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.
package/dist/sdk2.esm.js CHANGED
@@ -4858,6 +4858,22 @@ function withJobTaskMetadata(metadata, jobID, taskID) {
4858
4858
  if (taskID) merged.taskid = taskID;
4859
4859
  return merged;
4860
4860
  }
4861
+ /**
4862
+ * Runs a customer callback whose failure must not change an outcome that is
4863
+ * already settled: a throw or a rejected promise is logged, never rethrown.
4864
+ */
4865
+ function notifySafely$1(name, notify) {
4866
+ try {
4867
+ var result = notify();
4868
+ if (result instanceof Promise) {
4869
+ result["catch"](function (e) {
4870
+ return warn$1(name + " rejected", e);
4871
+ });
4872
+ }
4873
+ } catch (e) {
4874
+ warn$1(name + " threw", e);
4875
+ }
4876
+ }
4861
4877
  /**
4862
4878
  * How long an async `sessionId` resolver may take. It typically mints the
4863
4879
  * session through the host's own backend (an OAuth token, then
@@ -4880,6 +4896,10 @@ function resolveSessionIdWithTimeout(resolve) {
4880
4896
  return clearTimeout(timer);
4881
4897
  });
4882
4898
  }
4899
+ /**
4900
+ * Creates a client. Its type is `Required<IdmissionClient>`: unlike a
4901
+ * hand-written `IdmissionClient`, it always has `post()` and `handoff()`.
4902
+ */
4883
4903
  function createIdmissionClient(config) {
4884
4904
  var _config$fetch, _config$now;
4885
4905
  // `let`: when config.sessionId is an async resolver, the session URN (and
@@ -4966,10 +4986,33 @@ function createIdmissionClient(config) {
4966
4986
  }));
4967
4987
  return _timedFetch.apply(this, arguments);
4968
4988
  }
