@burdenoff/microfe-billing 2026.1114.10 → 2026.1115.2

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,24 +1,24 @@
1
1
  import { useBilling as e } from "../../../providers/BillingProvider.js";
2
2
  import { AccessDenied as t } from "../../../shared/components/AccessDenied.js";
3
3
  import { PageHeader as n } from "../../../shared/components/PageHeader.js";
4
- import { StatCard as r } from "../../../shared/components/StatCard.js";
5
- import { ServerError as i } from "../../../shared/components/ServerError.js";
6
- import { MoneyActionDialog as a } from "../../../shared/components/MoneyActionDialog.js";
7
- import { useBillingEventEmitter as ee } from "../../../hooks/useBillingEventEmitter.js";
8
- import { HeaderActions as te } from "../../../shared/components/HeaderActions.js";
9
- import { useBillingPermissions as o } from "../../../hooks/useBillingPermissions.js";
10
- import { useIsFluidgridsVariant as s } from "../../../hooks/useBillingVariant.js";
4
+ import { StatCard as ee } from "../../../shared/components/StatCard.js";
5
+ import { ServerError as r } from "../../../shared/components/ServerError.js";
6
+ import { MoneyActionDialog as i } from "../../../shared/components/MoneyActionDialog.js";
7
+ import { useBillingEventEmitter as a } from "../../../hooks/useBillingEventEmitter.js";
8
+ import { HeaderActions as o } from "../../../shared/components/HeaderActions.js";
9
+ import { useBillingPermissions as s } from "../../../hooks/useBillingPermissions.js";
10
+ import { useIsFluidgridsVariant as te } from "../../../hooks/useBillingVariant.js";
11
11
  import { formatCurrency as c, formatDateTime as l } from "../../../shared/utils/format.js";
12
12
  import { isServerError as u } from "../../../shared/utils/error.js";
13
13
  import "../../../shared/components/index.js";
14
14
  import "../../../shared/utils/index.js";
15
- import { addAffiliateCodeNote as d, createAffiliateCode as f, deactivateAffiliateCode as p, fetchMyAffiliateAnalytics as m, fetchMyAffiliateCodes as h, fetchMyAffiliateJourneys as g, updateAffiliateCode as _ } from "../api.js";
16
- import { useCallback as v, useEffect as y, useMemo as ne, useState as b } from "react";
17
- import { EmphasisPanel as re, IllustratedEmptyState as x, PagePurpose as ie, ResponsiveTable as ae } from "@burdenoff/fe-libs/ui";
18
- import { Link2 as oe, Plus as se, RefreshCw as ce, StickyNote as le, Ticket as ue, TrendingUp as de, Users as S } from "lucide-react";
19
- import { jsx as C, jsxs as w } from "react/jsx-runtime";
15
+ import { addAffiliateCodeNote as ne, createAffiliateCode as re, deactivateAffiliateCode as d, fetchMyAffiliateAnalytics as ie, fetchMyAffiliateCodes as ae, fetchMyAffiliateJourneys as f, updateAffiliateCode as p } from "../api.js";
16
+ import { useCallback as m, useEffect as h, useMemo as g, useState as _ } from "react";
17
+ import { EmphasisPanel as v, IllustratedEmptyState as y, PagePurpose as b, ResponsiveTable as oe } from "@burdenoff/fe-libs/ui";
18
+ import { Link2 as x, Plus as se, RefreshCw as ce, StickyNote as le, Ticket as ue, TrendingUp as de, Users as fe } from "lucide-react";
19
+ import { jsx as S, jsxs as C } from "react/jsx-runtime";
20
20
  // src/billing/modules/affiliate/pages/AffiliateDashboardPage.tsx
