@burdenoff/microfe-store 2026.626.1 → 2026.703.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/StoreRoot.js CHANGED
@@ -1,139 +1,96 @@
1
1
  import { StoreProvider as e } from "./providers/StoreProvider.js";
2
- import { STORE_PERMISSIONS as t, useStorePermissions as n } from "./hooks/useStorePermissions.js";
3
- import { StoreRoutes as r } from "./StoreRoutes.js";
4
- import { useCart as i } from "./hooks/useCart.js";
5
- import { useEffect as a, useMemo as o } from "react";
6
- import { ErrorBoundary as s } from "@burdenoff/fe-libs/shared/components";
7
- import { FeatureFlagProvider as c } from "@burdenoff/fe-libs/shared/feature-flags";
8
- import { useI18n as l } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
9
- import { Briefcase as u, DollarSign as d, FileCheck as f, Key as p, LayoutDashboard as m, Package as h, Receipt as g, ShoppingBag as _, ShoppingCart as v, Upload as y } from "lucide-react";
10
- import { jsx as b } from "react/jsx-runtime";
2
+ import { StoreRoutes as t } from "./StoreRoutes.js";
3
+ import { useCart as n } from "./hooks/useCart.js";
4
+ import { useEffect as r, useMemo as i } from "react";
5
+ import { ErrorBoundary as a } from "@burdenoff/fe-libs/shared/components";
6
+ import { FeatureFlagProvider as o } from "@burdenoff/fe-libs/shared/feature-flags";
7
+ import { useI18n as s } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
8
+ import { Key as c, Package as l, Receipt as u, ShoppingBag as d, ShoppingCart as f } from "lucide-react";
9
+ import { jsx as p } from "react/jsx-runtime";
11
10
  //#region src/StoreRoot.tsx
