idmission-web-sdk 2.5.64 → 2.5.65-react16compat.0

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,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('platform'), require('tus-js-client'), require('styled-components'), require('react-dom'), require('react-dom/client')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'react', 'platform', 'tus-js-client', 'styled-components', 'react-dom', 'react-dom/client'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Sdk2 = {}, global.React, global.platform, global.tus, global.styled, global.ReactDOM, global.ReactDOM));
5
- })(this, (function (exports, React, platform, tusJsClient, sc$1, reactDom, ReactDOM) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('platform'), require('tus-js-client'), require('styled-components'), require('react-dom')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react', 'platform', 'tus-js-client', 'styled-components', 'react-dom'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Sdk2 = {}, global.React, global.platform, global.tus, global.styled, global.ReactDOM));
5
+ })(this, (function (exports, React, platform, tusJsClient, sc$1, ReactDOM) { 'use strict';
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  var n = Object.create(null);
@@ -11683,7 +11683,7 @@
11683
11683
  });
11684
11684
  var portalLocation = document.getElementById('idmission-above-guides-content');
11685
11685
  if (!portalLocation) return element;
11686
- return /*#__PURE__*/reactDom.createPortal(element, portalLocation);
11686
+ return /*#__PURE__*/ReactDOM.createPortal(element, portalLocation);
11687
11687
  }
11688
11688
  var DebugStatsPaneDiv = styled.span(_templateObject$_ || (_templateObject$_ = _taggedTemplateLiteralLoose(["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n margin-right: 20px;\n padding: 8px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 10002;\n pointer-events: none;\n"])));
11689
11689
  var ObjectDetectionDebugOverlayDiv = styled.div(_templateObject2$Q || (_templateObject2$Q = _taggedTemplateLiteralLoose(["\n position: absolute;\n z-index: 1001;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n overflow: hidden;\n pointer-events: none;\n ", "\n transform-style: preserve-3d;\n"])), function (_ref3) {
@@ -12086,7 +12086,7 @@
12086
12086
  }, []);
12087
12087
  if (!target) return null;
12088
12088
  var bottomColor = hiddenBottomColor != null ? hiddenBottomColor : color;
