@authme/identity-verification 2.8.45 → 2.8.47

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.esm.js CHANGED
@@ -1,32 +1,34 @@
1
1
  import 'core-js/modules/es.error.cause.js';
2
2
  import 'core-js/modules/es.array.includes.js';
3
3
  import 'core-js/modules/es.array.iterator.js';
4
+ import 'core-js/modules/es.iterator.constructor.js';
5
+ import 'core-js/modules/es.iterator.map.js';
4
6
  import 'core-js/modules/es.object.assign.js';
5
7
  import 'core-js/modules/es.promise.js';
6
- import 'core-js/modules/esnext.iterator.constructor.js';
7
- import 'core-js/modules/esnext.iterator.map.js';
8
8
  import 'core-js/modules/web.dom-collections.iterator.js';
9
9
  import { getTranslateInstance, TrackingEvent, generateStatus, EventListenerService, StatusDescription, AuthmeError, ErrorCode, Feature, StatusEvent, StatusView, StatusAction, setRequestLoggingFunc, setAccessToken, getCustomerState } from '@authme/core';
10
10
  import { EAuthMeFASServiceStatus, EAuthMeIDCardAntiFraudStage as EAuthMeIDCardAntiFraudStage$1, EAuthMeCardClass as EAuthMeCardClass$1, AuthmeFunctionModule, MlEngine, EngineModule, EAuthMeEngineReturnCode, AuthmeEngineModuleBase } from '@authme/engine';
11
11
  import { CountryCode, IdRecognitionCardType, EAuthMeCardClass, EAuthMeIDCardAntiFraudStatus, thicknessDefaultConfig, EAuthMeIDCardAntiFraudStage, mapCardtypeToAuthmeClass, getRecognitionColumnOrder, cardTypeTitle, cardTypeConfirmTitle, cardTypeHeader, EAuthMeCardOCRStatus, EAuthMeMRZServiceStatus, saveExtraDoc, initScanDocumentResourceBase64, MRZService, ResourceImageType, uploadFrameBase64, finishScanDocument, initScanDocument, initScan, option, themeUI, CardOCR, IdCardAntiFraudService, twoWayAuthmeCardClassMap, RecognitionFileType, recognizeBase64, getCardSubTypes, getCardTypes, confirmScan } from '@authme/id-recognition';
12
- import { getCssVariable, RGBToLottieColor, colorToRGB, Storage, useState, uiThemeText, uiThemeHint, clearCanvas, getImageData, hidePopup, showPopup, waitTime, TIME_UNIT, AuthmeError as AuthmeError$1, ErrorCode as ErrorCode$1, isMobile, uiThemeButton, requestCamera, showElement, asyncOnLineShowErrorMessage, getCanvasSize, startSpinner, stopSpinner, themeConfigDefault, uiThemeDirection, fontWeight, hideElement, checkOnlineStatus, showErrorMessage, dataURItoBlob, uiThemeSmallButton, dropMenu, hideErrorMessage, UintArrayToBlob, isIphone14proOrProMax, cropByRatio, switchCamera, asyncShowPopup, retryPromiseWithCondition, asyncShowErrorMessage, uploadModal, backgroundRequest, debugTools, STORAGE_KEY, splitResult, RUN_FUNCTION_NAME, DEVICE_TYPE, combineResult, startLoadingSDK, stopLoadingSDK } from '@authme/util';
12
+ import { getCssVariable, RGBToLottieColor, colorToRGB, Storage, useState, uiThemeText, uiThemeHint, clearCanvas, getImageData, hidePopup, showPopup, waitTime, TIME_UNIT, AuthmeError as AuthmeError$1, ErrorCode as ErrorCode$1, isMobile, uiThemeButton, requestCamera, showElement, asyncOnLineShowErrorMessage, getCanvasSize, startSpinner, stopSpinner, themeConfigDefault, mergeThemeConfig, uiThemeDirection, fontWeight, hideElement, checkOnlineStatus, showErrorMessage, dataURItoBlob, uiThemeSmallButton, dropMenu, hideErrorMessage, UintArrayToBlob, isIphone14proOrProMax, cropByRatio, switchCamera, asyncShowPopup, retryPromiseWithCondition, asyncShowErrorMessage, uploadModal, backgroundRequest, debugTools, STORAGE_KEY, splitResult, RUN_FUNCTION_NAME, DEVICE_TYPE, combineResult, startLoadingSDK, stopLoadingSDK } from '@authme/util';
13
13
  import 'core-js/modules/es.array.push.js';
