@incodetech/core 2.0.0-alpha.8 → 2.0.0-rc.0

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.
Files changed (184) hide show
  1. package/dist/Actor-CI32dTbG.d.ts +2 -0
  2. package/dist/BaseWasmProvider-C_DLEI40.esm.js +1118 -0
  3. package/dist/BrowserStorageProvider-CuOW1Er2.esm.js +55 -0
  4. package/dist/BrowserTimerProvider-DhNc_x02.esm.js +22 -0
  5. package/dist/ITimerCapability-C67ZRskg.esm.js +7 -0
  6. package/dist/IpifyProvider-D7jx52AL.esm.js +139 -0
  7. package/dist/MotionSensorProvider-4v7xkqAp.esm.js +254 -0
  8. package/dist/OpenViduRecordingProvider-CMu6XVdc.esm.js +87 -0
  9. package/dist/StateMachine-BCQrZJhf.d.ts +2 -0
  10. package/dist/WasmUtilProvider-j98OJf-S.esm.js +114 -0
  11. package/dist/addressSearch-BpTbTWCa.esm.js +430 -0
  12. package/dist/ae-signature-DDDZmWXj.esm.js +12 -0
  13. package/dist/ae-signature.d.ts +25 -0
  14. package/dist/ae-signature.esm.js +8 -0
  15. package/dist/antifraud.d.ts +57 -0
  16. package/dist/antifraud.esm.js +45 -0
  17. package/dist/antifraudStateMachine-O0TMf6yc.esm.js +39 -0
  18. package/dist/api-CESGtpbH.esm.js +53 -0
  19. package/dist/authentication.d.ts +12 -0
  20. package/dist/authentication.esm.js +25 -0
  21. package/dist/authenticationManager-5M-fKzXx.esm.js +67 -0
  22. package/dist/authenticationManager-C83GNIhl.d.ts +66 -0
  23. package/dist/authenticationStateMachine-BMZqatiF.esm.js +139 -0
  24. package/dist/backCameraStream-DMdMeGk2.esm.js +346 -0
  25. package/dist/browserSimulation-gxD8cSpM.esm.js +20 -0
  26. package/dist/camera-DBSxa6ML.d.ts +4 -0
  27. package/dist/camera-PA2Ljri3.esm.js +22 -0
  28. package/dist/camera.d.ts +15 -0
  29. package/dist/camera.esm.js +5 -0
  30. package/dist/consent.d.ts +398 -0
  31. package/dist/consent.esm.js +79 -0
  32. package/dist/consentStateMachine-CCT-B60O.esm.js +151 -0
  33. package/dist/cpf-PPz2Njto.esm.js +38 -0
  34. package/dist/cpf-ocr.d.ts +204 -0
  35. package/dist/cpf-ocr.esm.js +177 -0
  36. package/dist/cross-document-data-match.d.ts +34 -0
  37. package/dist/cross-document-data-match.esm.js +71 -0
  38. package/dist/curp-validation.d.ts +188 -0
  39. package/dist/curp-validation.esm.js +110 -0
  40. package/dist/curpValidationStateMachine-CitWLr2c.esm.js +595 -0
  41. package/dist/custom-fields.d.ts +115 -0
  42. package/dist/custom-fields.esm.js +177 -0
  43. package/dist/custom-watchlist.d.ts +66 -0
  44. package/dist/custom-watchlist.esm.js +86 -0
  45. package/dist/dateUtils-UoN5xswP.esm.js +23 -0
  46. package/dist/deepsightLoader-Cm4JIT_z.esm.js +52 -0
  47. package/dist/deepsightService-CEVxzehb.d.ts +412 -0
  48. package/dist/deepsightService-O74l4Y__.esm.js +489 -0
  49. package/dist/device.d.ts +46 -0
  50. package/dist/device.esm.js +106 -0
  51. package/dist/displayErrors-DqJ_IbsG.d.ts +39 -0
  52. package/dist/document-capture.d.ts +906 -0
  53. package/dist/document-capture.esm.js +156 -0
  54. package/dist/document-upload.d.ts +331 -0
  55. package/dist/document-upload.esm.js +203 -0
  56. package/dist/documentCaptureStateMachine-BqzTDy9k.esm.js +394 -0
  57. package/dist/dynamic-forms.d.ts +178 -0
  58. package/dist/dynamic-forms.esm.js +323 -0
  59. package/dist/ekyb.d.ts +148 -0
  60. package/dist/ekyb.esm.js +127 -0
  61. package/dist/ekybStateMachine-B59rQjgj.esm.js +674 -0
  62. package/dist/ekyc.d.ts +164 -0
  63. package/dist/ekyc.esm.js +104 -0
  64. package/dist/ekycStateMachine-oeO0Iekd.esm.js +10626 -0
  65. package/dist/electronic-signature.d.ts +4 -0
  66. package/dist/electronic-signature.esm.js +7 -0
  67. package/dist/electronicSignatureManager-D9OHzTpG.esm.js +428 -0
  68. package/dist/email.d.ts +3 -263
  69. package/dist/email.esm.js +7 -477
  70. package/dist/emailManager-DIfnS5g1.d.ts +352 -0
  71. package/dist/emailManager-wAV0LE-H.esm.js +238 -0
  72. package/dist/emailStateMachine-DOf4j58N.esm.js +292 -0
  73. package/dist/endpoints-CnN3SyDa.esm.js +87 -0
  74. package/dist/events-D6-e4vok.esm.js +596 -0
  75. package/dist/events.d.ts +265 -0
  76. package/dist/events.esm.js +4 -0
  77. package/dist/extensibility.d.ts +122 -0
  78. package/dist/extensibility.esm.js +43 -0
  79. package/dist/face-match.d.ts +228 -0
  80. package/dist/face-match.esm.js +173 -0
  81. package/dist/faceCaptureManagerFactory-Dh2PdGlF.esm.js +290 -0
  82. package/dist/faceCaptureManagerFactory-yqtpxjnN.d.ts +690 -0
  83. package/dist/faceCaptureSetup-B3faSpYA.esm.js +873 -0
  84. package/dist/faceMatchStateMachine-DNFrxTFS.esm.js +127 -0
  85. package/dist/flow-events.d.ts +6 -0
  86. package/dist/flow-events.esm.js +0 -0
  87. package/dist/flow.d.ts +101 -321
  88. package/dist/flow.esm.js +370 -173
  89. package/dist/flowCompletionService-DhkT4SRY.d.ts +10 -0
  90. package/dist/flowCompletionService-P54yzGvA.esm.js +13 -0
  91. package/dist/flowServices-DTsm-Vf1.esm.js +188 -0
  92. package/dist/geolocation.d.ts +127 -0
  93. package/dist/geolocation.esm.js +89 -0
  94. package/dist/geolocationStateMachine-asasuHY2.esm.js +105 -0
  95. package/dist/getBrowser-BSXUTWXw.esm.js +41 -0
  96. package/dist/getDeviceClass-BSntT9_j.esm.js +14 -0
  97. package/dist/government-validation.d.ts +67 -0
  98. package/dist/government-validation.esm.js +81 -0
  99. package/dist/governmentValidationStateMachine-BDDYrJTo.esm.js +271 -0
  100. package/dist/home.d.ts +99 -0
  101. package/dist/home.esm.js +61 -0
  102. package/dist/http.d.ts +68 -0
  103. package/dist/http.esm.js +3 -0
  104. package/dist/id-ocr.d.ts +635 -0
  105. package/dist/id-ocr.esm.js +86 -0
  106. package/dist/id-verification.d.ts +190 -0
  107. package/dist/id-verification.esm.js +43 -0
  108. package/dist/id.d.ts +24 -0
  109. package/dist/id.esm.js +164 -0
  110. package/dist/idCaptureManager-B9TGA5dq.d.ts +956 -0
  111. package/dist/idCaptureManager-DMK0GIt3.esm.js +581 -0
  112. package/dist/idCaptureStateMachine-Bq0fVZXl.esm.js +2954 -0
  113. package/dist/idOcrStateMachine-YbjjC_Gg.esm.js +388 -0
  114. package/dist/idVerificationStateMachine-xbw9HP1Z.esm.js +71 -0
  115. package/dist/identity-reuse.d.ts +530 -0
  116. package/dist/identity-reuse.esm.js +274 -0
  117. package/dist/index-BLKtMA0g.d.ts +1177 -0
  118. package/dist/index-BcRG8rtJ.d.ts +97 -0
  119. package/dist/index.d.ts +3 -226
  120. package/dist/index.esm.js +11 -154
  121. package/dist/invokeOnCaptureCallback-rc6kBHo5.esm.js +30 -0
  122. package/dist/{lib-Bu9XGMBW.esm.js → lib-BB0B_qQX.esm.js} +801 -2
  123. package/dist/mandatory-consent.d.ts +412 -0
  124. package/dist/mandatory-consent.esm.js +78 -0
  125. package/dist/mandatoryConsentStateMachine-Cnco1jvn.esm.js +126 -0
  126. package/dist/openviduLazy-Cm0XFh_v.esm.js +3 -0
  127. package/dist/openviduLazy-Cok70ZSg.esm.js +12 -0
  128. package/dist/permissionServices-D_i6nzEw.esm.js +50 -0
  129. package/dist/phone.d.ts +3 -291
  130. package/dist/phone.esm.js +7 -548
  131. package/dist/phoneManager-B6M30hKE.d.ts +397 -0
  132. package/dist/phoneManager-DAJbGhlY.esm.js +256 -0
  133. package/dist/phoneStateMachine-CuPARRaT.esm.js +351 -0
  134. package/dist/platform-CfrjKhmi.esm.js +83 -0
  135. package/dist/qe-signature-DFo_Cc-I.esm.js +12 -0
  136. package/dist/qe-signature.d.ts +25 -0
  137. package/dist/qe-signature.esm.js +8 -0
  138. package/dist/recordingService-Ig2UgbLv.esm.js +1003 -0
  139. package/dist/redirect-to-mobile.d.ts +107 -0
  140. package/dist/redirect-to-mobile.esm.js +102 -0
  141. package/dist/redirectToMobileStateMachine-BOEqe46A.esm.js +249 -0
  142. package/dist/runChildModule-CqqwqAkW.esm.js +219 -0
  143. package/dist/selfie.d.ts +21 -754
  144. package/dist/selfie.esm.js +113 -962
  145. package/dist/selfieManager-D0lSgd-J.d.ts +68 -0
  146. package/dist/selfieManager-Duisl7qN.esm.js +60 -0
  147. package/dist/selfieStateMachine-D76whWEf.esm.js +68 -0
  148. package/dist/session-BS-d_vuE.esm.js +3206 -0
  149. package/dist/session.d.ts +217 -0
  150. package/dist/session.esm.js +9 -0
  151. package/dist/setup-Buy-hyj4.esm.js +887 -0
  152. package/dist/setup-C5AITV8m.d.ts +254 -0
  153. package/dist/signature.d.ts +94 -0
  154. package/dist/signature.esm.js +66 -0
  155. package/dist/signatureStateMachine-B5-QVUve.esm.js +132 -0
  156. package/dist/stats-CIfiPzb1.esm.js +16 -0
  157. package/dist/stats.d.ts +16 -0
  158. package/dist/stats.esm.js +4 -0
  159. package/dist/trust-graph.d.ts +54 -0
  160. package/dist/trust-graph.esm.js +56 -0
  161. package/dist/types-B06Ypu2F.d.ts +49 -0
  162. package/dist/types-BP1m8VRw.d.ts +340 -0
  163. package/dist/types-CFV9G_7j.d.ts +24 -0
  164. package/dist/{warmup-CEJTfxQr.d.ts → warmup-CEcppFiS.d.ts} +11 -3
  165. package/dist/wasm.d.ts +15 -0
  166. package/dist/wasm.esm.js +12 -0
  167. package/dist/watchlist-for-business.d.ts +79 -0
  168. package/dist/watchlist-for-business.esm.js +148 -0
  169. package/dist/watchlist.d.ts +62 -0
  170. package/dist/watchlist.esm.js +86 -0
  171. package/dist/watchlistServices-DMbUhkBX.esm.js +12 -0
  172. package/dist/workflow.d.ts +907 -0
  173. package/dist/workflow.esm.js +702 -0
  174. package/dist/{xstate.esm-B_rda9yU.esm.js → xstate.esm-B70JrNqo.esm.js} +144 -1
  175. package/package.json +203 -6
  176. package/dist/OpenViduLogger-BdPfiZO6.esm.js +0 -3
  177. package/dist/OpenViduLogger-CQyDxBvM.esm.js +0 -803
  178. package/dist/StateMachine-DRE1oH2B.d.ts +0 -2
  179. package/dist/addEvent-W0ORK0jT.esm.js +0 -16
  180. package/dist/endpoints-BSTFaHYo.esm.js +0 -1706
  181. package/dist/permissionServices-I6vX6DBy.esm.js +0 -72
  182. /package/dist/{Manager-BGfxEmyv.d.ts → Manager-C8PrhBOx.d.ts} +0 -0
  183. /package/dist/{chunk-C_Yo44FK.esm.js → chunk-CRF6K_H_.esm.js} +0 -0
  184. /package/dist/{types-iZi2rawo.d.ts → types-CAD4va6a.d.ts} +0 -0
