idmission-web-sdk 1.0.104 → 1.0.106

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.
@@ -3,6 +3,7 @@ import { ThemeInput } from '../../themes';
3
3
  import { LangOption } from '../../lib/locales';
4
4
  import { SubmissionRequest, SubmissionResponse } from '../../contexts/SubmissionContext';
5
5
  import { DocumentCaptureWizardClassNames } from '../document_capture/DocumentCaptureWizard';
6
+ import { CameraFeedMode } from '../document_capture/DocumentCaptureScreen';
6
7
  export type DocumentCaptureClassNames = DocumentCaptureWizardClassNames;
7
8
  export interface DocumentCaptureProps extends PropsWithChildren {
8
9
  /** Language code to use. Supported values: 'auto' (detect based on user's OS), 'en' (English), 'es' (Spanish). Defaults to auto. */
@@ -11,6 +12,8 @@ export interface DocumentCaptureProps extends PropsWithChildren {
11
12
  submissionToken: string;
12
13
  /** URL to hit with all API requests. Defaults to the value specified in your decoded `submissionToken`. */
13
14
  submissionUrl?: string;
15
+ /** URL to upload captured documents to via Tus. */
16
+ documentServiceUrl?: string;
14
17
  /** Callback function that fires immediately prior to submission, giving the client application an opportunity to specify custom asynchronous logic that mutates the request before it executes. The submission request is passed in as a parameter and a promise resolving to the updated request should be returned. */
15
18
  onBeforeSubmit?: (req: SubmissionRequest) => Promise<SubmissionRequest>;
16
19
  /** Callback function that fires when the user has completed the flow instead of making a call to IDmission's servers, allowing customers to specify their own submission logic. Arguments: the request payload that would have been dispatched to IDmission's API, which contains the images/documents/video submitted by the user. Note that when this parameter is supplied, `onComplete` will never fire, and the customer will need to implement their own error handling/retry logic. Use at your own risk! */
@@ -22,6 +25,7 @@ export interface DocumentCaptureProps extends PropsWithChildren {
22
25
  /** Callback function that fires when the user clicks the exit button from the loading overlay, declining to engage with IDmission. Binding this callback results in the cancel button being rendered on the loading overlay. */
23
26
  onUserCancel?: () => void;
24
27
  aspectRatio?: number;
28
+ cameraFeedMode?: CameraFeedMode;
25
29
  instructions?: ReactNode;
26
30
  /** Name of an included theme or object containing theme properties. **/
27
31
  theme?: ThemeInput;
@@ -7,7 +7,7 @@ export type DocumentCaptureGuideOverlayProps = {
7
7
  borderRadius?: number;
8
8
  borderColor?: string;
9
9
  borderWidth?: number;
10
- maskColor?: string;
10
+ maskColor: string;
11
11
  padding?: number;
12
12
  classNames?: DocumentCaptureGuideOverlayClassNames;
13
13
  };
@@ -0,0 +1,15 @@
1
+ import React, { ReactNode } from 'react';
2
+ export type CameraFeedMode = 'snapToGuides' | 'fullscreen';
3
+ export type DocumentCaptureScreenClassNames = {
4
+ container?: string;
5
+ cameraFeed?: string;
6
+ };
7
+ export type DocumentCaptureScreenProps = {
8
+ aspectRatio?: number;
9
+ cameraFeedMode?: CameraFeedMode;
10
+ classNames?: DocumentCaptureScreenClassNames;
11
+ instructions?: ReactNode;
12
+ onCaptureClicked?: () => void;
13
+ onSuccess?: (blob: Blob) => void;
14
+ };
15
+ export declare const DocumentCaptureScreen: ({ aspectRatio, cameraFeedMode, classNames, instructions, onCaptureClicked, onSuccess, }: DocumentCaptureScreenProps) => React.JSX.Element;
@@ -0,0 +1,68 @@
1
+ import React, { Dispatch, ReactNode } from 'react';
2
+ export type DocumentCaptureState = {
3
+ initialDrawComplete: boolean;
4
+ redrawing: boolean;
5
+ rectX: number;
6
+ rectY: number;
7
+ rectWidth: number;
8
+ rectHeight: number;
9
+ rectOffsetTop: number;
10
+ capturing: boolean;
11
+ imageUrl: string;
12
+ imageBlob: Blob | null;
13
+ uploadState: 'not_started' | 'in_progress' | 'succeeded' | 'failed';
14
+ };
15
+ export declare const documentCaptureInitialState: {
16
+ initialDrawComplete: false;
17
+ redrawing: false;
18
+ capturing: false;
19
+ rectX: number;
20
+ rectY: number;
21
+ rectWidth: number;
22
+ rectHeight: number;
23
+ rectOffsetTop: number;
24
+ imageUrl: string;
25
+ imageBlob: null;
26
+ uploadState: "not_started";
27
+ };
28
+ export declare const DocumentCaptureStateContext: React.Context<DocumentCaptureState>;
29
+ export type DocumentCaptureAction = {
30
+ type: 'redrawRequested';
31
+ } | {
32
+ type: 'redrawInProgress';
33
+ } | {
34
+ type: 'redrawCompleted';
35
+ payload: {
36
+ rectX: number;
37
+ rectY: number;
38
+ rectWidth: number;
39
+ rectHeight: number;
40
+ rectOffsetTop: number;
41
+ };
42
+ } | {
43
+ type: 'captureRequested';
44
+ } | {
45
+ type: 'captureCompleted';
46
+ payload: {
47
+ imageUrl: string;
48
+ imageBlob: Blob;
49
+ };
50
+ } | {
51
+ type: 'retryCapture';
52
+ } | {
53
+ type: 'uploadStarted';
54
+ } | {
55
+ type: 'uploadCompleted';
56
+ } | {
57
+ type: 'uploadFailed';
58
+ };
59
+ export type DocumentCaptureDispatch = Dispatch<DocumentCaptureAction>;
60
+ export declare const DocumentCaptureDispatchContext: React.Context<DocumentCaptureDispatch>;
61
+ export declare const documentCaptureStateReducer: (state: DocumentCaptureState, action: DocumentCaptureAction) => DocumentCaptureState;
62
+ export declare const DocumentCaptureStateProvider: ({ children, }: {
63
+ children: ReactNode;
64
+ }) => React.JSX.Element;
65
+ export declare const useDocumentCaptureState: () => [
66
+ DocumentCaptureState,
67
+ DocumentCaptureDispatch
68
+ ];
@@ -1,14 +1,13 @@
1
1
  import React, { ReactNode } from 'react';
2
- export type DocumentCaptureWizardClassNames = {
3
- container?: string;
4
- cameraFeed?: string;
5
- };
2
+ import { CameraFeedMode, DocumentCaptureScreenClassNames } from './DocumentCaptureScreen';
3
+ export type DocumentCaptureWizardClassNames = DocumentCaptureScreenClassNames;
6
4
  export type DocumentCaptureWizardProps = {
7
5
  onSuccess?: () => void;
8
6
  onExitCapture?: () => void;
9
7
  onUserCancel?: () => void;
10
8
  aspectRatio?: number;
9
+ cameraFeedMode?: CameraFeedMode;
11
10
  instructions?: ReactNode;
12
11
  classNames?: DocumentCaptureWizardClassNames;
13
12
  };
14
- export declare const DocumentCaptureWizard: ({ aspectRatio, instructions, classNames, }: DocumentCaptureWizardProps) => React.JSX.Element;
13
+ export declare const DocumentCaptureWizard: ({ onSuccess, aspectRatio, cameraFeedMode, instructions, classNames, }: DocumentCaptureWizardProps) => React.JSX.Element;
@@ -32,6 +32,7 @@ export type SubmissionState = {
32
32
  setIdCaptureVideoIdFrontImage: (image: string) => void;
33
33
  setIdCaptureVideoIdBackImage: (image: string) => void;
34
34
  setAdditionalDocuments: (uploadedDocuments: UploadedDocument[]) => void;
35
+ uploadDocument: (blob: Blob) => Promise<string>;
35
36
  logIdFrontCaptureAttempt: (attempt: CaptureAttemptMetadata) => void;
36
37
  logIdBackCaptureAttempt: (attempt: CaptureAttemptMetadata) => void;
37
38
  logSelfieCaptureAttempt: (attempt: CaptureAttemptMetadata) => void;
@@ -68,10 +69,11 @@ export type SubmissionProviderProps = {
68
69
  webhooksSendProcessedImages?: boolean;
69
70
  webhooksFireOnReview?: boolean;
70
71
  precapturedDocuments?: CapturedDocuments;
72
+ documentServiceUrl?: string;
71
73
  onSubmit?: (payload: SubmissionRequest) => void;
72
74
  onBeforeSubmit?: (req: SubmissionRequest) => Promise<SubmissionRequest>;
73
75
  onBeforeLivenessCheck?: (req: LivenessCheckRequest) => Promise<LivenessCheckRequest>;
74
76
  onResponseReceived?: (res: SubmissionResponse, req: SubmissionRequest) => void;
75
77
  onRequestFailure?: (err: Error) => void;
76
78
  };
77
- export declare const SubmissionProvider: ({ action, children, url, environment, token, companyId, enrollmentId, personalData, cardData, bypassAgeValidation, bypassNameMatching, needImmediateResponse, manualReviewRequired, idBackImageRequired, idImageResolutionCheck, verifyIdWithExternalDatabases, deduplicationEnabled, deduplicationSynchronous, geolocationEnabled, geolocationRequired, webhooksEnabled, webhooksClientTraceId, webhooksStripSpecialCharacters, webhooksSendInputImages, webhooksSendProcessedImages, webhooksFireOnReview, precapturedDocuments, onSubmit, onBeforeSubmit, onBeforeLivenessCheck, onResponseReceived, onRequestFailure, }: SubmissionProviderProps) => ReactElement;
79
+ export declare const SubmissionProvider: ({ action, children, url, environment, token, companyId, enrollmentId, personalData, cardData, bypassAgeValidation, bypassNameMatching, needImmediateResponse, manualReviewRequired, idBackImageRequired, idImageResolutionCheck, verifyIdWithExternalDatabases, deduplicationEnabled, deduplicationSynchronous, geolocationEnabled, geolocationRequired, webhooksEnabled, webhooksClientTraceId, webhooksStripSpecialCharacters, webhooksSendInputImages, webhooksSendProcessedImages, webhooksFireOnReview, precapturedDocuments, documentServiceUrl, onSubmit, onBeforeSubmit, onBeforeLivenessCheck, onResponseReceived, onRequestFailure, }: SubmissionProviderProps) => ReactElement;
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ import { preloadModels } from './lib/models/preloadModels';
10
10
  import { CustomerBiometricsEnrollment } from './components/customer_flows/CustomerBiometricsEnrollment';
11
11
  import { themes } from './themes';
12
12
  import { SubmissionRequest, SubmissionResponse } from './contexts/SubmissionContext';
13
+ import { DocumentCapture, DocumentCaptureProps } from './components/customer_flows/DocumentCapture';
13
14
  type TargetElement = Element | DocumentFragment | string | undefined;
14
15
  export declare const renderIdValidation: (optionsOrTargetElement: TargetElement | IdValidationProps, options?: IdValidationProps) => Element | DocumentFragment;
15
16
  export declare const renderFaceValidation: (optionsOrTargetElement: TargetElement | FaceValidationProps, options?: FaceValidationProps) => Element | DocumentFragment;
@@ -20,6 +21,7 @@ export declare const renderCustomerVerification: (optionsOrTargetElement: Target
20
21
  export declare const renderCustomerIdentification: (optionsOrTargetElement: TargetElement | CustomerIdentificationProps, options?: CustomerIdentificationProps) => Element | DocumentFragment;
21
22
  export declare const renderSignatureKYC: (optionsOrTargetElement: TargetElement | SignatureKYCProps, options?: SignatureKYCProps) => Element | DocumentFragment;
22
23
  export declare const renderVideoIdValidation: (optionsOrTargetElement: TargetElement | VideoIdValidationProps, options?: VideoIdValidationProps) => Element | DocumentFragment;
24
+ export declare const renderDocumentCapture: (optionsOrTargetElement: TargetElement | DocumentCaptureProps, options?: DocumentCaptureProps) => Element | DocumentFragment;
23
25
  export type IDmissionSDK = {
24
26
  renderIdValidation: typeof renderIdValidation;
25
27
  renderFaceValidation: typeof renderFaceValidation;
@@ -30,6 +32,7 @@ export type IDmissionSDK = {
30
32
  renderCustomerIdentification: typeof renderCustomerIdentification;
31
33
  renderSignatureKYC: typeof renderSignatureKYC;
32
34
  renderVideoIdValidation: typeof renderVideoIdValidation;
35
+ renderDocumentCapture: typeof renderDocumentCapture;
33
36
  preloadModels: typeof preloadModels;
34
37
  themes: typeof themes;
35
38
  version: string;
@@ -38,4 +41,4 @@ export type IDmissionSDK = {
38
41
  declare global {
39
42
  var IDmissionSDK: IDmissionSDK;
40
43
  }
41
- export { preloadModels, themes, IdValidation, FaceValidation, IdAndFaceValidation, CustomerIdAndBiometricsEnrollment, CustomerBiometricsEnrollment, CustomerVerification, CustomerIdentification, SignatureKYC, VideoIdValidation, SubmissionRequest, SubmissionResponse, };
44
+ export { preloadModels, themes, IdValidation, FaceValidation, IdAndFaceValidation, CustomerIdAndBiometricsEnrollment, CustomerBiometricsEnrollment, CustomerVerification, CustomerIdentification, SignatureKYC, VideoIdValidation, DocumentCapture, SubmissionRequest, SubmissionResponse, };