@burdenoff/microfe-billing 2026.516.1 → 2026.517.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/billing/BillingUserRoutes.js +1 -1
- package/dist/billing/BillingUserRoutes.js.map +1 -1
- package/dist/billing/modules/billing/hooks/useInvoices.d.ts +0 -1
- package/dist/billing/modules/billing/hooks/useInvoices.d.ts.map +1 -1
- package/dist/billing/modules/billing/hooks/useInvoices.js +20 -26
- package/dist/billing/modules/billing/hooks/useInvoices.js.map +1 -1
- package/dist/billing/modules/billing/pages/InvoicesListPage.d.ts.map +1 -1
- package/dist/billing/modules/billing/pages/InvoicesListPage.js +176 -170
- package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/RefundsPage.js +1 -1
- package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
- package/dist/billing/modules/checkout/components/OrderSummary.js +4 -4
- package/dist/billing/modules/checkout/components/OrderSummary.js.map +1 -1
- package/dist/billing/modules/checkout/pages/CheckoutPage.d.ts.map +1 -1
- package/dist/billing/modules/checkout/pages/CheckoutPage.js +2 -2
- package/dist/billing/modules/checkout/pages/CheckoutPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.d.ts.map +1 -1
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +178 -209
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
- package/dist/billing/modules/dashboard/pages/OverviewPage.js +2 -2
- package/dist/billing/modules/dashboard/pages/OverviewPage.js.map +1 -1
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js +2 -2
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -1
- package/dist/billing/modules/earnings/api.d.ts +0 -4
- package/dist/billing/modules/earnings/api.d.ts.map +1 -1
- package/dist/billing/modules/earnings/api.js +10 -14
- package/dist/billing/modules/earnings/api.js.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.d.ts.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.js +233 -523
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaPage.js +1 -1
- package/dist/billing/modules/quota/pages/QuotaPage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.d.ts.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js +44 -101
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.d.ts.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js +46 -105
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/hooks/useSubscriptions.d.ts +1 -1
- package/dist/billing/modules/subscriptions/hooks/useSubscriptions.d.ts.map +1 -1
- package/dist/billing/modules/subscriptions/hooks/useSubscriptions.js +15 -16
- package/dist/billing/modules/subscriptions/hooks/useSubscriptions.js.map +1 -1
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.d.ts.map +1 -1
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js +165 -158
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js.map +1 -1
- package/dist/billing/modules/usage/pages/UsagePage.d.ts.map +1 -1
- package/dist/billing/modules/usage/pages/UsagePage.js +3 -3
- package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
- package/dist/billing/shared/types/graphql.d.ts +0 -2
- package/dist/billing/shared/types/graphql.d.ts.map +1 -1
- package/dist/billing/shared/types/graphql.js.map +1 -1
- package/dist/generated/global-operations.d.ts +0 -48
- package/dist/generated/global-operations.d.ts.map +1 -1
- package/dist/generated/global-operations.js +293 -310
- package/dist/generated/global-operations.js.map +1 -1
- package/dist/generated/global-types.d.ts +0 -9
- package/dist/generated/global-types.d.ts.map +1 -1
- package/dist/generated/global-types.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,32 +4,32 @@ import { useBillingEventEmitter as n } from "../../../hooks/useBillingEventEmitt
|
|
|
4
4
|
import { formatDate as r, formatRelativeTime as ee } from "../../../shared/utils/format.js";
|
|
5
5
|
import { directBillingGraphqlRequest as i } from "../../../shared/utils/directBillingGraphql.js";
|
|
6
6
|
import "../../../shared/utils/index.js";
|
|
7
|
-
import { useBillingPermissions as
|
|
8
|
-
import { CreditWithdrawalHistoryDocument as
|
|
9
|
-
import { useDefaultBillingAccount as
|
|
7
|
+
import { useBillingPermissions as a } from "../../../hooks/useBillingPermissions.js";
|
|
8
|
+
import { CreditWithdrawalHistoryDocument as o, GetCreditBalanceByTypeDocument as s, RequestCreditWithdrawalDocument as c } from "../../../../generated/global-operations.js";
|
|
9
|
+
import { useDefaultBillingAccount as te } from "../../subscriptions/hooks/useSubscriptions.js";
|
|
10
10
|
import "../../subscriptions/hooks/index.js";
|
|
11
|
-
import { addPayoutAccount as
|
|
12
|
-
import { useEffect as
|
|
11
|
+
import { addPayoutAccount as l, fetchPayoutAccounts as ne } from "../../earnings/api.js";
|
|
12
|
+
import { useEffect as re, useState as u } from "react";
|
|
13
13
|
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
14
14
|
//#region src/billing/modules/credits/pages/CreditWithdrawalPage.tsx
|
|
15
|
-
async function
|
|
15
|
+
async function ie(e, t) {
|
|
16
16
|
return (await i({
|
|
17
17
|
...t,
|
|
18
|
-
query:
|
|
18
|
+
query: s,
|
|
19
19
|
variables: { billingAccountId: e }
|
|
20
20
|
})).getCreditBalanceByType;
|
|
21
21
|
}
|
|
22
|
-
async function
|
|
22
|
+
async function ae(e, t) {
|
|
23
23
|
return (await i({
|
|
24
24
|
...t,
|
|
25
|
-
query:
|
|
25
|
+
query: c,
|
|
26
26
|
variables: { input: e }
|
|
27
27
|
})).requestCreditWithdrawal;
|
|
28
28
|
}
|
|
29
|
-
async function
|
|
29
|
+
async function oe(e, t) {
|
|
30
30
|
return (await i({
|
|
31
31
|
...t,
|
|
32
|
-
query:
|
|
32
|
+
query: o,
|
|
33
33
|
variables: { billingAccountId: e }
|
|
34
34
|
})).myPayoutRequests.items;
|
|
35
35
|
}
|
|
@@ -57,7 +57,7 @@ var m = ({ label: e, value: t, description: n, highlight: r }) => /* @__PURE__ *
|
|
|
57
57
|
})
|
|
58
58
|
]
|
|
59
59
|
});
|
|
60
|
-
function
|
|
60
|
+
function se(e) {
|
|
61
61
|
switch (e.toUpperCase()) {
|
|
62
62
|
case "PAID": return t.success.text;
|
|
63
63
|
case "APPROVED":
|
|
@@ -69,7 +69,7 @@ function ce(e) {
|
|
|
69
69
|
default: return "text-muted-foreground";
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function ce(e) {
|
|
73
73
|
switch (e.toUpperCase()) {
|
|
74
74
|
case "PAID": return `${t.success.bg} ${t.success.text}`;
|
|
75
75
|
case "APPROVED":
|
|
@@ -82,129 +82,111 @@ function le(e) {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
var h = () => {
|
|
85
|
-
let i =
|
|
85
|
+
let i = a(), { billingAccount: o, isLoading: s } = te(), { apiGatewayUrl: c, authToken: h, orgId: g } = e(), { emit: _ } = n(), [v, le] = u(null), [ue, y] = u(!1), [b, x] = u(null), [de, fe] = u([]), [pe, S] = u(!1), [C, me] = u([]), [w, T] = u(!1), [E, D] = u(""), [O, k] = u(""), [A, j] = u(""), [M, N] = u(!1), [P, F] = u(null), [I, L] = u(!1), [R, z] = u(!1), [B, V] = u({
|
|
86
86
|
label: "",
|
|
87
87
|
type: "BANK_ACCOUNT",
|
|
88
|
-
accountHolderName: "",
|
|
89
88
|
accountNumber: "",
|
|
90
89
|
ifscCode: "",
|
|
91
90
|
routingNumber: "",
|
|
92
91
|
upiId: "",
|
|
93
|
-
country: "",
|
|
92
|
+
country: "IN",
|
|
94
93
|
currency: "USD"
|
|
95
|
-
}), [
|
|
96
|
-
apiGatewayUrl:
|
|
94
|
+
}), [H, U] = u(!1), [W, G] = u(null), K = o?.id, q = () => ({
|
|
95
|
+
apiGatewayUrl: c,
|
|
97
96
|
authToken: h,
|
|
98
|
-
orgId:
|
|
99
|
-
}),
|
|
100
|
-
if (
|
|
101
|
-
|
|
97
|
+
orgId: g
|
|
98
|
+
}), J = async () => {
|
|
99
|
+
if (K) {
|
|
100
|
+
y(!0), x(null);
|
|
102
101
|
try {
|
|
103
|
-
|
|
102
|
+
le(await ie(K, q()));
|
|
104
103
|
} catch (e) {
|
|
105
|
-
|
|
104
|
+
x(e instanceof Error ? e.message : "Failed to load balance");
|
|
106
105
|
} finally {
|
|
107
|
-
|
|
106
|
+
y(!1);
|
|
108
107
|
}
|
|
109
108
|
}
|
|
110
|
-
},
|
|
111
|
-
if (
|
|
112
|
-
|
|
109
|
+
}, Y = async () => {
|
|
110
|
+
if (K) {
|
|
111
|
+
S(!0);
|
|
113
112
|
try {
|
|
114
|
-
let e = await
|
|
115
|
-
|
|
113
|
+
let e = await ne(K, q());
|
|
114
|
+
fe(e);
|
|
116
115
|
let t = e.find((e) => e.isDefault) ?? e[0];
|
|
117
|
-
t &&
|
|
116
|
+
t && D(t.id);
|
|
118
117
|
} catch {} finally {
|
|
119
|
-
|
|
118
|
+
S(!1);
|
|
120
119
|
}
|
|
121
120
|
}
|
|
122
|
-
},
|
|
123
|
-
if (
|
|
124
|
-
|
|
121
|
+
}, X = async () => {
|
|
122
|
+
if (K) {
|
|
123
|
+
T(!0);
|
|
125
124
|
try {
|
|
126
|
-
|
|
125
|
+
me(await oe(K, q()));
|
|
127
126
|
} catch {} finally {
|
|
128
|
-
|
|
127
|
+
T(!1);
|
|
129
128
|
}
|
|
130
129
|
}
|
|
131
130
|
};
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}, [
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}));
|
|
139
|
-
}, [a?.currency]);
|
|
140
|
-
let ye = async () => {
|
|
141
|
-
if (U) {
|
|
142
|
-
H(null), B(!0);
|
|
131
|
+
re(() => {
|
|
132
|
+
K && (J(), Y(), X());
|
|
133
|
+
}, [K]);
|
|
134
|
+
let he = async () => {
|
|
135
|
+
if (K) {
|
|
136
|
+
G(null), U(!0);
|
|
143
137
|
try {
|
|
144
|
-
let e =
|
|
145
|
-
await
|
|
146
|
-
billingAccountId:
|
|
147
|
-
label:
|
|
148
|
-
type:
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
accountNumber: L.accountNumber,
|
|
154
|
-
...e ? { ifsc: L.ifscCode } : { routingNumber: L.routingNumber }
|
|
155
|
-
},
|
|
156
|
-
...L.type === "UPI" && { upiId: L.upiId }
|
|
157
|
-
}, W()), g("billing.payout_account.added", {
|
|
138
|
+
let e = {};
|
|
139
|
+
B.type === "BANK_ACCOUNT" ? B.country === "IN" ? (e.accountNumber = B.accountNumber, e.ifscCode = B.ifscCode) : (e.accountNumber = B.accountNumber, e.routingNumber = B.routingNumber) : B.type === "UPI" && (e.upiId = B.upiId), await l({
|
|
140
|
+
billingAccountId: K,
|
|
141
|
+
label: B.label,
|
|
142
|
+
type: B.type,
|
|
143
|
+
country: B.country,
|
|
144
|
+
currency: B.currency,
|
|
145
|
+
accountDetails: e
|
|
146
|
+
}, q()), _("billing.payout_account.added", {
|
|
158
147
|
route: "/billing/credits/withdraw",
|
|
159
|
-
entityId:
|
|
148
|
+
entityId: K,
|
|
160
149
|
source: "credit-withdrawal"
|
|
161
|
-
}), await
|
|
150
|
+
}), await Y(), z(!1), V({
|
|
162
151
|
label: "",
|
|
163
152
|
type: "BANK_ACCOUNT",
|
|
164
|
-
accountHolderName: "",
|
|
165
153
|
accountNumber: "",
|
|
166
154
|
ifscCode: "",
|
|
167
155
|
routingNumber: "",
|
|
168
156
|
upiId: "",
|
|
169
|
-
country: "",
|
|
157
|
+
country: "IN",
|
|
170
158
|
currency: "USD"
|
|
171
159
|
});
|
|
172
160
|
} catch (e) {
|
|
173
|
-
|
|
161
|
+
G(e instanceof Error ? e.message : "Failed to add account");
|
|
174
162
|
} finally {
|
|
175
|
-
|
|
163
|
+
U(!1);
|
|
176
164
|
}
|
|
177
165
|
}
|
|
178
|
-
},
|
|
179
|
-
if (!
|
|
180
|
-
let e = parseFloat(
|
|
166
|
+
}, ge = async () => {
|
|
167
|
+
if (!K || !E) return;
|
|
168
|
+
let e = parseFloat(O);
|
|
181
169
|
if (!(!e || e <= 0)) {
|
|
182
|
-
|
|
170
|
+
F(null), N(!0);
|
|
183
171
|
try {
|
|
184
|
-
|
|
172
|
+
_("billing.credits.withdrawal_requested", {
|
|
185
173
|
route: "/billing/credits/withdraw",
|
|
186
|
-
entityId: (await
|
|
187
|
-
billingAccountId:
|
|
174
|
+
entityId: (await ae({
|
|
175
|
+
billingAccountId: K,
|
|
188
176
|
creditAmount: e,
|
|
189
|
-
payoutAccountId:
|
|
190
|
-
notes:
|
|
191
|
-
},
|
|
177
|
+
payoutAccountId: E,
|
|
178
|
+
notes: A || void 0
|
|
179
|
+
}, q())).id,
|
|
192
180
|
source: "credit-withdrawal",
|
|
193
181
|
amount: e
|
|
194
|
-
}),
|
|
182
|
+
}), L(!0), k(""), j(""), await J(), await X();
|
|
195
183
|
} catch (e) {
|
|
196
|
-
|
|
184
|
+
F(e instanceof Error ? e.message : "Withdrawal request failed");
|
|
197
185
|
} finally {
|
|
198
|
-
|
|
186
|
+
N(!1);
|
|
199
187
|
}
|
|
200
188
|
}
|
|
201
|
-
}
|
|
202
|
-
variables: {
|
|
203
|
-
creditAmount: Y,
|
|
204
|
-
currency: J
|
|
205
|
-
},
|
|
206
|
-
skip: Y <= 0 || !a
|
|
207
|
-
}), Z = xe?.getCostOfCredits?.amount;
|
|
189
|
+
};
|
|
208
190
|
if (!i.canWithdrawCredits) return /* @__PURE__ */ f("div", {
|
|
209
191
|
className: "flex items-center justify-center h-full min-h-[400px]",
|
|
210
192
|
children: /* @__PURE__ */ p("div", {
|
|
@@ -236,20 +218,7 @@ var h = () => {
|
|
|
236
218
|
]
|
|
237
219
|
})
|
|
238
220
|
});
|
|
239
|
-
if (
|
|
240
|
-
className: "flex items-center justify-center h-full min-h-[400px]",
|
|
241
|
-
children: /* @__PURE__ */ p("div", {
|
|
242
|
-
className: "text-center space-y-2",
|
|
243
|
-
children: [/* @__PURE__ */ f("h2", {
|
|
244
|
-
className: "text-lg font-semibold text-foreground",
|
|
245
|
-
children: "No Billing Account"
|
|
246
|
-
}), /* @__PURE__ */ f("p", {
|
|
247
|
-
className: "text-sm text-muted-foreground",
|
|
248
|
-
children: "You need a billing account to withdraw credits."
|
|
249
|
-
})]
|
|
250
|
-
})
|
|
251
|
-
});
|
|
252
|
-
if (o && !a) return /* @__PURE__ */ p("div", {
|
|
221
|
+
if (s && !o) return /* @__PURE__ */ p("div", {
|
|
253
222
|
className: "space-y-6 p-6",
|
|
254
223
|
children: [/* @__PURE__ */ f("div", { className: "h-8 w-64 bg-muted animate-pulse rounded" }), /* @__PURE__ */ f("div", {
|
|
255
224
|
className: "grid grid-cols-2 lg:grid-cols-4 gap-4",
|
|
@@ -264,7 +233,7 @@ var h = () => {
|
|
|
264
233
|
}, e))
|
|
265
234
|
})]
|
|
266
235
|
});
|
|
267
|
-
let
|
|
236
|
+
let Z = v?.withdrawable ?? 0, Q = parseFloat(O) || 0, _e = Q > 0 && Q <= Z, $ = de.filter((e) => e.status !== "ARCHIVED");
|
|
268
237
|
return /* @__PURE__ */ p("div", {
|
|
269
238
|
className: "space-y-6 p-6",
|
|
270
239
|
children: [
|
|
@@ -277,7 +246,7 @@ var h = () => {
|
|
|
277
246
|
})] }),
|
|
278
247
|
/* @__PURE__ */ f("div", {
|
|
279
248
|
className: "grid grid-cols-2 lg:grid-cols-4 gap-4",
|
|
280
|
-
children:
|
|
249
|
+
children: ue ? [
|
|
281
250
|
1,
|
|
282
251
|
2,
|
|
283
252
|
3,
|
|
@@ -285,34 +254,34 @@ var h = () => {
|
|
|
285
254
|
].map((e) => /* @__PURE__ */ p("div", {
|
|
286
255
|
className: "border border-border rounded-lg p-5",
|
|
287
256
|
children: [/* @__PURE__ */ f("div", { className: "h-4 w-20 bg-muted animate-pulse rounded mb-2" }), /* @__PURE__ */ f("div", { className: "h-8 w-28 bg-muted animate-pulse rounded" })]
|
|
288
|
-
}, e)) :
|
|
257
|
+
}, e)) : b ? /* @__PURE__ */ f("div", {
|
|
289
258
|
className: "col-span-4 text-sm text-destructive",
|
|
290
|
-
children:
|
|
259
|
+
children: b
|
|
291
260
|
}) : /* @__PURE__ */ p(d, { children: [
|
|
292
261
|
/* @__PURE__ */ f(m, {
|
|
293
262
|
label: "Purchased",
|
|
294
|
-
value:
|
|
263
|
+
value: v?.purchased ?? 0,
|
|
295
264
|
description: "From credit purchases"
|
|
296
265
|
}),
|
|
297
266
|
/* @__PURE__ */ f(m, {
|
|
298
267
|
label: "Earned",
|
|
299
|
-
value:
|
|
268
|
+
value: v?.earned ?? 0,
|
|
300
269
|
description: "From sales & referrals"
|
|
301
270
|
}),
|
|
302
271
|
/* @__PURE__ */ f(m, {
|
|
303
272
|
label: "Granted",
|
|
304
|
-
value:
|
|
273
|
+
value: v?.granted ?? 0,
|
|
305
274
|
description: "Coupons & admin grants — non-withdrawable"
|
|
306
275
|
}),
|
|
307
276
|
/* @__PURE__ */ f(m, {
|
|
308
277
|
label: "Withdrawable",
|
|
309
|
-
value:
|
|
278
|
+
value: Z,
|
|
310
279
|
description: "Purchased + earned",
|
|
311
280
|
highlight: !0
|
|
312
281
|
})
|
|
313
282
|
] })
|
|
314
283
|
}),
|
|
315
|
-
|
|
284
|
+
I && /* @__PURE__ */ p("div", {
|
|
316
285
|
className: "flex items-center gap-3 p-4 rounded-lg bg-status-success-bg-subtle border border-status-success-border text-status-success-text",
|
|
317
286
|
children: [
|
|
318
287
|
/* @__PURE__ */ f("svg", {
|
|
@@ -335,7 +304,7 @@ var h = () => {
|
|
|
335
304
|
children: "Our team will review and process your request."
|
|
336
305
|
})] }),
|
|
337
306
|
/* @__PURE__ */ f("button", {
|
|
338
|
-
onClick: () =>
|
|
307
|
+
onClick: () => L(!1),
|
|
339
308
|
className: "ml-auto text-current opacity-60 hover:opacity-100",
|
|
340
309
|
children: /* @__PURE__ */ f("svg", {
|
|
341
310
|
className: "w-4 h-4",
|
|
@@ -363,12 +332,12 @@ var h = () => {
|
|
|
363
332
|
className: "text-base font-semibold text-foreground",
|
|
364
333
|
children: "Payout Account"
|
|
365
334
|
}), /* @__PURE__ */ f("button", {
|
|
366
|
-
onClick: () =>
|
|
335
|
+
onClick: () => z((e) => !e),
|
|
367
336
|
className: "text-sm text-primary hover:underline",
|
|
368
|
-
children:
|
|
337
|
+
children: R ? "Cancel" : "+ Add new"
|
|
369
338
|
})]
|
|
370
339
|
}),
|
|
371
|
-
|
|
340
|
+
R && /* @__PURE__ */ p("div", {
|
|
372
341
|
className: "border border-border rounded-lg p-4 space-y-3 bg-muted/30",
|
|
373
342
|
children: [
|
|
374
343
|
/* @__PURE__ */ f("h3", {
|
|
@@ -380,79 +349,101 @@ var h = () => {
|
|
|
380
349
|
children: "Label"
|
|
381
350
|
}), /* @__PURE__ */ f("input", {
|
|
382
351
|
type: "text",
|
|
383
|
-
value:
|
|
384
|
-
onChange: (e) =>
|
|
352
|
+
value: B.label,
|
|
353
|
+
onChange: (e) => V((t) => ({
|
|
385
354
|
...t,
|
|
386
355
|
label: e.target.value
|
|
387
356
|
})),
|
|
388
357
|
placeholder: "e.g. My Bank Account",
|
|
389
358
|
className: "w-full px-3 py-2 text-sm border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/30"
|
|
390
359
|
})] }),
|
|
391
|
-
/* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("label", {
|
|
392
|
-
className: "block text-xs text-muted-foreground mb-1",
|
|
393
|
-
children: "Account Holder Name"
|
|
394
|
-
}), /* @__PURE__ */ f("input", {
|
|
395
|
-
type: "text",
|
|
396
|
-
value: L.accountHolderName,
|
|
397
|
-
onChange: (e) => R((t) => ({
|
|
398
|
-
...t,
|
|
399
|
-
accountHolderName: e.target.value
|
|
400
|
-
})),
|
|
401
|
-
placeholder: "Full name as on bank account",
|
|
402
|
-
className: "w-full px-3 py-2 text-sm border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/30"
|
|
403
|
-
})] }),
|
|
404
360
|
/* @__PURE__ */ p("div", {
|
|
405
361
|
className: "grid grid-cols-2 gap-3",
|
|
406
362
|
children: [/* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("label", {
|
|
407
363
|
className: "block text-xs text-muted-foreground mb-1",
|
|
408
364
|
children: "Type"
|
|
409
365
|
}), /* @__PURE__ */ p("select", {
|
|
410
|
-
value:
|
|
411
|
-
onChange: (e) =>
|
|
366
|
+
value: B.type,
|
|
367
|
+
onChange: (e) => V((t) => ({
|
|
412
368
|
...t,
|
|
413
369
|
type: e.target.value
|
|
414
370
|
})),
|
|
415
371
|
className: "w-full px-3 py-2 text-sm border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/30",
|
|
416
|
-
children: [
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
372
|
+
children: [
|
|
373
|
+
/* @__PURE__ */ f("option", {
|
|
374
|
+
value: "BANK_ACCOUNT",
|
|
375
|
+
children: "Bank Account"
|
|
376
|
+
}),
|
|
377
|
+
/* @__PURE__ */ f("option", {
|
|
378
|
+
value: "UPI",
|
|
379
|
+
children: "UPI"
|
|
380
|
+
}),
|
|
381
|
+
/* @__PURE__ */ f("option", {
|
|
382
|
+
value: "WALLET",
|
|
383
|
+
children: "Wallet"
|
|
384
|
+
})
|
|
385
|
+
]
|
|
423
386
|
})] }), /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("label", {
|
|
424
387
|
className: "block text-xs text-muted-foreground mb-1",
|
|
425
388
|
children: "Country"
|
|
426
|
-
}), /* @__PURE__ */
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
onChange: (e) => R((t) => ({
|
|
389
|
+
}), /* @__PURE__ */ p("select", {
|
|
390
|
+
value: B.country,
|
|
391
|
+
onChange: (e) => V((t) => ({
|
|
430
392
|
...t,
|
|
431
393
|
country: e.target.value
|
|
432
394
|
})),
|
|
433
|
-
|
|
434
|
-
|
|
395
|
+
className: "w-full px-3 py-2 text-sm border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/30",
|
|
396
|
+
children: [
|
|
397
|
+
/* @__PURE__ */ f("option", {
|
|
398
|
+
value: "IN",
|
|
399
|
+
children: "India"
|
|
400
|
+
}),
|
|
401
|
+
/* @__PURE__ */ f("option", {
|
|
402
|
+
value: "US",
|
|
403
|
+
children: "United States"
|
|
404
|
+
}),
|
|
405
|
+
/* @__PURE__ */ f("option", {
|
|
406
|
+
value: "GB",
|
|
407
|
+
children: "United Kingdom"
|
|
408
|
+
}),
|
|
409
|
+
/* @__PURE__ */ f("option", {
|
|
410
|
+
value: "SG",
|
|
411
|
+
children: "Singapore"
|
|
412
|
+
}),
|
|
413
|
+
/* @__PURE__ */ f("option", {
|
|
414
|
+
value: "AU",
|
|
415
|
+
children: "Australia"
|
|
416
|
+
}),
|
|
417
|
+
/* @__PURE__ */ f("option", {
|
|
418
|
+
value: "CA",
|
|
419
|
+
children: "Canada"
|
|
420
|
+
}),
|
|
421
|
+
/* @__PURE__ */ f("option", {
|
|
422
|
+
value: "DE",
|
|
423
|
+
children: "Germany"
|
|
424
|
+
})
|
|
425
|
+
]
|
|
435
426
|
})] })]
|
|
436
427
|
}),
|
|
437
|
-
|
|
428
|
+
B.type === "BANK_ACCOUNT" && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("label", {
|
|
438
429
|
className: "block text-xs text-muted-foreground mb-1",
|
|
439
430
|
children: "Account Number"
|
|
440
431
|
}), /* @__PURE__ */ f("input", {
|
|
441
432
|
type: "text",
|
|
442
|
-
value:
|
|
443
|
-
onChange: (e) =>
|
|
433
|
+
value: B.accountNumber,
|
|
434
|
+
onChange: (e) => V((t) => ({
|
|
444
435
|
...t,
|
|
445
436
|
accountNumber: e.target.value
|
|
446
437
|
})),
|
|
447
438
|
placeholder: "Account number",
|
|
448
439
|
className: "w-full px-3 py-2 text-sm border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/30"
|
|
449
|
-
})] }),
|
|
440
|
+
})] }), B.country === "IN" ? /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("label", {
|
|
450
441
|
className: "block text-xs text-muted-foreground mb-1",
|
|
451
442
|
children: "IFSC Code"
|
|
452
443
|
}), /* @__PURE__ */ f("input", {
|
|
453
444
|
type: "text",
|
|
454
|
-
value:
|
|
455
|
-
onChange: (e) =>
|
|
445
|
+
value: B.ifscCode,
|
|
446
|
+
onChange: (e) => V((t) => ({
|
|
456
447
|
...t,
|
|
457
448
|
ifscCode: e.target.value.toUpperCase()
|
|
458
449
|
})),
|
|
@@ -463,43 +454,43 @@ var h = () => {
|
|
|
463
454
|
children: "Routing Number"
|
|
464
455
|
}), /* @__PURE__ */ f("input", {
|
|
465
456
|
type: "text",
|
|
466
|
-
value:
|
|
467
|
-
onChange: (e) =>
|
|
457
|
+
value: B.routingNumber,
|
|
458
|
+
onChange: (e) => V((t) => ({
|
|
468
459
|
...t,
|
|
469
460
|
routingNumber: e.target.value
|
|
470
461
|
})),
|
|
471
462
|
placeholder: "Routing / sort code",
|
|
472
463
|
className: "w-full px-3 py-2 text-sm border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/30"
|
|
473
464
|
})] })] }),
|
|
474
|
-
|
|
465
|
+
B.type === "UPI" && /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("label", {
|
|
475
466
|
className: "block text-xs text-muted-foreground mb-1",
|
|
476
467
|
children: "UPI ID"
|
|
477
468
|
}), /* @__PURE__ */ f("input", {
|
|
478
469
|
type: "text",
|
|
479
|
-
value:
|
|
480
|
-
onChange: (e) =>
|
|
470
|
+
value: B.upiId,
|
|
471
|
+
onChange: (e) => V((t) => ({
|
|
481
472
|
...t,
|
|
482
473
|
upiId: e.target.value
|
|
483
474
|
})),
|
|
484
475
|
placeholder: "yourname@upi",
|
|
485
476
|
className: "w-full px-3 py-2 text-sm border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/30"
|
|
486
477
|
})] }),
|
|
487
|
-
|
|
478
|
+
W && /* @__PURE__ */ f("p", {
|
|
488
479
|
className: "text-xs text-destructive",
|
|
489
|
-
children:
|
|
480
|
+
children: W
|
|
490
481
|
}),
|
|
491
482
|
/* @__PURE__ */ f("button", {
|
|
492
|
-
onClick: () => void
|
|
493
|
-
disabled:
|
|
483
|
+
onClick: () => void he(),
|
|
484
|
+
disabled: H || !B.label,
|
|
494
485
|
className: "w-full py-2 text-sm font-medium bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
|
|
495
|
-
children:
|
|
486
|
+
children: H ? "Saving…" : "Save Account"
|
|
496
487
|
})
|
|
497
488
|
]
|
|
498
489
|
}),
|
|
499
|
-
|
|
490
|
+
pe ? /* @__PURE__ */ f("div", {
|
|
500
491
|
className: "space-y-2",
|
|
501
492
|
children: [1, 2].map((e) => /* @__PURE__ */ f("div", { className: "h-16 border border-border rounded-lg bg-muted animate-pulse" }, e))
|
|
502
|
-
}) : $.length === 0 && !
|
|
493
|
+
}) : $.length === 0 && !R ? /* @__PURE__ */ p("div", {
|
|
503
494
|
className: "flex flex-col items-center justify-center py-8 border border-dashed border-border rounded-lg",
|
|
504
495
|
children: [
|
|
505
496
|
/* @__PURE__ */ f("svg", {
|
|
@@ -519,7 +510,7 @@ var h = () => {
|
|
|
519
510
|
children: "No payout accounts yet"
|
|
520
511
|
}),
|
|
521
512
|
/* @__PURE__ */ f("button", {
|
|
522
|
-
onClick: () =>
|
|
513
|
+
onClick: () => z(!0),
|
|
523
514
|
className: "mt-2 text-sm text-primary hover:underline",
|
|
524
515
|
children: "Add a bank account or UPI"
|
|
525
516
|
})
|
|
@@ -527,8 +518,8 @@ var h = () => {
|
|
|
527
518
|
}) : /* @__PURE__ */ f("div", {
|
|
528
519
|
className: "space-y-2",
|
|
529
520
|
children: $.map((e) => /* @__PURE__ */ f("button", {
|
|
530
|
-
onClick: () =>
|
|
531
|
-
className: `w-full text-left p-4 border rounded-lg transition-colors ${
|
|
521
|
+
onClick: () => D(e.id),
|
|
522
|
+
className: `w-full text-left p-4 border rounded-lg transition-colors ${E === e.id ? "border-primary bg-primary/5" : "border-border bg-card hover:border-primary/40"}`,
|
|
532
523
|
children: /* @__PURE__ */ p("div", {
|
|
533
524
|
className: "flex items-center justify-between",
|
|
534
525
|
children: [/* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("p", {
|
|
@@ -553,7 +544,7 @@ var h = () => {
|
|
|
553
544
|
className: `text-xs px-2 py-0.5 rounded font-medium ${e.status === "ACTIVE" ? `${t.success.bg} ${t.success.text}` : e.status === "PENDING_VERIFICATION" ? `${t.warning.bg} ${t.warning.text}` : `${t.error.bg} ${t.error.text}`}`,
|
|
554
545
|
children: e.status.replaceAll("_", " ").toLowerCase()
|
|
555
546
|
}),
|
|
556
|
-
|
|
547
|
+
E === e.id && /* @__PURE__ */ f("svg", {
|
|
557
548
|
className: "w-4 h-4 text-primary shrink-0",
|
|
558
549
|
fill: "none",
|
|
559
550
|
viewBox: "0 0 24 24",
|
|
@@ -587,10 +578,10 @@ var h = () => {
|
|
|
587
578
|
/* @__PURE__ */ f("input", {
|
|
588
579
|
type: "number",
|
|
589
580
|
min: 1,
|
|
590
|
-
max:
|
|
581
|
+
max: Z,
|
|
591
582
|
step: 1,
|
|
592
|
-
value:
|
|
593
|
-
onChange: (e) =>
|
|
583
|
+
value: O,
|
|
584
|
+
onChange: (e) => k(e.target.value),
|
|
594
585
|
placeholder: "Enter credit amount",
|
|
595
586
|
className: "w-full px-3 py-2 text-sm border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/30"
|
|
596
587
|
}),
|
|
@@ -601,29 +592,11 @@ var h = () => {
|
|
|
601
592
|
" ",
|
|
602
593
|
/* @__PURE__ */ p("span", {
|
|
603
594
|
className: "font-medium",
|
|
604
|
-
children: [
|
|
595
|
+
children: [Z.toLocaleString(), " credits"]
|
|
605
596
|
})
|
|
606
597
|
]
|
|
607
598
|
}),
|
|
608
|
-
|
|
609
|
-
className: "text-xs text-muted-foreground mt-1",
|
|
610
|
-
children: X ? "Calculating…" : Z == null ? null : /* @__PURE__ */ p(d, { children: [
|
|
611
|
-
"Estimated payout:",
|
|
612
|
-
" ",
|
|
613
|
-
/* @__PURE__ */ f("span", {
|
|
614
|
-
className: "font-semibold text-foreground",
|
|
615
|
-
children: Z.toLocaleString(void 0, {
|
|
616
|
-
style: "currency",
|
|
617
|
-
currency: J,
|
|
618
|
-
minimumFractionDigits: 2,
|
|
619
|
-
maximumFractionDigits: 2
|
|
620
|
-
})
|
|
621
|
-
}),
|
|
622
|
-
" ",
|
|
623
|
-
"at the current credit rate"
|
|
624
|
-
] })
|
|
625
|
-
}),
|
|
626
|
-
Y > 0 && Y > Q && /* @__PURE__ */ f("p", {
|
|
599
|
+
Q > 0 && Q > Z && /* @__PURE__ */ f("p", {
|
|
627
600
|
className: "text-xs text-destructive mt-1",
|
|
628
601
|
children: "Amount exceeds your withdrawable balance"
|
|
629
602
|
})
|
|
@@ -635,33 +608,29 @@ var h = () => {
|
|
|
635
608
|
children: "(optional)"
|
|
636
609
|
})]
|
|
637
610
|
}), /* @__PURE__ */ f("textarea", {
|
|
638
|
-
value:
|
|
639
|
-
onChange: (e) =>
|
|
611
|
+
value: A,
|
|
612
|
+
onChange: (e) => j(e.target.value),
|
|
640
613
|
placeholder: "Any notes for this withdrawal request",
|
|
641
614
|
rows: 2,
|
|
642
615
|
className: "w-full px-3 py-2 text-sm border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/30 resize-none"
|
|
643
616
|
})] }),
|
|
644
|
-
|
|
617
|
+
P && /* @__PURE__ */ f("div", {
|
|
645
618
|
className: "p-3 rounded-md bg-destructive/10 border border-destructive/20",
|
|
646
619
|
children: /* @__PURE__ */ f("p", {
|
|
647
620
|
className: "text-sm text-destructive",
|
|
648
|
-
children:
|
|
621
|
+
children: P
|
|
649
622
|
})
|
|
650
623
|
}),
|
|
651
624
|
/* @__PURE__ */ p("div", {
|
|
652
625
|
className: "pt-1 border-t border-border",
|
|
653
|
-
children: [/* @__PURE__ */
|
|
626
|
+
children: [/* @__PURE__ */ f("p", {
|
|
654
627
|
className: "text-xs text-muted-foreground mb-3",
|
|
655
|
-
children:
|
|
656
|
-
"Credits will be converted to ",
|
|
657
|
-
J,
|
|
658
|
-
" at the current credit rate. Withdrawals are reviewed before processing and may take 3–5 business days."
|
|
659
|
-
]
|
|
628
|
+
children: "Credits will be converted to USD at the current credit rate. Withdrawals are reviewed before processing and may take 3–5 business days."
|
|
660
629
|
}), /* @__PURE__ */ f("button", {
|
|
661
|
-
onClick: () => void
|
|
662
|
-
disabled:
|
|
630
|
+
onClick: () => void ge(),
|
|
631
|
+
disabled: M || !_e || !E || $.length === 0,
|
|
663
632
|
className: "w-full py-2.5 text-sm font-medium bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
|
|
664
|
-
children:
|
|
633
|
+
children: M ? "Submitting…" : "Request Withdrawal"
|
|
665
634
|
})]
|
|
666
635
|
})
|
|
667
636
|
]
|
|
@@ -676,7 +645,7 @@ var h = () => {
|
|
|
676
645
|
className: "text-base font-semibold text-foreground",
|
|
677
646
|
children: "Withdrawal History"
|
|
678
647
|
}), /* @__PURE__ */ f("button", {
|
|
679
|
-
onClick: () => void
|
|
648
|
+
onClick: () => void X(),
|
|
680
649
|
className: "text-sm text-muted-foreground hover:text-foreground transition-colors",
|
|
681
650
|
"aria-label": "Refresh withdrawal history",
|
|
682
651
|
children: /* @__PURE__ */ f("svg", {
|
|
@@ -692,14 +661,14 @@ var h = () => {
|
|
|
692
661
|
})
|
|
693
662
|
})
|
|
694
663
|
})]
|
|
695
|
-
}),
|
|
664
|
+
}), w ? /* @__PURE__ */ f("div", {
|
|
696
665
|
className: "space-y-2",
|
|
697
666
|
children: [
|
|
698
667
|
1,
|
|
699
668
|
2,
|
|
700
669
|
3
|
|
701
670
|
].map((e) => /* @__PURE__ */ f("div", { className: "h-16 border border-border rounded-lg bg-muted animate-pulse" }, e))
|
|
702
|
-
}) :
|
|
671
|
+
}) : C.length === 0 ? /* @__PURE__ */ p("div", {
|
|
703
672
|
className: "flex flex-col items-center justify-center py-10 border border-dashed border-border rounded-lg",
|
|
704
673
|
children: [/* @__PURE__ */ f("svg", {
|
|
705
674
|
className: "w-8 h-8 text-muted-foreground mb-2",
|
|
@@ -746,7 +715,7 @@ var h = () => {
|
|
|
746
715
|
] })
|
|
747
716
|
}), /* @__PURE__ */ f("tbody", {
|
|
748
717
|
className: "divide-y divide-border",
|
|
749
|
-
children:
|
|
718
|
+
children: C.map((e) => /* @__PURE__ */ p("tr", {
|
|
750
719
|
className: "hover:bg-muted/30 transition-colors",
|
|
751
720
|
children: [
|
|
752
721
|
/* @__PURE__ */ p("td", {
|
|
@@ -760,7 +729,7 @@ var h = () => {
|
|
|
760
729
|
/* @__PURE__ */ p("td", {
|
|
761
730
|
className: "px-4 py-3",
|
|
762
731
|
children: [/* @__PURE__ */ f("span", {
|
|
763
|
-
className: `inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${
|
|
732
|
+
className: `inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${ce(e.status)}`,
|
|
764
733
|
children: e.status.charAt(0) + e.status.slice(1).toLowerCase()
|
|
765
734
|
}), e.failureReason && /* @__PURE__ */ f("p", {
|
|
766
735
|
className: "text-xs text-destructive mt-0.5 max-w-[180px] truncate",
|
|
@@ -782,7 +751,7 @@ var h = () => {
|
|
|
782
751
|
/* @__PURE__ */ f("td", {
|
|
783
752
|
className: "px-4 py-3 text-muted-foreground hidden md:table-cell",
|
|
784
753
|
children: e.paidAt ? /* @__PURE__ */ f("span", {
|
|
785
|
-
className:
|
|
754
|
+
className: se("PAID"),
|
|
786
755
|
children: r(e.paidAt, "short")
|
|
787
756
|
}) : "—"
|
|
788
757
|
})
|