@idscan/idvc2 3.5.0 → 3.7.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.
Files changed (30) hide show
  1. package/README.md +7 -0
  2. package/dist/idvc.js +1 -1
  3. package/dist/idvc.js.gzip +0 -0
  4. package/dist/index.html +1 -0
  5. package/dist/js/defaultConfig.ts +12 -3
  6. package/dist/js/environment/langs.js +1 -1
  7. package/dist/langs.js.gzip +0 -0
  8. package/dist/networks/Face-chunk.js +1 -1
  9. package/dist/types/defaultConfig.d.ts +3 -3
  10. package/dist/types/environment/langs.d.ts +4 -1
  11. package/dist/types/modules/App/UI.d.ts +6 -0
  12. package/dist/types/modules/App/getCameraDevice.d.ts +8 -0
  13. package/dist/types/modules/Config.d.ts +1 -1
  14. package/dist/types/modules/Step.d.ts +5 -5
  15. package/dist/types/modules/ui/CameraSelectScreen/CameraSelectScreen.d.ts +14 -0
  16. package/dist/types/modules/ui/CameraSelectScreen/camera-select-screen-template.d.ts +4 -0
  17. package/dist/types/modules/ui/ControlButton/ControlButton.d.ts +1 -1
  18. package/dist/types/modules/ui/ControlButton/index.d.ts +2 -0
  19. package/dist/types/modules/ui/MainScreen/MainScreen.d.ts +2 -0
  20. package/dist/types/modules/ui/MainScreen/select-camera-template.d.ts +5 -0
  21. package/dist/types/modules/ui/MainScreen/select-camera.d.ts +17 -0
  22. package/dist/types/modules/ui/VideoWrapper/CanvasWrapper.d.ts +2 -2
  23. package/dist/types/modules/ui/VideoWrapper/CaptureButton.d.ts +15 -0
  24. package/dist/types/modules/ui/VideoWrapper/{VideoRecorderService.d.ts → MultiImagesRecorderService.d.ts} +2 -2
  25. package/dist/types/modules/ui/VideoWrapper/VideoWrapper.d.ts +3 -4
  26. package/dist/types/modules/ui/cameraSelectedEvent.d.ts +1 -0
  27. package/dist/types/modules/validation/ValidateAllowCameraSelection.d.ts +5 -0
  28. package/dist/types/modules/validation/validatorFactory.d.ts +2 -1
  29. package/dist/types/types/context.d.ts +1 -0
  30. package/package.json +1 -1
@@ -4,7 +4,7 @@ import { StepType } from './environment/stepsDescription';
4
4
  import { AllLabels, supportedLanguages } from './environment/langs';
5
5
  import { ModalPositionKeys } from './environment/modalPosition';
6
6
  import { DeepPartial } from './types/helpers/DeepPartial';
7
- export type ValidationFn = 'validateElement' | 'validateString' | 'validateDocumentTypes' | 'validateDistinctStringInArray' | 'validateNumber' | 'validateFunction' | 'ValidateDictionaryLangMatch' | 'validateBool';
7
+ export type ValidationFn = 'validateElement' | 'validateString' | 'validateDocumentTypes' | 'validateDistinctStringInArray' | 'validateNumber' | 'validateFunction' | 'ValidateDictionaryLangMatch' | 'validateBool' | 'validateAllowCameraSelection';
8
8
  type DefaultValueFunction = () => boolean;
9
9
  export type NormalizedType = 'Path';
