Client: PortalSettings: Fixed links for sdk

This commit is contained in:
Ilya Oleshko 2024-04-11 17:50:51 +03:00
parent 1b1787097c
commit da5909ab15
2 changed files with 3 additions and 3 deletions

View File

@ -43,7 +43,7 @@ const StyledContainer = styled.div`
StyledContainer.defaultProps = { theme: Base };
const CodeBlock = ({ config }) => {
const codeString = `const config = ${JSON.stringify(config, null, "\t")}\n\nconst script = document.createElement("script");\n\nscript.setAttribute("src", "${new URL(window.location).origin}/static/scripts/api.js");\nscript.onload = () => window.DocSpace.SDK.initFrame(config);\n\ndocument.body.appendChild(script);`;
const codeString = `const config = ${JSON.stringify(config, null, "\t")}\n\nconst script = document.createElement("script");\n\nscript.setAttribute("src", "${new URL(window.location).origin}/static/scripts/sdk/1.0.0/api.js");\nscript.onload = () => window.DocSpace.SDK.initFrame(config);\n\ndocument.body.appendChild(script);`;
const extensions = [javascript({ jsx: true })];

View File

@ -310,8 +310,8 @@
const logoSrc = `${config.src}/static/images/light_small_logo.react.svg`;
button.innerHTML = `${config?.buttonWithLogo ? `<img width="16px" heigth="16px" src="${logoSrc}" />` : ""}${config?.buttonText || "Select to DocSpace"}`;
const url = new URL(window.location.href);
const scriptUrl = `${url.protocol}//${url.hostname}/static/scripts/api.js`;
const url = new URL(document.currentScript.src);
const scriptUrl = `${url.origin}${url.pathname}`;
const configStringify = JSON.stringify(config, function (key, val) {
return typeof val === "function" ? "" + val : val;