@incodetech/core 2.0.0 → 2.0.1-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/Actor-CI32dTbG.d.ts +2 -0
- package/dist/BaseWasmProvider-C_DLEI40.esm.js +1118 -0
- package/dist/BrowserStorageProvider-CuOW1Er2.esm.js +55 -0
- package/dist/BrowserTimerProvider-DhNc_x02.esm.js +22 -0
- package/dist/ITimerCapability-C67ZRskg.esm.js +7 -0
- package/dist/IpifyProvider-D7jx52AL.esm.js +139 -0
- package/dist/Manager-C8PrhBOx.d.ts +19 -0
- package/dist/MotionSensorProvider-4v7xkqAp.esm.js +254 -0
- package/dist/OpenViduRecordingProvider-CMu6XVdc.esm.js +87 -0
- package/dist/StateMachine-BCQrZJhf.d.ts +2 -0
- package/dist/WasmUtilProvider-j98OJf-S.esm.js +114 -0
- package/dist/addressSearch-BpTbTWCa.esm.js +430 -0
- package/dist/ae-signature-DDDZmWXj.esm.js +12 -0
- package/dist/ae-signature.d.ts +25 -0
- package/dist/ae-signature.esm.js +8 -0
- package/dist/antifraud.d.ts +57 -0
- package/dist/antifraud.esm.js +45 -0
- package/dist/antifraudStateMachine-O0TMf6yc.esm.js +39 -0
- package/dist/api-CESGtpbH.esm.js +53 -0
- package/dist/authentication.d.ts +12 -0
- package/dist/authentication.esm.js +25 -0
- package/dist/authenticationManager-5M-fKzXx.esm.js +67 -0
- package/dist/authenticationManager-C83GNIhl.d.ts +66 -0
- package/dist/authenticationStateMachine-BMZqatiF.esm.js +139 -0
- package/dist/backCameraStream-DMdMeGk2.esm.js +346 -0
- package/dist/browserSimulation-gxD8cSpM.esm.js +20 -0
- package/dist/camera-DBSxa6ML.d.ts +4 -0
- package/dist/camera-PA2Ljri3.esm.js +22 -0
- package/dist/camera.d.ts +15 -0
- package/dist/camera.esm.js +5 -0
- package/dist/chunk-CRF6K_H_.esm.js +49 -0
- package/dist/consent.d.ts +398 -0
- package/dist/consent.esm.js +79 -0
- package/dist/consentStateMachine-CCT-B60O.esm.js +151 -0
- package/dist/cpf-PPz2Njto.esm.js +38 -0
- package/dist/cpf-ocr.d.ts +204 -0
- package/dist/cpf-ocr.esm.js +177 -0
- package/dist/cross-document-data-match.d.ts +34 -0
- package/dist/cross-document-data-match.esm.js +71 -0
- package/dist/curp-validation.d.ts +188 -0
- package/dist/curp-validation.esm.js +110 -0
- package/dist/curpValidationStateMachine-CitWLr2c.esm.js +595 -0
- package/dist/custom-fields.d.ts +115 -0
- package/dist/custom-fields.esm.js +177 -0
- package/dist/custom-watchlist.d.ts +66 -0
- package/dist/custom-watchlist.esm.js +86 -0
- package/dist/dateUtils-UoN5xswP.esm.js +23 -0
- package/dist/deepsightLoader-Cm4JIT_z.esm.js +52 -0
- package/dist/deepsightService-CEVxzehb.d.ts +412 -0
- package/dist/deepsightService-O74l4Y__.esm.js +489 -0
- package/dist/device.d.ts +46 -0
- package/dist/device.esm.js +106 -0
- package/dist/displayErrors-DqJ_IbsG.d.ts +39 -0
- package/dist/document-capture.d.ts +906 -0
- package/dist/document-capture.esm.js +156 -0
- package/dist/document-upload.d.ts +331 -0
- package/dist/document-upload.esm.js +203 -0
- package/dist/documentCaptureStateMachine-BqzTDy9k.esm.js +394 -0
- package/dist/dynamic-forms.d.ts +178 -0
- package/dist/dynamic-forms.esm.js +323 -0
- package/dist/ekyb.d.ts +148 -0
- package/dist/ekyb.esm.js +127 -0
- package/dist/ekybStateMachine-BR2let5f.esm.js +674 -0
- package/dist/ekyc.d.ts +164 -0
- package/dist/ekyc.esm.js +104 -0
- package/dist/ekycStateMachine-oeO0Iekd.esm.js +10626 -0
- package/dist/electronic-signature.d.ts +4 -0
- package/dist/electronic-signature.esm.js +7 -0
- package/dist/electronicSignatureManager-D9OHzTpG.esm.js +428 -0
- package/dist/email.d.ts +4 -0
- package/dist/email.esm.js +9 -0
- package/dist/emailManager-DIfnS5g1.d.ts +352 -0
- package/dist/emailManager-wAV0LE-H.esm.js +238 -0
- package/dist/emailStateMachine-DOf4j58N.esm.js +292 -0
- package/dist/endpoints-CnN3SyDa.esm.js +87 -0
- package/dist/events-D6-e4vok.esm.js +596 -0
- package/dist/events.d.ts +265 -0
- package/dist/events.esm.js +4 -0
- package/dist/extensibility.d.ts +122 -0
- package/dist/extensibility.esm.js +43 -0
- package/dist/face-match.d.ts +228 -0
- package/dist/face-match.esm.js +173 -0
- package/dist/faceCaptureManagerFactory-Dh2PdGlF.esm.js +290 -0
- package/dist/faceCaptureManagerFactory-yqtpxjnN.d.ts +690 -0
- package/dist/faceCaptureSetup-B3faSpYA.esm.js +873 -0
- package/dist/faceMatchStateMachine-DNFrxTFS.esm.js +127 -0
- package/dist/flow-events.d.ts +6 -0
- package/dist/flow-events.esm.js +0 -0
- package/dist/flow.d.ts +358 -0
- package/dist/flow.esm.js +825 -0
- package/dist/flowCompletionService-DhkT4SRY.d.ts +10 -0
- package/dist/flowCompletionService-P54yzGvA.esm.js +13 -0
- package/dist/flowServices-DG3IdWw6.esm.js +188 -0
- package/dist/geolocation.d.ts +127 -0
- package/dist/geolocation.esm.js +89 -0
- package/dist/geolocationStateMachine-asasuHY2.esm.js +105 -0
- package/dist/getBrowser-BSXUTWXw.esm.js +41 -0
- package/dist/getDeviceClass-BSntT9_j.esm.js +14 -0
- package/dist/government-validation.d.ts +67 -0
- package/dist/government-validation.esm.js +81 -0
- package/dist/governmentValidationStateMachine-BDDYrJTo.esm.js +271 -0
- package/dist/home.d.ts +99 -0
- package/dist/home.esm.js +61 -0
- package/dist/http.d.ts +68 -0
- package/dist/http.esm.js +3 -0
- package/dist/id-ocr.d.ts +635 -0
- package/dist/id-ocr.esm.js +86 -0
- package/dist/id-verification.d.ts +190 -0
- package/dist/id-verification.esm.js +43 -0
- package/dist/id.d.ts +24 -0
- package/dist/id.esm.js +164 -0
- package/dist/idCaptureManager-Fyd0eam-.d.ts +958 -0
- package/dist/idCaptureManager-ZPkD7Gjk.esm.js +581 -0
- package/dist/idCaptureStateMachine-BK0bPHoc.esm.js +2963 -0
- package/dist/idOcrStateMachine-YbjjC_Gg.esm.js +388 -0
- package/dist/idVerificationStateMachine-xbw9HP1Z.esm.js +71 -0
- package/dist/identity-reuse.d.ts +530 -0
- package/dist/identity-reuse.esm.js +274 -0
- package/dist/index-BcRG8rtJ.d.ts +97 -0
- package/dist/index-DZoqeAo9.d.ts +1177 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.esm.js +12 -0
- package/dist/invokeOnCaptureCallback-rc6kBHo5.esm.js +30 -0
- package/dist/lib-BB0B_qQX.esm.js +12499 -0
- package/dist/mandatory-consent.d.ts +412 -0
- package/dist/mandatory-consent.esm.js +78 -0
- package/dist/mandatoryConsentStateMachine-Cnco1jvn.esm.js +126 -0
- package/dist/openviduLazy-Cm0XFh_v.esm.js +3 -0
- package/dist/openviduLazy-Cok70ZSg.esm.js +12 -0
- package/dist/permissionServices-D_i6nzEw.esm.js +50 -0
- package/dist/phone.d.ts +4 -0
- package/dist/phone.esm.js +9 -0
- package/dist/phoneManager-B6M30hKE.d.ts +397 -0
- package/dist/phoneManager-DAJbGhlY.esm.js +256 -0
- package/dist/phoneStateMachine-CuPARRaT.esm.js +351 -0
- package/dist/platform-CfrjKhmi.esm.js +83 -0
- package/dist/qe-signature-DFo_Cc-I.esm.js +12 -0
- package/dist/qe-signature.d.ts +25 -0
- package/dist/qe-signature.esm.js +8 -0
- package/dist/recordingService-Ig2UgbLv.esm.js +1003 -0
- package/dist/redirect-to-mobile.d.ts +107 -0
- package/dist/redirect-to-mobile.esm.js +102 -0
- package/dist/redirectToMobileStateMachine-BOEqe46A.esm.js +249 -0
- package/dist/runChildModule-CqqwqAkW.esm.js +219 -0
- package/dist/selfie.d.ts +26 -0
- package/dist/selfie.esm.js +146 -0
- package/dist/selfieManager-D0lSgd-J.d.ts +68 -0
- package/dist/selfieManager-Duisl7qN.esm.js +60 -0
- package/dist/selfieStateMachine-D76whWEf.esm.js +68 -0
- package/dist/session-CGtQJJzB.esm.js +3206 -0
- package/dist/session.d.ts +217 -0
- package/dist/session.esm.js +9 -0
- package/dist/setup-C5AITV8m.d.ts +254 -0
- package/dist/setup-DsM8IG7k.esm.js +887 -0
- package/dist/signature.d.ts +94 -0
- package/dist/signature.esm.js +66 -0
- package/dist/signatureStateMachine-B5-QVUve.esm.js +132 -0
- package/dist/stats-CIfiPzb1.esm.js +16 -0
- package/dist/stats.d.ts +16 -0
- package/dist/stats.esm.js +4 -0
- package/dist/trust-graph.d.ts +54 -0
- package/dist/trust-graph.esm.js +56 -0
- package/dist/types-B06Ypu2F.d.ts +49 -0
- package/dist/types-BP1m8VRw.d.ts +340 -0
- package/dist/types-CAD4va6a.d.ts +5 -0
- package/dist/types-CFV9G_7j.d.ts +24 -0
- package/dist/warmup-CEcppFiS.d.ts +63 -0
- package/dist/wasm.d.ts +15 -0
- package/dist/wasm.esm.js +12 -0
- package/dist/watchlist-for-business.d.ts +79 -0
- package/dist/watchlist-for-business.esm.js +148 -0
- package/dist/watchlist.d.ts +62 -0
- package/dist/watchlist.esm.js +86 -0
- package/dist/watchlistServices-DMbUhkBX.esm.js +12 -0
- package/dist/workflow.d.ts +907 -0
- package/dist/workflow.esm.js +702 -0
- package/dist/xstate.esm-B70JrNqo.esm.js +3404 -0
- package/package.json +1 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import "./BrowserTimerProvider-DhNc_x02.esm.js";
|
|
2
|
+
import "./api-CESGtpbH.esm.js";
|
|
3
|
+
import { o as createManagerInstrumentation } from "./events-D6-e4vok.esm.js";
|
|
4
|
+
import "./endpoints-CnN3SyDa.esm.js";
|
|
5
|
+
import { c as createManager, s as createActor } from "./xstate.esm-B70JrNqo.esm.js";
|
|
6
|
+
import { t as governmentValidationMachine } from "./governmentValidationStateMachine-BDDYrJTo.esm.js";
|
|
7
|
+
|
|
8
|
+
//#region src/modules/government-validation/governmentValidationActor.ts
|
|
9
|
+
function createGovernmentValidationActor(options) {
|
|
10
|
+
return createActor(governmentValidationMachine, { input: { config: options.config } }).start();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/modules/government-validation/governmentValidationManager.ts
|
|
15
|
+
function mapState(snapshot) {
|
|
16
|
+
const typedSnapshot = snapshot;
|
|
17
|
+
const { context } = typedSnapshot;
|
|
18
|
+
if (typedSnapshot.matches("idle")) return { status: "idle" };
|
|
19
|
+
if (typedSnapshot.matches("loading")) return { status: "loading" };
|
|
20
|
+
if (typedSnapshot.matches("polling") || typedSnapshot.matches("pollingRequest")) return { status: "processing" };
|
|
21
|
+
if (typedSnapshot.matches("awaitingOtp")) return {
|
|
22
|
+
status: "awaitingOtp",
|
|
23
|
+
resendTimer: context.resendTimer,
|
|
24
|
+
canResend: !context.resendTimerActive,
|
|
25
|
+
attemptsRemaining: context.attemptsRemaining,
|
|
26
|
+
otpError: context.otpError
|
|
27
|
+
};
|
|
28
|
+
if (typedSnapshot.matches("verifyingOtp")) return { status: "verifyingOtp" };
|
|
29
|
+
if (typedSnapshot.matches("displaySuccess")) return { status: "finished" };
|
|
30
|
+
if (typedSnapshot.matches("displayProcessing")) return { status: "processing" };
|
|
31
|
+
if (typedSnapshot.matches("finished")) return { status: "finished" };
|
|
32
|
+
if (typedSnapshot.matches("displayError")) return {
|
|
33
|
+
status: "error",
|
|
34
|
+
error: context.error ?? "An error occurred"
|
|
35
|
+
};
|
|
36
|
+
if (typedSnapshot.matches("displayUnknown")) return {
|
|
37
|
+
status: "unknown",
|
|
38
|
+
error: context.error ?? "Unknown validation status"
|
|
39
|
+
};
|
|
40
|
+
return { status: "idle" };
|
|
41
|
+
}
|
|
42
|
+
function createApi({ actor, trackElementClicked }) {
|
|
43
|
+
return {
|
|
44
|
+
load() {
|
|
45
|
+
actor.send({ type: "LOAD" });
|
|
46
|
+
},
|
|
47
|
+
setOtpCode(code) {
|
|
48
|
+
actor.send({
|
|
49
|
+
type: "OTP_CHANGED",
|
|
50
|
+
code
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
submitOtp(code) {
|
|
54
|
+
trackElementClicked?.("submitOtp");
|
|
55
|
+
actor.send({
|
|
56
|
+
type: "OTP_CHANGED",
|
|
57
|
+
code
|
|
58
|
+
});
|
|
59
|
+
actor.send({ type: "SUBMIT_OTP" });
|
|
60
|
+
},
|
|
61
|
+
resendOtp() {
|
|
62
|
+
trackElementClicked?.("resendOtp");
|
|
63
|
+
actor.send({ type: "RESEND_OTP" });
|
|
64
|
+
},
|
|
65
|
+
retry() {
|
|
66
|
+
trackElementClicked?.("retry");
|
|
67
|
+
actor.send({ type: "RETRY" });
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function createGovernmentValidationManager(options) {
|
|
72
|
+
return createManager({
|
|
73
|
+
actor: createGovernmentValidationActor(options),
|
|
74
|
+
mapState,
|
|
75
|
+
createApi,
|
|
76
|
+
instrumentation: createManagerInstrumentation("GOVERNMENT_VALIDATION")
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
export { createGovernmentValidationManager, governmentValidationMachine };
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { t as BrowserTimerProvider } from "./BrowserTimerProvider-DhNc_x02.esm.js";
|
|
2
|
+
import { t as api } from "./api-CESGtpbH.esm.js";
|
|
3
|
+
import { t as endpoints } from "./endpoints-CnN3SyDa.esm.js";
|
|
4
|
+
import { a as fromPromise, i as fromCallback, r as assign, t as setup } from "./xstate.esm-B70JrNqo.esm.js";
|
|
5
|
+
|
|
6
|
+
//#region src/modules/government-validation/governmentValidationServices.ts
|
|
7
|
+
async function processGovernmentValidation(signal) {
|
|
8
|
+
const res = await api.post(endpoints.governmentValidation, {}, { signal });
|
|
9
|
+
if (!res.ok) throw new Error(`POST ${endpoints.governmentValidation} failed: ${res.status} ${res.statusText}`);
|
|
10
|
+
return res.data;
|
|
11
|
+
}
|
|
12
|
+
async function submitGovernmentValidationOtp(params, signal) {
|
|
13
|
+
const res = await api.post(endpoints.governmentValidation, { otpCode: params.code }, { signal });
|
|
14
|
+
if (!res.ok) throw new Error(`POST ${endpoints.governmentValidation} (OTP) failed: ${res.status} ${res.statusText}`);
|
|
15
|
+
return res.data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/modules/government-validation/governmentValidationStateMachine.ts
|
|
20
|
+
const RESEND_TIMER_SECONDS = 30;
|
|
21
|
+
const POLL_INTERVAL_MS = 2e3;
|
|
22
|
+
const MAX_POLL_COUNT = 60;
|
|
23
|
+
const AUTO_PROCEED_DELAY_MS = 3e3;
|
|
24
|
+
const governmentValidationMachine = setup({
|
|
25
|
+
types: {
|
|
26
|
+
context: {},
|
|
27
|
+
events: {},
|
|
28
|
+
input: {}
|
|
29
|
+
},
|
|
30
|
+
delays: { AUTO_PROCEED: AUTO_PROCEED_DELAY_MS },
|
|
31
|
+
actors: {
|
|
32
|
+
processValidation: fromPromise(async ({ signal }) => {
|
|
33
|
+
return processGovernmentValidation(signal);
|
|
34
|
+
}),
|
|
35
|
+
submitOtp: fromPromise(async ({ input, signal }) => {
|
|
36
|
+
return submitGovernmentValidationOtp({ code: input.code }, signal);
|
|
37
|
+
}),
|
|
38
|
+
pollingTimer: fromCallback(({ sendBack }) => {
|
|
39
|
+
const timer = BrowserTimerProvider.getInstance();
|
|
40
|
+
const interval = timer.setInterval(() => {
|
|
41
|
+
sendBack({ type: "POLL" });
|
|
42
|
+
}, POLL_INTERVAL_MS);
|
|
43
|
+
return () => timer.clearInterval(interval);
|
|
44
|
+
}),
|
|
45
|
+
resendTimer: fromCallback(({ sendBack }) => {
|
|
46
|
+
const timer = BrowserTimerProvider.getInstance();
|
|
47
|
+
let seconds = RESEND_TIMER_SECONDS;
|
|
48
|
+
const interval = timer.setInterval(() => {
|
|
49
|
+
seconds -= 1;
|
|
50
|
+
sendBack({ type: "TICK" });
|
|
51
|
+
if (seconds <= 0) timer.clearInterval(interval);
|
|
52
|
+
}, 1e3);
|
|
53
|
+
return () => timer.clearInterval(interval);
|
|
54
|
+
})
|
|
55
|
+
},
|
|
56
|
+
actions: {
|
|
57
|
+
setError: assign(({ event }) => ({ error: String(event.error) })),
|
|
58
|
+
setErrorFromResponse: assign({ error: () => "Government validation failed" }),
|
|
59
|
+
setUnknownError: assign({ error: () => "Unknown validation status" }),
|
|
60
|
+
clearError: assign({ error: () => void 0 }),
|
|
61
|
+
setOtpCode: assign(({ event }) => ({
|
|
62
|
+
otpCode: event.code,
|
|
63
|
+
otpError: void 0
|
|
64
|
+
})),
|
|
65
|
+
setOtpError: assign(({ context }) => ({
|
|
66
|
+
otpError: "Invalid OTP code",
|
|
67
|
+
attemptsRemaining: context.attemptsRemaining - 1
|
|
68
|
+
})),
|
|
69
|
+
clearOtpError: assign({
|
|
70
|
+
otpError: () => void 0,
|
|
71
|
+
otpCode: () => ""
|
|
72
|
+
}),
|
|
73
|
+
startResendTimer: assign({
|
|
74
|
+
resendTimer: () => RESEND_TIMER_SECONDS,
|
|
75
|
+
resendTimerActive: () => true
|
|
76
|
+
}),
|
|
77
|
+
tickResendTimer: assign(({ context }) => {
|
|
78
|
+
const newTimer = Math.max(0, context.resendTimer - 1);
|
|
79
|
+
return {
|
|
80
|
+
resendTimer: newTimer,
|
|
81
|
+
resendTimerActive: newTimer > 0
|
|
82
|
+
};
|
|
83
|
+
}),
|
|
84
|
+
incrementPollCount: assign(({ context }) => ({ pollCount: context.pollCount + 1 })),
|
|
85
|
+
resetPollCount: assign({ pollCount: () => 0 }),
|
|
86
|
+
resetContext: assign(({ context }) => ({
|
|
87
|
+
config: context.config,
|
|
88
|
+
error: void 0,
|
|
89
|
+
otpCode: "",
|
|
90
|
+
otpError: void 0,
|
|
91
|
+
attemptsRemaining: context.config.maxOtpAttempts ?? 3,
|
|
92
|
+
resendTimer: 0,
|
|
93
|
+
resendTimerActive: false,
|
|
94
|
+
pollCount: 0
|
|
95
|
+
}))
|
|
96
|
+
},
|
|
97
|
+
guards: {
|
|
98
|
+
isProcessing: (_, params) => params.response.statusCode === -1,
|
|
99
|
+
isSuccess: (_, params) => params.response.statusCode === 0 && params.response.validationStatus?.status !== "UNKNOWN",
|
|
100
|
+
isError: (_, params) => params.response.statusCode > 0,
|
|
101
|
+
isOtpRequested: (_, params) => params.response.otpResponse?.authBridge?.otpCodeRequested === true,
|
|
102
|
+
isUnknown: (_, params) => params.response.validationStatus?.status === "UNKNOWN",
|
|
103
|
+
hasAttemptsRemaining: ({ context }) => context.attemptsRemaining > 0,
|
|
104
|
+
canResend: ({ context }) => !context.resendTimerActive,
|
|
105
|
+
hasReachedMaxPolls: ({ context }) => context.pollCount >= MAX_POLL_COUNT
|
|
106
|
+
}
|
|
107
|
+
}).createMachine({
|
|
108
|
+
id: "governmentValidation",
|
|
109
|
+
initial: "idle",
|
|
110
|
+
context: ({ input }) => ({
|
|
111
|
+
config: input.config,
|
|
112
|
+
error: void 0,
|
|
113
|
+
otpCode: "",
|
|
114
|
+
otpError: void 0,
|
|
115
|
+
attemptsRemaining: input.config.maxOtpAttempts ?? 3,
|
|
116
|
+
resendTimer: 0,
|
|
117
|
+
resendTimerActive: false,
|
|
118
|
+
pollCount: 0
|
|
119
|
+
}),
|
|
120
|
+
states: {
|
|
121
|
+
idle: { on: { LOAD: { target: "loading" } } },
|
|
122
|
+
loading: { invoke: {
|
|
123
|
+
id: "processValidation",
|
|
124
|
+
src: "processValidation",
|
|
125
|
+
onDone: [
|
|
126
|
+
{
|
|
127
|
+
target: "awaitingOtp",
|
|
128
|
+
guard: {
|
|
129
|
+
type: "isOtpRequested",
|
|
130
|
+
params: ({ event }) => ({ response: event.output })
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
target: "displaySuccess",
|
|
135
|
+
guard: {
|
|
136
|
+
type: "isSuccess",
|
|
137
|
+
params: ({ event }) => ({ response: event.output })
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
target: "polling",
|
|
142
|
+
guard: {
|
|
143
|
+
type: "isProcessing",
|
|
144
|
+
params: ({ event }) => ({ response: event.output })
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
target: "displayUnknown",
|
|
149
|
+
guard: {
|
|
150
|
+
type: "isUnknown",
|
|
151
|
+
params: ({ event }) => ({ response: event.output })
|
|
152
|
+
},
|
|
153
|
+
actions: "setUnknownError"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
target: "displayError",
|
|
157
|
+
actions: "setErrorFromResponse"
|
|
158
|
+
}
|
|
159
|
+
],
|
|
160
|
+
onError: {
|
|
161
|
+
target: "displayError",
|
|
162
|
+
actions: "setError"
|
|
163
|
+
}
|
|
164
|
+
} },
|
|
165
|
+
polling: {
|
|
166
|
+
invoke: {
|
|
167
|
+
id: "pollingTimer",
|
|
168
|
+
src: "pollingTimer"
|
|
169
|
+
},
|
|
170
|
+
on: { POLL: [{
|
|
171
|
+
target: "displayError",
|
|
172
|
+
guard: "hasReachedMaxPolls",
|
|
173
|
+
actions: assign({ error: () => "Validation timed out" })
|
|
174
|
+
}, {
|
|
175
|
+
target: "pollingRequest",
|
|
176
|
+
actions: "incrementPollCount"
|
|
177
|
+
}] }
|
|
178
|
+
},
|
|
179
|
+
pollingRequest: { invoke: {
|
|
180
|
+
id: "pollValidation",
|
|
181
|
+
src: "processValidation",
|
|
182
|
+
onDone: [
|
|
183
|
+
{
|
|
184
|
+
target: "displaySuccess",
|
|
185
|
+
guard: {
|
|
186
|
+
type: "isSuccess",
|
|
187
|
+
params: ({ event }) => ({ response: event.output })
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
target: "polling",
|
|
192
|
+
guard: {
|
|
193
|
+
type: "isProcessing",
|
|
194
|
+
params: ({ event }) => ({ response: event.output })
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
target: "displayUnknown",
|
|
199
|
+
guard: {
|
|
200
|
+
type: "isUnknown",
|
|
201
|
+
params: ({ event }) => ({ response: event.output })
|
|
202
|
+
},
|
|
203
|
+
actions: "setUnknownError"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
target: "displayError",
|
|
207
|
+
actions: "setErrorFromResponse"
|
|
208
|
+
}
|
|
209
|
+
],
|
|
210
|
+
onError: {
|
|
211
|
+
target: "displayError",
|
|
212
|
+
actions: "setError"
|
|
213
|
+
}
|
|
214
|
+
} },
|
|
215
|
+
awaitingOtp: {
|
|
216
|
+
entry: "startResendTimer",
|
|
217
|
+
invoke: {
|
|
218
|
+
id: "resendTimer",
|
|
219
|
+
src: "resendTimer"
|
|
220
|
+
},
|
|
221
|
+
on: {
|
|
222
|
+
TICK: { actions: "tickResendTimer" },
|
|
223
|
+
OTP_CHANGED: { actions: "setOtpCode" },
|
|
224
|
+
SUBMIT_OTP: { target: "verifyingOtp" },
|
|
225
|
+
RESEND_OTP: {
|
|
226
|
+
target: "loading",
|
|
227
|
+
guard: "canResend"
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
verifyingOtp: { invoke: {
|
|
232
|
+
id: "submitOtp",
|
|
233
|
+
src: "submitOtp",
|
|
234
|
+
input: ({ context }) => ({ code: context.otpCode }),
|
|
235
|
+
onDone: [
|
|
236
|
+
{
|
|
237
|
+
target: "displaySuccess",
|
|
238
|
+
guard: {
|
|
239
|
+
type: "isSuccess",
|
|
240
|
+
params: ({ event }) => ({ response: event.output })
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
target: "awaitingOtp",
|
|
245
|
+
guard: "hasAttemptsRemaining",
|
|
246
|
+
actions: "setOtpError"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
target: "displayError",
|
|
250
|
+
actions: assign({ error: () => "Maximum OTP attempts exceeded" })
|
|
251
|
+
}
|
|
252
|
+
],
|
|
253
|
+
onError: [{
|
|
254
|
+
target: "awaitingOtp",
|
|
255
|
+
guard: "hasAttemptsRemaining",
|
|
256
|
+
actions: "setOtpError"
|
|
257
|
+
}, {
|
|
258
|
+
target: "displayError",
|
|
259
|
+
actions: "setError"
|
|
260
|
+
}]
|
|
261
|
+
} },
|
|
262
|
+
displaySuccess: { after: { AUTO_PROCEED: { target: "finished" } } },
|
|
263
|
+
displayProcessing: { after: { AUTO_PROCEED: { target: "finished" } } },
|
|
264
|
+
displayError: { after: { AUTO_PROCEED: { target: "finished" } } },
|
|
265
|
+
displayUnknown: { after: { AUTO_PROCEED: { target: "finished" } } },
|
|
266
|
+
finished: { type: "final" }
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
//#endregion
|
|
271
|
+
export { governmentValidationMachine as t };
|
package/dist/home.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { t as Manager } from "./Manager-C8PrhBOx.js";
|
|
2
|
+
import "./camera-DBSxa6ML.js";
|
|
3
|
+
import "./types-CFV9G_7j.js";
|
|
4
|
+
import { t as EmptyConfig } from "./types-BP1m8VRw.js";
|
|
5
|
+
import * as xstate634 from "xstate";
|
|
6
|
+
|
|
7
|
+
//#region src/modules/home/types.d.ts
|
|
8
|
+
type HomeConfig = EmptyConfig;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/modules/home/homeManager.d.ts
|
|
11
|
+
type HomeIdleState = {
|
|
12
|
+
status: 'idle';
|
|
13
|
+
};
|
|
14
|
+
type HomeMainState = {
|
|
15
|
+
status: 'main';
|
|
16
|
+
};
|
|
17
|
+
type HomeFinishedState = {
|
|
18
|
+
status: 'finished';
|
|
19
|
+
};
|
|
20
|
+
type HomeState = HomeIdleState | HomeMainState | HomeFinishedState;
|
|
21
|
+
declare function createHomeManager(options?: {
|
|
22
|
+
config?: HomeConfig;
|
|
23
|
+
}): Manager<HomeState> & {
|
|
24
|
+
load(): void;
|
|
25
|
+
complete(): void;
|
|
26
|
+
reset(): void;
|
|
27
|
+
};
|
|
28
|
+
type HomeManager = ReturnType<typeof createHomeManager>;
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/modules/home/homeStateMachine.d.ts
|
|
31
|
+
type HomeContext = {
|
|
32
|
+
config: EmptyConfig;
|
|
33
|
+
};
|
|
34
|
+
type HomeInput = {
|
|
35
|
+
config: EmptyConfig;
|
|
36
|
+
};
|
|
37
|
+
declare const homeMachine: xstate634.StateMachine<HomeContext, {
|
|
38
|
+
type: "LOAD";
|
|
39
|
+
} | {
|
|
40
|
+
type: "COMPLETE";
|
|
41
|
+
} | {
|
|
42
|
+
type: "RESET";
|
|
43
|
+
}, {}, never, never, never, never, "idle" | "finished" | "main", string, HomeInput, xstate634.NonReducibleUnknown, xstate634.EventObject, xstate634.MetaObject, {
|
|
44
|
+
readonly id: "home";
|
|
45
|
+
readonly initial: "idle";
|
|
46
|
+
readonly context: ({
|
|
47
|
+
input
|
|
48
|
+
}: {
|
|
49
|
+
spawn: {
|
|
50
|
+
<TSrc extends never>(logic: TSrc, ...[options]: never): xstate634.ActorRefFromLogic<never>;
|
|
51
|
+
<TLogic extends xstate634.AnyActorLogic>(src: TLogic, ...[options]: xstate634.ConditionalRequired<[options?: ({
|
|
52
|
+
id?: never;
|
|
53
|
+
systemId?: string;
|
|
54
|
+
input?: xstate634.InputFrom<TLogic> | undefined;
|
|
55
|
+
syncSnapshot?: boolean;
|
|
56
|
+
} & { [K in xstate634.RequiredLogicInput<TLogic>]: unknown }) | undefined], xstate634.IsNotNever<xstate634.RequiredLogicInput<TLogic>>>): xstate634.ActorRefFromLogic<TLogic>;
|
|
57
|
+
};
|
|
58
|
+
input: HomeInput;
|
|
59
|
+
self: xstate634.ActorRef<xstate634.MachineSnapshot<HomeContext, {
|
|
60
|
+
type: "LOAD";
|
|
61
|
+
} | {
|
|
62
|
+
type: "COMPLETE";
|
|
63
|
+
} | {
|
|
64
|
+
type: "RESET";
|
|
65
|
+
}, Record<string, xstate634.AnyActorRef | undefined>, xstate634.StateValue, string, unknown, any, any>, {
|
|
66
|
+
type: "LOAD";
|
|
67
|
+
} | {
|
|
68
|
+
type: "COMPLETE";
|
|
69
|
+
} | {
|
|
70
|
+
type: "RESET";
|
|
71
|
+
}, xstate634.AnyEventObject>;
|
|
72
|
+
}) => {
|
|
73
|
+
config: EmptyConfig;
|
|
74
|
+
};
|
|
75
|
+
readonly states: {
|
|
76
|
+
readonly idle: {
|
|
77
|
+
readonly on: {
|
|
78
|
+
readonly LOAD: {
|
|
79
|
+
readonly target: "main";
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
readonly main: {
|
|
84
|
+
readonly on: {
|
|
85
|
+
readonly COMPLETE: {
|
|
86
|
+
readonly target: "finished";
|
|
87
|
+
};
|
|
88
|
+
readonly RESET: {
|
|
89
|
+
readonly target: "idle";
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
readonly finished: {
|
|
94
|
+
readonly type: "final";
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
}>;
|
|
98
|
+
//#endregion
|
|
99
|
+
export { type HomeConfig, type HomeManager, type HomeState, createHomeManager, homeMachine };
|
package/dist/home.esm.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import "./api-CESGtpbH.esm.js";
|
|
2
|
+
import { o as createManagerInstrumentation } from "./events-D6-e4vok.esm.js";
|
|
3
|
+
import { c as createManager, s as createActor, t as setup } from "./xstate.esm-B70JrNqo.esm.js";
|
|
4
|
+
|
|
5
|
+
//#region src/modules/home/homeStateMachine.ts
|
|
6
|
+
const homeMachine = setup({ types: {
|
|
7
|
+
context: {},
|
|
8
|
+
events: {},
|
|
9
|
+
input: {}
|
|
10
|
+
} }).createMachine({
|
|
11
|
+
id: "home",
|
|
12
|
+
initial: "idle",
|
|
13
|
+
context: ({ input }) => ({ config: input.config }),
|
|
14
|
+
states: {
|
|
15
|
+
idle: { on: { LOAD: { target: "main" } } },
|
|
16
|
+
main: { on: {
|
|
17
|
+
COMPLETE: { target: "finished" },
|
|
18
|
+
RESET: { target: "idle" }
|
|
19
|
+
} },
|
|
20
|
+
finished: { type: "final" }
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/modules/home/homeActor.ts
|
|
26
|
+
function createHomeActor(options = {}) {
|
|
27
|
+
return createActor(homeMachine, { input: { config: options.config ?? {} } }).start();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/modules/home/homeManager.ts
|
|
32
|
+
function mapState(snapshot) {
|
|
33
|
+
const typedSnapshot = snapshot;
|
|
34
|
+
if (typedSnapshot.matches("main")) return { status: "main" };
|
|
35
|
+
if (typedSnapshot.matches("finished")) return { status: "finished" };
|
|
36
|
+
return { status: "idle" };
|
|
37
|
+
}
|
|
38
|
+
function createApi({ actor }) {
|
|
39
|
+
return {
|
|
40
|
+
load() {
|
|
41
|
+
actor.send({ type: "LOAD" });
|
|
42
|
+
},
|
|
43
|
+
complete() {
|
|
44
|
+
actor.send({ type: "COMPLETE" });
|
|
45
|
+
},
|
|
46
|
+
reset() {
|
|
47
|
+
actor.send({ type: "RESET" });
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function createHomeManager(options = {}) {
|
|
52
|
+
return createManager({
|
|
53
|
+
actor: createHomeActor({ config: options.config }),
|
|
54
|
+
mapState,
|
|
55
|
+
createApi,
|
|
56
|
+
instrumentation: createManagerInstrumentation("HOME")
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
export { createHomeManager, homeMachine };
|
package/dist/http.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//#region ../infra/src/http/types.d.ts
|
|
2
|
+
|
|
3
|
+
type RequestConfig = {
|
|
4
|
+
method?: string;
|
|
5
|
+
url: string;
|
|
6
|
+
headers?: Record<string, string>;
|
|
7
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
8
|
+
params?: Record<string, string | number | boolean | undefined>;
|
|
9
|
+
body?: unknown;
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
timeout?: number;
|
|
12
|
+
parse?: 'json' | 'text' | 'blob' | 'arrayBuffer' | 'response';
|
|
13
|
+
onUploadProgress?: (progress: number) => void;
|
|
14
|
+
keepalive?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Transport-internal flag: the request body has already been inline-
|
|
17
|
+
* encrypted by C++ `SessionEncryptor` (used only by the on-device face-
|
|
18
|
+
* results path). When true, `createWasmApi` attaches the SHA-256 OAEP
|
|
19
|
+
* scheme header so the server can unwrap the embedded AES key, and
|
|
20
|
+
* forwards the flag to the WASM WebClient so it does not double-encrypt.
|
|
21
|
+
* Ignored by non-WASM transports.
|
|
22
|
+
*/
|
|
23
|
+
ie?: boolean;
|
|
24
|
+
};
|
|
25
|
+
type HttpResponse<T = unknown> = {
|
|
26
|
+
ok: boolean;
|
|
27
|
+
status: number;
|
|
28
|
+
statusText: string;
|
|
29
|
+
url: string;
|
|
30
|
+
headers: Record<string, string>;
|
|
31
|
+
data: T;
|
|
32
|
+
};
|
|
33
|
+
type HttpClient = {
|
|
34
|
+
defaults: {
|
|
35
|
+
baseURL: string;
|
|
36
|
+
headers: Record<string, string>;
|
|
37
|
+
};
|
|
38
|
+
request<T = unknown>(config: RequestConfig): Promise<HttpResponse<T>>;
|
|
39
|
+
get<T = unknown>(url: string, config?: Omit<RequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
|
|
40
|
+
post<T = unknown>(url: string, body?: unknown, config?: Omit<RequestConfig, 'method' | 'url' | 'body'>): Promise<HttpResponse<T>>;
|
|
41
|
+
put<T = unknown>(url: string, body?: unknown, config?: Omit<RequestConfig, 'method' | 'url' | 'body'>): Promise<HttpResponse<T>>;
|
|
42
|
+
patch<T = unknown>(url: string, body?: unknown, config?: Omit<RequestConfig, 'method' | 'url' | 'body'>): Promise<HttpResponse<T>>;
|
|
43
|
+
delete<T = unknown>(url: string, config?: Omit<RequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
|
|
44
|
+
head<T = unknown>(url: string, config?: Omit<RequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
|
|
45
|
+
options<T = unknown>(url: string, config?: Omit<RequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
|
|
46
|
+
setHeader(name: string, value: string): void;
|
|
47
|
+
};
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/internal/http/api.d.ts
|
|
50
|
+
type MethodConfig = {
|
|
51
|
+
headers?: Record<string, string>;
|
|
52
|
+
signal?: AbortSignal;
|
|
53
|
+
timeout?: number;
|
|
54
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
55
|
+
onUploadProgress?: (progress: number) => void;
|
|
56
|
+
keepalive?: boolean;
|
|
57
|
+
};
|
|
58
|
+
type ApiClient = {
|
|
59
|
+
get<T>(url: string, config?: MethodConfig): Promise<HttpResponse<T>>;
|
|
60
|
+
post<T>(url: string, data?: unknown, config?: MethodConfig): Promise<HttpResponse<T>>;
|
|
61
|
+
put<T>(url: string, data?: unknown, config?: MethodConfig): Promise<HttpResponse<T>>;
|
|
62
|
+
patch<T>(url: string, data?: unknown, config?: MethodConfig): Promise<HttpResponse<T>>;
|
|
63
|
+
delete<T>(url: string, config?: MethodConfig): Promise<HttpResponse<T>>;
|
|
64
|
+
};
|
|
65
|
+
declare function getApi(): HttpClient;
|
|
66
|
+
declare const api: ApiClient;
|
|
67
|
+
//#endregion
|
|
68
|
+
export { api, getApi };
|
package/dist/http.esm.js
ADDED