@authme/id-recognition 2.8.42 → 2.8.45
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 +1 -0
- package/{index.cjs → index.cjs.js} +67 -100
- package/index.esm.d.ts +1 -0
- package/{index.js → index.esm.js} +60 -91
- package/package.json +6 -11
- package/src/index.d.ts +7 -7
- package/src/lib/data-access/api.d.ts +93 -93
- package/src/lib/data-access/index.d.ts +1 -1
- package/src/lib/enum/id-recognition.enum.d.ts +66 -66
- package/src/lib/enum/index.d.ts +1 -1
- package/src/lib/interface/api-response.interface.d.ts +65 -65
- package/src/lib/interface/id-recognition-type.interface.d.ts +79 -79
- package/src/lib/interface/index.d.ts +2 -2
- package/src/lib/model/dto.model.d.ts +27 -27
- package/src/lib/model/id-type.enum.d.ts +13 -13
- package/src/lib/model/index.d.ts +2 -2
- package/src/lib/modules-id-recognition-feature-id-recognition.d.ts +27 -27
- package/src/lib/util.d.ts +12 -12
- package/src/lib/version.d.ts +1 -1
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
|
-
|
|
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
|
|
103
|
-
if (((
|
|
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));
|
|
@@ -220,7 +223,7 @@ function getCardTypes(type, country) {
|
|
|
220
223
|
return CardTypeMap[type];
|
|
221
224
|
}
|
|
222
225
|
function cardTypeTitle(cardType) {
|
|
223
|
-
var
|
|
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 = ((
|
|
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
|
|
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 = ((
|
|
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
|
|
361
|
-
return (
|
|
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.
|
|
408
|
-
var date = "2026-02-03T09:36:05+0000";
|
|
382
|
+
var version$1 = "2.8.45";
|
|
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
|
|
481
|
-
if (error instanceof core.AuthmeError && ((
|
|
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
|
|
506
|
-
if (error instanceof core.AuthmeError && ((
|
|
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
|
|
539
|
-
if (error instanceof core.AuthmeError && ((
|
|
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
|
|
599
|
-
formData.append(`info[${key}]`, params
|
|
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
|
|
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
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
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
|
|
658
|
-
var _b, _c;
|
|
625
|
+
var _window, _Symbol$for, _window$_Symbol$for;
|
|
659
626
|
const version = packageInfo.version;
|
|
660
|
-
(
|
|
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,
|
|
630
|
+
Object.defineProperty(exports, "EAuthMeCardClass", {
|
|
664
631
|
enumerable: true,
|
|
665
632
|
get: function () { return engine.EAuthMeCardClass; }
|
|
666
633
|
});
|
|
667
|
-
Object.defineProperty(exports,
|
|
634
|
+
Object.defineProperty(exports, "EAuthMeCardMatchStatus", {
|
|
668
635
|
enumerable: true,
|
|
669
636
|
get: function () { return engine.EAuthMeCardMatchStatus; }
|
|
670
637
|
});
|
|
671
|
-
Object.defineProperty(exports,
|
|
638
|
+
Object.defineProperty(exports, "EAuthMeCardOCRStatus", {
|
|
672
639
|
enumerable: true,
|
|
673
640
|
get: function () { return engine.EAuthMeCardOCRStatus; }
|
|
674
641
|
});
|
|
675
|
-
Object.defineProperty(exports,
|
|
642
|
+
Object.defineProperty(exports, "EAuthMeIDCardAntiFraudStage", {
|
|
676
643
|
enumerable: true,
|
|
677
644
|
get: function () { return engine.EAuthMeIDCardAntiFraudStage; }
|
|
678
645
|
});
|
|
679
|
-
Object.defineProperty(exports,
|
|
646
|
+
Object.defineProperty(exports, "EAuthMeIDCardAntiFraudStatus", {
|
|
680
647
|
enumerable: true,
|
|
681
648
|
get: function () { return engine.EAuthMeIDCardAntiFraudStatus; }
|
|
682
649
|
});
|
|
683
|
-
Object.defineProperty(exports,
|
|
650
|
+
Object.defineProperty(exports, "EAuthMeMRZRecogStatus", {
|
|
684
651
|
enumerable: true,
|
|
685
652
|
get: function () { return engine.EAuthMeMRZRecogStatus; }
|
|
686
653
|
});
|
|
687
|
-
Object.defineProperty(exports,
|
|
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
|
|
100
|
-
if (((
|
|
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));
|
|
@@ -217,7 +222,7 @@ function getCardTypes(type, country) {
|
|
|
217
222
|
return CardTypeMap[type];
|
|
218
223
|
}
|
|
219
224
|
function cardTypeTitle(cardType) {
|
|
220
|
-
var
|
|
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 = ((
|
|
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
|
|
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 = ((
|
|
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
|
|
358
|
-
return (
|
|
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.
|
|
405
|
-
var date = "2026-02-03T09:36:05+0000";
|
|
381
|
+
var version$1 = "2.8.45";
|
|
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
|
|
478
|
-
if (error instanceof AuthmeError && ((
|
|
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
|
|
503
|
-
if (error instanceof AuthmeError && ((
|
|
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
|
|
536
|
-
if (error instanceof AuthmeError && ((
|
|
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
|
|
596
|
-
formData.append(`info[${key}]`, params
|
|
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
|
|
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
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
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
|
|
655
|
-
var _b, _c;
|
|
624
|
+
var _window, _Symbol$for, _window$_Symbol$for;
|
|
656
625
|
const version = packageInfo.version;
|
|
657
|
-
(
|
|
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.
|
|
3
|
+
"version": "2.8.45",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"core-js": "^3.6.0"
|
|
6
|
-
"@authme/core": "2.8.42",
|
|
7
|
-
"@authme/engine": "2.8.42",
|
|
8
|
-
"@authme/util": "2.8.42"
|
|
5
|
+
"core-js": "^3.6.0"
|
|
9
6
|
},
|
|
10
|
-
"module": "./index.js",
|
|
11
|
-
"main": "./index.cjs",
|
|
12
|
-
"
|
|
13
|
-
|
|
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';
|