@burdenoff/microfe-billing 2026.1005.2 → 2026.1005.4

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