12089
- return /*#__PURE__*/reactDom.createPortal(jsxs(Fragment, {
12089
+ return /*#__PURE__*/ReactDOM.createPortal(jsxs(Fragment, {
12090
12090
  children: [jsx(EdgeStrip, {
12091
12091
  "$edge": "top",
12092
12092
  "$color": color,
@@ -12200,7 +12200,7 @@
12200
12200
  var element = jsx(GuidanceMessageContainerDiv, _extends({}, props));
12201
12201
  var portalLocation = document.getElementById('idmission-above-guides-content');
12202
12202
  if (!portalLocation) return element;
12203
- return /*#__PURE__*/reactDom.createPortal(element, portalLocation);
12203
+ return /*#__PURE__*/ReactDOM.createPortal(element, portalLocation);
12204
12204
  };
12205
12205
  var GuidanceMessage = styled.div(_templateObject2$P || (_templateObject2$P = _taggedTemplateLiteralLoose(["\n margin-left: auto;\n margin-right: auto;\n background: ", ";\n color: ", ";\n border-radius: 8px;\n z-index: 10001;\n padding: 16px 24px;\n font-size: 18px;\n font-weight: bold;\n box-shadow:\n 0 1px 3px 0 rgb(0 0 0 / 0.1),\n 0 1px 2px -1px rgb(0 0 0 / 0.1);\n"])), function (props) {
12206
12206
  var _ref3, _props$$background, _props$theme, _props$$variant;
@@ -27159,6 +27159,19 @@
27159
27159
  error: null
27160
27160
  });
27161
27161
  }
27162
+ // The exit button: abandon the attempt and put the instructions back up.
27163
+ // 'captureStarted' accepts 'loading', so the overlay's continue starts a
27164
+ // fresh attempt from here.
27165
+ case 'exitRequested':
27166
+ {
27167
+ if (state.phase === 'initializing' || state.phase === 'loading') return state;
27168
+ return _extends({}, state, {
27169
+ phase: 'loading'
27170
+ }, clearedSelfieVerdict(), {
27171
+ capturedSelfie: null,
27172
+ error: null
27173
+ });
27174
+ }
27162
27175
  }
27163
27176
  }
27164
27177
  // The ladder's code, except that HOLD_STILL reads HAND_OVER_FACE while the
@@ -29468,6 +29481,37 @@
29468
29481
  return _doAttach.apply(this, arguments);
29469
29482
  }
29470
29483
  var cameraReacquisition = null;
29484
+ // sdk2's retry and exit both remount FaceLivenessCapture with a new `key`
29485
+ // (FaceLivenessWizard.tsx:394-409), which throws away that component's
29486
+ // whole reducer -- INCLUDING timesLivenessCheckFailed -- so the user gets a
29487
+ // fresh set of liveness attempts. Rebuilding the machine here is that
29488
+ // remount's equivalent; without it a retry from the lockout screen
29489
+ // re-entered capture with the failure budget still spent, and the next
29490
+ // failed check re-locked immediately.
29491
+ function resetLivenessAttempt() {
29492
+ clearTimer('liveness:reset');
29493
+ clearTimer('liveness:kickout');
29494
+ clearTimer('liveness:kickoutGrace');
29495
+ // The challenge runner and its tick are NOT reducer state, so the
29496
+ // setState below cannot reach them -- runLivenessEffects runs only from
29497
+ // dispatchLiveness. Leaving CHALLENGE otherwise left the discarded runner
29498
+ // ticking, still able to fire onChallengeComplete for an attempt the user
29499
+ // had abandoned.
29500
+ clearTimer('challenge:tick');
29501
+ challengeRunner = null;
29502
+ challengeResultConsumed = false;
29503
+ // Orphan any check still in flight: its verdict would otherwise land in
29504
+ // the machine built below (the reducer's livenessChecked case is
29505
+ // unguarded), and its single-flight latch would block the fresh attempt
29506
+ // from checking at all until it settled.
29507
+ livenessGeneration += 1;
29508
+ livenessCheckInFlight = false;
29509
+ internal.setState({
29510
+ liveness: createInitialLivenessMachineState(),
29511
+ challenge: null,
29512
+ livenessTimedOut: false
29513
+ });
29514
+ }
29471
29515
  // retry()'s capture re-entry, run straight away or once a released camera
29472
29516
  // is back.
29473
29517
  function resumeCapture() {
@@ -29801,37 +29845,7 @@
29801
29845
  },
29802
29846
  retry: function retry() {
29803
29847
  if (!active) return;
29804
- // sdk2's retry remounts FaceLivenessCapture with a new `key`
29805
- // (FaceLivenessWizard.tsx:402-409), which throws away that
29806
- // component's whole reducer -- INCLUDING timesLivenessCheckFailed --
29807
- // so the user gets a fresh set of liveness attempts. Rebuilding the
29808
- // machine here is that remount's equivalent; without it a retry from
29809
- // the lockout screen re-entered capture with the failure budget still
29810
- // spent, and the next failed check re-locked immediately.
29811
- if (config.liveness) {
29812
- clearTimer('liveness:reset');
29813
- clearTimer('liveness:kickout');
29814
- clearTimer('liveness:kickoutGrace');
29815
- // The challenge runner and its tick are NOT reducer state, so the
29816
- // setState below cannot reach them -- runLivenessEffects runs only
29817
- // from dispatchLiveness. Retrying out of CHALLENGE otherwise left
29818
- // the discarded runner ticking, still able to fire
29819
- // onChallengeComplete for an attempt the user had abandoned.
29820
- clearTimer('challenge:tick');
29821
- challengeRunner = null;
29822
- challengeResultConsumed = false;
29823
- // Orphan any check still in flight: its verdict would otherwise land
29824
- // in the machine built below (the reducer's livenessChecked case is
29825
- // unguarded), and its single-flight latch would block the fresh
29826
- // attempt from checking at all until it settled.
29827
- livenessGeneration += 1;
29828
- livenessCheckInFlight = false;
29829
- internal.setState({
29830
- liveness: createInitialLivenessMachineState(),
29831
- challenge: null,
29832
- livenessTimedOut: false
29833
- });
29834
- }
29848
+ if (config.liveness) resetLivenessAttempt();
29835
29849
  progress.retry('capture-error');
29836
29850
  dispatch({
29837
29851
  type: 'retryRequested'
@@ -29848,12 +29862,43 @@
29848
29862
  if (cameraReacquisition) return;
29849
29863
  var generation = attachGeneration;
29850
29864
  var reacquisition = requestCamera().then(function () {
29851
- if (active && generation === attachGeneration) resumeCapture();
29865
+ // exitCapture() may have sent the user back to the instructions
29866
+ // while the camera was coming back.
29867
+ if (active && generation === attachGeneration && internal.getState().phase === 'capturing') resumeCapture();
29852
29868
  })["catch"](function () {})["finally"](function () {
29853
29869
  // detach() may have dropped this one and a newer one started.
29854
29870
  if (cameraReacquisition === reacquisition) cameraReacquisition = null;
29855
29871
  });
29856
29872
  cameraReacquisition = reacquisition;
29873
+ },
29874
+ exitCapture: function exitCapture() {
29875
+ var _frameLoop9;
29876
+ if (!active) return;
29877
+ var _internal$getState = internal.getState(),
29878
+ phase = _internal$getState.phase;
29879
+ if (phase === 'initializing' || phase === 'loading') return;
29880
+ // Every armed timer belongs to the abandoned attempt.
29881
+ clearAllTimers();
29882
+ (_frameLoop9 = frameLoop) == null || _frameLoop9.stop();
29883
+ frameLoop = null;
29884
+ trackingOnly = false;
29885
+ initialDelayOver = false;
29886
+ busy = false;
29887
+ pendingFire = null;
29888
+ if (config.liveness) resetLivenessAttempt();
29889
+ progress.retry('user-requested');
29890
+ internal.setState({
29891
+ capturedAttempt: null,
29892
+ capturedImageUrl: null,
29893
+ captureRecovery: null
29894
+ });
29895
+ dispatch({
29896
+ type: 'exitRequested'
29897
+ });
29898
+ // The overlay waits on `camera.ready`, so a camera handed back by a
29899
+ // terminal screen has to come back for its continue to enable. A
29900
+ // failure lands in `error` (requestCamera's own write).
29901
+ if (cameraReleased && !cameraReacquisition) void requestCamera()["catch"](function () {});
29857
29902
  }
29858
29903
  }
29859
29904
  }, progressBinding);
@@ -31600,6 +31645,13 @@
31600
31645
  void controller.actions.start();
31601
31646
  onLoadingOverlayDismissed == null || onLoadingOverlayDismissed();
31602
31647
  }, [controller, onLoadingOverlayDismissed]);
31648
+ // Back to the instructions BEFORE telling the host, as sdk2 did
31649
+ // (FaceLivenessWizard.tsx:394): handing `onExit` to the button raw left the
31650
+ // capture running behind a host that expected the loading screen.
31651
+ var handleExit = React.useCallback(function () {
31652
+ controller.actions.exitCapture();
31653
+ onExit == null || onExit();
31654
+ }, [controller, onExit]);
31603
31655
  // plan-3 ruling: camera-acquisition errors recover via requestCamera()
31604
31656
  // (retry() explicitly excludes them, controller.ts), everything else via
31605
31657
  // retry(). Applies unconditionally across every loadingOverlayMode.
@@ -31698,7 +31750,7 @@
31698
31750
  children: [jsx("br", {}), state.handOverFace.lastCheck ? state.handOverFace.lastCheck.handOverFace ? '❌' : '✅' : '➖', ' ', "Hand Off Face (", state.handOverFace.status, state.handOverFace.lastCheck && ", last check " + state.handOverFace.lastCheck.coverage.toFixed(2) + " covered in " + Math.round(state.handOverFace.lastCheck.inferenceMs) + " ms", ")"]
31699
31751
  })]