10
10
  /**
@@ -23,7 +23,7 @@ export type StepConfig = {
23
23
  autocaptureDelay?: number;
24
24
  enableDesktopNotification?: boolean;
25
25
  enableFourCornerCapture?: boolean;
26
- shouldRecordVideo?: boolean;
26
+ shouldRecordMultiImages?: boolean;
27
27
  delayUntilCaptureButtonVisible?: number;
28
28
  };
29
29
  export type DocumentType = {
@@ -33,7 +33,7 @@ export type DocumentType = {
33
33
  tooltipText?: string;
34
34
  };
35
35
  type ImageURI = 'png' | 'jpeg' | 'webp';
36
- export type DefaultConfigName = 'el' | 'licenseKey' | 'networkUrl' | 'language' | 'customTranslations' | 'documentTypes' | 'realFaceMode' | 'modalPosition' | 'resizeUploadedImage' | 'showSubmitBtn' | 'isShowDocumentTypeSelect' | 'useCDN' | 'processingImageFormat' | 'allowSubmitWithWarnings' | 'autocaptureConfidence' | 'autoContinue' | 'autoStart' | 'playPreviewAnimations' | 'autocaptureDelay' | 'fixFrontOrientAfterUpload' | 'onChange' | 'onReset' | 'submit' | 'onRetakeHook' | 'onCameraError' | 'onMounted' | 'onDocumentTypeSelect' | 'onReloaded';
36
+ export type DefaultConfigName = 'el' | 'licenseKey' | 'networkUrl' | 'language' | 'customTranslations' | 'documentTypes' | 'realFaceMode' | 'modalPosition' | 'resizeUploadedImage' | 'showSubmitBtn' | 'isShowDocumentTypeSelect' | 'useCDN' | 'processingImageFormat' | 'allowSubmitWithWarnings' | 'autocaptureConfidence' | 'autoContinue' | 'autoStart' | 'playPreviewAnimations' | 'autocaptureDelay' | 'fixFrontOrientAfterUpload' | 'onChange' | 'onReset' | 'submit' | 'onRetakeHook' | 'onCameraError' | 'onMounted' | 'onDocumentTypeSelect' | 'onReloaded' | 'allowCameraSelection';
37
37
  /**
38
38
  * IDefaultConfig
39
39
  * @param {string} name,
@@ -1,7 +1,7 @@
1
1
  import { CameraNotSupportedReason } from '../types/modules/camera.enum';
2
2
  type LabelGroup = 'errorCodes' | 'hintTexts' | 'keyErrors' | 'general' | 'uploaderDescription' | 'documentsTypes' | 'loaderText';
3
3
  type AllTypes = IErrorCodes | IHintTexts | KeyError | IGeneral | IDocumentsTypes | IUploaderDescription | ISpinnerText;
4
- type Label = Record<LabelGroup, AllTypes>;
4
+ export type Label = Record<LabelGroup, AllTypes>;
5
5
  export type AllLabels = Record<SupportedLanguage, Label>;
6
6
  type KeyError = string[];
7
7
  type GetTranslation = {
@@ -112,12 +112,15 @@ interface IGeneral {
112
112
  continue: string;
113
113
  capture: string;
114
114
  retake: string;
115
+ showCameraSelectionModal: string;
115
116
  };
116
117
  desktopNotification: {
117
118
  barcode: string;
118
119
  mrz: string;
119
120
  other: string;
120
121
  };
122
+ noAvailableCameras: string;
123
+ selectCameraDevice: string;
121
124
  documentType: string;
122
125
  selectDocumentTypeText: string;
123
126
  changeBtn: string;
@@ -7,15 +7,20 @@ import { StepsScreen } from '../ui/StepsList/StepsScreen';
7
7
  import { IDVCVersionPlank } from '../ui/IDVCVersionPlank/IDVCVersionPlank';
8
8
  import { AnimationSettings, Notification, NotificationState } from '../ui/Notification/Notification';
9
9
  import type { Context } from '../../types/context';
10
+ import { InitCameraScreen } from '../ui/CameraSelectScreen/CameraSelectScreen';
11
+ import { SelectCamera } from '../ui/MainScreen/select-camera';
10
12
  export declare class WeblibUI {
11
13
  mountElement: HTMLElement;
12
14
  mainScreen: MainScreen;
13
15
  loader: Loader;
14
16
  selectDocumentType: SelectDocumentType;
17
+ selectCamera: SelectCamera;
15
18
  initScreen: InitScreen;
19
+ initCameraScreen: InitCameraScreen;
16
20
  stepsScreen: StepsScreen;
17
21
  idvcVersionContainer: IDVCVersionPlank;
18
22
  constructor(mountElement: HTMLElement);
23
+ private initCamera;
19
24
  remountUI(): void;
20
25
  createNotification(notificationContainer: HTMLElement, { status, message, }: NotificationState, animationSettings: AnimationSettings): Notification;
21
26
  updateResetButton({ steps, }: Context): void;
@@ -36,6 +41,7 @@ export declare class WeblibUI {
36
41
  private mainScreenEditButtonClick;
37
42
  private mainScreenControlButtonClick;
38
43
  private stepsListControlButtonClick;
44
+ private onChangedCamera;
39
45
  private initStepsListScreen;
40
46
  switchComponentMode(mode: 'uploader' | 'video'): void;
41
47
  private switchCapturingMode;
@@ -0,0 +1,8 @@
1
+ export declare const getCameraDevices: () => Promise<{
2
+ deviceId: string;
3
+ groupId: string;
4
+ kind: MediaDeviceKind;
5
+ label: string;
6
+ toJSON: any;
7
+ }[]>;
8
+ export declare const checkHasCameraDevices: (devices: Array<MediaDeviceInfo>) => boolean;
@@ -152,7 +152,7 @@ declare class Config implements IConfig {
152
152
  realFaceMode: "all" | "auto" | "none";
153
153
  language: any;
154
154
  constructor(configObject: IConfig);
155
- getFunction(validationFn: ValidationFn): false | import("./validation/ValidateElement").default | import("./validation/ValidateBool").default | import("./validation/ValidateStringInArray").default | ValidateDocumentTypes | import("./validation/ValidateFunction").default | import("./validation/ValidateNumber").default | import("./validation/ValidateString").default | import("./validation/ValidateDictionaryLangMatch").default<Record<string, unknown>>;
155
+ getFunction(validationFn: ValidationFn): false | import("./validation/ValidateElement").default | import("./validation/ValidateBool").default | import("./validation/ValidateStringInArray").default | ValidateDocumentTypes | import("./validation/ValidateFunction").default | import("./validation/ValidateNumber").default | import("./validation/ValidateString").default | import("./validation/ValidateAllowCameraSelection").default | import("./validation/ValidateDictionaryLangMatch").default<Record<string, unknown>>;
156
156
  validate(configObject: IConfig): void;
157
157
  normalize(configObject: IConfig): void;
158
158
  }
@@ -20,7 +20,7 @@ export interface IStepObj {
20
20
  time?: number;
21
21
  configs?: StepConfig[];
22
22
  stepTypeImageName: StepTypeImageName;
23
- shouldRecordVideo?: boolean;
23
+ shouldRecordMultiImages?: boolean;
24
24
  delayUntilCaptureButtonVisible?: number;
25
25
  }
26
26
  export interface IStepCallback {
@@ -28,8 +28,8 @@ export interface IStepCallback {
28
28
  img: Base64Image | null;
29
29
  /** blob step image */
