@incodetech/core 0.0.0-dev-20260409-a38d5e8 → 0.0.0-dev-20260409-089e5c6
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-ByxoNfxC.esm.js +55 -0
- package/dist/{OpenViduRecordingProvider-Bn2meybK.esm.js → OpenViduRecordingProvider-JatjSE3h.esm.js} +1 -1
- package/dist/{WasmUtilProvider-BpZSvZbg.esm.js → WasmUtilProvider-DRh0wrlm.esm.js} +1 -1
- package/dist/{addressSearch-DOFI7lwy.esm.js → addressSearch-CDdN30un.esm.js} +4 -4
- package/dist/antifraud.d.ts +1 -1
- package/dist/antifraud.esm.js +4 -37
- package/dist/antifraudStateMachine-C1AgS0nL.esm.js +39 -0
- package/dist/authentication.d.ts +11 -11
- package/dist/authentication.esm.js +22 -19
- package/dist/{authenticationManager-C2mk36yK.d.ts → authenticationManager-DYFYx68i.d.ts} +2 -2
- package/dist/authenticationManager-UaO9UTN7.esm.js +67 -0
- package/dist/{authenticationManager-C7dL_avf.esm.js → authenticationStateMachine-DWI65EwK.esm.js} +7 -67
- package/dist/{backCameraStream-tabTmwDS.esm.js → backCameraStream-BihRmMzc.esm.js} +3 -3
- package/dist/camera.d.ts +1 -1
- package/dist/camera.esm.js +3 -3
- package/dist/consent.d.ts +57 -57
- package/dist/consent.esm.js +4 -149
- package/dist/consentStateMachine-CpRu2hF0.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-Czzgv2W1.esm.js +419 -0
- package/dist/{deepsightLoader-Cj6SyUQ-.esm.js → deepsightLoader-jIgoauFK.esm.js} +10 -10
- package/dist/{deepsightService-BjgXl5hs.esm.js → deepsightService-D4mM8yJ2.esm.js} +5 -5
- package/dist/{deepsightService-ByD6uIs7.d.ts → deepsightService-DAeakjDd.d.ts} +2 -2
- package/dist/device.esm.js +3 -3
- package/dist/document-capture.d.ts +75 -73
- package/dist/document-capture.esm.js +8 -403
- package/dist/document-upload.d.ts +50 -50
- package/dist/document-upload.esm.js +7 -7
- package/dist/documentCaptureStateMachine-XbpsHzh5.esm.js +403 -0
- package/dist/ekyb.d.ts +3 -3
- package/dist/ekyb.esm.js +10 -655
- package/dist/ekybStateMachine-BDuCae6s.esm.js +653 -0
- package/dist/ekyc.d.ts +3 -3
- package/dist/ekyc.esm.js +6 -10614
- package/dist/ekycStateMachine-BN4KBDYY.esm.js +10615 -0
- package/dist/email.d.ts +3 -3
- package/dist/email.esm.js +6 -5
- package/dist/emailManager-CAeo59lD.esm.js +238 -0
- package/dist/{emailManager-CU_hzrsl.d.ts → emailManager-CZYfcu0n.d.ts} +4 -3
- package/dist/{emailManager-_9R4vm6g.esm.js → emailStateMachine-Bqwe_sQS.esm.js} +6 -239
- package/dist/{events-DlHrOIRc.esm.js → events-CZ2ka3pu.esm.js} +8 -1
- package/dist/events.d.ts +1 -0
- 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-D8zlMTvd.esm.js +117 -0
- package/dist/{faceCaptureManagerFactory-Da_-ohdg.d.ts → faceCaptureManagerFactory-DS-6yCya.d.ts} +8 -8
- package/dist/{faceCaptureSetup-CaVWkjvE.esm.js → faceCaptureSetup-1M6uUEjK.esm.js} +5 -119
- package/dist/faceMatchStateMachine-D3DuP_ya.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-W6bj7Xd3.esm.js} +2 -2
- package/dist/{flowServices-p22wrYPf.esm.js → flowServices-C4tjBD8q.esm.js} +3 -3
- package/dist/geolocation.d.ts +7 -6
- package/dist/geolocation.esm.js +7 -105
- package/dist/geolocationStateMachine-Bj2LkGwy.esm.js +105 -0
- package/dist/{getDeviceClass-DEzz4cmY.esm.js → getDeviceClass-BoiWvKAc.esm.js} +1 -1
- package/dist/government-validation.d.ts +2 -2
- package/dist/government-validation.esm.js +5 -269
- package/dist/governmentValidationStateMachine-W1CzRjVw.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-BcS8fgW4.esm.js +335 -0
- package/dist/{idCaptureManager-CV08v1e3.d.ts → idCaptureManager-oR6YPYHj.d.ts} +7 -7
- package/dist/{idCaptureManager-dyZzKv8L.esm.js → idCaptureStateMachine-MAzfM_2O.esm.js} +17 -346
- package/dist/identity-reuse.d.ts +530 -0
- package/dist/identity-reuse.esm.js +273 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +8 -8
- package/dist/{lib-Bavz2qmt.esm.js → lib-CxDxnzRd.esm.js} +1 -1
- package/dist/mandatory-consent.d.ts +55 -55
- package/dist/mandatory-consent.esm.js +4 -124
- package/dist/mandatoryConsentStateMachine-BMKi26Re.esm.js +126 -0
- package/dist/{openviduLazy-vhrVZCr_.esm.js → openviduLazy-B8tinh9W.esm.js} +2 -2
- package/dist/openviduLazy-CItjpMfL.esm.js +3 -0
- package/dist/{permissionServices-Cskq32Yd.esm.js → permissionServices-Cj120WaT.esm.js} +2 -2
- package/dist/phone.d.ts +3 -3
- package/dist/phone.esm.js +6 -5
- package/dist/phoneManager-Bvj6Jr4o.esm.js +258 -0
- package/dist/{phoneManager-ulJuGvJ8.d.ts → phoneManager-CCMCkyYr.d.ts} +2 -2
- package/dist/{phoneManager-DerdUfd4.esm.js → phoneStateMachine-B1t1Z-Dd.esm.js} +5 -258
- package/dist/{recordingService-483wQ6kR.esm.js → recordingService-8I_-hhNI.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-BVP1KcoO.esm.js +249 -0
- package/dist/runChildModule-B5DEiOS7.esm.js +27 -0
- package/dist/selfie.d.ts +11 -11
- package/dist/selfie.esm.js +22 -19
- package/dist/selfieManager-B6x3O5Ns.esm.js +60 -0
- package/dist/{selfieManager-DCRP7X75.d.ts → selfieManager-gizt3Zha.d.ts} +2 -2
- package/dist/selfieStateMachine-DHPSBFj0.esm.js +56 -0
- package/dist/{session-CUh77zj3.esm.js → session-DoI-X9FK.esm.js} +4 -4
- package/dist/session.d.ts +1 -1
- package/dist/session.esm.js +6 -6
- package/dist/{setup-XpxfZgKn.esm.js → setup-Bh2S53NT.esm.js} +6 -5
- package/dist/{setup-DpHakxsC.d.ts → setup-Bz3Ffaoc.d.ts} +1 -1
- package/dist/signature.d.ts +4 -3
- package/dist/signature.esm.js +6 -189
- package/dist/signatureStateMachine-Cv7yPuEf.esm.js +189 -0
- package/dist/{stats-DHDoqSBV.esm.js → stats-wkQyDFV3.esm.js} +1 -1
- package/dist/stats.esm.js +2 -2
- package/dist/types-BdEM5Jj7.d.ts +35 -0
- package/dist/{types-2OPf1pyv.d.ts → types-CdlQrTiZ.d.ts} +1 -1
- package/dist/{types-CVJVQ7fp.d.ts → types-m43DfiSx.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 +11 -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-BkPcZGke.d.ts} +0 -0
- /package/dist/{BaseWasmProvider-D-s_6M5H.esm.js → BaseWasmProvider-C73c2nV9.esm.js} +0 -0
- /package/dist/{BrowserEnvironmentProvider-DaHeLJQw.esm.js → BrowserEnvironmentProvider-lxn4oxXn.esm.js} +0 -0
- /package/dist/{BrowserTimerProvider-BhD2MlHg.esm.js → BrowserTimerProvider-CSdm7__S.esm.js} +0 -0
- /package/dist/{ITimerCapability-oixwa6nj.esm.js → ITimerCapability-DAIaq369.esm.js} +0 -0
- /package/dist/{Manager-BN2g_I8W.d.ts → Manager-Bcnemkyi.d.ts} +0 -0
- /package/dist/{MotionSensorProvider-CodM3e0E.esm.js → MotionSensorProvider-BLnFo6My.esm.js} +0 -0
- /package/dist/{StateMachine-BoJsfMvg.d.ts → StateMachine-DIeoDJ7r.d.ts} +0 -0
- /package/dist/{api-DzpnV6O7.esm.js → api-CqKwkjJ3.esm.js} +0 -0
- /package/dist/{browserSimulation-B4ubb2OL.esm.js → browserSimulation-7W5-A3RV.esm.js} +0 -0
- /package/dist/{camera-DmkFpf5N.esm.js → camera-B-5traWf.esm.js} +0 -0
- /package/dist/{camera-1eeGnAaL.d.ts → camera-CgnuDuxy.d.ts} +0 -0
- /package/dist/{chunk-DsxENsBR.esm.js → chunk-Qw4qVmMx.esm.js} +0 -0
- /package/dist/{displayErrors-BZLX7idb.d.ts → displayErrors-C9-VaqmS.d.ts} +0 -0
- /package/dist/{flowCompletionService-D-3YCHyO.d.ts → flowCompletionService-CPLdZxe-.d.ts} +0 -0
- /package/dist/{getBrowser-Dtyt9J_h.esm.js → getBrowser-DJkbzQ5t.esm.js} +0 -0
- /package/dist/{platform-Dv7a2fv-.esm.js → platform-BfoqeM61.esm.js} +0 -0
- /package/dist/{types-D_QfFKxT.d.ts → types-CxU9jTRl.d.ts} +0 -0
- /package/dist/{warmup-CIj_wEV_.d.ts → warmup-Cs0uqxUW.d.ts} +0 -0
- /package/dist/{xstate.esm-Bv55-lJ4.esm.js → xstate.esm-D7D6CGwY.esm.js} +0 -0
|
@@ -1,128 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { a as createActor,
|
|
1
|
+
import "./api-CqKwkjJ3.esm.js";
|
|
2
|
+
import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-CZ2ka3pu.esm.js";
|
|
3
|
+
import { a as createActor, o as createManager } from "./xstate.esm-D7D6CGwY.esm.js";
|
|
4
|
+
import { t as mandatoryConsentMachine } from "./mandatoryConsentStateMachine-BMKi26Re.esm.js";
|
|
4
5
|
|
|
5
|
-
//#region src/modules/mandatory-consent/mandatoryConsentServices.ts
|
|
6
|
-
async function fetchMandatoryConsent(regulationType, signal) {
|
|
7
|
-
const res = await api.get(endpoints.getConsents, {
|
|
8
|
-
signal,
|
|
9
|
-
query: {
|
|
10
|
-
type: "MANDATORY",
|
|
11
|
-
language: "en",
|
|
12
|
-
regulationType
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
if (!res.ok) throw new Error(`GET ${endpoints.getConsents} failed: ${res.status} ${res.statusText}`);
|
|
16
|
-
return res.data;
|
|
17
|
-
}
|
|
18
|
-
async function submitMandatoryConsent(params, signal) {
|
|
19
|
-
const res = await api.post(endpoints.submitMlConsent, params, { signal });
|
|
20
|
-
if (!res.ok) throw new Error(`POST ${endpoints.submitMlConsent} failed: ${res.status} ${res.statusText}`);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/modules/mandatory-consent/mandatoryConsentStateMachine.ts
|
|
25
|
-
const mandatoryConsentMachine = setup({
|
|
26
|
-
types: {
|
|
27
|
-
context: {},
|
|
28
|
-
events: {},
|
|
29
|
-
input: {}
|
|
30
|
-
},
|
|
31
|
-
actors: {
|
|
32
|
-
fetchConsent: fromPromise(async ({ input, signal }) => fetchMandatoryConsent(input.config.consentType, signal)),
|
|
33
|
-
submitConsent: fromPromise(async ({ input, signal }) => submitMandatoryConsent({ consents: [{
|
|
34
|
-
id: input.consentId,
|
|
35
|
-
isSigned: input.isSigned
|
|
36
|
-
}] }, signal))
|
|
37
|
-
},
|
|
38
|
-
actions: {
|
|
39
|
-
setConsent: assign(({ event }) => {
|
|
40
|
-
return {
|
|
41
|
-
consent: event.output.consents[0],
|
|
42
|
-
isSigned: false,
|
|
43
|
-
error: void 0
|
|
44
|
-
};
|
|
45
|
-
}),
|
|
46
|
-
toggleSigned: assign(({ context }) => ({ isSigned: !context.isSigned })),
|
|
47
|
-
setError: assign(({ event }) => ({ error: String(event.error) })),
|
|
48
|
-
clearError: assign({ error: () => void 0 }),
|
|
49
|
-
resetContext: assign(({ context }) => ({
|
|
50
|
-
config: context.config,
|
|
51
|
-
consent: void 0,
|
|
52
|
-
isSigned: false,
|
|
53
|
-
error: void 0
|
|
54
|
-
}))
|
|
55
|
-
},
|
|
56
|
-
guards: { canSubmit: ({ context }) => Boolean(context.consent?.id) && context.isSigned }
|
|
57
|
-
}).createMachine({
|
|
58
|
-
id: "mandatoryConsent",
|
|
59
|
-
initial: "idle",
|
|
60
|
-
context: ({ input }) => ({
|
|
61
|
-
config: input.config,
|
|
62
|
-
consent: void 0,
|
|
63
|
-
isSigned: false,
|
|
64
|
-
error: void 0
|
|
65
|
-
}),
|
|
66
|
-
states: {
|
|
67
|
-
idle: { on: { LOAD: {
|
|
68
|
-
target: "loading",
|
|
69
|
-
actions: "clearError"
|
|
70
|
-
} } },
|
|
71
|
-
loading: { invoke: {
|
|
72
|
-
id: "fetchConsent",
|
|
73
|
-
src: "fetchConsent",
|
|
74
|
-
input: ({ context }) => ({ config: context.config }),
|
|
75
|
-
onDone: {
|
|
76
|
-
target: "display",
|
|
77
|
-
actions: "setConsent"
|
|
78
|
-
},
|
|
79
|
-
onError: {
|
|
80
|
-
target: "error",
|
|
81
|
-
actions: "setError"
|
|
82
|
-
}
|
|
83
|
-
} },
|
|
84
|
-
display: { on: {
|
|
85
|
-
TOGGLE: { actions: "toggleSigned" },
|
|
86
|
-
SUBMIT: {
|
|
87
|
-
target: "submitting",
|
|
88
|
-
guard: "canSubmit"
|
|
89
|
-
},
|
|
90
|
-
CANCEL: { target: "closed" },
|
|
91
|
-
RETRY: {
|
|
92
|
-
target: "loading",
|
|
93
|
-
actions: "clearError"
|
|
94
|
-
}
|
|
95
|
-
} },
|
|
96
|
-
submitting: { invoke: {
|
|
97
|
-
id: "submitConsent",
|
|
98
|
-
src: "submitConsent",
|
|
99
|
-
input: ({ context }) => ({
|
|
100
|
-
consentId: context.consent?.id ?? "",
|
|
101
|
-
isSigned: context.isSigned
|
|
102
|
-
}),
|
|
103
|
-
onDone: { target: "finished" },
|
|
104
|
-
onError: {
|
|
105
|
-
target: "display",
|
|
106
|
-
actions: "setError"
|
|
107
|
-
}
|
|
108
|
-
} },
|
|
109
|
-
error: { on: {
|
|
110
|
-
RETRY: {
|
|
111
|
-
target: "loading",
|
|
112
|
-
actions: "clearError"
|
|
113
|
-
},
|
|
114
|
-
CANCEL: { target: "closed" },
|
|
115
|
-
RESET: {
|
|
116
|
-
target: "idle",
|
|
117
|
-
actions: "resetContext"
|
|
118
|
-
}
|
|
119
|
-
} },
|
|
120
|
-
finished: { type: "final" },
|
|
121
|
-
closed: { type: "final" }
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
//#endregion
|
|
126
6
|
//#region src/modules/mandatory-consent/mandatoryConsentActor.ts
|
|
127
7
|
function createMandatoryConsentActor(options) {
|
|
128
8
|
return createActor(mandatoryConsentMachine, { input: { config: options.config } }).start();
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { t as api } from "./api-CqKwkjJ3.esm.js";
|
|
2
|
+
import { _ as endpoints } from "./events-CZ2ka3pu.esm.js";
|
|
3
|
+
import { i as fromPromise, n as assign, t as setup } from "./xstate.esm-D7D6CGwY.esm.js";
|
|
4
|
+
|
|
5
|
+
//#region src/modules/mandatory-consent/mandatoryConsentServices.ts
|
|
6
|
+
async function fetchMandatoryConsent(regulationType, signal) {
|
|
7
|
+
const res = await api.get(endpoints.getConsents, {
|
|
8
|
+
signal,
|
|
9
|
+
query: {
|
|
10
|
+
type: "MANDATORY",
|
|
11
|
+
language: "en",
|
|
12
|
+
regulationType
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
if (!res.ok) throw new Error(`GET ${endpoints.getConsents} failed: ${res.status} ${res.statusText}`);
|
|
16
|
+
return res.data;
|
|
17
|
+
}
|
|
18
|
+
async function submitMandatoryConsent(params, signal) {
|
|
19
|
+
const res = await api.post(endpoints.submitMlConsent, params, { signal });
|
|
20
|
+
if (!res.ok) throw new Error(`POST ${endpoints.submitMlConsent} failed: ${res.status} ${res.statusText}`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/modules/mandatory-consent/mandatoryConsentStateMachine.ts
|
|
25
|
+
const mandatoryConsentMachine = setup({
|
|
26
|
+
types: {
|
|
27
|
+
context: {},
|
|
28
|
+
events: {},
|
|
29
|
+
input: {}
|
|
30
|
+
},
|
|
31
|
+
actors: {
|
|
32
|
+
fetchConsent: fromPromise(async ({ input, signal }) => fetchMandatoryConsent(input.config.consentType, signal)),
|
|
33
|
+
submitConsent: fromPromise(async ({ input, signal }) => submitMandatoryConsent({ consents: [{
|
|
34
|
+
id: input.consentId,
|
|
35
|
+
isSigned: input.isSigned
|
|
36
|
+
}] }, signal))
|
|
37
|
+
},
|
|
38
|
+
actions: {
|
|
39
|
+
setConsent: assign(({ event }) => {
|
|
40
|
+
return {
|
|
41
|
+
consent: event.output.consents[0],
|
|
42
|
+
isSigned: false,
|
|
43
|
+
error: void 0
|
|
44
|
+
};
|
|
45
|
+
}),
|
|
46
|
+
toggleSigned: assign(({ context }) => ({ isSigned: !context.isSigned })),
|
|
47
|
+
setError: assign(({ event }) => ({ error: String(event.error) })),
|
|
48
|
+
clearError: assign({ error: () => void 0 }),
|
|
49
|
+
resetContext: assign(({ context }) => ({
|
|
50
|
+
config: context.config,
|
|
51
|
+
consent: void 0,
|
|
52
|
+
isSigned: false,
|
|
53
|
+
error: void 0
|
|
54
|
+
}))
|
|
55
|
+
},
|
|
56
|
+
guards: { canSubmit: ({ context }) => Boolean(context.consent?.id) && context.isSigned }
|
|
57
|
+
}).createMachine({
|
|
58
|
+
id: "mandatoryConsent",
|
|
59
|
+
initial: "idle",
|
|
60
|
+
context: ({ input }) => ({
|
|
61
|
+
config: input.config,
|
|
62
|
+
consent: void 0,
|
|
63
|
+
isSigned: false,
|
|
64
|
+
error: void 0
|
|
65
|
+
}),
|
|
66
|
+
states: {
|
|
67
|
+
idle: { on: { LOAD: {
|
|
68
|
+
target: "loading",
|
|
69
|
+
actions: "clearError"
|
|
70
|
+
} } },
|
|
71
|
+
loading: { invoke: {
|
|
72
|
+
id: "fetchConsent",
|
|
73
|
+
src: "fetchConsent",
|
|
74
|
+
input: ({ context }) => ({ config: context.config }),
|
|
75
|
+
onDone: {
|
|
76
|
+
target: "display",
|
|
77
|
+
actions: "setConsent"
|
|
78
|
+
},
|
|
79
|
+
onError: {
|
|
80
|
+
target: "error",
|
|
81
|
+
actions: "setError"
|
|
82
|
+
}
|
|
83
|
+
} },
|
|
84
|
+
display: { on: {
|
|
85
|
+
TOGGLE: { actions: "toggleSigned" },
|
|
86
|
+
SUBMIT: {
|
|
87
|
+
target: "submitting",
|
|
88
|
+
guard: "canSubmit"
|
|
89
|
+
},
|
|
90
|
+
CANCEL: { target: "closed" },
|
|
91
|
+
RETRY: {
|
|
92
|
+
target: "loading",
|
|
93
|
+
actions: "clearError"
|
|
94
|
+
}
|
|
95
|
+
} },
|
|
96
|
+
submitting: { invoke: {
|
|
97
|
+
id: "submitConsent",
|
|
98
|
+
src: "submitConsent",
|
|
99
|
+
input: ({ context }) => ({
|
|
100
|
+
consentId: context.consent?.id ?? "",
|
|
101
|
+
isSigned: context.isSigned
|
|
102
|
+
}),
|
|
103
|
+
onDone: { target: "finished" },
|
|
104
|
+
onError: {
|
|
105
|
+
target: "display",
|
|
106
|
+
actions: "setError"
|
|
107
|
+
}
|
|
108
|
+
} },
|
|
109
|
+
error: { on: {
|
|
110
|
+
RETRY: {
|
|
111
|
+
target: "loading",
|
|
112
|
+
actions: "clearError"
|
|
113
|
+
},
|
|
114
|
+
CANCEL: { target: "closed" },
|
|
115
|
+
RESET: {
|
|
116
|
+
target: "idle",
|
|
117
|
+
actions: "resetContext"
|
|
118
|
+
}
|
|
119
|
+
} },
|
|
120
|
+
finished: { type: "final" },
|
|
121
|
+
closed: { type: "final" }
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
//#endregion
|
|
126
|
+
export { mandatoryConsentMachine as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as __toDynamicImportESM } from "./chunk-
|
|
1
|
+
import { a as __toDynamicImportESM } from "./chunk-Qw4qVmMx.esm.js";
|
|
2
2
|
|
|
3
3
|
//#region ../infra/src/providers/browser/openviduLazy.ts
|
|
4
4
|
let openViduImport;
|
|
5
5
|
async function loadOpenVidu() {
|
|
6
6
|
if (openViduImport) return openViduImport;
|
|
7
|
-
openViduImport = import("./lib-
|
|
7
|
+
openViduImport = import("./lib-CxDxnzRd.esm.js").then(__toDynamicImportESM(1));
|
|
8
8
|
return openViduImport;
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as stopCameraStream, r as requestCameraAccess } from "./camera-
|
|
2
|
-
import { t as MotionSensorProvider } from "./MotionSensorProvider-
|
|
1
|
+
import { i as stopCameraStream, r as requestCameraAccess } from "./camera-B-5traWf.esm.js";
|
|
2
|
+
import { t as MotionSensorProvider } from "./MotionSensorProvider-BLnFo6My.esm.js";
|
|
3
3
|
|
|
4
4
|
//#region ../infra/src/media/permissions.ts
|
|
5
5
|
async function queryPermission(name) {
|
package/dist/phone.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./Manager-
|
|
2
|
-
import "./Actor-
|
|
3
|
-
import { a as phoneMachine, n as PhoneState, o as PhoneConfig, r as createPhoneManager, t as PhoneManager } from "./phoneManager-
|
|
1
|
+
import "./Manager-Bcnemkyi.js";
|
|
2
|
+
import "./Actor-BkPcZGke.js";
|
|
3
|
+
import { a as phoneMachine, n as PhoneState, o as PhoneConfig, r as createPhoneManager, t as PhoneManager } from "./phoneManager-CCMCkyYr.js";
|
|
4
4
|
export { type PhoneConfig, type PhoneManager, type PhoneState, createPhoneManager, phoneMachine };
|
package/dist/phone.esm.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import "./api-
|
|
2
|
-
import "./events-
|
|
3
|
-
import "./xstate.esm-
|
|
4
|
-
import "./BrowserTimerProvider-
|
|
5
|
-
import {
|
|
1
|
+
import "./api-CqKwkjJ3.esm.js";
|
|
2
|
+
import "./events-CZ2ka3pu.esm.js";
|
|
3
|
+
import "./xstate.esm-D7D6CGwY.esm.js";
|
|
4
|
+
import "./BrowserTimerProvider-CSdm7__S.esm.js";
|
|
5
|
+
import { t as phoneMachine } from "./phoneStateMachine-B1t1Z-Dd.esm.js";
|
|
6
|
+
import { t as createPhoneManager } from "./phoneManager-Bvj6Jr4o.esm.js";
|
|
6
7
|
|
|
7
8
|
export { createPhoneManager, phoneMachine };
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-CZ2ka3pu.esm.js";
|
|
2
|
+
import { a as createActor, o as createManager } from "./xstate.esm-D7D6CGwY.esm.js";
|
|
3
|
+
import { t as phoneMachine } from "./phoneStateMachine-B1t1Z-Dd.esm.js";
|
|
4
|
+
|
|
5
|
+
//#region src/modules/phone/phoneActor.ts
|
|
6
|
+
function createPhoneActor(options) {
|
|
7
|
+
return createActor(phoneMachine, { input: { config: options.config } }).start();
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/modules/phone/phoneManager.ts
|
|
12
|
+
/**
|
|
13
|
+
* @module @incodetech/core/phone
|
|
14
|
+
*
|
|
15
|
+
* Phone verification module for the Incode Web SDK.
|
|
16
|
+
* Supports both headless (programmatic) and UI-driven usage patterns.
|
|
17
|
+
*
|
|
18
|
+
* ## Headless Usage
|
|
19
|
+
*
|
|
20
|
+
* The phone manager can be used entirely without UI for backend integrations,
|
|
21
|
+
* custom UI implementations, or automated workflows.
|
|
22
|
+
*
|
|
23
|
+
* @example Basic headless phone verification with OTP
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { createPhoneManager } from '@incodetech/core/phone';
|
|
26
|
+
* import { setup } from '@incodetech/core';
|
|
27
|
+
*
|
|
28
|
+
* // 1. Configure the SDK (required before using any module)
|
|
29
|
+
* setup({ apiURL: 'https://api.example.com', token: 'your-token' });
|
|
30
|
+
*
|
|
31
|
+
* // 2. Create the phone manager
|
|
32
|
+
* const phoneManager = createPhoneManager({
|
|
33
|
+
* config: {
|
|
34
|
+
* otpVerification: true,
|
|
35
|
+
* otpExpirationInMinutes: 5,
|
|
36
|
+
* prefill: false,
|
|
37
|
+
* maxOtpAttempts: 3,
|
|
38
|
+
* },
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* // 3. Subscribe to state changes (optional but recommended)
|
|
42
|
+
* phoneManager.subscribe((state) => {
|
|
43
|
+
* console.log('Phone state:', state.status);
|
|
44
|
+
* if (state.status === 'finished') {
|
|
45
|
+
* console.log('Phone verified successfully!');
|
|
46
|
+
* }
|
|
47
|
+
* if (state.status === 'error') {
|
|
48
|
+
* console.error('Error:', state.error);
|
|
49
|
+
* }
|
|
50
|
+
* });
|
|
51
|
+
*
|
|
52
|
+
* // 4. Start the flow
|
|
53
|
+
* phoneManager.load();
|
|
54
|
+
*
|
|
55
|
+
* // 5. When state is 'inputting', set the phone number
|
|
56
|
+
* phoneManager.setPhoneNumber('+14155551234', true);
|
|
57
|
+
*
|
|
58
|
+
* // 6. Submit the phone number
|
|
59
|
+
* phoneManager.submit();
|
|
60
|
+
*
|
|
61
|
+
* // 7. When state is 'awaitingOtp', submit the OTP code
|
|
62
|
+
* phoneManager.submitOtp('ABC123');
|
|
63
|
+
*
|
|
64
|
+
* // 8. Clean up when done
|
|
65
|
+
* phoneManager.stop();
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @example Polling-based headless usage
|
|
69
|
+
* ```typescript
|
|
70
|
+
* const phoneManager = createPhoneManager({ config });
|
|
71
|
+
*
|
|
72
|
+
* phoneManager.load();
|
|
73
|
+
*
|
|
74
|
+
* // Poll for state changes
|
|
75
|
+
* const interval = setInterval(() => {
|
|
76
|
+
* const state = phoneManager.getState();
|
|
77
|
+
*
|
|
78
|
+
* switch (state.status) {
|
|
79
|
+
* case 'inputting':
|
|
80
|
+
* phoneManager.setPhoneNumber('+14155551234', true);
|
|
81
|
+
* phoneManager.submit();
|
|
82
|
+
* break;
|
|
83
|
+
* case 'awaitingOtp':
|
|
84
|
+
* // Get OTP from user or external source
|
|
85
|
+
* phoneManager.submitOtp(otpCode);
|
|
86
|
+
* break;
|
|
87
|
+
* case 'finished':
|
|
88
|
+
* clearInterval(interval);
|
|
89
|
+
* phoneManager.stop();
|
|
90
|
+
* break;
|
|
91
|
+
* case 'error':
|
|
92
|
+
* clearInterval(interval);
|
|
93
|
+
* console.error(state.error);
|
|
94
|
+
* phoneManager.stop();
|
|
95
|
+
* break;
|
|
96
|
+
* }
|
|
97
|
+
* }, 100);
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
function mapState(snapshot) {
|
|
101
|
+
const typedSnapshot = snapshot;
|
|
102
|
+
const { context } = typedSnapshot;
|
|
103
|
+
if (typedSnapshot.matches("idle")) return { status: "idle" };
|
|
104
|
+
if (typedSnapshot.matches("loadingPrefill")) return { status: "loadingPrefill" };
|
|
105
|
+
if (typedSnapshot.matches("loadingStartInfo")) return {
|
|
106
|
+
status: "inputting",
|
|
107
|
+
countryCode: context.countryCode,
|
|
108
|
+
phonePrefix: context.phonePrefix,
|
|
109
|
+
prefilledPhone: context.prefilledPhone,
|
|
110
|
+
otpVerification: context.config.otpVerification,
|
|
111
|
+
optinEnabled: context.config.optinEnabled ?? false
|
|
112
|
+
};
|
|
113
|
+
if (typedSnapshot.matches("inputting")) return {
|
|
114
|
+
status: "inputting",
|
|
115
|
+
countryCode: context.countryCode,
|
|
116
|
+
phonePrefix: context.phonePrefix,
|
|
117
|
+
prefilledPhone: context.prefilledPhone,
|
|
118
|
+
phoneError: context.phoneError,
|
|
119
|
+
otpVerification: context.config.otpVerification,
|
|
120
|
+
optinEnabled: context.config.optinEnabled ?? false
|
|
121
|
+
};
|
|
122
|
+
if (typedSnapshot.matches("submitting")) return { status: "submitting" };
|
|
123
|
+
if (typedSnapshot.matches("resendingOtp")) return { status: "resendingOtp" };
|
|
124
|
+
if (typedSnapshot.matches("sendingInitialOtp")) return { status: "sendingInitialOtp" };
|
|
125
|
+
if (typedSnapshot.matches("awaitingOtp")) return {
|
|
126
|
+
status: "awaitingOtp",
|
|
127
|
+
resendTimer: context.resendTimer,
|
|
128
|
+
canResend: !context.resendTimerActive,
|
|
129
|
+
attemptsRemaining: context.attemptsRemaining
|
|
130
|
+
};
|
|
131
|
+
if (typedSnapshot.matches("verifyingOtp")) return {
|
|
132
|
+
status: "verifyingOtp",
|
|
133
|
+
resendTimer: context.resendTimer,
|
|
134
|
+
canResend: !context.resendTimerActive
|
|
135
|
+
};
|
|
136
|
+
if (typedSnapshot.matches("otpError")) return {
|
|
137
|
+
status: "otpError",
|
|
138
|
+
otpError: context.otpError ?? "otp.errorv2",
|
|
139
|
+
attemptsRemaining: context.attemptsRemaining,
|
|
140
|
+
resendTimer: context.resendTimer,
|
|
141
|
+
canResend: !context.resendTimerActive
|
|
142
|
+
};
|
|
143
|
+
if (typedSnapshot.matches("finished")) return { status: "finished" };
|
|
144
|
+
if (typedSnapshot.matches("error")) return {
|
|
145
|
+
status: "error",
|
|
146
|
+
error: context.error ?? "An error occurred"
|
|
147
|
+
};
|
|
148
|
+
return { status: "idle" };
|
|
149
|
+
}
|
|
150
|
+
function createApi({ actor, trackElementClicked }) {
|
|
151
|
+
return {
|
|
152
|
+
load() {
|
|
153
|
+
actor.send({ type: "LOAD" });
|
|
154
|
+
},
|
|
155
|
+
setPhoneNumber(phone, isValid) {
|
|
156
|
+
actor.send({
|
|
157
|
+
type: "PHONE_CHANGED",
|
|
158
|
+
phone,
|
|
159
|
+
isValid
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
setOptInGranted(granted) {
|
|
163
|
+
actor.send({
|
|
164
|
+
type: "OPT_IN_CHANGED",
|
|
165
|
+
granted
|
|
166
|
+
});
|
|
167
|
+
},
|
|
168
|
+
submit() {
|
|
169
|
+
trackElementClicked?.("submit");
|
|
170
|
+
actor.send({ type: "SUBMIT" });
|
|
171
|
+
},
|
|
172
|
+
setOtpCode(code) {
|
|
173
|
+
actor.send({
|
|
174
|
+
type: "OTP_CHANGED",
|
|
175
|
+
code
|
|
176
|
+
});
|
|
177
|
+
},
|
|
178
|
+
submitOtp(code) {
|
|
179
|
+
trackElementClicked?.("submitOtp");
|
|
180
|
+
actor.send({
|
|
181
|
+
type: "OTP_CHANGED",
|
|
182
|
+
code
|
|
183
|
+
});
|
|
184
|
+
actor.send({ type: "VERIFY_OTP" });
|
|
185
|
+
},
|
|
186
|
+
resendOtp() {
|
|
187
|
+
trackElementClicked?.("resendOtp");
|
|
188
|
+
actor.send({ type: "RESEND_OTP" });
|
|
189
|
+
},
|
|
190
|
+
back() {
|
|
191
|
+
trackElementClicked?.("back");
|
|
192
|
+
actor.send({ type: "BACK" });
|
|
193
|
+
},
|
|
194
|
+
reset() {
|
|
195
|
+
actor.send({ type: "RESET" });
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Creates a phone verification manager for headless or UI-driven usage.
|
|
201
|
+
*
|
|
202
|
+
* The manager provides a state machine-based API for phone number verification
|
|
203
|
+
* with optional OTP (one-time password) verification.
|
|
204
|
+
*
|
|
205
|
+
* @param options - Configuration options
|
|
206
|
+
* @param options.config - Phone verification configuration
|
|
207
|
+
* @param options.config.otpVerification - Whether to require OTP verification
|
|
208
|
+
* @param options.config.otpExpirationInMinutes - How long the OTP is valid
|
|
209
|
+
* @param options.config.prefill - Whether to fetch a pre-filled phone number
|
|
210
|
+
* @param options.config.isInstantVerify - Use instant verification API
|
|
211
|
+
* @param options.config.optinEnabled - Show marketing opt-in checkbox
|
|
212
|
+
* @param options.config.maxOtpAttempts - Maximum OTP verification attempts (default: 3)
|
|
213
|
+
*
|
|
214
|
+
* @returns Phone manager with state, API methods, and subscription
|
|
215
|
+
*
|
|
216
|
+
* @example Headless usage
|
|
217
|
+
* ```typescript
|
|
218
|
+
* const manager = createPhoneManager({
|
|
219
|
+
* config: { otpVerification: true, otpExpirationInMinutes: 5, prefill: false },
|
|
220
|
+
* });
|
|
221
|
+
*
|
|
222
|
+
* manager.subscribe((state) => console.log(state.status));
|
|
223
|
+
* manager.load();
|
|
224
|
+
* manager.setPhoneNumber('+14155551234', true);
|
|
225
|
+
* manager.submit();
|
|
226
|
+
* // ... wait for 'awaitingOtp' state ...
|
|
227
|
+
* manager.submitOtp('ABC123');
|
|
228
|
+
* manager.stop();
|
|
229
|
+
* ```
|
|
230
|
+
*
|
|
231
|
+
* @example With React/Preact UI hook
|
|
232
|
+
* ```tsx
|
|
233
|
+
* const [state, manager] = useManager(() => createPhoneManager({ config }));
|
|
234
|
+
*
|
|
235
|
+
* if (state.status === 'inputting') {
|
|
236
|
+
* return <input onChange={(e) => manager.setPhoneNumber(e.target.value, true)} />;
|
|
237
|
+
* }
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
function createPhoneManager(options) {
|
|
241
|
+
return createManager({
|
|
242
|
+
actor: createPhoneActor(options),
|
|
243
|
+
mapState,
|
|
244
|
+
createApi,
|
|
245
|
+
instrumentation: createManagerInstrumentation(eventModuleNames.phone)
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
function createPhoneManagerFromActor(actor) {
|
|
249
|
+
return createManager({
|
|
250
|
+
actor,
|
|
251
|
+
mapState,
|
|
252
|
+
createApi,
|
|
253
|
+
instrumentation: createManagerInstrumentation(eventModuleNames.phone)
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
//#endregion
|
|
258
|
+
export { createPhoneManagerFromActor as n, createPhoneManager as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as Manager } from "./Manager-
|
|
2
|
-
import { t as ActorRefFrom } from "./Actor-
|
|
1
|
+
import { t as Manager } from "./Manager-Bcnemkyi.js";
|
|
2
|
+
import { t as ActorRefFrom } from "./Actor-BkPcZGke.js";
|
|
3
3
|
|
|
4
4
|
//#region src/modules/phone/types.d.ts
|
|
5
5
|
|