@burdenoff/microfe-billing 2026.830.1 → 2026.830.2

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.
@@ -1,89 +1,86 @@
1
1
  import { BillingProvider as e } from "./providers/BillingProvider.js";
2
- import { BillingUserRoutes as t } from "./BillingUserRoutes.js";
3
- import { BillingAdminRoutes as n } from "./BillingAdminRoutes.js";
4
- import { useCallback as r, useEffect as i } from "react";
2
+ import { useTr as t } from "./shared/hooks/useTr.js";
3
+ import { BillingUserRoutes as n } from "./BillingUserRoutes.js";
4
+ import { BillingAdminRoutes as r } from "./BillingAdminRoutes.js";
5
+ import { useEffect as i } from "react";
5
6
  import { ErrorBoundary as a } from "@burdenoff/fe-libs/shared/components";
6
7
  import { FeatureFlagProvider as o } from "@burdenoff/fe-libs/shared/feature-flags";
7
8
  import { Activity as s, Blocks as c, Coins as l, DollarSign as u, Gauge as d, Gift as f, Landmark as p, LayoutDashboard as m, Package as h, RefreshCw as g, RotateCcw as _, Settings as v, Ticket as y, TicketCheck as b, TrendingUp as x } from "lucide-react";
8
9
  import { jsx as S } from "react/jsx-runtime";
9
- import { useI18n as C } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
10
10
  //#region src/billing/BillingRoot.tsx
