@authme/identity-verification 2.8.3 → 2.8.5
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 +133 -162
- package/assets/locale/ja_JP.json +135 -164
- package/assets/locale/zh_Hant_TW.json +134 -163
- package/assets/styles/style.css +374 -1
- package/index.cjs +452 -45
- package/index.js +453 -46
- package/package.json +6 -6
- package/src/lib/identity-verification-feature-identity-verification.d.ts +2 -0
- package/src/lib/interface/config.interface.d.ts +3 -0
- package/src/lib/ui/ocr-flow.d.ts +1 -0
- package/src/lib/v2/ui/ocrResultModal.d.ts +13 -0
package/index.cjs
CHANGED
|
@@ -32,6 +32,8 @@ require('core-js/modules/es.typed-array.fill.js');
|
|
|
32
32
|
require('core-js/modules/es.typed-array.set.js');
|
|
33
33
|
require('core-js/modules/es.typed-array.sort.js');
|
|
34
34
|
require('core-js/modules/es.typed-array.to-locale-string.js');
|
|
35
|
+
require('core-js/modules/es.string.pad-start.js');
|
|
36
|
+
require('core-js/modules/es.regexp.constructor.js');
|
|
35
37
|
require('core-js/modules/es.typed-array.uint8-array.js');
|
|
36
38
|
|
|
37
39
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -109,7 +111,8 @@ const defaultLivenessConfig = {
|
|
|
109
111
|
subtitle: null,
|
|
110
112
|
uploadFullFrame: false,
|
|
111
113
|
passive: false,
|
|
112
|
-
compareCustomerClientId: null
|
|
114
|
+
compareCustomerClientId: null,
|
|
115
|
+
deviceType: null
|
|
113
116
|
};
|
|
114
117
|
const defaultIdRecognitionConfig = {
|
|
115
118
|
icon: DEFAULT_ICON_URI,
|
|
@@ -133,7 +136,8 @@ const defaultIdRecognitionConfig = {
|
|
|
133
136
|
captureTimeout: -1,
|
|
134
137
|
resultImageFormat: 'jpg',
|
|
135
138
|
confirmPageEnabled: true,
|
|
136
|
-
isFraudIntroEnable: false
|
|
139
|
+
isFraudIntroEnable: false,
|
|
140
|
+
deviceType: null
|
|
137
141
|
};
|
|
138
142
|
|
|
139
143
|
function setCorrectViewHeight() {
|
|
@@ -27904,7 +27908,7 @@ const setStatusTextTop = params => {
|
|
|
27904
27908
|
const _maskTop = maskTop !== null && maskTop !== void 0 ? maskTop : window.innerHeight / 2 - maskHeight / 2;
|
|
27905
27909
|
const _maskBotton = _maskTop + maskHeight;
|
|
27906
27910
|
titleTextPanel.style.top = `${_maskTop - MASK_STYLE.MASK_TITLE_MARGIN - MASK_STYLE.TITLE_TEXT_FONT_SIZE}px`;
|
|
27907
|
-
statusTextPanel.style.top = `${_maskBotton + MASK_STYLE.MASK_TITLE_MARGIN}px`;
|
|
27911
|
+
statusTextPanel.style.top = `${_maskBotton + MASK_STYLE.MASK_TITLE_MARGIN + 60}px`;
|
|
27908
27912
|
};
|
|
27909
27913
|
|
|
27910
27914
|
const limitFPS = fps => {
|
|
@@ -27923,7 +27927,9 @@ const limitFPS = fps => {
|
|
|
27923
27927
|
};
|
|
27924
27928
|
const sendFrame = (canvasSizeInfo, canvas, video, frameCallback, fps, bas64Format, imageType, cardType, flags, type) => source$ => {
|
|
27925
27929
|
let received = true;
|
|
27926
|
-
const ctx = canvas.getContext('2d'
|
|
27930
|
+
const ctx = canvas.getContext('2d', {
|
|
27931
|
+
willReadFrequently: true
|
|
27932
|
+
});
|
|
27927
27933
|
return source$.pipe(rxjs.mergeMap(() => rxjs.animationFrames().pipe(limitFPS(fps), rxjs.filter(() => received && !(flags === null || flags === void 0 ? void 0 : flags.animating)), 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 => {
|
|
27928
27934
|
// send to fast, ignore
|
|
27929
27935
|
if (e instanceof core.AuthmeError && e.code === core.ErrorCode.RECOGNITION_NOT_AVAILABLE) {
|
|
@@ -28232,7 +28238,6 @@ function startLiveness(config) {
|
|
|
28232
28238
|
// }
|
|
28233
28239
|
function makeSDKFlowTimeout(expiredIn) {
|
|
28234
28240
|
return rxjs.timer(expiredIn * util.TIME_UNIT.SECOND).pipe(rxjs.switchMap(() => new rxjs.Observable(observer => {
|
|
28235
|
-
console.log('makeSDKFlowTimeout observer');
|
|
28236
28241
|
config.onDestroy();
|
|
28237
28242
|
popupView({
|
|
28238
28243
|
title: translateService.translate('sdk.general.error.timeout.title'),
|
|
@@ -28767,7 +28772,6 @@ const renderCameraSwitch = config => {
|
|
|
28767
28772
|
};
|
|
28768
28773
|
const renderOCRUI = config => {
|
|
28769
28774
|
const uiThemeConfig = util.Storage.getItem('themeConfig');
|
|
28770
|
-
console.log('uiThemeConfig', uiThemeConfig);
|
|
28771
28775
|
const translateService = core.getTranslateInstance();
|
|
28772
28776
|
const createTextPanel = () => {
|
|
28773
28777
|
const ele = document.createElement('div');
|
|
@@ -29922,7 +29926,9 @@ const imageDataToBase64 = (data, width, height, mimeType = 'image/png') => {
|
|
|
29922
29926
|
const canvas = document.createElement('canvas');
|
|
29923
29927
|
canvas.width = width;
|
|
29924
29928
|
canvas.height = height;
|
|
29925
|
-
const ctx = canvas.getContext('2d'
|
|
29929
|
+
const ctx = canvas.getContext('2d', {
|
|
29930
|
+
willReadFrequently: true
|
|
29931
|
+
});
|
|
29926
29932
|
// 2. 建立 ImageData,填充像素數據
|
|
29927
29933
|
const imgData = ctx.createImageData(width, height);
|
|
29928
29934
|
imgData.data.set(new Uint8ClampedArray(data)); // 確保格式正確
|
|
@@ -29934,7 +29940,9 @@ const videoToBase64 = (video, sizeInfo) => __awaiter(void 0, void 0, void 0, fun
|
|
|
29934
29940
|
const canvas = document.createElement('canvas');
|
|
29935
29941
|
canvas.width = sizeInfo.canvasWidth;
|
|
29936
29942
|
canvas.height = sizeInfo.canvasHeight;
|
|
29937
|
-
const ctx = canvas.getContext('2d'
|
|
29943
|
+
const ctx = canvas.getContext('2d', {
|
|
29944
|
+
willReadFrequently: true
|
|
29945
|
+
});
|
|
29938
29946
|
if (!ctx) {
|
|
29939
29947
|
throw new Error('Failed to get 2d context from canvas');
|
|
29940
29948
|
}
|
|
@@ -30350,7 +30358,6 @@ const toast = arg => {
|
|
|
30350
30358
|
};
|
|
30351
30359
|
|
|
30352
30360
|
const confirmPopup = arg => {
|
|
30353
|
-
console.log('confirmPopup', arg);
|
|
30354
30361
|
const authmeContainer = document.querySelector('.authme-container');
|
|
30355
30362
|
if (!authmeContainer) {
|
|
30356
30363
|
console.error('confirmPopup: authmeContainer not found');
|
|
@@ -30542,6 +30549,343 @@ const fraudScanIntroPage = arg => {
|
|
|
30542
30549
|
authmeContainer.appendChild(domModal);
|
|
30543
30550
|
};
|
|
30544
30551
|
|
|
30552
|
+
const ocrResultModal = arg => {
|
|
30553
|
+
let modifiedDetails = {};
|
|
30554
|
+
const authmeContainer = document.querySelector('.authme-container');
|
|
30555
|
+
if (!authmeContainer) {
|
|
30556
|
+
console.error('modal: authmeContainer not found');
|
|
30557
|
+
return;
|
|
30558
|
+
}
|
|
30559
|
+
const translateService = core.getTranslateInstance();
|
|
30560
|
+
const uiThemeConfig = util.Storage.getItem('themeConfig');
|
|
30561
|
+
function removeOcrResultModal() {
|
|
30562
|
+
var _a;
|
|
30563
|
+
(_a = document.querySelector('.video-container__ocrResultModal')) === null || _a === void 0 ? void 0 : _a.remove();
|
|
30564
|
+
}
|
|
30565
|
+
function formatTime(seconds) {
|
|
30566
|
+
const m = Math.floor(seconds % 3600 / 60);
|
|
30567
|
+
const s = seconds % 60;
|
|
30568
|
+
return [m, s].map(unit => String(unit).padStart(2, '0')).join(':');
|
|
30569
|
+
}
|
|
30570
|
+
function groupInput({
|
|
30571
|
+
name,
|
|
30572
|
+
label,
|
|
30573
|
+
value
|
|
30574
|
+
}) {
|
|
30575
|
+
const domGroupItem = document.createElement('div');
|
|
30576
|
+
domGroupItem.classList.add('video-container__ocrResultModal-group-item');
|
|
30577
|
+
domGroupItem.id = name;
|
|
30578
|
+
const domLabel = document.createElement('label');
|
|
30579
|
+
const domInput = document.createElement('input');
|
|
30580
|
+
const domError = document.createElement('div');
|
|
30581
|
+
domLabel.classList.add('video-container__ocrResultModal-label');
|
|
30582
|
+
domInput.classList.add('video-container__ocrResultModal-input');
|
|
30583
|
+
domError.classList.add('video-container__ocrResultModal-error');
|
|
30584
|
+
domError.classList.add('hidden');
|
|
30585
|
+
domLabel.innerText = `${label}`;
|
|
30586
|
+
domInput.type = 'text';
|
|
30587
|
+
domInput.value = value;
|
|
30588
|
+
domError.innerText = `${label}格式不符`;
|
|
30589
|
+
domInput.addEventListener('input', () => {
|
|
30590
|
+
validateFields() ? btnConfirmStatus(false) : btnConfirmStatus(true);
|
|
30591
|
+
// btnConfirmStatus(Object.values(validateMap).some((i: any) => i.validate === false));
|
|
30592
|
+
});
|
|
30593
|
+
|
|
30594
|
+
domGroupItem.appendChild(domLabel);
|
|
30595
|
+
domGroupItem.appendChild(domInput);
|
|
30596
|
+
domGroupItem.appendChild(domError);
|
|
30597
|
+
return domGroupItem;
|
|
30598
|
+
}
|
|
30599
|
+
function groupDropMenu({
|
|
30600
|
+
name,
|
|
30601
|
+
label,
|
|
30602
|
+
value,
|
|
30603
|
+
selections
|
|
30604
|
+
}) {
|
|
30605
|
+
const domGroupItem = document.createElement('div');
|
|
30606
|
+
domGroupItem.classList.add('video-container__ocrResultModal-group-item');
|
|
30607
|
+
domGroupItem.id = name;
|
|
30608
|
+
const domLabel = document.createElement('label');
|
|
30609
|
+
domLabel.classList.add('video-container__ocrResultModal-label');
|
|
30610
|
+
domLabel.innerText = `${label}`;
|
|
30611
|
+
const domDropMenu = document.createElement('div');
|
|
30612
|
+
domDropMenu.classList.add('drop_menu_container');
|
|
30613
|
+
const domDropMenuTitle = document.createElement('div');
|
|
30614
|
+
domDropMenuTitle.classList.add('drop_menu_title');
|
|
30615
|
+
domDropMenuTitle.setAttribute('data-value', value);
|
|
30616
|
+
domDropMenuTitle.innerHTML = `<span class="ellipsis">${selections.find(i => i.value === value) ? selections.find(i => i.value === value).name : '請選擇'}</span>
|
|
30617
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3 7L10.07 14L17 7" stroke="#343434" stroke-width="2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
|
|
30618
|
+
const domError = document.createElement('div');
|
|
30619
|
+
domError.classList.add('video-container__ocrResultModal-error');
|
|
30620
|
+
domError.classList.add('hidden');
|
|
30621
|
+
domError.innerText = `${label}格式不符`;
|
|
30622
|
+
let domDropMenuCancel = null;
|
|
30623
|
+
if (window.innerWidth < 1440) {
|
|
30624
|
+
// mobile
|
|
30625
|
+
domDropMenuCancel = document.createElement('div');
|
|
30626
|
+
domDropMenuCancel.classList.add('drop_menu_cancel');
|
|
30627
|
+
domDropMenuCancel.innerText = arg.cancelText;
|
|
30628
|
+
}
|
|
30629
|
+
const domDropMenuulSection = document.createElement('section');
|
|
30630
|
+
domDropMenuulSection.classList.add('drop_menu_ul_section');
|
|
30631
|
+
const domDropMenuUlContainer = document.createElement('div');
|
|
30632
|
+
domDropMenuUlContainer.classList.add('drop_menu_ul_container');
|
|
30633
|
+
const domDropMenuUl = document.createElement('ul');
|
|
30634
|
+
domDropMenuulSection.classList.add('hide');
|
|
30635
|
+
selections.forEach(selection => {
|
|
30636
|
+
const domDropMenuLi = document.createElement('li');
|
|
30637
|
+
domDropMenuLi.classList.add('drop_menu_item');
|
|
30638
|
+
if (selection.value === value) {
|
|
30639
|
+
domDropMenuLi.classList.add('active');
|
|
30640
|
+
}
|
|
30641
|
+
domDropMenuLi.setAttribute('data-value', selection.value);
|
|
30642
|
+
domDropMenuLi.innerHTML = `<span>${selection.name}</span>`;
|
|
30643
|
+
domDropMenuUl.appendChild(domDropMenuLi);
|
|
30644
|
+
});
|
|
30645
|
+
domDropMenu.appendChild(domDropMenuTitle);
|
|
30646
|
+
domDropMenuUlContainer.appendChild(domDropMenuUl);
|
|
30647
|
+
if (domDropMenuCancel) {
|
|
30648
|
+
domDropMenuUlContainer.appendChild(domDropMenuCancel);
|
|
30649
|
+
}
|
|
30650
|
+
domDropMenuulSection.appendChild(domDropMenuUlContainer);
|
|
30651
|
+
domDropMenu.appendChild(domDropMenuulSection);
|
|
30652
|
+
util.dropMenu(domDropMenu, dom => {
|
|
30653
|
+
domDropMenuTitle.setAttribute('data-value', dom.getAttribute('data-value'));
|
|
30654
|
+
validateFields() ? btnConfirmStatus(false) : btnConfirmStatus(true);
|
|
30655
|
+
});
|
|
30656
|
+
domGroupItem.appendChild(domLabel);
|
|
30657
|
+
domGroupItem.appendChild(domDropMenu);
|
|
30658
|
+
domGroupItem.appendChild(domError);
|
|
30659
|
+
return domGroupItem;
|
|
30660
|
+
}
|
|
30661
|
+
function formatDate(dateString, format) {
|
|
30662
|
+
// 解析日期字串為 Date 物件
|
|
30663
|
+
const date = new Date(dateString);
|
|
30664
|
+
const year = date.getFullYear(); // 取得年份
|
|
30665
|
+
const month = (date.getMonth() + 1).toString().padStart(2, '0'); // 取得月份並補齊兩位
|
|
30666
|
+
const day = date.getDate().toString().padStart(2, '0'); // 取得日期並補齊兩位
|
|
30667
|
+
// 根據傳入的 format 來替換字串
|
|
30668
|
+
return format.replace('YYYY', year.toString()) // 替換 "YYYY" 為年份
|
|
30669
|
+
.replace('yyyy', year.toString()) // 替換 "yyyy" 為年份
|
|
30670
|
+
.replace('MM', month) // 替換 "MM" 為月份
|
|
30671
|
+
.replace('dd', day) // 替換 "dd" 為日期
|
|
30672
|
+
.replace('yyyy', year.toString()); // 處理 "yyyy" 格式
|
|
30673
|
+
}
|
|
30674
|
+
|
|
30675
|
+
function isValidDateFormat(dateStr) {
|
|
30676
|
+
const regex = /^\d{4}\/(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])$/;
|
|
30677
|
+
return regex.test(dateStr);
|
|
30678
|
+
}
|
|
30679
|
+
function checkModifiedData() {
|
|
30680
|
+
const items = domModal.querySelectorAll('.video-container__ocrResultModal-group-item');
|
|
30681
|
+
items.forEach(item => {
|
|
30682
|
+
const input = item.querySelector('input');
|
|
30683
|
+
if (input) {
|
|
30684
|
+
const key = item.id;
|
|
30685
|
+
const value = input.value;
|
|
30686
|
+
let valueOrigin = arg.items.find(i => i.name === key).value;
|
|
30687
|
+
const dateFormat = arg.items.find(i => i.name === key).dateFormat;
|
|
30688
|
+
if (dateFormat) {
|
|
30689
|
+
valueOrigin = formatDate(valueOrigin, dateFormat);
|
|
30690
|
+
}
|
|
30691
|
+
modifiedDetails[key] = {
|
|
30692
|
+
isModified: value !== valueOrigin ? true : false,
|
|
30693
|
+
value
|
|
30694
|
+
};
|
|
30695
|
+
} else if (item.querySelector('.drop_menu_title')) {
|
|
30696
|
+
// drop menu
|
|
30697
|
+
const key = item.id;
|
|
30698
|
+
const value = item.querySelector('.drop_menu_title').getAttribute('data-value');
|
|
30699
|
+
const valueOrigin = arg.items.find(i => i.name === key).value;
|
|
30700
|
+
modifiedDetails[key] = {
|
|
30701
|
+
isModified: value !== valueOrigin ? true : false,
|
|
30702
|
+
value
|
|
30703
|
+
};
|
|
30704
|
+
}
|
|
30705
|
+
});
|
|
30706
|
+
}
|
|
30707
|
+
function btnConfirmStatus(flag) {
|
|
30708
|
+
domConfirm.disabled = flag;
|
|
30709
|
+
util.uiThemeButton(domConfirm, uiThemeConfig.majorButton, flag);
|
|
30710
|
+
}
|
|
30711
|
+
function validateFields() {
|
|
30712
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
30713
|
+
for (const key in validateMap) {
|
|
30714
|
+
const item = validateMap[key];
|
|
30715
|
+
const domItem = domModal.querySelector(`#${key}`);
|
|
30716
|
+
if (domItem) {
|
|
30717
|
+
const input = domItem.querySelector('input');
|
|
30718
|
+
if (input && item.regex) {
|
|
30719
|
+
if (item.regex.test(input.value)) {
|
|
30720
|
+
item.validate = true;
|
|
30721
|
+
(_a = domItem.querySelector('.video-container__ocrResultModal-input')) === null || _a === void 0 ? void 0 : _a.classList.remove('error');
|
|
30722
|
+
(_b = domItem.querySelector('.video-container__ocrResultModal-error')) === null || _b === void 0 ? void 0 : _b.classList.add('hidden');
|
|
30723
|
+
} else {
|
|
30724
|
+
item.validate = false;
|
|
30725
|
+
(_c = domItem.querySelector('.video-container__ocrResultModal-input')) === null || _c === void 0 ? void 0 : _c.classList.add('error');
|
|
30726
|
+
(_d = domItem.querySelector('.video-container__ocrResultModal-error')) === null || _d === void 0 ? void 0 : _d.classList.remove('hidden');
|
|
30727
|
+
}
|
|
30728
|
+
} else if (item.regex) {
|
|
30729
|
+
// drop menu
|
|
30730
|
+
const domDropMenu = domItem.querySelector('.drop_menu_title');
|
|
30731
|
+
if (domDropMenu) {
|
|
30732
|
+
if (domDropMenu.getAttribute('data-value') !== '') {
|
|
30733
|
+
item.validate = true;
|
|
30734
|
+
domDropMenu.classList.remove('error');
|
|
30735
|
+
(_e = domItem.querySelector('.video-container__ocrResultModal-error')) === null || _e === void 0 ? void 0 : _e.classList.add('hidden');
|
|
30736
|
+
} else {
|
|
30737
|
+
item.validate = false;
|
|
30738
|
+
domDropMenu.classList.add('error');
|
|
30739
|
+
(_f = domItem.querySelector('.video-container__ocrResultModal-error')) === null || _f === void 0 ? void 0 : _f.classList.remove('hidden');
|
|
30740
|
+
}
|
|
30741
|
+
}
|
|
30742
|
+
} else if (input && item.dateFormat) {
|
|
30743
|
+
if (isValidDateFormat(input.value)) {
|
|
30744
|
+
// if (item.dateFormat.test(input.value)) {
|
|
30745
|
+
item.validate = true;
|
|
30746
|
+
(_g = domItem.querySelector('.video-container__ocrResultModal-input')) === null || _g === void 0 ? void 0 : _g.classList.remove('error');
|
|
30747
|
+
(_h = domItem.querySelector('.video-container__ocrResultModal-error')) === null || _h === void 0 ? void 0 : _h.classList.add('hidden');
|
|
30748
|
+
} else {
|
|
30749
|
+
item.validate = false;
|
|
30750
|
+
(_j = domItem.querySelector('.video-container__ocrResultModal-input')) === null || _j === void 0 ? void 0 : _j.classList.add('error');
|
|
30751
|
+
(_k = domItem.querySelector('.video-container__ocrResultModal-error')) === null || _k === void 0 ? void 0 : _k.classList.remove('hidden');
|
|
30752
|
+
}
|
|
30753
|
+
}
|
|
30754
|
+
}
|
|
30755
|
+
}
|
|
30756
|
+
const isPass = Object.values(validateMap).every(item => item.validate === true);
|
|
30757
|
+
return isPass;
|
|
30758
|
+
}
|
|
30759
|
+
modifiedDetails = arg.items.reduce((acc, item) => {
|
|
30760
|
+
acc[item.name] = {
|
|
30761
|
+
isModified: false,
|
|
30762
|
+
value: item.value
|
|
30763
|
+
};
|
|
30764
|
+
return acc;
|
|
30765
|
+
}, {});
|
|
30766
|
+
let timer = Math.floor((arg.countDownTime - new Date().getTime()) / 1000);
|
|
30767
|
+
const validateMap = {};
|
|
30768
|
+
const domModal = document.createElement('div');
|
|
30769
|
+
const domHeaderContainer = document.createElement('div');
|
|
30770
|
+
const domBodyContainer = document.createElement('div');
|
|
30771
|
+
const domBody = document.createElement('div');
|
|
30772
|
+
const domTitle = document.createElement('div');
|
|
30773
|
+
const domSubtitle = document.createElement('div');
|
|
30774
|
+
const domFooterContainer = document.createElement('div');
|
|
30775
|
+
const domCountDownContainer = document.createElement('div');
|
|
30776
|
+
const domCountDown = document.createElement('div');
|
|
30777
|
+
const domHint = document.createElement('div');
|
|
30778
|
+
const domClose = document.createElement('div');
|
|
30779
|
+
const domConfirm = document.createElement('button');
|
|
30780
|
+
domModal.classList.add('video-container__ocrResultModal');
|
|
30781
|
+
domHeaderContainer.classList.add('video-container__ocrResultModal-header-container');
|
|
30782
|
+
domBodyContainer.classList.add('video-container__ocrResultModal-body-container');
|
|
30783
|
+
domBody.classList.add('video-container__ocrResultModal-body');
|
|
30784
|
+
domTitle.classList.add('video-container__ocrResultModal-title');
|
|
30785
|
+
domSubtitle.classList.add('video-container__ocrResultModal-subtitle');
|
|
30786
|
+
domFooterContainer.classList.add('video-container__ocrResultModal-footer-container');
|
|
30787
|
+
domCountDownContainer.classList.add('video-container__ocrResultModal-countdown-container');
|
|
30788
|
+
domCountDown.classList.add('video-container__ocrResultModal-countdown');
|
|
30789
|
+
domHint.classList.add('video-container__ocrResultModal-hint');
|
|
30790
|
+
domClose.classList.add('video-container__ocrResultModal-close');
|
|
30791
|
+
domConfirm.classList.add('video-container__ocrResultModal-confirm');
|
|
30792
|
+
btnConfirmStatus(true);
|
|
30793
|
+
// uiThemeButton(domConfirm, uiThemeConfig.majorButton);
|
|
30794
|
+
util.uiThemeText(domTitle, uiThemeConfig.resultTitle);
|
|
30795
|
+
util.uiThemeText(domSubtitle, uiThemeConfig.resultBody);
|
|
30796
|
+
domTitle.innerText = arg.title;
|
|
30797
|
+
domSubtitle.innerText = arg.subtitle;
|
|
30798
|
+
domHint.innerHTML = arg.hintText;
|
|
30799
|
+
domCountDownContainer.innerHTML = `${arg.countDown1Text} <span class="video-container__ocrResultModal-countdown" style="color: ${uiThemeConfig.resultTime};font-size:${uiThemeConfig.fontSize}px;font-weight:${util.fontWeight[uiThemeConfig.textWeight]}"> ${formatTime(timer)} </span> ${arg.countDown2Text}`;
|
|
30800
|
+
domConfirm.innerText = arg.confirmText;
|
|
30801
|
+
domClose.innerHTML = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M19.1943 6.41714C19.6393 5.97216 19.6393 5.2507 19.1943 4.80571C18.7493 4.36073 18.0278 4.36073 17.5829 4.80571L12 10.3886L6.41714 4.80572C5.97216 4.36073 5.2507 4.36073 4.80571 4.80571C4.36073 5.2507 4.36073 5.97216 4.80571 6.41714L10.3886 12L4.80571 17.5829C4.36073 18.0278 4.36073 18.7493 4.80571 19.1943C5.2507 19.6393 5.97216 19.6393 6.41714 19.1943L12 13.6114L17.5829 19.1943C18.0278 19.6393 18.7493 19.6393 19.1943 19.1943C19.6393 18.7493 19.6393 18.0278 19.1943 17.5829L13.6114 12L19.1943 6.41714Z" fill="${uiThemeConfig.nonEkycCloseButton.contentColor}" fill-opacity="${uiThemeConfig.nonEkycCloseButton.contentOpacity}" /></svg>`;
|
|
30802
|
+
const countdownInterval = setInterval(() => {
|
|
30803
|
+
timer -= 1;
|
|
30804
|
+
const countdownEl = domModal.querySelector('.video-container__ocrResultModal-countdown');
|
|
30805
|
+
if (countdownEl) {
|
|
30806
|
+
countdownEl.innerHTML = formatTime(timer);
|
|
30807
|
+
}
|
|
30808
|
+
if (timer <= 0) {
|
|
30809
|
+
clearInterval(countdownInterval);
|
|
30810
|
+
}
|
|
30811
|
+
}, 1000);
|
|
30812
|
+
// form start
|
|
30813
|
+
arg.items.sort((a, b) => {
|
|
30814
|
+
var _a, _b;
|
|
30815
|
+
return ((_a = a.order) !== null && _a !== void 0 ? _a : Infinity) - ((_b = b.order) !== null && _b !== void 0 ? _b : Infinity);
|
|
30816
|
+
});
|
|
30817
|
+
arg.items.forEach(item => {
|
|
30818
|
+
// init validateMap
|
|
30819
|
+
if (item.regex) {
|
|
30820
|
+
validateMap[item.name] = {
|
|
30821
|
+
validate: false,
|
|
30822
|
+
regex: new RegExp(item.regex.slice(1, -1))
|
|
30823
|
+
};
|
|
30824
|
+
} else if (item.selections) {
|
|
30825
|
+
validateMap[item.name] = {
|
|
30826
|
+
validate: false,
|
|
30827
|
+
regex: /\S+/
|
|
30828
|
+
};
|
|
30829
|
+
} else if (item.dateFormat) {
|
|
30830
|
+
validateMap[item.name] = {
|
|
30831
|
+
validate: false,
|
|
30832
|
+
dateFormat: new RegExp(item.dateFormat.slice(1, -1))
|
|
30833
|
+
};
|
|
30834
|
+
}
|
|
30835
|
+
// init UI
|
|
30836
|
+
if (!item.hidden) {
|
|
30837
|
+
if (item.selections) {
|
|
30838
|
+
const domDropMenu = groupDropMenu({
|
|
30839
|
+
name: item.name,
|
|
30840
|
+
label: item.name === 'issueReason' ? translateService.translate('sdk.ocr.verify.result.issueType') : translateService.translate(`sdk.ocr.verify.result.${item.name}`),
|
|
30841
|
+
value: item.value,
|
|
30842
|
+
selections: item.selections
|
|
30843
|
+
});
|
|
30844
|
+
domBody.appendChild(domDropMenu);
|
|
30845
|
+
} else {
|
|
30846
|
+
const domGroupItem = groupInput({
|
|
30847
|
+
name: item.name,
|
|
30848
|
+
label: item.name === 'issueReason' ? translateService.translate('sdk.ocr.verify.result.issueType') : translateService.translate(`sdk.ocr.verify.result.${item.name}`),
|
|
30849
|
+
value: item.dateFormat ? formatDate(item.value, item.dateFormat) : item.value
|
|
30850
|
+
});
|
|
30851
|
+
domBody.appendChild(domGroupItem);
|
|
30852
|
+
}
|
|
30853
|
+
}
|
|
30854
|
+
});
|
|
30855
|
+
// form end
|
|
30856
|
+
domHeaderContainer.appendChild(domTitle);
|
|
30857
|
+
domHeaderContainer.appendChild(domSubtitle);
|
|
30858
|
+
domModal.appendChild(domHeaderContainer);
|
|
30859
|
+
domModal.appendChild(domClose);
|
|
30860
|
+
domModal.appendChild(domBodyContainer);
|
|
30861
|
+
// domBodyContainer.appendChild(domTitle);
|
|
30862
|
+
// domBodyContainer.appendChild(domSubtitle);
|
|
30863
|
+
domBodyContainer.appendChild(domBody);
|
|
30864
|
+
domModal.appendChild(domFooterContainer);
|
|
30865
|
+
domFooterContainer.appendChild(domCountDownContainer);
|
|
30866
|
+
domFooterContainer.appendChild(domHint);
|
|
30867
|
+
domFooterContainer.appendChild(domConfirm);
|
|
30868
|
+
authmeContainer.appendChild(domModal);
|
|
30869
|
+
validateFields() ? btnConfirmStatus(false) : btnConfirmStatus(true);
|
|
30870
|
+
return new Promise(resolve => {
|
|
30871
|
+
domClose.addEventListener('click', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
30872
|
+
if (arg.onClose) {
|
|
30873
|
+
yield arg.onClose();
|
|
30874
|
+
}
|
|
30875
|
+
removeOcrResultModal();
|
|
30876
|
+
resolve('close');
|
|
30877
|
+
}));
|
|
30878
|
+
domConfirm.addEventListener('click', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
30879
|
+
checkModifiedData();
|
|
30880
|
+
if (arg.onConfirm) {
|
|
30881
|
+
yield arg.onConfirm(modifiedDetails);
|
|
30882
|
+
}
|
|
30883
|
+
removeOcrResultModal();
|
|
30884
|
+
resolve(modifiedDetails);
|
|
30885
|
+
}));
|
|
30886
|
+
});
|
|
30887
|
+
};
|
|
30888
|
+
|
|
30545
30889
|
const initEvenTrackingStatus = ocrConfig => {
|
|
30546
30890
|
setFeature$1(ocrConfig.needAntiFraud ? core.Feature.OCRFraud : core.Feature.OCR);
|
|
30547
30891
|
};
|
|
@@ -30552,6 +30896,7 @@ function startOCR(config) {
|
|
|
30552
30896
|
const timeout$ = new rxjs.Subject();
|
|
30553
30897
|
// let sdkFlowTimeout: NodeJS.Timeout;
|
|
30554
30898
|
let sdkFlowTimeout = null;
|
|
30899
|
+
let countDownTime = 0;
|
|
30555
30900
|
let deviceMetas;
|
|
30556
30901
|
// anti fraud
|
|
30557
30902
|
let currentAntiFraudStage;
|
|
@@ -30781,7 +31126,6 @@ function startOCR(config) {
|
|
|
30781
31126
|
// }
|
|
30782
31127
|
function makeSDKFlowTimeout(expiredIn) {
|
|
30783
31128
|
return rxjs.timer(expiredIn * util.TIME_UNIT.SECOND).pipe(rxjs.switchMap(() => new rxjs.Observable(observer => {
|
|
30784
|
-
console.log('makeSDKFlowTimeout observer');
|
|
30785
31129
|
config.onDestroy();
|
|
30786
31130
|
popupView({
|
|
30787
31131
|
title: translateService.translate('sdk.general.error.timeout.title'),
|
|
@@ -30935,6 +31279,7 @@ function startOCR(config) {
|
|
|
30935
31279
|
buttonDisable$(cardMatchROI);
|
|
30936
31280
|
}
|
|
30937
31281
|
if (ocrEngineConfig.expiredIn && !sdkFlowTimeout) {
|
|
31282
|
+
countDownTime = new Date().getTime() + ocrEngineConfig.expiredIn * util.TIME_UNIT.SECOND;
|
|
30938
31283
|
sdkFlowTimeout = makeSDKFlowTimeout(ocrEngineConfig.expiredIn);
|
|
30939
31284
|
}
|
|
30940
31285
|
})), sendFrame(canvasSizeInfo, uiComponentOCR.image, uiComponentBasic.video, config.onAntiFraudFrame, ocrEngineConfig.fraudMaxFps, false, 'jpg', undefined), rxjs.map(x => x.result), rxjs.tap(x => {
|
|
@@ -31172,7 +31517,9 @@ function startOCR(config) {
|
|
|
31172
31517
|
let ocrSendFrameAnimation = false;
|
|
31173
31518
|
const handleOcrSendFrame = (canvasSizeInfo, canvas, video, frameCallback, fps, bas64Format, imageType, cardType, type) => source$ => {
|
|
31174
31519
|
let received = true;
|
|
31175
|
-
const ctx = canvas.getContext('2d'
|
|
31520
|
+
const ctx = canvas.getContext('2d', {
|
|
31521
|
+
willReadFrequently: true
|
|
31522
|
+
});
|
|
31176
31523
|
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 => {
|
|
31177
31524
|
// send to fast, ignore
|
|
31178
31525
|
if (e instanceof core.AuthmeError && e.code === core.ErrorCode.RECOGNITION_NOT_AVAILABLE) {
|
|
@@ -31240,6 +31587,7 @@ function startOCR(config) {
|
|
|
31240
31587
|
return init(retry).pipe(rxjs.tap(() => {
|
|
31241
31588
|
setStatusView(core.StatusView.Running);
|
|
31242
31589
|
if (ocrEngineConfig.expiredIn && !sdkFlowTimeout) {
|
|
31590
|
+
countDownTime = new Date().getTime() + ocrEngineConfig.expiredIn * util.TIME_UNIT.SECOND;
|
|
31243
31591
|
sdkFlowTimeout = makeSDKFlowTimeout(ocrEngineConfig.expiredIn);
|
|
31244
31592
|
}
|
|
31245
31593
|
}), rxjs.switchMap(canvasSizeInfo => {
|
|
@@ -31430,26 +31778,66 @@ function startOCR(config) {
|
|
|
31430
31778
|
}), rxjs.switchMap(() => config.onSuccess()), rxjs.tap(() => {
|
|
31431
31779
|
setStatusEvent$1(cardClassResultMapping(config.acceptTypes[config.acceptTypes.length - 1]));
|
|
31432
31780
|
util.stopSpinner();
|
|
31433
|
-
|
|
31781
|
+
// only for TWN IDCard handle ocr result page
|
|
31782
|
+
if (config.cardTypes[0].includes(idRecognition.IdRecognitionCardType.IDCard) && config.cardTypes[0].includes(idRecognition.CountryCode.TWN)) ; else {
|
|
31783
|
+
uiComponentBasic.container.style.display = 'none';
|
|
31784
|
+
}
|
|
31434
31785
|
}), rxjs.concatMap(result => __awaiter(this, void 0, void 0, function* () {
|
|
31435
31786
|
setStatusView(core.StatusView.Confirm);
|
|
31436
31787
|
let modifiedData = result2ModifiedData(result.details);
|
|
31437
31788
|
if (config.ocrConfig.displayResultPage) {
|
|
31438
|
-
|
|
31439
|
-
|
|
31440
|
-
|
|
31441
|
-
|
|
31442
|
-
|
|
31443
|
-
|
|
31444
|
-
|
|
31445
|
-
|
|
31446
|
-
|
|
31447
|
-
|
|
31448
|
-
|
|
31449
|
-
|
|
31450
|
-
|
|
31789
|
+
// only for TWN IDCard
|
|
31790
|
+
if (config.cardTypes[0].includes(idRecognition.IdRecognitionCardType.IDCard) && config.cardTypes[0].includes(idRecognition.CountryCode.TWN)) {
|
|
31791
|
+
const keyMapping = {
|
|
31792
|
+
[idRecognition.IdRecognitionCardType.IDCard]: 'idCard',
|
|
31793
|
+
[idRecognition.IdRecognitionCardType.DriverLicense]: 'driverLicense',
|
|
31794
|
+
[idRecognition.IdRecognitionCardType.HealthCard]: 'HealthCard',
|
|
31795
|
+
[idRecognition.IdRecognitionCardType.ResidentCard]: 'residentCard',
|
|
31796
|
+
[idRecognition.IdRecognitionCardType.Passport]: 'passport'
|
|
31797
|
+
};
|
|
31798
|
+
const res = yield ocrResultModal({
|
|
31799
|
+
title: `${'請確認'}${translateService.translate(config.ocrConfig.type ? `sdk.ocr.verify.result.title.${keyMapping[config.ocrConfig.type]}` : '')}`,
|
|
31800
|
+
subtitle: '若資料有錯誤,可點擊內容進行修改',
|
|
31801
|
+
items: result.ocrResultFilds,
|
|
31802
|
+
confirmText: translateService.translate('sdk.general.confirm'),
|
|
31803
|
+
hintText: '逾時將自動轉跳至選單頁並無法保存此次紀錄',
|
|
31804
|
+
countDown1Text: '請在',
|
|
31805
|
+
countDown2Text: '內完成確認',
|
|
31806
|
+
countDownTime,
|
|
31807
|
+
cancelText: translateService.translate('sdk.general.cancel'),
|
|
31808
|
+
onConfirm: result => {
|
|
31809
|
+
modifiedData = result;
|
|
31810
|
+
},
|
|
31811
|
+
onClose: () => {
|
|
31812
|
+
// console.log('onClose');
|
|
31813
|
+
}
|
|
31814
|
+
});
|
|
31815
|
+
if (res === 'close') {
|
|
31816
|
+
const cancelResultObj = {
|
|
31817
|
+
isSuccess: false,
|
|
31818
|
+
code: `${core.ErrorCode.USER_CANCEL}`,
|
|
31819
|
+
message: new core.AuthmeError(core.ErrorCode.USER_CANCEL).message,
|
|
31820
|
+
data: {}
|
|
31821
|
+
};
|
|
31822
|
+
return cancelResultObj;
|
|
31451
31823
|
}
|
|
31452
|
-
}
|
|
31824
|
+
} else {
|
|
31825
|
+
modifiedData = yield renderConfirmUI({
|
|
31826
|
+
cardType: config.ocrConfig.type,
|
|
31827
|
+
items: {
|
|
31828
|
+
columns: Object.keys(result.details).sort((a, b) => {
|
|
31829
|
+
const aScore = idRecognition.getRecognitionColumnOrder(a);
|
|
31830
|
+
const bScore = idRecognition.getRecognitionColumnOrder(b);
|
|
31831
|
+
return aScore - bScore || a.localeCompare(b);
|
|
31832
|
+
}),
|
|
31833
|
+
details: result.details
|
|
31834
|
+
},
|
|
31835
|
+
options: {
|
|
31836
|
+
headerIcon: config.ocrConfig.icon,
|
|
31837
|
+
translate: key => translateService.translate(key)
|
|
31838
|
+
}
|
|
31839
|
+
});
|
|
31840
|
+
}
|
|
31453
31841
|
}
|
|
31454
31842
|
flags.onConfirm = true;
|
|
31455
31843
|
util.Storage.setItem('scanId', result.scanId);
|
|
@@ -31883,6 +32271,7 @@ function startOCR(config) {
|
|
|
31883
32271
|
sdkFlowTimeout.unsubscribe();
|
|
31884
32272
|
sdkFlowTimeout = null;
|
|
31885
32273
|
}
|
|
32274
|
+
countDownTime = 0;
|
|
31886
32275
|
eventListenerService$1.stop();
|
|
31887
32276
|
util.hidePopup();
|
|
31888
32277
|
uiComponentBasic.container.remove();
|
|
@@ -32376,7 +32765,9 @@ class LivenessVerifyModule {
|
|
|
32376
32765
|
const result = yield this.fasService.recognition(data);
|
|
32377
32766
|
if (this.canvas) {
|
|
32378
32767
|
const debugData = yield (_c = this.fasService) === null || _c === void 0 ? void 0 : _c.getDebugImageData(data);
|
|
32379
|
-
const ctx = this.canvas.getContext('2d'
|
|
32768
|
+
const ctx = this.canvas.getContext('2d', {
|
|
32769
|
+
willReadFrequently: true
|
|
32770
|
+
});
|
|
32380
32771
|
this.canvas.width = frameWidth;
|
|
32381
32772
|
this.canvas.height = frameHeight;
|
|
32382
32773
|
ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
@@ -32563,7 +32954,7 @@ class LivenessModule {
|
|
|
32563
32954
|
try {
|
|
32564
32955
|
const result = yield rxjs.firstValueFrom(yield startLiveness({
|
|
32565
32956
|
getOptionConfig: () => __awaiter(this, void 0, void 0, function* () {
|
|
32566
|
-
const res = yield liveness.LivenessAPI.IdentityVerification.option();
|
|
32957
|
+
const res = yield liveness.LivenessAPI.IdentityVerification.option(config.deviceType);
|
|
32567
32958
|
const themeId = res.themeId;
|
|
32568
32959
|
if (!themeId) {
|
|
32569
32960
|
return {};
|
|
@@ -32623,7 +33014,9 @@ class LivenessModule {
|
|
|
32623
33014
|
const result = yield this.fasService.recognition(data);
|
|
32624
33015
|
if (this.canvas) {
|
|
32625
33016
|
const debugData = yield (_b = this.fasService) === null || _b === void 0 ? void 0 : _b.getDebugImageData(data);
|
|
32626
|
-
const ctx = this.canvas.getContext('2d'
|
|
33017
|
+
const ctx = this.canvas.getContext('2d', {
|
|
33018
|
+
willReadFrequently: true
|
|
33019
|
+
});
|
|
32627
33020
|
this.canvas.width = frameWidth;
|
|
32628
33021
|
this.canvas.height = frameHeight;
|
|
32629
33022
|
ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
@@ -33121,7 +33514,9 @@ class MRZModule {
|
|
|
33121
33514
|
const mrzResult = yield this.mrzService.recognition(data);
|
|
33122
33515
|
if (this.canvas) {
|
|
33123
33516
|
const debugData = yield (_d = this.mrzService) === null || _d === void 0 ? void 0 : _d.getDebugImageData(data);
|
|
33124
|
-
const ctx = this.canvas.getContext('2d'
|
|
33517
|
+
const ctx = this.canvas.getContext('2d', {
|
|
33518
|
+
willReadFrequently: true
|
|
33519
|
+
});
|
|
33125
33520
|
this.canvas.width = frameWidth;
|
|
33126
33521
|
this.canvas.height = frameHeight;
|
|
33127
33522
|
ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
@@ -33282,7 +33677,8 @@ class MRZModule {
|
|
|
33282
33677
|
yield util.waitTime(1000);
|
|
33283
33678
|
return {
|
|
33284
33679
|
scanId: scanId,
|
|
33285
|
-
details: latestTField !== null && latestTField !== void 0 ? latestTField : {}
|
|
33680
|
+
details: latestTField !== null && latestTField !== void 0 ? latestTField : {},
|
|
33681
|
+
ocrResultFilds: []
|
|
33286
33682
|
};
|
|
33287
33683
|
}),
|
|
33288
33684
|
onDestroy: () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -33535,6 +33931,7 @@ class OCRModule {
|
|
|
33535
33931
|
let backImage = null;
|
|
33536
33932
|
let frontCropImage = null;
|
|
33537
33933
|
let backCropImage = null;
|
|
33934
|
+
let ocrResultFilds = [];
|
|
33538
33935
|
const {
|
|
33539
33936
|
getDebugLogsLength,
|
|
33540
33937
|
modifyDeubgLog,
|
|
@@ -33624,8 +34021,7 @@ class OCRModule {
|
|
|
33624
34021
|
cardTypeConfigs: cardTypeConfigs,
|
|
33625
34022
|
ocrConfig: config,
|
|
33626
34023
|
getOptionConfig: () => __awaiter(this, void 0, void 0, function* () {
|
|
33627
|
-
const res = yield idRecognition.option();
|
|
33628
|
-
console.log('themeId:', res.themeId);
|
|
34024
|
+
const res = yield idRecognition.option(config.deviceType);
|
|
33629
34025
|
const themeId = res.themeId;
|
|
33630
34026
|
if (!themeId) {
|
|
33631
34027
|
return {};
|
|
@@ -34056,7 +34452,9 @@ class OCRModule {
|
|
|
34056
34452
|
}
|
|
34057
34453
|
if (this.canvas) {
|
|
34058
34454
|
const debugData = yield (_f = this.antiFraudInstance) === null || _f === void 0 ? void 0 : _f.getDebugImageData(data);
|
|
34059
|
-
const ctx = this.canvas.getContext('2d'
|
|
34455
|
+
const ctx = this.canvas.getContext('2d', {
|
|
34456
|
+
willReadFrequently: true
|
|
34457
|
+
});
|
|
34060
34458
|
this.canvas.width = frameWidth;
|
|
34061
34459
|
this.canvas.height = frameHeight;
|
|
34062
34460
|
ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
@@ -34183,7 +34581,9 @@ class OCRModule {
|
|
|
34183
34581
|
});
|
|
34184
34582
|
if (this.canvas) {
|
|
34185
34583
|
const debugData = yield _service === null || _service === void 0 ? void 0 : _service.getDebugImageData(data);
|
|
34186
|
-
const ctx = this.canvas.getContext('2d'
|
|
34584
|
+
const ctx = this.canvas.getContext('2d', {
|
|
34585
|
+
willReadFrequently: true
|
|
34586
|
+
});
|
|
34187
34587
|
this.canvas.width = frameWidth;
|
|
34188
34588
|
this.canvas.height = frameHeight;
|
|
34189
34589
|
ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
@@ -34222,7 +34622,6 @@ class OCRModule {
|
|
|
34222
34622
|
// downloadImage(image, `${frameIndex}-${docInfos[type as EAuthMeCardClass].docId}-${new Date().getTime().toString()}.jpg`)
|
|
34223
34623
|
frameIndex++;
|
|
34224
34624
|
util.backgroundRequest(() => __awaiter(this, void 0, void 0, function* () {
|
|
34225
|
-
console.log('recognition', docInfos[cardType !== null && cardType !== void 0 ? cardType : ''].docId);
|
|
34226
34625
|
if (docInfos[eClass].docId === '') {
|
|
34227
34626
|
console.warn('didnt find docid, retry');
|
|
34228
34627
|
return false;
|
|
@@ -34381,7 +34780,7 @@ class OCRModule {
|
|
|
34381
34780
|
throw 'recognition failed';
|
|
34382
34781
|
}
|
|
34383
34782
|
result = unionMerge(result, resp && resp.details || {});
|
|
34384
|
-
yield SendRequestWithRetry(() => __awaiter(this, void 0, void 0, function* () {
|
|
34783
|
+
const res = yield SendRequestWithRetry(() => __awaiter(this, void 0, void 0, function* () {
|
|
34385
34784
|
const postData = {
|
|
34386
34785
|
scanDocumentId: docId,
|
|
34387
34786
|
details: resp === null || resp === void 0 ? void 0 : resp.details,
|
|
@@ -34402,7 +34801,11 @@ class OCRModule {
|
|
|
34402
34801
|
// needFraudOption ? this.fraudResult : null
|
|
34403
34802
|
// )
|
|
34404
34803
|
);
|
|
34405
|
-
|
|
34804
|
+
// ocrResultFilds = res.fields.concat(ocrResultFilds);
|
|
34805
|
+
ocrResultFilds = ocrResultFilds.map(item1 => {
|
|
34806
|
+
const item2 = res.fields.find(item => item.name === item1.name);
|
|
34807
|
+
return item2 ? Object.assign(Object.assign({}, item1), item2) : item1;
|
|
34808
|
+
}).concat(res.fields.filter(item2 => !ocrResultFilds.some(item1 => item1.name === item2.name)));
|
|
34406
34809
|
delete docInfos[option.cardType];
|
|
34407
34810
|
return true;
|
|
34408
34811
|
} catch (error) {
|
|
@@ -34578,7 +34981,9 @@ class OCRModule {
|
|
|
34578
34981
|
}
|
|
34579
34982
|
if (this.canvas) {
|
|
34580
34983
|
const debugData = yield (_j = this.antiFraudInstance) === null || _j === void 0 ? void 0 : _j.getDebugImageData(data);
|
|
34581
|
-
const ctx = this.canvas.getContext('2d'
|
|
34984
|
+
const ctx = this.canvas.getContext('2d', {
|
|
34985
|
+
willReadFrequently: true
|
|
34986
|
+
});
|
|
34582
34987
|
this.canvas.width = frameWidth;
|
|
34583
34988
|
this.canvas.height = frameHeight;
|
|
34584
34989
|
ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
@@ -34725,7 +35130,8 @@ class OCRModule {
|
|
|
34725
35130
|
frontImage,
|
|
34726
35131
|
backImage,
|
|
34727
35132
|
frontCropImage,
|
|
34728
|
-
backCropImage
|
|
35133
|
+
backCropImage,
|
|
35134
|
+
ocrResultFilds
|
|
34729
35135
|
};
|
|
34730
35136
|
}),
|
|
34731
35137
|
onDestroy: () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -34787,7 +35193,7 @@ function renderCardTypeAndCountryConfig(config) {
|
|
|
34787
35193
|
currentCardTypeAndCountry = Object.assign(Object.assign({}, currentCardTypeAndCountry), {
|
|
34788
35194
|
country
|
|
34789
35195
|
});
|
|
34790
|
-
countrySelectDropdownText.innerText = translate(`sdk.
|
|
35196
|
+
countrySelectDropdownText.innerText = translate(`sdk.general.country.${country}`);
|
|
34791
35197
|
};
|
|
34792
35198
|
const dropdownSwitch = switchTarget => {
|
|
34793
35199
|
const closeDropdown = () => {
|
|
@@ -34824,7 +35230,7 @@ function renderCardTypeAndCountryConfig(config) {
|
|
|
34824
35230
|
<label class="country-select-label">${translate('sdk.home.selectCountry')}</label>
|
|
34825
35231
|
<div class="country-select-dropdown">
|
|
34826
35232
|
<div class="country-select-dropdown-frame">
|
|
34827
|
-
<div class="country-select-dropdown-text">${translate(`sdk.
|
|
35233
|
+
<div class="country-select-dropdown-text">${translate(`sdk.general.country.${config.defaultCountry}`)}</div>
|
|
34828
35234
|
<div class="country-select-dropdown-icon"></div>
|
|
34829
35235
|
</div>
|
|
34830
35236
|
<div class="dropdown-country-list"></div>
|
|
@@ -34855,7 +35261,7 @@ function renderCardTypeAndCountryConfig(config) {
|
|
|
34855
35261
|
countryDom.classList.add('dropdown-country-list-item');
|
|
34856
35262
|
countryDom.innerHTML = `
|
|
34857
35263
|
<div class="dropdown-country-list-item-frame">
|
|
34858
|
-
<div class="dropdown-country-list-item-text">${translate(`sdk.
|
|
35264
|
+
<div class="dropdown-country-list-item-text">${translate(`sdk.general.country.${country}`)}</div>
|
|
34859
35265
|
</div>
|
|
34860
35266
|
`;
|
|
34861
35267
|
countryDom.addEventListener('click', event => {
|
|
@@ -34960,6 +35366,7 @@ class AuthmeIdentityVerification extends engine.AuthmeFunctionModule {
|
|
|
34960
35366
|
super(...arguments);
|
|
34961
35367
|
this.isAuth = false;
|
|
34962
35368
|
this.tearDownPromise = undefined;
|
|
35369
|
+
this.DEVICE_TYPE = util.DEVICE_TYPE;
|
|
34963
35370
|
}
|
|
34964
35371
|
// livenessVerify 可能是過時的產物,暫時不支援 LIVENESS_VERIFY module。
|
|
34965
35372
|
preloadAsync(modules) {
|
|
@@ -35242,8 +35649,8 @@ class AuthmeIdentityVerification extends engine.AuthmeFunctionModule {
|
|
|
35242
35649
|
}
|
|
35243
35650
|
|
|
35244
35651
|
var name = "authme/sdk";
|
|
35245
|
-
var version$1 = "2.8.
|
|
35246
|
-
var date = "2025-03-
|
|
35652
|
+
var version$1 = "2.8.5";
|
|
35653
|
+
var date = "2025-03-17T05:56:00+0000";
|
|
35247
35654
|
var packageInfo = {
|
|
35248
35655
|
name: name,
|
|
35249
35656
|
version: version$1,
|