@burdenoff/microfe-billing 2026.601.2 → 2026.601.3
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.
|
@@ -40,9 +40,9 @@ var Ke = () => {
|
|
|
40
40
|
let { t: Ke } = We(), h = (e, t) => {
|
|
41
41
|
let n = Ke(e);
|
|
42
42
|
return n === e ? t : n;
|
|
43
|
-
}, { planId: qe, addonId: g, storeOrderId: _ } = He(), v = se(),
|
|
43
|
+
}, { planId: qe, addonId: g, storeOrderId: _ } = He(), v = se(), y = Ve(), b = y.state, Je = a(), { emit: x } = r(), { orgId: S, stripePublishableKey: Ye, razorpayKey: Xe, apiGatewayUrl: Ze, authToken: Qe, currentUser: $e } = e(), { productSlug: et } = Ue(), C = Oe(null), { items: w, clearCart: tt, _hasHydrated: T } = oe(), E = y.pathname.includes("/checkout/addons") && !g, D = y.pathname.includes("/checkout/store") && !!_, O = E ? "ADDON" : D ? "ORDER" : b?.purchaseType ?? (qe ? "PLAN" : g ? "ADDON" : "CREDITS"), k = b?.itemId ?? qe ?? g ?? _, [nt, A] = u(!1), j = Oe(!1), [M, N] = u("select"), [P, F] = u(null), [rt, I] = u(null), [L, it] = u(null), [at, ot] = u("card");
|
|
44
44
|
c(() => {
|
|
45
|
-
if (
|
|
45
|
+
if (M !== "success" || !L) return;
|
|
46
46
|
let e = typeof window < "u" ? window.localStorage.getItem(Ge("boff-referral-attribution")) : null;
|
|
47
47
|
if (!e) return;
|
|
48
48
|
let t;
|
|
@@ -52,168 +52,168 @@ var Ke = () => {
|
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
if (!t.journeyId && !t.codeId) return;
|
|
55
|
-
let n =
|
|
56
|
-
|
|
55
|
+
let n = L.transactionId || P?.paymentId || P?.orderId || _ || k || O, r = `${t.journeyId ?? "journey"}:${n}`;
|
|
56
|
+
C.current !== r && (C.current = r, ce({
|
|
57
57
|
journeyId: t.journeyId,
|
|
58
58
|
codeId: t.codeId,
|
|
59
|
-
eventType:
|
|
60
|
-
productSlug:
|
|
61
|
-
actorUserId:
|
|
62
|
-
orderId:
|
|
63
|
-
billingAccountId:
|
|
64
|
-
storeOrderId:
|
|
65
|
-
valueAmount:
|
|
66
|
-
currency:
|
|
59
|
+
eventType: O === "ORDER" ? "STORE_PURCHASE" : "PAID_CONVERSION",
|
|
60
|
+
productSlug: et,
|
|
61
|
+
actorUserId: $e?.id,
|
|
62
|
+
orderId: L.transactionId || P?.paymentId || P?.orderId,
|
|
63
|
+
billingAccountId: L.billingAccountId,
|
|
64
|
+
storeOrderId: O === "ORDER" ? _ : void 0,
|
|
65
|
+
valueAmount: L.total,
|
|
66
|
+
currency: L.currency,
|
|
67
67
|
mode: "billing-checkout",
|
|
68
68
|
metadata: {
|
|
69
|
-
purchaseType:
|
|
70
|
-
billingAccountName:
|
|
69
|
+
purchaseType: O,
|
|
70
|
+
billingAccountName: L.billingAccountName
|
|
71
71
|
}
|
|
72
72
|
}, {
|
|
73
|
-
apiGatewayUrl:
|
|
74
|
-
authToken:
|
|
75
|
-
orgId:
|
|
73
|
+
apiGatewayUrl: Ze,
|
|
74
|
+
authToken: Qe,
|
|
75
|
+
orgId: S
|
|
76
76
|
}).catch(() => {
|
|
77
|
-
|
|
77
|
+
C.current = null;
|
|
78
78
|
}));
|
|
79
79
|
}, [
|
|
80
|
+
Ze,
|
|
80
81
|
Qe,
|
|
81
|
-
$e,
|
|
82
|
-
|
|
82
|
+
$e?.id,
|
|
83
|
+
k,
|
|
84
|
+
M,
|
|
85
|
+
S,
|
|
86
|
+
P?.orderId,
|
|
87
|
+
P?.paymentId,
|
|
88
|
+
et,
|
|
89
|
+
L,
|
|
83
90
|
O,
|
|
84
|
-
A,
|
|
85
|
-
x,
|
|
86
|
-
M?.orderId,
|
|
87
|
-
M?.paymentId,
|
|
88
|
-
tt,
|
|
89
|
-
F,
|
|
90
|
-
D,
|
|
91
91
|
_
|
|
92
92
|
]);
|
|
93
|
-
let [
|
|
93
|
+
let [R, z] = u(1), B = le({
|
|
94
94
|
defaultCurrency: "USD",
|
|
95
|
-
upgradeFromSubscriptionId:
|
|
96
|
-
downgradeFromSubscriptionId:
|
|
97
|
-
}), { config: st, stripeEnabled: ct, razorpayEnabled:
|
|
98
|
-
paymentId:
|
|
99
|
-
billingAccountId:
|
|
95
|
+
upgradeFromSubscriptionId: b?.upgradeFromSubscriptionId,
|
|
96
|
+
downgradeFromSubscriptionId: b?.downgradeFromSubscriptionId
|
|
97
|
+
}), { config: st, stripeEnabled: ct, razorpayEnabled: lt } = fe(), { elapsedTime: ut, error: dt } = pe({
|
|
98
|
+
paymentId: M === "processing" ? P?.paymentId ?? null : null,
|
|
99
|
+
billingAccountId: B.billingAccount?.id ?? L?.billingAccountId ?? null,
|
|
100
100
|
paymentType: at,
|
|
101
101
|
pollingInterval: 5e3,
|
|
102
102
|
maxPollingTime: 3e5,
|
|
103
103
|
onSuccess: (e) => {
|
|
104
|
-
e.transactionId &&
|
|
104
|
+
e.transactionId && it((t) => t && {
|
|
105
105
|
...t,
|
|
106
106
|
transactionId: e.transactionId
|
|
107
|
-
}),
|
|
107
|
+
}), N("success"), E && tt();
|
|
108
108
|
},
|
|
109
109
|
onFailure: (e) => {
|
|
110
|
-
|
|
110
|
+
I(e.failureReason || "Payment failed"), N("error");
|
|
111
111
|
},
|
|
112
112
|
onTimeout: () => {
|
|
113
|
-
|
|
113
|
+
I("Payment verification timed out. Please check your billing history for the payment status."), N("error");
|
|
114
114
|
}
|
|
115
|
-
}), { data:
|
|
116
|
-
variables: { id:
|
|
117
|
-
skip:
|
|
118
|
-
}), { data: H, loading:
|
|
119
|
-
variables: { addonIDs:
|
|
120
|
-
skip:
|
|
115
|
+
}), { data: ft, loading: pt, refetch: mt } = ee({}), { data: V, loading: ht } = re({
|
|
116
|
+
variables: { id: k },
|
|
117
|
+
skip: O !== "PLAN" || !k
|
|
118
|
+
}), { data: H, loading: gt } = ie({
|
|
119
|
+
variables: { addonIDs: k ? [k] : [] },
|
|
120
|
+
skip: O !== "ADDON" || !k || D
|
|
121
121
|
}), { data: U } = ae({
|
|
122
122
|
variables: { id: _ },
|
|
123
|
-
skip: !
|
|
124
|
-
}), { data:
|
|
125
|
-
variables: { billingAccountId:
|
|
126
|
-
skip: !
|
|
127
|
-
}), { data:
|
|
128
|
-
variables: { billingAccountId:
|
|
129
|
-
skip: !
|
|
130
|
-
}), W = l(() =>
|
|
123
|
+
skip: !D || !_
|
|
124
|
+
}), { data: _t, loading: vt } = ne({
|
|
125
|
+
variables: { billingAccountId: B.billingAccount?.id },
|
|
126
|
+
skip: !B.billingAccount?.id
|
|
127
|
+
}), { data: yt, loading: bt } = o({
|
|
128
|
+
variables: { billingAccountId: B.billingAccount?.id },
|
|
129
|
+
skip: !B.billingAccount?.id || O !== "ADDON" || D
|
|
130
|
+
}), W = l(() => yt?.getActiveSubscriptions ?? [], [yt]), G = l(() => !B.selectedSubscriptionId || W.length === 0 ? null : W.find((e) => e.id === B.selectedSubscriptionId) ?? null, [B.selectedSubscriptionId, W]), K = B.items[0]?.type === "CREDITS" ? B.items[0].quantity : 100, { data: q, loading: xt } = te({
|
|
131
131
|
variables: {
|
|
132
132
|
creditAmount: K,
|
|
133
|
-
currency:
|
|
133
|
+
currency: B.selectedCurrency || "USD"
|
|
134
134
|
},
|
|
135
|
-
skip:
|
|
136
|
-
}), J = l(() => q?.getCostOfCredits?.amount && K > 0 ? q.getCostOfCredits.amount / K : .01, [q, K]), Y = l(() =>
|
|
137
|
-
if (!
|
|
138
|
-
let e = X.find((e) => e.id ===
|
|
135
|
+
skip: O !== "CREDITS"
|
|
136
|
+
}), J = l(() => q?.getCostOfCredits?.amount && K > 0 ? q.getCostOfCredits.amount / K : .01, [q, K]), Y = l(() => _t?.getPaymentMethods ?? [], [_t]), X = l(() => ft?.getBillingAccountsByOrg ?? [], [ft]), Z = l(() => {
|
|
137
|
+
if (!B.billingAccount) return;
|
|
138
|
+
let e = X.find((e) => e.id === B.billingAccount?.id)?.billingAddresses;
|
|
139
139
|
if (e && e.length > 0) return e[0]?.country || void 0;
|
|
140
|
-
}, [
|
|
140
|
+
}, [B.billingAccount, X]), [St, Ct] = u(null);
|
|
141
141
|
c(() => {
|
|
142
|
-
if (Z) if (Z === "IN")
|
|
142
|
+
if (Z) if (Z === "IN") B.selectedCurrency !== "INR" && B.setCurrency("INR"), lt && St !== Z && B.selectedProvider !== "CREDITS" && (B.setPaymentProvider("RAZORPAY"), Ct(Z));
|
|
143
143
|
else {
|
|
144
|
-
if (
|
|
145
|
-
let e =
|
|
146
|
-
|
|
144
|
+
if (B.selectedCurrency === "INR") {
|
|
145
|
+
let e = B.billingAccount?.currency, t = e && e !== "INR" ? e : "USD";
|
|
146
|
+
B.setCurrency(t);
|
|
147
147
|
}
|
|
148
|
-
|
|
148
|
+
B.selectedProvider === "RAZORPAY" && (B.setPaymentProvider("STRIPE"), Ct(Z));
|
|
149
149
|
}
|
|
150
150
|
}, [
|
|
151
151
|
Z,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
152
|
+
B.selectedCurrency,
|
|
153
|
+
B.selectedProvider,
|
|
154
|
+
B.setCurrency,
|
|
155
|
+
B.setPaymentProvider,
|
|
156
|
+
B.billingAccount?.currency,
|
|
157
|
+
lt,
|
|
158
|
+
St
|
|
159
159
|
]), c(() => {
|
|
160
|
-
if (!
|
|
161
|
-
let e =
|
|
162
|
-
e !== "INR" &&
|
|
160
|
+
if (!B.billingAccount?.currency || Z === "IN") return;
|
|
161
|
+
let e = B.billingAccount.currency;
|
|
162
|
+
e !== "INR" && B.selectedCurrency !== e && B.setCurrency(e);
|
|
163
163
|
}, [
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
B.billingAccount?.id,
|
|
165
|
+
B.billingAccount?.currency,
|
|
166
166
|
Z,
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
B.selectedCurrency,
|
|
168
|
+
B.setCurrency
|
|
169
169
|
]), c(() => {
|
|
170
|
-
if (
|
|
171
|
-
let e =
|
|
172
|
-
if (
|
|
173
|
-
|
|
170
|
+
if (B.selectedProvider !== "AUTO" && B.selectedProvider !== null) return;
|
|
171
|
+
let e = B.availableCredits >= B.total;
|
|
172
|
+
if (B.canPayWithCredits && e) {
|
|
173
|
+
B.setPaymentProvider("CREDITS"), B.setSelectedPaymentMethodId(null);
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
|
-
if (Y.length > 0 && !
|
|
176
|
+
if (Y.length > 0 && !B.selectedPaymentMethodId) {
|
|
177
177
|
let e = Y.find((e) => e.isDefault && e.isVerified), t = Y.find((e) => e.isVerified), n = e || t;
|
|
178
178
|
if (n) {
|
|
179
|
-
|
|
179
|
+
B.setSelectedPaymentMethodId(n.id), n.razorpayPaymentMethodId ? B.setPaymentProvider("RAZORPAY") : n.stripePaymentMethodId && B.setPaymentProvider("STRIPE");
|
|
180
180
|
return;
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
}, [
|
|
184
184
|
Y.length,
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
185
|
+
B.canPayWithCredits,
|
|
186
|
+
B.availableCredits,
|
|
187
|
+
B.total
|
|
188
188
|
]);
|
|
189
189
|
let [Q, $] = u(!1);
|
|
190
190
|
c(() => {
|
|
191
|
-
if (!
|
|
191
|
+
if (!D || Q || !U?.getStoreOrder) return;
|
|
192
192
|
let e = De(U.getStoreOrder.currency);
|
|
193
|
-
|
|
193
|
+
B.selectedCurrency !== e && B.setCurrency(e);
|
|
194
194
|
}, [
|
|
195
|
-
|
|
195
|
+
D,
|
|
196
196
|
Q,
|
|
197
197
|
U,
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
B.selectedCurrency,
|
|
199
|
+
B.setCurrency
|
|
200
200
|
]), c(() => {
|
|
201
|
-
if (
|
|
201
|
+
if (O === "PLAN" && V?.getPlan?.pricingModel === "PER_SEAT") {
|
|
202
202
|
let e = V.getPlan.minSeats ?? 1;
|
|
203
|
-
|
|
203
|
+
z((t) => t < e ? e : t);
|
|
204
204
|
}
|
|
205
|
-
}, [V,
|
|
206
|
-
|
|
207
|
-
}, [
|
|
205
|
+
}, [V, O]), c(() => {
|
|
206
|
+
O === "PLAN" && V?.getPlan?.pricingModel === "PER_SEAT" && Q && $(!1);
|
|
207
|
+
}, [R]), c(() => {
|
|
208
208
|
if (!Q) {
|
|
209
|
-
if (
|
|
210
|
-
|
|
211
|
-
for (let e of
|
|
209
|
+
if (E && T && w.length > 0) {
|
|
210
|
+
B.clearItems();
|
|
211
|
+
for (let e of w) {
|
|
212
212
|
let t = e.addon, n = t.features?.map((e) => ({
|
|
213
213
|
id: e.quota?.id || e.id,
|
|
214
214
|
name: e.quota?.name || "Feature",
|
|
215
215
|
limits: e.quota?.limits
|
|
216
|
-
})) || [], r =
|
|
216
|
+
})) || [], r = B.selectedCurrency || "USD", i = t.currencyPrices?.[r] ?? t.price, a = {
|
|
217
217
|
id: t.id,
|
|
218
218
|
type: "ADDON",
|
|
219
219
|
name: t.name,
|
|
@@ -225,25 +225,25 @@ var Ke = () => {
|
|
|
225
225
|
features: n,
|
|
226
226
|
metadata: { addonId: t.id }
|
|
227
227
|
};
|
|
228
|
-
|
|
228
|
+
B.addItem(a);
|
|
229
229
|
}
|
|
230
230
|
$(!0);
|
|
231
231
|
return;
|
|
232
232
|
}
|
|
233
|
-
if (
|
|
233
|
+
if (O === "PLAN" && V?.getPlan) {
|
|
234
234
|
let e = V.getPlan, t = e.features?.map((e) => ({
|
|
235
235
|
id: e.quota?.id || e.id,
|
|
236
236
|
name: e.quota?.name || "Feature",
|
|
237
237
|
limits: e.quota?.limits
|
|
238
|
-
})) || [], n =
|
|
238
|
+
})) || [], n = B.selectedCurrency || "USD", r = e.currencyPrices, i = e.pricingModel === "PER_SEAT", a;
|
|
239
239
|
if (i && e.pricePerSeat) {
|
|
240
240
|
let t = r?.[n];
|
|
241
|
-
a = (typeof t == "object" && t?.perSeat ? t.perSeat : e.pricePerSeat) *
|
|
241
|
+
a = (typeof t == "object" && t?.perSeat ? t.perSeat : e.pricePerSeat) * R;
|
|
242
242
|
} else {
|
|
243
243
|
let t = r?.[n];
|
|
244
244
|
a = typeof t == "number" ? t : e.price;
|
|
245
245
|
}
|
|
246
|
-
let o = i ?
|
|
246
|
+
let o = i ? R : 1, ee = {
|
|
247
247
|
id: e.id,
|
|
248
248
|
type: "PLAN",
|
|
249
249
|
name: e.name,
|
|
@@ -259,13 +259,13 @@ var Ke = () => {
|
|
|
259
259
|
seatCount: i ? o : void 0
|
|
260
260
|
}
|
|
261
261
|
};
|
|
262
|
-
|
|
263
|
-
} else if (
|
|
262
|
+
B.addItem(ee), $(!0);
|
|
263
|
+
} else if (O === "ADDON" && !E && H?.getSelectedAddons?.[0]) {
|
|
264
264
|
let e = H.getSelectedAddons[0], t = e.features?.map((e) => ({
|
|
265
265
|
id: e.quota?.id || e.id,
|
|
266
266
|
name: e.quota?.name || "Feature",
|
|
267
267
|
limits: e.quota?.limits
|
|
268
|
-
})) || [], n =
|
|
268
|
+
})) || [], n = B.selectedCurrency || "USD", r = e.currencyPrices?.[n] ?? e.price, i = {
|
|
269
269
|
id: e.id,
|
|
270
270
|
type: "ADDON",
|
|
271
271
|
name: e.name,
|
|
@@ -273,254 +273,255 @@ var Ke = () => {
|
|
|
273
273
|
price: r,
|
|
274
274
|
priceUSD: e.price,
|
|
275
275
|
currency: n,
|
|
276
|
-
quantity:
|
|
276
|
+
quantity: b?.quantity ?? 1,
|
|
277
277
|
features: t,
|
|
278
278
|
metadata: { addonId: e.id }
|
|
279
279
|
};
|
|
280
|
-
|
|
281
|
-
} else if (
|
|
280
|
+
B.addItem(i), $(!0);
|
|
281
|
+
} else if (D && U?.getStoreOrder) {
|
|
282
282
|
let e = U.getStoreOrder, t = Ee(e);
|
|
283
|
-
for (let e of t)
|
|
283
|
+
for (let e of t) B.addItem(e);
|
|
284
284
|
$(!0);
|
|
285
|
-
} else if (
|
|
285
|
+
} else if (O === "CREDITS") {
|
|
286
286
|
let e = {
|
|
287
287
|
id: "credits-purchase",
|
|
288
288
|
type: "CREDITS",
|
|
289
289
|
name: "Credits",
|
|
290
290
|
description: "Purchase credits for your account",
|
|
291
291
|
price: J,
|
|
292
|
-
currency:
|
|
292
|
+
currency: B.selectedCurrency || "USD",
|
|
293
293
|
quantity: 100
|
|
294
294
|
};
|
|
295
|
-
|
|
295
|
+
B.addItem(e), $(!0);
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
}, [
|
|
299
|
-
|
|
299
|
+
O,
|
|
300
300
|
V,
|
|
301
301
|
H,
|
|
302
302
|
U,
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
303
|
+
B.addItem,
|
|
304
|
+
B.clearItems,
|
|
305
|
+
b?.quantity,
|
|
306
306
|
Q,
|
|
307
|
-
T,
|
|
308
307
|
E,
|
|
309
|
-
|
|
308
|
+
D,
|
|
310
309
|
w,
|
|
310
|
+
T,
|
|
311
311
|
J,
|
|
312
|
-
|
|
312
|
+
B.selectedCurrency
|
|
313
313
|
]), c(() => {
|
|
314
|
-
if (!(!
|
|
315
|
-
for (let e of
|
|
316
|
-
let t = e.price *
|
|
317
|
-
|
|
314
|
+
if (!(!D || !Q || B.conversionRate <= 1)) {
|
|
315
|
+
for (let e of B.items) if (e.type === "ORDER" && e.currency !== B.selectedCurrency) {
|
|
316
|
+
let t = e.price * B.conversionRate;
|
|
317
|
+
B.updateItemPrice(e.id, t, B.selectedCurrency);
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
}, [
|
|
321
|
-
|
|
321
|
+
D,
|
|
322
322
|
Q,
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
323
|
+
B.conversionRate,
|
|
324
|
+
B.selectedCurrency,
|
|
325
|
+
B.updateItemPrice
|
|
326
326
|
]), c(() => {
|
|
327
|
-
if (
|
|
328
|
-
let e =
|
|
329
|
-
e && e.price !== J &&
|
|
327
|
+
if (O === "CREDITS" && Q && J > 0) {
|
|
328
|
+
let e = B.items.find((e) => e.id === "credits-purchase");
|
|
329
|
+
e && e.price !== J && B.updateItemPrice("credits-purchase", J);
|
|
330
330
|
}
|
|
331
331
|
}, [
|
|
332
|
-
|
|
332
|
+
O,
|
|
333
333
|
Q,
|
|
334
334
|
J,
|
|
335
|
-
|
|
336
|
-
|
|
335
|
+
B.items,
|
|
336
|
+
B.updateItemPrice
|
|
337
337
|
]), c(() => {
|
|
338
|
-
if (!Q ||
|
|
339
|
-
let e =
|
|
340
|
-
for (let t of
|
|
338
|
+
if (!Q || B.items.length === 0) return;
|
|
339
|
+
let e = B.selectedCurrency || "USD";
|
|
340
|
+
for (let t of B.items) if (t.type === "PLAN" && V?.getPlan) {
|
|
341
341
|
let n = V.getPlan.currencyPrices?.[e] ?? V.getPlan.price;
|
|
342
|
-
(t.price !== n || t.currency !== e) &&
|
|
342
|
+
(t.price !== n || t.currency !== e) && B.updateItemPrice(t.id, n, e);
|
|
343
343
|
} else if (t.type === "ADDON") {
|
|
344
|
-
if (!
|
|
344
|
+
if (!E && H?.getSelectedAddons?.[0]) {
|
|
345
345
|
let n = H.getSelectedAddons[0], r = n.currencyPrices?.[e] ?? n.price;
|
|
346
|
-
(t.price !== r || t.currency !== e) &&
|
|
346
|
+
(t.price !== r || t.currency !== e) && B.updateItemPrice(t.id, r, e);
|
|
347
347
|
}
|
|
348
|
-
if (
|
|
349
|
-
let n =
|
|
348
|
+
if (E) {
|
|
349
|
+
let n = w.find((e) => e.addon.id === t.id);
|
|
350
350
|
if (n) {
|
|
351
351
|
let r = n.addon.currencyPrices?.[e] ?? n.addon.price;
|
|
352
|
-
(t.price !== r || t.currency !== e) &&
|
|
352
|
+
(t.price !== r || t.currency !== e) && B.updateItemPrice(t.id, r, e);
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
356
|
}, [
|
|
357
|
-
|
|
357
|
+
B.selectedCurrency,
|
|
358
358
|
Q,
|
|
359
|
-
|
|
360
|
-
|
|
359
|
+
B.items,
|
|
360
|
+
B.updateItemPrice,
|
|
361
361
|
V,
|
|
362
362
|
H,
|
|
363
|
-
|
|
364
|
-
|
|
363
|
+
w,
|
|
364
|
+
E
|
|
365
365
|
]), c(() => {
|
|
366
|
-
if (X.length > 0 && !
|
|
367
|
-
if (
|
|
368
|
-
let e = X.find((e) => e.id ===
|
|
366
|
+
if (X.length > 0 && !B.billingAccount) {
|
|
367
|
+
if (b?.billingAccountId) {
|
|
368
|
+
let e = X.find((e) => e.id === b.billingAccountId);
|
|
369
369
|
if (e) {
|
|
370
|
-
|
|
370
|
+
B.setBillingAccount(e);
|
|
371
371
|
return;
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
|
-
if (
|
|
375
|
-
let e = i(
|
|
374
|
+
if (S) {
|
|
375
|
+
let e = i(S);
|
|
376
376
|
if (e) {
|
|
377
377
|
let t = X.find((t) => t.id === e);
|
|
378
378
|
if (t) {
|
|
379
|
-
|
|
379
|
+
B.setBillingAccount(t);
|
|
380
380
|
return;
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
|
-
|
|
384
|
+
B.setBillingAccount(X[0]);
|
|
385
385
|
}
|
|
386
386
|
}, [
|
|
387
387
|
X,
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
388
|
+
B.billingAccount,
|
|
389
|
+
B.setBillingAccount,
|
|
390
|
+
b?.billingAccountId,
|
|
391
|
+
S
|
|
392
392
|
]);
|
|
393
|
-
let
|
|
393
|
+
let wt = !!(b?.upgradeFromSubscriptionId || b?.downgradeFromSubscriptionId);
|
|
394
394
|
c(() => {
|
|
395
|
-
|
|
395
|
+
E && T && w.length === 0 && !Q && v("/addons", { replace: !0 });
|
|
396
396
|
}, [
|
|
397
|
-
w,
|
|
398
|
-
C.length,
|
|
399
397
|
T,
|
|
398
|
+
w.length,
|
|
399
|
+
E,
|
|
400
400
|
Q,
|
|
401
401
|
v
|
|
402
402
|
]);
|
|
403
|
-
let
|
|
404
|
-
billingAccountId:
|
|
405
|
-
purchaseType:
|
|
406
|
-
productId:
|
|
407
|
-
}),
|
|
408
|
-
if (!
|
|
409
|
-
|
|
410
|
-
|
|
403
|
+
let Tt = de({
|
|
404
|
+
billingAccountId: B.billingAccount?.id,
|
|
405
|
+
purchaseType: O,
|
|
406
|
+
productId: k
|
|
407
|
+
}), Et = s(async () => {
|
|
408
|
+
if (!B.billingAccount) return;
|
|
409
|
+
let e = j.current;
|
|
410
|
+
if (j.current = !1, !e && !Te(B.billingAccount)) {
|
|
411
|
+
A(!0);
|
|
411
412
|
return;
|
|
412
413
|
}
|
|
413
|
-
|
|
414
|
-
let
|
|
415
|
-
if (
|
|
416
|
-
if (
|
|
414
|
+
I(null);
|
|
415
|
+
let t = B.billingAccount.creditAmount ?? 0, n = [...B.items], r = B.total, i = await B.initiatePayment();
|
|
416
|
+
if (i.success) {
|
|
417
|
+
if (x("billing.checkout.initiated", {
|
|
417
418
|
route: "/billing/checkout",
|
|
418
|
-
entityId:
|
|
419
|
+
entityId: i.paymentId ?? i.orderId,
|
|
419
420
|
source: "checkout",
|
|
420
|
-
amount:
|
|
421
|
-
currency:
|
|
422
|
-
}),
|
|
423
|
-
|
|
421
|
+
amount: i.total || r,
|
|
422
|
+
currency: i.currency || B.selectedCurrency
|
|
423
|
+
}), B.selectedProvider === "CREDITS") {
|
|
424
|
+
x("billing.credits.spent", {
|
|
424
425
|
route: "/billing/checkout",
|
|
425
|
-
entityId:
|
|
426
|
+
entityId: i.orderId,
|
|
426
427
|
source: "checkout",
|
|
427
|
-
amount:
|
|
428
|
+
amount: r,
|
|
428
429
|
currency: "CREDITS"
|
|
429
|
-
}),
|
|
430
|
-
items:
|
|
431
|
-
total:
|
|
432
|
-
billingAccountName:
|
|
433
|
-
billingAccountId:
|
|
434
|
-
previousBalance:
|
|
435
|
-
newBalance:
|
|
430
|
+
}), it({
|
|
431
|
+
items: n,
|
|
432
|
+
total: r,
|
|
433
|
+
billingAccountName: B.billingAccount.name,
|
|
434
|
+
billingAccountId: B.billingAccount.id,
|
|
435
|
+
previousBalance: t,
|
|
436
|
+
newBalance: t - r,
|
|
436
437
|
paymentMethod: "credits",
|
|
437
438
|
currency: "Credits",
|
|
438
|
-
transactionId:
|
|
439
|
-
}), ot("credits"),
|
|
439
|
+
transactionId: i.orderId
|
|
440
|
+
}), ot("credits"), F({ paymentId: i.orderId }), N("processing");
|
|
440
441
|
return;
|
|
441
442
|
}
|
|
442
|
-
|
|
443
|
-
items:
|
|
444
|
-
total:
|
|
445
|
-
billingAccountName:
|
|
446
|
-
billingAccountId:
|
|
447
|
-
previousBalance:
|
|
448
|
-
newBalance:
|
|
443
|
+
it({
|
|
444
|
+
items: n,
|
|
445
|
+
total: i.total || r,
|
|
446
|
+
billingAccountName: B.billingAccount.name,
|
|
447
|
+
billingAccountId: B.billingAccount.id,
|
|
448
|
+
previousBalance: t,
|
|
449
|
+
newBalance: t,
|
|
449
450
|
paymentMethod: "card",
|
|
450
|
-
currency:
|
|
451
|
-
transactionId:
|
|
452
|
-
}), ot("card"),
|
|
453
|
-
clientSecret:
|
|
454
|
-
orderId:
|
|
455
|
-
razorpayKeyId:
|
|
456
|
-
razorpayCustomerId:
|
|
457
|
-
paymentId:
|
|
458
|
-
paymentComplete:
|
|
459
|
-
prefillName:
|
|
460
|
-
prefillEmail:
|
|
461
|
-
prefillContact:
|
|
462
|
-
total:
|
|
463
|
-
currency:
|
|
464
|
-
}),
|
|
465
|
-
} else
|
|
451
|
+
currency: i.currency || B.selectedCurrency,
|
|
452
|
+
transactionId: i.paymentId
|
|
453
|
+
}), ot("card"), F({
|
|
454
|
+
clientSecret: i.clientSecret,
|
|
455
|
+
orderId: i.orderId,
|
|
456
|
+
razorpayKeyId: i.razorpayKeyId,
|
|
457
|
+
razorpayCustomerId: i.razorpayCustomerId,
|
|
458
|
+
paymentId: i.paymentId,
|
|
459
|
+
paymentComplete: i.paymentComplete,
|
|
460
|
+
prefillName: i.prefillName,
|
|
461
|
+
prefillEmail: i.prefillEmail,
|
|
462
|
+
prefillContact: i.prefillContact,
|
|
463
|
+
total: i.total,
|
|
464
|
+
currency: i.currency
|
|
465
|
+
}), i.paymentComplete ? N("processing") : N("payment");
|
|
466
|
+
} else x("billing.checkout.failed", {
|
|
466
467
|
route: "/billing/checkout",
|
|
467
468
|
source: "checkout",
|
|
468
|
-
reason:
|
|
469
|
-
}),
|
|
470
|
-
}, [
|
|
471
|
-
|
|
469
|
+
reason: i.error || "Payment initiation failed"
|
|
470
|
+
}), I(i.error || "Payment initiation failed"), N("error");
|
|
471
|
+
}, [B, x]), Dt = s((e) => {
|
|
472
|
+
x("billing.payment.succeeded", {
|
|
472
473
|
route: "/billing/checkout",
|
|
473
|
-
entityId:
|
|
474
|
+
entityId: P?.paymentId ?? P?.orderId,
|
|
474
475
|
source: "checkout"
|
|
475
|
-
}),
|
|
476
|
+
}), F((e) => e), N("processing");
|
|
476
477
|
}, [
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
]),
|
|
481
|
-
|
|
478
|
+
x,
|
|
479
|
+
P?.orderId,
|
|
480
|
+
P?.paymentId
|
|
481
|
+
]), Ot = s((e) => {
|
|
482
|
+
x("billing.payment.failed", {
|
|
482
483
|
route: "/billing/checkout",
|
|
483
|
-
entityId:
|
|
484
|
+
entityId: P?.paymentId ?? P?.orderId,
|
|
484
485
|
source: "checkout",
|
|
485
486
|
reason: e
|
|
486
|
-
}),
|
|
487
|
+
}), I(e), N("error");
|
|
487
488
|
}, [
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
]),
|
|
492
|
-
|
|
493
|
-
}, [
|
|
494
|
-
if (!
|
|
489
|
+
x,
|
|
490
|
+
P?.orderId,
|
|
491
|
+
P?.paymentId
|
|
492
|
+
]), kt = s((e) => {
|
|
493
|
+
B.updateItemQuantity("credits-purchase", e);
|
|
494
|
+
}, [B]);
|
|
495
|
+
if (!Je.canProcessPayment) return /* @__PURE__ */ p(t, { message: "You don't have permission to make purchases." });
|
|
495
496
|
if (ue()) return /* @__PURE__ */ p(me, {
|
|
496
|
-
purchaseType:
|
|
497
|
-
productId:
|
|
498
|
-
billingAccountId:
|
|
499
|
-
nativeCheckout:
|
|
497
|
+
purchaseType: O,
|
|
498
|
+
productId: k,
|
|
499
|
+
billingAccountId: B.billingAccount?.id,
|
|
500
|
+
nativeCheckout: Tt,
|
|
500
501
|
onBack: () => v("dashboard")
|
|
501
502
|
});
|
|
502
|
-
let
|
|
503
|
-
if (
|
|
504
|
-
let
|
|
505
|
-
if (
|
|
506
|
-
let e =
|
|
503
|
+
let At = pt || ht && O === "PLAN" || gt && O === "ADDON" && !E || E && !T;
|
|
504
|
+
if (E && T && w.length === 0 && !Q) return null;
|
|
505
|
+
let jt = () => {
|
|
506
|
+
if (E) {
|
|
507
|
+
let e = B.items.length;
|
|
507
508
|
return `Purchase ${e} Add-on${e === 1 ? "" : "s"}`;
|
|
508
509
|
}
|
|
509
|
-
switch (
|
|
510
|
+
switch (O) {
|
|
510
511
|
case "CREDITS": return "Buy Credits";
|
|
511
512
|
case "PLAN": return "Subscribe to Plan";
|
|
512
513
|
case "ADDON": return "Purchase Add-on";
|
|
513
514
|
default: return "Checkout";
|
|
514
515
|
}
|
|
515
|
-
},
|
|
516
|
-
switch (
|
|
516
|
+
}, Mt = () => {
|
|
517
|
+
switch (O) {
|
|
517
518
|
case "CREDITS": return /* @__PURE__ */ p(Ne, { className: "size-6" });
|
|
518
519
|
case "PLAN": return /* @__PURE__ */ p(Fe, { className: "size-6" });
|
|
519
520
|
case "ADDON": return /* @__PURE__ */ p(je, { className: "size-6" });
|
|
520
521
|
default: return /* @__PURE__ */ p(Re, { className: "size-6" });
|
|
521
522
|
}
|
|
522
523
|
};
|
|
523
|
-
if (
|
|
524
|
+
if (At) return /* @__PURE__ */ p("div", {
|
|
524
525
|
className: "flex items-center justify-center min-h-[400px]",
|
|
525
526
|
children: /* @__PURE__ */ m("div", {
|
|
526
527
|
className: "text-center space-y-4",
|
|
@@ -530,10 +531,10 @@ var Ke = () => {
|
|
|
530
531
|
})]
|
|
531
532
|
})
|
|
532
533
|
});
|
|
533
|
-
if (
|
|
534
|
+
if (M === "success") {
|
|
534
535
|
let e = (e) => {
|
|
535
|
-
if (!
|
|
536
|
-
let t =
|
|
536
|
+
if (!L) return `${e.toFixed(2)}`;
|
|
537
|
+
let t = L.currency;
|
|
537
538
|
return t === "Credits" ? `${e.toFixed(2)} Credits` : `${{
|
|
538
539
|
INR: "₹",
|
|
539
540
|
USD: "$",
|
|
@@ -557,7 +558,7 @@ var Ke = () => {
|
|
|
557
558
|
children: h("billing.checkout.purchaseCompleted", "Your purchase has been completed successfully.")
|
|
558
559
|
})] })]
|
|
559
560
|
}),
|
|
560
|
-
|
|
561
|
+
L && /* @__PURE__ */ m("div", {
|
|
561
562
|
className: "bg-card border border-border rounded-lg overflow-hidden",
|
|
562
563
|
children: [
|
|
563
564
|
/* @__PURE__ */ m("div", {
|
|
@@ -567,7 +568,7 @@ var Ke = () => {
|
|
|
567
568
|
children: [/* @__PURE__ */ p(Ie, { className: "size-4" }), h("billing.checkout.itemsPurchased", "Items Purchased")]
|
|
568
569
|
}), /* @__PURE__ */ p("div", {
|
|
569
570
|
className: "space-y-2",
|
|
570
|
-
children:
|
|
571
|
+
children: L.items.map((t) => /* @__PURE__ */ m("div", {
|
|
571
572
|
className: "flex items-center justify-between",
|
|
572
573
|
children: [/* @__PURE__ */ m("div", {
|
|
573
574
|
className: "flex items-center gap-2",
|
|
@@ -601,7 +602,7 @@ var Ke = () => {
|
|
|
601
602
|
children: h("billing.checkout.paymentMethod", "Payment Method")
|
|
602
603
|
}), /* @__PURE__ */ p("div", {
|
|
603
604
|
className: "flex items-center gap-2",
|
|
604
|
-
children:
|
|
605
|
+
children: L.paymentMethod === "credits" ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(ze, { className: "size-4 text-status-warning-text" }), /* @__PURE__ */ p("span", {
|
|
605
606
|
className: "font-medium text-foreground",
|
|
606
607
|
children: h("billing.checkout.credits", "Credits")
|
|
607
608
|
})] }) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(Pe, { className: "size-4 text-accent-blue" }), /* @__PURE__ */ p("span", {
|
|
@@ -615,12 +616,12 @@ var Ke = () => {
|
|
|
615
616
|
children: h("billing.checkout.totalPaid", "Total Paid")
|
|
616
617
|
}), /* @__PURE__ */ p("p", {
|
|
617
618
|
className: "font-bold text-lg text-foreground",
|
|
618
|
-
children: e(
|
|
619
|
+
children: e(L.total)
|
|
619
620
|
})]
|
|
620
621
|
})]
|
|
621
622
|
})
|
|
622
623
|
}),
|
|
623
|
-
|
|
624
|
+
L.paymentMethod === "credits" && /* @__PURE__ */ m("div", {
|
|
624
625
|
className: "p-4 border-b border-border",
|
|
625
626
|
children: [/* @__PURE__ */ m("h3", {
|
|
626
627
|
className: "font-semibold text-foreground mb-3 flex items-center gap-2",
|
|
@@ -635,7 +636,7 @@ var Ke = () => {
|
|
|
635
636
|
children: h("billing.checkout.previousBalance", "Previous Balance")
|
|
636
637
|
}), /* @__PURE__ */ p("p", {
|
|
637
638
|
className: "font-semibold text-foreground",
|
|
638
|
-
children: t(
|
|
639
|
+
children: t(L.previousBalance)
|
|
639
640
|
})]
|
|
640
641
|
}),
|
|
641
642
|
/* @__PURE__ */ p(Ae, { className: "size-5 text-muted-foreground shrink-0" }),
|
|
@@ -646,7 +647,7 @@ var Ke = () => {
|
|
|
646
647
|
children: h("billing.checkout.newBalance", "New Balance")
|
|
647
648
|
}), /* @__PURE__ */ p("p", {
|
|
648
649
|
className: "font-semibold text-status-success-text",
|
|
649
|
-
children: t(
|
|
650
|
+
children: t(L.newBalance)
|
|
650
651
|
})]
|
|
651
652
|
})
|
|
652
653
|
]
|
|
@@ -661,15 +662,15 @@ var Ke = () => {
|
|
|
661
662
|
children: h("billing.checkout.billingAccount", "Billing Account")
|
|
662
663
|
}), /* @__PURE__ */ p("p", {
|
|
663
664
|
className: "font-medium text-foreground",
|
|
664
|
-
children:
|
|
665
|
-
})] }),
|
|
665
|
+
children: L.billingAccountName
|
|
666
|
+
})] }), L.transactionId && /* @__PURE__ */ m("div", {
|
|
666
667
|
className: "text-right",
|
|
667
668
|
children: [/* @__PURE__ */ p("p", {
|
|
668
669
|
className: "text-xs text-muted-foreground mb-1",
|
|
669
670
|
children: h("billing.checkout.transactionId", "Transaction ID")
|
|
670
671
|
}), /* @__PURE__ */ m("p", {
|
|
671
672
|
className: "font-mono text-xs text-muted-foreground",
|
|
672
|
-
children: [
|
|
673
|
+
children: [L.transactionId.slice(0, 8), "..."]
|
|
673
674
|
})]
|
|
674
675
|
})]
|
|
675
676
|
})
|
|
@@ -693,7 +694,7 @@ var Ke = () => {
|
|
|
693
694
|
]
|
|
694
695
|
});
|
|
695
696
|
}
|
|
696
|
-
if (
|
|
697
|
+
if (M === "error") return /* @__PURE__ */ p("div", {
|
|
697
698
|
className: "max-w-lg mx-auto p-6",
|
|
698
699
|
children: /* @__PURE__ */ m("div", {
|
|
699
700
|
className: "text-center space-y-6",
|
|
@@ -707,7 +708,7 @@ var Ke = () => {
|
|
|
707
708
|
children: h("billing.checkout.paymentFailed", "Payment Failed")
|
|
708
709
|
}), /* @__PURE__ */ p("p", {
|
|
709
710
|
className: "text-muted-foreground mt-2",
|
|
710
|
-
children:
|
|
711
|
+
children: rt || dt || B.error || h("billing.checkout.genericError", "Something went wrong. Please try again.")
|
|
711
712
|
})] }),
|
|
712
713
|
/* @__PURE__ */ m("div", {
|
|
713
714
|
className: "flex gap-3 justify-center",
|
|
@@ -719,7 +720,7 @@ var Ke = () => {
|
|
|
719
720
|
}), /* @__PURE__ */ p("button", {
|
|
720
721
|
type: "button",
|
|
721
722
|
onClick: () => {
|
|
722
|
-
|
|
723
|
+
N("select"), I(null), B.reset();
|
|
723
724
|
},
|
|
724
725
|
className: "px-4 py-2 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90",
|
|
725
726
|
children: h("billing.checkout.tryAgain", "Try Again")
|
|
@@ -728,7 +729,7 @@ var Ke = () => {
|
|
|
728
729
|
]
|
|
729
730
|
})
|
|
730
731
|
});
|
|
731
|
-
if (
|
|
732
|
+
if (M === "processing") return /* @__PURE__ */ p("div", {
|
|
732
733
|
className: "max-w-lg mx-auto p-6",
|
|
733
734
|
children: /* @__PURE__ */ m("div", {
|
|
734
735
|
className: "text-center space-y-6",
|
|
@@ -756,7 +757,7 @@ var Ke = () => {
|
|
|
756
757
|
children: ((e) => {
|
|
757
758
|
let t = Math.floor(e / 1e3);
|
|
758
759
|
return `${Math.floor(t / 60)}:${(t % 60).toString().padStart(2, "0")}`;
|
|
759
|
-
})(
|
|
760
|
+
})(ut)
|
|
760
761
|
})
|
|
761
762
|
]
|
|
762
763
|
}), /* @__PURE__ */ p("p", {
|
|
@@ -768,13 +769,13 @@ var Ke = () => {
|
|
|
768
769
|
className: "w-full bg-muted rounded-full h-2 overflow-hidden",
|
|
769
770
|
children: /* @__PURE__ */ p("div", {
|
|
770
771
|
className: "bg-primary h-2 rounded-full transition-all duration-1000",
|
|
771
|
-
style: { width: `${Math.min(
|
|
772
|
+
style: { width: `${Math.min(ut / 3e5 * 100, 100)}%` }
|
|
772
773
|
})
|
|
773
774
|
}),
|
|
774
|
-
|
|
775
|
+
ut > 3e4 && /* @__PURE__ */ p("button", {
|
|
775
776
|
type: "button",
|
|
776
777
|
onClick: () => {
|
|
777
|
-
|
|
778
|
+
N("error"), I("Payment verification was cancelled. Please check your billing history.");
|
|
778
779
|
},
|
|
779
780
|
className: "text-sm text-muted-foreground hover:text-foreground underline",
|
|
780
781
|
children: h("billing.checkout.cancelAndCheckHistory", "Cancel and check billing history")
|
|
@@ -782,19 +783,19 @@ var Ke = () => {
|
|
|
782
783
|
]
|
|
783
784
|
})
|
|
784
785
|
});
|
|
785
|
-
if (
|
|
786
|
+
if (M === "payment" && P) {
|
|
786
787
|
let e = (e, t) => `${{
|
|
787
788
|
INR: "₹",
|
|
788
789
|
USD: "$",
|
|
789
790
|
EUR: "€",
|
|
790
791
|
GBP: "£"
|
|
791
|
-
}[t] || t + " "}${e.toFixed(2)}`, t =
|
|
792
|
+
}[t] || t + " "}${e.toFixed(2)}`, t = P.currency || B.selectedCurrency, r = P.total ?? B.total;
|
|
792
793
|
return /* @__PURE__ */ m("div", {
|
|
793
794
|
className: "max-w-2xl mx-auto p-4 sm:p-6 space-y-6",
|
|
794
795
|
children: [
|
|
795
796
|
/* @__PURE__ */ m("button", {
|
|
796
797
|
type: "button",
|
|
797
|
-
onClick: () =>
|
|
798
|
+
onClick: () => N("select"),
|
|
798
799
|
className: "flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground",
|
|
799
800
|
children: [/* @__PURE__ */ p(ke, { className: "size-4" }), h("billing.checkout.backToCheckout", "Back to checkout")]
|
|
800
801
|
}),
|
|
@@ -809,7 +810,7 @@ var Ke = () => {
|
|
|
809
810
|
className: "font-semibold text-foreground flex items-center gap-2",
|
|
810
811
|
children: [/* @__PURE__ */ p(Ie, { className: "size-4" }), h("billing.checkout.paymentSummary", "Payment Summary")]
|
|
811
812
|
}),
|
|
812
|
-
|
|
813
|
+
B.billingAccount && /* @__PURE__ */ m("div", {
|
|
813
814
|
className: "p-3 bg-muted/30 rounded-lg space-y-1",
|
|
814
815
|
children: [
|
|
815
816
|
/* @__PURE__ */ p("div", {
|
|
@@ -818,15 +819,15 @@ var Ke = () => {
|
|
|
818
819
|
}),
|
|
819
820
|
/* @__PURE__ */ p("div", {
|
|
820
821
|
className: "font-medium text-foreground",
|
|
821
|
-
children:
|
|
822
|
+
children: B.billingAccount.name
|
|
822
823
|
}),
|
|
823
824
|
/* @__PURE__ */ p("div", {
|
|
824
825
|
className: "text-sm text-muted-foreground",
|
|
825
|
-
children:
|
|
826
|
+
children: B.billingAccount.email
|
|
826
827
|
})
|
|
827
828
|
]
|
|
828
829
|
}),
|
|
829
|
-
|
|
830
|
+
O === "ADDON" && B.selectedSubscriptionId && G && /* @__PURE__ */ m("div", {
|
|
830
831
|
className: "p-3 bg-muted/30 rounded-lg space-y-1",
|
|
831
832
|
children: [
|
|
832
833
|
/* @__PURE__ */ p("div", {
|
|
@@ -847,7 +848,7 @@ var Ke = () => {
|
|
|
847
848
|
className: "space-y-2 text-sm",
|
|
848
849
|
children: [
|
|
849
850
|
(() => {
|
|
850
|
-
let n =
|
|
851
|
+
let n = B.taxRate, i = n > 0 ? r / (1 + n) : r, a = n > 0 ? r - i : 0;
|
|
851
852
|
return /* @__PURE__ */ m(f, { children: [
|
|
852
853
|
/* @__PURE__ */ m("div", {
|
|
853
854
|
className: "flex justify-between",
|
|
@@ -859,16 +860,16 @@ var Ke = () => {
|
|
|
859
860
|
children: e(i, t)
|
|
860
861
|
})]
|
|
861
862
|
}),
|
|
862
|
-
|
|
863
|
+
B.discountAmount > 0 && /* @__PURE__ */ m("div", {
|
|
863
864
|
className: "flex justify-between text-status-success-text",
|
|
864
|
-
children: [/* @__PURE__ */ p("span", { children: h("billing.checkout.discount", "Discount") }), /* @__PURE__ */ m("span", { children: ["-", e(
|
|
865
|
+
children: [/* @__PURE__ */ p("span", { children: h("billing.checkout.discount", "Discount") }), /* @__PURE__ */ m("span", { children: ["-", e(B.discountAmount, t)] })]
|
|
865
866
|
}),
|
|
866
867
|
a > 0 && /* @__PURE__ */ m("div", {
|
|
867
868
|
className: "flex justify-between",
|
|
868
869
|
children: [/* @__PURE__ */ m("span", {
|
|
869
870
|
className: "text-muted-foreground",
|
|
870
871
|
children: [
|
|
871
|
-
|
|
872
|
+
B.taxType || h("billing.checkout.tax", "Tax"),
|
|
872
873
|
" (",
|
|
873
874
|
(n * 100).toFixed(0),
|
|
874
875
|
"%)"
|
|
@@ -895,23 +896,23 @@ var Ke = () => {
|
|
|
895
896
|
})
|
|
896
897
|
]
|
|
897
898
|
}),
|
|
898
|
-
|
|
899
|
+
B.selectedProvider === "STRIPE" && P.clientSecret && /* @__PURE__ */ p("div", {
|
|
899
900
|
className: "rounded-lg border border-border bg-card overflow-hidden",
|
|
900
901
|
children: /* @__PURE__ */ p("div", {
|
|
901
902
|
className: "p-4 space-y-4",
|
|
902
903
|
children: /* @__PURE__ */ p(ye, {
|
|
903
|
-
clientSecret:
|
|
904
|
-
publishableKey:
|
|
905
|
-
amount: Math.round((
|
|
906
|
-
currency:
|
|
907
|
-
onSuccess:
|
|
908
|
-
onError:
|
|
909
|
-
onCancel: () =>
|
|
910
|
-
isCompletingExistingPayment: !!
|
|
904
|
+
clientSecret: P.clientSecret,
|
|
905
|
+
publishableKey: Ye || st?.stripePublishableKey || "",
|
|
906
|
+
amount: Math.round((P.total ?? B.total) * 100),
|
|
907
|
+
currency: P.currency || B.selectedCurrency,
|
|
908
|
+
onSuccess: Dt,
|
|
909
|
+
onError: Ot,
|
|
910
|
+
onCancel: () => N("select"),
|
|
911
|
+
isCompletingExistingPayment: !!B.selectedPaymentMethodId
|
|
911
912
|
})
|
|
912
913
|
})
|
|
913
914
|
}),
|
|
914
|
-
|
|
915
|
+
B.selectedProvider === "RAZORPAY" && P.orderId && /* @__PURE__ */ p("div", {
|
|
915
916
|
className: "rounded-lg border border-border bg-card overflow-hidden",
|
|
916
917
|
children: /* @__PURE__ */ m("div", {
|
|
917
918
|
className: "p-4 space-y-4",
|
|
@@ -919,27 +920,27 @@ var Ke = () => {
|
|
|
919
920
|
className: "flex items-center gap-2 cursor-pointer",
|
|
920
921
|
children: [/* @__PURE__ */ p("input", {
|
|
921
922
|
type: "checkbox",
|
|
922
|
-
checked:
|
|
923
|
-
onChange: (e) =>
|
|
923
|
+
checked: B.saveCard,
|
|
924
|
+
onChange: (e) => B.setSaveCard(e.target.checked),
|
|
924
925
|
className: "size-4 rounded border-border text-primary focus:ring-primary"
|
|
925
926
|
}), /* @__PURE__ */ p("span", {
|
|
926
927
|
className: "text-sm text-muted-foreground",
|
|
927
928
|
children: "Save card for future purchases"
|
|
928
929
|
})]
|
|
929
930
|
}), /* @__PURE__ */ p(be, {
|
|
930
|
-
orderId:
|
|
931
|
-
keyId:
|
|
932
|
-
amount: Math.round((
|
|
933
|
-
currency:
|
|
934
|
-
customerId:
|
|
931
|
+
orderId: P.orderId,
|
|
932
|
+
keyId: P.razorpayKeyId || Xe || "",
|
|
933
|
+
amount: Math.round((P.total ?? B.total) * 100),
|
|
934
|
+
currency: P.currency || "INR",
|
|
935
|
+
customerId: P.razorpayCustomerId,
|
|
935
936
|
prefill: {
|
|
936
|
-
name:
|
|
937
|
-
email:
|
|
938
|
-
contact:
|
|
937
|
+
name: P.prefillName,
|
|
938
|
+
email: P.prefillEmail,
|
|
939
|
+
contact: P.prefillContact
|
|
939
940
|
},
|
|
940
|
-
onSuccess: (e) =>
|
|
941
|
-
onError:
|
|
942
|
-
onCancel: () =>
|
|
941
|
+
onSuccess: (e) => Dt(e.razorpay_payment_id),
|
|
942
|
+
onError: Ot,
|
|
943
|
+
onCancel: () => N("select")
|
|
943
944
|
})]
|
|
944
945
|
})
|
|
945
946
|
})
|
|
@@ -959,16 +960,16 @@ var Ke = () => {
|
|
|
959
960
|
className: "flex items-center gap-3 mb-6",
|
|
960
961
|
children: [/* @__PURE__ */ p("div", {
|
|
961
962
|
className: "p-2 rounded-lg bg-primary/10 text-primary",
|
|
962
|
-
children:
|
|
963
|
+
children: Mt()
|
|
963
964
|
}), /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("h1", {
|
|
964
965
|
className: "text-2xl font-bold text-foreground",
|
|
965
|
-
children:
|
|
966
|
+
children: jt()
|
|
966
967
|
}), /* @__PURE__ */ p("p", {
|
|
967
968
|
className: "text-sm text-muted-foreground",
|
|
968
969
|
children: "Complete your purchase securely"
|
|
969
970
|
})] })]
|
|
970
971
|
}),
|
|
971
|
-
|
|
972
|
+
b?.upgradeFromSubscriptionId && b?.currentPlanName && /* @__PURE__ */ p("div", {
|
|
972
973
|
className: "mb-6 p-4 rounded-lg border border-border-subtle bg-status-info-bg-subtle",
|
|
973
974
|
children: /* @__PURE__ */ m("div", {
|
|
974
975
|
className: "flex items-center gap-3",
|
|
@@ -984,7 +985,7 @@ var Ke = () => {
|
|
|
984
985
|
" ",
|
|
985
986
|
/* @__PURE__ */ p("span", {
|
|
986
987
|
className: "font-semibold",
|
|
987
|
-
children:
|
|
988
|
+
children: b.currentPlanName
|
|
988
989
|
})
|
|
989
990
|
]
|
|
990
991
|
}), /* @__PURE__ */ p("p", {
|
|
@@ -994,7 +995,7 @@ var Ke = () => {
|
|
|
994
995
|
})]
|
|
995
996
|
})
|
|
996
997
|
}),
|
|
997
|
-
|
|
998
|
+
b?.downgradeFromSubscriptionId && b?.currentPlanName && /* @__PURE__ */ p("div", {
|
|
998
999
|
className: "mb-6 p-4 rounded-lg border border-status-warning-border bg-status-warning-bg-subtle",
|
|
999
1000
|
children: /* @__PURE__ */ m("div", {
|
|
1000
1001
|
className: "flex items-center gap-3",
|
|
@@ -1010,7 +1011,7 @@ var Ke = () => {
|
|
|
1010
1011
|
" ",
|
|
1011
1012
|
/* @__PURE__ */ p("span", {
|
|
1012
1013
|
className: "font-semibold",
|
|
1013
|
-
children:
|
|
1014
|
+
children: b.currentPlanName
|
|
1014
1015
|
})
|
|
1015
1016
|
]
|
|
1016
1017
|
}), /* @__PURE__ */ p("p", {
|
|
@@ -1025,30 +1026,30 @@ var Ke = () => {
|
|
|
1025
1026
|
children: [/* @__PURE__ */ m("div", {
|
|
1026
1027
|
className: "lg:col-span-3 space-y-6 order-2 lg:order-1",
|
|
1027
1028
|
children: [
|
|
1028
|
-
|
|
1029
|
+
O === "CREDITS" && B.items[0] && /* @__PURE__ */ p("div", {
|
|
1029
1030
|
className: "rounded-lg border border-border bg-card p-4 sm:p-6",
|
|
1030
1031
|
children: /* @__PURE__ */ p(ve, {
|
|
1031
|
-
value:
|
|
1032
|
-
onChange:
|
|
1032
|
+
value: B.items[0].quantity,
|
|
1033
|
+
onChange: kt,
|
|
1033
1034
|
costPerCredit: J,
|
|
1034
|
-
currency:
|
|
1035
|
-
disabled:
|
|
1035
|
+
currency: B.selectedCurrency,
|
|
1036
|
+
disabled: xt
|
|
1036
1037
|
})
|
|
1037
1038
|
}),
|
|
1038
1039
|
/* @__PURE__ */ m("div", {
|
|
1039
1040
|
className: "rounded-lg border border-border bg-card p-4 sm:p-6 space-y-4",
|
|
1040
1041
|
children: [/* @__PURE__ */ p(he, {
|
|
1041
1042
|
accounts: X,
|
|
1042
|
-
selectedAccountId:
|
|
1043
|
-
onSelect:
|
|
1044
|
-
isLoading:
|
|
1045
|
-
disabled:
|
|
1046
|
-
disabledMessage:
|
|
1047
|
-
}),
|
|
1043
|
+
selectedAccountId: B.billingAccount?.id ?? null,
|
|
1044
|
+
onSelect: B.setBillingAccount,
|
|
1045
|
+
isLoading: pt,
|
|
1046
|
+
disabled: wt,
|
|
1047
|
+
disabledMessage: wt ? "Billing account is locked for plan changes" : void 0
|
|
1048
|
+
}), O === "ADDON" && !D && B.billingAccount && /* @__PURE__ */ p(xe, {
|
|
1048
1049
|
subscriptions: W,
|
|
1049
|
-
selectedSubscriptionId:
|
|
1050
|
-
onSelect:
|
|
1051
|
-
isLoading:
|
|
1050
|
+
selectedSubscriptionId: B.selectedSubscriptionId,
|
|
1051
|
+
onSelect: B.setSelectedSubscriptionId,
|
|
1052
|
+
isLoading: bt
|
|
1052
1053
|
})]
|
|
1053
1054
|
}),
|
|
1054
1055
|
/* @__PURE__ */ m("div", {
|
|
@@ -1056,22 +1057,22 @@ var Ke = () => {
|
|
|
1056
1057
|
children: [
|
|
1057
1058
|
/* @__PURE__ */ p(Ce, {
|
|
1058
1059
|
savedPaymentMethods: Y,
|
|
1059
|
-
selectedPaymentMethodId:
|
|
1060
|
-
onSelectSavedCard:
|
|
1061
|
-
selectedProvider:
|
|
1062
|
-
onSelectProvider:
|
|
1060
|
+
selectedPaymentMethodId: B.selectedPaymentMethodId,
|
|
1061
|
+
onSelectSavedCard: B.setSelectedPaymentMethodId,
|
|
1062
|
+
selectedProvider: B.selectedProvider,
|
|
1063
|
+
onSelectProvider: B.setPaymentProvider,
|
|
1063
1064
|
stripeEnabled: ct,
|
|
1064
|
-
razorpayEnabled:
|
|
1065
|
-
canPayWithCredits:
|
|
1066
|
-
availableCredits:
|
|
1067
|
-
totalAmount:
|
|
1065
|
+
razorpayEnabled: lt,
|
|
1066
|
+
canPayWithCredits: B.canPayWithCredits && B.hasEnoughCredits,
|
|
1067
|
+
availableCredits: B.availableCredits,
|
|
1068
|
+
totalAmount: B.subtotalUSD,
|
|
1068
1069
|
billingCountry: Z,
|
|
1069
|
-
saveCard:
|
|
1070
|
-
onSaveCardChange:
|
|
1071
|
-
autoRenewEnabled:
|
|
1072
|
-
isLoading:
|
|
1070
|
+
saveCard: B.saveCard,
|
|
1071
|
+
onSaveCardChange: B.setSaveCard,
|
|
1072
|
+
autoRenewEnabled: O === "PLAN" && B.autoRenew,
|
|
1073
|
+
isLoading: vt
|
|
1073
1074
|
}),
|
|
1074
|
-
|
|
1075
|
+
B.selectedProvider !== "CREDITS" && B.selectedProvider !== "AUTO" && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", { className: "border-t border-border" }), /* @__PURE__ */ p("div", {
|
|
1075
1076
|
className: "bg-muted/50 p-4 rounded-md",
|
|
1076
1077
|
children: /* @__PURE__ */ m("div", {
|
|
1077
1078
|
className: "flex items-start gap-3",
|
|
@@ -1090,7 +1091,7 @@ var Ke = () => {
|
|
|
1090
1091
|
className: "flex-1 text-sm",
|
|
1091
1092
|
children: [/* @__PURE__ */ m("p", {
|
|
1092
1093
|
className: "font-medium text-foreground mb-1",
|
|
1093
|
-
children: ["Currency: ",
|
|
1094
|
+
children: ["Currency: ", B.selectedCurrency]
|
|
1094
1095
|
}), /* @__PURE__ */ m("p", {
|
|
1095
1096
|
className: "text-muted-foreground text-xs",
|
|
1096
1097
|
children: [
|
|
@@ -1098,17 +1099,17 @@ var Ke = () => {
|
|
|
1098
1099
|
" ",
|
|
1099
1100
|
/* @__PURE__ */ p("strong", {
|
|
1100
1101
|
className: "text-foreground",
|
|
1101
|
-
children:
|
|
1102
|
+
children: B.selectedCurrency
|
|
1102
1103
|
}),
|
|
1103
1104
|
" ",
|
|
1104
1105
|
"based on your billing account settings.",
|
|
1105
|
-
|
|
1106
|
+
B.selectedCurrency === "INR" && " GST will be applied at checkout."
|
|
1106
1107
|
]
|
|
1107
1108
|
})]
|
|
1108
1109
|
})]
|
|
1109
1110
|
})
|
|
1110
1111
|
})] }),
|
|
1111
|
-
|
|
1112
|
+
O === "PLAN" && V?.getPlan?.pricingModel === "PER_SEAT" && /* @__PURE__ */ p("div", {
|
|
1112
1113
|
className: "border-t border-border pt-4",
|
|
1113
1114
|
children: /* @__PURE__ */ m("div", {
|
|
1114
1115
|
className: "space-y-3",
|
|
@@ -1129,26 +1130,26 @@ var Ke = () => {
|
|
|
1129
1130
|
children: [
|
|
1130
1131
|
/* @__PURE__ */ p("button", {
|
|
1131
1132
|
type: "button",
|
|
1132
|
-
onClick: () =>
|
|
1133
|
-
disabled:
|
|
1133
|
+
onClick: () => z((e) => Math.max(V.getPlan?.minSeats ?? 1, e - 1)),
|
|
1134
|
+
disabled: R <= (V.getPlan.minSeats ?? 1),
|
|
1134
1135
|
className: "size-9 rounded-md border border-border flex items-center justify-center hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed transition-colors text-foreground",
|
|
1135
1136
|
children: "−"
|
|
1136
1137
|
}),
|
|
1137
1138
|
/* @__PURE__ */ p("input", {
|
|
1138
1139
|
type: "number",
|
|
1139
|
-
value:
|
|
1140
|
+
value: R,
|
|
1140
1141
|
min: V.getPlan.minSeats ?? 1,
|
|
1141
1142
|
max: V.getPlan.maxSeats ?? 999,
|
|
1142
1143
|
onChange: (e) => {
|
|
1143
1144
|
let t = parseInt(e.target.value, 10);
|
|
1144
|
-
isNaN(t) ||
|
|
1145
|
+
isNaN(t) || z(Math.max(V.getPlan?.minSeats ?? 1, t));
|
|
1145
1146
|
},
|
|
1146
1147
|
className: "w-20 h-9 text-center border border-border rounded-md bg-background text-foreground text-sm focus:outline-none focus:ring-2 focus:ring-primary"
|
|
1147
1148
|
}),
|
|
1148
1149
|
/* @__PURE__ */ p("button", {
|
|
1149
1150
|
type: "button",
|
|
1150
|
-
onClick: () =>
|
|
1151
|
-
disabled:
|
|
1151
|
+
onClick: () => z((e) => Math.min(V.getPlan?.maxSeats ?? 999, e + 1)),
|
|
1152
|
+
disabled: R >= (V.getPlan.maxSeats ?? 999),
|
|
1152
1153
|
className: "size-9 rounded-md border border-border flex items-center justify-center hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed transition-colors text-foreground",
|
|
1153
1154
|
children: "+"
|
|
1154
1155
|
}),
|
|
@@ -1164,7 +1165,7 @@ var Ke = () => {
|
|
|
1164
1165
|
" ",
|
|
1165
1166
|
"=",
|
|
1166
1167
|
" ",
|
|
1167
|
-
(V.getPlan.pricePerSeat *
|
|
1168
|
+
(V.getPlan.pricePerSeat * R).toLocaleString("en", {
|
|
1168
1169
|
style: "currency",
|
|
1169
1170
|
currency: V.getPlan.currency ?? "USD"
|
|
1170
1171
|
}),
|
|
@@ -1189,46 +1190,46 @@ var Ke = () => {
|
|
|
1189
1190
|
/* @__PURE__ */ p("div", {
|
|
1190
1191
|
className: "p-4",
|
|
1191
1192
|
children: /* @__PURE__ */ p(ge, {
|
|
1192
|
-
items:
|
|
1193
|
-
subtotal:
|
|
1194
|
-
discountAmount:
|
|
1195
|
-
taxAmount:
|
|
1196
|
-
taxRate:
|
|
1197
|
-
taxType:
|
|
1198
|
-
total:
|
|
1199
|
-
currency:
|
|
1200
|
-
isCalculatingTax:
|
|
1201
|
-
showInCredits:
|
|
1202
|
-
onUpdateQuantity:
|
|
1203
|
-
onRemoveItem:
|
|
1204
|
-
isEditable:
|
|
1193
|
+
items: B.items,
|
|
1194
|
+
subtotal: B.subtotal,
|
|
1195
|
+
discountAmount: B.discountAmount,
|
|
1196
|
+
taxAmount: B.taxAmount,
|
|
1197
|
+
taxRate: B.taxRate,
|
|
1198
|
+
taxType: B.taxType,
|
|
1199
|
+
total: B.total,
|
|
1200
|
+
currency: B.selectedCurrency,
|
|
1201
|
+
isCalculatingTax: B.isCalculatingTax,
|
|
1202
|
+
showInCredits: B.selectedProvider === "CREDITS",
|
|
1203
|
+
onUpdateQuantity: O === "PLAN" ? void 0 : B.updateItemQuantity,
|
|
1204
|
+
onRemoveItem: B.removeItem,
|
|
1205
|
+
isEditable: O !== "PLAN"
|
|
1205
1206
|
})
|
|
1206
1207
|
}),
|
|
1207
1208
|
/* @__PURE__ */ p("div", {
|
|
1208
1209
|
className: "px-4 pb-4 border-t border-border pt-4",
|
|
1209
1210
|
children: /* @__PURE__ */ p(_e, {
|
|
1210
|
-
value:
|
|
1211
|
-
onChange:
|
|
1212
|
-
onValidate: async () => await
|
|
1213
|
-
onClear:
|
|
1214
|
-
isApplied:
|
|
1215
|
-
discountValue:
|
|
1216
|
-
discountType:
|
|
1217
|
-
isValidating:
|
|
1211
|
+
value: B.promoCode,
|
|
1212
|
+
onChange: B.setPromoCode,
|
|
1213
|
+
onValidate: async () => await B.validatePromoCode(),
|
|
1214
|
+
onClear: B.clearPromoCode,
|
|
1215
|
+
isApplied: B.promoDiscount > 0,
|
|
1216
|
+
discountValue: B.promoDiscount,
|
|
1217
|
+
discountType: B.promoDiscountType,
|
|
1218
|
+
isValidating: B.isProcessing
|
|
1218
1219
|
})
|
|
1219
1220
|
}),
|
|
1220
|
-
|
|
1221
|
+
O === "PLAN" && B.selectedProvider !== "CREDITS" && B.selectedProvider !== "AUTO" && (() => {
|
|
1221
1222
|
let e = "", t = !1, n = !1;
|
|
1222
|
-
if (
|
|
1223
|
-
let r = Y.find((e) => e.id ===
|
|
1223
|
+
if (B.selectedPaymentMethodId) {
|
|
1224
|
+
let r = Y.find((e) => e.id === B.selectedPaymentMethodId);
|
|
1224
1225
|
r && (e = `${r.type === "CREDIT_CARD" || r.type === "DEBIT_CARD" ? "Card" : r.type}${r.last4 ? ` •••• ${r.last4}` : ""}`, t = !0, n = !1);
|
|
1225
|
-
} else (
|
|
1226
|
+
} else (B.selectedProvider === "RAZORPAY" || B.selectedProvider === "STRIPE") && (e = B.selectedProvider === "RAZORPAY" ? "new card (Razorpay)" : "new card (Stripe)", t = !0, n = !0);
|
|
1226
1227
|
return /* @__PURE__ */ p("div", {
|
|
1227
1228
|
className: "px-4 pb-4",
|
|
1228
1229
|
children: /* @__PURE__ */ p(Se, {
|
|
1229
|
-
enabled:
|
|
1230
|
+
enabled: B.autoRenew,
|
|
1230
1231
|
onToggle: (e) => {
|
|
1231
|
-
|
|
1232
|
+
B.setAutoRenew(e), e && B.selectedPaymentMethodId && B.setAutoRenewPaymentMethodId(B.selectedPaymentMethodId);
|
|
1232
1233
|
},
|
|
1233
1234
|
hasPaymentMethodSelected: t,
|
|
1234
1235
|
selectedPaymentMethodDisplay: e,
|
|
@@ -1240,10 +1241,10 @@ var Ke = () => {
|
|
|
1240
1241
|
}),
|
|
1241
1242
|
/* @__PURE__ */ p("button", {
|
|
1242
1243
|
type: "button",
|
|
1243
|
-
onClick:
|
|
1244
|
-
disabled:
|
|
1244
|
+
onClick: Et,
|
|
1245
|
+
disabled: B.isProcessing || !B.billingAccount || B.items.length === 0 || O === "ADDON" && !D && bt || O === "ADDON" && !D && W.length === 0 || O === "ADDON" && !D && !B.selectedSubscriptionId,
|
|
1245
1246
|
className: "w-full px-6 py-4 rounded-lg bg-primary text-primary-foreground font-semibold\n hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed\n transition-colors flex items-center justify-center gap-2",
|
|
1246
|
-
children:
|
|
1247
|
+
children: B.isProcessing ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(d, { className: "size-5 animate-spin" }), "Processing…"] }) : B.selectedProvider === "CREDITS" ? "Pay with Credits" : "Proceed to Payment"
|
|
1247
1248
|
}),
|
|
1248
1249
|
/* @__PURE__ */ p("p", {
|
|
1249
1250
|
className: "text-center text-xs text-muted-foreground",
|
|
@@ -1253,14 +1254,17 @@ var Ke = () => {
|
|
|
1253
1254
|
})
|
|
1254
1255
|
})]
|
|
1255
1256
|
}),
|
|
1256
|
-
|
|
1257
|
-
billingAccountId:
|
|
1258
|
-
hasPhone: !!
|
|
1259
|
-
hasAddress: !!(
|
|
1257
|
+
nt && B.billingAccount && /* @__PURE__ */ p(we, {
|
|
1258
|
+
billingAccountId: B.billingAccount.id,
|
|
1259
|
+
hasPhone: !!B.billingAccount.contactNumber?.trim(),
|
|
1260
|
+
hasAddress: !!(B.billingAccount.billingAddresses?.[0]?.line1?.trim() && B.billingAccount.billingAddresses?.[0]?.postalCode?.trim()),
|
|
1260
1261
|
onCompleted: () => {
|
|
1261
|
-
|
|
1262
|
+
j.current = !0, A(!1), Et(), mt().then((e) => {
|
|
1263
|
+
let t = (e.data?.getBillingAccountsByOrg ?? []).find((e) => e.id === B.billingAccount?.id);
|
|
1264
|
+
t && B.setBillingAccount(t);
|
|
1265
|
+
});
|
|
1262
1266
|
},
|
|
1263
|
-
onCancel: () =>
|
|
1267
|
+
onCancel: () => A(!1)
|
|
1264
1268
|
})
|
|
1265
1269
|
]
|
|
1266
1270
|
});
|