diff --git a/.env.example b/.env.example index cd2978cc0..6fc74933f 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,5 @@ # Frontend config ************************************************************************************************************************************************************************************************ -# Set CI to false while running the app locally -CI=false + # Set it to the URL form where the app home page will be accessed PUBLIC_URL=https://app.opensignlabs.com/ # Set it to true if you want to generate the Sourcemap for debugging diff --git a/.env.frontend_dev b/.env.frontend_dev index d36422a82..f16acf752 100644 --- a/.env.frontend_dev +++ b/.env.frontend_dev @@ -2,8 +2,6 @@ # When used as it is, this env config will connect to our hosted UAT backend # Note that any data in staging will get cleared from time to time and you may have to sign up again and again -# Set CI to false while running the app locally -CI=false # Set it to the URL form where the app home page will be accessed PUBLIC_URL=http://localhost:3000 # Set it to true if you want to generate the Sourcemap for debugging diff --git a/.env.local_dev b/.env.local_dev index 93eff6132..34fd3bf89 100644 --- a/.env.local_dev +++ b/.env.local_dev @@ -2,8 +2,6 @@ # When used as it is, this env config will connect to our hosted UAT backend # Note that any data in staging will get cleared from time to time and you may have to sign up again and again -# Set CI to false while running the app locally -CI=false # Set it to the URL form where the app home page will be accessed PUBLIC_URL=http://localhost:3000 # Set it to true if you want to generate the Sourcemap for debugging diff --git a/apps/OpenSign/src/components/ErrorBoundary.js b/apps/OpenSign/src/components/ErrorBoundary.js deleted file mode 100644 index e15a818df..000000000 --- a/apps/OpenSign/src/components/ErrorBoundary.js +++ /dev/null @@ -1,49 +0,0 @@ -import React, { Component } from "react"; - -export class ErrorBoundary extends Component { - constructor(props) { - super(props); - this.state = { hasError: false }; - } - - static getDerivedStateFromError() { - return { - hasError: true - }; - } - - componentDidCatch(error, info) { - console.log(error); - console.log(info); - } - - render() { - if (this.state.hasError) { - return ( -
-
-

- Something went wrong. -

