@ahmed_hani/dot-document-auto-capture 7.7.0 → 8.0.1

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.
@@ -0,0 +1,34 @@
1
+ import type { CallbackImage, ObjectValues } from '../../../ui-common/src/types/common';
2
+ export declare const CameraFacingMode: {
3
+ readonly FRONT: "user";
4
+ readonly BACK: "environment";
5
+ };
6
+ export type CameraFacingModeValues = ObjectValues<typeof CameraFacingMode>;
7
+ export declare const CaptureMode: {
8
+ readonly AUTO_CAPTURE: "AUTO_CAPTURE";
9
+ readonly WAIT_FOR_REQUEST: "WAIT_FOR_REQUEST";
10
+ };
11
+ export type CaptureModeValues = ObjectValues<typeof CaptureMode>;
12
+ export type CameraConfiguration = {
13
+ facingMode?: CameraFacingModeValues;
14
+ isVideoCaptureEnabled?: boolean;
15
+ };
16
+ export type CommonConfiguration = {
17
+ assetsDirectoryPath?: string;
18
+ captureMode?: CaptureModeValues;
19
+ sessionToken?: string;
20
+ styleTarget?: HTMLElement;
21
+ transactionCountingToken?: string;
22
+ };
23
+ export type CallbackConfiguration<TDetectedObject> = {
24
+ onComplete: (imageData: CallbackImage<TDetectedObject>, content: Uint8Array) => void;
25
+ onError: (e: Error) => void;
26
+ };
27
+ export type AutoCaptureConfiguration = {
28
+ candidateSelectionDurationMillis?: number;
29
+ };
30
+ export type BaseConfiguration<TDetectedObject, TQualityAttributeThresholds> = CommonConfiguration & CallbackConfiguration<TDetectedObject> & {
31
+ autoCapture?: AutoCaptureConfiguration;
32
+ camera?: CameraConfiguration;
33
+ qualityAttributeThresholds?: TQualityAttributeThresholds;
34
+ };
@@ -1,4 +1,6 @@
1
- import type { BaseCameraProps, CustomElement, DetectedDocument, Resolution } from '../../../ui-common/src/types';
1
+ import type { BaseConfiguration } from './configuration';
2
+ import type { CallbackImage, CustomElement, MaxInterval, MinInterval, MinOrMaxInterval, Resolution } from '../../../ui-common/src/types';
3
+ import type { DetectedDocument } from '../../../ui-common/src/types/modality/detection/document';
2
4
  export * from '../../../ui-common/src/types/common';
3
5
  export * from '../../../ui-common/src/types/document';
4
6
  export * from '../../../ui-common/src/error';
@@ -9,35 +11,33 @@ declare global {
9
11
  namespace preact.JSX {
10
12
  interface IntrinsicElements {
11
13
  'x-dot-document-auto-capture': CustomElement<{
12
- cameraOptions: DocumentCameraProps;
14
+ configuration: DocumentConfiguration;
13
15
  }>;
14
16
  }
15
17
  }
16
18
  namespace React.JSX {
17
19
  interface IntrinsicElements {
18
20
  'x-dot-document-auto-capture': CustomElement<{
19
- cameraOptions: DocumentCameraProps;
21
+ configuration: DocumentConfiguration;
20
22
  }>;
21
23
  }
22
24
  }
23
25
  }
24
26
  export type HTMLDocumentCaptureElement = HTMLElement & {
25
- cameraOptions: DocumentCameraProps;
27
+ configuration: DocumentConfiguration;
26
28
  };
27
29
  export type DocumentComponentData = {
28
30
  detection: DetectedDocument;
29
31
  imageResolution: Resolution;
30
32
  };
31
33
  export type DocumentThresholds = {
32
- brightnessHighThreshold?: number;
33
- brightnessLowThreshold?: number;
34
- confidenceThreshold?: number;
35
- hotspotsScoreThreshold?: number;
36
- outOfBoundsThreshold?: number;
37
- sharpnessThreshold?: number;
38
- sizeSmallThreshold?: number;
34
+ brightness?: MinOrMaxInterval;
35
+ confidence?: MinInterval;
36
+ edgeDistanceToImageShorterSideRatio?: MinInterval;
37
+ hotspotsScore?: MaxInterval;
38
+ sharpness?: MinInterval;
39
+ size?: MinInterval;
39
40
  };
