@incodetech/core 0.0.0-dev-20260309-4e885f1 → 0.0.0-dev-20260309-7c6c9b5
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/document-capture.d.ts +47 -47
- package/dist/document-upload.d.ts +46 -46
- package/dist/ekyc.d.ts +1 -0
- package/dist/ekyc.esm.js +116 -21
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as Manager } from "./Manager-CVog-etk.js";
|
|
2
2
|
import { t as CameraStream } from "./camera-HI2fNiV5.js";
|
|
3
|
-
import * as
|
|
3
|
+
import * as xstate0 from "xstate";
|
|
4
4
|
|
|
5
5
|
//#region src/modules/document-capture/types.d.ts
|
|
6
6
|
type DocumentType = 'addressStatement' | 'otherDocument1' | 'otherDocument2' | 'otherDocument3' | 'v5cMultiPageLogbook' | 'circulationCard' | 'financeSettlement' | 'carInvoice' | 'capture' | 'processPoaOcr' | 'processLoaOcr' | 'processAsylumSeekerVisaZaf' | 'processBankStatementOCR' | 'processBankCheck' | 'processV5CLogbook' | 'processCarInvoice' | 'processCirculationCard' | 'processFinanceSettlement';
|
|
@@ -72,7 +72,7 @@ type DocumentCaptureInput = {
|
|
|
72
72
|
};
|
|
73
73
|
//#endregion
|
|
74
74
|
//#region src/modules/document-capture/documentCaptureStateMachine.d.ts
|
|
75
|
-
declare const documentCaptureMachine:
|
|
75
|
+
declare const documentCaptureMachine: xstate0.StateMachine<DocumentCaptureContext, {
|
|
76
76
|
type: "CAPTURE";
|
|
77
77
|
} | {
|
|
78
78
|
type: "FILE_SELECTED";
|
|
@@ -95,43 +95,31 @@ declare const documentCaptureMachine: xstate63.StateMachine<DocumentCaptureConte
|
|
|
95
95
|
} | {
|
|
96
96
|
type: "CLOSE";
|
|
97
97
|
}, {
|
|
98
|
-
[x: string]:
|
|
98
|
+
[x: string]: xstate0.ActorRefFromLogic<xstate0.PromiseActorLogic<MediaStream, void, xstate0.EventObject>> | xstate0.ActorRefFromLogic<xstate0.PromiseActorLogic<DocumentUploadResponse, {
|
|
99
99
|
capturedDocument: NonNullable<DocumentCaptureContext["capturedDocument"]>;
|
|
100
100
|
processingType: string;
|
|
101
101
|
onProgress: (progress: number) => void;
|
|
102
|
-
},
|
|
103
|
-
},
|
|
102
|
+
}, xstate0.EventObject>> | undefined;
|
|
103
|
+
}, xstate0.Values<{
|
|
104
104
|
initCamera: {
|
|
105
105
|
src: "initCamera";
|
|
106
|
-
logic:
|
|
106
|
+
logic: xstate0.PromiseActorLogic<MediaStream, void, xstate0.EventObject>;
|
|
107
107
|
id: string | undefined;
|
|
108
108
|
};
|
|
109
109
|
uploadDocument: {
|
|
110
110
|
src: "uploadDocument";
|
|
111
|
-
logic:
|
|
111
|
+
logic: xstate0.PromiseActorLogic<DocumentUploadResponse, {
|
|
112
112
|
capturedDocument: NonNullable<DocumentCaptureContext["capturedDocument"]>;
|
|
113
113
|
processingType: string;
|
|
114
114
|
onProgress: (progress: number) => void;
|
|
115
|
-
},
|
|
115
|
+
}, xstate0.EventObject>;
|
|
116
116
|
id: string | undefined;
|
|
117
117
|
};
|
|
118
|
-
}>,
|
|
118
|
+
}>, xstate0.Values<{
|
|
119
119
|
setStream: {
|
|
120
120
|
type: "setStream";
|
|
121
121
|
params: unknown;
|
|
122
122
|
};
|
|
123
|
-
setProgress: {
|
|
124
|
-
type: "setProgress";
|
|
125
|
-
params: unknown;
|
|
126
|
-
};
|
|
127
|
-
clearError: {
|
|
128
|
-
type: "clearError";
|
|
129
|
-
params: unknown;
|
|
130
|
-
};
|
|
131
|
-
stopStream: {
|
|
132
|
-
type: "stopStream";
|
|
133
|
-
params: unknown;
|
|
134
|
-
};
|
|
135
123
|
setCapturedDocument: {
|
|
136
124
|
type: "setCapturedDocument";
|
|
137
125
|
params: unknown;
|
|
@@ -140,6 +128,10 @@ declare const documentCaptureMachine: xstate63.StateMachine<DocumentCaptureConte
|
|
|
140
128
|
type: "setFileTooLargeError";
|
|
141
129
|
params: unknown;
|
|
142
130
|
};
|
|
131
|
+
setProgress: {
|
|
132
|
+
type: "setProgress";
|
|
133
|
+
params: unknown;
|
|
134
|
+
};
|
|
143
135
|
setUploadError: {
|
|
144
136
|
type: "setUploadError";
|
|
145
137
|
params: unknown;
|
|
@@ -168,10 +160,18 @@ declare const documentCaptureMachine: xstate63.StateMachine<DocumentCaptureConte
|
|
|
168
160
|
type: "clearForNextPage";
|
|
169
161
|
params: unknown;
|
|
170
162
|
};
|
|
163
|
+
clearError: {
|
|
164
|
+
type: "clearError";
|
|
165
|
+
params: unknown;
|
|
166
|
+
};
|
|
171
167
|
resetProgress: {
|
|
172
168
|
type: "resetProgress";
|
|
173
169
|
params: unknown;
|
|
174
170
|
};
|
|
171
|
+
stopStream: {
|
|
172
|
+
type: "stopStream";
|
|
173
|
+
params: unknown;
|
|
174
|
+
};
|
|
175
175
|
trackTutorial: {
|
|
176
176
|
type: "trackTutorial";
|
|
177
177
|
params: unknown;
|
|
@@ -196,7 +196,7 @@ declare const documentCaptureMachine: xstate63.StateMachine<DocumentCaptureConte
|
|
|
196
196
|
type: "trackFailure";
|
|
197
197
|
params: unknown;
|
|
198
198
|
};
|
|
199
|
-
}>,
|
|
199
|
+
}>, xstate0.Values<{
|
|
200
200
|
allowSkip: {
|
|
201
201
|
type: "allowSkip";
|
|
202
202
|
params: unknown;
|
|
@@ -229,7 +229,7 @@ declare const documentCaptureMachine: xstate63.StateMachine<DocumentCaptureConte
|
|
|
229
229
|
type: "isPendingNextPage";
|
|
230
230
|
params: unknown;
|
|
231
231
|
};
|
|
232
|
-
}>, never, "initCamera" | "
|
|
232
|
+
}>, never, "initCamera" | "tutorial" | "capturing" | "preview" | "finished" | "closed" | "failure" | "uploading" | "success", string, DocumentCaptureInput, xstate0.NonReducibleUnknown, xstate0.EventObject, xstate0.MetaObject, {
|
|
233
233
|
readonly id: "documentCapture";
|
|
234
234
|
readonly initial: "tutorial";
|
|
235
235
|
readonly context: ({
|
|
@@ -238,67 +238,67 @@ declare const documentCaptureMachine: xstate63.StateMachine<DocumentCaptureConte
|
|
|
238
238
|
spawn: {
|
|
239
239
|
<TSrc extends "initCamera" | "uploadDocument">(logic: TSrc, ...[options]: ({
|
|
240
240
|
src: "initCamera";
|
|
241
|
-
logic:
|
|
241
|
+
logic: xstate0.PromiseActorLogic<MediaStream, void, xstate0.EventObject>;
|
|
242
242
|
id: string | undefined;
|
|
243
243
|
} extends infer T ? T extends {
|
|
244
244
|
src: "initCamera";
|
|
245
|
-
logic:
|
|
245
|
+
logic: xstate0.PromiseActorLogic<MediaStream, void, xstate0.EventObject>;
|
|
246
246
|
id: string | undefined;
|
|
247
247
|
} ? T extends {
|
|
248
248
|
src: TSrc;
|
|
249
|
-
} ?
|
|
249
|
+
} ? xstate0.ConditionalRequired<[options?: ({
|
|
250
250
|
id?: T["id"] | undefined;
|
|
251
251
|
systemId?: string;
|
|
252
|
-
input?:
|
|
252
|
+
input?: xstate0.InputFrom<T["logic"]> | undefined;
|
|
253
253
|
syncSnapshot?: boolean;
|
|
254
|
-
} & { [K in
|
|
254
|
+
} & { [K in xstate0.RequiredActorOptions<T>]: unknown }) | undefined], xstate0.IsNotNever<xstate0.RequiredActorOptions<T>>> : never : never : never) | ({
|
|
255
255
|
src: "uploadDocument";
|
|
256
|
-
logic:
|
|
256
|
+
logic: xstate0.PromiseActorLogic<DocumentUploadResponse, {
|
|
257
257
|
capturedDocument: NonNullable<DocumentCaptureContext["capturedDocument"]>;
|
|
258
258
|
processingType: string;
|
|
259
259
|
onProgress: (progress: number) => void;
|
|
260
|
-
},
|
|
260
|
+
}, xstate0.EventObject>;
|
|
261
261
|
id: string | undefined;
|
|
262
262
|
} extends infer T_1 ? T_1 extends {
|
|
263
263
|
src: "uploadDocument";
|
|
264
|
-
logic:
|
|
264
|
+
logic: xstate0.PromiseActorLogic<DocumentUploadResponse, {
|
|
265
265
|
capturedDocument: NonNullable<DocumentCaptureContext["capturedDocument"]>;
|
|
266
266
|
processingType: string;
|
|
267
267
|
onProgress: (progress: number) => void;
|
|
268
|
-
},
|
|
268
|
+
}, xstate0.EventObject>;
|
|
269
269
|
id: string | undefined;
|
|
270
270
|
} ? T_1 extends {
|
|
271
271
|
src: TSrc;
|
|
272
|
-
} ?
|
|
272
|
+
} ? xstate0.ConditionalRequired<[options?: ({
|
|
273
273
|
id?: T_1["id"] | undefined;
|
|
274
274
|
systemId?: string;
|
|
275
|
-
input?:
|
|
275
|
+
input?: xstate0.InputFrom<T_1["logic"]> | undefined;
|
|
276
276
|
syncSnapshot?: boolean;
|
|
277
|
-
} & { [K_1 in
|
|
277
|
+
} & { [K_1 in xstate0.RequiredActorOptions<T_1>]: unknown }) | undefined], xstate0.IsNotNever<xstate0.RequiredActorOptions<T_1>>> : never : never : never)): xstate0.ActorRefFromLogic<xstate0.GetConcreteByKey<xstate0.Values<{
|
|
278
278
|
initCamera: {
|
|
279
279
|
src: "initCamera";
|
|
280
|
-
logic:
|
|
280
|
+
logic: xstate0.PromiseActorLogic<MediaStream, void, xstate0.EventObject>;
|
|
281
281
|
id: string | undefined;
|
|
282
282
|
};
|
|
283
283
|
uploadDocument: {
|
|
284
284
|
src: "uploadDocument";
|
|
285
|
-
logic:
|
|
285
|
+
logic: xstate0.PromiseActorLogic<DocumentUploadResponse, {
|
|
286
286
|
capturedDocument: NonNullable<DocumentCaptureContext["capturedDocument"]>;
|
|
287
287
|
processingType: string;
|
|
288
288
|
onProgress: (progress: number) => void;
|
|
289
|
-
},
|
|
289
|
+
}, xstate0.EventObject>;
|
|
290
290
|
id: string | undefined;
|
|
291
291
|
};
|
|
292
292
|
}>, "src", TSrc>["logic"]>;
|
|
293
|
-
<TLogic extends
|
|
293
|
+
<TLogic extends xstate0.AnyActorLogic>(src: TLogic, ...[options]: xstate0.ConditionalRequired<[options?: ({
|
|
294
294
|
id?: never;
|
|
295
295
|
systemId?: string;
|
|
296
|
-
input?:
|
|
296
|
+
input?: xstate0.InputFrom<TLogic> | undefined;
|
|
297
297
|
syncSnapshot?: boolean;
|
|
298
|
-
} & { [K in
|
|
298
|
+
} & { [K in xstate0.RequiredLogicInput<TLogic>]: unknown }) | undefined], xstate0.IsNotNever<xstate0.RequiredLogicInput<TLogic>>>): xstate0.ActorRefFromLogic<TLogic>;
|
|
299
299
|
};
|
|
300
300
|
input: DocumentCaptureInput;
|
|
301
|
-
self:
|
|
301
|
+
self: xstate0.ActorRef<xstate0.MachineSnapshot<DocumentCaptureContext, {
|
|
302
302
|
type: "CAPTURE";
|
|
303
303
|
} | {
|
|
304
304
|
type: "FILE_SELECTED";
|
|
@@ -320,7 +320,7 @@ declare const documentCaptureMachine: xstate63.StateMachine<DocumentCaptureConte
|
|
|
320
320
|
type: "SKIP";
|
|
321
321
|
} | {
|
|
322
322
|
type: "CLOSE";
|
|
323
|
-
}, Record<string,
|
|
323
|
+
}, Record<string, xstate0.AnyActorRef | undefined>, xstate0.StateValue, string, unknown, any, any>, {
|
|
324
324
|
type: "CAPTURE";
|
|
325
325
|
} | {
|
|
326
326
|
type: "FILE_SELECTED";
|
|
@@ -342,7 +342,7 @@ declare const documentCaptureMachine: xstate63.StateMachine<DocumentCaptureConte
|
|
|
342
342
|
type: "SKIP";
|
|
343
343
|
} | {
|
|
344
344
|
type: "CLOSE";
|
|
345
|
-
},
|
|
345
|
+
}, xstate0.AnyEventObject>;
|
|
346
346
|
}) => {
|
|
347
347
|
config: {
|
|
348
348
|
processingType: DocumentType;
|
|
@@ -479,7 +479,7 @@ declare const documentCaptureMachine: xstate63.StateMachine<DocumentCaptureConte
|
|
|
479
479
|
} | {
|
|
480
480
|
type: "CLOSE";
|
|
481
481
|
};
|
|
482
|
-
self:
|
|
482
|
+
self: xstate0.ActorRef<xstate0.MachineSnapshot<DocumentCaptureContext, {
|
|
483
483
|
type: "CAPTURE";
|
|
484
484
|
} | {
|
|
485
485
|
type: "FILE_SELECTED";
|
|
@@ -501,7 +501,7 @@ declare const documentCaptureMachine: xstate63.StateMachine<DocumentCaptureConte
|
|
|
501
501
|
type: "SKIP";
|
|
502
502
|
} | {
|
|
503
503
|
type: "CLOSE";
|
|
504
|
-
}, Record<string,
|
|
504
|
+
}, Record<string, xstate0.AnyActorRef>, xstate0.StateValue, string, unknown, any, any>, {
|
|
505
505
|
type: "CAPTURE";
|
|
506
506
|
} | {
|
|
507
507
|
type: "FILE_SELECTED";
|
|
@@ -523,7 +523,7 @@ declare const documentCaptureMachine: xstate63.StateMachine<DocumentCaptureConte
|
|
|
523
523
|
type: "SKIP";
|
|
524
524
|
} | {
|
|
525
525
|
type: "CLOSE";
|
|
526
|
-
},
|
|
526
|
+
}, xstate0.AnyEventObject>;
|
|
527
527
|
}) => {
|
|
528
528
|
capturedDocument: CapturedDocument;
|
|
529
529
|
processingType: DocumentType;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as Manager } from "./Manager-CVog-etk.js";
|
|
2
2
|
import "./camera-HI2fNiV5.js";
|
|
3
3
|
import { n as DocumentUploadContext, r as DocumentUploadInput, t as DocumentUploadConfig } from "./types-B_l5fu_D.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as xstate58 from "xstate";
|
|
5
5
|
|
|
6
6
|
//#region src/modules/document-upload/documentUploadStateMachine.d.ts
|
|
7
|
-
declare const documentUploadMachine:
|
|
7
|
+
declare const documentUploadMachine: xstate58.StateMachine<DocumentUploadContext, {
|
|
8
8
|
type: "START";
|
|
9
9
|
} | {
|
|
10
10
|
type: "CAPTURE";
|
|
@@ -17,52 +17,52 @@ declare const documentUploadMachine: xstate0.StateMachine<DocumentUploadContext,
|
|
|
17
17
|
} | {
|
|
18
18
|
type: "CLOSE";
|
|
19
19
|
}, {
|
|
20
|
-
[x: string]:
|
|
20
|
+
[x: string]: xstate58.ActorRefFromLogic<xstate58.PromiseActorLogic<MediaStream, void, xstate58.EventObject>> | xstate58.ActorRefFromLogic<xstate58.PromiseActorLogic<void, {
|
|
21
21
|
imageBase64: string;
|
|
22
22
|
documentType: string;
|
|
23
23
|
onProgress: (progress: number) => void;
|
|
24
|
-
},
|
|
25
|
-
},
|
|
24
|
+
}, xstate58.EventObject>> | undefined;
|
|
25
|
+
}, xstate58.Values<{
|
|
26
26
|
initCamera: {
|
|
27
27
|
src: "initCamera";
|
|
28
|
-
logic:
|
|
28
|
+
logic: xstate58.PromiseActorLogic<MediaStream, void, xstate58.EventObject>;
|
|
29
29
|
id: string | undefined;
|
|
30
30
|
};
|
|
31
31
|
uploadDocument: {
|
|
32
32
|
src: "uploadDocument";
|
|
33
|
-
logic:
|
|
33
|
+
logic: xstate58.PromiseActorLogic<void, {
|
|
34
34
|
imageBase64: string;
|
|
35
35
|
documentType: string;
|
|
36
36
|
onProgress: (progress: number) => void;
|
|
37
|
-
},
|
|
37
|
+
}, xstate58.EventObject>;
|
|
38
38
|
id: string | undefined;
|
|
39
39
|
};
|
|
40
|
-
}>,
|
|
40
|
+
}>, xstate58.Values<{
|
|
41
41
|
setStream: {
|
|
42
42
|
type: "setStream";
|
|
43
|
-
params:
|
|
44
|
-
};
|
|
45
|
-
setImageAndClearError: {
|
|
46
|
-
type: "setImageAndClearError";
|
|
47
|
-
params: xstate0.NonReducibleUnknown;
|
|
43
|
+
params: xstate58.NonReducibleUnknown;
|
|
48
44
|
};
|
|
49
45
|
setProgress: {
|
|
50
46
|
type: "setProgress";
|
|
51
|
-
params:
|
|
52
|
-
};
|
|
53
|
-
setError: {
|
|
54
|
-
type: "setError";
|
|
55
|
-
params: xstate0.NonReducibleUnknown;
|
|
47
|
+
params: xstate58.NonReducibleUnknown;
|
|
56
48
|
};
|
|
57
49
|
clearError: {
|
|
58
50
|
type: "clearError";
|
|
59
|
-
params:
|
|
51
|
+
params: xstate58.NonReducibleUnknown;
|
|
60
52
|
};
|
|
61
53
|
stopStream: {
|
|
62
54
|
type: "stopStream";
|
|
63
|
-
params:
|
|
55
|
+
params: xstate58.NonReducibleUnknown;
|
|
56
|
+
};
|
|
57
|
+
setImageAndClearError: {
|
|
58
|
+
type: "setImageAndClearError";
|
|
59
|
+
params: xstate58.NonReducibleUnknown;
|
|
60
|
+
};
|
|
61
|
+
setError: {
|
|
62
|
+
type: "setError";
|
|
63
|
+
params: xstate58.NonReducibleUnknown;
|
|
64
64
|
};
|
|
65
|
-
}>, never, never, "error" | "initCamera" | "
|
|
65
|
+
}>, never, never, "error" | "initCamera" | "capturing" | "finished" | "closed" | "uploading" | "idle", string, DocumentUploadInput, xstate58.NonReducibleUnknown, xstate58.EventObject, xstate58.MetaObject, {
|
|
66
66
|
readonly id: "documentUpload";
|
|
67
67
|
readonly initial: "idle";
|
|
68
68
|
readonly context: ({
|
|
@@ -71,67 +71,67 @@ declare const documentUploadMachine: xstate0.StateMachine<DocumentUploadContext,
|
|
|
71
71
|
spawn: {
|
|
72
72
|
<TSrc extends "initCamera" | "uploadDocument">(logic: TSrc, ...[options]: ({
|
|
73
73
|
src: "initCamera";
|
|
74
|
-
logic:
|
|
74
|
+
logic: xstate58.PromiseActorLogic<MediaStream, void, xstate58.EventObject>;
|
|
75
75
|
id: string | undefined;
|
|
76
76
|
} extends infer T ? T extends {
|
|
77
77
|
src: "initCamera";
|
|
78
|
-
logic:
|
|
78
|
+
logic: xstate58.PromiseActorLogic<MediaStream, void, xstate58.EventObject>;
|
|
79
79
|
id: string | undefined;
|
|
80
80
|
} ? T extends {
|
|
81
81
|
src: TSrc;
|
|
82
|
-
} ?
|
|
82
|
+
} ? xstate58.ConditionalRequired<[options?: ({
|
|
83
83
|
id?: T["id"] | undefined;
|
|
84
84
|
systemId?: string;
|
|
85
|
-
input?:
|
|
85
|
+
input?: xstate58.InputFrom<T["logic"]> | undefined;
|
|
86
86
|
syncSnapshot?: boolean;
|
|
87
|
-
} & { [K in
|
|
87
|
+
} & { [K in xstate58.RequiredActorOptions<T>]: unknown }) | undefined], xstate58.IsNotNever<xstate58.RequiredActorOptions<T>>> : never : never : never) | ({
|
|
88
88
|
src: "uploadDocument";
|
|
89
|
-
logic:
|
|
89
|
+
logic: xstate58.PromiseActorLogic<void, {
|
|
90
90
|
imageBase64: string;
|
|
91
91
|
documentType: string;
|
|
92
92
|
onProgress: (progress: number) => void;
|
|
93
|
-
},
|
|
93
|
+
}, xstate58.EventObject>;
|
|
94
94
|
id: string | undefined;
|
|
95
95
|
} extends infer T_1 ? T_1 extends {
|
|
96
96
|
src: "uploadDocument";
|
|
97
|
-
logic:
|
|
97
|
+
logic: xstate58.PromiseActorLogic<void, {
|
|
98
98
|
imageBase64: string;
|
|
99
99
|
documentType: string;
|
|
100
100
|
onProgress: (progress: number) => void;
|
|
101
|
-
},
|
|
101
|
+
}, xstate58.EventObject>;
|
|
102
102
|
id: string | undefined;
|
|
103
103
|
} ? T_1 extends {
|
|
104
104
|
src: TSrc;
|
|
105
|
-
} ?
|
|
105
|
+
} ? xstate58.ConditionalRequired<[options?: ({
|
|
106
106
|
id?: T_1["id"] | undefined;
|
|
107
107
|
systemId?: string;
|
|
108
|
-
input?:
|
|
108
|
+
input?: xstate58.InputFrom<T_1["logic"]> | undefined;
|
|
109
109
|
syncSnapshot?: boolean;
|
|
110
|
-
} & { [K_1 in
|
|
110
|
+
} & { [K_1 in xstate58.RequiredActorOptions<T_1>]: unknown }) | undefined], xstate58.IsNotNever<xstate58.RequiredActorOptions<T_1>>> : never : never : never)): xstate58.ActorRefFromLogic<xstate58.GetConcreteByKey<xstate58.Values<{
|
|
111
111
|
initCamera: {
|
|
112
112
|
src: "initCamera";
|
|
113
|
-
logic:
|
|
113
|
+
logic: xstate58.PromiseActorLogic<MediaStream, void, xstate58.EventObject>;
|
|
114
114
|
id: string | undefined;
|
|
115
115
|
};
|
|
116
116
|
uploadDocument: {
|
|
117
117
|
src: "uploadDocument";
|
|
118
|
-
logic:
|
|
118
|
+
logic: xstate58.PromiseActorLogic<void, {
|
|
119
119
|
imageBase64: string;
|
|
120
120
|
documentType: string;
|
|
121
121
|
onProgress: (progress: number) => void;
|
|
122
|
-
},
|
|
122
|
+
}, xstate58.EventObject>;
|
|
123
123
|
id: string | undefined;
|
|
124
124
|
};
|
|
125
125
|
}>, "src", TSrc>["logic"]>;
|
|
126
|
-
<TLogic extends
|
|
126
|
+
<TLogic extends xstate58.AnyActorLogic>(src: TLogic, ...[options]: xstate58.ConditionalRequired<[options?: ({
|
|
127
127
|
id?: never;
|
|
128
128
|
systemId?: string;
|
|
129
|
-
input?:
|
|
129
|
+
input?: xstate58.InputFrom<TLogic> | undefined;
|
|
130
130
|
syncSnapshot?: boolean;
|
|
131
|
-
} & { [K in
|
|
131
|
+
} & { [K in xstate58.RequiredLogicInput<TLogic>]: unknown }) | undefined], xstate58.IsNotNever<xstate58.RequiredLogicInput<TLogic>>>): xstate58.ActorRefFromLogic<TLogic>;
|
|
132
132
|
};
|
|
133
133
|
input: DocumentUploadInput;
|
|
134
|
-
self:
|
|
134
|
+
self: xstate58.ActorRef<xstate58.MachineSnapshot<DocumentUploadContext, {
|
|
135
135
|
type: "START";
|
|
136
136
|
} | {
|
|
137
137
|
type: "CAPTURE";
|
|
@@ -143,7 +143,7 @@ declare const documentUploadMachine: xstate0.StateMachine<DocumentUploadContext,
|
|
|
143
143
|
type: "RETRY";
|
|
144
144
|
} | {
|
|
145
145
|
type: "CLOSE";
|
|
146
|
-
}, Record<string,
|
|
146
|
+
}, Record<string, xstate58.AnyActorRef | undefined>, xstate58.StateValue, string, unknown, any, any>, {
|
|
147
147
|
type: "START";
|
|
148
148
|
} | {
|
|
149
149
|
type: "CAPTURE";
|
|
@@ -155,7 +155,7 @@ declare const documentUploadMachine: xstate0.StateMachine<DocumentUploadContext,
|
|
|
155
155
|
type: "RETRY";
|
|
156
156
|
} | {
|
|
157
157
|
type: "CLOSE";
|
|
158
|
-
},
|
|
158
|
+
}, xstate58.AnyEventObject>;
|
|
159
159
|
}) => {
|
|
160
160
|
config: DocumentUploadConfig;
|
|
161
161
|
stream: undefined;
|
|
@@ -225,7 +225,7 @@ declare const documentUploadMachine: xstate0.StateMachine<DocumentUploadContext,
|
|
|
225
225
|
} | {
|
|
226
226
|
type: "CLOSE";
|
|
227
227
|
};
|
|
228
|
-
self:
|
|
228
|
+
self: xstate58.ActorRef<xstate58.MachineSnapshot<DocumentUploadContext, {
|
|
229
229
|
type: "START";
|
|
230
230
|
} | {
|
|
231
231
|
type: "CAPTURE";
|
|
@@ -237,7 +237,7 @@ declare const documentUploadMachine: xstate0.StateMachine<DocumentUploadContext,
|
|
|
237
237
|
type: "RETRY";
|
|
238
238
|
} | {
|
|
239
239
|
type: "CLOSE";
|
|
240
|
-
}, Record<string,
|
|
240
|
+
}, Record<string, xstate58.AnyActorRef>, xstate58.StateValue, string, unknown, any, any>, {
|
|
241
241
|
type: "START";
|
|
242
242
|
} | {
|
|
243
243
|
type: "CAPTURE";
|
|
@@ -249,7 +249,7 @@ declare const documentUploadMachine: xstate0.StateMachine<DocumentUploadContext,
|
|
|
249
249
|
type: "RETRY";
|
|
250
250
|
} | {
|
|
251
251
|
type: "CLOSE";
|
|
252
|
-
},
|
|
252
|
+
}, xstate58.AnyEventObject>;
|
|
253
253
|
}) => {
|
|
254
254
|
imageBase64: string;
|
|
255
255
|
documentType: string;
|
package/dist/ekyc.d.ts
CHANGED
|
@@ -93,6 +93,7 @@ type EkycFormState = {
|
|
|
93
93
|
values: EkycFormValues;
|
|
94
94
|
errors: Record<string, string>;
|
|
95
95
|
displayErrors: Record<string, string>;
|
|
96
|
+
errorParams: Record<string, Record<string, string | number>>;
|
|
96
97
|
isValid: boolean;
|
|
97
98
|
addressSuggestions: AddressSuggestion[];
|
|
98
99
|
prefilled: Record<string, boolean>;
|
package/dist/ekyc.esm.js
CHANGED
|
@@ -9919,19 +9919,64 @@ const PO_BOX_REGEX = /POBox|P\.O\.Box|pobox|postofficebox|postbox|po\.box|p\.o\.
|
|
|
9919
9919
|
function isPoBox(address) {
|
|
9920
9920
|
return PO_BOX_REGEX.test(address.replace(/\s/g, ""));
|
|
9921
9921
|
}
|
|
9922
|
-
const
|
|
9923
|
-
|
|
9924
|
-
|
|
9925
|
-
}
|
|
9922
|
+
const US_POSTAL_CODE_REGEX = /^(?:\d{5}|\d{9}|\d{5}-\d{4})$/;
|
|
9923
|
+
const BR_POSTAL_CODE_REGEX = /^(?:\d{5}|\d{8}|\d{5}-\d{3})$/;
|
|
9924
|
+
const CA_POSTAL_CODE_REGEX = /^[A-Za-z]\d[A-Za-z] \d[A-Za-z]\d$/;
|
|
9925
|
+
const ES_POSTAL_CODE_REGEX = /^\d{5}$/;
|
|
9926
|
+
const UK_POSTAL_CODE_REGEX = /^(?:[A-Z]{2}\d|[A-Z]{2}\d{2}|[A-Z]\d|[A-Z]\d{2}|[A-Z]\d[A-Z]|[A-Z]{2}\d[A-Z]) \d[A-Z]{2}$/;
|
|
9926
9927
|
const DEFAULT_POSTAL_CODE_MAX = 8;
|
|
9927
|
-
/**
|
|
9928
|
+
/**
|
|
9929
|
+
* Validates postal code by country:
|
|
9930
|
+
* - US: 5-digit, 9-digit, or ZIP+4
|
|
9931
|
+
* - BR: 5-digit, 8-digit, or 5+3 with dash
|
|
9932
|
+
* - CA: A1A 1A1
|
|
9933
|
+
* - ES: 5 digits
|
|
9934
|
+
* - GB/UK: A0 0AA, AA0 0AA, AA0A 0AA
|
|
9935
|
+
* - Others: 5 or 8 numeric digits
|
|
9936
|
+
*/
|
|
9928
9937
|
function validatePostalCode(postalCode, country) {
|
|
9929
9938
|
if (!postalCode) return false;
|
|
9930
|
-
if (country === "US") return
|
|
9931
|
-
if (country === "
|
|
9932
|
-
|
|
9933
|
-
|
|
9934
|
-
|
|
9939
|
+
if (country === "US") return US_POSTAL_CODE_REGEX.test(postalCode);
|
|
9940
|
+
if (country === "BR") return BR_POSTAL_CODE_REGEX.test(postalCode);
|
|
9941
|
+
if (country === "CA") return CA_POSTAL_CODE_REGEX.test(postalCode);
|
|
9942
|
+
if (country === "ES") return ES_POSTAL_CODE_REGEX.test(postalCode);
|
|
9943
|
+
if (country === "GB" || country === "UK") return UK_POSTAL_CODE_REGEX.test(postalCode.toUpperCase());
|
|
9944
|
+
const stripped = postalCode.replace(/\D/g, "");
|
|
9945
|
+
const maxLen = DEFAULT_POSTAL_CODE_MAX;
|
|
9946
|
+
return /^\d+$/.test(stripped) && [5, maxLen].includes(stripped.length);
|
|
9947
|
+
}
|
|
9948
|
+
/**
|
|
9949
|
+
* Normalizes ZIP input to digits and an optional dash after 5 digits.
|
|
9950
|
+
* Examples:
|
|
9951
|
+
* - 12345
|
|
9952
|
+
* - 123456789
|
|
9953
|
+
* - 12345-6789
|
|
9954
|
+
*/
|
|
9955
|
+
function formatPostalCode(value, country) {
|
|
9956
|
+
if (country === "US" || country === "BR" || country === "ES") {
|
|
9957
|
+
let maxLength = getPostalCodeMaxLength(country);
|
|
9958
|
+
if (country !== "ES") maxLength = maxLength - 1;
|
|
9959
|
+
const hasDash = value.includes("-");
|
|
9960
|
+
const digits = value.replace(/\D/g, "").slice(0, maxLength);
|
|
9961
|
+
if (country === "ES") return digits;
|
|
9962
|
+
if (digits.length <= 5) {
|
|
9963
|
+
if (hasDash && digits.length === 5) return `${digits}-`;
|
|
9964
|
+
return digits;
|
|
9965
|
+
}
|
|
9966
|
+
if (hasDash) return `${digits.slice(0, 5)}-${digits.slice(5)}`;
|
|
9967
|
+
return digits;
|
|
9968
|
+
}
|
|
9969
|
+
if (country === "CA") {
|
|
9970
|
+
const normalized = value.replace(/[^A-Za-z0-9]/g, "").toUpperCase().slice(0, 6);
|
|
9971
|
+
if (normalized.length <= 3) return normalized;
|
|
9972
|
+
return `${normalized.slice(0, 3)} ${normalized.slice(3)}`;
|
|
9973
|
+
}
|
|
9974
|
+
if (country === "GB" || country === "UK") {
|
|
9975
|
+
const normalized = value.replace(/[^A-Za-z0-9]/g, "").toUpperCase().slice(0, 7);
|
|
9976
|
+
if (normalized.length <= 3) return normalized;
|
|
9977
|
+
return `${normalized.slice(0, -3)} ${normalized.slice(-3)}`;
|
|
9978
|
+
}
|
|
9979
|
+
return value.replace(/\D/g, "").slice(0, DEFAULT_POSTAL_CODE_MAX);
|
|
9935
9980
|
}
|
|
9936
9981
|
/** Validates a phone number using libphonenumber-js country rules */
|
|
9937
9982
|
function validatePhone(phone, country) {
|
|
@@ -9982,6 +10027,25 @@ const STATE_CODE_HINTS = {
|
|
|
9982
10027
|
AR: "B, C, K"
|
|
9983
10028
|
};
|
|
9984
10029
|
const REQUIRED_ERROR_KEYS = new Set(["verification.errors.required"]);
|
|
10030
|
+
const POSTAL_CODE_MAX_LENGTH_BY_COUNTRY = {
|
|
10031
|
+
US: 10,
|
|
10032
|
+
BR: 9,
|
|
10033
|
+
CA: 7,
|
|
10034
|
+
ES: 5,
|
|
10035
|
+
GB: 8,
|
|
10036
|
+
UK: 8
|
|
10037
|
+
};
|
|
10038
|
+
const DEFAULT_POSTAL_CODE_MAX_LENGTH = 8;
|
|
10039
|
+
function getPostalCodeMaxLength(country) {
|
|
10040
|
+
return POSTAL_CODE_MAX_LENGTH_BY_COUNTRY[country] ?? DEFAULT_POSTAL_CODE_MAX_LENGTH;
|
|
10041
|
+
}
|
|
10042
|
+
function getPostalCodeErrorKey(country) {
|
|
10043
|
+
if (country === "CA") return "verification.errors.CAPostalCodeInvalidFormat";
|
|
10044
|
+
if (country === "ES") return "verification.errors.ESPostalCodeInvalidFormat";
|
|
10045
|
+
if (country === "GB" || country === "UK") return "verification.errors.UKPostalCodeInvalidFormat";
|
|
10046
|
+
if (country === "US") return "verification.errors.zipCodeInvalidFormat";
|
|
10047
|
+
return "verification.errors.postalCodeInvalidFormat";
|
|
10048
|
+
}
|
|
9985
10049
|
function buildFieldDefs(fields, configSource, country, enablePhoneRisk = false) {
|
|
9986
10050
|
const defs = [];
|
|
9987
10051
|
const add = (name, type, label, source, opts) => {
|
|
@@ -10068,7 +10132,10 @@ function buildFieldDefs(fields, configSource, country, enablePhoneRisk = false)
|
|
|
10068
10132
|
placeholderParams: { states: STATE_CODE_HINTS[country] ?? "" }
|
|
10069
10133
|
}
|
|
10070
10134
|
});
|
|
10071
|
-
add("postalCode", "text", country === "US" ? "verification.labels.zipCode" : "verification.labels.postalCode", fields.address, {
|
|
10135
|
+
add("postalCode", "text", country === "US" ? "verification.labels.zipCode" : "verification.labels.postalCode", fields.address, {
|
|
10136
|
+
section: "address",
|
|
10137
|
+
maxLength: getPostalCodeMaxLength(country)
|
|
10138
|
+
});
|
|
10072
10139
|
}
|
|
10073
10140
|
if (fields.dlNumber) add("dlNumber", "text", "verification.labels.dlNumber", fields.dlNumber, { section: "driverLicense" });
|
|
10074
10141
|
if (fields.dlState) add("dlState", "dropdown", "verification.labels.dlState", fields.dlState, {
|
|
@@ -10086,7 +10153,7 @@ function validateField(name, value, required, country, configSource) {
|
|
|
10086
10153
|
if (name === "taxId" && country === "BR") return validateCPF(val) ? void 0 : "verification.errors.invalidTaxId";
|
|
10087
10154
|
if (name === "ssn" && (country === "US" || country === "CA")) return /^\d{3}-\d{2}-\d{4}$/.test(val) ? void 0 : "verification.errors.invalidSsn";
|
|
10088
10155
|
if (name === "street" && isPoBox(val)) return "verification.errors.poBox";
|
|
10089
|
-
if (name === "postalCode") return validatePostalCode(val, country) ? void 0 :
|
|
10156
|
+
if (name === "postalCode") return validatePostalCode(val, country) ? void 0 : getPostalCodeErrorKey(country);
|
|
10090
10157
|
if (name === "phone") {
|
|
10091
10158
|
if (!isFieldOptional("phone", configSource) || val) return validatePhone(val, country) ? void 0 : "verification.errors.invalidPhone";
|
|
10092
10159
|
}
|
|
@@ -10103,14 +10170,30 @@ function computeValidation(fields, values, country, configSource) {
|
|
|
10103
10170
|
isValid: Object.keys(errors).length === 0
|
|
10104
10171
|
};
|
|
10105
10172
|
}
|
|
10106
|
-
|
|
10173
|
+
const POSTAL_CODE_FORMAT_ERROR_KEYS = new Set([
|
|
10174
|
+
"verification.errors.zipCodeInvalidFormat",
|
|
10175
|
+
"verification.errors.postalCodeInvalidFormat",
|
|
10176
|
+
"verification.errors.CAPostalCodeInvalidFormat",
|
|
10177
|
+
"verification.errors.ESPostalCodeInvalidFormat",
|
|
10178
|
+
"verification.errors.UKPostalCodeInvalidFormat"
|
|
10179
|
+
]);
|
|
10180
|
+
function computeDisplayErrors(errors, touched, submitAttempted, country) {
|
|
10107
10181
|
const display = {};
|
|
10182
|
+
const errorParams = {};
|
|
10108
10183
|
for (const [field, err] of Object.entries(errors)) {
|
|
10109
10184
|
const isRequiredErr = REQUIRED_ERROR_KEYS.has(err);
|
|
10110
10185
|
if (isRequiredErr && submitAttempted) display[field] = err;
|
|
10111
10186
|
else if (!isRequiredErr && touched[field]) display[field] = err;
|
|
10187
|
+
if (display[field] && field === "postalCode" && POSTAL_CODE_FORMAT_ERROR_KEYS.has(err)) {
|
|
10188
|
+
let length = getPostalCodeMaxLength(country);
|
|
10189
|
+
if (country === "US" || country === "BR") length = length - 1;
|
|
10190
|
+
errorParams[field] = { maxLength: length };
|
|
10191
|
+
}
|
|
10112
10192
|
}
|
|
10113
|
-
return
|
|
10193
|
+
return {
|
|
10194
|
+
displayErrors: display,
|
|
10195
|
+
errorParams
|
|
10196
|
+
};
|
|
10114
10197
|
}
|
|
10115
10198
|
function applyPrefill(fields, ocrData, otpStatus, _country) {
|
|
10116
10199
|
const values = {};
|
|
@@ -10214,6 +10297,7 @@ function buildSubmitPayload(ctx) {
|
|
|
10214
10297
|
function processFieldValue(name, value, fieldsCountry) {
|
|
10215
10298
|
if ((name === "firstName" || name === "surName" || name === "middleName" || name === "maternalSurname") && value) return cleanName(value);
|
|
10216
10299
|
if (name === "ssn" && (fieldsCountry === "US" || fieldsCountry === "CA")) return formatSSN(value);
|
|
10300
|
+
if (name === "postalCode") return formatPostalCode(value, fieldsCountry);
|
|
10217
10301
|
return value;
|
|
10218
10302
|
}
|
|
10219
10303
|
function fillFromSuggestion(values, touched, suggestion) {
|
|
@@ -10369,7 +10453,8 @@ const ekycMachine = setup({
|
|
|
10369
10453
|
fields: updatedFields,
|
|
10370
10454
|
errors,
|
|
10371
10455
|
isValid,
|
|
10372
|
-
displayErrors: {}
|
|
10456
|
+
displayErrors: {},
|
|
10457
|
+
errorParams: {}
|
|
10373
10458
|
};
|
|
10374
10459
|
}),
|
|
10375
10460
|
updateField: assign(({ context, event }) => {
|
|
@@ -10384,34 +10469,42 @@ const ekycMachine = setup({
|
|
|
10384
10469
|
[name]: true
|
|
10385
10470
|
};
|
|
10386
10471
|
const { errors, isValid } = computeValidation(context.fields, newValues, context.fieldsCountry, context.configSource);
|
|
10472
|
+
const { displayErrors, errorParams } = computeDisplayErrors(errors, newTouched, context.submitAttempted, context.fieldsCountry);
|
|
10387
10473
|
return {
|
|
10388
10474
|
values: newValues,
|
|
10389
10475
|
errors,
|
|
10390
10476
|
isValid,
|
|
10391
10477
|
touched: newTouched,
|
|
10392
|
-
displayErrors
|
|
10478
|
+
displayErrors,
|
|
10479
|
+
errorParams
|
|
10393
10480
|
};
|
|
10394
10481
|
}),
|
|
10395
10482
|
fillAddressFields: assign(({ context, event }) => {
|
|
10396
10483
|
const { suggestion } = event;
|
|
10397
10484
|
const { values: newValues, touched: newTouched } = fillFromSuggestion(context.values, context.touched, suggestion);
|
|
10398
10485
|
const { errors, isValid } = computeValidation(context.fields, newValues, context.fieldsCountry, context.configSource);
|
|
10486
|
+
const { displayErrors, errorParams } = computeDisplayErrors(errors, newTouched, context.submitAttempted, context.fieldsCountry);
|
|
10399
10487
|
return {
|
|
10400
10488
|
values: newValues,
|
|
10401
10489
|
addressSuggestions: [],
|
|
10402
10490
|
errors,
|
|
10403
10491
|
isValid,
|
|
10404
10492
|
touched: newTouched,
|
|
10405
|
-
displayErrors
|
|
10493
|
+
displayErrors,
|
|
10494
|
+
errorParams
|
|
10406
10495
|
};
|
|
10407
10496
|
}),
|
|
10408
10497
|
setAddressSuggestions: assign(({ event }) => ({ addressSuggestions: event.suggestions })),
|
|
10409
10498
|
setErrorMessage: assign(({ event }) => ({ errorMessage: String(event.error ?? "verification.error") })),
|
|
10410
10499
|
clearErrorMessage: assign({ errorMessage: () => "" }),
|
|
10411
|
-
markSubmitAttempted: assign(({ context }) =>
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
|
|
10500
|
+
markSubmitAttempted: assign(({ context }) => {
|
|
10501
|
+
const { displayErrors, errorParams } = computeDisplayErrors(context.errors, context.touched, true, context.fieldsCountry);
|
|
10502
|
+
return {
|
|
10503
|
+
submitAttempted: true,
|
|
10504
|
+
displayErrors,
|
|
10505
|
+
errorParams
|
|
10506
|
+
};
|
|
10507
|
+
}),
|
|
10415
10508
|
trackModuleOpen: () => {
|
|
10416
10509
|
addEvent({
|
|
10417
10510
|
code: "open",
|
|
@@ -10465,6 +10558,7 @@ const ekycMachine = setup({
|
|
|
10465
10558
|
values: {},
|
|
10466
10559
|
errors: {},
|
|
10467
10560
|
displayErrors: {},
|
|
10561
|
+
errorParams: {},
|
|
10468
10562
|
isValid: false,
|
|
10469
10563
|
addressSuggestions: [],
|
|
10470
10564
|
prefilled: {},
|
|
@@ -10619,6 +10713,7 @@ function mapState(snapshot) {
|
|
|
10619
10713
|
values: context.values,
|
|
10620
10714
|
errors: context.errors,
|
|
10621
10715
|
displayErrors: context.displayErrors,
|
|
10716
|
+
errorParams: context.errorParams,
|
|
10622
10717
|
isValid: context.isValid,
|
|
10623
10718
|
addressSuggestions: context.addressSuggestions,
|
|
10624
10719
|
prefilled: context.prefilled,
|