diff --git a/.env b/.env index 23bf83b..98c85da 100644 --- a/.env +++ b/.env @@ -1,3 +1,3 @@ -# VITE_BASE_URI="https://officially-powerful-goat.ngrok-free.app" +VITE_BASE_URI="https://officially-powerful-goat.ngrok-free.app" # VITE_BASE_URI="https://python-amused-adder.ngrok-free.app" -VITE_BASE_URI="https://concrete-gladly-mullet.ngrok-free.app" \ No newline at end of file +# VITE_BASE_URI="https://concrete-gladly-mullet.ngrok-free.app" \ No newline at end of file diff --git a/index.html b/index.html index e4b78ea..c118459 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - Vite + React + TS + Sign Made Easy
diff --git a/src/SigningOrderDiagram .tsx b/src/SigningOrderDiagram .tsx index f04f611..a0839ad 100644 --- a/src/SigningOrderDiagram .tsx +++ b/src/SigningOrderDiagram .tsx @@ -58,15 +58,11 @@ const getInitials = (name: string) => { const SigningOrderDiagram : React.FC = (signers) => { - console.log(signers, "Line 59") - const grouped = groupByRoutingOrder(signers.signers); const sortedOrders = Object.keys(grouped) .map(Number) .sort((a, b) => a - b); - console.log("sortedOrders",sortedOrders,grouped) - const currentProcessingOrder = sortedOrders.find((order) => grouped[order].some((signer) => !signer.completed) diff --git a/src/components/CommonNav.tsx b/src/components/CommonNav.tsx index 794f18f..07e52d2 100644 --- a/src/components/CommonNav.tsx +++ b/src/components/CommonNav.tsx @@ -49,7 +49,6 @@ const CommonNav: React.FC = ({ }) => { const activeAccountId = JSON.parse(sessionStorage.getItem('activeAccountId') || 'null'); const userDetails = JSON.parse(sessionStorage.getItem('userDetails') || '{}'); - console.log("activeAccountId", activeAccountId); const [open, setOpen] = useState(false); const [accountsOpen, setAccountsOpen] = useState(false); @@ -70,12 +69,10 @@ const CommonNav: React.FC = ({ }, }); - console.log("user", user) const getAccountDetails = async () => { try { let res = await api.get('/api/user/accounts'); let items = res?.data; - console.log('items', items); const cleanedData: AccountDataArray[] = items.map((item: any) => ({ userId: item.userId, @@ -109,7 +106,6 @@ const CommonNav: React.FC = ({ }; const handleAccountSwitch = (account: any) => { - console.log("handleAccountSwitch", account); // Update sessionStorage sessionStorage.setItem('activeAccountId', JSON.stringify(account.accountId)); @@ -151,7 +147,7 @@ const CommonNav: React.FC = ({ const getUserDetails = async () => { try { let res = await api.get(`/api/user/details`); - console.log("getuser", res); + const item = res?.data; if (item) { const userData = { @@ -166,8 +162,6 @@ const CommonNav: React.FC = ({ }, }; - console.log("userData", userData) - setUser(userData); sessionStorage.setItem('userDetails', JSON.stringify(userData)); sessionStorage.setItem('activeAccountId', JSON.stringify(userData.account.id)); @@ -175,7 +169,6 @@ const CommonNav: React.FC = ({ // Dispatch event for initial load dispatchSessionStorageChange('activeAccountId', userData.account.id); - console.log("Data is saved in sessionStorage"); } } catch (error) { console.error("Error fetching user details:", error); diff --git a/src/components/accounts/Account.tsx b/src/components/accounts/Account.tsx index 5fca92c..01dbe47 100644 --- a/src/components/accounts/Account.tsx +++ b/src/components/accounts/Account.tsx @@ -108,7 +108,6 @@ const Account = () => { JSON.parse(sessionStorage.getItem('activeAccountId') || 'null') ); - console.log("activeAccountId Trans.", activeAccountId) // const { accountId } = useParams<{ accountId: string }>(); const [transactions, setTransactions] = useState([]); const [accountsData, setAccountsData] = useState([]) diff --git a/src/components/accounts/AccountNav.tsx b/src/components/accounts/AccountNav.tsx index ccfc83b..a9098f0 100644 --- a/src/components/accounts/AccountNav.tsx +++ b/src/components/accounts/AccountNav.tsx @@ -42,7 +42,6 @@ const dispatchSessionStorageChange = (key: string, newValue: any) => { const AccountNav: React.FC = ({ accountName = null, transactionName = null }) => { const activeAccountId = JSON.parse(sessionStorage.getItem('activeAccountId') || 'null'); const userDetails = JSON.parse(sessionStorage.getItem('userDetails') || '{}'); - console.log("activeAccountId", activeAccountId); const [open, setOpen] = useState(false); const [accountsOpen, setAccountsOpen] = useState(false); @@ -63,12 +62,10 @@ const AccountNav: React.FC = ({ accountName = null, transaction }, }); - console.log("user", user) const getAccountDetails = async () => { try { let res = await api.get('/api/user/accounts'); let items = res?.data; - console.log('items', items); const cleanedData: AccountDataArray[] = items.map((item: any) => ({ userId: item.userId, @@ -102,7 +99,6 @@ const AccountNav: React.FC = ({ accountName = null, transaction }; const handleAccountSwitch = (account: any) => { - console.log("handleAccountSwitch", account); // Update sessionStorage sessionStorage.setItem('activeAccountId', JSON.stringify(account.accountId)); @@ -146,7 +142,7 @@ const AccountNav: React.FC = ({ accountName = null, transaction const getUserDetails = async () => { try { let res = await api.get(`/api/user/details`); - console.log("getuser", res); + const item = res?.data; if (item) { const userData = { @@ -161,16 +157,12 @@ const AccountNav: React.FC = ({ accountName = null, transaction }, }; - console.log("userData",userData) - setUser(userData); sessionStorage.setItem('userDetails', JSON.stringify(userData)); sessionStorage.setItem('activeAccountId', JSON.stringify(userData.account.id)); // Dispatch event for initial load dispatchSessionStorageChange('activeAccountId', userData.account.id); - - console.log("Data is saved in sessionStorage"); } diff --git a/src/components/accounts/Accounts.tsx b/src/components/accounts/Accounts.tsx index 89e6da3..3537389 100644 --- a/src/components/accounts/Accounts.tsx +++ b/src/components/accounts/Accounts.tsx @@ -99,7 +99,6 @@ const Accounts = () => { const handleAction = async (accountId: string, action: 'accept' | 'reject') => { try { let response = await api.post(`/api/accounts/${accountId}/accept/invite`) - console.log(response) if (response.data.status === 202) { toast.success("Login Successful", { position: "top-center", diff --git a/src/components/accounts/TransactionDataTable.tsx b/src/components/accounts/TransactionDataTable.tsx index 61471d5..3f8d2af 100644 --- a/src/components/accounts/TransactionDataTable.tsx +++ b/src/components/accounts/TransactionDataTable.tsx @@ -25,7 +25,6 @@ const statusColorMap = { const TransactionDataTable = ({activeAccountId}) => { const navigate = useNavigate() const loaction = useLocation() - console.log("loaction", loaction.pathname); const [currentEmailId, setCurrentEmailId] = useState('null'); const [selectedTransactions, setSelectedTransactions] = useState([]); diff --git a/src/components/auth/LoginForm.tsx b/src/components/auth/LoginForm.tsx index 8ad99b8..733933c 100644 --- a/src/components/auth/LoginForm.tsx +++ b/src/components/auth/LoginForm.tsx @@ -6,7 +6,6 @@ import { Link, useNavigate } from "react-router-dom"; import OAuthGoogle from "./OAuthGoogle"; import { Bounce, toast } from "react-toastify"; // import Cookies from "js-cookie"; -import { updateUser } from "../../store/slices/userSlice"; import { useDispatch } from "react-redux"; import { AppDispatch } from "../../store/store"; // import api from "../../config/api"; @@ -27,18 +26,15 @@ function LoginForm() { const handleNextClick = () => { - console.log('Next Button Clicked'); // Validation Starts if (formData.email === "") { - console.log('All Fields are Required'); return; } // Validate Email Format const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; if (!emailRegex.test(formData.email)) { - console.log("Invalid email format"); return; } // Validation Ends @@ -47,18 +43,14 @@ function LoginForm() { axios.get(`${import.meta.env.VITE_BASE_URI}/api/auth/user?email=${formData.email}`, { headers: { "ngrok-skip-browser-warning": "69420" } }) .then((res) => { - console.log(res, "Cache Key res", formData.email) - console.log(res.data, "Cache Key res 2", formData.email) if (res.status === 200) { toast.dismiss(); - console.log('User Exists'); setCacheKey(res.data); setNextClick(true); } }) .catch((err) => { - console.log('User Does Not Exists'); toast.dismiss(); toast.error("User Does Not Exists", { position: "top-center", @@ -76,25 +68,20 @@ function LoginForm() { } const handleFormLoginClick = () => { - console.log('Login Function Called Line 7 LoginForm.tsx'); // Validation Starts if (formData.email === "" || formData.password === "") { - console.log('All Fields are Required'); return; } // Validate Email Format const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; if (!emailRegex.test(formData.email)) { - console.log("Invalid email format"); return; } // Validation Ends // Login API Call - console.log('Login API Call'); - console.log(formData, "Submitting Data :", { cacheKey: cacheKey, password: formData.password }); axios.post(`${import.meta.env.VITE_BASE_URI}/api/auth/login`, { cacheKey: cacheKey, password: formData.password }, { @@ -106,11 +93,9 @@ function LoginForm() { } ) .then((res) => { - console.log(res.status, "Response Status Line 42 LoginForm.tsx", res); if (res.status === 200) { toast.dismiss(); - // console.log('User Logined Successfully Line 45 LoginForm.tsx headerCookie:', res.headers.authorization); // Cookies.set("authorization", res.headers.authorization, { // path: "/", // secure: true, // Required for HTTPS @@ -133,9 +118,7 @@ function LoginForm() { } }) .catch((err) => { - console.log(err, "ERROR") if (err.status === 401) { - console.log('Unauthorized'); toast.dismiss(); toast.error("Credentials Not Match", { position: "top-center", @@ -149,7 +132,6 @@ function LoginForm() { transition: Bounce, }); } else { - console.log('Some Error Occurred'); toast.dismiss(); toast.error("Some Error Occurred", { position: "top-center", @@ -207,7 +189,7 @@ function LoginForm() {

or login with social platforms

- +
diff --git a/src/components/auth/OAuthGoogle.tsx b/src/components/auth/OAuthGoogle.tsx index 9d2de8b..29a4234 100644 --- a/src/components/auth/OAuthGoogle.tsx +++ b/src/components/auth/OAuthGoogle.tsx @@ -19,16 +19,14 @@ interface OAuthGoogleProps { isLogin: boolean } -const OAuthGoogle: React.FC = ({isLogin}) => { +const OAuthGoogle: React.FC = ({ isLogin }) => { const dispatch = useDispatch(); const navigate = useNavigate(); // Define the success handler type (based on the Google login response) const responseMessage = (response: GoogleResponse) => { - console.log(response, "OAuthGoogle .tsx Line 23 Response from Google"); const token = response.credential; - console.log(token, 'token'); axios.get(`${import.meta.env.VITE_BASE_URI}/api/oauth2/authorization/google?token=${token}`, { headers: { @@ -38,7 +36,6 @@ const OAuthGoogle: React.FC = ({isLogin}) => { .then((res) => { if (res.status === 200 || res.status === 201) { toast.dismiss(); - console.log('User Logined Successfully Line 45 LoginForm.tsx headerCookie:', res.headers.authorization); dispatch(updateUser({ ...res.data, authorized: true, accessToken: res.headers.authorization })); @@ -52,8 +49,6 @@ const OAuthGoogle: React.FC = ({isLogin}) => { const decoded = jwtDecode(token); - - console.log(decoded, 'decoded'); }; // Define the error handler type (error can be of any type) diff --git a/src/components/auth/RegisterForm.tsx b/src/components/auth/RegisterForm.tsx index 5fca512..6e02a69 100644 --- a/src/components/auth/RegisterForm.tsx +++ b/src/components/auth/RegisterForm.tsx @@ -22,14 +22,12 @@ interface FormDataState { function RegisterForm() { - console.log("RegisterForm Component Rendered"); const [formData, setForm] = useState({ email: "", password: "", confirmPassword: "", firstName: "", lastName: "" }); const dispatch = useDispatch(); const navigate = useNavigate(); const handleFormRegisterClick = () => { - console.log('Register Function Called Line 7 RegisterForm.tsx'); formData.firstName = formData.firstName.trim(); formData.lastName = formData.lastName.trim(); // Validation Starts @@ -48,7 +46,6 @@ function RegisterForm() { // Register API Call - console.log('Register API Call'); console.dir(formData); axios.post(`${import.meta.env.VITE_BASE_URI}/api/auth/signup`, { firstName: formData.firstName, lastName: formData.lastName, email: formData.email, password: formData.password }, { @@ -59,10 +56,8 @@ function RegisterForm() { } }) .then((res) => { - console.log(res.status, "Response Status Line 42 RegisterForm.tsx"); if (res.status === 201) { - console.log(res, "line 58"); toast.dismiss(); // dispatch(updateUser({ ...res.data, authorized: true, accessToken: res.headers.authorization })); // dispatch(updateUser({ ...res.data, authorized: true })); @@ -71,7 +66,6 @@ function RegisterForm() { }) .catch((err) => { if (err.status === 409) { - console.log('User Already Exists'); toast.dismiss(); toast.error("User Already Exists", { position: "top-center", @@ -85,7 +79,6 @@ function RegisterForm() { transition: Bounce, }); } else { - console.log('Some Error Occurred'); toast.dismiss(); toast.error("Some Error Occurred", { position: "top-center", diff --git a/src/components/client/DocumentPages.tsx b/src/components/client/DocumentPages.tsx index 64532e7..ea4cf05 100644 --- a/src/components/client/DocumentPages.tsx +++ b/src/components/client/DocumentPages.tsx @@ -1,32 +1,40 @@ -import React from 'react' -import { MdKeyboardArrowDown } from 'react-icons/md'; +import React, { useState } from 'react' +import { MdKeyboardArrowDown, MdOutlineNavigateNext } from 'react-icons/md'; +import { DocumentType } from './SignDocument'; +import { GrFormPrevious } from 'react-icons/gr'; interface DocumentPagesInterface { - selectedDocuments: DocumentType[]; + selectedDocuments: DocumentType[] | null; setDropDownTogglePage: React.Dispatch>; dropDownTogglePage: string; } const DocumentPages = ({ selectedDocuments, setDropDownTogglePage, dropDownTogglePage }: DocumentPagesInterface) => { + + const [currentPage, setCurrentPage] = useState(0); + return ( -
+
{selectedDocuments && selectedDocuments.length && selectedDocuments.map((document, indx) => { - return ( + return (
setDropDownTogglePage('')} >
(`${(dropDownTogglePage === 'pageDropDown' + indx) ? '' : 'pageDropDown' + indx}`)} + onClick={() => { + setDropDownTogglePage(`${(dropDownTogglePage === 'pageDropDown' + indx) ? '' : 'pageDropDown' + indx}`) + } + } className={`p-2 ${(dropDownTogglePage === 'pageDropDown' + indx) ? "bg-[var(--primary)]" : "bg-slate-200"} flex flex-col justify-center items-center gap-2 rounded`}> { document.pages != undefined && } @@ -40,15 +48,53 @@ const DocumentPages = ({ selectedDocuments, setDropDownTogglePage, dropDownToggl { dropDownTogglePage === 'pageDropDown' + indx && -
- {document.pages != undefined && document.pages.map((img, indx) => ( - -

{indx + 1}

-
- ))} +
+ {/* Prev Button */} + { + if (currentPage === 0) e.preventDefault(); + else setCurrentPage(currentPage - 1); + }} + > + + + + {/* Page Selector */} + + + + / {document.pages?.length} + + + {/* Next Button */} + { + if (currentPage === document.pages?.length - 1) e.preventDefault(); + else setCurrentPage(currentPage + 1); + }} + > + +
} diff --git a/src/components/client/SignDocument.tsx b/src/components/client/SignDocument.tsx index a8a02e2..89fed20 100644 --- a/src/components/client/SignDocument.tsx +++ b/src/components/client/SignDocument.tsx @@ -1,9 +1,9 @@ -import { useEffect, useLayoutEffect, useState } from "react"; +import { useEffect, useState } from "react"; import axios from "axios" import { RootState } from "../../store/store"; import { useNavigate, useParams } from "react-router-dom" -import { DroppedItem, DroppedItemsObj, TagsTypes } from "../../utlity/types"; +import { DroppedItem, TagsTypes } from "../../utlity/types"; import Loader from "../dashboard/Loader"; import SignCon from "../signature/SignCon"; @@ -11,24 +11,22 @@ import { Bounce, toast } from "react-toastify"; import { useDispatch, useSelector } from "react-redux"; import { hideLoader, showLoader } from "../../store/slices/loaderSlice"; -import { FaRegImage, FaFileAlt, FaSignature, FaStamp, FaCheck, FaQuestionCircle } from 'react-icons/fa' +import { FaFileAlt, FaSignature, FaStamp, FaCheck, FaQuestionCircle } from 'react-icons/fa' import { IoIosDocument, IoMdClose } from 'react-icons/io' import { MdKeyboardArrowDown } from 'react-icons/md' -import { TbChevronsDownLeft, TbSignature } from "react-icons/tb"; +import { TbSignature } from "react-icons/tb"; import { BsFileArrowDownFill } from "react-icons/bs"; import dayjs from "dayjs"; import maskUtils from "../../utlity/maskUtils"; import StampUpload from "../stamp/StampUpload"; -import TermsModal from "./TermsModal"; import DocumentPages from "./DocumentPages"; import FieldList from "../process/processStepTwo/FieldList"; import typeToIconMap from "../../helper/iconMap"; -import { droppedTagsDefaultField } from "../process/processStepTwo/DocumentContainer"; import SignCompletionScreen from "./SignCompletionScreen"; import api from "../../config/api"; -import RightSideBar from "../process/processStepTwo/rightSideBar/RightSideBar"; import { RiDragMoveFill } from "react-icons/ri"; import { handleGroupBorderPosition } from "../../utlity/tagGroupConUtils"; +import RightSideBar from "../process/processStepTwo/rightSideBar/RightSideBar"; @@ -45,6 +43,7 @@ interface RecipientType { phone: string | null; index: number; type: string; + provideOwnTags: boolean; recipientStatus: string; authType: string | null; language: string | null; @@ -59,7 +58,7 @@ interface pagesType { height: number; width: number; } -interface DocumentType { +export interface DocumentType { documentId: string; pages: pagesType[]; name: string; @@ -134,6 +133,11 @@ const fitObj = [ }, ] +enum RightSideNav { + ATTRIBUTES = "attributes", + PAGES = "pages" +} + // Functions - LIST // handleSignClick - Handle when sign || Initial tag got clicked // fetchData - Fetch document pages and tags data @@ -141,7 +145,6 @@ const fitObj = [ const SignDocument = () => { - const { recipientId } = useParams(); const dispatch = useDispatch(); @@ -158,7 +161,7 @@ const SignDocument = () => { const [stamp, setStamp] = useState({ open: false, blob: "" }); - console.log(recSignStatus, "recSignStatus") + const [rightSideNavToggle, setRightSideNavToggle] = useState(RightSideNav.PAGES); // Handling Date Opacity const [dateValues, setDateValues] = useState<{ [key: string]: string }>({}); @@ -232,8 +235,6 @@ const SignDocument = () => { }, [droppedItems]) - console.log(droppedItems, "{droppedItems[selectedTag.key][selectedTag.index]}") - useEffect(() => { if (recSignStatus === "COMPLETED") { // setHideTags(true); @@ -352,6 +353,8 @@ const SignDocument = () => { setTransaction(res?.data?.transaction) setRecSignStatus(res?.data?.status) + if (res?.data?.details.provideOwnTags) setRightSideNavToggle(RightSideNav.ATTRIBUTES) + if ("provideOwnTags" in res?.data?.details && res?.data?.details.provideOwnTags) { setProvideTags(true) } @@ -372,9 +375,23 @@ const SignDocument = () => { }); } - + const handleToastError = (msg: string) => { + toast.dismiss(); + toast.error(msg, { + position: "top-center", + autoClose: 5000, + hideProgressBar: false, + closeOnClick: false, + pauseOnHover: true, + draggable: true, + progress: undefined, + theme: "light", + transition: Bounce, + }); + } const handleFormSubmit = () => { + // e.preventDefault(); const submitData: TagsSubmitDataObj = { tags: [] @@ -398,37 +415,14 @@ const SignDocument = () => { } } - if (signInitialsCount !== Object.keys(signConfObj).length) { - toast.error("Please ensure all signature and initials are signed", { - position: "bottom-right", - autoClose: 5000, - hideProgressBar: false, - closeOnClick: false, - pauseOnHover: true, - draggable: true, - progress: undefined, - theme: "light", - transition: Bounce, - }); + handleToastError("Please ensure all signature and initials are signed") return; } for (const tag of droppedItems) { - - // if ((tag.type === "SIGNATURE" || tag.subType === "INITIALS") && !tag.value) { - if (("required" in tag && tag.required) && ((tag.type !== "SIGNATURE" && tag.type !== "INITIALS") && (tag.value === "" || !("value" in tag)))) { - toast.error(`${tag.label} is required`, { - position: "bottom-right", - autoClose: 5000, - hideProgressBar: false, - closeOnClick: false, - pauseOnHover: true, - draggable: true, - progress: undefined, - theme: "light", - transition: Bounce, - }); + if ("required" in tag && tag.required && ((tag.type !== "SIGNATURE" && tag.type !== "INITIALS") && (tag.value === undefined || tag.value === null || tag.value === "" || !("value" in tag)))) { + handleToastError(`${tag.label} is required`) return; } @@ -453,39 +447,7 @@ const SignDocument = () => { } } - // for (const tag of tagJson) { - // if (data[tag.id as string]) { - // const tagData: TagSubmitData = { - // id: tag.id as string, - // type: tag.type, - // subType: tag.subType ? tag.subType : "", - // signed: true, - // value: data[tag.id as string] as string - // } - // submitData.tags.push(tagData) - // } - - // if (tag.type === "SIGNATURE") { - // submitData.tags.push({ - // id: tag.id as string, - // type: "SIGNATURE", - // subType: "DRAW", - // signed: true, - // value: "" - // }) - // } - - // if (tag.type === "INITIALS") { - // submitData.tags.push({ - // id: tag.id as string, - // type: "INITIALS", - // subType: "DRAW", - // signed: true, - // value: "" - // }) - // } - - // } + // return; dispatch(showLoader("Signing ...")); axios.post(`${import.meta.env.VITE_BASE_URI}/api/sign?recipientId=${recipientId}`, submitData, { headers: { "ngrok-skip-browser-warning": "69420", } }) @@ -608,6 +570,58 @@ const SignDocument = () => { } + const handlePrefillValues = () => { + const prefilledTags = ["NAME", "EMAIL", "TEXT", "COMPANY", "TEMPORAL"] + + const updatedItems = droppedItems.map((item, index) => { + if (prefilledTags.includes(item.type)) { + + let value = null; + let isUpdate = false + + switch (item.type) { + case "NAME": + value = recipient?.firstName + " " + recipient?.lastName; + isUpdate = true; + break; + case "EMAIL": + value = recipient?.email; + isUpdate = true; + break; + case "TEXT": + value = item.value; + isUpdate = true; + break; + case "COMPANY": + value = item.value; + isUpdate = true; + break; + case "TEMPORAL": + if (item.currentTimeStamp) isUpdate = true; + if (isUpdate) { + value = dayjs(Date.now()).format(item.format); + } + break; + default: + break; + } + return { ...item, value } + } else { + return item + } + }) + + setDroppedItems(updatedItems); + } + + + useEffect(() => { + if (droppedItems.length > 0) { + handlePrefillValues(); + } + }, [droppedItems.length]) + + // HANDLE DROP - START const handleDrop = (event: React.DragEvent, docId: string, documentId: number, pageIndex: number) => { event.preventDefault(); @@ -689,7 +703,7 @@ const SignDocument = () => { isDeleted: false } - if(prepData.type === "NAME") { + if (prepData.type === "NAME") { prepData.firstName = true prepData.lastName = true } @@ -848,18 +862,13 @@ const SignDocument = () => { // Updated handleRemoveTag function with your existing API logic and group handling const handleRemoveTag = (key: string, targetIndex: number) => { - - console.log("Removing tag:", key, targetIndex, droppedItems); - const tag: DroppedItem = droppedItems[targetIndex]; const recipientId = tag.recipientId; - console.log(tag, "line 776"); - (async () => { if ("id" in tag) { try { - const response = await api.delete(`/api/sign/tags?recipientId=${recipientId}`, { data: [ { tagId: tag.id } ] }) + const response = await api.delete(`/api/sign/tags?recipientId=${recipientId}`, { data: [{ tagId: tag.id }] }) if (response.status !== 200) throw "Tag Deletion error" } catch (err) { return; @@ -927,7 +936,6 @@ const SignDocument = () => { // }, 100); } } else { - console.log("Listening to 895") // Handle non-group item removal (your existing logic) setDroppedItems(prevState => prevState.filter((item, idx) => { return idx !== targetIndex; @@ -936,7 +944,10 @@ const SignDocument = () => { })() }; - console.log(droppedItems, "droppedItems Line 934") + + const handleSetIsFields = (setTo: boolean) => { + if (setTo !== isFields) setIsFields(setTo); + } // const [showTerms, setShowTerms] = useState(true); @@ -990,6 +1001,19 @@ const SignDocument = () => {
{/* FIT - END */} + {provideTags &&
handleSetIsFields(true)} + className={`flex items-center gap-1 cursor-pointer text-xs px-2 py-1 rounded-sm ${isFields ? 'bg-slate-100' : ''}`}> + +

Fields

+
} + +
handleSetIsFields(provideTags ? false : !isFields)} + className={`flex items-center gap-1 cursor-pointer text-xs px-2 py-1 rounded-sm ${!isFields ? 'bg-slate-100' : ''}`}> + +

Pages

+
@@ -1032,10 +1056,11 @@ const SignDocument = () => { {/* Send */} {(!transparentTags && !hideTags) ? -
- -
- ); -}; - -export default RecipientAddCard; \ No newline at end of file diff --git a/src/components/process/processStepOne/DocumentCard.tsx b/src/components/process/processStepOne/DocumentCard.tsx index 394eb5f..264371a 100644 --- a/src/components/process/processStepOne/DocumentCard.tsx +++ b/src/components/process/processStepOne/DocumentCard.tsx @@ -39,11 +39,10 @@ const DocumentCard: React.FC = ({ id, name, isCompleted , tra let lastUpdate = 0; const delay = 1000; - const docProgSSE = new EventSource(`http://192.168.2.112:8083/api/progress/${id}`); + const docProgSSE = new EventSource(`http://192.168.2.176:8083/api/progress/${id}`); docProgSSE.addEventListener('progress', (event) => { const jsonData = JSON.parse(event.data); - console.log(jsonData, "Kaboom"); if (jsonData.isComplete) { isCompleted = true; @@ -87,8 +86,6 @@ const DocumentCard: React.FC = ({ id, name, isCompleted , tra }; }, [id]); - console.log(isCompleted, "line 118") - const radius = 28 const circumference = 2 * Math.PI * radius const offset = circumference - (progress / 100) * circumference @@ -103,7 +100,6 @@ const DocumentCard: React.FC = ({ id, name, isCompleted , tra if (res.status === 202) { dispatch(deleteDocument(docId)); setDocumentDel({ docId: null, isDel: false }); - console.log("Document deleted successfully"); } } diff --git a/src/components/process/processStepOne/ProcessStepOne.tsx b/src/components/process/processStepOne/ProcessStepOne.tsx index 12fdb01..0b3dbe0 100644 --- a/src/components/process/processStepOne/ProcessStepOne.tsx +++ b/src/components/process/processStepOne/ProcessStepOne.tsx @@ -31,7 +31,7 @@ const ProcessStepOne = () => { const templateId = useParams<{ templateId: string }>().templateId; let { accountId, transactionId } = useParams<{ accountId: string, transactionId: string }>(); const [searchParams] = useSearchParams(); - console.log("searchParams", searchParams.get('useTemplate')) + const isTamplate = searchParams.get('useTemplate') const navigate = useNavigate(); @@ -47,22 +47,11 @@ const ProcessStepOne = () => { const [editCase, setEditCase] = useState("") const [editRecipient, setEditRecipient] = useState({}) - - - // if (!accountId || !transactionId) { - // window.location.href = "/"; - // return null; - // } - - // const selectedDocuments = useSelector((state: RootState) => state.selectedDocuments.selectedDocuments) - // const { selectedDocuments, signType } = useSelector((state: RootState) => state.selectedDocuments) - const selectedDocuments = useSelector((state: RootState) => state.documents.documents) const selectedRecipients = useSelector((state: RootState) => state.selectedRecipients.recipients) const [showSelfSignWarnModal, setShowSelfSignWarnModal] = useState(false) const [editRecipientCurrentEmail, setEditRecipientCurrentEmail] = useState('') - console.log() const userData = useSelector((state: RootState) => state.user) // ProcessStepOne.tsx const topRef = useRef(null); @@ -83,15 +72,9 @@ const ProcessStepOne = () => { }, 5000); // hide icon while typing, show it again after 500ms of no input }; - // const userData = useSelector((state: RootState) => state.user) - const [transactionDetails, setTransactionDetails] = useState([]); - console.log("selectedRecipients", selectedRecipients) - useEffect(() => { - // <<<<<<< HEAD - // Fetching Transaction Details - START (async () => { try { const res = await api.get(`/api/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}`); @@ -105,38 +88,27 @@ const ProcessStepOne = () => { { subject: res.data.subject ? res.data.subject : "Documents for Signature", message: res.data.message ? res.data.message : "" } ) - // console.log("setTransactionDetails",res.data) } catch (e) { - console.log("Error - transactions details") } })() - // Fetching Transaction Details - END - - // ======= - // (async () => { - // const res = await api.get(`/api/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}`) - // console.log(res.data); - // })() - // >>>>>>> origin/main - - // (async () => { - // const res = await api.get(`/api/accounts/${accountId}/${transactionTemplateToggle}/${transactionId}`) - // console.log(res.data); - // })() selectedRecipients.length === 0 && dispatch(fetchRecipients({ accountId, transactionId })); selectedDocuments.length === 0 && dispatch(fetchDocuments({ accountId, transactionId })); }, []) - // const signingOrder = useSelector((state: RootState) => state.selectedRecipients.signingOrder) - // const user = useSelector((state: RootState) => state.user) - const [emailDtls, setEmailDtls] = useState({ subject: "Documents for Signature", message: "" }); useEffect(() => { dispatch(hideLoader()); }, []) + + const getMinRoutingOrder = () => { + return selectedRecipients.reduce((min, recipient) => { + return Math.min(min, recipient.routingOrder ?? Infinity); + }, Infinity); + }; + const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); const handleNextClick = async (saveAndClose: boolean = false) => { @@ -172,7 +144,6 @@ const ProcessStepOne = () => { if (SignTypeEnum.selfSign === signType) formError.recipients = false; if (formError.documents || formError.recipients || formError.subject || formError.recipientEmailAndLastName) { - console.log(selectedDocuments, 'line 193') toast.dismiss(); toast.error(`${formError.documents ? "Add Document" : ""} ${(formError.documents && formError.recipients) ? " | " : ""} @@ -216,10 +187,17 @@ const ProcessStepOne = () => { dispatch(showLoader("Processing Recipients...")); + let minRoutingOrder = getMinRoutingOrder(); + // selectedRecipients.forEach((recipient) => { + // if (recipient.routingOrder ?? 1 < minRoutingOrder) { + // minRoutingOrder = recipient.routingOrder ?? 1; + // } + // }); + const recipientsData = selectedRecipients.map((recipient, index) => ({ id: "id" in recipient ? recipient.id : null, routingOrder: "routingOrder" in recipient && recipient.routingOrder ? recipient.routingOrder : 1, - provideOwnTags: userData.email === recipient.email ? true : false, + provideOwnTags: userData.email === recipient.email && (recipient.routingOrder ?? 1) === minRoutingOrder ? true : false, type: recipient.type, firstName: recipient.firstName, lastName: recipient.lastName, @@ -249,11 +227,10 @@ const ProcessStepOne = () => { await Promise.all( selectedRecipients.map((recipient) => dispatch(removeRecipientAsync({ recipientId: recipient.id, - email: recipient.email, accountId, transactionId, - })) - ) + email: recipient.email, + }))) ); recipientsDataTemp = [{ @@ -274,9 +251,11 @@ const ProcessStepOne = () => { phone: "", accessCode: "", accessCodeDelivery: true, - language: "en", + language: userData.language ? userData.language : "en", name: `${userData.firstName} ${userData.lastName}`, - roleName: "" + roleName: "", + allowSenderToEdit: true, + allowSenderToDelete: true, }] try { @@ -288,7 +267,8 @@ const ProcessStepOne = () => { } } else { - await dispatch(addRecipientAsync({ recipientsData: recipientsDataTemp, accountId, transactionId })); + if(!accountId || !transactionId) return; + dispatch(addRecipientAsync({ recipientsData: recipientsDataTemp, accountId, transactionId })); } dispatch(showLoader("Processing Message...")); @@ -298,11 +278,6 @@ const ProcessStepOne = () => { status: "CREATED" }) - // if (isSendNow) { - // dispatch(updateTransactionStatus(TRANSACTION_STATUS_ENUMS.TRANSACTION_SEND_SUCCESS)); - // } - // else { - // setTimeout(() => { dispatch(resetDocuments()) dispatch(resetRecipients()) if (transactionTemplateToggle === TRANSACTION_TEMPLATE_TOGGLE.TEMPLATES) { @@ -447,13 +422,13 @@ const ProcessStepOne = () => { (signType !== SignTypeEnum.selfSign || showSelfSignWarnModal) &&
- +
- +
@@ -479,7 +454,7 @@ const ProcessStepOne = () => { {/* Message */}
- + + : handlePropertyChange("value", textValue)} + id="textValue" + value={textValue} + className="outline-none border-1 rounded px-2 py-1 border-slate-200" + onChange={e => setTextValue(e.target.value)} + /> + } +
+ ) +} + +export default TextValueFIll \ No newline at end of file diff --git a/src/components/process/processStepTwo/rightSideBar/attributes/ToolTipAttr.tsx b/src/components/process/processStepTwo/rightSideBar/attributes/ToolTipAttr.tsx new file mode 100644 index 0000000..48d7e6a --- /dev/null +++ b/src/components/process/processStepTwo/rightSideBar/attributes/ToolTipAttr.tsx @@ -0,0 +1,23 @@ +import React from 'react' + +interface ToolTipAttrInt { + tooltip: string; + handlePropertyChange: (changeTo: string, changeWith: string | boolean | number) => void; +} + +const ToolTipAttr: React.FC = ({ tooltip, handlePropertyChange }) => { + return ( + <> +
+ + handlePropertyChange('tooltip', e.target.value)} + type="text" + className="outline-none border-1 rounded px-2 py-1 border-slate-200" /> +
+ + ) +} + +export default ToolTipAttr \ No newline at end of file diff --git a/src/components/routes_helper/PageGuard.tsx b/src/components/routes_helper/PageGuard.tsx index ddfdf16..17193df 100644 --- a/src/components/routes_helper/PageGuard.tsx +++ b/src/components/routes_helper/PageGuard.tsx @@ -4,8 +4,6 @@ import { useParams } from 'react-router-dom' const PageGuard = () => { const allowedPages = ["settings", "contacts"] - console.log("Allowed Pages: ", allowedPages) - const {page1} = useParams<{page1: string}>() if (page1 && !allowedPages.includes(page1)) { return
Access Denied
diff --git a/src/components/setting/Setting.tsx b/src/components/setting/Setting.tsx index c479cb0..3ce7b7b 100644 --- a/src/components/setting/Setting.tsx +++ b/src/components/setting/Setting.tsx @@ -43,9 +43,7 @@ interface AccountOption { const Setting = () => { const { page1 } = useParams<{ page1: string }>(); - console.log("page1", page1) const location = useLocation(); - console.log("location", location) const navigate = useNavigate(); const [activeAccountId, setActiveAccountId] = useState( @@ -310,7 +308,6 @@ const Setting = () => { // Set initial subsection when component mounts or activeTab changes useEffect(() => { const subSections = getSubSections(activeTab); - console.log("subSections", subSections) const hash = location.hash.replace('#', ''); if (subSections.length > 0) { @@ -345,23 +342,19 @@ const Setting = () => { let res; let toastMesaage; if (action === 'create') { - console.log('Creating account:', data); const payloadAccount = { name: data.accountName } res = await api.post(`/api/user/accounts`, payloadAccount) - console.log("resAccountName", res) if (res.status === 201) { toastMesaage = `${action.toUpperCase()} Created Successfull...!` } } else if (action === 'invite') { - console.log('Inviting user:', data); const payloadInvite = { email: data.email, role: data.role } res = await api.post(`/api/accounts/${data.i_accountName}/invite`, payloadInvite) - console.log("InviteNAme", res) toastMesaage = "Invite Successfull...!" } diff --git a/src/components/setting/Signature/AddSignatureModal.tsx b/src/components/setting/Signature/AddSignatureModal.tsx index 54e7e30..3c85cc2 100644 --- a/src/components/setting/Signature/AddSignatureModal.tsx +++ b/src/components/setting/Signature/AddSignatureModal.tsx @@ -55,7 +55,6 @@ const AddSignatureModal: React.FC = ({ getAllSignatures, editingSignature }) => { - console.log("editingSignature", editingSignature) const [activeTab, setActiveTab] = useState<'SELECT' | 'DRAW' | 'UPLOAD'>('SELECT'); const [fullName, setFullName] = useState(''); const [initials, setInitials] = useState(''); @@ -82,8 +81,6 @@ const AddSignatureModal: React.FC = ({ signatureOptions.length > 0 ? { id: signatureOptions[0].id, style: signatureOptions[0].style } : { id: 0, style: "" } ); - console.log("selectedSignature", selectedSignature) - // Store the actual file const [file1, setFile1] = useState(null); const [file2, setFile2] = useState(null); @@ -119,7 +116,7 @@ const AddSignatureModal: React.FC = ({ useEffect(() => { if (editingSignature) { setFullName(`${editingSignature.firstName} ${editingSignature.lastName}`); - setInitials(`${editingSignature.firstName.slice(0, 1)}${editingSignature.lastName.slice(0, 1)}`); + setInitials((`${editingSignature.firstName.slice(0, 1)}${editingSignature.lastName.slice(0, 1)}`).toUpperCase()); setActiveTab(editingSignature.signatureType as 'SELECT' | 'DRAW' | 'UPLOAD'); // Set font for SELECT tab @@ -230,8 +227,6 @@ const AddSignatureModal: React.FC = ({ payload.initialsBase64 = signatures.initials; } - console.log("payload214", payload); - let res; if (isEditMode && editingSignature) { // Update existing signature @@ -240,7 +235,6 @@ const AddSignatureModal: React.FC = ({ signatureId: editingSignature.id }; res = await api.put(`/api/user/signatures`, updatePayload); - console.log("handleUpdate", res); toast.success("Signature Updated Successfully", { position: "top-center", @@ -256,7 +250,6 @@ const AddSignatureModal: React.FC = ({ } else { // Create new signature res = await api.post(`/api/user/signatures`, payload); - console.log("handleSubmit", res); toast.success("Signature Created Successfully", { position: "top-center", @@ -451,7 +444,7 @@ const AddSignatureModal: React.FC = ({ const getUserDetails = async () => { try { let res = await api.get(`/api/user/details`); - console.log("getuser", res); + let currUser = res?.data; setUser(currUser); @@ -564,7 +557,7 @@ const AddSignatureModal: React.FC = ({ > {checked && }
- Signature will be used by default + Save as default signature
@@ -686,7 +679,7 @@ const AddSignatureModal: React.FC = ({ > {checked && }
- Signature will be used by default + Save as default signature diff --git a/src/components/setting/Signature/Signature.tsx b/src/components/setting/Signature/Signature.tsx index e24d04f..d3924f8 100644 --- a/src/components/setting/Signature/Signature.tsx +++ b/src/components/setting/Signature/Signature.tsx @@ -43,7 +43,6 @@ const SignatureManager: React.FC = () => { setLoading(true) try { let res = await api.get("/api/user/signatures") - console.log("getAllSignatures", res.data) let signatureData = res?.data setSignatures(signatureData) } catch (error) { @@ -58,9 +57,7 @@ const SignatureManager: React.FC = () => { }, []) const handleEdit = (id: string) => { - console.log('Edit signature:', id); let editSignature = signatures.find((item) => item.id === id); - console.log("editSignature", editSignature); if (editSignature) { setEditingSignature(editSignature); @@ -74,7 +71,7 @@ const SignatureManager: React.FC = () => { setLoading(true) try { let res = await api.delete(`/api/user/signatures/${id}`) - console.log(res.data) + toast.success("Signature Delete Successfull", { position: "top-center", autoClose: 500, @@ -115,8 +112,6 @@ const SignatureManager: React.FC = () => { const selectedFont = signatureOptions.find(opt => opt.style === font); const fontClass = `${selectedFont?.style || 'print'}`; - console.log("fontClass",fontClass) - if (mode === 'initials') { const initials = `${(firstName?.[0] ?? '')}${(lastName?.[0] ?? '')}`.toUpperCase(); diff --git a/src/components/signature/SignCon.tsx b/src/components/signature/SignCon.tsx index d218874..00660f7 100644 --- a/src/components/signature/SignCon.tsx +++ b/src/components/signature/SignCon.tsx @@ -120,8 +120,6 @@ const AddSignatureModal: React.FC = ({ }, }); - console.log("User data", user) - const [selectedSignature, setSelectedSignature] = useState( signatureOptions.length > 0 ? { id: signatureOptions[0].id, style: signatureOptions[0].style } : { id: 0, style: "" } ); @@ -174,7 +172,6 @@ const AddSignatureModal: React.FC = ({ signature: signatureBlob, initial: initialsBlob, }); - console.log("saved Called Line 174") } } setPreSaveSignatures(preSavedSignatures) @@ -225,7 +222,6 @@ const AddSignatureModal: React.FC = ({ const handleSubmit = async () => { setIsSubmitting(true); - console.log("handleSubmit Called") if (!signatures.fullSignature || !signatures.initials) { alert('Please provide both signature and initials'); setIsSubmitting(false); @@ -245,7 +241,6 @@ const AddSignatureModal: React.FC = ({ font: selectedSignature.style }; - console.log("payload", payload) // if (isEditMode && editingSignature) { // // Update existing signature // const updatePayload = { @@ -275,7 +270,6 @@ const AddSignatureModal: React.FC = ({ "ngrok-skip-browser-warning": "69420" } }); - console.log("handleSubmit", res); toast.success("Signature Created Successfully", { position: "top-center", @@ -787,7 +781,7 @@ const AddSignatureModal: React.FC = ({ // let currUser = res?.data; setUser(recipient); setFullName(recipient.firstName + " " + recipient.lastName); - setInitials(recipient.firstName.slice(0, 1) + recipient.lastName.slice(0, 1)); + setInitials((recipient.firstName.slice(0, 1) + recipient.lastName.slice(0, 1)).toUpperCase()); } catch (error) { console.error("Error fetching user details:", error); } diff --git a/src/components/signature_pad/InitialCon.tsx b/src/components/signature_pad/InitialCon.tsx index cb8ee93..9acd0ea 100644 --- a/src/components/signature_pad/InitialCon.tsx +++ b/src/components/signature_pad/InitialCon.tsx @@ -13,7 +13,6 @@ interface InitialConProps { const InitialCon: React.FC = ({ openInitial, setOpenInitial, savedInitial, setSavedInitial }) => { const handleSaveInitial = (signatureDataUrl: string) => { - console.log(signatureDataUrl, "savedInitial ------ 123"); setSavedInitial(signatureDataUrl); setOpenInitial(false) diff --git a/src/components/signature_pad/SignatureCon.tsx b/src/components/signature_pad/SignatureCon.tsx index aa565e4..f4394a1 100644 --- a/src/components/signature_pad/SignatureCon.tsx +++ b/src/components/signature_pad/SignatureCon.tsx @@ -14,7 +14,6 @@ interface SignatureConProps { const SignatureCon: React.FC = ({ recipientId, openSign, setOpenSign, savedSignature, setSavedSignature }) => { const handleSaveSignature = (signatureDataUrl: string) => { - console.log('Signature saved:', signatureDataUrl); axios.post(`${import.meta.env.VITE_BASE_URI}/api/sign/signature?recipientId=${recipientId}`, { signature: signatureDataUrl, @@ -23,9 +22,7 @@ const SignatureCon: React.FC = ({ recipientId, openSign, setO }, { headers: { "ngrok-skip-browser-warning": "69420", } }) .then((res) => { - console.log(res, "Signature saved response") if (res.status === 200 || res.status === 201) { - console.log('Signature saved successfully'); setSavedSignature(signatureDataUrl); setOpenSign(false) } diff --git a/src/components/stamp/StampUpload.tsx b/src/components/stamp/StampUpload.tsx index 2157d99..7eb6048 100644 --- a/src/components/stamp/StampUpload.tsx +++ b/src/components/stamp/StampUpload.tsx @@ -9,9 +9,6 @@ interface StampUploadType { const StampUpload: React.FC = ({ stamp, setStamp }) => { - console.log(stamp, "stamp upload component"); - - // const [preview, setStamp] = useState(null); const fileInputRef = useRef(null); @@ -23,7 +20,6 @@ const StampUpload: React.FC = ({ stamp, setStamp }) => { reader.onload = () => { if (typeof reader.result === 'string') { - console.log(reader.result, "reader result"); setStamp((prev) => { return ( { diff --git a/src/components/templates/TemplateTable.tsx b/src/components/templates/TemplateTable.tsx index 6939105..e2b381d 100644 --- a/src/components/templates/TemplateTable.tsx +++ b/src/components/templates/TemplateTable.tsx @@ -88,7 +88,7 @@ const TemplateTable = () => { templateId: item.id, }; let res = await api.post(`/api/accounts/${activeAccountId}/transactions`, payload) - console.log("handleUseClick", res.data) + // /process-step-one/:accountId/:transactionId navigate(`/process-step-one/${activeAccountId}/${res?.data?.id}?useTemplate=true`); } catch (error) { @@ -220,7 +220,6 @@ const TemplateTable = () => {