idmission-web-sdk 1.0.11 → 1.0.13
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/components/fallback_flows/IdCapture.d.ts +24 -0
- package/dist/components/id_capture/IdCaptureModelsProvider.d.ts +2 -0
- package/dist/sdk2.cjs.development.js +194 -84
- 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 +194 -84
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +194 -84
- 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/dist/stories/FallbackFlows/IdCapture.stories.d.ts +8 -0
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/sdk2.esm.js
CHANGED
|
@@ -14,7 +14,7 @@ import { FaceDetector, FilesetResolver } from '@mediapipe/tasks-vision';
|
|
|
14
14
|
import SignatureCanvas from 'react-signature-canvas';
|
|
15
15
|
import ReactDOM, { createPortal } from 'react-dom';
|
|
16
16
|
|
|
17
|
-
var webSdkVersion = '1.0.
|
|
17
|
+
var webSdkVersion = '1.0.13';
|
|
18
18
|
|
|
19
19
|
function getPlatform() {
|
|
20
20
|
return window.platform;
|
|
@@ -677,7 +677,7 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
677
677
|
e_1 = _c.sent();
|
|
678
678
|
err = e_1;
|
|
679
679
|
setSubmissionStatus(SubmissionStatus.FAILED);
|
|
680
|
-
setSubmissionError(e_1 instanceof SubmissionError || e_1 instanceof NetworkError ? e_1 : new SubmissionError({
|
|
680
|
+
setSubmissionError(e_1 instanceof SubmissionError || e_1 instanceof NetworkError ? e_1 : err.message === 'Load failed' ? new NetworkError() : new SubmissionError({
|
|
681
681
|
statusCode: '',
|
|
682
682
|
statusMessage: err.message
|
|
683
683
|
}));
|
|
@@ -8333,33 +8333,17 @@ function cropToBoundingBox(frame, bbox) {
|
|
|
8333
8333
|
return canvas;
|
|
8334
8334
|
}
|
|
8335
8335
|
|
|
8336
|
-
var ModelLoadingErrorOverlay = function ModelLoadingErrorOverlay(_a) {
|
|
8337
|
-
var error = _a.error;
|
|
8338
|
-
return /*#__PURE__*/React__default.createElement(OverlayContainer, null, /*#__PURE__*/React__default.createElement(OverlayInner, {
|
|
8339
|
-
style: {
|
|
8340
|
-
justifyContent: 'center'
|
|
8341
|
-
}
|
|
8342
|
-
}, /*#__PURE__*/React__default.createElement("h3", {
|
|
8343
|
-
style: {
|
|
8344
|
-
marginBottom: 8
|
|
8345
|
-
}
|
|
8346
|
-
}, "We're sorry, an unexpected error has occurred."), /*#__PURE__*/React__default.createElement("p", {
|
|
8347
|
-
style: {
|
|
8348
|
-
marginBottom: 0
|
|
8349
|
-
}
|
|
8350
|
-
}, /*#__PURE__*/React__default.createElement("code", null, error.message))));
|
|
8351
|
-
};
|
|
8352
|
-
|
|
8353
8336
|
var PREDICTION_POSITIONS = {
|
|
8354
|
-
boxes:
|
|
8355
|
-
scores:
|
|
8356
|
-
labels:
|
|
8337
|
+
boxes: 0,
|
|
8338
|
+
scores: 7,
|
|
8339
|
+
labels: 4
|
|
8357
8340
|
};
|
|
8358
8341
|
var IdCaptureModelsContext = /*#__PURE__*/createContext({
|
|
8359
8342
|
ready: false,
|
|
8360
8343
|
working: {
|
|
8361
8344
|
current: false
|
|
8362
8345
|
},
|
|
8346
|
+
error: null,
|
|
8363
8347
|
thresholds: {},
|
|
8364
8348
|
setThresholds: function setThresholds() {
|
|
8365
8349
|
return null;
|
|
@@ -8379,7 +8363,7 @@ var IdCaptureModelsContext = /*#__PURE__*/createContext({
|
|
|
8379
8363
|
return null;
|
|
8380
8364
|
}
|
|
8381
8365
|
});
|
|
8382
|
-
var defaultDocumentDetectionModelUrl = "".concat(DEFAULT_CDN_URL, "/models/
|
|
8366
|
+
var defaultDocumentDetectionModelUrl = "".concat(DEFAULT_CDN_URL, "/models/documentdetection448/model.json");
|
|
8383
8367
|
var defaultFocusModelUrl = "".concat(DEFAULT_CDN_URL, "/models/focus/model.json");
|
|
8384
8368
|
var IdCaptureModelsProvider = function IdCaptureModelsProvider(_a) {
|
|
8385
8369
|
var children = _a.children,
|
|
@@ -8466,13 +8450,11 @@ var IdCaptureModelsProvider = function IdCaptureModelsProvider(_a) {
|
|
|
8466
8450
|
});
|
|
8467
8451
|
});
|
|
8468
8452
|
}
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
});
|
|
8473
|
-
} catch (e) {
|
|
8453
|
+
loadModels().then(function () {
|
|
8454
|
+
setReady(true);
|
|
8455
|
+
})["catch"](function (e) {
|
|
8474
8456
|
setLoadingError(e);
|
|
8475
|
-
}
|
|
8457
|
+
});
|
|
8476
8458
|
var webGLCanvas = getWebGLContext(2).canvas;
|
|
8477
8459
|
webGLCanvas.addEventListener('webglcontextlost', reloadModels);
|
|
8478
8460
|
return function () {
|
|
@@ -8496,6 +8478,9 @@ var IdCaptureModelsProvider = function IdCaptureModelsProvider(_a) {
|
|
|
8496
8478
|
if (thresholds.pdf417) setPdf417DetectionThreshold(thresholds.pdf417);
|
|
8497
8479
|
if (thresholds.focus) setFocusThreshold(thresholds.focus);
|
|
8498
8480
|
}, []);
|
|
8481
|
+
var _m = useState(0),
|
|
8482
|
+
timesAllZero = _m[0],
|
|
8483
|
+
setTimesAllZero = _m[1];
|
|
8499
8484
|
var bestPredictionCanvas = useRef(null);
|
|
8500
8485
|
var bestFocusScore = useRef(0);
|
|
8501
8486
|
var makePrediction = useCallback(function (frame) {
|
|
@@ -8517,6 +8502,9 @@ var IdCaptureModelsProvider = function IdCaptureModelsProvider(_a) {
|
|
|
8517
8502
|
bestFocusScore.current = prediction.focusScore;
|
|
8518
8503
|
drawToCanvas(bestPredictionCanvas.current, frame);
|
|
8519
8504
|
}
|
|
8505
|
+
if (prediction.allZero) setTimesAllZero(function (n) {
|
|
8506
|
+
return n + 1;
|
|
8507
|
+
});
|
|
8520
8508
|
(_a = onPredictionHandler.current) === null || _a === void 0 ? void 0 : _a.call(onPredictionHandler, prediction);
|
|
8521
8509
|
working.current = false;
|
|
8522
8510
|
return [2];
|
|
@@ -8525,6 +8513,11 @@ var IdCaptureModelsProvider = function IdCaptureModelsProvider(_a) {
|
|
|
8525
8513
|
});
|
|
8526
8514
|
})();
|
|
8527
8515
|
}, [logPredictions, thresholds]);
|
|
8516
|
+
useEffect(function () {
|
|
8517
|
+
if (timesAllZero >= 2) {
|
|
8518
|
+
setLoadingError(new Error('model is returning all zeroes'));
|
|
8519
|
+
}
|
|
8520
|
+
}, [timesAllZero]);
|
|
8528
8521
|
var onPredictionMade = useCallback(function (handler) {
|
|
8529
8522
|
onPredictionHandler.current = handler;
|
|
8530
8523
|
}, []);
|
|
@@ -8561,14 +8554,13 @@ var IdCaptureModelsProvider = function IdCaptureModelsProvider(_a) {
|
|
|
8561
8554
|
detectionTime: detectionTime,
|
|
8562
8555
|
focusPredictionTime: focusPredictionTime,
|
|
8563
8556
|
getBestFrame: getBestFrame,
|
|
8564
|
-
resetBestFrame: resetBestFrame
|
|
8557
|
+
resetBestFrame: resetBestFrame,
|
|
8558
|
+
error: loadingError
|
|
8565
8559
|
};
|
|
8566
|
-
}, [detectionTime, focusPredictionTime, getBestFrame, makePrediction, onPredictionMade, ready, resetBestFrame, setThresholds, thresholds]);
|
|
8560
|
+
}, [detectionTime, focusPredictionTime, getBestFrame, loadingError, makePrediction, onPredictionMade, ready, resetBestFrame, setThresholds, thresholds]);
|
|
8567
8561
|
return /*#__PURE__*/React__default.createElement(IdCaptureModelsContext.Provider, {
|
|
8568
8562
|
value: value
|
|
8569
|
-
},
|
|
8570
|
-
error: loadingError
|
|
8571
|
-
}) : children, /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
|
|
8563
|
+
}, children, /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
|
|
8572
8564
|
ref: lastPredictionCanvas
|
|
8573
8565
|
}), /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
|
|
8574
8566
|
ref: bestPredictionCanvas
|
|
@@ -8580,7 +8572,7 @@ function makePredictions(frame, lastPredictionCanvas, thresholds, logPredictions
|
|
|
8580
8572
|
logPredictions = false;
|
|
8581
8573
|
}
|
|
8582
8574
|
return __awaiter(this, void 0, void 0, function () {
|
|
8583
|
-
var _l, frameWidth, frameHeight, _o, boxes, scores, labels, time, detectedObjects, bestDocument, bestPassportPage, bestDocumentScore, passportDetectionScore, passportDetectionThresholdMet, bestDocumentOrPassport, detectionScore, detectionThresholdMet, detectedDocumentType, bestMrz, mrzDetectionScore, mrzDetectionThresholdMet, bestPdf417, pdf417DetectionScore, pdf417DetectionThresholdMet, focusPrediction, focusPredictionTime, focusScore, focusThresholdMet;
|
|
8575
|
+
var _l, frameWidth, frameHeight, _o, boxes, scores, labels, time, allZero, detectedObjects, bestDocument, bestPassportPage, bestDocumentScore, passportDetectionScore, passportDetectionThresholdMet, bestDocumentOrPassport, detectionScore, detectionThresholdMet, detectedDocumentType, bestMrz, mrzDetectionScore, mrzDetectionThresholdMet, bestPdf417, pdf417DetectionScore, pdf417DetectionThresholdMet, focusPrediction, focusPredictionTime, focusScore, focusThresholdMet;
|
|
8584
8576
|
var _p;
|
|
8585
8577
|
return __generator(this, function (_q) {
|
|
8586
8578
|
switch (_q.label) {
|
|
@@ -8590,6 +8582,11 @@ function makePredictions(frame, lastPredictionCanvas, thresholds, logPredictions
|
|
|
8590
8582
|
return [4, makeDocumentDetectionPredictions(frame, logPredictions)];
|
|
8591
8583
|
case 1:
|
|
8592
8584
|
_o = _q.sent(), boxes = _o.boxes, scores = _o.scores, labels = _o.labels, time = _o.time;
|
|
8585
|
+
allZero = boxes.length > 0 && !boxes.some(function (box) {
|
|
8586
|
+
return box.some(function (n) {
|
|
8587
|
+
return n > 0;
|
|
8588
|
+
});
|
|
8589
|
+
});
|
|
8593
8590
|
detectedObjects = applyNonMaxSuppression(boxes.map(function (box, i) {
|
|
8594
8591
|
return bboxToDetectedObjectUnscaled(box, scores[i], labels[i]);
|
|
8595
8592
|
}));
|
|
@@ -8649,7 +8646,8 @@ function makePredictions(frame, lastPredictionCanvas, thresholds, logPredictions
|
|
|
8649
8646
|
focusThresholdMet: focusThresholdMet,
|
|
8650
8647
|
focusPredictionTime: focusPredictionTime,
|
|
8651
8648
|
frameWidth: frameWidth,
|
|
8652
|
-
frameHeight: frameHeight
|
|
8649
|
+
frameHeight: frameHeight,
|
|
8650
|
+
allZero: allZero
|
|
8653
8651
|
}];
|
|
8654
8652
|
}
|
|
8655
8653
|
});
|
|
@@ -8673,7 +8671,7 @@ function makeDocumentDetectionPredictions(image, logPredictions) {
|
|
|
8673
8671
|
_e.trys.push([1, 7,, 8]);
|
|
8674
8672
|
tfImg = tf.browser.fromPixels(image);
|
|
8675
8673
|
if (logPredictions) console.time('resize');
|
|
8676
|
-
tfResize = tf.image.resizeBilinear(tfImg, [
|
|
8674
|
+
tfResize = tf.image.resizeBilinear(tfImg, [448, 448]);
|
|
8677
8675
|
if (logPredictions) console.timeEnd('resize');
|
|
8678
8676
|
tfImg.dispose();
|
|
8679
8677
|
if (logPredictions) console.time('convert to int32');
|
|
@@ -8683,7 +8681,7 @@ function makeDocumentDetectionPredictions(image, logPredictions) {
|
|
|
8683
8681
|
_d = (_c = Array).from;
|
|
8684
8682
|
return [4, tfInt32.data()];
|
|
8685
8683
|
case 2:
|
|
8686
|
-
tf4d_ = _b.apply(_a, [_d.apply(_c, [_e.sent()]), [1,
|
|
8684
|
+
tf4d_ = _b.apply(_a, [_d.apply(_c, [_e.sent()]), [1, 448, 448, 3]]);
|
|
8687
8685
|
tfInt32.dispose();
|
|
8688
8686
|
tf4d = tf.cast(tf4d_, 'int32');
|
|
8689
8687
|
if (logPredictions) console.timeEnd('convert to int32');
|
|
@@ -10087,6 +10085,101 @@ function useShowSuccessScreen(skipSuccessScreen, successScreenReady, onDoneCallb
|
|
|
10087
10085
|
return !skipSuccessScreen || skipSuccessScreenResolvedFalse;
|
|
10088
10086
|
}
|
|
10089
10087
|
|
|
10088
|
+
var IdCaptureFallback = function IdCaptureFallback(_a) {
|
|
10089
|
+
var onCapture = _a.onCapture,
|
|
10090
|
+
onFinished = _a.onFinished,
|
|
10091
|
+
_b = _a.colors,
|
|
10092
|
+
colors = _b === void 0 ? {} : _b,
|
|
10093
|
+
_c = _a.verbiage,
|
|
10094
|
+
rawVerbiage = _c === void 0 ? {} : _c;
|
|
10095
|
+
var fileInput = useRef(null);
|
|
10096
|
+
var _d = useState([]),
|
|
10097
|
+
images = _d[0],
|
|
10098
|
+
setImages = _d[1];
|
|
10099
|
+
colors.captureMoreBtn || (colors.captureMoreBtn = {
|
|
10100
|
+
backgroundColor: '#666'
|
|
10101
|
+
});
|
|
10102
|
+
var verbiage = useTranslations(rawVerbiage, {
|
|
10103
|
+
headingText: "We're having some trouble.",
|
|
10104
|
+
descriptionText: 'On-device capture guidance failed, please capture photos of your ID card or passport manually.',
|
|
10105
|
+
firstInstructionText: 'Please capture the front of your ID card, or the ID page of your passport.',
|
|
10106
|
+
secondInstructionText: 'Please capture the back of your ID card, or click Done if submitting a passport.',
|
|
10107
|
+
captureBtnText: 'Capture',
|
|
10108
|
+
captureMoreBtnText: 'Capture back of ID Card',
|
|
10109
|
+
doneBtnText: 'Done'
|
|
10110
|
+
});
|
|
10111
|
+
return /*#__PURE__*/React__default.createElement(OverlayContainer, null, /*#__PURE__*/React__default.createElement(OverlayInner, {
|
|
10112
|
+
style: {
|
|
10113
|
+
justifyContent: 'center'
|
|
10114
|
+
}
|
|
10115
|
+
}, /*#__PURE__*/React__default.createElement("h3", {
|
|
10116
|
+
style: {
|
|
10117
|
+
marginBottom: 8
|
|
10118
|
+
}
|
|
10119
|
+
}, verbiage.headingText), /*#__PURE__*/React__default.createElement("p", {
|
|
10120
|
+
style: {
|
|
10121
|
+
marginBottom: 8
|
|
10122
|
+
}
|
|
10123
|
+
}, verbiage.descriptionText), images.length > 0 && /*#__PURE__*/React__default.createElement(OverlayImageMultiContainer, null, images.map(function (image, i) {
|
|
10124
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
10125
|
+
key: i,
|
|
10126
|
+
style: {
|
|
10127
|
+
display: 'flex',
|
|
10128
|
+
justifyContent: 'center',
|
|
10129
|
+
flexGrow: 1,
|
|
10130
|
+
flexBasis: 0
|
|
10131
|
+
}
|
|
10132
|
+
}, /*#__PURE__*/React__default.createElement("img", {
|
|
10133
|
+
src: image,
|
|
10134
|
+
alt: ""
|
|
10135
|
+
}));
|
|
10136
|
+
})), images.length < 2 && /*#__PURE__*/React__default.createElement("p", {
|
|
10137
|
+
style: {
|
|
10138
|
+
fontWeight: 'bold'
|
|
10139
|
+
}
|
|
10140
|
+
}, images.length === 0 ? verbiage.firstInstructionText : verbiage.secondInstructionText), /*#__PURE__*/React__default.createElement("input", {
|
|
10141
|
+
ref: fileInput,
|
|
10142
|
+
type: "file",
|
|
10143
|
+
accept: "image/*",
|
|
10144
|
+
hidden: true,
|
|
10145
|
+
onChange: function onChange(e) {
|
|
10146
|
+
var _a;
|
|
10147
|
+
var file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
|
|
10148
|
+
if (!file) return;
|
|
10149
|
+
var reader = new FileReader();
|
|
10150
|
+
reader.addEventListener('load', function (e) {
|
|
10151
|
+
var _a;
|
|
10152
|
+
var imageData = (_a = e.target) === null || _a === void 0 ? void 0 : _a.result;
|
|
10153
|
+
setImages(function (images) {
|
|
10154
|
+
return __spreadArray(__spreadArray([], images, true), [imageData], false);
|
|
10155
|
+
});
|
|
10156
|
+
onCapture === null || onCapture === void 0 ? void 0 : onCapture(imageData);
|
|
10157
|
+
});
|
|
10158
|
+
reader.readAsDataURL(file);
|
|
10159
|
+
}
|
|
10160
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
10161
|
+
style: {
|
|
10162
|
+
marginTop: 32
|
|
10163
|
+
}
|
|
10164
|
+
}, images.length < 2 && /*#__PURE__*/React__default.createElement(LoaderButton, {
|
|
10165
|
+
colors: images.length > 0 ? colors.captureMoreBtn : colors.captureBtn,
|
|
10166
|
+
finished: true,
|
|
10167
|
+
onClick: function onClick() {
|
|
10168
|
+
var _a;
|
|
10169
|
+
(_a = fileInput.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
10170
|
+
}
|
|
10171
|
+
}, images.length > 0 ? verbiage.captureMoreBtnText : verbiage.captureBtnText), images.length > 0 && /*#__PURE__*/React__default.createElement(LoaderButton, {
|
|
10172
|
+
colors: colors.doneBtn,
|
|
10173
|
+
finished: true,
|
|
10174
|
+
onClick: function onClick() {
|
|
10175
|
+
onFinished === null || onFinished === void 0 ? void 0 : onFinished(images);
|
|
10176
|
+
},
|
|
10177
|
+
style: {
|
|
10178
|
+
marginLeft: 12
|
|
10179
|
+
}
|
|
10180
|
+
}, verbiage.doneBtnText))));
|
|
10181
|
+
};
|
|
10182
|
+
|
|
10090
10183
|
var CaptureState;
|
|
10091
10184
|
(function (CaptureState) {
|
|
10092
10185
|
CaptureState["CAPTURING"] = "CAPTURING";
|
|
@@ -10138,6 +10231,22 @@ var reducer$4 = function reducer(state, action) {
|
|
|
10138
10231
|
}
|
|
10139
10232
|
return newState;
|
|
10140
10233
|
}
|
|
10234
|
+
case 'imageCapturedManually':
|
|
10235
|
+
{
|
|
10236
|
+
var newState = __assign({}, state);
|
|
10237
|
+
var capturedDocument = __assign(__assign({}, action.payload), {
|
|
10238
|
+
width: 0,
|
|
10239
|
+
height: 0
|
|
10240
|
+
});
|
|
10241
|
+
if (Object.keys(state.capturedDocuments).length === 0) {
|
|
10242
|
+
newState.capturedDocuments[DocumentType.PASSPORT] = capturedDocument;
|
|
10243
|
+
} else {
|
|
10244
|
+
newState.capturedDocuments = {};
|
|
10245
|
+
newState.capturedDocuments[DocumentType.ID_CARD_FRONT] = state.capturedDocuments[DocumentType.PASSPORT];
|
|
10246
|
+
newState.capturedDocuments[DocumentType.ID_CARD_BACK] = capturedDocument;
|
|
10247
|
+
}
|
|
10248
|
+
return newState;
|
|
10249
|
+
}
|
|
10141
10250
|
case 'reset':
|
|
10142
10251
|
return __assign({}, initialState$4);
|
|
10143
10252
|
}
|
|
@@ -10188,6 +10297,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
10188
10297
|
setPassportImage = _3.setPassportImage,
|
|
10189
10298
|
logIdFrontCaptureAttempt = _3.logIdFrontCaptureAttempt,
|
|
10190
10299
|
logIdBackCaptureAttempt = _3.logIdBackCaptureAttempt;
|
|
10300
|
+
var modelsError = useContext(IdCaptureModelsContext).error;
|
|
10191
10301
|
var operationStartedAt = useRef();
|
|
10192
10302
|
useEffect(function () {
|
|
10193
10303
|
operationStartedAt.current = new Date();
|
|
@@ -10225,53 +10335,23 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
10225
10335
|
});
|
|
10226
10336
|
}, [logCaptureMetadata]);
|
|
10227
10337
|
var onSubmitClick = useCallback(function () {
|
|
10228
|
-
|
|
10229
|
-
|
|
10230
|
-
|
|
10231
|
-
|
|
10232
|
-
|
|
10233
|
-
|
|
10234
|
-
|
|
10235
|
-
|
|
10236
|
-
|
|
10237
|
-
|
|
10238
|
-
|
|
10239
|
-
|
|
10240
|
-
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
idFrontImage = _a;
|
|
10244
|
-
_b = idBackDocument;
|
|
10245
|
-
if (!_b) return [3, 4];
|
|
10246
|
-
return [4, dataUrlToBase64(idBackDocument.imageData)];
|
|
10247
|
-
case 3:
|
|
10248
|
-
_b = _d.sent();
|
|
10249
|
-
_d.label = 4;
|
|
10250
|
-
case 4:
|
|
10251
|
-
idBackImage = _b;
|
|
10252
|
-
_c = passportDocument;
|
|
10253
|
-
if (!_c) return [3, 6];
|
|
10254
|
-
return [4, dataUrlToBase64(passportDocument.imageData)];
|
|
10255
|
-
case 5:
|
|
10256
|
-
_c = _d.sent();
|
|
10257
|
-
_d.label = 6;
|
|
10258
|
-
case 6:
|
|
10259
|
-
passportImage = _c;
|
|
10260
|
-
setIdFrontImage(idFrontImage);
|
|
10261
|
-
setIdBackImage(idBackImage);
|
|
10262
|
-
setPassportImage(passportImage);
|
|
10263
|
-
releaseCameraAccess();
|
|
10264
|
-
setTimeout(function () {
|
|
10265
|
-
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess({
|
|
10266
|
-
idFrontImage: idFrontImage,
|
|
10267
|
-
idBackImage: idBackImage,
|
|
10268
|
-
passportImage: passportImage
|
|
10269
|
-
});
|
|
10270
|
-
}, 0);
|
|
10271
|
-
return [2];
|
|
10272
|
-
}
|
|
10338
|
+
var idFrontDocument = state.capturedDocuments['ID_CARD_FRONT'];
|
|
10339
|
+
var idBackDocument = state.capturedDocuments['ID_CARD_BACK'];
|
|
10340
|
+
var passportDocument = state.capturedDocuments['PASSPORT'];
|
|
10341
|
+
var idFrontImage = idFrontDocument && dataUrlToBase64Sync(idFrontDocument.imageData);
|
|
10342
|
+
var idBackImage = idBackDocument && dataUrlToBase64Sync(idBackDocument.imageData);
|
|
10343
|
+
var passportImage = passportDocument && dataUrlToBase64Sync(passportDocument.imageData);
|
|
10344
|
+
setIdFrontImage(idFrontImage);
|
|
10345
|
+
setIdBackImage(idBackImage);
|
|
10346
|
+
setPassportImage(passportImage);
|
|
10347
|
+
releaseCameraAccess();
|
|
10348
|
+
setTimeout(function () {
|
|
10349
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess({
|
|
10350
|
+
idFrontImage: idFrontImage,
|
|
10351
|
+
idBackImage: idBackImage,
|
|
10352
|
+
passportImage: passportImage
|
|
10273
10353
|
});
|
|
10274
|
-
});
|
|
10354
|
+
}, 0);
|
|
10275
10355
|
}, [onSuccess, releaseCameraAccess, setIdBackImage, setIdFrontImage, setPassportImage, state.capturedDocuments]);
|
|
10276
10356
|
var showSuccessScreen = useShowSuccessScreen(skipSuccessScreen, state.captureState === CaptureState.COMPLETE, onSubmitClick);
|
|
10277
10357
|
var onRetryClick = useCallback(function () {
|
|
@@ -10325,6 +10405,19 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
10325
10405
|
className: "padded"
|
|
10326
10406
|
}, /*#__PURE__*/React__default.createElement("h1", null, "Submission completed!"), /*#__PURE__*/React__default.createElement("pre", null, JSON.stringify(submissionResponse, null, 2)));
|
|
10327
10407
|
}
|
|
10408
|
+
if (modelsError) {
|
|
10409
|
+
return /*#__PURE__*/React__default.createElement(IdCaptureFallback, {
|
|
10410
|
+
onFinished: onSubmitClick,
|
|
10411
|
+
onCapture: function onCapture(imageData) {
|
|
10412
|
+
dispatch({
|
|
10413
|
+
type: 'imageCapturedManually',
|
|
10414
|
+
payload: {
|
|
10415
|
+
imageData: imageData
|
|
10416
|
+
}
|
|
10417
|
+
});
|
|
10418
|
+
}
|
|
10419
|
+
});
|
|
10420
|
+
}
|
|
10328
10421
|
return /*#__PURE__*/React__default.createElement(PageContainer, {
|
|
10329
10422
|
className: "flex"
|
|
10330
10423
|
}, state.captureState !== CaptureState.COMPLETE && /*#__PURE__*/React__default.createElement(CameraVideoTag, null), overlayDismissed && function () {
|
|
@@ -10441,6 +10534,23 @@ var FaceCaptureGuideOverlay = function FaceCaptureGuideOverlay(_a) {
|
|
|
10441
10534
|
}));
|
|
10442
10535
|
};
|
|
10443
10536
|
|
|
10537
|
+
var ModelLoadingErrorOverlay = function ModelLoadingErrorOverlay(_a) {
|
|
10538
|
+
var error = _a.error;
|
|
10539
|
+
return /*#__PURE__*/React__default.createElement(OverlayContainer, null, /*#__PURE__*/React__default.createElement(OverlayInner, {
|
|
10540
|
+
style: {
|
|
10541
|
+
justifyContent: 'center'
|
|
10542
|
+
}
|
|
10543
|
+
}, /*#__PURE__*/React__default.createElement("h3", {
|
|
10544
|
+
style: {
|
|
10545
|
+
marginBottom: 8
|
|
10546
|
+
}
|
|
10547
|
+
}, "We're sorry, an unexpected error has occurred."), /*#__PURE__*/React__default.createElement("p", {
|
|
10548
|
+
style: {
|
|
10549
|
+
marginBottom: 0
|
|
10550
|
+
}
|
|
10551
|
+
}, /*#__PURE__*/React__default.createElement("code", null, error.message))));
|
|
10552
|
+
};
|
|
10553
|
+
|
|
10444
10554
|
var NUM_KEYPOINTS = 6;
|
|
10445
10555
|
var GREEN = '#32EEDB';
|
|
10446
10556
|
var RED = '#FF2C35';
|