@incodetech/core 0.0.0-dev-20260323-d5fdccb → 0.0.0-dev-20260324-90ddcfd

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 (82) hide show
  1. package/dist/{addressSearch-BBIa1heY.esm.js → addressSearch-DCaEdoev.esm.js} +4 -4
  2. package/dist/authentication.d.ts +10 -10
  3. package/dist/authentication.esm.js +11 -10
  4. package/dist/{authenticationManager-DZFI79F5.d.ts → authenticationManager-C-Mmg1uU.d.ts} +2 -2
  5. package/dist/{authenticationManager-h6dB_vib.esm.js → authenticationManager-CEGYyu8r.esm.js} +6 -6
  6. package/dist/{backCameraStream-BPxNH3Pg.esm.js → backCameraStream-BPzo60FO.esm.js} +1 -1
  7. package/dist/browserSimulation-DYAk0Ipe.esm.js +20 -0
  8. package/dist/consent.d.ts +56 -56
  9. package/dist/consent.esm.js +4 -4
  10. package/dist/curp-validation.d.ts +4 -4
  11. package/dist/curp-validation.esm.js +4 -4
  12. package/dist/{deepsightLoader-CZ_4kZPK.esm.js → deepsightLoader-ErxPZUBZ.esm.js} +5 -4
  13. package/dist/{deepsightService-DFek2Sxh.esm.js → deepsightService-BcdwWkYD.esm.js} +5 -23
  14. package/dist/{deepsightService-foKxxo3y.d.ts → deepsightService-C47Uyf6m.d.ts} +1 -1
  15. package/dist/document-capture.d.ts +60 -60
  16. package/dist/document-capture.esm.js +5 -5
  17. package/dist/document-upload.d.ts +52 -52
  18. package/dist/document-upload.esm.js +5 -5
  19. package/dist/ekyb.d.ts +2 -2
  20. package/dist/ekyb.esm.js +8 -6
  21. package/dist/ekyc.d.ts +2 -2
  22. package/dist/ekyc.esm.js +5 -5
  23. package/dist/email.d.ts +3 -3
  24. package/dist/email.esm.js +5 -5
  25. package/dist/{emailManager-OpJLWD9-.esm.js → emailManager-1W2Uh6du.esm.js} +4 -4
  26. package/dist/{emailManager-lUXVfa0R.d.ts → emailManager-CN9sSCz6.d.ts} +2 -2
  27. package/dist/{endpoints-Bydn-Ave.esm.js → endpoints-b2PxFIku.esm.js} +2 -0
  28. package/dist/{events-DzHYCTUI.esm.js → events-CbNkXF2Q.esm.js} +2 -2
  29. package/dist/extensibility.d.ts +14 -14
  30. package/dist/extensibility.esm.js +16 -14
  31. package/dist/face-match.d.ts +1 -1
  32. package/dist/face-match.esm.js +4 -4
  33. package/dist/{faceCaptureManagerFactory-Bavynz5Q.d.ts → faceCaptureManagerFactory-UFhWTbej.d.ts} +7 -7
  34. package/dist/{faceCaptureSetup-BOmXn1op.esm.js → faceCaptureSetup-CoeOjXeo.esm.js} +8 -8
  35. package/dist/flow.d.ts +7 -7
  36. package/dist/flow.esm.js +8 -6
  37. package/dist/{flowCompletionService-C-pC9OZ9.esm.js → flowCompletionService-DkbMP576.esm.js} +2 -2
  38. package/dist/{flowServices-Cc1HxYIC.esm.js → flowServices-jrv5Zxbr.esm.js} +48 -4
  39. package/dist/geolocation.d.ts +1 -1
  40. package/dist/geolocation.esm.js +4 -4
  41. package/dist/government-validation.d.ts +1 -1
  42. package/dist/government-validation.esm.js +4 -4
  43. package/dist/id.d.ts +9 -9
  44. package/dist/id.esm.js +12 -10
  45. package/dist/{idCaptureManager-DPzinE1o.esm.js → idCaptureManager-BniIgM20.esm.js} +43 -226
  46. package/dist/{idCaptureManager-Ih_zvBCr.d.ts → idCaptureManager-Dn7_eHt9.d.ts} +22 -8
  47. package/dist/index.d.ts +19 -10
  48. package/dist/index.esm.js +12 -10
  49. package/dist/{lib-3ivDs79I.esm.js → lib-VFNBaz_7.esm.js} +1 -1
  50. package/dist/mandatory-consent.d.ts +411 -0
  51. package/dist/mandatory-consent.esm.js +198 -0
  52. package/dist/phone.d.ts +3 -3
  53. package/dist/phone.esm.js +5 -5
  54. package/dist/{phoneManager-pTIOvlCD.d.ts → phoneManager-B0MT8wYz.d.ts} +2 -2
  55. package/dist/{phoneManager-BwBW-tRA.esm.js → phoneManager-Cvp5LFN7.esm.js} +4 -4
  56. package/dist/{recordingsRepository-DVPWOR9j.esm.js → recordingsRepository-DGWSMj-_.esm.js} +3 -3
  57. package/dist/redirect-to-mobile.d.ts +1 -1
  58. package/dist/redirect-to-mobile.esm.js +4 -4
  59. package/dist/selfie.d.ts +10 -10
  60. package/dist/selfie.esm.js +11 -10
  61. package/dist/{selfieManager-DT0oJmpD.esm.js → selfieManager-BxwT4tDD.esm.js} +3 -3
  62. package/dist/{selfieManager-uSCpF37G.d.ts → selfieManager-DSn8EPLE.d.ts} +2 -2
  63. package/dist/session-4QVMNIs5.esm.js +243 -0
  64. package/dist/session.d.ts +1 -1
  65. package/dist/session.esm.js +3 -3
  66. package/dist/{src-Cmpz4Jmw.esm.js → src-BX-m0lbm.esm.js} +2 -2
  67. package/dist/{stats-D76Thmqp.esm.js → stats-BaWAv541.esm.js} +1 -1
  68. package/dist/stats.esm.js +2 -2
  69. package/dist/{types-DSJflCEU.d.ts → types-0A1THNYO.d.ts} +5 -2
  70. package/dist/{types-CHzupruc.d.ts → types-BYFeUhw0.d.ts} +1 -1
  71. package/package.json +7 -3
  72. /package/dist/{Actor-D6rhGxJy.d.ts → Actor-By8WNHi-.d.ts} +0 -0
  73. /package/dist/{Manager-CVDYGoSq.d.ts → Manager-BWqHEUjI.d.ts} +0 -0
  74. /package/dist/{StateMachine-BqtRw_hz.d.ts → StateMachine-dxjI9q0V.d.ts} +0 -0
  75. /package/dist/{api-3fZO5bmj.esm.js → api-C2uzxrpN.esm.js} +0 -0
  76. /package/dist/{camera-CVBwqx-j.d.ts → camera-BCRgkMoe.d.ts} +0 -0
  77. /package/dist/{chunk-C24vxluH.esm.js → chunk-NXK2ElUW.esm.js} +0 -0
  78. /package/dist/{displayErrors-BgtBHbfb.d.ts → displayErrors-CV7ux9Fr.d.ts} +0 -0
  79. /package/dist/{flowCompletionService-De8JDo87.d.ts → flowCompletionService-sG6KA8y2.d.ts} +0 -0
  80. /package/dist/{id-r_CoQ3r-.esm.js → id-C3aKMJhc.esm.js} +0 -0
  81. /package/dist/{index-LKrIp3Oo.d.ts → index-DGdyPh8A.d.ts} +0 -0
  82. /package/dist/{warmup-DoQLFT3z.d.ts → warmup-B_dntecl.d.ts} +0 -0
