idmission-web-sdk 2.6.3-t3code-shared-flow-settings-e5702c2 → 2.6.3-t3code-callback-homes-submit-handoff-9e68377

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.
@@ -5559,6 +5559,22 @@
5559
5559
  if (taskID) merged.taskid = taskID;
5560
5560
  return merged;
5561
5561
  }
5562
+ /**
5563
+ * Runs a customer callback whose failure must not change an outcome that is
5564
+ * already settled: a throw or a rejected promise is logged, never rethrown.
5565
+ */
5566
+ function notifySafely$1(name, notify) {
5567
+ try {
5568
+ var result = notify();
5569
+ if (result instanceof Promise) {
5570
+ result["catch"](function (e) {
5571
+ return warn$2(name + " rejected", e);
5572
+ });
5573
+ }
5574
+ } catch (e) {
5575
+ warn$2(name + " threw", e);
5576
+ }
5577
+ }
5562
5578
  /**
5563
5579
  * How long an async `sessionId` resolver may take. It typically mints the
5564
5580
  * session through the host's own backend (an OAuth token, then
@@ -5581,6 +5597,10 @@
5581
5597
  return clearTimeout(timer);
5582
5598
  });
5583
5599
  }
5600
+ /**
5601
+ * Creates a client. Its type is `Required<IdmissionClient>`: unlike a
5602
+ * hand-written `IdmissionClient`, it always has `post()` and `handoff()`.
5603
+ */
5584
5604
  function createIdmissionClient(config) {
5585
5605
  var _config$fetch, _config$now;
5586
5606
  // `let`: when config.sessionId is an async resolver, the session URN (and
@@ -5667,10 +5687,33 @@
5667
5687
  }));
5668
5688
  return _timedFetch.apply(this, arguments);
5669
5689
  }
