@burdenoff/microfe-billing 2026.1114.9 → 2026.1115.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.
@@ -1,13 +1,13 @@
1
1
  import "../../shared/utils/index.js";
2
- import { directBillingGraphqlRequest as e } from "../../shared/utils/directBillingGraphql.js";
3
- import { gatewayGraphqlRequest as t } from "../../shared/utils/gatewayGraphql.js";
2
+ import { gatewayGraphqlRequest as e } from "../../shared/utils/gatewayGraphql.js";
3
+ import { directBillingGraphqlRequest as t } from "../../shared/utils/directBillingGraphql.js";
4
4
  import { AddPayoutAccountDocument as n, AdminDeveloperRevenueOrgDetailDocument as r, AdminDeveloperRevenueOrgDocument as i, AdminDeveloperRevenueOrgMonthlyDocument as a, AdminDeveloperRevenueOrgsDocument as o, AdminPayoutRequestsDocument as s, AdminPayoutSummaryDocument as c, ApprovePayoutRequestDocument as l, ArchivePayoutAccountDocument as u, BillingDeveloperPortalRevenueDocument as d, GetCostOfCreditsDocument as f, GetCreditBalanceByTypeDocument as p, MarkPayoutPaidDocument as m, MyEarningsEntriesDocument as h, MyEarningsSummaryDocument as g, MyPayoutAccountsDocument as _, MyPayoutRequestsDocument as v, RejectPayoutRequestDocument as y, RetrySaleCreditSyncDocument as b, SetDefaultPayoutAccountDocument as x, UpdatePayoutAccountDocument as S } from "../../../generated/global-operations.js";
5
5
  // src/billing/modules/earnings/api.ts
