@burdenoff/microfe-billing 2026.1114.6 → 2026.1114.8

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.
Files changed (32) hide show
  1. package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js +1 -1
  2. package/dist/billing/modules/addons/pages/AddonDetailPage.js +1 -1
  3. package/dist/billing/modules/addons/pages/AddonEditPage.js +1 -1
  4. package/dist/billing/modules/addons/pages/AddonsBrowsePage.js +3 -3
  5. package/dist/billing/modules/addons/pages/AddonsBrowsePage.js.map +1 -1
  6. package/dist/billing/modules/billing/pages/InvoicesListPage.js +176 -168
  7. package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
  8. package/dist/billing/modules/billing/pages/TransactionsPage.js +117 -111
  9. package/dist/billing/modules/billing/pages/TransactionsPage.js.map +1 -1
  10. package/dist/billing/modules/billing/pages/UserRefundsPage.js +143 -138
  11. package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
  12. package/dist/billing/modules/credits/pages/CreditTransactionsPage.js +132 -126
  13. package/dist/billing/modules/credits/pages/CreditTransactionsPage.js.map +1 -1
  14. package/dist/billing/modules/earnings/pages/DeveloperRevenueAdminPage.js +13 -13
  15. package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js +24 -24
  16. package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js.map +1 -1
  17. package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js +1 -1
  18. package/dist/billing/modules/plans/pages/PlanEditPage.js +6 -6
  19. package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
  20. package/dist/billing/modules/plans/pages/PlansBrowsePage.js +35 -35
  21. package/dist/billing/modules/plans/pages/PlansListPage.js +1 -1
  22. package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js +4 -4
  23. package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js +4 -4
  24. package/dist/billing/shared/components/BillingHistoryTabs.d.ts +9 -0
  25. package/dist/billing/shared/components/BillingHistoryTabs.js +35 -0
  26. package/dist/billing/shared/components/BillingHistoryTabs.js.map +1 -0
  27. package/dist/billing/shared/components/historyTabs.d.ts +16 -0
  28. package/dist/billing/shared/components/historyTabs.js +24 -0
  29. package/dist/billing/shared/components/historyTabs.js.map +1 -0
  30. package/dist/billing/shared/components/index.d.ts +1 -0
  31. package/dist/billing/shared/components/index.js +2 -1
  32. package/package.json +1 -1
@@ -3,9 +3,9 @@ import { AccessDenied as t } from "../../../shared/components/AccessDenied.js";
3
3
  import { PageHeader as n } from "../../../shared/components/PageHeader.js";
4
4
  import { ServerError as r } from "../../../shared/components/ServerError.js";
5
5
  import { useBillingNavigate as i } from "../../../hooks/useBillingNavigate.js";
6
- import { formatCurrency as a } from "../../../shared/utils/format.js";
7
- import { isServerError as o } from "../../../shared/utils/error.js";
8
- import { useBillingPermissions as s } from "../../../hooks/useBillingPermissions.js";
6
+ import { useBillingPermissions as a } from "../../../hooks/useBillingPermissions.js";
7
+ import { formatCurrency as o } from "../../../shared/utils/format.js";
8
+ import { isServerError as s } from "../../../shared/utils/error.js";
9
9
  import "../../../shared/components/index.js";
10
10
  import "../../../shared/utils/index.js";
11
11
  import { fetchAdminDeveloperRevenueOrgs as c } from "../api.js";
@@ -36,7 +36,7 @@ function C({ orgs: e }) {
36
36
  children: "Gross revenue"
37
37
  }), /* @__PURE__ */ S("div", {
38
38
  className: "mt-1 flex items-center gap-2 text-lg font-semibold text-text-primary",
39
- children: [/* @__PURE__ */ x(h, { className: "size-4 text-text-muted" }), a(t.totalRevenue, "USD")]
39
+ children: [/* @__PURE__ */ x(h, { className: "size-4 text-text-muted" }), o(t.totalRevenue, "USD")]
40
40
  })]
41
41
  }),
42
42
  /* @__PURE__ */ S("div", {
@@ -46,7 +46,7 @@ function C({ orgs: e }) {
46
46
  children: "Platform fees"
47
47
  }), /* @__PURE__ */ S("div", {
48
48
  className: "mt-1 flex items-center gap-2 text-lg font-semibold text-text-primary",
49
- children: [/* @__PURE__ */ x(_, { className: "size-4 text-text-muted" }), a(t.totalPlatformFees, "USD")]
49
+ children: [/* @__PURE__ */ x(_, { className: "size-4 text-text-muted" }), o(t.totalPlatformFees, "USD")]
50
50
  })]
51
51
  }),
52
52
  /* @__PURE__ */ S("div", {
@@ -56,7 +56,7 @@ function C({ orgs: e }) {
56
56
  children: "Pending earned credits"
57
57
  }), /* @__PURE__ */ S("div", {
58
58
  className: "mt-1 flex items-center gap-2 text-lg font-semibold text-text-primary",
59
- children: [/* @__PURE__ */ x(y, { className: "size-4 text-text-muted" }), a(t.pendingBalance, "USD")]
59
+ children: [/* @__PURE__ */ x(y, { className: "size-4 text-text-muted" }), o(t.pendingBalance, "USD")]
60
60
  })]
61
61
  }),
62
62
  /* @__PURE__ */ S("div", {
@@ -66,14 +66,14 @@ function C({ orgs: e }) {
66
66
  children: "Already withdrawn"
67
67
  }), /* @__PURE__ */ S("div", {
68
68
  className: "mt-1 flex items-center gap-2 text-lg font-semibold text-text-primary",
69
- children: [/* @__PURE__ */ x(m, { className: "size-4 text-text-muted" }), a(t.totalPayouts, "USD")]
69
+ children: [/* @__PURE__ */ x(m, { className: "size-4 text-text-muted" }), o(t.totalPayouts, "USD")]
70
70
  })]
71
71
  })
72
72
  ]
73
73
  });
74
74
  }