14
14
  import { mergeMap, animationFrames, filter, tap, map, from, catchError, EMPTY, concatAll, takeUntil, of, merge, fromEvent, Subject, defer, throttleTime, switchMap, take, concatMap, throwError, finalize, Observable, interval, mapTo, firstValueFrom, shareReplay, switchMapTo, takeWhile as takeWhile$1, timer, race } from 'rxjs';
15
+ import 'core-js/modules/es.iterator.for-each.js';
15
16
  import 'core-js/modules/es.regexp.to-string.js';
16
- import 'core-js/modules/esnext.iterator.for-each.js';
17
17
  import { FasRecognitionResult, EAuthMeFASServiceStage, FasService, EAuthMeMouthStatus, LivenessAPI, LivenessResultStatus } from '@authme/liveness';
18
18
  import 'core-js/modules/es.number.to-fixed.js';
19
19
  import 'core-js/modules/es.parse-float.js';
20
20
  import 'core-js/modules/es.symbol.description.js';
21
+ import 'core-js/modules/es.map.get-or-insert.js';
22
+ import 'core-js/modules/es.map.get-or-insert-computed.js';
21
23
  import 'core-js/modules/es.string.includes.js';
22
24
  import lottie from 'lottie-web';
23
25
  import 'core-js/modules/es.array.reduce.js';
24
26
  import 'core-js/modules/es.array.sort.js';
27
+ import 'core-js/modules/es.iterator.filter.js';
28
+ import 'core-js/modules/es.iterator.reduce.js';
25
29
  import 'core-js/modules/es.parse-int.js';
26
30
  import 'core-js/modules/es.regexp.exec.js';
27
31
  import 'core-js/modules/es.string.replace.js';
28
- import 'core-js/modules/esnext.iterator.filter.js';
29
- import 'core-js/modules/esnext.iterator.reduce.js';
30
32
  import 'core-js/modules/es.object.from-entries.js';
31
33
  import { takeWhile, finalize as finalize$1 } from 'rxjs/operators';
32
34
  import 'core-js/modules/es.array-buffer.constructor.js';
@@ -45,6 +47,8 @@ import 'core-js/modules/es.typed-array.to-locale-string.js';
45
47
  import 'core-js/modules/es.typed-array.to-reversed.js';
46
48
  import 'core-js/modules/es.typed-array.to-sorted.js';
47
49
  import 'core-js/modules/es.typed-array.with.js';
50
+ import 'core-js/modules/es.iterator.every.js';
51
+ import 'core-js/modules/es.iterator.find.js';
48
52
  import 'core-js/modules/es.regexp.constructor.js';
49
53
  import 'core-js/modules/es.regexp.dot-all.js';
50
54
  import 'core-js/modules/es.regexp.test.js';
@@ -52,18 +56,18 @@ import 'core-js/modules/es.string.match.js';
52
56
  import 'core-js/modules/es.string.pad-start.js';
53
57
  import 'core-js/modules/es.string.starts-with.js';
54
58
  import 'core-js/modules/es.string.trim.js';
55
- import 'core-js/modules/esnext.iterator.every.js';
56
- import 'core-js/modules/esnext.iterator.find.js';
57
59
  import 'core-js/modules/es.json.stringify.js';
58
60
  import 'core-js/modules/web.atob.js';
59
61
  import 'core-js/modules/web.dom-exception.constructor.js';
60
62
  import 'core-js/modules/web.dom-exception.stack.js';
61
63
  import 'core-js/modules/web.dom-exception.to-string-tag.js';
64
+ import 'core-js/modules/es.json.parse.js';
62
65
  import 'core-js/modules/es.typed-array.uint8-array.js';
