@incodetech/core 0.0.0-dev-20260409-a38d5e8 → 0.0.0-dev-20260409-09dfd52
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-CXaS5Ooj.esm.js +55 -0
- package/dist/{OpenViduRecordingProvider-Bn2meybK.esm.js → OpenViduRecordingProvider-D_cVAwYQ.esm.js} +1 -1
- package/dist/{WasmUtilProvider-BpZSvZbg.esm.js → WasmUtilProvider-mWSXzp7b.esm.js} +1 -1
- package/dist/{addressSearch-DOFI7lwy.esm.js → addressSearch-C26OZIx0.esm.js} +4 -4
- package/dist/antifraud.d.ts +1 -1
- package/dist/antifraud.esm.js +4 -37
- package/dist/antifraudStateMachine-B74mO8vr.esm.js +39 -0
- package/dist/authentication.d.ts +11 -11
- package/dist/authentication.esm.js +22 -19
- package/dist/authenticationManager-BBQHippG.esm.js +67 -0
- package/dist/{authenticationManager-C2mk36yK.d.ts → authenticationManager-DOTo1EYF.d.ts} +2 -2
- package/dist/{authenticationManager-C7dL_avf.esm.js → authenticationStateMachine-DCJ0ArAt.esm.js} +7 -67
- package/dist/{backCameraStream-tabTmwDS.esm.js → backCameraStream-D9g2wyil.esm.js} +3 -3
- package/dist/camera.d.ts +1 -1
- package/dist/camera.esm.js +3 -3
- package/dist/consent.d.ts +55 -55
- package/dist/consent.esm.js +4 -149
- package/dist/consentStateMachine-DIdJXJW0.esm.js +151 -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 +5 -5
- package/dist/curp-validation.esm.js +4 -417
- package/dist/curpValidationStateMachine-Dp5WB6__.esm.js +419 -0
- package/dist/{deepsightLoader-Cj6SyUQ-.esm.js → deepsightLoader-CaULV07H.esm.js} +10 -10
- package/dist/{deepsightService-ByD6uIs7.d.ts → deepsightService-S-tU77m-.d.ts} +2 -2
- package/dist/{deepsightService-BjgXl5hs.esm.js → deepsightService-rPGLH8Xp.esm.js} +5 -5
- package/dist/device.esm.js +3 -3
- package/dist/document-capture.d.ts +80 -78
- package/dist/document-capture.esm.js +8 -403
- package/dist/document-upload.d.ts +53 -53
- package/dist/document-upload.esm.js +7 -7
- package/dist/documentCaptureStateMachine-ByYOCKz5.esm.js +403 -0
- package/dist/ekyb.d.ts +3 -3
- package/dist/ekyb.esm.js +10 -655
- package/dist/ekybStateMachine-DRku_YmR.esm.js +653 -0
- package/dist/ekyc.d.ts +3 -3
- package/dist/ekyc.esm.js +6 -10614
- package/dist/ekycStateMachine-CSWaaWVl.esm.js +10615 -0
- package/dist/email.d.ts +3 -3
- package/dist/email.esm.js +6 -5
- package/dist/{emailManager-CU_hzrsl.d.ts → emailManager-D6CHM2QO.d.ts} +4 -3
- package/dist/emailManager-DByjyeY8.esm.js +238 -0
- package/dist/{emailManager-_9R4vm6g.esm.js → emailStateMachine-BoIkeCw5.esm.js} +6 -239
- package/dist/{events-DlHrOIRc.esm.js → events-W91zLpx4.esm.js} +5 -1
- package/dist/events.esm.js +2 -2
- package/dist/extensibility.d.ts +15 -15
- package/dist/extensibility.esm.js +33 -26
- package/dist/face-match.d.ts +7 -6
- package/dist/face-match.esm.js +8 -129
- package/dist/faceCaptureManagerFactory-Bspg2Tyf.esm.js +117 -0
- package/dist/{faceCaptureManagerFactory-Da_-ohdg.d.ts → faceCaptureManagerFactory-P2yy30KU.d.ts} +8 -8
- package/dist/{faceCaptureSetup-CaVWkjvE.esm.js → faceCaptureSetup-CQevz86q.esm.js} +5 -119
- package/dist/faceMatchStateMachine-CLterVEC.esm.js +127 -0
- package/dist/flow.d.ts +8 -13
- package/dist/flow.esm.js +10 -29
- package/dist/{flowCompletionService-B5JemmC6.esm.js → flowCompletionService-DZSDUXus.esm.js} +2 -2
- package/dist/{flowServices-p22wrYPf.esm.js → flowServices-YATk0fgY.esm.js} +3 -3
- package/dist/geolocation.d.ts +7 -6
- package/dist/geolocation.esm.js +7 -105
- package/dist/geolocationStateMachine-CRRUCl9K.esm.js +105 -0
- package/dist/{getDeviceClass-DEzz4cmY.esm.js → getDeviceClass-DBF-ExLR.esm.js} +1 -1
- package/dist/government-validation.d.ts +2 -2
- package/dist/government-validation.esm.js +5 -269
- package/dist/governmentValidationStateMachine-C_iPX9VE.esm.js +271 -0
- package/dist/http.esm.js +1 -1
- package/dist/id.d.ts +10 -10
- package/dist/id.esm.js +22 -20
- package/dist/idCaptureManager-CJfatzuY.esm.js +335 -0
- package/dist/{idCaptureManager-CV08v1e3.d.ts → idCaptureManager-CbZvdr9y.d.ts} +7 -7
- package/dist/{idCaptureManager-dyZzKv8L.esm.js → idCaptureStateMachine-gf-Q9piu.esm.js} +17 -346
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +8 -8
- package/dist/{lib-Bavz2qmt.esm.js → lib-BzVJ-zxG.esm.js} +1 -1
- package/dist/mandatory-consent.d.ts +55 -55
- package/dist/mandatory-consent.esm.js +4 -124
- package/dist/mandatoryConsentStateMachine-BZNBJ1fK.esm.js +126 -0
- package/dist/{openviduLazy-vhrVZCr_.esm.js → openviduLazy-CLg_-u0m.esm.js} +2 -2
- package/dist/openviduLazy-rFXBtZVZ.esm.js +3 -0
- package/dist/{permissionServices-Cskq32Yd.esm.js → permissionServices-Cisv73eQ.esm.js} +2 -2
- package/dist/phone.d.ts +3 -3
- package/dist/phone.esm.js +6 -5
- package/dist/phoneManager-DhC4obPF.esm.js +258 -0
- package/dist/{phoneManager-ulJuGvJ8.d.ts → phoneManager-Zwr-qCnC.d.ts} +2 -2
- package/dist/{phoneManager-DerdUfd4.esm.js → phoneStateMachine-Cc_w4tC0.esm.js} +5 -258
- package/dist/{recordingService-483wQ6kR.esm.js → recordingService-CCfxUY7-.esm.js} +14 -68
- package/dist/redirect-to-mobile.d.ts +2 -2
- package/dist/redirect-to-mobile.esm.js +5 -247
- package/dist/redirectToMobileStateMachine-vOe27Ufw.esm.js +249 -0
- package/dist/runChildModule-DVC4JEjp.esm.js +27 -0
- package/dist/selfie.d.ts +11 -11
- package/dist/selfie.esm.js +22 -19
- package/dist/selfieManager-CorEST5h.esm.js +60 -0
- package/dist/{selfieManager-DCRP7X75.d.ts → selfieManager-DNwfxieF.d.ts} +2 -2
- package/dist/selfieStateMachine-3b19ON1z.esm.js +56 -0
- package/dist/{session-CUh77zj3.esm.js → session-B_rKSRql.esm.js} +4 -4
- package/dist/session.d.ts +1 -1
- package/dist/session.esm.js +6 -6
- package/dist/{setup-DpHakxsC.d.ts → setup-BYqwVLiv.d.ts} +1 -1
- package/dist/{setup-XpxfZgKn.esm.js → setup-DLvhsDol.esm.js} +6 -5
- package/dist/signature.d.ts +4 -3
- package/dist/signature.esm.js +6 -189
- package/dist/signatureStateMachine-CU92zCXU.esm.js +189 -0
- package/dist/{stats-DHDoqSBV.esm.js → stats-gFD2351t.esm.js} +1 -1
- package/dist/stats.esm.js +2 -2
- package/dist/{types-2OPf1pyv.d.ts → types-CYJ0Ish6.d.ts} +1 -1
- package/dist/types-CjsEZRcz.d.ts +35 -0
- package/dist/{types-CVJVQ7fp.d.ts → types-DU8HmI5U.d.ts} +1 -1
- package/dist/wasm.d.ts +2 -2
- package/dist/wasm.esm.js +8 -8
- package/dist/workflow.d.ts +813 -0
- package/dist/workflow.esm.js +600 -0
- package/package.json +7 -3
- package/dist/openviduLazy-BIPHozOu.esm.js +0 -3
- package/dist/selfieManager-DeOcNel4.esm.js +0 -110
- /package/dist/{Actor-Ba71-_30.d.ts → Actor-DbWH1K6E.d.ts} +0 -0
- /package/dist/{BaseWasmProvider-D-s_6M5H.esm.js → BaseWasmProvider-DoYDYH1z.esm.js} +0 -0
- /package/dist/{BrowserEnvironmentProvider-DaHeLJQw.esm.js → BrowserEnvironmentProvider-BtKLxTx4.esm.js} +0 -0
- /package/dist/{BrowserTimerProvider-BhD2MlHg.esm.js → BrowserTimerProvider-v7bpbrAk.esm.js} +0 -0
- /package/dist/{ITimerCapability-oixwa6nj.esm.js → ITimerCapability-BZO_FsCo.esm.js} +0 -0
- /package/dist/{Manager-BN2g_I8W.d.ts → Manager-DcPMRgTm.d.ts} +0 -0
- /package/dist/{MotionSensorProvider-CodM3e0E.esm.js → MotionSensorProvider-D90R4qwV.esm.js} +0 -0
- /package/dist/{StateMachine-BoJsfMvg.d.ts → StateMachine-BBuIgsHT.d.ts} +0 -0
- /package/dist/{api-DzpnV6O7.esm.js → api-aa9Mx20l.esm.js} +0 -0
- /package/dist/{browserSimulation-B4ubb2OL.esm.js → browserSimulation-DFqGKQAD.esm.js} +0 -0
- /package/dist/{camera-1eeGnAaL.d.ts → camera-DATT31my.d.ts} +0 -0
- /package/dist/{camera-DmkFpf5N.esm.js → camera-DpPQS_-5.esm.js} +0 -0
- /package/dist/{chunk-DsxENsBR.esm.js → chunk-YGHKo4MY.esm.js} +0 -0
- /package/dist/{displayErrors-BZLX7idb.d.ts → displayErrors-xrg0ejaS.d.ts} +0 -0
- /package/dist/{flowCompletionService-D-3YCHyO.d.ts → flowCompletionService-gxt5reFV.d.ts} +0 -0
- /package/dist/{getBrowser-Dtyt9J_h.esm.js → getBrowser-DCcD7H-M.esm.js} +0 -0
- /package/dist/{platform-Dv7a2fv-.esm.js → platform-DctkySJU.esm.js} +0 -0
- /package/dist/{types-D_QfFKxT.d.ts → types-CIjb0FKu.d.ts} +0 -0
- /package/dist/{warmup-CIj_wEV_.d.ts → warmup-Ckb1hN85.d.ts} +0 -0
- /package/dist/{xstate.esm-Bv55-lJ4.esm.js → xstate.esm-B7FPE6br.esm.js} +0 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { t as api } from "./api-aa9Mx20l.esm.js";
|
|
2
|
+
import { _ as endpoints } from "./events-W91zLpx4.esm.js";
|
|
3
|
+
import { i as fromPromise, n as assign, r as fromCallback, t as setup } from "./xstate.esm-B7FPE6br.esm.js";
|
|
4
|
+
import { t as BrowserTimerProvider } from "./BrowserTimerProvider-v7bpbrAk.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/http.esm.js
CHANGED
package/dist/id.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import "./warmup-
|
|
2
|
-
import "./Manager-
|
|
3
|
-
import "./Actor-
|
|
4
|
-
import "./StateMachine-
|
|
5
|
-
import { t as CameraStream } from "./camera-
|
|
6
|
-
import "./types-
|
|
7
|
-
import "./types-
|
|
8
|
-
import "./deepsightService-
|
|
9
|
-
import { n as PermissionStatus, t as PermissionResult } from "./types-
|
|
10
|
-
import { A as IdCaptureDependencies, B as RecordingSession, C as CaptureIdResponse, D as ID_ERROR_CODES, E as DetectionStatus, F as IdCaptureThresholds, H as DetectionOrientation, I as IdDocumentType, L as IdError, M as IdCaptureGeometry, N as IdCaptureInput, O as IdCaptureConfig, P as IdCaptureMode, R as IdErrorCode, S as idCaptureMachine, T as DetectionArea, U as IdCaptureSettings, V as UploadIdResponse, _ as validateUploadResponse, a as IdCaptureInitResult, b as createIdCaptureActor, c as UploadIdImageParams, d as preloadIdRecordingProvider, f as processId, g as uploadIdImage, h as stopStream, j as IdCaptureEvent, k as IdCaptureContext, l as ValidationError, m as stopRecording, n as IdCaptureState, o as InitializeIdCaptureParams, p as startRecordingSession, r as createIdCaptureManager, s as StartRecordingParams, t as IdCaptureManager, u as initializeIdCapture, v as CreateIdCaptureActorOptions, w as CapturedImage, x as IdCaptureMachine, y as IdCaptureActor, z as IdFlowStep } from "./idCaptureManager-
|
|
1
|
+
import "./warmup-Ckb1hN85.js";
|
|
2
|
+
import "./Manager-DcPMRgTm.js";
|
|
3
|
+
import "./Actor-DbWH1K6E.js";
|
|
4
|
+
import "./StateMachine-BBuIgsHT.js";
|
|
5
|
+
import { t as CameraStream } from "./camera-DATT31my.js";
|
|
6
|
+
import "./types-CYJ0Ish6.js";
|
|
7
|
+
import "./types-DU8HmI5U.js";
|
|
8
|
+
import "./deepsightService-S-tU77m-.js";
|
|
9
|
+
import { n as PermissionStatus, t as PermissionResult } from "./types-CIjb0FKu.js";
|
|
10
|
+
import { A as IdCaptureDependencies, B as RecordingSession, C as CaptureIdResponse, D as ID_ERROR_CODES, E as DetectionStatus, F as IdCaptureThresholds, H as DetectionOrientation, I as IdDocumentType, L as IdError, M as IdCaptureGeometry, N as IdCaptureInput, O as IdCaptureConfig, P as IdCaptureMode, R as IdErrorCode, S as idCaptureMachine, T as DetectionArea, U as IdCaptureSettings, V as UploadIdResponse, _ as validateUploadResponse, a as IdCaptureInitResult, b as createIdCaptureActor, c as UploadIdImageParams, d as preloadIdRecordingProvider, f as processId, g as uploadIdImage, h as stopStream, j as IdCaptureEvent, k as IdCaptureContext, l as ValidationError, m as stopRecording, n as IdCaptureState, o as InitializeIdCaptureParams, p as startRecordingSession, r as createIdCaptureManager, s as StartRecordingParams, t as IdCaptureManager, u as initializeIdCapture, v as CreateIdCaptureActorOptions, w as CapturedImage, x as IdCaptureMachine, y as IdCaptureActor, z as IdFlowStep } from "./idCaptureManager-CbZvdr9y.js";
|
|
11
11
|
export { CameraStream, CaptureIdResponse, CapturedImage, type CreateIdCaptureActorOptions, DetectionArea, DetectionOrientation, DetectionStatus, ID_ERROR_CODES, type IdCaptureActor, IdCaptureConfig, type IdCaptureContext, IdCaptureDependencies, type IdCaptureEvent, IdCaptureGeometry, IdCaptureInitResult, type IdCaptureInput, type IdCaptureMachine, type IdCaptureManager, IdCaptureMode, IdCaptureSettings, type IdCaptureState, IdCaptureThresholds, IdDocumentType, IdError, IdErrorCode, IdFlowStep, InitializeIdCaptureParams, PermissionResult, PermissionStatus, RecordingSession, StartRecordingParams, UploadIdImageParams, UploadIdResponse, ValidationError, createIdCaptureActor, createIdCaptureManager, idCaptureMachine, initializeIdCapture, preloadIdRecordingProvider, processId, startRecordingSession, stopRecording, stopStream, uploadIdImage, validateUploadResponse };
|
package/dist/id.esm.js
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import "./BaseWasmProvider-
|
|
2
|
-
import "./api-
|
|
3
|
-
import "./events-
|
|
4
|
-
import "./session-
|
|
5
|
-
import "./BrowserEnvironmentProvider-
|
|
6
|
-
import "./browserSimulation-
|
|
7
|
-
import "./xstate.esm-
|
|
8
|
-
import "./
|
|
9
|
-
import "./
|
|
10
|
-
import "./
|
|
11
|
-
import "./
|
|
12
|
-
import "./
|
|
13
|
-
import "./
|
|
14
|
-
import "./
|
|
15
|
-
import "./
|
|
16
|
-
import "./
|
|
17
|
-
import "./
|
|
18
|
-
import "./
|
|
19
|
-
import "./
|
|
20
|
-
import
|
|
1
|
+
import "./BaseWasmProvider-DoYDYH1z.esm.js";
|
|
2
|
+
import "./api-aa9Mx20l.esm.js";
|
|
3
|
+
import "./events-W91zLpx4.esm.js";
|
|
4
|
+
import "./session-B_rKSRql.esm.js";
|
|
5
|
+
import "./BrowserEnvironmentProvider-BtKLxTx4.esm.js";
|
|
6
|
+
import "./browserSimulation-DFqGKQAD.esm.js";
|
|
7
|
+
import "./xstate.esm-B7FPE6br.esm.js";
|
|
8
|
+
import "./BrowserStorageProvider-CXaS5Ooj.esm.js";
|
|
9
|
+
import "./recordingService-CCfxUY7-.esm.js";
|
|
10
|
+
import "./deepsightService-rPGLH8Xp.esm.js";
|
|
11
|
+
import "./camera-DpPQS_-5.esm.js";
|
|
12
|
+
import "./getBrowser-DCcD7H-M.esm.js";
|
|
13
|
+
import "./stats-gFD2351t.esm.js";
|
|
14
|
+
import "./MotionSensorProvider-D90R4qwV.esm.js";
|
|
15
|
+
import "./permissionServices-Cisv73eQ.esm.js";
|
|
16
|
+
import "./platform-DctkySJU.esm.js";
|
|
17
|
+
import "./ITimerCapability-BZO_FsCo.esm.js";
|
|
18
|
+
import "./backCameraStream-D9g2wyil.esm.js";
|
|
19
|
+
import "./getDeviceClass-DBF-ExLR.esm.js";
|
|
20
|
+
import "./BrowserTimerProvider-v7bpbrAk.esm.js";
|
|
21
|
+
import { a as startRecordingSession, c as uploadIdImage, i as processId, l as validateUploadResponse, n as initializeIdCapture, o as stopRecording, r as preloadIdRecordingProvider, s as stopStream, t as idCaptureMachine, u as ID_ERROR_CODES } from "./idCaptureStateMachine-gf-Q9piu.esm.js";
|
|
22
|
+
import { r as createIdCaptureActor, t as createIdCaptureManager } from "./idCaptureManager-CJfatzuY.esm.js";
|
|
21
23
|
|
|
22
24
|
export { ID_ERROR_CODES, createIdCaptureActor, createIdCaptureManager, idCaptureMachine, initializeIdCapture, preloadIdRecordingProvider, processId, startRecordingSession, stopRecording, stopStream, uploadIdImage, validateUploadResponse };
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import { n as eventModuleNames, o as createManagerInstrumentation, r as eventScreenNames } from "./events-W91zLpx4.esm.js";
|
|
2
|
+
import { a as createActor, o as createManager } from "./xstate.esm-B7FPE6br.esm.js";
|
|
3
|
+
import { t as BrowserStorageProvider } from "./BrowserStorageProvider-CXaS5Ooj.esm.js";
|
|
4
|
+
import { t as idCaptureMachine } from "./idCaptureStateMachine-gf-Q9piu.esm.js";
|
|
5
|
+
|
|
6
|
+
//#region src/modules/id/idCaptureActor.ts
|
|
7
|
+
function createIdCaptureActor(options) {
|
|
8
|
+
const dependencies = options.dependencies ?? { storage: new BrowserStorageProvider() };
|
|
9
|
+
return createActor(idCaptureMachine, { input: {
|
|
10
|
+
config: options.config,
|
|
11
|
+
dependencies
|
|
12
|
+
} }).start();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/modules/id/idCaptureManager.ts
|
|
17
|
+
function getPermissionStatus(snapshot) {
|
|
18
|
+
if (!snapshot.matches("permissions")) return;
|
|
19
|
+
if (snapshot.matches({ permissions: "idle" })) return "idle";
|
|
20
|
+
if (snapshot.matches({ permissions: "waitingForUser" })) return "idle";
|
|
21
|
+
if (snapshot.matches({ permissions: "learnMore" })) return "learnMore";
|
|
22
|
+
if (snapshot.matches({ permissions: "requesting" })) return "requesting";
|
|
23
|
+
if (snapshot.matches({ permissions: "denied" })) return "denied";
|
|
24
|
+
}
|
|
25
|
+
function getCaptureStatus(snapshot) {
|
|
26
|
+
const matches = {
|
|
27
|
+
initializing: snapshot.matches({ capture: "initializing" }),
|
|
28
|
+
detecting: snapshot.matches({ capture: "detecting" }),
|
|
29
|
+
manualCaptureWaiting: snapshot.matches({ capture: "manualCaptureWaiting" }),
|
|
30
|
+
capturing: snapshot.matches({ capture: "capturing" }),
|
|
31
|
+
capturingManual: snapshot.matches({ capture: "capturingManual" }),
|
|
32
|
+
uploading: snapshot.matches({ capture: "uploading" }),
|
|
33
|
+
uploadError: snapshot.matches({ capture: "uploadError" }),
|
|
34
|
+
success: snapshot.matches({ capture: "success" })
|
|
35
|
+
};
|
|
36
|
+
if (matches.initializing) return "initializing";
|
|
37
|
+
if (matches.detecting || matches.manualCaptureWaiting) return "detecting";
|
|
38
|
+
if (matches.capturing || matches.capturingManual) return "capturing";
|
|
39
|
+
if (matches.uploading) return "uploading";
|
|
40
|
+
if (matches.uploadError) return "uploadError";
|
|
41
|
+
if (matches.success) return "success";
|
|
42
|
+
}
|
|
43
|
+
function getErrorMessage(errorCode) {
|
|
44
|
+
if (!errorCode) return void 0;
|
|
45
|
+
return {
|
|
46
|
+
UPLOAD_ERROR: "Upload failed",
|
|
47
|
+
CLASSIFICATION_FAILED: "ID classification failed",
|
|
48
|
+
LOW_SHARPNESS: "Image is not sharp enough",
|
|
49
|
+
GLARE_DETECTED: "Glare detected on ID",
|
|
50
|
+
WRONG_DOCUMENT_SIDE: "Wrong side of document",
|
|
51
|
+
ID_TYPE_UNACCEPTABLE: "ID type is not acceptable",
|
|
52
|
+
READABILITY_ISSUE: "ID readability issue",
|
|
53
|
+
RETRY_EXHAUSTED_CONTINUE_TO_BACK: "Retry exhausted",
|
|
54
|
+
RETRY_EXHAUSTED_SKIP_BACK: "Retry exhausted",
|
|
55
|
+
NO_MORE_TRIES: "No more tries remaining",
|
|
56
|
+
UNEXPECTED_ERROR: "An unexpected error occurred",
|
|
57
|
+
NO_TOKEN: "No token available",
|
|
58
|
+
PERMISSION_DENIED: "Permission denied",
|
|
59
|
+
USER_CANCELLED: "User cancelled",
|
|
60
|
+
SERVER_ERROR: "Server error"
|
|
61
|
+
}[errorCode];
|
|
62
|
+
}
|
|
63
|
+
function getErrorDescription(errorCode, uploadResponse) {
|
|
64
|
+
if (!errorCode) return void 0;
|
|
65
|
+
return {
|
|
66
|
+
UPLOAD_ERROR: "Please try again",
|
|
67
|
+
CLASSIFICATION_FAILED: "Please ensure your ID is clearly visible",
|
|
68
|
+
LOW_SHARPNESS: "Please ensure the image is clear and well-focused",
|
|
69
|
+
GLARE_DETECTED: "Please avoid bright reflections on your ID",
|
|
70
|
+
WRONG_DOCUMENT_SIDE: uploadResponse?.side === "back" ? "Please show the back side of your ID" : "Please show the front side of your ID",
|
|
71
|
+
ID_TYPE_UNACCEPTABLE: "Please use a valid ID type",
|
|
72
|
+
READABILITY_ISSUE: "Please ensure all text is clearly visible",
|
|
73
|
+
RETRY_EXHAUSTED_CONTINUE_TO_BACK: "Continuing to back side capture",
|
|
74
|
+
RETRY_EXHAUSTED_SKIP_BACK: "Skipping back side capture",
|
|
75
|
+
NO_MORE_TRIES: "Maximum attempts reached",
|
|
76
|
+
UNEXPECTED_ERROR: "Please try again later",
|
|
77
|
+
NO_TOKEN: "Session expired",
|
|
78
|
+
PERMISSION_DENIED: "Camera permission is required",
|
|
79
|
+
USER_CANCELLED: "Capture was cancelled",
|
|
80
|
+
SERVER_ERROR: "Please try again later"
|
|
81
|
+
}[errorCode];
|
|
82
|
+
}
|
|
83
|
+
function mapState(snapshot) {
|
|
84
|
+
const { context } = snapshot;
|
|
85
|
+
if (snapshot.matches("idle")) return { status: "idle" };
|
|
86
|
+
if (snapshot.matches("chooser")) return {
|
|
87
|
+
status: "chooser",
|
|
88
|
+
availableDocumentTypes: context.availableDocumentTypes
|
|
89
|
+
};
|
|
90
|
+
if (snapshot.matches("loading")) return { status: "loading" };
|
|
91
|
+
if (snapshot.matches("tutorial")) return {
|
|
92
|
+
status: "tutorial",
|
|
93
|
+
selectedDocumentType: context.selectedDocumentType,
|
|
94
|
+
currentMode: context.currentMode
|
|
95
|
+
};
|
|
96
|
+
if (snapshot.matches("closed")) return { status: "closed" };
|
|
97
|
+
if (snapshot.matches("permissions")) {
|
|
98
|
+
const permissionStatus = getPermissionStatus(snapshot);
|
|
99
|
+
if (permissionStatus === void 0) return {
|
|
100
|
+
status: "permissions",
|
|
101
|
+
permissionStatus: "idle"
|
|
102
|
+
};
|
|
103
|
+
return {
|
|
104
|
+
status: "permissions",
|
|
105
|
+
permissionStatus
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
if (snapshot.matches("capture")) {
|
|
109
|
+
const captureStatus = getCaptureStatus(snapshot);
|
|
110
|
+
const needsBackCapture = (context.currentMode === "front" || context.currentMode === "passport") && !context.config.onlyFront && !context.config.onlyBack && !context.uploadResponse?.skipBackIdCapture && !(context.config.usSmartCapture && context.currentMode === "front");
|
|
111
|
+
const needsFrontCapture = context.config.usSmartCapture === true && context.currentMode === "back" && context.uploadResponse?.forceFrontIdCapture === true;
|
|
112
|
+
return {
|
|
113
|
+
status: "capture",
|
|
114
|
+
captureStatus: captureStatus ?? "initializing",
|
|
115
|
+
stream: context.stream,
|
|
116
|
+
detectionStatus: context.detectionStatus,
|
|
117
|
+
debugFrame: void 0,
|
|
118
|
+
attemptsRemaining: context.attemptsRemaining,
|
|
119
|
+
uploadError: context.uploadError,
|
|
120
|
+
currentMode: context.currentMode,
|
|
121
|
+
counterValue: context.counterValue,
|
|
122
|
+
orientation: context.orientation,
|
|
123
|
+
idType: context.idType,
|
|
124
|
+
previewImageUrl: context.previewImageUrl,
|
|
125
|
+
uploadProgress: context.uploadProgress ?? 0,
|
|
126
|
+
uploadErrorMessage: context.uploadError ? getErrorMessage(context.uploadError) : void 0,
|
|
127
|
+
uploadErrorDescription: context.uploadError ? getErrorDescription(context.uploadError, context.uploadResponse) : void 0,
|
|
128
|
+
needsBackCapture,
|
|
129
|
+
needsFrontCapture,
|
|
130
|
+
showCaptureButtonInAuto: context.config.showCaptureButtonInAuto ?? false,
|
|
131
|
+
canRetry: context.attemptsRemaining > 0
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
if (snapshot.matches("mandatoryConsent")) return {
|
|
135
|
+
status: "mandatoryConsent",
|
|
136
|
+
regulationType: context.uploadResponse?.regulationType ?? "Other"
|
|
137
|
+
};
|
|
138
|
+
if (snapshot.matches("frontFinished")) return { status: "frontFinished" };
|
|
139
|
+
if (snapshot.matches("backFinished")) return { status: "backFinished" };
|
|
140
|
+
if (snapshot.matches("processing")) return { status: "processing" };
|
|
141
|
+
if (snapshot.matches("expired")) return { status: "expired" };
|
|
142
|
+
if (snapshot.matches("finished")) return { status: "finished" };
|
|
143
|
+
if (snapshot.matches("error")) return {
|
|
144
|
+
status: "error",
|
|
145
|
+
error: context.error ?? "Unknown error"
|
|
146
|
+
};
|
|
147
|
+
return { status: "idle" };
|
|
148
|
+
}
|
|
149
|
+
function createApi({ actor, trackElementClicked, trackCaptureAttemptFinished }) {
|
|
150
|
+
const snapshot = actor.getSnapshot();
|
|
151
|
+
if (snapshot.context.dependencies) snapshot.context.dependencies.trackCaptureAttemptFinished = trackCaptureAttemptFinished;
|
|
152
|
+
return {
|
|
153
|
+
load() {
|
|
154
|
+
actor.send({ type: "LOAD" });
|
|
155
|
+
},
|
|
156
|
+
selectDocument(documentType) {
|
|
157
|
+
trackElementClicked?.(`selectDocument.${documentType}`);
|
|
158
|
+
actor.send({
|
|
159
|
+
type: "SELECT_DOCUMENT",
|
|
160
|
+
documentType
|
|
161
|
+
});
|
|
162
|
+
},
|
|
163
|
+
nextStep() {
|
|
164
|
+
trackElementClicked?.("nextStep");
|
|
165
|
+
actor.send({ type: "NEXT_STEP" });
|
|
166
|
+
},
|
|
167
|
+
requestPermission() {
|
|
168
|
+
trackElementClicked?.("requestPermission");
|
|
169
|
+
actor.send({ type: "REQUEST_PERMISSION" });
|
|
170
|
+
},
|
|
171
|
+
goToLearnMore() {
|
|
172
|
+
trackElementClicked?.("goToLearnMore");
|
|
173
|
+
actor.send({ type: "GO_TO_LEARN_MORE" });
|
|
174
|
+
},
|
|
175
|
+
back() {
|
|
176
|
+
trackElementClicked?.("back");
|
|
177
|
+
actor.send({ type: "BACK" });
|
|
178
|
+
},
|
|
179
|
+
close() {
|
|
180
|
+
trackElementClicked?.("close");
|
|
181
|
+
actor.send({ type: "QUIT" });
|
|
182
|
+
},
|
|
183
|
+
reset() {
|
|
184
|
+
actor.send({ type: "RESET" });
|
|
185
|
+
},
|
|
186
|
+
retryCapture() {
|
|
187
|
+
trackElementClicked?.("retryCapture");
|
|
188
|
+
actor.send({ type: "RETRY_CAPTURE" });
|
|
189
|
+
},
|
|
190
|
+
continueFromError() {
|
|
191
|
+
trackElementClicked?.("continueFromError");
|
|
192
|
+
actor.send({ type: "CONTINUE_FROM_ERROR" });
|
|
193
|
+
},
|
|
194
|
+
capture() {
|
|
195
|
+
trackElementClicked?.("capture");
|
|
196
|
+
actor.send({ type: "MANUAL_CAPTURE" });
|
|
197
|
+
},
|
|
198
|
+
switchToManualCapture() {
|
|
199
|
+
trackElementClicked?.("switchToManualCapture");
|
|
200
|
+
actor.send({ type: "SWITCH_TO_MANUAL_CAPTURE" });
|
|
201
|
+
},
|
|
202
|
+
continueToBack() {
|
|
203
|
+
trackElementClicked?.("continueToBack");
|
|
204
|
+
actor.send({ type: "CONTINUE_TO_BACK" });
|
|
205
|
+
},
|
|
206
|
+
continueToFront() {
|
|
207
|
+
trackElementClicked?.("continueToFront");
|
|
208
|
+
actor.send({ type: "CONTINUE_TO_FRONT" });
|
|
209
|
+
},
|
|
210
|
+
skipBack() {
|
|
211
|
+
trackElementClicked?.("skipBack");
|
|
212
|
+
actor.send({ type: "SKIP_BACK" });
|
|
213
|
+
},
|
|
214
|
+
acceptMandatoryConsent() {
|
|
215
|
+
trackElementClicked?.("acceptMandatoryConsent");
|
|
216
|
+
actor.send({ type: "CONSENT_ACCEPT" });
|
|
217
|
+
},
|
|
218
|
+
cancelMandatoryConsent() {
|
|
219
|
+
trackElementClicked?.("cancelMandatoryConsent");
|
|
220
|
+
actor.send({ type: "CONSENT_CANCEL" });
|
|
221
|
+
},
|
|
222
|
+
updateDetectionArea(detectionArea) {
|
|
223
|
+
actor.send({
|
|
224
|
+
type: "UPDATE_DETECTION_AREA",
|
|
225
|
+
detectionArea
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
const FRONT_SCREENS = {
|
|
231
|
+
tutorial: eventScreenNames.frontTutorial,
|
|
232
|
+
cameraCapture: eventScreenNames.frontCameraCapture,
|
|
233
|
+
uploadProgress: eventScreenNames.frontUploadProgress,
|
|
234
|
+
attemptFailed: eventScreenNames.frontAttemptFailed,
|
|
235
|
+
uploadSuccess: eventScreenNames.frontUploadSuccess,
|
|
236
|
+
help: eventScreenNames.frontHelp
|
|
237
|
+
};
|
|
238
|
+
const BACK_SCREENS = {
|
|
239
|
+
tutorial: eventScreenNames.backTutorial,
|
|
240
|
+
cameraCapture: eventScreenNames.backCameraCapture,
|
|
241
|
+
uploadProgress: eventScreenNames.backUploadProgress,
|
|
242
|
+
attemptFailed: eventScreenNames.backAttemptFailed,
|
|
243
|
+
uploadSuccess: eventScreenNames.backUploadSuccess,
|
|
244
|
+
help: eventScreenNames.backHelp
|
|
245
|
+
};
|
|
246
|
+
const PASSPORT_SCREENS = { tutorial: eventScreenNames.passportTutorial };
|
|
247
|
+
function getSideScreens(mode) {
|
|
248
|
+
if (mode === "back") return BACK_SCREENS;
|
|
249
|
+
if (mode === "passport") return {
|
|
250
|
+
...FRONT_SCREENS,
|
|
251
|
+
...PASSPORT_SCREENS
|
|
252
|
+
};
|
|
253
|
+
return FRONT_SCREENS;
|
|
254
|
+
}
|
|
255
|
+
function getCaptureSubstateScreen(value, screens) {
|
|
256
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
257
|
+
const captureValue = value.capture;
|
|
258
|
+
if (captureValue === void 0) return void 0;
|
|
259
|
+
if (typeof captureValue === "string") switch (captureValue) {
|
|
260
|
+
case "detecting":
|
|
261
|
+
case "manualCaptureWaiting":
|
|
262
|
+
case "capturing":
|
|
263
|
+
case "capturingManual": return screens.cameraCapture;
|
|
264
|
+
case "uploading":
|
|
265
|
+
case "validatingUpload": return screens.uploadProgress;
|
|
266
|
+
case "uploadError": return screens.attemptFailed;
|
|
267
|
+
case "success": return screens.uploadSuccess;
|
|
268
|
+
}
|
|
269
|
+
if (typeof captureValue === "object" && captureValue !== null) {
|
|
270
|
+
const substates = Object.keys(captureValue);
|
|
271
|
+
if (substates.includes("detecting") || substates.includes("capturing")) return screens.cameraCapture;
|
|
272
|
+
if (substates.includes("uploading")) return screens.uploadProgress;
|
|
273
|
+
if (substates.includes("uploadError")) return screens.attemptFailed;
|
|
274
|
+
if (substates.includes("success")) return screens.uploadSuccess;
|
|
275
|
+
}
|
|
276
|
+
return screens.cameraCapture;
|
|
277
|
+
}
|
|
278
|
+
function getIdCaptureScreenName(snapshot) {
|
|
279
|
+
const { value, context } = snapshot;
|
|
280
|
+
if (value === void 0 || value === null) return void 0;
|
|
281
|
+
const topLevel = typeof value === "string" ? value : typeof value === "object" ? Object.keys(value)[0] : void 0;
|
|
282
|
+
if (topLevel === void 0) return void 0;
|
|
283
|
+
const side = context.currentMode;
|
|
284
|
+
const screens = getSideScreens(side);
|
|
285
|
+
switch (topLevel) {
|
|
286
|
+
case "idle": return "IDLE";
|
|
287
|
+
case "chooser": return "DOCUMENT_CHOOSER";
|
|
288
|
+
case "loading": return "LOADING";
|
|
289
|
+
case "tutorial": return screens.tutorial;
|
|
290
|
+
case "permissions": return "PERMISSIONS";
|
|
291
|
+
case "capture": return getCaptureSubstateScreen(value, screens);
|
|
292
|
+
case "mandatoryConsent": return "MANDATORY_CONSENT";
|
|
293
|
+
case "frontFinished": return screens.uploadSuccess;
|
|
294
|
+
case "backFinished": return screens.uploadSuccess;
|
|
295
|
+
case "processing": return "PROCESSING";
|
|
296
|
+
case "expired": return "EXPIRED";
|
|
297
|
+
case "finished": return "FINISHED";
|
|
298
|
+
case "closed": return "CLOSED";
|
|
299
|
+
case "error": return "ERROR";
|
|
300
|
+
default: return topLevel;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
function mapIdCaptureScreenName(snapshot) {
|
|
304
|
+
return getIdCaptureScreenName(snapshot);
|
|
305
|
+
}
|
|
306
|
+
function getIdCaptureErrorPayload(snapshot) {
|
|
307
|
+
const errorCode = snapshot.context.uploadError;
|
|
308
|
+
if (errorCode === void 0) return;
|
|
309
|
+
return { errorCode };
|
|
310
|
+
}
|
|
311
|
+
function createIdCaptureManager(options) {
|
|
312
|
+
return createManager({
|
|
313
|
+
actor: createIdCaptureActor(options),
|
|
314
|
+
mapState,
|
|
315
|
+
createApi,
|
|
316
|
+
instrumentation: createManagerInstrumentation(eventModuleNames.id, {
|
|
317
|
+
getScreenName: mapIdCaptureScreenName,
|
|
318
|
+
getErrorPayload: getIdCaptureErrorPayload
|
|
319
|
+
})
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
function createIdCaptureManagerFromActor(actor) {
|
|
323
|
+
return createManager({
|
|
324
|
+
actor,
|
|
325
|
+
mapState,
|
|
326
|
+
createApi,
|
|
327
|
+
instrumentation: createManagerInstrumentation(eventModuleNames.id, {
|
|
328
|
+
getScreenName: mapIdCaptureScreenName,
|
|
329
|
+
getErrorPayload: getIdCaptureErrorPayload
|
|
330
|
+
})
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
//#endregion
|
|
335
|
+
export { createIdCaptureManagerFromActor as n, createIdCaptureActor as r, createIdCaptureManager as t };
|