Skip to main content

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

OptionTypeNotes
product'chat'|'viewer'|'editor'|'tiles'Required. Selects the bundle + default doorway.
publishableKeystringPublishable browser key (kld_pk_live_…). Required for chat/editor/tiles; viewer needs none. The SDK exchanges it for a short-lived session at runtime.
apiKeystringDeprecated alias for publishableKey; also accepts a legacy kld_live_… key.
shareId / mapIdstringViewer: the published-map id.
styleIdstringTiles/editor: a Kaleidr basemap style id (or full style URL for editor).
mapmap instanceChat: your live in-page map to attach to.
mapTargetstringChat: CSS selector of a host map element (declarative path).
center zoom pitch bearingInitial camera.
themestring | objectNamed theme or token bag.
doorway'iframe'|'attach'Escape hatch — overrides the product default.
basestringOverride the CDN origin (dev / self-host).
apiBasestringPlatform API origin for the chat product's inference path.
enabledbooleanPer-mount dormancy override.

KaleidrHandle

interface KaleidrHandle {
product: 'chat' | 'viewer' | 'editor' | 'tiles';
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 inert by defaultmount() validates and registers but loads no bundle until the embed gate is on. Enable it via any of:

  • window.__KALEIDR_EMBED_ENABLED__ = true (before the script runs), or
  • Kaleidr.enable(true) at runtime, 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>