@incodetech/core 0.0.0-dev-20260317-6ffceac → 0.0.0-dev-20260317-737b25e
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/{types-CWa0DQcn.d.ts → displayErrors-B2eFGhh_.d.ts} +7 -1
- package/dist/document-capture.d.ts +47 -47
- package/dist/document-upload.d.ts +46 -46
- package/dist/ekyb.d.ts +7 -4
- package/dist/ekyb.esm.js +10 -67
- package/dist/ekyc.d.ts +9 -4
- package/dist/ekyc.esm.js +34 -43
- package/package.json +1 -1
|
@@ -29,4 +29,10 @@ type AddressSuggestion = {
|
|
|
29
29
|
countryCode?: string;
|
|
30
30
|
};
|
|
31
31
|
//#endregion
|
|
32
|
-
|
|
32
|
+
//#region src/shared/displayErrors.d.ts
|
|
33
|
+
type DisplayErrorsResult = {
|
|
34
|
+
displayErrors: Record<string, string>;
|
|
35
|
+
errorParams: Record<string, Record<string, string | number>>;
|
|
36
|
+
};
|
|
37
|
+
//#endregion
|
|
38
|
+
export { AddressSuggestion as n, FieldDef as r, DisplayErrorsResult as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as Manager } from "./Manager-DsNvecSe.js";
|
|
2
2
|
import { t as CameraStream } from "./camera-Bzi6CMAW.js";
|
|
3
|
-
import * as
|
|
3
|
+
import * as xstate63 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: xstate63.StateMachine<DocumentCaptureContext, {
|
|
76
76
|
type: "CAPTURE";
|
|
77
77
|
} | {
|
|
78
78
|
type: "FILE_SELECTED";
|
|
@@ -95,31 +95,43 @@ declare const documentCaptureMachine: xstate0.StateMachine<DocumentCaptureContex
|
|
|
95
95
|
} | {
|
|
96
96
|
type: "CLOSE";
|
|
97
97
|
}, {
|
|
98
|
-
[x: string]:
|
|
98
|
+
[x: string]: xstate63.ActorRefFromLogic<xstate63.PromiseActorLogic<MediaStream, void, xstate63.EventObject>> | xstate63.ActorRefFromLogic<xstate63.PromiseActorLogic<DocumentUploadResponse, {
|
|
99
99
|
capturedDocument: NonNullable<DocumentCaptureContext["capturedDocument"]>;
|
|
100
100
|
processingType: string;
|
|
101
101
|
onProgress: (progress: number) => void;
|
|
102
|
-
},
|
|
103
|
-
},
|
|
102
|
+
}, xstate63.EventObject>> | undefined;
|
|
103
|
+
}, xstate63.Values<{
|
|
104
104
|
initCamera: {
|
|
105
105
|
src: "initCamera";
|
|
106
|
-
logic:
|
|
106
|
+
logic: xstate63.PromiseActorLogic<MediaStream, void, xstate63.EventObject>;
|
|
107
107
|
id: string | undefined;
|
|
108
108
|
};
|
|
109
109
|
uploadDocument: {
|
|
110
110
|
src: "uploadDocument";
|
|
111
|
-
logic:
|
|
111
|
+
logic: xstate63.PromiseActorLogic<DocumentUploadResponse, {
|
|
112
112
|
capturedDocument: NonNullable<DocumentCaptureContext["capturedDocument"]>;
|
|
113
113
|
processingType: string;
|
|
114
114
|
onProgress: (progress: number) => void;
|
|
115
|
-
},
|
|
115
|
+
}, xstate63.EventObject>;
|
|
116
116
|
id: string | undefined;
|
|
117
117
|
};
|
|
118
|
-
}>,
|
|
118
|
+
}>, xstate63.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
|
+
};
|
|
123
135
|
setCapturedDocument: {
|
|
124
136
|
type: "setCapturedDocument";
|
|
125
137
|
params: unknown;
|
|
@@ -128,10 +140,6 @@ declare const documentCaptureMachine: xstate0.StateMachine<DocumentCaptureContex
|
|
|
128
140
|
type: "setFileTooLargeError";
|
|
129
141
|
params: unknown;
|
|
130
142
|
};
|
|
131
|
-
setProgress: {
|
|
132
|
-
type: "setProgress";
|
|
133
|
-
params: unknown;
|
|
134
|
-
};
|
|
135
143
|
setUploadError: {
|
|
136
144
|
type: "setUploadError";
|
|
137
145
|
params: unknown;
|
|
@@ -160,18 +168,10 @@ declare const documentCaptureMachine: xstate0.StateMachine<DocumentCaptureContex
|
|
|
160
168
|
type: "clearForNextPage";
|
|
161
169
|
params: unknown;
|
|
162
170
|
};
|
|
163
|
-
clearError: {
|
|
164
|
-
type: "clearError";
|
|
165
|
-
params: unknown;
|
|
166
|
-
};
|
|
167
171
|
resetProgress: {
|
|
168
172
|
type: "resetProgress";
|
|
169
173
|
params: unknown;
|
|
170
174
|
};
|
|
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: xstate0.StateMachine<DocumentCaptureContex
|
|
|
196
196
|
type: "trackFailure";
|
|
197
197
|
params: unknown;
|
|
198
198
|
};
|
|
199
|
-
}>,
|
|
199
|
+
}>, xstate63.Values<{
|
|
200
200
|
allowSkip: {
|
|
201
201
|
type: "allowSkip";
|
|
202
202
|
params: unknown;
|
|
@@ -229,7 +229,7 @@ declare const documentCaptureMachine: xstate0.StateMachine<DocumentCaptureContex
|
|
|
229
229
|
type: "isPendingNextPage";
|
|
230
230
|
params: unknown;
|
|
231
231
|
};
|
|
232
|
-
}>, never, "initCamera" | "
|
|
232
|
+
}>, never, "initCamera" | "capturing" | "closed" | "uploading" | "finished" | "tutorial" | "preview" | "failure" | "success", string, DocumentCaptureInput, xstate63.NonReducibleUnknown, xstate63.EventObject, xstate63.MetaObject, {
|
|
233
233
|
readonly id: "documentCapture";
|
|
234
234
|
readonly initial: "tutorial";
|
|
235
235
|
readonly context: ({
|
|
@@ -238,67 +238,67 @@ declare const documentCaptureMachine: xstate0.StateMachine<DocumentCaptureContex
|
|
|
238
238
|
spawn: {
|
|
239
239
|
<TSrc extends "initCamera" | "uploadDocument">(logic: TSrc, ...[options]: ({
|
|
240
240
|
src: "initCamera";
|
|
241
|
-
logic:
|
|
241
|
+
logic: xstate63.PromiseActorLogic<MediaStream, void, xstate63.EventObject>;
|
|
242
242
|
id: string | undefined;
|
|
243
243
|
} extends infer T ? T extends {
|
|
244
244
|
src: "initCamera";
|
|
245
|
-
logic:
|
|
245
|
+
logic: xstate63.PromiseActorLogic<MediaStream, void, xstate63.EventObject>;
|
|
246
246
|
id: string | undefined;
|
|
247
247
|
} ? T extends {
|
|
248
248
|
src: TSrc;
|
|
249
|
-
} ?
|
|
249
|
+
} ? xstate63.ConditionalRequired<[options?: ({
|
|
250
250
|
id?: T["id"] | undefined;
|
|
251
251
|
systemId?: string;
|
|
252
|
-
input?:
|
|
252
|
+
input?: xstate63.InputFrom<T["logic"]> | undefined;
|
|
253
253
|
syncSnapshot?: boolean;
|
|
254
|
-
} & { [K in
|
|
254
|
+
} & { [K in xstate63.RequiredActorOptions<T>]: unknown }) | undefined], xstate63.IsNotNever<xstate63.RequiredActorOptions<T>>> : never : never : never) | ({
|
|
255
255
|
src: "uploadDocument";
|
|
256
|
-
logic:
|
|
256
|
+
logic: xstate63.PromiseActorLogic<DocumentUploadResponse, {
|
|
257
257
|
capturedDocument: NonNullable<DocumentCaptureContext["capturedDocument"]>;
|
|
258
258
|
processingType: string;
|
|
259
259
|
onProgress: (progress: number) => void;
|
|
260
|
-
},
|
|
260
|
+
}, xstate63.EventObject>;
|
|
261
261
|
id: string | undefined;
|
|
262
262
|
} extends infer T_1 ? T_1 extends {
|
|
263
263
|
src: "uploadDocument";
|
|
264
|
-
logic:
|
|
264
|
+
logic: xstate63.PromiseActorLogic<DocumentUploadResponse, {
|
|
265
265
|
capturedDocument: NonNullable<DocumentCaptureContext["capturedDocument"]>;
|
|
266
266
|
processingType: string;
|
|
267
267
|
onProgress: (progress: number) => void;
|
|
268
|
-
},
|
|
268
|
+
}, xstate63.EventObject>;
|
|
269
269
|
id: string | undefined;
|
|
270
270
|
} ? T_1 extends {
|
|
271
271
|
src: TSrc;
|
|
272
|
-
} ?
|
|
272
|
+
} ? xstate63.ConditionalRequired<[options?: ({
|
|
273
273
|
id?: T_1["id"] | undefined;
|
|
274
274
|
systemId?: string;
|
|
275
|
-
input?:
|
|
275
|
+
input?: xstate63.InputFrom<T_1["logic"]> | undefined;
|
|
276
276
|
syncSnapshot?: boolean;
|
|
277
|
-
} & { [K_1 in
|
|
277
|
+
} & { [K_1 in xstate63.RequiredActorOptions<T_1>]: unknown }) | undefined], xstate63.IsNotNever<xstate63.RequiredActorOptions<T_1>>> : never : never : never)): xstate63.ActorRefFromLogic<xstate63.GetConcreteByKey<xstate63.Values<{
|
|
278
278
|
initCamera: {
|
|
279
279
|
src: "initCamera";
|
|
280
|
-
logic:
|
|
280
|
+
logic: xstate63.PromiseActorLogic<MediaStream, void, xstate63.EventObject>;
|
|
281
281
|
id: string | undefined;
|
|
282
282
|
};
|
|
283
283
|
uploadDocument: {
|
|
284
284
|
src: "uploadDocument";
|
|
285
|
-
logic:
|
|
285
|
+
logic: xstate63.PromiseActorLogic<DocumentUploadResponse, {
|
|
286
286
|
capturedDocument: NonNullable<DocumentCaptureContext["capturedDocument"]>;
|
|
287
287
|
processingType: string;
|
|
288
288
|
onProgress: (progress: number) => void;
|
|
289
|
-
},
|
|
289
|
+
}, xstate63.EventObject>;
|
|
290
290
|
id: string | undefined;
|
|
291
291
|
};
|
|
292
292
|
}>, "src", TSrc>["logic"]>;
|
|
293
|
-
<TLogic extends
|
|
293
|
+
<TLogic extends xstate63.AnyActorLogic>(src: TLogic, ...[options]: xstate63.ConditionalRequired<[options?: ({
|
|
294
294
|
id?: never;
|
|
295
295
|
systemId?: string;
|
|
296
|
-
input?:
|
|
296
|
+
input?: xstate63.InputFrom<TLogic> | undefined;
|
|
297
297
|
syncSnapshot?: boolean;
|
|
298
|
-
} & { [K in
|
|
298
|
+
} & { [K in xstate63.RequiredLogicInput<TLogic>]: unknown }) | undefined], xstate63.IsNotNever<xstate63.RequiredLogicInput<TLogic>>>): xstate63.ActorRefFromLogic<TLogic>;
|
|
299
299
|
};
|
|
300
300
|
input: DocumentCaptureInput;
|
|
301
|
-
self:
|
|
301
|
+
self: xstate63.ActorRef<xstate63.MachineSnapshot<DocumentCaptureContext, {
|
|
302
302
|
type: "CAPTURE";
|
|
303
303
|
} | {
|
|
304
304
|
type: "FILE_SELECTED";
|
|
@@ -320,7 +320,7 @@ declare const documentCaptureMachine: xstate0.StateMachine<DocumentCaptureContex
|
|
|
320
320
|
type: "SKIP";
|
|
321
321
|
} | {
|
|
322
322
|
type: "CLOSE";
|
|
323
|
-
}, Record<string,
|
|
323
|
+
}, Record<string, xstate63.AnyActorRef | undefined>, xstate63.StateValue, string, unknown, any, any>, {
|
|
324
324
|
type: "CAPTURE";
|
|
325
325
|
} | {
|
|
326
326
|
type: "FILE_SELECTED";
|
|
@@ -342,7 +342,7 @@ declare const documentCaptureMachine: xstate0.StateMachine<DocumentCaptureContex
|
|
|
342
342
|
type: "SKIP";
|
|
343
343
|
} | {
|
|
344
344
|
type: "CLOSE";
|
|
345
|
-
},
|
|
345
|
+
}, xstate63.AnyEventObject>;
|
|
346
346
|
}) => {
|
|
347
347
|
config: {
|
|
348
348
|
processingType: DocumentType;
|
|
@@ -479,7 +479,7 @@ declare const documentCaptureMachine: xstate0.StateMachine<DocumentCaptureContex
|
|
|
479
479
|
} | {
|
|
480
480
|
type: "CLOSE";
|
|
481
481
|
};
|
|
482
|
-
self:
|
|
482
|
+
self: xstate63.ActorRef<xstate63.MachineSnapshot<DocumentCaptureContext, {
|
|
483
483
|
type: "CAPTURE";
|
|
484
484
|
} | {
|
|
485
485
|
type: "FILE_SELECTED";
|
|
@@ -501,7 +501,7 @@ declare const documentCaptureMachine: xstate0.StateMachine<DocumentCaptureContex
|
|
|
501
501
|
type: "SKIP";
|
|
502
502
|
} | {
|
|
503
503
|
type: "CLOSE";
|
|
504
|
-
}, Record<string,
|
|
504
|
+
}, Record<string, xstate63.AnyActorRef>, xstate63.StateValue, string, unknown, any, any>, {
|
|
505
505
|
type: "CAPTURE";
|
|
506
506
|
} | {
|
|
507
507
|
type: "FILE_SELECTED";
|
|
@@ -523,7 +523,7 @@ declare const documentCaptureMachine: xstate0.StateMachine<DocumentCaptureContex
|
|
|
523
523
|
type: "SKIP";
|
|
524
524
|
} | {
|
|
525
525
|
type: "CLOSE";
|
|
526
|
-
},
|
|
526
|
+
}, xstate63.AnyEventObject>;
|
|
527
527
|
}) => {
|
|
528
528
|
capturedDocument: CapturedDocument;
|
|
529
529
|
processingType: DocumentType;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as Manager } from "./Manager-DsNvecSe.js";
|
|
2
2
|
import "./camera-Bzi6CMAW.js";
|
|
3
3
|
import { n as DocumentUploadContext, r as DocumentUploadInput, t as DocumentUploadConfig } from "./types-BHnsBsl_.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as xstate0 from "xstate";
|
|
5
5
|
|
|
6
6
|
//#region src/modules/document-upload/documentUploadStateMachine.d.ts
|
|
7
|
-
declare const documentUploadMachine:
|
|
7
|
+
declare const documentUploadMachine: xstate0.StateMachine<DocumentUploadContext, {
|
|
8
8
|
type: "START";
|
|
9
9
|
} | {
|
|
10
10
|
type: "CAPTURE";
|
|
@@ -17,52 +17,52 @@ declare const documentUploadMachine: xstate58.StateMachine<DocumentUploadContext
|
|
|
17
17
|
} | {
|
|
18
18
|
type: "CLOSE";
|
|
19
19
|
}, {
|
|
20
|
-
[x: string]:
|
|
20
|
+
[x: string]: xstate0.ActorRefFromLogic<xstate0.PromiseActorLogic<MediaStream, void, xstate0.EventObject>> | xstate0.ActorRefFromLogic<xstate0.PromiseActorLogic<void, {
|
|
21
21
|
imageBase64: string;
|
|
22
22
|
documentType: string;
|
|
23
23
|
onProgress: (progress: number) => void;
|
|
24
|
-
},
|
|
25
|
-
},
|
|
24
|
+
}, xstate0.EventObject>> | undefined;
|
|
25
|
+
}, xstate0.Values<{
|
|
26
26
|
initCamera: {
|
|
27
27
|
src: "initCamera";
|
|
28
|
-
logic:
|
|
28
|
+
logic: xstate0.PromiseActorLogic<MediaStream, void, xstate0.EventObject>;
|
|
29
29
|
id: string | undefined;
|
|
30
30
|
};
|
|
31
31
|
uploadDocument: {
|
|
32
32
|
src: "uploadDocument";
|
|
33
|
-
logic:
|
|
33
|
+
logic: xstate0.PromiseActorLogic<void, {
|
|
34
34
|
imageBase64: string;
|
|
35
35
|
documentType: string;
|
|
36
36
|
onProgress: (progress: number) => void;
|
|
37
|
-
},
|
|
37
|
+
}, xstate0.EventObject>;
|
|
38
38
|
id: string | undefined;
|
|
39
39
|
};
|
|
40
|
-
}>,
|
|
40
|
+
}>, xstate0.Values<{
|
|
41
41
|
setStream: {
|
|
42
42
|
type: "setStream";
|
|
43
|
-
params:
|
|
43
|
+
params: xstate0.NonReducibleUnknown;
|
|
44
|
+
};
|
|
45
|
+
setImageAndClearError: {
|
|
46
|
+
type: "setImageAndClearError";
|
|
47
|
+
params: xstate0.NonReducibleUnknown;
|
|
44
48
|
};
|
|
45
49
|
setProgress: {
|
|
46
50
|
type: "setProgress";
|
|
47
|
-
params:
|
|
51
|
+
params: xstate0.NonReducibleUnknown;
|
|
52
|
+
};
|
|
53
|
+
setError: {
|
|
54
|
+
type: "setError";
|
|
55
|
+
params: xstate0.NonReducibleUnknown;
|
|
48
56
|
};
|
|
49
57
|
clearError: {
|
|
50
58
|
type: "clearError";
|
|
51
|
-
params:
|
|
59
|
+
params: xstate0.NonReducibleUnknown;
|
|
52
60
|
};
|
|
53
61
|
stopStream: {
|
|
54
62
|
type: "stopStream";
|
|
55
|
-
params:
|
|
56
|
-
};
|
|
57
|
-
setImageAndClearError: {
|
|
58
|
-
type: "setImageAndClearError";
|
|
59
|
-
params: xstate58.NonReducibleUnknown;
|
|
60
|
-
};
|
|
61
|
-
setError: {
|
|
62
|
-
type: "setError";
|
|
63
|
-
params: xstate58.NonReducibleUnknown;
|
|
63
|
+
params: xstate0.NonReducibleUnknown;
|
|
64
64
|
};
|
|
65
|
-
}>, never, never, "error" | "initCamera" | "
|
|
65
|
+
}>, never, never, "error" | "initCamera" | "idle" | "capturing" | "closed" | "uploading" | "finished", string, DocumentUploadInput, xstate0.NonReducibleUnknown, xstate0.EventObject, xstate0.MetaObject, {
|
|
66
66
|
readonly id: "documentUpload";
|
|
67
67
|
readonly initial: "idle";
|
|
68
68
|
readonly context: ({
|
|
@@ -71,67 +71,67 @@ declare const documentUploadMachine: xstate58.StateMachine<DocumentUploadContext
|
|
|
71
71
|
spawn: {
|
|
72
72
|
<TSrc extends "initCamera" | "uploadDocument">(logic: TSrc, ...[options]: ({
|
|
73
73
|
src: "initCamera";
|
|
74
|
-
logic:
|
|
74
|
+
logic: xstate0.PromiseActorLogic<MediaStream, void, xstate0.EventObject>;
|
|
75
75
|
id: string | undefined;
|
|
76
76
|
} extends infer T ? T extends {
|
|
77
77
|
src: "initCamera";
|
|
78
|
-
logic:
|
|
78
|
+
logic: xstate0.PromiseActorLogic<MediaStream, void, xstate0.EventObject>;
|
|
79
79
|
id: string | undefined;
|
|
80
80
|
} ? T extends {
|
|
81
81
|
src: TSrc;
|
|
82
|
-
} ?
|
|
82
|
+
} ? xstate0.ConditionalRequired<[options?: ({
|
|
83
83
|
id?: T["id"] | undefined;
|
|
84
84
|
systemId?: string;
|
|
85
|
-
input?:
|
|
85
|
+
input?: xstate0.InputFrom<T["logic"]> | undefined;
|
|
86
86
|
syncSnapshot?: boolean;
|
|
87
|
-
} & { [K in
|
|
87
|
+
} & { [K in xstate0.RequiredActorOptions<T>]: unknown }) | undefined], xstate0.IsNotNever<xstate0.RequiredActorOptions<T>>> : never : never : never) | ({
|
|
88
88
|
src: "uploadDocument";
|
|
89
|
-
logic:
|
|
89
|
+
logic: xstate0.PromiseActorLogic<void, {
|
|
90
90
|
imageBase64: string;
|
|
91
91
|
documentType: string;
|
|
92
92
|
onProgress: (progress: number) => void;
|
|
93
|
-
},
|
|
93
|
+
}, xstate0.EventObject>;
|
|
94
94
|
id: string | undefined;
|
|
95
95
|
} extends infer T_1 ? T_1 extends {
|
|
96
96
|
src: "uploadDocument";
|
|
97
|
-
logic:
|
|
97
|
+
logic: xstate0.PromiseActorLogic<void, {
|
|
98
98
|
imageBase64: string;
|
|
99
99
|
documentType: string;
|
|
100
100
|
onProgress: (progress: number) => void;
|
|
101
|
-
},
|
|
101
|
+
}, xstate0.EventObject>;
|
|
102
102
|
id: string | undefined;
|
|
103
103
|
} ? T_1 extends {
|
|
104
104
|
src: TSrc;
|
|
105
|
-
} ?
|
|
105
|
+
} ? xstate0.ConditionalRequired<[options?: ({
|
|
106
106
|
id?: T_1["id"] | undefined;
|
|
107
107
|
systemId?: string;
|
|
108
|
-
input?:
|
|
108
|
+
input?: xstate0.InputFrom<T_1["logic"]> | undefined;
|
|
109
109
|
syncSnapshot?: boolean;
|
|
110
|
-
} & { [K_1 in
|
|
110
|
+
} & { [K_1 in xstate0.RequiredActorOptions<T_1>]: unknown }) | undefined], xstate0.IsNotNever<xstate0.RequiredActorOptions<T_1>>> : never : never : never)): xstate0.ActorRefFromLogic<xstate0.GetConcreteByKey<xstate0.Values<{
|
|
111
111
|
initCamera: {
|
|
112
112
|
src: "initCamera";
|
|
113
|
-
logic:
|
|
113
|
+
logic: xstate0.PromiseActorLogic<MediaStream, void, xstate0.EventObject>;
|
|
114
114
|
id: string | undefined;
|
|
115
115
|
};
|
|
116
116
|
uploadDocument: {
|
|
117
117
|
src: "uploadDocument";
|
|
118
|
-
logic:
|
|
118
|
+
logic: xstate0.PromiseActorLogic<void, {
|
|
119
119
|
imageBase64: string;
|
|
120
120
|
documentType: string;
|
|
121
121
|
onProgress: (progress: number) => void;
|
|
122
|
-
},
|
|
122
|
+
}, xstate0.EventObject>;
|
|
123
123
|
id: string | undefined;
|
|
124
124
|
};
|
|
125
125
|
}>, "src", TSrc>["logic"]>;
|
|
126
|
-
<TLogic extends
|
|
126
|
+
<TLogic extends xstate0.AnyActorLogic>(src: TLogic, ...[options]: xstate0.ConditionalRequired<[options?: ({
|
|
127
127
|
id?: never;
|
|
128
128
|
systemId?: string;
|
|
129
|
-
input?:
|
|
129
|
+
input?: xstate0.InputFrom<TLogic> | undefined;
|
|
130
130
|
syncSnapshot?: boolean;
|
|
131
|
-
} & { [K in
|
|
131
|
+
} & { [K in xstate0.RequiredLogicInput<TLogic>]: unknown }) | undefined], xstate0.IsNotNever<xstate0.RequiredLogicInput<TLogic>>>): xstate0.ActorRefFromLogic<TLogic>;
|
|
132
132
|
};
|
|
133
133
|
input: DocumentUploadInput;
|
|
134
|
-
self:
|
|
134
|
+
self: xstate0.ActorRef<xstate0.MachineSnapshot<DocumentUploadContext, {
|
|
135
135
|
type: "START";
|
|
136
136
|
} | {
|
|
137
137
|
type: "CAPTURE";
|
|
@@ -143,7 +143,7 @@ declare const documentUploadMachine: xstate58.StateMachine<DocumentUploadContext
|
|
|
143
143
|
type: "RETRY";
|
|
144
144
|
} | {
|
|
145
145
|
type: "CLOSE";
|
|
146
|
-
}, Record<string,
|
|
146
|
+
}, Record<string, xstate0.AnyActorRef | undefined>, xstate0.StateValue, string, unknown, any, any>, {
|
|
147
147
|
type: "START";
|
|
148
148
|
} | {
|
|
149
149
|
type: "CAPTURE";
|
|
@@ -155,7 +155,7 @@ declare const documentUploadMachine: xstate58.StateMachine<DocumentUploadContext
|
|
|
155
155
|
type: "RETRY";
|
|
156
156
|
} | {
|
|
157
157
|
type: "CLOSE";
|
|
158
|
-
},
|
|
158
|
+
}, xstate0.AnyEventObject>;
|
|
159
159
|
}) => {
|
|
160
160
|
config: DocumentUploadConfig;
|
|
161
161
|
stream: undefined;
|
|
@@ -225,7 +225,7 @@ declare const documentUploadMachine: xstate58.StateMachine<DocumentUploadContext
|
|
|
225
225
|
} | {
|
|
226
226
|
type: "CLOSE";
|
|
227
227
|
};
|
|
228
|
-
self:
|
|
228
|
+
self: xstate0.ActorRef<xstate0.MachineSnapshot<DocumentUploadContext, {
|
|
229
229
|
type: "START";
|
|
230
230
|
} | {
|
|
231
231
|
type: "CAPTURE";
|
|
@@ -237,7 +237,7 @@ declare const documentUploadMachine: xstate58.StateMachine<DocumentUploadContext
|
|
|
237
237
|
type: "RETRY";
|
|
238
238
|
} | {
|
|
239
239
|
type: "CLOSE";
|
|
240
|
-
}, Record<string,
|
|
240
|
+
}, Record<string, xstate0.AnyActorRef>, xstate0.StateValue, string, unknown, any, any>, {
|
|
241
241
|
type: "START";
|
|
242
242
|
} | {
|
|
243
243
|
type: "CAPTURE";
|
|
@@ -249,7 +249,7 @@ declare const documentUploadMachine: xstate58.StateMachine<DocumentUploadContext
|
|
|
249
249
|
type: "RETRY";
|
|
250
250
|
} | {
|
|
251
251
|
type: "CLOSE";
|
|
252
|
-
},
|
|
252
|
+
}, xstate0.AnyEventObject>;
|
|
253
253
|
}) => {
|
|
254
254
|
imageBase64: string;
|
|
255
255
|
documentType: string;
|
package/dist/ekyb.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as Manager } from "./Manager-DsNvecSe.js";
|
|
2
|
-
import { n as FieldDef, t as
|
|
2
|
+
import { n as AddressSuggestion, r as FieldDef, t as DisplayErrorsResult } from "./displayErrors-B2eFGhh_.js";
|
|
3
3
|
|
|
4
4
|
//#region src/modules/ekyb/types.d.ts
|
|
5
5
|
type UboEntry = {
|
|
@@ -49,12 +49,12 @@ type EkybFormState = {
|
|
|
49
49
|
availableCountries: readonly string[];
|
|
50
50
|
fields: EkybFieldDef[];
|
|
51
51
|
values: EkybFormValues;
|
|
52
|
-
|
|
53
|
-
errorParams: Record<string, Record<string, string | number>>;
|
|
52
|
+
errors: Record<string, string>;
|
|
54
53
|
isValid: boolean;
|
|
55
54
|
ubos: UboEntry[];
|
|
56
55
|
canAddUbo: boolean;
|
|
57
56
|
addressSuggestions: AddressSuggestion[];
|
|
57
|
+
submitAttempted: boolean;
|
|
58
58
|
};
|
|
59
59
|
type EkybSubmittingState = {
|
|
60
60
|
status: 'submitting';
|
|
@@ -105,6 +105,9 @@ declare function createEkybManager(options: CreateEkybActorOptions): Manager<Eky
|
|
|
105
105
|
};
|
|
106
106
|
type EkybManager = ReturnType<typeof createEkybManager>;
|
|
107
107
|
//#endregion
|
|
108
|
+
//#region src/modules/ekyb/ekybActions.d.ts
|
|
109
|
+
declare function computeDisplayErrors(errors: Record<string, string>, touched: Record<string, boolean>, submitAttempted: boolean, country: string, fields?: EkybFieldDef[]): DisplayErrorsResult;
|
|
110
|
+
//#endregion
|
|
108
111
|
//#region src/modules/ekyb/ekybConstants.d.ts
|
|
109
112
|
/**
|
|
110
113
|
* Countries available in all environments.
|
|
@@ -121,4 +124,4 @@ declare const DEV_ONLY_COUNTRIES: readonly EkybCountry[];
|
|
|
121
124
|
declare const ALL_COUNTRIES: readonly EkybCountry[];
|
|
122
125
|
declare function isSupportedCountry(code: string): code is EkybCountry;
|
|
123
126
|
//#endregion
|
|
124
|
-
export { ALL_COUNTRIES, DEV_ONLY_COUNTRIES, type AddressSuggestion as EkybAddressSuggestion, type EkybConfig, type EkybCountry, type EkybFieldDef, type EkybManager, type EkybState, SUPPORTED_COUNTRIES, type UboEntry, createEkybManager, ekybMachine, isSupportedCountry };
|
|
127
|
+
export { ALL_COUNTRIES, DEV_ONLY_COUNTRIES, type AddressSuggestion as EkybAddressSuggestion, type EkybConfig, type EkybCountry, type EkybFieldDef, type EkybManager, type EkybState, SUPPORTED_COUNTRIES, type UboEntry, computeDisplayErrors as computeEkybDisplayErrors, createEkybManager, ekybMachine, isSupportedCountry };
|
package/dist/ekyb.esm.js
CHANGED
|
@@ -402,13 +402,10 @@ const ekybMachine = setup({
|
|
|
402
402
|
fields,
|
|
403
403
|
values,
|
|
404
404
|
errors,
|
|
405
|
-
displayErrors: {},
|
|
406
|
-
errorParams: {},
|
|
407
405
|
isValid,
|
|
408
406
|
ubos,
|
|
409
407
|
canAddUbo: hasUbos,
|
|
410
408
|
hasUbos,
|
|
411
|
-
touched: {},
|
|
412
409
|
submitAttempted: false,
|
|
413
410
|
addressSuggestions: [],
|
|
414
411
|
_nextUboId: 2,
|
|
@@ -438,7 +435,6 @@ const ekybMachine = setup({
|
|
|
438
435
|
state: ""
|
|
439
436
|
};
|
|
440
437
|
const { errors, isValid } = computeEkybValidation(fields, newValues, country, ubos, hasUbos);
|
|
441
|
-
const { displayErrors, errorParams } = computeDisplayErrors(errors, context.touched, context.submitAttempted, country, fields);
|
|
442
438
|
return {
|
|
443
439
|
country,
|
|
444
440
|
fields,
|
|
@@ -448,9 +444,6 @@ const ekybMachine = setup({
|
|
|
448
444
|
ubos,
|
|
449
445
|
canAddUbo: hasUbos && ubos.length < UBO_INPUT_LIMIT,
|
|
450
446
|
hasUbos,
|
|
451
|
-
displayErrors,
|
|
452
|
-
errorParams,
|
|
453
|
-
submitAttempted: context.submitAttempted,
|
|
454
447
|
_nextUboId: nextId
|
|
455
448
|
};
|
|
456
449
|
}),
|
|
@@ -461,19 +454,11 @@ const ekybMachine = setup({
|
|
|
461
454
|
...context.values,
|
|
462
455
|
[name]: processed
|
|
463
456
|
};
|
|
464
|
-
const newTouched = {
|
|
465
|
-
...context.touched,
|
|
466
|
-
[name]: true
|
|
467
|
-
};
|
|
468
457
|
const { errors, isValid } = computeEkybValidation(context.fields, newValues, context.country, context.ubos, context.hasUbos);
|
|
469
|
-
const { displayErrors, errorParams } = computeDisplayErrors(errors, newTouched, context.submitAttempted, context.country, context.fields);
|
|
470
458
|
return {
|
|
471
459
|
values: newValues,
|
|
472
460
|
errors,
|
|
473
|
-
isValid
|
|
474
|
-
touched: newTouched,
|
|
475
|
-
displayErrors,
|
|
476
|
-
errorParams
|
|
461
|
+
isValid
|
|
477
462
|
};
|
|
478
463
|
}),
|
|
479
464
|
addUbo: assign(({ context }) => {
|
|
@@ -485,14 +470,11 @@ const ekybMachine = setup({
|
|
|
485
470
|
}];
|
|
486
471
|
const canAddUbo = ubos.length < UBO_INPUT_LIMIT;
|
|
487
472
|
const { errors, isValid } = computeEkybValidation(context.fields, context.values, context.country, ubos, context.hasUbos);
|
|
488
|
-
const { displayErrors, errorParams } = computeDisplayErrors(errors, context.touched, context.submitAttempted, context.country, context.fields);
|
|
489
473
|
return {
|
|
490
474
|
ubos,
|
|
491
475
|
canAddUbo,
|
|
492
476
|
errors,
|
|
493
477
|
isValid,
|
|
494
|
-
displayErrors,
|
|
495
|
-
errorParams,
|
|
496
478
|
_nextUboId: newId + 1
|
|
497
479
|
};
|
|
498
480
|
}),
|
|
@@ -500,75 +482,39 @@ const ekybMachine = setup({
|
|
|
500
482
|
const { index } = event;
|
|
501
483
|
const ubos = context.ubos.filter((_, i) => i !== index);
|
|
502
484
|
const canAddUbo = ubos.length < UBO_INPUT_LIMIT;
|
|
503
|
-
const touched = {};
|
|
504
|
-
for (const [key, val] of Object.entries(context.touched)) {
|
|
505
|
-
const match = key.match(/^ubo-(\d+)-(name|surname)$/);
|
|
506
|
-
if (!match) {
|
|
507
|
-
touched[key] = val;
|
|
508
|
-
continue;
|
|
509
|
-
}
|
|
510
|
-
const oldIdx = Number(match[1]);
|
|
511
|
-
if (oldIdx === index) continue;
|
|
512
|
-
const newIdx = oldIdx > index ? oldIdx - 1 : oldIdx;
|
|
513
|
-
touched[`ubo-${newIdx}-${match[2]}`] = val;
|
|
514
|
-
}
|
|
515
485
|
const { errors, isValid } = computeEkybValidation(context.fields, context.values, context.country, ubos, context.hasUbos);
|
|
516
|
-
const { displayErrors, errorParams } = computeDisplayErrors(errors, touched, context.submitAttempted, context.country, context.fields);
|
|
517
486
|
return {
|
|
518
487
|
ubos,
|
|
519
488
|
canAddUbo,
|
|
520
489
|
errors,
|
|
521
|
-
isValid
|
|
522
|
-
displayErrors,
|
|
523
|
-
errorParams,
|
|
524
|
-
touched
|
|
490
|
+
isValid
|
|
525
491
|
};
|
|
526
492
|
}),
|
|
527
493
|
setUboField: assign(({ context, event }) => {
|
|
528
494
|
const { index, field, value } = event;
|
|
529
|
-
const uboKey = `ubo-${index}-${field}`;
|
|
530
495
|
const ubos = context.ubos.map((ubo, i) => i === index ? {
|
|
531
496
|
...ubo,
|
|
532
497
|
[field]: value
|
|
533
498
|
} : ubo);
|
|
534
|
-
const newTouched = {
|
|
535
|
-
...context.touched,
|
|
536
|
-
[uboKey]: true
|
|
537
|
-
};
|
|
538
499
|
const { errors, isValid } = computeEkybValidation(context.fields, context.values, context.country, ubos, context.hasUbos);
|
|
539
|
-
const { displayErrors, errorParams } = computeDisplayErrors(errors, newTouched, context.submitAttempted, context.country, context.fields);
|
|
540
500
|
return {
|
|
541
501
|
ubos,
|
|
542
502
|
errors,
|
|
543
|
-
isValid
|
|
544
|
-
touched: newTouched,
|
|
545
|
-
displayErrors,
|
|
546
|
-
errorParams
|
|
503
|
+
isValid
|
|
547
504
|
};
|
|
548
505
|
}),
|
|
549
506
|
setErrorMessage: assign(({ event }) => ({ errorMessage: String(event.error ?? "verification.error") })),
|
|
550
507
|
clearErrorMessage: assign({ errorMessage: () => "" }),
|
|
551
|
-
markSubmitAttempted: assign(
|
|
552
|
-
const { displayErrors, errorParams } = computeDisplayErrors(context.errors, context.touched, true, context.country, context.fields);
|
|
553
|
-
return {
|
|
554
|
-
submitAttempted: true,
|
|
555
|
-
displayErrors,
|
|
556
|
-
errorParams
|
|
557
|
-
};
|
|
558
|
-
}),
|
|
508
|
+
markSubmitAttempted: assign({ submitAttempted: () => true }),
|
|
559
509
|
fillAddressFields: assign(({ context, event }) => {
|
|
560
510
|
const { suggestion } = event;
|
|
561
|
-
const { values: newValues
|
|
511
|
+
const { values: newValues } = fillFromSuggestion(context.values, {}, suggestion);
|
|
562
512
|
const { errors, isValid } = computeEkybValidation(context.fields, newValues, context.country, context.ubos, context.hasUbos);
|
|
563
|
-
const { displayErrors, errorParams } = computeDisplayErrors(errors, newTouched, context.submitAttempted, context.country, context.fields);
|
|
564
513
|
return {
|
|
565
514
|
values: newValues,
|
|
566
515
|
addressSuggestions: [],
|
|
567
516
|
errors,
|
|
568
|
-
isValid
|
|
569
|
-
touched: newTouched,
|
|
570
|
-
displayErrors,
|
|
571
|
-
errorParams
|
|
517
|
+
isValid
|
|
572
518
|
};
|
|
573
519
|
}),
|
|
574
520
|
setAddressSuggestions: assign(({ event }) => ({ addressSuggestions: event.suggestions })),
|
|
@@ -615,14 +561,11 @@ const ekybMachine = setup({
|
|
|
615
561
|
fields,
|
|
616
562
|
values,
|
|
617
563
|
errors,
|
|
618
|
-
displayErrors: {},
|
|
619
|
-
errorParams: {},
|
|
620
564
|
isValid,
|
|
621
565
|
ubos,
|
|
622
566
|
canAddUbo: hasUbos,
|
|
623
567
|
hasUbos,
|
|
624
568
|
errorMessage: "",
|
|
625
|
-
touched: {},
|
|
626
569
|
submitAttempted: false,
|
|
627
570
|
addressSuggestions: [],
|
|
628
571
|
_nextUboId: 2,
|
|
@@ -742,12 +685,12 @@ function mapState(snapshot) {
|
|
|
742
685
|
availableCountries: context.availableCountries,
|
|
743
686
|
fields: context.fields,
|
|
744
687
|
values: context.values,
|
|
745
|
-
|
|
746
|
-
errorParams: context.errorParams,
|
|
688
|
+
errors: context.errors,
|
|
747
689
|
isValid: context.isValid,
|
|
748
690
|
ubos: context.ubos,
|
|
749
691
|
canAddUbo: context.canAddUbo,
|
|
750
|
-
addressSuggestions: context.addressSuggestions
|
|
692
|
+
addressSuggestions: context.addressSuggestions,
|
|
693
|
+
submitAttempted: context.submitAttempted
|
|
751
694
|
};
|
|
752
695
|
if (typedSnapshot.matches("submitting")) return { status: "submitting" };
|
|
753
696
|
if (typedSnapshot.matches("success")) return { status: "success" };
|
|
@@ -829,4 +772,4 @@ function createEkybManager(options) {
|
|
|
829
772
|
}
|
|
830
773
|
|
|
831
774
|
//#endregion
|
|
832
|
-
export { ALL_COUNTRIES, DEV_ONLY_COUNTRIES, SUPPORTED_COUNTRIES, createEkybManager, ekybMachine, isSupportedCountry };
|
|
775
|
+
export { ALL_COUNTRIES, DEV_ONLY_COUNTRIES, SUPPORTED_COUNTRIES, computeDisplayErrors as computeEkybDisplayErrors, createEkybManager, ekybMachine, isSupportedCountry };
|
package/dist/ekyc.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as Manager } from "./Manager-DsNvecSe.js";
|
|
2
|
-
import { n as FieldDef, t as
|
|
2
|
+
import { n as AddressSuggestion, r as FieldDef, t as DisplayErrorsResult } from "./displayErrors-B2eFGhh_.js";
|
|
3
3
|
|
|
4
4
|
//#region src/modules/ekyc/types.d.ts
|
|
5
5
|
type EkycFieldSource = 'user_input' | 'document_scan' | 'poa_document' | 'phone_module_input' | 'email_module_input' | false;
|
|
@@ -19,6 +19,7 @@ type EkycVerificationFields = {
|
|
|
19
19
|
idNum?: EkycFieldSource;
|
|
20
20
|
idNum1?: EkycFieldSource;
|
|
21
21
|
gender?: EkycFieldSource;
|
|
22
|
+
panNumber?: EkycFieldSource;
|
|
22
23
|
};
|
|
23
24
|
type EkycModuleConfig = {
|
|
24
25
|
source: string;
|
|
@@ -51,6 +52,8 @@ type EkycModuleConfig = {
|
|
|
51
52
|
idNum1Source?: string;
|
|
52
53
|
checkGender?: boolean;
|
|
53
54
|
genderSource?: string;
|
|
55
|
+
checkPanNumber?: boolean;
|
|
56
|
+
panNumberSource?: string;
|
|
54
57
|
};
|
|
55
58
|
type EkycFormValues = Record<string, string | undefined>;
|
|
56
59
|
/** Manager creation config */
|
|
@@ -82,14 +85,13 @@ type EkycFormState = {
|
|
|
82
85
|
fields: EkycFieldDef[];
|
|
83
86
|
values: EkycFormValues;
|
|
84
87
|
errors: Record<string, string>;
|
|
85
|
-
displayErrors: Record<string, string>;
|
|
86
|
-
errorParams: Record<string, Record<string, string | number>>;
|
|
87
88
|
isValid: boolean;
|
|
88
89
|
addressSuggestions: AddressSuggestion[];
|
|
89
90
|
prefilled: Record<string, boolean>;
|
|
90
91
|
hideEmail: boolean;
|
|
91
92
|
fieldsCountry: string;
|
|
92
93
|
submitError: string;
|
|
94
|
+
submitAttempted: boolean;
|
|
93
95
|
};
|
|
94
96
|
type EkycSubmittingState = {
|
|
95
97
|
status: 'submitting';
|
|
@@ -137,4 +139,7 @@ declare function createEkycManager(options: CreateEkycActorOptions): Manager<Eky
|
|
|
137
139
|
};
|
|
138
140
|
type EkycManager = ReturnType<typeof createEkycManager>;
|
|
139
141
|
//#endregion
|
|
140
|
-
|
|
142
|
+
//#region src/modules/ekyc/ekycActions.d.ts
|
|
143
|
+
declare function computeDisplayErrors(errors: Record<string, string>, touched: Record<string, boolean>, submitAttempted: boolean, country: string, fields?: EkycFieldDef[]): DisplayErrorsResult;
|
|
144
|
+
//#endregion
|
|
145
|
+
export { type AddressSuggestion, type EkycConfig, type EkycManager, type EkycModuleConfig, type EkycState, computeDisplayErrors as computeEkycDisplayErrors, createEkycManager, ekycMachine };
|
package/dist/ekyc.esm.js
CHANGED
|
@@ -9857,7 +9857,8 @@ function getEKYCFields(config) {
|
|
|
9857
9857
|
last4SSN: config.checkLast4SSN ? mapToEKYCvalue(config.last4SSNSource ?? "") : false,
|
|
9858
9858
|
idNum: config.checkIdNum ? mapToEKYCvalue(config.idNumSource ?? "") : false,
|
|
9859
9859
|
idNum1: config.checkIdNum1 ? mapToEKYCvalue(config.idNum1Source ?? "") : false,
|
|
9860
|
-
gender: config.checkGender ? mapToEKYCvalue(config.genderSource ?? "") : false
|
|
9860
|
+
gender: config.checkGender ? mapToEKYCvalue(config.genderSource ?? "") : false,
|
|
9861
|
+
panNumber: config.checkPanNumber ? mapToEKYCvalue(config.panNumberSource ?? "") : false
|
|
9861
9862
|
};
|
|
9862
9863
|
}
|
|
9863
9864
|
/** Maps a verification source string to a country code */
|
|
@@ -9875,6 +9876,7 @@ function getEKYCCountry(source) {
|
|
|
9875
9876
|
case "CO_1": return "CO";
|
|
9876
9877
|
case "CR_1": return "CR";
|
|
9877
9878
|
case "CA_RES_CREDIT": return "CA";
|
|
9879
|
+
case "INDIA_PAN": return "IN";
|
|
9878
9880
|
default: return "US";
|
|
9879
9881
|
}
|
|
9880
9882
|
}
|
|
@@ -9882,6 +9884,7 @@ function getEKYCCountry(source) {
|
|
|
9882
9884
|
function isFieldOptional(fieldName, configSource) {
|
|
9883
9885
|
if (fieldName === "middleName") return true;
|
|
9884
9886
|
if (fieldName === "dateOfBirth") return DOB_OPTIONAL_SOURCES.includes(configSource);
|
|
9887
|
+
if (fieldName === "street") return false;
|
|
9885
9888
|
if (ADDRESS_FIELDS.includes(fieldName)) return ADDRESS_OPTIONAL_SOURCES.includes(configSource);
|
|
9886
9889
|
if (fieldName === "last4SSN") return LAST4SSN_OPTIONAL_SOURCES.includes(configSource);
|
|
9887
9890
|
if (DRIVERS_LICENSE_FIELDS.includes(fieldName)) return DRIVERS_LICENSE_OPTIONAL_SOURCES.includes(configSource);
|
|
@@ -9971,14 +9974,14 @@ function buildFieldDefs(fields, configSource, country, enablePhoneRisk = false)
|
|
|
9971
9974
|
maxLength: 100,
|
|
9972
9975
|
placeholder: "verification.placeholder.firstName"
|
|
9973
9976
|
});
|
|
9974
|
-
if (configSource === "US_CREDIT_BUREAU_1" || configSource === "CA_RES_CREDIT") add("middleName", "text", "verification.labels.middleName", fields.name, {
|
|
9977
|
+
if (configSource === "US_CREDIT_BUREAU_1" || configSource === "CA_RES_CREDIT" || configSource === "UK_VOTER_REGISTER" || country === "IN") add("middleName", "text", "verification.labels.middleName", fields.name, {
|
|
9975
9978
|
maxLength: 100,
|
|
9976
9979
|
placeholder: "verification.placeholder.middleName",
|
|
9977
9980
|
optional: true
|
|
9978
9981
|
});
|
|
9979
9982
|
add("surName", "text", country === "US" ? "verification.labels.lastName" : "verification.labels.surName", fields.name, {
|
|
9980
9983
|
maxLength: 100,
|
|
9981
|
-
placeholder: "verification.placeholder.lastName"
|
|
9984
|
+
placeholder: country === "US" ? "verification.placeholder.lastName" : "verification.placeholder.surname"
|
|
9982
9985
|
});
|
|
9983
9986
|
if (country === "MX") add("maternalSurname", "text", "verification.labels.maternalSurname", fields.name, {
|
|
9984
9987
|
maxLength: 100,
|
|
@@ -10026,11 +10029,13 @@ function buildFieldDefs(fields, configSource, country, enablePhoneRisk = false)
|
|
|
10026
10029
|
value: "M",
|
|
10027
10030
|
label: "common.male"
|
|
10028
10031
|
}] });
|
|
10029
|
-
if (fields.
|
|
10032
|
+
if (fields.panNumber) add("panNumber", "text", "verification.labels.panNumber", fields.panNumber, { maxLength: 10 });
|
|
10033
|
+
const addAddressFields = () => {
|
|
10034
|
+
if (!fields.address) return;
|
|
10030
10035
|
add("street", "text", "verification.labels.street", fields.address, { section: "address" });
|
|
10031
10036
|
add("houseNo", "text", "verification.labels.houseNo", fields.address, { section: "address" });
|
|
10032
10037
|
add("city", "text", "verification.labels.city", fields.address, { section: "address" });
|
|
10033
|
-
add("state", country === "US" ? "dropdown" : "text", "verification.labels.state", fields.address, {
|
|
10038
|
+
add("state", country === "US" ? "dropdown" : "text", country === "US" ? "verification.labels.chooseState" : "verification.labels.state", fields.address, {
|
|
10034
10039
|
section: "address",
|
|
10035
10040
|
...country === "US" ? {
|
|
10036
10041
|
options: usStateOptions,
|
|
@@ -10044,14 +10049,23 @@ function buildFieldDefs(fields, configSource, country, enablePhoneRisk = false)
|
|
|
10044
10049
|
section: "address",
|
|
10045
10050
|
maxLength: getPostalCodeMaxLength(country)
|
|
10046
10051
|
});
|
|
10052
|
+
};
|
|
10053
|
+
const addDriversLicenseFields = () => {
|
|
10054
|
+
if (fields.dlNumber) add("dlNumber", "text", "verification.labels.dlNumber", fields.dlNumber, { section: "driverLicense" });
|
|
10055
|
+
if (fields.dlState) add("dlState", "dropdown", "verification.labels.dlState", fields.dlState, {
|
|
10056
|
+
section: "driverLicense",
|
|
10057
|
+
options: usStateOptions,
|
|
10058
|
+
placeholder: "verification.placeholders.selectState"
|
|
10059
|
+
});
|
|
10060
|
+
if (fields.dlExpireAt) add("dlExpireAt", "date", "verification.labels.dlExpireAt", fields.dlExpireAt, { section: "driverLicense" });
|
|
10061
|
+
};
|
|
10062
|
+
if (configSource === "US_TELCO_1") {
|
|
10063
|
+
addDriversLicenseFields();
|
|
10064
|
+
addAddressFields();
|
|
10065
|
+
} else {
|
|
10066
|
+
addAddressFields();
|
|
10067
|
+
addDriversLicenseFields();
|
|
10047
10068
|
}
|
|
10048
|
-
if (fields.dlNumber) add("dlNumber", "text", "verification.labels.dlNumber", fields.dlNumber, { section: "driverLicense" });
|
|
10049
|
-
if (fields.dlState) add("dlState", "dropdown", "verification.labels.dlState", fields.dlState, {
|
|
10050
|
-
section: "driverLicense",
|
|
10051
|
-
options: usStateOptions,
|
|
10052
|
-
placeholder: "verification.placeholders.selectState"
|
|
10053
|
-
});
|
|
10054
|
-
if (fields.dlExpireAt) add("dlExpireAt", "date", "verification.labels.dlExpireAt", fields.dlExpireAt, { section: "driverLicense" });
|
|
10055
10069
|
return defs;
|
|
10056
10070
|
}
|
|
10057
10071
|
function validateField(name, value, required, country, configSource) {
|
|
@@ -10066,6 +10080,7 @@ function validateField(name, value, required, country, configSource) {
|
|
|
10066
10080
|
if (!isFieldOptional("phone", configSource) || val) return validatePhone(val, country) ? void 0 : "verification.errors.invalidPhone";
|
|
10067
10081
|
}
|
|
10068
10082
|
if (name === "email" && val) return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val) ? void 0 : "verification.errors.invalidEmail";
|
|
10083
|
+
if (name === "panNumber" && val) return val.length === 10 ? void 0 : "verification.errors.exactly10Characters";
|
|
10069
10084
|
}
|
|
10070
10085
|
function computeValidation(fields, values, country, configSource) {
|
|
10071
10086
|
const errors = {};
|
|
@@ -10332,9 +10347,7 @@ const ekycMachine = setup({
|
|
|
10332
10347
|
hideEmail,
|
|
10333
10348
|
fields: updatedFields,
|
|
10334
10349
|
errors,
|
|
10335
|
-
isValid
|
|
10336
|
-
displayErrors: {},
|
|
10337
|
-
errorParams: {}
|
|
10350
|
+
isValid
|
|
10338
10351
|
};
|
|
10339
10352
|
}),
|
|
10340
10353
|
updateField: assign(({ context, event }) => {
|
|
@@ -10344,35 +10357,23 @@ const ekycMachine = setup({
|
|
|
10344
10357
|
...context.values,
|
|
10345
10358
|
[name]: processedValue
|
|
10346
10359
|
};
|
|
10347
|
-
const newTouched = {
|
|
10348
|
-
...context.touched,
|
|
10349
|
-
[name]: true
|
|
10350
|
-
};
|
|
10351
10360
|
const { errors, isValid } = computeValidation(context.fields, newValues, context.fieldsCountry, context.configSource);
|
|
10352
|
-
const { displayErrors, errorParams } = computeDisplayErrors(errors, newTouched, context.submitAttempted, context.fieldsCountry, context.fields);
|
|
10353
10361
|
return {
|
|
10354
10362
|
values: newValues,
|
|
10355
10363
|
errors,
|
|
10356
10364
|
isValid,
|
|
10357
|
-
touched: newTouched,
|
|
10358
|
-
displayErrors,
|
|
10359
|
-
errorParams,
|
|
10360
10365
|
submitError: ""
|
|
10361
10366
|
};
|
|
10362
10367
|
}),
|
|
10363
10368
|
fillAddressFields: assign(({ context, event }) => {
|
|
10364
10369
|
const { suggestion } = event;
|
|
10365
|
-
const { values: newValues
|
|
10370
|
+
const { values: newValues } = fillFromSuggestion(context.values, {}, suggestion);
|
|
10366
10371
|
const { errors, isValid } = computeValidation(context.fields, newValues, context.fieldsCountry, context.configSource);
|
|
10367
|
-
const { displayErrors, errorParams } = computeDisplayErrors(errors, newTouched, context.submitAttempted, context.fieldsCountry, context.fields);
|
|
10368
10372
|
return {
|
|
10369
10373
|
values: newValues,
|
|
10370
10374
|
addressSuggestions: [],
|
|
10371
10375
|
errors,
|
|
10372
10376
|
isValid,
|
|
10373
|
-
touched: newTouched,
|
|
10374
|
-
displayErrors,
|
|
10375
|
-
errorParams,
|
|
10376
10377
|
submitError: ""
|
|
10377
10378
|
};
|
|
10378
10379
|
}),
|
|
@@ -10381,14 +10382,7 @@ const ekycMachine = setup({
|
|
|
10381
10382
|
clearErrorMessage: assign({ errorMessage: () => "" }),
|
|
10382
10383
|
setSubmitError: assign(() => ({ submitError: "verification.errors.countryNotSupported" })),
|
|
10383
10384
|
clearSubmitError: assign({ submitError: () => "" }),
|
|
10384
|
-
markSubmitAttempted: assign(
|
|
10385
|
-
const { displayErrors, errorParams } = computeDisplayErrors(context.errors, context.touched, true, context.fieldsCountry, context.fields);
|
|
10386
|
-
return {
|
|
10387
|
-
submitAttempted: true,
|
|
10388
|
-
displayErrors,
|
|
10389
|
-
errorParams
|
|
10390
|
-
};
|
|
10391
|
-
}),
|
|
10385
|
+
markSubmitAttempted: assign({ submitAttempted: () => true }),
|
|
10392
10386
|
trackModuleOpen: () => {
|
|
10393
10387
|
addEvent({
|
|
10394
10388
|
code: "open",
|
|
@@ -10442,15 +10436,12 @@ const ekycMachine = setup({
|
|
|
10442
10436
|
fields: [],
|
|
10443
10437
|
values: {},
|
|
10444
10438
|
errors: {},
|
|
10445
|
-
displayErrors: {},
|
|
10446
|
-
errorParams: {},
|
|
10447
10439
|
isValid: false,
|
|
10448
10440
|
addressSuggestions: [],
|
|
10449
10441
|
prefilled: {},
|
|
10450
10442
|
hideEmail: false,
|
|
10451
10443
|
errorMessage: "",
|
|
10452
10444
|
submitError: "",
|
|
10453
|
-
touched: {},
|
|
10454
10445
|
submitAttempted: false,
|
|
10455
10446
|
_searchQuery: ""
|
|
10456
10447
|
}),
|
|
@@ -10540,6 +10531,7 @@ const ekycMachine = setup({
|
|
|
10540
10531
|
target: "submitting",
|
|
10541
10532
|
guard: "isValid"
|
|
10542
10533
|
}, { actions: "markSubmitAttempted" }],
|
|
10534
|
+
SKIP: { target: "#ekyc.finished" },
|
|
10543
10535
|
CLOSE: { target: "#ekyc.closed" }
|
|
10544
10536
|
}
|
|
10545
10537
|
},
|
|
@@ -10602,14 +10594,13 @@ function mapState(snapshot) {
|
|
|
10602
10594
|
fields: context.fields,
|
|
10603
10595
|
values: context.values,
|
|
10604
10596
|
errors: context.errors,
|
|
10605
|
-
displayErrors: context.displayErrors,
|
|
10606
|
-
errorParams: context.errorParams,
|
|
10607
10597
|
isValid: context.isValid,
|
|
10608
10598
|
addressSuggestions: context.addressSuggestions,
|
|
10609
10599
|
prefilled: context.prefilled,
|
|
10610
10600
|
hideEmail: context.hideEmail,
|
|
10611
10601
|
fieldsCountry: context.fieldsCountry,
|
|
10612
|
-
submitError: context.submitError
|
|
10602
|
+
submitError: context.submitError,
|
|
10603
|
+
submitAttempted: context.submitAttempted
|
|
10613
10604
|
};
|
|
10614
10605
|
if (typedSnapshot.matches("submitting")) return { status: "submitting" };
|
|
10615
10606
|
if (typedSnapshot.matches("success")) return { status: "success" };
|
|
@@ -10672,4 +10663,4 @@ function createEkycManager(options) {
|
|
|
10672
10663
|
}
|
|
10673
10664
|
|
|
10674
10665
|
//#endregion
|
|
10675
|
-
export { createEkycManager, ekycMachine };
|
|
10666
|
+
export { computeDisplayErrors as computeEkycDisplayErrors, createEkycManager, ekycMachine };
|