@@ -0,0 +1,15 @@
1
+ import { n as PermissionStatus, t as PermissionResult } from "./types-CAD4va6a.js";
2
+
3
+ //#region src/internal/permissions/permissionServices.d.ts
4
+ type RequestPermissionOptions = {
5
+ requestMotion?: boolean;
6
+ };
7
+ declare function checkPermission(): Promise<PermissionResult>;
8
+ /**
9
+ * Requests camera permission by attempting to access the camera, then immediately
10
+ * stops the obtained stream. Also requests motion sensor permission (required on iOS
11
+ * to be called during a user gesture). This function does not keep or return the stream.
12
+ */
13
+ declare function requestPermission(options?: RequestPermissionOptions): Promise<PermissionResult>;
14
+ //#endregion
15
+ export { type PermissionResult, type PermissionStatus, checkPermission as checkCameraPermission, requestPermission as requestCameraPermission };
@@ -0,0 +1,5 @@
1
+ import "./camera-PA2Ljri3.esm.js";
2
+ import "./MotionSensorProvider-4v7xkqAp.esm.js";
3
+ import { n as requestPermission, t as checkPermission } from "./permissionServices-D_i6nzEw.esm.js";
4
+
5
+ export { checkPermission as checkCameraPermission, requestPermission as requestCameraPermission };
@@ -0,0 +1,398 @@
1
+ import { t as Manager } from "./Manager-C8PrhBOx.js";
2
+ import "./Actor-CI32dTbG.js";
3
+ import * as xstate182 from "xstate";
4
+
5
+ //#region src/modules/consent/types.d.ts
6
+ type ConsentConfig = {
7
+ combinedConsents?: string;
8
+ consentId?: string;
9
+ };
10
+ type ConsentCheckbox = {
11
+ id: string;
12
+ label: string;
13
+ required: boolean;
14
+ checked: boolean;
15
+ };
16
+ type FetchCombinedConsentResponse = {
17
+ languageConsentId: string;
18
+ terms: string;
19
+ title: string;
20
+ consents: Array<{
21
+ checkboxId: string;
22
+ consentText: string;
23
+ optional: boolean;
24
+ }>;
25
+ };
26
+ //#endregion
27
+ //#region src/modules/consent/consentStateMachine.d.ts
28
+ type ConsentContext = {
29
+ config: ConsentConfig;
30
+ title: string;
31
+ richText: string;
32
+ languageConsentId: string;
33
+ checkboxes: ConsentCheckbox[];
34
+ error: string | undefined;
35
+ };
36
+ type ConsentInput = {
37
+ config: ConsentConfig;
38
+ };
39
+ declare const consentMachine: xstate182.StateMachine<ConsentContext, {
40
+ type: "LOAD";
41
+ } | {
42
+ type: "TOGGLE_CHECKBOX";
43
+ checkboxId: string;
44
+ } | {
45
+ type: "SUBMIT";
46
+ } | {
47
+ type: "RETRY";
48
+ } | {
49
+ type: "RESET";
50
+ }, {
51
+ [x: string]: xstate182.ActorRefFromLogic<xstate182.PromiseActorLogic<FetchCombinedConsentResponse, {
52
+ consentId: string;
53
+ }, xstate182.EventObject>> | xstate182.ActorRefFromLogic<xstate182.PromiseActorLogic<void, {
54
+ languageConsentId: string;
55
+ checkboxes: ConsentCheckbox[];
56
+ }, xstate182.EventObject>> | undefined;
57
+ }, xstate182.Values<{
58
+ fetchConsent: {
59
+ src: "fetchConsent";
60
+ logic: xstate182.PromiseActorLogic<FetchCombinedConsentResponse, {
61
+ consentId: string;
62
+ }, xstate182.EventObject>;
63
+ id: string | undefined;
64
+ };
65
+ submitConsent: {
66
+ src: "submitConsent";
67
+ logic: xstate182.PromiseActorLogic<void, {
68
+ languageConsentId: string;
69
+ checkboxes: ConsentCheckbox[];
70
+ }, xstate182.EventObject>;
71
+ id: string | undefined;
72
+ };
73
+ }>, xstate182.Values<{
74
+ setError: {
75
+ type: "setError";
76
+ params: xstate182.NonReducibleUnknown;
77
+ };
78
+ clearError: {
79
+ type: "clearError";
80
+ params: xstate182.NonReducibleUnknown;
81
+ };
82
+ resetContext: {
83
+ type: "resetContext";
84
+ params: xstate182.NonReducibleUnknown;
85
+ };
86
+ setConsentData: {
87
+ type: "setConsentData";
88
+ params: xstate182.NonReducibleUnknown;
89
+ };
90
+ toggleCheckbox: {
91
+ type: "toggleCheckbox";
92
+ params: xstate182.NonReducibleUnknown;
93
+ };
94
+ }>, {
95
+ type: "canSubmit";
96
+ params: unknown;
97
+ }, never, "error" | "idle" | "finished" | "loading" | "display" | "submitting", string, ConsentInput, xstate182.NonReducibleUnknown, xstate182.EventObject, xstate182.MetaObject, {
98
+ readonly id: "consent";
99
+ readonly initial: "idle";
100
+ readonly context: ({
101
+ input
102
+ }: {
103
+ spawn: {
104
+ <TSrc extends "fetchConsent" | "submitConsent">(logic: TSrc, ...[options]: ({
105
+ src: "fetchConsent";
106
+ logic: xstate182.PromiseActorLogic<FetchCombinedConsentResponse, {
107
+ consentId: string;
108
+ }, xstate182.EventObject>;
109
+ id: string | undefined;
110
+ } extends infer T ? T extends {
111
+ src: "fetchConsent";
112
+ logic: xstate182.PromiseActorLogic<FetchCombinedConsentResponse, {
113
+ consentId: string;
114
+ }, xstate182.EventObject>;
115
+ id: string | undefined;
116
+ } ? T extends {
117
+ src: TSrc;
118
+ } ? xstate182.ConditionalRequired<[options?: ({
119
+ id?: T["id"] | undefined;
120
+ systemId?: string;
121
+ input?: xstate182.InputFrom<T["logic"]> | undefined;
122
+ syncSnapshot?: boolean;
123
+ } & { [K in xstate182.RequiredActorOptions<T>]: unknown }) | undefined], xstate182.IsNotNever<xstate182.RequiredActorOptions<T>>> : never : never : never) | ({
124
+ src: "submitConsent";
125
+ logic: xstate182.PromiseActorLogic<void, {
126
+ languageConsentId: string;
127
+ checkboxes: ConsentCheckbox[];
128
+ }, xstate182.EventObject>;
129
+ id: string | undefined;
130
+ } extends infer T_1 ? T_1 extends {
131
+ src: "submitConsent";
132
+ logic: xstate182.PromiseActorLogic<void, {
133
+ languageConsentId: string;
134
+ checkboxes: ConsentCheckbox[];
135
+ }, xstate182.EventObject>;
136
+ id: string | undefined;
137
+ } ? T_1 extends {
138
+ src: TSrc;
139
+ } ? xstate182.ConditionalRequired<[options?: ({
140
+ id?: T_1["id"] | undefined;
141
+ systemId?: string;
142
+ input?: xstate182.InputFrom<T_1["logic"]> | undefined;
143
+ syncSnapshot?: boolean;
144
+ } & { [K_1 in xstate182.RequiredActorOptions<T_1>]: unknown }) | undefined], xstate182.IsNotNever<xstate182.RequiredActorOptions<T_1>>> : never : never : never)): xstate182.ActorRefFromLogic<xstate182.GetConcreteByKey<xstate182.Values<{
145
+ fetchConsent: {
146
+ src: "fetchConsent";
147
+ logic: xstate182.PromiseActorLogic<FetchCombinedConsentResponse, {
148
+ consentId: string;
149
+ }, xstate182.EventObject>;
150
+ id: string | undefined;
151
+ };
152
+ submitConsent: {
153
+ src: "submitConsent";
154
+ logic: xstate182.PromiseActorLogic<void, {
155
+ languageConsentId: string;
156
+ checkboxes: ConsentCheckbox[];
157
+ }, xstate182.EventObject>;
158
+ id: string | undefined;
159
+ };
160
+ }>, "src", TSrc>["logic"]>;
161
+ <TLogic extends xstate182.AnyActorLogic>(src: TLogic, ...[options]: xstate182.ConditionalRequired<[options?: ({
162
+ id?: never;
163
+ systemId?: string;
164
+ input?: xstate182.InputFrom<TLogic> | undefined;
165
+ syncSnapshot?: boolean;
166
+ } & { [K in xstate182.RequiredLogicInput<TLogic>]: unknown }) | undefined], xstate182.IsNotNever<xstate182.RequiredLogicInput<TLogic>>>): xstate182.ActorRefFromLogic<TLogic>;
167
+ };
168
+ input: ConsentInput;
169
+ self: xstate182.ActorRef<xstate182.MachineSnapshot<ConsentContext, {
170
+ type: "LOAD";
171
+ } | {
172
+ type: "TOGGLE_CHECKBOX";
173
+ checkboxId: string;
174
+ } | {
175
+ type: "SUBMIT";
176
+ } | {
177
+ type: "RETRY";
178
+ } | {
179
+ type: "RESET";
180
+ }, Record<string, xstate182.AnyActorRef | undefined>, xstate182.StateValue, string, unknown, any, any>, {
181
+ type: "LOAD";
182
+ } | {
183
+ type: "TOGGLE_CHECKBOX";
184
+ checkboxId: string;
185
+ } | {
186
+ type: "SUBMIT";
187
+ } | {
188
+ type: "RETRY";
189
+ } | {
190
+ type: "RESET";
191
+ }, xstate182.AnyEventObject>;
192
+ }) => {
193
+ config: ConsentConfig;
194
+ title: string;
195
+ richText: string;
196
+ languageConsentId: string;
197
+ checkboxes: never[];
198
+ error: undefined;
199
+ };
200
+ readonly states: {
201
+ readonly idle: {
202
+ readonly on: {
203
+ readonly LOAD: {
204
+ readonly target: "loading";
205
+ readonly actions: "clearError";
206
+ };
207
+ };
208
+ };
209
+ readonly loading: {
210
+ readonly invoke: {
211
+ readonly id: "fetchConsent";
212
+ readonly src: "fetchConsent";
213
+ readonly input: ({
214
+ context
215
+ }: {
216
+ context: ConsentContext;
217
+ event: {
218
+ type: "LOAD";
219
+ } | {
220
+ type: "TOGGLE_CHECKBOX";
221
+ checkboxId: string;
222
+ } | {
223
+ type: "SUBMIT";
224
+ } | {
225
+ type: "RETRY";
226
+ } | {
227
+ type: "RESET";
228
+ };
229
+ self: xstate182.ActorRef<xstate182.MachineSnapshot<ConsentContext, {
230
+ type: "LOAD";
231
+ } | {
232
+ type: "TOGGLE_CHECKBOX";
233
+ checkboxId: string;
234
+ } | {
235
+ type: "SUBMIT";
236
+ } | {
237
+ type: "RETRY";
238
+ } | {
239
+ type: "RESET";
240
+ }, Record<string, xstate182.AnyActorRef>, xstate182.StateValue, string, unknown, any, any>, {
241
+ type: "LOAD";
242
+ } | {
243
+ type: "TOGGLE_CHECKBOX";
244
+ checkboxId: string;
245
+ } | {
246
+ type: "SUBMIT";
247
+ } | {
248
+ type: "RETRY";
249
+ } | {
250
+ type: "RESET";
251
+ }, xstate182.AnyEventObject>;
252
+ }) => {
253
+ consentId: string;
254
+ };
255
+ readonly onDone: {
256
+ readonly target: "display";
257
+ readonly actions: "setConsentData";
258
+ };
259
+ readonly onError: {
260
+ readonly target: "error";
261
+ readonly actions: "setError";
262
+ };
263
+ };
264
+ };
265
+ readonly display: {
266
+ readonly on: {
267
+ readonly TOGGLE_CHECKBOX: {
268
+ readonly actions: "toggleCheckbox";
269
+ };
270
+ readonly SUBMIT: {
271
+ readonly target: "submitting";
272
+ readonly guard: "canSubmit";
273
+ };
274
+ readonly RETRY: {
275
+ readonly target: "loading";
276
+ readonly actions: "clearError";
277
+ };
278
+ };
279
+ };
280
+ readonly submitting: {
281
+ readonly invoke: {
282
+ readonly id: "submitConsent";
283
+ readonly src: "submitConsent";
284
+ readonly input: ({
285
+ context
286
+ }: {
287
+ context: ConsentContext;
288
+ event: {
289
+ type: "LOAD";
290
+ } | {
291
+ type: "TOGGLE_CHECKBOX";
292
+ checkboxId: string;
293
+ } | {
294
+ type: "SUBMIT";
295
+ } | {
296
+ type: "RETRY";
297
+ } | {
298
+ type: "RESET";
299
+ };
300
+ self: xstate182.ActorRef<xstate182.MachineSnapshot<ConsentContext, {
301
+ type: "LOAD";
302
+ } | {
303
+ type: "TOGGLE_CHECKBOX";
304
+ checkboxId: string;
305
+ } | {
306
+ type: "SUBMIT";
307
+ } | {
308
+ type: "RETRY";
309
+ } | {
310
+ type: "RESET";
311
+ }, Record<string, xstate182.AnyActorRef>, xstate182.StateValue, string, unknown, any, any>, {
312
+ type: "LOAD";
313
+ } | {
314
+ type: "TOGGLE_CHECKBOX";
315
+ checkboxId: string;
316
+ } | {
317
+ type: "SUBMIT";
318
+ } | {
319
+ type: "RETRY";
320
+ } | {
321
+ type: "RESET";
322
+ }, xstate182.AnyEventObject>;
323
+ }) => {
324
+ languageConsentId: string;
325
+ checkboxes: ConsentCheckbox[];
326
+ };
327
+ readonly onDone: {
328
+ readonly target: "finished";
329
+ };
330
+ readonly onError: {
331
+ readonly target: "display";
332
+ readonly actions: "setError";
333
+ };
334
+ };
335
+ };
336
+ readonly error: {
337
+ readonly on: {
338
+ readonly RETRY: {
339
+ readonly target: "loading";
340
+ readonly actions: "clearError";
341
+ };
342
+ readonly RESET: {
343
+ readonly target: "idle";
344
+ readonly actions: "resetContext";
345
+ };
346
+ };
347
+ };
348
+ readonly finished: {
349
+ readonly type: "final";
350
+ };
351
+ };
352
+ }>;
353
+ //#endregion
354
+ //#region src/modules/consent/consentActor.d.ts
355
+ type CreateConsentActorOptions = {
356
+ config: ConsentConfig;
357
+ };
358
+ //#endregion
359
+ //#region src/modules/consent/consentManager.d.ts
360
+ type ConsentIdleState = {
361
+ status: 'idle';
362
+ };
363
+ type ConsentLoadingState = {
364
+ status: 'loading';
365
+ };
366
+ type ConsentDisplayState = {
367
+ status: 'display';
368
+ title: string;
369
+ richText: string;
370
+ checkboxes: ConsentCheckbox[];
371
+ canSubmit: boolean;
372
+ error?: string;
373
+ };
374
+ type ConsentSubmittingState = {
375
+ status: 'submitting';
376
+ title: string;
377
+ richText: string;
378
+ checkboxes: ConsentCheckbox[];
379
+ canSubmit: false;
380
+ };
381
+ type ConsentFinishedState = {
382
+ status: 'finished';
383
+ };
384
+ type ConsentErrorState = {
385
+ status: 'error';
386
+ error: string;
387
+ };
388
+ type ConsentState = ConsentIdleState | ConsentLoadingState | ConsentDisplayState | ConsentSubmittingState | ConsentFinishedState | ConsentErrorState;
389
+ declare function createConsentManager(options: CreateConsentActorOptions): Manager<ConsentState> & {
390
+ load(): void;
391
+ toggleCheckbox(checkboxId: string): void;
392
+ submit(): void;
393
+ retry(): void;
394
+ reset(): void;
395
+ };
396
+ type ConsentManager = ReturnType<typeof createConsentManager>;
397
+ //#endregion
398
+ export { type ConsentCheckbox, type ConsentConfig, type ConsentManager, type ConsentState, consentMachine, createConsentManager };
@@ -0,0 +1,79 @@
1
+ import "./api-CESGtpbH.esm.js";
2
+ import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-D6-e4vok.esm.js";
3
+ import "./endpoints-CnN3SyDa.esm.js";
4
+ import { c as createManager, s as createActor } from "./xstate.esm-B70JrNqo.esm.js";
5
+ import { t as consentMachine } from "./consentStateMachine-CCT-B60O.esm.js";
6
+
7
+ //#region src/modules/consent/consentActor.ts
8
+ function createConsentActor(options) {
9
+ return createActor(consentMachine, { input: { config: options.config } }).start();
10
+ }
11
+
12
+ //#endregion
13
+ //#region src/modules/consent/consentManager.ts
14
+ function getCanSubmit(checkboxes) {
15
+ return checkboxes.filter((checkbox) => checkbox.required).every((checkbox) => checkbox.checked);
16
+ }
17
+ function mapState(snapshot) {
18
+ const typedSnapshot = snapshot;
19
+ const { context } = typedSnapshot;
20
+ const canSubmit = getCanSubmit(context.checkboxes);
21
+ if (typedSnapshot.matches("idle")) return { status: "idle" };
22
+ if (typedSnapshot.matches("loading")) return { status: "loading" };
23
+ if (typedSnapshot.matches("display")) return {
24
+ status: "display",
25
+ title: context.title,
26
+ richText: context.richText,
27
+ checkboxes: context.checkboxes,
28
+ canSubmit,
29
+ error: context.error
30
+ };
31
+ if (typedSnapshot.matches("submitting")) return {
32
+ status: "submitting",
33
+ title: context.title,
34
+ richText: context.richText,
35
+ checkboxes: context.checkboxes,
36
+ canSubmit: false
37
+ };
38
+ if (typedSnapshot.matches("finished")) return { status: "finished" };
39
+ if (typedSnapshot.matches("error")) return {
40
+ status: "error",
41
+ error: context.error ?? "Unknown error"
42
+ };
43
+ return { status: "idle" };
44
+ }
45
+ function createApi({ actor, trackElementClicked }) {
46
+ return {
47
+ load() {
48
+ actor.send({ type: "LOAD" });
49
+ },
50
+ toggleCheckbox(checkboxId) {
51
+ actor.send({
52
+ type: "TOGGLE_CHECKBOX",
53
+ checkboxId
54
+ });
55
+ },
56
+ submit() {
57
+ trackElementClicked?.("submit");
58
+ actor.send({ type: "SUBMIT" });
59
+ },
60
+ retry() {
61
+ trackElementClicked?.("retry");
62
+ actor.send({ type: "RETRY" });
63
+ },
64
+ reset() {
65
+ actor.send({ type: "RESET" });
66
+ }
67
+ };
68
+ }
69
+ function createConsentManager(options) {
70
+ return createManager({
71
+ actor: createConsentActor(options),
72
+ mapState,
73
+ createApi,
74
+ instrumentation: createManagerInstrumentation(eventModuleNames.combinedConsent)
75
+ });
76
+ }
77
+
78
+ //#endregion
79
+ export { consentMachine, createConsentManager };
@@ -0,0 +1,151 @@
1
+ import { t as api } from "./api-CESGtpbH.esm.js";
2
+ import { t as endpoints } from "./endpoints-CnN3SyDa.esm.js";
3
+ import { a as fromPromise, r as assign, t as setup } from "./xstate.esm-B70JrNqo.esm.js";
4
+
5
+ //#region src/modules/consent/consentServices.ts
6
+ async function fetchCombinedConsent(consentId, signal) {
7
+ if (!consentId) throw new Error("Combined consent id is required");
8
+ const res = await api.get(endpoints.getCombinedConsent, {
9
+ signal,
10
+ query: {
11
+ id: consentId,
12
+ language: "en"
13
+ }
14
+ });
15
+ if (!res.ok) throw new Error(`GET ${endpoints.getCombinedConsent} failed: ${res.status} ${res.statusText}`);
16
+ return res.data;
17
+ }
18
+ async function submitCombinedConsent(params, signal) {
19
+ const res = await api.post(endpoints.signCombinedConsent, params, { signal });
20
+ if (!res.ok) throw new Error(`POST ${endpoints.signCombinedConsent} failed: ${res.status} ${res.statusText}`);
21
+ }
22
+
23
+ //#endregion
24
+ //#region src/modules/consent/consentStateMachine.ts
25
+ function toCheckboxRecord(checkboxes) {
26
+ return checkboxes.reduce((acc, checkbox) => {
27
+ acc[checkbox.id] = checkbox.checked;
28
+ return acc;
29
+ }, {});
30
+ }
31
+ const consentMachine = setup({
32
+ types: {
33
+ context: {},
34
+ events: {},
35
+ input: {}
36
+ },
37
+ actors: {
38
+ fetchConsent: fromPromise(async ({ input, signal }) => {
39
+ return fetchCombinedConsent(input.consentId, signal);
40
+ }),
41
+ submitConsent: fromPromise(async ({ input, signal }) => {
42
+ await submitCombinedConsent({
43
+ languageConsentId: input.languageConsentId,
44
+ checkboxes: toCheckboxRecord(input.checkboxes)
45
+ }, signal);
46
+ })
47
+ },
48
+ actions: {
49
+ setConsentData: assign(({ event }) => {
50
+ const output = event.output;
51
+ return {
52
+ title: output.title,
53
+ richText: output.terms,
54
+ languageConsentId: output.languageConsentId,
55
+ checkboxes: output.consents.map((consent) => ({
56
+ id: consent.checkboxId,
57
+ label: consent.consentText,
58
+ required: !consent.optional,
59
+ checked: false
60
+ })),
61
+ error: void 0
62
+ };
63
+ }),
64
+ toggleCheckbox: assign(({ context, event }) => {
65
+ const checkboxId = event.checkboxId;
66
+ return { checkboxes: context.checkboxes.map((checkbox) => checkbox.id === checkboxId ? {
67
+ ...checkbox,
68
+ checked: !checkbox.checked
69
+ } : checkbox) };
70
+ }),
71
+ setError: assign(({ event }) => ({ error: String(event.error) })),
72
+ clearError: assign({ error: () => void 0 }),
73
+ resetContext: assign(({ context }) => ({
74
+ config: context.config,
75
+ title: "",
76
+ richText: "",
77
+ languageConsentId: "",
78
+ checkboxes: [],
79
+ error: void 0
80
+ }))
81
+ },
82
+ guards: { canSubmit: ({ context }) => context.checkboxes.filter((checkbox) => checkbox.required).every((checkbox) => checkbox.checked) }
83
+ }).createMachine({
84
+ id: "consent",
85
+ initial: "idle",
86
+ context: ({ input }) => ({
87
+ config: input.config,
88
+ title: "",
89
+ richText: "",
90
+ languageConsentId: "",
91
+ checkboxes: [],
92
+ error: void 0
93
+ }),
94
+ states: {
95
+ idle: { on: { LOAD: {
96
+ target: "loading",
97
+ actions: "clearError"
98
+ } } },
99
+ loading: { invoke: {
100
+ id: "fetchConsent",
101
+ src: "fetchConsent",
102
+ input: ({ context }) => ({ consentId: String(context.config.combinedConsents ?? context.config.consentId ?? "") }),
103
+ onDone: {
104
+ target: "display",
105
+ actions: "setConsentData"
106
+ },
107
+ onError: {
108
+ target: "error",
109
+ actions: "setError"
110
+ }
111
+ } },
112
+ display: { on: {
113
+ TOGGLE_CHECKBOX: { actions: "toggleCheckbox" },
114
+ SUBMIT: {
115
+ target: "submitting",
116
+ guard: "canSubmit"
117
+ },
118
+ RETRY: {
119
+ target: "loading",
120
+ actions: "clearError"
121
+ }
122
+ } },
123
+ submitting: { invoke: {
124
+ id: "submitConsent",
125
+ src: "submitConsent",
126
+ input: ({ context }) => ({
127
+ languageConsentId: context.languageConsentId,
128
+ checkboxes: context.checkboxes
129
+ }),
130
+ onDone: { target: "finished" },
131
+ onError: {
132
+ target: "display",
133
+ actions: "setError"
134
+ }
135
+ } },
136
+ error: { on: {
137
+ RETRY: {
138
+ target: "loading",
139
+ actions: "clearError"
140
+ },
141
+ RESET: {
142
+ target: "idle",
143
+ actions: "resetContext"
144
+ }
145
+ } },
146
+ finished: { type: "final" }
147
+ }
148
+ });
149
+
150
+ //#endregion
151
+ export { consentMachine as t };
@@ -0,0 +1,38 @@
1
+ //#region src/shared/validators/cpf.ts
2
+ const INVALID_CPF_PATTERNS = [
3
+ "00000000000",
4
+ "11111111111",
5
+ "22222222222",
6
+ "33333333333",
7
+ "44444444444",
8
+ "55555555555",
9
+ "66666666666",
10
+ "77777777777",
11
+ "88888888888",
12
+ "99999999999"
13
+ ];
14
+ /**
15
+ * Validates a Brazilian CPF number (11-digit checksum).
16
+ * Accepts formatted (000.000.000-00) or unformatted input.
17
+ */
18
+ function validateCPF(cpfString) {
19
+ let cpf = cpfString;
20
+ if (cpf.length === 14) cpf = cpf.replace(/\./g, "").replace(/-/g, "");
21
+ if (cpf.length !== 11) return false;
22
+ if (!/^\d+$/.test(cpf)) return false;
23
+ if (INVALID_CPF_PATTERNS.includes(cpf)) return false;
24
+ let sum = 0;
25
+ for (let i = 0; i < 9; i++) sum += Number.parseInt(cpf.charAt(i), 10) * (10 - i);
26
+ let firstDigit = 11 - sum % 11;
27
+ if (firstDigit >= 10) firstDigit = 0;
28
+ if (cpf.charAt(9) !== firstDigit.toString()) return false;
29
+ sum = 0;
30
+ for (let i = 0; i < 10; i++) sum += Number.parseInt(cpf.charAt(i), 10) * (11 - i);
31
+ let secondDigit = 11 - sum % 11;
32
+ if (secondDigit >= 10) secondDigit = 0;
33
+ if (cpf.charAt(10) !== secondDigit.toString()) return false;
34
+ return true;
35
+ }
36
+
37
+ //#endregion
38
+ export { validateCPF as t };