@txgw/payout-components 0.2.2 → 0.3.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.
@@ -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-D9Vb1NW1.js";
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-DyrjuDU0.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-D9Vb1NW1.js").then((i) => i.m).then(importLazyComponent);
5248
+ return import("./vendor-DyrjuDU0.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-D9Vb1NW1.js").then((k) => k.p).then(function(k) {
9811
+ return import("./vendor-DyrjuDU0.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()) {
@@ -19069,13 +19069,6 @@ var ScopedRootRenderer = StatusScoped(HocScoped(Root)), ErrorBoundary = (
19069
19069
  }, a;
19070
19070
  })(React__default.Component)
19071
19071
  );
19072
- /** @license amis v@version
19073
- *
19074
- * Copyright Baidu
19075
- *
19076
- * This source code is licensed under the Apache license found in the
19077
- * LICENSE file in the root directory of this source tree.
19078
- */
19079
19072
  getClassPrefix();
19080
19073
  window.amisVersionInfo = {
19081
19074
  version: "6.13.0",
@@ -27143,7 +27136,7 @@ var Editor$1 = (
27143
27136
  return this.container;
27144
27137
  }, a.prototype.loadMonaco = function() {
27145
27138
  var e = this;
27146
- window.__amis_monaco_editor_locale = this.props.locale, import("./vendor-D9Vb1NW1.js").then((t) => t.c5).then(function(t) {
27139
+ window.__amis_monaco_editor_locale = this.props.locale, import("./vendor-DyrjuDU0.js").then((t) => t.c5).then(function(t) {
27147
27140
  return e.initMonaco(t);
27148
27141
  });
27149
27142
  }, a.prototype.initMonaco = function(e) {
@@ -36057,17 +36050,17 @@ var FuncList$1 = themeable(FuncList), CodeMirrorEditor = (
36057
36050
  return __generator(this, function(u) {
36058
36051
  switch (u.label) {
36059
36052
  case 0:
36060
- return [4, import("./vendor-D9Vb1NW1.js").then((c) => c.a)];
36053
+ return [4, import("./vendor-DyrjuDU0.js").then((c) => c.a)];
36061
36054
  case 1:
36062
- return s = u.sent().default, [4, import("./vendor-D9Vb1NW1.js").then((c) => c.j)];
36055
+ return s = u.sent().default, [4, import("./vendor-DyrjuDU0.js").then((c) => c.j)];
36063
36056
  case 2:
36064
- return u.sent(), [4, import("./vendor-D9Vb1NW1.js").then((c) => c.h)];
36057
+ return u.sent(), [4, import("./vendor-DyrjuDU0.js").then((c) => c.h)];
36065
36058
  case 3:
36066
- return u.sent(), [4, import("./vendor-D9Vb1NW1.js").then((c) => c.s)];
36059
+ return u.sent(), [4, import("./vendor-DyrjuDU0.js").then((c) => c.s)];
36067
36060
  case 4:
36068
- return u.sent(), [4, import("./vendor-D9Vb1NW1.js").then((c) => c.b)];
36061
+ return u.sent(), [4, import("./vendor-DyrjuDU0.js").then((c) => c.b)];
36069
36062
  case 5:
36070
- return u.sent(), [4, import("./vendor-D9Vb1NW1.js").then((c) => c.d)];
36063
+ return u.sent(), [4, import("./vendor-DyrjuDU0.js").then((c) => c.d)];
36071
36064
  case 6:
36072
36065
  return u.sent(), this.unmounted ? [
36073
36066
  2
@@ -49447,7 +49440,7 @@ var VCell = observer$1(function(a) {
49447
49440
  return l ? s("exportExcel", __assign(__assign({ label: o("CRUD.exportExcel") }, e), { type: "button" }), {
49448
49441
  loading: r.exportExcelLoading,
49449
49442
  onAction: function() {
49450
- r.update({ exportExcelLoading: !0 }), import("./vendor-D9Vb1NW1.js").then((u) => u.e).then(function(u) {
49443
+ r.update({ exportExcelLoading: !0 }), import("./vendor-DyrjuDU0.js").then((u) => u.e).then(function(u) {
49451
49444
  return __awaiter(t, void 0, void 0, function() {
49452
49445
  var c, p;
49453
49446
  return __generator(this, function(f) {
@@ -49480,7 +49473,7 @@ var VCell = observer$1(function(a) {
49480
49473
  var t = this, n = this.props, r = n.store, o = n.translate, s = n.render, l = r.filteredColumns || [];
49481
49474
  return l ? s("exportExcelTemplate", __assign(__assign({ label: o("CRUD.exportExcelTemplate") }, e), { type: "button" }), {
49482
49475
  onAction: function() {
49483
- import("./vendor-D9Vb1NW1.js").then((u) => u.e).then(function(u) {
49476
+ import("./vendor-DyrjuDU0.js").then((u) => u.e).then(function(u) {
49484
49477
  return __awaiter(t, void 0, void 0, function() {
49485
49478
  var c, p;
49486
49479
  return __generator(this, function(f) {
@@ -52761,7 +52754,7 @@ const Image$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
52761
52754
  imagePlaceholder
52762
52755
  }, Symbol.toStringTag, { value: "Module" }));
52763
52756
  var Cropper = React__default.lazy(function() {
52764
- return import("./vendor-D9Vb1NW1.js").then((i) => i.c6);
52757
+ return import("./vendor-DyrjuDU0.js").then((i) => i.c6);
52765
52758
  }), preventEvent = function(i) {
52766
52759
  return i.stopPropagation();
52767
52760
  };
@@ -73715,7 +73708,7 @@ var ExcelControl = (
73715
73708
  }, v.readAsArrayBuffer(e);
73716
73709
  })];
73717
73710
  case 2:
73718
- return r = f.sent(), o = e.name.toLowerCase().endsWith(".xls"), s = void 0, o ? [4, import("./vendor-D9Vb1NW1.js").then((h) => h.c7)] : [3, 4];
73711
+ return r = f.sent(), o = e.name.toLowerCase().endsWith(".xls"), s = void 0, o ? [4, import("./vendor-DyrjuDU0.js").then((h) => h.c7)] : [3, 4];
73719
73712
  case 3:
73720
73713
  return l = f.sent(), u = l.read(new Uint8Array(r), {
73721
73714
  cellDates: !0
@@ -73747,7 +73740,7 @@ var ExcelControl = (
73747
73740
  case 0:
73748
73741
  n = this.props, r = n.allSheets, o = n.parseImage, s = n.plainText, l = n.translate, v.label = 1;
73749
73742
  case 1:
73750
- return v.trys.push([1, 4, , 5]), [4, import("./vendor-D9Vb1NW1.js").then((_) => _.e)];
73743
+ return v.trys.push([1, 4, , 5]), [4, import("./vendor-DyrjuDU0.js").then((_) => _.e)];
73751
73744
  case 2:
73752
73745
  return u = v.sent().default, this.ExcelJS = u, c = new u.Workbook(), p = typeof e == "string" ? new Uint8Array(e.split("").map(function(_) {
73753
73746
  return _.charCodeAt(0);
@@ -80704,7 +80697,7 @@ const Status = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
80704
80697
  StatusFieldRenderer
80705
80698
  }, Symbol.toStringTag, { value: "Module" }));
80706
80699
  var JsonView = React__default.lazy(function() {
80707
- return import("./vendor-D9Vb1NW1.js").then((i) => i.m).then(importLazyComponent);
80700
+ return import("./vendor-DyrjuDU0.js").then((i) => i.m).then(importLazyComponent);
80708
80701
  }), JSONField = (
80709
80702
  /** @class */
80710
80703
  (function(i) {
@@ -81664,14 +81657,14 @@ var Chart = (
81664
81657
  r.data;
81665
81658
  var p = this.props, f = p.mapURL, h = p.mapName, m = this.props.onChartMount || this.onChartMount;
81666
81659
  e ? Promise.all([
81667
- import("./vendor-D9Vb1NW1.js").then((v) => v.c8),
81668
- import("./vendor-D9Vb1NW1.js").then((v) => v.i),
81660
+ import("./vendor-DyrjuDU0.js").then((v) => v.c8),
81661
+ import("./vendor-DyrjuDU0.js").then((v) => v.i),
81669
81662
  // @ts-ignore 官方没提供 type
81670
- import("./vendor-D9Vb1NW1.js").then((v) => v.c9),
81663
+ import("./vendor-DyrjuDU0.js").then((v) => v.c9),
81671
81664
  // @ts-ignore 官方没提供 type
81672
- import("./vendor-D9Vb1NW1.js").then((v) => v.ca),
81665
+ import("./vendor-DyrjuDU0.js").then((v) => v.ca),
81673
81666
  // @ts-ignore 官方没提供 type
81674
- import("./vendor-D9Vb1NW1.js").then((v) => v.f)
81667
+ import("./vendor-DyrjuDU0.js").then((v) => v.f)
81675
81668
  ]).then(function(v) {
81676
81669
  var _ = __read(v, 2), g = _[0], b = _[1];
81677
81670
  return __awaiter(t, void 0, void 0, function() {
@@ -82628,7 +82621,7 @@ var str2seconds = function(i) {
82628
82621
  this.mpegtsPlayer && (this.mpegtsPlayer.destroy(), (t = (e = this.props).setError) === null || t === void 0 || t.call(e, ""));
82629
82622
  }, a.prototype.initFlv = function(e) {
82630
82623
  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-D9Vb1NW1.js").then((f) => f.g).then(function(f) {
82624
+ import("./vendor-DyrjuDU0.js").then((f) => f.g).then(function(f) {
82632
82625
  n = n || r.video && r.video.video;
82633
82626
  var h = f.createPlayer({
82634
82627
  type: "flv",
@@ -82688,7 +82681,7 @@ var str2seconds = function(i) {
82688
82681
  }));
82689
82682
  }, a.prototype.initHls = function(e) {
82690
82683
  var t = this, n = e.video, r = e.manager, o = e.src, s = e.autoPlay, l = e.actions;
82691
- import("./vendor-D9Vb1NW1.js").then((u) => u.k).then(function(u) {
82684
+ import("./vendor-DyrjuDU0.js").then((u) => u.k).then(function(u) {
82692
82685
  var c = u.default;
82693
82686
  if (c.isSupported()) {
82694
82687
  n = n || r.video && r.video.video;
@@ -86122,7 +86115,7 @@ var Code = (
86122
86115
  return anyChanged(a.propsList, this.props, e) || this.resolveLanguage(this.props) !== this.resolveLanguage(e) || getPropValue(this.props) !== getPropValue(e);
86123
86116
  }, a.prototype.componentDidMount = function() {
86124
86117
  var e = this;
86125
- import("./vendor-D9Vb1NW1.js").then((t) => t.c5).then(function(t) {
86118
+ import("./vendor-DyrjuDU0.js").then((t) => t.c5).then(function(t) {
86126
86119
  return e.handleMonaco(t);
86127
86120
  });
86128
86121
  }, a.prototype.componentDidUpdate = function(e) {
@@ -88141,7 +88134,7 @@ var OfficeViewer = (
88141
88134
  return __awaiter(this, void 0, void 0, function() {
88142
88135
  var e, t, n = this;
88143
88136
  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-D9Vb1NW1.js").then((o) => o.cb).then(function(o) {
88137
+ return e = this.props, e.wordOptions, e.excelOptions, e.env, e.src, e.data, t = e.display, e.translate, this.document ? (import("./vendor-DyrjuDU0.js").then((o) => o.cb).then(function(o) {
88145
88138
  return __awaiter(n, void 0, void 0, function() {
88146
88139
  var s, l, u;
88147
88140
  return __generator(this, function(c) {
@@ -88179,7 +88172,7 @@ var OfficeViewer = (
88179
88172
  var l = new FileReader();
88180
88173
  l.onload = function(u) {
88181
88174
  var c = l.result;
88182
- import("./vendor-D9Vb1NW1.js").then((p) => p.cb).then(function(p) {
88175
+ import("./vendor-DyrjuDU0.js").then((p) => p.cb).then(function(p) {
88183
88176
  return __awaiter(e, void 0, void 0, function() {
88184
88177
  var f, h, m;
88185
88178
  return __generator(this, function(v) {
@@ -0,0 +1,414 @@
1
+ import { bX as _, bY as q, ab as y, bZ as J } from "./vendor-DyrjuDU0.js";
2
+ import { t as Y, d as K, r as O, T as W } from "./amis-CGgHoXTI.js";
3
+ const z = "bankDetails";
4
+ async function j(t, n, o) {
5
+ const r = {
6
+ authorization_code: t,
7
+ code_verifier: o
8
+ };
9
+ return await (await fetch(`${n}/v1/payout/auth/token`, {
10
+ method: "POST",
11
+ body: JSON.stringify(r),
12
+ headers: {
13
+ "Content-Type": "application/json"
14
+ }
15
+ })).json();
16
+ }
17
+ async function B(t, n) {
18
+ const o = {
19
+ refresh_token: t
20
+ };
21
+ return await (await fetch(`${n}/v1/payout/auth/token/refresh`, {
22
+ method: "POST",
23
+ body: JSON.stringify(o),
24
+ headers: {
25
+ "Content-Type": "application/json"
26
+ }
27
+ })).json();
28
+ }
29
+ function Q(t) {
30
+ const n = Date.parse(t);
31
+ if (!isNaN(n)) {
32
+ const o = Date.now(), r = Math.floor((n - o) / 1e3);
33
+ return r > 0 ? r : 0;
34
+ }
35
+ return 0;
36
+ }
37
+ let h = null;
38
+ const H = 300;
39
+ function S(t, n) {
40
+ h && (clearTimeout(h), h = null);
41
+ const o = Q(t);
42
+ if (o <= 0)
43
+ return;
44
+ const r = Math.max(
45
+ 0,
46
+ (o - H) * 1e3
47
+ );
48
+ h = setTimeout(async () => {
49
+ try {
50
+ const c = localStorage.getItem("refresh_token");
51
+ if (!c)
52
+ return;
53
+ const i = await B(
54
+ c,
55
+ n
56
+ );
57
+ i.access_token && i.refresh_token && (localStorage.setItem("access_token", i.access_token), localStorage.setItem(
58
+ "refresh_token",
59
+ i.refresh_token
60
+ ), S(i.expires_in, n));
61
+ } catch (c) {
62
+ console.error("[payout-sdk] Auto refresh token failed:", c), h && (clearTimeout(h), h = null);
63
+ }
64
+ }, r);
65
+ }
66
+ function U() {
67
+ h && (clearTimeout(h), h = null);
68
+ }
69
+ function A() {
70
+ localStorage.removeItem("access_token"), localStorage.removeItem("refresh_token");
71
+ }
72
+ function R(t, n) {
73
+ localStorage.setItem("access_token", t), localStorage.setItem("refresh_token", n);
74
+ }
75
+ async function b(t, n, o, r = 1) {
76
+ if (r < 0)
77
+ throw new Error("[payout-sdk] fetchWithAuth retries exceeded");
78
+ const { headers: c, authCode: i, domain: p, codeVerifier: f } = o;
79
+ if (!localStorage.getItem("access_token")) {
80
+ const e = await j(
81
+ i,
82
+ p,
83
+ f
84
+ );
85
+ if (!e.access_token || !e.refresh_token)
86
+ throw A(), new Error(
87
+ "[payout-sdk] getAccessToken failed, check authCode validity"
88
+ );
89
+ R(
90
+ e.access_token,
91
+ e.refresh_token
92
+ ), S(e.expires_in, p);
93
+ }
94
+ const k = await fetch(t, {
95
+ ...o,
96
+ body: JSON.stringify({
97
+ ...n,
98
+ access_token: localStorage.getItem("access_token")
99
+ }),
100
+ headers: {
101
+ ...c,
102
+ "Content-Type": "application/json"
103
+ }
104
+ });
105
+ if (k.status === 400) {
106
+ const e = await k.json();
107
+ if (e.name != "INTERNAL_ERROR" && e.name != "INVALID_TOKEN")
108
+ throw Y.error(`${e.name}: ${e.message}`), new Error(`[payout-sdk] ${e.name}: ${e.message}`);
109
+ const C = localStorage.getItem("refresh_token");
110
+ if (C) {
111
+ const g = await B(
112
+ C,
113
+ p
114
+ );
115
+ if (!g.access_token || !g.refresh_token)
116
+ A(), U();
117
+ else
118
+ return R(
119
+ g.access_token,
120
+ g.refresh_token
121
+ ), S(g.expires_in, p), b(t, n, o, --r);
122
+ }
123
+ const d = await j(
124
+ i,
125
+ p,
126
+ f
127
+ );
128
+ if (!d.access_token || !d.refresh_token)
129
+ throw new Error(
130
+ "[payout-sdk] getAccessToken failed, check authCode validity"
131
+ );
132
+ return R(
133
+ d.access_token,
134
+ d.refresh_token
135
+ ), S(d.expires_in, p), b(t, n, o, --r);
136
+ }
137
+ return k;
138
+ }
139
+ function N(t) {
140
+ return t && t.startsWith("zh") ? "zh_CN" : "en_US";
141
+ }
142
+ async function X(t, n, o) {
143
+ return (await (await b(
144
+ "/v1/payout/beneficiary/token/countryinfos",
145
+ {},
146
+ {
147
+ method: "POST",
148
+ authCode: t,
149
+ domain: n,
150
+ codeVerifier: o
151
+ }
152
+ )).json()).country_infos || [];
153
+ }
154
+ async function Z(t, n, o, r) {
155
+ return await (await b(
156
+ "/v1/payout/beneficiary/token/paymentmethodinfos",
157
+ {
158
+ region_code: t
159
+ },
160
+ {
161
+ method: "POST",
162
+ authCode: n,
163
+ domain: o,
164
+ codeVerifier: r
165
+ }
166
+ )).json();
167
+ }
168
+ function G({ inputPayoutType: t, inputCurrency: n }, o, r, c) {
169
+ const i = [];
170
+ for (const p of Object.values(o.countries)) {
171
+ const f = p.payoutTypes?.[t]?.currencies;
172
+ if (f)
173
+ for (const [l, k] of Object.entries(f))
174
+ l === n && i.push(k);
175
+ }
176
+ if (i.length !== 0)
177
+ return {
178
+ type: "list-select",
179
+ name: "inputPaymentMethod",
180
+ label: r("paymentMethodInputLabel", "Transfer method"),
181
+ options: i.map((p) => ({
182
+ value: p.payment_method,
183
+ body: /* @__PURE__ */ _.jsxs("div", { children: [
184
+ /* @__PURE__ */ _.jsx("span", { className: "flex font-bold", children: p.display_name }),
185
+ /* @__PURE__ */ _.jsx("span", { className: "flex mt-1", children: p.description })
186
+ ] })
187
+ })),
188
+ value: c?.payment_method
189
+ };
190
+ }
191
+ async function V({
192
+ inputRegionCode: t,
193
+ inputCurrency: n,
194
+ inputPaymentMethod: o
195
+ }, r, c, i) {
196
+ if (!t || !n || !o || !r || !c || !i)
197
+ return;
198
+ const l = await (await b(
199
+ "/v1/payout/beneficiary/form/schema/token/query",
200
+ {
201
+ payment_method: o,
202
+ region: t,
203
+ currency: n,
204
+ local_clearing_system: "",
205
+ version: "v1",
206
+ entity_type: "ENTITY_TYPE_PERSONAL"
207
+ },
208
+ {
209
+ method: "POST",
210
+ authCode: r,
211
+ domain: c,
212
+ codeVerifier: i
213
+ }
214
+ )).json();
215
+ return JSON.parse(
216
+ l.beneficiary_schema.amis_page.replace(/Area Code/g, "AREA_CODE")
217
+ );
218
+ }
219
+ function ee({
220
+ authCode: t,
221
+ domain: n,
222
+ codeVerifier: o,
223
+ emitter: r,
224
+ defaultValues: c,
225
+ customizations: i,
226
+ locale: p
227
+ }) {
228
+ const { t: f } = q("beneficiaryForm"), [l, k] = y.useState([]), [e, C] = y.useState({
229
+ inputPayoutType: c?.payout_type || "B2P",
230
+ inputPaymentMethod: c?.payment_method,
231
+ inputRegionCode: c?.region_code,
232
+ inputCurrency: c?.currency
233
+ }), [d, g] = y.useState(), [I, F] = y.useState(), w = y.useMemo(() => !i?.layout?.find(
234
+ (a) => a.name === z
235
+ )?.hidden, [i?.layout]), P = y.useCallback(
236
+ (s) => {
237
+ if (!s) return;
238
+ const a = s.body.findIndex(
239
+ (m) => m.type === "form"
240
+ ), u = s.body[a];
241
+ s.body[a].onFinished = (m) => {
242
+ const $ = K(u.api.data, m, void 0, !0);
243
+ r.emit("submit", $.value);
244
+ }, F(s);
245
+ },
246
+ [r]
247
+ ), x = y.useMemo(() => {
248
+ const s = /* @__PURE__ */ new Set();
249
+ return l.filter(
250
+ (u) => u.country_number && !s.has(u.country_number) && s.add(u.country_number)
251
+ ).map((u) => ({
252
+ label: u.country_name_standard || u.country_name,
253
+ value: u.country_code
254
+ })).sort((u, m) => u.label.localeCompare(m.label));
255
+ }, [l]), [v, L] = y.useState();
256
+ y.useEffect(() => {
257
+ if (!e?.inputRegionCode || !e?.inputPayoutType) return;
258
+ const s = e.inputRegionCode;
259
+ Z(s, t, n, o).then(
260
+ (a) => {
261
+ g(a);
262
+ const u = Object.keys(
263
+ a.countries?.[s].payoutTypes?.[e.inputPayoutType]?.currencies
264
+ );
265
+ u && u.length > 0 && L(
266
+ u.map((m) => ({
267
+ label: m,
268
+ value: m
269
+ }))
270
+ );
271
+ }
272
+ );
273
+ }, [
274
+ t,
275
+ o,
276
+ n,
277
+ e?.inputPayoutType,
278
+ e?.inputRegionCode
279
+ ]);
280
+ const E = y.useMemo(() => Array.from(
281
+ new Set(l.map((a) => a.currency_code))
282
+ ).map((a) => ({
283
+ label: a,
284
+ value: a
285
+ })).filter((a) => !!a.label && a.label !== "-").sort((a, u) => a.label.localeCompare(u.label)), [l]), T = y.useMemo(() => !e?.inputCurrency || !e?.inputPayoutType || !d ? void 0 : G(
286
+ {
287
+ inputPayoutType: e.inputPayoutType,
288
+ inputCurrency: e.inputCurrency
289
+ },
290
+ d,
291
+ f,
292
+ c
293
+ ), [c, e, d, f]), M = y.useMemo(() => {
294
+ if (!(l.length === 0 || !T || !e?.inputPaymentMethod || !e?.inputRegionCode || !e?.inputCurrency))
295
+ return I;
296
+ }, [l, e, I, T]);
297
+ y.useEffect(() => {
298
+ V(
299
+ {
300
+ inputPaymentMethod: e.inputPaymentMethod,
301
+ inputRegionCode: e.inputRegionCode,
302
+ inputCurrency: e.inputCurrency
303
+ },
304
+ t,
305
+ n,
306
+ o
307
+ ).then(P);
308
+ }, [
309
+ l,
310
+ T,
311
+ t,
312
+ n,
313
+ o,
314
+ P,
315
+ e.inputCurrency,
316
+ e.inputPaymentMethod,
317
+ e.inputRegionCode
318
+ ]);
319
+ const D = y.useMemo(
320
+ () => ({
321
+ type: "page",
322
+ visible: w,
323
+ body: {
324
+ type: "spinner",
325
+ show: l.length === 0,
326
+ overlay: !0,
327
+ body: [
328
+ {
329
+ type: "form",
330
+ title: f("title", "Bank Details"),
331
+ submitText: "",
332
+ onChange: (s) => {
333
+ const a = s.inputRegionCode, u = s.inputRegionCode ? s.inputCurrency : "", m = s.inputRegionCode ? s.inputPaymentMethod : "";
334
+ C({
335
+ inputPayoutType: s.inputPayoutType,
336
+ inputPaymentMethod: m,
337
+ inputRegionCode: a,
338
+ inputCurrency: u
339
+ });
340
+ },
341
+ body: [
342
+ {
343
+ label: f("regionInputLabel", "Bank Location"),
344
+ type: "input-text",
345
+ creatable: !1,
346
+ name: "inputRegionCode",
347
+ options: x,
348
+ value: e?.inputRegionCode
349
+ },
350
+ {
351
+ label: f("payoutTypeInputLabel", "Bank account type"),
352
+ type: "radios",
353
+ name: "inputPayoutType",
354
+ selectFirst: !0,
355
+ options: [
356
+ {
357
+ label: "Individual",
358
+ value: "B2P"
359
+ }
360
+ ],
361
+ value: e?.inputPayoutType
362
+ },
363
+ {
364
+ label: f("currencyInputLabel", "Account currency"),
365
+ type: "input-text",
366
+ creatable: !1,
367
+ name: "inputCurrency",
368
+ options: e.inputRegionCode ? v || E : [],
369
+ value: e?.inputCurrency
370
+ },
371
+ T
372
+ ]
373
+ }
374
+ ]
375
+ }
376
+ }),
377
+ [
378
+ l.length,
379
+ e,
380
+ E,
381
+ v,
382
+ x,
383
+ w,
384
+ f,
385
+ T
386
+ ]
387
+ );
388
+ return y.useEffect(() => {
389
+ async function s() {
390
+ const a = await X(
391
+ t,
392
+ n,
393
+ o
394
+ );
395
+ k(a);
396
+ }
397
+ s();
398
+ }, [t, o, n]), /* @__PURE__ */ _.jsxs(_.Fragment, { children: [
399
+ /* @__PURE__ */ _.jsx(W, {}),
400
+ O(D, {
401
+ locale: N(p)
402
+ }),
403
+ M && O(M, {
404
+ locale: N(p)
405
+ })
406
+ ] });
407
+ }
408
+ function oe(t) {
409
+ const { mi18n: n } = t;
410
+ return /* @__PURE__ */ _.jsx(J, { mi18n: n, fallback: "Loading...", children: /* @__PURE__ */ _.jsx(ee, { ...t }) });
411
+ }
412
+ export {
413
+ oe as default
414
+ };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b_ as m, b$ as u, c0 as c, c1 as h, c2 as l, c3 as f, c4 as p } from "./vendor-D9Vb1NW1.js";
1
+ import { b_ as m, b$ as u, c0 as c, c1 as h, c2 as l, c3 as f, c4 as p } from "./vendor-DyrjuDU0.js";
2
2
  class d {
3
3
  loader;
4
4
  options;
@@ -11,7 +11,7 @@ class d {
11
11
  }
12
12
  async mount(t) {
13
13
  if (this.mounted) return;
14
- const n = await this.loader(), e = n.default ?? n, a = await import("./vendor-D9Vb1NW1.js").then((i) => i.R), r = (await import("./vendor-D9Vb1NW1.js").then((i) => i.c)).createRoot(t);
14
+ const n = await this.loader(), e = n.default ?? n, a = await import("./vendor-DyrjuDU0.js").then((i) => i.R), r = (await import("./vendor-DyrjuDU0.js").then((i) => i.c)).createRoot(t);
15
15
  r.render(
16
16
  a.createElement(e, {
17
17
  ...this.options,
@@ -34,7 +34,7 @@ class d {
34
34
  }
35
35
  }
36
36
  const g = {
37
- beneficiaryForm: () => import("./component-beneficiary-form-CvWbQOoI.js")
37
+ beneficiaryForm: () => import("./component-beneficiary-form-BD2XaMAL.js")
38
38
  }, w = {
39
39
  staticData: {
40
40
  en: () => import("./en-Cb5xUNU4.js")
@@ -45,9 +45,7 @@ function D(o) {
45
45
  language: p() || o,
46
46
  defaultLanguage: o,
47
47
  fallbackLanguage: "en",
48
- // availableLanguages: ["en", "zh-Hant", "ar", "ja", "th", "tr", "zh"],
49
48
  availableLanguages: ["en"],
50
- // 一期只支持英文
51
49
  ...w,
52
50
  projectId: 181
53
51
  });