idmission-web-sdk 1.0.242 → 1.0.244

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.
@@ -1,9 +1,3 @@
1
- export type Platform = {
2
- name: string;
3
- version: string;
4
- os: {
5
- family: string;
6
- version: string;
7
- };
8
- };
1
+ import platform from 'platform';
2
+ export type Platform = typeof platform;
9
3
  export declare function getPlatform(): Platform | undefined;
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var tslib = require('tslib');
6
6
  var React = require('react');
7
7
  var ReactDOM = require('react-dom/client');
8
+ var platform = require('platform');
8
9
  var styled = require('styled-components');
9
10
  var reactI18next = require('react-i18next');
10
11
  var tusJsClient = require('tus-js-client');
@@ -42,6 +43,7 @@ function _interopNamespace(e) {
42
43
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
43
44
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
44
45
  var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
46
+ var platform__default = /*#__PURE__*/_interopDefaultLegacy(platform);
45
47
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
46
48
  var useResizeObserver__default = /*#__PURE__*/_interopDefaultLegacy(useResizeObserver);
47
49
  var tf__namespace = /*#__PURE__*/_interopNamespace(tf);
@@ -49,13 +51,16 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
49
51
  var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
50
52
  var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
51
53
 
52
- var webSdkVersion = '1.0.242';
54
+ var webSdkVersion = '1.0.244';
53
55
 
54
56
  function getPlatform() {
55
- if (typeof window === 'undefined') return;
56
57
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
57
58
  // @ts-ignore
58
- return window.platform;
59
+ if (typeof window !== 'undefined' && typeof window.platform !== 'undefined')
60
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
61
+ // @ts-ignore
62
+ return window.platform;
63
+ return platform__default['default'];
59
64
  }
60
65
 
61
66
  function dataUrlToBase64(url) {
@@ -153,6 +158,7 @@ function apiHeaders(sessionId) {
153
158
  return headers;
154
159
  }
155
160
  function attachMetadataToRequest(request, _a) {
161
+ var _b, _c;
156
162
  var selfieCaptureAttempts = _a.selfieCaptureAttempts,
157
163
  idFrontCaptureAttempts = _a.idFrontCaptureAttempts,
158
164
  idBackCaptureAttempts = _a.idBackCaptureAttempts,
@@ -167,8 +173,8 @@ function attachMetadataToRequest(request, _a) {
167
173
  };
168
174
  var platform = getPlatform();
169
175
  if (platform) {
170
- metadata.os = platform.os.family;
171
- metadata.osVersion = platform.os.version;
176
+ metadata.os = (_b = platform.os) === null || _b === void 0 ? void 0 : _b.family;
177
+ metadata.osVersion = (_c = platform.os) === null || _c === void 0 ? void 0 : _c.version;
172
178
  metadata.browserVersion = "".concat(platform.name, " ").concat(platform.version);
173
179
  }
174
180
  if (geolocationResult) {
@@ -1776,6 +1782,7 @@ var useHighestResCaptureDevice = function useHighestResCaptureDevice(_a) {
1776
1782
  if (cameraAccessDenied) return;
1777
1783
  setCameraReady(false);
1778
1784
  listAvailableCameras().then(function (availableCameras) {
1785
+ var _a, _b;
1779
1786
  var selectedCamera;
1780
1787
  if (debugMode) {
1781
1788
  console.log('availableCameras', availableCameras);
@@ -1784,7 +1791,7 @@ var useHighestResCaptureDevice = function useHighestResCaptureDevice(_a) {
1784
1791
  if (debugMode) {
1785
1792
  console.log('platformDetails', platform);
1786
1793
  }
1787
- if (!iphoneContinuityCameraDenied && (!platform || platform.os.family === 'OS X')) {
1794
+ if (!iphoneContinuityCameraDenied && (!(platform === null || platform === void 0 ? void 0 : platform.os) || platform.os.family === 'OS X')) {
1788
1795
  var iphoneContinuityCamera = availableCameras.find(function (deviceInfo) {
1789
1796
  return labelMatches(deviceInfo, 'iphone');
1790
1797
  });
@@ -1792,7 +1799,9 @@ var useHighestResCaptureDevice = function useHighestResCaptureDevice(_a) {
1792
1799
  if (iphoneContinuityCamera && iphoneContinuityCameraAllowed) {
1793
1800
  selectedCamera = iphoneContinuityCamera;
1794
1801
  }
1795
- } else if ((platform === null || platform === void 0 ? void 0 : platform.os.family) === 'Android') {
1802
+ } else if (((_a = platform === null || platform === void 0 ? void 0 : platform.os) === null || _a === void 0 ? void 0 : _a.family) === 'Android' || availableCameras.every(function (c) {
1803
+ return c.label.startsWith('camera2 ');
1804
+ })) {
1796
1805
  availableCameras = availableCameras.sort(function (a, b) {
1797
1806
  return a.label.toLowerCase().localeCompare(b.label.toLowerCase());
1798
1807
  });
@@ -1824,7 +1833,7 @@ var useHighestResCaptureDevice = function useHighestResCaptureDevice(_a) {
1824
1833
  return labelMatches(deviceInfo, rearLabels);
1825
1834
  }));
1826
1835
  // on iOS, the front facing camera always is at the first position in the list, so we skip it if all else fails.
1827
- if (!preferFrontFacingCamera && (platform === null || platform === void 0 ? void 0 : platform.os.family) === 'iOS' && availableCameras.length > 0) {
1836
+ if (!preferFrontFacingCamera && ((_b = platform === null || platform === void 0 ? void 0 : platform.os) === null || _b === void 0 ? void 0 : _b.family) === 'iOS' && availableCameras.length > 0) {
1828
1837
  selectedCamera || (selectedCamera = availableCameras[1]);
1829
1838
  }
1830
1839
  selectedCamera || (selectedCamera = availableCameras[0]);