4969
- function performUpload(blob, metadata) {
4970
- return uploadDocument(blob, metadata, {
4971
- documentServiceUrl: urls.documentServiceUrl,
4989
+ function currentRoute() {
4990
+ return {
4972
4991
  sessionId: store.getState().session.sessionId,
4992
+ submissionUrl: urls.submissionUrl,
4993
+ documentServiceUrl: urls.documentServiceUrl,
4994
+ sessionNonce: getLastSessionNonce()
4995
+ };
4996
+ }
4997
+ // The attestation holders are module-level and follow the newest
4998
+ // ValidateSession. If that is no longer this operation's session, its nonce
4999
+ // and OS token belong to someone else: omit the envelope (throwing here is
5000
+ // attachMetadataToRequest's fail-open path, which reports
5001
+ // `attestationAttached: false`) rather than attach a stranger's.
5002
+ function routeBoundCollectors(route) {
5003
+ return {
5004
+ collectAttestation: function collectAttestation(web, versions) {
5005
+ if (getLastSessionNonce() !== route.sessionNonce) {
5006
+ throw new Error('session changed during submission; attestation omitted');
5007
+ }
5008
+ return collectClientAttestation(web, versions);
5009
+ }
5010
+ };
5011
+ }
5012
+ function performUpload(blob, metadata, route) {
5013
+ return uploadDocument(blob, metadata, {
5014
+ documentServiceUrl: route.documentServiceUrl,
5015
+ sessionId: route.sessionId,
4973
5016
  Upload: config.tusUpload,
4974
5017
  delay: config.delay,
4975
5018
  calculateMd5: config.calculateMd5,
@@ -5193,23 +5236,28 @@ function createIdmissionClient(config) {
5193
5236
  }));
5194
5237
  return _retrySession.apply(this, arguments);
5195
5238
  }
5196
- function submit(_x6, _x7) {
5197
- return _submit.apply(this, arguments);
5239
+ function runPipeline(_x6, _x7, _x8) {
5240
+ return _runPipeline.apply(this, arguments);
5198
5241
  }
5199
- function _submit() {
5200
- _submit = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(artifacts, options) {
5201
- var _options$onBeforeSubm;
5202
- 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;
5242
+ function _runPipeline() {
5243
+ _runPipeline = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(artifacts, options, kind) {
5244
+ var _artifacts$meta$liven, _artifacts$meta, _options$onBeforeSubm;
5245
+ 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;
5203
5246
  return _regeneratorRuntime.wrap(function (_context7) {
5204
5247
  while (1) switch (_context7.prev = _context7.next) {
5205
5248
  case 0:
5206
- if (!(options.action === SubmissionAction.NONE && !config.onSubmit)) {
5249
+ handsOff = kind === 'handoff' || kind === 'submit' && config.onSubmit !== undefined; // sdk2 short-circuits action NONE to a synthetic success before any
5250
+ // network activity (SubmissionProvider.tsx:1203-1225). This client does
5251
+ // not fabricate that response, but it keeps the "NONE does no network
5252
+ // work" guarantee by rejecting here, before any upload — unless the
5253
+ // request is being handed off, which is the one thing NONE can do.
5254
+ if (!(options.action === SubmissionAction.NONE && !handsOff)) {
5207
5255
  _context7.next = 1;
5208
5256
  break;
5209
5257
  }
5210
5258
  throw new SubmissionError({
5211
5259
  statusCode: 'UNSUPPORTED_ACTION',
5212
- statusMessage: "submit() rejects action: 'NONE' -- capture-only, no-network submission is the controller layer's responsibility (plan 3), not this client's"
5260
+ statusMessage: "action 'NONE' has no endpoint to post to; use handoff() to build the request without posting it"
5213
5261
  });
5214
5262
  case 1:
5215
5263
  if (!(store.getState().session.sessionCheckState !== 'PASSED')) {
@@ -5218,6 +5266,11 @@ function createIdmissionClient(config) {
5218
5266
  }
5219
5267
  throw new AuthenticationError(401, 'session not validated');
5220
5268
  case 2:
5269
+ route = currentRoute(); // Claimed, not read: an overlapping operation must not reuse it, and a
5270
+ // `checkLiveness()` that lands mid-operation keeps its own token for the
5271
+ // next one (SubmissionProvider.tsx:1350 cleared it after the submit).
5272
+ claimedLivenessToken = (_artifacts$meta$liven = (_artifacts$meta = artifacts.meta) == null ? void 0 : _artifacts$meta.livenessToken) != null ? _artifacts$meta$liven : livenessToken;
5273
+ livenessToken = undefined;
5221
5274
  store.setState({
5222
5275
  submissionStatus: SubmissionStatus.SUBMITTING,
5223
5276
  submissionError: undefined
@@ -5234,7 +5287,7 @@ function createIdmissionClient(config) {
5234
5287
  _context7.next = 5;
5235
5288
  return buildSubmissionPayload(_extends({}, artifacts, {
5236
5289
  meta: _extends({}, artifacts.meta, {
5237
- livenessToken: (_artifacts$meta$liven = (_artifacts$meta = artifacts.meta) == null ? void 0 : _artifacts$meta.livenessToken) != null ? _artifacts$meta$liven : livenessToken
5290
+ livenessToken: claimedLivenessToken
5238
5291
  })
5239
5292
  }), _extends({}, options, {
5240
5293
  onBeforeSubmit: beforeSubmit ? function (request) {
@@ -5250,7 +5303,7 @@ function createIdmissionClient(config) {
5250
5303
  // withJobTaskMetadata (see its own comment above): only present
5251
5304
  // when options.jobID/taskID are present.
5252
5305
  uploadDocument: documentServiceEnabled ? (/*#__PURE__*/function () {
5253
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(blob, metadata) {
5306
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(blob, metadata) {
5254
5307
  var result, _t3;
5255
5308
  return _regeneratorRuntime.wrap(function (_context6) {
5256
5309
  while (1) switch (_context6.prev = _context6.next) {
@@ -5267,7 +5320,7 @@ function createIdmissionClient(config) {
5267
5320
  });
5268
5321
  _context6.prev = 1;
5269
5322
  _context6.next = 2;
5270
- return performUpload(blob, withJobTaskMetadata(metadata, options.jobID, options.taskID));
5323
+ return performUpload(blob, withJobTaskMetadata(metadata, options.jobID, options.taskID), route);
5271
5324
  case 2:
5272
5325
  result = _context6.sent;
5273
5326
  progress.observe({
@@ -5297,12 +5350,13 @@ function createIdmissionClient(config) {
5297
5350
  }
5298
5351
  }, _callee6, null, [[1, 3, 4, 5]]);
5299
5352
  }));
5300
- return function (_x10, _x11) {
5301
- return _ref2.apply(this, arguments);
5353
+ return function (_x13, _x14) {
5354
+ return _ref3.apply(this, arguments);
5302
5355
  };
5303
5356
  }()) : undefined,
5304
5357
  now: config.now,
5305
- sdkVersions: config.sdkVersions
5358
+ sdkVersions: config.sdkVersions,
5359
+ collectors: routeBoundCollectors(route)
5306
5360
  });
5307
5361
  case 5:
5308
5362
  payloadResult = _context7.sent;
@@ -5316,40 +5370,41 @@ function createIdmissionClient(config) {
5316
5370
  case 7:
5317
5371
  payloadBuildEnd = payloadResult.uploadTimings.payloadBuildEnd;
5318
5372
  uploadMeasurements = payloadResult.uploadTimings.uploads;
5319
- request = payloadResult.request; // Stashed HERE rather than next to `lastSubmissionTimings` in the
5320
- // `finally`, because the hand-off below returns early: parking it in
5321
- // the same setState as the timings would leave `onSubmit` customers
5322
- // with a timings block and no request to go with it.
5373
+ request = payloadResult.request; // Stashed before the hand-off returns, so hand-off callers get the
5374
+ // request alongside the timings the `finally` records.
5323
5375
  store.setState({
5324
5376
  attestationAttached: payloadResult.attestationAttached,
5325
5377
  lastSubmissionRequest: request
5326
5378
  });
5327
- // THE HAND-OFF. sdk2 short-circuits at the equivalent point
5328
- // (SubmissionProvider.tsx:1374-1377, `return onSubmit.current(request)`
5329
- // before `defaultOnSubmit`), so everything above this line runs and
5330
- // nothing below it does.
5331
- //
5332
- // The status goes to SUBMITTED, where sdk2 leaves it at READY. That is a
5333
- // deliberate divergence in INTERNAL state to preserve the VISIBLE
5334
- // behaviour: sdk2's wizard renders an empty fragment for READY via its
5335
- // switch `default`, whereas this codebase renders the submitting screen
5336
- // for READY — so inheriting READY would park the user on a spinner
5337
- // forever. SUBMITTED with no response falls through every terminal
5338
- // branch to `return null`, which is sdk2's empty fragment.
5339
- if (!config.onSubmit) {
5379
+ if (!handsOff) {
5340
5380
  _context7.next = 8;
5341
5381
  break;
5342
5382
  }
5383
+ // sdk2 short-circuits at the equivalent point
5384
+ // (SubmissionProvider.tsx:1374-1377), so everything above runs and
5385
+ // nothing below does.
5386
+ //
5387
+ // The status goes to SUBMITTED, where sdk2 leaves it at READY. That is
5388
+ // a deliberate divergence in INTERNAL state to preserve the VISIBLE
5389
+ // behaviour: sdk2's wizard renders an empty fragment for READY via its
5390
+ // switch `default`, whereas this codebase renders the submitting
5391
+ // screen for READY — so inheriting READY would park the user on a
5392
+ // spinner forever. SUBMITTED with no response falls through every
5393
+ // terminal branch to `return null`, which is sdk2's empty fragment.
5343
5394
  store.setState({
5344
5395
  submissionStatus: SubmissionStatus.SUBMITTED
5345
5396
  });
5346
- config.onSubmit(request);
5397
+ if (kind === 'submit') config.onSubmit == null || config.onSubmit(request);
5347
5398
  progress.observe({
5348
5399
  kind: 'flow-completed'
5349
5400
  });
5350
- return _context7.abrupt("return", null);
5401
+ built = {
5402
+ request: request,
5403
+ response: null
5404
+ };
5405
+ _context7.next = 23;
5406
+ break;
5351
5407
  case 8:
5352
- sessionId = store.getState().session.sessionId;
5353
5408
  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));
5354
5409
  progress.observe({
5355
5410
  kind: 'phase',
@@ -5364,9 +5419,9 @@ function createIdmissionClient(config) {
5364
5419
  _context7.prev = 9;
5365
5420
  _context7.prev = 10;
5366
5421
  _context7.next = 11;
5367
- return timedFetch(urls.submissionUrl + endpoint, {
5422
+ return timedFetch(route.submissionUrl + endpoint, {
5368
5423
  method: 'POST',
5369
- headers: apiHeaders(sessionId, options.sendBase64DocumentsInSwaggerProxy),
5424
+ headers: apiHeaders(route.sessionId, options.sendBase64DocumentsInSwaggerProxy),
5370
5425
  body: JSON.stringify(request)
5371
5426
  });
5372
5427
  case 11:
@@ -5456,10 +5511,21 @@ function createIdmissionClient(config) {
5456
5511
  progress.observe({
5457
5512
  kind: 'flow-completed'
5458
5513
  });
5459
- config.onResponseReceived == null || config.onResponseReceived(submissionResponse, request);
5460
- return _context7.abrupt("return", submissionResponse);
5514
+ // Legacy `submit()` keeps a throwing `onResponseReceived` inside the
5515
+ // failure path, as it always has; `post()` notifies after the outcome
5516
+ // is settled (below).
5517
+ if (kind === 'submit') {
5518
+ config.onResponseReceived == null || config.onResponseReceived(submissionResponse, request);
5519
+ }
5520
+ built = {
5521
+ request: request,
5522
+ response: submissionResponse
5523
+ };
5461
5524
  case 23:
5462
- _context7.prev = 23;
5525
+ _context7.next = 25;
5526
+ break;
5527
+ case 24:
5528
+ _context7.prev = 24;
5463
5529
  _t0 = _context7["catch"](3);
5464
5530
  if (failedAt === undefined) failedAt = 'submission';
5465
5531
  err = _t0;
@@ -5471,72 +5537,116 @@ function createIdmissionClient(config) {
5471
5537
  // UNLIKE sdk2 (`if (throwErrorsOnFailure) throw err`) there is no
5472
5538
  // catch-swallow path: rejection always propagates.
5473
5539
  throw err;
5474
- case 24:
5475
- _context7.prev = 24;
5476
- // Liveness tokens are single-use: clear after each submit so a stale
5477
- // token isn't reapplied on a retry (SubmissionProvider.tsx:1350).
5478
- livenessToken = undefined;
5540
+ case 25:
5541
+ _context7.prev = 25;
5479
5542
  endedAt = nowImpl();
5543
+ timings = buildSubmissionTimings({
5544
+ startedAt: startedAt,
5545
+ endedAt: endedAt,
5546
+ payloadBuildStart: payloadBuildStart,
5547
+ payloadBuildEnd: payloadBuildEnd,
5548
+ uploads: uploadMeasurements,
5549
+ apiCallStart: apiCallStart,
5550
+ apiCallEnd: apiCallEnd,
5551
+ responseParseStart: responseParseStart,
5552
+ responseParseEnd: responseParseEnd,
5553
+ failedAt: failedAt
5554
+ });
5480
5555
  store.setState({
5481
- lastSubmissionTimings: buildSubmissionTimings({
5482
- startedAt: startedAt,
5483
- endedAt: endedAt,
5484
- payloadBuildStart: payloadBuildStart,
5485
- payloadBuildEnd: payloadBuildEnd,
5486
- uploads: uploadMeasurements,
5487
- apiCallStart: apiCallStart,
5488
- apiCallEnd: apiCallEnd,
5489
- responseParseStart: responseParseStart,
5490
- responseParseEnd: responseParseEnd,
5491
- failedAt: failedAt
5492
- })
5556
+ lastSubmissionTimings: timings
5493
5557
  });
5494
- return _context7.finish(24);
5495
- case 25:
5558
+ return _context7.finish(25);
5559
+ case 26:
5560
+ if (kind === 'post' && built.response) {
5561
+ _built = built, _response = _built.response, _request = _built.request;
5562
+ notifySafely$1('onResponseReceived', function () {
5563
+ return config.onResponseReceived == null ? void 0 : config.onResponseReceived(_response, _request);
5564
+ });
5565
+ }
5566
+ return _context7.abrupt("return", _extends({}, built, {
5567
+ timings: timings
5568
+ }));
5569
+ case 27:
5496
5570
  case "end":
5497
5571
  return _context7.stop();
5498
5572
  }
5499
- }, _callee7, null, [[3, 23, 24, 25], [4, 6], [9, 20], [10, 12]]);
5573
+ }, _callee7, null, [[3, 24, 25, 26], [4, 6], [9, 20], [10, 12]]);
5574
+ }));
5575
+ return _runPipeline.apply(this, arguments);
5576
+ }
5577
+ function submit(artifacts, options) {
5578
+ return runPipeline(artifacts, options, 'submit').then(function (_ref2) {
5579
+ var response = _ref2.response;
5580
+ return response;
5581
+ });
5582
+ }
5583
+ function post(artifacts, options) {
5584
+ return runPipeline(artifacts, options, 'post');
5585
+ }
5586
+ function handoff(_x9, _x0) {
5587
+ return _handoff.apply(this, arguments);
5588
+ }
5589
+ function _handoff() {
5590
+ _handoff = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(artifacts, options) {
5591
+ var _yield$runPipeline, request, timings;
5592
+ return _regeneratorRuntime.wrap(function (_context8) {
5593
+ while (1) switch (_context8.prev = _context8.next) {
5594
+ case 0:
5595
+ _context8.next = 1;
5596
+ return runPipeline(artifacts, options, 'handoff');
5597
+ case 1:
5598
+ _yield$runPipeline = _context8.sent;
5599
+ request = _yield$runPipeline.request;
5600
+ timings = _yield$runPipeline.timings;
5601
+ return _context8.abrupt("return", {
5602
+ request: request,
5603
+ timings: timings
5604
+ });
5605
+ case 2:
5606
+ case "end":
5607
+ return _context8.stop();
5608
+ }
5609
+ }, _callee8);
5500
5610
  }));
5501
- return _submit.apply(this, arguments);
5611
+ return _handoff.apply(this, arguments);
5502
5612
  }
5503
- function checkLiveness(_x8, _x9) {
5613
+ function checkLiveness(_x1, _x10) {
5504
5614
  return _checkLiveness.apply(this, arguments);
5505
5615
  }
5506
5616
  function _checkLiveness() {
5507
- _checkLiveness = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(imageDataUrl, options) {
5617
+ _checkLiveness = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(imageDataUrl, options) {
5508
5618
  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;
5509
- return _regeneratorRuntime.wrap(function (_context8) {
5510
- while (1) switch (_context8.prev = _context8.next) {
5619
+ return _regeneratorRuntime.wrap(function (_context9) {
5620
+ while (1) switch (_context9.prev = _context9.next) {
5511
5621
  case 0:
5512
5622
  if (options === void 0) {
5513
5623
  options = {};
5514
5624
  }
5515
- _context8.prev = 1;
5625
+ _context9.prev = 1;
5516
5626
  selfie = imageDataUrl;
5517
5627
  if (!(options.useDocumentServiceForLivenessChecks && documentServiceEnabled)) {
5518
- _context8.next = 6;
5628
+ _context9.next = 6;
5519
5629
  break;
5520
5630
  }
5521
5631
  if (!selfie.startsWith('data:')) {
5522
5632
  selfie = "data:image/jpeg;base64," + selfie;
5523
5633
  }
5524
- _context8.prev = 2;
5525
- _context8.next = 3;
5634
+ _context9.prev = 2;
5635
+ _context9.next = 3;
5526
5636
  return performUpload(dataUrlToBlob(selfie), withJobTaskMetadata({
5527
5637
  filename: 'liveness',
5528
5638
  filetype: 'image/jpeg'
5529
- }, options.jobID, options.taskID));
5639
+ }, options.jobID, options.taskID), currentRoute());
5530
5640
  case 3:
5531
- selfie = _context8.sent;
5532
- _context8.next = 5;
5641
+ selfie = _context9.sent;
5642
+ _context9.next = 5;
5533
5643
  break;
5534
5644
  case 4:
5535
- _context8.prev = 4;
5536
- _t1 = _context8["catch"](2);
5645
+ _context9.prev = 4;
5646
+ _t1 = _context9["catch"](2);
5537
5647
  throw new NetworkError(_t1 instanceof Error ? _t1.message : String(_t1));
5538
5648
  case 5:
5539
- _context8.next = 7;
5649
+ _context9.next = 7;
5540
5650
  break;
5541
5651
  case 6:
5542
5652
  selfie = dataUrlToBase64Sync$1(selfie);
@@ -5604,19 +5714,19 @@ function createIdmissionClient(config) {
5604
5714
  attestationAttached: attestationAttached
5605
5715
  });
5606
5716
  if (!config.onBeforeLivenessCheck) {
5607
- _context8.next = 9;
5717
+ _context9.next = 9;
5608
5718
  break;
5609
5719
  }
5610
- _context8.next = 8;
5720
+ _context9.next = 8;
5611
5721
  return config.onBeforeLivenessCheck(request);
5612
5722
  case 8:
5613
- result = _context8.sent;
5723
+ result = _context9.sent;
5614
5724
  if (result) request = result;
5615
5725
  case 9:
5616
5726
  endpoint = liveCheckEndpoint(!!options.idCardForFaceMatch);
5617
5727
  sessionId = store.getState().session.sessionId;
5618
- _context8.prev = 10;
5619
- _context8.next = 11;
5728
+ _context9.prev = 10;
5729
+ _context9.next = 11;
5620
5730
  return timedFetch(urls.submissionUrl + endpoint, {
5621
5731
  method: 'POST',
5622
5732
  // SubmissionProvider.tsx:1447 — sourced from the same
@@ -5627,36 +5737,36 @@ function createIdmissionClient(config) {
5627
5737
  body: JSON.stringify(request)
5628
5738
  });
5629
5739
  case 11:
5630
- response = _context8.sent;
5631
- _context8.next = 13;
5740
+ response = _context9.sent;
5741
+ _context9.next = 13;
5632
5742
  break;
5633
5743
  case 12:
5634
- _context8.prev = 12;
5635
- _t10 = _context8["catch"](10);
5744
+ _context9.prev = 12;
5745
+ _t10 = _context9["catch"](10);
5636
5746
  throw new NetworkError(_t10 instanceof Error ? _t10.message : String(_t10));
5637
5747
  case 13:
5638
5748
  if (response.ok) {
5639
- _context8.next = 18;
5749
+ _context9.next = 18;
5640
5750
  break;
5641
5751
  }
5642
5752
  if (!(response.status === 401 || response.status === 403)) {
5643
- _context8.next = 15;
5753
+ _context9.next = 15;
5644
5754
  break;
5645
5755
  }
5646
5756
  _t11 = AuthenticationError;
5647
5757
  _t12 = response.status;
5648
- _context8.next = 14;
5758
+ _context9.next = 14;
5649
5759
  return response.text();
5650
5760
  case 14:
5651
- _t13 = _context8.sent;
5761
+ _t13 = _context9.sent;
5652
5762
  throw new _t11(_t12, _t13);
5653
5763
  case 15:
5654
- _context8.next = 16;
5764
+ _context9.next = 16;
5655
5765
  return response.text();
5656
5766
  case 16:
5657
- statusMessage = _context8.sent;
5767
+ statusMessage = _context9.sent;
5658
5768
  if (!(!statusMessage || statusMessage === 'Load failed')) {
5659
- _context8.next = 17;
5769
+ _context9.next = 17;
5660
5770
  break;
5661
5771
  }
5662
5772
  throw new NetworkError(statusMessage);
@@ -5666,12 +5776,12 @@ function createIdmissionClient(config) {
5666
5776
  statusMessage: statusMessage
5667
5777
  });
5668
5778
  case 18:
5669
- _context8.next = 19;
5779
+ _context9.next = 19;
5670
5780
  return response.json();
5671
5781
  case 19:
5672
- livenessResponse = _context8.sent;
5782
+ livenessResponse = _context9.sent;
5673
5783
  if (!(livenessResponse.status.statusCode !== '000')) {
5674
- _context8.next = 20;
5784
+ _context9.next = 20;
5675
5785
  break;
5676
5786
  }
5677
5787
  throw new SubmissionError(livenessResponse.status);
@@ -5684,7 +5794,7 @@ function createIdmissionClient(config) {
5684
5794
  // unconditional here — a deliberate scope narrowing, not a silent drop.
5685
5795
  livenessToken = (_livenessResponse$res = livenessResponse.resultData) == null ? void 0 : _livenessResponse$res.livenessToken;
5686
5796
  if (!(options.softFail && !isLiveFaceConfirmed((_livenessResponse$res2 = livenessResponse.resultData) == null ? void 0 : _livenessResponse$res2.verificationResult))) {
5687
- _context8.next = 21;
5797
+ _context9.next = 21;
5688
5798
  break;
5689
5799
  }
5690
5800
  // Current sdk2 (SubmissionProvider.tsx checkLiveness): softFail also
@@ -5693,21 +5803,21 @@ function createIdmissionClient(config) {
5693
5803
  // non-live capture) and hand back a typed failure that still carries
5694
5804
  // the response so callers can read the detection flags.
5695
5805
  livenessToken = undefined;
5696
- return _context8.abrupt("return", {
5806
+ return _context9.abrupt("return", {
5697
5807
  ok: false,
5698
5808
  error: new Error("Liveness not confirmed: " + ((_livenessResponse$res3 = (_livenessResponse$res4 = livenessResponse.resultData) == null ? void 0 : _livenessResponse$res4.verificationResult) != null ? _livenessResponse$res3 : 'no verificationResult')),
5699
5809
  response: livenessResponse
5700
5810
  });
5701
5811
  case 21:
5702
- return _context8.abrupt("return", {
5812
+ return _context9.abrupt("return", {
5703
5813
  ok: true,
5704
5814
  response: livenessResponse
5705
5815
  });
5706
5816
  case 22:
5707
- _context8.prev = 22;
5708
- _t14 = _context8["catch"](1);
5817
+ _context9.prev = 22;
5818
+ _t14 = _context9["catch"](1);
5709
5819
  if (!options.softFail) {
5710
- _context8.next = 23;
5820
+ _context9.next = 23;
5711
5821
  break;
5712
5822
  }
5713
5823
  // Caller is treating this as a best-effort check. Don't surface the
@@ -5715,7 +5825,7 @@ function createIdmissionClient(config) {
5715
5825
  // typed failure result instead of sdk2's silent `undefined` (deliberate
5716
5826
  // divergence #3).
5717
5827
  livenessToken = undefined;
5718
- return _context8.abrupt("return", {
5828
+ return _context9.abrupt("return", {
5719
5829
  ok: false,
5720
5830
  error: _t14
5721
5831
  });
@@ -5729,32 +5839,32 @@ function createIdmissionClient(config) {
5729
5839
  throw err;
5730
5840
  case 24:
5731
5841
  case "end":
5732
- return _context8.stop();
5842
+ return _context9.stop();
5733
5843
  }
5734
- }, _callee8, null, [[1, 22], [2, 4], [10, 12]]);
5844
+ }, _callee9, null, [[1, 22], [2, 4], [10, 12]]);
5735
5845
  }));
5736
5846
  return _checkLiveness.apply(this, arguments);
5737
5847
  }
5738
- function clientUploadDocument(_x0, _x1) {
5848
+ function clientUploadDocument(_x11, _x12) {
5739
5849
  return _clientUploadDocument.apply(this, arguments);
5740
5850
  }
5741
5851
  function _clientUploadDocument() {
5742
- _clientUploadDocument = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(blob, metadata) {
5743
- return _regeneratorRuntime.wrap(function (_context9) {
5744
- while (1) switch (_context9.prev = _context9.next) {
5852
+ _clientUploadDocument = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(blob, metadata) {
5853
+ return _regeneratorRuntime.wrap(function (_context0) {
5854
+ while (1) switch (_context0.prev = _context0.next) {
5745
5855
  case 0:
5746
5856
  if (documentServiceEnabled) {
5747
- _context9.next = 1;
5857
+ _context0.next = 1;
5748
5858
  break;
5749
5859
  }
5750
5860
  throw new Error('document upload is disabled: no documentServiceUrl configured');
5751
5861
  case 1:
5752
- return _context9.abrupt("return", performUpload(blob, metadata != null ? metadata : {}));
5862
+ return _context0.abrupt("return", performUpload(blob, metadata != null ? metadata : {}, currentRoute()));
5753
5863
  case 2:
5754
5864
  case "end":
5755
- return _context9.stop();
5865
+ return _context0.stop();
5756
5866
  }
5757
- }, _callee9);
5867
+ }, _callee0);
5758
5868
  }));
5759
5869
  return _clientUploadDocument.apply(this, arguments);
5760
5870
  }
@@ -5770,6 +5880,8 @@ function createIdmissionClient(config) {
5770
5880
  validateSession: validateSessionMethod,
5771
5881
  retrySession: retrySession,
5772
5882
  submit: submit,
5883
+ post: post,
5884
+ handoff: handoff,
5773
5885
  checkLiveness: checkLiveness,
5774
5886
  uploadDocument: clientUploadDocument
5775
5887
  };
@@ -7562,12 +7674,17 @@ var SdkLanguageContext = /*#__PURE__*/createContext(undefined);
7562
7674
  * Binds one rendered SDK tree to its requested language. A fixed translator
7563
7675
  * avoids waiting for a post-render changeLanguage() effect and keeps SSR and
7564
7676
  * concurrently mounted SDK views independent of the shared detector instance.
7677
+ *
7678
+ * An unset `lang` keeps whatever scope encloses it (or none), so a caller can
7679
+ * render the provider unconditionally: toggling `lang` between unset and set
7680
+ * then never changes the element tree, and never remounts the subtree.
7565
7681
  */
7566
7682
  function SdkLanguageProvider(_ref) {
7567
7683
  var children = _ref.children,
7568
7684
  lang = _ref.lang;
7685
+ var inherited = useContext(SdkLanguageContext);
7569
7686
  return /*#__PURE__*/createElement(SdkLanguageContext.Provider, {
7570
- value: lang === 'auto' ? detectedLanguage : lang
7687
+ value: lang === undefined ? inherited : lang === 'auto' ? detectedLanguage : lang
7571
7688
  }, children);
7572
7689
  }
7573
7690
  /**
@@ -38389,7 +38506,9 @@ function SubmissionProvider(_ref) {
38389
38506
  onComplete = _ref.onComplete,
38390
38507
  onApproved = _ref.onApproved,
38391
38508
  onDenied = _ref.onDenied,
38392
- onRequestFailure = _ref.onRequestFailure;
38509
+ onSubmissionFailure = _ref.onSubmissionFailure,
38510
+ onRequestFailure = _ref.onRequestFailure,
38511
+ mode = _ref.mode;
38393
38512
  var progress = useCaptureObserver();
38394
38513
  var clientState = useSyncExternalStore(client.subscribe, client.getState, client.getState);
38395
38514
  var _useAuthState = useAuthState(),
@@ -38402,10 +38521,15 @@ function SubmissionProvider(_ref) {
38402
38521
  _useState4 = _slicedToArray(_useState3, 2),
38403
38522
  localError = _useState4[0],
38404
38523
  setLocalError = _useState4[1];
38405
- var _useState5 = useState(false),
38524
+ var _useState5 = useState(IDLE_ATTEMPT),
38406
38525
  _useState6 = _slicedToArray(_useState5, 2),
38407
- resubmitting = _useState6[0],
38408
- setResubmitting = _useState6[1];
38526
+ attempt = _useState6[0],
38527
+ setAttempt = _useState6[1];
38528
+ var reportFailure = onSubmissionFailure != null ? onSubmissionFailure : onRequestFailure;
38529
+ var _useState7 = useState(false),
38530
+ _useState8 = _slicedToArray(_useState7, 2),
38531
+ resubmitting = _useState8[0],
38532
+ setResubmitting = _useState8[1];
38409
38533
  var lastArtifactsRef = useRef(null);
38410
38534
  var submitInFlightRef = useRef(null);
38411
38535
  var resubmitInFlightRef = useRef(null);
@@ -38423,6 +38547,65 @@ function SubmissionProvider(_ref) {
38423
38547
  }) : incoming;
38424
38548
  // Store the merged artifacts so a resubmit carries location too.
38425
38549
  lastArtifactsRef.current = artifacts;
38550
+ if (mode !== undefined) {
38551
+ // Registered before anything customer-supplied runs, so a throw from
38552
+ // a notification can never leave the flow without a status.
38553
+ setAttempt(_extends({}, IDLE_ATTEMPT, {
38554
+ status: SubmissionStatus.SUBMITTING
38555
+ }));
38556
+ notifySafely('onSubmissionStarted', function () {
38557
+ return onSubmissionStarted == null ? void 0 : onSubmissionStarted(artifacts);
38558
+ });
38559
+ var _unbindProgress = bindSubmissionObserver(artifacts, progress);
38560
+ var _promise = runAttempt(client, mode, artifacts, _extends({}, options, {
38561
+ action: action
38562
+ })).then(function (outcome) {
38563
+ setAttempt(_extends({}, outcome, {
38564
+ status: SubmissionStatus.SUBMITTED,
38565
+ error: null
38566
+ }));
38567
+ var response = outcome.response,
38568
+ request = outcome.request;
38569
+ if (response === null) {
38570
+ // Terminal once called; the handler is never awaited.
38571
+ if (typeof mode === 'object') {
38572
+ notifySafely('submitMode.handoff', function () {
38573
+ return mode.handoff(request);
38574
+ });
38575
+ }
38576
+ return null;
38577
+ }
38578
+ notifySafely('onComplete', function () {
38579
+ return onComplete == null ? void 0 : onComplete(response);
38580
+ });
38581
+ if (isApprovedResponse(action, response)) {
38582
+ notifySafely('onApproved', function () {
38583
+ return onApproved == null ? void 0 : onApproved(response);
38584
+ });
38585
+ } else {
38586
+ notifySafely('onDenied', function () {
38587
+ return onDenied == null ? void 0 : onDenied(response);
38588
+ });
38589
+ }
38590
+ return response;
38591
+ }, function (cause) {
38592
+ var error = cause instanceof Error ? cause : new Error(String(cause));
38593
+ setAttempt(_extends({}, IDLE_ATTEMPT, {
38594
+ status: SubmissionStatus.FAILED,
38595
+ error: error
38596
+ }));
38597
+ notifySafely('onSubmissionFailure', function () {
38598
+ return reportFailure == null ? void 0 : reportFailure(error);
38599
+ });
38600
+ throw error;
38601
+ })["finally"](function () {
38602
+ _unbindProgress();
38603
+ submitInFlightRef.current = null;
38604
+ setResubmitting(false);
38605
+ });
38606
+ submitInFlightRef.current = _promise;
38607
+ return _promise;
38608
+ }
38426
38609
  setSubmissionResponse(null);
38427
38610
  setLocalError(null);
38428
38611
  onSubmissionStarted == null || onSubmissionStarted(artifacts);
@@ -38443,7 +38626,7 @@ function SubmissionProvider(_ref) {
38443
38626
  })["catch"](function (cause) {
38444
38627
  var error = cause instanceof Error ? cause : new Error(String(cause));
38445
38628
  setLocalError(error);
38446
- onRequestFailure == null || onRequestFailure(error);
38629
+ reportFailure == null || reportFailure(error);
38447
38630
  throw error;
38448
38631
  })["finally"](function () {
38449
38632
  unbindProgress();
@@ -38452,7 +38635,7 @@ function SubmissionProvider(_ref) {
38452
38635
  });
38453
38636
  submitInFlightRef.current = promise;
38454
38637
  return promise;
38455
- }, [action, client, geolocation, onApproved, onComplete, onDenied, onRequestFailure, onSubmissionStarted, options, progress]);
38638
+ }, [action, client, geolocation, onApproved, onComplete, onDenied, reportFailure, onSubmissionStarted, options, progress, mode]);
38456
38639
  var resubmit = useMemo(function () {
38457
38640
  if (!authState.session.canRefreshSession) return null;
38458
38641
  return function () {
@@ -38497,22 +38680,121 @@ function SubmissionProvider(_ref) {
38497
38680
  }, [authState.session.canRefreshSession, client, submit]);
38498
38681
  var value = useMemo(function () {
38499
38682
  var _ref3, _clientState$lastSubm, _clientState$lastSubm2;
38683
+ if (mode !== undefined) {
38684
+ return {
38685
+ action: action,
38686
+ submit: submit,
38687
+ submissionStatus: resubmitting ? SubmissionStatus.SUBMITTING : attempt.status,
38688
+ submissionResponse: attempt.response,
38689
+ submissionError: attempt.error,
38690
+ lastSubmissionTimings: attempt.timings,
38691
+ lastSubmissionRequest: attempt.request,
38692
+ resubmit: resubmit
38693
+ };
38694
+ }
38500
38695
  return {
38501
38696
  action: action,
38502
38697
  submit: submit,
38503
- submissionStatus: resubmitting ? SubmissionStatus.SUBMITTING : clientState.submissionStatus,
38698
+ // A rejection before the client records anything (an unsupported
38699
+ // action, an unvalidated session) leaves the client at READY, which the
38700
+ // wizard renders as its submitting screen; the local error is the
38701
+ // failure it would otherwise never show.
38702
+ submissionStatus: resubmitting ? SubmissionStatus.SUBMITTING : localError && clientState.submissionStatus === SubmissionStatus.READY ? SubmissionStatus.FAILED : clientState.submissionStatus,
38504
38703
  submissionResponse: submissionResponse,
38505
38704
  submissionError: (_ref3 = localError != null ? localError : clientState.submissionError) != null ? _ref3 : null,
38506
38705
  lastSubmissionTimings: (_clientState$lastSubm = clientState.lastSubmissionTimings) != null ? _clientState$lastSubm : null,
38507
38706
  lastSubmissionRequest: (_clientState$lastSubm2 = clientState.lastSubmissionRequest) != null ? _clientState$lastSubm2 : null,
38508
38707
  resubmit: resubmit
38509
38708
  };
38510
- }, [action, clientState.lastSubmissionRequest, clientState.lastSubmissionTimings, clientState.submissionError, clientState.submissionStatus, localError, resubmit, resubmitting, submissionResponse, submit]);
38709
+ }, [action, attempt, clientState.lastSubmissionRequest, clientState.lastSubmissionTimings, clientState.submissionError, clientState.submissionStatus, localError, mode, resubmit, resubmitting, submissionResponse, submit]);
38511
38710
  return jsx(SubmissionContext.Provider, {
38512
38711
  value: value,
38513
38712
  children: children
38514
38713
  });
38515
38714
  }
38715
+ var IDLE_ATTEMPT = {
38716
+ status: SubmissionStatus.READY,
38717
+ response: null,
38718
+ request: null,
38719
+ timings: null,
38720
+ error: null
38721
+ };
38722
+ /**
38723
+ * One explicit-mode attempt through the client's `post()` or `handoff()`.
38724
+ * Never falls back to `submit()`: that would let the deprecated
38725
+ * `config.onSubmit` decide what an explicit mode already decided.
38726
+ */
38727
+ function runAttempt(_x, _x2, _x3, _x4) {
38728
+ return _runAttempt.apply(this, arguments);
38729
+ }
38730
+ function _runAttempt() {
38731
+ _runAttempt = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(client, mode, artifacts, options) {
38732
+ var _yield$client$handoff, request, timings;
38733
+ return _regeneratorRuntime.wrap(function (_context2) {
38734
+ while (1) switch (_context2.prev = _context2.next) {
38735
+ case 0:
38736
+ if (!(mode === 'capture')) {
38737
+ _context2.next = 1;
38738
+ break;
38739
+ }
38740
+ throw new Error("submitMode 'capture' does not submit; the flow reports onCaptured instead");
38741
+ case 1:
38742
+ if (!(mode === 'post')) {
38743
+ _context2.next = 3;
38744
+ break;
38745
+ }
38746
+ if (client.post) {
38747
+ _context2.next = 2;
38748
+ break;
38749
+ }
38750
+ throw missingMethod('post', "submitMode 'post'");
38751
+ case 2:
38752
+ return _context2.abrupt("return", client.post(artifacts, options));
38753
+ case 3:
38754
+ if (client.handoff) {
38755
+ _context2.next = 4;
38756
+ break;
38757
+ }
38758
+ throw missingMethod('handoff', 'submitMode { handoff }');
38759
+ case 4:
38760
+ _context2.next = 5;
38761
+ return client.handoff(artifacts, options);
38762
+ case 5:
38763
+ _yield$client$handoff = _context2.sent;
38764
+ request = _yield$client$handoff.request;
38765
+ timings = _yield$client$handoff.timings;
38766
+ return _context2.abrupt("return", {
38767
+ request: request,
38768
+ timings: timings,
38769
+ response: null
38770
+ });
38771
+ case 6:
38772
+ case "end":
38773
+ return _context2.stop();
38774
+ }
38775
+ }, _callee2);
38776
+ }));
38777
+ return _runAttempt.apply(this, arguments);
38778
+ }
38779
+ function missingMethod(method, needs) {
38780
+ return new Error(needs + " needs client." + method + "(), which this client does not have. " + 'Create the client with createIdmissionClient or useIdmissionClient.');
38781
+ }
38782
+ /**
38783
+ * Runs a customer callback whose failure must not change an outcome that is
38784
+ * already settled: a throw or a rejected promise is logged, never rethrown.
38785
+ */
38786
+ function notifySafely(name, notify) {
38787
+ try {
38788
+ var result = notify();
38789
+ if (result instanceof Promise) {
38790
+ result["catch"](function (e) {
38791
+ return warn(name + " rejected", e);
38792
+ });
38793
+ }
38794
+ } catch (e) {
38795
+ warn(name + " threw", e);
38796
+ }
38797
+ }
38516
38798
  function useSubmission() {
38517
38799
  var context = useContext(SubmissionContext);
38518
38800
  if (!context) {
@@ -40377,11 +40659,12 @@ function RemoteDiagnosticsMount(_ref) {
40377
40659
  }
40378
40660
 
40379
40661
  var _templateObject$1, _templateObject2$1, _templateObject3, _templateObject4;
40380
- var _excluded$9 = ["client", "action", "submission", "theme", "className", "geolocationEnabled", "geolocationRequired", "captureProgress", "remoteDiagnostics", "loadingSpinner", "showEnrollmentId", "lang", "children"];
40662
+ var _excluded$9 = ["client", "action", "submission", "submitMode", "theme", "className", "geolocationEnabled", "geolocationRequired", "captureProgress", "remoteDiagnostics", "loadingSpinner", "showEnrollmentId", "lang", "children"];
40381
40663
  function FlowChassis(_ref) {
40382
40664
  var client = _ref.client,
40383
40665
  action = _ref.action,
40384
40666
  submission = _ref.submission,
40667
+ submitMode = _ref.submitMode,
40385
40668
  _ref$theme = _ref.theme,
40386
40669
  theme = _ref$theme === void 0 ? 'default' : _ref$theme,
40387
40670
  className = _ref.className,
@@ -40404,7 +40687,7 @@ function FlowChassis(_ref) {
40404
40687
  client: client,
40405
40688
  children: [jsx(RemoteDiagnosticsMount, {
40406
40689
  remoteDiagnostics: remoteDiagnostics
40407
- }), jsx(FlowLanguage, {
40690
+ }), jsx(SdkLanguageProvider, {
40408
40691
  lang: lang,
40409
40692
  children: jsx(ThemeProvider, {
40410
40693
  theme: theme,
@@ -40414,6 +40697,7 @@ function FlowChassis(_ref) {
40414
40697
  client: client,
40415
40698
  action: action,
40416
40699
  options: submission,
40700
+ mode: submitMode,
40417
40701
  geolocation: geolocation.position
40418
40702
  }, callbacks, {
40419
40703
  children: jsx(FlowPage, {
@@ -40432,17 +40716,8 @@ function FlowChassis(_ref) {
40432
40716
  })
40433
40717
  });
40434
40718
  }
40435
- /** Scopes the flow's own screens to `lang`; a no-op when the flow sets none. */
40436
- function FlowLanguage(_ref2) {
40437
- var lang = _ref2.lang,
40438
- children = _ref2.children;
40439
- return lang === undefined ? children : jsx(SdkLanguageProvider, {
40440
- lang: lang,
40441
- children: children
40442
- });
40443
- }
40444
- function AuthGate(_ref3) {
40445
- var children = _ref3.children;
40719
+ function AuthGate(_ref2) {
40720
+ var children = _ref2.children;
40446
40721
  var _useAuthState = useAuthState(),
40447
40722
  state = _useAuthState.state,
40448
40723
  retry = _useAuthState.retry;
@@ -40493,10 +40768,10 @@ function AuthGate(_ref3) {
40493
40768
  * enrollment-ID banner sits outside that body, so stages and their in-body
40494
40769
  * overlays lay out below it instead of over it.
40495
40770
  */
40496
- function FlowPage(_ref4) {
40497
- var className = _ref4.className,
40498
- enrollmentId = _ref4.enrollmentId,
40499
- children = _ref4.children;
40771
+ function FlowPage(_ref3) {
40772
+ var className = _ref3.className,
40773
+ enrollmentId = _ref3.enrollmentId,
40774
+ children = _ref3.children;
40500
40775
  var _useTheme = useTheme(),
40501
40776
  Header = _useTheme.header,
40502
40777
  Footer = _useTheme.footer;
@@ -40606,8 +40881,8 @@ function impliedSkipSuccessScreen(explicit, introActive) {
40606
40881
  */
40607
40882
  function inheritFlowSettings(step, flow) {
40608
40883
  var inherited = {};
40609
- for (var _i = 0, _Object$keys = Object.keys(flow); _i < _Object$keys.length; _i++) {
40610
- var key = _Object$keys[_i];
40884
+ for (var key in flow) {
40885
+ if (!Object.prototype.hasOwnProperty.call(flow, key)) continue;
40611
40886
  if ((step == null ? void 0 : step[key]) === undefined && flow[key] !== undefined) {
40612
40887
  inherited[key] = flow[key];
40613
40888
  }
@@ -40743,7 +41018,7 @@ function withVirtualCameras(camera, allowVirtualCameras) {
40743
41018
  return base;
40744
41019
  }
40745
41020
 
40746
- 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"];
41021
+ 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"];
40747
41022
  var EMPTY_ID_CAPTURE$3 = {};
40748
41023
  var EMPTY_SIGNATURE_CAPTURE$5 = {};
40749
41024
  var EMPTY_ID_VIEW$3 = {};
@@ -40760,8 +41035,8 @@ function IdValidationFlow(_ref) {
40760
41035
  submission = _ref$submission === void 0 ? EMPTY_SUBMISSION$6 : _ref$submission,
40761
41036
  _ref$initialArtifacts = _ref.initialArtifacts,
40762
41037
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$9 : _ref$initialArtifacts,
40763
- _ref$captureOnly = _ref.captureOnly,
40764
- captureOnly = _ref$captureOnly === void 0 ? false : _ref$captureOnly,
41038
+ submitMode = _ref.submitMode,
41039
+ captureOnly = _ref.captureOnly,
40765
41040
  signatureController = _ref.signatureController,
40766
41041
  _ref$signatureCapture = _ref.signatureCapture,
40767
41042
  signatureCapture = _ref$signatureCapture === void 0 ? EMPTY_SIGNATURE_CAPTURE$5 : _ref$signatureCapture,
@@ -40920,10 +41195,12 @@ function IdValidationFlow(_ref) {
40920
41195
  successIssuerCaptionText: 'confirmed'
40921
41196
  }
40922
41197
  });
41198
+ var mode = submitMode != null ? submitMode : captureOnly ? 'capture' : undefined;
40923
41199
  return jsxs(FlowChassis, _extends({
40924
41200
  client: client,
40925
41201
  action: SubmissionAction.VALIDATE,
40926
41202
  submission: submission,
41203
+ submitMode: mode,
40927
41204
  theme: theme,
40928
41205
  className: className,
40929
41206
  lang: lang
@@ -40931,7 +41208,7 @@ function IdValidationFlow(_ref) {
40931
41208
  children: [jsx(CompositeWizard, _extends({}, ringScreens, {
40932
41209
  steps: steps,
40933
41210
  initialArtifacts: initialArtifacts,
40934
- captureOnly: captureOnly,
41211
+ captureOnly: mode === 'capture',
40935
41212
  showResultScreen: showResultScreen != null ? showResultScreen : showSuccessScreen,
40936
41213
  showDiagnostics: showDiagnostics,
40937
41214
  onArtifactsCollected: onCaptured,
@@ -41391,6 +41668,10 @@ function SignatureKYCFlow(_ref) {
41391
41668
  captureProgress = _ref.captureProgress,
41392
41669
  remoteDiagnostics = _ref.remoteDiagnostics,
41393
41670
  loadingSpinner = _ref.loadingSpinner,
41671
+ _ref$submitMode = _ref.submitMode,
41672
+ submitMode = _ref$submitMode === void 0 ? 'capture' : _ref$submitMode,
41673
+ onSubmissionStarted = _ref.onSubmissionStarted,
41674
+ onSubmissionFailure = _ref.onSubmissionFailure,
41394
41675
  onCaptured = _ref.onCaptured,
41395
41676
  onCaptureError = _ref.onCaptureError;
41396
41677
  // Flow-wide settings reach each step unless its own bag sets them.
@@ -41591,8 +41872,8 @@ function SignatureKYCFlow(_ref) {
41591
41872
  completedRef.current = true;
41592
41873
  artifactsRef.current = mergeSubmissionArtifacts(artifactsRef.current, artifacts);
41593
41874
  setStage('complete');
41594
- onCaptured == null || onCaptured(artifactsRef.current);
41595
- }, [onCaptured]);
41875
+ if (submitMode === 'capture') onCaptured == null || onCaptured(artifactsRef.current);
41876
+ }, [onCaptured, submitMode]);
41596
41877
  var handleLivenessFailureExit = useCallback(function () {
41597
41878
  onExitAfterLivenessFailure == null || onExitAfterLivenessFailure();
41598
41879
  if (allowSignatureAfterLivenessCheckFailure) handleLivenessDone();
@@ -41601,6 +41882,9 @@ function SignatureKYCFlow(_ref) {
41601
41882
  client: client,
41602
41883
  action: SubmissionAction.NONE,
41603
41884
  submission: submission,
41885
+ submitMode: submitMode,
41886
+ onSubmissionStarted: onSubmissionStarted,
41887
+ onSubmissionFailure: onSubmissionFailure,
41604
41888
  theme: theme,
41605
41889
  className: className,
41606
41890
  lang: lang,
@@ -41610,8 +41894,10 @@ function SignatureKYCFlow(_ref) {
41610
41894
  remoteDiagnostics: remoteDiagnostics,
41611
41895
  loadingSpinner: loadingSpinner,
41612
41896
  children: [jsx(CaptureProgressCompletion, {
41613
- completed: stage === 'complete'
41614
- }), stage !== 'complete' ? jsxs(HandoffRoot, {
41897
+ completed: stage === 'complete' && submitMode === 'capture'
41898
+ }), stage === 'complete' && submitMode !== 'capture' ? jsx(SignatureHandoff, {
41899
+ artifacts: artifactsRef.current
41900
+ }) : null, stage !== 'complete' ? jsxs(HandoffRoot, {
41615
41901
  children: [jsx(SignatureCaptureView, _extends({}, signatureView, {
41616
41902
  skipSuccessScreen: impliedSkipSuccessScreen(signatureView.skipSuccessScreen, isRingIntroActive(faceView)),
41617
41903
  controller: resolvedSignatureController,
@@ -41661,6 +41947,44 @@ function SignatureKYCFlow(_ref) {
41661
41947
  }) : null]
41662
41948
  });
41663
41949
  }
41950
+ /**
41951
+ * Hands the finished capture off once the session has passed: a finishing
41952
+ * screen while the request is built, a retry screen if that fails, and
41953
+ * nothing once it has been handed off.
41954
+ */
41955
+ function SignatureHandoff(_ref3) {
41956
+ var artifacts = _ref3.artifacts;
41957
+ var _useSubmission = useSubmission(),
41958
+ action = _useSubmission.action,
41959
+ submit = _useSubmission.submit,
41960
+ submissionStatus = _useSubmission.submissionStatus,
41961
+ submissionError = _useSubmission.submissionError;
41962
+ var sessionReady = useSessionReady();
41963
+ var startedRef = useRef(false);
41964
+ // The provider reports a failure itself; these catches only keep the
41965
+ // rejection from going unhandled.
41966
+ useEffect(function () {
41967
+ if (!sessionReady || startedRef.current) return;
41968
+ startedRef.current = true;
41969
+ submit(artifacts)["catch"](function () {});
41970
+ }, [artifacts, sessionReady, submit]);
41971
+ if (submissionStatus === SubmissionStatus.SUBMITTED) return null;
41972
+ if (submissionStatus === SubmissionStatus.FAILED) {
41973
+ return jsx(SubmissionErrorOverlay, {
41974
+ error: submissionError,
41975
+ onRetry: function onRetry() {
41976
+ submit(artifacts)["catch"](function () {});
41977
+ }
41978
+ });
41979
+ }
41980
+ var text = submissionStatusText(action, artifacts);
41981
+ return jsx(OrbStatusScreen, {
41982
+ state: "working",
41983
+ text: text,
41984
+ accessibleLabel: text,
41985
+ loadingStage: "submission"
41986
+ });
41987
+ }
41664
41988
  /**
41665
41989
  * Black, so iOS Safari's bars read as letterboxing around the camera feed
41666
41990
  * rather than as one more colour a theme has to choose.
@@ -41678,10 +42002,10 @@ var CAMERA_EDGE_COLOR = '#000';
41678
42002
  * no flat strip can sit on its bottom edge unseen: that one is drawn invisibly,
41679
42003
  * as on ID capture's overlay. Opaque, it covered the bottom 12px of the bar.
41680
42004
  */
41681
- function FlowEdgeTint(_ref3) {
42005
+ function FlowEdgeTint(_ref4) {
41682
42006
  var _theme$selfieCapture$, _theme$selfieCapture, _theme$background;
41683
- var surface = _ref3.surface,
41684
- modelsReady = _ref3.modelsReady;
42007
+ var surface = _ref4.surface,
42008
+ modelsReady = _ref4.modelsReady;
41685
42009
  var theme = useTheme();
41686
42010
  if (theme.isFullscreen === false || surface === null) return null;
41687
42011
  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');
@@ -41691,9 +42015,9 @@ function FlowEdgeTint(_ref3) {
41691
42015
  hiddenBottomColor: surface === 'overlay' ? selfieLoadingOverlayBottomEdgeColor(theme, modelsReady) : undefined
41692
42016
  });
41693
42017
  }
41694
- function SelfieTrackerAttachment(_ref4) {
41695
- var controller = _ref4.controller,
41696
- video = _ref4.video;
42018
+ function SelfieTrackerAttachment(_ref5) {
42019
+ var controller = _ref5.controller,
42020
+ video = _ref5.video;
41697
42021
  useEffect(function () {
41698
42022
  if (!video) return;
41699
42023
  void controller.attach(video)["catch"](function () {
@@ -41711,7 +42035,7 @@ var FaceStage = styled.div(_templateObject2 || (_templateObject2 = _taggedTempla
41711
42035
  return props.$visible ? 'block' : 'none';
41712
42036
  });
41713
42037
 
41714
- 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"],
42038
+ 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"],
41715
42039
  _excluded2$2 = ["checkLivenessOptions"];
41716
42040
  var EMPTY_ID_CAPTURE$1 = {};
41717
42041
  var EMPTY_FACE_CAPTURE$2 = {};
@@ -41744,8 +42068,8 @@ function VideoIdValidationFlow(_ref) {
41744
42068
  submission = _ref$submission === void 0 ? EMPTY_SUBMISSION$2 : _ref$submission,
41745
42069
  _ref$initialArtifacts = _ref.initialArtifacts,
41746
42070
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$5 : _ref$initialArtifacts,
41747
- _ref$captureOnly = _ref.captureOnly,
41748
- captureOnly = _ref$captureOnly === void 0 ? false : _ref$captureOnly,
42071
+ submitMode = _ref.submitMode,
42072
+ captureOnly = _ref.captureOnly,
41749
42073
  signatureController = _ref.signatureController,
41750
42074
  _ref$signatureCapture = _ref.signatureCapture,
41751
42075
  signatureCapture = _ref$signatureCapture === void 0 ? EMPTY_SIGNATURE_CAPTURE$2 : _ref$signatureCapture,
@@ -41963,10 +42287,12 @@ function VideoIdValidationFlow(_ref) {
41963
42287
  successIssuerCaptionText: 'confirmed'
41964
42288
  }
41965
42289
  });
42290
+ var mode = submitMode != null ? submitMode : captureOnly ? 'capture' : undefined;
41966
42291
  return jsxs(FlowChassis, _extends({
41967
42292
  client: client,
41968
42293
  action: action,
41969
42294
  submission: submission,
42295
+ submitMode: mode,
41970
42296
  theme: theme,
41971
42297
  className: className,
41972
42298
  lang: lang
@@ -41974,7 +42300,7 @@ function VideoIdValidationFlow(_ref) {
41974
42300
  children: [jsx(CompositeWizard, _extends({}, ringScreens, {
41975
42301
  steps: steps,
41976
42302
  initialArtifacts: initialArtifacts,
41977
- captureOnly: captureOnly,
42303
+ captureOnly: mode === 'capture',
41978
42304
  showResultScreen: showResultScreen != null ? showResultScreen : showSuccessScreen,
41979
42305
  showDiagnostics: showDiagnostics,
41980
42306
  onArtifactsCollected: onCaptured,
@@ -46185,7 +46511,9 @@ function CustomerMatchFlow(_ref) {
46185
46511
  onComplete = _ref.onComplete,
46186
46512
  onCustomerMatched = _ref.onCustomerMatched,
46187
46513
  onCustomerNotMatched = _ref.onCustomerNotMatched,
46514
+ onSubmissionFailure = _ref.onSubmissionFailure,
46188
46515
  onRequestFailure = _ref.onRequestFailure,
46516
+ submitMode = _ref.submitMode,
46189
46517
  onCaptureGuidanceTimeout = _ref.onCaptureGuidanceTimeout,
46190
46518
  onExitCapture = _ref.onExitCapture,
46191
46519
  onExitAfterFailure = _ref.onExitAfterFailure;
@@ -46272,15 +46600,19 @@ function CustomerMatchFlow(_ref) {
46272
46600
  setOutcome('notMatched');
46273
46601
  onCustomerNotMatched == null || onCustomerNotMatched(response);
46274
46602
  }, [onCustomerNotMatched]);
46603
+ var reportFailure = onSubmissionFailure != null ? onSubmissionFailure : onRequestFailure;
46275
46604
  var handleLivenessCheckFailed = useCallback(function (error) {
46276
46605
  setOutcome('failed');
46277
- onRequestFailure == null || onRequestFailure(error);
46278
- }, [onRequestFailure]);
46606
+ reportFailure == null || reportFailure(error);
46607
+ }, [reportFailure]);
46279
46608
  var handleRequestError = useCallback(function (error) {
46280
46609
  errorRef.current = error;
46281
46610
  setOutcome('error');
46282
- onRequestFailure == null || onRequestFailure(error);
46283
- }, [onRequestFailure]);
46611
+ reportFailure == null || reportFailure(error);
46612
+ }, [reportFailure]);
46613
+ var handleHandedOff = useCallback(function () {
46614
+ return setOutcome('handedOff');
46615
+ }, []);
46284
46616
  var handleCaptureGuidanceTimeout = useCallback(function () {
46285
46617
  setOutcome('failed');
46286
46618
  onCaptureGuidanceTimeout == null || onCaptureGuidanceTimeout();
@@ -46321,6 +46653,7 @@ function CustomerMatchFlow(_ref) {
46321
46653
  client: client,
46322
46654
  action: action,
46323
46655
  submission: submission,
46656
+ submitMode: submitMode,
46324
46657
  theme: theme,
46325
46658
  className: className,
46326
46659
  lang: lang,
@@ -46345,6 +46678,7 @@ function CustomerMatchFlow(_ref) {
46345
46678
  onNotMatched: handleNotMatched,
46346
46679
  onLivenessCheckFailed: handleLivenessCheckFailed,
46347
46680
  onRequestError: handleRequestError,
46681
+ onSubmissionIntercepted: handleHandedOff,
46348
46682
  onCaptureGuidanceTimeout: handleCaptureGuidanceTimeout,
46349
46683
  onExitCapture: onExitCapture,
46350
46684
  finishingScreen: {
@@ -46480,6 +46814,84 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
46480
46814
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
46481
46815
  };
46482
46816
 
46817
+ function createIdAndFaceValidationJourneyEvent(event, now) {
46818
+ if (now === void 0) {
46819
+ now = function now() {
46820
+ return new Date();
46821
+ };
46822
+ }
46823
+ return _assign(_assign({}, event), {
46824
+ version: 1,
46825
+ flow: 'id-and-face-validation',
46826
+ timestamp: now().toISOString()
46827
+ });
46828
+ }
46829
+ /**
46830
+ * websdk-ui `CompositeWizardStep.id` -> journey stage.
46831
+ *
46832
+ * Four of the five stage names ARE step ids already; only the additional-
46833
+ * documents step differs, because sdk2's stage vocabulary says
46834
+ * `additional-document-capture` (singular "document") while websdk-ui's step
46835
+ * is `additional-documents`. Unknown ids return undefined so a step this
46836
+ * vocabulary has no name for is silently skipped rather than emitted with a
46837
+ * bogus stage — the same shape as sdk2's partial lookup record.
46838
+ */
46839
+ function journeyStageForStepId(stepId) {
46840
+ switch (stepId) {
46841
+ case 'id-capture':
46842
+ case 'face-liveness':
46843
+ case 'signature-capture':
46844
+ case 'video-signature-capture':
46845
+ return stepId;
46846
+ case 'additional-documents':
46847
+ return 'additional-document-capture';
46848
+ default:
46849
+ return undefined;
46850
+ }
46851
+ }
46852
+ /**
46853
+ * The document types sdk2 reports as `document.captured`. sdk2 filters the
46854
+ * wizard's `onDocumentStored` through this set (`primaryIdDocumentTypes`) so
46855
+ * that a document type outside the journey vocabulary cannot widen the event.
46856
+ * Kept as a predicate rather than a Set: the ES5 UMD bundle target makes
46857
+ * `for..of` over a Set a downlevel hazard, and a switch needs no iteration.
46858
+ */
46859
+ function isJourneyDocumentType(documentType) {
46860
+ return documentType === 'idCardFront' || documentType === 'idCardBack' || documentType === 'passport' || documentType === 'singlePage';
46861
+ }
46862
+ /**
46863
+ * The lazy `flow.started` rule, lifted out of sdk2's `emitJourneyEvent`
46864
+ * closure (IdAndFaceValidation.tsx:521-537) so it can be tested without a
46865
+ * React tree.
46866
+ *
46867
+ * sdk2 does NOT simply emit `flow.started` from a mount effect: it emits it
46868
+ * before the FIRST event of any kind, whatever that event is, and then
46869
+ * suppresses the explicit mount emit. The mount effect and the lazy guard
46870
+ * together mean `flow.started` is always the first event a customer sees,
46871
+ * even if some other event races the effect. That ordering guarantee is the
46872
+ * contract, not the effect.
46873
+ */
46874
+ function createJourneyEmitter(callback, now) {
46875
+ var flowStartedEmitted = false;
46876
+ return function emit(event) {
46877
+ if (!callback) return;
46878
+ if (!flowStartedEmitted) {
46879
+ flowStartedEmitted = true;
46880
+ emitWith(callback, {
46881
+ name: 'flow.started'
46882
+ }, now);
46883
+ }
46884
+ if (event.name !== 'flow.started') emitWith(callback, event, now);
46885
+ };
46886
+ }
46887
+ function emitWith(callback, event, now) {
46888
+ try {
46889
+ callback(createIdAndFaceValidationJourneyEvent(event, now));
46890
+ } catch (error) {
46891
+ warn$1('[IdAndFaceValidation] onJourneyEvent callback failed', error);
46892
+ }
46893
+ }
46894
+
46483
46895
  /**
46484
46896
  * sdk2 exports this as a mutable `string[]`
46485
46897
  * (contexts/AuthStateContext.tsx:25), not a readonly tuple — copied rather
@@ -46652,12 +47064,9 @@ function mapClientConfig(props) {
46652
47064
  documentServiceUrl: (_b = props.documentServiceUrl) !== null && _b !== void 0 ? _b : apiBase ? apiBase + '/files/' : override === null || override === void 0 ? void 0 : override.documentServiceUrl,
46653
47065
  onBeforeSubmit: props.onBeforeSubmit,
46654
47066
  onBeforeLivenessCheck: props.onBeforeLivenessCheck,
46655
- // Straight through to the client, which is where sdk2 put it too
46656
- // (SubmissionProvider.submit). That is what makes the SUPPRESSION uniform:
46657
- // every flow — including the two match flows, which own their own stage
46658
- // machine — submits through this one client, so none of them can post
46659
- // behind an integrator who supplied `onSubmit`.
46660
- onSubmit: props.onSubmit,
47067
+ // 2.x's `onSubmit` is not a client option here: each flow maps it to its
47068
+ // own `submitMode: { handoff }` (see ./props.ts), which follows the prop
47069
+ // live where a client option would be fixed at mount.
46661
47070
  onBeforeDocumentUpload: props.onBeforeDocumentUpload,
46662
47071
  onDocumentUploadProgress: props.onDocumentUploadProgress,
46663
47072
  onDocumentUploaded: props.onDocumentUploaded,
@@ -47667,84 +48076,6 @@ function mapFaceCapture(props, prefixed) {
47667
48076
  };
47668
48077
  }
47669
48078
 
47670
- function createIdAndFaceValidationJourneyEvent(event, now) {
47671
- if (now === void 0) {
47672
- now = function now() {
47673
- return new Date();
47674
- };
47675
- }
47676
- return _assign(_assign({}, event), {
47677
- version: 1,
47678
- flow: 'id-and-face-validation',
47679
- timestamp: now().toISOString()
47680
- });
47681
- }
47682
- /**
47683
- * websdk-ui `CompositeWizardStep.id` -> journey stage.
47684
- *
47685
- * Four of the five stage names ARE step ids already; only the additional-
47686
- * documents step differs, because sdk2's stage vocabulary says
47687
- * `additional-document-capture` (singular "document") while websdk-ui's step
47688
- * is `additional-documents`. Unknown ids return undefined so a step this
47689
- * vocabulary has no name for is silently skipped rather than emitted with a
47690
- * bogus stage — the same shape as sdk2's partial lookup record.
47691
- */
47692
- function journeyStageForStepId(stepId) {
47693
- switch (stepId) {
47694
- case 'id-capture':
47695
- case 'face-liveness':
47696
- case 'signature-capture':
47697
- case 'video-signature-capture':
47698
- return stepId;
47699
- case 'additional-documents':
47700
- return 'additional-document-capture';
47701
- default:
47702
- return undefined;
47703
- }
47704
- }
47705
- /**
47706
- * The document types sdk2 reports as `document.captured`. sdk2 filters the
47707
- * wizard's `onDocumentStored` through this set (`primaryIdDocumentTypes`) so
47708
- * that a document type outside the journey vocabulary cannot widen the event.
47709
- * Kept as a predicate rather than a Set: the ES5 UMD bundle target makes
47710
- * `for..of` over a Set a downlevel hazard, and a switch needs no iteration.
47711
- */
47712
- function isJourneyDocumentType(documentType) {
47713
- return documentType === 'idCardFront' || documentType === 'idCardBack' || documentType === 'passport' || documentType === 'singlePage';
47714
- }
47715
- /**
47716
- * The lazy `flow.started` rule, lifted out of sdk2's `emitJourneyEvent`
47717
- * closure (IdAndFaceValidation.tsx:521-537) so it can be tested without a
47718
- * React tree.
47719
- *
47720
- * sdk2 does NOT simply emit `flow.started` from a mount effect: it emits it
47721
- * before the FIRST event of any kind, whatever that event is, and then
47722
- * suppresses the explicit mount emit. The mount effect and the lazy guard
47723
- * together mean `flow.started` is always the first event a customer sees,
47724
- * even if some other event races the effect. That ordering guarantee is the
47725
- * contract, not the effect.
47726
- */
47727
- function createJourneyEmitter(callback, now) {
47728
- var flowStartedEmitted = false;
47729
- return function emit(event) {
47730
- if (!callback) return;
47731
- if (!flowStartedEmitted) {
47732
- flowStartedEmitted = true;
47733
- emitWith(callback, {
47734
- name: 'flow.started'
47735
- }, now);
47736
- }
47737
- if (event.name !== 'flow.started') emitWith(callback, event, now);
47738
- };
47739
- }
47740
- function emitWith(callback, event, now) {
47741
- try {
47742
- callback(createIdAndFaceValidationJourneyEvent(event, now));
47743
- } catch (error) {
47744
- warn$1('[IdAndFaceValidation] onJourneyEvent callback failed', error);
47745
- }
47746
- }
47747
-
47748
48079
  /**
47749
48080
  * Recursively drops keys whose value is exactly `undefined`.
47750
48081
  *
@@ -47927,6 +48258,16 @@ function mapThemeWithColors(theme, colors) {
47927
48258
  return mergeThemes(mapped, overrides);
47928
48259
  }
47929
48260
 
48261
+ /**
48262
+ * 2.x's `onSubmit` as the flow's hand-off. sdk2 read it on every submission,
48263
+ * so this maps on every render: adding or removing it takes effect from the
48264
+ * next submission. Without it the flow posts.
48265
+ */
48266
+ function mapHandoff(onSubmit) {
48267
+ return onSubmit ? {
48268
+ handoff: onSubmit
48269
+ } : undefined;
48270
+ }
47930
48271
  var EMPTY_CONTEXT = {};
47931
48272
  /** Adapts a 3.0 `(response)` callback back to 2.x's `(response, request)`. */
47932
48273
  function withSubmissionRequest(callback, ctx) {
@@ -48018,13 +48359,13 @@ function mapAdditionalDocumentVerbiage(verbiage) {
48018
48359
  }
48019
48360
  // --- 1. IdValidation ------------------------------------------------------
48020
48361
  function mapIdValidationProps(props, ctx) {
48021
- var _a;
48362
+ var _a, _b;
48022
48363
  if (ctx === void 0) {
48023
48364
  ctx = EMPTY_CONTEXT;
48024
48365
  }
48025
- var _b = mapIdCapture(props),
48026
- capture = _b.capture,
48027
- view = _b.view;
48366
+ var _c = mapIdCapture(props),
48367
+ capture = _c.capture,
48368
+ view = _c.view;
48028
48369
  return compact({
48029
48370
  capture: capture,
48030
48371
  view: view,
@@ -48050,9 +48391,8 @@ function mapIdValidationProps(props, ctx) {
48050
48391
  // `onSubmit` WINS over capture-only, matching sdk2's ordering: its
48051
48392
  // `submit()` checks `onSubmit` before the `action === NONE` branch
48052
48393
  // (SubmissionProvider.tsx:1374 vs :1237), so a capture-only flow still
48053
- // owes the callback its built request. Letting the flow run its normal
48054
- // submit path is what builds that request; the client suppresses the POST.
48055
- captureOnly: props.onSubmit ? undefined : props.captureOnly,
48394
+ // owes the callback its built request.
48395
+ submitMode: (_b = mapHandoff(props.onSubmit)) !== null && _b !== void 0 ? _b : props.captureOnly ? 'capture' : undefined,
48056
48396
  captureAdditionalDocuments: props.captureAdditionalDocuments,
48057
48397
  geolocationEnabled: props.geolocationEnabled,
48058
48398
  geolocationRequired: props.geolocationRequired,
@@ -48073,13 +48413,10 @@ function mapIdValidationProps(props, ctx) {
48073
48413
  // would be a NEW restriction, not parity.
48074
48414
  showResultScreen: props.debugMode,
48075
48415
  showDiagnostics: props.debugMode,
48076
- // `onSubmit` is NOT mapped to a flow prop: it goes to the client config
48077
- // (see mapClientConfig), which is the layer sdk2 put it at and the only
48078
- // one that can suppress the POST for every flow at once.
48079
48416
  onComplete: withSubmissionRequest(props.onComplete, ctx),
48080
48417
  onApproved: withSubmissionRequest(props.onApproved, ctx),
48081
48418
  onDenied: withSubmissionRequest(props.onDenied, ctx),
48082
- onRequestFailure: props.onRequestFailure
48419
+ onSubmissionFailure: props.onRequestFailure
48083
48420
  });
48084
48421
  }
48085
48422
  // --- 2. FaceValidation ----------------------------------------------------
@@ -48271,7 +48608,8 @@ function mapIdAndFaceValidationProps(props, ctx) {
48271
48608
  onComplete: withSubmissionRequest(props.onComplete, ctx),
48272
48609
  onApproved: withSubmissionRequest(props.onApproved, ctx),
48273
48610
  onDenied: withSubmissionRequest(props.onDenied, ctx),
48274
- onRequestFailure: props.onRequestFailure,
48611
+ submitMode: mapHandoff(props.onSubmit),
48612
+ onSubmissionFailure: props.onRequestFailure,
48275
48613
  onCaptureError: props.onRequestFailure
48276
48614
  });
48277
48615
  }
@@ -48426,10 +48764,11 @@ function mapSignatureKYCProps(props, ctx) {
48426
48764
  captureProgress: props.captureProgress,
48427
48765
  remoteDiagnostics: props.remoteDiagnostics,
48428
48766
  loadingSpinner: props.loadingSpinner,
48429
- // `onCaptured` is supplied by the COMPONENT, not here: this flow never
48430
- // enters `client.submit()` on its own, so the façade makes that call from
48431
- // `onCaptured` to produce the same built request 2.x hands over. See
48432
- // components/flows.tsx.
48767
+ // 2.x builds this flow's request and hands it to `onSubmit`
48768
+ // (SubmissionProvider.tsx:1374, ahead of its NONE branch). Unset, the
48769
+ // flow captures and posts nothing, as 2.x's NONE did. A failed hand-off
48770
+ // is not reported to `onRequestFailure`, which 2.x never did either.
48771
+ submitMode: mapHandoff(props.onSubmit),
48433
48772
  onCaptureError: props.onRequestFailure
48434
48773
  });
48435
48774
  }
@@ -48455,7 +48794,7 @@ function nestedLayer(nested, map) {
48455
48794
  return map(nested);
48456
48795
  }
48457
48796
  function mapVideoIdValidationProps(props, ctx) {
48458
- var _a, _b, _c;
48797
+ var _a, _b, _c, _d;
48459
48798
  if (ctx === void 0) {
48460
48799
  ctx = EMPTY_CONTEXT;
48461
48800
  }
@@ -48548,7 +48887,11 @@ function mapVideoIdValidationProps(props, ctx) {
48548
48887
  showResultScreen: props.debugMode,
48549
48888
  showDiagnostics: props.debugMode,
48550
48889
  onComplete: withSubmissionRequest(props.onComplete, ctx),
48551
- onRequestFailure: props.onRequestFailure,
48890
+ // No ID captured and none supplied resolves the action to NONE, which
48891
+ // has nothing to post. 2.x answered with a synthetic success and no
48892
+ // request; capture mode is that without the fabricated response.
48893
+ submitMode: (_d = mapHandoff(props.onSubmit)) !== null && _d !== void 0 ? _d : props.skipIdCapture && !props.idCardForFaceMatch ? 'capture' : undefined,
48894
+ onSubmissionFailure: props.onRequestFailure,
48552
48895
  onCaptureError: props.onRequestFailure
48553
48896
  });
48554
48897
  }
@@ -48713,7 +49056,8 @@ function mapCustomerMatchProps(props, ctx) {
48713
49056
  onComplete: withSubmissionRequest(props.onComplete, ctx),
48714
49057
  onCustomerMatched: withSubmissionRequest(props.onCustomerMatched, ctx),
48715
49058
  onCustomerNotMatched: withSubmissionRequest(props.onCustomerNotMatched, ctx),
48716
- onRequestFailure: props.onRequestFailure,
49059
+ submitMode: mapHandoff(props.onSubmit),
49060
+ onSubmissionFailure: props.onRequestFailure,
48717
49061
  onExitCapture: props.onExitCapture,
48718
49062
  onExitAfterFailure: props.onExitAfterFailure
48719
49063
  });
@@ -48782,7 +49126,8 @@ function mapCustomerBiometricsEnrollmentProps(props, ctx) {
48782
49126
  // sdk2's enrollment twin of `onApproved`.
48783
49127
  onApproved: withSubmissionRequest(props.onEnrolled, ctx),
48784
49128
  onDenied: withSubmissionRequest(props.onDenied, ctx),
48785
- onRequestFailure: props.onRequestFailure,
49129
+ submitMode: mapHandoff(props.onSubmit),
49130
+ onSubmissionFailure: props.onRequestFailure,
48786
49131
  onCaptureError: props.onRequestFailure
48787
49132
  });
48788
49133
  }
@@ -48874,12 +49219,13 @@ function mapCustomerIdAndBiometricsEnrollmentProps(props, ctx) {
48874
49219
  onComplete: withSubmissionRequest(props.onComplete, ctx),
48875
49220
  onApproved: withSubmissionRequest(props.onEnrolled, ctx),
48876
49221
  onDenied: withSubmissionRequest(props.onDenied, ctx),
48877
- onRequestFailure: props.onRequestFailure,
49222
+ submitMode: mapHandoff(props.onSubmit),
49223
+ onSubmissionFailure: props.onRequestFailure,
48878
49224
  onCaptureError: props.onRequestFailure
48879
49225
  });
48880
49226
  }
48881
49227
 
48882
- var webSdkVersion = '2.6.3-t3code-shared-flow-settings-07ab804';
49228
+ var webSdkVersion = '2.6.3-t3code-callback-homes-submit-handoff-9690b2d';
48883
49229
 
48884
49230
  // GENERATED by scripts/styleBagTypes.mjs from
48885
49231
  // src/__fixtures__/sdk2StyleBags.json and the mapper sweep — do not
@@ -50936,23 +51282,17 @@ var STYLE_WITH_ASSETS = {
50936
51282
  var SUBMIT_CALLBACKS = {
50937
51283
  onBeforeSubmit: MAPPED,
50938
51284
  /**
50939
- * Mapped to the CLIENT's `onSubmit`, not to a flow prop — the layer sdk2 put
50940
- * it at (SubmissionProvider.submit). The client builds the request, hands it
50941
- * over, and does NOT post, so `onComplete`/`onApproved`/`onDenied` never
50942
- * fire, exactly as 2.x documents. Every flow submits through that one
50943
- * client, including the two match flows with their own stage machine, so the
50944
- * suppression is uniform.
51285
+ * Mapped to the flow's `submitMode: { handoff }`. The flow builds the
51286
+ * request, hands it over, and does NOT post, so `onComplete`/`onApproved`/
51287
+ * `onDenied` never fire, exactly as 2.x documents. Mapped on every render,
51288
+ * so adding or removing it takes effect from the next submission, as sdk2's
51289
+ * ref-held `onSubmit` did.
50945
51290
  *
50946
51291
  * What the flow SHOWS afterwards is a 3.0 call rather than a 2.x
50947
51292
  * reproduction: every family now ends quietly, because the integrator owns
50948
51293
  * the outcome once they have the request. 2.x's match flows showed a failure
50949
51294
  * screen there, but only because their `submit()` could not distinguish an
50950
51295
  * intercepted submission from a broken one.
50951
- *
50952
- * `SignatureKYC` reaches the same place by a different route: its 3.0
50953
- * counterpart never enters `client.submit()`, so the façade component makes
50954
- * that call itself from `onCaptured`. `action: NONE` is accepted there
50955
- * precisely because `onSubmit` is bound.
50956
51296
  */
50957
51297
  onSubmit: MAPPED,
50958
51298
  onComplete: MAPPED,
@@ -51050,7 +51390,7 @@ var SignatureKYC$1 = _assign(_assign(_assign(_assign(_assign(_assign(_assign(_as
51050
51390
  // `SubmissionAction.NONE` and wires `onComplete` to the provider's
51051
51391
  // `onResponseReceived` (SignatureKYC.tsx:434,449), which never fires because
51052
51392
  // nothing is ever posted. `onSubmit` is the real completion seam and IS
51053
- // mapped, to the flow's `onCaptured`.
51393
+ // mapped, to the flow's `submitMode: { handoff }`.
51054
51394
  onComplete: NOOP,
51055
51395
  onSubmit: MAPPED,
51056
51396
  onRequestFailure: MAPPED,
@@ -51541,10 +51881,6 @@ function useCompatClient(props) {
51541
51881
  _lastLivenessRequest.current = request;
51542
51882
  return propsRef.current.onBeforeLivenessCheck ? propsRef.current.onBeforeLivenessCheck(request) : Promise.resolve(request);
51543
51883
  },
51544
- onSubmit: propsRef.current.onSubmit ? function (request) {
51545
- var _a, _b;
51546
- return (_b = (_a = propsRef.current).onSubmit) === null || _b === void 0 ? void 0 : _b.call(_a, request);
51547
- } : undefined,
51548
51884
  onResponseReceived: function onResponseReceived(_response, request) {
51549
51885
  _lastSubmissionRequest.current = request;
51550
51886
  },
@@ -51715,34 +52051,12 @@ var SignatureKYC = function SignatureKYC(props) {
51715
52051
  client = _a.client,
51716
52052
  ctx = _a.ctx;
51717
52053
  useDroppedPropReport('SignatureKYC', props);
51718
- // The one flow whose 3.0 counterpart never enters `client.submit()`: it runs
51719
- // its own stage machine and reports completion through `onCaptured` instead.
51720
- // 2.x DOES submit here — its CompositeWizard calls `submit()`, which hands
51721
- // the built request to `onSubmit` before reaching the capture-only branch —
51722
- // so the façade makes that call itself to produce the same request. The
51723
- // client suppresses the POST, and `action: NONE` is accepted precisely
51724
- // because `onSubmit` is bound.
51725
- //
51726
- // Only when bound: without `onSubmit` the client rejects NONE by design, and
51727
- // this flow has nothing to submit anyway.
51728
- var onSubmit = props.onSubmit;
51729
- var submission = mapSubmission(props);
51730
- var handOff = onSubmit ? function (artifacts) {
51731
- void client.submit(artifacts, _assign(_assign({}, submission), {
51732
- action: SubmissionAction.NONE
51733
- }))["catch"](function () {
51734
- // The failure already reached `onRequestFailure` through the
51735
- // client's own hook, which is where 2.x reported it too.
51736
- });
51737
- } : undefined;
51738
52054
  // No `children`: SignatureKYCFlow omits it from its props (it runs its own
51739
52055
  // stage machine rather than CompositeWizard), so passing it would not
51740
52056
  // compile — and 2.x rendered it nowhere either.
51741
52057
  return /*#__PURE__*/React.createElement(SignatureKYCFlow, _assign({
51742
52058
  client: client
51743
- }, mapSignatureKYCProps(props, ctx), {
51744
- onCaptured: handOff
51745
- }));
52059
+ }, mapSignatureKYCProps(props, ctx)));
51746
52060
  };
51747
52061
  /**
51748
52062
  * Render a fullscreen capture component that performs ID and face validation,