idmission-web-sdk 2.6.3-t3code-callback-homes-submit-handoff-9e68377 → 2.6.3-t3code-callback-homes-submit-handoff-ee11df0

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-9e68377";
11277
+ declare const webSdkVersion = "2.6.3-t3code-callback-homes-submit-handoff-ee11df0";
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-9e68377",
4
+ "version": "2.6.3-t3code-callback-homes-submit-handoff-ee11df0",
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.",
@@ -4875,12 +4875,11 @@ function withJobTaskMetadata(metadata, jobID, taskID) {
4875
4875
  */
4876
4876
  function notifySafely$1(name, notify) {
4877
4877
  try {
4878
- var result = notify();
4879
- if (result instanceof Promise) {
4880
- result["catch"](function (e) {
4881
- return warn$1(name + " rejected", e);
4882
- });
4883
- }
4878
+ // `Promise.resolve`, not `instanceof Promise`: a promise from another
4879
+ // realm (an iframe) fails that check, and its rejection would go unhandled.
4880
+ Promise.resolve(notify())["catch"](function (e) {
4881
+ return warn$1(name + " rejected", e);
4882
+ });
4884
4883
  } catch (e) {
4885
4884
  warn$1(name + " threw", e);
4886
4885
  }
@@ -4961,7 +4960,10 @@ function createIdmissionClient(config) {
4961
4960
  var livenessToken;
4962
4961
  function timedFetch(_x, _x2) {
4963
4962
  return _timedFetch.apply(this, arguments);
4964
- }
4963
+ } // The attestation nonce THIS client's session was validated with. The
4964
+ // holders are module-level, so another client validating later replaces
4965
+ // them; comparing against this, not against whatever the holder says at
4966
+ // submit time, is what keeps that client's nonce off this client's request.
4965
4967
  function _timedFetch() {
4966
4968
  _timedFetch = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(url, init) {
4967
4969
  var controller, timer;
@@ -4997,17 +4999,19 @@ function createIdmissionClient(config) {
4997
4999
  }));
4998
5000
  return _timedFetch.apply(this, arguments);
4999
5001
  }
5002
+ var validatedSessionNonce = null;
5000
5003
  function currentRoute() {
5001
5004
  return {
5002
5005
  sessionId: store.getState().session.sessionId,
5003
5006
  submissionUrl: urls.submissionUrl,
5004
5007
  documentServiceUrl: urls.documentServiceUrl,
5005
- sessionNonce: getLastSessionNonce()
5008
+ sessionNonce: validatedSessionNonce
5006
5009
  };
5007
5010
  }
5008
5011
  // 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
5012
+ // ValidateSession, from any client. If they no longer hold this operation's
5013
+ // session nonce, the nonce and OS token belong to someone else: omit the
5014
+ // envelope (throwing here is
5011
5015
  // attachMetadataToRequest's fail-open path, which reports
5012
5016
  // `attestationAttached: false`) rather than attach a stranger's.
5013
5017
  function routeBoundCollectors(route) {
@@ -5075,7 +5079,7 @@ function createIdmissionClient(config) {
5075
5079
  }
5076
5080
  function _runSessionValidation() {
5077
5081
  _runSessionValidation = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(epoch) {
5078
- var authUrl, adoptSessionUrls, resolvedSessionId, err, valid, finalState, _err, _t, _t2;
5082
+ var authUrl, adoptSessionUrls, resolvedSessionId, err, responseNonce, valid, finalState, _err, _t, _t2;
5079
5083
  return _regeneratorRuntime.wrap(function (_context3) {
5080
5084
  while (1) switch (_context3.prev = _context3.next) {
5081
5085
  case 0:
@@ -5170,14 +5174,22 @@ function createIdmissionClient(config) {
5170
5174
  payload: 'RUNNING'
5171
5175
  });
5172
5176
  _context3.prev = 8;
5177
+ // The nonce THIS response carried, taken as it is ingested: reading
5178
+ // the shared holder after the await could pick up another client's.
5179
+ responseNonce = null;
5173
5180
  _context3.next = 9;
5174
5181
  return validateSession(authUrl, resolvedSessionId, {
5175
5182
  fetch: config.fetch,
5176
- delay: config.delay
5183
+ delay: config.delay,
5184
+ ingestNonce: function ingestNonce(nonce) {
5185
+ responseNonce = typeof nonce === 'string' && nonce ? nonce : null;
5186
+ ingestSessionAttestation(nonce);
5187
+ }
5177
5188
  });
5178
5189
  case 9:
5179
5190
  valid = _context3.sent;
5180
5191
  finalState = valid ? 'PASSED' : 'FAILED';
5192
+ if (epoch === sessionRunEpoch) validatedSessionNonce = responseNonce;
5181
5193
  dispatchSessionIfCurrent(epoch, {
5182
5194
  type: 'setCheckState',
5183
5195
  payload: finalState
@@ -38536,11 +38548,18 @@ function SubmissionProvider(_ref) {
38536
38548
  _useState6 = _slicedToArray(_useState5, 2),
38537
38549
  attempt = _useState6[0],
38538
38550
  setAttempt = _useState6[1];
38539
- var reportFailure = onSubmissionFailure != null ? onSubmissionFailure : onRequestFailure;
38540
- var _useState7 = React.useState(false),
38551
+ // Which path the latest submission took. State is read from that path even
38552
+ // if `mode` changes while it is in flight; before any submission, `mode`
38553
+ // decides.
38554
+ var _useState7 = React.useState(null),
38541
38555
  _useState8 = _slicedToArray(_useState7, 2),
38542
- resubmitting = _useState8[0],
38543
- setResubmitting = _useState8[1];
38556
+ startedExplicit = _useState8[0],
38557
+ setStartedExplicit = _useState8[1];
38558
+ var reportFailure = onSubmissionFailure != null ? onSubmissionFailure : onRequestFailure;
38559
+ var _useState9 = React.useState(false),
38560
+ _useState0 = _slicedToArray(_useState9, 2),
38561
+ resubmitting = _useState0[0],
38562
+ setResubmitting = _useState0[1];
38544
38563
  var lastArtifactsRef = React.useRef(null);
38545
38564
  var submitInFlightRef = React.useRef(null);
38546
38565
  var resubmitInFlightRef = React.useRef(null);
@@ -38558,19 +38577,22 @@ function SubmissionProvider(_ref) {
38558
38577
  }) : incoming;
38559
38578
  // Store the merged artifacts so a resubmit carries location too.
38560
38579
  lastArtifactsRef.current = artifacts;
38580
+ setStartedExplicit(mode !== undefined);
38561
38581
  if (mode !== undefined) {
38562
38582
  // Registered before anything customer-supplied runs, so a throw from
38563
38583
  // a notification can never leave the flow without a status.
38564
38584
  setAttempt(_extends({}, IDLE_ATTEMPT, {
38565
38585
  status: SubmissionStatus.SUBMITTING
38566
38586
  }));
38567
- notifySafely('onSubmissionStarted', function () {
38568
- return onSubmissionStarted == null ? void 0 : onSubmissionStarted(artifacts);
38569
- });
38570
38587
  var _unbindProgress = bindSubmissionObserver(artifacts, progress);
38571
- var _promise = runAttempt(client, mode, artifacts, _extends({}, options, {
38572
- action: action
38573
- })).then(function (outcome) {
38588
+ // The client call waits one microtask so the in-flight promise is
38589
+ // registered first: an `onSubmissionStarted` that calls `submit()`
38590
+ // gets this attempt back instead of starting a second one.
38591
+ var _promise = Promise.resolve().then(function () {
38592
+ return runAttempt(client, mode, artifacts, _extends({}, options, {
38593
+ action: action
38594
+ }));
38595
+ }).then(function (outcome) {
38574
38596
  setAttempt(_extends({}, outcome, {
38575
38597
  status: SubmissionStatus.SUBMITTED,
38576
38598
  error: null
@@ -38615,6 +38637,9 @@ function SubmissionProvider(_ref) {
38615
38637
  setResubmitting(false);
38616
38638
  });
38617
38639
  submitInFlightRef.current = _promise;
38640
+ notifySafely('onSubmissionStarted', function () {
38641
+ return onSubmissionStarted == null ? void 0 : onSubmissionStarted(artifacts);
38642
+ });
38618
38643
  return _promise;
38619
38644
  }
38620
38645
  setSubmissionResponse(null);
@@ -38691,7 +38716,7 @@ function SubmissionProvider(_ref) {
38691
38716
  }, [authState.session.canRefreshSession, client, submit]);
38692
38717
  var value = React.useMemo(function () {
38693
38718
  var _ref3, _clientState$lastSubm, _clientState$lastSubm2;
38694
- if (mode !== undefined) {
38719
+ if (startedExplicit != null ? startedExplicit : mode !== undefined) {
38695
38720
  return {
38696
38721
  action: action,
38697
38722
  submit: submit,
@@ -38717,7 +38742,7 @@ function SubmissionProvider(_ref) {
38717
38742
  lastSubmissionRequest: (_clientState$lastSubm2 = clientState.lastSubmissionRequest) != null ? _clientState$lastSubm2 : null,
38718
38743
  resubmit: resubmit
38719
38744
  };
38720
- }, [action, attempt, clientState.lastSubmissionRequest, clientState.lastSubmissionTimings, clientState.submissionError, clientState.submissionStatus, localError, mode, resubmit, resubmitting, submissionResponse, submit]);
38745
+ }, [action, attempt, clientState.lastSubmissionRequest, clientState.lastSubmissionTimings, clientState.submissionError, clientState.submissionStatus, localError, mode, resubmit, resubmitting, startedExplicit, submissionResponse, submit]);
38721
38746
  return jsxRuntime.jsx(SubmissionContext.Provider, {
38722
38747
  value: value,
38723
38748
  children: children
@@ -38796,12 +38821,11 @@ function missingMethod(method, needs) {
38796
38821
  */
38797
38822
  function notifySafely(name, notify) {
38798
38823
  try {
38799
- var result = notify();
38800
- if (result instanceof Promise) {
38801
- result["catch"](function (e) {
38802
- return warn(name + " rejected", e);
38803
- });
38804
- }
38824
+ // `Promise.resolve`, not `instanceof Promise`: a promise from another
38825
+ // realm (an iframe) fails that check, and its rejection would go unhandled.
38826
+ Promise.resolve(notify())["catch"](function (e) {
38827
+ return warn(name + " rejected", e);
38828
+ });
38805
38829
  } catch (e) {
38806
38830
  warn(name + " threw", e);
38807
38831
  }
@@ -41878,6 +41902,14 @@ function SignatureKYCFlow(_ref) {
41878
41902
  resolvedSelfieController.actions.retry();
41879
41903
  setStage('face-liveness');
41880
41904
  }, [resolvedSelfieController]);
41905
+ // Lives here, above the chassis's session gate: a session error unmounts
41906
+ // and remounts `SignatureHandoff`, and must not start the hand-off again.
41907
+ var handoffStartedRef = React.useRef(false);
41908
+ var claimHandoffStart = React.useCallback(function () {
41909
+ if (handoffStartedRef.current) return false;
41910
+ handoffStartedRef.current = true;
41911
+ return true;
41912
+ }, []);
41881
41913
  var handleSignatureCompleted = React.useCallback(function (artifacts) {
41882
41914
  if (completedRef.current) return;
41883
41915
  completedRef.current = true;
@@ -41907,7 +41939,8 @@ function SignatureKYCFlow(_ref) {
41907
41939
  children: [jsxRuntime.jsx(CaptureProgressCompletion, {
41908
41940
  completed: stage === 'complete' && submitMode === 'capture'
41909
41941
  }), stage === 'complete' && submitMode !== 'capture' ? jsxRuntime.jsx(SignatureHandoff, {
41910
- artifacts: artifactsRef.current
41942
+ artifacts: artifactsRef.current,
41943
+ claimStart: claimHandoffStart
41911
41944
  }) : null, stage !== 'complete' ? jsxRuntime.jsxs(HandoffRoot, {
41912
41945
  children: [jsxRuntime.jsx(SignatureCaptureView, _extends({}, signatureView, {
41913
41946
  skipSuccessScreen: impliedSkipSuccessScreen(signatureView.skipSuccessScreen, isRingIntroActive(faceView)),
@@ -41964,21 +41997,20 @@ function SignatureKYCFlow(_ref) {
41964
41997
  * nothing once it has been handed off.
41965
41998
  */
41966
41999
  function SignatureHandoff(_ref3) {
41967
- var artifacts = _ref3.artifacts;
42000
+ var artifacts = _ref3.artifacts,
42001
+ claimStart = _ref3.claimStart;
41968
42002
  var _useSubmission = useSubmission(),
41969
42003
  action = _useSubmission.action,
41970
42004
  submit = _useSubmission.submit,
41971
42005
  submissionStatus = _useSubmission.submissionStatus,
41972
42006
  submissionError = _useSubmission.submissionError;
41973
42007
  var sessionReady = useSessionReady();
41974
- var startedRef = React.useRef(false);
41975
42008
  // The provider reports a failure itself; these catches only keep the
41976
42009
  // rejection from going unhandled.
41977
42010
  React.useEffect(function () {
41978
- if (!sessionReady || startedRef.current) return;
41979
- startedRef.current = true;
42011
+ if (!sessionReady || !claimStart()) return;
41980
42012
  submit(artifacts)["catch"](function () {});
41981
- }, [artifacts, sessionReady, submit]);
42013
+ }, [artifacts, claimStart, sessionReady, submit]);
41982
42014
  if (submissionStatus === SubmissionStatus.SUBMITTED) return null;
41983
42015
  if (submissionStatus === SubmissionStatus.FAILED) {
41984
42016
  return jsxRuntime.jsx(SubmissionErrorOverlay, {
@@ -49236,7 +49268,7 @@ function mapCustomerIdAndBiometricsEnrollmentProps(props, ctx) {
49236
49268
  });
49237
49269
  }
49238
49270
 
49239
- var webSdkVersion = '2.6.3-t3code-callback-homes-submit-handoff-9e68377';
49271
+ var webSdkVersion = '2.6.3-t3code-callback-homes-submit-handoff-ee11df0';
49240
49272
 
49241
49273
  // GENERATED by scripts/styleBagTypes.mjs from
49242
49274
  // src/__fixtures__/sdk2StyleBags.json and the mapper sweep — do not