idmission-web-sdk 1.0.289 → 1.0.290

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.
@@ -5,6 +5,7 @@ import { OnBeforeDocumentUpload, OnDocumentUploaded, OnDocumentUploadFailed, OnD
5
5
  import { SubmissionRequest } from '../../contexts/SubmissionContext';
6
6
  import { DocumentCaptureWizardClassNames, DocumentCaptureWizardVerbiage } from '../document_capture/DocumentCaptureWizard';
7
7
  import { CameraFeedMode } from '../../lib/camera/CameraFeedWrapper';
8
+ import { CapturedDocument, OnAllDocumentsUploaded } from '../document_capture/DocumentCaptureStateProvider';
8
9
  export type DocumentCaptureClassNames = DocumentCaptureWizardClassNames;
9
10
  export type DocumentCaptureVerbiage = DocumentCaptureWizardVerbiage;
10
11
  export interface DocumentCaptureProps extends PropsWithChildren {
@@ -31,11 +32,12 @@ export interface DocumentCaptureProps extends PropsWithChildren {
31
32
  /** 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! */
32
33
  onSubmit?: (req: SubmissionRequest) => void;
33
34
  /** Callback function that fires when the user completes the DocumentCapture flow. Arguments: the SubmissionResponse from IDmission's API is passed as an argument to the customer's application for further handling, which indicates whether the user passed the validation check, and the request payload dispatched to IDmission's API, which contains the images submitted by the user. */
34
- onComplete?: (documentId: string) => void;
35
+ onComplete?: OnAllDocumentsUploaded;
35
36
  /** Callback function that fires when the user clicks the exit button during ID or selfie capture. */
36
37
  onExitCapture?: () => void;
37
38
  /** 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. */
38
39
  onUserCancel?: () => void;
40
+ documents?: CapturedDocument[];
39
41
  aspectRatio?: number;
40
42
  cameraFeedMode?: CameraFeedMode;
41
43
  instructions?: ReactNode;
@@ -1,5 +1,4 @@
1
- import React, { ReactNode } from 'react';
2
- import { CameraFeedMode } from '../../lib/camera/CameraFeedWrapper';
1
+ import React from 'react';
3
2
  import { CustomerSuppliedVerbiage } from '../../lib/locales';
4
3
  export type DocumentCaptureScreenClassNames = {
5
4
  container?: string;
@@ -31,12 +30,8 @@ export type DocumentCaptureScreenVerbiage = {
31
30
  successBtnText?: CustomerSuppliedVerbiage;
32
31
  };
33
32
  export type DocumentCaptureScreenProps = {
34
- aspectRatio?: number;
35
- cameraFeedMode?: CameraFeedMode;
36
- instructions?: ReactNode;
37
33
  onCaptureClicked?: () => void;
38
- onSuccess?: (documentId: string) => void;
39
34
  classNames?: DocumentCaptureScreenClassNames;
40
35
  verbiage?: DocumentCaptureScreenVerbiage;
41
36
  };
42
- export declare const DocumentCaptureScreen: ({ aspectRatio, cameraFeedMode, instructions, onCaptureClicked, onSuccess, classNames, verbiage: rawVerbiage, }: DocumentCaptureScreenProps) => React.JSX.Element;
37
+ export declare const DocumentCaptureScreen: ({ onCaptureClicked, classNames, verbiage: rawVerbiage, }: DocumentCaptureScreenProps) => React.JSX.Element;
@@ -1,5 +1,22 @@
1
1
  import React, { Dispatch, ReactNode } from 'react';
2
+ import { CameraFeedMode } from '../../lib/camera/CameraFeedWrapper';
3
+ export type OnDocumentUploaded = (document: CapturedDocument) => void;
4
+ export type OnAllDocumentsUploaded = (documents: CapturedDocument[]) => Promise<void>;
5
+ export type CapturedDocument = {
6
+ title?: string;
7
+ aspectRatio?: number;
8
+ cameraFeedMode?: CameraFeedMode;
9
+ instructions?: ReactNode;
10
+ documentId?: string;
11
+ content?: Blob;
12
+ contentUrl?: string;
13
+ uploadState?: DocumentCaptureUploadState;
14
+ onUploaded?: OnDocumentUploaded;
15
+ };
16
+ type DocumentCaptureUploadState = 'not_started' | 'in_progress' | 'succeeded' | 'failed';
2
17
  export type DocumentCaptureState = {
18
+ documents: CapturedDocument[];
19
+ currentDocumentIndex: number;
3
20
  initialDrawComplete: boolean;
4
21
  redrawing: boolean;
5
22
  rectX: number;
@@ -8,11 +25,12 @@ export type DocumentCaptureState = {
8
25
  rectHeight: number;
9
26
  rectOffsetTop: number;
10
27
  capturing: boolean;
11
- imageUrl: string;
12
- imageBlob: Blob | null;
13
- uploadState: 'not_started' | 'in_progress' | 'succeeded' | 'failed';
28
+ onDocumentUploaded?: OnDocumentUploaded;
29
+ onAllDocumentsUploaded?: OnAllDocumentsUploaded;
14
30
  };
15
31
  export declare const documentCaptureInitialState: {
32
+ documents: never[];
33
+ currentDocumentIndex: number;
16
34
  initialDrawComplete: false;
17
35
  redrawing: false;
18
36
  capturing: false;
@@ -21,12 +39,18 @@ export declare const documentCaptureInitialState: {
21
39
  rectWidth: number;
22
40
  rectHeight: number;
23
41
  rectOffsetTop: number;
24
- imageUrl: string;
25
- imageBlob: null;
26
- uploadState: "not_started";
27
42
  };
28
43
  export declare const DocumentCaptureStateContext: React.Context<DocumentCaptureState>;
29
44
  export type DocumentCaptureAction = {
45
+ type: 'setDocuments';
46
+ payload: CapturedDocument[];
47
+ } | {
48
+ type: 'setHooks';
49
+ payload: {
50
+ onDocumentUploaded?: OnDocumentUploaded;
51
+ onAllDocumentsUploaded?: OnAllDocumentsUploaded;
52
+ };
53
+ } | {
30
54
  type: 'redrawRequested';
31
55
  } | {
32
56
  type: 'redrawInProgress';
@@ -44,8 +68,8 @@ export type DocumentCaptureAction = {
44
68
  } | {
45
69
  type: 'captureCompleted';
46
70
  payload: {
47
- imageUrl: string;
48
- imageBlob: Blob;
71
+ content: Blob;
72
+ contentUrl: string;
49
73
  };
50
74
  } | {
51
75
  type: 'retryCapture';
@@ -53,16 +77,26 @@ export type DocumentCaptureAction = {
53
77
  type: 'uploadStarted';
54
78
  } | {
55
79
  type: 'uploadCompleted';
80
+ payload: {
81
+ documentId: string;
82
+ };
56
83
  } | {
57
84
  type: 'uploadFailed';
58
85
  };
59
86
  export type DocumentCaptureDispatch = Dispatch<DocumentCaptureAction>;
60
87
  export declare const DocumentCaptureDispatchContext: React.Context<DocumentCaptureDispatch>;
61
88
  export declare const documentCaptureStateReducer: (state: DocumentCaptureState, action: DocumentCaptureAction) => DocumentCaptureState;
62
- export declare const DocumentCaptureStateProvider: ({ children, }: {
89
+ export declare const DocumentCaptureStateProvider: ({ documents, aspectRatio, cameraFeedMode, instructions, onDocumentUploaded, onAllDocumentsUploaded, children, }: {
90
+ documents?: CapturedDocument[] | undefined;
91
+ aspectRatio?: number | undefined;
92
+ cameraFeedMode?: CameraFeedMode | undefined;
93
+ instructions?: ReactNode;
94
+ onDocumentUploaded?: OnDocumentUploaded | undefined;
95
+ onAllDocumentsUploaded?: OnAllDocumentsUploaded | undefined;
63
96
  children: ReactNode;
64
97
  }) => React.JSX.Element;
65
98
  export declare const useDocumentCaptureState: () => [
66
99
  DocumentCaptureState,
67
100
  DocumentCaptureDispatch
68
101
  ];
102
+ export {};
@@ -1,16 +1,19 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import { DocumentCaptureScreenClassNames, DocumentCaptureScreenVerbiage } from './DocumentCaptureScreen';
3
+ import { CapturedDocument, OnAllDocumentsUploaded, OnDocumentUploaded } from './DocumentCaptureStateProvider';
3
4
  import { CameraFeedMode } from '../../lib/camera/CameraFeedWrapper';
4
5
  export type DocumentCaptureWizardClassNames = DocumentCaptureScreenClassNames;
5
6
  export type DocumentCaptureWizardVerbiage = DocumentCaptureScreenVerbiage;
6
7
  export type DocumentCaptureWizardProps = {
7
- onSuccess?: (documentId: string) => void;
8
+ onSuccess?: OnAllDocumentsUploaded;
9
+ onDocumentUploaded?: OnDocumentUploaded;
8
10
  onExitCapture?: () => void;
9
11
  onUserCancel?: () => void;
12
+ documents?: CapturedDocument[];
10
13
  aspectRatio?: number;
11
14
  cameraFeedMode?: CameraFeedMode;
12
15
  instructions?: ReactNode;
13
16
  classNames?: DocumentCaptureWizardClassNames;
14
17
  verbiage?: DocumentCaptureWizardVerbiage;
15
18
  };
16
- export declare const DocumentCaptureWizard: ({ onSuccess, aspectRatio, cameraFeedMode, instructions, classNames, verbiage, }: DocumentCaptureWizardProps) => React.JSX.Element;
19
+ export declare const DocumentCaptureWizard: ({ onSuccess, onDocumentUploaded, documents, aspectRatio, cameraFeedMode, instructions, classNames, verbiage, }: DocumentCaptureWizardProps) => React.JSX.Element;
@@ -51,7 +51,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
51
51
  var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
52
52
  var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
53
53
 
54
- var webSdkVersion = '1.0.289';
54
+ var webSdkVersion = '1.0.290';
55
55
 
56
56
  function getPlatform() {
57
57
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -18735,6 +18735,8 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
18735
18735
  };
18736
18736
 
18737
18737
  var documentCaptureInitialState = {
18738
+ documents: [],
18739
+ currentDocumentIndex: 0,
18738
18740
  initialDrawComplete: false,
18739
18741
  redrawing: false,
18740
18742
  capturing: false,
@@ -18742,15 +18744,20 @@ var documentCaptureInitialState = {
18742
18744
  rectY: 0,
18743
18745
  rectWidth: 0,
18744
18746
  rectHeight: 0,
18745
- rectOffsetTop: 0,
18746
- imageUrl: '',
18747
- imageBlob: null,
18748
- uploadState: 'not_started'
18747
+ rectOffsetTop: 0
18749
18748
  };
18750
18749
  var DocumentCaptureStateContext = /*#__PURE__*/React.createContext(documentCaptureInitialState);
18751
18750
  var DocumentCaptureDispatchContext = /*#__PURE__*/React.createContext(function () {});
18752
18751
  var documentCaptureStateReducer = function documentCaptureStateReducer(state, action) {
18752
+ var _a, _b, _c, _d;
18753
18753
  switch (action.type) {
18754
+ case 'setDocuments':
18755
+ return tslib.__assign(tslib.__assign({}, state), {
18756
+ documents: action.payload,
18757
+ currentDocumentIndex: 0
18758
+ });
18759
+ case 'setHooks':
18760
+ return tslib.__assign(tslib.__assign({}, state), action.payload);
18754
18761
  case 'redrawRequested':
18755
18762
  return tslib.__assign(tslib.__assign({}, state), {
18756
18763
  redrawing: true,
@@ -18778,38 +18785,102 @@ var documentCaptureStateReducer = function documentCaptureStateReducer(state, ac
18778
18785
  capturing: true
18779
18786
  });
18780
18787
  case 'captureCompleted':
18781
- return tslib.__assign(tslib.__assign(tslib.__assign({}, state), {
18782
- capturing: false
18783
- }), action.payload);
18788
+ {
18789
+ var newState = tslib.__assign(tslib.__assign({}, state), {
18790
+ capturing: false
18791
+ });
18792
+ var index = state.currentDocumentIndex;
18793
+ newState.documents[index].content = action.payload.content;
18794
+ newState.documents[index].contentUrl = action.payload.contentUrl;
18795
+ return newState;
18796
+ }
18784
18797
  case 'retryCapture':
18785
- return tslib.__assign(tslib.__assign({}, state), {
18786
- imageUrl: '',
18787
- imageBlob: null
18788
- });
18798
+ {
18799
+ var newState = tslib.__assign({}, state);
18800
+ var index = state.currentDocumentIndex;
18801
+ newState.documents[index].content = undefined;
18802
+ newState.documents[index].contentUrl = undefined;
18803
+ return newState;
18804
+ }
18789
18805
  case 'uploadStarted':
18790
- return tslib.__assign(tslib.__assign({}, state), {
18791
- uploadState: 'in_progress'
18792
- });
18806
+ {
18807
+ var newState = tslib.__assign({}, state);
18808
+ var index = state.currentDocumentIndex;
18809
+ newState.documents[index].uploadState = 'in_progress';
18810
+ return newState;
18811
+ }
18793
18812
  case 'uploadCompleted':
18794
- return tslib.__assign(tslib.__assign({}, state), {
18795
- uploadState: 'succeeded'
18796
- });
18813
+ {
18814
+ var newState = tslib.__assign({}, state);
18815
+ var index = state.currentDocumentIndex;
18816
+ newState.documents[index].documentId = action.payload.documentId;
18817
+ newState.documents[index].uploadState = 'succeeded';
18818
+ (_b = (_a = newState.documents[index]).onUploaded) === null || _b === void 0 ? void 0 : _b.call(_a, newState.documents[index]);
18819
+ (_c = state.onDocumentUploaded) === null || _c === void 0 ? void 0 : _c.call(state, newState.documents[index]);
18820
+ if (state.documents.length - 1 > index) {
18821
+ newState.currentDocumentIndex += 1;
18822
+ } else {
18823
+ (_d = state.onAllDocumentsUploaded) === null || _d === void 0 ? void 0 : _d.call(state, newState.documents);
18824
+ }
18825
+ return newState;
18826
+ }
18797
18827
  case 'uploadFailed':
18798
- return tslib.__assign(tslib.__assign({}, state), {
18799
- uploadState: 'failed'
18800
- });
18828
+ {
18829
+ var newState = tslib.__assign({}, state);
18830
+ var index = state.currentDocumentIndex;
18831
+ newState.documents[index].uploadState = 'failed';
18832
+ return newState;
18833
+ }
18801
18834
  default:
18802
18835
  return state;
18803
18836
  }
18804
18837
  };
18805
18838
  var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
18806
- var children = _a.children;
18807
- var _b = React.useContext(CameraStateContext),
18808
- cameraRef = _b.cameraRef,
18809
- videoRef = _b.videoRef;
18810
- var _c = React.useReducer(documentCaptureStateReducer, documentCaptureInitialState),
18811
- state = _c[0],
18812
- dispatch = _c[1];
18839
+ var _b = _a.documents,
18840
+ documents = _b === void 0 ? [] : _b,
18841
+ aspectRatio = _a.aspectRatio,
18842
+ cameraFeedMode = _a.cameraFeedMode,
18843
+ instructions = _a.instructions,
18844
+ onDocumentUploaded = _a.onDocumentUploaded,
18845
+ onAllDocumentsUploaded = _a.onAllDocumentsUploaded,
18846
+ children = _a.children;
18847
+ var _c = React.useContext(CameraStateContext),
18848
+ cameraRef = _c.cameraRef,
18849
+ videoRef = _c.videoRef;
18850
+ var _d = React.useReducer(documentCaptureStateReducer, documentCaptureInitialState),
18851
+ state = _d[0],
18852
+ dispatch = _d[1];
18853
+ React.useEffect(function () {
18854
+ var resolvedDocuments = (documents === null || documents === void 0 ? void 0 : documents.length) ? documents.map(function (d) {
18855
+ return tslib.__assign(tslib.__assign({
18856
+ title: 'Document Capture',
18857
+ aspectRatio: aspectRatio,
18858
+ cameraFeedMode: 'snapToGuides',
18859
+ instructions: instructions
18860
+ }, d), {
18861
+ uploadState: 'not_started'
18862
+ });
18863
+ }) : [{
18864
+ title: 'Document Capture',
18865
+ aspectRatio: aspectRatio,
18866
+ cameraFeedMode: cameraFeedMode !== null && cameraFeedMode !== void 0 ? cameraFeedMode : 'snapToGuides',
18867
+ instructions: instructions,
18868
+ uploadState: 'not_started'
18869
+ }];
18870
+ dispatch({
18871
+ type: 'setDocuments',
18872
+ payload: resolvedDocuments
18873
+ });
18874
+ }, [aspectRatio, cameraFeedMode, documents, instructions]);
18875
+ React.useEffect(function () {
18876
+ dispatch({
18877
+ type: 'setHooks',
18878
+ payload: {
18879
+ onDocumentUploaded: onDocumentUploaded,
18880
+ onAllDocumentsUploaded: onAllDocumentsUploaded
18881
+ }
18882
+ });
18883
+ }, [onAllDocumentsUploaded, onDocumentUploaded]);
18813
18884
  var onResize = useDebounce.useDebouncedCallback(function () {
18814
18885
  dispatch({
18815
18886
  type: 'redrawRequested'
@@ -18826,14 +18897,14 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
18826
18897
  React.useEffect(function () {
18827
18898
  if (!state.capturing) return;
18828
18899
  if (!cameraRef.current) return;
18829
- function onComplete(imageBlob) {
18830
- if (!imageBlob) return;
18831
- var imageUrl = URL.createObjectURL(imageBlob);
18900
+ function onComplete(content) {
18901
+ if (!content) return;
18902
+ var contentUrl = URL.createObjectURL(content);
18832
18903
  dispatch({
18833
18904
  type: 'captureCompleted',
18834
18905
  payload: {
18835
- imageUrl: imageUrl,
18836
- imageBlob: imageBlob
18906
+ content: content,
18907
+ contentUrl: contentUrl
18837
18908
  }
18838
18909
  });
18839
18910
  }
@@ -18961,40 +19032,40 @@ var Canvas = styled__default['default'].canvas(templateObject_2$1 || (templateOb
18961
19032
  var templateObject_1$1, templateObject_2$1;
18962
19033
 
18963
19034
  var DocumentCaptureScreen = function DocumentCaptureScreen(_a) {
18964
- var _b, _c, _d, _e;
18965
- var aspectRatio = _a.aspectRatio,
18966
- _f = _a.cameraFeedMode,
18967
- cameraFeedMode = _f === void 0 ? 'snapToGuides' : _f,
18968
- instructions = _a.instructions,
18969
- onCaptureClicked = _a.onCaptureClicked,
18970
- onSuccess = _a.onSuccess,
19035
+ var _b, _c, _d, _e, _f;
19036
+ var onCaptureClicked = _a.onCaptureClicked,
18971
19037
  _g = _a.classNames,
18972
19038
  classNames = _g === void 0 ? {} : _g,
18973
19039
  _h = _a.verbiage,
18974
19040
  rawVerbiage = _h === void 0 ? {} : _h;
18975
- var _j = React.useContext(SubmissionContext),
18976
- submit = _j.submit,
18977
- uploadDocument = _j.uploadDocument;
18978
- var _k = useDocumentCaptureState(),
18979
- _l = _k[0],
18980
- rectX = _l.rectX,
18981
- rectY = _l.rectY,
18982
- rectWidth = _l.rectWidth,
18983
- rectHeight = _l.rectHeight,
18984
- rectOffsetTop = _l.rectOffsetTop,
18985
- capturing = _l.capturing,
18986
- imageUrl = _l.imageUrl,
18987
- imageBlob = _l.imageBlob,
18988
- uploadState = _l.uploadState,
18989
- dispatch = _k[1];
19041
+ var uploadDocument = React.useContext(SubmissionContext).uploadDocument;
19042
+ var _j = useDocumentCaptureState(),
19043
+ _k = _j[0],
19044
+ documents = _k.documents,
19045
+ currentDocumentIndex = _k.currentDocumentIndex,
19046
+ rectX = _k.rectX,
19047
+ rectY = _k.rectY,
19048
+ rectWidth = _k.rectWidth,
19049
+ rectHeight = _k.rectHeight,
19050
+ rectOffsetTop = _k.rectOffsetTop,
19051
+ capturing = _k.capturing,
19052
+ dispatch = _j[1];
19053
+ var _l = (_b = documents[currentDocumentIndex]) !== null && _b !== void 0 ? _b : {},
19054
+ title = _l.title,
19055
+ aspectRatio = _l.aspectRatio,
19056
+ cameraFeedMode = _l.cameraFeedMode,
19057
+ instructions = _l.instructions,
19058
+ contentUrl = _l.contentUrl,
19059
+ content = _l.content,
19060
+ uploadState = _l.uploadState;
18990
19061
  var _m = React.useContext(CameraStateContext),
18991
19062
  cameraReady = _m.cameraReady,
18992
19063
  cameraAccessDenied = _m.cameraAccessDenied,
18993
19064
  retryCameraAccess = _m.retryCameraAccess;
18994
19065
  var theme = styled.useTheme();
18995
- var maskColor = (_d = (_c = (_b = theme.documentCapture) === null || _b === void 0 ? void 0 : _b.guideBox) === null || _c === void 0 ? void 0 : _c.maskColor) !== null && _d !== void 0 ? _d : cameraFeedMode === 'snapToGuides' ? '#708090' : "rgba(0, 0, 0, 0.5)";
19066
+ var maskColor = (_e = (_d = (_c = theme.documentCapture) === null || _c === void 0 ? void 0 : _c.guideBox) === null || _d === void 0 ? void 0 : _d.maskColor) !== null && _e !== void 0 ? _e : cameraFeedMode === 'snapToGuides' ? '#708090' : "rgba(0, 0, 0, 0.5)";
18996
19067
  var verbiage = useTranslations(rawVerbiage, {
18997
- headingText: 'Document Capture',
19068
+ headingText: title,
18998
19069
  loadingBtnText: 'Camera initializing...',
18999
19070
  retryCameraAccessBtnText: 'Retry',
19000
19071
  captureBtnText: 'Capture',
@@ -19017,47 +19088,46 @@ var DocumentCaptureScreen = function DocumentCaptureScreen(_a) {
19017
19088
  return tslib.__generator(this, function (_a) {
19018
19089
  switch (_a.label) {
19019
19090
  case 0:
19020
- _a.trys.push([0, 3,, 4]);
19091
+ _a.trys.push([0, 2,, 3]);
19021
19092
  dispatch({
19022
19093
  type: 'uploadStarted'
19023
19094
  });
19024
- return [4 /*yield*/, uploadDocument(imageBlob, {
19095
+ return [4 /*yield*/, uploadDocument(content, {
19025
19096
  filetype: 'image/jpeg'
19026
19097
  })];
19027
19098
  case 1:
19028
19099
  documentId = _a.sent();
19029
19100
  dispatch({
19030
- type: 'uploadCompleted'
19101
+ type: 'uploadCompleted',
19102
+ payload: {
19103
+ documentId: documentId
19104
+ }
19031
19105
  });
19032
- return [4 /*yield*/, submit()];
19106
+ return [3 /*break*/, 3];
19033
19107
  case 2:
19034
- _a.sent();
19035
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(documentId);
19036
- return [3 /*break*/, 4];
19037
- case 3:
19038
19108
  _a.sent();
19039
19109
  dispatch({
19040
19110
  type: 'uploadFailed'
19041
19111
  });
19042
- return [3 /*break*/, 4];
19043
- case 4:
19112
+ return [3 /*break*/, 3];
19113
+ case 3:
19044
19114
  return [2 /*return*/];
19045
19115
  }
19046
19116
  });
19047
19117
  });
19048
19118
  }
19049
19119
  return /*#__PURE__*/React__default['default'].createElement(PageContainer, {
19050
- className: "flex ".concat((_e = classNames.container) !== null && _e !== void 0 ? _e : '')
19120
+ className: "flex ".concat((_f = classNames.container) !== null && _f !== void 0 ? _f : '')
19051
19121
  }, /*#__PURE__*/React__default['default'].createElement(CameraFeedWrapper, {
19052
19122
  className: classNames.cameraFeedWrapper,
19053
- "$mode": cameraFeedMode,
19123
+ "$mode": cameraFeedMode !== null && cameraFeedMode !== void 0 ? cameraFeedMode : 'snapToGuides',
19054
19124
  "$x": rectX,
19055
19125
  "$y": rectY + rectOffsetTop,
19056
19126
  "$w": rectWidth,
19057
19127
  "$h": rectHeight
19058
- }, imageUrl ? ( /*#__PURE__*/React__default['default'].createElement(PreviewImage, {
19128
+ }, contentUrl ? ( /*#__PURE__*/React__default['default'].createElement(PreviewImage, {
19059
19129
  alt: "",
19060
- src: imageUrl,
19130
+ src: contentUrl,
19061
19131
  className: classNames.previewImage
19062
19132
  })) : ( /*#__PURE__*/React__default['default'].createElement(CameraVideoTag, {
19063
19133
  className: classNames.cameraFeed
@@ -19084,7 +19154,7 @@ var DocumentCaptureScreen = function DocumentCaptureScreen(_a) {
19084
19154
  variant: "negative",
19085
19155
  finished: true,
19086
19156
  onClick: retryCameraAccess
19087
- }, verbiage.retryCameraAccessBtnText)) : imageUrl ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, uploadState === 'not_started' ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(LoaderButton, {
19157
+ }, verbiage.retryCameraAccessBtnText)) : contentUrl ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, uploadState === 'not_started' ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(LoaderButton, {
19088
19158
  className: classNames.retryCaptureBtn,
19089
19159
  finished: true,
19090
19160
  variant: "warning",
@@ -19103,7 +19173,7 @@ var DocumentCaptureScreen = function DocumentCaptureScreen(_a) {
19103
19173
  finished: uploadState !== 'in_progress',
19104
19174
  variant: uploadState === 'failed' ? 'negative' : 'positive',
19105
19175
  onClick: onSubmitClick,
19106
- disabled: ['in_progress', 'succeeded'].includes(uploadState)
19176
+ disabled: ['in_progress', 'succeeded'].includes(uploadState !== null && uploadState !== void 0 ? uploadState : '')
19107
19177
  }, uploadState === 'succeeded' ? verbiage.successBtnText : uploadState === 'failed' ? verbiage.retryUploadBtnText : verbiage.uploadingBtnText)))) : ( /*#__PURE__*/React__default['default'].createElement(LoaderButton, {
19108
19178
  className: classNames.captureBtn,
19109
19179
  finished: cameraReady,
@@ -19130,18 +19200,26 @@ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, temp
19130
19200
 
19131
19201
  var DocumentCaptureWizard = function DocumentCaptureWizard(_a) {
19132
19202
  var onSuccess = _a.onSuccess,
19203
+ onDocumentUploaded = _a.onDocumentUploaded,
19204
+ // TODO: onExitCapture, onUserCancel
19205
+ _b = _a.documents,
19206
+ // TODO: onExitCapture, onUserCancel
19207
+ documents = _b === void 0 ? [] : _b,
19133
19208
  aspectRatio = _a.aspectRatio,
19134
19209
  cameraFeedMode = _a.cameraFeedMode,
19135
19210
  instructions = _a.instructions,
19136
- _b = _a.classNames,
19137
- classNames = _b === void 0 ? {} : _b,
19138
- _c = _a.verbiage,
19139
- verbiage = _c === void 0 ? {} : _c;
19140
- return /*#__PURE__*/React__default['default'].createElement(DocumentCaptureStateProvider, null, /*#__PURE__*/React__default['default'].createElement(DocumentCaptureScreen, {
19211
+ _c = _a.classNames,
19212
+ classNames = _c === void 0 ? {} : _c,
19213
+ _d = _a.verbiage,
19214
+ verbiage = _d === void 0 ? {} : _d;
19215
+ return /*#__PURE__*/React__default['default'].createElement(DocumentCaptureStateProvider, {
19216
+ documents: documents,
19141
19217
  aspectRatio: aspectRatio,
19142
19218
  cameraFeedMode: cameraFeedMode,
19143
19219
  instructions: instructions,
19144
- onSuccess: onSuccess,
19220
+ onDocumentUploaded: onDocumentUploaded,
19221
+ onAllDocumentsUploaded: onSuccess
19222
+ }, /*#__PURE__*/React__default['default'].createElement(DocumentCaptureScreen, {
19145
19223
  classNames: classNames,
19146
19224
  verbiage: verbiage
19147
19225
  }));
@@ -19166,21 +19244,23 @@ var DocumentCapture = function DocumentCapture(_a) {
19166
19244
  onComplete = _a.onComplete,
19167
19245
  onExitCapture = _a.onExitCapture,
19168
19246
  onUserCancel = _a.onUserCancel,
19247
+ _c = _a.documents,
19248
+ documents = _c === void 0 ? [] : _c,
19169
19249
  aspectRatio = _a.aspectRatio,
19170
19250
  cameraFeedMode = _a.cameraFeedMode,
19171
19251
  instructions = _a.instructions,
19172
- _c = _a.theme,
19173
- theme = _c === void 0 ? 'default' : _c,
19174
- _d = _a.classNames,
19175
- classNames = _d === void 0 ? {} : _d,
19176
- _e = _a.verbiage,
19177
- verbiage = _e === void 0 ? {} : _e,
19178
- _f = _a.geolocationEnabled,
19179
- geolocationEnabled = _f === void 0 ? true : _f,
19180
- _g = _a.geolocationRequired,
19181
- geolocationRequired = _g === void 0 ? false : _g,
19182
- _h = _a.debugMode,
19183
- debugMode = _h === void 0 ? false : _h;
19252
+ _d = _a.theme,
19253
+ theme = _d === void 0 ? 'default' : _d,
19254
+ _e = _a.classNames,
19255
+ classNames = _e === void 0 ? {} : _e,
19256
+ _f = _a.verbiage,
19257
+ verbiage = _f === void 0 ? {} : _f,
19258
+ _g = _a.geolocationEnabled,
19259
+ geolocationEnabled = _g === void 0 ? true : _g,
19260
+ _h = _a.geolocationRequired,
19261
+ geolocationRequired = _h === void 0 ? false : _h,
19262
+ _j = _a.debugMode,
19263
+ debugMode = _j === void 0 ? false : _j;
19184
19264
  useLanguage(lang);
19185
19265
  return /*#__PURE__*/React__default['default'].createElement(AuthProvider, {
19186
19266
  sessionId: sessionId,
@@ -19206,6 +19286,7 @@ var DocumentCapture = function DocumentCapture(_a) {
19206
19286
  onSuccess: onComplete,
19207
19287
  onExitCapture: onExitCapture,
19208
19288
  onUserCancel: onUserCancel,
19289
+ documents: documents,
19209
19290
  aspectRatio: aspectRatio,
19210
19291
  cameraFeedMode: cameraFeedMode,
19211
19292
  instructions: instructions,