@burdenoff/microfe-billing 2026.913.1 → 2026.914.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.
Files changed (43) hide show
  1. package/dist/billing/BillingAdminRoutes.js +84 -71
  2. package/dist/billing/BillingAdminRoutes.js.map +1 -1
  3. package/dist/billing/modules/billing/hooks/useRefunds.js.map +1 -1
  4. package/dist/billing/modules/billing/pages/PaymentMethodsPage.js +90 -87
  5. package/dist/billing/modules/billing/pages/PaymentMethodsPage.js.map +1 -1
  6. package/dist/billing/modules/billing/pages/RefundIssueLogsPage.js +97 -58
  7. package/dist/billing/modules/billing/pages/RefundIssueLogsPage.js.map +1 -1
  8. package/dist/billing/modules/checkout/components/OrderSummary.js +22 -19
  9. package/dist/billing/modules/checkout/components/OrderSummary.js.map +1 -1
  10. package/dist/billing/modules/checkout/components/RazorpayPaymentButton.js.map +1 -1
  11. package/dist/billing/modules/checkout/hooks/useCheckout.js +174 -157
  12. package/dist/billing/modules/checkout/hooks/useCheckout.js.map +1 -1
  13. package/dist/billing/modules/checkout/pages/CheckoutPage.js +189 -182
  14. package/dist/billing/modules/checkout/pages/CheckoutPage.js.map +1 -1
  15. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +293 -274
  16. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
  17. package/dist/billing/modules/dashboard/components/AddPaymentMethodModal.js +140 -250
  18. package/dist/billing/modules/dashboard/components/AddPaymentMethodModal.js.map +1 -1
  19. package/dist/billing/modules/earnings/api.js +79 -42
  20. package/dist/billing/modules/earnings/api.js.map +1 -1
  21. package/dist/billing/modules/earnings/index.js +4 -3
  22. package/dist/billing/modules/earnings/pages/DeveloperRevenueAdminPage.js +103 -310
  23. package/dist/billing/modules/earnings/pages/DeveloperRevenueAdminPage.js.map +1 -1
  24. package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js +545 -0
  25. package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js.map +1 -0
  26. package/dist/billing/modules/earnings/pages/PayoutAdminPage.js +246 -196
  27. package/dist/billing/modules/earnings/pages/PayoutAdminPage.js.map +1 -1
  28. package/dist/billing/modules/subscriptions/hooks/useSubscriptions.js +44 -28
  29. package/dist/billing/modules/subscriptions/hooks/useSubscriptions.js.map +1 -1
  30. package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js +317 -270
  31. package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js.map +1 -1
  32. package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js +153 -150
  33. package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js.map +1 -1
  34. package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js +1 -1
  35. package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js.map +1 -1
  36. package/dist/billing/modules/usage/hooks/useUsage.js +74 -48
  37. package/dist/billing/modules/usage/hooks/useUsage.js.map +1 -1
  38. package/dist/generated/global-operations.js +220 -183
  39. package/dist/generated/global-operations.js.map +1 -1
  40. package/dist/generated/global-types.js.map +1 -1
  41. package/dist/node_modules/sonner/dist/index.js +163 -0
  42. package/dist/node_modules/sonner/dist/index.js.map +1 -0
  43. package/package.json +1 -1