5670
- function performUpload(blob, metadata) {
5671
- return uploadDocument(blob, metadata, {
5672
- documentServiceUrl: urls.documentServiceUrl,
5690
+ function currentRoute() {
5691
+ return {
5673
5692
  sessionId: store.getState().session.sessionId,
5693
+ submissionUrl: urls.submissionUrl,
5694
+ documentServiceUrl: urls.documentServiceUrl,
5695
+ sessionNonce: getLastSessionNonce()
5696
+ };
5697
+ }
5698
+ // The attestation holders are module-level and follow the newest
5699
+ // ValidateSession. If that is no longer this operation's session, its nonce
5700
+ // and OS token belong to someone else: omit the envelope (throwing here is
5701
+ // attachMetadataToRequest's fail-open path, which reports
5702
+ // `attestationAttached: false`) rather than attach a stranger's.
5703
+ function routeBoundCollectors(route) {
5704
+ return {
5705
+ collectAttestation: function collectAttestation(web, versions) {
5706
+ if (getLastSessionNonce() !== route.sessionNonce) {
5707
+ throw new Error('session changed during submission; attestation omitted');
5708
+ }
5709
+ return collectClientAttestation(web, versions);
5710
+ }
5711
+ };
5712
+ }
5713
+ function performUpload(blob, metadata, route) {
5714
+ return uploadDocument(blob, metadata, {
5715
+ documentServiceUrl: route.documentServiceUrl,
5716
+ sessionId: route.sessionId,
5674
5717
  Upload: config.tusUpload,
5675
5718
  delay: config.delay,
5676
5719
  calculateMd5: config.calculateMd5,
@@ -5894,23 +5937,28 @@
5894
5937
  }));
5895
5938
  return _retrySession.apply(this, arguments);
5896
5939
  }
5897
- function submit(_x6, _x7) {
5898
- return _submit.apply(this, arguments);
5940
+ function runPipeline(_x6, _x7, _x8) {
5941
+ return _runPipeline.apply(this, arguments);
5899
5942
  }
5900
- function _submit() {
5901
- _submit = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(artifacts, options) {
5902
- var _options$onBeforeSubm;
5903
- var progress, uploadsInFlight, beforeSubmit, startedAt, payloadBuildStart, payloadBuildEnd, uploadMeasurements, apiCallStart, apiCallEnd, responseParseStart, responseParseEnd, failedAt, _artifacts$id, _artifacts$id2, _artifacts$id3, _artifacts$face, payloadResult, _artifacts$meta$liven, _artifacts$meta, request, sessionId, endpoint, submissionResponse, response, _response$statusText, statusMessage, err, endedAt, _t4, _t5, _t6, _t7, _t8, _t9, _t0;
5943
+ function _runPipeline() {
5944
+ _runPipeline = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(artifacts, options, kind) {
5945
+ var _artifacts$meta$liven, _artifacts$meta, _options$onBeforeSubm;
5946
+ var handsOff, route, claimedLivenessToken, progress, uploadsInFlight, beforeSubmit, startedAt, payloadBuildStart, payloadBuildEnd, uploadMeasurements, apiCallStart, apiCallEnd, responseParseStart, responseParseEnd, failedAt, built, timings, payloadResult, request, _artifacts$id, _artifacts$id2, _artifacts$id3, _artifacts$face, endpoint, submissionResponse, response, _response$statusText, statusMessage, err, endedAt, _built, _response, _request, _t4, _t5, _t6, _t7, _t8, _t9, _t0;
5904
5947
  return _regeneratorRuntime.wrap(function (_context7) {
5905
5948
  while (1) switch (_context7.prev = _context7.next) {
5906
5949
  case 0:
5907
- if (!(options.action === SubmissionAction.NONE && !config.onSubmit)) {
5950
+ handsOff = kind === 'handoff' || kind === 'submit' && config.onSubmit !== undefined; // sdk2 short-circuits action NONE to a synthetic success before any
5951
+ // network activity (SubmissionProvider.tsx:1203-1225). This client does
5952
+ // not fabricate that response, but it keeps the "NONE does no network
5953
+ // work" guarantee by rejecting here, before any upload — unless the
5954
+ // request is being handed off, which is the one thing NONE can do.
5955
+ if (!(options.action === SubmissionAction.NONE && !handsOff)) {
5908
5956
  _context7.next = 1;
5909
5957
  break;
5910
5958
  }
5911
5959
  throw new SubmissionError({
5912
5960
  statusCode: 'UNSUPPORTED_ACTION',
5913
- statusMessage: "submit() rejects action: 'NONE' -- capture-only, no-network submission is the controller layer's responsibility (plan 3), not this client's"
5961
+ statusMessage: "action 'NONE' has no endpoint to post to; use handoff() to build the request without posting it"
5914
5962
  });
5915
5963
  case 1:
5916
5964
  if (!(store.getState().session.sessionCheckState !== 'PASSED')) {
@@ -5919,6 +5967,11 @@
5919
5967
  }
5920
5968
  throw new AuthenticationError(401, 'session not validated');
5921
5969
  case 2:
5970
+ route = currentRoute(); // Claimed, not read: an overlapping operation must not reuse it, and a
5971
+ // `checkLiveness()` that lands mid-operation keeps its own token for the
5972
+ // next one (SubmissionProvider.tsx:1350 cleared it after the submit).
5973
+ claimedLivenessToken = (_artifacts$meta$liven = (_artifacts$meta = artifacts.meta) == null ? void 0 : _artifacts$meta.livenessToken) != null ? _artifacts$meta$liven : livenessToken;
5974
+ livenessToken = undefined;
5922
5975
  store.setState({
5923
5976
  submissionStatus: SubmissionStatus.SUBMITTING,
5924
5977
  submissionError: undefined
@@ -5935,7 +5988,7 @@
5935
5988
  _context7.next = 5;
5936
5989
  return buildSubmissionPayload(_extends$1({}, artifacts, {
5937
5990
  meta: _extends$1({}, artifacts.meta, {
5938
- livenessToken: (_artifacts$meta$liven = (_artifacts$meta = artifacts.meta) == null ? void 0 : _artifacts$meta.livenessToken) != null ? _artifacts$meta$liven : livenessToken
5991
+ livenessToken: claimedLivenessToken
5939
5992
  })
5940
5993
  }), _extends$1({}, options, {
5941
5994
  onBeforeSubmit: beforeSubmit ? function (request) {
@@ -5951,7 +6004,7 @@
5951
6004
  // withJobTaskMetadata (see its own comment above): only present
5952
6005
  // when options.jobID/taskID are present.
5953
6006
  uploadDocument: documentServiceEnabled ? (/*#__PURE__*/function () {
5954
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(blob, metadata) {
6007
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(blob, metadata) {
5955
6008
  var result, _t3;
5956
6009
  return _regeneratorRuntime.wrap(function (_context6) {
5957
6010
  while (1) switch (_context6.prev = _context6.next) {
@@ -5968,7 +6021,7 @@
5968
6021
  });
5969
6022
  _context6.prev = 1;
5970
6023
  _context6.next = 2;
5971
- return performUpload(blob, withJobTaskMetadata(metadata, options.jobID, options.taskID));
6024
+ return performUpload(blob, withJobTaskMetadata(metadata, options.jobID, options.taskID), route);
5972
6025
  case 2:
5973
6026
  result = _context6.sent;
5974
6027
  progress.observe({
@@ -5998,12 +6051,13 @@
5998
6051
  }
5999
6052
  }, _callee6, null, [[1, 3, 4, 5]]);
6000
6053
  }));
6001
- return function (_x10, _x11) {
6002
- return _ref2.apply(this, arguments);
6054
+ return function (_x13, _x14) {
6055
+ return _ref3.apply(this, arguments);
6003
6056
  };
6004
6057
  }()) : undefined,
6005
6058
  now: config.now,
6006
- sdkVersions: config.sdkVersions
6059
+ sdkVersions: config.sdkVersions,
6060
+ collectors: routeBoundCollectors(route)
6007
6061
  });
6008
6062
  case 5:
6009
6063
  payloadResult = _context7.sent;
@@ -6017,40 +6071,41 @@
6017
6071
  case 7:
6018
6072
  payloadBuildEnd = payloadResult.uploadTimings.payloadBuildEnd;
6019
6073
  uploadMeasurements = payloadResult.uploadTimings.uploads;
6020
- request = payloadResult.request; // Stashed HERE rather than next to `lastSubmissionTimings` in the
6021
- // `finally`, because the hand-off below returns early: parking it in
6022
- // the same setState as the timings would leave `onSubmit` customers
6023
- // with a timings block and no request to go with it.
6074
+ request = payloadResult.request; // Stashed before the hand-off returns, so hand-off callers get the
6075
+ // request alongside the timings the `finally` records.
6024
6076
  store.setState({
6025
6077
  attestationAttached: payloadResult.attestationAttached,
6026
6078
  lastSubmissionRequest: request
6027
6079
  });
6028
- // THE HAND-OFF. sdk2 short-circuits at the equivalent point
6029
- // (SubmissionProvider.tsx:1374-1377, `return onSubmit.current(request)`
6030
- // before `defaultOnSubmit`), so everything above this line runs and
6031
- // nothing below it does.
6032
- //
6033
- // The status goes to SUBMITTED, where sdk2 leaves it at READY. That is a
6034
- // deliberate divergence in INTERNAL state to preserve the VISIBLE
6035
- // behaviour: sdk2's wizard renders an empty fragment for READY via its
6036
- // switch `default`, whereas this codebase renders the submitting screen
6037
- // for READY — so inheriting READY would park the user on a spinner
6038
- // forever. SUBMITTED with no response falls through every terminal
6039
- // branch to `return null`, which is sdk2's empty fragment.
6040
- if (!config.onSubmit) {
6080
+ if (!handsOff) {
6041
6081
  _context7.next = 8;
6042
6082
  break;
6043
6083
  }
6084
+ // sdk2 short-circuits at the equivalent point
6085
+ // (SubmissionProvider.tsx:1374-1377), so everything above runs and
6086
+ // nothing below does.
6087
+ //
6088
+ // The status goes to SUBMITTED, where sdk2 leaves it at READY. That is
6089
+ // a deliberate divergence in INTERNAL state to preserve the VISIBLE
6090
+ // behaviour: sdk2's wizard renders an empty fragment for READY via its
6091
+ // switch `default`, whereas this codebase renders the submitting
6092
+ // screen for READY — so inheriting READY would park the user on a
6093
+ // spinner forever. SUBMITTED with no response falls through every
6094
+ // terminal branch to `return null`, which is sdk2's empty fragment.
6044
6095
  store.setState({
6045
6096
  submissionStatus: SubmissionStatus.SUBMITTED
6046
6097
  });
6047
- config.onSubmit(request);
6098
+ if (kind === 'submit') config.onSubmit == null || config.onSubmit(request);
6048
6099
  progress.observe({
6049
6100
  kind: 'flow-completed'
6050
6101
  });
6051
- return _context7.abrupt("return", null);
6102
+ built = {
6103
+ request: request,
6104
+ response: null
6105
+ };
6106
+ _context7.next = 23;
6107
+ break;
6052
6108
  case 8:
6053
- sessionId = store.getState().session.sessionId;
6054
6109
  endpoint = determineSubmissionEndpoint(options.action, !!((_artifacts$id = artifacts.id) != null && _artifacts$id.frontImage || (_artifacts$id2 = artifacts.id) != null && _artifacts$id2.backImage || (_artifacts$id3 = artifacts.id) != null && _artifacts$id3.passportImage), !!((_artifacts$face = artifacts.face) != null && _artifacts$face.selfieImage));
6055
6110
  progress.observe({
6056
6111
  kind: 'phase',
@@ -6065,9 +6120,9 @@
6065
6120
  _context7.prev = 9;
6066
6121
  _context7.prev = 10;
6067
6122
  _context7.next = 11;
6068
- return timedFetch(urls.submissionUrl + endpoint, {
6123
+ return timedFetch(route.submissionUrl + endpoint, {
6069
6124
  method: 'POST',
6070
- headers: apiHeaders(sessionId, options.sendBase64DocumentsInSwaggerProxy),
6125
+ headers: apiHeaders(route.sessionId, options.sendBase64DocumentsInSwaggerProxy),
6071
6126
  body: JSON.stringify(request)
6072
6127
  });
6073
6128
  case 11:
@@ -6157,10 +6212,21 @@
6157
6212
  progress.observe({
6158
6213
  kind: 'flow-completed'
6159
6214
  });
6160
- config.onResponseReceived == null || config.onResponseReceived(submissionResponse, request);
6161
- return _context7.abrupt("return", submissionResponse);
6215
+ // Legacy `submit()` keeps a throwing `onResponseReceived` inside the
6216
+ // failure path, as it always has; `post()` notifies after the outcome
6217
+ // is settled (below).
6218
+ if (kind === 'submit') {
6219
+ config.onResponseReceived == null || config.onResponseReceived(submissionResponse, request);
6220
+ }
6221
+ built = {
6222
+ request: request,
6223
+ response: submissionResponse
6224
+ };
6162
6225
  case 23:
6163
- _context7.prev = 23;
6226
+ _context7.next = 25;
6227
+ break;
6228
+ case 24:
6229
+ _context7.prev = 24;
6164
6230
  _t0 = _context7["catch"](3);
6165
6231
  if (failedAt === undefined) failedAt = 'submission';
6166
6232
  err = _t0;
@@ -6172,72 +6238,116 @@
6172
6238
  // UNLIKE sdk2 (`if (throwErrorsOnFailure) throw err`) there is no
6173
6239
  // catch-swallow path: rejection always propagates.
6174
6240
  throw err;
6175
- case 24:
6176
- _context7.prev = 24;
6177
- // Liveness tokens are single-use: clear after each submit so a stale
6178
- // token isn't reapplied on a retry (SubmissionProvider.tsx:1350).
6179
- livenessToken = undefined;
6241
+ case 25:
6242
+ _context7.prev = 25;
6180
6243
  endedAt = nowImpl();
6244
+ timings = buildSubmissionTimings({
6245
+ startedAt: startedAt,
6246
+ endedAt: endedAt,
6247
+ payloadBuildStart: payloadBuildStart,
6248
+ payloadBuildEnd: payloadBuildEnd,
6249
+ uploads: uploadMeasurements,
6250
+ apiCallStart: apiCallStart,
6251
+ apiCallEnd: apiCallEnd,
6252
+ responseParseStart: responseParseStart,
6253
+ responseParseEnd: responseParseEnd,
6254
+ failedAt: failedAt
6255
+ });
6181
6256
  store.setState({
6182
- lastSubmissionTimings: buildSubmissionTimings({
6183
- startedAt: startedAt,
6184
- endedAt: endedAt,
6185
- payloadBuildStart: payloadBuildStart,
6186
- payloadBuildEnd: payloadBuildEnd,
6187
- uploads: uploadMeasurements,
6188
- apiCallStart: apiCallStart,
6189
- apiCallEnd: apiCallEnd,
6190
- responseParseStart: responseParseStart,
6191
- responseParseEnd: responseParseEnd,
6192
- failedAt: failedAt
6193
- })
6257
+ lastSubmissionTimings: timings
6194
6258
  });
6195
- return _context7.finish(24);
6196
- case 25:
6259
+ return _context7.finish(25);
6260
+ case 26:
6261
+ if (kind === 'post' && built.response) {
6262
+ _built = built, _response = _built.response, _request = _built.request;
6263
+ notifySafely$1('onResponseReceived', function () {
6264
+ return config.onResponseReceived == null ? void 0 : config.onResponseReceived(_response, _request);
6265
+ });
6266
+ }
6267
+ return _context7.abrupt("return", _extends$1({}, built, {
6268
+ timings: timings
6269
+ }));
6270
+ case 27:
6197
6271
  case "end":
6198
6272
  return _context7.stop();
6199
6273
  }
6200
- }, _callee7, null, [[3, 23, 24, 25], [4, 6], [9, 20], [10, 12]]);
6274
+ }, _callee7, null, [[3, 24, 25, 26], [4, 6], [9, 20], [10, 12]]);
6275
+ }));
6276
+ return _runPipeline.apply(this, arguments);
6277
+ }
6278
+ function submit(artifacts, options) {
6279
+ return runPipeline(artifacts, options, 'submit').then(function (_ref2) {
6280
+ var response = _ref2.response;
6281
+ return response;
6282
+ });
6283
+ }
6284
+ function post(artifacts, options) {
6285
+ return runPipeline(artifacts, options, 'post');
6286
+ }
6287
+ function handoff(_x9, _x0) {
6288
+ return _handoff.apply(this, arguments);
6289
+ }
6290
+ function _handoff() {
6291
+ _handoff = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(artifacts, options) {
6292
+ var _yield$runPipeline, request, timings;
6293
+ return _regeneratorRuntime.wrap(function (_context8) {
6294
+ while (1) switch (_context8.prev = _context8.next) {
6295
+ case 0:
6296
+ _context8.next = 1;
6297
+ return runPipeline(artifacts, options, 'handoff');
6298
+ case 1:
6299
+ _yield$runPipeline = _context8.sent;
6300
+ request = _yield$runPipeline.request;
6301
+ timings = _yield$runPipeline.timings;
6302
+ return _context8.abrupt("return", {
6303
+ request: request,
6304
+ timings: timings
6305
+ });
6306
+ case 2:
6307
+ case "end":
6308
+ return _context8.stop();
6309
+ }
6310
+ }, _callee8);
6201
6311
  }));
6202
- return _submit.apply(this, arguments);
6312
+ return _handoff.apply(this, arguments);
6203
6313
  }
6204
- function checkLiveness(_x8, _x9) {
6314
+ function checkLiveness(_x1, _x10) {
6205
6315
  return _checkLiveness.apply(this, arguments);
6206
6316
  }
6207
6317
  function _checkLiveness() {
6208
- _checkLiveness = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(imageDataUrl, options) {
6318
+ _checkLiveness = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(imageDataUrl, options) {
6209
6319
  var _options$metadata$sel, _options$metadata, _options$metadata$idF, _options$metadata2, _options$metadata$idB, _options$metadata3, _options$metadata$bar, _options$metadata4, _options$metadata5, _options$metadata$geo, _options$metadata6, _livenessResponse$res, _livenessResponse$res2, selfie, request, _attachMetadataToRequ, attestationAttached, result, endpoint, sessionId, response, statusMessage, livenessResponse, _livenessResponse$res3, _livenessResponse$res4, err, _t1, _t10, _t11, _t12, _t13, _t14;
6210
- return _regeneratorRuntime.wrap(function (_context8) {
6211
- while (1) switch (_context8.prev = _context8.next) {
6320
+ return _regeneratorRuntime.wrap(function (_context9) {
6321
+ while (1) switch (_context9.prev = _context9.next) {
6212
6322
  case 0:
6213
6323
  if (options === void 0) {
6214
6324
  options = {};
6215
6325
  }
6216
- _context8.prev = 1;
6326
+ _context9.prev = 1;
6217
6327
  selfie = imageDataUrl;
6218
6328
  if (!(options.useDocumentServiceForLivenessChecks && documentServiceEnabled)) {
6219
- _context8.next = 6;
6329
+ _context9.next = 6;
6220
6330
  break;
6221
6331
  }
6222
6332
  if (!selfie.startsWith('data:')) {
6223
6333
  selfie = "data:image/jpeg;base64," + selfie;
6224
6334
  }
6225
- _context8.prev = 2;
6226
- _context8.next = 3;
6335
+ _context9.prev = 2;
6336
+ _context9.next = 3;
6227
6337
  return performUpload(dataUrlToBlob(selfie), withJobTaskMetadata({
6228
6338
  filename: 'liveness',
6229
6339
  filetype: 'image/jpeg'
6230
- }, options.jobID, options.taskID));
6340
+ }, options.jobID, options.taskID), currentRoute());
6231
6341
  case 3:
6232
- selfie = _context8.sent;
6233
- _context8.next = 5;
6342
+ selfie = _context9.sent;
6343
+ _context9.next = 5;
6234
6344
  break;
6235
6345
  case 4:
6236
- _context8.prev = 4;
6237
- _t1 = _context8["catch"](2);
6346
+ _context9.prev = 4;
6347
+ _t1 = _context9["catch"](2);
6238
6348
  throw new NetworkError(_t1 instanceof Error ? _t1.message : String(_t1));
6239
6349
  case 5:
6240
- _context8.next = 7;
6350
+ _context9.next = 7;
6241
6351
  break;
6242
6352
  case 6:
6243
6353
  selfie = dataUrlToBase64Sync$1(selfie);
@@ -6305,19 +6415,19 @@
6305
6415
  attestationAttached: attestationAttached
6306
6416
  });
6307
6417
  if (!config.onBeforeLivenessCheck) {
6308
- _context8.next = 9;
6418
+ _context9.next = 9;
6309
6419
  break;
6310
6420
  }
6311
- _context8.next = 8;
6421
+ _context9.next = 8;
6312
6422
  return config.onBeforeLivenessCheck(request);
6313
6423
  case 8:
6314
- result = _context8.sent;
6424
+ result = _context9.sent;
6315
6425
  if (result) request = result;
6316
6426
  case 9:
6317
6427
  endpoint = liveCheckEndpoint(!!options.idCardForFaceMatch);
6318
6428
  sessionId = store.getState().session.sessionId;
6319
- _context8.prev = 10;
6320
- _context8.next = 11;
6429
+ _context9.prev = 10;
6430
+ _context9.next = 11;
6321
6431
  return timedFetch(urls.submissionUrl + endpoint, {
6322
6432
  method: 'POST',
6323
6433
  // SubmissionProvider.tsx:1447 — sourced from the same
@@ -6328,36 +6438,36 @@
6328
6438
  body: JSON.stringify(request)
6329
6439
  });
6330
6440
  case 11:
6331
- response = _context8.sent;
6332
- _context8.next = 13;
6441
+ response = _context9.sent;
6442
+ _context9.next = 13;
6333
6443
  break;
6334
6444
  case 12:
6335
- _context8.prev = 12;
6336
- _t10 = _context8["catch"](10);
6445
+ _context9.prev = 12;
6446
+ _t10 = _context9["catch"](10);
6337
6447
  throw new NetworkError(_t10 instanceof Error ? _t10.message : String(_t10));
6338
6448
  case 13:
6339
6449
  if (response.ok) {
6340
- _context8.next = 18;
6450
+ _context9.next = 18;
6341
6451
  break;
6342
6452
  }
6343
6453
  if (!(response.status === 401 || response.status === 403)) {
6344
- _context8.next = 15;
6454
+ _context9.next = 15;
6345
6455
  break;
6346
6456
  }
6347
6457
  _t11 = AuthenticationError;
6348
6458
  _t12 = response.status;
6349
- _context8.next = 14;
6459
+ _context9.next = 14;
6350
6460
  return response.text();
6351
6461
  case 14:
6352
- _t13 = _context8.sent;
6462
+ _t13 = _context9.sent;
6353
6463
  throw new _t11(_t12, _t13);
6354
6464
  case 15:
6355
- _context8.next = 16;
6465
+ _context9.next = 16;
6356
6466
  return response.text();
6357
6467
  case 16:
6358
- statusMessage = _context8.sent;
6468
+ statusMessage = _context9.sent;
6359
6469
  if (!(!statusMessage || statusMessage === 'Load failed')) {
6360
- _context8.next = 17;
6470
+ _context9.next = 17;
6361
6471
  break;
6362
6472
  }
6363
6473
  throw new NetworkError(statusMessage);
@@ -6367,12 +6477,12 @@
6367
6477
  statusMessage: statusMessage
6368
6478
  });
6369
6479
  case 18:
6370
- _context8.next = 19;
6480
+ _context9.next = 19;
6371
6481
  return response.json();
6372
6482
  case 19:
6373
- livenessResponse = _context8.sent;
6483
+ livenessResponse = _context9.sent;
6374
6484
  if (!(livenessResponse.status.statusCode !== '000')) {
6375
- _context8.next = 20;
6485
+ _context9.next = 20;
6376
6486
  break;
6377
6487
  }
6378
6488
  throw new SubmissionError(livenessResponse.status);
@@ -6385,7 +6495,7 @@
6385
6495
  // unconditional here — a deliberate scope narrowing, not a silent drop.
6386
6496
  livenessToken = (_livenessResponse$res = livenessResponse.resultData) == null ? void 0 : _livenessResponse$res.livenessToken;
6387
6497
  if (!(options.softFail && !isLiveFaceConfirmed((_livenessResponse$res2 = livenessResponse.resultData) == null ? void 0 : _livenessResponse$res2.verificationResult))) {
6388
- _context8.next = 21;
6498
+ _context9.next = 21;
6389
6499
  break;
6390
6500
  }
6391
6501
  // Current sdk2 (SubmissionProvider.tsx checkLiveness): softFail also
@@ -6394,21 +6504,21 @@
6394
6504
  // non-live capture) and hand back a typed failure that still carries
6395
6505
  // the response so callers can read the detection flags.
6396
6506
  livenessToken = undefined;
6397
- return _context8.abrupt("return", {
6507
+ return _context9.abrupt("return", {
6398
6508
  ok: false,
6399
6509
  error: new Error("Liveness not confirmed: " + ((_livenessResponse$res3 = (_livenessResponse$res4 = livenessResponse.resultData) == null ? void 0 : _livenessResponse$res4.verificationResult) != null ? _livenessResponse$res3 : 'no verificationResult')),
6400
6510
  response: livenessResponse
6401
6511
  });
6402
6512
  case 21:
6403
- return _context8.abrupt("return", {
6513
+ return _context9.abrupt("return", {
6404
6514
  ok: true,
6405
6515
  response: livenessResponse
6406
6516
  });
6407
6517
  case 22:
6408
- _context8.prev = 22;
6409
- _t14 = _context8["catch"](1);
6518
+ _context9.prev = 22;
6519
+ _t14 = _context9["catch"](1);
6410
6520
  if (!options.softFail) {
6411
- _context8.next = 23;
6521
+ _context9.next = 23;
6412
6522
  break;
6413
6523
  }
6414
6524
  // Caller is treating this as a best-effort check. Don't surface the
@@ -6416,7 +6526,7 @@
6416
6526
  // typed failure result instead of sdk2's silent `undefined` (deliberate
6417
6527
  // divergence #3).
6418
6528
  livenessToken = undefined;
6419
- return _context8.abrupt("return", {
6529
+ return _context9.abrupt("return", {
6420
6530
  ok: false,
6421
6531
  error: _t14
6422
6532
  });
@@ -6430,32 +6540,32 @@
6430
6540
  throw err;
6431
6541
  case 24:
6432
6542
  case "end":
6433
- return _context8.stop();
6543
+ return _context9.stop();
6434
6544
  }
6435
- }, _callee8, null, [[1, 22], [2, 4], [10, 12]]);
6545
+ }, _callee9, null, [[1, 22], [2, 4], [10, 12]]);
6436
6546
  }));
6437
6547
  return _checkLiveness.apply(this, arguments);
6438
6548
  }
6439
- function clientUploadDocument(_x0, _x1) {
6549
+ function clientUploadDocument(_x11, _x12) {
6440
6550
  return _clientUploadDocument.apply(this, arguments);
6441
6551
  }
6442
6552
  function _clientUploadDocument() {
6443
- _clientUploadDocument = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(blob, metadata) {
6444
- return _regeneratorRuntime.wrap(function (_context9) {
6445
- while (1) switch (_context9.prev = _context9.next) {
6553
+ _clientUploadDocument = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(blob, metadata) {
6554
+ return _regeneratorRuntime.wrap(function (_context0) {
6555
+ while (1) switch (_context0.prev = _context0.next) {
6446
6556
  case 0:
6447
6557
  if (documentServiceEnabled) {
6448
- _context9.next = 1;
6558
+ _context0.next = 1;
6449
6559
  break;
6450
6560
  }
6451
6561
  throw new Error('document upload is disabled: no documentServiceUrl configured');
6452
6562
  case 1:
6453
- return _context9.abrupt("return", performUpload(blob, metadata != null ? metadata : {}));
6563
+ return _context0.abrupt("return", performUpload(blob, metadata != null ? metadata : {}, currentRoute()));
6454
6564
  case 2:
6455
6565
  case "end":
6456
- return _context9.stop();
6566
+ return _context0.stop();
6457
6567
  }
6458
- }, _callee9);
6568
+ }, _callee0);
6459
6569
  }));
6460
6570
  return _clientUploadDocument.apply(this, arguments);
6461
6571
  }
@@ -6471,6 +6581,8 @@
6471
6581
  validateSession: validateSessionMethod,
6472
6582
  retrySession: retrySession,
6473
6583
  submit: submit,
6584
+ post: post,
6585
+ handoff: handoff,
6474
6586
  checkLiveness: checkLiveness,
6475
6587
  uploadDocument: clientUploadDocument
6476
6588
  };
@@ -43973,7 +44085,9 @@
43973
44085
  onComplete = _ref.onComplete,
43974
44086
  onApproved = _ref.onApproved,
43975
44087
  onDenied = _ref.onDenied,
43976
- onRequestFailure = _ref.onRequestFailure;
44088
+ onSubmissionFailure = _ref.onSubmissionFailure,
44089
+ onRequestFailure = _ref.onRequestFailure,
44090
+ mode = _ref.mode;
43977
44091
  var progress = useCaptureObserver();
43978
44092
  var clientState = shimExports.useSyncExternalStore(client.subscribe, client.getState, client.getState);
43979
44093
  var _useAuthState = useAuthState(),
@@ -43986,10 +44100,15 @@
43986
44100
  _useState4 = _slicedToArray$1(_useState3, 2),
43987
44101
  localError = _useState4[0],
43988
44102
  setLocalError = _useState4[1];
43989
- var _useState5 = React.useState(false),
44103
+ var _useState5 = React.useState(IDLE_ATTEMPT),
43990
44104
  _useState6 = _slicedToArray$1(_useState5, 2),
43991
- resubmitting = _useState6[0],
43992
- setResubmitting = _useState6[1];
44105
+ attempt = _useState6[0],
44106
+ setAttempt = _useState6[1];
44107
+ var reportFailure = onSubmissionFailure != null ? onSubmissionFailure : onRequestFailure;
44108
+ var _useState7 = React.useState(false),
44109
+ _useState8 = _slicedToArray$1(_useState7, 2),
44110
+ resubmitting = _useState8[0],
44111
+ setResubmitting = _useState8[1];
43993
44112
  var lastArtifactsRef = React.useRef(null);
43994
44113
  var submitInFlightRef = React.useRef(null);
43995
44114
  var resubmitInFlightRef = React.useRef(null);
@@ -44007,6 +44126,65 @@
44007
44126
  }) : incoming;
44008
44127
  // Store the merged artifacts so a resubmit carries location too.
44009
44128
  lastArtifactsRef.current = artifacts;
44129
+ if (mode !== undefined) {
44130
+ // Registered before anything customer-supplied runs, so a throw from
44131
+ // a notification can never leave the flow without a status.
44132
+ setAttempt(_extends$1({}, IDLE_ATTEMPT, {
44133
+ status: SubmissionStatus.SUBMITTING
44134
+ }));
44135
+ notifySafely('onSubmissionStarted', function () {
44136
+ return onSubmissionStarted == null ? void 0 : onSubmissionStarted(artifacts);
44137
+ });
44138
+ var _unbindProgress = bindSubmissionObserver(artifacts, progress);
44139
+ var _promise = runAttempt(client, mode, artifacts, _extends$1({}, options, {
44140
+ action: action
44141
+ })).then(function (outcome) {
44142
+ setAttempt(_extends$1({}, outcome, {
44143
+ status: SubmissionStatus.SUBMITTED,
44144
+ error: null
44145
+ }));
44146
+ var response = outcome.response,
44147
+ request = outcome.request;
44148
+ if (response === null) {
44149
+ // Terminal once called; the handler is never awaited.
44150
+ if (typeof mode === 'object') {
44151
+ notifySafely('submitMode.handoff', function () {
44152
+ return mode.handoff(request);
44153
+ });
44154
+ }
44155
+ return null;
44156
+ }
44157
+ notifySafely('onComplete', function () {
44158
+ return onComplete == null ? void 0 : onComplete(response);
44159
+ });
44160
+ if (isApprovedResponse(action, response)) {
44161
+ notifySafely('onApproved', function () {
44162
+ return onApproved == null ? void 0 : onApproved(response);
44163
+ });
44164
+ } else {
44165
+ notifySafely('onDenied', function () {
44166
+ return onDenied == null ? void 0 : onDenied(response);
44167
+ });
44168
+ }
44169
+ return response;
44170
+ }, function (cause) {
44171
+ var error = cause instanceof Error ? cause : new Error(String(cause));
44172
+ setAttempt(_extends$1({}, IDLE_ATTEMPT, {
44173
+ status: SubmissionStatus.FAILED,
44174
+ error: error
44175
+ }));
44176
+ notifySafely('onSubmissionFailure', function () {
44177
+ return reportFailure == null ? void 0 : reportFailure(error);
44178
+ });
44179
+ throw error;
44180
+ })["finally"](function () {
44181
+ _unbindProgress();
44182
+ submitInFlightRef.current = null;
44183
+ setResubmitting(false);
44184
+ });
44185
+ submitInFlightRef.current = _promise;
44186
+ return _promise;
44187
+ }
44010
44188
  setSubmissionResponse(null);
44011
44189
  setLocalError(null);
44012
44190
  onSubmissionStarted == null || onSubmissionStarted(artifacts);
@@ -44027,7 +44205,7 @@
44027
44205
  })["catch"](function (cause) {
44028
44206
  var error = cause instanceof Error ? cause : new Error(String(cause));
44029
44207
  setLocalError(error);
44030
- onRequestFailure == null || onRequestFailure(error);
44208
+ reportFailure == null || reportFailure(error);
44031
44209
  throw error;
44032
44210
  })["finally"](function () {
44033
44211
  unbindProgress();
@@ -44036,7 +44214,7 @@
44036
44214
  });
44037
44215
  submitInFlightRef.current = promise;
44038
44216
  return promise;
44039
- }, [action, client, geolocation, onApproved, onComplete, onDenied, onRequestFailure, onSubmissionStarted, options, progress]);
44217
+ }, [action, client, geolocation, onApproved, onComplete, onDenied, reportFailure, onSubmissionStarted, options, progress, mode]);
44040
44218
  var resubmit = React.useMemo(function () {
44041
44219
  if (!authState.session.canRefreshSession) return null;
44042
44220
  return function () {
@@ -44081,22 +44259,121 @@
44081
44259
  }, [authState.session.canRefreshSession, client, submit]);
44082
44260
  var value = React.useMemo(function () {
44083
44261
  var _ref3, _clientState$lastSubm, _clientState$lastSubm2;
44262
+ if (mode !== undefined) {
44263
+ return {
44264
+ action: action,
44265
+ submit: submit,
44266
+ submissionStatus: resubmitting ? SubmissionStatus.SUBMITTING : attempt.status,
44267
+ submissionResponse: attempt.response,
44268
+ submissionError: attempt.error,
44269
+ lastSubmissionTimings: attempt.timings,
44270
+ lastSubmissionRequest: attempt.request,
44271
+ resubmit: resubmit
44272
+ };
44273
+ }
44084
44274
  return {
44085
44275
  action: action,
44086
44276
  submit: submit,
44087
- submissionStatus: resubmitting ? SubmissionStatus.SUBMITTING : clientState.submissionStatus,
44277
+ // A rejection before the client records anything (an unsupported
44278
+ // action, an unvalidated session) leaves the client at READY, which the
44279
+ // wizard renders as its submitting screen; the local error is the
44280
+ // failure it would otherwise never show.
44281
+ submissionStatus: resubmitting ? SubmissionStatus.SUBMITTING : localError && clientState.submissionStatus === SubmissionStatus.READY ? SubmissionStatus.FAILED : clientState.submissionStatus,
44088
44282
  submissionResponse: submissionResponse,
44089
44283
  submissionError: (_ref3 = localError != null ? localError : clientState.submissionError) != null ? _ref3 : null,
44090
44284
  lastSubmissionTimings: (_clientState$lastSubm = clientState.lastSubmissionTimings) != null ? _clientState$lastSubm : null,
44091
44285
  lastSubmissionRequest: (_clientState$lastSubm2 = clientState.lastSubmissionRequest) != null ? _clientState$lastSubm2 : null,
44092
44286
  resubmit: resubmit
44093
44287
  };
44094
- }, [action, clientState.lastSubmissionRequest, clientState.lastSubmissionTimings, clientState.submissionError, clientState.submissionStatus, localError, resubmit, resubmitting, submissionResponse, submit]);
44288
+ }, [action, attempt, clientState.lastSubmissionRequest, clientState.lastSubmissionTimings, clientState.submissionError, clientState.submissionStatus, localError, mode, resubmit, resubmitting, submissionResponse, submit]);
44095
44289
  return jsx(SubmissionContext.Provider, {
44096
44290
  value: value,
44097
44291
  children: children
44098
44292
  });
