LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
UN-3308 [MISC] Add plugin-gated banner mount in PageLayout (#2029)
Athul41ff2346097f
diff --git a/frontend/src/helpers/pluginLoader.js b/frontend/src/helpers/pluginLoader.jsnew file mode 100644index 000000000..eefb19226--- /dev/null+++ b/frontend/src/helpers/pluginLoader.js@@ -0,0 +1,33 @@+// Classify a dynamic plugin-import failure as "plugin not shipped"+// (expected in OSS builds) vs. a real load failure.+//+// The PRIMARY signal in the shipped Vite bundle: vite.config.js's+// `optionalPluginImports` plugin resolves a missing optional-plugin path+// to a stub module whose body is `throw new Error('Optional plugin not+// available')`. That is the actual error an absent plugin throws in+// production, so it must be matched here or every OSS page load misfires+// the consumer's error branch.+//+// LIMITATION: this still isn't fully sound — a present-but-failed-to-load+// chunk (transient CDN/origin 5xx, a stale hashed asset) surfaces as+// "Failed to fetch dynamically imported module", and `MODULE_NOT_FOUND`+// is a Node/CJS code that only appears under jsdom/vitest, not the+// shipped bundle. So a transient chunk-load failure can be misread as+// "missing" and silently disable whatever the consumer gates on it —+// a route in the routers, the status banner in PageLayout — for that+// session. Same outcome as a bare `catch`, but genuine errors in the+// present-plugin case at least get logged. Centralized so any future+// hardening lands once.+//+// Zero-dependency on purpose: consumers include modules that import+// each other (Router/useMainAppRoutes/PageLayout), and this helper+// must never re-introduce an import cycle.+export function isModuleMissing(err) {+ const msg = err?.message || "";+ return (+ err?.code === "MODULE_NOT_FOUND" ||+ msg.includes("Optional plugin not available") ||+ msg.includes("Failed to fetch dynamically imported module") ||+ msg.includes("Cannot find module")+ );+}diff --git a/frontend/src/layouts/page-layout/PageLayout.jsx b/frontend/src/layouts/page-layout/PageLayout.jsxindex b9e4ccf6f..79deac2e1 100644--- a/frontend/src/layouts/page-layout/PageLayout.jsx+++ b/frontend/src/layouts/page-layout/PageLayout.jsx@@ -11,6 +11,26 @@ import {getLocalStorageValue,setLocalStorageValue,} from "../../helpers/localStorage";+import { isModuleMissing } from "../../helpers/pluginLoader.js";++// Optional status banner contributed by the marketplace plugin, when+// present. The plugin is absent in OSS builds — the import fails and+// nothing is mounted. The banner self-manages its visibility.+let MarketplacePendingBanner;+try {+ const marketplaceMod = await import("../../plugins/marketplace");+ MarketplacePendingBanner = marketplaceMod.MarketplacePendingBanner;+} catch (err) {+ // Missing plugin is the expected case; surface anything else so a+ // broken plugin doesn't silently unmount its UI.+ if (!isModuleMissing(err)) {+ // eslint-disable-next-line no-console+ console.error(+ "[marketplace] MarketplacePendingBanner import failed unexpectedly",+ err,+ );+ }+}function PageLayout({sideBarOptions,@@ -36,6 +56,7 @@ function PageLayout({/>)}<Layout>+ {MarketplacePendingBanner && <MarketplacePendingBanner />}<Outlet />{!hideSidebar && <div className="height-40" />}{showLogsAndNotifications && <DisplayLogsAndNotifications />}diff --git a/frontend/src/routes/Router.jsx b/frontend/src/routes/Router.jsxindex 4c02ed1fd..5c43ae4d5 100644--- a/frontend/src/routes/Router.jsx+++ b/frontend/src/routes/Router.jsx@@ -6,11 +6,12 @@ import { PersistentLogin } from "../components/helpers/auth/PersistentLogin.js";import { RequireAuth } from "../components/helpers/auth/RequireAuth.js";import { RequireGuest } from "../components/helpers/auth/RequireGuest.js";import { OAuthStatus } from "../components/oauth-ds/oauth-status/OAuthStatus.jsx";+import { isModuleMissing } from "../helpers/pluginLoader.js";import { LandingPage } from "../pages/LandingPage.jsx";import { OutputAnalyzerPage } from "../pages/OutputAnalyzerPage.jsx";import { SetOrgPage } from "../pages/SetOrgPage.jsx";import { ToolIdePage } from "../pages/ToolIdePage.jsx";-import { isModuleMissing, useMainAppRoutes } from "./useMainAppRoutes.js";+import { useMainAppRoutes } from "./useMainAppRoutes.js";// Marketplace buyer pages must be reachable at TOP-LEVEL paths: Tackle's// post-purchase redirect is one static URL per environmentdiff --git a/frontend/src/routes/useMainAppRoutes.js b/frontend/src/routes/useMainAppRoutes.jsindex 078fffcac..e748fa376 100644--- a/frontend/src/routes/useMainAppRoutes.js+++ b/frontend/src/routes/useMainAppRoutes.js@@ -5,6 +5,7 @@ import { ProjectHelper } from "../components/helpers/project/ProjectHelper.js";import { DefaultTriad } from "../components/settings/default-triad/DefaultTriad.jsx";import { PlatformSettings } from "../components/settings/platform/PlatformSettings.jsx";import { deploymentTypes } from "../helpers/GetStaticData.js";+import { isModuleMissing } from "../helpers/pluginLoader.js";import { FullPageLayout } from "../layouts/fullpage-payout/FullPageLayout.jsx";import { PageLayout } from "../layouts/page-layout/PageLayout.jsx";import { AgencyPage } from "../pages/AgencyPage.jsx";@@ -121,27 +122,6 @@ try {// Do nothing, Not-found Page will be triggered.}-// Best-effort classification of a dynamic-import rejection as "plugin-// not shipped" (expected in OSS builds) vs. a real load failure.-//-// LIMITATION: in a browser/Vite bundle this isn't fully sound — a-// genuinely-absent plugin and a present-but-failed-to-load chunk-// (transient CDN/origin 5xx, a stale hashed asset) both surface as-// "Failed to fetch dynamically imported module", and `MODULE_NOT_FOUND`-// is a Node/CJS code that only appears under jsdom/vitest, not the-// shipped bundle. So a transient chunk-load failure can be misread as-// "missing" and de-register the route for that session — same outcome-// as a bare `catch`, but genuine errors in the present-plugin case at-// least get logged. Centralized so any future hardening lands once.-export function isModuleMissing(err) {- const msg = err?.message || "";- return (- err?.code === "MODULE_NOT_FOUND" ||- msg.includes("Failed to fetch dynamically imported module") ||- msg.includes("Cannot find module")- );-}-try {const mod = await import("../plugins/prompt-change-indicator/ReadOnlyReviewPage.jsx"