diff --git a/apps/OpenSign/src/components/pdf/EmbedTab.js b/apps/OpenSign/src/components/pdf/EmbedTab.js deleted file mode 100644 index 183a5a635..000000000 --- a/apps/OpenSign/src/components/pdf/EmbedTab.js +++ /dev/null @@ -1,305 +0,0 @@ -import React, { useState } from "react"; -import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; -import { tomorrow } from "react-syntax-highlighter/dist/esm/styles/prism"; -import { copytoData } from "../../constant/Utils"; -import { useTranslation } from "react-i18next"; -import { useNavigate } from "react-router"; - -function EmbedTab(props) { - const { t } = useTranslation(); - const navigate = useNavigate(); - const tabName = [ - { title: "React/Next.js", icon: "fa-brands fa-react", color: "#61dafb" }, - { title: "JavaScript", icon: "fa-brands fa-js", color: "#ffd43b" }, - { title: "Angular", icon: "fa-brands fa-angular", color: "#ff5733" } - ]; - const [activeTab, setActiveTab] = useState(0); - // State to track if the code has been copied - const [isCopied, setIsCopied] = useState(false); - const reactCode = [ - { - id: 0, - title: "Installation", - codeString: `npm install @opensign/react` - }, - { - id: 1, - title: "Usage", - codeString: ` -import React from "react"; -import Opensign from "@opensign/react"; - -export default function App() { - return ( -
- console.log("success")} - onLoadError={(error) => console.log(error)} - templateId= "${props.templateId ? props.templateId : "#templateId"}" - /> -
- ); -} - -` - } - ]; - - const angularCode = [ - { - id: 0, - title: "Installation", - codeString: `npm install @opensign/angular` - }, - { - id: 1, - title: "Usage", - codeString: ` -import { Component } from '@angular/core'; -import { OpensignComponent } from "@opensign/angular" - -@Component({ - selector:'app-root', - standalone: true, - imports: [OpensignComponent], - template:\`\`, -}) -export class AppComponent { - handleLoad() { - console.log("success"); - } - handleError(error: string) { - console.log(error); - } -} - -` - } - ]; - const jsCodeString = ` - - `; - - const handleCopy = (code, ind) => { - copytoData(code); - setIsCopied({ ...isCopied, [ind]: true }); - setTimeout(() => setIsCopied(false), 3000); - }; - - return ( -
- {props.templateId && ( -

- {t("embed-template")} -

- )} -
-
- {tabName.map((tabData, ind) => ( -
setActiveTab(ind)} - key={ind} - role="tab" - className={`${ - activeTab === ind ? "op-tab-active" : "" - } op-tab flex items-center pb-10 md:pb-0`} - > - - - {tabData.title} - -
- ))} -
-
-
- {activeTab === 0 ? ( -
- {reactCode.map((data, ind) => { - return ( -
-

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

- {ind === 0 && ( -

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

- )} -
-
handleCopy(data.codeString, ind)} - className="absolute top-[20px] right-[20px] cursor-pointer" - > - - - {isCopied[ind] ? t("copied-code") : t("copy-code")} - -
- - {data.codeString} - -
-
- ); - })} - {props.isEmbedPage && ( -

- {t("js-snippet-msg-1")} - navigate("/report/6TeaPr321t")} - > - {t("js-snippet-msg-2")} - - {t("js-snippet-msg-3")} -

- )} -

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

-

- {" "} - {t("public-template-mssg-4")} - - {" "} - OpenSign React package{" "} - - {t("public-template-mssg-5")} -

-
- ) : activeTab === 1 ? ( -
-
-

{t(`Usage`)}

-

{t("js-snippet-msg")}

-
-
handleCopy(jsCodeString, 0)} - className="absolute top-[20px] right-[20px] cursor-pointer" - > - - - {isCopied[0] ? t("copied-code") : t("copy-code")} - -
- - {jsCodeString} - -
- {props.isEmbedPage && ( -

- {t("js-snippet-msg-1")} - navigate("/report/6TeaPr321t")} - > - {t("js-snippet-msg-2")} - - {t("js-snippet-msg-3")} -

- )} -
-
- ) : ( - activeTab === 2 && ( -
- {angularCode.map((data, ind) => { - return ( -
-

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

- {ind === 0 && ( -

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

- )} -
-
handleCopy(data.codeString, ind)} - className="absolute top-[20px] right-[20px] cursor-pointer" - > - - - {isCopied[ind] ? t("copied-code") : t("copy-code")} - -
- - {data.codeString} - -
-
- ); - })} - {props.isEmbedPage && ( -

- {t("js-snippet-msg-1")} - navigate("/report/6TeaPr321t")} - > - {t("js-snippet-msg-2")} - - {t("js-snippet-msg-3")} -

- )} -

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

-

- {" "} - {t("public-template-mssg-4")} - - {" "} - OpenSign Angular package{" "} - - {t("public-template-mssg-5")} -

-
- ) - )} -
-
- ); -} - -export default EmbedTab; diff --git a/apps/OpenSign/src/constant/appinfo.js b/apps/OpenSign/src/constant/appinfo.js index 8541bd2b7..e46cbba1c 100644 --- a/apps/OpenSign/src/constant/appinfo.js +++ b/apps/OpenSign/src/constant/appinfo.js @@ -1,11 +1,9 @@ import logo from "../assets/images/logo.png"; export function serverUrl_fn() { - let baseUrl; - baseUrl = process.env.REACT_APP_SERVERURL - ? process.env.REACT_APP_SERVERURL - : window.location.origin + "/app"; - + let baseUrl = process.env.REACT_APP_SERVERURL + ? process.env.REACT_APP_SERVERURL + : window.location.origin + "/api/app"; return baseUrl; } export const appInfo = { diff --git a/apps/OpenSignServer/Utils.js b/apps/OpenSignServer/Utils.js index 09c3cb981..1343c058d 100644 --- a/apps/OpenSignServer/Utils.js +++ b/apps/OpenSignServer/Utils.js @@ -6,10 +6,6 @@ dotenv.config(); export const cloudServerUrl = 'http://localhost:8080/app'; export const appName = 'OpenSign™'; -export function customAPIurl() { - const url = new URL(cloudServerUrl); - return url.pathname === '/api/app' ? url.origin + '/api' : url.origin; -} export const color = [ '#93a3db',