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