@txgw/payout-components 0.1.6 → 0.2.0
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/{amis-bclZq1Od.js → amis-CjYQbrSm.js} +26 -26
- package/dist/component-beneficiary-form-ZOQLPYQM.js +344 -0
- package/dist/index.d.ts +5 -6
- package/dist/index.js +7 -7
- package/dist/{vendor-C7cpyYhi.js → vendor-fKhExfo_.js} +61941 -60584
- package/package.json +2 -1
- package/dist/component-beneficiary-form-BFa6ZStw.js +0 -326
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as __extends, l as __assign, n as __values, o as hooks, u as upperFirst, q as padStart, r as capitalize, t as escape, v as truncate, w as uniqBy, x as uniqWith, y as isEqual, z as get, A as isPlainObject, B as __awaiter, C as __generator, D as __read, E as __spreadArray, F as toFixed, G as groupBy, H as uniq, I as transform, J as template, K as isEmpty$2, L as startsWith, M as endsWith, N as isString, O as isObject$1, P as qs, Q as merge, S as isNaN$1, T as matchSorter, U as isNumber, V as isObservableArray, W as isObservable, X as compile, Y as last, Z as isAlive, $ as find, a0 as findIndex$1, a1 as types, a2 as getEnv, a3 as destroy, a4 as React__default, a5 as observer, a6 as reactDomExports, a7 as __decorate, a8 as observable, a9 as __metadata, aa as action, ab as reactExports, ac as cx, ad as autorun, ae as __rest, af as omit, ag as cloneDeep, ah as memoize, ai as findLastIndex, aj as flow, ak as debounce, al as throttle, am as flatten, an as pick, ao as toPairs, ap as getParent, aq as sortBy, ar as FileSaver_minExports, as as isEqualWith, at as reaction, au as addDisposer, av as setLivelinessChecking, aw as hoistNonReactStatic, ax as values, ay as InView, az as map, aA as kebabCase, aB as ReactDOM, aC as useRootClose, aD as Portal, aE as chunk, aF as mapValues, aG as camelCase, aH as uncontrollable$1, aI as toJS, aJ as CSSTransition, aK as difference$1, aL as reactIsExports, aM as keycode, aN as ENTERING, aO as ENTERED, aP as EXITING, aQ as Transition, aR as cjsExports, aS as EXITED, aT as isFunction, aU as Downshift$1, aV as extend, aW as each, aX as Sortable, aY as propTypesExports, aZ as comparer, a_ as range$1, a$ as keys, b0 as index$2, b1 as forEach, b2 as times, b3 as isInteger, b4 as intersectionWith, b5 as unionWith, b6 as includes, b7 as getMiniDecimal, b8 as InputNumber$1, b9 as getNumberPrecision, ba as chain, bb as intersection, bc as useForm, bd as FormProvider, be as Controller$1, bf as intersectionBy, bg as compact, bh as Circle, bi as useFieldArray, bj as useFormContext, bk as useFormState, bl as Draggable, bm as Item$1, bn as SubMenu$2, bo as MenuItemGroup, bp as Divider$2, bq as ExportMenu, br as SmoothSignature, bs as xor, bt as hotkeys, bu as getSnapshot, bv as observer$1, bw as useInView, bx as Dropzone, by as isNil, bz as accepts, bA as ErrorCode, bB as tinymce, bC as Froala, bD as omitBy, bE as pickBy, bF as partition, bG as inRange, bH as clone, bI as union, bJ as cjsExports$1, bK as assign, bL as libExports, bM as num2str, bN as update, bO as d, bP as SketchPicker, bQ as GithubPicker, bR as JsBarcode, bS as markdownIt, bT as libExports$1, bU as Document, bV as Page$2, bW as __webpack_exports__GlobalWorkerOptions } from "./vendor-
|
|
1
|
+
import { _ as __extends, l as __assign, n as __values, o as hooks, u as upperFirst, q as padStart, r as capitalize, t as escape, v as truncate, w as uniqBy, x as uniqWith, y as isEqual, z as get, A as isPlainObject, B as __awaiter, C as __generator, D as __read, E as __spreadArray, F as toFixed, G as groupBy, H as uniq, I as transform, J as template, K as isEmpty$2, L as startsWith, M as endsWith, N as isString, O as isObject$1, P as qs, Q as merge, S as isNaN$1, T as matchSorter, U as isNumber, V as isObservableArray, W as isObservable, X as compile, Y as last, Z as isAlive, $ as find, a0 as findIndex$1, a1 as types, a2 as getEnv, a3 as destroy, a4 as React__default, a5 as observer, a6 as reactDomExports, a7 as __decorate, a8 as observable, a9 as __metadata, aa as action, ab as reactExports, ac as cx, ad as autorun, ae as __rest, af as omit, ag as cloneDeep, ah as memoize, ai as findLastIndex, aj as flow, ak as debounce, al as throttle, am as flatten, an as pick, ao as toPairs, ap as getParent, aq as sortBy, ar as FileSaver_minExports, as as isEqualWith, at as reaction, au as addDisposer, av as setLivelinessChecking, aw as hoistNonReactStatic, ax as values, ay as InView, az as map, aA as kebabCase, aB as ReactDOM, aC as useRootClose, aD as Portal, aE as chunk, aF as mapValues, aG as camelCase, aH as uncontrollable$1, aI as toJS, aJ as CSSTransition, aK as difference$1, aL as reactIsExports, aM as keycode, aN as ENTERING, aO as ENTERED, aP as EXITING, aQ as Transition, aR as cjsExports, aS as EXITED, aT as isFunction, aU as Downshift$1, aV as extend, aW as each, aX as Sortable, aY as propTypesExports, aZ as comparer, a_ as range$1, a$ as keys, b0 as index$2, b1 as forEach, b2 as times, b3 as isInteger, b4 as intersectionWith, b5 as unionWith, b6 as includes, b7 as getMiniDecimal, b8 as InputNumber$1, b9 as getNumberPrecision, ba as chain, bb as intersection, bc as useForm, bd as FormProvider, be as Controller$1, bf as intersectionBy, bg as compact, bh as Circle, bi as useFieldArray, bj as useFormContext, bk as useFormState, bl as Draggable, bm as Item$1, bn as SubMenu$2, bo as MenuItemGroup, bp as Divider$2, bq as ExportMenu, br as SmoothSignature, bs as xor, bt as hotkeys, bu as getSnapshot, bv as observer$1, bw as useInView, bx as Dropzone, by as isNil, bz as accepts, bA as ErrorCode, bB as tinymce, bC as Froala, bD as omitBy, bE as pickBy, bF as partition, bG as inRange, bH as clone, bI as union, bJ as cjsExports$1, bK as assign, bL as libExports, bM as num2str, bN as update, bO as d, bP as SketchPicker, bQ as GithubPicker, bR as JsBarcode, bS as markdownIt, bT as libExports$1, bU as Document, bV as Page$2, bW as __webpack_exports__GlobalWorkerOptions } from "./vendor-fKhExfo_.js";
|
|
2
2
|
var FormulaEvalError = (
|
|
3
3
|
/** @class */
|
|
4
4
|
(function(i) {
|
|
@@ -5245,7 +5245,7 @@ function position(i, a) {
|
|
|
5245
5245
|
});
|
|
5246
5246
|
}
|
|
5247
5247
|
var JsonView$1 = React__default.lazy(function() {
|
|
5248
|
-
return import("./vendor-
|
|
5248
|
+
return import("./vendor-fKhExfo_.js").then((i) => i.m).then(importLazyComponent);
|
|
5249
5249
|
});
|
|
5250
5250
|
(function() {
|
|
5251
5251
|
function i() {
|
|
@@ -9808,7 +9808,7 @@ var Column$2 = types.model("Column", {
|
|
|
9808
9808
|
];
|
|
9809
9809
|
Array.isArray(O.data) ? R = O.data : R = O.data.rows || O.data.items, F.label = 2;
|
|
9810
9810
|
case 2:
|
|
9811
|
-
return import("./vendor-
|
|
9811
|
+
return import("./vendor-fKhExfo_.js").then((k) => k.p).then(function(k) {
|
|
9812
9812
|
var M, D, P = [];
|
|
9813
9813
|
try {
|
|
9814
9814
|
for (var L = __values(R), U = L.next(); !U.done; U = L.next()) {
|
|
@@ -27143,7 +27143,7 @@ var Editor$1 = (
|
|
|
27143
27143
|
return this.container;
|
|
27144
27144
|
}, a.prototype.loadMonaco = function() {
|
|
27145
27145
|
var e = this;
|
|
27146
|
-
window.__amis_monaco_editor_locale = this.props.locale, import("./vendor-
|
|
27146
|
+
window.__amis_monaco_editor_locale = this.props.locale, import("./vendor-fKhExfo_.js").then((t) => t.c5).then(function(t) {
|
|
27147
27147
|
return e.initMonaco(t);
|
|
27148
27148
|
});
|
|
27149
27149
|
}, a.prototype.initMonaco = function(e) {
|
|
@@ -36057,17 +36057,17 @@ var FuncList$1 = themeable(FuncList), CodeMirrorEditor = (
|
|
|
36057
36057
|
return __generator(this, function(u) {
|
|
36058
36058
|
switch (u.label) {
|
|
36059
36059
|
case 0:
|
|
36060
|
-
return [4, import("./vendor-
|
|
36060
|
+
return [4, import("./vendor-fKhExfo_.js").then((c) => c.a)];
|
|
36061
36061
|
case 1:
|
|
36062
|
-
return s = u.sent().default, [4, import("./vendor-
|
|
36062
|
+
return s = u.sent().default, [4, import("./vendor-fKhExfo_.js").then((c) => c.j)];
|
|
36063
36063
|
case 2:
|
|
36064
|
-
return u.sent(), [4, import("./vendor-
|
|
36064
|
+
return u.sent(), [4, import("./vendor-fKhExfo_.js").then((c) => c.h)];
|
|
36065
36065
|
case 3:
|
|
36066
|
-
return u.sent(), [4, import("./vendor-
|
|
36066
|
+
return u.sent(), [4, import("./vendor-fKhExfo_.js").then((c) => c.s)];
|
|
36067
36067
|
case 4:
|
|
36068
|
-
return u.sent(), [4, import("./vendor-
|
|
36068
|
+
return u.sent(), [4, import("./vendor-fKhExfo_.js").then((c) => c.b)];
|
|
36069
36069
|
case 5:
|
|
36070
|
-
return u.sent(), [4, import("./vendor-
|
|
36070
|
+
return u.sent(), [4, import("./vendor-fKhExfo_.js").then((c) => c.d)];
|
|
36071
36071
|
case 6:
|
|
36072
36072
|
return u.sent(), this.unmounted ? [
|
|
36073
36073
|
2
|
|
@@ -49447,7 +49447,7 @@ var VCell = observer$1(function(a) {
|
|
|
49447
49447
|
return l ? s("exportExcel", __assign(__assign({ label: o("CRUD.exportExcel") }, e), { type: "button" }), {
|
|
49448
49448
|
loading: r.exportExcelLoading,
|
|
49449
49449
|
onAction: function() {
|
|
49450
|
-
r.update({ exportExcelLoading: !0 }), import("./vendor-
|
|
49450
|
+
r.update({ exportExcelLoading: !0 }), import("./vendor-fKhExfo_.js").then((u) => u.e).then(function(u) {
|
|
49451
49451
|
return __awaiter(t, void 0, void 0, function() {
|
|
49452
49452
|
var c, p;
|
|
49453
49453
|
return __generator(this, function(f) {
|
|
@@ -49480,7 +49480,7 @@ var VCell = observer$1(function(a) {
|
|
|
49480
49480
|
var t = this, n = this.props, r = n.store, o = n.translate, s = n.render, l = r.filteredColumns || [];
|
|
49481
49481
|
return l ? s("exportExcelTemplate", __assign(__assign({ label: o("CRUD.exportExcelTemplate") }, e), { type: "button" }), {
|
|
49482
49482
|
onAction: function() {
|
|
49483
|
-
import("./vendor-
|
|
49483
|
+
import("./vendor-fKhExfo_.js").then((u) => u.e).then(function(u) {
|
|
49484
49484
|
return __awaiter(t, void 0, void 0, function() {
|
|
49485
49485
|
var c, p;
|
|
49486
49486
|
return __generator(this, function(f) {
|
|
@@ -52761,7 +52761,7 @@ const Image$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
52761
52761
|
imagePlaceholder
|
|
52762
52762
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
52763
52763
|
var Cropper = React__default.lazy(function() {
|
|
52764
|
-
return import("./vendor-
|
|
52764
|
+
return import("./vendor-fKhExfo_.js").then((i) => i.c6);
|
|
52765
52765
|
}), preventEvent = function(i) {
|
|
52766
52766
|
return i.stopPropagation();
|
|
52767
52767
|
};
|
|
@@ -73715,7 +73715,7 @@ var ExcelControl = (
|
|
|
73715
73715
|
}, v.readAsArrayBuffer(e);
|
|
73716
73716
|
})];
|
|
73717
73717
|
case 2:
|
|
73718
|
-
return r = f.sent(), o = e.name.toLowerCase().endsWith(".xls"), s = void 0, o ? [4, import("./vendor-
|
|
73718
|
+
return r = f.sent(), o = e.name.toLowerCase().endsWith(".xls"), s = void 0, o ? [4, import("./vendor-fKhExfo_.js").then((h) => h.c7)] : [3, 4];
|
|
73719
73719
|
case 3:
|
|
73720
73720
|
return l = f.sent(), u = l.read(new Uint8Array(r), {
|
|
73721
73721
|
cellDates: !0
|
|
@@ -73747,7 +73747,7 @@ var ExcelControl = (
|
|
|
73747
73747
|
case 0:
|
|
73748
73748
|
n = this.props, r = n.allSheets, o = n.parseImage, s = n.plainText, l = n.translate, v.label = 1;
|
|
73749
73749
|
case 1:
|
|
73750
|
-
return v.trys.push([1, 4, , 5]), [4, import("./vendor-
|
|
73750
|
+
return v.trys.push([1, 4, , 5]), [4, import("./vendor-fKhExfo_.js").then((_) => _.e)];
|
|
73751
73751
|
case 2:
|
|
73752
73752
|
return u = v.sent().default, this.ExcelJS = u, c = new u.Workbook(), p = typeof e == "string" ? new Uint8Array(e.split("").map(function(_) {
|
|
73753
73753
|
return _.charCodeAt(0);
|
|
@@ -80704,7 +80704,7 @@ const Status = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
80704
80704
|
StatusFieldRenderer
|
|
80705
80705
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
80706
80706
|
var JsonView = React__default.lazy(function() {
|
|
80707
|
-
return import("./vendor-
|
|
80707
|
+
return import("./vendor-fKhExfo_.js").then((i) => i.m).then(importLazyComponent);
|
|
80708
80708
|
}), JSONField = (
|
|
80709
80709
|
/** @class */
|
|
80710
80710
|
(function(i) {
|
|
@@ -81664,14 +81664,14 @@ var Chart = (
|
|
|
81664
81664
|
r.data;
|
|
81665
81665
|
var p = this.props, f = p.mapURL, h = p.mapName, m = this.props.onChartMount || this.onChartMount;
|
|
81666
81666
|
e ? Promise.all([
|
|
81667
|
-
import("./vendor-
|
|
81668
|
-
import("./vendor-
|
|
81667
|
+
import("./vendor-fKhExfo_.js").then((v) => v.c8),
|
|
81668
|
+
import("./vendor-fKhExfo_.js").then((v) => v.i),
|
|
81669
81669
|
// @ts-ignore 官方没提供 type
|
|
81670
|
-
import("./vendor-
|
|
81670
|
+
import("./vendor-fKhExfo_.js").then((v) => v.c9),
|
|
81671
81671
|
// @ts-ignore 官方没提供 type
|
|
81672
|
-
import("./vendor-
|
|
81672
|
+
import("./vendor-fKhExfo_.js").then((v) => v.ca),
|
|
81673
81673
|
// @ts-ignore 官方没提供 type
|
|
81674
|
-
import("./vendor-
|
|
81674
|
+
import("./vendor-fKhExfo_.js").then((v) => v.f)
|
|
81675
81675
|
]).then(function(v) {
|
|
81676
81676
|
var _ = __read(v, 2), g = _[0], b = _[1];
|
|
81677
81677
|
return __awaiter(t, void 0, void 0, function() {
|
|
@@ -82628,7 +82628,7 @@ var str2seconds = function(i) {
|
|
|
82628
82628
|
this.mpegtsPlayer && (this.mpegtsPlayer.destroy(), (t = (e = this.props).setError) === null || t === void 0 || t.call(e, ""));
|
|
82629
82629
|
}, a.prototype.initFlv = function(e) {
|
|
82630
82630
|
var t = this, n = e.video, r = e.manager, o = e.src, s = e.isLive, l = e.config, u = e.actions, c = e.setError, p = e.autoPlay;
|
|
82631
|
-
import("./vendor-
|
|
82631
|
+
import("./vendor-fKhExfo_.js").then((f) => f.g).then(function(f) {
|
|
82632
82632
|
n = n || r.video && r.video.video;
|
|
82633
82633
|
var h = f.createPlayer({
|
|
82634
82634
|
type: "flv",
|
|
@@ -82688,7 +82688,7 @@ var str2seconds = function(i) {
|
|
|
82688
82688
|
}));
|
|
82689
82689
|
}, a.prototype.initHls = function(e) {
|
|
82690
82690
|
var t = this, n = e.video, r = e.manager, o = e.src, s = e.autoPlay, l = e.actions;
|
|
82691
|
-
import("./vendor-
|
|
82691
|
+
import("./vendor-fKhExfo_.js").then((u) => u.k).then(function(u) {
|
|
82692
82692
|
var c = u.default;
|
|
82693
82693
|
if (c.isSupported()) {
|
|
82694
82694
|
n = n || r.video && r.video.video;
|
|
@@ -86122,7 +86122,7 @@ var Code = (
|
|
|
86122
86122
|
return anyChanged(a.propsList, this.props, e) || this.resolveLanguage(this.props) !== this.resolveLanguage(e) || getPropValue(this.props) !== getPropValue(e);
|
|
86123
86123
|
}, a.prototype.componentDidMount = function() {
|
|
86124
86124
|
var e = this;
|
|
86125
|
-
import("./vendor-
|
|
86125
|
+
import("./vendor-fKhExfo_.js").then((t) => t.c5).then(function(t) {
|
|
86126
86126
|
return e.handleMonaco(t);
|
|
86127
86127
|
});
|
|
86128
86128
|
}, a.prototype.componentDidUpdate = function(e) {
|
|
@@ -88141,7 +88141,7 @@ var OfficeViewer = (
|
|
|
88141
88141
|
return __awaiter(this, void 0, void 0, function() {
|
|
88142
88142
|
var e, t, n = this;
|
|
88143
88143
|
return __generator(this, function(r) {
|
|
88144
|
-
return e = this.props, e.wordOptions, e.excelOptions, e.env, e.src, e.data, t = e.display, e.translate, this.document ? (import("./vendor-
|
|
88144
|
+
return e = this.props, e.wordOptions, e.excelOptions, e.env, e.src, e.data, t = e.display, e.translate, this.document ? (import("./vendor-fKhExfo_.js").then((o) => o.cb).then(function(o) {
|
|
88145
88145
|
return __awaiter(n, void 0, void 0, function() {
|
|
88146
88146
|
var s, l, u;
|
|
88147
88147
|
return __generator(this, function(c) {
|
|
@@ -88179,7 +88179,7 @@ var OfficeViewer = (
|
|
|
88179
88179
|
var l = new FileReader();
|
|
88180
88180
|
l.onload = function(u) {
|
|
88181
88181
|
var c = l.result;
|
|
88182
|
-
import("./vendor-
|
|
88182
|
+
import("./vendor-fKhExfo_.js").then((p) => p.cb).then(function(p) {
|
|
88183
88183
|
return __awaiter(e, void 0, void 0, function() {
|
|
88184
88184
|
var f, h, m;
|
|
88185
88185
|
return __generator(this, function(v) {
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import { bX as g, bY as x, ab as u, bZ as E, b_ as M, b$ as O, c0 as A, c1 as L, c2 as B, c3 as F } from "./vendor-fKhExfo_.js";
|
|
2
|
+
import { t as N, d as q, r as w, T as $ } from "./amis-CjYQbrSm.js";
|
|
3
|
+
const D = "bankDetails";
|
|
4
|
+
async function b(n, e, o, p = 1) {
|
|
5
|
+
if (p < 0)
|
|
6
|
+
throw new Error("[payout-sdk] fetchWithAuth retries exceeded");
|
|
7
|
+
const { headers: a, authCode: h, domain: y, codeVerifier: c } = o, _ = localStorage.getItem("access_token");
|
|
8
|
+
if (_)
|
|
9
|
+
e.access_token = _;
|
|
10
|
+
else {
|
|
11
|
+
const s = await R(
|
|
12
|
+
h,
|
|
13
|
+
y,
|
|
14
|
+
c
|
|
15
|
+
);
|
|
16
|
+
if (!s.access_token || !s.refresh_token)
|
|
17
|
+
throw localStorage.removeItem("access_token"), localStorage.removeItem("refresh_token"), new Error(
|
|
18
|
+
"[payout-sdk] getAccessToken failed, check authCode validity"
|
|
19
|
+
);
|
|
20
|
+
e.access_token = s.access_token, localStorage.setItem("access_token", s.access_token), localStorage.setItem("refresh_token", s.refresh_token);
|
|
21
|
+
}
|
|
22
|
+
const t = await fetch(n, {
|
|
23
|
+
...o,
|
|
24
|
+
body: JSON.stringify(e),
|
|
25
|
+
headers: {
|
|
26
|
+
...a,
|
|
27
|
+
"Content-Type": "application/json"
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
if (t.status === 400) {
|
|
31
|
+
const s = await t.json();
|
|
32
|
+
if (s.name != "INTERNAL_ERROR")
|
|
33
|
+
throw N.error(`${s.name}: ${s.message}`), new Error(`[payout-sdk] ${s.name}: ${s.message}`);
|
|
34
|
+
const l = localStorage.getItem("refresh_token");
|
|
35
|
+
if (l) {
|
|
36
|
+
const d = await z(
|
|
37
|
+
l,
|
|
38
|
+
y
|
|
39
|
+
);
|
|
40
|
+
if (!d.access_token || !d.refresh_token)
|
|
41
|
+
localStorage.removeItem("access_token"), localStorage.removeItem("refresh_token");
|
|
42
|
+
else
|
|
43
|
+
return localStorage.setItem(
|
|
44
|
+
"refresh_token",
|
|
45
|
+
d.refresh_token
|
|
46
|
+
), localStorage.setItem("access_token", d.access_token), b(n, e, o, --p);
|
|
47
|
+
}
|
|
48
|
+
const f = await R(
|
|
49
|
+
h,
|
|
50
|
+
y,
|
|
51
|
+
c
|
|
52
|
+
);
|
|
53
|
+
if (!f.access_token || !f.refresh_token)
|
|
54
|
+
throw new Error(
|
|
55
|
+
"[payout-sdk] getAccessToken failed, check authCode validity"
|
|
56
|
+
);
|
|
57
|
+
return localStorage.setItem("refresh_token", f.refresh_token), localStorage.setItem("access_token", f.access_token), b(n, e, o, --p);
|
|
58
|
+
}
|
|
59
|
+
return t;
|
|
60
|
+
}
|
|
61
|
+
async function R(n, e, o) {
|
|
62
|
+
const p = {
|
|
63
|
+
authorization_code: n,
|
|
64
|
+
code_verifier: o
|
|
65
|
+
};
|
|
66
|
+
return await (await fetch(`${e}/v1/payout/auth/token`, {
|
|
67
|
+
method: "POST",
|
|
68
|
+
body: JSON.stringify(p),
|
|
69
|
+
headers: {
|
|
70
|
+
"Content-Type": "application/json"
|
|
71
|
+
}
|
|
72
|
+
})).json();
|
|
73
|
+
}
|
|
74
|
+
async function z(n, e) {
|
|
75
|
+
const o = {
|
|
76
|
+
refresh_token: n
|
|
77
|
+
};
|
|
78
|
+
return await (await fetch(`${e}/v1/payout/auth/token/refresh`, {
|
|
79
|
+
method: "POST",
|
|
80
|
+
body: JSON.stringify(o),
|
|
81
|
+
headers: {
|
|
82
|
+
"Content-Type": "application/json"
|
|
83
|
+
}
|
|
84
|
+
})).json();
|
|
85
|
+
}
|
|
86
|
+
async function J(n, e, o) {
|
|
87
|
+
return (await (await b(
|
|
88
|
+
"/v1/payout/beneficiary/token/countryinfos",
|
|
89
|
+
{},
|
|
90
|
+
{
|
|
91
|
+
method: "POST",
|
|
92
|
+
authCode: n,
|
|
93
|
+
domain: e,
|
|
94
|
+
codeVerifier: o
|
|
95
|
+
}
|
|
96
|
+
)).json()).country_infos || [];
|
|
97
|
+
}
|
|
98
|
+
async function Y({ inputRegionCode: n, inputPayoutType: e, inputCurrency: o }, p, a, h, y, c) {
|
|
99
|
+
const t = await (await b(
|
|
100
|
+
"/v1/payout/beneficiary/token/paymentmethodinfos",
|
|
101
|
+
{
|
|
102
|
+
region_code: n
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
method: "POST",
|
|
106
|
+
authCode: p,
|
|
107
|
+
domain: a,
|
|
108
|
+
codeVerifier: h
|
|
109
|
+
}
|
|
110
|
+
)).json(), s = [];
|
|
111
|
+
for (const l of Object.values(t.countries)) {
|
|
112
|
+
const f = l.payoutTypes?.[e]?.currencies;
|
|
113
|
+
if (f)
|
|
114
|
+
for (const [d, S] of Object.entries(f))
|
|
115
|
+
d === o && s.push(S);
|
|
116
|
+
}
|
|
117
|
+
if (s.length !== 0)
|
|
118
|
+
return {
|
|
119
|
+
type: "list-select",
|
|
120
|
+
name: "inputPaymentMethod",
|
|
121
|
+
label: y("paymentMethodInputLabel", "Transfer method"),
|
|
122
|
+
options: s.map((l) => ({
|
|
123
|
+
value: l.payment_method,
|
|
124
|
+
body: /* @__PURE__ */ g.jsxs("div", { children: [
|
|
125
|
+
/* @__PURE__ */ g.jsx("span", { className: "flex font-bold", children: l.display_name }),
|
|
126
|
+
/* @__PURE__ */ g.jsx("span", { className: "flex mt-1", children: l.description })
|
|
127
|
+
] })
|
|
128
|
+
})),
|
|
129
|
+
value: c?.payment_method
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
async function K({
|
|
133
|
+
inputRegionCode: n,
|
|
134
|
+
inputCurrency: e,
|
|
135
|
+
inputPaymentMethod: o
|
|
136
|
+
}, p, a, h) {
|
|
137
|
+
const _ = await (await b(
|
|
138
|
+
"/v1/payout/beneficiary/form/schema/token/query",
|
|
139
|
+
{
|
|
140
|
+
payment_method: o,
|
|
141
|
+
region: n,
|
|
142
|
+
currency: e,
|
|
143
|
+
local_clearing_system: "",
|
|
144
|
+
version: "v1",
|
|
145
|
+
entity_type: "ENTITY_TYPE_PERSONAL"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
method: "POST",
|
|
149
|
+
authCode: p,
|
|
150
|
+
domain: a,
|
|
151
|
+
codeVerifier: h
|
|
152
|
+
}
|
|
153
|
+
)).json();
|
|
154
|
+
return JSON.parse(
|
|
155
|
+
_.beneficiary_schema.amis_page.replace(/Area Code/g, "AREA_CODE")
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
function W({
|
|
159
|
+
authCode: n,
|
|
160
|
+
domain: e,
|
|
161
|
+
codeVerifier: o,
|
|
162
|
+
emitter: p,
|
|
163
|
+
defaultValues: a,
|
|
164
|
+
customizations: h
|
|
165
|
+
}) {
|
|
166
|
+
const { t: y } = x("beneficiaryForm"), [c, _] = u.useState([]), [t, s] = u.useState(), [l, f] = u.useState(), [d, S] = u.useState(), C = u.useMemo(() => !h?.layout?.find(
|
|
167
|
+
(r) => r.name === D
|
|
168
|
+
)?.hidden, [h?.layout]), T = u.useCallback(
|
|
169
|
+
(i) => {
|
|
170
|
+
const r = i.body.findIndex(
|
|
171
|
+
(k) => k.type === "form"
|
|
172
|
+
), m = i.body[r];
|
|
173
|
+
i.body[r].onFinished = (k) => {
|
|
174
|
+
const j = q(m.api.data, k, void 0, !0);
|
|
175
|
+
p.emit("submit", j.value);
|
|
176
|
+
}, S(i);
|
|
177
|
+
},
|
|
178
|
+
[p]
|
|
179
|
+
), v = u.useMemo(() => {
|
|
180
|
+
const i = /* @__PURE__ */ new Set();
|
|
181
|
+
return c.filter(
|
|
182
|
+
(m) => m.country_number && !i.has(m.country_number) && i.add(m.country_number)
|
|
183
|
+
).map((m) => ({
|
|
184
|
+
label: m.country_name_standard || m.country_name,
|
|
185
|
+
value: m.country_code
|
|
186
|
+
})).sort((m, k) => m.label.localeCompare(k.label));
|
|
187
|
+
}, [c]), I = u.useMemo(() => Array.from(
|
|
188
|
+
new Set(c.map((r) => r.currency_code))
|
|
189
|
+
).map((r) => ({
|
|
190
|
+
label: r,
|
|
191
|
+
value: r
|
|
192
|
+
})).filter((r) => !!r.label && r.label !== "-").sort((r, m) => r.label.localeCompare(m.label)), [c]);
|
|
193
|
+
u.useEffect(() => {
|
|
194
|
+
c.length !== 0 && t?.inputRegionCode && t?.inputCurrency && t?.inputPayoutType && Y(
|
|
195
|
+
{
|
|
196
|
+
inputRegionCode: t.inputRegionCode,
|
|
197
|
+
inputCurrency: t.inputCurrency,
|
|
198
|
+
inputPayoutType: t.inputPayoutType
|
|
199
|
+
},
|
|
200
|
+
n,
|
|
201
|
+
e,
|
|
202
|
+
o,
|
|
203
|
+
y,
|
|
204
|
+
a
|
|
205
|
+
).then(f);
|
|
206
|
+
}, [
|
|
207
|
+
c,
|
|
208
|
+
n,
|
|
209
|
+
e,
|
|
210
|
+
t?.inputRegionCode,
|
|
211
|
+
t?.inputCurrency,
|
|
212
|
+
t?.inputPayoutType,
|
|
213
|
+
a,
|
|
214
|
+
o,
|
|
215
|
+
y
|
|
216
|
+
]), u.useEffect(() => {
|
|
217
|
+
c.length !== 0 && l && t?.inputPaymentMethod && t?.inputRegionCode && t?.inputCurrency && K(
|
|
218
|
+
{
|
|
219
|
+
inputPaymentMethod: t.inputPaymentMethod,
|
|
220
|
+
inputRegionCode: t.inputRegionCode,
|
|
221
|
+
inputCurrency: t.inputCurrency
|
|
222
|
+
},
|
|
223
|
+
n,
|
|
224
|
+
e,
|
|
225
|
+
o
|
|
226
|
+
).then((i) => i && T(i));
|
|
227
|
+
}, [
|
|
228
|
+
c,
|
|
229
|
+
l,
|
|
230
|
+
n,
|
|
231
|
+
e,
|
|
232
|
+
o,
|
|
233
|
+
t?.inputPaymentMethod,
|
|
234
|
+
t?.inputRegionCode,
|
|
235
|
+
t?.inputCurrency,
|
|
236
|
+
T
|
|
237
|
+
]), u.useEffect(() => {
|
|
238
|
+
t?.inputCurrency || f(void 0);
|
|
239
|
+
}, [t?.inputCurrency]), u.useEffect(() => {
|
|
240
|
+
a && s({
|
|
241
|
+
inputPayoutType: a.payout_type || "B2P",
|
|
242
|
+
inputPaymentMethod: a.payment_method,
|
|
243
|
+
inputRegionCode: a.region_code,
|
|
244
|
+
inputCurrency: a.currency
|
|
245
|
+
});
|
|
246
|
+
}, [a]);
|
|
247
|
+
const P = u.useMemo(
|
|
248
|
+
() => ({
|
|
249
|
+
type: "page",
|
|
250
|
+
visible: C,
|
|
251
|
+
body: {
|
|
252
|
+
type: "spinner",
|
|
253
|
+
show: c.length === 0,
|
|
254
|
+
overlay: !0,
|
|
255
|
+
body: [
|
|
256
|
+
{
|
|
257
|
+
type: "form",
|
|
258
|
+
title: y("title", "Bank Details"),
|
|
259
|
+
submitText: "",
|
|
260
|
+
onChange: (i) => {
|
|
261
|
+
s(i);
|
|
262
|
+
},
|
|
263
|
+
body: [
|
|
264
|
+
{
|
|
265
|
+
label: y("regionInputLabel", "Bank Location"),
|
|
266
|
+
type: "input-text",
|
|
267
|
+
creatable: !1,
|
|
268
|
+
name: "inputRegionCode",
|
|
269
|
+
options: v,
|
|
270
|
+
value: a?.region_code
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
label: y("payoutTypeInputLabel", "Bank account type"),
|
|
274
|
+
type: "radios",
|
|
275
|
+
name: "inputPayoutType",
|
|
276
|
+
selectFirst: !0,
|
|
277
|
+
options: [
|
|
278
|
+
{
|
|
279
|
+
label: "Individual",
|
|
280
|
+
value: "B2P"
|
|
281
|
+
}
|
|
282
|
+
],
|
|
283
|
+
value: a?.payout_type
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
label: y("currencyInputLabel", "Account currency"),
|
|
287
|
+
type: "input-text",
|
|
288
|
+
creatable: !1,
|
|
289
|
+
name: "inputCurrency",
|
|
290
|
+
options: I,
|
|
291
|
+
value: a?.currency
|
|
292
|
+
},
|
|
293
|
+
l
|
|
294
|
+
]
|
|
295
|
+
}
|
|
296
|
+
]
|
|
297
|
+
}
|
|
298
|
+
}),
|
|
299
|
+
[
|
|
300
|
+
C,
|
|
301
|
+
c.length,
|
|
302
|
+
y,
|
|
303
|
+
v,
|
|
304
|
+
a?.region_code,
|
|
305
|
+
a?.payout_type,
|
|
306
|
+
a?.currency,
|
|
307
|
+
I,
|
|
308
|
+
l
|
|
309
|
+
]
|
|
310
|
+
);
|
|
311
|
+
return u.useEffect(() => {
|
|
312
|
+
async function i() {
|
|
313
|
+
const r = await J(
|
|
314
|
+
n,
|
|
315
|
+
e,
|
|
316
|
+
o
|
|
317
|
+
);
|
|
318
|
+
_(r);
|
|
319
|
+
}
|
|
320
|
+
i();
|
|
321
|
+
}, [n, o, e]), /* @__PURE__ */ g.jsxs(g.Fragment, { children: [
|
|
322
|
+
/* @__PURE__ */ g.jsx($, {}),
|
|
323
|
+
w(P),
|
|
324
|
+
d && w(d)
|
|
325
|
+
] });
|
|
326
|
+
}
|
|
327
|
+
function X(n) {
|
|
328
|
+
const { locale: e = "en" } = n, o = u.useMemo(
|
|
329
|
+
() => E().use(M()).use(O()).use(A()).use(L()).init({
|
|
330
|
+
language: B() || e,
|
|
331
|
+
defaultLanguage: e,
|
|
332
|
+
fallbackLanguage: "en",
|
|
333
|
+
availableLanguages: ["en", "zh-Hant", "ar", "ja", "th", "tr", "zh"],
|
|
334
|
+
apiUrl: "https://admin.midasbuy.com/i18n/api",
|
|
335
|
+
apiKey: "tgpak_gm2tqxzygnpvsokipayuqz2yhb4hszcvkzsq",
|
|
336
|
+
projectId: 181
|
|
337
|
+
}),
|
|
338
|
+
[e]
|
|
339
|
+
);
|
|
340
|
+
return /* @__PURE__ */ g.jsx(F, { mi18n: o, fallback: "Loading...", children: /* @__PURE__ */ g.jsx(W, { ...n }) });
|
|
341
|
+
}
|
|
342
|
+
export {
|
|
343
|
+
X as default
|
|
344
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ declare interface BaseProps<T extends keyof typeof ElementsMap> extends InitOpti
|
|
|
12
12
|
emitter: Emitter<Events<T>>;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
declare function BeneficiaryForm(
|
|
15
|
+
declare function BeneficiaryForm(props: Props): JSX_2.Element;
|
|
16
16
|
|
|
17
17
|
declare interface BeneficiaryFormCustomizations {
|
|
18
18
|
layout?: LayoutSection[];
|
|
@@ -76,6 +76,7 @@ declare interface InitOptions {
|
|
|
76
76
|
authCode: string;
|
|
77
77
|
domain: string;
|
|
78
78
|
codeVerifier: string;
|
|
79
|
+
locale?: Locale;
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
declare interface LayoutSection {
|
|
@@ -84,13 +85,11 @@ declare interface LayoutSection {
|
|
|
84
85
|
hidden?: boolean;
|
|
85
86
|
}
|
|
86
87
|
|
|
88
|
+
declare type Locale = "en" | "zh-Hant" | "ar" | "ja" | "th" | "tr" | "zh";
|
|
89
|
+
|
|
87
90
|
declare type PayoutType = "B2P";
|
|
88
91
|
|
|
89
|
-
declare interface Props {
|
|
90
|
-
authCode: string;
|
|
91
|
-
domain: string;
|
|
92
|
-
codeVerifier: string;
|
|
93
|
-
emitter: Emitter<ElementEventsMap["beneficiaryForm"]>;
|
|
92
|
+
declare interface Props extends BaseProps<"beneficiaryForm"> {
|
|
94
93
|
defaultValues?: BeneficiaryFormDefaultValues;
|
|
95
94
|
customizations?: BeneficiaryFormCustomizations;
|
|
96
95
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
class
|
|
1
|
+
import { c4 as a } from "./vendor-fKhExfo_.js";
|
|
2
|
+
class c {
|
|
3
3
|
loader;
|
|
4
4
|
options;
|
|
5
5
|
mounted = !1;
|
|
@@ -10,7 +10,7 @@ class u {
|
|
|
10
10
|
}
|
|
11
11
|
async mount(t) {
|
|
12
12
|
if (this.mounted) return;
|
|
13
|
-
const o = await this.loader(), e = o.default ?? o, m = await import("./vendor-
|
|
13
|
+
const o = await this.loader(), e = o.default ?? o, m = await import("./vendor-fKhExfo_.js").then((i) => i.R), s = (await import("./vendor-fKhExfo_.js").then((i) => i.c)).createRoot(t);
|
|
14
14
|
s.render(
|
|
15
15
|
m.createElement(e, {
|
|
16
16
|
...this.options,
|
|
@@ -31,8 +31,8 @@ class u {
|
|
|
31
31
|
return this.mounted;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
const
|
|
35
|
-
beneficiaryForm: () => import("./component-beneficiary-form-
|
|
34
|
+
const u = {
|
|
35
|
+
beneficiaryForm: () => import("./component-beneficiary-form-ZOQLPYQM.js")
|
|
36
36
|
};
|
|
37
37
|
class h {
|
|
38
38
|
options;
|
|
@@ -43,10 +43,10 @@ class h {
|
|
|
43
43
|
createElement(t, o) {
|
|
44
44
|
if (!this.options)
|
|
45
45
|
throw new Error("[payout-sdk] options are not initialized");
|
|
46
|
-
const e =
|
|
46
|
+
const e = u[t];
|
|
47
47
|
if (!e)
|
|
48
48
|
throw new Error(`[payout-sdk] component ${t} not found`);
|
|
49
|
-
return this.components[t] ? this.components[t] : (this.components[t] = new
|
|
49
|
+
return this.components[t] ? this.components[t] : (this.components[t] = new c(e, {
|
|
50
50
|
...this.options,
|
|
51
51
|
...o
|
|
52
52
|
}), this.components[t]);
|