@incodetech/web 0.0.0-dev-20260528-e63e949b → 0.0.0-dev-20260529-ab174ea7

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.
@@ -5,15 +5,18 @@ import { t as a } from "../spinner-CKnjVHxw.js";
5
5
  import { t as o } from "../incodeModule-BH9gV7jI.js";
6
6
  import { createAntifraudManager as s } from "@incodetech/core/antifraud";
7
7
  //#region src/modules/antifraud/antifraud.tsx
8
- var c = ({ onFinish: i }) => {
9
- let [o, c] = n(() => s());
8
+ var c = ({ manager: i, onFinish: o }) => {
9
+ let [c, l] = n(() => i ?? s(), { manageLifecycle: !i });
10
10
  return e(() => {
11
- c.load();
12
- }, [c]), r({
13
- status: o.status === "finished" ? "finished" : "loading",
14
- onFinish: i
11
+ i || l.load();
12
+ }, [l, i]), r({
13
+ status: c.status === "finished" ? "finished" : "loading",
14
+ onFinish: o
15
15
  }), /* @__PURE__ */ t(a, { fullScreen: !0 });
16
- }, l = ({ onFinish: e }) => /* @__PURE__ */ t(i, { children: /* @__PURE__ */ t(c, { onFinish: e }) });
16
+ }, l = ({ manager: e, onFinish: n }) => /* @__PURE__ */ t(i, { children: /* @__PURE__ */ t(c, {
17
+ manager: e,
18
+ onFinish: n
19
+ }) });
17
20
  o(l, "incode-antifraud");
18
21
  //#endregion
19
22
  export { l as Antifraud };
@@ -1,12 +1,4 @@
1
1
  /*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */
2
- .IncodeDynamicFormsProgress {
3
- margin-bottom: var(--spacing-4, var(--spacing-4, 4px));
4
- text-align: center;
5
- font-size: var(--text-sm, .875rem);
6
- line-height: var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)));
7
- color: var(--text-secondary);
8
- }
9
-
10
2
  .IncodeDynamicFormsPage .IncodePageTitleContainer {
11
3
  margin-top: var(--spacing-24, var(--spacing-24, 24px));
12
4
  }
@@ -15,22 +7,42 @@
15
7
  align-items: center;
16
8
  }
17
9
 
18
- .IncodeDynamicFormsForm {
19
- flex-direction: column;
10
+ .IncodeDynamicFormsPage .IncodeDynamicFormsProgress {
11
+ margin-bottom: var(--spacing-4, var(--spacing-4, 4px));
12
+ text-align: center;
13
+ font-size: var(--text-sm, .875rem);
14
+ line-height: var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)));
15
+ color: var(--text-secondary);
16
+ }
17
+
18
+ .IncodeDynamicFormsPage .IncodeDynamicFormsForm {
20
19
  width: 100%;
21
- max-width: 420px;
22
20
  height: 100%;
21
+ max-width: var(--incode-form-max-w);
22
+ flex-direction: column;
23
23
  display: flex;
24
24
  }
25
25
 
