@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.
- package/dist/billing/BillingAdminRoutes.js +100 -74
- package/dist/billing/BillingAdminRoutes.js.map +1 -1
- package/dist/billing/modules/billing/hooks/useRefunds.js.map +1 -1
- package/dist/billing/modules/billing/index.js +5 -4
- package/dist/billing/modules/billing/pages/PaymentMethodsPage.js +90 -87
- package/dist/billing/modules/billing/pages/PaymentMethodsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/RefundIssueLogsPage.js +240 -0
- package/dist/billing/modules/billing/pages/RefundIssueLogsPage.js.map +1 -0
- package/dist/billing/modules/billing/pages/RefundsPage.js +116 -108
- package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/index.js +1 -0
- package/dist/billing/modules/checkout/components/OrderSummary.js +22 -19
- package/dist/billing/modules/checkout/components/OrderSummary.js.map +1 -1
- package/dist/billing/modules/checkout/components/RazorpayPaymentButton.js.map +1 -1
- package/dist/billing/modules/checkout/hooks/useCheckout.js +174 -157
- package/dist/billing/modules/checkout/hooks/useCheckout.js.map +1 -1
- package/dist/billing/modules/checkout/pages/CheckoutPage.js +189 -182
- package/dist/billing/modules/checkout/pages/CheckoutPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +293 -274
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
- package/dist/billing/modules/dashboard/components/AddPaymentMethodModal.js +140 -250
- package/dist/billing/modules/dashboard/components/AddPaymentMethodModal.js.map +1 -1
- package/dist/billing/modules/earnings/api.js +79 -42
- package/dist/billing/modules/earnings/api.js.map +1 -1
- package/dist/billing/modules/earnings/index.js +4 -3
- package/dist/billing/modules/earnings/pages/DeveloperRevenueAdminPage.js +103 -310
- package/dist/billing/modules/earnings/pages/DeveloperRevenueAdminPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js +545 -0
- package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js.map +1 -0
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.js +246 -196
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/hooks/useSubscriptions.js +44 -28
- package/dist/billing/modules/subscriptions/hooks/useSubscriptions.js.map +1 -1
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js +317 -270
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js +153 -150
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js +1 -1
- package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js.map +1 -1
- package/dist/billing/modules/usage/hooks/useUsage.js +74 -48
- package/dist/billing/modules/usage/hooks/useUsage.js.map +1 -1
- package/dist/generated/global-operations.js +221 -183
- package/dist/generated/global-operations.js.map +1 -1
- package/dist/generated/global-types.js.map +1 -1
- package/dist/node_modules/sonner/dist/index.js +163 -0
- package/dist/node_modules/sonner/dist/index.js.map +1 -0
- 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:
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
]), Z =
|
|
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 (
|
|
18
|
-
if (
|
|
19
|
-
|
|
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:
|
|
22
|
-
fromCurrency:
|
|
38
|
+
toCurrency: x,
|
|
39
|
+
fromCurrency: G
|
|
23
40
|
} });
|
|
24
41
|
}
|
|
25
42
|
}, [
|
|
26
43
|
X,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
44
|
+
x,
|
|
45
|
+
y,
|
|
46
|
+
W,
|
|
47
|
+
F,
|
|
48
|
+
K,
|
|
49
|
+
g,
|
|
50
|
+
G
|
|
34
51
|
]), s(() => {
|
|
35
|
-
if (!
|
|
36
|
-
|
|
52
|
+
if (!v || K <= 0) {
|
|
53
|
+
I(0), L(0), R("NONE");
|
|
37
54
|
return;
|
|
38
55
|
}
|
|
39
|
-
if (
|
|
40
|
-
|
|
56
|
+
if (y === "CREDITS") {
|
|
57
|
+
I(0), L(0), R("NONE");
|
|
41
58
|
return;
|
|
42
59
|
}
|
|
43
|
-
if (
|
|
44
|
-
|
|
60
|
+
if (x !== "INR") {
|
|
61
|
+
I(0), L(0), R("NONE");
|
|
45
62
|
return;
|
|
46
63
|
}
|
|
47
|
-
let e =
|
|
48
|
-
|
|
64
|
+
let e = K - Y, t = .18;
|
|
65
|
+
I(e * t), L(t), R("GST");
|
|
49
66
|
}, [
|
|
50
|
-
|
|
51
|
-
|
|
67
|
+
v,
|
|
68
|
+
K,
|
|
52
69
|
Y,
|
|
53
|
-
|
|
54
|
-
|
|
70
|
+
x,
|
|
71
|
+
y
|
|
55
72
|
]);
|
|
56
|
-
let
|
|
57
|
-
|
|
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
|
-
|
|
69
|
-
}, []),
|
|
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
|
-
|
|
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
|
-
}, [$]),
|
|
82
|
-
|
|
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
|
-
}, []),
|
|
91
|
-
|
|
92
|
-
}, []),
|
|
93
|
-
|
|
94
|
-
}, []),
|
|
95
|
-
|
|
96
|
-
let t =
|
|
97
|
-
X > 0 &&
|
|
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:
|
|
117
|
+
fromCurrency: G
|
|
101
118
|
} });
|
|
102
119
|
}, [
|
|
103
120
|
X,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
121
|
+
W,
|
|
122
|
+
g,
|
|
123
|
+
G
|
|
107
124
|
]);
|
|
108
125
|
return {
|
|
109
|
-
items:
|
|
110
|
-
billingAccount:
|
|
111
|
-
selectedProvider:
|
|
112
|
-
selectedCurrency:
|
|
113
|
-
promoCode:
|
|
114
|
-
promoDiscount:
|
|
115
|
-
promoDiscountType:
|
|
116
|
-
useCredits:
|
|
117
|
-
creditsToUse:
|
|
118
|
-
checkoutState:
|
|
119
|
-
error:
|
|
120
|
-
selectedPaymentMethodId:
|
|
121
|
-
saveCard:
|
|
122
|
-
autoRenew:
|
|
123
|
-
autoRenewPaymentMethodId:
|
|
124
|
-
selectedSubscriptionId:
|
|
125
|
-
subtotal:
|
|
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:
|
|
129
|
-
taxRate:
|
|
130
|
-
taxType:
|
|
145
|
+
taxAmount: F,
|
|
146
|
+
taxRate: ie,
|
|
147
|
+
taxType: ae,
|
|
131
148
|
total: X,
|
|
132
|
-
totalInSelectedCurrency:
|
|
149
|
+
totalInSelectedCurrency: we,
|
|
133
150
|
availableCredits: Z,
|
|
134
151
|
creditsRequired: Q,
|
|
135
|
-
hasEnoughCredits:
|
|
136
|
-
canPayWithCredits:
|
|
137
|
-
isLoading:
|
|
138
|
-
isProcessing:
|
|
152
|
+
hasEnoughCredits: be,
|
|
153
|
+
canPayWithCredits: xe,
|
|
154
|
+
isLoading: Te,
|
|
155
|
+
isProcessing: Ee,
|
|
139
156
|
isCalculatingTax: !1,
|
|
140
|
-
conversionRate:
|
|
141
|
-
convertedAmount:
|
|
142
|
-
addItem:
|
|
157
|
+
conversionRate: Ce,
|
|
158
|
+
convertedAmount: Se,
|
|
159
|
+
addItem: De,
|
|
143
160
|
removeItem: $,
|
|
144
|
-
updateItemQuantity:
|
|
145
|
-
updateItemPrice:
|
|
146
|
-
clearItems:
|
|
147
|
-
setBillingAccount:
|
|
161
|
+
updateItemQuantity: Oe,
|
|
162
|
+
updateItemPrice: ke,
|
|
163
|
+
clearItems: Ae,
|
|
164
|
+
setBillingAccount: je,
|
|
148
165
|
setPaymentProvider: o((e) => {
|
|
149
|
-
|
|
150
|
-
}, [
|
|
151
|
-
setCurrency:
|
|
152
|
-
setPromoCode:
|
|
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 (!
|
|
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
|
-
|
|
163
|
-
let { data: e, error: t } = await
|
|
164
|
-
code:
|
|
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:
|
|
168
|
-
currency:
|
|
184
|
+
amount: K,
|
|
185
|
+
currency: x
|
|
169
186
|
} } });
|
|
170
|
-
if (t || !e?.validateCoupon) return
|
|
187
|
+
if (t || !e?.validateCoupon) return E(0), N("idle"), {
|
|
171
188
|
valid: !1,
|
|
172
|
-
code:
|
|
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
|
|
195
|
+
if (!n.valid) return E(0), N("idle"), {
|
|
179
196
|
valid: !1,
|
|
180
|
-
code:
|
|
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
|
|
203
|
+
if (!r) return E(0), N("idle"), {
|
|
187
204
|
valid: !1,
|
|
188
|
-
code:
|
|
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
|
|
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
|
|
218
|
+
return E(0), N("idle"), {
|
|
202
219
|
valid: !1,
|
|
203
|
-
code:
|
|
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
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
229
|
+
C,
|
|
230
|
+
x,
|
|
231
|
+
K,
|
|
232
|
+
ve
|
|
216
233
|
]),
|
|
217
234
|
clearPromoCode: o(() => {
|
|
218
|
-
|
|
235
|
+
w(""), E(0), D("PERCENTAGE");
|
|
219
236
|
}, []),
|
|
220
|
-
setUseCredits:
|
|
237
|
+
setUseCredits: k,
|
|
221
238
|
setCreditsToUse: o((e) => {
|
|
222
|
-
let t = Math.min(e, Z,
|
|
223
|
-
|
|
239
|
+
let t = Math.min(e, Z, K - Y);
|
|
240
|
+
j(Math.max(0, t));
|
|
224
241
|
}, [
|
|
225
242
|
Z,
|
|
226
|
-
|
|
243
|
+
K,
|
|
227
244
|
Y
|
|
228
245
|
]),
|
|
229
|
-
setSelectedPaymentMethodId:
|
|
230
|
-
setSaveCard:
|
|
231
|
-
setAutoRenew:
|
|
232
|
-
setAutoRenewPaymentMethodId:
|
|
233
|
-
setSelectedSubscriptionId:
|
|
246
|
+
setSelectedPaymentMethodId: oe,
|
|
247
|
+
setSaveCard: se,
|
|
248
|
+
setAutoRenew: ce,
|
|
249
|
+
setAutoRenewPaymentMethodId: le,
|
|
250
|
+
setSelectedSubscriptionId: ue,
|
|
234
251
|
initiatePayment: o(async () => {
|
|
235
|
-
if (!
|
|
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:
|
|
261
|
+
currency: x,
|
|
245
262
|
error: "Please select a billing account"
|
|
246
263
|
};
|
|
247
|
-
if (
|
|
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:
|
|
273
|
+
currency: x,
|
|
257
274
|
error: "No items in checkout"
|
|
258
275
|
};
|
|
259
276
|
try {
|
|
260
|
-
|
|
261
|
-
let e =
|
|
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 =
|
|
264
|
-
if (a === "AUTO" && (a =
|
|
265
|
-
let { data: e } = await
|
|
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:
|
|
268
|
-
currency:
|
|
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
|
|
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:
|
|
299
|
+
currency: x,
|
|
283
300
|
error: e
|
|
284
301
|
};
|
|
285
302
|
}
|
|
286
303
|
}
|
|
287
304
|
if (a === "CREDITS") {
|
|
288
|
-
let e =
|
|
289
|
-
billingAccountId:
|
|
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 ?
|
|
316
|
+
subscriptionId: e.length > 0 ? U : void 0,
|
|
300
317
|
seatCount: n?.metadata?.seatCount
|
|
301
318
|
} } }), o = a?.spendCredits;
|
|
302
|
-
return o?.creditTransactionID ? (
|
|
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:
|
|
328
|
+
currency: x,
|
|
312
329
|
orderId: o.creditTransactionID
|
|
313
|
-
}) : (
|
|
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:
|
|
339
|
+
currency: x,
|
|
323
340
|
error: "Failed to process credit payment"
|
|
324
341
|
});
|
|
325
342
|
}
|
|
326
|
-
let o =
|
|
327
|
-
billingAccountId:
|
|
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:
|
|
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 ?
|
|
340
|
-
paymentMethodId:
|
|
341
|
-
saveCard:
|
|
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:
|
|
346
|
-
autoRenew: t === "PLAN" &&
|
|
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 ? (
|
|
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:
|
|
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
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
417
|
+
ee
|
|
401
418
|
])
|
|
402
419
|
};
|
|
403
420
|
}
|