11
- var w = (w) => {
12
- let { t: T } = C(), E = r((e, t) => {
13
- let n = T(e);
14
- return n === e ? t : n;
15
- }, [T]), { registerNavItems: D, registerFooterItems: O, basePath: k = "/", mode: A = "user" } = w, j = (e, t) => (e.endsWith("/") ? e.slice(0, -1) : e) + (t.startsWith("/") ? t : `/${t}`);
11
+ var C = (C) => {
12
+ let w = t(), { registerNavItems: T, registerFooterItems: E, basePath: D = "/", mode: O = "user" } = C, k = (e, t) => (e.endsWith("/") ? e.slice(0, -1) : e) + (t.startsWith("/") ? t : `/${t}`);
16
13
  return i(() => {
17
- if (!D) return;
14
+ if (!T) return;
18
15
  let e = [
19
16
  {
20
17
  id: "billing-overview",
21
- label: E("billing.nav.billing", "Billing"),
22
- path: k === "/" ? "/" : j(k, "overview"),
18
+ label: w("billing.nav.billing", "Billing"),
19
+ path: D === "/" ? "/" : k(D, "overview"),
23
20
  icon: /* @__PURE__ */ S(m, { size: 20 }),
24
21
  order: 100,
25
22
  group: "billing"
26
23
  },
27
24
  {
28
25
  id: "billing-subscriptions",
29
- label: E("billing.nav.subscriptions", "Subscriptions"),
30
- path: j(k, "subscriptions"),
26
+ label: w("billing.nav.subscriptions", "Subscriptions"),
27
+ path: k(D, "subscriptions"),
31
28
  icon: /* @__PURE__ */ S(g, { size: 20 }),
32
29
  order: 110,
33
30
  group: "billing"
34
31
  },
35
32
  {
36
33
  id: "billing-plans",
37
- label: E("billing.nav.plans", "Plans"),
38
- path: j(k, "plans"),
34
+ label: w("billing.nav.plans", "Plans"),
35
+ path: k(D, "plans"),
39
36
  icon: /* @__PURE__ */ S(h, { size: 20 }),
40
37
  order: 120,
41
38
  group: "billing"
42
39
  },
43
40
  {
44
41
  id: "billing-addons",
45
- label: E("billing.nav.addons", "Addons"),
46
- path: j(k, "addons"),
42
+ label: w("billing.nav.addons", "Addons"),
43
+ path: k(D, "addons"),
47
44
  icon: /* @__PURE__ */ S(c, { size: 20 }),
48
45
  order: 130,
49
46
  group: "billing"
50
47
  },
51
48
  {
52
49
  id: "billing-usage",
53
- label: E("billing.nav.usage", "Usage"),
54
- path: j(k, "usage"),
50
+ label: w("billing.nav.usage", "Usage"),
51
+ path: k(D, "usage"),
55
52
  icon: /* @__PURE__ */ S(s, { size: 20 }),
56
53
  order: 180,
57
54
  group: "billing"
58
55
  },
59
56
  {
60
57
  id: "billing-affiliate",
61
- label: E("billing.nav.affiliate", "Affiliate"),
62
- path: j(k, "affiliate"),
58
+ label: w("billing.nav.affiliate", "Affiliate"),
59
+ path: k(D, "affiliate"),
63
60
  icon: /* @__PURE__ */ S(b, { size: 20 }),
64
61
  order: 190,
65
62
  group: "billing"
66
63
  },
67
64
  {
68
65
  id: "billing-earnings",
69
- label: E("billing.nav.earnings", "Earnings"),
70
- path: j(k, "earnings"),
66
+ label: w("billing.nav.earnings", "Earnings"),
67
+ path: k(D, "earnings"),
71
68
  icon: /* @__PURE__ */ S(l, { size: 20 }),
72
69
  order: 200,
73
70
  group: "billing"
74
71
  },
75
72
  {
76
73
  id: "billing-payouts",
77
- label: E("billing.nav.payouts", "Payouts"),
78
- path: j(k, "payouts"),
74
+ label: w("billing.nav.payouts", "Payouts"),
75
+ path: k(D, "payouts"),
79
76
  icon: /* @__PURE__ */ S(p, { size: 20 }),
80
77
  order: 205,
81
78
  group: "billing"
82
79
  },
83
80
  {
84
81
  id: "billing-settings",
85
- label: E("billing.nav.settings", "Settings"),
86
- path: j(k, "settings"),
82
+ label: w("billing.nav.settings", "Settings"),
83
+ path: k(D, "settings"),
87
84
  icon: /* @__PURE__ */ S(v, { size: 20 }),
88
85
  order: 210,
89
86
  group: "billing"
@@ -91,116 +88,116 @@ var w = (w) => {
91
88
  ], t = [
92
89
  {
93
90
  id: "billing-plans",
94
- label: E("billing.nav.plans", "Plans"),
95
- path: j(k, "plans"),
91
+ label: w("billing.nav.plans", "Plans"),
92
+ path: k(D, "plans"),
96
93
  icon: /* @__PURE__ */ S(h, { size: 20 }),
97
94
  order: 100,
98
95
  group: "billing"
99
96
  },
100
97
  {
101
98
  id: "billing-addons",
102
- label: E("billing.nav.addons", "Addons"),
103
- path: j(k, "addons"),
99
+ label: w("billing.nav.addons", "Addons"),
100
+ path: k(D, "addons"),
104
101
  icon: /* @__PURE__ */ S(c, { size: 20 }),
105
102
  order: 110,
106
103
  group: "billing"
107
104
  },
108
105
  {
109
106
  id: "billing-quotas",
110
- label: E("billing.nav.quotas", "Quotas"),
111
- path: j(k, "quotas"),
107
+ label: w("billing.nav.quotas", "Quotas"),
108
+ path: k(D, "quotas"),
112
109
  icon: /* @__PURE__ */ S(d, { size: 20 }),
113
110
  order: 120,
114
111
  group: "billing"
115
112
  },
116
113
  {
117
114
  id: "billing-coupons",
118
- label: E("billing.nav.coupons", "Coupons"),
119
- path: j(k, "coupons"),
115
+ label: w("billing.nav.coupons", "Coupons"),
116
+ path: k(D, "coupons"),
120
117
  icon: /* @__PURE__ */ S(y, { size: 20 }),
121
118
  order: 130,
122
119
  group: "billing"
123
120
  },
124
121
  {
125
122
  id: "billing-promotions",
126
- label: E("billing.nav.promotions", "Promotions"),
127
- path: j(k, "promotions"),
123
+ label: w("billing.nav.promotions", "Promotions"),
124
+ path: k(D, "promotions"),
128
125
  icon: /* @__PURE__ */ S(f, { size: 20 }),
129
126
  order: 135,
130
127
  group: "billing"
131
128
  },
132
129
  {
133
130
  id: "billing-credits-admin",
134
- label: E("billing.nav.creditGrants", "Credit Grants"),
135
- path: j(k, "credits"),
131
+ label: w("billing.nav.creditGrants", "Credit Grants"),
132
+ path: k(D, "credits"),
136
133
  icon: /* @__PURE__ */ S(l, { size: 20 }),
137
134
  order: 150,
138
135
  group: "billing"
139
136
  },
140
137
  {
141
138
  id: "billing-refunds",
142
- label: E("billing.nav.refunds", "Refunds"),
143
- path: j(k, "refunds"),
139
+ label: w("billing.nav.refunds", "Refunds"),
140
+ path: k(D, "refunds"),
144
141
  icon: /* @__PURE__ */ S(_, { size: 20 }),
145
142
  order: 160,
146
143
  group: "billing"
147
144
  },
148
145
  {
149
146
  id: "billing-admin-developer-revenue",
150
- label: E("billing.nav.developerRevenue", "Developer Revenue"),
151
- path: j(k, "developer-revenue"),
147
+ label: w("billing.nav.developerRevenue", "Developer Revenue"),
148
+ path: k(D, "developer-revenue"),
152
149
  icon: /* @__PURE__ */ S(u, { size: 20 }),
153
150
  order: 164,
154
151
  group: "billing"
155
152
  },
156
153
  {
157
154
  id: "billing-admin-payouts",
158
- label: E("billing.nav.payouts", "Payouts"),
159
- path: j(k, "payouts"),
155
+ label: w("billing.nav.payouts", "Payouts"),
156
+ path: k(D, "payouts"),
160
157
  icon: /* @__PURE__ */ S(p, { size: 20 }),
161
158
  order: 165,
162
159
  group: "billing"
163
160
  },
164
161
  {
165
162
  id: "billing-analytics",
166
- label: E("billing.nav.analytics", "Analytics"),
167
- path: j(k, "analytics"),
163
+ label: w("billing.nav.analytics", "Analytics"),
164
+ path: k(D, "analytics"),
168
165
  icon: /* @__PURE__ */ S(x, { size: 20 }),
169
166
  order: 170,
170
167
  group: "billing"
171
168
  }
172
169
  ];
173
- return D(A === "admin" ? t : e);
170
+ return T(O === "admin" ? t : e);
174
171
  }, [
172
+ T,
175
173
  D,
176
- k,
177
- A,
178
- E
174
+ O,
175
+ w
179
176
  ]), i(() => {
180
- if (O) return O([{
177
+ if (E) return E([{
181
178
  id: "billing-status",
182
- label: E("billing.nav.billingReady", "Billing Ready"),
179
+ label: w("billing.nav.billingReady", "Billing Ready"),
183
180
  type: "status",
184
181
  order: 10,
185
182
  section: "left"
186
183
  }]);
187
- }, [O, E]), /* @__PURE__ */ S(a, {
184
+ }, [E, w]), /* @__PURE__ */ S(a, {
188
185
  fallback: /* @__PURE__ */ S("div", {
189
186
  className: "flex min-h-[240px] items-center justify-center px-6 py-10 text-center text-sm text-text-secondary",
190
- children: E("billing.errorBoundary.message", "Something went wrong loading this module. Please refresh the page.")
187
+ children: w("billing.errorBoundary.message", "Something went wrong loading this module. Please refresh the page.")
191
188
  }),
192
189
  children: /* @__PURE__ */ S(o, {
193
190
  workspaceId: null,
194
191
  gateway: "global",
195
192
  defaultEnabled: !0,
196
193
  children: /* @__PURE__ */ S(e, {
197
- ...w,
198
- children: S(A === "admin" ? n : t, {})
194
+ ...C,
195
+ children: S(O === "admin" ? r : n, {})
199
196
  })
200
197
  })
201
198
  });
202
199
  };
203
200
  //#endregion
204
- export { w as BillingRoot };
201
+ export { C as BillingRoot };
205
202
 
206
203
  //# sourceMappingURL=BillingRoot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BillingRoot.js","names":[],"sources":["../../src/billing/BillingRoot.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useCallback, useEffect } from 'react';\nimport { ErrorBoundary } from '@burdenoff/fe-libs/shared/components';\nimport { FeatureFlagProvider } from '@burdenoff/fe-libs/shared/feature-flags';\nimport {\n LayoutDashboard,\n RefreshCw,\n Package,\n Blocks,\n Gauge,\n RotateCcw,\n Activity,\n TrendingUp,\n Settings,\n Ticket,\n Coins,\n TicketCheck,\n Landmark,\n Gift,\n DollarSign,\n} from 'lucide-react';\nimport { BillingProvider } from './providers/BillingProvider';\nimport type { NavItem, BillingRootProps } from './types';\nimport { BillingUserRoutes } from './BillingUserRoutes';\nimport { BillingAdminRoutes } from './BillingAdminRoutes';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\n\n/**\n * Root component for the Billing 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 { BillingRoot, type BillingRootProps } from '@burdenoff/microfe-billing';\n *\n * function App() {\n * const props: BillingRootProps = {\n * basePath: '/billing',\n * navigate: (path) => router.push(path),\n * currentUser: { id: '1', email: 'user@example.com', firstName: 'John', lastName: 'Doe' },\n * workspaceId: 'ws-123',\n * orgId: 'org-123',\n * apiGatewayUrl: 'https://api.example.com/tenant/graphql',\n * authToken: 'token',\n * stripePublishableKey: 'pk_test_...',\n * razorpayKey: 'rzp_test_...',\n * onSubscriptionCreate: (subscription) => console.log('Subscription created:', subscription),\n * onSubscriptionUpdate: (subscription) => console.log('Subscription updated:', subscription),\n * onPaymentProcess: (payment) => console.log('Payment processed:', payment),\n * registerNavItems: (items) => { return () => {}; },\n * };\n *\n * return <BillingRoot {...props} />;\n * }\n * ```\n */\nexport const BillingRoot: FC<BillingRootProps> = (props) => {\n const { t } = useI18n();\n const tr = useCallback(\n (key: string, fallback: string): string => {\n const translated = t(key);\n return translated === key ? fallback : translated;\n },\n [t]\n );\n const { registerNavItems, registerFooterItems, basePath = '/', mode = 'user' } = props;\n\n // Helper to join paths correctly, avoiding double slashes\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 // Register navigation items with the shell based on mode\n useEffect(() => {\n if (!registerNavItems) return;\n\n const userNavItems: NavItem[] = [\n {\n id: 'billing-overview',\n label: tr('billing.nav.billing', 'Billing'),\n path: basePath === '/' ? '/' : joinPath(basePath, 'overview'),\n icon: <LayoutDashboard size={20} />,\n order: 100,\n group: 'billing',\n },\n {\n id: 'billing-subscriptions',\n label: tr('billing.nav.subscriptions', 'Subscriptions'),\n path: joinPath(basePath, 'subscriptions'),\n icon: <RefreshCw size={20} />,\n order: 110,\n group: 'billing',\n },\n {\n id: 'billing-plans',\n label: tr('billing.nav.plans', 'Plans'),\n path: joinPath(basePath, 'plans'),\n icon: <Package size={20} />,\n order: 120,\n group: 'billing',\n },\n {\n id: 'billing-addons',\n label: tr('billing.nav.addons', 'Addons'),\n path: joinPath(basePath, 'addons'),\n icon: <Blocks size={20} />,\n order: 130,\n group: 'billing',\n },\n {\n id: 'billing-usage',\n label: tr('billing.nav.usage', 'Usage'),\n path: joinPath(basePath, 'usage'),\n icon: <Activity size={20} />,\n order: 180,\n group: 'billing',\n },\n {\n id: 'billing-affiliate',\n label: tr('billing.nav.affiliate', 'Affiliate'),\n path: joinPath(basePath, 'affiliate'),\n icon: <TicketCheck size={20} />,\n order: 190,\n group: 'billing',\n },\n {\n id: 'billing-earnings',\n label: tr('billing.nav.earnings', 'Earnings'),\n path: joinPath(basePath, 'earnings'),\n icon: <Coins size={20} />,\n order: 200,\n group: 'billing',\n },\n {\n id: 'billing-payouts',\n label: tr('billing.nav.payouts', 'Payouts'),\n path: joinPath(basePath, 'payouts'),\n icon: <Landmark size={20} />,\n order: 205,\n group: 'billing',\n },\n {\n id: 'billing-settings',\n label: tr('billing.nav.settings', 'Settings'),\n path: joinPath(basePath, 'settings'),\n icon: <Settings size={20} />,\n order: 210,\n group: 'billing',\n },\n ];\n\n const adminNavItems: NavItem[] = [\n {\n id: 'billing-plans',\n label: tr('billing.nav.plans', 'Plans'),\n path: joinPath(basePath, 'plans'),\n icon: <Package size={20} />,\n order: 100,\n group: 'billing',\n },\n {\n id: 'billing-addons',\n label: tr('billing.nav.addons', 'Addons'),\n path: joinPath(basePath, 'addons'),\n icon: <Blocks size={20} />,\n order: 110,\n group: 'billing',\n },\n {\n id: 'billing-quotas',\n label: tr('billing.nav.quotas', 'Quotas'),\n path: joinPath(basePath, 'quotas'),\n icon: <Gauge size={20} />,\n order: 120,\n group: 'billing',\n },\n {\n id: 'billing-coupons',\n label: tr('billing.nav.coupons', 'Coupons'),\n path: joinPath(basePath, 'coupons'),\n icon: <Ticket size={20} />,\n order: 130,\n group: 'billing',\n },\n {\n id: 'billing-promotions',\n label: tr('billing.nav.promotions', 'Promotions'),\n path: joinPath(basePath, 'promotions'),\n icon: <Gift size={20} />,\n order: 135,\n group: 'billing',\n },\n\n {\n id: 'billing-credits-admin',\n label: tr('billing.nav.creditGrants', 'Credit Grants'),\n path: joinPath(basePath, 'credits'),\n icon: <Coins size={20} />,\n order: 150,\n group: 'billing',\n },\n {\n id: 'billing-refunds',\n label: tr('billing.nav.refunds', 'Refunds'),\n path: joinPath(basePath, 'refunds'),\n icon: <RotateCcw size={20} />,\n order: 160,\n group: 'billing',\n },\n {\n id: 'billing-admin-developer-revenue',\n label: tr('billing.nav.developerRevenue', 'Developer Revenue'),\n path: joinPath(basePath, 'developer-revenue'),\n icon: <DollarSign size={20} />,\n order: 164,\n group: 'billing',\n },\n {\n id: 'billing-admin-payouts',\n label: tr('billing.nav.payouts', 'Payouts'),\n path: joinPath(basePath, 'payouts'),\n icon: <Landmark size={20} />,\n order: 165,\n group: 'billing',\n },\n {\n id: 'billing-analytics',\n label: tr('billing.nav.analytics', 'Analytics'),\n path: joinPath(basePath, 'analytics'),\n icon: <TrendingUp size={20} />,\n order: 170,\n group: 'billing',\n },\n ];\n\n const navItems = mode === 'admin' ? adminNavItems : userNavItems;\n const cleanup = registerNavItems(navItems);\n return cleanup;\n }, [registerNavItems, basePath, mode, tr]);\n\n // Register footer items (example: billing status indicator in left section)\n useEffect(() => {\n if (!registerFooterItems) return;\n\n const footerItems = [\n {\n id: 'billing-status',\n label: tr('billing.nav.billingReady', 'Billing Ready'),\n type: 'status' as const,\n order: 10,\n section: 'left' as const,\n },\n ];\n\n const cleanup = registerFooterItems(footerItems);\n return cleanup;\n }, [registerFooterItems, tr]);\n\n return (\n <ErrorBoundary\n fallback={\n <div className=\"flex min-h-[240px] items-center justify-center px-6 py-10 text-center text-sm text-text-secondary\">\n {tr(\n 'billing.errorBoundary.message',\n 'Something went wrong loading this module. Please refresh the page.'\n )}\n </div>\n }\n >\n <FeatureFlagProvider workspaceId={null} gateway=\"global\" defaultEnabled={true}>\n <BillingProvider {...props}>\n {mode === 'admin' ? <BillingAdminRoutes /> : <BillingUserRoutes />}\n </BillingProvider>\n </FeatureFlagProvider>\n </ErrorBoundary>\n );\n};\n"],"mappings":";;;;;;;;;;AA2DA,IAAa,KAAqC,MAAU;CAC1D,IAAM,EAAE,SAAM,EAAQ,GAChB,IAAK,GACR,GAAa,MAA6B;EACzC,IAAM,IAAa,EAAE,CAAG;EACxB,OAAO,MAAe,IAAM,IAAW;CACzC,GACA,CAAC,CAAC,CACJ,GACM,EAAE,qBAAkB,wBAAqB,cAAW,KAAK,UAAO,WAAW,GAG3E,KAAY,GAAc,OACZ,EAAK,SAAS,GAAG,IAAI,EAAK,MAAM,GAAG,EAAE,IAAI,MACzC,EAAK,WAAW,GAAG,IAAI,IAAO,IAAI;CA8LtD,OAzLA,QAAgB;EACd,IAAI,CAAC,GAAkB;EAEvB,IAAM,IAA0B;GAC9B;IACE,IAAI;IACJ,OAAO,EAAG,uBAAuB,SAAS;IAC1C,MAAM,MAAa,MAAM,MAAM,EAAS,GAAU,UAAU;IAC5D,MAAM,kBAAC,GAAD,EAAiB,MAAM,GAAK,CAAA;IAClC,OAAO;IACP,OAAO;GAC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IAC5C,MAAM,kBAAC,GAAD,EAAY,MAAM,GAAK,CAAA;IAC7B,OAAO;IACP,OAAO;GACT;GACA;IACE,IAAI;IACJ,OAAO,EAAG,uBAAuB,SAAS;IAC1C,MAAM,EAAS,GAAU,SAAS;IAClC,MAAM,kBAAC,GAAD,EAAU,MAAM,GAAK,CAAA;IAC3B,OAAO;IACP,OAAO;GACT;GACA;IACE,IAAI;IACJ,OAAO,EAAG,yBAAyB,WAAW;IAC9C,MAAM,EAAS,GAAU,WAAW;IACpC,MAAM,kBAAC,GAAD,EAAY,MAAM,GAAK,CAAA;IAC7B,OAAO;IACP,OAAO;GACT;EACF;EAIA,OADgB,EADC,MAAS,UAAU,IAAgB,CAE7C;CACT,GAAG;EAAC;EAAkB;EAAU;EAAM;CAAE,CAAC,GAGzC,QAAgB;EACT,OAaL,OADgB,EAAoB,CATlC;GACE,IAAI;GACJ,OAAO,EAAG,4BAA4B,eAAe;GACrD,MAAM;GACN,OAAO;GACP,SAAS;EACX,CAGkC,CAC7B;CACT,GAAG,CAAC,GAAqB,CAAE,CAAC,GAG1B,kBAAC,GAAD;EACE,UACE,kBAAC,OAAD;GAAK,WAAU;aACZ,EACC,iCACA,oEACF;EACG,CAAA;YAGP,kBAAC,GAAD;GAAqB,aAAa;GAAM,SAAQ;GAAS,gBAAgB;aACvE,kBAAC,GAAD;IAAiB,GAAI;cACC,EAAnB,MAAS,UAAW,IAAyB,GAA1B,CAAqB,CAAwB;GAClD,CAAA;EACE,CAAA;CACR,CAAA;AAEnB"}
1
+ {"version":3,"file":"BillingRoot.js","names":[],"sources":["../../src/billing/BillingRoot.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useEffect } from 'react';\nimport { ErrorBoundary } from '@burdenoff/fe-libs/shared/components';\nimport { FeatureFlagProvider } from '@burdenoff/fe-libs/shared/feature-flags';\nimport {\n LayoutDashboard,\n RefreshCw,\n Package,\n Blocks,\n Gauge,\n RotateCcw,\n Activity,\n TrendingUp,\n Settings,\n Ticket,\n Coins,\n TicketCheck,\n Landmark,\n Gift,\n DollarSign,\n} from 'lucide-react';\nimport { BillingProvider } from './providers/BillingProvider';\nimport type { NavItem, BillingRootProps } from './types';\nimport { BillingUserRoutes } from './BillingUserRoutes';\nimport { BillingAdminRoutes } from './BillingAdminRoutes';\nimport { useTr } from './shared/hooks/useTr';\n\n/**\n * Root component for the Billing 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 { BillingRoot, type BillingRootProps } from '@burdenoff/microfe-billing';\n *\n * function App() {\n * const props: BillingRootProps = {\n * basePath: '/billing',\n * navigate: (path) => router.push(path),\n * currentUser: { id: '1', email: 'user@example.com', firstName: 'John', lastName: 'Doe' },\n * workspaceId: 'ws-123',\n * orgId: 'org-123',\n * apiGatewayUrl: 'https://api.example.com/tenant/graphql',\n * authToken: 'token',\n * stripePublishableKey: 'pk_test_...',\n * razorpayKey: 'rzp_test_...',\n * onSubscriptionCreate: (subscription) => console.log('Subscription created:', subscription),\n * onSubscriptionUpdate: (subscription) => console.log('Subscription updated:', subscription),\n * onPaymentProcess: (payment) => console.log('Payment processed:', payment),\n * registerNavItems: (items) => { return () => {}; },\n * };\n *\n * return <BillingRoot {...props} />;\n * }\n * ```\n */\nexport const BillingRoot: FC<BillingRootProps> = (props) => {\n const tr = useTr();\n const { registerNavItems, registerFooterItems, basePath = '/', mode = 'user' } = props;\n\n // Helper to join paths correctly, avoiding double slashes\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 // Register navigation items with the shell based on mode\n useEffect(() => {\n if (!registerNavItems) return;\n\n const userNavItems: NavItem[] = [\n {\n id: 'billing-overview',\n label: tr('billing.nav.billing', 'Billing'),\n path: basePath === '/' ? '/' : joinPath(basePath, 'overview'),\n icon: <LayoutDashboard size={20} />,\n order: 100,\n group: 'billing',\n },\n {\n id: 'billing-subscriptions',\n label: tr('billing.nav.subscriptions', 'Subscriptions'),\n path: joinPath(basePath, 'subscriptions'),\n icon: <RefreshCw size={20} />,\n order: 110,\n group: 'billing',\n },\n {\n id: 'billing-plans',\n label: tr('billing.nav.plans', 'Plans'),\n path: joinPath(basePath, 'plans'),\n icon: <Package size={20} />,\n order: 120,\n group: 'billing',\n },\n {\n id: 'billing-addons',\n label: tr('billing.nav.addons', 'Addons'),\n path: joinPath(basePath, 'addons'),\n icon: <Blocks size={20} />,\n order: 130,\n group: 'billing',\n },\n {\n id: 'billing-usage',\n label: tr('billing.nav.usage', 'Usage'),\n path: joinPath(basePath, 'usage'),\n icon: <Activity size={20} />,\n order: 180,\n group: 'billing',\n },\n {\n id: 'billing-affiliate',\n label: tr('billing.nav.affiliate', 'Affiliate'),\n path: joinPath(basePath, 'affiliate'),\n icon: <TicketCheck size={20} />,\n order: 190,\n group: 'billing',\n },\n {\n id: 'billing-earnings',\n label: tr('billing.nav.earnings', 'Earnings'),\n path: joinPath(basePath, 'earnings'),\n icon: <Coins size={20} />,\n order: 200,\n group: 'billing',\n },\n {\n id: 'billing-payouts',\n label: tr('billing.nav.payouts', 'Payouts'),\n path: joinPath(basePath, 'payouts'),\n icon: <Landmark size={20} />,\n order: 205,\n group: 'billing',\n },\n {\n id: 'billing-settings',\n label: tr('billing.nav.settings', 'Settings'),\n path: joinPath(basePath, 'settings'),\n icon: <Settings size={20} />,\n order: 210,\n group: 'billing',\n },\n ];\n\n const adminNavItems: NavItem[] = [\n {\n id: 'billing-plans',\n label: tr('billing.nav.plans', 'Plans'),\n path: joinPath(basePath, 'plans'),\n icon: <Package size={20} />,\n order: 100,\n group: 'billing',\n },\n {\n id: 'billing-addons',\n label: tr('billing.nav.addons', 'Addons'),\n path: joinPath(basePath, 'addons'),\n icon: <Blocks size={20} />,\n order: 110,\n group: 'billing',\n },\n {\n id: 'billing-quotas',\n label: tr('billing.nav.quotas', 'Quotas'),\n path: joinPath(basePath, 'quotas'),\n icon: <Gauge size={20} />,\n order: 120,\n group: 'billing',\n },\n {\n id: 'billing-coupons',\n label: tr('billing.nav.coupons', 'Coupons'),\n path: joinPath(basePath, 'coupons'),\n icon: <Ticket size={20} />,\n order: 130,\n group: 'billing',\n },\n {\n id: 'billing-promotions',\n label: tr('billing.nav.promotions', 'Promotions'),\n path: joinPath(basePath, 'promotions'),\n icon: <Gift size={20} />,\n order: 135,\n group: 'billing',\n },\n\n {\n id: 'billing-credits-admin',\n label: tr('billing.nav.creditGrants', 'Credit Grants'),\n path: joinPath(basePath, 'credits'),\n icon: <Coins size={20} />,\n order: 150,\n group: 'billing',\n },\n {\n id: 'billing-refunds',\n label: tr('billing.nav.refunds', 'Refunds'),\n path: joinPath(basePath, 'refunds'),\n icon: <RotateCcw size={20} />,\n order: 160,\n group: 'billing',\n },\n {\n id: 'billing-admin-developer-revenue',\n label: tr('billing.nav.developerRevenue', 'Developer Revenue'),\n path: joinPath(basePath, 'developer-revenue'),\n icon: <DollarSign size={20} />,\n order: 164,\n group: 'billing',\n },\n {\n id: 'billing-admin-payouts',\n label: tr('billing.nav.payouts', 'Payouts'),\n path: joinPath(basePath, 'payouts'),\n icon: <Landmark size={20} />,\n order: 165,\n group: 'billing',\n },\n {\n id: 'billing-analytics',\n label: tr('billing.nav.analytics', 'Analytics'),\n path: joinPath(basePath, 'analytics'),\n icon: <TrendingUp size={20} />,\n order: 170,\n group: 'billing',\n },\n ];\n\n const navItems = mode === 'admin' ? adminNavItems : userNavItems;\n const cleanup = registerNavItems(navItems);\n return cleanup;\n }, [registerNavItems, basePath, mode, tr]);\n\n // Register footer items (example: billing status indicator in left section)\n useEffect(() => {\n if (!registerFooterItems) return;\n\n const footerItems = [\n {\n id: 'billing-status',\n label: tr('billing.nav.billingReady', 'Billing Ready'),\n type: 'status' as const,\n order: 10,\n section: 'left' as const,\n },\n ];\n\n const cleanup = registerFooterItems(footerItems);\n return cleanup;\n }, [registerFooterItems, tr]);\n\n return (\n <ErrorBoundary\n fallback={\n <div className=\"flex min-h-[240px] items-center justify-center px-6 py-10 text-center text-sm text-text-secondary\">\n {tr(\n 'billing.errorBoundary.message',\n 'Something went wrong loading this module. Please refresh the page.'\n )}\n </div>\n }\n >\n <FeatureFlagProvider workspaceId={null} gateway=\"global\" defaultEnabled={true}>\n <BillingProvider {...props}>\n {mode === 'admin' ? <BillingAdminRoutes /> : <BillingUserRoutes />}\n </BillingProvider>\n </FeatureFlagProvider>\n </ErrorBoundary>\n );\n};\n"],"mappings":";;;;;;;;;;AA2DA,IAAa,KAAqC,MAAU;CAC1D,IAAM,IAAK,EAAM,GACX,EAAE,qBAAkB,wBAAqB,cAAW,KAAK,UAAO,WAAW,GAG3E,KAAY,GAAc,OACZ,EAAK,SAAS,GAAG,IAAI,EAAK,MAAM,GAAG,EAAE,IAAI,MACzC,EAAK,WAAW,GAAG,IAAI,IAAO,IAAI;CA8LtD,OAzLA,QAAgB;EACd,IAAI,CAAC,GAAkB;EAEvB,IAAM,IAA0B;GAC9B;IACE,IAAI;IACJ,OAAO,EAAG,uBAAuB,SAAS;IAC1C,MAAM,MAAa,MAAM,MAAM,EAAS,GAAU,UAAU;IAC5D,MAAM,kBAAC,GAAD,EAAiB,MAAM,GAAK,CAAA;IAClC,OAAO;IACP,OAAO;GACT;GACA;IACE,IAAI;IACJ,OAAO,EAAG,6BAA6B,eAAe;IACtD,MAAM,EAAS,GAAU,eAAe;IACxC,MAAM,kBAAC,GAAD,EAAW,MAAM,GAAK,CAAA;IAC5B,OAAO;IACP,OAAO;GACT;GACA;IACE,IAAI;IACJ,OAAO,EAAG,qBAAqB,OAAO;IACtC,MAAM,EAAS,GAAU,OAAO;IAChC,MAAM,kBAAC,GAAD,EAAS,MAAM,GAAK,CAAA;IAC1B,OAAO;IACP,OAAO;GACT;GACA;IACE,IAAI;IACJ,OAAO,EAAG,sBAAsB,QAAQ;IACxC,MAAM,EAAS,GA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