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