75
75
  var w = () => {
76
- let m = s(), { apiGatewayUrl: h, authToken: _, orgId: y } = e(), w = i(), [T, E] = f([]), [D, O] = f(!0), [k, A] = f(null), [j, M] = f(""), N = d(() => ({
76
+ let m = a(), { apiGatewayUrl: h, authToken: _, orgId: y } = e(), w = i(), [T, E] = f([]), [D, O] = f(!0), [k, A] = f(null), [j, M] = f(""), N = d(() => ({
77
77
  apiGatewayUrl: h,
78
78
  authToken: _,
79
79
  orgId: y
@@ -95,7 +95,7 @@ var w = () => {
95
95
  if (u(() => {
96
96
  m.isBillingAdmin && P();
97
97
  }, [P, m.isBillingAdmin]), !m.isBillingAdmin) return /* @__PURE__ */ x(t, { message: "You don't have permission to view developer revenue." });
98
- if (k && o(k)) return /* @__PURE__ */ x(r, {
98
+ if (k && s(k)) return /* @__PURE__ */ x(r, {
99
99
  title: "Developer revenue unavailable",
100
100
  message: k.message,
101
101
  showRetry: !0,
@@ -204,19 +204,19 @@ var w = () => {
204
204
  }),
205
205
  /* @__PURE__ */ x("td", {
206
206
  className: "px-4 py-3 text-text-primary",
207
- children: a(e.totalRevenue, "USD")
207
+ children: o(e.totalRevenue, "USD")
208
208
  }),
209
209
  /* @__PURE__ */ x("td", {
210
210
  className: "px-4 py-3 text-text-secondary",
211
- children: a(e.totalPlatformFees, "USD")
211
+ children: o(e.totalPlatformFees, "USD")
212
212
  }),
213
213
  /* @__PURE__ */ x("td", {
214
214
  className: "px-4 py-3 font-medium text-status-warning-text",
215
- children: a(e.pendingBalance, "USD")
215
+ children: o(e.pendingBalance, "USD")
216
216
  }),
217
217
  /* @__PURE__ */ x("td", {
218
218
  className: "px-4 py-3 text-text-secondary",
219
- children: a(e.totalPayouts, "USD")
219
+ children: o(e.totalPayouts, "USD")
220
220
  })
221
221
  ]
222
222
  }, e.id)) })]
@@ -4,9 +4,9 @@ import { PageHeader as n } from "../../../shared/components/PageHeader.js";
4
4
  import { StatCard as r } from "../../../shared/components/StatCard.js";
5
5
  import { ServerError as i } from "../../../shared/components/ServerError.js";
6
6
  import { useBillingNavigate as a } from "../../../hooks/useBillingNavigate.js";
7
- import { formatCredits as o, formatCurrency as s, formatDateTime as c } from "../../../shared/utils/format.js";
8
- import { isServerError as l } from "../../../shared/utils/error.js";
9
- import { useBillingPermissions as ee } from "../../../hooks/useBillingPermissions.js";
7
+ import { useBillingPermissions as o } from "../../../hooks/useBillingPermissions.js";
8
+ import { formatCredits as s, formatCurrency as c, formatDateTime as l } from "../../../shared/utils/format.js";
9
+ import { isServerError as ee } from "../../../shared/utils/error.js";
10
10
  import "../../../shared/components/index.js";
11
11
  import "../../../shared/utils/index.js";
12
12
  import { fetchAdminDeveloperRevenueOrg as u, fetchAdminDeveloperRevenueOrgDetail as d, fetchAdminDeveloperRevenueOrgMonthly as te, fetchAdminPayoutRequests as f, fetchBillingAccountCreditBalance as p, fetchCreditCost as m, retrySaleCreditSync as ne } from "../api.js";
@@ -100,15 +100,15 @@ function de({ points: e }) {
100
100
  }),
101
101
  /* @__PURE__ */ S("td", {
102
102
  className: "px-4 py-3 text-text-primary",
103
- children: s(t.grossRevenue, "USD")
103
+ children: c(t.grossRevenue, "USD")
104
104
  }),
105
105
  /* @__PURE__ */ S("td", {
106
106
  className: "px-4 py-3 text-text-secondary",
107
- children: s(t.platformFees, "USD")
107
+ children: c(t.platformFees, "USD")
108
108
  }),
109
109
  /* @__PURE__ */ S("td", {
110
110
  className: "px-4 py-3 text-text-secondary",
111
- children: s(t.netRevenue, "USD")
111
+ children: c(t.netRevenue, "USD")
112
112
  }),
113
113
  /* @__PURE__ */ S("td", {
114
114
  className: "px-4 py-3 text-text-secondary",
@@ -176,7 +176,7 @@ function fe({ requests: e }) {
176
176
  children: [
177
177
  /* @__PURE__ */ S("td", {
178
178
  className: "px-4 py-3 text-text-secondary",
179
- children: c(e.createdAt)
179
+ children: l(e.createdAt)
180
180
  }),
181
181
  /* @__PURE__ */ S("td", {
182
182
  className: "px-4 py-3 text-text-secondary",
@@ -184,7 +184,7 @@ function fe({ requests: e }) {
184
184
  }),
185
185
  /* @__PURE__ */ S("td", {
186
186
  className: "px-4 py-3 font-medium text-text-primary",
187
- children: s(e.requestedAmount, e.currency)
187
+ children: c(e.requestedAmount, e.currency)
188
188
  }),
189
189
  /* @__PURE__ */ S("td", {
190
190
  className: "px-4 py-3",
@@ -192,7 +192,7 @@ function fe({ requests: e }) {
192
192
  }),
193
193
  /* @__PURE__ */ S("td", {
194
194
  className: "px-4 py-3 text-text-secondary",
195
- children: e.paidAt ? c(e.paidAt) : "—"
195
+ children: e.paidAt ? l(e.paidAt) : "—"
196
196
  }),
197
197
  /* @__PURE__ */ S("td", {
198
198
  className: "px-4 py-3 text-text-muted",
@@ -204,7 +204,7 @@ function fe({ requests: e }) {
204
204
  });
205
205
  }
206
206
  var k = () => {
207
- let { organizationId: y } = le(), T = ee(), { apiGatewayUrl: E, authToken: D, orgId: k } = e(), pe = a(), [A, j] = _(null), [M, N] = _([]), [P, F] = _(null), [I, L] = _(null), [R, z] = _([]), [B, me] = _(null), [he, ge] = _([]), [V, H] = _(w), [_e, U] = _(!0), [W, G] = _(!1), [K, q] = _(null), [J, Y] = _(null), X = g(() => ({
207
+ let { organizationId: y } = le(), T = o(), { apiGatewayUrl: E, authToken: D, orgId: k } = e(), pe = a(), [A, j] = _(null), [M, N] = _([]), [P, F] = _(null), [I, L] = _(null), [R, z] = _([]), [B, me] = _(null), [he, ge] = _([]), [V, H] = _(w), [_e, U] = _(!0), [W, G] = _(!1), [K, q] = _(null), [J, Y] = _(null), X = g(() => ({
208
208
  apiGatewayUrl: E,
209
209
  authToken: D,
210
210
  orgId: k
@@ -266,7 +266,7 @@ var k = () => {
266
266
  }).finally(() => G(!1)));
267
267
  };
268
268
  if (!T.isBillingAdmin) return /* @__PURE__ */ S(t, { message: "You don't have permission to view developer revenue." });
269
- if (K && l(K)) return /* @__PURE__ */ S(i, {
269
+ if (K && ee(K)) return /* @__PURE__ */ S(i, {
270
270
  title: "Developer revenue unavailable",
271
271
  message: K.message,
272
272
  showRetry: !0,
@@ -300,22 +300,22 @@ var k = () => {
300
300
  children: [
301
301
  /* @__PURE__ */ S(r, {
302
302
  label: "Gross revenue (all time)",
303
- value: s(A.totalRevenue, "USD"),
303
+ value: c(A.totalRevenue, "USD"),
304
304
  icon: /* @__PURE__ */ S(b, { className: "size-4" })
305
305
  }),
306
306
  /* @__PURE__ */ S(r, {
307
307
  label: "Platform fees (all time)",
308
- value: s(A.totalPlatformFees, "USD"),
308
+ value: c(A.totalPlatformFees, "USD"),
309
309
  icon: /* @__PURE__ */ S(se, { className: "size-4" })
310
310
  }),
311
311
  /* @__PURE__ */ S(r, {
312
312
  label: "Pending earned credits",
313
- value: s(B?.summary?.pendingBalance ?? A.pendingBalance, "USD"),
313
+ value: c(B?.summary?.pendingBalance ?? A.pendingBalance, "USD"),
314
314
  icon: /* @__PURE__ */ S(ce, { className: "size-4" })
315
315
  }),
316
316
  /* @__PURE__ */ S(r, {
317
317
  label: "Already withdrawn (all time)",
318
- value: s(ye, "USD"),
318
+ value: c(ye, "USD"),
319
319
  icon: /* @__PURE__ */ S(oe, { className: "size-4" })
320
320
  })
321
321
  ]
@@ -338,28 +338,28 @@ var k = () => {
338
338
  children: [
339
339
  /* @__PURE__ */ S(r, {
340
340
  label: "Earned",
341
- value: o(P.earned)
341
+ value: s(P.earned)
342
342
  }),
343
343
  /* @__PURE__ */ S(r, {
344
344
  label: "Purchased",
345
- value: o(P.purchased)
345
+ value: s(P.purchased)
346
346
  }),
347
347
  /* @__PURE__ */ S(r, {
348
348
  label: "Granted",
349
- value: o(P.granted)
349
+ value: s(P.granted)
350
350
  }),
351
351
  /* @__PURE__ */ S(r, {
352
352
  label: "Withdrawable",
353
- value: o(P.withdrawable)
353
+ value: s(P.withdrawable)
354
354
  }),
355
355
  /* @__PURE__ */ S(r, {
356
356
  label: "Total balance",
357
- value: o(P.total)
357
+ value: s(P.total)
358
358
  })
359
359
  ]
360
360
  }), /* @__PURE__ */ S("div", {
361
361
  className: "px-5 pb-4 text-xs text-text-muted",
362
- children: I === null ? "Estimated cash value could not be loaded." : `≈ ${s(I, "USD")} total at the current credit rate.`
362
+ children: I === null ? "Estimated cash value could not be loaded." : `≈ ${c(I, "USD")} total at the current credit rate.`
363
363
  })] }) : /* @__PURE__ */ S("div", {
364
364
  className: "px-5 py-8 text-center text-sm text-text-muted",
365
365
  children: "Credit balance could not be loaded."
@@ -369,7 +369,7 @@ var k = () => {
369
369
  }),
370
370
  $ > 0 && /* @__PURE__ */ C("div", {
371
371
  className: "border-t border-border-seam bg-status-warning-bg-subtle px-5 py-3 text-xs text-status-warning-text",
372
- children: [s($, "USD"), " is currently tied up in a pending or approved withdrawal request — it has already left the withdrawable balance above."]
372
+ children: [c($, "USD"), " is currently tied up in a pending or approved withdrawal request — it has already left the withdrawable balance above."]
373
373
  })
374
374
  ]
375
375
  }),
@@ -495,11 +495,11 @@ var k = () => {
495
495
  }),
496
496
  /* @__PURE__ */ S("td", {
497
497
  className: "px-4 py-3 text-text-secondary",
498
- children: c(e.purchasedAt)
498
+ children: l(e.purchasedAt)
499
499
  }),
500
500
  /* @__PURE__ */ S("td", {
501
501
  className: "px-4 py-3 text-text-primary",
502
- children: s(e.netAmount, e.currency)
502
+ children: c(e.netAmount, e.currency)
503
503
  }),
504
504
  /* @__PURE__ */ C("td", {
505
505
  className: "px-4 py-3 text-text-secondary",
@@ -1 +1 @@
1
- {"version":3,"file":"DeveloperRevenueOrgDetailPage.js","names":["_Fragment","Fragment$1","ALL_TIME","PAYOUT_STATUS_LABEL","PAYOUT_STATUS_COLORS","PayoutStatusBadge","status","formatMonthLabel","iso","monthRangeFor","month","start","MonthlyRevenueTrend","points","prior","index","growthPct","point","formatCurrency","jsx","TrendingUp","TrendingDown","WithdrawalHistory","requests","formatDateTime","request","DeveloperRevenueOrgDetailPage","useParams","permissions","useBillingPermissions","useBilling","navigateTo","useBillingNavigate","org","setOrg","useState","monthly","setMonthly","creditBalance","setCreditBalance","creditBalanceUsd","setCreditBalanceUsd","lifetimePayouts","setLifetimePayouts","detail","setDetail","payoutHistory","setPayoutHistory","selectedMonth","setSelectedMonth","loading","setLoading","periodLoading","setPeriodLoading","error","setError","retryingSaleId","setRetryingSaleId","requestContext","useMemo","apiGatewayUrl","authToken","orgId","loadPeriod","useCallback","range","detailResult","payoutsResult","fetchAdminDeveloperRevenueOrgDetail","organizationIdValue","billingAccountId","fetchAdminPayoutRequests","load","organizationId","orgResult","monthlyResult","fetchAdminDeveloperRevenueOrg","fetchAdminDeveloperRevenueOrgMonthly","defaultMonth","balanceResult","lifetimeResult","fetchBillingAccountCreditBalance","fetchCreditCost","loadError","handleMonthChange","AccessDenied","isServerError","ServerError","Loader2","withdrawn","sum","inFlight","monthOptions","PageHeader","ArrowLeft","PagePurpose","StatCard","CreditCard","Wallet","BadgeCheck","formatCredits","event","sale","retrySaleCreditSync"],"sources":["../../../../../src/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState, type FC } from 'react';\nimport { useParams } from 'react-router';\nimport {\n ArrowLeft,\n BadgeCheck,\n CreditCard,\n Loader2,\n TrendingDown,\n TrendingUp,\n Wallet,\n} from 'lucide-react';\n\nimport { useBilling } from '../../../providers/BillingProvider';\nimport { useBillingNavigate } from '../../../hooks/useBillingNavigate';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport { AccessDenied, PageHeader, ServerError, StatCard } from '../../../shared/components';\nimport { PagePurpose } from '@burdenoff/fe-libs/ui';\nimport {\n formatCredits,\n formatCurrency,\n formatDateTime,\n isServerError,\n} from '../../../shared/utils';\nimport {\n fetchAdminDeveloperRevenueOrg,\n fetchAdminDeveloperRevenueOrgDetail,\n fetchAdminDeveloperRevenueOrgMonthly,\n fetchAdminPayoutRequests,\n fetchBillingAccountCreditBalance,\n fetchCreditCost,\n retrySaleCreditSync,\n type AdminDeveloperRevenueOrg,\n type AdminDeveloperRevenueOrgDetail,\n type CreditBalanceByType,\n type DeveloperOrgMonthlyRevenuePoint,\n type PayoutRequest,\n} from '../api';\n\nconst ALL_TIME = 'all';\n\nconst PAYOUT_STATUS_LABEL: Record<string, string> = {\n REQUESTED: 'Requested',\n APPROVED: 'Approved',\n REJECTED: 'Rejected',\n PROCESSING: 'Processing',\n PAID: 'Paid',\n FAILED: 'Failed',\n CANCELED: 'Canceled',\n};\n\nconst PAYOUT_STATUS_COLORS: Record<string, string> = {\n REQUESTED: 'bg-status-warning-bg-subtle text-status-warning-text',\n APPROVED: 'bg-status-info-bg-subtle text-status-info-text',\n REJECTED: 'bg-status-error-bg-subtle text-status-error-text',\n PROCESSING: 'bg-status-info-bg-subtle text-status-info-text',\n PAID: 'bg-status-success-bg-subtle text-status-success-text',\n FAILED: 'bg-status-error-bg-subtle text-status-error-text',\n CANCELED: 'bg-bg-sunken text-text-muted',\n};\n\nfunction PayoutStatusBadge({ status }: { status: string }) {\n return (\n <span\n className={`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium ${PAYOUT_STATUS_COLORS[status] ?? 'bg-bg-sunken text-text-muted'}`}\n >\n {PAYOUT_STATUS_LABEL[status] ?? status}\n </span>\n );\n}\n\nfunction formatMonthLabel(iso: string): string {\n return new Date(iso).toLocaleDateString('en-US', { month: 'short', year: 'numeric' });\n}\n\n/**\n * Turns a month-start ISO string (as returned by developerOrgMonthlyRevenue,\n * always the first instant of a calendar month) into a [startDate, endDate]\n * range covering that whole month, for scoping the sales/withdrawal queries.\n * ALL_TIME returns an empty range (no filtering).\n */\nfunction monthRangeFor(month: string): { startDate?: string; endDate?: string } {\n if (month === ALL_TIME) return {};\n const start = new Date(month);\n if (Number.isNaN(start.getTime())) return {};\n const startDate = new Date(\n Date.UTC(start.getUTCFullYear(), start.getUTCMonth(), 1)\n ).toISOString();\n const endDate = new Date(\n Date.UTC(start.getUTCFullYear(), start.getUTCMonth() + 1, 1) - 1\n ).toISOString();\n return { startDate, endDate };\n}\n\nfunction MonthlyRevenueTrend({ points }: { points: DeveloperOrgMonthlyRevenuePoint[] }) {\n if (points.length === 0) {\n return (\n <div className=\"px-5 py-10 text-center text-sm text-text-muted\">\n No sales recorded yet — the revenue trend will appear once the first sale comes in.\n </div>\n );\n }\n\n return (\n <div className=\"overflow-x-auto\">\n <table className=\"min-w-full text-sm\">\n <thead className=\"bg-bg-sunken/60 text-left text-xs uppercase tracking-wide text-text-muted\">\n <tr>\n <th className=\"px-4 py-3\">Month</th>\n <th className=\"px-4 py-3\">Gross revenue</th>\n <th className=\"px-4 py-3\">Platform fee</th>\n <th className=\"px-4 py-3\">Net revenue</th>\n <th className=\"px-4 py-3\">Sales</th>\n <th className=\"px-4 py-3\">Growth (MoM)</th>\n </tr>\n </thead>\n <tbody>\n {points.map((point, index) => {\n const prior = index > 0 ? points[index - 1] : null;\n const growthPct =\n prior && prior.grossRevenue > 0\n ? ((point.grossRevenue - prior.grossRevenue) / prior.grossRevenue) * 100\n : null;\n\n return (\n <tr key={point.month} className=\"border-t border-border-seam\">\n <td className=\"px-4 py-3 font-medium text-text-primary\">\n {formatMonthLabel(point.month)}\n </td>\n <td className=\"px-4 py-3 text-text-primary\">\n {formatCurrency(point.grossRevenue, 'USD')}\n </td>\n <td className=\"px-4 py-3 text-text-secondary\">\n {formatCurrency(point.platformFees, 'USD')}\n </td>\n <td className=\"px-4 py-3 text-text-secondary\">\n {formatCurrency(point.netRevenue, 'USD')}\n </td>\n <td className=\"px-4 py-3 text-text-secondary\">{point.salesCount}</td>\n <td className=\"px-4 py-3\">\n {growthPct === null ? (\n <span className=\"text-text-muted\">—</span>\n ) : (\n <span\n className={`inline-flex items-center gap-1 font-medium ${\n growthPct >= 0 ? 'text-status-success-text' : 'text-status-error-text'\n }`}\n >\n {growthPct >= 0 ? (\n <TrendingUp className=\"size-3.5\" />\n ) : (\n <TrendingDown className=\"size-3.5\" />\n )}\n {growthPct >= 0 ? '+' : ''}\n {growthPct.toFixed(1)}%\n </span>\n )}\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n );\n}\n\nfunction WithdrawalHistory({ requests }: { requests: PayoutRequest[] }) {\n if (requests.length === 0) {\n return (\n <div className=\"px-5 py-10 text-center text-sm text-text-muted\">\n No withdrawal requests in this period.\n </div>\n );\n }\n\n return (\n <div className=\"overflow-x-auto\">\n <table className=\"min-w-full text-sm\">\n <thead className=\"bg-bg-sunken/60 text-left text-xs uppercase tracking-wide text-text-muted\">\n <tr>\n <th className=\"px-4 py-3\">Requested</th>\n <th className=\"px-4 py-3\">Kind</th>\n <th className=\"px-4 py-3\">Amount</th>\n <th className=\"px-4 py-3\">Status</th>\n <th className=\"px-4 py-3\">Paid</th>\n <th className=\"px-4 py-3\">Notes</th>\n </tr>\n </thead>\n <tbody>\n {requests.map((request) => (\n <tr key={request.id} className=\"border-t border-border-seam\">\n <td className=\"px-4 py-3 text-text-secondary\">{formatDateTime(request.createdAt)}</td>\n <td className=\"px-4 py-3 text-text-secondary\">\n {request.requestKind === 'CREDIT_CONVERSION'\n ? 'Revenue-share credits'\n : 'Cash payout'}\n </td>\n <td className=\"px-4 py-3 font-medium text-text-primary\">\n {formatCurrency(request.requestedAmount, request.currency)}\n </td>\n <td className=\"px-4 py-3\">\n <PayoutStatusBadge status={request.status} />\n </td>\n <td className=\"px-4 py-3 text-text-secondary\">\n {request.paidAt ? formatDateTime(request.paidAt) : '—'}\n </td>\n <td className=\"px-4 py-3 text-text-muted\">\n {request.failureReason || request.userNotes || '—'}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n\nexport const DeveloperRevenueOrgDetailPage: FC = () => {\n const { organizationId } = useParams<{ organizationId: string }>();\n const permissions = useBillingPermissions();\n const { apiGatewayUrl, authToken, orgId } = useBilling();\n const navigateTo = useBillingNavigate();\n\n const [org, setOrg] = useState<AdminDeveloperRevenueOrg | null>(null);\n const [monthly, setMonthly] = useState<DeveloperOrgMonthlyRevenuePoint[]>([]);\n const [creditBalance, setCreditBalance] = useState<CreditBalanceByType | null>(null);\n const [creditBalanceUsd, setCreditBalanceUsd] = useState<number | null>(null);\n // Lifetime (unscoped) withdrawal history — drives the \"Already withdrawn\" /\n // in-flight totals up top, which must stay accurate regardless of which\n // month the tables below are currently scoped to.\n const [lifetimePayouts, setLifetimePayouts] = useState<PayoutRequest[]>([]);\n // Period-scoped data — re-fetched whenever selectedMonth changes.\n const [detail, setDetail] = useState<AdminDeveloperRevenueOrgDetail | null>(null);\n const [payoutHistory, setPayoutHistory] = useState<PayoutRequest[]>([]);\n const [selectedMonth, setSelectedMonth] = useState<string>(ALL_TIME);\n\n const [loading, setLoading] = useState(true);\n const [periodLoading, setPeriodLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n const [retryingSaleId, setRetryingSaleId] = useState<string | null>(null);\n\n const requestContext = useMemo(\n () => ({ apiGatewayUrl, authToken, orgId }),\n [apiGatewayUrl, authToken, orgId]\n );\n\n const loadPeriod = useCallback(\n async (\n organizationIdValue: string,\n billingAccountId: string | null | undefined,\n month: string\n ) => {\n const range = monthRangeFor(month);\n const [detailResult, payoutsResult] = await Promise.all([\n fetchAdminDeveloperRevenueOrgDetail(organizationIdValue, requestContext, range),\n billingAccountId\n ? fetchAdminPayoutRequests(requestContext, {\n limit: 100,\n filter: { billingAccountId, ...range },\n })\n : Promise.resolve({ items: [], totalCount: 0, hasMore: false }),\n ]);\n setDetail(detailResult);\n setPayoutHistory(payoutsResult.items);\n },\n [requestContext]\n );\n\n const load = useCallback(async () => {\n if (!organizationId) return;\n setLoading(true);\n setError(null);\n try {\n const [orgResult, monthlyResult] = await Promise.all([\n fetchAdminDeveloperRevenueOrg(organizationId, requestContext),\n fetchAdminDeveloperRevenueOrgMonthly(organizationId, requestContext, 12),\n ]);\n setOrg(orgResult);\n setMonthly(monthlyResult);\n\n const billingAccountId = orgResult?.billingAccountId ?? null;\n const defaultMonth =\n monthlyResult.length > 0 ? monthlyResult[monthlyResult.length - 1].month : ALL_TIME;\n setSelectedMonth(defaultMonth);\n\n const [balanceResult, lifetimeResult] = await Promise.all([\n billingAccountId\n ? fetchBillingAccountCreditBalance(billingAccountId, requestContext)\n : Promise.resolve(null),\n billingAccountId\n ? fetchAdminPayoutRequests(requestContext, { limit: 100, filter: { billingAccountId } })\n : Promise.resolve({ items: [], totalCount: 0, hasMore: false }),\n loadPeriod(organizationId, billingAccountId, defaultMonth),\n ]);\n setCreditBalance(balanceResult);\n setLifetimePayouts(lifetimeResult.items);\n\n if (balanceResult && balanceResult.total > 0) {\n fetchCreditCost(balanceResult.total, 'USD', requestContext)\n .then(setCreditBalanceUsd)\n .catch(() => setCreditBalanceUsd(null));\n } else {\n setCreditBalanceUsd(0);\n }\n } catch (loadError) {\n setError(loadError instanceof Error ? loadError : new Error('Failed to load revenue detail'));\n } finally {\n setLoading(false);\n }\n }, [organizationId, requestContext, loadPeriod]);\n\n useEffect(() => {\n if (!permissions.isBillingAdmin) return;\n void load();\n }, [load, permissions.isBillingAdmin]);\n\n const handleMonthChange = (month: string) => {\n if (!organizationId || !org) return;\n setSelectedMonth(month);\n setPeriodLoading(true);\n void loadPeriod(organizationId, org.billingAccountId, month)\n .catch((loadError) => {\n setError(loadError instanceof Error ? loadError : new Error('Failed to load period data'));\n })\n .finally(() => setPeriodLoading(false));\n };\n\n if (!permissions.isBillingAdmin) {\n return <AccessDenied message=\"You don't have permission to view developer revenue.\" />;\n }\n\n if (error && isServerError(error)) {\n return (\n <ServerError\n title=\"Developer revenue unavailable\"\n message={error.message}\n showRetry\n onRetry={() => void load()}\n />\n );\n }\n\n if (loading || !org) {\n return (\n <div className=\"flex items-center justify-center py-20 text-text-secondary\">\n <Loader2 className=\"size-8 animate-spin\" />\n </div>\n );\n }\n\n const withdrawn = lifetimePayouts\n .filter((request) => request.status === 'PAID')\n .reduce((sum, request) => sum + (request.approvedAmount ?? request.requestedAmount), 0);\n const inFlight = lifetimePayouts\n .filter((request) => ['REQUESTED', 'APPROVED', 'PROCESSING'].includes(request.status))\n .reduce((sum, request) => sum + request.requestedAmount, 0);\n\n // Most-recent-first for the dropdown; `monthly` itself stays ascending\n // (oldest first) since that's what the trend table's MoM math needs.\n const monthOptions = [...monthly].reverse();\n\n return (\n <div className=\"space-y-6 p-6\">\n <PageHeader\n title={org.name}\n description={`/${org.slug}${org.isVerified ? ' · Verified developer organization' : ''}`}\n actions={\n <button\n type=\"button\"\n onClick={() => navigateTo('/developer-revenue')}\n className=\"inline-flex items-center gap-2 rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary\"\n >\n <ArrowLeft className=\"size-4\" />\n Back to developer revenue\n </button>\n }\n />\n\n <PagePurpose>\n Store revenue for this org is credited into its linked billing account as earned credits.\n The developer withdraws those credits later through their own billing withdrawal flow — this\n page is a read-and-verify view of that whole loop, from sale to payout.\n </PagePurpose>\n\n <div className=\"grid gap-3 md:grid-cols-2 xl:grid-cols-4\">\n <StatCard\n label=\"Gross revenue (all time)\"\n value={formatCurrency(org.totalRevenue, 'USD')}\n icon={<TrendingUp className=\"size-4\" />}\n />\n <StatCard\n label=\"Platform fees (all time)\"\n value={formatCurrency(org.totalPlatformFees, 'USD')}\n icon={<CreditCard className=\"size-4\" />}\n />\n <StatCard\n label=\"Pending earned credits\"\n value={formatCurrency(detail?.summary?.pendingBalance ?? org.pendingBalance, 'USD')}\n icon={<Wallet className=\"size-4\" />}\n />\n <StatCard\n label=\"Already withdrawn (all time)\"\n value={formatCurrency(withdrawn, 'USD')}\n icon={<BadgeCheck className=\"size-4\" />}\n />\n </div>\n\n <section className=\"overflow-hidden rounded-card border border-border-seam bg-bg-surface shadow-[var(--shadow-elevation-1)]\">\n <div className=\"border-b border-border-seam px-5 py-4\">\n <h2 className=\"text-base font-semibold text-text-primary\">Billing account balance</h2>\n <p className=\"mt-1 text-sm text-text-muted\">\n The current credit ledger on the org&apos;s linked billing account, right now. These are\n credit units, not currency — 1 credit is worth a small fraction of $1 at the\n platform&apos;s current credit rate.\n </p>\n </div>\n {!org.billingAccountId ? (\n <div className=\"px-5 py-8 text-center text-sm text-text-muted\">\n No billing account is linked yet — revenue cannot be credited until this org links one.\n </div>\n ) : !creditBalance ? (\n <div className=\"px-5 py-8 text-center text-sm text-text-muted\">\n Credit balance could not be loaded.\n </div>\n ) : (\n <>\n <div className=\"grid gap-3 p-5 md:grid-cols-3 xl:grid-cols-5\">\n <StatCard label=\"Earned\" value={formatCredits(creditBalance.earned)} />\n <StatCard label=\"Purchased\" value={formatCredits(creditBalance.purchased)} />\n <StatCard label=\"Granted\" value={formatCredits(creditBalance.granted)} />\n <StatCard label=\"Withdrawable\" value={formatCredits(creditBalance.withdrawable)} />\n <StatCard label=\"Total balance\" value={formatCredits(creditBalance.total)} />\n </div>\n <div className=\"px-5 pb-4 text-xs text-text-muted\">\n {creditBalanceUsd === null\n ? 'Estimated cash value could not be loaded.'\n : `≈ ${formatCurrency(creditBalanceUsd, 'USD')} total at the current credit rate.`}\n </div>\n </>\n )}\n {inFlight > 0 && (\n <div className=\"border-t border-border-seam bg-status-warning-bg-subtle px-5 py-3 text-xs text-status-warning-text\">\n {formatCurrency(inFlight, 'USD')} is currently tied up in a pending or approved\n withdrawal request — it has already left the withdrawable balance above.\n </div>\n )}\n </section>\n\n <section className=\"overflow-hidden rounded-card border border-border-seam bg-bg-surface shadow-[var(--shadow-elevation-1)]\">\n <div className=\"border-b border-border-seam px-5 py-4\">\n <h2 className=\"text-base font-semibold text-text-primary\">Monthly revenue trend</h2>\n <p className=\"mt-1 text-sm text-text-muted\">\n Last 12 months of gross/net revenue for this org, computed from completed sales.\n </p>\n </div>\n <MonthlyRevenueTrend points={monthly} />\n </section>\n\n <div className=\"flex flex-wrap items-center justify-between gap-3 rounded-card border border-border-seam bg-bg-surface px-5 py-4 shadow-[var(--shadow-elevation-1)]\">\n <div>\n <h2 className=\"text-sm font-semibold text-text-primary\">Viewing activity for</h2>\n <p className=\"mt-1 text-xs text-text-muted\">\n Scopes both the withdrawal history and sales tables below — pick a single month to keep\n long-running orgs easy to review, or switch to all time.\n </p>\n </div>\n <div className=\"flex items-center gap-2\">\n {periodLoading && <Loader2 className=\"size-4 animate-spin text-text-muted\" />}\n <select\n value={selectedMonth}\n onChange={(event) => handleMonthChange(event.target.value)}\n disabled={periodLoading}\n className=\"rounded-md border border-border-subtle bg-bg-surface scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary px-3 py-2 text-sm text-text-primary disabled:opacity-50\"\n >\n <option value={ALL_TIME}>All time</option>\n {monthOptions.map((point) => (\n <option key={point.month} value={point.month}>\n {formatMonthLabel(point.month)}\n </option>\n ))}\n </select>\n </div>\n </div>\n\n <section className=\"overflow-hidden rounded-card border border-border-seam bg-bg-surface shadow-[var(--shadow-elevation-1)]\">\n <div className=\"border-b border-border-seam px-5 py-4\">\n <h2 className=\"text-base font-semibold text-text-primary\">Withdrawal history</h2>\n <p className=\"mt-1 text-sm text-text-muted\">\n Payout requests this org made in{' '}\n {selectedMonth === ALL_TIME ? 'all time' : formatMonthLabel(selectedMonth)} — both\n revenue-share credit conversions and cash payouts — with current status.\n </p>\n </div>\n <div className={periodLoading ? 'pointer-events-none opacity-50' : undefined}>\n <WithdrawalHistory requests={payoutHistory} />\n </div>\n </section>\n\n <section className=\"overflow-hidden rounded-card border border-border-seam bg-bg-surface shadow-[var(--shadow-elevation-1)]\">\n <div className=\"border-b border-border-seam px-5 py-4\">\n <h2 className=\"text-base font-semibold text-text-primary\">\n Sales currently contributing to earned credits\n </h2>\n <p className=\"mt-1 text-xs text-text-muted\">\n Unpaid sales purchased in{' '}\n {selectedMonth === ALL_TIME ? 'all time' : formatMonthLabel(selectedMonth)} that should\n exist as earned credits in the linked billing account until the developer withdraws\n them.\n </p>\n </div>\n <div className={`overflow-x-auto ${periodLoading ? 'pointer-events-none opacity-50' : ''}`}>\n <table className=\"min-w-full text-sm\">\n <thead className=\"bg-bg-sunken/60 text-left text-xs uppercase tracking-wide text-text-muted\">\n <tr>\n <th className=\"px-4 py-3\">Application</th>\n <th className=\"px-4 py-3\">Purchased</th>\n <th className=\"px-4 py-3\">Net revenue</th>\n <th className=\"px-4 py-3\">Credit sync</th>\n <th className=\"px-4 py-3\">Status</th>\n </tr>\n </thead>\n <tbody>\n {!detail || detail.unpaidSales.items.length === 0 ? (\n <tr>\n <td colSpan={5} className=\"px-4 py-8 text-center text-sm text-text-muted\">\n No outstanding unpaid sales in this period.\n </td>\n </tr>\n ) : (\n detail.unpaidSales.items.map((sale) => (\n <tr key={sale.id} className=\"border-t border-border-seam\">\n <td className=\"px-4 py-3\">\n <div className=\"font-medium text-text-primary\">\n {sale.application?.name ?? 'Unknown app'}\n </div>\n <div className=\"text-xs text-text-muted\">\n /{sale.application?.slug ?? 'unknown'}\n </div>\n </td>\n <td className=\"px-4 py-3 text-text-secondary\">\n {formatDateTime(sale.purchasedAt)}\n </td>\n <td className=\"px-4 py-3 text-text-primary\">\n {formatCurrency(sale.netAmount, sale.currency)}\n </td>\n <td className=\"px-4 py-3 text-text-secondary\">\n <div>{sale.billingCreditSyncStatus ?? 'UNKNOWN'}</div>\n {sale.billingCreditSyncError && (\n <div className=\"mt-1 text-xs text-status-error-text\">\n {sale.billingCreditSyncError}\n </div>\n )}\n {sale.billingCreditSyncStatus !== 'SYNCED' && org.billingAccountId && (\n <button\n type=\"button\"\n onClick={() => {\n if (!organizationId) return;\n void (async () => {\n setRetryingSaleId(sale.id);\n try {\n await retrySaleCreditSync(sale.id, requestContext);\n await loadPeriod(\n organizationId,\n org.billingAccountId,\n selectedMonth\n );\n } finally {\n setRetryingSaleId(null);\n }\n })();\n }}\n disabled={retryingSaleId === sale.id}\n className=\"mt-2 rounded-md border border-border-subtle px-2 py-1 text-xs font-medium text-text-primary disabled:opacity-50\"\n >\n {retryingSaleId === sale.id ? 'Retrying…' : 'Retry sync'}\n </button>\n )}\n </td>\n <td className=\"px-4 py-3 text-text-secondary\">{sale.status}</td>\n </tr>\n ))\n )}\n </tbody>\n </table>\n </div>\n </section>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsCA,IAAME,IAAW,OAEXC,IAA8C;CAClD,WAAW;CACX,UAAU;CACV,UAAU;CACV,YAAY;CACZ,MAAM;CACN,QAAQ;CACR,UAAU;AACZ,GAEMC,IAA+C;CACnD,WAAW;CACX,UAAU;CACV,UAAU;CACV,YAAY;CACZ,MAAM;CACN,QAAQ;CACR,UAAU;AACZ;AAEA,SAASC,EAAkB,EAAE,aAA8B;CACzD,OACE,kBAAC,QAAD;EACE,WAAW,2EAA2ED,EAAqBE,MAAW;EAErH,UAAAH,EAAoBG,MAAWA;CAC5B,CAAA;AAEV;AAEA,SAASC,EAAiB,GAAqB;CAC7C,OAAO,IAAI,KAAKC,C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perRevenueOrgDetailPage.js","names":["_Fragment","Fragment$1","ALL_TIME","PAYOUT_STATUS_LABEL","PAYOUT_STATUS_COLORS","PayoutStatusBadge","status","formatMonthLabel","iso","monthRangeFor","month","start","MonthlyRevenueTrend","points","prior","index","growthPct","point","formatCurrency","jsx","TrendingUp","TrendingDown","WithdrawalHistory","requests","formatDateTime","request","DeveloperRevenueOrgDetailPage","useParams","permissions","useBillingPermissions","useBilling","navigateTo","useBillingNavigate","org","setOrg","useState","monthly","setMonthly","creditBalance","setCreditBalance","creditBalanceUsd","setCreditBalanceUsd","lifetimePayouts","setLifetimePayouts","detail","setDetail","payoutHistory","setPayoutHistory","selectedMonth","setSelectedMonth","loading","setLoading","periodLoading","setPeriodLoading","error","setError","retryingSaleId","setRetryingSaleId","requestContext","useMemo","apiGatewayUrl","authToken","orgId","loadPeriod","useCallback","range","detailResult","payoutsResult","fetchAdminDeveloperRevenueOrgDetail","organizationIdValue","billingAccountId","fetchAdminPayoutRequests","load","organizationId","orgResult","monthlyResult","fetchAdminDeveloperRevenueOrg","fetchAdminDeveloperRevenueOrgMonthly","defaultMonth","balanceResult","lifetimeResult","fetchBillingAccountCreditBalance","fetchCreditCost","loadError","handleMonthChange","AccessDenied","isServerError","ServerError","Loader2","withdrawn","sum","inFlight","monthOptions","PageHeader","ArrowLeft","PagePurpose","StatCard","CreditCard","Wallet","BadgeCheck","formatCredits","event","sale","retrySaleCreditSync"],"sources":["../../../../../src/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState, type FC } from 'react';\nimport { useParams } from 'react-router';\nimport {\n ArrowLeft,\n BadgeCheck,\n CreditCard,\n Loader2,\n TrendingDown,\n TrendingUp,\n Wallet,\n} from 'lucide-react';\n\nimport { useBilling } from '../../../providers/BillingProvider';\nimport { useBillingNavigate } from '../../../hooks/useBillingNavigate';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport { AccessDenied, PageHeader, ServerError, StatCard } from '../../../shared/components';\nimport { PagePurpose } from '@burdenoff/fe-libs/ui';\nimport {\n formatCredits,\n formatCurrency,\n formatDateTime,\n isServerError,\n} from '../../../shared/utils';\nimport {\n fetchAdminDeveloperRevenueOrg,\n fetchAdminDeveloperRevenueOrgDetail,\n fetchAdminDeveloperRevenueOrgMonthly,\n fetchAdminPayoutRequests,\n fetchBillingAccountCreditBalance,\n fetchCreditCost,\n retrySaleCreditSync,\n type AdminDeveloperRevenueOrg,\n type AdminDeveloperRevenueOrgDetail,\n type CreditBalanceByType,\n type DeveloperOrgMonthlyRevenuePoint,\n type PayoutRequest,\n} from '../api';\n\nconst ALL_TIME = 'all';\n\nconst PAYOUT_STATUS_LABEL: Record<string, string> = {\n REQUESTED: 'Requested',\n APPROVED: 'Approved',\n REJECTED: 'Rejected',\n PROCESSING: 'Processing',\n PAID: 'Paid',\n FAILED: 'Failed',\n CANCELED: 'Canceled',\n};\n\nconst PAYOUT_STATUS_COLORS: Record<string, string> = {\n REQUESTED: 'bg-status-warning-bg-subtle text-status-warning-text',\n APPROVED: 'bg-status-info-bg-subtle text-status-info-text',\n REJECTED: 'bg-status-error-bg-subtle text-status-error-text',\n PROCESSING: 'bg-status-info-bg-subtle text-status-info-text',\n PAID: 'bg-status-success-bg-subtle text-status-success-text',\n FAILED: 'bg-status-error-bg-subtle text-status-error-text',\n CANCELED: 'bg-bg-sunken text-text-muted',\n};\n\nfunction PayoutStatusBadge({ status }: { status: string }) {\n return (\n <span\n className={`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium ${PAYOUT_STATUS_COLORS[status] ?? 'bg-bg-sunken text-text-muted'}`}\n >\n {PAYOUT_STATUS_LABEL[status] ?? status}\n </span>\n );\n}\n\nfunction formatMonthLabel(iso: string): string {\n return new Date(iso).toLocaleDateString('en-US', { month: 'short', year: 'numeric' });\n}\n\n/**\n * Turns a month-start ISO string (as returned by developerOrgMonthlyRevenue,\n * always the first instant of a calendar month) into a [startDate, endDate]\n * range covering that whole month, for scoping the sales/withdrawal queries.\n * ALL_TIME returns an empty range (no filtering).\n */\nfunction monthRangeFor(month: string): { startDate?: string; endDate?: string } {\n if (month === ALL_TIME) return {};\n const start = new Date(month);\n if (Number.isNaN(start.getTime())) return {};\n const startDate = new Date(\n Date.UTC(start.getUTCFullYear(), start.getUTCMonth(), 1)\n ).toISOString();\n const endDate = new Date(\n Date.UTC(start.getUTCFullYear(), start.getUTCMonth() + 1, 1) - 1\n ).toISOString();\n return { startDate, endDate };\n}\n\nfunction MonthlyRevenueTrend({ points }: { points: DeveloperOrgMonthlyRevenuePoint[] }) {\n if (points.length === 0) {\n return (\n <div className=\"px-5 py-10 text-center text-sm text-text-muted\">\n No sales recorded yet — the revenue trend will appear once the first sale comes in.\n </div>\n );\n }\n\n return (\n <div className=\"overflow-x-auto\">\n <table className=\"min-w-full text-sm\">\n <thead className=\"bg-bg-sunken/60 text-left text-xs uppercase tracking-wide text-text-muted\">\n <tr>\n <th className=\"px-4 py-3\">Month</th>\n <th className=\"px-4 py-3\">Gross revenue</th>\n <th className=\"px-4 py-3\">Platform fee</th>\n <th className=\"px-4 py-3\">Net revenue</th>\n <th className=\"px-4 py-3\">Sales</th>\n <th className=\"px-4 py-3\">Growth (MoM)</th>\n </tr>\n </thead>\n <tbody>\n {points.map((point, index) => {\n const prior = index > 0 ? points[index - 1] : null;\n const growthPct =\n prior && prior.grossRevenue > 0\n ? ((point.grossRevenue - prior.grossRevenue) / prior.grossRevenue) * 100\n : null;\n\n return (\n <tr key={point.month} className=\"border-t border-border-seam\">\n <td className=\"px-4 py-3 font-medium text-text-primary\">\n {formatMonthLabel(point.month)}\n </td>\n <td className=\"px-4 py-3 text-text-primary\">\n {formatCurrency(point.grossRevenue, 'USD')}\n </td>\n <td className=\"px-4 py-3 text-text-secondary\">\n {formatCurrency(point.platformFees, 'USD')}\n </td>\n <td className=\"px-4 py-3 text-text-secondary\">\n {formatCurrency(point.netRevenue, 'USD')}\n </td>\n <td className=\"px-4 py-3 text-text-secondary\">{point.salesCount}</td>\n <td className=\"px-4 py-3\">\n {growthPct === null ? (\n <span className=\"text-text-muted\">—</span>\n ) : (\n <span\n className={`inline-flex items-center gap-1 font-medium ${\n growthPct >= 0 ? 'text-status-success-text' : 'text-status-error-text'\n }`}\n >\n {growthPct >= 0 ? (\n <TrendingUp className=\"size-3.5\" />\n ) : (\n <TrendingDown className=\"size-3.5\" />\n )}\n {growthPct >= 0 ? '+' : ''}\n {growthPct.toFixed(1)}%\n </span>\n )}\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n );\n}\n\nfunction WithdrawalHistory({ requests }: { requests: PayoutRequest[] }) {\n if (requests.length === 0) {\n return (\n <div className=\"px-5 py-10 text-center text-sm text-text-muted\">\n No withdrawal requests in this period.\n </div>\n );\n }\n\n return (\n <div className=\"overflow-x-auto\">\n <table className=\"min-w-full text-sm\">\n <thead className=\"bg-bg-sunken/60 text-left text-xs uppercase tracking-wide text-text-muted\">\n <tr>\n <th className=\"px-4 py-3\">Requested</th>\n <th className=\"px-4 py-3\">Kind</th>\n <th className=\"px-4 py-3\">Amount</th>\n <th className=\"px-4 py-3\">Status</th>\n <th className=\"px-4 py-3\">Paid</th>\n <th className=\"px-4 py-3\">Notes</th>\n </tr>\n </thead>\n <tbody>\n {requests.map((request) => (\n <tr key={request.id} className=\"border-t border-border-seam\">\n <td className=\"px-4 py-3 text-text-secondary\">{formatDateTime(request.createdAt)}</td>\n <td className=\"px-4 py-3 text-text-secondary\">\n {request.requestKind === 'CREDIT_CONVERSION'\n ? 'Revenue-share credits'\n : 'Cash payout'}\n </td>\n <td className=\"px-4 py-3 font-medium text-text-primary\">\n {formatCurrency(request.requestedAmount, request.currency)}\n </td>\n <td className=\"px-4 py-3\">\n <PayoutStatusBadge status={request.status} />\n </td>\n <td className=\"px-4 py-3 text-text-secondary\">\n {request.paidAt ? formatDateTime(request.paidAt) : '—'}\n </td>\n <td className=\"px-4 py-3 text-text-muted\">\n {request.failureReason || request.userNotes || '—'}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n\nexport const DeveloperRevenueOrgDetailPage: FC = () => {\n const { organizationId } = useParams<{ organizationId: string }>();\n const permissions = useBillingPermissions();\n const { apiGatewayUrl, authToken, orgId } = useBilling();\n const navigateTo = useBillingNavigate();\n\n const [org, setOrg] = useState<AdminDeveloperRevenueOrg | null>(null);\n const [monthly, setMonthly] = useState<DeveloperOrgMonthlyRevenuePoint[]>([]);\n const [creditBalance, setCreditBalance] = useState<CreditBalanceByType | null>(null);\n const [creditBalanceUsd, setCreditBalanceUsd] = useState<number | null>(null);\n // Lifetime (unscoped) withdrawal history — drives the \"Already withdrawn\" /\n // in-flight totals up top, which must stay accurate regardless of which\n // month the tables below are currently scoped to.\n const [lifetimePayouts, setLifetimePayouts] = useState<PayoutRequest[]>([]);\n // Period-scoped data — re-fetched whenever selectedMonth changes.\n const [detail, setDetail] = useState<AdminDeveloperRevenueOrgDetail | null>(null);\n const [payoutHistory, setPayoutHistory] = useState<PayoutRequest[]>([]);\n const [selectedMonth, setSelectedMonth] = useState<string>(ALL_TIME);\n\n const [loading, setLoading] = useState(true);\n const [periodLoading, setPeriodLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n const [retryingSaleId, setRetryingSaleId] = useState<string | null>(null);\n\n const requestContext = useMemo(\n () => ({ apiGatewayUrl, authToken, orgId }),\n [apiGatewayUrl, authToken, orgId]\n );\n\n const loadPeriod = useCallback(\n async (\n organizationIdValue: string,\n billingAccountId: string | null | undefined,\n month: string\n ) => {\n const range = monthRangeFor(month);\n const [detailResult, payoutsResult] = await Promise.all([\n fetchAdminDeveloperRevenueOrgDetail(organizationIdValue, requestContext, range),\n billingAccountId\n ? fetchAdminPayoutRequests(requestContext, {\n limit: 100,\n filter: { billingAccountId, ...range },\n })\n : Promise.resolve({ items: [], totalCount: 0, hasMore: false }),\n ]);\n setDetail(detailResult);\n setPayoutHistory(payoutsResult.items);\n },\n [requestContext]\n );\n\n const load = useCallback(async () => {\n if (!organizationId) return;\n setLoading(true);\n setError(null);\n try {\n const [orgResult, monthlyResult] = await Promise.all([\n fetchAdminDeveloperRevenueOrg(organizationId, requestContext),\n fetchAdminDeveloperRevenueOrgMonthly(organizationId, requestContext, 12),\n ]);\n setOrg(orgResult);\n setMonthly(monthlyResult);\n\n const billingAccountId = orgResult?.billingAccountId ?? null;\n const defaultMonth =\n monthlyResult.length > 0 ? monthlyResult[monthlyResult.length - 1].month : ALL_TIME;\n setSelectedMonth(defaultMonth);\n\n const [balanceResult, lifetimeResult] = await Promise.all([\n billingAccountId\n ? fetchBillingAccountCreditBalance(billingAccountId, requestContext)\n : Promise.resolve(null),\n billingAccountId\n ? fetchAdminPayoutRequests(requestContext, { limit: 100, filter: { billingAccountId } })\n : Promise.resolve({ items: [], totalCount: 0, hasMore: false }),\n loadPeriod(organizationId, billingAccountId, defaultMonth),\n ]);\n setCreditBalance(balanceResult);\n setLifetimePayouts(lifetimeResult.items);\n\n if (balanceResult && balanceResult.total > 0) {\n fetchCreditCost(balanceResult.total, 'USD', requestContext)\n .then(setCreditBalanceUsd)\n .catch(() => setCreditBalanceUsd(null));\n } else {\n setCreditBalanceUsd(0);\n }\n } catch (loadError) {\n setError(loadError instanceof Error ? loadError : new Error('Failed to load revenue detail'));\n } finally {\n setLoading(false);\n }\n }, [organizationId, requestContext, loadPeriod]);\n\n useEffect(() => {\n if (!permissions.isBillingAdmin) return;\n void load();\n }, [load, permissions.isBillingAdmin]);\n\n const handleMonthChange = (month: string) => {\n if (!organizationId || !org) return;\n setSelectedMonth(month);\n setPeriodLoading(true);\n void loadPeriod(organizationId, org.billingAccountId, month)\n .catch((loadError) => {\n setError(loadError instanceof Error ? loadError : new Error('Failed to load period data'));\n })\n .finally(() => setPeriodLoading(false));\n };\n\n if (!permissions.isBillingAdmin) {\n return <AccessDenied message=\"You don't have permission to view developer revenue.\" />;\n }\n\n if (error && isServerError(error)) {\n return (\n <ServerError\n title=\"Developer revenue unavailable\"\n message={error.message}\n showRetry\n onRetry={() => void load()}\n />\n );\n }\n\n if (loading || !org) {\n return (\n <div className=\"flex items-center justify-center py-20 text-text-secondary\">\n <Loader2 className=\"size-8 animate-spin\" />\n </div>\n );\n }\n\n const withdrawn = lifetimePayouts\n .filter((request) => request.status === 'PAID')\n .reduce((sum, request) => sum + (request.approvedAmount ?? request.requestedAmount), 0);\n const inFlight = lifetimePayouts\n .filter((request) => ['REQUESTED', 'APPROVED', 'PROCESSING'].includes(request.status))\n .reduce((sum, request) => sum + request.requestedAmount, 0);\n\n // Most-recent-first for the dropdown; `monthly` itself stays ascending\n // (oldest first) since that's what the trend table's MoM math needs.\n const monthOptions = [...monthly].reverse();\n\n return (\n <div className=\"space-y-6 p-6\">\n <PageHeader\n title={org.name}\n description={`/${org.slug}${org.isVerified ? ' · Verified developer organization' : ''}`}\n actions={\n <button\n type=\"button\"\n onClick={() => navigateTo('/developer-revenue')}\n className=\"inline-flex items-center gap-2 rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary\"\n >\n <ArrowLeft className=\"size-4\" />\n Back to developer revenue\n </button>\n }\n />\n\n <PagePurpose>\n Store revenue for this org is credited into its linked billing account as earned credits.\n The developer withdraws those credits later through their own billing withdrawal flow — this\n page is a read-and-verify view of that whole loop, from sale to payout.\n </PagePurpose>\n\n <div className=\"grid gap-3 md:grid-cols-2 xl:grid-cols-4\">\n <StatCard\n label=\"Gross revenue (all time)\"\n value={formatCurrency(org.totalRevenue, 'USD')}\n icon={<TrendingUp className=\"size-4\" />}\n />\n <StatCard\n label=\"Platform fees (all time)\"\n value={formatCurrency(org.totalPlatformFees, 'USD')}\n icon={<CreditCard className=\"size-4\" />}\n />\n <StatCard\n label=\"Pending earned credits\"\n value={formatCurrency(detail?.summary?.pendingBalance ?? org.pendingBalance, 'USD')}\n icon={<Wallet className=\"size-4\" />}\n />\n <StatCard\n label=\"Already withdrawn (all time)\"\n value={formatCurrency(withdrawn, 'USD')}\n icon={<BadgeCheck className=\"size-4\" />}\n />\n </div>\n\n <section className=\"overflow-hidden rounded-card border border-border-seam bg-bg-surface shadow-[var(--shadow-elevation-1)]\">\n <div className=\"border-b border-border-seam px-5 py-4\">\n <h2 className=\"text-base font-semibold text-text-primary\">Billing account balance</h2>\n <p className=\"mt-1 text-sm text-text-muted\">\n The current credit ledger on the org&apos;s linked billing account, right now. These are\n credit units, not currency — 1 credit is worth a small fraction of $1 at the\n platform&apos;s current credit rate.\n </p>\n </div>\n {!org.billingAccountId ? (\n <div className=\"px-5 py-8 text-center text-sm text-text-muted\">\n No billing account is linked yet — revenue cannot be credited until this org links one.\n </div>\n ) : !creditBalance ? (\n <div className=\"px-5 py-8 text-center text-sm text-text-muted\">\n Credit balance could not be loaded.\n </div>\n ) : (\n <>\n <div className=\"grid gap-3 p-5 md:grid-cols-3 xl:grid-cols-5\">\n <StatCard label=\"Earned\" value={formatCredits(creditBalance.earned)} />\n <StatCard label=\"Purchased\" value={formatCredits(creditBalance.purchased)} />\n <StatCard label=\"Granted\" value={formatCredits(creditBalance.granted)} />\n <StatCard label=\"Withdrawable\" value={formatCredits(creditBalance.withdrawable)} />\n <StatCard label=\"Total balance\" value={formatCredits(creditBalance.total)} />\n </div>\n <div className=\"px-5 pb-4 text-xs text-text-muted\">\n {creditBalanceUsd === null\n ? 'Estimated cash value could not be loaded.'\n : `≈ ${formatCurrency(creditBalanceUsd, 'USD')} total at the current credit rate.`}\n </div>\n </>\n )}\n {inFlight > 0 && (\n <div className=\"border-t border-border-seam bg-status-warning-bg-subtle px-5 py-3 text-xs text-status-warning-text\">\n {formatCurrency(inFlight, 'USD')} is currently tied up in a pending or approved\n withdrawal request — it has already left the withdrawable balance above.\n </div>\n )}\n </section>\n\n <section className=\"overflow-hidden rounded-card border border-border-seam bg-bg-surface shadow-[var(--shadow-elevation-1)]\">\n <div className=\"border-b border-border-seam px-5 py-4\">\n <h2 className=\"text-base font-semibold text-text-primary\">Monthly revenue trend</h2>\n <p className=\"mt-1 text-sm text-text-muted\">\n Last 12 months of gross/net revenue for this org, computed from completed sales.\n </p>\n </div>\n <MonthlyRevenueTrend points={monthly} />\n </section>\n\n <div className=\"flex flex-wrap items-center justify-between gap-3 rounded-card border border-border-seam bg-bg-surface px-5 py-4 shadow-[var(--shadow-elevation-1)]\">\n <div>\n <h2 className=\"text-sm font-semibold text-text-primary\">Viewing activity for</h2>\n <p className=\"mt-1 text-xs text-text-muted\">\n Scopes both the withdrawal history and sales tables below — pick a single month to keep\n long-running orgs easy to review, or switch to all time.\n </p>\n </div>\n <div className=\"flex items-center gap-2\">\n {periodLoading && <Loader2 className=\"size-4 animate-spin text-text-muted\" />}\n <select\n value={selectedMonth}\n onChange={(event) => handleMonthChange(event.target.value)}\n disabled={periodLoading}\n className=\"rounded-md border border-border-subtle bg-bg-surface scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary px-3 py-2 text-sm text-text-primary disabled:opacity-50\"\n >\n <option value={ALL_TIME}>All time</option>\n {monthOptions.map((point) => (\n <option key={point.month} value={point.month}>\n {formatMonthLabel(point.month)}\n </option>\n ))}\n </select>\n </div>\n </div>\n\n <section className=\"overflow-hidden rounded-card border border-border-seam bg-bg-surface shadow-[var(--shadow-elevation-1)]\">\n <div className=\"border-b border-border-seam px-5 py-4\">\n <h2 className=\"text-base font-semibold text-text-primary\">Withdrawal history</h2>\n <p className=\"mt-1 text-sm text-text-muted\">\n Payout requests this org made in{' '}\n {selectedMonth === ALL_TIME ? 'all time' : formatMonthLabel(selectedMonth)} — both\n revenue-share credit conversions and cash payouts — with current status.\n </p>\n </div>\n <div className={periodLoading ? 'pointer-events-none opacity-50' : undefined}>\n <WithdrawalHistory requests={payoutHistory} />\n </div>\n </section>\n\n <section className=\"overflow-hidden rounded-card border border-border-seam bg-bg-surface shadow-[var(--shadow-elevation-1)]\">\n <div className=\"border-b border-border-seam px-5 py-4\">\n <h2 className=\"text-base font-semibold text-text-primary\">\n Sales currently contributing to earned credits\n </h2>\n <p className=\"mt-1 text-xs text-text-muted\">\n Unpaid sales purchased in{' '}\n {selectedMonth === ALL_TIME ? 'all time' : formatMonthLabel(selectedMonth)} that should\n exist as earned credits in the linked billing account until the developer withdraws\n them.\n </p>\n </div>\n <div className={`overflow-x-auto ${periodLoading ? 'pointer-events-none opacity-50' : ''}`}>\n <table className=\"min-w-full text-sm\">\n <thead className=\"bg-bg-sunken/60 text-left text-xs uppercase tracking-wide text-text-muted\">\n <tr>\n <th className=\"px-4 py-3\">Application</th>\n <th className=\"px-4 py-3\">Purchased</th>\n <th className=\"px-4 py-3\">Net revenue</th>\n <th className=\"px-4 py-3\">Credit sync</th>\n <th className=\"px-4 py-3\">Status</th>\n </tr>\n </thead>\n <tbody>\n {!detail || detail.unpaidSales.items.length === 0 ? (\n <tr>\n <td colSpan={5} className=\"px-4 py-8 text-center text-sm text-text-muted\">\n No outstanding unpaid sales in this period.\n </td>\n </tr>\n ) : (\n detail.unpaidSales.items.map((sale) => (\n <tr key={sale.id} className=\"border-t border-border-seam\">\n <td className=\"px-4 py-3\">\n <div className=\"font-medium text-text-primary\">\n {sale.application?.name ?? 'Unknown app'}\n </div>\n <div className=\"text-xs text-text-muted\">\n /{sale.application?.slug ?? 'unknown'}\n </div>\n </td>\n <td className=\"px-4 py-3 text-text-secondary\">\n {formatDateTime(sale.purchasedAt)}\n </td>\n <td className=\"px-4 py-3 text-text-primary\">\n {formatCurrency(sale.netAmount, sale.currency)}\n </td>\n <td className=\"px-4 py-3 text-text-secondary\">\n <div>{sale.billingCreditSyncStatus ?? 'UNKNOWN'}</div>\n {sale.billingCreditSyncError && (\n <div className=\"mt-1 text-xs text-status-error-text\">\n {sale.billingCreditSyncError}\n </div>\n )}\n {sale.billingCreditSyncStatus !== 'SYNCED' && org.billingAccountId && (\n <button\n type=\"button\"\n onClick={() => {\n if (!organizationId) return;\n void (async () => {\n setRetryingSaleId(sale.id);\n try {\n await retrySaleCreditSync(sale.id, requestContext);\n await loadPeriod(\n organizationId,\n org.billingAccountId,\n selectedMonth\n );\n } finally {\n setRetryingSaleId(null);\n }\n })();\n }}\n disabled={retryingSaleId === sale.id}\n className=\"mt-2 rounded-md border border-border-subtle px-2 py-1 text-xs font-medium text-text-primary disabled:opacity-50\"\n >\n {retryingSaleId === sale.id ? 'Retrying…' : 'Retry sync'}\n </button>\n )}\n </td>\n <td className=\"px-4 py-3 text-text-secondary\">{sale.status}</td>\n </tr>\n ))\n )}\n </tbody>\n </table>\n </div>\n </section>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsCA,IAAME,IAAW,OAEXC,IAA8C;CAClD,WAAW;CACX,UAAU;CACV,UAAU;CACV,YAAY;CACZ,MAAM;CACN,QAAQ;CACR,UAAU;AACZ,GAEMC,IAA+C;CACnD,WAAW;CACX,UAAU;CACV,UAAU;CACV,YAAY;CACZ,MAAM;CACN,QAAQ;CACR,UAAU;AACZ;AAEA,SAASC,EAAkB,EAAE,aAA8B;CACzD,OACE,kBAAC,QAAD;EACE,WAAW,2EAA2ED,EAAqBE,MAAW;EAErH,UAAAH,EAAoBG,MAAWA;CAC5B,CAAA;AAEV;AAEA,SAASC,EAAiB,GAAqB;CAC7C,OAAO,IAAI,KAAKC,CAAG,CAAC,CAAC,mBAAmB,SAAS;EAAE,OAAO;EAAS,MAAM;CAAU,CAAC;AACtF;AAQA,SAASC,GAAc,GAAyD;CAC9E,IAAIC,MAAUR,GAAU,OAAO,CAAC;CAChC,IAAMS,IAAQ,IAAI,KAAKD,CAAK;CAQ5B,OAPI,OAAO,MAAMC,EAAM,QAAQ,CAAC,IAAU,CAAC,IAOpC;EAAE,WANS,IAAI,KACpB,KAAK,IAAIA,EAAM,eAAe,GAAGA,EAAM,YAAY,GAAG,CAAC,CACzD,CAAC,CAAC,YAIO;EAAW,0BAHJ,IAAI,KAClB,KAAK,IAAIA,EAAM,eAAe,GAAGA,EAAM,YAAY,IAAI,GAAG,CAAC,IAAI,CACjE,EAAA,CAAE,YACkB;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AAK,QAAQ;QAC3C,CAAA;QACJ,kBAAC,MAAD;SAAI,WAAU;SAAd,UAAA;UACE,kBAAC,OAAD,EAAA,UAAMA,EAAK,2BAA2B,UAAe,CAAA;UACpDA,EAAK,0BACJ,kBAAC,OAAD;WAAK,WAAU;WACZ,UAAAA,EAAK;UACH,CAAA;UAENA,EAAK,4BAA4B,YAAYrE,EAAI,oBAChD,kBAAC,UAAD;WACE,MAAK;WACL,eAAe;YACb,AAAKwC,MACC,YAAY;aAChB,EAAkB6B,EAAK,EAAE;aACzB,IAAI;cAEF,AADA,MAAMC,GAAoBD,EAAK,IAAI5C,CAAc,GACjD,MAAMK,EACJU,GACAxC,EAAI,kBACJe,CACF;aACF,UAAU;cACR,EAAkB,IAAI;aACxB;YACF,EAAA,CAAG;WACL;WACA,UAAUQ,MAAmB8C,EAAK;WAClC,WAAU;WAET,UAAA9C,MAAmB8C,EAAK,KAAK,cAAc;UACtC,CAAA;SAER;;QACJ,kBAAC,MAAD;SAAI,WAAU;SAAiC,UAAAA,EAAK;QAAW,CAAA;OAC7D;MAjDK,GAAAA,EAAK,EAiDV,CACL,EAEE,CAAA,CACF;;IACJ,CAAA,CACE;;EACN;;AAET"}
@@ -1,9 +1,9 @@
1
1
  import { ServerError as e } from "../../../shared/components/ServerError.js";
2
2
  import { useBillingNavigate as t } from "../../../hooks/useBillingNavigate.js";
3
+ import "../hooks/index.js";
3
4
  import { formatCurrency as n, formatPlanDuration as r, formatPlanDurationLabel as i, formatQuotaValue as a } from "../../../shared/utils/format.js";
4
5
  import { isServerError as o } from "../../../shared/utils/error.js";
5
6
  import { getPlanFeatureQuantity as s, getPlanFeatureUnit as c, getQuotaDisplayName as l } from "../../../shared/utils/planFeatureQuantity.js";
6
- import "../hooks/index.js";
7
7
  import "../../../shared/components/index.js";
8
8
  import { usePlan as u } from "../hooks/usePlans.js";
9
9
  import "../../../shared/utils/index.js";
@@ -4,9 +4,9 @@ import { ServerError as n } from "../../../shared/components/ServerError.js";
4
4
  import { CurrencyPriceOverridesEditor as r } from "../../../shared/components/CurrencyPriceOverridesEditor.js";
5
5
  import { useBillingNavigate as ee } from "../../../hooks/useBillingNavigate.js";
6
6
  import "../hooks/index.js";
7
- import { isServerError as i } from "../../../shared/utils/error.js";
8
- import { getPlanFeatureQuantity as a } from "../../../shared/utils/planFeatureQuantity.js";
9
- import { useBillingPermissions as te } from "../../../hooks/useBillingPermissions.js";
7
+ import { useBillingPermissions as i } from "../../../hooks/useBillingPermissions.js";
8
+ import { isServerError as a } from "../../../shared/utils/error.js";
9
+ import { getPlanFeatureQuantity as te } from "../../../shared/utils/planFeatureQuantity.js";
10
10
  import "../../../shared/components/index.js";
11
11
  import "../../../shared/utils/index.js";
12
12
  import { usePlan as o, usePlanMutations as s } from "../hooks/usePlans.js";
@@ -23,7 +23,7 @@ var y = () => {
23
23
  let { t: y } = v(), b = (e, t) => {
24
24
  let n = y(e);
25
25
  return n === e ? t : n;
26
- }, { planId: x } = m(), S = ee(), C = te(), { plan: w, isLoading: T, error: E, refetch: D } = o(x), { quotas: O, isLoading: k } = c({ onlyActive: !0 }), { updatePlan: A, isUpdating: j } = s(), [M, N] = f(""), [ne, P] = f(""), [F, I] = f("USD"), [L, R] = f(l.MONTHLY), [z, B] = f(!0), [V, H] = f(!0), [U, W] = f([]), [G, K] = f([]), [q, J] = f([]), [Y, X] = f(null), [Z, Q] = f(!1);
26
+ }, { planId: x } = m(), S = ee(), C = i(), { plan: w, isLoading: T, error: E, refetch: D } = o(x), { quotas: O, isLoading: k } = c({ onlyActive: !0 }), { updatePlan: A, isUpdating: j } = s(), [M, N] = f(""), [ne, P] = f(""), [F, I] = f("USD"), [L, R] = f(l.MONTHLY), [z, B] = f(!0), [V, H] = f(!0), [U, W] = f([]), [G, K] = f([]), [q, J] = f([]), [Y, X] = f(null), [Z, Q] = f(!1);
27
27
  if (d(() => {
28
28
  if (w) {
29
29
  if (N(w.name ?? ""), P(String(w.price ?? "")), I(w.currency ?? "USD"), R(w.duration ?? l.MONTHLY), B(w.isActive ?? !0), H(w.isPurchasable ?? !0), w.currencyPrices && typeof w.currencyPrices == "object") {
@@ -36,7 +36,7 @@ var y = () => {
36
36
  if (w.features && w.features.length > 0) {
37
37
  let e = [], t = /* @__PURE__ */ new Map();
38
38
  for (let e of w.features) if (e.quota?.id) {
39
- let n = e.quota.id, r = a(e) || 1;
39
+ let n = e.quota.id, r = te(e) || 1;
40
40
  t.set(n, r);
41
41
  }
42
42
  for (let [n, r] of t) e.push({
@@ -60,7 +60,7 @@ var y = () => {
60
60
  ].map((e) => /* @__PURE__ */ g("div", { className: "h-16 bg-bg-sunken animate-pulse rounded" }, e))
61
61
  })]
62
62
  });
63
- if (E && i(E)) return /* @__PURE__ */ g("div", {
63
+ if (E && a(E)) return /* @__PURE__ */ g("div", {
64
64
  className: "p-6",
65
65
  children: /* @__PURE__ */ g(n, {
66
66
  title: b("billing.plans.serverUnavailable", "Server Unavailable"),