@authme/identity-verification 2.8.5 → 2.8.7

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.
Files changed (3) hide show
  1. package/index.cjs +21 -17
  2. package/index.js +21 -17
  3. package/package.json +6 -6
package/index.cjs CHANGED
@@ -28849,7 +28849,7 @@ const renderOCRUI = config => {
28849
28849
  confirmBtn.textContent = translateService.translate('sdk.general.preparing');
28850
28850
  confirmBtn.disabled = true;
28851
28851
  btnContainer.appendChild(confirmBtn);
28852
- util.uiThemeButton(confirmBtn, uiThemeConfig.majorButton);
28852
+ util.uiThemeButton(confirmBtn, uiThemeConfig.fraudInfoButton);
28853
28853
  antiFraudInstructionContainer.appendChild(instructionText);
28854
28854
  antiFraudInstructionContainer.appendChild(antiFraudInstructionAnimationContainer);
28855
28855
  antiFraudInstructionContainer.appendChild(btnContainer);
@@ -30659,17 +30659,21 @@ const ocrResultModal = arg => {
30659
30659
  return domGroupItem;
30660
30660
  }
30661
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" 格式
30662
+ // 確保日期格式為 "YYYY-MM-DD",避免瀏覽器解析錯誤
30663
+ const normalizedDateString = dateString.replace(/\//g, '-');
30664
+ // 解析日期字串
30665
+ const date = new Date(normalizedDateString);
30666
+ if (isNaN(date.getTime())) {
30667
+ throw new Error('Invalid date format');
30668
+ }
30669
+ // 取得年月日
30670
+ const year = date.getFullYear().toString(); // 取得年份
30671
+ const month = (date.getMonth() + 1).toString().padStart(2, '0'); // 0 的月份
30672
+ const day = date.getDate().toString().padStart(2, '0'); // 0 的日期
30673
+ // 替換格式
30674
+ return format.replace(/YYYY|yyyy/g, year) // 年份 (YYYY 或 yyyy)
30675
+ .replace(/MM|mm/g, month) // 月份 (MM)
30676
+ .replace(/dd/g, day); // 日期 (dd)
30673
30677
  }
30674
30678
 
30675
30679
  function isValidDateFormat(dateStr) {
@@ -30682,11 +30686,11 @@ const ocrResultModal = arg => {
30682
30686
  const input = item.querySelector('input');
30683
30687
  if (input) {
30684
30688
  const key = item.id;
30685
- const value = input.value;
30686
- let valueOrigin = arg.items.find(i => i.name === key).value;
30689
+ let value = input.value;
30690
+ const valueOrigin = arg.items.find(i => i.name === key).value;
30687
30691
  const dateFormat = arg.items.find(i => i.name === key).dateFormat;
30688
30692
  if (dateFormat) {
30689
- valueOrigin = formatDate(valueOrigin, dateFormat);
30693
+ value = formatDate(value, 'yyyy-mm-dd');
30690
30694
  }
30691
30695
  modifiedDetails[key] = {
30692
30696
  isModified: value !== valueOrigin ? true : false,
@@ -35649,8 +35653,8 @@ class AuthmeIdentityVerification extends engine.AuthmeFunctionModule {
35649
35653
  }
35650
35654
 
35651
35655
  var name = "authme/sdk";
35652
- var version$1 = "2.8.5";
35653
- var date = "2025-03-17T05:56:00+0000";
35656
+ var version$1 = "2.8.7";
35657
+ var date = "2025-03-21T02:01:27+0000";
35654
35658
  var packageInfo = {
35655
35659
  name: name,
35656
35660
  version: version$1,
package/index.js CHANGED
@@ -28841,7 +28841,7 @@ const renderOCRUI = config => {
28841
28841
  confirmBtn.textContent = translateService.translate('sdk.general.preparing');
28842
28842
  confirmBtn.disabled = true;
28843
28843
  btnContainer.appendChild(confirmBtn);
28844
- uiThemeButton(confirmBtn, uiThemeConfig.majorButton);
28844
+ uiThemeButton(confirmBtn, uiThemeConfig.fraudInfoButton);
28845
28845
  antiFraudInstructionContainer.appendChild(instructionText);
28846
28846
  antiFraudInstructionContainer.appendChild(antiFraudInstructionAnimationContainer);
28847
28847
  antiFraudInstructionContainer.appendChild(btnContainer);
@@ -30651,17 +30651,21 @@ const ocrResultModal = arg => {
30651
30651
  return domGroupItem;
30652
30652
  }
30653
30653
  function formatDate(dateString, format) {
30654
- // 解析日期字串為 Date 物件
30655
- const date = new Date(dateString);
30656
- const year = date.getFullYear(); // 取得年份
30657
- const month = (date.getMonth() + 1).toString().padStart(2, '0'); // 取得月份並補齊兩位
30658
- const day = date.getDate().toString().padStart(2, '0'); // 取得日期並補齊兩位
30659
- // 根據傳入的 format 來替換字串
30660
- return format.replace('YYYY', year.toString()) // 替換 "YYYY" 為年份
30661
- .replace('yyyy', year.toString()) // 替換 "yyyy" 為年份
30662
- .replace('MM', month) // 替換 "MM" 為月份
30663
- .replace('dd', day) // 替換 "dd" 為日期
30664
- .replace('yyyy', year.toString()); // 處理 "yyyy" 格式
30654
+ // 確保日期格式為 "YYYY-MM-DD",避免瀏覽器解析錯誤
30655
+ const normalizedDateString = dateString.replace(/\//g, '-');
30656
+ // 解析日期字串
30657
+ const date = new Date(normalizedDateString);
30658
+ if (isNaN(date.getTime())) {
30659
+ throw new Error('Invalid date format');
30660
+ }
30661
+ // 取得年月日
30662
+ const year = date.getFullYear().toString(); // 取得年份
30663
+ const month = (date.getMonth() + 1).toString().padStart(2, '0'); // 0 的月份
30664
+ const day = date.getDate().toString().padStart(2, '0'); // 0 的日期
30665
+ // 替換格式
30666
+ return format.replace(/YYYY|yyyy/g, year) // 年份 (YYYY 或 yyyy)
30667
+ .replace(/MM|mm/g, month) // 月份 (MM)
30668
+ .replace(/dd/g, day); // 日期 (dd)
30665
30669
  }
30666
30670
 
30667
30671
  function isValidDateFormat(dateStr) {
@@ -30674,11 +30678,11 @@ const ocrResultModal = arg => {
30674
30678
  const input = item.querySelector('input');
30675
30679
  if (input) {
30676
30680
  const key = item.id;
30677
- const value = input.value;
30678
- let valueOrigin = arg.items.find(i => i.name === key).value;
30681
+ let value = input.value;
30682
+ const valueOrigin = arg.items.find(i => i.name === key).value;
30679
30683
  const dateFormat = arg.items.find(i => i.name === key).dateFormat;
30680
30684
  if (dateFormat) {
30681
- valueOrigin = formatDate(valueOrigin, dateFormat);
30685
+ value = formatDate(value, 'yyyy-mm-dd');
30682
30686
  }
30683
30687
  modifiedDetails[key] = {
30684
30688
  isModified: value !== valueOrigin ? true : false,
@@ -35641,8 +35645,8 @@ class AuthmeIdentityVerification extends AuthmeFunctionModule {
35641
35645
  }
35642
35646
 
35643
35647
  var name = "authme/sdk";
35644
- var version$1 = "2.8.5";
35645
- var date = "2025-03-17T05:56:00+0000";
35648
+ var version$1 = "2.8.7";
35649
+ var date = "2025-03-21T02:01:27+0000";
35646
35650
  var packageInfo = {
35647
35651
  name: name,
35648
35652
  version: version$1,
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@authme/identity-verification",
3
- "version": "2.8.5",
3
+ "version": "2.8.7",
4
4
  "peerDependencies": {
5
5
  "core-js": "^3.6.0",
6
6
  "lottie-web": "^5.9.2",
7
7
  "rxjs": "^7.4.0",
8
- "@authme/core": "2.8.5",
9
- "@authme/engine": "2.8.5",
10
- "@authme/id-recognition": "2.8.5",
11
- "@authme/util": "2.8.5",
12
- "@authme/liveness": "2.8.5"
8
+ "@authme/core": "2.8.7",
9
+ "@authme/engine": "2.8.7",
10
+ "@authme/id-recognition": "2.8.7",
11
+ "@authme/util": "2.8.7",
12
+ "@authme/liveness": "2.8.7"
13
13
  },
14
14
  "module": "./index.js",
15
15
  "main": "./index.cjs",