kaleidr.js — the loader
One script tag installs window.Kaleidr and defines the
<kaleidr-map> element:
<script src="https://cdn.kaleidr.com/embed/v1/kaleidr.js"></script>
The façade is a thin loader. It owns only: version, config, script loading, the product registry, key passing, doorway selection, mount lifecycle, error normalization, and the dormancy flag. Each product's real behaviour lives in its own bundle, lazy-loaded by URL on first use.
Kaleidr.mount(target, options) → KaleidrHandle
const handle = Kaleidr.mount('#chat', {
product: 'chat',
publishableKey: 'kld_pk_live_…',
map: myMap,
});
Returns a handle synchronously while the product bundle loads in the background; calls before load are queued and flushed on ready.
Options
| Option | Type | Notes |
|---|---|---|
product | 'chat'|'viewer'|'editor'|'tile' | Required. Selects the bundle + default doorway. |
publishableKey | string | Publishable browser key (kld_pk_live_…). Required for chat/editor/tile; viewer needs none. The SDK exchanges it for a short-lived session at runtime. |
apiKey | string | Deprecated alias for publishableKey; also accepts a legacy kld_live_… key. |
shareId / mapId | string | Viewer: the published-map id. |
styleId | string | Tile/editor: a Kaleidr basemap style id (or full style URL for editor). Omitted, the organization's stored default applies, then kaleidr-morning. |
map | map instance | Chat: your live in-page map to attach to. |
mapTarget | string | Chat: CSS selector of a host map element (declarative path). |
center zoom pitch bearing | Initial camera. | |
theme | string | object | Named theme or token bag. |
doorway | 'iframe'|'attach' | Escape hatch — overrides the product default. |
base | string | Override the CDN origin bundles load from (dev / self-host). |
viewerBase | string | Viewer/tile only: the origin the iframe points at. Distinct from base — the iframe never aims at the CDN. |
apiBase | string | Platform API origin for the chat product's inference path. |
enabled | boolean | Per-mount dormancy override. |
KaleidrHandle
interface KaleidrHandle {
product: 'chat' | 'viewer' | 'editor' | 'tile';
setCamera?(camera): void; // present where the product supports it
setTheme?(theme): void;
destroy(): void; // always present
}
Kaleidr.init()
Upgrades any <kaleidr-map> already in the DOM. Called automatically on load;
call it after injecting elements dynamically.
Kaleidr.enable(on = true)
The SDK is live by default — you don't need to enable anything, and the quickstart works as written.
enable() exists as an off switch: passing false stops mount() from
loading any bundle, so you can gate embeds behind a consent banner or kill them
on a page without removing the markup. The same switch is available as
window.__KALEIDR_EMBED_ENABLED__ = false (before the script runs) or the
flag attribute / enabled option per mount.
Kaleidr.version
The loader version string.
CDN base override
For local dev or self-hosting, point the loader at another origin:
<script>window.__KALEIDR_EMBED_BASE__ = 'https://cdn-dev.kaleidr.com';</script>