@idscan/idvc2 2.5.6 → 2.5.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.
Files changed (165) hide show
  1. package/README.md +3 -0
  2. package/dist/types/assets/images/barcode.d.ts +2 -0
  3. package/dist/types/assets/images/face.d.ts +2 -0
  4. package/dist/types/assets/images/front.d.ts +2 -0
  5. package/dist/types/assets/images/mrz.d.ts +2 -0
  6. package/dist/types/assets/images/pdf.d.ts +2 -0
  7. package/dist/types/bl.d.ts +15 -0
  8. package/dist/types/constatnts/camera.d.ts +11 -0
  9. package/dist/types/constatnts/imageProcessing.d.ts +3 -0
  10. package/dist/types/constatnts/pdf.d.ts +1 -0
  11. package/dist/types/context.d.ts +118 -0
  12. package/dist/types/defaultConfig.d.ts +57 -0
  13. package/dist/types/environment/designations.d.ts +5 -0
  14. package/dist/types/environment/documentTypes.d.ts +26 -0
  15. package/dist/types/environment/langs.d.ts +89 -0
  16. package/dist/types/environment/loopResult.d.ts +8 -0
  17. package/dist/types/environment/modalPosition.d.ts +19 -0
  18. package/dist/types/environment/realFaceModes.d.ts +22 -0
  19. package/dist/types/environment/stepsDescription.d.ts +54 -0
  20. package/dist/types/environment/triangulation.d.ts +18 -0
  21. package/dist/types/eventListeners/eventListeners.d.ts +15 -0
  22. package/dist/types/eventListeners/selectDocumentType/selectHandler.d.ts +5 -0
  23. package/dist/types/helpers/apiSupport.d.ts +1 -0
  24. package/dist/types/helpers/canvas.d.ts +34 -0
  25. package/dist/types/helpers/color.d.ts +14 -0
  26. package/dist/types/helpers/dataManipulation.d.ts +27 -0
  27. package/dist/types/helpers/detectLanguage.d.ts +3 -0
  28. package/dist/types/helpers/geometry.d.ts +35 -0
  29. package/dist/types/helpers/html.d.ts +26 -0
  30. package/dist/types/helpers/image.d.ts +36 -0
  31. package/dist/types/helpers/imageprocessing.d.ts +11 -0
  32. package/dist/types/helpers/licenceKeyError.d.ts +6 -0
  33. package/dist/types/helpers/manualUpload.d.ts +7 -0
  34. package/dist/types/helpers/math.d.ts +35 -0
  35. package/dist/types/helpers/mobileChecker.d.ts +15 -0
  36. package/dist/types/helpers/numbers.d.ts +2 -0
  37. package/dist/types/helpers/step-background.d.ts +2 -0
  38. package/dist/types/helpers/strings.d.ts +9 -0
  39. package/dist/types/helpers/time.d.ts +11 -0
  40. package/dist/types/helpers/ts/common.d.ts +17 -0
  41. package/dist/types/helpers/updateSelecetTypes.d.ts +3 -0
  42. package/dist/types/helpers/validators.d.ts +44 -0
  43. package/dist/types/idvc.d.ts +19 -0
  44. package/dist/types/initialize.d.ts +12 -0
  45. package/dist/types/loader/asyncLoader.d.ts +1 -0
  46. package/dist/types/loader/loadAnglesModel.d.ts +2 -0
  47. package/dist/types/loader/loadFrontModels.d.ts +2 -0
  48. package/dist/types/loader/loaderClassLocal.d.ts +2 -0
  49. package/dist/types/loader/loaderFace.d.ts +2 -0
  50. package/dist/types/loader/loaderMRZ.d.ts +4 -0
  51. package/dist/types/loader/loaderMeshFace.d.ts +3 -0
  52. package/dist/types/loader/loaderPDF.d.ts +3 -0
  53. package/dist/types/loader/loaderUploadMode.d.ts +1 -0
  54. package/dist/types/loader/loaderZXing.d.ts +2 -0
  55. package/dist/types/loop.d.ts +13 -0
  56. package/dist/types/loopControl.d.ts +10 -0
  57. package/dist/types/modules/BarcodeModule.d.ts +28 -0
  58. package/dist/types/modules/Config.d.ts +131 -0
  59. package/dist/types/modules/FrontProcessing.d.ts +11 -0
  60. package/dist/types/modules/MetaData.d.ts +10 -0
  61. package/dist/types/modules/MrzModule.d.ts +73 -0
  62. package/dist/types/modules/PdfModule.d.ts +79 -0
  63. package/dist/types/modules/Step.d.ts +69 -0
  64. package/dist/types/modules/blur.d.ts +4 -0
  65. package/dist/types/modules/browwserCompatibilities.d.ts +7 -0
  66. package/dist/types/modules/camera/camera.d.ts +14 -0
  67. package/dist/types/modules/camera/cameraManager.d.ts +9 -0
  68. package/dist/types/modules/face/Face.d.ts +63 -0
  69. package/dist/types/modules/face/MeshFace.d.ts +48 -0
  70. package/dist/types/modules/face/SimpleFace.d.ts +23 -0
  71. package/dist/types/modules/feature-detect/simd.d.ts +2 -0
  72. package/dist/types/modules/frameQuality.d.ts +10 -0
  73. package/dist/types/modules/heic.d.ts +11 -0
  74. package/dist/types/modules/image.d.ts +13 -0
  75. package/dist/types/modules/initErrorHandler.d.ts +10 -0
  76. package/dist/types/modules/licenseKeyChecker.d.ts +1 -0
  77. package/dist/types/modules/manualUpload.d.ts +7 -0
  78. package/dist/types/modules/manualUploadProcessing.d.ts +30 -0
  79. package/dist/types/modules/mediaDevices.d.ts +2 -0
  80. package/dist/types/modules/moduleInitializer.d.ts +8 -0
  81. package/dist/types/modules/step-functions/face.d.ts +2 -0
  82. package/dist/types/modules/step-functions/pdf.d.ts +13 -0
  83. package/dist/types/modules/step-result-processing/barcode.d.ts +2 -0
  84. package/dist/types/modules/step-result-processing/common.d.ts +1 -0
  85. package/dist/types/modules/step-result-processing/mrz.d.ts +2 -0
  86. package/dist/types/modules/step-result-processing/pdf.d.ts +2 -0
  87. package/dist/types/modules/step-result-processing/simpleFace.d.ts +2 -0
  88. package/dist/types/modules/step-result-processing/volumeFace.d.ts +7 -0
  89. package/dist/types/modules/stepFunctions.d.ts +5 -0
  90. package/dist/types/modules/stepResultProcessing.d.ts +9 -0
  91. package/dist/types/modules/ui/Flashlight.d.ts +17 -0
  92. package/dist/types/modules/ui/MaskCapture.d.ts +52 -0
  93. package/dist/types/modules/ui/MessageBox.d.ts +19 -0
  94. package/dist/types/modules/ui/Modal.d.ts +20 -0
  95. package/dist/types/modules/ui/SelectDocumentType.d.ts +37 -0
  96. package/dist/types/modules/ui/canvas.d.ts +48 -0
  97. package/dist/types/modules/ui/forceCaptruringBtn.d.ts +12 -0
  98. package/dist/types/modules/ui/hints.d.ts +17 -0
  99. package/dist/types/modules/ui/limitations.d.ts +2 -0
  100. package/dist/types/modules/ui/manualSwitchBtn.d.ts +30 -0
  101. package/dist/types/modules/ui/selectDocumentType/documentSelectedEvent.d.ts +7 -0
  102. package/dist/types/modules/ui/spinner.d.ts +13 -0
  103. package/dist/types/modules/ui/swiper.d.ts +3 -0
  104. package/dist/types/modules/uploader.d.ts +58 -0
  105. package/dist/types/modules/validation/ValidateBool.d.ts +5 -0
  106. package/dist/types/modules/validation/ValidateDocumentTypes.d.ts +20 -0
  107. package/dist/types/modules/validation/ValidateElement.d.ts +5 -0
  108. package/dist/types/modules/validation/ValidateFunction.d.ts +5 -0
  109. package/dist/types/modules/validation/ValidateNumber.d.ts +5 -0
  110. package/dist/types/modules/validation/ValidateString.d.ts +5 -0
  111. package/dist/types/modules/validation/ValidateStringInArray.d.ts +12 -0
  112. package/dist/types/modules/validation/showValidationError.d.ts +2 -0
  113. package/dist/types/modules/validation/validatorFactory.d.ts +10 -0
  114. package/dist/types/modules/validator.d.ts +12 -0
  115. package/dist/types/neural models/Provider.d.ts +4 -0
  116. package/dist/types/neural models/anglesModel.d.ts +15 -0
  117. package/dist/types/neural models/blazeFaceModel.d.ts +27 -0
  118. package/dist/types/neural models/classLocal/exits.d.ts +3 -0
  119. package/dist/types/neural models/classLocalModel.d.ts +29 -0
  120. package/dist/types/neural models/meshFaceModel.d.ts +17 -0
  121. package/dist/types/neural models/mrzModel.d.ts +20 -0
  122. package/dist/types/neural models/neuralModel.d.ts +18 -0
  123. package/dist/types/neural models/preload.d.ts +7 -0
  124. package/dist/types/stepProcessing.d.ts +27 -0
  125. package/dist/types/types/enums/realFace.d.ts +4 -0
  126. package/dist/types/types/modules/camera.enum.d.ts +18 -0
  127. package/dist/types/ui.d.ts +89 -0
  128. package/dist/types/util.d.ts +34 -0
  129. package/dist/types/workers/blurWorker.d.ts +1 -0
  130. package/dist/types/workers/bubbleWorker.d.ts +1 -0
  131. package/dist/types/workers/loadNetworksWorker.d.ts +0 -0
  132. package/dist/types/workers/mrzWorker.d.ts +1 -0
  133. package/package.json +1 -1
  134. package/dist/css/idvc.css +0 -1
  135. package/dist/idvc.js +0 -1684
  136. package/dist/index.html +0 -114
  137. package/dist/js/defaultConfig.ts +0 -303
  138. package/dist/js/environment/capturingModes.json +0 -4
  139. package/dist/js/environment/cssVariables.json +0 -191
  140. package/dist/js/environment/designations.ts +0 -23
  141. package/dist/js/environment/documentTypes.ts +0 -151
  142. package/dist/js/environment/langs.js +0 -1
  143. package/dist/js/environment/loadModes.json +0 -11
  144. package/dist/js/environment/loopResult.ts +0 -14
  145. package/dist/js/environment/modalPosition.ts +0 -27
  146. package/dist/js/environment/networkNames.json +0 -9
  147. package/dist/js/environment/realFaceModes.ts +0 -24
  148. package/dist/js/environment/stepsDescription.ts +0 -64
  149. package/dist/js/environment/triangulation.ts +0 -188
  150. package/dist/networks/156-9239-chunk.js +0 -1
  151. package/dist/networks/190-77ed-chunk.js +0 -1
  152. package/dist/networks/77-9e2f-chunk.js +0 -1
  153. package/dist/networks/Face-a2b7-chunk.js +0 -1
  154. package/dist/networks/MRZ-7d62-chunk.js +0 -1
  155. package/dist/networks/PDF-78d2-chunk.js +0 -1
  156. package/dist/networks/ZXing-5410-chunk.js +0 -1
  157. package/dist/networks/angle03032023.onnx +0 -0
  158. package/dist/networks/classLocal03032023.onnx +0 -0
  159. package/dist/networks/faceDetection03032023.onnx +0 -0
  160. package/dist/networks/faceLandmark03032023.onnx +0 -0
  161. package/dist/networks/mrz03032023.onnx +0 -0
  162. package/dist/networks/ort-wasm-simd-threaded.wasm +0 -0
  163. package/dist/networks/ort-wasm-simd.wasm +0 -0
  164. package/dist/networks/ort-wasm-threaded.wasm +0 -0
  165. package/dist/networks/ort-wasm.wasm +0 -0
