idmission-web-sdk 2.6.1-changeset-release-develop-a09dd14 → 2.6.1-changeset-release-develop-3d44875

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.
package/dist/sdk2.esm.js CHANGED
@@ -16391,7 +16391,7 @@ function _acquireCamera() {
16391
16391
  });
16392
16392
  case 8:
16393
16393
  if (stream) {
16394
- _context.next = 12;
16394
+ _context.next = 13;
16395
16395
  break;
16396
16396
  }
16397
16397
  _context.prev = 9;
@@ -16405,21 +16405,26 @@ function _acquireCamera() {
16405
16405
  debug$1(LOG_TAG + " opened fallback stream", {
16406
16406
  maxVideoResolution: maxVideoResolution
16407
16407
  });
16408
- _context.next = 12;
16408
+ _context.next = 13;
16409
16409
  break;
16410
16410
  case 11:
16411
16411
  _context.prev = 11;
16412
16412
  _t2 = _context["catch"](9);
16413
- // cameraStore.tsx:288-290 — non-fatal logging path, kept verbatim.
16414
- debug$1(LOG_TAG + " cannot open stream at all", _t2);
16413
+ if (!(_t2.name === 'NotAllowedError')) {
16414
+ _context.next = 12;
16415
+ break;
16416
+ }
16417
+ throw _t2;
16415
16418
  case 12:
16419
+ debug$1(LOG_TAG + " cannot open stream at all", _t2);
16420
+ case 13:
16416
16421
  if (stream) {
16417
- _context.next = 13;
16422
+ _context.next = 14;
16418
16423
  break;
16419
16424
  }
16420
16425
  error$1(LOG_TAG + " failed to open camera");
16421
16426
  throw new Error('failed to open camera: ');
16422
- case 13:
16427
+ case 14:
16423
16428
  debug$1(LOG_TAG + " camera access requested with constraints", constraints);
16424
16429
  handleStreamEnded = function handleStreamEnded() {
16425
16430
  // cameraStore.tsx:303-326 — sdk2 branches on whether a continuity
@@ -16442,7 +16447,7 @@ function _acquireCamera() {
16442
16447
  handleStreamEnded();
16443
16448
  };
16444
16449
  camera = obtainCameraAccess(stream, selectedCamera.label, videoEl);
16445
- _context.next = 14;
16450
+ _context.next = 15;
16446
16451
  return new Promise(function (resolve) {
16447
16452
  scheduleTimeout(function () {
16448
16453
  // iOS 17 has a strange behavior where the video track flickers
@@ -16458,7 +16463,7 @@ function _acquireCamera() {
16458
16463
  resolve();
16459
16464
  }, 500);
16460
16465
  });
16461
- case 14:
16466
+ case 15:
16462
16467
  isRearFacing = (_camera$isRearFacing = camera == null ? void 0 : camera.isRearFacing) != null ? _camera$isRearFacing : false;
16463
16468
  return _context.abrupt("return", {
16464
16469
  camera: camera,
@@ -16468,18 +16473,18 @@ function _acquireCamera() {
16468
16473
  return camera.release();
16469
16474
  }
16470
16475
  });
16471
- case 15:
16472
- _context.prev = 15;
16476
+ case 16:
16477
+ _context.prev = 16;
16473
16478
  _t3 = _context["catch"](2);
16474
16479
  if (!(_t3 instanceof CaptureAttachError)) {
16475
- _context.next = 16;
16480
+ _context.next = 17;
16476
16481
  break;
16477
16482
  }
16478
16483
  throw _t3;
16479
- case 16:
16484
+ case 17:
16480
16485
  err = _t3;
16481
16486
  if (!(err.name === 'NotAllowedError')) {
16482
- _context.next = 17;
16487
+ _context.next = 18;
16483
16488
  break;
16484
16489
  }
16485
16490
  // cameraStore.tsx:374-381 — outer catch's "blocked by the user" path.
@@ -16490,9 +16495,9 @@ function _acquireCamera() {
16490
16495
  code: 'CAMERA_PERMISSION_DENIED',
16491
16496
  recoverable: true
16492
16497
  });
16493
- case 17:
16498
+ case 18:
16494
16499
  if (!((_err$message = err.message) != null && _err$message.includes('failed to open camera') || (_err$message2 = err.message) != null && _err$message2.includes('Could not start video source'))) {
16495
- _context.next = 18;
16500
+ _context.next = 19;
16496
16501
  break;
16497
16502
  }
16498
16503
  error$1(LOG_TAG + " camera access encountered some other error", _t3);
@@ -16501,16 +16506,16 @@ function _acquireCamera() {
16501
16506
  recoverable: true,
16502
16507
  cause: _t3
16503
16508
  });
16504
- case 18:
16509
+ case 19:
16505
16510
  // cameraStore.tsx:382-385 — genuinely unexpected error; sdk2 rethrows it
16506
16511
  // as-is (no CaptureError bucket exists for it), so we do too.
16507
16512
  error$1(LOG_TAG + " camera access encountered some other error", _t3);
16508
16513
  throw _t3;
16509
- case 19:
16514
+ case 20:
16510
16515
  case "end":
16511
16516
  return _context.stop();
16512
16517
  }
