mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-09-04 16:58:05 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5af1e8a17 | ||
|
|
fab7998e22 | ||
|
|
4a4db6851e | ||
|
|
870973e7f3 | ||
|
|
4146680c1e | ||
|
|
d9fcc69ca4 | ||
|
|
d1c405912b | ||
|
|
745aca1754 | ||
|
|
672eeea851 | ||
|
|
98efff65c9 | ||
|
|
fe21978538 | ||
|
|
ca4ccfd889 | ||
|
|
6cb2d69566 | ||
|
|
98b9ebb228 |
@@ -3,13 +3,13 @@
|
|||||||
"version": "2.26.0",
|
"version": "2.26.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@formkit/auto-animate": "^0.8.4",
|
"@formkit/auto-animate": "^0.9.0",
|
||||||
"@imgly/background-removal": "^1.7.0",
|
"@imgly/background-removal": "^1.7.0",
|
||||||
"@lottiefiles/dotlottie-react": "^0.15.2",
|
"@lottiefiles/dotlottie-react": "^0.16.2",
|
||||||
"@pdf-lib/fontkit": "^1.1.1",
|
"@pdf-lib/fontkit": "^1.1.1",
|
||||||
"@radix-ui/themes": "^3.2.1",
|
"@radix-ui/themes": "^3.2.1",
|
||||||
"@reduxjs/toolkit": "^2.8.2",
|
"@reduxjs/toolkit": "^2.8.2",
|
||||||
"axios": "^1.11.0",
|
"axios": "^1.12.2",
|
||||||
"date-fns-tz": "^3.2.0",
|
"date-fns-tz": "^3.2.0",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
"i18next": "^25.4.0",
|
"i18next": "^25.4.0",
|
||||||
@@ -36,13 +36,13 @@
|
|||||||
"react-dom": "^18.3.1",
|
"react-dom": "^18.3.1",
|
||||||
"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.7.3",
|
"react-i18next": "^15.7.4",
|
||||||
"react-konva": "^18.2.12",
|
"react-konva": "^18.2.12",
|
||||||
"react-pdf": "^9.2.1",
|
"react-pdf": "^9.2.1",
|
||||||
"react-quill-new": "^3.6.0",
|
"react-quill-new": "^3.6.0",
|
||||||
"react-redux": "^9.2.0",
|
"react-redux": "^9.2.0",
|
||||||
"react-rnd": "^10.5.2",
|
"react-rnd": "^10.5.2",
|
||||||
"react-router": "^7.8.2",
|
"react-router": "^7.9.3",
|
||||||
"react-scrollbars-custom": "^4.1.1",
|
"react-scrollbars-custom": "^4.1.1",
|
||||||
"react-select": "^5.10.2",
|
"react-select": "^5.10.2",
|
||||||
"react-signature-canvas": "^1.1.0-alpha.2",
|
"react-signature-canvas": "^1.1.0-alpha.2",
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
"reactour": "^1.19.4",
|
"reactour": "^1.19.4",
|
||||||
"redux": "^5.0.1",
|
"redux": "^5.0.1",
|
||||||
"regex-parser": "^2.3.1",
|
"regex-parser": "^2.3.1",
|
||||||
"serve": "^14.2.4",
|
"serve": "^14.2.5",
|
||||||
"styled-components": "^5.3.11",
|
"styled-components": "^5.3.11",
|
||||||
"web-vitals": "^5.1.0",
|
"web-vitals": "^5.1.0",
|
||||||
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
|
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
"@testing-library/jest-dom": "^6.8.0",
|
"@testing-library/jest-dom": "^6.8.0",
|
||||||
"@testing-library/react": "^16.3.0",
|
"@testing-library/react": "^16.3.0",
|
||||||
"@testing-library/user-event": "^14.6.1",
|
"@testing-library/user-event": "^14.6.1",
|
||||||
"@types/react": "^19.1.12",
|
"@types/react": "^19.1.13",
|
||||||
"@vitejs/plugin-react": "^4.7.0",
|
"@vitejs/plugin-react": "^4.7.0",
|
||||||
"@vitest/ui": "^3.2.4",
|
"@vitest/ui": "^3.2.4",
|
||||||
"autoprefixer": "^10.4.21",
|
"autoprefixer": "^10.4.21",
|
||||||
@@ -113,7 +113,7 @@
|
|||||||
"eslint": "^9.34.0",
|
"eslint": "^9.34.0",
|
||||||
"eslint-plugin-prettier": "^5.5.4",
|
"eslint-plugin-prettier": "^5.5.4",
|
||||||
"eslint-plugin-react": "^7.37.5",
|
"eslint-plugin-react": "^7.37.5",
|
||||||
"jsdom": "^26.1.0",
|
"jsdom": "^27.0.0",
|
||||||
"lint-staged": "^16.1.6",
|
"lint-staged": "^16.1.6",
|
||||||
"postcss": "^8.5.6",
|
"postcss": "^8.5.6",
|
||||||
"prettier": "^3.6.2",
|
"prettier": "^3.6.2",
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
"dark-mode": "Dunkelmodus",
|
"dark-mode": "Dunkelmodus",
|
||||||
"name": "Name",
|
"name": "Name",
|
||||||
"phone": "Telefon",
|
"phone": "Telefon",
|
||||||
"phone-optional": "optional",
|
"phone-optional": "Optional",
|
||||||
"email": "E-Mail",
|
"email": "E-Mail",
|
||||||
"company": "Unternehmen",
|
"company": "Unternehmen",
|
||||||
"job-title": "Berufsbezeichnung",
|
"job-title": "Berufsbezeichnung",
|
||||||
@@ -165,7 +165,8 @@
|
|||||||
"daily-mail-quota": "Tägliches E-Mail-Kontingent",
|
"daily-mail-quota": "Tägliches E-Mail-Kontingent",
|
||||||
"Save as template": "Als Vorlage speichern",
|
"Save as template": "Als Vorlage speichern",
|
||||||
"Fix & resend": "Korrigieren und erneut senden",
|
"Fix & resend": "Korrigieren und erneut senden",
|
||||||
"Kiosk Mode": "Kiosk Modus"
|
"Kiosk Mode": "Kiosk Modus",
|
||||||
|
"Reset password": "Passwort zurücksetzen"
|
||||||
},
|
},
|
||||||
"report-heading": {
|
"report-heading": {
|
||||||
"Sr.No": "Nr.",
|
"Sr.No": "Nr.",
|
||||||
@@ -901,6 +902,10 @@
|
|||||||
"thanks-for-feedback": "Danke für Ihr Feedback 🙏",
|
"thanks-for-feedback": "Danke für Ihr Feedback 🙏",
|
||||||
"share-your-feedback": "Teilen Sie Ihr Feedback",
|
"share-your-feedback": "Teilen Sie Ihr Feedback",
|
||||||
"share-your-review": "Teilen Sie Ihre Bewertung",
|
"share-your-review": "Teilen Sie Ihre Bewertung",
|
||||||
|
"please-select-rating": "Bitte wählen Sie eine Bewertung aus",
|
||||||
|
"feedback-optional": "Feedback (optional)",
|
||||||
|
"feedback-saved": "Feedback wurde gespeichert.",
|
||||||
|
"feedback-save-error": "Feedback konnte nicht gespeichert werden, bitte versuchen Sie es erneut.",
|
||||||
"date-format": "Datumsformat",
|
"date-format": "Datumsformat",
|
||||||
"document-deleted": "Das Dokument wurde gelöscht oder Sie haben keinen Zugriff. Bitte kontaktieren Sie den Absender.",
|
"document-deleted": "Das Dokument wurde gelöscht oder Sie haben keinen Zugriff. Bitte kontaktieren Sie den Absender.",
|
||||||
"save-as-template-?": "Sind Sie sicher, dass Sie dieses Dokument als Vorlage speichern möchten?",
|
"save-as-template-?": "Sind Sie sicher, dass Sie dieses Dokument als Vorlage speichern möchten?",
|
||||||
@@ -1210,5 +1215,32 @@
|
|||||||
"otp-email": "Wir haben einen Bestätigungscode gesendet",
|
"otp-email": "Wir haben einen Bestätigungscode gesendet",
|
||||||
"save-as-temp-warn": "Hinweis: Dieses Dokument enthält vorausgefüllte Widgets, die automatisch entfernt werden, da sie bereits im Basisdokument integriert sind.",
|
"save-as-temp-warn": "Hinweis: Dieses Dokument enthält vorausgefüllte Widgets, die automatisch entfernt werden, da sie bereits im Basisdokument integriert sind.",
|
||||||
"edit-document": "Dokument bearbeiten",
|
"edit-document": "Dokument bearbeiten",
|
||||||
"otp-email": "Wir haben einen Bestätigungscode gesendet"
|
"modify": "Ändern",
|
||||||
}
|
"merge-certificate-to-pdf": "Zertifikat mit PDF zusammenführen",
|
||||||
|
"merge-cc-to-pdf-help": {
|
||||||
|
"p1": "Dies stellt sicher, dass das Abschlusszertifikat im endgültigen PDF-Dokument enthalten ist. Bitte beachten Sie jedoch, dass das Zertifikat nach dem Zusammenführen nicht mehr vom Hauptdokument getrennt werden kann.",
|
||||||
|
"p2": "Wenn Sie sich entscheiden, nicht zusammenzuführen, wird das Abschlusszertifikat als separate PDF-Datei zusammen mit dem unterzeichneten Dokument bereitgestellt."
|
||||||
|
},
|
||||||
|
"read-only-date-error": "Das schreibgeschützte Datums-Widget muss ein Standarddatum haben.",
|
||||||
|
"set-date": "Datum festlegen",
|
||||||
|
"set-today": "Unterzeichnungsdatum",
|
||||||
|
"enter-name": "Name eingeben",
|
||||||
|
"enter-email": "E-Mail eingeben",
|
||||||
|
"subscribe-to-opensign-msg": "Abonnieren Sie {{appName}} und genießen Sie unbegrenzt kostenlose digitale Signaturen.",
|
||||||
|
"duplicate-subscribe-msg": "Mit Duplizieren können Sie eine exakte Kopie der ausgewählten Vorlage erstellen, die Sie wiederverwenden oder ändern können, ohne das Original zu beeinflussen.",
|
||||||
|
"save-as-template-msg": "Speichern Sie dieses Dokument als wiederverwendbare Vorlage, die Sie für zukünftige Dokumente erneut nutzen können.",
|
||||||
|
"public-credit-alert": "Das Signieren über diesen Link verbraucht Ihre kostenlosen E-Mail-Credits. Als kostenloser Nutzer erhalten Sie 15 E-Mail-Credits pro Monat, um zu verhindern, dass Spammer unsere Systeme missbrauchen. Um höhere Limits und ununterbrochenen Zugriff zu genießen, abonnieren Sie die <1>OpenSign™-Bezahlpläne.</1>",
|
||||||
|
"know-more-about": "Mehr erfahren über",
|
||||||
|
"free-unlimited-signatures": "Kostenlose unbegrenzte Signaturen",
|
||||||
|
"email-quota-updated": "Tägliches E-Mail-Kontingent erfolgreich aktualisiert.",
|
||||||
|
"password-has-been-reset": "Passwort wurde zurückgesetzt.",
|
||||||
|
"Unauthorized to reset your own password.": "Nicht berechtigt, Ihr eigenes Passwort zurückzusetzen.",
|
||||||
|
"User not found or not allowed.": "Benutzer nicht gefunden oder nicht erlaubt.",
|
||||||
|
"User not found.": "Benutzer nicht gefunden.",
|
||||||
|
"Admin user tenant not found.": "Admin-Benutzer-Tenant nicht gefunden.",
|
||||||
|
"User is not authenticated.": "Benutzer ist nicht authentifiziert.",
|
||||||
|
"Please provide required parameters.": "Bitte geben Sie die erforderlichen Parameter an.",
|
||||||
|
"reset-password": "Benutzerpasswort zurücksetzen",
|
||||||
|
"enter-strong-password": "Geben Sie ein sicheres Passwort ein oder generieren Sie eines automatisch.",
|
||||||
|
"autogenerate": "Automatisch generieren"
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
"dark-mode": "Dark mode",
|
"dark-mode": "Dark mode",
|
||||||
"name": "Name",
|
"name": "Name",
|
||||||
"phone": "Phone",
|
"phone": "Phone",
|
||||||
"phone-optional": "optional",
|
"phone-optional": "Optional",
|
||||||
"email": "Email",
|
"email": "Email",
|
||||||
"company": "Company",
|
"company": "Company",
|
||||||
"job-title": "Job title",
|
"job-title": "Job title",
|
||||||
@@ -165,7 +165,8 @@
|
|||||||
"daily-mail-quota": "Daily Email Quota",
|
"daily-mail-quota": "Daily Email Quota",
|
||||||
"Save as template": "Save as template",
|
"Save as template": "Save as template",
|
||||||
"Fix & resend": "Fix & Resend",
|
"Fix & resend": "Fix & Resend",
|
||||||
"Kiosk Mode": "Kiosk Mode"
|
"Kiosk Mode": "Kiosk Mode",
|
||||||
|
"Reset password": "Reset password"
|
||||||
},
|
},
|
||||||
"report-heading": {
|
"report-heading": {
|
||||||
"Sr.No": "Sr.No",
|
"Sr.No": "Sr.No",
|
||||||
@@ -902,6 +903,10 @@
|
|||||||
"thanks-for-feedback": "Thanks for your feedback 🙏",
|
"thanks-for-feedback": "Thanks for your feedback 🙏",
|
||||||
"share-your-feedback": "Share your feedback",
|
"share-your-feedback": "Share your feedback",
|
||||||
"share-your-review": "Share your review",
|
"share-your-review": "Share your review",
|
||||||
|
"please-select-rating": "Please select a rating",
|
||||||
|
"feedback-optional": "Feedback (Optional)",
|
||||||
|
"feedback-saved": "Feedback has been saved.",
|
||||||
|
"feedback-save-error": "Unable to save feedback, please try again.",
|
||||||
"date-format": "Date format",
|
"date-format": "Date format",
|
||||||
"document-deleted": "The document has been deleted or you don't have access. Please contact the sender.",
|
"document-deleted": "The document has been deleted or you don't have access. Please contact the sender.",
|
||||||
"save-as-template-?": "Are you sure you want to save this document as template?",
|
"save-as-template-?": "Are you sure you want to save this document as template?",
|
||||||
@@ -1208,8 +1213,35 @@
|
|||||||
"enter-region-of-space": "Enter region of space",
|
"enter-region-of-space": "Enter region of space",
|
||||||
"enter-access-key": "Enter access key",
|
"enter-access-key": "Enter access key",
|
||||||
"enter-secret-access-key": "Enter secret access key",
|
"enter-secret-access-key": "Enter secret access key",
|
||||||
"otp-email":"We’ve sent a verification code to",
|
"otp-email": "We've sent a verification code to",
|
||||||
"save-as-temp-warn":"Note: This document includes prefilled widgets, which will be automatically removed as they are already incorporated into the base document.",
|
"save-as-temp-warn": "Note: This document includes prefilled widgets, which will be automatically removed as they are already incorporated into the base document.",
|
||||||
"edit-document": "Edit document",
|
"edit-document": "Edit document",
|
||||||
"otp-email":"We've sent a verification code to"
|
"modify": "Modify",
|
||||||
}
|
"merge-certificate-to-pdf": "Merge Certificate to PDF",
|
||||||
|
"merge-cc-to-pdf-help": {
|
||||||
|
"p1": "This will ensure that the completion certificate is included in the final PDF document. However, please note that once merged, the certificate cannot be separated from the main document.",
|
||||||
|
"p2": "If you choose not to merge, the completion certificate will be provided as a separate PDF file along with the signed document."
|
||||||
|
},
|
||||||
|
"read-only-date-error": "Read-only date widget must have a default date.",
|
||||||
|
"set-date": "Set Date",
|
||||||
|
"set-today": "Signing Date",
|
||||||
|
"enter-name": "Enter name",
|
||||||
|
"enter-email": "Enter email",
|
||||||
|
"subscribe-to-opensign-msg": "Subscribe to {{appName}} and enjoy unlimited free digital signatures.",
|
||||||
|
"duplicate-subscribe-msg": "Duplicate lets you create an exact copy of the selected template, allowing you to reuse or modify it without affecting the original.",
|
||||||
|
"save-as-template-msg": "Save this document as a reusable template that you can use again for future documents.",
|
||||||
|
"public-credit-alert": "Signing through this link consumes your free email credits. As a Free user, you are allotted 15 email credits per month to prevent spammers from abusing our systems. To enjoy higher limits and uninterrupted access, Subscribe to <1>OpenSign™ Paid plans.</1>",
|
||||||
|
"know-more-about": "Know more about",
|
||||||
|
"free-unlimited-signatures": "Free Unlimited Signatures",
|
||||||
|
"email-quota-updated": "Daily email quota updated successfully.",
|
||||||
|
"password-has-been-reset": "Password has been reset.",
|
||||||
|
"Unauthorized to reset your own password.": "Unauthorized to reset your own password.",
|
||||||
|
"User not found or not allowed.": "User not found or not allowed.",
|
||||||
|
"User not found.": "User not found.",
|
||||||
|
"Admin user tenant not found.": "Admin user tenant not found.",
|
||||||
|
"User is not authenticated.": "User is not authenticated.",
|
||||||
|
"Please provide required parameters.": "Please provide required parameters.",
|
||||||
|
"reset-password": "Reset User Password",
|
||||||
|
"enter-strong-password": "Enter a strong password or auto-generate one.",
|
||||||
|
"autogenerate": "Autogenerate"
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
"dark-mode": "Modo oscuro",
|
"dark-mode": "Modo oscuro",
|
||||||
"name": "Nombre",
|
"name": "Nombre",
|
||||||
"phone": "Teléfono",
|
"phone": "Teléfono",
|
||||||
"phone-optional": "opcional",
|
"phone-optional": "Opcional",
|
||||||
"email": "Correo",
|
"email": "Correo",
|
||||||
"company": "Compañía",
|
"company": "Compañía",
|
||||||
"job-title": "Título del puesto",
|
"job-title": "Título del puesto",
|
||||||
@@ -165,7 +165,8 @@
|
|||||||
"daily-mail-quota": "Cuota diaria de correos electrónicos",
|
"daily-mail-quota": "Cuota diaria de correos electrónicos",
|
||||||
"Save as template": "Guardar como plantilla",
|
"Save as template": "Guardar como plantilla",
|
||||||
"Fix & resend": "Corregir y reenviar",
|
"Fix & resend": "Corregir y reenviar",
|
||||||
"Kiosk Mode": "Modo Kiosco"
|
"Kiosk Mode": "Modo Kiosco",
|
||||||
|
"Reset password": "Restablecer contraseña"
|
||||||
},
|
},
|
||||||
"report-heading": {
|
"report-heading": {
|
||||||
"Sr.No": "Nº",
|
"Sr.No": "Nº",
|
||||||
@@ -902,6 +903,10 @@
|
|||||||
"thanks-for-feedback": "Gracias por su comentario 🙏",
|
"thanks-for-feedback": "Gracias por su comentario 🙏",
|
||||||
"share-your-feedback": "Comparta sus comentarios",
|
"share-your-feedback": "Comparta sus comentarios",
|
||||||
"share-your-review": "Comparta su reseña",
|
"share-your-review": "Comparta su reseña",
|
||||||
|
"please-select-rating": "Por favor seleccione una calificación",
|
||||||
|
"feedback-optional": "Comentarios (opcional)",
|
||||||
|
"feedback-saved": "Los comentarios han sido guardados.",
|
||||||
|
"feedback-save-error": "No se pudieron guardar los comentarios, inténtelo de nuevo.",
|
||||||
"date-format": "Formato de fecha",
|
"date-format": "Formato de fecha",
|
||||||
"document-deleted": "El documento ha sido eliminado o no tiene acceso. Por favor, contacte al remitente.",
|
"document-deleted": "El documento ha sido eliminado o no tiene acceso. Por favor, contacte al remitente.",
|
||||||
"save-as-template-?": "¿Está seguro de que desea guardar este documento como plantilla?",
|
"save-as-template-?": "¿Está seguro de que desea guardar este documento como plantilla?",
|
||||||
@@ -1211,5 +1216,32 @@
|
|||||||
"otp-email": "Hemos enviado un código de verificación",
|
"otp-email": "Hemos enviado un código de verificación",
|
||||||
"save-as-temp-warn": "Nota: Este documento incluye widgets prellenados, que se eliminarán automáticamente ya que ya están incorporados en el documento base.",
|
"save-as-temp-warn": "Nota: Este documento incluye widgets prellenados, que se eliminarán automáticamente ya que ya están incorporados en el documento base.",
|
||||||
"edit-document": "Editar documento",
|
"edit-document": "Editar documento",
|
||||||
"otp-email": "Hemos enviado un código de verificación"
|
"modify": "Modificar",
|
||||||
}
|
"merge-certificate-to-pdf": "Combinar certificado con PDF",
|
||||||
|
"merge-cc-to-pdf-help": {
|
||||||
|
"p1": "Esto garantizará que el certificado de finalización esté incluido en el documento PDF final. Sin embargo, tenga en cuenta que una vez combinado, el certificado no se podrá separar del documento principal.",
|
||||||
|
"p2": "Si elige no combinar, el certificado de finalización se proporcionará como un archivo PDF separado junto con el documento firmado."
|
||||||
|
},
|
||||||
|
"read-only-date-error": "El widget de fecha de solo lectura debe tener una fecha predeterminada.",
|
||||||
|
"set-date": "Establecer fecha",
|
||||||
|
"set-today": "Fecha de firma",
|
||||||
|
"enter-name": "Ingrese nombre",
|
||||||
|
"enter-email": "Ingrese correo electrónico",
|
||||||
|
"subscribe-to-opensign-msg": "Suscríbase a {{appName}} y disfrute de firmas digitales gratuitas ilimitadas.",
|
||||||
|
"duplicate-subscribe-msg": "Duplicar le permite crear una copia exacta de la plantilla seleccionada, lo que le permite reutilizarla o modificarla sin afectar al original.",
|
||||||
|
"save-as-template-msg": "Guarde este documento como una plantilla reutilizable que podrá usar nuevamente para futuros documentos.",
|
||||||
|
"public-credit-alert": "Firmar a través de este enlace consumirá sus créditos de correo electrónico gratuitos. Como usuario gratuito, se le asignan 15 créditos de correo electrónico por mes para evitar que los spammers abusen de nuestros sistemas. Para disfrutar de límites más altos y acceso ininterrumpido, suscríbase a los planes de pago de <1>OpenSign™.</1>",
|
||||||
|
"know-more-about": "Saber más sobre",
|
||||||
|
"free-unlimited-signatures": "¿Firmas ilimitadas gratis",
|
||||||
|
"email-quota-updated": "La cuota diaria de correos se actualizó correctamente.",
|
||||||
|
"password-has-been-reset": "La contraseña ha sido restablecida.",
|
||||||
|
"Unauthorized to reset your own password.": "No está autorizado para restablecer su propia contraseña.",
|
||||||
|
"User not found or not allowed.": "Usuario no encontrado o no autorizado.",
|
||||||
|
"User not found.": "Usuario no encontrado.",
|
||||||
|
"Admin user tenant not found.": "Inquilino de usuario administrador no encontrado.",
|
||||||
|
"User is not authenticated.": "El usuario no está autenticado.",
|
||||||
|
"Please provide required parameters.": "Por favor, proporcione los parámetros requeridos.",
|
||||||
|
"reset-password": "Restablecer contraseña de usuario",
|
||||||
|
"enter-strong-password": "Ingrese una contraseña segura o genere una automáticamente.",
|
||||||
|
"autogenerate": "Generar automáticamente"
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
"dark-mode": "Mode sombre",
|
"dark-mode": "Mode sombre",
|
||||||
"name": "Nom et Prénom",
|
"name": "Nom et Prénom",
|
||||||
"phone": "Téléphone",
|
"phone": "Téléphone",
|
||||||
"phone-optional": "(facultatif)",
|
"phone-optional": "Optionnel",
|
||||||
"email": "E-mail",
|
"email": "E-mail",
|
||||||
"company": "Organisation",
|
"company": "Organisation",
|
||||||
"job-title": "Votre Fonction",
|
"job-title": "Votre Fonction",
|
||||||
@@ -200,7 +200,8 @@
|
|||||||
"daily-mail-quota": "Quota d'e-mails quotidien",
|
"daily-mail-quota": "Quota d'e-mails quotidien",
|
||||||
"Save as template": "Enregistrer comme modèle",
|
"Save as template": "Enregistrer comme modèle",
|
||||||
"Fix & resend": "Corriger et renvoyer",
|
"Fix & resend": "Corriger et renvoyer",
|
||||||
"Kiosk Mode": "Mode Kiosque"
|
"Kiosk Mode": "Mode Kiosque",
|
||||||
|
"Reset password": "Réinitialiser le mot de passe"
|
||||||
},
|
},
|
||||||
"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.",
|
||||||
@@ -426,7 +427,7 @@
|
|||||||
"initial-alert": "Mon initiale est introuvable",
|
"initial-alert": "Mon initiale est introuvable",
|
||||||
"copy-title": "Copier le widget vers",
|
"copy-title": "Copier le widget vers",
|
||||||
"contact-delete-alert": "Êtes-vous sûr de vouloir supprimer ce contact ?",
|
"contact-delete-alert": "Êtes-vous sûr de vouloir supprimer ce contact ?",
|
||||||
"reset-password": "Le lien de réinitialisation du mot de passe a été envoyé à votre identifiant de messagerie",
|
"reset-password-alert-1": "Le lien de réinitialisation du mot de passe a été envoyé à votre identifiant de messagerie",
|
||||||
"reset-password-alert-2": "Veuillez configurer l'adaptateur de messagerie",
|
"reset-password-alert-2": "Veuillez configurer l'adaptateur de messagerie",
|
||||||
"reset-password-alert-3": "Réinitialisez votre mot de passe",
|
"reset-password-alert-3": "Réinitialisez votre mot de passe",
|
||||||
"faild-animation": "Échec du chargement de l'animation",
|
"faild-animation": "Échec du chargement de l'animation",
|
||||||
@@ -901,6 +902,10 @@
|
|||||||
"thanks-for-feedback": "Merci pour votre retour 🙏",
|
"thanks-for-feedback": "Merci pour votre retour 🙏",
|
||||||
"share-your-feedback": "Partagez votre avis",
|
"share-your-feedback": "Partagez votre avis",
|
||||||
"share-your-review": "Partagez votre avis",
|
"share-your-review": "Partagez votre avis",
|
||||||
|
"please-select-rating": "Veuillez sélectionner une note",
|
||||||
|
"feedback-optional": "Retour (optionnel)",
|
||||||
|
"feedback-saved": "Le retour a été enregistré.",
|
||||||
|
"feedback-save-error": "Impossible d'enregistrer le retour, veuillez réessayer.",
|
||||||
"date-format": "Format de date",
|
"date-format": "Format de date",
|
||||||
"document-deleted": "Le document a été supprimé ou vous n'y avez pas accès. Veuillez contacter l'expéditeur.",
|
"document-deleted": "Le document a été supprimé ou vous n'y avez pas accès. Veuillez contacter l'expéditeur.",
|
||||||
"save-as-template-?": "Êtes-vous sûr de vouloir enregistrer ce document comme modèle ?",
|
"save-as-template-?": "Êtes-vous sûr de vouloir enregistrer ce document comme modèle ?",
|
||||||
@@ -1210,5 +1215,32 @@
|
|||||||
"otp-email": "Nous avons envoyé un code de vérification",
|
"otp-email": "Nous avons envoyé un code de vérification",
|
||||||
"save-as-temp-warn": "Remarque : Ce document contient des widgets préremplis, qui seront automatiquement supprimés car ils sont déjà intégrés dans le document de base.",
|
"save-as-temp-warn": "Remarque : Ce document contient des widgets préremplis, qui seront automatiquement supprimés car ils sont déjà intégrés dans le document de base.",
|
||||||
"edit-document": "Modifier le document",
|
"edit-document": "Modifier le document",
|
||||||
"otp-email": "Nous avons envoyé un code de vérification"
|
"modify": "Modifier",
|
||||||
}
|
"merge-certificate-to-pdf": "Fusionner le certificat avec le PDF",
|
||||||
|
"merge-cc-to-pdf-help": {
|
||||||
|
"p1": "Cela garantira que le certificat de finalisation est inclus dans le document PDF final. Cependant, veuillez noter qu'une fois fusionné, le certificat ne peut plus être séparé du document principal.",
|
||||||
|
"p2": "Si vous choisissez de ne pas fusionner, le certificat de finalisation sera fourni sous forme de fichier PDF distinct accompagné du document signé."
|
||||||
|
},
|
||||||
|
"read-only-date-error": "Le widget de date en lecture seule doit avoir une date par défaut.",
|
||||||
|
"set-date": "Définir la date",
|
||||||
|
"set-today": "Date de signature",
|
||||||
|
"enter-name": "Saisir le nom",
|
||||||
|
"enter-email": "Saisir l'e-mail",
|
||||||
|
"subscribe-to-opensign-msg": "Abonnez-vous à {{appName}} et profitez de signatures numériques gratuites illimitées.",
|
||||||
|
"duplicate-subscribe-msg": "Dupliquer vous permet de créer une copie exacte du modèle sélectionné, que vous pouvez réutiliser ou modifier sans affecter l'original.",
|
||||||
|
"save-as-template-msg": "Enregistrez ce document comme modèle réutilisable que vous pourrez utiliser à nouveau pour de futurs documents.",
|
||||||
|
"public-credit-alert": "Signer via ce lien consomme vos crédits e-mail gratuits. En tant qu'utilisateur gratuit, vous disposez de 15 crédits e-mail par mois afin d’empêcher les spammeurs d’abuser de nos systèmes. Pour profiter de limites plus élevées et d'un accès ininterrompu, abonnez-vous aux forfaits payants de <1>OpenSign™.</1>",
|
||||||
|
"know-more-about": "En savoir plus sur",
|
||||||
|
"free-unlimited-signatures": "Signatures illimitées gratuites",
|
||||||
|
"email-quota-updated": "Quota quotidien d'e-mails mis à jour avec succès.",
|
||||||
|
"password-has-been-reset": "Le mot de passe a été réinitialisé.",
|
||||||
|
"Unauthorized to reset your own password.": "Non autorisé à réinitialiser votre propre mot de passe.",
|
||||||
|
"User not found or not allowed.": "Utilisateur introuvable ou non autorisé.",
|
||||||
|
"User not found.": "Utilisateur introuvable.",
|
||||||
|
"Admin user tenant not found.": "Locataire administrateur introuvable.",
|
||||||
|
"User is not authenticated.": "L'utilisateur n'est pas authentifié.",
|
||||||
|
"Please provide required parameters.": "Veuillez fournir les paramètres requis.",
|
||||||
|
"reset-password": "Réinitialiser le mot de passe utilisateur",
|
||||||
|
"enter-strong-password": "Entrez un mot de passe sécurisé ou générez-en un automatiquement.",
|
||||||
|
"autogenerate": "Générer automatiquement"
|
||||||
|
}
|
||||||
@@ -165,7 +165,8 @@
|
|||||||
"daily-mail-quota": "दैनिक ईमेल कोटा",
|
"daily-mail-quota": "दैनिक ईमेल कोटा",
|
||||||
"Save as template": "टेम्पलेट के रूप में सहेजें",
|
"Save as template": "टेम्पलेट के रूप में सहेजें",
|
||||||
"Fix & resend": "ठीक करें और पुनः भेजें",
|
"Fix & resend": "ठीक करें और पुनः भेजें",
|
||||||
"Kiosk Mode": "कियोस्क मोड"
|
"Kiosk Mode": "कियोस्क मोड",
|
||||||
|
"Reset password": "पासवर्ड रीसेट करें"
|
||||||
},
|
},
|
||||||
"report-heading": {
|
"report-heading": {
|
||||||
"Sr.No": "क्रमांक",
|
"Sr.No": "क्रमांक",
|
||||||
@@ -901,6 +902,10 @@
|
|||||||
"thanks-for-feedback": "आपकी प्रतिक्रिया के लिए धन्यवाद 🙏",
|
"thanks-for-feedback": "आपकी प्रतिक्रिया के लिए धन्यवाद 🙏",
|
||||||
"share-your-feedback": "अपनी प्रतिक्रिया साझा करें",
|
"share-your-feedback": "अपनी प्रतिक्रिया साझा करें",
|
||||||
"share-your-review": "अपनी समीक्षा साझा करें",
|
"share-your-review": "अपनी समीक्षा साझा करें",
|
||||||
|
"please-select-rating": "कृपया एक रेटिंग चुनें",
|
||||||
|
"feedback-optional": "प्रतिक्रिया (वैकल्पिक)",
|
||||||
|
"feedback-saved": "प्रतिक्रिया सहेज ली गई है।",
|
||||||
|
"feedback-save-error": "प्रतिक्रिया सहेजी नहीं जा सकी, कृपया पुनः प्रयास करें।",
|
||||||
"date-format": "दिनांक प्रारूप",
|
"date-format": "दिनांक प्रारूप",
|
||||||
"document-deleted": "दस्तावेज़ हटा दिया गया है या आपके पास पहुंच नहीं है। कृपया प्रेषक से संपर्क करें।",
|
"document-deleted": "दस्तावेज़ हटा दिया गया है या आपके पास पहुंच नहीं है। कृपया प्रेषक से संपर्क करें।",
|
||||||
"save-as-template-?": "क्या आप वाकई इस दस्तावेज़ को टेम्पलेट के रूप में सहेजना चाहते हैं?",
|
"save-as-template-?": "क्या आप वाकई इस दस्तावेज़ को टेम्पलेट के रूप में सहेजना चाहते हैं?",
|
||||||
@@ -1210,5 +1215,32 @@
|
|||||||
"otp-email": "हमने एक सत्यापन कोड भेजा है",
|
"otp-email": "हमने एक सत्यापन कोड भेजा है",
|
||||||
"save-as-temp-warn": "नोट: इस दस्तावेज़ में पहले से भरे हुए विजेट शामिल हैं, जिन्हें स्वचालित रूप से हटा दिया जाएगा क्योंकि वे पहले से ही मूल दस्तावेज़ में सम्मिलित हैं।",
|
"save-as-temp-warn": "नोट: इस दस्तावेज़ में पहले से भरे हुए विजेट शामिल हैं, जिन्हें स्वचालित रूप से हटा दिया जाएगा क्योंकि वे पहले से ही मूल दस्तावेज़ में सम्मिलित हैं।",
|
||||||
"edit-document": "दस्तावेज़ संपादित करें",
|
"edit-document": "दस्तावेज़ संपादित करें",
|
||||||
"otp-email": "हमने एक सत्यापन कोड भेजा है"
|
"modify": "संशोधित करें",
|
||||||
}
|
"merge-certificate-to-pdf": "प्रमाणपत्र को PDF में मिलाएँ",
|
||||||
|
"merge-cc-to-pdf-help": {
|
||||||
|
"p1": "यह सुनिश्चित करेगा कि पूर्णता प्रमाणपत्र अंतिम PDF दस्तावेज़ में शामिल हो। हालाँकि, कृपया ध्यान दें कि एक बार मिलाने के बाद, प्रमाणपत्र को मुख्य दस्तावेज़ से अलग नहीं किया जा सकता।",
|
||||||
|
"p2": "यदि आप मिलाना नहीं चुनते हैं, तो पूर्णता प्रमाणपत्र हस्ताक्षरित दस्तावेज़ के साथ एक अलग PDF फ़ाइल के रूप में प्रदान किया जाएगा।"
|
||||||
|
},
|
||||||
|
"read-only-date-error": "रीड-ओनली दिनांक विजेट में एक डिफ़ॉल्ट दिनांक होना आवश्यक है।",
|
||||||
|
"set-date": "दिनांक सेट करें",
|
||||||
|
"set-today": "हस्ताक्षर की तिथि",
|
||||||
|
"enter-name": "नाम दर्ज करें",
|
||||||
|
"enter-email": "ईमेल दर्ज करें",
|
||||||
|
"subscribe-to-opensign-msg": "{{appName}} की सदस्यता लें और असीमित निःशुल्क डिजिटल हस्ताक्षरों का आनंद लें।",
|
||||||
|
"duplicate-subscribe-msg": "डुप्लिकेट करने से आप चयनित टेम्पलेट की एक सटीक प्रति बना सकते हैं, जिसे आप पुनः उपयोग या संशोधित कर सकते हैं बिना मूल को प्रभावित किए।",
|
||||||
|
"save-as-template-msg": "इस दस्तावेज़ को एक पुन: प्रयोज्य टेम्पलेट के रूप में सहेजें जिसे आप भविष्य के दस्तावेज़ों के लिए फिर से उपयोग कर सकते हैं।",
|
||||||
|
"public-credit-alert": "इस लिंक के माध्यम से हस्ताक्षर करने पर आपके निःशुल्क ईमेल क्रेडिट का उपभोग होगा। एक निःशुल्क उपयोगकर्ता के रूप में, आपको स्पैमर्स को हमारी प्रणाली का दुरुपयोग करने से रोकने के लिए प्रति माह 15 ईमेल क्रेडिट आवंटित किए जाते हैं। उच्च सीमा और निर्बाध पहुँच का आनंद लेने के लिए, <1>OpenSign™ पेड प्लान</1> की सदस्यता लें।",
|
||||||
|
"know-more-about": "इसके बारे में और जानें",
|
||||||
|
"free-unlimited-signatures": "मुफ़्त असीमित हस्ताक्षर",
|
||||||
|
"email-quota-updated": "दैनिक ईमेल कोटा सफलतापूर्वक अपडेट किया गया।",
|
||||||
|
"password-has-been-reset": "पासवर्ड रीसेट कर दिया गया है।",
|
||||||
|
"Unauthorized to reset your own password.": "अपना पासवर्ड रीसेट करने के लिए अधिकृत नहीं है।",
|
||||||
|
"User not found or not allowed.": "उपयोगकर्ता नहीं मिला या अनुमति नहीं है।",
|
||||||
|
"User not found.": "उपयोगकर्ता नहीं मिला।",
|
||||||
|
"Admin user tenant not found.": "एडमिन उपयोगकर्ता टेनेंट नहीं मिला।",
|
||||||
|
"User is not authenticated.": "उपयोगकर्ता प्रमाणीकृत नहीं है।",
|
||||||
|
"Please provide required parameters.": "कृपया आवश्यक पैरामीटर प्रदान करें।",
|
||||||
|
"reset-password": "उपयोगकर्ता पासवर्ड रीसेट करें",
|
||||||
|
"enter-strong-password": "एक मज़बूत पासवर्ड दर्ज करें या स्वचालित रूप से उत्पन्न करें।",
|
||||||
|
"autogenerate": "स्वतः उत्पन्न करें"
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
"dark-mode": "Modalità scura",
|
"dark-mode": "Modalità scura",
|
||||||
"name": "Nome",
|
"name": "Nome",
|
||||||
"phone": "Telefono",
|
"phone": "Telefono",
|
||||||
"phone-optional": "facoltativo",
|
"phone-optional": "Opzionale",
|
||||||
"email": "Email",
|
"email": "Email",
|
||||||
"company": "Azienda",
|
"company": "Azienda",
|
||||||
"job-title": "Titolo professionale",
|
"job-title": "Titolo professionale",
|
||||||
@@ -165,7 +165,8 @@
|
|||||||
"daily-mail-quota": "Quota e-mail giornaliera",
|
"daily-mail-quota": "Quota e-mail giornaliera",
|
||||||
"Save as template": "Salva come modello",
|
"Save as template": "Salva come modello",
|
||||||
"Fix & resend": "Correggi e reinvia",
|
"Fix & resend": "Correggi e reinvia",
|
||||||
"Kiosk Mode": "Modalità Kiosk"
|
"Kiosk Mode": "Modalità Kiosk",
|
||||||
|
"Reset password": "Reimposta password"
|
||||||
},
|
},
|
||||||
"report-heading": {
|
"report-heading": {
|
||||||
"Sr.No": "Nr.",
|
"Sr.No": "Nr.",
|
||||||
@@ -901,6 +902,10 @@
|
|||||||
"thanks-for-feedback": "Grazie per il tuo feedback 🙏",
|
"thanks-for-feedback": "Grazie per il tuo feedback 🙏",
|
||||||
"share-your-feedback": "Condividi il tuo feedback",
|
"share-your-feedback": "Condividi il tuo feedback",
|
||||||
"share-your-review": "Condividi la tua recensione",
|
"share-your-review": "Condividi la tua recensione",
|
||||||
|
"please-select-rating": "Si prega di selezionare una valutazione",
|
||||||
|
"feedback-optional": "Feedback (opzionale)",
|
||||||
|
"feedback-saved": "Il feedback è stato salvato.",
|
||||||
|
"feedback-save-error": "Impossibile salvare il feedback, riprova.",
|
||||||
"date-format": "Formato data",
|
"date-format": "Formato data",
|
||||||
"document-deleted": "Il documento è stato eliminato o non hai accesso. Si prega di contattare il mittente.",
|
"document-deleted": "Il documento è stato eliminato o non hai accesso. Si prega di contattare il mittente.",
|
||||||
"save-as-template-?": "Sei sicuro di voler salvare questo documento come modello?",
|
"save-as-template-?": "Sei sicuro di voler salvare questo documento come modello?",
|
||||||
@@ -1210,5 +1215,32 @@
|
|||||||
"otp-email": "Abbiamo inviato un codice di verifica",
|
"otp-email": "Abbiamo inviato un codice di verifica",
|
||||||
"save-as-temp-warn": "Nota: Questo documento include widget precompilati, che verranno automaticamente rimossi poiché sono già incorporati nel documento di base.",
|
"save-as-temp-warn": "Nota: Questo documento include widget precompilati, che verranno automaticamente rimossi poiché sono già incorporati nel documento di base.",
|
||||||
"edit-document": "Modifica documento",
|
"edit-document": "Modifica documento",
|
||||||
"otp-email": "Abbiamo inviato un codice di verifica"
|
"modify": "Modifica",
|
||||||
}
|
"merge-certificate-to-pdf": "Unisci certificato al PDF",
|
||||||
|
"merge-cc-to-pdf-help": {
|
||||||
|
"p1": "Questo garantirà che il certificato di completamento sia incluso nel documento PDF finale. Tuttavia, si noti che una volta unito, il certificato non può essere separato dal documento principale.",
|
||||||
|
"p2": "Se scegli di non unire, il certificato di completamento sarà fornito come file PDF separato insieme al documento firmato."
|
||||||
|
},
|
||||||
|
"read-only-date-error": "Il widget data di sola lettura deve avere una data predefinita.",
|
||||||
|
"set-date": "Imposta data",
|
||||||
|
"set-today": "Data di firma",
|
||||||
|
"enter-name": "Inserisci nome",
|
||||||
|
"enter-email": "Inserisci e-mail",
|
||||||
|
"subscribe-to-opensign-msg": "Abbonati a {{appName}} e goditi firme digitali gratuite illimitate.",
|
||||||
|
"duplicate-subscribe-msg": "Duplicare consente di creare una copia esatta del modello selezionato, permettendoti di riutilizzarlo o modificarlo senza influire sull'originale.",
|
||||||
|
"save-as-template-msg": "Salva questo documento come modello riutilizzabile che potrai usare di nuovo per documenti futuri.",
|
||||||
|
"public-credit-alert": "Firmare tramite questo link consumerà i tuoi crediti e-mail gratuiti. Come utente gratuito, ti vengono assegnati 15 crediti e-mail al mese per impedire agli spammer di abusare dei nostri sistemi. Per usufruire di limiti più elevati e accesso ininterrotto, abbonati ai piani a pagamento di <1>OpenSign™.</1>",
|
||||||
|
"know-more-about": "Scopri di più su",
|
||||||
|
"free-unlimited-signatures": "Firme illimitate gratuite",
|
||||||
|
"email-quota-updated": "Quota e-mail giornaliera aggiornata con successo.",
|
||||||
|
"password-has-been-reset": "La password è stata reimpostata.",
|
||||||
|
"Unauthorized to reset your own password.": "Non sei autorizzato a reimpostare la tua password.",
|
||||||
|
"User not found or not allowed.": "Utente non trovato o non autorizzato.",
|
||||||
|
"User not found.": "Utente non trovato.",
|
||||||
|
"Admin user tenant not found.": "Tenant utente amministratore non trovato.",
|
||||||
|
"User is not authenticated.": "Utente non autenticato.",
|
||||||
|
"Please provide required parameters.": "Fornisci i parametri richiesti.",
|
||||||
|
"reset-password": "Reimposta password utente",
|
||||||
|
"enter-strong-password": "Inserisci una password sicura o generane una automaticamente.",
|
||||||
|
"autogenerate": "Genera automaticamente"
|
||||||
|
}
|
||||||
@@ -19,7 +19,6 @@ import Loader from "./primitives/Loader";
|
|||||||
import UserList from "./pages/UserList";
|
import UserList from "./pages/UserList";
|
||||||
import { serverUrl_fn } from "./constant/appinfo";
|
import { serverUrl_fn } from "./constant/appinfo";
|
||||||
import DocSuccessPage from "./pages/DocSuccessPage";
|
import DocSuccessPage from "./pages/DocSuccessPage";
|
||||||
import ValidateSession from "./primitives/ValidateSession";
|
|
||||||
import DragProvider from "./components/DragProivder";
|
import DragProvider from "./components/DragProivder";
|
||||||
import Title from "./components/Title";
|
import Title from "./components/Title";
|
||||||
const DebugPdf = lazyWithRetry(() => import("./pages/DebugPdf"));
|
const DebugPdf = lazyWithRetry(() => import("./pages/DebugPdf"));
|
||||||
@@ -88,13 +87,7 @@ function App() {
|
|||||||
path="/forgetpassword"
|
path="/forgetpassword"
|
||||||
element={<Lazy Page={ForgetPassword} />}
|
element={<Lazy Page={ForgetPassword} />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route element={<HomeLayout />}>
|
||||||
element={
|
|
||||||
<ValidateSession>
|
|
||||||
<HomeLayout />
|
|
||||||
</ValidateSession>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Route path="/users" element={<UserList />} />
|
<Route path="/users" element={<UserList />} />
|
||||||
<Route
|
<Route
|
||||||
path="/changepassword"
|
path="/changepassword"
|
||||||
|
|||||||
@@ -244,6 +244,7 @@ const AddSigner = (props) => {
|
|||||||
onInvalid={(e) => e.target.setCustomValidity(t("input-required"))}
|
onInvalid={(e) => e.target.setCustomValidity(t("input-required"))}
|
||||||
onInput={(e) => e.target.setCustomValidity("")}
|
onInput={(e) => e.target.setCustomValidity("")}
|
||||||
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"
|
||||||
|
placeholder={t("enter-name")}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
@@ -263,6 +264,7 @@ const AddSigner = (props) => {
|
|||||||
onInput={(e) => e.target.setCustomValidity("")}
|
onInput={(e) => e.target.setCustomValidity("")}
|
||||||
disabled={addYourself}
|
disabled={addYourself}
|
||||||
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"
|
||||||
|
placeholder={t("enter-email")}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ const AddUser = (props) => {
|
|||||||
onInput={(e) => e.target.setCustomValidity("")}
|
onInput={(e) => e.target.setCustomValidity("")}
|
||||||
required
|
required
|
||||||
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"
|
||||||
|
placeholder={t("enter-name")}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
@@ -200,6 +201,7 @@ const AddUser = (props) => {
|
|||||||
}
|
}
|
||||||
onInput={(e) => e.target.setCustomValidity("")}
|
onInput={(e) => e.target.setCustomValidity("")}
|
||||||
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"
|
||||||
|
placeholder={t("enter-email")}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { appInfo } from "../constant/appinfo";
|
import { appInfo } from "../constant/appinfo";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
import { toggleSidebar } from "../redux/reducers/sidebarReducer.js";
|
import { toggleSidebar } from "../redux/reducers/sidebarReducer.js";
|
||||||
|
import { sessionStatus } from "../redux/reducers/userReducer.js";
|
||||||
|
|
||||||
const Header = ({ isConsole, setIsLoggingOut }) => {
|
const Header = ({ isConsole, setIsLoggingOut }) => {
|
||||||
const { t, i18n } = useTranslation();
|
const { t, i18n } = useTranslation();
|
||||||
@@ -67,6 +68,8 @@ const Header = ({ isConsole, setIsLoggingOut }) => {
|
|||||||
await Parse.User.logOut();
|
await Parse.User.logOut();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("Err while logging out", err);
|
console.log("Err while logging out", err);
|
||||||
|
} finally {
|
||||||
|
dispatch(sessionStatus(true));
|
||||||
}
|
}
|
||||||
let appdata = localStorage.getItem("userSettings");
|
let appdata = localStorage.getItem("userSettings");
|
||||||
let applogo = localStorage.getItem("appLogo");
|
let applogo = localStorage.getItem("appLogo");
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import Parse from "parse";
|
import Parse from "parse";
|
||||||
import getReplacedHashQuery from "../../constant/getReplacedHashQuery";
|
import getReplacedHashQuery from "../../constant/getReplacedHashQuery";
|
||||||
@@ -168,25 +168,21 @@ const DashboardCard = (props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setresponse(arr.length);
|
setresponse(arr.length);
|
||||||
setLoading(false);
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await axios.get(url, { headers: headers }).then((res) => {
|
await axios.get(url, { headers: headers }).then((res) => {
|
||||||
if (res.data.results.length > 0) {
|
if (res?.data?.[props.Data.key]) {
|
||||||
setLoading(false);
|
setresponse(parseInt(res.data[props.Data.key]));
|
||||||
if (props.Data.key !== "count") {
|
} else if (res?.data?.results?.length > 0) {
|
||||||
setresponse(res.data.results[0][props.Data.key]);
|
setresponse(res.data.results.length);
|
||||||
} else {
|
|
||||||
setresponse(res.data[props.Data.key]);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
setresponse(0);
|
setresponse(0);
|
||||||
setLoading(false);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Problem", e);
|
console.error("Problem", e);
|
||||||
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ const EditTemplate = ({
|
|||||||
Bcc: template?.Bcc,
|
Bcc: template?.Bcc,
|
||||||
RedirectUrl: template?.RedirectUrl || "",
|
RedirectUrl: template?.RedirectUrl || "",
|
||||||
AllowModifications: template?.AllowModifications || false,
|
AllowModifications: template?.AllowModifications || false,
|
||||||
TimeToCompleteDays: template?.TimeToCompleteDays || 15
|
TimeToCompleteDays: template?.TimeToCompleteDays || 15,
|
||||||
});
|
});
|
||||||
const [isUpdate, setIsUpdate] = useState(false);
|
const [isUpdate, setIsUpdate] = useState(false);
|
||||||
const [showConfirm, setShowConfirm] = useState(false);
|
const [showConfirm, setShowConfirm] = useState(false);
|
||||||
@@ -244,6 +244,7 @@ const EditTemplate = ({
|
|||||||
setShowConfirm(false);
|
setShowConfirm(false);
|
||||||
handleClose();
|
handleClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalUi
|
<ModalUi
|
||||||
isOpen
|
isOpen
|
||||||
|
|||||||
@@ -75,9 +75,12 @@ function Header(props) {
|
|||||||
alert(t("only-pdf-allowed"));
|
alert(t("only-pdf-allowed"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const mb = Math.round(file?.size / Math.pow(1024, 2));
|
const fileSize =
|
||||||
if (mb > maxFileSize) {
|
maxFileSize;
|
||||||
alert(`${t("file-alert-1")} ${maxFileSize} MB`);
|
const pdfsize = file?.size;
|
||||||
|
const fileSizeBytes = fileSize * 1024 * 1024;
|
||||||
|
if (pdfsize > fileSizeBytes) {
|
||||||
|
alert(`${t("file-alert-1")} ${fileSize} MB`);
|
||||||
removeFile(e);
|
removeFile(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -134,6 +137,13 @@ function Header(props) {
|
|||||||
useObjectStreams: false
|
useObjectStreams: false
|
||||||
});
|
});
|
||||||
const pdfBuffer = base64ToArrayBuffer(pdfBase64);
|
const pdfBuffer = base64ToArrayBuffer(pdfBase64);
|
||||||
|
const pdfsize = pdfBuffer?.byteLength;
|
||||||
|
const fileSizeBytes = fileSize * 1024 * 1024;
|
||||||
|
if (pdfsize > fileSizeBytes) {
|
||||||
|
alert(`${t("file-alert-1")} ${fileSize} MB`);
|
||||||
|
removeFile(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
props.setPdfArrayBuffer(pdfBuffer);
|
props.setPdfArrayBuffer(pdfBuffer);
|
||||||
props.setPdfBase64Url(pdfBase64);
|
props.setPdfBase64Url(pdfBase64);
|
||||||
props.setIsUploadPdf && props.setIsUploadPdf(true);
|
props.setIsUploadPdf && props.setIsUploadPdf(true);
|
||||||
@@ -167,7 +177,9 @@ function Header(props) {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
const handleDownloadBtn = async () => {
|
const handleDownloadBtn = async () => {
|
||||||
if (props?.isCompleted) {
|
if (
|
||||||
|
props?.isCompleted
|
||||||
|
) {
|
||||||
props?.setIsDownloadModal(true);
|
props?.setIsDownloadModal(true);
|
||||||
} else {
|
} else {
|
||||||
await handleDownloadDoc();
|
await handleDownloadDoc();
|
||||||
@@ -222,25 +234,27 @@ function Header(props) {
|
|||||||
{t("download")}
|
{t("download")}
|
||||||
</div>
|
</div>
|
||||||
</DropdownMenu.Item>
|
</DropdownMenu.Item>
|
||||||
{props?.isCompleted && (
|
{
|
||||||
<DropdownMenu.Item
|
props?.isCompleted && (
|
||||||
className="DropdownMenuItem"
|
<DropdownMenu.Item
|
||||||
onClick={() =>
|
className="DropdownMenuItem"
|
||||||
handleDownloadCertificate(
|
onClick={() =>
|
||||||
props?.pdfDetails,
|
handleDownloadCertificate(
|
||||||
setIsDownloading
|
props?.pdfDetails,
|
||||||
)
|
setIsDownloading
|
||||||
}
|
)
|
||||||
>
|
}
|
||||||
<div className="border-none bg-[#fff]">
|
>
|
||||||
<i
|
<div className="border-none bg-[#fff]">
|
||||||
className="fa-light fa-award mr-[3px]"
|
<i
|
||||||
aria-hidden="true"
|
className="fa-light fa-award mr-[3px]"
|
||||||
></i>
|
aria-hidden="true"
|
||||||
{t("certificate")}
|
></i>
|
||||||
</div>
|
{t("certificate")}
|
||||||
</DropdownMenu.Item>
|
</div>
|
||||||
)}
|
</DropdownMenu.Item>
|
||||||
|
)
|
||||||
|
}
|
||||||
{props?.isSignYourself && (
|
{props?.isSignYourself && (
|
||||||
<DropdownMenu.Item
|
<DropdownMenu.Item
|
||||||
className="DropdownMenuItem"
|
className="DropdownMenuItem"
|
||||||
@@ -518,24 +532,28 @@ function Header(props) {
|
|||||||
></i>
|
></i>
|
||||||
<span className="hidden lg:block">{t("print")}</span>
|
<span className="hidden lg:block">{t("print")}</span>
|
||||||
</button>
|
</button>
|
||||||
{props?.isCompleted && (
|
{
|
||||||
<button
|
props?.isCompleted && (
|
||||||
type="button"
|
<button
|
||||||
onClick={() =>
|
type="button"
|
||||||
handleDownloadCertificate(
|
onClick={() =>
|
||||||
props?.pdfDetails,
|
handleDownloadCertificate(
|
||||||
setIsDownloading
|
props?.pdfDetails,
|
||||||
)
|
setIsDownloading
|
||||||
}
|
)
|
||||||
className="op-btn op-btn-secondary op-btn-sm mr-[3px] shadow"
|
}
|
||||||
>
|
className="op-btn op-btn-secondary op-btn-sm mr-[3px] shadow"
|
||||||
<i
|
>
|
||||||
className="fa-light fa-award py-[3px]"
|
<i
|
||||||
aria-hidden="true"
|
className="fa-light fa-award py-[3px]"
|
||||||
></i>
|
aria-hidden="true"
|
||||||
<span className="hidden lg:block">{t("certificate")}</span>
|
></i>
|
||||||
</button>
|
<span className="hidden lg:block">
|
||||||
)}
|
{t("certificate")}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
)
|
||||||
|
}
|
||||||
<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"
|
||||||
@@ -592,23 +610,25 @@ function Header(props) {
|
|||||||
)
|
)
|
||||||
) : props?.isCompleted ? (
|
) : props?.isCompleted ? (
|
||||||
<div className="flex flex-row">
|
<div className="flex flex-row">
|
||||||
{props?.isCompleted && (
|
{
|
||||||
<button
|
props?.isCompleted && (
|
||||||
type="button"
|
<button
|
||||||
onClick={() =>
|
type="button"
|
||||||
handleDownloadCertificate(
|
onClick={() =>
|
||||||
props?.pdfDetails,
|
handleDownloadCertificate(
|
||||||
setIsDownloading
|
props?.pdfDetails,
|
||||||
)
|
setIsDownloading
|
||||||
}
|
)
|
||||||
className="op-btn op-btn-secondary op-btn-sm gap-0 font-medium text-[12px] mr-[3px] shadow"
|
}
|
||||||
>
|
className="op-btn op-btn-secondary op-btn-sm gap-0 font-medium text-[12px] mr-[3px] shadow"
|
||||||
<i className="fa-light fa-award" aria-hidden="true"></i>
|
>
|
||||||
<span className="hidden lg:block ml-1">
|
<i className="fa-light fa-award" aria-hidden="true"></i>
|
||||||
{t("certificate")}
|
<span className="hidden lg:block ml-1">
|
||||||
</span>
|
{t("certificate")}
|
||||||
</button>
|
</span>
|
||||||
)}
|
</button>
|
||||||
|
)
|
||||||
|
}
|
||||||
<button
|
<button
|
||||||
onClick={(e) =>
|
onClick={(e) =>
|
||||||
handleToPrint(e, setIsDownloading, props?.pdfDetails)
|
handleToPrint(e, setIsDownloading, props?.pdfDetails)
|
||||||
@@ -622,7 +642,8 @@ function Header(props) {
|
|||||||
<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={() => props?.setIsDownloadModal(true)}
|
// onClick={() => props?.setIsDownloadModal(true)}
|
||||||
|
onClick={() => handleDownloadBtn()}
|
||||||
>
|
>
|
||||||
<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>
|
||||||
|
|||||||
@@ -67,9 +67,12 @@ function PdfTools(props) {
|
|||||||
alert(t("only-pdf-allowed"));
|
alert(t("only-pdf-allowed"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const mb = Math.round(file?.size / Math.pow(1024, 2));
|
const fileSize =
|
||||||
if (mb > maxFileSize) {
|
maxFileSize;
|
||||||
alert(`${t("file-alert-1")} ${maxFileSize} MB`);
|
const pdfsize = file?.size;
|
||||||
|
const fileSizeBytes = fileSize * 1024 * 1024;
|
||||||
|
if (pdfsize > fileSizeBytes) {
|
||||||
|
alert(`${t("file-alert-1")} ${fileSize} MB`);
|
||||||
removeFile(e);
|
removeFile(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -126,6 +129,13 @@ function PdfTools(props) {
|
|||||||
useObjectStreams: false
|
useObjectStreams: false
|
||||||
});
|
});
|
||||||
const pdfBuffer = base64ToArrayBuffer(pdfBase64);
|
const pdfBuffer = base64ToArrayBuffer(pdfBase64);
|
||||||
|
const pdfsize = pdfBuffer?.byteLength;
|
||||||
|
const fileSizeBytes = fileSize * 1024 * 1024;
|
||||||
|
if (pdfsize > fileSizeBytes) {
|
||||||
|
alert(`${t("file-alert-1")} ${fileSize} MB`);
|
||||||
|
removeFile(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
props.setPdfArrayBuffer(pdfBuffer);
|
props.setPdfArrayBuffer(pdfBuffer);
|
||||||
props.setPdfBase64Url(pdfBase64);
|
props.setPdfBase64Url(pdfBase64);
|
||||||
props.setIsUploadPdf && props.setIsUploadPdf(true);
|
props.setIsUploadPdf && props.setIsUploadPdf(true);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect, forwardRef } from "react";
|
||||||
import BorderResize from "./BorderResize";
|
import BorderResize from "./BorderResize";
|
||||||
import { Rnd } from "react-rnd";
|
import { Rnd } from "react-rnd";
|
||||||
import {
|
import {
|
||||||
@@ -15,7 +15,13 @@ import {
|
|||||||
cellsWidget,
|
cellsWidget,
|
||||||
textWidget,
|
textWidget,
|
||||||
selectFormat,
|
selectFormat,
|
||||||
randomId
|
randomId,
|
||||||
|
getYear,
|
||||||
|
getMonth,
|
||||||
|
months,
|
||||||
|
years,
|
||||||
|
getDefaultDate,
|
||||||
|
getDefaultFormat
|
||||||
} from "../../constant/Utils";
|
} from "../../constant/Utils";
|
||||||
import PlaceholderType from "./PlaceholderType";
|
import PlaceholderType from "./PlaceholderType";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
@@ -29,47 +35,34 @@ import {
|
|||||||
} from "../../redux/reducers/widgetSlice";
|
} from "../../redux/reducers/widgetSlice";
|
||||||
import { themeColor } from "../../constant/const";
|
import { themeColor } from "../../constant/const";
|
||||||
import { useGuidelinesContext } from "../../context/GuidelinesContext";
|
import { useGuidelinesContext } from "../../context/GuidelinesContext";
|
||||||
|
import DatePicker from "react-datepicker";
|
||||||
//function to get default format
|
|
||||||
const getDefaultFormat = (dateFormat) => dateFormat || "MM/dd/yyyy";
|
|
||||||
|
|
||||||
//function to convert formated date to new Date() format
|
|
||||||
const getDefaultDate = (dateStr, format) => {
|
|
||||||
//get valid date format for moment to convert formated date to new Date() format
|
|
||||||
const formats = changeDateToMomentFormat(format);
|
|
||||||
const parsedDate = moment(dateStr, formats);
|
|
||||||
let date;
|
|
||||||
if (parsedDate.isValid()) {
|
|
||||||
date = new Date(parsedDate.toISOString());
|
|
||||||
return date;
|
|
||||||
} else {
|
|
||||||
date = new Date();
|
|
||||||
return date;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function Placeholder(props) {
|
function Placeholder(props) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const prefillImg = useSelector((state) => state.widget.prefillImg);
|
const prefillImg = useSelector((state) => state.widget.prefillImg);
|
||||||
const { showGuidelines } = useGuidelinesContext();
|
const { showGuidelines } = useGuidelinesContext();
|
||||||
|
const statusArr = ["Required", "Optional"];
|
||||||
const widgetData =
|
const widgetData =
|
||||||
props.pos?.options?.defaultValue || props.pos?.options?.response;
|
props.pos?.options?.defaultValue || props.pos?.options?.response;
|
||||||
const [isDateModal, setIsDateModal] = useState(false);
|
const [isDateModal, setIsDateModal] = useState(false);
|
||||||
const [containerScale, setContainerScale] = useState();
|
const [containerScale, setContainerScale] = useState();
|
||||||
const [selectDate, setSelectDate] = useState({});
|
const [selectDate, setSelectDate] = useState({});
|
||||||
const [dateFormat, setDateFormat] = useState([]);
|
const [dateFormatList, setDateFormatList] = useState([]);
|
||||||
const [clickonWidget, setClickonWidget] = useState({});
|
const [clickonWidget, setClickonWidget] = useState({});
|
||||||
const [isDateReadOnly, setIsDateReadOnly] = useState(
|
const [formdata, setFormdata] = useState({
|
||||||
props?.pos?.options?.isReadOnly || false
|
status: props?.pos?.options?.status || "required",
|
||||||
|
isReadOnly: props?.pos?.options?.isReadOnly || false
|
||||||
|
});
|
||||||
|
const [isToday, setIsToday] = useState(
|
||||||
|
props.pos?.options?.response === "today" ? true : false
|
||||||
);
|
);
|
||||||
const startDate = props?.pos?.options?.response
|
const startDate = props?.pos?.options?.response
|
||||||
? getDefaultDate(
|
? getDefaultDate(
|
||||||
props?.pos?.options?.response,
|
props?.pos?.options?.response,
|
||||||
props.pos?.options?.validation?.format
|
props.pos?.options?.validation?.format
|
||||||
)
|
)
|
||||||
: new Date();
|
: "";
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const getPdfPageWidth = props.pdfOriginalWH.find(
|
const getPdfPageWidth = props.pdfOriginalWH.find(
|
||||||
(data) => data.pageNumber === props.pageNumber
|
(data) => data.pageNumber === props.pageNumber
|
||||||
@@ -102,29 +95,87 @@ function Placeholder(props) {
|
|||||||
}
|
}
|
||||||
}, [widgetData]);
|
}, [widgetData]);
|
||||||
|
|
||||||
|
//function is used to convert date according to selected format
|
||||||
|
const handleGetFormatDate = (data, isDateChange) => {
|
||||||
|
const isSpecialDateFormat =
|
||||||
|
data?.format &&
|
||||||
|
["dd-MM-yyyy", "dd.MM.yyyy", "dd/MM/yyyy"].includes(data?.format);
|
||||||
|
let updateDate = data.date;
|
||||||
|
let date = "";
|
||||||
|
if (isSpecialDateFormat && updateDate) {
|
||||||
|
date = isDateChange
|
||||||
|
? moment(updateDate).format(changeDateToMomentFormat(data.format))
|
||||||
|
: updateDate;
|
||||||
|
} else if (updateDate) {
|
||||||
|
//using moment package is used to change date as per the format provided in selectDate obj e.g. - MM/dd/yyyy -> 03/12/2024
|
||||||
|
const newDate = new Date(updateDate);
|
||||||
|
date = moment(newDate.getTime()).format(
|
||||||
|
changeDateToMomentFormat(data?.format)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
setSelectDate({ date: date, format: data?.format });
|
||||||
|
return date;
|
||||||
|
};
|
||||||
|
const saveDateSetting = (data) => {
|
||||||
|
if (formdata?.isReadOnly && !selectDate.date && !isToday) {
|
||||||
|
alert(t("read-only-date-error"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
handleSaveDate(data);
|
||||||
|
setIsDateModal(false);
|
||||||
|
props.setFontColor("");
|
||||||
|
props.setFontSize("");
|
||||||
|
};
|
||||||
|
//function to save date and format on local array onchange date and onclick format
|
||||||
|
const handleSaveDate = (data, isDateChange) => {
|
||||||
|
const date = isToday ? "today" : handleGetFormatDate(data, isDateChange);
|
||||||
|
//`onChangeInput` is used to save data related to date in a placeholder field
|
||||||
|
onChangeInput(
|
||||||
|
date,
|
||||||
|
props.pos,
|
||||||
|
props.xyPosition,
|
||||||
|
props.index,
|
||||||
|
props.setXyPosition,
|
||||||
|
props.data && props.data.Id,
|
||||||
|
false,
|
||||||
|
data?.format,
|
||||||
|
props.fontSize || props.pos?.options?.fontSize || 12,
|
||||||
|
props.fontColor || props.pos?.options?.fontColor || "black",
|
||||||
|
formdata
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
//Date-picker- accept date - Thu Dec 30 2025 00:00:00 GMT+0530 (India Standard Time)
|
||||||
|
//if date have in this format - "30/12/2025"
|
||||||
|
//then first need to be convert in this format - Tue Dec 30 2025 00:00:00 GMT+0530 (India Standard Time)
|
||||||
|
//Using moment - moment("30/12/2025", "DD/MM/YYYY").toDate();
|
||||||
|
|
||||||
|
//moment package where we show date according to format in list
|
||||||
|
//it support date in this type - "2025-09-11"// ISO string, "2025-09-11T14:30:00" // ISO datetime
|
||||||
//function change format array list with selected date and format
|
//function change format array list with selected date and format
|
||||||
const changeDateFormat = () => {
|
const changeDateFormat = () => {
|
||||||
const updateDate = [];
|
const updateDate = [];
|
||||||
dateFormatArr.map((data) => {
|
dateFormatArr.map((data) => {
|
||||||
let date;
|
let date = selectDate?.date || new Date();
|
||||||
if (selectDate && selectDate.format === "dd-MM-yyyy") {
|
const isString = typeof date === "string";
|
||||||
const [day, month, year] = selectDate.date.split("-");
|
if (selectDate.format === "dd-MM-yyyy" && isString) {
|
||||||
|
const [day, month, year] = date.split("-");
|
||||||
date = new Date(`${year}-${month}-${day}`);
|
date = new Date(`${year}-${month}-${day}`);
|
||||||
} else if (selectDate && selectDate.format === "dd.MM.yyyy") {
|
} else if (selectDate.format === "dd.MM.yyyy" && isString) {
|
||||||
const [day, month, year] = selectDate.date.split(".");
|
const [day, month, year] = date.split(".");
|
||||||
date = new Date(`${year}.${month}.${day}`);
|
date = new Date(`${year}.${month}.${day}`);
|
||||||
} else if (selectDate && selectDate.format === "dd/MM/yyyy") {
|
} else if (selectDate.format === "dd/MM/yyyy" && isString) {
|
||||||
const [day, month, year] = selectDate.date.split("/");
|
const [day, month, year] = date.split("/");
|
||||||
date = new Date(`${year}/${month}/${day}`);
|
date = new Date(`${year}/${month}/${day}`);
|
||||||
} else {
|
} else {
|
||||||
date = new Date(selectDate?.date);
|
date = selectDate?.date ? new Date(selectDate?.date) : new Date();
|
||||||
}
|
}
|
||||||
const milliseconds = date.getTime();
|
const milliseconds = date.getTime();
|
||||||
const newDate = moment(milliseconds).format(data);
|
const newDate = moment(milliseconds).format(data);
|
||||||
const dateObj = { date: newDate, format: selectFormat(data) };
|
const dateObj = { date: newDate, format: selectFormat(data) };
|
||||||
updateDate.push(dateObj);
|
updateDate.push(dateObj);
|
||||||
});
|
});
|
||||||
setDateFormat(updateDate);
|
setDateFormatList(updateDate);
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -287,41 +338,6 @@ function Placeholder(props) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//function to save date and format on local array onchange date and onclick format
|
|
||||||
const handleSaveDate = (data, isDateChange) => {
|
|
||||||
const isSpecialDateFormat =
|
|
||||||
data?.format &&
|
|
||||||
["dd-MM-yyyy", "dd.MM.yyyy", "dd/MM/yyyy"].includes(data?.format);
|
|
||||||
let updateDate = data.date;
|
|
||||||
let date;
|
|
||||||
if (isSpecialDateFormat) {
|
|
||||||
date = isDateChange
|
|
||||||
? moment(updateDate).format(changeDateToMomentFormat(data.format))
|
|
||||||
: updateDate;
|
|
||||||
} else {
|
|
||||||
//using moment package is used to change date as per the format provided in selectDate obj e.g. - MM/dd/yyyy -> 03/12/2024
|
|
||||||
const newDate = new Date(updateDate);
|
|
||||||
date = moment(newDate.getTime()).format(
|
|
||||||
changeDateToMomentFormat(data?.format)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
//`onChangeInput` is used to save data related to date in a placeholder field
|
|
||||||
onChangeInput(
|
|
||||||
date,
|
|
||||||
props.pos,
|
|
||||||
props.xyPosition,
|
|
||||||
props.index,
|
|
||||||
props.setXyPosition,
|
|
||||||
props.data && props.data.Id,
|
|
||||||
false,
|
|
||||||
data?.format,
|
|
||||||
props.fontSize || props.pos?.options?.fontSize || 12,
|
|
||||||
props.fontColor || props.pos?.options?.fontColor || "black",
|
|
||||||
isDateReadOnly || false
|
|
||||||
);
|
|
||||||
setSelectDate({ date: date, format: data?.format });
|
|
||||||
};
|
|
||||||
|
|
||||||
const setCellCount = (key, newCount) => {
|
const setCellCount = (key, newCount) => {
|
||||||
props.setXyPosition((prev) => {
|
props.setXyPosition((prev) => {
|
||||||
const isSignerList = prev.some((d) => d.signerPtr);
|
const isSignerList = prev.some((d) => d.signerPtr);
|
||||||
@@ -650,6 +666,40 @@ function Placeholder(props) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const ExampleCustomInput = forwardRef(({ value, onClick }, ref) => (
|
||||||
|
<div
|
||||||
|
className="border-gray-400 rounded-[50px] border-[1px] px-3 md:ml-2 text-xs py-2 focus:outline-none hover:border-base-content "
|
||||||
|
onClick={onClick}
|
||||||
|
ref={ref}
|
||||||
|
>
|
||||||
|
{value}
|
||||||
|
<i className="fa-light fa-calendar ml-[5px]"></i>
|
||||||
|
</div>
|
||||||
|
));
|
||||||
|
ExampleCustomInput.displayName = "ExampleCustomInput";
|
||||||
|
const handleChangeFormat = (e) => {
|
||||||
|
const selectedIndex = e.target.value;
|
||||||
|
e.stopPropagation();
|
||||||
|
if (
|
||||||
|
props?.isPlaceholder &&
|
||||||
|
props?.data?.Role !== "prefill" &&
|
||||||
|
!selectDate?.date
|
||||||
|
) {
|
||||||
|
setSelectDate((prev) => ({
|
||||||
|
...prev,
|
||||||
|
format: dateFormatList[selectedIndex]?.format
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
setSelectDate(dateFormatList[selectedIndex]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const handleClearDate = () => {
|
||||||
|
setIsToday(false);
|
||||||
|
setSelectDate((prev) => ({
|
||||||
|
...prev,
|
||||||
|
date: ""
|
||||||
|
}));
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* Check if a text widget (prefill type) exists. Once the user enters a value and clicks outside or the widget becomes non-selectable, it should appear as plain text (just like embedded text in a document). When the user clicks on the text again, it should become editable. */}
|
{/* Check if a text widget (prefill type) exists. Once the user enters a value and clicks outside or the widget becomes non-selectable, it should appear as plain text (just like embedded text in a document). When the user clicks on the text again, it should become editable. */}
|
||||||
@@ -889,10 +939,8 @@ function Placeholder(props) {
|
|||||||
(props?.isAlllowModify &&
|
(props?.isAlllowModify &&
|
||||||
!props?.assignedWidgetId.includes(props.pos.key))
|
!props?.assignedWidgetId.includes(props.pos.key))
|
||||||
}
|
}
|
||||||
setSelectDate={setSelectDate}
|
|
||||||
selectDate={selectDate}
|
selectDate={selectDate}
|
||||||
startDate={startDate}
|
startDate={startDate}
|
||||||
handleSaveDate={handleSaveDate}
|
|
||||||
xPos={props.xPos}
|
xPos={props.xPos}
|
||||||
calculateFont={calculateFont}
|
calculateFont={calculateFont}
|
||||||
setCellCount={setCellCount}
|
setCellCount={setCellCount}
|
||||||
@@ -902,22 +950,18 @@ function Placeholder(props) {
|
|||||||
)}
|
)}
|
||||||
<ModalUi isOpen={isDateModal} title={t("widget-info")} showClose={false}>
|
<ModalUi isOpen={isDateModal} title={t("widget-info")} showClose={false}>
|
||||||
<div className="text-base-content h-[100%] p-[20px]">
|
<div className="text-base-content h-[100%] p-[20px]">
|
||||||
<div className="flex flex-col md:flex-row md:items-center gap-y-3">
|
<div className="flex flex-col gap-3">
|
||||||
<div className="flex flex-row items-center gap-x-1">
|
<div className="flex flex-col md:items-center md:flex-row gap-y-3">
|
||||||
<span className="capitalize">{t("format")} :</span>
|
<span className="capitalize">{t("format")} :</span>
|
||||||
<select
|
<select
|
||||||
className="op-select op-select-bordered op-select-sm focus:outline-none hover:border-base-content text-xs"
|
className="op-select op-select-bordered op-select-sm focus:outline-none hover:border-base-content text-xs md:ml-4"
|
||||||
defaultValue={""}
|
defaultValue={""}
|
||||||
onChange={(e) => {
|
onChange={(e) => handleChangeFormat(e)}
|
||||||
const selectedIndex = e.target.value;
|
|
||||||
e.stopPropagation();
|
|
||||||
setSelectDate(dateFormat[selectedIndex]);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<option value="" disabled>
|
<option value="" disabled>
|
||||||
{t("select-date-format")}
|
{t("select-date-format")}
|
||||||
</option>
|
</option>
|
||||||
{dateFormat.map((data, ind) => {
|
{dateFormatList.map((data, ind) => {
|
||||||
return (
|
return (
|
||||||
<option className="text-[13px]" value={ind} key={ind}>
|
<option className="text-[13px]" value={ind} key={ind}>
|
||||||
{data?.date ? data?.date : "nodata"}
|
{data?.date ? data?.date : "nodata"}
|
||||||
@@ -925,79 +969,190 @@ function Placeholder(props) {
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</select>
|
</select>
|
||||||
|
<span className="text-xs text-gray-400 ml-1">
|
||||||
|
{selectDate.format}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<span className="text-xs text-gray-400 ml-1">
|
{props?.data?.Role !== "prefill" && props?.isPlaceholder && (
|
||||||
{selectDate.format}
|
<>
|
||||||
</span>
|
<div className="flex flex-col md:flex-row md:items-center gap-2">
|
||||||
</div>
|
<span>{t("set-date")} :</span>
|
||||||
<div className="flex flex-col md:flex-row gap-y-2 md:gap-y-0 gap-x-2 mt-3">
|
<DatePicker
|
||||||
<div className="flex flex-row items-center">
|
renderCustomHeader={({ date, changeYear, changeMonth }) => (
|
||||||
<span className="capitalize">{t("font-size")} :</span>
|
<div className="flex justify-start md:ml-2 ">
|
||||||
<select
|
<select
|
||||||
className="ml-[3px] md:ml:[7px] op-select op-select-bordered op-select-sm focus:outline-none hover:border-base-content text-xs"
|
className="bg-transparent outline-none"
|
||||||
value={props.fontSize || clickonWidget.options?.fontSize || 12}
|
value={months[getMonth(date)]}
|
||||||
onChange={(e) => props.setFontSize(parseInt(e.target.value))}
|
onChange={({ target: { value } }) =>
|
||||||
>
|
changeMonth(months.indexOf(value))
|
||||||
{fontsizeArr.map((size, ind) => (
|
}
|
||||||
<option className="text-[13px]" value={size} key={ind}>
|
>
|
||||||
{size}
|
{months.map((option) => (
|
||||||
</option>
|
<option key={option} value={option}>
|
||||||
))}
|
{option}
|
||||||
</select>
|
</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
<select
|
||||||
|
className="bg-transparent outline-none"
|
||||||
|
value={getYear(date)}
|
||||||
|
onChange={({ target: { value } }) =>
|
||||||
|
changeYear(value)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{years.map((option) => (
|
||||||
|
<option key={option} value={option}>
|
||||||
|
{option}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
closeOnScroll={true}
|
||||||
|
selected={getDefaultDate(
|
||||||
|
selectDate?.date,
|
||||||
|
selectDate?.format
|
||||||
|
)}
|
||||||
|
popperPlacement="top-end"
|
||||||
|
customInput={<ExampleCustomInput />}
|
||||||
|
onChange={(date) => {
|
||||||
|
setIsToday(false);
|
||||||
|
const isDateChange = true;
|
||||||
|
const dateObj = {
|
||||||
|
date: date,
|
||||||
|
format: selectDate.format
|
||||||
|
};
|
||||||
|
handleGetFormatDate(dateObj, isDateChange);
|
||||||
|
}}
|
||||||
|
dateFormat={
|
||||||
|
selectDate
|
||||||
|
? selectDate?.format
|
||||||
|
: props.pos?.options?.validation?.format
|
||||||
|
? props.pos?.options?.validation?.format
|
||||||
|
: "MM/dd/yyyy"
|
||||||
|
}
|
||||||
|
portalId="root-portal"
|
||||||
|
/>
|
||||||
|
<label className=" flex items-center gap-1 cursor-pointer">
|
||||||
|
<input
|
||||||
|
checked={isToday}
|
||||||
|
type="checkbox"
|
||||||
|
className="op-checkbox op-checkbox-xs"
|
||||||
|
onClick={() => {
|
||||||
|
setSelectDate((prev) => ({
|
||||||
|
...prev,
|
||||||
|
date: ""
|
||||||
|
}));
|
||||||
|
setIsToday(!isToday);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<span className="ml-[2px]">{t("set-today")}</span>
|
||||||
|
</label>
|
||||||
|
<span
|
||||||
|
onClick={() => handleClearDate()}
|
||||||
|
className="underline text-blue-500 cursor-pointer md:ml-2"
|
||||||
|
>
|
||||||
|
{t("clear")}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-row items-center gap-[10px]">
|
||||||
|
{statusArr.map((data, ind) => {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
key={ind}
|
||||||
|
className="flex flex-row gap-[5px] items-center"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
className="mr-[2px] op-radio op-radio-xs"
|
||||||
|
type="radio"
|
||||||
|
name="status"
|
||||||
|
onChange={() =>
|
||||||
|
setFormdata({
|
||||||
|
...formdata,
|
||||||
|
status: data.toLowerCase()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
checked={
|
||||||
|
formdata.status.toLowerCase() === data.toLowerCase()
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<div className="text-[13px]">
|
||||||
|
{t(`widget-status.${data}`)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className="flex flex-col md:flex-row gap-y-2 md:gap-y-0 gap-x-2">
|
||||||
|
<div className="flex flex-row items-center">
|
||||||
|
<span className="capitalize">{t("font-size")} :</span>
|
||||||
|
<select
|
||||||
|
className="ml-[3px] md:ml:[7px] op-select op-select-bordered op-select-sm focus:outline-none hover:border-base-content text-xs"
|
||||||
|
value={
|
||||||
|
props.fontSize || clickonWidget.options?.fontSize || 12
|
||||||
|
}
|
||||||
|
onChange={(e) => props.setFontSize(parseInt(e.target.value))}
|
||||||
|
>
|
||||||
|
{fontsizeArr.map((size, ind) => (
|
||||||
|
<option className="text-[13px]" value={size} key={ind}>
|
||||||
|
{size}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-row gap-1 items-center">
|
||||||
|
<span className="capitalize">{t("color")} :</span>
|
||||||
|
<select
|
||||||
|
value={
|
||||||
|
props.fontColor ||
|
||||||
|
clickonWidget.options?.fontColor ||
|
||||||
|
"black"
|
||||||
|
}
|
||||||
|
onChange={(e) => props.setFontColor(e.target.value)}
|
||||||
|
className="ml-[4px] md:ml[7px] op-select op-select-bordered op-select-sm focus:outline-none hover:border-base-content text-xs"
|
||||||
|
>
|
||||||
|
{fontColorArr.map((color, ind) => (
|
||||||
|
<option value={color} key={ind}>
|
||||||
|
{t(`color-type.${color}`)}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
<span
|
||||||
|
style={{
|
||||||
|
background:
|
||||||
|
props.fontColor || props.pos.options?.fontColor || "black"
|
||||||
|
}}
|
||||||
|
className="w-5 h-[19px] ml-1"
|
||||||
|
></span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-row gap-1 items-center">
|
{props?.isPlaceholder && props?.data?.Role !== "prefill" && (
|
||||||
<span className="capitalize">{t("color")} :</span>
|
<label className="flex items-center gap-1 cursor-pointer">
|
||||||
<select
|
<input
|
||||||
value={
|
name="isReadOnly"
|
||||||
props.fontColor || clickonWidget.options?.fontColor || "black"
|
type="checkbox"
|
||||||
}
|
checked={formdata?.isReadOnly}
|
||||||
onChange={(e) => props.setFontColor(e.target.value)}
|
className="op-checkbox op-checkbox-xs"
|
||||||
className="ml-[4px] md:ml[7px] op-select op-select-bordered op-select-sm focus:outline-none hover:border-base-content text-xs"
|
onChange={() =>
|
||||||
>
|
setFormdata({
|
||||||
{fontColorArr.map((color, ind) => (
|
...formdata,
|
||||||
<option value={color} key={ind}>
|
isReadOnly: !formdata?.isReadOnly
|
||||||
{t(`color-type.${color}`)}
|
})
|
||||||
</option>
|
}
|
||||||
))}
|
/>
|
||||||
</select>
|
<span className="capitalize ml-[2px]">{t("read-only")}</span>
|
||||||
<span
|
|
||||||
style={{
|
|
||||||
background:
|
|
||||||
props.fontColor || props.pos.options?.fontColor || "black"
|
|
||||||
}}
|
|
||||||
className="w-5 h-[19px] ml-1"
|
|
||||||
></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{props?.isPlaceholder && props?.data?.Role !== "prefill" && (
|
|
||||||
<div className="flex items-center mt-3">
|
|
||||||
<input
|
|
||||||
id="isReadOnly"
|
|
||||||
name="isReadOnly"
|
|
||||||
type="checkbox"
|
|
||||||
checked={
|
|
||||||
isDateReadOnly || props.pos.options?.isReadOnly || false
|
|
||||||
}
|
|
||||||
className="op-checkbox op-checkbox-xs"
|
|
||||||
onChange={() => setIsDateReadOnly(!isDateReadOnly)}
|
|
||||||
/>
|
|
||||||
<label
|
|
||||||
className="ml-1.5 mb-0 capitalize text-[13px]"
|
|
||||||
htmlFor="isreadonly"
|
|
||||||
>
|
|
||||||
{t("read-only")}
|
|
||||||
</label>
|
</label>
|
||||||
</div>
|
)}
|
||||||
)}
|
</div>
|
||||||
<div className="h-[1px] w-full my-[15px] bg-[#9f9f9f]"></div>
|
<div className="h-[1px] w-full my-[15px] bg-[#9f9f9f]"></div>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="op-btn op-btn-primary"
|
className="op-btn op-btn-primary"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsDateModal(false);
|
saveDateSetting(selectDate);
|
||||||
handleSaveDate(selectDate);
|
|
||||||
props.setFontColor("");
|
|
||||||
props.setFontSize("");
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t("save")}
|
{t("save")}
|
||||||
|
|||||||
@@ -34,8 +34,9 @@ function PlaceholderType(props) {
|
|||||||
((props.isSelfSign || props.isNeedSign) &&
|
((props.isSelfSign || props.isNeedSign) &&
|
||||||
props.data?.signerObjId === props.signerObjId);
|
props.data?.signerObjId === props.signerObjId);
|
||||||
const isReadOnly =
|
const isReadOnly =
|
||||||
props.pos.options?.isReadOnly ||
|
props?.data?.Role !== "prefill" &&
|
||||||
props.data?.signerObjId !== props.signerObjId;
|
(props.pos.options?.isReadOnly ||
|
||||||
|
props.data?.signerObjId !== props.signerObjId);
|
||||||
// prefer the latest response value over any default value
|
// prefer the latest response value over any default value
|
||||||
const widgetData =
|
const widgetData =
|
||||||
props.pos?.options?.response ?? props.pos?.options?.defaultValue ?? "";
|
props.pos?.options?.response ?? props.pos?.options?.defaultValue ?? "";
|
||||||
@@ -83,8 +84,7 @@ function PlaceholderType(props) {
|
|||||||
color: fontColor,
|
color: fontColor,
|
||||||
fontFamily: "Arial, sans-serif"
|
fontFamily: "Arial, sans-serif"
|
||||||
}}
|
}}
|
||||||
className={`${isReadOnly ? `select-none` : ``} ${selectWidgetCls} overflow-hidden`}
|
className={`${isReadOnly ? `select-none opacity-25` : ``} ${selectWidgetCls} overflow-hidden`}
|
||||||
disabled={isReadOnly}
|
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
>
|
>
|
||||||
@@ -399,11 +399,9 @@ function PlaceholderType(props) {
|
|||||||
popperPlacement="top-end"
|
popperPlacement="top-end"
|
||||||
customInput={<ExampleCustomInput />}
|
customInput={<ExampleCustomInput />}
|
||||||
dateFormat={
|
dateFormat={
|
||||||
props.selectDate
|
props?.selectDate?.format ||
|
||||||
? props.selectDate?.format
|
props.pos?.options?.validation?.format ||
|
||||||
: props.pos?.options?.validation?.format
|
"MM/dd/yyyy"
|
||||||
? props.pos?.options?.validation?.format
|
|
||||||
: "MM/dd/yyyy"
|
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -412,11 +410,9 @@ function PlaceholderType(props) {
|
|||||||
className="select-none-cls overflow-hidden"
|
className="select-none-cls overflow-hidden"
|
||||||
>
|
>
|
||||||
<span>
|
<span>
|
||||||
{props.selectDate
|
{props?.selectDate?.format ||
|
||||||
? props.selectDate?.format
|
props.pos?.options?.validation?.format ||
|
||||||
: props.pos?.options?.validation?.format
|
"MM/dd/yyyy"}
|
||||||
? props.pos?.options?.validation?.format
|
|
||||||
: "MM/dd/yyyy"}
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ function PrefillWidgetModal(props) {
|
|||||||
const loadedSet = useRef(new Set());
|
const loadedSet = useRef(new Set());
|
||||||
const initializedRef = useRef(false); // prevent rerun on state updates
|
const initializedRef = useRef(false); // prevent rerun on state updates
|
||||||
const prefillImg = useSelector((state) => state.widget.prefillImg);
|
const prefillImg = useSelector((state) => state.widget.prefillImg);
|
||||||
const [uniqueWidget, setUniqueWidget] = useState([]);
|
|
||||||
const [image, setImage] = useState(null);
|
const [image, setImage] = useState(null);
|
||||||
const [imageLoaders, setImageLoaders] = useState({});
|
const [imageLoaders, setImageLoaders] = useState({});
|
||||||
const [currentWidget, setCurrentWidget] = useState("");
|
const [currentWidget, setCurrentWidget] = useState("");
|
||||||
@@ -68,7 +67,7 @@ function PrefillWidgetModal(props) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// useMemo to memoize the calculation of unique widgets
|
// useMemo to memoize the calculation of unique widgets
|
||||||
const memoizedUniqueWidget = useMemo(() => {
|
const uniqueWidget = useMemo(() => {
|
||||||
//functions to used remove duplicate name values across all pages
|
//functions to used remove duplicate name values across all pages
|
||||||
if (!props.prefillData) return [];
|
if (!props.prefillData) return [];
|
||||||
//This will help us track which name values have already been encountered across all pages.
|
//This will help us track which name values have already been encountered across all pages.
|
||||||
@@ -119,10 +118,6 @@ function PrefillWidgetModal(props) {
|
|||||||
savePrefillImg();
|
savePrefillImg();
|
||||||
}, [props.xyPosition]);
|
}, [props.xyPosition]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setUniqueWidget(memoizedUniqueWidget);
|
|
||||||
}, [memoizedUniqueWidget]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (totalImages > 0 && loadedImages === totalImages) {
|
if (totalImages > 0 && loadedImages === totalImages) {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
@@ -441,14 +436,12 @@ function PrefillWidgetModal(props) {
|
|||||||
handleCheckboxValue(e.target.checked, ind, position);
|
handleCheckboxValue(e.target.checked, ind, position);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{!position.options?.isHideLabel && (
|
<label
|
||||||
<label
|
htmlFor={`checkbox-${position.key + ind}`}
|
||||||
htmlFor={`checkbox-${position.key + ind}`}
|
className="text-xs mb-0 text-center ml-[3px] cursor-pointer"
|
||||||
className="text-xs mb-0 text-center ml-[3px] cursor-pointer"
|
>
|
||||||
>
|
{data}
|
||||||
{data}
|
</label>
|
||||||
</label>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -560,14 +553,12 @@ function PrefillWidgetModal(props) {
|
|||||||
handleWidgetDetails(position, data);
|
handleWidgetDetails(position, data);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{!position.options?.isHideLabel && (
|
<label
|
||||||
<label
|
htmlFor={`radio-${position.key + ind}`}
|
||||||
htmlFor={`radio-${position.key + ind}`}
|
className="text-xs mb-0 ml-[2px] cursor-pointer"
|
||||||
className="text-xs mb-0 ml-[2px] cursor-pointer"
|
>
|
||||||
>
|
{data}
|
||||||
{data}
|
</label>
|
||||||
</label>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -591,8 +582,8 @@ function PrefillWidgetModal(props) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleEmbedPrefill = (item) => {
|
const handleEmbedPrefill = async (item) => {
|
||||||
props.handleCreateDocument();
|
await props.handleCreateDocument();
|
||||||
};
|
};
|
||||||
//`loadOptions` function to use show all list of signer in dropdown
|
//`loadOptions` function to use show all list of signer in dropdown
|
||||||
const loadOptions = async (inputValue) => {
|
const loadOptions = async (inputValue) => {
|
||||||
@@ -654,7 +645,7 @@ function PrefillWidgetModal(props) {
|
|||||||
handleClose={props.handleClosePrefillModal}
|
handleClose={props.handleClosePrefillModal}
|
||||||
>
|
>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
{loading && (
|
{(props?.isSubmit || loading) && (
|
||||||
<div className="absolute inset-0 flex items-center justify-center bg-white/70 z-[9999]">
|
<div className="absolute inset-0 flex items-center justify-center bg-white/70 z-[9999]">
|
||||||
<Loader />
|
<Loader />
|
||||||
</div>
|
</div>
|
||||||
@@ -733,7 +724,7 @@ function PrefillWidgetModal(props) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex gap-2 mx-4 mb-3">
|
<div className="flex gap-2 mx-4 mb-3">
|
||||||
<button
|
<button
|
||||||
disabled={isAnyLoaderActive}
|
disabled={isAnyLoaderActive || props?.isSubmit}
|
||||||
className="op-btn op-btn-primary op-btn-sm w-[80px]"
|
className="op-btn op-btn-primary op-btn-sm w-[80px]"
|
||||||
onClick={() => handleEmbedPrefill(props?.item)}
|
onClick={() => handleEmbedPrefill(props?.item)}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -85,9 +85,12 @@ function RenderAllPdfPage(props) {
|
|||||||
alert(t("only-pdf-allowed"));
|
alert(t("only-pdf-allowed"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const mb = Math.round(file?.size / Math.pow(1024, 2));
|
const fileSize =
|
||||||
if (mb > maxFileSize) {
|
maxFileSize;
|
||||||
alert(`${t("file-alert-1")} ${maxFileSize} MB`);
|
const pdfsize = file?.size;
|
||||||
|
const fileSizeBytes = fileSize * 1024 * 1024;
|
||||||
|
if (pdfsize > fileSizeBytes) {
|
||||||
|
alert(`${t("file-alert-1")} ${fileSize} MB`);
|
||||||
removeFile(e);
|
removeFile(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -144,6 +147,13 @@ function RenderAllPdfPage(props) {
|
|||||||
useObjectStreams: false
|
useObjectStreams: false
|
||||||
});
|
});
|
||||||
const pdfBuffer = base64ToArrayBuffer(pdfBase64);
|
const pdfBuffer = base64ToArrayBuffer(pdfBase64);
|
||||||
|
const pdfsize = pdfBuffer?.byteLength;
|
||||||
|
const fileSizeBytes = fileSize * 1024 * 1024;
|
||||||
|
if (pdfsize > fileSizeBytes) {
|
||||||
|
alert(`${t("file-alert-1")} ${fileSize} MB`);
|
||||||
|
removeFile(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
props.setPdfArrayBuffer(pdfBuffer);
|
props.setPdfArrayBuffer(pdfBuffer);
|
||||||
props.setPdfBase64Url(pdfBase64);
|
props.setPdfBase64Url(pdfBase64);
|
||||||
props.setIsUploadPdf && props.setIsUploadPdf(true);
|
props.setIsUploadPdf && props.setIsUploadPdf(true);
|
||||||
|
|||||||
@@ -21,7 +21,9 @@ import {
|
|||||||
convertTextToImg,
|
convertTextToImg,
|
||||||
convertJpegToPng,
|
convertJpegToPng,
|
||||||
convertBase64ToFile,
|
convertBase64ToFile,
|
||||||
generatePdfName
|
generatePdfName,
|
||||||
|
getDefaultDate,
|
||||||
|
getDefaultFormat
|
||||||
} from "../../constant/Utils";
|
} from "../../constant/Utils";
|
||||||
import CellsWidget from "./CellsWidget";
|
import CellsWidget from "./CellsWidget";
|
||||||
import DatePicker from "react-datepicker";
|
import DatePicker from "react-datepicker";
|
||||||
@@ -36,7 +38,8 @@ import {
|
|||||||
setLastIndex,
|
setLastIndex,
|
||||||
setScrollTriggerId,
|
setScrollTriggerId,
|
||||||
setPrefillImg,
|
setPrefillImg,
|
||||||
setPrefillImgLoad
|
setPrefillImgLoad,
|
||||||
|
setTypedSignFont
|
||||||
} from "../../redux/reducers/widgetSlice";
|
} from "../../redux/reducers/widgetSlice";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import Loader from "../../primitives/Loader";
|
import Loader from "../../primitives/Loader";
|
||||||
@@ -44,22 +47,6 @@ import { emailRegex } from "../../constant/const";
|
|||||||
import RegexParser from "regex-parser";
|
import RegexParser from "regex-parser";
|
||||||
import { saveToMySign } from "../../utils/widgetUtils";
|
import { saveToMySign } from "../../utils/widgetUtils";
|
||||||
|
|
||||||
//function to get default format
|
|
||||||
const getDefaultFormat = (dateFormat) => dateFormat || "MM/dd/yyyy";
|
|
||||||
//function to convert formatted date to new Date() format
|
|
||||||
const getDefaultDate = (dateStr, format) => {
|
|
||||||
//get valid date format for moment to convert formatted date to new Date() format
|
|
||||||
const formats = changeDateToMomentFormat(format);
|
|
||||||
const parsedDate = moment(dateStr, formats);
|
|
||||||
let date;
|
|
||||||
if (parsedDate.isValid()) {
|
|
||||||
date = new Date(parsedDate.toISOString());
|
|
||||||
return date;
|
|
||||||
} else {
|
|
||||||
date = new Date();
|
|
||||||
return date;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const fontOptions = [
|
const fontOptions = [
|
||||||
{ value: "Fasthand" },
|
{ value: "Fasthand" },
|
||||||
{ value: "Dancing Script" },
|
{ value: "Dancing Script" },
|
||||||
@@ -79,6 +66,7 @@ function WidgetsValueModal(props) {
|
|||||||
const defaultSignImg = useSelector((state) => state.widget.defaultSignImg);
|
const defaultSignImg = useSelector((state) => state.widget.defaultSignImg);
|
||||||
const myInitial = useSelector((state) => state.widget.myInitial);
|
const myInitial = useSelector((state) => state.widget.myInitial);
|
||||||
const lastWidget = useSelector((state) => state.widget.lastIndex);
|
const lastWidget = useSelector((state) => state.widget.lastIndex);
|
||||||
|
const typedSignFont = useSelector((state) => state.widget.typedSignFont);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const canvasRef = useRef(null);
|
const canvasRef = useRef(null);
|
||||||
const imageRef = useRef(null);
|
const imageRef = useRef(null);
|
||||||
@@ -173,7 +161,7 @@ function WidgetsValueModal(props) {
|
|||||||
currWidgetsDetails?.options?.response,
|
currWidgetsDetails?.options?.response,
|
||||||
currWidgetsDetails?.options?.validation?.format
|
currWidgetsDetails?.options?.validation?.format
|
||||||
)
|
)
|
||||||
: new Date()
|
: ""
|
||||||
);
|
);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(setScrollTriggerId(currWidgetsDetails?.key));
|
dispatch(setScrollTriggerId(currWidgetsDetails?.key));
|
||||||
@@ -254,9 +242,7 @@ function WidgetsValueModal(props) {
|
|||||||
setXyPosition,
|
setXyPosition,
|
||||||
uniqueId,
|
uniqueId,
|
||||||
false,
|
false,
|
||||||
data?.format,
|
data?.format
|
||||||
currWidgetsDetails?.options?.fontSize || 12,
|
|
||||||
currWidgetsDetails?.options?.fontColor || "black"
|
|
||||||
);
|
);
|
||||||
setSelectDate({ date: date, format: data?.format });
|
setSelectDate({ date: date, format: data?.format });
|
||||||
};
|
};
|
||||||
@@ -278,10 +264,7 @@ function WidgetsValueModal(props) {
|
|||||||
setIsLoader(true);
|
setIsLoader(true);
|
||||||
try {
|
try {
|
||||||
dispatch(
|
dispatch(
|
||||||
setPrefillImg({
|
setPrefillImg({ id: currWidgetsDetails?.key, base64: image?.src })
|
||||||
id: currWidgetsDetails?.key,
|
|
||||||
base64: image?.src
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
const imageName = generatePdfName(16);
|
const imageName = generatePdfName(16);
|
||||||
const imageUrl = await convertBase64ToFile(
|
const imageUrl = await convertBase64ToFile(
|
||||||
@@ -630,11 +613,12 @@ function WidgetsValueModal(props) {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const loadFont = async () => {
|
const loadFont = async () => {
|
||||||
try {
|
try {
|
||||||
await document.fonts.load(`20px ${fontSelect}`);
|
const selectedFont = typedSignFont || fontSelect;
|
||||||
const selectFontSTyle = fontOptions.find(
|
await document.fonts.load(`20px ${selectedFont}`);
|
||||||
(font) => font.value === fontSelect
|
const selectFontStyle = fontOptions.find(
|
||||||
|
(font) => font.value === selectedFont
|
||||||
);
|
);
|
||||||
setFontSelect(selectFontSTyle?.value || fontOptions[0].value);
|
setFontSelect(selectFontStyle?.value || fontOptions[0].value);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error loading font:", error);
|
console.error("Error loading font:", error);
|
||||||
}
|
}
|
||||||
@@ -671,18 +655,21 @@ function WidgetsValueModal(props) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isTab === "type") {
|
if (isTab === "type") {
|
||||||
|
const signerName = localStorage.getItem("signer")
|
||||||
|
? JSON.parse(localStorage.getItem("signer"))?.Name
|
||||||
|
: currentUserName;
|
||||||
//trim user name or typed name value to show in initial signature
|
//trim user name or typed name value to show in initial signature
|
||||||
const trimmedName = typedSignature
|
const trimmedName = typedSignature
|
||||||
? typedSignature?.trim()
|
? typedSignature?.trim()
|
||||||
: props?.journey === "kiosk-signing" && kiosk_signer
|
: props?.journey === "kiosk-signing" && kiosk_signer
|
||||||
? kiosk_signer[0]?.Name?.trim()
|
? kiosk_signer[0]?.Name?.trim()
|
||||||
: currentUserName?.trim();
|
: signerName?.trim();
|
||||||
//get full name of user
|
//get full name of user
|
||||||
const fullUserName =
|
const fullUserName =
|
||||||
typedSignature ||
|
typedSignature ||
|
||||||
(props?.journey === "kiosk-signing" && kiosk_signer
|
(props?.journey === "kiosk-signing" && kiosk_signer
|
||||||
? kiosk_signer[0]?.Name
|
? kiosk_signer[0]?.Name
|
||||||
: currentUserName);
|
: signerName);
|
||||||
const firstCharacter = trimmedName?.charAt(0);
|
const firstCharacter = trimmedName?.charAt(0);
|
||||||
const userName =
|
const userName =
|
||||||
currWidgetsDetails?.type === "initials" ? firstCharacter : fullUserName;
|
currWidgetsDetails?.type === "initials" ? firstCharacter : fullUserName;
|
||||||
@@ -697,12 +684,13 @@ function WidgetsValueModal(props) {
|
|||||||
const maxWidth = currWidgetsDetails?.Width;
|
const maxWidth = currWidgetsDetails?.Width;
|
||||||
const maxHeight = currWidgetsDetails?.Height;
|
const maxHeight = currWidgetsDetails?.Height;
|
||||||
const widgetDims = { Width: maxWidth, Height: maxHeight };
|
const widgetDims = { Width: maxWidth, Height: maxHeight };
|
||||||
const fontFamily = fontStyle || fontSelect || "Fasthand";
|
const fontFamily = fontStyle || typedSignFont || fontSelect || "Fasthand";
|
||||||
const fillColor = color || penColor;
|
const fillColor = color || penColor;
|
||||||
const dataUrl = convertTextToImg(fontFamily, text, fillColor, widgetDims);
|
const dataUrl = convertTextToImg(fontFamily, text, fillColor, widgetDims);
|
||||||
setSignature(dataUrl);
|
setSignature(dataUrl);
|
||||||
setTextWidth(maxWidth);
|
setTextWidth(maxWidth);
|
||||||
setTextHeight(maxHeight);
|
setTextHeight(maxHeight);
|
||||||
|
dispatch(setTypedSignFont(fontFamily));
|
||||||
};
|
};
|
||||||
const PenColorComponent = () => {
|
const PenColorComponent = () => {
|
||||||
return (
|
return (
|
||||||
@@ -876,13 +864,14 @@ function WidgetsValueModal(props) {
|
|||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
>
|
>
|
||||||
{value}
|
{value ? value : "Select date"}
|
||||||
<i className="fa-light fa-calendar ml-[5px]"></i>
|
<i className="fa-light fa-calendar ml-[5px]"></i>
|
||||||
</div>
|
</div>
|
||||||
));
|
));
|
||||||
ExampleCustomInput.displayName = "ExampleCustomInput";
|
ExampleCustomInput.displayName = "ExampleCustomInput";
|
||||||
//function to set onchange date
|
//function to set onchange date
|
||||||
const handleOnDateChange = (date) => {
|
const handleOnDateChange = (date) => {
|
||||||
|
setWidgetValue(date);
|
||||||
setStartDate(date);
|
setStartDate(date);
|
||||||
};
|
};
|
||||||
const handleOnchangeTextBox = (e) => {
|
const handleOnchangeTextBox = (e) => {
|
||||||
@@ -1200,8 +1189,8 @@ function WidgetsValueModal(props) {
|
|||||||
)
|
)
|
||||||
) : isTab === "type" ? (
|
) : isTab === "type" ? (
|
||||||
<>
|
<>
|
||||||
<div className="flex justify-between items-center tabWidth">
|
<div className="flex justify-between items-center tabWidth rounded-[4px]">
|
||||||
<span className="mr-[5px] text-[12px]">
|
<span className="ml-[5px] text-[12px] text-base-content">
|
||||||
{currWidgetsDetails?.type === "initials"
|
{currWidgetsDetails?.type === "initials"
|
||||||
? t("initial-teb")
|
? t("initial-teb")
|
||||||
: t("signature-tab")}
|
: t("signature-tab")}
|
||||||
@@ -1228,7 +1217,7 @@ function WidgetsValueModal(props) {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="border-[1px] border-[#d6d3d3] mt-[10px] ml-[5px]">
|
<div className="border-[1px] border-[#d6d3d3] mt-[10px] rounded-[4px]">
|
||||||
{fontOptions.map((font, ind) => {
|
{fontOptions.map((font, ind) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -1251,7 +1240,7 @@ function WidgetsValueModal(props) {
|
|||||||
>
|
>
|
||||||
{typedSignature
|
{typedSignature
|
||||||
? typedSignature
|
? typedSignature
|
||||||
: "Your signature"}
|
: t("Your-Signature")}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -1466,52 +1455,59 @@ function WidgetsValueModal(props) {
|
|||||||
);
|
);
|
||||||
case "date":
|
case "date":
|
||||||
return (
|
return (
|
||||||
<div
|
<div className="flex flex-col">
|
||||||
className={`border-[1px] text-base-content data-[theme=opensigndark]:border-base-content data-[theme=opensigncss]:border-gray-300 rounded-[2px] p-1 px-3`}
|
<div
|
||||||
>
|
className={`border-[1px] text-base-content data-[theme=opensigndark]:border-base-content data-[theme=opensigncss]:border-gray-300 rounded-[2px] p-1 px-3`}
|
||||||
<DatePicker
|
>
|
||||||
renderCustomHeader={({ date, changeYear, changeMonth }) => (
|
<DatePicker
|
||||||
<div className="flex justify-start ml-2 ">
|
renderCustomHeader={({ date, changeYear, changeMonth }) => (
|
||||||
<select
|
<div className="flex justify-start ml-2 ">
|
||||||
className="bg-transparent outline-none"
|
<select
|
||||||
value={months[getMonth(date)]}
|
className="bg-transparent outline-none"
|
||||||
onChange={({ target: { value } }) =>
|
value={months[getMonth(date)]}
|
||||||
changeMonth(months.indexOf(value))
|
onChange={({ target: { value } }) =>
|
||||||
}
|
changeMonth(months.indexOf(value))
|
||||||
>
|
}
|
||||||
{months.map((option) => (
|
>
|
||||||
<option key={option} value={option}>
|
{months.map((option) => (
|
||||||
{option}
|
<option key={option} value={option}>
|
||||||
</option>
|
{option}
|
||||||
))}
|
</option>
|
||||||
</select>
|
))}
|
||||||
<select
|
</select>
|
||||||
className="bg-transparent outline-none"
|
<select
|
||||||
value={getYear(date)}
|
className="bg-transparent outline-none"
|
||||||
onChange={({ target: { value } }) => changeYear(value)}
|
value={getYear(date)}
|
||||||
>
|
onChange={({ target: { value } }) => changeYear(value)}
|
||||||
{years.map((option) => (
|
>
|
||||||
<option key={option} value={option}>
|
{years.map((option) => (
|
||||||
{option}
|
<option key={option} value={option}>
|
||||||
</option>
|
{option}
|
||||||
))}
|
</option>
|
||||||
</select>
|
))}
|
||||||
</div>
|
</select>
|
||||||
)}
|
</div>
|
||||||
closeOnScroll={true}
|
)}
|
||||||
selected={startDate}
|
closeOnScroll={true}
|
||||||
onChange={(date) => handleOnDateChange(date)}
|
selected={startDate}
|
||||||
popperPlacement="top-end"
|
onChange={(date) => handleOnDateChange(date)}
|
||||||
customInput={<ExampleCustomInput />}
|
popperPlacement="top-end"
|
||||||
dateFormat={
|
customInput={<ExampleCustomInput />}
|
||||||
selectDate
|
dateFormat={
|
||||||
? selectDate?.format
|
selectDate
|
||||||
: currWidgetsDetails?.options?.validation?.format
|
? selectDate?.format
|
||||||
? currWidgetsDetails?.options?.validation?.format
|
: currWidgetsDetails?.options?.validation?.format
|
||||||
: "MM/dd/yyyy"
|
? currWidgetsDetails?.options?.validation?.format
|
||||||
}
|
: "MM/dd/yyyy"
|
||||||
portalId="root-portal"
|
}
|
||||||
/>
|
portalId="root-portal"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="flex justify-center">
|
||||||
|
<span className="text-gray-300">
|
||||||
|
{currWidgetsDetails?.options?.validation?.format}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
case "email":
|
case "email":
|
||||||
@@ -1591,9 +1587,6 @@ function WidgetsValueModal(props) {
|
|||||||
const isCheckBox =
|
const isCheckBox =
|
||||||
!currWidgetsDetails.options?.isReadOnly &&
|
!currWidgetsDetails.options?.isReadOnly &&
|
||||||
currWidgetsDetails.type === "checkbox";
|
currWidgetsDetails.type === "checkbox";
|
||||||
const isRadio =
|
|
||||||
!currWidgetsDetails?.options?.isReadOnly &&
|
|
||||||
currWidgetsDetails?.type === radioButtonWidget;
|
|
||||||
if (isCheckBox) {
|
if (isCheckBox) {
|
||||||
//get minimum required count if exist
|
//get minimum required count if exist
|
||||||
const minCount =
|
const minCount =
|
||||||
@@ -1655,7 +1648,7 @@ function WidgetsValueModal(props) {
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
return (
|
return (
|
||||||
<span className="text-center text-[12px]">
|
<span className="text-center text-[12px] text-base-content">
|
||||||
{t("required-mssg", { leftRequiredWidget, totalWidget })}
|
{t("required-mssg", { leftRequiredWidget, totalWidget })}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
@@ -1887,15 +1880,15 @@ function WidgetsValueModal(props) {
|
|||||||
{isFinish ? (
|
{isFinish ? (
|
||||||
<>
|
<>
|
||||||
<div className="p-1 mt-3">
|
<div className="p-1 mt-3">
|
||||||
<span className="text-base">{t("finish-mssg")}</span>
|
<span className="text-base text-base-content">
|
||||||
|
{t("finish-mssg")}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex gap-3 items-center mt-4">
|
<div className="flex gap-3 items-center mt-4">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="op-btn op-btn-primary op-btn-sm px-4"
|
className="op-btn op-btn-primary op-btn-sm px-4"
|
||||||
onClick={() => {
|
onClick={() => handleFinish()}
|
||||||
handleFinish();
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{t("finish")}
|
{t("finish")}
|
||||||
</button>
|
</button>
|
||||||
@@ -1955,9 +1948,7 @@ function WidgetsValueModal(props) {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="op-btn op-btn-primary op-btn-sm"
|
className="op-btn op-btn-primary op-btn-sm"
|
||||||
onClick={() => {
|
onClick={() => handleClickOnNext()}
|
||||||
handleClickOnNext();
|
|
||||||
}}
|
|
||||||
disabled={handleDisable()}
|
disabled={handleDisable()}
|
||||||
>
|
>
|
||||||
{t("save")}
|
{t("save")}
|
||||||
@@ -1967,10 +1958,7 @@ function WidgetsValueModal(props) {
|
|||||||
type="button"
|
type="button"
|
||||||
className="op-btn op-btn-primary op-btn-sm"
|
className="op-btn op-btn-primary op-btn-sm"
|
||||||
disabled={handleDisable()}
|
disabled={handleDisable()}
|
||||||
onClick={() => {
|
onClick={() => handleClickOnNext(true)} // isFinishDoc
|
||||||
const isFinishDoc = true;
|
|
||||||
handleClickOnNext(isFinishDoc);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{t("done")}
|
{t("done")}
|
||||||
</button>
|
</button>
|
||||||
@@ -1978,9 +1966,7 @@ function WidgetsValueModal(props) {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="op-btn op-btn-primary op-btn-sm text-xs md:text-sm"
|
className="op-btn op-btn-primary op-btn-sm text-xs md:text-sm"
|
||||||
onClick={() => {
|
onClick={() => handleClickOnNext()}
|
||||||
handleClickOnNext();
|
|
||||||
}}
|
|
||||||
disabled={handleDisable()}
|
disabled={handleDisable()}
|
||||||
>
|
>
|
||||||
{t("next-field")}
|
{t("next-field")}
|
||||||
|
|||||||
@@ -410,9 +410,14 @@ export const changeDateToMomentFormat = (format) => {
|
|||||||
return "L";
|
return "L";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
export const addWidgetOptions = (type, signer, placeholder, widgetValue) => {
|
export const addWidgetOptions = (
|
||||||
|
type,
|
||||||
|
signer,
|
||||||
|
placeholder,
|
||||||
|
role,
|
||||||
|
widgetValue
|
||||||
|
) => {
|
||||||
let defaultOpt;
|
let defaultOpt;
|
||||||
//condition to handle widgets name field
|
|
||||||
if (placeholder) {
|
if (placeholder) {
|
||||||
const countSameWidget = placeholder?.reduce((count, page) => {
|
const countSameWidget = placeholder?.reduce((count, page) => {
|
||||||
return count + page.pos.filter((item) => item.type === type).length;
|
return count + page.pos.filter((item) => item.type === type).length;
|
||||||
@@ -472,7 +477,7 @@ export const addWidgetOptions = (type, signer, placeholder, widgetValue) => {
|
|||||||
: "MM/dd/yyyy";
|
: "MM/dd/yyyy";
|
||||||
return {
|
return {
|
||||||
...defaultOpt,
|
...defaultOpt,
|
||||||
response: getDate(signer?.DateFormat),
|
response: role === "prefill" ? getDate(signer?.DateFormat) : "",
|
||||||
validation: { format: dateFormat, type: "date-format" }
|
validation: { format: dateFormat, type: "date-format" }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -823,6 +828,8 @@ export const createDocument = async (
|
|||||||
) => {
|
) => {
|
||||||
if (template && template.length > 0) {
|
if (template && template.length > 0) {
|
||||||
const Doc = template[0];
|
const Doc = template[0];
|
||||||
|
const date = new Date();
|
||||||
|
const isoDate = date.toISOString();
|
||||||
let extUserId = Doc.ExtUserPtr.objectId;
|
let extUserId = Doc.ExtUserPtr.objectId;
|
||||||
let creatorId = Doc.CreatedBy.objectId;
|
let creatorId = Doc.CreatedBy.objectId;
|
||||||
const Extand_Class = localStorage.getItem("Extand_Class");
|
const Extand_Class = localStorage.getItem("Extand_Class");
|
||||||
@@ -898,6 +905,7 @@ export const createDocument = async (
|
|||||||
IsTourEnabled: Doc?.IsTourEnabled || false,
|
IsTourEnabled: Doc?.IsTourEnabled || false,
|
||||||
AllowModifications: Doc?.AllowModifications || false,
|
AllowModifications: Doc?.AllowModifications || false,
|
||||||
TimeToCompleteDays: parseInt(Doc?.TimeToCompleteDays) || 15,
|
TimeToCompleteDays: parseInt(Doc?.TimeToCompleteDays) || 15,
|
||||||
|
DocSentAt: { __type: "Date", iso: isoDate },
|
||||||
...SignatureType,
|
...SignatureType,
|
||||||
...NotifyOnSignatures,
|
...NotifyOnSignatures,
|
||||||
...Bcc,
|
...Bcc,
|
||||||
@@ -999,7 +1007,7 @@ export const onChangeInput = (
|
|||||||
dateFormat,
|
dateFormat,
|
||||||
fontSize,
|
fontSize,
|
||||||
fontColor,
|
fontColor,
|
||||||
isDateReadOnly
|
dateDetails
|
||||||
) => {
|
) => {
|
||||||
const isSigners = xyPosition.some(
|
const isSigners = xyPosition.some(
|
||||||
(data) => data.signerPtr || data.Role === "prefill"
|
(data) => data.signerPtr || data.Role === "prefill"
|
||||||
@@ -1031,9 +1039,18 @@ export const onChangeInput = (
|
|||||||
options: {
|
options: {
|
||||||
...position.options,
|
...position.options,
|
||||||
response: value,
|
response: value,
|
||||||
fontSize: fontSize,
|
fontSize: fontSize ? fontSize : position.options?.fontSize,
|
||||||
fontColor: fontColor,
|
fontColor: fontColor
|
||||||
isReadOnly: isDateReadOnly || false,
|
? fontColor
|
||||||
|
: position.options?.fontColor,
|
||||||
|
isReadOnly:
|
||||||
|
dateDetails?.isReadOnly !== "undefined"
|
||||||
|
? dateDetails?.isReadOnly
|
||||||
|
: position.options?.isReadOnly,
|
||||||
|
status:
|
||||||
|
dateDetails?.status !== "undefined"
|
||||||
|
? dateDetails?.status
|
||||||
|
: position.options?.status,
|
||||||
validation: {
|
validation: {
|
||||||
type: "date-format",
|
type: "date-format",
|
||||||
format: dateFormat // This indicates the required date format explicitly.
|
format: dateFormat // This indicates the required date format explicitly.
|
||||||
@@ -1993,7 +2010,17 @@ export const embedWidgetsToDoc = async (
|
|||||||
} else if (isTextTypeWidget) {
|
} else if (isTextTypeWidget) {
|
||||||
let textContent = "";
|
let textContent = "";
|
||||||
if (position?.options?.response) {
|
if (position?.options?.response) {
|
||||||
textContent = position.options?.response;
|
if (
|
||||||
|
position.type === "date" &&
|
||||||
|
position.options?.response === "today"
|
||||||
|
) {
|
||||||
|
const getFormat = changeDateToMomentFormat(
|
||||||
|
position?.options?.validation?.format
|
||||||
|
);
|
||||||
|
textContent = moment().format(getFormat);
|
||||||
|
} else {
|
||||||
|
textContent = position.options?.response;
|
||||||
|
}
|
||||||
} else if (position?.options?.defaultValue) {
|
} else if (position?.options?.defaultValue) {
|
||||||
textContent = position?.options?.defaultValue;
|
textContent = position?.options?.defaultValue;
|
||||||
}
|
}
|
||||||
@@ -3429,10 +3456,10 @@ export const updateDateWidgetsRes = (
|
|||||||
journey,
|
journey,
|
||||||
isRemovePrefill
|
isRemovePrefill
|
||||||
) => {
|
) => {
|
||||||
const extUser = localStorage.getItem("Extand_Class");
|
const contactUser = documentData?.Signers?.find(
|
||||||
const contactUser = documentData?.Signers.find(
|
|
||||||
(data) => data.objectId === signerId
|
(data) => data.objectId === signerId
|
||||||
);
|
);
|
||||||
|
const extUser = JSON.stringify([contactUser]);
|
||||||
let placeHolders = documentData?.Placeholders;
|
let placeHolders = documentData?.Placeholders;
|
||||||
if (isRemovePrefill) {
|
if (isRemovePrefill) {
|
||||||
placeHolders = placeHolders?.filter((x) => x.Role !== "prefill");
|
placeHolders = placeHolders?.filter((x) => x.Role !== "prefill");
|
||||||
@@ -3445,18 +3472,7 @@ export const updateDateWidgetsRes = (
|
|||||||
placeHolder: item?.placeHolder?.map((ph) => ({
|
placeHolder: item?.placeHolder?.map((ph) => ({
|
||||||
...ph,
|
...ph,
|
||||||
pos: ph?.pos?.map((widget) => {
|
pos: ph?.pos?.map((widget) => {
|
||||||
// only for date widgets *and* missing response
|
if (
|
||||||
if (widget.type === "date" && !widget.options.response) {
|
|
||||||
return {
|
|
||||||
...widget,
|
|
||||||
options: {
|
|
||||||
...widget.options,
|
|
||||||
response: getDate(
|
|
||||||
changeDateToMomentFormat(widget.options.validation.format)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
} else if (
|
|
||||||
["name", "email", "job title", "company"].includes(widget.type) &&
|
["name", "email", "job title", "company"].includes(widget.type) &&
|
||||||
!widget.options.defaultValue &&
|
!widget.options.defaultValue &&
|
||||||
!widget.options.response
|
!widget.options.response
|
||||||
@@ -3590,6 +3606,7 @@ export const handleCheckResponse = (checkUser, setminRequiredCount) => {
|
|||||||
//in `defaultValue` variable is used to get how many checkbox checked by default
|
//in `defaultValue` variable is used to get how many checkbox checked by default
|
||||||
const defaultValue =
|
const defaultValue =
|
||||||
requiredCheckbox[i].options?.defaultValue?.length;
|
requiredCheckbox[i].options?.defaultValue?.length;
|
||||||
|
const checkboxValue = response ? response : defaultValue;
|
||||||
//condition to check parseMin and parseMax greater than 0 then consider it as a required check box
|
//condition to check parseMin and parseMax greater than 0 then consider it as a required check box
|
||||||
if (
|
if (
|
||||||
parseMin > 0 &&
|
parseMin > 0 &&
|
||||||
@@ -3604,7 +3621,10 @@ export const handleCheckResponse = (checkUser, setminRequiredCount) => {
|
|||||||
setminRequiredCount(parseMin);
|
setminRequiredCount(parseMin);
|
||||||
}
|
}
|
||||||
//else condition to validate minimum required checkbox
|
//else condition to validate minimum required checkbox
|
||||||
else if (parseMin > 0 && (parseMin > response || !response)) {
|
else if (
|
||||||
|
parseMin > 0 &&
|
||||||
|
(parseMin > checkboxValue || !checkboxValue)
|
||||||
|
) {
|
||||||
if (!showAlert) {
|
if (!showAlert) {
|
||||||
showAlert = true;
|
showAlert = true;
|
||||||
widgetKey = requiredCheckbox[i].key;
|
widgetKey = requiredCheckbox[i].key;
|
||||||
@@ -3803,7 +3823,7 @@ export const sendEmailToSigners = async (
|
|||||||
htmlReqBody,
|
htmlReqBody,
|
||||||
variables
|
variables
|
||||||
);
|
);
|
||||||
} else if (defaultMail) {
|
} else if (defaultMail?.body && defaultMail?.subject) {
|
||||||
const mailBody = defaultMail?.body;
|
const mailBody = defaultMail?.body;
|
||||||
const mailSubject = defaultMail.subject;
|
const mailSubject = defaultMail.subject;
|
||||||
const replacedRequestBody = mailBody.replace(/"/g, "'");
|
const replacedRequestBody = mailBody.replace(/"/g, "'");
|
||||||
@@ -4031,3 +4051,19 @@ export const handleDeleteWidget = (key, Id, pageNumber, signerPos) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
//function to convert formatted date to new Date() format
|
||||||
|
export const getDefaultDate = (dateStr, format) => {
|
||||||
|
//get valid date format for moment to convert formatted date to new Date() format
|
||||||
|
const formats = changeDateToMomentFormat(format);
|
||||||
|
const parsedDate = moment(dateStr, formats);
|
||||||
|
let date;
|
||||||
|
if (parsedDate.isValid()) {
|
||||||
|
date = new Date(parsedDate.toISOString());
|
||||||
|
return date;
|
||||||
|
} else if (dateStr === "today") {
|
||||||
|
date = new Date();
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
//function to get default format
|
||||||
|
export const getDefaultFormat = (dateFormat) => dateFormat || "MM/dd/yyyy";
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export const getThemeIconColor = () => {
|
|||||||
return theme === "opensigndark" ? "#CCCCCC" : "#686968";
|
return theme === "opensigndark" ? "#CCCCCC" : "#686968";
|
||||||
};
|
};
|
||||||
export const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
export const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
||||||
export const maxFileSize = 10; // 10MB
|
|
||||||
export const maxTitleLength = 250; // 250 characters
|
export const maxTitleLength = 250; // 250 characters
|
||||||
export const maxNoteLength = 200; // 200 characters
|
export const maxNoteLength = 200; // 200 characters
|
||||||
export const maxDescriptionLength = 500; // 500 characters
|
export const maxDescriptionLength = 500; // 500 characters
|
||||||
|
export const maxFileSize = 80; // for cloud 10MB / 80MB for self-hosted
|
||||||
|
|||||||
@@ -2,10 +2,11 @@ import { useEffect, useMemo } from "react";
|
|||||||
|
|
||||||
export function useManifestUrl(appName, logo) {
|
export function useManifestUrl(appName, logo) {
|
||||||
const url = useMemo(() => {
|
const url = useMemo(() => {
|
||||||
|
const start_url = window.location.origin || ".";
|
||||||
const manifest = {
|
const manifest = {
|
||||||
short_name: appName,
|
short_name: appName,
|
||||||
name: appName,
|
name: appName,
|
||||||
start_url: ".",
|
start_url: start_url,
|
||||||
display: "standalone",
|
display: "standalone",
|
||||||
theme_color: "#000000",
|
theme_color: "#000000",
|
||||||
background_color: "#ffffff",
|
background_color: "#ffffff",
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export const extraCols = [
|
|||||||
export default function reportJson(id) {
|
export default function reportJson(id) {
|
||||||
const head = ["Title", "Note", "Folder", "File", "Owner", "Signers"];
|
const head = ["Title", "Note", "Folder", "File", "Owner", "Signers"];
|
||||||
const declineHead = ["Title", "Reason", "Folder", "File", "Owner", "Signers"];
|
const declineHead = ["Title", "Reason", "Folder", "File", "Owner", "Signers"];
|
||||||
const iphead = ["Title", "Note", "Folder", "File", "Signers"];
|
const iphead = ["Title", "Note", "Folder", "File", "Signers", "Sent Date"];
|
||||||
const contactbook = ["Name", "Email", "Phone", "Company", "JobTitle"];
|
const contactbook = ["Name", "Email", "Phone", "Company", "JobTitle"];
|
||||||
const dashboardReportHead = ["Title", "File", "Owner", "Signers"];
|
const dashboardReportHead = ["Title", "File", "Owner", "Signers"];
|
||||||
const templateReport = ["Title", "File", "Owner", "Signers"];
|
const templateReport = ["Title", "File", "Owner", "Signers"];
|
||||||
@@ -38,25 +38,6 @@ export default function reportJson(id) {
|
|||||||
redirectUrl: "",
|
redirectUrl: "",
|
||||||
action: "delete"
|
action: "delete"
|
||||||
}
|
}
|
||||||
// {
|
|
||||||
// btnId: "22534",
|
|
||||||
// hoverLabel: "option",
|
|
||||||
// btnColor: "",
|
|
||||||
// restrictBtn: true,
|
|
||||||
// textColor: "black",
|
|
||||||
// btnIcon: "fa-light fa-ellipsis-vertical fa-lg",
|
|
||||||
// action: "option",
|
|
||||||
// subaction: [
|
|
||||||
// {
|
|
||||||
// btnId: "1630",
|
|
||||||
// btnLabel: "Save as template",
|
|
||||||
// hoverLabel: "Save as template",
|
|
||||||
// btnIcon: "fa-light fa-envelope",
|
|
||||||
// redirectUrl: "",
|
|
||||||
// action: "saveastemplate"
|
|
||||||
// }
|
|
||||||
// ]
|
|
||||||
// }
|
|
||||||
],
|
],
|
||||||
helpMsg:
|
helpMsg:
|
||||||
"These are documents you have started but have not finalized for sending."
|
"These are documents you have started but have not finalized for sending."
|
||||||
@@ -429,25 +410,6 @@ export default function reportJson(id) {
|
|||||||
redirectUrl: "",
|
redirectUrl: "",
|
||||||
action: "delete"
|
action: "delete"
|
||||||
}
|
}
|
||||||
// {
|
|
||||||
// btnId: "55534",
|
|
||||||
// hoverLabel: "option",
|
|
||||||
// btnColor: "",
|
|
||||||
// restrictBtn: true,
|
|
||||||
// textColor: "black",
|
|
||||||
// btnIcon: "fa-light fa-ellipsis-vertical fa-lg",
|
|
||||||
// action: "option",
|
|
||||||
// subaction: [
|
|
||||||
// {
|
|
||||||
// btnId: "6630",
|
|
||||||
// btnLabel: "Save as template",
|
|
||||||
// hoverLabel: "Save as template",
|
|
||||||
// btnIcon: "fa-light fa-envelope",
|
|
||||||
// redirectUrl: "",
|
|
||||||
// action: "saveastemplate"
|
|
||||||
// }
|
|
||||||
// ]
|
|
||||||
// }
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
// contactbook report
|
// contactbook report
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ const dashboardJson = [
|
|||||||
queryType: "",
|
queryType: "",
|
||||||
class: "contracts_Document",
|
class: "contracts_Document",
|
||||||
query:
|
query:
|
||||||
'where={"Type":null,"Signers":{"#*exists":true},"Placeholders":{"#*exists":true},"SignedUrl":{"#*exists":true},"IsCompleted":false,"IsDeclined":false,"IsArchive":null,"CreatedBy":{"__type":"Pointer","className":"_User","objectId":"#UserId.objectId#"},"ExpiryDate":{"#*gt":{"__type":"#Date#","iso":"#today#"}}}&keys=Name,ExpiryDate,SignedUrl,Signers&count=1',
|
'where={"Type":{"#*ne":"Folder"},"Signers":{"#*exists":true},"Placeholders":{"#*exists":true},"SignedUrl":{"#*exists":true},"IsCompleted":{"#*ne":true},"IsDeclined":{"#*ne":true},"IsArchive":{"#*ne":true},"CreatedBy":{"__type":"Pointer","className":"_User","objectId":"#UserId.objectId#"},"ExpiryDate":{"#*gt":{"__type":"#Date#","iso":"#today#"}}}&count=1&limit=0',
|
||||||
key: "count",
|
key: "count",
|
||||||
Redirect_type: "Report",
|
Redirect_type: "Report",
|
||||||
Redirect_id: "1MwEuxLEkF",
|
Redirect_id: "1MwEuxLEkF",
|
||||||
|
|||||||
@@ -4,21 +4,22 @@ import Footer from "../components/Footer";
|
|||||||
import Sidebar from "../components/sidebar/Sidebar";
|
import Sidebar from "../components/sidebar/Sidebar";
|
||||||
import Tour from "../primitives/Tour";
|
import Tour from "../primitives/Tour";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import Parse from "parse";
|
import Parse from "parse";
|
||||||
import ModalUi from "../primitives/ModalUi";
|
import { useNavigate, Outlet } from "react-router";
|
||||||
import { useNavigate, useLocation, Outlet } from "react-router";
|
|
||||||
import Loader from "../primitives/Loader";
|
import Loader from "../primitives/Loader";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { sessionStatus } from "../redux/reducers/userReducer";
|
||||||
|
import SessionExpiredModal from "../primitives/SessionExpiredModal";
|
||||||
|
|
||||||
const HomeLayout = () => {
|
const HomeLayout = () => {
|
||||||
const appName =
|
const appName =
|
||||||
"OpenSign™";
|
"OpenSign™";
|
||||||
const { t, i18n } = useTranslation();
|
const { t, i18n } = useTranslation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const location = useLocation();
|
const dispatch = useDispatch();
|
||||||
const arr = useSelector((state) => state.TourSteps);
|
const arr = useSelector((state) => state.TourSteps);
|
||||||
const [isUserValid, setIsUserValid] = useState(true);
|
const isValidSession = useSelector((state) => state.user.isValidSession);
|
||||||
const [isLoader, setIsLoader] = useState(true);
|
const [isLoader, setIsLoader] = useState(true);
|
||||||
const [isCloseBtn, setIsCloseBtn] = useState(true);
|
const [isCloseBtn, setIsCloseBtn] = useState(true);
|
||||||
const [isTour, setIsTour] = useState(false);
|
const [isTour, setIsTour] = useState(false);
|
||||||
@@ -35,28 +36,31 @@ const HomeLayout = () => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!tenantId) {
|
if (localStorage.getItem("accesstoken")) {
|
||||||
setIsUserValid(false);
|
if (!tenantId) {
|
||||||
} else {
|
dispatch(sessionStatus(false));
|
||||||
(async () => {
|
} else {
|
||||||
try {
|
(async () => {
|
||||||
// Use the session token to validate the user
|
try {
|
||||||
const userQuery = new Parse.Query(Parse.User);
|
// Use the session token to validate the user
|
||||||
const user = await userQuery.get(Parse?.User?.current()?.id, {
|
const userQuery = new Parse.Query(Parse.User);
|
||||||
sessionToken: localStorage.getItem("accesstoken")
|
const user = await userQuery.get(Parse?.User?.current()?.id, {
|
||||||
});
|
sessionToken: localStorage.getItem("accesstoken")
|
||||||
if (user) {
|
});
|
||||||
localStorage.setItem("profileImg", user.get("ProfilePic") || "");
|
if (user) {
|
||||||
setIsUserValid(true);
|
localStorage.setItem("profileImg", user.get("ProfilePic") || "");
|
||||||
setIsLoader(false);
|
dispatch(sessionStatus(true));
|
||||||
} else {
|
setIsLoader(false);
|
||||||
setIsUserValid(false);
|
} else {
|
||||||
|
dispatch(sessionStatus(true));
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("catch");
|
||||||
|
// Session token is invalid or there was an error
|
||||||
|
dispatch(sessionStatus(false));
|
||||||
}
|
}
|
||||||
} catch (error) {
|
})();
|
||||||
// Session token is invalid or there was an error
|
}
|
||||||
setIsUserValid(false);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
@@ -169,77 +173,56 @@ const HomeLayout = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleLoginBtn = async () => {
|
return isValidSession && localStorage.getItem("accesstoken") ? (
|
||||||
try {
|
|
||||||
await Parse?.User?.logOut();
|
|
||||||
} catch (err) {
|
|
||||||
console.log("err ", err);
|
|
||||||
} finally {
|
|
||||||
localStorage.removeItem("accesstoken");
|
|
||||||
navigate("/", { replace: true, state: { from: location } });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<div className="flex flex-col h-screen overflow-hidden">
|
<div className="flex flex-col h-screen overflow-hidden">
|
||||||
{/* HEADER */}
|
{/* HEADER */}
|
||||||
<header className="z-[501]">
|
<header className="z-[501]">
|
||||||
{!isLoader && <Header setIsLoggingOut={setIsLoggingOut} />}
|
{!isLoader && <Header setIsLoggingOut={setIsLoggingOut} />}
|
||||||
</header>
|
</header>
|
||||||
{isUserValid ? (
|
{isLoader ? (
|
||||||
|
<div className="flex h-[100vh] justify-center items-center">
|
||||||
|
<Loader />
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
<>
|
<>
|
||||||
{isLoader ? (
|
{isLoggingOut && (
|
||||||
<div className="flex h-[100vh] justify-center items-center">
|
<div className="inset-0 bg-black/30 z-[1000] fixed flex justify-center items-center">
|
||||||
<Loader />
|
<Loader />
|
||||||
</div>
|
</div>
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
{isLoggingOut && (
|
|
||||||
<div className="inset-0 bg-black/30 z-[1000] fixed flex justify-center items-center">
|
|
||||||
<Loader />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{/* BODY */}
|
|
||||||
<div className="flex flex-1 overflow-hidden">
|
|
||||||
{/* SIDEBAR with width animation */}
|
|
||||||
<Sidebar />
|
|
||||||
{/* MAIN (includes both content + footer in one scrollable column) */}
|
|
||||||
<main
|
|
||||||
id="renderList"
|
|
||||||
className="flex-1 overflow-auto transition-all duration-300 ease-in-out"
|
|
||||||
>
|
|
||||||
<div className="flex flex-col min-h-full">
|
|
||||||
{/* your page content */}
|
|
||||||
<div className="p-3">{<Outlet />}</div>
|
|
||||||
{/* sticky-but-scrollable footer */}
|
|
||||||
<div className="mt-auto z-30">
|
|
||||||
<Footer />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
</div>
|
|
||||||
<Tour
|
|
||||||
onRequestClose={closeTour}
|
|
||||||
steps={tourConfigs}
|
|
||||||
isOpen={isTour}
|
|
||||||
disableKeyboardNavigation={["esc"]}
|
|
||||||
// disableInteraction={true}
|
|
||||||
scrollOffset={-100}
|
|
||||||
showCloseButton={isCloseBtn}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
</>
|
{/* BODY */}
|
||||||
) : (
|
<div className="flex flex-1 overflow-hidden">
|
||||||
<ModalUi showHeader={false} isOpen={true} showClose={false}>
|
{/* SIDEBAR with width animation */}
|
||||||
<div className="flex flex-col justify-center items-center py-4 md:py-5 gap-5">
|
<Sidebar />
|
||||||
<p className="text-xl font-medium">{t("session-expired")}</p>
|
{/* MAIN (includes both content + footer in one scrollable column) */}
|
||||||
<button onClick={handleLoginBtn} className="op-btn op-btn-neutral">
|
<main
|
||||||
{t("login")}
|
id="renderList"
|
||||||
</button>
|
className="flex-1 overflow-auto transition-all duration-300 ease-in-out"
|
||||||
|
>
|
||||||
|
<div className="flex flex-col min-h-full">
|
||||||
|
{/* your page content */}
|
||||||
|
<div className="p-3">{<Outlet />}</div>
|
||||||
|
{/* sticky-but-scrollable footer */}
|
||||||
|
<div className="mt-auto z-30">
|
||||||
|
<Footer />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</ModalUi>
|
<Tour
|
||||||
|
onRequestClose={closeTour}
|
||||||
|
steps={tourConfigs}
|
||||||
|
isOpen={isTour}
|
||||||
|
disableKeyboardNavigation={["esc"]}
|
||||||
|
// disableInteraction={true}
|
||||||
|
scrollOffset={-100}
|
||||||
|
showCloseButton={isCloseBtn}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
) : (
|
||||||
|
<SessionExpiredModal />
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ function processDimensions(x, y, width, height) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
const DebugPdf = () => {
|
const DebugPdf = () => {
|
||||||
const {t} = useTranslation()
|
const { t } = useTranslation();
|
||||||
const { width } = useWindowSize();
|
const { width } = useWindowSize();
|
||||||
const [pdf, setPdf] = useState("");
|
const [pdf, setPdf] = useState("");
|
||||||
const [isModal, setIsModal] = useState(true);
|
const [isModal, setIsModal] = useState(true);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ const DocSuccessPage = () => {
|
|||||||
objectId: docId,
|
objectId: docId,
|
||||||
SignedUrl: docUrl,
|
SignedUrl: docUrl,
|
||||||
CertificateUrl: certificate,
|
CertificateUrl: certificate,
|
||||||
IsCompleted: completed
|
IsCompleted: completed,
|
||||||
};
|
};
|
||||||
setPdfDetails([details]);
|
setPdfDetails([details]);
|
||||||
const base64Pdf = await getBase64FromUrl(docUrl);
|
const base64Pdf = await getBase64FromUrl(docUrl);
|
||||||
@@ -52,7 +52,9 @@ const DocSuccessPage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleDownload = () => {
|
const handleDownload = () => {
|
||||||
if (pdfDetails?.[0]?.IsCompleted) {
|
if (
|
||||||
|
pdfDetails?.[0]?.IsCompleted
|
||||||
|
) {
|
||||||
setIsDownloadModal(true);
|
setIsDownloadModal(true);
|
||||||
} else {
|
} else {
|
||||||
handleDownloadPdf(pdfDetails, setIsDownloading, pdfBase64Url);
|
handleDownloadPdf(pdfDetails, setIsDownloading, pdfBase64Url);
|
||||||
@@ -99,21 +101,26 @@ const DocSuccessPage = () => {
|
|||||||
<span>{t("download")}</span>
|
<span>{t("download")}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{pdfDetails?.[0]?.IsCompleted && (
|
{
|
||||||
<button
|
pdfDetails?.[0]?.IsCompleted && (
|
||||||
type="button"
|
<button
|
||||||
onClick={() =>
|
type="button"
|
||||||
handleDownloadCertificate(pdfDetails, setIsDownloading)
|
onClick={() =>
|
||||||
}
|
handleDownloadCertificate(
|
||||||
className="font-medium text-sm md:text-[13px] md:px-4 py-2 op-btn op-btn-secondary"
|
pdfDetails,
|
||||||
>
|
setIsDownloading
|
||||||
<i
|
)
|
||||||
className="fa-light fa-award mx-[3px] md:mx-0"
|
}
|
||||||
aria-hidden="true"
|
className="font-medium text-sm md:text-[13px] md:px-4 py-2 op-btn op-btn-secondary"
|
||||||
></i>
|
>
|
||||||
<span>{t("certificate")}</span>
|
<i
|
||||||
</button>
|
className="fa-light fa-award mx-[3px] md:mx-0"
|
||||||
)}
|
aria-hidden="true"
|
||||||
|
></i>
|
||||||
|
<span>{t("certificate")}</span>
|
||||||
|
</button>
|
||||||
|
)
|
||||||
|
}
|
||||||
<button
|
<button
|
||||||
onClick={(e) =>
|
onClick={(e) =>
|
||||||
handleToPrint(e, setIsDownloading, pdfDetails)
|
handleToPrint(e, setIsDownloading, pdfDetails)
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ import ModalUi from "../primitives/ModalUi";
|
|||||||
import { Tooltip } from "react-tooltip";
|
import { Tooltip } from "react-tooltip";
|
||||||
import Loader from "../primitives/Loader";
|
import Loader from "../primitives/Loader";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { useDispatch } from "react-redux";
|
||||||
|
import { sessionStatus } from "../redux/reducers/userReducer";
|
||||||
|
|
||||||
// `Form` render all type of Form on this basis of their provided in path
|
// `Form` render all type of Form on this basis of their provided in path
|
||||||
function Form() {
|
function Form() {
|
||||||
@@ -50,6 +52,7 @@ const Forms = (props) => {
|
|||||||
const abortController = new AbortController();
|
const abortController = new AbortController();
|
||||||
const inputFileRef = useRef(null);
|
const inputFileRef = useRef(null);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const dispatch = useDispatch();
|
||||||
const [signers, setSigners] = useState([]);
|
const [signers, setSigners] = useState([]);
|
||||||
const [folder, setFolder] = useState({ ObjectId: "", Name: "" });
|
const [folder, setFolder] = useState({ ObjectId: "", Name: "" });
|
||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
@@ -67,7 +70,7 @@ const Forms = (props) => {
|
|||||||
NotifyOnSignatures: "",
|
NotifyOnSignatures: "",
|
||||||
Bcc: [],
|
Bcc: [],
|
||||||
RedirectUrl: "",
|
RedirectUrl: "",
|
||||||
AllowModifications: false
|
AllowModifications: false,
|
||||||
});
|
});
|
||||||
const [fileupload, setFileUpload] = useState("");
|
const [fileupload, setFileUpload] = useState("");
|
||||||
const [selectedFiles, setSelectedFiles] = useState([]);
|
const [selectedFiles, setSelectedFiles] = useState([]);
|
||||||
@@ -98,6 +101,8 @@ const Forms = (props) => {
|
|||||||
extUserData?.IsTourEnabled === false
|
extUserData?.IsTourEnabled === false
|
||||||
? "false"
|
? "false"
|
||||||
: "true";
|
: "true";
|
||||||
|
const fileSize =
|
||||||
|
maxFileSize;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleReset();
|
handleReset();
|
||||||
return () => abortController.abort();
|
return () => abortController.abort();
|
||||||
@@ -136,11 +141,10 @@ const Forms = (props) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// setFormData((prev) => ({ ...prev, file: files[0] }));
|
// setFormData((prev) => ({ ...prev, file: files[0] }));
|
||||||
const totalMb = Math.round(
|
const totalBytes = Math.round(files.reduce((sum, f) => sum + f.size, 0)); // in bytes
|
||||||
files.reduce((sum, f) => sum + f.size, 0) / Math.pow(1024, 2)
|
const fileSizeBytes = fileSize * 1024 * 1024;
|
||||||
);
|
if (totalBytes > fileSizeBytes) {
|
||||||
if (totalMb > maxFileSize) {
|
alert(`${t("file-alert-1")} ${fileSize} MB`);
|
||||||
alert(`${t("file-alert-1")} ${maxFileSize} MB`);
|
|
||||||
setFileUpload("");
|
setFileUpload("");
|
||||||
setSelectedFiles([]);
|
setSelectedFiles([]);
|
||||||
removeFile(e);
|
removeFile(e);
|
||||||
@@ -276,7 +280,11 @@ const Forms = (props) => {
|
|||||||
console.log("err in docx to pdf ", err);
|
console.log("err in docx to pdf ", err);
|
||||||
const error =
|
const error =
|
||||||
t("docx-error");
|
t("docx-error");
|
||||||
alert(error);
|
if (err?.code === 209) {
|
||||||
|
dispatch(sessionStatus(false));
|
||||||
|
} else {
|
||||||
|
alert(error);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -334,8 +342,13 @@ const Forms = (props) => {
|
|||||||
setSelectedFiles([]);
|
setSelectedFiles([]);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
alert(error.message);
|
if (error?.code === 209) {
|
||||||
|
dispatch(sessionStatus(false));
|
||||||
|
} else {
|
||||||
|
alert(error.message);
|
||||||
|
}
|
||||||
setSelectedFiles([]);
|
setSelectedFiles([]);
|
||||||
|
removeFile(e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// `isValidURL` is used to check valid webhook url
|
// `isValidURL` is used to check valid webhook url
|
||||||
@@ -461,7 +474,7 @@ const Forms = (props) => {
|
|||||||
IsEnableOTP: "false",
|
IsEnableOTP: "false",
|
||||||
IsTourEnabled: istourenabled,
|
IsTourEnabled: istourenabled,
|
||||||
RedirectUrl: "",
|
RedirectUrl: "",
|
||||||
AllowModifications: false
|
AllowModifications: false,
|
||||||
});
|
});
|
||||||
setFileUpload("");
|
setFileUpload("");
|
||||||
setSelectedFiles([]);
|
setSelectedFiles([]);
|
||||||
@@ -470,7 +483,9 @@ const Forms = (props) => {
|
|||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("err ", err);
|
console.log("err ", err);
|
||||||
if (err.message === "only 15 reminder allowed") {
|
if (err?.code === 209) {
|
||||||
|
dispatch(sessionStatus(false));
|
||||||
|
} else if (err.message === "only 15 reminder allowed") {
|
||||||
setIsAlert({
|
setIsAlert({
|
||||||
type: "danger",
|
type: "danger",
|
||||||
message: t("only-15-reminder-allowed")
|
message: t("only-15-reminder-allowed")
|
||||||
@@ -541,7 +556,7 @@ const Forms = (props) => {
|
|||||||
IsTourEnabled: istourenabled,
|
IsTourEnabled: istourenabled,
|
||||||
NotifyOnSignatures: notifySign,
|
NotifyOnSignatures: notifySign,
|
||||||
RedirectUrl: "",
|
RedirectUrl: "",
|
||||||
AllowModifications: false
|
AllowModifications: false,
|
||||||
};
|
};
|
||||||
setFormData(obj);
|
setFormData(obj);
|
||||||
removeFile();
|
removeFile();
|
||||||
@@ -602,7 +617,9 @@ const Forms = (props) => {
|
|||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
removeFile();
|
removeFile();
|
||||||
if (err?.response?.status === 401) {
|
if (err?.code === 209) {
|
||||||
|
dispatch(sessionStatus(false));
|
||||||
|
} else if (err?.response?.status === 401) {
|
||||||
setIsPassword(true);
|
setIsPassword(true);
|
||||||
setIsCorrectPass(false);
|
setIsCorrectPass(false);
|
||||||
} else {
|
} else {
|
||||||
@@ -631,10 +648,12 @@ const Forms = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="shadow-md rounded-box my-[2px] p-3 bg-base-100 text-base-content">
|
<div
|
||||||
|
className={`${isSubmit ? "" : "shadow-md rounded-box my-[2px] p-3 bg-base-100 text-base-content"}`}
|
||||||
|
>
|
||||||
{isAlert?.message && <Alert type={isAlert.type}>{isAlert.message}</Alert>}
|
{isAlert?.message && <Alert type={isAlert.type}>{isAlert.message}</Alert>}
|
||||||
{isSubmit ? (
|
{isSubmit ? (
|
||||||
<div className="h-[300px] flex justify-center items-center">
|
<div className="flex flex-col justify-center items-center h-[100vh]">
|
||||||
<Loader />
|
<Loader />
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
@@ -1047,7 +1066,7 @@ const Forms = (props) => {
|
|||||||
></div>
|
></div>
|
||||||
)}
|
)}
|
||||||
{isAdvanceOpt && (
|
{isAdvanceOpt && (
|
||||||
<div className="card bg-base-100 rounded-box p-3 flex-grow ">
|
<div className="card bg-base-100 rounded-box p-3 flex-grow ">
|
||||||
{formData?.autoreminder === true &&
|
{formData?.autoreminder === true &&
|
||||||
props.title !== "New Template" && (
|
props.title !== "New Template" && (
|
||||||
<div className="text-xs mt-2">
|
<div className="text-xs mt-2">
|
||||||
|
|||||||
@@ -378,6 +378,7 @@ function GuestLogin() {
|
|||||||
e.target.setCustomValidity(t("input-required"))
|
e.target.setCustomValidity(t("input-required"))
|
||||||
}
|
}
|
||||||
onInput={(e) => e.target.setCustomValidity("")}
|
onInput={(e) => e.target.setCustomValidity("")}
|
||||||
|
placeholder={t("enter-name")}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -395,6 +396,7 @@ function GuestLogin() {
|
|||||||
value={contact.email}
|
value={contact.email}
|
||||||
onChange={handleInputChange}
|
onChange={handleInputChange}
|
||||||
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"
|
||||||
|
placeholder={t("enter-email")}
|
||||||
required
|
required
|
||||||
disabled
|
disabled
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -14,8 +14,9 @@ import {
|
|||||||
setMyInitial,
|
setMyInitial,
|
||||||
setDefaultSignImg,
|
setDefaultSignImg,
|
||||||
resetWidgetState,
|
resetWidgetState,
|
||||||
setPrefillImg
|
setPrefillImg,
|
||||||
} from "../redux/reducers/widgetSlice.js";
|
setTypedSignFont
|
||||||
|
} from "../redux/reducers/widgetSlice";
|
||||||
import {
|
import {
|
||||||
contractDocument,
|
contractDocument,
|
||||||
embedWidgetsToDoc,
|
embedWidgetsToDoc,
|
||||||
@@ -736,6 +737,7 @@ function PdfRequestFiles(
|
|||||||
widgets
|
widgets
|
||||||
);
|
);
|
||||||
if (resSign && resSign.status === "success") {
|
if (resSign && resSign.status === "success") {
|
||||||
|
dispatch(setTypedSignFont("Fasthand"));
|
||||||
setPdfUrl(resSign.data);
|
setPdfUrl(resSign.data);
|
||||||
setIsSigned(true);
|
setIsSigned(true);
|
||||||
setSignedSigners([]);
|
setSignedSigners([]);
|
||||||
@@ -884,7 +886,8 @@ function PdfRequestFiles(
|
|||||||
?.IsCompleted
|
?.IsCompleted
|
||||||
? `&completed=true`
|
? `&completed=true`
|
||||||
: "";
|
: "";
|
||||||
const params = `docid=${updatedDoc.updatedPdfDetails[0].objectId}&docurl=${encodeURIComponent(url)}${isCompleted}${fileAdapter}`;
|
const params =
|
||||||
|
`docid=${updatedDoc.updatedPdfDetails[0].objectId}&docurl=${encodeURIComponent(url)}${isCompleted}${fileAdapter}`;
|
||||||
window.location.href = `/success?${params}`;
|
window.location.href = `/success?${params}`;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1509,6 +1512,7 @@ function PdfRequestFiles(
|
|||||||
dragTypeValue,
|
dragTypeValue,
|
||||||
owner,
|
owner,
|
||||||
filterSignerPos?.placeHolder,
|
filterSignerPos?.placeHolder,
|
||||||
|
null,
|
||||||
widgetValue
|
widgetValue
|
||||||
),
|
),
|
||||||
Width: widgetWidth / (containerScale * scale),
|
Width: widgetWidth / (containerScale * scale),
|
||||||
@@ -1545,6 +1549,7 @@ function PdfRequestFiles(
|
|||||||
dragTypeValue,
|
dragTypeValue,
|
||||||
owner,
|
owner,
|
||||||
filterSignerPos?.placeHolder,
|
filterSignerPos?.placeHolder,
|
||||||
|
null,
|
||||||
widgetValue
|
widgetValue
|
||||||
),
|
),
|
||||||
Width: widgetWidth / (containerScale * scale),
|
Width: widgetWidth / (containerScale * scale),
|
||||||
@@ -1714,6 +1719,10 @@ function PdfRequestFiles(
|
|||||||
}
|
}
|
||||||
return email;
|
return email;
|
||||||
};
|
};
|
||||||
|
const handleDownload = async () => {
|
||||||
|
setIsCompleted((prev) => ({ ...prev, isModal: false }));
|
||||||
|
setIsDownloadModal(true);
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isLoading.isLoad ? (
|
{isLoading.isLoad ? (
|
||||||
@@ -1925,34 +1934,28 @@ function PdfRequestFiles(
|
|||||||
{t("print")}
|
{t("print")}
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
handleDownloadCertificate(
|
handleDownloadCertificate(
|
||||||
pdfDetails,
|
pdfDetails,
|
||||||
setIsDownloading
|
setIsDownloading
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
className="font-[500] text-[13px] mr-[5px] op-btn op-btn-secondary"
|
className="font-[500] text-[13px] mr-[5px] op-btn op-btn-secondary"
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
className="fa-light fa-award mx-[3px] lg:mx-0"
|
className="fa-light fa-award mx-[3px] lg:mx-0"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
></i>
|
></i>
|
||||||
<span className="hidden lg:block">
|
<span className="hidden lg:block">
|
||||||
{t("certificate")}
|
{t("certificate")}
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
<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={handleDownload}
|
||||||
setIsCompleted((prev) => ({
|
|
||||||
...prev,
|
|
||||||
isModal: false
|
|
||||||
}));
|
|
||||||
setIsDownloadModal(true);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
className="fa-light fa-download"
|
className="fa-light fa-download"
|
||||||
|
|||||||
@@ -553,7 +553,8 @@ function PlaceHolderSign() {
|
|||||||
options: addWidgetOptions(
|
options: addWidgetOptions(
|
||||||
dragTypeValue,
|
dragTypeValue,
|
||||||
owner,
|
owner,
|
||||||
filterSignerPos?.placeHolder
|
filterSignerPos?.placeHolder,
|
||||||
|
roleName
|
||||||
),
|
),
|
||||||
Width: widgetWidth / (containerScale * scale),
|
Width: widgetWidth / (containerScale * scale),
|
||||||
Height: widgetHeight / (containerScale * scale)
|
Height: widgetHeight / (containerScale * scale)
|
||||||
@@ -588,7 +589,8 @@ function PlaceHolderSign() {
|
|||||||
options: addWidgetOptions(
|
options: addWidgetOptions(
|
||||||
dragTypeValue,
|
dragTypeValue,
|
||||||
owner,
|
owner,
|
||||||
filterSignerPos?.placeHolder
|
filterSignerPos?.placeHolder,
|
||||||
|
roleName
|
||||||
),
|
),
|
||||||
Width: widgetWidth / (containerScale * scale),
|
Width: widgetWidth / (containerScale * scale),
|
||||||
Height: widgetHeight / (containerScale * scale)
|
Height: widgetHeight / (containerScale * scale)
|
||||||
@@ -2045,12 +2047,12 @@ function PlaceHolderSign() {
|
|||||||
setSignBtnPosition={setSignBtnPosition}
|
setSignBtnPosition={setSignBtnPosition}
|
||||||
pageNumber={pageNumber}
|
pageNumber={pageNumber}
|
||||||
pdfBase64Url={pdfBase64Url}
|
pdfBase64Url={pdfBase64Url}
|
||||||
signedUrl={pdfDetails?.[0]?.SignedUrl || ""}
|
|
||||||
setPdfArrayBuffer={setPdfArrayBuffer}
|
setPdfArrayBuffer={setPdfArrayBuffer}
|
||||||
setPdfBase64Url={setPdfBase64Url}
|
setPdfBase64Url={setPdfBase64Url}
|
||||||
setIsUploadPdf={setIsUploadPdf}
|
setIsUploadPdf={setIsUploadPdf}
|
||||||
pdfArrayBuffer={pdfArrayBuffer}
|
pdfArrayBuffer={pdfArrayBuffer}
|
||||||
isMergePdfBtn={true}
|
isMergePdfBtn={true}
|
||||||
|
pdfDetails={pdfDetails}
|
||||||
/>
|
/>
|
||||||
{/* pdf render view */}
|
{/* pdf render view */}
|
||||||
<div className="w-full md:w-[57%] flex mr-4">
|
<div className="w-full md:w-[57%] flex mr-4">
|
||||||
@@ -2070,6 +2072,7 @@ function PlaceHolderSign() {
|
|||||||
setAllPages={setAllPages}
|
setAllPages={setAllPages}
|
||||||
setPageNumber={setPageNumber}
|
setPageNumber={setPageNumber}
|
||||||
setIsTour={setPlaceholderTour}
|
setIsTour={setPlaceholderTour}
|
||||||
|
pdfDetails={pdfDetails}
|
||||||
/>
|
/>
|
||||||
<div className=" w-full md:w-[95%] ">
|
<div className=" w-full md:w-[95%] ">
|
||||||
{/* this modal is used show alert set placeholder for all signers before send mail */}
|
{/* this modal is used show alert set placeholder for all signers before send mail */}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ const Preferences = () => {
|
|||||||
completionMail: false
|
completionMail: false
|
||||||
});
|
});
|
||||||
const [fileNameFormat, setFileNameFormat] = useState("DOCNAME");
|
const [fileNameFormat, setFileNameFormat] = useState("DOCNAME");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchSignType();
|
fetchSignType();
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
@@ -194,7 +195,7 @@ const Preferences = () => {
|
|||||||
DateFormat: dateFormat,
|
DateFormat: dateFormat,
|
||||||
Is12HourTime: is12HourTime,
|
Is12HourTime: is12HourTime,
|
||||||
IsLTVEnabled: isLTVEnabled,
|
IsLTVEnabled: isLTVEnabled,
|
||||||
DownloadFilenameFormat: fileNameFormat
|
DownloadFilenameFormat: fileNameFormat,
|
||||||
};
|
};
|
||||||
const updateRes = await Parse.Cloud.run("updatepreferences", params);
|
const updateRes = await Parse.Cloud.run("updatepreferences", params);
|
||||||
if (updateRes) {
|
if (updateRes) {
|
||||||
@@ -804,7 +805,7 @@ const Preferences = () => {
|
|||||||
onClick={() => handleModifyMail("request")}
|
onClick={() => handleModifyMail("request")}
|
||||||
className="op-btn op-btn-primary shadow-lg"
|
className="op-btn op-btn-primary shadow-lg"
|
||||||
>
|
>
|
||||||
Modify
|
{t("modify")}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@@ -880,7 +881,7 @@ const Preferences = () => {
|
|||||||
onClick={() => handleModifyMail("completion")}
|
onClick={() => handleModifyMail("completion")}
|
||||||
className="op-btn op-btn-primary shadow-lg"
|
className="op-btn op-btn-primary shadow-lg"
|
||||||
>
|
>
|
||||||
Modify
|
{t("modify")}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -32,7 +32,11 @@ const Report = () => {
|
|||||||
const [defaultColumns, setDefaultColumns] = useState([]);
|
const [defaultColumns, setDefaultColumns] = useState([]);
|
||||||
const [isColumnModal, setIsColumnModal] = useState(false);
|
const [isColumnModal, setIsColumnModal] = useState(false);
|
||||||
const debounceTimer = useRef(null);
|
const debounceTimer = useRef(null);
|
||||||
const docPerPage = 20;
|
// Number of documents to display per page (should always be half of docLimit for proper pagination)
|
||||||
|
const docPerPage = 10;
|
||||||
|
// Number of documents to fetch per API call
|
||||||
|
const docLimit = 20;
|
||||||
|
|
||||||
|
|
||||||
// below useEffect is call when id param change
|
// below useEffect is call when id param change
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -48,7 +52,7 @@ const Report = () => {
|
|||||||
setVisibleColumns([]);
|
setVisibleColumns([]);
|
||||||
setColumnLabels({});
|
setColumnLabels({});
|
||||||
}
|
}
|
||||||
getReportData(0, docPerPage, "");
|
getReportData(0, docLimit, "");
|
||||||
|
|
||||||
// Function returned from useEffect is called on unmount
|
// Function returned from useEffect is called on unmount
|
||||||
return () => {
|
return () => {
|
||||||
@@ -64,7 +68,7 @@ const Report = () => {
|
|||||||
// below useEffect call when isNextRecord state is true and fetch next record
|
// below useEffect call when isNextRecord state is true and fetch next record
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isNextRecord) {
|
if (isNextRecord) {
|
||||||
getReportData(list.length, 20, searchTerm);
|
getReportData(list?.length, docLimit, searchTerm);
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
}, [isNextRecord]);
|
}, [isNextRecord]);
|
||||||
|
|||||||
@@ -63,8 +63,9 @@ import {
|
|||||||
setMyInitial,
|
setMyInitial,
|
||||||
setDefaultSignImg,
|
setDefaultSignImg,
|
||||||
setIsShowModal,
|
setIsShowModal,
|
||||||
resetWidgetState
|
resetWidgetState,
|
||||||
} from "../redux/reducers/widgetSlice.js";
|
setTypedSignFont
|
||||||
|
} from "../redux/reducers/widgetSlice";
|
||||||
import WidgetsValueModal from "../components/pdf/WidgetsValueModal";
|
import WidgetsValueModal from "../components/pdf/WidgetsValueModal";
|
||||||
import WidgetNameModal from "../components/pdf/WidgetNameModal";
|
import WidgetNameModal from "../components/pdf/WidgetNameModal";
|
||||||
import CellsSettingModal from "../components/pdf/CellsSettingModal";
|
import CellsSettingModal from "../components/pdf/CellsSettingModal";
|
||||||
@@ -745,6 +746,7 @@ function SignYourSelf() {
|
|||||||
if (resSignPdf) {
|
if (resSignPdf) {
|
||||||
const signedpdf = JSON.parse(JSON.stringify(resSignPdf));
|
const signedpdf = JSON.parse(JSON.stringify(resSignPdf));
|
||||||
setPdfUrl(signedpdf);
|
setPdfUrl(signedpdf);
|
||||||
|
dispatch(setTypedSignFont("Fasthand"));
|
||||||
getDocumentDetails(false);
|
getDocumentDetails(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1248,12 +1250,12 @@ function SignYourSelf() {
|
|||||||
pageNumber={pageNumber}
|
pageNumber={pageNumber}
|
||||||
containerWH={containerWH}
|
containerWH={containerWH}
|
||||||
pdfBase64Url={pdfBase64Url}
|
pdfBase64Url={pdfBase64Url}
|
||||||
signedUrl={pdfDetails?.[0]?.SignedUrl || ""}
|
|
||||||
setPdfArrayBuffer={setPdfArrayBuffer}
|
setPdfArrayBuffer={setPdfArrayBuffer}
|
||||||
setPdfBase64Url={setPdfBase64Url}
|
setPdfBase64Url={setPdfBase64Url}
|
||||||
setIsUploadPdf={setIsUploadPdf}
|
setIsUploadPdf={setIsUploadPdf}
|
||||||
pdfArrayBuffer={pdfArrayBuffer}
|
pdfArrayBuffer={pdfArrayBuffer}
|
||||||
isMergePdfBtn={!pdfDetails?.[0]?.IsCompleted}
|
isMergePdfBtn={!pdfDetails?.[0]?.IsCompleted}
|
||||||
|
pdfDetails={pdfDetails}
|
||||||
/>
|
/>
|
||||||
<div className="w-full md:w-[57%] flex mr-4">
|
<div className="w-full md:w-[57%] flex mr-4">
|
||||||
<PdfTools
|
<PdfTools
|
||||||
@@ -1271,6 +1273,7 @@ function SignYourSelf() {
|
|||||||
setAllPages={setAllPages}
|
setAllPages={setAllPages}
|
||||||
setPageNumber={setPageNumber}
|
setPageNumber={setPageNumber}
|
||||||
isDisableEditTools={isCompleted}
|
isDisableEditTools={isCompleted}
|
||||||
|
pdfDetails={pdfDetails}
|
||||||
/>
|
/>
|
||||||
<div className="w-full md:w-[95%]">
|
<div className="w-full md:w-[95%]">
|
||||||
<ModalUi
|
<ModalUi
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ const TemplatePlaceholder = () => {
|
|||||||
const [currUserId, setCurrUserId] = useState(false);
|
const [currUserId, setCurrUserId] = useState(false);
|
||||||
const [documentDetails, setDocumentDetails] = useState();
|
const [documentDetails, setDocumentDetails] = useState();
|
||||||
const [copied, setCopied] = useState(false);
|
const [copied, setCopied] = useState(false);
|
||||||
|
const [isUseTemplate, setIsUseTemplate] = useState(false);
|
||||||
const currentUser = localStorage.getItem(
|
const currentUser = localStorage.getItem(
|
||||||
`Parse/${localStorage.getItem("parseAppId")}/currentUser`
|
`Parse/${localStorage.getItem("parseAppId")}/currentUser`
|
||||||
);
|
);
|
||||||
@@ -347,8 +348,8 @@ const TemplatePlaceholder = () => {
|
|||||||
setPrefillSigner([utils?.prefillObj()]);
|
setPrefillSigner([utils?.prefillObj()]);
|
||||||
}
|
}
|
||||||
setSignersData(updatedSigners);
|
setSignersData(updatedSigners);
|
||||||
setUniqueId(updatedSigners[0].Id);
|
setUniqueId(updatedSigners[0]?.Id);
|
||||||
setBlockColor(updatedSigners[0].blockColor);
|
setBlockColor(updatedSigners[0]?.blockColor);
|
||||||
setIsSelectId(0);
|
setIsSelectId(0);
|
||||||
} else {
|
} else {
|
||||||
const updatedSigners = documentData[0].Signers.map((x, index) => ({
|
const updatedSigners = documentData[0].Signers.map((x, index) => ({
|
||||||
@@ -357,8 +358,8 @@ const TemplatePlaceholder = () => {
|
|||||||
Role: "Role " + (index + 1)
|
Role: "Role " + (index + 1)
|
||||||
}));
|
}));
|
||||||
setSignersData(updatedSigners);
|
setSignersData(updatedSigners);
|
||||||
setUniqueId(updatedSigners[0].Id);
|
setUniqueId(updatedSigners[0]?.Id);
|
||||||
setBlockColor(updatedSigners[0].blockColor);
|
setBlockColor(updatedSigners[0]?.blockColor);
|
||||||
setPrefillSigner([utils?.prefillObj()]);
|
setPrefillSigner([utils?.prefillObj()]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -436,7 +437,6 @@ const TemplatePlaceholder = () => {
|
|||||||
const addPositionOfSignature = (item, monitor) => {
|
const addPositionOfSignature = (item, monitor) => {
|
||||||
getSignerPos(item, monitor);
|
getSignerPos(item, monitor);
|
||||||
};
|
};
|
||||||
|
|
||||||
// `getSignerPos` is used to get placeholder position when user place it and save it in array
|
// `getSignerPos` is used to get placeholder position when user place it and save it in array
|
||||||
const getSignerPos = (item, monitor) => {
|
const getSignerPos = (item, monitor) => {
|
||||||
if (uniqueId) {
|
if (uniqueId) {
|
||||||
@@ -482,7 +482,8 @@ const TemplatePlaceholder = () => {
|
|||||||
options: addWidgetOptions(
|
options: addWidgetOptions(
|
||||||
dragTypeValue,
|
dragTypeValue,
|
||||||
owner,
|
owner,
|
||||||
filterSignerPos?.placeHolder
|
filterSignerPos?.placeHolder,
|
||||||
|
roleName
|
||||||
),
|
),
|
||||||
Width: widgetWidth / (containerScale * scale),
|
Width: widgetWidth / (containerScale * scale),
|
||||||
Height: widgetHeight / (containerScale * scale)
|
Height: widgetHeight / (containerScale * scale)
|
||||||
@@ -516,7 +517,8 @@ const TemplatePlaceholder = () => {
|
|||||||
options: addWidgetOptions(
|
options: addWidgetOptions(
|
||||||
dragTypeValue,
|
dragTypeValue,
|
||||||
owner,
|
owner,
|
||||||
filterSignerPos?.placeHolder
|
filterSignerPos?.placeHolder,
|
||||||
|
roleName
|
||||||
),
|
),
|
||||||
Width: widgetWidth / (containerScale * scale),
|
Width: widgetWidth / (containerScale * scale),
|
||||||
Height: widgetHeight / (containerScale * scale)
|
Height: widgetHeight / (containerScale * scale)
|
||||||
@@ -613,7 +615,6 @@ const TemplatePlaceholder = () => {
|
|||||||
setIsAddRole(true);
|
setIsAddRole(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const tourAddRole = [
|
const tourAddRole = [
|
||||||
{
|
{
|
||||||
selector: '[data-tut="reactourAddbtn"]',
|
selector: '[data-tut="reactourAddbtn"]',
|
||||||
@@ -931,6 +932,7 @@ const TemplatePlaceholder = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleCreateDocument = async () => {
|
const handleCreateDocument = async () => {
|
||||||
|
setIsUseTemplate(true);
|
||||||
try {
|
try {
|
||||||
setIsUiLoading(true);
|
setIsUiLoading(true);
|
||||||
const res = await utils?.handleCheckPrefillCreateDoc(
|
const res = await utils?.handleCheckPrefillCreateDoc(
|
||||||
@@ -974,6 +976,7 @@ const TemplatePlaceholder = () => {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("error in create document function", e);
|
console.log("error in create document function", e);
|
||||||
}
|
}
|
||||||
|
setIsUseTemplate(false);
|
||||||
};
|
};
|
||||||
const navigatePageToDoc = async () => {
|
const navigatePageToDoc = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -1771,12 +1774,12 @@ const TemplatePlaceholder = () => {
|
|||||||
setSignBtnPosition={setSignBtnPosition}
|
setSignBtnPosition={setSignBtnPosition}
|
||||||
pageNumber={pageNumber}
|
pageNumber={pageNumber}
|
||||||
pdfBase64Url={pdfBase64Url}
|
pdfBase64Url={pdfBase64Url}
|
||||||
signedUrl={pdfDetails?.[0]?.SignedUrl || ""}
|
|
||||||
setPdfArrayBuffer={setPdfArrayBuffer}
|
setPdfArrayBuffer={setPdfArrayBuffer}
|
||||||
setPdfBase64Url={setPdfBase64Url}
|
setPdfBase64Url={setPdfBase64Url}
|
||||||
setIsUploadPdf={setIsUploadPdf}
|
setIsUploadPdf={setIsUploadPdf}
|
||||||
pdfArrayBuffer={pdfArrayBuffer}
|
pdfArrayBuffer={pdfArrayBuffer}
|
||||||
isMergePdfBtn={true}
|
isMergePdfBtn={true}
|
||||||
|
pdfDetails={pdfDetails}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* pdf render view */}
|
{/* pdf render view */}
|
||||||
@@ -1796,6 +1799,7 @@ const TemplatePlaceholder = () => {
|
|||||||
allPages={allPages}
|
allPages={allPages}
|
||||||
setAllPages={setAllPages}
|
setAllPages={setAllPages}
|
||||||
setPageNumber={setPageNumber}
|
setPageNumber={setPageNumber}
|
||||||
|
pdfDetails={pdfDetails}
|
||||||
/>
|
/>
|
||||||
<div className="w-full md:w-[95%]">
|
<div className="w-full md:w-[95%]">
|
||||||
<ModalUi
|
<ModalUi
|
||||||
@@ -2138,6 +2142,7 @@ const TemplatePlaceholder = () => {
|
|||||||
isNewContact={isNewContact}
|
isNewContact={isNewContact}
|
||||||
documentFlow={"template"}
|
documentFlow={"template"}
|
||||||
docId={pdfDetails[0]?.objectId}
|
docId={pdfDetails[0]?.objectId}
|
||||||
|
isSubmit={isUseTemplate}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{isShowModal[currWidgetsDetails?.key] && (
|
{isShowModal[currWidgetsDetails?.key] && (
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
} from "react-i18next";
|
} from "react-i18next";
|
||||||
import DeleteUserModal from "../primitives/DeleteUserModal";
|
import DeleteUserModal from "../primitives/DeleteUserModal";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import PasswordResetModal from "../primitives/PasswordResetModal";
|
||||||
|
|
||||||
const actions = [
|
const actions = [
|
||||||
{
|
{
|
||||||
@@ -23,6 +24,14 @@ const actions = [
|
|||||||
action: "delete",
|
action: "delete",
|
||||||
restrictAdmin: true
|
restrictAdmin: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
btnId: "1910",
|
||||||
|
hoverLabel: "Reset password",
|
||||||
|
btnIcon: "fa-light fa-key",
|
||||||
|
redirectUrl: "",
|
||||||
|
action: "resetpassword",
|
||||||
|
restrictAdmin: true
|
||||||
|
},
|
||||||
];
|
];
|
||||||
const heading = ["Sr.No", "Name", "Email", "Phone", "Role", "Team", "Active"];
|
const heading = ["Sr.No", "Name", "Email", "Phone", "Role", "Team", "Active"];
|
||||||
const UserList = () => {
|
const UserList = () => {
|
||||||
@@ -208,9 +217,9 @@ const UserList = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// `showAlert` handle show/hide alert
|
// `showAlert` handle show/hide alert
|
||||||
const showAlert = (type, msg) => {
|
const showAlert = (type, msg, timer = 1500) => {
|
||||||
setIsAlert({ type, msg });
|
setIsAlert({ type, msg });
|
||||||
setTimeout(() => setIsAlert({ type: "success", msg: "" }), 1500);
|
setTimeout(() => setIsAlert({ type: "success", msg: "" }), timer);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDeleteAccount = async (item) => {
|
const handleDeleteAccount = async (item) => {
|
||||||
@@ -247,13 +256,15 @@ const UserList = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleActionBtn = async (act, item) => {
|
const handleActionBtn = async (act, item) => {
|
||||||
if (act.action === "delete") {
|
setIsActModal({ [`${act.action}_${item.objectId}`]: true });
|
||||||
setIsActModal({ [`delete_${item.objectId}`]: true });
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
const handleBtnVisibility = (act, item) => {
|
const handleBtnVisibility = (act, item) => {
|
||||||
if (act.restrictAdmin) {
|
if (act.restrictAdmin) {
|
||||||
return item?.objectId !== extClass?.[0]?.objectId;
|
if (item?.UserRole === "contracts_Admin") {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return item?.objectId !== extClass?.[0]?.objectId;
|
||||||
|
}
|
||||||
} else if (
|
} else if (
|
||||||
act.restrictBtn === true &&
|
act.restrictBtn === true &&
|
||||||
item?.objectId === extClass?.[0]?.objectId
|
item?.objectId === extClass?.[0]?.objectId
|
||||||
@@ -263,6 +274,28 @@ const UserList = () => {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const handleActiveToggleVisibility = (item) => {
|
||||||
|
if (item?.UserRole === "contracts_Admin") {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return item?.objectId !== extClass?.[0]?.objectId;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
async function submitPassword(userId, password) {
|
||||||
|
setIsLoader(true);
|
||||||
|
setIsActModal({});
|
||||||
|
try {
|
||||||
|
const params = { userId, password };
|
||||||
|
await Parse.Cloud.run("resetpassword", params);
|
||||||
|
showAlert("success", t("password-has-been-reset"));
|
||||||
|
} catch (err) {
|
||||||
|
console.log("err while reset password", err);
|
||||||
|
showAlert("danger", t(err.message), 2000);
|
||||||
|
} finally {
|
||||||
|
setIsLoader(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
{isLoader && (
|
{isLoader && (
|
||||||
@@ -340,7 +373,7 @@ const UserList = () => {
|
|||||||
<td className="px-4 py-2">
|
<td className="px-4 py-2">
|
||||||
{formatRow(item.TeamIds)}
|
{formatRow(item.TeamIds)}
|
||||||
</td>
|
</td>
|
||||||
{item.UserRole !== "contracts_Admin" ? (
|
{handleActiveToggleVisibility(item) ? (
|
||||||
<td className="px-4 py-2 font-semibold">
|
<td className="px-4 py-2 font-semibold">
|
||||||
<label className="cursor-pointer relative block items-center mb-0">
|
<label className="cursor-pointer relative block items-center mb-0">
|
||||||
<input
|
<input
|
||||||
@@ -436,6 +469,17 @@ const UserList = () => {
|
|||||||
deleteRes={deleteUserRes}
|
deleteRes={deleteUserRes}
|
||||||
handleClose={handleCloseModal}
|
handleClose={handleCloseModal}
|
||||||
/>
|
/>
|
||||||
|
<PasswordResetModal
|
||||||
|
isOpen={
|
||||||
|
isActModal[
|
||||||
|
"resetpassword_" + item.objectId
|
||||||
|
]
|
||||||
|
}
|
||||||
|
userId={item?.UserId?.objectId}
|
||||||
|
onClose={handleCloseModal}
|
||||||
|
onSubmit={submitPassword}
|
||||||
|
showAlert={showAlert}
|
||||||
|
/>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -487,7 +487,7 @@ function UserProfile() {
|
|||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{deleteUserRes ? (
|
{deleteUserRes ? (
|
||||||
<div className="h-[100px] p-[20px] flex justify-center items-center text-sm md:text-base">
|
<div className="h-[100px] p-[20px] flex justify-center items-center text-base-content text-sm md:text-base">
|
||||||
{deleteUserRes}
|
{deleteUserRes}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -174,6 +174,7 @@ const AddContact = (props) => {
|
|||||||
required
|
required
|
||||||
disabled={addYourself}
|
disabled={addYourself}
|
||||||
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"
|
||||||
|
placeholder={t("enter-name")}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-[0.75rem]">
|
<div className="mb-[0.75rem]">
|
||||||
@@ -193,6 +194,7 @@ const AddContact = (props) => {
|
|||||||
required
|
required
|
||||||
disabled={addYourself}
|
disabled={addYourself}
|
||||||
className="op-input op-input-bordered op-input-sm focus:outline-none hover:border-base-content w-full text-xs lowercase"
|
className="op-input op-input-bordered op-input-sm focus:outline-none hover:border-base-content w-full text-xs lowercase"
|
||||||
|
placeholder={t("enter-email")}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{isOptionalDetails && (
|
{isOptionalDetails && (
|
||||||
|
|||||||
@@ -96,8 +96,8 @@ function DownloadPdfZip(props) {
|
|||||||
handleClose={() => props.setIsDownloadModal(false)}
|
handleClose={() => props.setIsDownloadModal(false)}
|
||||||
>
|
>
|
||||||
<div className="p-[20px] h-full text-base-content">
|
<div className="p-[20px] h-full text-base-content">
|
||||||
{downloadType.map((data, ind) => {
|
{downloadType
|
||||||
return (
|
.map((data, ind) => (
|
||||||
<label
|
<label
|
||||||
key={ind}
|
key={ind}
|
||||||
className="flex items-center gap-1 mb-2 cursor-pointer"
|
className="flex items-center gap-1 mb-2 cursor-pointer"
|
||||||
@@ -111,8 +111,7 @@ function DownloadPdfZip(props) {
|
|||||||
/>
|
/>
|
||||||
{data.label}
|
{data.label}
|
||||||
</label>
|
</label>
|
||||||
);
|
))}
|
||||||
})}
|
|
||||||
<div className="h-[1px] w-full my-[15px] bg-[#9f9f9f]"></div>
|
<div className="h-[1px] w-full my-[15px] bg-[#9f9f9f]"></div>
|
||||||
<button
|
<button
|
||||||
onClick={() => handleDownload()}
|
onClick={() => handleDownload()}
|
||||||
|
|||||||
@@ -9,10 +9,12 @@ const ModalUi = ({
|
|||||||
showHeader = true,
|
showHeader = true,
|
||||||
showClose = true,
|
showClose = true,
|
||||||
reduceWidth,
|
reduceWidth,
|
||||||
position
|
position,
|
||||||
|
crossColor
|
||||||
}) => {
|
}) => {
|
||||||
const width = reduceWidth;
|
const width = reduceWidth;
|
||||||
const isBottom = position === "bottom" ? "items-end pb-2 !bg-black/10" : "";
|
const isBottom = position === "bottom" ? "items-end pb-2 !bg-black/10" : "";
|
||||||
|
const crossBtnColor = crossColor ?? "text-base-content";
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isOpen && (
|
{isOpen && (
|
||||||
@@ -38,7 +40,7 @@ const ModalUi = ({
|
|||||||
)}
|
)}
|
||||||
{showClose && (
|
{showClose && (
|
||||||
<button
|
<button
|
||||||
className="op-btn op-btn-sm op-btn-circle op-btn-ghost text-base-content absolute right-2 top-2"
|
className={`${crossBtnColor} op-btn op-btn-sm op-btn-circle op-btn-ghost absolute right-2 top-2 z-40`}
|
||||||
onClick={() => handleClose && handleClose()}
|
onClick={() => handleClose && handleClose()}
|
||||||
>
|
>
|
||||||
✕
|
✕
|
||||||
|
|||||||
@@ -0,0 +1,205 @@
|
|||||||
|
import { useMemo, useState } from "react";
|
||||||
|
import ModalUi from "./ModalUi";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PasswordResetModal
|
||||||
|
* - Validates password rules (length >= 8, upper, lower, digit, special)
|
||||||
|
* - Buttons: Submit, Autogenerate (12 chars), Copy (Font Awesome icon only)
|
||||||
|
* - `Autogenerate` fills a valid 12-char password but remains editable
|
||||||
|
* - `Copy` copies the current password to clipboard
|
||||||
|
*
|
||||||
|
* Props:
|
||||||
|
* - isOpen: boolean
|
||||||
|
* - onClose: () => void
|
||||||
|
* - onSubmit: (password: string) => Promise<void> | void
|
||||||
|
*/
|
||||||
|
export default function PasswordResetModal({
|
||||||
|
userId,
|
||||||
|
isOpen,
|
||||||
|
onClose,
|
||||||
|
onSubmit,
|
||||||
|
showAlert
|
||||||
|
}) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [password, setPassword] = useState("");
|
||||||
|
const [submitting, setSubmitting] = useState(false);
|
||||||
|
const [copied, setCopied] = useState(false);
|
||||||
|
|
||||||
|
// Validation helpers
|
||||||
|
const rules = useMemo(
|
||||||
|
() => ({
|
||||||
|
hasUpper: /[A-Z]/,
|
||||||
|
hasLower: /[a-z]/,
|
||||||
|
hasDigit: /\d/,
|
||||||
|
// Richer special set including common keyboard symbols
|
||||||
|
hasSpecial: /[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?`~]/,
|
||||||
|
minLen: 8
|
||||||
|
}),
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
const checks = useMemo(() => {
|
||||||
|
return {
|
||||||
|
lenOK: password.length >= rules.minLen,
|
||||||
|
upperLowerDigitOK:
|
||||||
|
rules.hasUpper.test(password) &&
|
||||||
|
rules.hasLower.test(password) &&
|
||||||
|
rules.hasDigit.test(password),
|
||||||
|
specialOK: rules.hasSpecial.test(password)
|
||||||
|
};
|
||||||
|
}, [password, rules]);
|
||||||
|
|
||||||
|
// Always-present condition list with per-condition status
|
||||||
|
const conditions = useMemo(
|
||||||
|
() => [
|
||||||
|
{
|
||||||
|
key: "len",
|
||||||
|
ok: checks.lenOK,
|
||||||
|
text: "password-length"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "uld",
|
||||||
|
ok: checks.upperLowerDigitOK,
|
||||||
|
text: "password-case"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "spec",
|
||||||
|
ok: checks.specialOK,
|
||||||
|
text: "password-special-case"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[checks]
|
||||||
|
);
|
||||||
|
|
||||||
|
const allValid = conditions.every((c) => c.ok) && password.length > 0;
|
||||||
|
|
||||||
|
// Autogenerate a valid random password (12 chars)
|
||||||
|
const handleAutogen = () => {
|
||||||
|
const length = 12;
|
||||||
|
const upper = "ABCDEFGHJKLMNPQRSTUVWXYZ"; // omit ambiguous I/O
|
||||||
|
const lower = "abcdefghijkmnopqrstuvwxyz"; // omit ambiguous l
|
||||||
|
const digits = "23456789"; // omit 0/1
|
||||||
|
const special = "!@#$%^&*()-_=+[]{};:,.?";
|
||||||
|
const all = upper + lower + digits + special;
|
||||||
|
|
||||||
|
function pick(str) {
|
||||||
|
return str[Math.floor(Math.random() * str.length)];
|
||||||
|
}
|
||||||
|
function shuffle(arr) {
|
||||||
|
return arr.sort(() => Math.random() - 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
let pwd = [pick(upper), pick(lower), pick(digits), pick(special)];
|
||||||
|
while (pwd.length < length) pwd.push(pick(all));
|
||||||
|
pwd = shuffle(pwd).join("");
|
||||||
|
|
||||||
|
setPassword(pwd);
|
||||||
|
};
|
||||||
|
const handleCopy = async () => {
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(password);
|
||||||
|
showAlert("success", t("copied"), 1200);
|
||||||
|
setCopied(true);
|
||||||
|
setTimeout(() => setCopied(false, 1200));
|
||||||
|
} catch (e) {
|
||||||
|
console.error("Clipboard error", e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSubmit = async (e) => {
|
||||||
|
e?.preventDefault?.();
|
||||||
|
if (!allValid) return; // guard
|
||||||
|
try {
|
||||||
|
setSubmitting(true);
|
||||||
|
await onSubmit?.(userId, password);
|
||||||
|
setSubmitting(false);
|
||||||
|
onClose?.();
|
||||||
|
setPassword("");
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
setSubmitting(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<ModalUi
|
||||||
|
isOpen={isOpen}
|
||||||
|
title={t("reset-password")}
|
||||||
|
handleClose={() => {
|
||||||
|
setPassword("");
|
||||||
|
onClose?.();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<form onSubmit={handleSubmit} className="space-y-3 pt-[15px] p-[20px]">
|
||||||
|
<p className="text-sm text-base-content/60">
|
||||||
|
{t("enter-strong-password")}
|
||||||
|
</p>
|
||||||
|
<label className="op-form-control w-full">
|
||||||
|
<div className="op-label">
|
||||||
|
<span className="op-label-text">{t("new-password")}</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex gap-2">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="op-input op-input-bordered op-input-sm focus:outline-none hover:border-base-content w-full text-xs"
|
||||||
|
placeholder="Enter password or click Autogenerate"
|
||||||
|
value={password}
|
||||||
|
onChange={(e) => setPassword(e.target.value)}
|
||||||
|
autoFocus
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="op-btn op-btn-square op-btn-sm"
|
||||||
|
onClick={handleCopy}
|
||||||
|
title={copied ? "Copied" : "Copy"}
|
||||||
|
aria-label="Copy password"
|
||||||
|
disabled={!password}
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
className={`fa-regular fa-copy ${copied ? "opacity-70" : ""}`}
|
||||||
|
></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
{/* When everything is valid, show just a right tick */}
|
||||||
|
<ul className="mt-1 ml-2">
|
||||||
|
{conditions.map((c) => (
|
||||||
|
<li
|
||||||
|
key={c.key}
|
||||||
|
className={`${c.ok ? "text-success" : "text-error"} text-[12px] leading-snug`}
|
||||||
|
>
|
||||||
|
{c.ok ? "✓" : "✗"} {t(c.text)}
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div className="pt-2 flex flex-row gap-x-2">
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
className="op-btn op-btn-primary"
|
||||||
|
disabled={!allValid || submitting}
|
||||||
|
>
|
||||||
|
{t("submit")}
|
||||||
|
</button>
|
||||||
|
<button type="button" className="op-btn" onClick={handleAutogen}>
|
||||||
|
{t("autogenerate")}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="op-btn op-btn-ghost"
|
||||||
|
onClick={() => {
|
||||||
|
setPassword("");
|
||||||
|
onClose?.();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t("cancel")}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</ModalUi>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -63,7 +63,7 @@ function CustomModal(props) {
|
|||||||
className="op-btn op-btn-secondary ml-[10px] mb-3 mt-1"
|
className="op-btn op-btn-secondary ml-[10px] mb-3 mt-1"
|
||||||
onClick={() => props.handleDownloadBtn()}
|
onClick={() => props.handleDownloadBtn()}
|
||||||
>
|
>
|
||||||
Download
|
{t("download")}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -138,6 +138,12 @@ export const RenderReportCell = ({
|
|||||||
{rowData?.ExpiryDate ? formatDate(rowData?.ExpiryDate?.iso) : "-"}
|
{rowData?.ExpiryDate ? formatDate(rowData?.ExpiryDate?.iso) : "-"}
|
||||||
</td>
|
</td>
|
||||||
);
|
);
|
||||||
|
case "Sent Date":
|
||||||
|
return (
|
||||||
|
<td key={col} className="p-2 text-center">
|
||||||
|
{rowData?.DocSentAt ? formatDate(rowData?.DocSentAt?.iso) : "-"}
|
||||||
|
</td>
|
||||||
|
);
|
||||||
case "Signers":
|
case "Signers":
|
||||||
return (
|
return (
|
||||||
<SignerCell
|
<SignerCell
|
||||||
|
|||||||
+13
-10
@@ -1,26 +1,29 @@
|
|||||||
import React from "react";
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import ModalUi from "./ModalUi";
|
import { useLocation, useNavigate } from "react-router";
|
||||||
import { useNavigate } from "react-router";
|
import { useDispatch } from "react-redux";
|
||||||
|
import { sessionStatus } from "../redux/reducers/userReducer";
|
||||||
import Parse from "parse";
|
import Parse from "parse";
|
||||||
|
import ModalUi from "./ModalUi";
|
||||||
|
|
||||||
const ValidateSession = ({ children }) => {
|
const SessionExpiredModal = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const location = useLocation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
const handleLoginBtn = async () => {
|
const handleLoginBtn = async () => {
|
||||||
try {
|
try {
|
||||||
await Parse?.User?.logOut();
|
await Parse?.User?.logOut();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("err ", err);
|
console.log(`err: ${err}`);
|
||||||
} finally {
|
} finally {
|
||||||
localStorage.removeItem("accesstoken");
|
localStorage.removeItem("accesstoken");
|
||||||
navigate("/", { replace: true });
|
dispatch(sessionStatus(true));
|
||||||
|
navigate("/", { replace: true, state: { from: location } });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return localStorage.getItem("accesstoken") ? (
|
|
||||||
children
|
return (
|
||||||
) : (
|
|
||||||
<ModalUi showHeader={false} isOpen={true} showClose={false}>
|
<ModalUi showHeader={false} isOpen={true} showClose={false}>
|
||||||
<div className="flex flex-col justify-center items-center py-4 md:py-5 gap-5">
|
<div className="flex flex-col justify-center items-center py-4 md:py-5 gap-5">
|
||||||
<p className="text-xl font-medium">{t("session-expired")}</p>
|
<p className="text-xl font-medium">{t("session-expired")}</p>
|
||||||
@@ -32,4 +35,4 @@ const ValidateSession = ({ children }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ValidateSession;
|
export default SessionExpiredModal;
|
||||||
@@ -1,12 +1,9 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import Parse from "parse";
|
import Parse from "parse";
|
||||||
import { Outlet, useNavigate, useLocation } from "react-router";
|
import { Outlet } from "react-router";
|
||||||
import ModalUi from "./ModalUi";
|
import SessionExpiredModal from "./SessionExpiredModal";
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
const Validate = () => {
|
const Validate = () => {
|
||||||
const navigate = useNavigate();
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const location = useLocation();
|
|
||||||
const [isUserValid, setIsUserValid] = useState(true);
|
const [isUserValid, setIsUserValid] = useState(true);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
@@ -37,30 +34,7 @@ const Validate = () => {
|
|||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleLoginBtn = async () => {
|
return isUserValid ? <Outlet /> : <SessionExpiredModal />;
|
||||||
try {
|
|
||||||
await Parse.User.logOut();
|
|
||||||
} catch (err) {
|
|
||||||
console.log("err ", err);
|
|
||||||
} finally {
|
|
||||||
localStorage.removeItem("accesstoken");
|
|
||||||
navigate("/", { replace: true, state: { from: location } });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return isUserValid ? (
|
|
||||||
<div>
|
|
||||||
<Outlet />
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<ModalUi showHeader={false} isOpen={true} showClose={false}>
|
|
||||||
<div className="flex flex-col justify-center items-center py-4 md:py-5 gap-5">
|
|
||||||
<p className="text-xl font-medium">{t("session-expired")}</p>
|
|
||||||
<button onClick={handleLoginBtn} className="op-btn op-btn-neutral">
|
|
||||||
{t("login")}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</ModalUi>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Validate;
|
export default Validate;
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import { createSlice } from "@reduxjs/toolkit";
|
||||||
|
const initialState = { isValidSession: true };
|
||||||
|
const userReducer = createSlice({
|
||||||
|
name: "user",
|
||||||
|
initialState: initialState,
|
||||||
|
reducers: {
|
||||||
|
sessionStatus: (state, action) => {
|
||||||
|
state.isValidSession = action.payload;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export const { sessionStatus } = userReducer.actions;
|
||||||
|
|
||||||
|
export default userReducer.reducer;
|
||||||
@@ -13,7 +13,8 @@ const initialState = {
|
|||||||
lastIndex: "",
|
lastIndex: "",
|
||||||
scrollTriggerId: "",
|
scrollTriggerId: "",
|
||||||
prefillImg: [],
|
prefillImg: [],
|
||||||
prefillImgLoad: {}
|
prefillImgLoad: {},
|
||||||
|
typedSignFont: "Fasthand"
|
||||||
};
|
};
|
||||||
|
|
||||||
const widgetSlice = createSlice({
|
const widgetSlice = createSlice({
|
||||||
@@ -41,6 +42,9 @@ const widgetSlice = createSlice({
|
|||||||
setScrollTriggerId: (state, action) => {
|
setScrollTriggerId: (state, action) => {
|
||||||
state.scrollTriggerId = action.payload;
|
state.scrollTriggerId = action.payload;
|
||||||
},
|
},
|
||||||
|
setTypedSignFont: (state, action) => {
|
||||||
|
state.typedSignFont = action.payload;
|
||||||
|
},
|
||||||
setPrefillImg: (state, action) => {
|
setPrefillImg: (state, action) => {
|
||||||
const existingIndex = state.prefillImg.findIndex(
|
const existingIndex = state.prefillImg.findIndex(
|
||||||
(img) => img.id === action.payload.id
|
(img) => img.id === action.payload.id
|
||||||
@@ -73,7 +77,8 @@ export const {
|
|||||||
setLastIndex,
|
setLastIndex,
|
||||||
setScrollTriggerId,
|
setScrollTriggerId,
|
||||||
setPrefillImg,
|
setPrefillImg,
|
||||||
setPrefillImgLoad
|
setPrefillImgLoad,
|
||||||
|
setTypedSignFont
|
||||||
} = widgetSlice.actions;
|
} = widgetSlice.actions;
|
||||||
|
|
||||||
export default widgetSlice.reducer;
|
export default widgetSlice.reducer;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import ShowTenant from "./reducers/ShowTenant";
|
|||||||
import TourStepsReducer from "./reducers/TourStepsReducer";
|
import TourStepsReducer from "./reducers/TourStepsReducer";
|
||||||
import widgetReducer from "./reducers/widgetSlice";
|
import widgetReducer from "./reducers/widgetSlice";
|
||||||
import sidebarReducer from "./reducers/sidebarReducer";
|
import sidebarReducer from "./reducers/sidebarReducer";
|
||||||
|
import userReducer from "./reducers/userReducer";
|
||||||
|
|
||||||
export const store = configureStore({
|
export const store = configureStore({
|
||||||
reducer: {
|
reducer: {
|
||||||
@@ -11,6 +12,7 @@ export const store = configureStore({
|
|||||||
TourSteps: TourStepsReducer,
|
TourSteps: TourStepsReducer,
|
||||||
ShowTenant,
|
ShowTenant,
|
||||||
widget: widgetReducer,
|
widget: widgetReducer,
|
||||||
sidebar: sidebarReducer
|
sidebar: sidebarReducer,
|
||||||
|
user: userReducer
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ const EditContactForm = (props) => {
|
|||||||
onInput={(e) => e.target.setCustomValidity("")}
|
onInput={(e) => e.target.setCustomValidity("")}
|
||||||
onInvalid={(e) => e.target.setCustomValidity(t("input-required"))}
|
onInvalid={(e) => e.target.setCustomValidity(t("input-required"))}
|
||||||
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"
|
||||||
|
placeholder={t("enter-name")}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -105,6 +106,7 @@ const EditContactForm = (props) => {
|
|||||||
onInput={(e) => e.target.setCustomValidity("")}
|
onInput={(e) => e.target.setCustomValidity("")}
|
||||||
onInvalid={(e) => e.target.setCustomValidity(t("input-required"))}
|
onInvalid={(e) => e.target.setCustomValidity(t("input-required"))}
|
||||||
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"
|
||||||
|
placeholder={t("enter-email")}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ const DocumentsReport = (props) => {
|
|||||||
const [documentId, setDocumentId] = useState("");
|
const [documentId, setDocumentId] = useState("");
|
||||||
const [isNewContact, setIsNewContact] = useState({ status: false, id: "" });
|
const [isNewContact, setIsNewContact] = useState({ status: false, id: "" });
|
||||||
const [isPrefillModal, setIsPrefillModal] = useState({});
|
const [isPrefillModal, setIsPrefillModal] = useState({});
|
||||||
|
const [isSubmit, setIsSubmit] = useState(false);
|
||||||
const [error, setError] = useState("");
|
const [error, setError] = useState("");
|
||||||
const [isMailModal, setIsMailModal] = useState(false);
|
const [isMailModal, setIsMailModal] = useState(false);
|
||||||
const [customizeMail, setCustomizeMail] = useState({ body: "", subject: "" });
|
const [customizeMail, setCustomizeMail] = useState({ body: "", subject: "" });
|
||||||
@@ -105,6 +106,15 @@ const DocumentsReport = (props) => {
|
|||||||
}
|
}
|
||||||
}, [props.isSearchResult]);
|
}, [props.isSearchResult]);
|
||||||
|
|
||||||
|
// Close dropdown when clicking outside or on button again
|
||||||
|
useEffect(() => {
|
||||||
|
const onDocClick = (e) => {
|
||||||
|
if (!e.target.closest('[data-dropdown-root="1"]')) setIsOption({});
|
||||||
|
};
|
||||||
|
document.addEventListener("click", onDocClick);
|
||||||
|
return () => document.removeEventListener("click", onDocClick);
|
||||||
|
}, []);
|
||||||
|
|
||||||
const getPaginationRange = () => {
|
const getPaginationRange = () => {
|
||||||
const totalPageNumbers = 7; // Adjust this value to show more/less page numbers
|
const totalPageNumbers = 7; // Adjust this value to show more/less page numbers
|
||||||
const pages = [];
|
const pages = [];
|
||||||
@@ -329,6 +339,8 @@ const DocumentsReport = (props) => {
|
|||||||
setIsModal({ [`extendexpiry_${item.objectId}`]: true });
|
setIsModal({ [`extendexpiry_${item.objectId}`]: true });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Get current list
|
// Get current list
|
||||||
const indexOfLastDoc = currentPage * props.docPerPage;
|
const indexOfLastDoc = currentPage * props.docPerPage;
|
||||||
const indexOfFirstDoc = indexOfLastDoc - props.docPerPage;
|
const indexOfFirstDoc = indexOfLastDoc - props.docPerPage;
|
||||||
@@ -495,7 +507,9 @@ const DocumentsReport = (props) => {
|
|||||||
const docId = props?.ReportName !== "Templates" && item.objectId;
|
const docId = props?.ReportName !== "Templates" && item.objectId;
|
||||||
if (url) {
|
if (url) {
|
||||||
try {
|
try {
|
||||||
if (isCompleted) {
|
if (
|
||||||
|
isCompleted
|
||||||
|
) {
|
||||||
setIsDownloadModal({ [item.objectId]: true });
|
setIsDownloadModal({ [item.objectId]: true });
|
||||||
} else {
|
} else {
|
||||||
const signedUrl = await getSignedUrl(
|
const signedUrl = await getSignedUrl(
|
||||||
@@ -789,6 +803,7 @@ const DocumentsReport = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleCloseModal = () => {
|
const handleCloseModal = () => {
|
||||||
|
setError("");
|
||||||
setIsModal({});
|
setIsModal({});
|
||||||
};
|
};
|
||||||
const handleSaveAsTemplate = async (doc) => {
|
const handleSaveAsTemplate = async (doc) => {
|
||||||
@@ -920,6 +935,7 @@ const DocumentsReport = (props) => {
|
|||||||
};
|
};
|
||||||
//`handlePrefillWidgetCreateDoc` is used to embed prefill all widgets on document, create document, and send document
|
//`handlePrefillWidgetCreateDoc` is used to embed prefill all widgets on document, create document, and send document
|
||||||
const handlePrefillWidgetCreateDoc = async () => {
|
const handlePrefillWidgetCreateDoc = async () => {
|
||||||
|
setIsSubmit(true);
|
||||||
const scale = 1;
|
const scale = 1;
|
||||||
const key = Object.keys(isPrefillModal)[0];
|
const key = Object.keys(isPrefillModal)[0];
|
||||||
setActLoader({ [key]: true });
|
setActLoader({ [key]: true });
|
||||||
@@ -957,6 +973,7 @@ const DocumentsReport = (props) => {
|
|||||||
alert(t("user-not-exist"));
|
alert(t("user-not-exist"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setIsSubmit(false);
|
||||||
setActLoader({});
|
setActLoader({});
|
||||||
};
|
};
|
||||||
const handleRecipientSign = (documentId, currentId) => {
|
const handleRecipientSign = (documentId, currentId) => {
|
||||||
@@ -1027,10 +1044,10 @@ const DocumentsReport = (props) => {
|
|||||||
if (isPrefill) {
|
if (isPrefill) {
|
||||||
return (
|
return (
|
||||||
<span className="flex text-sm mt-3 text-red-500">
|
<span className="flex text-sm mt-3 text-red-500">
|
||||||
{t("save-as-temp-warn")}
|
{t("save-as-temp-warn")}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
@@ -1166,6 +1183,7 @@ const DocumentsReport = (props) => {
|
|||||||
<React.Fragment key={index}>
|
<React.Fragment key={index}>
|
||||||
{handleBtnVisibility(act, item) && (
|
{handleBtnVisibility(act, item) && (
|
||||||
<div
|
<div
|
||||||
|
data-dropdown-root="1"
|
||||||
role="button"
|
role="button"
|
||||||
data-tut={act?.selector}
|
data-tut={act?.selector}
|
||||||
onClick={() => handleActionBtn(act, item)}
|
onClick={() => handleActionBtn(act, item)}
|
||||||
@@ -1367,6 +1385,7 @@ const DocumentsReport = (props) => {
|
|||||||
setIsNewContact={setIsNewContact}
|
setIsNewContact={setIsNewContact}
|
||||||
isNewContact={isNewContact}
|
isNewContact={isNewContact}
|
||||||
docId={item.objectId}
|
docId={item.objectId}
|
||||||
|
isSubmit={isSubmit}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{isModal["extendexpiry_" + item.objectId] && (
|
{isModal["extendexpiry_" + item.objectId] && (
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import "../../styles/quill.css";
|
|||||||
import BulkSendUi from "../../components/BulkSendUi";
|
import BulkSendUi from "../../components/BulkSendUi";
|
||||||
import Loader from "../../primitives/Loader";
|
import Loader from "../../primitives/Loader";
|
||||||
import { serverUrl_fn } from "../../constant/appinfo";
|
import { serverUrl_fn } from "../../constant/appinfo";
|
||||||
import { useTranslation } from "react-i18next";
|
import { Trans, useTranslation } from "react-i18next";
|
||||||
import { useElSize } from "../../hook/useElSize";
|
import { useElSize } from "../../hook/useElSize";
|
||||||
import LottieWithLoader from "../../primitives/DotLottieReact";
|
import LottieWithLoader from "../../primitives/DotLottieReact";
|
||||||
import PrefillWidgetModal from "../../components/pdf/PrefillWidgetsModal";
|
import PrefillWidgetModal from "../../components/pdf/PrefillWidgetsModal";
|
||||||
@@ -67,7 +67,7 @@ const TemplatesReport = (props) => {
|
|||||||
const [userDetails, setUserDetails] = useState({});
|
const [userDetails, setUserDetails] = useState({});
|
||||||
const [isNextStep, setIsNextStep] = useState({});
|
const [isNextStep, setIsNextStep] = useState({});
|
||||||
const [isBulkSend, setIsBulkSend] = useState({});
|
const [isBulkSend, setIsBulkSend] = useState({});
|
||||||
const [templateDeatils, setTemplateDetails] = useState({});
|
const [templateDetails, setTemplateDetails] = useState({});
|
||||||
const [placeholders, setPlaceholders] = useState([]);
|
const [placeholders, setPlaceholders] = useState([]);
|
||||||
const [isLoader, setIsLoader] = useState({});
|
const [isLoader, setIsLoader] = useState({});
|
||||||
const [isShareWith, setIsShareWith] = useState({});
|
const [isShareWith, setIsShareWith] = useState({});
|
||||||
@@ -85,6 +85,7 @@ const TemplatesReport = (props) => {
|
|||||||
const [documentId, setDocumentId] = useState("");
|
const [documentId, setDocumentId] = useState("");
|
||||||
const [isNewContact, setIsNewContact] = useState({ status: false, id: "" });
|
const [isNewContact, setIsNewContact] = useState({ status: false, id: "" });
|
||||||
const [isPrefillModal, setIsPrefillModal] = useState({});
|
const [isPrefillModal, setIsPrefillModal] = useState({});
|
||||||
|
const [isSubmit, setIsSubmit] = useState(false);
|
||||||
const startIndex = (currentPage - 1) * props.docPerPage;
|
const startIndex = (currentPage - 1) * props.docPerPage;
|
||||||
const { isMoreDocs, setIsNextRecord } = props;
|
const { isMoreDocs, setIsNextRecord } = props;
|
||||||
const [isMailModal, setIsMailModal] = useState(false);
|
const [isMailModal, setIsMailModal] = useState(false);
|
||||||
@@ -164,6 +165,15 @@ const TemplatesReport = (props) => {
|
|||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
// Close dropdown when clicking outside or on button again
|
||||||
|
useEffect(() => {
|
||||||
|
const onDocClick = (e) => {
|
||||||
|
if (!e.target.closest('[data-dropdown-root="1"]')) setIsOption({});
|
||||||
|
};
|
||||||
|
document.addEventListener("click", onDocClick);
|
||||||
|
return () => document.removeEventListener("click", onDocClick);
|
||||||
|
}, []);
|
||||||
|
|
||||||
// `fetchTeamList` is used to fetch team list for share with functionality
|
// `fetchTeamList` is used to fetch team list for share with functionality
|
||||||
const fetchTeamList = async () => {
|
const fetchTeamList = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -238,9 +248,8 @@ const TemplatesReport = (props) => {
|
|||||||
);
|
);
|
||||||
if (checkIsSignatureExist) {
|
if (checkIsSignatureExist) {
|
||||||
setActLoader({ [`${item.objectId}_${act.btnId}`]: true });
|
setActLoader({ [`${item.objectId}_${act.btnId}`]: true });
|
||||||
const templateDeatils = await fetchTemplate(item.objectId);
|
const template = await fetchTemplate(item.objectId);
|
||||||
const templateData =
|
const templateData = template.data && template.data.result;
|
||||||
templateDeatils.data && templateDeatils.data.result;
|
|
||||||
if (!templateData.error) {
|
if (!templateData.error) {
|
||||||
setXyPosition(templateData?.Placeholders);
|
setXyPosition(templateData?.Placeholders);
|
||||||
const signer = utils.handleSignersList(templateData);
|
const signer = utils.handleSignersList(templateData);
|
||||||
@@ -283,7 +292,7 @@ const TemplatesReport = (props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if (axiosRes) {
|
if (axiosRes?.data) {
|
||||||
return axiosRes;
|
return axiosRes;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -296,10 +305,10 @@ const TemplatesReport = (props) => {
|
|||||||
const navigatePageToDoc = async (templateRes, placeholder, signer) => {
|
const navigatePageToDoc = async (templateRes, placeholder, signer) => {
|
||||||
setIsPrefillModal({});
|
setIsPrefillModal({});
|
||||||
const res = await createDocument(
|
const res = await createDocument(
|
||||||
[templateRes || templateDeatils],
|
[templateRes || templateDetails],
|
||||||
placeholder || xyPosition,
|
placeholder || xyPosition,
|
||||||
signer || signerList,
|
signer || signerList,
|
||||||
templateRes?.URL || templateDeatils?.URL
|
templateRes?.URL || templateDetails?.URL
|
||||||
);
|
);
|
||||||
if (res.status === "success") {
|
if (res.status === "success") {
|
||||||
navigate(`/placeHolderSign/${res.id}`, {
|
navigate(`/placeHolderSign/${res.id}`, {
|
||||||
@@ -871,14 +880,15 @@ const TemplatesReport = (props) => {
|
|||||||
};
|
};
|
||||||
//`handlePrefillWidgetCreateDoc` is used to embed prefill all widgets on document, create document, and send document
|
//`handlePrefillWidgetCreateDoc` is used to embed prefill all widgets on document, create document, and send document
|
||||||
const handlePrefillWidgetCreateDoc = async () => {
|
const handlePrefillWidgetCreateDoc = async () => {
|
||||||
|
setIsSubmit(true);
|
||||||
const scale = 1;
|
const scale = 1;
|
||||||
const res = await utils?.handleCheckPrefillCreateDoc(
|
const res = await utils?.handleCheckPrefillCreateDoc(
|
||||||
xyPosition,
|
xyPosition,
|
||||||
signerList,
|
signerList,
|
||||||
setIsPrefillModal,
|
setIsPrefillModal,
|
||||||
scale,
|
scale,
|
||||||
templateDeatils?.URL,
|
templateDetails?.URL,
|
||||||
[templateDeatils],
|
[templateDetails],
|
||||||
prefillImg,
|
prefillImg,
|
||||||
extClass?.[0]?.UserId?.objectId,
|
extClass?.[0]?.UserId?.objectId,
|
||||||
);
|
);
|
||||||
@@ -940,6 +950,7 @@ const TemplatesReport = (props) => {
|
|||||||
alert(t("user-not-exist"));
|
alert(t("user-not-exist"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setIsSubmit(false);
|
||||||
};
|
};
|
||||||
//function show signer list and share link to share signUrl
|
//function show signer list and share link to share signUrl
|
||||||
const handleShareList = () => {
|
const handleShareList = () => {
|
||||||
@@ -1150,6 +1161,7 @@ const TemplatesReport = (props) => {
|
|||||||
role="button"
|
role="button"
|
||||||
data-tut={act?.selector}
|
data-tut={act?.selector}
|
||||||
key={index}
|
key={index}
|
||||||
|
data-dropdown-root="1"
|
||||||
onClick={() => handleActionBtn(act, item)}
|
onClick={() => handleActionBtn(act, item)}
|
||||||
title={t(`btnLabel.${act.hoverLabel}`)}
|
title={t(`btnLabel.${act.hoverLabel}`)}
|
||||||
className={
|
className={
|
||||||
@@ -1257,6 +1269,7 @@ const TemplatesReport = (props) => {
|
|||||||
setIsNewContact={setIsNewContact}
|
setIsNewContact={setIsNewContact}
|
||||||
isNewContact={isNewContact}
|
isNewContact={isNewContact}
|
||||||
docId={item.objectId}
|
docId={item.objectId}
|
||||||
|
isSubmit={isSubmit}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{isShareWith[item.objectId] && (
|
{isShareWith[item.objectId] && (
|
||||||
@@ -1328,7 +1341,7 @@ const TemplatesReport = (props) => {
|
|||||||
) : (
|
) : (
|
||||||
<BulkSendUi
|
<BulkSendUi
|
||||||
Placeholders={placeholders}
|
Placeholders={placeholders}
|
||||||
item={templateDeatils}
|
item={templateDetails}
|
||||||
handleClose={handleQuickSendClose}
|
handleClose={handleQuickSendClose}
|
||||||
signatureType={signatureType}
|
signatureType={signatureType}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { format, toZonedTime } from 'date-fns-tz';
|
|||||||
import getPresignedUrl, { getSignedLocalUrl } from './cloud/parsefunction/getSignedUrl.js';
|
import getPresignedUrl, { getSignedLocalUrl } from './cloud/parsefunction/getSignedUrl.js';
|
||||||
import crypto from 'node:crypto';
|
import crypto from 'node:crypto';
|
||||||
import { PDFDocument, rgb } from 'pdf-lib';
|
import { PDFDocument, rgb } from 'pdf-lib';
|
||||||
|
import { parseUploadFile } from './utils/fileUtils.js';
|
||||||
|
|
||||||
dotenv.config({ quiet: true });
|
dotenv.config({ quiet: true });
|
||||||
|
|
||||||
|
|||||||
@@ -2,20 +2,24 @@ import express from 'express';
|
|||||||
import cors from 'cors';
|
import cors from 'cors';
|
||||||
import dotenv from 'dotenv';
|
import dotenv from 'dotenv';
|
||||||
import uploadFile from './uploadFile.js';
|
import uploadFile from './uploadFile.js';
|
||||||
|
|
||||||
import docxtopdf, { upload as docxUpload } from './docxtopdf.js';
|
import docxtopdf, { upload as docxUpload } from './docxtopdf.js';
|
||||||
import decryptpdf, { upload as decryptUpload } from './decryptpdf.js';
|
import decryptpdf, { upload as decryptUpload } from './decryptpdf.js';
|
||||||
import { deleteUserByAdmin, deleteUserGet, deleteUserPost } from './deleteUser.js';
|
import { deleteUserByAdmin, deleteUserPost } from './deleteAccount/deleteUser.js';
|
||||||
|
import { deleteUserGet } from './deleteAccount/deleteUserGet.js';
|
||||||
|
import { deleteUserOtp } from './deleteAccount/deleteUserOtp.js';
|
||||||
|
|
||||||
export const app = express();
|
export const app = express();
|
||||||
|
|
||||||
dotenv.config({ quiet: true });
|
dotenv.config({ quiet: true });
|
||||||
app.use(cors());
|
app.use(cors());
|
||||||
app.use(express.json({ limit: '50mb' }));
|
app.use(express.json({ limit: '100mb' }));
|
||||||
app.use(express.urlencoded({ limit: '50mb', extended: true }));
|
app.use(express.urlencoded({ limit: '100mb', extended: true }));
|
||||||
|
|
||||||
app.post('/file_upload', uploadFile);
|
app.post('/file_upload', uploadFile);
|
||||||
app.post('/docxtopdf', docxUpload.single('file'), docxtopdf);
|
app.post('/docxtopdf', docxUpload.single('file'), docxtopdf);
|
||||||
app.post('/decryptpdf', decryptUpload.single('file'), decryptpdf);
|
app.post('/decryptpdf', decryptUpload.single('file'), decryptpdf);
|
||||||
app.get('/delete-account/:userId', deleteUserGet);
|
app.get('/delete-account/:userId', deleteUserGet);
|
||||||
|
app.post('/delete-account/:userId/otp', deleteUserOtp);
|
||||||
app.post('/delete-account/:userId', deleteUserPost);
|
app.post('/delete-account/:userId', deleteUserPost);
|
||||||
app.post('/deleteuser/:userId', deleteUserByAdmin);
|
app.post('/deleteuser/:userId', deleteUserByAdmin);
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import { S3Client, DeleteObjectCommand } from '@aws-sdk/client-s3';
|
import { S3Client, DeleteObjectCommand } from '@aws-sdk/client-s3';
|
||||||
import fs from 'node:fs/promises';
|
import fs from 'node:fs/promises';
|
||||||
import pLimit from 'p-limit';
|
import pLimit from 'p-limit';
|
||||||
import { serverAppId } from '../../Utils.js';
|
import { serverAppId } from '../../../Utils.js';
|
||||||
|
|
||||||
// === Configuration ===
|
// === Configuration ===
|
||||||
const serverHost = new URL(process.env.SERVER_URL).hostname;
|
const serverHost = new URL(process.env.SERVER_URL).hostname;
|
||||||
+91
-140
@@ -1,7 +1,7 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { cloudServerUrl, generateId, serverAppId } from '../../Utils.js';
|
import { cloudServerUrl, generateId, serverAppId } from '../../../Utils.js';
|
||||||
import sendmailtoSupport from './sendMailToSupport.js';
|
|
||||||
import { deleteContactsInBatch, deleteDataFiles, deleteInBatches } from './deleteFileUrl.js';
|
import { deleteContactsInBatch, deleteDataFiles, deleteInBatches } from './deleteFileUrl.js';
|
||||||
|
import { MAX_ATTEMPTS } from './deleteUtils.js';
|
||||||
const serverUrl = cloudServerUrl;
|
const serverUrl = cloudServerUrl;
|
||||||
const appId = serverAppId;
|
const appId = serverAppId;
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ const resetPasswordAndDeleteSession = async userId => {
|
|||||||
await Parse.Object.destroyAll(sessions, { useMasterKey: true });
|
await Parse.Object.destroyAll(sessions, { useMasterKey: true });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
export async function deleteUser(userId, adminId) {
|
export async function deleteUser(userId, adminId, adminTenantId, isOrgAdmin, orgPtr) {
|
||||||
const userPointer = { __type: 'Pointer', className: '_User', objectId: userId };
|
const userPointer = { __type: 'Pointer', className: '_User', objectId: userId };
|
||||||
let userDetails = {
|
let userDetails = {
|
||||||
UserRole: 'not found',
|
UserRole: 'not found',
|
||||||
@@ -47,14 +47,18 @@ export async function deleteUser(userId, adminId) {
|
|||||||
const Users = Parse.Object.extend('contracts_Users');
|
const Users = Parse.Object.extend('contracts_Users');
|
||||||
const userQuery = new Parse.Query(Users);
|
const userQuery = new Parse.Query(Users);
|
||||||
userQuery.equalTo('UserId', userPointer);
|
userQuery.equalTo('UserId', userPointer);
|
||||||
if (adminId) {
|
if (adminTenantId) {
|
||||||
|
userQuery.equalTo('TenantId', adminTenantId);
|
||||||
|
if (isOrgAdmin && orgPtr) {
|
||||||
|
userQuery.equalTo('OrganizationId', orgPtr);
|
||||||
|
}
|
||||||
|
} else if (adminId) {
|
||||||
userQuery.equalTo('CreatedBy', { __type: 'Pointer', className: '_User', objectId: adminId });
|
userQuery.equalTo('CreatedBy', { __type: 'Pointer', className: '_User', objectId: adminId });
|
||||||
}
|
}
|
||||||
const userResult = await userQuery.first({ useMasterKey: true });
|
const userResult = await userQuery.first({ useMasterKey: true });
|
||||||
userDetails = { ...userDetails, UserId: userId };
|
userDetails = { ...userDetails, UserId: userId };
|
||||||
if (!userResult) {
|
if (!userResult) {
|
||||||
const errorMessage = 'User not found.';
|
const errorMessage = isOrgAdmin ? 'Unauthorized.' : 'User not found.';
|
||||||
sendmailtoSupport(userDetails, errorMessage);
|
|
||||||
return { code: 400, message: errorMessage };
|
return { code: 400, message: errorMessage };
|
||||||
}
|
}
|
||||||
const contractsUserId = userResult.id;
|
const contractsUserId = userResult.id;
|
||||||
@@ -62,6 +66,10 @@ export async function deleteUser(userId, adminId) {
|
|||||||
const teamIds = userResult.get('TeamIds') || [];
|
const teamIds = userResult.get('TeamIds') || [];
|
||||||
const organizationId = userResult.get('OrganizationId')?.id;
|
const organizationId = userResult.get('OrganizationId')?.id;
|
||||||
const isAdmin = userResult?.get('UserRole') === 'contracts_Admin' ? true : false;
|
const isAdmin = userResult?.get('UserRole') === 'contracts_Admin' ? true : false;
|
||||||
|
if (isOrgAdmin && isAdmin) {
|
||||||
|
const errorMessage = 'Unauthorized.';
|
||||||
|
return { code: 400, message: errorMessage };
|
||||||
|
}
|
||||||
userDetails = {
|
userDetails = {
|
||||||
...userDetails,
|
...userDetails,
|
||||||
UserRole: userResult?.get('UserRole'),
|
UserRole: userResult?.get('UserRole'),
|
||||||
@@ -73,7 +81,6 @@ export async function deleteUser(userId, adminId) {
|
|||||||
};
|
};
|
||||||
if (adminId && isAdmin) {
|
if (adminId && isAdmin) {
|
||||||
const errorMessage = 'An error occurred while deleting your account.';
|
const errorMessage = 'An error occurred while deleting your account.';
|
||||||
sendmailtoSupport(userDetails, errorMessage);
|
|
||||||
return { code: 400, message: errorMessage };
|
return { code: 400, message: errorMessage };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +92,6 @@ export async function deleteUser(userId, adminId) {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed during contracts_Template cleanup:', err);
|
console.error('Failed during contracts_Template cleanup:', err);
|
||||||
const errorMessage = 'Failed during contracts_Template cleanup:' + err?.message;
|
const errorMessage = 'Failed during contracts_Template cleanup:' + err?.message;
|
||||||
sendmailtoSupport(userDetails, errorMessage);
|
|
||||||
return { code: 400, message: errorMessage };
|
return { code: 400, message: errorMessage };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +101,6 @@ export async function deleteUser(userId, adminId) {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed during contactbook cleanup:', err);
|
console.error('Failed during contactbook cleanup:', err);
|
||||||
const errorMessage = 'Failed during contactbook cleanup:' + err?.message;
|
const errorMessage = 'Failed during contactbook cleanup:' + err?.message;
|
||||||
sendmailtoSupport(userDetails, errorMessage);
|
|
||||||
return { code: 400, message: errorMessage };
|
return { code: 400, message: errorMessage };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +121,6 @@ export async function deleteUser(userId, adminId) {
|
|||||||
console.error('Failed during contactbook current user cleanup:', err);
|
console.error('Failed during contactbook current user cleanup:', err);
|
||||||
const errorMessage =
|
const errorMessage =
|
||||||
'Failed during contactbook current user cleanup: ' + (err?.message || err);
|
'Failed during contactbook current user cleanup: ' + (err?.message || err);
|
||||||
sendmailtoSupport(userDetails, errorMessage);
|
|
||||||
return { code: 400, message: errorMessage };
|
return { code: 400, message: errorMessage };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +134,6 @@ export async function deleteUser(userId, adminId) {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to delete appToken entries:', err);
|
console.error('Failed to delete appToken entries:', err);
|
||||||
const errorMessage = 'Failed to delete appToken entries:' + err?.message;
|
const errorMessage = 'Failed to delete appToken entries:' + err?.message;
|
||||||
sendmailtoSupport(userDetails, errorMessage);
|
|
||||||
return { code: 400, message: errorMessage };
|
return { code: 400, message: errorMessage };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +143,6 @@ export async function deleteUser(userId, adminId) {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed during partners_DataFiles cleanup:', err);
|
console.error('Failed during partners_DataFiles cleanup:', err);
|
||||||
const errorMessage = 'Failed during partners_DataFiles cleanup:' + err?.message;
|
const errorMessage = 'Failed during partners_DataFiles cleanup:' + err?.message;
|
||||||
sendmailtoSupport(userDetails, errorMessage);
|
|
||||||
return { code: 400, message: errorMessage };
|
return { code: 400, message: errorMessage };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,7 +158,6 @@ export async function deleteUser(userId, adminId) {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to delete contracts_Organizations entry:', err);
|
console.error('Failed to delete contracts_Organizations entry:', err);
|
||||||
const errorMessage = 'Failed to delete contracts_Organizations entry:' + err?.message;
|
const errorMessage = 'Failed to delete contracts_Organizations entry:' + err?.message;
|
||||||
sendmailtoSupport(userDetails, errorMessage);
|
|
||||||
return { code: 400, message: errorMessage };
|
return { code: 400, message: errorMessage };
|
||||||
}
|
}
|
||||||
// STEP 7: Delete each entry in contracts_Teams by objectId from teamIds
|
// STEP 7: Delete each entry in contracts_Teams by objectId from teamIds
|
||||||
@@ -170,7 +171,6 @@ export async function deleteUser(userId, adminId) {
|
|||||||
} catch (teamErr) {
|
} catch (teamErr) {
|
||||||
console.error(`Failed to delete team with ID ${team.id}:`, teamErr);
|
console.error(`Failed to delete team with ID ${team.id}:`, teamErr);
|
||||||
const errorMessage = `Failed to delete team with ID ${team.id}` + teamErr?.message;
|
const errorMessage = `Failed to delete team with ID ${team.id}` + teamErr?.message;
|
||||||
sendmailtoSupport(userDetails, errorMessage);
|
|
||||||
return { code: 400, message: errorMessage };
|
return { code: 400, message: errorMessage };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -178,7 +178,6 @@ export async function deleteUser(userId, adminId) {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed during contracts_Teams deletion loop:', err);
|
console.error('Failed during contracts_Teams deletion loop:', err);
|
||||||
const errorMessage = 'Failed during contracts_Teams deletion loop:' + err?.message;
|
const errorMessage = 'Failed during contracts_Teams deletion loop:' + err?.message;
|
||||||
sendmailtoSupport(userDetails, errorMessage);
|
|
||||||
return { code: 400, message: errorMessage };
|
return { code: 400, message: errorMessage };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +193,6 @@ export async function deleteUser(userId, adminId) {
|
|||||||
const msg = `Failed during partners_Tenant ${'cleanup:'} `;
|
const msg = `Failed during partners_Tenant ${'cleanup:'} `;
|
||||||
console.error(msg, err);
|
console.error(msg, err);
|
||||||
const errorMessage = msg + err?.message;
|
const errorMessage = msg + err?.message;
|
||||||
sendmailtoSupport(userDetails, errorMessage);
|
|
||||||
return { code: 400, message: errorMessage };
|
return { code: 400, message: errorMessage };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,7 +212,6 @@ export async function deleteUser(userId, adminId) {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed during partners_TenantCredits cleanup:', err);
|
console.error('Failed during partners_TenantCredits cleanup:', err);
|
||||||
const errorMessage = 'Failed during partners_TenantCredits cleanup:' + err?.message;
|
const errorMessage = 'Failed during partners_TenantCredits cleanup:' + err?.message;
|
||||||
sendmailtoSupport(userDetails, errorMessage);
|
|
||||||
return { code: 400, message: errorMessage };
|
return { code: 400, message: errorMessage };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -228,7 +225,6 @@ export async function deleteUser(userId, adminId) {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed during contracts_Signature cleanup:', err);
|
console.error('Failed during contracts_Signature cleanup:', err);
|
||||||
const errorMessage = 'Failed during contracts_Signature cleanup:' + err?.message;
|
const errorMessage = 'Failed during contracts_Signature cleanup:' + err?.message;
|
||||||
sendmailtoSupport(userDetails, errorMessage);
|
|
||||||
return { code: 400, message: errorMessage };
|
return { code: 400, message: errorMessage };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,120 +234,20 @@ export async function deleteUser(userId, adminId) {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to delete contracts_Users entry:', err);
|
console.error('Failed to delete contracts_Users entry:', err);
|
||||||
const errorMessage = 'Failed to delete contracts_Users entry:' + err?.message;
|
const errorMessage = 'Failed to delete contracts_Users entry:' + err?.message;
|
||||||
sendmailtoSupport(userDetails, errorMessage);
|
|
||||||
return { code: 400, message: errorMessage };
|
return { code: 400, message: errorMessage };
|
||||||
}
|
}
|
||||||
return { code: 200, message: 'User and all associated data deleted successfully.' };
|
return { code: 200, message: 'User and all associated data deleted successfully.' };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('User deletion process failed:', error);
|
console.error('User deletion process failed:', error);
|
||||||
const errorMessage = `User deletion failed: ${error.message || error}`;
|
const errorMessage = `User deletion failed: ${error.message || error}`;
|
||||||
sendmailtoSupport(userDetails, errorMessage);
|
|
||||||
return { code: 400, message: errorMessage };
|
return { code: 400, message: errorMessage };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. HTML Password Prompt Page
|
|
||||||
export const deleteUserGet = async (req, res) => {
|
|
||||||
const { userId } = req.params;
|
|
||||||
|
|
||||||
const extUserQuery = new Parse.Query('Contracts_Users');
|
|
||||||
extUserQuery.equalTo('userId', { __type: 'Pointer', className: '_User', objectId: userId });
|
|
||||||
const extUser = await extUserQuery.first({ useMasterKey: true });
|
|
||||||
if (!extUser) {
|
|
||||||
const errorMessage = 'User not found.';
|
|
||||||
return res.send(errorMessage);
|
|
||||||
}
|
|
||||||
const routePath = process?.env?.SERVER_URL?.includes?.('api') ? '/api' : '';
|
|
||||||
const htmlForm = `
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Delete Account</title>
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
||||||
background-color: #f8f9fa;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
height: 100vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container {
|
|
||||||
background-color: #ffffff;
|
|
||||||
padding: 40px;
|
|
||||||
border-radius: 8px;
|
|
||||||
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
|
|
||||||
width: 100%;
|
|
||||||
max-width: 400px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
color: #dc3545;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
label {
|
|
||||||
display: block;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
input[type="password"] {
|
|
||||||
width: 100%;
|
|
||||||
padding: 12px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
|
||||||
background-color: #d9534f;
|
|
||||||
color: #ffffff;
|
|
||||||
border: none;
|
|
||||||
padding: 12px 20px;
|
|
||||||
font-size: 16px;
|
|
||||||
border-radius: 4px;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background-color 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
button:hover {
|
|
||||||
background-color: #c9302c;
|
|
||||||
}
|
|
||||||
|
|
||||||
.warning {
|
|
||||||
color: #6c757d;
|
|
||||||
font-size: 14px;
|
|
||||||
margin-top: -10px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="container">
|
|
||||||
<h2>Confirm Account Deletion</h2>
|
|
||||||
<p class="warning">This action is irreversible. Please confirm by entering your password.</p>
|
|
||||||
<form method="POST" action="${routePath}/delete-account/${userId}">
|
|
||||||
<label for="password">Password</label>
|
|
||||||
<input type="password" name="password" id="password" placeholder="Please provide your password" required />
|
|
||||||
<button type="submit">Delete My Account</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
`;
|
|
||||||
res.send(htmlForm);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 2. Handle Password Verification and Deletion
|
// 2. Handle Password Verification and Deletion
|
||||||
export const deleteUserPost = async (req, res) => {
|
export const deleteUserPost = async (req, res) => {
|
||||||
const { userId } = req.params;
|
const { userId } = req.params;
|
||||||
const routePath = process?.env?.SERVER_URL?.includes?.('api') ? '/api' : '';
|
const { otp } = req.body;
|
||||||
const { password } = req.body;
|
|
||||||
let userDetails = {
|
let userDetails = {
|
||||||
UserRole: 'not found',
|
UserRole: 'not found',
|
||||||
Name: 'not found',
|
Name: 'not found',
|
||||||
@@ -369,33 +265,68 @@ export const deleteUserPost = async (req, res) => {
|
|||||||
const user = await userQuery.first({ useMasterKey: true });
|
const user = await userQuery.first({ useMasterKey: true });
|
||||||
if (!user) {
|
if (!user) {
|
||||||
const errorMessage = 'User not found.';
|
const errorMessage = 'User not found.';
|
||||||
// sendmailtoSupport(userDetails, errorMessage);
|
|
||||||
// return res.status(404).send(errorMessage);
|
|
||||||
return res.send(errorMessage);
|
return res.send(errorMessage);
|
||||||
}
|
}
|
||||||
const extUserQuery = new Parse.Query('Contracts_Users');
|
const extUserQuery = new Parse.Query('contracts_Users');
|
||||||
extUserQuery.equalTo('userId', { __type: 'Pointer', className: '_User', objectId: userId });
|
extUserQuery.equalTo('UserId', { __type: 'Pointer', className: '_User', objectId: userId });
|
||||||
|
|
||||||
const extUser = await extUserQuery.first({ useMasterKey: true });
|
const extUser = await extUserQuery.first({ useMasterKey: true });
|
||||||
if (!extUser) {
|
if (!extUser) {
|
||||||
const errorMessage = 'User not found.';
|
const errorMessage = 'User not found.';
|
||||||
return res.send(errorMessage);
|
return res.send(errorMessage);
|
||||||
}
|
}
|
||||||
// 2. Attempt login to verify password
|
|
||||||
const username = user.get('username'); // assuming 'username' is used for login
|
if (extUser?.get('UserRole') !== 'contracts_Admin') {
|
||||||
|
const errorMessage =
|
||||||
|
'This action is not permitted. Kindly contact your administrator to request account deletion.';
|
||||||
|
return res.send(errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
const extUsers = new Parse.Query('contracts_Users');
|
||||||
|
extUsers.equalTo('TenantId', extUser?.get('TenantId'));
|
||||||
|
extUsers.notEqualTo('UserRole', 'contracts_Admin');
|
||||||
|
const isTeamUsers = await extUsers.first({ useMasterKey: true });
|
||||||
|
if (isTeamUsers) {
|
||||||
|
const errorMessage = `To delete this account, start by removing all team users associated with it. Once all users are removed, you'll be able to permanently delete the account.`;
|
||||||
|
return res.send(errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get stored OTP info
|
||||||
|
const savedOtp = extUser.get('DeleteOTP') || '';
|
||||||
|
const expiry = extUser.get('DeleteOTPExpiry');
|
||||||
|
const tries = Number(extUser.get('DeleteOTPTries') || 0);
|
||||||
|
|
||||||
|
if (tries >= MAX_ATTEMPTS) {
|
||||||
|
return res.status(429).send('Too many invalid attempts. Please resend OTP and try again.');
|
||||||
|
}
|
||||||
|
if (!otp || typeof otp !== 'string') {
|
||||||
|
// Count attempt
|
||||||
|
extUser.set('DeleteOTPTries', tries + 1);
|
||||||
|
await extUser.save(null, { useMasterKey: true });
|
||||||
|
return res.status(400).send('OTP is required.');
|
||||||
|
}
|
||||||
|
if (!savedOtp) {
|
||||||
|
return res.status(400).send('No OTP found. Please request a new OTP.');
|
||||||
|
}
|
||||||
|
if (expiry && Date.now() > expiry.getTime()) {
|
||||||
|
return res.status(400).send('OTP has expired. Please request a new OTP.');
|
||||||
|
}
|
||||||
|
if (otp !== savedOtp) {
|
||||||
|
// Increment tries on mismatch
|
||||||
|
extUser.set('DeleteOTPTries', tries + 1);
|
||||||
|
await extUser.save(null, { useMasterKey: true });
|
||||||
|
return res.status(400).send('Invalid OTP.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Remove OTP related data
|
||||||
try {
|
try {
|
||||||
// await Parse.User.logIn(username, password); // Will throw if password invalid
|
extUser.unset('DeleteOTP');
|
||||||
// Use REST login to avoid mutating the global Parse current user
|
extUser.unset('DeleteOTPExpiry');
|
||||||
// Will throw if password invalid
|
extUser.unset('DeleteOTPSentAt');
|
||||||
const res = await axios.get(serverUrl + '/login', {
|
extUser.unset('DeleteOTPTries');
|
||||||
params: { username, password },
|
await extUser.save(null, { useMasterKey: true });
|
||||||
headers: { 'X-Parse-Application-Id': appId },
|
|
||||||
});
|
|
||||||
console.log('Res ', res?.data);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('err while validating password: ', err?.response?.data || err);
|
console.log('err while validating password: ', err?.response?.data || err);
|
||||||
const errorMessage = `Invalid password. <a href="${routePath}/delete-account/${userId}">Try again</a>`;
|
|
||||||
sendmailtoSupport(userDetails, errorMessage);
|
|
||||||
return res.status(401).send(errorMessage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await deleteUser(userId);
|
const response = await deleteUser(userId);
|
||||||
@@ -405,7 +336,6 @@ export const deleteUserPost = async (req, res) => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Account deletion error:', error);
|
console.error('Account deletion error:', error);
|
||||||
const errorMessage = error?.message || 'An error occurred while deleting your account.';
|
const errorMessage = error?.message || 'An error occurred while deleting your account.';
|
||||||
sendmailtoSupport(userDetails, errorMessage);
|
|
||||||
return res.status(500).send(errorMessage);
|
return res.status(500).send(errorMessage);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -444,10 +374,32 @@ export const deleteUserByAdmin = async (req, res) => {
|
|||||||
const user = await userQuery.first({ useMasterKey: true });
|
const user = await userQuery.first({ useMasterKey: true });
|
||||||
if (!user) {
|
if (!user) {
|
||||||
const errorMessage = 'User not found.';
|
const errorMessage = 'User not found.';
|
||||||
sendmailtoSupport(userDetails, errorMessage);
|
|
||||||
return res.status(400).json({ message: errorMessage });
|
return res.status(400).json({ message: errorMessage });
|
||||||
}
|
}
|
||||||
const response = await deleteUser(userId, adminId);
|
|
||||||
|
if (adminId === userId) {
|
||||||
|
return res.status(400).json({ message: 'You cannot delete your own account.' });
|
||||||
|
}
|
||||||
|
// 2. ext user details
|
||||||
|
const extUserQuery = new Parse.Query('contracts_Users');
|
||||||
|
extUserQuery.equalTo('UserId', { __type: 'Pointer', className: '_User', objectId: adminId });
|
||||||
|
const extUser = await extUserQuery.first({ useMasterKey: true });
|
||||||
|
if (!extUser) {
|
||||||
|
const errorMessage = 'User not found.';
|
||||||
|
return res.status(400).json({ message: errorMessage });
|
||||||
|
}
|
||||||
|
const isAdmin =
|
||||||
|
extUser?.get('UserRole') === 'contracts_Admin' ||
|
||||||
|
extUser?.get('UserRole') === 'contracts_OrgAdmin'
|
||||||
|
? true
|
||||||
|
: false;
|
||||||
|
const isOrgAdmin = extUser?.get('UserRole') === 'contracts_OrgAdmin';
|
||||||
|
const tenantId = extUser?.get('TenantId');
|
||||||
|
const orgPtr = isOrgAdmin && extUser?.get('OrganizationId');
|
||||||
|
if (!isAdmin) {
|
||||||
|
return res.status(400).json({ message: 'Unauthorized.' });
|
||||||
|
}
|
||||||
|
const response = await deleteUser(userId, adminId, tenantId, isOrgAdmin, orgPtr);
|
||||||
const code = response?.code || 400;
|
const code = response?.code || 400;
|
||||||
const message = response?.message || 'An error occurred while deleting your account.';
|
const message = response?.message || 'An error occurred while deleting your account.';
|
||||||
return res.status(code).json({ message: message });
|
return res.status(code).json({ message: message });
|
||||||
@@ -458,7 +410,6 @@ export const deleteUserByAdmin = async (req, res) => {
|
|||||||
error?.message ||
|
error?.message ||
|
||||||
'An error occurred while deleting your account.';
|
'An error occurred while deleting your account.';
|
||||||
console.error(`Account deletion error:`, errorMessage);
|
console.error(`Account deletion error:`, errorMessage);
|
||||||
sendmailtoSupport(userDetails, errorMessage);
|
|
||||||
return res.status(code).json({ message: errorMessage });
|
return res.status(code).json({ message: errorMessage });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,143 @@
|
|||||||
|
import { OTP_LENGTH, RESEND_COOLDOWN_SEC } from './deleteUtils.js';
|
||||||
|
|
||||||
|
// 1. HTML Password Prompt Page
|
||||||
|
export const deleteUserGet = async (req, res) => {
|
||||||
|
const { userId } = req.params;
|
||||||
|
|
||||||
|
const extUserQuery = new Parse.Query('contracts_Users');
|
||||||
|
extUserQuery.equalTo('UserId', { __type: 'Pointer', className: '_User', objectId: userId });
|
||||||
|
const extUser = await extUserQuery.first({ useMasterKey: true });
|
||||||
|
if (!extUser) return res.status(404).send('User not found.');
|
||||||
|
|
||||||
|
const routePath = process?.env?.SERVER_URL?.includes?.('api') ? '/api' : '';
|
||||||
|
|
||||||
|
const htmlForm = `
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Delete Account</title>
|
||||||
|
<style>
|
||||||
|
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f8f9fa; margin: 0; padding: 0; display: flex; justify-content: center; align-items: center; height: 100vh; }
|
||||||
|
.container { background-color: #ffffff; padding: 40px; border-radius: 8px; box-shadow: 0 8px 16px rgba(0,0,0,0.1); width: 100%; max-width: 420px; text-align: center; }
|
||||||
|
h2 { color: #dc3545; margin-bottom: 14px; }
|
||||||
|
p.warning { color: #6c757d; font-size: 14px; margin-top: 0; margin-bottom: 18px; }
|
||||||
|
|
||||||
|
label { display: block; margin-bottom: 10px; font-weight: 600; text-align: left; }
|
||||||
|
input[type="text"] { width: 100%; padding: 12px; margin-bottom: 16px; border: 1px solid #ccc; border-radius: 4px; font-size: 16px; letter-spacing: 0.2em; }
|
||||||
|
|
||||||
|
button { background-color: #d9534f; color: #ffffff; border: none; padding: 12px 16px; font-size: 16px; border-radius: 4px; cursor: pointer; transition: background-color 0.3s ease; }
|
||||||
|
button:hover { background-color: #c9302c; }
|
||||||
|
.secondary { background-color: #6c757d; }
|
||||||
|
.secondary:hover { background-color: #5a6268; }
|
||||||
|
.btn-block { width: 100%; }
|
||||||
|
|
||||||
|
.link-btn { background: transparent; border: none; color: #0d6efd; text-decoration: underline; padding: 0; font-size: 14px; cursor: pointer; }
|
||||||
|
.link-btn[disabled] { color: #6c757d; text-decoration: none; cursor: not-allowed; }
|
||||||
|
|
||||||
|
.muted { color: #6c757d; font-size: 13px; margin-top: 8px; min-height: 18px; }
|
||||||
|
.error { color: #c9302c; font-size: 13px; margin-top: 8px; min-height: 18px; }
|
||||||
|
|
||||||
|
.hidden { display: none; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<h2>Confirm Account Deletion</h2>
|
||||||
|
|
||||||
|
<!-- Initial view: only Send OTP -->
|
||||||
|
<div id="preOtp">
|
||||||
|
<p class="warning">This action is irreversible. A verification mail will be sent to your account to your registered email.</p>
|
||||||
|
<button type="button" id="sendOtpBtn" class="secondary btn-block">Send OTP</button>
|
||||||
|
<div id="preMsg" class="muted"></div>
|
||||||
|
<div id="preErr" class="error"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Shown after OTP is sent -->
|
||||||
|
<form id="otpForm" class="hidden" method="POST" action="${routePath}/delete-account/${userId}">
|
||||||
|
<p class="warning">This action is irreversible. Verify with an OTP sent to your registered email.</p>
|
||||||
|
<label for="otp">One-Time Password (OTP)</label>
|
||||||
|
<input type="text" name="otp" id="otp" placeholder="Enter ${OTP_LENGTH}-digit OTP" required maxlength="${OTP_LENGTH}" inputmode="numeric" />
|
||||||
|
|
||||||
|
<div style="text-align:center; margin-top: 10px;">
|
||||||
|
<button type="submit" id="deleteBtn">Delete My Account</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="text-align:center; margin-top: 10px;">
|
||||||
|
<button type="button" id="resendOtpLink" class="link-btn">Resend OTP</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="timer" class="muted"></div>
|
||||||
|
<div id="msg" class="muted"></div>
|
||||||
|
<div id="err" class="error"></div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
(function(){
|
||||||
|
const preOtp = document.getElementById('preOtp');
|
||||||
|
const sendBtn = document.getElementById('sendOtpBtn');
|
||||||
|
const preMsg = document.getElementById('preMsg');
|
||||||
|
const preErr = document.getElementById('preErr');
|
||||||
|
|
||||||
|
const form = document.getElementById('otpForm');
|
||||||
|
const otpInput = document.getElementById('otp');
|
||||||
|
const resendLink = document.getElementById('resendOtpLink');
|
||||||
|
const timerEl = document.getElementById('timer');
|
||||||
|
const msgEl = document.getElementById('msg');
|
||||||
|
const errEl = document.getElementById('err');
|
||||||
|
|
||||||
|
const RESEND_WAIT = ${RESEND_COOLDOWN_SEC};
|
||||||
|
let countdown = 0;
|
||||||
|
let iv = null;
|
||||||
|
|
||||||
|
function setText(el, t){ el.textContent = t || ''; }
|
||||||
|
function updateResendState(){
|
||||||
|
resendLink.disabled = countdown>0;
|
||||||
|
if(countdown>0){
|
||||||
|
resendLink.setAttribute('disabled','true');
|
||||||
|
resendLink.style.pointerEvents='none';
|
||||||
|
}else{
|
||||||
|
resendLink.removeAttribute('disabled');
|
||||||
|
resendLink.style.pointerEvents='auto';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function tick(){
|
||||||
|
if(countdown<=0){ clearInterval(iv); iv=null; setText(timerEl,'You can resend the OTP now.'); updateResendState(); return; }
|
||||||
|
setText(timerEl,'Resend available in '+countdown+'s'); countdown--; updateResendState();
|
||||||
|
}
|
||||||
|
function startTimer(sec){ countdown=sec||RESEND_WAIT; if(iv) clearInterval(iv); tick(); iv=setInterval(tick,1000); }
|
||||||
|
|
||||||
|
async function sendOtp(showForm){
|
||||||
|
setText(preErr,''); setText(preMsg,'Sending OTP...');
|
||||||
|
try {
|
||||||
|
const resp = await fetch('${routePath}/delete-account/${userId}/otp',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({})});
|
||||||
|
const data = await resp.json().catch(()=>({}));
|
||||||
|
if(!resp.ok){
|
||||||
|
if(resp.status===429 && data?.retryAfterSec){
|
||||||
|
startTimer(data.retryAfterSec); setText(preErr,'Please wait '+data.retryAfterSec+'s before resending.'); setText(preMsg,'');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new Error(data?.error || 'Failed to send OTP.');
|
||||||
|
}
|
||||||
|
startTimer(data?.cooldownSec || RESEND_WAIT);
|
||||||
|
|
||||||
|
// Success: hide pre, show form
|
||||||
|
preOtp.classList.add('hidden');
|
||||||
|
form.classList.remove('hidden');
|
||||||
|
setText(msgEl,'OTP sent to your registered email.');
|
||||||
|
otpInput.focus();
|
||||||
|
|
||||||
|
} catch(e){
|
||||||
|
setText(preErr,e.message||'Error sending OTP.');
|
||||||
|
setText(preMsg,'');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sendBtn.addEventListener('click',()=>sendOtp(true));
|
||||||
|
resendLink.addEventListener('click',()=>{ if(countdown<=0) sendOtp(false); });
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
`;
|
||||||
|
res.send(htmlForm);
|
||||||
|
};
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import {
|
||||||
|
generateOtp,
|
||||||
|
msUntil,
|
||||||
|
sendDeleteOtpEmail,
|
||||||
|
OTP_EXPIRES_MIN,
|
||||||
|
RESEND_COOLDOWN_SEC,
|
||||||
|
} from './deleteUtils.js';
|
||||||
|
|
||||||
|
export const deleteUserOtp = async (req, res) => {
|
||||||
|
const { userId } = req.params;
|
||||||
|
|
||||||
|
const extUserQuery = new Parse.Query('contracts_Users');
|
||||||
|
extUserQuery.equalTo('UserId', { __type: 'Pointer', className: '_User', objectId: userId });
|
||||||
|
const extUser = await extUserQuery.first({ useMasterKey: true });
|
||||||
|
if (!extUser) return res.status(404).json({ error: 'User not found' });
|
||||||
|
|
||||||
|
const now = Date.now();
|
||||||
|
const lastSentAt = extUser.get('DeleteOTPSentAt')?.getTime?.() || 0;
|
||||||
|
const cooldownEndsAt = lastSentAt + RESEND_COOLDOWN_SEC * 1000;
|
||||||
|
const remainingMs = msUntil(now, cooldownEndsAt);
|
||||||
|
|
||||||
|
if (remainingMs > 0) {
|
||||||
|
return res
|
||||||
|
.status(429)
|
||||||
|
.json({ error: 'Cooldown not finished', retryAfterSec: Math.ceil(remainingMs / 1000) });
|
||||||
|
}
|
||||||
|
|
||||||
|
const otp = generateOtp();
|
||||||
|
const expiresAt = new Date(now + OTP_EXPIRES_MIN * 60 * 1000);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const resp = await sendDeleteOtpEmail(extUser, otp);
|
||||||
|
extUser.set('DeleteOTP', otp);
|
||||||
|
extUser.set('DeleteOTPExpiry', expiresAt);
|
||||||
|
extUser.set('DeleteOTPSentAt', new Date(now));
|
||||||
|
extUser.set('DeleteOTPTries', 0); // reset tries on resend
|
||||||
|
await extUser.save(null, { useMasterKey: true });
|
||||||
|
return res.json({ ok: true, cooldownSec: RESEND_COOLDOWN_SEC, expiresInMin: OTP_EXPIRES_MIN });
|
||||||
|
} catch (err) {
|
||||||
|
console.log('Error sending delete OTP (POST /otp):', err?.response?.data || err);
|
||||||
|
return res.status(500).json({ error: 'Failed to send OTP' });
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
import axios from 'axios';
|
||||||
|
import { appName, cloudServerUrl, serverAppId } from '../../../Utils.js';
|
||||||
|
|
||||||
|
const serverUrl = cloudServerUrl;
|
||||||
|
const appId = serverAppId;
|
||||||
|
const masterKey = process.env.MASTER_KEY;
|
||||||
|
|
||||||
|
// Constants (adjust to your preference)
|
||||||
|
export const OTP_LENGTH = 6;
|
||||||
|
export const OTP_EXPIRES_MIN = 10; // OTP validity in minutes
|
||||||
|
export const RESEND_COOLDOWN_SEC = 30; // Cooldown between OTP sends
|
||||||
|
export const MAX_ATTEMPTS = 5; // Max allowed wrong attempts
|
||||||
|
|
||||||
|
export function generateOtp(len = OTP_LENGTH) {
|
||||||
|
// 6-digit numeric OTP (000000–999999, padded)
|
||||||
|
const n = Math.floor(Math.random() * Math.pow(10, len));
|
||||||
|
return String(n).padStart(len, '0');
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function sendDeleteOtpEmail(extUser, otp) {
|
||||||
|
const params = {
|
||||||
|
extUserId: extUser.id,
|
||||||
|
from: appName,
|
||||||
|
recipient: extUser?.get('Email'),
|
||||||
|
subject: 'OTP for Deletion account request',
|
||||||
|
html: `
|
||||||
|
<html lang="en">
|
||||||
|
<body style="margin:0;padding:0;background:#f6f7fb;font-family:Arial,Helvetica,sans-serif;">
|
||||||
|
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background:#f6f7fb;">
|
||||||
|
<tr>
|
||||||
|
<td align="center" style="padding:24px;">
|
||||||
|
<table role="presentation" width="480" cellpadding="0" cellspacing="0" style="background:#ffffff;border:1px solid #e9ecf1;border-radius:8px;padding:20px;">
|
||||||
|
<tr>
|
||||||
|
<td align="left" style="font-size:16px;color:#0f172a;">
|
||||||
|
<div style="font-weight:bold;margin-bottom:8px;">${appName}</div>
|
||||||
|
<div style="font-size:18px;margin:0 0 12px 0;">Your verification code</div>
|
||||||
|
<div style="display:inline-block;border:1px solid #e9ecf1;border-radius:6px;background:#f8fafc;padding:10px 14px;margin-bottom:10px;">
|
||||||
|
<span style="font-family:Consolas,'Courier New',monospace;font-size:24px;letter-spacing:6px;color:#0f172a;">${otp}</span>
|
||||||
|
</div>
|
||||||
|
<p style="margin:8px 0 0 0;font-size:13px;color:#475569;">
|
||||||
|
This code expires in <strong>${OTP_EXPIRES_MIN}</strong> minutes.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<hr style="border:none;border-top:1px solid #e9ecf1;margin:18px 0;">
|
||||||
|
<p style="margin:0;font-size:12px;color:#64748b;">
|
||||||
|
If you didn’t request this code, you can ignore this email.
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div style="font-size:11px;color:#94a3b8;margin-top:12px;">
|
||||||
|
© ${new Date().getFullYear()} ${appName}. All rights reserved.
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
`,
|
||||||
|
};
|
||||||
|
const headers = {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'X-Parse-Application-Id': appId,
|
||||||
|
'X-Parse-Master-Key': masterKey,
|
||||||
|
};
|
||||||
|
return axios.post(serverUrl + '/functions/sendmailv3', params, { headers });
|
||||||
|
}
|
||||||
|
|
||||||
|
export function msUntil(nowMs, futureMs) {
|
||||||
|
return Math.max(0, (futureMs || 0) - nowMs);
|
||||||
|
}
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
import { appName, smtpenable } from '../../Utils.js';
|
|
||||||
|
|
||||||
export default async function sendmailtoSupport(userDetails, errorMessage) {
|
|
||||||
const mailsender = smtpenable ? process.env.SMTP_USER_EMAIL : process.env.MAILGUN_SENDER;
|
|
||||||
// Render a simple HTML form. In production, consider using a templating engine.
|
|
||||||
try {
|
|
||||||
await Parse.Cloud.sendEmail({
|
|
||||||
sender: appName + ' <' + mailsender + '>',
|
|
||||||
recipient: 'support@opensignlabs.com',
|
|
||||||
subject: `Error while deleting account – ${appName}`,
|
|
||||||
text: `Error while deleting account – ${appName}`,
|
|
||||||
html: `<html>
|
|
||||||
<head>
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
font-family: Arial, sans-serif;
|
|
||||||
background-color: #f8f9fa;
|
|
||||||
margin: 0;
|
|
||||||
padding: 40px;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container {
|
|
||||||
max-width: 600px;
|
|
||||||
margin: auto;
|
|
||||||
background: #ffffff;
|
|
||||||
border: 1px solid #dee2e6;
|
|
||||||
border-radius: 8px;
|
|
||||||
box-shadow: 0 4px 8px rgba(0,0,0,0.05);
|
|
||||||
padding: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
color: #dc3545;
|
|
||||||
font-size: 24px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
font-size: 20px;
|
|
||||||
color: #495057;
|
|
||||||
margin-top: 30px;
|
|
||||||
border-bottom: 1px solid #dee2e6;
|
|
||||||
padding-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.details p {
|
|
||||||
margin: 10px 0;
|
|
||||||
line-height: 1.6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.label {
|
|
||||||
font-weight: bold;
|
|
||||||
color: #212529;
|
|
||||||
}
|
|
||||||
|
|
||||||
.value {
|
|
||||||
color: #495057;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="container">
|
|
||||||
<h1>Error: ${errorMessage}</h1>
|
|
||||||
|
|
||||||
<h2>User Details</h2>
|
|
||||||
<div class="details">
|
|
||||||
<p><span class="label">UserRole:</span> <span class="value">${userDetails?.UserRole}</span></p>
|
|
||||||
<p><span class="label">Name:</span> <span class="value">${userDetails?.Name}</span></p>
|
|
||||||
<p><span class="label">Email:</span> <span class="value">${userDetails?.Email}</span></p>
|
|
||||||
<p><span class="label">UserId:</span> <span class="value">${userDetails?.UserId}</span></p>
|
|
||||||
<p><span class="label">ExtUserId:</span> <span class="value">${userDetails?.objectId}</span></p>
|
|
||||||
<p><span class="label">TenantId:</span> <span class="value">${userDetails?.TenantId}</span></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>`,
|
|
||||||
});
|
|
||||||
} catch (err) {
|
|
||||||
console.log('err while sending mail to support', err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -56,6 +56,7 @@ import loginUser from './parsefunction/loginUser.js';
|
|||||||
import addUser from './parsefunction/addUser.js';
|
import addUser from './parsefunction/addUser.js';
|
||||||
import filterDocs from './parsefunction/filterDocs.js';
|
import filterDocs from './parsefunction/filterDocs.js';
|
||||||
import sendDeleteUserMail from './parsefunction/sendDeleteUserMail.js';
|
import sendDeleteUserMail from './parsefunction/sendDeleteUserMail.js';
|
||||||
|
import resetPassword from './parsefunction/resetPassword.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);
|
||||||
@@ -122,3 +123,4 @@ Parse.Cloud.define('loginuser', loginUser);
|
|||||||
Parse.Cloud.define('adduser', addUser);
|
Parse.Cloud.define('adduser', addUser);
|
||||||
Parse.Cloud.define('filterdocs', filterDocs);
|
Parse.Cloud.define('filterdocs', filterDocs);
|
||||||
Parse.Cloud.define('senddeleterequest', sendDeleteUserMail);
|
Parse.Cloud.define('senddeleterequest', sendDeleteUserMail);
|
||||||
|
Parse.Cloud.define('resetpassword', resetPassword);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import fs from 'node:fs';
|
|||||||
import dotenv from 'dotenv';
|
import dotenv from 'dotenv';
|
||||||
import GenerateCertificate from './pdf/GenerateCertificate.js';
|
import GenerateCertificate from './pdf/GenerateCertificate.js';
|
||||||
import { getSecureUrl } from '../../Utils.js';
|
import { getSecureUrl } from '../../Utils.js';
|
||||||
|
import { parseUploadFile } from '../../utils/fileUtils.js';
|
||||||
dotenv.config({ quiet: true });
|
dotenv.config({ quiet: true });
|
||||||
const eSignName = 'OpenSign';
|
const eSignName = 'OpenSign';
|
||||||
const eSigncontact = 'hello@opensignlabs.com';
|
const eSigncontact = 'hello@opensignlabs.com';
|
||||||
@@ -16,10 +17,14 @@ async function uploadFile(pdfName, filepath) {
|
|||||||
try {
|
try {
|
||||||
const filedata = fs.readFileSync(filepath);
|
const filedata = fs.readFileSync(filepath);
|
||||||
let fileUrl;
|
let fileUrl;
|
||||||
const file = new Parse.File(pdfName, [...filedata], 'application/pdf');
|
|
||||||
await file.save({ useMasterKey: true });
|
// const file = new Parse.File(pdfName, [...filedata], 'application/pdf');
|
||||||
const fileRes = getSecureUrl(file.url());
|
// await file.save({ useMasterKey: true });
|
||||||
fileUrl = fileRes.url;
|
// const fileRes = getSecureUrl(file.url());
|
||||||
|
// fileUrl = fileRes.url;
|
||||||
|
|
||||||
|
const fileRes = await parseUploadFile(pdfName, filedata, 'application/pdf');
|
||||||
|
fileUrl = getSecureUrl(fileRes?.url)?.url;
|
||||||
return { imageUrl: fileUrl };
|
return { imageUrl: fileUrl };
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Err ', err);
|
console.log('Err ', err);
|
||||||
@@ -52,7 +57,9 @@ export default async function generateCertificatebydocId(req) {
|
|||||||
const certificatePath = `./exports/certificate_${docId}.pdf`;
|
const certificatePath = `./exports/certificate_${docId}.pdf`;
|
||||||
try {
|
try {
|
||||||
const getDocument = new Parse.Query('contracts_Document');
|
const getDocument = new Parse.Query('contracts_Document');
|
||||||
getDocument.include('ExtUserPtr,Signers,AuditTrail.UserPtr,Placeholders,ExtUserPtr.TenantId');
|
getDocument.include(
|
||||||
|
'ExtUserPtr,Signers,AuditTrail.UserPtr,Placeholders,ExtUserPtr.TenantId,ExtUserPtr.UserId'
|
||||||
|
);
|
||||||
const docRes = await getDocument.get(docId, { useMasterKey: true });
|
const docRes = await getDocument.get(docId, { useMasterKey: true });
|
||||||
|
|
||||||
if (docRes && docRes?.get('IsCompleted') && !docRes?.get('CertificateUrl')) {
|
if (docRes && docRes?.get('IsCompleted') && !docRes?.get('CertificateUrl')) {
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export default async function getDrive(request) {
|
|||||||
return { error: 'Please provide required parameter!' };
|
return { error: 'Please provide required parameter!' };
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('err', err);
|
console.log('err', err?.response?.data || err);
|
||||||
if (err.code == 209) {
|
if (err.code == 209) {
|
||||||
return { error: 'Invalid session token' };
|
return { error: 'Invalid session token' };
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -20,22 +20,23 @@ async function getTenantByUserId(userId, contactId) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const query = new Parse.Query('contracts_Users');
|
const query = new Parse.Query('contracts_Users');
|
||||||
query.equalTo('UserId', {
|
query.equalTo('UserId', { __type: 'Pointer', className: '_User', objectId: userId });
|
||||||
__type: 'Pointer',
|
|
||||||
className: '_User',
|
|
||||||
objectId: userId,
|
|
||||||
});
|
|
||||||
const extuser = await query.first({ useMasterKey: true });
|
const extuser = await query.first({ useMasterKey: true });
|
||||||
if (extuser) {
|
if (extuser) {
|
||||||
|
const tenantId = extuser?.get('TenantId')?.id || '';
|
||||||
const user = extuser?.get('CreatedBy')?.id || userId;
|
const user = extuser?.get('CreatedBy')?.id || userId;
|
||||||
const tenantCreditsQuery = new Parse.Query('partners_Tenant');
|
const tenantQuery = new Parse.Query('partners_Tenant');
|
||||||
tenantCreditsQuery.equalTo('UserId', {
|
if (tenantId) {
|
||||||
__type: 'Pointer',
|
tenantQuery.equalTo('objectId', tenantId);
|
||||||
className: '_User',
|
} else {
|
||||||
objectId: user,
|
tenantQuery.equalTo('UserId', {
|
||||||
});
|
__type: 'Pointer',
|
||||||
tenantCreditsQuery.exclude('FileAdapters,PfxFile');
|
className: '_User',
|
||||||
const res = await tenantCreditsQuery.first({ useMasterKey: true });
|
objectId: user,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
tenantQuery.exclude('FileAdapters,PfxFile');
|
||||||
|
const res = await tenantQuery.first({ useMasterKey: true });
|
||||||
return res;
|
return res;
|
||||||
} else {
|
} else {
|
||||||
return {};
|
return {};
|
||||||
|
|||||||
@@ -14,13 +14,19 @@ import { pdflibAddPlaceholder } from '@signpdf/placeholder-pdf-lib';
|
|||||||
import { Placeholder } from './Placeholder.js';
|
import { Placeholder } from './Placeholder.js';
|
||||||
import { SignPdf } from '@signpdf/signpdf';
|
import { SignPdf } from '@signpdf/signpdf';
|
||||||
import { P12Signer } from '@signpdf/signer-p12';
|
import { P12Signer } from '@signpdf/signer-p12';
|
||||||
import { buildDownloadFilename } from '../../../utils/fileUtils.js';
|
import { buildDownloadFilename, parseUploadFile } from '../../../utils/fileUtils.js';
|
||||||
|
|
||||||
const serverUrl = cloudServerUrl; // process.env.SERVER_URL;
|
const serverUrl = cloudServerUrl; // process.env.SERVER_URL;
|
||||||
const APPID = serverAppId;
|
const APPID = serverAppId;
|
||||||
const masterKEY = process.env.MASTER_KEY;
|
const masterKEY = process.env.MASTER_KEY;
|
||||||
const eSignName = 'OpenSign';
|
const eSignName = 'OpenSign';
|
||||||
const eSigncontact = 'hello@opensignlabs.com';
|
const eSigncontact = 'hello@opensignlabs.com';
|
||||||
|
const docUrl = `${serverUrl}/classes/contracts_Document`;
|
||||||
|
const headers = {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'X-Parse-Application-Id': APPID,
|
||||||
|
'X-Parse-Master-Key': masterKEY,
|
||||||
|
};
|
||||||
|
|
||||||
async function unlinkFile(path) {
|
async function unlinkFile(path) {
|
||||||
if (fs.existsSync(path)) {
|
if (fs.existsSync(path)) {
|
||||||
@@ -37,10 +43,14 @@ async function uploadFile(pdfName, filepath) {
|
|||||||
try {
|
try {
|
||||||
const filedata = fs.readFileSync(filepath);
|
const filedata = fs.readFileSync(filepath);
|
||||||
let fileUrl;
|
let fileUrl;
|
||||||
const file = new Parse.File(pdfName, [...filedata], 'application/pdf');
|
|
||||||
await file.save({ useMasterKey: true });
|
// const file = new Parse.File(pdfName, [...filedata], 'application/pdf');
|
||||||
const fileRes = getSecureUrl(file.url());
|
// await file.save({ useMasterKey: true });
|
||||||
fileUrl = fileRes.url;
|
// const fileRes = getSecureUrl(file.url());
|
||||||
|
// fileUrl = fileRes.url;
|
||||||
|
|
||||||
|
const fileRes = await parseUploadFile(pdfName, filedata, 'application/pdf');
|
||||||
|
fileUrl = getSecureUrl(fileRes?.url)?.url;
|
||||||
|
|
||||||
return { imageUrl: fileUrl };
|
return { imageUrl: fileUrl };
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -90,13 +100,7 @@ async function updateDoc(docId, url, userId, ipAddress, data, className, sign) {
|
|||||||
isCompleted = true;
|
isCompleted = true;
|
||||||
}
|
}
|
||||||
const body = { SignedUrl: url, AuditTrail: updateAuditTrail, IsCompleted: isCompleted };
|
const body = { SignedUrl: url, AuditTrail: updateAuditTrail, IsCompleted: isCompleted };
|
||||||
const signedRes = await axios.put(serverUrl + '/classes/contracts_Document/' + docId, body, {
|
const signedRes = await axios.put(`${docUrl}/${docId}`, body, { headers });
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'X-Parse-Application-Id': APPID,
|
|
||||||
'X-Parse-Master-Key': masterKEY,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return { isCompleted: isCompleted, message: 'success', AuditTrail: updateAuditTrail };
|
return { isCompleted: isCompleted, message: 'success', AuditTrail: updateAuditTrail };
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('update doc err ', err);
|
console.log('update doc err ', err);
|
||||||
@@ -141,13 +145,7 @@ async function sendNotifyMail(doc, signUser, mailProvider, publicUrl) {
|
|||||||
html: body,
|
html: body,
|
||||||
mailProvider: mailProvider,
|
mailProvider: mailProvider,
|
||||||
};
|
};
|
||||||
await axios.post(serverUrl + '/functions/sendmailv3', params, {
|
await axios.post(serverUrl + '/functions/sendmailv3', params, { headers });
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'X-Parse-Application-Id': APPID,
|
|
||||||
'X-Parse-Master-Key': masterKEY,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('err in sendnotifymail', err);
|
console.log('err in sendnotifymail', err);
|
||||||
@@ -255,13 +253,7 @@ async function sendCompletedMail(obj) {
|
|||||||
filename: docName,
|
filename: docName,
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
const res = await axios.post(serverUrl + '/functions/sendmailv3', params, {
|
const res = await axios.post(serverUrl + '/functions/sendmailv3', params, { headers });
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'X-Parse-Application-Id': APPID,
|
|
||||||
'X-Parse-Master-Key': masterKEY,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
// console.log('res', res.data.result);
|
// console.log('res', res.data.result);
|
||||||
if (res.data?.result?.status !== 'success') {
|
if (res.data?.result?.status !== 'success') {
|
||||||
unlinkFile(`./exports/signed_certificate_${doc.objectId}.pdf`);
|
unlinkFile(`./exports/signed_certificate_${doc.objectId}.pdf`);
|
||||||
@@ -298,13 +290,7 @@ async function sendMailsaveCertifcate(doc, pfx, isCustomMail, mailProvider, file
|
|||||||
fs.writeFileSync(certificatePath, signedCertificate);
|
fs.writeFileSync(certificatePath, signedCertificate);
|
||||||
const file = await uploadFile('certificate.pdf', certificatePath);
|
const file = await uploadFile('certificate.pdf', certificatePath);
|
||||||
const body = { CertificateUrl: file.imageUrl };
|
const body = { CertificateUrl: file.imageUrl };
|
||||||
await axios.put(serverUrl + '/classes/contracts_Document/' + doc.objectId, body, {
|
await axios.put(`${docUrl}/${doc.objectId}`, body, { headers });
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'X-Parse-Application-Id': APPID,
|
|
||||||
'X-Parse-Master-Key': masterKEY,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
// used in API only
|
// used in API only
|
||||||
if (doc.IsSendMail === false) {
|
if (doc.IsSendMail === false) {
|
||||||
console.log("don't send mail");
|
console.log("don't send mail");
|
||||||
@@ -313,6 +299,41 @@ async function sendMailsaveCertifcate(doc, pfx, isCustomMail, mailProvider, file
|
|||||||
}
|
}
|
||||||
saveFileUsage(CertificateBuffer.length, file.imageUrl, doc?.CreatedBy?.objectId);
|
saveFileUsage(CertificateBuffer.length, file.imageUrl, doc?.CreatedBy?.objectId);
|
||||||
unlinkFile(pfx.name);
|
unlinkFile(pfx.name);
|
||||||
|
return file.imageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process a PDF for signing:
|
||||||
|
* - updates audit trail, generates certificate.
|
||||||
|
* - Optionally inserts a signature placeholder (Placeholder()).
|
||||||
|
* - Otherwise (no merge + no placeholder), it flattens forms for finalization.
|
||||||
|
*
|
||||||
|
* @param {Object} _resDoc - Document details (expects AuditTrail, etc.)
|
||||||
|
* @param {Buffer|Uint8Array} pdfBytes - Original PDF bytes
|
||||||
|
* @param {string} [options.reason] - Reason text used in placeholder
|
||||||
|
* @param {string} [options.UserPtr] - user pointer (for audit trail)
|
||||||
|
* @param {string} [options.ipAddress] - IP (for audit trail)
|
||||||
|
* @param {string} [options.Signature] - Signature (for audit trail)
|
||||||
|
* @returns {Promise<Buffer>} merged PDF Buffer
|
||||||
|
*/
|
||||||
|
async function processPdf(_resDoc, PdfBuffer, reason) {
|
||||||
|
// No CC merge; operate directly on the original PDF
|
||||||
|
const pdfDoc = await PDFDocument.load(PdfBuffer);
|
||||||
|
const form = pdfDoc.getForm();
|
||||||
|
// Updates the field appearances to ensure visual changes are reflected.
|
||||||
|
form.updateFieldAppearances();
|
||||||
|
// Flattens the form, converting all form fields into non-editable, static content
|
||||||
|
form.flatten();
|
||||||
|
Placeholder({
|
||||||
|
pdfDoc: pdfDoc,
|
||||||
|
reason: `Digitally signed by ${eSignName} for ${reason}`,
|
||||||
|
location: 'n/a',
|
||||||
|
name: eSignName,
|
||||||
|
contactInfo: eSigncontact,
|
||||||
|
signatureLength: 16000,
|
||||||
|
});
|
||||||
|
const pdfWithPlaceholderBytes = await pdfDoc.save();
|
||||||
|
return Buffer.from(pdfWithPlaceholderBytes);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -333,7 +354,7 @@ async function PDF(req) {
|
|||||||
const publicUrl = req.headers.public_url;
|
const publicUrl = req.headers.public_url;
|
||||||
// below bode is used to get info of docId
|
// below bode is used to get info of docId
|
||||||
const docQuery = new Parse.Query('contracts_Document');
|
const docQuery = new Parse.Query('contracts_Document');
|
||||||
docQuery.include('ExtUserPtr,Signers,ExtUserPtr.TenantId,Bcc');
|
docQuery.include('ExtUserPtr,Signers,ExtUserPtr.TenantId,Bcc,CreatedBy');
|
||||||
docQuery.equalTo('objectId', docId);
|
docQuery.equalTo('objectId', docId);
|
||||||
const resDoc = await docQuery.first({ useMasterKey: true });
|
const resDoc = await docQuery.first({ useMasterKey: true });
|
||||||
if (!resDoc) {
|
if (!resDoc) {
|
||||||
@@ -389,7 +410,11 @@ async function PDF(req) {
|
|||||||
const auditTrail = updateAuditTrail.filter(x => x.Activity === 'Signed');
|
const auditTrail = updateAuditTrail.filter(x => x.Activity === 'Signed');
|
||||||
let isCompleted = false;
|
let isCompleted = false;
|
||||||
if (_resDoc.Signers && _resDoc.Signers.length > 0) {
|
if (_resDoc.Signers && _resDoc.Signers.length > 0) {
|
||||||
if (auditTrail.length === _resDoc.Signers.length) {
|
const removePrefill =
|
||||||
|
_resDoc?.Placeholders?.length > 0 &&
|
||||||
|
_resDoc?.Placeholders?.filter(x => x?.Role !== 'prefill');
|
||||||
|
if (auditTrail.length === removePrefill?.length) {
|
||||||
|
// if (auditTrail.length === _resDoc.Signers.length) {
|
||||||
isCompleted = true;
|
isCompleted = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -408,24 +433,9 @@ async function PDF(req) {
|
|||||||
signersName && signersName.length > 0
|
signersName && signersName.length > 0
|
||||||
? signersName?.join(', ')
|
? signersName?.join(', ')
|
||||||
: username + ' <' + userEmail + '>';
|
: username + ' <' + userEmail + '>';
|
||||||
const pdfDoc = await PDFDocument.load(PdfBuffer);
|
|
||||||
const form = pdfDoc.getForm();
|
|
||||||
// Updates the field appearances to ensure visual changes are reflected.
|
|
||||||
form.updateFieldAppearances();
|
|
||||||
// Flattens the form, converting all form fields into non-editable, static content
|
|
||||||
form.flatten();
|
|
||||||
const p12Cert = new P12Signer(P12Buffer, { passphrase: passphrase || null });
|
const p12Cert = new P12Signer(P12Buffer, { passphrase: passphrase || null });
|
||||||
signedFilePath = `./exports/signed_${name}`;
|
signedFilePath = `./exports/signed_${name}`;
|
||||||
Placeholder({
|
PdfBuffer = await processPdf(_resDoc, PdfBuffer, reason, UserPtr, userIP, sign);
|
||||||
pdfDoc: pdfDoc,
|
|
||||||
reason: `Digitally signed by ${eSignName} for ${reason}`,
|
|
||||||
location: 'n/a',
|
|
||||||
name: eSignName,
|
|
||||||
contactInfo: eSigncontact,
|
|
||||||
signatureLength: 16000,
|
|
||||||
});
|
|
||||||
const pdfWithPlaceholderBytes = await pdfDoc.save();
|
|
||||||
PdfBuffer = Buffer.from(pdfWithPlaceholderBytes);
|
|
||||||
//`new signPDF` create new instance of pdfBuffer and p12Buffer
|
//`new signPDF` create new instance of pdfBuffer and p12Buffer
|
||||||
const OBJ = new SignPdf();
|
const OBJ = new SignPdf();
|
||||||
// `signedDocs` is used to signpdf digitally
|
// `signedDocs` is used to signpdf digitally
|
||||||
@@ -484,9 +494,7 @@ async function PDF(req) {
|
|||||||
console.log('Err in signpdf', err);
|
console.log('Err in signpdf', err);
|
||||||
const body = { DebugginLog: err?.message };
|
const body = { DebugginLog: err?.message };
|
||||||
try {
|
try {
|
||||||
await axios.put(serverUrl + '/classes/contracts_Document/' + docId, body, {
|
await axios.put(`${docUrl}/${docId}`, body, { headers });
|
||||||
headers: { 'X-Parse-Application-Id': APPID, 'X-Parse-Master-Key': masterKEY },
|
|
||||||
});
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('err in saving debugginglog', err);
|
console.log('err in saving debugginglog', err);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ export default function reportJson(id, currentUserId) {
|
|||||||
'RequestSubject',
|
'RequestSubject',
|
||||||
'ExtUserPtr.TenantId.RequestBody',
|
'ExtUserPtr.TenantId.RequestBody',
|
||||||
'ExtUserPtr.TenantId.RequestSubject',
|
'ExtUserPtr.TenantId.RequestSubject',
|
||||||
|
'DocSentAt',
|
||||||
];
|
];
|
||||||
const filterKeys = [
|
const filterKeys = [
|
||||||
'TimeToCompleteDays',
|
'TimeToCompleteDays',
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
export default async function resetPassword(request) {
|
||||||
|
const userId = request.params.userId;
|
||||||
|
const newPassword = request.params.password;
|
||||||
|
|
||||||
|
if (!userId || !newPassword) {
|
||||||
|
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Please provide required parameters.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!request.user) {
|
||||||
|
throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, 'User is not authenticated.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (request.user.id === userId) {
|
||||||
|
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Unauthorized to reset your own password.');
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 1. Get Admin User TenantId
|
||||||
|
const adminUserQuery = new Parse.Query('contracts_Users');
|
||||||
|
adminUserQuery.equalTo('UserId', request.user);
|
||||||
|
const adminUser = await adminUserQuery.first({ useMasterKey: true });
|
||||||
|
|
||||||
|
const tenantId = adminUser?.get('TenantId');
|
||||||
|
if (!tenantId) {
|
||||||
|
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Admin user tenant not found.');
|
||||||
|
}
|
||||||
|
const isAdmin =
|
||||||
|
adminUser.get('UserRole') === 'contracts_Admin' ||
|
||||||
|
adminUser.get('UserRole') === 'contracts_OrgAdmin';
|
||||||
|
if (!isAdmin) {
|
||||||
|
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Unauthorized.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Verify the user belongs to the same tenant and is not an admin
|
||||||
|
const targetUserQuery = new Parse.Query('contracts_Users');
|
||||||
|
targetUserQuery.equalTo('UserId', { __type: 'Pointer', className: '_User', objectId: userId });
|
||||||
|
targetUserQuery.equalTo('TenantId', tenantId);
|
||||||
|
targetUserQuery.notEqualTo('UserRole', 'contracts_Admin');
|
||||||
|
const targetUser = await targetUserQuery.first({ useMasterKey: true });
|
||||||
|
|
||||||
|
if (!targetUser) {
|
||||||
|
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'User not found or not allowed.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Update user's password
|
||||||
|
const userQuery = new Parse.Query(Parse.User);
|
||||||
|
userQuery.equalTo('objectId', userId);
|
||||||
|
const user = await userQuery.first({ useMasterKey: true });
|
||||||
|
|
||||||
|
if (!user) {
|
||||||
|
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'User not found.');
|
||||||
|
}
|
||||||
|
|
||||||
|
user.set('password', newPassword);
|
||||||
|
await user.save(null, { useMasterKey: true });
|
||||||
|
|
||||||
|
return { status: 'success', message: 'Password has been reset.' };
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error while resetting password:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
import { flattenPdf, getSecureUrl } from '../../Utils.js';
|
import { flattenPdf, getSecureUrl } from '../../Utils.js';
|
||||||
|
import { parseUploadFile } from '../../utils/fileUtils.js';
|
||||||
|
|
||||||
export default async function saveFile(request) {
|
export default async function saveFile(request) {
|
||||||
if (!request.params.fileBase64) {
|
if (!request.params.fileBase64) {
|
||||||
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Please provide file.');
|
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Please provide file.');
|
||||||
@@ -10,6 +12,7 @@ export default async function saveFile(request) {
|
|||||||
const extCls = new Parse.Query('contracts_Users');
|
const extCls = new Parse.Query('contracts_Users');
|
||||||
extCls.equalTo('UserId', request.user);
|
extCls.equalTo('UserId', request.user);
|
||||||
extCls.include('TenantId');
|
extCls.include('TenantId');
|
||||||
|
extCls.include('UserId');
|
||||||
const resExt = await extCls.first({ useMasterKey: true });
|
const resExt = await extCls.first({ useMasterKey: true });
|
||||||
if (resExt) {
|
if (resExt) {
|
||||||
const _resExt = JSON.parse(JSON.stringify(resExt));
|
const _resExt = JSON.parse(JSON.stringify(resExt));
|
||||||
@@ -20,17 +23,26 @@ export default async function saveFile(request) {
|
|||||||
if (ext === 'pdf') {
|
if (ext === 'pdf') {
|
||||||
mimeType = 'application/pdf';
|
mimeType = 'application/pdf';
|
||||||
const flatPdf = await flattenPdf(fileBase64);
|
const flatPdf = await flattenPdf(fileBase64);
|
||||||
file = [...flatPdf];
|
// file = [...flatPdf];
|
||||||
|
file = flatPdf;
|
||||||
} else if (ext === 'png' || ext === 'jpeg' || ext === 'jpg') {
|
} else if (ext === 'png' || ext === 'jpeg' || ext === 'jpg') {
|
||||||
mimeType = `image/${ext}`;
|
mimeType = `image/${ext}`;
|
||||||
file = { base64: fileBase64 };
|
// file = { base64: fileBase64 };
|
||||||
|
file = Buffer.from(fileBase64, 'base64');
|
||||||
|
}
|
||||||
|
// const pdfFile = new Parse.File(fileName, file, mimeType);
|
||||||
|
// // Save the Parse File if needed
|
||||||
|
// const pdfData = await pdfFile.save({ useMasterKey: true });
|
||||||
|
// const presignedUrl = pdfData.url();
|
||||||
|
// const fileRes = getSecureUrl(presignedUrl);
|
||||||
|
// return { url: fileRes.url };
|
||||||
|
try {
|
||||||
|
const fileRes = await parseUploadFile(fileName, file, mimeType);
|
||||||
|
fileUrl = getSecureUrl(fileRes?.url)?.url;
|
||||||
|
return { url: fileUrl };
|
||||||
|
} catch (err) {
|
||||||
|
throw new Parse.Error(400, err?.message);
|
||||||
}
|
}
|
||||||
const pdfFile = new Parse.File(fileName, file, mimeType);
|
|
||||||
// Save the Parse File if needed
|
|
||||||
const pdfData = await pdfFile.save({ useMasterKey: true });
|
|
||||||
const presignedUrl = pdfData.url();
|
|
||||||
const fileRes = getSecureUrl(presignedUrl);
|
|
||||||
return { url: fileRes.url };
|
|
||||||
} else {
|
} else {
|
||||||
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'User not found.');
|
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'User not found.');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ export const config = {
|
|||||||
appId: serverAppId,
|
appId: serverAppId,
|
||||||
logLevel: ['error'],
|
logLevel: ['error'],
|
||||||
maxLimit: 500,
|
maxLimit: 500,
|
||||||
maxUploadSize: '30mb',
|
maxUploadSize: '100mb',
|
||||||
masterKey: process.env.MASTER_KEY, //Add your master key here. Keep it secret!
|
masterKey: process.env.MASTER_KEY, //Add your master key here. Keep it secret!
|
||||||
masterKeyIps: ['0.0.0.0/0', '::/0'], // '::1'
|
masterKeyIps: ['0.0.0.0/0', '::/0'], // '::1'
|
||||||
serverURL: cloudServerUrl, // Don't forget to change to https if needed
|
serverURL: cloudServerUrl, // Don't forget to change to https if needed
|
||||||
@@ -156,8 +156,8 @@ export const config = {
|
|||||||
|
|
||||||
export const app = express();
|
export const app = express();
|
||||||
app.use(cors());
|
app.use(cors());
|
||||||
app.use(express.json({ limit: '50mb' }));
|
app.use(express.json({ limit: '100mb' }));
|
||||||
app.use(express.urlencoded({ limit: '50mb', extended: true }));
|
app.use(express.urlencoded({ limit: '100mb', extended: true }));
|
||||||
app.use(function (req, res, next) {
|
app.use(function (req, res, next) {
|
||||||
req.headers['x-real-ip'] = getUserIP(req);
|
req.headers['x-real-ip'] = getUserIP(req);
|
||||||
const publicUrl = 'https://' + req?.get('host');
|
const publicUrl = 'https://' + req?.get('host');
|
||||||
|
|||||||
Generated
+2765
-2704
File diff suppressed because it is too large
Load Diff
@@ -18,8 +18,8 @@
|
|||||||
"watch": "nodemon index.js"
|
"watch": "nodemon index.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-s3": "^3.879.0",
|
"@aws-sdk/client-s3": "^3.896.0",
|
||||||
"@aws-sdk/s3-request-presigner": "^3.879.0",
|
"@aws-sdk/s3-request-presigner": "^3.896.0",
|
||||||
"@parse/fs-files-adapter": "^3.0.0",
|
"@parse/fs-files-adapter": "^3.0.0",
|
||||||
"@parse/s3-files-adapter": "^4.2.0",
|
"@parse/s3-files-adapter": "^4.2.0",
|
||||||
"@pdf-lib/fontkit": "^1.1.1",
|
"@pdf-lib/fontkit": "^1.1.1",
|
||||||
@@ -27,18 +27,18 @@
|
|||||||
"@signpdf/signer-p12": "^3.2.4",
|
"@signpdf/signer-p12": "^3.2.4",
|
||||||
"@signpdf/signpdf": "^3.2.5",
|
"@signpdf/signpdf": "^3.2.5",
|
||||||
"aws-sdk": "^2.1692.0",
|
"aws-sdk": "^2.1692.0",
|
||||||
"axios": "^1.11.0",
|
"axios": "^1.12.2",
|
||||||
"coherentpdf": "^2.5.5",
|
"coherentpdf": "^2.5.5",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"date-fns-tz": "^3.2.0",
|
"date-fns-tz": "^3.2.0",
|
||||||
"dotenv": "^17.2.1",
|
"dotenv": "^17.2.2",
|
||||||
"express": "^5.1.0",
|
"express": "^5.1.0",
|
||||||
"form-data": "^4.0.4",
|
"form-data": "^4.0.4",
|
||||||
"generate-api-key": "^1.0.2",
|
"generate-api-key": "^1.0.2",
|
||||||
"googleapis": "^159.0.0",
|
"googleapis": "^159.0.0",
|
||||||
"libreoffice-convert": "^1.6.1",
|
"libreoffice-convert": "^1.7.0",
|
||||||
"mailgun.js": "^12.0.3",
|
"mailgun.js": "^12.1.0",
|
||||||
"mongodb": "^6.19.0",
|
"mongodb": "^6.20.0",
|
||||||
"multer": "^2.0.2",
|
"multer": "^2.0.2",
|
||||||
"multer-s3": "^3.0.1",
|
"multer-s3": "^3.0.1",
|
||||||
"node-forge": "^1.3.1",
|
"node-forge": "^1.3.1",
|
||||||
@@ -49,19 +49,19 @@
|
|||||||
"parse-server": "^8.2.4",
|
"parse-server": "^8.2.4",
|
||||||
"parse-server-api-mail-adapter": "^4.1.0",
|
"parse-server-api-mail-adapter": "^4.1.0",
|
||||||
"pdf-lib": "^1.17.1",
|
"pdf-lib": "^1.17.1",
|
||||||
"posthog-node": "^5.8.1",
|
"posthog-node": "^5.9.1",
|
||||||
"qrcode": "^1.5.4",
|
"qrcode": "^1.5.4",
|
||||||
"rate-limiter-flexible": "^7.2.0",
|
"rate-limiter-flexible": "^7.4.0",
|
||||||
"sharp": "^0.34.3",
|
"sharp": "^0.34.4",
|
||||||
"speakeasy": "^2.0.0",
|
"speakeasy": "^2.0.0",
|
||||||
"ws": "^8.18.3"
|
"ws": "^8.18.3"
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/eslint-parser": "^7.28.0",
|
"@babel/eslint-parser": "^7.28.4",
|
||||||
"eslint": "^9.34.0",
|
"eslint": "^9.36.0",
|
||||||
"jasmine": "^5.10.0",
|
"jasmine": "^5.11.0",
|
||||||
"mongodb-runner": "^5.9.2",
|
"mongodb-runner": "^5.10.0",
|
||||||
"nodemon": "^3.1.10",
|
"nodemon": "^3.1.10",
|
||||||
"nyc": "^17.1.0",
|
"nyc": "^17.1.0",
|
||||||
"prettier": "^3.6.2"
|
"prettier": "^3.6.2"
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
import axios from 'axios';
|
||||||
|
import { cloudServerUrl, serverAppId } from '../Utils.js';
|
||||||
|
|
||||||
function formatFixedDate(date = new Date()) {
|
function formatFixedDate(date = new Date()) {
|
||||||
const dd = String(date.getDate()).padStart(2, '0');
|
const dd = String(date.getDate()).padStart(2, '0');
|
||||||
const months = [
|
const months = [
|
||||||
@@ -75,3 +78,23 @@ export function buildDownloadFilename(formatId, ctx) {
|
|||||||
const safeExt = ext.replace(/\.+/g, '').toLowerCase() || 'pdf';
|
const safeExt = ext.replace(/\.+/g, '').toLowerCase() || 'pdf';
|
||||||
return `${stem}.${safeExt}`;
|
return `${stem}.${safeExt}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function parseUploadFile(fileName, fileData, mimeType) {
|
||||||
|
try {
|
||||||
|
const res = await axios.post(`${cloudServerUrl}/files/${fileName}`, fileData, {
|
||||||
|
headers: {
|
||||||
|
'X-Parse-Application-Id': serverAppId,
|
||||||
|
'X-Parse-Master-Key': process.env.MASTER_KEY,
|
||||||
|
'Content-Type': mimeType,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// console.log('File uploaded:', res.data);
|
||||||
|
return res.data;
|
||||||
|
} catch (err) {
|
||||||
|
const errorMessage = err?.response?.data?.error || 'Unknown error';
|
||||||
|
const statusCode = err?.response?.status || 500;
|
||||||
|
console.log('Err in parseUploadFile', errorMessage);
|
||||||
|
throw { message: errorMessage, code: statusCode };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user