@incodetech/web 0.0.0-dev-20260317-5e90a15 → 0.0.0-dev-20260318-7381409

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.
@@ -8,6 +8,10 @@
8
8
  }
9
9
  }
10
10
 
11
+ .IncodeEkybSpinner {
12
+ flex: 1;
13
+ }
14
+
11
15
  .IncodeEkybPage {
12
16
  max-width: 480px;
13
17
  margin-inline: auto;
@@ -33,6 +37,10 @@
33
37
  margin-inline: auto;
34
38
  }
35
39
 
40
+ .IncodeEkybFooter {
41
+ margin-top: var(--spacing-24, var(--spacing-24, 24px));
42
+ }
43
+
36
44
  @media (min-width: 768px) {
37
45
  .IncodePageContainer.IncodeEkybPage {
38
46
  margin-top: var(--spacing-0, var(--spacing-none, 0px));
@@ -55,7 +63,6 @@
55
63
  .IncodeEkybPage .IncodeEkybForm {
56
64
  min-height: var(--spacing-0, var(--spacing-none, 0px));
57
65
  padding-bottom: var(--spacing-8, var(--spacing-8, 8px));
58
- flex: 1;
59
66
  overflow-y: auto;
60
67
  }
61
68
 
@@ -0,0 +1,356 @@
1
+ import { b as v, u as o, I as J, a as Q, B as Z } from "./button-Ca1tRSTI.js";
2
+ import { SUPPORTED_COUNTRIES as M, DEV_ONLY_COUNTRIES as x, computeEkybDisplayErrors as ee, createEkybManager as te } from "@incodetech/core/ekyb";
3
+ import { T as q, y as V, A as D, d as oe, q as S, k as re } from "./vendor-preact-BXf0bkEs.js";
4
+ import "./uiConfig-Z6RT23Sl.js";
5
+ import "@incodetech/core";
6
+ import { u as ne, A as se } from "./addressAutocomplete-DetZGxBZ.js";
7
+ import { P as K } from "./page-BVHG3h0V.js";
8
+ import { S as ae } from "./spinner-Cx3FPUCD.js";
9
+ import { t as G, F as ce, V as P } from "./formField-FeX9N4c8.js";
10
+ import { r as le } from "./incodeModule-aE-LkKwM.js";
11
+ import { D as Y } from "./dropdownComposed-B5ZuQS8C.js";
12
+ import { I as _ } from "./inputComposed-BHi-MSpP.js";
13
+ function ue(t) {
14
+ return [...t.toUpperCase()].map((r) => String.fromCodePoint(127462 + r.charCodeAt(0) - 65)).join("");
15
+ }
16
+ const ie = {
17
+ BR: "Brazil",
18
+ CM: "Cameroon",
19
+ CN: "China",
20
+ FR: "France",
21
+ DE: "Germany",
22
+ IL: "Israel",
23
+ IT: "Italy",
24
+ KE: "Kenya",
25
+ MX: "Mexico",
26
+ NG: "Nigeria",
27
+ ES: "Spain",
28
+ GB: "United Kingdom",
29
+ US: "USA"
30
+ };
31
+ function me(t) {
32
+ const r = ie[t] ?? t;
33
+ return { value: t, label: `${ue(t)} ${r}` };
34
+ }
35
+ function de() {
36
+ if (typeof window > "u") return !1;
37
+ const { hostname: t } = window.location;
38
+ return t === "localhost" || t.includes("stage") || t.includes("demo");
39
+ }
40
+ const be = ({
41
+ value: t,
42
+ onChange: r
43
+ }) => {
44
+ const { t: c } = v(), n = q(() => (de() ? [...M, ...x] : [...M]).map(me).sort((l, d) => l.label.localeCompare(d.label)), []);
45
+ return /* @__PURE__ */ o("div", { className: "IncodeEkybCountrySelector", children: /* @__PURE__ */ o(
46
+ Y,
47
+ {
48
+ id: "ekyb-country",
49
+ label: c("ekyb.country"),
50
+ value: t,
51
+ options: n,
52
+ onChange: r,
53
+ "data-testid": "ekyb-country-selector"
54
+ }
55
+ ) });
56
+ }, B = ({
57
+ field: t,
58
+ value: r,
59
+ error: c,
60
+ errorParams: n,
61
+ country: i,
62
+ onChange: l,
63
+ onBlur: d
64
+ }) => {
65
+ const { t: b } = v(), u = !t.required, h = b(t.label);
66
+ if (t.type === "dropdown") {
67
+ const m = u ? `${h} (${b("common.optional")})` : h, s = t.name === "state" ? b("ekyb.selectState") : void 0;
68
+ return /* @__PURE__ */ o(
69
+ Y,
70
+ {
71
+ id: `ekyb-${t.name}`,
72
+ label: m,
73
+ placeholder: s,
74
+ value: r,
75
+ options: (t.options ?? []).map((p) => ({
76
+ ...p,
77
+ label: b(p.label)
78
+ })),
79
+ error: G(b, c, n),
80
+ searchable: !0,
81
+ onChange: (p) => l(t.name, p),
82
+ onBlur: d ? () => d(t.name) : void 0,
83
+ "data-testid": `ekyb-field-${t.name}`
84
+ }
85
+ );
86
+ }
87
+ return /* @__PURE__ */ o(
88
+ ce,
89
+ {
90
+ name: t.name,
91
+ label: t.label,
92
+ value: r,
93
+ error: c,
94
+ errorParams: n,
95
+ required: t.required,
96
+ optional: u,
97
+ onChange: l,
98
+ onBlur: d
99
+ }
100
+ );
101
+ }, pe = ({
102
+ ubos: t,
103
+ errors: r,
104
+ errorParams: c,
105
+ canAddUbo: n,
106
+ onSetField: i,
107
+ onBlur: l,
108
+ onAdd: d,
109
+ onRemove: b
110
+ }) => {
111
+ const { t: u } = v(), h = (m) => G(u, r[m], c[m]);
112
+ return t.length === 0 ? null : /* @__PURE__ */ o("div", { className: "IncodeEkybUbos", children: [
113
+ t.map((m, s) => {
114
+ const p = s === 0 ? u("ekyb.uboName") : u("ekyb.uboNameWithNumber", { number: s + 1 }), f = s === 0 ? u("ekyb.uboSurname") : u("ekyb.uboSurnameWithNumber", { number: s + 1 }), N = s === 0;
115
+ return /* @__PURE__ */ o("div", { className: "IncodeEkybUboEntry", children: [
116
+ /* @__PURE__ */ o(
117
+ _,
118
+ {
119
+ id: `ubo-${s}-name`,
120
+ label: p,
121
+ name: `ubo-${s}-name`,
122
+ value: m.name,
123
+ error: h(`ubo-${s}-name`),
124
+ onInput: (I) => i(s, "name", I.target.value),
125
+ onBlur: l ? () => l(`ubo-${s}-name`) : void 0,
126
+ "data-testid": `ekyb-ubo-${s}-name`
127
+ }
128
+ ),
129
+ /* @__PURE__ */ o(
130
+ _,
131
+ {
132
+ id: `ubo-${s}-surname`,
133
+ label: f,
134
+ name: `ubo-${s}-surname`,
135
+ value: m.surname,
136
+ error: h(`ubo-${s}-surname`),
137
+ onInput: (I) => i(
138
+ s,
139
+ "surname",
140
+ I.target.value
141
+ ),
142
+ onBlur: l ? () => l(`ubo-${s}-surname`) : void 0,
143
+ "data-testid": `ekyb-ubo-${s}-surname`
144
+ }
145
+ ),
146
+ !N && /* @__PURE__ */ o(
147
+ "button",
148
+ {
149
+ className: "IncodeEkybRemoveUbo",
150
+ onClick: () => b(s),
151
+ type: "button",
152
+ children: u("common.remove")
153
+ }
154
+ )
155
+ ] }, m.id);
156
+ }),
157
+ n && /* @__PURE__ */ o(
158
+ "button",
159
+ {
160
+ className: "IncodeEkybAddUbo",
161
+ onClick: d,
162
+ type: "button",
163
+ "data-testid": "ekyb-add-ubo",
164
+ children: u("ekyb.addAnotherUbo")
165
+ }
166
+ )
167
+ ] });
168
+ }, ye = ({ config: t, onFinish: r }) => {
169
+ const { t: c } = v(), [n, i] = Q(() => te({ config: t }));
170
+ return V(() => {
171
+ (n.status === "finished" || n.status === "closed") && r?.();
172
+ }, [n.status, r]), n.status === "finished" || n.status === "closed" ? null : n.status === "loading" ? /* @__PURE__ */ o(
173
+ P,
174
+ {
175
+ status: "submitting",
176
+ submittingTitle: c("common.loading")
177
+ }
178
+ ) : n.status === "submitting" ? /* @__PURE__ */ o(K, { children: /* @__PURE__ */ o(
179
+ ae,
180
+ {
181
+ fullScreen: !1,
182
+ title: c("common.processing"),
183
+ className: "IncodeEkybSpinner"
184
+ }
185
+ ) }) : n.status === "success" ? /* @__PURE__ */ o(P, { status: "success" }) : n.status === "error" ? /* @__PURE__ */ o(P, { status: "failure", onRetry: () => i.retry() }) : n.status === "form" ? /* @__PURE__ */ o(ke, { state: n, manager: i }) : null;
186
+ }, O = /* @__PURE__ */ new Set([
187
+ "street",
188
+ "houseNo",
189
+ "addressLine2",
190
+ "city",
191
+ "state",
192
+ "postalCode"
193
+ ]), he = ["street", "city", "state", "postalCode", "houseNo"], ke = ({ state: t, manager: r }) => {
194
+ const {
195
+ country: c,
196
+ fields: n,
197
+ values: i,
198
+ errors: l,
199
+ isValid: d,
200
+ ubos: b,
201
+ canAddUbo: u,
202
+ addressSuggestions: h,
203
+ submitAttempted: m
204
+ } = t, { t: s } = v(), p = D(null), f = D(null), N = D(void 0), I = ne(p, n.length), [w, T] = oe({}), y = S((e) => {
205
+ T((a) => a[e] ? a : { ...a, [e]: !0 });
206
+ }, []), { displayErrors: E, errorParams: F } = q(
207
+ () => ee(
208
+ l,
209
+ w,
210
+ m,
211
+ c,
212
+ n
213
+ ),
214
+ [l, w, m, c, n]
215
+ ), $ = S(
216
+ (e) => y(e),
217
+ [y]
218
+ ), A = S(
219
+ (e, a) => {
220
+ y(e), r.setField(e, a);
221
+ },
222
+ [r, y]
223
+ ), j = S(
224
+ (e, a, k) => {
225
+ y(`ubo-${e}-${a}`), r.setUboField(e, a, k);
226
+ },
227
+ [r, y]
228
+ ), W = S(
229
+ (e) => {
230
+ for (const a of he) y(a);
231
+ r.selectAddress(e);
232
+ },
233
+ [r, y]
234
+ ), z = S(
235
+ (e) => {
236
+ r.removeUbo(e), T((a) => {
237
+ const k = {};
238
+ for (const [C, U] of Object.entries(a)) {
239
+ const R = C.match(/^ubo-(\d+)-(name|surname)$/);
240
+ if (!R) {
241
+ k[C] = U;
242
+ continue;
243
+ }
244
+ const g = Number(R[1]);
245
+ if (g === e) continue;
246
+ const X = g > e ? g - 1 : g;
247
+ k[`ubo-${X}-${R[2]}`] = U;
248
+ }
249
+ return k;
250
+ });
251
+ },
252
+ [r]
253
+ );
254
+ V(() => {
255
+ const e = E.postalCode, a = N.current;
256
+ if (N.current = e, !e || a === e)
257
+ return;
258
+ const k = requestAnimationFrame(() => {
259
+ const C = f.current;
260
+ if (!C) return;
261
+ (C.querySelector("#postalCode-error") ?? C).scrollIntoView({
262
+ behavior: "smooth",
263
+ block: "nearest"
264
+ });
265
+ });
266
+ return () => cancelAnimationFrame(k);
267
+ }, [E.postalCode]);
268
+ const H = n.filter((e) => !O.has(e.name)), L = n.filter((e) => O.has(e.name));
269
+ return /* @__PURE__ */ o(K, { className: `IncodeEkybPage${I ? " IncodeEkybPageScrollable" : ""}`, title: s("ekyb.title"), children: [
270
+ /* @__PURE__ */ o("div", { ref: p, className: "IncodeEkybForm", children: [
271
+ /* @__PURE__ */ o(
272
+ be,
273
+ {
274
+ value: c,
275
+ onChange: (e) => r.setCountry(e)
276
+ }
277
+ ),
278
+ H.map((e) => /* @__PURE__ */ o(
279
+ B,
280
+ {
281
+ field: e,
282
+ value: i[e.name] ?? "",
283
+ error: E[e.name],
284
+ errorParams: F[e.name],
285
+ country: c,
286
+ onChange: A,
287
+ onBlur: $
288
+ },
289
+ e.name
290
+ )),
291
+ /* @__PURE__ */ o(
292
+ pe,
293
+ {
294
+ ubos: b,
295
+ errors: E,
296
+ errorParams: F,
297
+ canAddUbo: u,
298
+ onSetField: j,
299
+ onBlur: $,
300
+ onAdd: () => r.addUbo(),
301
+ onRemove: z
302
+ }
303
+ ),
304
+ L.length > 0 && /* @__PURE__ */ o(re, { children: [
305
+ /* @__PURE__ */ o("h3", { className: "IncodeEkybSectionHeader", children: s("ekyb.addressDetails") }),
306
+ L.map((e) => e.name === "street" ? /* @__PURE__ */ o(
307
+ se,
308
+ {
309
+ label: e.label,
310
+ value: i.street ?? "",
311
+ error: E.street,
312
+ errorParams: F.street,
313
+ suggestions: h,
314
+ optional: !e.required,
315
+ onChange: (a) => A("street", a),
316
+ onSearch: (a) => r.searchAddress(a),
317
+ onSelect: W,
318
+ onBlur: () => $("street")
319
+ },
320
+ e.name
321
+ ) : /* @__PURE__ */ o(
322
+ "div",
323
+ {
324
+ ref: e.name === "postalCode" ? f : void 0,
325
+ children: /* @__PURE__ */ o(
326
+ B,
327
+ {
328
+ field: e,
329
+ value: i[e.name] ?? "",
330
+ error: E[e.name],
331
+ errorParams: F[e.name],
332
+ country: c,
333
+ onChange: A,
334
+ onBlur: $
335
+ }
336
+ )
337
+ },
338
+ e.name
339
+ ))
340
+ ] })
341
+ ] }),
342
+ /* @__PURE__ */ o("div", { className: "IncodeEkybFooter", children: /* @__PURE__ */ o(
343
+ Z,
344
+ {
345
+ onClick: () => r.submit(),
346
+ disabled: !d,
347
+ "data-testid": "ekyb-submit",
348
+ children: s("ekyb.continue")
349
+ }
350
+ ) })
351
+ ] });
352
+ }, Ee = ({ config: t, onFinish: r }) => /* @__PURE__ */ o(J, { children: t ? /* @__PURE__ */ o(ye, { config: t, onFinish: r }) : null });
353
+ le(Ee, "incode-ekyb");
354
+ export {
355
+ Ee as EkybModule
356
+ };
@@ -9,6 +9,10 @@
9
9
  }
10
10
  }