31700
31752
  }), onExit != null && jsx(ExitCaptureButton, {
31701
- onClick: onExit,
31753
+ onClick: handleExit,
31702
31754
  className: classNames.exitBtn
31703
31755
  }), showLoadingOverlay && jsx(SelfieCaptureLoadingOverlay, {
31704
31756
  state: loadingOverlayState,
@@ -53701,7 +53753,7 @@
53701
53753
  });
53702
53754
  }
53703
53755
 
53704
- var webSdkVersion = '2.5.64';
53756
+ var webSdkVersion = '2.5.65-react16compat.0';
53705
53757
 
53706
53758
  var MAPPED = 'mapped';
53707
53759
  var NOOP = 'dropped-noop';
@@ -54702,6 +54754,25 @@
54702
54754
  }, mapCustomerIdAndBiometricsEnrollmentProps(props, ctx)), props.children);
54703
54755
  };
54704
54756
 
54757
+ /**
54758
+ * react-16-compat: React 16/17 have no `createRoot`, so this adapts the legacy
54759
+ * `ReactDOM.render` API to the root shape the rest of this module expects.
54760
+ * Keeping that shape means the teardown logic below stays byte-identical to
54761
+ * develop and merges cleanly. Runs on React 16.14 through 18; React 19
54762
+ * removed `ReactDOM.render`, which is why this build's peer range stops at 18.
54763
+ */
54764
+ function createRoot(container) {
54765
+ return {
54766
+ render: function render(element) {
54767
+ // eslint-disable-next-line react/no-deprecated -- the only mount API React 16 has
54768
+ ReactDOM.render(element, container);
54769
+ },
54770
+ unmount: function unmount() {
54771
+ // eslint-disable-next-line react/no-deprecated -- pairs with ReactDOM.render above
54772
+ ReactDOM.unmountComponentAtNode(container);
54773
+ }
54774
+ };
54775
+ }
54705
54776
  /**
54706
54777
  * Targets whose `remove` this module has already wrapped. Permanent: the
54707
54778
  * wrapper is installed at most once per element, so repeat renders can never
@@ -54729,8 +54800,7 @@
54729
54800
  targetElement = document.createElement('div');
54730
54801
  document.body.append(targetElement);
54731
54802
  }
54732
- var root = ReactDOM.createRoot(targetElement);
54733
- root.render(/*#__PURE__*/React.createElement(OverlayContainer, null, component));
54803
+ var root = createRoot(targetElement);
54734
54804
  if ('remove' in targetElement) {
54735
54805
  var element_1 = targetElement;
54736
54806
  // Always point at the newest root, even when the wrapper is already
@@ -54780,6 +54850,10 @@
54780
54850
  };
54781
54851
  }
54782
54852
  }
54853
+ // react-16-compat: render LAST. A legacy root mounts synchronously, so layout
54854
+ // effects (e.g. a customer `loadingSpinner`) run inside this call; one that
54855
+ // calls `.remove()` must already hit the wrapper above, not the native method.
54856
+ root.render(/*#__PURE__*/React.createElement(OverlayContainer, null, component));
54783
54857
  return targetElement;
54784
54858
  }
54785
54859
  function renderComponent(Component, targetElement, options) {