@incodetech/core 2.0.1 → 2.1.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.
- package/dist/{BrowserStorageProvider-CuOW1Er2.esm.js → BrowserStorageProvider-BpJM-gIl.esm.js} +8 -1
- package/dist/{IpifyProvider-D7jx52AL.esm.js → IpifyProvider-D4LWD15E.esm.js} +28 -0
- package/dist/{MotionSensorProvider-4v7xkqAp.esm.js → MotionSensorProvider-Bx7Mpzt0.esm.js} +63 -13
- package/dist/{OpenViduRecordingProvider-CMu6XVdc.esm.js → OpenViduRecordingProvider-O4GjBseO.esm.js} +1 -1
- package/dist/StateMachine-BC_nGvrc.d.ts +2 -0
- package/dist/StreamCanvasCapture-ImiDQdVA.esm.js +118 -0
- package/dist/StreamCanvasCapture-yyl20qd9.d.ts +152 -0
- package/dist/{BaseWasmProvider-C_DLEI40.esm.js → WasmUtilProvider-CiEN7Gjn.esm.js} +183 -11
- package/dist/{addressSearch-BpTbTWCa.esm.js → addressSearch-DvmWXKZg.esm.js} +63 -57
- package/dist/{ae-signature-DDDZmWXj.esm.js → ae-signature-BFZta3TZ.esm.js} +1 -1
- package/dist/ae-signature.d.ts +3 -3
- package/dist/ae-signature.esm.js +6 -5
- package/dist/antifraud.d.ts +5 -46
- package/dist/antifraud.esm.js +6 -43
- package/dist/antifraudManager-CkV4u-LE.esm.js +55 -0
- package/dist/antifraudManager-CznnhyvD.d.ts +63 -0
- package/dist/{antifraudStateMachine-O0TMf6yc.esm.js → antifraudStateMachine-Ccrb-Jxc.esm.js} +2 -2
- package/dist/apiError-B-j-gyDx.esm.js +51 -0
- package/dist/authentication.d.ts +13 -11
- package/dist/authentication.esm.js +26 -22
- package/dist/{authenticationManager-C83GNIhl.d.ts → authenticationManager-CIVY80H9.d.ts} +4 -4
- package/dist/{authenticationManager-5M-fKzXx.esm.js → authenticationManager-ZNotsWnC.esm.js} +6 -6
- package/dist/{authenticationStateMachine-BMZqatiF.esm.js → authenticationStateMachine-DksVbF_H.esm.js} +21 -9
- package/dist/{backCameraStream-DMdMeGk2.esm.js → backCameraStream-D7Wo4Nbx.esm.js} +95 -7
- package/dist/{session-CrkWAs-q.esm.js → browserSimulation-B1dWiXp7.esm.js} +61 -476
- package/dist/camera.d.ts +4 -3
- package/dist/camera.esm.js +4 -3
- package/dist/canvas-SKcRBxsk.esm.js +230 -0
- package/dist/consent.d.ts +4 -398
- package/dist/consent.esm.js +6 -77
- package/dist/consentManager-BLd51QiW.d.ts +419 -0
- package/dist/consentManager-BYo9Nu1r.esm.js +90 -0
- package/dist/{consentStateMachine-CCT-B60O.esm.js → consentStateMachine-BG3yL8aC.esm.js} +9 -6
- package/dist/cpf-ocr.d.ts +4 -199
- package/dist/cpf-ocr.esm.js +8 -177
- package/dist/cpfOcrManager-BnieFXuG.d.ts +216 -0
- package/dist/cpfOcrManager-sSKegxox.esm.js +190 -0
- package/dist/cross-document-data-match.d.ts +1 -1
- package/dist/cross-document-data-match.esm.js +4 -4
- package/dist/curp-validation.d.ts +8 -158
- package/dist/curp-validation.esm.js +6 -108
- package/dist/curpValidationManager-CFem6zP9.esm.js +122 -0
- package/dist/curpValidationManager-RttixpIc.d.ts +184 -0
- package/dist/{curpValidationStateMachine-CitWLr2c.esm.js → curpValidationStateMachine-B7V_qp66.esm.js} +20 -13
- package/dist/custom-fields.d.ts +2 -2
- package/dist/custom-fields.esm.js +4 -4
- package/dist/custom-watchlist.d.ts +1 -1
- package/dist/custom-watchlist.esm.js +4 -41
- package/dist/customWatchlistStateMachine-HmFybXLX.esm.js +50 -0
- package/dist/{deepsightLoader-Cm4JIT_z.esm.js → deepsightLoader-65k1Appi.esm.js} +19 -10
- package/dist/{deepsightService-CEVxzehb.d.ts → deepsightService-B7ShOkWL.d.ts} +8 -160
- package/dist/deepsightService-CrHmvx8X.esm.js +276 -0
- package/dist/device.esm.js +4 -3
- package/dist/document-capture.d.ts +995 -86
- package/dist/document-capture.esm.js +34 -8
- package/dist/document-upload.d.ts +47 -47
- package/dist/document-upload.esm.js +7 -7
- package/dist/{documentCaptureStateMachine-BqzTDy9k.esm.js → documentCaptureStateMachine-WYV1r9le.esm.js} +90 -6
- package/dist/dynamic-forms.d.ts +20 -5
- package/dist/dynamic-forms.esm.js +150 -61
- package/dist/ekyb.d.ts +32 -13
- package/dist/ekyb.esm.js +25 -15
- package/dist/{ekybStateMachine-CyMx_kg-.esm.js → ekybStateMachine-aYixw2sL.esm.js} +319 -207
- package/dist/ekyc.d.ts +10 -78
- package/dist/ekyc.esm.js +17 -12
- package/dist/{ekycStateMachine-oeO0Iekd.esm.js → ekycStateMachine-CXbpaJJn.esm.js} +201 -113
- package/dist/electronic-signature.d.ts +3 -3
- package/dist/electronic-signature.esm.js +5 -4
- package/dist/{electronicSignatureManager-D9OHzTpG.esm.js → electronicSignatureManager-BaECdJ1u.esm.js} +91 -23
- package/dist/email.d.ts +4 -3
- package/dist/email.esm.js +6 -5
- package/dist/{emailManager-wAV0LE-H.esm.js → emailManager--D5G3ChB.esm.js} +30 -7
- package/dist/{emailManager-DIfnS5g1.d.ts → emailManager-lAzDoQOs.d.ts} +66 -8
- package/dist/{emailStateMachine-DOf4j58N.esm.js → emailStateMachine-CxTOMAjC.esm.js} +46 -11
- package/dist/{endpoints-CnN3SyDa.esm.js → endpoints-BeTK0Mlt.esm.js} +6 -3
- package/dist/{events-D6-e4vok.esm.js → events-Dvvriq9l.esm.js} +3 -1
- package/dist/events.d.ts +2 -0
- package/dist/events.esm.js +1 -1
- package/dist/extensibility.d.ts +32 -16
- package/dist/extensibility.esm.js +55 -33
- package/dist/face-match.d.ts +32 -2
- package/dist/face-match.esm.js +5 -5
- package/dist/{faceCaptureManagerFactory-yqtpxjnN.d.ts → faceCaptureManagerFactory-C_hRHx8a.d.ts} +35 -11
- package/dist/{faceCaptureManagerFactory-Dh2PdGlF.esm.js → faceCaptureManagerFactory-kqbUqtrr.esm.js} +21 -5
- package/dist/{faceCaptureSetup-B3faSpYA.esm.js → faceCaptureSetup-CtvHWd3x.esm.js} +68 -183
- package/dist/{faceMatchStateMachine-DNFrxTFS.esm.js → faceMatchStateMachine-DdGXUBnx.esm.js} +60 -6
- package/dist/field-comparison.d.ts +4 -0
- package/dist/field-comparison.esm.js +7 -0
- package/dist/fieldComparisonManager-Bu5TaSr3.d.ts +76 -0
- package/dist/fieldComparisonManager-COGI2ARD.esm.js +162 -0
- package/dist/fiscal-qr.d.ts +59 -0
- package/dist/fiscal-qr.esm.js +323 -0
- package/dist/flow-events.d.ts +6 -5
- package/dist/flow.d.ts +23 -15
- package/dist/flow.esm.js +63 -17
- package/dist/flowCompletionService-BdR2cGgB.d.ts +19 -0
- package/dist/flowCompletionService-DdGojV9K.esm.js +20 -0
- package/dist/{flowServices-PiNsxLfK.esm.js → flowServices-BTuHLHVr.esm.js} +10 -5
- package/dist/geolocation.d.ts +4 -4
- package/dist/geolocation.esm.js +6 -6
- package/dist/{geolocationStateMachine-asasuHY2.esm.js → geolocationStateMachine-Dvh7X0wF.esm.js} +5 -5
- package/dist/getBrowser-C8DP7oTB.esm.js +8 -0
- package/dist/{getBrowser-BSXUTWXw.esm.js → getDeviceClass-C0olyNFS.esm.js} +1 -8
- package/dist/{getDeviceClass-BSntT9_j.esm.js → getDeviceClass-C8Do2qYu.esm.js} +1 -1
- package/dist/government-validation.d.ts +28 -8
- package/dist/government-validation.esm.js +19 -8
- package/dist/{governmentValidationStateMachine-BDDYrJTo.esm.js → governmentValidationStateMachine-DcJ-BfsC.esm.js} +35 -77
- package/dist/home.d.ts +15 -14
- package/dist/home.esm.js +2 -2
- package/dist/http-Cai3IoLS.esm.js +0 -0
- package/dist/http.esm.js +1 -0
- package/dist/id-ocr.d.ts +54 -54
- package/dist/id-ocr.esm.js +5 -5
- package/dist/id-verification.d.ts +27 -27
- package/dist/id-verification.esm.js +4 -4
- package/dist/id.d.ts +12 -10
- package/dist/id.esm.js +36 -26
- package/dist/{idCaptureManager-Fyd0eam-.d.ts → idCaptureManager-D-QYESvF.d.ts} +28 -14
- package/dist/{idCaptureManager-D0ktk7Hh.esm.js → idCaptureManager-DGVv5l1_.esm.js} +22 -7
- package/dist/{idCaptureStateMachine-dwlBUjbC.esm.js → idCaptureStateMachine-DHi7HydI.esm.js} +172 -123
- package/dist/{idOcrStateMachine-YbjjC_Gg.esm.js → idOcrStateMachine-CDQ5d_VM.esm.js} +4 -4
- package/dist/{idVerificationStateMachine-xbw9HP1Z.esm.js → idVerificationStateMachine-kRxwImzO.esm.js} +2 -2
- package/dist/identity-reuse.d.ts +4 -530
- package/dist/identity-reuse.esm.js +8 -274
- package/dist/identityReuseManager-C6n_97dw.esm.js +95 -0
- package/dist/identityReuseManager-DwLtVzUn.d.ts +428 -0
- package/dist/identityReuseStateMachine-BfE5YiEr.esm.js +148 -0
- package/dist/{index-BcRG8rtJ.d.ts → index-B5hPA0Bg.d.ts} +2 -2
- package/dist/{index-ChHWNH48.d.ts → index-B9NysVDB.d.ts} +469 -195
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +10 -8
- package/dist/{invokeOnCaptureCallback-rc6kBHo5.esm.js → invokeOnCaptureCallback-ygByVdnn.esm.js} +1 -1
- package/dist/{lib-BB0B_qQX.esm.js → lib-BY67lgbq.esm.js} +1 -1
- package/dist/mandatory-consent.d.ts +8 -412
- package/dist/mandatory-consent.esm.js +6 -76
- package/dist/mandatoryConsentManager-H6D18cZB.esm.js +89 -0
- package/dist/mandatoryConsentManager-KfIlURRY.d.ts +429 -0
- package/dist/{mandatoryConsentStateMachine-Cnco1jvn.esm.js → mandatoryConsentStateMachine-DtQNW1ji.esm.js} +6 -6
- package/dist/openviduLazy-B8L--0oe.esm.js +3 -0
- package/dist/{openviduLazy-Cok70ZSg.esm.js → openviduLazy-Dh14JNJc.esm.js} +2 -2
- package/dist/otp-CGMdUzBC.esm.js +33 -0
- package/dist/otp-DF5A0sFx.d.ts +8 -0
- package/dist/permissionGuards-C1ispV96.esm.js +23 -0
- package/dist/permissionServices-CG3bMSfG.esm.js +130 -0
- package/dist/phone.d.ts +4 -3
- package/dist/phone.esm.js +6 -5
- package/dist/{phoneManager-DAJbGhlY.esm.js → phoneManager-BmF-0Ez4.esm.js} +30 -7
- package/dist/{phoneManager-B6M30hKE.d.ts → phoneManager-fPmIBYQK.d.ts} +65 -7
- package/dist/{phoneStateMachine-CuPARRaT.esm.js → phoneStateMachine-BiV0yoEx.esm.js} +46 -11
- package/dist/{qe-signature-DFo_Cc-I.esm.js → qe-signature-CUYPcHVo.esm.js} +1 -1
- package/dist/qe-signature.d.ts +3 -3
- package/dist/qe-signature.esm.js +6 -5
- package/dist/{recordingService-Ig2UgbLv.esm.js → recordingService-Bn9EdCmz.esm.js} +197 -179
- package/dist/redirect-to-mobile.d.ts +6 -104
- package/dist/redirect-to-mobile.esm.js +6 -99
- package/dist/redirectToMobileManager-BNe3IzC_.d.ts +178 -0
- package/dist/redirectToMobileManager-Dy3t7o0C.esm.js +159 -0
- package/dist/{redirectToMobileStateMachine-BOEqe46A.esm.js → redirectToMobileStateMachine-DyAdRxfP.esm.js} +28 -19
- package/dist/{runChildModule-CqqwqAkW.esm.js → runChildModule-CuoHZ1cx.esm.js} +35 -3
- package/dist/selfie.d.ts +13 -11
- package/dist/selfie.esm.js +27 -23
- package/dist/{selfieManager-Duisl7qN.esm.js → selfieManager-BjCoKRy0.esm.js} +6 -6
- package/dist/{selfieManager-D0lSgd-J.d.ts → selfieManager-dUbKRzOh.d.ts} +4 -4
- package/dist/{selfieStateMachine-D76whWEf.esm.js → selfieStateMachine-b4F2q9zw.esm.js} +5 -3
- package/dist/session-DoVb-OcB.esm.js +152 -0
- package/dist/session.d.ts +37 -5
- package/dist/session.esm.js +12 -7
- package/dist/sessionInitializer-B8H5MsXM.esm.js +366 -0
- package/dist/{setup-C5AITV8m.d.ts → setup-BbkprdVv.d.ts} +57 -6
- package/dist/{setup-DPPAxmXf.esm.js → setup-BqEfrdja.esm.js} +162 -24
- package/dist/signature.d.ts +2 -2
- package/dist/signature.esm.js +4 -4
- package/dist/{signatureStateMachine-B5-QVUve.esm.js → signatureStateMachine-C5qqYLRz.esm.js} +3 -3
- package/dist/stats-BMNUG1AU.esm.js +41 -0
- package/dist/stats.d.ts +13 -2
- package/dist/stats.esm.js +3 -2
- package/dist/trust-graph.d.ts +33 -4
- package/dist/trust-graph.esm.js +21 -15
- package/dist/{types-CFV9G_7j.d.ts → types-Bj9hdFjU.d.ts} +1 -1
- package/dist/{types-BP1m8VRw.d.ts → types-DOUhndhT.d.ts} +14 -2
- package/dist/types-DsnEVMhr.esm.js +34 -0
- package/dist/types-DvGZI7BF.d.ts +131 -0
- package/dist/{types-B06Ypu2F.d.ts → types-NuT8ftBV.d.ts} +1 -1
- package/dist/types-ya0LN_MX.d.ts +5 -0
- package/dist/{warmup-CEcppFiS.d.ts → warmup-Dg8Lh-50.d.ts} +8 -0
- package/dist/wasm.d.ts +6 -4
- package/dist/wasm.esm.js +11 -9
- package/dist/watchlist-for-business.d.ts +1 -1
- package/dist/watchlist-for-business.esm.js +5 -73
- package/dist/watchlist.d.ts +1 -1
- package/dist/watchlist.esm.js +4 -41
- package/dist/watchlistForBusinessStateMachine-DMl8j2Ov.esm.js +74 -0
- package/dist/watchlistStateMachine-DmQlqI6L.esm.js +50 -0
- package/dist/workflow.d.ts +150 -97
- package/dist/workflow.esm.js +156 -80
- package/package.json +19 -1
- package/dist/StateMachine-BCQrZJhf.d.ts +0 -2
- package/dist/WasmUtilProvider-j98OJf-S.esm.js +0 -114
- package/dist/browserSimulation-gxD8cSpM.esm.js +0 -20
- package/dist/deepsightService-O74l4Y__.esm.js +0 -489
- package/dist/displayErrors-DqJ_IbsG.d.ts +0 -39
- package/dist/flowCompletionService-DhkT4SRY.d.ts +0 -10
- package/dist/flowCompletionService-P54yzGvA.esm.js +0 -13
- package/dist/openviduLazy-Cm0XFh_v.esm.js +0 -3
- package/dist/permissionServices-D_i6nzEw.esm.js +0 -50
- package/dist/stats-CIfiPzb1.esm.js +0 -16
- package/dist/types-CAD4va6a.d.ts +0 -5
- package/dist/watchlistServices-DMbUhkBX.esm.js +0 -12
- /package/dist/{Actor-CI32dTbG.d.ts → Actor-Y0_Fj-KL.d.ts} +0 -0
- /package/dist/{ITimerCapability-C67ZRskg.esm.js → ITimerCapability-CB0I1Uf2.esm.js} +0 -0
- /package/dist/{Manager-C8PrhBOx.d.ts → Manager-BHn8wH8K.d.ts} +0 -0
- /package/dist/{camera-PA2Ljri3.esm.js → camera-DJWm3V4g.esm.js} +0 -0
- /package/dist/{camera-DBSxa6ML.d.ts → camera-SRBpPq2X.d.ts} +0 -0
- /package/dist/{chunk-CRF6K_H_.esm.js → chunk-CMUKZ2uL.esm.js} +0 -0
- /package/dist/{cpf-PPz2Njto.esm.js → cpf-BRzggV8G.esm.js} +0 -0
- /package/dist/{dateUtils-UoN5xswP.esm.js → dateUtils-AksLQmgV.esm.js} +0 -0
- /package/dist/{platform-CfrjKhmi.esm.js → platform-SKvEfCBh.esm.js} +0 -0
- /package/dist/{xstate.esm-B70JrNqo.esm.js → xstate.esm-C9wncMQa.esm.js} +0 -0
package/dist/consent.esm.js
CHANGED
|
@@ -1,79 +1,8 @@
|
|
|
1
1
|
import "./api-CESGtpbH.esm.js";
|
|
2
|
-
import
|
|
3
|
-
import "./endpoints-
|
|
4
|
-
import
|
|
5
|
-
import { t as consentMachine } from "./consentStateMachine-
|
|
2
|
+
import "./events-Dvvriq9l.esm.js";
|
|
3
|
+
import "./endpoints-BeTK0Mlt.esm.js";
|
|
4
|
+
import "./xstate.esm-C9wncMQa.esm.js";
|
|
5
|
+
import { t as consentMachine } from "./consentStateMachine-BG3yL8aC.esm.js";
|
|
6
|
+
import { n as createConsentManagerFromActor, t as createConsentManager } from "./consentManager-BYo9Nu1r.esm.js";
|
|
6
7
|
|
|
7
|
-
|
|
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 };
|
|
8
|
+
export { consentMachine, createConsentManager, createConsentManagerFromActor };
|
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
import { t as Manager } from "./Manager-BHn8wH8K.js";
|
|
2
|
+
import { t as ActorRefFrom } from "./Actor-Y0_Fj-KL.js";
|
|
3
|
+
import * as xstate1044 from "xstate";
|
|
4
|
+
|
|
5
|
+
//#region src/modules/consent/types.d.ts
|
|
6
|
+
type ConsentConfig = {
|
|
7
|
+
combinedConsents?: string;
|
|
8
|
+
consentId?: string;
|
|
9
|
+
language?: string;
|
|
10
|
+
};
|
|
11
|
+
type ConsentCheckbox = {
|
|
12
|
+
id: string;
|
|
13
|
+
label: string;
|
|
14
|
+
required: boolean;
|
|
15
|
+
checked: boolean;
|
|
16
|
+
};
|
|
17
|
+
type FetchCombinedConsentResponse = {
|
|
18
|
+
languageConsentId: string;
|
|
19
|
+
terms: string;
|
|
20
|
+
title: string;
|
|
21
|
+
consents: Array<{
|
|
22
|
+
checkboxId: string;
|
|
23
|
+
consentText: string;
|
|
24
|
+
optional: boolean;
|
|
25
|
+
}>;
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/modules/consent/consentStateMachine.d.ts
|
|
29
|
+
type ConsentContext = {
|
|
30
|
+
config: ConsentConfig;
|
|
31
|
+
title: string;
|
|
32
|
+
richText: string;
|
|
33
|
+
languageConsentId: string;
|
|
34
|
+
checkboxes: ConsentCheckbox[];
|
|
35
|
+
error: string | undefined;
|
|
36
|
+
};
|
|
37
|
+
type ConsentInput = {
|
|
38
|
+
config: ConsentConfig;
|
|
39
|
+
};
|
|
40
|
+
declare const consentMachine: xstate1044.StateMachine<ConsentContext, {
|
|
41
|
+
type: "LOAD";
|
|
42
|
+
} | {
|
|
43
|
+
type: "TOGGLE_CHECKBOX";
|
|
44
|
+
checkboxId: string;
|
|
45
|
+
} | {
|
|
46
|
+
type: "SUBMIT";
|
|
47
|
+
} | {
|
|
48
|
+
type: "RETRY";
|
|
49
|
+
} | {
|
|
50
|
+
type: "RESET";
|
|
51
|
+
}, {
|
|
52
|
+
[x: string]: xstate1044.ActorRefFromLogic<xstate1044.PromiseActorLogic<FetchCombinedConsentResponse, {
|
|
53
|
+
consentId: string;
|
|
54
|
+
language?: string;
|
|
55
|
+
}, xstate1044.EventObject>> | xstate1044.ActorRefFromLogic<xstate1044.PromiseActorLogic<void, {
|
|
56
|
+
languageConsentId: string;
|
|
57
|
+
checkboxes: ConsentCheckbox[];
|
|
58
|
+
}, xstate1044.EventObject>> | undefined;
|
|
59
|
+
}, xstate1044.Values<{
|
|
60
|
+
fetchConsent: {
|
|
61
|
+
src: "fetchConsent";
|
|
62
|
+
logic: xstate1044.PromiseActorLogic<FetchCombinedConsentResponse, {
|
|
63
|
+
consentId: string;
|
|
64
|
+
language?: string;
|
|
65
|
+
}, xstate1044.EventObject>;
|
|
66
|
+
id: string | undefined;
|
|
67
|
+
};
|
|
68
|
+
submitConsent: {
|
|
69
|
+
src: "submitConsent";
|
|
70
|
+
logic: xstate1044.PromiseActorLogic<void, {
|
|
71
|
+
languageConsentId: string;
|
|
72
|
+
checkboxes: ConsentCheckbox[];
|
|
73
|
+
}, xstate1044.EventObject>;
|
|
74
|
+
id: string | undefined;
|
|
75
|
+
};
|
|
76
|
+
}>, xstate1044.Values<{
|
|
77
|
+
setError: {
|
|
78
|
+
type: "setError";
|
|
79
|
+
params: xstate1044.NonReducibleUnknown;
|
|
80
|
+
};
|
|
81
|
+
clearError: {
|
|
82
|
+
type: "clearError";
|
|
83
|
+
params: xstate1044.NonReducibleUnknown;
|
|
84
|
+
};
|
|
85
|
+
resetContext: {
|
|
86
|
+
type: "resetContext";
|
|
87
|
+
params: xstate1044.NonReducibleUnknown;
|
|
88
|
+
};
|
|
89
|
+
setConsentData: {
|
|
90
|
+
type: "setConsentData";
|
|
91
|
+
params: xstate1044.NonReducibleUnknown;
|
|
92
|
+
};
|
|
93
|
+
toggleCheckbox: {
|
|
94
|
+
type: "toggleCheckbox";
|
|
95
|
+
params: xstate1044.NonReducibleUnknown;
|
|
96
|
+
};
|
|
97
|
+
}>, {
|
|
98
|
+
type: "canSubmit";
|
|
99
|
+
params: unknown;
|
|
100
|
+
}, never, "error" | "idle" | "finished" | "loading" | "submitting" | "display", string, ConsentInput, xstate1044.NonReducibleUnknown, xstate1044.EventObject, xstate1044.MetaObject, {
|
|
101
|
+
readonly id: "consent";
|
|
102
|
+
readonly initial: "idle";
|
|
103
|
+
readonly context: ({
|
|
104
|
+
input
|
|
105
|
+
}: {
|
|
106
|
+
spawn: {
|
|
107
|
+
<TSrc extends "fetchConsent" | "submitConsent">(logic: TSrc, ...[options]: ({
|
|
108
|
+
src: "fetchConsent";
|
|
109
|
+
logic: xstate1044.PromiseActorLogic<FetchCombinedConsentResponse, {
|
|
110
|
+
consentId: string;
|
|
111
|
+
language?: string;
|
|
112
|
+
}, xstate1044.EventObject>;
|
|
113
|
+
id: string | undefined;
|
|
114
|
+
} extends infer T ? T extends {
|
|
115
|
+
src: "fetchConsent";
|
|
116
|
+
logic: xstate1044.PromiseActorLogic<FetchCombinedConsentResponse, {
|
|
117
|
+
consentId: string;
|
|
118
|
+
language?: string;
|
|
119
|
+
}, xstate1044.EventObject>;
|
|
120
|
+
id: string | undefined;
|
|
121
|
+
} ? T extends {
|
|
122
|
+
src: TSrc;
|
|
123
|
+
} ? xstate1044.ConditionalRequired<[options?: ({
|
|
124
|
+
id?: T["id"] | undefined;
|
|
125
|
+
systemId?: string;
|
|
126
|
+
input?: xstate1044.InputFrom<T["logic"]> | undefined;
|
|
127
|
+
syncSnapshot?: boolean;
|
|
128
|
+
} & { [K in xstate1044.RequiredActorOptions<T>]: unknown }) | undefined], xstate1044.IsNotNever<xstate1044.RequiredActorOptions<T>>> : never : never : never) | ({
|
|
129
|
+
src: "submitConsent";
|
|
130
|
+
logic: xstate1044.PromiseActorLogic<void, {
|
|
131
|
+
languageConsentId: string;
|
|
132
|
+
checkboxes: ConsentCheckbox[];
|
|
133
|
+
}, xstate1044.EventObject>;
|
|
134
|
+
id: string | undefined;
|
|
135
|
+
} extends infer T_1 ? T_1 extends {
|
|
136
|
+
src: "submitConsent";
|
|
137
|
+
logic: xstate1044.PromiseActorLogic<void, {
|
|
138
|
+
languageConsentId: string;
|
|
139
|
+
checkboxes: ConsentCheckbox[];
|
|
140
|
+
}, xstate1044.EventObject>;
|
|
141
|
+
id: string | undefined;
|
|
142
|
+
} ? T_1 extends {
|
|
143
|
+
src: TSrc;
|
|
144
|
+
} ? xstate1044.ConditionalRequired<[options?: ({
|
|
145
|
+
id?: T_1["id"] | undefined;
|
|
146
|
+
systemId?: string;
|
|
147
|
+
input?: xstate1044.InputFrom<T_1["logic"]> | undefined;
|
|
148
|
+
syncSnapshot?: boolean;
|
|
149
|
+
} & { [K_1 in xstate1044.RequiredActorOptions<T_1>]: unknown }) | undefined], xstate1044.IsNotNever<xstate1044.RequiredActorOptions<T_1>>> : never : never : never)): xstate1044.ActorRefFromLogic<xstate1044.GetConcreteByKey<xstate1044.Values<{
|
|
150
|
+
fetchConsent: {
|
|
151
|
+
src: "fetchConsent";
|
|
152
|
+
logic: xstate1044.PromiseActorLogic<FetchCombinedConsentResponse, {
|
|
153
|
+
consentId: string;
|
|
154
|
+
language?: string;
|
|
155
|
+
}, xstate1044.EventObject>;
|
|
156
|
+
id: string | undefined;
|
|
157
|
+
};
|
|
158
|
+
submitConsent: {
|
|
159
|
+
src: "submitConsent";
|
|
160
|
+
logic: xstate1044.PromiseActorLogic<void, {
|
|
161
|
+
languageConsentId: string;
|
|
162
|
+
checkboxes: ConsentCheckbox[];
|
|
163
|
+
}, xstate1044.EventObject>;
|
|
164
|
+
id: string | undefined;
|
|
165
|
+
};
|
|
166
|
+
}>, "src", TSrc>["logic"]>;
|
|
167
|
+
<TLogic extends xstate1044.AnyActorLogic>(src: TLogic, ...[options]: xstate1044.ConditionalRequired<[options?: ({
|
|
168
|
+
id?: never;
|
|
169
|
+
systemId?: string;
|
|
170
|
+
input?: xstate1044.InputFrom<TLogic> | undefined;
|
|
171
|
+
syncSnapshot?: boolean;
|
|
172
|
+
} & { [K in xstate1044.RequiredLogicInput<TLogic>]: unknown }) | undefined], xstate1044.IsNotNever<xstate1044.RequiredLogicInput<TLogic>>>): xstate1044.ActorRefFromLogic<TLogic>;
|
|
173
|
+
};
|
|
174
|
+
input: ConsentInput;
|
|
175
|
+
self: xstate1044.ActorRef<xstate1044.MachineSnapshot<ConsentContext, {
|
|
176
|
+
type: "LOAD";
|
|
177
|
+
} | {
|
|
178
|
+
type: "TOGGLE_CHECKBOX";
|
|
179
|
+
checkboxId: string;
|
|
180
|
+
} | {
|
|
181
|
+
type: "SUBMIT";
|
|
182
|
+
} | {
|
|
183
|
+
type: "RETRY";
|
|
184
|
+
} | {
|
|
185
|
+
type: "RESET";
|
|
186
|
+
}, Record<string, xstate1044.AnyActorRef | undefined>, xstate1044.StateValue, string, unknown, any, any>, {
|
|
187
|
+
type: "LOAD";
|
|
188
|
+
} | {
|
|
189
|
+
type: "TOGGLE_CHECKBOX";
|
|
190
|
+
checkboxId: string;
|
|
191
|
+
} | {
|
|
192
|
+
type: "SUBMIT";
|
|
193
|
+
} | {
|
|
194
|
+
type: "RETRY";
|
|
195
|
+
} | {
|
|
196
|
+
type: "RESET";
|
|
197
|
+
}, xstate1044.AnyEventObject>;
|
|
198
|
+
}) => {
|
|
199
|
+
config: ConsentConfig;
|
|
200
|
+
title: string;
|
|
201
|
+
richText: string;
|
|
202
|
+
languageConsentId: string;
|
|
203
|
+
checkboxes: never[];
|
|
204
|
+
error: undefined;
|
|
205
|
+
};
|
|
206
|
+
readonly states: {
|
|
207
|
+
readonly idle: {
|
|
208
|
+
readonly on: {
|
|
209
|
+
readonly LOAD: {
|
|
210
|
+
readonly target: "loading";
|
|
211
|
+
readonly actions: "clearError";
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
readonly loading: {
|
|
216
|
+
readonly invoke: {
|
|
217
|
+
readonly id: "fetchConsent";
|
|
218
|
+
readonly src: "fetchConsent";
|
|
219
|
+
readonly input: ({
|
|
220
|
+
context
|
|
221
|
+
}: {
|
|
222
|
+
context: ConsentContext;
|
|
223
|
+
event: {
|
|
224
|
+
type: "LOAD";
|
|
225
|
+
} | {
|
|
226
|
+
type: "TOGGLE_CHECKBOX";
|
|
227
|
+
checkboxId: string;
|
|
228
|
+
} | {
|
|
229
|
+
type: "SUBMIT";
|
|
230
|
+
} | {
|
|
231
|
+
type: "RETRY";
|
|
232
|
+
} | {
|
|
233
|
+
type: "RESET";
|
|
234
|
+
};
|
|
235
|
+
self: xstate1044.ActorRef<xstate1044.MachineSnapshot<ConsentContext, {
|
|
236
|
+
type: "LOAD";
|
|
237
|
+
} | {
|
|
238
|
+
type: "TOGGLE_CHECKBOX";
|
|
239
|
+
checkboxId: string;
|
|
240
|
+
} | {
|
|
241
|
+
type: "SUBMIT";
|
|
242
|
+
} | {
|
|
243
|
+
type: "RETRY";
|
|
244
|
+
} | {
|
|
245
|
+
type: "RESET";
|
|
246
|
+
}, Record<string, xstate1044.AnyActorRef>, xstate1044.StateValue, string, unknown, any, any>, {
|
|
247
|
+
type: "LOAD";
|
|
248
|
+
} | {
|
|
249
|
+
type: "TOGGLE_CHECKBOX";
|
|
250
|
+
checkboxId: string;
|
|
251
|
+
} | {
|
|
252
|
+
type: "SUBMIT";
|
|
253
|
+
} | {
|
|
254
|
+
type: "RETRY";
|
|
255
|
+
} | {
|
|
256
|
+
type: "RESET";
|
|
257
|
+
}, xstate1044.AnyEventObject>;
|
|
258
|
+
}) => {
|
|
259
|
+
consentId: string;
|
|
260
|
+
language: string | undefined;
|
|
261
|
+
};
|
|
262
|
+
readonly onDone: {
|
|
263
|
+
readonly target: "display";
|
|
264
|
+
readonly actions: "setConsentData";
|
|
265
|
+
};
|
|
266
|
+
readonly onError: {
|
|
267
|
+
readonly target: "error";
|
|
268
|
+
readonly actions: "setError";
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
readonly display: {
|
|
273
|
+
readonly on: {
|
|
274
|
+
readonly TOGGLE_CHECKBOX: {
|
|
275
|
+
readonly actions: "toggleCheckbox";
|
|
276
|
+
};
|
|
277
|
+
readonly SUBMIT: {
|
|
278
|
+
readonly target: "submitting";
|
|
279
|
+
readonly guard: "canSubmit";
|
|
280
|
+
};
|
|
281
|
+
readonly RETRY: {
|
|
282
|
+
readonly target: "loading";
|
|
283
|
+
readonly actions: "clearError";
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
readonly submitting: {
|
|
288
|
+
readonly invoke: {
|
|
289
|
+
readonly id: "submitConsent";
|
|
290
|
+
readonly src: "submitConsent";
|
|
291
|
+
readonly input: ({
|
|
292
|
+
context
|
|
293
|
+
}: {
|
|
294
|
+
context: ConsentContext;
|
|
295
|
+
event: {
|
|
296
|
+
type: "LOAD";
|
|
297
|
+
} | {
|
|
298
|
+
type: "TOGGLE_CHECKBOX";
|
|
299
|
+
checkboxId: string;
|
|
300
|
+
} | {
|
|
301
|
+
type: "SUBMIT";
|
|
302
|
+
} | {
|
|
303
|
+
type: "RETRY";
|
|
304
|
+
} | {
|
|
305
|
+
type: "RESET";
|
|
306
|
+
};
|
|
307
|
+
self: xstate1044.ActorRef<xstate1044.MachineSnapshot<ConsentContext, {
|
|
308
|
+
type: "LOAD";
|
|
309
|
+
} | {
|
|
310
|
+
type: "TOGGLE_CHECKBOX";
|
|
311
|
+
checkboxId: string;
|
|
312
|
+
} | {
|
|
313
|
+
type: "SUBMIT";
|
|
314
|
+
} | {
|
|
315
|
+
type: "RETRY";
|
|
316
|
+
} | {
|
|
317
|
+
type: "RESET";
|
|
318
|
+
}, Record<string, xstate1044.AnyActorRef>, xstate1044.StateValue, string, unknown, any, any>, {
|
|
319
|
+
type: "LOAD";
|
|
320
|
+
} | {
|
|
321
|
+
type: "TOGGLE_CHECKBOX";
|
|
322
|
+
checkboxId: string;
|
|
323
|
+
} | {
|
|
324
|
+
type: "SUBMIT";
|
|
325
|
+
} | {
|
|
326
|
+
type: "RETRY";
|
|
327
|
+
} | {
|
|
328
|
+
type: "RESET";
|
|
329
|
+
}, xstate1044.AnyEventObject>;
|
|
330
|
+
}) => {
|
|
331
|
+
languageConsentId: string;
|
|
332
|
+
checkboxes: ConsentCheckbox[];
|
|
333
|
+
};
|
|
334
|
+
readonly onDone: {
|
|
335
|
+
readonly target: "finished";
|
|
336
|
+
};
|
|
337
|
+
readonly onError: {
|
|
338
|
+
readonly target: "display";
|
|
339
|
+
readonly actions: "setError";
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
};
|
|
343
|
+
readonly error: {
|
|
344
|
+
readonly on: {
|
|
345
|
+
readonly RETRY: {
|
|
346
|
+
readonly target: "loading";
|
|
347
|
+
readonly actions: "clearError";
|
|
348
|
+
};
|
|
349
|
+
readonly RESET: {
|
|
350
|
+
readonly target: "idle";
|
|
351
|
+
readonly actions: "resetContext";
|
|
352
|
+
};
|
|
353
|
+
};
|
|
354
|
+
};
|
|
355
|
+
readonly finished: {
|
|
356
|
+
readonly type: "final";
|
|
357
|
+
};
|
|
358
|
+
};
|
|
359
|
+
}>;
|
|
360
|
+
type ConsentMachine = typeof consentMachine;
|
|
361
|
+
//#endregion
|
|
362
|
+
//#region src/modules/consent/consentActor.d.ts
|
|
363
|
+
type CreateConsentActorOptions = {
|
|
364
|
+
config: ConsentConfig;
|
|
365
|
+
};
|
|
366
|
+
type ConsentActor = ActorRefFrom<ConsentMachine>;
|
|
367
|
+
//#endregion
|
|
368
|
+
//#region src/modules/consent/consentManager.d.ts
|
|
369
|
+
type ConsentIdleState = {
|
|
370
|
+
status: 'idle';
|
|
371
|
+
};
|
|
372
|
+
type ConsentLoadingState = {
|
|
373
|
+
status: 'loading';
|
|
374
|
+
};
|
|
375
|
+
type ConsentDisplayState = {
|
|
376
|
+
status: 'display';
|
|
377
|
+
title: string;
|
|
378
|
+
richText: string;
|
|
379
|
+
checkboxes: ConsentCheckbox[];
|
|
380
|
+
canSubmit: boolean;
|
|
381
|
+
error?: string;
|
|
382
|
+
};
|
|
383
|
+
type ConsentSubmittingState = {
|
|
384
|
+
status: 'submitting';
|
|
385
|
+
title: string;
|
|
386
|
+
richText: string;
|
|
387
|
+
checkboxes: ConsentCheckbox[];
|
|
388
|
+
canSubmit: false;
|
|
389
|
+
};
|
|
390
|
+
type ConsentFinishedState = {
|
|
391
|
+
status: 'finished';
|
|
392
|
+
};
|
|
393
|
+
type ConsentErrorState = {
|
|
394
|
+
status: 'error';
|
|
395
|
+
error: string;
|
|
396
|
+
};
|
|
397
|
+
type ConsentState = ConsentIdleState | ConsentLoadingState | ConsentDisplayState | ConsentSubmittingState | ConsentFinishedState | ConsentErrorState;
|
|
398
|
+
declare function createConsentManager(options: CreateConsentActorOptions): Manager<ConsentState> & {
|
|
399
|
+
load(): void;
|
|
400
|
+
toggleCheckbox(checkboxId: string): void;
|
|
401
|
+
submit(): void;
|
|
402
|
+
retry(): void;
|
|
403
|
+
reset(): void;
|
|
404
|
+
};
|
|
405
|
+
/**
|
|
406
|
+
* Creates a consent manager from a pre-built actor.
|
|
407
|
+
* Use this when overriding the machine via `.provide()` for custom backends
|
|
408
|
+
* or for story-isolation testing.
|
|
409
|
+
*/
|
|
410
|
+
declare function createConsentManagerFromActor(actor: ConsentActor): Manager<ConsentState> & {
|
|
411
|
+
load(): void;
|
|
412
|
+
toggleCheckbox(checkboxId: string): void;
|
|
413
|
+
submit(): void;
|
|
414
|
+
retry(): void;
|
|
415
|
+
reset(): void;
|
|
416
|
+
};
|
|
417
|
+
type ConsentManager = ReturnType<typeof createConsentManager>;
|
|
418
|
+
//#endregion
|
|
419
|
+
export { ConsentActor as a, ConsentConfig as c, createConsentManagerFromActor as i, ConsentState as n, consentMachine as o, createConsentManager as r, ConsentCheckbox as s, ConsentManager as t };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-Dvvriq9l.esm.js";
|
|
2
|
+
import { c as createManager, s as createActor } from "./xstate.esm-C9wncMQa.esm.js";
|
|
3
|
+
import { t as consentMachine } from "./consentStateMachine-BG3yL8aC.esm.js";
|
|
4
|
+
|
|
5
|
+
//#region src/modules/consent/consentActor.ts
|
|
6
|
+
function createConsentActor(options) {
|
|
7
|
+
return createActor(consentMachine, { input: { config: options.config } }).start();
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/modules/consent/consentManager.ts
|
|
12
|
+
function getCanSubmit(checkboxes) {
|
|
13
|
+
return checkboxes.filter((checkbox) => checkbox.required).every((checkbox) => checkbox.checked);
|
|
14
|
+
}
|
|
15
|
+
function mapState(snapshot) {
|
|
16
|
+
const typedSnapshot = snapshot;
|
|
17
|
+
const { context } = typedSnapshot;
|
|
18
|
+
const canSubmit = getCanSubmit(context.checkboxes);
|
|
19
|
+
if (typedSnapshot.matches("idle")) return { status: "idle" };
|
|
20
|
+
if (typedSnapshot.matches("loading")) return { status: "loading" };
|
|
21
|
+
if (typedSnapshot.matches("display")) return {
|
|
22
|
+
status: "display",
|
|
23
|
+
title: context.title,
|
|
24
|
+
richText: context.richText,
|
|
25
|
+
checkboxes: context.checkboxes,
|
|
26
|
+
canSubmit,
|
|
27
|
+
error: context.error
|
|
28
|
+
};
|
|
29
|
+
if (typedSnapshot.matches("submitting")) return {
|
|
30
|
+
status: "submitting",
|
|
31
|
+
title: context.title,
|
|
32
|
+
richText: context.richText,
|
|
33
|
+
checkboxes: context.checkboxes,
|
|
34
|
+
canSubmit: false
|
|
35
|
+
};
|
|
36
|
+
if (typedSnapshot.matches("finished")) return { status: "finished" };
|
|
37
|
+
if (typedSnapshot.matches("error")) return {
|
|
38
|
+
status: "error",
|
|
39
|
+
error: context.error ?? "Unknown error"
|
|
40
|
+
};
|
|
41
|
+
return { status: "idle" };
|
|
42
|
+
}
|
|
43
|
+
function createApi({ actor, trackElementClicked }) {
|
|
44
|
+
return {
|
|
45
|
+
load() {
|
|
46
|
+
actor.send({ type: "LOAD" });
|
|
47
|
+
},
|
|
48
|
+
toggleCheckbox(checkboxId) {
|
|
49
|
+
actor.send({
|
|
50
|
+
type: "TOGGLE_CHECKBOX",
|
|
51
|
+
checkboxId
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
submit() {
|
|
55
|
+
trackElementClicked?.("submit");
|
|
56
|
+
actor.send({ type: "SUBMIT" });
|
|
57
|
+
},
|
|
58
|
+
retry() {
|
|
59
|
+
trackElementClicked?.("retry");
|
|
60
|
+
actor.send({ type: "RETRY" });
|
|
61
|
+
},
|
|
62
|
+
reset() {
|
|
63
|
+
actor.send({ type: "RESET" });
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function createConsentManager(options) {
|
|
68
|
+
return createManager({
|
|
69
|
+
actor: createConsentActor(options),
|
|
70
|
+
mapState,
|
|
71
|
+
createApi,
|
|
72
|
+
instrumentation: createManagerInstrumentation(eventModuleNames.combinedConsent)
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Creates a consent manager from a pre-built actor.
|
|
77
|
+
* Use this when overriding the machine via `.provide()` for custom backends
|
|
78
|
+
* or for story-isolation testing.
|
|
79
|
+
*/
|
|
80
|
+
function createConsentManagerFromActor(actor) {
|
|
81
|
+
return createManager({
|
|
82
|
+
actor,
|
|
83
|
+
mapState,
|
|
84
|
+
createApi,
|
|
85
|
+
instrumentation: createManagerInstrumentation(eventModuleNames.combinedConsent)
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
//#endregion
|
|
90
|
+
export { createConsentManagerFromActor as n, createConsentManager as t };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { t as api } from "./api-CESGtpbH.esm.js";
|
|
2
|
-
import { t as endpoints } from "./endpoints-
|
|
3
|
-
import { a as fromPromise, r as assign, t as setup } from "./xstate.esm-
|
|
2
|
+
import { t as endpoints } from "./endpoints-BeTK0Mlt.esm.js";
|
|
3
|
+
import { a as fromPromise, r as assign, t as setup } from "./xstate.esm-C9wncMQa.esm.js";
|
|
4
4
|
|
|
5
5
|
//#region src/modules/consent/consentServices.ts
|
|
6
|
-
async function fetchCombinedConsent(consentId, signal) {
|
|
6
|
+
async function fetchCombinedConsent(consentId, language, signal) {
|
|
7
7
|
if (!consentId) throw new Error("Combined consent id is required");
|
|
8
8
|
const res = await api.get(endpoints.getCombinedConsent, {
|
|
9
9
|
signal,
|
|
10
10
|
query: {
|
|
11
11
|
id: consentId,
|
|
12
|
-
language: "en"
|
|
12
|
+
language: language ?? "en"
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
if (!res.ok) throw new Error(`GET ${endpoints.getCombinedConsent} failed: ${res.status} ${res.statusText}`);
|
|
@@ -36,7 +36,7 @@ const consentMachine = setup({
|
|
|
36
36
|
},
|
|
37
37
|
actors: {
|
|
38
38
|
fetchConsent: fromPromise(async ({ input, signal }) => {
|
|
39
|
-
return fetchCombinedConsent(input.consentId, signal);
|
|
39
|
+
return fetchCombinedConsent(input.consentId, input.language, signal);
|
|
40
40
|
}),
|
|
41
41
|
submitConsent: fromPromise(async ({ input, signal }) => {
|
|
42
42
|
await submitCombinedConsent({
|
|
@@ -99,7 +99,10 @@ const consentMachine = setup({
|
|
|
99
99
|
loading: { invoke: {
|
|
100
100
|
id: "fetchConsent",
|
|
101
101
|
src: "fetchConsent",
|
|
102
|
-
input: ({ context }) => ({
|
|
102
|
+
input: ({ context }) => ({
|
|
103
|
+
consentId: String(context.config.combinedConsents ?? context.config.consentId ?? ""),
|
|
104
|
+
language: context.config.language
|
|
105
|
+
}),
|
|
103
106
|
onDone: {
|
|
104
107
|
target: "display",
|
|
105
108
|
actions: "setConsentData"
|