diff --git a/apps/OpenSign/package-lock.json b/apps/OpenSign/package-lock.json index fd8283e31..c9de1b9a3 100644 --- a/apps/OpenSign/package-lock.json +++ b/apps/OpenSign/package-lock.json @@ -22,6 +22,7 @@ "radix-ui": "^1.0.1", "react": "^18.2.0", "react-bootstrap": "^2.10.2", + "react-cookie": "^7.1.4", "react-datepicker": "^6.4.0", "react-dnd": "^16.0.1", "react-dnd-html5-backend": "^16.0.1", @@ -6054,6 +6055,11 @@ "@types/node": "*" } }, + "node_modules/@types/cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==" + }, "node_modules/@types/eslint": { "version": "8.44.4", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.4.tgz", @@ -6108,11 +6114,9 @@ } }, "node_modules/@types/hoist-non-react-statics": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.3.tgz", - "integrity": "sha512-Wny3a2UXn5FEA1l7gc6BbpoV5mD1XijZqgkp4TRgDCDL5r3B5ieOFGUX5h3n78Tr1MEG7BfvoM8qeztdvNU0fw==", - "optional": true, - "peer": true, + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.5.tgz", + "integrity": "sha512-SbcrWzkKBw2cdwRTwQAswfpB9g9LJWfjtUeW/jvNwbhC8cpmmNYVePa+ncbUe0rGTQ7G3Ff6mYUN2VMfLVr+Sg==", "dependencies": { "@types/react": "*", "hoist-non-react-statics": "^3.3.0" @@ -19354,6 +19358,19 @@ "react": "^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0" } }, + "node_modules/react-cookie": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/react-cookie/-/react-cookie-7.1.4.tgz", + "integrity": "sha512-wDxxa/HYaSXSMlyWJvJ5uZTzIVtQTPf1gMksFgwAz/2/W3lCtY8r4OChCXMPE7wax0PAdMY97UkNJedGv7KnDw==", + "dependencies": { + "@types/hoist-non-react-statics": "^3.3.5", + "hoist-non-react-statics": "^3.3.2", + "universal-cookie": "^7.0.0" + }, + "peerDependencies": { + "react": ">= 16.3.0" + } + }, "node_modules/react-datepicker": { "version": "6.4.0", "resolved": "https://registry.npmjs.org/react-datepicker/-/react-datepicker-6.4.0.tgz", @@ -22701,6 +22718,23 @@ "node": ">=8" } }, + "node_modules/universal-cookie": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/universal-cookie/-/universal-cookie-7.1.4.tgz", + "integrity": "sha512-Q+DVJsdykStWRMtXr2Pdj3EF98qZHUH/fXv/gwFz/unyToy1Ek1w5GsWt53Pf38tT8Gbcy5QNsj61Xe9TggP4g==", + "dependencies": { + "@types/cookie": "^0.6.0", + "cookie": "^0.6.0" + } + }, + "node_modules/universal-cookie/node_modules/cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/universalify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", diff --git a/apps/OpenSign/package.json b/apps/OpenSign/package.json index c225dc77e..a90a5ea44 100644 --- a/apps/OpenSign/package.json +++ b/apps/OpenSign/package.json @@ -17,6 +17,7 @@ "radix-ui": "^1.0.1", "react": "^18.2.0", "react-bootstrap": "^2.10.2", + "react-cookie": "^7.1.4", "react-datepicker": "^6.4.0", "react-dnd": "^16.0.1", "react-dnd-html5-backend": "^16.0.1", diff --git a/apps/OpenSign/src/components/Header.js b/apps/OpenSign/src/components/Header.js index f1516d6ba..eb8416b6d 100644 --- a/apps/OpenSign/src/components/Header.js +++ b/apps/OpenSign/src/components/Header.js @@ -4,18 +4,20 @@ import FullScreenButton from "./FullScreenButton"; import { useNavigate } from "react-router-dom"; import Parse from "parse"; import { useWindowSize } from "../hook/useWindowSize"; -import { checkIsSubscribed, openInNewTab } from "../constant/Utils"; +import { checkIsSubscribed, getAppLogo, openInNewTab } from "../constant/Utils"; import { isEnableSubscription } from "../constant/const"; const Header = ({ showSidebar }) => { const navigate = useNavigate(); const { width } = useWindowSize(); - let applogo = localStorage.getItem("appLogo") || ""; let username = localStorage.getItem("username"); const image = localStorage.getItem("profileImg") || dp; const [isOpen, setIsOpen] = useState(false); const [isSubscribe, setIsSubscribe] = useState(true); - const [isPro, setIsPro]= useState(false) + const [isPro, setIsPro] = useState(false); + const [applogo, setAppLogo] = useState( + localStorage.getItem("appLogo") || " " + ); const toggleDropdown = () => { setIsOpen(!isOpen); @@ -26,11 +28,18 @@ const Header = ({ showSidebar }) => { }, []); async function checkSubscription() { if (isEnableSubscription) { + const applogo = await getAppLogo(); + if (applogo) { + setAppLogo(applogo); + } else { + setAppLogo(localStorage.getItem("appLogo") || ""); + } const getIsSubscribe = await checkIsSubscribed(); - setIsPro(getIsSubscribe) + setIsPro(getIsSubscribe); setIsSubscribe(getIsSubscribe); } } + const closeDropdown = () => { setIsOpen(false); Parse.User.logOut(); diff --git a/apps/OpenSign/src/components/opensigndrive/DriveBody.js b/apps/OpenSign/src/components/opensigndrive/DriveBody.js index b8c2bdd56..213d3eac4 100644 --- a/apps/OpenSign/src/components/opensigndrive/DriveBody.js +++ b/apps/OpenSign/src/components/opensigndrive/DriveBody.js @@ -70,6 +70,7 @@ function DriveBody(props) { return item; }); props.setPdfData(updatedData); + props.sortingData(null, null, updatedData); await axios .put( `${localStorage.getItem("baseUrl")}classes/${localStorage.getItem( @@ -214,8 +215,8 @@ function DriveBody(props) { ? true : false : selecFolderId - ? false - : true; + ? false + : true; if (!checkExist) { if (moveFolderId) { updateData = { diff --git a/apps/OpenSign/src/components/pdf/Placeholder.js b/apps/OpenSign/src/components/pdf/Placeholder.js index 29ee1eca4..0ecc29a5f 100644 --- a/apps/OpenSign/src/components/pdf/Placeholder.js +++ b/apps/OpenSign/src/components/pdf/Placeholder.js @@ -542,7 +542,15 @@ function Placeholder(props) { data-tut={props.pos.key === props.unSignedWidgetId ? "IsSigned" : ""} key={props.pos.key} lockAspectRatio={ - props.pos.type !== textWidget && + // props.pos.type !== textWidget + ![ + textWidget, + "email", + "name", + "company", + "job title", + textInputWidget + ].includes(props.pos.type) && (props.pos.Width ? props.pos.Width / props.pos.Height : defaultWidthHeight(props.pos.type).width / diff --git a/apps/OpenSign/src/components/pdf/PlaceholderType.js b/apps/OpenSign/src/components/pdf/PlaceholderType.js index 58bdd0f14..918fdc129 100644 --- a/apps/OpenSign/src/components/pdf/PlaceholderType.js +++ b/apps/OpenSign/src/components/pdf/PlaceholderType.js @@ -135,7 +135,7 @@ function PlaceholderType(props) { } } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [props.pos]); + }, [props.pos?.options?.defaultValue]); const ExampleCustomInput = forwardRef(({ value, onClick }, ref) => (
{ - const height = 15; + const height = 18; if (e.key === "Enter") { //function to save height of text area onChangeHeightOfTextArea( @@ -403,19 +403,12 @@ function PlaceholderType(props) { case textInputWidget: return props.isSignYourself || (props.isNeedSign && props.data?.signerObjId === props.signerObjId) ? ( - { setTextValue(e.target.value); @@ -429,6 +422,13 @@ function PlaceholderType(props) { false ); }} + className={ + isMobile + ? "labelTextArea labelWidthMobile" + : "labelTextArea labelWidthDesktop" + } + style={{ whiteSpace: "pre-wrap" }} + cols="50" /> ) : (
{ const isDefault = false; handleTextValid(e); @@ -528,6 +525,13 @@ function PlaceholderType(props) { isDefault ); }} + className={ + isMobile + ? "labelTextArea labelWidthMobile" + : "labelTextArea labelWidthDesktop" + } + style={{ whiteSpace: "pre-wrap" }} + cols="50" /> ) : (
{ handleTextValid(e); onChangeInput( @@ -562,6 +564,13 @@ function PlaceholderType(props) { false ); }} + className={ + isMobile + ? "labelTextArea labelWidthMobile" + : "labelTextArea labelWidthDesktop" + } + style={{ whiteSpace: "pre-wrap" }} + cols="50" /> ) : (
{ handleTextValid(e); onChangeInput( @@ -596,6 +603,13 @@ function PlaceholderType(props) { false ); }} + className={ + isMobile + ? "labelTextArea labelWidthMobile" + : "labelTextArea labelWidthDesktop" + } + style={{ whiteSpace: "pre-wrap" }} + cols="50" /> ) : (
{ @@ -712,6 +725,13 @@ function PlaceholderType(props) { false ); }} + className={ + isMobile + ? "labelTextArea labelWidthMobile" + : "labelTextArea labelWidthDesktop" + } + style={{ whiteSpace: "pre-wrap" }} + cols="50" /> ) : (
); diff --git a/apps/OpenSign/src/constant/Utils.js b/apps/OpenSign/src/constant/Utils.js index a0b445802..89a4bac36 100644 --- a/apps/OpenSign/src/constant/Utils.js +++ b/apps/OpenSign/src/constant/Utils.js @@ -1273,6 +1273,7 @@ export const multiSignEmbed = async ( } }; const widgetTypeExist = [ + textWidget, textInputWidget, "name", "company", @@ -1328,7 +1329,7 @@ export const multiSignEmbed = async ( checkbox.enableReadOnly(); }); } - } else if (position.type === textWidget) { + } else if (widgetTypeExist) { const font = await pdfDoc.embedFont("Helvetica"); const fontSize = 12; let textContent; @@ -1404,24 +1405,8 @@ export const multiSignEmbed = async ( color: rgb(0, 0, 0), size: fontSize }); - y -= 15; // Adjust the line height as needed + y -= 18; // Adjust the line height as needed } - } else if (widgetTypeExist) { - const font = await pdfDoc.embedFont("Helvetica"); - const fontSize = 12; - let textContent; - if (position?.options?.response) { - textContent = position.options?.response; - } else if (position?.options?.defaultValue) { - textContent = position?.options?.defaultValue; - } - page.drawText(textContent, { - x: xPos(position), - y: yPos(position) + 10, - size: fontSize, - font, - color: rgb(0, 0, 0) - }); } else if (position.type === "dropdown") { const dropdownRandomId = "dropdown" + randomId(); const dropdown = form.createDropdown(dropdownRandomId); @@ -1793,6 +1778,7 @@ export const handleCopyNextToWidget = ( } }; + export const getFileName = (fileUrl) => { if (fileUrl) { const url = new URL(fileUrl); @@ -1800,5 +1786,20 @@ export const getFileName = (fileUrl) => { return filename || ""; } else { return ""; + +//fetch tenant app logo from `partners_Tenant` class by domain name +export const getAppLogo = async () => { + const domainName = window.location.host; + try { + const tenantCreditsQuery = new Parse.Query("partners_Tenant"); + tenantCreditsQuery.equalTo("Domain", domainName); + const res = await tenantCreditsQuery.first(); + + if (res) { + const updateRes = JSON.parse(JSON.stringify(res)); + return updateRes?.Logo; + } + } catch (e) { + return null; } }; diff --git a/apps/OpenSign/src/index.js b/apps/OpenSign/src/index.js index 0acf4043a..3f3131a15 100644 --- a/apps/OpenSign/src/index.js +++ b/apps/OpenSign/src/index.js @@ -4,6 +4,7 @@ import "./index.css"; import App from "./App"; import { Provider } from "react-redux"; import { store } from "./redux/store"; +import { CookiesProvider } from "react-cookie"; import { HTML5Backend } from "react-dnd-html5-backend"; import { TouchBackend } from "react-dnd-touch-backend"; import { @@ -62,10 +63,12 @@ if (process.env.REACT_APP_GTM) { const root = ReactDOM.createRoot(document.getElementById("root")); root.render( - - - {generatePreview} - - - + + + + {generatePreview} + + + + ); diff --git a/apps/OpenSign/src/layout/HomeLayout.js b/apps/OpenSign/src/layout/HomeLayout.js index 92f79e4f9..26a386455 100644 --- a/apps/OpenSign/src/layout/HomeLayout.js +++ b/apps/OpenSign/src/layout/HomeLayout.js @@ -10,6 +10,7 @@ import Parse from "parse"; import ModalUi from "../primitives/ModalUi"; import { useNavigate, useLocation, Outlet } from "react-router-dom"; import { isEnableSubscription } from "../constant/const"; +import { useCookies } from "react-cookie"; const HomeLayout = () => { const navigate = useNavigate(); @@ -24,6 +25,7 @@ const HomeLayout = () => { const [isTour, setIsTour] = useState(false); const [tourStatusArr, setTourStatusArr] = useState([]); const [tourConfigs, setTourConfigs] = useState([]); + const [, setCookie] = useCookies(["accesstoken", "main_Domain"]); useEffect(() => { (async () => { @@ -44,8 +46,27 @@ const HomeLayout = () => { setIsUserValid(false); } })(); + saveCookies(); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); + //function to use save data in cookies storage + const saveCookies = () => { + const main_Domain = window.location.origin; + const domainName = window.location.hostname; //app.opensignlabs.com + // Find the index of the first dot in the string + const indexOfFirstDot = domainName.indexOf("."); + // Remove the first dot and get the substring starting from the next character + const updateDomain = domainName.substring(indexOfFirstDot); //.opensignlabs.com + setCookie("accesstoken", localStorage.getItem("accesstoken"), { + secure: true, + domain: updateDomain + }); + setCookie("main_Domain", main_Domain, { + secure: true, + domain: updateDomain + }); + }; async function checkIsSubscribed() { const currentUser = Parse.User.current(); diff --git a/apps/OpenSign/src/pages/Dashboard.js b/apps/OpenSign/src/pages/Dashboard.js index 98ec05ff1..3b580d396 100644 --- a/apps/OpenSign/src/pages/Dashboard.js +++ b/apps/OpenSign/src/pages/Dashboard.js @@ -6,6 +6,7 @@ import { useNavigate, useParams } from "react-router-dom"; import Title from "../components/Title"; import { useDispatch } from "react-redux"; import { saveTourSteps } from "../redux/reducers/TourStepsReducer"; + const Dashboard = () => { const navigate = useNavigate(); const dispatch = useDispatch(); diff --git a/apps/OpenSign/src/pages/Login.js b/apps/OpenSign/src/pages/Login.js index eeaa76447..67488d00a 100644 --- a/apps/OpenSign/src/pages/Login.js +++ b/apps/OpenSign/src/pages/Login.js @@ -19,6 +19,7 @@ import Alert from "../primitives/Alert"; import { appInfo } from "../constant/appinfo"; import { fetchAppInfo } from "../redux/reducers/infoReducer"; import { showTenant } from "../redux/reducers/ShowTenant"; +import { getAppLogo } from "../constant/Utils"; function Login() { const navigate = useNavigate(); const location = useLocation(); @@ -43,7 +44,7 @@ function Login() { Destination: "" }); const [isModal, setIsModal] = useState(false); - const image = appInfo?.applogo || undefined; + const [image, setImage] = useState(appInfo?.applogo); useEffect(() => { if (localStorage.getItem("accesstoken")) { @@ -51,8 +52,19 @@ function Login() { GetLoginData(); } dispatch(fetchAppInfo()); + saveLogo(); + // eslint-disable-next-line }, []); + + const saveLogo = async () => { + const logo = await getAppLogo(); + if (logo) { + setImage(logo); + } else { + setImage(appInfo?.applogo || undefined); + } + }; const handleChange = (event) => { const { name, value } = event.target; setState({ ...state, [name]: value }); diff --git a/apps/OpenSign/src/pages/Opensigndrive.js b/apps/OpenSign/src/pages/Opensigndrive.js index 192a9d766..8c248f6cf 100644 --- a/apps/OpenSign/src/pages/Opensigndrive.js +++ b/apps/OpenSign/src/pages/Opensigndrive.js @@ -203,6 +203,7 @@ function Opensigndrive() { const result = JSON.parse(JSON.stringify(res)); setPdfData((prev) => [...prev, result]); + sortingData(null, null, [result], true); setNewFolderName(); setIsFolderLoader(false); setIsFolder(false); @@ -223,9 +224,13 @@ function Opensigndrive() { const sortedBy = (appInfo, type, order) => { if (type === orderName.Name) { if (order === orderName.Ascending) { - return appInfo.sort((a, b) => (a.Name > b.Name ? 1 : -1)); + return appInfo.sort((a, b) => + a.Name.toLowerCase() < b.Name.toLowerCase() ? -1 : 1 + ); } else if (order === orderName.Descending) { - return appInfo.sort((a, b) => (a.Name > b.Name ? -1 : 1)); + return appInfo.sort((a, b) => + a.Name.toLowerCase() < b.Name.toLowerCase() ? 1 : -1 + ); } } else if (type === orderName.Date) { if (order === orderName.Ascending) { @@ -724,6 +729,7 @@ function Opensigndrive() { isList={isList} setIsAlert={setIsAlert} setSkip={setSkip} + sortingData={sortingData} /> {loading && (
Loading...
diff --git a/apps/OpenSign/src/pages/Signup.js b/apps/OpenSign/src/pages/Signup.js index a3af7263c..2169c0d80 100644 --- a/apps/OpenSign/src/pages/Signup.js +++ b/apps/OpenSign/src/pages/Signup.js @@ -11,6 +11,7 @@ import { useDispatch } from "react-redux"; import { fetchAppInfo } from "../redux/reducers/infoReducer"; import { showTenant } from "../redux/reducers/ShowTenant"; import { isEnableSubscription } from "../constant/const"; +import { getAppLogo } from "../constant/Utils"; const Signup = () => { const { width } = useWindowSize(); const navigate = useNavigate(); @@ -22,6 +23,7 @@ const Signup = () => { const [email, setEmail] = useState(""); const [company, setCompany] = useState(""); const [jobTitle, setJobTitle] = useState(""); + const [image, setImage] = useState(appInfo?.applogo); const [state, setState] = useState({ loading: false, alertType: "success", @@ -33,7 +35,6 @@ const Signup = () => { const [specialCharValid, setSpecialCharValid] = useState(false); const togglePasswordVisibility = () => setShowPassword(!showPassword); - const image = appInfo.applogo; const clearStorage = async () => { if (Parse.User.current()) { @@ -469,9 +470,19 @@ const Signup = () => { }; useEffect(() => { dispatch(fetchAppInfo()); + saveLogo(); // eslint-disable-next-line }, []); + const saveLogo = async () => { + const logo = await getAppLogo(); + if (logo) { + setImage(logo); + } else { + setImage(appInfo?.applogo || undefined); + } + }; + const handlePasswordChange = (e) => { const newPassword = e.target.value; setPassword(newPassword); diff --git a/apps/OpenSign/src/styles/signature.css b/apps/OpenSign/src/styles/signature.css index 1d281ba17..7c901ff81 100644 --- a/apps/OpenSign/src/styles/signature.css +++ b/apps/OpenSign/src/styles/signature.css @@ -452,11 +452,15 @@ overflow: hidden !important; text-overflow: ellipsis; } + .disabled { - opacity: 0.5; /* Example: reduce opacity to visually indicate disabled state */ - pointer-events: none; /* Prevents mouse clicks and other events */ + opacity: 0.5; + /* Example: reduce opacity to visually indicate disabled state */ + pointer-events: none; + /* Prevents mouse clicks and other events */ /* background-color: #888; */ } + .useEmail { font-size: 10px; color: #424242; @@ -800,6 +804,7 @@ option { z-index: 999; border-radius: 2px; resize: none; + overflow: hidden; } .labelTextArea:focus { diff --git a/apps/OpenSignServer/test.pdf b/apps/OpenSignServer/test.pdf index 7a2d63ada..5facc82df 100644 Binary files a/apps/OpenSignServer/test.pdf and b/apps/OpenSignServer/test.pdf differ