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