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.
@@ -297,59 +297,75 @@ var SubmissionProvider = function SubmissionProvider(_a) {
297
297
  _b = _a.environment,
298
298
  environment = _b === void 0 ? 'prod' : _b,
299
299
  token = _a.token,
300
+ companyId = _a.companyId,
300
301
  enrollmentId = _a.enrollmentId,
301
- _c = _a.geolocationEnabled,
302
- geolocationEnabled = _c === void 0 ? true : _c,
303
- _d = _a.geolocationRequired,
304
- geolocationRequired = _d === void 0 ? false : _d,
302
+ personalData = _a.personalData,
303
+ cardData = _a.cardData,
304
+ _c = _a.manualReviewRequired,
305
+ manualReviewRequired = _c === void 0 ? false : _c,
306
+ _d = _a.verifyIdWithExternalDatabases,
307
+ verifyIdWithExternalDatabases = _d === void 0 ? false : _d,
308
+ _e = _a.deduplicationEnabled,
309
+ deduplicationEnabled = _e === void 0 ? false : _e,
310
+ _f = _a.deduplicationSynchronous,
311
+ deduplicationSynchronous = _f === void 0 ? false : _f,
312
+ _g = _a.geolocationEnabled,
313
+ geolocationEnabled = _g === void 0 ? true : _g,
314
+ _h = _a.geolocationRequired,
315
+ geolocationRequired = _h === void 0 ? false : _h,
316
+ _j = _a.webhooksEnabled,
317
+ webhooksEnabled = _j === void 0 ? false : _j,
318
+ webhooksClientTraceId = _a.webhooksClientTraceId,
319
+ _k = _a.webhooksStripSpecialCharacters,
320
+ webhooksStripSpecialCharacters = _k === void 0 ? true : _k,
305
321
  onBeforeSubmit = _a.onBeforeSubmit,
306
322
  onResponseReceived = _a.onResponseReceived,
307
323
  onRequestFailure = _a.onRequestFailure;
308
- var _e = React.useState(SubmissionStatus.READY),
309
- submissionStatus = _e[0],
310
- setSubmissionStatus = _e[1];
311
- var _f = React.useState(null),
312
- submissionRequest = _f[0],
313
- setSubmissionRequest = _f[1];
314
- var _g = React.useState(null),
315
- submissionResponse = _g[0],
316
- setSubmissionResponse = _g[1];
317
- var _h = React.useState(null),
318
- idFrontImage = _h[0],
319
- setIdFrontImage = _h[1];
320
- var _j = React.useState(null),
321
- idBackImage = _j[0],
322
- setIdBackImage = _j[1];
323
- var _k = React.useState(null),
324
- passportImage = _k[0],
325
- setPassportImage = _k[1];
326
- var _l = React.useState(null),
327
- selfieImage = _l[0],
328
- setSelfieImage = _l[1];
324
+ var _l = React.useState(SubmissionStatus.READY),
325
+ submissionStatus = _l[0],
326
+ setSubmissionStatus = _l[1];
329
327
  var _m = React.useState(null),
330
- signatureData = _m[0],
331
- setSignatureData = _m[1];
328
+ submissionRequest = _m[0],
329
+ setSubmissionRequest = _m[1];
332
330
  var _o = React.useState(null),
333
- additionalDocuments = _o[0],
334
- setAdditionalDocuments = _o[1];
331
+ submissionResponse = _o[0],
332
+ setSubmissionResponse = _o[1];
335
333
  var _p = React.useState(null),
336
- geolocationResult = _p[0],
337
- setGeolocationResult = _p[1];
338
- var _q = React.useState(0),
339
- geolocationAttempts = _q[0],
340
- setGeolocationAttempts = _q[1];
341
- var _r = React.useState(false),
342
- geolocationBlocked = _r[0],
343
- setGeolocationBlocked = _r[1];
344
- var _s = React.useState([]),
345
- idFrontCaptureAttempts = _s[0],
346
- setIdFrontCaptureAttempts = _s[1];
347
- var _t = React.useState([]),
348
- idBackCaptureAttempts = _t[0],
349
- setIdBackCaptureAttempts = _t[1];
350
- var _u = React.useState([]),
351
- selfieCaptureAttempts = _u[0],
352
- setSelfieCaptureAttempts = _u[1];
334
+ idFrontImage = _p[0],
335
+ setIdFrontImage = _p[1];
336
+ var _q = React.useState(null),
337
+ idBackImage = _q[0],
338
+ setIdBackImage = _q[1];
339
+ var _r = React.useState(null),
340
+ passportImage = _r[0],
341
+ setPassportImage = _r[1];
342
+ var _s = React.useState(null),
343
+ selfieImage = _s[0],
344
+ setSelfieImage = _s[1];
345
+ var _t = React.useState(null),
346
+ signatureData = _t[0],
347
+ setSignatureData = _t[1];
348
+ var _u = React.useState(null),
349
+ additionalDocuments = _u[0],
350
+ setAdditionalDocuments = _u[1];
351
+ var _v = React.useState(null),
352
+ geolocationResult = _v[0],
353
+ setGeolocationResult = _v[1];
354
+ var _w = React.useState(0),
355
+ geolocationAttempts = _w[0],
356
+ setGeolocationAttempts = _w[1];
357
+ var _x = React.useState(false),
358
+ geolocationBlocked = _x[0],
359
+ setGeolocationBlocked = _x[1];
360
+ var _y = React.useState([]),
361
+ idFrontCaptureAttempts = _y[0],
362
+ setIdFrontCaptureAttempts = _y[1];
363
+ var _z = React.useState([]),
364
+ idBackCaptureAttempts = _z[0],
365
+ setIdBackCaptureAttempts = _z[1];
366
+ var _0 = React.useState([]),
367
+ selfieCaptureAttempts = _0[0],
368
+ setSelfieCaptureAttempts = _0[1];
353
369
  var logIdFrontCaptureAttempt = React.useCallback(function (attempt) {
354
370
  setIdFrontCaptureAttempts(function (attempts) {
355
371
  return tslib.__spreadArray(tslib.__spreadArray([], attempts, true), [attempt], false);
@@ -368,8 +384,9 @@ var SubmissionProvider = function SubmissionProvider(_a) {
368
384
  var submit = React.useCallback(function () {
369
385
  return tslib.__awaiter(void 0, void 0, void 0, function () {
370
386
  var submissionResponse_1, submissionRequest_1, metadata, platform, onBeforeSubmitResult, host, endpoint, response, submissionResponse_2, e_1;
371
- return tslib.__generator(this, function (_a) {
372
- switch (_a.label) {
387
+ var _a;
388
+ return tslib.__generator(this, function (_b) {
389
+ switch (_b.label) {
373
390
  case 0:
374
391
  if (action === SubmissionAction.NONE) {
375
392
  submissionResponse_1 = {
@@ -383,9 +400,9 @@ var SubmissionProvider = function SubmissionProvider(_a) {
383
400
  return [2, submissionResponse_1];
384
401
  }
385
402
  setSubmissionStatus(SubmissionStatus.SUBMITTING);
386
- _a.label = 1;
403
+ _b.label = 1;
387
404
  case 1:
388
- _a.trys.push([1, 6,, 7]);
405
+ _b.trys.push([1, 6,, 7]);
389
406
  submissionRequest_1 = {
390
407
  securityData: {
391
408
  userName: '',
@@ -401,18 +418,18 @@ var SubmissionProvider = function SubmissionProvider(_a) {
401
418
  },
402
419
  additionalData: {
403
420
  uniqueRequestId: new Date().getTime().toString(),
404
- manualReviewRequired: 'N',
421
+ manualReviewRequired: manualReviewRequired ? 'Y' : 'N',
405
422
  bypassAgeValidation: 'N',
406
- deDuplicationRequired: 'N',
423
+ deDuplicationRequired: deduplicationEnabled ? 'Y' : 'N',
407
424
  bypassNameMatching: 'Y',
408
- postDataAPIRequired: 'N',
425
+ postDataAPIRequired: webhooksEnabled ? 'Y' : 'N',
409
426
  sendInputImagesInPost: 'N',
410
427
  sendProcessedImagesInPost: 'N',
411
428
  needImmediateResponse: 'N',
412
- deduplicationSynchronous: 'N',
413
- verifyDataWithHost: 'N',
429
+ deduplicationSynchronous: deduplicationSynchronous ? 'Y' : 'N',
430
+ verifyDataWithHost: verifyIdWithExternalDatabases ? 'Y' : 'N',
414
431
  idBackImageRequired: 'N',
415
- stripSpecialCharacters: 'Y',
432
+ stripSpecialCharacters: webhooksStripSpecialCharacters ? 'Y' : 'N',
416
433
  idImageResolutionCheck: 'Y'
417
434
  }
418
435
  };
@@ -436,11 +453,24 @@ var SubmissionProvider = function SubmissionProvider(_a) {
436
453
  };
437
454
  }
438
455
  }
439
- if (enrollmentId) {
440
- submissionRequest_1.customerData.personalData = {
441
- uniqueNumber: enrollmentId
456
+ if (companyId) {
457
+ submissionRequest_1.employee = {
458
+ companyId: companyId
442
459
  };
443
460
  }
461
+ if (personalData) {
462
+ submissionRequest_1.customerData.personalData = personalData;
463
+ }
464
+ if (cardData) {
465
+ submissionRequest_1.customerData.cardData = cardData;
466
+ }
467
+ if (enrollmentId) {
468
+ (_a = submissionRequest_1.customerData).personalData || (_a.personalData = {});
469
+ submissionRequest_1.customerData.personalData.uniqueNumber = enrollmentId;
470
+ }
471
+ if (webhooksClientTraceId) {
472
+ submissionRequest_1.additionalData.clientTraceId = webhooksClientTraceId;
473
+ }
444
474
  if (signatureData) {
445
475
  submissionRequest_1.customerData.signatureData = {
446
476
  signatureImage: signatureData.fileContent
@@ -476,9 +506,9 @@ var SubmissionProvider = function SubmissionProvider(_a) {
476
506
  if (!onBeforeSubmit) return [3, 3];
477
507
  return [4, onBeforeSubmit(submissionRequest_1)];
478
508
  case 2:
479
- onBeforeSubmitResult = _a.sent();
509
+ onBeforeSubmitResult = _b.sent();
480
510
  if (onBeforeSubmitResult) submissionRequest_1 = onBeforeSubmitResult;
481
- _a.label = 3;
511
+ _b.label = 3;
482
512
  case 3:
483
513
  host = url || determineSubmissionHost(environment, token);
484
514
  endpoint = determineSubmissionEndpoint(action, !!(idFrontImage || idBackImage || passportImage), !!selfieImage, !!token);
@@ -488,17 +518,17 @@ var SubmissionProvider = function SubmissionProvider(_a) {
488
518
  body: JSON.stringify(submissionRequest_1)
489
519
  })];
490
520
  case 4:
491
- response = _a.sent();
521
+ response = _b.sent();
492
522
  return [4, response.json()];
493
523
  case 5:
494
- submissionResponse_2 = _a.sent();
524
+ submissionResponse_2 = _b.sent();
495
525
  setSubmissionRequest(submissionRequest_1);
496
526
  setSubmissionResponse(submissionResponse_2);
497
527
  setSubmissionStatus(SubmissionStatus.SUBMITTED);
498
528
  onResponseReceived === null || onResponseReceived === void 0 ? void 0 : onResponseReceived(submissionResponse_2);
499
529
  return [2, submissionResponse_2];
500
530
  case 6:
501
- e_1 = _a.sent();
531
+ e_1 = _b.sent();
502
532
  setSubmissionStatus(SubmissionStatus.FAILED);
503
533
  onRequestFailure === null || onRequestFailure === void 0 ? void 0 : onRequestFailure(e_1);
504
534
  return [2, null];
@@ -11949,6 +11979,14 @@ var IdValidation = function IdValidation(_a) {
11949
11979
  _c = _a.submissionEnvironment,
11950
11980
  submissionEnvironment = _c === void 0 ? 'prod' : _c,
11951
11981
  submissionUrl = _a.submissionUrl,
11982
+ companyId = _a.companyId,
11983
+ manualReviewRequired = _a.manualReviewRequired,
11984
+ verifyIdWithExternalDatabases = _a.verifyIdWithExternalDatabases,
11985
+ personalData = _a.personalData,
11986
+ cardData = _a.cardData,
11987
+ webhooksEnabled = _a.webhooksEnabled,
11988
+ webhooksClientTraceId = _a.webhooksClientTraceId,
11989
+ webhooksStripSpecialCharacters = _a.webhooksStripSpecialCharacters,
11952
11990
  _d = _a.idAutoCaptureEnabled,
11953
11991
  idAutoCaptureEnabled = _d === void 0 ? true : _d,
11954
11992
  _e = _a.idCardAutoCaptureScoreThreshold,
@@ -12025,6 +12063,14 @@ var IdValidation = function IdValidation(_a) {
12025
12063
  environment: submissionEnvironment,
12026
12064
  url: submissionUrl,
12027
12065
  token: submissionToken,
12066
+ companyId: companyId,
12067
+ manualReviewRequired: manualReviewRequired,
12068
+ verifyIdWithExternalDatabases: verifyIdWithExternalDatabases,
12069
+ personalData: personalData,
12070
+ cardData: cardData,
12071
+ webhooksEnabled: webhooksEnabled,
12072
+ webhooksClientTraceId: webhooksClientTraceId,
12073
+ webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
12028
12074
  onBeforeSubmit: onBeforeSubmit,
12029
12075
  onResponseReceived: onResponseReceived,
12030
12076
  geolocationEnabled: geolocationEnabled,
@@ -12048,6 +12094,10 @@ var FaceValidation = function FaceValidation(_a) {
12048
12094
  _c = _a.submissionEnvironment,
12049
12095
  submissionEnvironment = _c === void 0 ? 'prod' : _c,
12050
12096
  submissionUrl = _a.submissionUrl,
12097
+ companyId = _a.companyId,
12098
+ webhooksEnabled = _a.webhooksEnabled,
12099
+ webhooksClientTraceId = _a.webhooksClientTraceId,
12100
+ webhooksStripSpecialCharacters = _a.webhooksStripSpecialCharacters,
12051
12101
  _d = _a.timeoutDurationMs,
12052
12102
  timeoutDurationMs = _d === void 0 ? 15000 : _d,
12053
12103
  onBeforeSubmit = _a.onBeforeSubmit,
@@ -12081,6 +12131,10 @@ var FaceValidation = function FaceValidation(_a) {
12081
12131
  environment: submissionEnvironment,
12082
12132
  url: submissionUrl,
12083
12133
  token: submissionToken,
12134
+ companyId: companyId,
12135
+ webhooksEnabled: webhooksEnabled,
12136
+ webhooksClientTraceId: webhooksClientTraceId,
12137
+ webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
12084
12138
  onBeforeSubmit: onBeforeSubmit,
12085
12139
  geolocationEnabled: geolocationEnabled,
12086
12140
  geolocationRequired: geolocationRequired
@@ -12100,6 +12154,14 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
12100
12154
  _c = _a.submissionEnvironment,
12101
12155
  submissionEnvironment = _c === void 0 ? 'prod' : _c,
12102
12156
  submissionUrl = _a.submissionUrl,
12157
+ companyId = _a.companyId,
12158
+ manualReviewRequired = _a.manualReviewRequired,
12159
+ verifyIdWithExternalDatabases = _a.verifyIdWithExternalDatabases,
12160
+ personalData = _a.personalData,
12161
+ cardData = _a.cardData,
12162
+ webhooksEnabled = _a.webhooksEnabled,
12163
+ webhooksClientTraceId = _a.webhooksClientTraceId,
12164
+ webhooksStripSpecialCharacters = _a.webhooksStripSpecialCharacters,
12103
12165
  _d = _a.idAutoCaptureEnabled,
12104
12166
  idAutoCaptureEnabled = _d === void 0 ? true : _d,
12105
12167
  _e = _a.idCardAutoCaptureScoreThreshold,
@@ -12190,6 +12252,14 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
12190
12252
  environment: submissionEnvironment,
12191
12253
  url: submissionUrl,
12192
12254
  token: submissionToken,
12255
+ companyId: companyId,
12256
+ manualReviewRequired: manualReviewRequired,
12257
+ verifyIdWithExternalDatabases: verifyIdWithExternalDatabases,
12258
+ personalData: personalData,
12259
+ cardData: cardData,
12260
+ webhooksEnabled: webhooksEnabled,
12261
+ webhooksClientTraceId: webhooksClientTraceId,
12262
+ webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
12193
12263
  onBeforeSubmit: onBeforeSubmit,
12194
12264
  onResponseReceived: onResponseReceived,
12195
12265
  geolocationEnabled: geolocationEnabled,
@@ -12215,6 +12285,16 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
12215
12285
  _c = _a.submissionEnvironment,
12216
12286
  submissionEnvironment = _c === void 0 ? 'prod' : _c,
12217
12287
  submissionUrl = _a.submissionUrl,
12288
+ companyId = _a.companyId,
12289
+ manualReviewRequired = _a.manualReviewRequired,
12290
+ verifyIdWithExternalDatabases = _a.verifyIdWithExternalDatabases,
12291
+ personalData = _a.personalData,
12292
+ cardData = _a.cardData,
12293
+ deduplicationEnabled = _a.deduplicationEnabled,
12294
+ deduplicationSynchronous = _a.deduplicationSynchronous,
12295
+ webhooksEnabled = _a.webhooksEnabled,
12296
+ webhooksClientTraceId = _a.webhooksClientTraceId,
12297
+ webhooksStripSpecialCharacters = _a.webhooksStripSpecialCharacters,
12218
12298
  _d = _a.idAutoCaptureEnabled,
12219
12299
  idAutoCaptureEnabled = _d === void 0 ? true : _d,
12220
12300
  _e = _a.idCardAutoCaptureScoreThreshold,
@@ -12304,7 +12384,17 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
12304
12384
  environment: submissionEnvironment,
12305
12385
  url: submissionUrl,
12306
12386
  token: submissionToken,
12387
+ companyId: companyId,
12307
12388
  enrollmentId: enrollmentId,
12389
+ manualReviewRequired: manualReviewRequired,
12390
+ verifyIdWithExternalDatabases: verifyIdWithExternalDatabases,
12391
+ personalData: personalData,
12392
+ cardData: cardData,
12393
+ deduplicationEnabled: deduplicationEnabled,
12394
+ deduplicationSynchronous: deduplicationSynchronous,
12395
+ webhooksEnabled: webhooksEnabled,
12396
+ webhooksClientTraceId: webhooksClientTraceId,
12397
+ webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
12308
12398
  onBeforeSubmit: onBeforeSubmit,
12309
12399
  onResponseReceived: onResponseReceived,
12310
12400
  geolocationEnabled: geolocationEnabled,
@@ -12689,6 +12779,10 @@ var CustomerVerification = function CustomerVerification(_a) {
12689
12779
  _c = _a.submissionEnvironment,
12690
12780
  submissionEnvironment = _c === void 0 ? 'prod' : _c,
12691
12781
  submissionUrl = _a.submissionUrl,
12782
+ companyId = _a.companyId,
12783
+ webhooksEnabled = _a.webhooksEnabled,
12784
+ webhooksClientTraceId = _a.webhooksClientTraceId,
12785
+ webhooksStripSpecialCharacters = _a.webhooksStripSpecialCharacters,
12692
12786
  _d = _a.timeoutDurationMs,
12693
12787
  timeoutDurationMs = _d === void 0 ? 15000 : _d,
12694
12788
  assets = _a.assets,
@@ -12710,7 +12804,11 @@ var CustomerVerification = function CustomerVerification(_a) {
12710
12804
  environment: submissionEnvironment,
12711
12805
  url: submissionUrl,
12712
12806
  token: submissionToken,
12807
+ companyId: companyId,
12713
12808
  enrollmentId: enrollmentId,
12809
+ webhooksEnabled: webhooksEnabled,
12810
+ webhooksClientTraceId: webhooksClientTraceId,
12811
+ webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
12714
12812
  onBeforeSubmit: onBeforeSubmit,
12715
12813
  geolocationEnabled: geolocationEnabled,
12716
12814
  geolocationRequired: geolocationRequired
@@ -13095,6 +13193,10 @@ var CustomerIdentification = function CustomerIdentification(_a) {
13095
13193
  _c = _a.submissionEnvironment,
13096
13194
  submissionEnvironment = _c === void 0 ? 'prod' : _c,
13097
13195
  submissionUrl = _a.submissionUrl,
13196
+ companyId = _a.companyId,
13197
+ webhooksEnabled = _a.webhooksEnabled,
13198
+ webhooksClientTraceId = _a.webhooksClientTraceId,
13199
+ webhooksStripSpecialCharacters = _a.webhooksStripSpecialCharacters,
13098
13200
  _d = _a.timeoutDurationMs,
13099
13201
  timeoutDurationMs = _d === void 0 ? 15000 : _d,
13100
13202
  onBeforeSubmit = _a.onBeforeSubmit,
@@ -13116,6 +13218,10 @@ var CustomerIdentification = function CustomerIdentification(_a) {
13116
13218
  environment: submissionEnvironment,
13117
13219
  url: submissionUrl,
13118
13220
  token: submissionToken,
13221
+ companyId: companyId,
13222
+ webhooksEnabled: webhooksEnabled,
13223
+ webhooksClientTraceId: webhooksClientTraceId,
13224
+ webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
13119
13225
  onBeforeSubmit: onBeforeSubmit,
13120
13226
  geolocationEnabled: geolocationEnabled,
13121
13227
  geolocationRequired: geolocationRequired
@@ -13177,6 +13283,12 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
13177
13283
  _c = _a.submissionEnvironment,
13178
13284
  submissionEnvironment = _c === void 0 ? 'prod' : _c,
13179
13285
  submissionUrl = _a.submissionUrl,
13286
+ companyId = _a.companyId,
13287
+ deduplicationEnabled = _a.deduplicationEnabled,
13288
+ deduplicationSynchronous = _a.deduplicationSynchronous,
13289
+ webhooksEnabled = _a.webhooksEnabled,
13290
+ webhooksClientTraceId = _a.webhooksClientTraceId,
13291
+ webhooksStripSpecialCharacters = _a.webhooksStripSpecialCharacters,
13180
13292
  _d = _a.timeoutDurationMs,
13181
13293
  timeoutDurationMs = _d === void 0 ? 15000 : _d,
13182
13294
  assets = _a.assets,
@@ -13239,7 +13351,13 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
13239
13351
  environment: submissionEnvironment,
13240
13352
  url: submissionUrl,
13241
13353
  token: submissionToken,
13354
+ companyId: companyId,
13242
13355
  enrollmentId: enrollmentId,
13356
+ deduplicationEnabled: deduplicationEnabled,
13357
+ deduplicationSynchronous: deduplicationSynchronous,
13358
+ webhooksEnabled: webhooksEnabled,
13359
+ webhooksClientTraceId: webhooksClientTraceId,
13360
+ webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
13243
13361
  onBeforeSubmit: onBeforeSubmit,
13244
13362
  onResponseReceived: onResponseReceived,
13245
13363
  geolocationEnabled: geolocationEnabled,