@txgw/payout-components 0.2.0 → 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.
- package/dist/{amis-CjYQbrSm.js → amis-CLFtZoO7.js} +26 -26
- package/dist/component-beneficiary-form-CvWbQOoI.js +359 -0
- package/dist/en-Cb5xUNU4.js +7 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +54 -31
- package/dist/{vendor-fKhExfo_.js → vendor-D9Vb1NW1.js} +1399 -1400
- package/package.json +9 -12
- package/dist/component-beneficiary-form-ZOQLPYQM.js +0 -344
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"
|
|
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
|
-
|
|
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;
|
package/dist/index.js
CHANGED
|
@@ -1,66 +1,89 @@
|
|
|
1
|
-
import { c4 as
|
|
2
|
-
class
|
|
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";
|
|
2
|
+
class d {
|
|
3
3
|
loader;
|
|
4
4
|
options;
|
|
5
5
|
mounted = !1;
|
|
6
6
|
root;
|
|
7
7
|
emitter;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
mi18n;
|
|
9
|
+
constructor(t, n, e) {
|
|
10
|
+
this.loader = t, this.options = n, this.emitter = m(), this.mi18n = e, this.root = null;
|
|
10
11
|
}
|
|
11
12
|
async mount(t) {
|
|
12
13
|
if (this.mounted) return;
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
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);
|
|
15
|
+
r.render(
|
|
16
|
+
a.createElement(e, {
|
|
16
17
|
...this.options,
|
|
17
|
-
emitter: this.emitter
|
|
18
|
+
emitter: this.emitter,
|
|
19
|
+
mi18n: this.mi18n
|
|
18
20
|
})
|
|
19
|
-
), this.root =
|
|
21
|
+
), this.root = r, this.mounted = !0;
|
|
20
22
|
}
|
|
21
23
|
unmount() {
|
|
22
24
|
this.root && (this.root.unmount(), this.root = null), this.mounted = !1;
|
|
23
25
|
}
|
|
24
|
-
on(t,
|
|
25
|
-
return t === "*" ? this.emitter.on(t,
|
|
26
|
+
on(t, n) {
|
|
27
|
+
return t === "*" ? this.emitter.on(t, n) : this.emitter.on(t, n);
|
|
26
28
|
}
|
|
27
|
-
off(t,
|
|
28
|
-
return t === "*" ? this.emitter.off(t,
|
|
29
|
+
off(t, n) {
|
|
30
|
+
return t === "*" ? this.emitter.off(t, n) : this.emitter.off(t, n);
|
|
29
31
|
}
|
|
30
32
|
isMounted() {
|
|
31
33
|
return this.mounted;
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
|
-
const
|
|
35
|
-
beneficiaryForm: () => import("./component-beneficiary-form-
|
|
36
|
+
const g = {
|
|
37
|
+
beneficiaryForm: () => import("./component-beneficiary-form-CvWbQOoI.js")
|
|
38
|
+
}, w = {
|
|
39
|
+
staticData: {
|
|
40
|
+
en: () => import("./en-Cb5xUNU4.js")
|
|
41
|
+
}
|
|
36
42
|
};
|
|
37
|
-
|
|
43
|
+
function D(o) {
|
|
44
|
+
return u().use(c()).use(h()).use(l()).use(f()).init({
|
|
45
|
+
language: p() || o,
|
|
46
|
+
defaultLanguage: o,
|
|
47
|
+
fallbackLanguage: "en",
|
|
48
|
+
// availableLanguages: ["en", "zh-Hant", "ar", "ja", "th", "tr", "zh"],
|
|
49
|
+
availableLanguages: ["en"],
|
|
50
|
+
// 一期只支持英文
|
|
51
|
+
...w,
|
|
52
|
+
projectId: 181
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
class E {
|
|
38
56
|
options;
|
|
57
|
+
mi18n;
|
|
39
58
|
components = {};
|
|
40
59
|
constructor(t) {
|
|
41
|
-
this.options = t;
|
|
60
|
+
this.options = t, this.mi18n = D(this.options?.locale || "en");
|
|
42
61
|
}
|
|
43
|
-
createElement(t,
|
|
62
|
+
createElement(t, n) {
|
|
44
63
|
if (!this.options)
|
|
45
64
|
throw new Error("[payout-sdk] options are not initialized");
|
|
46
|
-
const e =
|
|
65
|
+
const e = g[t];
|
|
47
66
|
if (!e)
|
|
48
67
|
throw new Error(`[payout-sdk] component ${t} not found`);
|
|
49
|
-
return this.components[t] ? this.components[t] : (this.components[t] = new
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
68
|
+
return this.components[t] ? this.components[t] : (this.components[t] = new d(
|
|
69
|
+
e,
|
|
70
|
+
{
|
|
71
|
+
...this.options,
|
|
72
|
+
...n
|
|
73
|
+
},
|
|
74
|
+
this.mi18n
|
|
75
|
+
), this.components[t]);
|
|
53
76
|
}
|
|
54
77
|
}
|
|
55
|
-
let
|
|
56
|
-
function
|
|
57
|
-
|
|
78
|
+
let s = null;
|
|
79
|
+
function S(o) {
|
|
80
|
+
s = new E(o);
|
|
58
81
|
}
|
|
59
|
-
function
|
|
60
|
-
if (!
|
|
61
|
-
return
|
|
82
|
+
function L(o, t) {
|
|
83
|
+
if (!s) throw new Error("[payout-sdk] SDK is not initialized");
|
|
84
|
+
return s.createElement(o, t);
|
|
62
85
|
}
|
|
63
86
|
export {
|
|
64
|
-
|
|
65
|
-
|
|
87
|
+
L as createElement,
|
|
88
|
+
S as init
|
|
66
89
|
};
|