@incodetech/core 0.0.0-dev-20260819-0bebbdc2 → 0.0.0-dev-20260819-1e7df894

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/{BrowserDiagnosticsCryptoProvider-6aqaVS6s.esm.js → BrowserDiagnosticsCryptoProvider-Dym2LDVf.esm.js} +1 -1
  2. package/dist/ae-signature.esm.js +1 -1
  3. package/dist/{apiError-C8O9Jo18.esm.js → apiError-DoY2131f.esm.js} +1 -1
  4. package/dist/authentication.esm.js +2 -2
  5. package/dist/{authenticationManager-BDwG2MBg.esm.js → authenticationManager-DAJKY_Hl.esm.js} +2 -2
  6. package/dist/{authenticationStateMachine-B_k1nxxF.esm.js → authenticationStateMachine-RL1XO40P.esm.js} +2 -2
  7. package/dist/{deepsightLoader-DZOieIHK.esm.js → deepsightLoader-B-Zift9C.esm.js} +3 -3
  8. package/dist/document-capture.d.ts +1 -1
  9. package/dist/{documentCaptureManager-B3t0ydtg.d.ts → documentCaptureManager-BykkLCQD.d.ts} +1 -1
  10. package/dist/dynamic-forms.esm.js +2 -2
  11. package/dist/{dynamicFormsManager-CA2tDe_k.esm.js → dynamicFormsManager-CcdW0DQC.esm.js} +1 -1
  12. package/dist/{dynamicFormsStateMachine-B4vHfk-3.esm.js → dynamicFormsStateMachine-D7uORLn9.esm.js} +1 -1
  13. package/dist/ekyb.esm.js +3 -3
  14. package/dist/{ekybManager-DCQJu92m.esm.js → ekybManager-CsWs60XQ.esm.js} +1 -1
  15. package/dist/{ekybStateMachine-DcNX5OXv.esm.js → ekybStateMachine-CA6zP4H6.esm.js} +1 -1
  16. package/dist/electronic-signature.esm.js +1 -1
  17. package/dist/{electronicSignatureManager-C8pORqlF.esm.js → electronicSignatureManager-DOXEL0RW.esm.js} +1 -1
  18. package/dist/extensibility.d.ts +3 -2
  19. package/dist/extensibility.esm.js +11 -10
  20. package/dist/{faceCaptureManagerFactory-DccAZCel.esm.js → faceCaptureManagerFactory-LtiMtH7F.esm.js} +1 -1
  21. package/dist/{faceCaptureSetup-eQ57H0LP.esm.js → faceCaptureSetup-Bmu-w4Bx.esm.js} +2 -2
  22. package/dist/fiscal-qr.d.ts +2 -56
  23. package/dist/fiscal-qr.esm.js +2 -308
  24. package/dist/fiscalQrManager-B5X-o5di.esm.js +311 -0
  25. package/dist/fiscalQrManager-CHcBJwUM.d.ts +68 -0
  26. package/dist/flow.esm.js +3 -3
  27. package/dist/{flowCompletionService-C6llWAAo.esm.js → flowCompletionService-8SgdkzNu.esm.js} +1 -1
  28. package/dist/{flowServices-BwFbhVDV.esm.js → flowServices-CS-gZQy3.esm.js} +3 -3
  29. package/dist/geolocation.esm.js +2 -2
  30. package/dist/{geolocationManager-DIiUsJfx.esm.js → geolocationManager-CQYoM_W5.esm.js} +1 -1
  31. package/dist/{geolocationStateMachine-C0RXwD9o.esm.js → geolocationStateMachine-CTP4h5aW.esm.js} +1 -1
  32. package/dist/id-selfie-flow.esm.js +6 -6
  33. package/dist/id.esm.js +3 -3
  34. package/dist/{idCaptureManager-NBeR-cgG.esm.js → idCaptureManager-BaHXvciD.esm.js} +2 -2
  35. package/dist/{idCaptureServices-p3NtcUxw.esm.js → idCaptureServices-Ub_gVri7.esm.js} +2 -2
  36. package/dist/{idCaptureStateMachine-BKbLET7m.esm.js → idCaptureStateMachine-CIgy6lmF.esm.js} +7 -7
  37. package/dist/index.esm.js +1 -1
  38. package/dist/{onDeviceFaceResults-DFirNde6.esm.js → onDeviceFaceResults-CB_SSBQK.esm.js} +3 -3
  39. package/dist/personhood.esm.js +3 -3
  40. package/dist/qe-signature.esm.js +1 -1
  41. package/dist/{recordingService-Cs-zgcly.esm.js → recordingService-B_AZuLkf.esm.js} +1 -1
  42. package/dist/{runChildModule-CJBpdJ9L.esm.js → runChildModule-BcQfHARx.esm.js} +1 -1
  43. package/dist/selfie.esm.js +4 -4
  44. package/dist/{selfieManager-C6nSxXbC.esm.js → selfieManager-BGmDX_0P.esm.js} +2 -2
  45. package/dist/{selfieStateMachine-CNBYEUhy.esm.js → selfieStateMachine-pXuKHOcE.esm.js} +2 -2
  46. package/dist/{session-BpBMD2qe.esm.js → session-D892ZKOf.esm.js} +4 -4
  47. package/dist/session.esm.js +4 -4
  48. package/dist/{sessionInitializer-CNBU6Zmm.esm.js → sessionInitializer-TZMpCMez.esm.js} +2 -2
  49. package/dist/{setup-MP1cPm8J.esm.js → setup-Ddy2FNq7.esm.js} +4 -4
  50. package/dist/trueSight-85AwiOlo.esm.js +1 -0
  51. package/dist/{trueSightService-7S24UFNk.esm.js → trueSightService-DlQshgGQ.esm.js} +2 -2
  52. package/dist/video-selfie.esm.js +3 -3
  53. package/dist/{videoSelfieCameraWarmer-BIRjIgms.esm.js → videoSelfieCameraWarmer-D_83WY3F.esm.js} +2 -2
  54. package/dist/wasm.esm.js +1 -1
  55. package/dist/workflow.esm.js +14 -14
  56. package/package.json +1 -1
  57. package/dist/trueSight-B42F3cH3.esm.js +0 -1
