idmission-web-sdk 1.0.94 → 1.0.96

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.
@@ -35,15 +35,16 @@ export type SubmissionRequest = {
35
35
  cardData?: CardData;
36
36
  biometricData?: {
37
37
  selfie?: string;
38
+ videoData?: string;
38
39
  };
39
40
  signatureData?: {
40
41
  signatureImage?: string;
42
+ signatureVideo?: string;
41
43
  };
42
44
  additionalDocuments?: UploadedDocument[];
43
45
  };
44
46
  biometricData?: {
45
47
  selfie?: string;
46
- videoData?: string;
47
48
  };
48
49
  additionalData: {
49
50
  uniqueRequestId: string;
@@ -1,6 +1,6 @@
1
1
  export declare const ALL_LANGUAGES: readonly ["auto", "en", "es"];
2
2
  export type LangOptions = typeof ALL_LANGUAGES;
3
- export type LangOption = LangOptions[number];
3
+ export type LangOption = LangOptions[number] | string;
4
4
  export declare const resources: {
5
5
  en: {
6
6
  translation: {};
@@ -46,7 +46,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
46
46
  var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
47
47
  var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
48
48
 
49
- var webSdkVersion = '1.0.94';
49
+ var webSdkVersion = '1.0.96';
50
50
 
51
51
  function getPlatform() {
52
52
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -788,11 +788,10 @@ var SubmissionProvider = function SubmissionProvider(_a) {
788
788
  }, [precapturedDocuments === null || precapturedDocuments === void 0 ? void 0 : precapturedDocuments.selfie]);
789
789
  var buildSubmissionPayload = React.useCallback(function () {
790
790
  return tslib.__awaiter(void 0, void 0, void 0, function () {
791
- var submissionRequest, _a, onBeforeSubmitResult;
792
- var _b;
793
- var _c;
794
- return tslib.__generator(this, function (_d) {
795
- switch (_d.label) {
791
+ var submissionRequest, _a, _b, onBeforeSubmitResult;
792
+ var _c, _d;
793
+ return tslib.__generator(this, function (_e) {
794
+ switch (_e.label) {
796
795
  case 0:
797
796
  submissionRequest = {
798
797
  securityData: {
@@ -836,14 +835,14 @@ var SubmissionProvider = function SubmissionProvider(_a) {
836
835
  }
837
836
  if (selfieImage) {
838
837
  if (action === SubmissionAction.IDENTIFY) {
838
+ // TODO: remove once API is fixed
839
839
  submissionRequest.biometricData = {
840
840
  selfie: selfieImage
841
841
  };
842
- } else {
843
- submissionRequest.customerData.biometricData = {
844
- selfie: selfieImage
845
- };
846
842
  }
843
+ submissionRequest.customerData.biometricData = {
844
+ selfie: selfieImage
845
+ };
847
846
  }
848
847
  if (companyId) {
849
848
  submissionRequest.employee = {
@@ -863,12 +862,17 @@ var SubmissionProvider = function SubmissionProvider(_a) {
863
862
  if (webhooksClientTraceId) {
864
863
  submissionRequest.additionalData.clientTraceId = webhooksClientTraceId;
865
864
  }
866
- if (signatureData) {
867
- submissionRequest.customerData.signatureData = {
868
- signatureImage: JSON.stringify(signatureData)
869
- // signatureImage: signatureData.fileContent,
870
- };
871
- }
865
+ if (!signatureData) return [3 /*break*/, 2];
866
+ submissionRequest.customerData.signatureData = {
867
+ signatureImage: JSON.stringify(signatureData)
868
+ };
869
+ if (!signatureVideoUrl) return [3 /*break*/, 2];
870
+ _a = submissionRequest.customerData.signatureData;
871
+ return [4 /*yield*/, videoDataUrlToB64(signatureVideoUrl)];
872
+ case 1:
873
+ _a.signatureVideo = _e.sent();
874
+ _e.label = 2;
875
+ case 2:
872
876
  if (additionalDocuments) {
873
877
  submissionRequest.customerData.additionalDocuments = additionalDocuments.map(function (d) {
874
878
  return tslib.__assign(tslib.__assign({}, d), {
@@ -878,27 +882,27 @@ var SubmissionProvider = function SubmissionProvider(_a) {
878
882
  });
879
883
  });
880
884
  }
881
- if (!(idCaptureVideoUrl || signatureVideoUrl)) return [3 /*break*/, 2];
882
- submissionRequest.biometricData || (submissionRequest.biometricData = {});
883
- _a = submissionRequest.biometricData;
884
- return [4 /*yield*/, videoDataUrlToB64((_b = idCaptureVideoUrl !== null && idCaptureVideoUrl !== void 0 ? idCaptureVideoUrl : signatureVideoUrl) !== null && _b !== void 0 ? _b : '')];
885
- case 1:
886
- _a.videoData = _d.sent();
887
- _d.label = 2;
888
- case 2:
885
+ if (!idCaptureVideoUrl) return [3 /*break*/, 4];
886
+ (_d = submissionRequest.customerData).biometricData || (_d.biometricData = {});
887
+ _b = submissionRequest.customerData.biometricData;
888
+ return [4 /*yield*/, videoDataUrlToB64(idCaptureVideoUrl)];
889
+ case 3:
890
+ _b.videoData = _e.sent();
891
+ _e.label = 4;
892
+ case 4:
889
893
  attachMetadataToRequest(submissionRequest, {
890
894
  selfieCaptureAttempts: selfieCaptureAttempts,
891
895
  idFrontCaptureAttempts: idFrontCaptureAttempts,
892
896
  idBackCaptureAttempts: idBackCaptureAttempts,
893
897
  geolocationResult: geolocationResult
894
898
  });
895
- if (!onBeforeSubmit) return [3 /*break*/, 4];
899
+ if (!onBeforeSubmit) return [3 /*break*/, 6];
896
900
  return [4 /*yield*/, onBeforeSubmit(submissionRequest)];
897
- case 3:
898
- onBeforeSubmitResult = _d.sent();
901
+ case 5:
902
+ onBeforeSubmitResult = _e.sent();
899
903
  if (onBeforeSubmitResult) submissionRequest = onBeforeSubmitResult;
900
- _d.label = 4;
901
- case 4:
904
+ _e.label = 6;
905
+ case 6:
902
906
  return [2 /*return*/, submissionRequest];
903
907
  }
904
908
  });