@txgw/payout-components 0.2.1 → 0.2.2

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-fKhExfo_.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-D9Vb1NW1.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-fKhExfo_.js").then((i) => i.m).then(importLazyComponent);
5248
+ return import("./vendor-D9Vb1NW1.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-fKhExfo_.js").then((k) => k.p).then(function(k) {
9811
+ return import("./vendor-D9Vb1NW1.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-fKhExfo_.js").then((t) => t.c5).then(function(t) {
27146
+ window.__amis_monaco_editor_locale = this.props.locale, import("./vendor-D9Vb1NW1.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-fKhExfo_.js").then((c) => c.a)];
36060
+ return [4, import("./vendor-D9Vb1NW1.js").then((c) => c.a)];
36061
36061
  case 1:
36062
- return s = u.sent().default, [4, import("./vendor-fKhExfo_.js").then((c) => c.j)];
36062
+ return s = u.sent().default, [4, import("./vendor-D9Vb1NW1.js").then((c) => c.j)];
36063
36063
  case 2:
36064
- return u.sent(), [4, import("./vendor-fKhExfo_.js").then((c) => c.h)];
36064
+ return u.sent(), [4, import("./vendor-D9Vb1NW1.js").then((c) => c.h)];
36065
36065
  case 3:
36066
- return u.sent(), [4, import("./vendor-fKhExfo_.js").then((c) => c.s)];
36066
+ return u.sent(), [4, import("./vendor-D9Vb1NW1.js").then((c) => c.s)];
36067
36067
  case 4:
36068
- return u.sent(), [4, import("./vendor-fKhExfo_.js").then((c) => c.b)];
36068
+ return u.sent(), [4, import("./vendor-D9Vb1NW1.js").then((c) => c.b)];
36069
36069
  case 5:
36070
- return u.sent(), [4, import("./vendor-fKhExfo_.js").then((c) => c.d)];
36070
+ return u.sent(), [4, import("./vendor-D9Vb1NW1.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-fKhExfo_.js").then((u) => u.e).then(function(u) {
49450
+ r.update({ exportExcelLoading: !0 }), import("./vendor-D9Vb1NW1.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-fKhExfo_.js").then((u) => u.e).then(function(u) {
49483
+ import("./vendor-D9Vb1NW1.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-fKhExfo_.js").then((i) => i.c6);
52764
+ return import("./vendor-D9Vb1NW1.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-fKhExfo_.js").then((h) => h.c7)] : [3, 4];
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];
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-fKhExfo_.js").then((_) => _.e)];
73750
+ return v.trys.push([1, 4, , 5]), [4, import("./vendor-D9Vb1NW1.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-fKhExfo_.js").then((i) => i.m).then(importLazyComponent);
80707
+ return import("./vendor-D9Vb1NW1.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-fKhExfo_.js").then((v) => v.c8),
81668
- import("./vendor-fKhExfo_.js").then((v) => v.i),
81667
+ import("./vendor-D9Vb1NW1.js").then((v) => v.c8),
81668
+ import("./vendor-D9Vb1NW1.js").then((v) => v.i),
81669
81669
  // @ts-ignore 官方没提供 type
81670
- import("./vendor-fKhExfo_.js").then((v) => v.c9),
81670
+ import("./vendor-D9Vb1NW1.js").then((v) => v.c9),
81671
81671
  // @ts-ignore 官方没提供 type
81672
- import("./vendor-fKhExfo_.js").then((v) => v.ca),
81672
+ import("./vendor-D9Vb1NW1.js").then((v) => v.ca),
81673
81673
  // @ts-ignore 官方没提供 type
81674
- import("./vendor-fKhExfo_.js").then((v) => v.f)
81674
+ import("./vendor-D9Vb1NW1.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-fKhExfo_.js").then((f) => f.g).then(function(f) {
82631
+ import("./vendor-D9Vb1NW1.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-fKhExfo_.js").then((u) => u.k).then(function(u) {
82691
+ import("./vendor-D9Vb1NW1.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-fKhExfo_.js").then((t) => t.c5).then(function(t) {
86125
+ import("./vendor-D9Vb1NW1.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-fKhExfo_.js").then((o) => o.cb).then(function(o) {
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) {
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-fKhExfo_.js").then((p) => p.cb).then(function(p) {
88182
+ import("./vendor-D9Vb1NW1.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) {
@@ -1,16 +1,16 @@
1
- import { bX as d, bY as B, ab as c, bZ as N, b_ as F, b$ as q, c0 as z, c1 as $, c2 as D, c3 as J } from "./vendor-fKhExfo_.js";
2
- import { t as Y, d as K, r as M, T as W } from "./amis-CjYQbrSm.js";
3
- const Q = "bankDetails";
1
+ import { bX as d, bY as N, ab as i, bZ as L } from "./vendor-D9Vb1NW1.js";
2
+ import { t as F, d as $, r as E, T as q } from "./amis-CLFtZoO7.js";
3
+ const D = "bankDetails";
4
4
  async function b(t, n, o, u = 1) {
5
5
  if (u < 0)
6
6
  throw new Error("[payout-sdk] fetchWithAuth retries exceeded");
7
- const { headers: s, authCode: m, domain: l, codeVerifier: y } = o, p = localStorage.getItem("access_token");
7
+ const { headers: s, authCode: l, domain: f, codeVerifier: y } = o, p = localStorage.getItem("access_token");
8
8
  if (p)
9
9
  n.access_token = p;
10
10
  else {
11
- const e = await j(
12
- m,
11
+ const e = await M(
13
12
  l,
13
+ f,
14
14
  y
15
15
  );
16
16
  if (!e.access_token || !e.refresh_token)
@@ -19,7 +19,7 @@ async function b(t, n, o, u = 1) {
19
19
  );
20
20
  n.access_token = e.access_token, localStorage.setItem("access_token", e.access_token), localStorage.setItem("refresh_token", e.refresh_token);
21
21
  }
22
- const g = await fetch(t, {
22
+ const _ = await fetch(t, {
23
23
  ...o,
24
24
  body: JSON.stringify(n),
25
25
  headers: {
@@ -27,38 +27,38 @@ async function b(t, n, o, u = 1) {
27
27
  "Content-Type": "application/json"
28
28
  }
29
29
  });
30
- if (g.status === 400) {
31
- const e = await g.json();
30
+ if (_.status === 400) {
31
+ const e = await _.json();
32
32
  if (e.name != "INTERNAL_ERROR")
33
- throw Y.error(`${e.name}: ${e.message}`), new Error(`[payout-sdk] ${e.name}: ${e.message}`);
33
+ throw F.error(`${e.name}: ${e.message}`), new Error(`[payout-sdk] ${e.name}: ${e.message}`);
34
34
  const k = localStorage.getItem("refresh_token");
35
35
  if (k) {
36
- const _ = await U(
36
+ const g = await J(
37
37
  k,
38
- l
38
+ f
39
39
  );
40
- if (!_.access_token || !_.refresh_token)
40
+ if (!g.access_token || !g.refresh_token)
41
41
  localStorage.removeItem("access_token"), localStorage.removeItem("refresh_token");
42
42
  else
43
43
  return localStorage.setItem(
44
44
  "refresh_token",
45
- _.refresh_token
46
- ), localStorage.setItem("access_token", _.access_token), b(t, n, o, --u);
45
+ g.refresh_token
46
+ ), localStorage.setItem("access_token", g.access_token), b(t, n, o, --u);
47
47
  }
48
- const f = await j(
49
- m,
48
+ const m = await M(
50
49
  l,
50
+ f,
51
51
  y
52
52
  );
53
- if (!f.access_token || !f.refresh_token)
53
+ if (!m.access_token || !m.refresh_token)
54
54
  throw new Error(
55
55
  "[payout-sdk] getAccessToken failed, check authCode validity"
56
56
  );
57
- return localStorage.setItem("refresh_token", f.refresh_token), localStorage.setItem("access_token", f.access_token), b(t, n, o, --u);
57
+ return localStorage.setItem("refresh_token", m.refresh_token), localStorage.setItem("access_token", m.access_token), b(t, n, o, --u);
58
58
  }
59
- return g;
59
+ return _;
60
60
  }
61
- async function j(t, n, o) {
61
+ async function M(t, n, o) {
62
62
  const u = {
63
63
  authorization_code: t,
64
64
  code_verifier: o
@@ -71,7 +71,7 @@ async function j(t, n, o) {
71
71
  }
72
72
  })).json();
73
73
  }
74
- async function U(t, n) {
74
+ async function J(t, n) {
75
75
  const o = {
76
76
  refresh_token: t
77
77
  };
@@ -83,10 +83,10 @@ async function U(t, n) {
83
83
  }
84
84
  })).json();
85
85
  }
86
- function E(t) {
86
+ function O(t) {
87
87
  return t && t.startsWith("zh") ? "zh_CN" : "en_US";
88
88
  }
89
- async function H(t, n, o) {
89
+ async function Y(t, n, o) {
90
90
  return (await (await b(
91
91
  "/v1/payout/beneficiary/token/countryinfos",
92
92
  {},
@@ -98,7 +98,7 @@ async function H(t, n, o) {
98
98
  }
99
99
  )).json()).country_infos || [];
100
100
  }
101
- async function X(t, n, o, u) {
101
+ async function W(t, n, o, u) {
102
102
  return await (await b(
103
103
  "/v1/payout/beneficiary/token/paymentmethodinfos",
104
104
  {
@@ -112,34 +112,34 @@ async function X(t, n, o, u) {
112
112
  }
113
113
  )).json();
114
114
  }
115
- function Z({ inputPayoutType: t, inputCurrency: n }, o, u, s) {
116
- const m = [];
117
- for (const l of Object.values(o.countries)) {
118
- const y = l.payoutTypes?.[t]?.currencies;
115
+ function z({ inputPayoutType: t, inputCurrency: n }, o, u, s) {
116
+ const l = [];
117
+ for (const f of Object.values(o.countries)) {
118
+ const y = f.payoutTypes?.[t]?.currencies;
119
119
  if (y)
120
- for (const [p, g] of Object.entries(y))
121
- p === n && m.push(g);
120
+ for (const [p, _] of Object.entries(y))
121
+ p === n && l.push(_);
122
122
  }
123
- if (m.length !== 0)
123
+ if (l.length !== 0)
124
124
  return {
125
125
  type: "list-select",
126
126
  name: "inputPaymentMethod",
127
127
  label: u("paymentMethodInputLabel", "Transfer method"),
128
- options: m.map((l) => ({
129
- value: l.payment_method,
128
+ options: l.map((f) => ({
129
+ value: f.payment_method,
130
130
  body: /* @__PURE__ */ d.jsxs("div", { children: [
131
- /* @__PURE__ */ d.jsx("span", { className: "flex font-bold", children: l.display_name }),
132
- /* @__PURE__ */ d.jsx("span", { className: "flex mt-1", children: l.description })
131
+ /* @__PURE__ */ d.jsx("span", { className: "flex font-bold", children: f.display_name }),
132
+ /* @__PURE__ */ d.jsx("span", { className: "flex mt-1", children: f.description })
133
133
  ] })
134
134
  })),
135
135
  value: s?.payment_method
136
136
  };
137
137
  }
138
- async function G({
138
+ async function K({
139
139
  inputRegionCode: t,
140
140
  inputCurrency: n,
141
141
  inputPaymentMethod: o
142
- }, u, s, m) {
142
+ }, u, s, l) {
143
143
  const p = await (await b(
144
144
  "/v1/payout/beneficiary/form/schema/token/query",
145
145
  {
@@ -154,55 +154,55 @@ async function G({
154
154
  method: "POST",
155
155
  authCode: u,
156
156
  domain: s,
157
- codeVerifier: m
157
+ codeVerifier: l
158
158
  }
159
159
  )).json();
160
160
  return JSON.parse(
161
161
  p.beneficiary_schema.amis_page.replace(/Area Code/g, "AREA_CODE")
162
162
  );
163
163
  }
164
- function V({
164
+ function Q({
165
165
  authCode: t,
166
166
  domain: n,
167
167
  codeVerifier: o,
168
168
  emitter: u,
169
169
  defaultValues: s,
170
- customizations: m,
171
- locale: l
170
+ customizations: l,
171
+ locale: f
172
172
  }) {
173
- const { t: y } = B("beneficiaryForm"), [p, g] = c.useState([]), [e, k] = c.useState(), [f, _] = c.useState(), [S, C] = c.useState(), [T, O] = c.useState(), v = c.useMemo(() => !m?.layout?.find(
174
- (r) => r.name === Q
175
- )?.hidden, [m?.layout]), I = c.useCallback(
176
- (a) => {
177
- const r = a.body.findIndex(
173
+ const { t: y } = N("beneficiaryForm"), [p, _] = i.useState([]), [e, k] = i.useState(), [m, g] = i.useState(), [S, C] = i.useState(), [T, j] = i.useState(), v = i.useMemo(() => !l?.layout?.find(
174
+ (a) => a.name === D
175
+ )?.hidden, [l?.layout]), I = i.useCallback(
176
+ (r) => {
177
+ const a = r.body.findIndex(
178
178
  (h) => h.type === "form"
179
- ), i = a.body[r];
180
- a.body[r].onFinished = (h) => {
181
- const L = K(i.api.data, h, void 0, !0);
182
- u.emit("submit", L.value);
183
- }, O(a);
179
+ ), c = r.body[a];
180
+ r.body[a].onFinished = (h) => {
181
+ const B = $(c.api.data, h, void 0, !0);
182
+ u.emit("submit", B.value);
183
+ }, j(r);
184
184
  },
185
185
  [u]
186
- ), w = c.useMemo(() => {
187
- const a = /* @__PURE__ */ new Set();
186
+ ), w = i.useMemo(() => {
187
+ const r = /* @__PURE__ */ new Set();
188
188
  return p.filter(
189
- (i) => i.country_number && !a.has(i.country_number) && a.add(i.country_number)
190
- ).map((i) => ({
191
- label: i.country_name_standard || i.country_name,
192
- value: i.country_code
193
- })).sort((i, h) => i.label.localeCompare(h.label));
194
- }, [p]), [P, x] = c.useState();
195
- c.useEffect(() => {
189
+ (c) => c.country_number && !r.has(c.country_number) && r.add(c.country_number)
190
+ ).map((c) => ({
191
+ label: c.country_name_standard || c.country_name,
192
+ value: c.country_code
193
+ })).sort((c, h) => c.label.localeCompare(h.label));
194
+ }, [p]), [P, x] = i.useState();
195
+ i.useEffect(() => {
196
196
  if (!e?.inputRegionCode || !e?.inputPayoutType) return;
197
- const a = e.inputRegionCode;
198
- X(a, t, n, o).then(
199
- (r) => {
200
- _(r);
201
- const i = Object.keys(
202
- r.countries?.[a].payoutTypes?.[e.inputPayoutType]?.currencies
197
+ const r = e.inputRegionCode;
198
+ W(r, t, n, o).then(
199
+ (a) => {
200
+ g(a);
201
+ const c = Object.keys(
202
+ a.countries?.[r].payoutTypes?.[e.inputPayoutType]?.currencies
203
203
  );
204
- i && i.length > 0 && x(
205
- i.map((h) => ({
204
+ c && c.length > 0 && x(
205
+ c.map((h) => ({
206
206
  label: h,
207
207
  value: h
208
208
  }))
@@ -216,26 +216,26 @@ function V({
216
216
  e?.inputPayoutType,
217
217
  e?.inputRegionCode
218
218
  ]);
219
- const R = c.useMemo(() => Array.from(
220
- new Set(p.map((r) => r.currency_code))
221
- ).map((r) => ({
222
- label: r,
223
- value: r
224
- })).filter((r) => !!r.label && r.label !== "-").sort((r, i) => r.label.localeCompare(i.label)), [p]);
225
- c.useEffect(() => {
226
- if (!f || !e) return;
227
- const a = Z(
219
+ const R = i.useMemo(() => Array.from(
220
+ new Set(p.map((a) => a.currency_code))
221
+ ).map((a) => ({
222
+ label: a,
223
+ value: a
224
+ })).filter((a) => !!a.label && a.label !== "-").sort((a, c) => a.label.localeCompare(c.label)), [p]);
225
+ i.useEffect(() => {
226
+ if (!m || !e) return;
227
+ const r = z(
228
228
  {
229
229
  inputPayoutType: e.inputPayoutType,
230
230
  inputCurrency: e.inputCurrency
231
231
  },
232
- f,
232
+ m,
233
233
  y,
234
234
  s
235
235
  );
236
- C(a);
237
- }, [s, e, f, y]), c.useEffect(() => {
238
- p.length !== 0 && S && e?.inputPaymentMethod && e?.inputRegionCode && e?.inputCurrency && G(
236
+ C(r);
237
+ }, [s, e, m, y]), i.useEffect(() => {
238
+ p.length !== 0 && S && e?.inputPaymentMethod && e?.inputRegionCode && e?.inputCurrency && K(
239
239
  {
240
240
  inputPaymentMethod: e.inputPaymentMethod,
241
241
  inputRegionCode: e.inputRegionCode,
@@ -244,7 +244,7 @@ function V({
244
244
  t,
245
245
  n,
246
246
  o
247
- ).then((a) => a && I(a));
247
+ ).then((r) => r && I(r));
248
248
  }, [
249
249
  p,
250
250
  S,
@@ -255,9 +255,9 @@ function V({
255
255
  e?.inputRegionCode,
256
256
  e?.inputCurrency,
257
257
  I
258
- ]), c.useEffect(() => {
258
+ ]), i.useEffect(() => {
259
259
  e?.inputCurrency || C(void 0);
260
- }, [e?.inputCurrency]), c.useEffect(() => {
260
+ }, [e?.inputCurrency]), i.useEffect(() => {
261
261
  s && k({
262
262
  inputPayoutType: s.payout_type || "B2P",
263
263
  inputPaymentMethod: s.payment_method,
@@ -265,7 +265,7 @@ function V({
265
265
  inputCurrency: s.currency
266
266
  });
267
267
  }, [s]);
268
- const A = c.useMemo(
268
+ const A = i.useMemo(
269
269
  () => ({
270
270
  type: "page",
271
271
  visible: v,
@@ -278,8 +278,8 @@ function V({
278
278
  type: "form",
279
279
  title: y("title", "Bank Details"),
280
280
  submitText: "",
281
- onChange: (a) => {
282
- k(a);
281
+ onChange: (r) => {
282
+ k(r);
283
283
  },
284
284
  body: [
285
285
  {
@@ -330,41 +330,30 @@ function V({
330
330
  S
331
331
  ]
332
332
  );
333
- return c.useEffect(() => {
334
- async function a() {
335
- const r = await H(
333
+ return i.useEffect(() => {
334
+ async function r() {
335
+ const a = await Y(
336
336
  t,
337
337
  n,
338
338
  o
339
339
  );
340
- g(r);
340
+ _(a);
341
341
  }
342
- a();
342
+ r();
343
343
  }, [t, o, n]), /* @__PURE__ */ d.jsxs(d.Fragment, { children: [
344
- /* @__PURE__ */ d.jsx(W, {}),
345
- M(A, {
346
- locale: E(l)
344
+ /* @__PURE__ */ d.jsx(q, {}),
345
+ E(A, {
346
+ locale: O(f)
347
347
  }),
348
- T && M(T, {
349
- locale: E(l)
348
+ T && E(T, {
349
+ locale: O(f)
350
350
  })
351
351
  ] });
352
352
  }
353
- function ne(t) {
354
- const { locale: n = "en" } = t, o = c.useMemo(
355
- () => N().use(F()).use(q()).use(z()).use($()).init({
356
- language: D() || n,
357
- defaultLanguage: n,
358
- fallbackLanguage: "en",
359
- availableLanguages: ["en", "zh-Hant", "ar", "ja", "th", "tr", "zh"],
360
- apiUrl: "https://admin.midasbuy.com/i18n/api",
361
- apiKey: "tgpak_gm2tqxzygnpvsokipayuqz2yhb4hszcvkzsq",
362
- projectId: 181
363
- }),
364
- [n]
365
- );
366
- return /* @__PURE__ */ d.jsx(J, { mi18n: o, fallback: "Loading...", children: /* @__PURE__ */ d.jsx(V, { ...t }) });
353
+ function Z(t) {
354
+ const { mi18n: n } = t;
355
+ return /* @__PURE__ */ d.jsx(L, { mi18n: n, fallback: "Loading...", children: /* @__PURE__ */ d.jsx(Q, { ...t }) });
367
356
  }
368
357
  export {
369
- ne as default
358
+ Z as default
370
359
  };
@@ -0,0 +1,7 @@
1
+ const e = { beneficiaryForm: { title: "Bank Details", regionInputLabel: "Bank Location", payoutTypeInputLabel: "Bank account type", currencyInputLabel: "Account currency", paymentMethodInputLabel: "Transfer method" } }, n = {
2
+ en: e
3
+ };
4
+ export {
5
+ n as default,
6
+ e as en
7
+ };
package/dist/index.d.ts CHANGED
@@ -4,12 +4,14 @@ import { Emitter } from 'mitt';
4
4
  import { EventType } from 'mitt';
5
5
  import { Handler } from 'mitt';
6
6
  import { JSX as JSX_2 } from 'react/jsx-runtime';
7
+ import { Mi18nInstance } from '@mi18n/react';
7
8
  import { WildcardHandler } from 'mitt';
8
9
 
9
10
  declare const BANK_DETAILS_FORM_KEY = "bankDetails";
10
11
 
11
12
  declare interface BaseProps<T extends keyof typeof ElementsMap> extends InitOptions {
12
13
  emitter: Emitter<Events<T>>;
14
+ mi18n: Mi18nInstance;
13
15
  }
14
16
 
15
17
  declare function BeneficiaryForm(props: Props): JSX_2.Element;
@@ -85,7 +87,7 @@ declare interface LayoutSection {
85
87
  hidden?: boolean;
86
88
  }
87
89
 
88
- declare type Locale = "en" | "zh-Hant" | "ar" | "ja" | "th" | "tr" | "zh";
90
+ declare type Locale = "en";
89
91
 
90
92
  declare type PayoutType = "B2P";
91
93
 
@@ -100,7 +102,8 @@ declare class SDKComponent<T extends keyof typeof ElementsMap> {
100
102
  private mounted;
101
103
  private root;
102
104
  private emitter;
103
- constructor(loader: (typeof ElementsMap)[T], options: InitOptions);
105
+ private mi18n;
106
+ constructor(loader: (typeof ElementsMap)[T], options: InitOptions, mi18n: Mi18nInstance);
104
107
  mount(container: Element): Promise<void>;
105
108
  unmount(): void;
106
109
  on(type: keyof Events<T>, handler: Handler<EventsData<T>>): void;