@incodetech/core 2.0.0-rc.0 → 2.0.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 (178) hide show
  1. package/package.json +3 -3
  2. package/dist/Actor-CI32dTbG.d.ts +0 -2
  3. package/dist/BaseWasmProvider-C_DLEI40.esm.js +0 -1118
  4. package/dist/BrowserStorageProvider-CuOW1Er2.esm.js +0 -55
  5. package/dist/BrowserTimerProvider-DhNc_x02.esm.js +0 -22
  6. package/dist/ITimerCapability-C67ZRskg.esm.js +0 -7
  7. package/dist/IpifyProvider-D7jx52AL.esm.js +0 -139
  8. package/dist/Manager-C8PrhBOx.d.ts +0 -19
  9. package/dist/MotionSensorProvider-4v7xkqAp.esm.js +0 -254
  10. package/dist/OpenViduRecordingProvider-CMu6XVdc.esm.js +0 -87
  11. package/dist/StateMachine-BCQrZJhf.d.ts +0 -2
  12. package/dist/WasmUtilProvider-j98OJf-S.esm.js +0 -114
  13. package/dist/addressSearch-BpTbTWCa.esm.js +0 -430
  14. package/dist/ae-signature-DDDZmWXj.esm.js +0 -12
  15. package/dist/ae-signature.d.ts +0 -25
  16. package/dist/ae-signature.esm.js +0 -8
  17. package/dist/antifraud.d.ts +0 -57
  18. package/dist/antifraud.esm.js +0 -45
  19. package/dist/antifraudStateMachine-O0TMf6yc.esm.js +0 -39
  20. package/dist/api-CESGtpbH.esm.js +0 -53
  21. package/dist/authentication.d.ts +0 -12
  22. package/dist/authentication.esm.js +0 -25
  23. package/dist/authenticationManager-5M-fKzXx.esm.js +0 -67
  24. package/dist/authenticationManager-C83GNIhl.d.ts +0 -66
  25. package/dist/authenticationStateMachine-BMZqatiF.esm.js +0 -139
  26. package/dist/backCameraStream-DMdMeGk2.esm.js +0 -346
  27. package/dist/browserSimulation-gxD8cSpM.esm.js +0 -20
  28. package/dist/camera-DBSxa6ML.d.ts +0 -4
  29. package/dist/camera-PA2Ljri3.esm.js +0 -22
  30. package/dist/camera.d.ts +0 -15
  31. package/dist/camera.esm.js +0 -5
  32. package/dist/chunk-CRF6K_H_.esm.js +0 -49
  33. package/dist/consent.d.ts +0 -398
  34. package/dist/consent.esm.js +0 -79
  35. package/dist/consentStateMachine-CCT-B60O.esm.js +0 -151
  36. package/dist/cpf-PPz2Njto.esm.js +0 -38
  37. package/dist/cpf-ocr.d.ts +0 -204
  38. package/dist/cpf-ocr.esm.js +0 -177
  39. package/dist/cross-document-data-match.d.ts +0 -34
  40. package/dist/cross-document-data-match.esm.js +0 -71
  41. package/dist/curp-validation.d.ts +0 -188
  42. package/dist/curp-validation.esm.js +0 -110
  43. package/dist/curpValidationStateMachine-CitWLr2c.esm.js +0 -595
  44. package/dist/custom-fields.d.ts +0 -115
  45. package/dist/custom-fields.esm.js +0 -177
  46. package/dist/custom-watchlist.d.ts +0 -66
  47. package/dist/custom-watchlist.esm.js +0 -86
  48. package/dist/dateUtils-UoN5xswP.esm.js +0 -23
  49. package/dist/deepsightLoader-Cm4JIT_z.esm.js +0 -52
  50. package/dist/deepsightService-CEVxzehb.d.ts +0 -412
  51. package/dist/deepsightService-O74l4Y__.esm.js +0 -489
  52. package/dist/device.d.ts +0 -46
  53. package/dist/device.esm.js +0 -106
  54. package/dist/displayErrors-DqJ_IbsG.d.ts +0 -39
  55. package/dist/document-capture.d.ts +0 -906
  56. package/dist/document-capture.esm.js +0 -156
  57. package/dist/document-upload.d.ts +0 -331
  58. package/dist/document-upload.esm.js +0 -203
  59. package/dist/documentCaptureStateMachine-BqzTDy9k.esm.js +0 -394
  60. package/dist/dynamic-forms.d.ts +0 -178
  61. package/dist/dynamic-forms.esm.js +0 -323
  62. package/dist/ekyb.d.ts +0 -148
  63. package/dist/ekyb.esm.js +0 -127
  64. package/dist/ekybStateMachine-B59rQjgj.esm.js +0 -674
  65. package/dist/ekyc.d.ts +0 -164
  66. package/dist/ekyc.esm.js +0 -104
  67. package/dist/ekycStateMachine-oeO0Iekd.esm.js +0 -10626
  68. package/dist/electronic-signature.d.ts +0 -4
  69. package/dist/electronic-signature.esm.js +0 -7
  70. package/dist/electronicSignatureManager-D9OHzTpG.esm.js +0 -428
  71. package/dist/email.d.ts +0 -4
  72. package/dist/email.esm.js +0 -9
  73. package/dist/emailManager-DIfnS5g1.d.ts +0 -352
  74. package/dist/emailManager-wAV0LE-H.esm.js +0 -238
  75. package/dist/emailStateMachine-DOf4j58N.esm.js +0 -292
  76. package/dist/endpoints-CnN3SyDa.esm.js +0 -87
  77. package/dist/events-D6-e4vok.esm.js +0 -596
  78. package/dist/events.d.ts +0 -265
  79. package/dist/events.esm.js +0 -4
  80. package/dist/extensibility.d.ts +0 -122
  81. package/dist/extensibility.esm.js +0 -43
  82. package/dist/face-match.d.ts +0 -228
  83. package/dist/face-match.esm.js +0 -173
  84. package/dist/faceCaptureManagerFactory-Dh2PdGlF.esm.js +0 -290
  85. package/dist/faceCaptureManagerFactory-yqtpxjnN.d.ts +0 -690
  86. package/dist/faceCaptureSetup-B3faSpYA.esm.js +0 -873
  87. package/dist/faceMatchStateMachine-DNFrxTFS.esm.js +0 -127
  88. package/dist/flow-events.d.ts +0 -6
  89. package/dist/flow-events.esm.js +0 -0
  90. package/dist/flow.d.ts +0 -358
  91. package/dist/flow.esm.js +0 -825
  92. package/dist/flowCompletionService-DhkT4SRY.d.ts +0 -10
  93. package/dist/flowCompletionService-P54yzGvA.esm.js +0 -13
  94. package/dist/flowServices-DTsm-Vf1.esm.js +0 -188
  95. package/dist/geolocation.d.ts +0 -127
  96. package/dist/geolocation.esm.js +0 -89
  97. package/dist/geolocationStateMachine-asasuHY2.esm.js +0 -105
  98. package/dist/getBrowser-BSXUTWXw.esm.js +0 -41
  99. package/dist/getDeviceClass-BSntT9_j.esm.js +0 -14
  100. package/dist/government-validation.d.ts +0 -67
  101. package/dist/government-validation.esm.js +0 -81
  102. package/dist/governmentValidationStateMachine-BDDYrJTo.esm.js +0 -271
  103. package/dist/home.d.ts +0 -99
  104. package/dist/home.esm.js +0 -61
  105. package/dist/http.d.ts +0 -68
  106. package/dist/http.esm.js +0 -3
  107. package/dist/id-ocr.d.ts +0 -635
  108. package/dist/id-ocr.esm.js +0 -86
  109. package/dist/id-verification.d.ts +0 -190
  110. package/dist/id-verification.esm.js +0 -43
  111. package/dist/id.d.ts +0 -24
  112. package/dist/id.esm.js +0 -164
  113. package/dist/idCaptureManager-B9TGA5dq.d.ts +0 -956
  114. package/dist/idCaptureManager-DMK0GIt3.esm.js +0 -581
  115. package/dist/idCaptureStateMachine-Bq0fVZXl.esm.js +0 -2954
  116. package/dist/idOcrStateMachine-YbjjC_Gg.esm.js +0 -388
  117. package/dist/idVerificationStateMachine-xbw9HP1Z.esm.js +0 -71
  118. package/dist/identity-reuse.d.ts +0 -530
  119. package/dist/identity-reuse.esm.js +0 -274
  120. package/dist/index-BLKtMA0g.d.ts +0 -1177
  121. package/dist/index-BcRG8rtJ.d.ts +0 -97
  122. package/dist/index.d.ts +0 -3
  123. package/dist/index.esm.js +0 -12
  124. package/dist/invokeOnCaptureCallback-rc6kBHo5.esm.js +0 -30
  125. package/dist/lib-BB0B_qQX.esm.js +0 -12499
  126. package/dist/mandatory-consent.d.ts +0 -412
  127. package/dist/mandatory-consent.esm.js +0 -78
  128. package/dist/mandatoryConsentStateMachine-Cnco1jvn.esm.js +0 -126
  129. package/dist/openviduLazy-Cm0XFh_v.esm.js +0 -3
  130. package/dist/openviduLazy-Cok70ZSg.esm.js +0 -12
  131. package/dist/permissionServices-D_i6nzEw.esm.js +0 -50
  132. package/dist/phone.d.ts +0 -4
  133. package/dist/phone.esm.js +0 -9
  134. package/dist/phoneManager-B6M30hKE.d.ts +0 -397
  135. package/dist/phoneManager-DAJbGhlY.esm.js +0 -256
  136. package/dist/phoneStateMachine-CuPARRaT.esm.js +0 -351
  137. package/dist/platform-CfrjKhmi.esm.js +0 -83
  138. package/dist/qe-signature-DFo_Cc-I.esm.js +0 -12
  139. package/dist/qe-signature.d.ts +0 -25
  140. package/dist/qe-signature.esm.js +0 -8
  141. package/dist/recordingService-Ig2UgbLv.esm.js +0 -1003
  142. package/dist/redirect-to-mobile.d.ts +0 -107
  143. package/dist/redirect-to-mobile.esm.js +0 -102
  144. package/dist/redirectToMobileStateMachine-BOEqe46A.esm.js +0 -249
  145. package/dist/runChildModule-CqqwqAkW.esm.js +0 -219
  146. package/dist/selfie.d.ts +0 -26
  147. package/dist/selfie.esm.js +0 -146
  148. package/dist/selfieManager-D0lSgd-J.d.ts +0 -68
  149. package/dist/selfieManager-Duisl7qN.esm.js +0 -60
  150. package/dist/selfieStateMachine-D76whWEf.esm.js +0 -68
  151. package/dist/session-BS-d_vuE.esm.js +0 -3206
  152. package/dist/session.d.ts +0 -217
  153. package/dist/session.esm.js +0 -9
  154. package/dist/setup-Buy-hyj4.esm.js +0 -887
  155. package/dist/setup-C5AITV8m.d.ts +0 -254
  156. package/dist/signature.d.ts +0 -94
  157. package/dist/signature.esm.js +0 -66
  158. package/dist/signatureStateMachine-B5-QVUve.esm.js +0 -132
  159. package/dist/stats-CIfiPzb1.esm.js +0 -16
  160. package/dist/stats.d.ts +0 -16
  161. package/dist/stats.esm.js +0 -4
  162. package/dist/trust-graph.d.ts +0 -54
  163. package/dist/trust-graph.esm.js +0 -56
  164. package/dist/types-B06Ypu2F.d.ts +0 -49
  165. package/dist/types-BP1m8VRw.d.ts +0 -340
  166. package/dist/types-CAD4va6a.d.ts +0 -5
  167. package/dist/types-CFV9G_7j.d.ts +0 -24
  168. package/dist/warmup-CEcppFiS.d.ts +0 -63
  169. package/dist/wasm.d.ts +0 -15
  170. package/dist/wasm.esm.js +0 -12
  171. package/dist/watchlist-for-business.d.ts +0 -79
  172. package/dist/watchlist-for-business.esm.js +0 -148
  173. package/dist/watchlist.d.ts +0 -62
  174. package/dist/watchlist.esm.js +0 -86
  175. package/dist/watchlistServices-DMbUhkBX.esm.js +0 -12
  176. package/dist/workflow.d.ts +0 -907
  177. package/dist/workflow.esm.js +0 -702
  178. package/dist/xstate.esm-B70JrNqo.esm.js +0 -3404
