@authme/core 2.1.1
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/CHANGELOG.md +101 -0
- package/README.md +7 -0
- package/package.json +12 -0
- package/src/index.d.ts +4 -0
- package/src/index.js +8 -0
- package/src/index.js.map +1 -0
- package/src/lib/core.d.ts +1 -0
- package/src/lib/core.js +8 -0
- package/src/lib/core.js.map +1 -0
- package/src/lib/data-access/http-client.d.ts +9 -0
- package/src/lib/data-access/http-client.js +44 -0
- package/src/lib/data-access/http-client.js.map +1 -0
- package/src/lib/data-access/index.d.ts +1 -0
- package/src/lib/data-access/index.js +5 -0
- package/src/lib/data-access/index.js.map +1 -0
- package/src/lib/enum/language.enum.d.ts +4 -0
- package/src/lib/enum/language.enum.js +9 -0
- package/src/lib/enum/language.enum.js.map +1 -0
- package/src/lib/model/authme-error.d.ts +29 -0
- package/src/lib/model/authme-error.js +51 -0
- package/src/lib/model/authme-error.js.map +1 -0
- package/src/lib/model/index.d.ts +1 -0
- package/src/lib/model/index.js +5 -0
- package/src/lib/model/index.js.map +1 -0
- package/src/lib/model/init-config.interface.d.ts +0 -0
- package/src/lib/model/init-config.interface.js +1 -0
- package/src/lib/model/init-config.interface.js.map +1 -0
- package/src/lib/translate/index.d.ts +1 -0
- package/src/lib/translate/index.js +5 -0
- package/src/lib/translate/index.js.map +1 -0
- package/src/lib/translate/translate.d.ts +14 -0
- package/src/lib/translate/translate.js +46 -0
- package/src/lib/translate/translate.js.map +1 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
|
+
|
|
5
|
+
## [2.1.1](https://github.com/AuthMe01/web-client-sdk/compare/prod-2.1.0...prod-2.1.1) (2022-09-08)
|
|
6
|
+
|
|
7
|
+
## 1.2.2 (2022-07-28)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
- PROD-405 Handle ocr backend recognition error ([1084e8d](https://github.com/AuthMe01/web-client-sdk/commit/1084e8d70f00ab8200f00f334272e1d594585387))
|
|
12
|
+
- PROD-463 handle anti-fraud timeout error ([13d1533](https://github.com/AuthMe01/web-client-sdk/commit/13d1533a4baecefadd9a47e0f81ac5ed4dbba0fa))
|
|
13
|
+
- PROD-583 fix anti-fraud process ([aee07de](https://github.com/AuthMe01/web-client-sdk/commit/aee07de111240304584a1b08dc9b9c6bc816f615))
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
- PROD-135 v3 fas api ([8e1e9cc](https://github.com/AuthMe01/web-client-sdk/commit/8e1e9cc9b8e5acbdbc4d49564bad8d42146a3c61))
|
|
18
|
+
- PROD-279 add sdk info in request header ([ca871cf](https://github.com/AuthMe01/web-client-sdk/commit/ca871cf9182aab3499c1918a8b946dc6d2cfed9a))
|
|
19
|
+
- PROD-334 Add Network Error Retry ([1dafbfd](https://github.com/AuthMe01/web-client-sdk/commit/1dafbfd2d51024abed9611cda4b7bd04401ed7f1))
|
|
20
|
+
- PROD-595 Add eKYC impl ([6b5cf51](https://github.com/AuthMe01/web-client-sdk/commit/6b5cf5198a8f3039a52a1f114ff2089cb45b17b2))
|
|
21
|
+
- show current version on view ([1957ca6](https://github.com/AuthMe01/web-client-sdk/commit/1957ca6f863e1421ed3705937a7e8601cda70916))
|
|
22
|
+
|
|
23
|
+
## 1.2.1 (2022-07-28)
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
- PROD-405 Handle ocr backend recognition error ([1084e8d](https://github.com/AuthMe01/web-client-sdk/commit/1084e8d70f00ab8200f00f334272e1d594585387))
|
|
28
|
+
- PROD-463 handle anti-fraud timeout error ([13d1533](https://github.com/AuthMe01/web-client-sdk/commit/13d1533a4baecefadd9a47e0f81ac5ed4dbba0fa))
|
|
29
|
+
- PROD-583 fix anti-fraud process ([aee07de](https://github.com/AuthMe01/web-client-sdk/commit/aee07de111240304584a1b08dc9b9c6bc816f615))
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
- PROD-135 v3 fas api ([8e1e9cc](https://github.com/AuthMe01/web-client-sdk/commit/8e1e9cc9b8e5acbdbc4d49564bad8d42146a3c61))
|
|
34
|
+
- PROD-279 add sdk info in request header ([ca871cf](https://github.com/AuthMe01/web-client-sdk/commit/ca871cf9182aab3499c1918a8b946dc6d2cfed9a))
|
|
35
|
+
- PROD-334 Add Network Error Retry ([1dafbfd](https://github.com/AuthMe01/web-client-sdk/commit/1dafbfd2d51024abed9611cda4b7bd04401ed7f1))
|
|
36
|
+
- PROD-595 Add eKYC impl ([6b5cf51](https://github.com/AuthMe01/web-client-sdk/commit/6b5cf5198a8f3039a52a1f114ff2089cb45b17b2))
|
|
37
|
+
- show current version on view ([1957ca6](https://github.com/AuthMe01/web-client-sdk/commit/1957ca6f863e1421ed3705937a7e8601cda70916))
|
|
38
|
+
|
|
39
|
+
# 1.2.0 (2022-07-25)
|
|
40
|
+
|
|
41
|
+
### Bug Fixes
|
|
42
|
+
|
|
43
|
+
- PROD-405 Handle ocr backend recognition error ([1084e8d](https://github.com/AuthMe01/web-client-sdk/commit/1084e8d70f00ab8200f00f334272e1d594585387))
|
|
44
|
+
- PROD-463 handle anti-fraud timeout error ([13d1533](https://github.com/AuthMe01/web-client-sdk/commit/13d1533a4baecefadd9a47e0f81ac5ed4dbba0fa))
|
|
45
|
+
- PROD-583 fix anti-fraud process ([aee07de](https://github.com/AuthMe01/web-client-sdk/commit/aee07de111240304584a1b08dc9b9c6bc816f615))
|
|
46
|
+
|
|
47
|
+
### Features
|
|
48
|
+
|
|
49
|
+
- PROD-135 v3 fas api ([8e1e9cc](https://github.com/AuthMe01/web-client-sdk/commit/8e1e9cc9b8e5acbdbc4d49564bad8d42146a3c61))
|
|
50
|
+
- PROD-279 add sdk info in request header ([ca871cf](https://github.com/AuthMe01/web-client-sdk/commit/ca871cf9182aab3499c1918a8b946dc6d2cfed9a))
|
|
51
|
+
- PROD-334 Add Network Error Retry ([1dafbfd](https://github.com/AuthMe01/web-client-sdk/commit/1dafbfd2d51024abed9611cda4b7bd04401ed7f1))
|
|
52
|
+
- PROD-595 Add eKYC impl ([6b5cf51](https://github.com/AuthMe01/web-client-sdk/commit/6b5cf5198a8f3039a52a1f114ff2089cb45b17b2))
|
|
53
|
+
- show current version on view ([1957ca6](https://github.com/AuthMe01/web-client-sdk/commit/1957ca6f863e1421ed3705937a7e8601cda70916))
|
|
54
|
+
|
|
55
|
+
## 1.1.1 (2022-07-07)
|
|
56
|
+
|
|
57
|
+
### Bug Fixes
|
|
58
|
+
|
|
59
|
+
- PROD-405 Handle ocr backend recognition error ([1084e8d](https://github.com/AuthMe01/web-client-sdk/commit/1084e8d70f00ab8200f00f334272e1d594585387))
|
|
60
|
+
- PROD-463 handle anti-fraud timeout error ([13d1533](https://github.com/AuthMe01/web-client-sdk/commit/13d1533a4baecefadd9a47e0f81ac5ed4dbba0fa))
|
|
61
|
+
- PROD-583 fix anti-fraud process ([aee07de](https://github.com/AuthMe01/web-client-sdk/commit/aee07de111240304584a1b08dc9b9c6bc816f615))
|
|
62
|
+
|
|
63
|
+
### Features
|
|
64
|
+
|
|
65
|
+
- PROD-135 v3 fas api ([8e1e9cc](https://github.com/AuthMe01/web-client-sdk/commit/8e1e9cc9b8e5acbdbc4d49564bad8d42146a3c61))
|
|
66
|
+
- PROD-279 add sdk info in request header ([ca871cf](https://github.com/AuthMe01/web-client-sdk/commit/ca871cf9182aab3499c1918a8b946dc6d2cfed9a))
|
|
67
|
+
- PROD-334 Add Network Error Retry ([1dafbfd](https://github.com/AuthMe01/web-client-sdk/commit/1dafbfd2d51024abed9611cda4b7bd04401ed7f1))
|
|
68
|
+
- PROD-595 Add eKYC impl ([6b5cf51](https://github.com/AuthMe01/web-client-sdk/commit/6b5cf5198a8f3039a52a1f114ff2089cb45b17b2))
|
|
69
|
+
- show current version on view ([1957ca6](https://github.com/AuthMe01/web-client-sdk/commit/1957ca6f863e1421ed3705937a7e8601cda70916))
|
|
70
|
+
|
|
71
|
+
# 1.1.0 (2022-07-06)
|
|
72
|
+
|
|
73
|
+
### Bug Fixes
|
|
74
|
+
|
|
75
|
+
- PROD-405 Handle ocr backend recognition error ([1084e8d](https://github.com/AuthMe01/web-client-sdk/commit/1084e8d70f00ab8200f00f334272e1d594585387))
|
|
76
|
+
- PROD-463 handle anti-fraud timeout error ([13d1533](https://github.com/AuthMe01/web-client-sdk/commit/13d1533a4baecefadd9a47e0f81ac5ed4dbba0fa))
|
|
77
|
+
- PROD-583 fix anti-fraud process ([aee07de](https://github.com/AuthMe01/web-client-sdk/commit/aee07de111240304584a1b08dc9b9c6bc816f615))
|
|
78
|
+
|
|
79
|
+
### Features
|
|
80
|
+
|
|
81
|
+
- PROD-135 v3 fas api ([8e1e9cc](https://github.com/AuthMe01/web-client-sdk/commit/8e1e9cc9b8e5acbdbc4d49564bad8d42146a3c61))
|
|
82
|
+
- PROD-279 add sdk info in request header ([ca871cf](https://github.com/AuthMe01/web-client-sdk/commit/ca871cf9182aab3499c1918a8b946dc6d2cfed9a))
|
|
83
|
+
- PROD-334 Add Network Error Retry ([1dafbfd](https://github.com/AuthMe01/web-client-sdk/commit/1dafbfd2d51024abed9611cda4b7bd04401ed7f1))
|
|
84
|
+
- PROD-595 Add eKYC impl ([6b5cf51](https://github.com/AuthMe01/web-client-sdk/commit/6b5cf5198a8f3039a52a1f114ff2089cb45b17b2))
|
|
85
|
+
- show current version on view ([1957ca6](https://github.com/AuthMe01/web-client-sdk/commit/1957ca6f863e1421ed3705937a7e8601cda70916))
|
|
86
|
+
|
|
87
|
+
# 1.0.0 (2022-05-30)
|
|
88
|
+
|
|
89
|
+
### Bug Fixes
|
|
90
|
+
|
|
91
|
+
- PROD-405 Handle ocr backend recognition error ([1084e8d](https://github.com/AuthMe01/web-client-sdk/commit/1084e8d70f00ab8200f00f334272e1d594585387))
|
|
92
|
+
- PROD-463 handle anti-fraud timeout error ([13d1533](https://github.com/AuthMe01/web-client-sdk/commit/13d1533a4baecefadd9a47e0f81ac5ed4dbba0fa))
|
|
93
|
+
- PROD-583 fix anti-fraud process ([aee07de](https://github.com/AuthMe01/web-client-sdk/commit/aee07de111240304584a1b08dc9b9c6bc816f615))
|
|
94
|
+
|
|
95
|
+
### Features
|
|
96
|
+
|
|
97
|
+
- PROD-135 v3 fas api ([8e1e9cc](https://github.com/AuthMe01/web-client-sdk/commit/8e1e9cc9b8e5acbdbc4d49564bad8d42146a3c61))
|
|
98
|
+
- PROD-279 add sdk info in request header ([ca871cf](https://github.com/AuthMe01/web-client-sdk/commit/ca871cf9182aab3499c1918a8b946dc6d2cfed9a))
|
|
99
|
+
- PROD-334 Add Network Error Retry ([1dafbfd](https://github.com/AuthMe01/web-client-sdk/commit/1dafbfd2d51024abed9611cda4b7bd04401ed7f1))
|
|
100
|
+
- PROD-595 Add eKYC impl ([6b5cf51](https://github.com/AuthMe01/web-client-sdk/commit/6b5cf5198a8f3039a52a1f114ff2089cb45b17b2))
|
|
101
|
+
- show current version on view ([1957ca6](https://github.com/AuthMe01/web-client-sdk/commit/1957ca6f863e1421ed3705937a7e8601cda70916))
|
package/README.md
ADDED
package/package.json
ADDED
package/src/index.d.ts
ADDED
package/src/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./lib/core"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./lib/model"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./lib/data-access"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./lib/translate"), exports);
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/core/src/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B;AAC3B,sDAA4B;AAC5B,4DAAkC;AAClC,0DAAgC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function core(): string;
|
package/src/lib/core.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../../../libs/core/src/lib/core.ts"],"names":[],"mappings":";;;AAAA,SAAgB,IAAI;IAClB,OAAO,MAAM,CAAC;AAChB,CAAC;AAFD,oBAEC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendRequest = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const util_1 = require("@authme/util");
|
|
6
|
+
const model_1 = require("../model");
|
|
7
|
+
function sendRequest(url, method = 'GET', body = null, contentType = 'application/json') {
|
|
8
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
const options = {
|
|
10
|
+
method,
|
|
11
|
+
body,
|
|
12
|
+
headers: {
|
|
13
|
+
Authorization: util_1.Storage.getItem('token')
|
|
14
|
+
? 'Bearer ' + util_1.Storage.getItem('token')
|
|
15
|
+
: '',
|
|
16
|
+
'Content-Type': contentType,
|
|
17
|
+
'sdk-info': `sdk-version: ${util_1.Storage.getItem('SDKVersion')};${(0, util_1.getUserAgent)()}`,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
if (contentType === 'multipart/form-data') {
|
|
21
|
+
delete options.headers['Content-Type'];
|
|
22
|
+
}
|
|
23
|
+
const normalizedUrl = new URL(url, util_1.Storage.getItem('apiBaseUrl') || '');
|
|
24
|
+
let resp;
|
|
25
|
+
try {
|
|
26
|
+
resp = yield fetch(normalizedUrl.toString(), options);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
throw new model_1.AuthmeError(model_1.ErrorCode.NETWORK_ERROR, error);
|
|
30
|
+
}
|
|
31
|
+
if (resp === null || resp === void 0 ? void 0 : resp.ok) {
|
|
32
|
+
return resp.json();
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
throw new model_1.AuthmeError(model_1.ErrorCode.HTTP_ERROR_RESPONSE, {
|
|
36
|
+
status: resp.status,
|
|
37
|
+
ok: resp.ok,
|
|
38
|
+
error: yield resp.json(),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
exports.sendRequest = sendRequest;
|
|
44
|
+
//# sourceMappingURL=http-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-client.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/data-access/http-client.ts"],"names":[],"mappings":";;;;AAAA,uCAAqD;AACrD,oCAAkD;AAOlD,SAAsB,WAAW,CAC/B,GAAW,EACX,MAAM,GAAG,KAAK,EACd,OAAY,IAAI,EAChB,WAAW,GAAG,kBAAkB;;QAEhC,MAAM,OAAO,GAAG;YACd,MAAM;YACN,IAAI;YACJ,OAAO,EAAE;gBACP,aAAa,EAAE,cAAO,CAAC,OAAO,CAAC,OAAO,CAAC;oBACrC,CAAC,CAAC,SAAS,GAAG,cAAO,CAAC,OAAO,CAAC,OAAO,CAAC;oBACtC,CAAC,CAAC,EAAE;gBACN,cAAc,EAAE,WAAW;gBAC3B,UAAU,EAAE,gBAAgB,cAAO,CAAC,OAAO,CACzC,YAAY,CACb,IAAI,IAAA,mBAAY,GAAE,EAAE;aACtB;SACF,CAAC;QACF,IAAI,WAAW,KAAK,qBAAqB,EAAE;YACzC,OAAQ,OAAe,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;SACjD;QACD,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,cAAO,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;QACxE,IAAI,IAAI,CAAC;QACT,IAAI;YACF,IAAI,GAAG,MAAM,KAAK,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;SACvD;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,mBAAW,CAAC,iBAAS,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;SACvD;QAED,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,EAAE;YACZ,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;SACpB;aAAM;YACL,MAAM,IAAI,mBAAW,CAAC,iBAAS,CAAC,mBAAmB,EAAE;gBACnD,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,KAAK,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE;aACzB,CAAC,CAAC;SACJ;IACH,CAAC;CAAA;AAvCD,kCAuCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './http-client';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/data-access/index.ts"],"names":[],"mappings":";;;AAAA,wDAA8B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthmeLanguage = void 0;
|
|
4
|
+
var AuthmeLanguage;
|
|
5
|
+
(function (AuthmeLanguage) {
|
|
6
|
+
AuthmeLanguage["zh-TW"] = "zh_Hant_TW";
|
|
7
|
+
AuthmeLanguage["en-US"] = "en_US";
|
|
8
|
+
})(AuthmeLanguage = exports.AuthmeLanguage || (exports.AuthmeLanguage = {}));
|
|
9
|
+
//# sourceMappingURL=language.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language.enum.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/enum/language.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,sCAAsB,CAAA;IACtB,iCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAGzB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare class AuthmeError {
|
|
2
|
+
private _cause;
|
|
3
|
+
private _code;
|
|
4
|
+
constructor(code: ErrorCode, cause?: any);
|
|
5
|
+
get message(): string;
|
|
6
|
+
setCode(code: ErrorCode): void;
|
|
7
|
+
get code(): ErrorCode;
|
|
8
|
+
get cause(): any;
|
|
9
|
+
}
|
|
10
|
+
export declare enum ErrorCode {
|
|
11
|
+
BROWSER_NOT_SUPPORT = 100,
|
|
12
|
+
ENGINE_INIT_ERROR = 101,
|
|
13
|
+
ENGINE_MODULE_IS_INITIALIZING = 102,
|
|
14
|
+
ENGINE_MODULE_INIT_ERROR = 103,
|
|
15
|
+
RECOGNITION_NOT_AVAILABLE = 104,
|
|
16
|
+
RECOGNITION_ERROR = 105,
|
|
17
|
+
INVALID_AUTH_ERROR = 106,
|
|
18
|
+
FAS_RECOGNITION_ERROR = 201,
|
|
19
|
+
FAS_POST_EMPTY_RESULT = 202,
|
|
20
|
+
FAS_POST_RESULT_ERROR = 203,
|
|
21
|
+
FAS_EMPTY_CONFIG_ERROR = 204,
|
|
22
|
+
ID_RECOGNITION_CONFIRM_INFO_ERROR = 301,
|
|
23
|
+
ID_RECOGNITION_UNEXPECTED_ERROR = 399,
|
|
24
|
+
ANTI_FRAUD_TIMEOUT_ERROR = 401,
|
|
25
|
+
NETWORK_ERROR = 901,
|
|
26
|
+
HTTP_ERROR_RESPONSE = 902,
|
|
27
|
+
USER_CANCEL = 903,
|
|
28
|
+
CAMERA_NOT_SUPPORT = 904
|
|
29
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ErrorCode = exports.AuthmeError = void 0;
|
|
4
|
+
class AuthmeError {
|
|
5
|
+
constructor(code, cause = null) {
|
|
6
|
+
this._cause = null;
|
|
7
|
+
this._code = null;
|
|
8
|
+
this._code = code;
|
|
9
|
+
this._cause = cause;
|
|
10
|
+
}
|
|
11
|
+
get message() {
|
|
12
|
+
return '[Authme SDK Error] Code: ' + this.code;
|
|
13
|
+
}
|
|
14
|
+
setCode(code) {
|
|
15
|
+
this._code = code;
|
|
16
|
+
}
|
|
17
|
+
get code() {
|
|
18
|
+
return this._code;
|
|
19
|
+
}
|
|
20
|
+
get cause() {
|
|
21
|
+
return this._cause;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.AuthmeError = AuthmeError;
|
|
25
|
+
var ErrorCode;
|
|
26
|
+
(function (ErrorCode) {
|
|
27
|
+
// 1XX for engine
|
|
28
|
+
ErrorCode[ErrorCode["BROWSER_NOT_SUPPORT"] = 100] = "BROWSER_NOT_SUPPORT";
|
|
29
|
+
ErrorCode[ErrorCode["ENGINE_INIT_ERROR"] = 101] = "ENGINE_INIT_ERROR";
|
|
30
|
+
ErrorCode[ErrorCode["ENGINE_MODULE_IS_INITIALIZING"] = 102] = "ENGINE_MODULE_IS_INITIALIZING";
|
|
31
|
+
ErrorCode[ErrorCode["ENGINE_MODULE_INIT_ERROR"] = 103] = "ENGINE_MODULE_INIT_ERROR";
|
|
32
|
+
ErrorCode[ErrorCode["RECOGNITION_NOT_AVAILABLE"] = 104] = "RECOGNITION_NOT_AVAILABLE";
|
|
33
|
+
ErrorCode[ErrorCode["RECOGNITION_ERROR"] = 105] = "RECOGNITION_ERROR";
|
|
34
|
+
ErrorCode[ErrorCode["INVALID_AUTH_ERROR"] = 106] = "INVALID_AUTH_ERROR";
|
|
35
|
+
// 2 for FAS
|
|
36
|
+
ErrorCode[ErrorCode["FAS_RECOGNITION_ERROR"] = 201] = "FAS_RECOGNITION_ERROR";
|
|
37
|
+
ErrorCode[ErrorCode["FAS_POST_EMPTY_RESULT"] = 202] = "FAS_POST_EMPTY_RESULT";
|
|
38
|
+
ErrorCode[ErrorCode["FAS_POST_RESULT_ERROR"] = 203] = "FAS_POST_RESULT_ERROR";
|
|
39
|
+
ErrorCode[ErrorCode["FAS_EMPTY_CONFIG_ERROR"] = 204] = "FAS_EMPTY_CONFIG_ERROR";
|
|
40
|
+
// 3 for ID-Recognition
|
|
41
|
+
ErrorCode[ErrorCode["ID_RECOGNITION_CONFIRM_INFO_ERROR"] = 301] = "ID_RECOGNITION_CONFIRM_INFO_ERROR";
|
|
42
|
+
ErrorCode[ErrorCode["ID_RECOGNITION_UNEXPECTED_ERROR"] = 399] = "ID_RECOGNITION_UNEXPECTED_ERROR";
|
|
43
|
+
// 4 for Anti-fraud
|
|
44
|
+
ErrorCode[ErrorCode["ANTI_FRAUD_TIMEOUT_ERROR"] = 401] = "ANTI_FRAUD_TIMEOUT_ERROR";
|
|
45
|
+
// 9 for common
|
|
46
|
+
ErrorCode[ErrorCode["NETWORK_ERROR"] = 901] = "NETWORK_ERROR";
|
|
47
|
+
ErrorCode[ErrorCode["HTTP_ERROR_RESPONSE"] = 902] = "HTTP_ERROR_RESPONSE";
|
|
48
|
+
ErrorCode[ErrorCode["USER_CANCEL"] = 903] = "USER_CANCEL";
|
|
49
|
+
ErrorCode[ErrorCode["CAMERA_NOT_SUPPORT"] = 904] = "CAMERA_NOT_SUPPORT";
|
|
50
|
+
})(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
|
|
51
|
+
//# sourceMappingURL=authme-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authme-error.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/model/authme-error.ts"],"names":[],"mappings":";;;AAAA,MAAa,WAAW;IAItB,YAAY,IAAe,EAAE,QAAa,IAAI;QAHtC,WAAM,GAAQ,IAAI,CAAC;QACnB,UAAK,GAAqB,IAAI,CAAC;QAGrC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,2BAA2B,GAAG,IAAI,CAAC,IAAI,CAAC;IACjD,CAAC;IAEM,OAAO,CAAC,IAAe;QAC5B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IACD,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AAvBD,kCAuBC;AAED,IAAY,SA4BX;AA5BD,WAAY,SAAS;IACnB,iBAAiB;IACjB,yEAAyB,CAAA;IACzB,qEAAuB,CAAA;IACvB,6FAAmC,CAAA;IACnC,mFAA8B,CAAA;IAC9B,qFAA+B,CAAA;IAC/B,qEAAuB,CAAA;IACvB,uEAAwB,CAAA;IAExB,YAAY;IACZ,6EAA2B,CAAA;IAC3B,6EAA2B,CAAA;IAC3B,6EAA2B,CAAA;IAC3B,+EAA4B,CAAA;IAE5B,uBAAuB;IACvB,qGAAuC,CAAA;IACvC,iGAAqC,CAAA;IAErC,mBAAmB;IACnB,mFAA8B,CAAA;IAE9B,eAAe;IACf,6DAAmB,CAAA;IACnB,yEAAyB,CAAA;IACzB,yDAAiB,CAAA;IACjB,uEAAwB,CAAA;AAC1B,CAAC,EA5BW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QA4BpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './authme-error';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/model/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+B"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=init-config.interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-config.interface.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/model/init-config.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './translate';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/translate/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AuthmeLanguage } from '../enum/language.enum';
|
|
2
|
+
declare class TranslateService {
|
|
3
|
+
private dict;
|
|
4
|
+
private languageOptions;
|
|
5
|
+
private currentLang;
|
|
6
|
+
fetchSource(path: string): Promise<boolean>;
|
|
7
|
+
setLang(lang: AuthmeLanguage): Promise<void>;
|
|
8
|
+
translate(key: string, args?: {
|
|
9
|
+
[key: string]: string | number;
|
|
10
|
+
}): string;
|
|
11
|
+
static instance: TranslateService | null;
|
|
12
|
+
}
|
|
13
|
+
declare function getTranslateInstance(): TranslateService;
|
|
14
|
+
export { getTranslateInstance };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTranslateInstance = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const language_enum_1 = require("../enum/language.enum");
|
|
6
|
+
class TranslateService {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.dict = {};
|
|
9
|
+
this.languageOptions = [language_enum_1.AuthmeLanguage['zh-TW'], language_enum_1.AuthmeLanguage['en-US']];
|
|
10
|
+
this.currentLang = language_enum_1.AuthmeLanguage['zh-TW'];
|
|
11
|
+
}
|
|
12
|
+
fetchSource(path) {
|
|
13
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
for (let i = 0; i < this.languageOptions.length; i++) {
|
|
15
|
+
const resp = yield fetch(`${path}/${this.languageOptions[i]}.json`);
|
|
16
|
+
if (resp.ok) {
|
|
17
|
+
this.dict[this.languageOptions[i]] = yield resp.json();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
setLang(lang) {
|
|
24
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
this.currentLang = lang;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
translate(key, args = {}) {
|
|
29
|
+
let str = this.dict[this.currentLang][key] || key;
|
|
30
|
+
if (Object.keys(args).length > 0) {
|
|
31
|
+
Object.keys(args).forEach((key) => {
|
|
32
|
+
str = str.replace(new RegExp(`{{${key}}}`, 'g'), args[key].toString());
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return str;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
TranslateService.instance = null;
|
|
39
|
+
function getTranslateInstance() {
|
|
40
|
+
if (!TranslateService.instance) {
|
|
41
|
+
TranslateService.instance = new TranslateService();
|
|
42
|
+
}
|
|
43
|
+
return TranslateService.instance;
|
|
44
|
+
}
|
|
45
|
+
exports.getTranslateInstance = getTranslateInstance;
|
|
46
|
+
//# sourceMappingURL=translate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translate.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/translate/translate.ts"],"names":[],"mappings":";;;;AAAA,yDAAuD;AAEvD,MAAM,gBAAgB;IAAtB;QACU,SAAI,GAAiD,EAAE,CAAC;QAExD,oBAAe,GAAG,CAAC,8BAAc,CAAC,OAAO,CAAC,EAAE,8BAAc,CAAC,OAAO,CAAC,CAAC,CAAC;QACrE,gBAAW,GAAG,8BAAc,CAAC,OAAO,CAAC,CAAC;IA6BhD,CAAC;IA3BO,WAAW,CAAC,IAAY;;YAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACpD,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;gBACpE,IAAI,IAAI,CAAC,EAAE,EAAE;oBACX,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;iBACxD;aACF;YACD,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;IAEK,OAAO,CAAC,IAAoB;;YAChC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAC1B,CAAC;KAAA;IAED,SAAS,CAAC,GAAW,EAAE,OAA2C,EAAE;QAClE,IAAI,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC;QAElD,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAChC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBAChC,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;YACzE,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,GAAG,CAAC;IACb,CAAC;;AAEM,yBAAQ,GAA4B,IAAI,CAAC;AAGlD,SAAS,oBAAoB;IAC3B,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE;QAC9B,gBAAgB,CAAC,QAAQ,GAAG,IAAI,gBAAgB,EAAE,CAAC;KACpD;IACD,OAAO,gBAAgB,CAAC,QAAQ,CAAC;AACnC,CAAC;AAEQ,oDAAoB"}
|