26
- .IncodeDynamicFormsForm button {
26
+ .IncodeDynamicFormsPage .IncodeDynamicFormsForm button {
27
27
  margin-top: auto;
28
28
  }
29
29
 
30
- .IncodeDynamicFormsField {
30
+ .IncodeDynamicFormsPage .IncodeDynamicFormsField {
31
31
  margin-bottom: var(--spacing-16, var(--spacing-16, 16px));
32
32
  flex-direction: column;
33
33
  align-items: flex-start;
34
34
  width: 100%;
35
35
  display: flex;
36
36
  }
37
+
38
+ .IncodeDynamicFormsPage .IncodeSrOnly {
39
+ clip-path: inset(50%);
40
+ white-space: nowrap;
41
+ border-width: 0;
42
+ width: 1px;
43
+ height: 1px;
44
+ margin: -1px;
45
+ padding: 0;
46
+ position: absolute;
47
+ overflow: hidden;
48
+ }
@@ -0,0 +1,298 @@
1
+ import { n as e } from "./i18n-Cw8Y_JeB.js";
2
+ import { d as t, m as n, v as r } from "./vendor-preact-D6SntenC.js";
3
+ import { c as i, o as a } from "./hooks-vuWWj6VY.js";
4
+ import { t as o } from "./incodeComponent-BKDH0iXh.js";
5
+ import { r as s } from "./loadingIcon-BN5YRQUb.js";
6
+ import { t as c } from "./page-C1yT4DLb.js";
7
+ import { t as l } from "./button-DcCUEn2n.js";
8
+ import { t as u } from "./verificationResult-CxBb6PGD.js";
9
+ import { t as d } from "./inputComposed-DAEey9xm.js";
10
+ import { n as f, t as p } from "./phoneInputComposed-BAXoouHv.js";
11
+ import { t as m } from "./dropdownComposed-CS2pyn-g.js";
12
+ import { t as h } from "./dateInputComposed-Ddd7HLyM.js";
13
+ import { t as g } from "./incodeModule-BH9gV7jI.js";
14
+ import { n as _, t as v } from "./requiredLabelHint-Dge9zK49.js";
15
+ import { t as y } from "./emailInput-B5ISY_uk.js";
16
+ import { formatCPF as b, isValidCPF as x } from "@incodetech/core/cpf-ocr";
17
+ import { createDynamicFormsManager as S } from "@incodetech/core/dynamic-forms";
18
+ //#region src/modules/dynamic-forms/dynamicForms.tsx
19
+ function C(e) {
20
+ return e.inputType ?? e.overrides ?? "TEXT";
21
+ }
22
+ function w(e) {
23
+ switch (e) {
24
+ case "NAME": return "name";
25
+ case "PHONE": return "tel";
26
+ case "DATE": return "bday";
27
+ default: return;
28
+ }
29
+ }
30
+ var T = ({ question: n, value: i, disabled: a = !1, error: o, labelHint: s, onChange: c, onFormatValidityChange: l, onBlur: u }) => {
31
+ let { t: g } = e(), _ = C(n), v = `dynamic-form-${n.questionId}`, S = n.question, T = !n.isOptional, E = w(_), D = _ === "COUNTRY" || _ === "NATIONALITY", O = t(() => D ? f.map((e) => ({
32
+ value: e.code,
33
+ label: `${e.emoji} ${e.name}`,
34
+ ariaLabel: e.name
35
+ })) : [], [D]);
36
+ if (_ === "YESNO") {
37
+ let e = [{
38
+ value: "YES",
39
+ label: g("common.yes")
40
+ }, {
41
+ value: "NO",
42
+ label: g("common.no")
43
+ }];
44
+ return /* @__PURE__ */ r("div", {
45
+ class: "IncodeDynamicFormsField",
46
+ children: /* @__PURE__ */ r(m, {
47
+ id: v,
48
+ name: n.questionId,
49
+ label: S,
50
+ labelHint: s,
51
+ value: i,
52
+ options: e,
53
+ required: T,
54
+ error: o,
55
+ disabled: a,
56
+ onChange: (e) => c(n.questionId, e),
57
+ onBlur: () => u?.(n.questionId)
58
+ })
59
+ });
60
+ }
61
+ if (_ === "DATE") return /* @__PURE__ */ r("div", {
62
+ class: "IncodeDynamicFormsField",
63
+ children: /* @__PURE__ */ r(h, {
64
+ id: v,
65
+ name: n.questionId,
66
+ label: S,
67
+ labelHint: s,
68
+ value: i,
69
+ required: T,
70
+ autocomplete: E,
71
+ error: o,
72
+ showErrorIcon: !!o,
73
+ disabled: a,
74
+ onInput: (e) => c(n.questionId, e.target.value),
75
+ onBlur: () => u?.(n.questionId)
76
+ })
77
+ });
78
+ if (_ === "PHONE") return /* @__PURE__ */ r("div", {
79
+ class: "IncodeDynamicFormsField",
80
+ onFocusOut: () => u?.(n.questionId),
81
+ children: /* @__PURE__ */ r(p, {
82
+ id: v,
83
+ label: S,
84
+ labelHint: s,
85
+ value: i,
86
+ required: T,
87
+ autocomplete: E,
88
+ error: o,
89
+ showErrorIcon: !!o,
90
+ disabled: a,
91
+ onChange: (e, t) => {
92
+ c(n.questionId, e), l?.(n.questionId, t);
93
+ }
94
+ })
95
+ });
96
+ if (_ === "COUNTRY" || _ === "NATIONALITY") return /* @__PURE__ */ r("div", {
97
+ class: "IncodeDynamicFormsField",
98
+ children: /* @__PURE__ */ r(m, {
99
+ id: v,
100
+ label: S,
101
+ labelHint: s,
102
+ value: i,
103
+ options: O,
104
+ searchable: !0,
105
+ required: T,
106
+ error: o,
107
+ disabled: a,
108
+ onChange: (e) => c(n.questionId, e),
109
+ onBlur: () => u?.(n.questionId)
110
+ })
111
+ });
112
+ if (_ === "SELECT" || _ === "MULTISELECT") {
113
+ let e = (n.options ?? []).map((e) => ({
114
+ value: e,
115
+ label: e
116
+ }));
117
+ return /* @__PURE__ */ r("div", {
118
+ class: "IncodeDynamicFormsField",
119
+ children: /* @__PURE__ */ r(m, {
120
+ id: v,
121
+ label: S,
122
+ labelHint: s,
123
+ value: i,
124
+ options: e,
125
+ searchable: e.length > 5,
126
+ required: T,
127
+ error: o,
128
+ disabled: a,
129
+ onChange: (e) => c(n.questionId, e),
130
+ onBlur: () => u?.(n.questionId)
131
+ })
132
+ });
133
+ }
134
+ return _ === "EMAIL" ? /* @__PURE__ */ r("div", {
135
+ class: "IncodeDynamicFormsField",
136
+ children: /* @__PURE__ */ r(y, {
137
+ value: i,
138
+ emailError: o,
139
+ label: S,
140
+ labelHint: s,
141
+ required: T,
142
+ disabled: a,
143
+ onEmailChange: (e, t) => {
144
+ c(n.questionId, e), l?.(n.questionId, t);
145
+ },
146
+ onBlur: () => u?.(n.questionId)
147
+ })
148
+ }) : _ === "CPF" ? /* @__PURE__ */ r("div", {
149
+ class: "IncodeDynamicFormsField",
150
+ children: /* @__PURE__ */ r(d, {
151
+ id: v,
152
+ name: n.questionId,
153
+ label: S,
154
+ labelHint: s,
155
+ inputMode: "numeric",
156
+ maxLength: 14,
157
+ value: i,
158
+ required: T,
159
+ error: o,
160
+ showErrorIcon: !!o,
161
+ disabled: a,
162
+ onInput: (e) => {
163
+ let t = b(e.target.value);
164
+ e.target.value = t, c(n.questionId, t), l?.(n.questionId, x(t));
165
+ },
166
+ onBlur: () => u?.(n.questionId)
167
+ })
168
+ }) : _ === "NUMBER" ? /* @__PURE__ */ r("div", {
169
+ class: "IncodeDynamicFormsField",
170
+ children: /* @__PURE__ */ r(d, {
171
+ id: v,
172
+ name: n.questionId,
173
+ label: S,
174
+ labelHint: s,
175
+ type: "number",
176
+ inputMode: "numeric",
177
+ value: i,
178
+ required: T,
179
+ error: o,
180
+ showErrorIcon: !!o,
181
+ disabled: a,
182
+ onInput: (e) => {
183
+ let t = e.target.value.replace(/[^0-9]/g, "");
184
+ c(n.questionId, t);
185
+ },
186
+ onBlur: () => u?.(n.questionId)
187
+ })
188
+ }) : /* @__PURE__ */ r("div", {
189
+ class: "IncodeDynamicFormsField",
190
+ children: /* @__PURE__ */ r(d, {
191
+ id: v,
192
+ name: n.questionId,
193
+ label: S,
194
+ labelHint: s,
195
+ type: "text",
196
+ value: i,
197
+ required: T,
198
+ autocomplete: E,
199
+ error: o,
200
+ showErrorIcon: !!o,
201
+ disabled: a,
202
+ onInput: (e) => c(n.questionId, e.target.value),
203
+ onBlur: () => u?.(n.questionId)
204
+ })
205
+ });
206
+ }, E = ({ screen: i, answers: a, validationErrors: o, canSubmit: u, isSubmitting: d = !1, onAnswerChange: f, onAnswerValidityChange: p, onValidateField: m, onSubmit: h }) => {
207
+ let { t: g } = e(), y = i.hideTitle ? void 0 : i.title || g("dynamicForms.title"), b = n(), x = i.title || g("dynamicForms.title"), S = t(() => _(i.questions.map((e) => !e.isOptional)), [i]);
208
+ return /* @__PURE__ */ r(c, {
209
+ className: "IncodeDynamicFormsPage",
210
+ title: y,
211
+ titleId: y ? b : void 0,
212
+ hideFooterBranding: !0,
213
+ children: [
214
+ /* @__PURE__ */ r(s, { size: 32 }),
215
+ d && /* @__PURE__ */ r("div", {
216
+ role: "status",
217
+ "aria-live": "polite",
218
+ class: "IncodeSrOnly",
219
+ children: g("common.processing")
220
+ }),
221
+ /* @__PURE__ */ r("form", {
222
+ class: "IncodeDynamicFormsForm",
223
+ onSubmit: (e) => {
224
+ e.preventDefault(), h();
225
+ },
226
+ "aria-labelledby": y ? b : void 0,
227
+ "aria-label": y ? void 0 : x,
228
+ "aria-busy": d || void 0,
229
+ children: [i.questions.map((e) => {
230
+ let t = o?.[e.questionId], n = v(S, !e.isOptional), i = n ? g(`forms.label.${n}`) ?? void 0 : void 0;
231
+ return /* @__PURE__ */ r(T, {
232
+ question: e,
233
+ value: a[e.questionId] ?? "",
234
+ disabled: d,
235
+ error: t ? g(t) : void 0,
236
+ labelHint: i,
237
+ onChange: f,
238
+ onFormatValidityChange: p,
239
+ onBlur: m
240
+ }, e.questionId);
241
+ }), /* @__PURE__ */ r(l, {
242
+ type: "submit",
243
+ disabled: !u,
244
+ isLoading: d,
245
+ children: g("common.continue")
246
+ })]
247
+ })
248
+ ]
249
+ });
250
+ }, D = ({ config: t, manager: n, onFinish: o }) => {
251
+ let { t: s } = e(), [c, l] = i(() => {
252
+ if (n) return n;
253
+ if (!t) throw Error("DynamicForms config is required");
254
+ return S({ config: t });
255
+ }, {
256
+ manageLifecycle: !n,
257
+ autoLoad: !0
258
+ });
259
+ if (a({
260
+ status: c.status === "closed" ? "finished" : c.status,
261
+ onFinish: o
262
+ }), c.status === "idle" || c.status === "loadingScreens") return /* @__PURE__ */ r(u, {
263
+ status: "submitting",
264
+ submittingTitle: s("common.loading")
265
+ });
266
+ if (c.status === "inputting" || c.status === "submitting") {
267
+ let e = c.status === "submitting", t = c.status === "inputting" ? c.canSubmit : !1;
268
+ return /* @__PURE__ */ r(E, {
269
+ screen: c.currentScreen,
270
+ answers: c.answers,
271
+ validationErrors: c.validationErrors,
272
+ canSubmit: t,
273
+ isSubmitting: e,
274
+ onAnswerChange: (e, t) => l.setAnswer(e, t),
275
+ onAnswerValidityChange: (e, t) => l.setAnswerValidity(e, t),
276
+ onValidateField: (e) => l.validateField(e),
277
+ onSubmit: () => l.submit()
278
+ });
279
+ }
280
+ if (c.status === "success") return /* @__PURE__ */ r(u, {
281
+ status: "success",
282
+ successTitle: s("dynamicForms.success")
283
+ });
284
+ if (c.status === "misconfigured") return /* @__PURE__ */ r(u, {
285
+ status: "failure",
286
+ failureTitle: s("dynamicForms.misconfigured"),
287
+ onSkip: () => l.close(),
288
+ skipLabel: s("common.close")
289
+ });
290
+ if (c.status === "finished" || c.status === "closed") return null;
291
+ }, O = ({ config: e, manager: t, onFinish: n }) => /* @__PURE__ */ r(o, { children: e || t ? /* @__PURE__ */ r(D, {
292
+ config: e,
293
+ manager: t,
294
+ onFinish: n
295
+ }) : null });
296
+ g(O, "incode-dynamic-forms");
297
+ //#endregion
298
+ export { O as DynamicForms };
@@ -5,7 +5,7 @@ import { c as u } from "../hooks-vuWWj6VY.js";
5
5
  import { t as d } from "../incodeComponent-BKDH0iXh.js";
6
6
  import { t as f } from "../transitionSpinner-BWCiDYAb.js";
7
7
  import { t as p } from "../incodeModule-BH9gV7jI.js";
8
- import { _ as m, a as h, c as g, d as _, f as v, h as y, l as b, m as x, n as S, o as C, p as w, r as T, s as E, t as D, u as O, y as k } from "../useModuleLoader-oxU_6Bgn.js";
8
+ import { _ as m, a as h, c as g, d as _, f as v, h as y, l as b, m as x, n as S, o as C, p as w, r as T, s as E, t as D, u as O, y as k } from "../useModuleLoader-ADkwJ0F9.js";
9
9
  import { getDeviceClass as A } from "@incodetech/core/device";
10
10
  import { getRequiredWasmPipelines as j } from "@incodetech/core/flow";
11
11
  import { bootstrapSession as M, refreshQrUrlUuid as N } from "@incodetech/core/session";
@@ -7562,14 +7562,6 @@
7562
7562
  margin-bottom: var(--spacing-16, var(--spacing-16, 16px));
7563
7563
  }
7564
7564
 
7565
- .IncodeDynamicFormsProgress {
7566
- margin-bottom: var(--spacing-4, var(--spacing-4, 4px));
7567
- text-align: center;
7568
- font-size: var(--text-sm, .875rem);
7569
- line-height: var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)));
7570
- color: var(--text-secondary);
7571
- }
7572
-
7573
7565
  .IncodeDynamicFormsPage .IncodePageTitleContainer {
7574
7566
  margin-top: var(--spacing-24, var(--spacing-24, 24px));
7575
7567
  }
