@burdenoff/microfe-billing 2026.1112.1 → 2026.1112.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.
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js +182 -150
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +153 -126
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditsPage.js +110 -109
- package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutsPage.js +220 -181
- package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { CreditWithdrawalHistoryDocument as e, GetCreditBalanceByTypeDocument as t, RequestCreditWithdrawalDocument as n, useGetCostOfCreditsCheckoutQuery as r } from "../../../../generated/global-operations.js";
|
|
2
2
|
import { useBillingPermissions as i } from "../../../hooks/useBillingPermissions.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { MoneyActionDialog as ee } from "../../../shared/components/MoneyActionDialog.js";
|
|
4
|
+
import { useBillingEventEmitter as te } from "../../../hooks/useBillingEventEmitter.js";
|
|
5
|
+
import { useBilling as ne } from "../../../providers/BillingProvider.js";
|
|
6
|
+
import { useIsFluidgridsVariant as re } from "../../../hooks/useBillingVariant.js";
|
|
5
7
|
import { directBillingGraphqlRequest as a } from "../../../shared/utils/directBillingGraphql.js";
|
|
8
|
+
import "../../../shared/components/index.js";
|
|
6
9
|
import "../../subscriptions/hooks/index.js";
|
|
7
10
|
import "../../../shared/utils/index.js";
|
|
8
|
-
import { addPayoutAccount as
|
|
9
|
-
import { useBillingAccount as
|
|
10
|
-
import { formatDate as o, formatRelativeTime as
|
|
11
|
+
import { addPayoutAccount as ie, fetchPayoutAccounts as ae } from "../../earnings/api.js";
|
|
12
|
+
import { useBillingAccount as oe, useBillingAccounts as se, useDefaultBillingAccount as ce } from "../../subscriptions/hooks/useSubscriptions.js";
|
|
13
|
+
import { formatDate as o, formatRelativeTime as le } from "../../../shared/utils/format.js";
|
|
11
14
|
import { statusTokens as s } from "../../../shared/utils/tokens.js";
|
|
12
15
|
import { useEffect as c, useState as l } from "react";
|
|
13
16
|
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
14
|
-
import { EmphasisPanel as
|
|
17
|
+
import { EmphasisPanel as p, IllustratedEmptyState as m, PagePurpose as ue } from "@burdenoff/fe-libs/ui";
|
|
15
18
|
// src/billing/modules/credits/pages/CreditWithdrawalPage.tsx
|
|
16
19
|
async function de(e, n) {
|
|
17
20
|
return (await a({
|
|
@@ -34,7 +37,7 @@ async function pe(t, n) {
|
|
|
34
37
|
variables: { billingAccountId: t }
|
|
35
38
|
})).myPayoutRequests.items;
|
|
36
39
|
}
|
|
37
|
-
var
|
|
40
|
+
var h = ({ label: e, value: t, description: n, highlight: r }) => {
|
|
38
41
|
let i = /* @__PURE__ */ f(u, { children: [
|
|
39
42
|
/* @__PURE__ */ d("p", {
|
|
40
43
|
className: "text-sm text-text-secondary",
|
|
@@ -56,7 +59,7 @@ var p = ({ label: e, value: t, description: n, highlight: r }) => {
|
|
|
56
59
|
children: n
|
|
57
60
|
})
|
|
58
61
|
] });
|
|
59
|
-
return r ? /* @__PURE__ */ d(
|
|
62
|
+
return r ? /* @__PURE__ */ d(p, {
|
|
60
63
|
className: "p-5",
|
|
61
64
|
children: i
|
|
62
65
|
}) : /* @__PURE__ */ d("div", {
|
|
@@ -88,8 +91,12 @@ function he(e) {
|
|
|
88
91
|
default: return "bg-bg-sunken text-text-secondary";
|
|
89
92
|
}
|
|
90
93
|
}
|
|
91
|
-
var
|
|
92
|
-
let e = i(), { billingAccounts: t } =
|
|
94
|
+
var ge = () => {
|
|
95
|
+
let e = i(), { billingAccounts: t } = se(), [n, a] = l(void 0), { billingAccount: p, isLoading: ge } = ce(), { billingAccount: _e, isLoading: ve } = oe(n), g = n ? _e : p, ye = n ? ve : ge, { apiGatewayUrl: be, authToken: xe, orgId: Se } = ne(), { emit: _ } = te(), [v, Ce] = l(null), [we, y] = l(!1), [b, x] = l(null), [Te, Ee] = l([]), [De, S] = l(!1), [C, Oe] = l([]), [ke, w] = l(!1), [T, E] = l(""), [D, O] = l(""), [k, A] = l(""), [j, M] = l(!1), [N, P] = l(null), [F, I] = l(!1), L = re(), [Ae, R] = l(!1);
|
|
96
|
+
c(() => {
|
|
97
|
+
F && R(!1);
|
|
98
|
+
}, [F]);
|
|
99
|
+
let [z, B] = l(!1), [V, H] = l({
|
|
93
100
|
label: "",
|
|
94
101
|
type: "BANK_ACCOUNT",
|
|
95
102
|
accountHolderName: "",
|
|
@@ -99,16 +106,16 @@ var m = () => {
|
|
|
99
106
|
upiId: "",
|
|
100
107
|
country: "",
|
|
101
108
|
currency: "USD"
|
|
102
|
-
}), [
|
|
103
|
-
apiGatewayUrl:
|
|
104
|
-
authToken:
|
|
105
|
-
orgId:
|
|
106
|
-
}),
|
|
107
|
-
if (
|
|
109
|
+
}), [U, je] = l(!1), [Me, Ne] = l(null), W = g?.id, G = () => ({
|
|
110
|
+
apiGatewayUrl: be,
|
|
111
|
+
authToken: xe,
|
|
112
|
+
orgId: Se
|
|
113
|
+
}), Pe = async () => {
|
|
114
|
+
if (W) {
|
|
108
115
|
y(!0), x(null);
|
|
109
116
|
try {
|
|
110
|
-
let e = await de(
|
|
111
|
-
|
|
117
|
+
let e = await de(W, G());
|
|
118
|
+
Ce(e);
|
|
112
119
|
} catch (e) {
|
|
113
120
|
x(e instanceof Error ? e.message : "Failed to load balance");
|
|
114
121
|
} finally {
|
|
@@ -116,58 +123,58 @@ var m = () => {
|
|
|
116
123
|
}
|
|
117
124
|
}
|
|
118
125
|
}, K = async () => {
|
|
119
|
-
if (
|
|
126
|
+
if (W) {
|
|
120
127
|
S(!0);
|
|
121
128
|
try {
|
|
122
|
-
let e = await
|
|
123
|
-
|
|
129
|
+
let e = await ae(W, G());
|
|
130
|
+
Ee(e);
|
|
124
131
|
let t = e.find((e) => e.isDefault) ?? e[0];
|
|
125
|
-
t &&
|
|
132
|
+
t && E(t.id);
|
|
126
133
|
} catch {} finally {
|
|
127
134
|
S(!1);
|
|
128
135
|
}
|
|
129
136
|
}
|
|
130
137
|
}, q = async () => {
|
|
131
|
-
if (
|
|
132
|
-
|
|
138
|
+
if (W) {
|
|
139
|
+
w(!0);
|
|
133
140
|
try {
|
|
134
|
-
let e = await pe(
|
|
135
|
-
|
|
141
|
+
let e = await pe(W, G());
|
|
142
|
+
Oe(e);
|
|
136
143
|
} catch {} finally {
|
|
137
|
-
|
|
144
|
+
w(!1);
|
|
138
145
|
}
|
|
139
146
|
}
|
|
140
147
|
};
|
|
141
148
|
c(() => {
|
|
142
|
-
|
|
143
|
-
}, [
|
|
144
|
-
|
|
149
|
+
W && (Pe(), K(), q());
|
|
150
|
+
}, [W]), c(() => {
|
|
151
|
+
g?.currency && H((e) => ({
|
|
145
152
|
...e,
|
|
146
|
-
currency:
|
|
153
|
+
currency: g.currency ?? "USD"
|
|
147
154
|
}));
|
|
148
|
-
}, [
|
|
149
|
-
let
|
|
150
|
-
if (
|
|
151
|
-
|
|
155
|
+
}, [g?.currency]);
|
|
156
|
+
let Fe = async () => {
|
|
157
|
+
if (W) {
|
|
158
|
+
Ne(null), je(!0);
|
|
152
159
|
try {
|
|
153
|
-
let e =
|
|
154
|
-
await
|
|
155
|
-
billingAccountId:
|
|
156
|
-
label:
|
|
157
|
-
type:
|
|
158
|
-
accountHolderName:
|
|
159
|
-
country:
|
|
160
|
-
currency:
|
|
161
|
-
...
|
|
162
|
-
accountNumber:
|
|
163
|
-
...e ? { ifsc:
|
|
160
|
+
let e = V.country.trim().toUpperCase() === "IN" || V.country.trim().toLowerCase() === "india";
|
|
161
|
+
await ie({
|
|
162
|
+
billingAccountId: W,
|
|
163
|
+
label: V.label,
|
|
164
|
+
type: V.type,
|
|
165
|
+
accountHolderName: V.accountHolderName,
|
|
166
|
+
country: V.country || void 0,
|
|
167
|
+
currency: V.currency,
|
|
168
|
+
...V.type === "BANK_ACCOUNT" && {
|
|
169
|
+
accountNumber: V.accountNumber,
|
|
170
|
+
...e ? { ifsc: V.ifscCode } : { routingNumber: V.routingNumber }
|
|
164
171
|
},
|
|
165
|
-
...
|
|
166
|
-
},
|
|
172
|
+
...V.type === "UPI" && { upiId: V.upiId }
|
|
173
|
+
}, G()), _("billing.payout_account.added", {
|
|
167
174
|
route: "/billing/credits/withdraw",
|
|
168
|
-
entityId:
|
|
175
|
+
entityId: W,
|
|
169
176
|
source: "credit-withdrawal"
|
|
170
|
-
}), await K(),
|
|
177
|
+
}), await K(), B(!1), H({
|
|
171
178
|
label: "",
|
|
172
179
|
type: "BANK_ACCOUNT",
|
|
173
180
|
accountHolderName: "",
|
|
@@ -179,42 +186,42 @@ var m = () => {
|
|
|
179
186
|
currency: "USD"
|
|
180
187
|
});
|
|
181
188
|
} catch (e) {
|
|
182
|
-
|
|
189
|
+
Ne(e instanceof Error ? e.message : "Failed to add account");
|
|
183
190
|
} finally {
|
|
184
|
-
|
|
191
|
+
je(!1);
|
|
185
192
|
}
|
|
186
193
|
}
|
|
187
|
-
},
|
|
188
|
-
if (!
|
|
189
|
-
let e = parseFloat(
|
|
194
|
+
}, Ie = async () => {
|
|
195
|
+
if (!W || !T) return;
|
|
196
|
+
let e = parseFloat(D);
|
|
190
197
|
if (!(!e || e <= 0)) {
|
|
191
|
-
|
|
198
|
+
P(null), M(!0);
|
|
192
199
|
try {
|
|
193
200
|
let t = await fe({
|
|
194
|
-
billingAccountId:
|
|
201
|
+
billingAccountId: W,
|
|
195
202
|
creditAmount: e,
|
|
196
|
-
payoutAccountId:
|
|
197
|
-
notes:
|
|
198
|
-
},
|
|
203
|
+
payoutAccountId: T,
|
|
204
|
+
notes: k || void 0
|
|
205
|
+
}, G());
|
|
199
206
|
_("billing.credits.withdrawal_requested", {
|
|
200
207
|
route: "/billing/credits/withdraw",
|
|
201
208
|
entityId: t.id,
|
|
202
209
|
source: "credit-withdrawal",
|
|
203
210
|
amount: e
|
|
204
|
-
}),
|
|
211
|
+
}), I(!0), O(""), A(""), await Pe(), await q();
|
|
205
212
|
} catch (e) {
|
|
206
|
-
|
|
213
|
+
P(e instanceof Error ? e.message : "Withdrawal request failed");
|
|
207
214
|
} finally {
|
|
208
|
-
|
|
215
|
+
M(!1);
|
|
209
216
|
}
|
|
210
217
|
}
|
|
211
|
-
}, J =
|
|
218
|
+
}, J = g?.currency ?? "USD", Y = parseFloat(D) || 0, { data: Le, loading: Re } = r({
|
|
212
219
|
variables: {
|
|
213
220
|
creditAmount: Y,
|
|
214
221
|
currency: J
|
|
215
222
|
},
|
|
216
|
-
skip: Y <= 0 || !
|
|
217
|
-
}),
|
|
223
|
+
skip: Y <= 0 || !g
|
|
224
|
+
}), ze = Le?.getCostOfCredits?.amount;
|
|
218
225
|
if (!e.canWithdrawCredits) return /* @__PURE__ */ d("div", {
|
|
219
226
|
className: "flex items-center justify-center h-full min-h-[400px]",
|
|
220
227
|
children: /* @__PURE__ */ f("div", {
|
|
@@ -246,7 +253,7 @@ var m = () => {
|
|
|
246
253
|
]
|
|
247
254
|
})
|
|
248
255
|
});
|
|
249
|
-
if (!
|
|
256
|
+
if (!ye && !g) return /* @__PURE__ */ d("div", {
|
|
250
257
|
className: "flex items-center justify-center h-full min-h-[400px]",
|
|
251
258
|
children: /* @__PURE__ */ f("div", {
|
|
252
259
|
className: "text-center space-y-2",
|
|
@@ -259,7 +266,7 @@ var m = () => {
|
|
|
259
266
|
})]
|
|
260
267
|
})
|
|
261
268
|
});
|
|
262
|
-
if (
|
|
269
|
+
if (ye && !g) return /* @__PURE__ */ f("div", {
|
|
263
270
|
className: "space-y-6 px-6 lg:px-8 py-6",
|
|
264
271
|
children: [/* @__PURE__ */ d("div", { className: "h-8 w-64 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ d("div", {
|
|
265
272
|
className: "grid grid-cols-2 lg:grid-cols-4 gap-4",
|
|
@@ -274,10 +281,28 @@ var m = () => {
|
|
|
274
281
|
}, e))
|
|
275
282
|
})]
|
|
276
283
|
});
|
|
277
|
-
let X = v?.withdrawable ?? 0, Z = .005,
|
|
284
|
+
let X = v?.withdrawable ?? 0, Z = .005, Be = Y > 0 && Y <= X + Z, Q = Te.filter((e) => e.status !== "ARCHIVED"), $ = j ? null : Q.length === 0 ? "Add a payout method above before requesting a withdrawal." : T ? Y > 0 ? Y > X + Z ? `Amount exceeds your withdrawable balance of ${X.toLocaleString()} credits.` : null : "Enter an amount to withdraw." : "Select a payout method above.";
|
|
278
285
|
return /* @__PURE__ */ f("div", {
|
|
279
286
|
className: "space-y-6 px-6 lg:px-8 py-6",
|
|
280
287
|
children: [
|
|
288
|
+
L && /* @__PURE__ */ d(ee, {
|
|
289
|
+
open: Ae,
|
|
290
|
+
title: "Review your withdrawal",
|
|
291
|
+
description: "These credits are converted to a payout when you confirm.",
|
|
292
|
+
details: [{
|
|
293
|
+
label: "Credits",
|
|
294
|
+
value: D
|
|
295
|
+
}, {
|
|
296
|
+
label: "Paid to",
|
|
297
|
+
value: Q.find((e) => e.id === T)?.label ?? ""
|
|
298
|
+
}],
|
|
299
|
+
confirmLabel: "Request withdrawal",
|
|
300
|
+
busyLabel: "Requesting…",
|
|
301
|
+
isBusy: j,
|
|
302
|
+
error: N,
|
|
303
|
+
onConfirm: () => void Ie(),
|
|
304
|
+
onCancel: () => R(!1)
|
|
305
|
+
}),
|
|
281
306
|
/* @__PURE__ */ f("div", {
|
|
282
307
|
className: "flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",
|
|
283
308
|
children: [/* @__PURE__ */ f("div", { children: [
|
|
@@ -294,7 +319,7 @@ var m = () => {
|
|
|
294
319
|
children: "Turn the credits you bought or earned (from sales and referrals) back into real money. Add a bank account or UPI as a payout destination, request a withdrawal for any amount up to your withdrawable balance, and track each request here until it is paid. Granted credits (coupons, admin grants) are not withdrawable."
|
|
295
320
|
})
|
|
296
321
|
] }), t.length > 1 && /* @__PURE__ */ d("select", {
|
|
297
|
-
value:
|
|
322
|
+
value: g?.id ?? "",
|
|
298
323
|
onChange: (e) => a(e.target.value),
|
|
299
324
|
"aria-label": "Switch billing account",
|
|
300
325
|
className: "px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] w-full sm:min-w-[200px] sm:w-auto",
|
|
@@ -306,7 +331,7 @@ var m = () => {
|
|
|
306
331
|
}),
|
|
307
332
|
/* @__PURE__ */ d("div", {
|
|
308
333
|
className: "grid grid-cols-2 lg:grid-cols-4 gap-4",
|
|
309
|
-
children:
|
|
334
|
+
children: we ? [
|
|
310
335
|
1,
|
|
311
336
|
2,
|
|
312
337
|
3,
|
|
@@ -318,22 +343,22 @@ var m = () => {
|
|
|
318
343
|
className: "col-span-4 text-sm text-status-error-text",
|
|
319
344
|
children: b
|
|
320
345
|
}) : /* @__PURE__ */ f(u, { children: [
|
|
321
|
-
/* @__PURE__ */ d(
|
|
346
|
+
/* @__PURE__ */ d(h, {
|
|
322
347
|
label: "Purchased",
|
|
323
348
|
value: v?.purchased ?? 0,
|
|
324
349
|
description: "From credit purchases"
|
|
325
350
|
}),
|
|
326
|
-
/* @__PURE__ */ d(
|
|
351
|
+
/* @__PURE__ */ d(h, {
|
|
327
352
|
label: "Earned",
|
|
328
353
|
value: v?.earned ?? 0,
|
|
329
354
|
description: "From sales & referrals"
|
|
330
355
|
}),
|
|
331
|
-
/* @__PURE__ */ d(
|
|
356
|
+
/* @__PURE__ */ d(h, {
|
|
332
357
|
label: "Granted",
|
|
333
358
|
value: v?.granted ?? 0,
|
|
334
359
|
description: "Coupons & admin grants — non-withdrawable"
|
|
335
360
|
}),
|
|
336
|
-
/* @__PURE__ */ d(
|
|
361
|
+
/* @__PURE__ */ d(h, {
|
|
337
362
|
label: "Withdrawable",
|
|
338
363
|
value: X,
|
|
339
364
|
description: "Purchased + earned",
|
|
@@ -341,7 +366,7 @@ var m = () => {
|
|
|
341
366
|
})
|
|
342
367
|
] })
|
|
343
368
|
}),
|
|
344
|
-
|
|
369
|
+
F && /* @__PURE__ */ f("div", {
|
|
345
370
|
className: "flex items-center gap-3 p-4 rounded-lg bg-status-success-bg-subtle border border-status-success-border text-status-success-text",
|
|
346
371
|
children: [
|
|
347
372
|
/* @__PURE__ */ d("svg", {
|
|
@@ -365,7 +390,7 @@ var m = () => {
|
|
|
365
390
|
})] }),
|
|
366
391
|
/* @__PURE__ */ d("button", {
|
|
367
392
|
type: "button",
|
|
368
|
-
onClick: () =>
|
|
393
|
+
onClick: () => I(!1),
|
|
369
394
|
className: "ml-auto text-current opacity-60 hover:opacity-100",
|
|
370
395
|
children: /* @__PURE__ */ d("svg", {
|
|
371
396
|
className: "size-4",
|
|
@@ -394,12 +419,12 @@ var m = () => {
|
|
|
394
419
|
children: "Payout Account"
|
|
395
420
|
}), /* @__PURE__ */ d("button", {
|
|
396
421
|
type: "button",
|
|
397
|
-
onClick: () =>
|
|
422
|
+
onClick: () => B((e) => !e),
|
|
398
423
|
className: "text-sm text-text-link hover:underline",
|
|
399
|
-
children:
|
|
424
|
+
children: z ? "Cancel" : "+ Add new"
|
|
400
425
|
})]
|
|
401
426
|
}),
|
|
402
|
-
|
|
427
|
+
z && /* @__PURE__ */ f("div", {
|
|
403
428
|
className: "border border-border-subtle rounded-lg p-4 space-y-3 bg-bg-sunken",
|
|
404
429
|
children: [
|
|
405
430
|
/* @__PURE__ */ d("h3", {
|
|
@@ -411,8 +436,8 @@ var m = () => {
|
|
|
411
436
|
children: "Label"
|
|
412
437
|
}), /* @__PURE__ */ d("input", {
|
|
413
438
|
type: "text",
|
|
414
|
-
value:
|
|
415
|
-
onChange: (e) =>
|
|
439
|
+
value: V.label,
|
|
440
|
+
onChange: (e) => H((t) => ({
|
|
416
441
|
...t,
|
|
417
442
|
label: e.target.value
|
|
418
443
|
})),
|
|
@@ -424,8 +449,8 @@ var m = () => {
|
|
|
424
449
|
children: "Account Holder Name"
|
|
425
450
|
}), /* @__PURE__ */ d("input", {
|
|
426
451
|
type: "text",
|
|
427
|
-
value:
|
|
428
|
-
onChange: (e) =>
|
|
452
|
+
value: V.accountHolderName,
|
|
453
|
+
onChange: (e) => H((t) => ({
|
|
429
454
|
...t,
|
|
430
455
|
accountHolderName: e.target.value
|
|
431
456
|
})),
|
|
@@ -438,8 +463,8 @@ var m = () => {
|
|
|
438
463
|
className: "block text-xs text-text-secondary mb-1",
|
|
439
464
|
children: "Type"
|
|
440
465
|
}), /* @__PURE__ */ f("select", {
|
|
441
|
-
value:
|
|
442
|
-
onChange: (e) =>
|
|
466
|
+
value: V.type,
|
|
467
|
+
onChange: (e) => H((t) => ({
|
|
443
468
|
...t,
|
|
444
469
|
type: e.target.value
|
|
445
470
|
})),
|
|
@@ -456,8 +481,8 @@ var m = () => {
|
|
|
456
481
|
children: "Country"
|
|
457
482
|
}), /* @__PURE__ */ d("input", {
|
|
458
483
|
type: "text",
|
|
459
|
-
value:
|
|
460
|
-
onChange: (e) =>
|
|
484
|
+
value: V.country,
|
|
485
|
+
onChange: (e) => H((t) => ({
|
|
461
486
|
...t,
|
|
462
487
|
country: e.target.value
|
|
463
488
|
})),
|
|
@@ -465,25 +490,25 @@ var m = () => {
|
|
|
465
490
|
className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
466
491
|
})] })]
|
|
467
492
|
}),
|
|
468
|
-
|
|
493
|
+
V.type === "BANK_ACCOUNT" && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
|
|
469
494
|
className: "block text-xs text-text-secondary mb-1",
|
|
470
495
|
children: "Account Number"
|
|
471
496
|
}), /* @__PURE__ */ d("input", {
|
|
472
497
|
type: "text",
|
|
473
|
-
value:
|
|
474
|
-
onChange: (e) =>
|
|
498
|
+
value: V.accountNumber,
|
|
499
|
+
onChange: (e) => H((t) => ({
|
|
475
500
|
...t,
|
|
476
501
|
accountNumber: e.target.value
|
|
477
502
|
})),
|
|
478
503
|
placeholder: "Account number",
|
|
479
504
|
className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
480
|
-
})] }),
|
|
505
|
+
})] }), V.country.trim().toUpperCase() === "IN" || V.country.trim().toLowerCase() === "india" ? /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
|
|
481
506
|
className: "block text-xs text-text-secondary mb-1",
|
|
482
507
|
children: "IFSC Code"
|
|
483
508
|
}), /* @__PURE__ */ d("input", {
|
|
484
509
|
type: "text",
|
|
485
|
-
value:
|
|
486
|
-
onChange: (e) =>
|
|
510
|
+
value: V.ifscCode,
|
|
511
|
+
onChange: (e) => H((t) => ({
|
|
487
512
|
...t,
|
|
488
513
|
ifscCode: e.target.value.toUpperCase()
|
|
489
514
|
})),
|
|
@@ -494,50 +519,50 @@ var m = () => {
|
|
|
494
519
|
children: "Routing Number"
|
|
495
520
|
}), /* @__PURE__ */ d("input", {
|
|
496
521
|
type: "text",
|
|
497
|
-
value:
|
|
498
|
-
onChange: (e) =>
|
|
522
|
+
value: V.routingNumber,
|
|
523
|
+
onChange: (e) => H((t) => ({
|
|
499
524
|
...t,
|
|
500
525
|
routingNumber: e.target.value
|
|
501
526
|
})),
|
|
502
527
|
placeholder: "Routing / sort code",
|
|
503
528
|
className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
504
529
|
})] })] }),
|
|
505
|
-
|
|
530
|
+
V.type === "UPI" && /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
|
|
506
531
|
className: "block text-xs text-text-secondary mb-1",
|
|
507
532
|
children: "UPI ID"
|
|
508
533
|
}), /* @__PURE__ */ d("input", {
|
|
509
534
|
type: "text",
|
|
510
|
-
value:
|
|
511
|
-
onChange: (e) =>
|
|
535
|
+
value: V.upiId,
|
|
536
|
+
onChange: (e) => H((t) => ({
|
|
512
537
|
...t,
|
|
513
538
|
upiId: e.target.value
|
|
514
539
|
})),
|
|
515
540
|
placeholder: "yourname@upi",
|
|
516
541
|
className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
517
542
|
})] }),
|
|
518
|
-
|
|
543
|
+
Me && /* @__PURE__ */ d("p", {
|
|
519
544
|
className: "text-xs text-status-error-text",
|
|
520
|
-
children:
|
|
545
|
+
children: Me
|
|
521
546
|
}),
|
|
522
547
|
/* @__PURE__ */ d("button", {
|
|
523
548
|
type: "button",
|
|
524
|
-
onClick: () => void
|
|
525
|
-
disabled:
|
|
549
|
+
onClick: () => void Fe(),
|
|
550
|
+
disabled: U || !V.label || !V.accountHolderName,
|
|
526
551
|
className: "w-full py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
|
|
527
|
-
children:
|
|
552
|
+
children: U ? "Saving…" : "Save Account"
|
|
528
553
|
})
|
|
529
554
|
]
|
|
530
555
|
}),
|
|
531
|
-
|
|
556
|
+
De ? /* @__PURE__ */ d("div", {
|
|
532
557
|
className: "space-y-2",
|
|
533
558
|
children: [1, 2].map((e) => /* @__PURE__ */ d("div", { className: "h-16 border border-border-subtle rounded-lg bg-bg-sunken animate-pulse" }, e))
|
|
534
|
-
}) : Q.length === 0 && !
|
|
559
|
+
}) : Q.length === 0 && !z ? /* @__PURE__ */ d(m, {
|
|
535
560
|
illustration: "empty-generic",
|
|
536
561
|
title: "No payout accounts yet",
|
|
537
562
|
description: "Add a bank account or UPI to receive your withdrawn credits.",
|
|
538
563
|
action: /* @__PURE__ */ d("button", {
|
|
539
564
|
type: "button",
|
|
540
|
-
onClick: () =>
|
|
565
|
+
onClick: () => B(!0),
|
|
541
566
|
className: "px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors",
|
|
542
567
|
children: "Add a bank account or UPI"
|
|
543
568
|
})
|
|
@@ -545,8 +570,8 @@ var m = () => {
|
|
|
545
570
|
className: "space-y-2",
|
|
546
571
|
children: Q.map((e) => /* @__PURE__ */ d("button", {
|
|
547
572
|
type: "button",
|
|
548
|
-
onClick: () =>
|
|
549
|
-
className: `w-full text-left p-4 border rounded-lg transition-colors ${
|
|
573
|
+
onClick: () => E(e.id),
|
|
574
|
+
className: `w-full text-left p-4 border rounded-lg transition-colors ${T === e.id ? "border-border-strong bg-[var(--color-accent-soft)]" : "border-border-subtle bg-bg-surface hover:border-border-strong"}`,
|
|
550
575
|
children: /* @__PURE__ */ f("div", {
|
|
551
576
|
className: "flex items-center justify-between",
|
|
552
577
|
children: [/* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("p", {
|
|
@@ -571,7 +596,7 @@ var m = () => {
|
|
|
571
596
|
className: `text-xs px-2 py-0.5 rounded font-medium ${e.status === "ACTIVE" ? `${s.success.bg} ${s.success.text}` : e.status === "PENDING_VERIFICATION" ? `${s.warning.bg} ${s.warning.text}` : `${s.error.bg} ${s.error.text}`}`,
|
|
572
597
|
children: e.status.replaceAll("_", " ").toLowerCase()
|
|
573
598
|
}),
|
|
574
|
-
|
|
599
|
+
T === e.id && /* @__PURE__ */ d("svg", {
|
|
575
600
|
className: "size-4 text-text-link shrink-0",
|
|
576
601
|
fill: "none",
|
|
577
602
|
viewBox: "0 0 24 24",
|
|
@@ -607,8 +632,8 @@ var m = () => {
|
|
|
607
632
|
min: 1,
|
|
608
633
|
max: X,
|
|
609
634
|
step: 1,
|
|
610
|
-
value:
|
|
611
|
-
onChange: (e) =>
|
|
635
|
+
value: D,
|
|
636
|
+
onChange: (e) => O(e.target.value),
|
|
612
637
|
placeholder: "Enter credit amount",
|
|
613
638
|
className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
614
639
|
}),
|
|
@@ -625,12 +650,12 @@ var m = () => {
|
|
|
625
650
|
}),
|
|
626
651
|
Y > 0 && Y <= X + Z && /* @__PURE__ */ d("p", {
|
|
627
652
|
className: "text-xs text-text-secondary mt-1",
|
|
628
|
-
children:
|
|
653
|
+
children: Re ? "Calculating…" : ze == null ? null : /* @__PURE__ */ f(u, { children: [
|
|
629
654
|
"Estimated payout:",
|
|
630
655
|
" ",
|
|
631
656
|
/* @__PURE__ */ d("span", {
|
|
632
657
|
className: "font-semibold text-text-primary",
|
|
633
|
-
children:
|
|
658
|
+
children: ze.toLocaleString(void 0, {
|
|
634
659
|
style: "currency",
|
|
635
660
|
currency: J,
|
|
636
661
|
minimumFractionDigits: 2,
|
|
@@ -653,17 +678,17 @@ var m = () => {
|
|
|
653
678
|
children: "(optional)"
|
|
654
679
|
})]
|
|
655
680
|
}), /* @__PURE__ */ d("textarea", {
|
|
656
|
-
value:
|
|
657
|
-
onChange: (e) =>
|
|
681
|
+
value: k,
|
|
682
|
+
onChange: (e) => A(e.target.value),
|
|
658
683
|
placeholder: "Any notes for this withdrawal request",
|
|
659
684
|
rows: 2,
|
|
660
685
|
className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] resize-none"
|
|
661
686
|
})] }),
|
|
662
|
-
|
|
687
|
+
N && /* @__PURE__ */ d("div", {
|
|
663
688
|
className: "p-3 rounded-button bg-status-error-bg-subtle border border-status-error-border",
|
|
664
689
|
children: /* @__PURE__ */ d("p", {
|
|
665
690
|
className: "text-sm text-status-error-text",
|
|
666
|
-
children:
|
|
691
|
+
children: N
|
|
667
692
|
})
|
|
668
693
|
}),
|
|
669
694
|
/* @__PURE__ */ f("div", {
|
|
@@ -683,10 +708,12 @@ var m = () => {
|
|
|
683
708
|
}),
|
|
684
709
|
/* @__PURE__ */ d("button", {
|
|
685
710
|
type: "button",
|
|
686
|
-
onClick: () =>
|
|
687
|
-
|
|
711
|
+
onClick: () => {
|
|
712
|
+
L ? (P(null), I(!1), R(!0)) : Ie();
|
|
713
|
+
},
|
|
714
|
+
disabled: j || !Be || !T || Q.length === 0,
|
|
688
715
|
className: "w-full py-2.5 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
|
|
689
|
-
children:
|
|
716
|
+
children: j ? "Submitting…" : "Request Withdrawal"
|
|
690
717
|
})
|
|
691
718
|
]
|
|
692
719
|
})
|
|
@@ -719,14 +746,14 @@ var m = () => {
|
|
|
719
746
|
})
|
|
720
747
|
})
|
|
721
748
|
})]
|
|
722
|
-
}),
|
|
749
|
+
}), ke ? /* @__PURE__ */ d("div", {
|
|
723
750
|
className: "space-y-2",
|
|
724
751
|
children: [
|
|
725
752
|
1,
|
|
726
753
|
2,
|
|
727
754
|
3
|
|
728
755
|
].map((e) => /* @__PURE__ */ d("div", { className: "h-16 border border-border-subtle rounded-lg bg-bg-sunken animate-pulse" }, e))
|
|
729
|
-
}) :
|
|
756
|
+
}) : C.length === 0 ? /* @__PURE__ */ d(m, {
|
|
730
757
|
illustration: "empty-data",
|
|
731
758
|
title: "No withdrawal requests yet",
|
|
732
759
|
description: "Once you request a withdrawal, its status will appear here."
|
|
@@ -760,7 +787,7 @@ var m = () => {
|
|
|
760
787
|
] })
|
|
761
788
|
}), /* @__PURE__ */ d("tbody", {
|
|
762
789
|
className: "divide-y divide-border-subtle",
|
|
763
|
-
children:
|
|
790
|
+
children: C.map((e) => /* @__PURE__ */ f("tr", {
|
|
764
791
|
className: "hover:bg-bg-sunken transition-colors",
|
|
765
792
|
children: [
|
|
766
793
|
/* @__PURE__ */ f("td", {
|
|
@@ -790,7 +817,7 @@ var m = () => {
|
|
|
790
817
|
className: "px-4 py-3 text-text-secondary hidden md:table-cell",
|
|
791
818
|
children: /* @__PURE__ */ d("span", {
|
|
792
819
|
title: o(e.createdAt, "long"),
|
|
793
|
-
children:
|
|
820
|
+
children: le(e.createdAt)
|
|
794
821
|
})
|
|
795
822
|
}),
|
|
796
823
|
/* @__PURE__ */ d("td", {
|
|
@@ -809,6 +836,6 @@ var m = () => {
|
|
|
809
836
|
]
|
|
810
837
|
});
|
|
811
838
|
};
|
|
812
|
-
export {
|
|
839
|
+
export { ge as CreditWithdrawalPage };
|
|
813
840
|
|
|
814
841
|
//# sourceMappingURL=CreditWithdrawalPage.js.map
|