idmission-web-sdk 2.6.3-t3code-shared-flow-settings-07ab804 → 2.6.3-t3code-callback-homes-submit-handoff-9690b2d

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
  };
@@ -12289,12 +12401,17 @@
12289
12401
  * Binds one rendered SDK tree to its requested language. A fixed translator
12290
12402
  * avoids waiting for a post-render changeLanguage() effect and keeps SSR and
12291
12403
  * concurrently mounted SDK views independent of the shared detector instance.
12404
+ *
12405
+ * An unset `lang` keeps whatever scope encloses it (or none), so a caller can
12406
+ * render the provider unconditionally: toggling `lang` between unset and set
12407
+ * then never changes the element tree, and never remounts the subtree.
12292
12408
  */
12293
12409
  function SdkLanguageProvider(_ref) {
12294
12410
  var children = _ref.children,
12295
12411
  lang = _ref.lang;
12412
+ var inherited = React.useContext(SdkLanguageContext);
12296
12413
  return /*#__PURE__*/React.createElement(SdkLanguageContext.Provider, {
12297
- value: lang === 'auto' ? detectedLanguage : lang
12414
+ value: lang === undefined ? inherited : lang === 'auto' ? detectedLanguage : lang
12298
12415
  }, children);
12299
12416
  }
12300
12417
  /**
@@ -43968,7 +44085,9 @@
43968
44085
  onComplete = _ref.onComplete,
43969
44086
  onApproved = _ref.onApproved,
43970
44087
  onDenied = _ref.onDenied,
43971
- onRequestFailure = _ref.onRequestFailure;
44088
+ onSubmissionFailure = _ref.onSubmissionFailure,
44089
+ onRequestFailure = _ref.onRequestFailure,
44090
+ mode = _ref.mode;
43972
44091
  var progress = useCaptureObserver();
43973
44092
  var clientState = shimExports.useSyncExternalStore(client.subscribe, client.getState, client.getState);
43974
44093
  var _useAuthState = useAuthState(),
@@ -43981,10 +44100,15 @@
43981
44100
  _useState4 = _slicedToArray$1(_useState3, 2),
43982
44101
  localError = _useState4[0],
43983
44102
  setLocalError = _useState4[1];
43984
- var _useState5 = React.useState(false),
44103
+ var _useState5 = React.useState(IDLE_ATTEMPT),
43985
44104
  _useState6 = _slicedToArray$1(_useState5, 2),
43986
- resubmitting = _useState6[0],
43987
- 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];
43988
44112
  var lastArtifactsRef = React.useRef(null);
43989
44113
  var submitInFlightRef = React.useRef(null);
43990
44114
  var resubmitInFlightRef = React.useRef(null);
@@ -44002,6 +44126,65 @@
44002
44126
  }) : incoming;
44003
44127
  // Store the merged artifacts so a resubmit carries location too.
44004
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
+ }
44005
44188
  setSubmissionResponse(null);
44006
44189
  setLocalError(null);
44007
44190
  onSubmissionStarted == null || onSubmissionStarted(artifacts);
@@ -44022,7 +44205,7 @@
44022
44205
  })["catch"](function (cause) {
44023
44206
  var error = cause instanceof Error ? cause : new Error(String(cause));
44024
44207
  setLocalError(error);
44025
- onRequestFailure == null || onRequestFailure(error);
44208
+ reportFailure == null || reportFailure(error);
44026
44209
  throw error;
44027
44210
  })["finally"](function () {
44028
44211
  unbindProgress();
@@ -44031,7 +44214,7 @@
44031
44214
  });
44032
44215
  submitInFlightRef.current = promise;
44033
44216
  return promise;
44034
- }, [action, client, geolocation, onApproved, onComplete, onDenied, onRequestFailure, onSubmissionStarted, options, progress]);
44217
+ }, [action, client, geolocation, onApproved, onComplete, onDenied, reportFailure, onSubmissionStarted, options, progress, mode]);
44035
44218
  var resubmit = React.useMemo(function () {
44036
44219
  if (!authState.session.canRefreshSession) return null;
44037
44220
  return function () {
@@ -44076,22 +44259,121 @@
44076
44259
  }, [authState.session.canRefreshSession, client, submit]);
44077
44260
  var value = React.useMemo(function () {
44078
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
+ }
44079
44274
  return {
44080
44275
  action: action,
44081
44276
  submit: submit,
44082
- 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,
44083
44282
  submissionResponse: submissionResponse,
44084
44283
  submissionError: (_ref3 = localError != null ? localError : clientState.submissionError) != null ? _ref3 : null,
44085
44284
  lastSubmissionTimings: (_clientState$lastSubm = clientState.lastSubmissionTimings) != null ? _clientState$lastSubm : null,
44086
44285
  lastSubmissionRequest: (_clientState$lastSubm2 = clientState.lastSubmissionRequest) != null ? _clientState$lastSubm2 : null,
44087
44286
  resubmit: resubmit
44088
44287
  };
44089
- }, [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]);
44090
44289
  return jsx(SubmissionContext.Provider, {
44091
44290
  value: value,
44092
44291
  children: children
44093
44292
  });
44094
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
+ }
44095
44377
  function useSubmission() {
44096
44378
  var context = React.useContext(SubmissionContext);
44097
44379
  if (!context) {
@@ -46797,11 +47079,12 @@
46797
47079
  }
46798
47080
 
46799
47081
  var _templateObject$2, _templateObject2$2, _templateObject3$1, _templateObject4$1;
46800
- 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"];
46801
47083
  function FlowChassis(_ref) {
46802
47084
  var client = _ref.client,
46803
47085
  action = _ref.action,
46804
47086
  submission = _ref.submission,
47087
+ submitMode = _ref.submitMode,
46805
47088
  _ref$theme = _ref.theme,
46806
47089
  theme = _ref$theme === void 0 ? 'default' : _ref$theme,
46807
47090
  className = _ref.className,
@@ -46824,7 +47107,7 @@
46824
47107
  client: client,
46825
47108
  children: [jsx(RemoteDiagnosticsMount, {
46826
47109
  remoteDiagnostics: remoteDiagnostics
46827
- }), jsx(FlowLanguage, {
47110
+ }), jsx(SdkLanguageProvider, {
46828
47111
  lang: lang,
46829
47112
  children: jsx(ThemeProvider, {
46830
47113
  theme: theme,
@@ -46834,6 +47117,7 @@
46834
47117
  client: client,
46835
47118
  action: action,
46836
47119
  options: submission,
47120
+ mode: submitMode,
46837
47121
  geolocation: geolocation.position
46838
47122
  }, callbacks, {
46839
47123
  children: jsx(FlowPage, {
@@ -46852,17 +47136,8 @@
46852
47136
  })
46853
47137
  });
46854
47138
  }
46855
- /** Scopes the flow's own screens to `lang`; a no-op when the flow sets none. */
46856
- function FlowLanguage(_ref2) {
46857
- var lang = _ref2.lang,
46858
- children = _ref2.children;
46859
- return lang === undefined ? children : jsx(SdkLanguageProvider, {
46860
- lang: lang,
46861
- children: children
46862
- });
46863
- }
46864
- function AuthGate(_ref3) {
46865
- var children = _ref3.children;
47139
+ function AuthGate(_ref2) {
47140
+ var children = _ref2.children;
46866
47141
  var _useAuthState = useAuthState(),
46867
47142
  state = _useAuthState.state,
46868
47143
  retry = _useAuthState.retry;
@@ -46913,10 +47188,10 @@
46913
47188
  * enrollment-ID banner sits outside that body, so stages and their in-body
46914
47189
  * overlays lay out below it instead of over it.
46915
47190
  */
46916
- function FlowPage(_ref4) {
46917
- var className = _ref4.className,
46918
- enrollmentId = _ref4.enrollmentId,
46919
- children = _ref4.children;
47191
+ function FlowPage(_ref3) {
47192
+ var className = _ref3.className,
47193
+ enrollmentId = _ref3.enrollmentId,
47194
+ children = _ref3.children;
46920
47195
  var _useTheme = useTheme(),
46921
47196
  Header = _useTheme.header,
46922
47197
  Footer = _useTheme.footer;
@@ -47026,8 +47301,8 @@
47026
47301
  */
47027
47302
  function inheritFlowSettings(step, flow) {
47028
47303
  var inherited = {};
47029
- for (var _i = 0, _Object$keys = Object.keys(flow); _i < _Object$keys.length; _i++) {
47030
- var key = _Object$keys[_i];
47304
+ for (var key in flow) {
47305
+ if (!Object.prototype.hasOwnProperty.call(flow, key)) continue;
47031
47306
  if ((step == null ? void 0 : step[key]) === undefined && flow[key] !== undefined) {
47032
47307
  inherited[key] = flow[key];
47033
47308
  }
@@ -47163,7 +47438,7 @@
47163
47438
  return base;
47164
47439
  }
47165
47440
 
47166
- 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"];
47167
47442
  var EMPTY_ID_CAPTURE$3 = {};
47168
47443
  var EMPTY_SIGNATURE_CAPTURE$5 = {};
47169
47444
  var EMPTY_ID_VIEW$3 = {};
@@ -47180,8 +47455,8 @@
47180
47455
  submission = _ref$submission === void 0 ? EMPTY_SUBMISSION$6 : _ref$submission,
47181
47456
  _ref$initialArtifacts = _ref.initialArtifacts,
47182
47457
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$9 : _ref$initialArtifacts,
47183
- _ref$captureOnly = _ref.captureOnly,
47184
- captureOnly = _ref$captureOnly === void 0 ? false : _ref$captureOnly,
47458
+ submitMode = _ref.submitMode,
47459
+ captureOnly = _ref.captureOnly,
47185
47460
  signatureController = _ref.signatureController,
47186
47461
  _ref$signatureCapture = _ref.signatureCapture,
47187
47462
  signatureCapture = _ref$signatureCapture === void 0 ? EMPTY_SIGNATURE_CAPTURE$5 : _ref$signatureCapture,
@@ -47340,10 +47615,12 @@
47340
47615
  successIssuerCaptionText: 'confirmed'
47341
47616
  }
47342
47617
  });
47618
+ var mode = submitMode != null ? submitMode : captureOnly ? 'capture' : undefined;
47343
47619
  return jsxs(FlowChassis, _extends$1({
47344
47620
  client: client,
47345
47621
  action: SubmissionAction.VALIDATE,
47346
47622
  submission: submission,
47623
+ submitMode: mode,
47347
47624
  theme: theme,
47348
47625
  className: className,
47349
47626
  lang: lang
@@ -47351,7 +47628,7 @@
47351
47628
  children: [jsx(CompositeWizard, _extends$1({}, ringScreens, {
47352
47629
  steps: steps,
47353
47630
  initialArtifacts: initialArtifacts,
47354
- captureOnly: captureOnly,
47631
+ captureOnly: mode === 'capture',
47355
47632
  showResultScreen: showResultScreen != null ? showResultScreen : showSuccessScreen,
47356
47633
  showDiagnostics: showDiagnostics,
47357
47634
  onArtifactsCollected: onCaptured,
@@ -47811,6 +48088,10 @@
47811
48088
  captureProgress = _ref.captureProgress,
47812
48089
  remoteDiagnostics = _ref.remoteDiagnostics,
47813
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,
47814
48095
  onCaptured = _ref.onCaptured,
47815
48096
  onCaptureError = _ref.onCaptureError;
47816
48097
  // Flow-wide settings reach each step unless its own bag sets them.
@@ -48011,8 +48292,8 @@
48011
48292
  completedRef.current = true;
48012
48293
  artifactsRef.current = mergeSubmissionArtifacts(artifactsRef.current, artifacts);
48013
48294
  setStage('complete');
48014
- onCaptured == null || onCaptured(artifactsRef.current);
48015
- }, [onCaptured]);
48295
+ if (submitMode === 'capture') onCaptured == null || onCaptured(artifactsRef.current);
48296
+ }, [onCaptured, submitMode]);
48016
48297
  var handleLivenessFailureExit = React.useCallback(function () {
48017
48298
  onExitAfterLivenessFailure == null || onExitAfterLivenessFailure();
48018
48299
  if (allowSignatureAfterLivenessCheckFailure) handleLivenessDone();
@@ -48021,6 +48302,9 @@
48021
48302
  client: client,
48022
48303
  action: SubmissionAction.NONE,
48023
48304
  submission: submission,
48305
+ submitMode: submitMode,
48306
+ onSubmissionStarted: onSubmissionStarted,
48307
+ onSubmissionFailure: onSubmissionFailure,
48024
48308
  theme: theme,
48025
48309
  className: className,
48026
48310
  lang: lang,
@@ -48030,8 +48314,10 @@
48030
48314
  remoteDiagnostics: remoteDiagnostics,
48031
48315
  loadingSpinner: loadingSpinner,
48032
48316
  children: [jsx(CaptureProgressCompletion, {
48033
- completed: stage === 'complete'
48034
- }), 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, {
48035
48321
  children: [jsx(SignatureCaptureView, _extends$1({}, signatureView, {
48036
48322
  skipSuccessScreen: impliedSkipSuccessScreen(signatureView.skipSuccessScreen, isRingIntroActive(faceView)),
48037
48323
  controller: resolvedSignatureController,
@@ -48081,6 +48367,44 @@
48081
48367
  }) : null]
48082
48368
  });
48083
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
+ }
48084
48408
  /**
48085
48409
  * Black, so iOS Safari's bars read as letterboxing around the camera feed
48086
48410
  * rather than as one more colour a theme has to choose.
@@ -48098,10 +48422,10 @@
48098
48422
  * no flat strip can sit on its bottom edge unseen: that one is drawn invisibly,
48099
48423
  * as on ID capture's overlay. Opaque, it covered the bottom 12px of the bar.
48100
48424
  */
48101
- function FlowEdgeTint(_ref3) {
48425
+ function FlowEdgeTint(_ref4) {
48102
48426
  var _theme$selfieCapture$, _theme$selfieCapture, _theme$background;
48103
- var surface = _ref3.surface,
48104
- modelsReady = _ref3.modelsReady;
48427
+ var surface = _ref4.surface,
48428
+ modelsReady = _ref4.modelsReady;
48105
48429
  var theme = useTheme();
48106
48430
  if (theme.isFullscreen === false || surface === null) return null;
48107
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');
@@ -48111,9 +48435,9 @@
48111
48435
  hiddenBottomColor: surface === 'overlay' ? selfieLoadingOverlayBottomEdgeColor(theme, modelsReady) : undefined
48112
48436
  });
48113
48437
  }
48114
- function SelfieTrackerAttachment(_ref4) {
48115
- var controller = _ref4.controller,
48116
- video = _ref4.video;
48438
+ function SelfieTrackerAttachment(_ref5) {
48439
+ var controller = _ref5.controller,
48440
+ video = _ref5.video;
48117
48441
  React.useEffect(function () {
48118
48442
  if (!video) return;
48119
48443
  void controller.attach(video)["catch"](function () {
@@ -48131,7 +48455,7 @@
48131
48455
  return props.$visible ? 'block' : 'none';
48132
48456
  });
48133
48457
 
48134
- 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"],
48135
48459
  _excluded2$2 = ["checkLivenessOptions"];
48136
48460
  var EMPTY_ID_CAPTURE$1 = {};
48137
48461
  var EMPTY_FACE_CAPTURE$2 = {};
@@ -48164,8 +48488,8 @@
48164
48488
  submission = _ref$submission === void 0 ? EMPTY_SUBMISSION$2 : _ref$submission,
48165
48489
  _ref$initialArtifacts = _ref.initialArtifacts,
48166
48490
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$5 : _ref$initialArtifacts,
48167
- _ref$captureOnly = _ref.captureOnly,
48168
- captureOnly = _ref$captureOnly === void 0 ? false : _ref$captureOnly,
48491
+ submitMode = _ref.submitMode,
48492
+ captureOnly = _ref.captureOnly,
48169
48493
  signatureController = _ref.signatureController,
48170
48494
  _ref$signatureCapture = _ref.signatureCapture,
48171
48495
  signatureCapture = _ref$signatureCapture === void 0 ? EMPTY_SIGNATURE_CAPTURE$2 : _ref$signatureCapture,
@@ -48383,10 +48707,12 @@
48383
48707
  successIssuerCaptionText: 'confirmed'
48384
48708
  }
48385
48709
  });
48710
+ var mode = submitMode != null ? submitMode : captureOnly ? 'capture' : undefined;
48386
48711
  return jsxs(FlowChassis, _extends$1({
48387
48712
  client: client,
48388
48713
  action: action,
48389
48714
  submission: submission,
48715
+ submitMode: mode,
48390
48716
  theme: theme,
48391
48717
  className: className,
48392
48718
  lang: lang
@@ -48394,7 +48720,7 @@
48394
48720
  children: [jsx(CompositeWizard, _extends$1({}, ringScreens, {
48395
48721
  steps: steps,
48396
48722
  initialArtifacts: initialArtifacts,
48397
- captureOnly: captureOnly,
48723
+ captureOnly: mode === 'capture',
48398
48724
  showResultScreen: showResultScreen != null ? showResultScreen : showSuccessScreen,
48399
48725
  showDiagnostics: showDiagnostics,
48400
48726
  onArtifactsCollected: onCaptured,
@@ -52605,7 +52931,9 @@
52605
52931
  onComplete = _ref.onComplete,
52606
52932
  onCustomerMatched = _ref.onCustomerMatched,
52607
52933
  onCustomerNotMatched = _ref.onCustomerNotMatched,
52934
+ onSubmissionFailure = _ref.onSubmissionFailure,
52608
52935
  onRequestFailure = _ref.onRequestFailure,
52936
+ submitMode = _ref.submitMode,
52609
52937
  onCaptureGuidanceTimeout = _ref.onCaptureGuidanceTimeout,
52610
52938
  onExitCapture = _ref.onExitCapture,
52611
52939
  onExitAfterFailure = _ref.onExitAfterFailure;
@@ -52692,15 +53020,19 @@
52692
53020
  setOutcome('notMatched');
52693
53021
  onCustomerNotMatched == null || onCustomerNotMatched(response);
52694
53022
  }, [onCustomerNotMatched]);
53023
+ var reportFailure = onSubmissionFailure != null ? onSubmissionFailure : onRequestFailure;
52695
53024
  var handleLivenessCheckFailed = React.useCallback(function (error) {
52696
53025
  setOutcome('failed');
52697
- onRequestFailure == null || onRequestFailure(error);
52698
- }, [onRequestFailure]);
53026
+ reportFailure == null || reportFailure(error);
53027
+ }, [reportFailure]);
52699
53028
  var handleRequestError = React.useCallback(function (error) {
52700
53029
  errorRef.current = error;
52701
53030
  setOutcome('error');
52702
- onRequestFailure == null || onRequestFailure(error);
52703
- }, [onRequestFailure]);
53031
+ reportFailure == null || reportFailure(error);
53032
+ }, [reportFailure]);
53033
+ var handleHandedOff = React.useCallback(function () {
53034
+ return setOutcome('handedOff');
53035
+ }, []);
52704
53036
  var handleCaptureGuidanceTimeout = React.useCallback(function () {
52705
53037
  setOutcome('failed');
52706
53038
  onCaptureGuidanceTimeout == null || onCaptureGuidanceTimeout();
@@ -52741,6 +53073,7 @@
52741
53073
  client: client,
52742
53074
  action: action,
52743
53075
  submission: submission,
53076
+ submitMode: submitMode,
52744
53077
  theme: theme,
52745
53078
  className: className,
52746
53079
  lang: lang,
@@ -52765,6 +53098,7 @@
52765
53098
  onNotMatched: handleNotMatched,
52766
53099
  onLivenessCheckFailed: handleLivenessCheckFailed,
52767
53100
  onRequestError: handleRequestError,
53101
+ onSubmissionIntercepted: handleHandedOff,
52768
53102
  onCaptureGuidanceTimeout: handleCaptureGuidanceTimeout,
52769
53103
  onExitCapture: onExitCapture,
52770
53104
  finishingScreen: {
@@ -52900,6 +53234,84 @@
52900
53234
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
52901
53235
  };
52902
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
+
52903
53315
  /**
52904
53316
  * sdk2 exports this as a mutable `string[]`
52905
53317
  * (contexts/AuthStateContext.tsx:25), not a readonly tuple — copied rather
@@ -53072,12 +53484,9 @@
53072
53484
  documentServiceUrl: (_b = props.documentServiceUrl) !== null && _b !== void 0 ? _b : apiBase ? apiBase + '/files/' : override === null || override === void 0 ? void 0 : override.documentServiceUrl,
53073
53485
  onBeforeSubmit: props.onBeforeSubmit,
53074
53486
  onBeforeLivenessCheck: props.onBeforeLivenessCheck,
53075
- // Straight through to the client, which is where sdk2 put it too
53076
- // (SubmissionProvider.submit). That is what makes the SUPPRESSION uniform:
53077
- // every flow — including the two match flows, which own their own stage
53078
- // machine — submits through this one client, so none of them can post
53079
- // behind an integrator who supplied `onSubmit`.
53080
- 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.
53081
53490
  onBeforeDocumentUpload: props.onBeforeDocumentUpload,
53082
53491
  onDocumentUploadProgress: props.onDocumentUploadProgress,
53083
53492
  onDocumentUploaded: props.onDocumentUploaded,
@@ -54087,84 +54496,6 @@
54087
54496
  };
54088
54497
  }
54089
54498
 
54090
- function createIdAndFaceValidationJourneyEvent(event, now) {
54091
- if (now === void 0) {
54092
- now = function now() {
54093
- return new Date();
54094
- };
54095
- }
54096
- return _assign(_assign({}, event), {
54097
- version: 1,
54098
- flow: 'id-and-face-validation',
54099
- timestamp: now().toISOString()
54100
- });
54101
- }
54102
- /**
54103
- * websdk-ui `CompositeWizardStep.id` -> journey stage.
54104
- *
54105
- * Four of the five stage names ARE step ids already; only the additional-
54106
- * documents step differs, because sdk2's stage vocabulary says
54107
- * `additional-document-capture` (singular "document") while websdk-ui's step
54108
- * is `additional-documents`. Unknown ids return undefined so a step this
54109
- * vocabulary has no name for is silently skipped rather than emitted with a
54110
- * bogus stage — the same shape as sdk2's partial lookup record.
54111
- */
54112
- function journeyStageForStepId(stepId) {
54113
- switch (stepId) {
54114
- case 'id-capture':
54115
- case 'face-liveness':
54116
- case 'signature-capture':
54117
- case 'video-signature-capture':
54118
- return stepId;
54119
- case 'additional-documents':
54120
- return 'additional-document-capture';
54121
- default:
54122
- return undefined;
54123
- }
54124
- }
54125
- /**
54126
- * The document types sdk2 reports as `document.captured`. sdk2 filters the
54127
- * wizard's `onDocumentStored` through this set (`primaryIdDocumentTypes`) so
54128
- * that a document type outside the journey vocabulary cannot widen the event.
54129
- * Kept as a predicate rather than a Set: the ES5 UMD bundle target makes
54130
- * `for..of` over a Set a downlevel hazard, and a switch needs no iteration.
54131
- */
54132
- function isJourneyDocumentType(documentType) {
54133
- return documentType === 'idCardFront' || documentType === 'idCardBack' || documentType === 'passport' || documentType === 'singlePage';
54134
- }
54135
- /**
54136
- * The lazy `flow.started` rule, lifted out of sdk2's `emitJourneyEvent`
54137
- * closure (IdAndFaceValidation.tsx:521-537) so it can be tested without a
54138
- * React tree.
54139
- *
54140
- * sdk2 does NOT simply emit `flow.started` from a mount effect: it emits it
54141
- * before the FIRST event of any kind, whatever that event is, and then
54142
- * suppresses the explicit mount emit. The mount effect and the lazy guard
54143
- * together mean `flow.started` is always the first event a customer sees,
54144
- * even if some other event races the effect. That ordering guarantee is the
54145
- * contract, not the effect.
54146
- */
54147
- function createJourneyEmitter(callback, now) {
54148
- var flowStartedEmitted = false;
54149
- return function emit(event) {
54150
- if (!callback) return;
54151
- if (!flowStartedEmitted) {
54152
- flowStartedEmitted = true;
54153
- emitWith(callback, {
54154
- name: 'flow.started'
54155
- }, now);
54156
- }
54157
- if (event.name !== 'flow.started') emitWith(callback, event, now);
54158
- };
54159
- }
54160
- function emitWith(callback, event, now) {
54161
- try {
54162
- callback(createIdAndFaceValidationJourneyEvent(event, now));
54163
- } catch (error) {
54164
- warn$2('[IdAndFaceValidation] onJourneyEvent callback failed', error);
54165
- }
54166
- }
54167
-
54168
54499
  /**
54169
54500
  * Recursively drops keys whose value is exactly `undefined`.
54170
54501
  *
@@ -54347,6 +54678,16 @@
54347
54678
  return mergeThemes(mapped, overrides);
54348
54679
  }
54349
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
+ }
54350
54691
  var EMPTY_CONTEXT = {};
54351
54692
  /** Adapts a 3.0 `(response)` callback back to 2.x's `(response, request)`. */
54352
54693
  function withSubmissionRequest(callback, ctx) {
@@ -54438,13 +54779,13 @@
54438
54779
  }
54439
54780
  // --- 1. IdValidation ------------------------------------------------------
54440
54781
  function mapIdValidationProps(props, ctx) {
54441
- var _a;
54782
+ var _a, _b;
54442
54783
  if (ctx === void 0) {
54443
54784
  ctx = EMPTY_CONTEXT;
54444
54785
  }
54445
- var _b = mapIdCapture(props),
54446
- capture = _b.capture,
54447
- view = _b.view;
54786
+ var _c = mapIdCapture(props),
54787
+ capture = _c.capture,
54788
+ view = _c.view;
54448
54789
  return compact({
54449
54790
  capture: capture,
54450
54791
  view: view,
@@ -54470,9 +54811,8 @@
54470
54811
  // `onSubmit` WINS over capture-only, matching sdk2's ordering: its
54471
54812
  // `submit()` checks `onSubmit` before the `action === NONE` branch
54472
54813
  // (SubmissionProvider.tsx:1374 vs :1237), so a capture-only flow still
54473
- // owes the callback its built request. Letting the flow run its normal
54474
- // submit path is what builds that request; the client suppresses the POST.
54475
- 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,
54476
54816
  captureAdditionalDocuments: props.captureAdditionalDocuments,
54477
54817
  geolocationEnabled: props.geolocationEnabled,
54478
54818
  geolocationRequired: props.geolocationRequired,
@@ -54493,13 +54833,10 @@
54493
54833
  // would be a NEW restriction, not parity.
54494
54834
  showResultScreen: props.debugMode,
54495
54835
  showDiagnostics: props.debugMode,
54496
- // `onSubmit` is NOT mapped to a flow prop: it goes to the client config
54497
- // (see mapClientConfig), which is the layer sdk2 put it at and the only
54498
- // one that can suppress the POST for every flow at once.
54499
54836
  onComplete: withSubmissionRequest(props.onComplete, ctx),
54500
54837
  onApproved: withSubmissionRequest(props.onApproved, ctx),
54501
54838
  onDenied: withSubmissionRequest(props.onDenied, ctx),
54502
- onRequestFailure: props.onRequestFailure
54839
+ onSubmissionFailure: props.onRequestFailure
54503
54840
  });
54504
54841
  }
54505
54842
  // --- 2. FaceValidation ----------------------------------------------------
@@ -54691,7 +55028,8 @@
54691
55028
  onComplete: withSubmissionRequest(props.onComplete, ctx),
54692
55029
  onApproved: withSubmissionRequest(props.onApproved, ctx),
54693
55030
  onDenied: withSubmissionRequest(props.onDenied, ctx),
54694
- onRequestFailure: props.onRequestFailure,
55031
+ submitMode: mapHandoff(props.onSubmit),
55032
+ onSubmissionFailure: props.onRequestFailure,
54695
55033
  onCaptureError: props.onRequestFailure
54696
55034
  });
54697
55035
  }
@@ -54846,10 +55184,11 @@
54846
55184
  captureProgress: props.captureProgress,
54847
55185
  remoteDiagnostics: props.remoteDiagnostics,
54848
55186
  loadingSpinner: props.loadingSpinner,
54849
- // `onCaptured` is supplied by the COMPONENT, not here: this flow never
54850
- // enters `client.submit()` on its own, so the façade makes that call from
54851
- // `onCaptured` to produce the same built request 2.x hands over. See
54852
- // 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),
54853
55192
  onCaptureError: props.onRequestFailure
54854
55193
  });
54855
55194
  }
@@ -54875,7 +55214,7 @@
54875
55214
  return map(nested);
54876
55215
  }
54877
55216
  function mapVideoIdValidationProps(props, ctx) {
54878
- var _a, _b, _c;
55217
+ var _a, _b, _c, _d;
54879
55218
  if (ctx === void 0) {
54880
55219
  ctx = EMPTY_CONTEXT;
54881
55220
  }
@@ -54968,7 +55307,11 @@
54968
55307
  showResultScreen: props.debugMode,
54969
55308
  showDiagnostics: props.debugMode,
54970
55309
  onComplete: withSubmissionRequest(props.onComplete, ctx),
54971
- 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,
54972
55315
  onCaptureError: props.onRequestFailure
54973
55316
  });
54974
55317
  }
@@ -55133,7 +55476,8 @@
55133
55476
  onComplete: withSubmissionRequest(props.onComplete, ctx),
55134
55477
  onCustomerMatched: withSubmissionRequest(props.onCustomerMatched, ctx),
55135
55478
  onCustomerNotMatched: withSubmissionRequest(props.onCustomerNotMatched, ctx),
55136
- onRequestFailure: props.onRequestFailure,
55479
+ submitMode: mapHandoff(props.onSubmit),
55480
+ onSubmissionFailure: props.onRequestFailure,
55137
55481
  onExitCapture: props.onExitCapture,
55138
55482
  onExitAfterFailure: props.onExitAfterFailure
55139
55483
  });