@@ -0,0 +1,20 @@
1
+ interface DestructedOptions {
2
+ isMobile: boolean;
3
+ background: HTMLDivElement;
4
+ containerId: string;
5
+ mainId?: string;
6
+ doneBtnId: string;
7
+ cancelBtnId: string;
8
+ }
9
+ declare class Modal {
10
+ private background;
11
+ container: HTMLDivElement;
12
+ doneBtn: HTMLButtonElement;
13
+ cancelBtn: HTMLButtonElement;
14
+ constructor(opts: DestructedOptions);
15
+ addDoneHandler(handler: (e?: Event) => void): void;
16
+ addCancelHandler(handler: (e?: Event) => void): void;
17
+ hide(): void;
18
+ show(): void;
19
+ }
20
+ export default Modal;
@@ -0,0 +1,37 @@
1
+ import Modal from './Modal';
2
+ import { DocumentRecord, DocumentTypeIndex, DocumentTypeName, HumanName } from '../../environment/documentTypes';
3
+ import { ModalPositionKeys } from '../../environment/modalPosition';
4
+ interface DocumentTypeElement {
5
+ name: DocumentTypeName;
6
+ element: HTMLLabelElement;
7
+ id: DocumentTypeIndex;
8
+ nName?: string;
9
+ }
10
+ interface ISpinner {
11
+ addSpinnerState: () => void;
12
+ showSpinner: () => void;
13
+ removeSpinnerState: () => void;
14
+ clearState: () => void;
15
+ hideSpinner: () => void;
16
+ }
17
+ declare class SelectDocumentType extends Modal {
18
+ private list;
19
+ elementsList: DocumentTypeElement[];
20
+ private cancelButtonContainer;
21
+ private doneButtonContainer;
22
+ private spinner;
23
+ constructor(isMobile: boolean, background: HTMLDivElement, spinner: ISpinner, modalPositionClass: ModalPositionKeys);
24
+ show(): void;
25
+ hide(): void;
26
+ showCancelButton(): void;
27
+ hideCancelButton(): void;
28
+ addDoneHandler(handler: (e?: Event) => void): void;
29
+ addCancelHandler(handler: (e?: Event) => void): void;
30
+ createElement: (docType: DocumentTypeName, humanName: HumanName) => HTMLLabelElement;
31
+ hasElement(docType: DocumentTypeName): boolean;
32
+ addElement(docType: DocumentTypeName, element: HTMLLabelElement, id: DocumentTypeIndex): void;
33
+ clearList(): void;
34
+ addType({ name: docType, humanName, id }: DocumentRecord): void;
35
+ render(): void;
36
+ }
37
+ export default SelectDocumentType;
@@ -0,0 +1,48 @@
1
+ import { IOffset, ISize } from '../../helpers/image';
2
+ import { Bbox } from '../../types/geometry';
3
+ export default class CanvasUi {
4
+ canvasNames: Set<string>;
5
+ canvasCtxNames: Set<string>;
6
+ videoCanvas: HTMLCanvasElement;
7
+ resizedCanvas: HTMLCanvasElement;
8
+ mrzCanvas: HTMLCanvasElement;
9
+ borderCanvas: HTMLCanvasElement;
10
+ faceCanvas: HTMLCanvasElement;
11
+ classLocalCanvas: HTMLCanvasElement;
12
+ blazeFaceCanvas: HTMLCanvasElement;
13
+ meshFaceCanvas: HTMLCanvasElement;
14
+ mrzCtx: CanvasRenderingContext2D;
15
+ videoCtx: CanvasRenderingContext2D;
16
+ resizedCtx: CanvasRenderingContext2D;
17
+ borderCtx: CanvasRenderingContext2D;
18
+ faceCtx: CanvasRenderingContext2D;
19
+ classLocalCtx: CanvasRenderingContext2D;
20
+ blazeFaceCtx: CanvasRenderingContext2D;
21
+ meshFaceCtx: CanvasRenderingContext2D;
22
+ video: HTMLVideoElement;
23
+ faceOffset: IOffset;
24
+ constructor(video: HTMLVideoElement);
25
+ saveCanvas(): void;
26
+ restoreCanvas(): void;
27
+ toggleBorderCanvas(): void;
28
+ clearBorderCtx(): void;
29
+ setVideoCanvasSizes({ width, height }: ISize): void;
30
+ getBaseSizes(coefficient?: number): {
31
+ baseHeight: number;
32
+ baseWidth: number;
33
+ };
34
+ setResizedCanvas(): void;
35
+ setBorderCanvas(width: number, height: number): void;
36
+ recreateCanvas(canvas: HTMLCanvasElement): {
37
+ canvas: HTMLCanvasElement;
38
+ ctx: CanvasRenderingContext2D;
39
+ };
40
+ rectreateDistinctCanvas(canvasName: string): void;
41
+ prepareFaceCanvas(width: number, height: number): void;
42
+ drawVideo(): void;
43
+ drawResized(): void;
44
+ drawFace(): void;
45
+ recreateWorkingCanvas(): void;
46
+ drawResizedVideo(): void;
47
+ drawBbox(bbox: Bbox): void;
48
+ }
@@ -0,0 +1,12 @@
1
+ type EventCallback = (e?: Event) => void;
2
+ declare class ForceCapturingButton {
3
+ private isShowing;
4
+ private el;
5
+ private callback;
6
+ constructor();
7
+ get state(): boolean;
8
+ set state(val: boolean);
9
+ addClickCallback(cbl: EventCallback): void;
10
+ setAvailable(status: boolean): void;
11
+ }
12
+ export default ForceCapturingButton;
@@ -0,0 +1,17 @@
1
+ import { RealFaceTurnSide } from '../../types/enums/realFace';
2
+ declare class UiHints {
3
+ static holdText: HTMLSpanElement;
4
+ static arrowUpHintContainer: HTMLDivElement;
5
+ static arrowLeftHintContainer: HTMLDivElement;
6
+ static arrowRightHintContainer: HTMLDivElement;
7
+ static arrowLeftFaceTheCameraContainer: HTMLDivElement;
8
+ static arrowRightFaceTheCameraContainer: HTMLDivElement;
9
+ static currentArrowContainer: HTMLDivElement | null;
10
+ static init(): void;
11
+ static showFaceTheCameraArrows(): void;
12
+ static hideFaceTheCameraArrows(): void;
13
+ static showArrow(arrowNumber: RealFaceTurnSide, data: any, isCorrectDirection: any): void;
14
+ static hideArrows(): void;
15
+ static updateHoldText(data?: number, isCorrectDirection?: boolean): string;
16
+ }
17
+ export default UiHints;
@@ -0,0 +1,2 @@
1
+ export declare const showLimitations: (errorText: any) => void;
2
+ export declare const hideLimitations: () => void;
@@ -0,0 +1,30 @@
1
+ import { IStepModeKeys } from '../../defaultConfig';
2
+ type EventCallback = (e?: Event) => void;
3
+ export interface IManualSwitchBtn {
4
+ el: HTMLButtonElement | null;
5
+ loadingEl: HTMLDivElement | null;
6
+ containerEl: HTMLDivElement | null;
7
+ state: IStepModeKeys | null;
8
+ callback: EventCallback | null;
9
+ setLoading(status: boolean): void;
10
+ setEnabled(status: boolean): void;
11
+ setAvailable(status: boolean): void;
12
+ setState(state: IStepModeKeys): void;
13
+ addClickCallback(cbl: EventCallback): void;
14
+ setText(): void;
15
+ }
16
+ declare class ManualSwitchBtn implements IManualSwitchBtn {
17
+ el: any;
18
+ loadingEl: any;
19
+ containerEl: any;
20
+ state: any;
21
+ callback: any;
22
+ constructor(cameraSupported: boolean);
23
+ setLoading(status: boolean): void;
24
+ setEnabled(status: boolean): void;
25
+ setAvailable(status: boolean): void;
26
+ setText(): void;
27
+ setState(state: IStepModeKeys): void;
28
+ addClickCallback(cbl: EventCallback): void;
29
+ }
30
+ export default ManualSwitchBtn;
@@ -0,0 +1,7 @@
1
+ import { DocumentTypeIndex, DocumentTypeName } from '../../../environment/documentTypes';
2
+ export interface DocumentSelectEvent {
3
+ docType: DocumentTypeName;
4
+ id: 0 | DocumentTypeIndex;
5
+ }
6
+ declare const _default: ({ docType, id }: DocumentSelectEvent) => CustomEvent<DocumentSelectEvent>;
7
+ export default _default;
@@ -0,0 +1,13 @@
1
+ export declare const addSpinnerState: (bottomText?: string, topText?: string) => void;
2
+ export declare const removeSpinnerState: () => void;
3
+ export declare const clearState: () => void;
4
+ export declare const showSpinner: () => void;
5
+ export declare const hideSpinner: () => void;
6
+ declare const _default: {
7
+ addSpinnerState: (bottomText?: string, topText?: string) => void;
8
+ removeSpinnerState: () => void;
9
+ clearState: () => void;
10
+ showSpinner: () => void;
11
+ hideSpinner: () => void;
12
+ };
13
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { SwiperCallback } from '../../types/modules/ui/swiper';
2
+ declare const init: (el: HTMLElement, cbk: SwiperCallback) => void;
3
+ export default init;
@@ -0,0 +1,58 @@
1
+ import { StepType } from '../environment/stepsDescription';
2
+ import { Base64Image } from '../helpers/image';
3
+ type SubmitHandler = (base64Obj: Base64Object) => Promise<void>;
4
+ interface Base64Object {
5
+ data: ImageData | Base64Image | null;
6
+ err: boolean;
7
+ }
8
+ interface ISmallStep {
9
+ type: StepType;
10
+ img: Base64Image | null;
11
+ name?: string;
12
+ errorCode?: string | null | undefined;
13
+ }
14
+ declare class Uploader {
15
+ private onsubmit;
16
+ private onHandle;
17
+ private states;
18
+ private readonly types;
19
+ private dropArea;
20
+ private dropAreaBackground;
21
+ private fileInput;
22
+ private stepName;
23
+ private errorTextEl;
24
+ private pressToUpdate;
25
+ private readonly translation;
26
+ protected textFront: HTMLElement;
27
+ protected textBack: HTMLElement;
28
+ protected textFace: HTMLElement;
29
+ protected textPdf: HTMLElement;
30
+ protected textMrz: HTMLElement;
31
+ protected textFrontBack: HTMLElement;
32
+ protected textPass: HTMLElement;
33
+ protected textFacePosition: HTMLElement;
34
+ private moduleController;
35
+ private addedFileTypes;
36
+ constructor(uploaderId: string, type: ISmallStep, onsubmit: SubmitHandler, onHandle: () => void, moduleController: any, addedFileTypes: string[]);
37
+ checkType(typeForCheck: string): string | false;
38
+ handleFiles(data: {
39
+ target: {
40
+ files: FileList;
41
+ };
42
+ } | Event): void;
43
+ setText(): void;
44
+ /**
45
+ *
46
+ * @param {string} errorCode
47
+ */
48
+ showError(errorCode: string): void;
49
+ clearStates(): void;
50
+ resetInput(): void;
51
+ highlight(): void;
52
+ unhighlight(): void;
53
+ handleDrop(e: DragEvent): void;
54
+ changeType(step: ISmallStep): void;
55
+ transition(): void;
56
+ setDisabled(val: boolean): void;
57
+ }
58
+ export default Uploader;
@@ -0,0 +1,5 @@
1
+ import { IValidator } from '../validator';
2
+ declare class ValidateBool implements IValidator<boolean> {
3
+ validate(val: any, fallback: boolean, configName: string): boolean;
4
+ }
5
+ export default ValidateBool;
@@ -0,0 +1,20 @@
1
+ import { IDocumentType } from '../../defaultConfig';
2
+ import { DocumentTypeName } from '../../environment/documentTypes';
3
+ import { StepType } from '../../environment/stepsDescription';
4
+ import { IDocumentTypeConfig, IValidator } from '../validator';
5
+ declare class ValidateDocumentTypes implements IValidator<IDocumentType[]> {
6
+ types: any[];
7
+ steps: any[];
8
+ commonStepTypes: Set<StepType>;
9
+ documentTypes: IDocumentTypeConfig;
10
+ validate(val: IDocumentType[], fallback: IDocumentType[], configName: 'documentTypes'): {
11
+ types: any[];
12
+ steps: any[];
13
+ commonStepTypes: Set<StepType>;
14
+ documentTypes: IDocumentTypeConfig;
15
+ };
16
+ validateTypes(types: string[]): DocumentTypeName[];
17
+ transformDocType({ type, steps }: IDocumentType): void;
18
+ setCommonStepTypes(): void;
19
+ }
20
+ export default ValidateDocumentTypes;
@@ -0,0 +1,5 @@
1
+ import { IValidator } from '../validator';
2
+ declare class ValidateElement implements IValidator<string> {
3
+ validate(elId: string, defaultValue: string): string;
4
+ }
5
+ export default ValidateElement;
@@ -0,0 +1,5 @@
1
+ import { IValidator } from '../validator';
2
+ declare class ValidateFunction implements IValidator<(arg?: undefined) => boolean> {
3
+ validate(val: any, fallback: (arg?: undefined) => boolean, configName: string): any;
4
+ }
5
+ export default ValidateFunction;
@@ -0,0 +1,5 @@
1
+ import { IValidator } from '../validator';
2
+ declare class ValidateNumber implements IValidator<number> {
3
+ validate(val: number, fallback: number, configName: string): number;
4
+ }
5
+ export default ValidateNumber;
@@ -0,0 +1,5 @@
1
+ import { IValidator } from '../validator';
2
+ declare class ValidateString implements IValidator<string> {
3
+ validate(val: string, fallback: string, configName: string): string;
4
+ }
5
+ export default ValidateString;
@@ -0,0 +1,12 @@
1
+ import { IValidator } from '../validator';
2
+ declare class ValidateDistinctStringInArray implements IValidator<string> {
3
+ /**
4
+ * validates string in given array and set its value
5
+ * @param {String} valueToSet - value that should be set
6
+ * @param {String} defaultValue - fallback if value is not in given array
7
+ * @param {String} configName - name of config
8
+ * @param {String[]} availableValues - array of available values
9
+ */
10
+ validate(valueToSet: string, defaultValue: string, configName: string, availableValues: string[]): string;
11
+ }
12
+ export default ValidateDistinctStringInArray;
@@ -0,0 +1,2 @@
1
+ declare const showError: (configName: string, fallback: any) => void;
2
+ export default showError;
@@ -0,0 +1,10 @@
1
+ import { ValidationFn } from '../../defaultConfig';
2
+ import ValidateElement from './ValidateElement';
3
+ import ValidateBool from './ValidateBool';
4
+ import ValidateDistinctStringInArray from './ValidateStringInArray';
5
+ import ValidateDocumentTypes from './ValidateDocumentTypes';
6
+ import ValidateFunction from './ValidateFunction';
7
+ import ValidateNumber from './ValidateNumber';
8
+ import ValidateString from './ValidateString';
9
+ declare const validatorFactory: (name: ValidationFn) => false | ValidateElement | ValidateBool | ValidateDistinctStringInArray | ValidateDocumentTypes | ValidateFunction | ValidateNumber | ValidateString;
10
+ export default validatorFactory;
@@ -0,0 +1,12 @@
1
+ import { DocumentTypeName } from '../environment/documentTypes';
2
+ import { DefaultConfigName, IStepConfig } from '../defaultConfig';
3
+ export type IDocumentTypeConfig = {
4
+ type: DocumentTypeName;
5
+ steps: IStepConfig[];
6
+ }[];
7
+ type SimpleValidate<T> = (val: T, fallback: T, configName: DefaultConfigName) => any;
8
+ type OneOfArray<T> = (valueToSet: T, defaultValue: T, configName: DefaultConfigName, availableValues: T[]) => any;
9
+ export interface IValidator<T> {
10
+ validate: SimpleValidate<T> | OneOfArray<T>;
11
+ }
12
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare enum Provider {
2
+ WASM = "wasm",
3
+ WEBGL = "webgl"
4
+ }
@@ -0,0 +1,15 @@
1
+ /// <reference types="onnxruntime-web" />
2
+ import { Provider } from './Provider';
3
+ import NeuralModel from './neuralModel';
4
+ import { RGBColor32 } from '../helpers/image';
5
+ interface Prediction {
6
+ label: string;
7
+ score: number;
8
+ }
9
+ export default class AnglesModel extends NeuralModel {
10
+ constructor(url?: string, provider?: Provider, wasmPaths?: string);
11
+ predict(rgb: RGBColor32): Promise<import("onnxruntime-web").InferenceSession.OnnxValueMapType>;
12
+ predictFromImage(input: HTMLCanvasElement | HTMLImageElement, dstCanvas?: HTMLCanvasElement): Promise<Prediction[]>;
13
+ interpret(data: Float32Array): Prediction[];
14
+ }
15
+ export {};
@@ -0,0 +1,27 @@
1
+ import { Provider } from './Provider';
2
+ import NeuralModel from './neuralModel';
3
+ import { RGBColor32 } from '../helpers/image';
4
+ import { BlazeFaceResult } from '../types/neural models/blazeFace';
5
+ import { ICrop } from '../helpers/ts/common';
6
+ export declare const ELEMENT_NUM_OF_ANCHOR = 16;
7
+ export declare const ANCHOR_GRID_SIZE: readonly [readonly [16, 16], readonly [8, 8]];
8
+ export declare const ANCHOR_NUM: readonly [2, 6];
9
+ export default class BlazeFaceModel extends NeuralModel {
10
+ private anchorList;
11
+ private scoreList;
12
+ private regressorList;
13
+ private thresholdLogit;
14
+ private bBoxList;
15
+ private keyPoints;
16
+ private origSize;
17
+ constructor(url?: string, provider?: Provider, wasmPaths?: string);
18
+ createAnchor(): void;
19
+ processImage(crop: ICrop): BlazeFaceResult;
20
+ predict(rgb: RGBColor32): Promise<void>;
21
+ predictFromImage(input: HTMLCanvasElement | HTMLImageElement | HTMLVideoElement, dstCanvas?: HTMLCanvasElement): Promise<BlazeFaceResult>;
22
+ private getBoundingBoxes;
23
+ private calculateIoU;
24
+ private nms;
25
+ private fixInScreen;
26
+ private fillKeyPoints;
27
+ }
@@ -0,0 +1,3 @@
1
+ export type ClassLocalExitType = 'Back' | 'BackWithoutBarcode' | 'Front' | 'None';
2
+ export declare const exits: ClassLocalExitType[];
3
+ export default exits;
@@ -0,0 +1,29 @@
1
+ /// <reference types="onnxruntime-web" />
2
+ import NeuralModel from './neuralModel';
3
+ import { Provider } from './Provider';
4
+ import { RGBColor32 } from '../helpers/image';
5
+ import { ClassLocalExitType } from './classLocal/exits';
6
+ import { Bbox } from '../types/geometry';
7
+ import { IOffset, ISize } from '../helpers/ts/common';
8
+ /**
9
+ * perimeterInPercents: document perimeter in percents
10
+ */
11
+ export interface InterpretClassLocalRes {
12
+ side: ClassLocalExitType;
13
+ bbox: Bbox;
14
+ perimeterInPercents: ISize;
15
+ }
16
+ interface Prediction {
17
+ label: ClassLocalExitType;
18
+ score: number;
19
+ }
20
+ export type PredictionList = Prediction[];
21
+ export default class ClassLocalModel extends NeuralModel {
22
+ private canvasSize;
23
+ constructor(url?: string, provider?: Provider, wasmPaths?: string);
24
+ setSizes({ height, width }: ISize): void;
25
+ predict(rgb: RGBColor32): Promise<import("onnxruntime-web").InferenceSession.OnnxValueMapType>;
26
+ predictFromImage(input: HTMLCanvasElement | HTMLImageElement, dstCanvas?: HTMLCanvasElement, offsets?: IOffset, cropSizes?: ISize): Promise<any[] | InterpretClassLocalRes>;
27
+ interpret(classifierData: Float32Array, bboxData: Float32Array): InterpretClassLocalRes;
28
+ }
29
+ export {};
@@ -0,0 +1,17 @@
1
+ import NeuralModel from './neuralModel';
2
+ import { Provider } from './Provider';
3
+ import { RGBColor32 } from '../helpers/image';
4
+ import { IBoundingBbox, KeyPointList } from '../types/neural models/blazeFace';
5
+ import { FaceMeshPrediction } from '../types/neural models/meshFace';
6
+ import { ICrop, ISize } from '../helpers/ts/common';
7
+ export default class MeshFaceModel extends NeuralModel {
8
+ origSize: ISize;
9
+ crop: ICrop;
10
+ landmarkList: Float32Array;
11
+ keypointList: KeyPointList;
12
+ constructor(url?: string, provider?: Provider, wasmPaths?: string);
13
+ preProcess(bbox: IBoundingBbox): void;
14
+ predict(rgb: RGBColor32): Promise<FaceMeshPrediction>;
15
+ prepareMesh(src: HTMLCanvasElement, dst: HTMLCanvasElement): ImageData;
16
+ predictFromImage(input: HTMLCanvasElement | HTMLImageElement, dstCanvas?: HTMLCanvasElement): Promise<FaceMeshPrediction>;
17
+ }
@@ -0,0 +1,20 @@
1
+ import { InferenceSession } from 'onnxruntime-web';
2
+ import NeuralModel from './neuralModel';
3
+ import { Provider } from './Provider';
4
+ import { RGBColor32 } from '../helpers/image';
5
+ interface Prediction {
6
+ value: string;
7
+ confidence: number;
8
+ }
9
+ export type PredictionList = Prediction[];
10
+ export default class MrzModel extends NeuralModel {
11
+ promiseList: Promise<InferenceSession.OnnxValueMapType>[];
12
+ predictionList: PredictionList[];
13
+ constructor(url?: string, provider?: Provider, wasmPaths?: string);
14
+ predict(rgb: RGBColor32): Promise<InferenceSession.OnnxValueMapType>;
15
+ predictFromArray(input: Float32Array, batchSize: number): Promise<PredictionList[]>;
16
+ interpret(data: Float32Array): PredictionList;
17
+ get isLoading(): boolean;
18
+ predictFromImage(input: any, dstCanvas: any): void;
19
+ }
20
+ export {};
@@ -0,0 +1,18 @@
1
+ import { InferenceSession } from 'onnxruntime-web';
2
+ import { Provider } from './Provider';
3
+ import { RGBColor32 } from '../helpers/image';
4
+ declare abstract class NeuralModel {
5
+ private readonly model;
6
+ private readonly provider;
7
+ protected loading: boolean;
8
+ protected session: InferenceSession;
9
+ protected uri: string;
10
+ constructor(model?: string, provider?: Provider, url?: string);
11
+ prepareUri(url: string): void;
12
+ initWasmPath(): void;
13
+ initWasm(): Promise<void>;
14
+ init(): Promise<void>;
15
+ abstract predict(rgb: RGBColor32): any;
16
+ abstract predictFromImage(input: HTMLCanvasElement | HTMLImageElement, dstCanvas?: HTMLCanvasElement): unknown;
17
+ }
18
+ export default NeuralModel;
@@ -0,0 +1,7 @@
1
+ import NeuralModel from './neuralModel';
2
+ import { RGBColor32 } from '../helpers/image';
3
+ export default class Preload extends NeuralModel {
4
+ constructor(wasmPaths: any);
5
+ predict(rgb: RGBColor32): void;
6
+ predictFromImage(input: HTMLCanvasElement | HTMLImageElement, dstCanvas?: HTMLCanvasElement): unknown;
7
+ }
@@ -0,0 +1,27 @@
1
+ export declare const generateSteps: () => void;
2
+ export declare const updateSteps: () => void;
3
+ export declare const changeStep: (nextStepNumber: number) => void;
4
+ export declare const getNextStep: () => number;
5
+ export declare const changeStepAuto: () => void;
6
+ export declare const updateStepImgCallback: () => void;
7
+ export declare const submitIfFullSteps: (payload?: {}) => void;
8
+ export declare const resetStepResults: (stepIndex?: number) => void;
9
+ export declare const again: () => void;
10
+ export declare const setStepImage: () => Promise<void>;
11
+ /**
12
+ * emits change function,
13
+ * emit change step function and
14
+ * emit submit function if all steps filled with image
15
+ * @param {Boolean} isNeedToChangeStep - is need to change step
16
+ */
17
+ export declare const emitCurrentStepChangeImage: (isNeedToChangeStep?: boolean) => void;
18
+ declare const _default: {
19
+ changeStepAuto: () => void;
20
+ updateStepImgCallback: () => void;
21
+ generateSteps: () => void;
22
+ submitIfFullSteps: (payload?: {}) => void;
23
+ again: () => void;
24
+ resetStepResults: (stepIndex?: number) => void;
25
+ updateSteps: () => void;
26
+ };
27
+ export default _default;
@@ -0,0 +1,4 @@
1
+ export declare enum RealFaceTurnSide {
2
+ LEFT = 0,
3
+ RIGHT = 1
4
+ }
@@ -0,0 +1,18 @@
1
+ export declare enum CameraType {
2
+ Back = "environment",
3
+ Front = "user"
4
+ }
5
+ export declare enum CameraNotSupportedReason {
6
+ /** navigator.mediaDevices.getUserMedia
7
+ * is not supported by current browser for current context.
8
+ * */
9
+ MediaDevicesNotSupported = "MediaDevicesNotSupported",
10
+ /** Camera with requested features is not available on current device. */
11
+ CameraNotFound = "CameraNotFound",
12
+ /** Camera access was not granted by the user. */
13
+ CameraNotAllowed = "CameraNotAllowed",
14
+ /** Unable to start playing because camera is already in use. */
15
+ CameraInUse = "CameraInUse",
16
+ /** Camera is currently not available due to a OS or hardware error. */
17
+ CameraNotAvailable = "CameraNotAvailable"
18
+ }