diff --git a/apps/OpenSign/src/json/plansArr.json b/apps/OpenSign/src/json/plansArr.json index 90ab47bdc..f372d7493 100644 --- a/apps/OpenSign/src/json/plansArr.json +++ b/apps/OpenSign/src/json/plansArr.json @@ -1,65 +1,63 @@ [ - { - "planName": "SELF HOSTED", - "currency": "", - "price": "Free", - "subtitle": "Free for life One click install.", - "btnText": "Visit github", - "url": "https://github.com/opensignlabs/opensign", - "target": "_blank", - "benefits": [ - "Sign Unlimited Documents", - "S3 Doc Storage", - "Unlimited Guest Signers", - "Unlimited completion certificates", - "Unique Code(OTP) verification for guest signers", - "Expiring docs & reject signature support", - "PDF Template Creation(coming soon)", - "Audit Trails", - "API support", - "Add-ons support(coming soon)", - "Self hosted cloud infrastructure", - "Free for lifetime", - "Community support" - ] - }, - { - "planName": "THANKS PLAN", - "currency": "$", - "price": "29.99", - "subtitle": "Use code 'FREEBETA' to get this for free(First 1000 users)", - "btnText": "Subscribe", - "url": "https://subscriptions.zoho.in/subscribe/ef798486e6a0a11ea65f2bae8f2af901dbadf3175d495584fd25b9af5d2f2b9e/thanks", - "target": "_self", - "benefits": [ - "Sign Unlimited Documents", - "Unlimited Secure Doc Storage with OpenSign™ Drive", - "Unlimited Guest Signers", - "Unlimited completion certificates", - "Unique Code(OTP) verification for guest signers", - "Expiring docs & reject signature support", - "PDF Template Creation(coming soon)", - "Audit Trails", - "API support", - "Add-ons support(coming soon)", - "Self hosted cloud infrastructure" - ] - }, - { - "planName": "ENTERPRISE", - "currency": "", - "price": "Request Price", - "subtitle": "Customization available Priority support.", - "btnText": "Contact us", - "url": "https://www.opensignlabs.com/contact-us", - "target": "_blank", - "benefits": [ - "All features", - "Custom domain", - "Whitelabeling", - "Uptime SLA", - "SSO support", - "24/7 support" - ] - } -] \ No newline at end of file + { + "planName": "Free Plan", + "currency": "", + "price": "Free", + "subtitle": "Free for life.", + "btnText": "Subscribe", + "url": "", + "target": "_blank", + "benefits": [ + "Sign Unlimited Documents", + "S3 Doc Storage", + "Unlimited Guest Signers", + "Unlimited completion certificates", + "Unique Code(OTP) verification for guest signers", + "Expiring docs & reject signature support", + "PDF Template Creation", + "Audit Trails", + "API support", + "Free for lifetime", + "Community support" + ] + }, + { + "planName": "THANKS PLAN", + "currency": "$", + "price": "29.99", + "subtitle": "Use code 'FREEBETA' to get this for free(First 1000 users)", + "btnText": "Subscribe", + "url": "https://subscriptions.zoho.in/subscribe/ef798486e6a0a11ea65f2bae8f2af901dbadf3175d495584fd25b9af5d2f2b9e/thanks", + "target": "_self", + "benefits": [ + "Sign Unlimited Documents", + "Unlimited Secure Doc Storage with OpenSign™ Drive", + "Unlimited Guest Signers", + "Unlimited completion certificates", + "Unique Code(OTP) verification for guest signers", + "Expiring docs & reject signature support", + "PDF Template Creation(coming soon)", + "Audit Trails", + "API support", + "Add-ons support(coming soon)", + "Self hosted cloud infrastructure" + ] + }, + { + "planName": "ENTERPRISE", + "currency": "", + "price": "Request Price", + "subtitle": "Customization available Priority support.", + "btnText": "Contact us", + "url": "https://www.opensignlabs.com/contact-us", + "target": "_blank", + "benefits": [ + "All features", + "Custom domain", + "Whitelabeling", + "Uptime SLA", + "SSO support", + "24/7 support" + ] + } +] diff --git a/apps/OpenSign/src/layout/HomeLayout.js b/apps/OpenSign/src/layout/HomeLayout.js index 8da57af4b..2686d5e92 100644 --- a/apps/OpenSign/src/layout/HomeLayout.js +++ b/apps/OpenSign/src/layout/HomeLayout.js @@ -52,14 +52,16 @@ const HomeLayout = () => { email: currentUser.get("email") }); if (isEnableSubscription) { + const freeplan = user?.get("Plan") && user?.get("Plan"); const billingDate = user?.get("Next_billing_date") && user?.get("Next_billing_date"); - - if (billingDate) { + if (freeplan === "freeplan") { + setIsUserValid(true); + setIsLoader(false); + } else if (billingDate) { if (billingDate > new Date()) { setIsUserValid(true); setIsLoader(false); - return true; } else { navigate(`/subscription`); } @@ -69,7 +71,6 @@ const HomeLayout = () => { } else { setIsUserValid(true); setIsLoader(false); - return true; } } const showSidebar = () => { diff --git a/apps/OpenSign/src/pages/Login.js b/apps/OpenSign/src/pages/Login.js index 8ddccaa1c..1d73c0bda 100644 --- a/apps/OpenSign/src/pages/Login.js +++ b/apps/OpenSign/src/pages/Login.js @@ -254,10 +254,15 @@ function Login() { "userDetails", JSON.stringify(LocalUserDetails) ); + const freeplan = + results[0].get("Plan") && + results[0].get("Plan"); const billingDate = results[0].get("Next_billing_date") && results[0].get("Next_billing_date"); - if (billingDate) { + if (freeplan === "freeplan") { + navigate(redirectUrl); + } else if (billingDate) { if (billingDate > new Date()) { localStorage.removeItem( "userDetails" @@ -809,7 +814,13 @@ function Login() { const billingDate = results[0].get("Next_billing_date") && results[0].get("Next_billing_date"); - if (billingDate) { + const freeplan = + results[0]?.get("Plan") && + results[0]?.get("Plan"); + + if (freeplan === "freeplan") { + navigate(redirectUrl); + } else if (billingDate) { if (billingDate > new Date()) { localStorage.removeItem("userDetails"); // Redirect to the appropriate URL after successful login diff --git a/apps/OpenSign/src/pages/PdfRequestFiles.js b/apps/OpenSign/src/pages/PdfRequestFiles.js index d063a3c35..efea4e25a 100644 --- a/apps/OpenSign/src/pages/PdfRequestFiles.js +++ b/apps/OpenSign/src/pages/PdfRequestFiles.js @@ -134,9 +134,12 @@ function PdfRequestFiles() { const user = await Parse.Cloud.run("getUserDetails", { email: email }); + const freeplan = user?.get("Plan") && user?.get("Plan"); const billingDate = user?.get("Next_billing_date") && user?.get("Next_billing_date"); - if (billingDate) { + if (freeplan === "freeplan") { + return true; + } else if (billingDate) { if (billingDate > new Date()) { return true; } else { diff --git a/apps/OpenSign/src/pages/PlaceHolderSign.js b/apps/OpenSign/src/pages/PlaceHolderSign.js index d46683711..d6ac2da45 100644 --- a/apps/OpenSign/src/pages/PlaceHolderSign.js +++ b/apps/OpenSign/src/pages/PlaceHolderSign.js @@ -183,9 +183,12 @@ function PlaceHolderSign() { const user = await Parse.Cloud.run("getUserDetails", { email: email }); + const freeplan = user?.get("Plan") && user?.get("Plan"); const billingDate = user?.get("Next_billing_date") && user?.get("Next_billing_date"); - if (billingDate) { + if (freeplan === "freeplan") { + return true; + } else if (billingDate) { if (billingDate > new Date()) { return true; } else { diff --git a/apps/OpenSign/src/pages/PlanSubscriptions.js b/apps/OpenSign/src/pages/PlanSubscriptions.js index 3a2e398bc..abae7edbc 100644 --- a/apps/OpenSign/src/pages/PlanSubscriptions.js +++ b/apps/OpenSign/src/pages/PlanSubscriptions.js @@ -1,9 +1,9 @@ import React, { useState, useEffect } from "react"; -// import { useNavigate } from "react-router"; -import { NavLink } from "react-router-dom"; +import { NavLink, useNavigate } from "react-router-dom"; import checkmark from "../assets/images/checkmark.png"; import plansArr from "../json/plansArr.json"; import Title from "../components/Title"; +import Parse from "parse"; const listItemStyle = { paddingLeft: "20px", // Add padding to create space for the image backgroundImage: `url(${checkmark})`, // Set your image as the list style image @@ -13,7 +13,7 @@ const listItemStyle = { }; const PlanSubscriptions = () => { - // const navigate = useNavigate(); + const navigate = useNavigate(); const [yearlyVisible, setYearlyVisible] = useState(false); const [isLoader, setIsLoader] = useState(true); @@ -36,14 +36,21 @@ const PlanSubscriptions = () => { phone; useEffect(() => { // if (localStorage.getItem("accesstoken")) { - setIsLoader(false); - setYearlyVisible(false); + setIsLoader(false); + setYearlyVisible(false); // } else { // navigate("/", { replace: true }); // } // eslint-disable-next-line }, []); + const handleFreePlan = async () => { + const params = { userId: Parse.User.current().id }; + const res = await Parse.Cloud.run("freesubscription", params); + if (res.status === "success") { + navigate("/"); + } + }; return ( <>