@@ -55202,7 +55546,8 @@
55202
55546
  // sdk2's enrollment twin of `onApproved`.
55203
55547
  onApproved: withSubmissionRequest(props.onEnrolled, ctx),
55204
55548
  onDenied: withSubmissionRequest(props.onDenied, ctx),
55205
- onRequestFailure: props.onRequestFailure,
55549
+ submitMode: mapHandoff(props.onSubmit),
55550
+ onSubmissionFailure: props.onRequestFailure,
55206
55551
  onCaptureError: props.onRequestFailure
55207
55552
  });
55208
55553
  }
@@ -55294,12 +55639,13 @@
55294
55639
  onComplete: withSubmissionRequest(props.onComplete, ctx),
55295
55640
  onApproved: withSubmissionRequest(props.onEnrolled, ctx),
55296
55641
  onDenied: withSubmissionRequest(props.onDenied, ctx),
55297
- onRequestFailure: props.onRequestFailure,
55642
+ submitMode: mapHandoff(props.onSubmit),
55643
+ onSubmissionFailure: props.onRequestFailure,
55298
55644
  onCaptureError: props.onRequestFailure
55299
55645
  });
55300
55646
  }
55301
55647
 
55302
- var webSdkVersion = '2.6.3-t3code-shared-flow-settings-07ab804';
55648
+ var webSdkVersion = '2.6.3-t3code-callback-homes-submit-handoff-9690b2d';
55303
55649
 
