@@ -29,32 +29,35 @@ type ResultStatus = {
2929 code : EnumResultStatus ;
3030 message ?: string ;
3131} ;
32- interface DocumentScanResult {
32+ interface DocumentResult {
3333 status : ResultStatus ;
3434 correctedImageResult ?: NormalizedImageResultItem | DSImageData ;
3535 originalImageResult ?: OriginalImageResultItem [ "imageData" ] ;
3636 detectedQuadrilateral ?: Quadrilateral ;
3737 _flowType ?: EnumFlowType ;
3838}
39- interface ControlButton {
39+ type ToolbarButtonConfig = Pick < ToolbarButton , "icon" | "label" | "className" | "isHidden" > ;
40+ interface ToolbarButton {
41+ id : string ;
4042 icon : string ;
41- text : string ;
43+ label : string ;
4244 onClick ?: ( ) => void | Promise < void > ;
43- disabled ?: boolean ;
45+ className ?: string ;
46+ isDisabled ?: boolean ;
47+ isHidden ?: boolean ;
4448}
4549
46- interface DocumentCorrectionViewControlIcons {
47- fullImageBtn ?: Pick < ControlButton , "icon" | "text" > ;
48- detectBordersBtn ?: Pick < ControlButton , "icon" | "text" > ;
49- applyBtn ?: Pick < ControlButton , "icon" | "text" > ;
50- containerStyle ?: Partial < CSSStyleDeclaration > ;
50+ interface DocumentCorrectionViewToolbarButtonsConfig {
51+ fullImage ?: ToolbarButtonConfig ;
52+ detectBorders ?: ToolbarButtonConfig ;
53+ apply ?: ToolbarButtonConfig ;
5154}
5255interface DocumentCorrectionViewConfig {
5356 container ?: HTMLElement ;
54- controlIcons ?: DocumentCorrectionViewControlIcons ;
57+ toolbarButtonsConfig ?: DocumentCorrectionViewToolbarButtonsConfig ;
5558 templateFilePath ?: string ;
5659 utilizedTemplateNames ?: UtilizedTemplateNames ;
57- onFinish ?: ( result : DocumentScanResult ) => void ;
60+ onFinish ?: ( result : DocumentResult ) => void ;
5861}
5962declare class DocumentCorrectionView {
6063 private resources ;
@@ -74,7 +77,7 @@ declare class DocumentCorrectionView {
7477 setFullImageBoundary ( ) : void ;
7578 setBoundaryAutomatically ( ) : Promise < void > ;
7679 confirmCorrection ( ) : Promise < void > ;
77- launch ( ) : Promise < DocumentScanResult > ;
80+ launch ( ) : Promise < DocumentResult > ;
7881 hideView ( ) : void ;
7982 /**
8083 * Normalize an image with DDN given a set of points
@@ -147,32 +150,32 @@ declare class DocumentScannerView {
147150 * @returns normalized image by DDN
148151 */
149152 private handleAutoCaptureMode ;
150- launch ( _demo_cameraType ?: _DEMO_CameraType ) : Promise < DocumentScanResult > ;
153+ launch ( _demo_cameraType ?: _DEMO_CameraType ) : Promise < DocumentResult > ;
151154 normalizeImage ( points : Quadrilateral [ "points" ] , originalImageData : OriginalImageResultItem [ "imageData" ] ) : Promise < NormalizedImageResultItem > ;
152155}
153156
154- interface ScanResultViewControlIcons {
155- uploadBtn ?: Pick < ControlButton , "icon" | "text" > ;
156- correctImageBtn ?: Pick < ControlButton , "icon" | "text" > ;
157- retakeBtn ?: Pick < ControlButton , "icon" | "text" > ;
158- doneBtn ?: Pick < ControlButton , "icon" | "text" > ;
159- containerStyle ?: Partial < CSSStyleDeclaration > ;
157+ interface DocumentResultViewToolbarButtonsConfig {
158+ retake ?: ToolbarButtonConfig ;
159+ correct ?: ToolbarButtonConfig ;
160+ share ?: ToolbarButtonConfig ;
161+ upload ?: ToolbarButtonConfig ;
162+ done ?: ToolbarButtonConfig ;
160163}
161- interface ScanResultViewConfig {
164+ interface DocumentResultViewConfig {
162165 container ?: HTMLElement ;
163- controlIcons ?: ScanResultViewControlIcons ;
164- onDone ?: ( result : DocumentScanResult ) => Promise < void > ;
165- onUpload ?: ( result : DocumentScanResult ) => Promise < void > ;
166+ toolbarButtonsConfig ?: DocumentResultViewToolbarButtonsConfig ;
167+ onDone ?: ( result : DocumentResult ) => Promise < void > ;
168+ onUpload ?: ( result : DocumentResult ) => Promise < void > ;
166169}
167- declare class ScanResultView {
170+ declare class DocumentResultView {
168171 private resources ;
169172 private config ;
170173 private scannerView ;
171174 private correctionView ;
172175 private container ;
173176 private currentScanResultViewResolver ?;
174- constructor ( resources : SharedResources , config : ScanResultViewConfig , scannerView : DocumentScannerView , correctionView : DocumentCorrectionView ) ;
175- launch ( ) : Promise < DocumentScanResult > ;
177+ constructor ( resources : SharedResources , config : DocumentResultViewConfig , scannerView : DocumentScannerView , correctionView : DocumentCorrectionView ) ;
178+ launch ( ) : Promise < DocumentResult > ;
176179 private handleUploadAndShareBtn ;
177180 private handleShare ;
178181 private handleCorrectImage ;
@@ -188,16 +191,16 @@ interface DocumentScannerConfig {
188191 license ?: string ;
189192 container ?: HTMLElement | string ;
190193 scannerViewConfig ?: DocumentScannerViewConfig ;
191- scanResultViewConfig ?: ScanResultViewConfig ;
194+ resultViewConfig ?: DocumentResultViewConfig ;
192195 correctionViewConfig ?: DocumentCorrectionViewConfig ;
193196 utilizedTemplateNames ?: UtilizedTemplateNames ;
194197}
195198interface SharedResources {
196199 cvRouter ?: CaptureVisionRouter ;
197200 cameraEnhancer ?: CameraEnhancer ;
198201 cameraView ?: CameraView ;
199- result ?: DocumentScanResult ;
200- onResultUpdated ?: ( result : DocumentScanResult ) => void ;
202+ result ?: DocumentResult ;
203+ onResultUpdated ?: ( result : DocumentResult ) => void ;
201204}
202205declare class DocumentScanner {
203206 private config ;
@@ -216,7 +219,7 @@ declare class DocumentScanner {
216219 components : {
217220 scannerView ?: DocumentScannerView ;
218221 correctionView ?: DocumentCorrectionView ;
219- scanResultView ?: ScanResultView ;
222+ scanResultView ?: DocumentResultView ;
220223 } ;
221224 } > ;
222225 private initializeResources ;
@@ -247,7 +250,7 @@ declare class DocumentScanner {
247250 * - Only Correction available + existing result: Goes to Correction
248251 * - Only ScanResult available + existing result: Goes to ScanResult
249252 *
250- * @returns Promise<DocumentScanResult > containing:
253+ * @returns Promise<DocumentResult > containing:
251254 * - status: Success/Failed/Cancelled with message
252255 * - originalImageResult: Raw captured image
253256 * - correctedImageResult: Normalized image (if correction applied)
@@ -256,7 +259,7 @@ declare class DocumentScanner {
256259 *
257260 * @throws Error if capture session already running
258261 */
259- launch ( _demo_cameraType ?: _DEMO_CameraType ) : Promise < DocumentScanResult > ;
262+ launch ( _demo_cameraType ?: _DEMO_CameraType ) : Promise < DocumentResult > ;
260263 /**
261264 * Checks if a capture session is currently in progress
262265 */
@@ -267,8 +270,8 @@ declare const DDS: {
267270 DocumentScanner : typeof DocumentScanner ;
268271 DocumentNormalizerView : typeof DocumentCorrectionView ;
269272 DocumentScannerView : typeof DocumentScannerView ;
270- ScanResultView : typeof ScanResultView ;
273+ DocumentResultView : typeof DocumentResultView ;
271274 EnumResultStatus : typeof EnumResultStatus ;
272275} ;
273276
274- export { ControlButton , DDS , DocumentCorrectionViewConfig , DocumentCorrectionViewControlIcons , DocumentCorrectionView as DocumentNormalizerView , DocumentScanResult , DocumentScanner , DocumentScannerConfig , DocumentScannerView , DocumentScannerViewConfig , EnumFlowType , EnumResultStatus , ResultStatus , ScanResultView , ScanResultViewConfig , ScanResultViewControlIcons , SharedResources , UtilizedTemplateNames } ;
277+ export { DDS , DocumentCorrectionViewConfig , DocumentCorrectionViewToolbarButtonsConfig , DocumentCorrectionView as DocumentNormalizerView , DocumentResult , DocumentResultView , DocumentResultViewConfig , DocumentResultViewToolbarButtonsConfig , DocumentScanner , DocumentScannerConfig , DocumentScannerView , DocumentScannerViewConfig , EnumFlowType , EnumResultStatus , ResultStatus , SharedResources , ToolbarButtonConfig , UtilizedTemplateNames } ;
0 commit comments