idmission-web-sdk 2.6.3-changeset-release-develop-eac763c → 2.6.3-changeset-release-develop-776f131

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
@@ -18,7 +18,7 @@ import { isWebGPUSupported, loadAndCompile, loadLiteRt, Tensor } from '@litertjs
18
18
 
19
19
  // Extracted from the barrel so modules inside this package can read the
20
20
  // version without importing index.ts (which would be circular).
21
- var webSdkUiVersion = '0.5.1';
21
+ var webSdkUiVersion = '0.6.0';
22
22
 
23
23
  function asyncGeneratorStep(n, t, e, r, o, a, c) {
24
24
  try {
@@ -484,7 +484,7 @@ function _toConsumableArray(r) {
484
484
  return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray$w(r) || _nonIterableSpread();
485
485
  }
486
486
 
487
- var webSdkCoreVersion = '0.5.1';
487
+ var webSdkCoreVersion = '0.6.0';
488
488
 
489
489
  var maxTime = 86400000;
490
490
  var maxCount = 1000000;
@@ -4858,6 +4858,21 @@ 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
+ // `Promise.resolve`, not `instanceof Promise`: a promise from another
4868
+ // realm (an iframe) fails that check, and its rejection would go unhandled.
4869
+ Promise.resolve(notify())["catch"](function (e) {
4870
+ return warn$1(name + " rejected", e);
4871
+ });
4872
+ } catch (e) {
4873
+ warn$1(name + " threw", e);
4874
+ }
4875
+ }
4861
4876
  /**
4862
4877
  * How long an async `sessionId` resolver may take. It typically mints the
4863
4878
  * session through the host's own backend (an OAuth token, then
@@ -4880,6 +4895,10 @@ function resolveSessionIdWithTimeout(resolve) {
4880
4895
  return clearTimeout(timer);
4881
4896
  });
4882
4897
  }
4898
+ /**
4899
+ * Creates a client. Its type is `Required<IdmissionClient>`: unlike a
4900
+ * hand-written `IdmissionClient`, it always has `post()` and `handoff()`.
4901
+ */
4883
4902
  function createIdmissionClient(config) {
4884
4903
  var _config$fetch, _config$now;
4885
4904
  // `let`: when config.sessionId is an async resolver, the session URN (and
@@ -4930,7 +4949,10 @@ function createIdmissionClient(config) {
4930
4949
  var livenessToken;
4931
4950
  function timedFetch(_x, _x2) {
4932
4951
  return _timedFetch.apply(this, arguments);
4933
- }
4952
+ } // The attestation nonce THIS client's session was validated with. The
4953
+ // holders are module-level, so another client validating later replaces
4954
+ // them; comparing against this, not against whatever the holder says at
4955
+ // submit time, is what keeps that client's nonce off this client's request.
4934
4956
  function _timedFetch() {
4935
4957
  _timedFetch = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(url, init) {
4936
4958
  var controller, timer;
@@ -4966,10 +4988,35 @@ function createIdmissionClient(config) {
4966
4988
  }));
4967
4989
  return _timedFetch.apply(this, arguments);
4968
4990
  }