40
- export type DocumentCameraProps = BaseCameraProps<DetectedDocument> & {
41
- thresholds?: DocumentThresholds;
42
- };
43
- export type DocumentCallback = DocumentCameraProps['onPhotoTaken'];
41
+ export type DocumentConfiguration = BaseConfiguration<DetectedDocument, DocumentThresholds>;
42
+ export type DocumentOnCompleteCallbackImage = CallbackImage<DetectedDocument>;
43
+ export type DocumentOnCompleteCallback = DocumentConfiguration['onComplete'];
package/events.mjs CHANGED
@@ -1,51 +1,44 @@
1
- const u = {};
2
- u.CONTINUE_DETECTION = "continue-detection", u.SWITCH_CAMERA = "switch-camera", u.TOGGLE_MIRROR = "toggle-mirror";
3
- const l = u, s = {};
4
- s.FIRST_FRAME = "first-frame", s.FIRST_VALID_FRAME = "first-valid-frame";
5
- const G = s, N = {};
6
- N.REQUEST_CAPTURE = "dot-custom-event:request-capture";
7
- const i = N;
8
- var R = ((t) => (t.CAMERA_PROPS_CHANGED = "document-auto-capture:camera-props-changed", t.CONTROL = "document-auto-capture:control", t.DETECTED_DOCUMENT_CHANGED = "document-auto-capture:detected-document-changed", t.DOCUMENT_DETECTION = "document-auto-capture:document-detection", t.INSTRUCTION_CHANGED = "document-auto-capture:instruction-changed", t.INSTRUCTION_ESCALATED = "document-auto-capture:instruction-escalated", t.STATE_CHANGED = "document-auto-capture:state-changed", t.VIDEO_ELEMENT_SIZE = "document-auto-capture:video-element-size", t))(R || {}), p = ((t) => (t.CAMERA_PROPS_CHANGED = "face-auto-capture:camera-props-changed", t.CONTROL = "face-auto-capture:control", t.DETECTED_FACE_CHANGED = "face-auto-capture:detected-face-changed", t.FACE_DETECTION = "face-auto-capture:face-detection", t.INSTRUCTION_CHANGED = "face-auto-capture:instruction-changed", t.STATE_CHANGED = "face-auto-capture:state-changed", t.VIDEO_ELEMENT_SIZE = "face-auto-capture:video-element-size", t))(p || {}), A = ((t) => (t.ANIMATION_END = "magnifeye-auto-capture:animation-end", t.CONTROL = "magnifeye-auto-capture:control", t.STATUS_CHANGED = "magnifeye-auto-capture:status-changed", t))(A || {}), S = ((t) => (t.CONTROL = "smile-auto-capture:control", t.INSTRUCTION_ESCALATED = "smile:instruction-escalated", t.STATUS_CHANGED = "smile-auto-capture:status-changed", t))(S || {}), m = ((t) => (t.CAMERA_PROPS_CHANGED = "palm-capture:camera-props-changed", t.CONTROL = "palm-capture:control", t.DETECTED_PALM_CHANGED = "palm-capture:detected-palm-changed", t.INSTRUCTION_CHANGED = "palm-capture:instruction-changed", t.STATE_CHANGED = "palm-capture:state-changed", t.VIDEO_ELEMENT_SIZE = "palm-capture:video-element-size", t))(m || {}), d = ((t) => (t.CONTROL = "eye-gaze-auto-capture:control", t.STATUS_CHANGED = "eye-gaze-auto-capture:status-changed", t))(d || {});
9
- const O = (t, c) => {
1
+ const _ = {};
2
+ _.CONTINUE_DETECTION = "continue-detection", _.SWITCH_CAMERA = "switch-camera", _.TOGGLE_MIRROR = "toggle-mirror";
3
+ const R = _, T = {};
4
+ T.FIRST_FRAME = "first-frame", T.FIRST_VALID_FRAME = "first-valid-frame";
5
+ const I = T, u = {};
6
+ u.REQUEST_CAPTURE = "dot-custom-event:request-capture";
7
+ const N = u, r = (t, s) => {
10
8
  const n = {};
11
- n.detail = c, document.dispatchEvent(new CustomEvent(t, n));
12
- }, g = (t, c) => {
9
+ n.detail = s, document.dispatchEvent(new CustomEvent(t, n));
10
+ }, d = (t, s) => {
13
11
  const n = {};
14
- n.instruction = c, O(t, n);
12
+ n.instruction = s, r(t, n);
15
13
  };
16
- function h(t) {
17
- const c = {};
18
- c.instruction = t;
19
- const n = c;
20
- O(i.REQUEST_CAPTURE, n);
14
+ function m(t) {
15
+ const s = {};
16
+ s.instruction = t;
17
+ const n = s;
18
+ r(N.REQUEST_CAPTURE, n);
21
19
  }
22
- const T = {};
23
- T.FRONT = "user", T.REAR = "environment";
24
- const H = T, r = {};
25
- r.AUTO_CAPTURE = "AUTO_CAPTURE", r.WAIT_FOR_REQUEST = "WAIT_FOR_REQUEST";
26
- const U = r, E = {};
27
- E.LOADING = "LOADING", E.ERROR = "ERROR", E.WAITING = "WAITING", E.RUNNING = "RUNNING", E.COMPLETE = "COMPLETE";
28
- const I = E, C = { ...I };
29
- C.DONE = "DONE";
30
- const v = C, _ = {};
31
- _.EYE_NOT_PRESENT = "eye_not_present";
32
- const M = _, e = {};
33
- e.CANDIDATE_SELECTION = "candidate_selection", e.DOCUMENT_CENTERING = "document_centering", e.DOCUMENT_NOT_PRESENT = "document_not_present", e.DOCUMENT_TOO_FAR = "document_too_far", e.SHARPNESS_TOO_LOW = "sharpness_too_low", e.BRIGHTNESS_TOO_LOW = "brightness_too_low", e.BRIGHTNESS_TOO_HIGH = "brightness_too_high", e.HOTSPOTS_PRESENT = "hotspots_present";
34
- const a = e, o = {};
35
- o.isPresent = a.DOCUMENT_NOT_PRESENT, o.isNotSmall = a.DOCUMENT_TOO_FAR, o.isNotOutOfBounds = a.DOCUMENT_CENTERING, o.isSharp = a.SHARPNESS_TOO_LOW, o.isNotDim = a.BRIGHTNESS_TOO_LOW, o.isNotBright = a.BRIGHTNESS_TOO_HIGH, o.noHotspots = a.HOTSPOTS_PRESENT;
36
- const L = o;
20
+ const E = {};
21
+ E.LOADING = "loading", E.ERROR = "error", E.WAITING = "waiting", E.RUNNING = "running", E.COMPLETE = "complete";
22
+ const i = E, O = { ...i };
23
+ O.DONE = "done";
24
+ const p = O, a = {};
25
+ a.EYE_NOT_PRESENT = "eye_not_present";
26
+ const A = a, o = {};
27
+ o.CANDIDATE_SELECTION = "candidate_selection", o.DOCUMENT_CENTERING = "document_centering", o.DOCUMENT_NOT_PRESENT = "document_not_present", o.DOCUMENT_TOO_FAR = "document_too_far", o.SHARPNESS_TOO_LOW = "sharpness_too_low", o.BRIGHTNESS_TOO_LOW = "brightness_too_low", o.BRIGHTNESS_TOO_HIGH = "brightness_too_high", o.HOTSPOTS_PRESENT = "hotspots_present";
28
+ const c = o, e = {};
29
+ e.isPresent = c.DOCUMENT_NOT_PRESENT, e.isNotSmall = c.DOCUMENT_TOO_FAR, e.isNotOutOfBounds = c.DOCUMENT_CENTERING, e.isSharp = c.SHARPNESS_TOO_LOW, e.isNotDim = c.BRIGHTNESS_TOO_LOW, e.isNotBright = c.BRIGHTNESS_TOO_HIGH, e.noHotspots = c.HOTSPOTS_PRESENT;
30
+ const D = e;
31
+ var C = ((t) => (t.CAMERA_PROPS_CHANGED = "document-auto-capture:camera-props-changed", t.CONTROL = "document-auto-capture:control", t.DETECTION_CHANGED = "document-auto-capture:detection-changed", t.INSTRUCTION_CHANGED = "document-auto-capture:instruction-changed", t.INSTRUCTION_ESCALATED = "document-auto-capture:instruction-escalated", t.STATE_CHANGED = "document-auto-capture:state-changed", t.VIDEO_ELEMENT_SIZE = "document-auto-capture:video-element-size", t))(C || {});
37
32
  export {
38
- I as AppStateValues,
39
- U as CaptureMode,
40
- i as ComponentCustomEvent,
41
- l as ControlEventInstruction,
42
- L as DocumentCheckToInstructionCodeMap,
43
- R as DocumentCustomEvent,
44
- a as DocumentInstructionCodeValues,
45
- M as EyeInstructionCodeValues,
46
- H as FacingMode,
47
- v as LivenessStateValues,
48
- G as RequestCaptureInstruction,
49
- h as dispatchCaptureEvent,
50
- g as dispatchControlEvent
33
+ i as AppStateValues,
34
+ N as ComponentCustomEvent,
35
+ R as ControlEventInstruction,
36
+ D as DocumentCheckToInstructionCodeMap,
37
+ C as DocumentCustomEvent,
38
+ c as DocumentInstructionCodeValues,
39
+ A as EyeInstructionCodeValues,
40
+ p as LivenessStateValues,
41
+ I as RequestCaptureInstruction,
42
+ m as dispatchCaptureEvent,
43
+ d as dispatchControlEvent
51
44
  };
package/events.umd.js CHANGED
@@ -1 +1 @@
1
- (function(e,o){typeof exports=="object"&&typeof module<"u"?o(exports):typeof define=="function"&&define.amd?define(["exports"],o):(e=typeof globalThis<"u"?globalThis:e||self,o(e["@innovatrics/dot-events-auto-capture"]={}))})(this,function(e){"use strict";const o={};o.CONTINUE_DETECTION="continue-detection",o.SWITCH_CAMERA="switch-camera",o.TOGGLE_MIRROR="toggle-mirror";const R=o,T={};T.FIRST_FRAME="first-frame",T.FIRST_VALID_FRAME="first-valid-frame";const A=T,C={};C.REQUEST_CAPTURE="dot-custom-event:request-capture";const N=C;var O=(t=>(t.CAMERA_PROPS_CHANGED="document-auto-capture:camera-props-changed",t.CONTROL="document-auto-capture:control",t.DETECTED_DOCUMENT_CHANGED="document-auto-capture:detected-document-changed",t.DOCUMENT_DETECTION="document-auto-capture:document-detection",t.INSTRUCTION_CHANGED="document-auto-capture:instruction-changed",t.INSTRUCTION_ESCALATED="document-auto-capture:instruction-escalated",t.STATE_CHANGED="document-auto-capture:state-changed",t.VIDEO_ELEMENT_SIZE="document-auto-capture:video-element-size",t))(O||{}),S=(t=>(t.CAMERA_PROPS_CHANGED="face-auto-capture:camera-props-changed",t.CONTROL="face-auto-capture:control",t.DETECTED_FACE_CHANGED="face-auto-capture:detected-face-changed",t.FACE_DETECTION="face-auto-capture:face-detection",t.INSTRUCTION_CHANGED="face-auto-capture:instruction-changed",t.STATE_CHANGED="face-auto-capture:state-changed",t.VIDEO_ELEMENT_SIZE="face-auto-capture:video-element-size",t))(S||{}),I=(t=>(t.ANIMATION_END="magnifeye-auto-capture:animation-end",t.CONTROL="magnifeye-auto-capture:control",t.STATUS_CHANGED="magnifeye-auto-capture:status-changed",t))(I||{}),D=(t=>(t.CONTROL="smile-auto-capture:control",t.INSTRUCTION_ESCALATED="smile:instruction-escalated",t.STATUS_CHANGED="smile-auto-capture:status-changed",t))(D||{}),l=(t=>(t.CAMERA_PROPS_CHANGED="palm-capture:camera-props-changed",t.CONTROL="palm-capture:control",t.DETECTED_PALM_CHANGED="palm-capture:detected-palm-changed",t.INSTRUCTION_CHANGED="palm-capture:instruction-changed",t.STATE_CHANGED="palm-capture:state-changed",t.VIDEO_ELEMENT_SIZE="palm-capture:video-element-size",t))(l||{}),h=(t=>(t.CONTROL="eye-gaze-auto-capture:control",t.STATUS_CHANGED="eye-gaze-auto-capture:status-changed",t))(h||{});const _=(t,s)=>{const u={};u.detail=s,document.dispatchEvent(new CustomEvent(t,u))},v=(t,s)=>{const u={};u.instruction=s,_(t,u)};function g(t){const s={};s.instruction=t;const u=s;_(N.REQUEST_CAPTURE,u)}const r={};r.FRONT="user",r.REAR="environment";const G=r,i={};i.AUTO_CAPTURE="AUTO_CAPTURE",i.WAIT_FOR_REQUEST="WAIT_FOR_REQUEST";const M=i,E={};E.LOADING="LOADING",E.ERROR="ERROR",E.WAITING="WAITING",E.RUNNING="RUNNING",E.COMPLETE="COMPLETE";const d=E,m={...d};m.DONE="DONE";const H=m,p={};p.EYE_NOT_PRESENT="eye_not_present";const U=p,n={};n.CANDIDATE_SELECTION="candidate_selection",n.DOCUMENT_CENTERING="document_centering",n.DOCUMENT_NOT_PRESENT="document_not_present",n.DOCUMENT_TOO_FAR="document_too_far",n.SHARPNESS_TOO_LOW="sharpness_too_low",n.BRIGHTNESS_TOO_LOW="brightness_too_low",n.BRIGHTNESS_TOO_HIGH="brightness_too_high",n.HOTSPOTS_PRESENT="hotspots_present";const a=n,c={};c.isPresent=a.DOCUMENT_NOT_PRESENT,c.isNotSmall=a.DOCUMENT_TOO_FAR,c.isNotOutOfBounds=a.DOCUMENT_CENTERING,c.isSharp=a.SHARPNESS_TOO_LOW,c.isNotDim=a.BRIGHTNESS_TOO_LOW,c.isNotBright=a.BRIGHTNESS_TOO_HIGH,c.noHotspots=a.HOTSPOTS_PRESENT;const f=c;e.AppStateValues=d,e.CaptureMode=M,e.ComponentCustomEvent=N,e.ControlEventInstruction=R,e.DocumentCheckToInstructionCodeMap=f,e.DocumentCustomEvent=O,e.DocumentInstructionCodeValues=a,e.EyeInstructionCodeValues=U,e.FacingMode=G,e.LivenessStateValues=H,e.RequestCaptureInstruction=A,e.dispatchCaptureEvent=g,e.dispatchControlEvent=v,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
1
+ (function(t,o){typeof exports=="object"&&typeof module<"u"?o(exports):typeof define=="function"&&define.amd?define(["exports"],o):(t=typeof globalThis<"u"?globalThis:t||self,o(t["@innovatrics/dot-events-auto-capture"]={}))})(this,function(t){"use strict";const o={};o.CONTINUE_DETECTION="continue-detection",o.SWITCH_CAMERA="switch-camera",o.TOGGLE_MIRROR="toggle-mirror";const S=o,a={};a.FIRST_FRAME="first-frame",a.FIRST_VALID_FRAME="first-valid-frame";const m=a,_={};_.REQUEST_CAPTURE="dot-custom-event:request-capture";const T=_,r=(e,i)=>{const u={};u.detail=i,document.dispatchEvent(new CustomEvent(e,u))},I=(e,i)=>{const u={};u.instruction=i,r(e,u)};function R(e){const i={};i.instruction=e;const u=i;r(T.REQUEST_CAPTURE,u)}const E={};E.LOADING="loading",E.ERROR="error",E.WAITING="waiting",E.RUNNING="running",E.COMPLETE="complete";const O=E,C={...O};C.DONE="done";const p=C,N={};N.EYE_NOT_PRESENT="eye_not_present";const l=N,n={};n.CANDIDATE_SELECTION="candidate_selection",n.DOCUMENT_CENTERING="document_centering",n.DOCUMENT_NOT_PRESENT="document_not_present",n.DOCUMENT_TOO_FAR="document_too_far",n.SHARPNESS_TOO_LOW="sharpness_too_low",n.BRIGHTNESS_TOO_LOW="brightness_too_low",n.BRIGHTNESS_TOO_HIGH="brightness_too_high",n.HOTSPOTS_PRESENT="hotspots_present";const c=n,s={};s.isPresent=c.DOCUMENT_NOT_PRESENT,s.isNotSmall=c.DOCUMENT_TOO_FAR,s.isNotOutOfBounds=c.DOCUMENT_CENTERING,s.isSharp=c.SHARPNESS_TOO_LOW,s.isNotDim=c.BRIGHTNESS_TOO_LOW,s.isNotBright=c.BRIGHTNESS_TOO_HIGH,s.noHotspots=c.HOTSPOTS_PRESENT;const f=s;var d=(e=>(e.CAMERA_PROPS_CHANGED="document-auto-capture:camera-props-changed",e.CONTROL="document-auto-capture:control",e.DETECTION_CHANGED="document-auto-capture:detection-changed",e.INSTRUCTION_CHANGED="document-auto-capture:instruction-changed",e.INSTRUCTION_ESCALATED="document-auto-capture:instruction-escalated",e.STATE_CHANGED="document-auto-capture:state-changed",e.VIDEO_ELEMENT_SIZE="document-auto-capture:video-element-size",e))(d||{});t.AppStateValues=O,t.ComponentCustomEvent=T,t.ControlEventInstruction=S,t.DocumentCheckToInstructionCodeMap=f,t.DocumentCustomEvent=d,t.DocumentInstructionCodeValues=c,t.EyeInstructionCodeValues=l,t.LivenessStateValues=p,t.RequestCaptureInstruction=m,t.dispatchCaptureEvent=R,t.dispatchControlEvent=I,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});