@@ -7578,19 +7570,27 @@
7578
7570
  align-items: center;
7579
7571
  }
7580
7572
 
7581
- .IncodeDynamicFormsForm {
7582
- flex-direction: column;
7573
+ .IncodeDynamicFormsPage .IncodeDynamicFormsProgress {
7574
+ margin-bottom: var(--spacing-4, var(--spacing-4, 4px));
7575
+ text-align: center;
7576
+ font-size: var(--text-sm, .875rem);
7577
+ line-height: var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)));
7578
+ color: var(--text-secondary);
7579
+ }
7580
+
7581
+ .IncodeDynamicFormsPage .IncodeDynamicFormsForm {
7583
7582
  width: 100%;
7584
- max-width: 420px;
7585
7583
  height: 100%;
7584
+ max-width: var(--incode-form-max-w);
7585
+ flex-direction: column;
7586
7586
  display: flex;
7587
7587
  }
7588
7588
 
7589
- .IncodeDynamicFormsForm button {
7589
+ .IncodeDynamicFormsPage .IncodeDynamicFormsForm button {
7590
7590
  margin-top: auto;
7591
7591
  }
7592
7592
 
7593
- .IncodeDynamicFormsField {
7593
+ .IncodeDynamicFormsPage .IncodeDynamicFormsField {
7594
7594
  margin-bottom: var(--spacing-16, var(--spacing-16, 16px));
7595
7595
  flex-direction: column;
7596
7596
  align-items: flex-start;
@@ -7598,6 +7598,18 @@
7598
7598
  display: flex;
7599
7599
  }
7600
7600
 
7601
+ .IncodeDynamicFormsPage .IncodeSrOnly {
7602
+ clip-path: inset(50%);
7603
+ white-space: nowrap;
7604
+ border-width: 0;
7605
+ width: 1px;
7606
+ height: 1px;
7607
+ margin: -1px;
7608
+ padding: 0;
7609
+ position: absolute;
7610
+ overflow: hidden;
7611
+ }
7612
+
7601
7613
  .IncodeSignature .IncodeSignatureContent {
7602
7614
  width: 100%;
7603
7615
  height: 100%;
@@ -1,9 +1,10 @@
1
1
  import { AntifraudConfig } from '@incodetech/core/antifraud';
2
+ import { AntifraudManager } from '@incodetech/core/antifraud';
2
3
  import { FC } from 'preact/compat';
3
4
 
4
5
  export declare const Antifraud: FC<AntifraudProps>;
5
6
 
6
- declare type AntifraudProps = IncodeModuleProps<AntifraudConfig>;
7
+ declare type AntifraudProps = IncodeModuleProps<AntifraudConfig, void, AntifraudManager>;
7
8
 
8
9
  declare type IncodeModuleProps<TConfig, TResult = void, TManager = unknown> = {
9
10
  /**
@@ -35,6 +36,8 @@ export { }
35
36
 
36
37
  declare global {
37
38
  interface HTMLElementTagNameMap {
38
- 'incode-antifraud': HTMLElement & IncodeModuleProps<AntifraudConfig>;
39
+ 'incode-antifraud': HTMLElement & IncodeModuleProps<AntifraudConfig,
40
+ void,
41
+ AntifraudManager>;
39
42
  }
40
43
  }
@@ -239,7 +239,7 @@ var N = {
239
239
  AE_SIGNATURE: () => import("./ae-signature/ae-signature.es.js").then((e) => e.AeSignature),
240
240
  QE_SIGNATURE: () => import("./qe-signature/qe-signature.es.js").then((e) => e.QeSignature),
241
241
  CROSS_DOCUMENT_DATA_MATCH: () => import("./cross-document-data-match/cross-document-data-match.es.js").then((e) => e.CrossDocumentDataMatch),
242
- DYNAMIC_FORMS: () => import("./dynamicForms-BoCUrGRC.js").then((e) => e.DynamicForms),
242
+ DYNAMIC_FORMS: () => import("./dynamicForms-4OXspsnx.js").then((e) => e.DynamicForms),
243
243
  FIELD_COMPARISON: () => import("./fieldComparison-CTRInIo3.js").then((e) => e.FieldComparison)
244
244
  };
245
245
  function P() {
@@ -5,7 +5,7 @@ import { c as l } from "../hooks-vuWWj6VY.js";
5
5
  import { t as u } from "../incodeComponent-BKDH0iXh.js";
6
6
  import { t as d } from "../transitionSpinner-BWCiDYAb.js";
7
7
  import { t as f } from "../incodeModule-BH9gV7jI.js";
8
- import { a as p, g as m, i as h, l as g, o as _, s as v, t as y, v as b, y as x } from "../useModuleLoader-oxU_6Bgn.js";
8
+ import { a as p, g as m, i as h, l as g, o as _, s as v, t as y, v as b, y as x } from "../useModuleLoader-ADkwJ0F9.js";
9
9
  import { resolveWasmConfig as S, upgradeToWasmHttpClient as C, warmupWasm as w } from "@incodetech/core/wasm";
10
10
  import { getDeviceClass as T } from "@incodetech/core/device";
11
11
  import { bootstrapSession as E, refreshQrUrlUuid as D } from "@incodetech/core/session";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@incodetech/web",
3
- "version": "0.0.0-dev-20260528-e63e949b",
3
+ "version": "0.0.0-dev-20260529-ab174ea7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/IncodeTechnologies/incode-web-sdk.git"
@@ -255,29 +255,32 @@
255
255
  "qrcode": "^1.5.4",
256
256
  "signature_pad": "^5.1.3",
257
257
  "tailwindcss": "^4.1.17",
258
- "@incodetech/core": "0.0.0-dev-20260528-e63e949b"
258
+ "@incodetech/core": "0.0.0-dev-20260529-ab174ea7"
259
259
  },
260
260
  "devDependencies": {
261
261
  "@microsoft/api-extractor": "^7.53.3",
262
262
  "@preact/preset-vite": "^2.10.5",
263
- "@storybook/addon-a11y": "^8.6.14",
264
- "@storybook/addon-essentials": "^8.6.14",
265
- "@storybook/addon-themes": "^8.6.14",
266
- "@storybook/blocks": "^8.6.14",
267
- "@storybook/preact": "^8.6.14",
268
- "@storybook/preact-vite": "^8.6.14",
263
+ "@storybook/addon-a11y": "^10.4.1",
264
+ "@storybook/addon-themes": "^10.4.1",
265
+ "@storybook/addon-vitest": "^10.4.1",
266
+ "@storybook/preact": "^10.4.1",
267
+ "@storybook/preact-vite": "^10.4.1",
268
+ "@storybook/react-dom-shim": "^10.4.1",
269
269
  "@tailwindcss/postcss": "^4.1.17",
270
270
  "@testing-library/preact": "^3.2.4",
271
271
  "@types/node": "^22.10.5",
272
272
  "@types/qrcode": "^1.5.6",
273
273
  "@vitejs/plugin-basic-ssl": "^2.3.0",
274
+ "@vitest/browser": "4.0.13",
275
+ "@vitest/browser-playwright": "4.0.13",
274
276
  "@vitest/coverage-v8": "^4.0.13",
275
277
  "happy-dom": "^20.7.0",
278
+ "playwright": "^1.60.0",
276
279
  "postcss": "^8.5.6",
277
280
  "postcss-import": "^16.1.1",
278
281
  "preact": "^10.27.2",
279
282
  "rollup-plugin-visualizer": "^7.0.1",
280
- "storybook": "^8.6.14",
283
+ "storybook": "^10.4.1",
281
284
  "stylelint": "^17.5.0",
282
285
  "typescript": "^5.9.3",
283
286
  "vite": "^8.0.0",
@@ -291,6 +294,7 @@
291
294
  "build:dev": "NODE_ENV=development vite build",
292
295
  "build:analyze": "rm -rf dist && ANALYZE=1 vite build && echo '\\nBundle report: packages/ui/dist/stats.html\\n'",
293
296
  "test": "vitest run",
297
+ "test:a11y": "VITE_STORYBOOK_A11Y=true vitest run",
294
298
  "coverage": "vitest run --coverage",
295
299
  "lint": "eslint . && pnpm lint:styles",
296
300
  "lint:fix": "eslint . --fix && pnpm lint:styles",
@@ -1,266 +0,0 @@
1
- import { n as e } from "./i18n-Cw8Y_JeB.js";
2
- import { d as t, v as n } from "./vendor-preact-D6SntenC.js";
3
- import { c as r, o as i } from "./hooks-vuWWj6VY.js";
4
- import { t as a } from "./incodeComponent-BKDH0iXh.js";
5
- import { r as o } from "./loadingIcon-BN5YRQUb.js";
6
- import { t as s } from "./page-C1yT4DLb.js";
7
- import { t as c } from "./button-DcCUEn2n.js";
8
- import { t as l } from "./verificationResult-CxBb6PGD.js";
9
- import { t as u } from "./inputComposed-DAEey9xm.js";
10
- import { n as d, t as f } from "./phoneInputComposed-BAXoouHv.js";
11
- import { t as p } from "./dropdownComposed-CS2pyn-g.js";
12
- import { t as m } from "./dateInputComposed-Ddd7HLyM.js";
13
- import { t as h } from "./incodeModule-BH9gV7jI.js";
14
- import { n as g, t as _ } from "./requiredLabelHint-Dge9zK49.js";
15
- import { t as v } from "./emailInput-B5ISY_uk.js";
16
- import { formatCPF as y, isValidCPF as b } from "@incodetech/core/cpf-ocr";
17
- import { createDynamicFormsManager as x } from "@incodetech/core/dynamic-forms";
18
- //#region src/modules/dynamic-forms/dynamicForms.tsx
19
- function S(e) {
20
- return e.inputType ?? e.overrides ?? "TEXT";
21
- }
22
- var C = ({ question: r, value: i, disabled: a = !1, error: o, labelHint: s, onChange: c, onFormatValidityChange: l, onBlur: h }) => {
23
- let { t: g } = e(), _ = S(r), x = `dynamic-form-${r.questionId}`, C = r.question, w = _ === "COUNTRY" || _ === "NATIONALITY", T = t(() => w ? d.map((e) => ({
24
- value: e.code,
25
- label: `${e.emoji} ${e.name}`,
26
- ariaLabel: e.name
27
- })) : [], [w]);
28
- if (_ === "YESNO") {
29
- let e = [{
30
- value: "YES",
31
- label: g("common.yes")
32
- }, {
33
- value: "NO",
34
- label: g("common.no")
35
- }];
36
- return /* @__PURE__ */ n("div", {
37
- class: "IncodeDynamicFormsField",
38
- children: /* @__PURE__ */ n(p, {
39
- id: x,
40
- name: r.questionId,
41
- label: C,
42
- labelHint: s,
43
- value: i,
44
- options: e,
45
- error: o,
46
- disabled: a,
47
- onChange: (e) => c(r.questionId, e),
48
- onBlur: () => h?.(r.questionId)
49
- })
50
- });
51
- }
52
- if (_ === "DATE") return /* @__PURE__ */ n("div", {
53
- class: "IncodeDynamicFormsField",
54
- children: /* @__PURE__ */ n(m, {
55
- id: x,
56
- name: r.questionId,
57
- label: C,
58
- labelHint: s,
59
- value: i,
60
- error: o,
61
- showErrorIcon: !!o,
62
- disabled: a,
63
- onInput: (e) => c(r.questionId, e.target.value),
64
- onBlur: () => h?.(r.questionId)
65
- })
66
- });
67
- if (_ === "PHONE") return /* @__PURE__ */ n("div", {
68
- class: "IncodeDynamicFormsField",
69
- onFocusOut: () => h?.(r.questionId),
70
- children: /* @__PURE__ */ n(f, {
71
- id: x,
72
- label: C,
73
- labelHint: s,
74
- value: i,
75
- error: o,
76
- showErrorIcon: !!o,
77
- disabled: a,
78
- onChange: (e, t) => {
79
- c(r.questionId, e), l?.(r.questionId, t);
80
- }
81
- })
82
- });
83
- if (_ === "COUNTRY" || _ === "NATIONALITY") return /* @__PURE__ */ n("div", {
84
- class: "IncodeDynamicFormsField",
85
- children: /* @__PURE__ */ n(p, {
86
- id: x,
87
- label: C,
88
- labelHint: s,
89
- value: i,
90
- options: T,
91
- searchable: !0,
92
- error: o,
93
- disabled: a,
94
- onChange: (e) => c(r.questionId, e),
95
- onBlur: () => h?.(r.questionId)
96
- })
97
- });
98
- if (_ === "SELECT" || _ === "MULTISELECT") {
99
- let e = (r.options ?? []).map((e) => ({
100
- value: e,
101
- label: e
102
- }));
103
- return /* @__PURE__ */ n("div", {
104
- class: "IncodeDynamicFormsField",
105
- children: /* @__PURE__ */ n(p, {
106
- id: x,
107
- label: C,
108
- labelHint: s,
109
- value: i,
110
- options: e,
111
- searchable: e.length > 5,
112
- error: o,
113
- disabled: a,
114
- onChange: (e) => c(r.questionId, e),
115
- onBlur: () => h?.(r.questionId)
116
- })
117
- });
118
- }
119
- return _ === "EMAIL" ? /* @__PURE__ */ n("div", {
120
- class: "IncodeDynamicFormsField",
121
- children: /* @__PURE__ */ n(v, {
122
- value: i,
123
- emailError: o,
124
- label: C,
125
- labelHint: s,
126
- disabled: a,
127
- onEmailChange: (e, t) => {
128
- c(r.questionId, e), l?.(r.questionId, t);
129
- },
130
- onBlur: () => h?.(r.questionId)
131
- })
132
- }) : _ === "CPF" ? /* @__PURE__ */ n("div", {
133
- class: "IncodeDynamicFormsField",
134
- children: /* @__PURE__ */ n(u, {
135
- id: x,
136
- name: r.questionId,
137
- label: C,
138
- labelHint: s,
139
- inputMode: "numeric",
140
- maxLength: 14,
141
- value: i,
142
- error: o,
143
- showErrorIcon: !!o,
144
- disabled: a,
145
- onInput: (e) => {
146
- let t = y(e.target.value);
147
- e.target.value = t, c(r.questionId, t), l?.(r.questionId, b(t));
148
- },
149
- onBlur: () => h?.(r.questionId)
150
- })
151
- }) : _ === "NUMBER" ? /* @__PURE__ */ n("div", {
152
- class: "IncodeDynamicFormsField",
153
- children: /* @__PURE__ */ n(u, {
154
- id: x,
155
- name: r.questionId,
156
- label: C,
157
- labelHint: s,
158
- type: "number",
159
- inputMode: "numeric",
160
- value: i,
161
- error: o,
162
- showErrorIcon: !!o,
163
- disabled: a,
164
- onInput: (e) => {
165
- let t = e.target.value.replace(/[^0-9]/g, "");
166
- c(r.questionId, t);
167
- },
168
- onBlur: () => h?.(r.questionId)
169
- })
170
- }) : /* @__PURE__ */ n("div", {
171
- class: "IncodeDynamicFormsField",
172
- children: /* @__PURE__ */ n(u, {
173
- id: x,
174
- name: r.questionId,
175
- label: C,
176
- labelHint: s,
177
- type: "text",
178
- value: i,
179
- error: o,
180
- showErrorIcon: !!o,
181
- disabled: a,
182
- onInput: (e) => c(r.questionId, e.target.value),
183
- onBlur: () => h?.(r.questionId)
184
- })
185
- });
186
- }, w = ({ screen: r, answers: i, validationErrors: a, canSubmit: l, isSubmitting: u = !1, onAnswerChange: d, onAnswerValidityChange: f, onValidateField: p, onSubmit: m }) => {
187
- let { t: h } = e(), v = r.hideTitle ? void 0 : r.title || h("dynamicForms.title"), y = t(() => g(r.questions.map((e) => !e.isOptional)), [r]);
188
- return /* @__PURE__ */ n(s, {
189
- className: "IncodeDynamicFormsPage",
190
- title: v,
191
- hideFooterBranding: !0,
192
- children: [/* @__PURE__ */ n(o, { size: 32 }), /* @__PURE__ */ n("form", {
193
- class: "IncodeDynamicFormsForm",
194
- onSubmit: (e) => {
195
- e.preventDefault(), m();
196
- },
197
- autoComplete: "off",
198
- children: [r.questions.map((e) => {
199
- let t = a?.[e.questionId], r = _(y, !e.isOptional), o = r ? h(`forms.label.${r}`) ?? void 0 : void 0;
200
- return /* @__PURE__ */ n(C, {
201
- question: e,
202
- value: i[e.questionId] ?? "",
203
- disabled: u,
204
- error: t ? h(t) : void 0,
205
- labelHint: o,
206
- onChange: d,
207
- onFormatValidityChange: f,
208
- onBlur: p
209
- }, e.questionId);
210
- }), /* @__PURE__ */ n(c, {
211
- type: "submit",
212
- disabled: !l,
213
- isLoading: u,
214
- children: h("common.continue")
215
- })]
216
- })]
217
- });
218
- }, T = ({ config: t, manager: a, onFinish: o }) => {
219
- let { t: s } = e(), [c, u] = r(() => {
220
- if (a) return a;
221
- if (!t) throw Error("DynamicForms config is required");
222
- return x({ config: t });
223
- }, {
224
- manageLifecycle: !a,
225
- autoLoad: !0
226
- });
227
- if (i({
228
- status: c.status === "closed" ? "finished" : c.status,
229
- onFinish: o
230
- }), c.status === "idle" || c.status === "loadingScreens") return /* @__PURE__ */ n(l, {
231
- status: "submitting",
232
- submittingTitle: s("common.loading")
233
- });
234
- if (c.status === "inputting" || c.status === "submitting") {
235
- let e = c.status === "submitting", t = c.status === "inputting" ? c.canSubmit : !1;
236
- return /* @__PURE__ */ n(w, {
237
- screen: c.currentScreen,
238
- answers: c.answers,
239
- validationErrors: c.validationErrors,
240
- canSubmit: t,
241
- isSubmitting: e,
242
- onAnswerChange: (e, t) => u.setAnswer(e, t),
243
- onAnswerValidityChange: (e, t) => u.setAnswerValidity(e, t),
244
- onValidateField: (e) => u.validateField(e),
245
- onSubmit: () => u.submit()
246
- });
247
- }
248
- if (c.status === "success") return /* @__PURE__ */ n(l, {
249
- status: "success",
250
- successTitle: s("dynamicForms.success")
251
- });
252
- if (c.status === "misconfigured") return /* @__PURE__ */ n(l, {
253
- status: "failure",
254
- failureTitle: s("dynamicForms.misconfigured"),
255
- onSkip: () => u.close(),
256
- skipLabel: s("common.close")
257
- });
258
- if (c.status === "finished" || c.status === "closed") return null;
259
- }, E = ({ config: e, manager: t, onFinish: r }) => /* @__PURE__ */ n(a, { children: e || t ? /* @__PURE__ */ n(T, {
260
- config: e,
261
- manager: t,
262
- onFinish: r
263
- }) : null });
264
- h(E, "incode-dynamic-forms");
265
- //#endregion
266
- export { E as DynamicForms };