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