@@ -1,308 +1,2 @@
1
- import { t as BrowserTimerProvider } from "./BrowserTimerProvider-BXhgNxLt.esm.js";
2
- import { t as api } from "./api-Bx3gKW_y.esm.js";
3
- import { n as eventModuleNames, o as createManagerInstrumentation, v as addEvent } from "./events-CxfNJVZW.esm.js";
4
- import { t as endpoints } from "./endpoints-CCzL3XD_.esm.js";
5
- import { c as createManager, o as createActor, r as assign, t as setup } from "./xstate.esm-Cf4e0Cfd.esm.js";
6
- import { n as fromPromise, t as fromCallback } from "./xstate-actors.esm-CtI5S0f4.esm.js";
7
- import { a as stopCameraStream } from "./camera-_2sXMXiF.esm.js";
8
- import { n as getBackCameraStream } from "./backCameraStream-BMGalshK.esm.js";
9
- import { t as StreamCanvasCapture } from "./StreamCanvasCapture-D2XcXCZ4.esm.js";
10
- import { BrowserQRCodeReader } from "@zxing/browser";
11
- //#region src/modules/fiscal-qr/fiscalQrConstants.ts
12
- const SUCCESS_DISPLAY_MS = 1500;
13
- const PROCESSING_DISPLAY_MS = 3e3;
14
- const ERROR_DISPLAY_MS = 3e3;
15
- //#endregion
16
- //#region src/modules/fiscal-qr/qrCodeDecoder.ts
17
- function createQrCodeDecoder() {
18
- const reader = new BrowserQRCodeReader();
19
- return { decode(canvas) {
20
- try {
21
- const text = reader.decodeFromCanvas(canvas.canvas).getText().trim();
22
- return text.length > 0 ? text : void 0;
23
- } catch {
24
- return;
25
- }
26
- } };
27
- }
28
- //#endregion
29
- //#region src/modules/fiscal-qr/fiscalQrUtils.ts
30
- /**
31
- * Continuously decodes QR codes from an existing frame capturer until the first
32
- * hit.
33
- *
34
- * When `applyFocusDelay` is true, waits {@link INITIAL_FOCUS_DELAY_MS} (camera
35
- * focus) before the first attempt; otherwise scans immediately. Either way it
36
- * then retries every {@link SCAN_INTERVAL_MS}. `onDetected` fires at most once.
37
- *
38
- * Takes a shared {@link StreamCanvasCapture} rather than a stream on purpose:
39
- * the capturer (and its hidden video) is created once for the camera session
40
- * and reused across scan restarts, so re-entering scanning never spins up a new
41
- * stream consumer — which would briefly disturb the visible camera feed.
42
- *
43
- * @returns a cleanup function that stops the scan loop. It does NOT dispose the
44
- * capturer or stop the camera — the caller owns those lifecycles.
45
- */
46
- function startQrScan(frameCapturer, onDetected, applyFocusDelay = true) {
47
- const decoder = createQrCodeDecoder();
48
- const timer = BrowserTimerProvider.getInstance();
49
- let disposed = false;
50
- let hasDetected = false;
51
- let scanInterval;
52
- let focusDelay;
53
- const scan = () => {
54
- if (disposed || hasDetected) return;
55
- const canvas = frameCapturer.getLatestCanvas();
56
- if (!canvas) return;
57
- try {
58
- const link = decoder.decode(canvas);
59
- if (link && !disposed && !hasDetected) {
60
- hasDetected = true;
61
- onDetected(link);
62
- }
63
- } finally {
64
- canvas.dispose();
65
- }
66
- };
67
- const beginScanning = () => {
68
- scan();
69
- scanInterval = timer.setInterval(scan, 500);
70
- };
71
- if (applyFocusDelay) focusDelay = timer.setTimeout(beginScanning, 800);
72
- else beginScanning();
73
- return () => {
74
- disposed = true;
75
- if (focusDelay !== void 0) timer.clearTimeout(focusDelay);
76
- if (scanInterval !== void 0) timer.clearInterval(scanInterval);
77
- };
78
- }
79
- //#endregion
80
- //#region src/modules/fiscal-qr/fiscalQrServices.ts
81
- /**
82
- * Submits a scanned Fiscal QR link to the backend.
83
- *
84
- * Throws when the request fails OR when the backend rejects the link
85
- * (`success === false`), so callers can retry/skip — matching the legacy SDK
86
- * which only advanced when `postResp.success` was truthy.
87
- */
88
- async function submitFiscalQrLink(params, signal) {
89
- const res = await api.post(endpoints.addFiscalQrLink, params, { signal });
90
- if (!res.ok) throw new Error(`POST failed: ${res.status}`);
91
- if (res.data?.success !== true) throw new Error("Fiscal QR link was not accepted");
92
- return res.data;
93
- }
94
- //#endregion
95
- //#region src/modules/fiscal-qr/fiscalQrStateMachine.ts
96
- const fiscalQrMachine = setup({
97
- types: {
98
- context: {},
99
- events: {},
100
- input: {}
101
- },
102
- actors: {
103
- initCamera: fromPromise(async () => {
104
- const { stream } = await getBackCameraStream(void 0);
105
- return {
106
- stream,
107
- frameCapturer: new StreamCanvasCapture(stream, { fps: 10 })
108
- };
109
- }),
110
- submitFiscalQrLink: fromPromise(async ({ input, signal }) => {
111
- await submitFiscalQrLink({ poaUrl: input.link }, signal);
112
- }),
113
- detectQrCode: fromCallback(({ input, sendBack }) => {
114
- if (!input.frameCapturer) return () => {};
115
- return startQrScan(input.frameCapturer, (link) => {
116
- sendBack({
117
- type: "QR_DETECTED",
118
- link
119
- });
120
- }, input.applyFocusDelay);
121
- })
122
- },
123
- actions: {
124
- setLink: assign(({ event }) => {
125
- if (event.type !== "QR_DETECTED") return {};
126
- return {
127
- link: event.link,
128
- error: void 0
129
- };
130
- }),
131
- setError: assign(({ event }) => ({ error: event.error?.message ?? "Submit failed" })),
132
- setStream: assign(({ event }) => {
133
- const { stream, frameCapturer } = event.output;
134
- return {
135
- stream,
136
- frameCapturer,
137
- error: void 0
138
- };
139
- }),
140
- stopStream: assign(({ context }) => {
141
- context.frameCapturer?.dispose();
142
- if (context.stream) stopCameraStream(context.stream);
143
- return {
144
- stream: void 0,
145
- frameCapturer: void 0
146
- };
147
- }),
148
- incrementAttempts: assign(({ context }) => ({ attempts: context.attempts + 1 })),
149
- resetSession: assign(() => ({
150
- link: "",
151
- error: void 0,
152
- attempts: 0
153
- })),
154
- trackSuccess: () => addEvent({
155
- code: "complete",
156
- module: eventModuleNames.fiscalQr
157
- })
158
- },
159
- guards: { isMaxAttemptsReached: ({ context }) => context.attempts + 1 >= 3 }
160
- }).createMachine({
161
- id: "fiscalQr",
162
- initial: "idle",
163
- context: ({ input }) => ({
164
- config: input.config,
165
- link: "",
166
- stream: void 0,
167
- error: void 0,
168
- attempts: 0
169
- }),
170
- on: { SKIP: ".finished" },
171
- states: {
172
- idle: { on: {
173
- LOAD: "idle",
174
- CONTINUE: {
175
- target: "initCamera",
176
- actions: "resetSession"
177
- }
178
- } },
179
- initCamera: { invoke: {
180
- id: "initCamera",
181
- src: "initCamera",
182
- input: void 0,
183
- onDone: {
184
- target: "scanning",
185
- actions: "setStream"
186
- },
187
- onError: {
188
- target: "scanning",
189
- actions: "setError"
190
- }
191
- } },
192
- scanning: {
193
- invoke: {
194
- id: "detectQrCode",
195
- src: "detectQrCode",
196
- input: ({ context }) => ({
197
- frameCapturer: context.frameCapturer,
198
- applyFocusDelay: context.attempts === 0
199
- })
200
- },
201
- on: {
202
- QR_DETECTED: {
203
- target: "submitting",
204
- actions: "setLink"
205
- },
206
- RESET: {
207
- target: "idle",
208
- actions: "stopStream"
209
- }
210
- }
211
- },
212
- submitting: { invoke: {
213
- id: "submitFiscalQrLink",
214
- src: "submitFiscalQrLink",
215
- input: ({ context }) => ({ link: context.link }),
216
- onDone: {
217
- target: "success",
218
- actions: "trackSuccess"
219
- },
220
- onError: [{
221
- target: "finished",
222
- guard: "isMaxAttemptsReached",
223
- actions: ["incrementAttempts", "setError"]
224
- }, {
225
- target: "error",
226
- actions: ["incrementAttempts", "setError"]
227
- }]
228
- } },
229
- success: { after: { [SUCCESS_DISPLAY_MS]: "processing" } },
230
- processing: {
231
- entry: "stopStream",
232
- after: { [PROCESSING_DISPLAY_MS]: "verified" }
233
- },
234
- verified: { after: { [PROCESSING_DISPLAY_MS]: "finished" } },
235
- error: { after: { [ERROR_DISPLAY_MS]: "scanning" } },
236
- finished: {
237
- type: "final",
238
- entry: "stopStream"
239
- }
240
- }
241
- });
242
- //#endregion
243
- //#region src/modules/fiscal-qr/fiscalQrActor.ts
244
- /**
245
- * Creates and starts a Fiscal QR actor.
246
- * The actor begins in 'idle' state, ready to receive events.
247
- */
248
- function createFiscalQrActor(options) {
249
- return createActor(fiscalQrMachine, { input: { config: options.config } }).start();
250
- }
251
- //#endregion
252
- //#region src/modules/fiscal-qr/fiscalQrManager.ts
253
- function mapState(snapshot) {
254
- const typedSnapshot = snapshot;
255
- const { stream, error, attempts } = typedSnapshot.context;
256
- if (typedSnapshot.matches("idle")) return { status: "idle" };
257
- if (typedSnapshot.matches("initCamera") || typedSnapshot.matches("scanning")) return {
258
- status: "scanning",
259
- stream,
260
- error
261
- };
262
- if (typedSnapshot.matches("submitting")) return {
263
- status: "capturing",
264
- stream
265
- };
266
- if (typedSnapshot.matches("success")) return {
267
- status: "success",
268
- stream
269
- };
270
- if (typedSnapshot.matches("processing")) return { status: "processing" };
271
- if (typedSnapshot.matches("verified")) return { status: "verified" };
272
- if (typedSnapshot.matches("error")) return {
273
- status: "error",
274
- error,
275
- attempts,
276
- stream
277
- };
278
- if (typedSnapshot.matches("finished")) return { status: "finished" };
279
- return { status: "idle" };
280
- }
281
- function createApi({ actor, trackElementClicked }) {
282
- return {
283
- load() {
284
- actor.send({ type: "LOAD" });
285
- },
286
- continue() {
287
- trackElementClicked?.("continue");
288
- actor.send({ type: "CONTINUE" });
289
- },
290
- skip() {
291
- trackElementClicked?.("skip");
292
- actor.send({ type: "SKIP" });
293
- },
294
- reset() {
295
- actor.send({ type: "RESET" });
296
- }
297
- };
298
- }
299
- function createFiscalQrManager(options) {
300
- return createManager({
301
- actor: createFiscalQrActor(options),
302
- mapState,
303
- createApi,
304
- instrumentation: createManagerInstrumentation(eventModuleNames.fiscalQr)
305
- });
306
- }
307
- //#endregion
308
- export { createFiscalQrManager, fiscalQrMachine };
1
+ import { n as createFiscalQrManagerFromActor, r as fiscalQrMachine, t as createFiscalQrManager } from "./fiscalQrManager-B5X-o5di.esm.js";
2
+ export { createFiscalQrManager, createFiscalQrManagerFromActor, fiscalQrMachine };
@@ -0,0 +1,311 @@
1
+ import { t as BrowserTimerProvider } from "./BrowserTimerProvider-BXhgNxLt.esm.js";
2
+ import { t as api } from "./api-Bx3gKW_y.esm.js";
3
+ import { n as eventModuleNames, o as createManagerInstrumentation, v as addEvent } from "./events-CxfNJVZW.esm.js";
4
+ import { t as endpoints } from "./endpoints-CCzL3XD_.esm.js";
5
+ import { c as createManager, o as createActor, r as assign, t as setup } from "./xstate.esm-Cf4e0Cfd.esm.js";
6
+ import { n as fromPromise, t as fromCallback } from "./xstate-actors.esm-CtI5S0f4.esm.js";
7
+ import { a as stopCameraStream } from "./camera-_2sXMXiF.esm.js";
8
+ import { n as getBackCameraStream } from "./backCameraStream-BMGalshK.esm.js";
9
+ import { t as StreamCanvasCapture } from "./StreamCanvasCapture-D2XcXCZ4.esm.js";
10
+ import { BrowserQRCodeReader } from "@zxing/browser";
11
+ //#region src/modules/fiscal-qr/fiscalQrConstants.ts
12
+ const SUCCESS_DISPLAY_MS = 1500;
13
+ const PROCESSING_DISPLAY_MS = 3e3;
14
+ const ERROR_DISPLAY_MS = 3e3;
15
+ //#endregion
16
+ //#region src/modules/fiscal-qr/qrCodeDecoder.ts
17
+ function createQrCodeDecoder() {
18
+ const reader = new BrowserQRCodeReader();
19
+ return { decode(canvas) {
20
+ try {
21
+ const text = reader.decodeFromCanvas(canvas.canvas).getText().trim();
22
+ return text.length > 0 ? text : void 0;
23
+ } catch {
24
+ return;
25
+ }
26
+ } };
27
+ }
28
+ //#endregion
29
+ //#region src/modules/fiscal-qr/fiscalQrUtils.ts
30
+ /**
31
+ * Continuously decodes QR codes from an existing frame capturer until the first
32
+ * hit.
33
+ *
34
+ * When `applyFocusDelay` is true, waits {@link INITIAL_FOCUS_DELAY_MS} (camera
35
+ * focus) before the first attempt; otherwise scans immediately. Either way it
36
+ * then retries every {@link SCAN_INTERVAL_MS}. `onDetected` fires at most once.
37
+ *
38
+ * Takes a shared {@link StreamCanvasCapture} rather than a stream on purpose:
39
+ * the capturer (and its hidden video) is created once for the camera session
40
+ * and reused across scan restarts, so re-entering scanning never spins up a new
41
+ * stream consumer — which would briefly disturb the visible camera feed.
42
+ *
43
+ * @returns a cleanup function that stops the scan loop. It does NOT dispose the
44
+ * capturer or stop the camera — the caller owns those lifecycles.
45
+ */
46
+ function startQrScan(frameCapturer, onDetected, applyFocusDelay = true) {
47
+ const decoder = createQrCodeDecoder();
48
+ const timer = BrowserTimerProvider.getInstance();
49
+ let disposed = false;
50
+ let hasDetected = false;
51
+ let scanInterval;
52
+ let focusDelay;
53
+ const scan = () => {
54
+ if (disposed || hasDetected) return;
55
+ const canvas = frameCapturer.getLatestCanvas();
56
+ if (!canvas) return;
57
+ try {
58
+ const link = decoder.decode(canvas);
59
+ if (link && !disposed && !hasDetected) {
60
+ hasDetected = true;
61
+ onDetected(link);
62
+ }
63
+ } finally {
64
+ canvas.dispose();
65
+ }
66
+ };
67
+ const beginScanning = () => {
68
+ scan();
69
+ scanInterval = timer.setInterval(scan, 500);
70
+ };
71
+ if (applyFocusDelay) focusDelay = timer.setTimeout(beginScanning, 800);
72
+ else beginScanning();
73
+ return () => {
74
+ disposed = true;
75
+ if (focusDelay !== void 0) timer.clearTimeout(focusDelay);
76
+ if (scanInterval !== void 0) timer.clearInterval(scanInterval);
77
+ };
78
+ }
79
+ //#endregion
80
+ //#region src/modules/fiscal-qr/fiscalQrServices.ts
81
+ /**
82
+ * Submits a scanned Fiscal QR link to the backend.
83
+ *
84
+ * Throws when the request fails OR when the backend rejects the link
85
+ * (`success === false`), so callers can retry/skip — matching the legacy SDK
86
+ * which only advanced when `postResp.success` was truthy.
87
+ */
88
+ async function submitFiscalQrLink(params, signal) {
89
+ const res = await api.post(endpoints.addFiscalQrLink, params, { signal });
90
+ if (!res.ok) throw new Error(`POST failed: ${res.status}`);
91
+ if (res.data?.success !== true) throw new Error("Fiscal QR link was not accepted");
92
+ return res.data;
93
+ }
94
+ //#endregion
95
+ //#region src/modules/fiscal-qr/fiscalQrStateMachine.ts
96
+ const fiscalQrMachine = setup({
97
+ types: {
98
+ context: {},
99
+ events: {},
100
+ input: {}
101
+ },
102
+ actors: {
103
+ initCamera: fromPromise(async () => {
104
+ const { stream } = await getBackCameraStream(void 0);
105
+ return {
106
+ stream,
107
+ frameCapturer: new StreamCanvasCapture(stream, { fps: 10 })
108
+ };
109
+ }),
110
+ submitFiscalQrLink: fromPromise(async ({ input, signal }) => {
111
+ await submitFiscalQrLink({ poaUrl: input.link }, signal);
112
+ }),
113
+ detectQrCode: fromCallback(({ input, sendBack }) => {
114
+ if (!input.frameCapturer) return () => {};
115
+ return startQrScan(input.frameCapturer, (link) => {
116
+ sendBack({
117
+ type: "QR_DETECTED",
118
+ link
119
+ });
120
+ }, input.applyFocusDelay);
121
+ })
122
+ },
123
+ actions: {
124
+ setLink: assign(({ event }) => {
125
+ if (event.type !== "QR_DETECTED") return {};
126
+ return {
127
+ link: event.link,
128
+ error: void 0
129
+ };
130
+ }),
131
+ setError: assign(({ event }) => ({ error: event.error?.message ?? "Submit failed" })),
132
+ setStream: assign(({ event }) => {
133
+ const { stream, frameCapturer } = event.output;
134
+ return {
135
+ stream,
136
+ frameCapturer,
137
+ error: void 0
138
+ };
139
+ }),
140
+ stopStream: assign(({ context }) => {
141
+ context.frameCapturer?.dispose();
142
+ if (context.stream) stopCameraStream(context.stream);
143
+ return {
144
+ stream: void 0,
145
+ frameCapturer: void 0
146
+ };
147
+ }),
148
+ incrementAttempts: assign(({ context }) => ({ attempts: context.attempts + 1 })),
149
+ resetSession: assign(() => ({
150
+ link: "",
151
+ error: void 0,
152
+ attempts: 0
153
+ })),
154
+ trackSuccess: () => addEvent({
155
+ code: "complete",
156
+ module: eventModuleNames.fiscalQr
157
+ })
158
+ },
159
+ guards: { isMaxAttemptsReached: ({ context }) => context.attempts + 1 >= 3 }
160
+ }).createMachine({
161
+ id: "fiscalQr",
162
+ initial: "idle",
163
+ context: ({ input }) => ({
164
+ config: input.config,
165
+ link: "",
166
+ stream: void 0,
167
+ error: void 0,
168
+ attempts: 0
169
+ }),
170
+ on: { SKIP: ".finished" },
171
+ states: {
172
+ idle: { on: {
173
+ LOAD: "idle",
174
+ CONTINUE: {
175
+ target: "initCamera",
176
+ actions: "resetSession"
177
+ }
178
+ } },
179
+ initCamera: { invoke: {
180
+ id: "initCamera",
181
+ src: "initCamera",
182
+ input: void 0,
183
+ onDone: {
184
+ target: "scanning",
185
+ actions: "setStream"
186
+ },
187
+ onError: {
188
+ target: "scanning",
189
+ actions: "setError"
190
+ }
191
+ } },
192
+ scanning: {
193
+ invoke: {
194
+ id: "detectQrCode",
195
+ src: "detectQrCode",
196
+ input: ({ context }) => ({
197
+ frameCapturer: context.frameCapturer,
198
+ applyFocusDelay: context.attempts === 0
199
+ })
200
+ },
201
+ on: {
202
+ QR_DETECTED: {
203
+ target: "submitting",
204
+ actions: "setLink"
205
+ },
206
+ RESET: {
207
+ target: "idle",
208
+ actions: "stopStream"
209
+ }
210
+ }
211
+ },
212
+ submitting: { invoke: {
213
+ id: "submitFiscalQrLink",
214
+ src: "submitFiscalQrLink",
215
+ input: ({ context }) => ({ link: context.link }),
216
+ onDone: {
217
+ target: "success",
218
+ actions: "trackSuccess"
219
+ },
220
+ onError: [{
221
+ target: "finished",
222
+ guard: "isMaxAttemptsReached",
223
+ actions: ["incrementAttempts", "setError"]
224
+ }, {
225
+ target: "error",
226
+ actions: ["incrementAttempts", "setError"]
227
+ }]
228
+ } },
229
+ success: { after: { [SUCCESS_DISPLAY_MS]: "processing" } },
230
+ processing: {
231
+ entry: "stopStream",
232
+ after: { [PROCESSING_DISPLAY_MS]: "verified" }
233
+ },
234
+ verified: { after: { [PROCESSING_DISPLAY_MS]: "finished" } },
235
+ error: { after: { [ERROR_DISPLAY_MS]: "scanning" } },
236
+ finished: {
237
+ type: "final",
238
+ entry: "stopStream"
239
+ }
240
+ }
241
+ });
242
+ //#endregion
243
+ //#region src/modules/fiscal-qr/fiscalQrActor.ts
244
+ /**
245
+ * Creates and starts a Fiscal QR actor.
246
+ * The actor begins in 'idle' state, ready to receive events.
247
+ */
248
+ function createFiscalQrActor(options) {
249
+ return createActor(fiscalQrMachine, { input: { config: options.config } }).start();
250
+ }
251
+ //#endregion
252
+ //#region src/modules/fiscal-qr/fiscalQrManager.ts
253
+ function mapState(snapshot) {
254
+ const typedSnapshot = snapshot;
255
+ const { stream, error, attempts } = typedSnapshot.context;
256
+ if (typedSnapshot.matches("idle")) return { status: "idle" };
257
+ if (typedSnapshot.matches("initCamera") || typedSnapshot.matches("scanning")) return {
258
+ status: "scanning",
259
+ stream,
260
+ error
261
+ };
262
+ if (typedSnapshot.matches("submitting")) return {
263
+ status: "capturing",
264
+ stream
265
+ };
266
+ if (typedSnapshot.matches("success")) return {
267
+ status: "success",
268
+ stream
269
+ };
270
+ if (typedSnapshot.matches("processing")) return { status: "processing" };
271
+ if (typedSnapshot.matches("verified")) return { status: "verified" };
272
+ if (typedSnapshot.matches("error")) return {
273
+ status: "error",
274
+ error,
275
+ attempts,
276
+ stream
277
+ };
278
+ if (typedSnapshot.matches("finished")) return { status: "finished" };
279
+ return { status: "idle" };
280
+ }
281
+ function createApi({ actor, trackElementClicked }) {
282
+ return {
283
+ load() {
284
+ actor.send({ type: "LOAD" });
285
+ },
286
+ continue() {
287
+ trackElementClicked?.("continue");
288
+ actor.send({ type: "CONTINUE" });
289
+ },
290
+ skip() {
291
+ trackElementClicked?.("skip");
292
+ actor.send({ type: "SKIP" });
293
+ },
294
+ reset() {
295
+ actor.send({ type: "RESET" });
296
+ }
297
+ };
298
+ }
299
+ function createFiscalQrManager(options) {
300
+ return createFiscalQrManagerFromActor(createFiscalQrActor(options));
301
+ }
302
+ function createFiscalQrManagerFromActor(actor) {
303
+ return createManager({
304
+ actor,
305
+ mapState,
306
+ createApi,
307
+ instrumentation: createManagerInstrumentation(eventModuleNames.fiscalQr)
308
+ });
309
+ }
310
+ //#endregion
311
+ export { createFiscalQrManagerFromActor as n, fiscalQrMachine as r, createFiscalQrManager as t };
@@ -0,0 +1,68 @@
1
+ import { i as ActorRefFrom } from "./spawn-D9jgw9pW.js";
2
+ import { t as Manager } from "./Manager-CQQ99QOI.js";
3
+ import "./Actor-iTq7YY48.js";
4
+ //#region src/modules/fiscal-qr/types.d.ts
5
+ /**
6
+ * Configuration options for the Fiscal QR module.
7
+ *
8
+ * The backend currently sends an empty module configuration for this step.
9
+ */
10
+ type FiscalQrConfig = Record<string, never>;
11
+ //#endregion
12
+ //#region src/modules/fiscal-qr/fiscalQrStateMachine.d.ts
13
+ declare const fiscalQrMachine: any;
14
+ type FiscalQrMachine = typeof fiscalQrMachine;
15
+ //#endregion
16
+ //#region src/modules/fiscal-qr/fiscalQrActor.d.ts
17
+ type FiscalQrActor = ActorRefFrom<FiscalQrMachine>;
18
+ //#endregion
19
+ //#region src/modules/fiscal-qr/fiscalQrManager.d.ts
20
+ type FiscalQrIdleState = {
21
+ status: 'idle';
22
+ };
23
+ type FiscalQrScanningState = {
24
+ status: 'scanning';
25
+ stream?: MediaStream;
26
+ error?: string;
27
+ };
28
+ type FiscalQrCapturingState = {
29
+ status: 'capturing';
30
+ stream?: MediaStream;
31
+ };
32
+ type FiscalQrSuccessState = {
33
+ status: 'success';
34
+ stream?: MediaStream;
35
+ };
36
+ type FiscalQrProcessingState = {
37
+ status: 'processing';
38
+ };
39
+ type FiscalQrErrorState = {
40
+ status: 'error';
41
+ error?: string;
42
+ attempts: number;
43
+ stream?: MediaStream;
44
+ };
45
+ type FiscalQrVerifiedState = {
46
+ status: 'verified';
47
+ };
48
+ type FiscalQrFinishedState = {
49
+ status: 'finished';
50
+ };
51
+ type FiscalQrState = FiscalQrIdleState | FiscalQrScanningState | FiscalQrCapturingState | FiscalQrSuccessState | FiscalQrProcessingState | FiscalQrErrorState | FiscalQrVerifiedState | FiscalQrFinishedState;
52
+ declare function createFiscalQrManager(options: {
53
+ config: FiscalQrConfig;
54
+ }): Manager<FiscalQrState> & {
55
+ load(): void;
56
+ continue(): void;
57
+ skip(): void;
58
+ reset(): void;
59
+ };
60
+ declare function createFiscalQrManagerFromActor(actor: FiscalQrActor): Manager<FiscalQrState> & {
61
+ load(): void;
62
+ continue(): void;
63
+ skip(): void;
64
+ reset(): void;
65
+ };
66
+ type FiscalQrManager = ReturnType<typeof createFiscalQrManager>;
67
+ //#endregion
68
+ export { FiscalQrActor as a, createFiscalQrManagerFromActor as i, FiscalQrState as n, fiscalQrMachine as o, createFiscalQrManager as r, FiscalQrConfig as s, FiscalQrManager as t };
package/dist/flow.esm.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { v as addEvent } from "./events-CxfNJVZW.esm.js";
2
- import { a as enrichFlowModuleConfig, c as resolveFlowModuleConfig, i as resolveDashboardModuleConfig, k as mergeDashboardConfig, n as preloadDashboardFlow, o as getRequiredWasmPipelines, s as normalizeFlowModules, t as getFlow } from "./flowServices-BwFbhVDV.esm.js";
2
+ import { a as enrichFlowModuleConfig, c as resolveFlowModuleConfig, i as resolveDashboardModuleConfig, k as mergeDashboardConfig, n as preloadDashboardFlow, o as getRequiredWasmPipelines, s as normalizeFlowModules, t as getFlow } from "./flowServices-CS-gZQy3.esm.js";
3
3
  import { c as createManager, o as createActor, r as assign, t as setup } from "./xstate.esm-Cf4e0Cfd.esm.js";
4
4
  import { n as fromPromise } from "./xstate-actors.esm-CtI5S0f4.esm.js";
5
- import { n as getFinishStatus, r as getTotalScoreStatus, t as classifyScoreStatus } from "./flowCompletionService-C6llWAAo.esm.js";
6
- import { n as isAdvanceableError, r as attachFlowEventEmitter, t as runChildModule } from "./runChildModule-CJBpdJ9L.esm.js";
5
+ import { n as getFinishStatus, r as getTotalScoreStatus, t as classifyScoreStatus } from "./flowCompletionService-8SgdkzNu.esm.js";
6
+ import { n as isAdvanceableError, r as attachFlowEventEmitter, t as runChildModule } from "./runChildModule-BcQfHARx.esm.js";
7
7
  //#region src/modules/flow/noOpFlowModuleMachine.ts
8
8
  const noOpFlowModuleMachine = setup({}).createMachine({
9
9
  id: "noOpFlowModule",