@txgw/payout-components 0.1.4 → 0.1.5
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/{component-beneficiary-form-Ckdv_c07.js → component-beneficiary-form-CMGaPrJT.js}
RENAMED
|
@@ -4,12 +4,12 @@ const O = "bankDetails";
|
|
|
4
4
|
async function b(r, t, s, u = 0) {
|
|
5
5
|
if (u < 0)
|
|
6
6
|
throw new Error("[payout-sdk] fetchWithAuth retries exceeded");
|
|
7
|
-
const { headers: n, authCode:
|
|
7
|
+
const { headers: n, authCode: f, domain: a, codeVerifier: _ } = s, e = localStorage.getItem("access_token");
|
|
8
8
|
if (e)
|
|
9
9
|
t.access_token = e;
|
|
10
10
|
else {
|
|
11
11
|
const o = await R(
|
|
12
|
-
|
|
12
|
+
f,
|
|
13
13
|
a,
|
|
14
14
|
_
|
|
15
15
|
);
|
|
@@ -19,7 +19,7 @@ async function b(r, t, s, u = 0) {
|
|
|
19
19
|
);
|
|
20
20
|
t.access_token = o.access_token, localStorage.setItem("access_token", o.access_token), localStorage.setItem("refresh_token", o.refresh_token);
|
|
21
21
|
}
|
|
22
|
-
const
|
|
22
|
+
const m = await fetch(r, {
|
|
23
23
|
...s,
|
|
24
24
|
body: JSON.stringify(t),
|
|
25
25
|
headers: {
|
|
@@ -27,8 +27,8 @@ async function b(r, t, s, u = 0) {
|
|
|
27
27
|
"Content-Type": "application/json"
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
if (
|
|
31
|
-
const o = await
|
|
30
|
+
if (m.status === 400) {
|
|
31
|
+
const o = await m.json();
|
|
32
32
|
if (o.name != "INTERNAL_ERROR")
|
|
33
33
|
throw E.error(`${o.name}: ${o.message}`), new Error(`[payout-sdk] ${o.name}: ${o.message}`);
|
|
34
34
|
const h = localStorage.getItem("refresh_token");
|
|
@@ -46,7 +46,7 @@ async function b(r, t, s, u = 0) {
|
|
|
46
46
|
), localStorage.setItem("access_token", d.access_token), b(r, t, s, --u);
|
|
47
47
|
}
|
|
48
48
|
const l = await R(
|
|
49
|
-
|
|
49
|
+
f,
|
|
50
50
|
a,
|
|
51
51
|
_
|
|
52
52
|
);
|
|
@@ -56,7 +56,7 @@ async function b(r, t, s, u = 0) {
|
|
|
56
56
|
);
|
|
57
57
|
return localStorage.setItem("refresh_token", l.refresh_token), localStorage.setItem("access_token", l.access_token), b(r, t, s, --u);
|
|
58
58
|
}
|
|
59
|
-
return
|
|
59
|
+
return m;
|
|
60
60
|
}
|
|
61
61
|
async function R(r, t, s) {
|
|
62
62
|
const u = {
|
|
@@ -95,7 +95,7 @@ async function A(r, t, s) {
|
|
|
95
95
|
}
|
|
96
96
|
)).json()).country_infos || [];
|
|
97
97
|
}
|
|
98
|
-
async function B({ inputRegionCode: r, inputPayoutType: t, inputCurrency: s }, u, n,
|
|
98
|
+
async function B({ inputRegionCode: r, inputPayoutType: t, inputCurrency: s }, u, n, f, a) {
|
|
99
99
|
const e = await (await b(
|
|
100
100
|
"/v1/payout/beneficiary/token/paymentmethodinfos",
|
|
101
101
|
{
|
|
@@ -105,35 +105,35 @@ async function B({ inputRegionCode: r, inputPayoutType: t, inputCurrency: s }, u
|
|
|
105
105
|
method: "POST",
|
|
106
106
|
authCode: u,
|
|
107
107
|
domain: n,
|
|
108
|
-
codeVerifier:
|
|
108
|
+
codeVerifier: f
|
|
109
109
|
}
|
|
110
|
-
)).json(),
|
|
110
|
+
)).json(), m = [];
|
|
111
111
|
for (const o of Object.values(e.countries)) {
|
|
112
112
|
const h = o.payoutTypes?.[t]?.currencies;
|
|
113
113
|
if (h)
|
|
114
114
|
for (const [l, d] of Object.entries(h))
|
|
115
|
-
l === s &&
|
|
115
|
+
l === s && m.push(d);
|
|
116
116
|
}
|
|
117
|
-
if (
|
|
117
|
+
if (m.length !== 0)
|
|
118
118
|
return {
|
|
119
119
|
type: "list-select",
|
|
120
120
|
name: "inputPaymentMethod",
|
|
121
121
|
label: "Transfer method",
|
|
122
|
-
options:
|
|
122
|
+
options: m.map((o) => ({
|
|
123
123
|
value: o.payment_method,
|
|
124
124
|
body: /* @__PURE__ */ g.jsxs("div", { children: [
|
|
125
125
|
/* @__PURE__ */ g.jsx("span", { className: "flex font-bold", children: o.display_name }),
|
|
126
126
|
/* @__PURE__ */ g.jsx("span", { className: "flex mt-1", children: o.description })
|
|
127
127
|
] })
|
|
128
128
|
})),
|
|
129
|
-
value: a?.
|
|
129
|
+
value: a?.payment_method
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
132
|
async function N({
|
|
133
133
|
inputRegionCode: r,
|
|
134
134
|
inputCurrency: t,
|
|
135
135
|
inputPaymentMethod: s
|
|
136
|
-
}, u, n,
|
|
136
|
+
}, u, n, f) {
|
|
137
137
|
const e = await (await b(
|
|
138
138
|
"/v1/payout/beneficiary/form/schema/token/query",
|
|
139
139
|
{
|
|
@@ -148,7 +148,7 @@ async function N({
|
|
|
148
148
|
method: "POST",
|
|
149
149
|
authCode: u,
|
|
150
150
|
domain: n,
|
|
151
|
-
codeVerifier:
|
|
151
|
+
codeVerifier: f
|
|
152
152
|
}
|
|
153
153
|
)).json();
|
|
154
154
|
return JSON.parse(
|
|
@@ -161,11 +161,11 @@ function q({
|
|
|
161
161
|
codeVerifier: s,
|
|
162
162
|
emitter: u,
|
|
163
163
|
defaultValues: n,
|
|
164
|
-
customizations:
|
|
164
|
+
customizations: f
|
|
165
165
|
}) {
|
|
166
|
-
const [a, _] = p.useState([]), [e,
|
|
166
|
+
const [a, _] = p.useState([]), [e, m] = p.useState(), [o, h] = p.useState(), [l, d] = p.useState(), C = p.useMemo(() => !f?.layout?.find(
|
|
167
167
|
(c) => c.name === O
|
|
168
|
-
)?.hidden, [
|
|
168
|
+
)?.hidden, [f?.layout]), S = p.useCallback(
|
|
169
169
|
(i) => {
|
|
170
170
|
const c = i.body.findIndex(
|
|
171
171
|
(k) => k.type === "form"
|
|
@@ -235,9 +235,9 @@ function q({
|
|
|
235
235
|
]), p.useEffect(() => {
|
|
236
236
|
e?.inputCurrency || h(void 0);
|
|
237
237
|
}, [e?.inputCurrency]), p.useEffect(() => {
|
|
238
|
-
n &&
|
|
238
|
+
n && m({
|
|
239
239
|
inputPayoutType: n.payout_type || "B2P",
|
|
240
|
-
inputPaymentMethod: n.
|
|
240
|
+
inputPaymentMethod: n.payment_method,
|
|
241
241
|
inputRegionCode: n.region_code,
|
|
242
242
|
inputCurrency: n.currency
|
|
243
243
|
});
|
|
@@ -256,7 +256,7 @@ function q({
|
|
|
256
256
|
title: "Bank Details",
|
|
257
257
|
submitText: "",
|
|
258
258
|
onChange: (i) => {
|
|
259
|
-
|
|
259
|
+
m(i);
|
|
260
260
|
},
|
|
261
261
|
body: [
|
|
262
262
|
{
|
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ declare interface BeneficiaryFormDefaultValues {
|
|
|
22
22
|
region_code?: string;
|
|
23
23
|
payout_type?: PayoutType;
|
|
24
24
|
currency?: string;
|
|
25
|
-
|
|
25
|
+
payment_method?: string;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
declare type BeneficiaryFormOptions<T extends keyof typeof ElementsMap> = Omit<BeneficiaryFormProps, keyof BaseProps<T>>;
|
package/dist/index.js
CHANGED