63
- import 'core-js/modules/esnext.json.parse.js';
64
- import 'core-js/modules/esnext.uint8-array.to-base64.js';
65
- import 'core-js/modules/esnext.uint8-array.to-hex.js';
66
- import 'core-js/modules/esnext.iterator.some.js';
66
+ import 'core-js/modules/es.uint8-array.set-from-base64.js';
67
+ import 'core-js/modules/es.uint8-array.set-from-hex.js';
68
+ import 'core-js/modules/es.uint8-array.to-base64.js';
69
+ import 'core-js/modules/es.uint8-array.to-hex.js';
70
+ import 'core-js/modules/es.iterator.some.js';
67
71
 
68
72
  function _objectWithoutPropertiesLoose(r, e) {
69
73
  if (null == r) return {};
@@ -29423,7 +29427,7 @@ async function startLiveness(config) {
29423
29427
  // const themeConfigApi = {};
29424
29428
  // console.log('themeConfigApi', themeConfigApi);
29425
29429
  // console.log('themeConfigDefault', themeConfigDefault);
29426
- uiThemeConfig = Object.assign(themeConfigDefault, themeConfigApi);
29430
+ uiThemeConfig = mergeThemeConfig(themeConfigApi);
29427
29431
  Storage.setItem('themeConfig', uiThemeConfig);
29428
29432
  uiComponentBasic = renderBasicUI({
29429
29433
  headerIcon: config.livenessConfig.icon,
@@ -32542,10 +32546,7 @@ async function startOCR(config) {
32542
32546
  uiComponentBasic.video.classList.add(cameraResult.facingMode);
32543
32547
  facingMode = cameraResult.facingMode;
32544
32548
  deviceMetas = cameraResult.deviceMetas;
32545
- }), switchMap(() => getCanvasSize(uiComponentBasic.video)), shareReplay(1))
32546
- // 由於目前不支持切換螢幕大小,所以不需要監聽 resize
32547
- // fromEvent(window, 'resize').pipe(switchMapTo(getCanvasSize(video)))
32548
- );
32549
+ }), switchMap(() => getCanvasSize(uiComponentBasic.video)), shareReplay(1)));
32549
32550
  const currentType = (() => {
32550
32551
  const data = {};
32551
32552
  return (method, obj) => {
@@ -33228,13 +33229,7 @@ async function startOCR(config) {
33228
33229
  console.error('unknow flow');
33229
33230
  return of(false);
33230
33231
  }
33231
- })
33232
- // tap(() => {
33233
- // setStatusEvent(cardClassMapping(type));
33234
- // setUIByType(type, cardType);
33235
- // }),
33236
- // switchMap(() => startOCR(type, cardType)),
33237
- );
33232
+ }));
33238
33233
  }
