idmission-web-sdk 2.6.3-t3code-shared-flow-settings-e5702c2 → 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.
@@ -4869,6 +4869,22 @@ function withJobTaskMetadata(metadata, jobID, taskID) {
4869
4869
  if (taskID) merged.taskid = taskID;
4870
4870
  return merged;
4871
4871
  }
4872
+ /**
4873
+ * Runs a customer callback whose failure must not change an outcome that is
4874
+ * already settled: a throw or a rejected promise is logged, never rethrown.
4875
+ */
4876
+ function notifySafely$1(name, notify) {
4877
+ try {
4878
+ var result = notify();
4879
+ if (result instanceof Promise) {
4880
+ result["catch"](function (e) {
4881
+ return warn$1(name + " rejected", e);
4882
+ });
4883
+ }
4884
+ } catch (e) {
4885
+ warn$1(name + " threw", e);
4886
+ }
4887
+ }
4872
4888
  /**
4873
4889
  * How long an async `sessionId` resolver may take. It typically mints the
4874
4890
  * session through the host's own backend (an OAuth token, then
@@ -4891,6 +4907,10 @@ function resolveSessionIdWithTimeout(resolve) {
4891
4907
  return clearTimeout(timer);
4892
4908
  });
4893
4909
  }
4910
+ /**
4911
+ * Creates a client. Its type is `Required<IdmissionClient>`: unlike a
4912
+ * hand-written `IdmissionClient`, it always has `post()` and `handoff()`.
4913
+ */
4894
4914
  function createIdmissionClient(config) {
4895
4915
  var _config$fetch, _config$now;
4896
4916
  // `let`: when config.sessionId is an async resolver, the session URN (and
@@ -4977,10 +4997,33 @@ function createIdmissionClient(config) {
4977
4997
  }));
4978
4998
  return _timedFetch.apply(this, arguments);
4979
4999
  }