6
- async function C(e, n) {
7
- let r = await t({
6
+ async function C(t, n) {
7
+ let r = await e({
8
8
  ...n,
9
9
  query: d,
10
- variables: { organizationId: e }
10
+ variables: { organizationId: t }
11
11
  });
12
12
  return {
13
13
  summary: r.developerOrgRevenueSummary,
@@ -15,77 +15,77 @@ async function C(e, n) {
15
15
  payouts: r.developerOrgPayouts.edges.map((e) => e.node)
16
16
  };
17
17
  }
18
- async function w(t, n) {
19
- return (await e({
18
+ async function w(e, n) {
19
+ return (await t({
20
20
  ...n,
21
21
  query: g,
22
- variables: { billingAccountId: t }
22
+ variables: { billingAccountId: e }
23
23
  })).myEarningsSummary;
24
24
  }
25
- async function T(t, n) {
26
- return (await e({
25
+ async function T(e, n) {
26
+ return (await t({
27
27
  ...n,
28
28
  query: h,
29
- variables: { billingAccountId: t }
29
+ variables: { billingAccountId: e }
30
30
  })).myEarningsEntries.items;
31
31
  }
32
- async function E(t, n) {
33
- return (await e({
32
+ async function E(e, n) {
33
+ return (await t({
34
34
  ...n,
35
35
  query: _,
36
- variables: { billingAccountId: t }
36
+ variables: { billingAccountId: e }
37
37
  })).myPayoutAccounts;
38
38
  }
39
- async function D(t, n) {
40
- return (await e({
39
+ async function D(e, n) {
40
+ return (await t({
41
41
  ...n,
42
42
  query: v,
43
- variables: { billingAccountId: t }
43
+ variables: { billingAccountId: e }
44
44
  })).myPayoutRequests.items;
45
45
  }
46
- async function O(t, r) {
47
- return (await e({
46
+ async function O(e, r) {
47
+ return (await t({
48
48
  ...r,
49
49
  query: n,
50
- variables: { input: t }
50
+ variables: { input: e }
51
51
  })).addPayoutAccount;
52
52
  }
53
- async function k(t, n, r) {
54
- await e({
53
+ async function k(e, n, r) {
54
+ await t({
55
55
  ...r,
56
56
  query: S,
57
57
  variables: {
58
- id: t,
58
+ id: e,
59
59
  input: n
60
60
  }
61
61
  });
62
62
  }
63
- async function A(t, n) {
64
- await e({
63
+ async function A(e, n) {
64
+ await t({
65
65
  ...n,
66
66
  query: x,
67
- variables: { id: t }
67
+ variables: { id: e }
68
68
  });
69
69
  }
70
- async function j(t, n) {
71
- await e({
70
+ async function j(e, n) {
71
+ await t({
72
72
  ...n,
73
73
  query: u,
74
- variables: { id: t }
74
+ variables: { id: e }
75
75
  });
76
76
  }
77
77
  async function M(e, t) {
78
78
  throw Error("Payout request not yet implemented");
79
79
  }
80
- async function N(t) {
81
- return (await e({
82
- ...t,
80
+ async function N(e) {
81
+ return (await t({
82
+ ...e,
83
83
  query: c
84
84
  })).adminPayoutSummary;
85
85
  }
86
- async function P(t, n = {}) {
87
- return (await e({
88
- ...t,
86
+ async function P(e, n = {}) {
87
+ return (await t({
88
+ ...e,
89
89
  query: s,
90
90
  variables: {
91
91
  limit: n.limit ?? 50,
@@ -94,25 +94,25 @@ async function P(t, n = {}) {
94
94
  }
95
95
  })).adminPayoutRequests;
96
96
  }
97
- async function F(e) {
98
- return (await t({
99
- ...e,
97
+ async function F(t) {
98
+ return (await e({
99
+ ...t,
100
100
  query: o
101
101
  })).developerOrganizations.edges.map((e) => e.node);
102
102
  }
103
- async function I(e, n) {
104
- return (await t({
103
+ async function I(t, n) {
104
+ return (await e({
105
105
  ...n,
106
106
  query: i,
107
- variables: { organizationId: e }
107
+ variables: { organizationId: t }
108
108
  })).developerOrganization;
109
109
  }
110
- async function L(e, n, i = {}) {
111
- let a = await t({
110
+ async function L(t, n, i = {}) {
111
+ let a = await e({
112
112
  ...n,
113
113
  query: r,
114
114
  variables: {
115
- organizationId: e,
115
+ organizationId: t,
116
116
  period: "monthly",
117
117
  salesLimit: 50,
118
118
  salesOffset: 0,
@@ -128,66 +128,66 @@ async function L(e, n, i = {}) {
128
128
  }
129
129
  };
130
130
  }
131
- async function R(t, n, r) {
132
- return (await e({
131
+ async function R(e, n, r) {
132
+ return (await t({
133
133
  ...r,
134
134
  query: f,
135
135
  variables: {
136
- creditAmount: t,
136
+ creditAmount: e,
137
137
  currency: n
138
138
  }
139
139
  })).getCostOfCredits.amount;
140
140
  }
141
- async function z(e, n, r = 12) {
142
- return (await t({
141
+ async function z(t, n, r = 12) {
142
+ return (await e({
143
143
  ...n,
144
144
  query: a,
145
145
  variables: {
146
- organizationId: e,
146
+ organizationId: t,
147
147
  months: r
148
148
  }
149
149
  })).developerOrgMonthlyRevenue;
150
150
  }
151
- async function B(t, n) {
152
- return (await e({
151
+ async function B(e, n) {
152
+ return (await t({
153
153
  ...n,
154
154
  query: p,
155
- variables: { billingAccountId: t }
155
+ variables: { billingAccountId: e }
156
156
  })).getCreditBalanceByType;
157
157
  }
158
- async function V(e, n) {
159
- return (await t({
158
+ async function V(t, n) {
159
+ return (await e({
160
160
  ...n,
161
161
  query: b,
162
- variables: { saleId: e }
162
+ variables: { saleId: t }
163
163
  })).retrySaleCreditSync;
164
164
  }
165
- async function H(t, n, r) {
166
- await e({
165
+ async function H(e, n, r) {
166
+ await t({
167
167
  ...r,
168
168
  query: l,
169
169
  variables: {
170
- id: t,
170
+ id: e,
171
171
  notes: n
172
172
  }
173
173
  });
174
174
  }
175
- async function U(t, n, r) {
176
- await e({
175
+ async function U(e, n, r) {
176
+ await t({
177
177
  ...r,
178
178
  query: y,
179
179
  variables: {
180
- id: t,
180
+ id: e,
181
181
  reason: n
182
182
  }
183
183
  });
184
184
  }
185
- async function W(t, n, r, i) {
186
- await e({
185
+ async function W(e, n, r, i) {
186
+ await t({
187
187
  ...i,
188
188
  query: m,
189
189
  variables: {
190
- id: t,
190
+ id: e,
191
191
  externalReference: n,
192
192
  notes: r
193
193
  }
@@ -1,21 +1,21 @@
1
1
  import { useIsFluidgridsVariant as e } from "../../../hooks/useBillingVariant.js";
2
2
  import { useTr as t } from "../../../shared/hooks/useTr.js";
3
3
  import { AccessDenied as ee } from "../../../shared/components/AccessDenied.js";
4
- import { PageHeader as n } from "../../../shared/components/PageHeader.js";
5
- import { StatCard as r } from "../../../shared/components/StatCard.js";
6
- import { ServerError as te } from "../../../shared/components/ServerError.js";
7
- import { PayoutErrorNotice as ne } from "../components/PayoutErrorNotice.js";
8
- import { plainPayoutError as re, rawErrorText as i } from "../utils/plainPayoutError.js";
4
+ import { PageHeader as te } from "../../../shared/components/PageHeader.js";
5
+ import { StatCard as n } from "../../../shared/components/StatCard.js";
6
+ import { ServerError as ne } from "../../../shared/components/ServerError.js";
7
+ import { PayoutErrorNotice as re } from "../components/PayoutErrorNotice.js";
8
+ import { plainPayoutError as ie, rawErrorText as r } from "../utils/plainPayoutError.js";
9
+ import { useBillingPermissions as i } from "../../../hooks/useBillingPermissions.js";
9
10
  import { formatCurrency as a, formatDateTime as o } from "../../../shared/utils/format.js";
10
11
  import { isServerError as s } from "../../../shared/utils/error.js";
11
- import { useBillingPermissions as c } from "../../../hooks/useBillingPermissions.js";
12
- import { useBilling as l } from "../../../providers/BillingProvider.js";
12
+ import { useBilling as c } from "../../../providers/BillingProvider.js";
13
13
  import "../../../shared/components/index.js";
14
14
  import "../../../shared/utils/index.js";
15
- import { useGetDefaultBillingAccountSettingsQuery as u } from "../../../../generated/global-operations.js";
16
- import { fetchDeveloperPortalRevenueDashboard as d, fetchEarningsEntries as ie, fetchEarningsSummary as ae } from "../api.js";
17
- import { useCallback as oe, useEffect as se, useMemo as ce, useState as f } from "react";
18
- import { EmphasisPanel as le, IllustratedEmptyState as p, PagePurpose as m, ResponsiveTable as h, ShowTechnicalDetails as ue } from "@burdenoff/fe-libs/ui";
15
+ import { useGetDefaultBillingAccountSettingsQuery as l } from "../../../../generated/global-operations.js";
16
+ import { fetchDeveloperPortalRevenueDashboard as u, fetchEarningsEntries as ae, fetchEarningsSummary as oe } from "../api.js";
17
+ import { useCallback as se, useEffect as ce, useMemo as le, useState as d } from "react";
18
+ import { EmphasisPanel as ue, IllustratedEmptyState as f, PagePurpose as p, ResponsiveTable as m, ShowTechnicalDetails as h } from "@burdenoff/fe-libs/ui";
19
19
  import { ArrowLeft as g, Coins as _, HandCoins as v, RefreshCw as y, Wallet as b } from "lucide-react";
20
20
  import { useSearchParams as x } from "react-router";
21
21
  import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
@@ -124,7 +124,7 @@ var de = [
124
124
  cell: (e) => o(e.createdAt)
125
125
  }
126
126
  ], T = () => {
127
- let [o] = x(), T = c(), E = e(), D = t(), { apiGatewayUrl: O, authToken: k, orgId: A, navigate: j } = l(), M = o.get("developerOrgId"), N = o.get("developerOrgName"), P = o.get("returnTo"), { data: F, loading: I } = u({}), L = F?.getDefaultBillingAccount?.id, [R, z] = f(null), [B, V] = f([]), [H, U] = f(null), [W, me] = f("ALL"), [G, K] = f(!0), [q, J] = f(null), Y = ce(() => ({
127
+ let [o] = x(), T = i(), E = e(), D = t(), { apiGatewayUrl: O, authToken: k, orgId: A, navigate: j } = c(), M = o.get("developerOrgId"), N = o.get("developerOrgName"), P = o.get("returnTo"), { data: F, loading: I } = l({}), L = F?.getDefaultBillingAccount?.id, [R, z] = d(null), [B, V] = d([]), [H, U] = d(null), [W, me] = d("ALL"), [G, K] = d(!0), [q, J] = d(null), Y = le(() => ({
128
128
  apiGatewayUrl: O,
129
129
  authToken: k,
130
130
  orgId: A
@@ -132,11 +132,11 @@ var de = [
132
132
  O,
133
133
  k,
134
134
  A
135
- ]), X = oe(async () => {
135
+ ]), X = se(async () => {
136
136
  K(!0), J(null);
137
137
  try {
138
138
  if (M) {
139
- let e = await d(M, Y);
139
+ let e = await u(M, Y);
140
140
  U(e), z(null), V([]);
141
141
  return;
142
142
  }
@@ -144,7 +144,7 @@ var de = [
144
144
  z(null), V([]), U(null);
145
145
  return;
146
146
  }
147
- let [e, t] = await Promise.all([ae(L, Y), ie(L, Y)]);
147
+ let [e, t] = await Promise.all([oe(L, Y), ae(L, Y)]);
148
148
  z(e), V(t), U(null);
149
149
  } catch (e) {
150
150
  J(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load earnings"));
@@ -156,26 +156,26 @@ var de = [
156
156
  M,
157
157
  Y
158
158
  ]);
159
- if (se(() => {
159
+ if (ce(() => {
160
160
  X();
161
161
  }, [X]), !T.canViewBillingAccount) return /* @__PURE__ */ C(ee, { message: "You don't have permission to view earnings." });
162
- if (!M && !L && !I) return /* @__PURE__ */ C(p, {
162
+ if (!M && !L && !I) return /* @__PURE__ */ C(f, {
163
163
  illustration: "empty-generic",
164
164
  title: "No billing account found",
165
165
  description: "Create a billing account first to view earnings."
166
166
  });
167
167
  if (q && s(q)) {
168
- let e = /* @__PURE__ */ C(te, {
168
+ let e = /* @__PURE__ */ C(ne, {
169
169
  title: "Earnings unavailable",
170
- message: E ? re(q, D) : q.message,
170
+ message: E ? ie(q, D) : q.message,
171
171
  onRetry: () => void X(),
172
172
  showRetry: !0
173
173
  });
174
174
  return E ? /* @__PURE__ */ w(S, { children: [e, /* @__PURE__ */ C("div", {
175
175
  className: "px-6",
176
- children: /* @__PURE__ */ C(ue, {
176
+ children: /* @__PURE__ */ C(h, {
177
177
  copyable: !0,
178
- children: i(q)
178
+ children: r(q)
179
179
  })
180
180
  })] }) : e;
181
181
  }
@@ -229,7 +229,7 @@ var de = [
229
229
  return /* @__PURE__ */ w("div", {
230
230
  className: "space-y-6 p-6",
231
231
  children: [
232
- /* @__PURE__ */ C(n, {
232
+ /* @__PURE__ */ C(te, {
233
233
  title: $ ? "Marketplace earnings" : "Earnings",
234
234
  description: $ ? `Developer portal revenue, sales, and payouts${N ? ` for ${N}` : ""}.` : "Track affiliate, store, and other earning sources in one ledger.",
235
235
  actions: P ? /* @__PURE__ */ w("button", {
@@ -239,7 +239,7 @@ var de = [
239
239
  children: [/* @__PURE__ */ C(g, { className: "size-4" }), "Back"]
240
240
  }) : void 0
241
241
  }),
242
- /* @__PURE__ */ C(m, { children: "See everything you have earned — from affiliate rewards, store sales and marketplace revenue — in one ledger, along with how much has been paid out and what is still pending. Filter by source to reconcile a specific stream." }),
242
+ /* @__PURE__ */ C(p, { children: "See everything you have earned — from affiliate rewards, store sales and marketplace revenue — in one ledger, along with how much has been paid out and what is still pending. Filter by source to reconcile a specific stream." }),
243
243
  G ? /* @__PURE__ */ C("div", {
244
244
  className: "grid gap-4 md:grid-cols-2 xl:grid-cols-4",
245
245
  children: [
@@ -253,7 +253,7 @@ var de = [
253
253
  children: [
254
254
  /* @__PURE__ */ C("div", {
255
255
  className: "grid gap-4 md:grid-cols-2 xl:grid-cols-4",
256
- children: ge.map((e) => /* @__PURE__ */ C(r, {
256
+ children: ge.map((e) => /* @__PURE__ */ C(n, {
257
257
  label: e.title,
258
258
  value: e.value,
259
259
  icon: e.icon
@@ -272,11 +272,11 @@ var de = [
272
272
  className: "inline-flex items-center gap-2 rounded-md border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary",
273
273
  children: [/* @__PURE__ */ C(y, { className: "size-4" }), "Refresh"]
274
274
  })]
275
- }), H.sales.length === 0 ? /* @__PURE__ */ C(p, {
275
+ }), H.sales.length === 0 ? /* @__PURE__ */ C(f, {
276
276
  illustration: "empty-data",
277
277
  title: "No sales yet",
278
278
  description: "Sales will appear here when customers start purchasing your apps."
279
- }) : /* @__PURE__ */ C(h, {
279
+ }) : /* @__PURE__ */ C(m, {
280
280
  data: H.sales,
281
281
  rowKey: (e) => e.id,
282
282
  columns: de
@@ -287,28 +287,28 @@ var de = [
287
287
  children: [/* @__PURE__ */ C("h2", {
288
288
  className: "mb-4 text-lg font-semibold text-text-primary",
289
289
  children: "Payouts"
290
- }), H.payouts.length === 0 ? /* @__PURE__ */ C(p, {
290
+ }), H.payouts.length === 0 ? /* @__PURE__ */ C(f, {
291
291
  illustration: "empty-data",
292
292
  title: "No payouts yet",
293
293
  description: "Scheduled and completed payouts will appear here."
294
- }) : /* @__PURE__ */ C(h, {
294
+ }) : /* @__PURE__ */ C(m, {
295
295
  data: H.payouts,
296
296
  rowKey: (e) => e.id,
297
297
  columns: fe
298
298
  })]
299
299
  })
300
300
  ]
301
- }) : /* @__PURE__ */ C(p, {
301
+ }) : /* @__PURE__ */ C(f, {
302
302
  illustration: "empty-data",
303
303
  title: "No developer portal revenue yet",
304
304
  description: "Marketplace revenue will appear here once your developer organization records sales."
305
305
  }) : R ? /* @__PURE__ */ w("div", {
306
306
  className: "space-y-4",
307
- children: [/* @__PURE__ */ C(le, {
307
+ children: [/* @__PURE__ */ C(ue, {
308
308
  className: "p-4 sm:p-5",
309
309
  children: /* @__PURE__ */ C("div", {
310
310
  className: "grid gap-4 md:grid-cols-2 xl:grid-cols-4",
311
- children: he.map((e) => /* @__PURE__ */ C(r, {
311
+ children: he.map((e) => /* @__PURE__ */ C(n, {
312
312
  label: e.title,
313
313
  value: e.value,
314
314
  icon: e.icon
@@ -335,7 +335,7 @@ var de = [
335
335
  }, e.title))
336
336
  }) : null]
337
337
  }) : null,
338
- q && !s(q) ? E ? /* @__PURE__ */ C(ne, { error: q }) : /* @__PURE__ */ C("div", {
338
+ q && !s(q) ? E ? /* @__PURE__ */ C(re, { error: q }) : /* @__PURE__ */ C("div", {
339
339
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4 text-sm text-status-error-text",
340
340
  children: q.message
341
341
  }) : null,
@@ -377,11 +377,11 @@ var de = [
377
377
  children: [/* @__PURE__ */ C(y, { className: "size-4" }), "Refresh"]
378
378
  })]
379
379
  })]
380
- }), Z.length === 0 && !G ? /* @__PURE__ */ C(p, {
380
+ }), Z.length === 0 && !G ? /* @__PURE__ */ C(f, {
381
381
  illustration: "empty-data",
382
382
  title: "No earnings yet",
383
383
  description: "Eligible affiliate rewards and other earnings will appear here."
384
- }) : /* @__PURE__ */ C(h, {
384
+ }) : /* @__PURE__ */ C(m, {
385
385
  data: Z,
386
386
  rowKey: (e) => e.id,
387
387
  columns: pe
@@ -1 +1 @@
1
- {"version":3,"file":"EarningsPage.js","names":["_Fragment","Fragment$1","salesColumns","sale","formatCurrency","formatDateTime","payoutColumns","payout","ledgerColumns","entry","EarningsPage","searchParams","useSearchParams","permissions","useBillingPermissions","isFluidgrids","useIsFluidgridsVariant","tr","useTr","useBilling","developerOrgId","developerOrgName","returnTo","billingAccountData","billingAccountLoading","useGetDefaultBillingAccountSettingsQuery","billingAccountId","summary","setSummary","useState","entries","setEntries","developerPortalRevenue","setDeveloperPortalRevenue","sourceFilter","setSourceFilter","loading","setLoading","error","setError","requestContext","useMemo","apiGatewayUrl","authToken","orgId","loadData","useCallback","loadedRevenue","fetchDeveloperPortalRevenueDashboard","loadedSummary","loadedEntries","fetchEarningsSummary","fetchEarningsEntries","loadError","useEffect","AccessDenied","IllustratedEmptyState","isServerError","serverError","ServerError","plainPayoutError","ShowTechnicalDetails","rawErrorText","cards","HandCoins","Coins","Wallet","RefreshCw","filteredEntries","categoryCards","item","developerPortalCards","isDeveloperPortalMode","PageHeader","navigate","ArrowLeft","PagePurpose","StatCard","card","ResponsiveTable","EmphasisPanel","PayoutErrorNotice","event"],"sources":["../../../../../src/billing/modules/earnings/pages/EarningsPage.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState, type FC } from 'react';\nimport { useSearchParams } from 'react-router';\nimport { ArrowLeft, Coins, HandCoins, RefreshCw, Wallet } from 'lucide-react';\nimport {\n ResponsiveTable,\n type ResponsiveTableColumn,\n PagePurpose,\n EmphasisPanel,\n IllustratedEmptyState,\n ShowTechnicalDetails,\n} from '@burdenoff/fe-libs/ui';\n\nimport { useIsFluidgridsVariant } from '../../../hooks/useBillingVariant';\nimport { useTr } from '../../../shared/hooks/useTr';\nimport { PayoutErrorNotice } from '../components/PayoutErrorNotice';\nimport { plainPayoutError, rawErrorText } from '../utils/plainPayoutError';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport { useBilling } from '../../../providers/BillingProvider';\nimport { AccessDenied, PageHeader, ServerError, StatCard } from '../../../shared/components';\nimport { formatCurrency, formatDateTime, isServerError } from '../../../shared/utils';\nimport { useGetDefaultBillingAccountSettingsQuery } from '../../../../generated/global-operations';\nimport {\n fetchEarningsEntries,\n fetchEarningsSummary,\n fetchDeveloperPortalRevenueDashboard,\n type DeveloperPortalRevenueDashboard,\n type DeveloperPortalRevenueSale,\n type DeveloperPortalRevenuePayout,\n type EarningsEntry,\n type EarningsSummary,\n} from '../api';\n\ntype EarningsSourceFilter = 'ALL' | 'AFFILIATE' | 'STORE' | 'OTHER';\n\nconst salesColumns: ResponsiveTableColumn<DeveloperPortalRevenueSale>[] = [\n {\n key: 'application',\n header: 'Application',\n priority: 'primary',\n cell: (sale) => sale.application?.name || sale.application?.slug || 'Unknown app',\n },\n { key: 'pricing', header: 'Pricing', cell: (sale) => sale.pricingModel },\n {\n key: 'gross',\n header: 'Gross',\n cell: (sale) => (\n <span className=\"tabular-nums\">\n {formatCurrency(sale.grossAmount, sale.currency || 'USD')}\n </span>\n ),\n },\n {\n key: 'net',\n header: 'Net',\n cell: (sale) => (\n <span className=\"tabular-nums\">{formatCurrency(sale.netAmount, sale.currency || 'USD')}</span>\n ),\n },\n { key: 'status', header: 'Status', cell: (sale) => sale.status },\n {\n key: 'purchased',\n header: 'Purchased',\n cell: (sale) => formatDateTime(sale.purchasedAt),\n },\n];\n\nconst payoutColumns: ResponsiveTableColumn<DeveloperPortalRevenuePayout>[] = [\n {\n key: 'period',\n header: 'Period',\n priority: 'primary',\n cell: (payout) => payout.periodLabel || '-',\n },\n {\n key: 'amount',\n header: 'Amount',\n cell: (payout) => (\n <span className=\"tabular-nums\">\n {formatCurrency(payout.netAmount, payout.currency || 'USD')}\n </span>\n ),\n },\n { key: 'status', header: 'Status', cell: (payout) => payout.status },\n {\n key: 'scheduled',\n header: 'Scheduled',\n cell: (payout) => (payout.scheduledAt ? formatDateTime(payout.scheduledAt) : '-'),\n },\n {\n key: 'completed',\n header: 'Completed',\n cell: (payout) => (payout.completedAt ? formatDateTime(payout.completedAt) : '-'),\n },\n];\n\nconst ledgerColumns: ResponsiveTableColumn<EarningsEntry>[] = [\n {\n key: 'category',\n header: 'Category',\n priority: 'primary',\n cell: (entry) => entry.sourceCategory,\n },\n {\n key: 'description',\n header: 'Description',\n cell: (entry) => entry.description || entry.sourceSubcategory || '-',\n },\n { key: 'unit', header: 'Unit', cell: (entry) => entry.unitType },\n {\n key: 'amount',\n header: 'Amount',\n cell: (entry) => (\n <span className=\"tabular-nums\">\n {entry.unitType === 'CREDITS'\n ? `${entry.amount.toLocaleString()} credits`\n : formatCurrency(entry.amount, entry.currency || 'USD')}\n </span>\n ),\n },\n { key: 'status', header: 'Status', cell: (entry) => entry.status },\n {\n key: 'created',\n header: 'Created',\n cell: (entry) => formatDateTime(entry.createdAt),\n },\n];\n\nexport const EarningsPage: FC = () => {\n const [searchParams] = useSearchParams();\n const permissions = useBillingPermissions();\n const isFluidgrids = useIsFluidgridsVariant();\n const tr = useTr();\n const { apiGatewayUrl, authToken, orgId, navigate } = useBilling();\n const developerOrgId = searchParams.get('developerOrgId');\n const developerOrgName = searchParams.get('developerOrgName');\n // Set by devportal's OrganizationDetailPage when it links here — lets this\n // page offer a way back without needing to know whether the org is\n // PHYSICAL or DIGITAL (that split isn't in scope on this side).\n const returnTo = searchParams.get('returnTo');\n const { data: billingAccountData, loading: billingAccountLoading } =\n useGetDefaultBillingAccountSettingsQuery({});\n\n const billingAccountId = billingAccountData?.getDefaultBillingAccount?.id;\n const [summary, setSummary] = useState<EarningsSummary | null>(null);\n const [entries, setEntries] = useState<EarningsEntry[]>([]);\n const [developerPortalRevenue, setDeveloperPortalRevenue] =\n useState<DeveloperPortalRevenueDashboard | null>(null);\n const [sourceFilter, setSourceFilter] = useState<EarningsSourceFilter>('ALL');\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const requestContext = useMemo(\n () => ({\n apiGatewayUrl,\n authToken,\n orgId,\n }),\n [apiGatewayUrl, authToken, orgId]\n );\n\n const loadData = useCallback(async () => {\n setLoading(true);\n setError(null);\n try {\n if (developerOrgId) {\n const loadedRevenue = await fetchDeveloperPortalRevenueDashboard(\n developerOrgId,\n requestContext\n );\n setDeveloperPortalRevenue(loadedRevenue);\n setSummary(null);\n setEntries([]);\n return;\n }\n\n if (!billingAccountId) {\n setSummary(null);\n setEntries([]);\n setDeveloperPortalRevenue(null);\n return;\n }\n\n const [loadedSummary, loadedEntries] = await Promise.all([\n fetchEarningsSummary(billingAccountId, requestContext),\n fetchEarningsEntries(billingAccountId, requestContext),\n ]);\n setSummary(loadedSummary);\n setEntries(loadedEntries);\n setDeveloperPortalRevenue(null);\n } catch (loadError) {\n setError(loadError instanceof Error ? loadError : new Error('Failed to load earnings'));\n } finally {\n setLoading(false);\n }\n }, [billingAccountId, developerOrgId, requestContext]);\n\n useEffect(() => {\n void loadData();\n }, [loadData]);\n\n if (!permissions.canViewBillingAccount) {\n return <AccessDenied message=\"You don't have permission to view earnings.\" />;\n }\n\n if (!developerOrgId && !billingAccountId && !billingAccountLoading) {\n return (\n <IllustratedEmptyState\n illustration=\"empty-generic\"\n title=\"No billing account found\"\n description=\"Create a billing account first to view earnings.\"\n />\n );\n }\n\n if (error && isServerError(error)) {\n const serverError = (\n <ServerError\n title=\"Earnings unavailable\"\n message={isFluidgrids ? plainPayoutError(error, tr) : error.message}\n onRetry={() => void loadData()}\n showRetry\n />\n );\n return isFluidgrids ? (\n <>\n {serverError}\n <div className=\"px-6\">\n <ShowTechnicalDetails copyable>{rawErrorText(error)}</ShowTechnicalDetails>\n </div>\n </>\n ) : (\n serverError\n );\n }\n\n const cards = summary\n ? [\n {\n title: 'Available',\n value: formatCurrency(summary.availableAmount, 'USD'),\n icon: <HandCoins className=\"size-5\" />,\n },\n {\n title: 'Reserved',\n value: formatCurrency(summary.reservedAmount, 'USD'),\n icon: <Coins className=\"size-5\" />,\n },\n {\n title: 'Paid out',\n value: formatCurrency(summary.paidAmount, 'USD'),\n icon: <Wallet className=\"size-5\" />,\n },\n {\n title: 'Lifetime',\n value: formatCurrency(summary.totalLifetimeAmount, 'USD'),\n icon: <RefreshCw className=\"size-5\" />,\n },\n ]\n : [];\n\n const filteredEntries =\n sourceFilter === 'ALL'\n ? entries\n : entries.filter((entry) => entry.sourceCategory === sourceFilter);\n\n const categoryCards =\n summary?.categoryBreakdown?.map((item) => ({\n title: `${item.category} earnings`,\n value: formatCurrency(item.amount, 'USD'),\n helperText: `${item.count} entries`,\n })) ?? [];\n\n const developerPortalCards = developerPortalRevenue?.summary\n ? [\n {\n title: 'Gross revenue',\n value: formatCurrency(\n developerPortalRevenue.summary.totalGrossRevenue,\n developerPortalRevenue.summary.currency\n ),\n icon: <HandCoins className=\"size-5\" />,\n },\n {\n title: 'Net revenue',\n value: formatCurrency(\n developerPortalRevenue.summary.totalNetRevenue,\n developerPortalRevenue.summary.currency\n ),\n icon: <Wallet className=\"size-5\" />,\n },\n {\n title: 'Pending balance',\n value: formatCurrency(\n developerPortalRevenue.summary.pendingBalance,\n developerPortalRevenue.summary.currency\n ),\n icon: <Coins className=\"size-5\" />,\n },\n {\n title: 'Platform fees',\n value: formatCurrency(\n developerPortalRevenue.summary.totalPlatformFees,\n developerPortalRevenue.summary.currency\n ),\n icon: <RefreshCw className=\"size-5\" />,\n },\n ]\n : [];\n\n const isDeveloperPortalMode = !!developerOrgId;\n\n return (\n <div className=\"space-y-6 p-6\">\n <PageHeader\n title={isDeveloperPortalMode ? 'Marketplace earnings' : 'Earnings'}\n description={\n isDeveloperPortalMode\n ? `Developer portal revenue, sales, and payouts${developerOrgName ? ` for ${developerOrgName}` : ''}.`\n : 'Track affiliate, store, and other earning sources in one ledger.'\n }\n actions={\n returnTo ? (\n <button\n type=\"button\"\n onClick={() => navigate?.(returnTo)}\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\n </button>\n ) : undefined\n }\n />\n\n <PagePurpose>\n See everything you have earned — from affiliate rewards, store sales and marketplace revenue\n — in one ledger, along with how much has been paid out and what is still pending. Filter by\n source to reconcile a specific stream.\n </PagePurpose>\n\n {loading ? (\n <div className=\"grid gap-4 md:grid-cols-2 xl:grid-cols-4\">\n {[1, 2, 3, 4].map((item) => (\n <div\n key={item}\n className=\"h-28 animate-pulse rounded-lg border border-border-subtle bg-bg-surface\"\n />\n ))}\n </div>\n ) : isDeveloperPortalMode ? (\n developerPortalRevenue?.summary ? (\n <div className=\"space-y-6\">\n <div className=\"grid gap-4 md:grid-cols-2 xl:grid-cols-4\">\n {developerPortalCards.map((card) => (\n <StatCard key={card.title} label={card.title} value={card.value} icon={card.icon} />\n ))}\n </div>\n\n <section className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <div className=\"mb-4 flex items-center justify-between\">\n <h2 className=\"text-lg font-semibold text-text-primary\">Recent sales</h2>\n <button\n type=\"button\"\n onClick={() => void loadData()}\n className=\"inline-flex items-center gap-2 rounded-md border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary\"\n >\n <RefreshCw className=\"size-4\" />\n Refresh\n </button>\n </div>\n\n {developerPortalRevenue.sales.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No sales yet\"\n description=\"Sales will appear here when customers start purchasing your apps.\"\n />\n ) : (\n <ResponsiveTable\n data={developerPortalRevenue.sales}\n rowKey={(sale) => sale.id}\n columns={salesColumns}\n />\n )}\n </section>\n\n <section className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <h2 className=\"mb-4 text-lg font-semibold text-text-primary\">Payouts</h2>\n\n {developerPortalRevenue.payouts.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No payouts yet\"\n description=\"Scheduled and completed payouts will appear here.\"\n />\n ) : (\n <ResponsiveTable\n data={developerPortalRevenue.payouts}\n rowKey={(payout) => payout.id}\n columns={payoutColumns}\n />\n )}\n </section>\n </div>\n ) : (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No developer portal revenue yet\"\n description=\"Marketplace revenue will appear here once your developer organization records sales.\"\n />\n )\n ) : summary ? (\n <div className=\"space-y-4\">\n <EmphasisPanel className=\"p-4 sm:p-5\">\n <div className=\"grid gap-4 md:grid-cols-2 xl:grid-cols-4\">\n {cards.map((card) => (\n <StatCard key={card.title} label={card.title} value={card.value} icon={card.icon} />\n ))}\n </div>\n </EmphasisPanel>\n {categoryCards.length > 0 ? (\n <div className=\"grid gap-4 md:grid-cols-2 xl:grid-cols-3\">\n {categoryCards.map((card) => (\n <div\n key={card.title}\n className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\"\n >\n <p className=\"text-sm text-text-secondary\">{card.title}</p>\n <p className=\"mt-2 text-xl font-semibold text-text-primary\">{card.value}</p>\n <p className=\"mt-1 text-xs text-text-secondary\">{card.helperText}</p>\n </div>\n ))}\n </div>\n ) : null}\n </div>\n ) : null}\n\n {error && !isServerError(error) ? (\n isFluidgrids ? (\n <PayoutErrorNotice error={error} />\n ) : (\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4 text-sm text-status-error-text\">\n {error.message}\n </div>\n )\n ) : null}\n\n <section className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <div className=\"mb-4 flex items-center justify-between\">\n <h2 className=\"text-lg font-semibold text-text-primary\">Ledger</h2>\n <div className=\"flex items-center gap-3\">\n <select\n value={sourceFilter}\n onChange={(event) => setSourceFilter(event.target.value as EarningsSourceFilter)}\n className=\"rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"ALL\">All sources</option>\n <option value=\"AFFILIATE\">Affiliate</option>\n <option value=\"STORE\">Store</option>\n <option value=\"OTHER\">Other</option>\n </select>\n <button\n type=\"button\"\n onClick={() => void loadData()}\n className=\"inline-flex items-center gap-2 rounded-md border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary\"\n >\n <RefreshCw className=\"size-4\" />\n Refresh\n </button>\n </div>\n </div>\n\n {filteredEntries.length === 0 && !loading ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No earnings yet\"\n description=\"Eligible affiliate rewards and other earnings will appear here.\"\n />\n ) : (\n <ResponsiveTable\n data={filteredEntries}\n rowKey={(entry) => entry.id}\n columns={ledgerColumns}\n />\n )}\n </section>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkCA,IAAME,KAAoE;CACxE;EACE,KAAK;EACL,QAAQ;EACR,UAAU;EACV,OAAO,MAASC,EAAK,aAAa,QAAQA,EAAK,aAAa,QAAQ;CACtE;CACA;EAAE,KAAK;EAAW,QAAQ;EAAW,OAAO,MAASA,EAAK;CAAa;CACvE;EACE,KAAK;EACL,QAAQ;EACR,OAAO,MACL,kBAAC,QAAD;GAAM,WAAU;GACb,UAAAC,EAAeD,EAAK,aAAaA,EAAK,YAA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A,GAClE,kBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACE,kBAAC,UAAD;OACE,OAAOJ;OACP,WAAW,MAAUC,GAAgB+C,EAAM,OAAO,KAA6B;OAC/E,WAAU;OAHZ,UAAA;QAKE,kBAAC,UAAD;SAAQ,OAAM;SAAM,UAAA;QAAmB,CAAA;QACvC,kBAAC,UAAD;SAAQ,OAAM;SAAY,UAAA;QAAiB,CAAA;QAC3C,kBAAC,UAAD;SAAQ,OAAM;SAAQ,UAAA;QAAa,CAAA;QACnC,kBAAC,UAAD;SAAQ,OAAM;SAAQ,UAAA;QAAa,CAAA;OAC7B;MACR,CAAA,GAAA,kBAAC,UAAD;OACE,MAAK;OACL,eAAe,KAAKrC,EAAS;OAC7B,WAAU;OAHZ,UAAA,CAKE,kBAACsB,GAAD,EAAW,WAAU,SAAU,CAAA,GAAC,SAE1B;MACL,CAAA,CAAA;KACF,CAAA,CAAA;IAEJ,CAAA,GAAAC,EAAgB,WAAW,KAAK,CAAChC,IAChC,kBAACoB,GAAD;KACE,cAAa;KACb,OAAM;KACN,aAAY;IACb,CAAA,IAED,kBAACuB,GAAD;KACE,MAAMX;KACN,SAAS,MAAU3D,EAAM;KACzB,SAASD;IACV,CAAA,CAEI;;EACN;;AAET"}
1
+ {"version":3,"file":"EarningsPage.js","names":["_Fragment","Fragment$1","salesColumns","sale","formatCurrency","formatDateTime","payoutColumns","payout","ledgerColumns","entry","EarningsPage","searchParams","useSearchParams","permissions","useBillingPermissions","isFluidgrids","useIsFluidgridsVariant","tr","useTr","useBilling","developerOrgId","developerOrgName","returnTo","billingAccountData","billingAccountLoading","useGetDefaultBillingAccountSettingsQuery","billingAccountId","summary","setSummary","useState","entries","setEntries","developerPortalRevenue","setDeveloperPortalRevenue","sourceFilter","setSourceFilter","loading","setLoading","error","setError","requestContext","useMemo","apiGatewayUrl","authToken","orgId","loadData","useCallback","loadedRevenue","fetchDeveloperPortalRevenueDashboard","loadedSummary","loadedEntries","fetchEarningsSummary","fetchEarningsEntries","loadError","useEffect","AccessDenied","IllustratedEmptyState","isServerError","serverError","ServerError","plainPayoutError","ShowTechnicalDetails","rawErrorText","cards","HandCoins","Coins","Wallet","RefreshCw","filteredEntries","categoryCards","item","developerPortalCards","isDeveloperPortalMode","PageHeader","navigate","ArrowLeft","PagePurpose","StatCard","card","ResponsiveTable","EmphasisPanel","PayoutErrorNotice","event"],"sources":["../../../../../src/billing/modules/earnings/pages/EarningsPage.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState, type FC } from 'react';\nimport { useSearchParams } from 'react-router';\nimport { ArrowLeft, Coins, HandCoins, RefreshCw, Wallet } from 'lucide-react';\nimport {\n ResponsiveTable,\n type ResponsiveTableColumn,\n PagePurpose,\n EmphasisPanel,\n IllustratedEmptyState,\n ShowTechnicalDetails,\n} from '@burdenoff/fe-libs/ui';\n\nimport { useIsFluidgridsVariant } from '../../../hooks/useBillingVariant';\nimport { useTr } from '../../../shared/hooks/useTr';\nimport { PayoutErrorNotice } from '../components/PayoutErrorNotice';\nimport { plainPayoutError, rawErrorText } from '../utils/plainPayoutError';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport { useBilling } from '../../../providers/BillingProvider';\nimport { AccessDenied, PageHeader, ServerError, StatCard } from '../../../shared/components';\nimport { formatCurrency, formatDateTime, isServerError } from '../../../shared/utils';\nimport { useGetDefaultBillingAccountSettingsQuery } from '../../../../generated/global-operations';\nimport {\n fetchEarningsEntries,\n fetchEarningsSummary,\n fetchDeveloperPortalRevenueDashboard,\n type DeveloperPortalRevenueDashboard,\n type DeveloperPortalRevenueSale,\n type DeveloperPortalRevenuePayout,\n type EarningsEntry,\n type EarningsSummary,\n} from '../api';\n\ntype EarningsSourceFilter = 'ALL' | 'AFFILIATE' | 'STORE' | 'OTHER';\n\nconst salesColumns: ResponsiveTableColumn<DeveloperPortalRevenueSale>[] = [\n {\n key: 'application',\n header: 'Application',\n priority: 'primary',\n cell: (sale) => sale.application?.name || sale.application?.slug || 'Unknown app',\n },\n { key: 'pricing', header: 'Pricing', cell: (sale) => sale.pricingModel },\n {\n key: 'gross',\n header: 'Gross',\n cell: (sale) => (\n <span className=\"tabular-nums\">\n {formatCurrency(sale.grossAmount, sale.currency || 'USD')}\n </span>\n ),\n },\n {\n key: 'net',\n header: 'Net',\n cell: (sale) => (\n <span className=\"tabular-nums\">{formatCurrency(sale.netAmount, sale.currency || 'USD')}</span>\n ),\n },\n { key: 'status', header: 'Status', cell: (sale) => sale.status },\n {\n key: 'purchased',\n header: 'Purchased',\n cell: (sale) => formatDateTime(sale.purchasedAt),\n },\n];\n\nconst payoutColumns: ResponsiveTableColumn<DeveloperPortalRevenuePayout>[] = [\n {\n key: 'period',\n header: 'Period',\n priority: 'primary',\n cell: (payout) => payout.periodLabel || '-',\n },\n {\n key: 'amount',\n header: 'Amount',\n cell: (payout) => (\n <span className=\"tabular-nums\">\n {formatCurrency(payout.netAmount, payout.currency || 'USD')}\n </span>\n ),\n },\n { key: 'status', header: 'Status', cell: (payout) => payout.status },\n {\n key: 'scheduled',\n header: 'Scheduled',\n cell: (payout) => (payout.scheduledAt ? formatDateTime(payout.scheduledAt) : '-'),\n },\n {\n key: 'completed',\n header: 'Completed',\n cell: (payout) => (payout.completedAt ? formatDateTime(payout.completedAt) : '-'),\n },\n];\n\nconst ledgerColumns: ResponsiveTableColumn<EarningsEntry>[] = [\n {\n key: 'category',\n header: 'Category',\n priority: 'primary',\n cell: (entry) => entry.sourceCategory,\n },\n {\n key: 'description',\n header: 'Description',\n cell: (entry) => entry.description || entry.sourceSubcategory || '-',\n },\n { key: 'unit', header: 'Unit', cell: (entry) => entry.unitType },\n {\n key: 'amount',\n header: 'Amount',\n cell: (entry) => (\n <span className=\"tabular-nums\">\n {entry.unitType === 'CREDITS'\n ? `${entry.amount.toLocaleString()} credits`\n : formatCurrency(entry.amount, entry.currency || 'USD')}\n </span>\n ),\n },\n { key: 'status', header: 'Status', cell: (entry) => entry.status },\n {\n key: 'created',\n header: 'Created',\n cell: (entry) => formatDateTime(entry.createdAt),\n },\n];\n\nexport const EarningsPage: FC = () => {\n const [searchParams] = useSearchParams();\n const permissions = useBillingPermissions();\n const isFluidgrids = useIsFluidgridsVariant();\n const tr = useTr();\n const { apiGatewayUrl, authToken, orgId, navigate } = useBilling();\n const developerOrgId = searchParams.get('developerOrgId');\n const developerOrgName = searchParams.get('developerOrgName');\n // Set by devportal's OrganizationDetailPage when it links here — lets this\n // page offer a way back without needing to know whether the org is\n // PHYSICAL or DIGITAL (that split isn't in scope on this side).\n const returnTo = searchParams.get('returnTo');\n const { data: billingAccountData, loading: billingAccountLoading } =\n useGetDefaultBillingAccountSettingsQuery({});\n\n const billingAccountId = billingAccountData?.getDefaultBillingAccount?.id;\n const [summary, setSummary] = useState<EarningsSummary | null>(null);\n const [entries, setEntries] = useState<EarningsEntry[]>([]);\n const [developerPortalRevenue, setDeveloperPortalRevenue] =\n useState<DeveloperPortalRevenueDashboard | null>(null);\n const [sourceFilter, setSourceFilter] = useState<EarningsSourceFilter>('ALL');\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const requestContext = useMemo(\n () => ({\n apiGatewayUrl,\n authToken,\n orgId,\n }),\n [apiGatewayUrl, authToken, orgId]\n );\n\n const loadData = useCallback(async () => {\n setLoading(true);\n setError(null);\n try {\n if (developerOrgId) {\n const loadedRevenue = await fetchDeveloperPortalRevenueDashboard(\n developerOrgId,\n requestContext\n );\n setDeveloperPortalRevenue(loadedRevenue);\n setSummary(null);\n setEntries([]);\n return;\n }\n\n if (!billingAccountId) {\n setSummary(null);\n setEntries([]);\n setDeveloperPortalRevenue(null);\n return;\n }\n\n const [loadedSummary, loadedEntries] = await Promise.all([\n fetchEarningsSummary(billingAccountId, requestContext),\n fetchEarningsEntries(billingAccountId, requestContext),\n ]);\n setSummary(loadedSummary);\n setEntries(loadedEntries);\n setDeveloperPortalRevenue(null);\n } catch (loadError) {\n setError(loadError instanceof Error ? loadError : new Error('Failed to load earnings'));\n } finally {\n setLoading(false);\n }\n }, [billingAccountId, developerOrgId, requestContext]);\n\n useEffect(() => {\n void loadData();\n }, [loadData]);\n\n if (!permissions.canViewBillingAccount) {\n return <AccessDenied message=\"You don't have permission to view earnings.\" />;\n }\n\n if (!developerOrgId && !billingAccountId && !billingAccountLoading) {\n return (\n <IllustratedEmptyState\n illustration=\"empty-generic\"\n title=\"No billing account found\"\n description=\"Create a billing account first to view earnings.\"\n />\n );\n }\n\n if (error && isServerError(error)) {\n const serverError = (\n <ServerError\n title=\"Earnings unavailable\"\n message={isFluidgrids ? plainPayoutError(error, tr) : error.message}\n onRetry={() => void loadData()}\n showRetry\n />\n );\n return isFluidgrids ? (\n <>\n {serverError}\n <div className=\"px-6\">\n <ShowTechnicalDetails copyable>{rawErrorText(error)}</ShowTechnicalDetails>\n </div>\n </>\n ) : (\n serverError\n );\n }\n\n const cards = summary\n ? [\n {\n title: 'Available',\n value: formatCurrency(summary.availableAmount, 'USD'),\n icon: <HandCoins className=\"size-5\" />,\n },\n {\n title: 'Reserved',\n value: formatCurrency(summary.reservedAmount, 'USD'),\n icon: <Coins className=\"size-5\" />,\n },\n {\n title: 'Paid out',\n value: formatCurrency(summary.paidAmount, 'USD'),\n icon: <Wallet className=\"size-5\" />,\n },\n {\n title: 'Lifetime',\n value: formatCurrency(summary.totalLifetimeAmount, 'USD'),\n icon: <RefreshCw className=\"size-5\" />,\n },\n ]\n : [];\n\n const filteredEntries =\n sourceFilter === 'ALL'\n ? entries\n : entries.filter((entry) => entry.sourceCategory === sourceFilter);\n\n const categoryCards =\n summary?.categoryBreakdown?.map((item) => ({\n title: `${item.category} earnings`,\n value: formatCurrency(item.amount, 'USD'),\n helperText: `${item.count} entries`,\n })) ?? [];\n\n const developerPortalCards = developerPortalRevenue?.summary\n ? [\n {\n title: 'Gross revenue',\n value: formatCurrency(\n developerPortalRevenue.summary.totalGrossRevenue,\n developerPortalRevenue.summary.currency\n ),\n icon: <HandCoins className=\"size-5\" />,\n },\n {\n title: 'Net revenue',\n value: formatCurrency(\n developerPortalRevenue.summary.totalNetRevenue,\n developerPortalRevenue.summary.currency\n ),\n icon: <Wallet className=\"size-5\" />,\n },\n {\n title: 'Pending balance',\n value: formatCurrency(\n developerPortalRevenue.summary.pendingBalance,\n developerPortalRevenue.summary.currency\n ),\n icon: <Coins className=\"size-5\" />,\n },\n {\n title: 'Platform fees',\n value: formatCurrency(\n developerPortalRevenue.summary.totalPlatformFees,\n developerPortalRevenue.summary.currency\n ),\n icon: <RefreshCw className=\"size-5\" />,\n },\n ]\n : [];\n\n const isDeveloperPortalMode = !!developerOrgId;\n\n return (\n <div className=\"space-y-6 p-6\">\n <PageHeader\n title={isDeveloperPortalMode ? 'Marketplace earnings' : 'Earnings'}\n description={\n isDeveloperPortalMode\n ? `Developer portal revenue, sales, and payouts${developerOrgName ? ` for ${developerOrgName}` : ''}.`\n : 'Track affiliate, store, and other earning sources in one ledger.'\n }\n actions={\n returnTo ? (\n <button\n type=\"button\"\n onClick={() => navigate?.(returnTo)}\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\n </button>\n ) : undefined\n }\n />\n\n <PagePurpose>\n See everything you have earned — from affiliate rewards, store sales and marketplace revenue\n — in one ledger, along with how much has been paid out and what is still pending. Filter by\n source to reconcile a specific stream.\n </PagePurpose>\n\n {loading ? (\n <div className=\"grid gap-4 md:grid-cols-2 xl:grid-cols-4\">\n {[1, 2, 3, 4].map((item) => (\n <div\n key={item}\n className=\"h-28 animate-pulse rounded-lg border border-border-subtle bg-bg-surface\"\n />\n ))}\n </div>\n ) : isDeveloperPortalMode ? (\n developerPortalRevenue?.summary ? (\n <div className=\"space-y-6\">\n <div className=\"grid gap-4 md:grid-cols-2 xl:grid-cols-4\">\n {developerPortalCards.map((card) => (\n <StatCard key={card.title} label={card.title} value={card.value} icon={card.icon} />\n ))}\n </div>\n\n <section className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <div className=\"mb-4 flex items-center justify-between\">\n <h2 className=\"text-lg font-semibold text-text-primary\">Recent sales</h2>\n <button\n type=\"button\"\n onClick={() => void loadData()}\n className=\"inline-flex items-center gap-2 rounded-md border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary\"\n >\n <RefreshCw className=\"size-4\" />\n Refresh\n </button>\n </div>\n\n {developerPortalRevenue.sales.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No sales yet\"\n description=\"Sales will appear here when customers start purchasing your apps.\"\n />\n ) : (\n <ResponsiveTable\n data={developerPortalRevenue.sales}\n rowKey={(sale) => sale.id}\n columns={salesColumns}\n />\n )}\n </section>\n\n <section className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <h2 className=\"mb-4 text-lg font-semibold text-text-primary\">Payouts</h2>\n\n {developerPortalRevenue.payouts.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No payouts yet\"\n description=\"Scheduled and completed payouts will appear here.\"\n />\n ) : (\n <ResponsiveTable\n data={developerPortalRevenue.payouts}\n rowKey={(payout) => payout.id}\n columns={payoutColumns}\n />\n )}\n </section>\n </div>\n ) : (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No developer portal revenue yet\"\n description=\"Marketplace revenue will appear here once your developer organization records sales.\"\n />\n )\n ) : summary ? (\n <div className=\"space-y-4\">\n <EmphasisPanel className=\"p-4 sm:p-5\">\n <div className=\"grid gap-4 md:grid-cols-2 xl:grid-cols-4\">\n {cards.map((card) => (\n <StatCard key={card.title} label={card.title} value={card.value} icon={card.icon} />\n ))}\n </div>\n </EmphasisPanel>\n {categoryCards.length > 0 ? (\n <div className=\"grid gap-4 md:grid-cols-2 xl:grid-cols-3\">\n {categoryCards.map((card) => (\n <div\n key={card.title}\n className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\"\n >\n <p className=\"text-sm text-text-secondary\">{card.title}</p>\n <p className=\"mt-2 text-xl font-semibold text-text-primary\">{card.value}</p>\n <p className=\"mt-1 text-xs text-text-secondary\">{card.helperText}</p>\n </div>\n ))}\n </div>\n ) : null}\n </div>\n ) : null}\n\n {error && !isServerError(error) ? (\n isFluidgrids ? (\n <PayoutErrorNotice error={error} />\n ) : (\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4 text-sm text-status-error-text\">\n {error.message}\n </div>\n )\n ) : null}\n\n <section className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <div className=\"mb-4 flex items-center justify-between\">\n <h2 className=\"text-lg font-semibold text-text-primary\">Ledger</h2>\n <div className=\"flex items-center gap-3\">\n <select\n value={sourceFilter}\n onChange={(event) => setSourceFilter(event.target.value as EarningsSourceFilter)}\n className=\"rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"ALL\">All sources</option>\n <option value=\"AFFILIATE\">Affiliate</option>\n <option value=\"STORE\">Store</option>\n <option value=\"OTHER\">Other</option>\n </select>\n <button\n type=\"button\"\n onClick={() => void loadData()}\n className=\"inline-flex items-center gap-2 rounded-md border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary\"\n >\n <RefreshCw className=\"size-4\" />\n Refresh\n </button>\n </div>\n </div>\n\n {filteredEntries.length === 0 && !loading ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No earnings yet\"\n description=\"Eligible affiliate rewards and other earnings will appear here.\"\n />\n ) : (\n <ResponsiveTable\n data={filteredEntries}\n rowKey={(entry) => entry.id}\n columns={ledgerColumns}\n />\n )}\n </section>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkCA,IAAME,KAAoE;CACxE;EACE,KAAK;EACL,QAAQ;EACR,UAAU;EACV,OAAO,MAASC,EAAK,aAAa,QAAQA,EAAK,aAAa,QAAQ;CACtE;CACA;EAAE,KAAK;E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,CAAA,IAEL;GAEJ,kBAAC,WAAD;IAAS,WAAU;IAAnB,UAAA,CACE,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAAC,MAAD;MAAI,WAAU;MAA0C,UAAA;KAAU,CAAA,GAClE,kBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACE,kBAAC,UAAD;OACE,OAAOJ;OACP,WAAW,MAAUC,GAAgB+C,EAAM,OAAO,KAA6B;OAC/E,WAAU;OAHZ,UAAA;QAKE,kBAAC,UAAD;SAAQ,OAAM;SAAM,UAAA;QAAmB,CAAA;QACvC,kBAAC,UAAD;SAAQ,OAAM;SAAY,UAAA;QAAiB,CAAA;QAC3C,kBAAC,UAAD;SAAQ,OAAM;SAAQ,UAAA;QAAa,CAAA;QACnC,kBAAC,UAAD;SAAQ,OAAM;SAAQ,UAAA;QAAa,CAAA;OAC7B;MACR,CAAA,GAAA,kBAAC,UAAD;OACE,MAAK;OACL,eAAe,KAAKrC,EAAS;OAC7B,WAAU;OAHZ,UAAA,CAKE,kBAACsB,GAAD,EAAW,WAAU,SAAU,CAAA,GAAC,SAE1B;MACL,CAAA,CAAA;KACF,CAAA,CAAA;IAEJ,CAAA,GAAAC,EAAgB,WAAW,KAAK,CAAChC,IAChC,kBAACoB,GAAD;KACE,cAAa;KACb,OAAM;KACN,aAAY;IACb,CAAA,IAED,kBAACuB,GAAD;KACE,MAAMX;KACN,SAAS,MAAU3D,EAAM;KACzB,SAASD;IACV,CAAA,CAEI;;EACN;;AAET"}
@@ -7,9 +7,9 @@ import { MoneyActionDialog as re } from "../../../shared/components/MoneyActionD
7
7
  import "../../../shared/components/index.js";
8
8
  import { useTr as ie } from "../../../shared/hooks/useTr.js";
9
9
  import { useBillingEventEmitter as ae } from "../../../hooks/useBillingEventEmitter.js";
10
+ import { useBilling as oe } from "../../../providers/BillingProvider.js";
10
11
  import { formatCurrency as n, formatDateTime as r } from "../../../shared/utils/format.js";
11
12
  import { isServerError as i } from "../../../shared/utils/error.js";
12
- import { useBilling as oe } from "../../../providers/BillingProvider.js";
13
13
  import "../../../shared/utils/index.js";
14
14
  import { useGetDefaultBillingAccountSettingsQuery as se } from "../../../../generated/global-operations.js";
15
15
  import { addPayoutAccount as ce, archivePayoutAccount as le, fetchPayoutAccounts as ue, fetchPayoutRequests as de, requestPayout as fe, setDefaultPayoutAccount as pe, updatePayoutAccount as me } from "../api.js";
@@ -5,8 +5,8 @@ import { PageHeader as ne } from "../../../shared/components/PageHeader.js";
5
5
  import { useBillingEventEmitter as re } from "../../../hooks/useBillingEventEmitter.js";
6
6
  import { useBillingPermissions as ie } from "../../../hooks/useBillingPermissions.js";
7
7
  import { useBilling as ae } from "../../../providers/BillingProvider.js";
8
- import { directBillingGraphqlRequest as oe } from "../../../shared/utils/directBillingGraphql.js";
9
8
  import "../../../shared/components/index.js";
9
+ import { directBillingGraphqlRequest as oe } from "../../../shared/utils/directBillingGraphql.js";
10
10
  import { TeamPermissionsPage as se } from "./TeamPermissionsPage.js";
11
11
  import "../../../shared/utils/index.js";
12
12
  import { ArchiveBillingAccountSettingsDocument as ce, useGetBillingAccountSettingsQuery as le, useGetBillingAccountsSettingsQuery as ue, useGetDefaultBillingAccountSettingsQuery as de, useSetDefaultBillingAccountSettingsMutation as fe, useUpdateBillingAccountSettingsMutation as pe } from "../../../../generated/global-operations.js";