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