21
- var T = [
21
+ var w = [
22
22
  {
23
23
  key: "code",
24
24
  header: "Code",
@@ -50,88 +50,88 @@ var T = [
50
50
  header: "Visited",
51
51
  cell: (e) => l(e.lastVisitedAt)
52
52
  }
53
- ], E = () => {
54
- let l = o(), E = s(), [D, O] = b(null), [k, A] = b(!1), [j, M] = b(null), { emit: N } = ee(), { apiGatewayUrl: P, authToken: F, orgId: I } = e(), [L, fe] = b([]), [R, z] = b([]), [B, V] = b(null), [H, U] = b(!0), [W, G] = b(null), [pe, K] = b(null), [q, J] = b({
53
+ ], T = () => {
54
+ let l = s(), T = te(), [E, D] = _(null), [O, k] = _(!1), [A, j] = _(null), [M, N] = _(null), { emit: P } = a(), { apiGatewayUrl: F, authToken: I, orgId: L } = e(), [R, z] = _([]), [B, V] = _([]), [H, pe] = _(null), [U, W] = _(!0), [G, K] = _(null), [me, q] = _(null), [J, Y] = _({
55
55
  label: "",
56
56
  description: "",
57
57
  notes: "",
58
58
  productSlug: "",
59
59
  destinationPath: "",
60
60
  destinationUrl: ""
61
- }), Y = ne(() => ({
62
- apiGatewayUrl: P,
63
- authToken: F,
64
- orgId: I
61
+ }), X = g(() => ({
62
+ apiGatewayUrl: F,
63
+ authToken: I,
64
+ orgId: L
65
65
  }), [
66
- P,
67
66
  F,
68
- I
69
- ]), X = v(async () => {
70
- U(!0), G(null);
67
+ I,
68
+ L
69
+ ]), Z = m(async () => {
70
+ W(!0), K(null);
71
71
  try {
72
72
  let [e, t, n] = await Promise.all([
73
- h(Y),
74
- m(Y),
75
- g(Y)
73
+ ae(X),
74
+ ie(X),
75
+ f(X)
76
76
  ]);
77
- fe(e), V(t), z(n);
77
+ z(e), pe(t), V(n);
78
78
  } catch (e) {
79
- G(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load affiliate dashboard"));
79
+ K(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load affiliate dashboard"));
80
80
  } finally {
81
- U(!1);
81
+ W(!1);
82
82
  }
83
- }, [Y]);
84
- if (y(() => {
85
- X();
86
- }, [X]), !l.canViewBillingAccount) return /* @__PURE__ */ C(t, { message: "You don't have permission to view affiliate analytics." });
87
- if (W && u(W)) return /* @__PURE__ */ C(i, {
83
+ }, [X]);
84
+ if (h(() => {
85
+ Z();
86
+ }, [Z]), !l.canViewBillingAccount) return /* @__PURE__ */ S(t, { message: "You don't have permission to view affiliate analytics." });
87
+ if (G && u(G)) return /* @__PURE__ */ S(r, {
88
88
  title: "Affiliate service unavailable",
89
- message: W.message,
90
- onRetry: () => void X(),
89
+ message: G.message,
90
+ onRetry: () => void Z(),
91
91
  showRetry: !0
92
92
  });
93
- let Z = L.find((e) => e.id === pe) ?? null, me = async () => {
94
- if (!q.productSlug.trim()) G(/* @__PURE__ */ Error("Product slug is required"));
93
+ let Q = R.find((e) => e.id === me) ?? null, he = async () => {
94
+ if (!J.productSlug.trim()) K(/* @__PURE__ */ Error("Product slug is required"));
95
95
  else try {
96
- if (Z) await _(Z.id, {
97
- label: q.label,
98
- description: q.description,
99
- notes: q.notes,
100
- destinationPath: q.destinationPath,
101
- destinationUrl: q.destinationUrl
102
- }, Y), N("billing.affiliate_code.updated", {
96
+ if (Q) await p(Q.id, {
97
+ label: J.label,
98
+ description: J.description,
99
+ notes: J.notes,
100
+ destinationPath: J.destinationPath,
101
+ destinationUrl: J.destinationUrl
102
+ }, X), P("billing.affiliate_code.updated", {
103
103
  route: "/billing/affiliate",
104
- entityId: Z.id,
104
+ entityId: Q.id,
105
105
  source: "affiliate-dashboard"
106
106
  });
107
107
  else {
108
- let e = await f({
109
- label: q.label,
110
- description: q.description,
111
- notes: q.notes,
112
- productSlug: q.productSlug,
113
- destinationPath: q.destinationPath,
114
- destinationUrl: q.destinationUrl
115
- }, Y);
116
- N("billing.affiliate_code.created", {
108
+ let e = await re({
109
+ label: J.label,
110
+ description: J.description,
111
+ notes: J.notes,
112
+ productSlug: J.productSlug,
113
+ destinationPath: J.destinationPath,
114
+ destinationUrl: J.destinationUrl
115
+ }, X);
116
+ P("billing.affiliate_code.created", {
117
117
  route: "/billing/affiliate",
118
118
  entityId: e.id,
119
119
  source: "affiliate-dashboard"
120
120
  });
121
121
  }
122
- K(null), J({
122
+ q(null), Y({
123
123
  label: "",
124
124
  description: "",
125
125
  notes: "",
126
126
  productSlug: "",
127
127
  destinationPath: "",
128
128
  destinationUrl: ""
129
- }), await X();
129
+ }), await Z();
130
130
  } catch (e) {
131
- G(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to save affiliate code"));
131
+ K(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to save affiliate code"));
132
132
  }
133
- }, he = (e) => {
134
- K(e.id), J({
133
+ }, ge = (e) => {
134
+ q(e.id), Y({
135
135
  label: e.label ?? "",
136
136
  description: e.description ?? "",
137
137
  notes: e.notes ?? "",
@@ -139,168 +139,173 @@ var T = [
139
139
  destinationPath: e.destinationPath ?? "",
140
140
  destinationUrl: e.destinationUrl ?? ""
141
141
  });
142
- }, ge = async () => {
143
- if (D) {
144
- A(!0), M(null);
142
+ }, _e = async () => {
143
+ if (E) {
144
+ k(!0), j(null);
145
145
  try {
146
- await Q(D.id), O(null);
146
+ await $(E.id), N(E.label), D(null);
147
147
  } catch (e) {
148
- M(e instanceof Error ? e.message : "Could not deactivate this code.");
148
+ j(e instanceof Error ? e.message : "Could not deactivate this code.");
149
149
  } finally {
150
- A(!1);
150
+ k(!1);
151
151
  }
152
152
  }
153
- }, Q = async (e) => {
154
- await p(e, Y), N("billing.affiliate_code.deactivated", {
153
+ }, $ = async (e) => {
154
+ await d(e, X), P("billing.affiliate_code.deactivated", {
155
155
  route: "/billing/affiliate",
156
156
  entityId: e,
157
157
  source: "affiliate-dashboard"
158
- }), await X();
159
- }, $ = async (e) => {
158
+ }), await Z();
159
+ }, ve = async (e) => {
160
160
  let t = window.prompt("Add an internal note for this affiliate code");
161
- t && (await d(e, t, Y), N("billing.affiliate_code.note_added", {
161
+ t && (await ne(e, t, X), P("billing.affiliate_code.note_added", {
162
162
  route: "/billing/affiliate",
163
163
  entityId: e,
164
164
  source: "affiliate-dashboard"
165
- }), await X());
166
- }, _e = B ? [
165
+ }), await Z());
166
+ }, ye = H ? [
167
167
  {
168
168
  title: "Codes",
169
- value: B.totalCodes,
170
- icon: /* @__PURE__ */ C(ue, { className: "size-5" })
169
+ value: H.totalCodes,
170
+ icon: /* @__PURE__ */ S(ue, { className: "size-5" })
171
171
  },
172
172
  {
173
173
  title: "Visits",
174
- value: B.totalVisits,
175
- icon: /* @__PURE__ */ C(S, { className: "size-5" })
174
+ value: H.totalVisits,
175
+ icon: /* @__PURE__ */ S(fe, { className: "size-5" })
176
176
  },
177
177
  {
178
178
  title: "Journeys",
179
- value: B.totalJourneys,
180
- icon: /* @__PURE__ */ C(oe, { className: "size-5" })
179
+ value: H.totalJourneys,
180
+ icon: /* @__PURE__ */ S(x, { className: "size-5" })
181
181
  },
182
182
  {
183
183
  title: "Revenue influenced",
184
- value: c(B.totalRevenueAmount, "USD"),
185
- icon: /* @__PURE__ */ C(de, { className: "size-5" })
184
+ value: c(H.totalRevenueAmount, "USD"),
185
+ icon: /* @__PURE__ */ S(de, { className: "size-5" })
186
186
  }
187
187
  ] : [];
188
- return /* @__PURE__ */ w("div", {
188
+ return /* @__PURE__ */ C("div", {
189
189
  className: "space-y-6 p-6",
190
190
  children: [
191
- E && /* @__PURE__ */ C(a, {
192
- open: D !== null,
191
+ T && M ? /* @__PURE__ */ S("div", {
192
+ role: "status",
193
+ className: "rounded-lg border border-border-subtle bg-status-info-bg-subtle p-4 text-sm text-status-info-text",
194
+ children: `"${M}" was deactivated.`
195
+ }) : null,
196
+ T && /* @__PURE__ */ S(i, {
197
+ open: E !== null,
193
198
  tone: "danger",
194
199
  title: "Deactivate this affiliate code?",
195
200
  description: "The code stops tracking new visits straight away. Visits and journeys already recorded are kept.",
196
201
  details: [{
197
202
  label: "Code",
198
- value: D?.label ?? ""
203
+ value: E?.label ?? ""
199
204
  }],
200
205
  confirmLabel: "Deactivate code",
201
206
  busyLabel: "Deactivating…",
202
- isBusy: k,
203
- error: j,
204
- onConfirm: () => void ge(),
205
- onCancel: () => O(null)
207
+ isBusy: O,
208
+ error: A,
209
+ onConfirm: () => void _e(),
210
+ onCancel: () => D(null)
206
211
  }),
207
- /* @__PURE__ */ C(n, {
212
+ /* @__PURE__ */ S(n, {
208
213
  title: "Affiliate codes",
209
214
  description: "Create referral codes, add internal notes, and monitor attributed journeys.",
210
- actions: /* @__PURE__ */ C(te, { actions: [{
215
+ actions: /* @__PURE__ */ S(o, { actions: [{
211
216
  label: "Refresh",
212
- onSelect: () => void X(),
213
- icon: /* @__PURE__ */ C(ce, { className: "size-4" })
217
+ onSelect: () => void Z(),
218
+ icon: /* @__PURE__ */ S(ce, { className: "size-4" })
214
219
  }] })
215
220
  }),
216
- /* @__PURE__ */ C(ie, { children: "Generate referral links for any product, share them, and see exactly what they drive — visits, signups, paid conversions and the rewards you have earned. Create and manage your codes on the left and watch attributed visitor journeys on the right." }),
217
- H ? /* @__PURE__ */ C("div", {
221
+ /* @__PURE__ */ S(b, { children: "Generate referral links for any product, share them, and see exactly what they drive — visits, signups, paid conversions and the rewards you have earned. Create and manage your codes on the left and watch attributed visitor journeys on the right." }),
222
+ U ? /* @__PURE__ */ S("div", {
218
223
  className: "grid gap-4 md:grid-cols-2 xl:grid-cols-4",
219
224
  children: [
220
225
  1,
221
226
  2,
222
227
  3,
223
228
  4
224
- ].map((e) => /* @__PURE__ */ C("div", { className: "h-28 animate-pulse rounded-lg border border-border-subtle bg-bg-surface" }, e))
225
- }) : B ? /* @__PURE__ */ C(re, {
229
+ ].map((e) => /* @__PURE__ */ S("div", { className: "h-28 animate-pulse rounded-lg border border-border-subtle bg-bg-surface" }, e))
230
+ }) : H ? /* @__PURE__ */ S(v, {
226
231
  className: "p-4 sm:p-5",
227
- children: /* @__PURE__ */ C("div", {
232
+ children: /* @__PURE__ */ S("div", {
228
233
  className: "grid gap-4 md:grid-cols-2 xl:grid-cols-4",
229
- children: _e.map((e) => /* @__PURE__ */ C(r, {
234
+ children: ye.map((e) => /* @__PURE__ */ S(ee, {
230
235
  label: e.title,
231
236
  value: e.value,
232
237
  icon: e.icon
233
238
  }, e.title))
234
239
  })
235
240
  }) : null,
236
- W && !u(W) ? /* @__PURE__ */ C("div", {
241
+ G && !u(G) ? /* @__PURE__ */ S("div", {
237
242
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4 text-sm text-status-error-text",
238
- children: W.message
243
+ children: G.message
239
244
  }) : null,
240
- /* @__PURE__ */ w("div", {
245
+ /* @__PURE__ */ C("div", {
241
246
  className: "grid gap-6 xl:grid-cols-[1.1fr,1.9fr]",
242
- children: [/* @__PURE__ */ w("section", {
247
+ children: [/* @__PURE__ */ C("section", {
243
248
  className: "rounded-lg border border-border-seam bg-bg-surface p-4 xl:sticky xl:top-6 xl:self-start",
244
249
  children: [
245
- /* @__PURE__ */ w("div", {
250
+ /* @__PURE__ */ C("div", {
246
251
  className: "mb-4 flex items-center justify-between",
247
- children: [/* @__PURE__ */ C("h2", {
252
+ children: [/* @__PURE__ */ S("h2", {
248
253
  className: "text-lg font-semibold text-text-primary",
249
- children: Z ? "Update affiliate code" : "Create affiliate code"
250
- }), Z ? null : /* @__PURE__ */ C(se, { className: "size-4 text-text-secondary" })]
254
+ children: Q ? "Update affiliate code" : "Create affiliate code"
255
+ }), Q ? null : /* @__PURE__ */ S(se, { className: "size-4 text-text-secondary" })]
251
256
  }),
252
- /* @__PURE__ */ w("div", {
257
+ /* @__PURE__ */ C("div", {
253
258
  className: "space-y-3",
254
259
  children: [
255
- /* @__PURE__ */ C("input", {
256
- value: q.label,
257
- onChange: (e) => J((t) => ({
260
+ /* @__PURE__ */ S("input", {
261
+ value: J.label,
262
+ onChange: (e) => Y((t) => ({
258
263
  ...t,
259
264
  label: e.target.value
260
265
  })),
261
266
  placeholder: "Label",
262
267
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
263
268
  }),
264
- /* @__PURE__ */ C("input", {
265
- value: q.productSlug,
266
- onChange: (e) => J((t) => ({
269
+ /* @__PURE__ */ S("input", {
270
+ value: J.productSlug,
271
+ onChange: (e) => Y((t) => ({
267
272
  ...t,
268
273
  productSlug: e.target.value
269
274
  })),
270
275
  placeholder: "Product slug (eg. bigconsole)",
271
276
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary",
272
- disabled: !!Z
277
+ disabled: !!Q
273
278
  }),
274
- /* @__PURE__ */ C("input", {
275
- value: q.destinationPath,
276
- onChange: (e) => J((t) => ({
279
+ /* @__PURE__ */ S("input", {
280
+ value: J.destinationPath,
281
+ onChange: (e) => Y((t) => ({
277
282
  ...t,
278
283
  destinationPath: e.target.value
279
284
  })),
280
285
  placeholder: "Destination path (eg. /pricing)",
281
286
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
282
287
  }),
283
- /* @__PURE__ */ C("input", {
284
- value: q.destinationUrl,
285
- onChange: (e) => J((t) => ({
288
+ /* @__PURE__ */ S("input", {
289
+ value: J.destinationUrl,
290
+ onChange: (e) => Y((t) => ({
286
291
  ...t,
287
292
  destinationUrl: e.target.value
288
293
  })),
289
294
  placeholder: "Absolute destination URL (optional)",
290
295
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
291
296
  }),
292
- /* @__PURE__ */ C("textarea", {
293
- value: q.description,
294
- onChange: (e) => J((t) => ({
297
+ /* @__PURE__ */ S("textarea", {
298
+ value: J.description,
299
+ onChange: (e) => Y((t) => ({
295
300
  ...t,
296
301
  description: e.target.value
297
302
  })),
298
303
  placeholder: "Description",
299
304
  className: "min-h-24 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
300
305
  }),
301
- /* @__PURE__ */ C("textarea", {
302
- value: q.notes,
303
- onChange: (e) => J((t) => ({
306
+ /* @__PURE__ */ S("textarea", {
307
+ value: J.notes,
308
+ onChange: (e) => Y((t) => ({
304
309
  ...t,
305
310
  notes: e.target.value
306
311
  })),
@@ -309,17 +314,17 @@ var T = [
309
314
  })
310
315
  ]
311
316
  }),
312
- /* @__PURE__ */ w("div", {
317
+ /* @__PURE__ */ C("div", {
313
318
  className: "mt-4 flex flex-wrap gap-3",
314
- children: [/* @__PURE__ */ C("button", {
319
+ children: [/* @__PURE__ */ S("button", {
315
320
  type: "button",
316
- onClick: () => void me(),
321
+ onClick: () => void he(),
317
322
  className: "rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text",
318
- children: Z ? "Save changes" : "Create code"
319
- }), Z ? /* @__PURE__ */ C("button", {
323
+ children: Q ? "Save changes" : "Create code"
324
+ }), Q ? /* @__PURE__ */ S("button", {
320
325
  type: "button",
321
326
  onClick: () => {
322
- K(null), J({
327
+ q(null), Y({
323
328
  label: "",
324
329
  description: "",
325
330
  notes: "",
@@ -333,32 +338,32 @@ var T = [
333
338
  }) : null]
334
339
  })
335
340
  ]
336
- }), /* @__PURE__ */ w("section", {
341
+ }), /* @__PURE__ */ C("section", {
337
342
  className: "space-y-4",
338
- children: [/* @__PURE__ */ w("div", {
343
+ children: [/* @__PURE__ */ C("div", {
339
344
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
340
- children: [/* @__PURE__ */ C("h2", {
345
+ children: [/* @__PURE__ */ S("h2", {
341
346
  className: "mb-4 text-lg font-semibold text-text-primary",
342
347
  children: "My codes"
343
- }), L.length === 0 && !H ? /* @__PURE__ */ C(x, {
348
+ }), R.length === 0 && !U ? /* @__PURE__ */ S(y, {
344
349
  illustration: "empty-data",
345
350
  title: "No affiliate codes yet",
346
351
  description: "Create your first code to start tracking attributable journeys."
347
- }) : /* @__PURE__ */ C("div", {
352
+ }) : /* @__PURE__ */ S("div", {
348
353
  className: "space-y-4",
349
- children: L.map((e) => {
354
+ children: R.map((e) => {
350
355
  let t = e.destinationUrl || `https://${e.productSlug}.com${e.destinationPath || ""}?ref=${e.code}`;
351
- return /* @__PURE__ */ w("div", {
356
+ return /* @__PURE__ */ C("div", {
352
357
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
353
358
  children: [
354
- /* @__PURE__ */ w("div", {
359
+ /* @__PURE__ */ C("div", {
355
360
  className: "flex flex-wrap items-start justify-between gap-4",
356
- children: [/* @__PURE__ */ w("div", { children: [
357
- /* @__PURE__ */ C("p", {
361
+ children: [/* @__PURE__ */ C("div", { children: [
362
+ /* @__PURE__ */ S("p", {
358
363
  className: "text-sm font-semibold text-text-primary",
359
364
  children: e.label || e.code
360
365
  }),
361
- /* @__PURE__ */ w("p", {
366
+ /* @__PURE__ */ C("p", {
362
367
  className: "text-xs text-text-secondary",
363
368
  children: [
364
369
  e.code,
@@ -366,83 +371,83 @@ var T = [
366
371
  e.productSlug
367
372
  ]
368
373
  }),
369
- /* @__PURE__ */ C("p", {
374
+ /* @__PURE__ */ S("p", {
370
375
  className: "mt-1 break-all text-xs text-text-secondary",
371
376
  children: t
372
377
  })
373
- ] }), /* @__PURE__ */ w("div", {
378
+ ] }), /* @__PURE__ */ C("div", {
374
379
  className: "flex flex-wrap gap-2",
375
380
  children: [
376
- /* @__PURE__ */ C("button", {
381
+ /* @__PURE__ */ S("button", {
377
382
  type: "button",
378
- onClick: () => he(e),
383
+ onClick: () => ge(e),
379
384
  className: "rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary",
380
385
  children: "Edit"
381
386
  }),
382
- /* @__PURE__ */ w("button", {
387
+ /* @__PURE__ */ C("button", {
383
388
  type: "button",
384
- onClick: () => void $(e.id),
389
+ onClick: () => void ve(e.id),
385
390
  className: "inline-flex items-center gap-1 rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary",
386
- children: [/* @__PURE__ */ C(le, { className: "size-3.5" }), "Note"]
391
+ children: [/* @__PURE__ */ S(le, { className: "size-3.5" }), "Note"]
387
392
  }),
388
- e.status === "ACTIVE" ? /* @__PURE__ */ C("button", {
393
+ e.status === "ACTIVE" ? /* @__PURE__ */ S("button", {
389
394
  type: "button",
390
- onClick: () => E ? (M(null), O({
395
+ onClick: () => T ? (j(null), D({
391
396
  id: e.id,
392
397
  label: e.label || e.code
393
- })) : void Q(e.id),
398
+ })) : void $(e.id),
394
399
  className: "rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-status-error-text",
395
400
  children: "Deactivate"
396
401
  }) : null
397
402
  ]
398
403
  })]
399
404
  }),
400
- /* @__PURE__ */ w("div", {
405
+ /* @__PURE__ */ C("div", {
401
406
  className: "mt-4 grid gap-3 sm:grid-cols-2 xl:grid-cols-4",
402
407
  children: [
403
- /* @__PURE__ */ w("div", {
408
+ /* @__PURE__ */ C("div", {
404
409
  className: "rounded-md border border-border-subtle bg-bg-surface p-3",
405
- children: [/* @__PURE__ */ C("p", {
410
+ children: [/* @__PURE__ */ S("p", {
406
411
  className: "text-xs text-text-secondary",
407
412
  children: "Visits"
408
- }), /* @__PURE__ */ C("p", {
413
+ }), /* @__PURE__ */ S("p", {
409
414
  className: "text-lg font-semibold text-text-primary",
410
415
  children: e.totalVisits
411
416
  })]
412
417
  }),
413
- /* @__PURE__ */ w("div", {
418
+ /* @__PURE__ */ C("div", {
414
419
  className: "rounded-md border border-border-subtle bg-bg-surface p-3",
415
- children: [/* @__PURE__ */ C("p", {
420
+ children: [/* @__PURE__ */ S("p", {
416
421
  className: "text-xs text-text-secondary",
417
422
  children: "Signups"
418
- }), /* @__PURE__ */ C("p", {
423
+ }), /* @__PURE__ */ S("p", {
419
424
  className: "text-lg font-semibold text-text-primary",
420
425
  children: e.totalSignups
421
426
  })]
422
427
  }),
423
- /* @__PURE__ */ w("div", {
428
+ /* @__PURE__ */ C("div", {
424
429
  className: "rounded-md border border-border-subtle bg-bg-surface p-3",
425
- children: [/* @__PURE__ */ C("p", {
430
+ children: [/* @__PURE__ */ S("p", {
426
431
  className: "text-xs text-text-secondary",
427
432
  children: "Paid conversions"
428
- }), /* @__PURE__ */ C("p", {
433
+ }), /* @__PURE__ */ S("p", {
429
434
  className: "text-lg font-semibold text-text-primary",
430
435
  children: e.totalPaidConversions + e.totalStorePurchases
431
436
  })]
432
437
  }),
433
- /* @__PURE__ */ w("div", {
438
+ /* @__PURE__ */ C("div", {
434
439
  className: "rounded-md border border-border-subtle bg-bg-surface p-3",
435
- children: [/* @__PURE__ */ C("p", {
440
+ children: [/* @__PURE__ */ S("p", {
436
441
  className: "text-xs text-text-secondary",
437
442
  children: "Rewards earned"
438
- }), /* @__PURE__ */ C("p", {
443
+ }), /* @__PURE__ */ S("p", {
439
444
  className: "text-lg font-semibold text-text-primary",
440
445
  children: c(e.totalRewardAmount, "USD")
441
446
  })]
442
447
  })
443
448
  ]
444
449
  }),
445
- e.notes ? /* @__PURE__ */ C("p", {
450
+ e.notes ? /* @__PURE__ */ S("p", {
446
451
  className: "mt-3 text-sm text-text-secondary",
447
452
  children: e.notes
448
453
  }) : null
@@ -450,19 +455,19 @@ var T = [
450
455
  }, e.id);
451
456
  })
452
457
  })]
453
- }), /* @__PURE__ */ w("div", {
458
+ }), /* @__PURE__ */ C("div", {
454
459
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
455
- children: [/* @__PURE__ */ C("h2", {
460
+ children: [/* @__PURE__ */ S("h2", {
456
461
  className: "mb-4 text-lg font-semibold text-text-primary",
457
462
  children: "Recent attributed journeys"
458
- }), R.length === 0 ? /* @__PURE__ */ C(x, {
463
+ }), B.length === 0 ? /* @__PURE__ */ S(y, {
459
464
  illustration: "empty-people",
460
465
  title: "No journeys yet",
461
466
  description: "Journeys will appear as visitors land on your affiliate links."
462
- }) : /* @__PURE__ */ C(ae, {
463
- data: R,
467
+ }) : /* @__PURE__ */ S(oe, {
468
+ data: B,
464
469
  rowKey: (e) => e.id,
465
- columns: T
470
+ columns: w
466
471
  })]
467
472
  })]
468
473
  })]
@@ -470,6 +475,6 @@ var T = [
470
475
  ]
471
476
  });
472
477
  };
473
- export { E as AffiliateDashboardPage };
478
+ export { T as AffiliateDashboardPage };
474
479
 
475
480
  //# sourceMappingURL=AffiliateDashboardPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AffiliateDashboardPage.js","names":["journeyColumns","journey","formatDateTime","AffiliateDashboardPage","permissions","useBillingPermissions","isFluidgrids","useIsFluidgridsVariant","codeToDeactivate","setCodeToDeactivate","useState","isDeactivating","setIsDeactivating","deactivateError","setDeactivateError","useBillingEventEmitter","useBilling","codes","setCodes","journeys","setJourneys","analytics","setAnalytics","loading","setLoading","error","setError","selectedCodeId","setSelectedCodeId","form","setForm","requestContext","useMemo","apiGatewayUrl","authToken","orgId","loadData","useCallback","loadedCodes","loadedAnalytics","loadedJourneys","fetchMyAffiliateCodes","fetchMyAffiliateAnalytics","fetchMyAffiliateJourneys","loadError","useEffect","AccessDenied","isServerError","ServerError","selectedCode","item","handleSubmit","updateAffiliateCode","emit","createdCode","createAffiliateCode","submitError","handleEdit","code","confirmDeactivate","handleDeactivate","err","deactivateAffiliateCode","codeId","handleQuickNote","note","addAffiliateCodeNote","metricCards","Ticket","Users","Link2","formatCurrency","TrendingUp","MoneyActionDialog","PageHeader","HeaderActions","RefreshCw","PagePurpose","EmphasisPanel","StatCard","card","Plus","current","event","IllustratedEmptyState","shareUrl","StickyNote","ResponsiveTable"],"sources":["../../../../../src/billing/modules/affiliate/pages/AffiliateDashboardPage.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState, type FC } from 'react';\nimport { Link2, Plus, RefreshCw, StickyNote, Ticket, TrendingUp, Users } from 'lucide-react';\nimport { ResponsiveTable, type ResponsiveTableColumn } from '@burdenoff/fe-libs/ui';\n\nimport { useBilling } from '../../../providers/BillingProvider';\nimport { useBillingEventEmitter } from '../../../hooks/useBillingEventEmitter';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport { useIsFluidgridsVariant } from '../../../hooks/useBillingVariant';\nimport { MoneyActionDialog } from '../../../shared/components';\nimport {\n AccessDenied,\n HeaderActions,\n PageHeader,\n ServerError,\n StatCard,\n} from '../../../shared/components';\nimport { PagePurpose, EmphasisPanel, IllustratedEmptyState } from '@burdenoff/fe-libs/ui';\nimport { formatCurrency, formatDateTime, isServerError } from '../../../shared/utils';\n\nconst journeyColumns: ResponsiveTableColumn<AffiliateJourney>[] = [\n { key: 'code', header: 'Code', priority: 'primary', cell: (journey) => journey.codeValue },\n { key: 'product', header: 'Product', cell: (journey) => journey.productSlug },\n {\n key: 'path',\n header: 'Path',\n cell: (journey) => journey.currentPath || journey.landingPath || '-',\n },\n { key: 'country', header: 'Country', cell: (journey) => journey.geographyCountry || '-' },\n { key: 'status', header: 'Status', cell: (journey) => journey.status },\n {\n key: 'visited',\n header: 'Visited',\n cell: (journey) => formatDateTime(journey.lastVisitedAt),\n },\n];\nimport {\n addAffiliateCodeNote,\n createAffiliateCode,\n deactivateAffiliateCode,\n fetchMyAffiliateAnalytics,\n fetchMyAffiliateCodes,\n fetchMyAffiliateJourneys,\n updateAffiliateCode,\n type AffiliateCode,\n type AffiliateJourney,\n type AffiliateAnalyticsSummary,\n} from '../api';\n\nexport const AffiliateDashboardPage: FC = () => {\n const permissions = useBillingPermissions();\n const isFluidgrids = useIsFluidgridsVariant();\n const [codeToDeactivate, setCodeToDeactivate] = useState<{ id: string; label: string } | null>(\n null\n );\n const [isDeactivating, setIsDeactivating] = useState(false);\n const [deactivateError, setDeactivateError] = useState<string | null>(null);\n const { emit } = useBillingEventEmitter();\n const { apiGatewayUrl, authToken, orgId } = useBilling();\n\n const [codes, setCodes] = useState<AffiliateCode[]>([]);\n const [journeys, setJourneys] = useState<AffiliateJourney[]>([]);\n const [analytics, setAnalytics] = useState<AffiliateAnalyticsSummary | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n const [selectedCodeId, setSelectedCodeId] = useState<string | null>(null);\n const [form, setForm] = useState({\n label: '',\n description: '',\n notes: '',\n productSlug: '',\n destinationPath: '',\n destinationUrl: '',\n });\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 const [loadedCodes, loadedAnalytics, loadedJourneys] = await Promise.all([\n fetchMyAffiliateCodes(requestContext),\n fetchMyAffiliateAnalytics(requestContext),\n fetchMyAffiliateJourneys(requestContext),\n ]);\n setCodes(loadedCodes);\n setAnalytics(loadedAnalytics);\n setJourneys(loadedJourneys);\n } catch (loadError) {\n setError(\n loadError instanceof Error ? loadError : new Error('Failed to load affiliate dashboard')\n );\n } finally {\n setLoading(false);\n }\n }, [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 affiliate analytics.\" />;\n }\n\n if (error && isServerError(error)) {\n return (\n <ServerError\n title=\"Affiliate service unavailable\"\n message={error.message}\n onRetry={() => void loadData()}\n showRetry\n />\n );\n }\n\n const selectedCode = codes.find((item) => item.id === selectedCodeId) ?? null;\n\n const handleSubmit = async () => {\n if (!form.productSlug.trim()) {\n setError(new Error('Product slug is required'));\n return;\n }\n\n try {\n if (selectedCode) {\n await updateAffiliateCode(\n selectedCode.id,\n {\n label: form.label,\n description: form.description,\n notes: form.notes,\n destinationPath: form.destinationPath,\n destinationUrl: form.destinationUrl,\n },\n requestContext\n );\n emit('billing.affiliate_code.updated', {\n route: '/billing/affiliate',\n entityId: selectedCode.id,\n source: 'affiliate-dashboard',\n });\n } else {\n const createdCode = await createAffiliateCode(\n {\n label: form.label,\n description: form.description,\n notes: form.notes,\n productSlug: form.productSlug,\n destinationPath: form.destinationPath,\n destinationUrl: form.destinationUrl,\n },\n requestContext\n );\n emit('billing.affiliate_code.created', {\n route: '/billing/affiliate',\n entityId: createdCode.id,\n source: 'affiliate-dashboard',\n });\n }\n\n setSelectedCodeId(null);\n setForm({\n label: '',\n description: '',\n notes: '',\n productSlug: '',\n destinationPath: '',\n destinationUrl: '',\n });\n await loadData();\n } catch (submitError) {\n setError(\n submitError instanceof Error ? submitError : new Error('Failed to save affiliate code')\n );\n }\n };\n\n const handleEdit = (code: AffiliateCode) => {\n setSelectedCodeId(code.id);\n setForm({\n label: code.label ?? '',\n description: code.description ?? '',\n notes: code.notes ?? '',\n productSlug: code.productSlug,\n destinationPath: code.destinationPath ?? '',\n destinationUrl: code.destinationUrl ?? '',\n });\n };\n\n const confirmDeactivate = async () => {\n if (!codeToDeactivate) return;\n setIsDeactivating(true);\n setDeactivateError(null);\n try {\n await handleDeactivate(codeToDeactivate.id);\n setCodeToDeactivate(null);\n } catch (err) {\n setDeactivateError(err instanceof Error ? err.message : 'Could not deactivate this code.');\n } finally {\n setIsDeactivating(false);\n }\n };\n\n const handleDeactivate = async (codeId: string) => {\n await deactivateAffiliateCode(codeId, requestContext);\n emit('billing.affiliate_code.deactivated', {\n route: '/billing/affiliate',\n entityId: codeId,\n source: 'affiliate-dashboard',\n });\n await loadData();\n };\n\n const handleQuickNote = async (codeId: string) => {\n const note = window.prompt('Add an internal note for this affiliate code');\n if (!note) return;\n await addAffiliateCodeNote(codeId, note, requestContext);\n emit('billing.affiliate_code.note_added', {\n route: '/billing/affiliate',\n entityId: codeId,\n source: 'affiliate-dashboard',\n });\n await loadData();\n };\n\n const metricCards = analytics\n ? [\n { title: 'Codes', value: analytics.totalCodes, icon: <Ticket className=\"size-5\" /> },\n { title: 'Visits', value: analytics.totalVisits, icon: <Users className=\"size-5\" /> },\n { title: 'Journeys', value: analytics.totalJourneys, icon: <Link2 className=\"size-5\" /> },\n {\n title: 'Revenue influenced',\n value: formatCurrency(analytics.totalRevenueAmount, 'USD'),\n icon: <TrendingUp className=\"size-5\" />,\n },\n ]\n : [];\n\n return (\n <div className=\"space-y-6 p-6\">\n {isFluidgrids && (\n <MoneyActionDialog\n open={codeToDeactivate !== null}\n tone=\"danger\"\n title=\"Deactivate this affiliate code?\"\n description=\"The code stops tracking new visits straight away. Visits and journeys already recorded are kept.\"\n details={[{ label: 'Code', value: codeToDeactivate?.label ?? '' }]}\n confirmLabel=\"Deactivate code\"\n busyLabel=\"Deactivating…\"\n isBusy={isDeactivating}\n error={deactivateError}\n onConfirm={() => void confirmDeactivate()}\n onCancel={() => setCodeToDeactivate(null)}\n />\n )}\n <PageHeader\n title=\"Affiliate codes\"\n description=\"Create referral codes, add internal notes, and monitor attributed journeys.\"\n actions={\n <HeaderActions\n actions={[\n {\n label: 'Refresh',\n onSelect: () => void loadData(),\n icon: <RefreshCw className=\"size-4\" />,\n },\n ]}\n />\n }\n />\n\n <PagePurpose>\n Generate referral links for any product, share them, and see exactly what they drive —\n visits, signups, paid conversions and the rewards you have earned. Create and manage your\n codes on the left and watch attributed visitor journeys on the right.\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 ) : analytics ? (\n <EmphasisPanel className=\"p-4 sm:p-5\">\n <div className=\"grid gap-4 md:grid-cols-2 xl:grid-cols-4\">\n {metricCards.map((card) => (\n <StatCard key={card.title} label={card.title} value={card.value} icon={card.icon} />\n ))}\n </div>\n </EmphasisPanel>\n ) : null}\n\n {error && !isServerError(error) ? (\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 ) : null}\n\n <div className=\"grid gap-6 xl:grid-cols-[1.1fr,1.9fr]\">\n <section className=\"rounded-lg border border-border-seam bg-bg-surface p-4 xl:sticky xl:top-6 xl:self-start\">\n <div className=\"mb-4 flex items-center justify-between\">\n <h2 className=\"text-lg font-semibold text-text-primary\">\n {selectedCode ? 'Update affiliate code' : 'Create affiliate code'}\n </h2>\n {!selectedCode ? <Plus className=\"size-4 text-text-secondary\" /> : null}\n </div>\n\n <div className=\"space-y-3\">\n <input\n value={form.label}\n onChange={(event) =>\n setForm((current) => ({ ...current, label: event.target.value }))\n }\n placeholder=\"Label\"\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n <input\n value={form.productSlug}\n onChange={(event) =>\n setForm((current) => ({ ...current, productSlug: event.target.value }))\n }\n placeholder=\"Product slug (eg. bigconsole)\"\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n disabled={Boolean(selectedCode)}\n />\n <input\n value={form.destinationPath}\n onChange={(event) =>\n setForm((current) => ({ ...current, destinationPath: event.target.value }))\n }\n placeholder=\"Destination path (eg. /pricing)\"\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n <input\n value={form.destinationUrl}\n onChange={(event) =>\n setForm((current) => ({ ...current, destinationUrl: event.target.value }))\n }\n placeholder=\"Absolute destination URL (optional)\"\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n <textarea\n value={form.description}\n onChange={(event) =>\n setForm((current) => ({ ...current, description: event.target.value }))\n }\n placeholder=\"Description\"\n className=\"min-h-24 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n <textarea\n value={form.notes}\n onChange={(event) =>\n setForm((current) => ({ ...current, notes: event.target.value }))\n }\n placeholder=\"Internal notes\"\n className=\"min-h-24 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n </div>\n\n <div className=\"mt-4 flex flex-wrap gap-3\">\n <button\n type=\"button\"\n onClick={() => void handleSubmit()}\n className=\"rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text\"\n >\n {selectedCode ? 'Save changes' : 'Create code'}\n </button>\n {selectedCode ? (\n <button\n type=\"button\"\n onClick={() => {\n setSelectedCodeId(null);\n setForm({\n label: '',\n description: '',\n notes: '',\n productSlug: '',\n destinationPath: '',\n destinationUrl: '',\n });\n }}\n className=\"rounded-md border border-border-subtle bg-bg-surface px-4 py-2 text-sm font-medium text-text-primary\"\n >\n Cancel\n </button>\n ) : null}\n </div>\n </section>\n\n <section className=\"space-y-4\">\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <h2 className=\"mb-4 text-lg font-semibold text-text-primary\">My codes</h2>\n {codes.length === 0 && !loading ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No affiliate codes yet\"\n description=\"Create your first code to start tracking attributable journeys.\"\n />\n ) : (\n <div className=\"space-y-4\">\n {codes.map((code) => {\n const shareUrl =\n code.destinationUrl ||\n `https://${code.productSlug}.com${code.destinationPath || ''}?ref=${code.code}`;\n return (\n <div\n key={code.id}\n className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\"\n >\n <div className=\"flex flex-wrap items-start justify-between gap-4\">\n <div>\n <p className=\"text-sm font-semibold text-text-primary\">\n {code.label || code.code}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {code.code} · {code.productSlug}\n </p>\n <p className=\"mt-1 break-all text-xs text-text-secondary\">{shareUrl}</p>\n </div>\n <div className=\"flex flex-wrap gap-2\">\n <button\n type=\"button\"\n onClick={() => handleEdit(code)}\n className=\"rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary\"\n >\n Edit\n </button>\n <button\n type=\"button\"\n onClick={() => void handleQuickNote(code.id)}\n className=\"inline-flex items-center gap-1 rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary\"\n >\n <StickyNote className=\"size-3.5\" />\n Note\n </button>\n {code.status === 'ACTIVE' ? (\n <button\n type=\"button\"\n onClick={() =>\n isFluidgrids\n ? (setDeactivateError(null),\n setCodeToDeactivate({\n id: code.id,\n label: code.label || code.code,\n }))\n : void handleDeactivate(code.id)\n }\n className=\"rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-status-error-text\"\n >\n Deactivate\n </button>\n ) : null}\n </div>\n </div>\n <div className=\"mt-4 grid gap-3 sm:grid-cols-2 xl:grid-cols-4\">\n <div className=\"rounded-md border border-border-subtle bg-bg-surface p-3\">\n <p className=\"text-xs text-text-secondary\">Visits</p>\n <p className=\"text-lg font-semibold text-text-primary\">\n {code.totalVisits}\n </p>\n </div>\n <div className=\"rounded-md border border-border-subtle bg-bg-surface p-3\">\n <p className=\"text-xs text-text-secondary\">Signups</p>\n <p className=\"text-lg font-semibold text-text-primary\">\n {code.totalSignups}\n </p>\n </div>\n <div className=\"rounded-md border border-border-subtle bg-bg-surface p-3\">\n <p className=\"text-xs text-text-secondary\">Paid conversions</p>\n <p className=\"text-lg font-semibold text-text-primary\">\n {code.totalPaidConversions + code.totalStorePurchases}\n </p>\n </div>\n <div className=\"rounded-md border border-border-subtle bg-bg-surface p-3\">\n <p className=\"text-xs text-text-secondary\">Rewards earned</p>\n <p className=\"text-lg font-semibold text-text-primary\">\n {formatCurrency(code.totalRewardAmount, 'USD')}\n </p>\n </div>\n </div>\n {code.notes ? (\n <p className=\"mt-3 text-sm text-text-secondary\">{code.notes}</p>\n ) : null}\n </div>\n );\n })}\n </div>\n )}\n </div>\n\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <h2 className=\"mb-4 text-lg font-semibold text-text-primary\">\n Recent attributed journeys\n </h2>\n {journeys.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-people\"\n title=\"No journeys yet\"\n description=\"Journeys will appear as visitors land on your affiliate links.\"\n />\n ) : (\n <ResponsiveTable\n data={journeys}\n rowKey={(journey) => journey.id}\n columns={journeyColumns}\n />\n )}\n </div>\n </section>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmBA,IAAMA,IAA4D;CAChE;EAAE,KAAK;EAAQ,QAAQ;EAAQ,UAAU;EAAW,OAAO,MAAYC,EAAQ;CAAU;CACzF;EAAE,KAAK;EAAW,QAAQ;EAAW,OAAO,MAAYA,EAAQ;CAAY;CAC5E;EACE,KAAK;EACL,QAAQ;EACR,OAAO,MAAYA,EAAQ,eAAeA,EAAQ,eAAe;CACnE;CACA;EAAE,KAAK;EAAW,QAAQ;EAAW,OAAO,MAAYA,EAAQ,oBAAoB;CAAI;CACxF;EAAE,KAAK;EAAU,QAAQ;EAAU,OAAO,MAAYA,EAAQ;CAAO;CACrE;EACE,KAAK;EACL,QAAQ;EACR,OAAO,MAAYC,EAAeD,EAAQ,aAAa;CACzD;AACF,GAcaE,UAAmC;CAC9C,IAAMC,IAAcC,EAAsB,GACpCC,IAAeC,EAAuB,GACtC,CAACC,GAAkBC,KAAuBC,EAC9C,IACF,GACM,CAACC,GAAgBC,KAAqBF,EAAS,EAAK,GACpD,CAACG,GAAiBC,KAAsBJ,EAAwB,IAAI,GACpE,EAAE,YAASK,GAAuB,GAClC,EAAE,kBAAe,cAAW,aAAUC,EAAW,GAEjD,CAACC,GAAOC,MAAYR,EAA0B,CAAC,CAAC,GAChD,CAACS,GAAUC,KAAeV,EAA6B,CAAC,CAAC,GACzD,CAACW,GAAW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,WAAU;aAAf,UAAA,CACE,kBAAC,KAAD;cAAG,WAAU;cAA8B,UAAA;aAAS,CAAA,GACpD,kBAAC,KAAD;cAAG,WAAU;cACV,UAAAA,EAAK;aACL,CAAA,CACA;;YACL,kBAAC,OAAD;aAAK,WAAU;aAAf,UAAA,CACE,kBAAC,KAAD;cAAG,WAAU;cAA8B,UAAA;aAAU,CAAA,GACrD,kBAAC,KAAD;cAAG,WAAU;cACV,UAAAA,EAAK;aACL,CAAA,CACA;;YACL,kBAAC,OAAD;aAAK,WAAU;aAAf,UAAA,CACE,kBAAC,KAAD;cAAG,WAAU;cAA8B,UAAA;aAAmB,CAAA,GAC9D,kBAAC,KAAD;cAAG,WAAU;cACV,UAAAA,EAAK,uBAAuBA,EAAK;aACjC,CAAA,CACA;;YACL,kBAAC,OAAD;aAAK,WAAU;aAAf,UAAA,CACE,kBAAC,KAAD;cAAG,WAAU;cAA8B,UAAA;aAAiB,CAAA,GAC5D,kBAAC,KAAD;cAAG,WAAU;cACV,UAAAa,EAAeb,EAAK,mBAAmB,KAAK;aAC5C,CAAA,CACA;;WACF;;UACJA,EAAK,QACJ,kBAAC,KAAD;WAAG,WAAU;WAAoC,UAAAA,EAAK;UAAS,CAAA,IAC7D;SACD;QA7EE,GAAAA,EAAK,EA6EP;OAET,CAAC;MACE,CAAA,CAEJ;KAEL,CAAA,GAAA,kBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACE,kBAAC,MAAD;OAAI,WAAU;OAA+C,UAAA;MAEzD,CAAA,GACHvC,EAAS,WAAW,IACnB,kBAACiE,GAAD;OACE,cAAa;OACb,OAAM;OACN,aAAY;MACb,CAAA,IAED,kBAACG,IAAD;OACE,MAAMpE;OACN,SAAS,MAAYlB,EAAQ;OAC7B,SAASD;MACV,CAAA,CAEA;KACE,CAAA,CAAA;IACN,CAAA,CAAA;;EACF;;AAET"}
1
+ {"version":3,"file":"AffiliateDashboardPage.js","names":["journeyColumns","journey","formatDateTime","AffiliateDashboardPage","permissions","useBillingPermissions","isFluidgrids","useIsFluidgridsVariant","codeToDeactivate","setCodeToDeactivate","useState","isDeactivating","setIsDeactivating","deactivateError","setDeactivateError","deactivatedLabel","setDeactivatedLabel","useBillingEventEmitter","useBilling","codes","setCodes","journeys","setJourneys","analytics","setAnalytics","loading","setLoading","error","setError","selectedCodeId","setSelectedCodeId","form","setForm","requestContext","useMemo","apiGatewayUrl","authToken","orgId","loadData","useCallback","loadedCodes","loadedAnalytics","loadedJourneys","fetchMyAffiliateCodes","fetchMyAffiliateAnalytics","fetchMyAffiliateJourneys","loadError","useEffect","AccessDenied","isServerError","ServerError","selectedCode","item","handleSubmit","updateAffiliateCode","emit","createdCode","createAffiliateCode","submitError","handleEdit","code","confirmDeactivate","handleDeactivate","err","deactivateAffiliateCode","codeId","handleQuickNote","note","addAffiliateCodeNote","metricCards","Ticket","Users","Link2","formatCurrency","TrendingUp","MoneyActionDialog","PageHeader","HeaderActions","RefreshCw","PagePurpose","EmphasisPanel","StatCard","card","Plus","current","event","IllustratedEmptyState","shareUrl","StickyNote","ResponsiveTable"],"sources":["../../../../../src/billing/modules/affiliate/pages/AffiliateDashboardPage.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState, type FC } from 'react';\nimport { Link2, Plus, RefreshCw, StickyNote, Ticket, TrendingUp, Users } from 'lucide-react';\nimport { ResponsiveTable, type ResponsiveTableColumn } from '@burdenoff/fe-libs/ui';\n\nimport { useBilling } from '../../../providers/BillingProvider';\nimport { useBillingEventEmitter } from '../../../hooks/useBillingEventEmitter';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport { useIsFluidgridsVariant } from '../../../hooks/useBillingVariant';\nimport { MoneyActionDialog } from '../../../shared/components';\nimport {\n AccessDenied,\n HeaderActions,\n PageHeader,\n ServerError,\n StatCard,\n} from '../../../shared/components';\nimport { PagePurpose, EmphasisPanel, IllustratedEmptyState } from '@burdenoff/fe-libs/ui';\nimport { formatCurrency, formatDateTime, isServerError } from '../../../shared/utils';\n\nconst journeyColumns: ResponsiveTableColumn<AffiliateJourney>[] = [\n { key: 'code', header: 'Code', priority: 'primary', cell: (journey) => journey.codeValue },\n { key: 'product', header: 'Product', cell: (journey) => journey.productSlug },\n {\n key: 'path',\n header: 'Path',\n cell: (journey) => journey.currentPath || journey.landingPath || '-',\n },\n { key: 'country', header: 'Country', cell: (journey) => journey.geographyCountry || '-' },\n { key: 'status', header: 'Status', cell: (journey) => journey.status },\n {\n key: 'visited',\n header: 'Visited',\n cell: (journey) => formatDateTime(journey.lastVisitedAt),\n },\n];\nimport {\n addAffiliateCodeNote,\n createAffiliateCode,\n deactivateAffiliateCode,\n fetchMyAffiliateAnalytics,\n fetchMyAffiliateCodes,\n fetchMyAffiliateJourneys,\n updateAffiliateCode,\n type AffiliateCode,\n type AffiliateJourney,\n type AffiliateAnalyticsSummary,\n} from '../api';\n\nexport const AffiliateDashboardPage: FC = () => {\n const permissions = useBillingPermissions();\n const isFluidgrids = useIsFluidgridsVariant();\n const [codeToDeactivate, setCodeToDeactivate] = useState<{ id: string; label: string } | null>(\n null\n );\n const [isDeactivating, setIsDeactivating] = useState(false);\n const [deactivateError, setDeactivateError] = useState<string | null>(null);\n const [deactivatedLabel, setDeactivatedLabel] = useState<string | null>(null);\n const { emit } = useBillingEventEmitter();\n const { apiGatewayUrl, authToken, orgId } = useBilling();\n\n const [codes, setCodes] = useState<AffiliateCode[]>([]);\n const [journeys, setJourneys] = useState<AffiliateJourney[]>([]);\n const [analytics, setAnalytics] = useState<AffiliateAnalyticsSummary | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n const [selectedCodeId, setSelectedCodeId] = useState<string | null>(null);\n const [form, setForm] = useState({\n label: '',\n description: '',\n notes: '',\n productSlug: '',\n destinationPath: '',\n destinationUrl: '',\n });\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 const [loadedCodes, loadedAnalytics, loadedJourneys] = await Promise.all([\n fetchMyAffiliateCodes(requestContext),\n fetchMyAffiliateAnalytics(requestContext),\n fetchMyAffiliateJourneys(requestContext),\n ]);\n setCodes(loadedCodes);\n setAnalytics(loadedAnalytics);\n setJourneys(loadedJourneys);\n } catch (loadError) {\n setError(\n loadError instanceof Error ? loadError : new Error('Failed to load affiliate dashboard')\n );\n } finally {\n setLoading(false);\n }\n }, [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 affiliate analytics.\" />;\n }\n\n if (error && isServerError(error)) {\n return (\n <ServerError\n title=\"Affiliate service unavailable\"\n message={error.message}\n onRetry={() => void loadData()}\n showRetry\n />\n );\n }\n\n const selectedCode = codes.find((item) => item.id === selectedCodeId) ?? null;\n\n const handleSubmit = async () => {\n if (!form.productSlug.trim()) {\n setError(new Error('Product slug is required'));\n return;\n }\n\n try {\n if (selectedCode) {\n await updateAffiliateCode(\n selectedCode.id,\n {\n label: form.label,\n description: form.description,\n notes: form.notes,\n destinationPath: form.destinationPath,\n destinationUrl: form.destinationUrl,\n },\n requestContext\n );\n emit('billing.affiliate_code.updated', {\n route: '/billing/affiliate',\n entityId: selectedCode.id,\n source: 'affiliate-dashboard',\n });\n } else {\n const createdCode = await createAffiliateCode(\n {\n label: form.label,\n description: form.description,\n notes: form.notes,\n productSlug: form.productSlug,\n destinationPath: form.destinationPath,\n destinationUrl: form.destinationUrl,\n },\n requestContext\n );\n emit('billing.affiliate_code.created', {\n route: '/billing/affiliate',\n entityId: createdCode.id,\n source: 'affiliate-dashboard',\n });\n }\n\n setSelectedCodeId(null);\n setForm({\n label: '',\n description: '',\n notes: '',\n productSlug: '',\n destinationPath: '',\n destinationUrl: '',\n });\n await loadData();\n } catch (submitError) {\n setError(\n submitError instanceof Error ? submitError : new Error('Failed to save affiliate code')\n );\n }\n };\n\n const handleEdit = (code: AffiliateCode) => {\n setSelectedCodeId(code.id);\n setForm({\n label: code.label ?? '',\n description: code.description ?? '',\n notes: code.notes ?? '',\n productSlug: code.productSlug,\n destinationPath: code.destinationPath ?? '',\n destinationUrl: code.destinationUrl ?? '',\n });\n };\n\n const confirmDeactivate = async () => {\n if (!codeToDeactivate) return;\n setIsDeactivating(true);\n setDeactivateError(null);\n try {\n await handleDeactivate(codeToDeactivate.id);\n setDeactivatedLabel(codeToDeactivate.label);\n setCodeToDeactivate(null);\n } catch (err) {\n setDeactivateError(err instanceof Error ? err.message : 'Could not deactivate this code.');\n } finally {\n setIsDeactivating(false);\n }\n };\n\n const handleDeactivate = async (codeId: string) => {\n await deactivateAffiliateCode(codeId, requestContext);\n emit('billing.affiliate_code.deactivated', {\n route: '/billing/affiliate',\n entityId: codeId,\n source: 'affiliate-dashboard',\n });\n await loadData();\n };\n\n const handleQuickNote = async (codeId: string) => {\n const note = window.prompt('Add an internal note for this affiliate code');\n if (!note) return;\n await addAffiliateCodeNote(codeId, note, requestContext);\n emit('billing.affiliate_code.note_added', {\n route: '/billing/affiliate',\n entityId: codeId,\n source: 'affiliate-dashboard',\n });\n await loadData();\n };\n\n const metricCards = analytics\n ? [\n { title: 'Codes', value: analytics.totalCodes, icon: <Ticket className=\"size-5\" /> },\n { title: 'Visits', value: analytics.totalVisits, icon: <Users className=\"size-5\" /> },\n { title: 'Journeys', value: analytics.totalJourneys, icon: <Link2 className=\"size-5\" /> },\n {\n title: 'Revenue influenced',\n value: formatCurrency(analytics.totalRevenueAmount, 'USD'),\n icon: <TrendingUp className=\"size-5\" />,\n },\n ]\n : [];\n\n return (\n <div className=\"space-y-6 p-6\">\n {isFluidgrids && deactivatedLabel ? (\n <div\n role=\"status\"\n className=\"rounded-lg border border-border-subtle bg-status-info-bg-subtle p-4 text-sm text-status-info-text\"\n >\n {`\"${deactivatedLabel}\" was deactivated.`}\n </div>\n ) : null}\n {isFluidgrids && (\n <MoneyActionDialog\n open={codeToDeactivate !== null}\n tone=\"danger\"\n title=\"Deactivate this affiliate code?\"\n description=\"The code stops tracking new visits straight away. Visits and journeys already recorded are kept.\"\n details={[{ label: 'Code', value: codeToDeactivate?.label ?? '' }]}\n confirmLabel=\"Deactivate code\"\n busyLabel=\"Deactivating…\"\n isBusy={isDeactivating}\n error={deactivateError}\n onConfirm={() => void confirmDeactivate()}\n onCancel={() => setCodeToDeactivate(null)}\n />\n )}\n <PageHeader\n title=\"Affiliate codes\"\n description=\"Create referral codes, add internal notes, and monitor attributed journeys.\"\n actions={\n <HeaderActions\n actions={[\n {\n label: 'Refresh',\n onSelect: () => void loadData(),\n icon: <RefreshCw className=\"size-4\" />,\n },\n ]}\n />\n }\n />\n\n <PagePurpose>\n Generate referral links for any product, share them, and see exactly what they drive —\n visits, signups, paid conversions and the rewards you have earned. Create and manage your\n codes on the left and watch attributed visitor journeys on the right.\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 ) : analytics ? (\n <EmphasisPanel className=\"p-4 sm:p-5\">\n <div className=\"grid gap-4 md:grid-cols-2 xl:grid-cols-4\">\n {metricCards.map((card) => (\n <StatCard key={card.title} label={card.title} value={card.value} icon={card.icon} />\n ))}\n </div>\n </EmphasisPanel>\n ) : null}\n\n {error && !isServerError(error) ? (\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 ) : null}\n\n <div className=\"grid gap-6 xl:grid-cols-[1.1fr,1.9fr]\">\n <section className=\"rounded-lg border border-border-seam bg-bg-surface p-4 xl:sticky xl:top-6 xl:self-start\">\n <div className=\"mb-4 flex items-center justify-between\">\n <h2 className=\"text-lg font-semibold text-text-primary\">\n {selectedCode ? 'Update affiliate code' : 'Create affiliate code'}\n </h2>\n {!selectedCode ? <Plus className=\"size-4 text-text-secondary\" /> : null}\n </div>\n\n <div className=\"space-y-3\">\n <input\n value={form.label}\n onChange={(event) =>\n setForm((current) => ({ ...current, label: event.target.value }))\n }\n placeholder=\"Label\"\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n <input\n value={form.productSlug}\n onChange={(event) =>\n setForm((current) => ({ ...current, productSlug: event.target.value }))\n }\n placeholder=\"Product slug (eg. bigconsole)\"\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n disabled={Boolean(selectedCode)}\n />\n <input\n value={form.destinationPath}\n onChange={(event) =>\n setForm((current) => ({ ...current, destinationPath: event.target.value }))\n }\n placeholder=\"Destination path (eg. /pricing)\"\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n <input\n value={form.destinationUrl}\n onChange={(event) =>\n setForm((current) => ({ ...current, destinationUrl: event.target.value }))\n }\n placeholder=\"Absolute destination URL (optional)\"\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n <textarea\n value={form.description}\n onChange={(event) =>\n setForm((current) => ({ ...current, description: event.target.value }))\n }\n placeholder=\"Description\"\n className=\"min-h-24 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n <textarea\n value={form.notes}\n onChange={(event) =>\n setForm((current) => ({ ...current, notes: event.target.value }))\n }\n placeholder=\"Internal notes\"\n className=\"min-h-24 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n </div>\n\n <div className=\"mt-4 flex flex-wrap gap-3\">\n <button\n type=\"button\"\n onClick={() => void handleSubmit()}\n className=\"rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text\"\n >\n {selectedCode ? 'Save changes' : 'Create code'}\n </button>\n {selectedCode ? (\n <button\n type=\"button\"\n onClick={() => {\n setSelectedCodeId(null);\n setForm({\n label: '',\n description: '',\n notes: '',\n productSlug: '',\n destinationPath: '',\n destinationUrl: '',\n });\n }}\n className=\"rounded-md border border-border-subtle bg-bg-surface px-4 py-2 text-sm font-medium text-text-primary\"\n >\n Cancel\n </button>\n ) : null}\n </div>\n </section>\n\n <section className=\"space-y-4\">\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <h2 className=\"mb-4 text-lg font-semibold text-text-primary\">My codes</h2>\n {codes.length === 0 && !loading ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No affiliate codes yet\"\n description=\"Create your first code to start tracking attributable journeys.\"\n />\n ) : (\n <div className=\"space-y-4\">\n {codes.map((code) => {\n const shareUrl =\n code.destinationUrl ||\n `https://${code.productSlug}.com${code.destinationPath || ''}?ref=${code.code}`;\n return (\n <div\n key={code.id}\n className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\"\n >\n <div className=\"flex flex-wrap items-start justify-between gap-4\">\n <div>\n <p className=\"text-sm font-semibold text-text-primary\">\n {code.label || code.code}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {code.code} · {code.productSlug}\n </p>\n <p className=\"mt-1 break-all text-xs text-text-secondary\">{shareUrl}</p>\n </div>\n <div className=\"flex flex-wrap gap-2\">\n <button\n type=\"button\"\n onClick={() => handleEdit(code)}\n className=\"rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary\"\n >\n Edit\n </button>\n <button\n type=\"button\"\n onClick={() => void handleQuickNote(code.id)}\n className=\"inline-flex items-center gap-1 rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary\"\n >\n <StickyNote className=\"size-3.5\" />\n Note\n </button>\n {code.status === 'ACTIVE' ? (\n <button\n type=\"button\"\n onClick={() =>\n isFluidgrids\n ? (setDeactivateError(null),\n setCodeToDeactivate({\n id: code.id,\n label: code.label || code.code,\n }))\n : void handleDeactivate(code.id)\n }\n className=\"rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-status-error-text\"\n >\n Deactivate\n </button>\n ) : null}\n </div>\n </div>\n <div className=\"mt-4 grid gap-3 sm:grid-cols-2 xl:grid-cols-4\">\n <div className=\"rounded-md border border-border-subtle bg-bg-surface p-3\">\n <p className=\"text-xs text-text-secondary\">Visits</p>\n <p className=\"text-lg font-semibold text-text-primary\">\n {code.totalVisits}\n </p>\n </div>\n <div className=\"rounded-md border border-border-subtle bg-bg-surface p-3\">\n <p className=\"text-xs text-text-secondary\">Signups</p>\n <p className=\"text-lg font-semibold text-text-primary\">\n {code.totalSignups}\n </p>\n </div>\n <div className=\"rounded-md border border-border-subtle bg-bg-surface p-3\">\n <p className=\"text-xs text-text-secondary\">Paid conversions</p>\n <p className=\"text-lg font-semibold text-text-primary\">\n {code.totalPaidConversions + code.totalStorePurchases}\n </p>\n </div>\n <div className=\"rounded-md border border-border-subtle bg-bg-surface p-3\">\n <p className=\"text-xs text-text-secondary\">Rewards earned</p>\n <p className=\"text-lg font-semibold text-text-primary\">\n {formatCurrency(code.totalRewardAmount, 'USD')}\n </p>\n </div>\n </div>\n {code.notes ? (\n <p className=\"mt-3 text-sm text-text-secondary\">{code.notes}</p>\n ) : null}\n </div>\n );\n })}\n </div>\n )}\n </div>\n\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <h2 className=\"mb-4 text-lg font-semibold text-text-primary\">\n Recent attributed journeys\n </h2>\n {journeys.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-people\"\n title=\"No journeys yet\"\n description=\"Journeys will appear as visitors land on your affiliate links.\"\n />\n ) : (\n <ResponsiveTable\n data={journeys}\n rowKey={(journey) => journey.id}\n columns={journeyColumns}\n />\n )}\n </div>\n </section>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmBA,IAAMA,IAA4D;CAChE;EAAE,KAAK;EAAQ,QAAQ;EAAQ,UAAU;EAAW,OAAO,MAAYC,EAAQ;CA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AAf,UAAA,CACE,kBAAC,KAAD;cAAG,WAAU;cAA8B,UAAA;aAAmB,CAAA,GAC9D,kBAAC,KAAD;cAAG,WAAU;cACV,UAAAA,EAAK,uBAAuBA,EAAK;aACjC,CAAA,CACA;;YACL,kBAAC,OAAD;aAAK,WAAU;aAAf,UAAA,CACE,kBAAC,KAAD;cAAG,WAAU;cAA8B,UAAA;aAAiB,CAAA,GAC5D,kBAAC,KAAD;cAAG,WAAU;cACV,UAAAa,EAAeb,EAAK,mBAAmB,KAAK;aAC5C,CAAA,CACA;;WACF;;UACJA,EAAK,QACJ,kBAAC,KAAD;WAAG,WAAU;WAAoC,UAAAA,EAAK;UAAS,CAAA,IAC7D;SACD;QA7EE,GAAAA,EAAK,EA6EP;OAET,CAAC;MACE,CAAA,CAEJ;KAEL,CAAA,GAAA,kBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACE,kBAAC,MAAD;OAAI,WAAU;OAA+C,UAAA;MAEzD,CAAA,GACHvC,EAAS,WAAW,IACnB,kBAACiE,GAAD;OACE,cAAa;OACb,OAAM;OACN,aAAY;MACb,CAAA,IAED,kBAACG,IAAD;OACE,MAAMpE;OACN,SAAS,MAAYpB,EAAQ;OAC7B,SAASD;MACV,CAAA,CAEA;KACE,CAAA,CAAA;IACN,CAAA,CAAA;;EACF;;AAET"}
@@ -424,7 +424,7 @@ var Fe = [
424
424
  className: "mb-4 flex items-center justify-between",
425
425
  children: [/* @__PURE__ */ m("h2", {
426
426
  className: "text-lg font-semibold text-text-primary",
427
- children: "Request payout"
427
+ children: g ? "Withdrawals" : "Request payout"
428
428
  }), /* @__PURE__ */ h("button", {
429
429
  type: "button",
430
430
  onClick: () => void X(),
@@ -432,7 +432,11 @@ var Fe = [
432
432
  children: [/* @__PURE__ */ m(Ne, { className: "size-4" }), "Refresh"]
433
433
  })]
434
434
  }),
435
- M.length === 0 && !P ? /* @__PURE__ */ m(d, {
435
+ g ? /* @__PURE__ */ h("div", {
436
+ className: "space-y-2 text-sm text-text-secondary",
437
+ role: "note",
438
+ children: [/* @__PURE__ */ m("p", { children: "Developer revenue is withdrawn from Developer, then Revenue. Approval adds the amount to your earned credits." }), /* @__PURE__ */ m("p", { children: "Earned credits are withdrawn as cash from Withdraw credits." })]
439
+ }) : M.length === 0 && !P ? /* @__PURE__ */ m(d, {
436
440
  illustration: "empty-generic",
437
441
  title: "No payout accounts yet",
438
442
  description: "Add a payout account before requesting a withdrawal."
@@ -1 +1 @@
1
- {"version":3,"file":"PayoutsPage.js","names":["_Fragment","Fragment$1","payoutRequestColumns","formatCurrency","request","formatDateTime","PayoutsPage","permissions","useBillingPermissions","isFluidgrids","useIsFluidgridsVariant","tr","useTr","isReviewingPayout","setIsReviewingPayout","useState","isSubmittingPayout","setIsSubmittingPayout","payoutError","setPayoutError","payoutFailure","setPayoutFailure","actionFailure","setActionFailure","payoutResult","setPayoutResult","useBillingEventEmitter","useBilling","billingAccountData","useGetDefaultBillingAccountSettingsQuery","billingAccountId","accounts","setAccounts","requests","setRequests","loading","setLoading","error","setError","accountForm","setAccountForm","requestAmount","setRequestAmount","selectedAccountId","setSelectedAccountId","editingAccountId","setEditingAccountId","archiveAccountId","setArchiveAccountId","notice","setNotice","requestContext","useMemo","apiGatewayUrl","authToken","orgId","loadData","useCallback","loadedAccounts","loadedRequests","fetchPayoutAccounts","fetchPayoutRequests","pickPayableAccountId","current","loadError","useEffect","AccessDenied","isServerError","serverError","ServerError","plainPayoutError","ShowTechnicalDetails","rawErrorText","guarded","action","failure","handleAddAccount","payload","updatePayoutAccount","emit","created","addPayoutAccount","handleSetDefault","setDefaultPayoutAccount","accountId","handleArchive","archivePayoutAccount","handleEditAccount","account","selectedAccount","hasPayableAccount","isPayoutAccountPayable","handleRequestPayout","requestPayout","confirmPayout","err","MoneyActionDialog","PageHeader","PagePurpose","PayoutErrorNotice","event","Landmark","RefreshCw","IllustratedEmptyState","payoutAccountStatusView","Send","PayoutDestinationList","toPayoutDestinations","item","destination","statusView","PAYOUT_ACCOUNT_TONE_CLASSES","ResponsiveTable","AlertDialog","open","AlertDialogContent","AlertDialogHeader","AlertDialogTitle","AlertDialogDescription","AlertDialogFooter","AlertDialogCancel","AlertDialogAction","id"],"sources":["../../../../../src/billing/modules/earnings/pages/PayoutsPage.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState, type FC } from 'react';\nimport { Landmark, RefreshCw, Send } from 'lucide-react';\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n ResponsiveTable,\n ShowTechnicalDetails,\n type ResponsiveTableColumn,\n} from '@burdenoff/fe-libs/ui';\n\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport { useIsFluidgridsVariant } from '../../../hooks/useBillingVariant';\nimport { MoneyActionDialog } from '../../../shared/components';\nimport { useTr } from '../../../shared/hooks/useTr';\nimport { useBillingEventEmitter } from '../../../hooks/useBillingEventEmitter';\nimport { useBilling } from '../../../providers/BillingProvider';\nimport { AccessDenied, PageHeader, ServerError } from '../../../shared/components';\nimport { PagePurpose, IllustratedEmptyState } from '@burdenoff/fe-libs/ui';\nimport { formatCurrency, formatDateTime, isServerError } from '../../../shared/utils';\nimport { useGetDefaultBillingAccountSettingsQuery } from '../../../../generated/global-operations';\nimport {\n addPayoutAccount,\n archivePayoutAccount,\n fetchPayoutAccounts,\n fetchPayoutRequests,\n requestPayout,\n setDefaultPayoutAccount,\n updatePayoutAccount,\n type PayoutAccount,\n type PayoutRequest,\n} from '../api';\nimport {\n PAYOUT_ACCOUNT_TONE_CLASSES,\n isPayoutAccountPayable,\n payoutAccountStatusView,\n pickPayableAccountId,\n} from '../payoutAccountStatus';\nimport { PayoutDestinationList } from '../components/PayoutDestinationList';\nimport { PayoutErrorNotice } from '../components/PayoutErrorNotice';\nimport { toPayoutDestinations } from '../utils/payoutDestination';\nimport { plainPayoutError, rawErrorText } from '../utils/plainPayoutError';\n\nconst payoutRequestColumns: ResponsiveTableColumn<PayoutRequest>[] = [\n {\n key: 'amount',\n header: 'Amount',\n priority: 'primary',\n cell: (request) => (\n <span className=\"tabular-nums\">\n {formatCurrency(request.requestedAmount, request.currency)}\n </span>\n ),\n },\n { key: 'provider', header: 'Provider', cell: (request) => request.provider },\n { key: 'status', header: 'Status', cell: (request) => request.status },\n {\n key: 'account',\n header: 'Account',\n cell: (request) => request.payoutAccount?.label || '-',\n },\n {\n key: 'created',\n header: 'Created',\n cell: (request) => formatDateTime(request.createdAt),\n },\n];\n\nexport const PayoutsPage: FC = () => {\n const permissions = useBillingPermissions();\n const isFluidgrids = useIsFluidgridsVariant();\n const tr = useTr();\n // FluidGrids: a review step precedes the request, and the outcome is always shown.\n const [isReviewingPayout, setIsReviewingPayout] = useState(false);\n const [isSubmittingPayout, setIsSubmittingPayout] = useState(false);\n const [payoutError, setPayoutError] = useState<string | null>(null);\n // Raw failure kept so its text can sit under \"Show technical details\".\n const [payoutFailure, setPayoutFailure] = useState<unknown>(null);\n // FluidGrids: failures of account actions (save, default, archive) shown in plain words.\n const [actionFailure, setActionFailure] = useState<unknown>(null);\n const [payoutResult, setPayoutResult] = useState<{ ok: boolean; message: string } | null>(null);\n const { emit } = useBillingEventEmitter();\n const { apiGatewayUrl, authToken, orgId } = useBilling();\n const { data: billingAccountData } = useGetDefaultBillingAccountSettingsQuery({});\n const billingAccountId = billingAccountData?.getDefaultBillingAccount?.id;\n\n const [accounts, setAccounts] = useState<PayoutAccount[]>([]);\n const [requests, setRequests] = useState<PayoutRequest[]>([]);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n const [accountForm, setAccountForm] = useState({\n label: '',\n type: 'BANK_ACCOUNT',\n providerPreference: 'AUTO',\n country: 'US',\n currency: 'USD',\n accountHolderName: '',\n bankName: '',\n accountNumber: '',\n routingNumber: '',\n ifsc: '',\n upiId: '',\n });\n const [requestAmount, setRequestAmount] = useState('');\n const [selectedAccountId, setSelectedAccountId] = useState<string>('');\n const [editingAccountId, setEditingAccountId] = useState<string | null>(null);\n const [archiveAccountId, setArchiveAccountId] = useState<string | null>(null);\n const [notice, setNotice] = useState<string | 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 if (!billingAccountId) return;\n setLoading(true);\n setError(null);\n try {\n const [loadedAccounts, loadedRequests] = await Promise.all([\n fetchPayoutAccounts(billingAccountId, requestContext),\n fetchPayoutRequests(billingAccountId, requestContext),\n ]);\n setAccounts(loadedAccounts);\n setRequests(loadedRequests);\n // Only verified accounts can be paid out to (BOFF-10953).\n setSelectedAccountId((current) => pickPayableAccountId(loadedAccounts, current));\n } catch (loadError) {\n setError(loadError instanceof Error ? loadError : new Error('Failed to load payout data'));\n } finally {\n setLoading(false);\n }\n }, [billingAccountId, requestContext]);\n\n useEffect(() => {\n void loadData();\n }, [loadData]);\n\n if (!permissions.canManagePaymentMethods) {\n return <AccessDenied message=\"You don't have permission to manage payout accounts.\" />;\n }\n\n if (error && isServerError(error)) {\n const serverError = (\n <ServerError\n title=\"Payout data 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 // FluidGrids: show a failed account action in plain words instead of an unhandled rejection.\n const guarded = async (action: () => Promise<void>): Promise<void> => {\n if (!isFluidgrids) return action();\n setActionFailure(null);\n try {\n await action();\n } catch (failure) {\n setActionFailure(failure);\n }\n };\n\n const handleAddAccount = async () => {\n if (!billingAccountId) return;\n setNotice(null);\n const payload = {\n billingAccountId,\n ...accountForm,\n };\n\n if (editingAccountId) {\n await updatePayoutAccount(editingAccountId, payload, requestContext);\n emit('billing.payout_account.updated', {\n route: '/billing/payouts',\n entityId: editingAccountId,\n source: 'payouts',\n });\n } else {\n const created = await addPayoutAccount(payload, requestContext);\n emit('billing.payout_account.added', {\n route: '/billing/payouts',\n entityId: billingAccountId,\n source: 'payouts',\n });\n // RazorpayX and Stripe Connect accounts stay pending until processor\n // onboarding verifies them (BOFF-10895); say so instead of implying the\n // account is ready to receive payouts.\n setNotice(\n created.status === 'ACTIVE'\n ? 'Payout account saved and ready to receive payouts.'\n : 'Payout account saved. It stays pending until the payout processor verifies it; you can request payouts to it once it is verified.'\n );\n }\n\n setAccountForm({\n label: '',\n type: 'BANK_ACCOUNT',\n providerPreference: 'AUTO',\n country: 'US',\n currency: 'USD',\n accountHolderName: '',\n bankName: '',\n accountNumber: '',\n routingNumber: '',\n ifsc: '',\n upiId: '',\n });\n setEditingAccountId(null);\n await loadData();\n };\n\n const handleSetDefault = async (accountId: string) => {\n setNotice(null);\n await setDefaultPayoutAccount(accountId, requestContext);\n await loadData();\n };\n\n const handleArchive = async (accountId: string) => {\n setNotice(null);\n await archivePayoutAccount(accountId, requestContext);\n emit('billing.payout_account.archived', {\n route: '/billing/payouts',\n entityId: accountId,\n source: 'payouts',\n });\n await loadData();\n };\n\n const handleEditAccount = (account: PayoutAccount) => {\n setNotice(null);\n setEditingAccountId(account.id);\n setAccountForm((current) => ({\n ...current,\n label: account.label,\n type: account.type,\n providerPreference: account.providerPreference,\n country: account.country || current.country,\n currency: account.currency,\n accountHolderName: account.displayName || current.accountHolderName,\n bankName: '',\n accountNumber: '',\n routingNumber: '',\n ifsc: '',\n upiId: '',\n }));\n };\n\n const selectedAccount = accounts.find((account) => account.id === selectedAccountId);\n const hasPayableAccount = accounts.some(isPayoutAccountPayable);\n\n const handleRequestPayout = async () => {\n if (!billingAccountId || !selectedAccountId || !requestAmount) return;\n if (!selectedAccount || !isPayoutAccountPayable(selectedAccount)) return;\n await requestPayout(\n {\n billingAccountId,\n payoutAccountId: selectedAccountId,\n amount: Number(requestAmount),\n currency: selectedAccount.currency,\n },\n requestContext\n );\n emit('billing.payout.requested', {\n route: '/billing/payouts',\n entityId: selectedAccountId,\n source: 'payouts',\n amount: Number(requestAmount),\n currency: selectedAccount.currency,\n });\n setRequestAmount('');\n await loadData();\n };\n\n const confirmPayout = async () => {\n setIsSubmittingPayout(true);\n setPayoutError(null);\n setPayoutFailure(null);\n try {\n await handleRequestPayout();\n setIsReviewingPayout(false);\n setPayoutResult({\n ok: true,\n message: `Payout of ${formatCurrency(Number(requestAmount), selectedAccount?.currency ?? '')} requested. We'll show its status below.`,\n });\n } catch (err) {\n setPayoutFailure(err);\n setPayoutError(plainPayoutError(err, tr));\n } finally {\n setIsSubmittingPayout(false);\n }\n };\n\n return (\n <div className=\"space-y-6 p-6\">\n {isFluidgrids && (\n <MoneyActionDialog\n open={isReviewingPayout}\n title=\"Review your payout\"\n description=\"The amount is moved out of your available balance when you confirm.\"\n details={[\n {\n label: 'Amount',\n value: formatCurrency(Number(requestAmount), selectedAccount?.currency ?? ''),\n },\n {\n label: 'Paid to',\n value: selectedAccount\n ? `${selectedAccount.label} · ${selectedAccount.currency}`\n : '',\n },\n ...(payoutFailure && rawErrorText(payoutFailure)\n ? [\n {\n label: tr('billing.payoutError.technical', 'Technical details'),\n value: (\n <ShowTechnicalDetails copyable>\n {rawErrorText(payoutFailure)}\n </ShowTechnicalDetails>\n ),\n },\n ]\n : []),\n ]}\n confirmLabel=\"Request payout\"\n busyLabel=\"Requesting…\"\n isBusy={isSubmittingPayout}\n error={payoutError}\n onConfirm={() => void confirmPayout()}\n onCancel={() => setIsReviewingPayout(false)}\n />\n )}\n {isFluidgrids && payoutResult && (\n <div\n role={payoutResult.ok ? 'status' : 'alert'}\n className={`rounded-md border p-3 text-sm ${payoutResult.ok ? 'border-status-success-border text-status-success-text' : 'border-status-error-border text-status-error-text'}`}\n >\n {payoutResult.message}\n </div>\n )}\n <PageHeader\n title=\"Payouts\"\n description=\"Register payout accounts, request withdrawals, and track disbursement status.\"\n />\n\n <PagePurpose>\n Get your earnings paid out to a real bank account or UPI. Register where you want to be\n paid, request a withdrawal of your available balance, and track each request from submission\n through to disbursement here.\n </PagePurpose>\n\n {notice ? (\n <div\n role=\"status\"\n className=\"rounded-lg border border-border-subtle bg-status-info-bg-subtle p-4 text-sm text-status-info-text\"\n >\n {notice}\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 {isFluidgrids && actionFailure ? <PayoutErrorNotice error={actionFailure} /> : null}\n\n <div className=\"grid gap-6 xl:grid-cols-[1.05fr,1.95fr]\">\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\">\n {editingAccountId ? 'Edit payout account' : 'Add payout account'}\n </h2>\n <div className=\"space-y-3\">\n <input\n value={accountForm.label}\n onChange={(event) =>\n setAccountForm((current) => ({ ...current, label: event.target.value }))\n }\n placeholder=\"Label\"\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n <div className=\"grid gap-3 md:grid-cols-2\">\n <select\n value={accountForm.type}\n onChange={(event) =>\n setAccountForm((current) => ({ ...current, type: event.target.value }))\n }\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=\"BANK_ACCOUNT\">Bank account</option>\n <option value=\"UPI\">UPI</option>\n <option value=\"WALLET\">Wallet</option>\n </select>\n <select\n value={accountForm.providerPreference}\n onChange={(event) =>\n setAccountForm((current) => ({\n ...current,\n providerPreference: event.target.value,\n }))\n }\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=\"AUTO\">Auto</option>\n <option value=\"STRIPE\">Stripe</option>\n <option value=\"RAZORPAY\">Razorpay</option>\n <option value=\"MANUAL\">Manual</option>\n </select>\n </div>\n <div className=\"grid gap-3 md:grid-cols-2\">\n <input\n value={accountForm.country}\n onChange={(event) =>\n setAccountForm((current) => ({\n ...current,\n country: event.target.value.toUpperCase(),\n }))\n }\n placeholder=\"Country\"\n className=\"rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n <input\n value={accountForm.currency}\n onChange={(event) =>\n setAccountForm((current) => ({\n ...current,\n currency: event.target.value.toUpperCase(),\n }))\n }\n placeholder=\"Currency\"\n className=\"rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n </div>\n <input\n value={accountForm.accountHolderName}\n onChange={(event) =>\n setAccountForm((current) => ({ ...current, accountHolderName: event.target.value }))\n }\n placeholder=\"Account holder name\"\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n {accountForm.type === 'BANK_ACCOUNT' ? (\n <>\n <input\n value={accountForm.bankName}\n onChange={(event) =>\n setAccountForm((current) => ({ ...current, bankName: event.target.value }))\n }\n placeholder=\"Bank name\"\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n <input\n value={accountForm.accountNumber}\n onChange={(event) =>\n setAccountForm((current) => ({ ...current, accountNumber: event.target.value }))\n }\n placeholder=\"Account number\"\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n <input\n value={\n accountForm.country === 'IN' ? accountForm.ifsc : accountForm.routingNumber\n }\n onChange={(event) =>\n setAccountForm((current) =>\n current.country === 'IN'\n ? { ...current, ifsc: event.target.value }\n : { ...current, routingNumber: event.target.value }\n )\n }\n placeholder={accountForm.country === 'IN' ? 'IFSC' : 'Routing number'}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n </>\n ) : accountForm.type === 'UPI' ? (\n <input\n value={accountForm.upiId}\n onChange={(event) =>\n setAccountForm((current) => ({ ...current, upiId: event.target.value }))\n }\n placeholder=\"UPI ID\"\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n ) : null}\n </div>\n <button\n type=\"button\"\n onClick={() => void guarded(handleAddAccount)}\n className=\"mt-4 inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text\"\n >\n <Landmark className=\"size-4\" />\n {editingAccountId ? 'Update payout account' : 'Save payout account'}\n </button>\n {editingAccountId ? (\n <button\n type=\"button\"\n onClick={() => {\n setEditingAccountId(null);\n setAccountForm({\n label: '',\n type: 'BANK_ACCOUNT',\n providerPreference: 'AUTO',\n country: 'US',\n currency: 'USD',\n accountHolderName: '',\n bankName: '',\n accountNumber: '',\n routingNumber: '',\n ifsc: '',\n upiId: '',\n });\n }}\n className=\"mt-4 ml-3 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 Cancel edit\n </button>\n ) : null}\n </section>\n\n <section className=\"space-y-4\">\n <div 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\">Request payout</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 {accounts.length === 0 && !loading ? (\n <IllustratedEmptyState\n illustration=\"empty-generic\"\n title=\"No payout accounts yet\"\n description=\"Add a payout account before requesting a withdrawal.\"\n />\n ) : (\n <div className=\"space-y-3\">\n <select\n value={selectedAccountId}\n onChange={(event) => setSelectedAccountId(event.target.value)}\n className=\"w-full 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 {!hasPayableAccount ? (\n <option value=\"\">No verified payout account yet</option>\n ) : null}\n {accounts.map((account) => (\n <option\n key={account.id}\n value={account.id}\n disabled={!isPayoutAccountPayable(account)}\n >\n {account.label} · {account.currency} ·{' '}\n {payoutAccountStatusView(account.status).label}\n </option>\n ))}\n </select>\n {!hasPayableAccount ? (\n <p className=\"text-sm text-text-secondary\">\n Payouts can be requested once one of your payout accounts is verified.\n </p>\n ) : null}\n <label className=\"block space-y-1 text-sm font-medium text-text-primary\">\n <span>Amount</span>\n <input\n value={requestAmount}\n onChange={(event) => setRequestAmount(event.target.value)}\n inputMode=\"decimal\"\n placeholder=\"0.00\"\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm font-normal text-text-primary\"\n />\n </label>\n <button\n type=\"button\"\n onClick={() => {\n if (!isFluidgrids) {\n void handleRequestPayout();\n return;\n }\n setPayoutError(null);\n setPayoutFailure(null);\n setPayoutResult(null);\n setIsReviewingPayout(true);\n }}\n disabled={!selectedAccount || !isPayoutAccountPayable(selectedAccount)}\n className=\"inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text disabled:cursor-not-allowed disabled:opacity-50\"\n >\n <Send className=\"size-4\" />\n Request payout\n </button>\n </div>\n )}\n\n {accounts.length > 0 ? (\n <div className=\"mt-4 space-y-3 rounded-md border border-border-subtle bg-bg-surface/60 p-3\">\n <h3 className=\"text-sm font-semibold text-text-primary\">Saved payout accounts</h3>\n {isFluidgrids ? (\n <PayoutDestinationList\n destinations={toPayoutDestinations(accounts)}\n renderActions={(destination) => {\n const account = accounts.find((item) => item.id === destination.id);\n if (!account) return null;\n return (\n <>\n <button\n type=\"button\"\n onClick={() => handleEditAccount(account)}\n className=\"rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary\"\n >\n {tr('billing.payouts.edit', 'Edit')}\n </button>\n {!account.isDefault ? (\n <button\n type=\"button\"\n onClick={() => void guarded(() => handleSetDefault(account.id))}\n className=\"rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary\"\n >\n {tr('billing.payouts.makeDefault', 'Make default')}\n </button>\n ) : null}\n <button\n type=\"button\"\n onClick={() => setArchiveAccountId(account.id)}\n className=\"rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-status-error-text\"\n >\n {tr('billing.payouts.archive', 'Archive')}\n </button>\n </>\n );\n }}\n />\n ) : (\n <>\n {accounts.map((account) => {\n const statusView = payoutAccountStatusView(account.status);\n return (\n <div\n key={account.id}\n className=\"flex flex-wrap items-center justify-between gap-3 rounded-md border border-border-subtle/70 bg-bg-surface px-3 py-2 text-sm\"\n >\n <div>\n <p className=\"flex flex-wrap items-center gap-2 font-medium text-text-primary\">\n {account.label} {account.isDefault ? '• Default' : ''}\n <span\n className={`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${PAYOUT_ACCOUNT_TONE_CLASSES[statusView.tone]}`}\n >\n {statusView.label}\n </span>\n </p>\n <p className=\"text-text-secondary\">\n {account.providerPreference} · {account.currency}\n </p>\n {statusView.hint ? (\n <p className=\"mt-1 text-xs text-text-secondary\">{statusView.hint}</p>\n ) : null}\n </div>\n <div className=\"flex flex-wrap gap-2\">\n <button\n type=\"button\"\n onClick={() => handleEditAccount(account)}\n className=\"rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary\"\n >\n Edit\n </button>\n {!account.isDefault ? (\n <button\n type=\"button\"\n onClick={() => void guarded(() => handleSetDefault(account.id))}\n className=\"rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary\"\n >\n Make default\n </button>\n ) : null}\n <button\n type=\"button\"\n onClick={() => setArchiveAccountId(account.id)}\n className=\"rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-status-error-text\"\n >\n Archive\n </button>\n </div>\n </div>\n );\n })}\n </>\n )}\n </div>\n ) : null}\n </div>\n\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <h2 className=\"mb-4 text-lg font-semibold text-text-primary\">Payout requests</h2>\n {requests.length === 0 && !loading ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No payout requests yet\"\n description=\"Your payout requests and processing updates will appear here.\"\n />\n ) : (\n <ResponsiveTable\n data={requests}\n rowKey={(request) => request.id}\n columns={payoutRequestColumns}\n />\n )}\n </div>\n </section>\n </div>\n\n <AlertDialog\n open={archiveAccountId !== null}\n onOpenChange={(open) => {\n if (!open) setArchiveAccountId(null);\n }}\n >\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>Archive payout account?</AlertDialogTitle>\n <AlertDialogDescription>\n Archive this payout account? You can add a new one at any time.\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>Cancel</AlertDialogCancel>\n <AlertDialogAction\n onClick={() => {\n const id = archiveAccountId;\n setArchiveAccountId(null);\n if (id) void guarded(() => handleArchive(id));\n }}\n >\n Archive\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,IAAME,KAA+D;CACnE;EACE,KAAK;EACL,QAAQ;EACR,UAAU;EACV,OAAO,MACL,kBAAC,QAAD;GAAM,WAAU;GACb,UAAAC,EAAeC,EAAQ,iBAAiBA,EAAQ,QAAQ;EACrD,CAAA;CAEV;CACA;EAAE,KAAK;EAAY,QAAQ;EAAY,OAAO,MAAYA,EAAQ;CAAS;CAC3E;EAAE,KAAK;EAAU,QAAQ;EAAU,OAAO,MAAYA,EAAQ;CAAO;CACrE;EACE,KAAK;EACL,QAAQ;EACR,OAAO,MAAYA,EAAQ,eAAe,SAAS;CACrD;CACA;EACE,KAAK;EACL,QAAQ;EACR,OAAO,MAAYC,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;IACrC;IAEA,UAAA,kBAACmE,IAAD,EAAA,UAAA,CACE,kBAACC,IAAD,EAAA,UAAA,CACE,kBAACC,IAAD,EAAA,UAAkB,0BAAyC,CAAA,GAC3D,kBAACC,IAAD,EAAA,UAAwB,kEAEA,CAAA,CACP,EAAA,CAAA,GACnB,kBAACC,IAAD,EAAA,UAAA,CACE,kBAACC,IAAD,EAAA,UAAmB,SAAyB,CAAA,GAC5C,kBAACC,IAAD;KACE,eAAe;MACb,IAAMC,IAAK3E;MAEX,AADAC,EAAoB,IAAI,GACpB0E,KAAIjD,QAAmBY,GAAcqC,CAAE,CAAC;KAC9C;KACD,UAAA;IAEkB,CAAA,CACF,EAAA,CAAA,CACD,EAAA,CAAA;GACT,CAAA;EACV;;AAET"}
1
+ {"version":3,"file":"PayoutsPage.js","names":["_Fragment","Fragment$1","payoutRequestColumns","formatCurrency","request","formatDateTime","PayoutsPage","permissions","useBillingPermissions","isFluidgrids","useIsFluidgridsVariant","tr","useTr","isReviewingPayout","setIsReviewingPayout","useState","isSubmittingPayout","setIsSubmittingPayout","payoutError","setPayoutError","payoutFailure","setPayoutFailure","actionFailure","setActionFailure","payoutResult","setPayoutResult","useBillingEventEmitter","useBilling","billingAccountData","useGetDefaultBillingAccountSettingsQuery","billingAccountId","accounts","setAccounts","requests","setRequests","loading","setLoading","error","setError","accountForm","setAccountForm","requestAmount","setRequestAmount","selectedAccountId","setSelectedAccountId","editingAccountId","setEditingAccountId","archiveAccountId","setArchiveAccountId","notice","setNotice","requestContext","useMemo","apiGatewayUrl","authToken","orgId","loadData","useCallback","loadedAccounts","loadedRequests","fetchPayoutAccounts","fetchPayoutRequests","pickPayableAccountId","current","loadError","useEffect","AccessDenied","isServerError","serverError","ServerError","plainPayoutError","ShowTechnicalDetails","rawErrorText","guarded","action","failure","handleAddAccount","payload","updatePayoutAccount","emit","created","addPayoutAccount","handleSetDefault","setDefaultPayoutAccount","accountId","handleArchive","archivePayoutAccount","handleEditAccount","account","selectedAccount","hasPayableAccount","isPayoutAccountPayable","handleRequestPayout","requestPayout","confirmPayout","err","MoneyActionDialog","PageHeader","PagePurpose","PayoutErrorNotice","event","Landmark","RefreshCw","IllustratedEmptyState","payoutAccountStatusView","Send","PayoutDestinationList","toPayoutDestinations","item","destination","statusView","PAYOUT_ACCOUNT_TONE_CLASSES","ResponsiveTable","AlertDialog","open","AlertDialogContent","AlertDialogHeader","AlertDialogTitle","AlertDialogDescription","AlertDialogFooter","AlertDialogCancel","AlertDialogAction","id"],"sources":["../../../../../src/billing/modules/earnings/pages/PayoutsPage.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState, type FC } from 'react';\nimport { Landmark, RefreshCw, Send } from 'lucide-react';\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n ResponsiveTable,\n ShowTechnicalDetails,\n type ResponsiveTableColumn,\n} from '@burdenoff/fe-libs/ui';\n\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport { useIsFluidgridsVariant } from '../../../hooks/useBillingVariant';\nimport { MoneyActionDialog } from '../../../shared/components';\nimport { useTr } from '../../../shared/hooks/useTr';\nimport { useBillingEventEmitter } from '../../../hooks/useBillingEventEmitter';\nimport { useBilling } from '../../../providers/BillingProvider';\nimport { AccessDenied, PageHeader, ServerError } from '../../../shared/components';\nimport { PagePurpose, IllustratedEmptyState } from '@burdenoff/fe-libs/ui';\nimport { formatCurrency, formatDateTime, isServerError } from '../../../shared/utils';\nimport { useGetDefaultBillingAccountSettingsQuery } from '../../../../generated/global-operations';\nimport {\n addPayoutAccount,\n archivePayoutAccount,\n fetchPayoutAccounts,\n fetchPayoutRequests,\n requestPayout,\n setDefaultPayoutAccount,\n updatePayoutAccount,\n type PayoutAccount,\n type PayoutRequest,\n} from '../api';\nimport {\n PAYOUT_ACCOUNT_TONE_CLASSES,\n isPayoutAccountPayable,\n payoutAccountStatusView,\n pickPayableAccountId,\n} from '../payoutAccountStatus';\nimport { PayoutDestinationList } from '../components/PayoutDestinationList';\nimport { PayoutErrorNotice } from '../components/PayoutErrorNotice';\nimport { toPayoutDestinations } from '../utils/payoutDestination';\nimport { plainPayoutError, rawErrorText } from '../utils/plainPayoutError';\n\nconst payoutRequestColumns: ResponsiveTableColumn<PayoutRequest>[] = [\n {\n key: 'amount',\n header: 'Amount',\n priority: 'primary',\n cell: (request) => (\n <span className=\"tabular-nums\">\n {formatCurrency(request.requestedAmount, request.currency)}\n </span>\n ),\n },\n { key: 'provider', header: 'Provider', cell: (request) => request.provider },\n { key: 'status', header: 'Status', cell: (request) => request.status },\n {\n key: 'account',\n header: 'Account',\n cell: (request) => request.payoutAccount?.label || '-',\n },\n {\n key: 'created',\n header: 'Created',\n cell: (request) => formatDateTime(request.createdAt),\n },\n];\n\nexport const PayoutsPage: FC = () => {\n const permissions = useBillingPermissions();\n const isFluidgrids = useIsFluidgridsVariant();\n const tr = useTr();\n // FluidGrids: a review step precedes the request, and the outcome is always shown.\n const [isReviewingPayout, setIsReviewingPayout] = useState(false);\n const [isSubmittingPayout, setIsSubmittingPayout] = useState(false);\n const [payoutError, setPayoutError] = useState<string | null>(null);\n // Raw failure kept so its text can sit under \"Show technical details\".\n const [payoutFailure, setPayoutFailure] = useState<unknown>(null);\n // FluidGrids: failures of account actions (save, default, archive) shown in plain words.\n const [actionFailure, setActionFailure] = useState<unknown>(null);\n const [payoutResult, setPayoutResult] = useState<{ ok: boolean; message: string } | null>(null);\n const { emit } = useBillingEventEmitter();\n const { apiGatewayUrl, authToken, orgId } = useBilling();\n const { data: billingAccountData } = useGetDefaultBillingAccountSettingsQuery({});\n const billingAccountId = billingAccountData?.getDefaultBillingAccount?.id;\n\n const [accounts, setAccounts] = useState<PayoutAccount[]>([]);\n const [requests, setRequests] = useState<PayoutRequest[]>([]);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n const [accountForm, setAccountForm] = useState({\n label: '',\n type: 'BANK_ACCOUNT',\n providerPreference: 'AUTO',\n country: 'US',\n currency: 'USD',\n accountHolderName: '',\n bankName: '',\n accountNumber: '',\n routingNumber: '',\n ifsc: '',\n upiId: '',\n });\n const [requestAmount, setRequestAmount] = useState('');\n const [selectedAccountId, setSelectedAccountId] = useState<string>('');\n const [editingAccountId, setEditingAccountId] = useState<string | null>(null);\n const [archiveAccountId, setArchiveAccountId] = useState<string | null>(null);\n const [notice, setNotice] = useState<string | 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 if (!billingAccountId) return;\n setLoading(true);\n setError(null);\n try {\n const [loadedAccounts, loadedRequests] = await Promise.all([\n fetchPayoutAccounts(billingAccountId, requestContext),\n fetchPayoutRequests(billingAccountId, requestContext),\n ]);\n setAccounts(loadedAccounts);\n setRequests(loadedRequests);\n // Only verified accounts can be paid out to (BOFF-10953).\n setSelectedAccountId((current) => pickPayableAccountId(loadedAccounts, current));\n } catch (loadError) {\n setError(loadError instanceof Error ? loadError : new Error('Failed to load payout data'));\n } finally {\n setLoading(false);\n }\n }, [billingAccountId, requestContext]);\n\n useEffect(() => {\n void loadData();\n }, [loadData]);\n\n if (!permissions.canManagePaymentMethods) {\n return <AccessDenied message=\"You don't have permission to manage payout accounts.\" />;\n }\n\n if (error && isServerError(error)) {\n const serverError = (\n <ServerError\n title=\"Payout data 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 // FluidGrids: show a failed account action in plain words instead of an unhandled rejection.\n const guarded = async (action: () => Promise<void>): Promise<void> => {\n if (!isFluidgrids) return action();\n setActionFailure(null);\n try {\n await action();\n } catch (failure) {\n setActionFailure(failure);\n }\n };\n\n const handleAddAccount = async () => {\n if (!billingAccountId) return;\n setNotice(null);\n const payload = {\n billingAccountId,\n ...accountForm,\n };\n\n if (editingAccountId) {\n await updatePayoutAccount(editingAccountId, payload, requestContext);\n emit('billing.payout_account.updated', {\n route: '/billing/payouts',\n entityId: editingAccountId,\n source: 'payouts',\n });\n } else {\n const created = await addPayoutAccount(payload, requestContext);\n emit('billing.payout_account.added', {\n route: '/billing/payouts',\n entityId: billingAccountId,\n source: 'payouts',\n });\n // RazorpayX and Stripe Connect accounts stay pending until processor\n // onboarding verifies them (BOFF-10895); say so instead of implying the\n // account is ready to receive payouts.\n setNotice(\n created.status === 'ACTIVE'\n ? 'Payout account saved and ready to receive payouts.'\n : 'Payout account saved. It stays pending until the payout processor verifies it; you can request payouts to it once it is verified.'\n );\n }\n\n setAccountForm({\n label: '',\n type: 'BANK_ACCOUNT',\n providerPreference: 'AUTO',\n country: 'US',\n currency: 'USD',\n accountHolderName: '',\n bankName: '',\n accountNumber: '',\n routingNumber: '',\n ifsc: '',\n upiId: '',\n });\n setEditingAccountId(null);\n await loadData();\n };\n\n const handleSetDefault = async (accountId: string) => {\n setNotice(null);\n await setDefaultPayoutAccount(accountId, requestContext);\n await loadData();\n };\n\n const handleArchive = async (accountId: string) => {\n setNotice(null);\n await archivePayoutAccount(accountId, requestContext);\n emit('billing.payout_account.archived', {\n route: '/billing/payouts',\n entityId: accountId,\n source: 'payouts',\n });\n await loadData();\n };\n\n const handleEditAccount = (account: PayoutAccount) => {\n setNotice(null);\n setEditingAccountId(account.id);\n setAccountForm((current) => ({\n ...current,\n label: account.label,\n type: account.type,\n providerPreference: account.providerPreference,\n country: account.country || current.country,\n currency: account.currency,\n accountHolderName: account.displayName || current.accountHolderName,\n bankName: '',\n accountNumber: '',\n routingNumber: '',\n ifsc: '',\n upiId: '',\n }));\n };\n\n const selectedAccount = accounts.find((account) => account.id === selectedAccountId);\n const hasPayableAccount = accounts.some(isPayoutAccountPayable);\n\n const handleRequestPayout = async () => {\n if (!billingAccountId || !selectedAccountId || !requestAmount) return;\n if (!selectedAccount || !isPayoutAccountPayable(selectedAccount)) return;\n await requestPayout(\n {\n billingAccountId,\n payoutAccountId: selectedAccountId,\n amount: Number(requestAmount),\n currency: selectedAccount.currency,\n },\n requestContext\n );\n emit('billing.payout.requested', {\n route: '/billing/payouts',\n entityId: selectedAccountId,\n source: 'payouts',\n amount: Number(requestAmount),\n currency: selectedAccount.currency,\n });\n setRequestAmount('');\n await loadData();\n };\n\n const confirmPayout = async () => {\n setIsSubmittingPayout(true);\n setPayoutError(null);\n setPayoutFailure(null);\n try {\n await handleRequestPayout();\n setIsReviewingPayout(false);\n setPayoutResult({\n ok: true,\n message: `Payout of ${formatCurrency(Number(requestAmount), selectedAccount?.currency ?? '')} requested. We'll show its status below.`,\n });\n } catch (err) {\n setPayoutFailure(err);\n setPayoutError(plainPayoutError(err, tr));\n } finally {\n setIsSubmittingPayout(false);\n }\n };\n\n return (\n <div className=\"space-y-6 p-6\">\n {isFluidgrids && (\n <MoneyActionDialog\n open={isReviewingPayout}\n title=\"Review your payout\"\n description=\"The amount is moved out of your available balance when you confirm.\"\n details={[\n {\n label: 'Amount',\n value: formatCurrency(Number(requestAmount), selectedAccount?.currency ?? ''),\n },\n {\n label: 'Paid to',\n value: selectedAccount\n ? `${selectedAccount.label} · ${selectedAccount.currency}`\n : '',\n },\n ...(payoutFailure && rawErrorText(payoutFailure)\n ? [\n {\n label: tr('billing.payoutError.technical', 'Technical details'),\n value: (\n <ShowTechnicalDetails copyable>\n {rawErrorText(payoutFailure)}\n </ShowTechnicalDetails>\n ),\n },\n ]\n : []),\n ]}\n confirmLabel=\"Request payout\"\n busyLabel=\"Requesting…\"\n isBusy={isSubmittingPayout}\n error={payoutError}\n onConfirm={() => void confirmPayout()}\n onCancel={() => setIsReviewingPayout(false)}\n />\n )}\n {isFluidgrids && payoutResult && (\n <div\n role={payoutResult.ok ? 'status' : 'alert'}\n className={`rounded-md border p-3 text-sm ${payoutResult.ok ? 'border-status-success-border text-status-success-text' : 'border-status-error-border text-status-error-text'}`}\n >\n {payoutResult.message}\n </div>\n )}\n <PageHeader\n title=\"Payouts\"\n description=\"Register payout accounts, request withdrawals, and track disbursement status.\"\n />\n\n <PagePurpose>\n Get your earnings paid out to a real bank account or UPI. Register where you want to be\n paid, request a withdrawal of your available balance, and track each request from submission\n through to disbursement here.\n </PagePurpose>\n\n {notice ? (\n <div\n role=\"status\"\n className=\"rounded-lg border border-border-subtle bg-status-info-bg-subtle p-4 text-sm text-status-info-text\"\n >\n {notice}\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 {isFluidgrids && actionFailure ? <PayoutErrorNotice error={actionFailure} /> : null}\n\n <div className=\"grid gap-6 xl:grid-cols-[1.05fr,1.95fr]\">\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\">\n {editingAccountId ? 'Edit payout account' : 'Add payout account'}\n </h2>\n <div className=\"space-y-3\">\n <input\n value={accountForm.label}\n onChange={(event) =>\n setAccountForm((current) => ({ ...current, label: event.target.value }))\n }\n placeholder=\"Label\"\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n <div className=\"grid gap-3 md:grid-cols-2\">\n <select\n value={accountForm.type}\n onChange={(event) =>\n setAccountForm((current) => ({ ...current, type: event.target.value }))\n }\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=\"BANK_ACCOUNT\">Bank account</option>\n <option value=\"UPI\">UPI</option>\n <option value=\"WALLET\">Wallet</option>\n </select>\n <select\n value={accountForm.providerPreference}\n onChange={(event) =>\n setAccountForm((current) => ({\n ...current,\n providerPreference: event.target.value,\n }))\n }\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=\"AUTO\">Auto</option>\n <option value=\"STRIPE\">Stripe</option>\n <option value=\"RAZORPAY\">Razorpay</option>\n <option value=\"MANUAL\">Manual</option>\n </select>\n </div>\n <div className=\"grid gap-3 md:grid-cols-2\">\n <input\n value={accountForm.country}\n onChange={(event) =>\n setAccountForm((current) => ({\n ...current,\n country: event.target.value.toUpperCase(),\n }))\n }\n placeholder=\"Country\"\n className=\"rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n <input\n value={accountForm.currency}\n onChange={(event) =>\n setAccountForm((current) => ({\n ...current,\n currency: event.target.value.toUpperCase(),\n }))\n }\n placeholder=\"Currency\"\n className=\"rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n </div>\n <input\n value={accountForm.accountHolderName}\n onChange={(event) =>\n setAccountForm((current) => ({ ...current, accountHolderName: event.target.value }))\n }\n placeholder=\"Account holder name\"\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n {accountForm.type === 'BANK_ACCOUNT' ? (\n <>\n <input\n value={accountForm.bankName}\n onChange={(event) =>\n setAccountForm((current) => ({ ...current, bankName: event.target.value }))\n }\n placeholder=\"Bank name\"\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n <input\n value={accountForm.accountNumber}\n onChange={(event) =>\n setAccountForm((current) => ({ ...current, accountNumber: event.target.value }))\n }\n placeholder=\"Account number\"\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n <input\n value={\n accountForm.country === 'IN' ? accountForm.ifsc : accountForm.routingNumber\n }\n onChange={(event) =>\n setAccountForm((current) =>\n current.country === 'IN'\n ? { ...current, ifsc: event.target.value }\n : { ...current, routingNumber: event.target.value }\n )\n }\n placeholder={accountForm.country === 'IN' ? 'IFSC' : 'Routing number'}\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n </>\n ) : accountForm.type === 'UPI' ? (\n <input\n value={accountForm.upiId}\n onChange={(event) =>\n setAccountForm((current) => ({ ...current, upiId: event.target.value }))\n }\n placeholder=\"UPI ID\"\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n ) : null}\n </div>\n <button\n type=\"button\"\n onClick={() => void guarded(handleAddAccount)}\n className=\"mt-4 inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text\"\n >\n <Landmark className=\"size-4\" />\n {editingAccountId ? 'Update payout account' : 'Save payout account'}\n </button>\n {editingAccountId ? (\n <button\n type=\"button\"\n onClick={() => {\n setEditingAccountId(null);\n setAccountForm({\n label: '',\n type: 'BANK_ACCOUNT',\n providerPreference: 'AUTO',\n country: 'US',\n currency: 'USD',\n accountHolderName: '',\n bankName: '',\n accountNumber: '',\n routingNumber: '',\n ifsc: '',\n upiId: '',\n });\n }}\n className=\"mt-4 ml-3 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 Cancel edit\n </button>\n ) : null}\n </section>\n\n <section className=\"space-y-4\">\n <div 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\">\n {isFluidgrids ? 'Withdrawals' : 'Request payout'}\n </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 {isFluidgrids ? (\n // This page has no working way to submit a payout (the request is not\n // implemented here), so FluidGrids points to the two that work.\n <div className=\"space-y-2 text-sm text-text-secondary\" role=\"note\">\n <p>\n Developer revenue is withdrawn from Developer, then Revenue. Approval adds the\n amount to your earned credits.\n </p>\n <p>Earned credits are withdrawn as cash from Withdraw credits.</p>\n </div>\n ) : accounts.length === 0 && !loading ? (\n <IllustratedEmptyState\n illustration=\"empty-generic\"\n title=\"No payout accounts yet\"\n description=\"Add a payout account before requesting a withdrawal.\"\n />\n ) : (\n <div className=\"space-y-3\">\n <select\n value={selectedAccountId}\n onChange={(event) => setSelectedAccountId(event.target.value)}\n className=\"w-full 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 {!hasPayableAccount ? (\n <option value=\"\">No verified payout account yet</option>\n ) : null}\n {accounts.map((account) => (\n <option\n key={account.id}\n value={account.id}\n disabled={!isPayoutAccountPayable(account)}\n >\n {account.label} · {account.currency} ·{' '}\n {payoutAccountStatusView(account.status).label}\n </option>\n ))}\n </select>\n {!hasPayableAccount ? (\n <p className=\"text-sm text-text-secondary\">\n Payouts can be requested once one of your payout accounts is verified.\n </p>\n ) : null}\n <label className=\"block space-y-1 text-sm font-medium text-text-primary\">\n <span>Amount</span>\n <input\n value={requestAmount}\n onChange={(event) => setRequestAmount(event.target.value)}\n inputMode=\"decimal\"\n placeholder=\"0.00\"\n className=\"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm font-normal text-text-primary\"\n />\n </label>\n <button\n type=\"button\"\n onClick={() => {\n if (!isFluidgrids) {\n void handleRequestPayout();\n return;\n }\n setPayoutError(null);\n setPayoutFailure(null);\n setPayoutResult(null);\n setIsReviewingPayout(true);\n }}\n disabled={!selectedAccount || !isPayoutAccountPayable(selectedAccount)}\n className=\"inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text disabled:cursor-not-allowed disabled:opacity-50\"\n >\n <Send className=\"size-4\" />\n Request payout\n </button>\n </div>\n )}\n\n {accounts.length > 0 ? (\n <div className=\"mt-4 space-y-3 rounded-md border border-border-subtle bg-bg-surface/60 p-3\">\n <h3 className=\"text-sm font-semibold text-text-primary\">Saved payout accounts</h3>\n {isFluidgrids ? (\n <PayoutDestinationList\n destinations={toPayoutDestinations(accounts)}\n renderActions={(destination) => {\n const account = accounts.find((item) => item.id === destination.id);\n if (!account) return null;\n return (\n <>\n <button\n type=\"button\"\n onClick={() => handleEditAccount(account)}\n className=\"rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary\"\n >\n {tr('billing.payouts.edit', 'Edit')}\n </button>\n {!account.isDefault ? (\n <button\n type=\"button\"\n onClick={() => void guarded(() => handleSetDefault(account.id))}\n className=\"rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary\"\n >\n {tr('billing.payouts.makeDefault', 'Make default')}\n </button>\n ) : null}\n <button\n type=\"button\"\n onClick={() => setArchiveAccountId(account.id)}\n className=\"rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-status-error-text\"\n >\n {tr('billing.payouts.archive', 'Archive')}\n </button>\n </>\n );\n }}\n />\n ) : (\n <>\n {accounts.map((account) => {\n const statusView = payoutAccountStatusView(account.status);\n return (\n <div\n key={account.id}\n className=\"flex flex-wrap items-center justify-between gap-3 rounded-md border border-border-subtle/70 bg-bg-surface px-3 py-2 text-sm\"\n >\n <div>\n <p className=\"flex flex-wrap items-center gap-2 font-medium text-text-primary\">\n {account.label} {account.isDefault ? '• Default' : ''}\n <span\n className={`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${PAYOUT_ACCOUNT_TONE_CLASSES[statusView.tone]}`}\n >\n {statusView.label}\n </span>\n </p>\n <p className=\"text-text-secondary\">\n {account.providerPreference} · {account.currency}\n </p>\n {statusView.hint ? (\n <p className=\"mt-1 text-xs text-text-secondary\">{statusView.hint}</p>\n ) : null}\n </div>\n <div className=\"flex flex-wrap gap-2\">\n <button\n type=\"button\"\n onClick={() => handleEditAccount(account)}\n className=\"rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary\"\n >\n Edit\n </button>\n {!account.isDefault ? (\n <button\n type=\"button\"\n onClick={() => void guarded(() => handleSetDefault(account.id))}\n className=\"rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-text-primary\"\n >\n Make default\n </button>\n ) : null}\n <button\n type=\"button\"\n onClick={() => setArchiveAccountId(account.id)}\n className=\"rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium text-status-error-text\"\n >\n Archive\n </button>\n </div>\n </div>\n );\n })}\n </>\n )}\n </div>\n ) : null}\n </div>\n\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <h2 className=\"mb-4 text-lg font-semibold text-text-primary\">Payout requests</h2>\n {requests.length === 0 && !loading ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No payout requests yet\"\n description=\"Your payout requests and processing updates will appear here.\"\n />\n ) : (\n <ResponsiveTable\n data={requests}\n rowKey={(request) => request.id}\n columns={payoutRequestColumns}\n />\n )}\n </div>\n </section>\n </div>\n\n <AlertDialog\n open={archiveAccountId !== null}\n onOpenChange={(open) => {\n if (!open) setArchiveAccountId(null);\n }}\n >\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>Archive payout account?</AlertDialogTitle>\n <AlertDialogDescription>\n Archive this payout account? You can add a new one at any time.\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>Cancel</AlertDialogCancel>\n <AlertDialogAction\n onClick={() => {\n const id = archiveAccountId;\n setArchiveAccountId(null);\n if (id) void guarded(() => handleArchive(id));\n }}\n >\n Archive\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;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kBAAC,UAAD;aACE,MAAK;aACL,eAAexC,EAAoBwC,EAAQ,EAAE;aAC7C,WAAU;aACX,UAAA;YAEO,CAAA;WACL;UACF,CAAA,CAAA;SA5CE,GAAAA,EAAQ,EA4CV;QAET,CAAC,EACD,CAAA,CAED;OACH,CAAA,IAAA;MACD;KAEL,CAAA,GAAA,kBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACE,kBAAC,MAAD;OAAI,WAAU;OAA+C,UAAA;MAAmB,CAAA,GAC/EvD,EAAS,WAAW,KAAK,CAACE,IACzB,kBAACoE,GAAD;OACE,cAAa;OACb,OAAM;OACN,aAAY;MACb,CAAA,IAED,kBAACS,IAAD;OACE,MAAM/E;OACN,SAAS,MAAY7B,EAAQ;OAC7B,SAASF;MACV,CAAA,CAEA;KACE,CAAA,CAAA;IACN,CAAA,CAAA;;GAEL,kBAAC+G,IAAD;IACE,MAAMlE,OAAqB;IAC3B,eAAe,MAAS;KACtB,AAAKmE,KAAMlE,EAAoB,IAAI;IACrC;IAEA,UAAA,kBAACmE,IAAD,EAAA,UAAA,CACE,kBAACC,IAAD,EAAA,UAAA,CACE,kBAACC,IAAD,EAAA,UAAkB,0BAAyC,CAAA,GAC3D,kBAACC,IAAD,EAAA,UAAwB,kEAEA,CAAA,CACP,EAAA,CAAA,GACnB,kBAACC,IAAD,EAAA,UAAA,CACE,kBAACC,IAAD,EAAA,UAAmB,SAAyB,CAAA,GAC5C,kBAACC,IAAD;KACE,eAAe;MACb,IAAMC,IAAK3E;MAEX,AADAC,EAAoB,IAAI,GACpB0E,KAAIjD,QAAmBY,GAAcqC,CAAE,CAAC;KAC9C;KACD,UAAA;IAEkB,CAAA,CACF,EAAA,CAAA,CACD,EAAA,CAAA;GACT,CAAA;EACV;;AAET"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-billing",
3
- "version": "2026.1114.10",
3
+ "version": "2026.1115.2",
4
4
  "description": "Billing microfrontend for Burdenoff products",
5
5
  "type": "module",
6
6
  "files": [