@burdenoff/microfe-billing 2026.706.1 → 2026.708.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"}
@@ -1,12 +1,12 @@
1
1
  import { gatewayGraphqlRequest as e } from "../../shared/utils/gatewayGraphql.js";
2
2
  import { directBillingGraphqlRequest as t } from "../../shared/utils/directBillingGraphql.js";
3
3
  import "../../shared/utils/index.js";
4
- import { AddPayoutAccountDocument as n, AdminPayoutRequestsDocument as r, AdminPayoutSummaryDocument as i, ApprovePayoutRequestDocument as a, ArchivePayoutAccountDocument as o, BillingDeveloperPortalRevenueDocument as s, MarkPayoutPaidDocument as c, MyEarningsEntriesDocument as l, MyEarningsSummaryDocument as u, MyPayoutAccountsDocument as d, MyPayoutRequestsDocument as f, RejectPayoutRequestDocument as p, SetDefaultPayoutAccountDocument as m, UpdatePayoutAccountDocument as h } from "../../../generated/global-operations.js";
4
+ import { AddPayoutAccountDocument as n, AdminDeveloperRevenueOrgDetailDocument as r, AdminDeveloperRevenueOrgsDocument as i, AdminPayoutRequestsDocument as a, AdminPayoutSummaryDocument as o, ApprovePayoutRequestDocument as s, ArchivePayoutAccountDocument as c, BillingDeveloperPortalRevenueDocument as l, MarkPayoutPaidDocument as u, MyEarningsEntriesDocument as d, MyEarningsSummaryDocument as f, MyPayoutAccountsDocument as p, MyPayoutRequestsDocument as m, RejectPayoutRequestDocument as h, RetrySaleCreditSyncDocument as g, SetDefaultPayoutAccountDocument as _, UpdatePayoutAccountDocument as v } from "../../../generated/global-operations.js";
5
5
  //#region src/billing/modules/earnings/api.ts
