@authme/util 2.3.1-rc.3 → 2.4.4-rc.7

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/package.json CHANGED
@@ -1,8 +1,10 @@
1
1
  {
2
2
  "name": "@authme/util",
3
- "version": "2.3.1-rc.3",
3
+ "version": "2.4.4-rc.7",
4
4
  "peerDependencies": {
5
5
  "core-js": "^3.6.0",
6
+ "jwt-decode": "3.1.2",
7
+ "rxjs": "7.5.7",
6
8
  "lottie-web": "5.9.6"
7
9
  },
8
10
  "module": "./index.js",
@@ -25,5 +25,7 @@ export declare enum ErrorCode {
25
25
  NETWORK_ERROR = 901,
26
26
  HTTP_ERROR_RESPONSE = 902,
27
27
  USER_CANCEL = 903,
28
- CAMERA_NOT_SUPPORT = 904
28
+ CAMERA_NOT_SUPPORT = 904,
29
+ SERVER_ERROR = 905,
30
+ EVENT_NAME_WRONG = 906
29
31
  }
@@ -1 +1,27 @@
1
1
  export declare function debugLog(message?: any, ...others: any[]): void;
2
+ export interface DebugLog<T> {
3
+ image?: string;
4
+ resultOcrImg?: string;
5
+ result?: any;
6
+ report?: any;
7
+ status?: 'recognition' | 'confirm' | 'run-start' | 'run-end' | 'run-error';
8
+ runFunction?: string;
9
+ roundId?: string;
10
+ type?: T;
11
+ time?: number;
12
+ dateTime?: string;
13
+ message?: any;
14
+ isAntiFraud?: boolean;
15
+ }
16
+ export declare function debugTools<T>(config: {
17
+ debugMode: boolean;
18
+ }): {
19
+ pushNewDebugLog: (logParams: DebugLog<T>) => void;
20
+ getDebugLogs: () => DebugLog<T>[];
21
+ getDebugLogsLength: () => number;
22
+ modifyDeubgLog: (index: number, logParams: Partial<DebugLog<T>>) => void;
23
+ downloadDebugLogs: () => void;
24
+ functionLogging: <P>(func: () => Promise<P>, logParams?: Partial<DebugLog<T>>) => Promise<P>;
25
+ nextDebugRound: (type?: T) => void;
26
+ modifyDebugType: (type: T) => void;
27
+ };
@@ -0,0 +1,2 @@
1
+ export declare function getDeviceInfo(): string;
2
+ export declare function getSystemInfo(): string;
@@ -1,3 +1,6 @@
1
+ export * from './jwt-decode.service';
2
+ export * from './client-info.service';
3
+ export { useState } from './state.service';
1
4
  export declare function dataURItoBlob(dataURI: string): Blob;
2
5
  export declare function UintArrayToBlob(width: number, height: number, data: Uint8Array | Uint8ClampedArray, canvasEle?: HTMLCanvasElement, imageFormat?: 'jpg' | 'png'): Blob;
3
6
  export declare function waitTime(ms: number): Promise<void>;
@@ -5,3 +8,6 @@ export declare function retryPromiseWithCondition<T>(promiseFactory: () => Promi
5
8
  export declare function getUserAgent(): string;
6
9
  export declare function isMobileOrTablet(): boolean;
7
10
  export declare function isMobile(): boolean;
11
+ export declare function splitResult(result: any): any;
12
+ export declare function combineResult(result: any): any;
13
+ export declare const isIphone14proOrProMax: () => boolean;
@@ -0,0 +1,19 @@
1
+ import { JwtPayload } from 'jwt-decode';
2
+ declare type TokenData<T> = {
3
+ payload: T;
4
+ exp: number;
5
+ iat: number;
6
+ };
7
+ export declare function decodeToken<T extends JwtPayload>(token: string): TokenData<T>;
8
+ export declare type AuthmeJWT = {
9
+ aud: string;
10
+ client_id: string;
11
+ client_tenant: string;
12
+ exp: number;
13
+ iat: number;
14
+ iss: string;
15
+ jti: string;
16
+ nbf: number;
17
+ scope: Array<string>;
18
+ };
19
+ export {};
@@ -0,0 +1,4 @@
1
+ import { BehaviorSubject } from 'rxjs';
2
+ declare type StatePair<T> = [() => T, (value: T) => void];
3
+ export declare function useState<T = any>(initialValue?: T, subscription?: BehaviorSubject<T>): StatePair<T>;
4
+ export {};
@@ -1,3 +1,10 @@
1
+ export declare enum STORAGE_KEY {
2
+ LOADING_LOTTIE = "loadingLottie",
3
+ OCR_IDCARD_RESULT_FORMAT = "ocrIdcardResultFormat",
4
+ ENABLE_EVENT_TRACKING = "enableEventTracking",
5
+ EVENT_TRACK_URL = "eventTrackUrl",
6
+ API_BASE_URL = "apiBaseUrl"
7
+ }
1
8
  declare function getItem(key: string): any;
2
9
  declare function setItem(key: string, val: any): void;
3
10
  declare function removeItem(key: string): boolean;
@@ -1,3 +1,19 @@
1
+ export interface DeviceMeta {
2
+ device: MediaDeviceInfo;
3
+ meta: {
4
+ resolution: number;
5
+ facingMode: 'front' | 'back';
6
+ facingModeFromLabel: 'back';
7
+ facingModeFromapabilities: 'front' | 'back';
8
+ capabilities: MediaTrackCapabilities;
9
+ };
10
+ capabilities: MediaTrackCapabilities;
11
+ }
12
+ declare type FacingMode = 'front' | 'back';
13
+ interface RequestCamersResult {
14
+ facingMode: FacingMode;
15
+ deviceMetas: DeviceMeta[];
16
+ }
1
17
  export declare const videoConstraintsFactory: (isPC: boolean, facingMode: 'user' | 'environment') => {
2
18
  video: {
3
19
  width: {
@@ -27,9 +43,11 @@ export declare const videoConstraintsFactory: (isPC: boolean, facingMode: 'user'
27
43
  facingMode: "user" | "environment";
28
44
  };
29
45
  };
46
+ export declare function switchCamera(deviceId: string, video: HTMLVideoElement): Promise<void>;
30
47
  export declare function requestCamera({ video, facingMode, translate, showMessage, }: {
31
48
  video: HTMLVideoElement;
32
49
  facingMode: 'front' | 'back';
33
50
  translate: (key: string) => string;
34
51
  showMessage: (text: string) => void;
35
- }): Promise<'front' | 'back'>;
52
+ }): Promise<RequestCamersResult>;
53
+ export {};
@@ -1,5 +1,12 @@
1
- export declare function showErrorMessage(text: string, showRetryBtn?: boolean, callback?: (e: Event) => void): Promise<void>;
1
+ export declare function showErrorMessage(text: string, showRetryBtn?: boolean, callback?: (e: Event) => void, buttonText?: string, _titleText?: string): Promise<void>;
2
+ export declare function showErrorMessageEventName(text: string, showRetryBtn?: boolean, callback?: (e: Event) => void, buttonText?: string, titleText?: string): Promise<void>;
2
3
  export declare function hideErrorMessage(): void;
3
- export declare function asyncShowErrorMessage(text: string, showRetryBtn?: boolean): Promise<boolean>;
4
+ export declare function asyncShowErrorMessage(text: string, showRetryBtn?: boolean, options?: {
5
+ callback?: (e: Event) => void;
6
+ buttonText?: string;
7
+ titleText?: string;
8
+ errorTextHandler?: (text: Error) => string;
9
+ showErrorMessageHandler?: (text: string) => void;
10
+ }): Promise<boolean>;
4
11
  export declare function asyncOnLineShowErrorMessage(text: string, showRetryBtn?: boolean): Promise<boolean>;
5
12
  export declare function checkOnlineStatus(msg: string): Promise<void>;
@@ -1,2 +1,2 @@
1
- export declare function startSpinner(text?: string): void;
1
+ export declare function startSpinner(text?: string, backgroundOpaque?: boolean): void;
2
2
  export declare function stopSpinner(): void;