44099
44293
  }
44294
+ var IDLE_ATTEMPT = {
44295
+ status: SubmissionStatus.READY,
44296
+ response: null,
44297
+ request: null,
44298
+ timings: null,
44299
+ error: null
44300
+ };
44301
+ /**
44302
+ * One explicit-mode attempt through the client's `post()` or `handoff()`.
44303
+ * Never falls back to `submit()`: that would let the deprecated
44304
+ * `config.onSubmit` decide what an explicit mode already decided.
44305
+ */
44306
+ function runAttempt(_x, _x2, _x3, _x4) {
44307
+ return _runAttempt.apply(this, arguments);
44308
+ }
44309
+ function _runAttempt() {
44310
+ _runAttempt = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(client, mode, artifacts, options) {
44311
+ var _yield$client$handoff, request, timings;
44312
+ return _regeneratorRuntime.wrap(function (_context2) {
44313
+ while (1) switch (_context2.prev = _context2.next) {
44314
+ case 0:
44315
+ if (!(mode === 'capture')) {
44316
+ _context2.next = 1;
44317
+ break;
44318
+ }
44319
+ throw new Error("submitMode 'capture' does not submit; the flow reports onCaptured instead");
44320
+ case 1:
44321
+ if (!(mode === 'post')) {
44322
+ _context2.next = 3;
44323
+ break;
44324
+ }
44325
+ if (client.post) {
44326
+ _context2.next = 2;
44327
+ break;
44328
+ }
44329
+ throw missingMethod('post', "submitMode 'post'");
44330
+ case 2:
44331
+ return _context2.abrupt("return", client.post(artifacts, options));
44332
+ case 3:
44333
+ if (client.handoff) {
44334
+ _context2.next = 4;
44335
+ break;
44336
+ }
44337
+ throw missingMethod('handoff', 'submitMode { handoff }');
44338
+ case 4:
44339
+ _context2.next = 5;
44340
+ return client.handoff(artifacts, options);
44341
+ case 5:
44342
+ _yield$client$handoff = _context2.sent;
44343
+ request = _yield$client$handoff.request;
44344
+ timings = _yield$client$handoff.timings;
44345
+ return _context2.abrupt("return", {
44346
+ request: request,
44347
+ timings: timings,
44348
+ response: null
44349
+ });
44350
+ case 6:
44351
+ case "end":
44352
+ return _context2.stop();
44353
+ }
44354
+ }, _callee2);
44355
+ }));
44356
+ return _runAttempt.apply(this, arguments);
44357
+ }
44358
+ function missingMethod(method, needs) {
44359
+ return new Error(needs + " needs client." + method + "(), which this client does not have. " + 'Create the client with createIdmissionClient or useIdmissionClient.');
44360
+ }
44361
+ /**
44362
+ * Runs a customer callback whose failure must not change an outcome that is
44363
+ * already settled: a throw or a rejected promise is logged, never rethrown.
44364
+ */
44365
+ function notifySafely(name, notify) {
44366
+ try {
44367
+ var result = notify();
44368
+ if (result instanceof Promise) {
44369
+ result["catch"](function (e) {
44370
+ return warn$1(name + " rejected", e);
44371
+ });
44372
+ }
44373
+ } catch (e) {
44374
+ warn$1(name + " threw", e);
44375
+ }
44376
+ }
44100
44377
  function useSubmission() {
44101
44378
  var context = React.useContext(SubmissionContext);
44102
44379
  if (!context) {
@@ -46802,11 +47079,12 @@
46802
47079
  }
46803
47080
 
46804
47081
  var _templateObject$2, _templateObject2$2, _templateObject3$1, _templateObject4$1;
46805
- var _excluded$9 = ["client", "action", "submission", "theme", "className", "geolocationEnabled", "geolocationRequired", "captureProgress", "remoteDiagnostics", "loadingSpinner", "showEnrollmentId", "lang", "children"];
47082
+ var _excluded$9 = ["client", "action", "submission", "submitMode", "theme", "className", "geolocationEnabled", "geolocationRequired", "captureProgress", "remoteDiagnostics", "loadingSpinner", "showEnrollmentId", "lang", "children"];
46806
47083
  function FlowChassis(_ref) {
46807
47084
  var client = _ref.client,
46808
47085
  action = _ref.action,
46809
47086
  submission = _ref.submission,
47087
+ submitMode = _ref.submitMode,
46810
47088
  _ref$theme = _ref.theme,
46811
47089
  theme = _ref$theme === void 0 ? 'default' : _ref$theme,
46812
47090
  className = _ref.className,
@@ -46839,6 +47117,7 @@
46839
47117
  client: client,
46840
47118
  action: action,
46841
47119
  options: submission,
47120
+ mode: submitMode,
46842
47121
  geolocation: geolocation.position
46843
47122
  }, callbacks, {
46844
47123
  children: jsx(FlowPage, {
@@ -47159,7 +47438,7 @@
47159
47438
  return base;
47160
47439
  }
47161
47440
 
47162
- var _excluded$8 = ["client", "controller", "capture", "view", "submission", "initialArtifacts", "captureOnly", "signatureController", "signatureCapture", "signatureView", "captureSignature", "captureSignatureVideo", "allowVirtualCameras", "theme", "className", "lang", "debugMode", "skipSuccessScreen", "showResultScreen", "showSuccessScreen", "showDiagnostics", "captureAdditionalDocuments", "additionalDocumentClassNames", "additionalDocumentVerbiage", "ringScreenClassNames", "ringScreenVerbiage", "onCaptured", "onSubmitted", "children"];
47441
+ var _excluded$8 = ["client", "controller", "capture", "view", "submission", "initialArtifacts", "submitMode", "captureOnly", "signatureController", "signatureCapture", "signatureView", "captureSignature", "captureSignatureVideo", "allowVirtualCameras", "theme", "className", "lang", "debugMode", "skipSuccessScreen", "showResultScreen", "showSuccessScreen", "showDiagnostics", "captureAdditionalDocuments", "additionalDocumentClassNames", "additionalDocumentVerbiage", "ringScreenClassNames", "ringScreenVerbiage", "onCaptured", "onSubmitted", "children"];
47163
47442
  var EMPTY_ID_CAPTURE$3 = {};
47164
47443
  var EMPTY_SIGNATURE_CAPTURE$5 = {};
47165
47444
  var EMPTY_ID_VIEW$3 = {};
@@ -47176,8 +47455,8 @@
47176
47455
  submission = _ref$submission === void 0 ? EMPTY_SUBMISSION$6 : _ref$submission,
47177
47456
  _ref$initialArtifacts = _ref.initialArtifacts,
47178
47457
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$9 : _ref$initialArtifacts,
47179
- _ref$captureOnly = _ref.captureOnly,
47180
- captureOnly = _ref$captureOnly === void 0 ? false : _ref$captureOnly,
47458
+ submitMode = _ref.submitMode,
47459
+ captureOnly = _ref.captureOnly,
47181
47460
  signatureController = _ref.signatureController,
47182
47461
  _ref$signatureCapture = _ref.signatureCapture,
47183
47462
  signatureCapture = _ref$signatureCapture === void 0 ? EMPTY_SIGNATURE_CAPTURE$5 : _ref$signatureCapture,
@@ -47336,10 +47615,12 @@
47336
47615
  successIssuerCaptionText: 'confirmed'
47337
47616
  }
47338
47617
  });