-
-
- ); - } - return this.props.children; - } -} - -export default ErrorBoundary; diff --git a/apps/OpenSign/src/components/dashboard/GetDashboard.js b/apps/OpenSign/src/components/dashboard/GetDashboard.js index 144505ef9..5550506a3 100644 --- a/apps/OpenSign/src/components/dashboard/GetDashboard.js +++ b/apps/OpenSign/src/components/dashboard/GetDashboard.js @@ -1,8 +1,5 @@ import React, { Suspense, lazy } from "react"; -import ErrorBoundary from "../ErrorBoundary"; - const DashboardCard = lazy(() => import("./DashboardCard")); - const DashboardReport = lazy(() => import("./DashboardReport")); const GetDashboard = (props) => { @@ -76,25 +73,23 @@ const GetDashboard = (props) => { } }; return ( - -
- {props.dashboard.map((val, key) => ( -
- {val.columns.map((col, i) => - col.widget.data && col.widget.data.tourSection ? ( -
- {renderSwitchWithTour(col)} -
- ) : ( -
- {renderSwitch(col)} -
- ) - )} -
- ))} -
-
+
+ {props.dashboard.map((val, key) => ( +
+ {val.columns.map((col, i) => + col.widget.data && col.widget.data.tourSection ? ( +
+ {renderSwitchWithTour(col)} +
+ ) : ( +
+ {renderSwitch(col)} +
+ ) + )} +
+ ))} +
); }; diff --git a/apps/OpenSign/src/components/pdf/Placeholder.js b/apps/OpenSign/src/components/pdf/Placeholder.js index cae1c79f3..ea047b17b 100644 --- a/apps/OpenSign/src/components/pdf/Placeholder.js +++ b/apps/OpenSign/src/components/pdf/Placeholder.js @@ -327,7 +327,7 @@ function Placeholder(props) { className="dropdown-item itemColor" style={{ fontSize: "12px" }} > - {data?.date ? data?.date : "nodata"} + {data?.date ? data?.date : "No data"} ); })} diff --git a/apps/OpenSign/src/components/pdf/RenderPdf.js b/apps/OpenSign/src/components/pdf/RenderPdf.js index 043f97845..7d89ab006 100644 --- a/apps/OpenSign/src/components/pdf/RenderPdf.js +++ b/apps/OpenSign/src/components/pdf/RenderPdf.js @@ -6,8 +6,8 @@ import { handleImageResize, handleSignYourselfImageResize } from "../../constant/Utils"; -import EmailToast from "../../primitives/EmailToast"; import Placeholder from "./Placeholder"; +import Alert from "../../primitives/Alert"; function RenderPdf({ pageNumber, @@ -324,6 +324,7 @@ function RenderPdf({ return ( <> + {successEmail && Email sent successfully!} {isMobile && scale ? (
- {pdfLoadFail.status && (pdfRequest ? signerPos.map((data, key) => { @@ -514,7 +514,6 @@ function RenderPdf({ ref={drop} id="container" > - {pdfLoadFail.status && (pdfRequest ? signerPos.map((data, key) => { diff --git a/apps/OpenSign/src/primitives/Alert.js b/apps/OpenSign/src/primitives/Alert.js index 72e3d1458..4a99792f2 100644 --- a/apps/OpenSign/src/primitives/Alert.js +++ b/apps/OpenSign/src/primitives/Alert.js @@ -18,7 +18,7 @@ const Alert = ({ children, type }) => { <> {children && (
{children}
diff --git a/apps/OpenSign/src/primitives/EmailToast.js b/apps/OpenSign/src/primitives/EmailToast.js deleted file mode 100644 index d22293cdc..000000000 --- a/apps/OpenSign/src/primitives/EmailToast.js +++ /dev/null @@ -1,21 +0,0 @@ -import React from "react"; -import "../styles/signature.css"; - -function EmailToast({ isShow }) { - return ( - <> - {isShow && ( -
-
- Email sent successfully! -
-
- )} - - ); -} - -export default EmailToast; diff --git a/apps/OpenSign/src/primitives/Nodata.js b/apps/OpenSign/src/primitives/Nodata.js deleted file mode 100644 index eab59c261..000000000 --- a/apps/OpenSign/src/primitives/Nodata.js +++ /dev/null @@ -1,18 +0,0 @@ -import React from "react"; - -function Nodata() { - return ( -
- No Data Found! -
- ); -} - -export default Nodata; diff --git a/apps/OpenSign/src/routes/Login.js b/apps/OpenSign/src/routes/Login.js index 04c49ac2f..dfe3003aa 100644 --- a/apps/OpenSign/src/routes/Login.js +++ b/apps/OpenSign/src/routes/Login.js @@ -1,6 +1,5 @@ import React, { useEffect, useState } from "react"; import Parse from "parse"; -import "../styles/toast.css"; import "../styles/loader.css"; import { connect } from "react-redux"; import { fetchAppInfo, showTenantName } from "../redux/actions"; @@ -13,6 +12,7 @@ import login_img from "../assets/images/login_img.svg"; import { useWindowSize } from "../hook/useWindowSize"; import ModalUi from "../primitives/ModalUi"; import { modalCancelBtnColor, modalSubmitBtnColor } from "../constant/const"; +import Alert from "../primitives/Alert"; function Login(props) { const navigate = useNavigate(); @@ -20,8 +20,8 @@ function Login(props) { const { width } = useWindowSize(); const [state, setState] = useState({ email: "", - toastColor: "#5cb85c", - toastDescription: "", + alertType: "success", + alertMsg: "", password: "", passwordVisible: false, mobile: "", @@ -354,13 +354,16 @@ function Login(props) { setState({ ...state, loading: false, - toastColor: "#d9534f", - toastDescription: `${error.message}` + alertType: "danger", + alertMsg: `${error.message}` }); - const x = document.getElementById("snackbar"); - x.className = "show"; setTimeout(function () { - x.className = x.className.replace("show", ""); + setState({ + ...state, + loading: false, + alertType: "danger", + alertMsg: "" + }); }, 2000); console.log(error); } @@ -370,13 +373,16 @@ function Login(props) { setState({ ...state, loading: false, - toastColor: "#d9534f", - toastDescription: "Login failed: Invalid username or password." + alertType: "danger", + alertMsg: "Invalid username or password!" }); - const x = document.getElementById("snackbar"); - x.className = "show"; setTimeout(function () { - x.className = x.className.replace("show", ""); + setState({ + ...state, + loading: false, + alertType: "danger", + alertMsg: "" + }); }, 2000); console.error("Error while logging in user", error); }); @@ -647,13 +653,16 @@ function Login(props) { setState({ ...state, loading: false, - toastColor: "#d9534f", - toastDescription: `${error.message}` + alertType: "danger", + alertMsg: `${error.message}` }); - const x = document.getElementById("snackbar"); - x.className = "show"; setTimeout(function () { - x.className = x.className.replace("show", ""); + setState({ + ...state, + loading: false, + alertType: "danger", + alertMsg: "" + }); }, 2000); console.log(error); } @@ -717,13 +726,17 @@ function Login(props) { setState({ ...state, loading: false, - toastColor: "#d9534f", - toastDescription: `Does not have permissions to access this application.` + alertType: "danger", + alertMsg: + "Does not have permissions to access this application!" }); - const x = document.getElementById("snackbar"); - x.className = "show"; setTimeout(function () { - x.className = x.className.replace("show", ""); + setState({ + ...state, + loading: false, + alertType: "danger", + alertMsg: "" + }); }, 2000); } // _currentRole = userRoles[0]; @@ -802,14 +815,16 @@ function Login(props) { setState({ ...state, loading: false, - toastColor: "#d9534f", - toastDescription: - "You don`t have access to this application." + alertType: "danger", + alertMsg: "You don`t have access to this application!" }); - const x = document.getElementById("snackbar"); - x.className = "show"; setTimeout(function () { - x.className = x.className.replace("show", ""); + setState({ + ...state, + loading: false, + alertType: "danger", + alertMsg: "" + }); }, 2000); localStorage.setItem("accesstoken", null); console.error("Error while fetching Follow", error); @@ -1124,14 +1139,7 @@ function Login(props) { )}
- - + {state.alertMsg}
diff --git a/apps/OpenSign/src/routes/PdfRequestFiles.js b/apps/OpenSign/src/routes/PdfRequestFiles.js index dd3ad2023..e1e648226 100644 --- a/apps/OpenSign/src/routes/PdfRequestFiles.js +++ b/apps/OpenSign/src/routes/PdfRequestFiles.js @@ -23,7 +23,6 @@ import { } from "../constant/Utils"; import Loader from "../components/pdf/Loader"; import HandleError from "../primitives/HandleError"; -import Nodata from "../primitives/Nodata"; import Header from "../components/pdf/Header"; import RenderPdf from "../components/pdf/RenderPdf"; import PdfDeclineModal from "../primitives/PdfDeclineModal"; @@ -58,7 +57,6 @@ function PdfRequestFiles() { const [pdfNewWidth, setPdfNewWidth] = useState(); const [pdfOriginalWidth, setPdfOriginalWidth] = useState(); const [signerPos, setSignerPos] = useState([]); - const [noData, setNoData] = useState(false); const [signerObjectId, setSignerObjectId] = useState(); const [isUiLoading, setIsUiLoading] = useState(false); const [isDecline, setIsDecline] = useState({ isDeclined: false }); @@ -295,7 +293,7 @@ function PdfRequestFiles() { setHandleError("Error: Something went wrong!"); setIsLoading(loadObj); } else { - setNoData(true); + setHandleError("No Data Found!"); const loadObj = { isLoad: false }; @@ -977,8 +975,6 @@ function PdfRequestFiles() { ) : handleError ? ( - ) : noData ? ( - ) : (
{isUiLoading && ( diff --git a/apps/OpenSign/src/routes/PlaceHolderSign.js b/apps/OpenSign/src/routes/PlaceHolderSign.js index eba378d28..de66823c2 100644 --- a/apps/OpenSign/src/routes/PlaceHolderSign.js +++ b/apps/OpenSign/src/routes/PlaceHolderSign.js @@ -14,7 +14,6 @@ import loader from "../assets/images/loader2.gif"; import { useLocation, useParams } from "react-router-dom"; import Loader from "../components/pdf/Loader"; import HandleError from "../primitives/HandleError"; -import Nodata from "../primitives/Nodata"; import SignerListPlace from "../components/pdf/SignerListPlace"; import Header from "../components/pdf/Header"; import { @@ -65,7 +64,6 @@ function PlaceHolderSign() { const [checkTourStatus, setCheckTourStatus] = useState(false); const [tourStatus, setTourStatus] = useState([]); const [signerUserId, setSignerUserId] = useState(); - const [noData, setNoData] = useState(false); const [pdfOriginalWidth, setPdfOriginalWidth] = useState(); const [contractName, setContractName] = useState(""); const [containerWH, setContainerWH] = useState(); @@ -274,8 +272,7 @@ function PlaceHolderSign() { setHandleError("Error: Something went wrong!"); setIsLoading(loadObj); } else { - setNoData(true); - + setHandleError("No Data Found!"); const loadObj = { isLoad: false }; @@ -305,8 +302,7 @@ function PlaceHolderSign() { setHandleError("Error: Something went wrong!"); setIsLoading(loadObj); } else if (res.length === 0) { - setNoData(true); - + setHandleError("No Data Found!"); const loadObj = { isLoad: false }; @@ -1315,8 +1311,6 @@ function PlaceHolderSign() { ) : handleError ? ( - ) : noData ? ( - ) : (
{isUiLoading && ( diff --git a/apps/OpenSign/src/routes/Signup.js b/apps/OpenSign/src/routes/Signup.js index faf0e2081..eed8f4bae 100644 --- a/apps/OpenSign/src/routes/Signup.js +++ b/apps/OpenSign/src/routes/Signup.js @@ -7,6 +7,7 @@ import { fetchAppInfo, showTenantName } from "../redux/actions"; import { useNavigate, NavLink } from "react-router-dom"; import login_img from "../assets/images/login_img.svg"; import { useWindowSize } from "../hook/useWindowSize"; +import Alert from "../primitives/Alert"; const Signup = (props) => { const { width } = useWindowSize(); @@ -21,8 +22,8 @@ const Signup = (props) => { const [jobTitle, setJobTitle] = useState(""); const [state, setState] = useState({ loading: false, - toastColor: "#5cb85c", - toastDescription: "" + alertType: "success", + alertMsg: "" }); const [showPassword, setShowPassword] = useState(false); const [lengthValid, setLengthValid] = useState(false); @@ -358,19 +359,18 @@ const Signup = (props) => { } }, (error) => { - /* alert( - "You dont have access to this application." - ); */ setState({ loading: false, - toastColor: "#d9534f", - toastDescription: - "You dont have access to this application." + alertType: "danger", + alertMsg: + "You dont have access to this application!" }); - const x = document.getElementById("snackbar"); - x.className = "show"; setTimeout(function () { - x.className = x.className.replace("show", ""); + setState({ + loading: false, + alertType: "danger", + alertMsg: "" + }); }, 2000); localStorage.setItem("accesstoken", null); console.error("Error while fetching Follow", error); @@ -381,25 +381,29 @@ const Signup = (props) => { } else { setState({ loading: false, - toastColor: "#d9534f", - toastDescription: "User Role Not Found." + alertType: "danger", + alertMsg: "User Role Not Found!" }); - const x = document.getElementById("snackbar"); - x.className = "show"; setTimeout(function () { - x.className = x.className.replace("show", ""); + setState({ + loading: false, + alertType: "danger", + alertMsg: "" + }); }, 2000); } } else { setState({ loading: false, - toastColor: "#d9534f", - toastDescription: "User Role Not Found." + alertType: "danger", + alertMsg: "User Role Not Found!" }); - const x = document.getElementById("snackbar"); - x.className = "show"; setTimeout(function () { - x.className = x.className.replace("show", ""); + setState({ + loading: false, + alertType: "danger", + alertMsg: "" + }); }, 2000); } }) @@ -407,13 +411,16 @@ const Signup = (props) => { console.log("err", err); setState({ loading: false, - toastColor: "#d9534f", - toastDescription: `Does not have permissions to access this application.` + alertType: "danger", + alertMsg: + "Does not have permissions to access this application!" }); - const x = document.getElementById("snackbar"); - x.className = "show"; setTimeout(function () { - x.className = x.className.replace("show", ""); + setState({ + loading: false, + alertType: "danger", + alertMsg: "" + }); }, 2000); }); } @@ -421,13 +428,15 @@ const Signup = (props) => { // alert(`${error.message}`); setState({ loading: false, - toastColor: "#d9534f", - toastDescription: `${error.message}` + alertType: "danger", + alertMsg: `${error.message}` }); - const x = document.getElementById("snackbar"); - x.className = "show"; setTimeout(function () { - x.className = x.className.replace("show", ""); + setState({ + loading: false, + alertType: "danger", + alertMsg: "" + }); }, 2000); console.log(error); } @@ -644,10 +653,7 @@ const Signup = (props) => { )}
- -
- {state.toastDescription} -
+ {state.alertMsg} ) : (
) : handleError ? ( - ) : noData ? ( - ) : (
{isUiLoading && ( diff --git a/apps/OpenSign/src/routes/TemplatePlaceholder.js b/apps/OpenSign/src/routes/TemplatePlaceholder.js index 6a1a855ec..7c6caa857 100644 --- a/apps/OpenSign/src/routes/TemplatePlaceholder.js +++ b/apps/OpenSign/src/routes/TemplatePlaceholder.js @@ -11,7 +11,6 @@ import WidgetComponent from "../components/pdf/WidgetComponent"; import Tour from "reactour"; import Loader from "../components/pdf/Loader"; import HandleError from "../primitives/HandleError"; -import Nodata from "../primitives/Nodata"; import SignerListPlace from "../components/pdf/SignerListPlace"; import Header from "../components/pdf/Header"; import WidgetNameModal from "../components/pdf/WidgetNameModal"; @@ -62,7 +61,6 @@ const TemplatePlaceholder = () => { const [checkTourStatus, setCheckTourStatus] = useState(false); const [tourStatus, setTourStatus] = useState([]); const [signerUserId, setSignerUserId] = useState(); - const [noData, setNoData] = useState(false); const [pdfOriginalWidth, setPdfOriginalWidth] = useState(); const [contractName, setContractName] = useState(""); const [containerWH, setContainerWH] = useState(); @@ -261,8 +259,7 @@ const TemplatePlaceholder = () => { setHandleError("Error: Something went wrong!"); setIsLoading(loadObj); } else { - setNoData(true); - + setHandleError("No Data Found!"); const loadObj = { isLoad: false }; @@ -301,8 +298,7 @@ const TemplatePlaceholder = () => { setHandleError("Error: Something went wrong!"); setIsLoading(loadObj); } else if (res.length === 0) { - setNoData(true); - + setHandleError("No Data Found!"); const loadObj = { isLoad: false }; @@ -1168,8 +1164,6 @@ const TemplatePlaceholder = () => { ) : handleError ? ( - ) : noData ? ( - ) : (
{/* this component used for UI interaction and show their functionality */} diff --git a/apps/OpenSign/src/styles/signature.css b/apps/OpenSign/src/styles/signature.css index 3559b8efc..b126e0082 100644 --- a/apps/OpenSign/src/styles/signature.css +++ b/apps/OpenSign/src/styles/signature.css @@ -169,16 +169,6 @@ box-shadow: 0 2px 4px rgba(154, 36, 36, 0.1), 0 2px 4px rgba(0, 0, 0, 0.18); } -.emailToast { - position: absolute; - z-index: 10; - background: #aeedae; - padding: 0 3px 3px 3px; - margin: 2px; - border-radius: 2px; -} - - .signatureBtn { border: 1.5px solid #47a3ad; diff --git a/apps/OpenSign/src/styles/toast.css b/apps/OpenSign/src/styles/toast.css deleted file mode 100644 index 409833af9..000000000 --- a/apps/OpenSign/src/styles/toast.css +++ /dev/null @@ -1,64 +0,0 @@ -#snackbar { - visibility: hidden; - min-width: 250px; - margin-left: -125px; - background-color: #333; - color: #fff; - text-align: center; - border-radius: 2px; - padding: 16px; - position: fixed; - z-index: 99999; - left: 50%; - top: 30px; - font-size: 14px; -} - -#snackbar.show { - visibility: visible; - -webkit-animation: fadein 0.5s; -} - -@-webkit-keyframes fadein { - from { - top: 0; - opacity: 0; - } - to { - top: 30px; - opacity: 1; - } -} - -@keyframes fadein { - from { - top: 0; - opacity: 0; - } - to { - top: 30px; - opacity: 1; - } -} - -@-webkit-keyframes fadeout { - from { - top: 30px; - opacity: 1; - } - to { - top: 0; - opacity: 0; - } -} - -@keyframes fadeout { - from { - top: 30px; - opacity: 1; - } - to { - top: 0; - opacity: 0; - } -}