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.
@@ -3721,59 +3721,75 @@
3721
3721
  _b = _a.environment,
3722
3722
  environment = _b === void 0 ? 'prod' : _b,
3723
3723
  token = _a.token,
3724
+ companyId = _a.companyId,
3724
3725
  enrollmentId = _a.enrollmentId,
3725
- _c = _a.geolocationEnabled,
3726
- geolocationEnabled = _c === void 0 ? true : _c,
3727
- _d = _a.geolocationRequired,
3728
- geolocationRequired = _d === void 0 ? false : _d,
3726
+ personalData = _a.personalData,
3727
+ cardData = _a.cardData,
3728
+ _c = _a.manualReviewRequired,
3729
+ manualReviewRequired = _c === void 0 ? false : _c,
3730
+ _d = _a.verifyIdWithExternalDatabases,
3731
+ verifyIdWithExternalDatabases = _d === void 0 ? false : _d,
3732
+ _e = _a.deduplicationEnabled,
3733
+ deduplicationEnabled = _e === void 0 ? false : _e,
3734
+ _f = _a.deduplicationSynchronous,
3735
+ deduplicationSynchronous = _f === void 0 ? false : _f,
3736
+ _g = _a.geolocationEnabled,
3737
+ geolocationEnabled = _g === void 0 ? true : _g,
3738
+ _h = _a.geolocationRequired,
3739
+ geolocationRequired = _h === void 0 ? false : _h,
3740
+ _j = _a.webhooksEnabled,
3741
+ webhooksEnabled = _j === void 0 ? false : _j,
3742
+ webhooksClientTraceId = _a.webhooksClientTraceId,
3743
+ _k = _a.webhooksStripSpecialCharacters,
3744
+ webhooksStripSpecialCharacters = _k === void 0 ? true : _k,
3729
3745
  onBeforeSubmit = _a.onBeforeSubmit,
3730
3746
  onResponseReceived = _a.onResponseReceived,
3731
3747
  onRequestFailure = _a.onRequestFailure;
3732
- var _e = React.useState(SubmissionStatus.READY),
3733
- submissionStatus = _e[0],
3734
- setSubmissionStatus = _e[1];
3735
- var _f = React.useState(null),
3736
- submissionRequest = _f[0],
3737
- setSubmissionRequest = _f[1];
3738
- var _g = React.useState(null),
3739
- submissionResponse = _g[0],
3740
- setSubmissionResponse = _g[1];
3741
- var _h = React.useState(null),
3742
- idFrontImage = _h[0],
3743
- setIdFrontImage = _h[1];
3744
- var _j = React.useState(null),
3745
- idBackImage = _j[0],
3746
- setIdBackImage = _j[1];
3747
- var _k = React.useState(null),
3748
- passportImage = _k[0],
3749
- setPassportImage = _k[1];
3750
- var _l = React.useState(null),
3751
- selfieImage = _l[0],
3752
- setSelfieImage = _l[1];
3748
+ var _l = React.useState(SubmissionStatus.READY),
3749
+ submissionStatus = _l[0],
3750
+ setSubmissionStatus = _l[1];
3753
3751
  var _m = React.useState(null),
3754
- signatureData = _m[0],
3755
- setSignatureData = _m[1];
3752
+ submissionRequest = _m[0],
3753
+ setSubmissionRequest = _m[1];
3756
3754
  var _o = React.useState(null),
3757
- additionalDocuments = _o[0],
3758
- setAdditionalDocuments = _o[1];
3755
+ submissionResponse = _o[0],
3756
+ setSubmissionResponse = _o[1];
3759
3757
  var _p = React.useState(null),
