@burdenoff/microfe-billing 2026.1116.1 → 2026.1119.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.
Files changed (62) hide show
  1. package/dist/billing/modules/addons/pages/AddonCreatePage.js +143 -143
  2. package/dist/billing/modules/addons/pages/AddonCreatePage.js.map +1 -1
  3. package/dist/billing/modules/addons/pages/AddonEditPage.js +170 -170
  4. package/dist/billing/modules/addons/pages/AddonEditPage.js.map +1 -1
  5. package/dist/billing/modules/analytics/pages/AnalyticsPage.js +148 -148
  6. package/dist/billing/modules/analytics/pages/AnalyticsPage.js.map +1 -1
  7. package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js +115 -115
  8. package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js.map +1 -1
  9. package/dist/billing/modules/billing/pages/InvoicesListPage.js +136 -136
  10. package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
  11. package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js +129 -129
  12. package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js.map +1 -1
  13. package/dist/billing/modules/billing/pages/RefundsPage.js +325 -325
  14. package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
  15. package/dist/billing/modules/billing/pages/UserRefundsPage.js +149 -149
  16. package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
  17. package/dist/billing/modules/checkout/components/CompleteBillingAccountModal.js +99 -98
  18. package/dist/billing/modules/checkout/components/CompleteBillingAccountModal.js.map +1 -1
  19. package/dist/billing/modules/checkout/components/StoreShippingSection.js +125 -124
  20. package/dist/billing/modules/checkout/components/StoreShippingSection.js.map +1 -1
  21. package/dist/billing/modules/checkout/components/WorkspaceQuotaAssignmentModal.js +61 -60
  22. package/dist/billing/modules/checkout/components/WorkspaceQuotaAssignmentModal.js.map +1 -1
  23. package/dist/billing/modules/coupons/pages/CouponsListPage.js +177 -177
  24. package/dist/billing/modules/coupons/pages/CouponsListPage.js.map +1 -1
  25. package/dist/billing/modules/coupons/pages/CreateCouponPage.js +231 -231
  26. package/dist/billing/modules/coupons/pages/CreateCouponPage.js.map +1 -1
  27. package/dist/billing/modules/coupons/pages/EditCouponPage.js +139 -139
  28. package/dist/billing/modules/coupons/pages/EditCouponPage.js.map +1 -1
  29. package/dist/billing/modules/credits/pages/AdminCreditsPage.js +54 -54
  30. package/dist/billing/modules/credits/pages/AdminCreditsPage.js.map +1 -1
  31. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +65 -65
  32. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
  33. package/dist/billing/modules/credits/pages/CreditsPage.js +95 -95
  34. package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
  35. package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.js +232 -231
  36. package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.js.map +1 -1
  37. package/dist/billing/modules/discounts/pages/DiscountsListPage.js +328 -328
  38. package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -1
  39. package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js +57 -57
  40. package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js.map +1 -1
  41. package/dist/billing/modules/earnings/pages/EarningsPage.js +53 -53
  42. package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -1
  43. package/dist/billing/modules/earnings/pages/PayoutsPage.js +100 -100
  44. package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
  45. package/dist/billing/modules/plans/pages/PlanCreatePage.js +150 -150
  46. package/dist/billing/modules/plans/pages/PlanCreatePage.js.map +1 -1
  47. package/dist/billing/modules/plans/pages/PlanEditPage.js +125 -125
  48. package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
  49. package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js +113 -113
  50. package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js.map +1 -1
  51. package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js +132 -132
  52. package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js.map +1 -1
  53. package/dist/billing/modules/settings/pages/SettingsPage.js +101 -101
  54. package/dist/billing/modules/settings/pages/SettingsPage.js.map +1 -1
  55. package/dist/billing/modules/settings/pages/TeamPermissionsPage.js +125 -125
  56. package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -1
  57. package/dist/billing/modules/usage/components/WorkspaceAiSpendPanel.js +51 -50
  58. package/dist/billing/modules/usage/components/WorkspaceAiSpendPanel.js.map +1 -1
  59. package/dist/billing/modules/usage/pages/UsagePage.js +107 -107
  60. package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
  61. package/dist/billing/shared/components/GeoPricingOverridesEditor.js +1 -0
  62. package/package.json +2 -2