33239
33234
  async function initOptions() {
33240
33235
  // get config from api
@@ -33243,7 +33238,7 @@ async function startOCR(config) {
33243
33238
  // const themeConfigApi = {};
33244
33239
  // console.log('themeConfigApi', themeConfigApi);
33245
33240
  // console.log('themeConfigDefault', themeConfigDefault);
33246
- uiThemeConfig = Object.assign(themeConfigDefault, themeConfigApi);
33241
+ uiThemeConfig = mergeThemeConfig(themeConfigApi);
33247
33242
  Storage.setItem('themeConfig', uiThemeConfig);
33248
33243
  // init UI component
33249
33244
  isTutorialFinish = !uiThemeConfig.isFraudAnimationLoadingPageEnabled;
@@ -33295,8 +33290,7 @@ async function startOCR(config) {
33295
33290
  }), switchMap(canvasSizeInfo => from(config.init(canvasSizeInfo.canvasWidth, canvasSizeInfo.canvasHeight)).pipe(tap(x => ocrEngineConfig = x), tap(async () => {
33296
33291
  stopSpinner();
33297
33292
  if (config.ocrConfig.needAntiFraud) return;
33298
- }), tap(() => eventListenerService$1.start()) // TODO check useless
33299
- )))).pipe(tap(() => {
33293
+ }), tap(() => eventListenerService$1.start()))))).pipe(tap(() => {
33300
33294
  sendStatusAction$1(StatusAction.Uploading);
33301
33295
  hideElement(uiComponentBasic.videoContainer);
33302
33296
  startSpinner({
@@ -33416,8 +33410,7 @@ async function startOCR(config) {
33416
33410
  }));
33417
33411
  const detectScreenResizeError$ = handleScreenResizeError$(detectScreenResize$(), unsubscribe$,
33418
33412
  // () => !flags.onConfirm
33419
- () => !flags.onConfirm && !flags.resultModalActive // Add check for resultModalActive
33420
- );
33413
+ () => !flags.onConfirm && !flags.resultModalActive);
33421
33414
  return merge(flow$, cancel$, detectScreenResizeError$, timeout$).pipe(take(1));
33422
33415
  }
33423
33416
  fromEvent(window, 'offline').pipe(switchMap(() => asyncOnLineShowErrorMessage(translateService.translate('sdk.general.error.alert.offline'), translateService.translate('sdk.general.error.retry'), false)), takeUntil(unsubscribe$)).subscribe();
@@ -34081,7 +34074,7 @@ function startExtra(config) {
34081
34074
  // const themeConfigApi = await config.getOptionConfig();
34082
34075
  // TODO comment out
34083
34076
  const themeConfigApi = {};
34084
- uiThemeConfig = Object.assign(themeConfigDefault, themeConfigApi);
34077
+ uiThemeConfig = mergeThemeConfig(themeConfigApi);
34085
34078
  Storage.setItem('themeConfig', uiThemeConfig);
34086
34079
  // init UI component
34087
34080
  uiComponentBasic = renderBasicUI({
@@ -34724,7 +34717,7 @@ class LivenessModule {
34724
34717
  uploadTarget = [...resultList.map((x, index) => ({
34725
34718
  index,
34726
34719
  result: x
34727
- })).filter(x => x.result.iIsKeyFrame === 1 || options.uploadFullFrame).map(x => ({
34720
+ })).filter(x => !!x.result.iIsKeyFrame || options.uploadFullFrame).map(x => ({
34728
34721
  index: x.index,
34729
34722
  data: frameList[x.index]
34730
34723
  }))];
@@ -35030,8 +35023,7 @@ class MRZModule {
35030
35023
  let shouldEncrypt = false;
35031
35024
  const encryptImageBase64 = async function encryptImageBase64(blob) {
35032
35025
  const imageArrayBuffer = await blobToArrayBuffer(blob);
35033
- const uint8Array = new Uint8Array(imageArrayBuffer);
35034
- const resultEncrypt = await _this.mrzService.encryptBlob(uint8Array, pubKey);
35026
+ const resultEncrypt = await _this.mrzService.encryptBlob(imageArrayBuffer, pubKey);
35035
35027
  return resultEncrypt;
35036
35028
  };
35037
35029
  const blobToArrayBuffer = async function blobToArrayBuffer(blob) {
@@ -35210,13 +35202,7 @@ class MRZModule {
35210
35202
  } else {
35211
35203
  return uploadFrameBase64(postData);
35212
35204
  }
35213
- }
35214
- // uploadFrameBase64(
35215
- // docInfos[EAuthMeCardClass.Passport].docId,
35216
- // requestImg,
35217
- // frameIndex++
35218
- // )
35219
- );
35205
+ });
35220
35206
  }
35221
35207
  const tField = latestTField;
35222
35208
  if (!tField) {
@@ -35252,15 +35238,7 @@ class MRZModule {
35252
35238
  } else {
35253
35239
  return uploadFrameBase64(postData);
35254
35240
  }
35255
- }
35256
- // uploadFrameBase64(
35257
- // docId,
35258
- // requestImg,
35259
- // frameIndex++,
35260
- // ResourceImageType.Recognition,
35261
- // report
35262
- // )
35263
- );
35241
+ });
35264
35242
  await SendRequestWithRetry$1(async function () {
35265
35243
  const postData = {
35266
35244
  scanDocumentId: docId,
@@ -35275,13 +35253,7 @@ class MRZModule {
35275
35253
  } else {
35276
35254
  return finishScanDocument(postData);
35277
35255
  }
35278
- }
35279
- // finishScanDocument(
35280
- // docId,
35281
- // latestTField ?? {},
35282
- // docInfos[option.type].fraudResult
35283
- // )
35284
- );
35256
+ });
35285
35257
  return true;