@@ -9,38 +9,39 @@ import { useGetActiveSubscriptionsCheckoutQuery as o, useGetBillingAccountsCheck
9
9
  import { useAddonCartStore as ae } from "../../addons/store/addonCartStore.js";
10
10
  import { useBillingNavigate as oe } from "../../../hooks/useBillingNavigate.js";
11
11
  import { recordAffiliateEvent as se } from "../../affiliate/api.js";
12
- import { STORE_SHIPPING_ITEM_ID as ce, useSetStoreOrderShipping as le } from "../hooks/useStoreShipping.js";
13
- import { useCheckout as ue } from "../hooks/useCheckout.js";
14
- import { isNativeIAPAvailable as de } from "../../../lib/native-purchases.js";
15
- import { useNativeCheckout as fe } from "../hooks/useNativeCheckout.js";
16
- import { usePaymentProviders as pe } from "../hooks/usePaymentProviders.js";
17
- import { usePaymentStatusPolling as me } from "../hooks/usePaymentStatusPolling.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 fe } from "../../../lib/native-purchases.js";
16
+ import { useNativeCheckout as pe } from "../hooks/useNativeCheckout.js";
17
+ import { usePaymentProviders as me } from "../hooks/usePaymentProviders.js";
18
+ import { usePaymentStatusPolling as he } from "../hooks/usePaymentStatusPolling.js";
18
19
  import "../hooks/index.js";
19
- import { NativeCheckoutView as he } from "../components/NativeCheckoutView.js";
20
- import { BillingAccountSelector as ge } from "../components/BillingAccountSelector.js";
21
- import { OrderSummary as _e } from "../components/OrderSummary.js";
22
- import { PromoCodeInput as ve } from "../components/PromoCodeInput.js";
23
- import { CreditsAmountInput as ye } from "../components/CreditsAmountInput.js";
24
- import { StripePaymentForm as be } from "../components/StripePaymentForm.js";
25
- import { RazorpayPaymentButton as xe } from "../components/RazorpayPaymentButton.js";
26
- import { SubscriptionSelector as Se } from "../components/SubscriptionSelector.js";
27
- import { SimpleAutoPayToggle as Ce } from "../components/SimpleAutoPayToggle.js";
28
- import { UnifiedPaymentMethodSelector as we } from "../components/UnifiedPaymentMethodSelector.js";
29
- import { CompleteBillingAccountModal as Te, isBillingAccountComplete as Ee } from "../components/CompleteBillingAccountModal.js";
30
- import { StoreShippingSection as De } from "../components/StoreShippingSection.js";
31
- import { WorkspaceQuotaAssignmentModal as Oe, isWorkspaceScopedQuota as ke } from "../components/WorkspaceQuotaAssignmentModal.js";
20
+ import { NativeCheckoutView as ge } from "../components/NativeCheckoutView.js";
21
+ import { BillingAccountSelector as _e } from "../components/BillingAccountSelector.js";
22
+ import { OrderSummary as ve } from "../components/OrderSummary.js";
23
+ import { PromoCodeInput as ye } from "../components/PromoCodeInput.js";
24
+ import { CreditsAmountInput as be } from "../components/CreditsAmountInput.js";
25
+ import { StripePaymentForm as xe } from "../components/StripePaymentForm.js";
26
+ import { RazorpayPaymentButton as Se } from "../components/RazorpayPaymentButton.js";
27
+ import { SubscriptionSelector as Ce } from "../components/SubscriptionSelector.js";
28
+ import { SimpleAutoPayToggle as we } from "../components/SimpleAutoPayToggle.js";
29
+ import { UnifiedPaymentMethodSelector as Te } from "../components/UnifiedPaymentMethodSelector.js";
30
+ import { CompleteBillingAccountModal as Ee, isBillingAccountComplete as De } from "../components/CompleteBillingAccountModal.js";
31
+ import { StoreShippingSection as Oe } from "../components/StoreShippingSection.js";
32
+ import { WorkspaceQuotaAssignmentModal as ke, isWorkspaceScopedQuota as Ae } from "../components/WorkspaceQuotaAssignmentModal.js";
32
33
  import "../components/index.js";
33
- import { buildStoreOrderCheckoutItems as Ae, normalizeStoreOrderCurrency as je } from "../utils/storeOrder.js";
34
- import { useCallback as c, useEffect as l, useMemo as u, useRef as Me, useState as d } from "react";
35
- import { ArrowLeft as Ne, ArrowRight as Pe, Blocks as Fe, CheckCircle as Ie, Coins as Le, CreditCard as Re, Loader2 as ze, Package as Be, Receipt as Ve, RefreshCw as He, ShoppingCart as Ue, Wallet as We, XCircle as Ge } from "lucide-react";
36
- import { useLocation as Ke, useParams as qe } from "react-router";
37
- import { useAppShell as Je } from "@burdenoff/fe-libs/shared/providers/shell";
34
+ import { buildStoreOrderCheckoutItems as je, normalizeStoreOrderCurrency as Me } from "../utils/storeOrder.js";
35
+ import { useCallback as c, useEffect as l, useMemo as u, useRef as Ne, useState as d } from "react";
36
+ import { ArrowLeft as Pe, ArrowRight as Fe, Blocks as Ie, CheckCircle as Le, Coins as Re, CreditCard as ze, Loader2 as Be, Package as Ve, Receipt as He, RefreshCw as Ue, ShoppingCart as We, Wallet as Ge, XCircle as Ke } from "lucide-react";
37
+ import { useLocation as qe, useParams as Je } from "react-router";
38
+ import { useAppShell as Ye } from "@burdenoff/fe-libs/shared/providers/shell";
38
39
  import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
39
- import { useI18n as Ye } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
40
- import { getProfileScopedKey as Xe } from "@burdenoff/fe-libs/shared/utils";
41
- import { PagePurpose as Ze } from "@burdenoff/fe-libs/ui";
40
+ import { useI18n as Xe } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
41
+ import { getProfileScopedKey as Ze } from "@burdenoff/fe-libs/shared/utils";
42
+ import { PagePurpose as Qe } from "@burdenoff/fe-libs/ui";
42
43
  //#region src/billing/modules/checkout/pages/CheckoutPage.tsx
43
- function Qe(e) {
44
+ function $e(e) {
44
45
  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 : {
45
46
  ...e,
46
47
  id: e.id,
@@ -52,17 +53,17 @@ function Qe(e) {
52
53
  billingAddresses: e.billingAddresses === null ? null : e.billingAddresses?.flatMap((e) => e ? [{ ...e }] : [])
53
54
  };
54
55
  }
55
- var $e = () => {
56
- let { t: $e } = Ye(), h = (e, t) => {
57
- let n = $e(e);
56
+ var et = () => {
57
+ let { t: et } = Xe(), h = (e, t) => {
58
+ let n = et(e);
58
59
  return n === e ? t : n;
59
- }, { planId: et, addonId: tt, storeOrderId: g } = qe(), _ = oe(), nt = Ke(), v = nt.state, rt = a(), { emit: y } = r(), { orgId: b, stripePublishableKey: it, razorpayKey: at, apiGatewayUrl: ot, authToken: st, currentUser: ct, workspaceId: x } = e(), { productSlug: lt } = Je(), ut = Me(null), dt = x ? [{
60
+ }, { planId: tt, addonId: nt, storeOrderId: g } = Je(), _ = oe(), rt = qe(), v = rt.state, it = a(), { emit: y } = r(), { orgId: b, stripePublishableKey: at, razorpayKey: ot, apiGatewayUrl: st, authToken: ct, currentUser: lt, workspaceId: x } = e(), { productSlug: ut } = Ye(), dt = Ne(null), { workspaces: ft } = ce(), pt = ft.length > 0 ? ft : x ? [{
60
61
  id: x,
61
62
  name: "Current workspace"
62
- }] : [], { items: S, clearCart: ft, _hasHydrated: C } = ae(), w = nt.pathname.includes("/checkout/addons") && !tt, T = nt.pathname.includes("/checkout/store") && !!g, E = w ? "ADDON" : T ? "ORDER" : v?.purchaseType ?? (et ? "PLAN" : tt ? "ADDON" : "CREDITS"), D = v?.itemId ?? et ?? tt ?? g, [pt, mt] = d(!1), ht = Me(!1), [gt, _t] = d(!1), [vt, yt] = d([]), [bt, xt] = d(null), [O, k] = d("select"), [A, St] = d(null), [Ct, j] = d(null), [M, wt] = d(null), [Tt, Et] = d("card");
63
+ }] : [], { items: S, clearCart: mt, _hasHydrated: C } = ae(), w = rt.pathname.includes("/checkout/addons") && !nt, T = rt.pathname.includes("/checkout/store") && !!g, E = w ? "ADDON" : T ? "ORDER" : v?.purchaseType ?? (tt ? "PLAN" : nt ? "ADDON" : "CREDITS"), D = v?.itemId ?? tt ?? nt ?? g, [ht, gt] = d(!1), _t = Ne(!1), [vt, yt] = d(!1), [bt, xt] = d([]), [St, Ct] = d(null), [O, k] = d("select"), [A, wt] = d(null), [Tt, j] = d(null), [M, Et] = d(null), [Dt, Ot] = d("card");
63
64
  l(() => {
64
65
  if (O !== "success" || !M) return;
65
- let e = typeof window < "u" ? window.localStorage.getItem(Xe("boff-referral-attribution")) : null;
66
+ let e = typeof window < "u" ? window.localStorage.getItem(Ze("boff-referral-attribution")) : null;
66
67
  if (!e) return;
67
68
  let t;
68
69
  try {
@@ -72,12 +73,12 @@ var $e = () => {
72
73
  }
73
74
  if (!t.journeyId && !t.codeId) return;
74
75
  let n = M.transactionId || A?.paymentId || A?.orderId || g || D || E, r = `${t.journeyId ?? "journey"}:${n}`;
75
- ut.current !== r && (ut.current = r, se({
76
+ dt.current !== r && (dt.current = r, se({
76
77
  journeyId: t.journeyId,
77
78
  codeId: t.codeId,
78
79
  eventType: E === "ORDER" ? "STORE_PURCHASE" : "PAID_CONVERSION",
79
- productSlug: lt,
80
- actorUserId: ct?.id,
80
+ productSlug: ut,
81
+ actorUserId: lt?.id,
81
82
  orderId: M.transactionId || A?.paymentId || A?.orderId,
82
83
  billingAccountId: M.billingAccountId,
83
84
  storeOrderId: E === "ORDER" ? g : void 0,
@@ -89,42 +90,42 @@ var $e = () => {
89
90
  billingAccountName: M.billingAccountName
90
91
  }
91
92
  }, {
92
- apiGatewayUrl: ot,
93
- authToken: st,
93
+ apiGatewayUrl: st,
94
+ authToken: ct,
94
95
  orgId: b
95
96
  }).catch(() => {
96
- ut.current = null;
97
+ dt.current = null;
97
98
  }));
98
99
  }, [
99
- ot,
100
100
  st,
101
- ct?.id,
101
+ ct,
102
+ lt?.id,
102
103
  D,
103
104
  O,
104
105
  b,
105
106
  A?.orderId,
106
107
  A?.paymentId,
107
- lt,
108
+ ut,
108
109
  M,
109
110
  E,
110
111
  g
111
112
  ]);
112
- let [N, P] = d(1), F = ue({
113
+ let [N, P] = d(1), F = de({
113
114
  defaultCurrency: "USD",
114
115
  upgradeFromSubscriptionId: v?.upgradeFromSubscriptionId,
115
116
  downgradeFromSubscriptionId: v?.downgradeFromSubscriptionId
116
- }), { config: Dt, stripeEnabled: Ot, razorpayEnabled: kt } = pe(), { elapsedTime: At, error: jt } = me({
117
+ }), { config: kt, stripeEnabled: At, razorpayEnabled: jt } = me(), { elapsedTime: Mt, error: Nt } = he({
117
118
  paymentId: O === "processing" ? A?.paymentId ?? null : null,
118
119
  billingAccountId: F.billingAccount?.id ?? M?.billingAccountId ?? null,
119
- paymentType: Tt,
120
+ paymentType: Dt,
120
121
  pollingInterval: 5e3,
121
122
  maxPollingTime: 3e5,
122
123
  onSuccess: (e) => {
123
- if (e.transactionId && wt((t) => t && {
124
+ if (e.transactionId && Et((t) => t && {
124
125
  ...t,
125
126
  transactionId: e.transactionId
126
- }), k("success"), w && ft(), (E === "PLAN" || E === "ADDON") && x) {
127
- let e = (I?.getPlan?.features ?? []).filter((e) => e != null).filter((e) => e.quota?.name && ke(e.quota.name)).map((e) => {
127
+ }), k("success"), w && mt(), (E === "PLAN" || E === "ADDON") && x) {
128
+ let e = (I?.getPlan?.features ?? []).filter((e) => e != null).filter((e) => e.quota?.name && Ae(e.quota.name)).map((e) => {
128
129
  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;
129
130
  return {
130
131
  quotaName: e.quota.name,
@@ -135,10 +136,10 @@ var $e = () => {
135
136
  quotaMode: "dedicated"
136
137
  };
137
138
  });
138
- e.length > 0 && (yt(e), Gt().then((e) => {
139
+ e.length > 0 && (xt(e), qt().then((e) => {
139
140
  let t = e.data?.getActiveSubscriptions?.find((e) => e.planId === D);
140
- t && xt(t.id);
141
- }), dt.length > 1 && _t(!0));
141
+ t && Ct(t.id);
142
+ }), pt.length > 1 && yt(!0));
142
143
  }
143
144
  },
144
145
  onFailure: (e) => {
@@ -147,48 +148,48 @@ var $e = () => {
147
148
  onTimeout: () => {
148
149
  j("Payment verification timed out. Please check your billing history for the payment status."), k("error");
149
150
  }
150
- }), { data: Mt, loading: Nt, refetch: Pt } = ee({}), { data: I, loading: Ft } = ne({
151
+ }), { data: Pt, loading: Ft, refetch: It } = ee({}), { data: I, loading: Lt } = ne({
151
152
  variables: { id: D },
152
153
  skip: E !== "PLAN" || !D
153
- }), { data: L, loading: It } = re({
154
+ }), { data: L, loading: Rt } = re({
154
155
  variables: { addonIDs: D ? [D] : [] },
155
156
  skip: E !== "ADDON" || !D || T
156
157
  }), { data: R } = ie({
157
158
  variables: { id: g },
158
159
  skip: !T || !g
159
- }), Lt = u(() => {
160
+ }), zt = u(() => {
160
161
  let e = R?.getStoreOrder?.lineItems;
161
162
  return Array.isArray(e) ? e : [];
162
- }, [R]), z = T && Lt.some((e) => String(e.itemType).toUpperCase() === "PHYSICAL"), Rt = je(R?.getStoreOrder?.currency), [B, zt] = d({
163
+ }, [R]), z = T && zt.some((e) => String(e.itemType).toUpperCase() === "PHYSICAL"), Bt = Me(R?.getStoreOrder?.currency), [B, Vt] = d({
163
164
  shippingAddressId: null,
164
165
  shippingMethodId: null,
165
166
  shippingCost: 0,
166
167
  destinationCountry: null
167
- }), [Bt] = le(), { data: Vt, loading: Ht } = s({
168
+ }), [Ht] = ue(), { data: Ut, loading: Wt } = s({
168
169
  variables: { billingAccountId: F.billingAccount?.id },
169
170
  skip: !F.billingAccount?.id
170
- }), { data: Ut, loading: Wt, refetch: Gt } = o({
171
+ }), { data: Gt, loading: Kt, refetch: qt } = o({
171
172
  variables: { billingAccountId: F.billingAccount?.id },
172
173
  skip: !F.billingAccount?.id || E !== "ADDON" && E !== "PLAN" || T
173
- }), V = u(() => Ut?.getActiveSubscriptions ?? [], [Ut]), H = u(() => !F.selectedSubscriptionId || V.length === 0 ? null : V.find((e) => e.id === F.selectedSubscriptionId) ?? null, [F.selectedSubscriptionId, V]), U = F.items[0]?.type === "CREDITS" ? F.items[0].quantity : 100, { data: Kt, loading: qt } = te({
174
+ }), V = u(() => Gt?.getActiveSubscriptions ?? [], [Gt]), H = u(() => !F.selectedSubscriptionId || V.length === 0 ? null : V.find((e) => e.id === F.selectedSubscriptionId) ?? null, [F.selectedSubscriptionId, V]), U = F.items[0]?.type === "CREDITS" ? F.items[0].quantity : 100, { data: Jt, loading: Yt } = te({
174
175
  variables: {
175
176
  creditAmount: U,
176
177
  currency: F.selectedCurrency || "USD"
177
178
  },
178
179
  skip: E !== "CREDITS"
179
- }), W = u(() => Kt?.getCostOfCredits?.amount && U > 0 ? Kt.getCostOfCredits.amount / U : .01, [Kt, U]), G = u(() => Vt?.getPaymentMethods ?? [], [Vt]), K = u(() => Mt?.myBillingAccounts ?? [], [Mt]), q = u(() => {
180
+ }), W = u(() => Jt?.getCostOfCredits?.amount && U > 0 ? Jt.getCostOfCredits.amount / U : .01, [Jt, U]), G = u(() => Ut?.getPaymentMethods ?? [], [Ut]), K = u(() => Pt?.myBillingAccounts ?? [], [Pt]), q = u(() => {
180
181
  if (!F.billingAccount) return;
181
182
  let e = K.find((e) => e.id === F.billingAccount?.id)?.billingAddresses;
182
183
  if (e && e.length > 0) return e[0]?.country || void 0;
183
- }, [F.billingAccount, K]), [Jt, Yt] = d(null);
184
+ }, [F.billingAccount, K]), [Xt, Zt] = d(null);
184
185
  l(() => {
185
- if (q) if (q === "IN") F.selectedCurrency !== "INR" && F.setCurrency("INR"), kt && Jt !== q && F.selectedProvider !== "CREDITS" && (F.setPaymentProvider("RAZORPAY"), Yt(q));
186
+ if (q) if (q === "IN") F.selectedCurrency !== "INR" && F.setCurrency("INR"), jt && Xt !== q && F.selectedProvider !== "CREDITS" && (F.setPaymentProvider("RAZORPAY"), Zt(q));
186
187
  else {
187
188
  if (F.selectedCurrency === "INR") {
188
189
  let e = F.billingAccount?.currency, t = e && e !== "INR" ? e : "USD";
189
190
  F.setCurrency(t);
190
191
  }
191
- F.selectedProvider === "RAZORPAY" && (F.setPaymentProvider("STRIPE"), Yt(q));
192
+ F.selectedProvider === "RAZORPAY" && (F.setPaymentProvider("STRIPE"), Zt(q));
192
193
  }
193
194
  }, [
194
195
  q,
@@ -197,46 +198,46 @@ var $e = () => {
197
198
  F.setCurrency,
198
199
  F.setPaymentProvider,
199
200
  F.billingAccount?.currency,
200
- kt,
201
- Jt
201
+ jt,
202
+ Xt
202
203
  ]);
203
- let { billingAccount: Xt, canPayWithCredits: Zt, hasEnoughCredits: Qt, selectedCurrency: J, selectedPaymentMethodId: $t, selectedProvider: en, setCurrency: Y, setPaymentProvider: X, setSelectedPaymentMethodId: tn } = F;
204
+ let { billingAccount: Qt, canPayWithCredits: $t, hasEnoughCredits: en, selectedCurrency: J, selectedPaymentMethodId: tn, selectedProvider: nn, setCurrency: Y, setPaymentProvider: X, setSelectedPaymentMethodId: rn } = F;
204
205
  l(() => {
205
- if (!Xt?.currency || q === "IN") return;
206
- let e = Xt.currency;
206
+ if (!Qt?.currency || q === "IN") return;
207
+ let e = Qt.currency;
207
208
  e !== "INR" && J !== e && Y(e);
208
209
  }, [
209
210
  q,
210
- Xt,
211
+ Qt,
211
212
  J,
212
213
  Y
213
214
  ]), l(() => {
214
- if (!(en !== "AUTO" && en !== null)) {
215
- if (Zt && Qt) {
216
- X("CREDITS"), tn(null);
215
+ if (!(nn !== "AUTO" && nn !== null)) {
216
+ if ($t && en) {
217
+ X("CREDITS"), rn(null);
217
218
  return;
218
219
  }
219
- if (G.length > 0 && !$t) {
220
+ if (G.length > 0 && !tn) {
220
221
  let e = G.find((e) => e.isDefault && e.isVerified), t = G.find((e) => e.isVerified), n = e || t;
221
222
  if (n) {
222
- tn(n.id), n.razorpayPaymentMethodId ? X("RAZORPAY") : n.stripePaymentMethodId && X("STRIPE");
223
+ rn(n.id), n.razorpayPaymentMethodId ? X("RAZORPAY") : n.stripePaymentMethodId && X("STRIPE");
223
224
  return;
224
225
  }
225
226
  }
226
227
  }
227
228
  }, [
228
- Zt,
229
- Qt,
230
- G,
231
229
  $t,
232
230
  en,
231
+ G,
232
+ tn,
233
+ nn,
233
234
  X,
234
- tn
235
+ rn
235
236
  ]);
236
237
  let [Z, Q] = d(!1);
237
238
  l(() => {
238
239
  if (!T || Z || !R?.getStoreOrder) return;
239
- let e = je(R.getStoreOrder.currency);
240
+ let e = Me(R.getStoreOrder.currency);
240
241
  J !== e && Y(e);
241
242
  }, [
242
243
  T,
@@ -344,7 +345,8 @@ var $e = () => {
344
345
  };
345
346
  F.addItem(o), Q(!0);
346
347
  } else if (T && R?.getStoreOrder) {
347
- let e = R.getStoreOrder, t = Ae(e);
348
+ F.clearItems();
349
+ let e = R.getStoreOrder, t = je(e);
348
350
  for (let e of t) F.addItem(e);
349
351
  Q(!0);
350
352
  } else if (E === "CREDITS") {
@@ -390,13 +392,13 @@ var $e = () => {
390
392
  F.selectedCurrency,
391
393
  F.updateItemPrice
392
394
  ]);
393
- let $ = Me(null);
395
+ let $ = Ne(null);
394
396
  l(() => {
395
397
  if (z) if (B.shippingCost > 0) {
396
- let e = F.selectedCurrency, t = Rt !== e && F.convertedAmount !== null ? B.shippingCost * F.conversionRate : B.shippingCost, n = $.current;
398
+ let e = F.selectedCurrency, t = Bt !== e && F.convertedAmount !== null ? B.shippingCost * F.conversionRate : B.shippingCost, n = $.current;
397
399
  if (n && n.price === t && n.currency === e) return;
398
400
  n === null ? F.addItem({
399
- id: ce,
401
+ id: le,
400
402
  type: "ORDER",
401
403
  name: "Shipping",
402
404
  price: t,
@@ -406,15 +408,15 @@ var $e = () => {
406
408
  storeOrderId: g,
407
409
  isShipping: !0
408
410
  }
409
- }) : F.updateItemPrice(ce, t, e), $.current = {
411
+ }) : F.updateItemPrice(le, t, e), $.current = {
410
412
  price: t,
411
413
  currency: e
412
414
  };
413
- } else $.current !== null && ($.current = null, F.removeItem(ce));
415
+ } else $.current !== null && ($.current = null, F.removeItem(le));
414
416
  }, [
415
417
  z,
416
418
  B.shippingCost,
417
- Rt,
419
+ Bt,
418
420
  F.selectedCurrency,
419
421
  F.conversionRate,
420
422
  F.convertedAmount,
@@ -489,7 +491,7 @@ var $e = () => {
489
491
  v?.billingAccountId,
490
492
  b
491
493
  ]);
492
- let nn = !!(v?.upgradeFromSubscriptionId || v?.downgradeFromSubscriptionId);
494
+ let an = !!(v?.upgradeFromSubscriptionId || v?.downgradeFromSubscriptionId);
493
495
  l(() => {
494
496
  w && C && S.length === 0 && !Z && _("/addons", { replace: !0 });
495
497
  }, [
@@ -499,24 +501,24 @@ var $e = () => {
499
501
  Z,
500
502
  _
501
503
  ]);
502
- let rn = fe({
504
+ let on = pe({
503
505
  billingAccountId: F.billingAccount?.id,
504
506
  purchaseType: E,
505
507
  productId: D
506
- }), an = c(async () => {
508
+ }), sn = c(async () => {
507
509
  if (!F.billingAccount) return;
508
- let e = ht.current;
509
- if (ht.current = !1, !e && !Ee(F.billingAccount)) {
510
- mt(!0);
510
+ let e = _t.current;
511
+ if (_t.current = !1, !e && !De(F.billingAccount)) {
512
+ gt(!0);
511
513
  return;
512
514
  }
513
515
  if (j(null), z) try {
514
- let e = (await Bt({ variables: { input: {
516
+ let e = (await Ht({ variables: { input: {
515
517
  orderId: g,
516
518
  shippingMethodId: B.shippingMethodId,
517
519
  ...B.shippingAddressId ? { shippingAddressId: B.shippingAddressId } : {}
518
520
  } } })).data?.setStoreOrderShipping?.shippingCost;
519
- typeof e == "number" && e !== B.shippingCost && zt((t) => ({
521
+ typeof e == "number" && e !== B.shippingCost && Vt((t) => ({
520
522
  ...t,
521
523
  shippingCost: e
522
524
  }));
@@ -539,7 +541,7 @@ var $e = () => {
539
541
  source: "checkout",
540
542
  amount: i,
541
543
  currency: "CREDITS"
542
- }), wt({
544
+ }), Et({
543
545
  items: n,
544
546
  total: i,
545
547
  billingAccountName: F.billingAccount.name,
@@ -549,10 +551,10 @@ var $e = () => {
549
551
  paymentMethod: "credits",
550
552
  currency: "Credits",
551
553
  transactionId: a.orderId
552
- }), Et("credits"), St({ paymentId: a.orderId }), k("processing");
554
+ }), Ot("credits"), wt({ paymentId: a.orderId }), k("processing");
553
555
  return;
554
556
  }
555
- wt({
557
+ Et({
556
558
  items: n,
557
559
  total: a.total || r,
558
560
  billingAccountName: F.billingAccount.name,
@@ -562,7 +564,7 @@ var $e = () => {
562
564
  paymentMethod: "card",
563
565
  currency: a.currency || F.selectedCurrency,
564
566
  transactionId: a.paymentId
565
- }), Et("card"), St({
567
+ }), Ot("card"), wt({
566
568
  clientSecret: a.clientSecret,
567
569
  orderId: a.orderId,
568
570
  razorpayKeyId: a.razorpayKeyId,
@@ -586,19 +588,19 @@ var $e = () => {
586
588
  z,
587
589
  B,
588
590
  g,
589
- Rt,
590
- Bt
591
- ]), on = c((e) => {
591
+ Bt,
592
+ Ht
593
+ ]), cn = c((e) => {
592
594
  y("billing.payment.succeeded", {
593
595
  route: "/billing/checkout",
594
596
  entityId: A?.paymentId ?? A?.orderId,
595
597
  source: "checkout"
596
- }), St((e) => e), k("processing");
598
+ }), wt((e) => e), k("processing");
597
599
  }, [
598
600
  y,
599
601
  A?.orderId,
600
602
  A?.paymentId
601
- ]), sn = c((e) => {
603
+ ]), ln = c((e) => {
602
604
  y("billing.payment.failed", {
603
605
  route: "/billing/checkout",
604
606
  entityId: A?.paymentId ?? A?.orderId,
@@ -609,20 +611,20 @@ var $e = () => {
609
611
  y,
610
612
  A?.orderId,
611
613
  A?.paymentId
612
- ]), cn = c((e) => {
614
+ ]), un = c((e) => {
613
615
  F.updateItemQuantity("credits-purchase", e);
614
616
  }, [F]);
615
- if (!rt.canProcessPayment) return /* @__PURE__ */ p(t, { message: "You don't have permission to make purchases." });
616
- if (de()) return /* @__PURE__ */ p(he, {
617
+ if (!it.canProcessPayment) return /* @__PURE__ */ p(t, { message: "You don't have permission to make purchases." });
618
+ if (fe()) return /* @__PURE__ */ p(ge, {
617
619
  purchaseType: E,
618
620
  productId: D,
619
621
  billingAccountId: F.billingAccount?.id,
620
- nativeCheckout: rn,
622
+ nativeCheckout: on,
621
623
  onBack: () => _("dashboard")
622
624
  });
623
- let ln = Nt || Ft && E === "PLAN" || It && E === "ADDON" && !w || w && !C;
625
+ let dn = Ft || Lt && E === "PLAN" || Rt && E === "ADDON" && !w || w && !C;
624
626
  if (w && C && S.length === 0 && !Z) return null;
625
- let un = () => {
627
+ let fn = () => {
626
628
  if (w) {
627
629
  let e = F.items.length;
628
630
  return `Purchase ${e} Add-on${e === 1 ? "" : "s"}`;
@@ -633,19 +635,19 @@ var $e = () => {
633
635
  case "ADDON": return "Purchase Add-on";
634
636
  default: return "Checkout";
635
637
  }
636
- }, dn = () => {
638
+ }, pn = () => {
637
639
  switch (E) {
638
- case "CREDITS": return /* @__PURE__ */ p(Le, { className: "size-6" });
639
- case "PLAN": return /* @__PURE__ */ p(Be, { className: "size-6" });
640
- case "ADDON": return /* @__PURE__ */ p(Fe, { className: "size-6" });
641
- default: return /* @__PURE__ */ p(Ue, { className: "size-6" });
640
+ case "CREDITS": return /* @__PURE__ */ p(Re, { className: "size-6" });
641
+ case "PLAN": return /* @__PURE__ */ p(Ve, { className: "size-6" });
642
+ case "ADDON": return /* @__PURE__ */ p(Ie, { className: "size-6" });
643
+ default: return /* @__PURE__ */ p(We, { className: "size-6" });
642
644
  }
643
645
  };
644
- if (ln) return /* @__PURE__ */ p("div", {
646
+ if (dn) return /* @__PURE__ */ p("div", {
645
647
  className: "flex items-center justify-center min-h-[400px]",
646
648
  children: /* @__PURE__ */ m("div", {
647
649
  className: "text-center space-y-4",
648
- children: [/* @__PURE__ */ p(ze, { className: "size-8 animate-spin mx-auto text-text-link" }), /* @__PURE__ */ p("p", {
650
+ children: [/* @__PURE__ */ p(Be, { className: "size-8 animate-spin mx-auto text-text-link" }), /* @__PURE__ */ p("p", {
649
651
  className: "text-text-secondary",
650
652
  children: h("billing.checkout.loadingCheckout", "Loading checkout...")
651
653
  })]
@@ -661,7 +663,11 @@ var $e = () => {
661
663
  EUR: "€",
662
664
  GBP: "£"
663
665
  }[t] || t + " "}${e.toFixed(2)}`;
664
- }, t = (e) => `${e.toFixed(2)} Credits`;
666
+ }, t = (e) => `${e.toFixed(2)} Credits`, n = M ? M.items.reduce((e, t) => e + t.price * t.quantity, 0) : 0, r = (e) => {
667
+ if (!M || n <= 0) return 0;
668
+ let t = e.price * e.quantity;
669
+ return M.total * (t / n);
670
+ };
665
671
  return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ m("div", {
666
672
  className: "max-w-2xl mx-auto p-6 space-y-6",
667
673
  children: [
@@ -669,7 +675,7 @@ var $e = () => {
669
675
  className: "text-center space-y-4",
670
676
  children: [/* @__PURE__ */ p("div", {
671
677
  className: "inline-flex p-4 rounded-full bg-status-success-bg-subtle text-status-success-text",
672
- children: /* @__PURE__ */ p(Ie, { className: "size-12" })
678
+ children: /* @__PURE__ */ p(Le, { className: "size-12" })
673
679
  }), /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("h1", {
674
680
  className: "text-2xl font-bold text-text-primary",
675
681
  children: h("billing.checkout.paymentSuccessful", "Payment Successful!")
@@ -685,7 +691,7 @@ var $e = () => {
685
691
  className: "p-4 border-b border-border-subtle",
686
692
  children: [/* @__PURE__ */ m("h3", {
687
693
  className: "font-semibold text-text-primary mb-3 flex items-center gap-2",
688
- children: [/* @__PURE__ */ p(Ve, { className: "size-4" }), h("billing.checkout.itemsPurchased", "Items Purchased")]
694
+ children: [/* @__PURE__ */ p(He, { className: "size-4" }), h("billing.checkout.itemsPurchased", "Items Purchased")]
689
695
  }), /* @__PURE__ */ p("div", {
690
696
  className: "space-y-2",
691
697
  children: M.items.map((t) => /* @__PURE__ */ m("div", {
@@ -693,10 +699,10 @@ var $e = () => {
693
699
  children: [/* @__PURE__ */ m("div", {
694
700
  className: "flex items-center gap-2",
695
701
  children: [
696
- t.type === "PLAN" && /* @__PURE__ */ p(Be, { className: "size-4 text-accent-blue" }),
697
- t.type === "ADDON" && /* @__PURE__ */ p(Fe, { className: "size-4 text-accent-purple" }),
698
- t.type === "CREDITS" && /* @__PURE__ */ p(Le, { className: "size-4 text-status-warning-text" }),
699
- t.type === "ORDER" && /* @__PURE__ */ p(Ue, { className: "size-4 text-status-success-text" }),
702
+ t.type === "PLAN" && /* @__PURE__ */ p(Ve, { className: "size-4 text-accent-blue" }),
703
+ t.type === "ADDON" && /* @__PURE__ */ p(Ie, { className: "size-4 text-accent-purple" }),
704
+ t.type === "CREDITS" && /* @__PURE__ */ p(Re, { className: "size-4 text-status-warning-text" }),
705
+ t.type === "ORDER" && /* @__PURE__ */ p(We, { className: "size-4 text-status-success-text" }),
700
706
  /* @__PURE__ */ p("span", {
701
707
  className: "text-text-primary",
702
708
  children: t.name
@@ -708,7 +714,7 @@ var $e = () => {
708
714
  ]
709
715
  }), /* @__PURE__ */ p("span", {
710
716
  className: "text-text-secondary",
711
- children: e(M.paymentMethod === "credits" ? (t.priceUSD ?? t.price) * 100 * t.quantity : t.price * t.quantity)
717
+ children: e(M.paymentMethod === "credits" ? r(t) : t.price * t.quantity)
712
718
  })]
713
719
  }, t.id))
714
720
  })]
@@ -722,10 +728,10 @@ var $e = () => {
722
728
  children: h("billing.checkout.paymentMethod", "Payment Method")
723
729
  }), /* @__PURE__ */ p("div", {
724
730
  className: "flex items-center gap-2",
725
- children: M.paymentMethod === "credits" ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(We, { className: "size-4 text-status-warning-text" }), /* @__PURE__ */ p("span", {
731
+ children: M.paymentMethod === "credits" ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(Ge, { className: "size-4 text-status-warning-text" }), /* @__PURE__ */ p("span", {
726
732
  className: "font-medium text-text-primary",
727
733
  children: h("billing.checkout.credits", "Credits")
728
- })] }) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(Re, { className: "size-4 text-accent-blue" }), /* @__PURE__ */ p("span", {
734
+ })] }) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(ze, { className: "size-4 text-accent-blue" }), /* @__PURE__ */ p("span", {
729
735
  className: "font-medium text-text-primary",
730
736
  children: h("billing.checkout.card", "Card")
731
737
  })] })
@@ -745,7 +751,7 @@ var $e = () => {
745
751
  className: "p-4 border-b border-border-subtle",
746
752
  children: [/* @__PURE__ */ m("h3", {
747
753
  className: "font-semibold text-text-primary mb-3 flex items-center gap-2",
748
- children: [/* @__PURE__ */ p(We, { className: "size-4" }), h("billing.checkout.creditBalance", "Credit Balance")]
754
+ children: [/* @__PURE__ */ p(Ge, { className: "size-4" }), h("billing.checkout.creditBalance", "Credit Balance")]
749
755
  }), /* @__PURE__ */ m("div", {
750
756
  className: "flex items-center gap-4",
751
757
  children: [
@@ -759,7 +765,7 @@ var $e = () => {
759
765
  children: t(M.previousBalance)
760
766
  })]
761
767
  }),
762
- /* @__PURE__ */ p(Pe, { className: "size-5 text-text-secondary shrink-0" }),
768
+ /* @__PURE__ */ p(Fe, { className: "size-5 text-text-secondary shrink-0" }),
763
769
  /* @__PURE__ */ m("div", {
764
770
  className: "flex-1 text-center p-3 rounded-lg bg-status-success-bg-subtle",
765
771
  children: [/* @__PURE__ */ p("p", {
@@ -812,14 +818,14 @@ var $e = () => {
812
818
  })]
813
819
  })
814
820
  ]
815
- }), gt && vt.length > 0 && x && bt && /* @__PURE__ */ p(Oe, {
821
+ }), vt && bt.length > 0 && x && St && /* @__PURE__ */ p(ke, {
816
822
  billingAccountId: M?.billingAccountId ?? "",
817
- subscriptionId: bt,
818
- quotas: vt,
819
- workspaces: dt,
823
+ subscriptionId: St,
824
+ quotas: bt,
825
+ workspaces: pt,
820
826
  currentWorkspaceId: x,
821
- onAssigned: () => _t(!1),
822
- onSkip: () => _t(!1)
827
+ onAssigned: () => yt(!1),
828
+ onSkip: () => yt(!1)
823
829
  })] });
824
830
  }
825
831
  if (O === "error") return /* @__PURE__ */ p("div", {
@@ -829,14 +835,14 @@ var $e = () => {
829
835
  children: [
830
836
  /* @__PURE__ */ p("div", {
831
837
  className: "inline-flex p-4 rounded-full bg-status-error-bg-subtle text-status-error-text",
832
- children: /* @__PURE__ */ p(Ge, { className: "size-12" })
838
+ children: /* @__PURE__ */ p(Ke, { className: "size-12" })
833
839
  }),
834
840
  /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("h1", {
835
841
  className: "text-2xl font-bold text-text-primary",
836
842
  children: h("billing.checkout.paymentFailed", "Payment Failed")
837
843
  }), /* @__PURE__ */ p("p", {
838
844
  className: "text-text-secondary mt-2",
839
- children: Ct || jt || F.error || h("billing.checkout.genericError", "Something went wrong. Please try again.")
845
+ children: Tt || Nt || F.error || h("billing.checkout.genericError", "Something went wrong. Please try again.")
840
846
  })] }),
841
847
  /* @__PURE__ */ m("div", {
842
848
  className: "flex gap-3 justify-center",
@@ -864,7 +870,7 @@ var $e = () => {
864
870
  children: [
865
871
  /* @__PURE__ */ p("div", {
866
872
  className: "inline-flex p-4 rounded-full bg-[var(--color-accent-soft)] text-text-link",
867
- children: /* @__PURE__ */ p(ze, { className: "size-12 animate-spin" })
873
+ children: /* @__PURE__ */ p(Be, { className: "size-12 animate-spin" })
868
874
  }),
869
875
  /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("h1", {
870
876
  className: "text-2xl font-bold text-text-primary",
@@ -885,7 +891,7 @@ var $e = () => {
885
891
  children: ((e) => {
886
892
  let t = Math.floor(e / 1e3);
887
893
  return `${Math.floor(t / 60)}:${(t % 60).toString().padStart(2, "0")}`;
888
- })(At)
894
+ })(Mt)
889
895
  })
890
896
  ]
891
897
  }), /* @__PURE__ */ p("p", {
@@ -897,10 +903,10 @@ var $e = () => {
897
903
  className: "w-full bg-bg-sunken rounded-full h-2 overflow-hidden",
898
904
  children: /* @__PURE__ */ p("div", {
899
905
  className: "bg-action-primary-bg h-2 rounded-full transition-all duration-1000",
900
- style: { width: `${Math.min(At / 3e5 * 100, 100)}%` }
906
+ style: { width: `${Math.min(Mt / 3e5 * 100, 100)}%` }
901
907
  })
902
908
  }),
903
- At > 3e4 && /* @__PURE__ */ p("button", {
909
+ Mt > 3e4 && /* @__PURE__ */ p("button", {
904
910
  type: "button",
905
911
  onClick: () => {
906
912
  k("error"), j("Payment verification was cancelled. Please check your billing history.");
@@ -925,7 +931,7 @@ var $e = () => {
925
931
  type: "button",
926
932
  onClick: () => k("select"),
927
933
  className: "flex items-center gap-2 text-sm text-text-secondary hover:text-text-primary",
928
- children: [/* @__PURE__ */ p(Ne, { className: "size-4" }), h("billing.checkout.backToCheckout", "Back to checkout")]
934
+ children: [/* @__PURE__ */ p(Pe, { className: "size-4" }), h("billing.checkout.backToCheckout", "Back to checkout")]
929
935
  }),
930
936
  /* @__PURE__ */ p(n, {
931
937
  title: h("billing.checkout.completePayment", "Complete Payment"),
@@ -936,7 +942,7 @@ var $e = () => {
936
942
  children: [
937
943
  /* @__PURE__ */ m("h3", {
938
944
  className: "font-semibold text-text-primary flex items-center gap-2",
939
- children: [/* @__PURE__ */ p(Ve, { className: "size-4" }), h("billing.checkout.paymentSummary", "Payment Summary")]
945
+ children: [/* @__PURE__ */ p(He, { className: "size-4" }), h("billing.checkout.paymentSummary", "Payment Summary")]
940
946
  }),
941
947
  F.billingAccount && /* @__PURE__ */ m("div", {
942
948
  className: "p-3 bg-bg-sunken rounded-lg space-y-1",
@@ -1028,13 +1034,13 @@ var $e = () => {
1028
1034
  className: "rounded-lg border border-border-subtle bg-bg-surface overflow-hidden",
1029
1035
  children: /* @__PURE__ */ p("div", {
1030
1036
  className: "p-4 space-y-4",
1031
- children: /* @__PURE__ */ p(be, {
1037
+ children: /* @__PURE__ */ p(xe, {
1032
1038
  clientSecret: A.clientSecret,
1033
- publishableKey: it || Dt?.stripePublishableKey || "",
1039
+ publishableKey: at || kt?.stripePublishableKey || "",
1034
1040
  amount: Math.round((A.total ?? F.total) * 100),
1035
1041
  currency: A.currency || F.selectedCurrency,
1036
- onSuccess: on,
1037
- onError: sn,
1042
+ onSuccess: cn,
1043
+ onError: ln,
1038
1044
  onCancel: () => k("select"),
1039
1045
  isCompletingExistingPayment: !!F.selectedPaymentMethodId
1040
1046
  })
@@ -1055,9 +1061,9 @@ var $e = () => {
1055
1061
  className: "text-sm text-text-secondary",
1056
1062
  children: "Save card for future purchases"
1057
1063
  })]
1058
- }), /* @__PURE__ */ p(xe, {
1064
+ }), /* @__PURE__ */ p(Se, {
1059
1065
  orderId: A.orderId,
1060
- keyId: A.razorpayKeyId || at || "",
1066
+ keyId: A.razorpayKeyId || ot || "",
1061
1067
  amount: Math.round((A.total ?? F.total) * 100),
1062
1068
  currency: A.currency || "INR",
1063
1069
  customerId: A.razorpayCustomerId,
@@ -1066,8 +1072,8 @@ var $e = () => {
1066
1072
  email: A.prefillEmail,
1067
1073
  contact: A.prefillContact
1068
1074
  },
1069
- onSuccess: (e) => on(e.razorpay_payment_id),
1070
- onError: sn,
1075
+ onSuccess: (e) => cn(e.razorpay_payment_id),
1076
+ onError: ln,
1071
1077
  onCancel: () => k("select")
1072
1078
  })]
1073
1079
  })
@@ -1082,22 +1088,22 @@ var $e = () => {
1082
1088
  type: "button",
1083
1089
  onClick: () => _(-1),
1084
1090
  className: "flex items-center gap-2 text-sm text-text-secondary hover:text-text-primary mb-4",
1085
- children: [/* @__PURE__ */ p(Ne, { className: "size-4" }), "Back"]
1091
+ children: [/* @__PURE__ */ p(Pe, { className: "size-4" }), "Back"]
1086
1092
  }),
1087
1093
  /* @__PURE__ */ m("div", {
1088
1094
  className: "flex items-center gap-3 mb-6",
1089
1095
  children: [/* @__PURE__ */ p("div", {
1090
1096
  className: "p-2 rounded-lg bg-[var(--color-accent-soft)] text-text-link",
1091
- children: dn()
1097
+ children: pn()
1092
1098
  }), /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("h1", {
1093
1099
  className: "text-2xl font-bold text-text-primary",
1094
- children: un()
1100
+ children: fn()
1095
1101
  }), /* @__PURE__ */ p("p", {
1096
1102
  className: "text-sm text-text-secondary",
1097
1103
  children: "Complete your purchase securely"
1098
1104
  })] })]
1099
1105
  }),
1100
- /* @__PURE__ */ p(Ze, {
1106
+ /* @__PURE__ */ p(Qe, {
1101
1107
  className: "mb-6",
1102
1108
  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.")
1103
1109
  }),
@@ -1107,7 +1113,7 @@ var $e = () => {
1107
1113
  className: "flex items-center gap-3",
1108
1114
  children: [/* @__PURE__ */ p("div", {
1109
1115
  className: "p-2 rounded-full bg-status-info-bg-subtle",
1110
- children: /* @__PURE__ */ p(He, { className: "size-4 text-accent-blue" })
1116
+ children: /* @__PURE__ */ p(Ue, { className: "size-4 text-accent-blue" })
1111
1117
  }), /* @__PURE__ */ m("div", {
1112
1118
  className: "flex-1",
1113
1119
  children: [/* @__PURE__ */ m("p", {
@@ -1133,7 +1139,7 @@ var $e = () => {
1133
1139
  className: "flex items-center gap-3",
1134
1140
  children: [/* @__PURE__ */ p("div", {
1135
1141
  className: "p-2 rounded-full bg-status-warning-bg-subtle",
1136
- children: /* @__PURE__ */ p(He, { className: "size-4 text-status-warning-text" })
1142
+ children: /* @__PURE__ */ p(Ue, { className: "size-4 text-status-warning-text" })
1137
1143
  }), /* @__PURE__ */ m("div", {
1138
1144
  className: "flex-1",
1139
1145
  children: [/* @__PURE__ */ m("p", {
@@ -1160,46 +1166,46 @@ var $e = () => {
1160
1166
  children: [
1161
1167
  E === "CREDITS" && F.items[0] && /* @__PURE__ */ p("div", {
1162
1168
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4 sm:p-6",
1163
- children: /* @__PURE__ */ p(ye, {
1169
+ children: /* @__PURE__ */ p(be, {
1164
1170
  value: F.items[0].quantity,
1165
- onChange: cn,
1171
+ onChange: un,
1166
1172
  costPerCredit: W,
1167
1173
  currency: F.selectedCurrency,
1168
- disabled: qt
1174
+ disabled: Yt
1169
1175
  })
1170
1176
  }),
1171
1177
  /* @__PURE__ */ m("div", {
1172
1178
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4 sm:p-6 space-y-4",
1173
- children: [/* @__PURE__ */ p(ge, {
1179
+ children: [/* @__PURE__ */ p(_e, {
1174
1180
  accounts: K,
1175
1181
  selectedAccountId: F.billingAccount?.id ?? null,
1176
1182
  onSelect: F.setBillingAccount,
1177
- isLoading: Nt,
1178
- disabled: nn,
1179
- disabledMessage: nn ? "Billing account is locked for plan changes" : void 0
1180
- }), E === "ADDON" && !T && F.billingAccount && /* @__PURE__ */ p(Se, {
1183
+ isLoading: Ft,
1184
+ disabled: an,
1185
+ disabledMessage: an ? "Billing account is locked for plan changes" : void 0
1186
+ }), E === "ADDON" && !T && F.billingAccount && /* @__PURE__ */ p(Ce, {
1181
1187
  subscriptions: V,
1182
1188
  selectedSubscriptionId: F.selectedSubscriptionId,
1183
1189
  onSelect: F.setSelectedSubscriptionId,
1184
- isLoading: Wt
1190
+ isLoading: Kt
1185
1191
  })]
1186
1192
  }),
1187
- z && /* @__PURE__ */ p(De, {
1193
+ z && /* @__PURE__ */ p(Oe, {
1188
1194
  storeOrderId: g,
1189
1195
  currency: F.selectedCurrency,
1190
- onChange: zt
1196
+ onChange: Vt
1191
1197
  }),
1192
1198
  /* @__PURE__ */ m("div", {
1193
1199
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4 sm:p-6 space-y-4",
1194
1200
  children: [
1195
- /* @__PURE__ */ p(we, {
1201
+ /* @__PURE__ */ p(Te, {
1196
1202
  savedPaymentMethods: G,
1197
1203
  selectedPaymentMethodId: F.selectedPaymentMethodId,
1198
1204
  onSelectSavedCard: F.setSelectedPaymentMethodId,
1199
1205
  selectedProvider: F.selectedProvider,
1200
1206
  onSelectProvider: F.setPaymentProvider,
1201
- stripeEnabled: Ot,
1202
- razorpayEnabled: kt,
1207
+ stripeEnabled: At,
1208
+ razorpayEnabled: jt,
1203
1209
  canPayWithCredits: F.canPayWithCredits,
1204
1210
  availableCredits: F.availableCredits,
1205
1211
  creditsRequired: F.creditsRequired,
@@ -1207,7 +1213,7 @@ var $e = () => {
1207
1213
  saveCard: F.saveCard,
1208
1214
  onSaveCardChange: F.setSaveCard,
1209
1215
  autoRenewEnabled: E === "PLAN" && F.autoRenew,
1210
- isLoading: Ht
1216
+ isLoading: Wt
1211
1217
  }),
1212
1218
  F.selectedProvider !== "CREDITS" && F.selectedProvider !== "AUTO" && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", { className: "border-t border-border-subtle" }), /* @__PURE__ */ p("div", {
1213
1219
  className: "bg-bg-sunken p-4 rounded-button",
@@ -1326,7 +1332,7 @@ var $e = () => {
1326
1332
  children: [
1327
1333
  /* @__PURE__ */ p("div", {
1328
1334
  className: "p-4",
1329
- children: /* @__PURE__ */ p(_e, {
1335
+ children: /* @__PURE__ */ p(ve, {
1330
1336
  items: F.items,
1331
1337
  subtotal: F.subtotal,
1332
1338
  discountAmount: F.discountAmount,
@@ -1337,6 +1343,7 @@ var $e = () => {
1337
1343
  currency: F.selectedCurrency,
1338
1344
  isCalculatingTax: F.isCalculatingTax,
1339
1345
  showInCredits: F.selectedProvider === "CREDITS",
1346
+ creditsRequired: F.creditsRequired,
1340
1347
  onUpdateQuantity: E !== "PLAN" && E !== "ORDER" ? F.updateItemQuantity : void 0,
1341
1348
  onRemoveItem: F.removeItem,
1342
1349
  isEditable: E !== "PLAN" && E !== "ORDER"
@@ -1344,7 +1351,7 @@ var $e = () => {
1344
1351
  }),
1345
1352
  F.selectedProvider !== "CREDITS" && /* @__PURE__ */ p("div", {
1346
1353
  className: "px-4 pb-4 border-t border-border-subtle pt-4",
1347
- children: /* @__PURE__ */ p(ve, {
1354
+ children: /* @__PURE__ */ p(ye, {
1348
1355
  value: F.promoCode,
1349
1356
  onChange: F.setPromoCode,
1350
1357
  onValidate: async () => await F.validatePromoCode(),
@@ -1363,7 +1370,7 @@ var $e = () => {
1363
1370
  } else (F.selectedProvider === "RAZORPAY" || F.selectedProvider === "STRIPE") && (e = F.selectedProvider === "RAZORPAY" ? "new card (Razorpay)" : "new card (Stripe)", t = !0, n = !0);
1364
1371
  return /* @__PURE__ */ p("div", {
1365
1372
  className: "px-4 pb-4",
1366
- children: /* @__PURE__ */ p(Ce, {
1373
+ children: /* @__PURE__ */ p(we, {
1367
1374
  enabled: F.autoRenew,
1368
1375
  onToggle: (e) => {
1369
1376
  F.setAutoRenew(e), e && F.selectedPaymentMethodId && F.setAutoRenewPaymentMethodId(F.selectedPaymentMethodId);
@@ -1378,10 +1385,10 @@ var $e = () => {
1378
1385
  }),
1379
1386
  /* @__PURE__ */ p("button", {
1380
1387
  type: "button",
1381
- onClick: an,
1382
- disabled: F.isProcessing || !F.billingAccount || F.items.length === 0 || F.selectedProvider === "CREDITS" && !Qt || E === "ADDON" && !T && Wt || E === "ADDON" && !T && V.length === 0 || E === "ADDON" && !T && !F.selectedSubscriptionId || z && (!B.shippingAddressId || !B.shippingMethodId),
1388
+ onClick: sn,
1389
+ disabled: F.isProcessing || !F.billingAccount || F.items.length === 0 || F.selectedProvider === "CREDITS" && !en || E === "ADDON" && !T && Kt || E === "ADDON" && !T && V.length === 0 || E === "ADDON" && !T && !F.selectedSubscriptionId || z && (!B.shippingAddressId || !B.shippingMethodId),
1383
1390
  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",
1384
- children: F.isProcessing ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(ze, { className: "size-5 animate-spin" }), "Processing…"] }) : F.selectedProvider === "CREDITS" ? "Pay with Credits" : "Proceed to Payment"
1391
+ children: F.isProcessing ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(Be, { className: "size-5 animate-spin" }), "Processing…"] }) : F.selectedProvider === "CREDITS" ? "Pay with Credits" : "Proceed to Payment"
1385
1392
  }),
1386
1393
  /* @__PURE__ */ p("p", {
1387
1394
  className: "text-center text-xs text-text-secondary",
@@ -1391,22 +1398,22 @@ var $e = () => {
1391
1398
  })
1392
1399
  })]
1393
1400
  }),
1394
- pt && F.billingAccount && /* @__PURE__ */ p(Te, {
1401
+ ht && F.billingAccount && /* @__PURE__ */ p(Ee, {
1395
1402
  billingAccountId: F.billingAccount.id,
1396
1403
  hasPhone: !!F.billingAccount.contactNumber?.trim(),
1397
1404
  hasAddress: !!(F.billingAccount.billingAddresses?.[0]?.line1?.trim() && F.billingAccount.billingAddresses?.[0]?.postalCode?.trim()),
1398
1405
  onCompleted: () => {
1399
- ht.current = !0, mt(!1), an(), Pt().then((e) => {
1400
- let t = (e.data?.myBillingAccounts ?? []).map(Qe).find((e) => e?.id === F.billingAccount?.id);
1406
+ _t.current = !0, gt(!1), sn(), It().then((e) => {
1407
+ let t = (e.data?.myBillingAccounts ?? []).map($e).find((e) => e?.id === F.billingAccount?.id);
1401
1408
  t && F.setBillingAccount(t);
1402
1409
  });
1403
1410
  },
1404
- onCancel: () => mt(!1)
1411
+ onCancel: () => gt(!1)
1405
1412
  })
1406
1413
  ]
1407
1414
  });
1408
1415
  };
1409
1416
  //#endregion
1410
- export { $e as CheckoutPage };
1417
+ export { et as CheckoutPage };
1411
1418
 
1412
1419
  //# sourceMappingURL=CheckoutPage.js.map