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.
@@ -29,7 +29,7 @@ var ReactDOM__default = /*#__PURE__*/_interopDefaultCompat(ReactDOM);
29
29
 
30
30
  // Extracted from the barrel so modules inside this package can read the
31
31
  // version without importing index.ts (which would be circular).
32
- var webSdkUiVersion = '0.5.1';
32
+ var webSdkUiVersion = '0.6.0';
33
33
 
34
34
  function asyncGeneratorStep(n, t, e, r, o, a, c) {
35
35
  try {
@@ -495,7 +495,7 @@ function _toConsumableArray(r) {
495
495
  return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray$w(r) || _nonIterableSpread();
496
496
  }
497
497
 
498
- var webSdkCoreVersion = '0.5.1';
498
+ var webSdkCoreVersion = '0.6.0';
499
499
 
500
500
  var maxTime = 86400000;
501
501
  var maxCount = 1000000;
@@ -4869,6 +4869,21 @@ function withJobTaskMetadata(metadata, jobID, taskID) {
4869
4869
  if (taskID) merged.taskid = taskID;
4870
4870
  return merged;
4871
4871
  }
4872
+ /**
4873
+ * Runs a customer callback whose failure must not change an outcome that is
4874
+ * already settled: a throw or a rejected promise is logged, never rethrown.
4875
+ */
4876
+ function notifySafely$1(name, notify) {
4877
+ try {
4878
+ // `Promise.resolve`, not `instanceof Promise`: a promise from another
4879
+ // realm (an iframe) fails that check, and its rejection would go unhandled.
4880
+ Promise.resolve(notify())["catch"](function (e) {
4881
+ return warn$1(name + " rejected", e);
4882
+ });
4883
+ } catch (e) {
4884
+ warn$1(name + " threw", e);
4885
+ }
4886
+ }
4872
4887
  /**
4873
4888
  * How long an async `sessionId` resolver may take. It typically mints the
4874
4889
  * session through the host's own backend (an OAuth token, then
@@ -4891,6 +4906,10 @@ function resolveSessionIdWithTimeout(resolve) {
4891
4906
  return clearTimeout(timer);
4892
4907
  });
4893
4908
  }
4909
+ /**
4910
+ * Creates a client. Its type is `Required<IdmissionClient>`: unlike a
4911
+ * hand-written `IdmissionClient`, it always has `post()` and `handoff()`.
4912
+ */
4894
4913
  function createIdmissionClient(config) {
4895
4914
  var _config$fetch, _config$now;
4896
4915
  // `let`: when config.sessionId is an async resolver, the session URN (and
@@ -4941,7 +4960,10 @@ function createIdmissionClient(config) {
4941
4960
  var livenessToken;
4942
4961
  function timedFetch(_x, _x2) {
4943
4962
  return _timedFetch.apply(this, arguments);
4944
- }
4963
+ } // The attestation nonce THIS client's session was validated with. The
4964
+ // holders are module-level, so another client validating later replaces
4965
+ // them; comparing against this, not against whatever the holder says at
4966
+ // submit time, is what keeps that client's nonce off this client's request.
4945
4967
  function _timedFetch() {
4946
4968
  _timedFetch = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(url, init) {
4947
4969
  var controller, timer;
@@ -4977,10 +4999,35 @@ function createIdmissionClient(config) {
4977
4999
  }));
4978
5000
  return _timedFetch.apply(this, arguments);
4979
5001
  }
4980
- function performUpload(blob, metadata) {
4981
- return uploadDocument(blob, metadata, {
4982
- documentServiceUrl: urls.documentServiceUrl,
5002
+ var validatedSessionNonce = null;
5003
+ function currentRoute() {
5004
+ return {
4983
5005
  sessionId: store.getState().session.sessionId,
5006
+ submissionUrl: urls.submissionUrl,
5007
+ documentServiceUrl: urls.documentServiceUrl,
5008
+ sessionNonce: validatedSessionNonce
5009
+ };
5010
+ }
5011
+ // The attestation holders are module-level and follow the newest
5012
+ // ValidateSession, from any client. If they no longer hold this operation's
5013
+ // session nonce, the nonce and OS token belong to someone else: omit the
5014
+ // envelope (throwing here is
5015
+ // attachMetadataToRequest's fail-open path, which reports
5016
+ // `attestationAttached: false`) rather than attach a stranger's.
5017
+ function routeBoundCollectors(route) {
5018
+ return {
5019
+ collectAttestation: function collectAttestation(web, versions) {
5020
+ if (getLastSessionNonce() !== route.sessionNonce) {
5021
+ throw new Error('session changed during submission; attestation omitted');
5022
+ }
5023
+ return collectClientAttestation(web, versions);
5024
+ }
5025
+ };
5026
+ }
5027
+ function performUpload(blob, metadata, route) {
5028
+ return uploadDocument(blob, metadata, {
5029
+ documentServiceUrl: route.documentServiceUrl,
5030
+ sessionId: route.sessionId,
4984
5031
  Upload: config.tusUpload,
4985
5032
  delay: config.delay,
4986
5033
  calculateMd5: config.calculateMd5,
@@ -5032,7 +5079,7 @@ function createIdmissionClient(config) {
5032
5079
  }
5033
5080
  function _runSessionValidation() {
5034
5081
  _runSessionValidation = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(epoch) {
5035
- var authUrl, adoptSessionUrls, resolvedSessionId, err, valid, finalState, _err, _t, _t2;
5082
+ var authUrl, adoptSessionUrls, resolvedSessionId, err, responseNonce, valid, finalState, _err, _t, _t2;
5036
5083
  return _regeneratorRuntime.wrap(function (_context3) {
5037
5084
  while (1) switch (_context3.prev = _context3.next) {
5038
5085
  case 0:
@@ -5127,14 +5174,22 @@ function createIdmissionClient(config) {
5127
5174
  payload: 'RUNNING'
5128
5175
  });
5129
5176
  _context3.prev = 8;
5177
+ // The nonce THIS response carried, taken as it is ingested: reading
5178
+ // the shared holder after the await could pick up another client's.
5179
+ responseNonce = null;
5130
5180
  _context3.next = 9;
5131
5181
  return validateSession(authUrl, resolvedSessionId, {
5132
5182
  fetch: config.fetch,
5133
- delay: config.delay
5183
+ delay: config.delay,
5184
+ ingestNonce: function ingestNonce(nonce) {
5185
+ responseNonce = typeof nonce === 'string' && nonce ? nonce : null;
5186
+ ingestSessionAttestation(nonce);
5187
+ }
5134
5188
  });
5135
5189
  case 9:
5136
5190
  valid = _context3.sent;
5137
5191
  finalState = valid ? 'PASSED' : 'FAILED';
5192
+ if (epoch === sessionRunEpoch) validatedSessionNonce = responseNonce;
5138
5193
  dispatchSessionIfCurrent(epoch, {
5139
5194
  type: 'setCheckState',
5140
5195
  payload: finalState
@@ -5204,23 +5259,28 @@ function createIdmissionClient(config) {
5204
5259
  }));
5205
5260
  return _retrySession.apply(this, arguments);
5206
5261
  }
5207
- function submit(_x6, _x7) {
5208
- return _submit.apply(this, arguments);
5262
+ function runPipeline(_x6, _x7, _x8) {
5263
+ return _runPipeline.apply(this, arguments);
5209
5264
  }
5210
- function _submit() {
5211
- _submit = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(artifacts, options) {
5212
- var _options$onBeforeSubm;
5213
- var progress, uploadsInFlight, beforeSubmit, startedAt, payloadBuildStart, payloadBuildEnd, uploadMeasurements, apiCallStart, apiCallEnd, responseParseStart, responseParseEnd, failedAt, _artifacts$id, _artifacts$id2, _artifacts$id3, _artifacts$face, payloadResult, _artifacts$meta$liven, _artifacts$meta, request, sessionId, endpoint, submissionResponse, response, _response$statusText, statusMessage, err, endedAt, _t4, _t5, _t6, _t7, _t8, _t9, _t0;
5265
+ function _runPipeline() {
5266
+ _runPipeline = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(artifacts, options, kind) {
5267
+ var _artifacts$meta$liven, _artifacts$meta, _options$onBeforeSubm;
5268
+ var handsOff, route, claimedLivenessToken, progress, uploadsInFlight, beforeSubmit, startedAt, payloadBuildStart, payloadBuildEnd, uploadMeasurements, apiCallStart, apiCallEnd, responseParseStart, responseParseEnd, failedAt, built, timings, payloadResult, request, _artifacts$id, _artifacts$id2, _artifacts$id3, _artifacts$face, endpoint, submissionResponse, response, _response$statusText, statusMessage, err, endedAt, _built, _response, _request, _t4, _t5, _t6, _t7, _t8, _t9, _t0;
5214
5269
  return _regeneratorRuntime.wrap(function (_context7) {
5215
5270
  while (1) switch (_context7.prev = _context7.next) {
5216
5271
  case 0:
5217
- if (!(options.action === SubmissionAction.NONE && !config.onSubmit)) {
5272
+ handsOff = kind === 'handoff' || kind === 'submit' && config.onSubmit !== undefined; // sdk2 short-circuits action NONE to a synthetic success before any
5273
+ // network activity (SubmissionProvider.tsx:1203-1225). This client does
5274
+ // not fabricate that response, but it keeps the "NONE does no network
5275
+ // work" guarantee by rejecting here, before any upload — unless the
5276
+ // request is being handed off, which is the one thing NONE can do.
5277
+ if (!(options.action === SubmissionAction.NONE && !handsOff)) {
5218
5278
  _context7.next = 1;
5219
5279
  break;
5220
5280
  }
5221
5281
  throw new SubmissionError({
5222
5282
  statusCode: 'UNSUPPORTED_ACTION',
5223
- statusMessage: "submit() rejects action: 'NONE' -- capture-only, no-network submission is the controller layer's responsibility (plan 3), not this client's"
5283
+ statusMessage: "action 'NONE' has no endpoint to post to; use handoff() to build the request without posting it"
5224
5284
  });
5225
5285
  case 1:
5226
5286
  if (!(store.getState().session.sessionCheckState !== 'PASSED')) {
@@ -5229,6 +5289,11 @@ function createIdmissionClient(config) {
5229
5289
  }
5230
5290
  throw new AuthenticationError(401, 'session not validated');
5231
5291
  case 2:
5292
+ route = currentRoute(); // Claimed, not read: an overlapping operation must not reuse it, and a
5293
+ // `checkLiveness()` that lands mid-operation keeps its own token for the
5294
+ // next one (SubmissionProvider.tsx:1350 cleared it after the submit).
5295
+ claimedLivenessToken = (_artifacts$meta$liven = (_artifacts$meta = artifacts.meta) == null ? void 0 : _artifacts$meta.livenessToken) != null ? _artifacts$meta$liven : livenessToken;
5296
+ livenessToken = undefined;
5232
5297
  store.setState({
5233
5298
  submissionStatus: SubmissionStatus.SUBMITTING,
5234
5299
  submissionError: undefined
@@ -5245,7 +5310,7 @@ function createIdmissionClient(config) {
5245
5310
  _context7.next = 5;
5246
5311
  return buildSubmissionPayload(_extends({}, artifacts, {
5247
5312
  meta: _extends({}, artifacts.meta, {
5248
- livenessToken: (_artifacts$meta$liven = (_artifacts$meta = artifacts.meta) == null ? void 0 : _artifacts$meta.livenessToken) != null ? _artifacts$meta$liven : livenessToken
5313
+ livenessToken: claimedLivenessToken
5249
5314
  })
5250
5315
  }), _extends({}, options, {
5251
5316
  onBeforeSubmit: beforeSubmit ? function (request) {
@@ -5261,7 +5326,7 @@ function createIdmissionClient(config) {
5261
5326
  // withJobTaskMetadata (see its own comment above): only present
5262
5327
  // when options.jobID/taskID are present.
5263
5328
  uploadDocument: documentServiceEnabled ? (/*#__PURE__*/function () {
5264
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(blob, metadata) {
5329
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(blob, metadata) {
5265
5330
  var result, _t3;
5266
5331
  return _regeneratorRuntime.wrap(function (_context6) {
5267
5332
  while (1) switch (_context6.prev = _context6.next) {
@@ -5278,7 +5343,7 @@ function createIdmissionClient(config) {
5278
5343
  });
5279
5344
  _context6.prev = 1;
5280
5345
  _context6.next = 2;
5281
- return performUpload(blob, withJobTaskMetadata(metadata, options.jobID, options.taskID));
5346
+ return performUpload(blob, withJobTaskMetadata(metadata, options.jobID, options.taskID), route);
5282
5347
  case 2:
5283
5348
  result = _context6.sent;
5284
5349
  progress.observe({
@@ -5308,12 +5373,13 @@ function createIdmissionClient(config) {
5308
5373
  }
5309
5374
  }, _callee6, null, [[1, 3, 4, 5]]);
5310
5375
  }));
5311
- return function (_x10, _x11) {
5312
- return _ref2.apply(this, arguments);
5376
+ return function (_x13, _x14) {
5377
+ return _ref3.apply(this, arguments);
5313
5378
  };
5314
5379
  }()) : undefined,
5315
5380
  now: config.now,
5316
- sdkVersions: config.sdkVersions
5381
+ sdkVersions: config.sdkVersions,
5382
+ collectors: routeBoundCollectors(route)
5317
5383
  });
5318
5384
  case 5:
5319
5385
  payloadResult = _context7.sent;
@@ -5327,40 +5393,41 @@ function createIdmissionClient(config) {
5327
5393
  case 7:
5328
5394
  payloadBuildEnd = payloadResult.uploadTimings.payloadBuildEnd;
5329
5395
  uploadMeasurements = payloadResult.uploadTimings.uploads;
5330
- request = payloadResult.request; // Stashed HERE rather than next to `lastSubmissionTimings` in the
5331
- // `finally`, because the hand-off below returns early: parking it in
5332
- // the same setState as the timings would leave `onSubmit` customers
5333
- // with a timings block and no request to go with it.
5396
+ request = payloadResult.request; // Stashed before the hand-off returns, so hand-off callers get the
5397
+ // request alongside the timings the `finally` records.
5334
5398
  store.setState({
5335
5399
  attestationAttached: payloadResult.attestationAttached,
5336
5400
  lastSubmissionRequest: request
5337
5401
  });
5338
- // THE HAND-OFF. sdk2 short-circuits at the equivalent point
5339
- // (SubmissionProvider.tsx:1374-1377, `return onSubmit.current(request)`
5340
- // before `defaultOnSubmit`), so everything above this line runs and
5341
- // nothing below it does.
5342
- //
5343
- // The status goes to SUBMITTED, where sdk2 leaves it at READY. That is a
5344
- // deliberate divergence in INTERNAL state to preserve the VISIBLE
5345
- // behaviour: sdk2's wizard renders an empty fragment for READY via its
5346
- // switch `default`, whereas this codebase renders the submitting screen
5347
- // for READY — so inheriting READY would park the user on a spinner
5348
- // forever. SUBMITTED with no response falls through every terminal
5349
- // branch to `return null`, which is sdk2's empty fragment.
5350
- if (!config.onSubmit) {
5402
+ if (!handsOff) {
5351
5403
  _context7.next = 8;
5352
5404
  break;
5353
5405
  }
5406
+ // sdk2 short-circuits at the equivalent point
5407
+ // (SubmissionProvider.tsx:1374-1377), so everything above runs and
5408
+ // nothing below does.
5409
+ //
5410
+ // The status goes to SUBMITTED, where sdk2 leaves it at READY. That is
5411
+ // a deliberate divergence in INTERNAL state to preserve the VISIBLE
5412
+ // behaviour: sdk2's wizard renders an empty fragment for READY via its
5413
+ // switch `default`, whereas this codebase renders the submitting
5414
+ // screen for READY — so inheriting READY would park the user on a
5415
+ // spinner forever. SUBMITTED with no response falls through every
5416
+ // terminal branch to `return null`, which is sdk2's empty fragment.
5354
5417
  store.setState({
5355
5418
  submissionStatus: SubmissionStatus.SUBMITTED
5356
5419
  });
5357
- config.onSubmit(request);
5420
+ if (kind === 'submit') config.onSubmit == null || config.onSubmit(request);
5358
5421
  progress.observe({
5359
5422
  kind: 'flow-completed'
5360
5423
  });
5361
- return _context7.abrupt("return", null);
5424
+ built = {
5425
+ request: request,
5426
+ response: null
5427
+ };
5428
+ _context7.next = 23;
5429
+ break;
5362
5430
  case 8:
5363
- sessionId = store.getState().session.sessionId;
5364
5431
  endpoint = determineSubmissionEndpoint(options.action, !!((_artifacts$id = artifacts.id) != null && _artifacts$id.frontImage || (_artifacts$id2 = artifacts.id) != null && _artifacts$id2.backImage || (_artifacts$id3 = artifacts.id) != null && _artifacts$id3.passportImage), !!((_artifacts$face = artifacts.face) != null && _artifacts$face.selfieImage));
5365
5432
  progress.observe({
5366
5433
  kind: 'phase',
@@ -5375,9 +5442,9 @@ function createIdmissionClient(config) {
5375
5442
  _context7.prev = 9;
5376
5443
  _context7.prev = 10;
5377
5444
  _context7.next = 11;
5378
- return timedFetch(urls.submissionUrl + endpoint, {
5445
+ return timedFetch(route.submissionUrl + endpoint, {
5379
5446
  method: 'POST',
5380
- headers: apiHeaders(sessionId, options.sendBase64DocumentsInSwaggerProxy),
5447
+ headers: apiHeaders(route.sessionId, options.sendBase64DocumentsInSwaggerProxy),
5381
5448
  body: JSON.stringify(request)
5382
5449
  });
5383
5450
  case 11:
@@ -5467,10 +5534,21 @@ function createIdmissionClient(config) {
5467
5534
  progress.observe({
5468
5535
  kind: 'flow-completed'
5469
5536
  });
5470
- config.onResponseReceived == null || config.onResponseReceived(submissionResponse, request);
5471
- return _context7.abrupt("return", submissionResponse);
5537
+ // Legacy `submit()` keeps a throwing `onResponseReceived` inside the
5538
+ // failure path, as it always has; `post()` notifies after the outcome
5539
+ // is settled (below).
5540
+ if (kind === 'submit') {
5541
+ config.onResponseReceived == null || config.onResponseReceived(submissionResponse, request);
5542
+ }
5543
+ built = {
5544
+ request: request,
5545
+ response: submissionResponse
5546
+ };
5472
5547
  case 23:
5473
- _context7.prev = 23;
5548
+ _context7.next = 25;
5549
+ break;
5550
+ case 24:
5551
+ _context7.prev = 24;
5474
5552
  _t0 = _context7["catch"](3);
5475
5553
  if (failedAt === undefined) failedAt = 'submission';
5476
5554
  err = _t0;
@@ -5482,72 +5560,116 @@ function createIdmissionClient(config) {
5482
5560
  // UNLIKE sdk2 (`if (throwErrorsOnFailure) throw err`) there is no
5483
5561
  // catch-swallow path: rejection always propagates.
5484
5562
  throw err;
5485
- case 24:
5486
- _context7.prev = 24;
5487
- // Liveness tokens are single-use: clear after each submit so a stale
5488
- // token isn't reapplied on a retry (SubmissionProvider.tsx:1350).
5489
- livenessToken = undefined;
5563
+ case 25:
5564
+ _context7.prev = 25;
5490
5565
  endedAt = nowImpl();
5566
+ timings = buildSubmissionTimings({
5567
+ startedAt: startedAt,
5568
+ endedAt: endedAt,
5569
+ payloadBuildStart: payloadBuildStart,
5570
+ payloadBuildEnd: payloadBuildEnd,
5571
+ uploads: uploadMeasurements,
5572
+ apiCallStart: apiCallStart,
5573
+ apiCallEnd: apiCallEnd,
5574
+ responseParseStart: responseParseStart,
5575
+ responseParseEnd: responseParseEnd,
5576
+ failedAt: failedAt
5577
+ });
5491
5578
  store.setState({
5492
- lastSubmissionTimings: buildSubmissionTimings({
5493
- startedAt: startedAt,
5494
- endedAt: endedAt,
5495
- payloadBuildStart: payloadBuildStart,
5496
- payloadBuildEnd: payloadBuildEnd,
5497
- uploads: uploadMeasurements,
5498
- apiCallStart: apiCallStart,
5499
- apiCallEnd: apiCallEnd,
5500
- responseParseStart: responseParseStart,
5501
- responseParseEnd: responseParseEnd,
5502
- failedAt: failedAt
5503
- })
5579
+ lastSubmissionTimings: timings
5504
5580
  });
5505
- return _context7.finish(24);
5506
- case 25:
5581
+ return _context7.finish(25);
5582
+ case 26:
5583
+ if (kind === 'post' && built.response) {
5584
+ _built = built, _response = _built.response, _request = _built.request;
5585
+ notifySafely$1('onResponseReceived', function () {
5586
+ return config.onResponseReceived == null ? void 0 : config.onResponseReceived(_response, _request);
5587
+ });
5588
+ }
5589
+ return _context7.abrupt("return", _extends({}, built, {
5590
+ timings: timings
5591
+ }));
5592
+ case 27:
5507
5593
  case "end":
5508
5594
  return _context7.stop();
5509
5595
  }
5510
- }, _callee7, null, [[3, 23, 24, 25], [4, 6], [9, 20], [10, 12]]);
5596
+ }, _callee7, null, [[3, 24, 25, 26], [4, 6], [9, 20], [10, 12]]);
5597
+ }));
5598
+ return _runPipeline.apply(this, arguments);
5599
+ }
5600
+ function submit(artifacts, options) {
5601
+ return runPipeline(artifacts, options, 'submit').then(function (_ref2) {
5602
+ var response = _ref2.response;
5603
+ return response;
5604
+ });
5605
+ }
5606
+ function post(artifacts, options) {
5607
+ return runPipeline(artifacts, options, 'post');
5608
+ }
5609
+ function handoff(_x9, _x0) {
5610
+ return _handoff.apply(this, arguments);
5611
+ }
5612
+ function _handoff() {
5613
+ _handoff = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(artifacts, options) {
5614
+ var _yield$runPipeline, request, timings;
5615
+ return _regeneratorRuntime.wrap(function (_context8) {
5616
+ while (1) switch (_context8.prev = _context8.next) {
5617
+ case 0:
5618
+ _context8.next = 1;
5619
+ return runPipeline(artifacts, options, 'handoff');
5620
+ case 1:
5621
+ _yield$runPipeline = _context8.sent;
5622
+ request = _yield$runPipeline.request;
5623
+ timings = _yield$runPipeline.timings;
5624
+ return _context8.abrupt("return", {
5625
+ request: request,
5626
+ timings: timings
5627
+ });
5628
+ case 2:
5629
+ case "end":
5630
+ return _context8.stop();
5631
+ }
5632
+ }, _callee8);
5511
5633
  }));
5512
- return _submit.apply(this, arguments);
5634
+ return _handoff.apply(this, arguments);
5513
5635
  }
5514
- function checkLiveness(_x8, _x9) {
5636
+ function checkLiveness(_x1, _x10) {
5515
5637
  return _checkLiveness.apply(this, arguments);
5516
5638
  }
5517
5639
  function _checkLiveness() {
5518
- _checkLiveness = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(imageDataUrl, options) {
5640
+ _checkLiveness = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(imageDataUrl, options) {
5519
5641
  var _options$metadata$sel, _options$metadata, _options$metadata$idF, _options$metadata2, _options$metadata$idB, _options$metadata3, _options$metadata$bar, _options$metadata4, _options$metadata5, _options$metadata$geo, _options$metadata6, _livenessResponse$res, _livenessResponse$res2, selfie, request, _attachMetadataToRequ, attestationAttached, result, endpoint, sessionId, response, statusMessage, livenessResponse, _livenessResponse$res3, _livenessResponse$res4, err, _t1, _t10, _t11, _t12, _t13, _t14;
5520
- return _regeneratorRuntime.wrap(function (_context8) {
5521
- while (1) switch (_context8.prev = _context8.next) {
5642
+ return _regeneratorRuntime.wrap(function (_context9) {
5643
+ while (1) switch (_context9.prev = _context9.next) {
5522
5644
  case 0:
5523
5645
  if (options === void 0) {
5524
5646
  options = {};
5525
5647
  }
5526
- _context8.prev = 1;
5648
+ _context9.prev = 1;
5527
5649
  selfie = imageDataUrl;
5528
5650
  if (!(options.useDocumentServiceForLivenessChecks && documentServiceEnabled)) {
5529
- _context8.next = 6;
5651
+ _context9.next = 6;
5530
5652
  break;
5531
5653
  }
5532
5654
  if (!selfie.startsWith('data:')) {
5533
5655
  selfie = "data:image/jpeg;base64," + selfie;
5534
5656
  }
5535
- _context8.prev = 2;
5536
- _context8.next = 3;
5657
+ _context9.prev = 2;
5658
+ _context9.next = 3;
5537
5659
  return performUpload(dataUrlToBlob(selfie), withJobTaskMetadata({
5538
5660
  filename: 'liveness',
5539
5661
  filetype: 'image/jpeg'
5540
- }, options.jobID, options.taskID));
5662
+ }, options.jobID, options.taskID), currentRoute());
5541
5663
  case 3:
5542
- selfie = _context8.sent;
5543
- _context8.next = 5;
5664
+ selfie = _context9.sent;
5665
+ _context9.next = 5;
5544
5666
  break;
5545
5667
  case 4:
5546
- _context8.prev = 4;
5547
- _t1 = _context8["catch"](2);
5668
+ _context9.prev = 4;
5669
+ _t1 = _context9["catch"](2);
5548
5670
  throw new NetworkError(_t1 instanceof Error ? _t1.message : String(_t1));
5549
5671
  case 5:
5550
- _context8.next = 7;
5672
+ _context9.next = 7;
5551
5673
  break;
5552
5674
  case 6:
5553
5675
  selfie = dataUrlToBase64Sync$1(selfie);
@@ -5615,19 +5737,19 @@ function createIdmissionClient(config) {
5615
5737
  attestationAttached: attestationAttached
5616
5738
  });
5617
5739
  if (!config.onBeforeLivenessCheck) {
5618
- _context8.next = 9;
5740
+ _context9.next = 9;
5619
5741
  break;
5620
5742
  }
5621
- _context8.next = 8;
5743
+ _context9.next = 8;
5622
5744
  return config.onBeforeLivenessCheck(request);
5623
5745
  case 8:
5624
- result = _context8.sent;
5746
+ result = _context9.sent;
5625
5747
  if (result) request = result;
5626
5748
  case 9:
5627
5749
  endpoint = liveCheckEndpoint(!!options.idCardForFaceMatch);
5628
5750
  sessionId = store.getState().session.sessionId;
5629
- _context8.prev = 10;
5630
- _context8.next = 11;
5751
+ _context9.prev = 10;
5752
+ _context9.next = 11;
5631
5753
  return timedFetch(urls.submissionUrl + endpoint, {
5632
5754
  method: 'POST',
5633
5755
  // SubmissionProvider.tsx:1447 — sourced from the same
@@ -5638,36 +5760,36 @@ function createIdmissionClient(config) {
5638
5760
  body: JSON.stringify(request)
5639
5761
  });
5640
5762
  case 11:
5641
- response = _context8.sent;
5642
- _context8.next = 13;
5763
+ response = _context9.sent;
5764
+ _context9.next = 13;
5643
5765
  break;
5644
5766
  case 12:
5645
- _context8.prev = 12;
5646
- _t10 = _context8["catch"](10);
5767
+ _context9.prev = 12;
5768
+ _t10 = _context9["catch"](10);
5647
5769
  throw new NetworkError(_t10 instanceof Error ? _t10.message : String(_t10));
5648
5770
  case 13:
5649
5771
  if (response.ok) {
5650
- _context8.next = 18;
5772
+ _context9.next = 18;
5651
5773
  break;
5652
5774
  }
5653
5775
  if (!(response.status === 401 || response.status === 403)) {
5654
- _context8.next = 15;
5776
+ _context9.next = 15;
5655
5777
  break;
5656
5778
  }
5657
5779
  _t11 = AuthenticationError;
5658
5780
  _t12 = response.status;
5659
- _context8.next = 14;
5781
+ _context9.next = 14;
5660
5782
  return response.text();
5661
5783
  case 14:
5662
- _t13 = _context8.sent;
5784
+ _t13 = _context9.sent;
5663
5785
  throw new _t11(_t12, _t13);
5664
5786
  case 15:
5665
- _context8.next = 16;
5787
+ _context9.next = 16;
5666
5788
  return response.text();
5667
5789
  case 16:
5668
- statusMessage = _context8.sent;
5790
+ statusMessage = _context9.sent;
5669
5791
  if (!(!statusMessage || statusMessage === 'Load failed')) {
5670
- _context8.next = 17;
5792
+ _context9.next = 17;
5671
5793
  break;
5672
5794
  }
5673
5795
  throw new NetworkError(statusMessage);
@@ -5677,12 +5799,12 @@ function createIdmissionClient(config) {
5677
5799
  statusMessage: statusMessage
5678
5800
  });
5679
5801
  case 18:
5680
- _context8.next = 19;
5802
+ _context9.next = 19;
5681
5803
  return response.json();
5682
5804
  case 19:
5683
- livenessResponse = _context8.sent;
5805
+ livenessResponse = _context9.sent;
5684
5806
  if (!(livenessResponse.status.statusCode !== '000')) {
5685
- _context8.next = 20;
5807
+ _context9.next = 20;
5686
5808
  break;
5687
5809
  }
5688
5810
  throw new SubmissionError(livenessResponse.status);
@@ -5695,7 +5817,7 @@ function createIdmissionClient(config) {
5695
5817
  // unconditional here — a deliberate scope narrowing, not a silent drop.
5696
5818
  livenessToken = (_livenessResponse$res = livenessResponse.resultData) == null ? void 0 : _livenessResponse$res.livenessToken;
5697
5819
  if (!(options.softFail && !isLiveFaceConfirmed((_livenessResponse$res2 = livenessResponse.resultData) == null ? void 0 : _livenessResponse$res2.verificationResult))) {
5698
- _context8.next = 21;
5820
+ _context9.next = 21;
5699
5821
  break;
5700
5822
  }
5701
5823
  // Current sdk2 (SubmissionProvider.tsx checkLiveness): softFail also
@@ -5704,21 +5826,21 @@ function createIdmissionClient(config) {
5704
5826
  // non-live capture) and hand back a typed failure that still carries
5705
5827
  // the response so callers can read the detection flags.
5706
5828
  livenessToken = undefined;
5707
- return _context8.abrupt("return", {
5829
+ return _context9.abrupt("return", {
5708
5830
  ok: false,
5709
5831
  error: new Error("Liveness not confirmed: " + ((_livenessResponse$res3 = (_livenessResponse$res4 = livenessResponse.resultData) == null ? void 0 : _livenessResponse$res4.verificationResult) != null ? _livenessResponse$res3 : 'no verificationResult')),
5710
5832
  response: livenessResponse
5711
5833
  });
5712
5834
  case 21:
5713
- return _context8.abrupt("return", {
5835
+ return _context9.abrupt("return", {
5714
5836
  ok: true,
5715
5837
  response: livenessResponse
5716
5838
  });
5717
5839
  case 22:
5718
- _context8.prev = 22;
5719
- _t14 = _context8["catch"](1);
5840
+ _context9.prev = 22;
5841
+ _t14 = _context9["catch"](1);
5720
5842
  if (!options.softFail) {
5721
- _context8.next = 23;
5843
+ _context9.next = 23;
5722
5844
  break;
5723
5845
  }
5724
5846
  // Caller is treating this as a best-effort check. Don't surface the
@@ -5726,7 +5848,7 @@ function createIdmissionClient(config) {
5726
5848
  // typed failure result instead of sdk2's silent `undefined` (deliberate
5727
5849
  // divergence #3).
5728
5850
  livenessToken = undefined;
5729
- return _context8.abrupt("return", {
5851
+ return _context9.abrupt("return", {
5730
5852
  ok: false,
5731
5853
  error: _t14
5732
5854
  });
@@ -5740,32 +5862,32 @@ function createIdmissionClient(config) {
5740
5862
  throw err;
5741
5863
  case 24:
5742
5864
  case "end":
5743
- return _context8.stop();
5865
+ return _context9.stop();
5744
5866
  }
5745
- }, _callee8, null, [[1, 22], [2, 4], [10, 12]]);
5867
+ }, _callee9, null, [[1, 22], [2, 4], [10, 12]]);
5746
5868
  }));
5747
5869
  return _checkLiveness.apply(this, arguments);
5748
5870
  }
5749
- function clientUploadDocument(_x0, _x1) {
5871
+ function clientUploadDocument(_x11, _x12) {
5750
5872
  return _clientUploadDocument.apply(this, arguments);
5751
5873
  }
5752
5874
  function _clientUploadDocument() {
5753
- _clientUploadDocument = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(blob, metadata) {
5754
- return _regeneratorRuntime.wrap(function (_context9) {
5755
- while (1) switch (_context9.prev = _context9.next) {
5875
+ _clientUploadDocument = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(blob, metadata) {
5876
+ return _regeneratorRuntime.wrap(function (_context0) {
5877
+ while (1) switch (_context0.prev = _context0.next) {
5756
5878
  case 0:
5757
5879
  if (documentServiceEnabled) {
5758
- _context9.next = 1;
5880
+ _context0.next = 1;
5759
5881
  break;
5760
5882
  }
5761
5883
  throw new Error('document upload is disabled: no documentServiceUrl configured');
5762
5884
  case 1:
5763
- return _context9.abrupt("return", performUpload(blob, metadata != null ? metadata : {}));
5885
+ return _context0.abrupt("return", performUpload(blob, metadata != null ? metadata : {}, currentRoute()));
5764
5886
  case 2:
5765
5887
  case "end":
5766
- return _context9.stop();
5888
+ return _context0.stop();
5767
5889
  }
5768
- }, _callee9);
5890
+ }, _callee0);
5769
5891
  }));
5770
5892
  return _clientUploadDocument.apply(this, arguments);
5771
5893
  }
@@ -5781,6 +5903,8 @@ function createIdmissionClient(config) {
5781
5903
  validateSession: validateSessionMethod,
5782
5904
  retrySession: retrySession,
5783
5905
  submit: submit,
5906
+ post: post,
5907
+ handoff: handoff,
5784
5908
  checkLiveness: checkLiveness,
5785
5909
  uploadDocument: clientUploadDocument
5786
5910
  };
@@ -7573,12 +7697,17 @@ var SdkLanguageContext = /*#__PURE__*/React.createContext(undefined);
7573
7697
  * Binds one rendered SDK tree to its requested language. A fixed translator
7574
7698
  * avoids waiting for a post-render changeLanguage() effect and keeps SSR and
7575
7699
  * concurrently mounted SDK views independent of the shared detector instance.
7700
+ *
7701
+ * An unset `lang` keeps whatever scope encloses it (or none), so a caller can
7702
+ * render the provider unconditionally: toggling `lang` between unset and set
7703
+ * then never changes the element tree, and never remounts the subtree.
7576
7704
  */
7577
7705
  function SdkLanguageProvider(_ref) {
7578
7706
  var children = _ref.children,
7579
7707
  lang = _ref.lang;
7708
+ var inherited = React.useContext(SdkLanguageContext);
7580
7709
  return /*#__PURE__*/React.createElement(SdkLanguageContext.Provider, {
7581
- value: lang === 'auto' ? detectedLanguage : lang
7710
+ value: lang === undefined ? inherited : lang === 'auto' ? detectedLanguage : lang
7582
7711
  }, children);
7583
7712
  }
7584
7713
  /**
@@ -38400,7 +38529,9 @@ function SubmissionProvider(_ref) {
38400
38529
  onComplete = _ref.onComplete,
38401
38530
  onApproved = _ref.onApproved,
38402
38531
  onDenied = _ref.onDenied,
38403
- onRequestFailure = _ref.onRequestFailure;
38532
+ onSubmissionFailure = _ref.onSubmissionFailure,
38533
+ onRequestFailure = _ref.onRequestFailure,
38534
+ mode = _ref.mode;
38404
38535
  var progress = useCaptureObserver();
38405
38536
  var clientState = shim.useSyncExternalStore(client.subscribe, client.getState, client.getState);
38406
38537
  var _useAuthState = useAuthState(),
@@ -38413,10 +38544,22 @@ function SubmissionProvider(_ref) {
38413
38544
  _useState4 = _slicedToArray(_useState3, 2),
38414
38545
  localError = _useState4[0],
38415
38546
  setLocalError = _useState4[1];
38416
- var _useState5 = React.useState(false),
38547
+ var _useState5 = React.useState(IDLE_ATTEMPT),
38417
38548
  _useState6 = _slicedToArray(_useState5, 2),
38418
- resubmitting = _useState6[0],
38419
- setResubmitting = _useState6[1];
38549
+ attempt = _useState6[0],
38550
+ setAttempt = _useState6[1];
38551
+ // Which path the latest submission took. State is read from that path even
38552
+ // if `mode` changes while it is in flight; before any submission, `mode`
38553
+ // decides.
38554
+ var _useState7 = React.useState(null),
38555
+ _useState8 = _slicedToArray(_useState7, 2),
38556
+ startedExplicit = _useState8[0],
38557
+ setStartedExplicit = _useState8[1];
38558
+ var reportFailure = onSubmissionFailure != null ? onSubmissionFailure : onRequestFailure;
38559
+ var _useState9 = React.useState(false),
38560
+ _useState0 = _slicedToArray(_useState9, 2),
38561
+ resubmitting = _useState0[0],
38562
+ setResubmitting = _useState0[1];
38420
38563
  var lastArtifactsRef = React.useRef(null);
38421
38564
  var submitInFlightRef = React.useRef(null);
38422
38565
  var resubmitInFlightRef = React.useRef(null);
@@ -38434,6 +38577,71 @@ function SubmissionProvider(_ref) {
38434
38577
  }) : incoming;
38435
38578
  // Store the merged artifacts so a resubmit carries location too.
38436
38579
  lastArtifactsRef.current = artifacts;
38580
+ setStartedExplicit(mode !== undefined);
38581
+ if (mode !== undefined) {
38582
+ // Registered before anything customer-supplied runs, so a throw from
38583
+ // a notification can never leave the flow without a status.
38584
+ setAttempt(_extends({}, IDLE_ATTEMPT, {
38585
+ status: SubmissionStatus.SUBMITTING
38586
+ }));
38587
+ var _unbindProgress = bindSubmissionObserver(artifacts, progress);
38588
+ // The client call waits one microtask so the in-flight promise is
38589
+ // registered first: an `onSubmissionStarted` that calls `submit()`
38590
+ // gets this attempt back instead of starting a second one.
38591
+ var _promise = Promise.resolve().then(function () {
38592
+ return runAttempt(client, mode, artifacts, _extends({}, options, {
38593
+ action: action
38594
+ }));
38595
+ }).then(function (outcome) {
38596
+ setAttempt(_extends({}, outcome, {
38597
+ status: SubmissionStatus.SUBMITTED,
38598
+ error: null
38599
+ }));
38600
+ var response = outcome.response,
38601
+ request = outcome.request;
38602
+ if (response === null) {
38603
+ // Terminal once called; the handler is never awaited.
38604
+ if (typeof mode === 'object') {
38605
+ notifySafely('submitMode.handoff', function () {
38606
+ return mode.handoff(request);
38607
+ });
38608
+ }
38609
+ return null;
38610
+ }
38611
+ notifySafely('onComplete', function () {
38612
+ return onComplete == null ? void 0 : onComplete(response);
38613
+ });
38614
+ if (isApprovedResponse(action, response)) {
38615
+ notifySafely('onApproved', function () {
38616
+ return onApproved == null ? void 0 : onApproved(response);
38617
+ });
38618
+ } else {
38619
+ notifySafely('onDenied', function () {
38620
+ return onDenied == null ? void 0 : onDenied(response);
38621
+ });
38622
+ }
38623
+ return response;
38624
+ }, function (cause) {
38625
+ var error = cause instanceof Error ? cause : new Error(String(cause));
38626
+ setAttempt(_extends({}, IDLE_ATTEMPT, {
38627
+ status: SubmissionStatus.FAILED,
38628
+ error: error
38629
+ }));
38630
+ notifySafely('onSubmissionFailure', function () {
38631
+ return reportFailure == null ? void 0 : reportFailure(error);
38632
+ });
38633
+ throw error;
38634
+ })["finally"](function () {
38635
+ _unbindProgress();
38636
+ submitInFlightRef.current = null;
38637
+ setResubmitting(false);
38638
+ });
38639
+ submitInFlightRef.current = _promise;
38640
+ notifySafely('onSubmissionStarted', function () {
38641
+ return onSubmissionStarted == null ? void 0 : onSubmissionStarted(artifacts);
38642
+ });
38643
+ return _promise;
38644
+ }
38437
38645
  setSubmissionResponse(null);
38438
38646
  setLocalError(null);
38439
38647
  onSubmissionStarted == null || onSubmissionStarted(artifacts);
@@ -38454,7 +38662,7 @@ function SubmissionProvider(_ref) {
38454
38662
  })["catch"](function (cause) {
38455
38663
  var error = cause instanceof Error ? cause : new Error(String(cause));
38456
38664
  setLocalError(error);
38457
- onRequestFailure == null || onRequestFailure(error);
38665
+ reportFailure == null || reportFailure(error);
38458
38666
  throw error;
38459
38667
  })["finally"](function () {
38460
38668
  unbindProgress();
@@ -38463,7 +38671,7 @@ function SubmissionProvider(_ref) {
38463
38671
  });
38464
38672
  submitInFlightRef.current = promise;
38465
38673
  return promise;
38466
- }, [action, client, geolocation, onApproved, onComplete, onDenied, onRequestFailure, onSubmissionStarted, options, progress]);
38674
+ }, [action, client, geolocation, onApproved, onComplete, onDenied, reportFailure, onSubmissionStarted, options, progress, mode]);
38467
38675
  var resubmit = React.useMemo(function () {
38468
38676
  if (!authState.session.canRefreshSession) return null;
38469
38677
  return function () {
@@ -38508,22 +38716,120 @@ function SubmissionProvider(_ref) {
38508
38716
  }, [authState.session.canRefreshSession, client, submit]);
38509
38717
  var value = React.useMemo(function () {
38510
38718
  var _ref3, _clientState$lastSubm, _clientState$lastSubm2;
38719
+ if (startedExplicit != null ? startedExplicit : mode !== undefined) {
38720
+ return {
38721
+ action: action,
38722
+ submit: submit,
38723
+ submissionStatus: resubmitting ? SubmissionStatus.SUBMITTING : attempt.status,
38724
+ submissionResponse: attempt.response,
38725
+ submissionError: attempt.error,
38726
+ lastSubmissionTimings: attempt.timings,
38727
+ lastSubmissionRequest: attempt.request,
38728
+ resubmit: resubmit
38729
+ };
38730
+ }
38511
38731
  return {
38512
38732
  action: action,
38513
38733
  submit: submit,
38514
- submissionStatus: resubmitting ? SubmissionStatus.SUBMITTING : clientState.submissionStatus,
38734
+ // A rejection before the client records anything (an unsupported
38735
+ // action, an unvalidated session) leaves the client at READY, which the
38736
+ // wizard renders as its submitting screen; the local error is the
38737
+ // failure it would otherwise never show.
38738
+ submissionStatus: resubmitting ? SubmissionStatus.SUBMITTING : localError && clientState.submissionStatus === SubmissionStatus.READY ? SubmissionStatus.FAILED : clientState.submissionStatus,
38515
38739
  submissionResponse: submissionResponse,
38516
38740
  submissionError: (_ref3 = localError != null ? localError : clientState.submissionError) != null ? _ref3 : null,
38517
38741
  lastSubmissionTimings: (_clientState$lastSubm = clientState.lastSubmissionTimings) != null ? _clientState$lastSubm : null,
38518
38742
  lastSubmissionRequest: (_clientState$lastSubm2 = clientState.lastSubmissionRequest) != null ? _clientState$lastSubm2 : null,
38519
38743
  resubmit: resubmit
38520
38744
  };
38521
- }, [action, clientState.lastSubmissionRequest, clientState.lastSubmissionTimings, clientState.submissionError, clientState.submissionStatus, localError, resubmit, resubmitting, submissionResponse, submit]);
38745
+ }, [action, attempt, clientState.lastSubmissionRequest, clientState.lastSubmissionTimings, clientState.submissionError, clientState.submissionStatus, localError, mode, resubmit, resubmitting, startedExplicit, submissionResponse, submit]);
38522
38746
  return jsxRuntime.jsx(SubmissionContext.Provider, {
38523
38747
  value: value,
38524
38748
  children: children
38525
38749
  });
38526
38750
  }
38751
+ var IDLE_ATTEMPT = {
38752
+ status: SubmissionStatus.READY,
38753
+ response: null,
38754
+ request: null,
38755
+ timings: null,
38756
+ error: null
38757
+ };
38758
+ /**
38759
+ * One explicit-mode attempt through the client's `post()` or `handoff()`.
38760
+ * Never falls back to `submit()`: that would let the deprecated
38761
+ * `config.onSubmit` decide what an explicit mode already decided.
38762
+ */
38763
+ function runAttempt(_x, _x2, _x3, _x4) {
38764
+ return _runAttempt.apply(this, arguments);
38765
+ }
38766
+ function _runAttempt() {
38767
+ _runAttempt = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(client, mode, artifacts, options) {
38768
+ var _yield$client$handoff, request, timings;
38769
+ return _regeneratorRuntime.wrap(function (_context2) {
38770
+ while (1) switch (_context2.prev = _context2.next) {
38771
+ case 0:
38772
+ if (!(mode === 'capture')) {
38773
+ _context2.next = 1;
38774
+ break;
38775
+ }
38776
+ throw new Error("submitMode 'capture' does not submit; the flow reports onCaptured instead");
38777
+ case 1:
38778
+ if (!(mode === 'post')) {
38779
+ _context2.next = 3;
38780
+ break;
38781
+ }
38782
+ if (client.post) {
38783
+ _context2.next = 2;
38784
+ break;
38785
+ }
38786
+ throw missingMethod('post', "submitMode 'post'");
38787
+ case 2:
38788
+ return _context2.abrupt("return", client.post(artifacts, options));
38789
+ case 3:
38790
+ if (client.handoff) {
38791
+ _context2.next = 4;
38792
+ break;
38793
+ }
38794
+ throw missingMethod('handoff', 'submitMode { handoff }');
38795
+ case 4:
38796
+ _context2.next = 5;
38797
+ return client.handoff(artifacts, options);
38798
+ case 5:
38799
+ _yield$client$handoff = _context2.sent;
38800
+ request = _yield$client$handoff.request;
38801
+ timings = _yield$client$handoff.timings;
38802
+ return _context2.abrupt("return", {
38803
+ request: request,
38804
+ timings: timings,
38805
+ response: null
38806
+ });
38807
+ case 6:
38808
+ case "end":
38809
+ return _context2.stop();
38810
+ }
38811
+ }, _callee2);
38812
+ }));
38813
+ return _runAttempt.apply(this, arguments);
38814
+ }
38815
+ function missingMethod(method, needs) {
38816
+ return new Error(needs + " needs client." + method + "(), which this client does not have. " + 'Create the client with createIdmissionClient or useIdmissionClient.');
38817
+ }
38818
+ /**
38819
+ * Runs a customer callback whose failure must not change an outcome that is
38820
+ * already settled: a throw or a rejected promise is logged, never rethrown.
38821
+ */
38822
+ function notifySafely(name, notify) {
38823
+ try {
38824
+ // `Promise.resolve`, not `instanceof Promise`: a promise from another
38825
+ // realm (an iframe) fails that check, and its rejection would go unhandled.
38826
+ Promise.resolve(notify())["catch"](function (e) {
38827
+ return warn(name + " rejected", e);
38828
+ });
38829
+ } catch (e) {
38830
+ warn(name + " threw", e);
38831
+ }
38832
+ }
38527
38833
  function useSubmission() {
38528
38834
  var context = React.useContext(SubmissionContext);
38529
38835
  if (!context) {
@@ -39433,15 +39739,15 @@ var Root = styledComponents.styled.div(_templateObject$2 || (_templateObject$2 =
39433
39739
  var Label = styledComponents.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"])));
39434
39740
 
39435
39741
  function CompositeWizard(_ref) {
39436
- var _successScreen$isAppr;
39742
+ var _successScreen$isAppr, _ref2;
39437
39743
  var steps = _ref.steps,
39438
39744
  sessionReadyProp = _ref.sessionReady,
39439
39745
  _ref$initialArtifacts = _ref.initialArtifacts,
39440
39746
  initialArtifacts = _ref$initialArtifacts === void 0 ? {} : _ref$initialArtifacts,
39441
39747
  _ref$captureOnly = _ref.captureOnly,
39442
39748
  captureOnly = _ref$captureOnly === void 0 ? false : _ref$captureOnly,
39443
- _ref$showSuccessScree = _ref.showSuccessScreen,
39444
- showSuccessScreen = _ref$showSuccessScree === void 0 ? false : _ref$showSuccessScree,
39749
+ showResultScreen = _ref.showResultScreen,
39750
+ showSuccessScreen = _ref.showSuccessScreen,
39445
39751
  _ref$showDiagnostics = _ref.showDiagnostics,
39446
39752
  showDiagnostics = _ref$showDiagnostics === void 0 ? false : _ref$showDiagnostics,
39447
39753
  successClassNames = _ref.successClassNames,
@@ -39591,7 +39897,7 @@ function CompositeWizard(_ref) {
39591
39897
  classNames: successScreen.classNames
39592
39898
  });
39593
39899
  }
39594
- if (submissionStatus === SubmissionStatus.SUBMITTED && submissionResponse && showSuccessScreen) {
39900
+ if (submissionStatus === SubmissionStatus.SUBMITTED && submissionResponse && ((_ref2 = showResultScreen != null ? showResultScreen : showSuccessScreen) != null ? _ref2 : false)) {
39595
39901
  return jsxRuntime.jsx(SubmissionSuccess, {
39596
39902
  response: submissionResponse,
39597
39903
  request: lastSubmissionRequest,
@@ -39628,8 +39934,8 @@ function capturedArtifactLabels(artifacts) {
39628
39934
  });
39629
39935
  return labels;
39630
39936
  }
39631
- function SubmittingScreen(_ref2) {
39632
- var text = _ref2.text;
39937
+ function SubmittingScreen(_ref3) {
39938
+ var text = _ref3.text;
39633
39939
  return jsxRuntime.jsx(OrbStatusScreen, {
39634
39940
  state: "working",
39635
39941
  text: text,
@@ -40388,11 +40694,12 @@ function RemoteDiagnosticsMount(_ref) {
40388
40694
  }
40389
40695
 
40390
40696
  var _templateObject$1, _templateObject2$1, _templateObject3, _templateObject4;
40391
- var _excluded$9 = ["client", "action", "submission", "theme", "className", "geolocationEnabled", "geolocationRequired", "captureProgress", "remoteDiagnostics", "loadingSpinner", "showEnrollmentId", "children"];
40697
+ var _excluded$9 = ["client", "action", "submission", "submitMode", "theme", "className", "geolocationEnabled", "geolocationRequired", "captureProgress", "remoteDiagnostics", "loadingSpinner", "showEnrollmentId", "lang", "children"];
40392
40698
  function FlowChassis(_ref) {
40393
40699
  var client = _ref.client,
40394
40700
  action = _ref.action,
40395
40701
  submission = _ref.submission,
40702
+ submitMode = _ref.submitMode,
40396
40703
  _ref$theme = _ref.theme,
40397
40704
  theme = _ref$theme === void 0 ? 'default' : _ref$theme,
40398
40705
  className = _ref.className,
@@ -40405,6 +40712,7 @@ function FlowChassis(_ref) {
40405
40712
  loadingSpinner = _ref.loadingSpinner,
40406
40713
  _ref$showEnrollmentId = _ref.showEnrollmentId,
40407
40714
  showEnrollmentId = _ref$showEnrollmentId === void 0 ? false : _ref$showEnrollmentId,
40715
+ lang = _ref.lang,
40408
40716
  children = _ref.children,
40409
40717
  callbacks = _objectWithoutPropertiesLoose(_ref, _excluded$9);
40410
40718
  var geolocation = useGeolocation(geolocationEnabled);
@@ -40414,26 +40722,30 @@ function FlowChassis(_ref) {
40414
40722
  client: client,
40415
40723
  children: [jsxRuntime.jsx(RemoteDiagnosticsMount, {
40416
40724
  remoteDiagnostics: remoteDiagnostics
40417
- }), jsxRuntime.jsx(ThemeProvider, {
40418
- theme: theme,
40419
- children: jsxRuntime.jsx(LoadingSpinnerProvider, {
40420
- spinner: loadingSpinner,
40421
- children: jsxRuntime.jsx(SubmissionProvider, _extends({
40422
- client: client,
40423
- action: action,
40424
- options: submission,
40425
- geolocation: geolocation.position
40426
- }, callbacks, {
40427
- children: jsxRuntime.jsx(FlowPage, {
40428
- className: className,
40429
- enrollmentId: showEnrollmentId ? submission == null ? void 0 : submission.enrollmentId : undefined,
40430
- children: jsxRuntime.jsx(AuthGate, {
40431
- children: geolocationRequired && geolocation.blocked ? jsxRuntime.jsx(GeolocationAccessDeniedOverlay, {
40432
- onRetry: geolocation.retry
40433
- }) : children
40725
+ }), jsxRuntime.jsx(SdkLanguageProvider, {
40726
+ lang: lang,
40727
+ children: jsxRuntime.jsx(ThemeProvider, {
40728
+ theme: theme,
40729
+ children: jsxRuntime.jsx(LoadingSpinnerProvider, {
40730
+ spinner: loadingSpinner,
40731
+ children: jsxRuntime.jsx(SubmissionProvider, _extends({
40732
+ client: client,
40733
+ action: action,
40734
+ options: submission,
40735
+ mode: submitMode,
40736
+ geolocation: geolocation.position
40737
+ }, callbacks, {
40738
+ children: jsxRuntime.jsx(FlowPage, {
40739
+ className: className,
40740
+ enrollmentId: showEnrollmentId ? submission == null ? void 0 : submission.enrollmentId : undefined,
40741
+ children: jsxRuntime.jsx(AuthGate, {
40742
+ children: geolocationRequired && geolocation.blocked ? jsxRuntime.jsx(GeolocationAccessDeniedOverlay, {
40743
+ onRetry: geolocation.retry
40744
+ }) : children
40745
+ })
40434
40746
  })
40435
- })
40436
- }))
40747
+ }))
40748
+ })
40437
40749
  })
40438
40750
  })]
40439
40751
  })
@@ -40593,6 +40905,26 @@ function impliedSkipSuccessScreen(explicit, introActive) {
40593
40905
  return explicit != null ? explicit : introActive;
40594
40906
  }
40595
40907
 
40908
+ /**
40909
+ * A step bag with the flow's settings filled in wherever the step leaves them
40910
+ * unset: `step ?? flow`, key by key. The step's own value always wins, an
40911
+ * explicit `false` included, so a flow-wide setting never overrides a step.
40912
+ *
40913
+ * `flow` is typed against the step bag, so a setting the step has no prop for
40914
+ * (`debugMode` on the signature step, say) fails to compile instead of being
40915
+ * forwarded to a component that ignores it.
40916
+ */
40917
+ function inheritFlowSettings(step, flow) {
40918
+ var inherited = {};
40919
+ for (var key in flow) {
40920
+ if (!Object.prototype.hasOwnProperty.call(flow, key)) continue;
40921
+ if ((step == null ? void 0 : step[key]) === undefined && flow[key] !== undefined) {
40922
+ inherited[key] = flow[key];
40923
+ }
40924
+ }
40925
+ return _extends({}, step, inherited);
40926
+ }
40927
+
40596
40928
  function buildRingScreenProps(_ref) {
40597
40929
  var ringMode = _ref.ringMode,
40598
40930
  finishingVerbiage = _ref.finishingVerbiage,
@@ -40721,7 +41053,7 @@ function withVirtualCameras(camera, allowVirtualCameras) {
40721
41053
  return base;
40722
41054
  }
40723
41055
 
40724
- 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"];
41056
+ 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"];
40725
41057
  var EMPTY_ID_CAPTURE$3 = {};
40726
41058
  var EMPTY_SIGNATURE_CAPTURE$5 = {};
40727
41059
  var EMPTY_ID_VIEW$3 = {};
@@ -40733,24 +41065,27 @@ function IdValidationFlow(_ref) {
40733
41065
  _ref$capture = _ref.capture,
40734
41066
  capture = _ref$capture === void 0 ? EMPTY_ID_CAPTURE$3 : _ref$capture,
40735
41067
  _ref$view = _ref.view,
40736
- view = _ref$view === void 0 ? EMPTY_ID_VIEW$3 : _ref$view,
41068
+ viewProp = _ref$view === void 0 ? EMPTY_ID_VIEW$3 : _ref$view,
40737
41069
  _ref$submission = _ref.submission,
40738
41070
  submission = _ref$submission === void 0 ? EMPTY_SUBMISSION$6 : _ref$submission,
40739
41071
  _ref$initialArtifacts = _ref.initialArtifacts,
40740
41072
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$9 : _ref$initialArtifacts,
40741
- _ref$captureOnly = _ref.captureOnly,
40742
- captureOnly = _ref$captureOnly === void 0 ? false : _ref$captureOnly,
41073
+ submitMode = _ref.submitMode,
41074
+ captureOnly = _ref.captureOnly,
40743
41075
  signatureController = _ref.signatureController,
40744
41076
  _ref$signatureCapture = _ref.signatureCapture,
40745
41077
  signatureCapture = _ref$signatureCapture === void 0 ? EMPTY_SIGNATURE_CAPTURE$5 : _ref$signatureCapture,
40746
- signatureView = _ref.signatureView,
41078
+ signatureViewProp = _ref.signatureView,
40747
41079
  captureSignature = _ref.captureSignature,
40748
41080
  captureSignatureVideo = _ref.captureSignatureVideo,
40749
41081
  allowVirtualCameras = _ref.allowVirtualCameras,
40750
41082
  theme = _ref.theme,
40751
41083
  className = _ref.className,
40752
- _ref$showSuccessScree = _ref.showSuccessScreen,
40753
- showSuccessScreen = _ref$showSuccessScree === void 0 ? false : _ref$showSuccessScree,
41084
+ lang = _ref.lang,
41085
+ debugMode = _ref.debugMode,
41086
+ skipSuccessScreen = _ref.skipSuccessScreen,
41087
+ showResultScreen = _ref.showResultScreen,
41088
+ showSuccessScreen = _ref.showSuccessScreen,
40754
41089
  _ref$showDiagnostics = _ref.showDiagnostics,
40755
41090
  showDiagnostics = _ref$showDiagnostics === void 0 ? false : _ref$showDiagnostics,
40756
41091
  captureAdditionalDocuments = _ref.captureAdditionalDocuments,
@@ -40762,6 +41097,23 @@ function IdValidationFlow(_ref) {
40762
41097
  onSubmitted = _ref.onSubmitted,
40763
41098
  children = _ref.children,
40764
41099
  callbacks = _objectWithoutPropertiesLoose(_ref, _excluded$8);
41100
+ // Flow-wide settings reach each step unless its own bag sets them.
41101
+ var _useMemo = React.useMemo(function () {
41102
+ return {
41103
+ view: inheritFlowSettings(viewProp, {
41104
+ lang: lang,
41105
+ debugMode: debugMode,
41106
+ skipSuccessScreen: skipSuccessScreen
41107
+ }),
41108
+ signatureView: inheritFlowSettings(signatureViewProp, {
41109
+ lang: lang,
41110
+ showCaptureDiagnostics: debugMode,
41111
+ skipSuccessScreen: skipSuccessScreen
41112
+ })
41113
+ };
41114
+ }, [debugMode, lang, signatureViewProp, skipSuccessScreen, viewProp]),
41115
+ view = _useMemo.view,
41116
+ signatureView = _useMemo.signatureView;
40765
41117
  useMountOnlyWarnings('IdValidationFlow', FLOW_MOUNT_ONLY_REMEDY, {
40766
41118
  capture: capture,
40767
41119
  signatureCapture: signatureCapture
@@ -40878,18 +41230,21 @@ function IdValidationFlow(_ref) {
40878
41230
  successIssuerCaptionText: 'confirmed'
40879
41231
  }
40880
41232
  });
41233
+ var mode = submitMode != null ? submitMode : captureOnly ? 'capture' : undefined;
40881
41234
  return jsxRuntime.jsxs(FlowChassis, _extends({
40882
41235
  client: client,
40883
41236
  action: SubmissionAction.VALIDATE,
40884
41237
  submission: submission,
41238
+ submitMode: mode,
40885
41239
  theme: theme,
40886
- className: className
41240
+ className: className,
41241
+ lang: lang
40887
41242
  }, callbacks, {
40888
41243
  children: [jsxRuntime.jsx(CompositeWizard, _extends({}, ringScreens, {
40889
41244
  steps: steps,
40890
41245
  initialArtifacts: initialArtifacts,
40891
- captureOnly: captureOnly,
40892
- showSuccessScreen: showSuccessScreen,
41246
+ captureOnly: mode === 'capture',
41247
+ showResultScreen: showResultScreen != null ? showResultScreen : showSuccessScreen,
40893
41248
  showDiagnostics: showDiagnostics,
40894
41249
  onArtifactsCollected: onCaptured,
40895
41250
  onSubmitted: onSubmitted
@@ -40908,13 +41263,16 @@ function FaceValidationFlow(_ref) {
40908
41263
  _ref$capture = _ref.capture,
40909
41264
  capture = _ref$capture === void 0 ? EMPTY_FACE_CAPTURE$5 : _ref$capture,
40910
41265
  _ref$view = _ref.view,
40911
- view = _ref$view === void 0 ? EMPTY_FACE_VIEW$5 : _ref$view,
41266
+ viewProp = _ref$view === void 0 ? EMPTY_FACE_VIEW$5 : _ref$view,
40912
41267
  _ref$submission = _ref.submission,
40913
41268
  submission = _ref$submission === void 0 ? EMPTY_SUBMISSION$5 : _ref$submission,
40914
41269
  _ref$initialArtifacts = _ref.initialArtifacts,
40915
41270
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$8 : _ref$initialArtifacts,
40916
41271
  theme = _ref.theme,
40917
41272
  className = _ref.className,
41273
+ lang = _ref.lang,
41274
+ debugMode = _ref.debugMode,
41275
+ skipSuccessScreen = _ref.skipSuccessScreen,
40918
41276
  geolocationEnabled = _ref.geolocationEnabled,
40919
41277
  geolocationRequired = _ref.geolocationRequired,
40920
41278
  captureProgress = _ref.captureProgress,
@@ -40923,6 +41281,14 @@ function FaceValidationFlow(_ref) {
40923
41281
  onCaptured = _ref.onCaptured,
40924
41282
  onCaptureError = _ref.onCaptureError,
40925
41283
  children = _ref.children;
41284
+ // Flow-wide settings reach the step unless its own bag sets them.
41285
+ var view = React.useMemo(function () {
41286
+ return inheritFlowSettings(viewProp, {
41287
+ lang: lang,
41288
+ debugMode: debugMode,
41289
+ skipSuccessScreen: skipSuccessScreen
41290
+ });
41291
+ }, [debugMode, lang, skipSuccessScreen, viewProp]);
40926
41292
  var checkLivenessOptions = capture.checkLivenessOptions,
40927
41293
  controllerCapture = _objectWithoutPropertiesLoose(capture, _excluded$7);
40928
41294
  useMountOnlyWarnings('FaceValidationFlow', FLOW_MOUNT_ONLY_REMEDY, {
@@ -40983,6 +41349,7 @@ function FaceValidationFlow(_ref) {
40983
41349
  submission: submission,
40984
41350
  theme: theme,
40985
41351
  className: className,
41352
+ lang: lang,
40986
41353
  geolocationEnabled: geolocationEnabled,
40987
41354
  geolocationRequired: geolocationRequired,
40988
41355
  captureProgress: captureProgress,
@@ -40997,7 +41364,7 @@ function FaceValidationFlow(_ref) {
40997
41364
  });
40998
41365
  }
40999
41366
 
41000
- 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"],
41367
+ 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"],
41001
41368
  _excluded2$3 = ["checkLivenessOptions"];
41002
41369
  var EMPTY_ID_CAPTURE$2 = {};
41003
41370
  var EMPTY_FACE_CAPTURE$4 = {};
@@ -41019,10 +41386,10 @@ function IdAndFaceValidationFlow(_ref) {
41019
41386
  _ref$signatureCapture = _ref.signatureCapture,
41020
41387
  signatureCapture = _ref$signatureCapture === void 0 ? EMPTY_SIGNATURE_CAPTURE$4 : _ref$signatureCapture,
41021
41388
  _ref$idView = _ref.idView,
41022
- idView = _ref$idView === void 0 ? EMPTY_ID_VIEW$2 : _ref$idView,
41389
+ idViewProp = _ref$idView === void 0 ? EMPTY_ID_VIEW$2 : _ref$idView,
41023
41390
  _ref$faceView = _ref.faceView,
41024
- faceView = _ref$faceView === void 0 ? EMPTY_FACE_VIEW$4 : _ref$faceView,
41025
- signatureView = _ref.signatureView,
41391
+ faceViewProp = _ref$faceView === void 0 ? EMPTY_FACE_VIEW$4 : _ref$faceView,
41392
+ signatureViewProp = _ref.signatureView,
41026
41393
  captureSignature = _ref.captureSignature,
41027
41394
  captureSignatureVideo = _ref.captureSignatureVideo,
41028
41395
  allowVirtualCameras = _ref.allowVirtualCameras,
@@ -41032,8 +41399,11 @@ function IdAndFaceValidationFlow(_ref) {
41032
41399
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$7 : _ref$initialArtifacts,
41033
41400
  theme = _ref.theme,
41034
41401
  className = _ref.className,
41035
- _ref$showSuccessScree = _ref.showSuccessScreen,
41036
- showSuccessScreen = _ref$showSuccessScree === void 0 ? false : _ref$showSuccessScree,
41402
+ lang = _ref.lang,
41403
+ debugMode = _ref.debugMode,
41404
+ skipSuccessScreen = _ref.skipSuccessScreen,
41405
+ showResultScreen = _ref.showResultScreen,
41406
+ showSuccessScreen = _ref.showSuccessScreen,
41037
41407
  _ref$showDiagnostics = _ref.showDiagnostics,
41038
41408
  showDiagnostics = _ref$showDiagnostics === void 0 ? false : _ref$showDiagnostics,
41039
41409
  captureAdditionalDocuments = _ref.captureAdditionalDocuments,
@@ -41047,6 +41417,26 @@ function IdAndFaceValidationFlow(_ref) {
41047
41417
  onStepCompleted = _ref.onStepCompleted,
41048
41418
  children = _ref.children,
41049
41419
  callbacks = _objectWithoutPropertiesLoose(_ref, _excluded$6);
41420
+ // Flow-wide settings reach each step unless its own bag sets them.
41421
+ var _useMemo = React.useMemo(function () {
41422
+ var settings = {
41423
+ lang: lang,
41424
+ debugMode: debugMode,
41425
+ skipSuccessScreen: skipSuccessScreen
41426
+ };
41427
+ return {
41428
+ idView: inheritFlowSettings(idViewProp, settings),
41429
+ faceView: inheritFlowSettings(faceViewProp, settings),
41430
+ signatureView: inheritFlowSettings(signatureViewProp, {
41431
+ lang: lang,
41432
+ showCaptureDiagnostics: debugMode,
41433
+ skipSuccessScreen: skipSuccessScreen
41434
+ })
41435
+ };
41436
+ }, [debugMode, faceViewProp, idViewProp, lang, signatureViewProp, skipSuccessScreen]),
41437
+ idView = _useMemo.idView,
41438
+ faceView = _useMemo.faceView,
41439
+ signatureView = _useMemo.signatureView;
41050
41440
  var checkLivenessOptions = faceCapture.checkLivenessOptions,
41051
41441
  selfieCaptureConfig = _objectWithoutPropertiesLoose(faceCapture, _excluded2$3);
41052
41442
  useMountOnlyWarnings('IdAndFaceValidationFlow', FLOW_MOUNT_ONLY_REMEDY, {
@@ -41217,12 +41607,13 @@ function IdAndFaceValidationFlow(_ref) {
41217
41607
  action: SubmissionAction.VALIDATE,
41218
41608
  submission: submission,
41219
41609
  theme: theme,
41220
- className: className
41610
+ className: className,
41611
+ lang: lang
41221
41612
  }, callbacks, {
41222
41613
  children: [jsxRuntime.jsx(CompositeWizard, _extends({}, ringScreens, {
41223
41614
  steps: steps,
41224
41615
  initialArtifacts: initialArtifacts,
41225
- showSuccessScreen: showSuccessScreen,
41616
+ showResultScreen: showResultScreen != null ? showResultScreen : showSuccessScreen,
41226
41617
  showDiagnostics: showDiagnostics,
41227
41618
  onSubmitted: onSubmitted,
41228
41619
  onStepStarted: onStepStarted,
@@ -41277,9 +41668,9 @@ function SignatureKYCFlow(_ref) {
41277
41668
  _ref$signatureCapture = _ref.signatureCapture,
41278
41669
  signatureCapture = _ref$signatureCapture === void 0 ? EMPTY_SIGNATURE_CAPTURE$3 : _ref$signatureCapture,
41279
41670
  _ref$faceView = _ref.faceView,
41280
- faceView = _ref$faceView === void 0 ? EMPTY_FACE_VIEW$3 : _ref$faceView,
41671
+ faceViewProp = _ref$faceView === void 0 ? EMPTY_FACE_VIEW$3 : _ref$faceView,
41281
41672
  _ref$signatureView = _ref.signatureView,
41282
- signatureView = _ref$signatureView === void 0 ? EMPTY_SIGNATURE_VIEW : _ref$signatureView,
41673
+ signatureViewProp = _ref$signatureView === void 0 ? EMPTY_SIGNATURE_VIEW : _ref$signatureView,
41283
41674
  challengeResponse = _ref.challengeResponse,
41284
41675
  allowVirtualCameras = _ref.allowVirtualCameras,
41285
41676
  _ref$allowHigherCamer = _ref.allowHigherCameraResolutions,
@@ -41305,13 +41696,35 @@ function SignatureKYCFlow(_ref) {
41305
41696
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$6 : _ref$initialArtifacts,
41306
41697
  theme = _ref.theme,
41307
41698
  className = _ref.className,
41699
+ lang = _ref.lang,
41700
+ debugMode = _ref.debugMode,
41308
41701
  geolocationEnabled = _ref.geolocationEnabled,
41309
41702
  geolocationRequired = _ref.geolocationRequired,
41310
41703
  captureProgress = _ref.captureProgress,
41311
41704
  remoteDiagnostics = _ref.remoteDiagnostics,
41312
41705
  loadingSpinner = _ref.loadingSpinner,
41706
+ _ref$submitMode = _ref.submitMode,
41707
+ submitMode = _ref$submitMode === void 0 ? 'capture' : _ref$submitMode,
41708
+ onSubmissionStarted = _ref.onSubmissionStarted,
41709
+ onSubmissionFailure = _ref.onSubmissionFailure,
41313
41710
  onCaptured = _ref.onCaptured,
41314
41711
  onCaptureError = _ref.onCaptureError;
41712
+ // Flow-wide settings reach each step unless its own bag sets them.
41713
+ var _useMemo = React.useMemo(function () {
41714
+ return {
41715
+ faceView: inheritFlowSettings(faceViewProp, {
41716
+ lang: lang,
41717
+ debugMode: debugMode
41718
+ }),
41719
+ signatureView: inheritFlowSettings(signatureViewProp, {
41720
+ lang: lang,
41721
+ showCaptureDiagnostics: debugMode,
41722
+ skipSuccessScreen: skipSuccessScreen
41723
+ })
41724
+ };
41725
+ }, [debugMode, faceViewProp, lang, signatureViewProp, skipSuccessScreen]),
41726
+ faceView = _useMemo.faceView,
41727
+ signatureView = _useMemo.signatureView;
41315
41728
  var checkLivenessOptions = faceCapture.checkLivenessOptions,
41316
41729
  selfieCaptureConfig = _objectWithoutPropertiesLoose(faceCapture, _excluded$5);
41317
41730
  useMountOnlyWarnings('SignatureKYCFlow', FLOW_MOUNT_ONLY_REMEDY, {
@@ -41322,7 +41735,7 @@ function SignatureKYCFlow(_ref) {
41322
41735
  var latestSelfieCapture = useLatestCallbacks(selfieCaptureConfig);
41323
41736
  var latestSelfieLiveness = useLatestCallbacks(selfieCaptureConfig.liveness);
41324
41737
  var latestSignatureCapture = useLatestCallbacks(signatureCapture);
41325
- var legacyVideoLayout = (_signatureView$legacy = signatureView == null ? void 0 : signatureView.legacyVideoLayout) != null ? _signatureView$legacy : false;
41738
+ var legacyVideoLayout = (_signatureView$legacy = signatureView.legacyVideoLayout) != null ? _signatureView$legacy : false;
41326
41739
  var onExitAfterLivenessFailure = faceView.onExitAfterFailure;
41327
41740
  var sharedVideoRef = React.useRef(null);
41328
41741
  var _useState = React.useState(null),
@@ -41489,13 +41902,21 @@ function SignatureKYCFlow(_ref) {
41489
41902
  resolvedSelfieController.actions.retry();
41490
41903
  setStage('face-liveness');
41491
41904
  }, [resolvedSelfieController]);
41905
+ // Lives here, above the chassis's session gate: a session error unmounts
41906
+ // and remounts `SignatureHandoff`, and must not start the hand-off again.
41907
+ var handoffStartedRef = React.useRef(false);
41908
+ var claimHandoffStart = React.useCallback(function () {
41909
+ if (handoffStartedRef.current) return false;
41910
+ handoffStartedRef.current = true;
41911
+ return true;
41912
+ }, []);
41492
41913
  var handleSignatureCompleted = React.useCallback(function (artifacts) {
41493
41914
  if (completedRef.current) return;
41494
41915
  completedRef.current = true;
41495
41916
  artifactsRef.current = mergeSubmissionArtifacts(artifactsRef.current, artifacts);
41496
41917
  setStage('complete');
41497
- onCaptured == null || onCaptured(artifactsRef.current);
41498
- }, [onCaptured]);
41918
+ if (submitMode === 'capture') onCaptured == null || onCaptured(artifactsRef.current);
41919
+ }, [onCaptured, submitMode]);
41499
41920
  var handleLivenessFailureExit = React.useCallback(function () {
41500
41921
  onExitAfterLivenessFailure == null || onExitAfterLivenessFailure();
41501
41922
  if (allowSignatureAfterLivenessCheckFailure) handleLivenessDone();
@@ -41504,18 +41925,25 @@ function SignatureKYCFlow(_ref) {
41504
41925
  client: client,
41505
41926
  action: SubmissionAction.NONE,
41506
41927
  submission: submission,
41928
+ submitMode: submitMode,
41929
+ onSubmissionStarted: onSubmissionStarted,
41930
+ onSubmissionFailure: onSubmissionFailure,
41507
41931
  theme: theme,
41508
41932
  className: className,
41933
+ lang: lang,
41509
41934
  geolocationEnabled: geolocationEnabled,
41510
41935
  geolocationRequired: geolocationRequired,
41511
41936
  captureProgress: captureProgress,
41512
41937
  remoteDiagnostics: remoteDiagnostics,
41513
41938
  loadingSpinner: loadingSpinner,
41514
41939
  children: [jsxRuntime.jsx(CaptureProgressCompletion, {
41515
- completed: stage === 'complete'
41516
- }), stage !== 'complete' ? jsxRuntime.jsxs(HandoffRoot, {
41940
+ completed: stage === 'complete' && submitMode === 'capture'
41941
+ }), stage === 'complete' && submitMode !== 'capture' ? jsxRuntime.jsx(SignatureHandoff, {
41942
+ artifacts: artifactsRef.current,
41943
+ claimStart: claimHandoffStart
41944
+ }) : null, stage !== 'complete' ? jsxRuntime.jsxs(HandoffRoot, {
41517
41945
  children: [jsxRuntime.jsx(SignatureCaptureView, _extends({}, signatureView, {
41518
- skipSuccessScreen: impliedSkipSuccessScreen(skipSuccessScreen != null ? skipSuccessScreen : signatureView.skipSuccessScreen, isRingIntroActive(faceView)),
41946
+ skipSuccessScreen: impliedSkipSuccessScreen(signatureView.skipSuccessScreen, isRingIntroActive(faceView)),
41519
41947
  controller: resolvedSignatureController,
41520
41948
  sessionReady: renderedStage === 'signature-capture',
41521
41949
  videoRef: sharedVideoRef,
@@ -41563,6 +41991,43 @@ function SignatureKYCFlow(_ref) {
41563
41991
  }) : null]
41564
41992
  });
41565
41993
  }
41994
+ /**
41995
+ * Hands the finished capture off once the session has passed: a finishing
41996
+ * screen while the request is built, a retry screen if that fails, and
41997
+ * nothing once it has been handed off.
41998
+ */
41999
+ function SignatureHandoff(_ref3) {
42000
+ var artifacts = _ref3.artifacts,
42001
+ claimStart = _ref3.claimStart;
42002
+ var _useSubmission = useSubmission(),
42003
+ action = _useSubmission.action,
42004
+ submit = _useSubmission.submit,
42005
+ submissionStatus = _useSubmission.submissionStatus,
42006
+ submissionError = _useSubmission.submissionError;
42007
+ var sessionReady = useSessionReady();
42008
+ // The provider reports a failure itself; these catches only keep the
42009
+ // rejection from going unhandled.
42010
+ React.useEffect(function () {
42011
+ if (!sessionReady || !claimStart()) return;
42012
+ submit(artifacts)["catch"](function () {});
42013
+ }, [artifacts, claimStart, sessionReady, submit]);
42014
+ if (submissionStatus === SubmissionStatus.SUBMITTED) return null;
42015
+ if (submissionStatus === SubmissionStatus.FAILED) {
42016
+ return jsxRuntime.jsx(SubmissionErrorOverlay, {
42017
+ error: submissionError,
42018
+ onRetry: function onRetry() {
42019
+ submit(artifacts)["catch"](function () {});
42020
+ }
42021
+ });
42022
+ }
42023
+ var text = submissionStatusText(action, artifacts);
42024
+ return jsxRuntime.jsx(OrbStatusScreen, {
42025
+ state: "working",
42026
+ text: text,
42027
+ accessibleLabel: text,
42028
+ loadingStage: "submission"
42029
+ });
42030
+ }
41566
42031
  /**
41567
42032
  * Black, so iOS Safari's bars read as letterboxing around the camera feed
41568
42033
  * rather than as one more colour a theme has to choose.
@@ -41580,10 +42045,10 @@ var CAMERA_EDGE_COLOR = '#000';
41580
42045
  * no flat strip can sit on its bottom edge unseen: that one is drawn invisibly,
41581
42046
  * as on ID capture's overlay. Opaque, it covered the bottom 12px of the bar.
41582
42047
  */
41583
- function FlowEdgeTint(_ref3) {
42048
+ function FlowEdgeTint(_ref4) {
41584
42049
  var _theme$selfieCapture$, _theme$selfieCapture, _theme$background;
41585
- var surface = _ref3.surface,
41586
- modelsReady = _ref3.modelsReady;
42050
+ var surface = _ref4.surface,
42051
+ modelsReady = _ref4.modelsReady;
41587
42052
  var theme = styledComponents.useTheme();
41588
42053
  if (theme.isFullscreen === false || surface === null) return null;
41589
42054
  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');
@@ -41593,9 +42058,9 @@ function FlowEdgeTint(_ref3) {
41593
42058
  hiddenBottomColor: surface === 'overlay' ? selfieLoadingOverlayBottomEdgeColor(theme, modelsReady) : undefined
41594
42059
  });
41595
42060
  }
41596
- function SelfieTrackerAttachment(_ref4) {
41597
- var controller = _ref4.controller,
41598
- video = _ref4.video;
42061
+ function SelfieTrackerAttachment(_ref5) {
42062
+ var controller = _ref5.controller,
42063
+ video = _ref5.video;
41599
42064
  React.useEffect(function () {
41600
42065
  if (!video) return;
41601
42066
  void controller.attach(video)["catch"](function () {
@@ -41613,7 +42078,7 @@ var FaceStage = styledComponents.styled.div(_templateObject2 || (_templateObject
41613
42078
  return props.$visible ? 'block' : 'none';
41614
42079
  });
41615
42080
 
41616
- 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"],
42081
+ 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"],
41617
42082
  _excluded2$2 = ["checkLivenessOptions"];
41618
42083
  var EMPTY_ID_CAPTURE$1 = {};
41619
42084
  var EMPTY_FACE_CAPTURE$2 = {};
@@ -41637,21 +42102,21 @@ function VideoIdValidationFlow(_ref) {
41637
42102
  _ref$capture = _ref.capture,
41638
42103
  capture = _ref$capture === void 0 ? EMPTY_VIDEO_CAPTURE : _ref$capture,
41639
42104
  _ref$idView = _ref.idView,
41640
- idView = _ref$idView === void 0 ? EMPTY_ID_VIEW$1 : _ref$idView,
42105
+ idViewProp = _ref$idView === void 0 ? EMPTY_ID_VIEW$1 : _ref$idView,
41641
42106
  _ref$faceView = _ref.faceView,
41642
- faceView = _ref$faceView === void 0 ? EMPTY_FACE_VIEW$2 : _ref$faceView,
42107
+ faceViewProp = _ref$faceView === void 0 ? EMPTY_FACE_VIEW$2 : _ref$faceView,
41643
42108
  _ref$view = _ref.view,
41644
- view = _ref$view === void 0 ? EMPTY_VIDEO_VIEW : _ref$view,
42109
+ viewProp = _ref$view === void 0 ? EMPTY_VIDEO_VIEW : _ref$view,
41645
42110
  _ref$submission = _ref.submission,
41646
42111
  submission = _ref$submission === void 0 ? EMPTY_SUBMISSION$2 : _ref$submission,
41647
42112
  _ref$initialArtifacts = _ref.initialArtifacts,
41648
42113
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$5 : _ref$initialArtifacts,
41649
- _ref$captureOnly = _ref.captureOnly,
41650
- captureOnly = _ref$captureOnly === void 0 ? false : _ref$captureOnly,
42114
+ submitMode = _ref.submitMode,
42115
+ captureOnly = _ref.captureOnly,
41651
42116
  signatureController = _ref.signatureController,
41652
42117
  _ref$signatureCapture = _ref.signatureCapture,
41653
42118
  signatureCapture = _ref$signatureCapture === void 0 ? EMPTY_SIGNATURE_CAPTURE$2 : _ref$signatureCapture,
41654
- signatureView = _ref.signatureView,
42119
+ signatureViewProp = _ref.signatureView,
41655
42120
  captureSignature = _ref.captureSignature,
41656
42121
  captureSignatureVideo = _ref.captureSignatureVideo,
41657
42122
  allowVirtualCameras = _ref.allowVirtualCameras,
@@ -41663,8 +42128,11 @@ function VideoIdValidationFlow(_ref) {
41663
42128
  onMicrophoneAccessDenied = _ref.onMicrophoneAccessDenied,
41664
42129
  theme = _ref.theme,
41665
42130
  className = _ref.className,
41666
- _ref$showSuccessScree = _ref.showSuccessScreen,
41667
- showSuccessScreen = _ref$showSuccessScree === void 0 ? false : _ref$showSuccessScree,
42131
+ lang = _ref.lang,
42132
+ debugMode = _ref.debugMode,
42133
+ skipSuccessScreen = _ref.skipSuccessScreen,
42134
+ showResultScreen = _ref.showResultScreen,
42135
+ showSuccessScreen = _ref.showSuccessScreen,
41668
42136
  _ref$showDiagnostics = _ref.showDiagnostics,
41669
42137
  showDiagnostics = _ref$showDiagnostics === void 0 ? false : _ref$showDiagnostics,
41670
42138
  captureAdditionalDocuments = _ref.captureAdditionalDocuments,
@@ -41677,6 +42145,31 @@ function VideoIdValidationFlow(_ref) {
41677
42145
  onCaptureError = _ref.onCaptureError,
41678
42146
  children = _ref.children,
41679
42147
  callbacks = _objectWithoutPropertiesLoose(_ref, _excluded$4);
42148
+ // Flow-wide settings reach each step unless its own bag sets them.
42149
+ var _useMemo = React.useMemo(function () {
42150
+ var settings = {
42151
+ lang: lang,
42152
+ debugMode: debugMode,
42153
+ skipSuccessScreen: skipSuccessScreen
42154
+ };
42155
+ return {
42156
+ idView: inheritFlowSettings(idViewProp, settings),
42157
+ faceView: inheritFlowSettings(faceViewProp, settings),
42158
+ view: inheritFlowSettings(viewProp, {
42159
+ lang: lang,
42160
+ debugMode: debugMode
42161
+ }),
42162
+ signatureView: inheritFlowSettings(signatureViewProp, {
42163
+ lang: lang,
42164
+ showCaptureDiagnostics: debugMode,
42165
+ skipSuccessScreen: skipSuccessScreen
42166
+ })
42167
+ };
42168
+ }, [debugMode, faceViewProp, idViewProp, lang, signatureViewProp, skipSuccessScreen, viewProp]),
42169
+ idView = _useMemo.idView,
42170
+ faceView = _useMemo.faceView,
42171
+ view = _useMemo.view,
42172
+ signatureView = _useMemo.signatureView;
41680
42173
  var checkLivenessOptions = faceCapture.checkLivenessOptions,
41681
42174
  selfieCaptureConfig = _objectWithoutPropertiesLoose(faceCapture, _excluded2$2);
41682
42175
  useMountOnlyWarnings('VideoIdValidationFlow', FLOW_MOUNT_ONLY_REMEDY, {
@@ -41837,18 +42330,21 @@ function VideoIdValidationFlow(_ref) {
41837
42330
  successIssuerCaptionText: 'confirmed'
41838
42331
  }
41839
42332
  });
42333
+ var mode = submitMode != null ? submitMode : captureOnly ? 'capture' : undefined;
41840
42334
  return jsxRuntime.jsxs(FlowChassis, _extends({
41841
42335
  client: client,
41842
42336
  action: action,
41843
42337
  submission: submission,
42338
+ submitMode: mode,
41844
42339
  theme: theme,
41845
- className: className
42340
+ className: className,
42341
+ lang: lang
41846
42342
  }, callbacks, {
41847
42343
  children: [jsxRuntime.jsx(CompositeWizard, _extends({}, ringScreens, {
41848
42344
  steps: steps,
41849
42345
  initialArtifacts: initialArtifacts,
41850
- captureOnly: captureOnly,
41851
- showSuccessScreen: showSuccessScreen,
42346
+ captureOnly: mode === 'capture',
42347
+ showResultScreen: showResultScreen != null ? showResultScreen : showSuccessScreen,
41852
42348
  showDiagnostics: showDiagnostics,
41853
42349
  onArtifactsCollected: onCaptured,
41854
42350
  onSubmitted: onSubmitted
@@ -44691,7 +45187,7 @@ function buildDocumentCaptureStep(controller, view, sessionReady) {
44691
45187
  };
44692
45188
  }
44693
45189
 
44694
- var _excluded$3 = ["client", "controller", "capture", "view", "documents", "submission", "initialArtifacts", "theme", "className", "onDocumentCaptured", "onDocumentUploaded", "onComplete", "children"];
45190
+ var _excluded$3 = ["client", "controller", "capture", "view", "documents", "submission", "initialArtifacts", "theme", "className", "lang", "debugMode", "onDocumentCaptured", "onDocumentUploaded", "onComplete", "children"];
44695
45191
  var EMPTY_DOCUMENTS = [];
44696
45192
  var EMPTY_CAPTURE$1 = {};
44697
45193
  var EMPTY_VIEW$2 = {};
@@ -44712,6 +45208,8 @@ function DocumentCaptureFlow(_ref) {
44712
45208
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$4 : _ref$initialArtifacts,
44713
45209
  theme = _ref.theme,
44714
45210
  className = _ref.className,
45211
+ lang = _ref.lang,
45212
+ debugMode = _ref.debugMode,
44715
45213
  onDocumentCaptured = _ref.onDocumentCaptured,
44716
45214
  onDocumentUploaded = _ref.onDocumentUploaded,
44717
45215
  onComplete = _ref.onComplete,
@@ -44808,8 +45306,11 @@ function DocumentCaptureFlow(_ref) {
44808
45306
  var steps = React.useMemo(function () {
44809
45307
  return [buildDocumentCaptureStep(resolvedController, _extends({
44810
45308
  documents: documents
44811
- }, view))];
44812
- }, [documents, resolvedController, view]);
45309
+ }, inheritFlowSettings(view, {
45310
+ lang: lang,
45311
+ debugMode: debugMode
45312
+ })))];
45313
+ }, [debugMode, documents, lang, resolvedController, view]);
44813
45314
  var onArtifactsCollected = React.useCallback(function () {
44814
45315
  // captureOnly hands the (empty) artifacts back here; completion is reported
44815
45316
  // through onComplete with the documents instead.
@@ -44819,7 +45320,8 @@ function DocumentCaptureFlow(_ref) {
44819
45320
  action: SubmissionAction.NONE,
44820
45321
  submission: submission,
44821
45322
  theme: theme,
44822
- className: className
45323
+ className: className,
45324
+ lang: lang
44823
45325
  }, callbacks, {
44824
45326
  children: [jsxRuntime.jsx(CompositeWizard, {
44825
45327
  steps: steps,
@@ -44830,7 +45332,7 @@ function DocumentCaptureFlow(_ref) {
44830
45332
  }));
44831
45333
  }
44832
45334
 
44833
- 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"],
45335
+ 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"],
44834
45336
  _excluded2$1 = ["checkLivenessOptions"];
44835
45337
  var EMPTY_FACE_CAPTURE$1 = {};
44836
45338
  var EMPTY_SIGNATURE_CAPTURE$1 = {};
@@ -44847,8 +45349,8 @@ function CustomerBiometricsEnrollmentFlow(_ref) {
44847
45349
  _ref$signatureCapture = _ref.signatureCapture,
44848
45350
  signatureCapture = _ref$signatureCapture === void 0 ? EMPTY_SIGNATURE_CAPTURE$1 : _ref$signatureCapture,
44849
45351
  _ref$faceView = _ref.faceView,
44850
- faceView = _ref$faceView === void 0 ? EMPTY_FACE_VIEW$1 : _ref$faceView,
44851
- signatureView = _ref.signatureView,
45352
+ faceViewProp = _ref$faceView === void 0 ? EMPTY_FACE_VIEW$1 : _ref$faceView,
45353
+ signatureViewProp = _ref.signatureView,
44852
45354
  captureSignature = _ref.captureSignature,
44853
45355
  captureSignatureVideo = _ref.captureSignatureVideo,
44854
45356
  allowVirtualCameras = _ref.allowVirtualCameras,
@@ -44856,8 +45358,11 @@ function CustomerBiometricsEnrollmentFlow(_ref) {
44856
45358
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$3 : _ref$initialArtifacts,
44857
45359
  theme = _ref.theme,
44858
45360
  className = _ref.className,
44859
- _ref$showSuccessScree = _ref.showSuccessScreen,
44860
- showSuccessScreen = _ref$showSuccessScree === void 0 ? false : _ref$showSuccessScree,
45361
+ lang = _ref.lang,
45362
+ debugMode = _ref.debugMode,
45363
+ skipSuccessScreen = _ref.skipSuccessScreen,
45364
+ showResultScreen = _ref.showResultScreen,
45365
+ showSuccessScreen = _ref.showSuccessScreen,
44861
45366
  _ref$showDiagnostics = _ref.showDiagnostics,
44862
45367
  showDiagnostics = _ref$showDiagnostics === void 0 ? false : _ref$showDiagnostics,
44863
45368
  captureAdditionalDocuments = _ref.captureAdditionalDocuments,
@@ -44869,6 +45374,23 @@ function CustomerBiometricsEnrollmentFlow(_ref) {
44869
45374
  onCaptureError = _ref.onCaptureError,
44870
45375
  children = _ref.children,
44871
45376
  callbacks = _objectWithoutPropertiesLoose(_ref, _excluded$2);
45377
+ // Flow-wide settings reach each step unless its own bag sets them.
45378
+ var _useMemo = React.useMemo(function () {
45379
+ return {
45380
+ faceView: inheritFlowSettings(faceViewProp, {
45381
+ lang: lang,
45382
+ debugMode: debugMode,
45383
+ skipSuccessScreen: skipSuccessScreen
45384
+ }),
45385
+ signatureView: inheritFlowSettings(signatureViewProp, {
45386
+ lang: lang,
45387
+ showCaptureDiagnostics: debugMode,
45388
+ skipSuccessScreen: skipSuccessScreen
45389
+ })
45390
+ };
45391
+ }, [debugMode, faceViewProp, lang, signatureViewProp, skipSuccessScreen]),
45392
+ faceView = _useMemo.faceView,
45393
+ signatureView = _useMemo.signatureView;
44872
45394
  var checkLivenessOptions = faceCapture.checkLivenessOptions,
44873
45395
  selfieCaptureConfig = _objectWithoutPropertiesLoose(faceCapture, _excluded2$1);
44874
45396
  useMountOnlyWarnings('CustomerBiometricsEnrollmentFlow', FLOW_MOUNT_ONLY_REMEDY, {
@@ -45000,19 +45522,20 @@ function CustomerBiometricsEnrollmentFlow(_ref) {
45000
45522
  submission: submission,
45001
45523
  showEnrollmentId: showDiagnostics,
45002
45524
  theme: theme,
45003
- className: className
45525
+ className: className,
45526
+ lang: lang
45004
45527
  }, callbacks, {
45005
45528
  children: [jsxRuntime.jsx(CompositeWizard, _extends({}, ringScreens, {
45006
45529
  steps: steps,
45007
45530
  initialArtifacts: initialArtifacts,
45008
- showSuccessScreen: showSuccessScreen,
45531
+ showResultScreen: showResultScreen != null ? showResultScreen : showSuccessScreen,
45009
45532
  showDiagnostics: showDiagnostics,
45010
45533
  onSubmitted: onSubmitted
45011
45534
  })), children]
45012
45535
  }));
45013
45536
  }
45014
45537
 
45015
- 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"],
45538
+ 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"],
45016
45539
  _excluded2 = ["checkLivenessOptions"];
45017
45540
  var EMPTY_ID_CAPTURE = {};
45018
45541
  var EMPTY_FACE_CAPTURE = {};
@@ -45045,11 +45568,11 @@ function CustomerIdAndBiometricsEnrollmentFlow(_ref) {
45045
45568
  _ref$videoIdCapture = _ref.videoIdCapture,
45046
45569
  videoIdCapture = _ref$videoIdCapture === void 0 ? EMPTY_VIDEO_ID_CAPTURE : _ref$videoIdCapture,
45047
45570
  _ref$idView = _ref.idView,
45048
- idView = _ref$idView === void 0 ? EMPTY_ID_VIEW : _ref$idView,
45571
+ idViewProp = _ref$idView === void 0 ? EMPTY_ID_VIEW : _ref$idView,
45049
45572
  _ref$faceView = _ref.faceView,
45050
- faceView = _ref$faceView === void 0 ? EMPTY_FACE_VIEW : _ref$faceView,
45051
- signatureView = _ref.signatureView,
45052
- videoIdView = _ref.videoIdView,
45573
+ faceViewProp = _ref$faceView === void 0 ? EMPTY_FACE_VIEW : _ref$faceView,
45574
+ signatureViewProp = _ref.signatureView,
45575
+ videoIdViewProp = _ref.videoIdView,
45053
45576
  captureSignature = _ref.captureSignature,
45054
45577
  captureSignatureVideo = _ref.captureSignatureVideo,
45055
45578
  _ref$captureVideoId = _ref.captureVideoId,
@@ -45059,8 +45582,11 @@ function CustomerIdAndBiometricsEnrollmentFlow(_ref) {
45059
45582
  initialArtifacts = _ref$initialArtifacts === void 0 ? EMPTY_ARTIFACTS$2 : _ref$initialArtifacts,
45060
45583
  theme = _ref.theme,
45061
45584
  className = _ref.className,
45062
- _ref$showSuccessScree = _ref.showSuccessScreen,
45063
- showSuccessScreen = _ref$showSuccessScree === void 0 ? false : _ref$showSuccessScree,
45585
+ lang = _ref.lang,
45586
+ debugMode = _ref.debugMode,
45587
+ skipSuccessScreen = _ref.skipSuccessScreen,
45588
+ showResultScreen = _ref.showResultScreen,
45589
+ showSuccessScreen = _ref.showSuccessScreen,
45064
45590
  _ref$showDiagnostics = _ref.showDiagnostics,
45065
45591
  showDiagnostics = _ref$showDiagnostics === void 0 ? false : _ref$showDiagnostics,
45066
45592
  captureAdditionalDocuments = _ref.captureAdditionalDocuments,
@@ -45072,7 +45598,31 @@ function CustomerIdAndBiometricsEnrollmentFlow(_ref) {
45072
45598
  onCaptureError = _ref.onCaptureError,
45073
45599
  children = _ref.children,
45074
45600
  callbacks = _objectWithoutPropertiesLoose(_ref, _excluded$1);
45075
- var preparing = useTranslations(undefined, PREPARING_FALLBACKS);
45601
+ // Flow-wide settings reach each step unless its own bag sets them.
45602
+ var _useMemo = React.useMemo(function () {
45603
+ var settings = {
45604
+ lang: lang,
45605
+ debugMode: debugMode,
45606
+ skipSuccessScreen: skipSuccessScreen
45607
+ };
45608
+ return {
45609
+ idView: inheritFlowSettings(idViewProp, settings),
45610
+ faceView: inheritFlowSettings(faceViewProp, settings),
45611
+ signatureView: inheritFlowSettings(signatureViewProp, {
45612
+ lang: lang,
45613
+ showCaptureDiagnostics: debugMode,
45614
+ skipSuccessScreen: skipSuccessScreen
45615
+ }),
45616
+ videoIdView: inheritFlowSettings(videoIdViewProp, {
45617
+ lang: lang,
45618
+ debugMode: debugMode
45619
+ })
45620
+ };
45621
+ }, [debugMode, faceViewProp, idViewProp, lang, signatureViewProp, skipSuccessScreen, videoIdViewProp]),
45622
+ idView = _useMemo.idView,
45623
+ faceView = _useMemo.faceView,
45624
+ signatureView = _useMemo.signatureView,
45625
+ videoIdView = _useMemo.videoIdView;
45076
45626
  var checkLivenessOptions = faceCapture.checkLivenessOptions,
45077
45627
  selfieCaptureConfig = _objectWithoutPropertiesLoose(faceCapture, _excluded2);
45078
45628
  useMountOnlyWarnings('CustomerIdAndBiometricsEnrollmentFlow', FLOW_MOUNT_ONLY_REMEDY, {
@@ -45288,26 +45838,31 @@ function CustomerIdAndBiometricsEnrollmentFlow(_ref) {
45288
45838
  submission: submission,
45289
45839
  showEnrollmentId: showDiagnostics,
45290
45840
  theme: theme,
45291
- className: className
45841
+ className: className,
45842
+ lang: lang
45292
45843
  }, callbacks, {
45293
45844
  children: [steps ? jsxRuntime.jsx(CompositeWizard, _extends({}, ringScreens, {
45294
45845
  steps: steps,
45295
45846
  initialArtifacts: initialArtifacts,
45296
- showSuccessScreen: showSuccessScreen,
45847
+ showResultScreen: showResultScreen != null ? showResultScreen : showSuccessScreen,
45297
45848
  showDiagnostics: showDiagnostics,
45298
45849
  onSubmitted: onSubmitted
45299
- })) :
45300
- // `loadingStage` is what enables the customer's `loadingSpinner`:
45301
- // without it OrbStatusScreen hard-renders the orb, so this was the one
45302
- // loading surface in the SDK that ignored a supplied component
45303
- // outright — in the flow whose double-loader prompted the fix.
45304
- jsxRuntime.jsx(OrbStatusScreen, {
45305
- state: "solving",
45306
- text: preparing.preparingText,
45307
- loadingStage: "preparing"
45308
- }), children]
45850
+ })) : jsxRuntime.jsx(PreparingScreen, {}), children]
45309
45851
  }));
45310
45852
  }
45853
+ /** Translated inside the chassis, so the flow's `lang` reaches it. */
45854
+ function PreparingScreen() {
45855
+ var preparing = useTranslations(undefined, PREPARING_FALLBACKS);
45856
+ // `loadingStage` is what enables the customer's `loadingSpinner`: without it
45857
+ // OrbStatusScreen hard-renders the orb, so this was the one loading surface
45858
+ // in the SDK that ignored a supplied component outright — in the flow whose
45859
+ // double-loader prompted the fix.
45860
+ return jsxRuntime.jsx(OrbStatusScreen, {
45861
+ state: "solving",
45862
+ text: preparing.preparingText,
45863
+ loadingStage: "preparing"
45864
+ });
45865
+ }
45311
45866
 
45312
45867
  var ALLOWED_MISMATCH_RETRIES$1 = 0;
45313
45868
  var MAX_LIVENESS_ATTEMPTS$1 = 3;
@@ -45975,6 +46530,8 @@ function CustomerMatchFlow(_ref) {
45975
46530
  view = _ref$view === void 0 ? EMPTY_VIEW : _ref$view,
45976
46531
  theme = _ref.theme,
45977
46532
  className = _ref.className,
46533
+ lang = _ref.lang,
46534
+ debugMode = _ref.debugMode,
45978
46535
  geolocationEnabled = _ref.geolocationEnabled,
45979
46536
  geolocationRequired = _ref.geolocationRequired,
45980
46537
  remoteDiagnostics = _ref.remoteDiagnostics,
@@ -45997,7 +46554,9 @@ function CustomerMatchFlow(_ref) {
45997
46554
  onComplete = _ref.onComplete,
45998
46555
  onCustomerMatched = _ref.onCustomerMatched,
45999
46556
  onCustomerNotMatched = _ref.onCustomerNotMatched,
46557
+ onSubmissionFailure = _ref.onSubmissionFailure,
46000
46558
  onRequestFailure = _ref.onRequestFailure,
46559
+ submitMode = _ref.submitMode,
46001
46560
  onCaptureGuidanceTimeout = _ref.onCaptureGuidanceTimeout,
46002
46561
  onExitCapture = _ref.onExitCapture,
46003
46562
  onExitAfterFailure = _ref.onExitAfterFailure;
@@ -46037,7 +46596,10 @@ function CustomerMatchFlow(_ref) {
46037
46596
  // Only the auto-continue half applies here: the plain SelfieCaptureView has
46038
46597
  // no capture review screen to skip (that is FaceLivenessView's), and this
46039
46598
  // flow's own terminal screens are governed by `skipSuccessScreen` below.
46040
- var resolvedView = _extends({}, view, {
46599
+ var resolvedView = _extends({}, inheritFlowSettings(view, {
46600
+ lang: lang,
46601
+ debugMode: debugMode
46602
+ }), {
46041
46603
  autoContinueAfterLoading: impliedAutoContinueAfterLoading(view.autoContinueAfterLoading, introActive)
46042
46604
  });
46043
46605
  // Reset during render, not in an effect: an auto-requesting capture stage
@@ -46081,15 +46643,19 @@ function CustomerMatchFlow(_ref) {
46081
46643
  setOutcome('notMatched');
46082
46644
  onCustomerNotMatched == null || onCustomerNotMatched(response);
46083
46645
  }, [onCustomerNotMatched]);
46646
+ var reportFailure = onSubmissionFailure != null ? onSubmissionFailure : onRequestFailure;
46084
46647
  var handleLivenessCheckFailed = React.useCallback(function (error) {
46085
46648
  setOutcome('failed');
46086
- onRequestFailure == null || onRequestFailure(error);
46087
- }, [onRequestFailure]);
46649
+ reportFailure == null || reportFailure(error);
46650
+ }, [reportFailure]);
46088
46651
  var handleRequestError = React.useCallback(function (error) {
46089
46652
  errorRef.current = error;
46090
46653
  setOutcome('error');
46091
- onRequestFailure == null || onRequestFailure(error);
46092
- }, [onRequestFailure]);
46654
+ reportFailure == null || reportFailure(error);
46655
+ }, [reportFailure]);
46656
+ var handleHandedOff = React.useCallback(function () {
46657
+ return setOutcome('handedOff');
46658
+ }, []);
46093
46659
  var handleCaptureGuidanceTimeout = React.useCallback(function () {
46094
46660
  setOutcome('failed');
46095
46661
  onCaptureGuidanceTimeout == null || onCaptureGuidanceTimeout();
@@ -46130,8 +46696,10 @@ function CustomerMatchFlow(_ref) {
46130
46696
  client: client,
46131
46697
  action: action,
46132
46698
  submission: submission,
46699
+ submitMode: submitMode,
46133
46700
  theme: theme,
46134
46701
  className: className,
46702
+ lang: lang,
46135
46703
  geolocationEnabled: geolocationEnabled,
46136
46704
  geolocationRequired: geolocationRequired,
46137
46705
  remoteDiagnostics: remoteDiagnostics,
@@ -46153,6 +46721,7 @@ function CustomerMatchFlow(_ref) {
46153
46721
  onNotMatched: handleNotMatched,
46154
46722
  onLivenessCheckFailed: handleLivenessCheckFailed,
46155
46723
  onRequestError: handleRequestError,
46724
+ onSubmissionIntercepted: handleHandedOff,
46156
46725
  onCaptureGuidanceTimeout: handleCaptureGuidanceTimeout,
46157
46726
  onExitCapture: onExitCapture,
46158
46727
  finishingScreen: {
@@ -46288,6 +46857,84 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
46288
46857
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
46289
46858
  };
46290
46859
 
46860
+ function createIdAndFaceValidationJourneyEvent(event, now) {
46861
+ if (now === void 0) {
46862
+ now = function now() {
46863
+ return new Date();
46864
+ };
46865
+ }
46866
+ return _assign(_assign({}, event), {
46867
+ version: 1,
46868
+ flow: 'id-and-face-validation',
46869
+ timestamp: now().toISOString()
46870
+ });
46871
+ }
46872
+ /**
46873
+ * websdk-ui `CompositeWizardStep.id` -> journey stage.
46874
+ *
46875
+ * Four of the five stage names ARE step ids already; only the additional-
46876
+ * documents step differs, because sdk2's stage vocabulary says
46877
+ * `additional-document-capture` (singular "document") while websdk-ui's step
46878
+ * is `additional-documents`. Unknown ids return undefined so a step this
46879
+ * vocabulary has no name for is silently skipped rather than emitted with a
46880
+ * bogus stage — the same shape as sdk2's partial lookup record.
46881
+ */
46882
+ function journeyStageForStepId(stepId) {
46883
+ switch (stepId) {
46884
+ case 'id-capture':
46885
+ case 'face-liveness':
46886
+ case 'signature-capture':
46887
+ case 'video-signature-capture':
46888
+ return stepId;
46889
+ case 'additional-documents':
46890
+ return 'additional-document-capture';
46891
+ default:
46892
+ return undefined;
46893
+ }
46894
+ }
46895
+ /**
46896
+ * The document types sdk2 reports as `document.captured`. sdk2 filters the
46897
+ * wizard's `onDocumentStored` through this set (`primaryIdDocumentTypes`) so
46898
+ * that a document type outside the journey vocabulary cannot widen the event.
46899
+ * Kept as a predicate rather than a Set: the ES5 UMD bundle target makes
46900
+ * `for..of` over a Set a downlevel hazard, and a switch needs no iteration.
46901
+ */
46902
+ function isJourneyDocumentType(documentType) {
46903
+ return documentType === 'idCardFront' || documentType === 'idCardBack' || documentType === 'passport' || documentType === 'singlePage';
46904
+ }
46905
+ /**
46906
+ * The lazy `flow.started` rule, lifted out of sdk2's `emitJourneyEvent`
46907
+ * closure (IdAndFaceValidation.tsx:521-537) so it can be tested without a
46908
+ * React tree.
46909
+ *
46910
+ * sdk2 does NOT simply emit `flow.started` from a mount effect: it emits it
46911
+ * before the FIRST event of any kind, whatever that event is, and then
46912
+ * suppresses the explicit mount emit. The mount effect and the lazy guard
46913
+ * together mean `flow.started` is always the first event a customer sees,
46914
+ * even if some other event races the effect. That ordering guarantee is the
46915
+ * contract, not the effect.
46916
+ */
46917
+ function createJourneyEmitter(callback, now) {
46918
+ var flowStartedEmitted = false;
46919
+ return function emit(event) {
46920
+ if (!callback) return;
46921
+ if (!flowStartedEmitted) {
46922
+ flowStartedEmitted = true;
46923
+ emitWith(callback, {
46924
+ name: 'flow.started'
46925
+ }, now);
46926
+ }
46927
+ if (event.name !== 'flow.started') emitWith(callback, event, now);
46928
+ };
46929
+ }
46930
+ function emitWith(callback, event, now) {
46931
+ try {
46932
+ callback(createIdAndFaceValidationJourneyEvent(event, now));
46933
+ } catch (error) {
46934
+ warn$1('[IdAndFaceValidation] onJourneyEvent callback failed', error);
46935
+ }
46936
+ }
46937
+
46291
46938
  /**
46292
46939
  * sdk2 exports this as a mutable `string[]`
46293
46940
  * (contexts/AuthStateContext.tsx:25), not a readonly tuple — copied rather
@@ -46460,12 +47107,9 @@ function mapClientConfig(props) {
46460
47107
  documentServiceUrl: (_b = props.documentServiceUrl) !== null && _b !== void 0 ? _b : apiBase ? apiBase + '/files/' : override === null || override === void 0 ? void 0 : override.documentServiceUrl,
46461
47108
  onBeforeSubmit: props.onBeforeSubmit,
46462
47109
  onBeforeLivenessCheck: props.onBeforeLivenessCheck,
46463
- // Straight through to the client, which is where sdk2 put it too
46464
- // (SubmissionProvider.submit). That is what makes the SUPPRESSION uniform:
46465
- // every flow — including the two match flows, which own their own stage
46466
- // machine — submits through this one client, so none of them can post
46467
- // behind an integrator who supplied `onSubmit`.
46468
- onSubmit: props.onSubmit,
47110
+ // 2.x's `onSubmit` is not a client option here: each flow maps it to its
47111
+ // own `submitMode: { handoff }` (see ./props.ts), which follows the prop
47112
+ // live where a client option would be fixed at mount.
46469
47113
  onBeforeDocumentUpload: props.onBeforeDocumentUpload,
46470
47114
  onDocumentUploadProgress: props.onDocumentUploadProgress,
46471
47115
  onDocumentUploaded: props.onDocumentUploaded,
@@ -47475,84 +48119,6 @@ function mapFaceCapture(props, prefixed) {
47475
48119
  };
47476
48120
  }
47477
48121
 
47478
- function createIdAndFaceValidationJourneyEvent(event, now) {
47479
- if (now === void 0) {
47480
- now = function now() {
47481
- return new Date();
47482
- };
47483
- }
47484
- return _assign(_assign({}, event), {
47485
- version: 1,
47486
- flow: 'id-and-face-validation',
47487
- timestamp: now().toISOString()
47488
- });
47489
- }
47490
- /**
47491
- * websdk-ui `CompositeWizardStep.id` -> journey stage.
47492
- *
47493
- * Four of the five stage names ARE step ids already; only the additional-
47494
- * documents step differs, because sdk2's stage vocabulary says
47495
- * `additional-document-capture` (singular "document") while websdk-ui's step
47496
- * is `additional-documents`. Unknown ids return undefined so a step this
47497
- * vocabulary has no name for is silently skipped rather than emitted with a
47498
- * bogus stage — the same shape as sdk2's partial lookup record.
47499
- */
47500
- function journeyStageForStepId(stepId) {
47501
- switch (stepId) {
47502
- case 'id-capture':
47503
- case 'face-liveness':
47504
- case 'signature-capture':
47505
- case 'video-signature-capture':
47506
- return stepId;
47507
- case 'additional-documents':
47508
- return 'additional-document-capture';
47509
- default:
47510
- return undefined;
47511
- }
47512
- }
47513
- /**
47514
- * The document types sdk2 reports as `document.captured`. sdk2 filters the
47515
- * wizard's `onDocumentStored` through this set (`primaryIdDocumentTypes`) so
47516
- * that a document type outside the journey vocabulary cannot widen the event.
47517
- * Kept as a predicate rather than a Set: the ES5 UMD bundle target makes
47518
- * `for..of` over a Set a downlevel hazard, and a switch needs no iteration.
47519
- */
47520
- function isJourneyDocumentType(documentType) {
47521
- return documentType === 'idCardFront' || documentType === 'idCardBack' || documentType === 'passport' || documentType === 'singlePage';
47522
- }
47523
- /**
47524
- * The lazy `flow.started` rule, lifted out of sdk2's `emitJourneyEvent`
47525
- * closure (IdAndFaceValidation.tsx:521-537) so it can be tested without a
47526
- * React tree.
47527
- *
47528
- * sdk2 does NOT simply emit `flow.started` from a mount effect: it emits it
47529
- * before the FIRST event of any kind, whatever that event is, and then
47530
- * suppresses the explicit mount emit. The mount effect and the lazy guard
47531
- * together mean `flow.started` is always the first event a customer sees,
47532
- * even if some other event races the effect. That ordering guarantee is the
47533
- * contract, not the effect.
47534
- */
47535
- function createJourneyEmitter(callback, now) {
47536
- var flowStartedEmitted = false;
47537
- return function emit(event) {
47538
- if (!callback) return;
47539
- if (!flowStartedEmitted) {
47540
- flowStartedEmitted = true;
47541
- emitWith(callback, {
47542
- name: 'flow.started'
47543
- }, now);
47544
- }
47545
- if (event.name !== 'flow.started') emitWith(callback, event, now);
47546
- };
47547
- }
47548
- function emitWith(callback, event, now) {
47549
- try {
47550
- callback(createIdAndFaceValidationJourneyEvent(event, now));
47551
- } catch (error) {
47552
- warn$1('[IdAndFaceValidation] onJourneyEvent callback failed', error);
47553
- }
47554
- }
47555
-
47556
48122
  /**
47557
48123
  * Recursively drops keys whose value is exactly `undefined`.
47558
48124
  *
@@ -47735,6 +48301,16 @@ function mapThemeWithColors(theme, colors) {
47735
48301
  return mergeThemes(mapped, overrides);
47736
48302
  }
47737
48303
 
48304
+ /**
48305
+ * 2.x's `onSubmit` as the flow's hand-off. sdk2 read it on every submission,
48306
+ * so this maps on every render: adding or removing it takes effect from the
48307
+ * next submission. Without it the flow posts.
48308
+ */
48309
+ function mapHandoff(onSubmit) {
48310
+ return onSubmit ? {
48311
+ handoff: onSubmit
48312
+ } : undefined;
48313
+ }
47738
48314
  var EMPTY_CONTEXT = {};
47739
48315
  /** Adapts a 3.0 `(response)` callback back to 2.x's `(response, request)`. */
47740
48316
  function withSubmissionRequest(callback, ctx) {
@@ -47826,13 +48402,13 @@ function mapAdditionalDocumentVerbiage(verbiage) {
47826
48402
  }
47827
48403
  // --- 1. IdValidation ------------------------------------------------------
47828
48404
  function mapIdValidationProps(props, ctx) {
47829
- var _a;
48405
+ var _a, _b;
47830
48406
  if (ctx === void 0) {
47831
48407
  ctx = EMPTY_CONTEXT;
47832
48408
  }
47833
- var _b = mapIdCapture(props),
47834
- capture = _b.capture,
47835
- view = _b.view;
48409
+ var _c = mapIdCapture(props),
48410
+ capture = _c.capture,
48411
+ view = _c.view;
47836
48412
  return compact({
47837
48413
  capture: capture,
47838
48414
  view: view,
@@ -47858,9 +48434,8 @@ function mapIdValidationProps(props, ctx) {
47858
48434
  // `onSubmit` WINS over capture-only, matching sdk2's ordering: its
47859
48435
  // `submit()` checks `onSubmit` before the `action === NONE` branch
47860
48436
  // (SubmissionProvider.tsx:1374 vs :1237), so a capture-only flow still
47861
- // owes the callback its built request. Letting the flow run its normal
47862
- // submit path is what builds that request; the client suppresses the POST.
47863
- captureOnly: props.onSubmit ? undefined : props.captureOnly,
48437
+ // owes the callback its built request.
48438
+ submitMode: (_b = mapHandoff(props.onSubmit)) !== null && _b !== void 0 ? _b : props.captureOnly ? 'capture' : undefined,
47864
48439
  captureAdditionalDocuments: props.captureAdditionalDocuments,
47865
48440
  geolocationEnabled: props.geolocationEnabled,
47866
48441
  geolocationRequired: props.geolocationRequired,
@@ -47871,7 +48446,7 @@ function mapIdValidationProps(props, ctx) {
47871
48446
  // post-submission diagnostics page on this one flag
47872
48447
  // (CompositeWizard.tsx:381, `if (debugMode) return <SubmissionSuccess />`);
47873
48448
  // here the capture-surface overlays live on `view.debugMode` (mapIdCapture)
47874
- // while the terminal page needs `showSuccessScreen` to render at all and
48449
+ // while the terminal page needs `showResultScreen` to render at all and
47875
48450
  // `showDiagnostics` to include the request/response bodies. Mapping only
47876
48451
  // the first left `debugMode` customers on a blank screen after submitting,
47877
48452
  // because CompositeWizard falls through to `return null`.
@@ -47879,15 +48454,12 @@ function mapIdValidationProps(props, ctx) {
47879
48454
  // Both take the same flag: sdk2's page showed the response body (behind a
47880
48455
  // toggle) whenever debugMode was on, so gating diagnostics separately here
47881
48456
  // would be a NEW restriction, not parity.
47882
- showSuccessScreen: props.debugMode,
48457
+ showResultScreen: props.debugMode,
47883
48458
  showDiagnostics: props.debugMode,
47884
- // `onSubmit` is NOT mapped to a flow prop: it goes to the client config
47885
- // (see mapClientConfig), which is the layer sdk2 put it at and the only
47886
- // one that can suppress the POST for every flow at once.
47887
48459
  onComplete: withSubmissionRequest(props.onComplete, ctx),
47888
48460
  onApproved: withSubmissionRequest(props.onApproved, ctx),
47889
48461
  onDenied: withSubmissionRequest(props.onDenied, ctx),
47890
- onRequestFailure: props.onRequestFailure
48462
+ onSubmissionFailure: props.onRequestFailure
47891
48463
  });
47892
48464
  }
47893
48465
  // --- 2. FaceValidation ----------------------------------------------------
@@ -48060,7 +48632,7 @@ function mapIdAndFaceValidationProps(props, ctx) {
48060
48632
  remoteDiagnostics: props.remoteDiagnostics,
48061
48633
  loadingSpinner: props.loadingSpinner,
48062
48634
  // See mapIdValidationProps for why `debugMode` feeds both.
48063
- showSuccessScreen: props.debugMode,
48635
+ showResultScreen: props.debugMode,
48064
48636
  showDiagnostics: props.debugMode,
48065
48637
  onStepStarted: emit ? function (stepId) {
48066
48638
  var stage = journeyStageForStepId(stepId);
@@ -48079,7 +48651,8 @@ function mapIdAndFaceValidationProps(props, ctx) {
48079
48651
  onComplete: withSubmissionRequest(props.onComplete, ctx),
48080
48652
  onApproved: withSubmissionRequest(props.onApproved, ctx),
48081
48653
  onDenied: withSubmissionRequest(props.onDenied, ctx),
48082
- onRequestFailure: props.onRequestFailure,
48654
+ submitMode: mapHandoff(props.onSubmit),
48655
+ onSubmissionFailure: props.onRequestFailure,
48083
48656
  onCaptureError: props.onRequestFailure
48084
48657
  });
48085
48658
  }
@@ -48182,7 +48755,7 @@ function mapSignatureKYCProps(props, ctx) {
48182
48755
  // both the boolean and async callback forms at the flow-level seam.
48183
48756
  //
48184
48757
  // `debugMode` forces it back on, completing the fold mapIdValidationProps
48185
- // does with `showSuccessScreen`/`showDiagnostics`: the capture readout
48758
+ // does with `showResultScreen`/`showDiagnostics`: the capture readout
48186
48759
  // renders INSIDE the review, so a consumer who skips the review and turns
48187
48760
  // debugMode on would otherwise get the switch with nowhere for it to show
48188
48761
  // — silently, in the one configuration it exists for.
@@ -48234,10 +48807,11 @@ function mapSignatureKYCProps(props, ctx) {
48234
48807
  captureProgress: props.captureProgress,
48235
48808
  remoteDiagnostics: props.remoteDiagnostics,
48236
48809
  loadingSpinner: props.loadingSpinner,
48237
- // `onCaptured` is supplied by the COMPONENT, not here: this flow never
48238
- // enters `client.submit()` on its own, so the façade makes that call from
48239
- // `onCaptured` to produce the same built request 2.x hands over. See
48240
- // components/flows.tsx.
48810
+ // 2.x builds this flow's request and hands it to `onSubmit`
48811
+ // (SubmissionProvider.tsx:1374, ahead of its NONE branch). Unset, the
48812
+ // flow captures and posts nothing, as 2.x's NONE did. A failed hand-off
48813
+ // is not reported to `onRequestFailure`, which 2.x never did either.
48814
+ submitMode: mapHandoff(props.onSubmit),
48241
48815
  onCaptureError: props.onRequestFailure
48242
48816
  });
48243
48817
  }
@@ -48263,7 +48837,7 @@ function nestedLayer(nested, map) {
48263
48837
  return map(nested);
48264
48838
  }
48265
48839
  function mapVideoIdValidationProps(props, ctx) {
48266
- var _a, _b, _c;
48840
+ var _a, _b, _c, _d;
48267
48841
  if (ctx === void 0) {
48268
48842
  ctx = EMPTY_CONTEXT;
48269
48843
  }
@@ -48353,10 +48927,14 @@ function mapVideoIdValidationProps(props, ctx) {
48353
48927
  remoteDiagnostics: props.remoteDiagnostics,
48354
48928
  loadingSpinner: props.loadingSpinner,
48355
48929
  // See mapIdValidationProps for why `debugMode` feeds both.
48356
- showSuccessScreen: props.debugMode,
48930
+ showResultScreen: props.debugMode,
48357
48931
  showDiagnostics: props.debugMode,
48358
48932
  onComplete: withSubmissionRequest(props.onComplete, ctx),
48359
- onRequestFailure: props.onRequestFailure,
48933
+ // No ID captured and none supplied resolves the action to NONE, which
48934
+ // has nothing to post. 2.x answered with a synthetic success and no
48935
+ // request; capture mode is that without the fabricated response.
48936
+ submitMode: (_d = mapHandoff(props.onSubmit)) !== null && _d !== void 0 ? _d : props.skipIdCapture && !props.idCardForFaceMatch ? 'capture' : undefined,
48937
+ onSubmissionFailure: props.onRequestFailure,
48360
48938
  onCaptureError: props.onRequestFailure
48361
48939
  });
48362
48940
  }
@@ -48521,7 +49099,8 @@ function mapCustomerMatchProps(props, ctx) {
48521
49099
  onComplete: withSubmissionRequest(props.onComplete, ctx),
48522
49100
  onCustomerMatched: withSubmissionRequest(props.onCustomerMatched, ctx),
48523
49101
  onCustomerNotMatched: withSubmissionRequest(props.onCustomerNotMatched, ctx),
48524
- onRequestFailure: props.onRequestFailure,
49102
+ submitMode: mapHandoff(props.onSubmit),
49103
+ onSubmissionFailure: props.onRequestFailure,
48525
49104
  onExitCapture: props.onExitCapture,
48526
49105
  onExitAfterFailure: props.onExitAfterFailure
48527
49106
  });
@@ -48584,13 +49163,14 @@ function mapCustomerBiometricsEnrollmentProps(props, ctx) {
48584
49163
  remoteDiagnostics: props.remoteDiagnostics,
48585
49164
  loadingSpinner: props.loadingSpinner,
48586
49165
  // See mapIdValidationProps for why `debugMode` feeds both.
48587
- showSuccessScreen: props.debugMode,
49166
+ showResultScreen: props.debugMode,
48588
49167
  showDiagnostics: props.debugMode,
48589
49168
  onComplete: withSubmissionRequest(props.onComplete, ctx),
48590
49169
  // sdk2's enrollment twin of `onApproved`.
48591
49170
  onApproved: withSubmissionRequest(props.onEnrolled, ctx),
48592
49171
  onDenied: withSubmissionRequest(props.onDenied, ctx),
48593
- onRequestFailure: props.onRequestFailure,
49172
+ submitMode: mapHandoff(props.onSubmit),
49173
+ onSubmissionFailure: props.onRequestFailure,
48594
49174
  onCaptureError: props.onRequestFailure
48595
49175
  });
48596
49176
  }
@@ -48677,17 +49257,18 @@ function mapCustomerIdAndBiometricsEnrollmentProps(props, ctx) {
48677
49257
  remoteDiagnostics: props.remoteDiagnostics,
48678
49258
  loadingSpinner: props.loadingSpinner,
48679
49259
  // See mapIdValidationProps for why `debugMode` feeds both.
48680
- showSuccessScreen: props.debugMode,
49260
+ showResultScreen: props.debugMode,
48681
49261
  showDiagnostics: props.debugMode,
48682
49262
  onComplete: withSubmissionRequest(props.onComplete, ctx),
48683
49263
  onApproved: withSubmissionRequest(props.onEnrolled, ctx),
48684
49264
  onDenied: withSubmissionRequest(props.onDenied, ctx),
48685
- onRequestFailure: props.onRequestFailure,
49265
+ submitMode: mapHandoff(props.onSubmit),
49266
+ onSubmissionFailure: props.onRequestFailure,
48686
49267
  onCaptureError: props.onRequestFailure
48687
49268
  });
48688
49269
  }
48689
49270
 
48690
- var webSdkVersion = '2.6.3-changeset-release-develop-eac763c';
49271
+ var webSdkVersion = '2.6.3-changeset-release-develop-776f131';
48691
49272
 
48692
49273
  // GENERATED by scripts/styleBagTypes.mjs from
48693
49274
  // src/__fixtures__/sdk2StyleBags.json and the mapper sweep — do not
@@ -50744,23 +51325,17 @@ var STYLE_WITH_ASSETS = {
50744
51325
  var SUBMIT_CALLBACKS = {
50745
51326
  onBeforeSubmit: MAPPED,
50746
51327
  /**
50747
- * Mapped to the CLIENT's `onSubmit`, not to a flow prop — the layer sdk2 put
50748
- * it at (SubmissionProvider.submit). The client builds the request, hands it
50749
- * over, and does NOT post, so `onComplete`/`onApproved`/`onDenied` never
50750
- * fire, exactly as 2.x documents. Every flow submits through that one
50751
- * client, including the two match flows with their own stage machine, so the
50752
- * suppression is uniform.
51328
+ * Mapped to the flow's `submitMode: { handoff }`. The flow builds the
51329
+ * request, hands it over, and does NOT post, so `onComplete`/`onApproved`/
51330
+ * `onDenied` never fire, exactly as 2.x documents. Mapped on every render,
51331
+ * so adding or removing it takes effect from the next submission, as sdk2's
51332
+ * ref-held `onSubmit` did.
50753
51333
  *
50754
51334
  * What the flow SHOWS afterwards is a 3.0 call rather than a 2.x
50755
51335
  * reproduction: every family now ends quietly, because the integrator owns
50756
51336
  * the outcome once they have the request. 2.x's match flows showed a failure
50757
51337
  * screen there, but only because their `submit()` could not distinguish an
50758
51338
  * intercepted submission from a broken one.
50759
- *
50760
- * `SignatureKYC` reaches the same place by a different route: its 3.0
50761
- * counterpart never enters `client.submit()`, so the façade component makes
50762
- * that call itself from `onCaptured`. `action: NONE` is accepted there
50763
- * precisely because `onSubmit` is bound.
50764
51339
  */
50765
51340
  onSubmit: MAPPED,
50766
51341
  onComplete: MAPPED,
@@ -50858,7 +51433,7 @@ var SignatureKYC$1 = _assign(_assign(_assign(_assign(_assign(_assign(_assign(_as
50858
51433
  // `SubmissionAction.NONE` and wires `onComplete` to the provider's
50859
51434
  // `onResponseReceived` (SignatureKYC.tsx:434,449), which never fires because
50860
51435
  // nothing is ever posted. `onSubmit` is the real completion seam and IS
50861
- // mapped, to the flow's `onCaptured`.
51436
+ // mapped, to the flow's `submitMode: { handoff }`.
50862
51437
  onComplete: NOOP,
50863
51438
  onSubmit: MAPPED,
50864
51439
  onRequestFailure: MAPPED,
@@ -51349,10 +51924,6 @@ function useCompatClient(props) {
51349
51924
  _lastLivenessRequest.current = request;
51350
51925
  return propsRef.current.onBeforeLivenessCheck ? propsRef.current.onBeforeLivenessCheck(request) : Promise.resolve(request);
51351
51926
  },
51352
- onSubmit: propsRef.current.onSubmit ? function (request) {
51353
- var _a, _b;
51354
- return (_b = (_a = propsRef.current).onSubmit) === null || _b === void 0 ? void 0 : _b.call(_a, request);
51355
- } : undefined,
51356
51927
  onResponseReceived: function onResponseReceived(_response, request) {
51357
51928
  _lastSubmissionRequest.current = request;
51358
51929
  },
@@ -51523,34 +52094,12 @@ var SignatureKYC = function SignatureKYC(props) {
51523
52094
  client = _a.client,
51524
52095
  ctx = _a.ctx;
51525
52096
  useDroppedPropReport('SignatureKYC', props);
51526
- // The one flow whose 3.0 counterpart never enters `client.submit()`: it runs
51527
- // its own stage machine and reports completion through `onCaptured` instead.
51528
- // 2.x DOES submit here — its CompositeWizard calls `submit()`, which hands
51529
- // the built request to `onSubmit` before reaching the capture-only branch —
51530
- // so the façade makes that call itself to produce the same request. The
51531
- // client suppresses the POST, and `action: NONE` is accepted precisely
51532
- // because `onSubmit` is bound.
51533
- //
51534
- // Only when bound: without `onSubmit` the client rejects NONE by design, and
51535
- // this flow has nothing to submit anyway.
51536
- var onSubmit = props.onSubmit;
51537
- var submission = mapSubmission(props);
51538
- var handOff = onSubmit ? function (artifacts) {
51539
- void client.submit(artifacts, _assign(_assign({}, submission), {
51540
- action: SubmissionAction.NONE
51541
- }))["catch"](function () {
51542
- // The failure already reached `onRequestFailure` through the
51543
- // client's own hook, which is where 2.x reported it too.
51544
- });
51545
- } : undefined;
51546
52097
  // No `children`: SignatureKYCFlow omits it from its props (it runs its own
51547
52098
  // stage machine rather than CompositeWizard), so passing it would not
51548
52099
  // compile — and 2.x rendered it nowhere either.
51549
52100
  return /*#__PURE__*/React__default.default.createElement(SignatureKYCFlow, _assign({
51550
52101
  client: client
51551
- }, mapSignatureKYCProps(props, ctx), {
51552
- onCaptured: handOff
51553
- }));
52102
+ }, mapSignatureKYCProps(props, ctx)));
51554
52103
  };
51555
52104
  /**
51556
52105
  * Render a fullscreen capture component that performs ID and face validation,