package/dist/camera.d.ts DELETED
@@ -1,15 +0,0 @@
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 };
@@ -1,5 +0,0 @@
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 };
@@ -1,49 +0,0 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __esm = (fn, res) => function() {
9
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
- };
11
- var __commonJS = (cb, mod) => function() {
12
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
13
- };
14
- var __export = (all, symbols) => {
15
- let target = {};
16
- for (var name in all) {
17
- __defProp(target, name, {
18
- get: all[name],
19
- enumerable: true
20
- });
21
- }
22
- if (symbols) {
23
- __defProp(target, Symbol.toStringTag, { value: "Module" });
24
- }
25
- return target;
26
- };
27
- var __copyProps = (to, from, except, desc) => {
28
- if (from && typeof from === "object" || typeof from === "function") {
29
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
30
- key = keys[i];
31
- if (!__hasOwnProp.call(to, key) && key !== except) {
32
- __defProp(to, key, {
33
- get: ((k) => from[k]).bind(null, key),
34
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
35
- });
36
- }
37
- }
38
- }
39
- return to;
40
- };
41
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
42
- value: mod,
43
- enumerable: true
44
- }) : target, mod));
45
- var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
46
- var __toDynamicImportESM = (isNodeMode) => (mod) => __toESM(mod.default, isNodeMode);
47
-
48
- //#endregion
49
- export { __toDynamicImportESM as a, __toCommonJS as i, __esm as n, __export as r, __commonJS as t };
package/dist/consent.d.ts DELETED
@@ -1,398 +0,0 @@
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 };
@@ -1,79 +0,0 @@
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 };
@@ -1,151 +0,0 @@
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 };