@@ -9,6 +9,7 @@ import * as HoverCard from "@radix-ui/react-hover-card";
9
9
import ModalUi from "../../primitives/ModalUi" ;
10
10
import FolderModal from "../shared/fields/FolderModal" ;
11
11
import { useTranslation } from "react-i18next" ;
12
+ import { handleDownloadPdf } from "../../constant/Utils" ;
12
13
13
14
function DriveBody ( props ) {
14
15
const { t } = useTranslation ( ) ;
@@ -100,16 +101,17 @@ function DriveBody(props) {
100
101
101
102
//function for navigate user to microapp-signature component
102
103
const checkPdfStatus = async ( data ) => {
103
- const signerExist = data . Signers && data . Signers ;
104
- const isDecline = data . IsDeclined && data . IsDeclined ;
105
- const isPlaceholder = data . Placeholders && data . Placeholders ;
106
- const signedUrl = data . SignedUrl ;
104
+ const signerExist = data ?. Signers ;
105
+ const isDecline = data ?. IsDeclined ;
106
+ const isPlaceholder = data ?. Placeholders ;
107
+ const signedUrl = data ?. SignedUrl ;
108
+ const isSignYourself = data ?. IsSignyourself ;
107
109
//checking if document has completed and request signature flow
108
110
if ( data ?. IsCompleted && signerExist ?. length > 0 ) {
109
111
navigate ( `/recipientSignPdf/${ data . objectId } ` ) ;
110
112
}
111
113
//checking if document has completed and signyour-self flow
112
- else if ( ! signerExist && ! isPlaceholder ) {
114
+ else if ( ( ! signerExist && ! isPlaceholder ) || isSignYourself ) {
113
115
navigate ( `/signaturePdf/${ data . objectId } ` ) ;
114
116
}
115
117
//checking if document has declined by someone
@@ -136,12 +138,10 @@ function DriveBody(props) {
136
138
}
137
139
} ;
138
140
139
- const handleMenuItemClick = ( selectType , data ) => {
141
+ const handleMenuItemClick = async ( selectType , data ) => {
140
142
switch ( selectType ) {
141
143
case "Download" : {
142
- const pdfName = data && data . Name ;
143
- const pdfUrl = data && data . SignedUrl ? data . SignedUrl : data . URL ;
144
- saveAs ( pdfUrl , `${ sanitizeFileName ( pdfName ) } _signed_by_OpenSign™.pdf` ) ;
144
+ await handleDownloadPdf ( [ data ] ) ;
145
145
break ;
146
146
}
147
147
case "Rename" : {
0 commit comments