16513
- }, _callee, null, [[2, 15], [5, 7], [9, 11]]);
16518
+ }, _callee, null, [[2, 16], [5, 7], [9, 11]]);
16514
16519
  }));
16515
16520
  return _acquireCamera.apply(this, arguments);
16516
16521
  }
@@ -20942,6 +20947,34 @@ var ErrorCard = styled(FlexCard)(_templateObject$A || (_templateObject$A = _tagg
20942
20947
  var Heading$8 = styled.h1(_templateObject2$v || (_templateObject2$v = _taggedTemplateLiteralLoose(["\n font-size: 1.5rem;\n margin-top: 0;\n margin-bottom: 1rem;\n"])));
20943
20948
  var Description$2 = styled.p(_templateObject3$m || (_templateObject3$m = _taggedTemplateLiteralLoose(["\n line-height: 1.5;\n margin-bottom: 1.5rem;\n"])));
20944
20949
 
20950
+ function reasonFor(code) {
20951
+ if (code === 'CAMERA_PERMISSION_DENIED') return 'permissionDenied';
20952
+ if (code === 'CAMERA_UNAVAILABLE') return 'unavailable';
20953
+ return undefined;
20954
+ }
20955
+ /**
20956
+ * Calls `onCameraAccessDenied` once per camera failure a controller reports:
20957
+ * when its error code becomes one, changes to the other, or a different
20958
+ * controller reports one. Not per render, and not again when StrictMode
20959
+ * replays effects, since the latch only moves when what it saw changes. A
20960
+ * failure seen with no handler bound is not latched, so a handler bound later
20961
+ * still hears about it; one already reported stays latched while the handler
20962
+ * is briefly unbound.
20963
+ */
20964
+ function useCameraAccessDeniedReport(controller, errorCode, onCameraAccessDenied) {
20965
+ var reason = reasonFor(errorCode);
20966
+ var reportedRef = useRef(undefined);
20967
+ useEffect(function () {
20968
+ var reported = reportedRef.current;
20969
+ var alreadyReported = (reported == null ? void 0 : reported.controller) === controller && reported.reason === reason;
20970
+ reportedRef.current = {
20971
+ controller: controller,
20972
+ reason: onCameraAccessDenied || alreadyReported ? reason : undefined
20973
+ };
20974
+ if (reason && onCameraAccessDenied && !alreadyReported) onCameraAccessDenied(reason);
20975
+ }, [controller, reason, onCameraAccessDenied]);
20976
+ }
20977
+
20945
20978
  // The one file-read both fallback screens use.
20946
20979
  //
20947
20980
  // Shared rather than duplicated: they read the same kind of file for the same
@@ -21770,7 +21803,6 @@ function IdCaptureViewContent(_ref) {
21770
21803
  var pendingPrecapturedRef = useRef(new Set());
21771
21804
  var seenPrecapturedRef = useRef(new Set());
21772
21805
  var tamperReportedRef = useRef(false);
21773
- var cameraDeniedReportedRef = useRef(false);
21774
21806
  var reportedModelErrorRef = useRef(null);
21775
21807
  // A new controller is a new session, so every notification latch below has
21776
21808
  // to start over — the same reasoning as the attach and overlay-dismissal
@@ -21788,7 +21820,6 @@ function IdCaptureViewContent(_ref) {
21788
21820
  pendingPrecapturedRef.current = new Set();
21789
21821
  seenPrecapturedRef.current = new Set();
21790
21822
  tamperReportedRef.current = false;
21791
- cameraDeniedReportedRef.current = false;
21792
21823
  reportedModelErrorRef.current = null;
21793
21824
  }, [controller]);
21794
21825
  useEffect(function () {
@@ -21840,16 +21871,7 @@ function IdCaptureViewContent(_ref) {
21840
21871
  // controller's typed error, which is where core lands a denied camera and a
21841
21872
  // failed model load alike (dual-truth contract: the same failure is already
21842
21873
  // on screen, so these are notifications, not the error UI).
21843
- var cameraDenied = ((_state$error2 = state.error) == null ? void 0 : _state$error2.code) === 'CAMERA_PERMISSION_DENIED';
21844
- useEffect(function () {
21845
- if (!cameraDenied) {
21846
- cameraDeniedReportedRef.current = false;
21847
- return;
21848
- }
21849
- if (cameraDeniedReportedRef.current) return;
21850
- cameraDeniedReportedRef.current = true;
21851
- onCameraAccessDenied == null || onCameraAccessDenied();
21852
- }, [controller, cameraDenied, onCameraAccessDenied]);
21874
+ useCameraAccessDeniedReport(controller, (_state$error2 = state.error) == null ? void 0 : _state$error2.code, onCameraAccessDenied);
21853
21875
  // Keyed on the ERROR OBJECT's identity, not on its cause: a MODEL_LOAD_FAILED
21854
21876
  // with no cause attached is still a model failure the host asked to hear
21855
21877
  // about, and keying on the cause skipped those entirely. A second, different
@@ -27471,7 +27493,7 @@ var StyledButtonsRow$4 = styled(ButtonsRow$2)(_templateObject6$9 || (_templateOb
27471
27493
 
27472
27494
  var _templateObject$p, _templateObject2$m;
27473
27495
  function SelfieCaptureSurface(_ref) {
27474
- var _state$error, _state$error2, _state$captureRecover, _state$error5, _state$captureRecover2, _state$prediction, _state$prediction$sam, _state$prediction2, _state$prediction3, _state$prediction4, _state$prediction5, _state$prediction6, _state$prediction7, _state$prediction8, _state$prediction9, _state$prediction0, _state$prediction1, _state$prediction$bri, _state$prediction10, _state$prediction$ran, _state$prediction11, _state$prediction$var, _state$prediction12, _assets$loadingOverla, _classNames$loadingOv, _colors$loadingOverla, _verbiage$loadingOver;
27496
+ var _state$error, _state$error2, _state$captureRecover, _state$error4, _state$error5, _state$captureRecover2, _state$prediction, _state$prediction$sam, _state$prediction2, _state$prediction3, _state$prediction4, _state$prediction5, _state$prediction6, _state$prediction7, _state$prediction8, _state$prediction9, _state$prediction0, _state$prediction1, _state$prediction$bri, _state$prediction10, _state$prediction$ran, _state$prediction11, _state$prediction$var, _state$prediction12, _assets$loadingOverla, _classNames$loadingOv, _colors$loadingOverla, _verbiage$loadingOver;
27475
27497
  var controller = _ref.controller,
27476
27498
  state = _ref.state,
27477
27499
  loadingOverlayMode = _ref.loadingOverlayMode,
@@ -27653,10 +27675,9 @@ function SelfieCaptureSurface(_ref) {
27653
27675
  kind: 'no-prompt'
27654
27676
  });
27655
27677
  var reportedModelErrorRef = useRef(null);
27656
- var cameraDeniedReportedRef = useRef(false);
27657
27678
  var tamperReportedRef = useRef(false);
27658
27679
  useEffect(function () {
27659
- var _state$error3, _state$error4;
27680
+ var _state$error3;
27660
27681
  var modelError = state.models.error;
27661
27682
  if (modelError && modelError !== reportedModelErrorRef.current) {
27662
27683
  reportedModelErrorRef.current = modelError;
@@ -27664,21 +27685,16 @@ function SelfieCaptureSurface(_ref) {
27664
27685
  onModelError == null || onModelError(modelError);
27665
27686
  }
27666
27687
  if (!modelError) reportedModelErrorRef.current = null;
27667
- var cameraDenied = ((_state$error3 = state.error) == null ? void 0 : _state$error3.code) === 'CAMERA_PERMISSION_DENIED';
27668
- if (cameraDenied && !cameraDeniedReportedRef.current) {
27669
- cameraDeniedReportedRef.current = true;
27670
- onCameraAccessDenied == null || onCameraAccessDenied();
27671
- }
27672
- if (!cameraDenied) cameraDeniedReportedRef.current = false;
27673
27688
  // Same one-shot latch as IdCaptureView's: the host counts detections, not
27674
27689
  // renders, and a cleared-then-re-detected tamper is a second detection.
27675
- var tampered = ((_state$error4 = state.error) == null ? void 0 : _state$error4.code) === 'CAMERA_TAMPERING_SUSPECTED';
27690
+ var tampered = ((_state$error3 = state.error) == null ? void 0 : _state$error3.code) === 'CAMERA_TAMPERING_SUSPECTED';
27676
27691
  if (tampered && !tamperReportedRef.current) {
27677
27692
  tamperReportedRef.current = true;
27678
27693
  onCameraTamperingDetected == null || onCameraTamperingDetected();
27679
27694
  }
27680
27695
  if (!tampered) tamperReportedRef.current = false;
27681
- }, [onCameraAccessDenied, onCameraTamperingDetected, onLoadingFailed, onModelError, (_state$error5 = state.error) == null ? void 0 : _state$error5.code, state.models.error]);
27696
+ }, [onCameraTamperingDetected, onLoadingFailed, onModelError, (_state$error4 = state.error) == null ? void 0 : _state$error4.code, state.models.error]);
27697
+ useCameraAccessDeniedReport(controller, (_state$error5 = state.error) == null ? void 0 : _state$error5.code, onCameraAccessDenied);
27682
27698
  var handleLoadingContinue = useCallback(function () {
27683
27699
  void controller.actions.start();
27684
27700
  onLoadingOverlayDismissed == null || onLoadingOverlayDismissed();
@@ -36376,7 +36392,7 @@ function DocumentCaptureView(props) {
36376
36392
  });
36377
36393
  }
36378
36394
  function DocumentCaptureSurface(_ref) {
36379
- var _entry$contentUrl, _entry$uploadState, _uiDocument$cameraFee, _entry$item$aspectRat, _uiDocument$instructi, _entry$item$title, _theme$documentCaptur, _theme$documentCaptur2, _state$autoCaptureShu, _state$autoCaptureShu2, _state$autoCaptureShu3, _state$autoCapture, _theme$documentCaptur3, _theme$documentCaptur4, _theme$colors$positiv, _theme$colors, _entry$item$title2, _entry$captureMetadat, _entry$captureMetadat2, _opaqueColor, _state$error, _state$error2, _guideRect$x, _guideRect$y, _guideRect$width, _guideRect$height, _state$autoCapture$gu, _state$autoCapture2;
36395
+ var _entry$contentUrl, _entry$uploadState, _uiDocument$cameraFee, _entry$item$aspectRat, _uiDocument$instructi, _entry$item$title, _theme$documentCaptur, _theme$documentCaptur2, _state$autoCaptureShu, _state$autoCaptureShu2, _state$autoCaptureShu3, _state$autoCapture, _theme$documentCaptur3, _theme$documentCaptur4, _theme$colors$positiv, _theme$colors, _entry$item$title2, _entry$captureMetadat, _entry$captureMetadat2, _opaqueColor, _state$error, _state$error2, _state$error3, _state$error4, _guideRect$x, _guideRect$y, _guideRect$width, _guideRect$height, _state$autoCapture$gu, _state$autoCapture2;
36380
36396
  var controller = _ref.controller,
36381
36397
  _ref$lang = _ref.lang,
36382
36398
  lang = _ref$lang === void 0 ? 'auto' : _ref$lang,
@@ -36605,20 +36621,13 @@ function DocumentCaptureSurface(_ref) {
36605
36621
  completedRef.current = true;
36606
36622
  onCompleted == null || onCompleted();
36607
36623
  }, [everyUploaded, onCompleted]);
36608
- var cameraAccessDenied = ((_state$error = state.error) == null ? void 0 : _state$error.code) === 'CAMERA_PERMISSION_DENIED';
36609
- var cameraTampered = ((_state$error2 = state.error) == null ? void 0 : _state$error2.code) === 'CAMERA_TAMPERING_SUSPECTED';
36610
- // Latched like the completion effect above: a notification per denial or
36611
- // detection, not per render.
36612
- var deniedReportedRef = useRef(false);
36613
- useEffect(function () {
36614
- if (!cameraAccessDenied) {
36615
- deniedReportedRef.current = false;
36616
- return;
36617
- }
36618
- if (deniedReportedRef.current) return;
36619
- deniedReportedRef.current = true;
36620
- onCameraAccessDenied == null || onCameraAccessDenied();
36621
- }, [cameraAccessDenied, onCameraAccessDenied]);
36624
+ // Either camera failure leaves the capture button stuck on "Loading", so
36625
+ // both get the retry button.
36626
+ var cameraFailed = ((_state$error = state.error) == null ? void 0 : _state$error.code) === 'CAMERA_PERMISSION_DENIED' || ((_state$error2 = state.error) == null ? void 0 : _state$error2.code) === 'CAMERA_UNAVAILABLE';
36627
+ var cameraTampered = ((_state$error3 = state.error) == null ? void 0 : _state$error3.code) === 'CAMERA_TAMPERING_SUSPECTED';
36628
+ // Latched like the completion effect above: a notification per camera
36629
+ // failure or detection, not per render.
36630
+ useCameraAccessDeniedReport(controller, (_state$error4 = state.error) == null ? void 0 : _state$error4.code, onCameraAccessDenied);
36622
36631
  var tamperReportedRef = useRef(false);
36623
36632
  useEffect(function () {
36624
36633
  if (!cameraTampered) {
@@ -36764,7 +36773,7 @@ function DocumentCaptureSurface(_ref) {
36764
36773
  finished: true,
36765
36774
  onClick: onExitAfterTamperSealPopped,
36766
36775
  children: verbiage.exitBtnText
36767
- }) : null : cameraAccessDenied ? jsx(LoaderButton, {
36776
+ }) : null : cameraFailed ? jsx(LoaderButton, {
36768
36777
  className: classNames.retryCameraAccessBtn,
36769
36778
  variant: "negative",
36770
36779
  finished: true,
@@ -48471,7 +48480,7 @@ function mapCustomerIdAndBiometricsEnrollmentProps(props, ctx) {
48471
48480
  });
48472
48481
  }
48473
48482
 
48474
- var webSdkVersion = '2.6.1-changeset-release-develop-a09dd14';
48483
+ var webSdkVersion = '2.6.1-changeset-release-develop-3d44875';
48475
48484
 
48476
48485
  // GENERATED by scripts/styleBagTypes.mjs from
48477
48486
  // src/__fixtures__/sdk2StyleBags.json and the mapper sweep — do not