diff --git a/package.json b/package.json index 59bfca1a..c218588a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "impro", - "version": "0.17.175", + "version": "0.17.176", "type": "module", "scripts": { "start": "rm -rf \"${BUILD_DIR:-build}\" && NODE_ENV=development eleventy --serve", diff --git a/src/js/mainLayout.js b/src/js/mainLayout.js index 2715a0ff..fd96b362 100644 --- a/src/js/mainLayout.js +++ b/src/js/mainLayout.js @@ -4,10 +4,7 @@ import { auth } from "/js/auth.js"; import { sidebarTemplate } from "/js/templates/sidebar.template.js"; import { footerTemplate } from "/js/templates/footer.template.js"; import { eyeIconTemplate } from "/js/templates/icons/eyeIcon.template.js"; -import { - getPluginPreviewIdsFromQueryParam, - PLUGIN_PREVIEW_QUERY_PARAM, -} from "/js/plugins/pluginService.js"; +import { PLUGIN_PREVIEW_QUERY_PARAM } from "/js/plugins/pluginService.js"; function exitPluginPreview() { const url = new URL(window.location.href); @@ -152,7 +149,6 @@ export class MainLayout extends Layout { } }; - const previewIds = getPluginPreviewIdsFromQueryParam(); this.#disposeEffect = effect(() => { const currentRoute = router.$currentRoute.get(); const layoutOptions = currentRoute?.options?.layoutOptions ?? {}; @@ -161,14 +157,9 @@ export class MainLayout extends Layout { typeof layoutOptions.activeNavItem === "function" ? layoutOptions.activeNavItem(currentRoute.params) : (layoutOptions.activeNavItem ?? null); - const previewingPlugins = - previewIds.length > 0 - ? pluginService.$pluginsInfo - .get() - .filter( - (plugin) => previewIds.includes(plugin.id) && plugin.loaded, - ) - : []; + const previewingPlugins = pluginService.isPreviewMode + ? pluginService.$pluginsInfo.get().filter((plugin) => plugin.loaded) + : []; render( mainLayoutTemplate({ isAuthenticated, diff --git a/src/js/plugins/pluginService.js b/src/js/plugins/pluginService.js index 5b0a97e0..93984134 100644 --- a/src/js/plugins/pluginService.js +++ b/src/js/plugins/pluginService.js @@ -171,6 +171,7 @@ export class PluginService extends ReactiveStore { this.prefManager.$installedPlugins.get(), ); this.session = session; + this.isPreviewMode = false; this._renderContext = null; this._dataLayer = null; this._setupRegistries(); @@ -392,6 +393,7 @@ export class PluginService extends ReactiveStore { } const previewPluginIds = getPluginPreviewIdsFromQueryParam(); if (previewPluginIds.length > 0 && !this.session) { + this.isPreviewMode = true; // Serial to avoid racing on preferences for (const previewPluginId of previewPluginIds) { await this._installPreviewPlugin(previewPluginId); @@ -453,7 +455,7 @@ export class PluginService extends ReactiveStore { const permissions = getPermissionsFromManifest(manifest); if (!isEmptyPermissions(permissions)) { showToast( - `"${manifest.name}" can't be previewed because it requires additional permissions.`, + `"${manifest.name}" can't be previewed because it requires user permissions.`, { style: "error", timeout: 5000 }, ); return; diff --git a/src/js/views/home.view.js b/src/js/views/home.view.js index 4f78fad4..1f0bd6ef 100644 --- a/src/js/views/home.view.js +++ b/src/js/views/home.view.js @@ -50,6 +50,7 @@ class HomeView extends View { if ( !isAuthenticated && + !pluginService.isPreviewMode && !sessionStorage.getItem(WELCOME_MODAL_SEEN_STORAGE_KEY) ) { sessionStorage.setItem(WELCOME_MODAL_SEEN_STORAGE_KEY, "true");