3760
- geolocationResult = _p[0],
3761
- setGeolocationResult = _p[1];
3762
- var _q = React.useState(0),
3763
- geolocationAttempts = _q[0],
3764
- setGeolocationAttempts = _q[1];
3765
- var _r = React.useState(false),
3766
- geolocationBlocked = _r[0],
3767
- setGeolocationBlocked = _r[1];
3768
- var _s = React.useState([]),
3769
- idFrontCaptureAttempts = _s[0],
3770
- setIdFrontCaptureAttempts = _s[1];
3771
- var _t = React.useState([]),
3772
- idBackCaptureAttempts = _t[0],
3773
- setIdBackCaptureAttempts = _t[1];
3774
- var _u = React.useState([]),
3775
- selfieCaptureAttempts = _u[0],
3776
- setSelfieCaptureAttempts = _u[1];
3758
+ idFrontImage = _p[0],
3759
+ setIdFrontImage = _p[1];
3760
+ var _q = React.useState(null),
3761
+ idBackImage = _q[0],
3762
+ setIdBackImage = _q[1];
3763
+ var _r = React.useState(null),
3764
+ passportImage = _r[0],
3765
+ setPassportImage = _r[1];
3766
+ var _s = React.useState(null),
3767
+ selfieImage = _s[0],
3768
+ setSelfieImage = _s[1];
3769
+ var _t = React.useState(null),
3770
+ signatureData = _t[0],
3771
+ setSignatureData = _t[1];
3772
+ var _u = React.useState(null),
3773
+ additionalDocuments = _u[0],
3774
+ setAdditionalDocuments = _u[1];
3775
+ var _v = React.useState(null),
3776
+ geolocationResult = _v[0],
3777
+ setGeolocationResult = _v[1];
3778
+ var _w = React.useState(0),
3779
+ geolocationAttempts = _w[0],
3780
+ setGeolocationAttempts = _w[1];
3781
+ var _x = React.useState(false),
3782
+ geolocationBlocked = _x[0],
3783
+ setGeolocationBlocked = _x[1];
3784
+ var _y = React.useState([]),
3785
+ idFrontCaptureAttempts = _y[0],
3786
+ setIdFrontCaptureAttempts = _y[1];
3787
+ var _z = React.useState([]),
3788
+ idBackCaptureAttempts = _z[0],
3789
+ setIdBackCaptureAttempts = _z[1];
3790
+ var _0 = React.useState([]),
3791
+ selfieCaptureAttempts = _0[0],
3792
+ setSelfieCaptureAttempts = _0[1];
3777
3793
  var logIdFrontCaptureAttempt = React.useCallback(function (attempt) {
3778
3794
  setIdFrontCaptureAttempts(function (attempts) {
3779
3795
  return __spreadArray(__spreadArray([], attempts, true), [attempt], false);
@@ -3792,8 +3808,9 @@
3792
3808
  var submit = React.useCallback(function () {
3793
3809
  return __awaiter(void 0, void 0, void 0, function () {
3794
3810
  var submissionResponse_1, submissionRequest_1, metadata, platform, onBeforeSubmitResult, host, endpoint, response, submissionResponse_2, e_1;
3795
- return __generator(this, function (_a) {
3796
- switch (_a.label) {
3811
+ var _a;
3812
+ return __generator(this, function (_b) {
3813
+ switch (_b.label) {
3797
3814
  case 0:
3798
3815
  if (action === SubmissionAction.NONE) {
3799
3816
  submissionResponse_1 = {
@@ -3807,9 +3824,9 @@
3807
3824
  return [2, submissionResponse_1];
3808
3825
  }
3809
3826
  setSubmissionStatus(SubmissionStatus.SUBMITTING);
3810
- _a.label = 1;
3827
+ _b.label = 1;
3811
3828
  case 1:
3812
- _a.trys.push([1, 6,, 7]);
3829
+ _b.trys.push([1, 6,, 7]);
3813
3830
  submissionRequest_1 = {
3814
3831
  securityData: {
3815
3832
  userName: '',
@@ -3825,18 +3842,18 @@
3825
3842
  },
3826
3843
  additionalData: {
3827
3844
  uniqueRequestId: new Date().getTime().toString(),
3828
- manualReviewRequired: 'N',
3845
+ manualReviewRequired: manualReviewRequired ? 'Y' : 'N',
3829
3846
  bypassAgeValidation: 'N',
3830
- deDuplicationRequired: 'N',
3847
+ deDuplicationRequired: deduplicationEnabled ? 'Y' : 'N',
3831
3848
  bypassNameMatching: 'Y',
3832
- postDataAPIRequired: 'N',
3849
+ postDataAPIRequired: webhooksEnabled ? 'Y' : 'N',
3833
3850
  sendInputImagesInPost: 'N',
3834
3851
  sendProcessedImagesInPost: 'N',
3835
3852
  needImmediateResponse: 'N',
3836
- deduplicationSynchronous: 'N',
3837
- verifyDataWithHost: 'N',
3853
+ deduplicationSynchronous: deduplicationSynchronous ? 'Y' : 'N',
3854
+ verifyDataWithHost: verifyIdWithExternalDatabases ? 'Y' : 'N',
3838
3855
  idBackImageRequired: 'N',
3839
- stripSpecialCharacters: 'Y',
3856
+ stripSpecialCharacters: webhooksStripSpecialCharacters ? 'Y' : 'N',
3840
3857
  idImageResolutionCheck: 'Y'
3841
3858
  }
3842
3859
  };
@@ -3860,11 +3877,24 @@
3860
3877
  };
3861
3878
  }
3862
3879
  }
3863
- if (enrollmentId) {
3864
- submissionRequest_1.customerData.personalData = {
3865
- uniqueNumber: enrollmentId
3880
+ if (companyId) {
3881
+ submissionRequest_1.employee = {
3882
+ companyId: companyId
3866
3883
  };
3867
3884
  }
3885
+ if (personalData) {
3886
+ submissionRequest_1.customerData.personalData = personalData;
3887
+ }
3888
+ if (cardData) {
3889
+ submissionRequest_1.customerData.cardData = cardData;
3890
+ }
3891
+ if (enrollmentId) {
3892
+ (_a = submissionRequest_1.customerData).personalData || (_a.personalData = {});
3893
+ submissionRequest_1.customerData.personalData.uniqueNumber = enrollmentId;
3894
+ }
3895
+ if (webhooksClientTraceId) {
3896
+ submissionRequest_1.additionalData.clientTraceId = webhooksClientTraceId;
3897
+ }
3868
3898
  if (signatureData) {
3869
3899
  submissionRequest_1.customerData.signatureData = {
3870
3900
  signatureImage: signatureData.fileContent
@@ -3900,9 +3930,9 @@
3900
3930
  if (!onBeforeSubmit) return [3, 3];
3901
3931
  return [4, onBeforeSubmit(submissionRequest_1)];
3902
3932
  case 2:
3903
- onBeforeSubmitResult = _a.sent();
3933
+ onBeforeSubmitResult = _b.sent();
3904
3934
  if (onBeforeSubmitResult) submissionRequest_1 = onBeforeSubmitResult;
3905
- _a.label = 3;
3935
+ _b.label = 3;
3906
3936
  case 3:
3907
3937
  host = url || determineSubmissionHost(environment, token);
3908
3938
  endpoint = determineSubmissionEndpoint(action, !!(idFrontImage || idBackImage || passportImage), !!selfieImage, !!token);
@@ -3912,17 +3942,17 @@
3912
3942
  body: JSON.stringify(submissionRequest_1)
3913
3943
  })];
3914
3944
  case 4:
3915
- response = _a.sent();
3945
+ response = _b.sent();
3916
3946
  return [4, response.json()];
3917
3947
  case 5:
3918
- submissionResponse_2 = _a.sent();
3948
+ submissionResponse_2 = _b.sent();
3919
3949
  setSubmissionRequest(submissionRequest_1);
3920
3950
  setSubmissionResponse(submissionResponse_2);
3921
3951
  setSubmissionStatus(SubmissionStatus.SUBMITTED);
3922
3952
  onResponseReceived === null || onResponseReceived === void 0 ? void 0 : onResponseReceived(submissionResponse_2);
3923
3953
  return [2, submissionResponse_2];
3924
3954
  case 6:
3925
- e_1 = _a.sent();
3955
+ e_1 = _b.sent();
3926
3956
  setSubmissionStatus(SubmissionStatus.FAILED);
3927
3957
  onRequestFailure === null || onRequestFailure === void 0 ? void 0 : onRequestFailure(e_1);
3928
3958
  return [2, null];
@@ -16182,6 +16212,14 @@
16182
16212
  _c = _a.submissionEnvironment,
16183
16213
  submissionEnvironment = _c === void 0 ? 'prod' : _c,
16184
16214
  submissionUrl = _a.submissionUrl,
16215
+ companyId = _a.companyId,
16216
+ manualReviewRequired = _a.manualReviewRequired,
16217
+ verifyIdWithExternalDatabases = _a.verifyIdWithExternalDatabases,
16218
+ personalData = _a.personalData,
16219
+ cardData = _a.cardData,
16220
+ webhooksEnabled = _a.webhooksEnabled,
16221
+ webhooksClientTraceId = _a.webhooksClientTraceId,
16222
+ webhooksStripSpecialCharacters = _a.webhooksStripSpecialCharacters,
16185
16223
  _d = _a.idAutoCaptureEnabled,
16186
16224
  idAutoCaptureEnabled = _d === void 0 ? true : _d,
16187
16225
  _e = _a.idCardAutoCaptureScoreThreshold,
@@ -16258,6 +16296,14 @@
16258
16296
  environment: submissionEnvironment,
16259
16297
  url: submissionUrl,
16260
16298
  token: submissionToken,
16299
+ companyId: companyId,
16300
+ manualReviewRequired: manualReviewRequired,
16301
+ verifyIdWithExternalDatabases: verifyIdWithExternalDatabases,
16302
+ personalData: personalData,
16303
+ cardData: cardData,
16304
+ webhooksEnabled: webhooksEnabled,
16305
+ webhooksClientTraceId: webhooksClientTraceId,
16306
+ webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
16261
16307
  onBeforeSubmit: onBeforeSubmit,
16262
16308
  onResponseReceived: onResponseReceived,
16263
16309
  geolocationEnabled: geolocationEnabled,
@@ -16281,6 +16327,10 @@
16281
16327
  _c = _a.submissionEnvironment,
16282
16328
  submissionEnvironment = _c === void 0 ? 'prod' : _c,
16283
16329
  submissionUrl = _a.submissionUrl,
16330
+ companyId = _a.companyId,
16331
+ webhooksEnabled = _a.webhooksEnabled,
16332
+ webhooksClientTraceId = _a.webhooksClientTraceId,
16333
+ webhooksStripSpecialCharacters = _a.webhooksStripSpecialCharacters,
16284
16334
  _d = _a.timeoutDurationMs,
16285
16335
  timeoutDurationMs = _d === void 0 ? 15000 : _d,
16286
16336
  onBeforeSubmit = _a.onBeforeSubmit,
@@ -16314,6 +16364,10 @@
16314
16364
  environment: submissionEnvironment,
16315
16365
  url: submissionUrl,
16316
16366
  token: submissionToken,
16367
+ companyId: companyId,
16368
+ webhooksEnabled: webhooksEnabled,
16369
+ webhooksClientTraceId: webhooksClientTraceId,
16370
+ webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
16317
16371
  onBeforeSubmit: onBeforeSubmit,
16318
16372
  geolocationEnabled: geolocationEnabled,
16319
16373
  geolocationRequired: geolocationRequired
@@ -16333,6 +16387,14 @@
16333
16387
  _c = _a.submissionEnvironment,
16334
16388
  submissionEnvironment = _c === void 0 ? 'prod' : _c,
16335
16389
  submissionUrl = _a.submissionUrl,
16390
+ companyId = _a.companyId,
16391
+ manualReviewRequired = _a.manualReviewRequired,
16392
+ verifyIdWithExternalDatabases = _a.verifyIdWithExternalDatabases,
16393
+ personalData = _a.personalData,
16394
+ cardData = _a.cardData,
16395
+ webhooksEnabled = _a.webhooksEnabled,
16396
+ webhooksClientTraceId = _a.webhooksClientTraceId,
16397
+ webhooksStripSpecialCharacters = _a.webhooksStripSpecialCharacters,
16336
16398
  _d = _a.idAutoCaptureEnabled,
16337
16399
  idAutoCaptureEnabled = _d === void 0 ? true : _d,
16338
16400
  _e = _a.idCardAutoCaptureScoreThreshold,
@@ -16423,6 +16485,14 @@
16423
16485
  environment: submissionEnvironment,
16424
16486
  url: submissionUrl,
16425
16487
  token: submissionToken,
16488
+ companyId: companyId,
16489
+ manualReviewRequired: manualReviewRequired,
16490
+ verifyIdWithExternalDatabases: verifyIdWithExternalDatabases,
16491
+ personalData: personalData,
16492
+ cardData: cardData,
16493
+ webhooksEnabled: webhooksEnabled,
16494
+ webhooksClientTraceId: webhooksClientTraceId,
16495
+ webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
16426
16496
  onBeforeSubmit: onBeforeSubmit,
16427
16497
  onResponseReceived: onResponseReceived,
16428
16498
  geolocationEnabled: geolocationEnabled,
@@ -16448,6 +16518,16 @@
16448
16518
  _c = _a.submissionEnvironment,
16449
16519
  submissionEnvironment = _c === void 0 ? 'prod' : _c,
16450
16520
  submissionUrl = _a.submissionUrl,
16521
+ companyId = _a.companyId,
16522
+ manualReviewRequired = _a.manualReviewRequired,
16523
+ verifyIdWithExternalDatabases = _a.verifyIdWithExternalDatabases,
16524
+ personalData = _a.personalData,
16525
+ cardData = _a.cardData,
16526
+ deduplicationEnabled = _a.deduplicationEnabled,
16527
+ deduplicationSynchronous = _a.deduplicationSynchronous,
16528
+ webhooksEnabled = _a.webhooksEnabled,
16529
+ webhooksClientTraceId = _a.webhooksClientTraceId,
16530
+ webhooksStripSpecialCharacters = _a.webhooksStripSpecialCharacters,
16451
16531
  _d = _a.idAutoCaptureEnabled,
16452
16532
  idAutoCaptureEnabled = _d === void 0 ? true : _d,
16453
16533
  _e = _a.idCardAutoCaptureScoreThreshold,
@@ -16537,7 +16617,17 @@
16537
16617
  environment: submissionEnvironment,
16538
16618
  url: submissionUrl,
16539
16619
  token: submissionToken,
16620
+ companyId: companyId,
16540
16621
  enrollmentId: enrollmentId,
16622
+ manualReviewRequired: manualReviewRequired,
16623
+ verifyIdWithExternalDatabases: verifyIdWithExternalDatabases,
16624
+ personalData: personalData,
16625
+ cardData: cardData,
16626
+ deduplicationEnabled: deduplicationEnabled,
16627
+ deduplicationSynchronous: deduplicationSynchronous,
16628
+ webhooksEnabled: webhooksEnabled,
16629
+ webhooksClientTraceId: webhooksClientTraceId,
16630
+ webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
16541
16631
  onBeforeSubmit: onBeforeSubmit,
16542
16632
  onResponseReceived: onResponseReceived,
16543
16633
  geolocationEnabled: geolocationEnabled,
@@ -16922,6 +17012,10 @@
16922
17012
  _c = _a.submissionEnvironment,
16923
17013
  submissionEnvironment = _c === void 0 ? 'prod' : _c,
16924
17014
  submissionUrl = _a.submissionUrl,
17015
+ companyId = _a.companyId,
17016
+ webhooksEnabled = _a.webhooksEnabled,
17017
+ webhooksClientTraceId = _a.webhooksClientTraceId,
17018
+ webhooksStripSpecialCharacters = _a.webhooksStripSpecialCharacters,
16925
17019
  _d = _a.timeoutDurationMs,
16926
17020
  timeoutDurationMs = _d === void 0 ? 15000 : _d,
16927
17021
  assets = _a.assets,
@@ -16943,7 +17037,11 @@
16943
17037
  environment: submissionEnvironment,
16944
17038
  url: submissionUrl,
16945
17039
  token: submissionToken,
17040
+ companyId: companyId,
16946
17041
  enrollmentId: enrollmentId,
17042
+ webhooksEnabled: webhooksEnabled,
17043
+ webhooksClientTraceId: webhooksClientTraceId,
17044
+ webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
16947
17045
  onBeforeSubmit: onBeforeSubmit,
16948
17046
  geolocationEnabled: geolocationEnabled,
16949
17047
  geolocationRequired: geolocationRequired
@@ -17328,6 +17426,10 @@
17328
17426
  _c = _a.submissionEnvironment,
17329
17427
  submissionEnvironment = _c === void 0 ? 'prod' : _c,
17330
17428
  submissionUrl = _a.submissionUrl,
17429
+ companyId = _a.companyId,
17430
+ webhooksEnabled = _a.webhooksEnabled,
17431
+ webhooksClientTraceId = _a.webhooksClientTraceId,
17432
+ webhooksStripSpecialCharacters = _a.webhooksStripSpecialCharacters,
17331
17433
  _d = _a.timeoutDurationMs,
17332
17434
  timeoutDurationMs = _d === void 0 ? 15000 : _d,
17333
17435
  onBeforeSubmit = _a.onBeforeSubmit,
@@ -17349,6 +17451,10 @@
17349
17451
  environment: submissionEnvironment,
17350
17452
  url: submissionUrl,
17351
17453
  token: submissionToken,
17454
+ companyId: companyId,
17455
+ webhooksEnabled: webhooksEnabled,
17456
+ webhooksClientTraceId: webhooksClientTraceId,
17457
+ webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
17352
17458
  onBeforeSubmit: onBeforeSubmit,
17353
17459
  geolocationEnabled: geolocationEnabled,
17354
17460
  geolocationRequired: geolocationRequired
@@ -17410,6 +17516,12 @@
17410
17516
  _c = _a.submissionEnvironment,
17411
17517
  submissionEnvironment = _c === void 0 ? 'prod' : _c,
17412
17518
  submissionUrl = _a.submissionUrl,
17519
+ companyId = _a.companyId,
17520
+ deduplicationEnabled = _a.deduplicationEnabled,
17521
+ deduplicationSynchronous = _a.deduplicationSynchronous,
17522
+ webhooksEnabled = _a.webhooksEnabled,
17523
+ webhooksClientTraceId = _a.webhooksClientTraceId,
17524
+ webhooksStripSpecialCharacters = _a.webhooksStripSpecialCharacters,
17413
17525
  _d = _a.timeoutDurationMs,
17414
17526
  timeoutDurationMs = _d === void 0 ? 15000 : _d,
17415
17527
  assets = _a.assets,
@@ -17472,7 +17584,13 @@
17472
17584
  environment: submissionEnvironment,
17473
17585
  url: submissionUrl,
17474
17586
  token: submissionToken,
17587
+ companyId: companyId,
17475
17588
  enrollmentId: enrollmentId,
17589
+ deduplicationEnabled: deduplicationEnabled,
17590
+ deduplicationSynchronous: deduplicationSynchronous,
17591
+ webhooksEnabled: webhooksEnabled,
17592
+ webhooksClientTraceId: webhooksClientTraceId,
17593
+ webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
17476
17594
  onBeforeSubmit: onBeforeSubmit,
17477
17595
  onResponseReceived: onResponseReceived,
17478
17596
  geolocationEnabled: geolocationEnabled,