@authme/identity-verification 2.8.6 → 2.8.8

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 +27 -18
  2. package/index.js +27 -18
  3. package/package.json +6 -6
package/index.cjs CHANGED
@@ -30570,7 +30570,8 @@ const ocrResultModal = arg => {
30570
30570
  function groupInput({
30571
30571
  name,
30572
30572
  label,
30573
- value
30573
+ value,
30574
+ type
30574
30575
  }) {
30575
30576
  const domGroupItem = document.createElement('div');
30576
30577
  domGroupItem.classList.add('video-container__ocrResultModal-group-item');
@@ -30586,6 +30587,9 @@ const ocrResultModal = arg => {
30586
30587
  domInput.type = 'text';
30587
30588
  domInput.value = value;
30588
30589
  domError.innerText = `${label}格式不符`;
30590
+ if (type === 'date') {
30591
+ domInput.placeholder = 'YYYY/MM/DD';
30592
+ }
30589
30593
  domInput.addEventListener('input', () => {
30590
30594
  validateFields() ? btnConfirmStatus(false) : btnConfirmStatus(true);
30591
30595
  // btnConfirmStatus(Object.values(validateMap).some((i: any) => i.validate === false));
@@ -30659,17 +30663,21 @@ const ocrResultModal = arg => {
30659
30663
  return domGroupItem;
30660
30664
  }
30661
30665
  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" 格式
30666
+ // 確保日期格式為 "YYYY-MM-DD",避免瀏覽器解析錯誤
30667
+ const normalizedDateString = dateString.replace(/\//g, '-');
30668
+ // 解析日期字串
30669
+ const date = new Date(normalizedDateString);
30670
+ if (isNaN(date.getTime())) {
30671
+ throw new Error('Invalid date format');
30672
+ }
30673
+ // 取得年月日
30674
+ const year = date.getFullYear().toString(); // 取得年份
30675
+ const month = (date.getMonth() + 1).toString().padStart(2, '0'); // 0 的月份
30676
+ const day = date.getDate().toString().padStart(2, '0'); // 0 的日期
30677
+ // 替換格式
30678
+ return format.replace(/YYYY|yyyy/g, year) // 年份 (YYYY 或 yyyy)
30679
+ .replace(/MM|mm/g, month) // 月份 (MM)
30680
+ .replace(/dd/g, day); // 日期 (dd)
30673
30681
  }
30674
30682
 
30675
30683
  function isValidDateFormat(dateStr) {
@@ -30682,11 +30690,11 @@ const ocrResultModal = arg => {
30682
30690
  const input = item.querySelector('input');
30683
30691
  if (input) {
30684
30692
  const key = item.id;
30685
- const value = input.value;
30686
- let valueOrigin = arg.items.find(i => i.name === key).value;
30693
+ let value = input.value;
30694
+ const valueOrigin = arg.items.find(i => i.name === key).value;
30687
30695
  const dateFormat = arg.items.find(i => i.name === key).dateFormat;
30688
30696
  if (dateFormat) {
30689
- valueOrigin = formatDate(valueOrigin, dateFormat);
30697
+ value = formatDate(value, 'yyyy-mm-dd');
30690
30698
  }
30691
30699
  modifiedDetails[key] = {
30692
30700
  isModified: value !== valueOrigin ? true : false,
@@ -30846,7 +30854,8 @@ const ocrResultModal = arg => {
30846
30854
  const domGroupItem = groupInput({
30847
30855
  name: item.name,
30848
30856
  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
30857
+ value: item.dateFormat ? formatDate(item.value, item.dateFormat) : item.value,
30858
+ type: item.dateFormat ? 'date' : 'text'
30850
30859
  });
30851
30860
  domBody.appendChild(domGroupItem);
30852
30861
  }
@@ -35649,8 +35658,8 @@ class AuthmeIdentityVerification extends engine.AuthmeFunctionModule {
35649
35658
  }
35650
35659
 
35651
35660
  var name = "authme/sdk";
35652
- var version$1 = "2.8.6";
35653
- var date = "2025-03-17T08:17:58+0000";
35661
+ var version$1 = "2.8.8";
35662
+ var date = "2025-03-25T06:52:21+0000";
35654
35663
  var packageInfo = {
35655
35664
  name: name,
35656
35665
  version: version$1,
package/index.js CHANGED
@@ -30562,7 +30562,8 @@ const ocrResultModal = arg => {
30562
30562
  function groupInput({
30563
30563
  name,
30564
30564
  label,
30565
- value
30565
+ value,
30566
+ type
30566
30567
  }) {
30567
30568
  const domGroupItem = document.createElement('div');
30568
30569
  domGroupItem.classList.add('video-container__ocrResultModal-group-item');
@@ -30578,6 +30579,9 @@ const ocrResultModal = arg => {
30578
30579
  domInput.type = 'text';
30579
30580
  domInput.value = value;
30580
30581
  domError.innerText = `${label}格式不符`;
30582
+ if (type === 'date') {
30583
+ domInput.placeholder = 'YYYY/MM/DD';
30584
+ }
30581
30585
  domInput.addEventListener('input', () => {
30582
30586
  validateFields() ? btnConfirmStatus(false) : btnConfirmStatus(true);
30583
30587
  // btnConfirmStatus(Object.values(validateMap).some((i: any) => i.validate === false));
@@ -30651,17 +30655,21 @@ const ocrResultModal = arg => {
30651
30655
  return domGroupItem;
30652
30656
  }
30653
30657
  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" 格式
30658
+ // 確保日期格式為 "YYYY-MM-DD",避免瀏覽器解析錯誤
30659
+ const normalizedDateString = dateString.replace(/\//g, '-');
30660
+ // 解析日期字串
30661
+ const date = new Date(normalizedDateString);
30662
+ if (isNaN(date.getTime())) {
30663
+ throw new Error('Invalid date format');
30664
+ }
30665
+ // 取得年月日
30666
+ const year = date.getFullYear().toString(); // 取得年份
30667
+ const month = (date.getMonth() + 1).toString().padStart(2, '0'); // 0 的月份
30668
+ const day = date.getDate().toString().padStart(2, '0'); // 0 的日期
30669
+ // 替換格式
30670
+ return format.replace(/YYYY|yyyy/g, year) // 年份 (YYYY 或 yyyy)
30671
+ .replace(/MM|mm/g, month) // 月份 (MM)
30672
+ .replace(/dd/g, day); // 日期 (dd)
30665
30673
  }
30666
30674
 
30667
30675
  function isValidDateFormat(dateStr) {
@@ -30674,11 +30682,11 @@ const ocrResultModal = arg => {
30674
30682
  const input = item.querySelector('input');
30675
30683
  if (input) {
30676
30684
  const key = item.id;
30677
- const value = input.value;
30678
- let valueOrigin = arg.items.find(i => i.name === key).value;
30685
+ let value = input.value;
30686
+ const valueOrigin = arg.items.find(i => i.name === key).value;
30679
30687
  const dateFormat = arg.items.find(i => i.name === key).dateFormat;
30680
30688
  if (dateFormat) {
30681
- valueOrigin = formatDate(valueOrigin, dateFormat);
30689
+ value = formatDate(value, 'yyyy-mm-dd');
30682
30690
  }
30683
30691
  modifiedDetails[key] = {
30684
30692
  isModified: value !== valueOrigin ? true : false,
@@ -30838,7 +30846,8 @@ const ocrResultModal = arg => {
30838
30846
  const domGroupItem = groupInput({
30839
30847
  name: item.name,
30840
30848
  label: item.name === 'issueReason' ? translateService.translate('sdk.ocr.verify.result.issueType') : translateService.translate(`sdk.ocr.verify.result.${item.name}`),
30841
- value: item.dateFormat ? formatDate(item.value, item.dateFormat) : item.value
30849
+ value: item.dateFormat ? formatDate(item.value, item.dateFormat) : item.value,
30850
+ type: item.dateFormat ? 'date' : 'text'
30842
30851
  });
30843
30852
  domBody.appendChild(domGroupItem);
30844
30853
  }
@@ -35641,8 +35650,8 @@ class AuthmeIdentityVerification extends AuthmeFunctionModule {
35641
35650
  }
35642
35651
 
35643
35652
  var name = "authme/sdk";
35644
- var version$1 = "2.8.6";
35645
- var date = "2025-03-17T08:17:58+0000";
35653
+ var version$1 = "2.8.8";
35654
+ var date = "2025-03-25T06:52:21+0000";
35646
35655
  var packageInfo = {
35647
35656
  name: name,
35648
35657
  version: version$1,
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@authme/identity-verification",
3
- "version": "2.8.6",
3
+ "version": "2.8.8",
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.6",
9
- "@authme/engine": "2.8.6",
10
- "@authme/id-recognition": "2.8.6",
11
- "@authme/util": "2.8.6",
12
- "@authme/liveness": "2.8.6"
8
+ "@authme/core": "2.8.8",
9
+ "@authme/engine": "2.8.8",
10
+ "@authme/id-recognition": "2.8.8",
11
+ "@authme/util": "2.8.8",
12
+ "@authme/liveness": "2.8.8"
13
13
  },
14
14
  "module": "./index.js",
15
15
  "main": "./index.cjs",