35286
35258
  } else {
35287
35259
  return false;
@@ -35686,8 +35658,7 @@ class OCRModule {
35686
35658
  const docInfos = {};
35687
35659
  const encryptImageBase64 = async function encryptImageBase64(blob) {
35688
35660
  const imageArrayBuffer = await blobToArrayBuffer(blob);
35689
- const uint8Array = new Uint8Array(imageArrayBuffer);
35690
- const resultEncrypt = await _this.ocrService.encryptBlob(uint8Array, pubKey);
35661
+ const resultEncrypt = await _this.ocrService.encryptBlob(imageArrayBuffer, pubKey);
35691
35662
  return resultEncrypt;
35692
35663
  };
35693
35664
  const blobToArrayBuffer = async function blobToArrayBuffer(blob) {
@@ -36300,15 +36271,7 @@ class OCRModule {
36300
36271
  } else {
36301
36272
  return uploadFrameBase64(postData);
36302
36273
  }
36303
- }
36304
- // uploadFrameBase64(
36305
- // docId,
36306
- // requestImg,
36307
- // frameIndex,
36308
- // ResourceImageType.Attach,
36309
- // undefined
36310
- // )
36311
- );
36274
+ });
36312
36275
  await SendRequestWithRetry(async function () {
36313
36276
  const postData = {
36314
36277
  scanDocumentId: docId,
@@ -36323,9 +36286,7 @@ class OCRModule {
36323
36286
  } else {
36324
36287
  return finishScanDocument(postData);
36325
36288
  }
36326
- }
36327
- // finishScanDocument(docId, {}, null)
36328
- );
36289
+ });
36329
36290
  return true;
36330
36291
  } catch (error) {
36331
36292
  console.error('confirmThickness:', error);
@@ -36416,13 +36377,7 @@ class OCRModule {
36416
36377
  } else {
36417
36378
  return uploadFrameBase64(postData);
36418
36379
  }
36419
- }
36420
- // uploadFrameBase64(
36421
- // docInfos[cardType ?? ''].docId,
36422
- // requestImg,
36423
- // frameIndex
36424
- // )
36425
- );
36380
+ });
36426
36381
  pushNewDebugImage(ocrOriginImg, {
36427
36382
  result: result,
36428
36383
  status: 'recognition',
@@ -36493,15 +36448,7 @@ class OCRModule {
36493
36448
  } else {
36494
36449
  return uploadFrameBase64(postData);
36495
36450
  }
36496
- }
36497
- // uploadFrameBase64(
36498
- // docId,
36499
- // requestImg,
36500
- // frameIndex,
36501
- // ResourceImageType.Recognition,
36502
- // report
36503
- // )
36504
- );
36451
+ });
36505
36452
  frameIndex = 0;
36506
36453
  try {
36507
36454
  const _requestImg = await encryptImageBase64(ocrImg);
@@ -36570,13 +36517,7 @@ class OCRModule {
36570
36517
  } else {
36571
36518
  return finishScanDocument(postData);
36572
36519
  }
36573
- }
36574
- // finishScanDocument(
36575
- // docId,
36576
- // resp.details,
36577
- // needFraudOption ? this.fraudResult : null
36578
- // )
36579
- );
36520
+ });
36580
36521
  // upload finish view
36581
36522
  const successView = uploadModal({
36582
36523
  type: 'success',
@@ -36645,15 +36586,7 @@ class OCRModule {
36645
36586
  } else {
36646
36587
  return uploadFrameBase64(postData);
36647
36588
  }
36648
- }
36649
- // uploadFrameBase64(
36650
- // docId,
36651
- // requestImg,
36652
- // frameIndex,
36653
- // ResourceImageType.Recognition,
36654
- // report
36655
- // )
36656
- );
36589
+ });
36657
36590
  frameIndex = 0;
36658
36591
  return true;
