From d4c0051cd95d7c1fa3ebb6c46e6a93aead85cb1b Mon Sep 17 00:00:00 2001 From: nxglabs Date: Thu, 29 May 2025 19:04:16 +0000 Subject: [PATCH] Merge pull request #695 from OpenSignLabs/login_to_sandbox refactor: handle conditions of sandbox --- apps/OpenSign/Dockerfile | 25 ---- apps/OpenSign/Dockerhubfile | 9 ++ apps/OpenSign/entrypoint.sh | 29 +++++ .../public/locales/de/translation.json | 3 +- .../public/locales/en/translation.json | 3 +- .../public/locales/es/translation.json | 3 +- .../public/locales/fr/translation.json | 3 +- .../public/locales/it/translation.json | 3 +- apps/OpenSign/src/App.jsx | 10 +- .../components/pdf/DropdownWidgetOption.jsx | 4 +- .../src/components/pdf/EditTemplate.jsx | 2 +- .../src/components/pdf/PlaceholderType.jsx | 115 ++++++++--------- .../src/components/pdf/WidgetsValueModal.jsx | 119 ++++++++---------- .../shared/fields/SelectSigners.jsx | 24 +++- apps/OpenSign/src/constant/Utils.jsx | 68 ++++++---- apps/OpenSign/src/constant/appinfo.js | 9 +- apps/OpenSign/src/json/menuJson.js | 21 ++-- apps/OpenSign/src/pages/Login.jsx | 47 +++---- apps/OpenSign/src/pages/PdfRequestFiles.jsx | 8 +- apps/OpenSign/src/pages/PlaceHolderSign.jsx | 6 +- apps/OpenSign/src/pages/SignyourselfPdf.jsx | 2 +- .../src/pages/TemplatePlaceholder.jsx | 23 +--- .../src/primitives/GetReportDisplay.jsx | 6 +- .../OpenSign/src/primitives/LinkUserModal.jsx | 4 +- apps/OpenSignServer/Dockerfile | 27 ---- apps/OpenSignServer/Utils.js | 2 +- .../cloud/parsefunction/Newsletter.js | 4 +- .../cloud/parsefunction/createBatchDocs.js | 6 +- .../cloud/parsefunction/pdf/PDF.js | 2 +- apps/OpenSignServer/index.js | 2 +- apps/OpenSignServer/package-lock.json | 4 +- 31 files changed, 302 insertions(+), 291 deletions(-) delete mode 100644 apps/OpenSign/Dockerfile create mode 100644 apps/OpenSign/entrypoint.sh delete mode 100644 apps/OpenSignServer/Dockerfile diff --git a/apps/OpenSign/Dockerfile b/apps/OpenSign/Dockerfile deleted file mode 100644 index e916c2679..000000000 --- a/apps/OpenSign/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -# Use an official Node runtime as the base image -FROM node:18 - -# Set the working directory inside the container -WORKDIR /usr/src/app - -# Copy package.json and package-lock.json first to leverage Docker cache -COPY ./package*.json ./ - -# Install application dependencies -RUN npm install - -# Copy the current directory contents into the container -COPY ./ . -COPY ./.husky . - -# Make port 3000 available to the world outside this container -EXPOSE 3000 - -# Define environment variables if needed -# ENV NODE_ENV production - -# Run the application -ENTRYPOINT npm run start - diff --git a/apps/OpenSign/Dockerhubfile b/apps/OpenSign/Dockerhubfile index 395bad9d6..6f2d22e29 100644 --- a/apps/OpenSign/Dockerhubfile +++ b/apps/OpenSign/Dockerhubfile @@ -13,6 +13,10 @@ RUN npm install # Copy the current directory contents into the container COPY apps/OpenSign/ . COPY apps/OpenSign/.husky . +COPY apps/OpenSign/entrypoint.sh . + +# make the entrypoint.sh file executable +RUN chmod +x entrypoint.sh # Define environment variables if needed ENV NODE_ENV=production @@ -20,8 +24,13 @@ ENV GENERATE_SOURCEMAP=false # build RUN npm run build +# Inject env.js loader into index.html +RUN sed -i '//a\' build/index.html + # Make port 3000 available to the world outside this container EXPOSE 3000 +ENTRYPOINT ["./entrypoint.sh"] + # Run the application CMD ["npm", "start"] diff --git a/apps/OpenSign/entrypoint.sh b/apps/OpenSign/entrypoint.sh new file mode 100644 index 000000000..91553527a --- /dev/null +++ b/apps/OpenSign/entrypoint.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +ENV_FILE=./build/env.js +DOTENV_FILE=./.env.prod # ✅ use .env.prod + +echo "Generating runtime env file at $ENV_FILE..." + +echo "window.RUNTIME_ENV = {" > $ENV_FILE + +# List of keys to include +RUNTIME_KEYS="REACT_APP_SERVERURL" + +for key in $RUNTIME_KEYS; do + # First check docker env (-e), fallback to .env file + value=$(printenv "$key") + + if [ -z "$value" ] && [ -f "$DOTENV_FILE" ]; then + # fallback: read from .env + value=$(grep "^$key=" "$DOTENV_FILE" | cut -d '=' -f2- | tr -d '\r\n' | sed 's/"/\\"/g') + else + value=$(echo "$value" | sed 's/"/\\"/g') + fi + + echo " $key: \"$value\"," >> $ENV_FILE +done + +echo "};" >> $ENV_FILE + +exec "$@" diff --git a/apps/OpenSign/public/locales/de/translation.json b/apps/OpenSign/public/locales/de/translation.json index 39bfb31e8..1e1f5b794 100644 --- a/apps/OpenSign/public/locales/de/translation.json +++ b/apps/OpenSign/public/locales/de/translation.json @@ -1,6 +1,7 @@ { "header-news": "Neue Funktion: Benutzer des Teams-Plans können jetzt ihre eigenen AWS S3-Buckets für die Dateispeicherung integrieren", "header-news-btn": "Jetzt einrichten", + "sandbox-news": "Dies ist eine Sandbox-Umgebung. Bitte nicht für produktive Zwecke verwenden.", "create-account": "Konto erstellen", "login": "Anmelden", "language": "Sprache", @@ -675,7 +676,7 @@ "public-template-mssg-1": "Um OpenSign in Ihr React- oder Next.js-Projekt zu integrieren, führen Sie einfach den folgenden Befehl aus:", "public-template-mssg-2": "Stellen Sie sicher, dass npm oder yarn in Ihrem Projekt eingerichtet ist. Wenn Sie Yarn verwenden, können Sie npm install durch yarn add @opensign/react ersetzen.", "public-template-mssg-3": "Benötigen Sie weitere Details oder Beispiele?", - "public-template-mssg-4": "Besuchen Sie die", + "public-template-mssg-4": "Besuchen Sie die ", "public-template-mssg-5": " npm für die neuesten Updates, detaillierte Dokumentationen und Versionshistorie.", "public-template-mssg-6": "Bevor Sie diesen Code-Schnipsel verwenden können, müssen Sie diese Vorlage öffentlich machen.", "public-template-mssg-7": "Bevor Sie einen öffentlichen Link generieren können, müssen Sie diese Vorlage öffentlich machen.", diff --git a/apps/OpenSign/public/locales/en/translation.json b/apps/OpenSign/public/locales/en/translation.json index 1f493bf0b..9b5653c6a 100644 --- a/apps/OpenSign/public/locales/en/translation.json +++ b/apps/OpenSign/public/locales/en/translation.json @@ -1,6 +1,7 @@ { "header-news": "New feature: Protect your account with Two-Factor Authentication (2FA) and enjoy the future of login with Passkeys — no passwords needed.", "header-news-btn": "Setup now", + "sandbox-news": "This is a sandbox environment. Please do not use it for production purposes.", "create-account": "Create account", "login": "Login", "language": "Language", @@ -675,7 +676,7 @@ "public-template-mssg-1": "To integrate OpenSign into your React or Next.js project, simply run the following command:", "public-template-mssg-2": "Ensure you have npm or yarn set up in your project. If you're using Yarn, you can replace npm install with yarn add @opensign/react.", "public-template-mssg-3": "Need more details or examples?", - "public-template-mssg-4": "Visit the", + "public-template-mssg-4": "Visit the ", "public-template-mssg-5": " npm for the latest updates, detailed documentation, and version history.", "public-template-mssg-6": "Before you can use this code snippet, you must make this template public.", "public-template-mssg-7": "Before you can generate a public link you must make this template public.", diff --git a/apps/OpenSign/public/locales/es/translation.json b/apps/OpenSign/public/locales/es/translation.json index e224ef784..2759690ce 100644 --- a/apps/OpenSign/public/locales/es/translation.json +++ b/apps/OpenSign/public/locales/es/translation.json @@ -1,6 +1,7 @@ { "header-news": "Nueva característica: los usuarios del plan Teams ahora pueden integrar sus propios depósitos de AWS S3 para el almacenamiento de archivos", "header-news-btn": "Configurar ahora", + "sandbox-news": "Este es un entorno sandbox. Por favor, no lo utilice con fines de producción.", "create-account": "Crear cuenta", "login": "Iniciar sesión", "language": "Idioma", @@ -675,7 +676,7 @@ "public-template-mssg-1": "Para integrar OpenSign a tu proyecto React o Next.js, simplemente ejecuta los siguientes comandos:", "public-template-mssg-2": "Asegúrate de tener «npm» o «yarn» configurado en tu proyecto. Si estás usando «yarn», puedes reemplazar «npm install» con «yarn add @opensign/react».", "public-template-mssg-3": "¿Necesitas más detalles o ejemplos?", - "public-template-mssg-4": "Visita la", + "public-template-mssg-4": "Visita la ", "public-template-mssg-5": " «npm» para las últimas actualizaciones, documentación detallada e historial de versiones.", "public-template-mssg-6": "Antes de que puedas usar este fragmento de código, debes convertir esta plantilla en pública.", "public-template-mssg-7": "Antes de poder generar un enlace público, debes hacer que esta plantilla sea pública.", diff --git a/apps/OpenSign/public/locales/fr/translation.json b/apps/OpenSign/public/locales/fr/translation.json index a2ae43c17..354afb26b 100644 --- a/apps/OpenSign/public/locales/fr/translation.json +++ b/apps/OpenSign/public/locales/fr/translation.json @@ -1,6 +1,7 @@ { "header-news": "Nouvelle fonctionnalité : les utilisateurs du forfait Teams peuvent désormais intégrer leurs propres compartiments AWS S3 pour le stockage de fichiers", "header-news-btn": "Configurer maintenant", + "sandbox-news": "Ceci est un environnement sandbox. Veuillez ne pas l'utiliser à des fins de production.", "create-account": "Créer un compte", "login": "Se Connecter", "language": "Langue", @@ -675,7 +676,7 @@ "public-template-mssg-1": "Pour intégrer OpenSign dans votre projet React ou Next.js, exécutez simplement la commande suivante :", "public-template-mssg-2": "Assurez-vous que npm ou Yarn est configuré dans votre projet. Si vous utilisez Yarn, vous pouvez remplacer npm install par Yarn Add @opensign/react.", "public-template-mssg-3": "Besoin de plus de détails ou d'exemples ?", - "public-template-mssg-4": "Visitez le", + "public-template-mssg-4": "Visitez le ", "public-template-mssg-5": "npm pour les dernières mises à jour, une documentation détaillée et l'historique des versions.", "public-template-mssg-6": "Avant de pouvoir utiliser cet extrait de code, vous devez rendre ce modèle public.", "public-template-mssg-7": "Avant de pouvoir générer un lien public, vous devez rendre ce modèle public.", diff --git a/apps/OpenSign/public/locales/it/translation.json b/apps/OpenSign/public/locales/it/translation.json index bb44b7f33..c243af05a 100644 --- a/apps/OpenSign/public/locales/it/translation.json +++ b/apps/OpenSign/public/locales/it/translation.json @@ -1,6 +1,7 @@ { "header-news": "Nuova funzionalità: Gli utenti del piano Teams possono ora integrare i propri bucket AWS S3 per l'archiviazione dei file", "header-news-btn": "Configura Ora", + "sandbox-news": "Questo è un ambiente sandbox. Si prega di non utilizzarlo per scopi di produzione.", "create-account": "Crea Account", "login": "Accedi", "language": "Lingua", @@ -675,7 +676,7 @@ "public-template-mssg-1": "Per integrare OpenSign nel tuo progetto React o Next.js, esegui semplicemente il seguente comando:", "public-template-mssg-2": "Assicurati di avere npm o yarn configurato nel tuo progetto. Se usi Yarn, puoi sostituire npm install con yarn add @opensign/react.", "public-template-mssg-3": "Hai bisogno di maggiori dettagli o esempi?", - "public-template-mssg-4": "Visita il", + "public-template-mssg-4": "Visita il ", "public-template-mssg-5": " npm per gli aggiornamenti più recenti, documentazione dettagliata e cronologia delle versioni.", "public-template-mssg-6": "Prima di poter utilizzare questo frammento di codice, devi rendere questo modello pubblico.", "public-template-mssg-7": "Prima di poter generare un link pubblico, devi rendere questo modello pubblico.", diff --git a/apps/OpenSign/src/App.jsx b/apps/OpenSign/src/App.jsx index d9fe57668..27366832b 100644 --- a/apps/OpenSign/src/App.jsx +++ b/apps/OpenSign/src/App.jsx @@ -106,10 +106,10 @@ function App() { element={} /> } /> - } - /> + } + /> @@ -165,7 +165,7 @@ function App() { path="/recipientSignPdf/:docId" element={} /> - } /> + } /> } diff --git a/apps/OpenSign/src/components/pdf/DropdownWidgetOption.jsx b/apps/OpenSign/src/components/pdf/DropdownWidgetOption.jsx index 927f5b6ec..3b98ead16 100644 --- a/apps/OpenSign/src/components/pdf/DropdownWidgetOption.jsx +++ b/apps/OpenSign/src/components/pdf/DropdownWidgetOption.jsx @@ -22,7 +22,7 @@ function DropdownWidgetOption(props) { const resetState = () => { setDropdownOptionList(["option-1", "option-2"]); - setDropdownName( props.currWidgetsDetails?.options?.name || props.type); + setDropdownName(props.currWidgetsDetails?.options?.name || props.type); setIsReadOnly(false); setIsHideLabel(false); setMinCount(0); @@ -115,7 +115,7 @@ function DropdownWidgetOption(props) { defaultData, isHideLabel ); - resetState() + resetState(); }; diff --git a/apps/OpenSign/src/components/pdf/EditTemplate.jsx b/apps/OpenSign/src/components/pdf/EditTemplate.jsx index 9b74a2570..c9213adc2 100644 --- a/apps/OpenSign/src/components/pdf/EditTemplate.jsx +++ b/apps/OpenSign/src/components/pdf/EditTemplate.jsx @@ -1,4 +1,4 @@ -import React, { +import { useState, useRef, } from "react"; diff --git a/apps/OpenSign/src/components/pdf/PlaceholderType.jsx b/apps/OpenSign/src/components/pdf/PlaceholderType.jsx index 8e62b46a1..8d63cf48d 100644 --- a/apps/OpenSign/src/components/pdf/PlaceholderType.jsx +++ b/apps/OpenSign/src/components/pdf/PlaceholderType.jsx @@ -168,34 +168,34 @@ function PlaceholderType(props) {
{props.pos.options?.values?.map((data, ind) => { return ( -
- - {!props.pos.options?.isHideLabel && ( - - )} +
+
); })} @@ -243,7 +243,6 @@ function PlaceholderType(props) {
); - case "initials": return props.pos.SignUrl ? ( - 0 ? "10px" : "0px" + fontSize: fontSize, + color: fontColor, + marginTop: ind > 0 ? "5px" : "0px" }} - className={`op-radio rounded-full border- border-black appearance-none bg-white inline-block align-middle relative ${ - handleRadioCheck(data) ? "checked-radio" : "" - }`} - type="radio" - disabled={ - props.isNeedSign && - (props.pos.options?.isReadOnly || - props.data?.signerObjId !== props.signerObjId) - } - checked={handleRadioCheck(data)} - /> - {!props.pos.options?.isHideLabel && ( - - )} + className="text-xs mb-0 flex items-center gap-1 " + > + + {!props.pos.options?.isHideLabel && ( + {data} + )} +
); })} diff --git a/apps/OpenSign/src/components/pdf/WidgetsValueModal.jsx b/apps/OpenSign/src/components/pdf/WidgetsValueModal.jsx index 1d804c102..8623c7217 100644 --- a/apps/OpenSign/src/components/pdf/WidgetsValueModal.jsx +++ b/apps/OpenSign/src/components/pdf/WidgetsValueModal.jsx @@ -231,7 +231,9 @@ function WidgetsValueModal(props) { setXyPosition, uniqueId, false, - data?.format + data?.format, + currWidgetsDetails?.options?.fontSize || 12, + currWidgetsDetails?.options?.fontColor || "black" ); setSelectDate({ date: date, format: data?.format }); }; @@ -1327,47 +1329,42 @@ function WidgetsValueModal(props) {
{currWidgetsDetails?.options?.values?.map((data, ind) => { return ( -
- { - if (e.target.checked) { - const maxRequired = - currWidgetsDetails?.options?.validation - ?.maxRequiredCount; - const maxCountInt = - maxRequired && parseInt(maxRequired); - if (maxCountInt > 0) { - if ( - selectedCheckbox && - selectedCheckbox?.length <= maxCountInt - 1 - ) { +
+
); })} @@ -1515,32 +1512,23 @@ function WidgetsValueModal(props) {
{currWidgetsDetails?.options?.values.map((data, ind) => { return ( -
- 0 ? "10px" : "0px" - }} - className={`flex justify-center op-radio`} - type="radio" - value={data} - checked={handleRadioCheck(data)} - onChange={(e) => { - handleCheckRadio(e.target.value); - }} - /> - {!currWidgetsDetails?.options?.isHideLabel && ( - - )} +
+
); })} @@ -1652,7 +1640,7 @@ function WidgetsValueModal(props) { const validateExpression = (regexValidation) => { if (widgetValue && regexValidation) { let regexObject = regexValidation; - if (props.pos?.options?.validation?.type === "regex") { + if (currWidgetsDetails?.options?.validation?.type === "regex") { regexObject = RegexParser(regexValidation); } let isValidate = regexObject.test(widgetValue); @@ -1675,7 +1663,8 @@ function WidgetsValueModal(props) { validateExpression(regexValidation); break; default: - regexValidation = props.pos?.options?.validation?.pattern || ""; + regexValidation = + currWidgetsDetails?.options?.validation?.pattern || ""; validateExpression(regexValidation); break; } diff --git a/apps/OpenSign/src/components/shared/fields/SelectSigners.jsx b/apps/OpenSign/src/components/shared/fields/SelectSigners.jsx index b7733a4d7..c9559a8ac 100644 --- a/apps/OpenSign/src/components/shared/fields/SelectSigners.jsx +++ b/apps/OpenSign/src/components/shared/fields/SelectSigners.jsx @@ -2,9 +2,19 @@ import React, { useEffect, useState } from "react"; import AsyncSelect from "react-select/async"; import { useTranslation } from "react-i18next"; import axios from "axios"; +import { handleUnlinkSigner } from "../../../constant/Utils"; const SelectSigners = (props) => { const { t } = useTranslation(); + const { + signerPos, + setSignerPos, + signersData, + setSignersData, + uniqueId, + isRemove, + handleAddUser + } = props; const [userList, setUserList] = useState([]); const [selected, setSelected] = useState(); const [userData, setUserData] = useState({}); @@ -30,7 +40,7 @@ const SelectSigners = (props) => { //checking if user select no signer option from dropdown if (item) { //checking selected signer is already assign to the document or not - const alreadyAssign = props.signersData.some( + const alreadyAssign = signersData.some( (item2) => item2.objectId === item.value ); if (alreadyAssign) { @@ -49,7 +59,7 @@ const SelectSigners = (props) => { }; const handleAdd = () => { if (userData && userData.objectId) { - props.details(userData); + handleAddUser(userData); if (props.closePopup) { props.closePopup(); } @@ -60,7 +70,13 @@ const SelectSigners = (props) => { }; //function to use remove signer from assigned widgets in create template flow const handleRemove = () => { - props.handleUnlinkSigner(); + handleUnlinkSigner( + signerPos, + setSignerPos, + signersData, + setSignersData, + uniqueId + ); if (props.closePopup) { props.closePopup(); } @@ -161,7 +177,7 @@ const SelectSigners = (props) => { - {props.isExistSigner && props.handleUnlinkSigner && ( + {props.isExistSigner && isRemove && (

This is an automated email from " + appName + ". For any queries regarding this email, please contact the sender " + @@ -3161,3 +3166,22 @@ export const checkRegularExpress = (validateType, setValidatePlaceholder) => { setValidatePlaceholder("please enter value"); } }; + //function to use unlink signer from widgets + export const handleUnlinkSigner = (signerPos,setSignerPos,signersdata,setSignersData,uniqueId) => { + //remove existing signer's details from 'signerPos' array + const updatePlaceHolder = signerPos.map((x) => { + if (x.Id === uniqueId) { + return { ...x, signerPtr: {}, signerObjId: "" }; + } + return { ...x }; + }); + setSignerPos(updatePlaceHolder); + //remove existing signer's details from 'signersdata' array and keep role and id + const updateSigner = signersdata.map((item) => { + if (item.Id == uniqueId) { + return { Role: item.Role, Id: item.Id, blockColor: item.blockColor }; + } + return item; + }); + setSignersData(updateSigner); + }; diff --git a/apps/OpenSign/src/constant/appinfo.js b/apps/OpenSign/src/constant/appinfo.js index a41cff14c..f8e615f5b 100644 --- a/apps/OpenSign/src/constant/appinfo.js +++ b/apps/OpenSign/src/constant/appinfo.js @@ -1,9 +1,12 @@ import logo from "../assets/images/logo.png"; +import { getEnv } from "./Utils"; export function serverUrl_fn() { - let baseUrl = process.env.REACT_APP_SERVERURL - ? process.env.REACT_APP_SERVERURL - : window.location.origin + "/api/app"; + const env = getEnv(); + const serverurl = env?.REACT_APP_SERVERURL + ? env.REACT_APP_SERVERURL // env.REACT_APP_SERVERURL is used for prod + : process.env.REACT_APP_SERVERURL; // process.env.REACT_APP_SERVERURL is used for dev (locally) + let baseUrl = serverurl ? serverurl : window.location.origin + "/api/app"; return baseUrl; } export const appInfo = { diff --git a/apps/OpenSign/src/json/menuJson.js b/apps/OpenSign/src/json/menuJson.js index f6801c6b0..340e11978 100644 --- a/apps/OpenSign/src/json/menuJson.js +++ b/apps/OpenSign/src/json/menuJson.js @@ -1,3 +1,13 @@ +const userssetting = [ + { + icon: "fa-light fa-users fa-fw", + title: "Users", + target: "_self", + pageType: "", + description: "", + objectId: "users" + } +]; export const subSetting = [ { icon: "fa-light fa-sliders", @@ -7,14 +17,7 @@ export const subSetting = [ description: "", objectId: "preferences" }, - { - icon: "fa-light fa-users fa-fw", - title: "Users", - target: "_self", - pageType: "", - description: "", - objectId: "users" - } + ...userssetting ]; const sidebarList = [ @@ -65,7 +68,7 @@ const sidebarList = [ pageType: "report", description: "", objectId: "6TeaPr321t" - }, + } ] }, { diff --git a/apps/OpenSign/src/pages/Login.jsx b/apps/OpenSign/src/pages/Login.jsx index a77af3336..554033ea4 100644 --- a/apps/OpenSign/src/pages/Login.jsx +++ b/apps/OpenSign/src/pages/Login.jsx @@ -68,6 +68,7 @@ function Login() { setState({ ...state, loading: false, alertType: type, alertMsg: msg }); setTimeout(() => setState({ ...state, alertMsg: "" }), 2000); }; + const checkUserExt = async () => { const app = await getAppLogo(); if (app?.error === "invalid_json") { @@ -82,11 +83,11 @@ function Login() { } else { setImage(appInfo?.applogo || undefined); } + dispatch(fetchAppInfo()); if (localStorage.getItem("accesstoken")) { setState({ ...state, loading: true }); GetLoginData(); } - dispatch(fetchAppInfo()); }; const handleChange = (event) => { let { name, value } = event.target; @@ -96,20 +97,15 @@ function Login() { setState({ ...state, [name]: value }); }; - const handleSubmit = async (event) => { - localStorage.removeItem("accesstoken"); - event.preventDefault(); + const handleLogin = async ( + ) => { + const email = state?.email + const password = state?.password - if (!emailRegex.test(state.email)) { - alert("Please enter a valid email address."); - return; - } - - const { email, password } = state; if (!email || !password) { return; } - + localStorage.removeItem("accesstoken"); try { setState({ ...state, loading: true }); localStorage.setItem("appLogo", appInfo.applogo); @@ -132,6 +128,14 @@ function Login() { showToast("danger", "Invalid username/password or region"); } }; + const handleLoginBtn = async (event) => { + event.preventDefault(); + if (!emailRegex.test(state.email)) { + alert("Please enter a valid email address."); + return; + } + await handleLogin(); + }; const setThirdpartyLoader = (value) => { setState({ ...state, thirdpartyLoader: value }); @@ -275,7 +279,6 @@ function Login() { const userInformation = JSON.parse( localStorage.getItem("UserInformation") ); - // console.log("payload ", payload); if (payload && payload.sessionToken) { const params = { userDetails: { @@ -289,7 +292,6 @@ function Login() { } }; const userSignUp = await Parse.Cloud.run("usersignup", params); - // console.log("userSignUp ", userSignUp); if (userSignUp && userSignUp.sessionToken) { const LocalUserDetails = { name: userInformation.name, @@ -430,7 +432,7 @@ function Login() {

-
+

{t("welcome")}

@@ -488,15 +490,14 @@ function Login() { )}
- -
- - {t("forgot-password")} - -
+
+ + {t("forgot-password")} + +
diff --git a/apps/OpenSign/src/pages/PdfRequestFiles.jsx b/apps/OpenSign/src/pages/PdfRequestFiles.jsx index cc257b470..0c6d700cb 100644 --- a/apps/OpenSign/src/pages/PdfRequestFiles.jsx +++ b/apps/OpenSign/src/pages/PdfRequestFiles.jsx @@ -1,4 +1,4 @@ -import React, { useState, useRef, useEffect } from "react"; +import { useState, useRef, useEffect } from "react"; import { PDFDocument } from "pdf-lib"; import "../styles/signature.css"; import Parse from "parse"; @@ -916,7 +916,7 @@ function PdfRequestFiles( const htmlReqBody = "" + replacedRequestBody + - " "; + ""; const variables = { document_title: documentName, @@ -929,7 +929,7 @@ function PdfRequestFiles( receiver_phone: user?.Phone || "", expiry_date: localExpireDate, company_name: orgName, - signing_url: `Sign here` + signing_url: signPdf }; replaceVar = replaceMailVaribles( requestSubject, @@ -944,7 +944,7 @@ function PdfRequestFiles( title: documentName, organization: orgName, localExpireDate: localExpireDate, - sigingUrl: signPdf + signingUrl: signPdf }; let params = { replyto: senderEmail || "", diff --git a/apps/OpenSign/src/pages/PlaceHolderSign.jsx b/apps/OpenSign/src/pages/PlaceHolderSign.jsx index 778540d19..e746b7ec4 100644 --- a/apps/OpenSign/src/pages/PlaceHolderSign.jsx +++ b/apps/OpenSign/src/pages/PlaceHolderSign.jsx @@ -1220,7 +1220,7 @@ function PlaceHolderSign() { receiver_phone: signerMail[i]?.Phone || "", expiry_date: localExpireDate, company_name: orgName, - signing_url: `Sign here` + signing_url: signPdf }; replaceVar = replaceMailVaribles( requestSubject, @@ -1249,7 +1249,7 @@ function PlaceHolderSign() { receiver_phone: signerMail[i]?.Phone || "", expiry_date: localExpireDate, company_name: orgName, - signing_url: `Sign here` + signing_url: signPdf }; replaceVar = replaceMailVaribles(mailSubject, htmlReqBody, variables); } @@ -1260,7 +1260,7 @@ function PlaceHolderSign() { title: documentName, organization: orgName, localExpireDate: localExpireDate, - sigingUrl: signPdf + signingUrl: signPdf }; let params = { extUserId: owner?.objectId, diff --git a/apps/OpenSign/src/pages/SignyourselfPdf.jsx b/apps/OpenSign/src/pages/SignyourselfPdf.jsx index a5b67c162..e1be796d6 100644 --- a/apps/OpenSign/src/pages/SignyourselfPdf.jsx +++ b/apps/OpenSign/src/pages/SignyourselfPdf.jsx @@ -1,4 +1,4 @@ -import React, { useState, useRef, useEffect } from "react"; +import { useState, useRef, useEffect } from "react"; import { PDFDocument } from "pdf-lib"; import "../styles/signature.css"; import Parse from "parse"; diff --git a/apps/OpenSign/src/pages/TemplatePlaceholder.jsx b/apps/OpenSign/src/pages/TemplatePlaceholder.jsx index eef53c378..8f373ea36 100644 --- a/apps/OpenSign/src/pages/TemplatePlaceholder.jsx +++ b/apps/OpenSign/src/pages/TemplatePlaceholder.jsx @@ -1149,25 +1149,6 @@ const TemplatePlaceholder = () => { const handleLinkUser = (id) => { setIsAddUser({ [id]: true }); }; - //function to use unlink signer from widgets - const handleUnlinkSigner = () => { - //remove existing signer's details from 'signerPos' array - const updatePlaceHolder = signerPos.map((x) => { - if (x.Id === uniqueId) { - return { ...x, signerPtr: {}, signerObjId: "" }; - } - return { ...x }; - }); - setSignerPos(updatePlaceHolder); - //remove existing signer's details from 'signersdata' array and keep role and id - const updateSigner = signersdata.map((item) => { - if (item.Id == uniqueId) { - return { Role: item.Role, Id: item.Id, blockColor: item.blockColor }; - } - return item; - }); - setSignersData(updateSigner); - }; // `handleAddUser` is used to adduser const handleAddUser = (data) => { const signerPtr = { @@ -1950,7 +1931,9 @@ const TemplatePlaceholder = () => { closePopup={closePopup} signersData={signersdata} signerPos={signerPos} - handleUnlinkSigner={handleUnlinkSigner} + setSignerPos={setSignerPos} + setSignersData={setSignersData} + isRemove={true} /> )}
diff --git a/apps/OpenSign/src/primitives/GetReportDisplay.jsx b/apps/OpenSign/src/primitives/GetReportDisplay.jsx index 880d3a128..e4f255e3e 100644 --- a/apps/OpenSign/src/primitives/GetReportDisplay.jsx +++ b/apps/OpenSign/src/primitives/GetReportDisplay.jsx @@ -679,7 +679,7 @@ const ReportTable = (props) => { receiver_phone: userDetails?.Phone || "", expiry_date: localExpireDate, company_name: doc.ExtUserPtr.Company, - signing_url: `Sign here` + signing_url: signPdf }; const res = replaceMailVaribles(subject, "", variables); setMail((prev) => ({ ...prev, subject: res.subject })); @@ -710,7 +710,7 @@ const ReportTable = (props) => { receiver_phone: userDetails?.Phone || "", expiry_date: localExpireDate, company_name: doc.ExtUserPtr.Company, - signing_url: `Sign here` + signing_url: signPdf }; const res = replaceMailVaribles("", body, variables); @@ -754,7 +754,7 @@ const ReportTable = (props) => { receiver_phone: user?.signerPtr?.Phone || "", expiry_date: localExpireDate, company_name: doc?.ExtUserPtr?.Company || "", - signing_url: `Sign here` + signing_url: signPdf }; const subject = doc?.RequestSubject || diff --git a/apps/OpenSign/src/primitives/LinkUserModal.jsx b/apps/OpenSign/src/primitives/LinkUserModal.jsx index c42c592f4..c5bcd7152 100644 --- a/apps/OpenSign/src/primitives/LinkUserModal.jsx +++ b/apps/OpenSign/src/primitives/LinkUserModal.jsx @@ -25,12 +25,10 @@ const LinkUserModal = (props) => { handleClose={props.closePopup} > {isContact && ( diff --git a/apps/OpenSignServer/Dockerfile b/apps/OpenSignServer/Dockerfile deleted file mode 100644 index f3fd7513c..000000000 --- a/apps/OpenSignServer/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -# Use an official Node runtime as the base image -FROM node:20 - -# Set the working directory inside the container -WORKDIR /usr/src/app - -# Copy package.json and package-lock.json first to leverage Docker cache -COPY ./package*.json ./ - -# Install application dependencies -RUN npm install - -# If you have native dependencies, you'll need extra tools. Uncomment the following line if needed. -# RUN apk add --no-cache make gcc g++ python3 - -# Copy the current directory contents into the container -COPY ./ . - -# Make port 8080 available to the world outside this container -EXPOSE 8080 - -# Define environment variables if needed -# ENV NODE_ENV production -# ENV DATABASE_URL mongodb://db:27017 - -# Run the application -ENTRYPOINT npm start diff --git a/apps/OpenSignServer/Utils.js b/apps/OpenSignServer/Utils.js index a4c2e8184..b774f0656 100644 --- a/apps/OpenSignServer/Utils.js +++ b/apps/OpenSignServer/Utils.js @@ -252,7 +252,7 @@ export const mailTemplate = param => { "Note" + param.note + "

This is an automated email from " + AppName + '. For any queries regarding this email, please contact the sender ' + diff --git a/apps/OpenSignServer/cloud/parsefunction/Newsletter.js b/apps/OpenSignServer/cloud/parsefunction/Newsletter.js index e26c8d97e..50cf7d9db 100644 --- a/apps/OpenSignServer/cloud/parsefunction/Newsletter.js +++ b/apps/OpenSignServer/cloud/parsefunction/Newsletter.js @@ -4,9 +4,9 @@ export default async function Newsletter(request) { const email = request.params?.email?.toLowerCase()?.replace(/\s/g, ''); const domain = request.params.domain; try { - const envAppId = process.env.REACT_APP_APPID || 'opensign'; + const envAppId = 'opensign'; const headers = { 'Content-Type': 'application/json', 'X-Parse-Application-Id': envAppId }; - const envProdServer = process.env.REACT_APP_SERVERURL || 'https://app.opensignlabs.com/api/app'; + const envProdServer = 'https://app.opensignlabs.com/api/app'; const newsletter = await axios.post( `${envProdServer}/classes/Newsletter`, { Name: name, Email: email, Domain: domain }, diff --git a/apps/OpenSignServer/cloud/parsefunction/createBatchDocs.js b/apps/OpenSignServer/cloud/parsefunction/createBatchDocs.js index 03f6dbcc5..2d4ce5899 100644 --- a/apps/OpenSignServer/cloud/parsefunction/createBatchDocs.js +++ b/apps/OpenSignServer/cloud/parsefunction/createBatchDocs.js @@ -14,7 +14,7 @@ async function deductcount(docsCount, extUserId) { } async function sendMail(document, publicUrl) { //sessionToken - const baseUrl = new URL(publicUrl); //process.env.PUBLIC_URL + const baseUrl = new URL(publicUrl); // console.log("pdfDetails", pdfDetails); const timeToCompleteDays = document?.TimeToCompleteDays || 15; @@ -71,7 +71,7 @@ async function sendMail(document, publicUrl) { receiver_phone: existSigner?.Phone || '', expiry_date: localExpireDate, company_name: orgName, - signing_url: `Sign here`, + signing_url: signPdf, }; replaceVar = replaceMailVaribles(mailSubject, htmlReqBody, variables); } @@ -82,7 +82,7 @@ async function sendMail(document, publicUrl) { title: document.Name, organization: orgName, localExpireDate: localExpireDate, - sigingUrl: signPdf, + signingUrl: signPdf, }; let params = { extUserId: document.ExtUserPtr.objectId, diff --git a/apps/OpenSignServer/cloud/parsefunction/pdf/PDF.js b/apps/OpenSignServer/cloud/parsefunction/pdf/PDF.js index 661452107..63bac492e 100644 --- a/apps/OpenSignServer/cloud/parsefunction/pdf/PDF.js +++ b/apps/OpenSignServer/cloud/parsefunction/pdf/PDF.js @@ -116,7 +116,7 @@ async function sendNotifyMail(doc, signUser, mailProvider, publicUrl) { const creatorEmail = doc.ExtUserPtr.Email; const signerName = signUser.Name; const signerEmail = signUser.Email; - const viewDocUrl = `${publicUrl}/recipientSignPdf/${doc.objectId}`; // ` ${process.env.PUBLIC_URL}/recipientSignPdf/${doc.objectId}`; + const viewDocUrl = `${publicUrl}/recipientSignPdf/${doc.objectId}`; const subject = `Document "${pdfName}" has been signed by ${signerName}`; const body = "

" + diff --git a/apps/OpenSignServer/index.js b/apps/OpenSignServer/index.js index 472e74ec8..209d07d67 100644 --- a/apps/OpenSignServer/index.js +++ b/apps/OpenSignServer/index.js @@ -161,7 +161,7 @@ app.use(express.urlencoded({ limit: '50mb', extended: true })); app.use(function (req, res, next) { req.headers['x-real-ip'] = getUserIP(req); const publicUrl = 'https://' + req?.get('host'); - req.headers['public_url'] = publicUrl; // process.env.PUBLIC_URL + req.headers['public_url'] = publicUrl; next(); }); function getUserIP(request) { diff --git a/apps/OpenSignServer/package-lock.json b/apps/OpenSignServer/package-lock.json index 17e907780..9f4c6f9c8 100644 --- a/apps/OpenSignServer/package-lock.json +++ b/apps/OpenSignServer/package-lock.json @@ -1,12 +1,12 @@ { "name": "open_sign_server", - "version": "1.4.0", + "version": "2.21.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "open_sign_server", - "version": "1.4.0", + "version": "2.21.1", "license": "MIT", "dependencies": { "@aws-sdk/client-s3": "^3.812.0",