@authme/util 2.8.12 → 2.8.14
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 +18 -5
- package/index.js +18 -5
- package/package.json +4 -4
- package/src/lib/authme-error.d.ts +2 -1
package/index.cjs
CHANGED
|
@@ -126,8 +126,9 @@ function __await(v) {
|
|
|
126
126
|
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
127
127
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
128
128
|
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
129
|
-
return i =
|
|
130
|
-
function
|
|
129
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
130
|
+
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
131
|
+
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
131
132
|
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
132
133
|
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
133
134
|
function fulfill(value) { resume("next", value); }
|
|
@@ -141,7 +142,12 @@ function __asyncValues(o) {
|
|
|
141
142
|
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
142
143
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
143
144
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
144
|
-
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
148
|
+
var e = new Error(message);
|
|
149
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
150
|
+
};
|
|
145
151
|
|
|
146
152
|
class AuthmeError {
|
|
147
153
|
constructor(code, cause = null) {
|
|
@@ -190,6 +196,7 @@ exports.ErrorCode = void 0;
|
|
|
190
196
|
ErrorCode[ErrorCode["CAMERA_NOT_SUPPORT"] = 904] = "CAMERA_NOT_SUPPORT";
|
|
191
197
|
ErrorCode[ErrorCode["SERVER_ERROR"] = 905] = "SERVER_ERROR";
|
|
192
198
|
ErrorCode[ErrorCode["EVENT_NAME_WRONG"] = 906] = "EVENT_NAME_WRONG";
|
|
199
|
+
ErrorCode[ErrorCode["ERROR_USER_CANCEL"] = 907] = "ERROR_USER_CANCEL";
|
|
193
200
|
})(exports.ErrorCode || (exports.ErrorCode = {}));
|
|
194
201
|
const verificationErrorMessages = code => {
|
|
195
202
|
const errorMessage = '';
|
|
@@ -1177,6 +1184,7 @@ function showErrorMessage(text, showRetryBtn, callback, buttonText, _titleText)
|
|
|
1177
1184
|
if (!target) {
|
|
1178
1185
|
return;
|
|
1179
1186
|
}
|
|
1187
|
+
const uiThemeConfig = Storage.getItem('themeConfig');
|
|
1180
1188
|
const errorMessagePanel = document.createElement('div');
|
|
1181
1189
|
errorMessagePanel.className = 'error-message-panel';
|
|
1182
1190
|
const icon = document.createElement('img');
|
|
@@ -1185,12 +1193,14 @@ function showErrorMessage(text, showRetryBtn, callback, buttonText, _titleText)
|
|
|
1185
1193
|
const errorText = document.createElement('div');
|
|
1186
1194
|
errorText.className = 'error-text';
|
|
1187
1195
|
errorText.textContent = text;
|
|
1196
|
+
uiThemeText(errorText, uiThemeConfig.bodyOne);
|
|
1188
1197
|
errorMessagePanel.appendChild(icon);
|
|
1189
1198
|
errorMessagePanel.appendChild(errorText);
|
|
1190
1199
|
if (showRetryBtn) {
|
|
1191
1200
|
const retryText = document.createElement('div');
|
|
1192
1201
|
retryText.className = 'retry-text';
|
|
1193
1202
|
retryText.textContent = buttonText !== null && buttonText !== void 0 ? buttonText : '重試';
|
|
1203
|
+
uiThemeButton(retryText, uiThemeConfig.minorButton);
|
|
1194
1204
|
errorMessagePanel.appendChild(retryText);
|
|
1195
1205
|
if (callback) {
|
|
1196
1206
|
retryText.addEventListener('click', e => {
|
|
@@ -1209,12 +1219,14 @@ function showErrorMessageEventName(text, showRetryBtn, callback, buttonText, tit
|
|
|
1209
1219
|
if (!target) {
|
|
1210
1220
|
return;
|
|
1211
1221
|
}
|
|
1222
|
+
const uiThemeConfig = Storage.getItem('themeConfig');
|
|
1212
1223
|
const errorMessagePanel = document.createElement('div');
|
|
1213
1224
|
errorMessagePanel.classList.add('error-message-panel');
|
|
1214
1225
|
errorMessagePanel.classList.add('event-name');
|
|
1215
1226
|
const errorText = document.createElement('div');
|
|
1216
1227
|
errorText.className = 'error-text';
|
|
1217
1228
|
errorText.textContent = text;
|
|
1229
|
+
uiThemeText(errorText, uiThemeConfig.bodyOne);
|
|
1218
1230
|
const title = document.createElement('div');
|
|
1219
1231
|
title.className = 'error-title';
|
|
1220
1232
|
title.textContent = titleText !== null && titleText !== void 0 ? titleText : 'error';
|
|
@@ -1224,6 +1236,7 @@ function showErrorMessageEventName(text, showRetryBtn, callback, buttonText, tit
|
|
|
1224
1236
|
const retryText = document.createElement('div');
|
|
1225
1237
|
retryText.className = 'retry-text';
|
|
1226
1238
|
retryText.textContent = buttonText !== null && buttonText !== void 0 ? buttonText : '重試';
|
|
1239
|
+
uiThemeButton(retryText, uiThemeConfig.majorButton);
|
|
1227
1240
|
errorMessagePanel.appendChild(retryText);
|
|
1228
1241
|
if (callback) {
|
|
1229
1242
|
retryText.addEventListener('click', e => {
|
|
@@ -3128,8 +3141,8 @@ const themeConfigDefault = {
|
|
|
3128
3141
|
};
|
|
3129
3142
|
|
|
3130
3143
|
var name = "authme/sdk";
|
|
3131
|
-
var version$1 = "2.8.
|
|
3132
|
-
var date = "2025-
|
|
3144
|
+
var version$1 = "2.8.14";
|
|
3145
|
+
var date = "2025-05-09T02:19:43+0000";
|
|
3133
3146
|
var packageInfo = {
|
|
3134
3147
|
name: name,
|
|
3135
3148
|
version: version$1,
|
package/index.js
CHANGED
|
@@ -116,8 +116,9 @@ function __await(v) {
|
|
|
116
116
|
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
117
117
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
118
118
|
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
119
|
-
return i =
|
|
120
|
-
function
|
|
119
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
120
|
+
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
121
|
+
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
121
122
|
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
122
123
|
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
123
124
|
function fulfill(value) { resume("next", value); }
|
|
@@ -131,7 +132,12 @@ function __asyncValues(o) {
|
|
|
131
132
|
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
132
133
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
133
134
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
134
|
-
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
138
|
+
var e = new Error(message);
|
|
139
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
140
|
+
};
|
|
135
141
|
|
|
136
142
|
class AuthmeError {
|
|
137
143
|
constructor(code, cause = null) {
|
|
@@ -180,6 +186,7 @@ var ErrorCode;
|
|
|
180
186
|
ErrorCode[ErrorCode["CAMERA_NOT_SUPPORT"] = 904] = "CAMERA_NOT_SUPPORT";
|
|
181
187
|
ErrorCode[ErrorCode["SERVER_ERROR"] = 905] = "SERVER_ERROR";
|
|
182
188
|
ErrorCode[ErrorCode["EVENT_NAME_WRONG"] = 906] = "EVENT_NAME_WRONG";
|
|
189
|
+
ErrorCode[ErrorCode["ERROR_USER_CANCEL"] = 907] = "ERROR_USER_CANCEL";
|
|
183
190
|
})(ErrorCode || (ErrorCode = {}));
|
|
184
191
|
const verificationErrorMessages = code => {
|
|
185
192
|
const errorMessage = '';
|
|
@@ -1167,6 +1174,7 @@ function showErrorMessage(text, showRetryBtn, callback, buttonText, _titleText)
|
|
|
1167
1174
|
if (!target) {
|
|
1168
1175
|
return;
|
|
1169
1176
|
}
|
|
1177
|
+
const uiThemeConfig = Storage.getItem('themeConfig');
|
|
1170
1178
|
const errorMessagePanel = document.createElement('div');
|
|
1171
1179
|
errorMessagePanel.className = 'error-message-panel';
|
|
1172
1180
|
const icon = document.createElement('img');
|
|
@@ -1175,12 +1183,14 @@ function showErrorMessage(text, showRetryBtn, callback, buttonText, _titleText)
|
|
|
1175
1183
|
const errorText = document.createElement('div');
|
|
1176
1184
|
errorText.className = 'error-text';
|
|
1177
1185
|
errorText.textContent = text;
|
|
1186
|
+
uiThemeText(errorText, uiThemeConfig.bodyOne);
|
|
1178
1187
|
errorMessagePanel.appendChild(icon);
|
|
1179
1188
|
errorMessagePanel.appendChild(errorText);
|
|
1180
1189
|
if (showRetryBtn) {
|
|
1181
1190
|
const retryText = document.createElement('div');
|
|
1182
1191
|
retryText.className = 'retry-text';
|
|
1183
1192
|
retryText.textContent = buttonText !== null && buttonText !== void 0 ? buttonText : '重試';
|
|
1193
|
+
uiThemeButton(retryText, uiThemeConfig.minorButton);
|
|
1184
1194
|
errorMessagePanel.appendChild(retryText);
|
|
1185
1195
|
if (callback) {
|
|
1186
1196
|
retryText.addEventListener('click', e => {
|
|
@@ -1199,12 +1209,14 @@ function showErrorMessageEventName(text, showRetryBtn, callback, buttonText, tit
|
|
|
1199
1209
|
if (!target) {
|
|
1200
1210
|
return;
|
|
1201
1211
|
}
|
|
1212
|
+
const uiThemeConfig = Storage.getItem('themeConfig');
|
|
1202
1213
|
const errorMessagePanel = document.createElement('div');
|
|
1203
1214
|
errorMessagePanel.classList.add('error-message-panel');
|
|
1204
1215
|
errorMessagePanel.classList.add('event-name');
|
|
1205
1216
|
const errorText = document.createElement('div');
|
|
1206
1217
|
errorText.className = 'error-text';
|
|
1207
1218
|
errorText.textContent = text;
|
|
1219
|
+
uiThemeText(errorText, uiThemeConfig.bodyOne);
|
|
1208
1220
|
const title = document.createElement('div');
|
|
1209
1221
|
title.className = 'error-title';
|
|
1210
1222
|
title.textContent = titleText !== null && titleText !== void 0 ? titleText : 'error';
|
|
@@ -1214,6 +1226,7 @@ function showErrorMessageEventName(text, showRetryBtn, callback, buttonText, tit
|
|
|
1214
1226
|
const retryText = document.createElement('div');
|
|
1215
1227
|
retryText.className = 'retry-text';
|
|
1216
1228
|
retryText.textContent = buttonText !== null && buttonText !== void 0 ? buttonText : '重試';
|
|
1229
|
+
uiThemeButton(retryText, uiThemeConfig.majorButton);
|
|
1217
1230
|
errorMessagePanel.appendChild(retryText);
|
|
1218
1231
|
if (callback) {
|
|
1219
1232
|
retryText.addEventListener('click', e => {
|
|
@@ -3118,8 +3131,8 @@ const themeConfigDefault = {
|
|
|
3118
3131
|
};
|
|
3119
3132
|
|
|
3120
3133
|
var name = "authme/sdk";
|
|
3121
|
-
var version$1 = "2.8.
|
|
3122
|
-
var date = "2025-
|
|
3134
|
+
var version$1 = "2.8.14";
|
|
3135
|
+
var date = "2025-05-09T02:19:43+0000";
|
|
3123
3136
|
var packageInfo = {
|
|
3124
3137
|
name: name,
|
|
3125
3138
|
version: version$1,
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authme/util",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.14",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"core-js": "^3.6.0",
|
|
6
|
-
"jwt-decode": "3.1.2",
|
|
7
|
-
"rxjs": "7.5.7",
|
|
8
6
|
"file-saver": "2.0.5",
|
|
9
7
|
"jszip": "3.10.1",
|
|
10
|
-
"
|
|
8
|
+
"jwt-decode": "3.1.2",
|
|
9
|
+
"lottie-web": "5.12.2",
|
|
10
|
+
"rxjs": "7.8.2"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@types/file-saver": "^2.0.5"
|
|
@@ -27,6 +27,7 @@ export declare enum ErrorCode {
|
|
|
27
27
|
USER_CANCEL = 903,
|
|
28
28
|
CAMERA_NOT_SUPPORT = 904,
|
|
29
29
|
SERVER_ERROR = 905,
|
|
30
|
-
EVENT_NAME_WRONG = 906
|
|
30
|
+
EVENT_NAME_WRONG = 906,
|
|
31
|
+
ERROR_USER_CANCEL = 907
|
|
31
32
|
}
|
|
32
33
|
export declare const verificationErrorMessages: (code: any) => "活體檢測信心度過低:系統審核活體檢測信心度小於身分驗證條件(KYC Option)配置的通過門檻,請用戶重新進行活體檢測。" | "人證比對信心度過低:系統審核人證比對信心度小於身分驗證條件(KYC Option)配置的通過門檻,請用戶重新上傳證件及重新進行活體檢測。" | "證件防偽辨識失敗:比對由前端防偽引擎提供的防偽數據發現異常,請用戶重新上傳證件。" | "證件資訊驗證失敗:透過台灣內政部領補換證件 API 驗證失敗,請用戶重新上傳最新證件。" | "證件資訊驗證次數已達上限:透過台灣內政部領補換證件 API 驗證時超過存取次數上限,請用戶隔日再重新上傳最新證件。" | "證件掛失中:透過台灣內政部領補換證件 API 驗證時發現該證件掛失中,請用戶辦理新證件或取消掛失狀態。" | "身分證號碼已停止使用:透過台灣內政部領補換證件 API 驗證時發現該身分證號碼已停用,請用戶重新上傳可用證件。" | "身分證號碼已暫停使用者權限:透過台灣內政部領補換證件 API 驗證時發現該身分證號碼已暫停使用者權限,請用戶重新上傳可用證件或洽詢相關單位。" | "未通過同證件比對:用戶在驗證證件正反面的過程中更換了證件,請用戶使用相同證件重新操作。" | "證件資料不完整:用戶上傳證件的 OCR 文字辨識結果缺少必要欄位,請用戶重新上傳證件。" | "未通過單證件欄位比對" | "活體檢測失敗:未能取得前端活體辨識引擎提供的活體檢測信心度,請用戶重新進行活體檢測。" | "人臉比對失敗:未能取得後端人臉特徵比對引擎提供的人證比對信心度,請用戶重新上傳證件及重新進行活體檢測。" | "人臉比對來源的圖像無法辨識出人臉特徵" | "找不到人臉比對目標之身分驗證條件" | "找不到人臉比對目標之已審核活體事件" | "人臉比對目標的圖像無法辨識出人臉特徵" | "強制待審核:身分驗證條件(KYC Option)要求證件上傳需要人工審核。" | "證件內容異動:使用者在確認證件 OCR 文件辨識結果時有修改欄位值。" | "證件比對發生錯誤:身分驗證條件(KYC Option)啟用了證件防偽辨識,比對防偽證件與 OCR 證件是否為相同證件時發現不相符。" | "證件資訊驗證發生錯誤:身分驗證條件(KYC Option)啟用了證件資訊驗證,但是在嘗試透過台灣內政部領補換證件 API 驗證證件資訊時發生錯誤。" | "防偽辨識發生錯誤:身分驗證條件(KYC Option)啟用了證件防偽辨識,但是在驗證證件防偽資訊時發生錯誤。" | "相片完整性比對發生錯誤:比對證件照片的色彩解析度及是否為支援的證件類型時發現不符合完整性要求。" | "數位影像真實性比對發生錯誤:比對證件照片發現有被數位修改跡或沒有人臉特徵。" | "證件相片 OCR 文字辨識發生錯誤:無法透過 OCR 引擎辨識證件相片中的文字欄位或辨識階段發生錯誤。" | "未通過單證件欄位比對:身分驗證條件(KYC Option)啟用了單證件欄位比對,在比對證件正面身分證號與背面條碼時發現不相符。" | "";
|