4980
- function performUpload(blob, metadata) {
4981
- return uploadDocument(blob, metadata, {
4982
- documentServiceUrl: urls.documentServiceUrl,
5000
+ function currentRoute() {
5001
+ return {
4983
5002
  sessionId: store.getState().session.sessionId,
5003
+ submissionUrl: urls.submissionUrl,
5004
+ documentServiceUrl: urls.documentServiceUrl,
5005
+ sessionNonce: getLastSessionNonce()
5006
+ };
5007
+ }
5008
+ // The attestation holders are module-level and follow the newest
5009
+ // ValidateSession. If that is no longer this operation's session, its nonce
5010
+ // and OS token belong to someone else: omit the envelope (throwing here is
5011
+ // attachMetadataToRequest's fail-open path, which reports
5012
+ // `attestationAttached: false`) rather than attach a stranger's.
5013
+ function routeBoundCollectors(route) {
5014
+ return {
5015
+ collectAttestation: function collectAttestation(web, versions) {
5016
+ if (getLastSessionNonce() !== route.sessionNonce) {
5017
+ throw new Error('session changed during submission; attestation omitted');
5018
+ }
5019
+ return collectClientAttestation(web, versions);
5020
+ }
5021
+ };
5022
+ }
5023
+ function performUpload(blob, metadata, route) {
5024
+ return uploadDocument(blob, metadata, {
5025
+ documentServiceUrl: route.documentServiceUrl,
5026
+ sessionId: route.sessionId,
4984
5027
  Upload: config.tusUpload,
4985
5028
  delay: config.delay,
4986
5029
  calculateMd5: config.calculateMd5,
@@ -5204,23 +5247,28 @@ function createIdmissionClient(config) {
5204
5247
  }));
5205
5248
  return _retrySession.apply(this, arguments);
5206
5249
  }
5207
- function submit(_x6, _x7) {
5208
- return _submit.apply(this, arguments);
5250
+ function runPipeline(_x6, _x7, _x8) {
5251
+ return _runPipeline.apply(this, arguments);
5209
5252
  }
5210
- function _submit() {
5211
- _submit = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(artifacts, options) {
5212
- var _options$onBeforeSubm;
5213
- 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;
5253
+ function _runPipeline() {
5254
+ _runPipeline = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(artifacts, options, kind) {
5255
+ var _artifacts$meta$liven, _artifacts$meta, _options$onBeforeSubm;
5256
+ 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;
5214
5257
  return _regeneratorRuntime.wrap(function (_context7) {
5215
5258
  while (1) switch (_context7.prev = _context7.next) {
5216
5259
  case 0:
5217
- if (!(options.action === SubmissionAction.NONE && !config.onSubmit)) {
5260
+ handsOff = kind === 'handoff' || kind === 'submit' && config.onSubmit !== undefined; // sdk2 short-circuits action NONE to a synthetic success before any
5261
+ // network activity (SubmissionProvider.tsx:1203-1225). This client does
5262
+ // not fabricate that response, but it keeps the "NONE does no network
5263
+ // work" guarantee by rejecting here, before any upload — unless the
5264
+ // request is being handed off, which is the one thing NONE can do.
5265
+ if (!(options.action === SubmissionAction.NONE && !handsOff)) {
5218
5266
  _context7.next = 1;
5219
5267
  break;
5220
5268
  }
5221
5269
  throw new SubmissionError({
5222
5270
  statusCode: 'UNSUPPORTED_ACTION',
5223
- statusMessage: "submit() rejects action: 'NONE' -- capture-only, no-network submission is the controller layer's responsibility (plan 3), not this client's"
5271
+ statusMessage: "action 'NONE' has no endpoint to post to; use handoff() to build the request without posting it"
5224
5272
  });
5225
5273
  case 1:
5226
5274
  if (!(store.getState().session.sessionCheckState !== 'PASSED')) {
@@ -5229,6 +5277,11 @@ function createIdmissionClient(config) {
5229
5277
  }
5230
5278
  throw new AuthenticationError(401, 'session not validated');
5231
5279
  case 2:
5280
+ route = currentRoute(); // Claimed, not read: an overlapping operation must not reuse it, and a
5281
+ // `checkLiveness()` that lands mid-operation keeps its own token for the
5282
+ // next one (SubmissionProvider.tsx:1350 cleared it after the submit).
5283
+ claimedLivenessToken = (_artifacts$meta$liven = (_artifacts$meta = artifacts.meta) == null ? void 0 : _artifacts$meta.livenessToken) != null ? _artifacts$meta$liven : livenessToken;
5284
+ livenessToken = undefined;
5232
5285
  store.setState({
5233
5286
  submissionStatus: SubmissionStatus.SUBMITTING,
5234
5287
  submissionError: undefined
@@ -5245,7 +5298,7 @@ function createIdmissionClient(config) {
5245
5298
  _context7.next = 5;
5246
5299
  return buildSubmissionPayload(_extends({}, artifacts, {
5247
5300
  meta: _extends({}, artifacts.meta, {
5248
- livenessToken: (_artifacts$meta$liven = (_artifacts$meta = artifacts.meta) == null ? void 0 : _artifacts$meta.livenessToken) != null ? _artifacts$meta$liven : livenessToken
5301
+ livenessToken: claimedLivenessToken
5249
5302
  })
5250
5303
  }), _extends({}, options, {
5251
5304
  onBeforeSubmit: beforeSubmit ? function (request) {
@@ -5261,7 +5314,7 @@ function createIdmissionClient(config) {
5261
5314
  // withJobTaskMetadata (see its own comment above): only present
5262
5315
  // when options.jobID/taskID are present.
5263
5316
  uploadDocument: documentServiceEnabled ? (/*#__PURE__*/function () {
5264
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(blob, metadata) {
5317
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(blob, metadata) {
5265
5318
  var result, _t3;
5266
5319
  return _regeneratorRuntime.wrap(function (_context6) {
5267
5320
  while (1) switch (_context6.prev = _context6.next) {
@@ -5278,7 +5331,7 @@ function createIdmissionClient(config) {
5278
5331
  });
5279
5332
  _context6.prev = 1;
5280
5333
  _context6.next = 2;
5281
- return performUpload(blob, withJobTaskMetadata(metadata, options.jobID, options.taskID));
5334
+ return performUpload(blob, withJobTaskMetadata(metadata, options.jobID, options.taskID), route);
5282
5335
  case 2:
5283
5336
  result = _context6.sent;
5284
5337
  progress.observe({
@@ -5308,12 +5361,13 @@ function createIdmissionClient(config) {
5308
5361
  }
5309
5362
  }, _callee6, null, [[1, 3, 4, 5]]);
5310
5363
  }));
5311
- return function (_x10, _x11) {
5312
- return _ref2.apply(this, arguments);
5364
+ return function (_x13, _x14) {
5365
+ return _ref3.apply(this, arguments);
5313
5366
  };
5314
5367
  }()) : undefined,
5315
5368
  now: config.now,
5316
- sdkVersions: config.sdkVersions
5369
+ sdkVersions: config.sdkVersions,
5370
+ collectors: routeBoundCollectors(route)
5317
5371
  });
5318
5372
  case 5:
5319
5373
  payloadResult = _context7.sent;
@@ -5327,40 +5381,41 @@ function createIdmissionClient(config) {
5327
5381
  case 7:
5328
5382
  payloadBuildEnd = payloadResult.uploadTimings.payloadBuildEnd;
5329
5383
  uploadMeasurements = payloadResult.uploadTimings.uploads;
5330
- request = payloadResult.request; // Stashed HERE rather than next to `lastSubmissionTimings` in the
5331
- // `finally`, because the hand-off below returns early: parking it in
5332
- // the same setState as the timings would leave `onSubmit` customers
5333
- // with a timings block and no request to go with it.
5384
+ request = payloadResult.request; // Stashed before the hand-off returns, so hand-off callers get the
5385
+ // request alongside the timings the `finally` records.
5334
5386
  store.setState({
5335
5387
  attestationAttached: payloadResult.attestationAttached,
5336
5388
  lastSubmissionRequest: request
5337
5389
  });
5338
- // THE HAND-OFF. sdk2 short-circuits at the equivalent point
5339
- // (SubmissionProvider.tsx:1374-1377, `return onSubmit.current(request)`
5340
- // before `defaultOnSubmit`), so everything above this line runs and
5341
- // nothing below it does.
5342
- //
5343
- // The status goes to SUBMITTED, where sdk2 leaves it at READY. That is a
5344
- // deliberate divergence in INTERNAL state to preserve the VISIBLE
5345
- // behaviour: sdk2's wizard renders an empty fragment for READY via its
5346
- // switch `default`, whereas this codebase renders the submitting screen
5347
- // for READY — so inheriting READY would park the user on a spinner
5348
- // forever. SUBMITTED with no response falls through every terminal
5349
- // branch to `return null`, which is sdk2's empty fragment.
5350
- if (!config.onSubmit) {
5390
+ if (!handsOff) {
5351
5391
  _context7.next = 8;
5352
5392
  break;
5353
5393
  }
5394
+ // sdk2 short-circuits at the equivalent point
5395
+ // (SubmissionProvider.tsx:1374-1377), so everything above runs and
5396
+ // nothing below does.
5397
+ //
5398
+ // The status goes to SUBMITTED, where sdk2 leaves it at READY. That is
5399
+ // a deliberate divergence in INTERNAL state to preserve the VISIBLE
5400
+ // behaviour: sdk2's wizard renders an empty fragment for READY via its
5401
+ // switch `default`, whereas this codebase renders the submitting
5402
+ // screen for READY — so inheriting READY would park the user on a
5403
+ // spinner forever. SUBMITTED with no response falls through every
5404
+ // terminal branch to `return null`, which is sdk2's empty fragment.
5354
5405
  store.setState({
5355
5406
  submissionStatus: SubmissionStatus.SUBMITTED
5356
5407
  });
5357
- config.onSubmit(request);
5408
+ if (kind === 'submit') config.onSubmit == null || config.onSubmit(request);
5358
5409
  progress.observe({
5359
5410
  kind: 'flow-completed'
5360
5411
  });
5361
- return _context7.abrupt("return", null);
5412
+ built = {
5413
+ request: request,
5414
+ response: null
5415
+ };
5416
+ _context7.next = 23;
5417
+ break;
5362
5418
  case 8:
5363
- sessionId = store.getState().session.sessionId;
5364
5419
  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));
5365
5420
  progress.observe({
5366
5421
  kind: 'phase',
@@ -5375,9 +5430,9 @@ function createIdmissionClient(config) {
5375
5430
  _context7.prev = 9;
5376
5431
  _context7.prev = 10;
5377
5432
  _context7.next = 11;
5378
- return timedFetch(urls.submissionUrl + endpoint, {
5433
+ return timedFetch(route.submissionUrl + endpoint, {
5379
5434
  method: 'POST',
5380
- headers: apiHeaders(sessionId, options.sendBase64DocumentsInSwaggerProxy),
5435
+ headers: apiHeaders(route.sessionId, options.sendBase64DocumentsInSwaggerProxy),
5381
5436
  body: JSON.stringify(request)
5382
5437
  });
5383
5438
  case 11:
@@ -5467,10 +5522,21 @@ function createIdmissionClient(config) {
5467
5522
  progress.observe({
5468
5523
  kind: 'flow-completed'
5469
5524
  });
5470
- config.onResponseReceived == null || config.onResponseReceived(submissionResponse, request);
5471
- return _context7.abrupt("return", submissionResponse);
5525
+ // Legacy `submit()` keeps a throwing `onResponseReceived` inside the
5526
+ // failure path, as it always has; `post()` notifies after the outcome
5527
+ // is settled (below).
5528
+ if (kind === 'submit') {
5529
+ config.onResponseReceived == null || config.onResponseReceived(submissionResponse, request);
5530
+ }
5531
+ built = {
5532
+ request: request,
5533
+ response: submissionResponse
5534
+ };
5472
5535
  case 23:
5473
- _context7.prev = 23;
5536
+ _context7.next = 25;
5537
+ break;
5538
+ case 24:
5539
+ _context7.prev = 24;
5474
5540
  _t0 = _context7["catch"](3);
5475
5541
  if (failedAt === undefined) failedAt = 'submission';
5476
5542
  err = _t0;
@@ -5482,72 +5548,116 @@ function createIdmissionClient(config) {
5482
5548
  // UNLIKE sdk2 (`if (throwErrorsOnFailure) throw err`) there is no
5483
5549
  // catch-swallow path: rejection always propagates.
5484
5550
  throw err;
5485
- case 24:
5486
- _context7.prev = 24;
5487
- // Liveness tokens are single-use: clear after each submit so a stale
5488
- // token isn't reapplied on a retry (SubmissionProvider.tsx:1350).
5489
- livenessToken = undefined;
5551
+ case 25:
5552
+ _context7.prev = 25;
5490
5553
  endedAt = nowImpl();
5554
+ timings = buildSubmissionTimings({
5555
+ startedAt: startedAt,
5556
+ endedAt: endedAt,
5557
+ payloadBuildStart: payloadBuildStart,
5558
+ payloadBuildEnd: payloadBuildEnd,
5559
+ uploads: uploadMeasurements,
5560
+ apiCallStart: apiCallStart,
5561
+ apiCallEnd: apiCallEnd,
5562
+ responseParseStart: responseParseStart,
5563
+ responseParseEnd: responseParseEnd,
5564
+ failedAt: failedAt
5565
+ });
5491
5566
  store.setState({
5492
- lastSubmissionTimings: buildSubmissionTimings({
5493
- startedAt: startedAt,
5494
- endedAt: endedAt,
5495
- payloadBuildStart: payloadBuildStart,
5496
- payloadBuildEnd: payloadBuildEnd,
5497
- uploads: uploadMeasurements,
5498
- apiCallStart: apiCallStart,
5499
- apiCallEnd: apiCallEnd,
5500
- responseParseStart: responseParseStart,
5501
- responseParseEnd: responseParseEnd,
5502
- failedAt: failedAt
5503
- })
5567
+ lastSubmissionTimings: timings
5504
5568
  });
5505
- return _context7.finish(24);
5506
- case 25:
5569
+ return _context7.finish(25);
5570
+ case 26:
5571
+ if (kind === 'post' && built.response) {
5572
+ _built = built, _response = _built.response, _request = _built.request;
5573
+ notifySafely$1('onResponseReceived', function () {
5574
+ return config.onResponseReceived == null ? void 0 : config.onResponseReceived(_response, _request);
5575
+ });
5576
+ }
5577
+ return _context7.abrupt("return", _extends({}, built, {
5578
+ timings: timings
5579
+ }));
5580
+ case 27:
5507
5581
  case "end":
5508
5582
  return _context7.stop();
5509
5583
  }
5510
- }, _callee7, null, [[3, 23, 24, 25], [4, 6], [9, 20], [10, 12]]);
5584
+ }, _callee7, null, [[3, 24, 25, 26], [4, 6], [9, 20], [10, 12]]);
5585
+ }));
5586
+ return _runPipeline.apply(this, arguments);
5587
+ }
5588
+ function submit(artifacts, options) {
5589
+ return runPipeline(artifacts, options, 'submit').then(function (_ref2) {
5590
+ var response = _ref2.response;
5591
+ return response;
5592
+ });
5593
+ }
5594
+ function post(artifacts, options) {
5595
+ return runPipeline(artifacts, options, 'post');
5596
+ }
5597
+ function handoff(_x9, _x0) {
5598
+ return _handoff.apply(this, arguments);
5599
+ }
5600
+ function _handoff() {
5601
+ _handoff = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(artifacts, options) {
5602
+ var _yield$runPipeline, request, timings;
5603
+ return _regeneratorRuntime.wrap(function (_context8) {
5604
+ while (1) switch (_context8.prev = _context8.next) {
5605
+ case 0:
5606
+ _context8.next = 1;
5607
+ return runPipeline(artifacts, options, 'handoff');
5608
+ case 1:
5609
+ _yield$runPipeline = _context8.sent;
5610
+ request = _yield$runPipeline.request;
5611
+ timings = _yield$runPipeline.timings;
5612
+ return _context8.abrupt("return", {
5613
+ request: request,
5614
+ timings: timings
5615
+ });
5616
+ case 2:
5617
+ case "end":
5618
+ return _context8.stop();
5619
+ }
5620
+ }, _callee8);
5511
5621
  }));
5512
- return _submit.apply(this, arguments);
5622
+ return _handoff.apply(this, arguments);
5513
5623
  }
5514
- function checkLiveness(_x8, _x9) {
5624
+ function checkLiveness(_x1, _x10) {
5515
5625
  return _checkLiveness.apply(this, arguments);
5516
5626
  }
5517
5627
  function _checkLiveness() {
5518
- _checkLiveness = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(imageDataUrl, options) {
5628
+ _checkLiveness = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(imageDataUrl, options) {
5519
5629
  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;
5520
- return _regeneratorRuntime.wrap(function (_context8) {
5521
- while (1) switch (_context8.prev = _context8.next) {
5630
+ return _regeneratorRuntime.wrap(function (_context9) {
5631
+ while (1) switch (_context9.prev = _context9.next) {
5522
5632
  case 0:
5523
5633
  if (options === void 0) {
5524
5634
  options = {};
5525
5635
  }
5526
- _context8.prev = 1;
5636
+ _context9.prev = 1;
5527
5637
  selfie = imageDataUrl;
5528
5638
  if (!(options.useDocumentServiceForLivenessChecks && documentServiceEnabled)) {
5529
- _context8.next = 6;
5639
+ _context9.next = 6;
5530
5640
  break;
5531
5641
  }
5532
5642
  if (!selfie.startsWith('data:')) {
5533
5643
  selfie = "data:image/jpeg;base64," + selfie;
5534
5644
  }
5535
- _context8.prev = 2;
5536
- _context8.next = 3;
5645
+ _context9.prev = 2;
5646
+ _context9.next = 3;
5537
5647
  return performUpload(dataUrlToBlob(selfie), withJobTaskMetadata({
5538
5648
  filename: 'liveness',
5539
5649
  filetype: 'image/jpeg'
5540
- }, options.jobID, options.taskID));
5650
+ }, options.jobID, options.taskID), currentRoute());
5541
5651
  case 3:
5542
- selfie = _context8.sent;
5543
- _context8.next = 5;
5652
+ selfie = _context9.sent;
5653
+ _context9.next = 5;
5544
5654
  break;
5545
5655
  case 4:
5546
- _context8.prev = 4;
5547
- _t1 = _context8["catch"](2);
5656
+ _context9.prev = 4;
5657
+ _t1 = _context9["catch"](2);
5548
5658
  throw new NetworkError(_t1 instanceof Error ? _t1.message : String(_t1));
5549
5659
  case 5:
5550
- _context8.next = 7;
5660
+ _context9.next = 7;
5551
5661
  break;
5552
5662
  case 6:
5553
5663
  selfie = dataUrlToBase64Sync$1(selfie);
@@ -5615,19 +5725,19 @@ function createIdmissionClient(config) {
5615
5725
  attestationAttached: attestationAttached
5616
5726
  });
5617
5727
  if (!config.onBeforeLivenessCheck) {
5618
- _context8.next = 9;
5728
+ _context9.next = 9;
5619
5729
  break;
5620
5730
  }
5621
- _context8.next = 8;
5731
+ _context9.next = 8;
5622
5732
  return config.onBeforeLivenessCheck(request);
5623
5733
  case 8:
5624
- result = _context8.sent;
5734
+ result = _context9.sent;
5625
5735
  if (result) request = result;
5626
5736
  case 9:
5627
5737
  endpoint = liveCheckEndpoint(!!options.idCardForFaceMatch);
5628
5738
  sessionId = store.getState().session.sessionId;
5629
- _context8.prev = 10;
5630
- _context8.next = 11;
5739
+ _context9.prev = 10;
5740
+ _context9.next = 11;
5631
5741
  return timedFetch(urls.submissionUrl + endpoint, {
5632
5742
  method: 'POST',
5633
5743
  // SubmissionProvider.tsx:1447 — sourced from the same
@@ -5638,36 +5748,36 @@ function createIdmissionClient(config) {
5638
5748
  body: JSON.stringify(request)
5639
5749
  });
5640
5750
  case 11:
5641
- response = _context8.sent;
5642
- _context8.next = 13;
5751
+ response = _context9.sent;
5752
+ _context9.next = 13;
5643
5753
  break;
5644
5754
  case 12:
5645
- _context8.prev = 12;
5646
- _t10 = _context8["catch"](10);
5755
+ _context9.prev = 12;
5756
+ _t10 = _context9["catch"](10);
5647
5757
  throw new NetworkError(_t10 instanceof Error ? _t10.message : String(_t10));
5648
5758
  case 13:
5649
5759
  if (response.ok) {
5650
- _context8.next = 18;
5760
+ _context9.next = 18;
5651
5761
  break;
5652
5762
  }
5653
5763
  if (!(response.status === 401 || response.status === 403)) {
5654
- _context8.next = 15;
5764
+ _context9.next = 15;
5655
5765
  break;
5656
5766
  }
5657
5767
  _t11 = AuthenticationError;
5658
5768
  _t12 = response.status;
5659
- _context8.next = 14;
5769
+ _context9.next = 14;
5660
5770
  return response.text();
5661
5771
  case 14:
5662
- _t13 = _context8.sent;
5772
+ _t13 = _context9.sent;
5663
5773
  throw new _t11(_t12, _t13);
5664
5774
  case 15:
5665
- _context8.next = 16;
5775
+ _context9.next = 16;
5666
5776
  return response.text();
5667
5777
  case 16:
5668
- statusMessage = _context8.sent;
5778
+ statusMessage = _context9.sent;
5669
5779
  if (!(!statusMessage || statusMessage === 'Load failed')) {
5670
- _context8.next = 17;
5780
+ _context9.next = 17;
5671
5781
  break;
5672
5782
  }
5673
5783
  throw new NetworkError(statusMessage);
@@ -5677,12 +5787,12 @@ function createIdmissionClient(config) {
5677
5787
  statusMessage: statusMessage
5678
5788
  });
5679
5789
  case 18:
5680
- _context8.next = 19;
5790
+ _context9.next = 19;
5681
5791
  return response.json();
5682
5792
  case 19:
5683
- livenessResponse = _context8.sent;
5793
+ livenessResponse = _context9.sent;
5684
5794
  if (!(livenessResponse.status.statusCode !== '000')) {
5685
- _context8.next = 20;
5795
+ _context9.next = 20;
5686
5796
  break;
5687
5797
  }
5688
5798
  throw new SubmissionError(livenessResponse.status);
@@ -5695,7 +5805,7 @@ function createIdmissionClient(config) {
5695
5805
  // unconditional here — a deliberate scope narrowing, not a silent drop.
5696
5806
  livenessToken = (_livenessResponse$res = livenessResponse.resultData) == null ? void 0 : _livenessResponse$res.livenessToken;
5697
5807
  if (!(options.softFail && !isLiveFaceConfirmed((_livenessResponse$res2 = livenessResponse.resultData) == null ? void 0 : _livenessResponse$res2.verificationResult))) {
5698
- _context8.next = 21;
5808
+ _context9.next = 21;
5699
5809
  break;
5700
5810
  }
5701
5811
  // Current sdk2 (SubmissionProvider.tsx checkLiveness): softFail also
@@ -5704,21 +5814,21 @@ function createIdmissionClient(config) {
5704
5814
  // non-live capture) and hand back a typed failure that still carries
5705
5815
  // the response so callers can read the detection flags.
5706
5816
  livenessToken = undefined;
5707
- return _context8.abrupt("return", {
5817
+ return _context9.abrupt("return", {
5708
5818
  ok: false,
5709
5819
  error: new Error("Liveness not confirmed: " + ((_livenessResponse$res3 = (_livenessResponse$res4 = livenessResponse.resultData) == null ? void 0 : _livenessResponse$res4.verificationResult) != null ? _livenessResponse$res3 : 'no verificationResult')),
5710
5820
  response: livenessResponse
5711
5821
  });
5712
5822
  case 21:
5713
- return _context8.abrupt("return", {
5823
+ return _context9.abrupt("return", {
5714
5824
  ok: true,
5715
5825
  response: livenessResponse
5716
5826
  });
5717
5827
  case 22:
5718
- _context8.prev = 22;
5719
- _t14 = _context8["catch"](1);
5828
+ _context9.prev = 22;
5829
+ _t14 = _context9["catch"](1);
5720
5830
  if (!options.softFail) {
5721
- _context8.next = 23;
5831
+ _context9.next = 23;
5722
5832
  break;
5723
5833
  }
5724
5834
  // Caller is treating this as a best-effort check. Don't surface the
@@ -5726,7 +5836,7 @@ function createIdmissionClient(config) {
5726
5836
  // typed failure result instead of sdk2's silent `undefined` (deliberate
5727
5837
  // divergence #3).
5728
5838
  livenessToken = undefined;
5729
- return _context8.abrupt("return", {
5839
+ return _context9.abrupt("return", {
5730
5840
  ok: false,
5731
5841
  error: _t14
5732
5842
  });
@@ -5740,32 +5850,32 @@ function createIdmissionClient(config) {
5740
5850
  throw err;
5741
5851
  case 24:
5742
5852
  case "end":
5743
- return _context8.stop();
5853
+ return _context9.stop();
5744
5854
  }
5745
- }, _callee8, null, [[1, 22], [2, 4], [10, 12]]);
5855
+ }, _callee9, null, [[1, 22], [2, 4], [10, 12]]);
5746
5856
  }));
5747
5857
  return _checkLiveness.apply(this, arguments);
5748
5858
  }
5749
- function clientUploadDocument(_x0, _x1) {
5859
+ function clientUploadDocument(_x11, _x12) {
5750
5860
  return _clientUploadDocument.apply(this, arguments);
5751
5861
  }
5752
5862
  function _clientUploadDocument() {
5753
- _clientUploadDocument = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(blob, metadata) {
5754
- return _regeneratorRuntime.wrap(function (_context9) {
5755
- while (1) switch (_context9.prev = _context9.next) {
5863
+ _clientUploadDocument = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(blob, metadata) {
5864
+ return _regeneratorRuntime.wrap(function (_context0) {
5865
+ while (1) switch (_context0.prev = _context0.next) {
5756
5866
  case 0:
5757
5867
  if (documentServiceEnabled) {
5758
- _context9.next = 1;
5868
+ _context0.next = 1;
5759
5869
  break;
5760
5870
  }
5761
5871
  throw new Error('document upload is disabled: no documentServiceUrl configured');
5762
5872
  case 1:
5763
- return _context9.abrupt("return", performUpload(blob, metadata != null ? metadata : {}));
5873
+ return _context0.abrupt("return", performUpload(blob, metadata != null ? metadata : {}, currentRoute()));
5764
5874
  case 2:
5765
5875
  case "end":
5766
- return _context9.stop();
5876
+ return _context0.stop();
5767
5877
  }
5768
- }, _callee9);
5878
+ }, _callee0);
5769
5879
  }));
5770
5880
  return _clientUploadDocument.apply(this, arguments);
5771
5881
  }
@@ -5781,6 +5891,8 @@ function createIdmissionClient(config) {
5781
5891
  validateSession: validateSessionMethod,
5782
5892
  retrySession: retrySession,
5783
5893
  submit: submit,
5894
+ post: post,
5895
+ handoff: handoff,
5784
5896
  checkLiveness: checkLiveness,
5785
5897
  uploadDocument: clientUploadDocument
5786
5898
  };
@@ -38405,7 +38517,9 @@ function SubmissionProvider(_ref) {
38405
38517
  onComplete = _ref.onComplete,
38406
38518
  onApproved = _ref.onApproved,
38407
38519
  onDenied = _ref.onDenied,
38408
- onRequestFailure = _ref.onRequestFailure;
38520
+ onSubmissionFailure = _ref.onSubmissionFailure,
38521
+ onRequestFailure = _ref.onRequestFailure,
38522
+ mode = _ref.mode;
38409
38523
  var progress = useCaptureObserver();
38410
38524
  var clientState = shim.useSyncExternalStore(client.subscribe, client.getState, client.getState);
38411
38525
  var _useAuthState = useAuthState(),
@@ -38418,10 +38532,15 @@ function SubmissionProvider(_ref) {
38418
38532
  _useState4 = _slicedToArray(_useState3, 2),
38419
38533
  localError = _useState4[0],
38420
38534
  setLocalError = _useState4[1];
38421
- var _useState5 = React.useState(false),
38535
+ var _useState5 = React.useState(IDLE_ATTEMPT),
38422
38536
  _useState6 = _slicedToArray(_useState5, 2),
38423
- resubmitting = _useState6[0],
38424
- setResubmitting = _useState6[1];
38537
+ attempt = _useState6[0],
38538
+ setAttempt = _useState6[1];
38539
+ var reportFailure = onSubmissionFailure != null ? onSubmissionFailure : onRequestFailure;
38540
+ var _useState7 = React.useState(false),
38541
+ _useState8 = _slicedToArray(_useState7, 2),
38542
+ resubmitting = _useState8[0],
38543
+ setResubmitting = _useState8[1];
38425
38544
  var lastArtifactsRef = React.useRef(null);
38426
38545
  var submitInFlightRef = React.useRef(null);
38427
38546
  var resubmitInFlightRef = React.useRef(null);
@@ -38439,6 +38558,65 @@ function SubmissionProvider(_ref) {
38439
38558
  }) : incoming;
38440
38559
  // Store the merged artifacts so a resubmit carries location too.
38441
38560
  lastArtifactsRef.current = artifacts;
38561
+ if (mode !== undefined) {
38562
+ // Registered before anything customer-supplied runs, so a throw from
38563
+ // a notification can never leave the flow without a status.
38564
+ setAttempt(_extends({}, IDLE_ATTEMPT, {
38565
+ status: SubmissionStatus.SUBMITTING
38566
+ }));
38567
+ notifySafely('onSubmissionStarted', function () {
38568
+ return onSubmissionStarted == null ? void 0 : onSubmissionStarted(artifacts);
38569
+ });
38570
+ var _unbindProgress = bindSubmissionObserver(artifacts, progress);
38571
+ var _promise = runAttempt(client, mode, artifacts, _extends({}, options, {
38572
+ action: action
38573
+ })).then(function (outcome) {
38574
+ setAttempt(_extends({}, outcome, {
38575
+ status: SubmissionStatus.SUBMITTED,
38576
+ error: null
38577
+ }));
38578
+ var response = outcome.response,
38579
+ request = outcome.request;
38580
+ if (response === null) {
38581
+ // Terminal once called; the handler is never awaited.
38582
+ if (typeof mode === 'object') {
38583
+ notifySafely('submitMode.handoff', function () {
38584
+ return mode.handoff(request);
38585
+ });
38586
+ }
38587
+ return null;
38588
+ }
38589
+ notifySafely('onComplete', function () {
38590
+ return onComplete == null ? void 0 : onComplete(response);
38591
+ });
38592
+ if (isApprovedResponse(action, response)) {
38593
+ notifySafely('onApproved', function () {
38594
+ return onApproved == null ? void 0 : onApproved(response);
38595
+ });
38596
+ } else {
38597
+ notifySafely('onDenied', function () {
38598
+ return onDenied == null ? void 0 : onDenied(response);
38599
+ });
38600
+ }
38601
+ return response;
38602
+ }, function (cause) {
38603
+ var error = cause instanceof Error ? cause : new Error(String(cause));
38604
+ setAttempt(_extends({}, IDLE_ATTEMPT, {
38605
+ status: SubmissionStatus.FAILED,
38606
+ error: error
38607
+ }));
38608
+ notifySafely('onSubmissionFailure', function () {
38609
+ return reportFailure == null ? void 0 : reportFailure(error);
38610
+ });
38611
+ throw error;
38612
+ })["finally"](function () {
38613
+ _unbindProgress();
38614
+ submitInFlightRef.current = null;
38615
+ setResubmitting(false);
38616
+ });
38617
+ submitInFlightRef.current = _promise;
38618
+ return _promise;
38619
+ }
38442
38620
  setSubmissionResponse(null);
38443
38621
  setLocalError(null);
38444
38622
  onSubmissionStarted == null || onSubmissionStarted(artifacts);
@@ -38459,7 +38637,7 @@ function SubmissionProvider(_ref) {
38459
38637
  })["catch"](function (cause) {
38460
38638
  var error = cause instanceof Error ? cause : new Error(String(cause));
38461
38639
  setLocalError(error);
38462
- onRequestFailure == null || onRequestFailure(error);
38640
+ reportFailure == null || reportFailure(error);
38463
38641
  throw error;
38464
38642
  })["finally"](function () {
38465
38643
  unbindProgress();
@@ -38468,7 +38646,7 @@ function SubmissionProvider(_ref) {
38468
38646
  });
38469
38647
  submitInFlightRef.current = promise;
38470
38648
  return promise;
38471
- }, [action, client, geolocation, onApproved, onComplete, onDenied, onRequestFailure, onSubmissionStarted, options, progress]);
38649
+ }, [action, client, geolocation, onApproved, onComplete, onDenied, reportFailure, onSubmissionStarted, options, progress, mode]);
38472
38650
  var resubmit = React.useMemo(function () {
38473
38651
  if (!authState.session.canRefreshSession) return null;
38474
38652
  return function () {
@@ -38513,22 +38691,121 @@ function SubmissionProvider(_ref) {
38513
38691
  }, [authState.session.canRefreshSession, client, submit]);
38514
38692
  var value = React.useMemo(function () {
38515
38693
  var _ref3, _clientState$lastSubm, _clientState$lastSubm2;
38694
+ if (mode !== undefined) {
38695
+ return {
38696
+ action: action,
38697
+ submit: submit,
38698
+ submissionStatus: resubmitting ? SubmissionStatus.SUBMITTING : attempt.status,
38699
+ submissionResponse: attempt.response,
38700
+ submissionError: attempt.error,
38701
+ lastSubmissionTimings: attempt.timings,
38702
+ lastSubmissionRequest: attempt.request,
38703
+ resubmit: resubmit
38704
+ };
38705
+ }
38516
38706
  return {
38517
38707
  action: action,
38518
38708
  submit: submit,
38519
- submissionStatus: resubmitting ? SubmissionStatus.SUBMITTING : clientState.submissionStatus,
38709
+ // A rejection before the client records anything (an unsupported
38710
+ // action, an unvalidated session) leaves the client at READY, which the
38711
+ // wizard renders as its submitting screen; the local error is the
38712
+ // failure it would otherwise never show.
38713
+ submissionStatus: resubmitting ? SubmissionStatus.SUBMITTING : localError && clientState.submissionStatus === SubmissionStatus.READY ? SubmissionStatus.FAILED : clientState.submissionStatus,
38520
38714
  submissionResponse: submissionResponse,
38521
38715
  submissionError: (_ref3 = localError != null ? localError : clientState.submissionError) != null ? _ref3 : null,
38522
38716
  lastSubmissionTimings: (_clientState$lastSubm = clientState.lastSubmissionTimings) != null ? _clientState$lastSubm : null,
38523
38717
  lastSubmissionRequest: (_clientState$lastSubm2 = clientState.lastSubmissionRequest) != null ? _clientState$lastSubm2 : null,
38524
38718
  resubmit: resubmit
38525
38719
  };
38526
- }, [action, clientState.lastSubmissionRequest, clientState.lastSubmissionTimings, clientState.submissionError, clientState.submissionStatus, localError, resubmit, resubmitting, submissionResponse, submit]);
38720
+ }, [action, attempt, clientState.lastSubmissionRequest, clientState.lastSubmissionTimings, clientState.submissionError, clientState.submissionStatus, localError, mode, resubmit, resubmitting, submissionResponse, submit]);
38527
38721
  return jsxRuntime.jsx(SubmissionContext.Provider, {
38528
38722
  value: value,
38529
38723
  children: children
38530
38724
  });
38531
38725
  }
38726
+ var IDLE_ATTEMPT = {
38727
+ status: SubmissionStatus.READY,
38728
+ response: null,
38729
+ request: null,
38730
+ timings: null,
38731
+ error: null
38732
+ };
38733
+ /**
38734
+ * One explicit-mode attempt through the client's `post()` or `handoff()`.
38735
+ * Never falls back to `submit()`: that would let the deprecated
38736
+ * `config.onSubmit` decide what an explicit mode already decided.
38737
+ */
38738
+ function runAttempt(_x, _x2, _x3, _x4) {
38739
+ return _runAttempt.apply(this, arguments);
38740
+ }
38741
+ function _runAttempt() {
38742
+ _runAttempt = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(client, mode, artifacts, options) {
38743
+ var _yield$client$handoff, request, timings;
38744
+ return _regeneratorRuntime.wrap(function (_context2) {
38745
+ while (1) switch (_context2.prev = _context2.next) {
38746
+ case 0:
38747
+ if (!(mode === 'capture')) {
38748
+ _context2.next = 1;
38749
+ break;
38750
+ }
38751
+ throw new Error("submitMode 'capture' does not submit; the flow reports onCaptured instead");
38752
+ case 1:
38753
+ if (!(mode === 'post')) {
38754
+ _context2.next = 3;
38755
+ break;
38756
+ }
38757
+ if (client.post) {
38758
+ _context2.next = 2;
38759
+ break;
38760
+ }
38761
+ throw missingMethod('post', "submitMode 'post'");
38762
+ case 2:
38763
+ return _context2.abrupt("return", client.post(artifacts, options));
38764
+ case 3:
38765
+ if (client.handoff) {
38766
+ _context2.next = 4;
38767
+ break;
38768
+ }
38769
+ throw missingMethod('handoff', 'submitMode { handoff }');
38770
+ case 4:
38771
+ _context2.next = 5;
38772
+ return client.handoff(artifacts, options);
38773
+ case 5:
38774
+ _yield$client$handoff = _context2.sent;
38775
+ request = _yield$client$handoff.request;
38776
+ timings = _yield$client$handoff.timings;
38777
+ return _context2.abrupt("return", {
38778
+ request: request,
38779
+ timings: timings,
38780
+ response: null
38781
+ });
38782
+ case 6:
38783
+ case "end":
38784
+ return _context2.stop();
38785
+ }
38786
+ }, _callee2);
38787
+ }));
38788
+ return _runAttempt.apply(this, arguments);
38789
+ }
38790
+ function missingMethod(method, needs) {
38791
+ return new Error(needs + " needs client." + method + "(), which this client does not have. " + 'Create the client with createIdmissionClient or useIdmissionClient.');
38792
+ }
38793
+ /**
38794
+ * Runs a customer callback whose failure must not change an outcome that is
38795
+ * already settled: a throw or a rejected promise is logged, never rethrown.
38796
+ */
38797
+ function notifySafely(name, notify) {
38798
+ try {
38799
+ var result = notify();
38800
+ if (result instanceof Promise) {
38801
+ result["catch"](function (e) {
38802
+ return warn(name + " rejected", e);
38803
+ });
38804
+ }
38805
+ } catch (e) {
38806
+ warn(name + " threw", e);
38807
+ }
38808
+ }
38532
38809
  function useSubmission() {
38533
38810
  var context = React.useContext(SubmissionContext);
38534
38811
  if (!context) {
@@ -40393,11 +40670,12 @@ function RemoteDiagnosticsMount(_ref) {
40393
40670
  }
40394
40671
 
40395
40672
  var _templateObject$1, _templateObject2$1, _templateObject3, _templateObject4;
40396
- var _excluded$9 = ["client", "action", "submission", "theme", "className", "geolocationEnabled", "geolocationRequired", "captureProgress", "remoteDiagnostics", "loadingSpinner", "showEnrollmentId", "lang", "children"];
40673
+ var _excluded$9 = ["client", "action", "submission", "submitMode", "theme", "className", "geolocationEnabled", "geolocationRequired", "captureProgress", "remoteDiagnostics", "loadingSpinner", "showEnrollmentId", "lang", "children"];
40397
40674
  function FlowChassis(_ref) {
40398
40675
  var client = _ref.client,
40399
40676
  action = _ref.action,
40400
40677
  submission = _ref.submission,
40678
+ submitMode = _ref.submitMode,
40401
40679
  _ref$theme = _ref.theme,
40402
40680
  theme = _ref$theme === void 0 ? 'default' : _ref$theme,
40403
40681
  className = _ref.className,
@@ -40430,6 +40708,7 @@ function FlowChassis(_ref) {
40430
40708
  client: client,
40431
40709
  action: action,
40432
40710
  options: submission,
40711
+ mode: submitMode,
40433
40712
  geolocation: geolocation.position
40434
40713
  }, callbacks, {
40435
40714
  children: jsxRuntime.jsx(FlowPage, {
@@ -40750,7 +41029,7 @@ function withVirtualCameras(camera, allowVirtualCameras) {
40750
41029
  return base;
40751
41030
  }
40752
41031
 
40753
- 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"];
41032
+ 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"];
40754
41033
  var EMPTY_ID_CAPTURE$3 = {};
40755
41034
  var EMPTY_SIGNATURE_CAPTURE$5 = {};
40756
41035
  var EMPTY_ID_VIEW$3 = {};
@@ -40767,8 +41046,8 @@ function IdValidationFlow(_ref) {
40767
41046
  submission = _ref$submission === void 0 ? EMPTY_SUBMISSION$6 : _ref$submission,
40768
41047
  _ref$initialArtifacts = _ref.initialArtifacts,
40769
41048
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$9 : _ref$initialArtifacts,
40770
- _ref$captureOnly = _ref.captureOnly,
40771
- captureOnly = _ref$captureOnly === void 0 ? false : _ref$captureOnly,
41049
+ submitMode = _ref.submitMode,
41050
+ captureOnly = _ref.captureOnly,
40772
41051
  signatureController = _ref.signatureController,
40773
41052
  _ref$signatureCapture = _ref.signatureCapture,
40774
41053
  signatureCapture = _ref$signatureCapture === void 0 ? EMPTY_SIGNATURE_CAPTURE$5 : _ref$signatureCapture,
@@ -40927,10 +41206,12 @@ function IdValidationFlow(_ref) {
40927
41206
  successIssuerCaptionText: 'confirmed'
40928
41207
  }
40929
41208
  });
41209
+ var mode = submitMode != null ? submitMode : captureOnly ? 'capture' : undefined;
40930
41210
  return jsxRuntime.jsxs(FlowChassis, _extends({
40931
41211
  client: client,
40932
41212
  action: SubmissionAction.VALIDATE,
40933
41213
  submission: submission,
41214
+ submitMode: mode,
40934
41215
  theme: theme,
40935
41216
  className: className,
40936
41217
  lang: lang
@@ -40938,7 +41219,7 @@ function IdValidationFlow(_ref) {
40938
41219
  children: [jsxRuntime.jsx(CompositeWizard, _extends({}, ringScreens, {
40939
41220
  steps: steps,
40940
41221
  initialArtifacts: initialArtifacts,
40941
- captureOnly: captureOnly,
41222
+ captureOnly: mode === 'capture',
40942
41223
  showResultScreen: showResultScreen != null ? showResultScreen : showSuccessScreen,
40943
41224
  showDiagnostics: showDiagnostics,
40944
41225
  onArtifactsCollected: onCaptured,
@@ -41398,6 +41679,10 @@ function SignatureKYCFlow(_ref) {
41398
41679
  captureProgress = _ref.captureProgress,
41399
41680
  remoteDiagnostics = _ref.remoteDiagnostics,
41400
41681
  loadingSpinner = _ref.loadingSpinner,
41682
+ _ref$submitMode = _ref.submitMode,
41683
+ submitMode = _ref$submitMode === void 0 ? 'capture' : _ref$submitMode,
41684
+ onSubmissionStarted = _ref.onSubmissionStarted,
41685
+ onSubmissionFailure = _ref.onSubmissionFailure,
41401
41686
  onCaptured = _ref.onCaptured,
41402
41687
  onCaptureError = _ref.onCaptureError;
41403
41688
  // Flow-wide settings reach each step unless its own bag sets them.
@@ -41598,8 +41883,8 @@ function SignatureKYCFlow(_ref) {
41598
41883
  completedRef.current = true;
41599
41884
  artifactsRef.current = mergeSubmissionArtifacts(artifactsRef.current, artifacts);
41600
41885
  setStage('complete');
41601
- onCaptured == null || onCaptured(artifactsRef.current);
41602
- }, [onCaptured]);
41886
+ if (submitMode === 'capture') onCaptured == null || onCaptured(artifactsRef.current);
41887
+ }, [onCaptured, submitMode]);
41603
41888
  var handleLivenessFailureExit = React.useCallback(function () {
41604
41889
  onExitAfterLivenessFailure == null || onExitAfterLivenessFailure();
41605
41890
  if (allowSignatureAfterLivenessCheckFailure) handleLivenessDone();
@@ -41608,6 +41893,9 @@ function SignatureKYCFlow(_ref) {
41608
41893
  client: client,
41609
41894
  action: SubmissionAction.NONE,
41610
41895
  submission: submission,
41896
+ submitMode: submitMode,
41897
+ onSubmissionStarted: onSubmissionStarted,
41898
+ onSubmissionFailure: onSubmissionFailure,
41611
41899
  theme: theme,
41612
41900
  className: className,
41613
41901
  lang: lang,
@@ -41617,8 +41905,10 @@ function SignatureKYCFlow(_ref) {
41617
41905
  remoteDiagnostics: remoteDiagnostics,
41618
41906
  loadingSpinner: loadingSpinner,
41619
41907
  children: [jsxRuntime.jsx(CaptureProgressCompletion, {
41620
- completed: stage === 'complete'
41621
- }), stage !== 'complete' ? jsxRuntime.jsxs(HandoffRoot, {
41908
+ completed: stage === 'complete' && submitMode === 'capture'
41909
+ }), stage === 'complete' && submitMode !== 'capture' ? jsxRuntime.jsx(SignatureHandoff, {
41910
+ artifacts: artifactsRef.current
41911
+ }) : null, stage !== 'complete' ? jsxRuntime.jsxs(HandoffRoot, {
41622
41912
  children: [jsxRuntime.jsx(SignatureCaptureView, _extends({}, signatureView, {
41623
41913
  skipSuccessScreen: impliedSkipSuccessScreen(signatureView.skipSuccessScreen, isRingIntroActive(faceView)),
41624
41914
  controller: resolvedSignatureController,
@@ -41668,6 +41958,44 @@ function SignatureKYCFlow(_ref) {
41668
41958
  }) : null]
41669
41959
  });
41670
41960
  }
41961
+ /**
41962
+ * Hands the finished capture off once the session has passed: a finishing
41963
+ * screen while the request is built, a retry screen if that fails, and
41964
+ * nothing once it has been handed off.
41965
+ */
41966
+ function SignatureHandoff(_ref3) {
41967
+ var artifacts = _ref3.artifacts;
41968
+ var _useSubmission = useSubmission(),
41969
+ action = _useSubmission.action,
41970
+ submit = _useSubmission.submit,
41971
+ submissionStatus = _useSubmission.submissionStatus,
41972
+ submissionError = _useSubmission.submissionError;
41973
+ var sessionReady = useSessionReady();
41974
+ var startedRef = React.useRef(false);
41975
+ // The provider reports a failure itself; these catches only keep the
41976
+ // rejection from going unhandled.
41977
+ React.useEffect(function () {
41978
+ if (!sessionReady || startedRef.current) return;
41979
+ startedRef.current = true;
41980
+ submit(artifacts)["catch"](function () {});
41981
+ }, [artifacts, sessionReady, submit]);
41982
+ if (submissionStatus === SubmissionStatus.SUBMITTED) return null;
41983
+ if (submissionStatus === SubmissionStatus.FAILED) {
41984
+ return jsxRuntime.jsx(SubmissionErrorOverlay, {
41985
+ error: submissionError,
41986
+ onRetry: function onRetry() {
41987
+ submit(artifacts)["catch"](function () {});
41988
+ }
41989
+ });
41990
+ }
41991
+ var text = submissionStatusText(action, artifacts);
41992
+ return jsxRuntime.jsx(OrbStatusScreen, {
41993
+ state: "working",
41994
+ text: text,
41995
+ accessibleLabel: text,
41996
+ loadingStage: "submission"
41997
+ });
41998
+ }
41671
41999
  /**
41672
42000
  * Black, so iOS Safari's bars read as letterboxing around the camera feed
41673
42001
  * rather than as one more colour a theme has to choose.
@@ -41685,10 +42013,10 @@ var CAMERA_EDGE_COLOR = '#000';
41685
42013
  * no flat strip can sit on its bottom edge unseen: that one is drawn invisibly,
41686
42014
  * as on ID capture's overlay. Opaque, it covered the bottom 12px of the bar.
41687
42015
  */
41688
- function FlowEdgeTint(_ref3) {
42016
+ function FlowEdgeTint(_ref4) {
41689
42017
  var _theme$selfieCapture$, _theme$selfieCapture, _theme$background;
41690
- var surface = _ref3.surface,
41691
- modelsReady = _ref3.modelsReady;
42018
+ var surface = _ref4.surface,
42019
+ modelsReady = _ref4.modelsReady;
41692
42020
  var theme = styledComponents.useTheme();
41693
42021
  if (theme.isFullscreen === false || surface === null) return null;
41694
42022
  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');
@@ -41698,9 +42026,9 @@ function FlowEdgeTint(_ref3) {
41698
42026
  hiddenBottomColor: surface === 'overlay' ? selfieLoadingOverlayBottomEdgeColor(theme, modelsReady) : undefined
41699
42027
  });
41700
42028
  }
41701
- function SelfieTrackerAttachment(_ref4) {
41702
- var controller = _ref4.controller,
41703
- video = _ref4.video;
42029
+ function SelfieTrackerAttachment(_ref5) {
42030
+ var controller = _ref5.controller,
42031
+ video = _ref5.video;
41704
42032
  React.useEffect(function () {
41705
42033
  if (!video) return;
41706
42034
  void controller.attach(video)["catch"](function () {
@@ -41718,7 +42046,7 @@ var FaceStage = styledComponents.styled.div(_templateObject2 || (_templateObject
41718
42046
  return props.$visible ? 'block' : 'none';
41719
42047
  });
41720
42048
 
41721
- 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"],
42049
+ 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"],
41722
42050
  _excluded2$2 = ["checkLivenessOptions"];
41723
42051
  var EMPTY_ID_CAPTURE$1 = {};
41724
42052
  var EMPTY_FACE_CAPTURE$2 = {};
@@ -41751,8 +42079,8 @@ function VideoIdValidationFlow(_ref) {
41751
42079
  submission = _ref$submission === void 0 ? EMPTY_SUBMISSION$2 : _ref$submission,
41752
42080
  _ref$initialArtifacts = _ref.initialArtifacts,
41753
42081
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$5 : _ref$initialArtifacts,
41754
- _ref$captureOnly = _ref.captureOnly,
41755
- captureOnly = _ref$captureOnly === void 0 ? false : _ref$captureOnly,
42082
+ submitMode = _ref.submitMode,
42083
+ captureOnly = _ref.captureOnly,
41756
42084
  signatureController = _ref.signatureController,
41757
42085
  _ref$signatureCapture = _ref.signatureCapture,
41758
42086
  signatureCapture = _ref$signatureCapture === void 0 ? EMPTY_SIGNATURE_CAPTURE$2 : _ref$signatureCapture,
@@ -41970,10 +42298,12 @@ function VideoIdValidationFlow(_ref) {
41970
42298
  successIssuerCaptionText: 'confirmed'
41971
42299
  }
41972
42300
  });
42301
+ var mode = submitMode != null ? submitMode : captureOnly ? 'capture' : undefined;
41973
42302
  return jsxRuntime.jsxs(FlowChassis, _extends({
41974
42303
  client: client,
41975
42304
  action: action,
41976
42305
  submission: submission,
42306
+ submitMode: mode,
41977
42307
  theme: theme,
41978
42308
  className: className,
41979
42309
  lang: lang
@@ -41981,7 +42311,7 @@ function VideoIdValidationFlow(_ref) {
41981
42311
  children: [jsxRuntime.jsx(CompositeWizard, _extends({}, ringScreens, {
41982
42312
  steps: steps,
41983
42313
  initialArtifacts: initialArtifacts,
41984
- captureOnly: captureOnly,
42314
+ captureOnly: mode === 'capture',
41985
42315
  showResultScreen: showResultScreen != null ? showResultScreen : showSuccessScreen,
41986
42316
  showDiagnostics: showDiagnostics,
41987
42317
  onArtifactsCollected: onCaptured,
@@ -46192,7 +46522,9 @@ function CustomerMatchFlow(_ref) {
46192
46522
  onComplete = _ref.onComplete,
46193
46523
  onCustomerMatched = _ref.onCustomerMatched,
46194
46524
  onCustomerNotMatched = _ref.onCustomerNotMatched,
46525
+ onSubmissionFailure = _ref.onSubmissionFailure,
46195
46526
  onRequestFailure = _ref.onRequestFailure,
46527
+ submitMode = _ref.submitMode,
46196
46528
  onCaptureGuidanceTimeout = _ref.onCaptureGuidanceTimeout,
46197
46529
  onExitCapture = _ref.onExitCapture,
46198
46530
  onExitAfterFailure = _ref.onExitAfterFailure;
@@ -46279,15 +46611,19 @@ function CustomerMatchFlow(_ref) {
46279
46611
  setOutcome('notMatched');
46280
46612
  onCustomerNotMatched == null || onCustomerNotMatched(response);
46281
46613
  }, [onCustomerNotMatched]);
46614
+ var reportFailure = onSubmissionFailure != null ? onSubmissionFailure : onRequestFailure;
46282
46615
  var handleLivenessCheckFailed = React.useCallback(function (error) {
46283
46616
  setOutcome('failed');
46284
- onRequestFailure == null || onRequestFailure(error);
46285
- }, [onRequestFailure]);
46617
+ reportFailure == null || reportFailure(error);
46618
+ }, [reportFailure]);
46286
46619
  var handleRequestError = React.useCallback(function (error) {
46287
46620
  errorRef.current = error;
46288
46621
  setOutcome('error');
46289
- onRequestFailure == null || onRequestFailure(error);
46290
- }, [onRequestFailure]);
46622
+ reportFailure == null || reportFailure(error);
46623
+ }, [reportFailure]);
46624
+ var handleHandedOff = React.useCallback(function () {
46625
+ return setOutcome('handedOff');
46626
+ }, []);
46291
46627
  var handleCaptureGuidanceTimeout = React.useCallback(function () {
46292
46628
  setOutcome('failed');
46293
46629
  onCaptureGuidanceTimeout == null || onCaptureGuidanceTimeout();
@@ -46328,6 +46664,7 @@ function CustomerMatchFlow(_ref) {
46328
46664
  client: client,
46329
46665
  action: action,
46330
46666
  submission: submission,
46667
+ submitMode: submitMode,
46331
46668
  theme: theme,
46332
46669
  className: className,
46333
46670
  lang: lang,
@@ -46352,6 +46689,7 @@ function CustomerMatchFlow(_ref) {
46352
46689
  onNotMatched: handleNotMatched,
46353
46690
  onLivenessCheckFailed: handleLivenessCheckFailed,
46354
46691
  onRequestError: handleRequestError,
46692
+ onSubmissionIntercepted: handleHandedOff,
46355
46693
  onCaptureGuidanceTimeout: handleCaptureGuidanceTimeout,
46356
46694
  onExitCapture: onExitCapture,
46357
46695
  finishingScreen: {
@@ -46487,6 +46825,84 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
46487
46825
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
46488
46826
  };
46489
46827
 
46828
+ function createIdAndFaceValidationJourneyEvent(event, now) {
46829
+ if (now === void 0) {
46830
+ now = function now() {
46831
+ return new Date();
46832
+ };
46833
+ }
46834
+ return _assign(_assign({}, event), {
46835
+ version: 1,
46836
+ flow: 'id-and-face-validation',
46837
+ timestamp: now().toISOString()
46838
+ });
46839
+ }
46840
+ /**
46841
+ * websdk-ui `CompositeWizardStep.id` -> journey stage.
46842
+ *
46843
+ * Four of the five stage names ARE step ids already; only the additional-
46844
+ * documents step differs, because sdk2's stage vocabulary says
46845
+ * `additional-document-capture` (singular "document") while websdk-ui's step
46846
+ * is `additional-documents`. Unknown ids return undefined so a step this
46847
+ * vocabulary has no name for is silently skipped rather than emitted with a
46848
+ * bogus stage — the same shape as sdk2's partial lookup record.
46849
+ */
46850
+ function journeyStageForStepId(stepId) {
46851
+ switch (stepId) {
46852
+ case 'id-capture':
46853
+ case 'face-liveness':
46854
+ case 'signature-capture':
46855
+ case 'video-signature-capture':
46856
+ return stepId;
46857
+ case 'additional-documents':
46858
+ return 'additional-document-capture';
46859
+ default:
46860
+ return undefined;
46861
+ }
46862
+ }
46863
+ /**
46864
+ * The document types sdk2 reports as `document.captured`. sdk2 filters the
46865
+ * wizard's `onDocumentStored` through this set (`primaryIdDocumentTypes`) so
46866
+ * that a document type outside the journey vocabulary cannot widen the event.
46867
+ * Kept as a predicate rather than a Set: the ES5 UMD bundle target makes
46868
+ * `for..of` over a Set a downlevel hazard, and a switch needs no iteration.
46869
+ */
46870
+ function isJourneyDocumentType(documentType) {
46871
+ return documentType === 'idCardFront' || documentType === 'idCardBack' || documentType === 'passport' || documentType === 'singlePage';
46872
+ }
46873
+ /**
46874
+ * The lazy `flow.started` rule, lifted out of sdk2's `emitJourneyEvent`
46875
+ * closure (IdAndFaceValidation.tsx:521-537) so it can be tested without a
46876
+ * React tree.
46877
+ *
46878
+ * sdk2 does NOT simply emit `flow.started` from a mount effect: it emits it
46879
+ * before the FIRST event of any kind, whatever that event is, and then
46880
+ * suppresses the explicit mount emit. The mount effect and the lazy guard
46881
+ * together mean `flow.started` is always the first event a customer sees,
46882
+ * even if some other event races the effect. That ordering guarantee is the
46883
+ * contract, not the effect.
46884
+ */
46885
+ function createJourneyEmitter(callback, now) {
46886
+ var flowStartedEmitted = false;
46887
+ return function emit(event) {
46888
+ if (!callback) return;
46889
+ if (!flowStartedEmitted) {
46890
+ flowStartedEmitted = true;
46891
+ emitWith(callback, {
46892
+ name: 'flow.started'
46893
+ }, now);
46894
+ }
46895
+ if (event.name !== 'flow.started') emitWith(callback, event, now);
46896
+ };
46897
+ }
46898
+ function emitWith(callback, event, now) {
46899
+ try {
46900
+ callback(createIdAndFaceValidationJourneyEvent(event, now));
46901
+ } catch (error) {
46902
+ warn$1('[IdAndFaceValidation] onJourneyEvent callback failed', error);
46903
+ }
46904
+ }
46905
+
46490
46906
  /**
46491
46907
  * sdk2 exports this as a mutable `string[]`
46492
46908
  * (contexts/AuthStateContext.tsx:25), not a readonly tuple — copied rather
@@ -46659,12 +47075,9 @@ function mapClientConfig(props) {
46659
47075
  documentServiceUrl: (_b = props.documentServiceUrl) !== null && _b !== void 0 ? _b : apiBase ? apiBase + '/files/' : override === null || override === void 0 ? void 0 : override.documentServiceUrl,
46660
47076
  onBeforeSubmit: props.onBeforeSubmit,
46661
47077
  onBeforeLivenessCheck: props.onBeforeLivenessCheck,
46662
- // Straight through to the client, which is where sdk2 put it too
46663
- // (SubmissionProvider.submit). That is what makes the SUPPRESSION uniform:
46664
- // every flow — including the two match flows, which own their own stage
46665
- // machine — submits through this one client, so none of them can post
46666
- // behind an integrator who supplied `onSubmit`.
46667
- onSubmit: props.onSubmit,
47078
+ // 2.x's `onSubmit` is not a client option here: each flow maps it to its
47079
+ // own `submitMode: { handoff }` (see ./props.ts), which follows the prop
47080
+ // live where a client option would be fixed at mount.
46668
47081
  onBeforeDocumentUpload: props.onBeforeDocumentUpload,
46669
47082
  onDocumentUploadProgress: props.onDocumentUploadProgress,
46670
47083
  onDocumentUploaded: props.onDocumentUploaded,
@@ -47674,84 +48087,6 @@ function mapFaceCapture(props, prefixed) {
47674
48087
  };
47675
48088
  }
47676
48089
 
47677
- function createIdAndFaceValidationJourneyEvent(event, now) {
47678
- if (now === void 0) {
47679
- now = function now() {
47680
- return new Date();
47681
- };
47682
- }
47683
- return _assign(_assign({}, event), {
47684
- version: 1,
47685
- flow: 'id-and-face-validation',
47686
- timestamp: now().toISOString()
47687
- });
47688
- }
47689
- /**
47690
- * websdk-ui `CompositeWizardStep.id` -> journey stage.
47691
- *
47692
- * Four of the five stage names ARE step ids already; only the additional-
47693
- * documents step differs, because sdk2's stage vocabulary says
47694
- * `additional-document-capture` (singular "document") while websdk-ui's step
47695
- * is `additional-documents`. Unknown ids return undefined so a step this
47696
- * vocabulary has no name for is silently skipped rather than emitted with a
47697
- * bogus stage — the same shape as sdk2's partial lookup record.
47698
- */
47699
- function journeyStageForStepId(stepId) {
47700
- switch (stepId) {
47701
- case 'id-capture':
47702
- case 'face-liveness':
47703
- case 'signature-capture':
47704
- case 'video-signature-capture':
47705
- return stepId;
47706
- case 'additional-documents':
47707
- return 'additional-document-capture';
47708
- default:
47709
- return undefined;
47710
- }
47711
- }
47712
- /**
47713
- * The document types sdk2 reports as `document.captured`. sdk2 filters the
47714
- * wizard's `onDocumentStored` through this set (`primaryIdDocumentTypes`) so
47715
- * that a document type outside the journey vocabulary cannot widen the event.
47716
- * Kept as a predicate rather than a Set: the ES5 UMD bundle target makes
47717
- * `for..of` over a Set a downlevel hazard, and a switch needs no iteration.
47718
- */
47719
- function isJourneyDocumentType(documentType) {
47720
- return documentType === 'idCardFront' || documentType === 'idCardBack' || documentType === 'passport' || documentType === 'singlePage';
47721
- }
47722
- /**
47723
- * The lazy `flow.started` rule, lifted out of sdk2's `emitJourneyEvent`
47724
- * closure (IdAndFaceValidation.tsx:521-537) so it can be tested without a
47725
- * React tree.
47726
- *
47727
- * sdk2 does NOT simply emit `flow.started` from a mount effect: it emits it
47728
- * before the FIRST event of any kind, whatever that event is, and then
47729
- * suppresses the explicit mount emit. The mount effect and the lazy guard
47730
- * together mean `flow.started` is always the first event a customer sees,
47731
- * even if some other event races the effect. That ordering guarantee is the
47732
- * contract, not the effect.
47733
- */
47734
- function createJourneyEmitter(callback, now) {
47735
- var flowStartedEmitted = false;
47736
- return function emit(event) {
47737
- if (!callback) return;
47738
- if (!flowStartedEmitted) {
47739
- flowStartedEmitted = true;
47740
- emitWith(callback, {
47741
- name: 'flow.started'
47742
- }, now);
47743
- }
47744
- if (event.name !== 'flow.started') emitWith(callback, event, now);
47745
- };
47746
- }
47747
- function emitWith(callback, event, now) {
47748
- try {
47749
- callback(createIdAndFaceValidationJourneyEvent(event, now));
47750
- } catch (error) {
47751
- warn$1('[IdAndFaceValidation] onJourneyEvent callback failed', error);
47752
- }
47753
- }
47754
-
47755
48090
  /**
47756
48091
  * Recursively drops keys whose value is exactly `undefined`.
47757
48092
  *
@@ -47934,6 +48269,16 @@ function mapThemeWithColors(theme, colors) {
47934
48269
  return mergeThemes(mapped, overrides);
47935
48270
  }
47936
48271
 
48272
+ /**
48273
+ * 2.x's `onSubmit` as the flow's hand-off. sdk2 read it on every submission,
48274
+ * so this maps on every render: adding or removing it takes effect from the
48275
+ * next submission. Without it the flow posts.
48276
+ */
48277
+ function mapHandoff(onSubmit) {
48278
+ return onSubmit ? {
48279
+ handoff: onSubmit
48280
+ } : undefined;
48281
+ }
47937
48282
  var EMPTY_CONTEXT = {};
47938
48283
  /** Adapts a 3.0 `(response)` callback back to 2.x's `(response, request)`. */
47939
48284
  function withSubmissionRequest(callback, ctx) {
@@ -48025,13 +48370,13 @@ function mapAdditionalDocumentVerbiage(verbiage) {
48025
48370
  }
48026
48371
  // --- 1. IdValidation ------------------------------------------------------
48027
48372
  function mapIdValidationProps(props, ctx) {
48028
- var _a;
48373
+ var _a, _b;
48029
48374
  if (ctx === void 0) {
48030
48375
  ctx = EMPTY_CONTEXT;
48031
48376
  }
48032
- var _b = mapIdCapture(props),
48033
- capture = _b.capture,
48034
- view = _b.view;
48377
+ var _c = mapIdCapture(props),
48378
+ capture = _c.capture,
48379
+ view = _c.view;
48035
48380
  return compact({
48036
48381
  capture: capture,
48037
48382
  view: view,
@@ -48057,9 +48402,8 @@ function mapIdValidationProps(props, ctx) {
48057
48402
  // `onSubmit` WINS over capture-only, matching sdk2's ordering: its
48058
48403
  // `submit()` checks `onSubmit` before the `action === NONE` branch
48059
48404
  // (SubmissionProvider.tsx:1374 vs :1237), so a capture-only flow still
48060
- // owes the callback its built request. Letting the flow run its normal
48061
- // submit path is what builds that request; the client suppresses the POST.
48062
- captureOnly: props.onSubmit ? undefined : props.captureOnly,
48405
+ // owes the callback its built request.
48406
+ submitMode: (_b = mapHandoff(props.onSubmit)) !== null && _b !== void 0 ? _b : props.captureOnly ? 'capture' : undefined,
48063
48407
  captureAdditionalDocuments: props.captureAdditionalDocuments,
48064
48408
  geolocationEnabled: props.geolocationEnabled,
48065
48409
  geolocationRequired: props.geolocationRequired,
@@ -48080,13 +48424,10 @@ function mapIdValidationProps(props, ctx) {
48080
48424
  // would be a NEW restriction, not parity.
48081
48425
  showResultScreen: props.debugMode,
48082
48426
  showDiagnostics: props.debugMode,
48083
- // `onSubmit` is NOT mapped to a flow prop: it goes to the client config
48084
- // (see mapClientConfig), which is the layer sdk2 put it at and the only
48085
- // one that can suppress the POST for every flow at once.
48086
48427
  onComplete: withSubmissionRequest(props.onComplete, ctx),
48087
48428
  onApproved: withSubmissionRequest(props.onApproved, ctx),
48088
48429
  onDenied: withSubmissionRequest(props.onDenied, ctx),
48089
- onRequestFailure: props.onRequestFailure
48430
+ onSubmissionFailure: props.onRequestFailure
48090
48431
  });
48091
48432
  }
48092
48433
  // --- 2. FaceValidation ----------------------------------------------------
@@ -48278,7 +48619,8 @@ function mapIdAndFaceValidationProps(props, ctx) {
48278
48619
  onComplete: withSubmissionRequest(props.onComplete, ctx),
48279
48620
  onApproved: withSubmissionRequest(props.onApproved, ctx),
48280
48621
  onDenied: withSubmissionRequest(props.onDenied, ctx),
48281
- onRequestFailure: props.onRequestFailure,
48622
+ submitMode: mapHandoff(props.onSubmit),
48623
+ onSubmissionFailure: props.onRequestFailure,
48282
48624
  onCaptureError: props.onRequestFailure
48283
48625
  });
48284
48626
  }
@@ -48433,10 +48775,11 @@ function mapSignatureKYCProps(props, ctx) {
48433
48775
  captureProgress: props.captureProgress,
48434
48776
  remoteDiagnostics: props.remoteDiagnostics,
48435
48777
  loadingSpinner: props.loadingSpinner,
48436
- // `onCaptured` is supplied by the COMPONENT, not here: this flow never
48437
- // enters `client.submit()` on its own, so the façade makes that call from
48438
- // `onCaptured` to produce the same built request 2.x hands over. See
48439
- // components/flows.tsx.
48778
+ // 2.x builds this flow's request and hands it to `onSubmit`
48779
+ // (SubmissionProvider.tsx:1374, ahead of its NONE branch). Unset, the
48780
+ // flow captures and posts nothing, as 2.x's NONE did. A failed hand-off
48781
+ // is not reported to `onRequestFailure`, which 2.x never did either.
48782
+ submitMode: mapHandoff(props.onSubmit),
48440
48783
  onCaptureError: props.onRequestFailure
48441
48784
  });
48442
48785
  }
@@ -48462,7 +48805,7 @@ function nestedLayer(nested, map) {
48462
48805
  return map(nested);
48463
48806
  }
48464
48807
  function mapVideoIdValidationProps(props, ctx) {
48465
- var _a, _b, _c;
48808
+ var _a, _b, _c, _d;
48466
48809
  if (ctx === void 0) {
48467
48810
  ctx = EMPTY_CONTEXT;
48468
48811
  }
@@ -48555,7 +48898,11 @@ function mapVideoIdValidationProps(props, ctx) {
48555
48898
  showResultScreen: props.debugMode,
48556
48899
  showDiagnostics: props.debugMode,
48557
48900
  onComplete: withSubmissionRequest(props.onComplete, ctx),
48558
- onRequestFailure: props.onRequestFailure,
48901
+ // No ID captured and none supplied resolves the action to NONE, which
48902
+ // has nothing to post. 2.x answered with a synthetic success and no
48903
+ // request; capture mode is that without the fabricated response.
48904
+ submitMode: (_d = mapHandoff(props.onSubmit)) !== null && _d !== void 0 ? _d : props.skipIdCapture && !props.idCardForFaceMatch ? 'capture' : undefined,
48905
+ onSubmissionFailure: props.onRequestFailure,
48559
48906
  onCaptureError: props.onRequestFailure
48560
48907
  });
48561
48908
  }
@@ -48720,7 +49067,8 @@ function mapCustomerMatchProps(props, ctx) {
48720
49067
  onComplete: withSubmissionRequest(props.onComplete, ctx),
48721
49068
  onCustomerMatched: withSubmissionRequest(props.onCustomerMatched, ctx),
48722
49069
  onCustomerNotMatched: withSubmissionRequest(props.onCustomerNotMatched, ctx),
48723
- onRequestFailure: props.onRequestFailure,
49070
+ submitMode: mapHandoff(props.onSubmit),
49071
+ onSubmissionFailure: props.onRequestFailure,
48724
49072
  onExitCapture: props.onExitCapture,
48725
49073
  onExitAfterFailure: props.onExitAfterFailure
48726
49074
  });
@@ -48789,7 +49137,8 @@ function mapCustomerBiometricsEnrollmentProps(props, ctx) {
48789
49137
  // sdk2's enrollment twin of `onApproved`.
48790
49138
  onApproved: withSubmissionRequest(props.onEnrolled, ctx),
48791
49139
  onDenied: withSubmissionRequest(props.onDenied, ctx),
48792
- onRequestFailure: props.onRequestFailure,
49140
+ submitMode: mapHandoff(props.onSubmit),
49141
+ onSubmissionFailure: props.onRequestFailure,
48793
49142
  onCaptureError: props.onRequestFailure
48794
49143
  });
48795
49144
  }
@@ -48881,12 +49230,13 @@ function mapCustomerIdAndBiometricsEnrollmentProps(props, ctx) {
48881
49230
  onComplete: withSubmissionRequest(props.onComplete, ctx),
48882
49231
  onApproved: withSubmissionRequest(props.onEnrolled, ctx),
48883
49232
  onDenied: withSubmissionRequest(props.onDenied, ctx),
48884
- onRequestFailure: props.onRequestFailure,
49233
+ submitMode: mapHandoff(props.onSubmit),
49234
+ onSubmissionFailure: props.onRequestFailure,
48885
49235
  onCaptureError: props.onRequestFailure
48886
49236
  });
48887
49237
  }
48888
49238
 
48889
- var webSdkVersion = '2.6.3-t3code-shared-flow-settings-e5702c2';
49239
+ var webSdkVersion = '2.6.3-t3code-callback-homes-submit-handoff-9690b2d';
48890
49240
 
48891
49241
  // GENERATED by scripts/styleBagTypes.mjs from
48892
49242
  // src/__fixtures__/sdk2StyleBags.json and the mapper sweep — do not
@@ -50943,23 +51293,17 @@ var STYLE_WITH_ASSETS = {
50943
51293
  var SUBMIT_CALLBACKS = {
50944
51294
  onBeforeSubmit: MAPPED,
50945
51295
  /**
50946
- * Mapped to the CLIENT's `onSubmit`, not to a flow prop — the layer sdk2 put
50947
- * it at (SubmissionProvider.submit). The client builds the request, hands it
50948
- * over, and does NOT post, so `onComplete`/`onApproved`/`onDenied` never
50949
- * fire, exactly as 2.x documents. Every flow submits through that one
50950
- * client, including the two match flows with their own stage machine, so the
50951
- * suppression is uniform.
51296
+ * Mapped to the flow's `submitMode: { handoff }`. The flow builds the
51297
+ * request, hands it over, and does NOT post, so `onComplete`/`onApproved`/
51298
+ * `onDenied` never fire, exactly as 2.x documents. Mapped on every render,
51299
+ * so adding or removing it takes effect from the next submission, as sdk2's
51300
+ * ref-held `onSubmit` did.
50952
51301
  *
50953
51302
  * What the flow SHOWS afterwards is a 3.0 call rather than a 2.x
50954
51303
  * reproduction: every family now ends quietly, because the integrator owns
50955
51304
  * the outcome once they have the request. 2.x's match flows showed a failure
50956
51305
  * screen there, but only because their `submit()` could not distinguish an
50957
51306
  * intercepted submission from a broken one.
50958
- *
50959
- * `SignatureKYC` reaches the same place by a different route: its 3.0
50960
- * counterpart never enters `client.submit()`, so the façade component makes
50961
- * that call itself from `onCaptured`. `action: NONE` is accepted there
50962
- * precisely because `onSubmit` is bound.
50963
51307
  */
50964
51308
  onSubmit: MAPPED,
50965
51309
  onComplete: MAPPED,
@@ -51057,7 +51401,7 @@ var SignatureKYC$1 = _assign(_assign(_assign(_assign(_assign(_assign(_assign(_as
51057
51401
  // `SubmissionAction.NONE` and wires `onComplete` to the provider's
51058
51402
  // `onResponseReceived` (SignatureKYC.tsx:434,449), which never fires because
51059
51403
  // nothing is ever posted. `onSubmit` is the real completion seam and IS
51060
- // mapped, to the flow's `onCaptured`.
51404
+ // mapped, to the flow's `submitMode: { handoff }`.
51061
51405
  onComplete: NOOP,
51062
51406
  onSubmit: MAPPED,
51063
51407
  onRequestFailure: MAPPED,
@@ -51548,10 +51892,6 @@ function useCompatClient(props) {
51548
51892
  _lastLivenessRequest.current = request;
51549
51893
  return propsRef.current.onBeforeLivenessCheck ? propsRef.current.onBeforeLivenessCheck(request) : Promise.resolve(request);
51550
51894
  },
51551
- onSubmit: propsRef.current.onSubmit ? function (request) {
51552
- var _a, _b;
51553
- return (_b = (_a = propsRef.current).onSubmit) === null || _b === void 0 ? void 0 : _b.call(_a, request);
51554
- } : undefined,
51555
51895
  onResponseReceived: function onResponseReceived(_response, request) {
51556
51896
  _lastSubmissionRequest.current = request;
51557
51897
  },
@@ -51722,34 +52062,12 @@ var SignatureKYC = function SignatureKYC(props) {
51722
52062
  client = _a.client,
51723
52063
  ctx = _a.ctx;
51724
52064
  useDroppedPropReport('SignatureKYC', props);
51725
- // The one flow whose 3.0 counterpart never enters `client.submit()`: it runs
51726
- // its own stage machine and reports completion through `onCaptured` instead.
51727
- // 2.x DOES submit here — its CompositeWizard calls `submit()`, which hands
51728
- // the built request to `onSubmit` before reaching the capture-only branch —
51729
- // so the façade makes that call itself to produce the same request. The
51730
- // client suppresses the POST, and `action: NONE` is accepted precisely
51731
- // because `onSubmit` is bound.
51732
- //
51733
- // Only when bound: without `onSubmit` the client rejects NONE by design, and
51734
- // this flow has nothing to submit anyway.
51735
- var onSubmit = props.onSubmit;
51736
- var submission = mapSubmission(props);
51737
- var handOff = onSubmit ? function (artifacts) {
51738
- void client.submit(artifacts, _assign(_assign({}, submission), {
51739
- action: SubmissionAction.NONE
51740
- }))["catch"](function () {
51741
- // The failure already reached `onRequestFailure` through the
51742
- // client's own hook, which is where 2.x reported it too.
51743
- });
51744
- } : undefined;
51745
52065
  // No `children`: SignatureKYCFlow omits it from its props (it runs its own
51746
52066
  // stage machine rather than CompositeWizard), so passing it would not
51747
52067
  // compile — and 2.x rendered it nowhere either.
51748
52068
  return /*#__PURE__*/React__default.default.createElement(SignatureKYCFlow, _assign({
51749
52069
  client: client
51750
- }, mapSignatureKYCProps(props, ctx), {
51751
- onCaptured: handOff
51752
- }));
52070
+ }, mapSignatureKYCProps(props, ctx)));
51753
52071
  };
51754
52072
  /**
51755
52073
  * Render a fullscreen capture component that performs ID and face validation,