@yidun/livedetect-sdk-h5 2.3.1 → 2.3.3

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.
@@ -18,6 +18,7 @@ export declare function getHeadersInfo(headers?: Record<string, string>): {
18
18
  sdkType: string;
19
19
  terminal: string;
20
20
  version: string;
21
+ riskVersion: string;
21
22
  };
22
23
  export declare function getTipTextByCode(type: WarnType, code: string): string | null;
23
24
  export declare function getTipCircleColor(type: WarnType, code: string): "#FC8D74" | "#5FD6A9" | undefined;
@@ -0,0 +1,23 @@
1
+ interface IriskOptions {
2
+ productId: string;
3
+ apiServer: string;
4
+ staticServer: string;
5
+ errorToken: string;
6
+ offlineToken: string;
7
+ }
8
+ interface GetTokenOptions {
9
+ timeout?: number;
10
+ }
11
+ export default class Irisk {
12
+ private readonly options;
13
+ private guardian;
14
+ private loadStatus;
15
+ private loadPromise;
16
+ private readonly jsPath;
17
+ constructor(options: IriskOptions);
18
+ init(): Promise<void>;
19
+ getToken(options?: GetTokenOptions): Promise<string>;
20
+ private loadScript;
21
+ private createGuardian;
22
+ }
23
+ export {};
@@ -8,6 +8,7 @@ import { Camera } from './modules/camera';
8
8
  import { Progress } from './modules/progress';
9
9
  import { Footer } from './modules/footer';
10
10
  import { Record as VideoRecord } from './modules/record';
11
+ import IriskModule from './irisk.js';
11
12
  declare class NELiveDetection extends EventEmitter implements Dispose {
12
13
  bdFaceSdk: any;
13
14
  options: Required<Options>;
@@ -23,11 +24,15 @@ declare class NELiveDetection extends EventEmitter implements Dispose {
23
24
  readonly progress: Progress;
24
25
  readonly footer: Footer;
25
26
  readonly record: VideoRecord;
27
+ private iriskModule;
28
+ private iriskEnable;
29
+ private iriskToken;
26
30
  constructor(options: Options);
27
31
  mount(container?: Options['container']): void;
28
32
  mergeOptionsFromServer(): Promise<void>;
29
33
  initBdFaceSdk(isEmitReady?: boolean): Promise<void>;
30
- start(): void;
34
+ initIriskModule(): IriskModule;
35
+ start(): Promise<void>;
31
36
  restart(): Promise<void>;
32
37
  dispose(): void;
33
38
  private canUseSDK;
@@ -23,15 +23,28 @@ export interface Options extends PirvateOptions {
23
23
  lang?: Lang;
24
24
  apiServer?: string;
25
25
  preload?: boolean;
26
- isSupport?: (ua: BrandVersion) => boolean;
26
+ riskConfig?: {
27
+ enable: 1 | 2;
28
+ pn: string;
29
+ apiServer: string;
30
+ token: string;
31
+ offlineToken: string;
32
+ };
33
+ isSupport?: (ua: UAInfo) => boolean;
27
34
  onMount?: (instance?: NELiveDetection) => void;
28
35
  onReady?: (instance?: NELiveDetection) => void;
29
36
  }
30
37
  export declare type WarnType = 'fail' | 'tip';
31
38
  export declare type FailCode = 'unsupported' | 'notallowed' | 'notfound' | 'notreadable' | 'overconstrained' | 'abort' | 'reject' | 'timeout' | 'action_timeout' | 'auth' | 'pdFail';
32
- export interface BrandVersion {
33
- osName: string;
34
- osVersion: string;
35
- browserName: string;
36
- browserVersion: string;
39
+ export interface BrowserInfo {
40
+ name: string;
41
+ version: string;
42
+ }
43
+ export interface OSInfo {
44
+ name: string;
45
+ version: string;
46
+ }
47
+ export interface UAInfo {
48
+ os: OSInfo;
49
+ browser: BrowserInfo;
37
50
  }
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@yidun/livedetect-sdk-h5",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
4
4
  "description": "活体检测 H5",
5
+ "riskVersion": "2.1.2",
5
6
  "main": "dist/NELiveDetection.umd.js",
6
7
  "module": "dist/es/NELiveDetection.esm.js",
7
8
  "typings": "dist/es/typings/index.d.ts",
@@ -23,7 +24,7 @@
23
24
  },
24
25
  "lint-staged": {
25
26
  "*.{ts,tsx,js}": [
26
- "eslint --config .eslintrc.js"
27
+ "eslint --config .eslintrc.js --fix"
27
28
  ],
28
29
  "*.{css,less,scss}": [
29
30
  "stylelint --config .stylelintrc.js"
@@ -103,7 +104,8 @@
103
104
  "typescript": "^4.6.3"
104
105
  },
105
106
  "dependencies": {
106
- "@yidun/snaker": "^0.4.3"
107
+ "@yidun/snaker": "^0.4.3",
108
+ "load-script": "^2.0.0"
107
109
  },
108
110
  "volta": {
109
111
  "node": "18.20.5"