mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-09-05 01:07:39 +02:00
Compare commits
106
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e71924a264 | ||
|
|
4ae9748004 | ||
|
|
eda6113792 | ||
|
|
4f1509c836 | ||
|
|
dfcf32ef3e | ||
|
|
4a95257ee2 | ||
|
|
ee1e13ef61 | ||
|
|
c9c099ffc5 | ||
|
|
a80f4fb3c9 | ||
|
|
941f3ac47f | ||
|
|
80d3200d57 | ||
|
|
55926e25d2 | ||
|
|
a31f3ebad7 | ||
|
|
dc9c32c6ee | ||
|
|
dac3aac2a1 | ||
|
|
40196e823c | ||
|
|
7708b7e938 | ||
|
|
8bbc5a9bc6 | ||
|
|
4dbdfb1b77 | ||
|
|
05c51edce3 | ||
|
|
379e8cd95e | ||
|
|
9fd00d4427 | ||
|
|
ca114cf124 | ||
|
|
75128784db | ||
|
|
722f0e277e | ||
|
|
7089998966 | ||
|
|
52211ddfa4 | ||
|
|
2b8b762d35 | ||
|
|
04c228cd36 | ||
|
|
915f8e7700 | ||
|
|
218cea00b5 | ||
|
|
f38f5ea670 | ||
|
|
a9c08c8a9f | ||
|
|
9406c4f718 | ||
|
|
791d8beb06 | ||
|
|
57a9f3aca0 | ||
|
|
ae8bf187c8 | ||
|
|
88f2ab1f8e | ||
|
|
76f5136073 | ||
|
|
0f84cd8949 | ||
|
|
adfdf7606f | ||
|
|
ce671d4294 | ||
|
|
2e7cf7a9df | ||
|
|
f699d93e44 | ||
|
|
531ef4d0b2 | ||
|
|
4c6dbb6690 | ||
|
|
0beb60d1b5 | ||
|
|
893c9d7c42 | ||
|
|
b7a22d94db | ||
|
|
3d854756d1 | ||
|
|
251e7058f1 | ||
|
|
368eb24217 | ||
|
|
f89ef54b82 | ||
|
|
b9d9f8772b | ||
|
|
f2ee03e850 | ||
|
|
92e59a0072 | ||
|
|
5394c0b520 | ||
|
|
e4a9c6f8c2 | ||
|
|
e559d037c3 | ||
|
|
c9909a0869 | ||
|
|
988fc1bbfd | ||
|
|
1831bbcd70 | ||
|
|
ced9bbdbd5 | ||
|
|
15d57d937b | ||
|
|
555979869d | ||
|
|
4e6477297e | ||
|
|
e9e06fc53b | ||
|
|
ecb2818589 | ||
|
|
c442689573 | ||
|
|
88919f2634 | ||
|
|
1a1bc41283 | ||
|
|
4188caed33 | ||
|
|
50557d8bc5 | ||
|
|
0f1ef0406e | ||
|
|
ffc742b460 | ||
|
|
0c04cc6ce6 | ||
|
|
4e6dfed838 | ||
|
|
fdc0524ad2 | ||
|
|
096d5962a3 | ||
|
|
9ea36f94a7 | ||
|
|
2b66df992f | ||
|
|
ff3c31975e | ||
|
|
beaa5eca69 | ||
|
|
b98040faac | ||
|
|
fbbff0df61 | ||
|
|
07d5f393c0 | ||
|
|
8220b15a29 | ||
|
|
7cf638b2be | ||
|
|
9852c87be7 | ||
|
|
30fb8f31e3 | ||
|
|
ec4d875547 | ||
|
|
1268f65516 | ||
|
|
6551b2537a | ||
|
|
43eee63df2 | ||
|
|
4caf9f598a | ||
|
|
107eaca8f0 | ||
|
|
cc11848346 | ||
|
|
b138ccf625 | ||
|
|
27ff7baa6d | ||
|
|
3fc41f4255 | ||
|
|
b20aa33a04 | ||
|
|
a64da4cd85 | ||
|
|
e80bcfc586 | ||
|
|
de5b8160a2 | ||
|
|
83df969751 | ||
|
|
f04fd16c9e |
Generated
+1269
-793
File diff suppressed because it is too large
Load Diff
+21
-19
@@ -4,16 +4,17 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@formkit/auto-animate": "^0.8.2",
|
"@formkit/auto-animate": "^0.8.2",
|
||||||
"@lottiefiles/dotlottie-react": "^0.8.9",
|
"@lottiefiles/dotlottie-react": "^0.9.0",
|
||||||
"@pdf-lib/fontkit": "^1.1.1",
|
"@pdf-lib/fontkit": "^1.1.1",
|
||||||
"@radix-ui/themes": "^3.1.3",
|
"@radix-ui/themes": "^3.1.3",
|
||||||
"@react-pdf/renderer": "^3.4.4",
|
"@react-pdf/renderer": "^4.0.0",
|
||||||
"@reduxjs/toolkit": "^2.2.7",
|
"@reduxjs/toolkit": "^2.2.7",
|
||||||
"axios": "^1.7.5",
|
"axios": "^1.7.7",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
"i18next": "^23.14.0",
|
"i18next": "^23.15.1",
|
||||||
"i18next-browser-languagedetector": "^8.0.0",
|
"i18next-browser-languagedetector": "^8.0.0",
|
||||||
"i18next-http-backend": "^2.6.1",
|
"i18next-http-backend": "^2.6.1",
|
||||||
|
"jszip": "^3.10.1",
|
||||||
"jwt-decode": "^4.0.0",
|
"jwt-decode": "^4.0.0",
|
||||||
"moment": "^2.30.1",
|
"moment": "^2.30.1",
|
||||||
"nth-check": "^2.1.1",
|
"nth-check": "^2.1.1",
|
||||||
@@ -25,7 +26,7 @@
|
|||||||
"react-bootstrap": "^2.10.4",
|
"react-bootstrap": "^2.10.4",
|
||||||
"react-confetti": "^6.1.0",
|
"react-confetti": "^6.1.0",
|
||||||
"react-cookie": "^7.2.0",
|
"react-cookie": "^7.2.0",
|
||||||
"react-datepicker": "^7.3.0",
|
"react-datepicker": "^7.4.0",
|
||||||
"react-dnd": "^16.0.1",
|
"react-dnd": "^16.0.1",
|
||||||
"react-dnd-html5-backend": "^16.0.1",
|
"react-dnd-html5-backend": "^16.0.1",
|
||||||
"react-dnd-multi-backend": "^8.0.3",
|
"react-dnd-multi-backend": "^8.0.3",
|
||||||
@@ -33,17 +34,18 @@
|
|||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-gtm-module": "^2.0.11",
|
"react-gtm-module": "^2.0.11",
|
||||||
"react-helmet": "^6.1.0",
|
"react-helmet": "^6.1.0",
|
||||||
"react-i18next": "^15.0.1",
|
"react-i18next": "^15.0.2",
|
||||||
"react-konva": "^18.2.10",
|
"react-konva": "^18.2.10",
|
||||||
"react-pdf": "^9.1.0",
|
"react-pdf": "^9.1.1",
|
||||||
"react-quill-new": "^3.3.0",
|
"react-quill-new": "^3.3.2",
|
||||||
"react-redux": "^9.1.2",
|
"react-redux": "^9.1.2",
|
||||||
"react-rnd": "^10.4.11",
|
"react-rnd": "^10.4.13",
|
||||||
"react-router-dom": "^6.26.1",
|
"react-router-dom": "^6.26.2",
|
||||||
"react-scripts": "5.0.1",
|
"react-scripts": "5.0.1",
|
||||||
"react-scrollbars-custom": "^4.1.1",
|
"react-scrollbars-custom": "^4.1.1",
|
||||||
"react-select": "^5.8.0",
|
"react-select": "^5.8.1",
|
||||||
"react-signature-canvas": "^1.0.6",
|
"react-signature-canvas": "^1.0.6",
|
||||||
|
"react-syntax-highlighter": "^15.5.0",
|
||||||
"react-tooltip": "^5.28.0",
|
"react-tooltip": "^5.28.0",
|
||||||
"react-web-share": "^2.0.2",
|
"react-web-share": "^2.0.2",
|
||||||
"reactour": "^1.19.4",
|
"reactour": "^1.19.4",
|
||||||
@@ -59,7 +61,7 @@
|
|||||||
"build-webpack": "webpack --config webpack.config.js",
|
"build-webpack": "webpack --config webpack.config.js",
|
||||||
"build": "npm run version && npm run build-webpack && react-scripts build",
|
"build": "npm run version && npm run build-webpack && react-scripts build",
|
||||||
"build-watch": "webpack --config webpack.config.js --watch",
|
"build-watch": "webpack --config webpack.config.js --watch",
|
||||||
"start-dev": "concurrently \"npm run build-watch\" \"react-scripts start\"",
|
"start-dev": "react-scripts start",
|
||||||
"start": "serve -s build",
|
"start": "serve -s build",
|
||||||
"version": "curl -s https://api.github.com/repos/opensignlabs/opensign/releases/latest | grep '\"tag_name\":' | awk -F '\"' '{print $4}' > ./public/version.txt",
|
"version": "curl -s https://api.github.com/repos/opensignlabs/opensign/releases/latest | grep '\"tag_name\":' | awk -F '\"' '{print $4}' > ./public/version.txt",
|
||||||
"version-win": "powershell -Command \"Invoke-RestMethod -Uri 'https://api.github.com/repos/opensignlabs/opensign/releases/latest' | Select-Object -ExpandProperty tag_name | Out-File -FilePath ./public/version.txt\"",
|
"version-win": "powershell -Command \"Invoke-RestMethod -Uri 'https://api.github.com/repos/opensignlabs/opensign/releases/latest' | Select-Object -ExpandProperty tag_name | Out-File -FilePath ./public/version.txt\"",
|
||||||
@@ -96,25 +98,25 @@
|
|||||||
"@babel/core": "^7.25.2",
|
"@babel/core": "^7.25.2",
|
||||||
"@babel/preset-env": "^7.25.4",
|
"@babel/preset-env": "^7.25.4",
|
||||||
"@babel/preset-react": "^7.24.7",
|
"@babel/preset-react": "^7.24.7",
|
||||||
"@babel/runtime-corejs2": "^7.25.4",
|
"@babel/runtime-corejs2": "^7.25.6",
|
||||||
"autoprefixer": "^10.4.20",
|
"autoprefixer": "^10.4.20",
|
||||||
"babel-loader": "^9.1.3",
|
"babel-loader": "^9.2.1",
|
||||||
"clean-webpack-plugin": "^4.0.0",
|
"clean-webpack-plugin": "^4.0.0",
|
||||||
"commitizen": "^4.3.0",
|
"commitizen": "^4.3.0",
|
||||||
"concurrently": "^8.2.2",
|
"concurrently": "^9.0.1",
|
||||||
"css-loader": "^7.1.2",
|
"css-loader": "^7.1.2",
|
||||||
"daisyui": "^4.12.10",
|
"daisyui": "^4.12.10",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"dotenv-webpack": "^8.1.0",
|
"dotenv-webpack": "^8.1.0",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^9.11.1",
|
||||||
"eslint-plugin-prettier": "^5.2.1",
|
"eslint-plugin-prettier": "^5.2.1",
|
||||||
"eslint-plugin-react": "^7.34.3",
|
"eslint-plugin-react": "^7.36.1",
|
||||||
"lint-staged": "^15.2.10",
|
"lint-staged": "^15.2.10",
|
||||||
"mini-css-extract-plugin": "^2.9.1",
|
"mini-css-extract-plugin": "^2.9.1",
|
||||||
"postcss": "^8.4.45",
|
"postcss": "^8.4.47",
|
||||||
"prettier": "^3.3.3",
|
"prettier": "^3.3.3",
|
||||||
"pretty-quick": "^4.0.0",
|
"pretty-quick": "^4.0.0",
|
||||||
"tailwindcss": "^3.4.10",
|
"tailwindcss": "^3.4.13",
|
||||||
"terser-webpack-plugin": "^5.3.10",
|
"terser-webpack-plugin": "^5.3.10",
|
||||||
"webpack-cli": "^5.1.4"
|
"webpack-cli": "^5.1.4"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -131,7 +131,8 @@
|
|||||||
"Share": "Share",
|
"Share": "Share",
|
||||||
"View": "View",
|
"View": "View",
|
||||||
"option": "Option",
|
"option": "Option",
|
||||||
"Embed": "Embed"
|
"Embed": "Embed",
|
||||||
|
"Copy TemplateId":"Copy TemplateId"
|
||||||
},
|
},
|
||||||
"report-heading": {
|
"report-heading": {
|
||||||
"Sr.No": "Sr.No",
|
"Sr.No": "Sr.No",
|
||||||
@@ -151,7 +152,8 @@
|
|||||||
"Name": "Name",
|
"Name": "Name",
|
||||||
"Status": "Status",
|
"Status": "Status",
|
||||||
"created-date": "Created Date",
|
"created-date": "Created Date",
|
||||||
"Type": "Type"
|
"Type": "Type",
|
||||||
|
"Logs": "Logs"
|
||||||
},
|
},
|
||||||
"report-help": {
|
"report-help": {
|
||||||
"Draft Documents": "These are documents you have started but have not finalized for sending.",
|
"Draft Documents": "These are documents you have started but have not finalized for sending.",
|
||||||
@@ -263,7 +265,8 @@
|
|||||||
"make-template-private-alert": "Are you sure you want to make this template private? This will remove it from your public profile.",
|
"make-template-private-alert": "Are you sure you want to make this template private? This will remove it from your public profile.",
|
||||||
"public-role": "Public role",
|
"public-role": "Public role",
|
||||||
"public-url": "Public URL",
|
"public-url": "Public URL",
|
||||||
"public-url-copy-mssg": " Here’s your public URL: Copy it or share it with the signer, and you will be able to see all your publicly set templates.",
|
"public-url-copy": "Here’s your public URL: ",
|
||||||
|
"public-url-copy-mssg":"Copy it or share it with the signer, and you will be able to see all your publicly set templates.",
|
||||||
"add-public-url-alert": "Please add your public URL, and you will be able to make a public template.",
|
"add-public-url-alert": "Please add your public URL, and you will be able to make a public template.",
|
||||||
"share-with-alert": "You cannot share a template if any roles already have contacts assigned. Please remove all contact assignments from the roles before sharing the template.",
|
"share-with-alert": "You cannot share a template if any roles already have contacts assigned. Please remove all contact assignments from the roles before sharing the template.",
|
||||||
"share-with": "Share with",
|
"share-with": "Share with",
|
||||||
@@ -572,9 +575,10 @@
|
|||||||
"pdf-request-file-5": "You can click 'Auto Sign All' to automatically sign at all the locations meant to be signed by you. Make sure that you review the document properly before you click this button .",
|
"pdf-request-file-5": "You can click 'Auto Sign All' to automatically sign at all the locations meant to be signed by you. Make sure that you review the document properly before you click this button .",
|
||||||
"placeholder-sign-1": "Select a recipient from this list to add a place-holder where he is supposed to sign.The placeholder will appear in the same colour as the recipient name once you drop it on the document.",
|
"placeholder-sign-1": "Select a recipient from this list to add a place-holder where he is supposed to sign.The placeholder will appear in the same colour as the recipient name once you drop it on the document.",
|
||||||
"placeholder-sign-2": "Clicking 'Add recipients' button will allow you to add more signers.",
|
"placeholder-sign-2": "Clicking 'Add recipients' button will allow you to add more signers.",
|
||||||
"placeholder-sign-3": "Drag or click on a field to add it to the document.",
|
"placeholder-sign-3": "Click this button to add more recipients/signers to the document.",
|
||||||
"placeholder-sign-4": "The PDF content area already displays the template's existing placeholders. For your convenience, these placeholders will match the color of the recipient's name, making them easily identifiable.",
|
"placeholder-sign-4": "Drag or click on a field to add it to the document.",
|
||||||
"placeholder-sign-5": "Clicking 'Send' will save the document. In the next step you can customize the emails to be sent out to the recipients or copy the signing links and share those with the recipients yourself.",
|
"placeholder-sign-5": "The PDF content area already displays the template's existing placeholders. For your convenience, these placeholders will match the color of the recipient's name, making them easily identifiable.",
|
||||||
|
"placeholder-sign-6": "Clicking 'Send' will save the document. In the next step you can customize the emails to be sent out to the recipients or copy the signing links and share those with the recipients yourself.",
|
||||||
"report-1": "Click the 'Add' button to create a new template. Templates are reusable documents designed to quickly generate new documents with the same structure and varying signers. For example, an HR template for onboarding could have predefined roles like ‘HR Manager’ and ‘New Employee’. Each time you use the template, you can assign the ‘New Employee’ role to different incoming staff members, while the ‘HR Manager’ role remains constant, facilitating a seamless onboarding process for each recruit. ",
|
"report-1": "Click the 'Add' button to create a new template. Templates are reusable documents designed to quickly generate new documents with the same structure and varying signers. For example, an HR template for onboarding could have predefined roles like ‘HR Manager’ and ‘New Employee’. Each time you use the template, you can assign the ‘New Employee’ role to different incoming staff members, while the ‘HR Manager’ role remains constant, facilitating a seamless onboarding process for each recruit. ",
|
||||||
"redirect": "Click the 'Use' button to create a new document from an existing template.",
|
"redirect": "Click the 'Use' button to create a new document from an existing template.",
|
||||||
"bulksend": "To quickly create and send multiple documents using an existing template, click the 'Quick Send' button.",
|
"bulksend": "To quickly create and send multiple documents using an existing template, click the 'Quick Send' button.",
|
||||||
@@ -630,6 +634,19 @@
|
|||||||
"reason":"Reason",
|
"reason":"Reason",
|
||||||
"decline-by":"Declined/revoked by",
|
"decline-by":"Declined/revoked by",
|
||||||
"document-declined": "Document declined",
|
"document-declined": "Document declined",
|
||||||
|
"public-template-mssg-1":"To integrate OpenSign into your React or Next.js project, simply run the following command:",
|
||||||
|
"public-template-mssg-2" :"Ensure you have npm or yarn set up in your project. If you’re using Yarn, you can replace npm install with yarn add @opensign/react.",
|
||||||
|
"public-template-mssg-3" :"Need more details or examples?",
|
||||||
|
"public-template-mssg-4": "Visit the",
|
||||||
|
"public-template-mssg-5": " npm for the latest updates, detailed documentation, and version history.",
|
||||||
|
"public-template-mssg-6" :"You need to set this template as public before you can utilize this code snippet.",
|
||||||
|
"copy-code":"COPY",
|
||||||
|
"copied-code":"COPIED",
|
||||||
|
"Installation":"Installation",
|
||||||
|
"Usage" :"Usage",
|
||||||
|
"insufficient-credits":"Insufficient Signing Credits",
|
||||||
|
"insufficient-credits-mssg":"The owner of this document currently lacks the necessary OpenSign credits for you to sign. Please reach out to the owner if you require further details.",
|
||||||
|
"angular-npm-mssg-1": "To integrate OpenSign into your Angular project, simply run the following command:",
|
||||||
"quota-mail-info-head":"Monthly request signatures email limit",
|
"quota-mail-info-head":"Monthly request signatures email limit",
|
||||||
"quota-mail-info": "You can send upto 15 signature request emails every month. Upgrade now to send unlimited signing requests directly.",
|
"quota-mail-info": "You can send upto 15 signature request emails every month. Upgrade now to send unlimited signing requests directly.",
|
||||||
"quota-mail": "You've reached your limit of 15 signature request emails for this month. Upgrade now to continue sending emails directly.",
|
"quota-mail": "You've reached your limit of 15 signature request emails for this month. Upgrade now to continue sending emails directly.",
|
||||||
@@ -638,6 +655,19 @@
|
|||||||
"unauthorized-modal":"You don't have permission to perform this action, please contact {{adminEmail}}.",
|
"unauthorized-modal":"You don't have permission to perform this action, please contact {{adminEmail}}.",
|
||||||
"sent-this-month":"Sent this month",
|
"sent-this-month":"Sent this month",
|
||||||
"available-seats":"Available seats",
|
"available-seats":"Available seats",
|
||||||
"buy-users":"Buy more users"
|
"buy-users":"Buy more users",
|
||||||
|
"isenable-otp": "Enable OTP verification",
|
||||||
|
"isenable-otp-help": {
|
||||||
|
"p1": "Would you like to enable the verification process using a one-time password (OTP)?",
|
||||||
|
"p2": "Selecting this option will enable OTP verification. Users will receive a verification code via email, which they must enter to sign the document.",
|
||||||
|
"p3": "Selecting this option will disable OTP verification, allowing users to sign the document directly without additional steps.",
|
||||||
|
"p4": "Please choose the option that best suits your document signing requirements."
|
||||||
|
},
|
||||||
|
"advanced-options":"Advanced options",
|
||||||
|
"hide-advanced-options":"Hide Advanced options",
|
||||||
|
"download-files":"Download files",
|
||||||
|
"download-pdf":"Download Pdf",
|
||||||
|
"pdf-certificate":"Download Pdf + Certificate",
|
||||||
|
"document-logs":"Document logs"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,7 +136,8 @@
|
|||||||
"Name": "Nom",
|
"Name": "Nom",
|
||||||
"Status": "Statut",
|
"Status": "Statut",
|
||||||
"created-date": "Date de création",
|
"created-date": "Date de création",
|
||||||
"Type": "Saisir"
|
"Type": "Saisir",
|
||||||
|
"Logs": "Journaux"
|
||||||
},
|
},
|
||||||
"btnLabel": {
|
"btnLabel": {
|
||||||
"sign": "Signer",
|
"sign": "Signer",
|
||||||
@@ -150,7 +151,8 @@
|
|||||||
"Share": "Partager",
|
"Share": "Partager",
|
||||||
"View": "Voir",
|
"View": "Voir",
|
||||||
"option": "Option",
|
"option": "Option",
|
||||||
"Embed": "Intégrer"
|
"Embed": "Intégrer",
|
||||||
|
"Copy TemplateId": "Copier l'ID du modèle"
|
||||||
},
|
},
|
||||||
"report-help": {
|
"report-help": {
|
||||||
"Draft Documents": "Il s'agit de documents que vous avez commencés mais que vous n'avez pas finalisés pour envoi.",
|
"Draft Documents": "Il s'agit de documents que vous avez commencés mais que vous n'avez pas finalisés pour envoi.",
|
||||||
@@ -262,7 +264,8 @@
|
|||||||
"make-template-private-alert": "Êtes-vous sûr de vouloir rendre ce modèle privé ? Cela le supprimera de votre profil public.",
|
"make-template-private-alert": "Êtes-vous sûr de vouloir rendre ce modèle privé ? Cela le supprimera de votre profil public.",
|
||||||
"public-role": "Rôle public",
|
"public-role": "Rôle public",
|
||||||
"public-url": "URL publique",
|
"public-url": "URL publique",
|
||||||
"public-url-copy-mssg": "Voici votre URL publique : copiez-la ou partagez-le avec le signataire et vous pouvoir voir tous vos paramètres publics modèles.",
|
"public-url-copy": "Voici votre URL publique : ",
|
||||||
|
"public-url-copy-mssg": "copiez-la ou partagez-le avec le signataire et vous pouvoir voir tous vos paramètres publics modèles.",
|
||||||
"add-public-url-alert": "Veuillez ajouter votre URL publique et vous pourra rendre public modèle.",
|
"add-public-url-alert": "Veuillez ajouter votre URL publique et vous pourra rendre public modèle.",
|
||||||
"share-with-alert": "Vous ne pouvez pas partager un modèle si des contacts sont déjà attribués à des rôles. Veuillez supprimer toutes les attributions de contacts des rôles avant de partager le modèle.",
|
"share-with-alert": "Vous ne pouvez pas partager un modèle si des contacts sont déjà attribués à des rôles. Veuillez supprimer toutes les attributions de contacts des rôles avant de partager le modèle.",
|
||||||
"share-with": "Partager avec",
|
"share-with": "Partager avec",
|
||||||
@@ -571,9 +574,10 @@
|
|||||||
"pdf-request-file-5": "Vous pouvez cliquer sur 'Signer automatiquement tout' pour signer automatiquement à tous les emplacements que vous êtes censé signer. Assurez-vous de lire correctement le document avant de cliquer sur ce bouton.",
|
"pdf-request-file-5": "Vous pouvez cliquer sur 'Signer automatiquement tout' pour signer automatiquement à tous les emplacements que vous êtes censé signer. Assurez-vous de lire correctement le document avant de cliquer sur ce bouton.",
|
||||||
"placeholder-sign-1": "Sélectionnez un destinataire dans cette liste pour ajouter un espace réservé à l'endroit où il est censé signer. L'espace réservé apparaîtra de la même couleur que le nom du destinataire une fois que vous le déposerez sur le document.",
|
"placeholder-sign-1": "Sélectionnez un destinataire dans cette liste pour ajouter un espace réservé à l'endroit où il est censé signer. L'espace réservé apparaîtra de la même couleur que le nom du destinataire une fois que vous le déposerez sur le document.",
|
||||||
"placeholder-sign-2": "Cliquer sur le bouton 'Ajouter des destinataires' vous permettra d'ajouter plus de signataires.",
|
"placeholder-sign-2": "Cliquer sur le bouton 'Ajouter des destinataires' vous permettra d'ajouter plus de signataires.",
|
||||||
"placeholder-sign-3": "Faites glisser ou cliquez sur un champ pour l'ajouter au document.",
|
"placeholder-sign-3": "Cliquez sur ce bouton pour ajouter plus de destinataires/signataires au document",
|
||||||
"placeholder-sign-4": "La zone de contenu PDF affiche déjà les espaces réservés existants du modèle. Pour votre commodité, ces espaces réservés correspondront à la couleur du nom du destinataire, ce qui les rendra facilement identifiables.",
|
"placeholder-sign-4": "Faites glisser ou cliquez sur un champ pour l'ajouter au document.",
|
||||||
"placeholder-sign-5": "Cliquer sur 'Envoyer' enregistrera le document. À l'étape suivante, vous pourrez personnaliser les e-mails à envoyer aux destinataires ou copier les liens de signature et les partager vous-même avec les destinataires.",
|
"placeholder-sign-5": "La zone de contenu PDF affiche déjà les espaces réservés existants du modèle. Pour votre commodité, ces espaces réservés correspondront à la couleur du nom du destinataire, ce qui les rendra facilement identifiables.",
|
||||||
|
"placeholder-sign-6": "Cliquer sur 'Envoyer' enregistrera le document. À l'étape suivante, vous pourrez personnaliser les e-mails à envoyer aux destinataires ou copier les liens de signature et les partager vous-même avec les destinataires.",
|
||||||
"report-1": "Cliquez sur le bouton 'Ajouter' pour créer un nouveau modèle. Les modèles sont des documents réutilisables conçus pour générer rapidement de nouveaux documents avec la même structure et différents signataires. Par exemple, un modèle RH pour l'intégration peut avoir des rôles prédéfinis tels que 'Responsable RH' et ' Nouvel employé'. Chaque fois que vous utilisez le modèle, vous pouvez attribuer le rôle 'Nouvel employé' à différents membres du personnel entrants, tandis que le rôle 'Responsable RH' reste constant, facilitant ainsi un processus d'intégration fluide pour chaque recrue",
|
"report-1": "Cliquez sur le bouton 'Ajouter' pour créer un nouveau modèle. Les modèles sont des documents réutilisables conçus pour générer rapidement de nouveaux documents avec la même structure et différents signataires. Par exemple, un modèle RH pour l'intégration peut avoir des rôles prédéfinis tels que 'Responsable RH' et ' Nouvel employé'. Chaque fois que vous utilisez le modèle, vous pouvez attribuer le rôle 'Nouvel employé' à différents membres du personnel entrants, tandis que le rôle 'Responsable RH' reste constant, facilitant ainsi un processus d'intégration fluide pour chaque recrue",
|
||||||
"redirect": "Cliquez sur le bouton 'Utiliser' pour créer un nouveau document à partir d'un modèle existant.",
|
"redirect": "Cliquez sur le bouton 'Utiliser' pour créer un nouveau document à partir d'un modèle existant.",
|
||||||
"bulksend": "Pour créer et envoyer rapidement plusieurs documents à l'aide d'un modèle existant, cliquez sur le bouton 'Envoi rapide'.",
|
"bulksend": "Pour créer et envoyer rapidement plusieurs documents à l'aide d'un modèle existant, cliquez sur le bouton 'Envoi rapide'.",
|
||||||
@@ -629,6 +633,19 @@
|
|||||||
"reason" :"Raison",
|
"reason" :"Raison",
|
||||||
"decline-by" :"Refusé/révoqué par",
|
"decline-by" :"Refusé/révoqué par",
|
||||||
"document-declined":"document refusé",
|
"document-declined":"document refusé",
|
||||||
|
"public-template-mssg-1" :"Pour intégrer OpenSign dans votre projet React ou Next.js, exécutez simplement la commande suivante :",
|
||||||
|
"public-template-mssg-2" :"Assurez-vous que npm ou Yarn est configuré dans votre projet. Si vous utilisez Yarn, vous pouvez remplacer npm install par Yarn Add @opensign/react.",
|
||||||
|
"public-template-mssg-3" :"Besoin de plus de détails ou d'exemples ?",
|
||||||
|
"public-template-mssg-4": "Visitez le",
|
||||||
|
"public-template-mssg-5": "npm pour les dernières mises à jour, une documentation détaillée et l'historique des versions.",
|
||||||
|
"public-template-mssg-6":"Vous devez définir ce modèle comme public avant de pouvoir utiliser cet extrait de code.",
|
||||||
|
"copy-code":"COPIE",
|
||||||
|
"copied-code":"COPIÉ",
|
||||||
|
"Installation":"Installation",
|
||||||
|
"Usage" :"Usage",
|
||||||
|
"insufficient-credits":"Crédits de signature insuffisants",
|
||||||
|
"insufficient-credits-mssg" :"Le propriétaire de ce document ne dispose actuellement pas des crédits OpenSign nécessaires pour que vous puissiez le signer. Veuillez contacter le propriétaire si vous avez besoin de plus de détails.",
|
||||||
|
"angular-npm-mssg-1" :"Pour intégrer OpenSign dans votre projet Angular, exécutez simplement la commande suivante :",
|
||||||
"quota-mail-info-head":"Limite mensuelle d'e-mails de signatures de demandes",
|
"quota-mail-info-head":"Limite mensuelle d'e-mails de signatures de demandes",
|
||||||
"quota-mail-info": "Vous pouvez envoyer jusqu'à 15 e-mails de demande de signature chaque mois. Mettez à niveau maintenant pour envoyer directement des demandes de signature illimitées.",
|
"quota-mail-info": "Vous pouvez envoyer jusqu'à 15 e-mails de demande de signature chaque mois. Mettez à niveau maintenant pour envoyer directement des demandes de signature illimitées.",
|
||||||
"quota-mail": "Vous avez atteint votre limite de 15 e-mails de demande de signature pour ce mois. Mettez à niveau maintenant pour continuer à envoyer des e-mails directement.",
|
"quota-mail": "Vous avez atteint votre limite de 15 e-mails de demande de signature pour ce mois. Mettez à niveau maintenant pour continuer à envoyer des e-mails directement.",
|
||||||
@@ -637,5 +654,19 @@
|
|||||||
"unauthorized-modal":"Vous n'êtes pas autorisé à effectuer cette action, veuillez contacter {{adminEmail}}.",
|
"unauthorized-modal":"Vous n'êtes pas autorisé à effectuer cette action, veuillez contacter {{adminEmail}}.",
|
||||||
"sent-this-month":"envoyé ce mois-ci",
|
"sent-this-month":"envoyé ce mois-ci",
|
||||||
"available-seats":"Disponible sièges",
|
"available-seats":"Disponible sièges",
|
||||||
"buy-users":"Acheter plus d'utilisateurs"
|
"buy-users":"Acheter plus d'utilisateurs",
|
||||||
|
"isenable-otp": "Activer la vérification OTP",
|
||||||
|
"isenable-otp-help": {
|
||||||
|
"p1": "Souhaitez-vous activer le processus de vérification à l'aide d'un mot de passe à usage unique (OTP)?",
|
||||||
|
"p2": "La sélection de cette option activera la vérification OTP. Les utilisateurs recevront un code de vérification par e-mail, qu'ils devront saisir pour signer le document.",
|
||||||
|
"p3": "La sélection de cette option désactivera la vérification OTP, permettant aux utilisateurs de signer le document directement sans étapes supplémentaires.",
|
||||||
|
"p4": "Veuillez choisir l'option qui correspond le mieux à vos exigences en matière de signature de documents."
|
||||||
|
},
|
||||||
|
"advanced-options":"Options avancées",
|
||||||
|
"hide-advanced-options": "Masquer les options avancées",
|
||||||
|
"download-files" :"Télécharger des fichiers",
|
||||||
|
"download-pdf" :"Télécharger le PDF",
|
||||||
|
"pdf-certificate" :"Télécharger Pdf + Certificat",
|
||||||
|
"document-logs":"Journaux de documents"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -20,6 +20,9 @@ const Header = ({ showSidebar }) => {
|
|||||||
const { t, i18n } = useTranslation();
|
const { t, i18n } = useTranslation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { width } = useWindowSize();
|
const { width } = useWindowSize();
|
||||||
|
const current_notification_version = "1"; // Update this with each new feature release
|
||||||
|
// Get the dismissed version from local storage
|
||||||
|
const dismissedVersion = localStorage.getItem("notificationDismissedVersion");
|
||||||
const username = localStorage.getItem("username") || "";
|
const username = localStorage.getItem("username") || "";
|
||||||
const image = localStorage.getItem("profileImg") || dp;
|
const image = localStorage.getItem("profileImg") || dp;
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
@@ -30,9 +33,15 @@ const Header = ({ showSidebar }) => {
|
|||||||
);
|
);
|
||||||
const [emailUsed, setEmailUsed] = useState(0);
|
const [emailUsed, setEmailUsed] = useState(0);
|
||||||
const [isModal, setIsModal] = useState(false);
|
const [isModal, setIsModal] = useState(false);
|
||||||
|
const [showNotification, setShowNotification] = useState(
|
||||||
|
(!dismissedVersion || dismissedVersion !== current_notification_version) &&
|
||||||
|
true
|
||||||
|
);
|
||||||
const toggleDropdown = () => {
|
const toggleDropdown = () => {
|
||||||
setIsOpen(!isOpen);
|
setIsOpen(!isOpen);
|
||||||
|
if (width <= 768) {
|
||||||
|
showSidebar();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
checkSubscription();
|
checkSubscription();
|
||||||
@@ -58,6 +67,13 @@ const Header = ({ showSidebar }) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("err in while fetching monthlyfreeEmails", err);
|
console.log("err in while fetching monthlyfreeEmails", err);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
const applogo = await getAppLogo();
|
||||||
|
if (applogo?.logo) {
|
||||||
|
setAppLogo(applogo?.logo);
|
||||||
|
} else {
|
||||||
|
setAppLogo(localStorage.getItem("appLogo") || "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,17 +131,34 @@ const Header = ({ showSidebar }) => {
|
|||||||
const handleMailUsed = () => {
|
const handleMailUsed = () => {
|
||||||
setIsModal(!isModal);
|
setIsModal(!isModal);
|
||||||
};
|
};
|
||||||
|
// Handle dismissing the notification
|
||||||
|
const dismissNotification = () => {
|
||||||
|
// Store the current version as dismissed in local storage
|
||||||
|
localStorage.setItem(
|
||||||
|
"notificationDismissedVersion",
|
||||||
|
current_notification_version
|
||||||
|
);
|
||||||
|
setShowNotification(false);
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{isEnableSubscription && (
|
{isEnableSubscription && showNotification && (
|
||||||
<div className="shadow py-1 text-center bg-[#CAE4FA] text-[14px] p-1">
|
<div className="flex justify-between items-center shadow py-1 bg-[#CAE4FA] p-1">
|
||||||
{t("header-news")} —
|
<div className="text-center text-[14px] ml-auto">
|
||||||
<span
|
{t("header-news")} —
|
||||||
className="cursor-pointer font-medium underline text-blue-800"
|
<span
|
||||||
onClick={() => navigate("/profile")}
|
className="cursor-pointer font-medium underline text-blue-800"
|
||||||
|
onClick={() => navigate("/profile")}
|
||||||
|
>
|
||||||
|
{" " + t("header-news-btn") + "."}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="ml-auto mr-1 cursor-pointer"
|
||||||
|
onClick={() => dismissNotification()}
|
||||||
>
|
>
|
||||||
{" " + t("header-news-btn") + "."}
|
<i className="fa-light fa-xmark"></i>
|
||||||
</span>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="op-navbar bg-base-100 shadow">
|
<div className="op-navbar bg-base-100 shadow">
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import * as HoverCard from "@radix-ui/react-hover-card";
|
|||||||
import ModalUi from "../../primitives/ModalUi";
|
import ModalUi from "../../primitives/ModalUi";
|
||||||
import FolderModal from "../shared/fields/FolderModal";
|
import FolderModal from "../shared/fields/FolderModal";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { handleDownloadPdf } from "../../constant/Utils";
|
||||||
|
|
||||||
function DriveBody(props) {
|
function DriveBody(props) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -100,16 +101,17 @@ function DriveBody(props) {
|
|||||||
|
|
||||||
//function for navigate user to microapp-signature component
|
//function for navigate user to microapp-signature component
|
||||||
const checkPdfStatus = async (data) => {
|
const checkPdfStatus = async (data) => {
|
||||||
const signerExist = data.Signers && data.Signers;
|
const signerExist = data?.Signers;
|
||||||
const isDecline = data.IsDeclined && data.IsDeclined;
|
const isDecline = data?.IsDeclined;
|
||||||
const isPlaceholder = data.Placeholders && data.Placeholders;
|
const isPlaceholder = data?.Placeholders;
|
||||||
const signedUrl = data.SignedUrl;
|
const signedUrl = data?.SignedUrl;
|
||||||
|
const isSignYourself = data?.IsSignyourself;
|
||||||
//checking if document has completed and request signature flow
|
//checking if document has completed and request signature flow
|
||||||
if (data?.IsCompleted && signerExist?.length > 0) {
|
if (data?.IsCompleted && signerExist?.length > 0) {
|
||||||
navigate(`/recipientSignPdf/${data.objectId}`);
|
navigate(`/recipientSignPdf/${data.objectId}`);
|
||||||
}
|
}
|
||||||
//checking if document has completed and signyour-self flow
|
//checking if document has completed and signyour-self flow
|
||||||
else if (!signerExist && !isPlaceholder) {
|
else if ((!signerExist && !isPlaceholder) || isSignYourself) {
|
||||||
navigate(`/signaturePdf/${data.objectId}`);
|
navigate(`/signaturePdf/${data.objectId}`);
|
||||||
}
|
}
|
||||||
//checking if document has declined by someone
|
//checking if document has declined by someone
|
||||||
@@ -136,12 +138,10 @@ function DriveBody(props) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleMenuItemClick = (selectType, data) => {
|
const handleMenuItemClick = async (selectType, data) => {
|
||||||
switch (selectType) {
|
switch (selectType) {
|
||||||
case "Download": {
|
case "Download": {
|
||||||
const pdfName = data && data.Name;
|
await handleDownloadPdf([data]);
|
||||||
const pdfUrl = data && data.SignedUrl ? data.SignedUrl : data.URL;
|
|
||||||
saveAs(pdfUrl, `${sanitizeFileName(pdfName)}_signed_by_OpenSign™.pdf`);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "Rename": {
|
case "Rename": {
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import { checkIsSubscribed, getFileName } from "../../constant/Utils";
|
|||||||
import Upgrade from "../../primitives/Upgrade";
|
import Upgrade from "../../primitives/Upgrade";
|
||||||
import { isEnableSubscription } from "../../constant/const";
|
import { isEnableSubscription } from "../../constant/const";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { Tooltip } from "react-tooltip";
|
||||||
|
|
||||||
// import SelectFolder from "../../premitives/SelectFolder";
|
// import SelectFolder from "../../premitives/SelectFolder";
|
||||||
|
|
||||||
const EditTemplate = ({ template, onSuccess }) => {
|
const EditTemplate = ({ template, onSuccess }) => {
|
||||||
@@ -14,7 +16,8 @@ const EditTemplate = ({ template, onSuccess }) => {
|
|||||||
Description: template?.Description || "",
|
Description: template?.Description || "",
|
||||||
SendinOrder: template?.SendinOrder ? `${template?.SendinOrder}` : "false",
|
SendinOrder: template?.SendinOrder ? `${template?.SendinOrder}` : "false",
|
||||||
AutomaticReminders: template?.AutomaticReminders || false,
|
AutomaticReminders: template?.AutomaticReminders || false,
|
||||||
RemindOnceInEvery: template?.RemindOnceInEvery || 5
|
RemindOnceInEvery: template?.RemindOnceInEvery || 5,
|
||||||
|
IsEnableOTP: template?.IsEnableOTP ? `${template?.IsEnableOTP}` : "false"
|
||||||
});
|
});
|
||||||
const [isSubscribe, setIsSubscribe] = useState(false);
|
const [isSubscribe, setIsSubscribe] = useState(false);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -41,7 +44,7 @@ const EditTemplate = ({ template, onSuccess }) => {
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
const isChecked = formData.SendinOrder === "true" ? true : false;
|
const isChecked = formData.SendinOrder === "true" ? true : false;
|
||||||
const AutoReminder = formData?.AutomaticReminders || false;
|
const AutoReminder = formData?.AutomaticReminders || false;
|
||||||
|
const IsEnableOTP = formData.IsEnableOTP === "true" ? true : false;
|
||||||
let reminderDate = {};
|
let reminderDate = {};
|
||||||
if (AutoReminder) {
|
if (AutoReminder) {
|
||||||
const RemindOnceInEvery = parseInt(formData?.RemindOnceInEvery);
|
const RemindOnceInEvery = parseInt(formData?.RemindOnceInEvery);
|
||||||
@@ -49,7 +52,12 @@ const EditTemplate = ({ template, onSuccess }) => {
|
|||||||
ReminderDate.setDate(ReminderDate.getDate() + RemindOnceInEvery);
|
ReminderDate.setDate(ReminderDate.getDate() + RemindOnceInEvery);
|
||||||
reminderDate = { NextReminderDate: ReminderDate };
|
reminderDate = { NextReminderDate: ReminderDate };
|
||||||
}
|
}
|
||||||
const data = { ...formData, SendinOrder: isChecked, ...reminderDate };
|
const data = {
|
||||||
|
...formData,
|
||||||
|
SendinOrder: isChecked,
|
||||||
|
IsEnableOTP: IsEnableOTP,
|
||||||
|
...reminderDate
|
||||||
|
};
|
||||||
onSuccess(data);
|
onSuccess(data);
|
||||||
};
|
};
|
||||||
const handleAutoReminder = () => {
|
const handleAutoReminder = () => {
|
||||||
@@ -184,6 +192,70 @@ const EditTemplate = ({ template, onSuccess }) => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{isEnableSubscription && (
|
||||||
|
<div className="text-xs mt-2">
|
||||||
|
<label className="block">
|
||||||
|
<span className={isSubscribe ? "" : " text-gray-300"}>
|
||||||
|
{t("isenable-otp")}{" "}
|
||||||
|
<a data-tooltip-id="isenableotp-tooltip" className="ml-1">
|
||||||
|
<sup>
|
||||||
|
<i className="fa-light fa-question rounded-full border-[#33bbff] text-[#33bbff] text-[13px] border-[1px] py-[1.5px] px-[4px]"></i>
|
||||||
|
</sup>
|
||||||
|
</a>{" "}
|
||||||
|
{!isSubscribe && isEnableSubscription && <Upgrade />}
|
||||||
|
</span>
|
||||||
|
<Tooltip id="isenableotp-tooltip" className="z-50">
|
||||||
|
<div className="max-w-[200px] md:max-w-[450px]">
|
||||||
|
<p className="font-bold">{t("isenable-otp")}</p>
|
||||||
|
<p>{t("isenable-otp-help.p1")}</p>
|
||||||
|
<p className="p-[5px]">
|
||||||
|
<ol className="list-disc">
|
||||||
|
<li>
|
||||||
|
<span className="font-bold">{t("yes")}: </span>
|
||||||
|
<span>{t("isenable-otp-help.p2")}</span>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<span className="font-bold">{t("no")}: </span>
|
||||||
|
<span>{t("isenable-otp-help.p3")}</span>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</p>
|
||||||
|
<p>{t("isenable-otp-help.p4")}</p>
|
||||||
|
</div>
|
||||||
|
</Tooltip>
|
||||||
|
</label>
|
||||||
|
<div
|
||||||
|
className={`${
|
||||||
|
isSubscribe ? "" : "pointer-events-none opacity-50"
|
||||||
|
} flex items-center gap-2 ml-2 mb-1 `}
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
value={"true"}
|
||||||
|
className="op-radio op-radio-xs"
|
||||||
|
name="IsEnableOTP"
|
||||||
|
checked={formData.IsEnableOTP === "true"}
|
||||||
|
onChange={handleStrInput}
|
||||||
|
/>
|
||||||
|
<div className="text-center">{t("yes")}</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className={`${
|
||||||
|
isSubscribe ? "" : "pointer-events-none opacity-50"
|
||||||
|
} flex items-center gap-2 ml-2 mb-1 `}
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
value={"false"}
|
||||||
|
name="IsEnableOTP"
|
||||||
|
className="op-radio op-radio-xs"
|
||||||
|
checked={formData.IsEnableOTP === "false"}
|
||||||
|
onChange={handleStrInput}
|
||||||
|
/>
|
||||||
|
<div className="text-center">{t("no")}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<div className="mt-[1rem] flex justify-start">
|
<div className="mt-[1rem] flex justify-start">
|
||||||
<button type="submit" className="op-btn op-btn-primary">
|
<button type="submit" className="op-btn op-btn-primary">
|
||||||
{t("submit")}
|
{t("submit")}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { handleDownloadPdf, handleToPrint } from "../../constant/Utils";
|
import { handleToPrint } from "../../constant/Utils";
|
||||||
import { themeColor, emailRegex } from "../../constant/const";
|
import { themeColor, emailRegex } from "../../constant/const";
|
||||||
import Loader from "../../primitives/Loader";
|
import Loader from "../../primitives/Loader";
|
||||||
import ModalUi from "../../primitives/ModalUi";
|
import ModalUi from "../../primitives/ModalUi";
|
||||||
@@ -15,7 +15,8 @@ function EmailComponent({
|
|||||||
sender,
|
sender,
|
||||||
setIsAlert,
|
setIsAlert,
|
||||||
extUserId,
|
extUserId,
|
||||||
activeMailAdapter
|
activeMailAdapter,
|
||||||
|
setIsDownloadModal
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [emailList, setEmailList] = useState([]);
|
const [emailList, setEmailList] = useState([]);
|
||||||
@@ -29,6 +30,28 @@ function EmailComponent({
|
|||||||
const pdfName = pdfDetails[0]?.Name;
|
const pdfName = pdfDetails[0]?.Name;
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
let sendMail;
|
let sendMail;
|
||||||
|
|
||||||
|
const docId = !pdfDetails?.[0]?.IsEnableOTP
|
||||||
|
? pdfDetails?.[0]?.objectId
|
||||||
|
: "";
|
||||||
|
let presignedUrl = pdfUrl;
|
||||||
|
try {
|
||||||
|
// const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl });
|
||||||
|
const axiosRes = await axios.post(
|
||||||
|
`${localStorage.getItem("baseUrl")}/functions/getsignedurl`,
|
||||||
|
{ url: pdfUrl, docId: docId },
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
"content-type": "Application/json",
|
||||||
|
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
|
||||||
|
"X-Parse-Session-Token": localStorage.getItem("accesstoken")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
presignedUrl = axiosRes.data.result;
|
||||||
|
} catch (err) {
|
||||||
|
console.log("err in getsignedurl", err);
|
||||||
|
}
|
||||||
for (let i = 0; i < emailList.length; i++) {
|
for (let i = 0; i < emailList.length; i++) {
|
||||||
try {
|
try {
|
||||||
const imgPng =
|
const imgPng =
|
||||||
@@ -46,7 +69,7 @@ function EmailComponent({
|
|||||||
mailProvider: activeMailAdapter,
|
mailProvider: activeMailAdapter,
|
||||||
extUserId: extUserId,
|
extUserId: extUserId,
|
||||||
pdfName: pdfName,
|
pdfName: pdfName,
|
||||||
url: pdfUrl,
|
url: presignedUrl,
|
||||||
recipient: emailList[i],
|
recipient: emailList[i],
|
||||||
subject: `${sender.name} has signed the doc - ${pdfName}`,
|
subject: `${sender.name} has signed the doc - ${pdfName}`,
|
||||||
from: sender.email,
|
from: sender.email,
|
||||||
@@ -129,6 +152,11 @@ function EmailComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const handleClose = () => {
|
||||||
|
setIsEmail(false);
|
||||||
|
setEmailValue("");
|
||||||
|
setEmailList([]);
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{/* isEmail */}
|
{/* isEmail */}
|
||||||
@@ -154,7 +182,9 @@ function EmailComponent({
|
|||||||
<div className="flex flex-row">
|
<div className="flex flex-row">
|
||||||
{!isAndroid && (
|
{!isAndroid && (
|
||||||
<button
|
<button
|
||||||
onClick={(e) => handleToPrint(e, pdfUrl, setIsDownloading)}
|
onClick={(e) =>
|
||||||
|
handleToPrint(e, pdfUrl, setIsDownloading, pdfDetails)
|
||||||
|
}
|
||||||
className="op-btn op-btn-neutral op-btn-sm text-[15px]"
|
className="op-btn op-btn-neutral op-btn-sm text-[15px]"
|
||||||
>
|
>
|
||||||
<i className="fa-light fa-print" aria-hidden="true"></i>
|
<i className="fa-light fa-print" aria-hidden="true"></i>
|
||||||
@@ -163,9 +193,10 @@ function EmailComponent({
|
|||||||
)}
|
)}
|
||||||
<button
|
<button
|
||||||
className="op-btn op-btn-primary op-btn-sm text-[15px] ml-2"
|
className="op-btn op-btn-primary op-btn-sm text-[15px] ml-2"
|
||||||
onClick={() =>
|
onClick={() => {
|
||||||
handleDownloadPdf(pdfDetails, pdfUrl, setIsDownloading)
|
handleClose();
|
||||||
}
|
setIsDownloadModal(true);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<i className="fa-light fa-download" aria-hidden="true"></i>
|
<i className="fa-light fa-download" aria-hidden="true"></i>
|
||||||
{t("download")}
|
{t("download")}
|
||||||
@@ -261,11 +292,7 @@ function EmailComponent({
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="op-btn op-btn-ghost ml-2"
|
className="op-btn op-btn-ghost ml-2"
|
||||||
onClick={() => {
|
onClick={() => handleClose()}
|
||||||
setIsEmail(false);
|
|
||||||
setEmailValue("");
|
|
||||||
setEmailList([]);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{t("close")}
|
{t("close")}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -0,0 +1,267 @@
|
|||||||
|
import React, { useState } from "react";
|
||||||
|
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
|
||||||
|
import { tomorrow } from "react-syntax-highlighter/dist/esm/styles/prism";
|
||||||
|
import { copytoData } from "../../constant/Utils";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
|
function EmbedTab(props) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const tabName = [
|
||||||
|
{ title: "React/Next.js", icon: "fa-brands fa-react", color: "#61dafb" },
|
||||||
|
{ title: "JavaScript", icon: "fa-brands fa-js", color: "#ffd43b" },
|
||||||
|
{ title: "Angular", icon: "fa-brands fa-angular", color: "#ff5733" }
|
||||||
|
];
|
||||||
|
const [activeTab, setActiveTab] = useState(0);
|
||||||
|
// State to track if the code has been copied
|
||||||
|
const [isCopied, setIsCopied] = useState(false);
|
||||||
|
const reactCode = [
|
||||||
|
{
|
||||||
|
id: 0,
|
||||||
|
title: "Installation",
|
||||||
|
codeString: `
|
||||||
|
npm install @opensign/react`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
title: "Usage",
|
||||||
|
codeString: `
|
||||||
|
import React from "react";
|
||||||
|
import Opensign from "@opensign/react";
|
||||||
|
|
||||||
|
export function App() {
|
||||||
|
return (
|
||||||
|
<div className="app">
|
||||||
|
<Opensign
|
||||||
|
onLoad={() => console.log("success")}
|
||||||
|
onLoadError={(error) => console.log(error)}
|
||||||
|
templateId= {"${props.templateId}"}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
`
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
const angularCode = [
|
||||||
|
{
|
||||||
|
id: 0,
|
||||||
|
title: "Installation",
|
||||||
|
codeString: `
|
||||||
|
npm install @opensign/angular`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
title: "Usage",
|
||||||
|
codeString: `
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
import {OpensignComponent} from "@opensign/angular"
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector:'app-root',
|
||||||
|
standalone: true,
|
||||||
|
imports: [OpensignComponent],
|
||||||
|
template: '<opensign templateId={"${props.templateId}"}
|
||||||
|
(onLoad)="handleLoad()"
|
||||||
|
(onLoadError)="handleError($event)"
|
||||||
|
></opensign>',
|
||||||
|
})
|
||||||
|
export class AppComponent{
|
||||||
|
handleLoad() {
|
||||||
|
console.log("success");
|
||||||
|
}
|
||||||
|
handleError(error: string) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
`
|
||||||
|
}
|
||||||
|
];
|
||||||
|
const jsCodeString = `
|
||||||
|
<script
|
||||||
|
src= "https://app.opensignlabs.com/static/js/public-template.bundle.js"
|
||||||
|
id="opensign-script"
|
||||||
|
templateId=${props.templateId}
|
||||||
|
></script>
|
||||||
|
`;
|
||||||
|
|
||||||
|
const handleCopy = (code, ind) => {
|
||||||
|
copytoData(code);
|
||||||
|
setIsCopied({ ...isCopied, [ind]: true });
|
||||||
|
setTimeout(() => setIsCopied(false), 3000);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="mt-4 border-t-[1px]">
|
||||||
|
<div className="flex justify-center items-center mt-2">
|
||||||
|
<div role="tablist" className="op-tabs op-tabs-bordered">
|
||||||
|
{tabName.map((tabData, ind) => (
|
||||||
|
<div
|
||||||
|
onClick={() => setActiveTab(ind)}
|
||||||
|
key={ind}
|
||||||
|
role="tab"
|
||||||
|
className={`${
|
||||||
|
activeTab === ind ? "op-tab-active" : ""
|
||||||
|
} op-tab flex items-center`}
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
className={`${tabData.icon}`}
|
||||||
|
style={{ color: tabData.color }}
|
||||||
|
></i>
|
||||||
|
<span className="ml-1 text-[10px] font-medium md:font-normal md:text-[15px]">
|
||||||
|
{tabData.title}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{activeTab === 0 ? (
|
||||||
|
<div className="mt-4">
|
||||||
|
{reactCode.map((data, ind) => {
|
||||||
|
return (
|
||||||
|
<div key={ind}>
|
||||||
|
<p className="font-medium text-[18px]">
|
||||||
|
{t(`${data.title}`)}
|
||||||
|
</p>
|
||||||
|
<p className="text-[13px] mt-2">
|
||||||
|
{t("public-template-mssg-1")}
|
||||||
|
</p>
|
||||||
|
<div className="relative p-1">
|
||||||
|
<div
|
||||||
|
onClick={() => handleCopy(data.codeString, ind)}
|
||||||
|
className="absolute top-[20px] right-[20px] cursor-pointer"
|
||||||
|
>
|
||||||
|
<i className="fa-light fa-copy text-white mr-[2px]" />
|
||||||
|
<span className=" text-white">
|
||||||
|
{isCopied[ind] ? t("copied-code") : t("copy-code")}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<SyntaxHighlighter
|
||||||
|
customStyle={{
|
||||||
|
borderRadius: "15px"
|
||||||
|
}}
|
||||||
|
language="javascript"
|
||||||
|
style={tomorrow}
|
||||||
|
>
|
||||||
|
{data.codeString}
|
||||||
|
</SyntaxHighlighter>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
|
||||||
|
<p className="font-medium text-[15px]">
|
||||||
|
{t("public-template-mssg-3")}
|
||||||
|
</p>
|
||||||
|
<p className="my-[6px]">
|
||||||
|
{" "}
|
||||||
|
{t("public-template-mssg-4")}
|
||||||
|
<a
|
||||||
|
href="https://www.npmjs.com/package/@opensign/react"
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer"
|
||||||
|
className="cursor-pointer text-blue-700 "
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
OpenSign React package{" "}
|
||||||
|
</a>
|
||||||
|
{t("public-template-mssg-5")}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
) : activeTab === 1 ? (
|
||||||
|
<div className="mt-4">
|
||||||
|
<div>
|
||||||
|
{/* <p className="font-medium text-[18px]">{t(`${data.title}`)}</p> */}
|
||||||
|
|
||||||
|
<div className="relative p-1">
|
||||||
|
<div
|
||||||
|
onClick={() => handleCopy(jsCodeString, 0)}
|
||||||
|
className="absolute top-[20px] right-[20px] cursor-pointer"
|
||||||
|
>
|
||||||
|
<i className="fa-light fa-copy text-white mr-[2px]" />
|
||||||
|
<span className=" text-white">
|
||||||
|
{isCopied[0] ? t("copied-code") : t("copy-code")}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<SyntaxHighlighter
|
||||||
|
customStyle={{
|
||||||
|
borderRadius: "15px"
|
||||||
|
}}
|
||||||
|
language="javascript"
|
||||||
|
style={tomorrow}
|
||||||
|
>
|
||||||
|
{jsCodeString}
|
||||||
|
</SyntaxHighlighter>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
activeTab === 2 && (
|
||||||
|
<div className="mt-4">
|
||||||
|
{angularCode.map((data, ind) => {
|
||||||
|
return (
|
||||||
|
<div key={ind}>
|
||||||
|
<p className="font-medium text-[18px]">
|
||||||
|
{t(`${data.title}`)}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p className="text-[13px] mt-2">
|
||||||
|
{t("angular-npm-mssg-1")}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div className="relative p-1">
|
||||||
|
<div
|
||||||
|
onClick={() => handleCopy(data.codeString, ind)}
|
||||||
|
className="absolute top-[20px] right-[20px] cursor-pointer"
|
||||||
|
>
|
||||||
|
<i className="fa-light fa-copy text-white mr-[2px]" />
|
||||||
|
<span className=" text-white">
|
||||||
|
{isCopied[ind] ? t("copied-code") : t("copy-code")}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<SyntaxHighlighter
|
||||||
|
customStyle={{
|
||||||
|
borderRadius: "15px"
|
||||||
|
}}
|
||||||
|
language="javascript"
|
||||||
|
style={tomorrow}
|
||||||
|
>
|
||||||
|
{data.codeString}
|
||||||
|
</SyntaxHighlighter>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
|
||||||
|
<p className="font-medium text-[15px]">
|
||||||
|
{t("public-template-mssg-3")}
|
||||||
|
</p>
|
||||||
|
<p className="my-[6px]">
|
||||||
|
{" "}
|
||||||
|
{t("public-template-mssg-4")}
|
||||||
|
<a
|
||||||
|
href="https://www.npmjs.com/package/@opensign/angular"
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer"
|
||||||
|
className="cursor-pointer text-blue-700 "
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
OpenSign Angular package{" "}
|
||||||
|
</a>
|
||||||
|
{t("public-template-mssg-5")}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default EmbedTab;
|
||||||
@@ -39,7 +39,8 @@ function Header({
|
|||||||
clickOnZoomOut,
|
clickOnZoomOut,
|
||||||
handleRotationFun,
|
handleRotationFun,
|
||||||
isDisableRotate,
|
isDisableRotate,
|
||||||
templateId
|
templateId,
|
||||||
|
setIsDownloadModal
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const filterPrefill =
|
const filterPrefill =
|
||||||
@@ -94,9 +95,13 @@ function Header({
|
|||||||
>
|
>
|
||||||
<DropdownMenu.Item
|
<DropdownMenu.Item
|
||||||
className="DropdownMenuItem"
|
className="DropdownMenuItem"
|
||||||
onClick={() =>
|
onClick={() => {
|
||||||
handleDownloadPdf(pdfDetails, pdfUrl, setIsDownloading)
|
if (isCompleted) {
|
||||||
}
|
setIsDownloadModal(true);
|
||||||
|
} else {
|
||||||
|
handleDownloadPdf(pdfDetails, setIsDownloading);
|
||||||
|
}
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<div className="flex flex-row">
|
<div className="flex flex-row">
|
||||||
<i
|
<i
|
||||||
@@ -142,7 +147,7 @@ function Header({
|
|||||||
<DropdownMenu.Item
|
<DropdownMenu.Item
|
||||||
className="DropdownMenuItem"
|
className="DropdownMenuItem"
|
||||||
onClick={(e) =>
|
onClick={(e) =>
|
||||||
handleToPrint(e, pdfUrl, setIsDownloading)
|
handleToPrint(e, pdfUrl, setIsDownloading, pdfDetails)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<div className="flex flex-row">
|
<div className="flex flex-row">
|
||||||
@@ -209,57 +214,67 @@ function Header({
|
|||||||
sideOffset={5}
|
sideOffset={5}
|
||||||
>
|
>
|
||||||
<DropdownMenu.Item
|
<DropdownMenu.Item
|
||||||
className="flex flex-row justify-center items-center text-[13px] focus:outline-none cursor-pointer"
|
className="DropdownMenuItem"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
handleDownloadPdf(
|
handleDownloadPdf(pdfDetails, setIsDownloading)
|
||||||
pdfDetails,
|
|
||||||
pdfDetails[0]?.URL,
|
|
||||||
setIsDownloading
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<i
|
<div className="flex flex-row">
|
||||||
className="fa-light fa-arrow-down mr-[3px]"
|
<i
|
||||||
aria-hidden="true"
|
className="fa-light fa-arrow-down mr-[3px]"
|
||||||
></i>
|
aria-hidden="true"
|
||||||
<span className="font-[500]">{t("download")}</span>
|
></i>
|
||||||
|
<span className="font-[500]">
|
||||||
|
{t("download")}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</DropdownMenu.Item>
|
</DropdownMenu.Item>
|
||||||
{!isDisableRotate && (
|
{!isDisableRotate && (
|
||||||
<>
|
<>
|
||||||
<DropdownMenu.Item
|
<DropdownMenu.Item
|
||||||
className="flex flex-row justify-center items-center text-[13px] focus:outline-none cursor-pointer"
|
className="DropdownMenuItem"
|
||||||
onClick={() => handleRotationFun(90)}
|
onClick={() => handleRotationFun(90)}
|
||||||
>
|
>
|
||||||
<i className="fa-light fa-rotate-right text-gray-500 2xl:text-[30px] mr-[3px]"></i>
|
<div className="flex flex-row">
|
||||||
<span className="font-[500]">
|
<i className="fa-light fa-rotate-right text-gray-500 2xl:text-[30px] mr-[3px]"></i>
|
||||||
{t("rotate-right")}
|
<span className="font-[500]">
|
||||||
</span>
|
{t("rotate-right")}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</DropdownMenu.Item>
|
</DropdownMenu.Item>
|
||||||
<DropdownMenu.Item
|
<DropdownMenu.Item
|
||||||
className="flex flex-row justify-center items-center text-[13px] focus:outline-none cursor-pointer"
|
className="DropdownMenuItem"
|
||||||
onClick={() => handleRotationFun(-90)}
|
onClick={() => handleRotationFun(-90)}
|
||||||
>
|
>
|
||||||
<i className="fa-light fa-rotate-left text-gray-500 2xl:text-[30px] mr-[3px]"></i>
|
<div className="flex flex-row">
|
||||||
<span className="font-[500]">
|
<i className="fa-light fa-rotate-left text-gray-500 2xl:text-[30px] mr-[3px]"></i>
|
||||||
{t("rotate-left")}
|
<span className="font-[500]">
|
||||||
</span>
|
{t("rotate-left")}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</DropdownMenu.Item>
|
</DropdownMenu.Item>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<DropdownMenu.Item
|
<DropdownMenu.Item
|
||||||
className="flex flex-row justify-center items-center text-[13px] focus:outline-none cursor-pointer"
|
className="DropdownMenuItem"
|
||||||
onClick={() => clickOnZoomIn()}
|
onClick={() => clickOnZoomIn()}
|
||||||
>
|
>
|
||||||
<i className="fa-light fa-magnifying-glass-plus text-gray-500 2xl:text-[30px]"></i>
|
<div className="flex flex-row">
|
||||||
<span className="font-[500]">{t("zoom-in")}</span>
|
<i className="fa-light fa-magnifying-glass-plus text-gray-500 2xl:text-[30px] mr-[3px]"></i>
|
||||||
|
<span className="font-[500]">{t("zoom-in")}</span>
|
||||||
|
</div>
|
||||||
</DropdownMenu.Item>
|
</DropdownMenu.Item>
|
||||||
<DropdownMenu.Item
|
<DropdownMenu.Item
|
||||||
className="flex flex-row justify-center items-center text-[13px] focus:outline-none cursor-pointer"
|
className="DropdownMenuItem"
|
||||||
onClick={() => clickOnZoomOut()}
|
onClick={() => clickOnZoomOut()}
|
||||||
>
|
>
|
||||||
<i className="fa-light fa-magnifying-glass-minus text-gray-500 2xl:text-[30px]"></i>
|
<div className="flex flex-row">
|
||||||
<span className="font-[500]">{t("zoom-out")}</span>
|
<i className="fa-light fa-magnifying-glass-minus text-gray-500 2xl:text-[30px] mr-[3px]"></i>
|
||||||
|
<span className="font-[500]">
|
||||||
|
{t("zoom-out")}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</DropdownMenu.Item>
|
</DropdownMenu.Item>
|
||||||
</DropdownMenu.Content>
|
</DropdownMenu.Content>
|
||||||
</DropdownMenu.Portal>
|
</DropdownMenu.Portal>
|
||||||
@@ -342,7 +357,9 @@ function Header({
|
|||||||
alreadySign ? (
|
alreadySign ? (
|
||||||
<div className="flex flex-row">
|
<div className="flex flex-row">
|
||||||
<button
|
<button
|
||||||
onClick={(e) => handleToPrint(e, pdfUrl, setIsDownloading)}
|
onClick={(e) =>
|
||||||
|
handleToPrint(e, pdfUrl, setIsDownloading, pdfDetails)
|
||||||
|
}
|
||||||
type="button"
|
type="button"
|
||||||
className="op-btn op-btn-neutral op-btn-sm mr-[3px] shadow"
|
className="op-btn op-btn-neutral op-btn-sm mr-[3px] shadow"
|
||||||
>
|
>
|
||||||
@@ -370,9 +387,13 @@ function Header({
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="op-btn op-btn-primary op-btn-sm mr-[3px] shadow"
|
className="op-btn op-btn-primary op-btn-sm mr-[3px] shadow"
|
||||||
onClick={() =>
|
onClick={() => {
|
||||||
handleDownloadPdf(pdfDetails, pdfUrl, setIsDownloading)
|
if (isCompleted) {
|
||||||
}
|
setIsDownloadModal(true);
|
||||||
|
} else {
|
||||||
|
handleDownloadPdf(pdfDetails, setIsDownloading);
|
||||||
|
}
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
className="fa-light fa-download py-[3px]"
|
className="fa-light fa-download py-[3px]"
|
||||||
@@ -427,11 +448,7 @@ function Header({
|
|||||||
type="button"
|
type="button"
|
||||||
className="op-btn op-btn-neutral op-btn-sm mr-[3px] shadow"
|
className="op-btn op-btn-neutral op-btn-sm mr-[3px] shadow"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
handleDownloadPdf(
|
handleDownloadPdf(pdfDetails, setIsDownloading)
|
||||||
pdfDetails,
|
|
||||||
pdfUrl,
|
|
||||||
setIsDownloading
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<i className="fa-light fa-arrow-down font-semibold lg:hidden"></i>
|
<i className="fa-light fa-arrow-down font-semibold lg:hidden"></i>
|
||||||
@@ -459,7 +476,9 @@ function Header({
|
|||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
<button
|
<button
|
||||||
onClick={(e) => handleToPrint(e, pdfUrl, setIsDownloading)}
|
onClick={(e) =>
|
||||||
|
handleToPrint(e, pdfUrl, setIsDownloading, pdfDetails)
|
||||||
|
}
|
||||||
type="button"
|
type="button"
|
||||||
className="op-btn op-btn-neutral op-btn-sm gap-0 font-medium text-[12px] mr-[3px] shadow"
|
className="op-btn op-btn-neutral op-btn-sm gap-0 font-medium text-[12px] mr-[3px] shadow"
|
||||||
>
|
>
|
||||||
@@ -469,9 +488,9 @@ function Header({
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="op-btn op-btn-primary op-btn-sm gap-0 font-medium text-[12px] mr-[3px] shadow"
|
className="op-btn op-btn-primary op-btn-sm gap-0 font-medium text-[12px] mr-[3px] shadow"
|
||||||
onClick={() =>
|
onClick={() => {
|
||||||
handleDownloadPdf(pdfDetails, pdfUrl, setIsDownloading)
|
setIsDownloadModal(true);
|
||||||
}
|
}}
|
||||||
>
|
>
|
||||||
<i className="fa-light fa-download" aria-hidden="true"></i>
|
<i className="fa-light fa-download" aria-hidden="true"></i>
|
||||||
<span className="hidden lg:block ml-1">{t("download")}</span>
|
<span className="hidden lg:block ml-1">{t("download")}</span>
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ function SignPad({
|
|||||||
const [isTab, setIsTab] = useState("draw");
|
const [isTab, setIsTab] = useState("draw");
|
||||||
const [isSignImg, setIsSignImg] = useState("");
|
const [isSignImg, setIsSignImg] = useState("");
|
||||||
const [signValue, setSignValue] = useState("");
|
const [signValue, setSignValue] = useState("");
|
||||||
const [textWidth, setTextWidth] = useState(null);
|
const [textWidth, setTextWidth] = useState(0);
|
||||||
const [textHeight, setTextHeight] = useState(null);
|
const [textHeight, setTextHeight] = useState(0);
|
||||||
const [signatureType, setSignatureType] = useState("draw");
|
const [signatureType, setSignatureType] = useState("draw");
|
||||||
const fontOptions = [
|
const fontOptions = [
|
||||||
{ value: "Fasthand" },
|
{ value: "Fasthand" },
|
||||||
@@ -51,7 +51,7 @@ function SignPad({
|
|||||||
`Parse/${localStorage.getItem("parseAppId")}/currentUser`
|
`Parse/${localStorage.getItem("parseAppId")}/currentUser`
|
||||||
);
|
);
|
||||||
const jsonSender = JSON.parse(senderUser);
|
const jsonSender = JSON.parse(senderUser);
|
||||||
const currentUserName = jsonSender && jsonSender.name;
|
const currentUserName = jsonSender && jsonSender?.name;
|
||||||
|
|
||||||
//function for clear signature image
|
//function for clear signature image
|
||||||
const handleClear = () => {
|
const handleClear = () => {
|
||||||
@@ -137,7 +137,7 @@ function SignPad({
|
|||||||
(isTab === "draw" && isSignImg) ||
|
(isTab === "draw" && isSignImg) ||
|
||||||
(isTab === "image" && image) ||
|
(isTab === "image" && image) ||
|
||||||
(isTab === "mysignature" && isDefaultSign) ||
|
(isTab === "mysignature" && isDefaultSign) ||
|
||||||
(isTab === "type" && textWidth)
|
(isTab === "type" && signValue)
|
||||||
? false
|
? false
|
||||||
: image
|
: image
|
||||||
? false
|
? false
|
||||||
@@ -169,10 +169,10 @@ function SignPad({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const trimmedName = currentUserName && currentUserName.trim();
|
const trimmedName = currentUserName && currentUserName?.trim();
|
||||||
const firstCharacter = trimmedName?.charAt(0);
|
const firstCharacter = trimmedName?.charAt(0);
|
||||||
const userName = isInitial ? firstCharacter : currentUserName;
|
const userName = isInitial ? firstCharacter : currentUserName;
|
||||||
setSignValue(userName);
|
setSignValue(userName || "");
|
||||||
setFontSelect("Fasthand");
|
setFontSelect("Fasthand");
|
||||||
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
@@ -200,8 +200,10 @@ function SignPad({
|
|||||||
canvasRef.current.fromDataURL(isSignImg);
|
canvasRef.current.fromDataURL(isSignImg);
|
||||||
}
|
}
|
||||||
if (isTab === "type") {
|
if (isTab === "type") {
|
||||||
const trimmedName = signValue ? signValue.trim() : currentUserName.trim();
|
const trimmedName = signValue
|
||||||
const firstCharacter = trimmedName.charAt(0);
|
? signValue?.trim()
|
||||||
|
: currentUserName?.trim();
|
||||||
|
const firstCharacter = trimmedName?.charAt(0);
|
||||||
const userName = isInitial ? firstCharacter : signValue;
|
const userName = isInitial ? firstCharacter : signValue;
|
||||||
setSignValue(userName);
|
setSignValue(userName);
|
||||||
convertToImg(fontSelect, userName);
|
convertToImg(fontSelect, userName);
|
||||||
|
|||||||
@@ -33,14 +33,15 @@ export const openInNewTab = (url, target) => {
|
|||||||
export async function fetchSubscription(
|
export async function fetchSubscription(
|
||||||
extUserId,
|
extUserId,
|
||||||
contactObjId,
|
contactObjId,
|
||||||
isGuestSign = false
|
isGuestSign = false,
|
||||||
|
isPublic = false
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
const Extand_Class = localStorage.getItem("Extand_Class");
|
const Extand_Class = localStorage.getItem("Extand_Class");
|
||||||
const extClass = Extand_Class && JSON.parse(Extand_Class);
|
const extClass = Extand_Class && JSON.parse(Extand_Class);
|
||||||
// console.log("extClass ", extClass);
|
// console.log("extClass ", extClass);
|
||||||
let extUser;
|
let extUser;
|
||||||
if (extClass && extClass.length > 0) {
|
if (extClass && extClass.length > 0 && !isPublic) {
|
||||||
extUser = extClass[0].objectId;
|
extUser = extClass[0].objectId;
|
||||||
} else {
|
} else {
|
||||||
extUser = extUserId;
|
extUser = extUserId;
|
||||||
@@ -54,7 +55,7 @@ export async function fetchSubscription(
|
|||||||
};
|
};
|
||||||
const params = isGuestSign
|
const params = isGuestSign
|
||||||
? { contactId: contactObjId }
|
? { contactId: contactObjId }
|
||||||
: { extUserId: extUser };
|
: { extUserId: extUser, ispublic: isPublic };
|
||||||
const tenatRes = await axios.post(url, params, { headers: headers });
|
const tenatRes = await axios.post(url, params, { headers: headers });
|
||||||
let plan, status, billingDate, adminId;
|
let plan, status, billingDate, adminId;
|
||||||
if (isGuestSign) {
|
if (isGuestSign) {
|
||||||
@@ -708,7 +709,8 @@ export const createDocument = async (
|
|||||||
Signers: signers,
|
Signers: signers,
|
||||||
SendinOrder: Doc?.SendinOrder || false,
|
SendinOrder: Doc?.SendinOrder || false,
|
||||||
AutomaticReminders: Doc?.AutomaticReminders || false,
|
AutomaticReminders: Doc?.AutomaticReminders || false,
|
||||||
RemindOnceInEvery: parseInt(Doc?.RemindOnceInEvery || 5)
|
RemindOnceInEvery: parseInt(Doc?.RemindOnceInEvery || 5),
|
||||||
|
IsEnableOTP: Doc?.IsEnableOTP || false
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -1741,9 +1743,7 @@ export const contactBook = async (objectId) => {
|
|||||||
|
|
||||||
//function for getting document details from contract_Documents class
|
//function for getting document details from contract_Documents class
|
||||||
export const contractDocument = async (documentId) => {
|
export const contractDocument = async (documentId) => {
|
||||||
const data = {
|
const data = { docId: documentId };
|
||||||
docId: documentId
|
|
||||||
};
|
|
||||||
const documentDeatils = await axios
|
const documentDeatils = await axios
|
||||||
.post(`${localStorage.getItem("baseUrl")}functions/getDocument`, data, {
|
.post(`${localStorage.getItem("baseUrl")}functions/getDocument`, data, {
|
||||||
headers: {
|
headers: {
|
||||||
@@ -2039,30 +2039,32 @@ export const fetchUrl = async (url, pdfName) => {
|
|||||||
console.error("Error downloading the file:", error);
|
console.error("Error downloading the file:", error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
//handle download signed pdf
|
export const getSignedUrl = async (pdfUrl, docId) => {
|
||||||
export const handleDownloadPdf = async (
|
//use only axios here due to public template sign
|
||||||
pdfDetails,
|
const axiosRes = await axios.post(
|
||||||
pdfUrl,
|
`${localStorage.getItem("baseUrl")}/functions/getsignedurl`,
|
||||||
setIsDownloading
|
{ url: pdfUrl, docId: docId || "" },
|
||||||
) => {
|
{
|
||||||
const pdfName = pdfDetails[0] && pdfDetails[0].Name;
|
headers: {
|
||||||
setIsDownloading("pdf");
|
"content-type": "Application/json",
|
||||||
try {
|
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
|
||||||
// const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl });
|
"X-Parse-Session-Token": localStorage.getItem("accesstoken")
|
||||||
const axiosRes = await axios.post(
|
|
||||||
`${localStorage.getItem("baseUrl")}/functions/getsignedurl`,
|
|
||||||
{ url: pdfUrl },
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
"content-type": "Application/json",
|
|
||||||
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
|
|
||||||
"X-Parse-Session-Token": localStorage.getItem("accesstoken")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
}
|
||||||
const url = axiosRes.data.result;
|
);
|
||||||
|
const url = axiosRes.data.result;
|
||||||
|
return url;
|
||||||
|
};
|
||||||
|
//handle download signed pdf
|
||||||
|
export const handleDownloadPdf = async (pdfDetails, setIsDownloading) => {
|
||||||
|
const pdfName = pdfDetails[0] && pdfDetails[0]?.Name;
|
||||||
|
const pdfUrl = pdfDetails?.[0]?.SignedUrl || pdfDetails?.[0]?.URL;
|
||||||
|
setIsDownloading && setIsDownloading("pdf");
|
||||||
|
const docId = !pdfDetails?.[0]?.IsEnableOTP ? pdfDetails?.[0]?.objectId : "";
|
||||||
|
try {
|
||||||
|
const url = await getSignedUrl(pdfUrl, docId);
|
||||||
await fetchUrl(url, pdfName);
|
await fetchUrl(url, pdfName);
|
||||||
setIsDownloading("");
|
setIsDownloading && setIsDownloading("");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("err in getsignedurl", err);
|
console.log("err in getsignedurl", err);
|
||||||
setIsDownloading("");
|
setIsDownloading("");
|
||||||
@@ -2075,16 +2077,22 @@ export const sanitizeFileName = (pdfName) => {
|
|||||||
return pdfName.replace(/ /g, "_");
|
return pdfName.replace(/ /g, "_");
|
||||||
};
|
};
|
||||||
//function for print digital sign pdf
|
//function for print digital sign pdf
|
||||||
export const handleToPrint = async (event, pdfUrl, setIsDownloading) => {
|
export const handleToPrint = async (
|
||||||
|
event,
|
||||||
|
pdfUrl,
|
||||||
|
setIsDownloading,
|
||||||
|
pdfDetails
|
||||||
|
) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
setIsDownloading("pdf");
|
setIsDownloading("pdf");
|
||||||
|
const docId = !pdfDetails?.[0]?.IsEnableOTP ? pdfDetails?.[0]?.objectId : "";
|
||||||
try {
|
try {
|
||||||
// const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl });
|
// const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl });
|
||||||
//`localStorage.getItem("baseUrl")` is also use in public-profile flow for public-sign
|
//`localStorage.getItem("baseUrl")` is also use in public-profile flow for public-sign
|
||||||
//if we give this `appInfo.baseUrl` as a base url then in public-profile it will create base url of it's window.location.origin ex- opensign.me which is not base url
|
//if we give this `appInfo.baseUrl` as a base url then in public-profile it will create base url of it's window.location.origin ex- opensign.me which is not base url
|
||||||
const axiosRes = await axios.post(
|
const axiosRes = await axios.post(
|
||||||
`${localStorage.getItem("baseUrl")}/functions/getsignedurl`,
|
`${localStorage.getItem("baseUrl")}/functions/getsignedurl`,
|
||||||
{ url: pdfUrl },
|
{ url: pdfUrl, docId: docId },
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
"content-type": "Application/json",
|
"content-type": "Application/json",
|
||||||
@@ -2124,13 +2132,18 @@ export const handleToPrint = async (event, pdfUrl, setIsDownloading) => {
|
|||||||
//handle download signed pdf
|
//handle download signed pdf
|
||||||
export const handleDownloadCertificate = async (
|
export const handleDownloadCertificate = async (
|
||||||
pdfDetails,
|
pdfDetails,
|
||||||
setIsDownloading
|
setIsDownloading,
|
||||||
|
isZip
|
||||||
) => {
|
) => {
|
||||||
if (pdfDetails?.length > 0 && pdfDetails[0]?.CertificateUrl) {
|
if (pdfDetails?.length > 0 && pdfDetails[0]?.CertificateUrl) {
|
||||||
try {
|
try {
|
||||||
await fetch(pdfDetails[0] && pdfDetails[0]?.CertificateUrl);
|
await fetch(pdfDetails[0] && pdfDetails[0]?.CertificateUrl);
|
||||||
const certificateUrl = pdfDetails[0] && pdfDetails[0]?.CertificateUrl;
|
const certificateUrl = pdfDetails[0] && pdfDetails[0]?.CertificateUrl;
|
||||||
saveAs(certificateUrl, `Certificate_signed_by_OpenSign™.pdf`);
|
if (isZip) {
|
||||||
|
return certificateUrl;
|
||||||
|
} else {
|
||||||
|
saveAs(certificateUrl, `Certificate_signed_by_OpenSign™.pdf`);
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("err in download in certificate", err);
|
console.log("err in download in certificate", err);
|
||||||
}
|
}
|
||||||
@@ -2156,7 +2169,13 @@ export const handleDownloadCertificate = async (
|
|||||||
if (doc?.CertificateUrl) {
|
if (doc?.CertificateUrl) {
|
||||||
await fetch(doc?.CertificateUrl);
|
await fetch(doc?.CertificateUrl);
|
||||||
const certificateUrl = doc?.CertificateUrl;
|
const certificateUrl = doc?.CertificateUrl;
|
||||||
saveAs(certificateUrl, `Certificate_signed_by_OpenSign™.pdf`);
|
if (isZip) {
|
||||||
|
setIsDownloading("");
|
||||||
|
return certificateUrl;
|
||||||
|
} else {
|
||||||
|
saveAs(certificateUrl, `Certificate_signed_by_OpenSign™.pdf`);
|
||||||
|
}
|
||||||
|
|
||||||
setIsDownloading("");
|
setIsDownloading("");
|
||||||
} else {
|
} else {
|
||||||
setIsDownloading("certificate");
|
setIsDownloading("certificate");
|
||||||
@@ -2456,3 +2475,45 @@ export const handleRotateWarning = (signerPos, pageNumber) => {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// `generateTitleFromFilename` to generate Title of document from file name
|
||||||
|
export function generateTitleFromFilename(filename) {
|
||||||
|
try {
|
||||||
|
// Step 1: Trim whitespace
|
||||||
|
let title = filename.trim();
|
||||||
|
|
||||||
|
// Step 2: Remove the file extension (everything after the last '.')
|
||||||
|
const lastDotIndex = title.lastIndexOf(".");
|
||||||
|
if (lastDotIndex > 0) {
|
||||||
|
title = title.substring(0, lastDotIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 3: Replace special characters (except Unicode letters, digits, spaces, and hyphens)
|
||||||
|
title = title.replace(/[^\p{L}\p{N}\s-]/gu, " ");
|
||||||
|
|
||||||
|
// Step 4: Replace multiple spaces with a single space
|
||||||
|
title = title.replace(/\s+/g, " ");
|
||||||
|
|
||||||
|
// Step 5: Capitalize first letter of each word (Title Case), handling Unicode characters
|
||||||
|
title = title.replace(
|
||||||
|
/\p{L}\S*/gu,
|
||||||
|
(txt) => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
|
||||||
|
);
|
||||||
|
|
||||||
|
// Step 6: Restrict length of title (optional, let's say 100 characters)
|
||||||
|
if (title.length > 100) {
|
||||||
|
title = title.substring(0, 100).trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 7: Handle empty or invalid title by falling back to "Untitled Document"
|
||||||
|
if (!title || title.length === 0) {
|
||||||
|
return "Untitled Document";
|
||||||
|
}
|
||||||
|
|
||||||
|
return title;
|
||||||
|
} catch (error) {
|
||||||
|
// Handle unexpected errors gracefully by returning a default title
|
||||||
|
console.error("Error generating title from filename:", error);
|
||||||
|
return "Untitled Document";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { isEnableSubscription } from "../constant/const";
|
||||||
|
|
||||||
export default function reportJson(id) {
|
export default function reportJson(id) {
|
||||||
// console.log("json ", json);
|
// console.log("json ", json);
|
||||||
const head = ["Sr.No", "Title", "Note", "Folder", "File", "Owner", "Signers"];
|
const head = ["Sr.No", "Title", "Note", "Folder", "File", "Owner", "Signers"];
|
||||||
@@ -10,9 +12,36 @@ export default function reportJson(id) {
|
|||||||
"Owner",
|
"Owner",
|
||||||
"Signers"
|
"Signers"
|
||||||
];
|
];
|
||||||
|
const iphead = [
|
||||||
|
"Sr.No",
|
||||||
|
"Title",
|
||||||
|
"Note",
|
||||||
|
"Folder",
|
||||||
|
"File",
|
||||||
|
"Status",
|
||||||
|
"Signers"
|
||||||
|
];
|
||||||
const contactbook = ["Sr.No", "Name", "Email", "Phone"];
|
const contactbook = ["Sr.No", "Name", "Email", "Phone"];
|
||||||
const dashboardReportHead = ["Title", "File", "Owner", "Signers"];
|
const dashboardReportHead = ["Title", "File", "Owner", "Signers"];
|
||||||
const templateReport = ["Sr.No", "Title", "File", "Owner", "Signers"];
|
const templateReport = ["Sr.No", "Title", "File", "Owner", "Signers"];
|
||||||
|
const templateSubAction = isEnableSubscription
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
btnId: "2434",
|
||||||
|
btnLabel: "Embed",
|
||||||
|
hoverLabel: "Embed",
|
||||||
|
btnIcon: "fa-light fa-code",
|
||||||
|
action: "Embed"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
btnId: "2434",
|
||||||
|
btnLabel: "Copy TemplateId",
|
||||||
|
hoverLabel: "Copy TemplateId",
|
||||||
|
btnIcon: "fa-light fa-copy",
|
||||||
|
action: "CopyTemplateId"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
: [];
|
||||||
switch (id) {
|
switch (id) {
|
||||||
// draft documents report
|
// draft documents report
|
||||||
case "ByHuevtCFY":
|
case "ByHuevtCFY":
|
||||||
@@ -63,7 +92,7 @@ export default function reportJson(id) {
|
|||||||
case "1MwEuxLEkF":
|
case "1MwEuxLEkF":
|
||||||
return {
|
return {
|
||||||
reportName: "In-progress documents",
|
reportName: "In-progress documents",
|
||||||
heading: head,
|
heading: iphead,
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
btnId: "8901",
|
btnId: "8901",
|
||||||
@@ -354,13 +383,7 @@ export default function reportJson(id) {
|
|||||||
redirectUrl: "template",
|
redirectUrl: "template",
|
||||||
action: "redirect"
|
action: "redirect"
|
||||||
},
|
},
|
||||||
{
|
...templateSubAction,
|
||||||
btnId: "2434",
|
|
||||||
btnLabel: "Embed",
|
|
||||||
hoverLabel: "Embed",
|
|
||||||
btnIcon: "fa-light fa-code",
|
|
||||||
action: "Embed"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
btnId: "1834",
|
btnId: "1834",
|
||||||
btnLabel: "Delete",
|
btnLabel: "Delete",
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ const DebugPdf = () => {
|
|||||||
|
|
||||||
const inferPdfType = async (pdf) => {
|
const inferPdfType = async (pdf) => {
|
||||||
try {
|
try {
|
||||||
const firstPage = await pdf.getPage(2);
|
const firstPage = await pdf.getPage(pdf?.numPages > 1 ? 2 : 1);
|
||||||
const scale = 1;
|
const scale = 1;
|
||||||
const { width, height } = firstPage.getViewport({ scale });
|
const { width, height } = firstPage.getViewport({ scale });
|
||||||
setPdfDimension({ width: width, height: height });
|
setPdfDimension({ width: width, height: height });
|
||||||
|
|||||||
+232
-111
@@ -9,7 +9,12 @@ import SignersInput from "../components/shared/fields/SignersInput";
|
|||||||
import Title from "../components/Title";
|
import Title from "../components/Title";
|
||||||
import PageNotFound from "./PageNotFound";
|
import PageNotFound from "./PageNotFound";
|
||||||
import { SaveFileSize } from "../constant/saveFileSize";
|
import { SaveFileSize } from "../constant/saveFileSize";
|
||||||
import { checkIsSubscribed, getFileName, toDataUrl } from "../constant/Utils";
|
import {
|
||||||
|
checkIsSubscribed,
|
||||||
|
generateTitleFromFilename,
|
||||||
|
getFileName,
|
||||||
|
toDataUrl
|
||||||
|
} from "../constant/Utils";
|
||||||
import { PDFDocument } from "pdf-lib";
|
import { PDFDocument } from "pdf-lib";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { isEnableSubscription } from "../constant/const";
|
import { isEnableSubscription } from "../constant/const";
|
||||||
@@ -61,7 +66,8 @@ const Forms = (props) => {
|
|||||||
password: "",
|
password: "",
|
||||||
file: "",
|
file: "",
|
||||||
remindOnceInEvery: 5,
|
remindOnceInEvery: 5,
|
||||||
autoreminder: false
|
autoreminder: false,
|
||||||
|
IsEnableOTP: "false"
|
||||||
});
|
});
|
||||||
const [fileupload, setFileUpload] = useState("");
|
const [fileupload, setFileUpload] = useState("");
|
||||||
const [fileload, setfileload] = useState(false);
|
const [fileload, setfileload] = useState(false);
|
||||||
@@ -74,6 +80,7 @@ const Forms = (props) => {
|
|||||||
const [isDecrypting, setIsDecrypting] = useState(false);
|
const [isDecrypting, setIsDecrypting] = useState(false);
|
||||||
const [isCorrectPass, setIsCorrectPass] = useState(true);
|
const [isCorrectPass, setIsCorrectPass] = useState(true);
|
||||||
const [isSubscribe, setIsSubscribe] = useState(false);
|
const [isSubscribe, setIsSubscribe] = useState(false);
|
||||||
|
const [isAdvanceOpt, setIsAdvanceOpt] = useState(false);
|
||||||
const handleStrInput = (e) => {
|
const handleStrInput = (e) => {
|
||||||
setIsCorrectPass(true);
|
setIsCorrectPass(true);
|
||||||
setFormData({ ...formData, [e.target.name]: e.target.value });
|
setFormData({ ...formData, [e.target.name]: e.target.value });
|
||||||
@@ -137,12 +144,11 @@ const Forms = (props) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("err in sending posthog encryptedpdf", err);
|
console.log("err in sending posthog encryptedpdf", err);
|
||||||
}
|
}
|
||||||
// console.log("err ", err);
|
|
||||||
try {
|
try {
|
||||||
setIsDecrypting(true);
|
setIsDecrypting(true);
|
||||||
const size = files?.[0].size;
|
const size = files?.[0].size;
|
||||||
const name = generatePdfName(16);
|
const name = generatePdfName(16);
|
||||||
const url = "https://ai.nxglabs.in/decryptpdf"; //"https://ai.nxglabs.in/decryptpdf"; //
|
const url = "https://ai.nxglabs.in/decryptpdf"; //
|
||||||
let formData = new FormData();
|
let formData = new FormData();
|
||||||
formData.append("file", files[0]);
|
formData.append("file", files[0]);
|
||||||
formData.append("password", "");
|
formData.append("password", "");
|
||||||
@@ -185,6 +191,9 @@ const Forms = (props) => {
|
|||||||
if (parseFile.url()) {
|
if (parseFile.url()) {
|
||||||
setFileUpload(parseFile.url());
|
setFileUpload(parseFile.url());
|
||||||
setfileload(false);
|
setfileload(false);
|
||||||
|
const title = generateTitleFromFilename(files?.[0]?.name);
|
||||||
|
setFormData((obj) => ({ ...obj, Name: title }));
|
||||||
|
SaveFileSize(size, response.url(), tenantId);
|
||||||
const tenantId = localStorage.getItem("TenantId");
|
const tenantId = localStorage.getItem("TenantId");
|
||||||
SaveFileSize(size, parseFile.url(), tenantId);
|
SaveFileSize(size, parseFile.url(), tenantId);
|
||||||
return parseFile.url();
|
return parseFile.url();
|
||||||
@@ -258,6 +267,8 @@ const Forms = (props) => {
|
|||||||
setfileload(false);
|
setfileload(false);
|
||||||
if (response.url()) {
|
if (response.url()) {
|
||||||
const tenantId = localStorage.getItem("TenantId");
|
const tenantId = localStorage.getItem("TenantId");
|
||||||
|
const title = generateTitleFromFilename(files?.[0]?.name);
|
||||||
|
setFormData((obj) => ({ ...obj, Name: title }));
|
||||||
SaveFileSize(size, response.url(), tenantId);
|
SaveFileSize(size, response.url(), tenantId);
|
||||||
return response.url();
|
return response.url();
|
||||||
}
|
}
|
||||||
@@ -285,12 +296,17 @@ const Forms = (props) => {
|
|||||||
if (res.data) {
|
if (res.data) {
|
||||||
setFileUpload(res.data.url);
|
setFileUpload(res.data.url);
|
||||||
setfileload(false);
|
setfileload(false);
|
||||||
|
const title = generateTitleFromFilename(files?.[0]?.name);
|
||||||
|
setFormData((obj) => ({ ...obj, Name: title }));
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
e.target.value = "";
|
e.target.value = "";
|
||||||
setfileload(false);
|
setfileload(false);
|
||||||
setpercentage(0);
|
setpercentage(0);
|
||||||
console.log("err in libreconverter ", err);
|
console.log("err in libreconverter ", err);
|
||||||
|
alert(
|
||||||
|
"We are currently experiencing some issues with processing DOCX files. Please upload the PDF version or contact us on support@opensignlabs.com"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -329,6 +345,8 @@ const Forms = (props) => {
|
|||||||
setfileload(false);
|
setfileload(false);
|
||||||
if (response.url()) {
|
if (response.url()) {
|
||||||
const tenantId = localStorage.getItem("TenantId");
|
const tenantId = localStorage.getItem("TenantId");
|
||||||
|
const title = generateTitleFromFilename(file.name);
|
||||||
|
setFormData((obj) => ({ ...obj, Name: title }));
|
||||||
SaveFileSize(size, response.url(), tenantId);
|
SaveFileSize(size, response.url(), tenantId);
|
||||||
return response.url();
|
return response.url();
|
||||||
}
|
}
|
||||||
@@ -366,9 +384,10 @@ const Forms = (props) => {
|
|||||||
});
|
});
|
||||||
setFileUpload(response.url());
|
setFileUpload(response.url());
|
||||||
setfileload(false);
|
setfileload(false);
|
||||||
|
|
||||||
if (response.url()) {
|
if (response.url()) {
|
||||||
const tenantId = localStorage.getItem("TenantId");
|
const tenantId = localStorage.getItem("TenantId");
|
||||||
|
const title = generateTitleFromFilename(file.name);
|
||||||
|
setFormData((obj) => ({ ...obj, Name: title }));
|
||||||
SaveFileSize(size, response.url(), tenantId);
|
SaveFileSize(size, response.url(), tenantId);
|
||||||
return response.url();
|
return response.url();
|
||||||
}
|
}
|
||||||
@@ -402,6 +421,13 @@ const Forms = (props) => {
|
|||||||
object.set("SendinOrder", isChecked);
|
object.set("SendinOrder", isChecked);
|
||||||
object.set("AutomaticReminders", formData.autoreminder);
|
object.set("AutomaticReminders", formData.autoreminder);
|
||||||
object.set("RemindOnceInEvery", parseInt(formData.remindOnceInEvery));
|
object.set("RemindOnceInEvery", parseInt(formData.remindOnceInEvery));
|
||||||
|
if (isEnableSubscription) {
|
||||||
|
const IsEnableOTP =
|
||||||
|
formData?.IsEnableOTP === "false" ? false : true;
|
||||||
|
object.set("IsEnableOTP", IsEnableOTP);
|
||||||
|
} else {
|
||||||
|
object.set("IsEnableOTP", false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
object.set("URL", fileupload);
|
object.set("URL", fileupload);
|
||||||
object.set("CreatedBy", Parse.User.createWithoutData(currentUser.id));
|
object.set("CreatedBy", Parse.User.createWithoutData(currentUser.id));
|
||||||
@@ -428,7 +454,17 @@ const Forms = (props) => {
|
|||||||
setFormData({
|
setFormData({
|
||||||
Name: "",
|
Name: "",
|
||||||
Description: "",
|
Description: "",
|
||||||
Note: ""
|
Note:
|
||||||
|
props.title === "Sign Yourself"
|
||||||
|
? "Note to myself"
|
||||||
|
: "Please review and sign this document",
|
||||||
|
TimeToCompleteDays: 15,
|
||||||
|
SendinOrder: "true",
|
||||||
|
password: "",
|
||||||
|
file: "",
|
||||||
|
remindOnceInEvery: 5,
|
||||||
|
autoreminder: false,
|
||||||
|
IsEnableOTP: "false"
|
||||||
});
|
});
|
||||||
setFileUpload("");
|
setFileUpload("");
|
||||||
setpercentage(0);
|
setpercentage(0);
|
||||||
@@ -477,7 +513,8 @@ const Forms = (props) => {
|
|||||||
password: "",
|
password: "",
|
||||||
file: "",
|
file: "",
|
||||||
remindOnceInEvery: 5,
|
remindOnceInEvery: 5,
|
||||||
autoreminder: false
|
autoreminder: false,
|
||||||
|
IsEnableOTP: "false"
|
||||||
});
|
});
|
||||||
setFileUpload("");
|
setFileUpload("");
|
||||||
setpercentage(0);
|
setpercentage(0);
|
||||||
@@ -529,6 +566,8 @@ const Forms = (props) => {
|
|||||||
setFormData((prev) => ({ ...prev, password: "" }));
|
setFormData((prev) => ({ ...prev, password: "" }));
|
||||||
setFileUpload(parseFile.url());
|
setFileUpload(parseFile.url());
|
||||||
setfileload(false);
|
setfileload(false);
|
||||||
|
const title = generateTitleFromFilename(formData?.file?.name);
|
||||||
|
setFormData((obj) => ({ ...obj, Name: title }));
|
||||||
const tenantId = localStorage.getItem("TenantId");
|
const tenantId = localStorage.getItem("TenantId");
|
||||||
SaveFileSize(size, parseFile.url(), tenantId);
|
SaveFileSize(size, parseFile.url(), tenantId);
|
||||||
return parseFile.url();
|
return parseFile.url();
|
||||||
@@ -641,7 +680,7 @@ const Forms = (props) => {
|
|||||||
)}
|
)}
|
||||||
<div className="text-xs">
|
<div className="text-xs">
|
||||||
<label className="block">
|
<label className="block">
|
||||||
{`${t("report-heading.File")} (${t("file-type")} ${
|
{`${t("report-heading.File")} (${t("file-type")}${
|
||||||
isEnableSubscription ? ", docx)" : ")"
|
isEnableSubscription ? ", docx)" : ")"
|
||||||
}`}
|
}`}
|
||||||
<span className="text-red-500 text-[13px]">*</span>
|
<span className="text-red-500 text-[13px]">*</span>
|
||||||
@@ -754,120 +793,73 @@ const Forms = (props) => {
|
|||||||
isReset={isReset}
|
isReset={isReset}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{props.title === "Request Signatures" && (
|
{props.title !== "Sign Yourself" && (
|
||||||
<div className="text-xs mt-2">
|
<div className="text-xs mt-2">
|
||||||
<label className="block">
|
<label className="block">
|
||||||
{t("time-to-complete")}
|
{t("send-in-order")}
|
||||||
<span className="text-red-500 text-[13px]">*</span>
|
<a data-tooltip-id="sendInOrder-tooltip" className="ml-1">
|
||||||
|
<sup>
|
||||||
|
<i className="fa-light fa-question rounded-full border-[#33bbff] text-[#33bbff] text-[13px] border-[1px] py-[1.5px] px-[4px]"></i>
|
||||||
|
</sup>
|
||||||
|
</a>
|
||||||
|
<Tooltip id="sendInOrder-tooltip" className="z-50">
|
||||||
|
<div className="max-w-[200px] md:max-w-[450px]">
|
||||||
|
<p className="font-bold">{t("send-in-order")}</p>
|
||||||
|
<p>{t("send-in-order-help.p1")}</p>
|
||||||
|
<p className="p-[5px]">
|
||||||
|
<ol className="list-disc">
|
||||||
|
<li>
|
||||||
|
<span className="font-bold">{t("yes")}: </span>
|
||||||
|
<span>{t("send-in-order-help.p2")}</span>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<span className="font-bold">{t("no")}: </span>
|
||||||
|
<span>{t("send-in-order-help.p3")}</span>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</p>
|
||||||
|
<p>{t("send-in-order-help.p4")}</p>
|
||||||
|
</div>
|
||||||
|
</Tooltip>
|
||||||
</label>
|
</label>
|
||||||
<input
|
<div className="flex items-center gap-2 ml-2 mb-1">
|
||||||
type="number"
|
<input
|
||||||
name="TimeToCompleteDays"
|
type="radio"
|
||||||
className="op-input op-input-bordered op-input-sm focus:outline-none hover:border-base-content w-full text-xs"
|
value={"true"}
|
||||||
value={formData.TimeToCompleteDays}
|
className="op-radio op-radio-xs"
|
||||||
onChange={(e) => handleStrInput(e)}
|
name="SendinOrder"
|
||||||
onInvalid={(e) =>
|
checked={formData.SendinOrder === "true"}
|
||||||
e.target.setCustomValidity(t("input-required"))
|
onChange={handleStrInput}
|
||||||
}
|
/>
|
||||||
onInput={(e) => e.target.setCustomValidity("")}
|
<div className="text-center">{t("yes")}</div>
|
||||||
required
|
</div>
|
||||||
/>
|
<div className="flex items-center gap-2 ml-2 mb-1">
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
value={"false"}
|
||||||
|
name="SendinOrder"
|
||||||
|
className="op-radio op-radio-xs"
|
||||||
|
checked={formData.SendinOrder === "false"}
|
||||||
|
onChange={handleStrInput}
|
||||||
|
/>
|
||||||
|
<div className="text-center">{t("no")}</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{props.title !== "Sign Yourself" && (
|
{isAdvanceOpt && (
|
||||||
<>
|
<div className="overflow-y-auto z-[500] transition-all">
|
||||||
<div className="text-xs mt-2">
|
{props.title === "Request Signatures" && (
|
||||||
<label className="block">
|
|
||||||
{t("send-in-order")}
|
|
||||||
<a data-tooltip-id="sendInOrder-tooltip" className="ml-1">
|
|
||||||
<sup>
|
|
||||||
<i className="fa-light fa-question rounded-full border-[#33bbff] text-[#33bbff] text-[13px] border-[1px] py-[1.5px] px-[4px]"></i>
|
|
||||||
</sup>
|
|
||||||
</a>
|
|
||||||
<Tooltip id="sendInOrder-tooltip" className="z-50">
|
|
||||||
<div className="max-w-[200px] md:max-w-[450px]">
|
|
||||||
<p className="font-bold">{t("send-in-order")}</p>
|
|
||||||
<p>{t("send-in-order-help.p1")}</p>
|
|
||||||
<p className="p-[5px]">
|
|
||||||
<ol className="list-disc">
|
|
||||||
<li>
|
|
||||||
<span className="font-bold">{t("yes")}:</span>
|
|
||||||
<span>{t("send-in-order-help.p2")}</span>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<span className="font-bold">{t("no")}: </span>
|
|
||||||
<span>{t("send-in-order-help.p3")}</span>
|
|
||||||
</li>
|
|
||||||
</ol>
|
|
||||||
</p>
|
|
||||||
<p>{t("send-in-order-help.p4")}</p>
|
|
||||||
</div>
|
|
||||||
</Tooltip>
|
|
||||||
</label>
|
|
||||||
<div className="flex items-center gap-2 ml-2 mb-1">
|
|
||||||
<input
|
|
||||||
type="radio"
|
|
||||||
value={"true"}
|
|
||||||
className="op-radio op-radio-xs"
|
|
||||||
name="SendinOrder"
|
|
||||||
checked={formData.SendinOrder === "true"}
|
|
||||||
onChange={handleStrInput}
|
|
||||||
/>
|
|
||||||
<div className="text-center">{t("yes")}</div>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center gap-2 ml-2 mb-1">
|
|
||||||
<input
|
|
||||||
type="radio"
|
|
||||||
value={"false"}
|
|
||||||
name="SendinOrder"
|
|
||||||
className="op-radio op-radio-xs"
|
|
||||||
checked={formData.SendinOrder === "false"}
|
|
||||||
onChange={handleStrInput}
|
|
||||||
/>
|
|
||||||
<div className="text-center">{t("no")}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{isEnableSubscription && (
|
|
||||||
<div className="text-xs mt-2">
|
|
||||||
<span
|
|
||||||
className={
|
|
||||||
isSubscribe
|
|
||||||
? "font-semibold"
|
|
||||||
: "font-semibold text-gray-300"
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{t("auto-reminder")}
|
|
||||||
{" "}
|
|
||||||
{!isSubscribe && isEnableSubscription && <Upgrade />}
|
|
||||||
</span>
|
|
||||||
<label
|
|
||||||
className={`${
|
|
||||||
isSubscribe
|
|
||||||
? "cursor-pointer "
|
|
||||||
: "pointer-events-none opacity-50"
|
|
||||||
} relative block items-center mb-0`}
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
className="op-toggle transition-all checked:[--tglbg:#3368ff] checked:bg-white"
|
|
||||||
checked={formData.autoreminder}
|
|
||||||
onChange={handleAutoReminder}
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{formData?.autoreminder === true && (
|
|
||||||
<div className="text-xs mt-2">
|
<div className="text-xs mt-2">
|
||||||
<label className="block">
|
<label className="block">
|
||||||
{t("remind-once")}
|
{t("time-to-complete")}
|
||||||
<span className="text-red-500 text-[13px]">*</span>
|
<span className="text-red-500 text-[13px]">*</span>
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
value={formData.remindOnceInEvery}
|
name="TimeToCompleteDays"
|
||||||
name="remindOnceInEvery"
|
|
||||||
className="op-input op-input-bordered op-input-sm focus:outline-none hover:border-base-content w-full text-xs"
|
className="op-input op-input-bordered op-input-sm focus:outline-none hover:border-base-content w-full text-xs"
|
||||||
onChange={handleStrInput}
|
value={formData.TimeToCompleteDays}
|
||||||
|
onChange={(e) => handleStrInput(e)}
|
||||||
onInvalid={(e) =>
|
onInvalid={(e) =>
|
||||||
e.target.setCustomValidity(t("input-required"))
|
e.target.setCustomValidity(t("input-required"))
|
||||||
}
|
}
|
||||||
@@ -876,7 +868,136 @@ const Forms = (props) => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</>
|
{props.title !== "Sign Yourself" && (
|
||||||
|
<>
|
||||||
|
{isEnableSubscription && (
|
||||||
|
<div className="text-xs mt-2">
|
||||||
|
<span className={isSubscribe ? "" : " text-gray-300"}>
|
||||||
|
{t("auto-reminder")}{" "}
|
||||||
|
{!isSubscribe && isEnableSubscription && <Upgrade />}
|
||||||
|
</span>
|
||||||
|
<label
|
||||||
|
className={`${
|
||||||
|
isSubscribe
|
||||||
|
? "cursor-pointer "
|
||||||
|
: "pointer-events-none opacity-50"
|
||||||
|
} relative block items-center mb-0 mt-1.5`}
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
className="op-toggle transition-all checked:[--tglbg:#3368ff] checked:bg-white"
|
||||||
|
checked={formData.autoreminder}
|
||||||
|
onChange={handleAutoReminder}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{formData?.autoreminder === true && (
|
||||||
|
<div className="text-xs mt-2">
|
||||||
|
<label className="block">
|
||||||
|
{t("remind-once")}
|
||||||
|
<span className="text-red-500 text-[13px]">*</span>
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
value={formData.remindOnceInEvery}
|
||||||
|
name="remindOnceInEvery"
|
||||||
|
className="op-input op-input-bordered op-input-sm focus:outline-none hover:border-base-content w-full text-xs"
|
||||||
|
onChange={handleStrInput}
|
||||||
|
onInvalid={(e) =>
|
||||||
|
e.target.setCustomValidity(t("input-required"))
|
||||||
|
}
|
||||||
|
onInput={(e) => e.target.setCustomValidity("")}
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{isEnableSubscription && (
|
||||||
|
<div className="text-xs mt-2">
|
||||||
|
<label className="block">
|
||||||
|
<span className={isSubscribe ? "" : " text-gray-300"}>
|
||||||
|
{t("isenable-otp")}{" "}
|
||||||
|
<a
|
||||||
|
data-tooltip-id="isenableotp-tooltip"
|
||||||
|
className="ml-1"
|
||||||
|
>
|
||||||
|
<sup>
|
||||||
|
<i className="fa-light fa-question rounded-full border-[#33bbff] text-[#33bbff] text-[13px] border-[1px] py-[1.5px] px-[4px]"></i>
|
||||||
|
</sup>
|
||||||
|
</a>{" "}
|
||||||
|
{!isSubscribe && isEnableSubscription && (
|
||||||
|
<Upgrade />
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
<Tooltip id="isenableotp-tooltip" className="z-50">
|
||||||
|
<div className="max-w-[200px] md:max-w-[450px]">
|
||||||
|
<p className="font-bold">{t("isenable-otp")}</p>
|
||||||
|
<p>{t("isenable-otp-help.p1")}</p>
|
||||||
|
<p className="p-[5px]">
|
||||||
|
<ol className="list-disc">
|
||||||
|
<li>
|
||||||
|
<span className="font-bold">
|
||||||
|
{t("yes")}:{" "}
|
||||||
|
</span>
|
||||||
|
<span>{t("isenable-otp-help.p2")}</span>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<span className="font-bold">
|
||||||
|
{t("no")}:{" "}
|
||||||
|
</span>
|
||||||
|
<span>{t("isenable-otp-help.p3")}</span>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</p>
|
||||||
|
<p>{t("isenable-otp-help.p4")}</p>
|
||||||
|
</div>
|
||||||
|
</Tooltip>
|
||||||
|
</label>
|
||||||
|
<div
|
||||||
|
className={`${
|
||||||
|
isSubscribe ? "" : "pointer-events-none opacity-50"
|
||||||
|
} flex items-center gap-2 ml-2 mb-1 `}
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
value={"true"}
|
||||||
|
className="op-radio op-radio-xs"
|
||||||
|
name="IsEnableOTP"
|
||||||
|
checked={formData.IsEnableOTP === "true"}
|
||||||
|
onChange={handleStrInput}
|
||||||
|
/>
|
||||||
|
<div className="text-center">{t("yes")}</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className={`${
|
||||||
|
isSubscribe ? "" : "pointer-events-none opacity-50"
|
||||||
|
} flex items-center gap-2 ml-2 mb-1 `}
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
value={"false"}
|
||||||
|
name="IsEnableOTP"
|
||||||
|
className="op-radio op-radio-xs"
|
||||||
|
checked={formData.IsEnableOTP === "false"}
|
||||||
|
onChange={handleStrInput}
|
||||||
|
/>
|
||||||
|
<div className="text-center">{t("no")}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{props.title !== "Sign Yourself" && (
|
||||||
|
<div
|
||||||
|
onClick={() => setIsAdvanceOpt(!isAdvanceOpt)}
|
||||||
|
className={`mt-2.5 op-link op-link-primary text-sm`}
|
||||||
|
>
|
||||||
|
{isAdvanceOpt
|
||||||
|
? t("hide-advanced-options")
|
||||||
|
: t("advanced-options")}
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="flex items-center mt-3 gap-2">
|
<div className="flex items-center mt-3 gap-2">
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -28,6 +28,28 @@ function GuestLogin() {
|
|||||||
const [contactId, setContactId] = useState(contactBookId);
|
const [contactId, setContactId] = useState(contactBookId);
|
||||||
const [sendmail, setSendmail] = useState();
|
const [sendmail, setSendmail] = useState();
|
||||||
const [contact, setContact] = useState({ name: "", phone: "", email: "" });
|
const [contact, setContact] = useState({ name: "", phone: "", email: "" });
|
||||||
|
const navigateToDoc = async (docId, contactId) => {
|
||||||
|
try {
|
||||||
|
const docDetails = await Parse.Cloud.run("getDocument", {
|
||||||
|
docId: docId
|
||||||
|
});
|
||||||
|
if (!docDetails.error) {
|
||||||
|
if (sendmail === "false") {
|
||||||
|
navigate(
|
||||||
|
`/load/recipientSignPdf/${docId}/${contactId}?sendmail=${sendmail}`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
navigate(`/load/recipientSignPdf/${docId}/${contactId}`);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log("err while getting doc", err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleServerUrl();
|
handleServerUrl();
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
@@ -70,13 +92,14 @@ function GuestLogin() {
|
|||||||
"linkcontacttodoc",
|
"linkcontacttodoc",
|
||||||
params
|
params
|
||||||
);
|
);
|
||||||
// console.log("linkContactRes ", linkContactRes);
|
|
||||||
setContactId(linkContactRes?.contactId);
|
setContactId(linkContactRes?.contactId);
|
||||||
|
await navigateToDoc(checkSplit[0], linkContactRes?.contactId);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("Err in link ext contact", err);
|
console.log("Err in link ext contact", err);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setContactId(checkSplit[2]);
|
setContactId(checkSplit[2]);
|
||||||
|
await navigateToDoc(checkSplit[0], checkSplit[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,15 +137,12 @@ function GuestLogin() {
|
|||||||
if (OTP) {
|
if (OTP) {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
let url = `${serverUrl}functions/AuthLoginAsMail/`;
|
let url = `${serverUrl}functions/AuthLoginAsMail`;
|
||||||
const headers = {
|
const headers = {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"X-Parse-Application-Id": parseId
|
"X-Parse-Application-Id": parseId
|
||||||
};
|
};
|
||||||
let body = {
|
let body = { email: email, otp: OTP };
|
||||||
email: email,
|
|
||||||
otp: OTP
|
|
||||||
};
|
|
||||||
let user = await axios.post(url, body, { headers: headers });
|
let user = await axios.post(url, body, { headers: headers });
|
||||||
if (user.data.result === "Invalid Otp") {
|
if (user.data.result === "Invalid Otp") {
|
||||||
alert(t("invalid-otp"));
|
alert(t("invalid-otp"));
|
||||||
@@ -140,7 +160,6 @@ function GuestLogin() {
|
|||||||
`Parse/${parseId}/currentUser`,
|
`Parse/${parseId}/currentUser`,
|
||||||
JSON.stringify(_user)
|
JSON.stringify(_user)
|
||||||
);
|
);
|
||||||
// console.log("contractUserDetails ", contractUserDetails);
|
|
||||||
if (contractUserDetails && contractUserDetails.length > 0) {
|
if (contractUserDetails && contractUserDetails.length > 0) {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
"Extand_Class",
|
"Extand_Class",
|
||||||
@@ -174,10 +193,15 @@ function GuestLogin() {
|
|||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const linkContactRes = await Parse.Cloud.run("linkcontacttodoc", params);
|
const linkContactRes = await Parse.Cloud.run("linkcontacttodoc", params);
|
||||||
// console.log("linkContactRes ", linkContactRes);
|
|
||||||
setContactId(linkContactRes.contactId);
|
setContactId(linkContactRes.contactId);
|
||||||
setEnterOtp(true);
|
const IsEnableOTP = await navigateToDoc(
|
||||||
await SendOtp();
|
documentId,
|
||||||
|
linkContactRes.contactId
|
||||||
|
);
|
||||||
|
if (!IsEnableOTP) {
|
||||||
|
setEnterOtp(true);
|
||||||
|
await SendOtp();
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
alert(t("something-went-wrong-mssg"));
|
alert(t("something-went-wrong-mssg"));
|
||||||
@@ -208,7 +232,7 @@ function GuestLogin() {
|
|||||||
<div className="w-full md:w-[50%] text-base-content">
|
<div className="w-full md:w-[50%] text-base-content">
|
||||||
<h1 className="text-2xl md:text-[30px]">{t("welcome")}</h1>
|
<h1 className="text-2xl md:text-[30px]">{t("welcome")}</h1>
|
||||||
<legend className="text-[12px] text-[#878787] mt-2 mb-1">
|
<legend className="text-[12px] text-[#878787] mt-2 mb-1">
|
||||||
{t("guest-email-alert")}
|
{t("get-otp-alert")}
|
||||||
</legend>
|
</legend>
|
||||||
<div className="p-[20px] outline outline-1 outline-slate-300/50 my-2 op-card shadow-md">
|
<div className="p-[20px] outline outline-1 outline-slate-300/50 my-2 op-card shadow-md">
|
||||||
<input
|
<input
|
||||||
@@ -236,7 +260,7 @@ function GuestLogin() {
|
|||||||
>
|
>
|
||||||
<h1 className="text-2xl md:text-[30px]">{t("welcome")}</h1>
|
<h1 className="text-2xl md:text-[30px]">{t("welcome")}</h1>
|
||||||
<legend className="text-[12px] text-[#878787] mt-2">
|
<legend className="text-[12px] text-[#878787] mt-2">
|
||||||
{t("get-verification-code-2")}
|
{t("guest-email-alert")}
|
||||||
</legend>
|
</legend>
|
||||||
<div className="p-[20px] pt-[15px] outline outline-1 outline-slate-300/50 op-card my-2 shadow-md">
|
<div className="p-[20px] pt-[15px] outline outline-1 outline-slate-300/50 op-card my-2 shadow-md">
|
||||||
<p className="text-sm">{t("enter-verification-code")}</p>
|
<p className="text-sm">{t("enter-verification-code")}</p>
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import {
|
|||||||
contractUsers,
|
contractUsers,
|
||||||
handleSendOTP,
|
handleSendOTP,
|
||||||
contactBook,
|
contactBook,
|
||||||
handleDownloadPdf,
|
|
||||||
handleToPrint,
|
handleToPrint,
|
||||||
handleDownloadCertificate,
|
handleDownloadCertificate,
|
||||||
getDefaultSignature,
|
getDefaultSignature,
|
||||||
@@ -36,21 +35,23 @@ import {
|
|||||||
onClickZoomOut,
|
onClickZoomOut,
|
||||||
fetchUrl
|
fetchUrl
|
||||||
} from "../constant/Utils";
|
} from "../constant/Utils";
|
||||||
import LoaderWithMsg from "../primitives/LoaderWithMsg";
|
|
||||||
import HandleError from "../primitives/HandleError";
|
|
||||||
import Header from "../components/pdf/PdfHeader";
|
import Header from "../components/pdf/PdfHeader";
|
||||||
import RenderPdf from "../components/pdf/RenderPdf";
|
import RenderPdf from "../components/pdf/RenderPdf";
|
||||||
import PdfDeclineModal from "../primitives/PdfDeclineModal";
|
|
||||||
import Title from "../components/Title";
|
import Title from "../components/Title";
|
||||||
import DefaultSignature from "../components/pdf/DefaultSignature";
|
import DefaultSignature from "../components/pdf/DefaultSignature";
|
||||||
import ModalUi from "../primitives/ModalUi";
|
|
||||||
import TourContentWithBtn from "../primitives/TourContentWithBtn";
|
|
||||||
import Loader from "../primitives/Loader";
|
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import SignerListComponent from "../components/pdf/SignerListComponent";
|
import SignerListComponent from "../components/pdf/SignerListComponent";
|
||||||
import VerifyEmail from "../components/pdf/VerifyEmail";
|
import VerifyEmail from "../components/pdf/VerifyEmail";
|
||||||
import PdfZoom from "../components/pdf/PdfZoom";
|
import PdfZoom from "../components/pdf/PdfZoom";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import ModalUi from "../primitives/ModalUi";
|
||||||
|
import TourContentWithBtn from "../primitives/TourContentWithBtn";
|
||||||
|
import HandleError from "../primitives/HandleError";
|
||||||
|
import LoaderWithMsg from "../primitives/LoaderWithMsg";
|
||||||
|
import DownloadPdfZip from "../primitives/DownloadPdfZip";
|
||||||
|
import Loader from "../primitives/Loader";
|
||||||
|
import PdfDeclineModal from "../primitives/PdfDeclineModal";
|
||||||
|
import Agreement from "../primitives/Agreement";
|
||||||
|
|
||||||
function PdfRequestFiles(props) {
|
function PdfRequestFiles(props) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -136,29 +137,32 @@ function PdfRequestFiles(props) {
|
|||||||
const [plancode, setPlanCode] = useState("");
|
const [plancode, setPlanCode] = useState("");
|
||||||
const isHeader = useSelector((state) => state.showHeader);
|
const isHeader = useSelector((state) => state.showHeader);
|
||||||
const divRef = useRef(null);
|
const divRef = useRef(null);
|
||||||
|
const [isDownloadModal, setIsDownloadModal] = useState(false);
|
||||||
|
const [isAgree, setIsAgree] = useState(false);
|
||||||
|
const [isAgreeTour, setIsAgreeTour] = useState(false);
|
||||||
|
|
||||||
const isMobile = window.innerWidth < 767;
|
const isMobile = window.innerWidth < 767;
|
||||||
|
|
||||||
let isGuestSignFlow = false;
|
let isGuestSignFlow = false;
|
||||||
let sendmail;
|
let sendmail;
|
||||||
let getDocId = "";
|
let getDocId = "";
|
||||||
const route = !props.templateId && window.location.pathname; //'/load/recipientSignPdf/TOAVuhXbfw/fPAKdK1qgX'
|
let contactBookId = "";
|
||||||
//window.location.search = ?sendmail=false
|
const route = !props.templateId && window.location.pathname;
|
||||||
const getQuery =
|
const getQuery = !props.templateId && window.location?.search?.split("?"); //['','sendmail=false']
|
||||||
!props.templateId &&
|
|
||||||
window.location?.search &&
|
|
||||||
window.location?.search?.split("?"); //['','sendmail=false']
|
|
||||||
|
|
||||||
//'sendmail=false'
|
|
||||||
if (getQuery) {
|
if (getQuery) {
|
||||||
sendmail = getQuery[1].split("=")[1]; //false
|
sendmail = getQuery?.[1]?.split("=")[1]; //false
|
||||||
}
|
}
|
||||||
const checkSplit = route && route?.split("/"); // ['', 'load', 'recipientSignPdf', 'TOAVuhXbfw', 'fPAKdK1qgX']
|
|
||||||
if (checkSplit && checkSplit.length > 4) {
|
const routeId = route && route?.split("/"); // ['', 'load', 'recipientSignPdf', ':docId', ':contactBookId']
|
||||||
|
if (routeId && routeId.length > 4) {
|
||||||
|
// this condition will be occur only in guest flow in which load routeId will be include
|
||||||
isGuestSignFlow = true;
|
isGuestSignFlow = true;
|
||||||
getDocId = checkSplit[3];
|
getDocId = routeId[3];
|
||||||
|
contactBookId = routeId[4];
|
||||||
} else {
|
} else {
|
||||||
getDocId = checkSplit[2];
|
// this condition will be occur only in if user is logged in and load routeId will be exclude
|
||||||
|
getDocId = routeId[2];
|
||||||
|
contactBookId = routeId?.[3] || "";
|
||||||
}
|
}
|
||||||
let getDocumentId = getDocId || documentId;
|
let getDocumentId = getDocId || documentId;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -243,7 +247,13 @@ function PdfRequestFiles(props) {
|
|||||||
};
|
};
|
||||||
async function checkIsSubscribed(extUserId, contactId) {
|
async function checkIsSubscribed(extUserId, contactId) {
|
||||||
const isGuestSign = isGuestSignFlow || false;
|
const isGuestSign = isGuestSignFlow || false;
|
||||||
const res = await fetchSubscription(extUserId, contactId, isGuestSign);
|
const isPublic = props.templateId ? true : false;
|
||||||
|
const res = await fetchSubscription(
|
||||||
|
extUserId,
|
||||||
|
contactId,
|
||||||
|
isGuestSign,
|
||||||
|
isPublic
|
||||||
|
);
|
||||||
const plan = res.plan;
|
const plan = res.plan;
|
||||||
const billingDate = res?.billingDate;
|
const billingDate = res?.billingDate;
|
||||||
const status = res?.status;
|
const status = res?.status;
|
||||||
@@ -291,19 +301,21 @@ function PdfRequestFiles(props) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
const documentData =
|
const documentData = templateDeatils?.data?.result
|
||||||
templateDeatils.data && templateDeatils.data.result
|
? [templateDeatils?.data?.result]
|
||||||
? [templateDeatils.data.result]
|
: [];
|
||||||
: [];
|
|
||||||
if (documentData && documentData[0]?.error) {
|
if (documentData && documentData[0]?.error) {
|
||||||
props?.setTemplateStatus({
|
props?.setTemplateStatus &&
|
||||||
status: "Invalid"
|
props?.setTemplateStatus({
|
||||||
});
|
status: "Invalid"
|
||||||
|
});
|
||||||
|
throw new Error("error: Invalid TemplateId");
|
||||||
} else if (documentData && documentData.length > 0) {
|
} else if (documentData && documentData.length > 0) {
|
||||||
if (documentData[0]?.IsPublic) {
|
if (documentData[0]?.IsPublic) {
|
||||||
props?.setTemplateStatus({
|
props?.setTemplateStatus &&
|
||||||
status: "Success"
|
props?.setTemplateStatus({
|
||||||
});
|
status: "Success"
|
||||||
|
});
|
||||||
const url =
|
const url =
|
||||||
documentData[0] &&
|
documentData[0] &&
|
||||||
(documentData[0]?.SignedUrl || documentData[0]?.URL);
|
(documentData[0]?.SignedUrl || documentData[0]?.URL);
|
||||||
@@ -347,22 +359,34 @@ function PdfRequestFiles(props) {
|
|||||||
isLoad: false
|
isLoad: false
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
props?.setTemplateStatus({
|
props?.setTemplateStatus &&
|
||||||
status: "Private"
|
props?.setTemplateStatus({
|
||||||
});
|
status: "Private"
|
||||||
|
});
|
||||||
|
setIsLoading(false);
|
||||||
|
setHandleError(t("something-went-wrong-mssg"));
|
||||||
|
console.error("error: TemplateId is not public");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
props?.setTemplateStatus({
|
props?.setTemplateStatus &&
|
||||||
status: "Invalid"
|
props?.setTemplateStatus({
|
||||||
});
|
status: "Invalid"
|
||||||
|
});
|
||||||
|
setIsLoading(false);
|
||||||
|
setHandleError(t("something-went-wrong-mssg"));
|
||||||
|
console.error("error: Invalid TemplateId");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("err in get template details ", err);
|
setIsLoading(false);
|
||||||
if (err?.response?.data?.code === 101) {
|
if (err?.response?.data?.code === 101) {
|
||||||
setHandleError(t("error-template"));
|
setHandleError(t("error-template"));
|
||||||
} else {
|
} else {
|
||||||
setHandleError(t("something-went-wrong-mssg"));
|
setHandleError(t("something-went-wrong-mssg"));
|
||||||
}
|
}
|
||||||
|
console.error("error: Invalid TemplateId");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
//function for get document details for perticular signer with signer'object id
|
//function for get document details for perticular signer with signer'object id
|
||||||
@@ -372,9 +396,10 @@ function PdfRequestFiles(props) {
|
|||||||
`Parse/${localStorage.getItem("parseAppId")}/currentUser`
|
`Parse/${localStorage.getItem("parseAppId")}/currentUser`
|
||||||
);
|
);
|
||||||
const jsonSender = JSON.parse(senderUser);
|
const jsonSender = JSON.parse(senderUser);
|
||||||
|
// `currUserId` will be contactId or extUserId
|
||||||
let currUserId;
|
let currUserId;
|
||||||
//getting document details
|
//getting document details
|
||||||
const documentData = await contractDocument(documentId || docId);
|
const documentData = await contractDocument(docId);
|
||||||
if (documentData && documentData.length > 0) {
|
if (documentData && documentData.length > 0) {
|
||||||
const url =
|
const url =
|
||||||
documentData[0] &&
|
documentData[0] &&
|
||||||
@@ -399,13 +424,13 @@ function PdfRequestFiles(props) {
|
|||||||
const expireUpdateDate = new Date(expireDate).getTime();
|
const expireUpdateDate = new Date(expireDate).getTime();
|
||||||
const currDate = new Date().getTime();
|
const currDate = new Date().getTime();
|
||||||
const getSigners = documentData[0].Signers;
|
const getSigners = documentData[0].Signers;
|
||||||
const getCurrentSigner =
|
const getCurrentSigner = getSigners?.find(
|
||||||
getSigners &&
|
(data) => data.UserId.objectId === jsonSender?.objectId
|
||||||
getSigners.filter(
|
);
|
||||||
(data) => data.UserId.objectId === jsonSender?.objectId
|
|
||||||
);
|
|
||||||
|
|
||||||
currUserId = getCurrentSigner[0] ? getCurrentSigner[0].objectId : "";
|
currUserId = getCurrentSigner?.objectId
|
||||||
|
? getCurrentSigner.objectId
|
||||||
|
: contactBookId || "";
|
||||||
if (isEnableSubscription) {
|
if (isEnableSubscription) {
|
||||||
await checkIsSubscribed(
|
await checkIsSubscribed(
|
||||||
documentData[0]?.ExtUserPtr?.objectId,
|
documentData[0]?.ExtUserPtr?.objectId,
|
||||||
@@ -428,10 +453,7 @@ function PdfRequestFiles(props) {
|
|||||||
setIsCelebration(true);
|
setIsCelebration(true);
|
||||||
setTimeout(() => setIsCelebration(false), 5000);
|
setTimeout(() => setIsCelebration(false), 5000);
|
||||||
} else if (declined) {
|
} else if (declined) {
|
||||||
const currentDecline = {
|
const currentDecline = { currnt: "another", isDeclined: true };
|
||||||
currnt: "another",
|
|
||||||
isDeclined: true
|
|
||||||
};
|
|
||||||
setIsDecline(currentDecline);
|
setIsDecline(currentDecline);
|
||||||
} else if (currDate > expireUpdateDate) {
|
} else if (currDate > expireUpdateDate) {
|
||||||
const expireDateFormat = moment(new Date(expireDate)).format(
|
const expireDateFormat = moment(new Date(expireDate)).format(
|
||||||
@@ -457,36 +479,24 @@ function PdfRequestFiles(props) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const audittrailData =
|
const audittrailData = documentData?.[0]?.AuditTrail?.filter(
|
||||||
documentData[0].AuditTrail &&
|
(data) => data.Activity === "Signed"
|
||||||
documentData[0].AuditTrail.length > 0 &&
|
);
|
||||||
documentData[0].AuditTrail.filter(
|
|
||||||
(data) => data.Activity === "Signed"
|
|
||||||
);
|
|
||||||
|
|
||||||
const checkAlreadySign =
|
const checkAlreadySign =
|
||||||
documentData[0].AuditTrail &&
|
documentData?.[0]?.AuditTrail?.some(
|
||||||
documentData[0].AuditTrail.length > 0 &&
|
|
||||||
documentData[0].AuditTrail.filter(
|
|
||||||
(data) =>
|
(data) =>
|
||||||
data.UserPtr?.objectId === currUserId &&
|
data?.UserPtr?.objectId === currUserId &&
|
||||||
data.Activity === "Signed"
|
data.Activity === "Signed"
|
||||||
);
|
) || false;
|
||||||
if (
|
if (checkAlreadySign) {
|
||||||
checkAlreadySign &&
|
|
||||||
checkAlreadySign[0] &&
|
|
||||||
checkAlreadySign.length > 0
|
|
||||||
) {
|
|
||||||
setAlreadySign(true);
|
setAlreadySign(true);
|
||||||
} else {
|
} else {
|
||||||
const obj = documentData?.[0];
|
const obj = documentData?.[0];
|
||||||
setSendInOrder(obj?.SendinOrder || false);
|
setSendInOrder(obj?.SendinOrder || false);
|
||||||
if (
|
if (
|
||||||
obj &&
|
obj &&
|
||||||
obj.Signers &&
|
obj?.Signers?.length > 0 &&
|
||||||
obj.Signers.length > 0 &&
|
obj?.Placeholders?.length > 0
|
||||||
obj.Placeholders &&
|
|
||||||
obj.Placeholders.length > 0
|
|
||||||
) {
|
) {
|
||||||
const params = {
|
const params = {
|
||||||
event: "viewed",
|
event: "viewed",
|
||||||
@@ -502,7 +512,10 @@ function PdfRequestFiles(props) {
|
|||||||
email: x?.Email,
|
email: x?.Email,
|
||||||
phone: x?.Phone
|
phone: x?.Phone
|
||||||
})),
|
})),
|
||||||
viewedBy: jsonSender.email,
|
viewedBy:
|
||||||
|
documentData?.[0].Signers?.find(
|
||||||
|
(x) => x.objectId === currUserId
|
||||||
|
)?.Email || jsonSender?.email,
|
||||||
viewedAt: new Date(),
|
viewedAt: new Date(),
|
||||||
createdAt: documentData?.[0].createdAt
|
createdAt: documentData?.[0].createdAt
|
||||||
}
|
}
|
||||||
@@ -583,40 +596,51 @@ function PdfRequestFiles(props) {
|
|||||||
//checking if condition current user already sign or owner does not exist as a signer or document has been declined by someone or document has been expired
|
//checking if condition current user already sign or owner does not exist as a signer or document has been declined by someone or document has been expired
|
||||||
//then stop to display tour message
|
//then stop to display tour message
|
||||||
if (
|
if (
|
||||||
(checkAlreadySign &&
|
checkAlreadySign ||
|
||||||
checkAlreadySign[0] &&
|
|
||||||
checkAlreadySign.length > 0) ||
|
|
||||||
!currUserId ||
|
!currUserId ||
|
||||||
declined ||
|
declined ||
|
||||||
currDate > expireUpdateDate
|
currDate > expireUpdateDate
|
||||||
) {
|
) {
|
||||||
setRequestSignTour(true);
|
setRequestSignTour(true);
|
||||||
} else {
|
} else {
|
||||||
//else condition to check current user exist in contracts_Users class and check tour message status
|
const isEnableOTP = documentData?.[0]?.IsEnableOTP || false;
|
||||||
//if not then check user exist in contracts_Contactbook class and check tour message statu
|
if (!isEnableOTP) {
|
||||||
const res = await contractUsers();
|
try {
|
||||||
if (res === "Error: Something went wrong!") {
|
const resContact = await axios.post(
|
||||||
setHandleError(t("something-went-wrong-mssg"));
|
`${localStorage.getItem("baseUrl")}functions/getcontact`,
|
||||||
} else if (res[0] && res?.length) {
|
{
|
||||||
setContractName("_Users");
|
contactId: currUserId
|
||||||
currUserId = res[0].objectId;
|
},
|
||||||
setSignerUserId(currUserId);
|
{
|
||||||
const tourData = res[0].TourStatus && res[0].TourStatus;
|
headers: {
|
||||||
if (tourData && tourData.length > 0) {
|
"Content-Type": "application/json",
|
||||||
const checkTourRequest = tourData.filter(
|
"X-Parse-Application-Id": localStorage.getItem("parseAppId")
|
||||||
(data) => data?.requestSign
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
setTourStatus(tourData);
|
const contact = resContact?.data?.result;
|
||||||
setRequestSignTour(checkTourRequest[0]?.requestSign || false);
|
setContractName("_Contactbook");
|
||||||
|
setSignerUserId(contact?.objectId);
|
||||||
|
const tourData = contact?.TourStatus && contact?.TourStatus;
|
||||||
|
if (tourData && tourData.length > 0) {
|
||||||
|
const checkTourRequest =
|
||||||
|
tourData?.some((data) => data?.requestSign) || false;
|
||||||
|
setTourStatus(tourData);
|
||||||
|
setRequestSignTour(checkTourRequest);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log("err while getting tourstatus", err);
|
||||||
}
|
}
|
||||||
} else if (res?.length === 0) {
|
} else {
|
||||||
const res = await contactBook(currUserId);
|
//else condition to check current user exist in contracts_Users class and check tour message status
|
||||||
|
//if not then check user exist in contracts_Contactbook class and check tour message status
|
||||||
|
const res = await contractUsers();
|
||||||
if (res === "Error: Something went wrong!") {
|
if (res === "Error: Something went wrong!") {
|
||||||
setHandleError(t("something-went-wrong-mssg"));
|
setHandleError(t("something-went-wrong-mssg"));
|
||||||
} else if (res[0] && res.length) {
|
} else if (res[0] && res?.length) {
|
||||||
setContractName("_Contactbook");
|
setContractName("_Users");
|
||||||
const objectId = res[0].objectId;
|
currUserId = res[0].objectId;
|
||||||
setSignerUserId(objectId);
|
setSignerUserId(currUserId);
|
||||||
const tourData = res[0].TourStatus && res[0].TourStatus;
|
const tourData = res[0].TourStatus && res[0].TourStatus;
|
||||||
if (tourData && tourData.length > 0) {
|
if (tourData && tourData.length > 0) {
|
||||||
const checkTourRequest = tourData.filter(
|
const checkTourRequest = tourData.filter(
|
||||||
@@ -625,8 +649,25 @@ function PdfRequestFiles(props) {
|
|||||||
setTourStatus(tourData);
|
setTourStatus(tourData);
|
||||||
setRequestSignTour(checkTourRequest[0]?.requestSign || false);
|
setRequestSignTour(checkTourRequest[0]?.requestSign || false);
|
||||||
}
|
}
|
||||||
} else if (res.length === 0) {
|
} else if (res?.length === 0) {
|
||||||
setHandleError(t("user-not-exist"));
|
const res = await contactBook(currUserId);
|
||||||
|
if (res === "Error: Something went wrong!") {
|
||||||
|
setHandleError(t("something-went-wrong-mssg"));
|
||||||
|
} else if (res[0] && res.length) {
|
||||||
|
setContractName("_Contactbook");
|
||||||
|
const objectId = res[0].objectId;
|
||||||
|
setSignerUserId(objectId);
|
||||||
|
const tourData = res[0].TourStatus && res[0].TourStatus;
|
||||||
|
if (tourData && tourData.length > 0) {
|
||||||
|
const checkTourRequest = tourData.filter(
|
||||||
|
(data) => data?.requestSign
|
||||||
|
);
|
||||||
|
setTourStatus(tourData);
|
||||||
|
setRequestSignTour(checkTourRequest[0]?.requestSign || false);
|
||||||
|
}
|
||||||
|
} else if (res.length === 0) {
|
||||||
|
setHandleError(t("user-not-exist"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -643,12 +684,12 @@ function PdfRequestFiles(props) {
|
|||||||
setIsUiLoading({ isLoad: false });
|
setIsUiLoading({ isLoad: false });
|
||||||
}
|
}
|
||||||
//function to get default signatur eof current user from `contracts_Signature` class
|
//function to get default signatur eof current user from `contracts_Signature` class
|
||||||
const defaultSignRes = await getDefaultSignature(jsonSender.objectId);
|
const defaultSignRes = await getDefaultSignature(jsonSender?.objectId);
|
||||||
if (defaultSignRes?.status === "success") {
|
if (defaultSignRes?.status === "success") {
|
||||||
setDefaultSignImg(defaultSignRes?.res?.defaultSignature);
|
const sign = defaultSignRes?.res?.defaultSignature || "";
|
||||||
setMyInitial(defaultSignRes?.res?.defaultInitial);
|
const initials = defaultSignRes?.res?.defaultInitial || "";
|
||||||
} else if (defaultSignRes?.status === "error") {
|
setDefaultSignImg(sign);
|
||||||
setHandleError("Error: Something went wrong!");
|
setMyInitial(initials);
|
||||||
}
|
}
|
||||||
setIsLoading({ isLoad: false });
|
setIsLoading({ isLoad: false });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -664,20 +705,30 @@ function PdfRequestFiles(props) {
|
|||||||
`Parse/${localStorage.getItem("parseAppId")}/currentUser`
|
`Parse/${localStorage.getItem("parseAppId")}/currentUser`
|
||||||
);
|
);
|
||||||
let currentUser = JSON.parse(localuser);
|
let currentUser = JSON.parse(localuser);
|
||||||
|
let isEmailVerified = currentUser?.emailVerified;
|
||||||
|
const isEnableOTP = pdfDetails?.[0]?.IsEnableOTP || false;
|
||||||
//if emailVerified data is not present in local user details then fetch again in _User class
|
//if emailVerified data is not present in local user details then fetch again in _User class
|
||||||
if (!currentUser?.emailVerified) {
|
if (isEnableOTP) {
|
||||||
const userQuery = new Parse.Query(Parse.User);
|
try {
|
||||||
const getUser = await userQuery.get(currentUser?.objectId, {
|
if (!currentUser?.emailVerified) {
|
||||||
sessionToken: currentUser?.sessionToken
|
const userQuery = new Parse.Query(Parse.User);
|
||||||
});
|
const getUser = await userQuery.get(currentUser?.objectId, {
|
||||||
if (getUser) {
|
sessionToken:
|
||||||
currentUser = JSON.parse(JSON.stringify(getUser));
|
currentUser?.sessionToken || localStorage.getItem("accesstoken")
|
||||||
|
});
|
||||||
|
if (getUser) {
|
||||||
|
currentUser = JSON.parse(JSON.stringify(getUser));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
isEmailVerified = currentUser?.emailVerified;
|
||||||
|
setIsEmailVerified(isEmailVerified);
|
||||||
|
} catch (err) {
|
||||||
|
console.log("err in get email verification ", err);
|
||||||
|
setHandleError(t("something-went-wrong-mssg"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let isEmailVerified = currentUser?.emailVerified;
|
|
||||||
//check if isEmailVerified then go on next step
|
//check if isEmailVerified then go on next step
|
||||||
if (isEmailVerified) {
|
if (!isEnableOTP || isEmailVerified) {
|
||||||
setIsEmailVerified(isEmailVerified);
|
|
||||||
try {
|
try {
|
||||||
const checkUser = signerPos.filter(
|
const checkUser = signerPos.filter(
|
||||||
(data) => data.signerObjId === signerObjectId
|
(data) => data.signerObjId === signerObjectId
|
||||||
@@ -858,17 +909,9 @@ function PdfRequestFiles(props) {
|
|||||||
// console.log("pdfte", pdfBytes);
|
// console.log("pdfte", pdfBytes);
|
||||||
//get ExistUserPtr object id of user class to get tenantDetails
|
//get ExistUserPtr object id of user class to get tenantDetails
|
||||||
const objectId = pdfDetails?.[0]?.ExtUserPtr?.UserId?.objectId;
|
const objectId = pdfDetails?.[0]?.ExtUserPtr?.UserId?.objectId;
|
||||||
//get ExistUserPtr email to get userDetails
|
let activeMailAdapter =
|
||||||
const res = await contractUsers();
|
pdfDetails?.[0]?.ExtUserPtr?.active_mail_adapter;
|
||||||
let activeMailAdapter = "";
|
|
||||||
if (res === "Error: Something went wrong!") {
|
|
||||||
setHandleError(t("something-went-wrong-mssg"));
|
|
||||||
setIsLoading({ isLoad: false });
|
|
||||||
} else if (!res || res?.length === 0) {
|
|
||||||
activeMailAdapter = "";
|
|
||||||
} else if (res[0] && res.length) {
|
|
||||||
activeMailAdapter = res[0]?.active_mail_adapter;
|
|
||||||
}
|
|
||||||
//function for call to embed signature in pdf and get digital signature pdf
|
//function for call to embed signature in pdf and get digital signature pdf
|
||||||
const resSign = await signPdfFun(
|
const resSign = await signPdfFun(
|
||||||
pdfBytes,
|
pdfBytes,
|
||||||
@@ -880,13 +923,13 @@ function PdfRequestFiles(props) {
|
|||||||
widgets
|
widgets
|
||||||
);
|
);
|
||||||
if (resSign && resSign.status === "success") {
|
if (resSign && resSign.status === "success") {
|
||||||
setPdfUrl(res.data);
|
setPdfUrl(resSign.data);
|
||||||
setIsSigned(true);
|
setIsSigned(true);
|
||||||
setSignedSigners([]);
|
setSignedSigners([]);
|
||||||
setUnSignedSigners([]);
|
setUnSignedSigners([]);
|
||||||
getDocumentDetails(true);
|
getDocumentDetails(documentId, true);
|
||||||
const index = pdfDetails?.[0].Signers.findIndex(
|
const index = pdfDetails?.[0]?.Signers.findIndex(
|
||||||
(x) => x.Email === currentUser?.email
|
(x) => x.objectId === signerObjectId
|
||||||
);
|
);
|
||||||
const newIndex = index + 1;
|
const newIndex = index + 1;
|
||||||
const usermail = {
|
const usermail = {
|
||||||
@@ -1054,21 +1097,6 @@ function PdfRequestFiles(props) {
|
|||||||
alertMessage: t("something-went-wrong-mssg")
|
alertMessage: t("something-went-wrong-mssg")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
//else verify users email
|
|
||||||
try {
|
|
||||||
const userQuery = new Parse.Query(Parse.User);
|
|
||||||
const user = await userQuery.get(currentUser?.objectId, {
|
|
||||||
sessionToken: localStorage.getItem("accesstoken")
|
|
||||||
});
|
|
||||||
if (user) {
|
|
||||||
isEmailVerified = user?.get("emailVerified");
|
|
||||||
setIsEmailVerified(isEmailVerified);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.log("error in save user's emailVerified in user class");
|
|
||||||
setHandleError(t("something-went-wrong-mssg"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1216,31 +1244,26 @@ function PdfRequestFiles(props) {
|
|||||||
);
|
);
|
||||||
const jsonSender = JSON.parse(senderUser);
|
const jsonSender = JSON.parse(senderUser);
|
||||||
setIsDecline({ isDeclined: false });
|
setIsDecline({ isDeclined: false });
|
||||||
const data = {
|
|
||||||
IsDeclined: true,
|
|
||||||
DeclineReason: reason,
|
|
||||||
DeclineBy: {
|
|
||||||
__type: "Pointer",
|
|
||||||
className: "_User",
|
|
||||||
objectId: jsonSender?.objectId
|
|
||||||
}
|
|
||||||
};
|
|
||||||
setIsUiLoading(true);
|
setIsUiLoading(true);
|
||||||
|
const email =
|
||||||
|
pdfDetails?.[0].Signers?.find((x) => x.objectId === signerObjectId)
|
||||||
|
?.Email || jsonSender?.email;
|
||||||
|
const userId =
|
||||||
|
pdfDetails?.[0].Signers?.find((x) => x.objectId === signerObjectId)
|
||||||
|
?.UserId?.objectId || jsonSender?.objectId;
|
||||||
|
const params = {
|
||||||
|
docId: pdfDetails?.[0].objectId,
|
||||||
|
reason: reason,
|
||||||
|
userId: userId
|
||||||
|
};
|
||||||
await axios
|
await axios
|
||||||
.put(
|
.post(`${localStorage.getItem("baseUrl")}functions/declinedoc`, params, {
|
||||||
`${localStorage.getItem(
|
headers: {
|
||||||
"baseUrl"
|
"Content-Type": "application/json",
|
||||||
)}classes/contracts_Document/${documentId}`,
|
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
|
||||||
data,
|
"X-Parse-Session-Token": localStorage.getItem("accesstoken")
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
|
|
||||||
"X-Parse-Session-Token": localStorage.getItem("accesstoken")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
)
|
})
|
||||||
.then(async (result) => {
|
.then(async (result) => {
|
||||||
const res = result.data;
|
const res = result.data;
|
||||||
if (res) {
|
if (res) {
|
||||||
@@ -1260,7 +1283,8 @@ function PdfRequestFiles(props) {
|
|||||||
email: x?.Email,
|
email: x?.Email,
|
||||||
phone: x?.Phone
|
phone: x?.Phone
|
||||||
})),
|
})),
|
||||||
declinedBy: jsonSender.email,
|
declinedBy: email,
|
||||||
|
declinedReason: reason,
|
||||||
declinedAt: new Date(),
|
declinedAt: new Date(),
|
||||||
createdAt: pdfDetails?.[0].createdAt
|
createdAt: pdfDetails?.[0].createdAt
|
||||||
}
|
}
|
||||||
@@ -1286,7 +1310,11 @@ function PdfRequestFiles(props) {
|
|||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log("error updating field is decline ", err);
|
console.log("error updating field is decline ", err);
|
||||||
setIsUiLoading(false);
|
setIsUiLoading(false);
|
||||||
alert(t("something-went-wrong-mssg"));
|
setIsAlert({
|
||||||
|
title: "Error",
|
||||||
|
isShow: true,
|
||||||
|
alertMessage: t("something-went-wrong-mssg")
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
//function to add default signature for all requested placeholder of sign
|
//function to add default signature for all requested placeholder of sign
|
||||||
@@ -1314,38 +1342,58 @@ function PdfRequestFiles(props) {
|
|||||||
const closeRequestSignTour = async () => {
|
const closeRequestSignTour = async () => {
|
||||||
setRequestSignTour(true);
|
setRequestSignTour(true);
|
||||||
if (isDontShow) {
|
if (isDontShow) {
|
||||||
let updatedTourStatus = [];
|
const isEnableOTP = pdfDetails?.[0]?.IsEnableOTP || false;
|
||||||
if (tourStatus.length > 0) {
|
if (!isEnableOTP) {
|
||||||
updatedTourStatus = [...tourStatus];
|
try {
|
||||||
const requestSignIndex = tourStatus.findIndex(
|
await axios.post(
|
||||||
(obj) => obj["requestSign"] === false || obj["requestSign"] === true
|
`${localStorage.getItem("baseUrl")}functions/updatecontacttour`,
|
||||||
);
|
{
|
||||||
if (requestSignIndex !== -1) {
|
contactId: signerObjectId
|
||||||
updatedTourStatus[requestSignIndex] = { requestSign: true };
|
},
|
||||||
} else {
|
{
|
||||||
updatedTourStatus.push({ requestSign: true });
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"X-Parse-Application-Id": localStorage.getItem("parseAppId")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
console.log("update tour messages error", e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
updatedTourStatus = [{ requestSign: true }];
|
let updatedTourStatus = [];
|
||||||
}
|
if (tourStatus.length > 0) {
|
||||||
try {
|
updatedTourStatus = [...tourStatus];
|
||||||
await axios.put(
|
const requestSignIndex = tourStatus.findIndex(
|
||||||
`${localStorage.getItem(
|
(obj) => obj["requestSign"] === false || obj["requestSign"] === true
|
||||||
"baseUrl"
|
);
|
||||||
)}classes/contracts${contractName}/${signerUserId}`,
|
if (requestSignIndex !== -1) {
|
||||||
{
|
updatedTourStatus[requestSignIndex] = { requestSign: true };
|
||||||
TourStatus: updatedTourStatus
|
} else {
|
||||||
},
|
updatedTourStatus.push({ requestSign: true });
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
|
|
||||||
"X-Parse-Session-Token": localStorage.getItem("accesstoken")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
} else {
|
||||||
} catch (e) {
|
updatedTourStatus = [{ requestSign: true }];
|
||||||
console.log("update tour messages error", e);
|
}
|
||||||
|
try {
|
||||||
|
await axios.put(
|
||||||
|
`${localStorage.getItem(
|
||||||
|
"baseUrl"
|
||||||
|
)}classes/contracts${contractName}/${signerUserId}`,
|
||||||
|
{
|
||||||
|
TourStatus: updatedTourStatus
|
||||||
|
},
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
|
||||||
|
"X-Parse-Session-Token": localStorage.getItem("accesstoken")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
console.log("update tour messages error", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1467,11 +1515,32 @@ function PdfRequestFiles(props) {
|
|||||||
await SendOtp();
|
await SendOtp();
|
||||||
} else {
|
} else {
|
||||||
console.log("error in public-sign to create user details");
|
console.log("error in public-sign to create user details");
|
||||||
alert(t("something-went-wrong-mssg"));
|
setIsAlert({
|
||||||
|
title: "Error",
|
||||||
|
isShow: true,
|
||||||
|
alertMessage: t("something-went-wrong-mssg")
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("e", e);
|
console.log("e", e);
|
||||||
// setIsLoader(false);
|
if (
|
||||||
|
e?.response?.data?.error === "Insufficient Credit" ||
|
||||||
|
e?.response?.data?.error === "Plan expired"
|
||||||
|
) {
|
||||||
|
handleCloseOtp();
|
||||||
|
setIsAlert({
|
||||||
|
title: t("insufficient-credits"),
|
||||||
|
isShow: true,
|
||||||
|
alertMessage: t("insufficient-credits-mssg")
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
handleCloseOtp();
|
||||||
|
setIsAlert({
|
||||||
|
title: "Error",
|
||||||
|
isShow: true,
|
||||||
|
alertMessage: t("something-went-wrong-mssg")
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1503,7 +1572,11 @@ function PdfRequestFiles(props) {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("error in verify otp in public-sign", error);
|
console.log("error in verify otp in public-sign", error);
|
||||||
alert(t("something-went-wrong-mssg"));
|
setIsAlert({
|
||||||
|
title: "Error",
|
||||||
|
isShow: true,
|
||||||
|
alertMessage: t("something-went-wrong-mssg")
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1602,6 +1675,17 @@ function PdfRequestFiles(props) {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
const AgreementTour = [
|
||||||
|
{
|
||||||
|
selector: '[data-tut="IsAgree"]',
|
||||||
|
content: "Please agree & continue to start signing",
|
||||||
|
position: "top",
|
||||||
|
style: { fontSize: "13px" }
|
||||||
|
}
|
||||||
|
];
|
||||||
|
const handleCloseAgreeTour = () => {
|
||||||
|
setIsAgreeTour(false);
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<DndProvider backend={HTML5Backend}>
|
<DndProvider backend={HTML5Backend}>
|
||||||
<Title title={props.templateId ? "Public Sign" : "Request Sign"} />
|
<Title title={props.templateId ? "Public Sign" : "Request Sign"} />
|
||||||
@@ -1624,7 +1708,23 @@ function PdfRequestFiles(props) {
|
|||||||
) : handleError ? (
|
) : handleError ? (
|
||||||
<HandleError handleError={handleError} />
|
<HandleError handleError={handleError} />
|
||||||
) : (
|
) : (
|
||||||
<div>
|
<div onClick={() => !isAgree && setIsAgreeTour(true)}>
|
||||||
|
{!isAgree && (
|
||||||
|
<Agreement
|
||||||
|
setIsAgree={setIsAgree}
|
||||||
|
setIsAgreeTour={setIsAgreeTour}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<Tour
|
||||||
|
showNumber={false}
|
||||||
|
showNavigation={false}
|
||||||
|
showNavigationNumber={false}
|
||||||
|
onRequestClose={handleCloseAgreeTour}
|
||||||
|
steps={AgreementTour}
|
||||||
|
isOpen={isAgreeTour}
|
||||||
|
rounded={5}
|
||||||
|
closeWithMask={false}
|
||||||
|
/>
|
||||||
{isUiLoading && (
|
{isUiLoading && (
|
||||||
<div className="absolute h-[100vh] w-full flex flex-col justify-center items-center z-[999] bg-[#e6f2f2] bg-opacity-80">
|
<div className="absolute h-[100vh] w-full flex flex-col justify-center items-center z-[999] bg-[#e6f2f2] bg-opacity-80">
|
||||||
<Loader />
|
<Loader />
|
||||||
@@ -1638,9 +1738,12 @@ function PdfRequestFiles(props) {
|
|||||||
<Confetti
|
<Confetti
|
||||||
width={window.innerWidth}
|
width={window.innerWidth}
|
||||||
height={window.innerHeight}
|
height={window.innerHeight}
|
||||||
|
recycle={false} // Prevents confetti from repeating
|
||||||
|
gravity={0.1} // Adjust the gravity to control the speed
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
pointerEvents:
|
pointerEvents:
|
||||||
@@ -1650,33 +1753,13 @@ function PdfRequestFiles(props) {
|
|||||||
: "auto"
|
: "auto"
|
||||||
}}
|
}}
|
||||||
className={`${
|
className={`${
|
||||||
props.templateId && "m-1 border-[0.5px] border-gray-300"
|
(props.templateId || isGuestSignFlow) &&
|
||||||
|
"mx-2 border-[0.5px] border-gray-300"
|
||||||
} relative op-card overflow-hidden flex flex-col md:flex-row justify-between bg-base-300`}
|
} relative op-card overflow-hidden flex flex-col md:flex-row justify-between bg-base-300`}
|
||||||
>
|
>
|
||||||
{!requestSignTour &&
|
{!requestSignTour &&
|
||||||
signerObjectId &&
|
signerObjectId &&
|
||||||
requestSignTourFunction()}
|
requestSignTourFunction()}
|
||||||
<ModalUi
|
|
||||||
isOpen={isAlert.isShow}
|
|
||||||
title={t("alert-message")}
|
|
||||||
handleClose={() =>
|
|
||||||
setIsAlert({ isShow: false, alertMessage: "" })
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<div className="h-full p-[20px]">
|
|
||||||
<p>{isAlert.alertMessage}</p>
|
|
||||||
<button
|
|
||||||
onClick={() =>
|
|
||||||
setIsAlert({ isShow: false, alertMessage: "" })
|
|
||||||
}
|
|
||||||
type="button"
|
|
||||||
className="op-btn op-btn-primary mt-3 px-4"
|
|
||||||
>
|
|
||||||
{t("ok")}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</ModalUi>
|
|
||||||
|
|
||||||
<Tour
|
<Tour
|
||||||
showNumber={false}
|
showNumber={false}
|
||||||
showNavigation={false}
|
showNavigation={false}
|
||||||
@@ -1691,11 +1774,7 @@ function PdfRequestFiles(props) {
|
|||||||
{/* this modal is used to show decline alert */}
|
{/* this modal is used to show decline alert */}
|
||||||
<PdfDeclineModal
|
<PdfDeclineModal
|
||||||
show={isDecline.isDeclined}
|
show={isDecline.isDeclined}
|
||||||
headMsg={
|
headMsg={t("document-declined")}
|
||||||
pdfDetails[0]?.IsDeclined
|
|
||||||
? t("document-declined")
|
|
||||||
: t("document-decline")
|
|
||||||
}
|
|
||||||
bodyMssg={
|
bodyMssg={
|
||||||
isDecline.currnt === "Sure"
|
isDecline.currnt === "Sure"
|
||||||
? t("decline-alert-1")
|
? t("decline-alert-1")
|
||||||
@@ -1938,7 +2017,12 @@ function PdfRequestFiles(props) {
|
|||||||
<div className="flex mt-4 gap-1 px-[15px]">
|
<div className="flex mt-4 gap-1 px-[15px]">
|
||||||
<button
|
<button
|
||||||
onClick={(e) =>
|
onClick={(e) =>
|
||||||
handleToPrint(e, pdfUrl, setIsDownloading)
|
handleToPrint(
|
||||||
|
e,
|
||||||
|
pdfUrl,
|
||||||
|
setIsDownloading,
|
||||||
|
pdfDetails
|
||||||
|
)
|
||||||
}
|
}
|
||||||
type="button"
|
type="button"
|
||||||
className="font-[500] text-[13px] mr-[5px] op-btn op-btn-neutral"
|
className="font-[500] text-[13px] mr-[5px] op-btn op-btn-neutral"
|
||||||
@@ -1972,13 +2056,13 @@ function PdfRequestFiles(props) {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="font-[500] text-[13px] mr-[5px] op-btn op-btn-primary"
|
className="font-[500] text-[13px] mr-[5px] op-btn op-btn-primary"
|
||||||
onClick={() =>
|
onClick={() => {
|
||||||
handleDownloadPdf(
|
setIsCompleted((prev) => ({
|
||||||
pdfDetails,
|
...prev,
|
||||||
pdfUrl,
|
isModal: false
|
||||||
setIsDownloading
|
}));
|
||||||
)
|
setIsDownloadModal(true);
|
||||||
}
|
}}
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
className="fa-light fa-download"
|
className="fa-light fa-download"
|
||||||
@@ -2058,6 +2142,7 @@ function PdfRequestFiles(props) {
|
|||||||
clickOnZoomOut={clickOnZoomOut}
|
clickOnZoomOut={clickOnZoomOut}
|
||||||
isDisableRotate={true}
|
isDisableRotate={true}
|
||||||
templateId={props.templateId}
|
templateId={props.templateId}
|
||||||
|
setIsDownloadModal={setIsDownloadModal}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div ref={divRef} data-tut="pdfArea" className="h-[95%]">
|
<div ref={divRef} data-tut="pdfArea" className="h-[95%]">
|
||||||
@@ -2184,6 +2269,28 @@ function PdfRequestFiles(props) {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</ModalUi>
|
</ModalUi>
|
||||||
|
<DownloadPdfZip
|
||||||
|
setIsDownloadModal={setIsDownloadModal}
|
||||||
|
isDownloadModal={isDownloadModal}
|
||||||
|
pdfDetails={pdfDetails}
|
||||||
|
isDocId={true}
|
||||||
|
/>
|
||||||
|
<ModalUi
|
||||||
|
isOpen={isAlert.isShow}
|
||||||
|
title={isAlert?.title || t("alert-message")}
|
||||||
|
handleClose={() => setIsAlert({ isShow: false, alertMessage: "" })}
|
||||||
|
>
|
||||||
|
<div className="h-full p-[20px]">
|
||||||
|
<p>{isAlert.alertMessage}</p>
|
||||||
|
<button
|
||||||
|
onClick={() => setIsAlert({ isShow: false, alertMessage: "" })}
|
||||||
|
type="button"
|
||||||
|
className="op-btn op-btn-primary mt-3 px-4"
|
||||||
|
>
|
||||||
|
{t("close")}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</ModalUi>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</DndProvider>
|
</DndProvider>
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ import RenderAllPdfPage from "../components/pdf/RenderAllPdfPage";
|
|||||||
import WidgetComponent from "../components/pdf/WidgetComponent";
|
import WidgetComponent from "../components/pdf/WidgetComponent";
|
||||||
import Tour from "reactour";
|
import Tour from "reactour";
|
||||||
import { useLocation, useParams } from "react-router-dom";
|
import { useLocation, useParams } from "react-router-dom";
|
||||||
import LoaderWithMsg from "../primitives/LoaderWithMsg";
|
|
||||||
import HandleError from "../primitives/HandleError";
|
|
||||||
import SignerListPlace from "../components/pdf/SignerListPlace";
|
import SignerListPlace from "../components/pdf/SignerListPlace";
|
||||||
import Header from "../components/pdf/PdfHeader";
|
import Header from "../components/pdf/PdfHeader";
|
||||||
import { RWebShare } from "react-web-share";
|
import { RWebShare } from "react-web-share";
|
||||||
@@ -45,23 +43,25 @@ import {
|
|||||||
import RenderPdf from "../components/pdf/RenderPdf";
|
import RenderPdf from "../components/pdf/RenderPdf";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import PlaceholderCopy from "../components/pdf/PlaceholderCopy";
|
import PlaceholderCopy from "../components/pdf/PlaceholderCopy";
|
||||||
import LinkUserModal from "../primitives/LinkUserModal";
|
|
||||||
import Title from "../components/Title";
|
import Title from "../components/Title";
|
||||||
import TourContentWithBtn from "../primitives/TourContentWithBtn";
|
|
||||||
import ModalUi from "../primitives/ModalUi";
|
|
||||||
import DropdownWidgetOption from "../components/pdf/DropdownWidgetOption";
|
import DropdownWidgetOption from "../components/pdf/DropdownWidgetOption";
|
||||||
import WidgetNameModal from "../components/pdf/WidgetNameModal";
|
import WidgetNameModal from "../components/pdf/WidgetNameModal";
|
||||||
import { SaveFileSize } from "../constant/saveFileSize";
|
import { SaveFileSize } from "../constant/saveFileSize";
|
||||||
import { EmailBody } from "../components/pdf/EmailBody";
|
import { EmailBody } from "../components/pdf/EmailBody";
|
||||||
import Upgrade from "../primitives/Upgrade";
|
|
||||||
import Alert from "../primitives/Alert";
|
|
||||||
import Loader from "../primitives/Loader";
|
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import PdfZoom from "../components/pdf/PdfZoom";
|
import PdfZoom from "../components/pdf/PdfZoom";
|
||||||
import LottieWithLoader from "../primitives/DotLottieReact";
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import RotateAlert from "../components/RotateAlert";
|
import RotateAlert from "../components/RotateAlert";
|
||||||
|
import Loader from "../primitives/Loader";
|
||||||
|
import ModalUi from "../primitives/ModalUi";
|
||||||
|
import TourContentWithBtn from "../primitives/TourContentWithBtn";
|
||||||
|
import HandleError from "../primitives/HandleError";
|
||||||
|
import LoaderWithMsg from "../primitives/LoaderWithMsg";
|
||||||
|
import LinkUserModal from "../primitives/LinkUserModal";
|
||||||
import QuotaCard from "../primitives/QuotaCard";
|
import QuotaCard from "../primitives/QuotaCard";
|
||||||
|
import LottieWithLoader from "../primitives/DotLottieReact";
|
||||||
|
import Alert from "../primitives/Alert";
|
||||||
|
import Upgrade from "../primitives/Upgrade";
|
||||||
|
|
||||||
function PlaceHolderSign() {
|
function PlaceHolderSign() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -1047,7 +1047,7 @@ function PlaceHolderSign() {
|
|||||||
type="button"
|
type="button"
|
||||||
className="flex flex-row items-center op-link op-link-primary"
|
className="flex flex-row items-center op-link op-link-primary"
|
||||||
>
|
>
|
||||||
<i className="fa-light fa-link" aria-hidden="true"></i>
|
<i className="fa-light fa-copy" />
|
||||||
<span className=" hidden md:block ml-1 ">{t("copy-link")}</span>
|
<span className=" hidden md:block ml-1 ">{t("copy-link")}</span>
|
||||||
</button>
|
</button>
|
||||||
<RWebShare data={{ url: data.url, title: t("sign-url") }}>
|
<RWebShare data={{ url: data.url, title: t("sign-url") }}>
|
||||||
@@ -1250,7 +1250,7 @@ function PlaceHolderSign() {
|
|||||||
selector: '[data-tut="addWidgets"]',
|
selector: '[data-tut="addWidgets"]',
|
||||||
content: () => (
|
content: () => (
|
||||||
<TourContentWithBtn
|
<TourContentWithBtn
|
||||||
message={t("tour-mssg.placeholder-sign-3")}
|
message={t("tour-mssg.placeholder-sign-4")}
|
||||||
isChecked={handleDontShow}
|
isChecked={handleDontShow}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
@@ -1261,19 +1261,18 @@ function PlaceHolderSign() {
|
|||||||
selector: '[data-tut="pdfArea"]',
|
selector: '[data-tut="pdfArea"]',
|
||||||
content: () => (
|
content: () => (
|
||||||
<TourContentWithBtn
|
<TourContentWithBtn
|
||||||
message={t("tour-mssg.placeholder-sign-4")}
|
message={t("tour-mssg.placeholder-sign-5")}
|
||||||
isChecked={handleDontShow}
|
isChecked={handleDontShow}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
position: "top",
|
position: "top",
|
||||||
style: { fontSize: "13px" }
|
style: { fontSize: "13px" }
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
selector: '[data-tut="headerArea"]',
|
selector: '[data-tut="headerArea"]',
|
||||||
content: () => (
|
content: () => (
|
||||||
<TourContentWithBtn
|
<TourContentWithBtn
|
||||||
message={t("tour-mssg.placeholder-sign-5")}
|
message={t("tour-mssg.placeholder-sign-6")}
|
||||||
isChecked={handleDontShow}
|
isChecked={handleDontShow}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import "../styles/signature.css";
|
|||||||
import Parse from "parse";
|
import Parse from "parse";
|
||||||
import Confetti from "react-confetti";
|
import Confetti from "react-confetti";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import LoaderWithMsg from "../primitives/LoaderWithMsg";
|
|
||||||
import RenderAllPdfPage from "../components/pdf/RenderAllPdfPage";
|
import RenderAllPdfPage from "../components/pdf/RenderAllPdfPage";
|
||||||
import { DndProvider } from "react-dnd";
|
import { DndProvider } from "react-dnd";
|
||||||
import { HTML5Backend } from "react-dnd-html5-backend";
|
import { HTML5Backend } from "react-dnd-html5-backend";
|
||||||
@@ -42,21 +41,23 @@ import {
|
|||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import Tour from "reactour";
|
import Tour from "reactour";
|
||||||
import Signedby from "../components/pdf/Signedby";
|
import Signedby from "../components/pdf/Signedby";
|
||||||
import HandleError from "../primitives/HandleError";
|
|
||||||
import Header from "../components/pdf/PdfHeader";
|
import Header from "../components/pdf/PdfHeader";
|
||||||
import RenderPdf from "../components/pdf/RenderPdf";
|
import RenderPdf from "../components/pdf/RenderPdf";
|
||||||
import PlaceholderCopy from "../components/pdf/PlaceholderCopy";
|
import PlaceholderCopy from "../components/pdf/PlaceholderCopy";
|
||||||
import TourContentWithBtn from "../primitives/TourContentWithBtn";
|
|
||||||
import Title from "../components/Title";
|
import Title from "../components/Title";
|
||||||
import ModalUi from "../primitives/ModalUi";
|
|
||||||
import DropdownWidgetOption from "../components/pdf/DropdownWidgetOption";
|
import DropdownWidgetOption from "../components/pdf/DropdownWidgetOption";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import TextFontSetting from "../components/pdf/TextFontSetting";
|
import TextFontSetting from "../components/pdf/TextFontSetting";
|
||||||
import VerifyEmail from "../components/pdf/VerifyEmail";
|
import VerifyEmail from "../components/pdf/VerifyEmail";
|
||||||
import PdfZoom from "../components/pdf/PdfZoom";
|
import PdfZoom from "../components/pdf/PdfZoom";
|
||||||
import Loader from "../primitives/Loader";
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import RotateAlert from "../components/RotateAlert";
|
import RotateAlert from "../components/RotateAlert";
|
||||||
|
import DownloadPdfZip from "../primitives/DownloadPdfZip";
|
||||||
|
import Loader from "../primitives/Loader";
|
||||||
|
import ModalUi from "../primitives/ModalUi";
|
||||||
|
import TourContentWithBtn from "../primitives/TourContentWithBtn";
|
||||||
|
import HandleError from "../primitives/HandleError";
|
||||||
|
import LoaderWithMsg from "../primitives/LoaderWithMsg";
|
||||||
//For signYourself inProgress section signer can add sign and complete doc sign.
|
//For signYourself inProgress section signer can add sign and complete doc sign.
|
||||||
function SignYourSelf() {
|
function SignYourSelf() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -130,6 +131,7 @@ function SignYourSelf() {
|
|||||||
const [pdfRotateBase64, setPdfRotatese64] = useState("");
|
const [pdfRotateBase64, setPdfRotatese64] = useState("");
|
||||||
const [isRotate, setIsRotate] = useState({ status: false, degree: 0 });
|
const [isRotate, setIsRotate] = useState({ status: false, degree: 0 });
|
||||||
const [isSubscribe, setIsSubscribe] = useState({ plan: "", isValid: true });
|
const [isSubscribe, setIsSubscribe] = useState({ plan: "", isValid: true });
|
||||||
|
const [isDownloadModal, setIsDownloadModal] = useState(false);
|
||||||
const divRef = useRef(null);
|
const divRef = useRef(null);
|
||||||
const nodeRef = useRef(null);
|
const nodeRef = useRef(null);
|
||||||
const [, drop] = useDrop({
|
const [, drop] = useDrop({
|
||||||
@@ -1190,7 +1192,12 @@ function SignYourSelf() {
|
|||||||
)}
|
)}
|
||||||
{isCelebration && (
|
{isCelebration && (
|
||||||
<div className="relative z-[1000]">
|
<div className="relative z-[1000]">
|
||||||
<Confetti width={window.innerWidth} height={window.innerHeight} />
|
<Confetti
|
||||||
|
width={window.innerWidth}
|
||||||
|
height={window.innerHeight}
|
||||||
|
recycle={false} // Prevents confetti from repeating
|
||||||
|
gravity={0.1} // Adjust the gravity to control the speed
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="relative op-card overflow-hidden flex flex-col md:flex-row justify-between bg-base-300">
|
<div className="relative op-card overflow-hidden flex flex-col md:flex-row justify-between bg-base-300">
|
||||||
@@ -1327,6 +1334,7 @@ function SignYourSelf() {
|
|||||||
setIsAlert={setIsAlert}
|
setIsAlert={setIsAlert}
|
||||||
extUserId={extUserId}
|
extUserId={extUserId}
|
||||||
activeMailAdapter={activeMailAdapter}
|
activeMailAdapter={activeMailAdapter}
|
||||||
|
setIsDownloadModal={setIsDownloadModal}
|
||||||
/>
|
/>
|
||||||
{/* pdf header which contain funish back button */}
|
{/* pdf header which contain funish back button */}
|
||||||
<Header
|
<Header
|
||||||
@@ -1346,6 +1354,7 @@ function SignYourSelf() {
|
|||||||
clickOnZoomIn={clickOnZoomIn}
|
clickOnZoomIn={clickOnZoomIn}
|
||||||
clickOnZoomOut={clickOnZoomOut}
|
clickOnZoomOut={clickOnZoomOut}
|
||||||
widgetsDetails={xyPostion}
|
widgetsDetails={xyPostion}
|
||||||
|
setIsDownloadModal={setIsDownloadModal}
|
||||||
/>
|
/>
|
||||||
<div ref={divRef} data-tut="reactourSecond" className="h-full">
|
<div ref={divRef} data-tut="reactourSecond" className="h-full">
|
||||||
{containerWH?.width && containerWH?.height && (
|
{containerWH?.width && containerWH?.height && (
|
||||||
@@ -1450,6 +1459,12 @@ function SignYourSelf() {
|
|||||||
setIsRotate={setIsRotate}
|
setIsRotate={setIsRotate}
|
||||||
handleRemoveWidgets={handleRemoveWidgets}
|
handleRemoveWidgets={handleRemoveWidgets}
|
||||||
/>
|
/>
|
||||||
|
<DownloadPdfZip
|
||||||
|
setIsDownloadModal={setIsDownloadModal}
|
||||||
|
isDownloadModal={isDownloadModal}
|
||||||
|
pdfDetails={pdfDetails}
|
||||||
|
isDocId={true}
|
||||||
|
/>
|
||||||
<TextFontSetting
|
<TextFontSetting
|
||||||
isTextSetting={isTextSetting}
|
isTextSetting={isTextSetting}
|
||||||
setIsTextSetting={setIsTextSetting}
|
setIsTextSetting={setIsTextSetting}
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import { HTML5Backend } from "react-dnd-html5-backend";
|
|||||||
import { useDrag, useDrop } from "react-dnd";
|
import { useDrag, useDrop } from "react-dnd";
|
||||||
import WidgetComponent from "../components/pdf/WidgetComponent";
|
import WidgetComponent from "../components/pdf/WidgetComponent";
|
||||||
import Tour from "reactour";
|
import Tour from "reactour";
|
||||||
import LoaderWithMsg from "../primitives/LoaderWithMsg";
|
|
||||||
import HandleError from "../primitives/HandleError";
|
|
||||||
import SignerListPlace from "../components/pdf/SignerListPlace";
|
import SignerListPlace from "../components/pdf/SignerListPlace";
|
||||||
import Header from "../components/pdf/PdfHeader";
|
import Header from "../components/pdf/PdfHeader";
|
||||||
import WidgetNameModal from "../components/pdf/WidgetNameModal";
|
import WidgetNameModal from "../components/pdf/WidgetNameModal";
|
||||||
@@ -36,18 +34,21 @@ import {
|
|||||||
import RenderPdf from "../components/pdf/RenderPdf";
|
import RenderPdf from "../components/pdf/RenderPdf";
|
||||||
import "../styles/AddUser.css";
|
import "../styles/AddUser.css";
|
||||||
import Title from "../components/Title";
|
import Title from "../components/Title";
|
||||||
import LinkUserModal from "../primitives/LinkUserModal";
|
|
||||||
import EditTemplate from "../components/pdf/EditTemplate";
|
import EditTemplate from "../components/pdf/EditTemplate";
|
||||||
import ModalUi from "../primitives/ModalUi";
|
|
||||||
import AddRoleModal from "../components/pdf/AddRoleModal";
|
import AddRoleModal from "../components/pdf/AddRoleModal";
|
||||||
import PlaceholderCopy from "../components/pdf/PlaceholderCopy";
|
import PlaceholderCopy from "../components/pdf/PlaceholderCopy";
|
||||||
import TourContentWithBtn from "../primitives/TourContentWithBtn";
|
|
||||||
import DropdownWidgetOption from "../components/pdf/DropdownWidgetOption";
|
import DropdownWidgetOption from "../components/pdf/DropdownWidgetOption";
|
||||||
import Parse from "parse";
|
import Parse from "parse";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import PdfZoom from "../components/pdf/PdfZoom";
|
import PdfZoom from "../components/pdf/PdfZoom";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import RotateAlert from "../components/RotateAlert";
|
import RotateAlert from "../components/RotateAlert";
|
||||||
|
import ModalUi from "../primitives/ModalUi";
|
||||||
|
import TourContentWithBtn from "../primitives/TourContentWithBtn";
|
||||||
|
import HandleError from "../primitives/HandleError";
|
||||||
|
import LoaderWithMsg from "../primitives/LoaderWithMsg";
|
||||||
|
import LinkUserModal from "../primitives/LinkUserModal";
|
||||||
|
|
||||||
const TemplatePlaceholder = () => {
|
const TemplatePlaceholder = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -779,6 +780,7 @@ const TemplatePlaceholder = () => {
|
|||||||
AutomaticReminders: pdfDetails[0]?.AutomaticReminders,
|
AutomaticReminders: pdfDetails[0]?.AutomaticReminders,
|
||||||
RemindOnceInEvery: parseInt(pdfDetails[0]?.RemindOnceInEvery),
|
RemindOnceInEvery: parseInt(pdfDetails[0]?.RemindOnceInEvery),
|
||||||
NextReminderDate: pdfDetails[0]?.NextReminderDate,
|
NextReminderDate: pdfDetails[0]?.NextReminderDate,
|
||||||
|
IsEnableOTP: pdfDetails[0]?.IsEnableOTP === true ? true : false,
|
||||||
URL: pdfUrl
|
URL: pdfUrl
|
||||||
};
|
};
|
||||||
const updateTemplate = new Parse.Object("contracts_Template");
|
const updateTemplate = new Parse.Object("contracts_Template");
|
||||||
|
|||||||
@@ -596,7 +596,7 @@ function UserProfile() {
|
|||||||
className="op-btn op-btn-primary op-btn-outline op-btn-xs md:op-btn-sm"
|
className="op-btn op-btn-primary op-btn-outline op-btn-xs md:op-btn-sm"
|
||||||
onClick={() => copytoclipboard()}
|
onClick={() => copytoclipboard()}
|
||||||
>
|
>
|
||||||
<i className="fa-light fa-link"></i>{" "}
|
<i className="fa-light fa-copy" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import React, { useState } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
|
function Agreement(props) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [isChecked, setIsChecked] = useState(false);
|
||||||
|
return (
|
||||||
|
<div className="flex justify-between mx-2 mb-2 pt-1" data-tut="IsAgree">
|
||||||
|
<div className="flex items-center">
|
||||||
|
<input
|
||||||
|
className="mr-3 op-checkbox op-checkbox-m"
|
||||||
|
type="checkbox"
|
||||||
|
value={isChecked}
|
||||||
|
onChange={(e) => {
|
||||||
|
setIsChecked(e.target.checked);
|
||||||
|
if (e.target.checked) {
|
||||||
|
props.setIsAgreeTour(false);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
I confirm that I have read and understood the 'Electronic Record
|
||||||
|
and Signature Disclosure' and consent to use electronic records and
|
||||||
|
signatures.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex">
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
if (isChecked) {
|
||||||
|
props.setIsAgreeTour(false);
|
||||||
|
props.setIsAgree(true);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
className="op-btn op-btn-primary op-btn-sm"
|
||||||
|
>
|
||||||
|
Agree & Continue
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Agreement;
|
||||||
@@ -25,8 +25,8 @@ const Alert = ({ children, type, className }) => {
|
|||||||
: "z-[1000] fixed top-20 left-1/2 transform -translate-x-1/2 text-sm"
|
: "z-[1000] fixed top-20 left-1/2 transform -translate-x-1/2 text-sm"
|
||||||
} `}
|
} `}
|
||||||
>
|
>
|
||||||
<div className={`op-alert ${textcolor}`}>
|
<div className={`op-alert ${textcolor} flex justify-center`}>
|
||||||
<span className="ml-3">{children}</span>
|
<span className="px-1">{children}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,136 @@
|
|||||||
|
import React, { useState } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import ModalUi from "./ModalUi";
|
||||||
|
import {
|
||||||
|
getSignedUrl,
|
||||||
|
handleDownloadCertificate,
|
||||||
|
handleDownloadPdf,
|
||||||
|
sanitizeFileName
|
||||||
|
} from "../constant/Utils";
|
||||||
|
import Loader from "./Loader";
|
||||||
|
import JSZip from "jszip";
|
||||||
|
import { saveAs } from "file-saver";
|
||||||
|
|
||||||
|
function DownloadPdfZip(props) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [selectType, setSelectType] = useState(1);
|
||||||
|
const [isDownloading, setIsDownloading] = useState(false);
|
||||||
|
const downloadType = [
|
||||||
|
{ id: 1, label: t("download-pdf") },
|
||||||
|
{ id: 2, label: t("pdf-certificate") }
|
||||||
|
];
|
||||||
|
|
||||||
|
const handleDownload = async () => {
|
||||||
|
if (selectType === 1) {
|
||||||
|
await handleDownloadPdf(props.pdfDetails, setIsDownloading);
|
||||||
|
setSelectType(1);
|
||||||
|
props.setIsDownloadModal(false);
|
||||||
|
} else if (selectType === 2) {
|
||||||
|
setIsDownloading("pdf");
|
||||||
|
const zip = new JSZip();
|
||||||
|
const pdfDetails = props.pdfDetails;
|
||||||
|
const pdfName = pdfDetails?.[0]?.Name || "Document";
|
||||||
|
const pdfUrl = pdfDetails?.[0]?.SignedUrl || "";
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Fetch the first PDF (Signed Document)
|
||||||
|
const docId =
|
||||||
|
props.isDocId && !pdfDetails?.[0]?.IsEnableOTP
|
||||||
|
? pdfDetails?.[0]?.objectId
|
||||||
|
: "";
|
||||||
|
const signedUrl = await getSignedUrl(pdfUrl, docId);
|
||||||
|
const pdf1Response = await fetch(signedUrl);
|
||||||
|
if (!pdf1Response.ok) {
|
||||||
|
throw new Error(`Failed to fetch PDF: ${signedUrl}`);
|
||||||
|
}
|
||||||
|
const pdf1Blob = await pdf1Response.blob();
|
||||||
|
const isZip = true;
|
||||||
|
// Fetch the Certificate (or generate its URL dynamically)
|
||||||
|
const certificateUrl = await handleDownloadCertificate(
|
||||||
|
pdfDetails,
|
||||||
|
setIsDownloading,
|
||||||
|
isZip
|
||||||
|
);
|
||||||
|
const pdf2Response = await fetch(certificateUrl);
|
||||||
|
if (!pdf2Response.ok) {
|
||||||
|
throw new Error(`Failed to fetch certificate PDF: ${certificateUrl}`);
|
||||||
|
}
|
||||||
|
const pdf2Blob = await pdf2Response.blob();
|
||||||
|
// Add files to ZIP
|
||||||
|
zip.file(
|
||||||
|
`${sanitizeFileName(pdfName)}_signed_by_OpenSign™.pdf`,
|
||||||
|
pdf1Blob
|
||||||
|
);
|
||||||
|
zip.file("Certificate_signed_by_OpenSign™.pdf", pdf2Blob);
|
||||||
|
|
||||||
|
// Generate the ZIP and trigger download
|
||||||
|
const zipBlob = await zip.generateAsync({ type: "blob" });
|
||||||
|
saveAs(
|
||||||
|
zipBlob,
|
||||||
|
`${sanitizeFileName(pdfName)}_signed_by_OpenSign™.zip`
|
||||||
|
);
|
||||||
|
setSelectType(1);
|
||||||
|
props.setIsDownloadModal(false);
|
||||||
|
setIsDownloading("");
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error creating ZIP file:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<ModalUi
|
||||||
|
isOpen={props.isDownloadModal}
|
||||||
|
title={t("download-files")}
|
||||||
|
handleClose={() => props.setIsDownloadModal(false)}
|
||||||
|
>
|
||||||
|
<div className="p-[20px] h-full">
|
||||||
|
{downloadType.map((data, ind) => {
|
||||||
|
return (
|
||||||
|
<label
|
||||||
|
key={ind}
|
||||||
|
className="flex items-center gap-1 mb-2 cursor-pointer"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
className="mr-[8px] op-radio op-radio-xs"
|
||||||
|
type="radio"
|
||||||
|
value={data.id}
|
||||||
|
onChange={() => setSelectType(data.id)}
|
||||||
|
checked={selectType === data.id}
|
||||||
|
/>
|
||||||
|
{data.label}
|
||||||
|
</label>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
<div className="h-[1px] w-full my-[15px] bg-[#9f9f9f]"></div>
|
||||||
|
<button
|
||||||
|
onClick={() => handleDownload()}
|
||||||
|
type="submit"
|
||||||
|
className="op-btn op-btn-primary"
|
||||||
|
>
|
||||||
|
{t("download")}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{isDownloading === "pdf" && (
|
||||||
|
<div className="fixed z-[200] inset-0 flex justify-center items-center bg-black bg-opacity-30">
|
||||||
|
<Loader />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<ModalUi
|
||||||
|
isOpen={isDownloading === "certificate"}
|
||||||
|
title={
|
||||||
|
isDownloading === "certificate"
|
||||||
|
? t("generating-certificate")
|
||||||
|
: t("pdf-download")
|
||||||
|
}
|
||||||
|
handleClose={() => setIsDownloading("")}
|
||||||
|
>
|
||||||
|
<div className="p-3 md:p-5 text-[13px] md:text-base text-center text-base-content">
|
||||||
|
{isDownloading === "certificate"}{" "}
|
||||||
|
<p>{t("generate-certificate-alert")}</p>
|
||||||
|
</div>
|
||||||
|
</ModalUi>
|
||||||
|
</ModalUi>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DownloadPdfZip;
|
||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
checkIsSubscribed,
|
checkIsSubscribed,
|
||||||
copytoData,
|
copytoData,
|
||||||
fetchUrl,
|
fetchUrl,
|
||||||
|
getSignedUrl,
|
||||||
replaceMailVaribles
|
replaceMailVaribles
|
||||||
} from "../constant/Utils";
|
} from "../constant/Utils";
|
||||||
import Confetti from "react-confetti";
|
import Confetti from "react-confetti";
|
||||||
@@ -30,6 +31,8 @@ import SubscribeCard from "./SubscribeCard";
|
|||||||
import { validplan } from "../json/plansArr";
|
import { validplan } from "../json/plansArr";
|
||||||
import { serverUrl_fn } from "../constant/appinfo";
|
import { serverUrl_fn } from "../constant/appinfo";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import DownloadPdfZip from "./DownloadPdfZip";
|
||||||
|
import EmbedTab from "../components/pdf/EmbedTab";
|
||||||
|
|
||||||
const ReportTable = (props) => {
|
const ReportTable = (props) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -69,7 +72,10 @@ const ReportTable = (props) => {
|
|||||||
const [publicUserName, setIsPublicUserName] = useState("");
|
const [publicUserName, setIsPublicUserName] = useState("");
|
||||||
const [isViewShare, setIsViewShare] = useState({});
|
const [isViewShare, setIsViewShare] = useState({});
|
||||||
const [isSubscribe, setIsSubscribe] = useState(true);
|
const [isSubscribe, setIsSubscribe] = useState(true);
|
||||||
|
const [isModal, setIsModal] = useState({});
|
||||||
const [reason, setReason] = useState("");
|
const [reason, setReason] = useState("");
|
||||||
|
const [isDownloadModal, setIsDownloadModal] = useState(false);
|
||||||
|
const [isEmbed, setIsEmbed] = useState(false);
|
||||||
const Extand_Class = localStorage.getItem("Extand_Class");
|
const Extand_Class = localStorage.getItem("Extand_Class");
|
||||||
const extClass = Extand_Class && JSON.parse(Extand_Class);
|
const extClass = Extand_Class && JSON.parse(Extand_Class);
|
||||||
const startIndex = (currentPage - 1) * props.docPerPage;
|
const startIndex = (currentPage - 1) * props.docPerPage;
|
||||||
@@ -266,7 +272,8 @@ const ReportTable = (props) => {
|
|||||||
Signers: signers,
|
Signers: signers,
|
||||||
SendinOrder: Doc?.SendinOrder || false,
|
SendinOrder: Doc?.SendinOrder || false,
|
||||||
AutomaticReminders: Doc?.AutomaticReminders || false,
|
AutomaticReminders: Doc?.AutomaticReminders || false,
|
||||||
RemindOnceInEvery: Doc?.RemindOnceInEvery || 5
|
RemindOnceInEvery: Doc?.RemindOnceInEvery || 5,
|
||||||
|
IsEnableOTP: Doc?.IsEnableOTP || false
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
const res = await axios.post(
|
const res = await axios.post(
|
||||||
@@ -364,6 +371,8 @@ const ReportTable = (props) => {
|
|||||||
setIsShareWith({ [item.objectId]: true });
|
setIsShareWith({ [item.objectId]: true });
|
||||||
} else if (act.action === "Embed") {
|
} else if (act.action === "Embed") {
|
||||||
handleEmbedFunction(item);
|
handleEmbedFunction(item);
|
||||||
|
} else if (act.action === "CopyTemplateId") {
|
||||||
|
copyTemplateId(item.objectId);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// Get current list
|
// Get current list
|
||||||
@@ -515,7 +524,6 @@ const ReportTable = (props) => {
|
|||||||
.then(async (result) => {
|
.then(async (result) => {
|
||||||
const res = result.data;
|
const res = result.data;
|
||||||
if (res) {
|
if (res) {
|
||||||
setReason("");
|
|
||||||
setActLoader({});
|
setActLoader({});
|
||||||
setIsAlert(true);
|
setIsAlert(true);
|
||||||
setAlertMsg({
|
setAlertMsg({
|
||||||
@@ -527,7 +535,43 @@ const ReportTable = (props) => {
|
|||||||
(x) => x.objectId !== item.objectId
|
(x) => x.objectId !== item.objectId
|
||||||
);
|
);
|
||||||
props.setList(upldatedList);
|
props.setList(upldatedList);
|
||||||
|
const params = {
|
||||||
|
event: "declined",
|
||||||
|
body: {
|
||||||
|
objectId: item.objectId,
|
||||||
|
file: item?.SignedUrl || item?.URL,
|
||||||
|
name: item?.Name,
|
||||||
|
note: item?.Note || "",
|
||||||
|
description: item?.Description || "",
|
||||||
|
signers: item?.Signers?.map((x) => ({
|
||||||
|
name: x?.Name,
|
||||||
|
email: x?.Email,
|
||||||
|
phone: x?.Phone
|
||||||
|
})),
|
||||||
|
declinedBy: jsonSender?.email,
|
||||||
|
declinedReason: reason,
|
||||||
|
declinedAt: new Date(),
|
||||||
|
createdAt: item?.createdAt
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
await axios.post(
|
||||||
|
`${localStorage.getItem("baseUrl")}functions/callwebhook`,
|
||||||
|
params,
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
|
||||||
|
sessiontoken: localStorage.getItem("accesstoken")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} catch (err) {
|
||||||
|
console.log("Err ", err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
setReason("");
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log("err", err);
|
console.log("err", err);
|
||||||
@@ -612,10 +656,15 @@ const ReportTable = (props) => {
|
|||||||
setActLoader({ [`${item.objectId}`]: true });
|
setActLoader({ [`${item.objectId}`]: true });
|
||||||
const url = item?.SignedUrl || item?.URL || "";
|
const url = item?.SignedUrl || item?.URL || "";
|
||||||
const pdfName = item?.Name || "exported_file";
|
const pdfName = item?.Name || "exported_file";
|
||||||
|
const isCompleted = item?.IsCompleted || false;
|
||||||
if (url) {
|
if (url) {
|
||||||
try {
|
try {
|
||||||
const signedUrl = await Parse.Cloud.run("getsignedurl", { url: url });
|
if (isCompleted) {
|
||||||
await fetchUrl(signedUrl, pdfName);
|
setIsDownloadModal({ [item.objectId]: true });
|
||||||
|
} else {
|
||||||
|
const signedUrl = await getSignedUrl(url);
|
||||||
|
await fetchUrl(signedUrl, pdfName);
|
||||||
|
}
|
||||||
setActLoader({});
|
setActLoader({});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("err in getsignedurl", err);
|
console.log("err in getsignedurl", err);
|
||||||
@@ -741,7 +790,7 @@ const ReportTable = (props) => {
|
|||||||
sessionToken: localStorage.getItem("accesstoken")
|
sessionToken: localStorage.getItem("accesstoken")
|
||||||
};
|
};
|
||||||
let params = {
|
let params = {
|
||||||
mailProvider: doc?.ExtUserPtr?.active_mail_adapter,
|
mailProvider: doc?.ExtUserPtr?.active_mail_adapter || "",
|
||||||
extUserId: doc?.ExtUserPtr?.objectId,
|
extUserId: doc?.ExtUserPtr?.objectId,
|
||||||
recipient: userDetails?.Email,
|
recipient: userDetails?.Email,
|
||||||
subject: mail.subject,
|
subject: mail.subject,
|
||||||
@@ -1076,12 +1125,14 @@ const ReportTable = (props) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleEmbedFunction = async (item) => {
|
const handleEmbedFunction = async (item) => {
|
||||||
|
setIsEmbed(true);
|
||||||
setIsPublicProfile({
|
setIsPublicProfile({
|
||||||
[item.objectId]: props.isPublic[item.objectId]
|
[item.objectId]: true
|
||||||
});
|
});
|
||||||
let extendUser = JSON.parse(localStorage.getItem("Extand_Class"));
|
let extendUser = JSON.parse(localStorage.getItem("Extand_Class"));
|
||||||
setIsPublicUserName(extendUser[0]?.UserName || "");
|
setIsPublicUserName(extendUser[0]?.UserName || "");
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
{Object.keys(actLoader)?.length > 0 && (
|
{Object.keys(actLoader)?.length > 0 && (
|
||||||
@@ -1089,10 +1140,15 @@ const ReportTable = (props) => {
|
|||||||
<Loader />
|
<Loader />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="p-2 w-full overflow-auto bg-base-100 text-base-content op-card shadow-lg">
|
<div className="p-2 w-full overflow-hidden bg-base-100 text-base-content op-card shadow-lg">
|
||||||
{isCelebration && (
|
{isCelebration && (
|
||||||
<div className="relative z-[1000]">
|
<div className="relative z-[1000]">
|
||||||
<Confetti width={window.innerWidth} height={window.innerHeight} />
|
<Confetti
|
||||||
|
width={window.innerWidth}
|
||||||
|
height={window.innerHeight}
|
||||||
|
recycle={false} // Prevents confetti from repeating
|
||||||
|
gravity={0.1} // Adjust the gravity to control the speed
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{isAlert && <Alert type={alertMsg.type}>{alertMsg.message}</Alert>}
|
{isAlert && <Alert type={alertMsg.type}>{alertMsg.message}</Alert>}
|
||||||
@@ -1132,8 +1188,8 @@ const ReportTable = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className={`${
|
className={`${
|
||||||
isDashboard && props.List?.length > 0 ? "h-[317px]" : "h-full"
|
isDashboard && props.List?.length > 0 ? "min-h-[317px]" : "h-full"
|
||||||
} w-full`}
|
} overflow-auto w-full`}
|
||||||
>
|
>
|
||||||
<table className="op-table border-collapse w-full ">
|
<table className="op-table border-collapse w-full ">
|
||||||
<thead className="text-[14px]">
|
<thead className="text-[14px]">
|
||||||
@@ -1169,48 +1225,50 @@ const ReportTable = (props) => {
|
|||||||
</td>
|
</td>
|
||||||
<td className="px-4 py-2 ">{item?.Email || "-"}</td>
|
<td className="px-4 py-2 ">{item?.Email || "-"}</td>
|
||||||
<td className="px-4 py-2">{item?.Phone || "-"}</td>
|
<td className="px-4 py-2">{item?.Phone || "-"}</td>
|
||||||
<td className="px-3 py-2 text-white grid grid-cols-2">
|
<td className="px-3 py-2">
|
||||||
{props.actions?.length > 0 &&
|
<div className="text-base-content min-w-max flex flex-row gap-x-2 gap-y-1 justify-start items-center">
|
||||||
props.actions.map((act, index) => (
|
{props.actions?.length > 0 &&
|
||||||
<button
|
props.actions.map((act, index) => (
|
||||||
key={index}
|
<button
|
||||||
onClick={() => handleActionBtn(act, item)}
|
key={index}
|
||||||
title={t(`btnLabel.${act.hoverLabel}`)}
|
onClick={() => handleActionBtn(act, item)}
|
||||||
className={`${
|
title={t(`btnLabel.${act.hoverLabel}`)}
|
||||||
act?.btnColor ? act.btnColor : ""
|
className={`${
|
||||||
} op-btn op-btn-sm`}
|
act?.btnColor ? act.btnColor : ""
|
||||||
|
} op-btn op-btn-sm`}
|
||||||
|
>
|
||||||
|
<i className={act.btnIcon}></i>
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
{isDeleteModal[item.objectId] && (
|
||||||
|
<ModalUi
|
||||||
|
isOpen
|
||||||
|
title={"Delete Contact"}
|
||||||
|
handleClose={handleClose}
|
||||||
>
|
>
|
||||||
<i className={act.btnIcon}></i>
|
<div className="m-[20px]">
|
||||||
</button>
|
<div className="text-lg font-normal text-black">
|
||||||
))}
|
{t("contact-delete-alert")}
|
||||||
{isDeleteModal[item.objectId] && (
|
</div>
|
||||||
<ModalUi
|
<hr className="bg-[#ccc] mt-4 " />
|
||||||
isOpen
|
<div className="flex items-center mt-3 gap-2 text-white">
|
||||||
title={"Delete Contact"}
|
<button
|
||||||
handleClose={handleClose}
|
onClick={() => handleDelete(item)}
|
||||||
>
|
className="op-btn op-btn-primary"
|
||||||
<div className="m-[20px]">
|
>
|
||||||
<div className="text-lg font-normal text-black">
|
{t("yes")}
|
||||||
{t("contact-delete-alert")}
|
</button>
|
||||||
|
<button
|
||||||
|
onClick={handleClose}
|
||||||
|
className="op-btn op-btn-secondary"
|
||||||
|
>
|
||||||
|
{t("no")}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr className="bg-[#ccc] mt-4 " />
|
</ModalUi>
|
||||||
<div className="flex items-center mt-3 gap-2 text-white">
|
)}
|
||||||
<button
|
</div>
|
||||||
onClick={() => handleDelete(item)}
|
|
||||||
className="op-btn op-btn-primary"
|
|
||||||
>
|
|
||||||
{t("yes")}
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
onClick={handleClose}
|
|
||||||
className="op-btn op-btn-secondary"
|
|
||||||
>
|
|
||||||
{t("no")}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</ModalUi>
|
|
||||||
)}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
) : (
|
) : (
|
||||||
@@ -1252,9 +1310,55 @@ const ReportTable = (props) => {
|
|||||||
{item?.URL ? t("download") : "-"}
|
{item?.URL ? t("download") : "-"}
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-4 py-2">
|
{props.ReportName === "In-progress documents" ? (
|
||||||
{formatRow(item?.ExtUserPtr)}
|
<td className="px-4 py-2">
|
||||||
</td>
|
<button
|
||||||
|
onClick={() =>
|
||||||
|
item?.AuditTrail?.length > 0 &&
|
||||||
|
setIsModal({ [item?.objectId]: true })
|
||||||
|
}
|
||||||
|
className={`${
|
||||||
|
item?.AuditTrail?.length
|
||||||
|
? "border-green-400"
|
||||||
|
: "cursor-default op-border-primary"
|
||||||
|
} focus:outline-none w-[60px] border-[2px] text-[12px] rounded-full md:self-center`}
|
||||||
|
>
|
||||||
|
{item?.AuditTrail?.length ? "VIEWED" : "SENT"}
|
||||||
|
</button>
|
||||||
|
{isModal[item.objectId] && (
|
||||||
|
<ModalUi
|
||||||
|
isOpen
|
||||||
|
title={t("document-logs")}
|
||||||
|
handleClose={() => setIsModal({})}
|
||||||
|
>
|
||||||
|
{item?.AuditTrail?.map((x, i) => (
|
||||||
|
<div
|
||||||
|
key={i}
|
||||||
|
className="pl-3 first:mt-2 text-sm font-medium flex flex-col md:flex-row items-start md:gap-4 border-t-[1px] border-gray-600"
|
||||||
|
>
|
||||||
|
<div className="py-2 break-all font-bold md:text-[12px] md:col-span-2 w-full md:w-[210px]">
|
||||||
|
{x?.UserPtr?.Email || "-"}
|
||||||
|
</div>
|
||||||
|
<button className="px-2 cursor-default border-[2px] text-[12px] border-green-400 rounded-full md:self-center">
|
||||||
|
{x?.Activity?.toUpperCase() || "-"}
|
||||||
|
</button>
|
||||||
|
<div className=" text-[12px] py-2">
|
||||||
|
{x?.Activity === "Signed"
|
||||||
|
? new Date(x?.SignedOn)?.toUTCString()
|
||||||
|
: new Date(
|
||||||
|
x?.ViewedOn
|
||||||
|
)?.toUTCString() || "-"}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</ModalUi>
|
||||||
|
)}
|
||||||
|
</td>
|
||||||
|
) : (
|
||||||
|
<td className="px-4 py-2">
|
||||||
|
{formatRow(item?.ExtUserPtr)}
|
||||||
|
</td>
|
||||||
|
)}
|
||||||
<td className="px-4 py-2">
|
<td className="px-4 py-2">
|
||||||
{!item?.IsSignyourself && item?.Placeholders ? (
|
{!item?.IsSignyourself && item?.Placeholders ? (
|
||||||
<button
|
<button
|
||||||
@@ -1272,11 +1376,7 @@ const ReportTable = (props) => {
|
|||||||
<td className=" pl-[20px] py-2">
|
<td className=" pl-[20px] py-2">
|
||||||
{props.ReportName === "Templates" && (
|
{props.ReportName === "Templates" && (
|
||||||
<div className="flex flex-row">
|
<div className="flex flex-row">
|
||||||
<label
|
<label className="cursor-pointer relative inline-flex items-center mb-0">
|
||||||
className={
|
|
||||||
"cursor-pointer relative inline-flex items-center mb-0"
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<input
|
<input
|
||||||
checked={props.isPublic?.[item.objectId]}
|
checked={props.isPublic?.[item.objectId]}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
@@ -1352,22 +1452,27 @@ const ReportTable = (props) => {
|
|||||||
<ModalUi
|
<ModalUi
|
||||||
isOpen
|
isOpen
|
||||||
title={t("public-url")}
|
title={t("public-url")}
|
||||||
handleClose={() => setIsPublicProfile({})}
|
handleClose={() => {
|
||||||
|
setIsPublicProfile({});
|
||||||
|
setIsEmbed(false);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<div className="m-[20px]">
|
<div className="m-[20px]">
|
||||||
{publicUserName ? (
|
{isEmbed && !item?.IsPublic ? (
|
||||||
|
<>
|
||||||
|
<p>{t("public-template-mssg-6")}</p>
|
||||||
|
<EmbedTab templateId={item.objectId} />
|
||||||
|
</>
|
||||||
|
) : publicUserName ? (
|
||||||
<div className="font-normal text-black">
|
<div className="font-normal text-black">
|
||||||
<p>{t("public-url-copy-mssg")}</p>
|
<span>{t("public-url-copy")}</span>
|
||||||
<div className=" flex items-center justify-between gap-3 mt-2 p-[2px] ">
|
<div className=" flex items-center justify-between gap-3 p-[2px] ">
|
||||||
<div className="w-[280px] whitespace-nowrap overflow-hidden text-ellipsis">
|
<div className="w-[280px] whitespace-nowrap overflow-hidden text-ellipsis">
|
||||||
<span className="font-bold">
|
|
||||||
{t("public-url")} :
|
|
||||||
</span>
|
|
||||||
<span
|
<span
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
copytoProfileLink()
|
copytoProfileLink()
|
||||||
}
|
}
|
||||||
className="ml-[2px] underline underline-offset-2 cursor-pointer"
|
className="ml-[2px] underline underline-offset-2 cursor-pointer text-blue-800"
|
||||||
>
|
>
|
||||||
{publicUrl()}
|
{publicUrl()}
|
||||||
</span>
|
</span>
|
||||||
@@ -1392,7 +1497,7 @@ const ReportTable = (props) => {
|
|||||||
copytoProfileLink()
|
copytoProfileLink()
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<i className="fa-light fa-link"></i>{" "}
|
<i className="fa-light fa-copy" />
|
||||||
<span className="hidden md:inline-block">
|
<span className="hidden md:inline-block">
|
||||||
{copied["publicprofile"]
|
{copied["publicprofile"]
|
||||||
? t("copied")
|
? t("copied")
|
||||||
@@ -1401,36 +1506,10 @@ const ReportTable = (props) => {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className=" flex items-center justify-between gap-3 mt-2 p-[2px] ">
|
<p className="text-[13px] mt-[5px]">
|
||||||
<div>
|
{t("public-url-copy-mssg")}
|
||||||
<span className="font-bold">
|
</p>
|
||||||
{t("templateid")} :
|
<EmbedTab templateId={item.objectId} />
|
||||||
</span>
|
|
||||||
<span
|
|
||||||
onClick={() =>
|
|
||||||
copyTemplateId(item.objectId)
|
|
||||||
}
|
|
||||||
className="underline ml-[2px] underline-offset-2 w-[150px] md:w-[350px] whitespace-nowrap overflow-hidden text-ellipsis cursor-pointer"
|
|
||||||
>
|
|
||||||
{item.objectId}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<button
|
|
||||||
className="op-btn op-btn-primary op-btn-outline op-btn-xs md:op-btn-sm"
|
|
||||||
onClick={() =>
|
|
||||||
copyTemplateId(item.objectId)
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<i className="fa-light fa-link"></i>{" "}
|
|
||||||
<span className="hidden md:inline-block">
|
|
||||||
{copied["templateid"]
|
|
||||||
? t("copied")
|
|
||||||
: t("copy")}
|
|
||||||
</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="font-normal text-black">
|
<div className="font-normal text-black">
|
||||||
@@ -1449,7 +1528,7 @@ const ReportTable = (props) => {
|
|||||||
</td>
|
</td>
|
||||||
)}
|
)}
|
||||||
<td className="px-2 py-2">
|
<td className="px-2 py-2">
|
||||||
<div className="text-base-content flex flex-row gap-x-2 gap-y-1 justify-start items-center">
|
<div className="text-base-content min-w-max flex flex-row gap-x-2 gap-y-1 justify-start items-center">
|
||||||
{props.actions?.length > 0 &&
|
{props.actions?.length > 0 &&
|
||||||
props.actions.map((act, index) =>
|
props.actions.map((act, index) =>
|
||||||
props.ReportName === "Templates" ? (
|
props.ReportName === "Templates" ? (
|
||||||
@@ -1490,65 +1569,33 @@ const ReportTable = (props) => {
|
|||||||
{isOption[item.objectId] &&
|
{isOption[item.objectId] &&
|
||||||
act.action === "option" && (
|
act.action === "option" && (
|
||||||
<ul className="absolute -right-1 top-auto z-[70] w-max op-dropdown-content op-menu shadow bg-base-100 text-base-content rounded-box">
|
<ul className="absolute -right-1 top-auto z-[70] w-max op-dropdown-content op-menu shadow bg-base-100 text-base-content rounded-box">
|
||||||
{act.subaction?.map((subact) =>
|
{act.subaction?.map((subact) => (
|
||||||
props.isPublic[
|
<li
|
||||||
item.objectId
|
key={subact.btnId}
|
||||||
] ? (
|
onClick={() =>
|
||||||
<li
|
handleActionBtn(
|
||||||
key={subact.btnId}
|
subact,
|
||||||
onClick={() =>
|
item
|
||||||
handleActionBtn(
|
)
|
||||||
subact,
|
}
|
||||||
item
|
title={t(
|
||||||
)
|
`btnLabel.${subact.btnLabel}`
|
||||||
}
|
)}
|
||||||
title={t(
|
>
|
||||||
`btnLabel.${subact.btnLabel}`
|
<span>
|
||||||
)}
|
<i
|
||||||
>
|
className={`${subact.btnIcon} mr-1.5`}
|
||||||
<span>
|
></i>
|
||||||
<i
|
{subact.btnLabel && (
|
||||||
className={`${subact.btnIcon} mr-1.5`}
|
<span className="text-[13px] capitalize font-medium">
|
||||||
></i>
|
{t(
|
||||||
{subact.btnLabel && (
|
`btnLabel.${subact.btnLabel}`
|
||||||
<span className="text-[13px] capitalize font-medium">
|
|
||||||
{t(
|
|
||||||
`btnLabel.${subact.btnLabel}`
|
|
||||||
)}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</span>
|
|
||||||
</li>
|
|
||||||
) : (
|
|
||||||
subact.action !== "Embed" && (
|
|
||||||
<li
|
|
||||||
key={subact.btnId}
|
|
||||||
onClick={() =>
|
|
||||||
handleActionBtn(
|
|
||||||
subact,
|
|
||||||
item
|
|
||||||
)
|
|
||||||
}
|
|
||||||
title={t(
|
|
||||||
`btnLabel.${subact.btnLabel}`
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<span>
|
|
||||||
<i
|
|
||||||
className={`${subact.btnIcon} mr-1.5`}
|
|
||||||
></i>
|
|
||||||
{subact.btnLabel && (
|
|
||||||
<span className="text-[13px] capitalize font-medium">
|
|
||||||
{t(
|
|
||||||
`btnLabel.${subact.btnLabel}`
|
|
||||||
)}
|
|
||||||
</span>
|
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
)}
|
||||||
)
|
</span>
|
||||||
)
|
</li>
|
||||||
)}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -1869,7 +1916,7 @@ const ReportTable = (props) => {
|
|||||||
className="op-btn op-btn-primary op-btn-outline op-btn-xs md:op-btn-sm"
|
className="op-btn op-btn-primary op-btn-outline op-btn-xs md:op-btn-sm"
|
||||||
onClick={() => copytoclipboard(share)}
|
onClick={() => copytoclipboard(share)}
|
||||||
>
|
>
|
||||||
<i className="fa-light fa-link"></i>{" "}
|
<i className="fa-light fa-copy" />
|
||||||
{copied[share.email]
|
{copied[share.email]
|
||||||
? t("copied")
|
? t("copied")
|
||||||
: t("copy")}
|
: t("copy")}
|
||||||
@@ -2023,6 +2070,14 @@ const ReportTable = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
</ModalUi>
|
</ModalUi>
|
||||||
)}
|
)}
|
||||||
|
{isDownloadModal[item.objectId] && (
|
||||||
|
<DownloadPdfZip
|
||||||
|
setIsDownloadModal={setIsDownloadModal}
|
||||||
|
isDownloadModal={isDownloadModal[item.objectId]}
|
||||||
|
pdfDetails={[item]}
|
||||||
|
isDocId={false}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ function CustomModal(props) {
|
|||||||
className="op-btn op-btn-primary mr-2 px-6"
|
className="op-btn op-btn-primary mr-2 px-6"
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setReason("");
|
|
||||||
props.declineDoc(reason);
|
props.declineDoc(reason);
|
||||||
|
setReason("");
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t("yes")}
|
{t("yes")}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export default function TourContentWithBtn({ message, isChecked, video }) {
|
|||||||
></iframe>
|
></iframe>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<label className="flex items-center justify-center mb-0">
|
<label className="flex items-center justify-center mt-3 mb-0">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
className="op-checkbox op-checkbox-xs mr-1"
|
className="op-checkbox op-checkbox-xs mr-1"
|
||||||
|
|||||||
@@ -11,28 +11,37 @@ import { isPublicStaging } from "../constant/const";
|
|||||||
pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.min.mjs`;
|
pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.min.mjs`;
|
||||||
|
|
||||||
// Wrapper component to manage props
|
// Wrapper component to manage props
|
||||||
const PublicScriptFileWrapper = ({ initialProps }) => {
|
const PublicScriptFileWrapper = () => {
|
||||||
const [props, setProps] = useState(initialProps);
|
const [props, setProps] = useState("");
|
||||||
|
|
||||||
// Make the setProps function globally accessible
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// Assigns the function 'setProps' to the global 'window' object as 'updatePublicTemplateProps'.
|
||||||
|
// This allows 'setProps' to be accessed and called globally across different scripts or components,
|
||||||
|
// enabling dynamic updates to the public template's properties.
|
||||||
window.updatePublicTemplateProps = setProps;
|
window.updatePublicTemplateProps = setProps;
|
||||||
|
const publicScript = document.getElementById("opensign-script");
|
||||||
|
// condition for using plan js load opensign-script then get templateId
|
||||||
|
if (publicScript) {
|
||||||
|
// Get the custom templateId attribute
|
||||||
|
const templateId = publicScript.getAttribute("templateId");
|
||||||
|
if (templateId) {
|
||||||
|
setProps({ templateId: templateId });
|
||||||
|
} else {
|
||||||
|
const error = "error: TemplateId is missing";
|
||||||
|
throw new Error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
return () => {
|
return () => {
|
||||||
window.updatePublicTemplateProps = undefined;
|
window.updatePublicTemplateProps = undefined;
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return <PdfRequestFiles {...props} />;
|
return <PdfRequestFiles {...props} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
const appId = isPublicStaging ? "opensign" : "legadranaxn";
|
const appId = isPublicStaging ? "opensign" : "legadranaxn";
|
||||||
//"opensign"
|
|
||||||
|
|
||||||
const serverUrl = isPublicStaging
|
const serverUrl = isPublicStaging
|
||||||
? "https://staging-app.opensignlabs.com/api/app"
|
? "https://staging-app.opensignlabs.com/api/app"
|
||||||
: "https://app.opensignlabs.com/api/app";
|
: "https://app.opensignlabs.com/api/app";
|
||||||
// "https://staging-app.opensignlabs.com/api/app"
|
|
||||||
|
|
||||||
localStorage.setItem("baseUrl", `${serverUrl}/`);
|
localStorage.setItem("baseUrl", `${serverUrl}/`);
|
||||||
localStorage.setItem("parseAppId", appId);
|
localStorage.setItem("parseAppId", appId);
|
||||||
@@ -58,7 +67,7 @@ const root = ReactDOM.createRoot(document.getElementById("script-component"));
|
|||||||
root.render(
|
root.render(
|
||||||
<div data-theme="opensigncss">
|
<div data-theme="opensigncss">
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<PublicScriptFileWrapper initialProps={{ text: "templateId" }} />
|
<PublicScriptFileWrapper />
|
||||||
</Provider>
|
</Provider>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -131,7 +131,8 @@
|
|||||||
"Share": "Share",
|
"Share": "Share",
|
||||||
"View": "View",
|
"View": "View",
|
||||||
"option": "Option",
|
"option": "Option",
|
||||||
"Embed": "Embed"
|
"Embed": "Embed",
|
||||||
|
"Copy TemplateId":"Copy TemplateId"
|
||||||
},
|
},
|
||||||
"report-heading": {
|
"report-heading": {
|
||||||
"Sr.No": "Sr.No",
|
"Sr.No": "Sr.No",
|
||||||
@@ -151,7 +152,8 @@
|
|||||||
"Name": "Name",
|
"Name": "Name",
|
||||||
"Status": "Status",
|
"Status": "Status",
|
||||||
"created-date": "Created Date",
|
"created-date": "Created Date",
|
||||||
"Type": "Type"
|
"Type": "Type",
|
||||||
|
"Logs": "Logs"
|
||||||
},
|
},
|
||||||
"report-help": {
|
"report-help": {
|
||||||
"Draft Documents": "These are documents you have started but have not finalized for sending.",
|
"Draft Documents": "These are documents you have started but have not finalized for sending.",
|
||||||
@@ -263,7 +265,8 @@
|
|||||||
"make-template-private-alert": "Are you sure you want to make this template private? This will remove it from your public profile.",
|
"make-template-private-alert": "Are you sure you want to make this template private? This will remove it from your public profile.",
|
||||||
"public-role": "Public role",
|
"public-role": "Public role",
|
||||||
"public-url": "Public URL",
|
"public-url": "Public URL",
|
||||||
"public-url-copy-mssg": " Here’s your public URL: Copy it or share it with the signer, and you will be able to see all your publicly set templates.",
|
"public-url-copy": "Here’s your public URL: ",
|
||||||
|
"public-url-copy-mssg":"Copy it or share it with the signer, and you will be able to see all your publicly set templates.",
|
||||||
"add-public-url-alert": "Please add your public URL, and you will be able to make a public template.",
|
"add-public-url-alert": "Please add your public URL, and you will be able to make a public template.",
|
||||||
"share-with-alert": "You cannot share a template if any roles already have contacts assigned. Please remove all contact assignments from the roles before sharing the template.",
|
"share-with-alert": "You cannot share a template if any roles already have contacts assigned. Please remove all contact assignments from the roles before sharing the template.",
|
||||||
"share-with": "Share with",
|
"share-with": "Share with",
|
||||||
@@ -572,9 +575,10 @@
|
|||||||
"pdf-request-file-5": "You can click 'Auto Sign All' to automatically sign at all the locations meant to be signed by you. Make sure that you review the document properly before you click this button .",
|
"pdf-request-file-5": "You can click 'Auto Sign All' to automatically sign at all the locations meant to be signed by you. Make sure that you review the document properly before you click this button .",
|
||||||
"placeholder-sign-1": "Select a recipient from this list to add a place-holder where he is supposed to sign.The placeholder will appear in the same colour as the recipient name once you drop it on the document.",
|
"placeholder-sign-1": "Select a recipient from this list to add a place-holder where he is supposed to sign.The placeholder will appear in the same colour as the recipient name once you drop it on the document.",
|
||||||
"placeholder-sign-2": "Clicking 'Add recipients' button will allow you to add more signers.",
|
"placeholder-sign-2": "Clicking 'Add recipients' button will allow you to add more signers.",
|
||||||
"placeholder-sign-3": "Drag or click on a field to add it to the document.",
|
"placeholder-sign-3": "Click this button to add more recipients/signers to the document.",
|
||||||
"placeholder-sign-4": "The PDF content area already displays the template's existing placeholders. For your convenience, these placeholders will match the color of the recipient's name, making them easily identifiable.",
|
"placeholder-sign-4": "Drag or click on a field to add it to the document.",
|
||||||
"placeholder-sign-5": "Clicking 'Send' will save the document. In the next step you can customize the emails to be sent out to the recipients or copy the signing links and share those with the recipients yourself.",
|
"placeholder-sign-5": "The PDF content area already displays the template's existing placeholders. For your convenience, these placeholders will match the color of the recipient's name, making them easily identifiable.",
|
||||||
|
"placeholder-sign-6": "Clicking 'Send' will save the document. In the next step you can customize the emails to be sent out to the recipients or copy the signing links and share those with the recipients yourself.",
|
||||||
"report-1": "Click the 'Add' button to create a new template. Templates are reusable documents designed to quickly generate new documents with the same structure and varying signers. For example, an HR template for onboarding could have predefined roles like ‘HR Manager’ and ‘New Employee’. Each time you use the template, you can assign the ‘New Employee’ role to different incoming staff members, while the ‘HR Manager’ role remains constant, facilitating a seamless onboarding process for each recruit. ",
|
"report-1": "Click the 'Add' button to create a new template. Templates are reusable documents designed to quickly generate new documents with the same structure and varying signers. For example, an HR template for onboarding could have predefined roles like ‘HR Manager’ and ‘New Employee’. Each time you use the template, you can assign the ‘New Employee’ role to different incoming staff members, while the ‘HR Manager’ role remains constant, facilitating a seamless onboarding process for each recruit. ",
|
||||||
"redirect": "Click the 'Use' button to create a new document from an existing template.",
|
"redirect": "Click the 'Use' button to create a new document from an existing template.",
|
||||||
"bulksend": "To quickly create and send multiple documents using an existing template, click the 'Quick Send' button.",
|
"bulksend": "To quickly create and send multiple documents using an existing template, click the 'Quick Send' button.",
|
||||||
@@ -593,7 +597,7 @@
|
|||||||
"Recently sent for signatures": "This is a list of documents you've sent to other parties for signature.",
|
"Recently sent for signatures": "This is a list of documents you've sent to other parties for signature.",
|
||||||
"Drafts": "This are documents you have started but have not finalized for sending.",
|
"Drafts": "This are documents you have started but have not finalized for sending.",
|
||||||
"public-template": "This video demonstrates how to set up your personalized public profile, such as ‘https://opensign.me/your-username’. You’ll also learn how to customize your tagline and make your templates available for public signing."
|
"public-template": "This video demonstrates how to set up your personalized public profile, such as ‘https://opensign.me/your-username’. You’ll also learn how to customize your tagline and make your templates available for public signing."
|
||||||
},
|
},
|
||||||
"enter-email-plaholder": "Add an email address and hit enter",
|
"enter-email-plaholder": "Add an email address and hit enter",
|
||||||
"success-email-alert": "Email sent successfully!",
|
"success-email-alert": "Email sent successfully!",
|
||||||
"expired-doc-title": "Expired Document",
|
"expired-doc-title": "Expired Document",
|
||||||
@@ -627,6 +631,22 @@
|
|||||||
"regenerate-test-token":"Regenerate Test Token",
|
"regenerate-test-token":"Regenerate Test Token",
|
||||||
"help-test-token":"This token can be used to test the APIs at the https://sandbox.opensignlabs.com/api/v1 endpoint, allowing you to conduct unlimited document signatures. Please note that the sandbox API will sign your documents with self-signed certificates, which may not be recognized as valid by Adobe. Once you’ve completed your testing, you can upgrade to one of our paid plans to generate a production token.",
|
"help-test-token":"This token can be used to test the APIs at the https://sandbox.opensignlabs.com/api/v1 endpoint, allowing you to conduct unlimited document signatures. Please note that the sandbox API will sign your documents with self-signed certificates, which may not be recognized as valid by Adobe. Once you’ve completed your testing, you can upgrade to one of our paid plans to generate a production token.",
|
||||||
"help-api-token":"This token can be used to access the production APIs at the {{origin}}/api/v1 endpoint. It can only be generated on one of our paid plans.",
|
"help-api-token":"This token can be used to access the production APIs at the {{origin}}/api/v1 endpoint. It can only be generated on one of our paid plans.",
|
||||||
|
"reason":"Reason",
|
||||||
|
"decline-by":"Declined/revoked by",
|
||||||
|
"document-declined": "Document declined",
|
||||||
|
"public-template-mssg-1":"To integrate OpenSign into your React or Next.js project, simply run the following command:",
|
||||||
|
"public-template-mssg-2" :"Ensure you have npm or yarn set up in your project. If you’re using Yarn, you can replace npm install with yarn add @opensign/react.",
|
||||||
|
"public-template-mssg-3" :"Need more details or examples?",
|
||||||
|
"public-template-mssg-4": "Visit the",
|
||||||
|
"public-template-mssg-5": " npm for the latest updates, detailed documentation, and version history.",
|
||||||
|
"public-template-mssg-6" :"You need to set this template as public before you can utilize this code snippet.",
|
||||||
|
"copy-code":"COPY",
|
||||||
|
"copied-code":"COPIED",
|
||||||
|
"Installation":"Installation",
|
||||||
|
"Usage" :"Usage",
|
||||||
|
"insufficient-credits":"Insufficient Signing Credits",
|
||||||
|
"insufficient-credits-mssg":"The owner of this document currently lacks the necessary OpenSign credits for you to sign. Please reach out to the owner if you require further details.",
|
||||||
|
"angular-npm-mssg-1": "To integrate OpenSign into your Angular project, simply run the following command:",
|
||||||
"quota-mail-info-head":"Monthly request signatures email limit",
|
"quota-mail-info-head":"Monthly request signatures email limit",
|
||||||
"quota-mail-info": "You can send upto 15 signature request emails every month. Upgrade now to send unlimited signing requests directly.",
|
"quota-mail-info": "You can send upto 15 signature request emails every month. Upgrade now to send unlimited signing requests directly.",
|
||||||
"quota-mail": "You've reached your limit of 15 signature request emails for this month. Upgrade now to continue sending emails directly.",
|
"quota-mail": "You've reached your limit of 15 signature request emails for this month. Upgrade now to continue sending emails directly.",
|
||||||
@@ -635,6 +655,18 @@
|
|||||||
"unauthorized-modal":"You don't have permission to perform this action, please contact {{adminEmail}}.",
|
"unauthorized-modal":"You don't have permission to perform this action, please contact {{adminEmail}}.",
|
||||||
"sent-this-month":"Sent this month",
|
"sent-this-month":"Sent this month",
|
||||||
"available-seats":"Available seats",
|
"available-seats":"Available seats",
|
||||||
"buy-users":"Buy more users"
|
"buy-users":"Buy more users",
|
||||||
|
"isenable-otp": "Enable OTP verification",
|
||||||
|
"isenable-otp-help": {
|
||||||
|
"p1": "Would you like to enable the verification process using a one-time password (OTP)?",
|
||||||
|
"p2": "Selecting this option will enable OTP verification. Users will receive a verification code via email, which they must enter to sign the document.",
|
||||||
|
"p3": "Selecting this option will disable OTP verification, allowing users to sign the document directly without additional steps.",
|
||||||
|
"p4": "Please choose the option that best suits your document signing requirements."
|
||||||
|
},
|
||||||
|
"advanced-options":"Advanced options",
|
||||||
|
"hide-advanced-options":"Hide Advanced options",
|
||||||
|
"download-files":"Download files",
|
||||||
|
"download-pdf":"Download Pdf",
|
||||||
|
"pdf-certificate":"Download Pdf + Certificate",
|
||||||
|
"document-logs":"Document logs"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,7 +136,8 @@
|
|||||||
"Name": "Nom",
|
"Name": "Nom",
|
||||||
"Status": "Statut",
|
"Status": "Statut",
|
||||||
"created-date": "Date de création",
|
"created-date": "Date de création",
|
||||||
"Type": "Saisir"
|
"Type": "Saisir",
|
||||||
|
"Logs": "Journaux"
|
||||||
},
|
},
|
||||||
"btnLabel": {
|
"btnLabel": {
|
||||||
"sign": "Signer",
|
"sign": "Signer",
|
||||||
@@ -150,7 +151,8 @@
|
|||||||
"Share": "Partager",
|
"Share": "Partager",
|
||||||
"View": "Voir",
|
"View": "Voir",
|
||||||
"option": "Option",
|
"option": "Option",
|
||||||
"Embed": "Intégrer"
|
"Embed": "Intégrer",
|
||||||
|
"Copy TemplateId": "Copier l'ID du modèle"
|
||||||
},
|
},
|
||||||
"report-help": {
|
"report-help": {
|
||||||
"Draft Documents": "Il s'agit de documents que vous avez commencés mais que vous n'avez pas finalisés pour envoi.",
|
"Draft Documents": "Il s'agit de documents que vous avez commencés mais que vous n'avez pas finalisés pour envoi.",
|
||||||
@@ -262,7 +264,8 @@
|
|||||||
"make-template-private-alert": "Êtes-vous sûr de vouloir rendre ce modèle privé ? Cela le supprimera de votre profil public.",
|
"make-template-private-alert": "Êtes-vous sûr de vouloir rendre ce modèle privé ? Cela le supprimera de votre profil public.",
|
||||||
"public-role": "Rôle public",
|
"public-role": "Rôle public",
|
||||||
"public-url": "URL publique",
|
"public-url": "URL publique",
|
||||||
"public-url-copy-mssg": "Voici votre URL publique : copiez-la ou partagez-le avec le signataire et vous pouvoir voir tous vos paramètres publics modèles.",
|
"public-url-copy": "Voici votre URL publique : ",
|
||||||
|
"public-url-copy-mssg": "copiez-la ou partagez-le avec le signataire et vous pouvoir voir tous vos paramètres publics modèles.",
|
||||||
"add-public-url-alert": "Veuillez ajouter votre URL publique et vous pourra rendre public modèle.",
|
"add-public-url-alert": "Veuillez ajouter votre URL publique et vous pourra rendre public modèle.",
|
||||||
"share-with-alert": "Vous ne pouvez pas partager un modèle si des contacts sont déjà attribués à des rôles. Veuillez supprimer toutes les attributions de contacts des rôles avant de partager le modèle.",
|
"share-with-alert": "Vous ne pouvez pas partager un modèle si des contacts sont déjà attribués à des rôles. Veuillez supprimer toutes les attributions de contacts des rôles avant de partager le modèle.",
|
||||||
"share-with": "Partager avec",
|
"share-with": "Partager avec",
|
||||||
@@ -571,9 +574,10 @@
|
|||||||
"pdf-request-file-5": "Vous pouvez cliquer sur 'Signer automatiquement tout' pour signer automatiquement à tous les emplacements que vous êtes censé signer. Assurez-vous de lire correctement le document avant de cliquer sur ce bouton.",
|
"pdf-request-file-5": "Vous pouvez cliquer sur 'Signer automatiquement tout' pour signer automatiquement à tous les emplacements que vous êtes censé signer. Assurez-vous de lire correctement le document avant de cliquer sur ce bouton.",
|
||||||
"placeholder-sign-1": "Sélectionnez un destinataire dans cette liste pour ajouter un espace réservé à l'endroit où il est censé signer. L'espace réservé apparaîtra de la même couleur que le nom du destinataire une fois que vous le déposerez sur le document.",
|
"placeholder-sign-1": "Sélectionnez un destinataire dans cette liste pour ajouter un espace réservé à l'endroit où il est censé signer. L'espace réservé apparaîtra de la même couleur que le nom du destinataire une fois que vous le déposerez sur le document.",
|
||||||
"placeholder-sign-2": "Cliquer sur le bouton 'Ajouter des destinataires' vous permettra d'ajouter plus de signataires.",
|
"placeholder-sign-2": "Cliquer sur le bouton 'Ajouter des destinataires' vous permettra d'ajouter plus de signataires.",
|
||||||
"placeholder-sign-3": "Faites glisser ou cliquez sur un champ pour l'ajouter au document.",
|
"placeholder-sign-3": "Cliquez sur ce bouton pour ajouter plus de destinataires/signataires au document",
|
||||||
"placeholder-sign-4": "La zone de contenu PDF affiche déjà les espaces réservés existants du modèle. Pour votre commodité, ces espaces réservés correspondront à la couleur du nom du destinataire, ce qui les rendra facilement identifiables.",
|
"placeholder-sign-4": "Faites glisser ou cliquez sur un champ pour l'ajouter au document.",
|
||||||
"placeholder-sign-5": "Cliquer sur 'Envoyer' enregistrera le document. À l'étape suivante, vous pourrez personnaliser les e-mails à envoyer aux destinataires ou copier les liens de signature et les partager vous-même avec les destinataires.",
|
"placeholder-sign-5": "La zone de contenu PDF affiche déjà les espaces réservés existants du modèle. Pour votre commodité, ces espaces réservés correspondront à la couleur du nom du destinataire, ce qui les rendra facilement identifiables.",
|
||||||
|
"placeholder-sign-6": "Cliquer sur 'Envoyer' enregistrera le document. À l'étape suivante, vous pourrez personnaliser les e-mails à envoyer aux destinataires ou copier les liens de signature et les partager vous-même avec les destinataires.",
|
||||||
"report-1": "Cliquez sur le bouton 'Ajouter' pour créer un nouveau modèle. Les modèles sont des documents réutilisables conçus pour générer rapidement de nouveaux documents avec la même structure et différents signataires. Par exemple, un modèle RH pour l'intégration peut avoir des rôles prédéfinis tels que 'Responsable RH' et ' Nouvel employé'. Chaque fois que vous utilisez le modèle, vous pouvez attribuer le rôle 'Nouvel employé' à différents membres du personnel entrants, tandis que le rôle 'Responsable RH' reste constant, facilitant ainsi un processus d'intégration fluide pour chaque recrue",
|
"report-1": "Cliquez sur le bouton 'Ajouter' pour créer un nouveau modèle. Les modèles sont des documents réutilisables conçus pour générer rapidement de nouveaux documents avec la même structure et différents signataires. Par exemple, un modèle RH pour l'intégration peut avoir des rôles prédéfinis tels que 'Responsable RH' et ' Nouvel employé'. Chaque fois que vous utilisez le modèle, vous pouvez attribuer le rôle 'Nouvel employé' à différents membres du personnel entrants, tandis que le rôle 'Responsable RH' reste constant, facilitant ainsi un processus d'intégration fluide pour chaque recrue",
|
||||||
"redirect": "Cliquez sur le bouton 'Utiliser' pour créer un nouveau document à partir d'un modèle existant.",
|
"redirect": "Cliquez sur le bouton 'Utiliser' pour créer un nouveau document à partir d'un modèle existant.",
|
||||||
"bulksend": "Pour créer et envoyer rapidement plusieurs documents à l'aide d'un modèle existant, cliquez sur le bouton 'Envoi rapide'.",
|
"bulksend": "Pour créer et envoyer rapidement plusieurs documents à l'aide d'un modèle existant, cliquez sur le bouton 'Envoi rapide'.",
|
||||||
@@ -626,14 +630,43 @@
|
|||||||
"regenerate-test-token":"Régénérer le jeton de test",
|
"regenerate-test-token":"Régénérer le jeton de test",
|
||||||
"help-test-token":"Ce jeton peut être utilisé pour tester les API au niveau du point de terminaison https://sandbox.opensignlabs.com/api/v1, vous permettant ainsi d'effectuer un nombre illimité de signatures de documents. Veuillez noter que l'API sandbox signera vos documents avec des certificats auto-signés, qui peuvent ne pas être reconnus comme valides par Adobe. Une fois vos tests terminés, vous pouvez passer à l’un de nos forfaits payants pour générer un jeton de production.",
|
"help-test-token":"Ce jeton peut être utilisé pour tester les API au niveau du point de terminaison https://sandbox.opensignlabs.com/api/v1, vous permettant ainsi d'effectuer un nombre illimité de signatures de documents. Veuillez noter que l'API sandbox signera vos documents avec des certificats auto-signés, qui peuvent ne pas être reconnus comme valides par Adobe. Une fois vos tests terminés, vous pouvez passer à l’un de nos forfaits payants pour générer un jeton de production.",
|
||||||
"help-api-token":"Ce jeton peut être utilisé pour accéder aux API de production au point de terminaison {{origin}}/api/v1. Il ne peut être généré que sur l'un de nos forfaits payants.",
|
"help-api-token":"Ce jeton peut être utilisé pour accéder aux API de production au point de terminaison {{origin}}/api/v1. Il ne peut être généré que sur l'un de nos forfaits payants.",
|
||||||
|
"reason" :"Raison",
|
||||||
|
"decline-by" :"Refusé/révoqué par",
|
||||||
|
"document-declined":"document refusé",
|
||||||
|
"public-template-mssg-1" :"Pour intégrer OpenSign dans votre projet React ou Next.js, exécutez simplement la commande suivante :",
|
||||||
|
"public-template-mssg-2" :"Assurez-vous que npm ou Yarn est configuré dans votre projet. Si vous utilisez Yarn, vous pouvez remplacer npm install par Yarn Add @opensign/react.",
|
||||||
|
"public-template-mssg-3" :"Besoin de plus de détails ou d'exemples ?",
|
||||||
|
"public-template-mssg-4": "Visitez le",
|
||||||
|
"public-template-mssg-5": "npm pour les dernières mises à jour, une documentation détaillée et l'historique des versions.",
|
||||||
|
"public-template-mssg-6":"Vous devez définir ce modèle comme public avant de pouvoir utiliser cet extrait de code.",
|
||||||
|
"copy-code":"COPIE",
|
||||||
|
"copied-code":"COPIÉ",
|
||||||
|
"Installation":"Installation",
|
||||||
|
"Usage" :"Usage",
|
||||||
|
"insufficient-credits":"Crédits de signature insuffisants",
|
||||||
|
"insufficient-credits-mssg" :"Le propriétaire de ce document ne dispose actuellement pas des crédits OpenSign nécessaires pour que vous puissiez le signer. Veuillez contacter le propriétaire si vous avez besoin de plus de détails.",
|
||||||
|
"angular-npm-mssg-1" :"Pour intégrer OpenSign dans votre projet Angular, exécutez simplement la commande suivante :",
|
||||||
"quota-mail-info-head":"Limite mensuelle d'e-mails de signatures de demandes",
|
"quota-mail-info-head":"Limite mensuelle d'e-mails de signatures de demandes",
|
||||||
"quota-mail-info": "Vous pouvez envoyer jusqu'à 15 e-mails de demande de signature chaque mois. Mettez à niveau maintenant pour envoyer directement des demandes de signature illimitées.",
|
"quota-mail-info": "Vous pouvez envoyer jusqu'à 15 e-mails de demande de signature chaque mois. Mettez à niveau maintenant pour envoyer directement des demandes de signature illimitées.",
|
||||||
"quota-mail": "Vous avez atteint votre limite de 15 e-mails de demande de signature pour ce mois. Mettez à niveau maintenant pour continuer à envoyer des e-mails directement.",
|
"quota-mail": "Vous avez atteint votre limite de 15 e-mails de demande de signature pour ce mois. Mettez à niveau maintenant pour continuer à envoyer des e-mails directement.",
|
||||||
"quota-mail-tip":"Astuce : Vous pouvez toujours signer un nombre <1>illimité de documents</1> en partageant manuellement les liens de demande de signature.",
|
"quota-mail-tip-tip":"Astuce : Vous pouvez toujours signer un nombre <1>illimité de documents</1> en partageant manuellement les liens de demande de signature.",
|
||||||
"quota-mail-head":"Quota atteint",
|
"quota-mail-head":"Quota atteint",
|
||||||
"unauthorized-modal":"Vous n'êtes pas autorisé à effectuer cette action, veuillez contacter {{adminEmail}}.",
|
"unauthorized-modal":"Vous n'êtes pas autorisé à effectuer cette action, veuillez contacter {{adminEmail}}.",
|
||||||
"sent-this-month":"envoyé ce mois-ci",
|
"sent-this-month":"envoyé ce mois-ci",
|
||||||
"available-seats":"Disponible sièges",
|
"available-seats":"Disponible sièges",
|
||||||
"buy-users":"Acheter plus d'utilisateurs"
|
"buy-users":"Acheter plus d'utilisateurs",
|
||||||
|
"isenable-otp": "Activer la vérification OTP",
|
||||||
|
"isenable-otp-help": {
|
||||||
|
"p1": "Souhaitez-vous activer le processus de vérification à l'aide d'un mot de passe à usage unique (OTP)?",
|
||||||
|
"p2": "La sélection de cette option activera la vérification OTP. Les utilisateurs recevront un code de vérification par e-mail, qu'ils devront saisir pour signer le document.",
|
||||||
|
"p3": "La sélection de cette option désactivera la vérification OTP, permettant aux utilisateurs de signer le document directement sans étapes supplémentaires.",
|
||||||
|
"p4": "Veuillez choisir l'option qui correspond le mieux à vos exigences en matière de signature de documents."
|
||||||
|
},
|
||||||
|
"advanced-options":"Options avancées",
|
||||||
|
"hide-advanced-options": "Masquer les options avancées",
|
||||||
|
"download-files" :"Télécharger des fichiers",
|
||||||
|
"download-pdf" :"Télécharger le PDF",
|
||||||
|
"pdf-certificate" :"Télécharger Pdf + Certificat",
|
||||||
|
"document-logs":"Journaux de documents"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import dotenv from 'dotenv';
|
|||||||
dotenv.config();
|
dotenv.config();
|
||||||
|
|
||||||
export const cloudServerUrl = 'http://localhost:8080/app';
|
export const cloudServerUrl = 'http://localhost:8080/app';
|
||||||
|
export const appName = process.env.APP_NAME || 'OpenSign™';
|
||||||
export function customAPIurl() {
|
export function customAPIurl() {
|
||||||
const url = new URL(cloudServerUrl);
|
const url = new URL(cloudServerUrl);
|
||||||
return url.pathname === '/api/app' ? url.origin + '/api' : url.origin;
|
return url.pathname === '/api/app' ? url.origin + '/api' : url.origin;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import saveInvoice from './saveInvoice.js';
|
|||||||
import savePayments from './savePayments.js';
|
import savePayments from './savePayments.js';
|
||||||
import gooogleauth from './googleauth.js';
|
import gooogleauth from './googleauth.js';
|
||||||
import autoReminder from './autoReminder.js';
|
import autoReminder from './autoReminder.js';
|
||||||
|
import validateSmtp from './validateSmtp.js';
|
||||||
export const app = express();
|
export const app = express();
|
||||||
|
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
@@ -22,3 +23,4 @@ app.post('/saveinvoice', saveInvoice);
|
|||||||
app.post('/savepayment', savePayments);
|
app.post('/savepayment', savePayments);
|
||||||
app.post('/googleauth', gooogleauth);
|
app.post('/googleauth', gooogleauth);
|
||||||
app.post('/sendreminder', autoReminder);
|
app.post('/sendreminder', autoReminder);
|
||||||
|
app.post('/validatesmtp', validateSmtp);
|
||||||
|
|||||||
@@ -196,6 +196,9 @@ export default async function createDocumentWithTemplate(request, response) {
|
|||||||
if (TimeToCompleteDays) {
|
if (TimeToCompleteDays) {
|
||||||
object.set('TimeToCompleteDays', TimeToCompleteDays);
|
object.set('TimeToCompleteDays', TimeToCompleteDays);
|
||||||
}
|
}
|
||||||
|
const enableOTP = request.body?.enableOTP === true ? true : false;
|
||||||
|
const IsEnableOTP = enableOTP || template?.IsEnableOTP || false;
|
||||||
|
object.set('IsEnableOTP', IsEnableOTP);
|
||||||
object.set('CreatedBy', template.CreatedBy);
|
object.set('CreatedBy', template.CreatedBy);
|
||||||
object.set('ExtUserPtr', {
|
object.set('ExtUserPtr', {
|
||||||
__type: 'Pointer',
|
__type: 'Pointer',
|
||||||
@@ -312,6 +315,7 @@ export default async function createDocumentWithTemplate(request, response) {
|
|||||||
from: sender,
|
from: sender,
|
||||||
html: html,
|
html: html,
|
||||||
extUserId: template.ExtUserPtr.objectId,
|
extUserId: template.ExtUserPtr.objectId,
|
||||||
|
mailProvider: template?.ExtUserPtr?.active_mail_adapter || '',
|
||||||
};
|
};
|
||||||
sendMail = await axios.post(url, params, { headers: headers });
|
sendMail = await axios.post(url, params, { headers: headers });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ export default async function createDocumentwithCoordinate(request, response) {
|
|||||||
const email_body = request.body.email_body;
|
const email_body = request.body.email_body;
|
||||||
const sendInOrder = request.body.sendInOrder || false;
|
const sendInOrder = request.body.sendInOrder || false;
|
||||||
const TimeToCompleteDays = request.body.timeToCompleteDays || 15;
|
const TimeToCompleteDays = request.body.timeToCompleteDays || 15;
|
||||||
|
const IsEnableOTP = request.body?.enableOTP === true ? true : false;
|
||||||
// console.log('fileData ', fileData);
|
// console.log('fileData ', fileData);
|
||||||
const protocol = customAPIurl();
|
const protocol = customAPIurl();
|
||||||
const baseUrl = new URL(process.env.PUBLIC_URL);
|
const baseUrl = new URL(process.env.PUBLIC_URL);
|
||||||
@@ -162,6 +163,7 @@ export default async function createDocumentwithCoordinate(request, response) {
|
|||||||
if (TimeToCompleteDays) {
|
if (TimeToCompleteDays) {
|
||||||
object.set('TimeToCompleteDays', TimeToCompleteDays);
|
object.set('TimeToCompleteDays', TimeToCompleteDays);
|
||||||
}
|
}
|
||||||
|
object.set('IsEnableOTP', IsEnableOTP);
|
||||||
object.set('IsSendMail', send_email);
|
object.set('IsSendMail', send_email);
|
||||||
let contact = [];
|
let contact = [];
|
||||||
if (signers && signers.length > 0) {
|
if (signers && signers.length > 0) {
|
||||||
@@ -369,6 +371,7 @@ export default async function createDocumentwithCoordinate(request, response) {
|
|||||||
from: sender,
|
from: sender,
|
||||||
html: html,
|
html: html,
|
||||||
extUserId: extUser.id,
|
extUserId: extUser.id,
|
||||||
|
mailProvider: parseExtUser?.active_mail_adapter || '',
|
||||||
};
|
};
|
||||||
|
|
||||||
await axios.post(url, params, { headers: headers });
|
await axios.post(url, params, { headers: headers });
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ export default async function createTemplate(request, response) {
|
|||||||
const SendinOrder = request.body.sendInOrder || false;
|
const SendinOrder = request.body.sendInOrder || false;
|
||||||
const fileData = request.files?.[0] ? request.files[0].buffer : null;
|
const fileData = request.files?.[0] ? request.files[0].buffer : null;
|
||||||
const baseUrl = new URL(process.env.PUBLIC_URL);
|
const baseUrl = new URL(process.env.PUBLIC_URL);
|
||||||
|
const isEnableOTP = request.body?.enableOTP === true ? true : false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const reqToken = request.headers['x-api-token'];
|
const reqToken = request.headers['x-api-token'];
|
||||||
@@ -65,6 +66,7 @@ export default async function createTemplate(request, response) {
|
|||||||
object.set('URL', fileUrl);
|
object.set('URL', fileUrl);
|
||||||
object.set('CreatedBy', userPtr);
|
object.set('CreatedBy', userPtr);
|
||||||
object.set('ExtUserPtr', extUserPtr);
|
object.set('ExtUserPtr', extUserPtr);
|
||||||
|
object.set('IsEnableOTP', isEnableOTP);
|
||||||
if (SendinOrder) {
|
if (SendinOrder) {
|
||||||
object.set('SendinOrder', SendinOrder);
|
object.set('SendinOrder', SendinOrder);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ export default async function createTemplatewithCoordinate(request, response) {
|
|||||||
const base64File = request.body.file;
|
const base64File = request.body.file;
|
||||||
const fileData = request.files?.[0] ? request.files[0].buffer : null;
|
const fileData = request.files?.[0] ? request.files[0].buffer : null;
|
||||||
const SendinOrder = request.body.sendInOrder || false;
|
const SendinOrder = request.body.sendInOrder || false;
|
||||||
|
const isEnableOTP = request.body?.enableOTP === true ? true : false;
|
||||||
|
|
||||||
// console.log('fileData ', fileData);
|
// console.log('fileData ', fileData);
|
||||||
const protocol = customAPIurl();
|
const protocol = customAPIurl();
|
||||||
|
|
||||||
@@ -80,6 +82,7 @@ export default async function createTemplatewithCoordinate(request, response) {
|
|||||||
object.set('URL', fileUrl);
|
object.set('URL', fileUrl);
|
||||||
object.set('CreatedBy', userPtr);
|
object.set('CreatedBy', userPtr);
|
||||||
object.set('ExtUserPtr', extUserPtr);
|
object.set('ExtUserPtr', extUserPtr);
|
||||||
|
object.set('IsEnableOTP', isEnableOTP);
|
||||||
let contact = [];
|
let contact = [];
|
||||||
if (signers && signers.length > 0) {
|
if (signers && signers.length > 0) {
|
||||||
let parseSigners;
|
let parseSigners;
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ export default async function draftDocument(request, response) {
|
|||||||
const send_email = request.body.send_email || true;
|
const send_email = request.body.send_email || true;
|
||||||
const fileData = request.files?.[0] ? request.files[0].buffer : null;
|
const fileData = request.files?.[0] ? request.files[0].buffer : null;
|
||||||
const SendinOrder = request.body.sendInOrder || false;
|
const SendinOrder = request.body.sendInOrder || false;
|
||||||
|
const isEnableOTP = request.body?.enableOTP === true ? true : false;
|
||||||
|
|
||||||
// console.log('fileData ', fileData);
|
// console.log('fileData ', fileData);
|
||||||
const protocol = customAPIurl();
|
const protocol = customAPIurl();
|
||||||
const baseUrl = new URL(process.env.PUBLIC_URL);
|
const baseUrl = new URL(process.env.PUBLIC_URL);
|
||||||
@@ -83,6 +85,7 @@ export default async function draftDocument(request, response) {
|
|||||||
object.set('CreatedBy', userPtr);
|
object.set('CreatedBy', userPtr);
|
||||||
object.set('ExtUserPtr', extUserPtr);
|
object.set('ExtUserPtr', extUserPtr);
|
||||||
object.set('IsSendMail', send_email);
|
object.set('IsSendMail', send_email);
|
||||||
|
object.set('IsEnableOTP', isEnableOTP);
|
||||||
if (signers && signers.length > 0) {
|
if (signers && signers.length > 0) {
|
||||||
let parseSigners;
|
let parseSigners;
|
||||||
if (base64File) {
|
if (base64File) {
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ export default async function getDocument(request, response) {
|
|||||||
document?.Signers?.map(y => ({ name: y?.Name, email: y?.Email, phone: y?.Phone })) ||
|
document?.Signers?.map(y => ({ name: y?.Name, email: y?.Email, phone: y?.Phone })) ||
|
||||||
[],
|
[],
|
||||||
sendInOrder: document?.SendinOrder || false,
|
sendInOrder: document?.SendinOrder || false,
|
||||||
|
enableOTP: document?.IsEnableOTP || false,
|
||||||
createdAt: document.createdAt,
|
createdAt: document.createdAt,
|
||||||
updatedAt: document.updatedAt,
|
updatedAt: document.updatedAt,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ export default async function getDocumentList(request, response) {
|
|||||||
x?.Signers?.map(y => ({ name: y?.Name, email: y?.Email, phone: y?.Phone })) ||
|
x?.Signers?.map(y => ({ name: y?.Name, email: y?.Email, phone: y?.Phone })) ||
|
||||||
[],
|
[],
|
||||||
sendInOrder: x?.SendinOrder || false,
|
sendInOrder: x?.SendinOrder || false,
|
||||||
|
enableOTP: x?.IsEnableOTP || false,
|
||||||
createdAt: x.createdAt,
|
createdAt: x.createdAt,
|
||||||
updatedAt: x.updatedAt,
|
updatedAt: x.updatedAt,
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ export default async function getTemplate(request, response) {
|
|||||||
),
|
),
|
||||||
})) || [],
|
})) || [],
|
||||||
sendInOrder: template?.SendinOrder || false,
|
sendInOrder: template?.SendinOrder || false,
|
||||||
|
enableOTP: template?.IsEnableOTP || false,
|
||||||
createdAt: template.createdAt,
|
createdAt: template.createdAt,
|
||||||
updatedAt: template.updatedAt,
|
updatedAt: template.updatedAt,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ export default async function getTemplatetList(request, response) {
|
|||||||
),
|
),
|
||||||
})) || [],
|
})) || [],
|
||||||
sendInOrder: template?.SendinOrder || false,
|
sendInOrder: template?.SendinOrder || false,
|
||||||
|
enableOTP: template?.IsEnableOTP || false,
|
||||||
createdAt: template.createdAt,
|
createdAt: template.createdAt,
|
||||||
updatedAt: template.updatedAt,
|
updatedAt: template.updatedAt,
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ export default async function resendMail(request, response) {
|
|||||||
if (resDoc) {
|
if (resDoc) {
|
||||||
const _resDoc = resDoc.toJSON();
|
const _resDoc = resDoc.toJSON();
|
||||||
const contact = _resDoc.Signers.find(x => x.Email === userMail);
|
const contact = _resDoc.Signers.find(x => x.Email === userMail);
|
||||||
|
const activeMailAdapter = _resDoc?.ExtUserPtr?.active_mail_adapter || '';
|
||||||
if (contact) {
|
if (contact) {
|
||||||
try {
|
try {
|
||||||
const imgPng = 'https://qikinnovation.ams3.digitaloceanspaces.com/logo.png';
|
const imgPng = 'https://qikinnovation.ams3.digitaloceanspaces.com/logo.png';
|
||||||
@@ -131,6 +132,7 @@ export default async function resendMail(request, response) {
|
|||||||
from: sender,
|
from: sender,
|
||||||
html: html,
|
html: html,
|
||||||
extUserId: _resDoc.ExtUserPtr.objectId,
|
extUserId: _resDoc.ExtUserPtr.objectId,
|
||||||
|
mailProvider: activeMailAdapter,
|
||||||
};
|
};
|
||||||
|
|
||||||
const res = await axios.post(url, params, { headers: headers });
|
const res = await axios.post(url, params, { headers: headers });
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export default async function updateDocument(request, response) {
|
|||||||
const token = await tokenQuery.first({ useMasterKey: true });
|
const token = await tokenQuery.first({ useMasterKey: true });
|
||||||
if (token !== undefined) {
|
if (token !== undefined) {
|
||||||
// Valid Token then proceed request
|
// Valid Token then proceed request
|
||||||
const allowedKeys = ['name', 'note', 'description', 'folderId'];
|
const allowedKeys = ['name', 'note', 'description', 'folderId', 'enableOTP'];
|
||||||
const objectKeys = Object.keys(request.body);
|
const objectKeys = Object.keys(request.body);
|
||||||
const isValid = objectKeys.every(key => allowedKeys.includes(key)) && objectKeys.length > 0;
|
const isValid = objectKeys.every(key => allowedKeys.includes(key)) && objectKeys.length > 0;
|
||||||
const parseUser = JSON.parse(JSON.stringify(token));
|
const parseUser = JSON.parse(JSON.stringify(token));
|
||||||
@@ -48,6 +48,10 @@ export default async function updateDocument(request, response) {
|
|||||||
objectId: request?.body?.folderId,
|
objectId: request?.body?.folderId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (request.body?.enableOTP) {
|
||||||
|
updateQuery.set('IsEnableOTP', request.body?.enableOTP);
|
||||||
|
}
|
||||||
const updatedRes = await updateQuery.save(null, { useMasterKey: true });
|
const updatedRes = await updateQuery.save(null, { useMasterKey: true });
|
||||||
if (updatedRes) {
|
if (updatedRes) {
|
||||||
if (request.posthog) {
|
if (request.posthog) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export default async function updateTemplate(request, response) {
|
|||||||
const token = await tokenQuery.first({ useMasterKey: true });
|
const token = await tokenQuery.first({ useMasterKey: true });
|
||||||
if (token !== undefined) {
|
if (token !== undefined) {
|
||||||
// Valid Token then proceed request
|
// Valid Token then proceed request
|
||||||
const allowedKeys = ['name', 'note', 'description', 'folderId'];
|
const allowedKeys = ['name', 'note', 'description', 'folderId', 'enableOTP'];
|
||||||
const objectKeys = Object.keys(request.body);
|
const objectKeys = Object.keys(request.body);
|
||||||
const isValid = objectKeys.every(key => allowedKeys.includes(key)) && objectKeys.length > 0;
|
const isValid = objectKeys.every(key => allowedKeys.includes(key)) && objectKeys.length > 0;
|
||||||
const parseUser = JSON.parse(JSON.stringify(token));
|
const parseUser = JSON.parse(JSON.stringify(token));
|
||||||
@@ -48,6 +48,9 @@ export default async function updateTemplate(request, response) {
|
|||||||
objectId: request?.body?.folderId,
|
objectId: request?.body?.folderId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (request.body?.enableOTP) {
|
||||||
|
updateQuery.set('IsEnableOTP', request.body?.enableOTP);
|
||||||
|
}
|
||||||
const updatedRes = await updateQuery.save(null, { useMasterKey: true });
|
const updatedRes = await updateQuery.save(null, { useMasterKey: true });
|
||||||
if (updatedRes) {
|
if (updatedRes) {
|
||||||
if (request.posthog) {
|
if (request.posthog) {
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
import { createTransport } from 'nodemailer';
|
||||||
|
import { appName } from '../../Utils.js';
|
||||||
|
// Online Javascript Editor for free
|
||||||
|
// Write, Edit and Run your Javascript code using JS Online Compiler
|
||||||
|
|
||||||
|
function generateOtpWithSum10() {
|
||||||
|
let otp = [];
|
||||||
|
let sum = 0;
|
||||||
|
|
||||||
|
// First, generate 3 random digits (0-9) and add them to the sum
|
||||||
|
for (let i = 0; i < 3; i++) {
|
||||||
|
let digit = Math.floor(Math.random() * 10);
|
||||||
|
otp.push(digit);
|
||||||
|
sum += digit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate the last digit to ensure the sum equals 10
|
||||||
|
let lastDigit = 10 - sum;
|
||||||
|
|
||||||
|
// If the last digit is not valid (e.g., greater than 9), regenerate
|
||||||
|
if (lastDigit >= 0 && lastDigit <= 9) {
|
||||||
|
otp.push(lastDigit);
|
||||||
|
} else {
|
||||||
|
return generateOtpWithSum10(); // Recursively generate again
|
||||||
|
}
|
||||||
|
|
||||||
|
return otp.join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function validateSmtp(request, response) {
|
||||||
|
const host = request.body.host;
|
||||||
|
const port = request.body?.port?.toString();
|
||||||
|
const username = request.body.username;
|
||||||
|
const password = request.body.password;
|
||||||
|
const secure = request.body?.secure;
|
||||||
|
const email = request.body?.email;
|
||||||
|
const otp = generateOtpWithSum10();
|
||||||
|
// console.log('Generated OTP:', otp);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const smtpsecure = secure || port !== '465' ? false : true;
|
||||||
|
const transporterSMTP = createTransport({
|
||||||
|
host: host,
|
||||||
|
port: port,
|
||||||
|
secure: smtpsecure,
|
||||||
|
auth: { user: username, pass: password },
|
||||||
|
});
|
||||||
|
const from = appName;
|
||||||
|
const mailsender = username;
|
||||||
|
const messageParams = {
|
||||||
|
from: from + ' <' + mailsender + '>',
|
||||||
|
to: email,
|
||||||
|
subject: `Your ${appName} SMTP credentials verification code`,
|
||||||
|
text: 'mail',
|
||||||
|
html:
|
||||||
|
`<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /></head><body><div style='background-color:#f5f5f5;padding:20px'><div style='box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;background-color:white;'><div style='background-color:red;padding:2px;font-family:system-ui; background-color:#47a3ad;'> <p style='font-size:20px;font-weight:400;color:white;padding-left:20px',>SMTP Verification Code</p></div><div style='padding:20px'><p style='font-family:system-ui;font-size:14px'>Your verification code is:</p><p style=' text-decoration: none; font-weight: bolder; color:blue;font-size:45px;margin:20px'>` +
|
||||||
|
otp +
|
||||||
|
'</p></div> </div> </div></body></html>',
|
||||||
|
};
|
||||||
|
|
||||||
|
const res = await transporterSMTP.sendMail(messageParams);
|
||||||
|
console.log('custom smtp transporter res: ', res?.response);
|
||||||
|
if (!res.err) {
|
||||||
|
response.status(200).json({ message: 'success' });
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log('err ', err);
|
||||||
|
const code = err?.responseCode || 400;
|
||||||
|
const message = err?.response || 'failed!';
|
||||||
|
response.status(code).json({ error: message });
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -65,6 +65,11 @@ import ExtUserAftersave from './parsefunction/ExtUserAftersave.js';
|
|||||||
import ExtUserAfterdelete from './parsefunction/ExtUserAfterdelete.js';
|
import ExtUserAfterdelete from './parsefunction/ExtUserAfterdelete.js';
|
||||||
import AllowedCredits from './parsefunction/AllowedCredits.js';
|
import AllowedCredits from './parsefunction/AllowedCredits.js';
|
||||||
import BuyCredits from './parsefunction/BuyCredits.js';
|
import BuyCredits from './parsefunction/BuyCredits.js';
|
||||||
|
import getContact from './parsefunction/getContact.js';
|
||||||
|
import updateContactTour from './parsefunction/updateContactTour.js';
|
||||||
|
import declinedocument from './parsefunction/declinedocument.js';
|
||||||
|
import addcustomsmtp from './parsefunction/addcustomsmtp.js';
|
||||||
|
import deactivateMailAdapter from './parsefunction/deactivateMailAdapter.js';
|
||||||
|
|
||||||
// This afterSave function triggers after an object is added or updated in the specified class, allowing for post-processing logic.
|
// This afterSave function triggers after an object is added or updated in the specified class, allowing for post-processing logic.
|
||||||
Parse.Cloud.afterSave('contracts_Document', DocumentAftersave);
|
Parse.Cloud.afterSave('contracts_Document', DocumentAftersave);
|
||||||
@@ -142,3 +147,8 @@ Parse.Cloud.define('allowedusers', AllowedUsers);
|
|||||||
Parse.Cloud.define('buyaddonusers', BuyAddonUsers);
|
Parse.Cloud.define('buyaddonusers', BuyAddonUsers);
|
||||||
Parse.Cloud.define('allowedcredits', AllowedCredits);
|
Parse.Cloud.define('allowedcredits', AllowedCredits);
|
||||||
Parse.Cloud.define('buycredits', BuyCredits);
|
Parse.Cloud.define('buycredits', BuyCredits);
|
||||||
|
Parse.Cloud.define('getcontact', getContact);
|
||||||
|
Parse.Cloud.define('updatecontacttour', updateContactTour);
|
||||||
|
Parse.Cloud.define('declinedoc', declinedocument);
|
||||||
|
Parse.Cloud.define('addsmtp', addcustomsmtp);
|
||||||
|
Parse.Cloud.define('deactivatemailadapter', deactivateMailAdapter);
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ const createDocumentFromTemplate = async (template, existContact, index) => {
|
|||||||
object.set('CreatedBy', template?.CreatedBy);
|
object.set('CreatedBy', template?.CreatedBy);
|
||||||
object.set('ExtUserPtr', template?.ExtUserPtr);
|
object.set('ExtUserPtr', template?.ExtUserPtr);
|
||||||
object.set('OriginIp', template?.OriginIp || '');
|
object.set('OriginIp', template?.OriginIp || '');
|
||||||
|
object.set('IsEnableOTP', template?.IsEnableOTP || false);
|
||||||
let signers = template?.Signers || [];
|
let signers = template?.Signers || [];
|
||||||
const signerobj = {
|
const signerobj = {
|
||||||
__type: 'Pointer',
|
__type: 'Pointer',
|
||||||
@@ -221,6 +222,25 @@ const sendMailToAllSigners = async docId => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const deductcount = async _resSub => {
|
||||||
|
try {
|
||||||
|
const subscriptionCls = new Parse.Object('contracts_Subscriptions');
|
||||||
|
subscriptionCls.id = _resSub.objectId;
|
||||||
|
const allowedCredits = _resSub?.AllowedCredits || 0;
|
||||||
|
const addonCredits = _resSub?.AddonCredits || 0;
|
||||||
|
if (allowedCredits > 0) {
|
||||||
|
const updateAllowedcredits = allowedCredits - 1 || 0;
|
||||||
|
subscriptionCls.set('AllowedCredits', updateAllowedcredits);
|
||||||
|
} else {
|
||||||
|
const updateAddonCredits = addonCredits > 0 ? addonCredits - 1 : 0;
|
||||||
|
subscriptionCls.set('AddonCredits', updateAddonCredits);
|
||||||
|
}
|
||||||
|
await subscriptionCls.save(null, { useMasterKey: true });
|
||||||
|
} catch (err) {
|
||||||
|
console.log('Err in deductcount in PublicUserLinkContacttoDoc cloud function', err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// `PublicUserLinkContactToDoc` cloud function is used to create contact, add this contact in contracts_Guest role and
|
// `PublicUserLinkContactToDoc` cloud function is used to create contact, add this contact in contracts_Guest role and
|
||||||
// create new document from template and save contact pointer in placeholder, signers and ACL of Document
|
// create new document from template and save contact pointer in placeholder, signers and ACL of Document
|
||||||
export default async function PublicUserLinkContactToDoc(req) {
|
export default async function PublicUserLinkContactToDoc(req) {
|
||||||
@@ -240,126 +260,163 @@ export default async function PublicUserLinkContactToDoc(req) {
|
|||||||
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Template not found.');
|
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Template not found.');
|
||||||
}
|
}
|
||||||
const _tempRes = JSON.parse(JSON.stringify(tempRes));
|
const _tempRes = JSON.parse(JSON.stringify(tempRes));
|
||||||
const Placeholders = _tempRes?.Placeholders || [];
|
const subscription = new Parse.Query('contracts_Subscriptions');
|
||||||
let index;
|
subscription.equalTo('TenantId', {
|
||||||
if (role) {
|
__type: 'Pointer',
|
||||||
index = Placeholders?.findIndex(x => x.Role && x.Role === role);
|
className: 'partners_Tenant',
|
||||||
} else {
|
objectId: _tempRes?.ExtUserPtr?.TenantId?.objectId,
|
||||||
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, '');
|
});
|
||||||
}
|
subscription.include('ExtUserPtr');
|
||||||
if (index !== -1) {
|
const date = new Date();
|
||||||
// Execute the query to check if a contact already exists in the 'contracts_Contactbook' class
|
subscription.greaterThanOrEqualTo('Next_billing_date', date);
|
||||||
const contactCls = new Parse.Query('contracts_Contactbook');
|
const resSub = await subscription.first({ useMasterKey: true });
|
||||||
contactCls.equalTo('Email', email);
|
if (resSub) {
|
||||||
contactCls.equalTo('CreatedBy', _tempRes.CreatedBy);
|
const _resSub = JSON.parse(JSON.stringify(resSub));
|
||||||
contactCls.notEqualTo('IsDeleted', true);
|
const allowedCredits = _resSub?.AllowedCredits || 0;
|
||||||
const existContact = await contactCls.first({ useMasterKey: true });
|
const addonCredits = _resSub?.AddonCredits || 0;
|
||||||
if (existContact) {
|
const totalcredits = allowedCredits + addonCredits;
|
||||||
const template_json = JSON.parse(JSON.stringify(tempRes));
|
if (totalcredits > 0) {
|
||||||
//update contact in placeholder, signers and update ACl in provide document
|
const Placeholders = _tempRes?.Placeholders || [];
|
||||||
const docRes = await createDocumentFromTemplate(template_json, existContact, index);
|
let index;
|
||||||
if (docRes) {
|
if (role) {
|
||||||
//condition will execute only if sendInOrder will be false for send email to all signers at a time.
|
index = Placeholders?.findIndex(x => x.Role && x.Role === role);
|
||||||
if (!template_json?.SendinOrder) {
|
} else {
|
||||||
await sendMailToAllSigners(docRes.id);
|
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, '');
|
||||||
}
|
|
||||||
return { contactId: existContact.id, docId: docRes.id };
|
|
||||||
}
|
}
|
||||||
} else {
|
if (index !== -1) {
|
||||||
// Execute the query to check if a user already exists in the 'contracts_Users' class
|
// Execute the query to check if a contact already exists in the 'contracts_Contactbook' class
|
||||||
const extUserQuery = new Parse.Query('contracts_Users');
|
const contactCls = new Parse.Query('contracts_Contactbook');
|
||||||
extUserQuery.equalTo('Email', email);
|
contactCls.equalTo('Email', email);
|
||||||
const extUser = await extUserQuery.first({ useMasterKey: true });
|
contactCls.equalTo('CreatedBy', _tempRes.CreatedBy);
|
||||||
if (extUser) {
|
contactCls.notEqualTo('IsDeleted', true);
|
||||||
const _extUser = JSON.parse(JSON.stringify(extUser));
|
const existContact = await contactCls.first({ useMasterKey: true });
|
||||||
const contact = {
|
if (existContact) {
|
||||||
UserId: _extUser.UserId,
|
const template_json = JSON.parse(JSON.stringify(tempRes));
|
||||||
Name: _extUser.Name,
|
//update contact in placeholder, signers and update ACl in provide document
|
||||||
Email: email,
|
const docRes = await createDocumentFromTemplate(template_json, existContact, index);
|
||||||
Phone: _extUser?.Phone ? _extUser.Phone : '',
|
if (docRes) {
|
||||||
CreatedBy: _tempRes.CreatedBy,
|
await deductcount(_resSub);
|
||||||
TenantId: _tempRes.ExtUserPtr.TenantId,
|
//condition will execute only if sendInOrder will be false for send email to all signers at a time.
|
||||||
};
|
if (!template_json?.SendinOrder) {
|
||||||
const template_json = JSON.parse(JSON.stringify(tempRes));
|
await sendMailToAllSigners(docRes.id);
|
||||||
// if user present on platform create contact on the basis of extended user details
|
}
|
||||||
const contactRes = await saveRoleContact(contact);
|
return { contactId: existContact.id, docId: docRes.id };
|
||||||
const docRes = await createDocumentFromTemplate(template_json, contactRes, index);
|
|
||||||
if (docRes) {
|
|
||||||
//condition will execute only if sendInOrder will be false for send email to all signers at a time.
|
|
||||||
if (!template_json?.SendinOrder) {
|
|
||||||
await sendMailToAllSigners(docRes.id);
|
|
||||||
}
|
}
|
||||||
return { contactId: contactRes.id, docId: docRes.id };
|
} else {
|
||||||
}
|
// Execute the query to check if a user already exists in the 'contracts_Users' class
|
||||||
} else if (name) {
|
const extUserQuery = new Parse.Query('contracts_Users');
|
||||||
try {
|
extUserQuery.equalTo('Email', email);
|
||||||
// Execute the query to check if a user already exists in the '_User' class
|
const extUser = await extUserQuery.first({ useMasterKey: true });
|
||||||
const userQuery = new Parse.Query(Parse.User);
|
if (extUser) {
|
||||||
userQuery.equalTo('email', email);
|
const _extUser = JSON.parse(JSON.stringify(extUser));
|
||||||
const userRes = await userQuery.first({ useMasterKey: true });
|
|
||||||
if (userRes) {
|
|
||||||
const contact = {
|
const contact = {
|
||||||
UserId: { __type: 'Pointer', className: '_User', objectId: userRes.id },
|
UserId: _extUser.UserId,
|
||||||
Name: name,
|
Name: _extUser.Name,
|
||||||
Email: email,
|
Email: email,
|
||||||
Phone: phone,
|
Phone: _extUser?.Phone ? _extUser.Phone : '',
|
||||||
CreatedBy: _tempRes.CreatedBy,
|
CreatedBy: _tempRes.CreatedBy,
|
||||||
TenantId: _tempRes.ExtUserPtr.TenantId,
|
TenantId: _tempRes.ExtUserPtr.TenantId,
|
||||||
};
|
};
|
||||||
const template_json = JSON.parse(JSON.stringify(tempRes));
|
const template_json = JSON.parse(JSON.stringify(tempRes));
|
||||||
// Create new contract on the basis provided contact details by user and userId from _User class
|
// if user present on platform create contact on the basis of extended user details
|
||||||
const contactRes = await saveRoleContact(contact);
|
const contactRes = await saveRoleContact(contact);
|
||||||
//update contact in placeholder, signers and update ACl in provide document
|
|
||||||
const docRes = await createDocumentFromTemplate(template_json, contactRes, index);
|
const docRes = await createDocumentFromTemplate(template_json, contactRes, index);
|
||||||
if (docRes) {
|
if (docRes) {
|
||||||
|
await deductcount(_resSub);
|
||||||
//condition will execute only if sendInOrder will be false for send email to all signers at a time.
|
//condition will execute only if sendInOrder will be false for send email to all signers at a time.
|
||||||
if (!template_json?.SendinOrder) {
|
if (!template_json?.SendinOrder) {
|
||||||
await sendMailToAllSigners(docRes.id);
|
await sendMailToAllSigners(docRes.id);
|
||||||
}
|
}
|
||||||
return { contactId: contactRes.id, docId: docRes.id };
|
return { contactId: contactRes.id, docId: docRes.id };
|
||||||
}
|
}
|
||||||
|
} else if (name) {
|
||||||
|
try {
|
||||||
|
// Execute the query to check if a user already exists in the '_User' class
|
||||||
|
const userQuery = new Parse.Query(Parse.User);
|
||||||
|
userQuery.equalTo('email', email);
|
||||||
|
const userRes = await userQuery.first({ useMasterKey: true });
|
||||||
|
if (userRes) {
|
||||||
|
const contact = {
|
||||||
|
UserId: { __type: 'Pointer', className: '_User', objectId: userRes.id },
|
||||||
|
Name: name,
|
||||||
|
Email: email,
|
||||||
|
Phone: phone,
|
||||||
|
CreatedBy: _tempRes.CreatedBy,
|
||||||
|
TenantId: _tempRes.ExtUserPtr.TenantId,
|
||||||
|
};
|
||||||
|
const template_json = JSON.parse(JSON.stringify(tempRes));
|
||||||
|
// Create new contract on the basis provided contact details by user and userId from _User class
|
||||||
|
const contactRes = await saveRoleContact(contact);
|
||||||
|
//update contact in placeholder, signers and update ACl in provide document
|
||||||
|
const docRes = await createDocumentFromTemplate(
|
||||||
|
template_json,
|
||||||
|
contactRes,
|
||||||
|
index
|
||||||
|
);
|
||||||
|
if (docRes) {
|
||||||
|
await deductcount(_resSub);
|
||||||
|
//condition will execute only if sendInOrder will be false for send email to all signers at a time.
|
||||||
|
if (!template_json?.SendinOrder) {
|
||||||
|
await sendMailToAllSigners(docRes.id);
|
||||||
|
}
|
||||||
|
return { contactId: contactRes.id, docId: docRes.id };
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// create new user in _User class on the basis of details provide by user
|
||||||
|
const _users = Parse.Object.extend('User');
|
||||||
|
const _user = new _users();
|
||||||
|
_user.set('name', name);
|
||||||
|
_user.set('username', email);
|
||||||
|
_user.set('email', email);
|
||||||
|
_user.set('password', email);
|
||||||
|
if (phone) {
|
||||||
|
_user.set('phone', phone);
|
||||||
|
}
|
||||||
|
const newUserRes = await _user.save();
|
||||||
|
const contact = {
|
||||||
|
UserId: { __type: 'Pointer', className: '_User', objectId: newUserRes.id },
|
||||||
|
Name: name,
|
||||||
|
Email: email,
|
||||||
|
Phone: phone,
|
||||||
|
CreatedBy: _tempRes.CreatedBy,
|
||||||
|
TenantId: _tempRes.ExtUserPtr.TenantId,
|
||||||
|
};
|
||||||
|
const template_json = JSON.parse(JSON.stringify(tempRes));
|
||||||
|
// Create new contract on the basis provided contact details by user and userId from _User class
|
||||||
|
const contactRes = await saveRoleContact(contact);
|
||||||
|
//update contact in placeholder, signers and update ACl in provide document
|
||||||
|
const docRes = await createDocumentFromTemplate(
|
||||||
|
template_json,
|
||||||
|
contactRes,
|
||||||
|
index
|
||||||
|
);
|
||||||
|
if (docRes) {
|
||||||
|
await deductcount(_resSub);
|
||||||
|
//condition will execute only if sendInOrder will be false for send email to all signers at a time.
|
||||||
|
if (!template_json?.SendinOrder) {
|
||||||
|
await sendMailToAllSigners(docRes.id);
|
||||||
|
}
|
||||||
|
return { contactId: contactRes.id, docId: docRes.id };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log('Err', err);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// create new user in _User class on the basis of details provide by user
|
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'User not found.');
|
||||||
const _users = Parse.Object.extend('User');
|
|
||||||
const _user = new _users();
|
|
||||||
_user.set('name', name);
|
|
||||||
_user.set('username', email);
|
|
||||||
_user.set('email', email);
|
|
||||||
_user.set('password', email);
|
|
||||||
if (phone) {
|
|
||||||
_user.set('phone', phone);
|
|
||||||
}
|
|
||||||
const newUserRes = await _user.save();
|
|
||||||
const contact = {
|
|
||||||
UserId: { __type: 'Pointer', className: '_User', objectId: newUserRes.id },
|
|
||||||
Name: name,
|
|
||||||
Email: email,
|
|
||||||
Phone: phone,
|
|
||||||
CreatedBy: _tempRes.CreatedBy,
|
|
||||||
TenantId: _tempRes.ExtUserPtr.TenantId,
|
|
||||||
};
|
|
||||||
const template_json = JSON.parse(JSON.stringify(tempRes));
|
|
||||||
// Create new contract on the basis provided contact details by user and userId from _User class
|
|
||||||
const contactRes = await saveRoleContact(contact);
|
|
||||||
//update contact in placeholder, signers and update ACl in provide document
|
|
||||||
const docRes = await createDocumentFromTemplate(template_json, contactRes, index);
|
|
||||||
if (docRes) {
|
|
||||||
//condition will execute only if sendInOrder will be false for send email to all signers at a time.
|
|
||||||
if (!template_json?.SendinOrder) {
|
|
||||||
await sendMailToAllSigners(docRes.id);
|
|
||||||
}
|
|
||||||
return { contactId: contactRes.id, docId: docRes.id };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
|
||||||
console.log('Err', err);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'User not found.');
|
throw new Parse.Error(
|
||||||
|
Parse.Error.OBJECT_NOT_FOUND,
|
||||||
|
'Please provide required parameters!'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new Parse.Error(Parse.Error.REQUEST_LIMIT_EXCEEDED, 'Insufficient Credit');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Please provide required parameters!');
|
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Plan expired');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Template not found.');
|
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Template not found.');
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { smtpenable, updateMailCount } from '../../Utils.js';
|
import { appName, smtpenable, updateMailCount } from '../../Utils.js';
|
||||||
async function getDocument(docId) {
|
async function getDocument(docId) {
|
||||||
try {
|
try {
|
||||||
const query = new Parse.Query('contracts_Document');
|
const query = new Parse.Query('contracts_Document');
|
||||||
@@ -28,12 +28,12 @@ async function sendMailOTPv1(request) {
|
|||||||
const mailsender = smtpenable ? process.env.SMTP_USER_EMAIL : process.env.MAILGUN_SENDER;
|
const mailsender = smtpenable ? process.env.SMTP_USER_EMAIL : process.env.MAILGUN_SENDER;
|
||||||
try {
|
try {
|
||||||
await Parse.Cloud.sendEmail({
|
await Parse.Cloud.sendEmail({
|
||||||
from: 'Opensign™' + ' <' + mailsender + '>',
|
from: appName + ' <' + mailsender + '>',
|
||||||
recipient: recipient,
|
recipient: recipient,
|
||||||
subject: 'Your OpenSign™ OTP',
|
subject: `Your ${appName} OTP`,
|
||||||
text: 'This email is a test.',
|
text: 'This email is a test.',
|
||||||
html:
|
html:
|
||||||
"<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /></head><body><div style='background-color:#f5f5f5;padding:20px'><div style='box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;background-color:white;'><div style='background-color:red;padding:2px;font-family:system-ui; background-color:#47a3ad;'> <p style='font-size:20px;font-weight:400;color:white;padding-left:20px',>OTP Verification</p></div><div style='padding:20px'><p style='font-family:system-ui;font-size:14px'>Your OTP for OpenSign™ verification is:</p><p style=' text-decoration: none; font-weight: bolder; color:blue;font-size:45px;margin:20px'>" +
|
`<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /></head><body><div style='background-color:#f5f5f5;padding:20px'><div style='box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;background-color:white;'><div style='background-color:red;padding:2px;font-family:system-ui; background-color:#47a3ad;'> <p style='font-size:20px;font-weight:400;color:white;padding-left:20px',>OTP Verification</p></div><div style='padding:20px'><p style='font-family:system-ui;font-size:14px'>Your OTP for ${appName} verification is:</p><p style=' text-decoration: none; font-weight: bolder; color:blue;font-size:45px;margin:20px'>` +
|
||||||
code +
|
code +
|
||||||
'</p></div> </div> </div></body></html>',
|
'</p></div> </div> </div></body></html>',
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
export default async function addcustomsmtp(request) {
|
||||||
|
if (!request?.user) {
|
||||||
|
throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, 'User is not authenticated.');
|
||||||
|
}
|
||||||
|
const host = request.params.host;
|
||||||
|
const port = request.params.port;
|
||||||
|
const username = request.params.username;
|
||||||
|
const password = request.params.password;
|
||||||
|
if (host && port && username && password) {
|
||||||
|
try {
|
||||||
|
const extUserCls = new Parse.Query('contracts_Users');
|
||||||
|
extUserCls.equalTo('UserId', request.user);
|
||||||
|
const extUser = await extUserCls.first({ useMasterKey: true });
|
||||||
|
if (extUser) {
|
||||||
|
const extUserCls = new Parse.Object('contracts_Users');
|
||||||
|
extUserCls.id = extUser.id;
|
||||||
|
extUserCls.set('SmtpConfig', { host, port, username, password });
|
||||||
|
extUserCls.set('active_mail_adapter', 'smtp');
|
||||||
|
const updateExtUser = await extUserCls.save(null, { useMasterKey: true });
|
||||||
|
// console.log('updateExtUser ', updateExtUser);
|
||||||
|
return updateExtUser.updatedAt;
|
||||||
|
}
|
||||||
|
return extUser;
|
||||||
|
} catch (err) {
|
||||||
|
console.log('Err in add custom smtp', err);
|
||||||
|
const code = err.code || 400;
|
||||||
|
const msg = err.message || 'Something went wrong.';
|
||||||
|
throw new Parse.Error(code, msg);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Please provide all parameters.');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,99 +7,101 @@ export default async function callWebhook(request) {
|
|||||||
const contactId = request.params.contactId;
|
const contactId = request.params.contactId;
|
||||||
const serverUrl = cloudServerUrl; //process.env.SERVER_URL;
|
const serverUrl = cloudServerUrl; //process.env.SERVER_URL;
|
||||||
const appId = process.env.APP_ID;
|
const appId = process.env.APP_ID;
|
||||||
const userRes = await axios.get(serverUrl + '/users/me', {
|
try {
|
||||||
headers: {
|
const docQuery = new Parse.Query('contracts_Document');
|
||||||
'X-Parse-Application-Id': appId,
|
const docRes = await docQuery.get(docId, { useMasterKey: true });
|
||||||
'X-Parse-Session-Token': request.headers['sessiontoken'],
|
const isEnableOTP = docRes?.get('IsEnableOTP') || false;
|
||||||
},
|
let userId;
|
||||||
});
|
if (isEnableOTP) {
|
||||||
|
const userRes = await axios.get(serverUrl + '/users/me', {
|
||||||
const userId = userRes.data && userRes.data.objectId;
|
headers: {
|
||||||
if (userId) {
|
'X-Parse-Application-Id': appId,
|
||||||
if (event === 'viewed' && contactId) {
|
'X-Parse-Session-Token': request.headers['sessiontoken'],
|
||||||
const docQuery = new Parse.Query('contracts_Document');
|
},
|
||||||
const res = await docQuery.get(docId, { useMasterKey: true });
|
});
|
||||||
if (res) {
|
userId = userRes.data && userRes.data.objectId;
|
||||||
const _res = res.toJSON();
|
}
|
||||||
const userPtr = {
|
if (!isEnableOTP || userId) {
|
||||||
__type: 'Pointer',
|
if (event === 'viewed' && contactId) {
|
||||||
className: 'contracts_Contactbook',
|
if (docRes) {
|
||||||
objectId: contactId,
|
const _docRes = docRes.toJSON();
|
||||||
};
|
const userPtr = {
|
||||||
const date = new Date().toISOString();
|
__type: 'Pointer',
|
||||||
const obj = {
|
className: 'contracts_Contactbook',
|
||||||
UserPtr: userPtr,
|
objectId: contactId,
|
||||||
SignedUrl: _res.SignedUrl,
|
};
|
||||||
Activity: 'Viewed',
|
const date = new Date().toISOString();
|
||||||
ipAddress: request.headers['x-real-ip'],
|
const obj = {
|
||||||
ViewedOn: date,
|
UserPtr: userPtr,
|
||||||
};
|
SignedUrl: _docRes.SignedUrl,
|
||||||
const isUserExist = _res?.AuditTrail?.some(
|
Activity: 'Viewed',
|
||||||
x => x.UserPtr.objectId === contactId && x?.ViewedOn
|
ipAddress: request.headers['x-real-ip'],
|
||||||
);
|
ViewedOn: date,
|
||||||
if (!isUserExist) {
|
};
|
||||||
const updateDoc = new Parse.Object('contracts_Document');
|
const isUserExist = _docRes?.AuditTrail?.some(
|
||||||
updateDoc.id = res.id;
|
x => x.UserPtr.objectId === contactId && x?.ViewedOn
|
||||||
if (_res?.AuditTrail && _res?.AuditTrail?.length > 0) {
|
);
|
||||||
updateDoc.set('AuditTrail', [..._res?.AuditTrail, obj]);
|
if (!isUserExist) {
|
||||||
} else {
|
const updateDoc = new Parse.Object('contracts_Document');
|
||||||
updateDoc.set('AuditTrail', [obj]);
|
updateDoc.id = docRes.id;
|
||||||
|
if (_docRes?.AuditTrail && _docRes?.AuditTrail?.length > 0) {
|
||||||
|
updateDoc.set('AuditTrail', [..._docRes?.AuditTrail, obj]);
|
||||||
|
} else {
|
||||||
|
updateDoc.set('AuditTrail', [obj]);
|
||||||
|
}
|
||||||
|
await updateDoc.save(null, { useMasterKey: true });
|
||||||
}
|
}
|
||||||
await updateDoc.save(null, { useMasterKey: true });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
const extendcls = new Parse.Query('contracts_Users');
|
||||||
const docQuery = new Parse.Query('contracts_Document');
|
extendcls.equalTo('objectId', docRes.get('ExtUserPtr')?.id);
|
||||||
const resDoc = await docQuery.get(docId, { useMasterKey: true });
|
// extendcls.equalTo('UserId', { __type: 'Pointer', className: '_User', objectId: userId });
|
||||||
const extendcls = new Parse.Query('contracts_Users');
|
const resExt = await extendcls.first({ useMasterKey: true });
|
||||||
extendcls.equalTo('objectId', resDoc.get('ExtUserPtr')?.id);
|
if (resExt) {
|
||||||
// extendcls.equalTo('UserId', { __type: 'Pointer', className: '_User', objectId: userId });
|
const extUser = JSON.parse(JSON.stringify(resExt));
|
||||||
const res = await extendcls.first({ useMasterKey: true });
|
if (extUser?.Webhook) {
|
||||||
if (res) {
|
const params = { event: event, ...body };
|
||||||
const extUser = JSON.parse(JSON.stringify(res));
|
await axios
|
||||||
if (extUser?.Webhook) {
|
.post(extUser?.Webhook, params, {
|
||||||
const params = {
|
headers: { 'Content-Type': 'application/json' },
|
||||||
event: event,
|
})
|
||||||
...body,
|
.then(res => {
|
||||||
};
|
try {
|
||||||
await axios
|
const webhook = new Parse.Object('contracts_Webhook');
|
||||||
.post(extUser?.Webhook, params, {
|
webhook.set('Log', res?.status);
|
||||||
headers: { 'Content-Type': 'application/json' },
|
webhook.set('UserId', {
|
||||||
})
|
__type: 'Pointer',
|
||||||
.then(res => {
|
className: '_User',
|
||||||
try {
|
objectId: userId,
|
||||||
// console.log('res ', res);
|
});
|
||||||
const webhook = new Parse.Object('contracts_Webhook');
|
webhook.save(null, { useMasterKey: true });
|
||||||
webhook.set('Log', res?.status);
|
} catch (err) {
|
||||||
webhook.set('UserId', {
|
console.log('err save in contracts_Webhook', err.message);
|
||||||
__type: 'Pointer',
|
}
|
||||||
className: '_User',
|
})
|
||||||
objectId: userId,
|
.catch(err => {
|
||||||
});
|
console.log('Err send data to webhook', err.message);
|
||||||
webhook.save(null, { useMasterKey: true });
|
try {
|
||||||
} catch (err) {
|
const webhook = new Parse.Object('contracts_Webhook');
|
||||||
console.log('err save in contracts_Webhook', err.message);
|
webhook.set('Log', err?.status);
|
||||||
}
|
webhook.set('UserId', {
|
||||||
})
|
__type: 'Pointer',
|
||||||
.catch(err => {
|
className: '_User',
|
||||||
console.log('Err send data to webhook', err.message);
|
objectId: userId,
|
||||||
try {
|
});
|
||||||
const webhook = new Parse.Object('contracts_Webhook');
|
webhook.save(null, { useMasterKey: true });
|
||||||
webhook.set('Log', err?.status);
|
} catch (err) {
|
||||||
webhook.set('UserId', {
|
console.log('err save in contracts_Webhook', err.message);
|
||||||
__type: 'Pointer',
|
}
|
||||||
className: '_User',
|
});
|
||||||
objectId: userId,
|
}
|
||||||
});
|
return { message: 'webhook called!' };
|
||||||
webhook.save(null, { useMasterKey: true });
|
|
||||||
} catch (err) {
|
|
||||||
console.log('err save in contracts_Webhook', err.message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return { message: 'webhook called!' };
|
} else {
|
||||||
|
return { message: 'User not found!' };
|
||||||
}
|
}
|
||||||
} else {
|
} catch (err) {
|
||||||
return { message: 'User not found!' };
|
console.log('Err in callwebhook', err);
|
||||||
|
return { message: 'Something went wrong!' };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ async function sendMail(document, sessionToken) {
|
|||||||
const orgName = document.ExtUserPtr.Company ? document.ExtUserPtr.Company : '';
|
const orgName = document.ExtUserPtr.Company ? document.ExtUserPtr.Company : '';
|
||||||
const themeBGcolor = '#47a3ad';
|
const themeBGcolor = '#47a3ad';
|
||||||
let params = {
|
let params = {
|
||||||
|
mailProvider: document?.ExtUserPtr?.active_mail_adapter || '',
|
||||||
extUserId: document.ExtUserPtr.objectId,
|
extUserId: document.ExtUserPtr.objectId,
|
||||||
recipient: objectId ? existSigner?.Email : signerMail[i].email,
|
recipient: objectId ? existSigner?.Email : signerMail[i].email,
|
||||||
subject: `${document.ExtUserPtr.Name} has requested you to sign "${document.Name}"`,
|
subject: `${document.ExtUserPtr.Name} has requested you to sign "${document.Name}"`,
|
||||||
@@ -199,6 +200,7 @@ export default async function createBatchDocs(request) {
|
|||||||
TimeToCompleteDays: x.TimeToCompleteDays || 15,
|
TimeToCompleteDays: x.TimeToCompleteDays || 15,
|
||||||
OriginIp: Ip,
|
OriginIp: Ip,
|
||||||
DocSentAt: { __type: 'Date', iso: isoDate },
|
DocSentAt: { __type: 'Date', iso: isoDate },
|
||||||
|
IsEnableOTP: x?.IsEnableOTP || false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
export default async function deactivateMailAdapter(request) {
|
||||||
|
if (!request?.user) {
|
||||||
|
throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, 'User is not authenticated.');
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const extUserCls = new Parse.Query('contracts_Users');
|
||||||
|
extUserCls.equalTo('UserId', request.user);
|
||||||
|
const extUser = await extUserCls.first({ useMasterKey: true });
|
||||||
|
if (extUser) {
|
||||||
|
const extUserCls = new Parse.Object('contracts_Users');
|
||||||
|
extUserCls.id = extUser.id;
|
||||||
|
extUserCls.unset('active_mail_adapter');
|
||||||
|
const updateExtUser = await extUserCls.save(null, { useMasterKey: true });
|
||||||
|
// console.log('updateExtUser ', updateExtUser);
|
||||||
|
return updateExtUser.updatedAt;
|
||||||
|
}
|
||||||
|
return extUser;
|
||||||
|
} catch (err) {
|
||||||
|
console.log('Err in add custom smtp', err);
|
||||||
|
const code = err.code || 400;
|
||||||
|
const msg = err.message || 'Something went wrong.';
|
||||||
|
throw new Parse.Error(code, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
export default async function declinedocument(request) {
|
||||||
|
const docId = request.params.docId;
|
||||||
|
const reason = request.params?.reason || '';
|
||||||
|
const declineBy = {
|
||||||
|
__type: 'Pointer',
|
||||||
|
className: '_User',
|
||||||
|
objectId: request.params?.userId,
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const docCls = new Parse.Query('contracts_Document');
|
||||||
|
const updateDoc = await docCls.get(docId, { useMasterKey: true });
|
||||||
|
if (updateDoc) {
|
||||||
|
const isEnableOTP = updateDoc?.get('IsEnableOTP') || false;
|
||||||
|
if (!isEnableOTP) {
|
||||||
|
updateDoc.set('IsDeclined', true);
|
||||||
|
updateDoc.set('DeclineReason', reason);
|
||||||
|
updateDoc.set('DeclineBy', declineBy);
|
||||||
|
await updateDoc.save(null, { useMasterKey: true });
|
||||||
|
return 'document declined';
|
||||||
|
} else {
|
||||||
|
if (!request?.user) {
|
||||||
|
throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, 'User is not authenticated.');
|
||||||
|
}
|
||||||
|
updateDoc.set('IsDeclined', true);
|
||||||
|
updateDoc.set('DeclineReason', reason);
|
||||||
|
updateDoc.set('DeclineBy', declineBy);
|
||||||
|
await updateDoc.save(null, { useMasterKey: true });
|
||||||
|
return 'document declined';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Document not found.');
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log('err while decling doc', err);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
export default async function getContact(request) {
|
||||||
|
const contactId = request.params.contactId;
|
||||||
|
try {
|
||||||
|
const contactCls = new Parse.Query('contracts_Contactbook');
|
||||||
|
const contactRes = await contactCls.get(contactId, { useMasterKey: true });
|
||||||
|
return contactRes;
|
||||||
|
} catch (err) {
|
||||||
|
console.log('Err in contracts_Contactbook class ', err);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,14 +6,7 @@ export default async function getDocument(request) {
|
|||||||
const docId = request.params.docId;
|
const docId = request.params.docId;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const userRes = await axios.get(serverUrl + '/users/me', {
|
if (docId) {
|
||||||
headers: {
|
|
||||||
'X-Parse-Application-Id': process.env.APP_ID,
|
|
||||||
'X-Parse-Session-Token': request.headers['sessiontoken'],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const userId = userRes.data && userRes.data.objectId;
|
|
||||||
if (docId && userId) {
|
|
||||||
try {
|
try {
|
||||||
const query = new Parse.Query('contracts_Document');
|
const query = new Parse.Query('contracts_Document');
|
||||||
query.equalTo('objectId', docId);
|
query.equalTo('objectId', docId);
|
||||||
@@ -26,11 +19,32 @@ export default async function getDocument(request) {
|
|||||||
query.notEqualTo('IsArchive', true);
|
query.notEqualTo('IsArchive', true);
|
||||||
const res = await query.first({ useMasterKey: true });
|
const res = await query.first({ useMasterKey: true });
|
||||||
if (res) {
|
if (res) {
|
||||||
const acl = res.getACL();
|
const IsEnableOTP = res?.get('IsEnableOTP') || false;
|
||||||
if (acl && acl.getReadAccess(userId)) {
|
if (!IsEnableOTP) {
|
||||||
return res;
|
return res;
|
||||||
} else {
|
} else {
|
||||||
return { error: "You don't have access of this document!" };
|
if (request?.headers?.['sessiontoken']) {
|
||||||
|
try {
|
||||||
|
const userRes = await axios.get(serverUrl + '/users/me', {
|
||||||
|
headers: {
|
||||||
|
'X-Parse-Application-Id': process.env.APP_ID,
|
||||||
|
'X-Parse-Session-Token': request.headers['sessiontoken'],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const userId = userRes.data && userRes.data?.objectId;
|
||||||
|
const acl = res.getACL();
|
||||||
|
if (userId && acl && acl.getReadAccess(userId)) {
|
||||||
|
return res;
|
||||||
|
} else {
|
||||||
|
return { error: "You don't have access of this document!" };
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log('err user in not authenticated', err);
|
||||||
|
return { error: "You don't have access of this document!" };
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return { error: "You don't have access of this document!" };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return { error: "You don't have access of this document!" };
|
return { error: "You don't have access of this document!" };
|
||||||
|
|||||||
@@ -28,15 +28,42 @@ export default function getPresignedUrl(url) {
|
|||||||
|
|
||||||
export async function getSignedUrl(request) {
|
export async function getSignedUrl(request) {
|
||||||
try {
|
try {
|
||||||
|
const docId = request.params.docId || '';
|
||||||
const url = request.params.url;
|
const url = request.params.url;
|
||||||
if (!request?.user) {
|
if (docId) {
|
||||||
throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, 'User is not authenticated.');
|
try {
|
||||||
|
const query = new Parse.Query('contracts_Document');
|
||||||
|
query.equalTo('objectId', docId);
|
||||||
|
query.notEqualTo('IsEnableOTP', true);
|
||||||
|
query.include('CreatedBy');
|
||||||
|
query.include('Signers');
|
||||||
|
query.include('AuditTrail.UserPtr');
|
||||||
|
query.include('Placeholders');
|
||||||
|
query.include('DeclineBy');
|
||||||
|
query.notEqualTo('IsArchive', true);
|
||||||
|
const res = await query.first({ useMasterKey: true });
|
||||||
|
if (res) {
|
||||||
|
if (useLocal !== 'true') {
|
||||||
|
const presignedUrl = getPresignedUrl(url);
|
||||||
|
return presignedUrl;
|
||||||
|
} else {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log('Err in presigned url', err);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (useLocal !== 'true') {
|
if (!request?.user) {
|
||||||
const presignedUrl = getPresignedUrl(url);
|
throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, 'User is not authenticated.');
|
||||||
return presignedUrl;
|
|
||||||
} else {
|
} else {
|
||||||
return url;
|
if (useLocal !== 'true') {
|
||||||
|
const presignedUrl = getPresignedUrl(url);
|
||||||
|
return presignedUrl;
|
||||||
|
} else {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -50,37 +50,24 @@ export default async function getSubscription(request) {
|
|||||||
}
|
}
|
||||||
} else if (contactId) {
|
} else if (contactId) {
|
||||||
try {
|
try {
|
||||||
const userRes = await axios.get(serverUrl + '/users/me', {
|
const contactCls = new Parse.Query('contracts_Contactbook');
|
||||||
headers: {
|
const contactUser = await contactCls.get(contactId, { useMasterKey: true });
|
||||||
'X-Parse-Application-Id': appId,
|
if (contactUser) {
|
||||||
'X-Parse-Session-Token': request.headers['sessiontoken'],
|
const subscriptionCls = new Parse.Query('contracts_Subscriptions');
|
||||||
},
|
subscriptionCls.equalTo('TenantId', {
|
||||||
});
|
__type: 'Pointer',
|
||||||
|
className: 'partners_Tenant',
|
||||||
const userId = userRes.data && userRes.data.objectId;
|
objectId: contactUser.get('TenantId').id,
|
||||||
if (userId) {
|
});
|
||||||
const contactCls = new Parse.Query('contracts_Contactbook');
|
subscriptionCls.descending('createdAt');
|
||||||
const contactUser = await contactCls.get(contactId, { useMasterKey: true });
|
const subcripitions = await subscriptionCls.first({ useMasterKey: true });
|
||||||
if (contactUser) {
|
if (subcripitions) {
|
||||||
const subscriptionCls = new Parse.Query('contracts_Subscriptions');
|
const _subcripitions = JSON.parse(JSON.stringify(subcripitions));
|
||||||
subscriptionCls.equalTo('TenantId', {
|
if (_subcripitions.PlanCode === 'freeplan') {
|
||||||
__type: 'Pointer',
|
return { status: 'success', result: { isSubscribed: false, plan: 'freeplan' } };
|
||||||
className: 'partners_Tenant',
|
} else if (_subcripitions?.Next_billing_date?.iso) {
|
||||||
objectId: contactUser.get('TenantId').id,
|
if (new Date(_subcripitions.Next_billing_date.iso) > new Date()) {
|
||||||
});
|
return { status: 'success', result: { isSubscribed: true } };
|
||||||
subscriptionCls.descending('createdAt');
|
|
||||||
const subcripitions = await subscriptionCls.first({ useMasterKey: true });
|
|
||||||
|
|
||||||
if (subcripitions) {
|
|
||||||
const _subcripitions = JSON.parse(JSON.stringify(subcripitions));
|
|
||||||
if (_subcripitions.PlanCode === 'freeplan') {
|
|
||||||
return { status: 'success', result: { isSubscribed: false, plan: 'freeplan' } };
|
|
||||||
} else if (_subcripitions?.Next_billing_date?.iso) {
|
|
||||||
if (new Date(_subcripitions.Next_billing_date.iso) > new Date()) {
|
|
||||||
return { status: 'success', result: { isSubscribed: true } };
|
|
||||||
} else {
|
|
||||||
return { status: 'success', result: { isSubscribed: false } };
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return { status: 'success', result: { isSubscribed: false } };
|
return { status: 'success', result: { isSubscribed: false } };
|
||||||
}
|
}
|
||||||
@@ -88,10 +75,10 @@ export default async function getSubscription(request) {
|
|||||||
return { status: 'success', result: { isSubscribed: false } };
|
return { status: 'success', result: { isSubscribed: false } };
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return { status: 'error', result: 'User not found!' };
|
return { status: 'success', result: { isSubscribed: false } };
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return { status: 'error', result: 'Invalid session token!' };
|
return { status: 'error', result: 'User not found!' };
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Err in get subscription2', err.message);
|
console.log('Err in get subscription2', err.message);
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ export default async function GenerateCertificate(docDetails) {
|
|||||||
const OriginIp = docDetails?.OriginIp || '';
|
const OriginIp = docDetails?.OriginIp || '';
|
||||||
const company = docDetails?.ExtUserPtr?.Company || '';
|
const company = docDetails?.ExtUserPtr?.Company || '';
|
||||||
const createdAt = docDetails?.DocSentAt?.iso || docDetails.createdAt;
|
const createdAt = docDetails?.DocSentAt?.iso || docDetails.createdAt;
|
||||||
|
const IsEnableOTP = docDetails?.IsEnableOTP || false;
|
||||||
const auditTrail =
|
const auditTrail =
|
||||||
docDetails?.Signers?.length > 0
|
docDetails?.Signers?.length > 0
|
||||||
? docDetails.AuditTrail.map(x => {
|
? docDetails.AuditTrail.map(x => {
|
||||||
@@ -348,22 +349,22 @@ export default async function GenerateCertificate(docDetails) {
|
|||||||
font: timesRomanFont,
|
font: timesRomanFont,
|
||||||
color: textValueColor,
|
color: textValueColor,
|
||||||
});
|
});
|
||||||
page.drawText('Security level :', {
|
if (IsEnableOTP) {
|
||||||
x: half + 55,
|
page.drawText('Security level :', {
|
||||||
y: yPosition4 + 10,
|
x: half + 55,
|
||||||
size: timeText,
|
y: yPosition4 + 10,
|
||||||
font: timesRomanFont,
|
size: timeText,
|
||||||
color: textKeyColor,
|
font: timesRomanFont,
|
||||||
});
|
color: textKeyColor,
|
||||||
|
});
|
||||||
page.drawText(`Email, OTP Auth`, {
|
page.drawText('Email, OTP Auth', {
|
||||||
x: half + 125,
|
x: half + 125,
|
||||||
y: yPosition4 + 10,
|
y: yPosition4 + 10,
|
||||||
size: timeText,
|
size: timeText,
|
||||||
font: timesRomanFont,
|
font: timesRomanFont,
|
||||||
color: textValueColor,
|
color: textValueColor,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
page.drawText('Signature :', {
|
page.drawText('Signature :', {
|
||||||
x: 30,
|
x: 30,
|
||||||
y: yPosition5,
|
y: yPosition5,
|
||||||
|
|||||||
@@ -272,157 +272,160 @@ const sendMailsaveCertifcate = async (doc, P12Buffer, url, isCustomMail, mailPro
|
|||||||
*/
|
*/
|
||||||
async function PDF(req) {
|
async function PDF(req) {
|
||||||
try {
|
try {
|
||||||
if (!req?.user) {
|
const userIP = req.headers['x-real-ip']; // client IPaddress
|
||||||
throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, 'User is not authenticated.');
|
const docId = req.params.docId;
|
||||||
|
const reqUserId = req.params.userId;
|
||||||
|
const isCustomMail = req.params.isCustomCompletionMail || false;
|
||||||
|
const mailProvider = req.params.mailProvider || '';
|
||||||
|
const sign = req.params.signature || '';
|
||||||
|
// below bode is used to get info of docId
|
||||||
|
const docQuery = new Parse.Query('contracts_Document');
|
||||||
|
docQuery.include('ExtUserPtr,Signers');
|
||||||
|
docQuery.equalTo('objectId', docId);
|
||||||
|
const resDoc = await docQuery.first({ useMasterKey: true });
|
||||||
|
if (!resDoc) {
|
||||||
|
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Document not found.');
|
||||||
|
}
|
||||||
|
const IsEnableOTP = resDoc?.get('IsEnableOTP') || false;
|
||||||
|
// if `IsEnableOTP` is false then we don't have to check authentication
|
||||||
|
if (IsEnableOTP) {
|
||||||
|
if (!req?.user) {
|
||||||
|
throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, 'User is not authenticated.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const _resDoc = resDoc?.toJSON();
|
||||||
|
let signUser;
|
||||||
|
let className;
|
||||||
|
// `reqUserId` is send throught pdfrequest signing flow
|
||||||
|
if (reqUserId) {
|
||||||
|
// to get contracts_Contactbook details for currentuser from reqUserId
|
||||||
|
const _contractUser = _resDoc.Signers.find(x => x.objectId === reqUserId);
|
||||||
|
if (_contractUser) {
|
||||||
|
signUser = _contractUser;
|
||||||
|
className = 'contracts_Contactbook';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const userIP = req.headers['x-real-ip']; // client IPaddress
|
className = 'contracts_Users';
|
||||||
const docId = req.params.docId;
|
signUser = _resDoc.ExtUserPtr;
|
||||||
const reqUserId = req.params.userId;
|
}
|
||||||
const isCustomMail = req.params.isCustomCompletionMail || false;
|
|
||||||
const mailProvider = req.params.mailProvider || '';
|
const username = signUser.Name;
|
||||||
const sign = req.params.signature || '';
|
const userEmail = signUser.Email;
|
||||||
// below bode is used to get info of docId
|
if (req.params.pdfFile) {
|
||||||
const docQuery = new Parse.Query('contracts_Document');
|
// `PdfBuffer` used to create buffer from pdf file
|
||||||
docQuery.include('ExtUserPtr,Signers');
|
let PdfBuffer = Buffer.from(req.params.pdfFile, 'base64');
|
||||||
docQuery.equalTo('objectId', docId);
|
// `P12Buffer` used to create buffer from p12 certificate
|
||||||
const resDoc = await docQuery.first({ useMasterKey: true });
|
const pfxFile = process.env.PFX_BASE64;
|
||||||
if (!resDoc) {
|
// const P12Buffer = fs.readFileSync();
|
||||||
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Document not found.');
|
const P12Buffer = Buffer.from(pfxFile, 'base64');
|
||||||
}
|
const p12Cert = new P12Signer(P12Buffer, { passphrase: process.env.PASS_PHRASE || null });
|
||||||
const _resDoc = resDoc?.toJSON();
|
const UserPtr = { __type: 'Pointer', className: className, objectId: signUser.objectId };
|
||||||
let signUser;
|
const obj = { UserPtr: UserPtr, SignedUrl: '', Activity: 'Signed', ipAddress: userIP };
|
||||||
let className;
|
let updateAuditTrail;
|
||||||
// `reqUserId` is send throught pdfrequest signing flow
|
if (_resDoc.AuditTrail && _resDoc.AuditTrail.length > 0) {
|
||||||
if (reqUserId) {
|
updateAuditTrail = [..._resDoc.AuditTrail, obj];
|
||||||
// to get contracts_Contactbook details for currentuser from reqUserId
|
|
||||||
const _contractUser = _resDoc.Signers.find(x => x.objectId === reqUserId);
|
|
||||||
if (_contractUser) {
|
|
||||||
signUser = _contractUser;
|
|
||||||
className = 'contracts_Contactbook';
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
className = 'contracts_Users';
|
updateAuditTrail = [obj];
|
||||||
signUser = _resDoc.ExtUserPtr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const username = signUser.Name;
|
const auditTrail = updateAuditTrail.filter(x => x.Activity === 'Signed');
|
||||||
const userEmail = signUser.Email;
|
let isCompleted = false;
|
||||||
if (req.params.pdfFile) {
|
if (_resDoc.Signers && _resDoc.Signers.length > 0) {
|
||||||
// `PdfBuffer` used to create buffer from pdf file
|
if (auditTrail.length === _resDoc.Signers.length) {
|
||||||
let PdfBuffer = Buffer.from(req.params.pdfFile, 'base64');
|
|
||||||
// `P12Buffer` used to create buffer from p12 certificate
|
|
||||||
const pfxFile = process.env.PFX_BASE64;
|
|
||||||
// const P12Buffer = fs.readFileSync();
|
|
||||||
const P12Buffer = Buffer.from(pfxFile, 'base64');
|
|
||||||
const p12Cert = new P12Signer(P12Buffer, { passphrase: process.env.PASS_PHRASE || null });
|
|
||||||
const UserPtr = { __type: 'Pointer', className: className, objectId: signUser.objectId };
|
|
||||||
const obj = { UserPtr: UserPtr, SignedUrl: '', Activity: 'Signed', ipAddress: userIP };
|
|
||||||
let updateAuditTrail;
|
|
||||||
if (_resDoc.AuditTrail && _resDoc.AuditTrail.length > 0) {
|
|
||||||
updateAuditTrail = [..._resDoc.AuditTrail, obj];
|
|
||||||
} else {
|
|
||||||
updateAuditTrail = [obj];
|
|
||||||
}
|
|
||||||
|
|
||||||
const auditTrail = updateAuditTrail.filter(x => x.Activity === 'Signed');
|
|
||||||
let isCompleted = false;
|
|
||||||
if (_resDoc.Signers && _resDoc.Signers.length > 0) {
|
|
||||||
if (auditTrail.length === _resDoc.Signers.length) {
|
|
||||||
isCompleted = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
isCompleted = true;
|
isCompleted = true;
|
||||||
}
|
}
|
||||||
const randomNumber = Math.floor(Math.random() * 5000);
|
|
||||||
const name = `exported_file_${randomNumber}.pdf`;
|
|
||||||
const pdfName = `./exports/${name}`;
|
|
||||||
let pdfSize = PdfBuffer.length;
|
|
||||||
if (isCompleted) {
|
|
||||||
const signersName = _resDoc.Signers?.map(x => x.Name + ' <' + x.Email + '>');
|
|
||||||
if (signersName && signersName.length > 0) {
|
|
||||||
// `pdflibAddPlaceholder` is used to add code of only digitial sign without widget
|
|
||||||
const pdfDoc = await PDFDocument.load(PdfBuffer);
|
|
||||||
pdflibAddPlaceholder({
|
|
||||||
pdfDoc: pdfDoc,
|
|
||||||
reason: 'Digitally signed by OpenSign for ' + signersName?.join(', '),
|
|
||||||
location: 'n/a',
|
|
||||||
name: eSignName,
|
|
||||||
contactInfo: eSigncontact,
|
|
||||||
signatureLength: 15000,
|
|
||||||
});
|
|
||||||
const pdfWithPlaceholderBytes = await pdfDoc.save();
|
|
||||||
PdfBuffer = Buffer.from(pdfWithPlaceholderBytes);
|
|
||||||
} else {
|
|
||||||
// `pdflibAddPlaceholder` is used to add code of only digitial sign without widget (signyourself)
|
|
||||||
const pdfDoc = await PDFDocument.load(PdfBuffer);
|
|
||||||
pdflibAddPlaceholder({
|
|
||||||
pdfDoc: pdfDoc,
|
|
||||||
reason: 'Digitally signed by OpenSign for ' + username + ' <' + userEmail + '>',
|
|
||||||
location: 'n/a',
|
|
||||||
name: eSignName,
|
|
||||||
contactInfo: eSigncontact,
|
|
||||||
signatureLength: 15000,
|
|
||||||
});
|
|
||||||
const pdfWithPlaceholderBytes = await pdfDoc.save();
|
|
||||||
PdfBuffer = Buffer.from(pdfWithPlaceholderBytes);
|
|
||||||
}
|
|
||||||
//`new signPDF` create new instance of pdfBuffer and p12Buffer
|
|
||||||
const OBJ = new SignPdf();
|
|
||||||
// `signedDocs` is used to signpdf digitally
|
|
||||||
const signedDocs = await OBJ.sign(PdfBuffer, p12Cert);
|
|
||||||
|
|
||||||
//`saveUrl` is used to save signed pdf in exports folder
|
|
||||||
const saveUrl = fs.writeFileSync(pdfName, signedDocs);
|
|
||||||
pdfSize = signedDocs.length;
|
|
||||||
} else {
|
|
||||||
//`saveUrl` is used to save signed pdf in exports folder
|
|
||||||
const saveUrl = fs.writeFileSync(pdfName, PdfBuffer);
|
|
||||||
pdfSize = PdfBuffer.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
// `uploadFile` is used to upload pdf to aws s3 and get it's url
|
|
||||||
const data = await uploadFile(name, pdfName);
|
|
||||||
|
|
||||||
if (data && data.imageUrl) {
|
|
||||||
// `axios` is used to update signed pdf url in contracts_Document classes for given DocId
|
|
||||||
const updatedDoc = await updateDoc(
|
|
||||||
req.params.docId, //docId
|
|
||||||
data.imageUrl, // url
|
|
||||||
signUser.objectId, // userID
|
|
||||||
userIP, // client ipAddress,
|
|
||||||
_resDoc, // auditTrail, signers, etc data
|
|
||||||
className, // className based on flow
|
|
||||||
sign // sign base64
|
|
||||||
);
|
|
||||||
sendDoctoWebhook(_resDoc, data.imageUrl, 'signed', signUser);
|
|
||||||
saveFileUsage(pdfSize, data.imageUrl, _resDoc?.CreatedBy?.objectId);
|
|
||||||
if (updatedDoc && updatedDoc.isCompleted) {
|
|
||||||
const doc = { ..._resDoc, AuditTrail: updatedDoc.AuditTrail };
|
|
||||||
sendMailsaveCertifcate(
|
|
||||||
doc,
|
|
||||||
P12Buffer,
|
|
||||||
data.imageUrl,
|
|
||||||
isCustomMail,
|
|
||||||
mailProvider,
|
|
||||||
_resDoc?.CreatedBy?.objectId
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// `fs.unlinkSync` is used to remove exported signed pdf file from exports folder
|
|
||||||
fs.unlinkSync(pdfName);
|
|
||||||
console.log(`New Signed PDF created called: ${pdfName}`);
|
|
||||||
if (updatedDoc.message === 'success') {
|
|
||||||
return { status: 'success', data: data.imageUrl };
|
|
||||||
} else {
|
|
||||||
const error = new Error('Please provide required parameters!');
|
|
||||||
error.code = 400; // Set the error code (e.g., 400 for bad request)
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
const error = new Error('Pdf file not present!');
|
isCompleted = true;
|
||||||
error.code = 400; // Set the error code (e.g., 400 for bad request)
|
|
||||||
throw error;
|
|
||||||
}
|
}
|
||||||
|
const randomNumber = Math.floor(Math.random() * 5000);
|
||||||
|
const name = `exported_file_${randomNumber}.pdf`;
|
||||||
|
const pdfName = `./exports/${name}`;
|
||||||
|
let pdfSize = PdfBuffer.length;
|
||||||
|
if (isCompleted) {
|
||||||
|
const signersName = _resDoc.Signers?.map(x => x.Name + ' <' + x.Email + '>');
|
||||||
|
if (signersName && signersName.length > 0) {
|
||||||
|
// `pdflibAddPlaceholder` is used to add code of only digitial sign without widget
|
||||||
|
const pdfDoc = await PDFDocument.load(PdfBuffer);
|
||||||
|
pdflibAddPlaceholder({
|
||||||
|
pdfDoc: pdfDoc,
|
||||||
|
reason: 'Digitally signed by OpenSign for ' + signersName?.join(', '),
|
||||||
|
location: 'n/a',
|
||||||
|
name: eSignName,
|
||||||
|
contactInfo: eSigncontact,
|
||||||
|
signatureLength: 15000,
|
||||||
|
});
|
||||||
|
const pdfWithPlaceholderBytes = await pdfDoc.save();
|
||||||
|
PdfBuffer = Buffer.from(pdfWithPlaceholderBytes);
|
||||||
|
} else {
|
||||||
|
// `pdflibAddPlaceholder` is used to add code of only digitial sign without widget (signyourself)
|
||||||
|
const pdfDoc = await PDFDocument.load(PdfBuffer);
|
||||||
|
pdflibAddPlaceholder({
|
||||||
|
pdfDoc: pdfDoc,
|
||||||
|
reason: 'Digitally signed by OpenSign for ' + username + ' <' + userEmail + '>',
|
||||||
|
location: 'n/a',
|
||||||
|
name: eSignName,
|
||||||
|
contactInfo: eSigncontact,
|
||||||
|
signatureLength: 15000,
|
||||||
|
});
|
||||||
|
const pdfWithPlaceholderBytes = await pdfDoc.save();
|
||||||
|
PdfBuffer = Buffer.from(pdfWithPlaceholderBytes);
|
||||||
|
}
|
||||||
|
//`new signPDF` create new instance of pdfBuffer and p12Buffer
|
||||||
|
const OBJ = new SignPdf();
|
||||||
|
// `signedDocs` is used to signpdf digitally
|
||||||
|
const signedDocs = await OBJ.sign(PdfBuffer, p12Cert);
|
||||||
|
|
||||||
|
//`saveUrl` is used to save signed pdf in exports folder
|
||||||
|
const saveUrl = fs.writeFileSync(pdfName, signedDocs);
|
||||||
|
pdfSize = signedDocs.length;
|
||||||
|
} else {
|
||||||
|
//`saveUrl` is used to save signed pdf in exports folder
|
||||||
|
const saveUrl = fs.writeFileSync(pdfName, PdfBuffer);
|
||||||
|
pdfSize = PdfBuffer.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
// `uploadFile` is used to upload pdf to aws s3 and get it's url
|
||||||
|
const data = await uploadFile(name, pdfName);
|
||||||
|
|
||||||
|
if (data && data.imageUrl) {
|
||||||
|
// `axios` is used to update signed pdf url in contracts_Document classes for given DocId
|
||||||
|
const updatedDoc = await updateDoc(
|
||||||
|
req.params.docId, //docId
|
||||||
|
data.imageUrl, // url
|
||||||
|
signUser.objectId, // userID
|
||||||
|
userIP, // client ipAddress,
|
||||||
|
_resDoc, // auditTrail, signers, etc data
|
||||||
|
className, // className based on flow
|
||||||
|
sign // sign base64
|
||||||
|
);
|
||||||
|
sendDoctoWebhook(_resDoc, data.imageUrl, 'signed', signUser);
|
||||||
|
saveFileUsage(pdfSize, data.imageUrl, _resDoc?.CreatedBy?.objectId);
|
||||||
|
if (updatedDoc && updatedDoc.isCompleted) {
|
||||||
|
const doc = { ..._resDoc, AuditTrail: updatedDoc.AuditTrail };
|
||||||
|
sendMailsaveCertifcate(
|
||||||
|
doc,
|
||||||
|
P12Buffer,
|
||||||
|
data.imageUrl,
|
||||||
|
isCustomMail,
|
||||||
|
mailProvider,
|
||||||
|
_resDoc?.CreatedBy?.objectId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// `fs.unlinkSync` is used to remove exported signed pdf file from exports folder
|
||||||
|
fs.unlinkSync(pdfName);
|
||||||
|
console.log(`New Signed PDF created called: ${pdfName}`);
|
||||||
|
if (updatedDoc.message === 'success') {
|
||||||
|
return { status: 'success', data: data.imageUrl };
|
||||||
|
} else {
|
||||||
|
const error = new Error('Please provide required parameters!');
|
||||||
|
error.code = 400; // Set the error code (e.g., 400 for bad request)
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const error = new Error('Pdf file not present!');
|
||||||
|
error.code = 400; // Set the error code (e.g., 400 for bad request)
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Err in signpdf', err);
|
console.log('Err in signpdf', err);
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ export default function reportJson(id, userId) {
|
|||||||
'Folder.Name',
|
'Folder.Name',
|
||||||
'URL',
|
'URL',
|
||||||
'ExtUserPtr.Name',
|
'ExtUserPtr.Name',
|
||||||
|
'ExtUserPtr.Email',
|
||||||
|
'ExtUserPtr.active_mail_adapter',
|
||||||
'Signers.Name',
|
'Signers.Name',
|
||||||
'Signers.Email',
|
'Signers.Email',
|
||||||
'Signers.Phone',
|
'Signers.Phone',
|
||||||
@@ -100,6 +102,8 @@ export default function reportJson(id, userId) {
|
|||||||
'Folder.Name',
|
'Folder.Name',
|
||||||
'URL',
|
'URL',
|
||||||
'ExtUserPtr.Name',
|
'ExtUserPtr.Name',
|
||||||
|
'ExtUserPtr.Email',
|
||||||
|
'ExtUserPtr.active_mail_adapter',
|
||||||
'Signers.Name',
|
'Signers.Name',
|
||||||
'Signers.Email',
|
'Signers.Email',
|
||||||
'Signers.Phone',
|
'Signers.Phone',
|
||||||
@@ -139,6 +143,7 @@ export default function reportJson(id, userId) {
|
|||||||
'TimeToCompleteDays',
|
'TimeToCompleteDays',
|
||||||
'Placeholders',
|
'Placeholders',
|
||||||
'IsSignyourself',
|
'IsSignyourself',
|
||||||
|
'IsCompleted',
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
// declined documents report
|
// declined documents report
|
||||||
@@ -227,6 +232,8 @@ export default function reportJson(id, userId) {
|
|||||||
'Folder.Name',
|
'Folder.Name',
|
||||||
'URL',
|
'URL',
|
||||||
'ExtUserPtr.Name',
|
'ExtUserPtr.Name',
|
||||||
|
'ExtUserPtr.Email',
|
||||||
|
'ExtUserPtr.active_mail_adapter',
|
||||||
'Signers.Name',
|
'Signers.Name',
|
||||||
'Signers.Email',
|
'Signers.Email',
|
||||||
'Signers.Phone',
|
'Signers.Phone',
|
||||||
@@ -268,6 +275,8 @@ export default function reportJson(id, userId) {
|
|||||||
'Name',
|
'Name',
|
||||||
'URL',
|
'URL',
|
||||||
'ExtUserPtr.Name',
|
'ExtUserPtr.Name',
|
||||||
|
'ExtUserPtr.Email',
|
||||||
|
'ExtUserPtr.active_mail_adapter',
|
||||||
'Signers.Name',
|
'Signers.Name',
|
||||||
'Signers.UserId',
|
'Signers.UserId',
|
||||||
'AuditTrail',
|
'AuditTrail',
|
||||||
@@ -335,6 +344,7 @@ export default function reportJson(id, userId) {
|
|||||||
'Folder.Name',
|
'Folder.Name',
|
||||||
'URL',
|
'URL',
|
||||||
'ExtUserPtr.Name',
|
'ExtUserPtr.Name',
|
||||||
|
'ExtUserPtr.active_mail_adapter',
|
||||||
'Signers.Name',
|
'Signers.Name',
|
||||||
'Signers.Email',
|
'Signers.Email',
|
||||||
'Signers.Phone',
|
'Signers.Phone',
|
||||||
|
|||||||
@@ -68,7 +68,11 @@ const makeEmail = async (to, from, subject, html, url, pdfName) => {
|
|||||||
type: 'application/pdf',
|
type: 'application/pdf',
|
||||||
path: './exports/certificate.pdf',
|
path: './exports/certificate.pdf',
|
||||||
};
|
};
|
||||||
attachments = [file, certificate];
|
if (fs.existsSync(certificate.path)) {
|
||||||
|
attachments = [file, certificate];
|
||||||
|
} else {
|
||||||
|
attachments = [file];
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
attachments = [file];
|
attachments = [file];
|
||||||
console.log('Err in read certificate sendmailv3', err);
|
console.log('Err in read certificate sendmailv3', err);
|
||||||
@@ -143,6 +147,14 @@ export default async function sendMailGmailProvider(_extRes, template) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log('gmail provider res: ', response?.status);
|
console.log('gmail provider res: ', response?.status);
|
||||||
|
const certificatePath = './exports/certificate.pdf';
|
||||||
|
if (fs.existsSync(certificatePath)) {
|
||||||
|
try {
|
||||||
|
fs.unlinkSync(certificatePath);
|
||||||
|
} catch (err) {
|
||||||
|
console.log('Err in unlink certificate sendmailgmail provider');
|
||||||
|
}
|
||||||
|
}
|
||||||
return { code: 200, message: 'Email sent successfully' };
|
return { code: 200, message: 'Email sent successfully' };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error sending email:', error);
|
console.error('Error sending email:', error);
|
||||||
|
|||||||
@@ -187,6 +187,111 @@ async function sendMailProvider(req, plan, monthchange) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
async function sendcustomsmtp(extRes, req) {
|
||||||
|
const smtpsecure = extRes.SmtpConfig.port !== '465' ? false : true;
|
||||||
|
const transporterSMTP = createTransport({
|
||||||
|
host: extRes.SmtpConfig.host,
|
||||||
|
port: extRes.SmtpConfig.port,
|
||||||
|
secure: smtpsecure,
|
||||||
|
auth: { user: extRes.SmtpConfig.username, pass: extRes.SmtpConfig.password },
|
||||||
|
});
|
||||||
|
if (req.params.url) {
|
||||||
|
let Pdf = fs.createWriteStream('test.pdf');
|
||||||
|
const writeToLocalDisk = () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (useLocal !== 'true') {
|
||||||
|
https.get(req.params.url, async function (response) {
|
||||||
|
response.pipe(Pdf);
|
||||||
|
response.on('end', () => resolve('success'));
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const path = new URL(req.params.url)?.pathname;
|
||||||
|
const localurl = 'http://localhost:8080' + path;
|
||||||
|
http.get(localurl, async function (response) {
|
||||||
|
response.pipe(Pdf);
|
||||||
|
response.on('end', () => resolve('success'));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
// `writeToLocalDisk` is used to create pdf file from doc url
|
||||||
|
const ress = await writeToLocalDisk();
|
||||||
|
if (ress) {
|
||||||
|
function readTolocal() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
let PdfBuffer = fs.readFileSync(Pdf.path);
|
||||||
|
resolve(PdfBuffer);
|
||||||
|
}, 100);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// `PdfBuffer` used to create buffer from pdf file
|
||||||
|
let PdfBuffer = await readTolocal();
|
||||||
|
const pdfName = req.params.pdfName ? `${req.params.pdfName}.pdf` : 'exported.pdf';
|
||||||
|
const file = { filename: pdfName, content: PdfBuffer };
|
||||||
|
let attachment;
|
||||||
|
const certificatePath = './exports/certificate.pdf';
|
||||||
|
if (fs.existsSync(certificatePath)) {
|
||||||
|
try {
|
||||||
|
// `certificateBuffer` used to create buffer from pdf file
|
||||||
|
const certificateBuffer = fs.readFileSync(certificatePath);
|
||||||
|
const certificate = { filename: 'certificate.pdf', content: certificateBuffer };
|
||||||
|
attachment = [file, certificate];
|
||||||
|
} catch (err) {
|
||||||
|
attachment = [file];
|
||||||
|
console.log('Err in read certificate sendmailv3', err);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
attachment = [file];
|
||||||
|
}
|
||||||
|
const from = req.params.from || '';
|
||||||
|
const mailsender = extRes.SmtpConfig.username;
|
||||||
|
|
||||||
|
const messageParams = {
|
||||||
|
from: from + ' <' + mailsender + '>',
|
||||||
|
to: req.params.recipient,
|
||||||
|
subject: req.params.subject,
|
||||||
|
text: req.params.text || 'mail',
|
||||||
|
html: req.params.html || '',
|
||||||
|
attachments: attachment,
|
||||||
|
};
|
||||||
|
const res = await transporterSMTP.sendMail(messageParams);
|
||||||
|
console.log('custom smtp transporter res: ', res?.response);
|
||||||
|
if (!res.err) {
|
||||||
|
if (req.params?.extUserId) {
|
||||||
|
await updateMailCount(req.params.extUserId); //, plan, monthchange
|
||||||
|
}
|
||||||
|
if (fs.existsSync(certificatePath)) {
|
||||||
|
try {
|
||||||
|
fs.unlinkSync(certificatePath);
|
||||||
|
} catch (err) {
|
||||||
|
console.log('Err in unlink certificate sendmailv3');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return { status: 'success', code: 200 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const from = req.params.from || '';
|
||||||
|
const mailsender = extRes.SmtpConfig.username;
|
||||||
|
const messageParams = {
|
||||||
|
from: from + ' <' + mailsender + '>',
|
||||||
|
to: req.params.recipient,
|
||||||
|
subject: req.params.subject,
|
||||||
|
text: req.params.text || 'mail',
|
||||||
|
html: req.params.html || '',
|
||||||
|
};
|
||||||
|
|
||||||
|
const res = await transporterSMTP.sendMail(messageParams);
|
||||||
|
console.log('custom smtp transporter res: ', res?.response);
|
||||||
|
if (!res.err) {
|
||||||
|
if (req.params?.extUserId) {
|
||||||
|
await updateMailCount(req.params.extUserId); //, plan, monthchange
|
||||||
|
}
|
||||||
|
return { status: 'success', code: 200 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
async function sendmailv3(req) {
|
async function sendmailv3(req) {
|
||||||
const mailProvider = req.params.mailProvider || 'default';
|
const mailProvider = req.params.mailProvider || 'default';
|
||||||
if (mailProvider) {
|
if (mailProvider) {
|
||||||
@@ -206,7 +311,11 @@ async function sendmailv3(req) {
|
|||||||
const extRes = await extUserQuery.get(extUserId, { useMasterKey: true });
|
const extRes = await extUserQuery.get(extUserId, { useMasterKey: true });
|
||||||
if (extRes) {
|
if (extRes) {
|
||||||
const _extRes = JSON.parse(JSON.stringify(extRes));
|
const _extRes = JSON.parse(JSON.stringify(extRes));
|
||||||
if (_extRes.google_refresh_token && mailProvider === 'google') {
|
if (
|
||||||
|
_extRes.active_mail_adapter === 'google' &&
|
||||||
|
_extRes.google_refresh_token &&
|
||||||
|
mailProvider === 'google'
|
||||||
|
) {
|
||||||
const res = await sendMailGmailProvider(_extRes, template);
|
const res = await sendMailGmailProvider(_extRes, template);
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
await updateMailCount(req.params.extUserId);
|
await updateMailCount(req.params.extUserId);
|
||||||
@@ -214,6 +323,14 @@ async function sendmailv3(req) {
|
|||||||
} else {
|
} else {
|
||||||
return { status: 'error' };
|
return { status: 'error' };
|
||||||
}
|
}
|
||||||
|
} else if (_extRes.active_mail_adapter === 'smtp' && mailProvider === 'smtp') {
|
||||||
|
const res = await sendcustomsmtp(_extRes, req);
|
||||||
|
if (res.code === 200) {
|
||||||
|
await updateMailCount(req.params.extUserId);
|
||||||
|
return { status: 'success' };
|
||||||
|
} else {
|
||||||
|
return { status: 'error' };
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Plan && Plan === 'freeplan') {
|
if (Plan && Plan === 'freeplan') {
|
||||||
let MonthlyFreeEmails = _extRes?.MonthlyFreeEmails || 0;
|
let MonthlyFreeEmails = _extRes?.MonthlyFreeEmails || 0;
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
export default async function updateContactTour(request) {
|
||||||
|
const contactId = request.params.contactId;
|
||||||
|
try {
|
||||||
|
const contactCls = new Parse.Query('contracts_Contactbook');
|
||||||
|
const contactRes = await contactCls.get(contactId, { useMasterKey: true });
|
||||||
|
if (contactRes) {
|
||||||
|
const _contactRes = JSON.parse(JSON.stringify(contactRes));
|
||||||
|
const tourStatus = _contactRes?.TourStatus?.length > 0 ? _contactRes.TourStatus : [];
|
||||||
|
let updatedTourStatus = [];
|
||||||
|
if (tourStatus.length > 0) {
|
||||||
|
updatedTourStatus = [...tourStatus];
|
||||||
|
const requestSignIndex = tourStatus.findIndex(
|
||||||
|
obj => obj['requestSign'] === false || obj['requestSign'] === true
|
||||||
|
);
|
||||||
|
if (requestSignIndex !== -1) {
|
||||||
|
updatedTourStatus[requestSignIndex] = { requestSign: true };
|
||||||
|
} else {
|
||||||
|
updatedTourStatus.push({ requestSign: true });
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
updatedTourStatus = [{ requestSign: true }];
|
||||||
|
}
|
||||||
|
contactRes.set('TourStatus', updatedTourStatus);
|
||||||
|
const updateRes = await contactRes.save(null, { useMasterKey: true });
|
||||||
|
return updateRes;
|
||||||
|
} else {
|
||||||
|
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'contact not found.');
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log('Err in contracts_Contactbook class ', err);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {Parse} Parse
|
||||||
|
*/
|
||||||
|
exports.up = async Parse => {
|
||||||
|
const templateSchema = new Parse.Schema('contracts_Template');
|
||||||
|
templateSchema.addBoolean('IsEnableOTP');
|
||||||
|
await templateSchema.update();
|
||||||
|
|
||||||
|
const className = 'contracts_Document';
|
||||||
|
const schema = new Parse.Schema(className);
|
||||||
|
schema.addBoolean('IsEnableOTP');
|
||||||
|
return schema.update();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {Parse} Parse
|
||||||
|
*/
|
||||||
|
exports.down = async Parse => {
|
||||||
|
const templateSchema = new Parse.Schema('contracts_Template');
|
||||||
|
templateSchema.deleteField('IsEnableOTP');
|
||||||
|
await templateSchema.update();
|
||||||
|
|
||||||
|
const className = 'contracts_Document';
|
||||||
|
const schema = new Parse.Schema(className);
|
||||||
|
schema.deleteField('IsEnableOTP');
|
||||||
|
return schema.update();
|
||||||
|
};
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
<br />
|
<br />
|
||||||
<p><a href="{{{link}}}" style="background-color: lightskyblue; cursor: pointer; border-radius: 5px; padding: 10px; border-style: solid; border-width: 2px; text-decoration: none; font-weight: bolder; color:blue">Verify email</a></p>
|
<p><a href="{{{link}}}" style="background-color: lightskyblue; cursor: pointer; border-radius: 5px; padding: 10px; border-style: solid; border-width: 2px; text-decoration: none; font-weight: bolder; color:blue">Verify email</a></p>
|
||||||
<br />
|
<br />
|
||||||
<p><a href="https://www.opensignlabs.com">OpenSign™</a></p>
|
<p><a href="https://www.opensignlabs.com">{{appName}}</a></p>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
OpenSign™ Email Address Verification
|
{{appName}} Email Address Verification
|
||||||
@@ -17,7 +17,7 @@ import { exec } from 'child_process';
|
|||||||
import { createTransport } from 'nodemailer';
|
import { createTransport } from 'nodemailer';
|
||||||
import { app as v1 } from './cloud/customRoute/v1/apiV1.js';
|
import { app as v1 } from './cloud/customRoute/v1/apiV1.js';
|
||||||
import { PostHog } from 'posthog-node';
|
import { PostHog } from 'posthog-node';
|
||||||
import { cloudServerUrl, smtpenable, smtpsecure, useLocal } from './Utils.js';
|
import { appName, cloudServerUrl, smtpenable, smtpsecure, useLocal } from './Utils.js';
|
||||||
import { SSOAuth } from './auth/authadapter.js';
|
import { SSOAuth } from './auth/authadapter.js';
|
||||||
let fsAdapter;
|
let fsAdapter;
|
||||||
if (useLocal !== 'true') {
|
if (useLocal !== 'true') {
|
||||||
@@ -102,7 +102,7 @@ export const config = {
|
|||||||
verifyUserEmails: false,
|
verifyUserEmails: false,
|
||||||
publicServerURL: process.env.SERVER_URL || cloudServerUrl,
|
publicServerURL: process.env.SERVER_URL || cloudServerUrl,
|
||||||
// Your apps name. This will appear in the subject and body of the emails that are sent.
|
// Your apps name. This will appear in the subject and body of the emails that are sent.
|
||||||
appName: 'Opensign',
|
appName: appName,
|
||||||
allowClientClassCreation: false,
|
allowClientClassCreation: false,
|
||||||
allowExpiredAuthDataToken: false,
|
allowExpiredAuthDataToken: false,
|
||||||
encodeParseObjectInCloudFunction: true,
|
encodeParseObjectInCloudFunction: true,
|
||||||
@@ -112,7 +112,7 @@ export const config = {
|
|||||||
module: 'parse-server-api-mail-adapter',
|
module: 'parse-server-api-mail-adapter',
|
||||||
options: {
|
options: {
|
||||||
// The email address from which emails are sent.
|
// The email address from which emails are sent.
|
||||||
sender: 'Opensign™' + ' <' + mailsender + '>',
|
sender: appName + ' <' + mailsender + '>',
|
||||||
// The email templates.
|
// The email templates.
|
||||||
templates: {
|
templates: {
|
||||||
// The template used by Parse Server to send an email for password
|
// The template used by Parse Server to send an email for password
|
||||||
@@ -141,12 +141,7 @@ export const config = {
|
|||||||
}
|
}
|
||||||
: {}),
|
: {}),
|
||||||
filesAdapter: fsAdapter,
|
filesAdapter: fsAdapter,
|
||||||
auth: {
|
auth: { google: { enabled: true }, sso: SSOAuth },
|
||||||
google: {
|
|
||||||
enabled: true,
|
|
||||||
},
|
|
||||||
sso: SSOAuth,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
// Client-keys like the javascript key or the .NET key are not necessary with parse-server
|
// Client-keys like the javascript key or the .NET key are not necessary with parse-server
|
||||||
// If you wish you require them, you can set them as options in the initialization above:
|
// If you wish you require them, you can set them as options in the initialization above:
|
||||||
|
|||||||
Generated
+256
-736
File diff suppressed because it is too large
Load Diff
@@ -24,24 +24,24 @@
|
|||||||
"@signpdf/placeholder-pdf-lib": "^3.2.4",
|
"@signpdf/placeholder-pdf-lib": "^3.2.4",
|
||||||
"@signpdf/signer-p12": "^3.2.4",
|
"@signpdf/signer-p12": "^3.2.4",
|
||||||
"@signpdf/signpdf": "^3.2.4",
|
"@signpdf/signpdf": "^3.2.4",
|
||||||
"aws-sdk": "^2.1687.0",
|
"aws-sdk": "^2.1691.0",
|
||||||
"axios": "^1.7.7",
|
"axios": "^1.7.7",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"express": "^4.21.0",
|
"express": "^4.21.0",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
"generate-api-key": "^1.0.2",
|
"generate-api-key": "^1.0.2",
|
||||||
"googleapis": "^140.0.1",
|
"googleapis": "^144.0.0",
|
||||||
"jsonschema": "^1.4.1",
|
"jsonschema": "^1.4.1",
|
||||||
"mailgun.js": "^10.2.3",
|
"mailgun.js": "^10.2.3",
|
||||||
"mongoose": "^8.6.1",
|
"mongoose": "^8.6.3",
|
||||||
"multer": "^1.4.5-lts.1",
|
"multer": "^1.4.5-lts.1",
|
||||||
"multer-s3": "^3.0.1",
|
"multer-s3": "^3.0.1",
|
||||||
"node-forge": "^1.3.1",
|
"node-forge": "^1.3.1",
|
||||||
"nodemailer": "^6.9.15",
|
"nodemailer": "^6.9.15",
|
||||||
"parse": "^5.3.0",
|
"parse": "^5.3.0",
|
||||||
"parse-dbtool": "^1.2.0",
|
"parse-dbtool": "^1.2.0",
|
||||||
"parse-server": "^7.2.0",
|
"parse-server": "^7.3.0-alpha.8",
|
||||||
"parse-server-api-mail-adapter": "^4.0.0",
|
"parse-server-api-mail-adapter": "^4.0.0",
|
||||||
"pdf-lib": "^1.17.1",
|
"pdf-lib": "^1.17.1",
|
||||||
"posthog-node": "^4.2.0",
|
"posthog-node": "^4.2.0",
|
||||||
@@ -50,11 +50,11 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/eslint-parser": "^7.25.1",
|
"@babel/eslint-parser": "^7.25.1",
|
||||||
"eslint": "^9.9.1",
|
"eslint": "^9.11.1",
|
||||||
"jasmine": "^5.3.0",
|
"jasmine": "^5.3.0",
|
||||||
"mongodb-runner": "^5.6.6",
|
"mongodb-runner": "^5.6.6",
|
||||||
"nodemon": "^3.1.4",
|
"nodemon": "^3.1.7",
|
||||||
"nyc": "^17.0.0",
|
"nyc": "^17.1.0",
|
||||||
"prettier": "^3.3.3"
|
"prettier": "^3.3.3"
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
|
|||||||
Reference in New Issue
Block a user