idmission-web-sdk 0.0.75 → 0.0.77

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.
@@ -131,6 +131,7 @@ export type LivenessCheckRequest = {
131
131
  stripSpecialCharacters: 'Y' | 'N';
132
132
  estimateAge: 'Y' | 'N';
133
133
  predictGender: 'Y' | 'N';
134
+ metadata?: string;
134
135
  };
135
136
  };
136
137
  export type LiveCheckResponse = {
@@ -178,3 +179,9 @@ export declare function determineSubmissionHost(environment: SubmissionEnvironme
178
179
  export declare function determineSubmissionEndpoint(action: SubmissionAction, hasId: boolean, hasSelfie: boolean, hasToken: boolean): string;
179
180
  export declare function liveCheckEndpoint(hasToken: boolean): string;
180
181
  export declare function apiHeaders(token?: string): HeadersInit;
182
+ export declare function attachMetadataToRequest(request: SubmissionRequest | LivenessCheckRequest, { selfieCaptureAttempts, idFrontCaptureAttempts, idBackCaptureAttempts, geolocationResult, }: {
183
+ selfieCaptureAttempts: CaptureAttemptMetadata[];
184
+ idFrontCaptureAttempts: CaptureAttemptMetadata[];
185
+ idBackCaptureAttempts: CaptureAttemptMetadata[];
186
+ geolocationResult: GeolocationPosition | null;
187
+ }): void;
@@ -50,6 +50,12 @@ var tf__namespace = /*#__PURE__*/_interopNamespace(tf);
50
50
  var useResizeObserver__default = /*#__PURE__*/_interopDefaultLegacy(useResizeObserver);
51
51
  var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
52
52
 
53
+ var webSdkVersion = '0.0.77';
54
+
55
+ function getPlatform() {
56
+ return window.platform;
57
+ }
58
+
53
59
  var SubmissionAction;
54
60
  (function (SubmissionAction) {
55
61
  SubmissionAction["NONE"] = "NONE";
@@ -179,6 +185,30 @@ function apiHeaders(token) {
179
185
  }
180
186
  return headers;
181
187
  }
188
+ function attachMetadataToRequest(request, _a) {
189
+ var selfieCaptureAttempts = _a.selfieCaptureAttempts,
190
+ idFrontCaptureAttempts = _a.idFrontCaptureAttempts,
191
+ idBackCaptureAttempts = _a.idBackCaptureAttempts,
192
+ geolocationResult = _a.geolocationResult;
193
+ var metadata = {
194
+ selfie: selfieCaptureAttempts,
195
+ front: idFrontCaptureAttempts,
196
+ back: idBackCaptureAttempts,
197
+ isRealIDCheckRequired: 'false',
198
+ sdkVersion: "WebSDK_".concat(webSdkVersion),
199
+ Resolution: "".concat(window.innerWidth, " x ").concat(window.innerHeight)
200
+ };
201
+ var platform = getPlatform();
202
+ if (platform) {
203
+ metadata.os = platform.os.family;
204
+ metadata.osVersion = platform.os.version;
205
+ metadata.browserVersion = "".concat(platform.name, " ").concat(platform.version);
206
+ }
207
+ if (geolocationResult) {
208
+ metadata.GeoLocation = JSON.stringify(geolocationResult);
209
+ }
210
+ request.additionalData.metadata = JSON.stringify(metadata);
211
+ }
182
212
 
183
213
  function dataUrlToBase64(url) {
184
214
  return tslib.__awaiter(this, void 0, void 0, function () {
@@ -348,10 +378,6 @@ var GeolocationAccessDeniedOverlay = function GeolocationAccessDeniedOverlay(_a)
348
378
  }, t('Retry')))));
349
379
  };
350
380
 
