@burdenoff/microfe-billing 2026.706.1 → 2026.715.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.
@@ -4,195 +4,203 @@ import { BillingAdminRoutes as n } from "./BillingAdminRoutes.js";
4
4
  import { useCallback as r, useEffect as i } from "react";
5
5
  import { ErrorBoundary as a } from "@burdenoff/fe-libs/shared/components";
6
6
  import { FeatureFlagProvider as o } from "@burdenoff/fe-libs/shared/feature-flags";
7
- import { Activity as s, Blocks as c, Coins as l, Gauge as u, Gift as d, Landmark as f, LayoutDashboard as p, Package as m, RefreshCw as h, RotateCcw as g, Settings as _, Ticket as v, TicketCheck as y, TrendingUp as b } from "lucide-react";
8
- import { jsx as x } from "react/jsx-runtime";
9
- import { useI18n as S } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
7
+ 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
+ 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 C = (C) => {
12
- let { t: w } = S(), T = r((e, t) => {
13
- let n = w(e);
11
+ var w = (w) => {
12
+ let { t: T } = C(), E = r((e, t) => {
13
+ let n = T(e);
14
14
  return n === e ? t : n;
15
- }, [w]), { registerNavItems: E, registerFooterItems: D, basePath: O = "/", mode: k = "user" } = C, A = (e, t) => (e.endsWith("/") ? e.slice(0, -1) : e) + (t.startsWith("/") ? t : `/${t}`);
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}`);
16
16
  return i(() => {
17
- if (!E) return;
17
+ if (!D) return;
18
18
  let e = [
19
19
  {
20
20
  id: "billing-overview",
21
- label: T("billing.nav.billing", "Billing"),
22
- path: O === "/" ? "/" : A(O, "overview"),
23
- icon: /* @__PURE__ */ x(p, { size: 20 }),
21
+ label: E("billing.nav.billing", "Billing"),
22
+ path: k === "/" ? "/" : j(k, "overview"),
23
+ icon: /* @__PURE__ */ S(m, { size: 20 }),
24
24
  order: 100,
25
25
  group: "billing"
26
26
  },
27
27
  {
28
28
  id: "billing-subscriptions",
29
- label: T("billing.nav.subscriptions", "Subscriptions"),
30
- path: A(O, "subscriptions"),
31
- icon: /* @__PURE__ */ x(h, { size: 20 }),
29
+ label: E("billing.nav.subscriptions", "Subscriptions"),
30
+ path: j(k, "subscriptions"),
31
+ icon: /* @__PURE__ */ S(g, { size: 20 }),
32
32
  order: 110,
33
33
  group: "billing"
34
34
  },
35
35
  {
36
36
  id: "billing-plans",
37
- label: T("billing.nav.plans", "Plans"),
38
- path: A(O, "plans"),
39
- icon: /* @__PURE__ */ x(m, { size: 20 }),
37
+ label: E("billing.nav.plans", "Plans"),
38
+ path: j(k, "plans"),
39
+ icon: /* @__PURE__ */ S(h, { size: 20 }),
40
40
  order: 120,
41
41
  group: "billing"
42
42
  },
43
43
  {
44
44
  id: "billing-addons",
45
- label: T("billing.nav.addons", "Addons"),
46
- path: A(O, "addons"),
47
- icon: /* @__PURE__ */ x(c, { size: 20 }),
45
+ label: E("billing.nav.addons", "Addons"),
46
+ path: j(k, "addons"),
47
+ icon: /* @__PURE__ */ S(c, { size: 20 }),
48
48
  order: 130,
49
49
  group: "billing"
50
50
  },
51
51
  {
52
52
  id: "billing-usage",
53
- label: T("billing.nav.usage", "Usage"),
54
- path: A(O, "usage"),
55
- icon: /* @__PURE__ */ x(s, { size: 20 }),
53
+ label: E("billing.nav.usage", "Usage"),
54
+ path: j(k, "usage"),
55
+ icon: /* @__PURE__ */ S(s, { size: 20 }),
56
56
  order: 180,
57
57
  group: "billing"
58
58
  },
59
59
  {
60
60
  id: "billing-affiliate",
61
- label: T("billing.nav.affiliate", "Affiliate"),
62
- path: A(O, "affiliate"),
63
- icon: /* @__PURE__ */ x(y, { size: 20 }),
61
+ label: E("billing.nav.affiliate", "Affiliate"),
62
+ path: j(k, "affiliate"),
63
+ icon: /* @__PURE__ */ S(b, { size: 20 }),
64
64
  order: 190,
65
65
  group: "billing"
66
66
  },
67
67
  {
68
68
  id: "billing-earnings",
69
- label: T("billing.nav.earnings", "Earnings"),
70
- path: A(O, "earnings"),
71
- icon: /* @__PURE__ */ x(l, { size: 20 }),
69
+ label: E("billing.nav.earnings", "Earnings"),
70
+ path: j(k, "earnings"),
71
+ icon: /* @__PURE__ */ S(l, { size: 20 }),
72
72
  order: 200,
73
73
  group: "billing"
74
74
  },
75
75
  {
76
76
  id: "billing-payouts",
77
- label: T("billing.nav.payouts", "Payouts"),
78
- path: A(O, "payouts"),
79
- icon: /* @__PURE__ */ x(f, { size: 20 }),
77
+ label: E("billing.nav.payouts", "Payouts"),
78
+ path: j(k, "payouts"),
79
+ icon: /* @__PURE__ */ S(p, { size: 20 }),
80
80
  order: 205,
81
81
  group: "billing"
82
82
  },
83
83
  {
84
84
  id: "billing-settings",
85
- label: T("billing.nav.settings", "Settings"),
86
- path: A(O, "settings"),
87
- icon: /* @__PURE__ */ x(_, { size: 20 }),
85
+ label: E("billing.nav.settings", "Settings"),
86
+ path: j(k, "settings"),
87
+ icon: /* @__PURE__ */ S(v, { size: 20 }),
88
88
  order: 210,
89
89
  group: "billing"
90
90
  }
91
91
  ], t = [
92
92
  {
93
93
  id: "billing-plans",
94
- label: T("billing.nav.plans", "Plans"),
95
- path: A(O, "plans"),
96
- icon: /* @__PURE__ */ x(m, { size: 20 }),
94
+ label: E("billing.nav.plans", "Plans"),
95
+ path: j(k, "plans"),
96
+ icon: /* @__PURE__ */ S(h, { size: 20 }),
97
97
  order: 100,
98
98
  group: "billing"
99
99
  },
100
100
  {
101
101
  id: "billing-addons",
102
- label: T("billing.nav.addons", "Addons"),
103
- path: A(O, "addons"),
104
- icon: /* @__PURE__ */ x(c, { size: 20 }),
102
+ label: E("billing.nav.addons", "Addons"),
103
+ path: j(k, "addons"),
104
+ icon: /* @__PURE__ */ S(c, { size: 20 }),
105
105
  order: 110,
106
106
  group: "billing"
107
107
  },
108
108
  {
109
109
  id: "billing-quotas",
110
- label: T("billing.nav.quotas", "Quotas"),
111
- path: A(O, "quotas"),
112
- icon: /* @__PURE__ */ x(u, { size: 20 }),
110
+ label: E("billing.nav.quotas", "Quotas"),
111
+ path: j(k, "quotas"),
112
+ icon: /* @__PURE__ */ S(d, { size: 20 }),
113
113
  order: 120,
114
114
  group: "billing"
115
115
  },
116
116
  {
117
117
  id: "billing-coupons",
118
- label: T("billing.nav.coupons", "Coupons"),
119
- path: A(O, "coupons"),
120
- icon: /* @__PURE__ */ x(v, { size: 20 }),
118
+ label: E("billing.nav.coupons", "Coupons"),
119
+ path: j(k, "coupons"),
120
+ icon: /* @__PURE__ */ S(y, { size: 20 }),
121
121
  order: 130,
122
122
  group: "billing"
123
123
  },
124
124
  {
125
125
  id: "billing-promotions",
126
- label: T("billing.nav.promotions", "Promotions"),
127
- path: A(O, "promotions"),
128
- icon: /* @__PURE__ */ x(d, { size: 20 }),
126
+ label: E("billing.nav.promotions", "Promotions"),
127
+ path: j(k, "promotions"),
128
+ icon: /* @__PURE__ */ S(f, { size: 20 }),
129
129
  order: 135,
130
130
  group: "billing"
131
131
  },
132
132
  {
133
133
  id: "billing-credits-admin",
134
- label: T("billing.nav.creditGrants", "Credit Grants"),
135
- path: A(O, "credits"),
136
- icon: /* @__PURE__ */ x(l, { size: 20 }),
134
+ label: E("billing.nav.creditGrants", "Credit Grants"),
135
+ path: j(k, "credits"),
136
+ icon: /* @__PURE__ */ S(l, { size: 20 }),
137
137
  order: 150,
138
138
  group: "billing"
139
139
  },
140
140
  {
141
141
  id: "billing-refunds",
142
- label: T("billing.nav.refunds", "Refunds"),
143
- path: A(O, "refunds"),
144
- icon: /* @__PURE__ */ x(g, { size: 20 }),
142
+ label: E("billing.nav.refunds", "Refunds"),
143
+ path: j(k, "refunds"),
144
+ icon: /* @__PURE__ */ S(_, { size: 20 }),
145
145
  order: 160,
146
146
  group: "billing"
147
147
  },
148
+ {
149
+ id: "billing-admin-developer-revenue",
150
+ label: E("billing.nav.developerRevenue", "Developer Revenue"),
151
+ path: j(k, "developer-revenue"),
152
+ icon: /* @__PURE__ */ S(u, { size: 20 }),
153
+ order: 164,
154
+ group: "billing"
155
+ },
148
156
  {
149
157
  id: "billing-admin-payouts",
150
- label: T("billing.nav.payouts", "Payouts"),
151
- path: A(O, "payouts"),
152
- icon: /* @__PURE__ */ x(f, { size: 20 }),
158
+ label: E("billing.nav.payouts", "Payouts"),
159
+ path: j(k, "payouts"),
160
+ icon: /* @__PURE__ */ S(p, { size: 20 }),
153
161
  order: 165,
154
162
  group: "billing"
155
163
  },
156
164
  {
157
165
  id: "billing-analytics",
158
- label: T("billing.nav.analytics", "Analytics"),
159
- path: A(O, "analytics"),
160
- icon: /* @__PURE__ */ x(b, { size: 20 }),
166
+ label: E("billing.nav.analytics", "Analytics"),
167
+ path: j(k, "analytics"),
168
+ icon: /* @__PURE__ */ S(x, { size: 20 }),
161
169
  order: 170,
162
170
  group: "billing"
163
171
  }
164
172
  ];
165
- return E(k === "admin" ? t : e);
173
+ return D(A === "admin" ? t : e);
166
174
  }, [
167
- E,
168
- O,
175
+ D,
169
176
  k,
170
- T
177
+ A,
178
+ E
171
179
  ]), i(() => {
172
- if (D) return D([{
180
+ if (O) return O([{
173
181
  id: "billing-status",
174
- label: T("billing.nav.billingReady", "Billing Ready"),
182
+ label: E("billing.nav.billingReady", "Billing Ready"),
175
183
  type: "status",
176
184
  order: 10,
177
185
  section: "left"
178
186
  }]);
179
- }, [D, T]), /* @__PURE__ */ x(a, {
180
- fallback: /* @__PURE__ */ x("div", {
187
+ }, [O, E]), /* @__PURE__ */ S(a, {
188
+ fallback: /* @__PURE__ */ S("div", {
181
189
  className: "flex min-h-[240px] items-center justify-center px-6 py-10 text-center text-sm text-text-secondary",
182
- children: T("billing.errorBoundary.message", "Something went wrong loading this module. Please refresh the page.")
190
+ children: E("billing.errorBoundary.message", "Something went wrong loading this module. Please refresh the page.")
183
191
  }),
184
- children: /* @__PURE__ */ x(o, {
192
+ children: /* @__PURE__ */ S(o, {
185
193
  workspaceId: null,
186
194
  gateway: "global",
187
195
  defaultEnabled: !0,
188
- children: /* @__PURE__ */ x(e, {
189
- ...C,
190
- children: x(k === "admin" ? n : t, {})
196
+ children: /* @__PURE__ */ S(e, {
197
+ ...w,
198
+ children: S(A === "admin" ? n : t, {})
191
199
  })
192
200
  })
193
201
  });
194
202
  };
195
203
  //#endregion
196
- export { C as BillingRoot };
204
+ export { w as BillingRoot };
197
205
 
198
206
  //# 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} 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-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":";;;;;;;;;;AA0DA,IAAa,KAAqC,MAAU;CAC1D,IAAM,EAAE,SAAM,GAAS,EACjB,IAAK,GACR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GAA1B,EAAsB,CAAwB;IAClD,CAAA;GACE,CAAA;EACR,CAAA"}
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,GAAS,EACjB,IAAK,GACR,GAAa,MAA6B;EACzC,IAAM,IAAa,EAAE,EAAI;AACzB,SAAO,MAAe,IAAM,IAAW;IAEzC,CAAC,EAAE,CACJ,EACK,EAAE,qBAAkB,wBAAqB,cAAW,KAAK,UAAO,WAAW,GAG3E,KAAY,GAAc,OACZ,EAAK,SAAS,IAAI,GAAG,EAAK,MAAM,GAAG,GAAG,GAAG,MACzC,EAAK,WAAW,IAAI,GAAG,IAAO,IAAI;AA8LtD,QAzLA,QAAgB;AACd,MAAI,CAAC,EAAkB;EAEvB,I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AAU;IAC3C,MAAM,EAAS,GAAU,UAAU;IACnC,MAAM,kBAAC,GAAD,EAAW,MAAM,IAAM,CAAA;IAC7B,OAAO;IACP,OAAO;IACR;GACD;IACE,IAAI;IACJ,OAAO,EAAG,gCAAgC,oBAAoB;IAC9D,MAAM,EAAS,GAAU,oBAAoB;IAC7C,MAAM,kBAAC,GAAD,EAAY,MAAM,IAAM,CAAA;IAC9B,OAAO;IACP,OAAO;IACR;GACD;IACE,IAAI;IACJ,OAAO,EAAG,uBAAuB,UAAU;IAC3C,MAAM,EAAS,GAAU,UAAU;IACnC,MAAM,kBAAC,GAAD,EAAU,MAAM,IAAM,CAAA;IAC5B,OAAO;IACP,OAAO;IACR;GACD;IACE,IAAI;IACJ,OAAO,EAAG,yBAAyB,YAAY;IAC/C,MAAM,EAAS,GAAU,YAAY;IACrC,MAAM,kBAAC,GAAD,EAAY,MAAM,IAAM,CAAA;IAC9B,OAAO;IACP,OAAO;IACR;GACF;AAID,SADgB,EADC,MAAS,UAAU,IAAgB,EACV;IAEzC;EAAC;EAAkB;EAAU;EAAM;EAAG,CAAC,EAG1C,QAAgB;AACT,QAaL,QADgB,EAVI,CAClB;GACE,IAAI;GACJ,OAAO,EAAG,4BAA4B,gBAAgB;GACtD,MAAM;GACN,OAAO;GACP,SAAS;GACV,CACF,CAE+C;IAE/C,CAAC,GAAqB,EAAG,CAAC,EAG3B,kBAAC,GAAD;EACE,UACE,kBAAC,OAAD;GAAK,WAAU;aACZ,EACC,iCACA,qEACD;GACG,CAAA;YAGR,kBAAC,GAAD;GAAqB,aAAa;GAAM,SAAQ;GAAS,gBAAgB;aACvE,kBAAC,GAAD;IAAiB,GAAI;cACC,EAAnB,MAAS,UAAW,IAAyB,GAA1B,EAAsB,CAAwB;IAClD,CAAA;GACE,CAAA;EACR,CAAA"}
@@ -154,7 +154,7 @@ var Ye = () => {
154
154
  currency: z.selectedCurrency || "USD"
155
155
  },
156
156
  skip: k !== "CREDITS"
157
- }), J = l(() => Mt?.getCostOfCredits?.amount && q > 0 ? Mt.getCostOfCredits.amount / q : .01, [Mt, q]), Y = l(() => Dt?.getPaymentMethods ?? [], [Dt]), X = l(() => St?.getBillingAccountsByOrg ?? [], [St]), Z = l(() => {
157
+ }), J = l(() => Mt?.getCostOfCredits?.amount && q > 0 ? Mt.getCostOfCredits.amount / q : .01, [Mt, q]), Y = l(() => Dt?.getPaymentMethods ?? [], [Dt]), X = l(() => St?.myBillingAccounts ?? [], [St]), Z = l(() => {
158
158
  if (!z.billingAccount) return;
159
159
  let e = X.find((e) => e.id === z.billingAccount?.id)?.billingAddresses;
160
160
  if (e && e.length > 0) return e[0]?.country || void 0;
@@ -1293,7 +1293,7 @@ var Ye = () => {
1293
1293
  hasAddress: !!(z.billingAccount.billingAddresses?.[0]?.line1?.trim() && z.billingAccount.billingAddresses?.[0]?.postalCode?.trim()),
1294
1294
  onCompleted: () => {
1295
1295
  ct.current = !0, st(!1), Rt(), wt().then((e) => {
1296
- let t = (e.data?.getBillingAccountsByOrg ?? []).find((e) => e.id === z.billingAccount?.id);
1296
+ let t = (e.data?.myBillingAccounts ?? []).find((e) => e.id === z.billingAccount?.id);
1297
1297
  t && z.setBillingAccount(t);
1298
1298
  });
1299
1299
  },