@burdenoff/microfe-billing 2026.1005.2 → 2026.1005.4
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/checkout/components/WebCheckoutRedirectView.js +82 -0
- package/dist/billing/modules/checkout/components/WebCheckoutRedirectView.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 +498 -485
- package/dist/billing/modules/checkout/pages/CheckoutPage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaAssignFreePage.js +144 -110
- package/dist/billing/modules/quota/pages/QuotaAssignFreePage.js.map +1 -1
- package/dist/billing/modules/quota/utils/quotaSelector.js +15 -0
- package/dist/billing/modules/quota/utils/quotaSelector.js.map +1 -0
- package/package.json +1 -1
|
@@ -18,30 +18,31 @@ import { usePaymentProviders as me } from "../hooks/usePaymentProviders.js";
|
|
|
18
18
|
import { usePaymentStatusPolling as he } from "../hooks/usePaymentStatusPolling.js";
|
|
19
19
|
import "../hooks/index.js";
|
|
20
20
|
import { NativeCheckoutView as ge } from "../components/NativeCheckoutView.js";
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
21
|
+
import { WebCheckoutRedirectView as _e } from "../components/WebCheckoutRedirectView.js";
|
|
22
|
+
import { BillingAccountSelector as ve } from "../components/BillingAccountSelector.js";
|
|
23
|
+
import { OrderSummary as ye } from "../components/OrderSummary.js";
|
|
24
|
+
import { PromoCodeInput as be } from "../components/PromoCodeInput.js";
|
|
25
|
+
import { CreditsAmountInput as xe } from "../components/CreditsAmountInput.js";
|
|
26
|
+
import { StripePaymentForm as Se } from "../components/StripePaymentForm.js";
|
|
27
|
+
import { RazorpayPaymentButton as Ce } from "../components/RazorpayPaymentButton.js";
|
|
28
|
+
import { SubscriptionSelector as we } from "../components/SubscriptionSelector.js";
|
|
29
|
+
import { SimpleAutoPayToggle as Te } from "../components/SimpleAutoPayToggle.js";
|
|
30
|
+
import { UnifiedPaymentMethodSelector as Ee } from "../components/UnifiedPaymentMethodSelector.js";
|
|
31
|
+
import { CompleteBillingAccountModal as De, isBillingAccountComplete as Oe } from "../components/CompleteBillingAccountModal.js";
|
|
32
|
+
import { StoreShippingSection as ke } from "../components/StoreShippingSection.js";
|
|
33
|
+
import { WorkspaceQuotaAssignmentModal as Ae, isWorkspaceScopedQuota as je } from "../components/WorkspaceQuotaAssignmentModal.js";
|
|
33
34
|
import "../components/index.js";
|
|
34
|
-
import { buildStoreOrderCheckoutItems as
|
|
35
|
-
import { useCallback as c, useEffect as l, useMemo as u, useRef as
|
|
36
|
-
import { ArrowLeft as
|
|
37
|
-
import { useLocation as
|
|
38
|
-
import { useAppShell as
|
|
35
|
+
import { buildStoreOrderCheckoutItems as Me, normalizeStoreOrderCurrency as Ne } from "../utils/storeOrder.js";
|
|
36
|
+
import { useCallback as c, useEffect as l, useMemo as u, useRef as Pe, useState as d } from "react";
|
|
37
|
+
import { ArrowLeft as Fe, ArrowRight as Ie, Blocks as Le, CheckCircle as Re, Coins as ze, CreditCard as Be, Loader2 as Ve, Package as He, Receipt as Ue, RefreshCw as We, ShoppingCart as Ge, Wallet as Ke, XCircle as qe } from "lucide-react";
|
|
38
|
+
import { useLocation as Je, useParams as Ye } from "react-router";
|
|
39
|
+
import { useAppShell as Xe } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
39
40
|
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
40
|
-
import { useI18n as
|
|
41
|
-
import { getProfileScopedKey as
|
|
42
|
-
import { PagePurpose as
|
|
41
|
+
import { useI18n as Ze } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
42
|
+
import { getProfileScopedKey as Qe } from "@burdenoff/fe-libs/shared/utils";
|
|
43
|
+
import { PagePurpose as $e } from "@burdenoff/fe-libs/ui";
|
|
43
44
|
//#region src/billing/modules/checkout/pages/CheckoutPage.tsx
|
|
44
|
-
function
|
|
45
|
+
function et(e) {
|
|
45
46
|
return typeof e.id != "string" || typeof e.name != "string" || typeof e.email != "string" || typeof e.currency != "string" || typeof e.creditAmount != "number" || typeof e.isActive != "boolean" ? null : {
|
|
46
47
|
...e,
|
|
47
48
|
id: e.id,
|
|
@@ -53,17 +54,17 @@ function $e(e) {
|
|
|
53
54
|
billingAddresses: e.billingAddresses === null ? null : e.billingAddresses?.flatMap((e) => e ? [{ ...e }] : [])
|
|
54
55
|
};
|
|
55
56
|
}
|
|
56
|
-
var
|
|
57
|
-
let { t:
|
|
58
|
-
let n =
|
|
57
|
+
var tt = () => {
|
|
58
|
+
let { t: tt } = Ze(), h = (e, t) => {
|
|
59
|
+
let n = tt(e);
|
|
59
60
|
return n === e ? t : n;
|
|
60
|
-
}, { planId:
|
|
61
|
-
id:
|
|
61
|
+
}, { planId: nt, addonId: rt, storeOrderId: g } = Ye(), _ = oe(), v = Je(), y = v.state, it = a(), { emit: b } = r(), { orgId: x, stripePublishableKey: at, razorpayKey: ot, apiGatewayUrl: st, authToken: ct, currentUser: lt, workspaceId: S } = e(), { productSlug: ut } = Xe(), dt = Pe(null), { workspaces: ft } = ce(), pt = ft.length > 0 ? ft : S ? [{
|
|
62
|
+
id: S,
|
|
62
63
|
name: "Current workspace"
|
|
63
|
-
}] : [], { items:
|
|
64
|
+
}] : [], { items: C, clearCart: mt, _hasHydrated: w } = ae(), T = v.pathname.includes("/checkout/addons") && !rt, E = v.pathname.includes("/checkout/store") && !!g, D = T ? "ADDON" : E ? "ORDER" : y?.purchaseType ?? (nt ? "PLAN" : rt ? "ADDON" : "CREDITS"), O = y?.itemId ?? nt ?? rt ?? g, [ht, gt] = d(!1), _t = Pe(!1), [vt, yt] = d(!1), [bt, xt] = d([]), [St, Ct] = d(null), [k, A] = d("select"), [j, wt] = d(null), [Tt, M] = d(null), [N, Et] = d(null), [Dt, Ot] = d("card");
|
|
64
65
|
l(() => {
|
|
65
|
-
if (
|
|
66
|
-
let e = typeof window < "u" ? window.localStorage.getItem(
|
|
66
|
+
if (k !== "success" || !N) return;
|
|
67
|
+
let e = typeof window < "u" ? window.localStorage.getItem(Qe("boff-referral-attribution")) : null;
|
|
67
68
|
if (!e) return;
|
|
68
69
|
let t;
|
|
69
70
|
try {
|
|
@@ -72,27 +73,27 @@ var et = () => {
|
|
|
72
73
|
return;
|
|
73
74
|
}
|
|
74
75
|
if (!t.journeyId && !t.codeId) return;
|
|
75
|
-
let n =
|
|
76
|
+
let n = N.transactionId || j?.paymentId || j?.orderId || g || O || D, r = `${t.journeyId ?? "journey"}:${n}`;
|
|
76
77
|
dt.current !== r && (dt.current = r, se({
|
|
77
78
|
journeyId: t.journeyId,
|
|
78
79
|
codeId: t.codeId,
|
|
79
|
-
eventType:
|
|
80
|
+
eventType: D === "ORDER" ? "STORE_PURCHASE" : "PAID_CONVERSION",
|
|
80
81
|
productSlug: ut,
|
|
81
82
|
actorUserId: lt?.id,
|
|
82
|
-
orderId:
|
|
83
|
-
billingAccountId:
|
|
84
|
-
storeOrderId:
|
|
85
|
-
valueAmount:
|
|
86
|
-
currency:
|
|
83
|
+
orderId: N.transactionId || j?.paymentId || j?.orderId,
|
|
84
|
+
billingAccountId: N.billingAccountId,
|
|
85
|
+
storeOrderId: D === "ORDER" ? g : void 0,
|
|
86
|
+
valueAmount: N.total,
|
|
87
|
+
currency: N.currency,
|
|
87
88
|
mode: "billing-checkout",
|
|
88
89
|
metadata: {
|
|
89
|
-
purchaseType:
|
|
90
|
-
billingAccountName:
|
|
90
|
+
purchaseType: D,
|
|
91
|
+
billingAccountName: N.billingAccountName
|
|
91
92
|
}
|
|
92
93
|
}, {
|
|
93
94
|
apiGatewayUrl: st,
|
|
94
95
|
authToken: ct,
|
|
95
|
-
orgId:
|
|
96
|
+
orgId: x
|
|
96
97
|
}).catch(() => {
|
|
97
98
|
dt.current = null;
|
|
98
99
|
}));
|
|
@@ -100,23 +101,23 @@ var et = () => {
|
|
|
100
101
|
st,
|
|
101
102
|
ct,
|
|
102
103
|
lt?.id,
|
|
103
|
-
D,
|
|
104
104
|
O,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
k,
|
|
106
|
+
x,
|
|
107
|
+
j?.orderId,
|
|
108
|
+
j?.paymentId,
|
|
108
109
|
ut,
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
N,
|
|
111
|
+
D,
|
|
111
112
|
g
|
|
112
113
|
]);
|
|
113
|
-
let [
|
|
114
|
+
let [P, F] = d(1), I = de({
|
|
114
115
|
defaultCurrency: "USD",
|
|
115
|
-
upgradeFromSubscriptionId:
|
|
116
|
-
downgradeFromSubscriptionId:
|
|
116
|
+
upgradeFromSubscriptionId: y?.upgradeFromSubscriptionId,
|
|
117
|
+
downgradeFromSubscriptionId: y?.downgradeFromSubscriptionId
|
|
117
118
|
}), { config: kt, stripeEnabled: At, razorpayEnabled: jt } = me(), { elapsedTime: Mt, error: Nt } = he({
|
|
118
|
-
paymentId:
|
|
119
|
-
billingAccountId:
|
|
119
|
+
paymentId: k === "processing" ? j?.paymentId ?? null : null,
|
|
120
|
+
billingAccountId: I.billingAccount?.id ?? N?.billingAccountId ?? null,
|
|
120
121
|
paymentType: Dt,
|
|
121
122
|
pollingInterval: 5e3,
|
|
122
123
|
maxPollingTime: 3e5,
|
|
@@ -124,139 +125,139 @@ var et = () => {
|
|
|
124
125
|
if (e.transactionId && Et((t) => t && {
|
|
125
126
|
...t,
|
|
126
127
|
transactionId: e.transactionId
|
|
127
|
-
}),
|
|
128
|
-
let e = (
|
|
128
|
+
}), A("success"), T && mt(), (D === "PLAN" || D === "ADDON") && S) {
|
|
129
|
+
let e = (L?.getPlan?.features ?? []).filter((e) => e != null).filter((e) => e.quota?.name && je(e.quota.name)).map((e) => {
|
|
129
130
|
let t = e.quota?.limits, n = t && "type" in t ? String(t.type) : "number", r = e.context && "quantity" in e.context ? Number(e.context.quantity) : null, i = t && "value" in t ? Number(t.value) : null, a = r ?? i;
|
|
130
131
|
return {
|
|
131
132
|
quotaName: e.quota.name,
|
|
132
|
-
productId:
|
|
133
|
+
productId: L?.getPlan?.context?.productId ?? "platform",
|
|
133
134
|
limit: n === "number" ? a : null,
|
|
134
135
|
noLimit: n !== "number",
|
|
135
136
|
resetPeriod: "NEVER",
|
|
136
137
|
quotaMode: "dedicated"
|
|
137
138
|
};
|
|
138
139
|
});
|
|
139
|
-
e.length > 0 && (xt(e),
|
|
140
|
-
let t = e.data?.getActiveSubscriptions?.find((e) => e.planId ===
|
|
140
|
+
e.length > 0 && (xt(e), qt().then((e) => {
|
|
141
|
+
let t = e.data?.getActiveSubscriptions?.find((e) => e.planId === O);
|
|
141
142
|
t && Ct(t.id);
|
|
142
143
|
}), pt.length > 1 && yt(!0));
|
|
143
144
|
}
|
|
144
145
|
},
|
|
145
146
|
onFailure: (e) => {
|
|
146
|
-
|
|
147
|
+
M(e.failureReason || "Payment failed"), A("error");
|
|
147
148
|
},
|
|
148
149
|
onTimeout: () => {
|
|
149
|
-
|
|
150
|
+
M("Payment verification timed out. Please check your billing history for the payment status."), A("error");
|
|
150
151
|
}
|
|
151
|
-
}), { data: Pt, loading: Ft, refetch: It } = ee({}), { data:
|
|
152
|
-
variables: { id:
|
|
153
|
-
skip:
|
|
154
|
-
}), { data:
|
|
155
|
-
variables: { addonIDs:
|
|
156
|
-
skip:
|
|
157
|
-
}), { data:
|
|
152
|
+
}), { data: Pt, loading: Ft, refetch: It } = ee({}), { data: L, loading: Lt } = ne({
|
|
153
|
+
variables: { id: O },
|
|
154
|
+
skip: D !== "PLAN" || !O
|
|
155
|
+
}), { data: R, loading: Rt } = re({
|
|
156
|
+
variables: { addonIDs: O ? [O] : [] },
|
|
157
|
+
skip: D !== "ADDON" || !O || E
|
|
158
|
+
}), { data: z } = ie({
|
|
158
159
|
variables: { id: g },
|
|
159
|
-
skip: !
|
|
160
|
-
}),
|
|
161
|
-
let e =
|
|
160
|
+
skip: !E || !g
|
|
161
|
+
}), B = D === "PLAN" ? L?.getPlan?.nativeProductId ?? O : D === "ADDON" && !T ? R?.getSelectedAddons?.[0]?.nativeProductId ?? O : void 0, zt = u(() => {
|
|
162
|
+
let e = z?.getStoreOrder?.lineItems;
|
|
162
163
|
return Array.isArray(e) ? e : [];
|
|
163
|
-
}, [
|
|
164
|
+
}, [z]), V = E && zt.some((e) => String(e.itemType).toUpperCase() === "PHYSICAL"), Bt = Ne(z?.getStoreOrder?.currency), [H, Vt] = d({
|
|
164
165
|
shippingAddressId: null,
|
|
165
166
|
shippingMethodId: null,
|
|
166
167
|
shippingCost: 0,
|
|
167
168
|
destinationCountry: null
|
|
168
|
-
}), [
|
|
169
|
-
variables: { billingAccountId:
|
|
170
|
-
skip: !
|
|
171
|
-
}), { data:
|
|
172
|
-
variables: { billingAccountId:
|
|
173
|
-
skip: !
|
|
174
|
-
}),
|
|
169
|
+
}), [Ht] = ue(), { data: Ut, loading: Wt } = s({
|
|
170
|
+
variables: { billingAccountId: I.billingAccount?.id },
|
|
171
|
+
skip: !I.billingAccount?.id
|
|
172
|
+
}), { data: Gt, loading: Kt, refetch: qt } = o({
|
|
173
|
+
variables: { billingAccountId: I.billingAccount?.id },
|
|
174
|
+
skip: !I.billingAccount?.id || D !== "ADDON" && D !== "PLAN" || E
|
|
175
|
+
}), U = u(() => Gt?.getActiveSubscriptions ?? [], [Gt]), W = u(() => !I.selectedSubscriptionId || U.length === 0 ? null : U.find((e) => e.id === I.selectedSubscriptionId) ?? null, [I.selectedSubscriptionId, U]), G = I.items[0]?.type === "CREDITS" ? I.items[0].quantity : 100, { data: Jt, loading: Yt } = te({
|
|
175
176
|
variables: {
|
|
176
|
-
creditAmount:
|
|
177
|
-
currency:
|
|
177
|
+
creditAmount: G,
|
|
178
|
+
currency: I.selectedCurrency || "USD"
|
|
178
179
|
},
|
|
179
|
-
skip:
|
|
180
|
-
}),
|
|
181
|
-
if (!
|
|
182
|
-
let e =
|
|
180
|
+
skip: D !== "CREDITS"
|
|
181
|
+
}), K = u(() => Jt?.getCostOfCredits?.amount && G > 0 ? Jt.getCostOfCredits.amount / G : .01, [Jt, G]), q = u(() => Ut?.getPaymentMethods ?? [], [Ut]), J = u(() => Pt?.myBillingAccounts ?? [], [Pt]), Y = u(() => {
|
|
182
|
+
if (!I.billingAccount) return;
|
|
183
|
+
let e = J.find((e) => e.id === I.billingAccount?.id)?.billingAddresses;
|
|
183
184
|
if (e && e.length > 0) return e[0]?.country || void 0;
|
|
184
|
-
}, [
|
|
185
|
+
}, [I.billingAccount, J]), [Xt, Zt] = d(null);
|
|
185
186
|
l(() => {
|
|
186
|
-
if (
|
|
187
|
+
if (Y) if (Y === "IN") I.selectedCurrency !== "INR" && I.setCurrency("INR"), jt && Xt !== Y && I.selectedProvider !== "CREDITS" && (I.setPaymentProvider("RAZORPAY"), Zt(Y));
|
|
187
188
|
else {
|
|
188
|
-
if (
|
|
189
|
-
let e =
|
|
190
|
-
|
|
189
|
+
if (I.selectedCurrency === "INR") {
|
|
190
|
+
let e = I.billingAccount?.currency, t = e && e !== "INR" ? e : "USD";
|
|
191
|
+
I.setCurrency(t);
|
|
191
192
|
}
|
|
192
|
-
|
|
193
|
+
I.selectedProvider === "RAZORPAY" && (I.setPaymentProvider("STRIPE"), Zt(Y));
|
|
193
194
|
}
|
|
194
195
|
}, [
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
196
|
+
Y,
|
|
197
|
+
I.selectedCurrency,
|
|
198
|
+
I.selectedProvider,
|
|
199
|
+
I.setCurrency,
|
|
200
|
+
I.setPaymentProvider,
|
|
201
|
+
I.billingAccount?.currency,
|
|
201
202
|
jt,
|
|
202
|
-
|
|
203
|
+
Xt
|
|
203
204
|
]);
|
|
204
|
-
let { billingAccount:
|
|
205
|
+
let { billingAccount: Qt, canPayWithCredits: $t, hasEnoughCredits: en, selectedCurrency: X, selectedPaymentMethodId: tn, selectedProvider: nn, setCurrency: Z, setPaymentProvider: rn, setSelectedPaymentMethodId: an } = I;
|
|
205
206
|
l(() => {
|
|
206
|
-
if (
|
|
207
|
-
let e =
|
|
208
|
-
e !== "INR" &&
|
|
207
|
+
if (!Qt?.currency || Y === "IN") return;
|
|
208
|
+
let e = Qt.currency;
|
|
209
|
+
e !== "INR" && X !== e && Z(e);
|
|
209
210
|
}, [
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
211
|
+
Y,
|
|
212
|
+
Qt,
|
|
213
|
+
X,
|
|
214
|
+
Z
|
|
214
215
|
]), l(() => {
|
|
215
|
-
if (!(
|
|
216
|
-
if (
|
|
217
|
-
|
|
216
|
+
if (!(nn !== "AUTO" && nn !== null)) {
|
|
217
|
+
if ($t && en) {
|
|
218
|
+
rn("CREDITS"), an(null);
|
|
218
219
|
return;
|
|
219
220
|
}
|
|
220
|
-
if (
|
|
221
|
-
let e =
|
|
221
|
+
if (q.length > 0 && !tn) {
|
|
222
|
+
let e = q.find((e) => e.isDefault && e.isVerified), t = q.find((e) => e.isVerified), n = e || t;
|
|
222
223
|
if (n) {
|
|
223
|
-
an(n.id), n.razorpayPaymentMethodId ?
|
|
224
|
+
an(n.id), n.razorpayPaymentMethodId ? rn("RAZORPAY") : n.stripePaymentMethodId && rn("STRIPE");
|
|
224
225
|
return;
|
|
225
226
|
}
|
|
226
227
|
}
|
|
227
228
|
}
|
|
228
229
|
}, [
|
|
230
|
+
$t,
|
|
229
231
|
en,
|
|
232
|
+
q,
|
|
230
233
|
tn,
|
|
231
|
-
G,
|
|
232
234
|
nn,
|
|
233
235
|
rn,
|
|
234
|
-
X,
|
|
235
236
|
an
|
|
236
237
|
]);
|
|
237
|
-
let [
|
|
238
|
+
let [Q, $] = d(!1);
|
|
238
239
|
l(() => {
|
|
239
|
-
if (!
|
|
240
|
-
let e =
|
|
241
|
-
|
|
240
|
+
if (!E || Q || !z?.getStoreOrder) return;
|
|
241
|
+
let e = Ne(z.getStoreOrder.currency);
|
|
242
|
+
X !== e && Z(e);
|
|
242
243
|
}, [
|
|
243
|
-
|
|
244
|
+
E,
|
|
245
|
+
Q,
|
|
246
|
+
X,
|
|
244
247
|
Z,
|
|
245
|
-
|
|
246
|
-
Y,
|
|
247
|
-
R
|
|
248
|
+
z
|
|
248
249
|
]), l(() => {
|
|
249
|
-
if (
|
|
250
|
-
let e =
|
|
251
|
-
|
|
250
|
+
if (D === "PLAN" && L?.getPlan?.pricingModel === "PER_SEAT") {
|
|
251
|
+
let e = L.getPlan.minSeats ?? 1;
|
|
252
|
+
F((t) => t < e ? e : t);
|
|
252
253
|
}
|
|
253
|
-
}, [
|
|
254
|
-
|
|
255
|
-
}, [
|
|
256
|
-
if (!
|
|
257
|
-
if (
|
|
258
|
-
|
|
259
|
-
for (let e of
|
|
254
|
+
}, [L, D]), l(() => {
|
|
255
|
+
D === "PLAN" && L?.getPlan?.pricingModel === "PER_SEAT" && Q && $(!1);
|
|
256
|
+
}, [P]), l(() => {
|
|
257
|
+
if (!Q) {
|
|
258
|
+
if (T && w && C.length > 0) {
|
|
259
|
+
I.clearItems();
|
|
260
|
+
for (let e of C) {
|
|
260
261
|
let t = e.addon, n = t.features?.map((e) => {
|
|
261
262
|
let t = e.quota?.limits, n = e.context && "quantity" in e.context ? Number(e.context.quantity) : void 0;
|
|
262
263
|
return {
|
|
@@ -267,7 +268,7 @@ var et = () => {
|
|
|
267
268
|
value: n
|
|
268
269
|
} : t
|
|
269
270
|
};
|
|
270
|
-
}) || [], r =
|
|
271
|
+
}) || [], r = I.selectedCurrency || "USD", i = t.currencyPrices, a = i?.[r] ?? t.price, o = i?.USD ?? t.price, ee = {
|
|
271
272
|
id: t.id,
|
|
272
273
|
type: "ADDON",
|
|
273
274
|
name: t.name,
|
|
@@ -279,13 +280,13 @@ var et = () => {
|
|
|
279
280
|
features: n,
|
|
280
281
|
metadata: { addonId: t.id }
|
|
281
282
|
};
|
|
282
|
-
|
|
283
|
+
I.addItem(ee);
|
|
283
284
|
}
|
|
284
|
-
|
|
285
|
+
$(!0);
|
|
285
286
|
return;
|
|
286
287
|
}
|
|
287
|
-
if (
|
|
288
|
-
let e =
|
|
288
|
+
if (D === "PLAN" && L?.getPlan) {
|
|
289
|
+
let e = L.getPlan, t = e.features?.map((e) => {
|
|
289
290
|
let t = e.quota?.limits, n = e.context && "quantity" in e.context ? Number(e.context.quantity) : void 0;
|
|
290
291
|
return {
|
|
291
292
|
id: e.quota?.id || e.id,
|
|
@@ -295,15 +296,15 @@ var et = () => {
|
|
|
295
296
|
value: n
|
|
296
297
|
} : t
|
|
297
298
|
};
|
|
298
|
-
}) || [], n =
|
|
299
|
+
}) || [], n = I.selectedCurrency || "USD", r = e.currencyPrices, i = e.pricingModel === "PER_SEAT", a;
|
|
299
300
|
if (i && e.pricePerSeat) {
|
|
300
301
|
let t = r?.[n];
|
|
301
|
-
a = (typeof t == "object" && t?.perSeat ? t.perSeat : e.pricePerSeat) *
|
|
302
|
+
a = (typeof t == "object" && t?.perSeat ? t.perSeat : e.pricePerSeat) * P;
|
|
302
303
|
} else {
|
|
303
304
|
let t = r?.[n];
|
|
304
305
|
a = typeof t == "number" ? t : e.price;
|
|
305
306
|
}
|
|
306
|
-
let o = r?.USD, ee = typeof o == "number" ? o : e.price, te = typeof o == "object" && o?.perSeat ? o.perSeat : e.pricePerSeat, s = i ?
|
|
307
|
+
let o = r?.USD, ee = typeof o == "number" ? o : e.price, te = typeof o == "object" && o?.perSeat ? o.perSeat : e.pricePerSeat, s = i ? P : 1, ne = {
|
|
307
308
|
id: e.id,
|
|
308
309
|
type: "PLAN",
|
|
309
310
|
name: e.name,
|
|
@@ -319,9 +320,9 @@ var et = () => {
|
|
|
319
320
|
seatCount: i ? s : void 0
|
|
320
321
|
}
|
|
321
322
|
};
|
|
322
|
-
|
|
323
|
-
} else if (
|
|
324
|
-
let e =
|
|
323
|
+
I.addItem(ne), $(!0);
|
|
324
|
+
} else if (D === "ADDON" && !T && R?.getSelectedAddons?.[0]) {
|
|
325
|
+
let e = R.getSelectedAddons[0], t = e.features?.map((e) => {
|
|
325
326
|
let t = e.quota?.limits, n = e.context && "quantity" in e.context ? Number(e.context.quantity) : void 0;
|
|
326
327
|
return {
|
|
327
328
|
id: e.quota?.id || e.id,
|
|
@@ -331,7 +332,7 @@ var et = () => {
|
|
|
331
332
|
value: n
|
|
332
333
|
} : t
|
|
333
334
|
};
|
|
334
|
-
}) || [], n =
|
|
335
|
+
}) || [], n = I.selectedCurrency || "USD", r = e.currencyPrices, i = r?.[n] ?? e.price, a = r?.USD ?? e.price, o = {
|
|
335
336
|
id: e.id,
|
|
336
337
|
type: "ADDON",
|
|
337
338
|
name: e.name,
|
|
@@ -339,65 +340,65 @@ var et = () => {
|
|
|
339
340
|
price: i,
|
|
340
341
|
priceUSD: a,
|
|
341
342
|
currency: n,
|
|
342
|
-
quantity:
|
|
343
|
+
quantity: y?.quantity ?? 1,
|
|
343
344
|
features: t,
|
|
344
345
|
metadata: { addonId: e.id }
|
|
345
346
|
};
|
|
346
|
-
|
|
347
|
-
} else if (
|
|
348
|
-
|
|
349
|
-
let e =
|
|
350
|
-
for (let e of t)
|
|
351
|
-
|
|
352
|
-
} else if (
|
|
347
|
+
I.addItem(o), $(!0);
|
|
348
|
+
} else if (E && z?.getStoreOrder) {
|
|
349
|
+
I.clearItems();
|
|
350
|
+
let e = z.getStoreOrder, t = Me(e);
|
|
351
|
+
for (let e of t) I.addItem(e);
|
|
352
|
+
$(!0);
|
|
353
|
+
} else if (D === "CREDITS") {
|
|
353
354
|
let e = {
|
|
354
355
|
id: "credits-purchase",
|
|
355
356
|
type: "CREDITS",
|
|
356
357
|
name: "Credits",
|
|
357
358
|
description: "Purchase credits for your account",
|
|
358
|
-
price:
|
|
359
|
-
currency:
|
|
359
|
+
price: K,
|
|
360
|
+
currency: I.selectedCurrency || "USD",
|
|
360
361
|
quantity: 100
|
|
361
362
|
};
|
|
362
|
-
|
|
363
|
+
I.addItem(e), $(!0);
|
|
363
364
|
}
|
|
364
365
|
}
|
|
365
366
|
}, [
|
|
366
|
-
|
|
367
|
-
I,
|
|
367
|
+
D,
|
|
368
368
|
L,
|
|
369
369
|
R,
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
370
|
+
z,
|
|
371
|
+
I.addItem,
|
|
372
|
+
I.clearItems,
|
|
373
|
+
y?.quantity,
|
|
374
|
+
Q,
|
|
375
375
|
T,
|
|
376
|
-
|
|
376
|
+
E,
|
|
377
377
|
C,
|
|
378
|
-
|
|
379
|
-
|
|
378
|
+
w,
|
|
379
|
+
K,
|
|
380
|
+
I.selectedCurrency
|
|
380
381
|
]), l(() => {
|
|
381
|
-
if (!(!
|
|
382
|
-
for (let e of
|
|
383
|
-
let t = e.price *
|
|
384
|
-
|
|
382
|
+
if (!(!E || !Q || I.convertedAmount === null)) {
|
|
383
|
+
for (let e of I.items) if (e.type === "ORDER" && e.currency !== I.selectedCurrency) {
|
|
384
|
+
let t = e.price * I.conversionRate;
|
|
385
|
+
I.updateItemPrice(e.id, t, I.selectedCurrency);
|
|
385
386
|
}
|
|
386
387
|
}
|
|
387
388
|
}, [
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
389
|
+
E,
|
|
390
|
+
Q,
|
|
391
|
+
I.convertedAmount,
|
|
392
|
+
I.conversionRate,
|
|
393
|
+
I.selectedCurrency,
|
|
394
|
+
I.updateItemPrice
|
|
394
395
|
]);
|
|
395
|
-
let
|
|
396
|
+
let on = Pe(null);
|
|
396
397
|
l(() => {
|
|
397
|
-
if (
|
|
398
|
-
let e =
|
|
398
|
+
if (V) if (H.shippingCost > 0) {
|
|
399
|
+
let e = I.selectedCurrency, t = Bt !== e && I.convertedAmount !== null ? H.shippingCost * I.conversionRate : H.shippingCost, n = on.current;
|
|
399
400
|
if (n && n.price === t && n.currency === e) return;
|
|
400
|
-
n === null ?
|
|
401
|
+
n === null ? I.addItem({
|
|
401
402
|
id: le,
|
|
402
403
|
type: "ORDER",
|
|
403
404
|
name: "Shipping",
|
|
@@ -408,134 +409,134 @@ var et = () => {
|
|
|
408
409
|
storeOrderId: g,
|
|
409
410
|
isShipping: !0
|
|
410
411
|
}
|
|
411
|
-
}) :
|
|
412
|
+
}) : I.updateItemPrice(le, t, e), on.current = {
|
|
412
413
|
price: t,
|
|
413
414
|
currency: e
|
|
414
415
|
};
|
|
415
|
-
} else
|
|
416
|
+
} else on.current !== null && (on.current = null, I.removeItem(le));
|
|
416
417
|
}, [
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
418
|
+
V,
|
|
419
|
+
H.shippingCost,
|
|
420
|
+
Bt,
|
|
421
|
+
I.selectedCurrency,
|
|
422
|
+
I.conversionRate,
|
|
423
|
+
I.convertedAmount,
|
|
423
424
|
g,
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
425
|
+
I.addItem,
|
|
426
|
+
I.updateItemPrice,
|
|
427
|
+
I.removeItem
|
|
427
428
|
]), l(() => {
|
|
428
|
-
if (
|
|
429
|
-
let e =
|
|
430
|
-
e && e.price !==
|
|
429
|
+
if (D === "CREDITS" && Q && K > 0) {
|
|
430
|
+
let e = I.items.find((e) => e.id === "credits-purchase");
|
|
431
|
+
e && e.price !== K && I.updateItemPrice("credits-purchase", K);
|
|
431
432
|
}
|
|
432
433
|
}, [
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
434
|
+
D,
|
|
435
|
+
Q,
|
|
436
|
+
K,
|
|
437
|
+
I.items,
|
|
438
|
+
I.updateItemPrice
|
|
438
439
|
]), l(() => {
|
|
439
|
-
if (!
|
|
440
|
-
let e =
|
|
441
|
-
for (let t of
|
|
442
|
-
let n =
|
|
443
|
-
(t.price !== n || t.currency !== e) &&
|
|
440
|
+
if (!Q || I.items.length === 0) return;
|
|
441
|
+
let e = I.selectedCurrency || "USD";
|
|
442
|
+
for (let t of I.items) if (t.type === "PLAN" && L?.getPlan) {
|
|
443
|
+
let n = L.getPlan.currencyPrices?.[e] ?? L.getPlan.price;
|
|
444
|
+
(t.price !== n || t.currency !== e) && I.updateItemPrice(t.id, n, e);
|
|
444
445
|
} else if (t.type === "ADDON") {
|
|
445
|
-
if (!
|
|
446
|
-
let n =
|
|
447
|
-
(t.price !== r || t.currency !== e) &&
|
|
446
|
+
if (!T && R?.getSelectedAddons?.[0]) {
|
|
447
|
+
let n = R.getSelectedAddons[0], r = n.currencyPrices?.[e] ?? n.price;
|
|
448
|
+
(t.price !== r || t.currency !== e) && I.updateItemPrice(t.id, r, e);
|
|
448
449
|
}
|
|
449
|
-
if (
|
|
450
|
-
let n =
|
|
450
|
+
if (T) {
|
|
451
|
+
let n = C.find((e) => e.addon.id === t.id);
|
|
451
452
|
if (n) {
|
|
452
453
|
let r = n.addon.currencyPrices?.[e] ?? n.addon.price;
|
|
453
|
-
(t.price !== r || t.currency !== e) &&
|
|
454
|
+
(t.price !== r || t.currency !== e) && I.updateItemPrice(t.id, r, e);
|
|
454
455
|
}
|
|
455
456
|
}
|
|
456
457
|
}
|
|
457
458
|
}, [
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
I,
|
|
459
|
+
I.selectedCurrency,
|
|
460
|
+
Q,
|
|
461
|
+
I.items,
|
|
462
|
+
I.updateItemPrice,
|
|
463
463
|
L,
|
|
464
|
-
|
|
465
|
-
|
|
464
|
+
R,
|
|
465
|
+
C,
|
|
466
|
+
T
|
|
466
467
|
]), l(() => {
|
|
467
|
-
if (
|
|
468
|
-
if (
|
|
469
|
-
let e =
|
|
468
|
+
if (J.length > 0 && !I.billingAccount) {
|
|
469
|
+
if (y?.billingAccountId) {
|
|
470
|
+
let e = J.find((e) => e.id === y.billingAccountId);
|
|
470
471
|
if (e) {
|
|
471
|
-
|
|
472
|
+
I.setBillingAccount(e);
|
|
472
473
|
return;
|
|
473
474
|
}
|
|
474
475
|
}
|
|
475
|
-
if (
|
|
476
|
-
let e = i(
|
|
476
|
+
if (x) {
|
|
477
|
+
let e = i(x);
|
|
477
478
|
if (e) {
|
|
478
|
-
let t =
|
|
479
|
+
let t = J.find((t) => t.id === e);
|
|
479
480
|
if (t) {
|
|
480
|
-
|
|
481
|
+
I.setBillingAccount(t);
|
|
481
482
|
return;
|
|
482
483
|
}
|
|
483
484
|
}
|
|
484
485
|
}
|
|
485
|
-
|
|
486
|
+
I.setBillingAccount(J[0]);
|
|
486
487
|
}
|
|
487
488
|
}, [
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
489
|
+
J,
|
|
490
|
+
I.billingAccount,
|
|
491
|
+
I.setBillingAccount,
|
|
492
|
+
y?.billingAccountId,
|
|
493
|
+
x
|
|
493
494
|
]);
|
|
494
|
-
let
|
|
495
|
+
let sn = !!(y?.upgradeFromSubscriptionId || y?.downgradeFromSubscriptionId);
|
|
495
496
|
l(() => {
|
|
496
|
-
|
|
497
|
+
T && w && C.length === 0 && !Q && _("/addons", { replace: !0 });
|
|
497
498
|
}, [
|
|
498
|
-
C,
|
|
499
|
-
S.length,
|
|
500
499
|
w,
|
|
501
|
-
|
|
500
|
+
C.length,
|
|
501
|
+
T,
|
|
502
|
+
Q,
|
|
502
503
|
_
|
|
503
504
|
]);
|
|
504
|
-
let
|
|
505
|
-
billingAccountId:
|
|
506
|
-
purchaseType:
|
|
507
|
-
productId:
|
|
508
|
-
}),
|
|
509
|
-
if (!
|
|
505
|
+
let cn = pe({
|
|
506
|
+
billingAccountId: I.billingAccount?.id,
|
|
507
|
+
purchaseType: D,
|
|
508
|
+
productId: B
|
|
509
|
+
}), ln = c(async () => {
|
|
510
|
+
if (!I.billingAccount) return;
|
|
510
511
|
let e = _t.current;
|
|
511
|
-
if (_t.current = !1, !e && !
|
|
512
|
+
if (_t.current = !1, !e && !Oe(I.billingAccount)) {
|
|
512
513
|
gt(!0);
|
|
513
514
|
return;
|
|
514
515
|
}
|
|
515
|
-
if (
|
|
516
|
-
let e = (await
|
|
516
|
+
if (M(null), V) try {
|
|
517
|
+
let e = (await Ht({ variables: { input: {
|
|
517
518
|
orderId: g,
|
|
518
|
-
shippingMethodId:
|
|
519
|
-
...
|
|
519
|
+
shippingMethodId: H.shippingMethodId,
|
|
520
|
+
...H.shippingAddressId ? { shippingAddressId: H.shippingAddressId } : {}
|
|
520
521
|
} } })).data?.setStoreOrderShipping?.shippingCost;
|
|
521
|
-
typeof e == "number" && e !==
|
|
522
|
+
typeof e == "number" && e !== H.shippingCost && Vt((t) => ({
|
|
522
523
|
...t,
|
|
523
524
|
shippingCost: e
|
|
524
525
|
}));
|
|
525
526
|
} catch (e) {
|
|
526
|
-
|
|
527
|
+
M(e instanceof Error && e.message ? e.message : "Could not save your shipping details. Please review your delivery address and try again."), A("error");
|
|
527
528
|
return;
|
|
528
529
|
}
|
|
529
|
-
let t =
|
|
530
|
+
let t = I.billingAccount.creditAmount ?? 0, n = [...I.items], r = I.total, i = I.creditsRequired, a = await I.initiatePayment();
|
|
530
531
|
if (a.success) {
|
|
531
|
-
if (
|
|
532
|
+
if (b("billing.checkout.initiated", {
|
|
532
533
|
route: "/billing/checkout",
|
|
533
534
|
entityId: a.paymentId ?? a.orderId,
|
|
534
535
|
source: "checkout",
|
|
535
536
|
amount: a.total || r,
|
|
536
|
-
currency: a.currency ||
|
|
537
|
-
}),
|
|
538
|
-
|
|
537
|
+
currency: a.currency || I.selectedCurrency
|
|
538
|
+
}), I.selectedProvider === "CREDITS") {
|
|
539
|
+
b("billing.credits.spent", {
|
|
539
540
|
route: "/billing/checkout",
|
|
540
541
|
entityId: a.orderId,
|
|
541
542
|
source: "checkout",
|
|
@@ -544,25 +545,25 @@ var et = () => {
|
|
|
544
545
|
}), Et({
|
|
545
546
|
items: n,
|
|
546
547
|
total: i,
|
|
547
|
-
billingAccountName:
|
|
548
|
-
billingAccountId:
|
|
548
|
+
billingAccountName: I.billingAccount.name,
|
|
549
|
+
billingAccountId: I.billingAccount.id,
|
|
549
550
|
previousBalance: t,
|
|
550
551
|
newBalance: t - i,
|
|
551
552
|
paymentMethod: "credits",
|
|
552
553
|
currency: "Credits",
|
|
553
554
|
transactionId: a.orderId
|
|
554
|
-
}), Ot("credits"), wt({ paymentId: a.orderId }),
|
|
555
|
+
}), Ot("credits"), wt({ paymentId: a.orderId }), A("processing");
|
|
555
556
|
return;
|
|
556
557
|
}
|
|
557
558
|
Et({
|
|
558
559
|
items: n,
|
|
559
560
|
total: a.total || r,
|
|
560
|
-
billingAccountName:
|
|
561
|
-
billingAccountId:
|
|
561
|
+
billingAccountName: I.billingAccount.name,
|
|
562
|
+
billingAccountId: I.billingAccount.id,
|
|
562
563
|
previousBalance: t,
|
|
563
564
|
newBalance: t,
|
|
564
565
|
paymentMethod: "card",
|
|
565
|
-
currency: a.currency ||
|
|
566
|
+
currency: a.currency || I.selectedCurrency,
|
|
566
567
|
transactionId: a.paymentId
|
|
567
568
|
}), Ot("card"), wt({
|
|
568
569
|
clientSecret: a.clientSecret,
|
|
@@ -576,97 +577,109 @@ var et = () => {
|
|
|
576
577
|
prefillContact: a.prefillContact,
|
|
577
578
|
total: a.total,
|
|
578
579
|
currency: a.currency
|
|
579
|
-
}), a.paymentComplete ?
|
|
580
|
-
} else
|
|
580
|
+
}), a.paymentComplete ? A("processing") : A("payment");
|
|
581
|
+
} else b("billing.checkout.failed", {
|
|
581
582
|
route: "/billing/checkout",
|
|
582
583
|
source: "checkout",
|
|
583
584
|
reason: a.error || "Payment initiation failed"
|
|
584
|
-
}),
|
|
585
|
+
}), M(a.error || "Payment initiation failed"), A("error");
|
|
585
586
|
}, [
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
587
|
+
I,
|
|
588
|
+
b,
|
|
589
|
+
V,
|
|
590
|
+
H,
|
|
590
591
|
g,
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
]),
|
|
594
|
-
|
|
592
|
+
Bt,
|
|
593
|
+
Ht
|
|
594
|
+
]), un = c((e) => {
|
|
595
|
+
b("billing.payment.succeeded", {
|
|
595
596
|
route: "/billing/checkout",
|
|
596
|
-
entityId:
|
|
597
|
+
entityId: j?.paymentId ?? j?.orderId,
|
|
597
598
|
source: "checkout"
|
|
598
|
-
}), wt((e) => e),
|
|
599
|
+
}), wt((e) => e), A("processing");
|
|
599
600
|
}, [
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
]),
|
|
604
|
-
|
|
601
|
+
b,
|
|
602
|
+
j?.orderId,
|
|
603
|
+
j?.paymentId
|
|
604
|
+
]), dn = c((e) => {
|
|
605
|
+
b("billing.payment.failed", {
|
|
605
606
|
route: "/billing/checkout",
|
|
606
|
-
entityId:
|
|
607
|
+
entityId: j?.paymentId ?? j?.orderId,
|
|
607
608
|
source: "checkout",
|
|
608
609
|
reason: e
|
|
609
|
-
}),
|
|
610
|
+
}), M(e), A("error");
|
|
610
611
|
}, [
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
]),
|
|
615
|
-
|
|
616
|
-
}, [
|
|
612
|
+
b,
|
|
613
|
+
j?.orderId,
|
|
614
|
+
j?.paymentId
|
|
615
|
+
]), fn = c((e) => {
|
|
616
|
+
I.updateItemQuantity("credits-purchase", e);
|
|
617
|
+
}, [I]);
|
|
617
618
|
if (!it.canProcessPayment) return /* @__PURE__ */ p(t, { message: "You don't have permission to make purchases." });
|
|
618
|
-
if (fe() &&
|
|
619
|
-
purchaseType:
|
|
620
|
-
|
|
621
|
-
billingAccountId:
|
|
622
|
-
nativeCheckout: sn,
|
|
619
|
+
if (fe() && D !== "PLAN") return /* @__PURE__ */ p(_e, {
|
|
620
|
+
purchaseType: D,
|
|
621
|
+
path: v.pathname + v.search,
|
|
622
|
+
billingAccountId: I.billingAccount?.id,
|
|
623
623
|
onBack: () => _("dashboard")
|
|
624
624
|
});
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
625
|
+
if (fe() && D === "PLAN" && B) return /* @__PURE__ */ p(ge, {
|
|
626
|
+
purchaseType: D,
|
|
627
|
+
productId: B,
|
|
628
|
+
billingAccountId: I.billingAccount?.id,
|
|
629
|
+
nativeCheckout: cn,
|
|
630
|
+
onBack: () => _("dashboard")
|
|
631
|
+
});
|
|
632
|
+
if (fe() && D === "PLAN" && !B) return /* @__PURE__ */ p(_e, {
|
|
633
|
+
purchaseType: D,
|
|
634
|
+
path: v.pathname + v.search,
|
|
635
|
+
billingAccountId: I.billingAccount?.id,
|
|
636
|
+
onBack: () => _("dashboard")
|
|
637
|
+
});
|
|
638
|
+
let pn = Ft || Lt && D === "PLAN" || Rt && D === "ADDON" && !T || T && !w;
|
|
639
|
+
if (T && w && C.length === 0 && !Q) return null;
|
|
640
|
+
let mn = () => {
|
|
641
|
+
if (T) {
|
|
642
|
+
let e = I.items.length;
|
|
630
643
|
return `Purchase ${e} Add-on${e === 1 ? "" : "s"}`;
|
|
631
644
|
}
|
|
632
|
-
switch (
|
|
645
|
+
switch (D) {
|
|
633
646
|
case "CREDITS": return "Buy Credits";
|
|
634
647
|
case "PLAN": return "Subscribe to Plan";
|
|
635
648
|
case "ADDON": return "Purchase Add-on";
|
|
636
649
|
default: return "Checkout";
|
|
637
650
|
}
|
|
638
|
-
},
|
|
639
|
-
switch (
|
|
640
|
-
case "CREDITS": return /* @__PURE__ */ p(
|
|
641
|
-
case "PLAN": return /* @__PURE__ */ p(
|
|
642
|
-
case "ADDON": return /* @__PURE__ */ p(
|
|
643
|
-
default: return /* @__PURE__ */ p(
|
|
651
|
+
}, hn = () => {
|
|
652
|
+
switch (D) {
|
|
653
|
+
case "CREDITS": return /* @__PURE__ */ p(ze, { className: "size-6" });
|
|
654
|
+
case "PLAN": return /* @__PURE__ */ p(He, { className: "size-6" });
|
|
655
|
+
case "ADDON": return /* @__PURE__ */ p(Le, { className: "size-6" });
|
|
656
|
+
default: return /* @__PURE__ */ p(Ge, { className: "size-6" });
|
|
644
657
|
}
|
|
645
658
|
};
|
|
646
|
-
if (
|
|
659
|
+
if (pn) return /* @__PURE__ */ p("div", {
|
|
647
660
|
className: "flex items-center justify-center min-h-[400px]",
|
|
648
661
|
children: /* @__PURE__ */ m("div", {
|
|
649
662
|
className: "text-center space-y-4",
|
|
650
|
-
children: [/* @__PURE__ */ p(
|
|
663
|
+
children: [/* @__PURE__ */ p(Ve, { className: "size-8 animate-spin mx-auto text-text-link" }), /* @__PURE__ */ p("p", {
|
|
651
664
|
className: "text-text-secondary",
|
|
652
665
|
children: h("billing.checkout.loadingCheckout", "Loading checkout...")
|
|
653
666
|
})]
|
|
654
667
|
})
|
|
655
668
|
});
|
|
656
|
-
if (
|
|
669
|
+
if (k === "success") {
|
|
657
670
|
let e = (e) => {
|
|
658
|
-
if (!
|
|
659
|
-
let t =
|
|
671
|
+
if (!N) return `${e.toFixed(2)}`;
|
|
672
|
+
let t = N.currency;
|
|
660
673
|
return t === "Credits" ? `${e.toFixed(2)} Credits` : `${{
|
|
661
674
|
INR: "₹",
|
|
662
675
|
USD: "$",
|
|
663
676
|
EUR: "€",
|
|
664
677
|
GBP: "£"
|
|
665
678
|
}[t] || t + " "}${e.toFixed(2)}`;
|
|
666
|
-
}, t = (e) => `${e.toFixed(2)} Credits`, n =
|
|
667
|
-
if (!
|
|
679
|
+
}, t = (e) => `${e.toFixed(2)} Credits`, n = N ? N.items.reduce((e, t) => e + t.price * t.quantity, 0) : 0, r = (e) => {
|
|
680
|
+
if (!N || n <= 0) return 0;
|
|
668
681
|
let t = e.price * e.quantity;
|
|
669
|
-
return
|
|
682
|
+
return N.total * (t / n);
|
|
670
683
|
};
|
|
671
684
|
return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ m("div", {
|
|
672
685
|
className: "max-w-2xl mx-auto p-6 space-y-6",
|
|
@@ -675,7 +688,7 @@ var et = () => {
|
|
|
675
688
|
className: "text-center space-y-4",
|
|
676
689
|
children: [/* @__PURE__ */ p("div", {
|
|
677
690
|
className: "inline-flex p-4 rounded-full bg-status-success-bg-subtle text-status-success-text",
|
|
678
|
-
children: /* @__PURE__ */ p(
|
|
691
|
+
children: /* @__PURE__ */ p(Re, { className: "size-12" })
|
|
679
692
|
}), /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("h1", {
|
|
680
693
|
className: "text-2xl font-bold text-text-primary",
|
|
681
694
|
children: h("billing.checkout.paymentSuccessful", "Payment Successful!")
|
|
@@ -684,25 +697,25 @@ var et = () => {
|
|
|
684
697
|
children: h("billing.checkout.purchaseCompleted", "Your purchase has been completed successfully.")
|
|
685
698
|
})] })]
|
|
686
699
|
}),
|
|
687
|
-
|
|
700
|
+
N && /* @__PURE__ */ m("div", {
|
|
688
701
|
className: "bg-bg-surface border border-border-subtle rounded-lg overflow-hidden",
|
|
689
702
|
children: [
|
|
690
703
|
/* @__PURE__ */ m("div", {
|
|
691
704
|
className: "p-4 border-b border-border-subtle",
|
|
692
705
|
children: [/* @__PURE__ */ m("h3", {
|
|
693
706
|
className: "font-semibold text-text-primary mb-3 flex items-center gap-2",
|
|
694
|
-
children: [/* @__PURE__ */ p(
|
|
707
|
+
children: [/* @__PURE__ */ p(Ue, { className: "size-4" }), h("billing.checkout.itemsPurchased", "Items Purchased")]
|
|
695
708
|
}), /* @__PURE__ */ p("div", {
|
|
696
709
|
className: "space-y-2",
|
|
697
|
-
children:
|
|
710
|
+
children: N.items.map((t) => /* @__PURE__ */ m("div", {
|
|
698
711
|
className: "flex items-center justify-between",
|
|
699
712
|
children: [/* @__PURE__ */ m("div", {
|
|
700
713
|
className: "flex items-center gap-2",
|
|
701
714
|
children: [
|
|
702
|
-
t.type === "PLAN" && /* @__PURE__ */ p(
|
|
703
|
-
t.type === "ADDON" && /* @__PURE__ */ p(
|
|
704
|
-
t.type === "CREDITS" && /* @__PURE__ */ p(
|
|
705
|
-
t.type === "ORDER" && /* @__PURE__ */ p(
|
|
715
|
+
t.type === "PLAN" && /* @__PURE__ */ p(He, { className: "size-4 text-accent-blue" }),
|
|
716
|
+
t.type === "ADDON" && /* @__PURE__ */ p(Le, { className: "size-4 text-accent-purple" }),
|
|
717
|
+
t.type === "CREDITS" && /* @__PURE__ */ p(ze, { className: "size-4 text-status-warning-text" }),
|
|
718
|
+
t.type === "ORDER" && /* @__PURE__ */ p(Ge, { className: "size-4 text-status-success-text" }),
|
|
706
719
|
/* @__PURE__ */ p("span", {
|
|
707
720
|
className: "text-text-primary",
|
|
708
721
|
children: t.name
|
|
@@ -714,7 +727,7 @@ var et = () => {
|
|
|
714
727
|
]
|
|
715
728
|
}), /* @__PURE__ */ p("span", {
|
|
716
729
|
className: "text-text-secondary",
|
|
717
|
-
children: e(
|
|
730
|
+
children: e(N.paymentMethod === "credits" ? r(t) : t.price * t.quantity)
|
|
718
731
|
})]
|
|
719
732
|
}, t.id))
|
|
720
733
|
})]
|
|
@@ -728,10 +741,10 @@ var et = () => {
|
|
|
728
741
|
children: h("billing.checkout.paymentMethod", "Payment Method")
|
|
729
742
|
}), /* @__PURE__ */ p("div", {
|
|
730
743
|
className: "flex items-center gap-2",
|
|
731
|
-
children:
|
|
744
|
+
children: N.paymentMethod === "credits" ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(Ke, { className: "size-4 text-status-warning-text" }), /* @__PURE__ */ p("span", {
|
|
732
745
|
className: "font-medium text-text-primary",
|
|
733
746
|
children: h("billing.checkout.credits", "Credits")
|
|
734
|
-
})] }) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(
|
|
747
|
+
})] }) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(Be, { className: "size-4 text-accent-blue" }), /* @__PURE__ */ p("span", {
|
|
735
748
|
className: "font-medium text-text-primary",
|
|
736
749
|
children: h("billing.checkout.card", "Card")
|
|
737
750
|
})] })
|
|
@@ -742,16 +755,16 @@ var et = () => {
|
|
|
742
755
|
children: h("billing.checkout.totalPaid", "Total Paid")
|
|
743
756
|
}), /* @__PURE__ */ p("p", {
|
|
744
757
|
className: "font-bold text-lg text-text-primary",
|
|
745
|
-
children: e(
|
|
758
|
+
children: e(N.total)
|
|
746
759
|
})]
|
|
747
760
|
})]
|
|
748
761
|
})
|
|
749
762
|
}),
|
|
750
|
-
|
|
763
|
+
N.paymentMethod === "credits" && /* @__PURE__ */ m("div", {
|
|
751
764
|
className: "p-4 border-b border-border-subtle",
|
|
752
765
|
children: [/* @__PURE__ */ m("h3", {
|
|
753
766
|
className: "font-semibold text-text-primary mb-3 flex items-center gap-2",
|
|
754
|
-
children: [/* @__PURE__ */ p(
|
|
767
|
+
children: [/* @__PURE__ */ p(Ke, { className: "size-4" }), h("billing.checkout.creditBalance", "Credit Balance")]
|
|
755
768
|
}), /* @__PURE__ */ m("div", {
|
|
756
769
|
className: "flex items-center gap-4",
|
|
757
770
|
children: [
|
|
@@ -762,10 +775,10 @@ var et = () => {
|
|
|
762
775
|
children: h("billing.checkout.previousBalance", "Previous Balance")
|
|
763
776
|
}), /* @__PURE__ */ p("p", {
|
|
764
777
|
className: "font-semibold text-text-primary",
|
|
765
|
-
children: t(
|
|
778
|
+
children: t(N.previousBalance)
|
|
766
779
|
})]
|
|
767
780
|
}),
|
|
768
|
-
/* @__PURE__ */ p(
|
|
781
|
+
/* @__PURE__ */ p(Ie, { className: "size-5 text-text-secondary shrink-0" }),
|
|
769
782
|
/* @__PURE__ */ m("div", {
|
|
770
783
|
className: "flex-1 text-center p-3 rounded-lg bg-status-success-bg-subtle",
|
|
771
784
|
children: [/* @__PURE__ */ p("p", {
|
|
@@ -773,7 +786,7 @@ var et = () => {
|
|
|
773
786
|
children: h("billing.checkout.newBalance", "New Balance")
|
|
774
787
|
}), /* @__PURE__ */ p("p", {
|
|
775
788
|
className: "font-semibold text-status-success-text",
|
|
776
|
-
children: t(
|
|
789
|
+
children: t(N.newBalance)
|
|
777
790
|
})]
|
|
778
791
|
})
|
|
779
792
|
]
|
|
@@ -788,15 +801,15 @@ var et = () => {
|
|
|
788
801
|
children: h("billing.checkout.billingAccount", "Billing Account")
|
|
789
802
|
}), /* @__PURE__ */ p("p", {
|
|
790
803
|
className: "font-medium text-text-primary",
|
|
791
|
-
children:
|
|
792
|
-
})] }),
|
|
804
|
+
children: N.billingAccountName
|
|
805
|
+
})] }), N.transactionId && /* @__PURE__ */ m("div", {
|
|
793
806
|
className: "text-right",
|
|
794
807
|
children: [/* @__PURE__ */ p("p", {
|
|
795
808
|
className: "text-xs text-text-secondary mb-1",
|
|
796
809
|
children: h("billing.checkout.transactionId", "Transaction ID")
|
|
797
810
|
}), /* @__PURE__ */ m("p", {
|
|
798
811
|
className: "font-mono text-xs text-text-secondary",
|
|
799
|
-
children: [
|
|
812
|
+
children: [N.transactionId.slice(0, 8), "..."]
|
|
800
813
|
})]
|
|
801
814
|
})]
|
|
802
815
|
})
|
|
@@ -818,31 +831,31 @@ var et = () => {
|
|
|
818
831
|
})]
|
|
819
832
|
})
|
|
820
833
|
]
|
|
821
|
-
}), vt && bt.length > 0 &&
|
|
822
|
-
billingAccountId:
|
|
834
|
+
}), vt && bt.length > 0 && S && St && /* @__PURE__ */ p(Ae, {
|
|
835
|
+
billingAccountId: N?.billingAccountId ?? "",
|
|
823
836
|
subscriptionId: St,
|
|
824
837
|
quotas: bt,
|
|
825
838
|
workspaces: pt,
|
|
826
|
-
currentWorkspaceId:
|
|
839
|
+
currentWorkspaceId: S,
|
|
827
840
|
onAssigned: () => yt(!1),
|
|
828
841
|
onSkip: () => yt(!1)
|
|
829
842
|
})] });
|
|
830
843
|
}
|
|
831
|
-
if (
|
|
844
|
+
if (k === "error") return /* @__PURE__ */ p("div", {
|
|
832
845
|
className: "max-w-lg mx-auto p-6",
|
|
833
846
|
children: /* @__PURE__ */ m("div", {
|
|
834
847
|
className: "text-center space-y-6",
|
|
835
848
|
children: [
|
|
836
849
|
/* @__PURE__ */ p("div", {
|
|
837
850
|
className: "inline-flex p-4 rounded-full bg-status-error-bg-subtle text-status-error-text",
|
|
838
|
-
children: /* @__PURE__ */ p(
|
|
851
|
+
children: /* @__PURE__ */ p(qe, { className: "size-12" })
|
|
839
852
|
}),
|
|
840
853
|
/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("h1", {
|
|
841
854
|
className: "text-2xl font-bold text-text-primary",
|
|
842
855
|
children: h("billing.checkout.paymentFailed", "Payment Failed")
|
|
843
856
|
}), /* @__PURE__ */ p("p", {
|
|
844
857
|
className: "text-text-secondary mt-2",
|
|
845
|
-
children: Tt || Nt ||
|
|
858
|
+
children: Tt || Nt || I.error || h("billing.checkout.genericError", "Something went wrong. Please try again.")
|
|
846
859
|
})] }),
|
|
847
860
|
/* @__PURE__ */ m("div", {
|
|
848
861
|
className: "flex gap-3 justify-center",
|
|
@@ -854,7 +867,7 @@ var et = () => {
|
|
|
854
867
|
}), /* @__PURE__ */ p("button", {
|
|
855
868
|
type: "button",
|
|
856
869
|
onClick: () => {
|
|
857
|
-
|
|
870
|
+
A("select"), M(null), I.reset();
|
|
858
871
|
},
|
|
859
872
|
className: "px-4 py-2 rounded-lg bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bgHover",
|
|
860
873
|
children: h("billing.checkout.tryAgain", "Try Again")
|
|
@@ -863,14 +876,14 @@ var et = () => {
|
|
|
863
876
|
]
|
|
864
877
|
})
|
|
865
878
|
});
|
|
866
|
-
if (
|
|
879
|
+
if (k === "processing") return /* @__PURE__ */ p("div", {
|
|
867
880
|
className: "max-w-lg mx-auto p-6",
|
|
868
881
|
children: /* @__PURE__ */ m("div", {
|
|
869
882
|
className: "text-center space-y-6",
|
|
870
883
|
children: [
|
|
871
884
|
/* @__PURE__ */ p("div", {
|
|
872
885
|
className: "inline-flex p-4 rounded-full bg-[var(--color-accent-soft)] text-text-link",
|
|
873
|
-
children: /* @__PURE__ */ p(
|
|
886
|
+
children: /* @__PURE__ */ p(Ve, { className: "size-12 animate-spin" })
|
|
874
887
|
}),
|
|
875
888
|
/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("h1", {
|
|
876
889
|
className: "text-2xl font-bold text-text-primary",
|
|
@@ -909,7 +922,7 @@ var et = () => {
|
|
|
909
922
|
Mt > 3e4 && /* @__PURE__ */ p("button", {
|
|
910
923
|
type: "button",
|
|
911
924
|
onClick: () => {
|
|
912
|
-
|
|
925
|
+
A("error"), M("Payment verification was cancelled. Please check your billing history.");
|
|
913
926
|
},
|
|
914
927
|
className: "text-sm text-text-secondary hover:text-text-primary underline",
|
|
915
928
|
children: h("billing.checkout.cancelAndCheckHistory", "Cancel and check billing history")
|
|
@@ -917,21 +930,21 @@ var et = () => {
|
|
|
917
930
|
]
|
|
918
931
|
})
|
|
919
932
|
});
|
|
920
|
-
if (
|
|
933
|
+
if (k === "payment" && j) {
|
|
921
934
|
let e = (e, t) => `${{
|
|
922
935
|
INR: "₹",
|
|
923
936
|
USD: "$",
|
|
924
937
|
EUR: "€",
|
|
925
938
|
GBP: "£"
|
|
926
|
-
}[t] || t + " "}${e.toFixed(2)}`, t =
|
|
939
|
+
}[t] || t + " "}${e.toFixed(2)}`, t = j.currency || I.selectedCurrency, r = j.total ?? I.total;
|
|
927
940
|
return /* @__PURE__ */ m("div", {
|
|
928
941
|
className: "max-w-2xl mx-auto p-4 sm:p-6 space-y-6",
|
|
929
942
|
children: [
|
|
930
943
|
/* @__PURE__ */ m("button", {
|
|
931
944
|
type: "button",
|
|
932
|
-
onClick: () =>
|
|
945
|
+
onClick: () => A("select"),
|
|
933
946
|
className: "flex items-center gap-2 text-sm text-text-secondary hover:text-text-primary",
|
|
934
|
-
children: [/* @__PURE__ */ p(
|
|
947
|
+
children: [/* @__PURE__ */ p(Fe, { className: "size-4" }), h("billing.checkout.backToCheckout", "Back to checkout")]
|
|
935
948
|
}),
|
|
936
949
|
/* @__PURE__ */ p(n, {
|
|
937
950
|
title: h("billing.checkout.completePayment", "Complete Payment"),
|
|
@@ -942,9 +955,9 @@ var et = () => {
|
|
|
942
955
|
children: [
|
|
943
956
|
/* @__PURE__ */ m("h3", {
|
|
944
957
|
className: "font-semibold text-text-primary flex items-center gap-2",
|
|
945
|
-
children: [/* @__PURE__ */ p(
|
|
958
|
+
children: [/* @__PURE__ */ p(Ue, { className: "size-4" }), h("billing.checkout.paymentSummary", "Payment Summary")]
|
|
946
959
|
}),
|
|
947
|
-
|
|
960
|
+
I.billingAccount && /* @__PURE__ */ m("div", {
|
|
948
961
|
className: "p-3 bg-bg-sunken rounded-lg space-y-1",
|
|
949
962
|
children: [
|
|
950
963
|
/* @__PURE__ */ p("div", {
|
|
@@ -953,15 +966,15 @@ var et = () => {
|
|
|
953
966
|
}),
|
|
954
967
|
/* @__PURE__ */ p("div", {
|
|
955
968
|
className: "font-medium text-text-primary",
|
|
956
|
-
children:
|
|
969
|
+
children: I.billingAccount.name
|
|
957
970
|
}),
|
|
958
971
|
/* @__PURE__ */ p("div", {
|
|
959
972
|
className: "text-sm text-text-secondary",
|
|
960
|
-
children:
|
|
973
|
+
children: I.billingAccount.email
|
|
961
974
|
})
|
|
962
975
|
]
|
|
963
976
|
}),
|
|
964
|
-
|
|
977
|
+
D === "ADDON" && I.selectedSubscriptionId && W && /* @__PURE__ */ m("div", {
|
|
965
978
|
className: "p-3 bg-bg-sunken rounded-lg space-y-1",
|
|
966
979
|
children: [
|
|
967
980
|
/* @__PURE__ */ p("div", {
|
|
@@ -970,11 +983,11 @@ var et = () => {
|
|
|
970
983
|
}),
|
|
971
984
|
/* @__PURE__ */ p("div", {
|
|
972
985
|
className: "font-medium text-text-primary",
|
|
973
|
-
children:
|
|
986
|
+
children: W.plan?.name || h("billing.checkout.subscription", "Subscription")
|
|
974
987
|
}),
|
|
975
|
-
|
|
988
|
+
W.plan?.product?.name && /* @__PURE__ */ p("div", {
|
|
976
989
|
className: "text-sm text-text-secondary",
|
|
977
|
-
children:
|
|
990
|
+
children: W.plan.product.name
|
|
978
991
|
})
|
|
979
992
|
]
|
|
980
993
|
}),
|
|
@@ -982,7 +995,7 @@ var et = () => {
|
|
|
982
995
|
className: "space-y-2 text-sm",
|
|
983
996
|
children: [
|
|
984
997
|
(() => {
|
|
985
|
-
let n =
|
|
998
|
+
let n = I.taxRate, i = n > 0 ? r / (1 + n) : r, a = n > 0 ? r - i : 0;
|
|
986
999
|
return /* @__PURE__ */ m(f, { children: [
|
|
987
1000
|
/* @__PURE__ */ m("div", {
|
|
988
1001
|
className: "flex justify-between",
|
|
@@ -994,16 +1007,16 @@ var et = () => {
|
|
|
994
1007
|
children: e(i, t)
|
|
995
1008
|
})]
|
|
996
1009
|
}),
|
|
997
|
-
|
|
1010
|
+
I.discountAmount > 0 && /* @__PURE__ */ m("div", {
|
|
998
1011
|
className: "flex justify-between text-status-success-text",
|
|
999
|
-
children: [/* @__PURE__ */ p("span", { children: h("billing.checkout.discount", "Discount") }), /* @__PURE__ */ m("span", { children: ["-", e(
|
|
1012
|
+
children: [/* @__PURE__ */ p("span", { children: h("billing.checkout.discount", "Discount") }), /* @__PURE__ */ m("span", { children: ["-", e(I.discountAmount, t)] })]
|
|
1000
1013
|
}),
|
|
1001
1014
|
a > 0 && /* @__PURE__ */ m("div", {
|
|
1002
1015
|
className: "flex justify-between",
|
|
1003
1016
|
children: [/* @__PURE__ */ m("span", {
|
|
1004
1017
|
className: "text-text-secondary",
|
|
1005
1018
|
children: [
|
|
1006
|
-
|
|
1019
|
+
I.taxType || h("billing.checkout.tax", "Tax"),
|
|
1007
1020
|
" (",
|
|
1008
1021
|
(n * 100).toFixed(0),
|
|
1009
1022
|
"%)"
|
|
@@ -1030,23 +1043,23 @@ var et = () => {
|
|
|
1030
1043
|
})
|
|
1031
1044
|
]
|
|
1032
1045
|
}),
|
|
1033
|
-
|
|
1046
|
+
I.selectedProvider === "STRIPE" && j.clientSecret && /* @__PURE__ */ p("div", {
|
|
1034
1047
|
className: "rounded-lg border border-border-subtle bg-bg-surface overflow-hidden",
|
|
1035
1048
|
children: /* @__PURE__ */ p("div", {
|
|
1036
1049
|
className: "p-4 space-y-4",
|
|
1037
|
-
children: /* @__PURE__ */ p(
|
|
1038
|
-
clientSecret:
|
|
1050
|
+
children: /* @__PURE__ */ p(Se, {
|
|
1051
|
+
clientSecret: j.clientSecret,
|
|
1039
1052
|
publishableKey: at || kt?.stripePublishableKey || "",
|
|
1040
|
-
amount: Math.round((
|
|
1041
|
-
currency:
|
|
1042
|
-
onSuccess:
|
|
1043
|
-
onError:
|
|
1044
|
-
onCancel: () =>
|
|
1045
|
-
isCompletingExistingPayment: !!
|
|
1053
|
+
amount: Math.round((j.total ?? I.total) * 100),
|
|
1054
|
+
currency: j.currency || I.selectedCurrency,
|
|
1055
|
+
onSuccess: un,
|
|
1056
|
+
onError: dn,
|
|
1057
|
+
onCancel: () => A("select"),
|
|
1058
|
+
isCompletingExistingPayment: !!I.selectedPaymentMethodId
|
|
1046
1059
|
})
|
|
1047
1060
|
})
|
|
1048
1061
|
}),
|
|
1049
|
-
|
|
1062
|
+
I.selectedProvider === "RAZORPAY" && j.orderId && /* @__PURE__ */ p("div", {
|
|
1050
1063
|
className: "rounded-lg border border-border-subtle bg-bg-surface overflow-hidden",
|
|
1051
1064
|
children: /* @__PURE__ */ m("div", {
|
|
1052
1065
|
className: "p-4 space-y-4",
|
|
@@ -1054,27 +1067,27 @@ var et = () => {
|
|
|
1054
1067
|
className: "flex items-center gap-2 cursor-pointer",
|
|
1055
1068
|
children: [/* @__PURE__ */ p("input", {
|
|
1056
1069
|
type: "checkbox",
|
|
1057
|
-
checked:
|
|
1058
|
-
onChange: (e) =>
|
|
1070
|
+
checked: I.saveCard,
|
|
1071
|
+
onChange: (e) => I.setSaveCard(e.target.checked),
|
|
1059
1072
|
className: "size-4 rounded border-border-subtle text-text-link focus:ring-[var(--color-focus-ring)]"
|
|
1060
1073
|
}), /* @__PURE__ */ p("span", {
|
|
1061
1074
|
className: "text-sm text-text-secondary",
|
|
1062
1075
|
children: "Save card for future purchases"
|
|
1063
1076
|
})]
|
|
1064
|
-
}), /* @__PURE__ */ p(
|
|
1065
|
-
orderId:
|
|
1066
|
-
keyId:
|
|
1067
|
-
amount: Math.round((
|
|
1068
|
-
currency:
|
|
1069
|
-
customerId:
|
|
1077
|
+
}), /* @__PURE__ */ p(Ce, {
|
|
1078
|
+
orderId: j.orderId,
|
|
1079
|
+
keyId: j.razorpayKeyId || ot || "",
|
|
1080
|
+
amount: Math.round((j.total ?? I.total) * 100),
|
|
1081
|
+
currency: j.currency || "INR",
|
|
1082
|
+
customerId: j.razorpayCustomerId,
|
|
1070
1083
|
prefill: {
|
|
1071
|
-
name:
|
|
1072
|
-
email:
|
|
1073
|
-
contact:
|
|
1084
|
+
name: j.prefillName,
|
|
1085
|
+
email: j.prefillEmail,
|
|
1086
|
+
contact: j.prefillContact
|
|
1074
1087
|
},
|
|
1075
|
-
onSuccess: (e) =>
|
|
1076
|
-
onError:
|
|
1077
|
-
onCancel: () =>
|
|
1088
|
+
onSuccess: (e) => un(e.razorpay_payment_id),
|
|
1089
|
+
onError: dn,
|
|
1090
|
+
onCancel: () => A("select")
|
|
1078
1091
|
})]
|
|
1079
1092
|
})
|
|
1080
1093
|
})
|
|
@@ -1088,32 +1101,32 @@ var et = () => {
|
|
|
1088
1101
|
type: "button",
|
|
1089
1102
|
onClick: () => _(-1),
|
|
1090
1103
|
className: "flex items-center gap-2 text-sm text-text-secondary hover:text-text-primary mb-4",
|
|
1091
|
-
children: [/* @__PURE__ */ p(
|
|
1104
|
+
children: [/* @__PURE__ */ p(Fe, { className: "size-4" }), "Back"]
|
|
1092
1105
|
}),
|
|
1093
1106
|
/* @__PURE__ */ m("div", {
|
|
1094
1107
|
className: "flex items-center gap-3 mb-6",
|
|
1095
1108
|
children: [/* @__PURE__ */ p("div", {
|
|
1096
1109
|
className: "p-2 rounded-lg bg-[var(--color-accent-soft)] text-text-link",
|
|
1097
|
-
children:
|
|
1110
|
+
children: hn()
|
|
1098
1111
|
}), /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("h1", {
|
|
1099
1112
|
className: "text-2xl font-bold text-text-primary",
|
|
1100
|
-
children:
|
|
1113
|
+
children: mn()
|
|
1101
1114
|
}), /* @__PURE__ */ p("p", {
|
|
1102
1115
|
className: "text-sm text-text-secondary",
|
|
1103
1116
|
children: "Complete your purchase securely"
|
|
1104
1117
|
})] })]
|
|
1105
1118
|
}),
|
|
1106
|
-
/* @__PURE__ */ p(
|
|
1119
|
+
/* @__PURE__ */ p($e, {
|
|
1107
1120
|
className: "mb-6",
|
|
1108
1121
|
children: h("billing.checkout.purpose", "Review what you are buying — plan, add-ons or credits — pick the billing account and payment method, apply any discount code, and pay. Taxes and the final total are shown before you confirm.")
|
|
1109
1122
|
}),
|
|
1110
|
-
|
|
1123
|
+
y?.upgradeFromSubscriptionId && y?.currentPlanName && /* @__PURE__ */ p("div", {
|
|
1111
1124
|
className: "mb-6 p-4 rounded-lg border border-border-subtle bg-status-info-bg-subtle",
|
|
1112
1125
|
children: /* @__PURE__ */ m("div", {
|
|
1113
1126
|
className: "flex items-center gap-3",
|
|
1114
1127
|
children: [/* @__PURE__ */ p("div", {
|
|
1115
1128
|
className: "p-2 rounded-full bg-status-info-bg-subtle",
|
|
1116
|
-
children: /* @__PURE__ */ p(
|
|
1129
|
+
children: /* @__PURE__ */ p(We, { className: "size-4 text-accent-blue" })
|
|
1117
1130
|
}), /* @__PURE__ */ m("div", {
|
|
1118
1131
|
className: "flex-1",
|
|
1119
1132
|
children: [/* @__PURE__ */ m("p", {
|
|
@@ -1123,7 +1136,7 @@ var et = () => {
|
|
|
1123
1136
|
" ",
|
|
1124
1137
|
/* @__PURE__ */ p("span", {
|
|
1125
1138
|
className: "font-semibold",
|
|
1126
|
-
children:
|
|
1139
|
+
children: y.currentPlanName
|
|
1127
1140
|
})
|
|
1128
1141
|
]
|
|
1129
1142
|
}), /* @__PURE__ */ p("p", {
|
|
@@ -1133,13 +1146,13 @@ var et = () => {
|
|
|
1133
1146
|
})]
|
|
1134
1147
|
})
|
|
1135
1148
|
}),
|
|
1136
|
-
|
|
1149
|
+
y?.downgradeFromSubscriptionId && y?.currentPlanName && /* @__PURE__ */ p("div", {
|
|
1137
1150
|
className: "mb-6 p-4 rounded-lg border border-status-warning-border bg-status-warning-bg-subtle",
|
|
1138
1151
|
children: /* @__PURE__ */ m("div", {
|
|
1139
1152
|
className: "flex items-center gap-3",
|
|
1140
1153
|
children: [/* @__PURE__ */ p("div", {
|
|
1141
1154
|
className: "p-2 rounded-full bg-status-warning-bg-subtle",
|
|
1142
|
-
children: /* @__PURE__ */ p(
|
|
1155
|
+
children: /* @__PURE__ */ p(We, { className: "size-4 text-status-warning-text" })
|
|
1143
1156
|
}), /* @__PURE__ */ m("div", {
|
|
1144
1157
|
className: "flex-1",
|
|
1145
1158
|
children: [/* @__PURE__ */ m("p", {
|
|
@@ -1149,7 +1162,7 @@ var et = () => {
|
|
|
1149
1162
|
" ",
|
|
1150
1163
|
/* @__PURE__ */ p("span", {
|
|
1151
1164
|
className: "font-semibold",
|
|
1152
|
-
children:
|
|
1165
|
+
children: y.currentPlanName
|
|
1153
1166
|
})
|
|
1154
1167
|
]
|
|
1155
1168
|
}), /* @__PURE__ */ p("p", {
|
|
@@ -1164,58 +1177,58 @@ var et = () => {
|
|
|
1164
1177
|
children: [/* @__PURE__ */ m("div", {
|
|
1165
1178
|
className: "lg:col-span-3 space-y-6 order-2 lg:order-1",
|
|
1166
1179
|
children: [
|
|
1167
|
-
|
|
1180
|
+
D === "CREDITS" && I.items[0] && /* @__PURE__ */ p("div", {
|
|
1168
1181
|
className: "rounded-lg border border-border-subtle bg-bg-surface p-4 sm:p-6",
|
|
1169
|
-
children: /* @__PURE__ */ p(
|
|
1170
|
-
value:
|
|
1171
|
-
onChange:
|
|
1172
|
-
costPerCredit:
|
|
1173
|
-
currency:
|
|
1174
|
-
disabled:
|
|
1182
|
+
children: /* @__PURE__ */ p(xe, {
|
|
1183
|
+
value: I.items[0].quantity,
|
|
1184
|
+
onChange: fn,
|
|
1185
|
+
costPerCredit: K,
|
|
1186
|
+
currency: I.selectedCurrency,
|
|
1187
|
+
disabled: Yt
|
|
1175
1188
|
})
|
|
1176
1189
|
}),
|
|
1177
1190
|
/* @__PURE__ */ m("div", {
|
|
1178
1191
|
className: "rounded-lg border border-border-subtle bg-bg-surface p-4 sm:p-6 space-y-4",
|
|
1179
|
-
children: [/* @__PURE__ */ p(
|
|
1180
|
-
accounts:
|
|
1181
|
-
selectedAccountId:
|
|
1182
|
-
onSelect:
|
|
1192
|
+
children: [/* @__PURE__ */ p(ve, {
|
|
1193
|
+
accounts: J,
|
|
1194
|
+
selectedAccountId: I.billingAccount?.id ?? null,
|
|
1195
|
+
onSelect: I.setBillingAccount,
|
|
1183
1196
|
isLoading: Ft,
|
|
1184
|
-
disabled:
|
|
1185
|
-
disabledMessage:
|
|
1186
|
-
}),
|
|
1187
|
-
subscriptions:
|
|
1188
|
-
selectedSubscriptionId:
|
|
1189
|
-
onSelect:
|
|
1190
|
-
isLoading:
|
|
1197
|
+
disabled: sn,
|
|
1198
|
+
disabledMessage: sn ? "Billing account is locked for plan changes" : void 0
|
|
1199
|
+
}), D === "ADDON" && !E && I.billingAccount && /* @__PURE__ */ p(we, {
|
|
1200
|
+
subscriptions: U,
|
|
1201
|
+
selectedSubscriptionId: I.selectedSubscriptionId,
|
|
1202
|
+
onSelect: I.setSelectedSubscriptionId,
|
|
1203
|
+
isLoading: Kt
|
|
1191
1204
|
})]
|
|
1192
1205
|
}),
|
|
1193
|
-
|
|
1206
|
+
V && /* @__PURE__ */ p(ke, {
|
|
1194
1207
|
storeOrderId: g,
|
|
1195
|
-
currency:
|
|
1196
|
-
onChange:
|
|
1208
|
+
currency: I.selectedCurrency,
|
|
1209
|
+
onChange: Vt
|
|
1197
1210
|
}),
|
|
1198
1211
|
/* @__PURE__ */ m("div", {
|
|
1199
1212
|
className: "rounded-lg border border-border-subtle bg-bg-surface p-4 sm:p-6 space-y-4",
|
|
1200
1213
|
children: [
|
|
1201
|
-
/* @__PURE__ */ p(
|
|
1202
|
-
savedPaymentMethods:
|
|
1203
|
-
selectedPaymentMethodId:
|
|
1204
|
-
onSelectSavedCard:
|
|
1205
|
-
selectedProvider:
|
|
1206
|
-
onSelectProvider:
|
|
1214
|
+
/* @__PURE__ */ p(Ee, {
|
|
1215
|
+
savedPaymentMethods: q,
|
|
1216
|
+
selectedPaymentMethodId: I.selectedPaymentMethodId,
|
|
1217
|
+
onSelectSavedCard: I.setSelectedPaymentMethodId,
|
|
1218
|
+
selectedProvider: I.selectedProvider,
|
|
1219
|
+
onSelectProvider: I.setPaymentProvider,
|
|
1207
1220
|
stripeEnabled: At,
|
|
1208
1221
|
razorpayEnabled: jt,
|
|
1209
|
-
canPayWithCredits:
|
|
1210
|
-
availableCredits:
|
|
1211
|
-
creditsRequired:
|
|
1212
|
-
billingCountry:
|
|
1213
|
-
saveCard:
|
|
1214
|
-
onSaveCardChange:
|
|
1215
|
-
autoRenewEnabled:
|
|
1216
|
-
isLoading:
|
|
1222
|
+
canPayWithCredits: I.canPayWithCredits,
|
|
1223
|
+
availableCredits: I.availableCredits,
|
|
1224
|
+
creditsRequired: I.creditsRequired,
|
|
1225
|
+
billingCountry: Y,
|
|
1226
|
+
saveCard: I.saveCard,
|
|
1227
|
+
onSaveCardChange: I.setSaveCard,
|
|
1228
|
+
autoRenewEnabled: D === "PLAN" && I.autoRenew,
|
|
1229
|
+
isLoading: Wt
|
|
1217
1230
|
}),
|
|
1218
|
-
|
|
1231
|
+
I.selectedProvider !== "CREDITS" && I.selectedProvider !== "AUTO" && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", { className: "border-t border-border-subtle" }), /* @__PURE__ */ p("div", {
|
|
1219
1232
|
className: "bg-bg-sunken p-4 rounded-button",
|
|
1220
1233
|
children: /* @__PURE__ */ m("div", {
|
|
1221
1234
|
className: "flex items-start gap-3",
|
|
@@ -1234,7 +1247,7 @@ var et = () => {
|
|
|
1234
1247
|
className: "flex-1 text-sm",
|
|
1235
1248
|
children: [/* @__PURE__ */ m("p", {
|
|
1236
1249
|
className: "font-medium text-text-primary mb-1",
|
|
1237
|
-
children: ["Currency: ",
|
|
1250
|
+
children: ["Currency: ", I.selectedCurrency]
|
|
1238
1251
|
}), /* @__PURE__ */ m("p", {
|
|
1239
1252
|
className: "text-text-secondary text-xs",
|
|
1240
1253
|
children: [
|
|
@@ -1242,30 +1255,30 @@ var et = () => {
|
|
|
1242
1255
|
" ",
|
|
1243
1256
|
/* @__PURE__ */ p("strong", {
|
|
1244
1257
|
className: "text-text-primary",
|
|
1245
|
-
children:
|
|
1258
|
+
children: I.selectedCurrency
|
|
1246
1259
|
}),
|
|
1247
1260
|
" ",
|
|
1248
1261
|
"based on your billing account settings.",
|
|
1249
|
-
|
|
1262
|
+
I.selectedCurrency === "INR" && " GST will be applied at checkout."
|
|
1250
1263
|
]
|
|
1251
1264
|
})]
|
|
1252
1265
|
})]
|
|
1253
1266
|
})
|
|
1254
1267
|
})] }),
|
|
1255
|
-
|
|
1268
|
+
D === "PLAN" && L?.getPlan?.pricingModel === "PER_SEAT" && /* @__PURE__ */ p("div", {
|
|
1256
1269
|
className: "border-t border-border-subtle pt-4",
|
|
1257
1270
|
children: /* @__PURE__ */ m("div", {
|
|
1258
1271
|
className: "space-y-3",
|
|
1259
1272
|
children: [/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("label", {
|
|
1260
1273
|
className: "text-sm font-medium text-text-primary",
|
|
1261
1274
|
children: "Number of seats"
|
|
1262
|
-
}),
|
|
1275
|
+
}), L.getPlan.minSeats && /* @__PURE__ */ m("p", {
|
|
1263
1276
|
className: "text-xs text-text-secondary mt-0.5",
|
|
1264
1277
|
children: [
|
|
1265
1278
|
"Minimum ",
|
|
1266
|
-
|
|
1279
|
+
L.getPlan.minSeats,
|
|
1267
1280
|
" seat",
|
|
1268
|
-
|
|
1281
|
+
L.getPlan.minSeats === 1 ? "" : "s",
|
|
1269
1282
|
" required"
|
|
1270
1283
|
]
|
|
1271
1284
|
})] }), /* @__PURE__ */ m("div", {
|
|
@@ -1273,44 +1286,44 @@ var et = () => {
|
|
|
1273
1286
|
children: [
|
|
1274
1287
|
/* @__PURE__ */ p("button", {
|
|
1275
1288
|
type: "button",
|
|
1276
|
-
onClick: () =>
|
|
1277
|
-
disabled:
|
|
1289
|
+
onClick: () => F((e) => Math.max(L.getPlan?.minSeats ?? 1, e - 1)),
|
|
1290
|
+
disabled: P <= (L.getPlan.minSeats ?? 1),
|
|
1278
1291
|
className: "size-9 rounded-button border border-border-subtle flex items-center justify-center hover:bg-action-ghost-bgHover disabled:opacity-40 disabled:cursor-not-allowed transition-colors text-text-primary",
|
|
1279
1292
|
children: "−"
|
|
1280
1293
|
}),
|
|
1281
1294
|
/* @__PURE__ */ p("input", {
|
|
1282
1295
|
type: "number",
|
|
1283
|
-
value:
|
|
1284
|
-
min:
|
|
1285
|
-
max:
|
|
1296
|
+
value: P,
|
|
1297
|
+
min: L.getPlan.minSeats ?? 1,
|
|
1298
|
+
max: L.getPlan.maxSeats ?? 999,
|
|
1286
1299
|
onChange: (e) => {
|
|
1287
1300
|
let t = parseInt(e.target.value, 10);
|
|
1288
|
-
isNaN(t) ||
|
|
1301
|
+
isNaN(t) || F(Math.max(L.getPlan?.minSeats ?? 1, t));
|
|
1289
1302
|
},
|
|
1290
1303
|
className: "w-20 h-9 text-center border border-border-subtle rounded-button bg-bg-surface text-text-primary text-sm focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
1291
1304
|
}),
|
|
1292
1305
|
/* @__PURE__ */ p("button", {
|
|
1293
1306
|
type: "button",
|
|
1294
|
-
onClick: () =>
|
|
1295
|
-
disabled:
|
|
1307
|
+
onClick: () => F((e) => Math.min(L.getPlan?.maxSeats ?? 999, e + 1)),
|
|
1308
|
+
disabled: P >= (L.getPlan.maxSeats ?? 999),
|
|
1296
1309
|
className: "size-9 rounded-button border border-border-subtle flex items-center justify-center hover:bg-action-ghost-bgHover disabled:opacity-40 disabled:cursor-not-allowed transition-colors text-text-primary",
|
|
1297
1310
|
children: "+"
|
|
1298
1311
|
}),
|
|
1299
|
-
|
|
1312
|
+
L.getPlan.pricePerSeat && /* @__PURE__ */ m("span", {
|
|
1300
1313
|
className: "text-sm text-text-secondary",
|
|
1301
1314
|
children: [
|
|
1302
1315
|
"×",
|
|
1303
1316
|
" ",
|
|
1304
|
-
|
|
1317
|
+
L.getPlan.pricePerSeat.toLocaleString("en", {
|
|
1305
1318
|
style: "currency",
|
|
1306
|
-
currency:
|
|
1319
|
+
currency: L.getPlan.currency ?? "USD"
|
|
1307
1320
|
}),
|
|
1308
1321
|
" ",
|
|
1309
1322
|
"=",
|
|
1310
1323
|
" ",
|
|
1311
|
-
(
|
|
1324
|
+
(L.getPlan.pricePerSeat * P).toLocaleString("en", {
|
|
1312
1325
|
style: "currency",
|
|
1313
|
-
currency:
|
|
1326
|
+
currency: L.getPlan.currency ?? "USD"
|
|
1314
1327
|
}),
|
|
1315
1328
|
"/mo"
|
|
1316
1329
|
]
|
|
@@ -1332,48 +1345,48 @@ var et = () => {
|
|
|
1332
1345
|
children: [
|
|
1333
1346
|
/* @__PURE__ */ p("div", {
|
|
1334
1347
|
className: "p-4",
|
|
1335
|
-
children: /* @__PURE__ */ p(
|
|
1336
|
-
items:
|
|
1337
|
-
subtotal:
|
|
1338
|
-
discountAmount:
|
|
1339
|
-
taxAmount:
|
|
1340
|
-
taxRate:
|
|
1341
|
-
taxType:
|
|
1342
|
-
total:
|
|
1343
|
-
currency:
|
|
1344
|
-
isCalculatingTax:
|
|
1345
|
-
showInCredits:
|
|
1346
|
-
creditsRequired:
|
|
1347
|
-
onUpdateQuantity:
|
|
1348
|
-
onRemoveItem:
|
|
1349
|
-
isEditable:
|
|
1348
|
+
children: /* @__PURE__ */ p(ye, {
|
|
1349
|
+
items: I.items,
|
|
1350
|
+
subtotal: I.subtotal,
|
|
1351
|
+
discountAmount: I.discountAmount,
|
|
1352
|
+
taxAmount: I.taxAmount,
|
|
1353
|
+
taxRate: I.taxRate,
|
|
1354
|
+
taxType: I.taxType,
|
|
1355
|
+
total: I.total,
|
|
1356
|
+
currency: I.selectedCurrency,
|
|
1357
|
+
isCalculatingTax: I.isCalculatingTax,
|
|
1358
|
+
showInCredits: I.selectedProvider === "CREDITS",
|
|
1359
|
+
creditsRequired: I.creditsRequired,
|
|
1360
|
+
onUpdateQuantity: D !== "PLAN" && D !== "ORDER" ? I.updateItemQuantity : void 0,
|
|
1361
|
+
onRemoveItem: I.removeItem,
|
|
1362
|
+
isEditable: D !== "PLAN" && D !== "ORDER"
|
|
1350
1363
|
})
|
|
1351
1364
|
}),
|
|
1352
|
-
|
|
1365
|
+
I.selectedProvider !== "CREDITS" && /* @__PURE__ */ p("div", {
|
|
1353
1366
|
className: "px-4 pb-4 border-t border-border-subtle pt-4",
|
|
1354
|
-
children: /* @__PURE__ */ p(
|
|
1355
|
-
value:
|
|
1356
|
-
onChange:
|
|
1357
|
-
onValidate: async () => await
|
|
1358
|
-
onClear:
|
|
1359
|
-
isApplied:
|
|
1360
|
-
discountValue:
|
|
1361
|
-
discountType:
|
|
1362
|
-
isValidating:
|
|
1367
|
+
children: /* @__PURE__ */ p(be, {
|
|
1368
|
+
value: I.promoCode,
|
|
1369
|
+
onChange: I.setPromoCode,
|
|
1370
|
+
onValidate: async () => await I.validatePromoCode(),
|
|
1371
|
+
onClear: I.clearPromoCode,
|
|
1372
|
+
isApplied: I.promoDiscount > 0,
|
|
1373
|
+
discountValue: I.promoDiscount,
|
|
1374
|
+
discountType: I.promoDiscountType,
|
|
1375
|
+
isValidating: I.isProcessing
|
|
1363
1376
|
})
|
|
1364
1377
|
}),
|
|
1365
|
-
|
|
1378
|
+
D === "PLAN" && I.selectedProvider !== "CREDITS" && I.selectedProvider !== "AUTO" && (() => {
|
|
1366
1379
|
let e = "", t = !1, n = !1;
|
|
1367
|
-
if (
|
|
1368
|
-
let r =
|
|
1380
|
+
if (I.selectedPaymentMethodId) {
|
|
1381
|
+
let r = q.find((e) => e.id === I.selectedPaymentMethodId);
|
|
1369
1382
|
r && (e = `${r.type === "CREDIT_CARD" || r.type === "DEBIT_CARD" ? "Card" : r.type}${r.last4 ? ` •••• ${r.last4}` : ""}`, t = !0, n = !1);
|
|
1370
|
-
} else (
|
|
1383
|
+
} else (I.selectedProvider === "RAZORPAY" || I.selectedProvider === "STRIPE") && (e = I.selectedProvider === "RAZORPAY" ? "new card (Razorpay)" : "new card (Stripe)", t = !0, n = !0);
|
|
1371
1384
|
return /* @__PURE__ */ p("div", {
|
|
1372
1385
|
className: "px-4 pb-4",
|
|
1373
|
-
children: /* @__PURE__ */ p(
|
|
1374
|
-
enabled:
|
|
1386
|
+
children: /* @__PURE__ */ p(Te, {
|
|
1387
|
+
enabled: I.autoRenew,
|
|
1375
1388
|
onToggle: (e) => {
|
|
1376
|
-
|
|
1389
|
+
I.setAutoRenew(e), e && I.selectedPaymentMethodId && I.setAutoRenewPaymentMethodId(I.selectedPaymentMethodId);
|
|
1377
1390
|
},
|
|
1378
1391
|
hasPaymentMethodSelected: t,
|
|
1379
1392
|
selectedPaymentMethodDisplay: e,
|
|
@@ -1385,10 +1398,10 @@ var et = () => {
|
|
|
1385
1398
|
}),
|
|
1386
1399
|
/* @__PURE__ */ p("button", {
|
|
1387
1400
|
type: "button",
|
|
1388
|
-
onClick:
|
|
1389
|
-
disabled:
|
|
1401
|
+
onClick: ln,
|
|
1402
|
+
disabled: I.isProcessing || !I.billingAccount || I.items.length === 0 || I.selectedProvider === "CREDITS" && !en || D === "ADDON" && !E && Kt || D === "ADDON" && !E && U.length === 0 || D === "ADDON" && !E && !I.selectedSubscriptionId || V && (!H.shippingAddressId || !H.shippingMethodId),
|
|
1390
1403
|
className: "w-full px-6 py-4 rounded-lg bg-action-primary-bg text-action-primary-text font-semibold\n hover:bg-action-primary-bgHover disabled:opacity-50 disabled:cursor-not-allowed\n transition-colors flex items-center justify-center gap-2",
|
|
1391
|
-
children:
|
|
1404
|
+
children: I.isProcessing ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(Ve, { className: "size-5 animate-spin" }), "Processing…"] }) : I.selectedProvider === "CREDITS" ? "Pay with Credits" : "Proceed to Payment"
|
|
1392
1405
|
}),
|
|
1393
1406
|
/* @__PURE__ */ p("p", {
|
|
1394
1407
|
className: "text-center text-xs text-text-secondary",
|
|
@@ -1398,14 +1411,14 @@ var et = () => {
|
|
|
1398
1411
|
})
|
|
1399
1412
|
})]
|
|
1400
1413
|
}),
|
|
1401
|
-
ht &&
|
|
1402
|
-
billingAccountId:
|
|
1403
|
-
hasPhone: !!
|
|
1404
|
-
hasAddress: !!(
|
|
1414
|
+
ht && I.billingAccount && /* @__PURE__ */ p(De, {
|
|
1415
|
+
billingAccountId: I.billingAccount.id,
|
|
1416
|
+
hasPhone: !!I.billingAccount.contactNumber?.trim(),
|
|
1417
|
+
hasAddress: !!(I.billingAccount.billingAddresses?.[0]?.line1?.trim() && I.billingAccount.billingAddresses?.[0]?.postalCode?.trim()),
|
|
1405
1418
|
onCompleted: () => {
|
|
1406
|
-
_t.current = !0, gt(!1),
|
|
1407
|
-
let t = (e.data?.myBillingAccounts ?? []).map(
|
|
1408
|
-
t &&
|
|
1419
|
+
_t.current = !0, gt(!1), ln(), It().then((e) => {
|
|
1420
|
+
let t = (e.data?.myBillingAccounts ?? []).map(et).find((e) => e?.id === I.billingAccount?.id);
|
|
1421
|
+
t && I.setBillingAccount(t);
|
|
1409
1422
|
});
|
|
1410
1423
|
},
|
|
1411
1424
|
onCancel: () => gt(!1)
|
|
@@ -1414,6 +1427,6 @@ var et = () => {
|
|
|
1414
1427
|
});
|
|
1415
1428
|
};
|
|
1416
1429
|
//#endregion
|
|
1417
|
-
export {
|
|
1430
|
+
export { tt as CheckoutPage };
|
|
1418
1431
|
|
|
1419
1432
|
//# sourceMappingURL=CheckoutPage.js.map
|