55304
55650
  // GENERATED by scripts/styleBagTypes.mjs from
55305
55651
  // src/__fixtures__/sdk2StyleBags.json and the mapper sweep — do not
@@ -57356,23 +57702,17 @@
57356
57702
  var SUBMIT_CALLBACKS = {
57357
57703
  onBeforeSubmit: MAPPED,
57358
57704
  /**
57359
- * Mapped to the CLIENT's `onSubmit`, not to a flow prop — the layer sdk2 put
57360
- * it at (SubmissionProvider.submit). The client builds the request, hands it
57361
- * over, and does NOT post, so `onComplete`/`onApproved`/`onDenied` never
57362
- * fire, exactly as 2.x documents. Every flow submits through that one
57363
- * client, including the two match flows with their own stage machine, so the
57364
- * 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.
57365
57710
  *
57366
57711
  * What the flow SHOWS afterwards is a 3.0 call rather than a 2.x
57367
57712
  * reproduction: every family now ends quietly, because the integrator owns
57368
57713
  * the outcome once they have the request. 2.x's match flows showed a failure
57369
57714
  * screen there, but only because their `submit()` could not distinguish an
57370
57715
  * intercepted submission from a broken one.
57371
- *
57372
- * `SignatureKYC` reaches the same place by a different route: its 3.0
57373
- * counterpart never enters `client.submit()`, so the façade component makes
57374
- * that call itself from `onCaptured`. `action: NONE` is accepted there
57375
- * precisely because `onSubmit` is bound.
57376
57716
  */
57377
57717
  onSubmit: MAPPED,
57378
57718
  onComplete: MAPPED,
@@ -57470,7 +57810,7 @@
57470
57810
  // `SubmissionAction.NONE` and wires `onComplete` to the provider's
57471
57811
  // `onResponseReceived` (SignatureKYC.tsx:434,449), which never fires because
57472
57812
  // nothing is ever posted. `onSubmit` is the real completion seam and IS
57473
- // mapped, to the flow's `onCaptured`.
57813
+ // mapped, to the flow's `submitMode: { handoff }`.
57474
57814
  onComplete: NOOP,
57475
57815
  onSubmit: MAPPED,
57476
57816
  onRequestFailure: MAPPED,
@@ -57961,10 +58301,6 @@
57961
58301
  _lastLivenessRequest.current = request;
57962
58302
  return propsRef.current.onBeforeLivenessCheck ? propsRef.current.onBeforeLivenessCheck(request) : Promise.resolve(request);
57963
58303
  },
