import { Observable } from 'rxjs'; /** * @internal * @hidden * Core constants used for host-to-iframe communication and URL construction. */ /** * Storage key for the Metabox Communicator instance registry. * * ### What does it unlock? * Constant string identifier for MetaBox version. Used internally to reference the MetaBox system and versioning. * * ### Practical Application * Internal system reference for versioning. * Not needed in front-end application code. * * ### AI Coding Best Practices * Skip in application code. This constant is for internal MetaBox system identification only. * * @internal */ declare const Metabox = "metabox"; /** * Identifier used as the `host` field in postMessage envelopes sent to the iframe. * * ### What does it unlock? * Constant for the MetaBox host connection point. Specifies endpoint for MetaBox connections. * * ### Practical Application * MetaBox endpoint constant. The host the configurator iframe connects to for Unreal Engine pixel streaming. * Not needed in front-end application code. * * ### AI Coding Best Practices * Skip in application code. This constant is for internal MetaBox system identification only. * * @internal */ declare const MetaboxHost = "metaboxHost"; /** * Action string dispatched by the iframe when the configurator app has loaded. * * ### What does it unlock? * App initialization flag variable. Signals when MetaBox has completed loading. * * ### Practical Application * Use the viewportReady event (more reliable) to gate your UI rendering — don't show controls until MetaBox confirms it's ready. * * ### AI Coding Best Practices * Prefer the viewportReady event over this variable: `api.addEventListener('viewportReady', (ready) => { if(ready) enableUI(); })`. * viewportReady is the reliable signal that MetaBox is ready to accept commands. * * @internal */ declare const AppLoaded = "appLoaded"; /** * Default MetaBox domain for production environments. * * ### What does it unlock? * Constant for the standard default MetaBox domain. Used as the primary domain for connecting to MetaBox server. * * ### Practical Application * Default MetaBox domain constant (HTTPS). The base domain used when no override is specified. * Override only via IntegrateMetaboxConfig.domain if connecting to a custom or self-hosted MetaBox instance. * * ### AI Coding Best Practices * Let integrateMetabox() use the default. Override only if needed: * `integrateMetabox(id, container, callback, { domain: 'https://custom.domain.com' })`. HTTPS is mandatory. * * @internal */ /** * @deprecated */ declare const Metabox_V3 = "metabox_v3"; /** * @deprecated */ declare const MetaboxHost_V3 = "metaboxHost_v3"; /** * @deprecated */ declare const AppLoaded_V3 = "appLoaded_v3"; declare const MetaboxDomain = "metabox.3dsource.com"; /** * Base route URL segment for the Modular Configurator. * * ### What does it unlock? * Base route URL constant used for loading the configurator. Standard path endpoint for accessing the modular configurator. * * ### Practical Application * The modular configurator URL format is: `https://{domain}/metabox-configurator/modular/{configuratorId}`. * Automatically constructed by integrateMetabox(). * * ### AI Coding Best Practices * Let integrateMetabox() handle URL construction. Only reference if building URLs manually * (e.g., QR codes, email links, server-side rendering). The modular path is `/modular/{id}`. * * @internal */ declare const BasicRouteUrl = "metabox-configurator/modular"; declare const VERSION = "3.0.30"; /** * Configuration options for integrating the Metabox Modular Configurator iframe into a host page. * Passed as the `config` parameter to {@link integrateMetabox}. * * ### What does it unlock? * Configuration interface for initializing the configurator. Passed to integrateMetabox function with settings * like domain, host, and standalone mode. * * ### Practical Application * Config interface for integrateMetabox() initialization. Supports: standalone (boolean — disables all built-in UI), * introImage/introVideo (URLs), loadingImage (URL), state (initial component tree), domain (HTTPS override). * * ### AI Coding Best Practices * Pass as the 4th parameter to integrateMetabox(). Key: `standalone:true` for custom UI builds. loadingImage for branded * loading. domain only if overriding the default MetaBox server. All URLs must be HTTPS. The state field lets you * restore a previously saved configuration. */ interface IntegrateMetaboxConfig { /** If true, disables Metabox custom template and all related logic. */ standalone?: boolean; /** URL to an image displayed while the configurator is loading (added as `?loadingImage=...`). */ loadingImage?: string; /** URL to a video shown on the intro screen (added as `?introVideo=...`). */ introVideo?: string; /** URL to an image shown on the intro screen (added as `?introImage=...`). */ introImage?: string; /** Predefined state for the configurator on initial loading in rison format (see * https://github.com/Nanonid/rison) (added as `?state=...`). */ state?: string; /** Custom domain for testing purposes. Defaults to `metabox.3dsource.com`. HTTPS is enforced. */ domain?: string; /** If true, shows the loading progress bar inside the configurator (added as `?showLoadingProgress=true`). */ showLoadingProgress?: boolean; /** If true, shows the resume stream popup when the stream is paused (added as `?showResumeStreamPopup=true`). */ showResumeStreamPopup?: boolean; /** If true, shows the user inactivity countdown popup before disconnecting (added as `?showUserInactivityTimer=true`). */ showUserInactivityTimer?: boolean; /** Inactivity timeout in seconds before the user is warned and eventually disconnected (added as `?userInactivityTimeout=...`). */ userInactivityTimeout?: number; } /** * Internal configuration sent to the Metabox Modular Configurator via postMessage. * Used by {@link Communicator} when establishing host-to-iframe communication. * * ### What does it unlock? * Configuration object for MetaBox commands. Contains parameters for command execution and behavior settings. * * ### Practical Application * Configuration object for MetaBox command execution. Contains parameters controlling command behavior and settings. * Used internally by the command dispatch system. * * ### AI Coding Best Practices * Read-only reference — commands use this internally. When building dynamic command systems, refer to individual * command class constructors for their specific parameter requirements rather than this config. */ interface MetaboxCommandConfig { /** If true, disables Metabox custom template and all related logic. */ standalone?: boolean; /** The URL of the host page embedding the configurator. */ hostUrl: string; /** The API version string sent to the configurator for compatibility. */ apiVersion: string; } /** * Registry of all action identifiers that can be sent from the host application to the Metabox Modular Configurator. * Each key maps to a string used as the `action` field in the postMessage envelope. * * ### What does it unlock? * Variable containing all available action names. Interface listing all actions that the modular configurator supports. * * ### Practical Application * Master action registry object — all supported configurator action names. Invaluable reference for building * admin dashboards, permission systems, or feature-availability displays. * * ### AI Coding Best Practices * Iterate this object to dynamically build action dropdowns, command palettes, or feature checklists in admin tools. * Each key is an action name, value is its description. Excellent reference for AI coding agents to understand * the full command vocabulary available. */ declare const MetaboxModularConfiguratorActions: { readonly metaboxConfig: "metaboxConfig"; readonly resumeStream: "resumeStream"; readonly setEnvironment: "setEnvironment"; readonly setEnvironmentMaterialById: "setEnvironmentMaterialById"; readonly setComponent: "setComponent"; readonly setComponentMaterialById: "setComponentMaterialById"; readonly getPdf: "getPdf"; readonly getCallToActionInformation: "getCallToActionInformation"; readonly getScreenshot: "getScreenshot"; readonly showEmbeddedMenu: "showEmbeddedMenu"; readonly showOverlayInterface: "showOverlayInterface"; readonly getCamera: "getCamera"; readonly setCamera: "setCamera"; readonly resetCamera: "resetCamera"; readonly resetConfiguration: "resetConfiguration"; readonly applyZoom: "applyZoom"; readonly initShowcase: "initShowcase"; readonly playShowcase: "playShowcase"; readonly pauseShowcase: "pauseShowcase"; readonly stopShowcase: "stopShowcase"; readonly sendCommandToUnreal: "sendCommandToUnreal"; readonly showMeasurement: "showMeasurement"; readonly hideMeasurement: "hideMeasurement"; readonly resetUserInactivityTimer: "resetUserInactivityTimer"; }; /** * Union of all action string literals from {@link MetaboxModularConfiguratorActions}. * * ### What does it unlock? * Type alias for all actions that can be sent to MetaBox. Defines the complete set of command types available. * * ### Practical Application * Type alias enumerating all available outgoing command types. Master list of everything your app can tell MetaBox to do. * Use as a checklist when planning which features to implement. * * ### AI Coding Best Practices * Reference for building command dispatchers or admin tools. Full command set includes all values of * MetaboxModularConfiguratorActions like: "metaboxConfig" | "setEnvironment" | "setEnvironmentMaterialById" | ... */ type ToMetaBoxActions = (typeof MetaboxModularConfiguratorActions)[keyof typeof MetaboxModularConfiguratorActions]; /** * @internal * @hidden */ type ToMetaboxMessagePayload = ToMetaboxMessagePayloads[keyof ToMetaboxMessagePayloads]; /** * Interface for messages sent from the application to the Metabox Modular Configurator. * * ### What does it unlock? * Defines payload structures for different types of outgoing messages to MetaBox. Contains data models for various command parameters. * * ### Practical Application * Payload type definitions for all outgoing command types. Defines required and optional fields per command. * Essential TypeScript reference for type-safe command construction. * * ### AI Coding Best Practices * Use as TypeScript type reference for proper typing when building dynamic command dispatchers. * Each key corresponds to a command name and its value defines the expected payload structure. */ interface ToMetaboxMessagePayloads { [MetaboxModularConfiguratorActions.metaboxConfig]: { appId: string; config: MetaboxCommandConfig; }; [MetaboxModularConfiguratorActions.setEnvironment]: { id: string; }; [MetaboxModularConfiguratorActions.setEnvironmentMaterialById]: { slotId: string; materialId: string; }; [MetaboxModularConfiguratorActions.setComponent]: { id: string; typeId: string; }; [MetaboxModularConfiguratorActions.setComponentMaterialById]: { componentId: string; slotId: string; materialId: string; }; [MetaboxModularConfiguratorActions.getScreenshot]: { format: MimeType; size?: { x: number; y: number; }; }; [MetaboxModularConfiguratorActions.getCallToActionInformation]: void; [MetaboxModularConfiguratorActions.getPdf]: void; [MetaboxModularConfiguratorActions.showEmbeddedMenu]: { visible: boolean; }; [MetaboxModularConfiguratorActions.showOverlayInterface]: { visible: boolean; }; [MetaboxModularConfiguratorActions.getCamera]: void; [MetaboxModularConfiguratorActions.setCamera]: { camera: CameraCommandPayload; }; [MetaboxModularConfiguratorActions.resetCamera]: void; [MetaboxModularConfiguratorActions.resetConfiguration]: void; [MetaboxModularConfiguratorActions.applyZoom]: { zoom: number; }; [MetaboxModularConfiguratorActions.initShowcase]: void; [MetaboxModularConfiguratorActions.playShowcase]: void; [MetaboxModularConfiguratorActions.pauseShowcase]: void; [MetaboxModularConfiguratorActions.stopShowcase]: void; [MetaboxModularConfiguratorActions.sendCommandToUnreal]: object; [MetaboxModularConfiguratorActions.showMeasurement]: void; [MetaboxModularConfiguratorActions.hideMeasurement]: void; [MetaboxModularConfiguratorActions.resetUserInactivityTimer]: void; } /** * Payload for the {@link SetCamera} command describing the desired camera state in the Unreal scene. * All fields are optional — only the provided values will be applied. * * ### What does it unlock? * Defines the payload structure for camera commands. Contains camera-related parameters passed to SetCamera command. * * ### Practical Application * Read-only interface defining camera parameters: fov (degrees), mode ('orbit'|'fps'), position ({x,y,z}), * rotation ({horizontal: yaw, vertical: pitch}), and restrictions (distance/FOV/rotation limits). * Both returned by getCameraResult event and accepted by SetCamera. * * ### AI Coding Best Practices * This interface is bidirectional — returned from GetCamera and accepted by SetCamera. * Capture a camera state via getCameraResult and replay it with SetCamera(payload). * Only include restriction fields you want to enforce; omitted values keep current settings. * In orbit mode, distance limits are relative to the orbit pivot. */ interface CameraCommandPayload { /** Field of view angle in degrees. */ fov?: number; /** Camera control mode: `'fps'` for first-person or `'orbit'` for orbital rotation around pivot. */ mode?: 'fps' | 'orbit'; /** Camera position in 3D world space. */ position?: { x: number; y: number; z: number; }; /** Camera rotation angles in degrees. */ rotation?: { horizontal: number; vertical: number; }; /** Min/max constraints applied to camera movement, zoom, and rotation. */ restrictions?: { maxDistanceToPivot?: number; maxFov?: number; maxHorizontalRotation?: number; maxVerticalRotation?: number; minDistanceToPivot?: number; minFov?: number; minHorizontalRotation?: number; minVerticalRotation?: number; }; } /** * @internal * @hidden * Envelope wrapping an action and its payload for host-to-Metabox postMessage communication. * * ### What does it unlock? * Envelope structure for outgoing MetaBox messages. Encapsulates messages with protocol headers for transmission. * * ### Practical Application * Protocol envelope for outgoing messages — adds headers for transmission to MetaBox iframe. * Internal to the communication layer, handled automatically by the Communicator. * * ### AI Coding Best Practices * Do not construct manually. The Communicator handles all message wrapping. Only reference this interface * if debugging raw postMessage traffic in browser devtools to diagnose why commands aren't being received. */ interface ToMetaBoxMessageEnvelope { action: ToMetaBoxActions; payload?: ToMetaboxMessagePayload | never; } /** * @internal * @hidden */ type ToMetaboxTarget = 'metabox' | 'child'; /** * @internal * @hidden * Top-level postMessage structure sent from the host to the Metabox iframe. * * ### What does it unlock? * Message interface for sending data to MetaBox. Wraps outgoing commands with necessary protocol information. * * ### Practical Application * Outgoing message format for commands to MetaBox. Wraps commands with protocol information for postMessage delivery. * Handled automatically by Communicator.sendCommandToMetabox() — never construct manually. * * ### AI Coding Best Practices * Do not construct ToMetaBoxMessage objects. Always use `api.sendCommandToMetabox(new CommandName(...))`. * The Communicator wraps your command in the correct message format automatically. */ interface ToMetaBoxMessage { host: typeof MetaboxHost; envelope: ToMetaBoxMessageEnvelope; /** * @deprecated, use envelope instead of payload */ payload: ToMetaBoxMessageEnvelope; target: ToMetaboxTarget; apiVersion: string; } /** * Represents a modular configurator envelope with an initial configurator, configuration tree, * all components by active component type, component selected materials, and associated environment. * * ### What does it unlock? * Main data envelope interface that comes from MetaBox. Contains all configurator data including components, * materials, variants, and state information. * * ### Practical Application * Delivered as the payload of the `configuratorDataUpdated` event. Contains: configurator (full definition of all options), * configurationTree (current assembly hierarchy), componentsByComponentType (active selection per category), * componentMaterialsIds (material selections), environmentId (current scene), environmentMaterialsIds. * This is the single source of truth for building your entire custom UI. * * ### AI Coding Best Practices * Subscribe to configuratorDataUpdated to receive this on EVERY state change. * Key fields: configurator (all available options — parse once for menu building), * configurationTree (current hierarchy), componentsByComponentType (what's selected per type), * componentMaterialsIds (active materials), environmentId (current scene). * Rebuild affected UI sections on each update. */ interface ModularConfiguratorEnvelope { /** * Represents the modular configurator api with its components, component types, and environments * */ configurator: InitialModularConfigurator; /** The unique tree of components and parent and component type id */ configurationTree: ComponentWithParent[]; /** A record mapping all components by current component type */ componentsByComponentType: Record; /** A record mapping component material selection */ componentMaterialsIds: SelectedIds; /** The unique environment identifier */ environmentId: string; /** A record mapping environment material selections */ environmentMaterialsIds: SelectedIds; } /** * Represents the modular configurator API with its components, component types, and environments. * * ### What does it unlock? * Defines payload structures for different message types. Contains data models for various command responses. * * ### Practical Application * Full configurator definition loaded at init — contains all available components, component types, * environments, materials, and metadata. Nested inside ModularConfiguratorEnvelope.configurator. * This is your catalog of everything the configurator supports. * * ### AI Coding Best Practices * Access via envelope.configurator from configuratorDataUpdated. This is your source of truth for ALL * available options. Iterate its component types, components, environments, and material collections * to build dynamic selection UIs. Only changes if the configurator definition is updated in MetaBox admin. */ interface InitialModularConfigurator { /** Unique identifier for the configurator. */ id: string; /** The name of the configurator. */ name: string; /** A list of components for the configurator. */ components: ModularConfiguratorComponent[]; /** A list of available environments. */ environments: ModularConfiguratorEnvironment[]; /** A list of a component type for the configurator. */ componentTypes: ModularConfiguratorComponentType[]; /** Indicates if the configurator is active. */ isActive: boolean; /** Indicates if the cta in ecom configurator is enabled or not. */ ctaEnabled: boolean; /** A list of available connectors shows connections between all component types. */ connectors: ModularConfiguratorConnector[]; /** Represents object typename for the Modular Configurator. */ __typename: 'ModularConfigurator'; } /** * Represents a configurator component within the modular configurator. * * ### What does it unlock? * Defines the type structure of a component. Describes component classification and available variants. * * ### Practical Application * Core component data model: id (UUID), name (display string), position (sort order), * componentType (category), product (3D asset reference with externalId for SKU mapping), * and virtualSocketToConnectorsMap (connection points). THE main data structure for building component UIs. * * ### AI Coding Best Practices * Access from configurator definition in the envelope. Key fields: id (pass to SetComponent), * componentType.id (the typeId param), name (display label), position (sort order). * Use product.externalId for ERP/PIM lookups. Check virtualSocketToConnectorsMap for modular assembly validation. */ interface ModularConfiguratorComponent { /** The id unique identifier. */ id: string; /** The modular configurator component type identifier. */ componentType: ModularConfiguratorComponentType; /** Display the name for the product. */ name: string; /** Position index of the product. */ position: number; /** The detailed product information. */ product: Product; /** Connectors between connectors and virtual sockets. */ virtualSocketToConnectorsMap?: ModularConfiguratorVirtualSocketToConnector[]; /** Represents object typename for the component. */ __typename: 'ModularConfiguratorComponent'; } /** * Represents a component type within the modular configurator. * * ### What does it unlock? * Type definition for modular configurator components. Defines the schema and available options for component types. * * ### Practical Application * Component type/category definitions — groups like 'wheel', 'frame', 'seat'. Each type has a collection * of available components. Use to build categorized selection menus (e.g., 'Choose Your Wheel' showing * only wheel-type options). * * ### AI Coding Best Practices * Access from the configurator definition. Use type names as section headers in custom menus. * Filter components by type to populate category-specific selectors. * The type.id is what you pass as typeId to SetComponent. */ interface ModularConfiguratorComponentType { /** Display the name for the component type. */ name: string; /** Position index of the component type. */ position: number; /** Is root current component type or not. */ isRoot: boolean; /** Is required current component type or not. */ isRequired: boolean; /** The id unique identifier. */ id: string; /** Represents object typename for the component type. */ __typename: 'ModularConfiguratorComponentType'; } /** * Represents the mapping between virtual sockets and connectors in the modular configurator. * * ### What does it unlock? * Represents the mapping between virtual sockets and connectors. Manages component connection points. * * ### Practical Application * Maps virtual sockets (connection points) to physical connectors on components. Shows which attachment * points on a component accept which other component types. Used for validating and visualizing * modular assembly connections. * * ### AI Coding Best Practices * Access via component.virtualSocketToConnectorsMap. Use to validate user-proposed assemblies in * drag-and-drop builder UIs. Before calling SetComponent for a child, verify the parent has a * compatible socket. Prevents invalid configurations. */ interface ModularConfiguratorVirtualSocketToConnector { virtualSocketId: string; connectorId: string; /** Represents object typename for the virtual map socket. */ __typename: 'ModularConfiguratorVirtualSocketToConnector'; } /** * Represents a connector in the modular configurator. * * ### What does it unlock? * Defines the connection structure between components. Represents the virtual connectors created * when loading products based on component tags. * * ### Practical Application * Connector definitions for modular assembly — how components physically attach via virtual sockets * and connection tags. Critical for modular products (sectional sofas, modular shelving, multi-piece * systems) where parts snap at defined points. * * ### AI Coding Best Practices * Access via virtualSocketToConnectorsMap on each component. These define which component slots accept * which other components based on matching connection tags. Use to validate proposed assemblies before * sending SetComponent commands in custom builder UIs. */ interface ModularConfiguratorConnector { id: string; componentTypeId1: string; componentTypeId2: string; /** Represents object typename for connector. */ __typename: 'ModularConfiguratorConnector'; } /** * Represents product details including visual assets and configuration. * * ### What does it unlock? * Interface representing a product in the configurator system. Contains product metadata, components, * and configuration options. * * ### Practical Application * Product data model: the base 3D digital twin referenced by each component. Contains product metadata * and externalId (SKU) for e-commerce/ERP mapping. Nested inside each ModularConfiguratorComponent. * * ### AI Coding Best Practices * Access via component.product in the configurator data. Use product.externalId to look up pricing, * inventory, and specs in external systems (ERP, PIM, Shopify, etc.). The product represents the * underlying 3D asset the component renders in the Unreal viewport. */ interface Product { /** The title of the product. */ title: string; /** List of thumbnails for the product. */ thumbnailList: Thumbnail[]; /** Available slots for the product. */ slots: Slot[]; /** List of metaProperties for the product. */ metaProperties: MetaProperty[]; /** List of virtualSockets for the product. */ virtualSockets: VirtualSocket[]; /** * @internal * @hidden * The model information associated with the product. */ model: Model; /** Unique identifier for the product. */ id: string; /** Unique external id for the product. */ externalId: string; /** Showcase details for the product. */ showcase?: Showcase; /** Represents object typename for the product. */ __typename: 'Product'; } /** * Represents a virtual socket on a product used for modular assembly connections. * * ### What does it unlock? * Virtual socket metadata linking abstract connection points to their underlying original sockets * defined on the 3D model. * * ### Practical Application * Virtual sockets are abstraction layers over physical sockets on the 3D model. They group one or * more original sockets under a single named connection point, simplifying the connector logic * for modular assembly. * * ### AI Coding Best Practices * This is an internal data structure managed by MetaBox. Access via `product.virtualSockets` on a * component's product. Typically consumed by the connector validation logic rather than directly * by UI code. */ interface VirtualSocket { /** Unique identifier for the virtual socket. */ id: string; /** Display name of the virtual socket. */ name: string; /** List of original socket identifiers on the 3D model that this virtual socket maps to. */ originalSockets: string[]; } /** * @internal * @hidden * Represents a 3D model asset referenced by a product. * * ### What does it unlock? * Model metadata for the underlying 3D asset. Contains the Unreal Engine asset path, pak file location, * and engine version required to load the model. * * ### Practical Application * Nested inside each {@link Product} as `product.model`. Holds the technical references needed to * load the 3D digital twin in the Unreal viewport — asset path, pak file path, and the Unreal Engine * version the asset was built for. * * ### AI Coding Best Practices * This is an internal data structure managed by MetaBox — you typically do not need to interact with it * directly. The Unreal scene component resolves and loads models automatically. Use `product.externalId` * for business-logic lookups (pricing, inventory) rather than model paths. */ interface Model { /** Unique identifier for the model. */ id: string; /** Unreal Engine asset path used to locate the model within the project. */ assetPath: string; /** Path to the .pak file containing the packaged model asset. */ pakFilePath: string; /** Unreal Engine version the model asset was built for. */ unrealVersion: string; /** Represents object typename for the model. */ __typename: 'Model'; } /** * Represents a thumbnail image entity with dimensions and URL path. * * ### What does it unlock? * Thumbnail interface representing preview images. Contains image data and metadata for visual representation. * * ### Practical Application * Preview image data: contains URLs and metadata for thumbnails used in component selectors, material * swatch pickers, and environment preview cards. Essential for building visual option pickers. * * ### AI Coding Best Practices * Access thumbnailList arrays from materials, environments, and components. Use URLs directly in `` tags. * Implement lazy loading for grids with many options. Consider preloading thumbnails for the currently * visible category. */ interface Thumbnail { /** Width of the thumbnail. */ width: number; /** Height of the thumbnail. */ height: number; /** URL path to the thumbnail image. */ urlPath: string; /** Represents object typename (as a string, flexible type). */ __typename: 'Thumbnail'; } /** * Represents a slot within a product that may allow material customization. * * ### What does it unlock? * Represents a material slot on a component or environment — a customizable surface. * * ### Practical Application * Material slot on a component or environment — represents a customizable surface. Each slot has an id * (used in SetComponentMaterial/SetEnvironmentMaterial) and a list of available materials. * Use to build per-surface material pickers. * * ### AI Coding Best Practices * Access slot definitions from component or environment data in the envelope. Each slot's id is the slotId * parameter for SetComponentMaterial or SetEnvironmentMaterial. Iterate slot.enabledMaterials to build * the swatch picker for that specific surface. */ interface Slot { /** Unique identifier for the slot. */ id: string; /** Display a label for the slot. */ label: string; /** A list of enabled materials for the slot. */ enabledMaterials: Material[]; /** Represents object typename for the slot. */ __typename: 'Slot'; } /** * Represents a metaProperty within a product that may allow business logic customization. * * ### What does it unlock? * Represents a component in the modular configurator with metadata, properties, and hierarchy information. * * ### Practical Application * Represents a component in the modular configurator with metadata, properties, and hierarchy info. * May contain custom key-value data (pricing hints, availability flags, descriptions) set in MetaBox admin. * * ### AI Coding Best Practices * Check for MetaProperty data in component definitions from the configurator data. Custom metadata can * be used for display purposes — tooltips, pricing, lead times, availability badges. These are set by * content teams in MetaBox admin. */ interface MetaProperty { /** Unique identifier for the metaProperty. */ id: string; /** Display the name for the metaProperty. */ name: string; /** Value for the metaProperty. */ value: string; /** Type for the metaProperty. */ type: string; /** Represents object typename for the metaProperty. */ __typename: 'MetaProperty'; } /** * Represents a material that can be applied to a product slot. * * ### What does it unlock? * Describes material characteristics. Contains properties like name, textures, and appearance attributes. * * ### Practical Application * Material data model: id (UUID), title (display name), externalId (SKU for ERP mapping), and * thumbnailList (swatch preview images). Use to build material/finish pickers with visual swatches * and to map selections to external product systems. * * ### AI Coding Best Practices * Access material data from component slot definitions in configuratorDataUpdated. Use title for labels, * thumbnailList for swatch images, externalId to map to your PIM/ERP for pricing and inventory. * Pass material.id to SetComponentMaterial or SetEnvironmentMaterial. */ interface Material { /** Unique identifier for the material. */ id: string; /** Title or name of the material. */ title: string; /** Unique external id for the material. */ externalId: string; /** List of thumbnails for the material. */ thumbnailList: Thumbnail[]; /** * @internal * @hidden * The model information associated with the material. */ model: Model; /** Represents object typename for the material. */ __typename: 'Material'; } /** * Details showcase the presentation of a product. * * ### What does it unlock? * Interface for showcase/demo mode features. Defines properties for timeline-based presentation. * * ### Practical Application * Showcase/demo animation data. Defines camera animation sequences for auto-playing product * presentations — timeline-based with camera movements, transitions, and durations. * Attached to components in the configurator. * * ### AI Coding Best Practices * Check if components have associated showcase data before enabling demo playback buttons. * Use showcase metadata (duration, slot count) to build custom timeline controls. * Playback sequence: InitShowcase → PlayShowcase → monitor via showcaseStatusChanged. */ interface Showcase { /** A list of low-bandwidth versions for the showcase (optional). */ lowBandwidth?: (Timecode | null)[] | null; /** Duration for the showcase (optional). */ duration?: number; /** Represents object typename for the showcase. */ __typename: 'Showcase'; } /** * Represents a low-bandwidth entity used in showcases in LBM mode. * * ### What does it unlock? * Timecode interface for showcase timeline management. Tracks timing and playback position information. * * ### Practical Application * Playback position tracking for showcase animations. Contains current timestamp within the animation * timeline. Use for building progress bars, time displays, or syncing external content (captions, * annotations) to showcase playback. * * ### AI Coding Best Practices * Access timecode data from showcase status events during playback. Use to update progress indicators * in custom playback UIs. Combine with showcaseStatusChanged to build full media player controls * for product demo presentations. */ interface Timecode { /** Time marker for the entity. */ time: number; /** Duration of the entity display. */ duration: number; /** Represents object typename (as a string, flexible type). */ __typename: 'Timecode'; } /** * Represents the environment settings for a modular configurator. * * ### What does it unlock? * Environmental settings interface for the configurator. Contains lighting and atmosphere properties. * * ### Practical Application * Environment settings interface: lighting properties, atmosphere, dynamic sky controls (udsEnabled, * udsHour, sunNorthYaw). Use to build environment/scene selector UIs showing available scene options * with preview thumbnails. * * ### AI Coding Best Practices * Access from configurator.environments in the envelope. Use thumbnailList for visual picker cards. * Display title as label. Check udsEnabled before showing time-of-day slider controls. * List available slots for environment material customization. */ interface ModularConfiguratorEnvironment { /** Unique identifier for the environment. */ environmentId: string; /** Position index of the environment. */ position: number; /** Display label for the environment. */ label: string; /** Detailed environment configuration. */ environment: Environment; /** Represents object typename for the environment. */ __typename: 'ModularConfiguratorEnvironment'; } /** * Represents an environment with associated media and configuration. * * ### What does it unlock? * Environment data model with lighting, sky, and material slot definitions. * * ### Practical Application * Environment data model: id, title, udsEnabled (dynamic sky toggle), sunNorthYaw, udsHour * (time of day for dynamic sky), thumbnailList (preview images), and slots (configurable material slots). * Use to build environment/scene picker UIs. * * ### AI Coding Best Practices * Access environment definitions from configurator.environments in the configuratorDataUpdated envelope. * Use thumbnailList for preview cards. Check udsEnabled to know if time-of-day controls are available. * Iterate slots array to build environment material pickers. */ interface Environment { /** Unique identifier for the environment. */ id: string; /** Title or name of the environment. */ title: string; /** Flag indicating if UDS is enabled. */ udsEnabled: boolean; /** The north yaw of the sun in the environment. */ sunNorthYaw: number; /** The UDS hour setting for the environment. */ udsHour: number; /** List of thumbnails for the environment (optional). */ thumbnailList: Thumbnail[]; /** List of slots for the environment (optional). */ slots: Slot[]; /** * @internal * @hidden * The model information associated with the environment. */ model: Model; /** Represents object typename for the environment. */ __typename: 'Environment'; } /** * Defines the structure for a component tree where every component has id and parent. * * ### What does it unlock? * Describes a component with its parent relationship. Used in component hierarchy representation. * * ### Practical Application * Read-only array entries showing parent-child relationships in the component tree. Returned in * configurationTree of ModularConfiguratorEnvelope. Each entry includes the component and its parent * reference for building hierarchy UIs. * * ### AI Coding Best Practices * Access via envelope.configurationTree from configuratorDataUpdated event. Use to render nested UIs * (tree views, accordions, breadcrumbs) mirroring the modular assembly hierarchy. * The root component will have no parent reference (parentId is null). */ interface ComponentWithParent { id: string; componentTypeId: string; parentId: string | null; } /** * Defines the structure for a mapping of selected materials. * * ### What does it unlock? * Type alias representing selected component/item IDs. Used to track which entities are currently selected. * * ### Practical Application * Record type (key-value map) tracking currently selected IDs. Found in componentMaterialsIds and * environmentMaterialsIds of ModularConfiguratorEnvelope. Maps slot or type keys to selected * material/component UUIDs. * * ### AI Coding Best Practices * Access from configuratorDataUpdated envelope. Use componentMaterialsIds to mark 'active/selected' * state on material swatches in your UI. Use componentsByComponentType to highlight which component * is selected per category. Both update on every state change. */ type SelectedIds = Record>; /** * Defines the structure for an available showcase status for the current component on a scene. * * ### What does it unlock? * Type alias for showcase status states. Defines possible states of showcase/timeline playback. * * ### Practical Application * Type alias: `'init' | 'play' | 'pause' | 'stop'`. Received via showcaseStatusChanged event. * Use to conditionally render playback controls and toggle configurator interactivity during demos. * * ### AI Coding Best Practices * Subscribe to showcaseStatusChanged and switch UI state: 'play' → show pause button, disable config * controls; 'pause' → show play/stop buttons; 'stop' → show play button, re-enable all config controls. */ type ShowCaseStatus = 'init' | 'play' | 'pause' | 'stop'; /** * Defines the structure for a video resolution. * * ### What does it unlock? * Defines video resolution settings for the configurator display. Specifies viewport dimensions. * * ### Practical Application * Video resolution interface: `{width: number|null, height: number|null}`. Received via * videoResolutionChanged event when the pixel stream resolution changes. Use for responsive * layout adjustments or displaying stream quality info. * * ### AI Coding Best Practices * Subscribe to videoResolutionChanged to monitor stream resolution. Use to dynamically adjust UI * overlay positioning, inform users about stream quality, or scale screenshot size requests proportionally. */ interface VideoResolution { width: number | null; height: number | null; } /** * Video stream statistics reported by the Metabox player. * * ### What does it unlock? * Real-time video quality metrics from the WebRTC stream — useful for monitoring * bitrate, frame rate, latency, and packet loss. * * ### Practical Application * Delivered as the payload of the `videoStatsUpdated` event. * Use it to build quality-of-service dashboards or trigger adaptive behaviour * (e.g. show a warning when `packetsLost` climbs or `framesDropped` is high). * * ### AI Coding Best Practices * Subscribe via `api.addEventListener('videoStatsUpdated', (stats: VideoStats) => {...})`. */ interface VideoStats { /** Video encoder quantization parameter (lower = better quality). */ qp?: number; /** Current bitrate in bits per second. */ bitrate?: number; /** Decoded frames per second. */ framesPerSecond?: number; /** Inter-arrival jitter in seconds. */ jitter?: number; /** Current round-trip time in seconds. */ rtt?: number; /** The total number of frames successfully decoded. */ framesDecoded?: number; /** The total number of frames dropped. */ framesDropped?: number; /** Total number of frames received. */ framesReceived?: number; /** Total number of packets lost. */ packetsLost?: number; } /** * Represents an ecom configurator object with all necessary information about cta. * * ### What does it unlock? * Configuration interface for the embedded MetaBox menu. Specifies settings and behavior for the menu system. * * ### Practical Application * Configuration interface for the e-commerce/CTA system. Received via ecomConfiguratorDataUpdated event. * Defines CTA button settings (label, callback URL) for the built-in or custom purchase workflow. * * ### AI Coding Best Practices * Read-only data — subscribe to ecomConfiguratorDataUpdated to receive. If building custom UI, extract * the CTA label and display it on your own button. The callback URL is where MetaBox POSTs the * configuration data when CTA is triggered. */ interface EcomConfigurator { /** The unique ecom configurator identifier. */ id: string; /** The created data of ecom configurator. */ createdAt: string; /** A reference to the Call To Action Information. */ cta?: Cta; /** Represents object typename for the ecom configurator. */ __typename: 'Configurator'; } /** * Represents the call-to-action information for an ecom configurator. * * ### What does it unlock? * Call-to-Action interface. Defines interactive elements and buttons for user actions within the configurator. * * ### Practical Application * Read-only CTA definition containing the label text and action URL configured in MetaBox admin. Received via * ecomConfiguratorDataUpdated event. Use to render custom CTA buttons matching admin-configured actions * (e.g., 'Request Quote', 'Add to Cart'). * * ### AI Coding Best Practices * Subscribe to ecomConfiguratorDataUpdated to receive CTA config. Use the label for button text. * The actual CTA trigger is `api.sendCommandToMetabox(new GetCallToActionInformation())` — which POSTs * the config JSON to the callback URL. The backend returns `{ redirectUrl }`. */ interface Cta { /** The indicator of whether the call-to-action is enabled or not. */ enabled: boolean; /** Label of button for call-to-action. */ label: string; /** Callback URL using for sent configurator selected information to this url and redirected to the url after get response. */ callbackUrl: string; /** Represents object typename for the CTA object. */ __typename: 'Cta'; } /** * Maps event names received from the Metabox iframe to their typed payloads. * Used by {@link Communicator.addEventListener} to provide type-safe event subscriptions. * * ### What does it unlock? * Message format for MetaBox communication protocol. Wraps data for transmission between API and MetaBox. * * ### Practical Application * Payload type map for all incoming event types. Defines the data shape for each event name * (configuratorDataUpdated, screenshotReady, viewportReady, etc.). Essential TypeScript reference for properly typing event handlers. * * ### AI Coding Best Practices * Use as TypeScript type reference: `api.addEventListener('configuratorDataUpdated', (data: FromMetaboxMessagePayloads['configuratorDataUpdated']) => {...})`. * Key events and their types: configuratorDataUpdated→ModularConfiguratorEnvelope, screenshotReady→string|null, * viewportReady→boolean, showcaseStatusChanged→ShowCaseStatus. */ interface FromMetaboxMessagePayloads { /** * Dispatches every time the configurator data is updated. * I.e., when the user changes the configuration. (Material, Component Tree, Components, Component Type, Environment) */ configuratorDataUpdated: ModularConfiguratorEnvelope; /** * Dispatches every time the ecom configurator data is updated (label, endpointUrl). */ ecomConfiguratorDataUpdated: EcomConfigurator; /** * Dispatches every time when the Unreal Viewport is visible/hidden. */ viewportReady: boolean; /** * Dispatches every time when while the configurator loads. Shows showcase status information on a scene. */ showcaseStatusChanged: ShowCaseStatus; /** * Dispatches at the moment while the configurator loads. Shows status information. */ statusMessageChanged: string | null; /** * Dispatches every time when Unreal is sending an ordered render with a new GetScreenshot() command. */ screenshotReady: string | null; /** * Dispatches every time when Unreal is changing its video stream size. */ videoResolutionChanged: VideoResolution; /** * Dispatches every time when the User sends get camera command new GetCamera() command. */ getCameraResult: CameraCommandPayload; /** * @deprecated * Dispatches every time when the configurator connected/disconnected with Unreal Engine. */ dataChannelConnected: boolean; /** * Dispatches periodically with aggregated video stream statistics. */ videoStatsUpdated: VideoStats; /** * Dispatches when the loading progress or loader visibility changes. * `percents` is the smoothed progress value (0–100). * `loaderVisible` indicates whether the loading overlay is currently shown. */ loadingStatusChanged: { percents: number; loaderVisible: boolean; }; /** * Dispatches when user inactivity (AFK) is detected and the countdown to disconnect begins. * `remainingSecondsToDisconnect` counts down (e.g. 15, 14, 13…) until the session is terminated. * `countdownVisible` indicates whether the AFK countdown popup is currently shown. */ userInactivityDetected: { remainingSecondsToDisconnect: number; countdownVisible: boolean; }; } /** * Union of all event names received from MetaBox. * * ### What does it unlock? * Type alias for MetaBox API actions coming from the server. Defines all possible action types. * * ### Practical Application * Type alias enumerating all possible incoming action/event types from MetaBox. Reference as a complete * checklist of subscribable events for building comprehensive event handling. * * ### AI Coding Best Practices * Use as a reference for all valid event names in api.addEventListener(). Key events: * configuratorDataUpdated, viewportReady, screenshotReady, showcaseStatusChanged, getCameraResult, * statusMessageChanged, ecomConfiguratorDataUpdated, videoResolutionChanged, videoStatsUpdated. * * @hidden */ type FromMetaBoxApiEvents = keyof FromMetaboxMessagePayloads; /** * @internal * This creates all event envelopes defined in MetaBoxAPIPayloads. * * ### What does it unlock? * Envelope structure for wrapping MetaBox API messages. Encapsulates commands and data for transmission. * * ### Practical Application * Protocol envelope structure wrapping all MetaBox API messages. Internal to the communication layer — adds * routing and protocol headers. The Communicator handles this automatically. * * ### AI Coding Best Practices * For debugging: inspect postMessage events in browser devtools and match * against this structure to diagnose malformed messages. The Communicator handles all wrapping/unwrapping. */ interface MetaBoxApiEnvelope { action: 'bridge'; eventType: T; payload: FromMetaboxMessagePayloads[T]; } /** * Identifies which side of the iframe boundary the Communicator is running on. * * ### What does it unlock? * Distinguishes which side of the postMessage channel the Communicator is operating on — * `'host'` for the embedding page and `'metabox'` for the iframe. * * ### Practical Application * Used internally by the Communicator to tag outgoing messages so the receiving side can verify their origin. * You never need to set or check this value in application code. * * ### AI Coding Best Practices * Skip in application code. The Communicator sets this automatically based on the `createInstance()` call. * Only relevant if debugging raw postMessage traffic between your page and the MetaBox iframe. */ type MetaboxEnvironment = 'metabox' | 'host'; /** * @hidden * @internal * Used for signaling that the app is loaded and ready to open api. */ interface MCAppLoaded { action: typeof AppLoaded; eventType?: unknown; payload: { appId: string; version?: string; }; } /** * @internal * @hidden * This creates a union of all event envelopes defined in MetaBoxAPIPayloads. */ type FromMetaBoxAPIEnvelope = { [K in keyof FromMetaboxMessagePayloads]: MetaBoxApiEnvelope; }[keyof FromMetaboxMessagePayloads] | MCAppLoaded; /** * @internal * @hidden */ type FromMetaboxTarget = 'parent' | 'communicator'; /** * @internal * @hidden * Top-level postMessage structure received from the Metabox iframe. * * ### What does it unlock? * Represents the Top-level postMessage structure received from the Metabox iframe. Contains read-only data. * * ### Practical Application * Incoming message wrapper from MetaBox. Defines how MetaBox wraps response data for postMessage delivery. * Internal to communication layer — the Communicator parses these automatically. * * ### AI Coding Best Practices * Do not parse these manually. The Communicator handles unwrapping and delivers typed payloads to your event listeners. * Only reference if debugging raw postMessage traffic in browser devtools. */ interface FromMetaBoxMessage { host: typeof Metabox; envelope: FromMetaBoxAPIEnvelope; target: FromMetaboxTarget; } /** * Base class for commands sent to the Metabox API. * * ### What does it unlock? * Base class that all other commands inherit from in a class hierarchy. Provides common properties * and methods that are automatically available to all command subclasses. * * ### Practical Application * Base class all commands inherit from. Never instantiate directly — use specific subclasses like * SetProduct, SetCamera, etc. All commands are sent via `api.sendCommandToMetabox(new CommandName(...))`. * * ### AI Coding Best Practices * Never construct a generic CommandBase. Always use the specific typed command class. When generating * dynamic command dispatch, use a switch/map pattern matching command names to their constructors. * * @internal * @hidden */ declare class CommandBase { /** The message envelope populated by subclass constructors and sent via {@link Communicator.sendCommandToMetabox}. */ data: ToMetaBoxMessageEnvelope; } /** * Represents a callback listener for specific message types. * Used internally by EventDispatcher to store event listeners. * * ### What does it unlock? * Event listener interface. Allows subscription to specific events from the configurator to receive real-time data updates. * * ### Practical Application * Event listener interface. addEventListener() and removeEventListener() on Communicator. Subscribe to real-time * configurator events: state changes, viewport readiness, screenshots, showcase status, camera results, resolution changes. * * ### AI Coding Best Practices * Set up listeners BEFORE sending commands that trigger them. Always clean up with removeEventListener on component unmount. * Key events: configuratorDataUpdated (every state change), viewportReady (init complete), screenshotReady (captures), * getCameraResult (camera queries), showcaseStatusChanged (demo playback). * * @public */ interface Listener { /** The message type this listener is registered for */ messageType: string; /** The callback function to execute when a message of the specified type is received */ callback: (data: unknown) => void; } /** * EventDispatcher is a class that manages event listeners and dispatches events to them. * * ### What does it unlock? * Parent class of Communicator that dispatches commands. Acts as an event dispatcher that routes command messages internally. * * ### Practical Application * Internal event routing layer — parent class of Communicator. Routes postMessage commands between your app * and the Unreal Engine pixel stream. Not used directly but understanding it helps debug message delivery issues. * * ### AI Coding Best Practices * Do not reference or extend EventDispatcher in application code. Use only the Communicator interface methods. * If debugging communication failures, check browser console for postMessage errors related to this layer. */ declare class EventDispatcher { /** * Storage for callback listeners by message type. */ listeners: Listener[]; /** * Removes all registered listeners. Subclasses override this to perform additional cleanup. * @param key - Instance key (used by subclass overrides for registry cleanup). */ destroy(key: string): void; /** * Adds an event listener for receiving specific types of messages. * * @param {string} messageType - The message type to listen for. * @param callback - The callback function to execute when a message is received. */ addEventListener(messageType: string, callback: (data: unknown) => void): this; /** * Dispatches an event to all listeners of a specific message type. * * @param {string} messageType - The message type. * @param data - The data associated with the event. */ dispatchEvent(messageType: string, data: unknown): this; /** * Removes an event listener for a specific type of message. * * @param {string} messageType - The message type. * @param callback - The callback function to remove. */ removeEventListener(messageType: string, callback: (data: unknown) => void): this; } /** * Handles messaging between the host page and embedded Metabox content. * * ### What does it unlock? * Internal class that creates a proxy/communication layer between the API and MetaBox. * Handles reading and sending commands through the established connection. * * ### Practical Application * The API handle returned in the integrateMetabox callback. Provides sendCommandToMetabox() to send commands, * and addEventListener()/removeEventListener() for event subscriptions. This is your entire interface to * the MetaBox Unreal Engine stream. * * ### AI Coding Best Practices * Store the Communicator reference from the apiReadyCallback in a module-scoped variable or state store. * NEVER send commands before this callback fires. All commands and event listeners go through this single * api object. Clean up listeners with removeEventListener on component unmount. * * @internal Use {@link Communicator.createInstance} or the {@link integrateMetabox} helper to instantiate. */ declare class Communicator extends EventDispatcher { /** * Bound handler for incoming postMessage events. */ private binder; /** * Constructs a Communicator, replacing any existing instance, and begins listening for messages. * @internal */ constructor(data: MCAppLoaded['payload'], environment: MetaboxEnvironment, config?: Partial); /** * Listens for Metabox to signal readiness, then initializes communicator. * @param apiReadyCallback - Called with the new Communicator once the Metabox is loaded. * @param {MetaboxEnvironment} environment - The environment in which the Communicator is running. * @param {MetaboxCommandConfig} config - optional initial config: standalone - if true - disable metabox custom template and all logic * @returns A cancel function that removes the handshake `message` listener. * `integrateMetabox` (the public entry point) calls this automatically when * a new integration supersedes a still-pending one, so direct internal * callers only need it for explicit early teardown. Idempotent. */ static createInstance(apiReadyCallback: (api: Communicator) => void, environment: MetaboxEnvironment, config?: Partial): () => void; /** * Cleans up resources and stops listening for messages. */ destroy(key: string): void; /** Destroys all active Communicator instances and clears the internal registry. */ static clearAll(): void; /** * Retrieves a registered Communicator instance by its key. * @param key - The composite key (`version_environment_appId`) identifying the instance. */ static getCommunicator(key: string): { instance: Communicator; } | undefined; /** * Posts a command to the Metabox iframe. * @param command - An action command containing data to send. */ sendCommandToMetabox(command: T): void; /** * Registers an event listener for messages dispatched by the Metabox. * @param messageType - The event name to listen for (e.g. `'configuratorDataUpdated'`). * @param callback - Handler invoked with the typed payload when the event fires. * @override */ addEventListener(messageType: T, callback: (data: FromMetaboxMessagePayloads[T]) => void): this; /** * Dispatches a typed event to all registered listeners. * @param messageType - The event name to dispatch. * @param data - The payload to pass to each listener. * @override */ dispatchEvent(messageType: T, data: FromMetaboxMessagePayloads[T]): this; /** * Removes a previously registered event listener. * @param messageType - The event name the listener was registered for. * @param callback - The same function reference that was passed to {@link addEventListener}. * @override */ removeEventListener(messageType: T, callback: (data: FromMetaboxMessagePayloads[T]) => void): this; /** * Filters and dispatches incoming messages from the Metabox. * @param event - The postMessage event received on a window. */ private handleMessageReceived; } /** * Integrates the Metabox Modular Configurator into the page by injecting an iframe and * initializing a Communicator instance for host-to-iframe messaging. * * - Builds a secure iframe URL using the provided configuratorId and config options. * - Ensures the resulting URL uses HTTPS and that the target container exists. * - Removes any previously embedded iframe with id "embeddedContent" before inserting a new one. * * ### What does it unlock? * Main initialization function for MetaBox integration. Initializes the configurator, receives an API handle, * and sets up all configurations. * * ### Practical Application * is THE entry point function. Creates the configurator iframe, establishes postMessage communication, and returns * the Communicator api handle via callback. Call ONCE per configurator. Params: configuratorId (modular UUID), * containerId (DOM element ID, default 'embed3DSource'), apiReadyCallback, config (IntegrateMetaboxConfig). * * ### AI Coding Best Practices * Pattern: `integrateMetabox('uuid', 'div-id', (api) => { * set up listeners, then set a root component, then environment, then children * }, { standalone: true })`. * Ensure a container div exists in DOM with non-zero dimensions. HTTPS required. * Inside callback: 1) addEventListener for configuratorDataUpdated, 2) SetComponent root, 3) SetEnvironment, * 4) SetComponent children, 5) SetComponentMaterial. * * @param {string} configuratorId - The Modular Configurator ID (not a full URL). It is appended to * `https://{domain}/metabox-configurator/modular/{configuratorId}` to form the iframe src. * * @param {string} containerId - The id of the container element where the iframe will be injected. * * @param {(api: Communicator) => void} apiReadyCallback - Called when the Communicator instance is created on the host side. * * @param {IntegrateMetaboxConfig} config - Optional configuration used to build the iframe URL and initialize the communicator. * Supported fields: * - standalone?: boolean — if true, disables Metabox custom template and related logic. * - introImage?: string — URL to an image shown on the intro screen (added as ?introImage=...). * - introVideo?: string — URL to a video shown on the intro screen (added as ?introVideo=...). * - loadingImage?: string — URL to an image displayed while loading (added as ?loadingImage=...). * - state?: string — Predefined state for configurator for initial loading (added as ?state=...). * - domain?: string — custom domain for testing (defaults to metabox.3dsource.com). HTTPS is enforced. * - showLoadingProgress?: boolean — if true, shows the loading progress bar (added as ?showLoadingProgress=true). * - showResumeStreamPopup?: boolean — if true, shows the resume stream popup (added as ?showResumeStreamPopup=true). * - showUserInactivityTimer?: boolean — if true, shows the AFK countdown popup (added as ?showUserInactivityTimer=true). * - userInactivityTimeout?: number — inactivity timeout in seconds before disconnect (added as ?userInactivityTimeout=...). * * @throws Error If configuratorId or containerId are empty strings. * @throws Error If the computed iframe URL is invalid or does not use HTTPS. * @throws Error If the container element with the provided id cannot be found. * * @returns A cancel function that stops waiting for the Metabox to load. * Calling it is optional — a later `integrateMetabox` call automatically * supersedes a still-pending handshake — but it lets you remove the handshake * listener immediately on teardown (e.g. SPA route change before * `apiReadyCallback` fires). Idempotent. * * @example * import { integrateMetabox } from '@3dsource/metabox-modular-configurator-api'; * * integrateMetabox('configurator-id', * 'embed3DSource', * (api) => { * // Communicator is ready to use * }, * { * standalone: false, * introImage: 'https://example.com/intro.png', * loadingImage: 'https://example.com/loading.png', * showLoadingProgress: true, * showResumeStreamPopup: true, * showUserInactivityTimer: true, * userInactivityTimeout: 20, * }, * ); */ declare function integrateMetabox(configuratorId: string, containerId: string, apiReadyCallback: (api: Communicator) => void, config?: IntegrateMetaboxConfig): () => void; /** * Saves an image by triggering a download. * * This function creates an anchor element, sets its `href` attribute to the provided image URL, * and triggers a click event to initiate a download with the specified filename. * * ### What does it unlock? * Main exported function to save images from the configurator. Converts base64 image data to actual image * files and saves them to the local filesystem. * * ### Practical Application * Exported utility function that converts base64 screenshot data (from screenshotReady event) to a downloadable * image file. Handles the base64 → blob → browser download flow. Import directly from the API package. * * ### AI Coding Best Practices * Pattern: `api.addEventListener('screenshotReady', (data) => { if(data) saveImage(data, 'config-screenshot.png'); })`. * Filename extension should match the MimeType passed to GetScreenshot. * Import: `import { saveImage } from '@3dsource/metabox-modular-configurator-api'`. * * @param {string} imageUrl - The URL of the image to save. * @param {string} filename - The name of the file to save. */ declare function saveImage(imageUrl: string, filename: string): void; /** * Constructs the iframe source URL for the Metabox Modular Configurator. * * ### What does it unlock? * Utility function that prepares the iframe source URL. Constructs the proper URL with parameters * for loading the MetaBox configurator. * * ### Practical Application * Utility function that constructs the iframe source URL with proper parameters. * URL format: `https://{domain}/metabox-configurator/modular/{configuratorId}`. * Called internally by integrateMetabox() — use directly only for manual URL construction. * * ### AI Coding Best Practices * Usually called internally. Use directly only for pre-constructing embed URLs (QR codes, email links, * preview URLs). Verify output is HTTPS. Remember modular configurators use `/modular/` path. * * @internal * @hidden * * @param {string} configuratorId - An string identifier for the configurator. * @param {IntegrateMetaboxConfig} config - An object containing the configuration options. */ declare const prepareIframeSrc: (configuratorId: string, config?: IntegrateMetaboxConfig) => string; /** * Wrapper helper function to use with RxJS the same way as `fromEvent`, to listen to events from the Communicator. * * ### What does it unlock? * Function that creates an event listener subscription. Allows developers to subscribe to specific events from the Communicator. * * ### Practical Application * Function that creates event listener subscriptions. Alternative to api.addEventListener() — both subscribe * to configurator events. Use to react to state changes, screenshot readiness, viewport loading, showcase status, etc. * * ### AI Coding Best Practices * Prefer api.addEventListener() directly from the Communicator object. If using fromCommunicatorEvent, pass the * event name and handler. Key events: configuratorDataUpdated, viewportReady, screenshotReady, showcaseStatusChanged, * getCameraResult. Always subscribe BEFORE sending commands that trigger responses. * * @param {Communicator} target - The Communicator instance to listen on. * @param {T} eventName - The event name from {@link FromMetaBoxApiEvents} to subscribe to. * @returns An Observable that emits the typed payload each time the event fires. * @internal */ declare function fromCommunicatorEvent(target: Communicator, eventName: T): Observable; /** * Represents a command to send Metabox Config to Metabox Modular Configurator. * * ### What does it unlock? * Configuration object passed to MetaBox during initialization. Specifies domain, host, standalone mode, * and other parameters that control how the configurator behaves. * * ### Practical Application * Internal configuration object auto-sent during initialization. Contains appId and config. * DO NOT call directly — integrateMetabox() handles this automatically as part of its setup sequence. * * ### AI Coding Best Practices * NEVER instantiate or send MetaboxConfig manually. It is auto-sent by integrateMetabox(). * Use the IntegrateMetaboxConfig parameter of integrateMetabox() instead for setting domain, standalone, * loadingImage, introImage, state, etc. * * @internal * Automatically sent when the Communicator instance is ready. * * @param {string} appId - The unique identifier for the Communicator Instance * @param {MetaboxCommandConfig} config - optional initial config: standalone - if true - disable metabox custom template and all logic */ declare class MetaboxConfig extends CommandBase { constructor(appId: string, config: MetaboxCommandConfig); } /** * Represents a command to get a PDF from Metabox Modular Configurator. * This class sends a message to the Metabox API to generate a PDF based on the current configuration. * **Important**: No need to listen to any events to see changes. Pdf will be downloaded automatically once it's ready. * * ### What does it unlock? * Generates a native MetaBox PDF document. No subscription required — it executes independently. * * ### Practical Application * Generates a branded PDF from the current configurator state server-side. No event subscription needed. * Use for B2B quote workflows, downloadable spec sheets, or emailing configured product summaries to prospects. * * ### AI Coding Best Practices * Simply call `api.sendCommandToMetabox(new GetPdf())`. No parameters or event subscription required. * The PDF generates inside MetaBox application. * * @example * import { GetPdf, Communicator } from '@3dsource/metabox-modular-configurator-api'; * window.env3DSource.apiReady = (api: Communicator) => { * api.sendCommandToMetabox(new GetPdf()); * }; */ declare class GetPdf extends CommandBase { constructor(); } /** * Represents a command to get a Call To Action Information from Metabox Modular Configurator. * This class sends a message to the Metabox API to generate Call To Action information based on the current * configuration and sends it to the endpoint URL from the CTA information. * * To listen for changes after sending this command, listen to the 'ecomConfiguratorDataUpdated' event. * * ### What does it unlock? * Retrieves information about call-to-action that were added to the configurator. Requires subscription to receive data. * * ### Practical Application * Triggers the CTA (Call-to-Action) workflow configured in MetaBox admin. The CTA label and callback URL are set in admin. * When invoked, MetaBox POSTs the full configuration JSON (including BOM) to your callback URL endpoint, which returns a { redirectUrl }. * * ### AI Coding Best Practices * Call only after user completes configuration. Subscribe to ecomConfiguratorDataUpdated to get CTA label/URL for building * custom CTA buttons in your UI. The POST payload includes the full bill of materials — your backend endpoint processes it * and returns a redirect URL. * * @example * import { Communicator, EcomConfigurator, GetCallToActionInformation } from '@3dsource/metabox-modular-configurator-api'; * window.env3DSource.apiReady = (api: Communicator) => { * * //Subscribe to the event before sending the command to ensure you capture the response * api.addEventListener('ecomConfiguratorDataUpdated', (data:EcomConfigurator) => { * console.log('Ecom configurator params:', data); * }); * * // Send the command to get Call To Action information from Metabox Modular Configurator * api.sendCommandToMetabox(new GetCallToActionInformation()); * }; */ declare class GetCallToActionInformation extends CommandBase { constructor(); } /** * Represents a command to get the camera configuration from Unreal. * This class sends a message to the Metabox API to get the camera from a scene. * To listen for changes after sending this command, listen to the 'getCameraResult' event. * * ### What does it unlock? * Retrieves camera presets for the configurator; allowing extraction and application of saved camera positions. * * ### Practical Application * Requests current camera state — returns asynchronously via the getCameraResult event. Returns a CameraCommandPayload * with fov, mode, position, rotation, and restrictions. Use to save camera positions, create shareable view links, * or build 'save this angle' features. * * ### AI Coding Best Practices * ALWAYS subscribe to getCameraResult BEFORE calling GetCamera(). Pattern: `api.addEventListener('getCameraResult', handler);` * then `api.sendCommandToMetabox(new GetCamera())`. The returned CameraCommandPayload can be fed directly back into * SetCamera to restore the view. * * @example * import { Communicator, CameraCommandPayload, GetCamera } from '@3dsource/metabox-modular-configurator-api'; * window.env3DSource.apiReady = (api: Communicator) => { * * //Subscribe to the event before sending the command to ensure you capture the response * api.addEventListener('getCameraResult', (data:CameraCommandPayload) => { * console.log('Camera params after get camera command:', data); * }); * * api.sendCommandToMetabox(new GetCamera()); * }; */ declare class GetCamera extends CommandBase { constructor(); } /** * Represents a command to set the camera configuration. * This class sends a message to the Metabox API to set the camera on a scene. * **Important**: No need to listen to any events to see changes. * * ### What does it unlock? * Sets camera presets with restriction parameters (FOV, rotation, position). * * ### Practical Application * Sets camera with precise control: fov (degrees), mode ('orbit'|'fps'), position ({x,y,z}), * rotation ({horizontal,vertical}), and restrictions (min/max distance, FOV, rotation bounds). * Use for guided tours, preset view buttons, or restricting camera to prevent users seeing behind the product. * * ### AI Coding Best Practices * Only include fields you want to change — omitted values keep current settings. Use orbit mode for typical product viewing, * fps for walkthrough/room scenes. Apply restrictions to prevent bad angles. Full interface: * `{fov?, mode?, position?, rotation?, restrictions?}`. * * @example * import { SetCamera, Communicator } from '@3dsource/metabox-modular-configurator-api'; * window.env3DSource.apiReady = (api: Communicator) => { * api.sendCommandToMetabox(new SetCamera({ * fov: 45, * mode: 'orbit', * position: { x: 100, y: 100, z: 100 }, * rotation: { horizontal: 0, vertical: 0 }, * restrictions: { * maxDistanceToPivot: 0, * maxFov: 0, * maxHorizontalRotation: 0, * maxVerticalRotation: 0, * minDistanceToPivot: 0, * minFov: 0, * minHorizontalRotation: 0, * minVerticalRotation: 0, * }, * })); * }; * * @param {CameraCommandPayload} camera - The camera configuration. */ declare class SetCamera extends CommandBase { constructor(camera: CameraCommandPayload); } /** * Represents a command to reset the camera to its initial position. * This class sends a message to the Metabox API to reset the camera on a scene. * * ### What does it unlock? * Resets the camera to its default state and position. Used to return camera to initial configuration after user manipulation. * * ### Practical Application * Resets camera to the default position defined in the component/environment template. Essential for 'Reset View' buttons. * Also, useful after programmatic camera moves to return to a known starting state. * * ### AI Coding Best Practices * Call `api.sendCommandToMetabox(new ResetCamera())`. No parameters. Restores template defaults — not the last user position. * Good practice to call after SetComponent changes that may shift the focal point of the assembly. * * @example * import { ResetCamera, Communicator } from '@3dsource/metabox-modular-configurator-api'; * window.env3DSource.apiReady = (api: Communicator) => { * api.sendCommandToMetabox(new ResetCamera()); * }; */ declare class ResetCamera extends CommandBase { constructor(); } /** * Represents a command to reset the modular configurator state to its defaults. * This class sends a message to the Metabox API to restore the component tree, component materials, * environment, and environment materials to the values defined by the configurator template. * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event. * * ### What does it unlock? * Resets the entire modular configurator state to defaults — root and child components, all component * material selections, environment, and environment materials all return to the template-defined initial * values. Used to give users a clean 'Start Over' affordance without reloading the iframe. * * ### Practical Application * Powers 'Reset to Defaults' / 'Start Over' buttons in modular configurators where users have built up * an assembly with multiple SetComponent / SetComponentMaterial calls. Unlike ResetCamera (which only * touches viewport state), ResetConfiguration wipes all user-applied selections back to template * defaults. The configurator responds with a full ModularConfiguratorEnvelope via configuratorDataUpdated, * so UI state derived from the envelope (configurationTree, componentsByComponentType, material chips) * will re-sync automatically. * * ### AI Coding Best Practices * Call `api.sendCommandToMetabox(new ResetConfiguration())`. No parameters. Subscribe to * configuratorDataUpdated BEFORE sending so you capture the reset envelope. If your UI maintains local * selection state separate from the envelope, clear it in the same handler. After reset, the root * component is back to the template default — no need to re-issue SetComponent for the root unless you * want a different starting assembly. Pair with ResetCamera if you also want the viewport returned to * its default framing. * * @example * import { ResetConfiguration, Communicator, ModularConfiguratorEnvelope } from '@3dsource/metabox-modular-configurator-api'; * window.env3DSource.apiReady = (api: Communicator) => { * * //Subscribe to the event before sending the command to ensure you capture the response * api.addEventListener('configuratorDataUpdated', (data: ModularConfiguratorEnvelope) => { * console.log('Configurator reset to default state:', data); * }); * * api.sendCommandToMetabox(new ResetConfiguration()); * }; */ declare class ResetConfiguration extends CommandBase { constructor(); } /** * Represents a command to apply zoom and change the camera zoom on a scene. * This class sends a command to the Metabox API to change zoom on a scene. * * ### What does it unlock? * Controls zoom functionality for the configurator; allowing users to adjust the zoom level of 3D objects and camera presets. * * ### Practical Application * Implements programmatic zoom on the pixel-streamed viewport. Use to build zoom slider controls, pinch-to-zoom on mobile, * or 'zoom to detail' buttons. Takes a numeric delta: positive zooms in, negative zooms out * (e.g., ApplyZoom(50) zooms in, ApplyZoom(-50) zooms out). * * ### AI Coding Best Practices * Always use numeric delta values, not absolute zoom levels. Pair with a UI slider that sends incremental values. * Debounce zoom input to ~100ms intervals to prevent overwhelming the Unreal stream. * Pattern: `api.sendCommandToMetabox(new ApplyZoom(50))`. * * @example * import { ApplyZoom, Communicator } from '@3dsource/metabox-modular-configurator-api'; * window.env3DSource.apiReady = (api: Communicator) => { * api.sendCommandToMetabox(new ApplyZoom(50)); * }; * * @param {number} zoom - The zoom value to apply. */ declare class ApplyZoom extends CommandBase { constructor(zoom: number); } /** * Represents a command to initialize Showcase for a component scene and start a sequence for the component. * This class sends a command to the Metabox API to initialize showcase if the component has a sequence. * To check this, find the showcase property in the current component and listen to the 'configuratorDataUpdated' event. * If this property exists, you can send the init showcase command. * * To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event. * * ### What does it unlock? * Initializes and displays the showcase/demo view for the configurator. Used when transitioning into presentation or demo mode. * * ### Practical Application * Loads the showcase/animation sequence attached to the current component. Must be called BEFORE PlayShowcase. * Use to initialize auto-playing product demos, trade show presentations, or hero section animations on landing pages. * * ### AI Coding Best Practices * ALWAYS call InitShowcase() before PlayShowcase(). Required sequence: InitShowcase → PlayShowcase → PauseShowcase/StopShowcase. * Subscribe to showcaseStatusChanged to track playback state ('playing'/'paused'/'stopped'). * * @example * import { Communicator, ShowCaseStatus, InitShowcase } from '@3dsource/metabox-modular-configurator-api'; * window.env3DSource.apiReady = (api: Communicator) => { * //Subscribe to the event before sending the command to ensure you capture the response * api.addEventListener('showcaseStatusChanged', (data:ShowCaseStatus) => { * console.log('Showcase status value after changed:', data); * }); * * api.sendCommandToMetabox(new InitShowcase()); * }; */ declare class InitShowcase extends CommandBase { constructor(); } /** * Represents a command to play Showcase for a component when it is already initialized and paused. * This class sends a command to the Metabox API to play showcase for a component if it is already initialized and paused. * * To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event. * * ### What does it unlock? * Starts or resumes the showcase/timeline playback. Executes the internal MetaBox play command internally. * * ### Practical Application * Starts or resumes showcase playback. Use for 'Play Demo' buttons on landing pages, auto-play on page load, * or resuming demos after inactivity timeout on kiosk displays. * * ### AI Coding Best Practices * Call `api.sendCommandToMetabox(new PlayShowcase())`. Must call InitShowcase() first or it won't play. * Subscribe to showcaseStatusChanged to track state. Auto-play pattern: wait for viewportReady → InitShowcase → * PlayShowcase. * * @example * import { Communicator, PlayShowcase } from '@3dsource/metabox-modular-configurator-api'; * window.env3DSource.apiReady = (api: Communicator) => { * //Subscribe to the event before sending the command to ensure you capture the response * api.addEventListener('showcaseStatusChanged', (data) => { * console.log('Showcase status value after changed:', data); * }); * * api.sendCommandToMetabox(new PlayShowcase()); * }; */ declare class PlayShowcase extends CommandBase { constructor(); } /** * @internal * @hidden * Represents a command to send Unreal command. */ declare class UnrealCommand extends CommandBase { constructor(payload: object); } /** * Represents a command to pause Showcase for a component when it is already initialized and playing. * This class sends a command to the Metabox API to pause showcase for a component if it is already initialized and playing. * * To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event. * * ### What does it unlock? * Pauses the showcase/timeline playback. Can be called independently without requiring any flag parameters. * * ### Practical Application * Pauses showcase animation playback. The showcase remains initialized and can be resumed with * PlayShowcase. Use when you need to temporarily freeze the animation (e.g., on a "Pause" button click). * * ### AI Coding Best Practices * Call `api.sendCommandToMetabox(new PauseShowcase())`. No parameters. Subscribe to showcaseStatusChanged * to confirm 'pause' state. Use PlayShowcase to resume or StopShowcase to reset. * * @example * import { Communicator, ShowCaseStatus, PauseShowcase } from '@3dsource/metabox-modular-configurator-api'; * window.env3DSource.apiReady = (api: Communicator) => { * * //Subscribe to the event before sending the command to ensure you capture the response * api.addEventListener('showcaseStatusChanged', (data:ShowCaseStatus) => { * console.log('Showcase status value after changed:', data); * }); * * api.sendCommandToMetabox(new PauseShowcase()); * }; */ declare class PauseShowcase extends CommandBase { constructor(); } /** * Represents a command to stop Showcase for a component when it is already initialized, and you want to destroy it. * This class sends a command to the Metabox API to stop showcase for a component if it is already initialized. * * To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event. * * ### What does it unlock? * Stops the showcase/timeline playback and closes the showcase mode. Returns to normal configurator view. * * ### Practical Application * Stops showcase playback and exits showcase mode entirely. Returns to normal interactive configurator view. * Use for 'Exit Demo' buttons or auto-trigger when the user starts actively configuring the product. * * ### AI Coding Best Practices * Call `api.sendCommandToMetabox(new StopShowcase())`. Fully resets the showcase state. Subscribe to * showcaseStatusChanged to confirm 'stopped' status. After stopping, the configurator returns to full * interactive mode — re-enable configuration controls. * * @example * import { Communicator, ShowCaseStatus } from '@3dsource/metabox-modular-configurator-api'; * window.env3DSource.apiReady = (api: Communicator) => { * * //Subscribe to the event before sending the command to ensure you capture the response * api.addEventListener('showcaseStatusChanged', (data:ShowCaseStatus) => { * console.log('Showcase status value after changed:', data); * }); * * api.sendCommandToMetabox(new StopShowcase()); * }; */ declare class StopShowcase extends CommandBase { constructor(); } /** * Image format. * This type represents the allowed image formats. * * ### What does it unlock? * Type alias for MIME types used in file/media handling. Defines supported file formats and media types. * * ### Practical Application * Type alias: 'image/png' | 'image/jpeg' | 'image/webp'. Used as the format parameter in GetScreenshot. * PNG for quality/transparency, JPEG for smaller files, WebP for modern browser optimization. * * ### AI Coding Best Practices * Pass as first param to GetScreenshot: `new GetScreenshot('image/png', {x:2048, y:2048})`. * Use PNG for highest quality and transparency. JPEG for smaller file size. WebP for modern browser optimization. * Match the saveImage filename extension to the format. */ type MimeType = 'image/png' | 'image/jpeg' | 'image/webp'; /** * Represents a command to get a screenshot. * * To listen for changes after sending this command, listen to the 'screenshot' event before command is sent. * * ### What does it unlock? * Takes a screenshot on the server side (Unreal Engine) of the 3D scene. Returns high-quality image. * Requires subscription to the screenshotReady event to receive the rendered image. * * ### Practical Application * Renders a high-res screenshot on the Unreal Engine server. Takes format ('image/png'|'image/jpeg'|'image/webp') * and optional size ({x, y}). Returns base64 data via screenshotReady event. Use for thumbnails, social sharing, * saving config snapshots, or attaching images to quotes. * * ### AI Coding Best Practices * Subscribe to screenshotReady BEFORE sending GetScreenshot. Pattern: * `api.addEventListener('screenshotReady', (data) => { if(data) saveImage(data, 'name.png'); })`. * Specify size for consistent outputs: `new GetScreenshot('image/png', {x:2048, y:2048})`. * Use saveImage() helper to convert base64 to downloadable file. * * @example * import { Communicator, saveImage, GetScreenshot } from '@3dsource/metabox-modular-configurator-api'; * window.env3DSource.apiReady = (api: Communicator) => { * * //Subscribe to the event before sending the command to ensure you capture the response * api.addEventListener('screenshot', (data:string) => { * // The data is a base64 string of the image. You can use it to display the image or save it as a file. * console.log('Get screenshot here:', data); * saveImage(data, 'Render.png'); * }); * * api.sendCommandToMetabox(new GetScreenshot('image/png', { x: 1024, y: 1024 })); * }; * * @param {MimeType} mimeType - The output format. * @param {{ x: number; y: number }} [size] - Optional size in pixels. */ declare class GetScreenshot extends CommandBase { constructor(mimeType: MimeType, size?: { x: number; y: number; }); } /** * Represents a command to set a component by its data (ID, typeId). * This action sends a message to the Metabox API to set a component using the provided data. * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event. * * ### What does it unlock? * Sets a component during initialization, which triggers the reconstruction of the component tree structure. * Simulates clicking a component in the menu. * * ### Practical Application * Selects a component in the modular assembly. Takes componentId (UUID), typeId (category string). * CRITICAL: Always set root component (isRoot:true) FIRST — nothing renders without it. Then add children (isRoot:false). * Simulates clicking a component in the menu. * * ### AI Coding Best Practices * ALWAYS set root first: `new SetComponent('id', 'type', true)`. Then children: `new SetComponent('childId', 'childType', false)`. * Get valid IDs from configuratorDataUpdated event data — the configurator definition contains all available components and types. * Wrong order = blank viewport. The typeId must match componentType values from the configurator. * * @example * import { Communicator, ModularConfiguratorEnvelope, SetComponent } from '@3dsource/metabox-modular-configurator-api'; * window.env3DSource.apiReady = (api: Communicator) => { * * //Subscribe to the event before sending the command to ensure you capture the response * api.addEventListener('configuratorDataUpdated', (data:ModularConfiguratorEnvelope) => { * console.log('State updated after applied new component:', data); * }); * * api.sendCommandToMetabox(new SetComponent( * 'ffea6b5c-3a8a-4f56-9417-e605acb5cca3', 'typeId' * )); * }; * * @param {string} id - The component ID. * @param {string} typeId - The component type ID. */ declare class SetComponent extends CommandBase { constructor(id: string, typeId: string); } /** * Represents a command to set component material by its slot ID and Material ID. * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event. * * ### What does it unlock? * Sets a material variant for a component. Simulates selecting a different material from the menu for a specific component. * * ### Practical Application * Applies a material to a specific slot on a component. Takes componentId (UUID), slotId (string), and materialId (UUID). * Use to build swatch pickers, apply preset themes/bundles, or sync material selections from an external * PIM/ERP system via externalId mapping. * * ### AI Coding Best Practices * Get valid slotId and materialId values from the configuratorDataUpdated envelope — * check component slot definitions and material lists. Pattern: * `new SetComponentMaterial('component-uuid', 'slot-name', 'material-uuid')`. The referenced component must already be set in the tree. * * @example * import { Communicator, ModularConfiguratorEnvelope, SetComponentMaterial } from '@3dsource/metabox-modular-configurator-api'; * window.env3DSource.apiReady = (api: Communicator) => { * * //Subscribe to the event before sending the command to ensure you capture the response * api.addEventListener('configuratorDataUpdated', (data:ModularConfiguratorEnvelope) => { * console.log('State updated after applied new material:', data); * }); * * api.sendCommandToMetabox(new SetComponentMaterial( * 'ffea6b5c-3a8a-4f56-9417-e605acb5cca3', * 'carpaint', * 'dd829d6e-9200-47a7-8d5b-af5df89b7e91', * )); * }; * * @param {string} componentId - The component ID. * @param {string} slotId - The slot ID. * @param {string} materialId - The material ID. */ declare class SetComponentMaterial extends CommandBase { constructor(componentId: string, slotId: string, materialId: string); } /** * Represents a command to set the environment by its ID. * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event. * * ### What does it unlock? * Sets environmental/lighting settings for the scene. Controls factors like lighting conditions and environmental appearance. * * ### Practical Application * Changes the 3D scene/environment (studio, showroom, outdoor, etc.). Takes an environmentId UUID. * Environments include lighting, backdrop, and optionally dynamic sky (udsEnabled) with time-of-day (udsHour) control. * * ### AI Coding Best Practices * Call `api.sendCommandToMetabox(new SetEnvironment('env-uuid'))`. Get valid environment IDs from the configurator * definition in configuratorDataUpdated. Set environment after root component during initialization. Each environment has * its own material slots, thumbnails, and lighting properties. * * @example * import { Communicator, ModularConfiguratorEnvelope } from '@3dsource/metabox-modular-configurator-api'; * window.env3DSource.apiReady = (api: Communicator) => { * * //Subscribe to the event before sending the command to ensure you capture the response * api.addEventListener('configuratorDataUpdated', (data:ModularConfiguratorEnvelope) => { * console.log('State updated after applied new environment:', data); * }); * * api.sendCommandToMetabox(new SetEnvironment('55555555-1234-1234-1234-01234567890')) * }; * * @param {string} environmentId - The environment ID. */ declare class SetEnvironment extends CommandBase { constructor(environmentId: string); } /** * Represents a command to set an environment material by its slot ID and Material ID. * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event. * * ### What does it unlock? * Sets environmental material properties such as textures and appearance attributes for the scene environment. * * ### Practical Application * Applies materials to environment slots (floor, walls, backdrop textures). Takes slotId and materialId. * Use for scene-based configurators where the environment is also customizable — kitchen visualizers, * room planners, trade show booth designers. * * ### AI Coding Best Practices * Pattern: `new SetEnvironmentMaterial('floor-slot-id', 'material-uuid')`. Get valid slot and material IDs from * the environment definition's slots array in configuratorDataUpdated. Only useful when the active environment * has configurable material slots. * * @example * import { Communicator, ModularConfiguratorEnvelope } from '@3dsource/metabox-modular-configurator-api'; * window.env3DSource.apiReady = (api: Communicator) => { * * //Subscribe to the event before sending the command to ensure you capture the response * api.addEventListener('configuratorDataUpdated', (data:ModularConfiguratorEnvelope) => { * console.log('State updated after applied new environment material:', data); * }); * * api.sendCommandToMetabox(new SetEnvironmentMaterial( * 'carpaint', * 'dd829d6e-9200-47a7-8d5b-af5df89b7e91', * )); * }; * * @param {string} slotId - The slot ID. * @param {string} materialId - The material ID. */ declare class SetEnvironmentMaterial extends CommandBase { constructor(slotId: string, materialId: string); } /** * Represents a command to toggle the embedded Metabox menu. * This command can only be used when using the metabox menu. * * ### What does it unlock? * Shows the embedded menu interface. Only works when using the MetaBox native menu (not in standalone/custom menu * mode). * * ### Practical Application * Toggles the native MetaBox right sidebar menu. Takes a boolean parameter. Pass false to hide when building custom UI. * In standalone mode, the menu is already hidden — this is only relevant in default (non-standalone) mode. * * ### AI Coding Best Practices * In standalone mode (`{standalone:true}`), this is unnecessary (menu already hidden). In default mode, * call `new ShowEmbeddedMenu(false)` early in initialization to hide built-in UI before rendering custom controls. * Pattern for custom UI: `ShowEmbeddedMenu(false)` + `ShowOverlayInterface(false)`. * * @example * import { ShowEmbeddedMenu, Communicator } from '@3dsource/metabox-modular-configurator-api'; * window.env3DSource.apiReady = (api: Communicator) => { * api.sendCommandToMetabox(new ShowEmbeddedMenu(true)); * }; * * @param {boolean} visible - A flag indicating whether the embedded menu should be visible. */ declare class ShowEmbeddedMenu extends CommandBase { constructor(visible: boolean); } /** * Represents a command to toggle the Unreal Overlay Interface Menu. * This action sends a message to the Metabox API to toggle the visibility of the Unreal overlay UI. * * ### What does it unlock? * Shows the overlay interface elements. Displays UI controls and buttons overlaid on the 3D scene. * * ### Practical Application * Toggles viewport overlay controls (buttons overlaid on the 3D scene). Takes a boolean. * Use `ShowOverlayInterface(false)` alongside `ShowEmbeddedMenu(false)` when building fully custom UI * that replaces all native MetaBox controls. * * ### AI Coding Best Practices * In standalone mode, overlays are already hidden. In default mode, call `new ShowOverlayInterface(false)` * early in initialization to prevent flash of native UI. Always pair with `ShowEmbeddedMenu(false)` for clean custom UI. * Pass true to restore if entering a mode that uses native controls. * * @example * import { ShowOverlayInterface, Communicator } from '@3dsource/metabox-modular-configurator-api'; * window.env3DSource.apiReady = (api: Communicator) => { * api.sendCommandToMetabox(new ShowOverlayInterface(true)); * }; * * @param {boolean} visible - A flag indicating whether the Unreal overlay UI should be visible. */ declare class ShowOverlayInterface extends CommandBase { constructor(visible: boolean); } /** * Represents a command to show measurement for a product when it is already loaded. * This class sends a command to the Metabox API to show measurement for a product if it is already initialized. * * ### What does it unlock? * Shows the measurement overlay. Works as a toggle with HideMeasurement to control visibility. * * ### Practical Application * Shows the measurement/dimension overlay tools on the 3D viewport. Use for B2B or technical applications * where buyers need to verify product dimensions, check fit specifications, or confirm measurements during procurement. * * ### AI Coding Best Practices * Call `api.sendCommandToMetabox(new ShowMeasurement())`. No parameters. Pair with HideMeasurement for toggle behavior. * Track visibility state in your app to keep toggle buttons in sync. * * @example * import { ShowMeasurement, Communicator } from '@3dsource/metabox-modular-configurator-api'; * window.env3DSource.apiReady = (api: Communicator) => { * api.sendCommandToMetabox(new ShowMeasurement()); * }; */ declare class ShowMeasurement extends CommandBase { constructor(); } /** * Represents a command to hide measurement for a product when it is already loaded. * This class sends a command to the Metabox API to hide measurement for a product if it is already initialized. * * ### What does it unlock? * Hides the measurement overlay. Executes unconditionally to hide the UI controls. * * ### Practical Application * Hides the measurement/dimension overlay. Use when transitioning from a technical spec view back to a clean * product presentation, or to keep consumer-facing configurators visually clean. * * ### AI Coding Best Practices * Call `api.sendCommandToMetabox(new HideMeasurement())`. No parameters. Pair with ShowMeasurement as a toggle. * Track visibility state in your app state to keep toggle buttons in sync. * * @example * import { HideMeasurement, Communicator } from '@3dsource/metabox-modular-configurator-api'; * window.env3DSource.apiReady = (api: Communicator) => { * api.sendCommandToMetabox(new HideMeasurement()); * }; */ declare class HideMeasurement extends CommandBase { constructor(); } /** * Represents a command to resume the pixel streaming session. * This class sends a message to the Metabox API to resume a paused or disconnected stream. * * ### What does it unlock? * Resumes the Unreal Engine pixel streaming connection after it has been paused, disconnected, or stopped due to inactivity (AFK timeout). * * ### Practical Application * Used to reconnect the 3D streaming session without a full page reload. Essential for 'Reconnect' or 'Resume' buttons * shown when the stream is interrupted, e.g., after an idle timeout or network disruption. * * ### AI Coding Best Practices * Call `api.sendCommandToMetabox(new ResumeStream())`. No parameters. Resumes the existing streaming session — * does not reinitialize the configurator or reset component/environment state. * * @example * import { ResumeStream, Communicator } from '@3dsource/metabox-modular-configurator-api'; * window.env3DSource.apiReady = (api: Communicator) => { * api.sendCommandToMetabox(new ResumeStream()); * }; */ declare class ResumeStream extends CommandBase { constructor(); } /** * Represents a command to reset the user inactivity (AFK) timer. * This class sends a message to the Metabox API to restart the inactivity countdown, * keeping the session alive when activity is detected programmatically. * * ### What does it unlock? * Resets the AFK inactivity timer, preventing an imminent disconnect when the countdown is active. * * ### Practical Application * Used to programmatically signal user activity and reset the inactivity countdown. * Pair with the `userInactivityDetected` event to show a custom "Stay connected?" prompt * and call this command when the user confirms, dismissing the countdown. * * ### AI Coding Best Practices * Call `api.sendCommandToMetabox(new ResetUserInactivityTimer())`. No parameters. * Typically triggered from a "Stay connected" or "I'm still here" button rendered when * `userInactivityDetected.countdownVisible` is `true`. * * @example * import { ResetUserInactivityTimer, Communicator } from '@3dsource/metabox-modular-configurator-api'; * window.env3DSource.apiReady = (api: Communicator) => { * api.addEventListener('userInactivityDetected', ({ countdownVisible }) => { * if (countdownVisible) { * // show custom UI, then on user confirmation: * api.sendCommandToMetabox(new ResetUserInactivityTimer()); * } * }); * }; */ declare class ResetUserInactivityTimer extends CommandBase { constructor(); } export { AppLoaded, AppLoaded_V3, ApplyZoom, BasicRouteUrl, CommandBase, Communicator, EventDispatcher, GetCallToActionInformation, GetCamera, GetPdf, GetScreenshot, HideMeasurement, InitShowcase, Metabox, MetaboxConfig, MetaboxDomain, MetaboxHost, MetaboxHost_V3, MetaboxModularConfiguratorActions, Metabox_V3, PauseShowcase, PlayShowcase, ResetCamera, ResetConfiguration, ResetUserInactivityTimer, ResumeStream, SetCamera, SetComponent, SetComponentMaterial, SetEnvironment, SetEnvironmentMaterial, ShowEmbeddedMenu, ShowMeasurement, ShowOverlayInterface, StopShowcase, UnrealCommand, VERSION, fromCommunicatorEvent, integrateMetabox, prepareIframeSrc, saveImage }; export type { CameraCommandPayload, ComponentWithParent, Cta, EcomConfigurator, Environment, FromMetaBoxAPIEnvelope, FromMetaBoxApiEvents, FromMetaBoxMessage, FromMetaboxMessagePayloads, FromMetaboxTarget, InitialModularConfigurator, IntegrateMetaboxConfig, Listener, MCAppLoaded, Material, MetaBoxApiEnvelope, MetaProperty, MetaboxCommandConfig, MetaboxEnvironment, MimeType, Model, ModularConfiguratorComponent, ModularConfiguratorComponentType, ModularConfiguratorConnector, ModularConfiguratorEnvelope, ModularConfiguratorEnvironment, ModularConfiguratorVirtualSocketToConnector, Product, SelectedIds, ShowCaseStatus, Showcase, Slot, Thumbnail, Timecode, ToMetaBoxActions, ToMetaBoxMessage, ToMetaBoxMessageEnvelope, ToMetaboxMessagePayload, ToMetaboxMessagePayloads, ToMetaboxTarget, VideoResolution, VideoStats, VirtualSocket };