@burdenoff/microfe-billing 2026.530.3 → 2026.531.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.
- package/dist/billing/BillingAdminRoutes.js +87 -61
- package/dist/billing/BillingAdminRoutes.js.map +1 -1
- package/dist/billing/BillingRoot.js +81 -73
- package/dist/billing/BillingRoot.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonDetailPage.js +85 -84
- package/dist/billing/modules/addons/pages/AddonDetailPage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonEditPage.js +176 -195
- package/dist/billing/modules/addons/pages/AddonEditPage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonsBrowsePage.js +173 -172
- package/dist/billing/modules/addons/pages/AddonsBrowsePage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonsListPage.js +216 -215
- package/dist/billing/modules/addons/pages/AddonsListPage.js.map +1 -1
- package/dist/billing/modules/checkout/hooks/useCheckout.js +165 -161
- package/dist/billing/modules/checkout/hooks/useCheckout.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js +344 -167
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js.map +1 -1
- package/dist/billing/modules/dashboard/components/RecommendedAddonsSection.js +79 -78
- package/dist/billing/modules/dashboard/components/RecommendedAddonsSection.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanEditPage.js +29 -20
- package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
- package/dist/billing/modules/promotions/index.js +4 -0
- package/dist/billing/modules/promotions/pages/CreatePromotionPage.js +289 -0
- package/dist/billing/modules/promotions/pages/CreatePromotionPage.js.map +1 -0
- package/dist/billing/modules/promotions/pages/PromotionsListPage.js +168 -0
- package/dist/billing/modules/promotions/pages/PromotionsListPage.js.map +1 -0
- package/dist/billing/modules/promotions/pages/index.js +2 -0
- package/dist/generated/global-operations.js +182 -75
- package/dist/generated/global-operations.js.map +1 -1
- package/dist/generated/global-types.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,59 +1,60 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
|
|
6
|
-
let { defaultCurrency:
|
|
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 (
|
|
9
|
+
return (O ? Math.max(0, e - A) : e) + F;
|
|
9
10
|
}, [
|
|
10
11
|
J,
|
|
11
12
|
X,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
]), Q =
|
|
16
|
-
|
|
17
|
-
if (
|
|
18
|
-
if (
|
|
19
|
-
|
|
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:
|
|
22
|
+
toCurrency: x,
|
|
22
23
|
fromCurrency: "USD"
|
|
23
24
|
} });
|
|
24
25
|
}
|
|
25
26
|
}, [
|
|
26
27
|
Z,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
x,
|
|
29
|
+
y,
|
|
30
|
+
q,
|
|
31
|
+
F,
|
|
31
32
|
J,
|
|
32
|
-
|
|
33
|
-
]),
|
|
34
|
-
if (!
|
|
35
|
-
|
|
33
|
+
g
|
|
34
|
+
]), o(() => {
|
|
35
|
+
if (!v || J <= 0) {
|
|
36
|
+
I(0), L(0), R("NONE");
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
38
|
-
if (
|
|
39
|
-
|
|
39
|
+
if (y === "CREDITS") {
|
|
40
|
+
I(0), L(0), R("NONE");
|
|
40
41
|
return;
|
|
41
42
|
}
|
|
42
|
-
if (
|
|
43
|
-
|
|
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
|
-
|
|
48
|
+
I(e * t), L(t), R("GST");
|
|
48
49
|
}, [
|
|
49
|
-
|
|
50
|
+
v,
|
|
50
51
|
J,
|
|
51
52
|
X,
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
x,
|
|
54
|
+
y
|
|
54
55
|
]);
|
|
55
|
-
let
|
|
56
|
-
|
|
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
|
-
}, []), $ =
|
|
67
|
-
|
|
68
|
-
}, []),
|
|
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
|
-
|
|
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
|
-
}, [$]),
|
|
81
|
-
|
|
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
|
-
}, []),
|
|
90
|
-
|
|
91
|
-
}, []),
|
|
92
|
-
te(e),
|
|
93
|
-
}, []),
|
|
94
|
-
|
|
95
|
-
let t =
|
|
96
|
-
Z > 0 && e !== "USD" && !t &&
|
|
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
|
-
|
|
104
|
-
|
|
104
|
+
q,
|
|
105
|
+
g
|
|
105
106
|
]);
|
|
106
107
|
return {
|
|
107
|
-
items:
|
|
108
|
-
billingAccount:
|
|
109
|
-
selectedProvider:
|
|
110
|
-
selectedCurrency:
|
|
111
|
-
promoCode:
|
|
112
|
-
promoDiscount:
|
|
113
|
-
promoDiscountType:
|
|
114
|
-
useCredits:
|
|
115
|
-
creditsToUse:
|
|
116
|
-
checkoutState:
|
|
117
|
-
error:
|
|
118
|
-
selectedPaymentMethodId:
|
|
119
|
-
saveCard:
|
|
120
|
-
autoRenew:
|
|
121
|
-
autoRenewPaymentMethodId:
|
|
122
|
-
selectedSubscriptionId:
|
|
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:
|
|
127
|
-
taxRate:
|
|
128
|
-
taxType:
|
|
127
|
+
taxAmount: F,
|
|
128
|
+
taxRate: ie,
|
|
129
|
+
taxType: ae,
|
|
129
130
|
total: Z,
|
|
130
|
-
totalInSelectedCurrency:
|
|
131
|
+
totalInSelectedCurrency: _e,
|
|
131
132
|
availableCredits: Q,
|
|
132
|
-
hasEnoughCredits:
|
|
133
|
-
canPayWithCredits:
|
|
134
|
-
isLoading:
|
|
135
|
-
isProcessing:
|
|
133
|
+
hasEnoughCredits: pe,
|
|
134
|
+
canPayWithCredits: me,
|
|
135
|
+
isLoading: ve,
|
|
136
|
+
isProcessing: ye,
|
|
136
137
|
isCalculatingTax: !1,
|
|
137
|
-
conversionRate:
|
|
138
|
-
convertedAmount:
|
|
139
|
-
addItem:
|
|
138
|
+
conversionRate: ge,
|
|
139
|
+
convertedAmount: he,
|
|
140
|
+
addItem: be,
|
|
140
141
|
removeItem: $,
|
|
141
|
-
updateItemQuantity:
|
|
142
|
-
updateItemPrice:
|
|
143
|
-
clearItems:
|
|
144
|
-
setBillingAccount:
|
|
145
|
-
setPaymentProvider:
|
|
146
|
-
|
|
147
|
-
}, [
|
|
148
|
-
setCurrency:
|
|
149
|
-
setPromoCode:
|
|
150
|
-
validatePromoCode:
|
|
151
|
-
if (!
|
|
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,81 @@ function c(c = {}) {
|
|
|
156
157
|
error: "Please enter a promo code"
|
|
157
158
|
};
|
|
158
159
|
try {
|
|
159
|
-
|
|
160
|
-
let { data: e, error: t } = await
|
|
161
|
-
code:
|
|
162
|
-
userId:
|
|
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:
|
|
166
|
+
currency: x
|
|
165
167
|
} } });
|
|
166
|
-
if (t || !e?.validateCoupon) return
|
|
168
|
+
if (t || !e?.validateCoupon) return E(0), N("idle"), {
|
|
167
169
|
valid: !1,
|
|
168
|
-
code:
|
|
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
|
|
176
|
+
if (!n.valid) return E(0), N("idle"), {
|
|
175
177
|
valid: !1,
|
|
176
|
-
code:
|
|
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
|
|
184
|
+
if (!r) return E(0), N("idle"), {
|
|
183
185
|
valid: !1,
|
|
184
|
-
code:
|
|
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
|
|
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
|
|
199
|
+
return E(0), N("idle"), {
|
|
198
200
|
valid: !1,
|
|
199
|
-
code:
|
|
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
|
-
|
|
207
|
-
|
|
208
|
-
|
|
208
|
+
v?.id,
|
|
209
|
+
u?.email,
|
|
210
|
+
u?.id,
|
|
211
|
+
C,
|
|
212
|
+
x,
|
|
209
213
|
J,
|
|
210
|
-
|
|
214
|
+
fe
|
|
211
215
|
]),
|
|
212
|
-
clearPromoCode:
|
|
213
|
-
|
|
216
|
+
clearPromoCode: a(() => {
|
|
217
|
+
w(""), E(0), D("PERCENTAGE");
|
|
214
218
|
}, []),
|
|
215
|
-
setUseCredits:
|
|
216
|
-
setCreditsToUse:
|
|
219
|
+
setUseCredits: k,
|
|
220
|
+
setCreditsToUse: a((e) => {
|
|
217
221
|
let t = Math.min(e, Q, J - X);
|
|
218
|
-
|
|
222
|
+
j(Math.max(0, t));
|
|
219
223
|
}, [
|
|
220
224
|
Q,
|
|
221
225
|
J,
|
|
222
226
|
X
|
|
223
227
|
]),
|
|
224
|
-
setSelectedPaymentMethodId:
|
|
228
|
+
setSelectedPaymentMethodId: oe,
|
|
225
229
|
setSaveCard: se,
|
|
226
230
|
setAutoRenew: ce,
|
|
227
|
-
setAutoRenewPaymentMethodId:
|
|
228
|
-
setSelectedSubscriptionId:
|
|
229
|
-
initiatePayment:
|
|
230
|
-
if (!
|
|
231
|
+
setAutoRenewPaymentMethodId: U,
|
|
232
|
+
setSelectedSubscriptionId: G,
|
|
233
|
+
initiatePayment: a(async () => {
|
|
234
|
+
if (!v) return {
|
|
231
235
|
success: !1,
|
|
232
236
|
provider: "AUTO",
|
|
233
237
|
subtotal: 0,
|
|
@@ -236,10 +240,10 @@ function c(c = {}) {
|
|
|
236
240
|
total: 0,
|
|
237
241
|
taxType: "NONE",
|
|
238
242
|
jurisdiction: "UNKNOWN",
|
|
239
|
-
currency:
|
|
243
|
+
currency: x,
|
|
240
244
|
error: "Please select a billing account"
|
|
241
245
|
};
|
|
242
|
-
if (
|
|
246
|
+
if (g.length === 0) return {
|
|
243
247
|
success: !1,
|
|
244
248
|
provider: "AUTO",
|
|
245
249
|
subtotal: 0,
|
|
@@ -248,29 +252,29 @@ function c(c = {}) {
|
|
|
248
252
|
total: 0,
|
|
249
253
|
taxType: "NONE",
|
|
250
254
|
jurisdiction: "UNKNOWN",
|
|
251
|
-
currency:
|
|
255
|
+
currency: x,
|
|
252
256
|
error: "No items in checkout"
|
|
253
257
|
};
|
|
254
258
|
try {
|
|
255
|
-
|
|
256
|
-
let e =
|
|
259
|
+
N("processing"), P(null);
|
|
260
|
+
let e = g[0], t = e.type, n = g.find((e) => e.metadata?.billingOrderId)?.metadata?.billingOrderId;
|
|
257
261
|
n && (t = "ORDER");
|
|
258
|
-
let r = J - X, i =
|
|
259
|
-
if (i === "AUTO" && (i =
|
|
260
|
-
let e =
|
|
261
|
-
billingAccountId:
|
|
262
|
+
let r = J - X, i = y;
|
|
263
|
+
if (i === "AUTO" && (i = x === "INR" ? "RAZORPAY" : "STRIPE"), i === "CREDITS") {
|
|
264
|
+
let e = g.filter((e) => e.type === "ADDON"), t = g.find((e) => e.type === "PLAN"), { data: n } = await le({ variables: { input: {
|
|
265
|
+
billingAccountId: v.id,
|
|
262
266
|
planId: t ? t.metadata?.planId || t.id : void 0,
|
|
263
267
|
addOnIds: e.length > 0 ? e.map((e) => ({
|
|
264
268
|
id: e.metadata?.addonId || e.id,
|
|
265
269
|
quantity: e.quantity
|
|
266
270
|
})) : void 0,
|
|
267
271
|
isAnnual: t?.metadata?.duration === "yearly",
|
|
268
|
-
upgradeFromSubscriptionId:
|
|
269
|
-
downgradeFromSubscriptionId:
|
|
270
|
-
subscriptionId: e.length > 0 ?
|
|
272
|
+
upgradeFromSubscriptionId: p || void 0,
|
|
273
|
+
downgradeFromSubscriptionId: m || void 0,
|
|
274
|
+
subscriptionId: e.length > 0 ? W : void 0,
|
|
271
275
|
seatCount: t?.metadata?.seatCount
|
|
272
276
|
} } }), i = n?.spendCredits;
|
|
273
|
-
return i?.creditTransactionID ? (
|
|
277
|
+
return i?.creditTransactionID ? (N("success"), {
|
|
274
278
|
success: !0,
|
|
275
279
|
provider: "CREDITS",
|
|
276
280
|
subtotal: r,
|
|
@@ -279,9 +283,9 @@ function c(c = {}) {
|
|
|
279
283
|
total: r,
|
|
280
284
|
taxType: "NONE",
|
|
281
285
|
jurisdiction: "UNKNOWN",
|
|
282
|
-
currency:
|
|
286
|
+
currency: x,
|
|
283
287
|
orderId: i.creditTransactionID
|
|
284
|
-
}) : (
|
|
288
|
+
}) : (N("error"), P("Failed to process credit payment"), {
|
|
285
289
|
success: !1,
|
|
286
290
|
provider: "CREDITS",
|
|
287
291
|
subtotal: r,
|
|
@@ -290,14 +294,14 @@ function c(c = {}) {
|
|
|
290
294
|
total: r,
|
|
291
295
|
taxType: "NONE",
|
|
292
296
|
jurisdiction: "UNKNOWN",
|
|
293
|
-
currency:
|
|
297
|
+
currency: x,
|
|
294
298
|
error: "Failed to process credit payment"
|
|
295
299
|
});
|
|
296
300
|
}
|
|
297
|
-
let a =
|
|
298
|
-
billingAccountId:
|
|
301
|
+
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: {
|
|
302
|
+
billingAccountId: v.id,
|
|
299
303
|
amount: r,
|
|
300
|
-
currency:
|
|
304
|
+
currency: x,
|
|
301
305
|
purchaseType: t,
|
|
302
306
|
provider: i,
|
|
303
307
|
orderId: n || void 0,
|
|
@@ -307,17 +311,17 @@ function c(c = {}) {
|
|
|
307
311
|
quantity: t === "ADDON" && a.length === 1 && !n ? a[0].quantity : void 0,
|
|
308
312
|
addonIds: t === "ADDON" && a.length > 1 && !n ? o : void 0,
|
|
309
313
|
quantities: t === "ADDON" && a.length > 1 && !n ? s : void 0,
|
|
310
|
-
subscriptionId: t === "ADDON" && !n ?
|
|
311
|
-
paymentMethodId:
|
|
312
|
-
saveCard:
|
|
313
|
-
upgradeFromSubscriptionId:
|
|
314
|
-
downgradeFromSubscriptionId:
|
|
315
|
-
isAnnual:
|
|
316
|
-
promoCode:
|
|
317
|
-
autoRenew: t === "PLAN" &&
|
|
318
|
-
autoRenewPaymentMethodId:
|
|
314
|
+
subscriptionId: t === "ADDON" && !n ? W : void 0,
|
|
315
|
+
paymentMethodId: z || void 0,
|
|
316
|
+
saveCard: z ? void 0 : B || V,
|
|
317
|
+
upgradeFromSubscriptionId: p || void 0,
|
|
318
|
+
downgradeFromSubscriptionId: m || void 0,
|
|
319
|
+
isAnnual: c || void 0,
|
|
320
|
+
promoCode: C || void 0,
|
|
321
|
+
autoRenew: t === "PLAN" && V ? !0 : void 0,
|
|
322
|
+
autoRenewPaymentMethodId: ee
|
|
319
323
|
} } }), u = l?.initiatePayment;
|
|
320
|
-
return u?.success ? (
|
|
324
|
+
return u?.success ? (N("success"), u) : (N("error"), P(u?.error ?? "Payment initiation failed"), {
|
|
321
325
|
success: !1,
|
|
322
326
|
provider: i,
|
|
323
327
|
subtotal: r,
|
|
@@ -326,12 +330,12 @@ function c(c = {}) {
|
|
|
326
330
|
total: r,
|
|
327
331
|
taxType: "NONE",
|
|
328
332
|
jurisdiction: "UNKNOWN",
|
|
329
|
-
currency:
|
|
333
|
+
currency: x,
|
|
330
334
|
error: u?.error ?? "Payment initiation failed"
|
|
331
335
|
});
|
|
332
336
|
} catch (e) {
|
|
333
337
|
let t = e instanceof Error ? e.message : "An error occurred";
|
|
334
|
-
return
|
|
338
|
+
return N("error"), P(t), {
|
|
335
339
|
success: !1,
|
|
336
340
|
provider: "AUTO",
|
|
337
341
|
subtotal: 0,
|
|
@@ -340,38 +344,38 @@ function c(c = {}) {
|
|
|
340
344
|
total: 0,
|
|
341
345
|
taxType: "NONE",
|
|
342
346
|
jurisdiction: "UNKNOWN",
|
|
343
|
-
currency:
|
|
347
|
+
currency: x,
|
|
344
348
|
error: t
|
|
345
349
|
};
|
|
346
350
|
}
|
|
347
351
|
}, [
|
|
348
|
-
g,
|
|
349
|
-
m,
|
|
350
352
|
v,
|
|
351
|
-
|
|
353
|
+
g,
|
|
354
|
+
x,
|
|
355
|
+
y,
|
|
352
356
|
J,
|
|
353
357
|
X,
|
|
354
|
-
|
|
355
|
-
I,
|
|
356
|
-
R,
|
|
358
|
+
C,
|
|
357
359
|
z,
|
|
358
360
|
B,
|
|
361
|
+
V,
|
|
359
362
|
H,
|
|
360
|
-
d,
|
|
361
|
-
f,
|
|
362
363
|
W,
|
|
363
|
-
|
|
364
|
+
p,
|
|
365
|
+
m,
|
|
366
|
+
K,
|
|
367
|
+
le
|
|
364
368
|
]),
|
|
365
|
-
reset:
|
|
366
|
-
|
|
369
|
+
reset: a(() => {
|
|
370
|
+
_([]), 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
371
|
}, [
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
372
|
+
d,
|
|
373
|
+
f,
|
|
374
|
+
h
|
|
371
375
|
])
|
|
372
376
|
};
|
|
373
377
|
}
|
|
374
378
|
//#endregion
|
|
375
|
-
export {
|
|
379
|
+
export { l as useCheckout };
|
|
376
380
|
|
|
377
381
|
//# sourceMappingURL=useCheckout.js.map
|