@invopop/console-ui-sdk
v0.0.11
Published
Standalone simple JS script designed to be incorporated into modules for communication with the console.
Readme
Invopop Console Applications SDK
Toolkit for web apps to be able to communicate with the Invopop Console UI.
Usage
Define the SDK URL in your HTML code with a constant as follows, adjusting the version of the SDK as needed:
<script>
const CONSOLE_SDK_URL =
"https://cdn.jsdelivr.net/npm/@invopop/[email protected]/index.js";
</script>Then import in the JS code with the functions you'd like to use:
const { start, fetchEnrollment } = await import(CONSOLE_SDK_URL);
await start();
let enrollment = await fetchEnrollment();
// .... use dataHistory
Apps run inside an iframe, so their internal navigation never reaches the
browser's address bar. Pushing the app's path to the console lets it mirror
that path into its own URL (?path=), making the address bar a shareable deep
link that reopens the app on the exact same view.
Push every history change automatically (recommended — covers HTMX
hx-push-url, SPA routers, and back/forward):
const { syncHistory } = await import(CONSOLE_SDK_URL);
syncHistory();syncHistory patches history.pushState and history.replaceState, and
returns a function that undoes this if you ever need to stop syncing.
Or push a path explicitly:
const { pushHistory } = await import(CONSOLE_SDK_URL);
pushHistory("/dashboard?state=205");Note the console mirrors the path with replaceState, so pushing never adds
entries to the browser's history stack.
