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