@burdenoff/microfe-billing 2026.901.1 → 2026.903.1

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