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