idmission-web-sdk 1.0.109 → 1.0.110

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.
@@ -47,7 +47,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
47
47
  var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
48
48
  var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
49
49
 
50
- var webSdkVersion = '1.0.109';
50
+ var webSdkVersion = '1.0.110';
51
51
 
52
52
  function getPlatform() {
53
53
  if (typeof window === 'undefined') return;
@@ -16422,10 +16422,12 @@ var documentCaptureStateReducer = function documentCaptureStateReducer(state, ac
16422
16422
  };
16423
16423
  var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
16424
16424
  var children = _a.children;
16425
- var cameraRef = React.useContext(CameraStateContext).cameraRef;
16426
- var _b = React.useReducer(documentCaptureStateReducer, documentCaptureInitialState),
16427
- state = _b[0],
16428
- dispatch = _b[1];
16425
+ var _b = React.useContext(CameraStateContext),
16426
+ cameraRef = _b.cameraRef,
16427
+ videoRef = _b.videoRef;
16428
+ var _c = React.useReducer(documentCaptureStateReducer, documentCaptureInitialState),
16429
+ state = _c[0],
16430
+ dispatch = _c[1];
16429
16431
  var onResize = useDebounce.useDebouncedCallback(function () {
16430
16432
  dispatch({
16431
16433
  type: 'redrawRequested'
@@ -16438,10 +16440,12 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
16438
16440
  window.removeEventListener('resize', onResize);
16439
16441
  };
16440
16442
  }, [onResize]);
16443
+ var videoTag = videoRef.current;
16441
16444
  React.useEffect(function () {
16442
16445
  if (!state.capturing) return;
16443
16446
  if (!cameraRef.current) return;
16444
- new ImageCapture(cameraRef.current.stream.getTracks()[0]).takePhoto().then(function (imageBlob) {
16447
+ function onComplete(imageBlob) {
16448
+ if (!imageBlob) return;
16445
16449
  var imageUrl = URL.createObjectURL(imageBlob);
16446
16450
  dispatch({
16447
16451
  type: 'captureCompleted',
@@ -16450,8 +16454,15 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
16450
16454
  imageBlob: imageBlob
16451
16455
  }
16452
16456
  });
16453
- })["catch"](function () {});
16454
- }, [cameraRef, state.capturing]);
16457
+ }
16458
+ if (typeof ImageCapture !== 'undefined') {
16459
+ new ImageCapture(cameraRef.current.stream.getTracks()[0]).takePhoto().then(onComplete)["catch"](function () {});
16460
+ } else if (videoTag) {
16461
+ var canvas = document.createElement('canvas');
16462
+ drawToCanvas(canvas, videoTag);
16463
+ canvas.toBlob(onComplete);
16464
+ }
16465
+ }, [cameraRef, state.capturing, videoTag]);
16455
16466
  return /*#__PURE__*/React__default['default'].createElement(DocumentCaptureStateContext.Provider, {
16456
16467
  value: state
16457
16468
  }, /*#__PURE__*/React__default['default'].createElement(DocumentCaptureDispatchContext.Provider, {
@@ -16747,7 +16758,8 @@ var DocumentCapture = function DocumentCapture(_a) {
16747
16758
  submissionToken = _a.submissionToken,
16748
16759
  submissionUrl = _a.submissionUrl,
16749
16760
  _c = _a.documentServiceUrl,
16750
- documentServiceUrl = _c === void 0 ? 'http://localhost:10000/files/' : _c,
16761
+ documentServiceUrl = _c === void 0 ? 'https://portal-api-dev.idmission.com/files/' : _c,
16762
+ // documentServiceUrl = 'http://localhost:10000/files/',
16751
16763
  onBeforeSubmit = _a.onBeforeSubmit,
16752
16764
  onSubmit = _a.onSubmit,
16753
16765
  onComplete = _a.onComplete,