From 9666e418808d6b871cdded4e472317b5adc5ed2e Mon Sep 17 00:00:00 2001 From: RaktimaNXG Date: Fri, 12 Jul 2024 11:24:49 +0530 Subject: [PATCH 1/2] fix: public profile user name already exist issue --- apps/OpenSign/src/components/Header.js | 4 +- apps/OpenSign/src/pages/UserProfile.js | 1 + .../src/primitives/GetReportDisplay.js | 41 ++++--------------- apps/OpenSign/src/script/PublicTemplate.js | 4 +- 4 files changed, 12 insertions(+), 38 deletions(-) diff --git a/apps/OpenSign/src/components/Header.js b/apps/OpenSign/src/components/Header.js index 20a8ff6d7..d6905caac 100644 --- a/apps/OpenSign/src/components/Header.js +++ b/apps/OpenSign/src/components/Header.js @@ -5,7 +5,7 @@ import { useNavigate } from "react-router-dom"; import Parse from "parse"; import { useWindowSize } from "../hook/useWindowSize"; import { checkIsSubscribed, getAppLogo, openInNewTab } from "../constant/Utils"; -import { isEnableSubscription } from "../constant/const"; +import { isEnableSubscription, isStaging } from "../constant/const"; const Header = ({ showSidebar }) => { const navigate = useNavigate(); @@ -86,7 +86,7 @@ const Header = ({ showSidebar }) => { }; }, [isOpen]); const handleConsoleRedirect = () => { - if (window.location.host === "staging-app.opensignlabs.com") { + if (isStaging) { window.open(" https://staging-console.opensignlabs.com/"); } else { window.open("https://console.opensignlabs.com/"); diff --git a/apps/OpenSign/src/pages/UserProfile.js b/apps/OpenSign/src/pages/UserProfile.js index 2e945fe7b..4dc0b36dc 100644 --- a/apps/OpenSign/src/pages/UserProfile.js +++ b/apps/OpenSign/src/pages/UserProfile.js @@ -185,6 +185,7 @@ function UserProfile() { const json = JSON.parse(JSON.stringify([res])); const extRes = JSON.stringify(json); localStorage.setItem("Extand_Class", extRes); + previousPublicUserName.current = publicUserName; // console.log("updateRes ", updateRes); }; // file upload function diff --git a/apps/OpenSign/src/primitives/GetReportDisplay.js b/apps/OpenSign/src/primitives/GetReportDisplay.js index 79e2c625e..26492e078 100644 --- a/apps/OpenSign/src/primitives/GetReportDisplay.js +++ b/apps/OpenSign/src/primitives/GetReportDisplay.js @@ -1240,42 +1240,18 @@ const ReportTable = (props) => {

{props.isPublic[item.objectId] ? `Are you sure you want to make this template public ?` - : `Are you sure you want to make this template private ? This will remove it from your public profile ?`} + : `Are you sure you want to make this template private? This will remove it from your public profile.`}

{props.isPublic[item.objectId] && (

Public role :{" "}

- {/* {item?.Placeholders?.length > 1 ? ( - - ) : ( */} + - {/* {item?.Placeholders[0]?.Role} */} - {/* {handleShowRole(item)} */} - {/*
*/} - {/* )} */} )} @@ -1306,27 +1282,24 @@ const ReportTable = (props) => { handleClose={() => { setIsPublicProfile({}); }} - reduceWidth={ - "md:min-w-[440px] md:max-w-[550px]" - } >
{publicUserName ? (

- Here’s your public URL. Copy or share - it with the signer, and you will be - able to see all your publicly set + Here’s your public URL: Copy it or + share it with the signer, and you will + be able to see all your publicly set templates.

-
+
Public URL :{" "} copytoProfileLink()} className="underline underline-offset-2 cursor-pointer" - >{`https://opensign-me.vercel.app/${publicUserName}`} + >{`https://opensign.me/${publicUserName}`}
) : ( diff --git a/apps/OpenSign/src/script/PublicTemplate.js b/apps/OpenSign/src/script/PublicTemplate.js index 8dddb4743..54f48d0ef 100644 --- a/apps/OpenSign/src/script/PublicTemplate.js +++ b/apps/OpenSign/src/script/PublicTemplate.js @@ -23,7 +23,7 @@ const appId = process.env.REACT_APP_APPID : "opensign"; const serverUrl = process.env.REACT_APP_SERVERURL ? process.env.REACT_APP_SERVERURL - : window.location.origin + "/api/app"; + : "https://staging-app.opensignlabs.com/api/app"; localStorage.setItem("baseUrl", `${serverUrl}/`); localStorage.setItem("parseAppId", appId); Parse.initialize(appId); @@ -33,7 +33,7 @@ const scriptComponent = document.createElement("div"); scriptComponent.id = "script-component"; document.body.appendChild(scriptComponent); const link = document.createElement("link"); -link.href = `${process.env.PUBLIC_URL}/css/fonts.css`; +link.href = "https://staging-app.opensignlabs.com/css/fonts.css"; link.rel = "stylesheet"; document.head.appendChild(link); From 8263e3247e7b8903ec988d162be010d188046361 Mon Sep 17 00:00:00 2001 From: RaktimaNXG Date: Fri, 12 Jul 2024 11:28:36 +0530 Subject: [PATCH 2/2] fix: handle condition to enter username --- apps/OpenSign/src/pages/UserProfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/OpenSign/src/pages/UserProfile.js b/apps/OpenSign/src/pages/UserProfile.js index 4dc0b36dc..d48fea6db 100644 --- a/apps/OpenSign/src/pages/UserProfile.js +++ b/apps/OpenSign/src/pages/UserProfile.js @@ -107,7 +107,7 @@ function UserProfile() { let phn = Phone, res = ""; //condition to call cloud function when user change publicUserName - if (previousPublicUserName.current !== publicUserName) { + if (publicUserName && previousPublicUserName.current !== publicUserName) { res = await handleCheckPublicUserName(); } if (!res) {