@txgw/payout-components 0.2.1 → 0.2.3

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/index.js CHANGED
@@ -1,66 +1,87 @@
1
- import { c4 as a } from "./vendor-fKhExfo_.js";
2
- class c {
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
+ class d {
3
3
  loader;
4
4
  options;
5
5
  mounted = !1;
6
6
  root;
7
7
  emitter;
8
- constructor(t, o) {
9
- this.loader = t, this.options = o, this.emitter = a(), this.root = null;
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 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
- s.render(
15
- m.createElement(e, {
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
+ 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 = s, this.mounted = !0;
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, o) {
25
- return t === "*" ? this.emitter.on(t, o) : this.emitter.on(t, o);
26
+ on(t, n) {
27
+ return t === "*" ? this.emitter.on(t, n) : this.emitter.on(t, n);
26
28
  }
27
- off(t, o) {
28
- return t === "*" ? this.emitter.off(t, o) : this.emitter.off(t, o);
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 u = {
35
- beneficiaryForm: () => import("./component-beneficiary-form-DIpi8Ma-.js")
36
+ const g = {
37
+ beneficiaryForm: () => import("./component-beneficiary-form-CoKMkl0U.js")
38
+ }, w = {
39
+ staticData: {
40
+ en: () => import("./en-Cb5xUNU4.js")
41
+ }
36
42
  };
37
- class h {
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"],
49
+ ...w,
50
+ projectId: 181
51
+ });
52
+ }
53
+ class E {
38
54
  options;
55
+ mi18n;
39
56
  components = {};
40
57
  constructor(t) {
41
- this.options = t;
58
+ this.options = t, this.mi18n = D(this.options?.locale || "en");
42
59
  }
43
- createElement(t, o) {
60
+ createElement(t, n) {
44
61
  if (!this.options)
45
62
  throw new Error("[payout-sdk] options are not initialized");
46
- const e = u[t];
63
+ const e = g[t];
47
64
  if (!e)
48
65
  throw new Error(`[payout-sdk] component ${t} not found`);
49
- return this.components[t] ? this.components[t] : (this.components[t] = new c(e, {
50
- ...this.options,
51
- ...o
52
- }), this.components[t]);
66
+ return this.components[t] ? this.components[t] : (this.components[t] = new d(
67
+ e,
68
+ {
69
+ ...this.options,
70
+ ...n
71
+ },
72
+ this.mi18n
73
+ ), this.components[t]);
53
74
  }
54
75
  }
55
- let r = null;
56
- function d(n) {
57
- r = new h(n);
76
+ let s = null;
77
+ function S(o) {
78
+ s = new E(o);
58
79
  }
59
- function p(n, t) {
60
- if (!r) throw new Error("[payout-sdk] SDK is not initialized");
61
- return r.createElement(n, t);
80
+ function L(o, t) {
81
+ if (!s) throw new Error("[payout-sdk] SDK is not initialized");
82
+ return s.createElement(o, t);
62
83
  }
63
84
  export {
64
- p as createElement,
65
- d as init
85
+ L as createElement,
86
+ S as init
66
87
  };