@@ -0,0 +1,411 @@
1
+ import { t as Manager } from "./Manager-BWqHEUjI.js";
2
+ import "./camera-BCRgkMoe.js";
3
+ import "./types-BYFeUhw0.js";
4
+ import { i as RegulationTypes } from "./types-0A1THNYO.js";
5
+ import * as xstate417 from "xstate";
6
+
7
+ //#region src/modules/mandatory-consent/types.d.ts
8
+ type MandatoryConsentConfig = {
9
+ consentType: RegulationTypes;
10
+ };
11
+ type MandatoryConsent = {
12
+ id: string;
13
+ title: string;
14
+ text: string;
15
+ description?: string;
16
+ consentType: string;
17
+ };
18
+ type FetchMandatoryConsentResponse = {
19
+ consents: MandatoryConsent[];
20
+ };
21
+ //#endregion
22
+ //#region src/modules/mandatory-consent/mandatoryConsentStateMachine.d.ts
23
+ type MandatoryConsentContext = {
24
+ config: MandatoryConsentConfig;
25
+ consent: MandatoryConsent | undefined;
26
+ isSigned: boolean;
27
+ error: string | undefined;
28
+ };
29
+ type MandatoryConsentInput = {
30
+ config: MandatoryConsentConfig;
31
+ };
32
+ declare const mandatoryConsentMachine: xstate417.StateMachine<MandatoryConsentContext, {
33
+ type: "LOAD";
34
+ } | {
35
+ type: "TOGGLE";
36
+ } | {
37
+ type: "SUBMIT";
38
+ } | {
39
+ type: "CANCEL";
40
+ } | {
41
+ type: "RETRY";
42
+ } | {
43
+ type: "RESET";
44
+ }, {
45
+ [x: string]: xstate417.ActorRefFromLogic<xstate417.PromiseActorLogic<FetchMandatoryConsentResponse, {
46
+ config: MandatoryConsentConfig;
47
+ }, xstate417.EventObject>> | xstate417.ActorRefFromLogic<xstate417.PromiseActorLogic<void, {
48
+ consentId: string;
49
+ isSigned: boolean;
50
+ }, xstate417.EventObject>> | undefined;
51
+ }, xstate417.Values<{
52
+ fetchConsent: {
53
+ src: "fetchConsent";
54
+ logic: xstate417.PromiseActorLogic<FetchMandatoryConsentResponse, {
55
+ config: MandatoryConsentConfig;
56
+ }, xstate417.EventObject>;
57
+ id: string | undefined;
58
+ };
59
+ submitConsent: {
60
+ src: "submitConsent";
61
+ logic: xstate417.PromiseActorLogic<void, {
62
+ consentId: string;
63
+ isSigned: boolean;
64
+ }, xstate417.EventObject>;
65
+ id: string | undefined;
66
+ };
67
+ }>, xstate417.Values<{
68
+ clearError: {
69
+ type: "clearError";
70
+ params: xstate417.NonReducibleUnknown;
71
+ };
72
+ resetContext: {
73
+ type: "resetContext";
74
+ params: xstate417.NonReducibleUnknown;
75
+ };
76
+ setError: {
77
+ type: "setError";
78
+ params: xstate417.NonReducibleUnknown;
79
+ };
80
+ setConsent: {
81
+ type: "setConsent";
82
+ params: xstate417.NonReducibleUnknown;
83
+ };
84
+ toggleSigned: {
85
+ type: "toggleSigned";
86
+ params: xstate417.NonReducibleUnknown;
87
+ };
88
+ }>, {
89
+ type: "canSubmit";
90
+ params: unknown;
91
+ }, never, "error" | "finished" | "closed" | "idle" | "loading" | "display" | "submitting", string, MandatoryConsentInput, xstate417.NonReducibleUnknown, xstate417.EventObject, xstate417.MetaObject, {
92
+ readonly id: "mandatoryConsent";
93
+ readonly initial: "idle";
94
+ readonly context: ({
95
+ input
96
+ }: {
97
+ spawn: {
98
+ <TSrc extends "fetchConsent" | "submitConsent">(logic: TSrc, ...[options]: ({
99
+ src: "fetchConsent";
100
+ logic: xstate417.PromiseActorLogic<FetchMandatoryConsentResponse, {
101
+ config: MandatoryConsentConfig;
102
+ }, xstate417.EventObject>;
103
+ id: string | undefined;
104
+ } extends infer T ? T extends {
105
+ src: "fetchConsent";
106
+ logic: xstate417.PromiseActorLogic<FetchMandatoryConsentResponse, {
107
+ config: MandatoryConsentConfig;
108
+ }, xstate417.EventObject>;
109
+ id: string | undefined;
110
+ } ? T extends {
111
+ src: TSrc;
112
+ } ? xstate417.ConditionalRequired<[options?: ({
113
+ id?: T["id"] | undefined;
114
+ systemId?: string;
115
+ input?: xstate417.InputFrom<T["logic"]> | undefined;
116
+ syncSnapshot?: boolean;
117
+ } & { [K in xstate417.RequiredActorOptions<T>]: unknown }) | undefined], xstate417.IsNotNever<xstate417.RequiredActorOptions<T>>> : never : never : never) | ({
118
+ src: "submitConsent";
119
+ logic: xstate417.PromiseActorLogic<void, {
120
+ consentId: string;
121
+ isSigned: boolean;
122
+ }, xstate417.EventObject>;
123
+ id: string | undefined;
124
+ } extends infer T_1 ? T_1 extends {
125
+ src: "submitConsent";
126
+ logic: xstate417.PromiseActorLogic<void, {
127
+ consentId: string;
128
+ isSigned: boolean;
129
+ }, xstate417.EventObject>;
130
+ id: string | undefined;
131
+ } ? T_1 extends {
132
+ src: TSrc;
133
+ } ? xstate417.ConditionalRequired<[options?: ({
134
+ id?: T_1["id"] | undefined;
135
+ systemId?: string;
136
+ input?: xstate417.InputFrom<T_1["logic"]> | undefined;
137
+ syncSnapshot?: boolean;
138
+ } & { [K_1 in xstate417.RequiredActorOptions<T_1>]: unknown }) | undefined], xstate417.IsNotNever<xstate417.RequiredActorOptions<T_1>>> : never : never : never)): xstate417.ActorRefFromLogic<xstate417.GetConcreteByKey<xstate417.Values<{
139
+ fetchConsent: {
140
+ src: "fetchConsent";
141
+ logic: xstate417.PromiseActorLogic<FetchMandatoryConsentResponse, {
142
+ config: MandatoryConsentConfig;
143
+ }, xstate417.EventObject>;
144
+ id: string | undefined;
145
+ };
146
+ submitConsent: {
147
+ src: "submitConsent";
148
+ logic: xstate417.PromiseActorLogic<void, {
149
+ consentId: string;
150
+ isSigned: boolean;
151
+ }, xstate417.EventObject>;
152
+ id: string | undefined;
153
+ };
154
+ }>, "src", TSrc>["logic"]>;
155
+ <TLogic extends xstate417.AnyActorLogic>(src: TLogic, ...[options]: xstate417.ConditionalRequired<[options?: ({
156
+ id?: never;
157
+ systemId?: string;
158
+ input?: xstate417.InputFrom<TLogic> | undefined;
159
+ syncSnapshot?: boolean;
160
+ } & { [K in xstate417.RequiredLogicInput<TLogic>]: unknown }) | undefined], xstate417.IsNotNever<xstate417.RequiredLogicInput<TLogic>>>): xstate417.ActorRefFromLogic<TLogic>;
161
+ };
162
+ input: MandatoryConsentInput;
163
+ self: xstate417.ActorRef<xstate417.MachineSnapshot<MandatoryConsentContext, {
164
+ type: "LOAD";
165
+ } | {
166
+ type: "TOGGLE";
167
+ } | {
168
+ type: "SUBMIT";
169
+ } | {
170
+ type: "CANCEL";
171
+ } | {
172
+ type: "RETRY";
173
+ } | {
174
+ type: "RESET";
175
+ }, Record<string, xstate417.AnyActorRef | undefined>, xstate417.StateValue, string, unknown, any, any>, {
176
+ type: "LOAD";
177
+ } | {
178
+ type: "TOGGLE";
179
+ } | {
180
+ type: "SUBMIT";
181
+ } | {
182
+ type: "CANCEL";
183
+ } | {
184
+ type: "RETRY";
185
+ } | {
186
+ type: "RESET";
187
+ }, xstate417.AnyEventObject>;
188
+ }) => {
189
+ config: MandatoryConsentConfig;
190
+ consent: undefined;
191
+ isSigned: false;
192
+ error: undefined;
193
+ };
194
+ readonly states: {
195
+ readonly idle: {
196
+ readonly on: {
197
+ readonly LOAD: {
198
+ readonly target: "loading";
199
+ readonly actions: "clearError";
200
+ };
201
+ };
202
+ };
203
+ readonly loading: {
204
+ readonly invoke: {
205
+ readonly id: "fetchConsent";
206
+ readonly src: "fetchConsent";
207
+ readonly input: ({
208
+ context
209
+ }: {
210
+ context: MandatoryConsentContext;
211
+ event: {
212
+ type: "LOAD";
213
+ } | {
214
+ type: "TOGGLE";
215
+ } | {
216
+ type: "SUBMIT";
217
+ } | {
218
+ type: "CANCEL";
219
+ } | {
220
+ type: "RETRY";
221
+ } | {
222
+ type: "RESET";
223
+ };
224
+ self: xstate417.ActorRef<xstate417.MachineSnapshot<MandatoryConsentContext, {
225
+ type: "LOAD";
226
+ } | {
227
+ type: "TOGGLE";
228
+ } | {
229
+ type: "SUBMIT";
230
+ } | {
231
+ type: "CANCEL";
232
+ } | {
233
+ type: "RETRY";
234
+ } | {
235
+ type: "RESET";
236
+ }, Record<string, xstate417.AnyActorRef>, xstate417.StateValue, string, unknown, any, any>, {
237
+ type: "LOAD";
238
+ } | {
239
+ type: "TOGGLE";
240
+ } | {
241
+ type: "SUBMIT";
242
+ } | {
243
+ type: "CANCEL";
244
+ } | {
245
+ type: "RETRY";
246
+ } | {
247
+ type: "RESET";
248
+ }, xstate417.AnyEventObject>;
249
+ }) => {
250
+ config: MandatoryConsentConfig;
251
+ };
252
+ readonly onDone: {
253
+ readonly target: "display";
254
+ readonly actions: "setConsent";
255
+ };
256
+ readonly onError: {
257
+ readonly target: "error";
258
+ readonly actions: "setError";
259
+ };
260
+ };
261
+ };
262
+ readonly display: {
263
+ readonly on: {
264
+ readonly TOGGLE: {
265
+ readonly actions: "toggleSigned";
266
+ };
267
+ readonly SUBMIT: {
268
+ readonly target: "submitting";
269
+ readonly guard: "canSubmit";
270
+ };
271
+ readonly CANCEL: {
272
+ readonly target: "closed";
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: MandatoryConsentContext;
288
+ event: {
289
+ type: "LOAD";
290
+ } | {
291
+ type: "TOGGLE";
292
+ } | {
293
+ type: "SUBMIT";
294
+ } | {
295
+ type: "CANCEL";
296
+ } | {
297
+ type: "RETRY";
298
+ } | {
299
+ type: "RESET";
300
+ };
301
+ self: xstate417.ActorRef<xstate417.MachineSnapshot<MandatoryConsentContext, {
302
+ type: "LOAD";
303
+ } | {
304
+ type: "TOGGLE";
305
+ } | {
306
+ type: "SUBMIT";
307
+ } | {
308
+ type: "CANCEL";
309
+ } | {
310
+ type: "RETRY";
311
+ } | {
312
+ type: "RESET";
313
+ }, Record<string, xstate417.AnyActorRef>, xstate417.StateValue, string, unknown, any, any>, {
314
+ type: "LOAD";
315
+ } | {
316
+ type: "TOGGLE";
317
+ } | {
318
+ type: "SUBMIT";
319
+ } | {
320
+ type: "CANCEL";
321
+ } | {
322
+ type: "RETRY";
323
+ } | {
324
+ type: "RESET";
325
+ }, xstate417.AnyEventObject>;
326
+ }) => {
327
+ consentId: string;
328
+ isSigned: boolean;
329
+ };
330
+ readonly onDone: {
331
+ readonly target: "finished";
332
+ };
333
+ readonly onError: {
334
+ readonly target: "display";
335
+ readonly actions: "setError";
336
+ };
337
+ };
338
+ };
339
+ readonly error: {
340
+ readonly on: {
341
+ readonly RETRY: {
342
+ readonly target: "loading";
343
+ readonly actions: "clearError";
344
+ };
345
+ readonly CANCEL: {
346
+ readonly target: "closed";
347
+ };
348
+ readonly RESET: {
349
+ readonly target: "idle";
350
+ readonly actions: "resetContext";
351
+ };
352
+ };
353
+ };
354
+ readonly finished: {
355
+ readonly type: "final";
356
+ };
357
+ readonly closed: {
358
+ readonly type: "final";
359
+ };
360
+ };
361
+ }>;
362
+ //#endregion
363
+ //#region src/modules/mandatory-consent/mandatoryConsentActor.d.ts
364
+ type CreateMandatoryConsentActorOptions = {
365
+ config: MandatoryConsentConfig;
366
+ };
367
+ //#endregion
368
+ //#region src/modules/mandatory-consent/mandatoryConsentManager.d.ts
369
+ type MandatoryConsentIdleState = {
370
+ status: 'idle';
371
+ };
372
+ type MandatoryConsentLoadingState = {
373
+ status: 'loading';
374
+ };
375
+ type MandatoryConsentDisplayState = {
376
+ status: 'display';
377
+ title: string;
378
+ text: string;
379
+ isSigned: boolean;
380
+ canSubmit: boolean;
381
+ error?: string;
382
+ };
383
+ type MandatoryConsentSubmittingState = {
384
+ status: 'submitting';
385
+ title: string;
386
+ text: string;
387
+ isSigned: boolean;
388
+ canSubmit: false;
389
+ };
390
+ type MandatoryConsentFinishedState = {
391
+ status: 'finished';
392
+ };
393
+ type MandatoryConsentClosedState = {
394
+ status: 'closed';
395
+ };
396
+ type MandatoryConsentErrorState = {
397
+ status: 'error';
398
+ error: string;
399
+ };
400
+ type MandatoryConsentState = MandatoryConsentIdleState | MandatoryConsentLoadingState | MandatoryConsentDisplayState | MandatoryConsentSubmittingState | MandatoryConsentFinishedState | MandatoryConsentClosedState | MandatoryConsentErrorState;
401
+ declare function createMandatoryConsentManager(options: CreateMandatoryConsentActorOptions): Manager<MandatoryConsentState> & {
402
+ load(): void;
403
+ toggle(): void;
404
+ submit(): void;
405
+ cancel(): void;
406
+ retry(): void;
407
+ reset(): void;
408
+ };
409
+ type MandatoryConsentManager = ReturnType<typeof createMandatoryConsentManager>;
410
+ //#endregion
411
+ export { type MandatoryConsentConfig, type MandatoryConsentManager, type MandatoryConsentState, createMandatoryConsentManager, mandatoryConsentMachine };
@@ -0,0 +1,198 @@
1
+ import { S as createActor, n as eventModuleNames, o as createManagerInstrumentation, v as setup, x as fromPromise, y as assign } from "./events-CbNkXF2Q.esm.js";
2
+ import { A as createManager } from "./src-BX-m0lbm.esm.js";
3
+ import { t as api } from "./api-C2uzxrpN.esm.js";
4
+ import { t as endpoints } from "./endpoints-b2PxFIku.esm.js";
5
+
6
+ //#region src/modules/mandatory-consent/mandatoryConsentServices.ts
7
+ async function fetchMandatoryConsent(regulationType, signal) {
8
+ const res = await api.get(endpoints.getConsents, {
9
+ signal,
10
+ query: {
11
+ type: "MANDATORY",
12
+ language: "en",
13
+ regulationType
14
+ }
15
+ });
16
+ if (!res.ok) throw new Error(`GET ${endpoints.getConsents} failed: ${res.status} ${res.statusText}`);
17
+ return res.data;
18
+ }
19
+ async function submitMandatoryConsent(params, signal) {
20
+ const res = await api.post(endpoints.submitMlConsent, params, { signal });
21
+ if (!res.ok) throw new Error(`POST ${endpoints.submitMlConsent} failed: ${res.status} ${res.statusText}`);
22
+ }
23
+
24
+ //#endregion
25
+ //#region src/modules/mandatory-consent/mandatoryConsentStateMachine.ts
26
+ const mandatoryConsentMachine = setup({
27
+ types: {
28
+ context: {},
29
+ events: {},
30
+ input: {}
31
+ },
32
+ actors: {
33
+ fetchConsent: fromPromise(async ({ input, signal }) => fetchMandatoryConsent(input.config.consentType, signal)),
34
+ submitConsent: fromPromise(async ({ input, signal }) => submitMandatoryConsent({ consents: [{
35
+ id: input.consentId,
36
+ isSigned: input.isSigned
37
+ }] }, signal))
38
+ },
39
+ actions: {
40
+ setConsent: assign(({ event }) => {
41
+ return {
42
+ consent: event.output.consents[0],
43
+ isSigned: false,
44
+ error: void 0
45
+ };
46
+ }),
47
+ toggleSigned: assign(({ context }) => ({ isSigned: !context.isSigned })),
48
+ setError: assign(({ event }) => ({ error: String(event.error) })),
49
+ clearError: assign({ error: () => void 0 }),
50
+ resetContext: assign(({ context }) => ({
51
+ config: context.config,
52
+ consent: void 0,
53
+ isSigned: false,
54
+ error: void 0
55
+ }))
56
+ },
57
+ guards: { canSubmit: ({ context }) => Boolean(context.consent?.id) && context.isSigned }
58
+ }).createMachine({
59
+ id: "mandatoryConsent",
60
+ initial: "idle",
61
+ context: ({ input }) => ({
62
+ config: input.config,
63
+ consent: void 0,
64
+ isSigned: false,
65
+ error: void 0
66
+ }),
67
+ states: {
68
+ idle: { on: { LOAD: {
69
+ target: "loading",
70
+ actions: "clearError"
71
+ } } },
72
+ loading: { invoke: {
73
+ id: "fetchConsent",
74
+ src: "fetchConsent",
75
+ input: ({ context }) => ({ config: context.config }),
76
+ onDone: {
77
+ target: "display",
78
+ actions: "setConsent"
79
+ },
80
+ onError: {
81
+ target: "error",
82
+ actions: "setError"
83
+ }
84
+ } },
85
+ display: { on: {
86
+ TOGGLE: { actions: "toggleSigned" },
87
+ SUBMIT: {
88
+ target: "submitting",
89
+ guard: "canSubmit"
90
+ },
91
+ CANCEL: { target: "closed" },
92
+ RETRY: {
93
+ target: "loading",
94
+ actions: "clearError"
95
+ }
96
+ } },
97
+ submitting: { invoke: {
98
+ id: "submitConsent",
99
+ src: "submitConsent",
100
+ input: ({ context }) => ({
101
+ consentId: context.consent?.id ?? "",
102
+ isSigned: context.isSigned
103
+ }),
104
+ onDone: { target: "finished" },
105
+ onError: {
106
+ target: "display",
107
+ actions: "setError"
108
+ }
109
+ } },
110
+ error: { on: {
111
+ RETRY: {
112
+ target: "loading",
113
+ actions: "clearError"
114
+ },
115
+ CANCEL: { target: "closed" },
116
+ RESET: {
117
+ target: "idle",
118
+ actions: "resetContext"
119
+ }
120
+ } },
121
+ finished: { type: "final" },
122
+ closed: { type: "final" }
123
+ }
124
+ });
125
+
126
+ //#endregion
127
+ //#region src/modules/mandatory-consent/mandatoryConsentActor.ts
128
+ function createMandatoryConsentActor(options) {
129
+ return createActor(mandatoryConsentMachine, { input: { config: options.config } }).start();
130
+ }
131
+
132
+ //#endregion
133
+ //#region src/modules/mandatory-consent/mandatoryConsentManager.ts
134
+ function mapState(snapshot) {
135
+ const typedSnapshot = snapshot;
136
+ const { context } = typedSnapshot;
137
+ const canSubmit = Boolean(context.isSigned && context.consent?.id);
138
+ if (typedSnapshot.matches("idle")) return { status: "idle" };
139
+ if (typedSnapshot.matches("loading")) return { status: "loading" };
140
+ if (typedSnapshot.matches("display")) return {
141
+ status: "display",
142
+ title: context.consent?.title ?? "",
143
+ text: context.consent?.text ?? "",
144
+ isSigned: context.isSigned,
145
+ canSubmit,
146
+ error: context.error
147
+ };
148
+ if (typedSnapshot.matches("submitting")) return {
149
+ status: "submitting",
150
+ title: context.consent?.title ?? "",
151
+ text: context.consent?.text ?? "",
152
+ isSigned: context.isSigned,
153
+ canSubmit: false
154
+ };
155
+ if (typedSnapshot.matches("finished")) return { status: "finished" };
156
+ if (typedSnapshot.matches("closed")) return { status: "closed" };
157
+ if (typedSnapshot.matches("error")) return {
158
+ status: "error",
159
+ error: context.error ?? "Unknown error"
160
+ };
161
+ return { status: "idle" };
162
+ }
163
+ function createApi({ actor, trackElementClicked }) {
164
+ return {
165
+ load() {
166
+ actor.send({ type: "LOAD" });
167
+ },
168
+ toggle() {
169
+ actor.send({ type: "TOGGLE" });
170
+ },
171
+ submit() {
172
+ trackElementClicked?.("submit");
173
+ actor.send({ type: "SUBMIT" });
174
+ },
175
+ cancel() {
176
+ trackElementClicked?.("cancel");
177
+ actor.send({ type: "CANCEL" });
178
+ },
179
+ retry() {
180
+ trackElementClicked?.("retry");
181
+ actor.send({ type: "RETRY" });
182
+ },
183
+ reset() {
184
+ actor.send({ type: "RESET" });
185
+ }
186
+ };
187
+ }
188
+ function createMandatoryConsentManager(options) {
189
+ return createManager({
190
+ actor: createMandatoryConsentActor(options),
191
+ mapState,
192
+ createApi,
193
+ instrumentation: createManagerInstrumentation(eventModuleNames.mlConsent)
194
+ });
195
+ }
196
+
197
+ //#endregion
198
+ export { createMandatoryConsentManager, mandatoryConsentMachine };
package/dist/phone.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import "./Manager-CVDYGoSq.js";
2
- import "./Actor-D6rhGxJy.js";
3
- import { a as phoneMachine, n as PhoneState, o as PhoneConfig, r as createPhoneManager, t as PhoneManager } from "./phoneManager-pTIOvlCD.js";
1
+ import "./Manager-BWqHEUjI.js";
2
+ import "./Actor-By8WNHi-.js";
3
+ import { a as phoneMachine, n as PhoneState, o as PhoneConfig, r as createPhoneManager, t as PhoneManager } from "./phoneManager-B0MT8wYz.js";
4
4
  export { type PhoneConfig, type PhoneManager, type PhoneState, createPhoneManager, phoneMachine };
