diff --git a/src/context/sasContext.tsx b/src/context/sasContext.tsx index 4b75323..f55e7d7 100644 --- a/src/context/sasContext.tsx +++ b/src/context/sasContext.tsx @@ -26,13 +26,24 @@ interface SASContextProps { startupData: any } -declare global { - interface Window { - sasjsConfig: SASjsConfig - } -} +const sasElement = document.querySelector('sasjs') + +const useComputeApi = sasElement?.getAttribute('useComputeApi') -const sasjsConfig = window.sasjsConfig as SASjsConfig +const sasjsConfig = { + serverUrl: sasElement?.getAttribute('serverUrl') ?? undefined, + appLoc: sasElement?.getAttribute('appLoc') ?? undefined, + serverType: sasElement?.getAttribute('serverType'), + debug: sasElement?.getAttribute('debug') === 'true', + loginMechanism: sasElement?.getAttribute('loginMechanism') ?? undefined, + useComputeApi: + useComputeApi === 'true' + ? true + : useComputeApi === 'false' + ? false + : useComputeApi, + contextName: sasElement?.getAttribute('contextName') ?? undefined +} as SASjsConfig const sasService = new SASjs(sasjsConfig) diff --git a/src/index.html b/src/index.html index ecbb529..558c51d 100644 --- a/src/index.html +++ b/src/index.html @@ -32,6 +32,11 @@ +
- diff --git a/src/layouts/Main.jsx b/src/layouts/Main.jsx index 5c8c737..1c8ed6a 100644 --- a/src/layouts/Main.jsx +++ b/src/layouts/Main.jsx @@ -193,7 +193,8 @@ const Main = (props) => { /> {!( - window.sasjsConfig.loginMechanism === 'Redirected' || + document.querySelector('sasjs')?.getAttribute('loginMechanism') === + 'Redirected' || sasContext.isUserLoggedIn || sasContext.checkingSession ) && }