| @@ -1,17 +1,12 @@ | ||
| 1 | 1 | const { pluginRecommendations = [] } = window?.extAgentData?.agentContext || {}; |
| 2 | 2 | const { adminUrl, homeUrl } = window?.extSharedData || {}; |
| 3 | 3 | |
| 4 | -export const getRedirectUrl = (redirectTo, options = {}) => { | |
| 5 | - if (redirectTo?.type === 'plugin-setup') { | |
| 6 | - const plugin = pluginRecommendations.find( | |
| 7 | - ({ slug }) => slug === options.pluginSlug, | |
| 8 | - ); | |
| 9 | - if (!plugin) return ''; | |
| 10 | - return makeRedirectUrl(plugin.redirectTo); | |
| 11 | - } | |
| 12 | - | |
| 13 | - return ''; | |
| 4 | +export const getPluginSetup = (pluginSlug) => { | |
| 5 | + const plugin = pluginRecommendations.find(({ slug }) => slug === pluginSlug); | |
| 6 | + if (!plugin?.redirectTo) return null; | |
| 7 | + const url = makeRedirectUrl(plugin.redirectTo); | |
| 8 | + return url ? { title: plugin.title, url } : null; | |
| 14 | 9 | }; |
| 15 | 10 | |
| 16 | 11 | const makeRedirectUrl = (url) => { |
| 17 | 12 | try { |