idmission-web-sdk 0.0.21 → 0.0.23

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/sdk2.esm.js CHANGED
@@ -261,59 +261,75 @@ var SubmissionProvider = function SubmissionProvider(_a) {
261
261
  _b = _a.environment,
262
262
  environment = _b === void 0 ? 'prod' : _b,
263
263
  token = _a.token,
264
+ companyId = _a.companyId,
264
265
  enrollmentId = _a.enrollmentId,
265
- _c = _a.geolocationEnabled,
266
- geolocationEnabled = _c === void 0 ? true : _c,
267
- _d = _a.geolocationRequired,
268
- geolocationRequired = _d === void 0 ? false : _d,
266
+ personalData = _a.personalData,
267
+ cardData = _a.cardData,
268
+ _c = _a.manualReviewRequired,
269
+ manualReviewRequired = _c === void 0 ? false : _c,
270
+ _d = _a.verifyIdWithExternalDatabases,
271
+ verifyIdWithExternalDatabases = _d === void 0 ? false : _d,
272
+ _e = _a.deduplicationEnabled,
273
+ deduplicationEnabled = _e === void 0 ? false : _e,
274
+ _f = _a.deduplicationSynchronous,
275
+ deduplicationSynchronous = _f === void 0 ? false : _f,
276
+ _g = _a.geolocationEnabled,
277
+ geolocationEnabled = _g === void 0 ? true : _g,
278
+ _h = _a.geolocationRequired,
279
+ geolocationRequired = _h === void 0 ? false : _h,
280
+ _j = _a.webhooksEnabled,
281
+ webhooksEnabled = _j === void 0 ? false : _j,
282
+ webhooksClientTraceId = _a.webhooksClientTraceId,
283
+ _k = _a.webhooksStripSpecialCharacters,
284
+ webhooksStripSpecialCharacters = _k === void 0 ? true : _k,
269
285
  onBeforeSubmit = _a.onBeforeSubmit,
270
286
  onResponseReceived = _a.onResponseReceived,
271
287
  onRequestFailure = _a.onRequestFailure;
272
- var _e = useState(SubmissionStatus.READY),
273
- submissionStatus = _e[0],
274
- setSubmissionStatus = _e[1];
275
- var _f = useState(null),
276
- submissionRequest = _f[0],
277
- setSubmissionRequest = _f[1];
278
- var _g = useState(null),
279
- submissionResponse = _g[0],
280
- setSubmissionResponse = _g[1];
281
- var _h = useState(null),
282
- idFrontImage = _h[0],
283
- setIdFrontImage = _h[1];
284
- var _j = useState(null),
285
- idBackImage = _j[0],
286
- setIdBackImage = _j[1];
287
- var _k = useState(null),
288
- passportImage = _k[0],
289
- setPassportImage = _k[1];
290
- var _l = useState(null),
291
- selfieImage = _l[0],
292
- setSelfieImage = _l[1];
288
+ var _l = useState(SubmissionStatus.READY),
289
+ submissionStatus = _l[0],
290
+ setSubmissionStatus = _l[1];
293
291
  var _m = useState(null),
294
- signatureData = _m[0],
295
- setSignatureData = _m[1];
292
+ submissionRequest = _m[0],
293
+ setSubmissionRequest = _m[1];
296
294
  var _o = useState(null),
297
- additionalDocuments = _o[0],
298
- setAdditionalDocuments = _o[1];
295
+ submissionResponse = _o[0],
296
+ setSubmissionResponse = _o[1];
299
297
  var _p = useState(null),
300
- geolocationResult = _p[0],
301
- setGeolocationResult = _p[1];
302
- var _q = useState(0),
303
- geolocationAttempts = _q[0],
304
- setGeolocationAttempts = _q[1];
305
- var _r = useState(false),
306
- geolocationBlocked = _r[0],
307
- setGeolocationBlocked = _r[1];
308
- var _s = useState([]),
309
- idFrontCaptureAttempts = _s[0],
310
- setIdFrontCaptureAttempts = _s[1];
311
- var _t = useState([]),
312
- idBackCaptureAttempts = _t[0],
313
- setIdBackCaptureAttempts = _t[1];
314
- var _u = useState([]),
315
- selfieCaptureAttempts = _u[0],
316
- setSelfieCaptureAttempts = _u[1];
298
+ idFrontImage = _p[0],
299
+ setIdFrontImage = _p[1];
300
+ var _q = useState(null),
301
+ idBackImage = _q[0],
302
+ setIdBackImage = _q[1];
303
+ var _r = useState(null),
304
+ passportImage = _r[0],
305
+ setPassportImage = _r[1];
306
+ var _s = useState(null),
307
+ selfieImage = _s[0],
308
+ setSelfieImage = _s[1];
309
+ var _t = useState(null),
310
+ signatureData = _t[0],
311
+ setSignatureData = _t[1];
312
+ var _u = useState(null),
313
+ additionalDocuments = _u[0],
314
+ setAdditionalDocuments = _u[1];
315
+ var _v = useState(null),
316
+ geolocationResult = _v[0],
317
+ setGeolocationResult = _v[1];
318
+ var _w = useState(0),
319
+ geolocationAttempts = _w[0],
320
+ setGeolocationAttempts = _w[1];
321
+ var _x = useState(false),
322
+ geolocationBlocked = _x[0],
323
+ setGeolocationBlocked = _x[1];
324
+ var _y = useState([]),
325
+ idFrontCaptureAttempts = _y[0],
326
+ setIdFrontCaptureAttempts = _y[1];
327
+ var _z = useState([]),
328
+ idBackCaptureAttempts = _z[0],
329
+ setIdBackCaptureAttempts = _z[1];
330
+ var _0 = useState([]),
331
+ selfieCaptureAttempts = _0[0],
332
+ setSelfieCaptureAttempts = _0[1];
317
333
  var logIdFrontCaptureAttempt = useCallback(function (attempt) {
318
334
  setIdFrontCaptureAttempts(function (attempts) {
319
335
  return __spreadArray(__spreadArray([], attempts, true), [attempt], false);
@@ -332,8 +348,9 @@ var SubmissionProvider = function SubmissionProvider(_a) {
332
348
  var submit = useCallback(function () {
333
349
  return __awaiter(void 0, void 0, void 0, function () {
334
350
  var submissionResponse_1, submissionRequest_1, metadata, platform, onBeforeSubmitResult, host, endpoint, response, submissionResponse_2, e_1;
335
- return __generator(this, function (_a) {
336
- switch (_a.label) {
351
+ var _a;
352
+ return __generator(this, function (_b) {
353
+ switch (_b.label) {
337
354
  case 0:
338
355
  if (action === SubmissionAction.NONE) {
339
356
  submissionResponse_1 = {
@@ -347,9 +364,9 @@ var SubmissionProvider = function SubmissionProvider(_a) {
347
364
  return [2, submissionResponse_1];
348
365
  }
349
366
  setSubmissionStatus(SubmissionStatus.SUBMITTING);
350
- _a.label = 1;
367
+ _b.label = 1;
351
368
  case 1:
352
- _a.trys.push([1, 6,, 7]);
369
+ _b.trys.push([1, 6,, 7]);
353
370
  submissionRequest_1 = {
354
371
  securityData: {
355
372
  userName: '',
@@ -365,18 +382,18 @@ var SubmissionProvider = function SubmissionProvider(_a) {
365
382
  },
366
383
  additionalData: {
367
384
  uniqueRequestId: new Date().getTime().toString(),
368
- manualReviewRequired: 'N',
385
+ manualReviewRequired: manualReviewRequired ? 'Y' : 'N',
369
386
  bypassAgeValidation: 'N',
370
- deDuplicationRequired: 'N',
387
+ deDuplicationRequired: deduplicationEnabled ? 'Y' : 'N',
371
388
  bypassNameMatching: 'Y',
372
- postDataAPIRequired: 'N',
389
+ postDataAPIRequired: webhooksEnabled ? 'Y' : 'N',
373
390
  sendInputImagesInPost: 'N',
374
391
  sendProcessedImagesInPost: 'N',
375
392
  needImmediateResponse: 'N',
376
- deduplicationSynchronous: 'N',
377
- verifyDataWithHost: 'N',
393
+ deduplicationSynchronous: deduplicationSynchronous ? 'Y' : 'N',
394
+ verifyDataWithHost: verifyIdWithExternalDatabases ? 'Y' : 'N',
378
395
  idBackImageRequired: 'N',
379
- stripSpecialCharacters: 'Y',
396
+ stripSpecialCharacters: webhooksStripSpecialCharacters ? 'Y' : 'N',
380
397
  idImageResolutionCheck: 'Y'
381
398
  }
382
399
  };
@@ -400,11 +417,24 @@ var SubmissionProvider = function SubmissionProvider(_a) {
400
417
  };
401
418
  }
402
419
  }
403
- if (enrollmentId) {
404
- submissionRequest_1.customerData.personalData = {
405
- uniqueNumber: enrollmentId
420
+ if (companyId) {
421
+ submissionRequest_1.employee = {
422
+ companyId: companyId
406
423
  };
407
424
  }
425
+ if (personalData) {
426
+ submissionRequest_1.customerData.personalData = personalData;
427
+ }
428
+ if (cardData) {
429
+ submissionRequest_1.customerData.cardData = cardData;
430
+ }
431
+ if (enrollmentId) {
432
+ (_a = submissionRequest_1.customerData).personalData || (_a.personalData = {});
433
+ submissionRequest_1.customerData.personalData.uniqueNumber = enrollmentId;
434
+ }
435
+ if (webhooksClientTraceId) {
436
+ submissionRequest_1.additionalData.clientTraceId = webhooksClientTraceId;
437
+ }
408
438
  if (signatureData) {
409
439
  submissionRequest_1.customerData.signatureData = {
410
440
  signatureImage: signatureData.fileContent
@@ -440,9 +470,9 @@ var SubmissionProvider = function SubmissionProvider(_a) {
440
470
  if (!onBeforeSubmit) return [3, 3];
441
471
  return [4, onBeforeSubmit(submissionRequest_1)];
442
472
  case 2:
443
- onBeforeSubmitResult = _a.sent();
473
+ onBeforeSubmitResult = _b.sent();
444
474
  if (onBeforeSubmitResult) submissionRequest_1 = onBeforeSubmitResult;
445
- _a.label = 3;
475
+ _b.label = 3;
446
476
  case 3:
447
477
  host = url || determineSubmissionHost(environment, token);
448
478
  endpoint = determineSubmissionEndpoint(action, !!(idFrontImage || idBackImage || passportImage), !!selfieImage, !!token);
@@ -452,17 +482,17 @@ var SubmissionProvider = function SubmissionProvider(_a) {
452
482
  body: JSON.stringify(submissionRequest_1)
453
483
  })];
454
484
  case 4:
455
- response = _a.sent();
485
+ response = _b.sent();
456
486
  return [4, response.json()];
457
487
  case 5:
458
- submissionResponse_2 = _a.sent();
488
+ submissionResponse_2 = _b.sent();
459
489
  setSubmissionRequest(submissionRequest_1);
460
490
  setSubmissionResponse(submissionResponse_2);
461
491
  setSubmissionStatus(SubmissionStatus.SUBMITTED);
462
492
  onResponseReceived === null || onResponseReceived === void 0 ? void 0 : onResponseReceived(submissionResponse_2);
463
493
  return [2, submissionResponse_2];
464
494
  case 6:
465
- e_1 = _a.sent();
495
+ e_1 = _b.sent();
466
496
  setSubmissionStatus(SubmissionStatus.FAILED);
467
497
  onRequestFailure === null || onRequestFailure === void 0 ? void 0 : onRequestFailure(e_1);
468
498
  return [2, null];
@@ -11913,6 +11943,14 @@ var IdValidation = function IdValidation(_a) {
11913
11943
  _c = _a.submissionEnvironment,
11914
11944
  submissionEnvironment = _c === void 0 ? 'prod' : _c,
11915
11945
  submissionUrl = _a.submissionUrl,
11946
+ companyId = _a.companyId,
11947
+ manualReviewRequired = _a.manualReviewRequired,
11948
+ verifyIdWithExternalDatabases = _a.verifyIdWithExternalDatabases,
11949
+ personalData = _a.personalData,
11950
+ cardData = _a.cardData,
11951
+ webhooksEnabled = _a.webhooksEnabled,
11952
+ webhooksClientTraceId = _a.webhooksClientTraceId,
11953
+ webhooksStripSpecialCharacters = _a.webhooksStripSpecialCharacters,
11916
11954
  _d = _a.idAutoCaptureEnabled,
11917
11955
  idAutoCaptureEnabled = _d === void 0 ? true : _d,
11918
11956
  _e = _a.idCardAutoCaptureScoreThreshold,
@@ -11989,6 +12027,14 @@ var IdValidation = function IdValidation(_a) {
11989
12027
  environment: submissionEnvironment,
11990
12028
  url: submissionUrl,
11991
12029
  token: submissionToken,
12030
+ companyId: companyId,
12031
+ manualReviewRequired: manualReviewRequired,
12032
+ verifyIdWithExternalDatabases: verifyIdWithExternalDatabases,
12033
+ personalData: personalData,
12034
+ cardData: cardData,
12035
+ webhooksEnabled: webhooksEnabled,
12036
+ webhooksClientTraceId: webhooksClientTraceId,
12037
+ webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
11992
12038
  onBeforeSubmit: onBeforeSubmit,
11993
12039
  onResponseReceived: onResponseReceived,
11994
12040
  geolocationEnabled: geolocationEnabled,
@@ -12012,6 +12058,10 @@ var FaceValidation = function FaceValidation(_a) {
12012
12058
  _c = _a.submissionEnvironment,
12013
12059
  submissionEnvironment = _c === void 0 ? 'prod' : _c,
12014
12060
  submissionUrl = _a.submissionUrl,
12061
+ companyId = _a.companyId,
12062
+ webhooksEnabled = _a.webhooksEnabled,
12063
+ webhooksClientTraceId = _a.webhooksClientTraceId,
12064
+ webhooksStripSpecialCharacters = _a.webhooksStripSpecialCharacters,
12015
12065
  _d = _a.timeoutDurationMs,
12016
12066
  timeoutDurationMs = _d === void 0 ? 15000 : _d,
12017
12067
  onBeforeSubmit = _a.onBeforeSubmit,
@@ -12045,6 +12095,10 @@ var FaceValidation = function FaceValidation(_a) {
12045
12095
  environment: submissionEnvironment,
12046
12096
  url: submissionUrl,
12047
12097
  token: submissionToken,
12098
+ companyId: companyId,
12099
+ webhooksEnabled: webhooksEnabled,
12100
+ webhooksClientTraceId: webhooksClientTraceId,
12101
+ webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
12048
12102
  onBeforeSubmit: onBeforeSubmit,
12049
12103
  geolocationEnabled: geolocationEnabled,
12050
12104
  geolocationRequired: geolocationRequired
@@ -12064,6 +12118,14 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
12064
12118
  _c = _a.submissionEnvironment,
12065
12119
  submissionEnvironment = _c === void 0 ? 'prod' : _c,
12066
12120
  submissionUrl = _a.submissionUrl,
12121
+ companyId = _a.companyId,
12122
+ manualReviewRequired = _a.manualReviewRequired,
12123
+ verifyIdWithExternalDatabases = _a.verifyIdWithExternalDatabases,
12124
+ personalData = _a.personalData,
12125
+ cardData = _a.cardData,
12126
+ webhooksEnabled = _a.webhooksEnabled,
12127
+ webhooksClientTraceId = _a.webhooksClientTraceId,
12128
+ webhooksStripSpecialCharacters = _a.webhooksStripSpecialCharacters,
12067
12129
  _d = _a.idAutoCaptureEnabled,
12068
12130
  idAutoCaptureEnabled = _d === void 0 ? true : _d,
12069
12131
  _e = _a.idCardAutoCaptureScoreThreshold,
@@ -12154,6 +12216,14 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
12154
12216
  environment: submissionEnvironment,
12155
12217
  url: submissionUrl,
12156
12218
  token: submissionToken,
12219
+ companyId: companyId,
12220
+ manualReviewRequired: manualReviewRequired,
12221
+ verifyIdWithExternalDatabases: verifyIdWithExternalDatabases,
12222
+ personalData: personalData,
12223
+ cardData: cardData,
12224
+ webhooksEnabled: webhooksEnabled,
12225
+ webhooksClientTraceId: webhooksClientTraceId,
12226
+ webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
12157
12227
  onBeforeSubmit: onBeforeSubmit,
12158
12228
  onResponseReceived: onResponseReceived,
12159
12229
  geolocationEnabled: geolocationEnabled,
@@ -12179,6 +12249,16 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
12179
12249
  _c = _a.submissionEnvironment,
12180
12250
  submissionEnvironment = _c === void 0 ? 'prod' : _c,
12181
12251
  submissionUrl = _a.submissionUrl,
12252
+ companyId = _a.companyId,
12253
+ manualReviewRequired = _a.manualReviewRequired,
12254
+ verifyIdWithExternalDatabases = _a.verifyIdWithExternalDatabases,
12255
+ personalData = _a.personalData,
12256
+ cardData = _a.cardData,
12257
+ deduplicationEnabled = _a.deduplicationEnabled,
12258
+ deduplicationSynchronous = _a.deduplicationSynchronous,
12259
+ webhooksEnabled = _a.webhooksEnabled,
12260
+ webhooksClientTraceId = _a.webhooksClientTraceId,
12261
+ webhooksStripSpecialCharacters = _a.webhooksStripSpecialCharacters,
12182
12262
  _d = _a.idAutoCaptureEnabled,
12183
12263
  idAutoCaptureEnabled = _d === void 0 ? true : _d,
12184
12264
  _e = _a.idCardAutoCaptureScoreThreshold,
@@ -12268,7 +12348,17 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
12268
12348
  environment: submissionEnvironment,
12269
12349
  url: submissionUrl,
12270
12350
  token: submissionToken,
12351
+ companyId: companyId,
12271
12352
  enrollmentId: enrollmentId,
12353
+ manualReviewRequired: manualReviewRequired,
12354
+ verifyIdWithExternalDatabases: verifyIdWithExternalDatabases,
12355
+ personalData: personalData,
12356
+ cardData: cardData,
12357
+ deduplicationEnabled: deduplicationEnabled,
12358
+ deduplicationSynchronous: deduplicationSynchronous,
12359
+ webhooksEnabled: webhooksEnabled,
12360
+ webhooksClientTraceId: webhooksClientTraceId,
12361
+ webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
12272
12362
  onBeforeSubmit: onBeforeSubmit,
12273
12363
  onResponseReceived: onResponseReceived,
12274
12364
  geolocationEnabled: geolocationEnabled,
@@ -12653,6 +12743,10 @@ var CustomerVerification = function CustomerVerification(_a) {
12653
12743
  _c = _a.submissionEnvironment,
12654
12744
  submissionEnvironment = _c === void 0 ? 'prod' : _c,
12655
12745
  submissionUrl = _a.submissionUrl,
12746
+ companyId = _a.companyId,
12747
+ webhooksEnabled = _a.webhooksEnabled,
12748
+ webhooksClientTraceId = _a.webhooksClientTraceId,
12749
+ webhooksStripSpecialCharacters = _a.webhooksStripSpecialCharacters,
12656
12750
  _d = _a.timeoutDurationMs,
12657
12751
  timeoutDurationMs = _d === void 0 ? 15000 : _d,
12658
12752
  assets = _a.assets,
@@ -12674,7 +12768,11 @@ var CustomerVerification = function CustomerVerification(_a) {
12674
12768
  environment: submissionEnvironment,
12675
12769
  url: submissionUrl,
12676
12770
  token: submissionToken,
12771
+ companyId: companyId,
12677
12772
  enrollmentId: enrollmentId,
12773
+ webhooksEnabled: webhooksEnabled,
12774
+ webhooksClientTraceId: webhooksClientTraceId,
12775
+ webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
12678
12776
  onBeforeSubmit: onBeforeSubmit,
12679
12777
  geolocationEnabled: geolocationEnabled,
12680
12778
  geolocationRequired: geolocationRequired
@@ -13059,6 +13157,10 @@ var CustomerIdentification = function CustomerIdentification(_a) {
13059
13157
  _c = _a.submissionEnvironment,
13060
13158
  submissionEnvironment = _c === void 0 ? 'prod' : _c,
13061
13159
  submissionUrl = _a.submissionUrl,
13160
+ companyId = _a.companyId,
13161
+ webhooksEnabled = _a.webhooksEnabled,
13162
+ webhooksClientTraceId = _a.webhooksClientTraceId,
13163
+ webhooksStripSpecialCharacters = _a.webhooksStripSpecialCharacters,
13062
13164
  _d = _a.timeoutDurationMs,
13063
13165
  timeoutDurationMs = _d === void 0 ? 15000 : _d,
13064
13166
  onBeforeSubmit = _a.onBeforeSubmit,
@@ -13080,6 +13182,10 @@ var CustomerIdentification = function CustomerIdentification(_a) {
13080
13182
  environment: submissionEnvironment,
13081
13183
  url: submissionUrl,
13082
13184
  token: submissionToken,
13185
+ companyId: companyId,
13186
+ webhooksEnabled: webhooksEnabled,
13187
+ webhooksClientTraceId: webhooksClientTraceId,
13188
+ webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
13083
13189
  onBeforeSubmit: onBeforeSubmit,
13084
13190
  geolocationEnabled: geolocationEnabled,
13085
13191
  geolocationRequired: geolocationRequired
@@ -13141,6 +13247,12 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
13141
13247
  _c = _a.submissionEnvironment,
13142
13248
  submissionEnvironment = _c === void 0 ? 'prod' : _c,
13143
13249
  submissionUrl = _a.submissionUrl,
13250
+ companyId = _a.companyId,
13251
+ deduplicationEnabled = _a.deduplicationEnabled,
13252
+ deduplicationSynchronous = _a.deduplicationSynchronous,
13253
+ webhooksEnabled = _a.webhooksEnabled,
13254
+ webhooksClientTraceId = _a.webhooksClientTraceId,
13255
+ webhooksStripSpecialCharacters = _a.webhooksStripSpecialCharacters,
13144
13256
  _d = _a.timeoutDurationMs,
13145
13257
  timeoutDurationMs = _d === void 0 ? 15000 : _d,
13146
13258
  assets = _a.assets,
@@ -13203,7 +13315,13 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
13203
13315
  environment: submissionEnvironment,
13204
13316
  url: submissionUrl,
13205
13317
  token: submissionToken,
13318
+ companyId: companyId,
13206
13319
  enrollmentId: enrollmentId,
13320
+ deduplicationEnabled: deduplicationEnabled,
13321
+ deduplicationSynchronous: deduplicationSynchronous,
13322
+ webhooksEnabled: webhooksEnabled,
13323
+ webhooksClientTraceId: webhooksClientTraceId,
13324
+ webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
13207
13325
  onBeforeSubmit: onBeforeSubmit,
13208
13326
  onResponseReceived: onResponseReceived,
13209
13327
  geolocationEnabled: geolocationEnabled,