package/dist/phone.esm.js CHANGED
@@ -1,7 +1,7 @@
1
- import "./events-DzHYCTUI.esm.js";
2
- import "./src-Cmpz4Jmw.esm.js";
3
- import "./api-3fZO5bmj.esm.js";
4
- import "./endpoints-Bydn-Ave.esm.js";
5
- import { r as phoneMachine, t as createPhoneManager } from "./phoneManager-BwBW-tRA.esm.js";
1
+ import "./events-CbNkXF2Q.esm.js";
2
+ import "./src-BX-m0lbm.esm.js";
3
+ import "./api-C2uzxrpN.esm.js";
4
+ import "./endpoints-b2PxFIku.esm.js";
5
+ import { r as phoneMachine, t as createPhoneManager } from "./phoneManager-Cvp5LFN7.esm.js";
6
6
 
7
7
  export { createPhoneManager, phoneMachine };
@@ -1,5 +1,5 @@
1
- import { t as Manager } from "./Manager-CVDYGoSq.js";
2
- import { t as ActorRefFrom } from "./Actor-D6rhGxJy.js";
1
+ import { t as Manager } from "./Manager-BWqHEUjI.js";
2
+ import { t as ActorRefFrom } from "./Actor-By8WNHi-.js";
3
3
 
4
4
  //#region src/modules/phone/types.d.ts