@@ -9,12 +9,12 @@ import { formatCredits as s, formatCurrency as c, formatDateTime as l } from "..
9
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
- 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";
13
- import { useCallback as h, useEffect as re, useMemo as g, useState as _ } from "react";
14
- import { PagePurpose as ie } from "@burdenoff/fe-libs/ui";
15
- import { ArrowLeft as ae, BadgeCheck as oe, CreditCard as se, Loader2 as v, TrendingDown as y, TrendingUp as b, Wallet as ce } from "lucide-react";
16
- import { useParams as le } from "react-router";
17
- import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
12
+ import { fetchAdminDeveloperRevenueOrg as te, fetchAdminDeveloperRevenueOrgDetail as u, fetchAdminDeveloperRevenueOrgMonthly as d, fetchAdminPayoutRequests as f, fetchBillingAccountCreditBalance as ne, fetchCreditCost as re, retrySaleCreditSync as p } from "../api.js";
13
+ import { useCallback as m, useEffect as h, useMemo as ie, useState as g } from "react";
14
+ import { PagePurpose as ae, ThemedSelect as oe } from "@burdenoff/fe-libs/ui";
15
+ import { ArrowLeft as se, BadgeCheck as ce, CreditCard as le, Loader2 as _, TrendingDown as v, TrendingUp as y, Wallet as b } from "lucide-react";
16
+ import { useParams as x } from "react-router";
17
+ import { Fragment as ue, jsx as S, jsxs as C } from "react/jsx-runtime";
18
18
  // src/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.tsx
19
19
  var w = "all", T = {
20
20
  REQUESTED: "Requested",
@@ -45,7 +45,7 @@ function O(e) {
45
45
  year: "numeric"
46
46
  });
47
47
  }