36659
36592
  } else {
@@ -36829,15 +36762,7 @@ class OCRModule {
36829
36762
  } else {
36830
36763
  return uploadFrameBase64(postData);
36831
36764
  }
36832
- }
36833
- // uploadFrameBase64(
36834
- // docId,
36835
- // requestImg,
36836
- // frameIndex,
36837
- // ResourceImageType.Fraud,
36838
- // report
36839
- // )
36840
- );
36765
+ });
36841
36766
  frameIndex = 0;
36842
36767
  await _this.antiFraudInstance.destroy();
36843
36768
  } else if (uploadFullFrame) {
@@ -36870,14 +36795,7 @@ class OCRModule {
36870
36795
  } else {
36871
36796
  return uploadFrameBase64(postData);
36872
36797
  }
36873
- }
36874
- // uploadFrameBase64(
36875
- // docId,
36876
- // requestImg,
36877
- // frameIndex,
36878
- // ResourceImageType.Fraud
36879
- // )
36880
- );
36798
+ });
36881
36799
  }
36882
36800
  return antiFraudRecogitionResult;
36883
36801
  },
@@ -37424,7 +37342,7 @@ class AuthmeIdentityVerification extends AuthmeFunctionModule {
37424
37342
  }
37425
37343
 
37426
37344
  var name = "authme/sdk";
37427
- var version$1 = "2.8.45";
37345
+ var version$1 = "2.8.47";
37428
37346
  var packageInfo = {
37429
37347
  name: name,
37430
37348
  version: version$1};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@authme/identity-verification",
3
- "version": "2.8.45",
3
+ "version": "2.8.47",
4
4
  "peerDependencies": {
5
5
  "core-js": "^3.6.0",
6
6
  "lottie-web": "^5.9.2",
@@ -8,5 +8,5 @@
8
8
  },
9
9
  "module": "./index.esm.js",
10
10
  "main": "./index.cjs.js",
11
- "types": "./index.esm.d.ts"
11
+ "types": "./index.d.ts"
12
12
  }
@@ -1,5 +1,5 @@
1
- export declare const eventListenerService: import("dist/libs/core/src").EventListenerService;
2
- export declare const sendStatusAction: (statusAction: import("dist/libs/core/src").StatusAction) => Promise<void>, sendStatusDescription: (statusDescription: import("dist/libs/core/src").StatusDescription) => Promise<void>, featureUseState: [() => import("dist/libs/core/src").Feature, (value: import("dist/libs/core/src").Feature) => void], eventUseState: [() => import("dist/libs/core/src").StatusEvent, (value: import("dist/libs/core/src").StatusEvent) => void], viewUseState: [() => import("dist/libs/core/src").StatusView, (value: import("dist/libs/core/src").StatusView) => void];
3
- export declare const setFeature: (value: import("dist/libs/core/src").Feature) => void;
4
- export declare const setStatusEvent: (value: import("dist/libs/core/src").StatusEvent) => void;
5
- export declare const setStatusView: (value: import("dist/libs/core/src").StatusView) => void;
1
+ export declare const eventListenerService: import("@authme/core").EventListenerService;
2
+ export declare const sendStatusAction: (statusAction: import("@authme/core").StatusAction) => Promise<void>, sendStatusDescription: (statusDescription: import("@authme/core").StatusDescription) => Promise<void>, featureUseState: [() => import("@authme/core").Feature, (value: import("@authme/core").Feature) => void], eventUseState: [() => import("@authme/core").StatusEvent, (value: import("@authme/core").StatusEvent) => void], viewUseState: [() => import("@authme/core").StatusView, (value: import("@authme/core").StatusView) => void];
3
+ export declare const setFeature: (value: import("@authme/core").Feature) => void;
4
+ export declare const setStatusEvent: (value: import("@authme/core").StatusEvent) => void;
5
+ export declare const setStatusView: (value: import("@authme/core").StatusView) => void;
@@ -17,4 +17,4 @@ export declare const setStatusTextTop: (params: {
17
17
  export declare const renderLivenessGuideUI: ({ container, showCloseButton, }: {
18
18
  container: HTMLElement;
19
19
  showCloseButton: boolean;
20
- }) => Promise<"continue" | "cancel">;
20
+ }) => Promise<"cancel" | "continue">;
package/index.esm.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./src/index";
File without changes