47618
+ var mode = submitMode != null ? submitMode : captureOnly ? 'capture' : undefined;
47339
47619
  return jsxs(FlowChassis, _extends$1({
47340
47620
  client: client,
47341
47621
  action: SubmissionAction.VALIDATE,
47342
47622
  submission: submission,
47623
+ submitMode: mode,
47343
47624
  theme: theme,
47344
47625
  className: className,
47345
47626
  lang: lang
@@ -47347,7 +47628,7 @@
47347
47628
  children: [jsx(CompositeWizard, _extends$1({}, ringScreens, {
47348
47629
  steps: steps,
47349
47630
  initialArtifacts: initialArtifacts,
47350
- captureOnly: captureOnly,
47631
+ captureOnly: mode === 'capture',
47351
47632
  showResultScreen: showResultScreen != null ? showResultScreen : showSuccessScreen,
47352
47633
  showDiagnostics: showDiagnostics,
47353
47634
  onArtifactsCollected: onCaptured,
@@ -47807,6 +48088,10 @@
47807
48088
  captureProgress = _ref.captureProgress,
47808
48089
  remoteDiagnostics = _ref.remoteDiagnostics,
47809
48090
  loadingSpinner = _ref.loadingSpinner,
48091
+ _ref$submitMode = _ref.submitMode,
48092
+ submitMode = _ref$submitMode === void 0 ? 'capture' : _ref$submitMode,
48093
+ onSubmissionStarted = _ref.onSubmissionStarted,
48094
+ onSubmissionFailure = _ref.onSubmissionFailure,
47810
48095
  onCaptured = _ref.onCaptured,
47811
48096
  onCaptureError = _ref.onCaptureError;
47812
48097
  // Flow-wide settings reach each step unless its own bag sets them.
@@ -48007,8 +48292,8 @@
48007
48292
  completedRef.current = true;
48008
48293
  artifactsRef.current = mergeSubmissionArtifacts(artifactsRef.current, artifacts);
48009
48294
  setStage('complete');
48010
- onCaptured == null || onCaptured(artifactsRef.current);
48011
- }, [onCaptured]);
48295
+ if (submitMode === 'capture') onCaptured == null || onCaptured(artifactsRef.current);
48296
+ }, [onCaptured, submitMode]);
48012
48297
  var handleLivenessFailureExit = React.useCallback(function () {
48013
48298
  onExitAfterLivenessFailure == null || onExitAfterLivenessFailure();
48014
48299
  if (allowSignatureAfterLivenessCheckFailure) handleLivenessDone();
@@ -48017,6 +48302,9 @@
48017
48302
  client: client,
48018
48303
  action: SubmissionAction.NONE,
48019
48304
  submission: submission,
48305
+ submitMode: submitMode,
48306
+ onSubmissionStarted: onSubmissionStarted,
48307
+ onSubmissionFailure: onSubmissionFailure,
48020
48308
  theme: theme,
48021
48309
  className: className,
48022
48310
  lang: lang,
@@ -48026,8 +48314,10 @@
48026
48314
  remoteDiagnostics: remoteDiagnostics,
48027
48315
  loadingSpinner: loadingSpinner,
48028
48316
  children: [jsx(CaptureProgressCompletion, {
48029
- completed: stage === 'complete'
48030
- }), stage !== 'complete' ? jsxs(HandoffRoot, {
48317
+ completed: stage === 'complete' && submitMode === 'capture'
48318
+ }), stage === 'complete' && submitMode !== 'capture' ? jsx(SignatureHandoff, {
48319
+ artifacts: artifactsRef.current
48320
+ }) : null, stage !== 'complete' ? jsxs(HandoffRoot, {
48031
48321
  children: [jsx(SignatureCaptureView, _extends$1({}, signatureView, {
48032
48322
  skipSuccessScreen: impliedSkipSuccessScreen(signatureView.skipSuccessScreen, isRingIntroActive(faceView)),
48033
48323
  controller: resolvedSignatureController,
@@ -48077,6 +48367,44 @@
48077
48367
  }) : null]
48078
48368
  });
48079
48369
  }
48370
+ /**
48371
+ * Hands the finished capture off once the session has passed: a finishing
48372
+ * screen while the request is built, a retry screen if that fails, and
48373
+ * nothing once it has been handed off.
48374
+ */
48375
+ function SignatureHandoff(_ref3) {
48376
+ var artifacts = _ref3.artifacts;
48377
+ var _useSubmission = useSubmission(),
48378
+ action = _useSubmission.action,
48379
+ submit = _useSubmission.submit,
48380
+ submissionStatus = _useSubmission.submissionStatus,
48381
+ submissionError = _useSubmission.submissionError;
48382
+ var sessionReady = useSessionReady();
48383
+ var startedRef = React.useRef(false);
48384
+ // The provider reports a failure itself; these catches only keep the
48385
+ // rejection from going unhandled.
48386
+ React.useEffect(function () {
48387
+ if (!sessionReady || startedRef.current) return;
48388
+ startedRef.current = true;
48389
+ submit(artifacts)["catch"](function () {});
48390
+ }, [artifacts, sessionReady, submit]);
48391
+ if (submissionStatus === SubmissionStatus.SUBMITTED) return null;
48392
+ if (submissionStatus === SubmissionStatus.FAILED) {
48393
+ return jsx(SubmissionErrorOverlay, {
48394
+ error: submissionError,
48395
+ onRetry: function onRetry() {
48396
+ submit(artifacts)["catch"](function () {});
48397
+ }
48398
+ });
48399
+ }
48400
+ var text = submissionStatusText(action, artifacts);
48401
+ return jsx(OrbStatusScreen, {
48402
+ state: "working",
48403
+ text: text,
48404
+ accessibleLabel: text,
48405
+ loadingStage: "submission"
48406
+ });
48407
+ }
48080
48408
  /**
48081
48409
  * Black, so iOS Safari's bars read as letterboxing around the camera feed
48082
48410
  * rather than as one more colour a theme has to choose.
@@ -48094,10 +48422,10 @@
48094
48422
  * no flat strip can sit on its bottom edge unseen: that one is drawn invisibly,
48095
48423
  * as on ID capture's overlay. Opaque, it covered the bottom 12px of the bar.
48096
48424
  */
48097
- function FlowEdgeTint(_ref3) {
48425
+ function FlowEdgeTint(_ref4) {
48098
48426
  var _theme$selfieCapture$, _theme$selfieCapture, _theme$background;
48099
- var surface = _ref3.surface,
48100
- modelsReady = _ref3.modelsReady;
48427
+ var surface = _ref4.surface,
48428
+ modelsReady = _ref4.modelsReady;
48101
48429
  var theme = useTheme();
48102
48430
  if (theme.isFullscreen === false || surface === null) return null;
48103
48431
  var color = opaqueColor(surface === 'camera' ? CAMERA_EDGE_COLOR : surface === 'overlay' ? (_theme$selfieCapture$ = (_theme$selfieCapture = theme.selfieCapture) == null || (_theme$selfieCapture = _theme$selfieCapture.loadingOverlay) == null ? void 0 : _theme$selfieCapture.backgroundColor) != null ? _theme$selfieCapture$ : SELFIE_LOADING_OVERLAY_BACKGROUND_DEFAULT : (_theme$background = theme.background) != null ? _theme$background : '#fff');
@@ -48107,9 +48435,9 @@
48107
48435
  hiddenBottomColor: surface === 'overlay' ? selfieLoadingOverlayBottomEdgeColor(theme, modelsReady) : undefined
48108
48436
  });
48109
48437
  }
48110
- function SelfieTrackerAttachment(_ref4) {
48111
- var controller = _ref4.controller,
48112
- video = _ref4.video;
48438
+ function SelfieTrackerAttachment(_ref5) {
48439
+ var controller = _ref5.controller,
48440
+ video = _ref5.video;
48113
48441
  React.useEffect(function () {
48114
48442
  if (!video) return;
48115
48443
  void controller.attach(video)["catch"](function () {
@@ -48127,7 +48455,7 @@
48127
48455
  return props.$visible ? 'block' : 'none';
48128
48456
  });
48129
48457
 
48130
- var _excluded$4 = ["client", "idController", "selfieController", "controller", "idCapture", "faceCapture", "capture", "idView", "faceView", "view", "submission", "initialArtifacts", "captureOnly", "signatureController", "signatureCapture", "signatureView", "captureSignature", "captureSignatureVideo", "allowVirtualCameras", "skipIdCapture", "matchOnly", "readTextPrompt", "onMicrophoneAccessDenied", "theme", "className", "lang", "debugMode", "skipSuccessScreen", "showResultScreen", "showSuccessScreen", "showDiagnostics", "captureAdditionalDocuments", "additionalDocumentClassNames", "additionalDocumentVerbiage", "ringScreenClassNames", "ringScreenVerbiage", "onCaptured", "onSubmitted", "onCaptureError", "children"],
48458
+ var _excluded$4 = ["client", "idController", "selfieController", "controller", "idCapture", "faceCapture", "capture", "idView", "faceView", "view", "submission", "initialArtifacts", "submitMode", "captureOnly", "signatureController", "signatureCapture", "signatureView", "captureSignature", "captureSignatureVideo", "allowVirtualCameras", "skipIdCapture", "matchOnly", "readTextPrompt", "onMicrophoneAccessDenied", "theme", "className", "lang", "debugMode", "skipSuccessScreen", "showResultScreen", "showSuccessScreen", "showDiagnostics", "captureAdditionalDocuments", "additionalDocumentClassNames", "additionalDocumentVerbiage", "ringScreenClassNames", "ringScreenVerbiage", "onCaptured", "onSubmitted", "onCaptureError", "children"],
48131
48459
  _excluded2$2 = ["checkLivenessOptions"];
48132
48460
  var EMPTY_ID_CAPTURE$1 = {};
48133
48461
  var EMPTY_FACE_CAPTURE$2 = {};
@@ -48160,8 +48488,8 @@
48160
48488
  submission = _ref$submission === void 0 ? EMPTY_SUBMISSION$2 : _ref$submission,
48161
48489
  _ref$initialArtifacts = _ref.initialArtifacts,
48162
48490
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$5 : _ref$initialArtifacts,
48163
- _ref$captureOnly = _ref.captureOnly,
48164
- captureOnly = _ref$captureOnly === void 0 ? false : _ref$captureOnly,
48491
+ submitMode = _ref.submitMode,
48492
+ captureOnly = _ref.captureOnly,
48165
48493
  signatureController = _ref.signatureController,
48166
48494
  _ref$signatureCapture = _ref.signatureCapture,
48167
48495
  signatureCapture = _ref$signatureCapture === void 0 ? EMPTY_SIGNATURE_CAPTURE$2 : _ref$signatureCapture,
@@ -48379,10 +48707,12 @@
48379
48707
  successIssuerCaptionText: 'confirmed'
48380
48708
  }
48381
48709
  });
48710
+ var mode = submitMode != null ? submitMode : captureOnly ? 'capture' : undefined;
48382
48711
  return jsxs(FlowChassis, _extends$1({
48383
48712
  client: client,
48384
48713
  action: action,
48385
48714
  submission: submission,
48715
+ submitMode: mode,
48386
48716
  theme: theme,
48387
48717
  className: className,
48388
48718
  lang: lang
@@ -48390,7 +48720,7 @@
48390
48720
  children: [jsx(CompositeWizard, _extends$1({}, ringScreens, {
48391
48721
  steps: steps,
48392
48722
  initialArtifacts: initialArtifacts,
48393
- captureOnly: captureOnly,
48723
+ captureOnly: mode === 'capture',
48394
48724
  showResultScreen: showResultScreen != null ? showResultScreen : showSuccessScreen,
48395
48725
  showDiagnostics: showDiagnostics,
48396
48726
  onArtifactsCollected: onCaptured,
@@ -52601,7 +52931,9 @@
52601
52931
  onComplete = _ref.onComplete,
52602
52932
  onCustomerMatched = _ref.onCustomerMatched,
52603
52933
  onCustomerNotMatched = _ref.onCustomerNotMatched,
52934
+ onSubmissionFailure = _ref.onSubmissionFailure,
52604
52935
  onRequestFailure = _ref.onRequestFailure,
52936
+ submitMode = _ref.submitMode,
52605
52937
  onCaptureGuidanceTimeout = _ref.onCaptureGuidanceTimeout,
52606
52938
  onExitCapture = _ref.onExitCapture,
52607
52939
  onExitAfterFailure = _ref.onExitAfterFailure;
@@ -52688,15 +53020,19 @@
52688
53020
  setOutcome('notMatched');
52689
53021
  onCustomerNotMatched == null || onCustomerNotMatched(response);
52690
53022
  }, [onCustomerNotMatched]);
53023
+ var reportFailure = onSubmissionFailure != null ? onSubmissionFailure : onRequestFailure;
52691
53024
  var handleLivenessCheckFailed = React.useCallback(function (error) {
52692
53025
  setOutcome('failed');
52693
- onRequestFailure == null || onRequestFailure(error);
52694
- }, [onRequestFailure]);
53026
+ reportFailure == null || reportFailure(error);
53027
+ }, [reportFailure]);
52695
53028
  var handleRequestError = React.useCallback(function (error) {
52696
53029
  errorRef.current = error;
52697
53030
  setOutcome('error');
52698
- onRequestFailure == null || onRequestFailure(error);
52699
- }, [onRequestFailure]);
53031
+ reportFailure == null || reportFailure(error);
53032
+ }, [reportFailure]);
53033
+ var handleHandedOff = React.useCallback(function () {
53034
+ return setOutcome('handedOff');
53035
+ }, []);
52700
53036
  var handleCaptureGuidanceTimeout = React.useCallback(function () {
52701
53037
  setOutcome('failed');
52702
53038
  onCaptureGuidanceTimeout == null || onCaptureGuidanceTimeout();
@@ -52737,6 +53073,7 @@
52737
53073
  client: client,
52738
53074
  action: action,
52739
53075
  submission: submission,
53076
+ submitMode: submitMode,
52740
53077
  theme: theme,
52741
53078
  className: className,
52742
53079
  lang: lang,
@@ -52761,6 +53098,7 @@
52761
53098
  onNotMatched: handleNotMatched,
52762
53099
  onLivenessCheckFailed: handleLivenessCheckFailed,
52763
53100
  onRequestError: handleRequestError,
53101
+ onSubmissionIntercepted: handleHandedOff,
52764
53102
  onCaptureGuidanceTimeout: handleCaptureGuidanceTimeout,
52765
53103
  onExitCapture: onExitCapture,
52766
53104
  finishingScreen: {
@@ -52896,6 +53234,84 @@
52896
53234
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
52897
53235
  };
52898
53236
 
53237
+ function createIdAndFaceValidationJourneyEvent(event, now) {
53238
+ if (now === void 0) {
53239
+ now = function now() {
53240
+ return new Date();
53241
+ };
53242
+ }
53243
+ return _assign(_assign({}, event), {
53244
+ version: 1,
53245
+ flow: 'id-and-face-validation',
53246
+ timestamp: now().toISOString()
53247
+ });
53248
+ }
53249
+ /**
53250
+ * websdk-ui `CompositeWizardStep.id` -> journey stage.
53251
+ *
53252
+ * Four of the five stage names ARE step ids already; only the additional-
53253
+ * documents step differs, because sdk2's stage vocabulary says
53254
+ * `additional-document-capture` (singular "document") while websdk-ui's step
53255
+ * is `additional-documents`. Unknown ids return undefined so a step this
53256
+ * vocabulary has no name for is silently skipped rather than emitted with a
53257
+ * bogus stage — the same shape as sdk2's partial lookup record.
53258
+ */
53259
+ function journeyStageForStepId(stepId) {
53260
+ switch (stepId) {
53261
+ case 'id-capture':
53262
+ case 'face-liveness':
53263
+ case 'signature-capture':
53264
+ case 'video-signature-capture':
53265
+ return stepId;
53266
+ case 'additional-documents':
53267
+ return 'additional-document-capture';
53268
+ default:
53269
+ return undefined;
53270
+ }
53271
+ }
53272
+ /**
53273
+ * The document types sdk2 reports as `document.captured`. sdk2 filters the
53274
+ * wizard's `onDocumentStored` through this set (`primaryIdDocumentTypes`) so
53275
+ * that a document type outside the journey vocabulary cannot widen the event.
53276
+ * Kept as a predicate rather than a Set: the ES5 UMD bundle target makes
53277
+ * `for..of` over a Set a downlevel hazard, and a switch needs no iteration.
53278
+ */
53279
+ function isJourneyDocumentType(documentType) {
53280
+ return documentType === 'idCardFront' || documentType === 'idCardBack' || documentType === 'passport' || documentType === 'singlePage';
53281
+ }
53282
+ /**
53283
+ * The lazy `flow.started` rule, lifted out of sdk2's `emitJourneyEvent`
53284
+ * closure (IdAndFaceValidation.tsx:521-537) so it can be tested without a
53285
+ * React tree.
53286
+ *
53287
+ * sdk2 does NOT simply emit `flow.started` from a mount effect: it emits it
53288
+ * before the FIRST event of any kind, whatever that event is, and then
53289
+ * suppresses the explicit mount emit. The mount effect and the lazy guard
53290
+ * together mean `flow.started` is always the first event a customer sees,
53291
+ * even if some other event races the effect. That ordering guarantee is the
53292
+ * contract, not the effect.
53293
+ */
53294
+ function createJourneyEmitter(callback, now) {
53295
+ var flowStartedEmitted = false;
53296
+ return function emit(event) {
53297
+ if (!callback) return;
53298
+ if (!flowStartedEmitted) {
53299
+ flowStartedEmitted = true;
53300
+ emitWith(callback, {
53301
+ name: 'flow.started'
53302
+ }, now);
53303
+ }
53304
+ if (event.name !== 'flow.started') emitWith(callback, event, now);
53305
+ };
53306
+ }
53307
+ function emitWith(callback, event, now) {
53308
+ try {
53309
+ callback(createIdAndFaceValidationJourneyEvent(event, now));
53310
+ } catch (error) {
53311
+ warn$2('[IdAndFaceValidation] onJourneyEvent callback failed', error);
53312
+ }
53313
+ }
53314
+
52899
53315
  /**
52900
53316
  * sdk2 exports this as a mutable `string[]`
52901
53317
  * (contexts/AuthStateContext.tsx:25), not a readonly tuple — copied rather
@@ -53068,12 +53484,9 @@
53068
53484
  documentServiceUrl: (_b = props.documentServiceUrl) !== null && _b !== void 0 ? _b : apiBase ? apiBase + '/files/' : override === null || override === void 0 ? void 0 : override.documentServiceUrl,
53069
53485
  onBeforeSubmit: props.onBeforeSubmit,
53070
53486
  onBeforeLivenessCheck: props.onBeforeLivenessCheck,
53071
- // Straight through to the client, which is where sdk2 put it too
53072
- // (SubmissionProvider.submit). That is what makes the SUPPRESSION uniform:
53073
- // every flow — including the two match flows, which own their own stage
53074
- // machine — submits through this one client, so none of them can post
53075
- // behind an integrator who supplied `onSubmit`.
53076
- onSubmit: props.onSubmit,
53487
+ // 2.x's `onSubmit` is not a client option here: each flow maps it to its
53488
+ // own `submitMode: { handoff }` (see ./props.ts), which follows the prop
53489
+ // live where a client option would be fixed at mount.
53077
53490
  onBeforeDocumentUpload: props.onBeforeDocumentUpload,
53078
53491
  onDocumentUploadProgress: props.onDocumentUploadProgress,
53079
53492
  onDocumentUploaded: props.onDocumentUploaded,
@@ -54083,84 +54496,6 @@
54083
54496
  };
54084
54497
  }
54085
54498
 
54086
- function createIdAndFaceValidationJourneyEvent(event, now) {
54087
- if (now === void 0) {
54088
- now = function now() {
54089
- return new Date();
54090
- };
54091
- }
54092
- return _assign(_assign({}, event), {
54093
- version: 1,
54094
- flow: 'id-and-face-validation',
54095
- timestamp: now().toISOString()
54096
- });
54097
- }
54098
- /**
54099
- * websdk-ui `CompositeWizardStep.id` -> journey stage.
54100
- *
54101
- * Four of the five stage names ARE step ids already; only the additional-
54102
- * documents step differs, because sdk2's stage vocabulary says
54103
- * `additional-document-capture` (singular "document") while websdk-ui's step
54104
- * is `additional-documents`. Unknown ids return undefined so a step this
54105
- * vocabulary has no name for is silently skipped rather than emitted with a
54106
- * bogus stage — the same shape as sdk2's partial lookup record.
54107
- */
54108
- function journeyStageForStepId(stepId) {
54109
- switch (stepId) {
54110
- case 'id-capture':
54111
- case 'face-liveness':
54112
- case 'signature-capture':
54113
- case 'video-signature-capture':
54114
- return stepId;
54115
- case 'additional-documents':
54116
- return 'additional-document-capture';
54117
- default:
54118
- return undefined;
54119
- }
54120
- }
54121
- /**
54122
- * The document types sdk2 reports as `document.captured`. sdk2 filters the
54123
- * wizard's `onDocumentStored` through this set (`primaryIdDocumentTypes`) so
54124
- * that a document type outside the journey vocabulary cannot widen the event.
54125
- * Kept as a predicate rather than a Set: the ES5 UMD bundle target makes
54126
- * `for..of` over a Set a downlevel hazard, and a switch needs no iteration.
54127
- */
54128
- function isJourneyDocumentType(documentType) {
54129
- return documentType === 'idCardFront' || documentType === 'idCardBack' || documentType === 'passport' || documentType === 'singlePage';
54130
- }
54131
- /**
54132
- * The lazy `flow.started` rule, lifted out of sdk2's `emitJourneyEvent`
54133
- * closure (IdAndFaceValidation.tsx:521-537) so it can be tested without a
54134
- * React tree.
54135
- *
54136
- * sdk2 does NOT simply emit `flow.started` from a mount effect: it emits it
54137
- * before the FIRST event of any kind, whatever that event is, and then
54138
- * suppresses the explicit mount emit. The mount effect and the lazy guard
54139
- * together mean `flow.started` is always the first event a customer sees,
54140
- * even if some other event races the effect. That ordering guarantee is the
54141
- * contract, not the effect.
54142
- */
54143
- function createJourneyEmitter(callback, now) {
54144
- var flowStartedEmitted = false;
54145
- return function emit(event) {
54146
- if (!callback) return;
54147
- if (!flowStartedEmitted) {
54148
- flowStartedEmitted = true;
54149
- emitWith(callback, {
54150
- name: 'flow.started'
54151
- }, now);
54152
- }
54153
- if (event.name !== 'flow.started') emitWith(callback, event, now);
54154
- };
54155
- }
54156
- function emitWith(callback, event, now) {
54157
- try {
54158
- callback(createIdAndFaceValidationJourneyEvent(event, now));
54159
- } catch (error) {
54160
- warn$2('[IdAndFaceValidation] onJourneyEvent callback failed', error);
54161
- }
54162
- }
54163
-
54164
54499
  /**
54165
54500
  * Recursively drops keys whose value is exactly `undefined`.
54166
54501
  *
@@ -54343,6 +54678,16 @@
54343
54678
  return mergeThemes(mapped, overrides);
54344
54679
  }
54345
54680
 
54681
+ /**
54682
+ * 2.x's `onSubmit` as the flow's hand-off. sdk2 read it on every submission,
54683
+ * so this maps on every render: adding or removing it takes effect from the
54684
+ * next submission. Without it the flow posts.
54685
+ */
54686
+ function mapHandoff(onSubmit) {
54687
+ return onSubmit ? {
54688
+ handoff: onSubmit
54689
+ } : undefined;
54690
+ }
54346
54691
  var EMPTY_CONTEXT = {};
54347
54692
  /** Adapts a 3.0 `(response)` callback back to 2.x's `(response, request)`. */
54348
54693
  function withSubmissionRequest(callback, ctx) {
@@ -54434,13 +54779,13 @@
54434
54779
  }
54435
54780
  // --- 1. IdValidation ------------------------------------------------------
54436
54781
  function mapIdValidationProps(props, ctx) {
54437
- var _a;
54782
+ var _a, _b;
54438
54783
  if (ctx === void 0) {
54439
54784
  ctx = EMPTY_CONTEXT;
54440
54785
  }
54441
- var _b = mapIdCapture(props),
54442
- capture = _b.capture,
54443
- view = _b.view;
54786
+ var _c = mapIdCapture(props),
54787
+ capture = _c.capture,
54788
+ view = _c.view;
54444
54789
  return compact({
54445
54790
  capture: capture,
54446
54791
  view: view,
@@ -54466,9 +54811,8 @@
54466
54811
  // `onSubmit` WINS over capture-only, matching sdk2's ordering: its
54467
54812
  // `submit()` checks `onSubmit` before the `action === NONE` branch
54468
54813
  // (SubmissionProvider.tsx:1374 vs :1237), so a capture-only flow still
54469
- // owes the callback its built request. Letting the flow run its normal
54470
- // submit path is what builds that request; the client suppresses the POST.
54471
- captureOnly: props.onSubmit ? undefined : props.captureOnly,
54814
+ // owes the callback its built request.
54815
+ submitMode: (_b = mapHandoff(props.onSubmit)) !== null && _b !== void 0 ? _b : props.captureOnly ? 'capture' : undefined,
54472
54816
  captureAdditionalDocuments: props.captureAdditionalDocuments,
54473
54817
  geolocationEnabled: props.geolocationEnabled,
54474
54818
  geolocationRequired: props.geolocationRequired,
@@ -54489,13 +54833,10 @@
54489
54833
  // would be a NEW restriction, not parity.
54490
54834
  showResultScreen: props.debugMode,
54491
54835
  showDiagnostics: props.debugMode,
54492
- // `onSubmit` is NOT mapped to a flow prop: it goes to the client config
54493
- // (see mapClientConfig), which is the layer sdk2 put it at and the only
54494
- // one that can suppress the POST for every flow at once.
54495
54836
  onComplete: withSubmissionRequest(props.onComplete, ctx),
54496
54837
  onApproved: withSubmissionRequest(props.onApproved, ctx),
54497
54838
  onDenied: withSubmissionRequest(props.onDenied, ctx),
54498
- onRequestFailure: props.onRequestFailure
54839
+ onSubmissionFailure: props.onRequestFailure
54499
54840
  });
54500
54841
  }
54501
54842
  // --- 2. FaceValidation ----------------------------------------------------
@@ -54687,7 +55028,8 @@
54687
55028
  onComplete: withSubmissionRequest(props.onComplete, ctx),
54688
55029
  onApproved: withSubmissionRequest(props.onApproved, ctx),
54689
55030
  onDenied: withSubmissionRequest(props.onDenied, ctx),
54690
- onRequestFailure: props.onRequestFailure,
55031
+ submitMode: mapHandoff(props.onSubmit),
55032
+ onSubmissionFailure: props.onRequestFailure,
54691
55033
  onCaptureError: props.onRequestFailure
54692
55034
  });
54693
55035
  }
@@ -54842,10 +55184,11 @@
54842
55184
  captureProgress: props.captureProgress,
54843
55185
  remoteDiagnostics: props.remoteDiagnostics,
54844
55186
  loadingSpinner: props.loadingSpinner,
54845
- // `onCaptured` is supplied by the COMPONENT, not here: this flow never
54846
- // enters `client.submit()` on its own, so the façade makes that call from
54847
- // `onCaptured` to produce the same built request 2.x hands over. See
54848
- // components/flows.tsx.
55187
+ // 2.x builds this flow's request and hands it to `onSubmit`
55188
+ // (SubmissionProvider.tsx:1374, ahead of its NONE branch). Unset, the
55189
+ // flow captures and posts nothing, as 2.x's NONE did. A failed hand-off
55190
+ // is not reported to `onRequestFailure`, which 2.x never did either.
55191
+ submitMode: mapHandoff(props.onSubmit),
54849
55192
  onCaptureError: props.onRequestFailure
54850
55193
  });
54851
55194
  }
@@ -54871,7 +55214,7 @@
54871
55214
  return map(nested);
54872
55215
  }
54873
55216
  function mapVideoIdValidationProps(props, ctx) {
54874
- var _a, _b, _c;
55217
+ var _a, _b, _c, _d;
54875
55218
  if (ctx === void 0) {
54876
55219
  ctx = EMPTY_CONTEXT;
54877
55220
  }
@@ -54964,7 +55307,11 @@
54964
55307
  showResultScreen: props.debugMode,
54965
55308
  showDiagnostics: props.debugMode,
54966
55309
  onComplete: withSubmissionRequest(props.onComplete, ctx),
54967
- onRequestFailure: props.onRequestFailure,
55310
+ // No ID captured and none supplied resolves the action to NONE, which
55311
+ // has nothing to post. 2.x answered with a synthetic success and no
55312
+ // request; capture mode is that without the fabricated response.
55313
+ submitMode: (_d = mapHandoff(props.onSubmit)) !== null && _d !== void 0 ? _d : props.skipIdCapture && !props.idCardForFaceMatch ? 'capture' : undefined,
55314
+ onSubmissionFailure: props.onRequestFailure,
54968
55315
  onCaptureError: props.onRequestFailure
54969
55316
  });
54970
55317
  }
