@incodetech/web 0.0.0-dev-20260313-bc2dab4 → 0.0.0-dev-20260316-0522f9e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5743,6 +5743,10 @@
5743
5743
  margin-bottom: var(--spacing-0, var(--spacing-none, 0px));
5744
5744
  }
5745
5745
 
5746
+ .IncodeEkybForm .IncodeAddressAutocomplete {
5747
+ margin-inline: auto;
5748
+ }
5749
+
5746
5750
  @media (min-width: 768px) {
5747
5751
  .IncodePageContainer.IncodeEkybPage {
5748
5752
  margin-top: var(--spacing-0, var(--spacing-none, 0px));
@@ -0,0 +1,103 @@
1
+ import { b as I, u as e, B as v } from "./button-Ca1tRSTI.js";
2
+ import "./uiConfig-Z6RT23Sl.js";
3
+ import "./vendor-preact-BXf0bkEs.js";
4
+ import { E as b } from "./errorIcon-BL647nVh.js";
5
+ import { S as y } from "./successIcon-BybULRRU.js";
6
+ import { P as m } from "./page-BVHG3h0V.js";
7
+ import { S as F } from "./spinner-Cx3FPUCD.js";
8
+ import { I as E } from "./dropdownComposed-DBm7cotT.js";
9
+ const L = ({
10
+ status: i,
11
+ submittingTitle: t,
12
+ successTitle: n,
13
+ failureTitle: d,
14
+ onRetry: o,
15
+ onSkip: s,
16
+ retryLabel: a,
17
+ skipLabel: f
18
+ }) => {
19
+ const { t: r } = I();
20
+ if (i === "submitting") {
21
+ const c = t ?? r("verification.processing");
22
+ return /* @__PURE__ */ e(m, { className: "IncodeVerificationResult", children: /* @__PURE__ */ e("div", { className: "IncodeVerificationResult__center", children: [
23
+ /* @__PURE__ */ e(F, {}),
24
+ /* @__PURE__ */ e("p", { className: "IncodeVerificationResult__title", children: c })
25
+ ] }) });
26
+ }
27
+ if (i === "success") {
28
+ const c = n ?? r("verification.successTitle");
29
+ return /* @__PURE__ */ e(m, { className: "IncodeVerificationResult", children: /* @__PURE__ */ e("div", { className: "IncodeVerificationResult__center", children: [
30
+ /* @__PURE__ */ e(y, { size: 64 }),
31
+ /* @__PURE__ */ e("p", { className: "IncodeVerificationResult__title", children: c })
32
+ ] }) });
33
+ }
34
+ const u = d ?? r("verification.failureTitle");
35
+ return /* @__PURE__ */ e(m, { className: "IncodeVerificationResult", children: [
36
+ /* @__PURE__ */ e("div", { className: "IncodeVerificationResult__center", children: [
37
+ /* @__PURE__ */ e(b, { size: 64 }),
38
+ /* @__PURE__ */ e("p", { className: "IncodeVerificationResult__title", children: u })
39
+ ] }),
40
+ /* @__PURE__ */ e("div", { className: "IncodeVerificationResult__actions", children: [
41
+ o && /* @__PURE__ */ e(v, { onClick: o, "data-testid": "verification-retry", children: a ?? r("common.tryAgain") }),
42
+ s && /* @__PURE__ */ e(
43
+ v,
44
+ {
45
+ onClick: s,
46
+ variant: "secondary",
47
+ "data-testid": "verification-skip",
48
+ children: f ?? r("common.skip")
49
+ }
50
+ )
51
+ ] })
52
+ ] });
53
+ };
54
+ function S(i, t) {
55
+ return t?.fieldName && typeof t.fieldName == "string" ? { ...t, fieldName: i(String(t.fieldName)) } : t;
56
+ }
57
+ function k(i, t, n) {
58
+ if (t)
59
+ return i(t, S(i, n));
60
+ }
61
+ const A = ({
62
+ name: i,
63
+ label: t,
64
+ value: n = "",
65
+ error: d,
66
+ errorParams: o,
67
+ type: s = "text",
68
+ placeholder: a,
69
+ placeholderParams: f,
70
+ required: r,
71
+ readonly: u,
72
+ maxLength: c,
73
+ disabled: N,
74
+ optional: _,
75
+ onChange: h
76
+ }) => {
77
+ const { t: l } = I(), p = l(t), V = _ ? `${p} ${l("verification.labels.optional")}` : p;
78
+ return /* @__PURE__ */ e("div", { className: "IncodeFormField", children: /* @__PURE__ */ e(
79
+ E,
80
+ {
81
+ id: i,
82
+ label: V,
83
+ name: i,
84
+ type: s,
85
+ value: n,
86
+ placeholder: a ? l(a, f) : void 0,
87
+ readOnly: u,
88
+ disabled: N,
89
+ maxLength: c,
90
+ error: k(l, d, o),
91
+ onInput: (R) => {
92
+ const g = R.target;
93
+ h(i, g.value);
94
+ },
95
+ "data-testid": `form-field-${i}`
96
+ }
97
+ ) });
98
+ };
99
+ export {
100
+ A as F,
101
+ L as V,
102
+ k as t
103
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@incodetech/web",
3
- "version": "0.0.0-dev-20260313-bc2dab4",
3
+ "version": "0.0.0-dev-20260316-0522f9e",
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-20260313-bc2dab4"
122
+ "@incodetech/core": "0.0.0-dev-20260316-0522f9e"
123
123
  },
124
124
  "devDependencies": {
125
125
  "@microsoft/api-extractor": "^7.53.3",
@@ -1,244 +0,0 @@
1
- import { b as k, u as t, I as U, a as F, S as $, B as R } from "./button-Ca1tRSTI.js";
2
- import { SUPPORTED_COUNTRIES as I, DEV_ONLY_COUNTRIES as M, createEkybManager as D } from "@incodetech/core/ekyb";
3
- import { T as w, y as v, A, k as L } from "./vendor-preact-BXf0bkEs.js";
4
- import "./uiConfig-Z6RT23Sl.js";
5
- import "@incodetech/core";
6
- import { u as P } from "./useFormScrollable-3O3GeT4m.js";
7
- import { P as O } from "./page-BVHG3h0V.js";
8
- import { F as T, V as E } from "./formField-C91ckby4.js";
9
- import { r as _ } from "./incodeModule-aE-LkKwM.js";
10
- import { D as g, I as S } from "./dropdownComposed-DBm7cotT.js";
11
- function B(e) {
12
- return [...e.toUpperCase()].map((o) => String.fromCodePoint(127462 + o.charCodeAt(0) - 65)).join("");
13
- }
14
- const V = {
15
- BR: "Brazil",
16
- CM: "Cameroon",
17
- CN: "China",
18
- FR: "France",
19
- DE: "Germany",
20
- IL: "Israel",
21
- IT: "Italy",
22
- KE: "Kenya",
23
- MX: "Mexico",
24
- NG: "Nigeria",
25
- ES: "Spain",
26
- GB: "United Kingdom",
27
- US: "United States"
28
- };
29
- function q(e) {
30
- const o = V[e] ?? e;
31
- return { value: e, label: `${B(e)} ${o}` };
32
- }
33
- function G() {
34
- if (typeof window > "u") return !1;
35
- const { hostname: e } = window.location;
36
- return e === "localhost" || e.includes("stage") || e.includes("demo");
37
- }
38
- const K = ({
39
- value: e,
40
- onChange: o
41
- }) => {
42
- const { t: r } = k(), n = w(() => (G() ? [...I, ...M] : [...I]).map(q).sort((u, l) => u.label.localeCompare(l.label)), []);
43
- return /* @__PURE__ */ t("div", { className: "IncodeEkybCountrySelector", children: /* @__PURE__ */ t(
44
- g,
45
- {
46
- id: "ekyb-country",
47
- label: r("ekyb.country"),
48
- value: e,
49
- options: n,
50
- onChange: o,
51
- "data-testid": "ekyb-country-selector"
52
- }
53
- ) });
54
- }, N = ({
55
- field: e,
56
- value: o,
57
- error: r,
58
- country: n,
59
- onChange: c
60
- }) => {
61
- const { t: u } = k(), l = !e.required, m = u(e.label);
62
- if (e.type === "dropdown") {
63
- const a = l ? `${m} (${u("common.optional")})` : m, b = e.name === "state" ? u("ekyb.selectState") : void 0;
64
- return /* @__PURE__ */ t(
65
- g,
66
- {
67
- id: `ekyb-${e.name}`,
68
- label: a,
69
- placeholder: b,
70
- value: o,
71
- options: (e.options ?? []).map((i) => ({
72
- ...i,
73
- label: u(i.label)
74
- })),
75
- error: r ? u(r) : void 0,
76
- searchable: !0,
77
- onChange: (i) => c(e.name, i),
78
- "data-testid": `ekyb-field-${e.name}`
79
- }
80
- );
81
- }
82
- return /* @__PURE__ */ t(
83
- T,
84
- {
85
- name: e.name,
86
- label: e.label,
87
- value: o,
88
- error: r,
89
- required: e.required,
90
- optional: l,
91
- onChange: c
92
- }
93
- );
94
- }, z = ({
95
- ubos: e,
96
- errors: o,
97
- canAddUbo: r,
98
- onSetField: n,
99
- onAdd: c,
100
- onRemove: u
101
- }) => {
102
- const { t: l } = k();
103
- return e.length === 0 ? null : /* @__PURE__ */ t("div", { className: "IncodeEkybUbos", children: [
104
- e.map((m, a) => {
105
- const b = a === 0 ? l("ekyb.uboName") : l("ekyb.uboNameWithNumber", { number: a + 1 }), i = a === 0 ? l("ekyb.uboSurname") : l("ekyb.uboSurnameWithNumber", { number: a + 1 }), h = a === 0;
106
- return /* @__PURE__ */ t("div", { className: "IncodeEkybUboEntry", children: [
107
- /* @__PURE__ */ t(
108
- S,
109
- {
110
- id: `ubo-${a}-name`,
111
- label: b,
112
- name: `ubo-${a}-name`,
113
- value: m.name,
114
- error: o[`ubo-${a}-name`] ? l(o[`ubo-${a}-name`]) : void 0,
115
- onInput: (d) => n(a, "name", d.target.value),
116
- "data-testid": `ekyb-ubo-${a}-name`
117
- }
118
- ),
119
- /* @__PURE__ */ t(
120
- S,
121
- {
122
- id: `ubo-${a}-surname`,
123
- label: i,
124
- name: `ubo-${a}-surname`,
125
- value: m.surname,
126
- error: o[`ubo-${a}-surname`] ? l(o[`ubo-${a}-surname`]) : void 0,
127
- onInput: (d) => n(
128
- a,
129
- "surname",
130
- d.target.value
131
- ),
132
- "data-testid": `ekyb-ubo-${a}-surname`
133
- }
134
- ),
135
- !h && /* @__PURE__ */ t(
136
- "button",
137
- {
138
- className: "IncodeEkybRemoveUbo",
139
- onClick: () => u(a),
140
- type: "button",
141
- children: l("common.remove")
142
- }
143
- )
144
- ] }, m.id);
145
- }),
146
- r && /* @__PURE__ */ t(
147
- "button",
148
- {
149
- className: "IncodeEkybAddUbo",
150
- onClick: c,
151
- type: "button",
152
- "data-testid": "ekyb-add-ubo",
153
- children: l("ekyb.addAnotherUbo")
154
- }
155
- )
156
- ] });
157
- }, W = ({ config: e, onFinish: o, onError: r }) => {
158
- const [n, c] = F(() => D({ config: e }), {
159
- autoLoad: !1
160
- });
161
- v(() => {
162
- (n.status === "finished" || n.status === "closed") && o?.();
163
- }, [n.status, o]);
164
- const u = n.status === "error" ? n.errorMessage : void 0;
165
- return v(() => {
166
- n.status === "error" && r?.(u);
167
- }, [n.status, r, u]), n.status === "finished" || n.status === "closed" ? null : n.status === "submitting" ? /* @__PURE__ */ t(E, { status: "submitting" }) : n.status === "success" ? /* @__PURE__ */ t(E, { status: "success" }) : n.status === "error" ? /* @__PURE__ */ t(E, { status: "failure", onRetry: () => c.retry() }) : n.status === "form" ? /* @__PURE__ */ t(Y, { state: n, manager: c }) : null;
168
- }, f = /* @__PURE__ */ new Set([
169
- "street",
170
- "houseNo",
171
- "addressLine2",
172
- "city",
173
- "state",
174
- "postalCode"
175
- ]), Y = ({ state: e, manager: o }) => {
176
- const { country: r, fields: n, values: c, displayErrors: u, isValid: l, ubos: m, canAddUbo: a } = e, { t: b } = k(), i = A(null), h = P(i, n.length), d = n.filter((s) => !f.has(s.name)), C = n.filter((s) => f.has(s.name));
177
- return /* @__PURE__ */ t(O, { className: `IncodeEkybPage${h ? " IncodeEkybPageScrollable" : ""}`, title: b("ekyb.title"), children: [
178
- /* @__PURE__ */ t("div", { ref: i, className: "IncodeEkybForm", children: [
179
- /* @__PURE__ */ t(
180
- K,
181
- {
182
- value: r,
183
- onChange: (s) => o.setCountry(s)
184
- }
185
- ),
186
- d.map((s) => /* @__PURE__ */ t(
187
- N,
188
- {
189
- field: s,
190
- value: c[s.name] ?? "",
191
- error: u[s.name],
192
- country: r,
193
- onChange: (y, p) => o.setField(y, p)
194
- },
195
- s.name
196
- )),
197
- C.length > 0 && /* @__PURE__ */ t(L, { children: [
198
- /* @__PURE__ */ t("h3", { className: "IncodeEkybSectionHeader", children: b("ekyb.addressDetails") }),
199
- C.map((s) => /* @__PURE__ */ t(
200
- N,
201
- {
202
- field: s,
203
- value: c[s.name] ?? "",
204
- error: u[s.name],
205
- country: r,
206
- onChange: (y, p) => o.setField(y, p)
207
- },
208
- s.name
209
- ))
210
- ] }),
211
- /* @__PURE__ */ t(
212
- z,
213
- {
214
- ubos: m,
215
- errors: u,
216
- canAddUbo: a,
217
- onSetField: (s, y, p) => o.setUboField(s, y, p),
218
- onAdd: () => o.addUbo(),
219
- onRemove: (s) => o.removeUbo(s)
220
- }
221
- )
222
- ] }),
223
- /* @__PURE__ */ t("div", { className: "IncodeEkybFooter", children: [
224
- /* @__PURE__ */ t($, { size: 32 }),
225
- /* @__PURE__ */ t(
226
- R,
227
- {
228
- onClick: () => o.submit(),
229
- disabled: !l,
230
- "data-testid": "ekyb-submit",
231
- children: b("ekyb.continue")
232
- }
233
- )
234
- ] })
235
- ] });
236
- }, j = ({
237
- config: e,
238
- onFinish: o,
239
- onError: r
240
- }) => /* @__PURE__ */ t(U, { children: e ? /* @__PURE__ */ t(W, { config: e, onFinish: o, onError: r }) : null });
241
- _(j, "incode-ekyb");
242
- export {
243
- j as EkybModule
244
- };