4969
- function performUpload(blob, metadata) {
4970
- return uploadDocument(blob, metadata, {
4971
- documentServiceUrl: urls.documentServiceUrl,
4991
+ var validatedSessionNonce = null;
4992
+ function currentRoute() {
4993
+ return {
4972
4994
  sessionId: store.getState().session.sessionId,
4995
+ submissionUrl: urls.submissionUrl,
4996
+ documentServiceUrl: urls.documentServiceUrl,
4997
+ sessionNonce: validatedSessionNonce
4998
+ };
4999
+ }
5000
+ // The attestation holders are module-level and follow the newest
5001
+ // ValidateSession, from any client. If they no longer hold this operation's
5002
+ // session nonce, the nonce and OS token belong to someone else: omit the
5003
+ // envelope (throwing here is
5004
+ // attachMetadataToRequest's fail-open path, which reports
5005
+ // `attestationAttached: false`) rather than attach a stranger's.
5006
+ function routeBoundCollectors(route) {
5007
+ return {
5008
+ collectAttestation: function collectAttestation(web, versions) {
5009
+ if (getLastSessionNonce() !== route.sessionNonce) {
5010
+ throw new Error('session changed during submission; attestation omitted');
5011
+ }
5012
+ return collectClientAttestation(web, versions);
5013
+ }
5014
+ };
5015
+ }
5016
+ function performUpload(blob, metadata, route) {
5017
+ return uploadDocument(blob, metadata, {
5018
+ documentServiceUrl: route.documentServiceUrl,
5019
+ sessionId: route.sessionId,
4973
5020
  Upload: config.tusUpload,
4974
5021
  delay: config.delay,
4975
5022
  calculateMd5: config.calculateMd5,
@@ -5021,7 +5068,7 @@ function createIdmissionClient(config) {
5021
5068
  }
5022
5069
  function _runSessionValidation() {
5023
5070
  _runSessionValidation = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(epoch) {
5024
- var authUrl, adoptSessionUrls, resolvedSessionId, err, valid, finalState, _err, _t, _t2;
5071
+ var authUrl, adoptSessionUrls, resolvedSessionId, err, responseNonce, valid, finalState, _err, _t, _t2;
5025
5072
  return _regeneratorRuntime.wrap(function (_context3) {
5026
5073
  while (1) switch (_context3.prev = _context3.next) {
5027
5074
  case 0:
@@ -5116,14 +5163,22 @@ function createIdmissionClient(config) {
5116
5163
  payload: 'RUNNING'
5117
5164
  });
5118
5165
  _context3.prev = 8;
5166
+ // The nonce THIS response carried, taken as it is ingested: reading
5167
+ // the shared holder after the await could pick up another client's.
5168
+ responseNonce = null;
5119
5169
  _context3.next = 9;
5120
5170
  return validateSession(authUrl, resolvedSessionId, {
5121
5171
  fetch: config.fetch,
5122
- delay: config.delay
5172
+ delay: config.delay,
5173
+ ingestNonce: function ingestNonce(nonce) {
5174
+ responseNonce = typeof nonce === 'string' && nonce ? nonce : null;
5175
+ ingestSessionAttestation(nonce);
5176
+ }
5123
5177
  });
5124
5178
  case 9:
5125
5179
  valid = _context3.sent;
5126
5180
  finalState = valid ? 'PASSED' : 'FAILED';
5181
+ if (epoch === sessionRunEpoch) validatedSessionNonce = responseNonce;
5127
5182
  dispatchSessionIfCurrent(epoch, {
5128
5183
  type: 'setCheckState',
5129
5184
  payload: finalState
@@ -5193,23 +5248,28 @@ function createIdmissionClient(config) {
5193
5248
  }));
5194
5249
  return _retrySession.apply(this, arguments);
5195
5250
  }
5196
- function submit(_x6, _x7) {
5197
- return _submit.apply(this, arguments);
5251
+ function runPipeline(_x6, _x7, _x8) {
5252
+ return _runPipeline.apply(this, arguments);
5198
5253
  }
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;
5254
+ function _runPipeline() {
5255
+ _runPipeline = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(artifacts, options, kind) {
5256
+ var _artifacts$meta$liven, _artifacts$meta, _options$onBeforeSubm;
5257
+ 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
5258
  return _regeneratorRuntime.wrap(function (_context7) {
5204
5259
  while (1) switch (_context7.prev = _context7.next) {
5205
5260
  case 0:
5206
- if (!(options.action === SubmissionAction.NONE && !config.onSubmit)) {
5261
+ handsOff = kind === 'handoff' || kind === 'submit' && config.onSubmit !== undefined; // sdk2 short-circuits action NONE to a synthetic success before any
5262
+ // network activity (SubmissionProvider.tsx:1203-1225). This client does
5263
+ // not fabricate that response, but it keeps the "NONE does no network
5264
+ // work" guarantee by rejecting here, before any upload — unless the
5265
+ // request is being handed off, which is the one thing NONE can do.
5266
+ if (!(options.action === SubmissionAction.NONE && !handsOff)) {
5207
5267
  _context7.next = 1;
5208
5268
  break;
5209
5269
  }
5210
5270
  throw new SubmissionError({
5211
5271
  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"
5272
+ statusMessage: "action 'NONE' has no endpoint to post to; use handoff() to build the request without posting it"
5213
5273
  });
5214
5274
  case 1:
5215
5275
  if (!(store.getState().session.sessionCheckState !== 'PASSED')) {
@@ -5218,6 +5278,11 @@ function createIdmissionClient(config) {
5218
5278
  }
5219
5279
  throw new AuthenticationError(401, 'session not validated');
5220
5280
  case 2:
5281
+ route = currentRoute(); // Claimed, not read: an overlapping operation must not reuse it, and a
5282
+ // `checkLiveness()` that lands mid-operation keeps its own token for the
5283
+ // next one (SubmissionProvider.tsx:1350 cleared it after the submit).
5284
+ claimedLivenessToken = (_artifacts$meta$liven = (_artifacts$meta = artifacts.meta) == null ? void 0 : _artifacts$meta.livenessToken) != null ? _artifacts$meta$liven : livenessToken;
5285
+ livenessToken = undefined;
5221
5286
  store.setState({
5222
5287
  submissionStatus: SubmissionStatus.SUBMITTING,
5223
5288
  submissionError: undefined
@@ -5234,7 +5299,7 @@ function createIdmissionClient(config) {
5234
5299
  _context7.next = 5;
5235
5300
  return buildSubmissionPayload(_extends({}, artifacts, {
5236
5301
  meta: _extends({}, artifacts.meta, {
5237
- livenessToken: (_artifacts$meta$liven = (_artifacts$meta = artifacts.meta) == null ? void 0 : _artifacts$meta.livenessToken) != null ? _artifacts$meta$liven : livenessToken
5302
+ livenessToken: claimedLivenessToken
5238
5303
  })
5239
5304
  }), _extends({}, options, {
5240
5305
  onBeforeSubmit: beforeSubmit ? function (request) {
@@ -5250,7 +5315,7 @@ function createIdmissionClient(config) {
5250
5315
  // withJobTaskMetadata (see its own comment above): only present
5251
5316
  // when options.jobID/taskID are present.
5252
5317
  uploadDocument: documentServiceEnabled ? (/*#__PURE__*/function () {
5253
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(blob, metadata) {
5318
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(blob, metadata) {
5254
5319
  var result, _t3;
5255
5320
  return _regeneratorRuntime.wrap(function (_context6) {
5256
5321
  while (1) switch (_context6.prev = _context6.next) {
@@ -5267,7 +5332,7 @@ function createIdmissionClient(config) {
5267
5332
  });
5268
5333
  _context6.prev = 1;
5269
5334
  _context6.next = 2;
5270
- return performUpload(blob, withJobTaskMetadata(metadata, options.jobID, options.taskID));
5335
+ return performUpload(blob, withJobTaskMetadata(metadata, options.jobID, options.taskID), route);
5271
5336
  case 2:
5272
5337
  result = _context6.sent;
5273
5338
  progress.observe({
@@ -5297,12 +5362,13 @@ function createIdmissionClient(config) {
5297
5362
  }
5298
5363
  }, _callee6, null, [[1, 3, 4, 5]]);
5299
5364
  }));
5300
- return function (_x10, _x11) {
5301
- return _ref2.apply(this, arguments);
5365
+ return function (_x13, _x14) {
5366
+ return _ref3.apply(this, arguments);
5302
5367
  };
5303
5368
  }()) : undefined,
5304
5369
  now: config.now,
5305
- sdkVersions: config.sdkVersions
5370
+ sdkVersions: config.sdkVersions,
5371
+ collectors: routeBoundCollectors(route)
5306
5372
  });
5307
5373
  case 5:
5308
5374
  payloadResult = _context7.sent;
@@ -5316,40 +5382,41 @@ function createIdmissionClient(config) {
5316
5382
  case 7:
5317
5383
  payloadBuildEnd = payloadResult.uploadTimings.payloadBuildEnd;
5318
5384
  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.
5385
+ request = payloadResult.request; // Stashed before the hand-off returns, so hand-off callers get the
5386
+ // request alongside the timings the `finally` records.
5323
5387
  store.setState({
5324
5388
  attestationAttached: payloadResult.attestationAttached,
5325
5389
  lastSubmissionRequest: request
5326
5390
  });
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) {
5391
+ if (!handsOff) {
5340
5392
  _context7.next = 8;
5341
5393
  break;
5342
5394
  }
5395
+ // sdk2 short-circuits at the equivalent point
5396
+ // (SubmissionProvider.tsx:1374-1377), so everything above runs and
5397
+ // nothing below does.
5398
+ //
5399
+ // The status goes to SUBMITTED, where sdk2 leaves it at READY. That is
5400
+ // a deliberate divergence in INTERNAL state to preserve the VISIBLE
5401
+ // behaviour: sdk2's wizard renders an empty fragment for READY via its
5402
+ // switch `default`, whereas this codebase renders the submitting
5403
+ // screen for READY — so inheriting READY would park the user on a
5404
+ // spinner forever. SUBMITTED with no response falls through every
5405
+ // terminal branch to `return null`, which is sdk2's empty fragment.
5343
5406
  store.setState({
5344
5407
  submissionStatus: SubmissionStatus.SUBMITTED
5345
5408
  });
5346
- config.onSubmit(request);
5409
+ if (kind === 'submit') config.onSubmit == null || config.onSubmit(request);
5347
5410
  progress.observe({
5348
5411
  kind: 'flow-completed'
5349
5412
  });
5350
- return _context7.abrupt("return", null);
5413
+ built = {
5414
+ request: request,
5415
+ response: null
5416
+ };
5417
+ _context7.next = 23;
5418
+ break;
5351
5419
  case 8:
5352
- sessionId = store.getState().session.sessionId;
5353
5420
  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
5421
  progress.observe({
5355
5422
  kind: 'phase',
@@ -5364,9 +5431,9 @@ function createIdmissionClient(config) {
5364
5431
  _context7.prev = 9;
5365
5432
  _context7.prev = 10;
5366
5433
  _context7.next = 11;
5367
- return timedFetch(urls.submissionUrl + endpoint, {
5434
+ return timedFetch(route.submissionUrl + endpoint, {
5368
5435
  method: 'POST',
5369
- headers: apiHeaders(sessionId, options.sendBase64DocumentsInSwaggerProxy),
5436
+ headers: apiHeaders(route.sessionId, options.sendBase64DocumentsInSwaggerProxy),
5370
5437
  body: JSON.stringify(request)
5371
5438
  });
5372
5439
  case 11:
@@ -5456,10 +5523,21 @@ function createIdmissionClient(config) {
5456
5523
  progress.observe({
5457
5524
  kind: 'flow-completed'
5458
5525
  });
5459
- config.onResponseReceived == null || config.onResponseReceived(submissionResponse, request);
5460
- return _context7.abrupt("return", submissionResponse);
5526
+ // Legacy `submit()` keeps a throwing `onResponseReceived` inside the
5527
+ // failure path, as it always has; `post()` notifies after the outcome
5528
+ // is settled (below).
5529
+ if (kind === 'submit') {
5530
+ config.onResponseReceived == null || config.onResponseReceived(submissionResponse, request);
5531
+ }
5532
+ built = {
5533
+ request: request,
5534
+ response: submissionResponse
5535
+ };
5461
5536
  case 23:
5462
- _context7.prev = 23;
5537
+ _context7.next = 25;
5538
+ break;
5539
+ case 24:
5540
+ _context7.prev = 24;
5463
5541
  _t0 = _context7["catch"](3);
5464
5542
  if (failedAt === undefined) failedAt = 'submission';
5465
5543
  err = _t0;
@@ -5471,72 +5549,116 @@ function createIdmissionClient(config) {
5471
5549
  // UNLIKE sdk2 (`if (throwErrorsOnFailure) throw err`) there is no
5472
5550
  // catch-swallow path: rejection always propagates.
5473
5551
  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;
5552
+ case 25:
5553
+ _context7.prev = 25;
5479
5554
  endedAt = nowImpl();
5555
+ timings = buildSubmissionTimings({
5556
+ startedAt: startedAt,
5557
+ endedAt: endedAt,
5558
+ payloadBuildStart: payloadBuildStart,
5559
+ payloadBuildEnd: payloadBuildEnd,
5560
+ uploads: uploadMeasurements,
5561
+ apiCallStart: apiCallStart,
5562
+ apiCallEnd: apiCallEnd,
5563
+ responseParseStart: responseParseStart,
5564
+ responseParseEnd: responseParseEnd,
5565
+ failedAt: failedAt
5566
+ });
5480
5567
  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
- })
5568
+ lastSubmissionTimings: timings
5493
5569
  });
5494
- return _context7.finish(24);
5495
- case 25:
5570
+ return _context7.finish(25);
5571
+ case 26:
5572
+ if (kind === 'post' && built.response) {
5573
+ _built = built, _response = _built.response, _request = _built.request;
5574
+ notifySafely$1('onResponseReceived', function () {
5575
+ return config.onResponseReceived == null ? void 0 : config.onResponseReceived(_response, _request);
5576
+ });
5577
+ }
5578
+ return _context7.abrupt("return", _extends({}, built, {
5579
+ timings: timings
5580
+ }));
5581
+ case 27:
5496
5582
  case "end":
5497
5583
  return _context7.stop();
5498
5584
  }
5499
- }, _callee7, null, [[3, 23, 24, 25], [4, 6], [9, 20], [10, 12]]);
5585
+ }, _callee7, null, [[3, 24, 25, 26], [4, 6], [9, 20], [10, 12]]);
5586
+ }));
5587
+ return _runPipeline.apply(this, arguments);
5588
+ }
5589
+ function submit(artifacts, options) {
5590
+ return runPipeline(artifacts, options, 'submit').then(function (_ref2) {
5591
+ var response = _ref2.response;
5592
+ return response;
5593
+ });
5594
+ }
5595
+ function post(artifacts, options) {
5596
+ return runPipeline(artifacts, options, 'post');
5597
+ }
5598
+ function handoff(_x9, _x0) {
5599
+ return _handoff.apply(this, arguments);
5600
+ }
5601
+ function _handoff() {
5602
+ _handoff = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(artifacts, options) {
5603
+ var _yield$runPipeline, request, timings;
5604
+ return _regeneratorRuntime.wrap(function (_context8) {
5605
+ while (1) switch (_context8.prev = _context8.next) {
5606
+ case 0:
5607
+ _context8.next = 1;
5608
+ return runPipeline(artifacts, options, 'handoff');
5609
+ case 1:
5610
+ _yield$runPipeline = _context8.sent;
5611
+ request = _yield$runPipeline.request;
5612
+ timings = _yield$runPipeline.timings;
5613
+ return _context8.abrupt("return", {
5614
+ request: request,
5615
+ timings: timings
5616
+ });
5617
+ case 2:
5618
+ case "end":
5619
+ return _context8.stop();
5620
+ }
5621
+ }, _callee8);
5500
5622
  }));
5501
- return _submit.apply(this, arguments);
5623
+ return _handoff.apply(this, arguments);
5502
5624
  }
5503
- function checkLiveness(_x8, _x9) {
5625
+ function checkLiveness(_x1, _x10) {
5504
5626
  return _checkLiveness.apply(this, arguments);
5505
5627
  }
5506
5628
  function _checkLiveness() {
5507
- _checkLiveness = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(imageDataUrl, options) {
5629
+ _checkLiveness = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(imageDataUrl, options) {
5508
5630
  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) {
5631
+ return _regeneratorRuntime.wrap(function (_context9) {
5632
+ while (1) switch (_context9.prev = _context9.next) {
5511
5633
  case 0:
5512
5634
  if (options === void 0) {
5513
5635
  options = {};
5514
5636
  }
5515
- _context8.prev = 1;
5637
+ _context9.prev = 1;
5516
5638
  selfie = imageDataUrl;
5517
5639
  if (!(options.useDocumentServiceForLivenessChecks && documentServiceEnabled)) {
5518
- _context8.next = 6;
5640
+ _context9.next = 6;
5519
5641
  break;
5520
5642
  }
5521
5643
  if (!selfie.startsWith('data:')) {
5522
5644
  selfie = "data:image/jpeg;base64," + selfie;
5523
5645
  }
5524
- _context8.prev = 2;
5525
- _context8.next = 3;
5646
+ _context9.prev = 2;
5647
+ _context9.next = 3;
5526
5648
  return performUpload(dataUrlToBlob(selfie), withJobTaskMetadata({
5527
5649
  filename: 'liveness',
5528
5650
  filetype: 'image/jpeg'
5529
- }, options.jobID, options.taskID));
5651
+ }, options.jobID, options.taskID), currentRoute());
5530
5652
  case 3:
5531
- selfie = _context8.sent;
5532
- _context8.next = 5;
5653
+ selfie = _context9.sent;
5654
+ _context9.next = 5;
5533
5655
  break;
5534
5656
  case 4:
5535
- _context8.prev = 4;
5536
- _t1 = _context8["catch"](2);
5657
+ _context9.prev = 4;
5658
+ _t1 = _context9["catch"](2);
5537
5659
  throw new NetworkError(_t1 instanceof Error ? _t1.message : String(_t1));
5538
5660
  case 5:
5539
- _context8.next = 7;
5661
+ _context9.next = 7;
5540
5662
  break;
5541
5663
  case 6:
5542
5664
  selfie = dataUrlToBase64Sync$1(selfie);
@@ -5604,19 +5726,19 @@ function createIdmissionClient(config) {
5604
5726
  attestationAttached: attestationAttached
5605
5727
  });
5606
5728
  if (!config.onBeforeLivenessCheck) {
5607
- _context8.next = 9;
5729
+ _context9.next = 9;
5608
5730
  break;
5609
5731
  }
5610
- _context8.next = 8;
5732
+ _context9.next = 8;
5611
5733
  return config.onBeforeLivenessCheck(request);
5612
5734
  case 8:
5613
- result = _context8.sent;
5735
+ result = _context9.sent;
5614
5736
  if (result) request = result;
5615
5737
  case 9:
5616
5738
  endpoint = liveCheckEndpoint(!!options.idCardForFaceMatch);
5617
5739
  sessionId = store.getState().session.sessionId;
5618
- _context8.prev = 10;
5619
- _context8.next = 11;
5740
+ _context9.prev = 10;
5741
+ _context9.next = 11;
5620
5742
  return timedFetch(urls.submissionUrl + endpoint, {
5621
5743
  method: 'POST',
5622
5744
  // SubmissionProvider.tsx:1447 — sourced from the same
@@ -5627,36 +5749,36 @@ function createIdmissionClient(config) {
5627
5749
  body: JSON.stringify(request)
5628
5750
  });
5629
5751
  case 11:
5630
- response = _context8.sent;
5631
- _context8.next = 13;
5752
+ response = _context9.sent;
5753
+ _context9.next = 13;
5632
5754
  break;
5633
5755
  case 12:
5634
- _context8.prev = 12;
5635
- _t10 = _context8["catch"](10);
5756
+ _context9.prev = 12;
5757
+ _t10 = _context9["catch"](10);
5636
5758
  throw new NetworkError(_t10 instanceof Error ? _t10.message : String(_t10));
5637
5759
  case 13:
5638
5760
  if (response.ok) {
5639
- _context8.next = 18;
5761
+ _context9.next = 18;
5640
5762
  break;
5641
5763
  }
5642
5764
  if (!(response.status === 401 || response.status === 403)) {
5643
- _context8.next = 15;
5765
+ _context9.next = 15;
5644
5766
  break;
5645
5767
  }
5646
5768
  _t11 = AuthenticationError;
5647
5769
  _t12 = response.status;
5648
- _context8.next = 14;
5770
+ _context9.next = 14;
5649
5771
  return response.text();
5650
5772
  case 14:
5651
- _t13 = _context8.sent;
5773
+ _t13 = _context9.sent;
5652
5774
  throw new _t11(_t12, _t13);
5653
5775
  case 15:
5654
- _context8.next = 16;
5776
+ _context9.next = 16;
5655
5777
  return response.text();
5656
5778
  case 16:
5657
- statusMessage = _context8.sent;
5779
+ statusMessage = _context9.sent;
5658
5780
  if (!(!statusMessage || statusMessage === 'Load failed')) {
5659
- _context8.next = 17;
5781
+ _context9.next = 17;
5660
5782
  break;
5661
5783
  }
5662
5784
  throw new NetworkError(statusMessage);
@@ -5666,12 +5788,12 @@ function createIdmissionClient(config) {
5666
5788
  statusMessage: statusMessage
5667
5789
  });
5668
5790
  case 18:
5669
- _context8.next = 19;
5791
+ _context9.next = 19;
5670
5792
  return response.json();
5671
5793
  case 19:
5672
- livenessResponse = _context8.sent;
5794
+ livenessResponse = _context9.sent;
5673
5795
  if (!(livenessResponse.status.statusCode !== '000')) {
5674
- _context8.next = 20;
5796
+ _context9.next = 20;
5675
5797
  break;
5676
5798
  }
5677
5799
  throw new SubmissionError(livenessResponse.status);
@@ -5684,7 +5806,7 @@ function createIdmissionClient(config) {
5684
5806
  // unconditional here — a deliberate scope narrowing, not a silent drop.
5685
5807
  livenessToken = (_livenessResponse$res = livenessResponse.resultData) == null ? void 0 : _livenessResponse$res.livenessToken;
5686
5808
  if (!(options.softFail && !isLiveFaceConfirmed((_livenessResponse$res2 = livenessResponse.resultData) == null ? void 0 : _livenessResponse$res2.verificationResult))) {
5687
- _context8.next = 21;
5809
+ _context9.next = 21;
5688
5810
  break;
5689
5811
  }
5690
5812
  // Current sdk2 (SubmissionProvider.tsx checkLiveness): softFail also
@@ -5693,21 +5815,21 @@ function createIdmissionClient(config) {
5693
5815
  // non-live capture) and hand back a typed failure that still carries
5694
5816
  // the response so callers can read the detection flags.
5695
5817
  livenessToken = undefined;
5696
- return _context8.abrupt("return", {
5818
+ return _context9.abrupt("return", {
5697
5819
  ok: false,
5698
5820
  error: new Error("Liveness not confirmed: " + ((_livenessResponse$res3 = (_livenessResponse$res4 = livenessResponse.resultData) == null ? void 0 : _livenessResponse$res4.verificationResult) != null ? _livenessResponse$res3 : 'no verificationResult')),
5699
5821
  response: livenessResponse
5700
5822
  });
5701
5823
  case 21:
5702
- return _context8.abrupt("return", {
5824
+ return _context9.abrupt("return", {
5703
5825
  ok: true,
5704
5826
  response: livenessResponse
5705
5827
  });
5706
5828
  case 22:
5707
- _context8.prev = 22;
5708
- _t14 = _context8["catch"](1);
5829
+ _context9.prev = 22;
5830
+ _t14 = _context9["catch"](1);
5709
5831
  if (!options.softFail) {
5710
- _context8.next = 23;
5832
+ _context9.next = 23;
5711
5833
  break;
5712
5834
  }
5713
5835
  // Caller is treating this as a best-effort check. Don't surface the
@@ -5715,7 +5837,7 @@ function createIdmissionClient(config) {
5715
5837
  // typed failure result instead of sdk2's silent `undefined` (deliberate
5716
5838
  // divergence #3).
5717
5839
  livenessToken = undefined;
5718
- return _context8.abrupt("return", {
5840
+ return _context9.abrupt("return", {
5719
5841
  ok: false,
5720
5842
  error: _t14
5721
5843
  });
@@ -5729,32 +5851,32 @@ function createIdmissionClient(config) {
5729
5851
  throw err;
5730
5852
  case 24:
5731
5853
  case "end":
5732
- return _context8.stop();
5854
+ return _context9.stop();
5733
5855
  }
5734
- }, _callee8, null, [[1, 22], [2, 4], [10, 12]]);
5856
+ }, _callee9, null, [[1, 22], [2, 4], [10, 12]]);
5735
5857
  }));
5736
5858
  return _checkLiveness.apply(this, arguments);
5737
5859
  }
5738
- function clientUploadDocument(_x0, _x1) {
5860
+ function clientUploadDocument(_x11, _x12) {
5739
5861
  return _clientUploadDocument.apply(this, arguments);
5740
5862
  }
5741
5863
  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) {
5864
+ _clientUploadDocument = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(blob, metadata) {
5865
+ return _regeneratorRuntime.wrap(function (_context0) {
5866
+ while (1) switch (_context0.prev = _context0.next) {
5745
5867
  case 0:
5746
5868
  if (documentServiceEnabled) {
5747
- _context9.next = 1;
5869
+ _context0.next = 1;
5748
5870
  break;
5749
5871
  }
5750
5872
  throw new Error('document upload is disabled: no documentServiceUrl configured');
5751
5873
  case 1:
5752
- return _context9.abrupt("return", performUpload(blob, metadata != null ? metadata : {}));
5874
+ return _context0.abrupt("return", performUpload(blob, metadata != null ? metadata : {}, currentRoute()));
5753
5875
  case 2:
5754
5876
  case "end":
5755
- return _context9.stop();
5877
+ return _context0.stop();
5756
5878
  }
5757
- }, _callee9);
5879
+ }, _callee0);
5758
5880
  }));
5759
5881
  return _clientUploadDocument.apply(this, arguments);
5760
5882
  }
@@ -5770,6 +5892,8 @@ function createIdmissionClient(config) {
5770
5892
  validateSession: validateSessionMethod,
5771
5893
  retrySession: retrySession,
5772
5894
  submit: submit,
5895
+ post: post,
5896
+ handoff: handoff,
5773
5897
  checkLiveness: checkLiveness,
5774
5898
  uploadDocument: clientUploadDocument
5775
5899
  };
@@ -7562,12 +7686,17 @@ var SdkLanguageContext = /*#__PURE__*/createContext(undefined);
7562
7686
  * Binds one rendered SDK tree to its requested language. A fixed translator
7563
7687
  * avoids waiting for a post-render changeLanguage() effect and keeps SSR and
7564
7688
  * concurrently mounted SDK views independent of the shared detector instance.
7689
+ *
7690
+ * An unset `lang` keeps whatever scope encloses it (or none), so a caller can
7691
+ * render the provider unconditionally: toggling `lang` between unset and set
7692
+ * then never changes the element tree, and never remounts the subtree.
7565
7693
  */
7566
7694
  function SdkLanguageProvider(_ref) {
7567
7695
  var children = _ref.children,
7568
7696
  lang = _ref.lang;
7697
+ var inherited = useContext(SdkLanguageContext);
7569
7698
  return /*#__PURE__*/createElement(SdkLanguageContext.Provider, {
7570
- value: lang === 'auto' ? detectedLanguage : lang
7699
+ value: lang === undefined ? inherited : lang === 'auto' ? detectedLanguage : lang
7571
7700
  }, children);
7572
7701
  }
7573
7702
  /**
@@ -38389,7 +38518,9 @@ function SubmissionProvider(_ref) {
38389
38518
  onComplete = _ref.onComplete,
38390
38519
  onApproved = _ref.onApproved,
38391
38520
  onDenied = _ref.onDenied,
38392
- onRequestFailure = _ref.onRequestFailure;
38521
+ onSubmissionFailure = _ref.onSubmissionFailure,
38522
+ onRequestFailure = _ref.onRequestFailure,
38523
+ mode = _ref.mode;
38393
38524
  var progress = useCaptureObserver();
38394
38525
  var clientState = useSyncExternalStore(client.subscribe, client.getState, client.getState);
38395
38526
  var _useAuthState = useAuthState(),
@@ -38402,10 +38533,22 @@ function SubmissionProvider(_ref) {
38402
38533
  _useState4 = _slicedToArray(_useState3, 2),
38403
38534
  localError = _useState4[0],
38404
38535
  setLocalError = _useState4[1];
38405
- var _useState5 = useState(false),
38536
+ var _useState5 = useState(IDLE_ATTEMPT),
38406
38537
  _useState6 = _slicedToArray(_useState5, 2),
38407
- resubmitting = _useState6[0],
38408
- setResubmitting = _useState6[1];
38538
+ attempt = _useState6[0],
38539
+ setAttempt = _useState6[1];
38540
+ // Which path the latest submission took. State is read from that path even
38541
+ // if `mode` changes while it is in flight; before any submission, `mode`
38542
+ // decides.
38543
+ var _useState7 = useState(null),
38544
+ _useState8 = _slicedToArray(_useState7, 2),
38545
+ startedExplicit = _useState8[0],
38546
+ setStartedExplicit = _useState8[1];
38547
+ var reportFailure = onSubmissionFailure != null ? onSubmissionFailure : onRequestFailure;
38548
+ var _useState9 = useState(false),
38549
+ _useState0 = _slicedToArray(_useState9, 2),
38550
+ resubmitting = _useState0[0],
38551
+ setResubmitting = _useState0[1];
38409
38552
  var lastArtifactsRef = useRef(null);
38410
38553
  var submitInFlightRef = useRef(null);
38411
38554
  var resubmitInFlightRef = useRef(null);
@@ -38423,6 +38566,71 @@ function SubmissionProvider(_ref) {
38423
38566
  }) : incoming;
38424
38567
  // Store the merged artifacts so a resubmit carries location too.
38425
38568
  lastArtifactsRef.current = artifacts;
38569
+ setStartedExplicit(mode !== undefined);
38570
+ if (mode !== undefined) {
38571
+ // Registered before anything customer-supplied runs, so a throw from
38572
+ // a notification can never leave the flow without a status.
38573
+ setAttempt(_extends({}, IDLE_ATTEMPT, {
38574
+ status: SubmissionStatus.SUBMITTING
38575
+ }));
38576
+ var _unbindProgress = bindSubmissionObserver(artifacts, progress);
38577
+ // The client call waits one microtask so the in-flight promise is
38578
+ // registered first: an `onSubmissionStarted` that calls `submit()`
38579
+ // gets this attempt back instead of starting a second one.
38580
+ var _promise = Promise.resolve().then(function () {
38581
+ return runAttempt(client, mode, artifacts, _extends({}, options, {
38582
+ action: action
38583
+ }));
38584
+ }).then(function (outcome) {
38585
+ setAttempt(_extends({}, outcome, {
38586
+ status: SubmissionStatus.SUBMITTED,
38587
+ error: null
38588
+ }));
38589
+ var response = outcome.response,
38590
+ request = outcome.request;
38591
+ if (response === null) {
38592
+ // Terminal once called; the handler is never awaited.
38593
+ if (typeof mode === 'object') {
38594
+ notifySafely('submitMode.handoff', function () {
38595
+ return mode.handoff(request);
38596
+ });
38597
+ }
38598
+ return null;
38599
+ }
38600
+ notifySafely('onComplete', function () {
38601
+ return onComplete == null ? void 0 : onComplete(response);
38602
+ });
38603
+ if (isApprovedResponse(action, response)) {
38604
+ notifySafely('onApproved', function () {
38605
+ return onApproved == null ? void 0 : onApproved(response);
38606
+ });
38607
+ } else {
38608
+ notifySafely('onDenied', function () {
38609
+ return onDenied == null ? void 0 : onDenied(response);
38610
+ });
38611
+ }
38612
+ return response;
38613
+ }, function (cause) {
38614
+ var error = cause instanceof Error ? cause : new Error(String(cause));
38615
+ setAttempt(_extends({}, IDLE_ATTEMPT, {
38616
+ status: SubmissionStatus.FAILED,
38617
+ error: error
38618
+ }));
38619
+ notifySafely('onSubmissionFailure', function () {
38620
+ return reportFailure == null ? void 0 : reportFailure(error);
38621
+ });
38622
+ throw error;
38623
+ })["finally"](function () {
38624
+ _unbindProgress();
38625
+ submitInFlightRef.current = null;
38626
+ setResubmitting(false);
38627
+ });
38628
+ submitInFlightRef.current = _promise;
38629
+ notifySafely('onSubmissionStarted', function () {
38630
+ return onSubmissionStarted == null ? void 0 : onSubmissionStarted(artifacts);
38631
+ });
38632
+ return _promise;
38633
+ }
38426
38634
  setSubmissionResponse(null);
38427
38635
  setLocalError(null);
38428
38636
  onSubmissionStarted == null || onSubmissionStarted(artifacts);
@@ -38443,7 +38651,7 @@ function SubmissionProvider(_ref) {
38443
38651
  })["catch"](function (cause) {
38444
38652
  var error = cause instanceof Error ? cause : new Error(String(cause));
38445
38653
  setLocalError(error);
38446
- onRequestFailure == null || onRequestFailure(error);
38654
+ reportFailure == null || reportFailure(error);
38447
38655
  throw error;
38448
38656
  })["finally"](function () {
38449
38657
  unbindProgress();
@@ -38452,7 +38660,7 @@ function SubmissionProvider(_ref) {
38452
38660
  });
38453
38661
  submitInFlightRef.current = promise;
38454
38662
  return promise;
38455
- }, [action, client, geolocation, onApproved, onComplete, onDenied, onRequestFailure, onSubmissionStarted, options, progress]);
38663
+ }, [action, client, geolocation, onApproved, onComplete, onDenied, reportFailure, onSubmissionStarted, options, progress, mode]);
38456
38664
  var resubmit = useMemo(function () {
38457
38665
  if (!authState.session.canRefreshSession) return null;
38458
38666
  return function () {
@@ -38497,22 +38705,120 @@ function SubmissionProvider(_ref) {
38497
38705
  }, [authState.session.canRefreshSession, client, submit]);
38498
38706
  var value = useMemo(function () {
38499
38707
  var _ref3, _clientState$lastSubm, _clientState$lastSubm2;
38708
+ if (startedExplicit != null ? startedExplicit : mode !== undefined) {
38709
+ return {
38710
+ action: action,
38711
+ submit: submit,
38712
+ submissionStatus: resubmitting ? SubmissionStatus.SUBMITTING : attempt.status,
38713
+ submissionResponse: attempt.response,
38714
+ submissionError: attempt.error,
38715
+ lastSubmissionTimings: attempt.timings,
38716
+ lastSubmissionRequest: attempt.request,
38717
+ resubmit: resubmit
38718
+ };
38719
+ }
38500
38720
  return {
38501
38721
  action: action,
38502
38722
  submit: submit,
38503
- submissionStatus: resubmitting ? SubmissionStatus.SUBMITTING : clientState.submissionStatus,
38723
+ // A rejection before the client records anything (an unsupported
38724
+ // action, an unvalidated session) leaves the client at READY, which the
38725
+ // wizard renders as its submitting screen; the local error is the
38726
+ // failure it would otherwise never show.
38727
+ submissionStatus: resubmitting ? SubmissionStatus.SUBMITTING : localError && clientState.submissionStatus === SubmissionStatus.READY ? SubmissionStatus.FAILED : clientState.submissionStatus,
38504
38728
  submissionResponse: submissionResponse,
38505
38729
  submissionError: (_ref3 = localError != null ? localError : clientState.submissionError) != null ? _ref3 : null,
38506
38730
  lastSubmissionTimings: (_clientState$lastSubm = clientState.lastSubmissionTimings) != null ? _clientState$lastSubm : null,
38507
38731
  lastSubmissionRequest: (_clientState$lastSubm2 = clientState.lastSubmissionRequest) != null ? _clientState$lastSubm2 : null,
38508
38732
  resubmit: resubmit
38509
38733
  };
38510
- }, [action, clientState.lastSubmissionRequest, clientState.lastSubmissionTimings, clientState.submissionError, clientState.submissionStatus, localError, resubmit, resubmitting, submissionResponse, submit]);
38734
+ }, [action, attempt, clientState.lastSubmissionRequest, clientState.lastSubmissionTimings, clientState.submissionError, clientState.submissionStatus, localError, mode, resubmit, resubmitting, startedExplicit, submissionResponse, submit]);
38511
38735
  return jsx(SubmissionContext.Provider, {
38512
38736
  value: value,
38513
38737
  children: children
38514
38738
  });
38515
38739
  }
38740
+ var IDLE_ATTEMPT = {
38741
+ status: SubmissionStatus.READY,
38742
+ response: null,
38743
+ request: null,
38744
+ timings: null,
38745
+ error: null
38746
+ };
38747
+ /**
38748
+ * One explicit-mode attempt through the client's `post()` or `handoff()`.
38749
+ * Never falls back to `submit()`: that would let the deprecated
38750
+ * `config.onSubmit` decide what an explicit mode already decided.
38751
+ */
38752
+ function runAttempt(_x, _x2, _x3, _x4) {
38753
+ return _runAttempt.apply(this, arguments);
38754
+ }
38755
+ function _runAttempt() {
38756
+ _runAttempt = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(client, mode, artifacts, options) {
38757
+ var _yield$client$handoff, request, timings;
38758
+ return _regeneratorRuntime.wrap(function (_context2) {
38759
+ while (1) switch (_context2.prev = _context2.next) {
38760
+ case 0:
38761
+ if (!(mode === 'capture')) {
38762
+ _context2.next = 1;
38763
+ break;
38764
+ }
38765
+ throw new Error("submitMode 'capture' does not submit; the flow reports onCaptured instead");
38766
+ case 1:
38767
+ if (!(mode === 'post')) {
38768
+ _context2.next = 3;
38769
+ break;
38770
+ }
38771
+ if (client.post) {
38772
+ _context2.next = 2;
38773
+ break;
38774
+ }
38775
+ throw missingMethod('post', "submitMode 'post'");
38776
+ case 2:
38777
+ return _context2.abrupt("return", client.post(artifacts, options));
38778
+ case 3:
38779
+ if (client.handoff) {
38780
+ _context2.next = 4;
38781
+ break;
38782
+ }
38783
+ throw missingMethod('handoff', 'submitMode { handoff }');
38784
+ case 4:
38785
+ _context2.next = 5;
38786
+ return client.handoff(artifacts, options);
38787
+ case 5:
38788
+ _yield$client$handoff = _context2.sent;
38789
+ request = _yield$client$handoff.request;
38790
+ timings = _yield$client$handoff.timings;
38791
+ return _context2.abrupt("return", {
38792
+ request: request,
38793
+ timings: timings,
38794
+ response: null
38795
+ });
38796
+ case 6:
38797
+ case "end":
38798
+ return _context2.stop();
38799
+ }
38800
+ }, _callee2);
38801
+ }));
38802
+ return _runAttempt.apply(this, arguments);
38803
+ }
38804
+ function missingMethod(method, needs) {
38805
+ return new Error(needs + " needs client." + method + "(), which this client does not have. " + 'Create the client with createIdmissionClient or useIdmissionClient.');
38806
+ }
38807
+ /**
38808
+ * Runs a customer callback whose failure must not change an outcome that is
38809
+ * already settled: a throw or a rejected promise is logged, never rethrown.
38810
+ */
38811
+ function notifySafely(name, notify) {
38812
+ try {
38813
+ // `Promise.resolve`, not `instanceof Promise`: a promise from another
38814
+ // realm (an iframe) fails that check, and its rejection would go unhandled.
38815
+ Promise.resolve(notify())["catch"](function (e) {
38816
+ return warn(name + " rejected", e);
38817
+ });
38818
+ } catch (e) {
38819
+ warn(name + " threw", e);
38820
+ }
38821
+ }
38516
38822
  function useSubmission() {
38517
38823
  var context = useContext(SubmissionContext);
38518
38824
  if (!context) {
@@ -39422,15 +39728,15 @@ var Root = styled.div(_templateObject$2 || (_templateObject$2 = _taggedTemplateL
39422
39728
  var Label = styled.span(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteralLoose(["\n max-width: 32rem;\n text-align: center;\n text-wrap: pretty;\n font-size: 14px;\n font-weight: 600;\n letter-spacing: 0.01em;\n"])));
39423
39729
 
39424
39730
  function CompositeWizard(_ref) {
39425
- var _successScreen$isAppr;
39731
+ var _successScreen$isAppr, _ref2;
39426
39732
  var steps = _ref.steps,
39427
39733
  sessionReadyProp = _ref.sessionReady,
39428
39734
  _ref$initialArtifacts = _ref.initialArtifacts,
39429
39735
  initialArtifacts = _ref$initialArtifacts === void 0 ? {} : _ref$initialArtifacts,
39430
39736
  _ref$captureOnly = _ref.captureOnly,
39431
39737
  captureOnly = _ref$captureOnly === void 0 ? false : _ref$captureOnly,
39432
- _ref$showSuccessScree = _ref.showSuccessScreen,
39433
- showSuccessScreen = _ref$showSuccessScree === void 0 ? false : _ref$showSuccessScree,
39738
+ showResultScreen = _ref.showResultScreen,
39739
+ showSuccessScreen = _ref.showSuccessScreen,
39434
39740
  _ref$showDiagnostics = _ref.showDiagnostics,
39435
39741
  showDiagnostics = _ref$showDiagnostics === void 0 ? false : _ref$showDiagnostics,
39436
39742
  successClassNames = _ref.successClassNames,
@@ -39580,7 +39886,7 @@ function CompositeWizard(_ref) {
39580
39886
  classNames: successScreen.classNames
39581
39887
  });
39582
39888
  }
39583
- if (submissionStatus === SubmissionStatus.SUBMITTED && submissionResponse && showSuccessScreen) {
39889
+ if (submissionStatus === SubmissionStatus.SUBMITTED && submissionResponse && ((_ref2 = showResultScreen != null ? showResultScreen : showSuccessScreen) != null ? _ref2 : false)) {
39584
39890
  return jsx(SubmissionSuccess, {
39585
39891
  response: submissionResponse,
39586
39892
  request: lastSubmissionRequest,
@@ -39617,8 +39923,8 @@ function capturedArtifactLabels(artifacts) {
39617
39923
  });
39618
39924
  return labels;
39619
39925
  }
39620
- function SubmittingScreen(_ref2) {
39621
- var text = _ref2.text;
39926
+ function SubmittingScreen(_ref3) {
39927
+ var text = _ref3.text;
39622
39928
  return jsx(OrbStatusScreen, {
39623
39929
  state: "working",
39624
39930
  text: text,
@@ -40377,11 +40683,12 @@ function RemoteDiagnosticsMount(_ref) {
40377
40683
  }
40378
40684
 
40379
40685
  var _templateObject$1, _templateObject2$1, _templateObject3, _templateObject4;
40380
- var _excluded$9 = ["client", "action", "submission", "theme", "className", "geolocationEnabled", "geolocationRequired", "captureProgress", "remoteDiagnostics", "loadingSpinner", "showEnrollmentId", "children"];
40686
+ var _excluded$9 = ["client", "action", "submission", "submitMode", "theme", "className", "geolocationEnabled", "geolocationRequired", "captureProgress", "remoteDiagnostics", "loadingSpinner", "showEnrollmentId", "lang", "children"];
40381
40687
  function FlowChassis(_ref) {
40382
40688
  var client = _ref.client,
40383
40689
  action = _ref.action,
40384
40690
  submission = _ref.submission,
40691
+ submitMode = _ref.submitMode,
40385
40692
  _ref$theme = _ref.theme,
40386
40693
  theme = _ref$theme === void 0 ? 'default' : _ref$theme,
40387
40694
  className = _ref.className,
@@ -40394,6 +40701,7 @@ function FlowChassis(_ref) {
40394
40701
  loadingSpinner = _ref.loadingSpinner,
40395
40702
  _ref$showEnrollmentId = _ref.showEnrollmentId,
40396
40703
  showEnrollmentId = _ref$showEnrollmentId === void 0 ? false : _ref$showEnrollmentId,
40704
+ lang = _ref.lang,
40397
40705
  children = _ref.children,
40398
40706
  callbacks = _objectWithoutPropertiesLoose(_ref, _excluded$9);
40399
40707
  var geolocation = useGeolocation(geolocationEnabled);
@@ -40403,26 +40711,30 @@ function FlowChassis(_ref) {
40403
40711
  client: client,
40404
40712
  children: [jsx(RemoteDiagnosticsMount, {
40405
40713
  remoteDiagnostics: remoteDiagnostics
40406
- }), jsx(ThemeProvider, {
40407
- theme: theme,
40408
- children: jsx(LoadingSpinnerProvider, {
40409
- spinner: loadingSpinner,
40410
- children: jsx(SubmissionProvider, _extends({
40411
- client: client,
40412
- action: action,
40413
- options: submission,
40414
- geolocation: geolocation.position
40415
- }, callbacks, {
40416
- children: jsx(FlowPage, {
40417
- className: className,
40418
- enrollmentId: showEnrollmentId ? submission == null ? void 0 : submission.enrollmentId : undefined,
40419
- children: jsx(AuthGate, {
40420
- children: geolocationRequired && geolocation.blocked ? jsx(GeolocationAccessDeniedOverlay, {
40421
- onRetry: geolocation.retry
40422
- }) : children
40714
+ }), jsx(SdkLanguageProvider, {
40715
+ lang: lang,
40716
+ children: jsx(ThemeProvider, {
40717
+ theme: theme,
40718
+ children: jsx(LoadingSpinnerProvider, {
40719
+ spinner: loadingSpinner,
40720
+ children: jsx(SubmissionProvider, _extends({
40721
+ client: client,
40722
+ action: action,
40723
+ options: submission,
40724
+ mode: submitMode,
40725
+ geolocation: geolocation.position
40726
+ }, callbacks, {
40727
+ children: jsx(FlowPage, {
40728
+ className: className,
40729
+ enrollmentId: showEnrollmentId ? submission == null ? void 0 : submission.enrollmentId : undefined,
40730
+ children: jsx(AuthGate, {
40731
+ children: geolocationRequired && geolocation.blocked ? jsx(GeolocationAccessDeniedOverlay, {
40732
+ onRetry: geolocation.retry
40733
+ }) : children
40734
+ })
40423
40735
  })
40424
- })
40425
- }))
40736
+ }))
40737
+ })
40426
40738
  })
40427
40739
  })]
40428
40740
  })
@@ -40582,6 +40894,26 @@ function impliedSkipSuccessScreen(explicit, introActive) {
40582
40894
  return explicit != null ? explicit : introActive;
40583
40895
  }
40584
40896
 
40897
+ /**
40898
+ * A step bag with the flow's settings filled in wherever the step leaves them
40899
+ * unset: `step ?? flow`, key by key. The step's own value always wins, an
40900
+ * explicit `false` included, so a flow-wide setting never overrides a step.
40901
+ *
40902
+ * `flow` is typed against the step bag, so a setting the step has no prop for
40903
+ * (`debugMode` on the signature step, say) fails to compile instead of being
40904
+ * forwarded to a component that ignores it.
40905
+ */
40906
+ function inheritFlowSettings(step, flow) {
40907
+ var inherited = {};
40908
+ for (var key in flow) {
40909
+ if (!Object.prototype.hasOwnProperty.call(flow, key)) continue;
40910
+ if ((step == null ? void 0 : step[key]) === undefined && flow[key] !== undefined) {
40911
+ inherited[key] = flow[key];
40912
+ }
40913
+ }
40914
+ return _extends({}, step, inherited);
40915
+ }
40916
+
40585
40917
  function buildRingScreenProps(_ref) {
40586
40918
  var ringMode = _ref.ringMode,
40587
40919
  finishingVerbiage = _ref.finishingVerbiage,
@@ -40710,7 +41042,7 @@ function withVirtualCameras(camera, allowVirtualCameras) {
40710
41042
  return base;
40711
41043
  }
40712
41044
 
40713
- var _excluded$8 = ["client", "controller", "capture", "view", "submission", "initialArtifacts", "captureOnly", "signatureController", "signatureCapture", "signatureView", "captureSignature", "captureSignatureVideo", "allowVirtualCameras", "theme", "className", "showSuccessScreen", "showDiagnostics", "captureAdditionalDocuments", "additionalDocumentClassNames", "additionalDocumentVerbiage", "ringScreenClassNames", "ringScreenVerbiage", "onCaptured", "onSubmitted", "children"];
41045
+ 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"];
40714
41046
  var EMPTY_ID_CAPTURE$3 = {};
40715
41047
  var EMPTY_SIGNATURE_CAPTURE$5 = {};
40716
41048
  var EMPTY_ID_VIEW$3 = {};
@@ -40722,24 +41054,27 @@ function IdValidationFlow(_ref) {
40722
41054
  _ref$capture = _ref.capture,
40723
41055
  capture = _ref$capture === void 0 ? EMPTY_ID_CAPTURE$3 : _ref$capture,
40724
41056
  _ref$view = _ref.view,
40725
- view = _ref$view === void 0 ? EMPTY_ID_VIEW$3 : _ref$view,
41057
+ viewProp = _ref$view === void 0 ? EMPTY_ID_VIEW$3 : _ref$view,
40726
41058
  _ref$submission = _ref.submission,
40727
41059
  submission = _ref$submission === void 0 ? EMPTY_SUBMISSION$6 : _ref$submission,
40728
41060
  _ref$initialArtifacts = _ref.initialArtifacts,
40729
41061
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$9 : _ref$initialArtifacts,
40730
- _ref$captureOnly = _ref.captureOnly,
40731
- captureOnly = _ref$captureOnly === void 0 ? false : _ref$captureOnly,
41062
+ submitMode = _ref.submitMode,
41063
+ captureOnly = _ref.captureOnly,
40732
41064
  signatureController = _ref.signatureController,
40733
41065
  _ref$signatureCapture = _ref.signatureCapture,
40734
41066
  signatureCapture = _ref$signatureCapture === void 0 ? EMPTY_SIGNATURE_CAPTURE$5 : _ref$signatureCapture,
40735
- signatureView = _ref.signatureView,
41067
+ signatureViewProp = _ref.signatureView,
40736
41068
  captureSignature = _ref.captureSignature,
40737
41069
  captureSignatureVideo = _ref.captureSignatureVideo,
40738
41070
  allowVirtualCameras = _ref.allowVirtualCameras,
40739
41071
  theme = _ref.theme,
40740
41072
  className = _ref.className,
40741
- _ref$showSuccessScree = _ref.showSuccessScreen,
40742
- showSuccessScreen = _ref$showSuccessScree === void 0 ? false : _ref$showSuccessScree,
41073
+ lang = _ref.lang,
41074
+ debugMode = _ref.debugMode,
41075
+ skipSuccessScreen = _ref.skipSuccessScreen,
41076
+ showResultScreen = _ref.showResultScreen,
41077
+ showSuccessScreen = _ref.showSuccessScreen,
40743
41078
  _ref$showDiagnostics = _ref.showDiagnostics,
40744
41079
  showDiagnostics = _ref$showDiagnostics === void 0 ? false : _ref$showDiagnostics,
40745
41080
  captureAdditionalDocuments = _ref.captureAdditionalDocuments,
@@ -40751,6 +41086,23 @@ function IdValidationFlow(_ref) {
40751
41086
  onSubmitted = _ref.onSubmitted,
40752
41087
  children = _ref.children,
40753
41088
  callbacks = _objectWithoutPropertiesLoose(_ref, _excluded$8);
41089
+ // Flow-wide settings reach each step unless its own bag sets them.
41090
+ var _useMemo = useMemo(function () {
41091
+ return {
41092
+ view: inheritFlowSettings(viewProp, {
41093
+ lang: lang,
41094
+ debugMode: debugMode,
41095
+ skipSuccessScreen: skipSuccessScreen
41096
+ }),
41097
+ signatureView: inheritFlowSettings(signatureViewProp, {
41098
+ lang: lang,
41099
+ showCaptureDiagnostics: debugMode,
41100
+ skipSuccessScreen: skipSuccessScreen
41101
+ })
41102
+ };
41103
+ }, [debugMode, lang, signatureViewProp, skipSuccessScreen, viewProp]),
41104
+ view = _useMemo.view,
41105
+ signatureView = _useMemo.signatureView;
40754
41106
  useMountOnlyWarnings('IdValidationFlow', FLOW_MOUNT_ONLY_REMEDY, {
40755
41107
  capture: capture,
40756
41108
  signatureCapture: signatureCapture
@@ -40867,18 +41219,21 @@ function IdValidationFlow(_ref) {
40867
41219
  successIssuerCaptionText: 'confirmed'
40868
41220
  }
40869
41221
  });
41222
+ var mode = submitMode != null ? submitMode : captureOnly ? 'capture' : undefined;
40870
41223
  return jsxs(FlowChassis, _extends({
40871
41224
  client: client,
40872
41225
  action: SubmissionAction.VALIDATE,
40873
41226
  submission: submission,
41227
+ submitMode: mode,
40874
41228
  theme: theme,
40875
- className: className
41229
+ className: className,
41230
+ lang: lang
40876
41231
  }, callbacks, {
40877
41232
  children: [jsx(CompositeWizard, _extends({}, ringScreens, {
40878
41233
  steps: steps,
40879
41234
  initialArtifacts: initialArtifacts,
40880
- captureOnly: captureOnly,
40881
- showSuccessScreen: showSuccessScreen,
41235
+ captureOnly: mode === 'capture',
41236
+ showResultScreen: showResultScreen != null ? showResultScreen : showSuccessScreen,
40882
41237
  showDiagnostics: showDiagnostics,
40883
41238
  onArtifactsCollected: onCaptured,
40884
41239
  onSubmitted: onSubmitted
@@ -40897,13 +41252,16 @@ function FaceValidationFlow(_ref) {
40897
41252
  _ref$capture = _ref.capture,
40898
41253
  capture = _ref$capture === void 0 ? EMPTY_FACE_CAPTURE$5 : _ref$capture,
40899
41254
  _ref$view = _ref.view,
40900
- view = _ref$view === void 0 ? EMPTY_FACE_VIEW$5 : _ref$view,
41255
+ viewProp = _ref$view === void 0 ? EMPTY_FACE_VIEW$5 : _ref$view,
40901
41256
  _ref$submission = _ref.submission,
40902
41257
  submission = _ref$submission === void 0 ? EMPTY_SUBMISSION$5 : _ref$submission,
40903
41258
  _ref$initialArtifacts = _ref.initialArtifacts,
40904
41259
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$8 : _ref$initialArtifacts,
40905
41260
  theme = _ref.theme,
40906
41261
  className = _ref.className,
41262
+ lang = _ref.lang,
41263
+ debugMode = _ref.debugMode,
41264
+ skipSuccessScreen = _ref.skipSuccessScreen,
40907
41265
  geolocationEnabled = _ref.geolocationEnabled,
40908
41266
  geolocationRequired = _ref.geolocationRequired,
40909
41267
  captureProgress = _ref.captureProgress,
@@ -40912,6 +41270,14 @@ function FaceValidationFlow(_ref) {
40912
41270
  onCaptured = _ref.onCaptured,
40913
41271
  onCaptureError = _ref.onCaptureError,
40914
41272
  children = _ref.children;
41273
+ // Flow-wide settings reach the step unless its own bag sets them.
41274
+ var view = useMemo(function () {
41275
+ return inheritFlowSettings(viewProp, {
41276
+ lang: lang,
41277
+ debugMode: debugMode,
41278
+ skipSuccessScreen: skipSuccessScreen
41279
+ });
41280
+ }, [debugMode, lang, skipSuccessScreen, viewProp]);
40915
41281
  var checkLivenessOptions = capture.checkLivenessOptions,
40916
41282
  controllerCapture = _objectWithoutPropertiesLoose(capture, _excluded$7);
40917
41283
  useMountOnlyWarnings('FaceValidationFlow', FLOW_MOUNT_ONLY_REMEDY, {
@@ -40972,6 +41338,7 @@ function FaceValidationFlow(_ref) {
40972
41338
  submission: submission,
40973
41339
  theme: theme,
40974
41340
  className: className,
41341
+ lang: lang,
40975
41342
  geolocationEnabled: geolocationEnabled,
40976
41343
  geolocationRequired: geolocationRequired,
40977
41344
  captureProgress: captureProgress,
@@ -40986,7 +41353,7 @@ function FaceValidationFlow(_ref) {
40986
41353
  });
40987
41354
  }
40988
41355
 
40989
- var _excluded$6 = ["client", "idController", "selfieController", "signatureController", "idCapture", "faceCapture", "signatureCapture", "idView", "faceView", "signatureView", "captureSignature", "captureSignatureVideo", "allowVirtualCameras", "submission", "initialArtifacts", "theme", "className", "showSuccessScreen", "showDiagnostics", "captureAdditionalDocuments", "additionalDocumentClassNames", "additionalDocumentVerbiage", "ringScreenClassNames", "ringScreenVerbiage", "onSubmitted", "onCaptureError", "onStepStarted", "onStepCompleted", "children"],
41356
+ var _excluded$6 = ["client", "idController", "selfieController", "signatureController", "idCapture", "faceCapture", "signatureCapture", "idView", "faceView", "signatureView", "captureSignature", "captureSignatureVideo", "allowVirtualCameras", "submission", "initialArtifacts", "theme", "className", "lang", "debugMode", "skipSuccessScreen", "showResultScreen", "showSuccessScreen", "showDiagnostics", "captureAdditionalDocuments", "additionalDocumentClassNames", "additionalDocumentVerbiage", "ringScreenClassNames", "ringScreenVerbiage", "onSubmitted", "onCaptureError", "onStepStarted", "onStepCompleted", "children"],
40990
41357
  _excluded2$3 = ["checkLivenessOptions"];
40991
41358
  var EMPTY_ID_CAPTURE$2 = {};
40992
41359
  var EMPTY_FACE_CAPTURE$4 = {};
@@ -41008,10 +41375,10 @@ function IdAndFaceValidationFlow(_ref) {
41008
41375
  _ref$signatureCapture = _ref.signatureCapture,
41009
41376
  signatureCapture = _ref$signatureCapture === void 0 ? EMPTY_SIGNATURE_CAPTURE$4 : _ref$signatureCapture,
41010
41377
  _ref$idView = _ref.idView,
41011
- idView = _ref$idView === void 0 ? EMPTY_ID_VIEW$2 : _ref$idView,
41378
+ idViewProp = _ref$idView === void 0 ? EMPTY_ID_VIEW$2 : _ref$idView,
41012
41379
  _ref$faceView = _ref.faceView,
41013
- faceView = _ref$faceView === void 0 ? EMPTY_FACE_VIEW$4 : _ref$faceView,
41014
- signatureView = _ref.signatureView,
41380
+ faceViewProp = _ref$faceView === void 0 ? EMPTY_FACE_VIEW$4 : _ref$faceView,
41381
+ signatureViewProp = _ref.signatureView,
41015
41382
  captureSignature = _ref.captureSignature,
41016
41383
  captureSignatureVideo = _ref.captureSignatureVideo,
41017
41384
  allowVirtualCameras = _ref.allowVirtualCameras,
@@ -41021,8 +41388,11 @@ function IdAndFaceValidationFlow(_ref) {
41021
41388
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$7 : _ref$initialArtifacts,
41022
41389
  theme = _ref.theme,
41023
41390
  className = _ref.className,
41024
- _ref$showSuccessScree = _ref.showSuccessScreen,
41025
- showSuccessScreen = _ref$showSuccessScree === void 0 ? false : _ref$showSuccessScree,
41391
+ lang = _ref.lang,
41392
+ debugMode = _ref.debugMode,
41393
+ skipSuccessScreen = _ref.skipSuccessScreen,
41394
+ showResultScreen = _ref.showResultScreen,
41395
+ showSuccessScreen = _ref.showSuccessScreen,
41026
41396
  _ref$showDiagnostics = _ref.showDiagnostics,
41027
41397
  showDiagnostics = _ref$showDiagnostics === void 0 ? false : _ref$showDiagnostics,
41028
41398
  captureAdditionalDocuments = _ref.captureAdditionalDocuments,
@@ -41036,6 +41406,26 @@ function IdAndFaceValidationFlow(_ref) {
41036
41406
  onStepCompleted = _ref.onStepCompleted,
41037
41407
  children = _ref.children,
41038
41408
  callbacks = _objectWithoutPropertiesLoose(_ref, _excluded$6);
41409
+ // Flow-wide settings reach each step unless its own bag sets them.
41410
+ var _useMemo = useMemo(function () {
41411
+ var settings = {
41412
+ lang: lang,
41413
+ debugMode: debugMode,
41414
+ skipSuccessScreen: skipSuccessScreen
41415
+ };
41416
+ return {
41417
+ idView: inheritFlowSettings(idViewProp, settings),
41418
+ faceView: inheritFlowSettings(faceViewProp, settings),
41419
+ signatureView: inheritFlowSettings(signatureViewProp, {
41420
+ lang: lang,
41421
+ showCaptureDiagnostics: debugMode,
41422
+ skipSuccessScreen: skipSuccessScreen
41423
+ })
41424
+ };
41425
+ }, [debugMode, faceViewProp, idViewProp, lang, signatureViewProp, skipSuccessScreen]),
41426
+ idView = _useMemo.idView,
41427
+ faceView = _useMemo.faceView,
41428
+ signatureView = _useMemo.signatureView;
41039
41429
  var checkLivenessOptions = faceCapture.checkLivenessOptions,
41040
41430
  selfieCaptureConfig = _objectWithoutPropertiesLoose(faceCapture, _excluded2$3);
41041
41431
  useMountOnlyWarnings('IdAndFaceValidationFlow', FLOW_MOUNT_ONLY_REMEDY, {
@@ -41206,12 +41596,13 @@ function IdAndFaceValidationFlow(_ref) {
41206
41596
  action: SubmissionAction.VALIDATE,
41207
41597
  submission: submission,
41208
41598
  theme: theme,
41209
- className: className
41599
+ className: className,
41600
+ lang: lang
41210
41601
  }, callbacks, {
41211
41602
  children: [jsx(CompositeWizard, _extends({}, ringScreens, {
41212
41603
  steps: steps,
41213
41604
  initialArtifacts: initialArtifacts,
41214
- showSuccessScreen: showSuccessScreen,
41605
+ showResultScreen: showResultScreen != null ? showResultScreen : showSuccessScreen,
41215
41606
  showDiagnostics: showDiagnostics,
41216
41607
  onSubmitted: onSubmitted,
41217
41608
  onStepStarted: onStepStarted,
@@ -41266,9 +41657,9 @@ function SignatureKYCFlow(_ref) {
41266
41657
  _ref$signatureCapture = _ref.signatureCapture,
41267
41658
  signatureCapture = _ref$signatureCapture === void 0 ? EMPTY_SIGNATURE_CAPTURE$3 : _ref$signatureCapture,
41268
41659
  _ref$faceView = _ref.faceView,
41269
- faceView = _ref$faceView === void 0 ? EMPTY_FACE_VIEW$3 : _ref$faceView,
41660
+ faceViewProp = _ref$faceView === void 0 ? EMPTY_FACE_VIEW$3 : _ref$faceView,
41270
41661
  _ref$signatureView = _ref.signatureView,
41271
- signatureView = _ref$signatureView === void 0 ? EMPTY_SIGNATURE_VIEW : _ref$signatureView,
41662
+ signatureViewProp = _ref$signatureView === void 0 ? EMPTY_SIGNATURE_VIEW : _ref$signatureView,
41272
41663
  challengeResponse = _ref.challengeResponse,
41273
41664
  allowVirtualCameras = _ref.allowVirtualCameras,
41274
41665
  _ref$allowHigherCamer = _ref.allowHigherCameraResolutions,
@@ -41294,13 +41685,35 @@ function SignatureKYCFlow(_ref) {
41294
41685
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$6 : _ref$initialArtifacts,
41295
41686
  theme = _ref.theme,
41296
41687
  className = _ref.className,
41688
+ lang = _ref.lang,
41689
+ debugMode = _ref.debugMode,
41297
41690
  geolocationEnabled = _ref.geolocationEnabled,
41298
41691
  geolocationRequired = _ref.geolocationRequired,
41299
41692
  captureProgress = _ref.captureProgress,
41300
41693
  remoteDiagnostics = _ref.remoteDiagnostics,
41301
41694
  loadingSpinner = _ref.loadingSpinner,
41695
+ _ref$submitMode = _ref.submitMode,
41696
+ submitMode = _ref$submitMode === void 0 ? 'capture' : _ref$submitMode,
41697
+ onSubmissionStarted = _ref.onSubmissionStarted,
41698
+ onSubmissionFailure = _ref.onSubmissionFailure,
41302
41699
  onCaptured = _ref.onCaptured,
41303
41700
  onCaptureError = _ref.onCaptureError;
41701
+ // Flow-wide settings reach each step unless its own bag sets them.
41702
+ var _useMemo = useMemo(function () {
41703
+ return {
41704
+ faceView: inheritFlowSettings(faceViewProp, {
41705
+ lang: lang,
41706
+ debugMode: debugMode
41707
+ }),
41708
+ signatureView: inheritFlowSettings(signatureViewProp, {
41709
+ lang: lang,
41710
+ showCaptureDiagnostics: debugMode,
41711
+ skipSuccessScreen: skipSuccessScreen
41712
+ })
41713
+ };
41714
+ }, [debugMode, faceViewProp, lang, signatureViewProp, skipSuccessScreen]),
41715
+ faceView = _useMemo.faceView,
41716
+ signatureView = _useMemo.signatureView;
41304
41717
  var checkLivenessOptions = faceCapture.checkLivenessOptions,
41305
41718
  selfieCaptureConfig = _objectWithoutPropertiesLoose(faceCapture, _excluded$5);
41306
41719
  useMountOnlyWarnings('SignatureKYCFlow', FLOW_MOUNT_ONLY_REMEDY, {
@@ -41311,7 +41724,7 @@ function SignatureKYCFlow(_ref) {
41311
41724
  var latestSelfieCapture = useLatestCallbacks(selfieCaptureConfig);
41312
41725
  var latestSelfieLiveness = useLatestCallbacks(selfieCaptureConfig.liveness);
41313
41726
  var latestSignatureCapture = useLatestCallbacks(signatureCapture);
41314
- var legacyVideoLayout = (_signatureView$legacy = signatureView == null ? void 0 : signatureView.legacyVideoLayout) != null ? _signatureView$legacy : false;
41727
+ var legacyVideoLayout = (_signatureView$legacy = signatureView.legacyVideoLayout) != null ? _signatureView$legacy : false;
41315
41728
  var onExitAfterLivenessFailure = faceView.onExitAfterFailure;
41316
41729
  var sharedVideoRef = useRef(null);
41317
41730
  var _useState = useState(null),
@@ -41478,13 +41891,21 @@ function SignatureKYCFlow(_ref) {
41478
41891
  resolvedSelfieController.actions.retry();
41479
41892
  setStage('face-liveness');
41480
41893
  }, [resolvedSelfieController]);
41894
+ // Lives here, above the chassis's session gate: a session error unmounts
41895
+ // and remounts `SignatureHandoff`, and must not start the hand-off again.
41896
+ var handoffStartedRef = useRef(false);
41897
+ var claimHandoffStart = useCallback(function () {
41898
+ if (handoffStartedRef.current) return false;
41899
+ handoffStartedRef.current = true;
41900
+ return true;
41901
+ }, []);
41481
41902
  var handleSignatureCompleted = useCallback(function (artifacts) {
41482
41903
  if (completedRef.current) return;
41483
41904
  completedRef.current = true;
41484
41905
  artifactsRef.current = mergeSubmissionArtifacts(artifactsRef.current, artifacts);
41485
41906
  setStage('complete');
41486
- onCaptured == null || onCaptured(artifactsRef.current);
41487
- }, [onCaptured]);
41907
+ if (submitMode === 'capture') onCaptured == null || onCaptured(artifactsRef.current);
41908
+ }, [onCaptured, submitMode]);
41488
41909
  var handleLivenessFailureExit = useCallback(function () {
41489
41910
  onExitAfterLivenessFailure == null || onExitAfterLivenessFailure();
41490
41911
  if (allowSignatureAfterLivenessCheckFailure) handleLivenessDone();
@@ -41493,18 +41914,25 @@ function SignatureKYCFlow(_ref) {
41493
41914
  client: client,
41494
41915
  action: SubmissionAction.NONE,
41495
41916
  submission: submission,
41917
+ submitMode: submitMode,
41918
+ onSubmissionStarted: onSubmissionStarted,
41919
+ onSubmissionFailure: onSubmissionFailure,
41496
41920
  theme: theme,
41497
41921
  className: className,
41922
+ lang: lang,
41498
41923
  geolocationEnabled: geolocationEnabled,
41499
41924
  geolocationRequired: geolocationRequired,
41500
41925
  captureProgress: captureProgress,
41501
41926
  remoteDiagnostics: remoteDiagnostics,
41502
41927
  loadingSpinner: loadingSpinner,
41503
41928
  children: [jsx(CaptureProgressCompletion, {
41504
- completed: stage === 'complete'
41505
- }), stage !== 'complete' ? jsxs(HandoffRoot, {
41929
+ completed: stage === 'complete' && submitMode === 'capture'
41930
+ }), stage === 'complete' && submitMode !== 'capture' ? jsx(SignatureHandoff, {
41931
+ artifacts: artifactsRef.current,
41932
+ claimStart: claimHandoffStart
41933
+ }) : null, stage !== 'complete' ? jsxs(HandoffRoot, {
41506
41934
  children: [jsx(SignatureCaptureView, _extends({}, signatureView, {
41507
- skipSuccessScreen: impliedSkipSuccessScreen(skipSuccessScreen != null ? skipSuccessScreen : signatureView.skipSuccessScreen, isRingIntroActive(faceView)),
41935
+ skipSuccessScreen: impliedSkipSuccessScreen(signatureView.skipSuccessScreen, isRingIntroActive(faceView)),
41508
41936
  controller: resolvedSignatureController,
41509
41937
  sessionReady: renderedStage === 'signature-capture',
41510
41938
  videoRef: sharedVideoRef,
@@ -41552,6 +41980,43 @@ function SignatureKYCFlow(_ref) {
41552
41980
  }) : null]
41553
41981
  });
41554
41982
  }
41983
+ /**
41984
+ * Hands the finished capture off once the session has passed: a finishing
41985
+ * screen while the request is built, a retry screen if that fails, and
41986
+ * nothing once it has been handed off.
41987
+ */
41988
+ function SignatureHandoff(_ref3) {
41989
+ var artifacts = _ref3.artifacts,
41990
+ claimStart = _ref3.claimStart;
41991
+ var _useSubmission = useSubmission(),
41992
+ action = _useSubmission.action,
41993
+ submit = _useSubmission.submit,
41994
+ submissionStatus = _useSubmission.submissionStatus,
41995
+ submissionError = _useSubmission.submissionError;
41996
+ var sessionReady = useSessionReady();
41997
+ // The provider reports a failure itself; these catches only keep the
41998
+ // rejection from going unhandled.
41999
+ useEffect(function () {
42000
+ if (!sessionReady || !claimStart()) return;
42001
+ submit(artifacts)["catch"](function () {});
42002
+ }, [artifacts, claimStart, sessionReady, submit]);
42003
+ if (submissionStatus === SubmissionStatus.SUBMITTED) return null;
42004
+ if (submissionStatus === SubmissionStatus.FAILED) {
42005
+ return jsx(SubmissionErrorOverlay, {
42006
+ error: submissionError,
42007
+ onRetry: function onRetry() {
42008
+ submit(artifacts)["catch"](function () {});
42009
+ }
42010
+ });
42011
+ }
42012
+ var text = submissionStatusText(action, artifacts);
42013
+ return jsx(OrbStatusScreen, {
42014
+ state: "working",
42015
+ text: text,
42016
+ accessibleLabel: text,
42017
+ loadingStage: "submission"
42018
+ });
42019
+ }
41555
42020
  /**
41556
42021
  * Black, so iOS Safari's bars read as letterboxing around the camera feed
41557
42022
  * rather than as one more colour a theme has to choose.
@@ -41569,10 +42034,10 @@ var CAMERA_EDGE_COLOR = '#000';
41569
42034
  * no flat strip can sit on its bottom edge unseen: that one is drawn invisibly,
41570
42035
  * as on ID capture's overlay. Opaque, it covered the bottom 12px of the bar.
41571
42036
  */
41572
- function FlowEdgeTint(_ref3) {
42037
+ function FlowEdgeTint(_ref4) {
41573
42038
  var _theme$selfieCapture$, _theme$selfieCapture, _theme$background;
41574
- var surface = _ref3.surface,
41575
- modelsReady = _ref3.modelsReady;
42039
+ var surface = _ref4.surface,
42040
+ modelsReady = _ref4.modelsReady;
41576
42041
  var theme = useTheme();
41577
42042
  if (theme.isFullscreen === false || surface === null) return null;
41578
42043
  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');
@@ -41582,9 +42047,9 @@ function FlowEdgeTint(_ref3) {
41582
42047
  hiddenBottomColor: surface === 'overlay' ? selfieLoadingOverlayBottomEdgeColor(theme, modelsReady) : undefined
41583
42048
  });
41584
42049
  }
41585
- function SelfieTrackerAttachment(_ref4) {
41586
- var controller = _ref4.controller,
41587
- video = _ref4.video;
42050
+ function SelfieTrackerAttachment(_ref5) {
42051
+ var controller = _ref5.controller,
42052
+ video = _ref5.video;
41588
42053
  useEffect(function () {
41589
42054
  if (!video) return;
41590
42055
  void controller.attach(video)["catch"](function () {
@@ -41602,7 +42067,7 @@ var FaceStage = styled.div(_templateObject2 || (_templateObject2 = _taggedTempla
41602
42067
  return props.$visible ? 'block' : 'none';
41603
42068
  });
41604
42069
 
41605
- 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", "showSuccessScreen", "showDiagnostics", "captureAdditionalDocuments", "additionalDocumentClassNames", "additionalDocumentVerbiage", "ringScreenClassNames", "ringScreenVerbiage", "onCaptured", "onSubmitted", "onCaptureError", "children"],
42070
+ 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"],
41606
42071
  _excluded2$2 = ["checkLivenessOptions"];
41607
42072
  var EMPTY_ID_CAPTURE$1 = {};
41608
42073
  var EMPTY_FACE_CAPTURE$2 = {};
@@ -41626,21 +42091,21 @@ function VideoIdValidationFlow(_ref) {
41626
42091
  _ref$capture = _ref.capture,
41627
42092
  capture = _ref$capture === void 0 ? EMPTY_VIDEO_CAPTURE : _ref$capture,
41628
42093
  _ref$idView = _ref.idView,
41629
- idView = _ref$idView === void 0 ? EMPTY_ID_VIEW$1 : _ref$idView,
42094
+ idViewProp = _ref$idView === void 0 ? EMPTY_ID_VIEW$1 : _ref$idView,
41630
42095
  _ref$faceView = _ref.faceView,
41631
- faceView = _ref$faceView === void 0 ? EMPTY_FACE_VIEW$2 : _ref$faceView,
42096
+ faceViewProp = _ref$faceView === void 0 ? EMPTY_FACE_VIEW$2 : _ref$faceView,
41632
42097
  _ref$view = _ref.view,
41633
- view = _ref$view === void 0 ? EMPTY_VIDEO_VIEW : _ref$view,
42098
+ viewProp = _ref$view === void 0 ? EMPTY_VIDEO_VIEW : _ref$view,
41634
42099
  _ref$submission = _ref.submission,
41635
42100
  submission = _ref$submission === void 0 ? EMPTY_SUBMISSION$2 : _ref$submission,
41636
42101
  _ref$initialArtifacts = _ref.initialArtifacts,
41637
42102
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$5 : _ref$initialArtifacts,
41638
- _ref$captureOnly = _ref.captureOnly,
41639
- captureOnly = _ref$captureOnly === void 0 ? false : _ref$captureOnly,
42103
+ submitMode = _ref.submitMode,
42104
+ captureOnly = _ref.captureOnly,
41640
42105
  signatureController = _ref.signatureController,
41641
42106
  _ref$signatureCapture = _ref.signatureCapture,
41642
42107
  signatureCapture = _ref$signatureCapture === void 0 ? EMPTY_SIGNATURE_CAPTURE$2 : _ref$signatureCapture,
41643
- signatureView = _ref.signatureView,
42108
+ signatureViewProp = _ref.signatureView,
41644
42109
  captureSignature = _ref.captureSignature,
41645
42110
  captureSignatureVideo = _ref.captureSignatureVideo,
41646
42111
  allowVirtualCameras = _ref.allowVirtualCameras,
@@ -41652,8 +42117,11 @@ function VideoIdValidationFlow(_ref) {
41652
42117
  onMicrophoneAccessDenied = _ref.onMicrophoneAccessDenied,
41653
42118
  theme = _ref.theme,
41654
42119
  className = _ref.className,
41655
- _ref$showSuccessScree = _ref.showSuccessScreen,
41656
- showSuccessScreen = _ref$showSuccessScree === void 0 ? false : _ref$showSuccessScree,
42120
+ lang = _ref.lang,
42121
+ debugMode = _ref.debugMode,
42122
+ skipSuccessScreen = _ref.skipSuccessScreen,
42123
+ showResultScreen = _ref.showResultScreen,
42124
+ showSuccessScreen = _ref.showSuccessScreen,
41657
42125
  _ref$showDiagnostics = _ref.showDiagnostics,
41658
42126
  showDiagnostics = _ref$showDiagnostics === void 0 ? false : _ref$showDiagnostics,
41659
42127
  captureAdditionalDocuments = _ref.captureAdditionalDocuments,
@@ -41666,6 +42134,31 @@ function VideoIdValidationFlow(_ref) {
41666
42134
  onCaptureError = _ref.onCaptureError,
41667
42135
  children = _ref.children,
41668
42136
  callbacks = _objectWithoutPropertiesLoose(_ref, _excluded$4);
42137
+ // Flow-wide settings reach each step unless its own bag sets them.
42138
+ var _useMemo = useMemo(function () {
42139
+ var settings = {
42140
+ lang: lang,
42141
+ debugMode: debugMode,
42142
+ skipSuccessScreen: skipSuccessScreen
42143
+ };
42144
+ return {
42145
+ idView: inheritFlowSettings(idViewProp, settings),
42146
+ faceView: inheritFlowSettings(faceViewProp, settings),
42147
+ view: inheritFlowSettings(viewProp, {
42148
+ lang: lang,
42149
+ debugMode: debugMode
42150
+ }),
42151
+ signatureView: inheritFlowSettings(signatureViewProp, {
42152
+ lang: lang,
42153
+ showCaptureDiagnostics: debugMode,
42154
+ skipSuccessScreen: skipSuccessScreen
42155
+ })
42156
+ };
42157
+ }, [debugMode, faceViewProp, idViewProp, lang, signatureViewProp, skipSuccessScreen, viewProp]),
42158
+ idView = _useMemo.idView,
42159
+ faceView = _useMemo.faceView,
42160
+ view = _useMemo.view,
42161
+ signatureView = _useMemo.signatureView;
41669
42162
  var checkLivenessOptions = faceCapture.checkLivenessOptions,
41670
42163
  selfieCaptureConfig = _objectWithoutPropertiesLoose(faceCapture, _excluded2$2);
41671
42164
  useMountOnlyWarnings('VideoIdValidationFlow', FLOW_MOUNT_ONLY_REMEDY, {
@@ -41826,18 +42319,21 @@ function VideoIdValidationFlow(_ref) {
41826
42319
  successIssuerCaptionText: 'confirmed'
41827
42320
  }
41828
42321
  });
42322
+ var mode = submitMode != null ? submitMode : captureOnly ? 'capture' : undefined;
41829
42323
  return jsxs(FlowChassis, _extends({
41830
42324
  client: client,
41831
42325
  action: action,
41832
42326
  submission: submission,
42327
+ submitMode: mode,
41833
42328
  theme: theme,
41834
- className: className
42329
+ className: className,
42330
+ lang: lang
41835
42331
  }, callbacks, {
41836
42332
  children: [jsx(CompositeWizard, _extends({}, ringScreens, {
41837
42333
  steps: steps,
41838
42334
  initialArtifacts: initialArtifacts,
41839
- captureOnly: captureOnly,
41840
- showSuccessScreen: showSuccessScreen,
42335
+ captureOnly: mode === 'capture',
42336
+ showResultScreen: showResultScreen != null ? showResultScreen : showSuccessScreen,
41841
42337
  showDiagnostics: showDiagnostics,
41842
42338
  onArtifactsCollected: onCaptured,
41843
42339
  onSubmitted: onSubmitted
@@ -44680,7 +45176,7 @@ function buildDocumentCaptureStep(controller, view, sessionReady) {
44680
45176
  };
44681
45177
  }
44682
45178
 
44683
- var _excluded$3 = ["client", "controller", "capture", "view", "documents", "submission", "initialArtifacts", "theme", "className", "onDocumentCaptured", "onDocumentUploaded", "onComplete", "children"];
45179
+ var _excluded$3 = ["client", "controller", "capture", "view", "documents", "submission", "initialArtifacts", "theme", "className", "lang", "debugMode", "onDocumentCaptured", "onDocumentUploaded", "onComplete", "children"];
44684
45180
  var EMPTY_DOCUMENTS = [];
44685
45181
  var EMPTY_CAPTURE$1 = {};
44686
45182
  var EMPTY_VIEW$2 = {};
@@ -44701,6 +45197,8 @@ function DocumentCaptureFlow(_ref) {
44701
45197
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$4 : _ref$initialArtifacts,
44702
45198
  theme = _ref.theme,
44703
45199
  className = _ref.className,
45200
+ lang = _ref.lang,
45201
+ debugMode = _ref.debugMode,
44704
45202
  onDocumentCaptured = _ref.onDocumentCaptured,
44705
45203
  onDocumentUploaded = _ref.onDocumentUploaded,
44706
45204
  onComplete = _ref.onComplete,
@@ -44797,8 +45295,11 @@ function DocumentCaptureFlow(_ref) {
44797
45295
  var steps = useMemo(function () {
44798
45296
  return [buildDocumentCaptureStep(resolvedController, _extends({
44799
45297
  documents: documents
44800
- }, view))];
44801
- }, [documents, resolvedController, view]);
45298
+ }, inheritFlowSettings(view, {
45299
+ lang: lang,
45300
+ debugMode: debugMode
45301
+ })))];
45302
+ }, [debugMode, documents, lang, resolvedController, view]);
44802
45303
  var onArtifactsCollected = useCallback(function () {
44803
45304
  // captureOnly hands the (empty) artifacts back here; completion is reported
44804
45305
  // through onComplete with the documents instead.
@@ -44808,7 +45309,8 @@ function DocumentCaptureFlow(_ref) {
44808
45309
  action: SubmissionAction.NONE,
44809
45310
  submission: submission,
44810
45311
  theme: theme,
44811
- className: className
45312
+ className: className,
45313
+ lang: lang
44812
45314
  }, callbacks, {
44813
45315
  children: [jsx(CompositeWizard, {
44814
45316
  steps: steps,
@@ -44819,7 +45321,7 @@ function DocumentCaptureFlow(_ref) {
44819
45321
  }));
44820
45322
  }
44821
45323
 
44822
- var _excluded$2 = ["client", "submission", "selfieController", "signatureController", "faceCapture", "signatureCapture", "faceView", "signatureView", "captureSignature", "captureSignatureVideo", "allowVirtualCameras", "initialArtifacts", "theme", "className", "showSuccessScreen", "showDiagnostics", "captureAdditionalDocuments", "additionalDocumentClassNames", "additionalDocumentVerbiage", "ringScreenClassNames", "ringScreenVerbiage", "onSubmitted", "onCaptureError", "children"],
45324
+ var _excluded$2 = ["client", "submission", "selfieController", "signatureController", "faceCapture", "signatureCapture", "faceView", "signatureView", "captureSignature", "captureSignatureVideo", "allowVirtualCameras", "initialArtifacts", "theme", "className", "lang", "debugMode", "skipSuccessScreen", "showResultScreen", "showSuccessScreen", "showDiagnostics", "captureAdditionalDocuments", "additionalDocumentClassNames", "additionalDocumentVerbiage", "ringScreenClassNames", "ringScreenVerbiage", "onSubmitted", "onCaptureError", "children"],
44823
45325
  _excluded2$1 = ["checkLivenessOptions"];
44824
45326
  var EMPTY_FACE_CAPTURE$1 = {};
44825
45327
  var EMPTY_SIGNATURE_CAPTURE$1 = {};
@@ -44836,8 +45338,8 @@ function CustomerBiometricsEnrollmentFlow(_ref) {
44836
45338
  _ref$signatureCapture = _ref.signatureCapture,
44837
45339
  signatureCapture = _ref$signatureCapture === void 0 ? EMPTY_SIGNATURE_CAPTURE$1 : _ref$signatureCapture,
44838
45340
  _ref$faceView = _ref.faceView,
44839
- faceView = _ref$faceView === void 0 ? EMPTY_FACE_VIEW$1 : _ref$faceView,
44840
- signatureView = _ref.signatureView,
45341
+ faceViewProp = _ref$faceView === void 0 ? EMPTY_FACE_VIEW$1 : _ref$faceView,
45342
+ signatureViewProp = _ref.signatureView,
44841
45343
  captureSignature = _ref.captureSignature,
44842
45344
  captureSignatureVideo = _ref.captureSignatureVideo,
44843
45345
  allowVirtualCameras = _ref.allowVirtualCameras,
@@ -44845,8 +45347,11 @@ function CustomerBiometricsEnrollmentFlow(_ref) {
44845
45347
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$3 : _ref$initialArtifacts,
44846
45348
  theme = _ref.theme,
44847
45349
  className = _ref.className,
44848
- _ref$showSuccessScree = _ref.showSuccessScreen,
44849
- showSuccessScreen = _ref$showSuccessScree === void 0 ? false : _ref$showSuccessScree,
45350
+ lang = _ref.lang,
45351
+ debugMode = _ref.debugMode,
45352
+ skipSuccessScreen = _ref.skipSuccessScreen,
45353
+ showResultScreen = _ref.showResultScreen,
45354
+ showSuccessScreen = _ref.showSuccessScreen,
44850
45355
  _ref$showDiagnostics = _ref.showDiagnostics,
44851
45356
  showDiagnostics = _ref$showDiagnostics === void 0 ? false : _ref$showDiagnostics,
44852
45357
  captureAdditionalDocuments = _ref.captureAdditionalDocuments,
@@ -44858,6 +45363,23 @@ function CustomerBiometricsEnrollmentFlow(_ref) {
44858
45363
  onCaptureError = _ref.onCaptureError,
44859
45364
  children = _ref.children,
44860
45365
  callbacks = _objectWithoutPropertiesLoose(_ref, _excluded$2);
45366
+ // Flow-wide settings reach each step unless its own bag sets them.
45367
+ var _useMemo = useMemo(function () {
45368
+ return {
45369
+ faceView: inheritFlowSettings(faceViewProp, {
45370
+ lang: lang,
45371
+ debugMode: debugMode,
45372
+ skipSuccessScreen: skipSuccessScreen
45373
+ }),
45374
+ signatureView: inheritFlowSettings(signatureViewProp, {
45375
+ lang: lang,
45376
+ showCaptureDiagnostics: debugMode,
45377
+ skipSuccessScreen: skipSuccessScreen
45378
+ })
45379
+ };
45380
+ }, [debugMode, faceViewProp, lang, signatureViewProp, skipSuccessScreen]),
45381
+ faceView = _useMemo.faceView,
45382
+ signatureView = _useMemo.signatureView;
44861
45383
  var checkLivenessOptions = faceCapture.checkLivenessOptions,
44862
45384
  selfieCaptureConfig = _objectWithoutPropertiesLoose(faceCapture, _excluded2$1);
44863
45385
  useMountOnlyWarnings('CustomerBiometricsEnrollmentFlow', FLOW_MOUNT_ONLY_REMEDY, {
@@ -44989,19 +45511,20 @@ function CustomerBiometricsEnrollmentFlow(_ref) {
44989
45511
  submission: submission,
44990
45512
  showEnrollmentId: showDiagnostics,
44991
45513
  theme: theme,
44992
- className: className
45514
+ className: className,
45515
+ lang: lang
44993
45516
  }, callbacks, {
44994
45517
  children: [jsx(CompositeWizard, _extends({}, ringScreens, {
44995
45518
  steps: steps,
44996
45519
  initialArtifacts: initialArtifacts,
44997
- showSuccessScreen: showSuccessScreen,
45520
+ showResultScreen: showResultScreen != null ? showResultScreen : showSuccessScreen,
44998
45521
  showDiagnostics: showDiagnostics,
44999
45522
  onSubmitted: onSubmitted
45000
45523
  })), children]
45001
45524
  }));
45002
45525
  }
45003
45526
 
45004
- var _excluded$1 = ["client", "submission", "idController", "selfieController", "signatureController", "videoIdController", "idCapture", "faceCapture", "signatureCapture", "videoIdCapture", "idView", "faceView", "signatureView", "videoIdView", "captureSignature", "captureSignatureVideo", "captureVideoId", "allowVirtualCameras", "initialArtifacts", "theme", "className", "showSuccessScreen", "showDiagnostics", "captureAdditionalDocuments", "additionalDocumentClassNames", "additionalDocumentVerbiage", "ringScreenClassNames", "ringScreenVerbiage", "onSubmitted", "onCaptureError", "children"],
45527
+ var _excluded$1 = ["client", "submission", "idController", "selfieController", "signatureController", "videoIdController", "idCapture", "faceCapture", "signatureCapture", "videoIdCapture", "idView", "faceView", "signatureView", "videoIdView", "captureSignature", "captureSignatureVideo", "captureVideoId", "allowVirtualCameras", "initialArtifacts", "theme", "className", "lang", "debugMode", "skipSuccessScreen", "showResultScreen", "showSuccessScreen", "showDiagnostics", "captureAdditionalDocuments", "additionalDocumentClassNames", "additionalDocumentVerbiage", "ringScreenClassNames", "ringScreenVerbiage", "onSubmitted", "onCaptureError", "children"],
45005
45528
  _excluded2 = ["checkLivenessOptions"];
45006
45529
  var EMPTY_ID_CAPTURE = {};
45007
45530
  var EMPTY_FACE_CAPTURE = {};
@@ -45034,11 +45557,11 @@ function CustomerIdAndBiometricsEnrollmentFlow(_ref) {
45034
45557
  _ref$videoIdCapture = _ref.videoIdCapture,
45035
45558
  videoIdCapture = _ref$videoIdCapture === void 0 ? EMPTY_VIDEO_ID_CAPTURE : _ref$videoIdCapture,
45036
45559
  _ref$idView = _ref.idView,
45037
- idView = _ref$idView === void 0 ? EMPTY_ID_VIEW : _ref$idView,
45560
+ idViewProp = _ref$idView === void 0 ? EMPTY_ID_VIEW : _ref$idView,
45038
45561
  _ref$faceView = _ref.faceView,
45039
- faceView = _ref$faceView === void 0 ? EMPTY_FACE_VIEW : _ref$faceView,
45040
- signatureView = _ref.signatureView,
45041
- videoIdView = _ref.videoIdView,
45562
+ faceViewProp = _ref$faceView === void 0 ? EMPTY_FACE_VIEW : _ref$faceView,
45563
+ signatureViewProp = _ref.signatureView,
45564
+ videoIdViewProp = _ref.videoIdView,
45042
45565
  captureSignature = _ref.captureSignature,
45043
45566
  captureSignatureVideo = _ref.captureSignatureVideo,
45044
45567
  _ref$captureVideoId = _ref.captureVideoId,
@@ -45048,8 +45571,11 @@ function CustomerIdAndBiometricsEnrollmentFlow(_ref) {
45048
45571
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$2 : _ref$initialArtifacts,
45049
45572
  theme = _ref.theme,
45050
45573
  className = _ref.className,
45051
- _ref$showSuccessScree = _ref.showSuccessScreen,
45052
- showSuccessScreen = _ref$showSuccessScree === void 0 ? false : _ref$showSuccessScree,
45574
+ lang = _ref.lang,
45575
+ debugMode = _ref.debugMode,
45576
+ skipSuccessScreen = _ref.skipSuccessScreen,
45577
+ showResultScreen = _ref.showResultScreen,
45578
+ showSuccessScreen = _ref.showSuccessScreen,
45053
45579
  _ref$showDiagnostics = _ref.showDiagnostics,
45054
45580
  showDiagnostics = _ref$showDiagnostics === void 0 ? false : _ref$showDiagnostics,
45055
45581
  captureAdditionalDocuments = _ref.captureAdditionalDocuments,
@@ -45061,7 +45587,31 @@ function CustomerIdAndBiometricsEnrollmentFlow(_ref) {
45061
45587
  onCaptureError = _ref.onCaptureError,
45062
45588
  children = _ref.children,
45063
45589
  callbacks = _objectWithoutPropertiesLoose(_ref, _excluded$1);
45064
- var preparing = useTranslations(undefined, PREPARING_FALLBACKS);
45590
+ // Flow-wide settings reach each step unless its own bag sets them.
45591
+ var _useMemo = useMemo(function () {
45592
+ var settings = {
45593
+ lang: lang,
45594
+ debugMode: debugMode,
45595
+ skipSuccessScreen: skipSuccessScreen
45596
+ };
45597
+ return {
45598
+ idView: inheritFlowSettings(idViewProp, settings),
45599
+ faceView: inheritFlowSettings(faceViewProp, settings),
45600
+ signatureView: inheritFlowSettings(signatureViewProp, {
45601
+ lang: lang,
45602
+ showCaptureDiagnostics: debugMode,
45603
+ skipSuccessScreen: skipSuccessScreen
45604
+ }),
45605
+ videoIdView: inheritFlowSettings(videoIdViewProp, {
45606
+ lang: lang,
45607
+ debugMode: debugMode
45608
+ })
45609
+ };
45610
+ }, [debugMode, faceViewProp, idViewProp, lang, signatureViewProp, skipSuccessScreen, videoIdViewProp]),
45611
+ idView = _useMemo.idView,
45612
+ faceView = _useMemo.faceView,
45613
+ signatureView = _useMemo.signatureView,
45614
+ videoIdView = _useMemo.videoIdView;
45065
45615
  var checkLivenessOptions = faceCapture.checkLivenessOptions,
45066
45616
  selfieCaptureConfig = _objectWithoutPropertiesLoose(faceCapture, _excluded2);
45067
45617
  useMountOnlyWarnings('CustomerIdAndBiometricsEnrollmentFlow', FLOW_MOUNT_ONLY_REMEDY, {
@@ -45277,26 +45827,31 @@ function CustomerIdAndBiometricsEnrollmentFlow(_ref) {
45277
45827
  submission: submission,
45278
45828
  showEnrollmentId: showDiagnostics,
45279
45829
  theme: theme,
45280
- className: className
45830
+ className: className,
45831
+ lang: lang
45281
45832
  }, callbacks, {
45282
45833
  children: [steps ? jsx(CompositeWizard, _extends({}, ringScreens, {
45283
45834
  steps: steps,
45284
45835
  initialArtifacts: initialArtifacts,
45285
- showSuccessScreen: showSuccessScreen,
45836
+ showResultScreen: showResultScreen != null ? showResultScreen : showSuccessScreen,
45286
45837
  showDiagnostics: showDiagnostics,
45287
45838
  onSubmitted: onSubmitted
45288
- })) :
45289
- // `loadingStage` is what enables the customer's `loadingSpinner`:
45290
- // without it OrbStatusScreen hard-renders the orb, so this was the one
45291
- // loading surface in the SDK that ignored a supplied component
45292
- // outright — in the flow whose double-loader prompted the fix.
45293
- jsx(OrbStatusScreen, {
45294
- state: "solving",
45295
- text: preparing.preparingText,
45296
- loadingStage: "preparing"
45297
- }), children]
45839
+ })) : jsx(PreparingScreen, {}), children]
45298
45840
  }));
45299
45841
  }
45842
+ /** Translated inside the chassis, so the flow's `lang` reaches it. */
45843
+ function PreparingScreen() {
45844
+ var preparing = useTranslations(undefined, PREPARING_FALLBACKS);
45845
+ // `loadingStage` is what enables the customer's `loadingSpinner`: without it
45846
+ // OrbStatusScreen hard-renders the orb, so this was the one loading surface
45847
+ // in the SDK that ignored a supplied component outright — in the flow whose
45848
+ // double-loader prompted the fix.
45849
+ return jsx(OrbStatusScreen, {
45850
+ state: "solving",
45851
+ text: preparing.preparingText,
45852
+ loadingStage: "preparing"
45853
+ });
45854
+ }
45300
45855
 
45301
45856
  var ALLOWED_MISMATCH_RETRIES$1 = 0;
45302
45857
  var MAX_LIVENESS_ATTEMPTS$1 = 3;
@@ -45964,6 +46519,8 @@ function CustomerMatchFlow(_ref) {
45964
46519
  view = _ref$view === void 0 ? EMPTY_VIEW : _ref$view,
45965
46520
  theme = _ref.theme,
45966
46521
  className = _ref.className,
46522
+ lang = _ref.lang,
46523
+ debugMode = _ref.debugMode,
45967
46524
  geolocationEnabled = _ref.geolocationEnabled,
45968
46525
  geolocationRequired = _ref.geolocationRequired,
45969
46526
  remoteDiagnostics = _ref.remoteDiagnostics,
@@ -45986,7 +46543,9 @@ function CustomerMatchFlow(_ref) {
45986
46543
  onComplete = _ref.onComplete,
45987
46544
  onCustomerMatched = _ref.onCustomerMatched,
45988
46545
  onCustomerNotMatched = _ref.onCustomerNotMatched,
46546
+ onSubmissionFailure = _ref.onSubmissionFailure,
45989
46547
  onRequestFailure = _ref.onRequestFailure,
46548
+ submitMode = _ref.submitMode,
45990
46549
  onCaptureGuidanceTimeout = _ref.onCaptureGuidanceTimeout,
45991
46550
  onExitCapture = _ref.onExitCapture,
45992
46551
  onExitAfterFailure = _ref.onExitAfterFailure;
@@ -46026,7 +46585,10 @@ function CustomerMatchFlow(_ref) {
46026
46585
  // Only the auto-continue half applies here: the plain SelfieCaptureView has
46027
46586
  // no capture review screen to skip (that is FaceLivenessView's), and this
46028
46587
  // flow's own terminal screens are governed by `skipSuccessScreen` below.
46029
- var resolvedView = _extends({}, view, {
46588
+ var resolvedView = _extends({}, inheritFlowSettings(view, {
46589
+ lang: lang,
46590
+ debugMode: debugMode
46591
+ }), {
46030
46592
  autoContinueAfterLoading: impliedAutoContinueAfterLoading(view.autoContinueAfterLoading, introActive)
46031
46593
  });
46032
46594
  // Reset during render, not in an effect: an auto-requesting capture stage
@@ -46070,15 +46632,19 @@ function CustomerMatchFlow(_ref) {
46070
46632
  setOutcome('notMatched');
46071
46633
  onCustomerNotMatched == null || onCustomerNotMatched(response);
46072
46634
  }, [onCustomerNotMatched]);
46635
+ var reportFailure = onSubmissionFailure != null ? onSubmissionFailure : onRequestFailure;
46073
46636
  var handleLivenessCheckFailed = useCallback(function (error) {
46074
46637
  setOutcome('failed');
46075
- onRequestFailure == null || onRequestFailure(error);
46076
- }, [onRequestFailure]);
46638
+ reportFailure == null || reportFailure(error);
46639
+ }, [reportFailure]);
46077
46640
  var handleRequestError = useCallback(function (error) {
46078
46641
  errorRef.current = error;
46079
46642
  setOutcome('error');
46080
- onRequestFailure == null || onRequestFailure(error);
46081
- }, [onRequestFailure]);
46643
+ reportFailure == null || reportFailure(error);
46644
+ }, [reportFailure]);
46645
+ var handleHandedOff = useCallback(function () {
46646
+ return setOutcome('handedOff');
46647
+ }, []);
46082
46648
  var handleCaptureGuidanceTimeout = useCallback(function () {
46083
46649
  setOutcome('failed');
46084
46650
  onCaptureGuidanceTimeout == null || onCaptureGuidanceTimeout();
@@ -46119,8 +46685,10 @@ function CustomerMatchFlow(_ref) {
46119
46685
  client: client,
46120
46686
  action: action,
46121
46687
  submission: submission,
46688
+ submitMode: submitMode,
46122
46689
  theme: theme,
46123
46690
  className: className,
46691
+ lang: lang,
46124
46692
  geolocationEnabled: geolocationEnabled,
46125
46693
  geolocationRequired: geolocationRequired,
46126
46694
  remoteDiagnostics: remoteDiagnostics,
@@ -46142,6 +46710,7 @@ function CustomerMatchFlow(_ref) {
46142
46710
  onNotMatched: handleNotMatched,
46143
46711
  onLivenessCheckFailed: handleLivenessCheckFailed,
46144
46712
  onRequestError: handleRequestError,
46713
+ onSubmissionIntercepted: handleHandedOff,
46145
46714
  onCaptureGuidanceTimeout: handleCaptureGuidanceTimeout,
46146
46715
  onExitCapture: onExitCapture,
46147
46716
  finishingScreen: {
@@ -46277,6 +46846,84 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
46277
46846
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
46278
46847
  };
46279
46848
 
46849
+ function createIdAndFaceValidationJourneyEvent(event, now) {
46850
+ if (now === void 0) {
46851
+ now = function now() {
46852
+ return new Date();
46853
+ };
46854
+ }
46855
+ return _assign(_assign({}, event), {
46856
+ version: 1,
46857
+ flow: 'id-and-face-validation',
46858
+ timestamp: now().toISOString()
46859
+ });
46860
+ }
46861
+ /**
46862
+ * websdk-ui `CompositeWizardStep.id` -> journey stage.
46863
+ *
46864
+ * Four of the five stage names ARE step ids already; only the additional-
46865
+ * documents step differs, because sdk2's stage vocabulary says
46866
+ * `additional-document-capture` (singular "document") while websdk-ui's step
46867
+ * is `additional-documents`. Unknown ids return undefined so a step this
46868
+ * vocabulary has no name for is silently skipped rather than emitted with a
46869
+ * bogus stage — the same shape as sdk2's partial lookup record.
46870
+ */
46871
+ function journeyStageForStepId(stepId) {
46872
+ switch (stepId) {
46873
+ case 'id-capture':
46874
+ case 'face-liveness':
46875
+ case 'signature-capture':
46876
+ case 'video-signature-capture':
46877
+ return stepId;
46878
+ case 'additional-documents':
46879
+ return 'additional-document-capture';
46880
+ default:
46881
+ return undefined;
46882
+ }
46883
+ }
46884
+ /**
46885
+ * The document types sdk2 reports as `document.captured`. sdk2 filters the
46886
+ * wizard's `onDocumentStored` through this set (`primaryIdDocumentTypes`) so
46887
+ * that a document type outside the journey vocabulary cannot widen the event.
46888
+ * Kept as a predicate rather than a Set: the ES5 UMD bundle target makes
46889
+ * `for..of` over a Set a downlevel hazard, and a switch needs no iteration.
46890
+ */
46891
+ function isJourneyDocumentType(documentType) {
46892
+ return documentType === 'idCardFront' || documentType === 'idCardBack' || documentType === 'passport' || documentType === 'singlePage';
46893
+ }
46894
+ /**
46895
+ * The lazy `flow.started` rule, lifted out of sdk2's `emitJourneyEvent`
46896
+ * closure (IdAndFaceValidation.tsx:521-537) so it can be tested without a
46897
+ * React tree.
46898
+ *
46899
+ * sdk2 does NOT simply emit `flow.started` from a mount effect: it emits it
46900
+ * before the FIRST event of any kind, whatever that event is, and then
46901
+ * suppresses the explicit mount emit. The mount effect and the lazy guard
46902
+ * together mean `flow.started` is always the first event a customer sees,
46903
+ * even if some other event races the effect. That ordering guarantee is the
46904
+ * contract, not the effect.
46905
+ */
46906
+ function createJourneyEmitter(callback, now) {
46907
+ var flowStartedEmitted = false;
46908
+ return function emit(event) {
46909
+ if (!callback) return;
46910
+ if (!flowStartedEmitted) {
46911
+ flowStartedEmitted = true;
46912
+ emitWith(callback, {
46913
+ name: 'flow.started'
46914
+ }, now);
46915
+ }
46916
+ if (event.name !== 'flow.started') emitWith(callback, event, now);
46917
+ };
46918
+ }
46919
+ function emitWith(callback, event, now) {
46920
+ try {
46921
+ callback(createIdAndFaceValidationJourneyEvent(event, now));
46922
+ } catch (error) {
46923
+ warn$1('[IdAndFaceValidation] onJourneyEvent callback failed', error);
46924
+ }
46925
+ }
46926
+
46280
46927
  /**
46281
46928
  * sdk2 exports this as a mutable `string[]`
46282
46929
  * (contexts/AuthStateContext.tsx:25), not a readonly tuple — copied rather
@@ -46449,12 +47096,9 @@ function mapClientConfig(props) {
46449
47096
  documentServiceUrl: (_b = props.documentServiceUrl) !== null && _b !== void 0 ? _b : apiBase ? apiBase + '/files/' : override === null || override === void 0 ? void 0 : override.documentServiceUrl,
46450
47097
  onBeforeSubmit: props.onBeforeSubmit,
46451
47098
  onBeforeLivenessCheck: props.onBeforeLivenessCheck,
46452
- // Straight through to the client, which is where sdk2 put it too
46453
- // (SubmissionProvider.submit). That is what makes the SUPPRESSION uniform:
46454
- // every flow — including the two match flows, which own their own stage
46455
- // machine — submits through this one client, so none of them can post
46456
- // behind an integrator who supplied `onSubmit`.
46457
- onSubmit: props.onSubmit,
47099
+ // 2.x's `onSubmit` is not a client option here: each flow maps it to its
47100
+ // own `submitMode: { handoff }` (see ./props.ts), which follows the prop
47101
+ // live where a client option would be fixed at mount.
46458
47102
  onBeforeDocumentUpload: props.onBeforeDocumentUpload,
46459
47103
  onDocumentUploadProgress: props.onDocumentUploadProgress,
46460
47104
  onDocumentUploaded: props.onDocumentUploaded,
@@ -47464,84 +48108,6 @@ function mapFaceCapture(props, prefixed) {
47464
48108
  };
47465
48109
  }
47466
48110
 
47467
- function createIdAndFaceValidationJourneyEvent(event, now) {
47468
- if (now === void 0) {
47469
- now = function now() {
47470
- return new Date();
47471
- };
47472
- }
47473
- return _assign(_assign({}, event), {
47474
- version: 1,
47475
- flow: 'id-and-face-validation',
47476
- timestamp: now().toISOString()
47477
- });
47478
- }
47479
- /**
47480
- * websdk-ui `CompositeWizardStep.id` -> journey stage.
47481
- *
47482
- * Four of the five stage names ARE step ids already; only the additional-
47483
- * documents step differs, because sdk2's stage vocabulary says
47484
- * `additional-document-capture` (singular "document") while websdk-ui's step
47485
- * is `additional-documents`. Unknown ids return undefined so a step this
47486
- * vocabulary has no name for is silently skipped rather than emitted with a
47487
- * bogus stage — the same shape as sdk2's partial lookup record.
47488
- */
47489
- function journeyStageForStepId(stepId) {
47490
- switch (stepId) {
47491
- case 'id-capture':
47492
- case 'face-liveness':
47493
- case 'signature-capture':
47494
- case 'video-signature-capture':
47495
- return stepId;
47496
- case 'additional-documents':
47497
- return 'additional-document-capture';
47498
- default:
47499
- return undefined;
47500
- }
47501
- }
47502
- /**
47503
- * The document types sdk2 reports as `document.captured`. sdk2 filters the
47504
- * wizard's `onDocumentStored` through this set (`primaryIdDocumentTypes`) so
47505
- * that a document type outside the journey vocabulary cannot widen the event.
47506
- * Kept as a predicate rather than a Set: the ES5 UMD bundle target makes
47507
- * `for..of` over a Set a downlevel hazard, and a switch needs no iteration.
47508
- */
47509
- function isJourneyDocumentType(documentType) {
47510
- return documentType === 'idCardFront' || documentType === 'idCardBack' || documentType === 'passport' || documentType === 'singlePage';
47511
- }
47512
- /**
47513
- * The lazy `flow.started` rule, lifted out of sdk2's `emitJourneyEvent`
47514
- * closure (IdAndFaceValidation.tsx:521-537) so it can be tested without a
47515
- * React tree.
47516
- *
47517
- * sdk2 does NOT simply emit `flow.started` from a mount effect: it emits it
47518
- * before the FIRST event of any kind, whatever that event is, and then
47519
- * suppresses the explicit mount emit. The mount effect and the lazy guard
47520
- * together mean `flow.started` is always the first event a customer sees,
47521
- * even if some other event races the effect. That ordering guarantee is the
47522
- * contract, not the effect.
47523
- */
47524
- function createJourneyEmitter(callback, now) {
47525
- var flowStartedEmitted = false;
47526
- return function emit(event) {
47527
- if (!callback) return;
47528
- if (!flowStartedEmitted) {
47529
- flowStartedEmitted = true;
47530
- emitWith(callback, {
47531
- name: 'flow.started'
47532
- }, now);
47533
- }
47534
- if (event.name !== 'flow.started') emitWith(callback, event, now);
47535
- };
47536
- }
47537
- function emitWith(callback, event, now) {
47538
- try {
47539
- callback(createIdAndFaceValidationJourneyEvent(event, now));
47540
- } catch (error) {
47541
- warn$1('[IdAndFaceValidation] onJourneyEvent callback failed', error);
47542
- }
47543
- }
47544
-
47545
48111
  /**
47546
48112
  * Recursively drops keys whose value is exactly `undefined`.
47547
48113
  *
@@ -47724,6 +48290,16 @@ function mapThemeWithColors(theme, colors) {
47724
48290
  return mergeThemes(mapped, overrides);
47725
48291
  }
47726
48292
 
48293
+ /**
48294
+ * 2.x's `onSubmit` as the flow's hand-off. sdk2 read it on every submission,
48295
+ * so this maps on every render: adding or removing it takes effect from the
48296
+ * next submission. Without it the flow posts.
48297
+ */
48298
+ function mapHandoff(onSubmit) {
48299
+ return onSubmit ? {
48300
+ handoff: onSubmit
48301
+ } : undefined;
48302
+ }
47727
48303
  var EMPTY_CONTEXT = {};
47728
48304
  /** Adapts a 3.0 `(response)` callback back to 2.x's `(response, request)`. */
47729
48305
  function withSubmissionRequest(callback, ctx) {
@@ -47815,13 +48391,13 @@ function mapAdditionalDocumentVerbiage(verbiage) {
47815
48391
  }
47816
48392
  // --- 1. IdValidation ------------------------------------------------------
47817
48393
  function mapIdValidationProps(props, ctx) {
47818
- var _a;
48394
+ var _a, _b;
47819
48395
  if (ctx === void 0) {
47820
48396
  ctx = EMPTY_CONTEXT;
47821
48397
  }
47822
- var _b = mapIdCapture(props),
47823
- capture = _b.capture,
47824
- view = _b.view;
48398
+ var _c = mapIdCapture(props),
48399
+ capture = _c.capture,
48400
+ view = _c.view;
47825
48401
  return compact({
47826
48402
  capture: capture,
47827
48403
  view: view,
@@ -47847,9 +48423,8 @@ function mapIdValidationProps(props, ctx) {
47847
48423
  // `onSubmit` WINS over capture-only, matching sdk2's ordering: its
47848
48424
  // `submit()` checks `onSubmit` before the `action === NONE` branch
47849
48425
  // (SubmissionProvider.tsx:1374 vs :1237), so a capture-only flow still
47850
- // owes the callback its built request. Letting the flow run its normal
47851
- // submit path is what builds that request; the client suppresses the POST.
47852
- captureOnly: props.onSubmit ? undefined : props.captureOnly,
48426
+ // owes the callback its built request.
48427
+ submitMode: (_b = mapHandoff(props.onSubmit)) !== null && _b !== void 0 ? _b : props.captureOnly ? 'capture' : undefined,
47853
48428
  captureAdditionalDocuments: props.captureAdditionalDocuments,
47854
48429
  geolocationEnabled: props.geolocationEnabled,
47855
48430
  geolocationRequired: props.geolocationRequired,
@@ -47860,7 +48435,7 @@ function mapIdValidationProps(props, ctx) {
47860
48435
  // post-submission diagnostics page on this one flag
47861
48436
  // (CompositeWizard.tsx:381, `if (debugMode) return <SubmissionSuccess />`);
47862
48437
  // here the capture-surface overlays live on `view.debugMode` (mapIdCapture)
47863
- // while the terminal page needs `showSuccessScreen` to render at all and
48438
+ // while the terminal page needs `showResultScreen` to render at all and
47864
48439
  // `showDiagnostics` to include the request/response bodies. Mapping only
47865
48440
  // the first left `debugMode` customers on a blank screen after submitting,
47866
48441
  // because CompositeWizard falls through to `return null`.
@@ -47868,15 +48443,12 @@ function mapIdValidationProps(props, ctx) {
47868
48443
  // Both take the same flag: sdk2's page showed the response body (behind a
47869
48444
  // toggle) whenever debugMode was on, so gating diagnostics separately here
47870
48445
  // would be a NEW restriction, not parity.
47871
- showSuccessScreen: props.debugMode,
48446
+ showResultScreen: props.debugMode,
47872
48447
  showDiagnostics: props.debugMode,
47873
- // `onSubmit` is NOT mapped to a flow prop: it goes to the client config
47874
- // (see mapClientConfig), which is the layer sdk2 put it at and the only
47875
- // one that can suppress the POST for every flow at once.
47876
48448
  onComplete: withSubmissionRequest(props.onComplete, ctx),
47877
48449
  onApproved: withSubmissionRequest(props.onApproved, ctx),
47878
48450
  onDenied: withSubmissionRequest(props.onDenied, ctx),
47879
- onRequestFailure: props.onRequestFailure
48451
+ onSubmissionFailure: props.onRequestFailure
47880
48452
  });
47881
48453
  }
47882
48454
  // --- 2. FaceValidation ----------------------------------------------------
@@ -48049,7 +48621,7 @@ function mapIdAndFaceValidationProps(props, ctx) {
48049
48621
  remoteDiagnostics: props.remoteDiagnostics,
48050
48622
  loadingSpinner: props.loadingSpinner,
48051
48623
  // See mapIdValidationProps for why `debugMode` feeds both.
48052
- showSuccessScreen: props.debugMode,
48624
+ showResultScreen: props.debugMode,
48053
48625
  showDiagnostics: props.debugMode,
48054
48626
  onStepStarted: emit ? function (stepId) {
48055
48627
  var stage = journeyStageForStepId(stepId);
@@ -48068,7 +48640,8 @@ function mapIdAndFaceValidationProps(props, ctx) {
48068
48640
  onComplete: withSubmissionRequest(props.onComplete, ctx),
48069
48641
  onApproved: withSubmissionRequest(props.onApproved, ctx),
48070
48642
  onDenied: withSubmissionRequest(props.onDenied, ctx),
48071
- onRequestFailure: props.onRequestFailure,
48643
+ submitMode: mapHandoff(props.onSubmit),
48644
+ onSubmissionFailure: props.onRequestFailure,
48072
48645
  onCaptureError: props.onRequestFailure
48073
48646
  });
48074
48647
  }
@@ -48171,7 +48744,7 @@ function mapSignatureKYCProps(props, ctx) {
48171
48744
  // both the boolean and async callback forms at the flow-level seam.
48172
48745
  //
48173
48746
  // `debugMode` forces it back on, completing the fold mapIdValidationProps
48174
- // does with `showSuccessScreen`/`showDiagnostics`: the capture readout
48747
+ // does with `showResultScreen`/`showDiagnostics`: the capture readout
48175
48748
  // renders INSIDE the review, so a consumer who skips the review and turns
48176
48749
  // debugMode on would otherwise get the switch with nowhere for it to show
48177
48750
  // — silently, in the one configuration it exists for.
@@ -48223,10 +48796,11 @@ function mapSignatureKYCProps(props, ctx) {
48223
48796
  captureProgress: props.captureProgress,
48224
48797
  remoteDiagnostics: props.remoteDiagnostics,
48225
48798
  loadingSpinner: props.loadingSpinner,
48226
- // `onCaptured` is supplied by the COMPONENT, not here: this flow never
48227
- // enters `client.submit()` on its own, so the façade makes that call from
48228
- // `onCaptured` to produce the same built request 2.x hands over. See
48229
- // components/flows.tsx.
48799
+ // 2.x builds this flow's request and hands it to `onSubmit`
48800
+ // (SubmissionProvider.tsx:1374, ahead of its NONE branch). Unset, the
48801
+ // flow captures and posts nothing, as 2.x's NONE did. A failed hand-off
48802
+ // is not reported to `onRequestFailure`, which 2.x never did either.
48803
+ submitMode: mapHandoff(props.onSubmit),
48230
48804
  onCaptureError: props.onRequestFailure
48231
48805
  });
48232
48806
  }
@@ -48252,7 +48826,7 @@ function nestedLayer(nested, map) {
48252
48826
  return map(nested);
48253
48827
  }
48254
48828
  function mapVideoIdValidationProps(props, ctx) {
48255
- var _a, _b, _c;
48829
+ var _a, _b, _c, _d;
48256
48830
  if (ctx === void 0) {
48257
48831
  ctx = EMPTY_CONTEXT;
48258
48832
  }
@@ -48342,10 +48916,14 @@ function mapVideoIdValidationProps(props, ctx) {
48342
48916
  remoteDiagnostics: props.remoteDiagnostics,
48343
48917
  loadingSpinner: props.loadingSpinner,
48344
48918
  // See mapIdValidationProps for why `debugMode` feeds both.
48345
- showSuccessScreen: props.debugMode,
48919
+ showResultScreen: props.debugMode,
48346
48920
  showDiagnostics: props.debugMode,
48347
48921
  onComplete: withSubmissionRequest(props.onComplete, ctx),
48348
- onRequestFailure: props.onRequestFailure,
48922
+ // No ID captured and none supplied resolves the action to NONE, which
48923
+ // has nothing to post. 2.x answered with a synthetic success and no
48924
+ // request; capture mode is that without the fabricated response.
48925
+ submitMode: (_d = mapHandoff(props.onSubmit)) !== null && _d !== void 0 ? _d : props.skipIdCapture && !props.idCardForFaceMatch ? 'capture' : undefined,
48926
+ onSubmissionFailure: props.onRequestFailure,
48349
48927
  onCaptureError: props.onRequestFailure
48350
48928
  });
48351
48929
  }
@@ -48510,7 +49088,8 @@ function mapCustomerMatchProps(props, ctx) {
48510
49088
  onComplete: withSubmissionRequest(props.onComplete, ctx),
48511
49089
  onCustomerMatched: withSubmissionRequest(props.onCustomerMatched, ctx),
48512
49090
  onCustomerNotMatched: withSubmissionRequest(props.onCustomerNotMatched, ctx),
48513
- onRequestFailure: props.onRequestFailure,
49091
+ submitMode: mapHandoff(props.onSubmit),
49092
+ onSubmissionFailure: props.onRequestFailure,
48514
49093
  onExitCapture: props.onExitCapture,
48515
49094
  onExitAfterFailure: props.onExitAfterFailure
48516
49095
  });
@@ -48573,13 +49152,14 @@ function mapCustomerBiometricsEnrollmentProps(props, ctx) {
48573
49152
  remoteDiagnostics: props.remoteDiagnostics,
48574
49153
  loadingSpinner: props.loadingSpinner,
48575
49154
  // See mapIdValidationProps for why `debugMode` feeds both.
48576
- showSuccessScreen: props.debugMode,
49155
+ showResultScreen: props.debugMode,
48577
49156
  showDiagnostics: props.debugMode,
48578
49157
  onComplete: withSubmissionRequest(props.onComplete, ctx),
48579
49158
  // sdk2's enrollment twin of `onApproved`.
48580
49159
  onApproved: withSubmissionRequest(props.onEnrolled, ctx),
48581
49160
  onDenied: withSubmissionRequest(props.onDenied, ctx),
48582
- onRequestFailure: props.onRequestFailure,
49161
+ submitMode: mapHandoff(props.onSubmit),
49162
+ onSubmissionFailure: props.onRequestFailure,
48583
49163
  onCaptureError: props.onRequestFailure
48584
49164
  });
48585
49165
  }
@@ -48666,17 +49246,18 @@ function mapCustomerIdAndBiometricsEnrollmentProps(props, ctx) {
48666
49246
  remoteDiagnostics: props.remoteDiagnostics,
48667
49247
  loadingSpinner: props.loadingSpinner,
48668
49248
  // See mapIdValidationProps for why `debugMode` feeds both.
48669
- showSuccessScreen: props.debugMode,
49249
+ showResultScreen: props.debugMode,
48670
49250
  showDiagnostics: props.debugMode,
48671
49251
  onComplete: withSubmissionRequest(props.onComplete, ctx),
48672
49252
  onApproved: withSubmissionRequest(props.onEnrolled, ctx),
48673
49253
  onDenied: withSubmissionRequest(props.onDenied, ctx),
48674
- onRequestFailure: props.onRequestFailure,
49254
+ submitMode: mapHandoff(props.onSubmit),
49255
+ onSubmissionFailure: props.onRequestFailure,
48675
49256
  onCaptureError: props.onRequestFailure
48676
49257
  });
48677
49258
  }
48678
49259
 
48679
- var webSdkVersion = '2.6.3-changeset-release-develop-eac763c';
49260
+ var webSdkVersion = '2.6.3-changeset-release-develop-776f131';
48680
49261
 
48681
49262
  // GENERATED by scripts/styleBagTypes.mjs from
48682
49263
  // src/__fixtures__/sdk2StyleBags.json and the mapper sweep — do not
@@ -50733,23 +51314,17 @@ var STYLE_WITH_ASSETS = {
50733
51314
  var SUBMIT_CALLBACKS = {
50734
51315
  onBeforeSubmit: MAPPED,
50735
51316
  /**
50736
- * Mapped to the CLIENT's `onSubmit`, not to a flow prop — the layer sdk2 put
50737
- * it at (SubmissionProvider.submit). The client builds the request, hands it
50738
- * over, and does NOT post, so `onComplete`/`onApproved`/`onDenied` never
50739
- * fire, exactly as 2.x documents. Every flow submits through that one
50740
- * client, including the two match flows with their own stage machine, so the
50741
- * suppression is uniform.
51317
+ * Mapped to the flow's `submitMode: { handoff }`. The flow builds the
51318
+ * request, hands it over, and does NOT post, so `onComplete`/`onApproved`/
51319
+ * `onDenied` never fire, exactly as 2.x documents. Mapped on every render,
51320
+ * so adding or removing it takes effect from the next submission, as sdk2's
51321
+ * ref-held `onSubmit` did.
50742
51322
  *
50743
51323
  * What the flow SHOWS afterwards is a 3.0 call rather than a 2.x
50744
51324
  * reproduction: every family now ends quietly, because the integrator owns
50745
51325
  * the outcome once they have the request. 2.x's match flows showed a failure
50746
51326
  * screen there, but only because their `submit()` could not distinguish an
50747
51327
  * intercepted submission from a broken one.
50748
- *
50749
- * `SignatureKYC` reaches the same place by a different route: its 3.0
50750
- * counterpart never enters `client.submit()`, so the façade component makes
50751
- * that call itself from `onCaptured`. `action: NONE` is accepted there
50752
- * precisely because `onSubmit` is bound.
50753
51328
  */
50754
51329
  onSubmit: MAPPED,
50755
51330
  onComplete: MAPPED,
@@ -50847,7 +51422,7 @@ var SignatureKYC$1 = _assign(_assign(_assign(_assign(_assign(_assign(_assign(_as
50847
51422
  // `SubmissionAction.NONE` and wires `onComplete` to the provider's
50848
51423
  // `onResponseReceived` (SignatureKYC.tsx:434,449), which never fires because
50849
51424
  // nothing is ever posted. `onSubmit` is the real completion seam and IS
50850
- // mapped, to the flow's `onCaptured`.
51425
+ // mapped, to the flow's `submitMode: { handoff }`.
50851
51426
  onComplete: NOOP,
50852
51427
  onSubmit: MAPPED,
50853
51428
  onRequestFailure: MAPPED,
@@ -51338,10 +51913,6 @@ function useCompatClient(props) {
51338
51913
  _lastLivenessRequest.current = request;
51339
51914
  return propsRef.current.onBeforeLivenessCheck ? propsRef.current.onBeforeLivenessCheck(request) : Promise.resolve(request);
51340
51915
  },
51341
- onSubmit: propsRef.current.onSubmit ? function (request) {
51342
- var _a, _b;
51343
- return (_b = (_a = propsRef.current).onSubmit) === null || _b === void 0 ? void 0 : _b.call(_a, request);
51344
- } : undefined,
51345
51916
  onResponseReceived: function onResponseReceived(_response, request) {
51346
51917
  _lastSubmissionRequest.current = request;
51347
51918
  },
@@ -51512,34 +52083,12 @@ var SignatureKYC = function SignatureKYC(props) {
51512
52083
  client = _a.client,
51513
52084
  ctx = _a.ctx;
51514
52085
  useDroppedPropReport('SignatureKYC', props);
51515
- // The one flow whose 3.0 counterpart never enters `client.submit()`: it runs
51516
- // its own stage machine and reports completion through `onCaptured` instead.
51517
- // 2.x DOES submit here — its CompositeWizard calls `submit()`, which hands
51518
- // the built request to `onSubmit` before reaching the capture-only branch —
51519
- // so the façade makes that call itself to produce the same request. The
51520
- // client suppresses the POST, and `action: NONE` is accepted precisely
51521
- // because `onSubmit` is bound.
51522
- //
51523
- // Only when bound: without `onSubmit` the client rejects NONE by design, and
51524
- // this flow has nothing to submit anyway.
51525
- var onSubmit = props.onSubmit;
51526
- var submission = mapSubmission(props);
51527
- var handOff = onSubmit ? function (artifacts) {
51528
- void client.submit(artifacts, _assign(_assign({}, submission), {
51529
- action: SubmissionAction.NONE
51530
- }))["catch"](function () {
51531
- // The failure already reached `onRequestFailure` through the
51532
- // client's own hook, which is where 2.x reported it too.
51533
- });
51534
- } : undefined;
51535
52086
  // No `children`: SignatureKYCFlow omits it from its props (it runs its own
51536
52087
  // stage machine rather than CompositeWizard), so passing it would not
51537
52088
  // compile — and 2.x rendered it nowhere either.
51538
52089
  return /*#__PURE__*/React.createElement(SignatureKYCFlow, _assign({
51539
52090
  client: client
51540
- }, mapSignatureKYCProps(props, ctx), {
51541
- onCaptured: handOff
51542
- }));
52091
+ }, mapSignatureKYCProps(props, ctx)));
51543
52092
  };
51544
52093
  /**
51545
52094
  * Render a fullscreen capture component that performs ID and face validation,