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