🔥 The free & Open Source DocuSign alternative
JavaScript digital-signaturedocument-signingdocusign-alternativedocusign-freee-signatureelectronic-signatureelectronic-signaturesesignesignaturehacktoberfestjavascriptlegaltechmongodbnodejsopen-sourcepdf-signpdf-signaturereactjsself-hostedsign-pdf-files
fix: handle condition of free validation warning message
RaktimaNXGde26c2d71912
diff --git a/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js b/apps/OpenSign/src/components/pdf/DropdownWidgetOption.jsindex 08de190f7..3f95eaac4 100644--- a/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js+++ b/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js@@ -1,5 +1,5 @@import React, { useEffect, useState } from "react";-import { themeColor } from "../../constant/const";+import { isEnableSubscription, themeColor } from "../../constant/const";import ModalUi from "../../primitives/ModalUi";import { radioButtonWidget } from "../../constant/Utils";import PremiumAlertHeader from "../../primitives/PremiumAlertHeader";@@ -254,7 +254,7 @@ function DropdownWidgetOption(props) {>Minimun check</label>- {!props.isSubscribe && <Upgrade />}+ {!props.isSubscribe && isEnableSubscription && <Upgrade />}<inputrequireddefaultValue={0}@@ -264,7 +264,7 @@ function DropdownWidgetOption(props) {setMinCount(count);}}className={- props.isSubscribe+ props.isSubscribe || !isEnableSubscription? "drodown-input": "disabled drodown-input"}@@ -287,7 +287,7 @@ function DropdownWidgetOption(props) {setMaxCount(count);}}className={- props.isSubscribe+ props.isSubscribe || !isEnableSubscription? "drodown-input": "disabled drodown-input"}@@ -402,13 +402,15 @@ function DropdownWidgetOption(props) {</div>)}</div>- {props.type === "checkbox" && !props.isSignYourself && (- <PremiumAlertHeader- message={- "Field validations are free in beta, this feature will incur a fee later."- }- />- )}+ {props.type === "checkbox" &&+ !props.isSignYourself &&+ !isEnableSubscription && (+ <PremiumAlertHeader+ message={+ "Field validations are free in beta, this feature will incur a fee later."+ }+ />+ )}<divclassName={`${props.type === "checkbox" && !props.isSignYourselfdiff --git a/apps/OpenSign/src/components/pdf/WidgetNameModal.js b/apps/OpenSign/src/components/pdf/WidgetNameModal.jsindex eb8bfb937..baaadadba 100644--- a/apps/OpenSign/src/components/pdf/WidgetNameModal.js+++ b/apps/OpenSign/src/components/pdf/WidgetNameModal.js@@ -5,6 +5,7 @@ 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({@@ -101,13 +102,14 @@ const WidgetNameModal = (props) => {title={"Widget info"}>{(props.defaultdata?.type === textInputWidget ||- props.widgetName === textInputWidget) && (- <PremiumAlertHeader- message={- "Field validations are free in beta, this feature will incur a fee later."- }- />- )}+ props.widgetName === textInputWidget) &&+ !isEnableSubscription && (+ <PremiumAlertHeader+ message={+ "Field validations are free in beta, this feature will incur a fee later."+ }+ />+ )}<formonSubmit={handleSubmit}className={`${@@ -136,14 +138,18 @@ const WidgetNameModal = (props) => {<div className="form-section"><labelhtmlFor="textvalidate"- className="disabled"+ className={+ !props.isSubscribe && isEnableSubscription && "disabled"+ }style={{ fontSize: 13 }}>Validation</label>- {!props.isSubscribe && <Upgrade />}+ {!props.isSubscribe && isEnableSubscription && <Upgrade />}<div- className="disabled"+ className={+ !props.isSubscribe && isEnableSubscription && "disabled"+ }style={{display: "flex",flexDirection: "row",diff --git a/apps/OpenSign/src/constant/Utils.js b/apps/OpenSign/src/constant/Utils.jsindex 4483bfe78..bd5b45b67 100644--- a/apps/OpenSign/src/constant/Utils.js+++ b/apps/OpenSign/src/constant/Utils.js@@ -26,7 +26,7 @@ export async function checkIsSubscribed() {const user = await Parse.Cloud.run("getUserDetails", {email: jsonSender[0].Email});- const freeplan = user?.get("Plan") && user?.get("Plan").plan_code;+ const freeplan = user?.get("Plan") && user?.get("Plan")?.plan_code;const billingDate =user?.get("Next_billing_date") && user?.get("Next_billing_date");if (freeplan === "freeplan") {diff --git a/apps/OpenSign/src/pages/GenerateToken.js b/apps/OpenSign/src/pages/GenerateToken.jsindex 026dfb7e9..9e4035191 100644--- a/apps/OpenSign/src/pages/GenerateToken.js+++ b/apps/OpenSign/src/pages/GenerateToken.js@@ -125,10 +125,10 @@ function GenerateToken() {</div>) : (<div className="bg-white flex flex-col justify-center shadow rounded">- <PremiumAlertHeader />+ {!isEnableSubscription && <PremiumAlertHeader />}<h1className={- isSubscribe+ isSubscribe || !isEnableSubscription? "ml-4 mt-3 mb-2 font-semibold": "ml-4 mt-3 mb-2 font-semibold text-gray-300"}@@ -140,11 +140,11 @@ function GenerateToken() {}iconColor={!isSubscribe && "gray"}/>- {!isSubscribe && <Upgrade />}+ {!isSubscribe && isEnableSubscription && <Upgrade />}</h1><ulclassName={- isSubscribe+ isSubscribe || !isEnableSubscription? "w-full flex flex-col p-2 text-sm ": "w-full flex flex-col p-2 text-sm opacity-20 pointer-events-none"}@@ -164,7 +164,7 @@ function GenerateToken() {</ul><divclassName={- isSubscribe+ isSubscribe || !isEnableSubscription? "flex flex-col md:flex-row items-center justify-center gap-2 pb-4": "flex flex-col md:flex-row items-center justify-center gap-2 pb-4 opacity-40 pointer-events-none"}diff --git a/apps/OpenSign/src/pages/UserProfile.js b/apps/OpenSign/src/pages/UserProfile.jsindex 4048a04ba..648c8eaae 100644--- a/apps/OpenSign/src/pages/UserProfile.js+++ b/apps/OpenSign/src/pages/UserProfile.js@@ -276,7 +276,7 @@ function UserProfile() {<div className="flex justify-between items-center py-2"><spanclassName={- isSubscribe+ isSubscribe || !isEnableSubscription? "font-semibold": "font-semibold text-gray-300"}@@ -288,11 +288,11 @@ function UserProfile() {}isSubscribe={isSubscribe}/>{" "}- {!isSubscribe && <Upgrade />}+ {!isSubscribe && isEnableSubscription && <Upgrade />}</span>{" "}<labelclassName={- !isSubscribe+ !isSubscribe || isEnableSubscription? "relative inline-flex items-center mb-0 pointer-events-none opacity-50": `${editmode ? "cursor-pointer" : ""@@ -310,11 +310,13 @@ function UserProfile() {<div className="w-9 h-5 bg-gray-200 peer-focus:outline-none peer-focus:ring-1 peer-focus:ring-black rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all dark:border-black peer-checked:bg-blue-600"></div></label></div>- <PremiumAlertHeader- message={- "Disable documentId is free in beta, this feature will incur a fee later."- }- />+ {!isEnableSubscription && (+ <PremiumAlertHeader+ message={+ "Disable documentId is free in beta, this feature will incur a fee later."+ }+ />+ )}</li></ul><div className="flex justify-center pt-2 pb-3 md:pt-3 md:pb-4">diff --git a/apps/OpenSign/src/pages/Webhook.js b/apps/OpenSign/src/pages/Webhook.jsindex b89bda460..12e4fef17 100644--- a/apps/OpenSign/src/pages/Webhook.js+++ b/apps/OpenSign/src/pages/Webhook.js@@ -109,10 +109,10 @@ function Webhook() {</div>) : (<div className="bg-white flex flex-col justify-center shadow rounded">- <PremiumAlertHeader />+ {!isEnableSubscription && <PremiumAlertHeader />}<h1className={- isSubscribe+ isSubscribe || !isEnableSubscription? "ml-4 mt-3 mb-2 font-semibold": "ml-4 mt-3 mb-2 font-semibold text-gray-300"}@@ -122,11 +122,11 @@ function Webhook() {url={"https://docs.opensignlabs.com/docs/API-docs/get-webhook"}isSubscribe={isSubscribe}/>- {!isSubscribe && <Upgrade />}+ {!isSubscribe && isEnableSubscription && <Upgrade />}</h1><ulclassName={- isSubscribe+ isSubscribe || !isEnableSubscription? "w-full flex flex-col p-2 text-sm ": "w-full flex flex-col p-2 text-sm opacity-20 pointer-events-none"}@@ -142,7 +142,7 @@ function Webhook() {</ul><divclassName={- isSubscribe+ isSubscribe || !isEnableSubscription? "flex flex-col md:flex-row items-center justify-center gap-2 pb-4": "flex flex-col md:flex-row items-center justify-center gap-2 pb-4 opacity-40 pointer-events-none"}diff --git a/apps/OpenSign/src/primitives/Tooltip.js b/apps/OpenSign/src/primitives/Tooltip.jsindex 2a8006deb..f49e4bce7 100644--- a/apps/OpenSign/src/primitives/Tooltip.js+++ b/apps/OpenSign/src/primitives/Tooltip.js@@ -1,12 +1,13 @@import React from "react";import { Tooltip as ReactTooltip } from "react-tooltip";import { openInNewTab } from "../constant/Utils";+import { isEnableSubscription } from "../constant/const";const Tooltip = ({ id, message, url, iconColor, isSubscribe }) =>url ? (<buttononClick={() => openInNewTab(url)}className={- isSubscribe+ isSubscribe || !isEnableSubscription? "text-center": "text-center opacity-20 pointer-events-none"}