@@ -55129,7 +55476,8 @@
55129
55476
  onComplete: withSubmissionRequest(props.onComplete, ctx),
55130
55477
  onCustomerMatched: withSubmissionRequest(props.onCustomerMatched, ctx),
55131
55478
  onCustomerNotMatched: withSubmissionRequest(props.onCustomerNotMatched, ctx),
55132
- onRequestFailure: props.onRequestFailure,
55479
+ submitMode: mapHandoff(props.onSubmit),
55480
+ onSubmissionFailure: props.onRequestFailure,
55133
55481
  onExitCapture: props.onExitCapture,
55134
55482
  onExitAfterFailure: props.onExitAfterFailure
55135
55483
  });
@@ -55198,7 +55546,8 @@
55198
55546
  // sdk2's enrollment twin of `onApproved`.
55199
55547
  onApproved: withSubmissionRequest(props.onEnrolled, ctx),
55200
55548
  onDenied: withSubmissionRequest(props.onDenied, ctx),
55201
- onRequestFailure: props.onRequestFailure,
55549
+ submitMode: mapHandoff(props.onSubmit),
55550
+ onSubmissionFailure: props.onRequestFailure,
55202
55551
  onCaptureError: props.onRequestFailure
55203
55552
  });
55204
55553
  }
@@ -55290,12 +55639,13 @@
55290
55639
  onComplete: withSubmissionRequest(props.onComplete, ctx),
