idmission-web-sdk 2.6.3-t3code-callback-homes-submit-handoff-9690b2d → 2.6.3-t3code-callback-homes-submit-handoff-cda6379

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/index.d.ts CHANGED
@@ -11274,7 +11274,7 @@ declare global {
11274
11274
  var IDmissionSDK: IDmissionSDK;
11275
11275
  }
11276
11276
 
11277
- declare const webSdkVersion = "2.6.3-t3code-callback-homes-submit-handoff-9690b2d";
11277
+ declare const webSdkVersion = "2.6.3-t3code-callback-homes-submit-handoff-cda6379";
11278
11278
 
11279
11279
  /**
11280
11280
  * sdk2's imperative handle on the video-signature capture screen
package/dist/props.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$comment": "GENERATED by scripts/propsManifest.mjs at build time. Each customer flow's props, read off dist/index.d.ts.",
3
3
  "schemaVersion": 1,
4
- "version": "2.6.3-t3code-callback-homes-submit-handoff-9690b2d",
4
+ "version": "2.6.3-t3code-callback-homes-submit-handoff-cda6379",
5
5
  "components": {
6
6
  "IdValidation": {
7
7
  "description": "Render a fullscreen ID capture component that instructs the user to\nphotograph both sides of their ID card, or the full page of their passport.",
@@ -4961,7 +4961,10 @@ function createIdmissionClient(config) {
4961
4961
  var livenessToken;
4962
4962
  function timedFetch(_x, _x2) {
4963
4963
  return _timedFetch.apply(this, arguments);
4964
- }
4964
+ } // The attestation nonce THIS client's session was validated with. The
4965
+ // holders are module-level, so another client validating later replaces
4966
+ // them; comparing against this, not against whatever the holder says at
4967
+ // submit time, is what keeps that client's nonce off this client's request.
4965
4968
  function _timedFetch() {
4966
4969
  _timedFetch = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(url, init) {
4967
4970
  var controller, timer;
@@ -4997,17 +5000,19 @@ function createIdmissionClient(config) {
4997
5000
  }));
4998
5001
  return _timedFetch.apply(this, arguments);
4999
5002
  }
5003
+ var validatedSessionNonce = null;
5000
5004
  function currentRoute() {
5001
5005
  return {
5002
5006
  sessionId: store.getState().session.sessionId,
5003
5007
  submissionUrl: urls.submissionUrl,
5004
5008
  documentServiceUrl: urls.documentServiceUrl,
5005
- sessionNonce: getLastSessionNonce()
5009
+ sessionNonce: validatedSessionNonce
5006
5010
  };
5007
5011
  }
5008
5012
  // The attestation holders are module-level and follow the newest
5009
- // ValidateSession. If that is no longer this operation's session, its nonce
5010
- // and OS token belong to someone else: omit the envelope (throwing here is
5013
+ // ValidateSession, from any client. If they no longer hold this operation's
5014
+ // session nonce, the nonce and OS token belong to someone else: omit the
5015
+ // envelope (throwing here is
5011
5016
  // attachMetadataToRequest's fail-open path, which reports
5012
5017
  // `attestationAttached: false`) rather than attach a stranger's.
5013
5018
  function routeBoundCollectors(route) {
@@ -5178,6 +5183,7 @@ function createIdmissionClient(config) {
5178
5183
  case 9:
5179
5184
  valid = _context3.sent;
5180
5185
  finalState = valid ? 'PASSED' : 'FAILED';
5186
+ if (epoch === sessionRunEpoch) validatedSessionNonce = getLastSessionNonce();
5181
5187
  dispatchSessionIfCurrent(epoch, {
5182
5188
  type: 'setCheckState',
5183
5189
  payload: finalState
@@ -38536,11 +38542,18 @@ function SubmissionProvider(_ref) {
38536
38542
  _useState6 = _slicedToArray(_useState5, 2),
38537
38543
  attempt = _useState6[0],
38538
38544
  setAttempt = _useState6[1];
38539
- var reportFailure = onSubmissionFailure != null ? onSubmissionFailure : onRequestFailure;
38540
- var _useState7 = React.useState(false),
38545
+ // Which path the latest submission took. State is read from that path even
38546
+ // if `mode` changes while it is in flight; before any submission, `mode`
38547
+ // decides.
38548
+ var _useState7 = React.useState(null),
38541
38549
  _useState8 = _slicedToArray(_useState7, 2),
38542
- resubmitting = _useState8[0],
38543
- setResubmitting = _useState8[1];
38550
+ startedExplicit = _useState8[0],
38551
+ setStartedExplicit = _useState8[1];
38552
+ var reportFailure = onSubmissionFailure != null ? onSubmissionFailure : onRequestFailure;
38553
+ var _useState9 = React.useState(false),
38554
+ _useState0 = _slicedToArray(_useState9, 2),
38555
+ resubmitting = _useState0[0],
38556
+ setResubmitting = _useState0[1];
38544
38557
  var lastArtifactsRef = React.useRef(null);
38545
38558
  var submitInFlightRef = React.useRef(null);
38546
38559
  var resubmitInFlightRef = React.useRef(null);
@@ -38558,19 +38571,22 @@ function SubmissionProvider(_ref) {
38558
38571
  }) : incoming;
38559
38572
  // Store the merged artifacts so a resubmit carries location too.
38560
38573
  lastArtifactsRef.current = artifacts;
38574
+ setStartedExplicit(mode !== undefined);
38561
38575
  if (mode !== undefined) {
38562
38576
  // Registered before anything customer-supplied runs, so a throw from
38563
38577
  // a notification can never leave the flow without a status.
38564
38578
  setAttempt(_extends({}, IDLE_ATTEMPT, {
38565
38579
  status: SubmissionStatus.SUBMITTING
38566
38580
  }));
38567
- notifySafely('onSubmissionStarted', function () {
38568
- return onSubmissionStarted == null ? void 0 : onSubmissionStarted(artifacts);
38569
- });
38570
38581
  var _unbindProgress = bindSubmissionObserver(artifacts, progress);
38571
- var _promise = runAttempt(client, mode, artifacts, _extends({}, options, {
38572
- action: action
38573
- })).then(function (outcome) {
38582
+ // The client call waits one microtask so the in-flight promise is
38583
+ // registered first: an `onSubmissionStarted` that calls `submit()`
38584
+ // gets this attempt back instead of starting a second one.
38585
+ var _promise = Promise.resolve().then(function () {
38586
+ return runAttempt(client, mode, artifacts, _extends({}, options, {
38587
+ action: action
38588
+ }));
38589
+ }).then(function (outcome) {
38574
38590
  setAttempt(_extends({}, outcome, {
38575
38591
  status: SubmissionStatus.SUBMITTED,
38576
38592
  error: null
@@ -38615,6 +38631,9 @@ function SubmissionProvider(_ref) {
38615
38631
  setResubmitting(false);
38616
38632
  });
38617
38633
  submitInFlightRef.current = _promise;
38634
+ notifySafely('onSubmissionStarted', function () {
38635
+ return onSubmissionStarted == null ? void 0 : onSubmissionStarted(artifacts);
38636
+ });
38618
38637
  return _promise;
38619
38638
  }
38620
38639
  setSubmissionResponse(null);
@@ -38691,7 +38710,7 @@ function SubmissionProvider(_ref) {
38691
38710
  }, [authState.session.canRefreshSession, client, submit]);
38692
38711
  var value = React.useMemo(function () {
38693
38712
  var _ref3, _clientState$lastSubm, _clientState$lastSubm2;
38694
- if (mode !== undefined) {
38713
+ if (startedExplicit != null ? startedExplicit : mode !== undefined) {
38695
38714
  return {
38696
38715
  action: action,
38697
38716
  submit: submit,
@@ -38717,7 +38736,7 @@ function SubmissionProvider(_ref) {
38717
38736
  lastSubmissionRequest: (_clientState$lastSubm2 = clientState.lastSubmissionRequest) != null ? _clientState$lastSubm2 : null,
38718
38737
  resubmit: resubmit
38719
38738
  };
38720
- }, [action, attempt, clientState.lastSubmissionRequest, clientState.lastSubmissionTimings, clientState.submissionError, clientState.submissionStatus, localError, mode, resubmit, resubmitting, submissionResponse, submit]);
38739
+ }, [action, attempt, clientState.lastSubmissionRequest, clientState.lastSubmissionTimings, clientState.submissionError, clientState.submissionStatus, localError, mode, resubmit, resubmitting, startedExplicit, submissionResponse, submit]);
38721
38740
  return jsxRuntime.jsx(SubmissionContext.Provider, {
38722
38741
  value: value,
38723
38742
  children: children
@@ -41878,6 +41897,14 @@ function SignatureKYCFlow(_ref) {
41878
41897
  resolvedSelfieController.actions.retry();
41879
41898
  setStage('face-liveness');
41880
41899
  }, [resolvedSelfieController]);
41900
+ // Lives here, above the chassis's session gate: a session error unmounts
41901
+ // and remounts `SignatureHandoff`, and must not start the hand-off again.
41902
+ var handoffStartedRef = React.useRef(false);
41903
+ var claimHandoffStart = React.useCallback(function () {
41904
+ if (handoffStartedRef.current) return false;
41905
+ handoffStartedRef.current = true;
41906
+ return true;
41907
+ }, []);
41881
41908
  var handleSignatureCompleted = React.useCallback(function (artifacts) {
41882
41909
  if (completedRef.current) return;
41883
41910
  completedRef.current = true;
@@ -41907,7 +41934,8 @@ function SignatureKYCFlow(_ref) {
41907
41934
  children: [jsxRuntime.jsx(CaptureProgressCompletion, {
41908
41935
  completed: stage === 'complete' && submitMode === 'capture'
41909
41936
  }), stage === 'complete' && submitMode !== 'capture' ? jsxRuntime.jsx(SignatureHandoff, {
41910
- artifacts: artifactsRef.current
41937
+ artifacts: artifactsRef.current,
41938
+ claimStart: claimHandoffStart
41911
41939
  }) : null, stage !== 'complete' ? jsxRuntime.jsxs(HandoffRoot, {
41912
41940
  children: [jsxRuntime.jsx(SignatureCaptureView, _extends({}, signatureView, {
41913
41941
  skipSuccessScreen: impliedSkipSuccessScreen(signatureView.skipSuccessScreen, isRingIntroActive(faceView)),
@@ -41964,21 +41992,20 @@ function SignatureKYCFlow(_ref) {
41964
41992
  * nothing once it has been handed off.
41965
41993
  */
