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