57964
- onSubmit: propsRef.current.onSubmit ? function (request) {
57965
- var _a, _b;
57966
- return (_b = (_a = propsRef.current).onSubmit) === null || _b === void 0 ? void 0 : _b.call(_a, request);
57967
- } : undefined,
57968
58304
  onResponseReceived: function onResponseReceived(_response, request) {
57969
58305
  _lastSubmissionRequest.current = request;
57970
58306
  },
@@ -58135,34 +58471,12 @@
58135
58471
  client = _a.client,
58136
58472
  ctx = _a.ctx;
58137
58473
  useDroppedPropReport('SignatureKYC', props);
58138
- // The one flow whose 3.0 counterpart never enters `client.submit()`: it runs
58139
- // its own stage machine and reports completion through `onCaptured` instead.
58140
- // 2.x DOES submit here — its CompositeWizard calls `submit()`, which hands
58141
- // the built request to `onSubmit` before reaching the capture-only branch —
58142
- // so the façade makes that call itself to produce the same request. The
58143
- // client suppresses the POST, and `action: NONE` is accepted precisely
58144
- // because `onSubmit` is bound.
58145
- //
58146
- // Only when bound: without `onSubmit` the client rejects NONE by design, and
58147
- // this flow has nothing to submit anyway.
58148
- var onSubmit = props.onSubmit;
58149
- var submission = mapSubmission(props);
58150
- var handOff = onSubmit ? function (artifacts) {
58151
- void client.submit(artifacts, _assign(_assign({}, submission), {
58152
- action: SubmissionAction.NONE
58153
- }))["catch"](function () {
58154
- // The failure already reached `onRequestFailure` through the
58155
- // client's own hook, which is where 2.x reported it too.
58156
- });
58157
- } : undefined;
58158
58474
  // No `children`: SignatureKYCFlow omits it from its props (it runs its own
58159
58475
  // stage machine rather than CompositeWizard), so passing it would not
58160
58476
  // compile — and 2.x rendered it nowhere either.
58161
58477
  return /*#__PURE__*/React.createElement(SignatureKYCFlow, _assign({
58162
58478
  client: client
58163
- }, mapSignatureKYCProps(props, ctx), {
58164
- onCaptured: handOff
58165
- }));
58479
+ }, mapSignatureKYCProps(props, ctx)));
58166
58480
  };
58167
58481
  /**
58168
58482
  * Render a fullscreen capture component that performs ID and face validation,