@authme/core 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 DELETED
@@ -1,630 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var util = require('@authme/util');
6
- require('core-js/modules/es.object.assign.js');
7
- require('core-js/modules/es.regexp.to-string.js');
8
- require('core-js/modules/es.array.iterator.js');
9
- require('core-js/modules/web.dom-collections.iterator.js');
10
- require('core-js/modules/web.url.js');
11
- require('core-js/modules/web.url-search-params.js');
12
- require('core-js/modules/es.promise.js');
13
- require('core-js/modules/es.symbol.description.js');
14
- require('core-js/modules/es.regexp.exec.js');
15
- require('core-js/modules/es.string.replace.js');
16
- require('core-js/modules/es.regexp.constructor.js');
17
- var rxjs = require('rxjs');
18
- var operators = require('rxjs/operators');
19
- var uuid = require('uuid');
20
- require('core-js/modules/es.string.ends-with.js');
21
-
22
- function core() {
23
- return 'core';
24
- }
25
-
26
- /******************************************************************************
27
- Copyright (c) Microsoft Corporation.
28
-
29
- Permission to use, copy, modify, and/or distribute this software for any
30
- purpose with or without fee is hereby granted.
31
-
32
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
33
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
34
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
35
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
36
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
37
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
38
- PERFORMANCE OF THIS SOFTWARE.
39
- ***************************************************************************** */
40
-
41
- function __awaiter(thisArg, _arguments, P, generator) {
42
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
43
- return new (P || (P = Promise))(function (resolve, reject) {
44
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
45
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
46
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
47
- step((generator = generator.apply(thisArg, _arguments || [])).next());
48
- });
49
- }
50
-
51
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
52
- var e = new Error(message);
53
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
54
- };
55
-
56
- var name = "authme/sdk";
57
- var version$1 = "2.8.41";
58
- var date = "2026-01-30T10:27:23+0000";
59
- var packageInfo = {
60
- name: name,
61
- version: version$1,
62
- date: date
63
- };
64
-
65
- var _a;
66
- var _b, _c;
67
- const version = packageInfo.version;
68
- (_a = (_b = window)[_c = Symbol.for('authme-sdk')]) !== null && _a !== void 0 ? _a : _b[_c] = {};
69
- window[Symbol.for('authme-sdk')][packageInfo.name] = version;
70
-
71
- function requestLoggingWapper() {
72
- let loggingFuncInstance = undefined;
73
- return {
74
- setRequestLoggingFunc: func => {
75
- loggingFuncInstance = func;
76
- },
77
- getRequestLoggingFunc: () => loggingFuncInstance
78
- };
79
- }
80
- const {
81
- setRequestLoggingFunc,
82
- getRequestLoggingFunc
83
- } = requestLoggingWapper();
84
- function tryLoadAndParseJsonAsync(response) {
85
- return __awaiter(this, void 0, void 0, function* () {
86
- try {
87
- return [undefined, yield response.json()];
88
- } catch (error) {
89
- return [error, undefined];
90
- }
91
- });
92
- }
93
- function tryLoadAndParseTextAsync(response) {
94
- return __awaiter(this, void 0, void 0, function* () {
95
- try {
96
- return [undefined, yield response.text()];
97
- } catch (error) {
98
- return [error, undefined];
99
- }
100
- });
101
- }
102
- function tryLoadArrayBufferAsync(response) {
103
- return __awaiter(this, void 0, void 0, function* () {
104
- try {
105
- return [undefined, yield response.arrayBuffer()];
106
- } catch (error) {
107
- return [error, undefined];
108
- }
109
- });
110
- }
111
- function sendRequest(url, method = 'GET', {
112
- body = undefined,
113
- contentType = 'application/json',
114
- expectedResponseContentTypes = null,
115
- // 可以透過代入 null 的方式來取消預設值。
116
- accessToken = util.Storage.getItem('token'),
117
- baseUrl = util.Storage.getItem('apiBaseUrl'),
118
- sdkInfo = [`sdk-version: ${version}`, `platform: ${navigator.platform}`].join(';')
119
- } = {}) {
120
- return __awaiter(this, void 0, void 0, function* () {
121
- const requestLoggingFunction = getRequestLoggingFunc();
122
- const options = Object.assign(Object.assign({
123
- method
124
- }, typeof body !== undefined ? {
125
- body: body
126
- } : {}), {
127
- headers: Object.assign(Object.assign(Object.assign({}, accessToken ? {
128
- Authorization: 'Bearer ' + accessToken
129
- } : {}), typeof body !== 'undefined' && contentType !== 'multipart/form-data' ? {
130
- 'Content-Type': contentType
131
- } : {}), sdkInfo ? {
132
- 'sdk-info': sdkInfo
133
- } : {})
134
- });
135
- let resp;
136
- try {
137
- const normalizedUrl = baseUrl ? new URL(url, baseUrl).toString() : url;
138
- resp = requestLoggingFunction ? yield requestLoggingFunction(() => fetch(normalizedUrl.toString(), options), {
139
- runFunction: util.RUN_FUNCTION_NAME.API_REQUEST,
140
- message: {
141
- url: normalizedUrl.toString(),
142
- options
143
- }
144
- }) : yield fetch(normalizedUrl.toString(), options);
145
- } catch (error) {
146
- throw new util.AuthmeError(util.ErrorCode.NETWORK_ERROR, error);
147
- }
148
- const responseContentType = resp.headers.has('content-type') ? resp.headers.get('content-type') : undefined;
149
- const errorMessages = [];
150
- let parsedError;
151
- let responseContent;
152
- if (!responseContentType) {
153
- [parsedError, responseContent] = [undefined, undefined];
154
- } else if (responseContentType.indexOf('application/json') >= 0) {
155
- [parsedError, responseContent] = yield tryLoadAndParseJsonAsync(resp);
156
- } else if (responseContentType.indexOf('text/json') >= 0) {
157
- [parsedError, responseContent] = yield tryLoadAndParseJsonAsync(resp);
158
- } else if (responseContentType.indexOf('text/') >= 0) {
159
- [parsedError, responseContent] = yield tryLoadAndParseTextAsync(resp);
160
- } else if (responseContentType.indexOf('application/javascript') >= 0) {
161
- [parsedError, responseContent] = yield tryLoadAndParseTextAsync(resp);
162
- } else {
163
- [parsedError, responseContent] = yield tryLoadArrayBufferAsync(resp);
164
- }
165
- if (!resp.ok) {
166
- errorMessages.push('status code not in the range 200-299');
167
- }
168
- if (parsedError) {
169
- errorMessages.push('parsedError when load/parse response');
170
- }
171
- if (expectedResponseContentTypes) {
172
- if (!responseContentType || expectedResponseContentTypes.every(v => responseContentType.indexOf(v) < 0)) {
173
- errorMessages.push(`responseContentType: expected value = ${expectedResponseContentTypes}` + `, but actual value = ${responseContentType}`);
174
- }
175
- }
176
- if (errorMessages.length !== 0) {
177
- // 5XX
178
- if (resp.status >= 500 && resp.status < 600 && resp.status !== 503 && resp.status !== 504) {
179
- throw new util.AuthmeError(util.ErrorCode.SERVER_ERROR, {
180
- errorMessages,
181
- meta: {
182
- status: resp.status,
183
- ok: resp.ok,
184
- url,
185
- responseContentType,
186
- responseContent,
187
- parsedError
188
- }
189
- });
190
- }
191
- throw new util.AuthmeError(util.ErrorCode.HTTP_ERROR_RESPONSE, {
192
- errorMessages,
193
- meta: {
194
- status: resp.status,
195
- ok: resp.ok,
196
- url,
197
- responseContentType,
198
- responseContent,
199
- parsedError
200
- }
201
- });
202
- }
203
- return responseContent;
204
- });
205
- }
206
-
207
- exports.AuthmeLanguage = void 0;
208
- (function (AuthmeLanguage) {
209
- AuthmeLanguage["zh-TW"] = "zh_Hant_TW";
210
- AuthmeLanguage["en-US"] = "en_US";
211
- AuthmeLanguage["ja-JP"] = "ja_JP";
212
- })(exports.AuthmeLanguage || (exports.AuthmeLanguage = {}));
213
-
214
- class TranslateService {
215
- constructor() {
216
- this.originalDict = {};
217
- this.customDict = {};
218
- this.languageOptions = [exports.AuthmeLanguage['zh-TW'], exports.AuthmeLanguage['en-US'], exports.AuthmeLanguage['ja-JP']];
219
- this.currentLang = exports.AuthmeLanguage['zh-TW'];
220
- }
221
- fetchSource(path) {
222
- return __awaiter(this, void 0, void 0, function* () {
223
- for (let i = 0; i < this.languageOptions.length; i++) {
224
- const [resp, oldKeyResp] = yield Promise.all([fetch(`${path}/${this.languageOptions[i]}.json`), fetch(`${path}/old/${this.languageOptions[i]}.json`)]);
225
- if (oldKeyResp.ok && !localStorage.getItem('local')) {
226
- this.originalDict[this.languageOptions[i]] = yield oldKeyResp.json();
227
- }
228
- if (resp.ok) {
229
- this.originalDict[this.languageOptions[i]] = Object.assign(Object.assign({}, this.originalDict[this.languageOptions[i]]), yield resp.json());
230
- }
231
- }
232
- return true;
233
- });
234
- }
235
- extendSource(path, lang) {
236
- return __awaiter(this, void 0, void 0, function* () {
237
- const resp = yield fetch(`${path}`);
238
- if (resp.ok) {
239
- this.customDict[lang] = yield resp.json();
240
- }
241
- return true;
242
- });
243
- }
244
- setLang(lang) {
245
- return __awaiter(this, void 0, void 0, function* () {
246
- this.currentLang = lang;
247
- });
248
- }
249
- translate(key, args = {}) {
250
- var _a, _b, _c, _d;
251
- let str = (_d = (_b = (_a = this.customDict[this.currentLang]) === null || _a === void 0 ? void 0 : _a[key]) !== null && _b !== void 0 ? _b : (_c = this.originalDict[this.currentLang]) === null || _c === void 0 ? void 0 : _c[key]) !== null && _d !== void 0 ? _d : key;
252
- if (!str) {
253
- return '';
254
- }
255
- if (Object.keys(args).length > 0) {
256
- Object.keys(args).forEach(key => {
257
- str = str.replace(new RegExp(`{{${key}}}`, 'g'), args[key].toString());
258
- });
259
- }
260
- return str.replace(/\n$/, '').replace(/\n/g, '<br>');
261
- }
262
- getCurrentLang() {
263
- return this.currentLang;
264
- }
265
- }
266
- TranslateService.instance = null;
267
- function getTranslateInstance() {
268
- if (!TranslateService.instance) {
269
- TranslateService.instance = new TranslateService();
270
- }
271
- return TranslateService.instance;
272
- }
273
-
274
- class MockApiService {
275
- constructor() {
276
- this.data = [];
277
- }
278
- postStatus(status) {
279
- return __awaiter(this, void 0, void 0, function* () {
280
- this.data.push(status);
281
- return Promise.resolve(status);
282
- });
283
- }
284
- postMutiStatus(status) {
285
- return __awaiter(this, void 0, void 0, function* () {
286
- this.data.push(...status);
287
- return Promise.resolve(status);
288
- });
289
- }
290
- getStatus() {
291
- return __awaiter(this, void 0, void 0, function* () {
292
- return Promise.resolve(this.data);
293
- });
294
- }
295
- }
296
-
297
- function sendEventLogging(events, pingMethod) {
298
- var _a;
299
- return __awaiter(this, void 0, void 0, function* () {
300
- if (util.Storage.getItem(util.STORAGE_KEY.ENABLE_EVENT_TRACKING) === false) {
301
- return;
302
- }
303
- const logs = events.filter(event => event.customerId !== '').map(event => {
304
- return {
305
- message: event,
306
- createTime: event.userTime
307
- };
308
- });
309
- const pingEvent = yield pingMethod();
310
- const newLog = [{
311
- message: pingEvent,
312
- createTime: pingEvent.userTime
313
- }, ...logs];
314
- return sendRequest('/api/event-logging/v1/log/ekyc-sdk', 'POST', {
315
- body: JSON.stringify({
316
- logs: newLog
317
- }),
318
- baseUrl: (_a = util.Storage.getItem(util.STORAGE_KEY.EVENT_TRACK_URL)) !== null && _a !== void 0 ? _a : util.Storage.getItem(util.STORAGE_KEY.API_BASE_URL)
319
- });
320
- });
321
- }
322
-
323
- const initialStatus = {
324
- eventId: '',
325
- sessionId: '',
326
- eventType: '',
327
- userTime: new Date().toISOString(),
328
- tenantId: '',
329
- customerId: '',
330
- duration: 0,
331
- deviceInfo: '',
332
- systemInfo: '',
333
- version: '1.0.0',
334
- language: '',
335
- description: 'description',
336
- platform: 'Web',
337
- extraInfo: 'extra info'
338
- };
339
- const BUFFER_TINTERVAL = 3000;
340
- class EventListenerService {
341
- constructor(getStatusProcess, options) {
342
- var _a;
343
- this.getStatusProcess = getStatusProcess;
344
- this.apiService = new MockApiService();
345
- this.pingInterval = (_a = options === null || options === void 0 ? void 0 : options.pingInterval) !== null && _a !== void 0 ? _a : BUFFER_TINTERVAL;
346
- this.statusSubject = new rxjs.BehaviorSubject(initialStatus);
347
- }
348
- start() {
349
- this.statusSubject = new rxjs.BehaviorSubject(initialStatus);
350
- this.statusSubject.pipe(operators.bufferTime(this.pingInterval), operators.filter(() => util.Storage.getItem(util.STORAGE_KEY.ENABLE_EVENT_TRACKING) === true), operators.mergeMap(events => {
351
- sendEventLogging(events, this.getStatusProcess);
352
- return events;
353
- })).subscribe();
354
- }
355
- stop() {
356
- if (this.pingSubscription) {
357
- this.pingSubscription.unsubscribe();
358
- this.pingSubscription = undefined;
359
- }
360
- this.statusSubject.complete();
361
- }
362
- sendUserActionStatus(status) {
363
- this.statusSubject.next(status);
364
- return this.sendStatus(status);
365
- }
366
- sendStatus(status) {
367
- return this.apiService.postStatus(status);
368
- }
369
- getStatusObservable() {
370
- return this.statusSubject;
371
- }
372
- }
373
-
374
- exports.Feature = void 0;
375
- (function (Feature) {
376
- Feature["OCRFraud"] = "OCRFraud";
377
- Feature["OCR"] = "OCR";
378
- Feature["SelectCardTypeAndCountry"] = "SelectCardTypeAndCountry";
379
- Feature["LivenessActive"] = "LivenessActive";
380
- Feature["LivenessPassive"] = "LivenessPassive";
381
- })(exports.Feature || (exports.Feature = {}));
382
- exports.StatusEvent = void 0;
383
- (function (StatusEvent) {
384
- StatusEvent["TWID"] = "TWID";
385
- StatusEvent["TWIDFraud"] = "TWIDFraud";
386
- StatusEvent["TWIDFront"] = "TWIDFront";
387
- StatusEvent["TWDriverLicenseFront"] = "TWDriverLicenseFront";
388
- StatusEvent["Passport"] = "Passport";
389
- StatusEvent["ResidencePermitFront"] = "ResidencePermitFront";
390
- StatusEvent["ResidencePermitBack"] = "ResidencePermitBack";
391
- StatusEvent["TWIDBack"] = "TWIDBack";
392
- StatusEvent["TWDriverLicenseBack"] = "TWDriverLicenseBack";
393
- StatusEvent["TWHealthCardFront"] = "TWHealthCardFront";
394
- StatusEvent["TWDriverLicense"] = "TWDriverLicense";
395
- StatusEvent["TWHealthCard"] = "TWHealthCard";
396
- StatusEvent["ResidencePermit"] = "ResidencePermit";
397
- StatusEvent["PassportFront"] = "PassportFront";
398
- StatusEvent["OpenMouth"] = "OpenMouth";
399
- StatusEvent["CloseMouth"] = "CloseMouth";
400
- StatusEvent["Smile"] = "Smile";
401
- StatusEvent["Scale"] = "Scale";
402
- StatusEvent["Done"] = "Done";
403
- StatusEvent["Passive"] = "Passive";
404
- StatusEvent["SelectCardTypeAndCountry"] = "SelectCardTypeAndCountry";
405
- StatusEvent["CardThicknessFailed"] = "CardThicknessFailed";
406
- })(exports.StatusEvent || (exports.StatusEvent = {}));
407
- exports.StatusView = void 0;
408
- (function (StatusView) {
409
- StatusView["Info"] = "Info";
410
- StatusView["Init"] = "Init";
411
- StatusView["Aligning"] = "Aligning";
412
- StatusView["Start"] = "Start";
413
- StatusView["Up"] = "Up";
414
- StatusView["Down"] = "Down";
415
- StatusView["Left"] = "Left";
416
- StatusView["Right"] = "Right";
417
- StatusView["Running"] = "Running";
418
- StatusView["Confirm"] = "Confirm";
419
- StatusView["Uploading"] = "Uploading";
420
- StatusView["Select"] = "Select";
421
- })(exports.StatusView || (exports.StatusView = {}));
422
- exports.StatusAction = void 0;
423
- (function (StatusAction) {
424
- StatusAction["Uploading"] = "Uploading";
425
- StatusAction["Show"] = "Show";
426
- StatusAction["BtnClose"] = "BtnClose";
427
- StatusAction["BtnStart"] = "BtnStart";
428
- StatusAction["InitError"] = "InitError";
429
- StatusAction["Start"] = "Start";
430
- StatusAction["Confirm"] = "Confirm";
431
- StatusAction["Retry"] = "Retry";
432
- })(exports.StatusAction || (exports.StatusAction = {}));
433
- exports.StatusDescription = void 0;
434
- (function (StatusDescription) {
435
- StatusDescription["NoCard"] = "NoCard";
436
- StatusDescription["WrongCardType"] = "WrongCardType";
437
- StatusDescription["PositionNotMatch"] = "PositionNotMatch";
438
- StatusDescription["Reflective"] = "Reflective";
439
- StatusDescription["Blur"] = "Blur";
440
- StatusDescription["Motion"] = "Motion";
441
- StatusDescription["Pass"] = "Pass";
442
- StatusDescription["Error"] = "Error";
443
- StatusDescription["Failed"] = "Failed";
444
- StatusDescription["Timeout"] = "Timeout";
445
- StatusDescription["Gray"] = "Gray";
446
- StatusDescription["NeedMoreFrame"] = "NeedMoreFrame";
447
- StatusDescription["NotAligned"] = "NotAligned";
448
- StatusDescription["NoFace"] = "NoFace";
449
- StatusDescription["FaceNotAtCenter"] = "FaceNotAtCenter";
450
- StatusDescription["FaceTooSmall"] = "FaceTooSmall";
451
- StatusDescription["FaceTooLarge"] = "FaceTooLarge";
452
- StatusDescription["NeedFaceToCamera"] = "NeedFaceToCamera";
453
- StatusDescription["FaceMasked"] = "FaceMasked";
454
- StatusDescription["NeedOpenMouth"] = "NeedOpenMouth";
455
- StatusDescription["NeedCloseMouth"] = "NeedCloseMouth";
456
- StatusDescription["NeedSmile"] = "NeedSmile";
457
- StatusDescription["NeedOpenEyes"] = "NeedOpenEyes";
458
- StatusDescription["UploadingStart"] = "UploadingStart";
459
- StatusDescription["UploadingEnd"] = "UploadingEnd";
460
- StatusDescription["Complete"] = "Complete";
461
- StatusDescription["CardThicknessFailed"] = "CardThicknessFailed";
462
- })(exports.StatusDescription || (exports.StatusDescription = {}));
463
-
464
- class TrackingEvent {
465
- constructor(params) {
466
- this._feature = params.feature;
467
- this._event = params.event;
468
- this._view = params.view;
469
- this._action = params.action;
470
- this._description = params.description;
471
- }
472
- nonNull(data) {
473
- return data !== null && data !== undefined;
474
- }
475
- get feature() {
476
- return this._feature;
477
- }
478
- set feature(value) {
479
- if (value && !(value in exports.Feature)) {
480
- throw new Error('Invalid feature');
481
- }
482
- this._feature = value;
483
- }
484
- get event() {
485
- return this._event;
486
- }
487
- set event(value) {
488
- if (value && !(value in exports.StatusEvent)) {
489
- throw new Error('Invalid event');
490
- }
491
- this._event = value;
492
- }
493
- get view() {
494
- return this._view;
495
- }
496
- set view(value) {
497
- if (value && !(value in exports.StatusView)) {
498
- throw new Error('Invalid view');
499
- }
500
- this._view = value;
501
- }
502
- get action() {
503
- return this._action;
504
- }
505
- set action(value) {
506
- if (value && !(value in exports.StatusAction)) {
507
- throw new Error('Invalid action');
508
- }
509
- this._action = value;
510
- }
511
- get description() {
512
- return this._description;
513
- }
514
- set description(value) {
515
- if (value && !(value in exports.StatusDescription)) {
516
- throw new Error('Invalid description');
517
- }
518
- this._description = value;
519
- }
520
- toString() {
521
- let result = '';
522
- if (this.nonNull(this._feature)) {
523
- result += `${this._feature}:`;
524
- }
525
- if (this.nonNull(this._event)) {
526
- result += `${this._event}:`;
527
- }
528
- if (this.nonNull(this._view)) {
529
- result += `${this._view}:`;
530
- }
531
- if (this.nonNull(this._action)) {
532
- result += `${this._action}:`;
533
- }
534
- if (this.nonNull(this._description)) {
535
- result += `${this._description}`;
536
- }
537
- if (result.endsWith(':')) {
538
- result = result.slice(0, -1); // 刪除最後一個字符
539
- }
540
-
541
- return result;
542
- }
543
- }
544
-
545
- const tokenSubject = new rxjs.BehaviorSubject('');
546
- tokenSubject.pipe(rxjs.tap(token => {
547
- if (!token) return;
548
- const _jwt = util.decodeToken(token);
549
- setAuthmeJWT(_jwt.payload);
550
- })).subscribe();
551
- const defaultEventName = new TrackingEvent({});
552
- const [getAuthmeJWT, setAuthmeJWT] = util.useState();
553
- const [getAccessToken, setAccessToken] = util.useState('', tokenSubject);
554
- const [getSessionId, setSessionId] = util.useState('');
555
- function generateStatus(params = {}) {
556
- const _authmeJWT = getAuthmeJWT();
557
- const {
558
- eventType = defaultEventName,
559
- sessionId = getSessionId(),
560
- userTime = new Date().toISOString(),
561
- tenantId = _authmeJWT.client_tenant,
562
- customerId = _authmeJWT.client_id,
563
- duration = 0,
564
- deviceInfo = util.getDeviceInfo(),
565
- systemInfo = util.getSystemInfo(),
566
- version: version$1 = version,
567
- language = '',
568
- description = '',
569
- platform = 'web',
570
- extraInfo = ''
571
- } = params;
572
- return {
573
- eventId: uuid.v4(),
574
- eventType: eventType.toString(),
575
- sessionId,
576
- userTime,
577
- tenantId,
578
- customerId,
579
- duration,
580
- deviceInfo,
581
- systemInfo,
582
- version: version$1,
583
- language,
584
- description,
585
- platform,
586
- extraInfo
587
- };
588
- }
589
-
590
- function getCustomerState() {
591
- return sendRequest(`/api/identity-verification/v1/verification/state`, 'GET').then(res => {
592
- return {
593
- state: res.state,
594
- createTime: res.createTime,
595
- code: res.code,
596
- customDetails: res.customDetails || null,
597
- message: util.verificationErrorMessages(res.code)
598
- };
599
- }).catch(error => {
600
- // if (error instanceof AuthmeError) {
601
- // return {
602
- // code: error.code,
603
- // message: error.message,
604
- // };
605
- // }
606
- throw error;
607
- });
608
- }
609
-
610
- Object.defineProperty(exports, 'AuthmeError', {
611
- enumerable: true,
612
- get: function () { return util.AuthmeError; }
613
- });
614
- Object.defineProperty(exports, 'ErrorCode', {
615
- enumerable: true,
616
- get: function () { return util.ErrorCode; }
617
- });
618
- exports.EventListenerService = EventListenerService;
619
- exports.TrackingEvent = TrackingEvent;
620
- exports.core = core;
621
- exports.generateStatus = generateStatus;
622
- exports.getAccessToken = getAccessToken;
623
- exports.getCustomerState = getCustomerState;
624
- exports.getSessionId = getSessionId;
625
- exports.getTranslateInstance = getTranslateInstance;
626
- exports.sendRequest = sendRequest;
627
- exports.setAccessToken = setAccessToken;
628
- exports.setRequestLoggingFunc = setRequestLoggingFunc;
629
- exports.setSessionId = setSessionId;
630
- exports.version = version;