@incodetech/web 0.0.0-dev-20260320-9f7f27a → 0.0.0-dev-20260320-2b71e13
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,13 +1,13 @@
|
|
|
1
|
-
import { b as
|
|
1
|
+
import { b as I, u as o, I as J, a as Q, B as Z } from "./button-Yr39X4SE.js";
|
|
2
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
|
|
3
|
+
import { T as q, y as V, A as D, d as oe, q as C, k as re } from "./vendor-preact--mDTxXnt.js";
|
|
4
4
|
import "./uiConfig-CKJmKRCo.js";
|
|
5
5
|
import "@incodetech/core";
|
|
6
6
|
import { u as ne, A as se } from "./addressAutocomplete-D7g-naeA.js";
|
|
7
7
|
import { P as K } from "./page-DO2rYslN.js";
|
|
8
8
|
import { S as ae } from "./spinner-Djok6FY8.js";
|
|
9
|
-
import { t as G, F as
|
|
10
|
-
import { r as
|
|
9
|
+
import { t as G, F as le, V as P } from "./formField-6BHE59Av.js";
|
|
10
|
+
import { r as ce } from "./incodeModule-Bxzkb7nW.js";
|
|
11
11
|
import { D as Y } from "./dropdownComposed-DLZ4R_VD.js";
|
|
12
12
|
import { a as _ } from "./inputComposed-n2VIh213.js";
|
|
13
13
|
function ue(t) {
|
|
@@ -41,14 +41,14 @@ const be = ({
|
|
|
41
41
|
value: t,
|
|
42
42
|
onChange: r
|
|
43
43
|
}) => {
|
|
44
|
-
const { t:
|
|
44
|
+
const { t: l } = I(), s = q(() => (de() ? [...M, ...x] : [...M]).map(me).sort((c, d) => c.label.localeCompare(d.label)), []);
|
|
45
45
|
return /* @__PURE__ */ o("div", { className: "IncodeEkybCountrySelector", children: /* @__PURE__ */ o(
|
|
46
46
|
Y,
|
|
47
47
|
{
|
|
48
48
|
id: "ekyb-country",
|
|
49
|
-
label:
|
|
49
|
+
label: l("ekyb.country"),
|
|
50
50
|
value: t,
|
|
51
|
-
options:
|
|
51
|
+
options: s,
|
|
52
52
|
onChange: r,
|
|
53
53
|
"data-testid": "ekyb-country-selector"
|
|
54
54
|
}
|
|
@@ -56,105 +56,105 @@ const be = ({
|
|
|
56
56
|
}, B = ({
|
|
57
57
|
field: t,
|
|
58
58
|
value: r,
|
|
59
|
-
error:
|
|
60
|
-
errorParams:
|
|
59
|
+
error: l,
|
|
60
|
+
errorParams: s,
|
|
61
61
|
country: i,
|
|
62
|
-
onChange:
|
|
62
|
+
onChange: c,
|
|
63
63
|
onBlur: d
|
|
64
64
|
}) => {
|
|
65
|
-
const { t: b } =
|
|
65
|
+
const { t: b } = I(), u = !t.required, y = b(t.label);
|
|
66
66
|
if (t.type === "dropdown") {
|
|
67
|
-
const m = u ? `${
|
|
67
|
+
const m = u ? `${y} (${b("common.optional")})` : y;
|
|
68
68
|
return /* @__PURE__ */ o(
|
|
69
69
|
Y,
|
|
70
70
|
{
|
|
71
71
|
id: `ekyb-${t.name}`,
|
|
72
72
|
label: m,
|
|
73
|
-
placeholder:
|
|
73
|
+
placeholder: t.placeholder ? b(t.placeholder) : void 0,
|
|
74
74
|
value: r,
|
|
75
|
-
options: (t.options ?? []).map((
|
|
76
|
-
...
|
|
77
|
-
label: b(
|
|
75
|
+
options: (t.options ?? []).map((n) => ({
|
|
76
|
+
...n,
|
|
77
|
+
label: b(n.label)
|
|
78
78
|
})),
|
|
79
|
-
error: G(b,
|
|
79
|
+
error: G(b, l, s),
|
|
80
80
|
searchable: !0,
|
|
81
|
-
onChange: (
|
|
81
|
+
onChange: (n) => c(t.name, n),
|
|
82
82
|
onBlur: d ? () => d(t.name) : void 0,
|
|
83
83
|
"data-testid": `ekyb-field-${t.name}`
|
|
84
84
|
}
|
|
85
85
|
);
|
|
86
86
|
}
|
|
87
87
|
return /* @__PURE__ */ o(
|
|
88
|
-
|
|
88
|
+
le,
|
|
89
89
|
{
|
|
90
90
|
name: t.name,
|
|
91
91
|
label: t.label,
|
|
92
92
|
value: r,
|
|
93
|
-
error:
|
|
94
|
-
errorParams:
|
|
93
|
+
error: l,
|
|
94
|
+
errorParams: s,
|
|
95
95
|
required: t.required,
|
|
96
96
|
optional: u,
|
|
97
|
-
onChange:
|
|
97
|
+
onChange: c,
|
|
98
98
|
onBlur: d
|
|
99
99
|
}
|
|
100
100
|
);
|
|
101
101
|
}, pe = ({
|
|
102
102
|
ubos: t,
|
|
103
103
|
errors: r,
|
|
104
|
-
errorParams:
|
|
105
|
-
canAddUbo:
|
|
104
|
+
errorParams: l,
|
|
105
|
+
canAddUbo: s,
|
|
106
106
|
onSetField: i,
|
|
107
|
-
onBlur:
|
|
107
|
+
onBlur: c,
|
|
108
108
|
onAdd: d,
|
|
109
109
|
onRemove: b
|
|
110
110
|
}) => {
|
|
111
|
-
const { t: u } =
|
|
111
|
+
const { t: u } = I(), y = (m) => G(u, r[m], l[m]);
|
|
112
112
|
return t.length === 0 ? null : /* @__PURE__ */ o("div", { className: "IncodeEkybUbos", children: [
|
|
113
|
-
t.map((m,
|
|
114
|
-
const
|
|
113
|
+
t.map((m, n) => {
|
|
114
|
+
const v = n === 0 ? u("ekyb.uboName") : u("ekyb.uboNameWithNumber", { number: n + 1 }), f = n === 0 ? u("ekyb.uboSurname") : u("ekyb.uboSurnameWithNumber", { number: n + 1 }), N = n === 0;
|
|
115
115
|
return /* @__PURE__ */ o("div", { className: "IncodeEkybUboEntry", children: [
|
|
116
116
|
/* @__PURE__ */ o(
|
|
117
117
|
_,
|
|
118
118
|
{
|
|
119
|
-
id: `ubo-${
|
|
120
|
-
label:
|
|
121
|
-
name: `ubo-${
|
|
119
|
+
id: `ubo-${n}-name`,
|
|
120
|
+
label: v,
|
|
121
|
+
name: `ubo-${n}-name`,
|
|
122
122
|
value: m.name,
|
|
123
|
-
error:
|
|
124
|
-
onInput: (
|
|
125
|
-
onBlur:
|
|
126
|
-
"data-testid": `ekyb-ubo-${
|
|
123
|
+
error: y(`ubo-${n}-name`),
|
|
124
|
+
onInput: (S) => i(n, "name", S.target.value),
|
|
125
|
+
onBlur: c ? () => c(`ubo-${n}-name`) : void 0,
|
|
126
|
+
"data-testid": `ekyb-ubo-${n}-name`
|
|
127
127
|
}
|
|
128
128
|
),
|
|
129
129
|
/* @__PURE__ */ o(
|
|
130
130
|
_,
|
|
131
131
|
{
|
|
132
|
-
id: `ubo-${
|
|
132
|
+
id: `ubo-${n}-surname`,
|
|
133
133
|
label: f,
|
|
134
|
-
name: `ubo-${
|
|
134
|
+
name: `ubo-${n}-surname`,
|
|
135
135
|
value: m.surname,
|
|
136
|
-
error:
|
|
137
|
-
onInput: (
|
|
138
|
-
|
|
136
|
+
error: y(`ubo-${n}-surname`),
|
|
137
|
+
onInput: (S) => i(
|
|
138
|
+
n,
|
|
139
139
|
"surname",
|
|
140
|
-
|
|
140
|
+
S.target.value
|
|
141
141
|
),
|
|
142
|
-
onBlur:
|
|
143
|
-
"data-testid": `ekyb-ubo-${
|
|
142
|
+
onBlur: c ? () => c(`ubo-${n}-surname`) : void 0,
|
|
143
|
+
"data-testid": `ekyb-ubo-${n}-surname`
|
|
144
144
|
}
|
|
145
145
|
),
|
|
146
146
|
!N && /* @__PURE__ */ o(
|
|
147
147
|
"button",
|
|
148
148
|
{
|
|
149
149
|
className: "IncodeEkybRemoveUbo",
|
|
150
|
-
onClick: () => b(
|
|
150
|
+
onClick: () => b(n),
|
|
151
151
|
type: "button",
|
|
152
152
|
children: u("common.remove")
|
|
153
153
|
}
|
|
154
154
|
)
|
|
155
155
|
] }, m.id);
|
|
156
156
|
}),
|
|
157
|
-
|
|
157
|
+
s && /* @__PURE__ */ o(
|
|
158
158
|
"button",
|
|
159
159
|
{
|
|
160
160
|
className: "IncodeEkybAddUbo",
|
|
@@ -166,23 +166,23 @@ const be = ({
|
|
|
166
166
|
)
|
|
167
167
|
] });
|
|
168
168
|
}, ye = ({ config: t, onFinish: r }) => {
|
|
169
|
-
const { t:
|
|
169
|
+
const { t: l } = I(), [s, i] = Q(() => te({ config: t }));
|
|
170
170
|
return V(() => {
|
|
171
|
-
(
|
|
172
|
-
}, [
|
|
171
|
+
(s.status === "finished" || s.status === "closed") && r?.();
|
|
172
|
+
}, [s.status, r]), s.status === "finished" || s.status === "closed" ? null : s.status === "loading" ? /* @__PURE__ */ o(
|
|
173
173
|
P,
|
|
174
174
|
{
|
|
175
175
|
status: "submitting",
|
|
176
|
-
submittingTitle:
|
|
176
|
+
submittingTitle: l("common.loading")
|
|
177
177
|
}
|
|
178
|
-
) :
|
|
178
|
+
) : s.status === "submitting" ? /* @__PURE__ */ o(K, { children: /* @__PURE__ */ o(
|
|
179
179
|
ae,
|
|
180
180
|
{
|
|
181
181
|
fullScreen: !1,
|
|
182
|
-
title:
|
|
182
|
+
title: l("common.processing"),
|
|
183
183
|
className: "IncodeEkybSpinner"
|
|
184
184
|
}
|
|
185
|
-
) }) :
|
|
185
|
+
) }) : s.status === "success" ? /* @__PURE__ */ o(P, { status: "success" }) : s.status === "error" ? /* @__PURE__ */ o(P, { status: "failure", onRetry: () => i.retry() }) : s.status === "form" ? /* @__PURE__ */ o(Ee, { state: s, manager: i }) : null;
|
|
186
186
|
}, O = /* @__PURE__ */ new Set([
|
|
187
187
|
"street",
|
|
188
188
|
"houseNo",
|
|
@@ -190,63 +190,63 @@ const be = ({
|
|
|
190
190
|
"city",
|
|
191
191
|
"state",
|
|
192
192
|
"postalCode"
|
|
193
|
-
]), he = ["street", "city", "state", "postalCode", "houseNo"],
|
|
193
|
+
]), he = ["street", "city", "state", "postalCode", "houseNo"], Ee = ({ state: t, manager: r }) => {
|
|
194
194
|
const {
|
|
195
|
-
country:
|
|
196
|
-
fields:
|
|
195
|
+
country: l,
|
|
196
|
+
fields: s,
|
|
197
197
|
values: i,
|
|
198
|
-
errors:
|
|
198
|
+
errors: c,
|
|
199
199
|
isValid: d,
|
|
200
200
|
ubos: b,
|
|
201
201
|
canAddUbo: u,
|
|
202
|
-
addressSuggestions:
|
|
202
|
+
addressSuggestions: y,
|
|
203
203
|
submitAttempted: m
|
|
204
|
-
} = t, { t:
|
|
204
|
+
} = t, { t: n } = I(), v = D(null), f = D(null), N = D(void 0), S = ne(v, s.length), [w, T] = oe({}), p = C((e) => {
|
|
205
205
|
T((a) => a[e] ? a : { ...a, [e]: !0 });
|
|
206
206
|
}, []), { displayErrors: E, errorParams: F } = q(
|
|
207
207
|
() => ee(
|
|
208
|
-
|
|
208
|
+
c,
|
|
209
209
|
w,
|
|
210
210
|
m,
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
l,
|
|
212
|
+
s
|
|
213
213
|
),
|
|
214
|
-
[
|
|
215
|
-
), $ =
|
|
216
|
-
(e) =>
|
|
217
|
-
[
|
|
218
|
-
), A =
|
|
214
|
+
[c, w, m, l, s]
|
|
215
|
+
), $ = C(
|
|
216
|
+
(e) => p(e),
|
|
217
|
+
[p]
|
|
218
|
+
), A = C(
|
|
219
219
|
(e, a) => {
|
|
220
|
-
|
|
220
|
+
p(e), r.setField(e, a);
|
|
221
221
|
},
|
|
222
|
-
[r,
|
|
223
|
-
), j =
|
|
224
|
-
(e, a,
|
|
225
|
-
|
|
222
|
+
[r, p]
|
|
223
|
+
), j = C(
|
|
224
|
+
(e, a, h) => {
|
|
225
|
+
p(`ubo-${e}-${a}`), r.setUboField(e, a, h);
|
|
226
226
|
},
|
|
227
|
-
[r,
|
|
228
|
-
), W =
|
|
227
|
+
[r, p]
|
|
228
|
+
), W = C(
|
|
229
229
|
(e) => {
|
|
230
|
-
for (const a of he)
|
|
230
|
+
for (const a of he) p(a);
|
|
231
231
|
r.selectAddress(e);
|
|
232
232
|
},
|
|
233
|
-
[r,
|
|
234
|
-
), z =
|
|
233
|
+
[r, p]
|
|
234
|
+
), z = C(
|
|
235
235
|
(e) => {
|
|
236
236
|
r.removeUbo(e), T((a) => {
|
|
237
|
-
const
|
|
238
|
-
for (const [
|
|
239
|
-
const R =
|
|
237
|
+
const h = {};
|
|
238
|
+
for (const [k, U] of Object.entries(a)) {
|
|
239
|
+
const R = k.match(/^ubo-(\d+)-(name|surname)$/);
|
|
240
240
|
if (!R) {
|
|
241
|
-
k
|
|
241
|
+
h[k] = U;
|
|
242
242
|
continue;
|
|
243
243
|
}
|
|
244
244
|
const g = Number(R[1]);
|
|
245
245
|
if (g === e) continue;
|
|
246
246
|
const X = g > e ? g - 1 : g;
|
|
247
|
-
|
|
247
|
+
h[`ubo-${X}-${R[2]}`] = U;
|
|
248
248
|
}
|
|
249
|
-
return
|
|
249
|
+
return h;
|
|
250
250
|
});
|
|
251
251
|
},
|
|
252
252
|
[r]
|
|
@@ -255,23 +255,23 @@ const be = ({
|
|
|
255
255
|
const e = E.postalCode, a = N.current;
|
|
256
256
|
if (N.current = e, !e || a === e)
|
|
257
257
|
return;
|
|
258
|
-
const
|
|
259
|
-
const
|
|
260
|
-
if (!
|
|
261
|
-
(
|
|
258
|
+
const h = requestAnimationFrame(() => {
|
|
259
|
+
const k = f.current;
|
|
260
|
+
if (!k) return;
|
|
261
|
+
(k.querySelector("#postalCode-error") ?? k).scrollIntoView({
|
|
262
262
|
behavior: "smooth",
|
|
263
263
|
block: "nearest"
|
|
264
264
|
});
|
|
265
265
|
});
|
|
266
|
-
return () => cancelAnimationFrame(
|
|
266
|
+
return () => cancelAnimationFrame(h);
|
|
267
267
|
}, [E.postalCode]);
|
|
268
|
-
const H =
|
|
269
|
-
return /* @__PURE__ */ o(K, { className: `IncodeEkybPage${
|
|
270
|
-
/* @__PURE__ */ o("div", { ref:
|
|
268
|
+
const H = s.filter((e) => !O.has(e.name)), L = s.filter((e) => O.has(e.name));
|
|
269
|
+
return /* @__PURE__ */ o(K, { className: `IncodeEkybPage${S ? " IncodeEkybPageScrollable" : ""}`, title: n("ekyb.title"), children: [
|
|
270
|
+
/* @__PURE__ */ o("div", { ref: v, className: "IncodeEkybForm", children: [
|
|
271
271
|
/* @__PURE__ */ o(
|
|
272
272
|
be,
|
|
273
273
|
{
|
|
274
|
-
value:
|
|
274
|
+
value: l,
|
|
275
275
|
onChange: (e) => r.setCountry(e)
|
|
276
276
|
}
|
|
277
277
|
),
|
|
@@ -282,7 +282,7 @@ const be = ({
|
|
|
282
282
|
value: i[e.name] ?? "",
|
|
283
283
|
error: E[e.name],
|
|
284
284
|
errorParams: F[e.name],
|
|
285
|
-
country:
|
|
285
|
+
country: l,
|
|
286
286
|
onChange: A,
|
|
287
287
|
onBlur: $
|
|
288
288
|
},
|
|
@@ -302,7 +302,7 @@ const be = ({
|
|
|
302
302
|
}
|
|
303
303
|
),
|
|
304
304
|
L.length > 0 && /* @__PURE__ */ o(re, { children: [
|
|
305
|
-
/* @__PURE__ */ o("h3", { className: "IncodeEkybSectionHeader", children:
|
|
305
|
+
/* @__PURE__ */ o("h3", { className: "IncodeEkybSectionHeader", children: n("ekyb.addressDetails") }),
|
|
306
306
|
L.map((e) => e.name === "street" ? /* @__PURE__ */ o(
|
|
307
307
|
se,
|
|
308
308
|
{
|
|
@@ -310,7 +310,7 @@ const be = ({
|
|
|
310
310
|
value: i.street ?? "",
|
|
311
311
|
error: E.street,
|
|
312
312
|
errorParams: F.street,
|
|
313
|
-
suggestions:
|
|
313
|
+
suggestions: y,
|
|
314
314
|
optional: !e.required,
|
|
315
315
|
onChange: (a) => A("street", a),
|
|
316
316
|
onSearch: (a) => r.searchAddress(a),
|
|
@@ -329,7 +329,7 @@ const be = ({
|
|
|
329
329
|
value: i[e.name] ?? "",
|
|
330
330
|
error: E[e.name],
|
|
331
331
|
errorParams: F[e.name],
|
|
332
|
-
country:
|
|
332
|
+
country: l,
|
|
333
333
|
onChange: A,
|
|
334
334
|
onBlur: $
|
|
335
335
|
}
|
|
@@ -345,12 +345,12 @@ const be = ({
|
|
|
345
345
|
onClick: () => r.submit(),
|
|
346
346
|
disabled: !d,
|
|
347
347
|
"data-testid": "ekyb-submit",
|
|
348
|
-
children:
|
|
348
|
+
children: n("ekyb.continue")
|
|
349
349
|
}
|
|
350
350
|
) })
|
|
351
351
|
] });
|
|
352
|
-
},
|
|
353
|
-
|
|
352
|
+
}, ke = ({ config: t, onFinish: r }) => /* @__PURE__ */ o(J, { children: t ? /* @__PURE__ */ o(ye, { config: t, onFinish: r }) : null });
|
|
353
|
+
ce(ke, "incode-ekyb");
|
|
354
354
|
export {
|
|
355
|
-
|
|
355
|
+
ke as EkybModule
|
|
356
356
|
};
|