@idscan/idvc2 3.8.0 → 3.9.0
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/README.md +3 -0
- package/dist/idvc.js +1 -1
- package/dist/idvc.js.gzip +0 -0
- package/dist/index.html +4 -2
- package/dist/networks/ZXing-chunk.js +1 -1
- package/dist/types/helpers/base64.d.ts +6 -0
- package/dist/types/helpers/image.d.ts +0 -1
- package/dist/types/helpers/strings.d.ts +0 -5
- package/dist/types/idvc.d.ts +2 -0
- package/dist/types/integrations/prepareRequestDataForDiveApi.d.ts +59 -0
- package/dist/types/manualUpload.d.ts +2 -2
- package/dist/types/modules/Step.d.ts +6 -6
- package/dist/types/modules/manualUploadProcessing.d.ts +3 -3
- package/dist/types/types/context.d.ts +3 -2
- package/dist/types/util.d.ts +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type Base64 = string;
|
|
2
|
+
export type Base64DataUrl = string;
|
|
3
|
+
export declare const base64ToUint8Array: (base64: string) => Uint8Array;
|
|
4
|
+
export declare const isBase64DataUrl: (value: string) => value is string;
|
|
5
|
+
export declare const extractBase64: (input?: string | null) => Base64;
|
|
6
|
+
export declare const blobToBase64DataUrl: (blob: Blob) => Promise<Base64DataUrl>;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import { Base64Image } from './image';
|
|
2
|
-
export declare const encodeMeta: (metadata: any) => string;
|
|
3
|
-
export declare const decodeMeta: (str: string) => any;
|
|
4
|
-
export declare const base64ToArrayBuffer: (base64: string) => Uint8Array;
|
|
5
|
-
export declare const getDataFromBase64Img: (imgString: Base64Image) => string;
|
|
6
1
|
export declare const splitWordByUpperLetters: (word: string) => string[];
|
|
7
2
|
export declare const normalizeCamelCase: (word: string) => string;
|
|
8
3
|
export declare const removeHtmlEntities: (str: string) => string;
|
package/dist/types/idvc.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { IConfig } from './modules/Config';
|
|
2
2
|
import type { SupportedLanguage } from './environment/langs';
|
|
3
3
|
import type { IDocumentTypeConfig } from './modules/validator';
|
|
4
|
+
export { prepareRequestDataForDiveApi, } from './integrations/prepareRequestDataForDiveApi';
|
|
5
|
+
export type { IPrepareRequestDataForDiveApiParams } from './integrations/prepareRequestDataForDiveApi';
|
|
4
6
|
export default class VideoCapturing {
|
|
5
7
|
constructor(config: IConfig);
|
|
6
8
|
get version(): string;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { IDataForSubmit } from '../util';
|
|
2
|
+
import { Base64 } from '../helpers/base64';
|
|
3
|
+
import { DocumentTypeIndex } from '../environment/documentTypes';
|
|
4
|
+
interface IRequestBase {
|
|
5
|
+
frontImageBase64: Base64;
|
|
6
|
+
backOrSecondImageBase64: Base64;
|
|
7
|
+
faceImageBase64: Base64;
|
|
8
|
+
ssn: string;
|
|
9
|
+
frontMultiImagesBase64: Base64;
|
|
10
|
+
faceMultiImagesBase64: Base64;
|
|
11
|
+
documentType: DocumentTypeIndex | 0;
|
|
12
|
+
}
|
|
13
|
+
interface IRequestV3 extends IRequestBase {
|
|
14
|
+
trackString: string;
|
|
15
|
+
verifyFace: boolean;
|
|
16
|
+
captureMethod: string;
|
|
17
|
+
userAgent: string;
|
|
18
|
+
frontEndMetadata: string;
|
|
19
|
+
metadata?: string;
|
|
20
|
+
}
|
|
21
|
+
interface IRequestV4 extends IRequestBase {
|
|
22
|
+
trackString: {
|
|
23
|
+
data: string;
|
|
24
|
+
barcodeParams: string;
|
|
25
|
+
};
|
|
26
|
+
metadata: {
|
|
27
|
+
captureMethod: string;
|
|
28
|
+
userAgent: string;
|
|
29
|
+
frontEndMetadata: string;
|
|
30
|
+
otherMetadata?: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export interface IPrepareRequestDataForDiveApiParams<P = Record<string, unknown>> {
|
|
34
|
+
data?: IDataForSubmit;
|
|
35
|
+
payload?: P;
|
|
36
|
+
versionAPI?: '3' | '3.1' | '4';
|
|
37
|
+
}
|
|
38
|
+
type IRequestPayload = Record<string, unknown>;
|
|
39
|
+
/**
|
|
40
|
+
* Prepares request payload for Dive API (v3 / v3.1 / v4) based on submitted capture data.
|
|
41
|
+
*
|
|
42
|
+
* Builds a normalized request object:
|
|
43
|
+
* - extracts base64 images (front, back/second, face)
|
|
44
|
+
* - prepares multi-capture images if available
|
|
45
|
+
* - parses metadata
|
|
46
|
+
* - adjusts payload structure depending on API version
|
|
47
|
+
*
|
|
48
|
+
* @template P - Additional custom payload fields to be merged into the request
|
|
49
|
+
*
|
|
50
|
+
* @param params - Parameters object
|
|
51
|
+
* @param params.data - Raw data collected from the results of the IDVC capture flow
|
|
52
|
+
* @param params.payload - Optional custom fields to extend the request payload
|
|
53
|
+
* @param params.versionAPI - Target Dive API version (`'3' | '3.1' | '4'`)
|
|
54
|
+
*
|
|
55
|
+
* @returns Promise resolving to a prepared Dive API request object
|
|
56
|
+
* compatible with the specified API version and extended with custom payload fields
|
|
57
|
+
*/
|
|
58
|
+
export declare const prepareRequestDataForDiveApi: <P extends IRequestPayload>({ data, versionAPI, payload, }: IPrepareRequestDataForDiveApiParams<P>) => Promise<(IRequestV3 | IRequestV4) & P>;
|
|
59
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Base64 } from './helpers/base64';
|
|
2
2
|
type Base64Object = {
|
|
3
|
-
data: ImageData |
|
|
3
|
+
data: ImageData | Base64 | null;
|
|
4
4
|
err: boolean;
|
|
5
5
|
};
|
|
6
6
|
declare const dropFile: (base64Obj: Base64Object) => Promise<void>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Base64Image } from '../helpers/image';
|
|
2
1
|
import { StepType, StepTypeImageName } from '../environment/stepsDescription';
|
|
3
2
|
import { StepMode } from '../defaultConfig';
|
|
4
3
|
import { ErrorCodes } from '../environment/langs';
|
|
5
4
|
import { DocumentTypeName } from '../environment/documentTypes';
|
|
5
|
+
import { Base64 } from '../helpers/base64';
|
|
6
6
|
export interface IStepConfigMode {
|
|
7
7
|
name: 'mode';
|
|
8
8
|
value: StepMode;
|
|
@@ -14,7 +14,7 @@ export interface IStepObj {
|
|
|
14
14
|
name: string;
|
|
15
15
|
type: StepType;
|
|
16
16
|
camera: VideoFacingModeEnum;
|
|
17
|
-
img:
|
|
17
|
+
img: Base64 | null;
|
|
18
18
|
err?: string | null;
|
|
19
19
|
text?: string;
|
|
20
20
|
time?: number;
|
|
@@ -25,7 +25,7 @@ export interface IStepObj {
|
|
|
25
25
|
}
|
|
26
26
|
export interface IStepCallback {
|
|
27
27
|
/** base64 encoded step image */
|
|
28
|
-
img:
|
|
28
|
+
img: Base64 | null;
|
|
29
29
|
/** blob step image */
|
|
30
30
|
blob: Blob | null;
|
|
31
31
|
/** blob step MultiImages */
|
|
@@ -43,7 +43,7 @@ export interface IStepCallback {
|
|
|
43
43
|
/** mrz recognized text */
|
|
44
44
|
mrzText?: string;
|
|
45
45
|
/** cropped base64 encoded mrz image */
|
|
46
|
-
mrzImg?:
|
|
46
|
+
mrzImg?: Base64 | null;
|
|
47
47
|
/** cropped blob mrz image */
|
|
48
48
|
mrzBlob?: Blob | null;
|
|
49
49
|
/** recognized text */
|
|
@@ -54,7 +54,7 @@ export default class Step implements IStepCallback, IStepObj {
|
|
|
54
54
|
multiImagesBlob: Blob | null;
|
|
55
55
|
errorCode: ErrorCodes | null | undefined;
|
|
56
56
|
mrzText?: string;
|
|
57
|
-
mrzImg?:
|
|
57
|
+
mrzImg?: Base64 | null;
|
|
58
58
|
mrzBlob?: Blob | null;
|
|
59
59
|
trackString?: string;
|
|
60
60
|
err?: string | null;
|
|
@@ -65,7 +65,7 @@ export default class Step implements IStepCallback, IStepObj {
|
|
|
65
65
|
name: string;
|
|
66
66
|
type: StepType;
|
|
67
67
|
camera: VideoFacingModeEnum;
|
|
68
|
-
img:
|
|
68
|
+
img: Base64 | null;
|
|
69
69
|
cameraInfo: Record<string, any>;
|
|
70
70
|
stepTypeImageName: StepTypeImageName;
|
|
71
71
|
shouldRecordMultiImages: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Base64Image } from '../helpers/image';
|
|
2
1
|
import type { ErrorCodeNames } from '../environment/langs';
|
|
2
|
+
import { Base64 } from '../helpers/base64';
|
|
3
3
|
type ProcessingErrorCode = ErrorCodeNames | '';
|
|
4
4
|
type Coordinate = {
|
|
5
5
|
x: number;
|
|
@@ -22,9 +22,9 @@ export declare const pdfProcess: (smallImage: any, { perimeter }: {
|
|
|
22
22
|
}) => Promise<boolean>;
|
|
23
23
|
/**
|
|
24
24
|
*
|
|
25
|
-
* @param {
|
|
25
|
+
* @param {Base64} data - base64 image
|
|
26
26
|
*/
|
|
27
|
-
export declare const barCodeProcess: (data:
|
|
27
|
+
export declare const barCodeProcess: (data: Base64) => Promise<boolean>;
|
|
28
28
|
export declare const frontProcess: ({ side, perimeter, isHasFace }: {
|
|
29
29
|
side: any;
|
|
30
30
|
perimeter: any;
|
|
@@ -7,7 +7,8 @@ import LoggerController from '../controllers/LoggerController';
|
|
|
7
7
|
import Step from '../modules/Step';
|
|
8
8
|
import { AllLabels } from '../environment/langs';
|
|
9
9
|
import { StepType } from '../environment/stepsDescription';
|
|
10
|
-
import {
|
|
10
|
+
import { Base64 } from '../helpers/base64';
|
|
11
|
+
import { Offset, Size } from '../helpers/image';
|
|
11
12
|
import { RealFaceTurnSide } from './enums/realFace';
|
|
12
13
|
import { StepConfig, StepMode } from '../defaultConfig';
|
|
13
14
|
import { DeepPartial } from './helpers/DeepPartial';
|
|
@@ -45,7 +46,7 @@ export type Context = {
|
|
|
45
46
|
steps: Step[];
|
|
46
47
|
currentStepType: StepType;
|
|
47
48
|
currentStepCamera: VideoFacingModeEnum;
|
|
48
|
-
currentStepImg:
|
|
49
|
+
currentStepImg: Base64 | null;
|
|
49
50
|
currentStepBlob: Blob | null;
|
|
50
51
|
curStep: number;
|
|
51
52
|
currentStep: number;
|
package/dist/types/util.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Base64 } from './helpers/base64';
|
|
2
2
|
import { IStepCallback } from './modules/Step';
|
|
3
3
|
import { DocumentTypeIndex, DocumentTypeName } from './environment/documentTypes';
|
|
4
4
|
import { Context } from './types/context';
|
|
@@ -22,5 +22,5 @@ export declare const filterWithForbiddenKeysValues: (obj: any, forbiddenKeys: an
|
|
|
22
22
|
export declare const prepareCameraErr: (err: IError) => IError;
|
|
23
23
|
export declare const formDataForSubmit: (steps: IStepCallback[], c: Context, payload?: {}) => IDataForSubmit;
|
|
24
24
|
export declare const imageToImageData: (img: HTMLImageElement) => ImageData;
|
|
25
|
-
export declare const base64ToImageData: (base64:
|
|
25
|
+
export declare const base64ToImageData: (base64: Base64) => Promise<ImageData>;
|
|
26
26
|
export {};
|