55291
55640
  onApproved: withSubmissionRequest(props.onEnrolled, ctx),
55292
55641
  onDenied: withSubmissionRequest(props.onDenied, ctx),
55293
- onRequestFailure: props.onRequestFailure,
55642
+ submitMode: mapHandoff(props.onSubmit),
55643
+ onSubmissionFailure: props.onRequestFailure,
55294
55644
  onCaptureError: props.onRequestFailure
55295
55645
  });
55296
55646
  }
55297
55647
 
55298
- var webSdkVersion = '2.6.3-t3code-shared-flow-settings-e5702c2';
55648
+ var webSdkVersion = '2.6.3-t3code-callback-homes-submit-handoff-9e68377';
55299
55649
 
55300
55650
  // GENERATED by scripts/styleBagTypes.mjs from
55301
55651
  // src/__fixtures__/sdk2StyleBags.json and the mapper sweep — do not
@@ -57352,23 +57702,17 @@
57352
57702
  var SUBMIT_CALLBACKS = {
57353
57703
  onBeforeSubmit: MAPPED,
57354
57704
  /**
57355
- * Mapped to the CLIENT's `onSubmit`, not to a flow prop — the layer sdk2 put
57356
- * it at (SubmissionProvider.submit). The client builds the request, hands it
57357
- * over, and does NOT post, so `onComplete`/`onApproved`/`onDenied` never
57358
- * fire, exactly as 2.x documents. Every flow submits through that one
57359
- * client, including the two match flows with their own stage machine, so the
57360
- * suppression is uniform.
57705
+ * Mapped to the flow's `submitMode: { handoff }`. The flow builds the
57706
+ * request, hands it over, and does NOT post, so `onComplete`/`onApproved`/
57707
+ * `onDenied` never fire, exactly as 2.x documents. Mapped on every render,
57708
+ * so adding or removing it takes effect from the next submission, as sdk2's
57709
+ * ref-held `onSubmit` did.
57361
57710
  *
57362
57711
  * What the flow SHOWS afterwards is a 3.0 call rather than a 2.x
57363
57712
  * reproduction: every family now ends quietly, because the integrator owns
57364
57713
  * the outcome once they have the request. 2.x's match flows showed a failure
57365
57714
  * screen there, but only because their `submit()` could not distinguish an
57366
57715
  * intercepted submission from a broken one.
57367
- *
57368
- * `SignatureKYC` reaches the same place by a different route: its 3.0
57369
- * counterpart never enters `client.submit()`, so the façade component makes
57370
- * that call itself from `onCaptured`. `action: NONE` is accepted there
57371
- * precisely because `onSubmit` is bound.
57372
57716
  */
57373
57717
  onSubmit: MAPPED,
57374
57718
  onComplete: MAPPED,
@@ -57466,7 +57810,7 @@
57466
57810
  // `SubmissionAction.NONE` and wires `onComplete` to the provider's
57467
57811
  // `onResponseReceived` (SignatureKYC.tsx:434,449), which never fires because
57468
57812
  // nothing is ever posted. `onSubmit` is the real completion seam and IS
57469
- // mapped, to the flow's `onCaptured`.
57813
+ // mapped, to the flow's `submitMode: { handoff }`.
57470
57814
  onComplete: NOOP,
57471
57815
  onSubmit: MAPPED,
57472
57816
  onRequestFailure: MAPPED,
@@ -57957,10 +58301,6 @@
57957
58301
  _lastLivenessRequest.current = request;
57958
58302
  return propsRef.current.onBeforeLivenessCheck ? propsRef.current.onBeforeLivenessCheck(request) : Promise.resolve(request);
57959
58303
  },