351
- function getPlatform() {
352
- return window.platform;
353
- }
354
-
355
381
  var SubmissionErrorOverlay = function SubmissionErrorOverlay(_a) {
356
382
  var submissionError = _a.submissionError;
357
383
  return /*#__PURE__*/React__default['default'].createElement(OverlayContainer, null, /*#__PURE__*/React__default['default'].createElement(OverlayInner, {
@@ -387,8 +413,6 @@ var SubmissionError = function (_super) {
387
413
  return SubmissionError;
388
414
  }(Error);
389
415
 
390
- var webSdkVersion = '0.0.75';
391
-
392
416
  var SubmissionProvider = function SubmissionProvider(_a) {
393
417
  var action = _a.action,
394
418
  children = _a.children,
@@ -488,7 +512,7 @@ var SubmissionProvider = function SubmissionProvider(_a) {
488
512
  }, []);
489
513
  var submit = React.useCallback(function () {
490
514
  return tslib.__awaiter(void 0, void 0, void 0, function () {
491
- var submissionResponse_1, submissionRequest_1, metadata, platform, onBeforeSubmitResult, host, endpoint, response, _a, submissionResponse_2, e_1, err;
515
+ var submissionResponse_1, submissionRequest_1, onBeforeSubmitResult, host, endpoint, response, _a, submissionResponse_2, e_1, err;
492
516
  var _b;
493
517
  var _c;
494
518
  return tslib.__generator(this, function (_d) {
@@ -591,24 +615,12 @@ var SubmissionProvider = function SubmissionProvider(_a) {
591
615
  });
592
616
  });
593
617
  }
594
- metadata = {
595
- selfie: selfieCaptureAttempts,
596
- front: idFrontCaptureAttempts,
597
- back: idBackCaptureAttempts,
598
- isRealIDCheckRequired: 'false',
599
- sdkVersion: "WebSDK_".concat(webSdkVersion),
600
- Resolution: "".concat(window.innerWidth, " x ").concat(window.innerHeight)
601
- };
602
- platform = getPlatform();
603
- if (platform) {
604
- metadata.os = platform.os.family;
605
- metadata.osVersion = platform.os.version;
606
- metadata.browserVersion = "".concat(platform.name, " ").concat(platform.version);
607
- }
608
- if (geolocationResult) {
609
- metadata.GeoLocation = JSON.stringify(geolocationResult);
610
- }
611
- submissionRequest_1.additionalData.metadata = JSON.stringify(metadata);
618
+ attachMetadataToRequest(submissionRequest_1, {
619
+ selfieCaptureAttempts: selfieCaptureAttempts,
620
+ idFrontCaptureAttempts: idFrontCaptureAttempts,
621
+ idBackCaptureAttempts: idBackCaptureAttempts,
622
+ geolocationResult: geolocationResult
623
+ });
612
624
  if (!onBeforeSubmit) return [3, 3];
613
625
  return [4, onBeforeSubmit(submissionRequest_1)];
614
626
  case 2:
@@ -686,6 +698,12 @@ var SubmissionProvider = function SubmissionProvider(_a) {
686
698
  estimateAge: 'N',
687
699
  predictGender: 'N'
688
700
  }, _b);
701
+ attachMetadataToRequest(request, {
702
+ selfieCaptureAttempts: selfieCaptureAttempts,
703
+ idFrontCaptureAttempts: idFrontCaptureAttempts,
704
+ idBackCaptureAttempts: idBackCaptureAttempts,
705
+ geolocationResult: geolocationResult
706
+ });
689
707
  host = url || determineSubmissionHost(environment, token);
690
708
  endpoint = liveCheckEndpoint(!!token);
691
709
  return [4, fetch(host + endpoint, {
@@ -727,7 +745,7 @@ var SubmissionProvider = function SubmissionProvider(_a) {
727
745
  }
728
746
  });
729
747
  });
730
- }, [environment, onRequestFailure, token, url]);
748
+ }, [environment, geolocationResult, idBackCaptureAttempts, idFrontCaptureAttempts, onRequestFailure, selfieCaptureAttempts, token, url]);
731
749
  var retryLocationAccess = React.useCallback(function () {
732
750
  setGeolocationAttempts(function (n) {
733
751
  return n + 1;
@@ -8578,7 +8596,7 @@ var esTranslation = {
8578
8596
  'Capturing...': 'Capturando...',
8579
8597
  'Capture failed!': 'Falló la captura',
8580
8598
  'Please flip your ID card...': 'Por favor voltea la identificación...',
8581
- 'ID card front captured.': '',
8599
+ 'ID card front captured.': 'Se ha capturado el frente de la identificación.',
8582
8600
  'ID Capture Successful': 'Captura Exitosa de ID',
8583
8601
  'Verify the entire ID was captured clearly with no glare.': 'Hay que verificar que toda la ID se vea completa y sin reflejos.',
8584
8602
  Submit: 'Enviar',