@burdenoff/microfe-billing 2026.601.6 → 2026.604.1

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