Skip to content

Interface: InitOptions

Consolidated initialization options for init(). Union of iframe options + map options + callbacks.

Extends

Properties

PropertyTypeDescriptionInherited from
accessKey?stringAccess key generated in Hub for the property.-
aiAssistant?Partial<AiAssistantConfig>Experimental AI assistant configuration (BYOK — bring your own LLM API key). When provided with provider + apiKey, the API enables the natural-language map assistant: the user's query is embedded against the property's POI vector index and the chosen LLM generates the answer. Omitted or partial (missing provider/apiKey) → AI assistant disabled, no-op fallback. The back-end semantic-search endpoint is gated on external integration work; customers using searchEndpoint to point at their own infra are unaffected. Provisional shape; see AiAssistantConfig. Example import { init, type AiAssistantConfig } from '@mapsted/maps-js-api'; await init({ propertyId: 1643, aiAssistant: { provider: 'anthropic', apiKey: process.env.ANTHROPIC_API_KEY!, }, });-
boost?Boost-SetOptions.boost
coordsData?CoordsData[]-SetOptions.coordsData
defaultCustomRoutingConfig?DefaultCustomRoutingConfigDefault custom routing optionsSetOptions.defaultCustomRoutingConfig
element?string | HTMLElementHTMLElement or CSS selector string for the map container. Omit for fullscreen.-
entityData?MapEntity[]-SetOptions.entityData
entityDefaults?MapEntity-SetOptions.entityDefaults
features?Partial<FeatureFlagSet>-SetOptions.features
focus?number | "property" | nullFocus mode for the map: - If "property" → initial focus will be at the property level - If a BuildingId (number) is passed → focus will go to that building levelSetOptions.focus
idleTime?numberIdle timeout delay in millisecondsSetOptions.idleTime
language?stringDefault language code (BCP 47).-
loader?"cube" | "rolling" | "spinner"Loader that will be used in the map, the value should be from the above set of loader options else the default loader will be used. This config field will be used only during the initialization - [[initialize]]SetOptions.loader
mapOverlayMarkers?MapOverlayMarker[]Array of map overlay marker detailsSetOptions.mapOverlayMarkers
mapsDomain?stringFull URL of the maps backend host, e.g. "https://maps.mapsted.com". Optional. In CDN mode the host is injected server-side from the script-tag URL. Otherwise it defaults to https://maps.mapsted.com — set it only for a white-label or self-hosted map backend served from your own domain. Throws MAPSTED-1011 for malformed values.-
onload?() => voidFunction called once the map is fully loaded and ready.-
propertyId?string | numberThe numeric property ID from the Mapsted Hub. Required to load a specific property in npm mode; in CDN mode it is auto-injected from the script-tag ?id= query parameter.-
security?Partial<SecurityConfig>Optional postMessage security configuration. When provided, the internal message handler validates incoming origins against the whitelist (allowedOrigins ∪ additionalOrigins) and throws MAPSTED-1303 in strict mode on mismatch. When omitted, the API falls back to the legacy single-origin validator driven by mapsDomain — no behavioural change for existing consumers. Partial shape: resolveConfig merges on top of DEFAULT_SECURITY_CONFIG. Example import { init, type SecurityConfig } from '@mapsted/maps-js-api'; await init({ mapsDomain: 'https://maps.mapsted.com', propertyId: 603, security: { allowedOrigins: ['https://maps.mapsted.com'], additionalOrigins: ['https://proxy.customer.com'], strictMode: true, }, });-
shareUrl?stringCustom url that will used while creating links to share entities and routes e.g. if https://your.domain/deeplink/<app name> is set then entity selection share link will be generated as: https://your.domain/deeplink/<app name>/map/select?property=95&building=95&floor=184&entity=81 By following this URL structure [https://your.domain/deeplink/<app name>], the Mapsted mobile application will be able to properly handle deep links and provide a seamless user experienceSetOptions.shareUrl
strict?booleanEnable strict mode for the migration shim. When true, calling any deprecated V2 method throws MAPSTED-1093 instead of emitting a console.warn. Defaults to false (lenient/backward-compatible mode).-