@burdenoff/microfe-billing 2026.530.2 → 2026.530.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/billing/BillingAdminRoutes.js +110 -71
  2. package/dist/billing/BillingAdminRoutes.js.map +1 -1
  3. package/dist/billing/BillingRoot.js +81 -73
  4. package/dist/billing/BillingRoot.js.map +1 -1
  5. package/dist/billing/BillingUserRoutes.js +103 -90
  6. package/dist/billing/BillingUserRoutes.js.map +1 -1
  7. package/dist/billing/modules/billing/index.js +2 -1
  8. package/dist/billing/modules/billing/pages/InvoicesListPage.js +135 -126
  9. package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
  10. package/dist/billing/modules/billing/pages/UserRefundsPage.js +417 -0
  11. package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -0
  12. package/dist/billing/modules/billing/pages/index.js +1 -0
  13. package/dist/billing/modules/checkout/hooks/useCheckout.js +163 -161
  14. package/dist/billing/modules/checkout/hooks/useCheckout.js.map +1 -1
  15. package/dist/billing/modules/coupons/pages/CreateCouponPage.js +344 -167
  16. package/dist/billing/modules/coupons/pages/CreateCouponPage.js.map +1 -1
  17. package/dist/billing/modules/plans/constants/featuredQuotas.js +37 -0
  18. package/dist/billing/modules/plans/constants/featuredQuotas.js.map +1 -0
  19. package/dist/billing/modules/plans/index.js +2 -1
  20. package/dist/billing/modules/plans/pages/PlanAssignFreePage.js +205 -0
  21. package/dist/billing/modules/plans/pages/PlanAssignFreePage.js.map +1 -0
  22. package/dist/billing/modules/plans/pages/PlanCreatePage.js +51 -33
  23. package/dist/billing/modules/plans/pages/PlanCreatePage.js.map +1 -1
  24. package/dist/billing/modules/plans/pages/PlanEditPage.js +78 -60
  25. package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
  26. package/dist/billing/modules/plans/pages/PlansBrowsePage.js +246 -126
  27. package/dist/billing/modules/plans/pages/PlansBrowsePage.js.map +1 -1
  28. package/dist/billing/modules/plans/pages/index.js +1 -0
  29. package/dist/billing/modules/promotions/index.js +4 -0
  30. package/dist/billing/modules/promotions/pages/CreatePromotionPage.js +289 -0
  31. package/dist/billing/modules/promotions/pages/CreatePromotionPage.js.map +1 -0
  32. package/dist/billing/modules/promotions/pages/PromotionsListPage.js +168 -0
  33. package/dist/billing/modules/promotions/pages/PromotionsListPage.js.map +1 -0
  34. package/dist/billing/modules/promotions/pages/index.js +2 -0
  35. package/dist/billing/shared/types/graphql.js.map +1 -1
  36. package/dist/generated/global-operations.js +422 -290
  37. package/dist/generated/global-operations.js.map +1 -1
  38. package/dist/generated/global-types.js +3 -1
  39. package/dist/generated/global-types.js.map +1 -1
  40. package/package.json +1 -1
@@ -1,59 +1,60 @@
1
- import { useConvertCurrencyLazyQuery as e, useInitiatePaymentCheckoutMutation as t, useSpendCreditsCheckoutMutation as n, useValidateCouponLazyQuery as r } from "../../../../generated/global-operations.js";
2
- import { useCallback as i, useEffect as a, useMemo as o, useState as s } from "react";
1
+ import { useBilling as e } from "../../../providers/BillingProvider.js";
2
+ import { useConvertCurrencyLazyQuery as t, useInitiatePaymentCheckoutMutation as n, useSpendCreditsCheckoutMutation as r, useValidateCouponLazyQuery as i } from "../../../../generated/global-operations.js";
3
+ import { useCallback as a, useEffect as o, useMemo as s, useState as c } from "react";
3
4
  //#region src/billing/modules/checkout/hooks/useCheckout.ts
4
5
  var ee = 100;
