@authme/id-recognition 2.8.41 → 2.8.44

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.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./src/index";
@@ -1,15 +1,18 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
3
+ require('core-js/modules/es.error.cause.js');
5
4
  require('core-js/modules/es.object.assign.js');
5
+ require('core-js/modules/esnext.iterator.constructor.js');
6
+ require('core-js/modules/esnext.iterator.map.js');
6
7
  var engine = require('@authme/engine');
7
8
  require('core-js/modules/es.array.iterator.js');
8
9
  require('core-js/modules/es.object.from-entries.js');
9
10
  require('core-js/modules/web.dom-collections.iterator.js');
11
+ require('core-js/modules/es.json.stringify.js');
12
+ require('core-js/modules/es.promise.js');
13
+ require('core-js/modules/esnext.iterator.for-each.js');
10
14
  var core = require('@authme/core');
11
15
  var util = require('@authme/util');
12
- require('core-js/modules/es.symbol.description.js');
13
16
 
14
17
  exports.ResourceImageType = void 0;
15
18
  (function (ResourceImageType) {
@@ -99,8 +102,8 @@ class CardOCR extends engine.AuthmeEngineModuleBase {
99
102
  return this.type;
100
103
  }
101
104
  setParams(params) {
102
- var _a;
103
- if (((_a = params.type) !== null && _a !== void 0 ? _a : this.type) === engine.EAuthMeCardClass.Invalid) throw new Error('Please set type first');
105
+ var _params$type;
106
+ if (((_params$type = params.type) != null ? _params$type : this.type) === engine.EAuthMeCardClass.Invalid) throw new Error('Please set type first');
104
107
  return this.engine.run(this.moduleName, 'setParams', Object.assign({
105
108
  type: this.type
106
109
  }, params));
@@ -115,8 +118,8 @@ class IdCardAntiFraudService extends engine.AuthmeEngineModuleBase {
115
118
  const stageStrList = stageList.map(x => x.split('_')[1]);
116
119
  return this.engine.run(this.moduleName, 'setStage', stageStrList);
117
120
  }
118
- getCardMatchROI() {
119
- return this.engine.run(this.moduleName, 'getCardMatchROI');
121
+ getCardMatchROI(config) {
122
+ return this.engine.run(this.moduleName, 'getCardMatchROI', config);
120
123
  }
121
124
  }
122
125
  class MRZService extends engine.AuthmeEngineModuleBase {
@@ -220,7 +223,7 @@ function getCardTypes(type, country) {
220
223
  return CardTypeMap[type];
221
224
  }
222
225
  function cardTypeTitle(cardType) {
223
- var _a, _b;
226
+ var _cardTypeMap$cardType, _cardTypeMap$cardType2;
224
227
  if (cardType == null) {
225
228
  return '';
226
229
  }
@@ -254,11 +257,11 @@ function cardTypeTitle(cardType) {
254
257
  const typeSections = cardTypeLower.split('_');
255
258
  const cardTypeName = typeSections[1];
256
259
  const cardTypeSection = typeSections[2];
257
- const titleKey = ((_a = cardTypeMap[cardTypeName]) === null || _a === void 0 ? void 0 : _a[cardTypeSection]) || ((_b = cardTypeMap[cardTypeName]) === null || _b === void 0 ? void 0 : _b.default);
260
+ const titleKey = ((_cardTypeMap$cardType = cardTypeMap[cardTypeName]) == null ? void 0 : _cardTypeMap$cardType[cardTypeSection]) || ((_cardTypeMap$cardType2 = cardTypeMap[cardTypeName]) == null ? void 0 : _cardTypeMap$cardType2.default);
258
261
  return titleKey || '';
259
262
  }
260
263
  function cardTypeHeader(cardType) {
261
- var _a, _b;
264
+ var _cardTypeMap$cardType3, _cardTypeMap$cardType4;
262
265
  if (cardType == null) {
263
266
  return '';
264
267
  }
@@ -297,9 +300,9 @@ function cardTypeHeader(cardType) {
297
300
  const cardTypeName = typeSections[1];
298
301
  const cardTypeSection = typeSections[2];
299
302
  if (country === exports.CountryCode.JPN.toLowerCase() && cardTypeName === 'idcard') {
300
- return 'sdk.verify.myNumberCard.header' ;
303
+ return 'sdk.verify.myNumberCard.header';
301
304
  }
302
- const titleKey = ((_a = cardTypeMap[cardTypeName]) === null || _a === void 0 ? void 0 : _a[cardTypeSection]) || ((_b = cardTypeMap[cardTypeName]) === null || _b === void 0 ? void 0 : _b.default);
305
+ const titleKey = ((_cardTypeMap$cardType3 = cardTypeMap[cardTypeName]) == null ? void 0 : _cardTypeMap$cardType3[cardTypeSection]) || ((_cardTypeMap$cardType4 = cardTypeMap[cardTypeName]) == null ? void 0 : _cardTypeMap$cardType4.default);
303
306
  return titleKey || '';
304
307
  }
305
308
  function cardTypeConfirmTitle(cardType) {
@@ -357,11 +360,13 @@ function mapCardtypeToAuthmeClass(type) {
357
360
  }
358
361
  }
359
362
  function getRecognitionColumnOrder(column) {
360
- var _a;
361
- return (_a = RECOGNITION_COLUMNS_ORDER[column]) !== null && _a !== void 0 ? _a : Number.MAX_VALUE;
363
+ var _RECOGNITION_COLUMNS_;
364
+ return (_RECOGNITION_COLUMNS_ = RECOGNITION_COLUMNS_ORDER[column]) != null ? _RECOGNITION_COLUMNS_ : Number.MAX_VALUE;
362
365
  }
363
366
  const twoWayAuthmeCardClassMap = (() => {
364
367
  const map = Object.fromEntries(Object.entries(exports.ServerSideEAuthMeCardClass).map(([key, value]) => [`EAuthMeCardClass_${key}`, value]));
368
+ // Manually add ALL_PASSPORT_CONTENT mapping
369
+ map['EAuthMeCardClass_ALL_PASSPORT_CONTENT'] = exports.ServerSideEAuthMeCardClass.Passport;
365
370
  const inverted = Object.fromEntries(Object.entries(map).map(([key, value]) => [value, key]));
366
371
  return {
367
372
  toServer(clientEnum) {
@@ -373,44 +378,11 @@ const twoWayAuthmeCardClassMap = (() => {
373
378
  };
374
379
  })();
375
380
 
376
- /******************************************************************************
377
- Copyright (c) Microsoft Corporation.
378
-
379
- Permission to use, copy, modify, and/or distribute this software for any
380
- purpose with or without fee is hereby granted.
381
-
382
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
383
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
384
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
385
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
386
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
387
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
388
- PERFORMANCE OF THIS SOFTWARE.
389
- ***************************************************************************** */
390
-
391
- function __awaiter(thisArg, _arguments, P, generator) {
392
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
393
- return new (P || (P = Promise))(function (resolve, reject) {
394
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
395
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
396
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
397
- step((generator = generator.apply(thisArg, _arguments || [])).next());
398
- });
399
- }
400
-
401
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
402
- var e = new Error(message);
403
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
404
- };
405
-
406
381
  var name = "authme/sdk";
407
- var version$1 = "2.8.41";
408
- var date = "2026-01-30T10:27:23+0000";
382
+ var version$1 = "2.8.44";
409
383
  var packageInfo = {
410
384
  name: name,
411
- version: version$1,
412
- date: date
413
- };
385
+ version: version$1};
414
386
 
415
387
  function initScan(type, country, needConfirm, cardTypes) {
416
388
  // let useCardTypes: any = getCardSubTypes(type, country).map((c) =>
@@ -477,8 +449,8 @@ function recognition(documentId, file) {
477
449
  body: formData,
478
450
  contentType: 'multipart/form-data'
479
451
  }).catch(error => {
480
- var _a, _b, _c;
481
- if (error instanceof core.AuthmeError && ((_c = (_b = (_a = error.cause) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.code) === 'AuthMe.IDRecognition:000201') {
452
+ var _error$cause;
453
+ if (error instanceof core.AuthmeError && ((_error$cause = error.cause) == null || (_error$cause = _error$cause.error) == null || (_error$cause = _error$cause.error) == null ? void 0 : _error$cause.code) === 'AuthMe.IDRecognition:000201') {
482
454
  return {
483
455
  retry: true,
484
456
  details: {}
@@ -502,8 +474,8 @@ function recognizeBase64(body) {
502
474
  body: JSON.stringify(body),
503
475
  contentType: 'application/json'
504
476
  }).catch(error => {
505
- var _a, _b, _c;
506
- if (error instanceof core.AuthmeError && ((_c = (_b = (_a = error.cause) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.code) === 'AuthMe.IDRecognition:000201') {
477
+ var _error$cause2;
478
+ if (error instanceof core.AuthmeError && ((_error$cause2 = error.cause) == null || (_error$cause2 = _error$cause2.error) == null || (_error$cause2 = _error$cause2.error) == null ? void 0 : _error$cause2.code) === 'AuthMe.IDRecognition:000201') {
507
479
  return {
508
480
  retry: true,
509
481
  details: {}
@@ -535,8 +507,8 @@ function uploadFrameBase64(body) {
535
507
  body: JSON.stringify(body),
536
508
  contentType: 'application/json'
537
509
  }).catch(error => {
538
- var _a, _b, _c;
539
- if (error instanceof core.AuthmeError && ((_c = (_b = (_a = error.cause) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.code) === 'AuthMe.IDRecognition:000201') {
510
+ var _error$cause3;
511
+ if (error instanceof core.AuthmeError && ((_error$cause3 = error.cause) == null || (_error$cause3 = _error$cause3.error) == null || (_error$cause3 = _error$cause3.error) == null ? void 0 : _error$cause3.code) === 'AuthMe.IDRecognition:000201') {
540
512
  return {
541
513
  retry: true,
542
514
  details: {}
@@ -595,8 +567,8 @@ function saveExtraDoc(params) {
595
567
  const formData = new FormData();
596
568
  formData.append('file', params.file);
597
569
  Object.keys(params.info).forEach(key => {
598
- if (!(params === null || params === void 0 ? void 0 : params.info[key])) return;
599
- formData.append(`info[${key}]`, params === null || params === void 0 ? void 0 : params.info[key]);
570
+ if (!(params != null && params.info[key])) return;
571
+ formData.append(`info[${key}]`, params == null ? void 0 : params.info[key]);
600
572
  });
601
573
  return core.sendRequest('/api/identity-verification/v1/verification/extra-document/file', 'POST', {
602
574
  body: formData,
@@ -616,75 +588,70 @@ function logCollect(message, stackTrace) {
616
588
  body: JSON.stringify(body)
617
589
  });
618
590
  }
619
- function option(deviceType) {
620
- return __awaiter(this, void 0, void 0, function* () {
621
- return core.sendRequest(`/api/identity-verification/v1/option${deviceType ? '?deviceType=' + deviceType : ''}`, 'GET');
622
- });
591
+ async function option(deviceType) {
592
+ return core.sendRequest(`/api/identity-verification/v1/option${deviceType ? '?deviceType=' + deviceType : ''}`, 'GET');
623
593
  }
624
- function themeUI(themeId) {
625
- return __awaiter(this, void 0, void 0, function* () {
626
- // const url = `/api/identity-verification/v1/ui-themes/${themeId}`;
627
- // const accessToken = Storage.getItem('token') as string | null;
628
- // const baseUrl = Storage.getItem('apiBaseUrl') as string | null;
629
- // const normalizedUrl = baseUrl ? new URL(url, baseUrl).toString() : url;
630
- // try {
631
- // const response = await fetch(normalizedUrl, {
632
- // method: 'GET',
633
- // headers: {
634
- // 'Content-Type': 'application/json',
635
- // 'Authorization': `Bearer ${accessToken}`, // 如果需要身份驗證
636
- // 'sdk-info': [
637
- // `sdk-version: ${version}`,
638
- // `platform: ${navigator.platform}`,
639
- // ].join(';') as string
640
- // }
641
- // });
642
- // if (!response.ok) {
643
- // // throw new Error(`HTTP error! Status: ${response.status}`);
644
- // return {};
645
- // }
646
- // const data = await response.json();
647
- // console.log('Response Data:', data);
648
- // return data; // 可以回傳資料讓其他函式使用
649
- // } catch (error) {
650
- // console.error('Fetch Error:', error);
651
- // return {}; // 或拋出錯誤,視需求而定
652
- // }
653
- return core.sendRequest(`/api/identity-verification/v1/ui-themes/${themeId}`, 'GET');
654
- });
594
+ async function themeUI(themeId) {
595
+ // const url = `/api/identity-verification/v1/ui-themes/${themeId}`;
596
+ // const accessToken = Storage.getItem('token') as string | null;
597
+ // const baseUrl = Storage.getItem('apiBaseUrl') as string | null;
598
+ // const normalizedUrl = baseUrl ? new URL(url, baseUrl).toString() : url;
599
+ // try {
600
+ // const response = await fetch(normalizedUrl, {
601
+ // method: 'GET',
602
+ // headers: {
603
+ // 'Content-Type': 'application/json',
604
+ // 'Authorization': `Bearer ${accessToken}`, // 如果需要身份驗證
605
+ // 'sdk-info': [
606
+ // `sdk-version: ${version}`,
607
+ // `platform: ${navigator.platform}`,
608
+ // ].join(';') as string
609
+ // }
610
+ // });
611
+ // if (!response.ok) {
612
+ // // throw new Error(`HTTP error! Status: ${response.status}`);
613
+ // return {};
614
+ // }
615
+ // const data = await response.json();
616
+ // console.log('Response Data:', data);
617
+ // return data; // 可以回傳資料讓其他函式使用
618
+ // } catch (error) {
619
+ // console.error('Fetch Error:', error);
620
+ // return {}; // 或拋出錯誤,視需求而定
621
+ // }
622
+ return core.sendRequest(`/api/identity-verification/v1/ui-themes/${themeId}`, 'GET');
655
623
  }
656
624
 
657
- var _a;
658
- var _b, _c;
625
+ var _window, _Symbol$for, _window$_Symbol$for;
659
626
  const version = packageInfo.version;
660
- (_a = (_b = window)[_c = Symbol.for('authme-sdk')]) !== null && _a !== void 0 ? _a : _b[_c] = {};
627
+ (_window$_Symbol$for = (_window = window)[_Symbol$for = Symbol.for('authme-sdk')]) != null ? _window$_Symbol$for : _window[_Symbol$for] = {};
661
628
  window[Symbol.for('authme-sdk')][packageInfo.name] = version;
662
629
 
663
- Object.defineProperty(exports, 'EAuthMeCardClass', {
630
+ Object.defineProperty(exports, "EAuthMeCardClass", {
664
631
  enumerable: true,
665
632
  get: function () { return engine.EAuthMeCardClass; }
666
633
  });
667
- Object.defineProperty(exports, 'EAuthMeCardMatchStatus', {
634
+ Object.defineProperty(exports, "EAuthMeCardMatchStatus", {
668
635
  enumerable: true,
669
636
  get: function () { return engine.EAuthMeCardMatchStatus; }
670
637
  });
671
- Object.defineProperty(exports, 'EAuthMeCardOCRStatus', {
638
+ Object.defineProperty(exports, "EAuthMeCardOCRStatus", {
672
639
  enumerable: true,
673
640
  get: function () { return engine.EAuthMeCardOCRStatus; }
674
641
  });
675
- Object.defineProperty(exports, 'EAuthMeIDCardAntiFraudStage', {
642
+ Object.defineProperty(exports, "EAuthMeIDCardAntiFraudStage", {
676
643
  enumerable: true,
677
644
  get: function () { return engine.EAuthMeIDCardAntiFraudStage; }
678
645
  });
679
- Object.defineProperty(exports, 'EAuthMeIDCardAntiFraudStatus', {
646
+ Object.defineProperty(exports, "EAuthMeIDCardAntiFraudStatus", {
680
647
  enumerable: true,
681
648
  get: function () { return engine.EAuthMeIDCardAntiFraudStatus; }
682
649
  });
683
- Object.defineProperty(exports, 'EAuthMeMRZRecogStatus', {
650
+ Object.defineProperty(exports, "EAuthMeMRZRecogStatus", {
684
651
  enumerable: true,
685
652
  get: function () { return engine.EAuthMeMRZRecogStatus; }
686
653
  });
687
- Object.defineProperty(exports, 'EAuthMeMRZServiceStatus', {
654
+ Object.defineProperty(exports, "EAuthMeMRZServiceStatus", {
688
655
  enumerable: true,
689
656
  get: function () { return engine.EAuthMeMRZServiceStatus; }
690
657
  });
package/index.esm.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./src/index";
@@ -1,12 +1,17 @@
1
+ import 'core-js/modules/es.error.cause.js';
1
2
  import 'core-js/modules/es.object.assign.js';
3
+ import 'core-js/modules/esnext.iterator.constructor.js';
4
+ import 'core-js/modules/esnext.iterator.map.js';
2
5
  import { AuthmeEngineModuleBase, EAuthMeCardClass, EngineModule } from '@authme/engine';
3
6
  export { EAuthMeCardClass, EAuthMeCardMatchStatus, EAuthMeCardOCRStatus, EAuthMeIDCardAntiFraudStage, EAuthMeIDCardAntiFraudStatus, EAuthMeMRZRecogStatus, EAuthMeMRZServiceStatus } from '@authme/engine';
4
7
  import 'core-js/modules/es.array.iterator.js';
5
8
  import 'core-js/modules/es.object.from-entries.js';
6
9
  import 'core-js/modules/web.dom-collections.iterator.js';
10
+ import 'core-js/modules/es.json.stringify.js';
11
+ import 'core-js/modules/es.promise.js';
12
+ import 'core-js/modules/esnext.iterator.for-each.js';
7
13
  import { sendRequest, AuthmeError } from '@authme/core';
8
14
  import { osVersion, Storage } from '@authme/util';
9
- import 'core-js/modules/es.symbol.description.js';
10
15
 
11
16
  var ResourceImageType;
12
17
  (function (ResourceImageType) {
@@ -96,8 +101,8 @@ class CardOCR extends AuthmeEngineModuleBase {
96
101
  return this.type;
97
102
  }
98
103
  setParams(params) {
99
- var _a;
100
- if (((_a = params.type) !== null && _a !== void 0 ? _a : this.type) === EAuthMeCardClass.Invalid) throw new Error('Please set type first');
104
+ var _params$type;
105
+ if (((_params$type = params.type) != null ? _params$type : this.type) === EAuthMeCardClass.Invalid) throw new Error('Please set type first');
101
106
  return this.engine.run(this.moduleName, 'setParams', Object.assign({
102
107
  type: this.type
103
108
  }, params));
@@ -112,8 +117,8 @@ class IdCardAntiFraudService extends AuthmeEngineModuleBase {
112
117
  const stageStrList = stageList.map(x => x.split('_')[1]);
113
118
  return this.engine.run(this.moduleName, 'setStage', stageStrList);
114
119
  }
115
- getCardMatchROI() {
116
- return this.engine.run(this.moduleName, 'getCardMatchROI');
120
+ getCardMatchROI(config) {
121
+ return this.engine.run(this.moduleName, 'getCardMatchROI', config);
117
122
  }
118
123
  }
119
124
  class MRZService extends AuthmeEngineModuleBase {
@@ -217,7 +222,7 @@ function getCardTypes(type, country) {
217
222
  return CardTypeMap[type];
218
223
  }
219
224
  function cardTypeTitle(cardType) {
220
- var _a, _b;
225
+ var _cardTypeMap$cardType, _cardTypeMap$cardType2;
221
226
  if (cardType == null) {
222
227
  return '';
223
228
  }
@@ -251,11 +256,11 @@ function cardTypeTitle(cardType) {
251
256
  const typeSections = cardTypeLower.split('_');
252
257
  const cardTypeName = typeSections[1];
253
258
  const cardTypeSection = typeSections[2];
254
- const titleKey = ((_a = cardTypeMap[cardTypeName]) === null || _a === void 0 ? void 0 : _a[cardTypeSection]) || ((_b = cardTypeMap[cardTypeName]) === null || _b === void 0 ? void 0 : _b.default);
259
+ const titleKey = ((_cardTypeMap$cardType = cardTypeMap[cardTypeName]) == null ? void 0 : _cardTypeMap$cardType[cardTypeSection]) || ((_cardTypeMap$cardType2 = cardTypeMap[cardTypeName]) == null ? void 0 : _cardTypeMap$cardType2.default);
255
260
  return titleKey || '';
256
261
  }
257
262
  function cardTypeHeader(cardType) {
258
- var _a, _b;
263
+ var _cardTypeMap$cardType3, _cardTypeMap$cardType4;
259
264
  if (cardType == null) {
260
265
  return '';
261
266
  }
@@ -294,9 +299,9 @@ function cardTypeHeader(cardType) {
294
299
  const cardTypeName = typeSections[1];
295
300
  const cardTypeSection = typeSections[2];
296
301
  if (country === CountryCode.JPN.toLowerCase() && cardTypeName === 'idcard') {
297
- return 'sdk.verify.myNumberCard.header' ;
302
+ return 'sdk.verify.myNumberCard.header';
298
303
  }
299
- const titleKey = ((_a = cardTypeMap[cardTypeName]) === null || _a === void 0 ? void 0 : _a[cardTypeSection]) || ((_b = cardTypeMap[cardTypeName]) === null || _b === void 0 ? void 0 : _b.default);
304
+ const titleKey = ((_cardTypeMap$cardType3 = cardTypeMap[cardTypeName]) == null ? void 0 : _cardTypeMap$cardType3[cardTypeSection]) || ((_cardTypeMap$cardType4 = cardTypeMap[cardTypeName]) == null ? void 0 : _cardTypeMap$cardType4.default);
300
305
  return titleKey || '';
301
306
  }
302
307
  function cardTypeConfirmTitle(cardType) {
@@ -354,11 +359,13 @@ function mapCardtypeToAuthmeClass(type) {
354
359
  }
355
360
  }
356
361
  function getRecognitionColumnOrder(column) {
357
- var _a;
358
- return (_a = RECOGNITION_COLUMNS_ORDER[column]) !== null && _a !== void 0 ? _a : Number.MAX_VALUE;
362
+ var _RECOGNITION_COLUMNS_;
363
+ return (_RECOGNITION_COLUMNS_ = RECOGNITION_COLUMNS_ORDER[column]) != null ? _RECOGNITION_COLUMNS_ : Number.MAX_VALUE;
359
364
  }
360
365
  const twoWayAuthmeCardClassMap = (() => {
361
366
  const map = Object.fromEntries(Object.entries(ServerSideEAuthMeCardClass).map(([key, value]) => [`EAuthMeCardClass_${key}`, value]));
367
+ // Manually add ALL_PASSPORT_CONTENT mapping
368
+ map['EAuthMeCardClass_ALL_PASSPORT_CONTENT'] = ServerSideEAuthMeCardClass.Passport;
362
369
  const inverted = Object.fromEntries(Object.entries(map).map(([key, value]) => [value, key]));
363
370
  return {
364
371
  toServer(clientEnum) {
@@ -370,44 +377,11 @@ const twoWayAuthmeCardClassMap = (() => {
370
377
  };
371
378
  })();
372
379
 
373
- /******************************************************************************
374
- Copyright (c) Microsoft Corporation.
375
-
376
- Permission to use, copy, modify, and/or distribute this software for any
377
- purpose with or without fee is hereby granted.
378
-
379
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
380
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
381
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
382
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
383
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
384
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
385
- PERFORMANCE OF THIS SOFTWARE.
386
- ***************************************************************************** */
387
-
388
- function __awaiter(thisArg, _arguments, P, generator) {
389
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
390
- return new (P || (P = Promise))(function (resolve, reject) {
391
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
392
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
393
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
394
- step((generator = generator.apply(thisArg, _arguments || [])).next());
395
- });
396
- }
397
-
398
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
399
- var e = new Error(message);
400
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
401
- };
402
-
403
380
  var name = "authme/sdk";
404
- var version$1 = "2.8.41";
405
- var date = "2026-01-30T10:27:23+0000";
381
+ var version$1 = "2.8.44";
406
382
  var packageInfo = {
407
383
  name: name,
408
- version: version$1,
409
- date: date
410
- };
384
+ version: version$1};
411
385
 
412
386
  function initScan(type, country, needConfirm, cardTypes) {
413
387
  // let useCardTypes: any = getCardSubTypes(type, country).map((c) =>
@@ -474,8 +448,8 @@ function recognition(documentId, file) {
474
448
  body: formData,
475
449
  contentType: 'multipart/form-data'
476
450
  }).catch(error => {
477
- var _a, _b, _c;
478
- if (error instanceof AuthmeError && ((_c = (_b = (_a = error.cause) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.code) === 'AuthMe.IDRecognition:000201') {
451
+ var _error$cause;
452
+ if (error instanceof AuthmeError && ((_error$cause = error.cause) == null || (_error$cause = _error$cause.error) == null || (_error$cause = _error$cause.error) == null ? void 0 : _error$cause.code) === 'AuthMe.IDRecognition:000201') {
479
453
  return {
480
454
  retry: true,
481
455
  details: {}
@@ -499,8 +473,8 @@ function recognizeBase64(body) {
499
473
  body: JSON.stringify(body),
500
474
  contentType: 'application/json'
501
475
  }).catch(error => {
502
- var _a, _b, _c;
503
- if (error instanceof AuthmeError && ((_c = (_b = (_a = error.cause) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.code) === 'AuthMe.IDRecognition:000201') {
476
+ var _error$cause2;
477
+ if (error instanceof AuthmeError && ((_error$cause2 = error.cause) == null || (_error$cause2 = _error$cause2.error) == null || (_error$cause2 = _error$cause2.error) == null ? void 0 : _error$cause2.code) === 'AuthMe.IDRecognition:000201') {
504
478
  return {
505
479
  retry: true,
506
480
  details: {}
@@ -532,8 +506,8 @@ function uploadFrameBase64(body) {
532
506
  body: JSON.stringify(body),
533
507
  contentType: 'application/json'
534
508
  }).catch(error => {
535
- var _a, _b, _c;
536
- if (error instanceof AuthmeError && ((_c = (_b = (_a = error.cause) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.code) === 'AuthMe.IDRecognition:000201') {
509
+ var _error$cause3;
510
+ if (error instanceof AuthmeError && ((_error$cause3 = error.cause) == null || (_error$cause3 = _error$cause3.error) == null || (_error$cause3 = _error$cause3.error) == null ? void 0 : _error$cause3.code) === 'AuthMe.IDRecognition:000201') {
537
511
  return {
538
512
  retry: true,
539
513
  details: {}
@@ -592,8 +566,8 @@ function saveExtraDoc(params) {
592
566
  const formData = new FormData();
593
567
  formData.append('file', params.file);
594
568
  Object.keys(params.info).forEach(key => {
595
- if (!(params === null || params === void 0 ? void 0 : params.info[key])) return;
596
- formData.append(`info[${key}]`, params === null || params === void 0 ? void 0 : params.info[key]);
569
+ if (!(params != null && params.info[key])) return;
570
+ formData.append(`info[${key}]`, params == null ? void 0 : params.info[key]);
597
571
  });
598
572
  return sendRequest('/api/identity-verification/v1/verification/extra-document/file', 'POST', {
599
573
  body: formData,
@@ -613,48 +587,43 @@ function logCollect(message, stackTrace) {
613
587
  body: JSON.stringify(body)
614
588
  });
615
589
  }
616
- function option(deviceType) {
617
- return __awaiter(this, void 0, void 0, function* () {
618
- return sendRequest(`/api/identity-verification/v1/option${deviceType ? '?deviceType=' + deviceType : ''}`, 'GET');
619
- });
590
+ async function option(deviceType) {
591
+ return sendRequest(`/api/identity-verification/v1/option${deviceType ? '?deviceType=' + deviceType : ''}`, 'GET');
620
592
  }
621
- function themeUI(themeId) {
622
- return __awaiter(this, void 0, void 0, function* () {
623
- // const url = `/api/identity-verification/v1/ui-themes/${themeId}`;
624
- // const accessToken = Storage.getItem('token') as string | null;
625
- // const baseUrl = Storage.getItem('apiBaseUrl') as string | null;
626
- // const normalizedUrl = baseUrl ? new URL(url, baseUrl).toString() : url;
627
- // try {
628
- // const response = await fetch(normalizedUrl, {
629
- // method: 'GET',
630
- // headers: {
631
- // 'Content-Type': 'application/json',
632
- // 'Authorization': `Bearer ${accessToken}`, // 如果需要身份驗證
633
- // 'sdk-info': [
634
- // `sdk-version: ${version}`,
635
- // `platform: ${navigator.platform}`,
636
- // ].join(';') as string
637
- // }
638
- // });
639
- // if (!response.ok) {
640
- // // throw new Error(`HTTP error! Status: ${response.status}`);
641
- // return {};
642
- // }
643
- // const data = await response.json();
644
- // console.log('Response Data:', data);
645
- // return data; // 可以回傳資料讓其他函式使用
646
- // } catch (error) {
647
- // console.error('Fetch Error:', error);
648
- // return {}; // 或拋出錯誤,視需求而定
649
- // }
650
- return sendRequest(`/api/identity-verification/v1/ui-themes/${themeId}`, 'GET');
651
- });
593
+ async function themeUI(themeId) {
594
+ // const url = `/api/identity-verification/v1/ui-themes/${themeId}`;
595
+ // const accessToken = Storage.getItem('token') as string | null;
596
+ // const baseUrl = Storage.getItem('apiBaseUrl') as string | null;
597
+ // const normalizedUrl = baseUrl ? new URL(url, baseUrl).toString() : url;
598
+ // try {
599
+ // const response = await fetch(normalizedUrl, {
600
+ // method: 'GET',
601
+ // headers: {
602
+ // 'Content-Type': 'application/json',
603
+ // 'Authorization': `Bearer ${accessToken}`, // 如果需要身份驗證
604
+ // 'sdk-info': [
605
+ // `sdk-version: ${version}`,
606
+ // `platform: ${navigator.platform}`,
607
+ // ].join(';') as string
608
+ // }
609
+ // });
610
+ // if (!response.ok) {
611
+ // // throw new Error(`HTTP error! Status: ${response.status}`);
612
+ // return {};
613
+ // }
614
+ // const data = await response.json();
615
+ // console.log('Response Data:', data);
616
+ // return data; // 可以回傳資料讓其他函式使用
617
+ // } catch (error) {
618
+ // console.error('Fetch Error:', error);
619
+ // return {}; // 或拋出錯誤,視需求而定
620
+ // }
621
+ return sendRequest(`/api/identity-verification/v1/ui-themes/${themeId}`, 'GET');
652
622
  }
653
623
 
654
- var _a;
655
- var _b, _c;
624
+ var _window, _Symbol$for, _window$_Symbol$for;
656
625
  const version = packageInfo.version;
657
- (_a = (_b = window)[_c = Symbol.for('authme-sdk')]) !== null && _a !== void 0 ? _a : _b[_c] = {};
626
+ (_window$_Symbol$for = (_window = window)[_Symbol$for = Symbol.for('authme-sdk')]) != null ? _window$_Symbol$for : _window[_Symbol$for] = {};
658
627
  window[Symbol.for('authme-sdk')][packageInfo.name] = version;
659
628
 
660
629
  export { CardOCR, CountryCode, IdCardAntiFraudService, IdRecognitionCardName, IdRecognitionCardType, IdType, IdTypeConfig, MRZService, RecognitionFileType, ResourceImageType, ServerSideEAuthMeCardClass, cardTypeConfirmTitle, cardTypeHeader, cardTypeTitle, confirmScan, finishScanDocument, getCardSubTypes, getCardTypes, getRecognitionColumnOrder, initScan, initScanDocument, initScanDocumentResourceBase64, logCollect, mapCardtypeToAuthmeClass, option, recognition, recognizeBase64, saveExtraDoc, saveResourceImage, themeUI, thicknessDefaultConfig, twoWayAuthmeCardClassMap, uploadFrameBase64, version };
package/package.json CHANGED
@@ -1,15 +1,10 @@
1
1
  {
2
2
  "name": "@authme/id-recognition",
3
- "version": "2.8.41",
3
+ "version": "2.8.44",
4
4
  "peerDependencies": {
5
- "core-js": "^3.6.0",
6
- "@authme/core": "2.8.41",
7
- "@authme/engine": "2.8.41",
8
- "@authme/util": "2.8.41"
5
+ "core-js": "^3.6.0"
9
6
  },
10
- "module": "./index.js",
11
- "main": "./index.cjs",
12
- "type": "module",
13
- "types": "./src/index.d.ts",
14
- "dependencies": {}
15
- }
7
+ "module": "./index.esm.js",
8
+ "main": "./index.cjs.js",
9
+ "types": "./index.esm.d.ts"
10
+ }
package/src/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export * from './lib/modules-id-recognition-feature-id-recognition';
2
- export * from './lib/model';
3
- export * from './lib/enum';
4
- export * from './lib/interface';
5
- export * from './lib/util';
6
- export * from './lib/data-access';
7
- export { version } from './lib/version';
1
+ export * from './lib/modules-id-recognition-feature-id-recognition';
2
+ export * from './lib/model';
3
+ export * from './lib/enum';
4
+ export * from './lib/interface';
5
+ export * from './lib/util';
6
+ export * from './lib/data-access';
7
+ export { version } from './lib/version';