57960
- onSubmit: propsRef.current.onSubmit ? function (request) {
57961
- var _a, _b;
57962
- return (_b = (_a = propsRef.current).onSubmit) === null || _b === void 0 ? void 0 : _b.call(_a, request);
57963
- } : undefined,
57964
58304
  onResponseReceived: function onResponseReceived(_response, request) {
57965
58305
  _lastSubmissionRequest.current = request;
57966
58306
  },
@@ -58131,34 +58471,12 @@
58131
58471
  client = _a.client,
58132
58472
  ctx = _a.ctx;
58133
58473
  useDroppedPropReport('SignatureKYC', props);
58134
- // The one flow whose 3.0 counterpart never enters `client.submit()`: it runs
58135
- // its own stage machine and reports completion through `onCaptured` instead.
58136
- // 2.x DOES submit here — its CompositeWizard calls `submit()`, which hands
58137
- // the built request to `onSubmit` before reaching the capture-only branch —
58138
- // so the façade makes that call itself to produce the same request. The
58139
- // client suppresses the POST, and `action: NONE` is accepted precisely
58140
- // because `onSubmit` is bound.
58141
- //
58142
- // Only when bound: without `onSubmit` the client rejects NONE by design, and
58143
- // this flow has nothing to submit anyway.
58144
- var onSubmit = props.onSubmit;
58145
- var submission = mapSubmission(props);
58146
- var handOff = onSubmit ? function (artifacts) {
58147
- void client.submit(artifacts, _assign(_assign({}, submission), {
58148
- action: SubmissionAction.NONE
58149
- }))["catch"](function () {
58150
- // The failure already reached `onRequestFailure` through the
58151
- // client's own hook, which is where 2.x reported it too.
58152
- });
58153
- } : undefined;
58154
58474
  // No `children`: SignatureKYCFlow omits it from its props (it runs its own
58155
58475
  // stage machine rather than CompositeWizard), so passing it would not
58156
58476
  // compile — and 2.x rendered it nowhere either.
58157
58477
  return /*#__PURE__*/React.createElement(SignatureKYCFlow, _assign({
58158
58478
  client: client
58159
- }, mapSignatureKYCProps(props, ctx), {
58160
- onCaptured: handOff
58161
- }));
58479
+ }, mapSignatureKYCProps(props, ctx)));
58162
58480
  };
58163
58481
  /**
58164
58482
  * Render a fullscreen capture component that performs ID and face validation,