5
- function c(c = {}) {
6
- let { defaultCurrency: l = "USD", defaultSaveCard: u = !1, upgradeFromSubscriptionId: d, downgradeFromSubscriptionId: f, defaultSubscriptionId: p } = c, [m, h] = s([]), [g, te] = s(null), [_, ne] = s("AUTO"), [v, y] = s(l), [b, x] = s(""), [S, C] = s(0), [re, w] = s("PERCENTAGE"), [T, E] = s(!1), [D, O] = s(0), [k, A] = s("idle"), [ie, j] = s(null), [M, N] = s(0), [ae, P] = s(0), [oe, F] = s("NONE"), [I, L] = s(null), [R, se] = s(u), [z, ce] = s(!1), [B, V] = s(null), [H, U] = s(p ?? null), [W] = t(), [G] = n(), [K, { data: q, loading: le }] = e(), [ue] = r(), J = o(() => m.reduce((e, t) => e + t.price * t.quantity, 0), [m]), Y = o(() => m.reduce((e, t) => e + (t.priceUSD ?? t.price) * t.quantity, 0), [m]), X = o(() => S ? Math.min(S, J) : 0, [J, S]), Z = o(() => {
6
+ function l(l = {}) {
7
+ let { currentUser: u } = e(), { defaultCurrency: d = "USD", defaultSaveCard: f = !1, upgradeFromSubscriptionId: p, downgradeFromSubscriptionId: m, defaultSubscriptionId: h } = l, [g, _] = c([]), [v, te] = c(null), [y, b] = c("AUTO"), [x, S] = c(d), [C, w] = c(""), [T, E] = c(0), [ne, D] = c("PERCENTAGE"), [O, k] = c(!1), [A, j] = c(0), [M, N] = c("idle"), [re, P] = c(null), [F, I] = c(0), [ie, L] = c(0), [ae, R] = c("NONE"), [z, oe] = c(null), [B, se] = c(f), [V, ce] = c(!1), [H, U] = c(null), [W, G] = c(h ?? null), [K] = n(), [le] = r(), [q, { data: ue, loading: de }] = t(), [fe] = i(), J = s(() => g.reduce((e, t) => e + t.price * t.quantity, 0), [g]), Y = s(() => g.reduce((e, t) => e + (t.priceUSD ?? t.price) * t.quantity, 0), [g]), X = s(() => T ? Math.min(T, J) : 0, [J, T]), Z = s(() => {
7
8
  let e = J - X;
8
- return (T ? Math.max(0, e - D) : e) + M;
9
+ return (O ? Math.max(0, e - A) : e) + F;
9
10
  }, [
10
11
  J,
11
12
  X,
12
- T,
13
- D,
14
- M
15
- ]), Q = g?.creditAmount ?? 0, de = o(() => Q >= Y * ee, [Q, Y]), fe = o(() => !m.some((e) => e.type === "CREDITS") && Q > 0, [m, Q]), pe = q?.convertCurrency?.amount ?? null, me = q?.convertCurrency?.exchangeRate ?? 1, he = pe ?? Z, ge = k === "loading" || le, _e = k === "processing";
16
- a(() => {
17
- if (_ !== "CREDITS" && m.length !== 0 && !m.every((e) => e.currency === v || e.type === "CREDITS") && Z > 0 && v !== "USD") {
18
- if (v === "INR" && M === 0 && J > 0) return;
19
- K({ variables: {
13
+ O,
14
+ A,
15
+ F
16
+ ]), Q = v?.creditAmount ?? 0, pe = s(() => Q >= Y * ee, [Q, Y]), me = s(() => !g.some((e) => e.type === "CREDITS") && Q > 0, [g, Q]), he = ue?.convertCurrency?.amount ?? null, ge = ue?.convertCurrency?.exchangeRate ?? 1, _e = he ?? Z, ve = M === "loading" || de, ye = M === "processing";
17
+ o(() => {
18
+ if (y !== "CREDITS" && g.length !== 0 && !g.every((e) => e.currency === x || e.type === "CREDITS") && Z > 0 && x !== "USD") {
19
+ if (x === "INR" && F === 0 && J > 0) return;
20
+ q({ variables: {
20
21
  amount: Z,
21
- toCurrency: v,
22
+ toCurrency: x,
22
23
  fromCurrency: "USD"
23
24
  } });
24
25
  }
25
26
  }, [
26
27
  Z,
27
- v,
28
- _,
29
- K,
30
- M,
28
+ x,
29
+ y,
30
+ q,
31
+ F,
31
32
  J,
32
- m
33
- ]), a(() => {
34
- if (!g || J <= 0) {
35
- N(0), P(0), F("NONE");
33
+ g
34
+ ]), o(() => {
35
+ if (!v || J <= 0) {
36
+ I(0), L(0), R("NONE");
36
37
  return;
37
38
  }
38
- if (_ === "CREDITS") {
39
- N(0), P(0), F("NONE");
39
+ if (y === "CREDITS") {
40
+ I(0), L(0), R("NONE");
40
41
  return;
41
42
  }
42
- if (v !== "INR") {
43
- N(0), P(0), F("NONE");
43
+ if (x !== "INR") {
44
+ I(0), L(0), R("NONE");
44
45
  return;
45
46
  }
46
47
  let e = J - X, t = .18;
47
- N(e * t), P(t), F("GST");
48
+ I(e * t), L(t), R("GST");
48
49
  }, [
49
- g,
50
+ v,
50
51
  J,
51
52
  X,
52
- v,
53
- _
53
+ x,
54
+ y
54
55
  ]);
55
- let ve = i((e) => {
56
- h((t) => e.type === "PLAN" ? t.find((e) => e.type === "PLAN") ? t.map((t) => t.type === "PLAN" ? {
56
+ let be = a((e) => {
57
+ _((t) => e.type === "PLAN" ? t.find((e) => e.type === "PLAN") ? t.map((t) => t.type === "PLAN" ? {
57
58
  ...e,
58
59
  quantity: 1
59
60
  } : t) : [...t, {
@@ -63,22 +64,22 @@ function c(c = {}) {
63
64
  ...t,
64
65
  quantity: t.quantity + e.quantity
65
66
  } : t) : [...t, e]);
66
- }, []), $ = i((e) => {
67
- h((t) => t.filter((t) => t.id !== e));
68
- }, []), ye = i((e, t) => {
67
+ }, []), $ = a((e) => {
68
+ _((t) => t.filter((t) => t.id !== e));
69
+ }, []), xe = a((e, t) => {
69
70
  if (t <= 0) {
70
71
  $(e);
71
72
  return;
72
73
  }
73
- h((n) => n.map((n) => n.id === e ? n.type === "PLAN" ? {
74
+ _((n) => n.map((n) => n.id === e ? n.type === "PLAN" ? {
74
75
  ...n,
75
76
  quantity: 1
76
77
  } : {
77
78
  ...n,
78
79
  quantity: t
79
80
  } : n));
80
- }, [$]), be = i((e, t, n) => {
81
- h((r) => r.map((r) => {
81
+ }, [$]), Se = a((e, t, n) => {
82
+ _((r) => r.map((r) => {
82
83
  if (r.id !== e) return r;
83
84
  let i = { price: t };
84
85
  return n && (i.currency = n), {
@@ -86,69 +87,69 @@ function c(c = {}) {
86
87
  ...i
87
88
  };
88
89
  }));
89
- }, []), xe = i(() => {
90
- h([]);
91
- }, []), Se = i((e) => {
92
- te(e), E(!1), O(0);
93
- }, []), Ce = i((e) => {
94
- y(e);
95
- let t = m.every((t) => t.currency === e || t.type === "CREDITS");
96
- Z > 0 && e !== "USD" && !t && K({ variables: {
90
+ }, []), Ce = a(() => {
91
+ _([]);
92
+ }, []), we = a((e) => {
93
+ te(e), k(!1), j(0);
94
+ }, []), Te = a((e) => {
95
+ S(e);
96
+ let t = g.every((t) => t.currency === e || t.type === "CREDITS");
97
+ Z > 0 && e !== "USD" && !t && q({ variables: {
97
98
  amount: Z,
98
99
  toCurrency: e,
99
100
  fromCurrency: "USD"
100
101
  } });
101
102
  }, [
102
103
  Z,
103
- K,
104
- m
104
+ q,
105
+ g
105
106
  ]);
106
107
  return {
107
- items: m,
108
- billingAccount: g,
109
- selectedProvider: _,
110
- selectedCurrency: v,
111
- promoCode: b,
112
- promoDiscount: S,
113
- promoDiscountType: re,
114
- useCredits: T,
115
- creditsToUse: D,
116
- checkoutState: k,
117
- error: ie,
118
- selectedPaymentMethodId: I,
119
- saveCard: R,
120
- autoRenew: z,
121
- autoRenewPaymentMethodId: B,
122
- selectedSubscriptionId: H,
108
+ items: g,
109
+ billingAccount: v,
110
+ selectedProvider: y,
111
+ selectedCurrency: x,
112
+ promoCode: C,
113
+ promoDiscount: T,
114
+ promoDiscountType: ne,
115
+ useCredits: O,
116
+ creditsToUse: A,
117
+ checkoutState: M,
118
+ error: re,
119
+ selectedPaymentMethodId: z,
120
+ saveCard: B,
121
+ autoRenew: V,
122
+ autoRenewPaymentMethodId: H,
123
+ selectedSubscriptionId: W,
123
124
  subtotal: J,
124
125
  subtotalUSD: Y,
125
126
  discountAmount: X,
126
- taxAmount: M,
127
- taxRate: ae,
128
- taxType: oe,
127
+ taxAmount: F,
128
+ taxRate: ie,
129
+ taxType: ae,
129
130
  total: Z,
130
- totalInSelectedCurrency: he,
131
+ totalInSelectedCurrency: _e,
131
132
  availableCredits: Q,
132
- hasEnoughCredits: de,
133
- canPayWithCredits: fe,
134
- isLoading: ge,
135
- isProcessing: _e,
133
+ hasEnoughCredits: pe,
134
+ canPayWithCredits: me,
135
+ isLoading: ve,
136
+ isProcessing: ye,
136
137
  isCalculatingTax: !1,
137
- conversionRate: me,
138
- convertedAmount: pe,
139
- addItem: ve,
138
+ conversionRate: ge,
139
+ convertedAmount: he,
140
+ addItem: be,
140
141
  removeItem: $,
141
- updateItemQuantity: ye,
142
- updateItemPrice: be,
143
- clearItems: xe,
144
- setBillingAccount: Se,
145
- setPaymentProvider: i((e) => {
146
- ne(e), e === "RAZORPAY" && v !== "INR" && y("INR");
147
- }, [v]),
148
- setCurrency: Ce,
149
- setPromoCode: x,
150
- validatePromoCode: i(async () => {
151
- if (!b.trim()) return {
142
+ updateItemQuantity: xe,
143
+ updateItemPrice: Se,
144
+ clearItems: Ce,
145
+ setBillingAccount: we,
146
+ setPaymentProvider: a((e) => {
147
+ b(e), e === "RAZORPAY" && x !== "INR" && S("INR");
148
+ }, [x]),
149
+ setCurrency: Te,
150
+ setPromoCode: w,
151
+ validatePromoCode: a(async () => {
152
+ if (!C.trim()) return {
152
153
  valid: !1,
153
154
  code: "",
154
155
  discountType: "PERCENTAGE",
@@ -156,78 +157,79 @@ function c(c = {}) {
156
157
  error: "Please enter a promo code"
157
158
  };
158
159
  try {
159
- A("loading");
160
- let { data: e, error: t } = await ue({ variables: { input: {
161
- code: b.trim().toUpperCase(),
162
- userId: g?.id || "unknown",
160
+ N("loading");
161
+ let { data: e, error: t } = await fe({ variables: { input: {
162
+ code: C.trim().toUpperCase(),
163
+ userId: u?.id ?? "",
164
+ userEmail: u?.email,
163
165
  amount: J,
164
- currency: v
166
+ currency: x
165
167
  } } });
166
- if (t || !e?.validateCoupon) return C(0), A("idle"), {
168
+ if (t || !e?.validateCoupon) return E(0), N("idle"), {
167
169
  valid: !1,
168
- code: b,
170
+ code: C,
169
171
  discountType: "PERCENTAGE",
170
172
  discountValue: 0,
171
173
  error: "Failed to validate coupon"
172
174
  };
173
175
  let n = e.validateCoupon;
174
- if (!n.valid) return C(0), A("idle"), {
176
+ if (!n.valid) return E(0), N("idle"), {
175
177
  valid: !1,
176
- code: b,
178
+ code: C,
177
179
  discountType: "PERCENTAGE",
178
180
  discountValue: 0,
179
181
  error: n.error || "Invalid coupon code"
180
182
  };
181
183
  let r = n.coupon;
182
- if (!r) return C(0), A("idle"), {
184
+ if (!r) return E(0), N("idle"), {
183
185
  valid: !1,
184
- code: b,
186
+ code: C,
185
187
  discountType: "PERCENTAGE",
186
188
  discountValue: 0,
187
189
  error: "Coupon data not found"
188
190
  };
189
191
  let i = n.discountAmount || 0, a = r.type === "FIXED_AMOUNT" ? "FIXED" : "PERCENTAGE";
190
- return C(i), w(a), A("idle"), {
192
+ return E(i), D(a), N("idle"), {
191
193
  valid: !0,
192
194
  code: r.code,
193
195
  discountType: a,
194
196
  discountValue: i
195
197
  };
196
198
  } catch {
197
- return C(0), A("idle"), {
199
+ return E(0), N("idle"), {
198
200
  valid: !1,
199
- code: b,
201
+ code: C,
200
202
  discountType: "PERCENTAGE",
201
203
  discountValue: 0,
202
204
  error: "Failed to validate coupon"
203
205
  };
204
206
  }
205
207
  }, [
206
- g?.id,
207
- b,
208
- v,
208
+ v?.id,
209
+ C,
210
+ x,
209
211
  J,
210
- ue
212
+ fe
211
213
  ]),
212
- clearPromoCode: i(() => {
213
- x(""), C(0), w("PERCENTAGE");
214
+ clearPromoCode: a(() => {
215
+ w(""), E(0), D("PERCENTAGE");
214
216
  }, []),
215
- setUseCredits: E,
216
- setCreditsToUse: i((e) => {
217
+ setUseCredits: k,
218
+ setCreditsToUse: a((e) => {
217
219
  let t = Math.min(e, Q, J - X);
218
- O(Math.max(0, t));
220
+ j(Math.max(0, t));
219
221
  }, [
220
222
  Q,
221
223
  J,
222
224
  X
223
225
  ]),
224
- setSelectedPaymentMethodId: L,
226
+ setSelectedPaymentMethodId: oe,
225
227
  setSaveCard: se,
226
228
  setAutoRenew: ce,
227
- setAutoRenewPaymentMethodId: V,
228
- setSelectedSubscriptionId: U,
229
- initiatePayment: i(async () => {
230
- if (!g) return {
229
+ setAutoRenewPaymentMethodId: U,
230
+ setSelectedSubscriptionId: G,
231
+ initiatePayment: a(async () => {
232
+ if (!v) return {
231
233
  success: !1,
232
234
  provider: "AUTO",
233
235
  subtotal: 0,
@@ -236,10 +238,10 @@ function c(c = {}) {
236
238
  total: 0,
237
239
  taxType: "NONE",
238
240
  jurisdiction: "UNKNOWN",
239
- currency: v,
241
+ currency: x,
240
242
  error: "Please select a billing account"
241
243
  };
242
- if (m.length === 0) return {
244
+ if (g.length === 0) return {
243
245
  success: !1,
244
246
  provider: "AUTO",
245
247
  subtotal: 0,
@@ -248,29 +250,29 @@ function c(c = {}) {
248
250
  total: 0,
249
251
  taxType: "NONE",
250
252
  jurisdiction: "UNKNOWN",
251
- currency: v,
253
+ currency: x,
252
254
  error: "No items in checkout"
253
255
  };
254
256
  try {
255
- A("processing"), j(null);
256
- let e = m[0], t = e.type, n = m.find((e) => e.metadata?.billingOrderId)?.metadata?.billingOrderId;
257
+ N("processing"), P(null);
258
+ let e = g[0], t = e.type, n = g.find((e) => e.metadata?.billingOrderId)?.metadata?.billingOrderId;
257
259
  n && (t = "ORDER");
258
- let r = J - X, i = _;
259
- if (i === "AUTO" && (i = v === "INR" ? "RAZORPAY" : "STRIPE"), i === "CREDITS") {
260
- let e = m.filter((e) => e.type === "ADDON"), t = m.find((e) => e.type === "PLAN"), { data: n } = await G({ variables: { input: {
261
- billingAccountId: g.id,
260
+ let r = J - X, i = y;
261
+ if (i === "AUTO" && (i = x === "INR" ? "RAZORPAY" : "STRIPE"), i === "CREDITS") {
262
+ let e = g.filter((e) => e.type === "ADDON"), t = g.find((e) => e.type === "PLAN"), { data: n } = await le({ variables: { input: {
263
+ billingAccountId: v.id,
262
264
  planId: t ? t.metadata?.planId || t.id : void 0,
263
265
  addOnIds: e.length > 0 ? e.map((e) => ({
264
266
  id: e.metadata?.addonId || e.id,
265
267
  quantity: e.quantity
266
268
  })) : void 0,
267
269
  isAnnual: t?.metadata?.duration === "yearly",
268
- upgradeFromSubscriptionId: d || void 0,
269
- downgradeFromSubscriptionId: f || void 0,
270
- subscriptionId: e.length > 0 ? H : void 0,
270
+ upgradeFromSubscriptionId: p || void 0,
271
+ downgradeFromSubscriptionId: m || void 0,
272
+ subscriptionId: e.length > 0 ? W : void 0,
271
273
  seatCount: t?.metadata?.seatCount
272
274
  } } }), i = n?.spendCredits;
273
- return i?.creditTransactionID ? (A("success"), {
275
+ return i?.creditTransactionID ? (N("success"), {
274
276
  success: !0,
275
277
  provider: "CREDITS",
276
278
  subtotal: r,
@@ -279,9 +281,9 @@ function c(c = {}) {
279
281
  total: r,
280
282
  taxType: "NONE",
281
283
  jurisdiction: "UNKNOWN",
282
- currency: v,
284
+ currency: x,
283
285
  orderId: i.creditTransactionID
284
- }) : (A("error"), j("Failed to process credit payment"), {
286
+ }) : (N("error"), P("Failed to process credit payment"), {
285
287
  success: !1,
286
288
  provider: "CREDITS",
287
289
  subtotal: r,
@@ -290,14 +292,14 @@ function c(c = {}) {
290
292
  total: r,
291
293
  taxType: "NONE",
292
294
  jurisdiction: "UNKNOWN",
293
- currency: v,
295
+ currency: x,
294
296
  error: "Failed to process credit payment"
295
297
  });
296
298
  }
297
- let a = m.filter((e) => e.type === "ADDON"), o = a.length > 0 ? a.map((e) => e.metadata?.addonId || e.id) : void 0, s = a.length > 0 ? a.map((e) => e.quantity) : void 0, ee = m.find((e) => e.type === "PLAN")?.metadata?.duration === "yearly", c = t === "PLAN" && z && (B || I) || void 0, { data: l } = await W({ variables: { input: {
298
- billingAccountId: g.id,
299
+ let a = g.filter((e) => e.type === "ADDON"), o = a.length > 0 ? a.map((e) => e.metadata?.addonId || e.id) : void 0, s = a.length > 0 ? a.map((e) => e.quantity) : void 0, c = g.find((e) => e.type === "PLAN")?.metadata?.duration === "yearly", ee = t === "PLAN" && V && (H || z) || void 0, { data: l } = await K({ variables: { input: {
300
+ billingAccountId: v.id,
299
301
  amount: r,
300
- currency: v,
302
+ currency: x,
301
303
  purchaseType: t,
302
304
  provider: i,
303
305
  orderId: n || void 0,
@@ -307,17 +309,17 @@ function c(c = {}) {
307
309
  quantity: t === "ADDON" && a.length === 1 && !n ? a[0].quantity : void 0,
308
310
  addonIds: t === "ADDON" && a.length > 1 && !n ? o : void 0,
309
311
  quantities: t === "ADDON" && a.length > 1 && !n ? s : void 0,
310
- subscriptionId: t === "ADDON" && !n ? H : void 0,
311
- paymentMethodId: I || void 0,
312
- saveCard: I ? void 0 : R || z,
313
- upgradeFromSubscriptionId: d || void 0,
314
- downgradeFromSubscriptionId: f || void 0,
315
- isAnnual: ee || void 0,
316
- promoCode: b || void 0,
317
- autoRenew: t === "PLAN" && z ? !0 : void 0,
318
- autoRenewPaymentMethodId: c
312
+ subscriptionId: t === "ADDON" && !n ? W : void 0,
313
+ paymentMethodId: z || void 0,
314
+ saveCard: z ? void 0 : B || V,
315
+ upgradeFromSubscriptionId: p || void 0,
316
+ downgradeFromSubscriptionId: m || void 0,
317
+ isAnnual: c || void 0,
318
+ promoCode: C || void 0,
319
+ autoRenew: t === "PLAN" && V ? !0 : void 0,
320
+ autoRenewPaymentMethodId: ee
319
321
  } } }), u = l?.initiatePayment;
320
- return u?.success ? (A("success"), u) : (A("error"), j(u?.error ?? "Payment initiation failed"), {
322
+ return u?.success ? (N("success"), u) : (N("error"), P(u?.error ?? "Payment initiation failed"), {
321
323
  success: !1,
322
324
  provider: i,
323
325
  subtotal: r,
@@ -326,12 +328,12 @@ function c(c = {}) {
326
328
  total: r,
327
329
  taxType: "NONE",
328
330
  jurisdiction: "UNKNOWN",
329
- currency: v,
331
+ currency: x,
330
332
  error: u?.error ?? "Payment initiation failed"
331
333
  });
332
334
  } catch (e) {
333
335
  let t = e instanceof Error ? e.message : "An error occurred";
334
- return A("error"), j(t), {
336
+ return N("error"), P(t), {
335
337
  success: !1,
336
338
  provider: "AUTO",
337
339
  subtotal: 0,
@@ -340,38 +342,38 @@ function c(c = {}) {
340
342
  total: 0,
341
343
  taxType: "NONE",
342
344
  jurisdiction: "UNKNOWN",
343
- currency: v,
345
+ currency: x,
344
346
  error: t
345
347
  };
346
348
  }
347
349
  }, [
348
- g,
349
- m,
350
350
  v,
351
- _,
351
+ g,
352
+ x,
353
+ y,
352
354
  J,
353
355
  X,
354
- b,
355
- I,
356
- R,
356
+ C,
357
357
  z,
358
358
  B,
359
+ V,
359
360
  H,
360
- d,
361
- f,
362
361
  W,
363
- G
362
+ p,
363
+ m,
364
+ K,
365
+ le
364
366
  ]),
365
- reset: i(() => {
366
- h([]), te(null), ne("AUTO"), y(l), x(""), C(0), w("PERCENTAGE"), E(!1), O(0), A("idle"), j(null), N(0), P(0), F("NONE"), L(null), se(u), ce(!1), V(null), U(p ?? null);
367
+ reset: a(() => {
368
+ _([]), te(null), b("AUTO"), S(d), w(""), E(0), D("PERCENTAGE"), k(!1), j(0), N("idle"), P(null), I(0), L(0), R("NONE"), oe(null), se(f), ce(!1), U(null), G(h ?? null);
367
369
  }, [
368
- l,
369
- u,
370
- p
370
+ d,
371
+ f,
372
+ h
371
373
  ])
372
374
  };
373
375
  }
374
376
  //#endregion
375
- export { c as useCheckout };
377
+ export { l as useCheckout };
376
378
 
377
379
  //# sourceMappingURL=useCheckout.js.map