30
30
  blob: Blob | null;
31
- /** blob step video */
32
- videoBlob?: Blob | null;
31
+ /** blob step MultiImages */
32
+ multiImagesBlob?: Blob | null;
33
33
  /** step type */
34
34
  type: StepType;
35
35
  /** is it autocaptured from camera */
@@ -51,7 +51,7 @@ export interface IStepCallback {
51
51
  }
52
52
  export default class Step implements IStepCallback, IStepObj {
53
53
  blob: Blob | null;
54
- videoBlob: Blob | null;
54
+ multiImagesBlob: Blob | null;
55
55
  errorCode: ErrorCodes | null | undefined;
56
56
  mrzText?: string;
57
57
  mrzImg?: Base64Image | null;
@@ -68,7 +68,7 @@ export default class Step implements IStepCallback, IStepObj {
68
68
  img: Base64Image | null;
69
69
  cameraInfo: Record<string, any>;
70
70
  stepTypeImageName: StepTypeImageName;
71
- shouldRecordVideo: boolean;
71
+ shouldRecordMultiImages: boolean;
72
72
  delayUntilCaptureButtonVisible?: number;
73
73
  constructor(nameOrObj: string | IStepObj, type?: StepType, camera?: VideoFacingModeEnum, time?: number, img?: Base64Image | null);
74
74
  get isShowManualSwitchButton(): boolean;
@@ -0,0 +1,14 @@
1
+ import { ComponentLit } from '../ComponentLit';
2
+ export type InitScreenState = {
3
+ devices: Array<MediaDeviceInfo>;
4
+ isHidden: boolean;
5
+ };
6
+ export type InitScreenEvents = {
7
+ onDeviceClick?: (res: MediaDeviceInfo) => void;
8
+ };
9
+ export declare class InitCameraScreen extends ComponentLit<InitScreenState> {
10
+ constructor(mountElement: HTMLElement | string, state: InitScreenState, events?: InitScreenEvents);
11
+ protected renderTemplate(): void;
12
+ setHidden: (newValue: boolean) => void;
13
+ handleDocumentClick: (event: Event) => void;
14
+ }
@@ -0,0 +1,4 @@
1
+ import { TemplateResult } from 'lit-html';
2
+ export declare const InitScreenTemplate: (state: any, handlers: {
3
+ onDeviceClick: (e: Event) => void;
4
+ }) => TemplateResult;
@@ -1,6 +1,6 @@
1
1
  import { ComponentLit } from '../ComponentLit';
2
2
  export type ControlButtonState = {
3
- type: 'start' | 'upload' | 'reset' | 'submit' | 'back' | 'edit' | 'continue' | 'capture' | 'retake';
3
+ type: 'start' | 'upload' | 'reset' | 'submit' | 'back' | 'edit' | 'continue' | 'capture' | 'retake' | 'showCameraSelectionModal';
4
4
  disabled: boolean;
5
5
  hidden: boolean;
6
6
  isMirroringIcon?: boolean;
@@ -0,0 +1,2 @@
1
+ export { ControlButton } from './ControlButton';
2
+ export type { ControlButtonClickedCustomEvent, ControlButtonEvents } from './ControlButton';
@@ -18,6 +18,7 @@ export type MainScreenUIEvents = {
18
18
  onEditButtonClick: (event: ControlButtonClickedCustomEvent) => void;
19
19
  onContinueButtonClick: (event: ControlButtonClickedCustomEvent) => void;
20
20
  onBackButtonClick: (event: ControlButtonClickedCustomEvent) => void;
21
+ onShowCameraSelectionModal: (event: ControlButtonClickedCustomEvent) => void;
21
22
  };
22
23
  export declare class MainScreen {
23
24
  mountElement: HTMLElement;
@@ -33,6 +34,7 @@ export declare class MainScreen {
33
34
  captureButtonsMountElement: HTMLElement;
34
35
  notificationContainer: HTMLElement;
35
36
  backButton: ControlButton;
37
+ showCameraSelectionButton: ControlButton;
36
38
  editButton: ControlButton;
37
39
  continueButton: ControlButton;
38
40
  messageBox: MessageBox;
@@ -0,0 +1,5 @@
1
+ import { TemplateResult } from 'lit-html';
2
+ export declare const SelectCameraTemplate: (state: any, handlers: {
3
+ hide: (e: Event) => void;
4
+ onClickCamera: (cam: MediaDeviceInfo) => void;
5
+ }) => TemplateResult;
@@ -0,0 +1,17 @@
1
+ import { ComponentLit, StateBase, Events } from '../ComponentLit';
2
+ export type SelectCameraState = StateBase & {
3
+ cameras: MediaDeviceInfo[];
4
+ selectedCamera: MediaDeviceInfo;
5
+ };
6
+ export type SelectCameraEvents = Events & {
7
+ onCameraChange: () => void;
8
+ };
9
+ export declare class SelectCamera extends ComponentLit<SelectCameraState> {
10
+ private modal;
11
+ events: SelectCameraEvents;
12
+ constructor(mountElement: HTMLElement, state: SelectCameraState, events?: SelectCameraEvents);
13
+ setCameras(cameras: MediaDeviceInfo[], selectedCamera?: MediaDeviceInfo): void;
14
+ private handleChange;
15
+ show(): Promise<void>;
16
+ protected renderTemplate(): void;
17
+ }
@@ -25,12 +25,12 @@ export declare class CanvasWrapper {
25
25
  private readonly faceOffset;
26
26
  private readonly canvasNames;
27
27
  private readonly canvasCtxNames;
28
- private videoRecorder;
28
+ private multiImagesRecorder;
29
29
  constructor(componentWrapper: HTMLElement, video: HTMLVideoElement);
30
30
  saveCanvas(): void;
31
31
  restoreCanvas(): void;
32
32
  toggleBorderCanvas(currentStepType: StepType, isStarted: boolean): void;
33
- toggleRecordVideo(currentStepObj: Step, isStarted: boolean): void;
33
+ toggleRecordMultiImages(currentStepObj: Step, isStarted: boolean): void;
34
34
  clearBorderCtx(): void;
35
35
  setVideoCanvasSizes({ width, height }: Size): void;
36
36
  getBaseSizes(coefficient?: number): {
@@ -0,0 +1,15 @@
1
+ import { ControlButtonEvents } from '../ControlButton';
2
+ export interface ICaptureButton {
3
+ setStart(): void;
4
+ setStop(): void;
5
+ }
6
+ export declare class CaptureButton implements ICaptureButton {
7
+ private controlButton;
8
+ private readonly checkIsCameraErrorVisible;
9
+ constructor(element: HTMLElement, onClick: ControlButtonEvents, checkIsCameraErrorVisible: () => boolean);
10
+ private timeout;
11
+ private showCaptureButtonTimeout;
12
+ private setVisible;
13
+ setStart: () => void;
14
+ setStop: () => void;
15
+ }
@@ -1,7 +1,7 @@
1
- export declare class VideoRecorderService {
1
+ export declare class MultiImagesRecorderService {
2
2
  private mediaRecorder;
3
3
  private recordedBlobs;
4
- private videoType;
4
+ private multiImagesType;
5
5
  startRecording(canvas: HTMLCanvasElement): void;
6
6
  stopRecording(): void;
7
7
  private handleDataAvailable;
@@ -4,8 +4,8 @@ import { CanvasWrapper } from './CanvasWrapper';
4
4
  import { UiHints } from './UIHints';
5
5
  import Step from '../../Step';
6
6
  import { StepPreview } from './StepPreview/StepPreview';
7
- import { ControlButton } from '../ControlButton/ControlButton';
8
7
  import { StatusPlank } from '../StatusPlank/StatusPlank';
8
+ import { ICaptureButton } from './CaptureButton';
9
9
  export type UpdateVideoWrapParams = {
10
10
  currentStepImg: string;
11
11
  currentStepObj: Step;
@@ -18,7 +18,7 @@ export declare class VideoWrapper {
18
18
  canvasWrapper: CanvasWrapper;
19
19
  hints: UiHints;
20
20
  stepPreview: StepPreview;
21
- captureButton: ControlButton;
21
+ captureButton: ICaptureButton;
22
22
  statusPlank: StatusPlank;
23
23
  video: HTMLVideoElement;
24
24
  videoWrap: HTMLDivElement;
@@ -31,7 +31,6 @@ export declare class VideoWrapper {
31
31
  private cameraErrorHeader;
32
32
  private cameraErrorText;
33
33
  private UIComponents;
34
- private isShowDemandButton;
35
34
  constructor(componentWrapper: HTMLElement);
36
35
  updateVideoWrap({ currentStepImg, currentStepObj, }: UpdateVideoWrapParams): void;
37
36
  setMirroring(isMirroring: boolean): void;
@@ -40,11 +39,11 @@ export declare class VideoWrapper {
40
39
  setFakeContourStyles(width: number): void;
41
40
  hideVideoError(): void;
42
41
  showVideoError(errorCode: string): void;
43
- setCaptureButtonHidden(newValue: boolean): void;
44
42
  private init;
45
43
  setCameraErrorText(header: string, text: string): void;
46
44
  showCameraError(): void;
47
45
  hideCameraError(): void;
46
+ checkIsCameraErrorVisible: () => boolean;
48
47
  changeType(step: Step): void;
49
48
  remountUIComponents(): void;
50
49
  private getFakeContourWidth;
@@ -0,0 +1 @@
1
+ export declare const selectedCameraEvent: (selectedCamera: MediaDeviceInfo) => CustomEvent<MediaDeviceInfo>;
@@ -0,0 +1,5 @@
1
+ import { IValidator } from '../validator';
2
+ declare class ValidateAllowCameraSelection implements IValidator<boolean> {
3
+ validate(val: unknown, fallback: boolean, configName: string): boolean;
4
+ }
5
+ export default ValidateAllowCameraSelection;
@@ -7,5 +7,6 @@ import ValidateDocumentTypes from './ValidateDocumentTypes';
7
7
  import ValidateFunction from './ValidateFunction';
8
8
  import ValidateNumber from './ValidateNumber';
9
9
  import ValidateString from './ValidateString';
10
- declare const validatorFactory: (name: ValidationFn) => false | ValidateElement | ValidateBool | ValidateDistinctStringInArray | ValidateDocumentTypes | ValidateFunction | ValidateNumber | ValidateString | ValidateDictionaryLangMatch<Record<string, unknown>>;
10
+ import ValidateAllowCameraSelection from './ValidateAllowCameraSelection';
11
+ declare const validatorFactory: (name: ValidationFn) => false | ValidateElement | ValidateBool | ValidateDistinctStringInArray | ValidateDocumentTypes | ValidateFunction | ValidateNumber | ValidateString | ValidateAllowCameraSelection | ValidateDictionaryLangMatch<Record<string, unknown>>;
11
12
  export default validatorFactory;
@@ -41,6 +41,7 @@ export type Context = {
41
41
  loggerController: LoggerController | null;
42
42
  browser?: BrowserInfo;
43
43
  browserMajorVersion?: number;
44
+ selectedCamera?: MediaDeviceInfo;
44
45
  steps: Step[];
45
46
  currentStepType: StepType;
46
47
  currentStepCamera: VideoFacingModeEnum;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idscan/idvc2",
3
- "version": "3.5.0",
3
+ "version": "3.7.0",
4
4
  "description": "component for the capturing documents",
5
5
  "main": "dist/idvc.js",
6
6
  "types": "dist/types/idvc.d.ts",