diff --git a/frontend/src/sdk/createStore.ts b/frontend/src/sdk/createStore.ts index d5d0d90..97d602a 100644 --- a/frontend/src/sdk/createStore.ts +++ b/frontend/src/sdk/createStore.ts @@ -16,9 +16,17 @@ export const createStore = (store?: PluginStore) => { internalStore = new PluginStore(); internalStore.setLoader(loader); } + let storeMajorVersion: number; + try { + // @ts-ignore + storeMajorVersion = Number(internalStore?.sdkVersion?.split('.')?.[0] ?? '3'); + } catch { + // fallback to pre v4 version + storeMajorVersion = 3; + } getActivePlugins(window.insights.chrome.isBeta(), packageInfo.insights.appname).then((data) => { data.forEach(({ name: item, pathPrefix = '/api/plugins' }) => { - const url = `/beta${pathPrefix}/${item}/`; + const url = storeMajorVersion < 4 ? `/beta${pathPrefix}/${item}/` : `/beta${pathPrefix}/${item}/plugin-manifest.json`; internalStore!.loadPlugin(url); }); });