From 5ffa681a8061f20579ebc873851d1232e754cf9b Mon Sep 17 00:00:00 2001 From: RaktimaNXG Date: Thu, 26 Sep 2024 14:56:25 +0530 Subject: [PATCH 1/2] feat: add copy public URL option to copy public url --- .../public/locales/en/translation.json | 3 +- .../public/locales/fr/translation.json | 3 +- .../src/components/opensigndrive/DriveBody.js | 7 -- apps/OpenSign/src/components/pdf/EmbedTab.js | 18 ++-- apps/OpenSign/src/json/ReportJson.js | 28 +++--- .../src/primitives/GetReportDisplay.js | 65 +++++++++++--- .../src/script/locales/en/translation.json | 79 ++++++++--------- .../src/script/locales/fr/translation.json | 85 ++++++++++--------- 8 files changed, 168 insertions(+), 120 deletions(-) diff --git a/apps/OpenSign/public/locales/en/translation.json b/apps/OpenSign/public/locales/en/translation.json index d5494f4a0..8c5ed8c71 100644 --- a/apps/OpenSign/public/locales/en/translation.json +++ b/apps/OpenSign/public/locales/en/translation.json @@ -132,7 +132,8 @@ "View": "View", "option": "Option", "Embed": "Embed", - "Copy TemplateId":"Copy TemplateId" + "Copy TemplateId":"Copy TemplateId", + "Copy Public URL":"Copy Public URL" }, "report-heading": { "Sr.No": "Sr.No", diff --git a/apps/OpenSign/public/locales/fr/translation.json b/apps/OpenSign/public/locales/fr/translation.json index c7ed9c310..0e239aaf6 100644 --- a/apps/OpenSign/public/locales/fr/translation.json +++ b/apps/OpenSign/public/locales/fr/translation.json @@ -152,7 +152,8 @@ "View": "Voir", "option": "Option", "Embed": "Intégrer", - "Copy TemplateId": "Copier l'ID du modèle" + "Copy TemplateId": "Copier l'ID du modèle", + "Copy Public URL":"Copier l'URL publique" }, "report-help": { "Draft Documents": "Il s'agit de documents que vous avez commencés mais que vous n'avez pas finalisés pour envoi.", diff --git a/apps/OpenSign/src/components/opensigndrive/DriveBody.js b/apps/OpenSign/src/components/opensigndrive/DriveBody.js index 1324210cb..b198f6c4b 100644 --- a/apps/OpenSign/src/components/opensigndrive/DriveBody.js +++ b/apps/OpenSign/src/components/opensigndrive/DriveBody.js @@ -2,7 +2,6 @@ import React, { useState, useEffect, useRef } from "react"; import "../../styles/opensigndrive.css"; import axios from "axios"; import * as ContextMenu from "@radix-ui/react-context-menu"; -import { saveAs } from "file-saver"; import { useNavigate } from "react-router-dom"; import Table from "react-bootstrap/Table"; import * as HoverCard from "@radix-ui/react-hover-card"; @@ -264,12 +263,6 @@ function DriveBody(props) { setIsOpenMoveModal(false); } }; - - const sanitizeFileName = (pdfName) => { - // Replace spaces with underscore - return pdfName.replace(/ /g, "_"); - }; - const handleEnterPress = (e, data) => { if (e.key === "Enter") { handledRenameDoc(data); diff --git a/apps/OpenSign/src/components/pdf/EmbedTab.js b/apps/OpenSign/src/components/pdf/EmbedTab.js index f2381ebef..ca3991b9b 100644 --- a/apps/OpenSign/src/components/pdf/EmbedTab.js +++ b/apps/OpenSign/src/components/pdf/EmbedTab.js @@ -129,9 +129,11 @@ export class AppComponent{

{t(`${data.title}`)}

-

- {t("public-template-mssg-1")} -

+ {ind === 0 && ( +

+ {t("public-template-mssg-1")} +

+ )}
handleCopy(data.codeString, ind)} @@ -210,11 +212,11 @@ export class AppComponent{

{t(`${data.title}`)}

- -

- {t("angular-npm-mssg-1")} -

- + {ind === 0 && ( +

+ {t("angular-npm-mssg-1")} +

+ )}
handleCopy(data.codeString, ind)} diff --git a/apps/OpenSign/src/json/ReportJson.js b/apps/OpenSign/src/json/ReportJson.js index c2da51950..859a2e4fd 100644 --- a/apps/OpenSign/src/json/ReportJson.js +++ b/apps/OpenSign/src/json/ReportJson.js @@ -39,6 +39,13 @@ export default function reportJson(id) { hoverLabel: "Copy TemplateId", btnIcon: "fa-light fa-copy", action: "CopyTemplateId" + }, + { + btnId: "2434", + btnLabel: "Copy Public URL", + hoverLabel: "Copy Public URL", + btnIcon: "fa-light fa-copy", + action: "CopyPublicURL" } ] : []; @@ -405,18 +412,15 @@ export default function reportJson(id) { if (item.action === "option") { // Make a shallow copy of the item const newItem = { ...item }; - newItem.subaction = [ - { - btnId: "1873", - btnLabel: "Share with team", - hoverLabel: "Share with team", - btnIcon: "fa-light fa-share-nodes", - redirectUrl: "", - action: "sharewith" - }, - ...newItem.subaction - ]; - + //splice method used to add `Share with team` option on second index of list + newItem.subaction.splice(1, 0, { + btnId: "1873", + btnLabel: "Share with team", + hoverLabel: "Share with team", + btnIcon: "fa-light fa-share-nodes", + redirectUrl: "", + action: "sharewith" + }); return newItem; } return item; diff --git a/apps/OpenSign/src/primitives/GetReportDisplay.js b/apps/OpenSign/src/primitives/GetReportDisplay.js index 8e3d305dd..13c2843cb 100644 --- a/apps/OpenSign/src/primitives/GetReportDisplay.js +++ b/apps/OpenSign/src/primitives/GetReportDisplay.js @@ -76,6 +76,7 @@ const ReportTable = (props) => { const [reason, setReason] = useState(""); const [isDownloadModal, setIsDownloadModal] = useState(false); const [isEmbed, setIsEmbed] = useState(false); + const [isPublicTour, setIsPublicTour] = useState(); const Extand_Class = localStorage.getItem("Extand_Class"); const extClass = Extand_Class && JSON.parse(Extand_Class); const startIndex = (currentPage - 1) * props.docPerPage; @@ -373,6 +374,19 @@ const ReportTable = (props) => { handleEmbedFunction(item); } else if (act.action === "CopyTemplateId") { copyTemplateId(item.objectId); + } else if (act.action === "CopyPublicURL") { + const isPublic = item?.IsPublic; + if (isPublic) { + let publicUrl = ""; + if (isStaging) { + publicUrl = `https://staging.opensign.me/publicsign?templateid=${item.objectId}`; + } else { + publicUrl = `https://opensign.me/publicsign?templateid=${item.objectId}`; + } + copyTemplateId(publicUrl); + } else { + setIsPublicTour({ [item.objectId]: true }); + } } }; // Get current list @@ -1133,6 +1147,17 @@ const ReportTable = (props) => { setIsPublicUserName(extendUser[0]?.UserName || ""); }; + const publicTourConfig = [ + { + selector: '[data-tut="IsPublic"]', + content: "Please make template public to copy public URL", + position: "top", + style: { fontSize: "13px" } + } + ]; + const closePublicTour = () => { + setIsPublicTour(); + }; return (
{Object.keys(actLoader)?.length > 0 && ( @@ -1153,13 +1178,27 @@ const ReportTable = (props) => { )} {isAlert && {alertMsg.message}} {props.tourData && props.ReportName === "Templates" && ( - + <> + + {isPublicTour && ( + + )} + )}
@@ -1375,13 +1414,17 @@ const ReportTable = (props) => { isEnableSubscription && ( {props.ReportName === "Templates" && ( -
+