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