diff --git a/apps/OpenSign/src/App.js b/apps/OpenSign/src/App.js index 7f4f587b1..929008576 100644 --- a/apps/OpenSign/src/App.js +++ b/apps/OpenSign/src/App.js @@ -15,6 +15,7 @@ import DraftDocument from "./components/pdf/DraftDocument"; import PlaceHolderSign from "./pages/PlaceHolderSign"; import PdfRequestFiles from "./pages/PdfRequestFiles"; import LazyPage from "./primitives/LazyPage"; +import { isEnableSubscription } from "./constant/const"; const DebugPdf = lazy(() => import("./pages/DebugPdf")); const ForgetPassword = lazy(() => import("./pages/ForgetPassword")); const GuestLogin = lazy(() => import("./pages/GuestLogin")); @@ -113,7 +114,7 @@ function App() { path="/forgetpassword" element={} /> - {process.env.REACT_APP_ENABLE_SUBSCRIPTION && ( + {isEnableSubscription && ( <> { contactQuery.set("Email", email); contactQuery.set("UserRole", "contracts_Guest"); - if (localStorage.getItem("TenetId")) { + if (localStorage.getItem("TenantId")) { contactQuery.set("TenantId", { __type: "Pointer", className: "partners_Tenant", - objectId: localStorage.getItem("TenetId") + objectId: localStorage.getItem("TenantId") }); } diff --git a/apps/OpenSign/src/components/AddUser.js b/apps/OpenSign/src/components/AddUser.js index 67d6095e0..d812a1cd0 100644 --- a/apps/OpenSign/src/components/AddUser.js +++ b/apps/OpenSign/src/components/AddUser.js @@ -48,11 +48,11 @@ const AddUser = (props) => { contactQuery.set("Email", email); contactQuery.set("UserRole", "contracts_User"); - if (localStorage.getItem("TenetId")) { + if (localStorage.getItem("TenantId")) { contactQuery.set("TenantId", { __type: "Pointer", className: "partners_Tenant", - objectId: localStorage.getItem("TenetId") + objectId: localStorage.getItem("TenantId") }); } diff --git a/apps/OpenSign/src/components/Header.js b/apps/OpenSign/src/components/Header.js index 6306d5135..236120820 100644 --- a/apps/OpenSign/src/components/Header.js +++ b/apps/OpenSign/src/components/Header.js @@ -4,20 +4,32 @@ import FullScreenButton from "./FullScreenButton"; import { useNavigate } from "react-router-dom"; import Parse from "parse"; import { useWindowSize } from "../hook/useWindowSize"; -import { openInNewTab } from "../constant/Utils"; +import { checkIsSubscribed, openInNewTab } from "../constant/Utils"; +import { isEnableSubscription } from "../constant/const"; + const Header = ({ showSidebar }) => { - const navigation = useNavigate(); + 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 toggleDropdown = () => { setIsOpen(!isOpen); }; - + useEffect(() => { + checkSubscription(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + async function checkSubscription() { + if (isEnableSubscription) { + const getIsSubscribe = await checkIsSubscribed(); + setIsSubscribe(getIsSubscribe); + } + } const closeDropdown = () => { setIsOpen(false); Parse.User.logOut(); @@ -43,7 +55,7 @@ const Header = ({ showSidebar }) => { localStorage.setItem("baseUrl", baseUrl); localStorage.setItem("parseAppId", appid); - navigation("/"); + navigate("/"); }; //handle to close profile drop down menu onclick screen @@ -83,6 +95,16 @@ const Header = ({ showSidebar }) => { id="profile-menu" className="flex justify-between items-center gap-x-3" > + {!isSubscribe && ( +
+ +
+ )}
@@ -123,7 +145,7 @@ const Header = ({ showSidebar }) => { className="hover:bg-gray-100 py-1 px-2 cursor-pointer font-normal" onClick={() => { setIsOpen(false); - navigation("/profile"); + navigate("/profile"); }} > Profile @@ -132,7 +154,7 @@ const Header = ({ showSidebar }) => { className="hover:bg-gray-100 py-1 px-2 cursor-pointer font-normal" onClick={() => { setIsOpen(false); - navigation("/changepassword"); + navigate("/changepassword"); }} > Change Password diff --git a/apps/OpenSign/src/components/pdf/AddRoleModal.js b/apps/OpenSign/src/components/pdf/AddRoleModal.js index 8a2d1acb1..630a4bd61 100644 --- a/apps/OpenSign/src/components/pdf/AddRoleModal.js +++ b/apps/OpenSign/src/components/pdf/AddRoleModal.js @@ -30,7 +30,7 @@ const AddRoleModal = (props) => { margin: "10px 0 10px 5px" }} > - e.g: Hr, Director, Manager, New joinee, Accountant, etc... + e.g: Customer, Hr, Director, Manager, Student, etc...

- {props.type === "checkbox" && !props.isSignYourself && ( - <> - - { - const count = handleSetMinMax(e); - setMinCount(count); - }} - className="drodown-input" - /> - - { - const count = handleSetMinMax(e); - setMaxCount(count); - }} - className="drodown-input" - /> - - )} +
+ {props.type === "checkbox" && !props.isSignYourself && ( + <> + + {!props.isSubscribe && isEnableSubscription && } + { + const count = handleSetMinMax(e); + setMinCount(count); + }} + className={ + props.isSubscribe || !isEnableSubscription + ? "drodown-input" + : "disabled drodown-input" + } + /> + + { + const count = handleSetMinMax(e); + setMaxCount(count); + }} + className={ + props.isSubscribe || !isEnableSubscription + ? "drodown-input" + : "disabled drodown-input" + } + /> + + )} +
{["dropdown", radioButtonWidget].includes(props.type) && ( <> @@ -378,13 +402,15 @@ function DropdownWidgetOption(props) {
)} - {props.type === "checkbox" && !props.isSignYourself && ( - - )} + {props.type === "checkbox" && + !props.isSignYourself && + !isEnableSubscription && ( + + )}
{props.title ? props.title : "Recipients"} + + {props?.title === "Roles" && ( + <> + + + + + + +
+

What are template roles?

+

+ Begin by specifying each role needed for the completion of + the document. Think about the parties involved in the + signing process and what their responsibilities are. + Common roles include HR for internal documents, Customer + for agreements or Vendor for business agreements.{" "} +

+

+ Why pre-attach users to some roles? +

+

+ For roles that consistently involve the same individual + (e.g., the CEO's signature on employee offer + letters), you can pre-attach a user to a role within the + template. This step is optional but recommended for + efficiency and consistency across documents. +

+

+ When do i specify the user attached to each role? +

+

+ When you create a document from your template, you'll + be prompted to attach users to each defined role. If a + role already has a user attached, this will be pre-filled, + but you can modify it as needed before sending out the + document. +

+
+
+ + )} +
diff --git a/apps/OpenSign/src/components/pdf/WidgetNameModal.js b/apps/OpenSign/src/components/pdf/WidgetNameModal.js index 71c433afc..baaadadba 100644 --- a/apps/OpenSign/src/components/pdf/WidgetNameModal.js +++ b/apps/OpenSign/src/components/pdf/WidgetNameModal.js @@ -4,6 +4,8 @@ import "../../styles/AddUser.css"; import RegexParser from "regex-parser"; import { textInputWidget } from "../../constant/Utils"; import PremiumAlertHeader from "../../primitives/PremiumAlertHeader"; +import Upgrade from "../../primitives/Upgrade"; +import { isEnableSubscription } from "../../constant/const"; const WidgetNameModal = (props) => { const [formdata, setFormdata] = useState({ @@ -100,13 +102,14 @@ const WidgetNameModal = (props) => { title={"Widget info"} > {(props.defaultdata?.type === textInputWidget || - props.widgetName === textInputWidget) && ( - - )} + props.widgetName === textInputWidget) && + !isEnableSubscription && ( + + )}
{ props.widgetName === textInputWidget) && ( <>
-
+