@authme/util 2.8.0 → 2.8.2
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 +464 -10
- package/index.js +459 -11
- package/package.json +1 -1
- package/src/index.d.ts +1 -0
- package/src/lib/const.d.ts +1 -0
- package/src/ui/index.d.ts +2 -0
- package/src/ui/spinner.d.ts +5 -1
- package/src/ui/uiThemeStyle.d.ts +4 -0
- package/src/ui/uploadModal.d.ts +14 -0
package/index.cjs
CHANGED
|
@@ -25,9 +25,9 @@ require('core-js/modules/es.array.includes.js');
|
|
|
25
25
|
require('core-js/modules/es.string.includes.js');
|
|
26
26
|
var fileSaver = require('file-saver');
|
|
27
27
|
var JSZip = require('jszip');
|
|
28
|
+
require('core-js/modules/es.parse-int.js');
|
|
28
29
|
var Lottie = require('lottie-web');
|
|
29
30
|
require('core-js/modules/es.array.sort.js');
|
|
30
|
-
require('core-js/modules/es.parse-int.js');
|
|
31
31
|
require('core-js/modules/es.string.trim.js');
|
|
32
32
|
require('core-js/modules/es.string.starts-with.js');
|
|
33
33
|
require('core-js/modules/es.symbol.description.js');
|
|
@@ -995,9 +995,65 @@ function cropByRatio(width, height, ratio) {
|
|
|
995
995
|
};
|
|
996
996
|
}
|
|
997
997
|
|
|
998
|
-
|
|
998
|
+
const fontWeight = {
|
|
999
|
+
regular: '400',
|
|
1000
|
+
medium: '500',
|
|
1001
|
+
bold: '700'
|
|
1002
|
+
};
|
|
1003
|
+
const hexToRgba = (hex, alpha = 1) => {
|
|
1004
|
+
// 移除 # 符號(如果有的話)
|
|
1005
|
+
hex = hex.replace(/^#/, '');
|
|
1006
|
+
// 解析短格式 (e.g., #RGB -> #RRGGBB)
|
|
1007
|
+
if (hex.length === 3) {
|
|
1008
|
+
hex = hex.split('').map(x => x + x).join('');
|
|
1009
|
+
}
|
|
1010
|
+
// 確保是有效的 HEX 格式
|
|
1011
|
+
if (hex.length !== 6) {
|
|
1012
|
+
throw new Error('Invalid HEX color.');
|
|
1013
|
+
}
|
|
1014
|
+
// 轉換 HEX 到 RGB
|
|
1015
|
+
const r = parseInt(hex.substring(0, 2), 16);
|
|
1016
|
+
const g = parseInt(hex.substring(2, 4), 16);
|
|
1017
|
+
const b = parseInt(hex.substring(4, 6), 16);
|
|
1018
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
1019
|
+
};
|
|
1020
|
+
const uiThemeText = (dom, textStyle) => {
|
|
1021
|
+
dom.style.color = textStyle.textColor;
|
|
1022
|
+
dom.style.fontWeight = fontWeight[textStyle.textWeight];
|
|
1023
|
+
dom.style.fontSize = `${textStyle.fontSize}px`;
|
|
1024
|
+
};
|
|
1025
|
+
const uiThemeHint = (dom, hintStyle) => {
|
|
1026
|
+
dom.style.borderRadius = `${hintStyle.cornerRadius}px`;
|
|
1027
|
+
dom.style.backgroundColor = hintStyle.backgroundColor;
|
|
1028
|
+
dom.style.opacity = hintStyle.opacity;
|
|
1029
|
+
dom.style.color = hintStyle.textColor;
|
|
1030
|
+
dom.style.fontWeight = fontWeight[hintStyle.textWeight];
|
|
1031
|
+
dom.style.fontSize = `${hintStyle.fontSize}px`;
|
|
1032
|
+
};
|
|
1033
|
+
const uiThemeButton = (dom, buttonStyle) => {
|
|
1034
|
+
dom.style.borderRadius = `${buttonStyle.cornerRadius}px`;
|
|
1035
|
+
dom.style.backgroundColor = buttonStyle.backgroundColor;
|
|
1036
|
+
dom.style.opacity = buttonStyle.backgroundOpacity;
|
|
1037
|
+
dom.style.color = buttonStyle.textColor;
|
|
1038
|
+
dom.style.borderColor = hexToRgba(buttonStyle.borderColor, buttonStyle.borderOpacity);
|
|
1039
|
+
dom.style.borderWidth = `${buttonStyle.borderWidth}px`;
|
|
1040
|
+
dom.style.fontWeight = fontWeight[buttonStyle.textWeight];
|
|
1041
|
+
dom.style.fontSize = `${buttonStyle.fontSize}px`;
|
|
1042
|
+
dom.style.borderStyle = 'solid';
|
|
1043
|
+
dom.style.height = `${buttonStyle.cornerRadius * 2}px`;
|
|
1044
|
+
dom.style.width = `calc(100% - ${buttonStyle.cornerRadius * 2}px)`;
|
|
1045
|
+
dom.style.maxWidth = `327px`;
|
|
1046
|
+
};
|
|
1047
|
+
|
|
1048
|
+
function startSpinner(args) {
|
|
999
1049
|
const loadingLottie = Storage.getItem(exports.STORAGE_KEY.LOADING_LOTTIE);
|
|
1050
|
+
const themeConfig = Storage.getItem('themeConfig');
|
|
1000
1051
|
const body = document.querySelector('.authme-container');
|
|
1052
|
+
//Statement
|
|
1053
|
+
const statementContainer = document.createElement('div');
|
|
1054
|
+
statementContainer.classList.add('statement');
|
|
1055
|
+
uiThemeText(statementContainer, themeConfig.bodyThreeDarkMode);
|
|
1056
|
+
statementContainer.textContent = args.statement || '';
|
|
1001
1057
|
if (loadingLottie) {
|
|
1002
1058
|
const loadingSDKOuter = document.createElement('div');
|
|
1003
1059
|
const loadingSDKContent = document.createElement('div');
|
|
@@ -1014,12 +1070,18 @@ function startSpinner(text, backgroundOpaque) {
|
|
|
1014
1070
|
animationData: loadingLottie
|
|
1015
1071
|
});
|
|
1016
1072
|
body === null || body === void 0 ? void 0 : body.appendChild(loadingSDKOuter);
|
|
1017
|
-
if (text) {
|
|
1073
|
+
if (args.text) {
|
|
1018
1074
|
loadingSDKText.classList.add('authme-loading-sdk-text');
|
|
1019
|
-
loadingSDKText.textContent = text;
|
|
1075
|
+
loadingSDKText.textContent = args.text;
|
|
1076
|
+
loadingSDKText.style.color = themeConfig.titleTwo.textColor;
|
|
1077
|
+
loadingSDKText.style.fontWeight = themeConfig.titleTwo.textWeight;
|
|
1078
|
+
loadingSDKText.style.fontSize = `${themeConfig.titleTwo.fontSize}px`;
|
|
1020
1079
|
loadingSDKContent.appendChild(loadingSDKText);
|
|
1021
1080
|
}
|
|
1022
|
-
if (backgroundOpaque) {
|
|
1081
|
+
if (args.backgroundOpaque) {
|
|
1082
|
+
loadingSDKOuter.classList.add('loading-outer--opaque');
|
|
1083
|
+
}
|
|
1084
|
+
if (args.backgroundOpaque) {
|
|
1023
1085
|
loadingSDKOuter.classList.add('authme-loading-sdk-outer--opaque');
|
|
1024
1086
|
}
|
|
1025
1087
|
return;
|
|
@@ -1030,14 +1092,21 @@ function startSpinner(text, backgroundOpaque) {
|
|
|
1030
1092
|
spinnerOuter.appendChild(spinner);
|
|
1031
1093
|
spinnerOuter.className = 'loading-outer';
|
|
1032
1094
|
spinner.className = 'loading';
|
|
1033
|
-
|
|
1095
|
+
spinner.style.borderRightColor = themeConfig.loadingViewContentColor;
|
|
1096
|
+
spinner.style.borderBottomColor = themeConfig.loadingViewContentColor;
|
|
1097
|
+
spinner.style.borderLeftColor = themeConfig.loadingViewContentColor;
|
|
1098
|
+
if (args.text) {
|
|
1034
1099
|
spinnerText.className = 'loading-text';
|
|
1035
|
-
spinnerText.textContent = text;
|
|
1100
|
+
spinnerText.textContent = args.text;
|
|
1101
|
+
uiThemeText(spinnerText, themeConfig.titleTwo);
|
|
1036
1102
|
spinnerOuter.appendChild(spinnerText);
|
|
1037
1103
|
}
|
|
1038
|
-
if (backgroundOpaque) {
|
|
1104
|
+
if (args.backgroundOpaque) {
|
|
1039
1105
|
spinnerOuter.classList.add('loading-outer--opaque');
|
|
1040
1106
|
}
|
|
1107
|
+
if (themeConfig.isStatementEnabled) {
|
|
1108
|
+
spinnerOuter.appendChild(statementContainer);
|
|
1109
|
+
}
|
|
1041
1110
|
body === null || body === void 0 ? void 0 : body.appendChild(spinnerOuter);
|
|
1042
1111
|
}
|
|
1043
1112
|
function stopSpinner() {
|
|
@@ -2490,6 +2559,106 @@ function RGBToLottieColor(color) {
|
|
|
2490
2559
|
return color.map(c => c / 255);
|
|
2491
2560
|
}
|
|
2492
2561
|
|
|
2562
|
+
const uploadModal = arg => {
|
|
2563
|
+
const authmeContainer = document.querySelector('.authme-container');
|
|
2564
|
+
if (!authmeContainer) {
|
|
2565
|
+
console.error('uploadModal: authmeContainer not found');
|
|
2566
|
+
return;
|
|
2567
|
+
}
|
|
2568
|
+
const uiThemeConfig = Storage.getItem('themeConfig');
|
|
2569
|
+
function removeModal() {
|
|
2570
|
+
var _a;
|
|
2571
|
+
(_a = document.querySelector('.video-container__upload')) === null || _a === void 0 ? void 0 : _a.remove();
|
|
2572
|
+
}
|
|
2573
|
+
const domModal = document.createElement('div');
|
|
2574
|
+
const domIcon = document.createElement('div');
|
|
2575
|
+
const domTitle = document.createElement('div');
|
|
2576
|
+
const domMessage = document.createElement('div');
|
|
2577
|
+
const domStatement = document.createElement('div');
|
|
2578
|
+
const domFooterContainer = document.createElement('div');
|
|
2579
|
+
const domClose = document.createElement('div');
|
|
2580
|
+
const domRetry = document.createElement('div');
|
|
2581
|
+
domModal.classList.add('video-container__upload');
|
|
2582
|
+
domIcon.classList.add('video-container__upload-icon');
|
|
2583
|
+
domTitle.classList.add('video-container__upload-title');
|
|
2584
|
+
domMessage.classList.add('video-container__upload-message');
|
|
2585
|
+
domStatement.classList.add('video-container__upload-statement');
|
|
2586
|
+
domFooterContainer.classList.add('video-container__upload-footer-container');
|
|
2587
|
+
domClose.classList.add('video-container__upload-close');
|
|
2588
|
+
domRetry.classList.add('video-container__upload-retry');
|
|
2589
|
+
uiThemeText(domTitle, uiThemeConfig.titleTwo);
|
|
2590
|
+
uiThemeText(domMessage, uiThemeConfig.bodyOne);
|
|
2591
|
+
if (arg.type === 'success') {
|
|
2592
|
+
domIcon.innerHTML = `<svg width="49" height="48" viewBox="0 0 49 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2593
|
+
<rect x="0.5" width="48" height="48" rx="24" fill="${uiThemeConfig.uploadCompleteView.backgroundColor}" fill-opacity="${uiThemeConfig.uploadCompleteView.backgroundOpacity}" />
|
|
2594
|
+
<g clip-path="url(#clip0_21855_2149)">
|
|
2595
|
+
<path d="M16.25 25.5L21.5 30.75L33.5 18.75" stroke="${uiThemeConfig.uploadCompleteView.contentColor}" stroke-opacity="${uiThemeConfig.uploadCompleteView.contentOpacity}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2596
|
+
</g>
|
|
2597
|
+
<defs>
|
|
2598
|
+
<clipPath id="clip0_21855_2149">
|
|
2599
|
+
<rect width="24" height="24" fill="white" transform="translate(12.5 12)"/>
|
|
2600
|
+
</clipPath>
|
|
2601
|
+
</defs>
|
|
2602
|
+
</svg>`;
|
|
2603
|
+
}
|
|
2604
|
+
if (arg.type === 'error') {
|
|
2605
|
+
domIcon.innerHTML = `<svg width="49" height="48" viewBox="0 0 49 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2606
|
+
<rect x="0.5" width="48" height="48" rx="24" fill="${uiThemeConfig.uploadIncompleteView.backgroundColor}" fill-opacity="${uiThemeConfig.uploadIncompleteView.backgroundOpacity}"/>
|
|
2607
|
+
<g clip-path="url(#clip0_21855_2690)">
|
|
2608
|
+
<path d="M31.25 17.25L17.75 30.75" stroke="${uiThemeConfig.uploadIncompleteView.contentColor}" stroke-opacity="${uiThemeConfig.uploadIncompleteView.contentOpacity}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2609
|
+
<path d="M31.25 30.75L17.75 17.25" stroke="${uiThemeConfig.uploadIncompleteView.contentColor}" stroke-opacity="${uiThemeConfig.uploadIncompleteView.contentOpacity}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2610
|
+
</g>
|
|
2611
|
+
<defs>
|
|
2612
|
+
<clipPath id="clip0_21855_2690">
|
|
2613
|
+
<rect width="24" height="24" fill="white" transform="translate(12.5 12)"/>
|
|
2614
|
+
</clipPath>
|
|
2615
|
+
</defs>
|
|
2616
|
+
</svg>
|
|
2617
|
+
`;
|
|
2618
|
+
}
|
|
2619
|
+
if (arg.type === 'success') {
|
|
2620
|
+
domTitle.innerText = arg.titleSuccess || '';
|
|
2621
|
+
domMessage.innerText = arg.messageSuccess || '';
|
|
2622
|
+
}
|
|
2623
|
+
if (arg.type === 'error') {
|
|
2624
|
+
domTitle.innerText = arg.titleError || '';
|
|
2625
|
+
domMessage.innerText = arg.messageError || '';
|
|
2626
|
+
}
|
|
2627
|
+
domModal.appendChild(domIcon);
|
|
2628
|
+
domModal.appendChild(domTitle);
|
|
2629
|
+
domModal.appendChild(domMessage);
|
|
2630
|
+
if (uiThemeConfig.isStatementEnabled && arg.statement && arg.type === 'success') {
|
|
2631
|
+
uiThemeText(domStatement, uiThemeConfig.bodyThree);
|
|
2632
|
+
domStatement.innerText = arg.statement;
|
|
2633
|
+
domModal.appendChild(domStatement);
|
|
2634
|
+
}
|
|
2635
|
+
if (arg.type === 'error' && arg.retryText && arg.closeText) {
|
|
2636
|
+
uiThemeButton(domRetry, uiThemeConfig.majorButton);
|
|
2637
|
+
domRetry.innerText = arg.retryText;
|
|
2638
|
+
domRetry.addEventListener('click', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
2639
|
+
if (arg.onRetry) {
|
|
2640
|
+
yield arg.onRetry();
|
|
2641
|
+
}
|
|
2642
|
+
removeModal();
|
|
2643
|
+
}));
|
|
2644
|
+
uiThemeButton(domClose, uiThemeConfig.minorButton);
|
|
2645
|
+
domClose.innerText = arg.closeText;
|
|
2646
|
+
domClose.addEventListener('click', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
2647
|
+
if (arg.onClose) {
|
|
2648
|
+
yield arg.onClose();
|
|
2649
|
+
}
|
|
2650
|
+
removeModal();
|
|
2651
|
+
}));
|
|
2652
|
+
domFooterContainer.appendChild(domRetry);
|
|
2653
|
+
domFooterContainer.appendChild(domClose);
|
|
2654
|
+
domModal.appendChild(domFooterContainer);
|
|
2655
|
+
}
|
|
2656
|
+
authmeContainer.appendChild(domModal);
|
|
2657
|
+
return {
|
|
2658
|
+
removeModal
|
|
2659
|
+
};
|
|
2660
|
+
};
|
|
2661
|
+
|
|
2493
2662
|
const QUEUE_LENGTH = 10;
|
|
2494
2663
|
const requstQueue = [];
|
|
2495
2664
|
function pushRequest(request) {
|
|
@@ -2517,9 +2686,288 @@ window.ononline = () => {
|
|
|
2517
2686
|
});
|
|
2518
2687
|
};
|
|
2519
2688
|
|
|
2689
|
+
const themeConfigDefault = {
|
|
2690
|
+
isFraudAnimationLoadingPageEnabled: true,
|
|
2691
|
+
isStatementEnabled: true,
|
|
2692
|
+
isLivenessIntroPageEnabled: true,
|
|
2693
|
+
resultPageCountdown: {
|
|
2694
|
+
// 結果頁倒數的參數們
|
|
2695
|
+
// 結果頁是否顯示倒數
|
|
2696
|
+
isEnabled: true,
|
|
2697
|
+
// 倒數敘述文字
|
|
2698
|
+
textColor: '#212121',
|
|
2699
|
+
textWeight: 'regular',
|
|
2700
|
+
fontSize: 14,
|
|
2701
|
+
// 倒數時間
|
|
2702
|
+
timeTextColor: '#FF3B30',
|
|
2703
|
+
timeTextWeight: 'regular',
|
|
2704
|
+
timeFontSize: 14
|
|
2705
|
+
},
|
|
2706
|
+
headerTitle: {
|
|
2707
|
+
// G.H.2
|
|
2708
|
+
// Header(畫面上方標題,如前導頁)的參數們
|
|
2709
|
+
textColor: '#212121',
|
|
2710
|
+
textWeight: 'medium',
|
|
2711
|
+
fontSize: 18
|
|
2712
|
+
},
|
|
2713
|
+
nonEkycCloseButton: {
|
|
2714
|
+
// G.A.3
|
|
2715
|
+
// 非ekyc流程中的X
|
|
2716
|
+
contentColor: '#424242',
|
|
2717
|
+
contentOpacity: 1
|
|
2718
|
+
},
|
|
2719
|
+
backButton: {
|
|
2720
|
+
// iOS only
|
|
2721
|
+
// ekyc流程中的返回
|
|
2722
|
+
contentColor: '#424242',
|
|
2723
|
+
contentOpacity: 1
|
|
2724
|
+
},
|
|
2725
|
+
ekycCloseButton: {
|
|
2726
|
+
// G.A.1、G.A.2
|
|
2727
|
+
// ekyc流程中的X
|
|
2728
|
+
contentColor: '#ffffff',
|
|
2729
|
+
contentOpacity: 1,
|
|
2730
|
+
backgroundColor: '#000000',
|
|
2731
|
+
backgroundOpacity: 0.2
|
|
2732
|
+
},
|
|
2733
|
+
majorButton: {
|
|
2734
|
+
// G.B.1、G.B.2、G.B.3、G.B.4
|
|
2735
|
+
// 主要button
|
|
2736
|
+
cornerRadius: 24,
|
|
2737
|
+
backgroundColor: '#00c1b6',
|
|
2738
|
+
backgroundOpacity: 1,
|
|
2739
|
+
borderColor: '#000000',
|
|
2740
|
+
borderOpacity: 1,
|
|
2741
|
+
borderWidth: 0,
|
|
2742
|
+
textColor: '#ffffff',
|
|
2743
|
+
textWeight: 'medium',
|
|
2744
|
+
fontSize: 16,
|
|
2745
|
+
disabledBackgroundColor: '#E0E0E0',
|
|
2746
|
+
disabledBorderColor: '#E0E0E0',
|
|
2747
|
+
disabledTextColor: '#FFFFFF'
|
|
2748
|
+
},
|
|
2749
|
+
minorButton: {
|
|
2750
|
+
// G.B.5、G.B.6、G.B.7、G.B.8
|
|
2751
|
+
// 次要button
|
|
2752
|
+
cornerRadius: 24,
|
|
2753
|
+
backgroundColor: '#ffffff',
|
|
2754
|
+
backgroundOpacity: 1,
|
|
2755
|
+
borderColor: '#00c1b6',
|
|
2756
|
+
borderOpacity: 1,
|
|
2757
|
+
borderWidth: 1,
|
|
2758
|
+
textColor: '#00c1b6',
|
|
2759
|
+
textWeight: 'medium',
|
|
2760
|
+
fontSize: 16,
|
|
2761
|
+
disabledBackgroundColor: '#FFFFFF',
|
|
2762
|
+
disabledBorderColor: '#BDBDBD',
|
|
2763
|
+
disabledTextColor: '#BDBDBD'
|
|
2764
|
+
},
|
|
2765
|
+
smallermMajorButton: {
|
|
2766
|
+
// 主要button(小)
|
|
2767
|
+
// 用於dialog/alert的按鈕
|
|
2768
|
+
cornerRadius: 15,
|
|
2769
|
+
backgroundColor: '#00c1b6',
|
|
2770
|
+
backgroundOpacity: 1,
|
|
2771
|
+
borderColor: '#000000',
|
|
2772
|
+
borderOpacity: 1,
|
|
2773
|
+
borderWidth: 0,
|
|
2774
|
+
textColor: '#ffffff',
|
|
2775
|
+
textWeight: 'medium',
|
|
2776
|
+
fontSize: 14,
|
|
2777
|
+
disabledBackgroundColor: '#E0E0E0',
|
|
2778
|
+
disabledBorderColor: '#E0E0E0',
|
|
2779
|
+
disabledTextColor: '#FFFFFF' //預設值: #FFFFFF
|
|
2780
|
+
},
|
|
2781
|
+
|
|
2782
|
+
// 次要button(小)
|
|
2783
|
+
smallerMinorButton: {
|
|
2784
|
+
cornerRadius: 15,
|
|
2785
|
+
backgroundColor: '#ffffff',
|
|
2786
|
+
backgroundOpacity: 1,
|
|
2787
|
+
borderColor: '#00c1b6',
|
|
2788
|
+
borderOpacity: 1,
|
|
2789
|
+
borderWidth: 1,
|
|
2790
|
+
textColor: '#00c1b6',
|
|
2791
|
+
textWeight: 'medium',
|
|
2792
|
+
fontSize: 14,
|
|
2793
|
+
disabledBackgroundColor: '#FFFFFF',
|
|
2794
|
+
disabledBorderColor: '#BDBDBD',
|
|
2795
|
+
disabledTextColor: '#BDBDBD' //預設值: #BDBDBD
|
|
2796
|
+
},
|
|
2797
|
+
|
|
2798
|
+
hint: {
|
|
2799
|
+
// G.HT.2
|
|
2800
|
+
// Hint 提示框(OCR、防偽、活體下面的提示的訊息)
|
|
2801
|
+
cornerRadius: 8,
|
|
2802
|
+
backgroundColor: '#000000',
|
|
2803
|
+
opacity: 0.4,
|
|
2804
|
+
textColor: '#ffffff',
|
|
2805
|
+
textWeight: 'regular',
|
|
2806
|
+
fontSize: 14
|
|
2807
|
+
},
|
|
2808
|
+
fraudIntroStepTitle: {
|
|
2809
|
+
// G.L.1、G.L.2
|
|
2810
|
+
// Fraud引導頁Step title(step1, step2 那塊)
|
|
2811
|
+
cornerRadius: 15,
|
|
2812
|
+
backgroundColor: '#25608A',
|
|
2813
|
+
backgroundOpacity: 1,
|
|
2814
|
+
textColor: '#ffffff',
|
|
2815
|
+
textWeight: 'medium',
|
|
2816
|
+
fontSize: 14
|
|
2817
|
+
},
|
|
2818
|
+
uploadCompleteView: {
|
|
2819
|
+
// G.S.1、G.S.2
|
|
2820
|
+
// 上傳完成的勾勾圖
|
|
2821
|
+
contentColor: '#ffffff',
|
|
2822
|
+
contentOpacity: 1,
|
|
2823
|
+
backgroundColor: '#00c1b6',
|
|
2824
|
+
backgroundOpacity: 1
|
|
2825
|
+
},
|
|
2826
|
+
uploadIncompleteView: {
|
|
2827
|
+
// G.S.3、G.S.4
|
|
2828
|
+
// 上傳失敗的X圖
|
|
2829
|
+
contentColor: '#ffffff',
|
|
2830
|
+
contentOpacity: 1,
|
|
2831
|
+
backgroundColor: '#FF3B30',
|
|
2832
|
+
backgroundOpacity: 1
|
|
2833
|
+
},
|
|
2834
|
+
loadingViewContentColor: '#00c1b6',
|
|
2835
|
+
scanFrame: {
|
|
2836
|
+
// G.SC.1、G.SC.2
|
|
2837
|
+
// 框線圖相關(外框)
|
|
2838
|
+
isEnabled: true,
|
|
2839
|
+
style: 'cornered',
|
|
2840
|
+
width: 2,
|
|
2841
|
+
opacity: 1,
|
|
2842
|
+
undetectedColor: '#ffffff',
|
|
2843
|
+
detectedColor: '#7CFFF9'
|
|
2844
|
+
},
|
|
2845
|
+
scanLine: {
|
|
2846
|
+
// 框線圖相關(掃描線)
|
|
2847
|
+
isEnabled: true,
|
|
2848
|
+
color: '#00c1b6'
|
|
2849
|
+
},
|
|
2850
|
+
scanHint: {
|
|
2851
|
+
// G.SC.4
|
|
2852
|
+
// 框線圖相關(掃描線)
|
|
2853
|
+
isEnabled: true,
|
|
2854
|
+
style: 'image',
|
|
2855
|
+
color: '#ffffff',
|
|
2856
|
+
opacity: 0.7,
|
|
2857
|
+
textWeight: 'medium',
|
|
2858
|
+
fontSize: 60
|
|
2859
|
+
},
|
|
2860
|
+
fraudScanHint: {
|
|
2861
|
+
// D.F.SC.1
|
|
2862
|
+
// 防偽框線圖相關參數(圖)
|
|
2863
|
+
isEnabled: true,
|
|
2864
|
+
style: 'animation',
|
|
2865
|
+
color: '#000000',
|
|
2866
|
+
opacity: 0.7
|
|
2867
|
+
},
|
|
2868
|
+
popupView: {
|
|
2869
|
+
// popup
|
|
2870
|
+
width: 0.75,
|
|
2871
|
+
cornerRadius: 12,
|
|
2872
|
+
backgroundColor: '#ffffff'
|
|
2873
|
+
},
|
|
2874
|
+
livenessErrorScanFrame: {
|
|
2875
|
+
// G.LIVE.2
|
|
2876
|
+
// 活體偵測錯誤
|
|
2877
|
+
color: '#FF3B30',
|
|
2878
|
+
opacity: 1,
|
|
2879
|
+
borderWidth: 6
|
|
2880
|
+
},
|
|
2881
|
+
livenessSuccessScanFrame: {
|
|
2882
|
+
// G.LIVE.1
|
|
2883
|
+
// 活體偵測成功
|
|
2884
|
+
color: '#00C1B6',
|
|
2885
|
+
opacity: 1,
|
|
2886
|
+
borderWidth: 6
|
|
2887
|
+
},
|
|
2888
|
+
isFraudScanIntroPageEnabled: true,
|
|
2889
|
+
pageDotColor: '#00C1B6',
|
|
2890
|
+
titleOne: {
|
|
2891
|
+
// G.T.1
|
|
2892
|
+
// figma 上的 title 1
|
|
2893
|
+
// OCR 確認頁的"確認xx正面、反面"、nfc 護照的"掃描護照晶片(Android 要調整 nfc sdk,比較麻煩)"[後面做]
|
|
2894
|
+
// 、"厚度檢測"、人臉辨識導引頁的"即將進行人臉拍攝"
|
|
2895
|
+
textColor: '#212121',
|
|
2896
|
+
textWeight: 'medium',
|
|
2897
|
+
fontSize: 20
|
|
2898
|
+
},
|
|
2899
|
+
titleTwo: {
|
|
2900
|
+
// G.T.2
|
|
2901
|
+
// Figma標示title 2
|
|
2902
|
+
// loading 圖的"上傳中"、"上傳失敗"、"上傳完成,等待審核中"、
|
|
2903
|
+
// timeout或其他錯誤 alert 的內容"請聯繫客服以協助處理此問題"
|
|
2904
|
+
textColor: '#212121',
|
|
2905
|
+
textWeight: 'medium',
|
|
2906
|
+
fontSize: 18
|
|
2907
|
+
},
|
|
2908
|
+
titleThree: {
|
|
2909
|
+
// G.T.3
|
|
2910
|
+
// Figma標示title 3
|
|
2911
|
+
// 活體的標題"將人臉放入邊框中"、nfc 護照的"尋找生物特徵的圖示(Android 要調整 nfc sdk,比較麻煩)"
|
|
2912
|
+
// 結果頁的"請在xx:xx內完成確認"
|
|
2913
|
+
textColor: '#212121',
|
|
2914
|
+
textWeight: 'medium',
|
|
2915
|
+
fontSize: 16
|
|
2916
|
+
},
|
|
2917
|
+
bodyOne: {
|
|
2918
|
+
// G.T.4
|
|
2919
|
+
// figma 上的 body 1
|
|
2920
|
+
// "完成流程"、"請檢查網路連線狀況並重新嘗試"、"請根據下方教學步驟依序完成NFC操作"、"請將卡面傾斜45度角放入畫面框線進行拍攝"
|
|
2921
|
+
// "將臉部置於方框中,依照畫面指示進行操作"
|
|
2922
|
+
textColor: '#212121',
|
|
2923
|
+
textWeight: 'regular',
|
|
2924
|
+
fontSize: 16
|
|
2925
|
+
},
|
|
2926
|
+
bodyTwo: {
|
|
2927
|
+
// G.T.5
|
|
2928
|
+
// Figma標示body 2或body2
|
|
2929
|
+
textColor: '#212121',
|
|
2930
|
+
textWeight: 'regular',
|
|
2931
|
+
fontSize: 14
|
|
2932
|
+
},
|
|
2933
|
+
bodyThree: {
|
|
2934
|
+
// G.T.6
|
|
2935
|
+
// Figma標示body 3或body3
|
|
2936
|
+
textColor: '#212121',
|
|
2937
|
+
textWeight: 'regular',
|
|
2938
|
+
fontSize: 12
|
|
2939
|
+
},
|
|
2940
|
+
titleOneDarkMode: {
|
|
2941
|
+
// G.T.D.1
|
|
2942
|
+
// Figma標示dark_title 1
|
|
2943
|
+
textColor: '#ffffff',
|
|
2944
|
+
textWeight: 'medium',
|
|
2945
|
+
fontSize: 20
|
|
2946
|
+
},
|
|
2947
|
+
titleTwoDarkMode: {
|
|
2948
|
+
// G.T.D.2
|
|
2949
|
+
// Figma標示dark_title 2
|
|
2950
|
+
textColor: '#ffffff',
|
|
2951
|
+
textWeight: 'medium',
|
|
2952
|
+
fontSize: 18
|
|
2953
|
+
},
|
|
2954
|
+
bodyTwoDarkMode: {
|
|
2955
|
+
textColor: '#ffffff',
|
|
2956
|
+
textWeight: 'regular',
|
|
2957
|
+
fontSize: 14
|
|
2958
|
+
},
|
|
2959
|
+
bodyThreeDarkMode: {
|
|
2960
|
+
// G.T.D.4
|
|
2961
|
+
// Figma標示dark_body 3
|
|
2962
|
+
textColor: '#E0E0E0',
|
|
2963
|
+
textWeight: 'regular',
|
|
2964
|
+
fontSize: 12
|
|
2965
|
+
}
|
|
2966
|
+
};
|
|
2967
|
+
|
|
2520
2968
|
var name = "authme/sdk";
|
|
2521
|
-
var version$1 = "2.8.
|
|
2522
|
-
var date = "2025-
|
|
2969
|
+
var version$1 = "2.8.2";
|
|
2970
|
+
var date = "2025-02-26T06:47:43+0000";
|
|
2523
2971
|
var packageInfo = {
|
|
2524
2972
|
name: name,
|
|
2525
2973
|
version: version$1,
|
|
@@ -2550,6 +2998,7 @@ exports.dataURItoBlob = dataURItoBlob;
|
|
|
2550
2998
|
exports.debugLog = debugLog;
|
|
2551
2999
|
exports.debugTools = debugTools;
|
|
2552
3000
|
exports.decodeToken = decodeToken;
|
|
3001
|
+
exports.fontWeight = fontWeight;
|
|
2553
3002
|
exports.getCanvasSize = getCanvasSize;
|
|
2554
3003
|
exports.getCssVariable = getCssVariable;
|
|
2555
3004
|
exports.getDeviceInfo = getDeviceInfo;
|
|
@@ -2576,6 +3025,11 @@ exports.startSpinner = startSpinner;
|
|
|
2576
3025
|
exports.stopLoadingSDK = stopLoadingSDK;
|
|
2577
3026
|
exports.stopSpinner = stopSpinner;
|
|
2578
3027
|
exports.switchCamera = switchCamera;
|
|
3028
|
+
exports.themeConfigDefault = themeConfigDefault;
|
|
3029
|
+
exports.uiThemeButton = uiThemeButton;
|
|
3030
|
+
exports.uiThemeHint = uiThemeHint;
|
|
3031
|
+
exports.uiThemeText = uiThemeText;
|
|
3032
|
+
exports.uploadModal = uploadModal;
|
|
2579
3033
|
exports.useState = useState;
|
|
2580
3034
|
exports.verificationErrorMessages = verificationErrorMessages;
|
|
2581
3035
|
exports.version = version;
|
package/index.js
CHANGED
|
@@ -21,9 +21,9 @@ import 'core-js/modules/es.array.includes.js';
|
|
|
21
21
|
import 'core-js/modules/es.string.includes.js';
|
|
22
22
|
import { saveAs } from 'file-saver';
|
|
23
23
|
import JSZip from 'jszip';
|
|
24
|
+
import 'core-js/modules/es.parse-int.js';
|
|
24
25
|
import Lottie from 'lottie-web';
|
|
25
26
|
import 'core-js/modules/es.array.sort.js';
|
|
26
|
-
import 'core-js/modules/es.parse-int.js';
|
|
27
27
|
import 'core-js/modules/es.string.trim.js';
|
|
28
28
|
import 'core-js/modules/es.string.starts-with.js';
|
|
29
29
|
import 'core-js/modules/es.symbol.description.js';
|
|
@@ -985,9 +985,65 @@ function cropByRatio(width, height, ratio) {
|
|
|
985
985
|
};
|
|
986
986
|
}
|
|
987
987
|
|
|
988
|
-
|
|
988
|
+
const fontWeight = {
|
|
989
|
+
regular: '400',
|
|
990
|
+
medium: '500',
|
|
991
|
+
bold: '700'
|
|
992
|
+
};
|
|
993
|
+
const hexToRgba = (hex, alpha = 1) => {
|
|
994
|
+
// 移除 # 符號(如果有的話)
|
|
995
|
+
hex = hex.replace(/^#/, '');
|
|
996
|
+
// 解析短格式 (e.g., #RGB -> #RRGGBB)
|
|
997
|
+
if (hex.length === 3) {
|
|
998
|
+
hex = hex.split('').map(x => x + x).join('');
|
|
999
|
+
}
|
|
1000
|
+
// 確保是有效的 HEX 格式
|
|
1001
|
+
if (hex.length !== 6) {
|
|
1002
|
+
throw new Error('Invalid HEX color.');
|
|
1003
|
+
}
|
|
1004
|
+
// 轉換 HEX 到 RGB
|
|
1005
|
+
const r = parseInt(hex.substring(0, 2), 16);
|
|
1006
|
+
const g = parseInt(hex.substring(2, 4), 16);
|
|
1007
|
+
const b = parseInt(hex.substring(4, 6), 16);
|
|
1008
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
1009
|
+
};
|
|
1010
|
+
const uiThemeText = (dom, textStyle) => {
|
|
1011
|
+
dom.style.color = textStyle.textColor;
|
|
1012
|
+
dom.style.fontWeight = fontWeight[textStyle.textWeight];
|
|
1013
|
+
dom.style.fontSize = `${textStyle.fontSize}px`;
|
|
1014
|
+
};
|
|
1015
|
+
const uiThemeHint = (dom, hintStyle) => {
|
|
1016
|
+
dom.style.borderRadius = `${hintStyle.cornerRadius}px`;
|
|
1017
|
+
dom.style.backgroundColor = hintStyle.backgroundColor;
|
|
1018
|
+
dom.style.opacity = hintStyle.opacity;
|
|
1019
|
+
dom.style.color = hintStyle.textColor;
|
|
1020
|
+
dom.style.fontWeight = fontWeight[hintStyle.textWeight];
|
|
1021
|
+
dom.style.fontSize = `${hintStyle.fontSize}px`;
|
|
1022
|
+
};
|
|
1023
|
+
const uiThemeButton = (dom, buttonStyle) => {
|
|
1024
|
+
dom.style.borderRadius = `${buttonStyle.cornerRadius}px`;
|
|
1025
|
+
dom.style.backgroundColor = buttonStyle.backgroundColor;
|
|
1026
|
+
dom.style.opacity = buttonStyle.backgroundOpacity;
|
|
1027
|
+
dom.style.color = buttonStyle.textColor;
|
|
1028
|
+
dom.style.borderColor = hexToRgba(buttonStyle.borderColor, buttonStyle.borderOpacity);
|
|
1029
|
+
dom.style.borderWidth = `${buttonStyle.borderWidth}px`;
|
|
1030
|
+
dom.style.fontWeight = fontWeight[buttonStyle.textWeight];
|
|
1031
|
+
dom.style.fontSize = `${buttonStyle.fontSize}px`;
|
|
1032
|
+
dom.style.borderStyle = 'solid';
|
|
1033
|
+
dom.style.height = `${buttonStyle.cornerRadius * 2}px`;
|
|
1034
|
+
dom.style.width = `calc(100% - ${buttonStyle.cornerRadius * 2}px)`;
|
|
1035
|
+
dom.style.maxWidth = `327px`;
|
|
1036
|
+
};
|
|
1037
|
+
|
|
1038
|
+
function startSpinner(args) {
|
|
989
1039
|
const loadingLottie = Storage.getItem(STORAGE_KEY.LOADING_LOTTIE);
|
|
1040
|
+
const themeConfig = Storage.getItem('themeConfig');
|
|
990
1041
|
const body = document.querySelector('.authme-container');
|
|
1042
|
+
//Statement
|
|
1043
|
+
const statementContainer = document.createElement('div');
|
|
1044
|
+
statementContainer.classList.add('statement');
|
|
1045
|
+
uiThemeText(statementContainer, themeConfig.bodyThreeDarkMode);
|
|
1046
|
+
statementContainer.textContent = args.statement || '';
|
|
991
1047
|
if (loadingLottie) {
|
|
992
1048
|
const loadingSDKOuter = document.createElement('div');
|
|
993
1049
|
const loadingSDKContent = document.createElement('div');
|
|
@@ -1004,12 +1060,18 @@ function startSpinner(text, backgroundOpaque) {
|
|
|
1004
1060
|
animationData: loadingLottie
|
|
1005
1061
|
});
|
|
1006
1062
|
body === null || body === void 0 ? void 0 : body.appendChild(loadingSDKOuter);
|
|
1007
|
-
if (text) {
|
|
1063
|
+
if (args.text) {
|
|
1008
1064
|
loadingSDKText.classList.add('authme-loading-sdk-text');
|
|
1009
|
-
loadingSDKText.textContent = text;
|
|
1065
|
+
loadingSDKText.textContent = args.text;
|
|
1066
|
+
loadingSDKText.style.color = themeConfig.titleTwo.textColor;
|
|
1067
|
+
loadingSDKText.style.fontWeight = themeConfig.titleTwo.textWeight;
|
|
1068
|
+
loadingSDKText.style.fontSize = `${themeConfig.titleTwo.fontSize}px`;
|
|
1010
1069
|
loadingSDKContent.appendChild(loadingSDKText);
|
|
1011
1070
|
}
|
|
1012
|
-
if (backgroundOpaque) {
|
|
1071
|
+
if (args.backgroundOpaque) {
|
|
1072
|
+
loadingSDKOuter.classList.add('loading-outer--opaque');
|
|
1073
|
+
}
|
|
1074
|
+
if (args.backgroundOpaque) {
|
|
1013
1075
|
loadingSDKOuter.classList.add('authme-loading-sdk-outer--opaque');
|
|
1014
1076
|
}
|
|
1015
1077
|
return;
|
|
@@ -1020,14 +1082,21 @@ function startSpinner(text, backgroundOpaque) {
|
|
|
1020
1082
|
spinnerOuter.appendChild(spinner);
|
|
1021
1083
|
spinnerOuter.className = 'loading-outer';
|
|
1022
1084
|
spinner.className = 'loading';
|
|
1023
|
-
|
|
1085
|
+
spinner.style.borderRightColor = themeConfig.loadingViewContentColor;
|
|
1086
|
+
spinner.style.borderBottomColor = themeConfig.loadingViewContentColor;
|
|
1087
|
+
spinner.style.borderLeftColor = themeConfig.loadingViewContentColor;
|
|
1088
|
+
if (args.text) {
|
|
1024
1089
|
spinnerText.className = 'loading-text';
|
|
1025
|
-
spinnerText.textContent = text;
|
|
1090
|
+
spinnerText.textContent = args.text;
|
|
1091
|
+
uiThemeText(spinnerText, themeConfig.titleTwo);
|
|
1026
1092
|
spinnerOuter.appendChild(spinnerText);
|
|
1027
1093
|
}
|
|
1028
|
-
if (backgroundOpaque) {
|
|
1094
|
+
if (args.backgroundOpaque) {
|
|
1029
1095
|
spinnerOuter.classList.add('loading-outer--opaque');
|
|
1030
1096
|
}
|
|
1097
|
+
if (themeConfig.isStatementEnabled) {
|
|
1098
|
+
spinnerOuter.appendChild(statementContainer);
|
|
1099
|
+
}
|
|
1031
1100
|
body === null || body === void 0 ? void 0 : body.appendChild(spinnerOuter);
|
|
1032
1101
|
}
|
|
1033
1102
|
function stopSpinner() {
|
|
@@ -2480,6 +2549,106 @@ function RGBToLottieColor(color) {
|
|
|
2480
2549
|
return color.map(c => c / 255);
|
|
2481
2550
|
}
|
|
2482
2551
|
|
|
2552
|
+
const uploadModal = arg => {
|
|
2553
|
+
const authmeContainer = document.querySelector('.authme-container');
|
|
2554
|
+
if (!authmeContainer) {
|
|
2555
|
+
console.error('uploadModal: authmeContainer not found');
|
|
2556
|
+
return;
|
|
2557
|
+
}
|
|
2558
|
+
const uiThemeConfig = Storage.getItem('themeConfig');
|
|
2559
|
+
function removeModal() {
|
|
2560
|
+
var _a;
|
|
2561
|
+
(_a = document.querySelector('.video-container__upload')) === null || _a === void 0 ? void 0 : _a.remove();
|
|
2562
|
+
}
|
|
2563
|
+
const domModal = document.createElement('div');
|
|
2564
|
+
const domIcon = document.createElement('div');
|
|
2565
|
+
const domTitle = document.createElement('div');
|
|
2566
|
+
const domMessage = document.createElement('div');
|
|
2567
|
+
const domStatement = document.createElement('div');
|
|
2568
|
+
const domFooterContainer = document.createElement('div');
|
|
2569
|
+
const domClose = document.createElement('div');
|
|
2570
|
+
const domRetry = document.createElement('div');
|
|
2571
|
+
domModal.classList.add('video-container__upload');
|
|
2572
|
+
domIcon.classList.add('video-container__upload-icon');
|
|
2573
|
+
domTitle.classList.add('video-container__upload-title');
|
|
2574
|
+
domMessage.classList.add('video-container__upload-message');
|
|
2575
|
+
domStatement.classList.add('video-container__upload-statement');
|
|
2576
|
+
domFooterContainer.classList.add('video-container__upload-footer-container');
|
|
2577
|
+
domClose.classList.add('video-container__upload-close');
|
|
2578
|
+
domRetry.classList.add('video-container__upload-retry');
|
|
2579
|
+
uiThemeText(domTitle, uiThemeConfig.titleTwo);
|
|
2580
|
+
uiThemeText(domMessage, uiThemeConfig.bodyOne);
|
|
2581
|
+
if (arg.type === 'success') {
|
|
2582
|
+
domIcon.innerHTML = `<svg width="49" height="48" viewBox="0 0 49 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2583
|
+
<rect x="0.5" width="48" height="48" rx="24" fill="${uiThemeConfig.uploadCompleteView.backgroundColor}" fill-opacity="${uiThemeConfig.uploadCompleteView.backgroundOpacity}" />
|
|
2584
|
+
<g clip-path="url(#clip0_21855_2149)">
|
|
2585
|
+
<path d="M16.25 25.5L21.5 30.75L33.5 18.75" stroke="${uiThemeConfig.uploadCompleteView.contentColor}" stroke-opacity="${uiThemeConfig.uploadCompleteView.contentOpacity}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2586
|
+
</g>
|
|
2587
|
+
<defs>
|
|
2588
|
+
<clipPath id="clip0_21855_2149">
|
|
2589
|
+
<rect width="24" height="24" fill="white" transform="translate(12.5 12)"/>
|
|
2590
|
+
</clipPath>
|
|
2591
|
+
</defs>
|
|
2592
|
+
</svg>`;
|
|
2593
|
+
}
|
|
2594
|
+
if (arg.type === 'error') {
|
|
2595
|
+
domIcon.innerHTML = `<svg width="49" height="48" viewBox="0 0 49 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2596
|
+
<rect x="0.5" width="48" height="48" rx="24" fill="${uiThemeConfig.uploadIncompleteView.backgroundColor}" fill-opacity="${uiThemeConfig.uploadIncompleteView.backgroundOpacity}"/>
|
|
2597
|
+
<g clip-path="url(#clip0_21855_2690)">
|
|
2598
|
+
<path d="M31.25 17.25L17.75 30.75" stroke="${uiThemeConfig.uploadIncompleteView.contentColor}" stroke-opacity="${uiThemeConfig.uploadIncompleteView.contentOpacity}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2599
|
+
<path d="M31.25 30.75L17.75 17.25" stroke="${uiThemeConfig.uploadIncompleteView.contentColor}" stroke-opacity="${uiThemeConfig.uploadIncompleteView.contentOpacity}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
2600
|
+
</g>
|
|
2601
|
+
<defs>
|
|
2602
|
+
<clipPath id="clip0_21855_2690">
|
|
2603
|
+
<rect width="24" height="24" fill="white" transform="translate(12.5 12)"/>
|
|
2604
|
+
</clipPath>
|
|
2605
|
+
</defs>
|
|
2606
|
+
</svg>
|
|
2607
|
+
`;
|
|
2608
|
+
}
|
|
2609
|
+
if (arg.type === 'success') {
|
|
2610
|
+
domTitle.innerText = arg.titleSuccess || '';
|
|
2611
|
+
domMessage.innerText = arg.messageSuccess || '';
|
|
2612
|
+
}
|
|
2613
|
+
if (arg.type === 'error') {
|
|
2614
|
+
domTitle.innerText = arg.titleError || '';
|
|
2615
|
+
domMessage.innerText = arg.messageError || '';
|
|
2616
|
+
}
|
|
2617
|
+
domModal.appendChild(domIcon);
|
|
2618
|
+
domModal.appendChild(domTitle);
|
|
2619
|
+
domModal.appendChild(domMessage);
|
|
2620
|
+
if (uiThemeConfig.isStatementEnabled && arg.statement && arg.type === 'success') {
|
|
2621
|
+
uiThemeText(domStatement, uiThemeConfig.bodyThree);
|
|
2622
|
+
domStatement.innerText = arg.statement;
|
|
2623
|
+
domModal.appendChild(domStatement);
|
|
2624
|
+
}
|
|
2625
|
+
if (arg.type === 'error' && arg.retryText && arg.closeText) {
|
|
2626
|
+
uiThemeButton(domRetry, uiThemeConfig.majorButton);
|
|
2627
|
+
domRetry.innerText = arg.retryText;
|
|
2628
|
+
domRetry.addEventListener('click', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
2629
|
+
if (arg.onRetry) {
|
|
2630
|
+
yield arg.onRetry();
|
|
2631
|
+
}
|
|
2632
|
+
removeModal();
|
|
2633
|
+
}));
|
|
2634
|
+
uiThemeButton(domClose, uiThemeConfig.minorButton);
|
|
2635
|
+
domClose.innerText = arg.closeText;
|
|
2636
|
+
domClose.addEventListener('click', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
2637
|
+
if (arg.onClose) {
|
|
2638
|
+
yield arg.onClose();
|
|
2639
|
+
}
|
|
2640
|
+
removeModal();
|
|
2641
|
+
}));
|
|
2642
|
+
domFooterContainer.appendChild(domRetry);
|
|
2643
|
+
domFooterContainer.appendChild(domClose);
|
|
2644
|
+
domModal.appendChild(domFooterContainer);
|
|
2645
|
+
}
|
|
2646
|
+
authmeContainer.appendChild(domModal);
|
|
2647
|
+
return {
|
|
2648
|
+
removeModal
|
|
2649
|
+
};
|
|
2650
|
+
};
|
|
2651
|
+
|
|
2483
2652
|
const QUEUE_LENGTH = 10;
|
|
2484
2653
|
const requstQueue = [];
|
|
2485
2654
|
function pushRequest(request) {
|
|
@@ -2507,9 +2676,288 @@ window.ononline = () => {
|
|
|
2507
2676
|
});
|
|
2508
2677
|
};
|
|
2509
2678
|
|
|
2679
|
+
const themeConfigDefault = {
|
|
2680
|
+
isFraudAnimationLoadingPageEnabled: true,
|
|
2681
|
+
isStatementEnabled: true,
|
|
2682
|
+
isLivenessIntroPageEnabled: true,
|
|
2683
|
+
resultPageCountdown: {
|
|
2684
|
+
// 結果頁倒數的參數們
|
|
2685
|
+
// 結果頁是否顯示倒數
|
|
2686
|
+
isEnabled: true,
|
|
2687
|
+
// 倒數敘述文字
|
|
2688
|
+
textColor: '#212121',
|
|
2689
|
+
textWeight: 'regular',
|
|
2690
|
+
fontSize: 14,
|
|
2691
|
+
// 倒數時間
|
|
2692
|
+
timeTextColor: '#FF3B30',
|
|
2693
|
+
timeTextWeight: 'regular',
|
|
2694
|
+
timeFontSize: 14
|
|
2695
|
+
},
|
|
2696
|
+
headerTitle: {
|
|
2697
|
+
// G.H.2
|
|
2698
|
+
// Header(畫面上方標題,如前導頁)的參數們
|
|
2699
|
+
textColor: '#212121',
|
|
2700
|
+
textWeight: 'medium',
|
|
2701
|
+
fontSize: 18
|
|
2702
|
+
},
|
|
2703
|
+
nonEkycCloseButton: {
|
|
2704
|
+
// G.A.3
|
|
2705
|
+
// 非ekyc流程中的X
|
|
2706
|
+
contentColor: '#424242',
|
|
2707
|
+
contentOpacity: 1
|
|
2708
|
+
},
|
|
2709
|
+
backButton: {
|
|
2710
|
+
// iOS only
|
|
2711
|
+
// ekyc流程中的返回
|
|
2712
|
+
contentColor: '#424242',
|
|
2713
|
+
contentOpacity: 1
|
|
2714
|
+
},
|
|
2715
|
+
ekycCloseButton: {
|
|
2716
|
+
// G.A.1、G.A.2
|
|
2717
|
+
// ekyc流程中的X
|
|
2718
|
+
contentColor: '#ffffff',
|
|
2719
|
+
contentOpacity: 1,
|
|
2720
|
+
backgroundColor: '#000000',
|
|
2721
|
+
backgroundOpacity: 0.2
|
|
2722
|
+
},
|
|
2723
|
+
majorButton: {
|
|
2724
|
+
// G.B.1、G.B.2、G.B.3、G.B.4
|
|
2725
|
+
// 主要button
|
|
2726
|
+
cornerRadius: 24,
|
|
2727
|
+
backgroundColor: '#00c1b6',
|
|
2728
|
+
backgroundOpacity: 1,
|
|
2729
|
+
borderColor: '#000000',
|
|
2730
|
+
borderOpacity: 1,
|
|
2731
|
+
borderWidth: 0,
|
|
2732
|
+
textColor: '#ffffff',
|
|
2733
|
+
textWeight: 'medium',
|
|
2734
|
+
fontSize: 16,
|
|
2735
|
+
disabledBackgroundColor: '#E0E0E0',
|
|
2736
|
+
disabledBorderColor: '#E0E0E0',
|
|
2737
|
+
disabledTextColor: '#FFFFFF'
|
|
2738
|
+
},
|
|
2739
|
+
minorButton: {
|
|
2740
|
+
// G.B.5、G.B.6、G.B.7、G.B.8
|
|
2741
|
+
// 次要button
|
|
2742
|
+
cornerRadius: 24,
|
|
2743
|
+
backgroundColor: '#ffffff',
|
|
2744
|
+
backgroundOpacity: 1,
|
|
2745
|
+
borderColor: '#00c1b6',
|
|
2746
|
+
borderOpacity: 1,
|
|
2747
|
+
borderWidth: 1,
|
|
2748
|
+
textColor: '#00c1b6',
|
|
2749
|
+
textWeight: 'medium',
|
|
2750
|
+
fontSize: 16,
|
|
2751
|
+
disabledBackgroundColor: '#FFFFFF',
|
|
2752
|
+
disabledBorderColor: '#BDBDBD',
|
|
2753
|
+
disabledTextColor: '#BDBDBD'
|
|
2754
|
+
},
|
|
2755
|
+
smallermMajorButton: {
|
|
2756
|
+
// 主要button(小)
|
|
2757
|
+
// 用於dialog/alert的按鈕
|
|
2758
|
+
cornerRadius: 15,
|
|
2759
|
+
backgroundColor: '#00c1b6',
|
|
2760
|
+
backgroundOpacity: 1,
|
|
2761
|
+
borderColor: '#000000',
|
|
2762
|
+
borderOpacity: 1,
|
|
2763
|
+
borderWidth: 0,
|
|
2764
|
+
textColor: '#ffffff',
|
|
2765
|
+
textWeight: 'medium',
|
|
2766
|
+
fontSize: 14,
|
|
2767
|
+
disabledBackgroundColor: '#E0E0E0',
|
|
2768
|
+
disabledBorderColor: '#E0E0E0',
|
|
2769
|
+
disabledTextColor: '#FFFFFF' //預設值: #FFFFFF
|
|
2770
|
+
},
|
|
2771
|
+
|
|
2772
|
+
// 次要button(小)
|
|
2773
|
+
smallerMinorButton: {
|
|
2774
|
+
cornerRadius: 15,
|
|
2775
|
+
backgroundColor: '#ffffff',
|
|
2776
|
+
backgroundOpacity: 1,
|
|
2777
|
+
borderColor: '#00c1b6',
|
|
2778
|
+
borderOpacity: 1,
|
|
2779
|
+
borderWidth: 1,
|
|
2780
|
+
textColor: '#00c1b6',
|
|
2781
|
+
textWeight: 'medium',
|
|
2782
|
+
fontSize: 14,
|
|
2783
|
+
disabledBackgroundColor: '#FFFFFF',
|
|
2784
|
+
disabledBorderColor: '#BDBDBD',
|
|
2785
|
+
disabledTextColor: '#BDBDBD' //預設值: #BDBDBD
|
|
2786
|
+
},
|
|
2787
|
+
|
|
2788
|
+
hint: {
|
|
2789
|
+
// G.HT.2
|
|
2790
|
+
// Hint 提示框(OCR、防偽、活體下面的提示的訊息)
|
|
2791
|
+
cornerRadius: 8,
|
|
2792
|
+
backgroundColor: '#000000',
|
|
2793
|
+
opacity: 0.4,
|
|
2794
|
+
textColor: '#ffffff',
|
|
2795
|
+
textWeight: 'regular',
|
|
2796
|
+
fontSize: 14
|
|
2797
|
+
},
|
|
2798
|
+
fraudIntroStepTitle: {
|
|
2799
|
+
// G.L.1、G.L.2
|
|
2800
|
+
// Fraud引導頁Step title(step1, step2 那塊)
|
|
2801
|
+
cornerRadius: 15,
|
|
2802
|
+
backgroundColor: '#25608A',
|
|
2803
|
+
backgroundOpacity: 1,
|
|
2804
|
+
textColor: '#ffffff',
|
|
2805
|
+
textWeight: 'medium',
|
|
2806
|
+
fontSize: 14
|
|
2807
|
+
},
|
|
2808
|
+
uploadCompleteView: {
|
|
2809
|
+
// G.S.1、G.S.2
|
|
2810
|
+
// 上傳完成的勾勾圖
|
|
2811
|
+
contentColor: '#ffffff',
|
|
2812
|
+
contentOpacity: 1,
|
|
2813
|
+
backgroundColor: '#00c1b6',
|
|
2814
|
+
backgroundOpacity: 1
|
|
2815
|
+
},
|
|
2816
|
+
uploadIncompleteView: {
|
|
2817
|
+
// G.S.3、G.S.4
|
|
2818
|
+
// 上傳失敗的X圖
|
|
2819
|
+
contentColor: '#ffffff',
|
|
2820
|
+
contentOpacity: 1,
|
|
2821
|
+
backgroundColor: '#FF3B30',
|
|
2822
|
+
backgroundOpacity: 1
|
|
2823
|
+
},
|
|
2824
|
+
loadingViewContentColor: '#00c1b6',
|
|
2825
|
+
scanFrame: {
|
|
2826
|
+
// G.SC.1、G.SC.2
|
|
2827
|
+
// 框線圖相關(外框)
|
|
2828
|
+
isEnabled: true,
|
|
2829
|
+
style: 'cornered',
|
|
2830
|
+
width: 2,
|
|
2831
|
+
opacity: 1,
|
|
2832
|
+
undetectedColor: '#ffffff',
|
|
2833
|
+
detectedColor: '#7CFFF9'
|
|
2834
|
+
},
|
|
2835
|
+
scanLine: {
|
|
2836
|
+
// 框線圖相關(掃描線)
|
|
2837
|
+
isEnabled: true,
|
|
2838
|
+
color: '#00c1b6'
|
|
2839
|
+
},
|
|
2840
|
+
scanHint: {
|
|
2841
|
+
// G.SC.4
|
|
2842
|
+
// 框線圖相關(掃描線)
|
|
2843
|
+
isEnabled: true,
|
|
2844
|
+
style: 'image',
|
|
2845
|
+
color: '#ffffff',
|
|
2846
|
+
opacity: 0.7,
|
|
2847
|
+
textWeight: 'medium',
|
|
2848
|
+
fontSize: 60
|
|
2849
|
+
},
|
|
2850
|
+
fraudScanHint: {
|
|
2851
|
+
// D.F.SC.1
|
|
2852
|
+
// 防偽框線圖相關參數(圖)
|
|
2853
|
+
isEnabled: true,
|
|
2854
|
+
style: 'animation',
|
|
2855
|
+
color: '#000000',
|
|
2856
|
+
opacity: 0.7
|
|
2857
|
+
},
|
|
2858
|
+
popupView: {
|
|
2859
|
+
// popup
|
|
2860
|
+
width: 0.75,
|
|
2861
|
+
cornerRadius: 12,
|
|
2862
|
+
backgroundColor: '#ffffff'
|
|
2863
|
+
},
|
|
2864
|
+
livenessErrorScanFrame: {
|
|
2865
|
+
// G.LIVE.2
|
|
2866
|
+
// 活體偵測錯誤
|
|
2867
|
+
color: '#FF3B30',
|
|
2868
|
+
opacity: 1,
|
|
2869
|
+
borderWidth: 6
|
|
2870
|
+
},
|
|
2871
|
+
livenessSuccessScanFrame: {
|
|
2872
|
+
// G.LIVE.1
|
|
2873
|
+
// 活體偵測成功
|
|
2874
|
+
color: '#00C1B6',
|
|
2875
|
+
opacity: 1,
|
|
2876
|
+
borderWidth: 6
|
|
2877
|
+
},
|
|
2878
|
+
isFraudScanIntroPageEnabled: true,
|
|
2879
|
+
pageDotColor: '#00C1B6',
|
|
2880
|
+
titleOne: {
|
|
2881
|
+
// G.T.1
|
|
2882
|
+
// figma 上的 title 1
|
|
2883
|
+
// OCR 確認頁的"確認xx正面、反面"、nfc 護照的"掃描護照晶片(Android 要調整 nfc sdk,比較麻煩)"[後面做]
|
|
2884
|
+
// 、"厚度檢測"、人臉辨識導引頁的"即將進行人臉拍攝"
|
|
2885
|
+
textColor: '#212121',
|
|
2886
|
+
textWeight: 'medium',
|
|
2887
|
+
fontSize: 20
|
|
2888
|
+
},
|
|
2889
|
+
titleTwo: {
|
|
2890
|
+
// G.T.2
|
|
2891
|
+
// Figma標示title 2
|
|
2892
|
+
// loading 圖的"上傳中"、"上傳失敗"、"上傳完成,等待審核中"、
|
|
2893
|
+
// timeout或其他錯誤 alert 的內容"請聯繫客服以協助處理此問題"
|
|
2894
|
+
textColor: '#212121',
|
|
2895
|
+
textWeight: 'medium',
|
|
2896
|
+
fontSize: 18
|
|
2897
|
+
},
|
|
2898
|
+
titleThree: {
|
|
2899
|
+
// G.T.3
|
|
2900
|
+
// Figma標示title 3
|
|
2901
|
+
// 活體的標題"將人臉放入邊框中"、nfc 護照的"尋找生物特徵的圖示(Android 要調整 nfc sdk,比較麻煩)"
|
|
2902
|
+
// 結果頁的"請在xx:xx內完成確認"
|
|
2903
|
+
textColor: '#212121',
|
|
2904
|
+
textWeight: 'medium',
|
|
2905
|
+
fontSize: 16
|
|
2906
|
+
},
|
|
2907
|
+
bodyOne: {
|
|
2908
|
+
// G.T.4
|
|
2909
|
+
// figma 上的 body 1
|
|
2910
|
+
// "完成流程"、"請檢查網路連線狀況並重新嘗試"、"請根據下方教學步驟依序完成NFC操作"、"請將卡面傾斜45度角放入畫面框線進行拍攝"
|
|
2911
|
+
// "將臉部置於方框中,依照畫面指示進行操作"
|
|
2912
|
+
textColor: '#212121',
|
|
2913
|
+
textWeight: 'regular',
|
|
2914
|
+
fontSize: 16
|
|
2915
|
+
},
|
|
2916
|
+
bodyTwo: {
|
|
2917
|
+
// G.T.5
|
|
2918
|
+
// Figma標示body 2或body2
|
|
2919
|
+
textColor: '#212121',
|
|
2920
|
+
textWeight: 'regular',
|
|
2921
|
+
fontSize: 14
|
|
2922
|
+
},
|
|
2923
|
+
bodyThree: {
|
|
2924
|
+
// G.T.6
|
|
2925
|
+
// Figma標示body 3或body3
|
|
2926
|
+
textColor: '#212121',
|
|
2927
|
+
textWeight: 'regular',
|
|
2928
|
+
fontSize: 12
|
|
2929
|
+
},
|
|
2930
|
+
titleOneDarkMode: {
|
|
2931
|
+
// G.T.D.1
|
|
2932
|
+
// Figma標示dark_title 1
|
|
2933
|
+
textColor: '#ffffff',
|
|
2934
|
+
textWeight: 'medium',
|
|
2935
|
+
fontSize: 20
|
|
2936
|
+
},
|
|
2937
|
+
titleTwoDarkMode: {
|
|
2938
|
+
// G.T.D.2
|
|
2939
|
+
// Figma標示dark_title 2
|
|
2940
|
+
textColor: '#ffffff',
|
|
2941
|
+
textWeight: 'medium',
|
|
2942
|
+
fontSize: 18
|
|
2943
|
+
},
|
|
2944
|
+
bodyTwoDarkMode: {
|
|
2945
|
+
textColor: '#ffffff',
|
|
2946
|
+
textWeight: 'regular',
|
|
2947
|
+
fontSize: 14
|
|
2948
|
+
},
|
|
2949
|
+
bodyThreeDarkMode: {
|
|
2950
|
+
// G.T.D.4
|
|
2951
|
+
// Figma標示dark_body 3
|
|
2952
|
+
textColor: '#E0E0E0',
|
|
2953
|
+
textWeight: 'regular',
|
|
2954
|
+
fontSize: 12
|
|
2955
|
+
}
|
|
2956
|
+
};
|
|
2957
|
+
|
|
2510
2958
|
var name = "authme/sdk";
|
|
2511
|
-
var version$1 = "2.8.
|
|
2512
|
-
var date = "2025-
|
|
2959
|
+
var version$1 = "2.8.2";
|
|
2960
|
+
var date = "2025-02-26T06:47:43+0000";
|
|
2513
2961
|
var packageInfo = {
|
|
2514
2962
|
name: name,
|
|
2515
2963
|
version: version$1,
|
|
@@ -2522,4 +2970,4 @@ const version = packageInfo.version;
|
|
|
2522
2970
|
(_a = (_b = window)[_c = Symbol.for('authme-sdk')]) !== null && _a !== void 0 ? _a : _b[_c] = {};
|
|
2523
2971
|
window[Symbol.for('authme-sdk')][packageInfo.name] = version;
|
|
2524
2972
|
|
|
2525
|
-
export { AuthmeError, ErrorCode, Icon, RGBToLottieColor, RUN_FUNCTION_NAME, STORAGE_KEY, Storage, TIME_UNIT, UintArrayToBlob, asyncOnLineShowErrorMessage, asyncShowErrorMessage, asyncShowPopup, backgroundRequest, checkOnlineStatus, clearCanvas, colorStringToRGB, colorToRGB, combineResult, cropByRatio, dataURItoBlob, debugLog, debugTools, decodeToken, getCanvasSize, getCssVariable, getDeviceInfo, getImageData, getSystemInfo, hexToRGB, hideElement, hideErrorMessage, hidePopup, isIphone14proOrProMax, isMobile, isMobileOrTablet, osVersion, requestCamera, resize, retryPromiseWithCondition, showElement, showErrorMessage, showErrorMessageEventName, showPopup, splitResult, startLoadingSDK, startSpinner, stopLoadingSDK, stopSpinner, switchCamera, useState, verificationErrorMessages, version, videoConstraintsFactory, waitTime };
|
|
2973
|
+
export { AuthmeError, ErrorCode, Icon, RGBToLottieColor, RUN_FUNCTION_NAME, STORAGE_KEY, Storage, TIME_UNIT, UintArrayToBlob, asyncOnLineShowErrorMessage, asyncShowErrorMessage, asyncShowPopup, backgroundRequest, checkOnlineStatus, clearCanvas, colorStringToRGB, colorToRGB, combineResult, cropByRatio, dataURItoBlob, debugLog, debugTools, decodeToken, fontWeight, getCanvasSize, getCssVariable, getDeviceInfo, getImageData, getSystemInfo, hexToRGB, hideElement, hideErrorMessage, hidePopup, isIphone14proOrProMax, isMobile, isMobileOrTablet, osVersion, requestCamera, resize, retryPromiseWithCondition, showElement, showErrorMessage, showErrorMessageEventName, showPopup, splitResult, startLoadingSDK, startSpinner, stopLoadingSDK, stopSpinner, switchCamera, themeConfigDefault, uiThemeButton, uiThemeHint, uiThemeText, uploadModal, useState, verificationErrorMessages, version, videoConstraintsFactory, waitTime };
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const themeConfigDefault: any;
|
package/src/ui/index.d.ts
CHANGED
package/src/ui/spinner.d.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const uploadModal: (arg: {
|
|
2
|
+
type: 'success' | 'error';
|
|
3
|
+
titleSuccess?: string;
|
|
4
|
+
messageSuccess?: string;
|
|
5
|
+
titleError?: string;
|
|
6
|
+
messageError?: string;
|
|
7
|
+
statement?: string;
|
|
8
|
+
retryText?: string;
|
|
9
|
+
closeText?: string;
|
|
10
|
+
onClose?: () => void;
|
|
11
|
+
onRetry?: () => void;
|
|
12
|
+
}) => {
|
|
13
|
+
removeModal: () => void;
|
|
14
|
+
};
|