5
5
 
@@ -1,7 +1,7 @@
1
- import { S as createActor, b as fromCallback, n as eventModuleNames, o as createManagerInstrumentation, v as setup, x as fromPromise, y as assign } from "./events-DzHYCTUI.esm.js";
2
- import { A as createManager, g as BrowserTimerProvider } from "./src-Cmpz4Jmw.esm.js";
3
- import { t as api } from "./api-3fZO5bmj.esm.js";
4
- import { t as endpoints } from "./endpoints-Bydn-Ave.esm.js";
1
+ import { S as createActor, b as fromCallback, n as eventModuleNames, o as createManagerInstrumentation, v as setup, x as fromPromise, y as assign } from "./events-CbNkXF2Q.esm.js";
2
+ import { A as createManager, g as BrowserTimerProvider } from "./src-BX-m0lbm.esm.js";
3
+ import { t as api } from "./api-C2uzxrpN.esm.js";
4
+ import { t as endpoints } from "./endpoints-b2PxFIku.esm.js";
5
5
 
6
6
  //#region src/modules/phone/phoneServices.ts
7
7
  async function fetchPhone(signal) {
@@ -1,6 +1,6 @@
1
- import { C as queryCameraPermission, M as getDeviceInfo, O as requestCameraAccess, P as getUserAgent, R as isIPad, f as MotionSensorProvider, k as stopCameraStream } from "./src-Cmpz4Jmw.esm.js";
2
- import { t as api } from "./api-3fZO5bmj.esm.js";
3
- import { t as endpoints } from "./endpoints-Bydn-Ave.esm.js";
1
+ import { C as queryCameraPermission, M as getDeviceInfo, O as requestCameraAccess, P as getUserAgent, R as isIPad, f as MotionSensorProvider, k as stopCameraStream } from "./src-BX-m0lbm.esm.js";
2
+ import { t as api } from "./api-C2uzxrpN.esm.js";
3
+ import { t as endpoints } from "./endpoints-b2PxFIku.esm.js";
4
4
 
5
5
  //#region src/internal/device/getBrowser.ts
6
6
  function getBrowser() {
@@ -1,4 +1,4 @@
1
- import { t as Manager } from "./Manager-CVDYGoSq.js";
1
+ import { t as Manager } from "./Manager-BWqHEUjI.js";
2
2
 
3
3
  //#region src/modules/redirect-to-mobile/types.d.ts
4
4
  type RedirectToMobileConfig = {
@@ -1,7 +1,7 @@
1
- import { S as createActor, b as fromCallback, n as eventModuleNames, o as createManagerInstrumentation, v as setup, x as fromPromise, y as assign } from "./events-DzHYCTUI.esm.js";
2
- import { A as createManager, g as BrowserTimerProvider } from "./src-Cmpz4Jmw.esm.js";
3
- import { t as api } from "./api-3fZO5bmj.esm.js";
4
- import { t as endpoints } from "./endpoints-Bydn-Ave.esm.js";
1
+ import { S as createActor, b as fromCallback, n as eventModuleNames, o as createManagerInstrumentation, v as setup, x as fromPromise, y as assign } from "./events-CbNkXF2Q.esm.js";
2
+ import { A as createManager, g as BrowserTimerProvider } from "./src-BX-m0lbm.esm.js";
3
+ import { t as api } from "./api-C2uzxrpN.esm.js";
4
+ import { t as endpoints } from "./endpoints-b2PxFIku.esm.js";
5
5
 
6
6
  //#region ../infra/src/url/urlUtils.ts
7
7
  function getUrlSearchParam(url, param) {