12
- var x = (t) => {
13
- let { t: n } = l();
14
- return /* @__PURE__ */ b(c, {
11
+ var m = (t) => {
12
+ let { t: n } = s();
13
+ return /* @__PURE__ */ p(o, {
15
14
  workspaceId: t.workspaceId ?? null,
16
15
  gateway: "global",
17
16
  defaultEnabled: !0,
18
- children: /* @__PURE__ */ b(s, {
19
- fallback: /* @__PURE__ */ b("div", {
17
+ children: /* @__PURE__ */ p(a, {
18
+ fallback: /* @__PURE__ */ p("div", {
20
19
  className: "p-6 text-center text-text-secondary",
21
20
  children: n("common.moduleLoadError", { defaultValue: "Something went wrong loading this module. Please refresh the page." })
22
21
  }),
23
- children: /* @__PURE__ */ b(e, {
22
+ children: /* @__PURE__ */ p(e, {
24
23
  ...t,
25
- children: /* @__PURE__ */ b(S, { ...t })
24
+ children: /* @__PURE__ */ p(h, { ...t })
26
25
  })
27
26
  })
28
27
  });
29
- }, S = ({ registerNavItems: e, registerFooterItems: s, basePath: c = "/" }) => {
30
- let { itemCount: x } = i(), { permissions: S, hasPermission: C } = n(), { t: w } = l(), T = S.canPublish, E = C(t.EARNINGS_READ);
31
- a(() => {
28
+ }, h = ({ registerNavItems: e, registerFooterItems: a, basePath: o = "/" }) => {
29
+ let { itemCount: m } = n(), { t: h } = s();
30
+ r(() => {
32
31
  if (!e) return;
33
- let t = (e, t) => (e.endsWith("/") ? e.slice(0, -1) : e) + (t.startsWith("/") ? t : `/${t}`), n = [
32
+ let t = (e, t) => (e.endsWith("/") ? e.slice(0, -1) : e) + (t.startsWith("/") ? t : `/${t}`);
33
+ return e([
34
34
  {
35
35
  id: "store-marketplace",
36
- label: w("nav.marketplace", { defaultValue: "Marketplace" }),
37
- path: t(c, "marketplace"),
38
- icon: /* @__PURE__ */ b(_, { size: 20 }),
36
+ label: h("nav.marketplace", { defaultValue: "Marketplace" }),
37
+ path: t(o, "marketplace"),
38
+ icon: /* @__PURE__ */ p(d, { size: 20 }),
39
39
  order: 10,
40
40
  group: "store"
41
41
  },
42
42
  {
43
43
  id: "store-cart",
44
- label: w("nav.cart", { defaultValue: "Cart" }),
45
- path: t(c, "cart"),
46
- icon: /* @__PURE__ */ b(v, { size: 20 }),
47
- badge: x > 0 ? x : void 0,
44
+ label: h("nav.cart", { defaultValue: "Cart" }),
45
+ path: t(o, "cart"),
46
+ icon: /* @__PURE__ */ p(f, { size: 20 }),
47
+ badge: m > 0 ? m : void 0,
48
48
  order: 20,
49
49
  group: "store"
50
50
  },
51
51
  {
52
52
  id: "store-orders",
53
- label: w("nav.orders", { defaultValue: "My Orders" }),
54
- path: t(c, "orders"),
55
- icon: /* @__PURE__ */ b(g, { size: 20 }),
53
+ label: h("nav.orders", { defaultValue: "My Orders" }),
54
+ path: t(o, "orders"),
55
+ icon: /* @__PURE__ */ p(u, { size: 20 }),
56
56
  order: 30,
57
57
  group: "store"
58
58
  },
59
59
  {
60
60
  id: "store-installed",
61
- label: w("nav.installed", { defaultValue: "Installed Apps" }),
62
- path: t(c, "installed"),
63
- icon: /* @__PURE__ */ b(h, { size: 20 }),
61
+ label: h("nav.installed", { defaultValue: "Installed Apps" }),
62
+ path: t(o, "installed"),
63
+ icon: /* @__PURE__ */ p(l, { size: 20 }),
64
64
  order: 40,
65
65
  group: "store"
66
66
  },
67
67
  {
68
68
  id: "store-licenses",
69
- label: w("nav.licenses", { defaultValue: "Licenses" }),
70
- path: t(c, "licenses"),
71
- icon: /* @__PURE__ */ b(p, { size: 20 }),
69
+ label: h("nav.licenses", { defaultValue: "Licenses" }),
70
+ path: t(o, "licenses"),
71
+ icon: /* @__PURE__ */ p(c, { size: 20 }),
72
72
  order: 50,
73
73
  group: "store"
74
74
  }
75
- ];
76
- if (T) {
77
- let e = [
78
- {
79
- id: "store-publisher-dashboard",
80
- label: w("nav.publisherDashboard", { defaultValue: "Dashboard" }),
81
- path: t(c, "publisher"),
82
- icon: /* @__PURE__ */ b(m, { size: 20 }),
83
- order: 10
84
- },
85
- {
86
- id: "store-publisher-submit",
87
- label: w("nav.submitProduct", { defaultValue: "Submit Product" }),
88
- path: t(c, "publisher/submit"),
89
- icon: /* @__PURE__ */ b(y, { size: 20 }),
90
- order: 20
91
- },
92
- {
93
- id: "store-publisher-submissions",
94
- label: w("nav.submissions", { defaultValue: "Submissions" }),
95
- path: t(c, "publisher/submissions"),
96
- icon: /* @__PURE__ */ b(f, { size: 20 }),
97
- order: 30
98
- }
99
- ];
100
- E && e.push({
101
- id: "store-publisher-revenue",
102
- label: w("nav.revenue", { defaultValue: "Revenue" }),
103
- path: t(c, "publisher/revenue"),
104
- icon: /* @__PURE__ */ b(d, { size: 20 }),
105
- order: 40
106
- }), n.push({
107
- id: "store-publisher",
108
- label: w("nav.publisher", { defaultValue: "Publisher Portal" }),
109
- path: t(c, "publisher"),
110
- icon: /* @__PURE__ */ b(u, { size: 20 }),
111
- order: 60,
112
- group: "store",
113
- children: e
114
- });
115
- }
116
- return e(n);
75
+ ]);
117
76
  }, [
118
77
  e,
119
- c,
120
- x,
121
- T,
122
- E,
123
- w
78
+ o,
79
+ m,
80
+ h
124
81
  ]);
125
- let D = o(() => [{
82
+ let g = i(() => [{
126
83
  id: "store-status",
127
- label: w("store.footer.ready", { defaultValue: "Store Ready" }),
84
+ label: h("store.footer.ready", { defaultValue: "Store Ready" }),
128
85
  type: "status",
129
86
  order: 10,
130
87
  section: "left"
131
- }], [w]);
132
- return a(() => {
133
- if (s) return s(D);
134
- }, [s, D]), /* @__PURE__ */ b(r, {});
88
+ }], [h]);
89
+ return r(() => {
90
+ if (a) return a(g);
91
+ }, [a, g]), /* @__PURE__ */ p(t, {});
135
92
  };
136
93
  //#endregion
137
- export { x as StoreRoot };
94
+ export { m as StoreRoot };
138
95
 
139
96
  //# sourceMappingURL=StoreRoot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StoreRoot.js","names":[],"sources":["../src/StoreRoot.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useEffect, useMemo } from 'react';\nimport { ErrorBoundary } from '@burdenoff/fe-libs/shared/components';\nimport { FeatureFlagProvider } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n ShoppingBag,\n ShoppingCart,\n Receipt,\n Package,\n Key,\n Briefcase,\n LayoutDashboard,\n Upload,\n FileCheck,\n DollarSign,\n} from 'lucide-react';\nimport { StoreProvider } from './providers/StoreProvider';\nimport type { NavItem, StoreRootProps } from './types';\nimport { StoreRoutes } from './StoreRoutes';\nimport { useCart } from './hooks/useCart';\nimport { useStorePermissions, STORE_PERMISSIONS } from './hooks/useStorePermissions';\n\n/**\n * Root component for the Store microfrontend.\n *\n * This is the main entry point that host applications import and render.\n * It sets up the necessary providers and renders the internal routing.\n * Automatically registers navigation items with the shell if registration functions are provided.\n *\n * @example\n * ```tsx\n * import { StoreRoot, type StoreRootProps } from '@burdenoff/micro-fe/store';\n *\n * function App() {\n * const props: StoreRootProps = {\n * basePath: '/store',\n * navigate: (path) => router.push(path),\n * currentUser: { id: '1', email: 'user@example.com', firstName: 'John', lastName: 'Doe' },\n * workspaceId: 'ws-123',\n * organizationId: 'org-123',\n * apiGatewayUrl: 'https://api.example.com/tenant/graphql',\n * authToken: 'token',\n * registerNavItems: (items) => { return () => {}; },\n * };\n *\n * return <StoreRoot {...props} />;\n * }\n * ```\n */\nexport const StoreRoot: FC<StoreRootProps> = (props) => {\n const { t } = useI18n();\n\n return (\n <FeatureFlagProvider\n workspaceId={props.workspaceId ?? null}\n gateway=\"global\"\n defaultEnabled={true}\n >\n <ErrorBoundary\n fallback={\n <div className=\"p-6 text-center text-text-secondary\">\n {t('common.moduleLoadError', {\n defaultValue: 'Something went wrong loading this module. Please refresh the page.',\n })}\n </div>\n }\n >\n <StoreProvider {...props}>\n <StoreNavigationRegistration {...props} />\n </StoreProvider>\n </ErrorBoundary>\n </FeatureFlagProvider>\n );\n};\n\n/**\n * Internal component that handles navigation registration\n */\nconst StoreNavigationRegistration: FC<StoreRootProps> = ({\n registerNavItems,\n registerFooterItems,\n basePath = '/',\n}) => {\n const { itemCount } = useCart(); // Get item count from backend cart\n const { permissions, hasPermission } = useStorePermissions();\n const { t } = useI18n();\n\n // Extract primitive flags so the registration effect only re-runs when\n // values actually change — not on every re-render of the permissions\n // object or memoized `hasPermission` identity. Without this, the parent\n // shell's nav store subscription causes a render loop: register → state\n // change → parent re-render → new permissions object → effect re-run →\n // unregister → register → ... (\"Maximum update depth exceeded\").\n const canPublish = permissions.canPublish;\n const canReadEarnings = hasPermission(STORE_PERMISSIONS.EARNINGS_READ);\n\n // Register navigation items with the shell\n useEffect(() => {\n if (!registerNavItems) return;\n\n const joinPath = (base: string, path: string): string => {\n const cleanBase = base.endsWith('/') ? base.slice(0, -1) : base;\n const cleanPath = path.startsWith('/') ? path : `/${path}`;\n return cleanBase + cleanPath;\n };\n\n const navItems: NavItem[] = [\n {\n id: 'store-marketplace',\n label: t('nav.marketplace', { defaultValue: 'Marketplace' }),\n path: joinPath(basePath, 'marketplace'),\n icon: <ShoppingBag size={20} />,\n order: 10,\n group: 'store',\n },\n {\n id: 'store-cart',\n label: t('nav.cart', { defaultValue: 'Cart' }),\n path: joinPath(basePath, 'cart'),\n icon: <ShoppingCart size={20} />,\n badge: itemCount > 0 ? itemCount : undefined,\n order: 20,\n group: 'store',\n },\n {\n id: 'store-orders',\n label: t('nav.orders', { defaultValue: 'My Orders' }),\n path: joinPath(basePath, 'orders'),\n icon: <Receipt size={20} />,\n order: 30,\n group: 'store',\n },\n {\n id: 'store-installed',\n label: t('nav.installed', { defaultValue: 'Installed Apps' }),\n path: joinPath(basePath, 'installed'),\n icon: <Package size={20} />,\n order: 40,\n group: 'store',\n },\n {\n id: 'store-licenses',\n label: t('nav.licenses', { defaultValue: 'Licenses' }),\n path: joinPath(basePath, 'licenses'),\n icon: <Key size={20} />,\n order: 50,\n group: 'store',\n },\n ];\n\n if (canPublish) {\n const publisherChildren: NavItem[] = [\n {\n id: 'store-publisher-dashboard',\n label: t('nav.publisherDashboard', { defaultValue: 'Dashboard' }),\n path: joinPath(basePath, 'publisher'),\n icon: <LayoutDashboard size={20} />,\n order: 10,\n },\n {\n id: 'store-publisher-submit',\n label: t('nav.submitProduct', { defaultValue: 'Submit Product' }),\n path: joinPath(basePath, 'publisher/submit'),\n icon: <Upload size={20} />,\n order: 20,\n },\n {\n id: 'store-publisher-submissions',\n label: t('nav.submissions', { defaultValue: 'Submissions' }),\n path: joinPath(basePath, 'publisher/submissions'),\n icon: <FileCheck size={20} />,\n order: 30,\n },\n ];\n\n if (canReadEarnings) {\n publisherChildren.push({\n id: 'store-publisher-revenue',\n label: t('nav.revenue', { defaultValue: 'Revenue' }),\n path: joinPath(basePath, 'publisher/revenue'),\n icon: <DollarSign size={20} />,\n order: 40,\n });\n }\n\n navItems.push({\n id: 'store-publisher',\n label: t('nav.publisher', { defaultValue: 'Publisher Portal' }),\n path: joinPath(basePath, 'publisher'),\n icon: <Briefcase size={20} />,\n order: 60,\n group: 'store',\n children: publisherChildren,\n });\n }\n\n const cleanup = registerNavItems(navItems);\n return cleanup;\n }, [registerNavItems, basePath, itemCount, canPublish, canReadEarnings, t]);\n\n // Register footer items — memoized to avoid re-registering on every render.\n const footerItems = useMemo(\n () => [\n {\n id: 'store-status',\n label: t('store.footer.ready', { defaultValue: 'Store Ready' }),\n type: 'status' as const,\n order: 10,\n section: 'left' as const,\n },\n ],\n [t]\n );\n\n useEffect(() => {\n if (!registerFooterItems) return;\n const cleanup = registerFooterItems(footerItems);\n return cleanup;\n }, [registerFooterItems, footerItems]);\n\n return <StoreRoutes />;\n};\n"],"mappings":";;;;;;;;;;;AAkDA,IAAa,KAAiC,MAAU;CACtD,IAAM,EAAE,SAAM,GAAS;AAEvB,QACE,kBAAC,GAAD;EACE,aAAa,EAAM,eAAe;EAClC,SAAQ;EACR,gBAAgB;YAEhB,kBAAC,GAAD;GACE,UACE,kBAAC,OAAD;IAAK,WAAU;cACZ,EAAE,0BAA0B,EAC3B,cAAc,sEACf,CAAC;IACE,CAAA;aAGR,kBAAC,GAAD;IAAe,GAAI;cACjB,kBAAC,GAAD,EAA6B,GAAI,GAAS,CAAA;IAC5B,CAAA;GACF,CAAA;EACI,CAAA;GAOpB,KAAmD,EACvD,qBACA,wBACA,cAAW,UACP;CACJ,IAAM,EAAE,iBAAc,GAAS,EACzB,EAAE,gBAAa,qBAAkB,GAAqB,EACtD,EAA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,CAAA"}
1
+ {"version":3,"file":"StoreRoot.js","names":[],"sources":["../src/StoreRoot.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useEffect, useMemo } from 'react';\nimport { ErrorBoundary } from '@burdenoff/fe-libs/shared/components';\nimport { FeatureFlagProvider } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { ShoppingBag, ShoppingCart, Receipt, Package, Key } from 'lucide-react';\nimport { StoreProvider } from './providers/StoreProvider';\nimport type { NavItem, StoreRootProps } from './types';\nimport { StoreRoutes } from './StoreRoutes';\nimport { useCart } from './hooks/useCart';\n\n/**\n * Root component for the Store microfrontend.\n *\n * This is the main entry point that host applications import and render.\n * It sets up the necessary providers and renders the internal routing.\n * Automatically registers navigation items with the shell if registration functions are provided.\n *\n * @example\n * ```tsx\n * import { StoreRoot, type StoreRootProps } from '@burdenoff/micro-fe/store';\n *\n * function App() {\n * const props: StoreRootProps = {\n * basePath: '/store',\n * navigate: (path) => router.push(path),\n * currentUser: { id: '1', email: 'user@example.com', firstName: 'John', lastName: 'Doe' },\n * workspaceId: 'ws-123',\n * organizationId: 'org-123',\n * apiGatewayUrl: 'https://api.example.com/tenant/graphql',\n * authToken: 'token',\n * registerNavItems: (items) => { return () => {}; },\n * };\n *\n * return <StoreRoot {...props} />;\n * }\n * ```\n */\nexport const StoreRoot: FC<StoreRootProps> = (props) => {\n const { t } = useI18n();\n\n return (\n <FeatureFlagProvider\n workspaceId={props.workspaceId ?? null}\n gateway=\"global\"\n defaultEnabled={true}\n >\n <ErrorBoundary\n fallback={\n <div className=\"p-6 text-center text-text-secondary\">\n {t('common.moduleLoadError', {\n defaultValue: 'Something went wrong loading this module. Please refresh the page.',\n })}\n </div>\n }\n >\n <StoreProvider {...props}>\n <StoreNavigationRegistration {...props} />\n </StoreProvider>\n </ErrorBoundary>\n </FeatureFlagProvider>\n );\n};\n\n/**\n * Internal component that handles navigation registration\n */\nconst StoreNavigationRegistration: FC<StoreRootProps> = ({\n registerNavItems,\n registerFooterItems,\n basePath = '/',\n}) => {\n const { itemCount } = useCart();\n const { t } = useI18n();\n\n // Register navigation items with the shell\n useEffect(() => {\n if (!registerNavItems) return;\n\n const joinPath = (base: string, path: string): string => {\n const cleanBase = base.endsWith('/') ? base.slice(0, -1) : base;\n const cleanPath = path.startsWith('/') ? path : `/${path}`;\n return cleanBase + cleanPath;\n };\n\n const navItems: NavItem[] = [\n {\n id: 'store-marketplace',\n label: t('nav.marketplace', { defaultValue: 'Marketplace' }),\n path: joinPath(basePath, 'marketplace'),\n icon: <ShoppingBag size={20} />,\n order: 10,\n group: 'store',\n },\n {\n id: 'store-cart',\n label: t('nav.cart', { defaultValue: 'Cart' }),\n path: joinPath(basePath, 'cart'),\n icon: <ShoppingCart size={20} />,\n badge: itemCount > 0 ? itemCount : undefined,\n order: 20,\n group: 'store',\n },\n {\n id: 'store-orders',\n label: t('nav.orders', { defaultValue: 'My Orders' }),\n path: joinPath(basePath, 'orders'),\n icon: <Receipt size={20} />,\n order: 30,\n group: 'store',\n },\n {\n id: 'store-installed',\n label: t('nav.installed', { defaultValue: 'Installed Apps' }),\n path: joinPath(basePath, 'installed'),\n icon: <Package size={20} />,\n order: 40,\n group: 'store',\n },\n {\n id: 'store-licenses',\n label: t('nav.licenses', { defaultValue: 'Licenses' }),\n path: joinPath(basePath, 'licenses'),\n icon: <Key size={20} />,\n order: 50,\n group: 'store',\n },\n ];\n\n const cleanup = registerNavItems(navItems);\n return cleanup;\n }, [registerNavItems, basePath, itemCount, t]);\n\n // Register footer items — memoized to avoid re-registering on every render.\n const footerItems = useMemo(\n () => [\n {\n id: 'store-status',\n label: t('store.footer.ready', { defaultValue: 'Store Ready' }),\n type: 'status' as const,\n order: 10,\n section: 'left' as const,\n },\n ],\n [t]\n );\n\n useEffect(() => {\n if (!registerFooterItems) return;\n const cleanup = registerFooterItems(footerItems);\n return cleanup;\n }, [registerFooterItems, footerItems]);\n\n return <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IACR;GACD;IACE,IAAI;IACJ,OAAO,EAAE,iBAAiB,EAAE,cAAc,kBAAkB,CAAC;IAC7D,MAAM,EAAS,GAAU,YAAY;IACrC,MAAM,kBAAC,GAAD,EAAS,MAAM,IAAM,CAAA;IAC3B,OAAO;IACP,OAAO;IACR;GACD;IACE,IAAI;IACJ,OAAO,EAAE,gBAAgB,EAAE,cAAc,YAAY,CAAC;IACtD,MAAM,EAAS,GAAU,WAAW;IACpC,MAAM,kBAAC,GAAD,EAAK,MAAM,IAAM,CAAA;IACvB,OAAO;IACP,OAAO;IACR;GACF,CAEyC;IAEzC;EAAC;EAAkB;EAAU;EAAW;EAAE,CAAC;CAG9C,IAAM,IAAc,QACZ,CACJ;EACE,IAAI;EACJ,OAAO,EAAE,sBAAsB,EAAE,cAAc,eAAe,CAAC;EAC/D,MAAM;EACN,OAAO;EACP,SAAS;EACV,CACF,EACD,CAAC,EAAE,CACJ;AAQD,QANA,QAAgB;AACT,QAEL,QADgB,EAAoB,EAAY;IAE/C,CAAC,GAAqB,EAAY,CAAC,EAE/B,kBAAC,GAAD,EAAe,CAAA"}
@@ -1,26 +1,26 @@
1
1
  import { useStore as e } from "./providers/StoreProvider.js";
2
- import { STORE_PERMISSIONS as t, useStorePermissions as n } from "./hooks/useStorePermissions.js";
3
- import { AccessDenied as r } from "./components/AccessDenied.js";
4
- import { PageLoadingFallback as i } from "./components/RouteGuards.js";
5
- import { Suspense as a, lazy as o } from "react";
6
- import { FeatureGate as s } from "@burdenoff/fe-libs/shared/feature-flags";
7
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
- import { Navigate as u, Route as d, Routes as f } from "react-router-dom";
2
+ import { useStorePermissions as t } from "./hooks/useStorePermissions.js";
3
+ import { AccessDenied as n } from "./components/AccessDenied.js";
4
+ import { PageLoadingFallback as r } from "./components/RouteGuards.js";
5
+ import { Suspense as i, lazy as a } from "react";
6
+ import { FeatureGate as o } from "@burdenoff/fe-libs/shared/feature-flags";
7
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
8
+ import { Navigate as l, Route as u, Routes as d } from "react-router-dom";
9
9
  //#region src/StoreRoutes.tsx
10
- var p = o(() => import("./pages/MarketplaceHomePage.js").then((e) => ({ default: e.MarketplaceHomePage }))), m = o(() => import("./pages/InstalledAppsPage.js").then((e) => ({ default: e.InstalledAppsPage }))), h = o(() => import("./pages/ProductDetailPage.js").then((e) => ({ default: e.ProductDetailPage }))), g = o(() => import("./pages/CartPage.js").then((e) => ({ default: e.CartPage }))), _ = o(() => import("./pages/OrdersPage.js").then((e) => ({ default: e.OrdersPage }))), v = o(() => import("./pages/PublisherSubmitPage.js").then((e) => ({ default: e.PublisherSubmitPage }))), y = o(() => import("./pages/MyLicensesPage.js").then((e) => ({ default: e.MyLicensesPage }))), b = o(() => import("./pages/OrderConfirmationPage.js").then((e) => ({ default: e.OrderConfirmationPage }))), x = o(() => import("./pages/PublisherDashboardPage.js").then((e) => ({ default: e.PublisherDashboardPage }))), S = o(() => import("./pages/PublisherSubmissionsPage.js").then((e) => ({ default: e.PublisherSubmissionsPage }))), C = o(() => import("./pages/PublisherRevenuePage.js").then((e) => ({ default: e.PublisherRevenuePage }))), w = o(() => import("./pages/AppDetailPage.js").then((e) => ({ default: e.AppDetailPage }))), T = o(() => import("./pages/AppSettingsPage.js").then((e) => ({ default: e.AppSettingsPage }))), E = o(() => import("./pages/ProductReviewsPage.js").then((e) => ({ default: e.ProductReviewsPage })));
11
- function D({ title: e, featureFlag: t }) {
12
- return /* @__PURE__ */ c("div", {
10
+ var f = a(() => import("./pages/MarketplaceHomePage.js").then((e) => ({ default: e.MarketplaceHomePage }))), p = a(() => import("./pages/InstalledAppsPage.js").then((e) => ({ default: e.InstalledAppsPage }))), m = a(() => import("./pages/ProductDetailPage.js").then((e) => ({ default: e.ProductDetailPage }))), h = a(() => import("./pages/CartPage.js").then((e) => ({ default: e.CartPage }))), g = a(() => import("./pages/OrdersPage.js").then((e) => ({ default: e.OrdersPage }))), _ = a(() => import("./pages/MyLicensesPage.js").then((e) => ({ default: e.MyLicensesPage }))), v = a(() => import("./pages/OrderConfirmationPage.js").then((e) => ({ default: e.OrderConfirmationPage }))), y = a(() => import("./pages/AppDetailPage.js").then((e) => ({ default: e.AppDetailPage }))), b = a(() => import("./pages/AppSettingsPage.js").then((e) => ({ default: e.AppSettingsPage })));
11
+ function x({ title: e, featureFlag: t }) {
12
+ return /* @__PURE__ */ s("div", {
13
13
  className: "flex min-h-[400px] items-center justify-center p-6",
14
- children: /* @__PURE__ */ l("div", {
14
+ children: /* @__PURE__ */ c("div", {
15
15
  className: "max-w-md rounded-lg border border-border-subtle bg-bg-surface p-6 text-center shadow-sm",
16
- children: [/* @__PURE__ */ l("h2", {
16
+ children: [/* @__PURE__ */ c("h2", {
17
17
  className: "text-lg font-semibold text-text-primary",
18
18
  children: [e, " is not enabled"]
19
- }), /* @__PURE__ */ l("p", {
19
+ }), /* @__PURE__ */ c("p", {
20
20
  className: "mt-2 text-sm text-text-secondary",
21
21
  children: [
22
22
  "Ask an administrator to enable the ",
23
- /* @__PURE__ */ c("span", {
23
+ /* @__PURE__ */ s("span", {
24
24
  className: "font-mono",
25
25
  children: t
26
26
  }),
@@ -31,219 +31,154 @@ function D({ title: e, featureFlag: t }) {
31
31
  })
32
32
  });
33
33
  }
34
- function O({ title: e, featureFlag: t, allowed: n, isLoading: a, children: o }) {
35
- return a ? /* @__PURE__ */ c(i, {}) : /* @__PURE__ */ c(s, {
34
+ function S({ title: e, featureFlag: t, allowed: i, isLoading: a, children: c }) {
35
+ return a ? /* @__PURE__ */ s(r, {}) : /* @__PURE__ */ s(o, {
36
36
  flag: t,
37
37
  defaultValue: !0,
38
- fallback: /* @__PURE__ */ c(D, {
38
+ fallback: /* @__PURE__ */ s(x, {
39
39
  title: e,
40
40
  featureFlag: t
41
41
  }),
42
- children: n ? o : /* @__PURE__ */ c(r, {})
42
+ children: i ? c : /* @__PURE__ */ s(n, {})
43
43
  });
44
44
  }
45
- var k = () => {
46
- let { basePath: r } = e(), { permissions: o, hasPermission: s, isLoading: D } = n();
47
- return /* @__PURE__ */ l(f, { children: [
48
- /* @__PURE__ */ c(d, {
45
+ var C = () => {
46
+ let { basePath: n } = e(), { permissions: a, isLoading: o } = t();
47
+ return /* @__PURE__ */ c(d, { children: [
48
+ /* @__PURE__ */ s(u, {
49
49
  index: !0,
50
- element: /* @__PURE__ */ c(u, {
50
+ element: /* @__PURE__ */ s(l, {
51
51
  to: "marketplace",
52
52
  replace: !0
53
53
  })
54
54
  }),
55
- /* @__PURE__ */ c(d, {
55
+ /* @__PURE__ */ s(u, {
56
56
  path: "marketplace",
57
- element: /* @__PURE__ */ c(O, {
57
+ element: /* @__PURE__ */ s(S, {
58
58
  title: "Marketplace",
59
59
  featureFlag: "store.marketplace",
60
- allowed: o.canBrowse,
61
- isLoading: D,
62
- children: /* @__PURE__ */ c(a, {
63
- fallback: /* @__PURE__ */ c(i, {}),
64
- children: /* @__PURE__ */ c(p, {})
60
+ allowed: a.canBrowse,
61
+ isLoading: o,
62
+ children: /* @__PURE__ */ s(i, {
63
+ fallback: /* @__PURE__ */ s(r, {}),
64
+ children: /* @__PURE__ */ s(f, {})
65
65
  })
66
66
  })
67
67
  }),
68
- /* @__PURE__ */ c(d, {
68
+ /* @__PURE__ */ s(u, {
69
69
  path: "marketplace/product/:productId",
70
- element: /* @__PURE__ */ c(O, {
70
+ element: /* @__PURE__ */ s(S, {
71
71
  title: "Marketplace",
72
72
  featureFlag: "store.marketplace",
73
- allowed: o.canBrowse,
74
- isLoading: D,
75
- children: /* @__PURE__ */ c(a, {
76
- fallback: /* @__PURE__ */ c(i, {}),
77
- children: /* @__PURE__ */ c(h, {})
73
+ allowed: a.canBrowse,
74
+ isLoading: o,
75
+ children: /* @__PURE__ */ s(i, {
76
+ fallback: /* @__PURE__ */ s(r, {}),
77
+ children: /* @__PURE__ */ s(m, {})
78
78
  })
79
79
  })
80
80
  }),
81
- /* @__PURE__ */ c(d, {
81
+ /* @__PURE__ */ s(u, {
82
82
  path: "cart",
83
- element: /* @__PURE__ */ c(O, {
83
+ element: /* @__PURE__ */ s(S, {
84
84
  title: "Cart",
85
85
  featureFlag: "store.cart",
86
- allowed: o.canPurchase,
87
- isLoading: D,
88
- children: /* @__PURE__ */ c(a, {
89
- fallback: /* @__PURE__ */ c(i, {}),
90
- children: /* @__PURE__ */ c(g, {})
86
+ allowed: a.canPurchase,
87
+ isLoading: o,
88
+ children: /* @__PURE__ */ s(i, {
89
+ fallback: /* @__PURE__ */ s(r, {}),
90
+ children: /* @__PURE__ */ s(h, {})
91
91
  })
92
92
  })
93
93
  }),
94
- /* @__PURE__ */ c(d, {
94
+ /* @__PURE__ */ s(u, {
95
95
  path: "orders/:orderId/confirmation",
96
- element: /* @__PURE__ */ c(O, {
96
+ element: /* @__PURE__ */ s(S, {
97
97
  title: "Order confirmation",
98
98
  featureFlag: "store.orders",
99
- allowed: o.canPurchase,
100
- isLoading: D,
101
- children: /* @__PURE__ */ c(a, {
102
- fallback: /* @__PURE__ */ c(i, {}),
103
- children: /* @__PURE__ */ c(b, {})
99
+ allowed: a.canPurchase,
100
+ isLoading: o,
101
+ children: /* @__PURE__ */ s(i, {
102
+ fallback: /* @__PURE__ */ s(r, {}),
103
+ children: /* @__PURE__ */ s(v, {})
104
104
  })
105
105
  })
106
106
  }),
107
- /* @__PURE__ */ c(d, {
107
+ /* @__PURE__ */ s(u, {
108
108
  path: "orders",
109
- element: /* @__PURE__ */ c(O, {
109
+ element: /* @__PURE__ */ s(S, {
110
110
  title: "Orders",
111
111
  featureFlag: "store.orders",
112
- allowed: o.canPurchase,
113
- isLoading: D,
114
- children: /* @__PURE__ */ c(a, {
115
- fallback: /* @__PURE__ */ c(i, {}),
116
- children: /* @__PURE__ */ c(_, {})
112
+ allowed: a.canPurchase,
113
+ isLoading: o,
114
+ children: /* @__PURE__ */ s(i, {
115
+ fallback: /* @__PURE__ */ s(r, {}),
116
+ children: /* @__PURE__ */ s(g, {})
117
117
  })
118
118
  })
119
119
  }),
120
- /* @__PURE__ */ c(d, {
120
+ /* @__PURE__ */ s(u, {
121
121
  path: "installed",
122
- element: /* @__PURE__ */ c(O, {
122
+ element: /* @__PURE__ */ s(S, {
123
123
  title: "Installed apps",
124
124
  featureFlag: "store.installed",
125
- allowed: o.canInstall,
126
- isLoading: D,
127
- children: /* @__PURE__ */ c(a, {
128
- fallback: /* @__PURE__ */ c(i, {}),
129
- children: /* @__PURE__ */ c(m, {})
125
+ allowed: a.canInstall,
126
+ isLoading: o,
127
+ children: /* @__PURE__ */ s(i, {
128
+ fallback: /* @__PURE__ */ s(r, {}),
129
+ children: /* @__PURE__ */ s(p, {})
130
130
  })
131
131
  })
132
132
  }),
133
- /* @__PURE__ */ c(d, {
133
+ /* @__PURE__ */ s(u, {
134
134
  path: "installed/:installationId",
135
- element: /* @__PURE__ */ c(O, {
135
+ element: /* @__PURE__ */ s(S, {
136
136
  title: "Installed apps",
137
137
  featureFlag: "store.installed",
138
- allowed: o.canInstall,
139
- isLoading: D,
140
- children: /* @__PURE__ */ c(a, {
141
- fallback: /* @__PURE__ */ c(i, {}),
142
- children: /* @__PURE__ */ c(w, {})
138
+ allowed: a.canInstall,
139
+ isLoading: o,
140
+ children: /* @__PURE__ */ s(i, {
141
+ fallback: /* @__PURE__ */ s(r, {}),
142
+ children: /* @__PURE__ */ s(y, {})
143
143
  })
144
144
  })
145
145
  }),
146
- /* @__PURE__ */ c(d, {
146
+ /* @__PURE__ */ s(u, {
147
147
  path: "installed/:installationId/settings",
148
- element: /* @__PURE__ */ c(O, {
148
+ element: /* @__PURE__ */ s(S, {
149
149
  title: "Installed apps",
150
150
  featureFlag: "store.installed",
151
- allowed: o.canInstall,
152
- isLoading: D,
153
- children: /* @__PURE__ */ c(a, {
154
- fallback: /* @__PURE__ */ c(i, {}),
155
- children: /* @__PURE__ */ c(T, {})
151
+ allowed: a.canInstall,
152
+ isLoading: o,
153
+ children: /* @__PURE__ */ s(i, {
154
+ fallback: /* @__PURE__ */ s(r, {}),
155
+ children: /* @__PURE__ */ s(b, {})
156
156
  })
157
157
  })
158
158
  }),
159
- /* @__PURE__ */ c(d, {
159
+ /* @__PURE__ */ s(u, {
160
160
  path: "licenses",
161
- element: /* @__PURE__ */ c(O, {
161
+ element: /* @__PURE__ */ s(S, {
162
162
  title: "Licenses",
163
163
  featureFlag: "store.licenses",
164
- allowed: o.canManageLicenses,
165
- isLoading: D,
166
- children: /* @__PURE__ */ c(a, {
167
- fallback: /* @__PURE__ */ c(i, {}),
168
- children: /* @__PURE__ */ c(y, {})
164
+ allowed: a.canManageLicenses,
165
+ isLoading: o,
166
+ children: /* @__PURE__ */ s(i, {
167
+ fallback: /* @__PURE__ */ s(r, {}),
168
+ children: /* @__PURE__ */ s(_, {})
169
169
  })
170
170
  })
171
171
  }),
172
- /* @__PURE__ */ c(d, {
173
- path: "publisher",
174
- element: /* @__PURE__ */ c(O, {
175
- title: "Publisher portal",
176
- featureFlag: "store.publisher-portal",
177
- allowed: o.canPublish,
178
- isLoading: D,
179
- children: /* @__PURE__ */ c(a, {
180
- fallback: /* @__PURE__ */ c(i, {}),
181
- children: /* @__PURE__ */ c(x, {})
182
- })
183
- })
184
- }),
185
- /* @__PURE__ */ c(d, {
186
- path: "publisher/submit",
187
- element: /* @__PURE__ */ c(O, {
188
- title: "Publisher portal",
189
- featureFlag: "store.publisher-portal",
190
- allowed: o.canPublish,
191
- isLoading: D,
192
- children: /* @__PURE__ */ c(a, {
193
- fallback: /* @__PURE__ */ c(i, {}),
194
- children: /* @__PURE__ */ c(v, {})
195
- })
196
- })
197
- }),
198
- /* @__PURE__ */ c(d, {
199
- path: "publisher/submissions",
200
- element: /* @__PURE__ */ c(O, {
201
- title: "Publisher portal",
202
- featureFlag: "store.publisher-portal",
203
- allowed: o.canPublish,
204
- isLoading: D,
205
- children: /* @__PURE__ */ c(a, {
206
- fallback: /* @__PURE__ */ c(i, {}),
207
- children: /* @__PURE__ */ c(S, {})
208
- })
209
- })
210
- }),
211
- /* @__PURE__ */ c(d, {
212
- path: "publisher/revenue",
213
- element: /* @__PURE__ */ c(O, {
214
- title: "Publisher revenue",
215
- featureFlag: "store.publisher-portal.revenue",
216
- allowed: s(t.EARNINGS_READ),
217
- isLoading: D,
218
- children: /* @__PURE__ */ c(a, {
219
- fallback: /* @__PURE__ */ c(i, {}),
220
- children: /* @__PURE__ */ c(C, {})
221
- })
222
- })
223
- }),
224
- /* @__PURE__ */ c(d, {
225
- path: "publisher/product/:productId/reviews",
226
- element: /* @__PURE__ */ c(O, {
227
- title: "Publisher portal",
228
- featureFlag: "store.publisher-portal",
229
- allowed: o.canPublish,
230
- isLoading: D,
231
- children: /* @__PURE__ */ c(a, {
232
- fallback: /* @__PURE__ */ c(i, {}),
233
- children: /* @__PURE__ */ c(E, {})
234
- })
235
- })
236
- }),
237
- /* @__PURE__ */ c(d, {
172
+ /* @__PURE__ */ s(u, {
238
173
  path: "*",
239
- element: /* @__PURE__ */ c(u, {
240
- to: `${r}/marketplace`,
174
+ element: /* @__PURE__ */ s(l, {
175
+ to: `${n}/marketplace`,
241
176
  replace: !0
242
177
  })
243
178
  })
244
179
  ] });
245
180
  };
246
181
  //#endregion
247
- export { k as StoreRoutes };
182
+ export { C as StoreRoutes };
248
183
 
249
184
  //# sourceMappingURL=StoreRoutes.js.map