uqudosdk-web 3.1.2

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/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ ## 3.1.2
2
+
3
+ - Changed API base server URL
4
+
5
+ ## 3.1.1
6
+
7
+ - Fixed bug where facial recognition was trigger for document that don't support facial recognition
8
+
9
+ ## 3.1.0
10
+
11
+ - Added support for multiple documents in the same Enrollment session.
12
+ - Added lookup feature to the Enrollment process.
13
+ - Allow scan rejection based on the age.
14
+ - Added an option that returns the data for an incomplete session for Account Recovery and Face Session
15
+ - Configuration option the set the max number of attempts before dropping the session.
package/COPYRIGHT.md ADDED
@@ -0,0 +1 @@
1
+ Copyright (c) uqudo 2022
package/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # Uqudo Web SDK
2
+
3
+ The official uqudo SDK for web.\
4
+ Onboard new users faster, easier, and cheaper with an experience that seamlessly fits into your onboarding journey. Fully supported across the Middle East & Africa.
5
+
6
+ #### Web documentation
7
+
8
+ https://docs.uqudo.com
9
+
10
+ ## Licensing
11
+
12
+ - In order to use the SDK you require a valid license. Contact us at https://uqudo.com/contact-us/
package/index.d.ts ADDED
@@ -0,0 +1,264 @@
1
+ // ---------- errors --------- //
2
+
3
+ export declare const isErrorCode: (code: unknown) => code is ErrorCode;
4
+
5
+ export declare class OperationError extends Error {
6
+ public code: ErrorCode;
7
+ public data: IResultInfo | undefined;
8
+ }
9
+
10
+ export declare const isOperationError: (
11
+ error: unknown
12
+ ) => error is OperationError;
13
+
14
+ // ---------- uqudo sdk --------- //
15
+
16
+ export declare class UqudoSdk {
17
+ enrollment(configProcess: IEnrollmentConfig): Promise<ReturnEnrollmentType>;
18
+ accountRecovery(
19
+ configProcess: IAccountRecoveryConfig
20
+ ): Promise<ReturnAccountRecoveryType>;
21
+ faceSession(
22
+ configProcess: IFaceSessionConfig
23
+ ): Promise<ReturnFaceSessionType>;
24
+ }
25
+
26
+ declare class UqudoSdkFactory {
27
+ static create(config: IUqudoSdkConfig): UqudoSdk;
28
+ }
29
+
30
+ export default UqudoSdkFactory;
31
+
32
+ export enum ErrorCode {
33
+ UNEXPECTED_ERROR = "UNEXPECTED_ERROR",
34
+ UNAUTHORIZED = "UNAUTHORIZED",
35
+ FORBIDDEN = "FORBIDDEN",
36
+ SESSION_EXPIRED_OR_NOT_FOUND = "SESSION_EXPIRED_OR_NOT_FOUND",
37
+ MEDIA_NOT_ALLOWED_ERROR = "MEDIA_NOT_ALLOWED_ERROR",
38
+ MEDIA_NOT_FOUND_ERROR = "MEDIA_NOT_FOUND_ERROR",
39
+ MEDIA_SECURITY_ERROR = "MEDIA_SECURITY_ERROR",
40
+ MEDIA_UNKNOWN_ERROR = "MEDIA_UNKNOWN_ERROR",
41
+ USER_CANCEL = "USER_CANCEL",
42
+ INVALID_CONFIG = "INVALID_CONFIG",
43
+ SESSION_INVALIDATED_TOO_MANY_ATTEMPTS = "SESSION_INVALIDATED_TOO_MANY_ATTEMPTS",
44
+ }
45
+
46
+ // ---------- enum --------- //
47
+ // error code display
48
+ export enum ErrorDisplayCode {
49
+ SCAN_DOCUMENT_NOT_RECOGNIZED = "SCAN_DOCUMENT_NOT_RECOGNIZED",
50
+ SCAN_DOCUMENT_EXPIRED = "SCAN_DOCUMENT_EXPIRED",
51
+ SCAN_DOCUMENT_FRONT_BACK_MISMATCH = "SCAN_DOCUMENT_FRONT_BACK_MISMATCH",
52
+ FACE_LIVENESS_FAILED = "FACE_LIVENESS_FAILED",
53
+ FACE_NO_MATCH = "FACE_NO_MATCH",
54
+ PAYLOAD_TOO_LARGE = "PAYLOAD_TOO_LARGE",
55
+ SCAN_DOCUMENT_AGE_VERIFICATION_FAILED = "SCAN_DOCUMENT_AGE_VERIFICATION_FAILED",
56
+ UNEXPECTED_ERROR = "UNEXPECTED_ERROR",
57
+ }
58
+
59
+ // document type
60
+ export enum DocumentType {
61
+ BHR_ID = "BHR_ID",
62
+ GENERIC_ID = "GENERIC_ID",
63
+ KWT_ID = "KWT_ID",
64
+ OMN_ID = "OMN_ID",
65
+ PAK_ID = "PAK_ID",
66
+ PASSPORT = "PASSPORT",
67
+ SAU_ID = "SAU_ID",
68
+ UAE_ID = "UAE_ID",
69
+ UAE_DL = "UAE_DL",
70
+ NLD_DL = "NLD_DL",
71
+ UAE_VISA = "UAE_VISA",
72
+ UAE_VL = "UAE_VL",
73
+ QAT_ID = "QAT_ID",
74
+ DEU_ID = "DEU_ID",
75
+ SDN_ID = "SDN_ID",
76
+ SDN_DL = "SDN_DL",
77
+ SDN_VL = "SDN_VL",
78
+ GHA_ID = "GHA_ID",
79
+ NGA_DL = "NGA_DL",
80
+ NGA_VOTER_ID = "NGA_VOTER_ID",
81
+ NGA_NIN = "NGA_NIN",
82
+ UAE_VL_PDF = "UAE_VL_PDF",
83
+ GBR_DL = "GBR_DL",
84
+ SAU_DL = "SAU_DL",
85
+ ZAF_ID = "ZAF_ID",
86
+ ZAF_DL = "ZAF_DL",
87
+ EGY_ID = "EGY_ID",
88
+ RWA_ID = "RWA_ID",
89
+ KEN_ID = "KEN_ID",
90
+ GHA_DL = "GHA_DL",
91
+ GHA_VOTER_ID = "GHA_VOTER_ID",
92
+ GHA_SSNIT = "GHA_SSNIT",
93
+ UGA_ID = "UGA_ID",
94
+ UGA_VOTER_ID = "UGA_VOTER_ID",
95
+ IND_ID = "IND_ID",
96
+ SEN_ID = "SEN_ID",
97
+ }
98
+
99
+ export enum BackgroundCheckType {
100
+ RDC = "RDC",
101
+ }
102
+
103
+ // ---------- texts type --------- //
104
+
105
+ export type ITextErrorDisplay = {
106
+ title?: string;
107
+ description?: string;
108
+ button?: string;
109
+ };
110
+
111
+ export interface ITextsArg {
112
+ startingCamera?: string;
113
+ validating?: string;
114
+ processing?: string;
115
+ closingSession?: string;
116
+ exit?: {
117
+ title?: string;
118
+ description?: string;
119
+ yesButtonText?: string;
120
+ noButtonText?: string;
121
+ };
122
+ upload?: {
123
+ title?: string;
124
+ front?: {
125
+ description?: string;
126
+ buttonText?: string;
127
+ };
128
+ back?: {
129
+ description?: string;
130
+ buttonText?: string;
131
+ };
132
+ acceptedFilesDescription?: string;
133
+ buttonText?: string;
134
+ tipDescription?: string;
135
+ };
136
+ backgroundCheck?: {
137
+ title?: string;
138
+ description?: string;
139
+ declineButtonText?: string;
140
+ consentButtonText?: string;
141
+ continueButtonText?: string;
142
+ declineConfirmation?: {
143
+ title?: string;
144
+ description?: string;
145
+ noButtonText?: string;
146
+ yesButtonText?: string;
147
+ };
148
+ };
149
+ facialRecognition?: {
150
+ title?: string;
151
+ description?: string;
152
+ headText?: string;
153
+ };
154
+ scan?: {
155
+ titleFrontSide?: string;
156
+ titleBackSide?: string;
157
+ rescanButtonText?: string;
158
+ continueButtonText?: string;
159
+ turnDocumentDescription?: string;
160
+ tipDescription?: string;
161
+ tipDescription2?: string;
162
+ description?: string;
163
+ };
164
+ documentTypes?: Record<string | DocumentType, string>;
165
+ errors?: Record<ErrorDisplayCode, ITextErrorDisplay>;
166
+ }
167
+
168
+ // ---------- texts type --------- //
169
+
170
+ export interface IAssetsArg {
171
+ logo?: string;
172
+ logoWhite?: string;
173
+ turnOverImage?: string;
174
+ headObj?: string;
175
+ closeSessionIcon?: string;
176
+ addFileIcon?: string;
177
+ hintIcon?: string;
178
+ recordIcon?: string;
179
+ takePictureIcon?: string;
180
+ spinnerIcon?: string;
181
+ removeIcon?: string;
182
+ updateIcon?: string;
183
+ }
184
+
185
+ // ---------- common type --------- //
186
+
187
+ export type IResultInfo = string;
188
+
189
+ export type IObservableFunctionsType<R = IResultInfo, E = OperationError> = {
190
+ onSuccess?: (result: R) => void;
191
+ onError?: (error: E) => void;
192
+ onFinally?: () => void;
193
+ };
194
+
195
+ export type IResource = {
196
+ assets?: IAssetsArg;
197
+ texts?: ITextsArg;
198
+ };
199
+
200
+ export type IConfigProcess = IResource & {
201
+ returnDataForIncompleteSession?: boolean;
202
+ };
203
+
204
+ // ---------- uqudo sdk type --------- //
205
+
206
+ export type IUqudoSdkConfig = IResource & {
207
+ baseURL?: string;
208
+ accessToken: string;
209
+ nonce?: string;
210
+ userId?: string;
211
+ };
212
+
213
+ // ---------- Enrollment type --------- //
214
+
215
+ export type ReturnEnrollmentType = IResultInfo;
216
+
217
+ export type IScanConfig = {
218
+ documentType: string | DocumentType;
219
+ disableExpiryValidation?: boolean;
220
+ forceUpload?: boolean;
221
+ enableAgeVerification?: number;
222
+ };
223
+
224
+ export type IEnrollmentConfig = IConfigProcess &
225
+ IObservableFunctionsType<ReturnEnrollmentType> & {
226
+ sessionId?: string;
227
+ scan: IScanConfig | IScanConfig[];
228
+ face?: {
229
+ enableFacialRecognition?: boolean;
230
+ enrollFace?: boolean;
231
+ maxAttempts?: number;
232
+ };
233
+ lookup?: {
234
+ enableLookup: boolean;
235
+ documentTypes: (string | DocumentType)[];
236
+ };
237
+ backgroundCheck?: {
238
+ enableBackgroundCheck?: boolean;
239
+ checkType?: string | BackgroundCheckType;
240
+ disableConsent?: boolean;
241
+ skipView?: boolean;
242
+ enableMonitoring?: boolean;
243
+ };
244
+ };
245
+
246
+ // ---------- Face Session type --------- //
247
+
248
+ export type ReturnFaceSessionType = IResultInfo;
249
+
250
+ export type IFaceSessionConfig = IConfigProcess &
251
+ IObservableFunctionsType<ReturnFaceSessionType> & {
252
+ sessionId: string;
253
+ maxAttempts?: number;
254
+ };
255
+
256
+ // ---------- Account Recovery type --------- //
257
+
258
+ export type ReturnAccountRecoveryType = IResultInfo;
259
+
260
+ export type IAccountRecoveryConfig = IConfigProcess &
261
+ IObservableFunctionsType<ReturnAccountRecoveryType> & {
262
+ enrollmentIdentifier: string;
263
+ maxAttempts?: number;
264
+ };