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