@authme/util 2.4.2 → 2.4.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/index.cjs +494 -54
- package/index.js +489 -54
- package/package.json +6 -1
- package/src/index.d.ts +1 -0
- package/src/lib/authme-error.d.ts +2 -1
- package/src/lib/authme-log.d.ts +46 -0
- package/src/lib/background-request-process.d.ts +1 -0
- package/src/lib/common/index.d.ts +1 -1
- package/src/lib/file-saver.d.ts +11 -0
- package/src/ui/camera.d.ts +19 -1
- package/src/ui/error-message.d.ts +12 -2
- package/src/ui/spinner.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authme/util",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.7",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"core-js": "^3.6.0",
|
|
6
6
|
"jwt-decode": "3.1.2",
|
|
7
7
|
"rxjs": "7.5.7",
|
|
8
|
+
"file-saver": "2.0.5",
|
|
9
|
+
"jszip": "3.10.1",
|
|
8
10
|
"lottie-web": "5.9.6"
|
|
9
11
|
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@types/file-saver": "^2.0.5"
|
|
14
|
+
},
|
|
10
15
|
"module": "./index.js",
|
|
11
16
|
"main": "./index.cjs",
|
|
12
17
|
"type": "module",
|
package/src/index.d.ts
CHANGED
package/src/lib/authme-log.d.ts
CHANGED
|
@@ -1 +1,47 @@
|
|
|
1
|
+
export declare enum RUN_FUNCTION_NAME {
|
|
2
|
+
RECOGNITION = "service.recognition",
|
|
3
|
+
ANTI_FARUD_RECOGNITION = "antiFraudInstance.recognition",
|
|
4
|
+
API_REQUEST = "api.request"
|
|
5
|
+
}
|
|
6
|
+
interface GetDebugImageParams<T> {
|
|
7
|
+
data: Uint8ClampedArray;
|
|
8
|
+
type?: T;
|
|
9
|
+
getDebugImageData: (data: Uint8ClampedArray | Uint8Array) => Promise<Uint8Array>;
|
|
10
|
+
result: any;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
}
|
|
1
14
|
export declare function debugLog(message?: any, ...others: any[]): void;
|
|
15
|
+
export interface DebugLog<T> {
|
|
16
|
+
result?: any;
|
|
17
|
+
report?: any;
|
|
18
|
+
status?: 'recognition' | 'confirm' | 'run-start' | 'run-end' | 'run-error';
|
|
19
|
+
runFunction?: RUN_FUNCTION_NAME;
|
|
20
|
+
roundId?: string;
|
|
21
|
+
_id: string;
|
|
22
|
+
type?: T;
|
|
23
|
+
time: number;
|
|
24
|
+
dateTime?: string;
|
|
25
|
+
message?: any;
|
|
26
|
+
isAntiFraud?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare function debugTools<T>(): {
|
|
29
|
+
debugMode: boolean;
|
|
30
|
+
debugModeUI: boolean;
|
|
31
|
+
pushNewDebugLog: (logParams: Partial<DebugLog<T>>) => DebugLog<T> | undefined;
|
|
32
|
+
getDebugLogs: () => DebugLog<T>[];
|
|
33
|
+
getDebugLogsLength: () => number;
|
|
34
|
+
modifyDeubgLog: (index: number, logParams: Partial<DebugLog<T>>) => void;
|
|
35
|
+
downloadDebugLogs: () => void;
|
|
36
|
+
functionLogging: <P>(func: () => Promise<P>, logParams?: Partial<DebugLog<T>>) => Promise<P>;
|
|
37
|
+
nextDebugRound: (type?: T) => void;
|
|
38
|
+
modifyDebugType: (type: T) => void;
|
|
39
|
+
pushNewDebugImage: (image: Blob, log: Partial<DebugLog<T>>, options?: {
|
|
40
|
+
prefix?: string;
|
|
41
|
+
}) => void;
|
|
42
|
+
setTimeDuration: (behavior: string) => {
|
|
43
|
+
end: () => void;
|
|
44
|
+
};
|
|
45
|
+
saveDebugImage: ({ getDebugImageData, data, width, height, result, type, }: GetDebugImageParams<T>) => Promise<void>;
|
|
46
|
+
};
|
|
47
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function backgroundRequest<T = unknown>(request: () => Promise<T>): void;
|
|
@@ -5,9 +5,9 @@ export declare function dataURItoBlob(dataURI: string): Blob;
|
|
|
5
5
|
export declare function UintArrayToBlob(width: number, height: number, data: Uint8Array | Uint8ClampedArray, canvasEle?: HTMLCanvasElement, imageFormat?: 'jpg' | 'png'): Blob;
|
|
6
6
|
export declare function waitTime(ms: number): Promise<void>;
|
|
7
7
|
export declare function retryPromiseWithCondition<T>(promiseFactory: () => Promise<T>, conditionFactory: (...args: any[]) => Promise<any>): Promise<T>;
|
|
8
|
-
export declare function getUserAgent(): string;
|
|
9
8
|
export declare function isMobileOrTablet(): boolean;
|
|
10
9
|
export declare function isMobile(): boolean;
|
|
10
|
+
export declare function osVersion(): string;
|
|
11
11
|
export declare function splitResult(result: any): any;
|
|
12
12
|
export declare function combineResult(result: any): any;
|
|
13
13
|
export declare const isIphone14proOrProMax: () => boolean;
|
package/src/ui/camera.d.ts
CHANGED
|
@@ -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<
|
|
52
|
+
}): Promise<RequestCamersResult>;
|
|
53
|
+
export {};
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare type ShowErrorMessageHandler = (text: string, showRetryBtn?: boolean, callback?: CallBackType, buttonText?: string, titleText?: string) => void;
|
|
2
|
+
export declare type CallBackType = (e: Event, tools?: {
|
|
3
|
+
hideErrorMessage: () => void;
|
|
4
|
+
}) => void;
|
|
5
|
+
export declare function showErrorMessage(text: string, showRetryBtn?: boolean, callback?: CallBackType, buttonText?: string, _titleText?: string): Promise<void>;
|
|
6
|
+
export declare function showErrorMessageEventName(text: string, showRetryBtn?: boolean, callback?: CallBackType, buttonText?: string, titleText?: string): Promise<void>;
|
|
2
7
|
export declare function hideErrorMessage(): void;
|
|
3
|
-
export declare function asyncShowErrorMessage(text: string, showRetryBtn?: boolean
|
|
8
|
+
export declare function asyncShowErrorMessage(text: string, showRetryBtn?: boolean, options?: {
|
|
9
|
+
callback?: CallBackType;
|
|
10
|
+
buttonText?: string;
|
|
11
|
+
titleText?: string;
|
|
12
|
+
showErrorMessageHandler?: ShowErrorMessageHandler;
|
|
13
|
+
}): Promise<boolean>;
|
|
4
14
|
export declare function asyncOnLineShowErrorMessage(text: string, showRetryBtn?: boolean): Promise<boolean>;
|
|
5
15
|
export declare function checkOnlineStatus(msg: string): Promise<void>;
|
package/src/ui/spinner.d.ts
CHANGED
|
@@ -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;
|