@authme/identity-verification 2.8.32 → 2.8.34
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/index.cjs +72 -30
- package/index.js +72 -30
- package/package.json +6 -6
- package/src/lib/ui/ocr.animate.d.ts +2 -2
package/index.cjs
CHANGED
|
@@ -30707,7 +30707,7 @@ function makeStyleTag(styleSetting) {
|
|
|
30707
30707
|
`;
|
|
30708
30708
|
return newStyle;
|
|
30709
30709
|
}
|
|
30710
|
-
function renderCardRotateAnimate(container) {
|
|
30710
|
+
function renderCardRotateAnimate(container, directionTextPanel = null, setAnimationFrameState) {
|
|
30711
30711
|
let animateStop = true;
|
|
30712
30712
|
let stopTimeout = null;
|
|
30713
30713
|
let currentDirection = null;
|
|
@@ -30727,6 +30727,10 @@ function renderCardRotateAnimate(container) {
|
|
|
30727
30727
|
frontArrowSvg.style.zIndex = `var(--authme-layers-2-z-index)`;
|
|
30728
30728
|
cardSvg.appendChild(cardMainGroup);
|
|
30729
30729
|
div.appendChild(cardSvg);
|
|
30730
|
+
// Append directionTextPanel to div.arrow if provided
|
|
30731
|
+
if (directionTextPanel) {
|
|
30732
|
+
div.appendChild(directionTextPanel);
|
|
30733
|
+
}
|
|
30730
30734
|
cardSvg.style.display = 'none';
|
|
30731
30735
|
frontArrowSvg.style.display = 'none';
|
|
30732
30736
|
backArrowSvg.style.display = 'none';
|
|
@@ -30745,6 +30749,10 @@ function renderCardRotateAnimate(container) {
|
|
|
30745
30749
|
clearTimeout(stopTimeout);
|
|
30746
30750
|
stopTimeout = null;
|
|
30747
30751
|
}
|
|
30752
|
+
// 手動調用狀態清理回調,確保在動畫中斷時也能重置 ocrSendFrameAnimation
|
|
30753
|
+
if (setAnimationFrameState) {
|
|
30754
|
+
setAnimationFrameState(false);
|
|
30755
|
+
}
|
|
30748
30756
|
fadeAnimate('out');
|
|
30749
30757
|
return new Promise(resolve => {
|
|
30750
30758
|
setTimeout(() => {
|
|
@@ -31063,9 +31071,8 @@ function renderCardRotateAnimate(container) {
|
|
|
31063
31071
|
}, roundAnimateDuration);
|
|
31064
31072
|
});
|
|
31065
31073
|
}
|
|
31066
|
-
function fadeAnimate(inOrOut
|
|
31074
|
+
function fadeAnimate(inOrOut) {
|
|
31067
31075
|
div.style.opacity = inOrOut === 'in' ? '0.8' : '0';
|
|
31068
|
-
if (directionTextPanel) directionTextPanel.style.display = inOrOut === 'in' ? 'flex' : 'none';
|
|
31069
31076
|
return new Promise(resolve => {
|
|
31070
31077
|
setTimeout(() => {
|
|
31071
31078
|
resolve(true);
|
|
@@ -31074,15 +31081,23 @@ function renderCardRotateAnimate(container) {
|
|
|
31074
31081
|
}
|
|
31075
31082
|
function rotateCard(direction, beforeAnimate = () => {
|
|
31076
31083
|
return;
|
|
31077
|
-
},
|
|
31084
|
+
}, stopOn = -1) {
|
|
31078
31085
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31079
31086
|
// console.log('rotateCard', direction);
|
|
31080
31087
|
animateStop = false;
|
|
31088
|
+
// 停止送圖(動畫開始)
|
|
31089
|
+
if (setAnimationFrameState) {
|
|
31090
|
+
setAnimationFrameState(true);
|
|
31091
|
+
}
|
|
31081
31092
|
stopTimeout = setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
31082
31093
|
if (animateStop) return;
|
|
31083
|
-
yield fadeAnimate('out'
|
|
31094
|
+
yield fadeAnimate('out');
|
|
31084
31095
|
setTimeout(() => {
|
|
31085
31096
|
resetAnimateStatus();
|
|
31097
|
+
// 恢復送圖(動畫結束)
|
|
31098
|
+
if (setAnimationFrameState) {
|
|
31099
|
+
setAnimationFrameState(false);
|
|
31100
|
+
}
|
|
31086
31101
|
}, fadeDuration);
|
|
31087
31102
|
beforeAnimate();
|
|
31088
31103
|
}), stopOn === -1 ? roundAnimateDuration * 2 : stopOn);
|
|
@@ -31091,7 +31106,7 @@ function renderCardRotateAnimate(container) {
|
|
|
31091
31106
|
cardSvg.style.display = 'block';
|
|
31092
31107
|
frontArrowSvg.style.display = 'block';
|
|
31093
31108
|
backArrowSvg.style.display = 'block';
|
|
31094
|
-
yield fadeAnimate('in'
|
|
31109
|
+
yield fadeAnimate('in');
|
|
31095
31110
|
function _rotateCard(direction) {
|
|
31096
31111
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31097
31112
|
switch (direction) {
|
|
@@ -32610,14 +32625,13 @@ function startOCR(config) {
|
|
|
32610
32625
|
function startAntiFraud(type, cardType) {
|
|
32611
32626
|
const animateInterval = 2 * util.TIME_UNIT.SECOND;
|
|
32612
32627
|
const nextAnimateInterval = 6 * util.TIME_UNIT.SECOND;
|
|
32613
|
-
let eStage = null;
|
|
32614
32628
|
let needDeformationCount = 0;
|
|
32615
32629
|
setStatusEvent$1(core.StatusEvent.TWID);
|
|
32616
32630
|
setStatusView(core.StatusView.Init);
|
|
32617
32631
|
if (type !== idRecognition.EAuthMeCardClass.TWN_IDCard_Front || !config.ocrConfig.needAntiFraud) {
|
|
32618
32632
|
return rxjs.of(true);
|
|
32619
32633
|
}
|
|
32620
|
-
const applyTextByResult = result => {
|
|
32634
|
+
const applyTextByResult = result => __awaiter(this, void 0, void 0, function* () {
|
|
32621
32635
|
if (!uiComponentOCRMask.setCardBorderColor) return;
|
|
32622
32636
|
uiComponentOCR.statusText.classList.add('non-empty');
|
|
32623
32637
|
switch (result.eStatus) {
|
|
@@ -32705,13 +32719,11 @@ function startOCR(config) {
|
|
|
32705
32719
|
break;
|
|
32706
32720
|
case idRecognition.EAuthMeIDCardAntiFraudStatus.StagePass:
|
|
32707
32721
|
uiComponentOCR.statusText.textContent = translateService.translate('sdk.general.verify.error.stagePass');
|
|
32708
|
-
stopAnimate();
|
|
32709
32722
|
previosAntiFraudAnimateTime = Date.now();
|
|
32710
32723
|
uiComponentOCRMask.setCardBorderColor('pass');
|
|
32711
|
-
//
|
|
32712
|
-
|
|
32713
|
-
|
|
32714
|
-
}, 2000);
|
|
32724
|
+
// Block execution for 2 seconds to show StagePass state
|
|
32725
|
+
yield new Promise(resolve => setTimeout(resolve, 2000));
|
|
32726
|
+
stopAnimate();
|
|
32715
32727
|
break;
|
|
32716
32728
|
case idRecognition.EAuthMeIDCardAntiFraudStatus.Pass:
|
|
32717
32729
|
uiComponentOCRMask.setCardBorderColor('pass');
|
|
@@ -32739,8 +32751,12 @@ function startOCR(config) {
|
|
|
32739
32751
|
uiComponentOCR.statusText.textContent = '';
|
|
32740
32752
|
uiComponentOCR.statusText.classList.remove('non-empty');
|
|
32741
32753
|
}
|
|
32742
|
-
};
|
|
32743
|
-
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(() =>
|
|
32754
|
+
});
|
|
32755
|
+
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(() => {
|
|
32756
|
+
// 動畫開始時停止送圖
|
|
32757
|
+
ocrSendFrameAnimation = true;
|
|
32758
|
+
return config.antiFraudStart(getCardBorderPoint(), uiComponentOCRMask.setBorderType, uiComponentOCRMask.setCardBorderColor, uiComponentOCRMask.setBorderSuccess, uiComponentOCR.scanAnimationContainer, uiComponentOCR.successContainer, uiComponentOCRMask.frameImage, uiComponentOCRMask.frameText, facingMode);
|
|
32759
|
+
}), rxjs.tap(() => __awaiter(this, void 0, void 0, function* () {
|
|
32744
32760
|
setStatusView(core.StatusView.Aligning);
|
|
32745
32761
|
if (buttonDisable$) {
|
|
32746
32762
|
const cardMatchROI = config.getCardMatchROI ? yield config.getCardMatchROI() : undefined;
|
|
@@ -32750,12 +32766,22 @@ function startOCR(config) {
|
|
|
32750
32766
|
countDownTime = new Date().getTime() + ocrEngineConfig.expiredIn * util.TIME_UNIT.SECOND;
|
|
32751
32767
|
sdkFlowTimeout = makeSDKFlowTimeout(ocrEngineConfig.expiredIn);
|
|
32752
32768
|
}
|
|
32753
|
-
})),
|
|
32754
|
-
|
|
32769
|
+
})),
|
|
32770
|
+
// 反欺詐完成後恢復送圖
|
|
32771
|
+
rxjs.tap(() => {
|
|
32772
|
+
ocrSendFrameAnimation = false;
|
|
32773
|
+
}), sendFrame(canvasSizeInfo, uiComponentOCR.image, uiComponentBasic.video, config.onAntiFraudFrame, ocrEngineConfig.fraudMaxFps, false, 'jpg', undefined,
|
|
32774
|
+
// 使用 sendFrame 內建的 flags 機制來控制動畫時的送圖
|
|
32775
|
+
{
|
|
32776
|
+
get animating() {
|
|
32777
|
+
return ocrSendFrameAnimation;
|
|
32778
|
+
}
|
|
32779
|
+
}), rxjs.map(x => x.result), rxjs.concatMap(x => __awaiter(this, void 0, void 0, function* () {
|
|
32780
|
+
yield applyTextByResult(x);
|
|
32755
32781
|
cardRotateByStage(x.eStage);
|
|
32756
32782
|
if (isTutorialFinish) {
|
|
32757
|
-
|
|
32758
|
-
|
|
32783
|
+
// 文字更新移到 cardRotateAnimationProcess 中,確保與動畫同步
|
|
32784
|
+
x.eStage;
|
|
32759
32785
|
}
|
|
32760
32786
|
if (x.eStage !== currentAntiFraudStage) {
|
|
32761
32787
|
needDeformationCount = 0;
|
|
@@ -32765,7 +32791,8 @@ function startOCR(config) {
|
|
|
32765
32791
|
// if (config.ocrConfig.disableTutorial) {
|
|
32766
32792
|
util.stopSpinner();
|
|
32767
32793
|
}
|
|
32768
|
-
|
|
32794
|
+
return x;
|
|
32795
|
+
})),
|
|
32769
32796
|
// ocrEngineConfig.expiredIn
|
|
32770
32797
|
// ? timeout(ocrEngineConfig.expiredIn * TIME_UNIT.SECOND)
|
|
32771
32798
|
// : tap(),
|
|
@@ -32778,7 +32805,11 @@ function startOCR(config) {
|
|
|
32778
32805
|
rxjs.takeWhile(x => x.eStatus !== idRecognition.EAuthMeIDCardAntiFraudStatus.Pass,
|
|
32779
32806
|
// &&
|
|
32780
32807
|
// x.eStatus !== EAuthMeIDCardAntiFraudStatus.Failed,
|
|
32781
|
-
true)
|
|
32808
|
+
true),
|
|
32809
|
+
// 確保在任何情況下(成功、失敗、取消)都重置 flag
|
|
32810
|
+
rxjs.finalize(() => {
|
|
32811
|
+
ocrSendFrameAnimation = false;
|
|
32812
|
+
}))), rxjs.shareReplay(1));
|
|
32782
32813
|
const handleSuccess$ = antiFraudStart$.pipe(rxjs.filter(x => x.eStatus === idRecognition.EAuthMeIDCardAntiFraudStatus.Pass || x.eStatus === idRecognition.EAuthMeIDCardAntiFraudStatus.Failed), rxjs.take(1), rxjs.tap(() => {
|
|
32783
32814
|
util.hidePopup();
|
|
32784
32815
|
clearAllFraudLottie();
|
|
@@ -32984,11 +33015,14 @@ function startOCR(config) {
|
|
|
32984
33015
|
util.showElement(uiComponentOCR.scanAnimationContainer);
|
|
32985
33016
|
return rxjs.of(true);
|
|
32986
33017
|
}
|
|
32987
|
-
}), rxjs.map(confirmResp => confirmResp)
|
|
33018
|
+
}), rxjs.map(confirmResp => confirmResp),
|
|
33019
|
+
// 確保在任何情況下(成功、失敗、取消)都重置 flag
|
|
33020
|
+
rxjs.finalize(() => {
|
|
33021
|
+
ocrSendFrameAnimation = false;
|
|
33022
|
+
}));
|
|
32988
33023
|
}));
|
|
32989
33024
|
};
|
|
32990
33025
|
uiComponentOCRMask.setCardBorderColor(null);
|
|
32991
|
-
let ocrSendFrameAnimation = false;
|
|
32992
33026
|
const handleOcrSendFrame = (canvasSizeInfo, canvas, video, frameCallback, fps, bas64Format, imageType, cardType, type) => source$ => {
|
|
32993
33027
|
let received = true;
|
|
32994
33028
|
const ctx = canvas.getContext('2d', {
|
|
@@ -33086,6 +33120,7 @@ function startOCR(config) {
|
|
|
33086
33120
|
};
|
|
33087
33121
|
return recognition(false);
|
|
33088
33122
|
}
|
|
33123
|
+
let ocrSendFrameAnimation = false;
|
|
33089
33124
|
function createFlowByType(type, cardType, cardTypeConfig) {
|
|
33090
33125
|
return rxjs.of(true).pipe(rxjs.tap(() => {
|
|
33091
33126
|
currentType('set', {
|
|
@@ -33213,7 +33248,10 @@ function startOCR(config) {
|
|
|
33213
33248
|
})),
|
|
33214
33249
|
container: uiComponentBasic.videoContainer
|
|
33215
33250
|
});
|
|
33216
|
-
const rotateUI = renderCardRotateAnimate(uiComponentOCR.arrowAnimationContainer
|
|
33251
|
+
const rotateUI = renderCardRotateAnimate(uiComponentOCR.arrowAnimationContainer, uiComponentOCR.directionTextPanel, isAnimating => {
|
|
33252
|
+
// 動畫開始時停止送圖,動畫結束時恢復送圖
|
|
33253
|
+
ocrSendFrameAnimation = isAnimating;
|
|
33254
|
+
});
|
|
33217
33255
|
rotateCard = rotateUI.rotateCard;
|
|
33218
33256
|
getIsRotateCardAnimating = rotateUI.getIsRotateCardAnimating;
|
|
33219
33257
|
stopAnimate = rotateUI.stopAnimate;
|
|
@@ -33762,26 +33800,30 @@ function startOCR(config) {
|
|
|
33762
33800
|
}
|
|
33763
33801
|
}
|
|
33764
33802
|
function cardRotateAnimationProcess(stage) {
|
|
33803
|
+
// 在動畫開始前更新文字,確保文字與動畫同步
|
|
33804
|
+
if (isTutorialFinish) {
|
|
33805
|
+
cardRotateTextProcess(stage, true);
|
|
33806
|
+
}
|
|
33765
33807
|
switch (stage) {
|
|
33766
33808
|
case idRecognition.EAuthMeIDCardAntiFraudStage.Left:
|
|
33767
33809
|
rotateCard(facingMode === 'front' ? 'right' : 'left', () => {
|
|
33768
33810
|
previosAntiFraudAnimateTime = Date.now();
|
|
33769
|
-
}
|
|
33811
|
+
});
|
|
33770
33812
|
break;
|
|
33771
33813
|
case idRecognition.EAuthMeIDCardAntiFraudStage.Right:
|
|
33772
33814
|
rotateCard(facingMode === 'front' ? 'left' : 'right', () => {
|
|
33773
33815
|
previosAntiFraudAnimateTime = Date.now();
|
|
33774
|
-
}
|
|
33816
|
+
});
|
|
33775
33817
|
break;
|
|
33776
33818
|
case idRecognition.EAuthMeIDCardAntiFraudStage.Up:
|
|
33777
33819
|
rotateCard('up', () => {
|
|
33778
33820
|
previosAntiFraudAnimateTime = Date.now();
|
|
33779
|
-
}
|
|
33821
|
+
});
|
|
33780
33822
|
break;
|
|
33781
33823
|
case idRecognition.EAuthMeIDCardAntiFraudStage.Down:
|
|
33782
33824
|
rotateCard('down', () => {
|
|
33783
33825
|
previosAntiFraudAnimateTime = Date.now();
|
|
33784
|
-
}
|
|
33826
|
+
});
|
|
33785
33827
|
break;
|
|
33786
33828
|
}
|
|
33787
33829
|
}
|
|
@@ -37247,8 +37289,8 @@ class AuthmeIdentityVerification extends engine.AuthmeFunctionModule {
|
|
|
37247
37289
|
}
|
|
37248
37290
|
|
|
37249
37291
|
var name = "authme/sdk";
|
|
37250
|
-
var version$1 = "2.8.
|
|
37251
|
-
var date = "2025-11-
|
|
37292
|
+
var version$1 = "2.8.34";
|
|
37293
|
+
var date = "2025-11-24T03:00:21+0000";
|
|
37252
37294
|
var packageInfo = {
|
|
37253
37295
|
name: name,
|
|
37254
37296
|
version: version$1,
|
package/index.js
CHANGED
|
@@ -30699,7 +30699,7 @@ function makeStyleTag(styleSetting) {
|
|
|
30699
30699
|
`;
|
|
30700
30700
|
return newStyle;
|
|
30701
30701
|
}
|
|
30702
|
-
function renderCardRotateAnimate(container) {
|
|
30702
|
+
function renderCardRotateAnimate(container, directionTextPanel = null, setAnimationFrameState) {
|
|
30703
30703
|
let animateStop = true;
|
|
30704
30704
|
let stopTimeout = null;
|
|
30705
30705
|
let currentDirection = null;
|
|
@@ -30719,6 +30719,10 @@ function renderCardRotateAnimate(container) {
|
|
|
30719
30719
|
frontArrowSvg.style.zIndex = `var(--authme-layers-2-z-index)`;
|
|
30720
30720
|
cardSvg.appendChild(cardMainGroup);
|
|
30721
30721
|
div.appendChild(cardSvg);
|
|
30722
|
+
// Append directionTextPanel to div.arrow if provided
|
|
30723
|
+
if (directionTextPanel) {
|
|
30724
|
+
div.appendChild(directionTextPanel);
|
|
30725
|
+
}
|
|
30722
30726
|
cardSvg.style.display = 'none';
|
|
30723
30727
|
frontArrowSvg.style.display = 'none';
|
|
30724
30728
|
backArrowSvg.style.display = 'none';
|
|
@@ -30737,6 +30741,10 @@ function renderCardRotateAnimate(container) {
|
|
|
30737
30741
|
clearTimeout(stopTimeout);
|
|
30738
30742
|
stopTimeout = null;
|
|
30739
30743
|
}
|
|
30744
|
+
// 手動調用狀態清理回調,確保在動畫中斷時也能重置 ocrSendFrameAnimation
|
|
30745
|
+
if (setAnimationFrameState) {
|
|
30746
|
+
setAnimationFrameState(false);
|
|
30747
|
+
}
|
|
30740
30748
|
fadeAnimate('out');
|
|
30741
30749
|
return new Promise(resolve => {
|
|
30742
30750
|
setTimeout(() => {
|
|
@@ -31055,9 +31063,8 @@ function renderCardRotateAnimate(container) {
|
|
|
31055
31063
|
}, roundAnimateDuration);
|
|
31056
31064
|
});
|
|
31057
31065
|
}
|
|
31058
|
-
function fadeAnimate(inOrOut
|
|
31066
|
+
function fadeAnimate(inOrOut) {
|
|
31059
31067
|
div.style.opacity = inOrOut === 'in' ? '0.8' : '0';
|
|
31060
|
-
if (directionTextPanel) directionTextPanel.style.display = inOrOut === 'in' ? 'flex' : 'none';
|
|
31061
31068
|
return new Promise(resolve => {
|
|
31062
31069
|
setTimeout(() => {
|
|
31063
31070
|
resolve(true);
|
|
@@ -31066,15 +31073,23 @@ function renderCardRotateAnimate(container) {
|
|
|
31066
31073
|
}
|
|
31067
31074
|
function rotateCard(direction, beforeAnimate = () => {
|
|
31068
31075
|
return;
|
|
31069
|
-
},
|
|
31076
|
+
}, stopOn = -1) {
|
|
31070
31077
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31071
31078
|
// console.log('rotateCard', direction);
|
|
31072
31079
|
animateStop = false;
|
|
31080
|
+
// 停止送圖(動畫開始)
|
|
31081
|
+
if (setAnimationFrameState) {
|
|
31082
|
+
setAnimationFrameState(true);
|
|
31083
|
+
}
|
|
31073
31084
|
stopTimeout = setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
31074
31085
|
if (animateStop) return;
|
|
31075
|
-
yield fadeAnimate('out'
|
|
31086
|
+
yield fadeAnimate('out');
|
|
31076
31087
|
setTimeout(() => {
|
|
31077
31088
|
resetAnimateStatus();
|
|
31089
|
+
// 恢復送圖(動畫結束)
|
|
31090
|
+
if (setAnimationFrameState) {
|
|
31091
|
+
setAnimationFrameState(false);
|
|
31092
|
+
}
|
|
31078
31093
|
}, fadeDuration);
|
|
31079
31094
|
beforeAnimate();
|
|
31080
31095
|
}), stopOn === -1 ? roundAnimateDuration * 2 : stopOn);
|
|
@@ -31083,7 +31098,7 @@ function renderCardRotateAnimate(container) {
|
|
|
31083
31098
|
cardSvg.style.display = 'block';
|
|
31084
31099
|
frontArrowSvg.style.display = 'block';
|
|
31085
31100
|
backArrowSvg.style.display = 'block';
|
|
31086
|
-
yield fadeAnimate('in'
|
|
31101
|
+
yield fadeAnimate('in');
|
|
31087
31102
|
function _rotateCard(direction) {
|
|
31088
31103
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31089
31104
|
switch (direction) {
|
|
@@ -32602,14 +32617,13 @@ function startOCR(config) {
|
|
|
32602
32617
|
function startAntiFraud(type, cardType) {
|
|
32603
32618
|
const animateInterval = 2 * TIME_UNIT.SECOND;
|
|
32604
32619
|
const nextAnimateInterval = 6 * TIME_UNIT.SECOND;
|
|
32605
|
-
let eStage = null;
|
|
32606
32620
|
let needDeformationCount = 0;
|
|
32607
32621
|
setStatusEvent$1(StatusEvent.TWID);
|
|
32608
32622
|
setStatusView(StatusView.Init);
|
|
32609
32623
|
if (type !== EAuthMeCardClass.TWN_IDCard_Front || !config.ocrConfig.needAntiFraud) {
|
|
32610
32624
|
return of(true);
|
|
32611
32625
|
}
|
|
32612
|
-
const applyTextByResult = result => {
|
|
32626
|
+
const applyTextByResult = result => __awaiter(this, void 0, void 0, function* () {
|
|
32613
32627
|
if (!uiComponentOCRMask.setCardBorderColor) return;
|
|
32614
32628
|
uiComponentOCR.statusText.classList.add('non-empty');
|
|
32615
32629
|
switch (result.eStatus) {
|
|
@@ -32697,13 +32711,11 @@ function startOCR(config) {
|
|
|
32697
32711
|
break;
|
|
32698
32712
|
case EAuthMeIDCardAntiFraudStatus.StagePass:
|
|
32699
32713
|
uiComponentOCR.statusText.textContent = translateService.translate('sdk.general.verify.error.stagePass');
|
|
32700
|
-
stopAnimate();
|
|
32701
32714
|
previosAntiFraudAnimateTime = Date.now();
|
|
32702
32715
|
uiComponentOCRMask.setCardBorderColor('pass');
|
|
32703
|
-
//
|
|
32704
|
-
|
|
32705
|
-
|
|
32706
|
-
}, 2000);
|
|
32716
|
+
// Block execution for 2 seconds to show StagePass state
|
|
32717
|
+
yield new Promise(resolve => setTimeout(resolve, 2000));
|
|
32718
|
+
stopAnimate();
|
|
32707
32719
|
break;
|
|
32708
32720
|
case EAuthMeIDCardAntiFraudStatus.Pass:
|
|
32709
32721
|
uiComponentOCRMask.setCardBorderColor('pass');
|
|
@@ -32731,8 +32743,12 @@ function startOCR(config) {
|
|
|
32731
32743
|
uiComponentOCR.statusText.textContent = '';
|
|
32732
32744
|
uiComponentOCR.statusText.classList.remove('non-empty');
|
|
32733
32745
|
}
|
|
32734
|
-
};
|
|
32735
|
-
const antiFraudStart$ = of(true).pipe(switchMap(() => checkOnlineStatus(translateService.translate('sdk.general.error.alert.offline'), translateService.translate('sdk.general.error.retry'))), switchMap(() => canvasSizeInfo$), switchMap(canvasSizeInfo => from(config.setFrameSize(canvasSizeInfo.canvasWidth, canvasSizeInfo.canvasHeight)).pipe(switchMap(() =>
|
|
32746
|
+
});
|
|
32747
|
+
const antiFraudStart$ = of(true).pipe(switchMap(() => checkOnlineStatus(translateService.translate('sdk.general.error.alert.offline'), translateService.translate('sdk.general.error.retry'))), switchMap(() => canvasSizeInfo$), switchMap(canvasSizeInfo => from(config.setFrameSize(canvasSizeInfo.canvasWidth, canvasSizeInfo.canvasHeight)).pipe(switchMap(() => {
|
|
32748
|
+
// 動畫開始時停止送圖
|
|
32749
|
+
ocrSendFrameAnimation = true;
|
|
32750
|
+
return config.antiFraudStart(getCardBorderPoint(), uiComponentOCRMask.setBorderType, uiComponentOCRMask.setCardBorderColor, uiComponentOCRMask.setBorderSuccess, uiComponentOCR.scanAnimationContainer, uiComponentOCR.successContainer, uiComponentOCRMask.frameImage, uiComponentOCRMask.frameText, facingMode);
|
|
32751
|
+
}), tap(() => __awaiter(this, void 0, void 0, function* () {
|
|
32736
32752
|
setStatusView(StatusView.Aligning);
|
|
32737
32753
|
if (buttonDisable$) {
|
|
32738
32754
|
const cardMatchROI = config.getCardMatchROI ? yield config.getCardMatchROI() : undefined;
|
|
@@ -32742,12 +32758,22 @@ function startOCR(config) {
|
|
|
32742
32758
|
countDownTime = new Date().getTime() + ocrEngineConfig.expiredIn * TIME_UNIT.SECOND;
|
|
32743
32759
|
sdkFlowTimeout = makeSDKFlowTimeout(ocrEngineConfig.expiredIn);
|
|
32744
32760
|
}
|
|
32745
|
-
})),
|
|
32746
|
-
|
|
32761
|
+
})),
|
|
32762
|
+
// 反欺詐完成後恢復送圖
|
|
32763
|
+
tap(() => {
|
|
32764
|
+
ocrSendFrameAnimation = false;
|
|
32765
|
+
}), sendFrame(canvasSizeInfo, uiComponentOCR.image, uiComponentBasic.video, config.onAntiFraudFrame, ocrEngineConfig.fraudMaxFps, false, 'jpg', undefined,
|
|
32766
|
+
// 使用 sendFrame 內建的 flags 機制來控制動畫時的送圖
|
|
32767
|
+
{
|
|
32768
|
+
get animating() {
|
|
32769
|
+
return ocrSendFrameAnimation;
|
|
32770
|
+
}
|
|
32771
|
+
}), map(x => x.result), concatMap(x => __awaiter(this, void 0, void 0, function* () {
|
|
32772
|
+
yield applyTextByResult(x);
|
|
32747
32773
|
cardRotateByStage(x.eStage);
|
|
32748
32774
|
if (isTutorialFinish) {
|
|
32749
|
-
|
|
32750
|
-
|
|
32775
|
+
// 文字更新移到 cardRotateAnimationProcess 中,確保與動畫同步
|
|
32776
|
+
x.eStage;
|
|
32751
32777
|
}
|
|
32752
32778
|
if (x.eStage !== currentAntiFraudStage) {
|
|
32753
32779
|
needDeformationCount = 0;
|
|
@@ -32757,7 +32783,8 @@ function startOCR(config) {
|
|
|
32757
32783
|
// if (config.ocrConfig.disableTutorial) {
|
|
32758
32784
|
stopSpinner();
|
|
32759
32785
|
}
|
|
32760
|
-
|
|
32786
|
+
return x;
|
|
32787
|
+
})),
|
|
32761
32788
|
// ocrEngineConfig.expiredIn
|
|
32762
32789
|
// ? timeout(ocrEngineConfig.expiredIn * TIME_UNIT.SECOND)
|
|
32763
32790
|
// : tap(),
|
|
@@ -32770,7 +32797,11 @@ function startOCR(config) {
|
|
|
32770
32797
|
takeWhile$1(x => x.eStatus !== EAuthMeIDCardAntiFraudStatus.Pass,
|
|
32771
32798
|
// &&
|
|
32772
32799
|
// x.eStatus !== EAuthMeIDCardAntiFraudStatus.Failed,
|
|
32773
|
-
true)
|
|
32800
|
+
true),
|
|
32801
|
+
// 確保在任何情況下(成功、失敗、取消)都重置 flag
|
|
32802
|
+
finalize(() => {
|
|
32803
|
+
ocrSendFrameAnimation = false;
|
|
32804
|
+
}))), shareReplay(1));
|
|
32774
32805
|
const handleSuccess$ = antiFraudStart$.pipe(filter(x => x.eStatus === EAuthMeIDCardAntiFraudStatus.Pass || x.eStatus === EAuthMeIDCardAntiFraudStatus.Failed), take(1), tap(() => {
|
|
32775
32806
|
hidePopup();
|
|
32776
32807
|
clearAllFraudLottie();
|
|
@@ -32976,11 +33007,14 @@ function startOCR(config) {
|
|
|
32976
33007
|
showElement(uiComponentOCR.scanAnimationContainer);
|
|
32977
33008
|
return of(true);
|
|
32978
33009
|
}
|
|
32979
|
-
}), map(confirmResp => confirmResp)
|
|
33010
|
+
}), map(confirmResp => confirmResp),
|
|
33011
|
+
// 確保在任何情況下(成功、失敗、取消)都重置 flag
|
|
33012
|
+
finalize(() => {
|
|
33013
|
+
ocrSendFrameAnimation = false;
|
|
33014
|
+
}));
|
|
32980
33015
|
}));
|
|
32981
33016
|
};
|
|
32982
33017
|
uiComponentOCRMask.setCardBorderColor(null);
|
|
32983
|
-
let ocrSendFrameAnimation = false;
|
|
32984
33018
|
const handleOcrSendFrame = (canvasSizeInfo, canvas, video, frameCallback, fps, bas64Format, imageType, cardType, type) => source$ => {
|
|
32985
33019
|
let received = true;
|
|
32986
33020
|
const ctx = canvas.getContext('2d', {
|
|
@@ -33078,6 +33112,7 @@ function startOCR(config) {
|
|
|
33078
33112
|
};
|
|
33079
33113
|
return recognition(false);
|
|
33080
33114
|
}
|
|
33115
|
+
let ocrSendFrameAnimation = false;
|
|
33081
33116
|
function createFlowByType(type, cardType, cardTypeConfig) {
|
|
33082
33117
|
return of(true).pipe(tap(() => {
|
|
33083
33118
|
currentType('set', {
|
|
@@ -33205,7 +33240,10 @@ function startOCR(config) {
|
|
|
33205
33240
|
})),
|
|
33206
33241
|
container: uiComponentBasic.videoContainer
|
|
33207
33242
|
});
|
|
33208
|
-
const rotateUI = renderCardRotateAnimate(uiComponentOCR.arrowAnimationContainer
|
|
33243
|
+
const rotateUI = renderCardRotateAnimate(uiComponentOCR.arrowAnimationContainer, uiComponentOCR.directionTextPanel, isAnimating => {
|
|
33244
|
+
// 動畫開始時停止送圖,動畫結束時恢復送圖
|
|
33245
|
+
ocrSendFrameAnimation = isAnimating;
|
|
33246
|
+
});
|
|
33209
33247
|
rotateCard = rotateUI.rotateCard;
|
|
33210
33248
|
getIsRotateCardAnimating = rotateUI.getIsRotateCardAnimating;
|
|
33211
33249
|
stopAnimate = rotateUI.stopAnimate;
|
|
@@ -33754,26 +33792,30 @@ function startOCR(config) {
|
|
|
33754
33792
|
}
|
|
33755
33793
|
}
|
|
33756
33794
|
function cardRotateAnimationProcess(stage) {
|
|
33795
|
+
// 在動畫開始前更新文字,確保文字與動畫同步
|
|
33796
|
+
if (isTutorialFinish) {
|
|
33797
|
+
cardRotateTextProcess(stage, true);
|
|
33798
|
+
}
|
|
33757
33799
|
switch (stage) {
|
|
33758
33800
|
case EAuthMeIDCardAntiFraudStage.Left:
|
|
33759
33801
|
rotateCard(facingMode === 'front' ? 'right' : 'left', () => {
|
|
33760
33802
|
previosAntiFraudAnimateTime = Date.now();
|
|
33761
|
-
}
|
|
33803
|
+
});
|
|
33762
33804
|
break;
|
|
33763
33805
|
case EAuthMeIDCardAntiFraudStage.Right:
|
|
33764
33806
|
rotateCard(facingMode === 'front' ? 'left' : 'right', () => {
|
|
33765
33807
|
previosAntiFraudAnimateTime = Date.now();
|
|
33766
|
-
}
|
|
33808
|
+
});
|
|
33767
33809
|
break;
|
|
33768
33810
|
case EAuthMeIDCardAntiFraudStage.Up:
|
|
33769
33811
|
rotateCard('up', () => {
|
|
33770
33812
|
previosAntiFraudAnimateTime = Date.now();
|
|
33771
|
-
}
|
|
33813
|
+
});
|
|
33772
33814
|
break;
|
|
33773
33815
|
case EAuthMeIDCardAntiFraudStage.Down:
|
|
33774
33816
|
rotateCard('down', () => {
|
|
33775
33817
|
previosAntiFraudAnimateTime = Date.now();
|
|
33776
|
-
}
|
|
33818
|
+
});
|
|
33777
33819
|
break;
|
|
33778
33820
|
}
|
|
33779
33821
|
}
|
|
@@ -37239,8 +37281,8 @@ class AuthmeIdentityVerification extends AuthmeFunctionModule {
|
|
|
37239
37281
|
}
|
|
37240
37282
|
|
|
37241
37283
|
var name = "authme/sdk";
|
|
37242
|
-
var version$1 = "2.8.
|
|
37243
|
-
var date = "2025-11-
|
|
37284
|
+
var version$1 = "2.8.34";
|
|
37285
|
+
var date = "2025-11-24T03:00:21+0000";
|
|
37244
37286
|
var packageInfo = {
|
|
37245
37287
|
name: name,
|
|
37246
37288
|
version: version$1,
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authme/identity-verification",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.34",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"core-js": "^3.6.0",
|
|
6
6
|
"lottie-web": "^5.9.2",
|
|
7
7
|
"rxjs": "^7.4.0",
|
|
8
|
-
"@authme/core": "2.8.
|
|
9
|
-
"@authme/engine": "2.8.
|
|
10
|
-
"@authme/id-recognition": "2.8.
|
|
11
|
-
"@authme/liveness": "2.8.
|
|
12
|
-
"@authme/util": "2.8.
|
|
8
|
+
"@authme/core": "2.8.34",
|
|
9
|
+
"@authme/engine": "2.8.34",
|
|
10
|
+
"@authme/id-recognition": "2.8.34",
|
|
11
|
+
"@authme/liveness": "2.8.34",
|
|
12
|
+
"@authme/util": "2.8.34"
|
|
13
13
|
},
|
|
14
14
|
"module": "./index.js",
|
|
15
15
|
"main": "./index.cjs",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare type direction = 'left' | 'right' | 'up' | 'down';
|
|
2
|
-
export declare function renderCardRotateAnimate(container: HTMLElement): {
|
|
2
|
+
export declare function renderCardRotateAnimate(container: HTMLElement, directionTextPanel?: HTMLElement | null, setAnimationFrameState?: (isAnimating: boolean) => void): {
|
|
3
3
|
stopAnimate: () => Promise<unknown>;
|
|
4
|
-
rotateCard: (direction: direction, beforeAnimate?: () => void,
|
|
4
|
+
rotateCard: (direction: direction, beforeAnimate?: () => void, stopOn?: number) => Promise<void>;
|
|
5
5
|
getIsRotateCardAnimating: () => boolean;
|
|
6
6
|
};
|
|
7
7
|
export {};
|