@incodetech/web 0.0.0-dev-20260317-6ffceac → 0.0.0-dev-20260317-5e90a15

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,11 +1,11 @@
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";
1
+ import { d, y as M, A as F, q as K } from "./vendor-preact-BXf0bkEs.js";
2
+ import { b as Q, u as l } from "./button-Ca1tRSTI.js";
3
3
  import "./uiConfig-Z6RT23Sl.js";
4
- import { t as Q } from "./formField-UWsp-7Fj.js";
5
- import { I as R } from "./inputComposed-BHi-MSpP.js";
4
+ import { t as R } from "./formField-FeX9N4c8.js";
5
+ import { I as q } from "./inputComposed-BHi-MSpP.js";
6
6
  import "@incodetech/core";
7
- import { u as q } from "./useMediaQuery-CiSMgDyi.js";
8
- function G(c, f) {
7
+ import { u as z } from "./useMediaQuery-CiSMgDyi.js";
8
+ function J(c, f) {
9
9
  const [A, h] = d(!1);
10
10
  return M(() => {
11
11
  const o = c.current;
@@ -16,7 +16,7 @@ function G(c, f) {
16
16
  return u.observe(o), () => u.disconnect();
17
17
  }, [f, c]), A;
18
18
  }
19
- const J = ({
19
+ const V = ({
20
20
  label: c,
21
21
  value: f,
22
22
  error: A,
@@ -26,9 +26,10 @@ const J = ({
26
26
  optional: u,
27
27
  onChange: w,
28
28
  onSearch: k,
29
- onSelect: N
29
+ onSelect: N,
30
+ onBlur: D
30
31
  }) => {
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
+ const { t: n } = Q(), [x, a] = d(!1), [C, m] = d(!1), [E, S] = d(""), [s, r] = d(-1), v = F(null), p = "ekyc-address-listbox", I = z(), g = n(c), $ = u ? `${g} (${n("common.optional")})` : g;
32
33
  M(() => {
33
34
  function e(t) {
34
35
  v.current && !v.current.contains(t.target) && a(!1);
@@ -37,32 +38,33 @@ const J = ({
37
38
  }, []), M(() => {
38
39
  r(-1);
39
40
  }, [o]);
40
- const b = F(
41
+ const b = K(
41
42
  (e) => {
42
43
  N(e), a(!1), m(!1), r(-1);
43
44
  },
44
45
  [N]
45
- ), $ = (e) => {
46
+ ), O = (e) => {
46
47
  w(e), e.length >= 3 ? I ? (m(!0), S(e)) : (k(e), a(!0)) : a(!1);
47
- }, O = (e) => {
48
+ }, L = (e) => {
48
49
  !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
+ }, y = !I && x && o.length > 0, H = y && s >= 0 ? `${p}-option-${s}` : void 0;
50
51
  return /* @__PURE__ */ l("div", { className: "IncodeAddressAutocomplete", ref: v, children: [
51
52
  /* @__PURE__ */ l(
52
- R,
53
+ q,
53
54
  {
54
55
  id: "ekyc-street",
55
- label: E,
56
+ label: $,
56
57
  name: "street",
57
58
  value: f,
58
59
  readOnly: i,
59
- error: Q(n, A, h),
60
- onInput: (e) => $(e.target.value),
61
- onKeyDown: O,
60
+ error: R(n, A, h),
61
+ onInput: (e) => O(e.target.value),
62
+ onKeyDown: L,
63
+ onBlur: D,
62
64
  role: "combobox",
63
65
  "aria-expanded": y,
64
66
  "aria-controls": p,
65
- "aria-activedescendant": L,
67
+ "aria-activedescendant": H,
66
68
  "aria-autocomplete": "list",
67
69
  "data-testid": "ekyc-address-input"
68
70
  }
@@ -87,7 +89,7 @@ const J = ({
87
89
  ))
88
90
  }
89
91
  ),
90
- I && D && /* @__PURE__ */ l("div", { className: "IncodeAddressAutocompleteModalOverlay", children: /* @__PURE__ */ l("div", { className: "IncodeAddressAutocompleteModal", children: [
92
+ I && C && /* @__PURE__ */ l("div", { className: "IncodeAddressAutocompleteModalOverlay", children: /* @__PURE__ */ l("div", { className: "IncodeAddressAutocompleteModal", children: [
91
93
  /* @__PURE__ */ l("div", { className: "IncodeAddressAutocompleteModalHeader", children: [
92
94
  /* @__PURE__ */ l("h3", { children: n("verification.addressSearch") }),
93
95
  /* @__PURE__ */ l(
@@ -106,7 +108,7 @@ const J = ({
106
108
  {
107
109
  className: "IncodeAddressAutocompleteModalInput",
108
110
  type: "text",
109
- value: C,
111
+ value: E,
110
112
  placeholder: n("verification.addressPlaceholder"),
111
113
  onInput: (e) => {
112
114
  const t = e.target.value;
@@ -146,6 +148,6 @@ const J = ({
146
148
  ] });
147
149
  };
148
150
  export {
149
- J as A,
150
- G as u
151
+ V as A,
152
+ J as u
151
153
  };
@@ -0,0 +1,302 @@
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
+ };
@@ -22,7 +22,7 @@
22
22
  display: flex;
23
23
  }
24
24
 
25
- .IncodeEkycForm .IncodeInputComposed, .IncodeEkycForm .IncodeDropdownComposed, .IncodeEkycForm .IncodeDateInputComposed, .IncodeEkycForm .IncodeAddressAutocomplete {
25
+ .IncodeEkycForm .IncodeInputComposed, .IncodeEkycForm .IncodeDropdownComposed, .IncodeEkycForm .IncodeDateInputComposed, .IncodeEkycForm .IncodePhoneInputComposed, .IncodeEkycForm .IncodeAddressAutocomplete {
26
26
  margin-inline: auto;
27
27
  }
28
28
 
@@ -1,164 +1,164 @@
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";
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
4
  import "./uiConfig-Z6RT23Sl.js";
5
5
  import "@incodetech/core";
6
- import { u as T, A as B } from "./addressAutocomplete-3u5x8ZFs.js";
7
- import { V as b, t as H, F as K } from "./formField-UWsp-7Fj.js";
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
8
  import { D as O } from "./dateInputComposed-CvFmQpJ0.js";
9
9
  import { D as z } from "./dropdownComposed-B5ZuQS8C.js";
10
10
  import { P as G } from "./page-BVHG3h0V.js";
11
11
  import { r as j } from "./incodeModule-aE-LkKwM.js";
12
12
  import { P as J } from "./phoneInputComposed-CwtJKvGh.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(
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(
22
18
  b,
23
19
  {
24
20
  status: "submitting",
25
- submittingTitle: h("common.loading")
21
+ submittingTitle: p("common.loading")
26
22
  }
27
- ) : t.status === "submitting" ? /* @__PURE__ */ r(b, { status: "submitting" }) : t.status === "success" ? /* @__PURE__ */ r(b, { status: "success" }) : t.status === "error" ? /* @__PURE__ */ r(
23
+ ) : a.status === "submitting" ? /* @__PURE__ */ r(b, { status: "submitting" }) : a.status === "success" ? /* @__PURE__ */ r(b, { status: "success" }) : a.status === "error" ? /* @__PURE__ */ r(
28
24
  b,
29
25
  {
30
26
  status: "failure",
31
27
  onRetry: () => i.retry(),
32
28
  onSkip: () => i.skip()
33
29
  }
34
- ) : t.status === "misconfigured" ? /* @__PURE__ */ r(
30
+ ) : a.status === "misconfigured" ? /* @__PURE__ */ r(
35
31
  b,
36
32
  {
37
33
  status: "failure",
38
- failureTitle: h("verification.noFormFields"),
34
+ failureTitle: p("verification.noFormFields"),
39
35
  onSkip: () => i.close(),
40
- skipLabel: h("common.close")
36
+ skipLabel: p("common.close")
41
37
  }
42
- ) : t.status === "form" ? /* @__PURE__ */ r(U, { state: t, manager: i }) : null;
43
- }, U = ({ state: p, manager: s }) => {
38
+ ) : a.status === "form" ? /* @__PURE__ */ r(U, { state: a, manager: i }) : null;
39
+ }, U = ({ state: m, manager: o }) => {
44
40
  const {
45
- fields: m,
46
- values: h,
47
- displayErrors: t,
48
- errorParams: i,
49
- isValid: y,
41
+ fields: p,
42
+ values: a,
43
+ displayErrors: i,
44
+ errorParams: y,
45
+ isValid: P,
50
46
  addressSuggestions: N,
51
47
  prefilled: R,
52
48
  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)
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)
59
55
  return;
60
56
  const u = requestAnimationFrame(() => {
61
- const c = F.current;
62
- if (!c) return;
63
- (c.querySelector("#postalCode-error") ?? c).scrollIntoView({
57
+ const l = C.current;
58
+ if (!l) return;
59
+ (l.querySelector("#postalCode-error") ?? l).scrollIntoView({
64
60
  behavior: "smooth",
65
61
  block: "nearest"
66
62
  });
67
63
  });
68
64
  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) => {
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) => {
74
70
  if (e.name === "email" && A) return null;
75
71
  let n = null;
76
- e.section && e.section !== S && (S = e.section, n = /* @__PURE__ */ r("h3", { className: "IncodeEkycSectionHeader", children: o({
72
+ e.section && e.section !== I && (I = e.section, n = /* @__PURE__ */ r("h3", { className: "IncodeEkycSectionHeader", children: s({
77
73
  address: "verification.labels.addressDetailsSection",
78
74
  driverLicense: "verification.labels.dlDetailsSection"
79
75
  }[e.section] ?? e.section) }));
80
- const u = e.readonly || R[e.name], c = h[e.name] ?? "", d = t[e.name];
76
+ const u = e.readonly || R[e.name], l = a[e.name] ?? "", d = i[e.name];
81
77
  if (e.name === "street" && e.section === "address")
82
78
  return /* @__PURE__ */ r("div", { children: [
83
79
  n,
84
80
  /* @__PURE__ */ r(
85
- B,
81
+ T,
86
82
  {
87
83
  label: e.label,
88
- value: c,
84
+ value: l,
89
85
  error: d,
90
- errorParams: i[e.name],
86
+ errorParams: y[e.name],
91
87
  suggestions: N,
92
88
  readonly: u,
93
89
  optional: !e.required,
94
- onChange: (a) => s.setField("street", a),
95
- onSearch: (a) => s.searchAddress(a),
96
- onSelect: (a) => s.selectAddress(a)
90
+ onChange: (t) => o.setField("street", t),
91
+ onSearch: (t) => o.searchAddress(t),
92
+ onSelect: (t) => o.selectAddress(t),
93
+ onBlur: () => o.blurField("street")
97
94
  }
98
95
  )
99
96
  ] }, e.name);
100
97
  if (e.type === "dropdown") {
101
- const a = o(e.label);
98
+ const t = s(e.label);
102
99
  return /* @__PURE__ */ r("div", { children: [
103
100
  n,
104
101
  /* @__PURE__ */ r(
105
102
  z,
106
103
  {
107
104
  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)
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)
114
111
  })),
115
- error: v(e.name, d),
112
+ error: h(e.name, d),
116
113
  disabled: u,
117
114
  searchable: !0,
118
- onChange: (l) => s.setField(e.name, l),
115
+ onChange: (c) => o.setField(e.name, c),
116
+ onBlur: () => o.blurField(e.name),
119
117
  "data-testid": `ekyc-field-${e.name}`
120
118
  }
121
119
  )
122
120
  ] }, e.name);
123
121
  }
124
122
  if (e.type === "date") {
125
- const a = o(e.label);
123
+ const t = s(e.label);
126
124
  return /* @__PURE__ */ r("div", { children: [
127
125
  n,
128
126
  /* @__PURE__ */ r(
129
127
  O,
130
128
  {
131
129
  id: `ekyc-${e.name}`,
132
- label: a,
133
- value: c,
134
- error: v(e.name, d),
130
+ label: t,
131
+ value: l,
132
+ error: h(e.name, d),
135
133
  disabled: u,
136
- onInput: (l) => {
137
- const q = l.target;
138
- s.setField(e.name, q.value);
134
+ onInput: (c) => {
135
+ const $ = c.target;
136
+ o.setField(e.name, $.value);
139
137
  },
138
+ onBlur: () => o.blurField(e.name),
140
139
  "data-testid": `ekyc-field-${e.name}`
141
140
  }
142
141
  )
143
142
  ] }, e.name);
144
143
  }
145
144
  if (e.type === "phone") {
146
- const a = o(e.label);
145
+ const t = s(e.label);
147
146
  return /* @__PURE__ */ r("div", { children: [
148
147
  n,
149
148
  /* @__PURE__ */ r(
150
149
  J,
151
150
  {
152
151
  id: `ekyc-${e.name}`,
153
- label: a,
154
- countryCode: L,
155
- value: c,
152
+ label: t,
153
+ countryCode: B,
154
+ value: l,
156
155
  placeholder: e.placeholder,
157
- error: v(e.name, d),
156
+ error: h(e.name, d),
158
157
  disabled: u,
159
158
  disableCountrySelector: e.disableCountrySelector,
160
159
  required: e.required,
161
- onChange: (l) => s.setField(e.name, l),
160
+ onChange: (c) => o.setField(e.name, c),
161
+ onBlur: () => o.blurField(e.name),
162
162
  "data-testid": `ekyc-field-${e.name}`
163
163
  }
164
164
  )
@@ -167,8 +167,8 @@ const Q = ({ config: p, onFinish: s, onError: m }) => {
167
167
  return e.type === "radio" ? /* @__PURE__ */ r("div", { children: [
168
168
  n,
169
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(
170
+ /* @__PURE__ */ r("label", { className: "IncodeEkycRadioLabel", children: s(e.label) }),
171
+ /* @__PURE__ */ r("div", { className: "IncodeEkycRadioOptions", children: e.options?.map((t) => /* @__PURE__ */ r(
172
172
  "label",
173
173
  {
174
174
  className: "IncodeEkycRadioOption",
@@ -178,23 +178,24 @@ const Q = ({ config: p, onFinish: s, onError: m }) => {
178
178
  {
179
179
  type: "radio",
180
180
  name: e.name,
181
- checked: c === a.value,
182
- value: a.value,
183
- onChange: () => s.setField(e.name, a.value),
181
+ checked: l === t.value,
182
+ value: t.value,
183
+ onChange: () => o.setField(e.name, t.value),
184
+ onBlur: () => o.blurField(e.name),
184
185
  disabled: u
185
186
  }
186
187
  ),
187
- /* @__PURE__ */ r("span", { children: o(a.label) })
188
+ /* @__PURE__ */ r("span", { children: s(t.label) })
188
189
  ]
189
190
  },
190
- a.value
191
+ t.value
191
192
  )) }),
192
- d && /* @__PURE__ */ r("span", { className: "IncodeEkycFieldError", children: v(e.name, d) })
193
+ d && /* @__PURE__ */ r("span", { className: "IncodeEkycFieldError", children: h(e.name, d) })
193
194
  ] })
194
195
  ] }, e.name) : /* @__PURE__ */ r(
195
196
  "div",
196
197
  {
197
- ref: e.name === "postalCode" ? F : void 0,
198
+ ref: e.name === "postalCode" ? C : void 0,
198
199
  children: [
199
200
  n,
200
201
  /* @__PURE__ */ r(
@@ -202,9 +203,9 @@ const Q = ({ config: p, onFinish: s, onError: m }) => {
202
203
  {
203
204
  name: e.name,
204
205
  label: e.label,
205
- value: c,
206
+ value: l,
206
207
  error: d,
207
- errorParams: i[e.name],
208
+ errorParams: y[e.name],
208
209
  type: e.type,
209
210
  placeholder: e.placeholder,
210
211
  placeholderParams: e.placeholderParams,
@@ -212,7 +213,8 @@ const Q = ({ config: p, onFinish: s, onError: m }) => {
212
213
  optional: e.optional,
213
214
  readonly: u,
214
215
  maxLength: e.maxLength,
215
- onChange: (a, l) => s.setField(a, l)
216
+ onChange: (t, c) => o.setField(t, c),
217
+ onBlur: (t) => o.blurField(t)
216
218
  }
217
219
  )
218
220
  ]
@@ -222,23 +224,19 @@ const Q = ({ config: p, onFinish: s, onError: m }) => {
222
224
  }) }),
223
225
  /* @__PURE__ */ r("div", { className: "IncodeEkycFooter", children: [
224
226
  /* @__PURE__ */ r(V, { size: 32 }),
225
- C && /* @__PURE__ */ r("p", { className: "IncodeEkycSubmitError", children: o(C) }),
227
+ k && /* @__PURE__ */ r("p", { className: "IncodeEkycSubmitError", children: s(k) }),
226
228
  /* @__PURE__ */ r(
227
229
  w,
228
230
  {
229
- onClick: () => s.submit(),
230
- disabled: !y,
231
+ onClick: () => o.submit(),
232
+ disabled: !P,
231
233
  "data-testid": "ekyc-submit",
232
- children: o("common.continue")
234
+ children: s("common.continue")
233
235
  }
234
236
  )
235
237
  ] })
236
238
  ] });
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 });
239
+ }, W = ({ config: m, onFinish: o }) => /* @__PURE__ */ r(q, { children: m ? /* @__PURE__ */ r(Q, { config: m, onFinish: o }) : null });
242
240
  j(W, "incode-ekyc");
243
241
  export {
244
242
  W as EkycModule
@@ -6,7 +6,7 @@ import { C as ie, F as le, M as de } from "./fileIcon-DOyMcRWU.js";
6
6
  import { S as ue, T as he, a as Ce, b as xe, c as me, d as Ie } from "./spinner-Cx3FPUCD.js";
7
7
  import { P as be } from "./processing-CDgOueI3.js";
8
8
  import { E as ve } from "./errorContent-yUAdbZ5o.js";
9
- import { F as ye, V as we } from "./formField-UWsp-7Fj.js";
9
+ import { F as ye, V as we } from "./formField-FeX9N4c8.js";
10
10
  import { a as Be, C as Le, c as Me, b as Se, e as Fe, d as De, H as He, L as Pe, P as Ve } from "./captureFooter-X2qN1773.js";
11
11
  import { a as Oe, I as Re } from "./inputComposed-BHi-MSpP.js";
12
12
  import { O as je } from "./otpInput-DdkvlvCS.js";
@@ -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-CWu3ZTNN.js").then((e) => e.EkycModule),
2004
- EKYB: () => import("../ekybModule-BKSouMz6.js").then((e) => e.EkybModule),
2003
+ EXTERNAL_VERIFICATION: () => import("../ekycModule-CQsPzNhO.js").then((e) => e.EkycModule),
2004
+ EKYB: () => import("../ekybModule-DUoTzXAx.js").then((e) => e.EkybModule),
2005
2005
  DOCUMENT_CAPTURE: () => import("../documentCapture-PdKA2frR.js").then(
2006
2006
  (e) => e.DocumentCapture
2007
2007
  ),
@@ -5408,7 +5408,7 @@
5408
5408
  display: flex;
5409
5409
  }
5410
5410
 
5411
- .IncodeEkycForm .IncodeInputComposed, .IncodeEkycForm .IncodeDropdownComposed, .IncodeEkycForm .IncodeDateInputComposed, .IncodeEkycForm .IncodeAddressAutocomplete {
5411
+ .IncodeEkycForm .IncodeInputComposed, .IncodeEkycForm .IncodeDropdownComposed, .IncodeEkycForm .IncodeDateInputComposed, .IncodeEkycForm .IncodePhoneInputComposed, .IncodeEkycForm .IncodeAddressAutocomplete {
5412
5412
  margin-inline: auto;
5413
5413
  }
5414
5414
 
@@ -1,12 +1,12 @@
1
- import { b as I, u as e, B as v } from "./button-Ca1tRSTI.js";
1
+ import { b as N, u as e, B as I } from "./button-Ca1tRSTI.js";
2
2
  import "./uiConfig-Z6RT23Sl.js";
3
3
  import "./vendor-preact-BXf0bkEs.js";
4
- import { E as b } from "./errorIcon-BL647nVh.js";
5
- import { S as y } from "./successIcon-BybULRRU.js";
4
+ import { E as y } from "./errorIcon-BL647nVh.js";
5
+ import { S as F } from "./successIcon-BybULRRU.js";
6
6
  import { P as m } from "./page-BVHG3h0V.js";
7
- import { S as F } from "./spinner-Cx3FPUCD.js";
8
- import { I as E } from "./inputComposed-BHi-MSpP.js";
9
- const L = ({
7
+ import { S as E } from "./spinner-Cx3FPUCD.js";
8
+ import { I as S } from "./inputComposed-BHi-MSpP.js";
9
+ const A = ({
10
10
  status: i,
11
11
  submittingTitle: t,
12
12
  successTitle: n,
@@ -16,31 +16,31 @@ const L = ({
16
16
  retryLabel: a,
17
17
  skipLabel: f
18
18
  }) => {
19
- const { t: r } = I();
19
+ const { t: r } = N();
20
20
  if (i === "submitting") {
21
21
  const c = t ?? r("verification.processing");
22
22
  return /* @__PURE__ */ e(m, { className: "IncodeVerificationResult", children: /* @__PURE__ */ e("div", { className: "IncodeVerificationResult__center", children: [
23
- /* @__PURE__ */ e(F, {}),
23
+ /* @__PURE__ */ e(E, {}),
24
24
  /* @__PURE__ */ e("p", { className: "IncodeVerificationResult__title", children: c })
25
25
  ] }) });
26
26
  }
27
27
  if (i === "success") {
28
28
  const c = n ?? r("verification.successTitle");
29
29
  return /* @__PURE__ */ e(m, { className: "IncodeVerificationResult", children: /* @__PURE__ */ e("div", { className: "IncodeVerificationResult__center", children: [
30
- /* @__PURE__ */ e(y, { size: 64 }),
30
+ /* @__PURE__ */ e(F, { size: 64 }),
31
31
  /* @__PURE__ */ e("p", { className: "IncodeVerificationResult__title", children: c })
32
32
  ] }) });
33
33
  }
34
34
  const u = d ?? r("verification.failureTitle");
35
35
  return /* @__PURE__ */ e(m, { className: "IncodeVerificationResult", children: [
36
36
  /* @__PURE__ */ e("div", { className: "IncodeVerificationResult__center", children: [
37
- /* @__PURE__ */ e(b, { size: 64 }),
37
+ /* @__PURE__ */ e(y, { size: 64 }),
38
38
  /* @__PURE__ */ e("p", { className: "IncodeVerificationResult__title", children: u })
39
39
  ] }),
40
40
  /* @__PURE__ */ e("div", { className: "IncodeVerificationResult__actions", children: [
41
- o && /* @__PURE__ */ e(v, { onClick: o, "data-testid": "verification-retry", children: a ?? r("common.tryAgain") }),
41
+ o && /* @__PURE__ */ e(I, { onClick: o, "data-testid": "verification-retry", children: a ?? r("common.tryAgain") }),
42
42
  s && /* @__PURE__ */ e(
43
- v,
43
+ I,
44
44
  {
45
45
  onClick: s,
46
46
  variant: "secondary",
@@ -51,14 +51,14 @@ const L = ({
51
51
  ] })
52
52
  ] });
53
53
  };
54
- function S(i, t) {
54
+ function k(i, t) {
55
55
  return t?.fieldName && typeof t.fieldName == "string" ? { ...t, fieldName: i(String(t.fieldName)) } : t;
56
56
  }
57
- function k(i, t, n) {
57
+ function C(i, t, n) {
58
58
  if (t)
59
- return i(t, S(i, n));
59
+ return i(t, k(i, n));
60
60
  }
61
- const A = ({
61
+ const O = ({
62
62
  name: i,
63
63
  label: t,
64
64
  value: n = "",
@@ -70,34 +70,36 @@ const A = ({
70
70
  required: r,
71
71
  readonly: u,
72
72
  maxLength: c,
73
- disabled: N,
74
- optional: _,
75
- onChange: h
73
+ disabled: _,
74
+ optional: h,
75
+ onChange: V,
76
+ onBlur: p
76
77
  }) => {
77
- const { t: l } = I(), p = l(t), V = _ ? `${p} ${l("verification.labels.optional")}` : p;
78
+ const { t: l } = N(), v = l(t), R = h ? `${v} ${l("verification.labels.optional")}` : v;
78
79
  return /* @__PURE__ */ e("div", { className: "IncodeFormField", children: /* @__PURE__ */ e(
79
- E,
80
+ S,
80
81
  {
81
82
  id: i,
82
- label: V,
83
+ label: R,
83
84
  name: i,
84
85
  type: s,
85
86
  value: n,
86
87
  placeholder: a ? l(a, f) : void 0,
87
88
  readOnly: u,
88
- disabled: N,
89
+ disabled: _,
89
90
  maxLength: c,
90
- error: k(l, d, o),
91
- onInput: (R) => {
92
- const g = R.target;
93
- h(i, g.value);
91
+ error: C(l, d, o),
92
+ onInput: (g) => {
93
+ const b = g.target;
94
+ V(i, b.value);
94
95
  },
96
+ onBlur: p ? () => p(i) : void 0,
95
97
  "data-testid": `form-field-${i}`
96
98
  }
97
99
  ) });
98
100
  };
99
101
  export {
100
- A as F,
101
- L as V,
102
- k as t
102
+ O as F,
103
+ A as V,
104
+ C as t
103
105
  };
@@ -314,6 +314,7 @@ declare type FormFieldProps = {
314
314
  disabled?: boolean;
315
315
  optional?: boolean;
316
316
  onChange: (name: string, value: string) => void;
317
+ onBlur?: (name: string) => void;
317
318
  };
318
319
 
319
320
  export declare function getCountryByCallingCode(callingCode: string): CountryData | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@incodetech/web",
3
- "version": "0.0.0-dev-20260317-6ffceac",
3
+ "version": "0.0.0-dev-20260317-5e90a15",
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-6ffceac"
122
+ "@incodetech/core": "0.0.0-dev-20260317-5e90a15"
123
123
  },
124
124
  "devDependencies": {
125
125
  "@microsoft/api-extractor": "^7.53.3",
@@ -1,300 +0,0 @@
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-3u5x8ZFs.js";
7
- import { P as K } from "./page-BVHG3h0V.js";
8
- import { t as $, F as z, V as v } from "./formField-UWsp-7Fj.js";
9
- import { r as W } from "./incodeModule-aE-LkKwM.js";
10
- import { D as P } from "./dropdownComposed-B5ZuQS8C.js";
11
- import { I as F } from "./inputComposed-BHi-MSpP.js";
12
- function Y(e) {
13
- return [...e.toUpperCase()].map((r) => String.fromCodePoint(127462 + r.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 r = j[e] ?? e;
32
- return { value: e, label: `${Y(e)} ${r}` };
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: r
42
- }) => {
43
- const { t: u } = k(), i = q(() => (X() ? [...f, ...O] : [...f]).map(H).sort((l, a) => l.label.localeCompare(a.label)), []);
44
- return /* @__PURE__ */ o("div", { className: "IncodeEkybCountrySelector", children: /* @__PURE__ */ o(
45
- P,
46
- {
47
- id: "ekyb-country",
48
- label: u("ekyb.country"),
49
- value: e,
50
- options: i,
51
- onChange: r,
52
- "data-testid": "ekyb-country-selector"
53
- }
54
- ) });
55
- }, U = ({
56
- field: e,
57
- value: r,
58
- error: u,
59
- errorParams: i,
60
- country: s,
61
- onChange: l
62
- }) => {
63
- const { t: a } = k(), m = !e.required, p = a(e.label);
64
- if (e.type === "dropdown") {
65
- const d = m ? `${p} (${a("common.optional")})` : p, n = e.name === "state" ? a("ekyb.selectState") : void 0;
66
- return /* @__PURE__ */ o(
67
- P,
68
- {
69
- id: `ekyb-${e.name}`,
70
- label: d,
71
- placeholder: n,
72
- value: r,
73
- options: (e.options ?? []).map((b) => ({
74
- ...b,
75
- label: a(b.label)
76
- })),
77
- error: $(a, u, i),
78
- searchable: !0,
79
- onChange: (b) => l(e.name, b),
80
- "data-testid": `ekyb-field-${e.name}`
81
- }
82
- );
83
- }
84
- return /* @__PURE__ */ o(
85
- z,
86
- {
87
- name: e.name,
88
- label: e.label,
89
- value: r,
90
- error: u,
91
- errorParams: i,
92
- required: e.required,
93
- optional: m,
94
- onChange: l
95
- }
96
- );
97
- }, Q = ({
98
- ubos: e,
99
- errors: r,
100
- errorParams: u,
101
- canAddUbo: i,
102
- onSetField: s,
103
- onAdd: l,
104
- onRemove: a
105
- }) => {
106
- const { t: m } = k(), p = (d) => $(m, r[d], u[d]);
107
- return e.length === 0 ? null : /* @__PURE__ */ o("div", { className: "IncodeEkybUbos", children: [
108
- e.map((d, n) => {
109
- 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;
110
- return /* @__PURE__ */ o("div", { className: "IncodeEkybUboEntry", children: [
111
- /* @__PURE__ */ o(
112
- F,
113
- {
114
- id: `ubo-${n}-name`,
115
- label: b,
116
- name: `ubo-${n}-name`,
117
- value: d.name,
118
- error: p(`ubo-${n}-name`),
119
- onInput: (h) => s(n, "name", h.target.value),
120
- "data-testid": `ekyb-ubo-${n}-name`
121
- }
122
- ),
123
- /* @__PURE__ */ o(
124
- F,
125
- {
126
- id: `ubo-${n}-surname`,
127
- label: C,
128
- name: `ubo-${n}-surname`,
129
- value: d.surname,
130
- error: p(`ubo-${n}-surname`),
131
- onInput: (h) => s(
132
- n,
133
- "surname",
134
- h.target.value
135
- ),
136
- "data-testid": `ekyb-ubo-${n}-surname`
137
- }
138
- ),
139
- !E && /* @__PURE__ */ o(
140
- "button",
141
- {
142
- className: "IncodeEkybRemoveUbo",
143
- onClick: () => a(n),
144
- type: "button",
145
- children: m("common.remove")
146
- }
147
- )
148
- ] }, d.id);
149
- }),
150
- i && /* @__PURE__ */ o(
151
- "button",
152
- {
153
- className: "IncodeEkybAddUbo",
154
- onClick: l,
155
- type: "button",
156
- "data-testid": "ekyb-add-ubo",
157
- children: m("ekyb.addAnotherUbo")
158
- }
159
- )
160
- ] });
161
- }, Z = ({ config: e, onFinish: r, onError: u }) => {
162
- const { t: i } = k(), [s, l] = D(() => _({ config: e }));
163
- g(() => {
164
- (s.status === "finished" || s.status === "closed") && r?.();
165
- }, [s.status, r]);
166
- const a = s.status === "error" ? s.errorMessage : void 0;
167
- return g(() => {
168
- s.status === "error" && u?.(a);
169
- }, [s.status, u, a]), s.status === "finished" || s.status === "closed" ? null : s.status === "loading" ? /* @__PURE__ */ o(
170
- v,
171
- {
172
- status: "submitting",
173
- submittingTitle: i("common.loading")
174
- }
175
- ) : 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;
176
- }, A = /* @__PURE__ */ new Set([
177
- "street",
178
- "houseNo",
179
- "addressLine2",
180
- "city",
181
- "state",
182
- "postalCode"
183
- ]), x = ({ state: e, manager: r }) => {
184
- const {
185
- country: u,
186
- fields: i,
187
- values: s,
188
- displayErrors: l,
189
- errorParams: a,
190
- isValid: m,
191
- ubos: p,
192
- canAddUbo: d,
193
- addressSuggestions: n
194
- } = e, { t: b } = k(), C = S(null), E = S(null), h = S(void 0), R = V(C, i.length);
195
- g(() => {
196
- const t = l.postalCode, c = h.current;
197
- if (h.current = t, !t || c === t)
198
- return;
199
- const y = requestAnimationFrame(() => {
200
- const I = E.current;
201
- if (!I) return;
202
- (I.querySelector("#postalCode-error") ?? I).scrollIntoView({
203
- behavior: "smooth",
204
- block: "nearest"
205
- });
206
- });
207
- return () => cancelAnimationFrame(y);
208
- }, [l.postalCode]);
209
- const M = i.filter((t) => !A.has(t.name)), N = i.filter((t) => A.has(t.name));
210
- return /* @__PURE__ */ o(K, { className: `IncodeEkybPage${R ? " IncodeEkybPageScrollable" : ""}`, title: b("ekyb.title"), children: [
211
- /* @__PURE__ */ o("div", { ref: C, className: "IncodeEkybForm", children: [
212
- /* @__PURE__ */ o(
213
- J,
214
- {
215
- value: u,
216
- onChange: (t) => r.setCountry(t)
217
- }
218
- ),
219
- M.map((t) => /* @__PURE__ */ o(
220
- U,
221
- {
222
- field: t,
223
- value: s[t.name] ?? "",
224
- error: l[t.name],
225
- errorParams: a[t.name],
226
- country: u,
227
- onChange: (c, y) => r.setField(c, y)
228
- },
229
- t.name
230
- )),
231
- /* @__PURE__ */ o(
232
- Q,
233
- {
234
- ubos: p,
235
- errors: l,
236
- errorParams: a,
237
- canAddUbo: d,
238
- onSetField: (t, c, y) => r.setUboField(t, c, y),
239
- onAdd: () => r.addUbo(),
240
- onRemove: (t) => r.removeUbo(t)
241
- }
242
- ),
243
- N.length > 0 && /* @__PURE__ */ o(B, { children: [
244
- /* @__PURE__ */ o("h3", { className: "IncodeEkybSectionHeader", children: b("ekyb.addressDetails") }),
245
- N.map((t) => t.name === "street" ? /* @__PURE__ */ o(
246
- G,
247
- {
248
- label: t.label,
249
- value: s.street ?? "",
250
- error: l.street,
251
- errorParams: a.street,
252
- suggestions: n,
253
- optional: !t.required,
254
- onChange: (c) => r.setField("street", c),
255
- onSearch: (c) => r.searchAddress(c),
256
- onSelect: (c) => r.selectAddress(c)
257
- },
258
- t.name
259
- ) : /* @__PURE__ */ o(
260
- "div",
261
- {
262
- ref: t.name === "postalCode" ? E : void 0,
263
- children: /* @__PURE__ */ o(
264
- U,
265
- {
266
- field: t,
267
- value: s[t.name] ?? "",
268
- error: l[t.name],
269
- errorParams: a[t.name],
270
- country: u,
271
- onChange: (c, y) => r.setField(c, y)
272
- }
273
- )
274
- },
275
- t.name
276
- ))
277
- ] })
278
- ] }),
279
- /* @__PURE__ */ o("div", { className: "IncodeEkybFooter", children: [
280
- /* @__PURE__ */ o(L, { size: 32 }),
281
- /* @__PURE__ */ o(
282
- T,
283
- {
284
- onClick: () => r.submit(),
285
- disabled: !m,
286
- "data-testid": "ekyb-submit",
287
- children: b("ekyb.continue")
288
- }
289
- )
290
- ] })
291
- ] });
292
- }, ee = ({
293
- config: e,
294
- onFinish: r,
295
- onError: u
296
- }) => /* @__PURE__ */ o(w, { children: e ? /* @__PURE__ */ o(Z, { config: e, onFinish: r, onError: u }) : null });
297
- W(ee, "incode-ekyb");
298
- export {
299
- ee as EkybModule
300
- };