41966
41994
  function SignatureHandoff(_ref3) {
41967
- var artifacts = _ref3.artifacts;
41995
+ var artifacts = _ref3.artifacts,
41996
+ claimStart = _ref3.claimStart;
41968
41997
  var _useSubmission = useSubmission(),
41969
41998
  action = _useSubmission.action,
41970
41999
  submit = _useSubmission.submit,
41971
42000
  submissionStatus = _useSubmission.submissionStatus,
41972
42001
  submissionError = _useSubmission.submissionError;
41973
42002
  var sessionReady = useSessionReady();
41974
- var startedRef = React.useRef(false);
41975
42003
  // The provider reports a failure itself; these catches only keep the
41976
42004
  // rejection from going unhandled.
41977
42005
  React.useEffect(function () {
41978
- if (!sessionReady || startedRef.current) return;
41979
- startedRef.current = true;
42006
+ if (!sessionReady || !claimStart()) return;
41980
42007
  submit(artifacts)["catch"](function () {});
41981
- }, [artifacts, sessionReady, submit]);
42008
+ }, [artifacts, claimStart, sessionReady, submit]);
41982
42009
  if (submissionStatus === SubmissionStatus.SUBMITTED) return null;
41983
42010
  if (submissionStatus === SubmissionStatus.FAILED) {
41984
42011
  return jsxRuntime.jsx(SubmissionErrorOverlay, {
@@ -49236,7 +49263,7 @@ function mapCustomerIdAndBiometricsEnrollmentProps(props, ctx) {
49236
49263
  });
49237
49264
  }
49238
49265
 
49239
- var webSdkVersion = '2.6.3-t3code-callback-homes-submit-handoff-9690b2d';
49266
+ var webSdkVersion = '2.6.3-t3code-callback-homes-submit-handoff-cda6379';
49240
49267
 
49241
49268
  // GENERATED by scripts/styleBagTypes.mjs from
49242
49269
  // src/__fixtures__/sdk2StyleBags.json and the mapper sweep — do not