11
11
 
12
+ .IncodeEkycSpinner {
13
+ flex: 1;
14
+ }
15
+
12
16
  .IncodeEkycPage {
13
17
  max-width: 480px;
14
18
  margin-inline: auto;
@@ -30,6 +34,14 @@
30
34
  margin-bottom: var(--spacing-0, var(--spacing-none, 0px));
31
35
  }
32
36
 
37
+ .IncodeEkycFooter {
38
+ margin-top: var(--spacing-24, var(--spacing-24, 24px));
39
+ align-items: center;
40
+ gap: var(--spacing-12, var(--spacing-12, 12px));
41
+ flex-direction: column;
42
+ display: flex;
43
+ }
44
+
33
45
  @media (min-width: 768px) {
34
46
  .IncodePageContainer.IncodeEkycPage {
35
47
  height: 100dvh;
@@ -52,7 +64,6 @@
52
64
  .IncodeEkycPage .IncodeEkycForm {
53
65
  min-height: var(--spacing-0, var(--spacing-none, 0px));
54
66
  padding-bottom: var(--spacing-8, var(--spacing-8, 8px));
55
- flex: 1;
56
67
  overflow-y: auto;
57
68
  }
58
69
 
@@ -0,0 +1,290 @@
1
+ import { u as r, I as Y, b as q, a as G, B as L } from "./button-Ca1tRSTI.js";
2
+ import { computeEkycDisplayErrors as j, createEkycManager as z } from "@incodetech/core/ekyc";
3
+ import { y as $, A as F, d as J, q as E, T as Q } from "./vendor-preact-BXf0bkEs.js";
4
+ import "./uiConfig-Z6RT23Sl.js";
5
+ import "@incodetech/core";
6
+ import { u as U, A as W } from "./addressAutocomplete-DetZGxBZ.js";
7
+ import { V as v, t as X, F as Z } from "./formField-FeX9N4c8.js";
8
+ import { D as f } from "./dateInputComposed-CvFmQpJ0.js";
9
+ import { D as ee } from "./dropdownComposed-B5ZuQS8C.js";
10
+ import { P as T } from "./page-BVHG3h0V.js";
11
+ import { S as re } from "./spinner-Cx3FPUCD.js";
12
+ import { r as oe } from "./incodeModule-aE-LkKwM.js";
13
+ import { P as te } from "./phoneInputComposed-CwtJKvGh.js";
14
+ const ae = ({ config: p, onFinish: s }) => {
15
+ const { t: l } = q(), [a, d] = G(() => z({ config: p }));
16
+ return $(() => {
17
+ (a.status === "finished" || a.status === "closed") && s?.();
18
+ }, [a.status, s]), a.status === "finished" || a.status === "closed" ? null : a.status === "loading" ? /* @__PURE__ */ r(
19
+ v,
20
+ {
21
+ status: "submitting",
22
+ submittingTitle: l("common.loading")
23
+ }
24
+ ) : a.status === "submitting" ? /* @__PURE__ */ r(T, { children: /* @__PURE__ */ r(
25
+ re,
26
+ {
27
+ fullScreen: !1,
28
+ title: l("common.processing"),
29
+ className: "IncodeEkycSpinner"
30
+ }
31
+ ) }) : a.status === "success" ? /* @__PURE__ */ r(v, { status: "success" }) : a.status === "error" ? /* @__PURE__ */ r(
32
+ v,
33
+ {
34
+ status: "failure",
35
+ onRetry: () => d.retry(),
36
+ onSkip: () => d.skip()
37
+ }
38
+ ) : a.status === "misconfigured" ? /* @__PURE__ */ r(
39
+ v,
40
+ {
41
+ status: "failure",
42
+ failureTitle: l("verification.noFormFields"),
43
+ onSkip: () => d.close(),
44
+ skipLabel: l("common.close")
45
+ }
46
+ ) : a.status === "form" ? /* @__PURE__ */ r(se, { state: a, manager: d }) : null;
47
+ }, ne = [
48
+ "street",
49
+ "city",
50
+ "state",
51
+ "postalCode",
52
+ "houseNo"
53
+ ], se = ({ state: p, manager: s }) => {
54
+ const {
55
+ fields: l,
56
+ values: a,
57
+ errors: d,
58
+ isValid: V,
59
+ addressSuggestions: w,
60
+ prefilled: K,
61
+ hideEmail: M,
62
+ fieldsCountry: C,
63
+ submitError: S,
64
+ submitAttempted: P
65
+ } = p, { t: n } = q(), N = F(null), A = F(null), R = F(void 0), x = U(N, l.length), [D, _] = J({}), h = E((e) => {
66
+ _((o) => o[e] ? o : { ...o, [e]: !0 });
67
+ }, []), { displayErrors: g, errorParams: I } = Q(
68
+ () => j(
69
+ d,
70
+ D,
71
+ P,
72
+ C,
73
+ l
74
+ ),
75
+ [d, D, P, C, l]
76
+ ), y = E(
77
+ (e) => h(e),
78
+ [h]
79
+ ), b = E(
80
+ (e, o) => {
81
+ h(e), s.setField(e, o);
82
+ },
83
+ [s, h]
84
+ ), H = E(
85
+ (e) => {
86
+ for (const o of ne) h(o);
87
+ s.selectAddress(e);
88
+ },
89
+ [s, h]
90
+ );
91
+ $(() => {
92
+ const e = g.postalCode, o = R.current;
93
+ if (R.current = e, !e || o === e)
94
+ return;
95
+ const i = requestAnimationFrame(() => {
96
+ const c = A.current;
97
+ if (!c) return;
98
+ (c.querySelector("#postalCode-error") ?? c).scrollIntoView({
99
+ behavior: "smooth",
100
+ block: "nearest"
101
+ });
102
+ });
103
+ return () => cancelAnimationFrame(i);
104
+ }, [g.postalCode]);
105
+ const k = (e, o) => X(n, o, I[e]);
106
+ let B;
107
+ return /* @__PURE__ */ r(T, { className: `IncodeEkycPage${x ? " IncodeEkycPageScrollable" : ""}`, title: n("verification.title"), children: [
108
+ /* @__PURE__ */ r("div", { ref: N, className: "IncodeEkycForm", children: l.map((e) => {
109
+ if (e.name === "email" && M) return null;
110
+ let o = null;
111
+ e.section && e.section !== B && (B = e.section, o = /* @__PURE__ */ r("h3", { className: "IncodeEkycSectionHeader", children: n({
112
+ address: "verification.labels.addressDetailsSection",
113
+ driverLicense: "verification.labels.dlDetailsSection"
114
+ }[e.section] ?? e.section) }));
115
+ const i = e.readonly || K[e.name], c = a[e.name] ?? "", u = g[e.name];
116
+ if (e.name === "street" && e.section === "address")
117
+ return /* @__PURE__ */ r("div", { children: [
118
+ o,
119
+ /* @__PURE__ */ r(
120
+ W,
121
+ {
122
+ label: e.label,
123
+ value: c,
124
+ error: u,
125
+ errorParams: I[e.name],
126
+ suggestions: w,
127
+ readonly: i,
128
+ optional: !e.required,
129
+ onChange: (t) => b("street", t),
130
+ onSearch: (t) => s.searchAddress(t),
131
+ onSelect: H,
132
+ onBlur: () => y("street")
133
+ }
134
+ )
135
+ ] }, e.name);
136
+ if (e.type === "dropdown") {
137
+ const t = n(e.label);
138
+ return /* @__PURE__ */ r("div", { children: [
139
+ o,
140
+ /* @__PURE__ */ r(
141
+ ee,
142
+ {
143
+ id: `ekyc-${e.name}`,
144
+ label: t,
145
+ placeholder: e.placeholder ? n(e.placeholder) : void 0,
146
+ value: c,
147
+ options: (e.options ?? []).map((m) => ({
148
+ ...m,
149
+ label: n(m.label)
150
+ })),
151
+ error: k(e.name, u),
152
+ disabled: i,
153
+ searchable: !0,
154
+ onChange: (m) => b(e.name, m),
155
+ onBlur: () => y(e.name),
156
+ "data-testid": `ekyc-field-${e.name}`
157
+ }
158
+ )
159
+ ] }, e.name);
160
+ }
161
+ if (e.type === "date") {
162
+ const t = n(e.label);
163
+ return /* @__PURE__ */ r("div", { children: [
164
+ o,
165
+ /* @__PURE__ */ r(
166
+ f,
167
+ {
168
+ id: `ekyc-${e.name}`,
169
+ label: t,
170
+ value: c,
171
+ error: k(e.name, u),
172
+ disabled: i,
173
+ onInput: (m) => {
174
+ const O = m.target;
175
+ b(e.name, O.value);
176
+ },
177
+ onBlur: () => y(e.name),
178
+ "data-testid": `ekyc-field-${e.name}`
179
+ }
180
+ )
181
+ ] }, e.name);
182
+ }
183
+ if (e.type === "phone") {
184
+ const t = n(e.label);
185
+ return /* @__PURE__ */ r("div", { children: [
186
+ o,
187
+ /* @__PURE__ */ r(
188
+ te,
189
+ {
190
+ id: `ekyc-${e.name}`,
191
+ label: t,
192
+ countryCode: C,
193
+ value: c,
194
+ placeholder: e.placeholder,
195
+ error: k(e.name, u),
196
+ disabled: i,
197
+ disableCountrySelector: e.disableCountrySelector,
198
+ required: e.required,
199
+ onChange: (m) => b(e.name, m),
200
+ onBlur: () => y(e.name),
201
+ "data-testid": `ekyc-field-${e.name}`
202
+ }
203
+ )
204
+ ] }, e.name);
205
+ }
206
+ return e.type === "radio" ? /* @__PURE__ */ r("div", { children: [
207
+ o,
208
+ /* @__PURE__ */ r("div", { className: "IncodeEkycRadioGroup", children: [
209
+ /* @__PURE__ */ r("label", { className: "IncodeEkycRadioLabel", children: n(e.label) }),
210
+ /* @__PURE__ */ r("div", { className: "IncodeEkycRadioOptions", children: e.options?.map((t) => /* @__PURE__ */ r(
211
+ "label",
212
+ {
213
+ className: "IncodeEkycRadioOption",
214
+ children: [
215
+ /* @__PURE__ */ r(
216
+ "input",
217
+ {
218
+ type: "radio",
219
+ name: e.name,
220
+ checked: c === t.value,
221
+ value: t.value,
222
+ onChange: () => b(e.name, t.value),
223
+ onBlur: () => y(e.name),
224
+ disabled: i
225
+ }
226
+ ),
227
+ /* @__PURE__ */ r("span", { children: n(t.label) })
228
+ ]
229
+ },
230
+ t.value
231
+ )) }),
232
+ u && /* @__PURE__ */ r("span", { className: "IncodeEkycFieldError", children: k(e.name, u) })
233
+ ] })
234
+ ] }, e.name) : /* @__PURE__ */ r(
235
+ "div",
236
+ {
237
+ ref: e.name === "postalCode" ? A : void 0,
238
+ children: [
239
+ o,
240
+ /* @__PURE__ */ r(
241
+ Z,
242
+ {
243
+ name: e.name,
244
+ label: e.label,
245
+ value: c,
246
+ error: u,
247
+ errorParams: I[e.name],
248
+ type: e.type,
249
+ placeholder: e.placeholder,
250
+ placeholderParams: e.placeholderParams,
251
+ required: e.required,
252
+ optional: e.optional,
253
+ readonly: i,
254
+ maxLength: e.maxLength,
255
+ onChange: b,
256
+ onBlur: y
257
+ }
258
+ )
259
+ ]
260
+ },
261
+ e.name
262
+ );
263
+ }) }),
264
+ /* @__PURE__ */ r("div", { className: "IncodeEkycFooter", children: [
265
+ S && /* @__PURE__ */ r("p", { className: "IncodeEkycSubmitError", children: n(S) }),
266
+ /* @__PURE__ */ r(
267
+ L,
268
+ {
269
+ onClick: () => s.submit(),
270
+ disabled: !V,
271
+ "data-testid": "ekyc-submit",
272
+ children: n("common.continue")
273
+ }
274
+ ),
275
+ S === "verification.errors.countryNotSupported" && /* @__PURE__ */ r(
276
+ L,
277
+ {
278
+ variant: "link",
279
+ onClick: () => s.skip(),
280
+ "data-testid": "ekyc-skip",
281
+ children: n("verification.labels.skip")
282
+ }
283
+ )
284
+ ] })
285
+ ] });
286
+ }, ce = ({ config: p, onFinish: s }) => /* @__PURE__ */ r(Y, { children: p ? /* @__PURE__ */ r(ae, { config: p, onFinish: s }) : null });
287
+ oe(ce, "incode-ekyc");
288
+ export {
289
+ ce as EkycModule
290
+ };
@@ -2000,8 +2000,8 @@ const Pe = () => import("../id/id.es.js").then((e) => e.Id), ke = {
2000
2000
  (e) => e.GovernmentValidation
2001
2001
  ),
2002
2002
  GEOLOCATION: () => import("../geolocation/geolocation.es.js").then((e) => e.Geolocation),
2003
- EXTERNAL_VERIFICATION: () => import("../ekycModule-CQsPzNhO.js").then((e) => e.EkycModule),
2004
- EKYB: () => import("../ekybModule-DUoTzXAx.js").then((e) => e.EkybModule),
2003
+ EXTERNAL_VERIFICATION: () => import("../ekycModule-BN_zKKux.js").then((e) => e.EkycModule),
2004
+ EKYB: () => import("../ekybModule-9m8cnkfH.js").then((e) => e.EkybModule),
2005
2005
  DOCUMENT_CAPTURE: () => import("../documentCapture-PdKA2frR.js").then(
2006
2006
  (e) => e.DocumentCapture
2007
2007
  ),
@@ -5395,6 +5395,10 @@
5395
5395
  display: inline-block;
5396
5396
  }
5397
5397
 
5398
+ .IncodeEkycSpinner {
5399
+ flex: 1;
5400
+ }
5401
+
5398
5402
  .IncodeEkycPage {
5399
5403
  max-width: 480px;
5400
5404
  margin-inline: auto;
@@ -5416,6 +5420,14 @@
5416
5420
  margin-bottom: var(--spacing-0, var(--spacing-none, 0px));
5417
5421
  }
5418
5422
 
5423
+ .IncodeEkycFooter {
5424
+ margin-top: var(--spacing-24, var(--spacing-24, 24px));
5425
+ align-items: center;
5426
+ gap: var(--spacing-12, var(--spacing-12, 12px));
5427
+ flex-direction: column;
5428
+ display: flex;
5429
+ }
5430
+
5419
5431
  @media (min-width: 768px) {
5420
5432
  .IncodePageContainer.IncodeEkycPage {
5421
5433
  height: 100dvh;
@@ -5438,7 +5450,6 @@
5438
5450
  .IncodeEkycPage .IncodeEkycForm {
5439
5451
  min-height: var(--spacing-0, var(--spacing-none, 0px));
5440
5452
  padding-bottom: var(--spacing-8, var(--spacing-8, 8px));
5441
- flex: 1;
5442
5453
  overflow-y: auto;
5443
5454
  }
5444
5455
 
@@ -5722,6 +5733,10 @@
5722
5733
  background-color: #0000;
5723
5734
  }
5724
5735
 
5736
+ .IncodeEkybSpinner {
5737
+ flex: 1;
5738
+ }
5739
+
5725
5740
  .IncodeEkybPage {
5726
5741
  max-width: 480px;
5727
5742
  margin-inline: auto;
@@ -5747,6 +5762,10 @@
5747
5762
  margin-inline: auto;
5748
5763
  }
5749
5764
 
5765
+ .IncodeEkybFooter {
5766
+ margin-top: var(--spacing-24, var(--spacing-24, 24px));
5767
+ }
5768
+
5750
5769
  @media (min-width: 768px) {
5751
5770
  .IncodePageContainer.IncodeEkybPage {
5752
5771
  margin-top: var(--spacing-0, var(--spacing-none, 0px));
@@ -5769,7 +5788,6 @@
5769
5788
  .IncodeEkybPage .IncodeEkybForm {
5770
5789
  min-height: var(--spacing-0, var(--spacing-none, 0px));
5771
5790
  padding-bottom: var(--spacing-8, var(--spacing-8, 8px));
5772
- flex: 1;
5773
5791
  overflow-y: auto;
5774
5792
  }
5775
5793
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@incodetech/web",
3
- "version": "0.0.0-dev-20260317-5e90a15",
3
+ "version": "0.0.0-dev-20260318-7381409",
4
4
  "type": "module",
5
5
  "main": "./dist/index.es.js",
6
6
  "types": "./dist/types/index.d.ts",
@@ -119,7 +119,7 @@
119
119
  "preact-custom-element": "^4.6.0",
120
120
  "qrcode": "^1.5.4",
121
121
  "tailwindcss": "^4.1.17",
122
- "@incodetech/core": "0.0.0-dev-20260317-5e90a15"
122
+ "@incodetech/core": "0.0.0-dev-20260318-7381409"
123
123
  },
124
124
  "devDependencies": {
125
125
  "@microsoft/api-extractor": "^7.53.3",
@@ -1,302 +0,0 @@
1
- import { b as C, u as r, I as D, a as M, S as L, B as T } from "./button-Ca1tRSTI.js";
2
- import { SUPPORTED_COUNTRIES as f, DEV_ONLY_COUNTRIES as B, createEkybManager as O } from "@incodetech/core/ekyb";
3
- import { T as _, y as A, A as F, k as q } from "./vendor-preact-BXf0bkEs.js";
4
- import "./uiConfig-Z6RT23Sl.js";
5
- import "@incodetech/core";
6
- import { u as V, A as G } from "./addressAutocomplete-DetZGxBZ.js";
7
- import { P as K } from "./page-BVHG3h0V.js";
8
- import { t as P, F as z, V as I } from "./formField-FeX9N4c8.js";
9
- import { r as W } from "./incodeModule-aE-LkKwM.js";
10
- import { D as R } from "./dropdownComposed-B5ZuQS8C.js";
11
- import { I as g } from "./inputComposed-BHi-MSpP.js";
12
- function Y(e) {
13
- return [...e.toUpperCase()].map((o) => String.fromCodePoint(127462 + o.charCodeAt(0) - 65)).join("");
14
- }
15
- const j = {
16
- BR: "Brazil",
17
- CM: "Cameroon",
18
- CN: "China",
19
- FR: "France",
20
- DE: "Germany",
21
- IL: "Israel",
22
- IT: "Italy",
23
- KE: "Kenya",
24
- MX: "Mexico",
25
- NG: "Nigeria",
26
- ES: "Spain",
27
- GB: "United Kingdom",
28
- US: "USA"
29
- };
30
- function H(e) {
31
- const o = j[e] ?? e;
32
- return { value: e, label: `${Y(e)} ${o}` };
33
- }
34
- function X() {
35
- if (typeof window > "u") return !1;
36
- const { hostname: e } = window.location;
37
- return e === "localhost" || e.includes("stage") || e.includes("demo");
38
- }
39
- const J = ({
40
- value: e,
41
- onChange: o
42
- }) => {
43
- const { t: u } = C(), n = _(() => (X() ? [...f, ...B] : [...f]).map(H).sort((l, c) => l.label.localeCompare(c.label)), []);
44
- return /* @__PURE__ */ r("div", { className: "IncodeEkybCountrySelector", children: /* @__PURE__ */ r(
45
- R,
46
- {
47
- id: "ekyb-country",
48
- label: u("ekyb.country"),
49
- value: e,
50
- options: n,
51
- onChange: o,
52
- "data-testid": "ekyb-country-selector"
53
- }
54
- ) });
55
- }, U = ({
56
- field: e,
57
- value: o,
58
- error: u,
59
- errorParams: n,
60
- country: m,
61
- onChange: l,
62
- onBlur: c
63
- }) => {
64
- const { t: b } = C(), i = !e.required, y = b(e.label);
65
- if (e.type === "dropdown") {
66
- const d = i ? `${y} (${b("common.optional")})` : y, s = e.name === "state" ? b("ekyb.selectState") : void 0;
67
- return /* @__PURE__ */ r(
68
- R,
69
- {
70
- id: `ekyb-${e.name}`,
71
- label: d,
72
- placeholder: s,
73
- value: o,
74
- options: (e.options ?? []).map((p) => ({
75
- ...p,
76
- label: b(p.label)
77
- })),
78
- error: P(b, u, n),
79
- searchable: !0,
80
- onChange: (p) => l(e.name, p),
81
- onBlur: c ? () => c(e.name) : void 0,
82
- "data-testid": `ekyb-field-${e.name}`
83
- }
84
- );
85
- }
86
- return /* @__PURE__ */ r(
87
- z,
88
- {
89
- name: e.name,
90
- label: e.label,
91
- value: o,
92
- error: u,
93
- errorParams: n,
94
- required: e.required,
95
- optional: i,
96
- onChange: l,
97
- onBlur: c
98
- }
99
- );
100
- }, Q = ({
101
- ubos: e,
102
- errors: o,
103
- errorParams: u,
104
- canAddUbo: n,
105
- onSetField: m,
106
- onBlur: l,
107
- onAdd: c,
108
- onRemove: b
109
- }) => {
110
- const { t: i } = C(), y = (d) => P(i, o[d], u[d]);
111
- return e.length === 0 ? null : /* @__PURE__ */ r("div", { className: "IncodeEkybUbos", children: [
112
- e.map((d, s) => {
113
- const p = s === 0 ? i("ekyb.uboName") : i("ekyb.uboNameWithNumber", { number: s + 1 }), E = s === 0 ? i("ekyb.uboSurname") : i("ekyb.uboSurnameWithNumber", { number: s + 1 }), v = s === 0;
114
- return /* @__PURE__ */ r("div", { className: "IncodeEkybUboEntry", children: [
115
- /* @__PURE__ */ r(
116
- g,
117
- {
118
- id: `ubo-${s}-name`,
119
- label: p,
120
- name: `ubo-${s}-name`,
121
- value: d.name,
122
- error: y(`ubo-${s}-name`),
123
- onInput: (k) => m(s, "name", k.target.value),
124
- onBlur: l ? () => l(`ubo-${s}-name`) : void 0,
125
- "data-testid": `ekyb-ubo-${s}-name`
126
- }
127
- ),
128
- /* @__PURE__ */ r(
129
- g,
130
- {
131
- id: `ubo-${s}-surname`,
132
- label: E,
133
- name: `ubo-${s}-surname`,
134
- value: d.surname,
135
- error: y(`ubo-${s}-surname`),
136
- onInput: (k) => m(
137
- s,
138
- "surname",
139
- k.target.value
140
- ),
141
- onBlur: l ? () => l(`ubo-${s}-surname`) : void 0,
142
- "data-testid": `ekyb-ubo-${s}-surname`
143
- }
144
- ),
145
- !v && /* @__PURE__ */ r(
146
- "button",
147
- {
148
- className: "IncodeEkybRemoveUbo",
149
- onClick: () => b(s),
150
- type: "button",
151
- children: i("common.remove")
152
- }
153
- )
154
- ] }, d.id);
155
- }),
156
- n && /* @__PURE__ */ r(
157
- "button",
158
- {
159
- className: "IncodeEkybAddUbo",
160
- onClick: c,
161
- type: "button",
162
- "data-testid": "ekyb-add-ubo",
163
- children: i("ekyb.addAnotherUbo")
164
- }
165
- )
166
- ] });
167
- }, Z = ({ config: e, onFinish: o }) => {
168
- const { t: u } = C(), [n, m] = M(() => O({ config: e }));
169
- return A(() => {
170
- (n.status === "finished" || n.status === "closed") && o?.();
171
- }, [n.status, o]), n.status === "finished" || n.status === "closed" ? null : n.status === "loading" ? /* @__PURE__ */ r(
172
- I,
173
- {
174
- status: "submitting",
175
- submittingTitle: u("common.loading")
176
- }
177
- ) : n.status === "submitting" ? /* @__PURE__ */ r(I, { status: "submitting" }) : n.status === "success" ? /* @__PURE__ */ r(I, { status: "success" }) : n.status === "error" ? /* @__PURE__ */ r(I, { status: "failure", onRetry: () => m.retry() }) : n.status === "form" ? /* @__PURE__ */ r(x, { state: n, manager: m }) : null;
178
- }, $ = /* @__PURE__ */ new Set([
179
- "street",
180
- "houseNo",
181
- "addressLine2",
182
- "city",
183
- "state",
184
- "postalCode"
185
- ]), x = ({ state: e, manager: o }) => {
186
- const {
187
- country: u,
188
- fields: n,
189
- values: m,
190
- displayErrors: l,
191
- errorParams: c,
192
- isValid: b,
193
- ubos: i,
194
- canAddUbo: y,
195
- addressSuggestions: d
196
- } = e, { t: s } = C(), p = F(null), E = F(null), v = F(void 0), k = V(p, n.length);
197
- A(() => {
198
- const t = l.postalCode, a = v.current;
199
- if (v.current = t, !t || a === t)
200
- return;
201
- const h = requestAnimationFrame(() => {
202
- const S = E.current;
203
- if (!S) return;
204
- (S.querySelector("#postalCode-error") ?? S).scrollIntoView({
205
- behavior: "smooth",
206
- block: "nearest"
207
- });
208
- });
209
- return () => cancelAnimationFrame(h);
210
- }, [l.postalCode]);
211
- const w = n.filter((t) => !$.has(t.name)), N = n.filter((t) => $.has(t.name));
212
- return /* @__PURE__ */ r(K, { className: `IncodeEkybPage${k ? " IncodeEkybPageScrollable" : ""}`, title: s("ekyb.title"), children: [
213
- /* @__PURE__ */ r("div", { ref: p, className: "IncodeEkybForm", children: [
214
- /* @__PURE__ */ r(
215
- J,
216
- {
217
- value: u,
218
- onChange: (t) => o.setCountry(t)
219
- }
220
- ),
221
- w.map((t) => /* @__PURE__ */ r(
222
- U,
223
- {
224
- field: t,
225
- value: m[t.name] ?? "",
226
- error: l[t.name],
227
- errorParams: c[t.name],
228
- country: u,
229
- onChange: (a, h) => o.setField(a, h),
230
- onBlur: (a) => o.blurField(a)
231
- },
232
- t.name
233
- )),
234
- /* @__PURE__ */ r(
235
- Q,
236
- {
237
- ubos: i,
238
- errors: l,
239
- errorParams: c,
240
- canAddUbo: y,
241
- onSetField: (t, a, h) => o.setUboField(t, a, h),
242
- onBlur: (t) => o.blurField(t),
243
- onAdd: () => o.addUbo(),
244
- onRemove: (t) => o.removeUbo(t)
245
- }
246
- ),
247
- N.length > 0 && /* @__PURE__ */ r(q, { children: [
248
- /* @__PURE__ */ r("h3", { className: "IncodeEkybSectionHeader", children: s("ekyb.addressDetails") }),
249
- N.map((t) => t.name === "street" ? /* @__PURE__ */ r(
250
- G,
251
- {
252
- label: t.label,
253
- value: m.street ?? "",
254
- error: l.street,
255
- errorParams: c.street,
256
- suggestions: d,
257
- optional: !t.required,
258
- onChange: (a) => o.setField("street", a),
259
- onSearch: (a) => o.searchAddress(a),
260
- onSelect: (a) => o.selectAddress(a),
261
- onBlur: () => o.blurField("street")
262
- },
263
- t.name
264
- ) : /* @__PURE__ */ r(
265
- "div",
266
- {
267
- ref: t.name === "postalCode" ? E : void 0,
268
- children: /* @__PURE__ */ r(
269
- U,
270
- {
271
- field: t,
272
- value: m[t.name] ?? "",
273
- error: l[t.name],
274
- errorParams: c[t.name],
275
- country: u,
276
- onChange: (a, h) => o.setField(a, h),
277
- onBlur: (a) => o.blurField(a)
278
- }
279
- )
280
- },
281
- t.name
282
- ))
283
- ] })
284
- ] }),
285
- /* @__PURE__ */ r("div", { className: "IncodeEkybFooter", children: [
286
- /* @__PURE__ */ r(L, { size: 32 }),
287
- /* @__PURE__ */ r(
288
- T,
289
- {
290
- onClick: () => o.submit(),
291
- disabled: !b,
292
- "data-testid": "ekyb-submit",
293
- children: s("ekyb.continue")
294
- }
295
- )
296
- ] })
297
- ] });
298
- }, ee = ({ config: e, onFinish: o }) => /* @__PURE__ */ r(D, { children: e ? /* @__PURE__ */ r(Z, { config: e, onFinish: o }) : null });
299
- W(ee, "incode-ekyb");
300
- export {
301
- ee as EkybModule
302
- };
@@ -1,243 +0,0 @@
1
- import { u as r, I as q, b as S, a as D, S as V, B as w } from "./button-Ca1tRSTI.js";
2
- import { createEkycManager as M } from "@incodetech/core/ekyc";
3
- import { y as g, A as v } from "./vendor-preact-BXf0bkEs.js";
4
- import "./uiConfig-Z6RT23Sl.js";
5
- import "@incodetech/core";
6
- import { u as x, A as T } from "./addressAutocomplete-DetZGxBZ.js";
7
- import { V as b, t as H, F as K } from "./formField-FeX9N4c8.js";
8
- import { D as O } from "./dateInputComposed-CvFmQpJ0.js";
9
- import { D as z } from "./dropdownComposed-B5ZuQS8C.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-CwtJKvGh.js";
13
- const Q = ({ config: m, onFinish: o }) => {
14
- const { t: p } = S(), [a, i] = D(() => M({ config: m }));
15
- return g(() => {
16
- (a.status === "finished" || a.status === "closed") && o?.();
17
- }, [a.status, o]), a.status === "finished" || a.status === "closed" ? null : a.status === "loading" ? /* @__PURE__ */ r(
18
- b,
19
- {
20
- status: "submitting",
21
- submittingTitle: p("common.loading")
22
- }
23
- ) : a.status === "submitting" ? /* @__PURE__ */ r(b, { status: "submitting" }) : a.status === "success" ? /* @__PURE__ */ r(b, { status: "success" }) : a.status === "error" ? /* @__PURE__ */ r(
24
- b,
25
- {
26
- status: "failure",
27
- onRetry: () => i.retry(),
28
- onSkip: () => i.skip()
29
- }
30
- ) : a.status === "misconfigured" ? /* @__PURE__ */ r(
31
- b,
32
- {
33
- status: "failure",
34
- failureTitle: p("verification.noFormFields"),
35
- onSkip: () => i.close(),
36
- skipLabel: p("common.close")
37
- }
38
- ) : a.status === "form" ? /* @__PURE__ */ r(U, { state: a, manager: i }) : null;
39
- }, U = ({ state: m, manager: o }) => {
40
- const {
41
- fields: p,
42
- values: a,
43
- displayErrors: i,
44
- errorParams: y,
45
- isValid: P,
46
- addressSuggestions: N,
47
- prefilled: R,
48
- hideEmail: A,
49
- fieldsCountry: B,
50
- submitError: k
51
- } = m, { t: s } = S(), E = v(null), C = v(null), F = v(void 0), L = x(E, p.length);
52
- g(() => {
53
- const e = i.postalCode, n = F.current;
54
- if (F.current = e, !e || n === e)
55
- return;
56
- const u = requestAnimationFrame(() => {
57
- const l = C.current;
58
- if (!l) return;
59
- (l.querySelector("#postalCode-error") ?? l).scrollIntoView({
60
- behavior: "smooth",
61
- block: "nearest"
62
- });
63
- });
64
- return () => cancelAnimationFrame(u);
65
- }, [i.postalCode]);
66
- const h = (e, n) => H(s, n, y[e]);
67
- let I;
68
- return /* @__PURE__ */ r(G, { className: `IncodeEkycPage${L ? " IncodeEkycPageScrollable" : ""}`, title: s("verification.title"), children: [
69
- /* @__PURE__ */ r("div", { ref: E, className: "IncodeEkycForm", children: p.map((e) => {
70
- if (e.name === "email" && A) return null;
71
- let n = null;
72
- e.section && e.section !== I && (I = e.section, n = /* @__PURE__ */ r("h3", { className: "IncodeEkycSectionHeader", children: s({
73
- address: "verification.labels.addressDetailsSection",
74
- driverLicense: "verification.labels.dlDetailsSection"
75
- }[e.section] ?? e.section) }));
76
- const u = e.readonly || R[e.name], l = a[e.name] ?? "", d = i[e.name];
77
- if (e.name === "street" && e.section === "address")
78
- return /* @__PURE__ */ r("div", { children: [
79
- n,
80
- /* @__PURE__ */ r(
81
- T,
82
- {
83
- label: e.label,
84
- value: l,
85
- error: d,
86
- errorParams: y[e.name],
87
- suggestions: N,
88
- readonly: u,
89
- optional: !e.required,
90
- onChange: (t) => o.setField("street", t),
91
- onSearch: (t) => o.searchAddress(t),
92
- onSelect: (t) => o.selectAddress(t),
93
- onBlur: () => o.blurField("street")
94
- }
95
- )
96
- ] }, e.name);
97
- if (e.type === "dropdown") {
98
- const t = s(e.label);
99
- return /* @__PURE__ */ r("div", { children: [
100
- n,
101
- /* @__PURE__ */ r(
102
- z,
103
- {
104
- id: `ekyc-${e.name}`,
105
- label: t,
106
- placeholder: e.placeholder ? s(e.placeholder) : void 0,
107
- value: l,
108
- options: (e.options ?? []).map((c) => ({
109
- ...c,
110
- label: s(c.label)
111
- })),
112
- error: h(e.name, d),
113
- disabled: u,
114
- searchable: !0,
115
- onChange: (c) => o.setField(e.name, c),
116
- onBlur: () => o.blurField(e.name),
117
- "data-testid": `ekyc-field-${e.name}`
118
- }
119
- )
120
- ] }, e.name);
121
- }
122
- if (e.type === "date") {
123
- const t = s(e.label);
124
- return /* @__PURE__ */ r("div", { children: [
125
- n,
126
- /* @__PURE__ */ r(
127
- O,
128
- {
129
- id: `ekyc-${e.name}`,
130
- label: t,
131
- value: l,
132
- error: h(e.name, d),
133
- disabled: u,
134
- onInput: (c) => {
135
- const $ = c.target;
136
- o.setField(e.name, $.value);
137
- },
138
- onBlur: () => o.blurField(e.name),
139
- "data-testid": `ekyc-field-${e.name}`
140
- }
141
- )
142
- ] }, e.name);
143
- }
144
- if (e.type === "phone") {
145
- const t = s(e.label);
146
- return /* @__PURE__ */ r("div", { children: [
147
- n,
148
- /* @__PURE__ */ r(
149
- J,
150
- {
151
- id: `ekyc-${e.name}`,
152
- label: t,
153
- countryCode: B,
154
- value: l,
155
- placeholder: e.placeholder,
156
- error: h(e.name, d),
157
- disabled: u,
158
- disableCountrySelector: e.disableCountrySelector,
159
- required: e.required,
160
- onChange: (c) => o.setField(e.name, c),
161
- onBlur: () => o.blurField(e.name),
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: s(e.label) }),
171
- /* @__PURE__ */ r("div", { className: "IncodeEkycRadioOptions", children: e.options?.map((t) => /* @__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: l === t.value,
182
- value: t.value,
183
- onChange: () => o.setField(e.name, t.value),
184
- onBlur: () => o.blurField(e.name),
185
- disabled: u
186
- }
187
- ),
188
- /* @__PURE__ */ r("span", { children: s(t.label) })
189
- ]
190
- },
191
- t.value
192
- )) }),
193
- d && /* @__PURE__ */ r("span", { className: "IncodeEkycFieldError", children: h(e.name, d) })
194
- ] })
195
- ] }, e.name) : /* @__PURE__ */ r(
196
- "div",
197
- {
198
- ref: e.name === "postalCode" ? C : void 0,
199
- children: [
200
- n,
201
- /* @__PURE__ */ r(
202
- K,
203
- {
204
- name: e.name,
205
- label: e.label,
206
- value: l,
207
- error: d,
208
- errorParams: y[e.name],
209
- type: e.type,
210
- placeholder: e.placeholder,
211
- placeholderParams: e.placeholderParams,
212
- required: e.required,
213
- optional: e.optional,
214
- readonly: u,
215
- maxLength: e.maxLength,
216
- onChange: (t, c) => o.setField(t, c),
217
- onBlur: (t) => o.blurField(t)
218
- }
219
- )
220
- ]
221
- },
222
- e.name
223
- );
224
- }) }),
225
- /* @__PURE__ */ r("div", { className: "IncodeEkycFooter", children: [
226
- /* @__PURE__ */ r(V, { size: 32 }),
227
- k && /* @__PURE__ */ r("p", { className: "IncodeEkycSubmitError", children: s(k) }),
228
- /* @__PURE__ */ r(
229
- w,
230
- {
231
- onClick: () => o.submit(),
232
- disabled: !P,
233
- "data-testid": "ekyc-submit",
234
- children: s("common.continue")
235
- }
236
- )
237
- ] })
238
- ] });
239
- }, W = ({ config: m, onFinish: o }) => /* @__PURE__ */ r(q, { children: m ? /* @__PURE__ */ r(Q, { config: m, onFinish: o }) : null });
240
- j(W, "incode-ekyc");
241
- export {
242
- W as EkycModule
243
- };