6
- async function g(t, n) {
6
+ async function y(t, n) {
7
7
  let r = await e({
8
8
  ...n,
9
- query: s,
9
+ query: l,
10
10
  variables: { organizationId: t }
11
11
  });
12
12
  return {
@@ -15,104 +15,140 @@ async function g(t, n) {
15
15
  payouts: r.developerOrgPayouts.edges.map((e) => e.node)
16
16
  };
17
17
  }
18
- async function _(e, n) {
18
+ async function b(e, n) {
19
19
  return (await t({
20
20
  ...n,
21
- query: u,
21
+ query: f,
22
22
  variables: { billingAccountId: e }
23
23
  })).myEarningsSummary;
24
24
  }
25
- async function v(e, n) {
25
+ async function x(e, n) {
26
26
  return (await t({
27
27
  ...n,
28
- query: l,
28
+ query: d,
29
29
  variables: { billingAccountId: e }
30
30
  })).myEarningsEntries.items;
31
31
  }
32
- async function y(e, n) {
32
+ async function S(e, n) {
33
33
  return (await t({
34
34
  ...n,
35
- query: d,
35
+ query: p,
36
36
  variables: { billingAccountId: e }
37
37
  })).myPayoutAccounts;
38
38
  }
39
- async function b(e, n) {
39
+ async function C(e, n) {
40
40
  return (await t({
41
41
  ...n,
42
- query: f,
42
+ query: m,
43
43
  variables: { billingAccountId: e }
44
44
  })).myPayoutRequests.items;
45
45
  }
46
- async function x(e, r) {
46
+ async function w(e, r) {
47
47
  await t({
48
48
  ...r,
49
49
  query: n,
50
50
  variables: { input: e }
51
51
  });
52
52
  }
53
- async function S(e, n, r) {
53
+ async function T(e, n, r) {
54
54
  await t({
55
55
  ...r,
56
- query: h,
56
+ query: v,
57
57
  variables: {
58
58
  id: e,
59
59
  input: n
60
60
  }
61
61
  });
62
62
  }
63
- async function C(e, n) {
63
+ async function E(e, n) {
64
64
  await t({
65
65
  ...n,
66
- query: m,
66
+ query: _,
67
67
  variables: { id: e }
68
68
  });
69
69
  }
70
- async function w(e, n) {
70
+ async function D(e, n) {
71
71
  await t({
72
72
  ...n,
73
- query: o,
73
+ query: c,
74
74
  variables: { id: e }
75
75
  });
76
76
  }
77
- async function T(e, t) {
77
+ async function O(e, t) {
78
78
  throw Error("Payout request not yet implemented");
79
79
  }
80
- async function E(e) {
80
+ async function k(e) {
81
81
  return (await t({
82
82
  ...e,
83
- query: i
83
+ query: o
84
84
  })).adminPayoutSummary;
85
85
  }
86
- async function D(e) {
86
+ async function A(e, n = {}) {
87
87
  return (await t({
88
88
  ...e,
89
- query: r
90
- })).adminPayoutRequests.items;
89
+ query: a,
90
+ variables: {
91
+ limit: n.limit ?? 50,
92
+ offset: n.offset ?? 0
93
+ }
94
+ })).adminPayoutRequests;
95
+ }
96
+ async function j(t) {
97
+ return (await e({
98
+ ...t,
99
+ query: i
100
+ })).developerOrganizations.edges.map((e) => e.node);
91
101
  }
92
- async function O(e, n, r) {
102
+ async function M(t, n) {
103
+ let i = await e({
104
+ ...n,
105
+ query: r,
106
+ variables: {
107
+ organizationId: t,
108
+ period: "monthly",
109
+ salesLimit: 20,
110
+ salesOffset: 0
111
+ }
112
+ });
113
+ return {
114
+ summary: i.developerOrgRevenueSummary,
115
+ unpaidSales: {
116
+ totalCount: i.developerOrgSales.totalCount,
117
+ items: i.developerOrgSales.edges.map((e) => e.node)
118
+ }
119
+ };
120
+ }
121
+ async function N(t, n) {
122
+ return (await e({
123
+ ...n,
124
+ query: g,
125
+ variables: { saleId: t }
126
+ })).retrySaleCreditSync;
127
+ }
128
+ async function P(e, n, r) {
93
129
  await t({
94
130
  ...r,
95
- query: a,
131
+ query: s,
96
132
  variables: {
97
133
  id: e,
98
134
  notes: n
99
135
  }
100
136
  });
101
137
  }
102
- async function k(e, n, r) {
138
+ async function F(e, n, r) {
103
139
  await t({
104
140
  ...r,
105
- query: p,
141
+ query: h,
106
142
  variables: {
107
143
  id: e,
108
144
  reason: n
109
145
  }
110
146
  });
111
147
  }
112
- async function A(e, n, r, i) {
148
+ async function I(e, n, r, i) {
113
149
  await t({
114
150
  ...i,
115
- query: c,
151
+ query: u,
116
152
  variables: {
117
153
  id: e,
118
154
  externalReference: n,
@@ -121,6 +157,6 @@ async function A(e, n, r, i) {
121
157
  });
122
158
  }
123
159
  //#endregion
124
- export { x as addPayoutAccount, O as approvePayoutRequest, w as archivePayoutAccount, D as fetchAdminPayoutRequests, E as fetchAdminPayoutSummary, g as fetchDeveloperPortalRevenueDashboard, v as fetchEarningsEntries, _ as fetchEarningsSummary, y as fetchPayoutAccounts, b as fetchPayoutRequests, A as markPayoutPaid, k as rejectPayoutRequest, T as requestPayout, C as setDefaultPayoutAccount, S as updatePayoutAccount };
160
+ export { w as addPayoutAccount, P as approvePayoutRequest, D as archivePayoutAccount, M as fetchAdminDeveloperRevenueOrgDetail, j as fetchAdminDeveloperRevenueOrgs, A as fetchAdminPayoutRequests, k as fetchAdminPayoutSummary, y as fetchDeveloperPortalRevenueDashboard, x as fetchEarningsEntries, b as fetchEarningsSummary, S as fetchPayoutAccounts, C as fetchPayoutRequests, I as markPayoutPaid, F as rejectPayoutRequest, O as requestPayout, N as retrySaleCreditSync, E as setDefaultPayoutAccount, T as updatePayoutAccount };
125
161
 
126
162
  //# sourceMappingURL=api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","names":[],"sources":["../../../../src/billing/modules/earnings/api.ts"],"sourcesContent":["import { directBillingGraphqlRequest } from '../../shared/utils';\nimport { gatewayGraphqlRequest } from '../../shared/utils/gatewayGraphql';\nimport {\n AddPayoutAccountDocument,\n AdminPayoutRequestsDocument,\n AdminPayoutSummaryDocument,\n ApprovePayoutRequestDocument,\n ArchivePayoutAccountDocument,\n BillingDeveloperPortalRevenueDocument,\n MarkPayoutPaidDocument,\n MyEarningsEntriesDocument,\n MyEarningsSummaryDocument,\n MyPayoutAccountsDocument,\n MyPayoutRequestsDocument,\n ProcessPayoutRequestDocument,\n RejectPayoutRequestDocument,\n SetDefaultPayoutAccountDocument,\n UpdatePayoutAccountDocument,\n} from '../../../generated/global-operations';\n\nexport interface EarningsSummary {\n totalLifetimeAmount: number;\n availableAmount: number;\n reservedAmount: number;\n paidAmount: number;\n pendingAmount: number;\n moneyAmount: number;\n creditsAmount: number;\n categoryBreakdown?: Array<{\n category: 'AFFILIATE' | 'STORE' | 'OTHER';\n amount: number;\n count: number;\n }>;\n}\n\nexport interface EarningsEntry {\n id: string;\n sourceCategory: 'AFFILIATE' | 'STORE' | 'OTHER';\n sourceSubcategory?: string | null;\n description?: string | null;\n unitType: 'MONEY' | 'CREDITS';\n amount: number;\n currency: string;\n status: 'AVAILABLE' | 'RESERVED' | 'PAID' | 'REVERSED';\n createdAt: string;\n}\n\nexport interface PayoutAccount {\n id: string;\n label: string;\n type: 'BANK_ACCOUNT' | 'UPI' | 'WALLET';\n providerPreference: 'AUTO' | 'STRIPE' | 'RAZORPAY' | 'MANUAL';\n status: 'PENDING_VERIFICATION' | 'ACTIVE' | 'FAILED_VERIFICATION' | 'ARCHIVED';\n displayName?: string | null;\n accountLast4?: string | null;\n country?: string | null;\n currency: string;\n isDefault: boolean;\n accountDetails?: Record<string, unknown> | null;\n}\n\nexport interface PayoutRequest {\n id: string;\n billingAccountId?: string | null;\n requesterUserId?: string | null;\n requestedAmount: number;\n approvedAmount?: number | null;\n currency: string;\n provider: 'AUTO' | 'STRIPE' | 'RAZORPAY' | 'MANUAL';\n status: 'REQUESTED' | 'APPROVED' | 'REJECTED' | 'PROCESSING' | 'PAID' | 'FAILED' | 'CANCELED';\n externalReference?: string | null;\n failureReason?: string | null;\n internalNotes?: string | null;\n userNotes?: string | null;\n createdAt: string;\n processedAt?: string | null;\n paidAt?: string | null;\n payoutAccount?: PayoutAccount | null;\n}\n\nexport interface PayoutAdminSummary {\n totalRequestedAmount: number;\n totalProcessingAmount: number;\n totalPaidAmount: number;\n pendingCount: number;\n failedCount: number;\n statusBreakdown?: Array<{ status: string; count: number; totalAmount: number }>;\n providerBreakdown?: Array<{ provider: string; count: number; totalAmount: number }>;\n}\n\nexport interface DeveloperPortalRevenueSummary {\n totalGrossRevenue: number;\n totalNetRevenue: number;\n totalPlatformFees: number;\n totalRefunds: number;\n totalRefundsCount: number;\n totalSales: number;\n pendingBalance: number;\n nextPayoutDate?: string | null;\n nextPayoutAmount?: number | null;\n}\n\nexport interface DeveloperPortalRevenueSale {\n id: string;\n grossAmount: number;\n netAmount: number;\n currency: string;\n pricingModel: string;\n status: string;\n purchasedAt: string;\n application?: {\n id: string;\n name: string;\n slug: string;\n } | null;\n}\n\nexport interface DeveloperPortalRevenuePayout {\n id: string;\n periodLabel?: string | null;\n netAmount: number;\n currency: string;\n status: string;\n scheduledAt?: string | null;\n completedAt?: string | null;\n}\n\nexport interface DeveloperPortalRevenueDashboard {\n summary: DeveloperPortalRevenueSummary | null;\n sales: DeveloperPortalRevenueSale[];\n payouts: DeveloperPortalRevenuePayout[];\n}\n\ninterface GatewayContext {\n apiGatewayUrl?: string;\n authToken?: string;\n orgId?: string;\n}\n\nexport async function fetchDeveloperPortalRevenueDashboard(\n organizationId: string,\n context: GatewayContext\n): Promise<DeveloperPortalRevenueDashboard> {\n type RevenueQueryResult = {\n developerOrgRevenueSummary: DeveloperPortalRevenueSummary | null;\n developerOrgSales: { edges: Array<{ node: DeveloperPortalRevenueSale }> };\n developerOrgPayouts: { edges: Array<{ node: DeveloperPortalRevenuePayout }> };\n };\n\n const data = await gatewayGraphqlRequest<RevenueQueryResult, { organizationId: string }>({\n ...context,\n query: BillingDeveloperPortalRevenueDocument,\n variables: { organizationId },\n });\n\n return {\n summary: data.developerOrgRevenueSummary,\n sales: data.developerOrgSales.edges.map((edge) => edge.node),\n payouts: data.developerOrgPayouts.edges.map((edge) => edge.node),\n };\n}\n\nexport async function fetchEarningsSummary(billingAccountId: string, context: GatewayContext) {\n const data = await directBillingGraphqlRequest<\n {\n myEarningsSummary: EarningsSummary;\n },\n { billingAccountId: string }\n >({\n ...context,\n query: MyEarningsSummaryDocument,\n variables: { billingAccountId },\n });\n\n return data.myEarningsSummary;\n}\n\nexport async function fetchEarningsEntries(billingAccountId: string, context: GatewayContext) {\n const data = await directBillingGraphqlRequest<\n {\n myEarningsEntries: { items: EarningsEntry[] };\n },\n { billingAccountId: string }\n >({\n ...context,\n query: MyEarningsEntriesDocument,\n variables: { billingAccountId },\n });\n\n return data.myEarningsEntries.items;\n}\n\nexport async function fetchPayoutAccounts(billingAccountId: string, context: GatewayContext) {\n const data = await directBillingGraphqlRequest<\n {\n myPayoutAccounts: PayoutAccount[];\n },\n { billingAccountId: string }\n >({\n ...context,\n query: MyPayoutAccountsDocument,\n variables: { billingAccountId },\n });\n\n return data.myPayoutAccounts;\n}\n\nexport async function fetchPayoutRequests(billingAccountId: string, context: GatewayContext) {\n const data = await directBillingGraphqlRequest<\n {\n myPayoutRequests: { items: PayoutRequest[] };\n },\n { billingAccountId: string }\n >({\n ...context,\n query: MyPayoutRequestsDocument,\n variables: { billingAccountId },\n });\n\n return data.myPayoutRequests.items;\n}\n\nexport async function addPayoutAccount(input: Record<string, unknown>, context: GatewayContext) {\n await directBillingGraphqlRequest<\n {\n addPayoutAccount: { id: string };\n },\n { input: Record<string, unknown> }\n >({\n ...context,\n query: AddPayoutAccountDocument,\n variables: { input },\n });\n}\n\nexport async function updatePayoutAccount(\n id: string,\n input: Record<string, unknown>,\n context: GatewayContext\n) {\n await directBillingGraphqlRequest<\n { updatePayoutAccount: { id: string } },\n { id: string; input: Record<string, unknown> }\n >({\n ...context,\n query: UpdatePayoutAccountDocument,\n variables: { id, input },\n });\n}\n\nexport async function setDefaultPayoutAccount(id: string, context: GatewayContext) {\n await directBillingGraphqlRequest<{ setDefaultPayoutAccount: { id: string } }, { id: string }>({\n ...context,\n query: SetDefaultPayoutAccountDocument,\n variables: { id },\n });\n}\n\nexport async function archivePayoutAccount(id: string, context: GatewayContext) {\n await directBillingGraphqlRequest<{ archivePayoutAccount: boolean }, { id: string }>({\n ...context,\n query: ArchivePayoutAccountDocument,\n variables: { id },\n });\n}\n\nexport async function requestPayout(_input: Record<string, unknown>, _context: GatewayContext) {\n throw new Error('Payout request not yet implemented');\n}\n\nexport async function fetchAdminPayoutSummary(context: GatewayContext) {\n const data = await directBillingGraphqlRequest<{\n adminPayoutSummary: PayoutAdminSummary;\n }>({\n ...context,\n query: AdminPayoutSummaryDocument,\n });\n\n return data.adminPayoutSummary;\n}\n\nexport async function fetchAdminPayoutRequests(context: GatewayContext) {\n const data = await directBillingGraphqlRequest<{\n adminPayoutRequests: { items: PayoutRequest[] };\n }>({\n ...context,\n query: AdminPayoutRequestsDocument,\n });\n\n return data.adminPayoutRequests.items;\n}\n\nexport async function approvePayoutRequest(\n id: string,\n notes: string | null,\n context: GatewayContext\n) {\n await directBillingGraphqlRequest<\n {\n approvePayoutRequest: { id: string };\n },\n { id: string; notes: string | null }\n >({\n ...context,\n query: ApprovePayoutRequestDocument,\n variables: { id, notes },\n });\n}\n\nexport async function rejectPayoutRequest(id: string, reason: string, context: GatewayContext) {\n await directBillingGraphqlRequest<\n {\n rejectPayoutRequest: { id: string };\n },\n { id: string; reason: string }\n >({\n ...context,\n query: RejectPayoutRequestDocument,\n variables: { id, reason },\n });\n}\n\nexport async function processPayoutRequest(id: string, context: GatewayContext) {\n await directBillingGraphqlRequest<\n {\n processPayoutRequest: { id: string };\n },\n { id: string }\n >({\n ...context,\n query: ProcessPayoutRequestDocument,\n variables: { id },\n });\n}\n\nexport async function markPayoutPaid(\n id: string,\n externalReference: string | null,\n notes: string | null,\n context: GatewayContext\n) {\n await directBillingGraphqlRequest<\n { markPayoutPaid: { id: string } },\n { id: string; externalReference: string | null; notes: string | null }\n >({\n ...context,\n query: MarkPayoutPaidDocument,\n variables: { id, externalReference, notes },\n });\n}\n"],"mappings":";;;;;AA2IA,eAAsB,EACpB,GACA,GAC0C;CAO1C,IAAM,IAAO,MAAM,EAAsE;EACvF,GAAG;EACH,OAAO;EACP,WAAW,EAAE,mBAAgB;EAC9B,CAAC;AAEF,QAAO;EACL,SAAS,EAAK;EACd,OAAO,EAAK,kBAAkB,MAAM,KAAK,MAAS,EAAK,KAAK;EAC5D,SAAS,EAAK,oBAAoB,MAAM,KAAK,MAAS,EAAK,KAAK;EACjE;;AAGH,eAAsB,EAAqB,GAA0B,GAAyB;AAY5F,SAXa,MAAM,EAKjB;EACA,GAAG;EACH,OAAO;EACP,WAAW,EAAE,qBAAkB;EAChC,CAAC,EAEU;;AAGd,eAAsB,EAAqB,GAA0B,GAAyB;AAY5F,SAXa,MAAM,EAKjB;EACA,GAAG;EACH,OAAO;EACP,WAAW,EAAE,qBAAkB;EAChC,CAAC,EAEU,kBAAkB;;AAGhC,eAAsB,EAAoB,GAA0B,GAAyB;AAY3F,SAXa,MAAM,EAKjB;EACA,GAAG;EACH,OAAO;EACP,WAAW,EAAE,qBAAkB;EAChC,CAAC,EAEU;;AAGd,eAAsB,EAAoB,GAA0B,GAAyB;AAY3F,SAXa,MAAM,EAKjB;EACA,GAAG;EACH,OAAO;EACP,WAAW,EAAE,qBAAkB;EAChC,CAAC,EAEU,iBAAiB;;AAG/B,eAAsB,EAAiB,GAAgC,GAAyB;AAC9F,OAAM,EAKJ;EACA,GAAG;EACH,OAAO;EACP,WAAW,EAAE,UAAO;EACrB,CAAC;;AAGJ,eAAsB,EACpB,GACA,GACA,GACA;AACA,OAAM,EAGJ;EACA,GAAG;EACH,OAAO;EACP,WAAW;GAAE;GAAI;GAAO;EACzB,CAAC;;AAGJ,eAAsB,EAAwB,GAAY,GAAyB;AACjF,OAAM,EAAyF;EAC7F,GAAG;EACH,OAAO;EACP,WAAW,EAAE,OAAI;EAClB,CAAC;;AAGJ,eAAsB,EAAqB,GAAY,GAAyB;AAC9E,OAAM,EAA+E;EACnF,GAAG;EACH,OAAO;EACP,WAAW,EAAE,OAAI;EAClB,CAAC;;AAGJ,eAAsB,EAAc,GAAiC,GAA0B;AAC7F,OAAU,MAAM,qCAAqC;;AAGvD,eAAsB,EAAwB,GAAyB;AAQrE,SAPa,MAAM,EAEhB;EACD,GAAG;EACH,OAAO;EACR,CAAC,EAEU;;AAGd,eAAsB,EAAyB,GAAyB;AAQtE,SAPa,MAAM,EAEhB;EACD,GAAG;EACH,OAAO;EACR,CAAC,EAEU,oBAAoB;;AAGlC,eAAsB,EACpB,GACA,GACA,GACA;AACA,OAAM,EAKJ;EACA,GAAG;EACH,OAAO;EACP,WAAW;GAAE;GAAI;GAAO;EACzB,CAAC;;AAGJ,eAAsB,EAAoB,GAAY,GAAgB,GAAyB;AAC7F,OAAM,EAKJ;EACA,GAAG;EACH,OAAO;EACP,WAAW;GAAE;GAAI;GAAQ;EAC1B,CAAC;;AAgBJ,eAAsB,EACpB,GACA,GACA,GACA,GACA;AACA,OAAM,EAGJ;EACA,GAAG;EACH,OAAO;EACP,WAAW;GAAE;GAAI;GAAmB;GAAO;EAC5C,CAAC"}
1
+ {"version":3,"file":"api.js","names":[],"sources":["../../../../src/billing/modules/earnings/api.ts"],"sourcesContent":["import { directBillingGraphqlRequest } from '../../shared/utils';\nimport { gatewayGraphqlRequest } from '../../shared/utils/gatewayGraphql';\nimport {\n AddPayoutAccountDocument,\n AdminDeveloperRevenueOrgDetailDocument,\n AdminDeveloperRevenueOrgsDocument,\n AdminPayoutRequestsDocument,\n AdminPayoutSummaryDocument,\n ApprovePayoutRequestDocument,\n ArchivePayoutAccountDocument,\n BillingDeveloperPortalRevenueDocument,\n MarkPayoutPaidDocument,\n MyEarningsEntriesDocument,\n MyEarningsSummaryDocument,\n MyPayoutAccountsDocument,\n MyPayoutRequestsDocument,\n ProcessPayoutRequestDocument,\n RejectPayoutRequestDocument,\n RetrySaleCreditSyncDocument,\n SetDefaultPayoutAccountDocument,\n UpdatePayoutAccountDocument,\n} from '../../../generated/global-operations';\n\nexport interface EarningsSummary {\n totalLifetimeAmount: number;\n availableAmount: number;\n reservedAmount: number;\n paidAmount: number;\n pendingAmount: number;\n moneyAmount: number;\n creditsAmount: number;\n categoryBreakdown?: Array<{\n category: 'AFFILIATE' | 'STORE' | 'OTHER';\n amount: number;\n count: number;\n }>;\n}\n\nexport interface EarningsEntry {\n id: string;\n sourceCategory: 'AFFILIATE' | 'STORE' | 'OTHER';\n sourceSubcategory?: string | null;\n description?: string | null;\n unitType: 'MONEY' | 'CREDITS';\n amount: number;\n currency: string;\n status: 'AVAILABLE' | 'RESERVED' | 'PAID' | 'REVERSED';\n createdAt: string;\n}\n\nexport interface PayoutAccount {\n id: string;\n label: string;\n type: 'BANK_ACCOUNT' | 'UPI' | 'WALLET';\n providerPreference: 'AUTO' | 'STRIPE' | 'RAZORPAY' | 'MANUAL';\n status: 'PENDING_VERIFICATION' | 'ACTIVE' | 'FAILED_VERIFICATION' | 'ARCHIVED';\n displayName?: string | null;\n accountLast4?: string | null;\n country?: string | null;\n currency: string;\n isDefault: boolean;\n accountDetails?: Record<string, unknown> | null;\n}\n\nexport interface PayoutRequest {\n id: string;\n billingAccountId?: string | null;\n requesterUserId?: string | null;\n requestedAmount: number;\n approvedAmount?: number | null;\n currency: string;\n provider: 'AUTO' | 'STRIPE' | 'RAZORPAY' | 'MANUAL';\n status: 'REQUESTED' | 'APPROVED' | 'REJECTED' | 'PROCESSING' | 'PAID' | 'FAILED' | 'CANCELED';\n externalReference?: string | null;\n failureReason?: string | null;\n internalNotes?: string | null;\n userNotes?: string | null;\n createdAt: string;\n processedAt?: string | null;\n paidAt?: string | null;\n payoutAccount?: PayoutAccount | null;\n}\n\nexport interface PayoutAdminSummary {\n totalRequestedAmount: number;\n totalProcessingAmount: number;\n totalPaidAmount: number;\n pendingCount: number;\n failedCount: number;\n statusBreakdown?: Array<{ status: string; count: number; totalAmount: number }>;\n providerBreakdown?: Array<{ provider: string; count: number; totalAmount: number }>;\n}\n\nexport interface AdminPayoutRequestsPage {\n items: PayoutRequest[];\n totalCount: number;\n hasMore: boolean;\n}\n\nexport interface DeveloperPortalRevenueSummary {\n totalGrossRevenue: number;\n totalNetRevenue: number;\n totalPlatformFees: number;\n totalRefunds: number;\n totalRefundsCount: number;\n totalSales: number;\n pendingBalance: number;\n nextPayoutDate?: string | null;\n nextPayoutAmount?: number | null;\n}\n\nexport interface DeveloperPortalRevenueSale {\n id: string;\n grossAmount: number;\n netAmount: number;\n currency: string;\n pricingModel: string;\n status: string;\n billingCreditSyncStatus?: string | null;\n billingCreditSyncError?: string | null;\n billingCreditSyncedAt?: string | null;\n purchasedAt: string;\n application?: {\n id: string;\n name: string;\n slug: string;\n } | null;\n}\n\nexport interface DeveloperPortalRevenuePayout {\n id: string;\n periodLabel?: string | null;\n netAmount: number;\n currency: string;\n status: string;\n scheduledAt?: string | null;\n completedAt?: string | null;\n}\n\nexport interface DeveloperPortalRevenueDashboard {\n summary: DeveloperPortalRevenueSummary | null;\n sales: DeveloperPortalRevenueSale[];\n payouts: DeveloperPortalRevenuePayout[];\n}\n\nexport interface AdminDeveloperRevenueOrg {\n id: string;\n name: string;\n slug: string;\n billingAccountId?: string | null;\n isVerified: boolean;\n totalApps: number;\n publishedApps: number;\n totalInstalls: number;\n activeInstalls: number;\n averageRating?: number | null;\n totalRevenue: number;\n totalPlatformFees: number;\n totalPayouts: number;\n pendingBalance: number;\n lifetimeRevenue: number;\n platformFeeRate: number;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface AdminDeveloperRevenueOrgDetail {\n summary: DeveloperPortalRevenueSummary | null;\n unpaidSales: {\n totalCount: number;\n items: DeveloperPortalRevenueSale[];\n };\n}\n\ninterface GatewayContext {\n apiGatewayUrl?: string;\n authToken?: string;\n orgId?: string;\n}\n\nexport async function fetchDeveloperPortalRevenueDashboard(\n organizationId: string,\n context: GatewayContext\n): Promise<DeveloperPortalRevenueDashboard> {\n type RevenueQueryResult = {\n developerOrgRevenueSummary: DeveloperPortalRevenueSummary | null;\n developerOrgSales: { edges: Array<{ node: DeveloperPortalRevenueSale }> };\n developerOrgPayouts: { edges: Array<{ node: DeveloperPortalRevenuePayout }> };\n };\n\n const data = await gatewayGraphqlRequest<RevenueQueryResult, { organizationId: string }>({\n ...context,\n query: BillingDeveloperPortalRevenueDocument,\n variables: { organizationId },\n });\n\n return {\n summary: data.developerOrgRevenueSummary,\n sales: data.developerOrgSales.edges.map((edge) => edge.node),\n payouts: data.developerOrgPayouts.edges.map((edge) => edge.node),\n };\n}\n\nexport async function fetchEarningsSummary(billingAccountId: string, context: GatewayContext) {\n const data = await directBillingGraphqlRequest<\n {\n myEarningsSummary: EarningsSummary;\n },\n { billingAccountId: string }\n >({\n ...context,\n query: MyEarningsSummaryDocument,\n variables: { billingAccountId },\n });\n\n return data.myEarningsSummary;\n}\n\nexport async function fetchEarningsEntries(billingAccountId: string, context: GatewayContext) {\n const data = await directBillingGraphqlRequest<\n {\n myEarningsEntries: { items: EarningsEntry[] };\n },\n { billingAccountId: string }\n >({\n ...context,\n query: MyEarningsEntriesDocument,\n variables: { billingAccountId },\n });\n\n return data.myEarningsEntries.items;\n}\n\nexport async function fetchPayoutAccounts(billingAccountId: string, context: GatewayContext) {\n const data = await directBillingGraphqlRequest<\n {\n myPayoutAccounts: PayoutAccount[];\n },\n { billingAccountId: string }\n >({\n ...context,\n query: MyPayoutAccountsDocument,\n variables: { billingAccountId },\n });\n\n return data.myPayoutAccounts;\n}\n\nexport async function fetchPayoutRequests(billingAccountId: string, context: GatewayContext) {\n const data = await directBillingGraphqlRequest<\n {\n myPayoutRequests: { items: PayoutRequest[] };\n },\n { billingAccountId: string }\n >({\n ...context,\n query: MyPayoutRequestsDocument,\n variables: { billingAccountId },\n });\n\n return data.myPayoutRequests.items;\n}\n\nexport async function addPayoutAccount(input: Record<string, unknown>, context: GatewayContext) {\n await directBillingGraphqlRequest<\n {\n addPayoutAccount: { id: string };\n },\n { input: Record<string, unknown> }\n >({\n ...context,\n query: AddPayoutAccountDocument,\n variables: { input },\n });\n}\n\nexport async function updatePayoutAccount(\n id: string,\n input: Record<string, unknown>,\n context: GatewayContext\n) {\n await directBillingGraphqlRequest<\n { updatePayoutAccount: { id: string } },\n { id: string; input: Record<string, unknown> }\n >({\n ...context,\n query: UpdatePayoutAccountDocument,\n variables: { id, input },\n });\n}\n\nexport async function setDefaultPayoutAccount(id: string, context: GatewayContext) {\n await directBillingGraphqlRequest<{ setDefaultPayoutAccount: { id: string } }, { id: string }>({\n ...context,\n query: SetDefaultPayoutAccountDocument,\n variables: { id },\n });\n}\n\nexport async function archivePayoutAccount(id: string, context: GatewayContext) {\n await directBillingGraphqlRequest<{ archivePayoutAccount: boolean }, { id: string }>({\n ...context,\n query: ArchivePayoutAccountDocument,\n variables: { id },\n });\n}\n\nexport async function requestPayout(_input: Record<string, unknown>, _context: GatewayContext) {\n throw new Error('Payout request not yet implemented');\n}\n\nexport async function fetchAdminPayoutSummary(context: GatewayContext) {\n const data = await directBillingGraphqlRequest<{\n adminPayoutSummary: PayoutAdminSummary;\n }>({\n ...context,\n query: AdminPayoutSummaryDocument,\n });\n\n return data.adminPayoutSummary;\n}\n\nexport async function fetchAdminPayoutRequests(\n context: GatewayContext,\n pagination: { limit?: number; offset?: number } = {}\n) {\n const data = await directBillingGraphqlRequest<{\n adminPayoutRequests: AdminPayoutRequestsPage;\n },\n {\n limit: number;\n offset: number;\n }>({\n ...context,\n query: AdminPayoutRequestsDocument,\n variables: {\n limit: pagination.limit ?? 50,\n offset: pagination.offset ?? 0,\n },\n });\n\n return data.adminPayoutRequests;\n}\n\nexport async function fetchAdminDeveloperRevenueOrgs(context: GatewayContext) {\n const data = await gatewayGraphqlRequest<{\n developerOrganizations: {\n edges: Array<{ node: AdminDeveloperRevenueOrg }>;\n };\n }>({\n ...context,\n query: AdminDeveloperRevenueOrgsDocument,\n });\n\n return data.developerOrganizations.edges.map((edge) => edge.node);\n}\n\nexport async function fetchAdminDeveloperRevenueOrgDetail(\n organizationId: string,\n context: GatewayContext\n) {\n const data = await gatewayGraphqlRequest<{\n developerOrgRevenueSummary: DeveloperPortalRevenueSummary | null;\n developerOrgSales: { totalCount: number; edges: Array<{ node: DeveloperPortalRevenueSale }> };\n },\n {\n organizationId: string;\n period: string;\n salesLimit: number;\n salesOffset: number;\n }>({\n ...context,\n query: AdminDeveloperRevenueOrgDetailDocument,\n variables: {\n organizationId,\n period: 'monthly',\n salesLimit: 20,\n salesOffset: 0,\n },\n });\n\n return {\n summary: data.developerOrgRevenueSummary,\n unpaidSales: {\n totalCount: data.developerOrgSales.totalCount,\n items: data.developerOrgSales.edges.map((edge) => edge.node),\n },\n } satisfies AdminDeveloperRevenueOrgDetail;\n}\n\nexport async function retrySaleCreditSync(saleId: string, context: GatewayContext) {\n const data = await gatewayGraphqlRequest<\n {\n retrySaleCreditSync: Pick<\n DeveloperPortalRevenueSale,\n 'id' | 'billingCreditSyncStatus' | 'billingCreditSyncError' | 'billingCreditSyncedAt'\n >;\n },\n { saleId: string }\n >({\n ...context,\n query: RetrySaleCreditSyncDocument,\n variables: { saleId },\n });\n\n return data.retrySaleCreditSync;\n}\n\nexport async function approvePayoutRequest(\n id: string,\n notes: string | null,\n context: GatewayContext\n) {\n await directBillingGraphqlRequest<\n {\n approvePayoutRequest: { id: string };\n },\n { id: string; notes: string | null }\n >({\n ...context,\n query: ApprovePayoutRequestDocument,\n variables: { id, notes },\n });\n}\n\nexport async function rejectPayoutRequest(id: string, reason: string, context: GatewayContext) {\n await directBillingGraphqlRequest<\n {\n rejectPayoutRequest: { id: string };\n },\n { id: string; reason: string }\n >({\n ...context,\n query: RejectPayoutRequestDocument,\n variables: { id, reason },\n });\n}\n\nexport async function processPayoutRequest(id: string, context: GatewayContext) {\n await directBillingGraphqlRequest<\n {\n processPayoutRequest: { id: string };\n },\n { id: string }\n >({\n ...context,\n query: ProcessPayoutRequestDocument,\n variables: { id },\n });\n}\n\nexport async function markPayoutPaid(\n id: string,\n externalReference: string | null,\n notes: string | null,\n context: GatewayContext\n) {\n await directBillingGraphqlRequest<\n { markPayoutPaid: { id: string } },\n { id: string; externalReference: string | null; notes: string | null }\n >({\n ...context,\n query: MarkPayoutPaidDocument,\n variables: { id, externalReference, notes },\n });\n}\n"],"mappings":";;;;;AAoLA,eAAsB,EACpB,GACA,GAC0C;CAO1C,IAAM,IAAO,MAAM,EAAsE;EACvF,GAAG;EACH,OAAO;EACP,WAAW,EAAE,mBAAgB;EAC9B,CAAC;AAEF,QAAO;EACL,SAAS,EAAK;EACd,OAAO,EAAK,kBAAkB,MAAM,KAAK,MAAS,EAAK,KAAK;EAC5D,SAAS,EAAK,oBAAoB,MAAM,KAAK,MAAS,EAAK,KAAK;EACjE;;AAGH,eAAsB,EAAqB,GAA0B,GAAyB;AAY5F,SAXa,MAAM,EAKjB;EACA,GAAG;EACH,OAAO;EACP,WAAW,EAAE,qBAAkB;EAChC,CAAC,EAEU;;AAGd,eAAsB,EAAqB,GAA0B,GAAyB;AAY5F,SAXa,MAAM,EAKjB;EACA,GAAG;EACH,OAAO;EACP,WAAW,EAAE,qBAAkB;EAChC,CAAC,EAEU,kBAAkB;;AAGhC,eAAsB,EAAoB,GAA0B,GAAyB;AAY3F,SAXa,MAAM,EAKjB;EACA,GAAG;EACH,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GACZ,aAAa;GACd;EACF,CAAC;AAEF,QAAO;EACL,SAAS,EAAK;EACd,aAAa;GACX,YAAY,EAAK,kBAAkB;GACnC,OAAO,EAAK,kBAAkB,MAAM,KAAK,MAAS,EAAK,KAAK;GAC7D;EACF;;AAGH,eAAsB,EAAoB,GAAgB,GAAyB;AAejF,SAda,MAAM,EAQjB;EACA,GAAG;EACH,OAAO;EACP,WAAW,EAAE,WAAQ;EACtB,CAAC,EAEU;;AAGd,eAAsB,EACpB,GACA,GACA,GACA;AACA,OAAM,EAKJ;EACA,GAAG;EACH,OAAO;EACP,WAAW;GAAE;GAAI;GAAO;EACzB,CAAC;;AAGJ,eAAsB,EAAoB,GAAY,GAAgB,GAAyB;AAC7F,OAAM,EAKJ;EACA,GAAG;EACH,OAAO;EACP,WAAW;GAAE;GAAI;GAAQ;EAC1B,CAAC;;AAgBJ,eAAsB,EACpB,GACA,GACA,GACA,GACA;AACA,OAAM,EAGJ;EACA,GAAG;EACH,OAAO;EACP,WAAW;GAAE;GAAI;GAAmB;GAAO;EAC5C,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { EarningsPage as e } from "./pages/EarningsPage.js";
2
- import { PayoutsPage as t } from "./pages/PayoutsPage.js";
3
- import { PayoutAdminPage as n } from "./pages/PayoutAdminPage.js";
4
- export { e as EarningsPage, n as PayoutAdminPage, t as PayoutsPage };
2
+ import { DeveloperRevenueAdminPage as t } from "./pages/DeveloperRevenueAdminPage.js";
3
+ import { PayoutsPage as n } from "./pages/PayoutsPage.js";
4
+ import { PayoutAdminPage as r } from "./pages/PayoutAdminPage.js";
5
+ export { t as DeveloperRevenueAdminPage, e as EarningsPage, r as PayoutAdminPage, n as PayoutsPage };