@incodetech/web 0.0.0-dev-20260313-bc2dab4 → 0.0.0-dev-20260316-0522f9e
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/addressAutocomplete-CL7IcYGQ.js +151 -0
- package/dist/ekyb/styles.css +4 -0
- package/dist/ekybModule-CV7jE8qz.js +299 -0
- package/dist/ekycModule-CmD1wsRS.js +245 -0
- package/dist/extensibility.es.js +1 -1
- package/dist/flow/flow.es.js +145 -137
- package/dist/flow/styles.css +4 -0
- package/dist/formField-B2HDj15w.js +103 -0
- package/package.json +2 -2
- package/dist/ekybModule-DiFpO2sE.js +0 -244
- package/dist/ekycModule-DdD1iChB.js +0 -370
- package/dist/formField-C91ckby4.js +0 -94
- package/dist/useFormScrollable-3O3GeT4m.js +0 -15
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { d, y as M, A as H, q as F } from "./vendor-preact-BXf0bkEs.js";
|
|
2
|
+
import { b as K, u as l } from "./button-Ca1tRSTI.js";
|
|
3
|
+
import "./uiConfig-Z6RT23Sl.js";
|
|
4
|
+
import { t as Q } from "./formField-B2HDj15w.js";
|
|
5
|
+
import { I as R } from "./dropdownComposed-DBm7cotT.js";
|
|
6
|
+
import "@incodetech/core";
|
|
7
|
+
import { u as q } from "./useMediaQuery-CiSMgDyi.js";
|
|
8
|
+
function G(c, f) {
|
|
9
|
+
const [A, h] = d(!1);
|
|
10
|
+
return M(() => {
|
|
11
|
+
const o = c.current;
|
|
12
|
+
if (!o) return;
|
|
13
|
+
const i = () => h(o.scrollHeight > o.clientHeight);
|
|
14
|
+
i();
|
|
15
|
+
const u = new ResizeObserver(i);
|
|
16
|
+
return u.observe(o), () => u.disconnect();
|
|
17
|
+
}, [f, c]), A;
|
|
18
|
+
}
|
|
19
|
+
const J = ({
|
|
20
|
+
label: c,
|
|
21
|
+
value: f,
|
|
22
|
+
error: A,
|
|
23
|
+
errorParams: h,
|
|
24
|
+
suggestions: o,
|
|
25
|
+
readonly: i,
|
|
26
|
+
optional: u,
|
|
27
|
+
onChange: w,
|
|
28
|
+
onSearch: k,
|
|
29
|
+
onSelect: N
|
|
30
|
+
}) => {
|
|
31
|
+
const { t: n } = K(), [x, a] = d(!1), [D, m] = d(!1), [C, S] = d(""), [s, r] = d(-1), v = H(null), p = "ekyc-address-listbox", I = q(), g = n(c), E = u ? `${g} (${n("common.optional")})` : g;
|
|
32
|
+
M(() => {
|
|
33
|
+
function e(t) {
|
|
34
|
+
v.current && !v.current.contains(t.target) && a(!1);
|
|
35
|
+
}
|
|
36
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
37
|
+
}, []), M(() => {
|
|
38
|
+
r(-1);
|
|
39
|
+
}, [o]);
|
|
40
|
+
const b = F(
|
|
41
|
+
(e) => {
|
|
42
|
+
N(e), a(!1), m(!1), r(-1);
|
|
43
|
+
},
|
|
44
|
+
[N]
|
|
45
|
+
), $ = (e) => {
|
|
46
|
+
w(e), e.length >= 3 ? I ? (m(!0), S(e)) : (k(e), a(!0)) : a(!1);
|
|
47
|
+
}, O = (e) => {
|
|
48
|
+
!x || o.length === 0 || (e.key === "ArrowDown" ? (e.preventDefault(), r((t) => t < o.length - 1 ? t + 1 : 0)) : e.key === "ArrowUp" ? (e.preventDefault(), r((t) => t > 0 ? t - 1 : o.length - 1)) : e.key === "Enter" && s >= 0 ? (e.preventDefault(), b(o[s])) : e.key === "Escape" && (a(!1), r(-1)));
|
|
49
|
+
}, y = !I && x && o.length > 0, L = y && s >= 0 ? `${p}-option-${s}` : void 0;
|
|
50
|
+
return /* @__PURE__ */ l("div", { className: "IncodeAddressAutocomplete", ref: v, children: [
|
|
51
|
+
/* @__PURE__ */ l(
|
|
52
|
+
R,
|
|
53
|
+
{
|
|
54
|
+
id: "ekyc-street",
|
|
55
|
+
label: E,
|
|
56
|
+
name: "street",
|
|
57
|
+
value: f,
|
|
58
|
+
readOnly: i,
|
|
59
|
+
error: Q(n, A, h),
|
|
60
|
+
onInput: (e) => $(e.target.value),
|
|
61
|
+
onKeyDown: O,
|
|
62
|
+
role: "combobox",
|
|
63
|
+
"aria-expanded": y,
|
|
64
|
+
"aria-controls": p,
|
|
65
|
+
"aria-activedescendant": L,
|
|
66
|
+
"aria-autocomplete": "list",
|
|
67
|
+
"data-testid": "ekyc-address-input"
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
y && /* @__PURE__ */ l(
|
|
71
|
+
"ul",
|
|
72
|
+
{
|
|
73
|
+
id: p,
|
|
74
|
+
role: "listbox",
|
|
75
|
+
className: "IncodeAddressAutocompleteSuggestions",
|
|
76
|
+
children: o.map((e, t) => /* @__PURE__ */ l(
|
|
77
|
+
"li",
|
|
78
|
+
{
|
|
79
|
+
id: `${p}-option-${t}`,
|
|
80
|
+
role: "option",
|
|
81
|
+
"aria-selected": t === s,
|
|
82
|
+
className: `IncodeAddressAutocompleteSuggestion${t === s ? "IncodeAddressAutocompleteSuggestionActive" : ""}`,
|
|
83
|
+
onClick: () => b(e),
|
|
84
|
+
children: e.label
|
|
85
|
+
},
|
|
86
|
+
e.id
|
|
87
|
+
))
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
I && D && /* @__PURE__ */ l("div", { className: "IncodeAddressAutocompleteModalOverlay", children: /* @__PURE__ */ l("div", { className: "IncodeAddressAutocompleteModal", children: [
|
|
91
|
+
/* @__PURE__ */ l("div", { className: "IncodeAddressAutocompleteModalHeader", children: [
|
|
92
|
+
/* @__PURE__ */ l("h3", { children: n("verification.addressSearch") }),
|
|
93
|
+
/* @__PURE__ */ l(
|
|
94
|
+
"button",
|
|
95
|
+
{
|
|
96
|
+
className: "IncodeAddressAutocompleteModalClose",
|
|
97
|
+
onClick: () => m(!1),
|
|
98
|
+
type: "button",
|
|
99
|
+
children: "×"
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
] }),
|
|
103
|
+
/* @__PURE__ */ l("div", { className: "IncodeAddressAutocompleteModalBody", children: [
|
|
104
|
+
/* @__PURE__ */ l(
|
|
105
|
+
"input",
|
|
106
|
+
{
|
|
107
|
+
className: "IncodeAddressAutocompleteModalInput",
|
|
108
|
+
type: "text",
|
|
109
|
+
value: C,
|
|
110
|
+
placeholder: n("verification.addressPlaceholder"),
|
|
111
|
+
onInput: (e) => {
|
|
112
|
+
const t = e.target.value;
|
|
113
|
+
S(t), t.length >= 3 && k(t);
|
|
114
|
+
},
|
|
115
|
+
autoFocus: !0
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
o.length > 0 && /* @__PURE__ */ l(
|
|
119
|
+
"ul",
|
|
120
|
+
{
|
|
121
|
+
role: "listbox",
|
|
122
|
+
className: "IncodeAddressAutocompleteModalSuggestions",
|
|
123
|
+
children: o.map((e) => /* @__PURE__ */ l(
|
|
124
|
+
"li",
|
|
125
|
+
{
|
|
126
|
+
role: "option",
|
|
127
|
+
className: "IncodeAddressAutocompleteModalSuggestion",
|
|
128
|
+
onClick: () => b(e),
|
|
129
|
+
children: e.label
|
|
130
|
+
},
|
|
131
|
+
e.id
|
|
132
|
+
))
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
/* @__PURE__ */ l(
|
|
136
|
+
"button",
|
|
137
|
+
{
|
|
138
|
+
className: "IncodeAddressAutocompleteEnterManually",
|
|
139
|
+
onClick: () => m(!1),
|
|
140
|
+
type: "button",
|
|
141
|
+
children: n("verification.enterManually")
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
] })
|
|
145
|
+
] }) })
|
|
146
|
+
] });
|
|
147
|
+
};
|
|
148
|
+
export {
|
|
149
|
+
J as A,
|
|
150
|
+
G as u
|
|
151
|
+
};
|
package/dist/ekyb/styles.css
CHANGED
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
margin-bottom: var(--spacing-0, var(--spacing-none, 0px));
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
.IncodeEkybForm .IncodeAddressAutocomplete {
|
|
33
|
+
margin-inline: auto;
|
|
34
|
+
}
|
|
35
|
+
|
|
32
36
|
@media (min-width: 768px) {
|
|
33
37
|
.IncodePageContainer.IncodeEkybPage {
|
|
34
38
|
margin-top: var(--spacing-0, var(--spacing-none, 0px));
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { b as k, u as o, I as w, a as D, S as L, B as T } from "./button-Ca1tRSTI.js";
|
|
2
|
+
import { SUPPORTED_COUNTRIES as F, DEV_ONLY_COUNTRIES as O, createEkybManager as _ } from "@incodetech/core/ekyb";
|
|
3
|
+
import { T as q, y as g, A as S, k as B } from "./vendor-preact-BXf0bkEs.js";
|
|
4
|
+
import "./uiConfig-Z6RT23Sl.js";
|
|
5
|
+
import "@incodetech/core";
|
|
6
|
+
import { u as V, A as G } from "./addressAutocomplete-CL7IcYGQ.js";
|
|
7
|
+
import { P as K } from "./page-BVHG3h0V.js";
|
|
8
|
+
import { t as $, F as z, V as v } from "./formField-B2HDj15w.js";
|
|
9
|
+
import { r as W } from "./incodeModule-aE-LkKwM.js";
|
|
10
|
+
import { D as P, I as f } from "./dropdownComposed-DBm7cotT.js";
|
|
11
|
+
function Y(e) {
|
|
12
|
+
return [...e.toUpperCase()].map((r) => String.fromCodePoint(127462 + r.charCodeAt(0) - 65)).join("");
|
|
13
|
+
}
|
|
14
|
+
const j = {
|
|
15
|
+
BR: "Brazil",
|
|
16
|
+
CM: "Cameroon",
|
|
17
|
+
CN: "China",
|
|
18
|
+
FR: "France",
|
|
19
|
+
DE: "Germany",
|
|
20
|
+
IL: "Israel",
|
|
21
|
+
IT: "Italy",
|
|
22
|
+
KE: "Kenya",
|
|
23
|
+
MX: "Mexico",
|
|
24
|
+
NG: "Nigeria",
|
|
25
|
+
ES: "Spain",
|
|
26
|
+
GB: "United Kingdom",
|
|
27
|
+
US: "USA"
|
|
28
|
+
};
|
|
29
|
+
function H(e) {
|
|
30
|
+
const r = j[e] ?? e;
|
|
31
|
+
return { value: e, label: `${Y(e)} ${r}` };
|
|
32
|
+
}
|
|
33
|
+
function X() {
|
|
34
|
+
if (typeof window > "u") return !1;
|
|
35
|
+
const { hostname: e } = window.location;
|
|
36
|
+
return e === "localhost" || e.includes("stage") || e.includes("demo");
|
|
37
|
+
}
|
|
38
|
+
const J = ({
|
|
39
|
+
value: e,
|
|
40
|
+
onChange: r
|
|
41
|
+
}) => {
|
|
42
|
+
const { t: u } = k(), i = q(() => (X() ? [...F, ...O] : [...F]).map(H).sort((l, a) => l.label.localeCompare(a.label)), []);
|
|
43
|
+
return /* @__PURE__ */ o("div", { className: "IncodeEkybCountrySelector", children: /* @__PURE__ */ o(
|
|
44
|
+
P,
|
|
45
|
+
{
|
|
46
|
+
id: "ekyb-country",
|
|
47
|
+
label: u("ekyb.country"),
|
|
48
|
+
value: e,
|
|
49
|
+
options: i,
|
|
50
|
+
onChange: r,
|
|
51
|
+
"data-testid": "ekyb-country-selector"
|
|
52
|
+
}
|
|
53
|
+
) });
|
|
54
|
+
}, U = ({
|
|
55
|
+
field: e,
|
|
56
|
+
value: r,
|
|
57
|
+
error: u,
|
|
58
|
+
errorParams: i,
|
|
59
|
+
country: s,
|
|
60
|
+
onChange: l
|
|
61
|
+
}) => {
|
|
62
|
+
const { t: a } = k(), m = !e.required, p = a(e.label);
|
|
63
|
+
if (e.type === "dropdown") {
|
|
64
|
+
const d = m ? `${p} (${a("common.optional")})` : p, n = e.name === "state" ? a("ekyb.selectState") : void 0;
|
|
65
|
+
return /* @__PURE__ */ o(
|
|
66
|
+
P,
|
|
67
|
+
{
|
|
68
|
+
id: `ekyb-${e.name}`,
|
|
69
|
+
label: d,
|
|
70
|
+
placeholder: n,
|
|
71
|
+
value: r,
|
|
72
|
+
options: (e.options ?? []).map((b) => ({
|
|
73
|
+
...b,
|
|
74
|
+
label: a(b.label)
|
|
75
|
+
})),
|
|
76
|
+
error: $(a, u, i),
|
|
77
|
+
searchable: !0,
|
|
78
|
+
onChange: (b) => l(e.name, b),
|
|
79
|
+
"data-testid": `ekyb-field-${e.name}`
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
return /* @__PURE__ */ o(
|
|
84
|
+
z,
|
|
85
|
+
{
|
|
86
|
+
name: e.name,
|
|
87
|
+
label: e.label,
|
|
88
|
+
value: r,
|
|
89
|
+
error: u,
|
|
90
|
+
errorParams: i,
|
|
91
|
+
required: e.required,
|
|
92
|
+
optional: m,
|
|
93
|
+
onChange: l
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
}, Q = ({
|
|
97
|
+
ubos: e,
|
|
98
|
+
errors: r,
|
|
99
|
+
errorParams: u,
|
|
100
|
+
canAddUbo: i,
|
|
101
|
+
onSetField: s,
|
|
102
|
+
onAdd: l,
|
|
103
|
+
onRemove: a
|
|
104
|
+
}) => {
|
|
105
|
+
const { t: m } = k(), p = (d) => $(m, r[d], u[d]);
|
|
106
|
+
return e.length === 0 ? null : /* @__PURE__ */ o("div", { className: "IncodeEkybUbos", children: [
|
|
107
|
+
e.map((d, n) => {
|
|
108
|
+
const b = n === 0 ? m("ekyb.uboName") : m("ekyb.uboNameWithNumber", { number: n + 1 }), C = n === 0 ? m("ekyb.uboSurname") : m("ekyb.uboSurnameWithNumber", { number: n + 1 }), E = n === 0;
|
|
109
|
+
return /* @__PURE__ */ o("div", { className: "IncodeEkybUboEntry", children: [
|
|
110
|
+
/* @__PURE__ */ o(
|
|
111
|
+
f,
|
|
112
|
+
{
|
|
113
|
+
id: `ubo-${n}-name`,
|
|
114
|
+
label: b,
|
|
115
|
+
name: `ubo-${n}-name`,
|
|
116
|
+
value: d.name,
|
|
117
|
+
error: p(`ubo-${n}-name`),
|
|
118
|
+
onInput: (h) => s(n, "name", h.target.value),
|
|
119
|
+
"data-testid": `ekyb-ubo-${n}-name`
|
|
120
|
+
}
|
|
121
|
+
),
|
|
122
|
+
/* @__PURE__ */ o(
|
|
123
|
+
f,
|
|
124
|
+
{
|
|
125
|
+
id: `ubo-${n}-surname`,
|
|
126
|
+
label: C,
|
|
127
|
+
name: `ubo-${n}-surname`,
|
|
128
|
+
value: d.surname,
|
|
129
|
+
error: p(`ubo-${n}-surname`),
|
|
130
|
+
onInput: (h) => s(
|
|
131
|
+
n,
|
|
132
|
+
"surname",
|
|
133
|
+
h.target.value
|
|
134
|
+
),
|
|
135
|
+
"data-testid": `ekyb-ubo-${n}-surname`
|
|
136
|
+
}
|
|
137
|
+
),
|
|
138
|
+
!E && /* @__PURE__ */ o(
|
|
139
|
+
"button",
|
|
140
|
+
{
|
|
141
|
+
className: "IncodeEkybRemoveUbo",
|
|
142
|
+
onClick: () => a(n),
|
|
143
|
+
type: "button",
|
|
144
|
+
children: m("common.remove")
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
] }, d.id);
|
|
148
|
+
}),
|
|
149
|
+
i && /* @__PURE__ */ o(
|
|
150
|
+
"button",
|
|
151
|
+
{
|
|
152
|
+
className: "IncodeEkybAddUbo",
|
|
153
|
+
onClick: l,
|
|
154
|
+
type: "button",
|
|
155
|
+
"data-testid": "ekyb-add-ubo",
|
|
156
|
+
children: m("ekyb.addAnotherUbo")
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
] });
|
|
160
|
+
}, Z = ({ config: e, onFinish: r, onError: u }) => {
|
|
161
|
+
const { t: i } = k(), [s, l] = D(() => _({ config: e }));
|
|
162
|
+
g(() => {
|
|
163
|
+
(s.status === "finished" || s.status === "closed") && r?.();
|
|
164
|
+
}, [s.status, r]);
|
|
165
|
+
const a = s.status === "error" ? s.errorMessage : void 0;
|
|
166
|
+
return g(() => {
|
|
167
|
+
s.status === "error" && u?.(a);
|
|
168
|
+
}, [s.status, u, a]), s.status === "finished" || s.status === "closed" ? null : s.status === "loading" ? /* @__PURE__ */ o(
|
|
169
|
+
v,
|
|
170
|
+
{
|
|
171
|
+
status: "submitting",
|
|
172
|
+
submittingTitle: i("common.loading")
|
|
173
|
+
}
|
|
174
|
+
) : s.status === "submitting" ? /* @__PURE__ */ o(v, { status: "submitting" }) : s.status === "success" ? /* @__PURE__ */ o(v, { status: "success" }) : s.status === "error" ? /* @__PURE__ */ o(v, { status: "failure", onRetry: () => l.retry() }) : s.status === "form" ? /* @__PURE__ */ o(x, { state: s, manager: l }) : null;
|
|
175
|
+
}, A = /* @__PURE__ */ new Set([
|
|
176
|
+
"street",
|
|
177
|
+
"houseNo",
|
|
178
|
+
"addressLine2",
|
|
179
|
+
"city",
|
|
180
|
+
"state",
|
|
181
|
+
"postalCode"
|
|
182
|
+
]), x = ({ state: e, manager: r }) => {
|
|
183
|
+
const {
|
|
184
|
+
country: u,
|
|
185
|
+
fields: i,
|
|
186
|
+
values: s,
|
|
187
|
+
displayErrors: l,
|
|
188
|
+
errorParams: a,
|
|
189
|
+
isValid: m,
|
|
190
|
+
ubos: p,
|
|
191
|
+
canAddUbo: d,
|
|
192
|
+
addressSuggestions: n
|
|
193
|
+
} = e, { t: b } = k(), C = S(null), E = S(null), h = S(void 0), R = V(C, i.length);
|
|
194
|
+
g(() => {
|
|
195
|
+
const t = l.postalCode, c = h.current;
|
|
196
|
+
if (h.current = t, !t || c === t)
|
|
197
|
+
return;
|
|
198
|
+
const y = requestAnimationFrame(() => {
|
|
199
|
+
const I = E.current;
|
|
200
|
+
if (!I) return;
|
|
201
|
+
(I.querySelector("#postalCode-error") ?? I).scrollIntoView({
|
|
202
|
+
behavior: "smooth",
|
|
203
|
+
block: "nearest"
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
return () => cancelAnimationFrame(y);
|
|
207
|
+
}, [l.postalCode]);
|
|
208
|
+
const M = i.filter((t) => !A.has(t.name)), N = i.filter((t) => A.has(t.name));
|
|
209
|
+
return /* @__PURE__ */ o(K, { className: `IncodeEkybPage${R ? " IncodeEkybPageScrollable" : ""}`, title: b("ekyb.title"), children: [
|
|
210
|
+
/* @__PURE__ */ o("div", { ref: C, className: "IncodeEkybForm", children: [
|
|
211
|
+
/* @__PURE__ */ o(
|
|
212
|
+
J,
|
|
213
|
+
{
|
|
214
|
+
value: u,
|
|
215
|
+
onChange: (t) => r.setCountry(t)
|
|
216
|
+
}
|
|
217
|
+
),
|
|
218
|
+
M.map((t) => /* @__PURE__ */ o(
|
|
219
|
+
U,
|
|
220
|
+
{
|
|
221
|
+
field: t,
|
|
222
|
+
value: s[t.name] ?? "",
|
|
223
|
+
error: l[t.name],
|
|
224
|
+
errorParams: a[t.name],
|
|
225
|
+
country: u,
|
|
226
|
+
onChange: (c, y) => r.setField(c, y)
|
|
227
|
+
},
|
|
228
|
+
t.name
|
|
229
|
+
)),
|
|
230
|
+
/* @__PURE__ */ o(
|
|
231
|
+
Q,
|
|
232
|
+
{
|
|
233
|
+
ubos: p,
|
|
234
|
+
errors: l,
|
|
235
|
+
errorParams: a,
|
|
236
|
+
canAddUbo: d,
|
|
237
|
+
onSetField: (t, c, y) => r.setUboField(t, c, y),
|
|
238
|
+
onAdd: () => r.addUbo(),
|
|
239
|
+
onRemove: (t) => r.removeUbo(t)
|
|
240
|
+
}
|
|
241
|
+
),
|
|
242
|
+
N.length > 0 && /* @__PURE__ */ o(B, { children: [
|
|
243
|
+
/* @__PURE__ */ o("h3", { className: "IncodeEkybSectionHeader", children: b("ekyb.addressDetails") }),
|
|
244
|
+
N.map((t) => t.name === "street" ? /* @__PURE__ */ o(
|
|
245
|
+
G,
|
|
246
|
+
{
|
|
247
|
+
label: t.label,
|
|
248
|
+
value: s.street ?? "",
|
|
249
|
+
error: l.street,
|
|
250
|
+
errorParams: a.street,
|
|
251
|
+
suggestions: n,
|
|
252
|
+
optional: !t.required,
|
|
253
|
+
onChange: (c) => r.setField("street", c),
|
|
254
|
+
onSearch: (c) => r.searchAddress(c),
|
|
255
|
+
onSelect: (c) => r.selectAddress(c)
|
|
256
|
+
},
|
|
257
|
+
t.name
|
|
258
|
+
) : /* @__PURE__ */ o(
|
|
259
|
+
"div",
|
|
260
|
+
{
|
|
261
|
+
ref: t.name === "postalCode" ? E : void 0,
|
|
262
|
+
children: /* @__PURE__ */ o(
|
|
263
|
+
U,
|
|
264
|
+
{
|
|
265
|
+
field: t,
|
|
266
|
+
value: s[t.name] ?? "",
|
|
267
|
+
error: l[t.name],
|
|
268
|
+
errorParams: a[t.name],
|
|
269
|
+
country: u,
|
|
270
|
+
onChange: (c, y) => r.setField(c, y)
|
|
271
|
+
}
|
|
272
|
+
)
|
|
273
|
+
},
|
|
274
|
+
t.name
|
|
275
|
+
))
|
|
276
|
+
] })
|
|
277
|
+
] }),
|
|
278
|
+
/* @__PURE__ */ o("div", { className: "IncodeEkybFooter", children: [
|
|
279
|
+
/* @__PURE__ */ o(L, { size: 32 }),
|
|
280
|
+
/* @__PURE__ */ o(
|
|
281
|
+
T,
|
|
282
|
+
{
|
|
283
|
+
onClick: () => r.submit(),
|
|
284
|
+
disabled: !m,
|
|
285
|
+
"data-testid": "ekyb-submit",
|
|
286
|
+
children: b("ekyb.continue")
|
|
287
|
+
}
|
|
288
|
+
)
|
|
289
|
+
] })
|
|
290
|
+
] });
|
|
291
|
+
}, ee = ({
|
|
292
|
+
config: e,
|
|
293
|
+
onFinish: r,
|
|
294
|
+
onError: u
|
|
295
|
+
}) => /* @__PURE__ */ o(w, { children: e ? /* @__PURE__ */ o(Z, { config: e, onFinish: r, onError: u }) : null });
|
|
296
|
+
W(ee, "incode-ekyb");
|
|
297
|
+
export {
|
|
298
|
+
ee as EkybModule
|
|
299
|
+
};
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { u as r, I as D, b as P, a as M, S as V, B as w } from "./button-Ca1tRSTI.js";
|
|
2
|
+
import { createEkycManager as x } from "@incodetech/core/ekyc";
|
|
3
|
+
import { y as E, A as k } from "./vendor-preact-BXf0bkEs.js";
|
|
4
|
+
import "./uiConfig-Z6RT23Sl.js";
|
|
5
|
+
import "@incodetech/core";
|
|
6
|
+
import { u as T, A as B } from "./addressAutocomplete-CL7IcYGQ.js";
|
|
7
|
+
import { V as b, t as H, F as K } from "./formField-B2HDj15w.js";
|
|
8
|
+
import { D as O } from "./dateInputComposed-CvFmQpJ0.js";
|
|
9
|
+
import { D as z } from "./dropdownComposed-DBm7cotT.js";
|
|
10
|
+
import { P as G } from "./page-BVHG3h0V.js";
|
|
11
|
+
import { r as j } from "./incodeModule-aE-LkKwM.js";
|
|
12
|
+
import { P as J } from "./phoneInputComposed-B1gXoSzr.js";
|
|
13
|
+
const Q = ({ config: p, onFinish: s, onError: m }) => {
|
|
14
|
+
const { t: h } = P(), [t, i] = M(() => x({ config: p }));
|
|
15
|
+
E(() => {
|
|
16
|
+
(t.status === "finished" || t.status === "closed") && s?.();
|
|
17
|
+
}, [t.status, s]);
|
|
18
|
+
const y = t.status === "error" ? t.errorMessage : void 0;
|
|
19
|
+
return E(() => {
|
|
20
|
+
t.status === "error" && m?.(y);
|
|
21
|
+
}, [t.status, m, y]), t.status === "finished" || t.status === "closed" ? null : t.status === "loading" ? /* @__PURE__ */ r(
|
|
22
|
+
b,
|
|
23
|
+
{
|
|
24
|
+
status: "submitting",
|
|
25
|
+
submittingTitle: h("common.loading")
|
|
26
|
+
}
|
|
27
|
+
) : t.status === "submitting" ? /* @__PURE__ */ r(b, { status: "submitting" }) : t.status === "success" ? /* @__PURE__ */ r(b, { status: "success" }) : t.status === "error" ? /* @__PURE__ */ r(
|
|
28
|
+
b,
|
|
29
|
+
{
|
|
30
|
+
status: "failure",
|
|
31
|
+
onRetry: () => i.retry(),
|
|
32
|
+
onSkip: () => i.skip()
|
|
33
|
+
}
|
|
34
|
+
) : t.status === "misconfigured" ? /* @__PURE__ */ r(
|
|
35
|
+
b,
|
|
36
|
+
{
|
|
37
|
+
status: "failure",
|
|
38
|
+
failureTitle: h("verification.noFormFields"),
|
|
39
|
+
onSkip: () => i.close(),
|
|
40
|
+
skipLabel: h("common.close")
|
|
41
|
+
}
|
|
42
|
+
) : t.status === "form" ? /* @__PURE__ */ r(U, { state: t, manager: i }) : null;
|
|
43
|
+
}, U = ({ state: p, manager: s }) => {
|
|
44
|
+
const {
|
|
45
|
+
fields: m,
|
|
46
|
+
values: h,
|
|
47
|
+
displayErrors: t,
|
|
48
|
+
errorParams: i,
|
|
49
|
+
isValid: y,
|
|
50
|
+
addressSuggestions: N,
|
|
51
|
+
prefilled: R,
|
|
52
|
+
hideEmail: A,
|
|
53
|
+
fieldsCountry: L,
|
|
54
|
+
submitError: C
|
|
55
|
+
} = p, { t: o } = P(), g = k(null), F = k(null), I = k(void 0), $ = T(g, m.length);
|
|
56
|
+
E(() => {
|
|
57
|
+
const e = t.postalCode, n = I.current;
|
|
58
|
+
if (I.current = e, !e || n === e)
|
|
59
|
+
return;
|
|
60
|
+
const u = requestAnimationFrame(() => {
|
|
61
|
+
const c = F.current;
|
|
62
|
+
if (!c) return;
|
|
63
|
+
(c.querySelector("#postalCode-error") ?? c).scrollIntoView({
|
|
64
|
+
behavior: "smooth",
|
|
65
|
+
block: "nearest"
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
return () => cancelAnimationFrame(u);
|
|
69
|
+
}, [t.postalCode]);
|
|
70
|
+
const v = (e, n) => H(o, n, i[e]);
|
|
71
|
+
let S;
|
|
72
|
+
return /* @__PURE__ */ r(G, { className: `IncodeEkycPage${$ ? " IncodeEkycPageScrollable" : ""}`, title: o("verification.title"), children: [
|
|
73
|
+
/* @__PURE__ */ r("div", { ref: g, className: "IncodeEkycForm", children: m.map((e) => {
|
|
74
|
+
if (e.name === "email" && A) return null;
|
|
75
|
+
let n = null;
|
|
76
|
+
e.section && e.section !== S && (S = e.section, n = /* @__PURE__ */ r("h3", { className: "IncodeEkycSectionHeader", children: o({
|
|
77
|
+
address: "verification.labels.addressDetailsSection",
|
|
78
|
+
driverLicense: "verification.labels.dlDetailsSection"
|
|
79
|
+
}[e.section] ?? e.section) }));
|
|
80
|
+
const u = e.readonly || R[e.name], c = h[e.name] ?? "", d = t[e.name];
|
|
81
|
+
if (e.name === "street" && e.section === "address")
|
|
82
|
+
return /* @__PURE__ */ r("div", { children: [
|
|
83
|
+
n,
|
|
84
|
+
/* @__PURE__ */ r(
|
|
85
|
+
B,
|
|
86
|
+
{
|
|
87
|
+
label: e.label,
|
|
88
|
+
value: c,
|
|
89
|
+
error: d,
|
|
90
|
+
errorParams: i[e.name],
|
|
91
|
+
suggestions: N,
|
|
92
|
+
readonly: u,
|
|
93
|
+
optional: !e.required,
|
|
94
|
+
onChange: (a) => s.setField("street", a),
|
|
95
|
+
onSearch: (a) => s.searchAddress(a),
|
|
96
|
+
onSelect: (a) => s.selectAddress(a)
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
] }, e.name);
|
|
100
|
+
if (e.type === "dropdown") {
|
|
101
|
+
const a = o(e.label);
|
|
102
|
+
return /* @__PURE__ */ r("div", { children: [
|
|
103
|
+
n,
|
|
104
|
+
/* @__PURE__ */ r(
|
|
105
|
+
z,
|
|
106
|
+
{
|
|
107
|
+
id: `ekyc-${e.name}`,
|
|
108
|
+
label: a,
|
|
109
|
+
placeholder: e.placeholder ? o(e.placeholder) : void 0,
|
|
110
|
+
value: c,
|
|
111
|
+
options: (e.options ?? []).map((l) => ({
|
|
112
|
+
...l,
|
|
113
|
+
label: o(l.label)
|
|
114
|
+
})),
|
|
115
|
+
error: v(e.name, d),
|
|
116
|
+
disabled: u,
|
|
117
|
+
searchable: !0,
|
|
118
|
+
onChange: (l) => s.setField(e.name, l),
|
|
119
|
+
"data-testid": `ekyc-field-${e.name}`
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
] }, e.name);
|
|
123
|
+
}
|
|
124
|
+
if (e.type === "date") {
|
|
125
|
+
const a = o(e.label);
|
|
126
|
+
return /* @__PURE__ */ r("div", { children: [
|
|
127
|
+
n,
|
|
128
|
+
/* @__PURE__ */ r(
|
|
129
|
+
O,
|
|
130
|
+
{
|
|
131
|
+
id: `ekyc-${e.name}`,
|
|
132
|
+
label: a,
|
|
133
|
+
value: c,
|
|
134
|
+
error: v(e.name, d),
|
|
135
|
+
disabled: u,
|
|
136
|
+
onInput: (l) => {
|
|
137
|
+
const q = l.target;
|
|
138
|
+
s.setField(e.name, q.value);
|
|
139
|
+
},
|
|
140
|
+
"data-testid": `ekyc-field-${e.name}`
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
] }, e.name);
|
|
144
|
+
}
|
|
145
|
+
if (e.type === "phone") {
|
|
146
|
+
const a = o(e.label);
|
|
147
|
+
return /* @__PURE__ */ r("div", { children: [
|
|
148
|
+
n,
|
|
149
|
+
/* @__PURE__ */ r(
|
|
150
|
+
J,
|
|
151
|
+
{
|
|
152
|
+
id: `ekyc-${e.name}`,
|
|
153
|
+
label: a,
|
|
154
|
+
countryCode: L,
|
|
155
|
+
value: c,
|
|
156
|
+
placeholder: e.placeholder,
|
|
157
|
+
error: v(e.name, d),
|
|
158
|
+
disabled: u,
|
|
159
|
+
disableCountrySelector: e.disableCountrySelector,
|
|
160
|
+
required: e.required,
|
|
161
|
+
onChange: (l) => s.setField(e.name, l),
|
|
162
|
+
"data-testid": `ekyc-field-${e.name}`
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
] }, e.name);
|
|
166
|
+
}
|
|
167
|
+
return e.type === "radio" ? /* @__PURE__ */ r("div", { children: [
|
|
168
|
+
n,
|
|
169
|
+
/* @__PURE__ */ r("div", { className: "IncodeEkycRadioGroup", children: [
|
|
170
|
+
/* @__PURE__ */ r("label", { className: "IncodeEkycRadioLabel", children: o(e.label) }),
|
|
171
|
+
/* @__PURE__ */ r("div", { className: "IncodeEkycRadioOptions", children: e.options?.map((a) => /* @__PURE__ */ r(
|
|
172
|
+
"label",
|
|
173
|
+
{
|
|
174
|
+
className: "IncodeEkycRadioOption",
|
|
175
|
+
children: [
|
|
176
|
+
/* @__PURE__ */ r(
|
|
177
|
+
"input",
|
|
178
|
+
{
|
|
179
|
+
type: "radio",
|
|
180
|
+
name: e.name,
|
|
181
|
+
checked: c === a.value,
|
|
182
|
+
value: a.value,
|
|
183
|
+
onChange: () => s.setField(e.name, a.value),
|
|
184
|
+
disabled: u
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
/* @__PURE__ */ r("span", { children: o(a.label) })
|
|
188
|
+
]
|
|
189
|
+
},
|
|
190
|
+
a.value
|
|
191
|
+
)) }),
|
|
192
|
+
d && /* @__PURE__ */ r("span", { className: "IncodeEkycFieldError", children: v(e.name, d) })
|
|
193
|
+
] })
|
|
194
|
+
] }, e.name) : /* @__PURE__ */ r(
|
|
195
|
+
"div",
|
|
196
|
+
{
|
|
197
|
+
ref: e.name === "postalCode" ? F : void 0,
|
|
198
|
+
children: [
|
|
199
|
+
n,
|
|
200
|
+
/* @__PURE__ */ r(
|
|
201
|
+
K,
|
|
202
|
+
{
|
|
203
|
+
name: e.name,
|
|
204
|
+
label: e.label,
|
|
205
|
+
value: c,
|
|
206
|
+
error: d,
|
|
207
|
+
errorParams: i[e.name],
|
|
208
|
+
type: e.type,
|
|
209
|
+
placeholder: e.placeholder,
|
|
210
|
+
placeholderParams: e.placeholderParams,
|
|
211
|
+
required: e.required,
|
|
212
|
+
optional: e.optional,
|
|
213
|
+
readonly: u,
|
|
214
|
+
maxLength: e.maxLength,
|
|
215
|
+
onChange: (a, l) => s.setField(a, l)
|
|
216
|
+
}
|
|
217
|
+
)
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
e.name
|
|
221
|
+
);
|
|
222
|
+
}) }),
|
|
223
|
+
/* @__PURE__ */ r("div", { className: "IncodeEkycFooter", children: [
|
|
224
|
+
/* @__PURE__ */ r(V, { size: 32 }),
|
|
225
|
+
C && /* @__PURE__ */ r("p", { className: "IncodeEkycSubmitError", children: o(C) }),
|
|
226
|
+
/* @__PURE__ */ r(
|
|
227
|
+
w,
|
|
228
|
+
{
|
|
229
|
+
onClick: () => s.submit(),
|
|
230
|
+
disabled: !y,
|
|
231
|
+
"data-testid": "ekyc-submit",
|
|
232
|
+
children: o("common.continue")
|
|
233
|
+
}
|
|
234
|
+
)
|
|
235
|
+
] })
|
|
236
|
+
] });
|
|
237
|
+
}, W = ({
|
|
238
|
+
config: p,
|
|
239
|
+
onFinish: s,
|
|
240
|
+
onError: m
|
|
241
|
+
}) => /* @__PURE__ */ r(D, { children: p ? /* @__PURE__ */ r(Q, { config: p, onFinish: s, onError: m }) : null });
|
|
242
|
+
j(W, "incode-ekyc");
|
|
243
|
+
export {
|
|
244
|
+
W as EkycModule
|
|
245
|
+
};
|