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