Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

UN-3308 [FEAT] Register marketplace landing routes (plugin-gated) (#2022)

Athulc14a3b3acfa2
diff --git a/frontend/src/routes/Router.jsx b/frontend/src/routes/Router.jsx
index fe0ddc077..4c02ed1fd 100644
--- a/frontend/src/routes/Router.jsx
+++ b/frontend/src/routes/Router.jsx
@@ -10,7 +10,33 @@ 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 { useMainAppRoutes } from "./useMainAppRoutes.js";
+import { isModuleMissing, useMainAppRoutes } from "./useMainAppRoutes.js";
+
+// Marketplace buyer pages must be reachable at TOP-LEVEL paths: Tackle's
+// post-purchase redirect is one static URL per environment
+// (https://<env>/marketplace-landing?...) and cannot carry a per-buyer
+// :orgName segment. The org-scoped variants under :orgName remain
+// registered in useMainAppRoutes for in-app navigation; these top-level
+// routes are the marketplace entry points. The landing page handles its
+// own auth (redirects unauthenticated buyers through signup preserving
+// the query params), so they sit outside RequireAuth.
+let MarketplaceLandingEntry;
+let MarketplaceStripeConflictEntry;
+try {
+ const marketplaceMod = await import("../plugins/marketplace");
+ MarketplaceLandingEntry = marketplaceMod.MarketplaceLandingPage;
+ MarketplaceStripeConflictEntry = marketplaceMod.MarketplaceStripeConflictPage;
+} catch (err) {
+ // Expected in OSS builds where the cloud plugin is absent.
+ if (!isModuleMissing(err)) {
+ // eslint-disable-next-line no-console
+ console.error(
+ "[marketplace] Plugin import failed unexpectedly; marketplace " +
+ "entry routes disabled",
+ err,
+ );
+ }
+}
let PublicPromptStudioHelper;
@@ -168,6 +194,18 @@ function Router() {
{PaymentSuccessful && (
<Route path="/payment/success" element={<PaymentSuccessful />} />
)}
+ {MarketplaceLandingEntry && (
+ <Route
+ path="/marketplace-landing"
+ element={<MarketplaceLandingEntry />}
+ />
+ )}
+ {MarketplaceStripeConflictEntry && (
+ <Route
+ path="/marketplace-stripe-conflict"
+ element={<MarketplaceStripeConflictEntry />}
+ />
+ )}
{CustomPlanCheckoutPage && (
<Route
path="/subscription/custom"
diff --git a/frontend/src/routes/useMainAppRoutes.js b/frontend/src/routes/useMainAppRoutes.js
index 53c9695b8..078fffcac 100644
--- a/frontend/src/routes/useMainAppRoutes.js
+++ b/frontend/src/routes/useMainAppRoutes.js
@@ -121,6 +121,27 @@ 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"
@@ -130,12 +151,7 @@ try {
// Expected in OSS builds where the cloud plugin is absent. Surface
// anything that isn't a missing-module error so syntax/runtime
// failures inside the plugin don't silently disable the route.
- const msg = err?.message || "";
- const isModuleMissing =
- err?.code === "MODULE_NOT_FOUND" ||
- msg.includes("Failed to fetch dynamically imported module") ||
- msg.includes("Cannot find module");
- if (!isModuleMissing) {
+ if (!isModuleMissing(err)) {
// eslint-disable-next-line no-console
console.error(
"[prompt-change-indicator] ReadOnlyReviewPage import failed unexpectedly",
@@ -168,11 +184,44 @@ try {
// Do nothing, Not-found Page will be triggered.
}
+let MarketplaceLandingPage;
+let MarketplaceStripeConflictPage;
+try {
+ const mod = await import("../plugins/marketplace");
+ MarketplaceLandingPage = mod.MarketplaceLandingPage;
+ MarketplaceStripeConflictPage = mod.MarketplaceStripeConflictPage;
+} catch (err) {
+ // Expected in OSS builds where the cloud plugin is absent. Surface
+ // anything that isn't a missing-module error so syntax/runtime
+ // failures inside the plugin don't silently de-register the routes.
+ // (See isModuleMissing for the browser-classification limitation.)
+ if (!isModuleMissing(err)) {
+ // eslint-disable-next-line no-console
+ console.error(
+ "[marketplace] Plugin import failed unexpectedly; marketplace " +
+ "routes disabled",
+ err,
+ );
+ }
+}
+
function useMainAppRoutes() {
const routes = (
<>
<Route path=":orgName" element={<FullPageLayout />}>
<Route path="onboard" element={<OnBoardPage />} />
+ {MarketplaceLandingPage && (
+ <Route
+ path="marketplace-landing"
+ element={<MarketplaceLandingPage />}
+ />
+ )}
+ {MarketplaceStripeConflictPage && (
+ <Route
+ path="marketplace-stripe-conflict"
+ element={<MarketplaceStripeConflictPage />}
+ />
+ )}
</Route>
{ChatAppLayout && ChatAppPage && (
<Route path=":orgName" element={<ChatAppLayout />}>