@authme/identity-verification 2.7.2 → 2.7.4-patch.1
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/assets/locale/en_US.json +195 -2
- package/assets/locale/ja_JP.json +207 -14
- package/assets/locale/old/en_US.json +0 -11
- package/assets/locale/old/ja_JP.json +0 -11
- package/assets/locale/old/zh_Hant_TW.json +0 -11
- package/assets/locale/zh_Hant_TW.json +196 -3
- package/assets/styles/style.css +77 -52
- package/index.cjs +409 -192
- package/index.js +410 -193
- package/package.json +6 -6
- package/src/lib/interface/config.interface.d.ts +2 -0
- package/src/lib/ui/extra.ui.d.ts +1 -0
- package/src/lib/ui/ocr-flow.d.ts +9 -4
- package/src/lib/ui/ocr.ui.d.ts +3 -3
- package/src/lib/v2/index.d.ts +1 -0
- package/src/lib/v2/thickness.d.ts +1 -1
- package/src/lib/v2/ui/toast.d.ts +7 -0
- package/src/lib/v2/utilities/index.d.ts +2 -0
package/index.cjs
CHANGED
|
@@ -127,7 +127,8 @@ const defaultIdRecognitionConfig = {
|
|
|
127
127
|
disablePassportConfirm: false,
|
|
128
128
|
antiFraudIMetalTagValidCountTh: false,
|
|
129
129
|
cardTypes: [],
|
|
130
|
-
cardTypeConfigs: []
|
|
130
|
+
cardTypeConfigs: [],
|
|
131
|
+
captureTimeout: -1
|
|
131
132
|
};
|
|
132
133
|
|
|
133
134
|
function setCorrectViewHeight() {
|
|
@@ -23239,6 +23240,7 @@ const renderBasicUI = userConfig => {
|
|
|
23239
23240
|
video.playsInline = true;
|
|
23240
23241
|
video.loop = true;
|
|
23241
23242
|
video.setAttribute('webkit-playsinline', '');
|
|
23243
|
+
video.setAttribute('poster', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAADwCAYAAABxLb1rAAAABmJLR0QA/wD/AP+gvaeTAAADKUlEQVR4nO3UMQEAIAzAsIF/zyBjRxMFvXpm5g1A0N0OANhigECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkfVV0C319akPEAAAAASUVORK5CYII=');
|
|
23242
23244
|
const lottieScreen = document.createElement('div');
|
|
23243
23245
|
lottieScreen.classList.add('lottie-screen');
|
|
23244
23246
|
const pictureIcon = document.createElement('div');
|
|
@@ -23717,8 +23719,8 @@ var RESIZE_EVENT;
|
|
|
23717
23719
|
RESIZE_EVENT["PASS"] = "PASS";
|
|
23718
23720
|
})(RESIZE_EVENT || (RESIZE_EVENT = {}));
|
|
23719
23721
|
function detectScreenResize$() {
|
|
23720
|
-
const initWidth = window.
|
|
23721
|
-
const initHeight = window.
|
|
23722
|
+
const initWidth = window.innerWidth;
|
|
23723
|
+
const initHeight = window.innerHeight;
|
|
23722
23724
|
let resize$;
|
|
23723
23725
|
if (util.isMobile()) {
|
|
23724
23726
|
if (!window.visualViewport) {
|
|
@@ -23742,7 +23744,7 @@ function detectScreenResize$() {
|
|
|
23742
23744
|
if (window.innerWidth < RESIZE_STYLE.RESIZE_WIDTH_LIMIT || window.innerHeight < RESIZE_STYLE.RESIZE_HEIGHT_LIMIT) {
|
|
23743
23745
|
return RESIZE_EVENT.SCREEN_RESOLUTION_TOO_LOW;
|
|
23744
23746
|
}
|
|
23745
|
-
if (window.
|
|
23747
|
+
if (window.innerWidth !== initWidth || window.innerHeight !== initHeight) {
|
|
23746
23748
|
return RESIZE_EVENT.SCREEN_SIZE_CHANGED;
|
|
23747
23749
|
}
|
|
23748
23750
|
return RESIZE_EVENT.PASS;
|
|
@@ -24011,10 +24013,10 @@ function startLiveness(config) {
|
|
|
24011
24013
|
result
|
|
24012
24014
|
}) => applyTextByResult(result)), rxjs.filter(({
|
|
24013
24015
|
result
|
|
24014
|
-
}) => result.eStatus === liveness.FasRecognitionResult.Pass && result.eStage === liveness.EAuthMeFASServiceStage.
|
|
24016
|
+
}) => result.eStatus === liveness.FasRecognitionResult.Pass && result.eStage === liveness.EAuthMeFASServiceStage.Passive || result.eStatus === liveness.FasRecognitionResult.Failed), rxjs.map(data => {
|
|
24015
24017
|
var _a, _b;
|
|
24016
24018
|
return Object.assign(Object.assign({}, data), {
|
|
24017
|
-
isSuccess: ((_a = data === null || data === void 0 ? void 0 : data.result) === null || _a === void 0 ? void 0 : _a.eStatus) === liveness.FasRecognitionResult.Pass && ((_b = data === null || data === void 0 ? void 0 : data.result) === null || _b === void 0 ? void 0 : _b.eStage) === liveness.EAuthMeFASServiceStage.
|
|
24019
|
+
isSuccess: ((_a = data === null || data === void 0 ? void 0 : data.result) === null || _a === void 0 ? void 0 : _a.eStatus) === liveness.FasRecognitionResult.Pass && ((_b = data === null || data === void 0 ? void 0 : data.result) === null || _b === void 0 ? void 0 : _b.eStage) === liveness.EAuthMeFASServiceStage.Passive
|
|
24018
24020
|
});
|
|
24019
24021
|
}), rxjs.take(1),
|
|
24020
24022
|
/**
|
|
@@ -24249,21 +24251,6 @@ const initScanAnimation = params => {
|
|
|
24249
24251
|
});
|
|
24250
24252
|
lottie__default["default"].stop('scan');
|
|
24251
24253
|
};
|
|
24252
|
-
const initSuccessAnimation = params => {
|
|
24253
|
-
lottie__default["default"].destroy('success');
|
|
24254
|
-
lottie__default["default"].loadAnimation({
|
|
24255
|
-
container: params.animationContainer,
|
|
24256
|
-
renderer: 'svg',
|
|
24257
|
-
loop: false,
|
|
24258
|
-
autoplay: true,
|
|
24259
|
-
name: 'success',
|
|
24260
|
-
animationData: success({
|
|
24261
|
-
color: '#7CFFF9',
|
|
24262
|
-
opacity: 1
|
|
24263
|
-
})
|
|
24264
|
-
});
|
|
24265
|
-
lottie__default["default"].stop('success');
|
|
24266
|
-
};
|
|
24267
24254
|
const renderCameraSwitch = config => {
|
|
24268
24255
|
const cameraSwitchContainer = document.createElement('div');
|
|
24269
24256
|
const cameraSwitch = document.createElement('div');
|
|
@@ -24313,21 +24300,29 @@ const renderOCRUI = config => {
|
|
|
24313
24300
|
// Animation
|
|
24314
24301
|
const scanAnimationContainer = document.createElement('div');
|
|
24315
24302
|
scanAnimationContainer.classList.add('scan');
|
|
24316
|
-
|
|
24317
|
-
|
|
24318
|
-
|
|
24319
|
-
|
|
24303
|
+
// 完成流程元件
|
|
24304
|
+
const successContainer = document.createElement('div');
|
|
24305
|
+
successContainer.classList.add('success_container');
|
|
24306
|
+
const successBlockDom = document.createElement('div');
|
|
24307
|
+
successBlockDom.classList.add('block');
|
|
24308
|
+
const successDom = document.createElement('div');
|
|
24309
|
+
successDom.classList.add('img');
|
|
24310
|
+
const successText = document.createElement('div');
|
|
24311
|
+
successText.textContent = translateService.translate('sdk.general.done');
|
|
24312
|
+
successBlockDom.appendChild(successDom);
|
|
24313
|
+
successBlockDom.appendChild(successText);
|
|
24314
|
+
successContainer.appendChild(successBlockDom);
|
|
24320
24315
|
const arrowAnimationContainer = document.createElement('div');
|
|
24321
24316
|
arrowAnimationContainer.classList.add('arrow_container');
|
|
24322
|
-
successAnimationContainer.appendChild(successAnimationDom);
|
|
24323
24317
|
config.videoContainer.appendChild(titleTextPanel);
|
|
24324
24318
|
if (config.showStatement) {
|
|
24325
24319
|
config.videoContainer.appendChild(statementContainer);
|
|
24326
24320
|
}
|
|
24327
24321
|
config.videoContainer.appendChild(statusTextPanel);
|
|
24328
24322
|
config.videoContainer.appendChild(scanAnimationContainer);
|
|
24329
|
-
config.videoContainer.appendChild(
|
|
24323
|
+
config.videoContainer.appendChild(successContainer);
|
|
24330
24324
|
config.videoContainer.appendChild(arrowAnimationContainer);
|
|
24325
|
+
successContainer.classList.add('hide');
|
|
24331
24326
|
// Anti-fraud Instruction
|
|
24332
24327
|
const lottieMask = document.createElement('div');
|
|
24333
24328
|
lottieMask.classList.add('lottie-mask');
|
|
@@ -24351,6 +24346,8 @@ const renderOCRUI = config => {
|
|
|
24351
24346
|
config.container.appendChild(lottieMask);
|
|
24352
24347
|
config.container.appendChild(antiFraudInstructionContainer);
|
|
24353
24348
|
// Picture
|
|
24349
|
+
const confirmContainer = document.createElement('div');
|
|
24350
|
+
confirmContainer.classList.add('confirm_container');
|
|
24354
24351
|
const confirmImageContainer = document.createElement('div');
|
|
24355
24352
|
confirmImageContainer.classList.add('confirm-image-container');
|
|
24356
24353
|
const imageTypeText = document.createElement('div');
|
|
@@ -24379,7 +24376,8 @@ const renderOCRUI = config => {
|
|
|
24379
24376
|
confirmImageContainer.appendChild(imageContainer);
|
|
24380
24377
|
confirmImageContainer.appendChild(imageLineLineDesktop);
|
|
24381
24378
|
confirmImageContainer.appendChild(imageFooter);
|
|
24382
|
-
|
|
24379
|
+
confirmContainer.appendChild(confirmImageContainer);
|
|
24380
|
+
config.container.appendChild(confirmContainer);
|
|
24383
24381
|
return {
|
|
24384
24382
|
antiFraudInstructionContainer,
|
|
24385
24383
|
titleTextPanel,
|
|
@@ -24389,11 +24387,12 @@ const renderOCRUI = config => {
|
|
|
24389
24387
|
statusTextPanel,
|
|
24390
24388
|
lottieMask,
|
|
24391
24389
|
arrowAnimationContainer,
|
|
24392
|
-
|
|
24393
|
-
|
|
24390
|
+
successContainer,
|
|
24391
|
+
successBlockDom,
|
|
24394
24392
|
scanAnimationContainer,
|
|
24395
24393
|
antiFraudInstructionAnimationContainer,
|
|
24396
24394
|
confirmImageContainer,
|
|
24395
|
+
confirmContainer,
|
|
24397
24396
|
imageTypeText,
|
|
24398
24397
|
// cardborder,
|
|
24399
24398
|
// cardborderContainer,
|
|
@@ -25305,7 +25304,8 @@ function renderCardRotateAnimate(container) {
|
|
|
25305
25304
|
const captureButton = () => {
|
|
25306
25305
|
let dom = document.querySelector('#btn_capture');
|
|
25307
25306
|
if (dom) {
|
|
25308
|
-
return dom;
|
|
25307
|
+
// return dom;
|
|
25308
|
+
dom.remove();
|
|
25309
25309
|
}
|
|
25310
25310
|
const videoContainer = document.querySelector('.video-container');
|
|
25311
25311
|
if (!videoContainer) {
|
|
@@ -25334,24 +25334,26 @@ const modal = arg => {
|
|
|
25334
25334
|
const domModal = document.createElement('div');
|
|
25335
25335
|
const domHeaderContainer = document.createElement('div');
|
|
25336
25336
|
const domHeader = document.createElement('div');
|
|
25337
|
-
const
|
|
25337
|
+
const domBodyContainer = document.createElement('div');
|
|
25338
|
+
const domBody = document.createElement('div');
|
|
25338
25339
|
const domTitle = document.createElement('div');
|
|
25339
25340
|
const domSubtitle = document.createElement('div');
|
|
25340
25341
|
const domImage = document.createElement('img');
|
|
25341
25342
|
const domContent = document.createElement('div');
|
|
25342
|
-
const
|
|
25343
|
+
const domFooterContainer = document.createElement('div');
|
|
25343
25344
|
const domClose = document.createElement('div');
|
|
25344
25345
|
const domConfirm = document.createElement('div');
|
|
25345
25346
|
const domCopyRight = document.createElement('div');
|
|
25346
25347
|
domModal.classList.add('video-container__modal');
|
|
25347
25348
|
domHeaderContainer.classList.add('video-container__modal-header-container');
|
|
25348
25349
|
domHeader.classList.add('video-container__modal-header');
|
|
25349
|
-
|
|
25350
|
+
domBodyContainer.classList.add('video-container__modal-body-container');
|
|
25351
|
+
domBody.classList.add('video-container__modal-body');
|
|
25350
25352
|
domTitle.classList.add('video-container__modal-title');
|
|
25351
25353
|
domSubtitle.classList.add('video-container__modal-subtitle');
|
|
25352
25354
|
domImage.classList.add('video-container__modal-image');
|
|
25353
25355
|
domContent.classList.add('video-container__modal-content');
|
|
25354
|
-
|
|
25356
|
+
domFooterContainer.classList.add('video-container__modal-footer-container');
|
|
25355
25357
|
domClose.classList.add('video-container__modal-close');
|
|
25356
25358
|
domConfirm.classList.add('video-container__modal-confirm');
|
|
25357
25359
|
domCopyRight.classList.add('video-container__modal-copy-right');
|
|
@@ -25377,16 +25379,17 @@ const modal = arg => {
|
|
|
25377
25379
|
domHeaderContainer.appendChild(domHeader);
|
|
25378
25380
|
domHeaderContainer.appendChild(domClose);
|
|
25379
25381
|
domModal.appendChild(domHeaderContainer);
|
|
25380
|
-
|
|
25381
|
-
|
|
25382
|
-
|
|
25383
|
-
|
|
25384
|
-
|
|
25385
|
-
|
|
25386
|
-
|
|
25382
|
+
domBodyContainer.appendChild(domBody);
|
|
25383
|
+
domBody.appendChild(domTitle);
|
|
25384
|
+
domBody.appendChild(domSubtitle);
|
|
25385
|
+
domBody.appendChild(domImage);
|
|
25386
|
+
domBody.appendChild(domContent);
|
|
25387
|
+
domModal.appendChild(domBodyContainer);
|
|
25388
|
+
domFooterContainer.appendChild(domConfirm);
|
|
25389
|
+
domModal.appendChild(domFooterContainer);
|
|
25387
25390
|
if (arg.copyRight) {
|
|
25388
25391
|
domCopyRight.innerText = arg.copyRight;
|
|
25389
|
-
|
|
25392
|
+
domFooterContainer.appendChild(domCopyRight);
|
|
25390
25393
|
}
|
|
25391
25394
|
authmeContainer.appendChild(domModal);
|
|
25392
25395
|
};
|
|
@@ -25414,9 +25417,11 @@ const resetFrame = () => {
|
|
|
25414
25417
|
};
|
|
25415
25418
|
const countdownTimer = (time, doSomething) => {
|
|
25416
25419
|
let end = false;
|
|
25420
|
+
let timer;
|
|
25421
|
+
let endTime;
|
|
25417
25422
|
const init = () => {
|
|
25418
|
-
|
|
25419
|
-
|
|
25423
|
+
endTime = new Date().getTime() + time * 1000;
|
|
25424
|
+
timer = setInterval(function () {
|
|
25420
25425
|
const currentTime = new Date().getTime();
|
|
25421
25426
|
const remainingTime = endTime - currentTime;
|
|
25422
25427
|
if (remainingTime <= 0) {
|
|
@@ -25428,10 +25433,21 @@ const countdownTimer = (time, doSomething) => {
|
|
|
25428
25433
|
}
|
|
25429
25434
|
}, 300);
|
|
25430
25435
|
};
|
|
25436
|
+
const clear = () => {
|
|
25437
|
+
clearInterval(timer);
|
|
25438
|
+
end = true;
|
|
25439
|
+
return (endTime - new Date().getTime()) / 1000;
|
|
25440
|
+
};
|
|
25441
|
+
const pause = () => {
|
|
25442
|
+
clearInterval(timer);
|
|
25443
|
+
return (endTime - new Date().getTime()) / 1000;
|
|
25444
|
+
};
|
|
25431
25445
|
const getStatus = () => {
|
|
25432
25446
|
return end;
|
|
25433
25447
|
};
|
|
25434
25448
|
return {
|
|
25449
|
+
pause: pause,
|
|
25450
|
+
clear: clear,
|
|
25435
25451
|
init: init,
|
|
25436
25452
|
end: getStatus
|
|
25437
25453
|
};
|
|
@@ -25439,7 +25455,7 @@ const countdownTimer = (time, doSomething) => {
|
|
|
25439
25455
|
|
|
25440
25456
|
const translateService = core.getTranslateInstance();
|
|
25441
25457
|
// TODO 處理參數
|
|
25442
|
-
const startThickness = (type, cardType, cardTypeConfig, setHintTextLocale, setCardPoints, setCardBorderColor, statusText, canvasSizeInfo$, showVideoElement, config, cardRotateByStage, getCardBorderPoint, setBorderType, setBorderSuccess, scanAnimationContainer, successAnimationContainer, frameImage, frameText, facingMode, ocrEngineConfig, sdkFlowTimeout = undefined, makeSDKFlowTimeout, image, video, retryBtn, completeBtn, confirmImageContainer) => {
|
|
25458
|
+
const startThickness = (type, cardType, cardTypeConfig, setHintTextLocale, setCardPoints, setCardBorderColor, statusText, canvasSizeInfo$, showVideoElement, config, cardRotateByStage, getCardBorderPoint, setBorderType, setBorderSuccess, scanAnimationContainer, successAnimationContainer, frameImage, frameText, facingMode, ocrEngineConfig, sdkFlowTimeout = undefined, makeSDKFlowTimeout, image, video, retryBtn, completeBtn, confirmImageContainer, confrimContainer) => {
|
|
25443
25459
|
const videoToCanvas = (sizeInfo, data) => {
|
|
25444
25460
|
const ctx2 = image.getContext('2d');
|
|
25445
25461
|
image.width = sizeInfo.canvasWidth;
|
|
@@ -25456,6 +25472,7 @@ const startThickness = (type, cardType, cardTypeConfig, setHintTextLocale, setCa
|
|
|
25456
25472
|
videoToCanvas(sizeInfo, data);
|
|
25457
25473
|
showVideoElement(false);
|
|
25458
25474
|
util.showElement(confirmImageContainer);
|
|
25475
|
+
util.showElement(confrimContainer);
|
|
25459
25476
|
const retryEvents = rxjs.fromEvent(retryBtn, 'click').pipe(rxjs.mapTo(true));
|
|
25460
25477
|
const confirmEvents = rxjs.fromEvent(completeBtn, 'click').pipe(rxjs.mapTo(false));
|
|
25461
25478
|
const allEvents$ = rxjs.merge(retryEvents, confirmEvents);
|
|
@@ -25508,11 +25525,6 @@ const startThickness = (type, cardType, cardTypeConfig, setHintTextLocale, setCa
|
|
|
25508
25525
|
sendStatusDescription$1(core.StatusDescription.WrongCardType);
|
|
25509
25526
|
setCardBorderColor('error');
|
|
25510
25527
|
break;
|
|
25511
|
-
case idRecognition.EAuthMeIDCardAntiFraudStatus.CardThicknessFailed:
|
|
25512
|
-
statusText.textContent = translateService.translate('sdk.general.verify.error.CardThicknessFailed');
|
|
25513
|
-
sendStatusDescription$1(core.StatusDescription.CardThicknessFailed);
|
|
25514
|
-
setCardBorderColor('error');
|
|
25515
|
-
break;
|
|
25516
25528
|
case idRecognition.EAuthMeIDCardAntiFraudStatus.Reflective:
|
|
25517
25529
|
statusText.textContent = translateService.translate('sdk.general.verify.error.reflective');
|
|
25518
25530
|
sendStatusDescription$1(core.StatusDescription.Reflective);
|
|
@@ -25553,22 +25565,11 @@ const startThickness = (type, cardType, cardTypeConfig, setHintTextLocale, setCa
|
|
|
25553
25565
|
statusText.textContent = translateService.translate('sdk.general.verify.error.cardCutByCamera');
|
|
25554
25566
|
break;
|
|
25555
25567
|
case idRecognition.EAuthMeIDCardAntiFraudStatus.CardNotInROI:
|
|
25556
|
-
statusText.textContent = translateService.translate('verify.error.
|
|
25568
|
+
statusText.textContent = translateService.translate('sdk.general.verify.error.missmatch');
|
|
25557
25569
|
break;
|
|
25558
25570
|
case idRecognition.EAuthMeIDCardAntiFraudStatus.CardTooSmall:
|
|
25559
25571
|
statusText.textContent = translateService.translate('sdk.general.verify.error.getCloser');
|
|
25560
25572
|
break;
|
|
25561
|
-
case idRecognition.EAuthMeIDCardAntiFraudStatus.NeedHoldCard:
|
|
25562
|
-
statusText.textContent = translateService.translate('sdk.general.verify.error.needHoldCard');
|
|
25563
|
-
break;
|
|
25564
|
-
case idRecognition.EAuthMeIDCardAntiFraudStatus.StagePass:
|
|
25565
|
-
statusText.textContent = translateService.translate('sdk.general.verify.error.stagePass');
|
|
25566
|
-
setCardBorderColor('pass');
|
|
25567
|
-
break;
|
|
25568
|
-
case idRecognition.EAuthMeIDCardAntiFraudStatus.Pass:
|
|
25569
|
-
setCardBorderColor('pass');
|
|
25570
|
-
statusText.textContent = translateService.translate('sdk.general.verify.error.pass');
|
|
25571
|
-
break;
|
|
25572
25573
|
case idRecognition.EAuthMeIDCardAntiFraudStatus.Failed:
|
|
25573
25574
|
setCardBorderColor('error');
|
|
25574
25575
|
statusText.textContent = translateService.translate('sdk.general.verify.error.pass');
|
|
@@ -25611,7 +25612,8 @@ const startThickness = (type, cardType, cardTypeConfig, setHintTextLocale, setCa
|
|
|
25611
25612
|
onConfirm: () => {
|
|
25612
25613
|
observer.next(canvasSizeInfo);
|
|
25613
25614
|
observer.complete();
|
|
25614
|
-
}
|
|
25615
|
+
},
|
|
25616
|
+
copyRight: translateService.translate('sdk.general.footer')
|
|
25615
25617
|
});
|
|
25616
25618
|
});
|
|
25617
25619
|
} else {
|
|
@@ -25651,6 +25653,9 @@ const startThickness = (type, cardType, cardTypeConfig, setHintTextLocale, setCa
|
|
|
25651
25653
|
result
|
|
25652
25654
|
}) => {
|
|
25653
25655
|
if (thicknessTimer.end()) {
|
|
25656
|
+
util.hideElement(confirmImageContainer);
|
|
25657
|
+
util.hideElement(confrimContainer);
|
|
25658
|
+
showVideoElement(true);
|
|
25654
25659
|
util.startSpinner(translateService.translate('sdk.general.uploading'), true);
|
|
25655
25660
|
videoToCanvas(canvasSizeInfo, result.imageData);
|
|
25656
25661
|
return config.confirmThickness ? config.confirmThickness(generateImage(), cardType) : rxjs.of(false);
|
|
@@ -25661,6 +25666,7 @@ const startThickness = (type, cardType, cardTypeConfig, setHintTextLocale, setCa
|
|
|
25661
25666
|
}), rxjs.switchMap(confirmResp => {
|
|
25662
25667
|
showVideoElement(true);
|
|
25663
25668
|
util.hideElement(confirmImageContainer);
|
|
25669
|
+
util.hideElement(confrimContainer);
|
|
25664
25670
|
util.stopSpinner();
|
|
25665
25671
|
if (confirmResp) {
|
|
25666
25672
|
return autoDetectProcess(true);
|
|
@@ -25686,6 +25692,9 @@ const startThickness = (type, cardType, cardTypeConfig, setHintTextLocale, setCa
|
|
|
25686
25692
|
// 當 end() 函數返回 false 時繼續
|
|
25687
25693
|
operators.finalize(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
25688
25694
|
if (thicknessTimer.end()) {
|
|
25695
|
+
util.hideElement(confirmImageContainer);
|
|
25696
|
+
util.hideElement(confrimContainer);
|
|
25697
|
+
showVideoElement(true);
|
|
25689
25698
|
util.startSpinner(translateService.translate('sdk.general.uploading'), true);
|
|
25690
25699
|
const sizeInfo = yield util.getCanvasSize(video);
|
|
25691
25700
|
videoToCanvas(sizeInfo);
|
|
@@ -25705,10 +25714,11 @@ const startThickness = (type, cardType, cardTypeConfig, setHintTextLocale, setCa
|
|
|
25705
25714
|
return needRetry ? rxjs.of(true) : rxjs.from(config.confirmThickness ? config.confirmThickness(generateImage(), cardType) : rxjs.of(false)).pipe(rxjs.tap(() => sendStatusAction$1(core.StatusAction.Uploading)), rxjs.map(confirmResp => !confirmResp));
|
|
25706
25715
|
}), rxjs.tap(confirmResp => {
|
|
25707
25716
|
util.hideElement(confirmImageContainer);
|
|
25717
|
+
util.hideElement(confrimContainer);
|
|
25708
25718
|
util.stopSpinner();
|
|
25709
25719
|
showVideoElement(true);
|
|
25720
|
+
checkTimeout.unsubscribe(); // 取消 interval$ 的訂閱
|
|
25710
25721
|
if (!confirmResp) {
|
|
25711
|
-
checkTimeout.unsubscribe(); // 取消 interval$ 的訂閱
|
|
25712
25722
|
util.hideElement(captureBtn);
|
|
25713
25723
|
observer.next(canvasSizeInfo);
|
|
25714
25724
|
}
|
|
@@ -25734,6 +25744,63 @@ const startThickness = (type, cardType, cardTypeConfig, setHintTextLocale, setCa
|
|
|
25734
25744
|
}
|
|
25735
25745
|
};
|
|
25736
25746
|
|
|
25747
|
+
const toast = arg => {
|
|
25748
|
+
var _a;
|
|
25749
|
+
let timer = null;
|
|
25750
|
+
let clearStatus = false;
|
|
25751
|
+
const message = typeof arg === 'string' ? arg : arg.message;
|
|
25752
|
+
const duration = arg.duration || 4000;
|
|
25753
|
+
const transition = (_a = arg.transition) !== null && _a !== void 0 ? _a : true;
|
|
25754
|
+
const toast = document.createElement('div');
|
|
25755
|
+
toast.style.cssText = `
|
|
25756
|
+
position: fixed;
|
|
25757
|
+
bottom: 50px;
|
|
25758
|
+
left: 50%;
|
|
25759
|
+
box-sizing: border-box;
|
|
25760
|
+
transform: translateX(-50%);
|
|
25761
|
+
width: 90%;
|
|
25762
|
+
padding: 10px 16px;
|
|
25763
|
+
background-color: rgba(0, 0, 0, .6);
|
|
25764
|
+
color: #fff;
|
|
25765
|
+
border-radius: 8px;
|
|
25766
|
+
z-index: 999999;
|
|
25767
|
+
display: flex;
|
|
25768
|
+
align-items: center;
|
|
25769
|
+
column-gap: 16px;
|
|
25770
|
+
opacity: 0;
|
|
25771
|
+
word-break: break-all;
|
|
25772
|
+
`;
|
|
25773
|
+
toast.classList.add('authme-toast');
|
|
25774
|
+
const clear = () => {
|
|
25775
|
+
if (!clearStatus) {
|
|
25776
|
+
clearStatus = true;
|
|
25777
|
+
document.body.removeChild(toast);
|
|
25778
|
+
clearTimeout(timer);
|
|
25779
|
+
}
|
|
25780
|
+
};
|
|
25781
|
+
if (transition) {
|
|
25782
|
+
toast.style.transition = 'opacity .3s ease-in';
|
|
25783
|
+
setTimeout(() => {
|
|
25784
|
+
toast.style.opacity = '1';
|
|
25785
|
+
}, 300);
|
|
25786
|
+
} else {
|
|
25787
|
+
toast.style.opacity = '1';
|
|
25788
|
+
}
|
|
25789
|
+
toast.innerHTML = message;
|
|
25790
|
+
document.body.appendChild(toast);
|
|
25791
|
+
timer = setTimeout(() => {
|
|
25792
|
+
clearStatus = true;
|
|
25793
|
+
toast.style.opacity = '0';
|
|
25794
|
+
toast.style.transition = 'opacity .3s ease-out';
|
|
25795
|
+
setTimeout(() => {
|
|
25796
|
+
document.body.removeChild(toast);
|
|
25797
|
+
}, 500);
|
|
25798
|
+
}, duration);
|
|
25799
|
+
return {
|
|
25800
|
+
clear
|
|
25801
|
+
};
|
|
25802
|
+
};
|
|
25803
|
+
|
|
25737
25804
|
const initEvenTrackingStatus = ocrConfig => {
|
|
25738
25805
|
setFeature$1(ocrConfig.needAntiFraud ? core.Feature.OCRFraud : core.Feature.OCR);
|
|
25739
25806
|
};
|
|
@@ -25757,7 +25824,8 @@ function startOCR(config) {
|
|
|
25757
25824
|
enableManualUpload: false,
|
|
25758
25825
|
fraudRetryTimes: 1,
|
|
25759
25826
|
fraudTimeout: 52,
|
|
25760
|
-
fraudMaxFps: 2
|
|
25827
|
+
fraudMaxFps: 2,
|
|
25828
|
+
captureTimeout: config.ocrConfig.captureTimeout
|
|
25761
25829
|
};
|
|
25762
25830
|
let cardSizeInfo = {
|
|
25763
25831
|
width: 0,
|
|
@@ -25798,9 +25866,10 @@ function startOCR(config) {
|
|
|
25798
25866
|
lottieMask,
|
|
25799
25867
|
arrowAnimationContainer,
|
|
25800
25868
|
scanAnimationContainer,
|
|
25801
|
-
|
|
25869
|
+
successContainer,
|
|
25802
25870
|
antiFraudInstructionAnimationContainer,
|
|
25803
25871
|
confirmImageContainer,
|
|
25872
|
+
confirmContainer,
|
|
25804
25873
|
imageTypeText,
|
|
25805
25874
|
retryBtn,
|
|
25806
25875
|
confirmBtn,
|
|
@@ -25833,6 +25902,9 @@ function startOCR(config) {
|
|
|
25833
25902
|
stopAnimate
|
|
25834
25903
|
} = renderCardRotateAnimate(arrowAnimationContainer);
|
|
25835
25904
|
setCorrectViewHeight();
|
|
25905
|
+
let countdownCaptureTimer;
|
|
25906
|
+
let toastManualCapture = null;
|
|
25907
|
+
let captureTimeoutTimer;
|
|
25836
25908
|
const canvasSizeInfo$ = rxjs.merge(rxjs.defer(() => util.requestCamera({
|
|
25837
25909
|
video,
|
|
25838
25910
|
facingMode: 'back',
|
|
@@ -25868,7 +25940,7 @@ function startOCR(config) {
|
|
|
25868
25940
|
});
|
|
25869
25941
|
}), expiredIn * util.TIME_UNIT.SECOND);
|
|
25870
25942
|
}
|
|
25871
|
-
function startAntiFraud(type) {
|
|
25943
|
+
function startAntiFraud(type, cardType) {
|
|
25872
25944
|
const animateInterval = 2 * util.TIME_UNIT.SECOND;
|
|
25873
25945
|
const nextAnimateInterval = 6 * util.TIME_UNIT.SECOND;
|
|
25874
25946
|
let needDeformationCount = 0;
|
|
@@ -25954,7 +26026,7 @@ function startOCR(config) {
|
|
|
25954
26026
|
statusText.textContent = translateService.translate('sdk.general.verify.error.cardCutByCamera');
|
|
25955
26027
|
break;
|
|
25956
26028
|
case idRecognition.EAuthMeIDCardAntiFraudStatus.CardNotInROI:
|
|
25957
|
-
statusText.textContent = translateService.translate('verify.error.
|
|
26029
|
+
statusText.textContent = translateService.translate('sdk.general.verify.error.missmatch');
|
|
25958
26030
|
break;
|
|
25959
26031
|
case idRecognition.EAuthMeIDCardAntiFraudStatus.CardTooSmall:
|
|
25960
26032
|
statusText.textContent = translateService.translate('sdk.general.verify.error.getCloser');
|
|
@@ -25995,7 +26067,7 @@ function startOCR(config) {
|
|
|
25995
26067
|
statusText.classList.remove('non-empty');
|
|
25996
26068
|
}
|
|
25997
26069
|
};
|
|
25998
|
-
const antiFraudStart$ = rxjs.of(true).pipe(rxjs.switchMap(() => util.checkOnlineStatus(translateService.translate('sdk.general.error.alert.offline'), translateService.translate('sdk.general.error.retry'))), rxjs.switchMap(() => canvasSizeInfo$), rxjs.switchMap(canvasSizeInfo => rxjs.from(config.setFrameSize(canvasSizeInfo.canvasWidth, canvasSizeInfo.canvasHeight)).pipe(rxjs.switchMap(() => config.antiFraudStart(getCardBorderPoint(), setBorderType, setCardBorderColor, setBorderSuccess, scanAnimationContainer,
|
|
26070
|
+
const antiFraudStart$ = rxjs.of(true).pipe(rxjs.switchMap(() => util.checkOnlineStatus(translateService.translate('sdk.general.error.alert.offline'), translateService.translate('sdk.general.error.retry'))), rxjs.switchMap(() => canvasSizeInfo$), rxjs.switchMap(canvasSizeInfo => rxjs.from(config.setFrameSize(canvasSizeInfo.canvasWidth, canvasSizeInfo.canvasHeight)).pipe(rxjs.switchMap(() => config.antiFraudStart(getCardBorderPoint(), setBorderType, setCardBorderColor, setBorderSuccess, scanAnimationContainer, successContainer, frameImage, frameText, facingMode)), rxjs.tap(() => __awaiter(this, void 0, void 0, function* () {
|
|
25999
26071
|
setStatusView(core.StatusView.Aligning);
|
|
26000
26072
|
if (buttonDisable$) {
|
|
26001
26073
|
const cardMatchROI = config.getCardMatchROI ? yield config.getCardMatchROI() : undefined;
|
|
@@ -26036,9 +26108,10 @@ function startOCR(config) {
|
|
|
26036
26108
|
statusText.classList.remove('non-empty');
|
|
26037
26109
|
setCardBorderColor('pass');
|
|
26038
26110
|
util.hideElement(arrowAnimationContainer);
|
|
26039
|
-
|
|
26111
|
+
successContainer.classList.remove('hide');
|
|
26040
26112
|
}), rxjs.switchMap(() => util.waitTime(2000)), rxjs.tap(() => {
|
|
26041
|
-
|
|
26113
|
+
setHeaderByType(cardType);
|
|
26114
|
+
successContainer.classList.add('hide');
|
|
26042
26115
|
}));
|
|
26043
26116
|
antiFraudStart$.pipe(
|
|
26044
26117
|
//workaround?: 因目前Frontal timeout會直接Failed,所以不能用$handleError來作為停止條件。
|
|
@@ -26056,6 +26129,7 @@ function startOCR(config) {
|
|
|
26056
26129
|
if (!config.ocrConfig.needOCR && type === idRecognition.EAuthMeCardClass.TWN_IDCard_Front) {
|
|
26057
26130
|
return rxjs.of(true);
|
|
26058
26131
|
}
|
|
26132
|
+
let captureBtn;
|
|
26059
26133
|
// if (config.ocrConfig.needAntiFraud) {
|
|
26060
26134
|
const point = getCardBorderPoint();
|
|
26061
26135
|
setCardPoints(point.map(([x, y]) => ({
|
|
@@ -26115,7 +26189,7 @@ function startOCR(config) {
|
|
|
26115
26189
|
showCameraSwitchButton(deviceMetas);
|
|
26116
26190
|
}
|
|
26117
26191
|
};
|
|
26118
|
-
const init = retry => canvasSizeInfo$.pipe(rxjs.take(1), rxjs.switchMap(canvasSizeInfo => rxjs.from(config.setFrameSize(canvasSizeInfo.canvasWidth, canvasSizeInfo.canvasHeight)).pipe(rxjs.switchMap(() => util.checkOnlineStatus(translateService.translate('sdk.general.error.alert.offline'), translateService.translate('sdk.general.error.retry'))), rxjs.switchMap(() => config.ocrStart(getCardBorderPoint(), type, setBorderType, setCardBorderColor, setBorderSuccess, scanAnimationContainer,
|
|
26192
|
+
const init = retry => canvasSizeInfo$.pipe(rxjs.take(1), rxjs.switchMap(canvasSizeInfo => rxjs.from(config.setFrameSize(canvasSizeInfo.canvasWidth, canvasSizeInfo.canvasHeight)).pipe(rxjs.switchMap(() => util.checkOnlineStatus(translateService.translate('sdk.general.error.alert.offline'), translateService.translate('sdk.general.error.retry'))), rxjs.switchMap(() => config.ocrStart(getCardBorderPoint(), type, setBorderType, setCardBorderColor, setBorderSuccess, scanAnimationContainer, successContainer, frameImage, frameText, facingMode, cardType, retry)), rxjs.tap(() => {
|
|
26119
26193
|
tiltFrame(false);
|
|
26120
26194
|
util.stopSpinner();
|
|
26121
26195
|
util.showElement(scanAnimationContainer);
|
|
@@ -26124,41 +26198,167 @@ function startOCR(config) {
|
|
|
26124
26198
|
lottie__default["default"].play('scan');
|
|
26125
26199
|
util.showElement(scanAnimationContainer);
|
|
26126
26200
|
}), rxjs.map(() => canvasSizeInfo))));
|
|
26127
|
-
|
|
26128
|
-
|
|
26129
|
-
|
|
26130
|
-
|
|
26131
|
-
|
|
26201
|
+
const videoToCanvas = (sizeInfo, data) => {
|
|
26202
|
+
const ctx2 = image.getContext('2d');
|
|
26203
|
+
image.width = sizeInfo.canvasWidth;
|
|
26204
|
+
image.height = sizeInfo.canvasHeight;
|
|
26205
|
+
if (data) {
|
|
26206
|
+
const imgData = ctx2.createImageData(image.width, image.height);
|
|
26207
|
+
imgData.data.set(data);
|
|
26208
|
+
ctx2.putImageData(imgData, 0, 0);
|
|
26209
|
+
} else {
|
|
26210
|
+
ctx2.drawImage(video, sizeInfo.startX, sizeInfo.startY, sizeInfo.width, sizeInfo.height, 0, 0, sizeInfo.canvasWidth, sizeInfo.canvasHeight);
|
|
26132
26211
|
}
|
|
26133
|
-
}
|
|
26134
|
-
|
|
26135
|
-
|
|
26136
|
-
|
|
26137
|
-
|
|
26138
|
-
|
|
26139
|
-
|
|
26140
|
-
|
|
26141
|
-
|
|
26142
|
-
|
|
26143
|
-
|
|
26144
|
-
|
|
26145
|
-
|
|
26146
|
-
|
|
26147
|
-
|
|
26148
|
-
|
|
26149
|
-
|
|
26150
|
-
|
|
26151
|
-
|
|
26152
|
-
|
|
26153
|
-
|
|
26154
|
-
|
|
26155
|
-
|
|
26156
|
-
|
|
26157
|
-
|
|
26158
|
-
|
|
26159
|
-
|
|
26160
|
-
|
|
26161
|
-
|
|
26212
|
+
};
|
|
26213
|
+
const checkConfirmImageManual = (sizeInfo, data) => __awaiter(this, void 0, void 0, function* () {
|
|
26214
|
+
videoToCanvas(sizeInfo, data);
|
|
26215
|
+
showVideoElement(false);
|
|
26216
|
+
util.showElement(confirmImageContainer);
|
|
26217
|
+
util.showElement(confirmContainer);
|
|
26218
|
+
const retryEvents = rxjs.fromEvent(retryBtn, 'click').pipe(rxjs.mapTo(true));
|
|
26219
|
+
const confirmEvents = rxjs.fromEvent(completeBtn, 'click').pipe(rxjs.mapTo(false));
|
|
26220
|
+
const allEvents$ = rxjs.merge(retryEvents, confirmEvents);
|
|
26221
|
+
return yield rxjs.firstValueFrom(allEvents$.pipe());
|
|
26222
|
+
});
|
|
26223
|
+
const manualCapture = show => {
|
|
26224
|
+
captureBtn = captureButton();
|
|
26225
|
+
if (captureBtn && show) {
|
|
26226
|
+
util.showElement(captureBtn);
|
|
26227
|
+
toastManualCapture = toast({
|
|
26228
|
+
message: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_19494_3109)"><path d="M19.5 19.5H4.5C4.10218 19.5 3.72064 19.342 3.43934 19.0607C3.15804 18.7794 3 18.3978 3 18V7.5C3 7.10218 3.15804 6.72064 3.43934 6.43934C3.72064 6.15804 4.10218 6 4.5 6H7.5L9 3.75H15L16.5 6H19.5C19.8978 6 20.2794 6.15804 20.5607 6.43934C20.842 6.72064 21 7.10218 21 7.5V18C21 18.3978 20.842 18.7794 20.5607 19.0607C20.2794 19.342 19.8978 19.5 19.5 19.5Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 15.75C13.864 15.75 15.375 14.239 15.375 12.375C15.375 10.511 13.864 9 12 9C10.136 9 8.625 10.511 8.625 12.375C8.625 14.239 10.136 15.75 12 15.75Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></g><defs><clipPath id="clip0_19494_3109"><rect width="24" height="24" fill="white"/></clipPath></defs></svg>' + translateService.translate('sdk.general.manualCapture'),
|
|
26229
|
+
transition: !show
|
|
26230
|
+
});
|
|
26231
|
+
}
|
|
26232
|
+
return rxjs.fromEvent(captureBtn, 'click').pipe(rxjs.switchMap(() => util.getCanvasSize(video)), rxjs.switchMap(canvasSizeInfo => {
|
|
26233
|
+
ocrSendFrameAnimation = true;
|
|
26234
|
+
lottie__default["default"].stop('scan');
|
|
26235
|
+
util.hideElement(scanAnimationContainer);
|
|
26236
|
+
if (toastManualCapture) {
|
|
26237
|
+
toastManualCapture.clear();
|
|
26238
|
+
}
|
|
26239
|
+
return rxjs.from(type === idRecognition.EAuthMeCardClass.Passport && config.ocrConfig.disablePassportConfirm ? rxjs.of(false) : checkConfirmImageManual(canvasSizeInfo)).pipe(rxjs.switchMap(needRetry => {
|
|
26240
|
+
util.startSpinner(translateService.translate('sdk.general.uploading'));
|
|
26241
|
+
if (needRetry) {
|
|
26242
|
+
util.hideElement(confirmImageContainer);
|
|
26243
|
+
util.hideElement(confirmContainer);
|
|
26244
|
+
util.stopSpinner();
|
|
26245
|
+
showVideoElement();
|
|
26246
|
+
lottie__default["default"].play('scan');
|
|
26247
|
+
util.showElement(scanAnimationContainer);
|
|
26248
|
+
}
|
|
26249
|
+
return needRetry ? rxjs.of(true) : rxjs.from(config.confirmImage({
|
|
26250
|
+
type,
|
|
26251
|
+
cardType,
|
|
26252
|
+
imageData: util.dataURItoBlob(image.toDataURL('image/jpeg', 0.85)),
|
|
26253
|
+
manual: true
|
|
26254
|
+
})).pipe(rxjs.tap(() => sendStatusAction$1(core.StatusAction.Uploading)), rxjs.map(confirmResp => !confirmResp));
|
|
26255
|
+
}), rxjs.switchMap(needRetry => {
|
|
26256
|
+
if (needRetry) {
|
|
26257
|
+
ocrSendFrameAnimation = false;
|
|
26258
|
+
return recognition(true).pipe(rxjs.map(() => true));
|
|
26259
|
+
} else {
|
|
26260
|
+
util.hideElement(captureBtn);
|
|
26261
|
+
util.hideElement(confirmImageContainer);
|
|
26262
|
+
util.hideElement(confirmContainer);
|
|
26263
|
+
util.stopSpinner();
|
|
26264
|
+
showVideoElement();
|
|
26265
|
+
lottie__default["default"].play('scan');
|
|
26266
|
+
util.showElement(scanAnimationContainer);
|
|
26267
|
+
return rxjs.of(true);
|
|
26268
|
+
}
|
|
26269
|
+
}), rxjs.map(confirmResp => confirmResp));
|
|
26270
|
+
}));
|
|
26271
|
+
};
|
|
26272
|
+
setCardBorderColor(null);
|
|
26273
|
+
let ocrSendFrameAnimation = false;
|
|
26274
|
+
const handleOcrSendFrame = (canvasSizeInfo, canvas, video, frameCallback, fps, bas64Format, imageType, cardType, type) => source$ => {
|
|
26275
|
+
let received = true;
|
|
26276
|
+
const ctx = canvas.getContext('2d');
|
|
26277
|
+
return source$.pipe(rxjs.mergeMap(() => rxjs.animationFrames().pipe(limitFPS(fps), rxjs.filter(() => received && !ocrSendFrameAnimation), rxjs.tap(() => received = false), rxjs.tap(() => util.clearCanvas(canvas)), rxjs.map(() => util.getImageData(canvas, ctx, video, canvasSizeInfo, bas64Format, imageType)), rxjs.mergeMap(imageData => rxjs.from(frameCallback(imageData.data, imageData.base64, cardType, type)).pipe(rxjs.catchError(e => {
|
|
26278
|
+
// send to fast, ignore
|
|
26279
|
+
if (e instanceof core.AuthmeError && e.code === core.ErrorCode.RECOGNITION_NOT_AVAILABLE) {
|
|
26280
|
+
return rxjs.EMPTY;
|
|
26281
|
+
}
|
|
26282
|
+
throw e;
|
|
26283
|
+
}), rxjs.filter(x => !!x), rxjs.map(result => ({
|
|
26284
|
+
imageData,
|
|
26285
|
+
result
|
|
26286
|
+
})), rxjs.tap(() => received = true))))));
|
|
26287
|
+
};
|
|
26288
|
+
const autoCapture = canvasSizeInfo => {
|
|
26289
|
+
return rxjs.of(canvasSizeInfo).pipe(handleOcrSendFrame(canvasSizeInfo, image, video, config.recognition, 30, false, 'jpg', cardType, type), rxjs.tap(x => applyTextByResult(x.result)), rxjs.filter(({
|
|
26290
|
+
result
|
|
26291
|
+
}) => result.eStatus === idRecognition.EAuthMeCardOCRStatus.Pass || result.eStatus === idRecognition.EAuthMeMRZServiceStatus.Success), rxjs.take(1), rxjs.tap(() => {
|
|
26292
|
+
if (countdownCaptureTimer && countdownCaptureTimer.end && !countdownCaptureTimer.end()) {
|
|
26293
|
+
const remainingCountTime = Math.floor(countdownCaptureTimer.pause());
|
|
26294
|
+
captureTimeoutTimer = remainingCountTime;
|
|
26295
|
+
}
|
|
26296
|
+
setCardBorderColor('pass');
|
|
26297
|
+
statusText.textContent = translateService.translate('sdk.general.verify.success');
|
|
26298
|
+
lottie__default["default"].stop('scan');
|
|
26299
|
+
if (toastManualCapture) {
|
|
26300
|
+
toastManualCapture.clear();
|
|
26301
|
+
}
|
|
26302
|
+
util.hideElement(scanAnimationContainer);
|
|
26303
|
+
}), rxjs.switchMap(resp => rxjs.of(true).pipe(rxjs.tap(() => {
|
|
26304
|
+
util.hideElement(scanAnimationContainer);
|
|
26305
|
+
}), rxjs.map(() => resp))), rxjs.switchMap(({
|
|
26306
|
+
result
|
|
26307
|
+
}) => rxjs.from(type === idRecognition.EAuthMeCardClass.Passport && config.ocrConfig.disablePassportConfirm ? rxjs.of(false) : checkConfirmImage(result.imageData, result.iWidth, result.iHeight)).pipe(rxjs.switchMap(needRetry => {
|
|
26308
|
+
if (countdownCaptureTimer && countdownCaptureTimer.end) {
|
|
26309
|
+
if (needRetry && !countdownCaptureTimer.end()) {
|
|
26310
|
+
countdownCaptureTimer = countdownTimer(captureTimeoutTimer, () => {
|
|
26311
|
+
util.showElement(captureBtn);
|
|
26312
|
+
toastManualCapture = toast({
|
|
26313
|
+
message: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_19494_3109)"><path d="M19.5 19.5H4.5C4.10218 19.5 3.72064 19.342 3.43934 19.0607C3.15804 18.7794 3 18.3978 3 18V7.5C3 7.10218 3.15804 6.72064 3.43934 6.43934C3.72064 6.15804 4.10218 6 4.5 6H7.5L9 3.75H15L16.5 6H19.5C19.8978 6 20.2794 6.15804 20.5607 6.43934C20.842 6.72064 21 7.10218 21 7.5V18C21 18.3978 20.842 18.7794 20.5607 19.0607C20.2794 19.342 19.8978 19.5 19.5 19.5Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 15.75C13.864 15.75 15.375 14.239 15.375 12.375C15.375 10.511 13.864 9 12 9C10.136 9 8.625 10.511 8.625 12.375C8.625 14.239 10.136 15.75 12 15.75Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></g><defs><clipPath id="clip0_19494_3109"><rect width="24" height="24" fill="white"/></clipPath></defs></svg>' + translateService.translate('sdk.general.manualCapture'),
|
|
26314
|
+
transition: true
|
|
26315
|
+
});
|
|
26316
|
+
});
|
|
26317
|
+
countdownCaptureTimer.init();
|
|
26318
|
+
}
|
|
26319
|
+
if (!needRetry) {
|
|
26320
|
+
countdownCaptureTimer.clear();
|
|
26321
|
+
util.hideElement(captureBtn);
|
|
26322
|
+
}
|
|
26323
|
+
}
|
|
26324
|
+
util.startSpinner(translateService.translate('sdk.general.uploading'));
|
|
26325
|
+
return needRetry ? rxjs.of(true) : rxjs.from(config.confirmImage({
|
|
26326
|
+
type,
|
|
26327
|
+
cardType
|
|
26328
|
+
})).pipe(rxjs.tap(() => sendStatusAction$1(core.StatusAction.Uploading)), rxjs.map(confirmResp => !confirmResp));
|
|
26329
|
+
}), rxjs.tap(() => {
|
|
26330
|
+
util.hideElement(confirmImageContainer);
|
|
26331
|
+
util.hideElement(confirmContainer);
|
|
26332
|
+
util.stopSpinner();
|
|
26333
|
+
showVideoElement();
|
|
26334
|
+
}), rxjs.switchMap(needRetry => needRetry ? recognition(true) : rxjs.of(true)))));
|
|
26335
|
+
};
|
|
26336
|
+
const recognition = retry => {
|
|
26337
|
+
return init(retry).pipe(rxjs.tap(() => {
|
|
26338
|
+
setStatusView(core.StatusView.Running);
|
|
26339
|
+
if (ocrEngineConfig.expiredIn && !sdkFlowTimeout) {
|
|
26340
|
+
sdkFlowTimeout = makeSDKFlowTimeout(ocrEngineConfig.expiredIn);
|
|
26341
|
+
}
|
|
26342
|
+
}), rxjs.switchMap(canvasSizeInfo => {
|
|
26343
|
+
if (type !== idRecognition.EAuthMeCardClass.Passport && !retry) {
|
|
26344
|
+
if (ocrEngineConfig.captureTimeout > 0) {
|
|
26345
|
+
countdownCaptureTimer = countdownTimer(ocrEngineConfig.captureTimeout, () => {
|
|
26346
|
+
util.showElement(captureBtn);
|
|
26347
|
+
toastManualCapture = toast({
|
|
26348
|
+
message: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_19494_3109)"><path d="M19.5 19.5H4.5C4.10218 19.5 3.72064 19.342 3.43934 19.0607C3.15804 18.7794 3 18.3978 3 18V7.5C3 7.10218 3.15804 6.72064 3.43934 6.43934C3.72064 6.15804 4.10218 6 4.5 6H7.5L9 3.75H15L16.5 6H19.5C19.8978 6 20.2794 6.15804 20.5607 6.43934C20.842 6.72064 21 7.10218 21 7.5V18C21 18.3978 20.842 18.7794 20.5607 19.0607C20.2794 19.342 19.8978 19.5 19.5 19.5Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 15.75C13.864 15.75 15.375 14.239 15.375 12.375C15.375 10.511 13.864 9 12 9C10.136 9 8.625 10.511 8.625 12.375C8.625 14.239 10.136 15.75 12 15.75Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></g><defs><clipPath id="clip0_19494_3109"><rect width="24" height="24" fill="white"/></clipPath></defs></svg>' + translateService.translate('sdk.general.manualCapture'),
|
|
26349
|
+
transition: true
|
|
26350
|
+
});
|
|
26351
|
+
});
|
|
26352
|
+
countdownCaptureTimer.init();
|
|
26353
|
+
return rxjs.race(manualCapture(false), autoCapture(canvasSizeInfo));
|
|
26354
|
+
}
|
|
26355
|
+
if (ocrEngineConfig.captureTimeout === 0) {
|
|
26356
|
+
return rxjs.race(manualCapture(true), autoCapture(canvasSizeInfo));
|
|
26357
|
+
}
|
|
26358
|
+
}
|
|
26359
|
+
return autoCapture(canvasSizeInfo);
|
|
26360
|
+
}));
|
|
26361
|
+
};
|
|
26162
26362
|
return recognition(false);
|
|
26163
26363
|
}
|
|
26164
26364
|
function createFlowByType(type, cardType, cardTypeConfig) {
|
|
@@ -26171,7 +26371,7 @@ function startOCR(config) {
|
|
|
26171
26371
|
setUIByType(type, cardType);
|
|
26172
26372
|
}), rxjs.switchMap(() => {
|
|
26173
26373
|
if (type === idRecognition.EAuthMeCardClass.TWN_IDCard_Front && config.ocrConfig.needAntiFraud) {
|
|
26174
|
-
return rxjs.from(startAntiFraud(type)).pipe(rxjs.switchMap(() => {
|
|
26374
|
+
return rxjs.from(startAntiFraud(type, cardType)).pipe(rxjs.switchMap(() => {
|
|
26175
26375
|
hideFrameUI(false);
|
|
26176
26376
|
return startOCR(type, cardType);
|
|
26177
26377
|
}));
|
|
@@ -26183,7 +26383,7 @@ function startOCR(config) {
|
|
|
26183
26383
|
thicknessStart: config.thicknessStart,
|
|
26184
26384
|
onThicknessFrame: config.onThicknessFrame,
|
|
26185
26385
|
confirmThickness: config.confirmThickness
|
|
26186
|
-
}, cardRotateByStage, getCardBorderPoint, setBorderType, setBorderSuccess, scanAnimationContainer,
|
|
26386
|
+
}, cardRotateByStage, getCardBorderPoint, setBorderType, setBorderSuccess, scanAnimationContainer, successContainer, frameImage, frameText, facingMode, ocrEngineConfig, sdkFlowTimeout, makeSDKFlowTimeout, image, video, retryBtn, completeBtn, confirmImageContainer, confirmContainer);
|
|
26187
26387
|
} else if (cardType.toLocaleLowerCase().includes('front')) {
|
|
26188
26388
|
hideFrameUI(false);
|
|
26189
26389
|
return startOCR(type, cardType);
|
|
@@ -26284,6 +26484,10 @@ function startOCR(config) {
|
|
|
26284
26484
|
}), rxjs.takeUntil(unsubscribe$), rxjs.finalize(() => {
|
|
26285
26485
|
document.body.removeChild(container);
|
|
26286
26486
|
sendStatusAction$1(core.StatusAction.BtnClose);
|
|
26487
|
+
countdownCaptureTimer && countdownCaptureTimer.clear && countdownCaptureTimer.clear();
|
|
26488
|
+
if (toastManualCapture) {
|
|
26489
|
+
toastManualCapture.clear();
|
|
26490
|
+
}
|
|
26287
26491
|
}));
|
|
26288
26492
|
const detectScreenResizeError$ = handleScreenResizeError$(detectScreenResize$(), unsubscribe$, () => !flags.onConfirm);
|
|
26289
26493
|
return rxjs.merge(flow$, cancel$, detectScreenResizeError$, timeout$).pipe(rxjs.take(1));
|
|
@@ -26302,7 +26506,7 @@ function startOCR(config) {
|
|
|
26302
26506
|
util.showElement(lottieMask);
|
|
26303
26507
|
setHeaderText(translateService.translate('verify.idCard'), translateService.translate('sdk.verify.header.stepper', {
|
|
26304
26508
|
current: 1,
|
|
26305
|
-
total:
|
|
26509
|
+
total: stepTotal()
|
|
26306
26510
|
}));
|
|
26307
26511
|
lottie__default["default"].loadAnimation({
|
|
26308
26512
|
container: antiFraudInstructionAnimationContainer,
|
|
@@ -26356,6 +26560,7 @@ function startOCR(config) {
|
|
|
26356
26560
|
rxjs.tap(() => sendStatusAction$1(core.StatusAction.Show));
|
|
26357
26561
|
showVideoElement(false);
|
|
26358
26562
|
util.showElement(confirmImageContainer);
|
|
26563
|
+
util.showElement(confirmContainer);
|
|
26359
26564
|
if (data) {
|
|
26360
26565
|
const ctx2 = image.getContext('2d');
|
|
26361
26566
|
image.width = width;
|
|
@@ -26404,7 +26609,7 @@ function startOCR(config) {
|
|
|
26404
26609
|
}
|
|
26405
26610
|
function setUIByType(type, cardType) {
|
|
26406
26611
|
setTextByType(type, cardType);
|
|
26407
|
-
setHeaderByType(
|
|
26612
|
+
setHeaderByType(cardType);
|
|
26408
26613
|
setCardSize(type);
|
|
26409
26614
|
}
|
|
26410
26615
|
function setTextByType(type, cardType) {
|
|
@@ -26452,46 +26657,25 @@ function startOCR(config) {
|
|
|
26452
26657
|
}
|
|
26453
26658
|
imageTypeText.textContent = translateService.translate(titleConfirmKey !== null && titleConfirmKey !== void 0 ? titleConfirmKey : 'verify.confirm.unexpected');
|
|
26454
26659
|
}
|
|
26455
|
-
|
|
26456
|
-
|
|
26457
|
-
|
|
26458
|
-
|
|
26459
|
-
EAuthMeCardClass_TWN_IDCard_Back: 'sdk.verify.idCard.header',
|
|
26460
|
-
EAuthMeCardClass_TWN_DriverLicense_Front: 'sdk.verify.driverLicense.header',
|
|
26461
|
-
EAuthMeCardClass_TWN_DriverLicense_Back: 'sdk.verify.driverLicense.header',
|
|
26462
|
-
EAuthMeCardClass_TWN_HealthCard_Front: 'sdk.verify.healthCard.header',
|
|
26463
|
-
EAuthMeCardClass_JPN_IDCard_Front: 'sdk.verify.myNumberCard.header',
|
|
26464
|
-
EAuthMeCardClass_JPN_IDCard_Back: 'sdk.verify.myNumberCard.header',
|
|
26465
|
-
EAuthMeCardClass_JPN_IDCard_Thickness: 'sdk.verify.myNumberCard.header',
|
|
26466
|
-
EAuthMeCardClass_TWN_ResidentCard_Front: 'sdk.verify.residentCard.header',
|
|
26467
|
-
EAuthMeCardClass_TWN_ResidentCard_Back: 'sdk.verify.residentCard.header'
|
|
26468
|
-
};
|
|
26469
|
-
if (type.includes('Health') || type.includes('Passport')) {
|
|
26470
|
-
setHeaderText(translateService.translate(typeMap[type]), translateService.translate('sdk.verify.header.stepper', {
|
|
26471
|
-
current: 1,
|
|
26472
|
-
total: 1
|
|
26473
|
-
}));
|
|
26474
|
-
} else {
|
|
26475
|
-
if (type.includes('Front')) {
|
|
26476
|
-
const stepNow = type.includes('TWN_IDCard') ? translateService.translate('sdk.verify.header.stepper', {
|
|
26477
|
-
current: 2,
|
|
26478
|
-
total: 3
|
|
26479
|
-
}) : translateService.translate('sdk.verify.header.stepper', {
|
|
26480
|
-
current: 1,
|
|
26481
|
-
total: 2
|
|
26482
|
-
});
|
|
26483
|
-
setHeaderText(translateService.translate(typeMap[type]), stepNow);
|
|
26484
|
-
} else {
|
|
26485
|
-
const stepNow = type.includes('TWN_IDCard') ? translateService.translate('sdk.verify.header.stepper', {
|
|
26486
|
-
current: 3,
|
|
26487
|
-
total: 3
|
|
26488
|
-
}) : translateService.translate('sdk.verify.header.stepper', {
|
|
26489
|
-
current: 2,
|
|
26490
|
-
total: 2
|
|
26491
|
-
});
|
|
26492
|
-
setHeaderText(translateService.translate(typeMap[type]), stepNow);
|
|
26493
|
-
}
|
|
26660
|
+
const stepTotal = () => {
|
|
26661
|
+
let total = config.cardTypes.length;
|
|
26662
|
+
if (config.ocrConfig.needAntiFraud) {
|
|
26663
|
+
total = total + 1;
|
|
26494
26664
|
}
|
|
26665
|
+
return total;
|
|
26666
|
+
};
|
|
26667
|
+
const setpCurrent = type => {
|
|
26668
|
+
let current = config.cardTypes.indexOf(type) + 1;
|
|
26669
|
+
if (isTutorialFinish) {
|
|
26670
|
+
current++;
|
|
26671
|
+
}
|
|
26672
|
+
return current;
|
|
26673
|
+
};
|
|
26674
|
+
function setHeaderByType(cardType) {
|
|
26675
|
+
setHeaderText(translateService.translate(idRecognition.cardTypeHeader(cardType)), translateService.translate('sdk.verify.header.stepper', {
|
|
26676
|
+
current: setpCurrent(cardType),
|
|
26677
|
+
total: stepTotal()
|
|
26678
|
+
}));
|
|
26495
26679
|
}
|
|
26496
26680
|
function setCardSize(type) {
|
|
26497
26681
|
var _a, _b;
|
|
@@ -26500,17 +26684,22 @@ function startOCR(config) {
|
|
|
26500
26684
|
CARD_SIZE[CARD_SIZE["MAX_WIDTH_RATE"] = 0.95] = "MAX_WIDTH_RATE";
|
|
26501
26685
|
CARD_SIZE[CARD_SIZE["MAX_HEIGHT_RATE"] = 0.6] = "MAX_HEIGHT_RATE";
|
|
26502
26686
|
CARD_SIZE[CARD_SIZE["MAX_HEIGHT_RATE_IPHONE14PRO"] = 0.235] = "MAX_HEIGHT_RATE_IPHONE14PRO";
|
|
26687
|
+
CARD_SIZE[CARD_SIZE["POSSPORT_MAX_WIDTH_RATE"] = 0.9] = "POSSPORT_MAX_WIDTH_RATE";
|
|
26503
26688
|
CARD_SIZE[CARD_SIZE["DRIVER_LICENSE_RATIO"] = 1.4166666666666667] = "DRIVER_LICENSE_RATIO";
|
|
26504
26689
|
CARD_SIZE[CARD_SIZE["ID_CARD_RATIO"] = 1.5740740740740742] = "ID_CARD_RATIO";
|
|
26505
26690
|
CARD_SIZE[CARD_SIZE["PASSPORT_RATIO"] = 1.4597701149425288] = "PASSPORT_RATIO";
|
|
26506
26691
|
})(CARD_SIZE || (CARD_SIZE = {}));
|
|
26507
26692
|
let heightRate = CARD_SIZE.MAX_HEIGHT_RATE;
|
|
26693
|
+
let widthRate = CARD_SIZE.MAX_WIDTH_RATE;
|
|
26508
26694
|
if (util.isIphone14proOrProMax() && config.ocrConfig.hotfixIphone14proCameraBlur) {
|
|
26509
26695
|
heightRate = CARD_SIZE.MAX_HEIGHT_RATE_IPHONE14PRO;
|
|
26510
26696
|
}
|
|
26697
|
+
if (type === idRecognition.EAuthMeCardClass.Passport) {
|
|
26698
|
+
widthRate = CARD_SIZE.POSSPORT_MAX_WIDTH_RATE;
|
|
26699
|
+
}
|
|
26511
26700
|
const windowWidth = window.innerWidth;
|
|
26512
26701
|
const windowHeight = window.innerHeight;
|
|
26513
|
-
const maxWidth = windowWidth *
|
|
26702
|
+
const maxWidth = windowWidth * widthRate;
|
|
26514
26703
|
const maxHeight = windowHeight * heightRate;
|
|
26515
26704
|
let ratio = CARD_SIZE.ID_CARD_RATIO;
|
|
26516
26705
|
if (type === idRecognition.EAuthMeCardClass.TWN_DriverLicense_Back || type === idRecognition.EAuthMeCardClass.TWN_DriverLicense_Front) {
|
|
@@ -26565,8 +26754,15 @@ function startOCR(config) {
|
|
|
26565
26754
|
} = renderCameraSwitch({
|
|
26566
26755
|
container: videoContainer
|
|
26567
26756
|
});
|
|
26757
|
+
let hint = true;
|
|
26568
26758
|
cameraHint.innerHTML = translateService.translate('sdk.general.verify.error.switchCamera');
|
|
26569
26759
|
cameraSwitchContainer.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
|
|
26760
|
+
if (hint) {
|
|
26761
|
+
setTimeout(() => {
|
|
26762
|
+
cameraHint.outerHTML = '';
|
|
26763
|
+
hint = false;
|
|
26764
|
+
}, 300);
|
|
26765
|
+
}
|
|
26570
26766
|
const _nextCameraNumber = parseInt(switchText.textContent) + 1;
|
|
26571
26767
|
const nextCameraNumber = _nextCameraNumber > backCameraList.length ? 1 : _nextCameraNumber;
|
|
26572
26768
|
switchText.textContent = (nextCameraNumber > backCameraList.length ? 1 : nextCameraNumber) + '';
|
|
@@ -26693,6 +26889,8 @@ const renderExtraUI = config => {
|
|
|
26693
26889
|
// Set init text
|
|
26694
26890
|
titleText.innerHTML = translateService.translate('extra.title');
|
|
26695
26891
|
// Picture
|
|
26892
|
+
const confirmContainer = document.createElement('div');
|
|
26893
|
+
confirmContainer.classList.add('confirm_container');
|
|
26696
26894
|
const confirmImageContainer = document.createElement('div');
|
|
26697
26895
|
confirmImageContainer.classList.add('confirm-image-container', 'confirm-image-container-extra');
|
|
26698
26896
|
const confirmImageWapper = document.createElement('div');
|
|
@@ -26724,7 +26922,8 @@ const renderExtraUI = config => {
|
|
|
26724
26922
|
confirmImageWapper.appendChild(imageContainer);
|
|
26725
26923
|
//confirmImageContainer.appendChild(imageLineLineDesktop);
|
|
26726
26924
|
confirmImageWapper.appendChild(imageFooter);
|
|
26727
|
-
|
|
26925
|
+
confirmContainer.appendChild(confirmImageContainer);
|
|
26926
|
+
config.container.appendChild(confirmContainer);
|
|
26728
26927
|
// Other picture
|
|
26729
26928
|
const checkOtherImageContainer = document.createElement('div');
|
|
26730
26929
|
checkOtherImageContainer.classList.add('check-other-image-container', 'check-other-image-container-extra');
|
|
@@ -26754,6 +26953,7 @@ const renderExtraUI = config => {
|
|
|
26754
26953
|
titleTextPanel,
|
|
26755
26954
|
titleText,
|
|
26756
26955
|
confirmImageContainer,
|
|
26956
|
+
confirmContainer,
|
|
26757
26957
|
checkOtherImageContainer,
|
|
26758
26958
|
imageTypeText,
|
|
26759
26959
|
retryBtn,
|
|
@@ -26789,6 +26989,7 @@ function startExtra(config) {
|
|
|
26789
26989
|
const {
|
|
26790
26990
|
titleTextPanel,
|
|
26791
26991
|
confirmImageContainer,
|
|
26992
|
+
confirmContainer,
|
|
26792
26993
|
checkOtherImageContainer,
|
|
26793
26994
|
retryBtn,
|
|
26794
26995
|
completeBtn,
|
|
@@ -26832,6 +27033,7 @@ function startExtra(config) {
|
|
|
26832
27033
|
}
|
|
26833
27034
|
showVideoElement();
|
|
26834
27035
|
util.hideElement(confirmImageContainer);
|
|
27036
|
+
util.hideElement(confirmContainer);
|
|
26835
27037
|
}))), rxjs.switchMap(needRetry => needRetry ? rxjs.of(true) : config.extraConfig.continue === false ? reset() : rxjs.from(takeOtherImage()).pipe(rxjs.switchMap(needContinue => needContinue ? rxjs.of(true) : rxjs.of(false)), rxjs.tap(() => {
|
|
26836
27038
|
if (config.extraConfig.border == 'none') {
|
|
26837
27039
|
util.hideElement(cardborderContainer);
|
|
@@ -26873,6 +27075,7 @@ function startExtra(config) {
|
|
|
26873
27075
|
const height = sizeInfo.canvasHeight;
|
|
26874
27076
|
showVideoElement(false);
|
|
26875
27077
|
util.showElement(confirmImageContainer);
|
|
27078
|
+
util.showElement(confirmContainer);
|
|
26876
27079
|
const ctx2 = image.getContext('2d');
|
|
26877
27080
|
image.width = width;
|
|
26878
27081
|
image.height = height;
|
|
@@ -27408,7 +27611,6 @@ class LivenessModule {
|
|
|
27408
27611
|
function initFrameView(cardPoints, scanId, faceMode, scanView, cardType, cardTypeConfig, setBorderType, setCardBorderColor, setBorderSuccess) {
|
|
27409
27612
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27410
27613
|
const scanAnimationContainer = document.querySelector('.scan');
|
|
27411
|
-
const successAnimationDom = document.querySelector('.success');
|
|
27412
27614
|
document.querySelector('#authme_frame_border');
|
|
27413
27615
|
const videoContainer = document.querySelector('.video-container');
|
|
27414
27616
|
const windowWidth = videoContainer.offsetWidth;
|
|
@@ -27416,9 +27618,6 @@ function initFrameView(cardPoints, scanId, faceMode, scanView, cardType, cardTyp
|
|
|
27416
27618
|
const lottieScanSetting = {
|
|
27417
27619
|
scanAnimationContainer: scanAnimationContainer
|
|
27418
27620
|
};
|
|
27419
|
-
const lottieSuccessSetting = {
|
|
27420
|
-
animationContainer: successAnimationDom
|
|
27421
|
-
};
|
|
27422
27621
|
function frameImage(faceMode, zIndex, base64, color, opacity) {
|
|
27423
27622
|
color = color !== null && color !== void 0 ? color : OcrFrame.imageColor;
|
|
27424
27623
|
opacity = opacity !== null && opacity !== void 0 ? opacity : OcrFrame.imageOpacity;
|
|
@@ -27495,7 +27694,6 @@ function initFrameView(cardPoints, scanId, faceMode, scanView, cardType, cardTyp
|
|
|
27495
27694
|
`);
|
|
27496
27695
|
dom.textContent = text;
|
|
27497
27696
|
}
|
|
27498
|
-
initSuccessAnimation(lottieSuccessSetting);
|
|
27499
27697
|
const scanViewSetting = {
|
|
27500
27698
|
document_type: '',
|
|
27501
27699
|
border: {
|
|
@@ -27701,6 +27899,29 @@ class MRZModule {
|
|
|
27701
27899
|
// 2. 由於 engine-lib 限制,getFinalResult 必須要在 stop 之後呼叫。
|
|
27702
27900
|
const finalResult = yield this.mrzService.getFinalResult();
|
|
27703
27901
|
latestTField = JSON.parse(yield this.mrzService.toJson(finalResult));
|
|
27902
|
+
if (latestTField['birthDateCheckDigit']) {
|
|
27903
|
+
delete latestTField['birthDateCheckDigit'];
|
|
27904
|
+
}
|
|
27905
|
+
if (latestTField['documentNumberCheckDigit']) {
|
|
27906
|
+
delete latestTField['documentNumberCheckDigit'];
|
|
27907
|
+
}
|
|
27908
|
+
if (latestTField['expiryDateCheckDigit']) {
|
|
27909
|
+
delete latestTField['expiryDateCheckDigit'];
|
|
27910
|
+
}
|
|
27911
|
+
if (latestTField['optionaldataCheckDigit']) {
|
|
27912
|
+
delete latestTField['optionaldataCheckDigit'];
|
|
27913
|
+
}
|
|
27914
|
+
if (latestTField['overallCheckDigit']) {
|
|
27915
|
+
delete latestTField['overallCheckDigit'];
|
|
27916
|
+
}
|
|
27917
|
+
switch (latestTField.gender) {
|
|
27918
|
+
case 'M':
|
|
27919
|
+
latestTField.gender = 'male';
|
|
27920
|
+
break;
|
|
27921
|
+
case 'F':
|
|
27922
|
+
latestTField.gender = 'female';
|
|
27923
|
+
break;
|
|
27924
|
+
}
|
|
27704
27925
|
} else if (uploadFullFrame) {
|
|
27705
27926
|
const image = util.UintArrayToBlob(frameWidth, frameHeight, data, virtualCanvas);
|
|
27706
27927
|
const requestImg = yield encryptImageBase64(image);
|
|
@@ -27716,14 +27937,14 @@ class MRZModule {
|
|
|
27716
27937
|
});
|
|
27717
27938
|
}
|
|
27718
27939
|
}),
|
|
27719
|
-
confirmImage:
|
|
27720
|
-
const docId = docInfos[type].docId;
|
|
27940
|
+
confirmImage: option => __awaiter(this, void 0, void 0, function* () {
|
|
27941
|
+
const docId = docInfos[option.type].docId;
|
|
27721
27942
|
if (docId) {
|
|
27722
|
-
docInfos[type].docId = '';
|
|
27723
|
-
const requestImg = yield encryptImageBase64(docInfos[type].ocrOriginImg);
|
|
27943
|
+
docInfos[option.type].docId = '';
|
|
27944
|
+
const requestImg = yield encryptImageBase64(docInfos[option.type].ocrOriginImg);
|
|
27724
27945
|
const report = yield this.mrzService.getReport();
|
|
27725
27946
|
yield SendRequestWithRetry$1(() => idRecognition.uploadFrameBase64(docId, requestImg, frameIndex++, idRecognition.ResourceImageType.Recognition, report));
|
|
27726
|
-
yield SendRequestWithRetry$1(() => idRecognition.finishScanDocument(docId, latestTField !== null && latestTField !== void 0 ? latestTField : {}, docInfos[type].fraudResult));
|
|
27947
|
+
yield SendRequestWithRetry$1(() => idRecognition.finishScanDocument(docId, latestTField !== null && latestTField !== void 0 ? latestTField : {}, docInfos[option.type].fraudResult));
|
|
27727
27948
|
return true;
|
|
27728
27949
|
} else {
|
|
27729
27950
|
return false;
|
|
@@ -28048,7 +28269,8 @@ class OCRModule {
|
|
|
28048
28269
|
}
|
|
28049
28270
|
yield util.waitTime(100);
|
|
28050
28271
|
return Object.assign(Object.assign({}, resp.parameters), {
|
|
28051
|
-
expiredIn: resp.expiredIn
|
|
28272
|
+
expiredIn: resp.expiredIn,
|
|
28273
|
+
captureTimeout: config.captureTimeout
|
|
28052
28274
|
});
|
|
28053
28275
|
}),
|
|
28054
28276
|
ocrStart: (points, type, setBorderType, setCardBorderColor, setBorderSuccess, scanAnimationContainer, successAnimationContainer, frameImage, frameText, faceMode, cardType, retry = false) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -28095,10 +28317,6 @@ class OCRModule {
|
|
|
28095
28317
|
const lottieScanSetting = {
|
|
28096
28318
|
scanAnimationContainer: scanAnimationContainer
|
|
28097
28319
|
};
|
|
28098
|
-
const lottieSuccessSetting = {
|
|
28099
|
-
animationContainer: successAnimationContainer
|
|
28100
|
-
};
|
|
28101
|
-
initSuccessAnimation(lottieSuccessSetting);
|
|
28102
28320
|
const scanViewSetting = {
|
|
28103
28321
|
document_type: '',
|
|
28104
28322
|
border: {
|
|
@@ -28174,8 +28392,9 @@ class OCRModule {
|
|
|
28174
28392
|
newParams['timeoutSec'] = 1000;
|
|
28175
28393
|
newParams['fCardMatchTh'] = 0.5;
|
|
28176
28394
|
newParams['fImageReflectiveTriggerTh'] = 0.15;
|
|
28177
|
-
newParams['fImageThicknessTh'] = 0.
|
|
28178
|
-
newParams['fCardDeformationTh'] =
|
|
28395
|
+
newParams['fImageThicknessTh'] = 0.4;
|
|
28396
|
+
newParams['fCardDeformationTh'] = 10;
|
|
28397
|
+
newParams['enableCardInROI'] = 1;
|
|
28179
28398
|
yield _service.setParams(Object.assign(Object.assign({}, oldParams), newParams));
|
|
28180
28399
|
_service.setOption({
|
|
28181
28400
|
key: 'thickness_detector',
|
|
@@ -28216,10 +28435,6 @@ class OCRModule {
|
|
|
28216
28435
|
const lottieScanSetting = {
|
|
28217
28436
|
scanAnimationContainer: scanAnimationContainer
|
|
28218
28437
|
};
|
|
28219
|
-
const lottieSuccessSetting = {
|
|
28220
|
-
animationContainer: successAnimationContainer
|
|
28221
|
-
};
|
|
28222
|
-
initSuccessAnimation(lottieSuccessSetting);
|
|
28223
28438
|
const scanViewSetting = {
|
|
28224
28439
|
document_type: '',
|
|
28225
28440
|
border: {
|
|
@@ -28445,7 +28660,7 @@ class OCRModule {
|
|
|
28445
28660
|
status: 'confirm',
|
|
28446
28661
|
type: type
|
|
28447
28662
|
});
|
|
28448
|
-
} else if (uploadFullFrame) {
|
|
28663
|
+
} else if (uploadFullFrame && docInfos[eClass].docId !== '') {
|
|
28449
28664
|
const image = ocrOriginImg;
|
|
28450
28665
|
const requestImg = yield encryptImageBase64(image);
|
|
28451
28666
|
// downloadImage(image, `${frameIndex}-${docInfos[type as EAuthMeCardClass].docId}-${new Date().getTime().toString()}.jpg`)
|
|
@@ -28460,7 +28675,7 @@ class OCRModule {
|
|
|
28460
28675
|
durationTimeRecognition.end();
|
|
28461
28676
|
return result;
|
|
28462
28677
|
}),
|
|
28463
|
-
confirmImage:
|
|
28678
|
+
confirmImage: option => __awaiter(this, void 0, void 0, function* () {
|
|
28464
28679
|
// 將二進位圖片進行加密,目前不需要使用,不確定未來是否需要,先註解
|
|
28465
28680
|
// const encryptImage = async (blob: Blob): Promise<Blob> => {
|
|
28466
28681
|
// const imageArrayBuffer = await blobToArrayBuffer(blob);
|
|
@@ -28471,18 +28686,23 @@ class OCRModule {
|
|
|
28471
28686
|
// );
|
|
28472
28687
|
// return base64ToBlob(resultEncrypt);
|
|
28473
28688
|
// };
|
|
28474
|
-
|
|
28689
|
+
if (option.manual) {
|
|
28690
|
+
this.ocrService.stop();
|
|
28691
|
+
}
|
|
28692
|
+
const docId = docInfos[option.cardType].docId;
|
|
28475
28693
|
if (docId) {
|
|
28476
|
-
const needFraudOption = config.needAntiFraud && type === engine.EAuthMeCardClass.TWN_IDCard_Front;
|
|
28694
|
+
const needFraudOption = config.needAntiFraud && option.type === engine.EAuthMeCardClass.TWN_IDCard_Front;
|
|
28477
28695
|
let ocrOriginImg;
|
|
28478
|
-
if (imageData) {
|
|
28479
|
-
ocrOriginImg = imageData;
|
|
28696
|
+
if (option.imageData) {
|
|
28697
|
+
ocrOriginImg = option.imageData;
|
|
28480
28698
|
} else {
|
|
28481
|
-
ocrOriginImg = docInfos[cardType].ocrOriginImg;
|
|
28699
|
+
ocrOriginImg = docInfos[option.cardType].ocrOriginImg;
|
|
28482
28700
|
}
|
|
28701
|
+
// const base64Image = await blobToBase64(ocrOriginImg);
|
|
28702
|
+
// console.log('confirmImage', base64Image);
|
|
28483
28703
|
const requestImg = yield encryptImageBase64(ocrOriginImg);
|
|
28484
28704
|
const report = yield this.ocrService.getReport();
|
|
28485
|
-
docInfos[cardType].docId = '';
|
|
28705
|
+
docInfos[option.cardType].docId = '';
|
|
28486
28706
|
modifyDeubgLog(getDebugLogsLength() - 1, {
|
|
28487
28707
|
report: report
|
|
28488
28708
|
});
|
|
@@ -28490,7 +28710,7 @@ class OCRModule {
|
|
|
28490
28710
|
yield SendRequestWithRetry(() => idRecognition.uploadFrameBase64(docId, requestImg, frameIndex, idRecognition.ResourceImageType.Recognition, report));
|
|
28491
28711
|
frameIndex = 0;
|
|
28492
28712
|
try {
|
|
28493
|
-
const ocrImg = docInfos[cardType].ocrImg;
|
|
28713
|
+
const ocrImg = option.imageData ? option.imageData : docInfos[option.cardType].ocrImg;
|
|
28494
28714
|
const _requestImg = yield encryptImageBase64(ocrImg);
|
|
28495
28715
|
const resp = yield SendRequestWithRetry(() => idRecognition.recognitionEncrypt(docId, _requestImg, report, idRecognition.RecognitionFileType.FlatImage));
|
|
28496
28716
|
if (resp.retry) {
|
|
@@ -28499,12 +28719,12 @@ class OCRModule {
|
|
|
28499
28719
|
}
|
|
28500
28720
|
result = unionMerge(result, resp && resp.details || {});
|
|
28501
28721
|
yield SendRequestWithRetry(() => idRecognition.finishScanDocument(docId, resp.details, needFraudOption ? this.fraudResult : null));
|
|
28502
|
-
delete docInfos[cardType];
|
|
28722
|
+
delete docInfos[option.cardType];
|
|
28503
28723
|
return true;
|
|
28504
28724
|
} catch (error) {
|
|
28505
28725
|
console.log('confirmImage fail,retrying ');
|
|
28506
28726
|
console.error(error);
|
|
28507
|
-
docInfos[cardType].docId = docId;
|
|
28727
|
+
docInfos[option.cardType].docId = docId;
|
|
28508
28728
|
return false;
|
|
28509
28729
|
}
|
|
28510
28730
|
} else {
|
|
@@ -28513,7 +28733,7 @@ class OCRModule {
|
|
|
28513
28733
|
}
|
|
28514
28734
|
}),
|
|
28515
28735
|
ocrCancel: (type, cardType, imageData) => __awaiter(this, void 0, void 0, function* () {
|
|
28516
|
-
const docId = docInfos[cardType].docId;
|
|
28736
|
+
const docId = docInfos[cardType] ? docInfos[cardType].docId : '';
|
|
28517
28737
|
if (docId) {
|
|
28518
28738
|
let ocrOriginImg;
|
|
28519
28739
|
if (imageData) {
|
|
@@ -28533,7 +28753,8 @@ class OCRModule {
|
|
|
28533
28753
|
frameIndex = 0;
|
|
28534
28754
|
return true;
|
|
28535
28755
|
} else {
|
|
28536
|
-
|
|
28756
|
+
yield this.ocrService.stop();
|
|
28757
|
+
console.warn('didnt find docid , retry');
|
|
28537
28758
|
return false;
|
|
28538
28759
|
}
|
|
28539
28760
|
}),
|
|
@@ -28568,10 +28789,6 @@ class OCRModule {
|
|
|
28568
28789
|
fraudResult: null
|
|
28569
28790
|
};
|
|
28570
28791
|
}
|
|
28571
|
-
const lottieSuccessSetting = {
|
|
28572
|
-
animationContainer: successAnimationContainer
|
|
28573
|
-
};
|
|
28574
|
-
initSuccessAnimation(lottieSuccessSetting);
|
|
28575
28792
|
// TODO 等開始處理防偽的時候再處理
|
|
28576
28793
|
// if (resp.scanView && resp.scanView.enable) {
|
|
28577
28794
|
// setBorderType({
|
|
@@ -29115,8 +29332,8 @@ class AuthmeIdentityVerification extends engine.AuthmeFunctionModule {
|
|
|
29115
29332
|
}
|
|
29116
29333
|
|
|
29117
29334
|
var name = "authme/sdk";
|
|
29118
|
-
var version$1 = "2.7.
|
|
29119
|
-
var date = "
|
|
29335
|
+
var version$1 = "2.7.4-patch.1";
|
|
29336
|
+
var date = "2025-08-28T04:22:37+0000";
|
|
29120
29337
|
var packageInfo = {
|
|
29121
29338
|
name: name,
|
|
29122
29339
|
version: version$1,
|