48
- function ue(e) {
48
+ function de(e) {
49
49
  if (e === w) return {};
50
50
  let t = new Date(e);
51
51
  return Number.isNaN(t.getTime()) ? {} : {
@@ -53,7 +53,7 @@ function ue(e) {
53
53
  endDate: (/* @__PURE__ */ new Date(Date.UTC(t.getUTCFullYear(), t.getUTCMonth() + 1, 1) - 1)).toISOString()
54
54
  };
55
55
  }
56
- function de({ points: e }) {
56
+ function fe({ points: e }) {
57
57
  return e.length === 0 ? /* @__PURE__ */ S("div", {
58
58
  className: "px-5 py-10 text-center text-sm text-text-muted",
59
59
  children: "No sales recorded yet — the revenue trend will appear once the first sale comes in."
@@ -122,7 +122,7 @@ function de({ points: e }) {
122
122
  }) : /* @__PURE__ */ C("span", {
123
123
  className: `inline-flex items-center gap-1 font-medium ${i >= 0 ? "text-status-success-text" : "text-status-error-text"}`,
124
124
  children: [
125
- S(i >= 0 ? b : y, { className: "size-3.5" }),
125
+ S(i >= 0 ? y : v, { className: "size-3.5" }),
126
126
  i >= 0 ? "+" : "",
127
127
  i.toFixed(1),
128
128
  "%"
@@ -135,7 +135,7 @@ function de({ points: e }) {
135
135
  })
136
136
  });
137
137
  }
138
- function fe({ requests: e }) {
138
+ function pe({ requests: e }) {
139
139
  return e.length === 0 ? /* @__PURE__ */ S("div", {
140
140
  className: "px-5 py-10 text-center text-sm text-text-muted",
141
141
  children: "No withdrawal requests in this period."
@@ -204,7 +204,7 @@ function fe({ requests: e }) {
204
204
  });
205
205
  }
206
206
  var k = () => {
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(() => ({
207
+ let { organizationId: v } = x(), T = o(), { apiGatewayUrl: E, authToken: D, orgId: k } = e(), A = a(), [j, M] = g(null), [N, P] = g([]), [F, I] = g(null), [L, R] = g(null), [z, me] = g([]), [B, he] = g(null), [ge, _e] = g([]), [V, H] = g(w), [ve, U] = g(!0), [W, G] = g(!1), [K, q] = g(null), [J, Y] = g(null), X = ie(() => ({
208
208
  apiGatewayUrl: E,
209
209
  authToken: D,
210
210
  orgId: k
@@ -212,8 +212,8 @@ var k = () => {
212
212
  E,
213
213
  D,
214
214
  k
215
- ]), Z = h(async (e, t, n) => {
216
- let r = ue(n), [i, a] = await Promise.all([d(e, X, r), t ? f(X, {
215
+ ]), Z = m(async (e, t, n) => {
216
+ let r = de(n), [i, a] = await Promise.all([u(e, X, r), t ? f(X, {
217
217
  limit: 100,
218
218
  filter: {
219
219
  billingAccountId: t,
@@ -224,17 +224,17 @@ var k = () => {
224
224
  totalCount: 0,
225
225
  hasMore: !1
226
226
  })]);
227
- me(i), ge(a.items);
228
- }, [X]), Q = h(async () => {
229
- if (y) {
227
+ he(i), _e(a.items);
228
+ }, [X]), Q = m(async () => {
229
+ if (v) {
230
230
  U(!0), q(null);
231
231
  try {
232
- let [e, t] = await Promise.all([u(y, X), te(y, X, 12)]);
233
- j(e), N(t);
232
+ let [e, t] = await Promise.all([te(v, X), d(v, X, 12)]);
233
+ M(e), P(t);
234
234
  let n = e?.billingAccountId ?? null, r = t.length > 0 ? t[t.length - 1].month : w;
235
235
  H(r);
236
236
  let [i, a] = await Promise.all([
237
- n ? p(n, X) : Promise.resolve(null),
237
+ n ? ne(n, X) : Promise.resolve(null),
238
238
  n ? f(X, {
239
239
  limit: 100,
240
240
  filter: { billingAccountId: n }
@@ -243,9 +243,9 @@ var k = () => {
243
243
  totalCount: 0,
244
244
  hasMore: !1
245
245
  }),
246
- Z(y, n, r)
246
+ Z(v, n, r)
247
247
  ]);
248
- F(i), z(a.items), i && i.total > 0 ? m(i.total, "USD", X).then(L).catch(() => L(null)) : L(0);
248
+ I(i), me(a.items), i && i.total > 0 ? re(i.total, "USD", X).then(R).catch(() => R(null)) : R(0);
249
249
  } catch (e) {
250
250
  q(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load revenue detail"));
251
251
  } finally {
@@ -253,15 +253,15 @@ var k = () => {
253
253
  }
254
254
  }
255
255
  }, [
256
- y,
256
+ v,
257
257
  X,
258
258
  Z
259
259
  ]);
260
- re(() => {
260
+ h(() => {
261
261
  T.isBillingAdmin && Q();
262
262
  }, [Q, T.isBillingAdmin]);
263
- let ve = (e) => {
264
- y && A && (H(e), G(!0), Z(y, A.billingAccountId, e).catch((e) => {
263
+ let ye = (e) => {
264
+ v && j && (H(e), G(!0), Z(v, j.billingAccountId, e).catch((e) => {
265
265
  q(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load period data"));
266
266
  }).finally(() => G(!1)));
267
267
  };
@@ -272,51 +272,51 @@ var k = () => {
272
272
  showRetry: !0,
273
273
  onRetry: () => void Q()
274
274
  });
275
- if (_e || !A) return /* @__PURE__ */ S("div", {
275
+ if (ve || !j) return /* @__PURE__ */ S("div", {
276
276
  className: "flex items-center justify-center py-20 text-text-secondary",
277
- children: /* @__PURE__ */ S(v, { className: "size-8 animate-spin" })
277
+ children: /* @__PURE__ */ S(_, { className: "size-8 animate-spin" })
278
278
  });
279
- let ye = R.filter((e) => e.status === "PAID").reduce((e, t) => e + (t.approvedAmount ?? t.requestedAmount), 0), $ = R.filter((e) => [
279
+ let be = z.filter((e) => e.status === "PAID").reduce((e, t) => e + (t.approvedAmount ?? t.requestedAmount), 0), $ = z.filter((e) => [
280
280
  "REQUESTED",
281
281
  "APPROVED",
282
282
  "PROCESSING"
283
- ].includes(e.status)).reduce((e, t) => e + t.requestedAmount, 0), be = [...M].reverse();
283
+ ].includes(e.status)).reduce((e, t) => e + t.requestedAmount, 0), xe = [...N].reverse();
284
284
  return /* @__PURE__ */ C("div", {
285
285
  className: "space-y-6 p-6",
286
286
  children: [
287
287
  /* @__PURE__ */ S(n, {
288
- title: A.name,
289
- description: `/${A.slug}${A.isVerified ? " · Verified developer organization" : ""}`,
288
+ title: j.name,
289
+ description: `/${j.slug}${j.isVerified ? " · Verified developer organization" : ""}`,
290
290
  actions: /* @__PURE__ */ C("button", {
291
291
  type: "button",
292
- onClick: () => pe("/developer-revenue"),
292
+ onClick: () => A("/developer-revenue"),
293
293
  className: "inline-flex items-center gap-2 rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary",
294
- children: [/* @__PURE__ */ S(ae, { className: "size-4" }), "Back to developer revenue"]
294
+ children: [/* @__PURE__ */ S(se, { className: "size-4" }), "Back to developer revenue"]
295
295
  })
296
296
  }),
297
- /* @__PURE__ */ S(ie, { children: "Store revenue for this org is credited into its linked billing account as earned credits. The developer withdraws those credits later through their own billing withdrawal flow — this page is a read-and-verify view of that whole loop, from sale to payout." }),
297
+ /* @__PURE__ */ S(ae, { children: "Store revenue for this org is credited into its linked billing account as earned credits. The developer withdraws those credits later through their own billing withdrawal flow — this page is a read-and-verify view of that whole loop, from sale to payout." }),
298
298
  /* @__PURE__ */ C("div", {
299
299
  className: "grid gap-3 md:grid-cols-2 xl:grid-cols-4",
300
300
  children: [
301
301
  /* @__PURE__ */ S(r, {
302
302
  label: "Gross revenue (all time)",
303
- value: c(A.totalRevenue, "USD"),
304
- icon: /* @__PURE__ */ S(b, { className: "size-4" })
303
+ value: c(j.totalRevenue, "USD"),
304
+ icon: /* @__PURE__ */ S(y, { className: "size-4" })
305
305
  }),
306
306
  /* @__PURE__ */ S(r, {
307
307
  label: "Platform fees (all time)",
308
- value: c(A.totalPlatformFees, "USD"),
309
- icon: /* @__PURE__ */ S(se, { className: "size-4" })
308
+ value: c(j.totalPlatformFees, "USD"),
309
+ icon: /* @__PURE__ */ S(le, { className: "size-4" })
310
310
  }),
311
311
  /* @__PURE__ */ S(r, {
312
312
  label: "Pending earned credits",
313
- value: c(B?.summary?.pendingBalance ?? A.pendingBalance, "USD"),
314
- icon: /* @__PURE__ */ S(ce, { className: "size-4" })
313
+ value: c(B?.summary?.pendingBalance ?? j.pendingBalance, "USD"),
314
+ icon: /* @__PURE__ */ S(b, { className: "size-4" })
315
315
  }),
316
316
  /* @__PURE__ */ S(r, {
317
317
  label: "Already withdrawn (all time)",
318
- value: c(ye, "USD"),
319
- icon: /* @__PURE__ */ S(oe, { className: "size-4" })
318
+ value: c(be, "USD"),
319
+ icon: /* @__PURE__ */ S(ce, { className: "size-4" })
320
320
  })
321
321
  ]
322
322
  }),
@@ -333,33 +333,33 @@ var k = () => {
333
333
  children: "The current credit ledger on the org's linked billing account, right now. These are credit units, not currency — 1 credit is worth a small fraction of $1 at the platform's current credit rate."
334
334
  })]
335
335
  }),
336
- A.billingAccountId ? P ? /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ C("div", {
336
+ j.billingAccountId ? F ? /* @__PURE__ */ C(ue, { children: [/* @__PURE__ */ C("div", {
337
337
  className: "grid gap-3 p-5 md:grid-cols-3 xl:grid-cols-5",
338
338
  children: [
339
339
  /* @__PURE__ */ S(r, {
340
340
  label: "Earned",
341
- value: s(P.earned)
341
+ value: s(F.earned)
342
342
  }),
343
343
  /* @__PURE__ */ S(r, {
344
344
  label: "Purchased",
345
- value: s(P.purchased)
345
+ value: s(F.purchased)
346
346
  }),
347
347
  /* @__PURE__ */ S(r, {
348
348
  label: "Granted",
349
- value: s(P.granted)
349
+ value: s(F.granted)
350
350
  }),
351
351
  /* @__PURE__ */ S(r, {
352
352
  label: "Withdrawable",
353
- value: s(P.withdrawable)
353
+ value: s(F.withdrawable)
354
354
  }),
355
355
  /* @__PURE__ */ S(r, {
356
356
  label: "Total balance",
357
- value: s(P.total)
357
+ value: s(F.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." : `≈ ${c(I, "USD")} total at the current credit rate.`
362
+ children: L === null ? "Estimated cash value could not be loaded." : `≈ ${c(L, "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."
@@ -384,7 +384,7 @@ var k = () => {
384
384
  className: "mt-1 text-sm text-text-muted",
385
385
  children: "Last 12 months of gross/net revenue for this org, computed from completed sales."
386
386
  })]
387
- }), /* @__PURE__ */ S(de, { points: M })]
387
+ }), /* @__PURE__ */ S(fe, { points: N })]
388
388
  }),
389
389
  /* @__PURE__ */ C("div", {
390
390
  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)]",
@@ -396,15 +396,15 @@ var k = () => {
396
396
  children: "Scopes both the withdrawal history and sales tables below — pick a single month to keep long-running orgs easy to review, or switch to all time."
397
397
  })] }), /* @__PURE__ */ C("div", {
398
398
  className: "flex items-center gap-2",
399
- children: [W && /* @__PURE__ */ S(v, { className: "size-4 animate-spin text-text-muted" }), /* @__PURE__ */ C("select", {
399
+ children: [W && /* @__PURE__ */ S(_, { className: "size-4 animate-spin text-text-muted" }), /* @__PURE__ */ C(oe, {
400
400
  value: V,
401
- onChange: (e) => ve(e.target.value),
401
+ onChange: (e) => ye(e.target.value),
402
402
  disabled: W,
403
403
  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",
404
404
  children: [/* @__PURE__ */ S("option", {
405
405
  value: w,
406
406
  children: "All time"
407
- }), be.map((e) => /* @__PURE__ */ S("option", {
407
+ }), xe.map((e) => /* @__PURE__ */ S("option", {
408
408
  value: e.month,
409
409
  children: O(e.month)
410
410
  }, e.month))]
@@ -429,7 +429,7 @@ var k = () => {
429
429
  })]
430
430
  }), /* @__PURE__ */ S("div", {
431
431
  className: W ? "pointer-events-none opacity-50" : void 0,
432
- children: /* @__PURE__ */ S(fe, { requests: he })
432
+ children: /* @__PURE__ */ S(pe, { requests: ge })
433
433
  })]
434
434
  }),
435
435
  /* @__PURE__ */ C("section", {
@@ -509,13 +509,13 @@ var k = () => {
509
509
  className: "mt-1 text-xs text-status-error-text",
510
510
  children: e.billingCreditSyncError
511
511
  }),
512
- e.billingCreditSyncStatus !== "SYNCED" && A.billingAccountId && /* @__PURE__ */ S("button", {
512
+ e.billingCreditSyncStatus !== "SYNCED" && j.billingAccountId && /* @__PURE__ */ S("button", {
513
513
  type: "button",
514
514
  onClick: () => {
515
- y && (async () => {
515
+ v && (async () => {
516
516
  Y(e.id);
517
517
  try {
518
- await ne(e.id, X), await Z(y, A.billingAccountId, V);
518
+ await p(e.id, X), await Z(v, j.billingAccountId, V);
519
519
  } finally {
520
520
  Y(null);
521
521
  }
@@ -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":";;;;;;;;;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;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
+ {"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","ThemedSelect","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, ThemedSelect } 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 <ThemedSelect\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 </ThemedSelect>\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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