idmission-web-sdk 0.0.74 → 0.0.76

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.
@@ -3087,6 +3087,12 @@
3087
3087
  }();
3088
3088
  Browser.type = 'languageDetector';
3089
3089
 
3090
+ var webSdkVersion = '0.0.76';
3091
+
3092
+ function getPlatform() {
3093
+ return window.platform;
3094
+ }
3095
+
3090
3096
  var SubmissionAction;
3091
3097
  (function (SubmissionAction) {
3092
3098
  SubmissionAction["NONE"] = "NONE";
@@ -3216,6 +3222,30 @@
3216
3222
  }
3217
3223
  return headers;
3218
3224
  }
3225
+ function attachMetadataToRequest(request, _a) {
3226
+ var selfieCaptureAttempts = _a.selfieCaptureAttempts,
3227
+ idFrontCaptureAttempts = _a.idFrontCaptureAttempts,
3228
+ idBackCaptureAttempts = _a.idBackCaptureAttempts,
3229
+ geolocationResult = _a.geolocationResult;
3230
+ var metadata = {
3231
+ selfie: selfieCaptureAttempts,
3232
+ front: idFrontCaptureAttempts,
3233
+ back: idBackCaptureAttempts,
3234
+ isRealIDCheckRequired: 'false',
3235
+ sdkVersion: "WebSDK_".concat(webSdkVersion),
3236
+ Resolution: "".concat(window.innerWidth, " x ").concat(window.innerHeight)
3237
+ };
3238
+ var platform = getPlatform();
3239
+ if (platform) {
3240
+ metadata.os = platform.os.family;
3241
+ metadata.osVersion = platform.os.version;
3242
+ metadata.browserVersion = "".concat(platform.name, " ").concat(platform.version);
3243
+ }
3244
+ if (geolocationResult) {
3245
+ metadata.GeoLocation = JSON.stringify(geolocationResult);
3246
+ }
3247
+ request.additionalData.metadata = JSON.stringify(metadata);
3248
+ }
3219
3249
 
3220
3250
  function dataUrlToBase64(url) {
3221
3251
  return __awaiter(this, void 0, void 0, function () {
@@ -3788,10 +3818,6 @@
3788
3818
  }, t('Retry')))));
3789
3819
  };
3790
3820
 
3791
- function getPlatform() {
3792
- return window.platform;
3793
- }
3794
-
3795
3821
  var SubmissionErrorOverlay = function SubmissionErrorOverlay(_a) {
3796
3822
  var submissionError = _a.submissionError;
3797
3823
  return /*#__PURE__*/React__default['default'].createElement(OverlayContainer, null, /*#__PURE__*/React__default['default'].createElement(OverlayInner, {
@@ -3827,8 +3853,6 @@
3827
3853
  return SubmissionError;
3828
3854
  }(Error);
3829
3855
 
3830
- var webSdkVersion = '0.0.74';
3831
-
3832
3856
  var SubmissionProvider = function SubmissionProvider(_a) {
3833
3857
  var action = _a.action,
3834
3858
  children = _a.children,
@@ -3928,7 +3952,7 @@
3928
3952
  }, []);
3929
3953
  var submit = React.useCallback(function () {
3930
3954
  return __awaiter(void 0, void 0, void 0, function () {
3931
- var submissionResponse_1, submissionRequest_1, metadata, platform, onBeforeSubmitResult, host, endpoint, response, _a, submissionResponse_2, e_1, err;
3955
+ var submissionResponse_1, submissionRequest_1, onBeforeSubmitResult, host, endpoint, response, _a, submissionResponse_2, e_1, err;
3932
3956
  var _b;
3933
3957
  var _c;
3934
3958
  return __generator(this, function (_d) {
@@ -4031,24 +4055,12 @@
4031
4055
  });
4032
4056
  });
4033
4057
  }
4034
- metadata = {
4035
- selfie: selfieCaptureAttempts,
4036
- front: idFrontCaptureAttempts,
4037
- back: idBackCaptureAttempts,
4038
- isRealIDCheckRequired: 'false',
4039
- sdkVersion: "WebSDK_".concat(webSdkVersion),
4040
- Resolution: "".concat(window.innerWidth, " x ").concat(window.innerHeight)
4041
- };
4042
- platform = getPlatform();
4043
- if (platform) {
4044
- metadata.os = platform.os.family;
4045
- metadata.osVersion = platform.os.version;
4046
- metadata.browserVersion = "".concat(platform.name, " ").concat(platform.version);
4047
- }
4048
- if (geolocationResult) {
4049
- metadata.GeoLocation = JSON.stringify(geolocationResult);
4050
- }
4051
- submissionRequest_1.additionalData.metadata = JSON.stringify(metadata);
4058
+ attachMetadataToRequest(submissionRequest_1, {
4059
+ selfieCaptureAttempts: selfieCaptureAttempts,
4060
+ idFrontCaptureAttempts: idFrontCaptureAttempts,
4061
+ idBackCaptureAttempts: idBackCaptureAttempts,
4062
+ geolocationResult: geolocationResult
4063
+ });
4052
4064
  if (!onBeforeSubmit) return [3, 3];
4053
4065
  return [4, onBeforeSubmit(submissionRequest_1)];
4054
4066
  case 2:
@@ -4126,6 +4138,12 @@
4126
4138
  estimateAge: 'N',
4127
4139
  predictGender: 'N'
4128
4140
  }, _b);
4141
+ attachMetadataToRequest(request, {
4142
+ selfieCaptureAttempts: selfieCaptureAttempts,
4143
+ idFrontCaptureAttempts: idFrontCaptureAttempts,
4144
+ idBackCaptureAttempts: idBackCaptureAttempts,
4145
+ geolocationResult: geolocationResult
4146
+ });
4129
4147
  host = url || determineSubmissionHost(environment, token);
4130
4148
  endpoint = liveCheckEndpoint(!!token);
4131
4149
  return [4, fetch(host + endpoint, {
@@ -4167,7 +4185,7 @@
4167
4185
  }
4168
4186
  });
4169
4187
  });
4170
- }, [environment, onRequestFailure, token, url]);
4188
+ }, [environment, geolocationResult, idBackCaptureAttempts, idFrontCaptureAttempts, onRequestFailure, selfieCaptureAttempts, token, url]);
4171
4189
  var retryLocationAccess = React.useCallback(function () {
4172
4190
  setGeolocationAttempts(function (n) {
4173
4191
  return n + 1;