@3dsource/metabox-modular-configurator-api 3.0.19-dev.11 → 3.0.19-dev.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1016,22 +1016,6 @@ const Metabox = 'metabox';
|
|
|
1016
1016
|
* @internal
|
|
1017
1017
|
*/
|
|
1018
1018
|
const MetaboxHost = 'metaboxHost';
|
|
1019
|
-
/**
|
|
1020
|
-
* Identifier used as the `host` field in postMessage envelopes received from the iframe.
|
|
1021
|
-
*
|
|
1022
|
-
* ### What does it unlock?
|
|
1023
|
-
* Constant identifier used internally to reference and compare MetaBox data. Used for data validation and internal routing.
|
|
1024
|
-
*
|
|
1025
|
-
* ### Practical Application
|
|
1026
|
-
* Internal data reference constant used for validation and message routing within the communication layer.
|
|
1027
|
-
* Not needed in front-end application code.
|
|
1028
|
-
*
|
|
1029
|
-
* ### AI Coding Best Practices
|
|
1030
|
-
* Skip in application code. Only relevant if debugging very low-level message traffic between your app and the MetaBox iframe.
|
|
1031
|
-
*
|
|
1032
|
-
* @internal
|
|
1033
|
-
*/
|
|
1034
|
-
const MetaboxData = 'metaboxData';
|
|
1035
1019
|
/**
|
|
1036
1020
|
* Action string dispatched by the iframe when the configurator app has loaded.
|
|
1037
1021
|
*
|
|
@@ -1047,7 +1031,7 @@ const MetaboxData = 'metaboxData';
|
|
|
1047
1031
|
*
|
|
1048
1032
|
* @internal
|
|
1049
1033
|
*/
|
|
1050
|
-
const AppLoaded = '
|
|
1034
|
+
const AppLoaded = 'appLoaded';
|
|
1051
1035
|
/**
|
|
1052
1036
|
* Default MetaBox domain for production environments.
|
|
1053
1037
|
*
|
|
@@ -1095,7 +1079,7 @@ const MetaboxDomain = 'metabox.3dsource.com';
|
|
|
1095
1079
|
*/
|
|
1096
1080
|
const BasicRouteUrl = 'metabox-configurator/modular';
|
|
1097
1081
|
|
|
1098
|
-
const VERSION = '3.0.19-dev.
|
|
1082
|
+
const VERSION = '3.0.19-dev.12';
|
|
1099
1083
|
|
|
1100
1084
|
const communicatorMap = new Map();
|
|
1101
1085
|
/**
|
|
@@ -1424,5 +1408,5 @@ function saveImage(imageUrl, filename) {
|
|
|
1424
1408
|
* Generated bundle index. Do not edit.
|
|
1425
1409
|
*/
|
|
1426
1410
|
|
|
1427
|
-
export { AppLoaded, AppLoaded_V3, ApplyZoom, BasicRouteUrl, CommandBase, Communicator, EventDispatcher, ForceSetDeviceType, GetCallToActionInformation, GetCamera, GetPdf, GetScreenshot, HideMeasurement, InitShowcase, Metabox, MetaboxConfig,
|
|
1411
|
+
export { AppLoaded, AppLoaded_V3, ApplyZoom, BasicRouteUrl, CommandBase, Communicator, EventDispatcher, ForceSetDeviceType, GetCallToActionInformation, GetCamera, GetPdf, GetScreenshot, HideMeasurement, InitShowcase, Metabox, MetaboxConfig, MetaboxDomain, MetaboxHost, MetaboxHost_V3, MetaboxModularConfiguratorActions, Metabox_V3, PauseShowcase, PlayShowcase, ResetCamera, ResumeStream, SetCamera, SetComponent, SetComponentMaterial, SetEnvironment, SetEnvironmentMaterial, ShowEmbeddedMenu, ShowMeasurement, ShowOverlayInterface, StopShowcase, UnrealCommand, VERSION, fromCommunicatorEvent, integrateMetabox, prepareIframeSrc, saveImage };
|
|
1428
1412
|
//# sourceMappingURL=3dsource-metabox-modular-configurator-api.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"3dsource-metabox-modular-configurator-api.mjs","sources":["../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/CommandBase.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/fromCommunicatorEvent.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/interfaces/ToMetaboxMessagePayloads.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/MetaboxConfig.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/GetPdf.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/GetCallToActionInformation.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/GetCamera.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/SetCamera.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/ResetCamera.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/ApplyZoom.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/InitShowcase.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/PlayShowcase.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/UnrealCommand.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/PauseShowcase.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/StopShowcase.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/GetScreenshot.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/SetComponent.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/SetComponentMaterial.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/SetEnvironment.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/SetEnvironmentMaterial.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/ShowEmbeddedMenu.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/ShowOverlayInterface.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/ShowMeasurement.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/HideMeasurement.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/ForceSetDeviceType.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/ResumeStream.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/helpers/event-dispatcher.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/constants/common.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/constants/version.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/helpers/communicator.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/helpers/prepare-iframe-src.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/helpers/integrate-metabox.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/helpers/save-image.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/3dsource-metabox-modular-configurator-api.ts"],"sourcesContent":["import type { ToMetaBoxMessageEnvelope } from '../interfaces';\n\n/**\n * Base class for commands sent to the Metabox API.\n *\n * ### What does it unlock?\n * Base class that all other commands inherit from in a class hierarchy. Provides common properties\n * and methods that are automatically available to all command subclasses.\n *\n * ### Practical Application\n * Base class all commands inherit from. Never instantiate directly — use specific subclasses like\n * SetProduct, SetCamera, etc. All commands are sent via `api.sendCommandToMetabox(new CommandName(...))`.\n *\n * ### AI Coding Best Practices\n * Never construct a generic CommandBase. Always use the specific typed command class. When generating\n * dynamic command dispatch, use a switch/map pattern matching command names to their constructors.\n *\n * @internal\n * @hidden\n */\n\nexport class CommandBase {\n /** The message envelope populated by subclass constructors and sent via {@link Communicator.sendCommandToMetabox}. */\n data!: ToMetaBoxMessageEnvelope;\n}\n","import type { Communicator } from '../helpers';\nimport type {\n FromMetaBoxApiEvents,\n FromMetaboxMessagePayloads,\n} from '../interfaces';\nimport type { Observable } from 'rxjs';\nimport { fromEvent } from 'rxjs';\n\n/**\n * Wrapper helper function to use with RxJS the same way as `fromEvent`, to listen to events from the Communicator.\n *\n * ### What does it unlock?\n * Function that creates an event listener subscription. Allows developers to subscribe to specific events from the Communicator.\n *\n * ### Practical Application\n * Function that creates event listener subscriptions. Alternative to api.addEventListener() — both subscribe\n * to configurator events. Use to react to state changes, screenshot readiness, viewport loading, showcase status, etc.\n *\n * ### AI Coding Best Practices\n * Prefer api.addEventListener() directly from the Communicator object. If using fromCommunicatorEvent, pass the\n * event name and handler. Key events: configuratorDataUpdated, viewportReady, screenshotReady, showcaseStatusChanged,\n * getCameraResult. Always subscribe BEFORE sending commands that trigger responses.\n *\n * @param {Communicator} target - The Communicator instance to listen on.\n * @param {T} eventName - The event name from {@link FromMetaBoxApiEvents} to subscribe to.\n * @returns An Observable that emits the typed payload each time the event fires.\n * @internal\n */\nexport function fromCommunicatorEvent<T extends FromMetaBoxApiEvents>(\n target: Communicator,\n eventName: T,\n) {\n return fromEvent(target, eventName) as Observable<\n FromMetaboxMessagePayloads[T]\n >;\n}\n","import type { MimeType } from '../actions';\nimport type { ApplicationDeviceTypes } from './application-device-types';\nimport type { MetaboxHost } from '../constants';\nimport type { MetaboxCommandConfig } from './metabox-config';\n\n/**\n * Registry of all action identifiers that can be sent from the host application to the Metabox Modular Configurator.\n * Each key maps to a string used as the `action` field in the postMessage envelope.\n *\n * ### What does it unlock?\n * Variable containing all available action names. Interface listing all actions that the modular configurator supports.\n *\n * ### Practical Application\n * Master action registry object — all supported configurator action names. Invaluable reference for building\n * admin dashboards, permission systems, or feature-availability displays.\n *\n * ### AI Coding Best Practices\n * Iterate this object to dynamically build action dropdowns, command palettes, or feature checklists in admin tools.\n * Each key is an action name, value is its description. Excellent reference for AI coding agents to understand\n * the full command vocabulary available.\n */\nexport const MetaboxModularConfiguratorActions = {\n metaboxConfig: 'metaboxConfig',\n resumeStream: 'resumeStream',\n setEnvironment: 'setEnvironment',\n setEnvironmentMaterialById: 'setEnvironmentMaterialById',\n setComponent: 'setComponent',\n setComponentMaterialById: 'setComponentMaterialById',\n getPdf: 'getPdf',\n getCallToActionInformation: 'getCallToActionInformation',\n getScreenshot: 'getScreenshot',\n showEmbeddedMenu: 'showEmbeddedMenu',\n forceSetDeviceType: 'forceSetDeviceType',\n showOverlayInterface: 'showOverlayInterface',\n getCamera: 'getCamera',\n setCamera: 'setCamera',\n resetCamera: 'resetCamera',\n applyZoom: 'applyZoom',\n initShowcase: 'initShowcase',\n playShowcase: 'playShowcase',\n pauseShowcase: 'pauseShowcase',\n stopShowcase: 'stopShowcase',\n sendCommandToUnreal: 'sendCommandToUnreal',\n showMeasurement: 'showMeasurement',\n hideMeasurement: 'hideMeasurement',\n} as const;\n\n/**\n * Union of all action string literals from {@link MetaboxModularConfiguratorActions}.\n *\n * ### What does it unlock?\n * Type alias for all actions that can be sent to MetaBox. Defines the complete set of command types available.\n *\n * ### Practical Application\n * Type alias enumerating all available outgoing command types. Master list of everything your app can tell MetaBox to do.\n * Use as a checklist when planning which features to implement.\n *\n * ### AI Coding Best Practices\n * Reference for building command dispatchers or admin tools. Full command set includes all values of\n * MetaboxModularConfiguratorActions like: \"metaboxConfig\" | \"setEnvironment\" | \"setEnvironmentMaterialById\" | ...\n */\nexport type ToMetaBoxActions =\n (typeof MetaboxModularConfiguratorActions)[keyof typeof MetaboxModularConfiguratorActions];\n\n/**\n * @internal\n * @hidden\n */\nexport type ToMetaboxMessagePayload =\n ToMetaboxMessagePayloads[keyof ToMetaboxMessagePayloads];\n\n/**\n * Interface for messages sent from the application to the Metabox Modular Configurator.\n *\n * ### What does it unlock?\n * Defines payload structures for different types of outgoing messages to MetaBox. Contains data models for various command parameters.\n *\n * ### Practical Application\n * Payload type definitions for all outgoing command types. Defines required and optional fields per command.\n * Essential TypeScript reference for type-safe command construction.\n *\n * ### AI Coding Best Practices\n * Use as TypeScript type reference for proper typing when building dynamic command dispatchers.\n * Each key corresponds to a command name and its value defines the expected payload structure.\n */\nexport interface ToMetaboxMessagePayloads {\n [MetaboxModularConfiguratorActions.metaboxConfig]: {\n appId: string;\n config: MetaboxCommandConfig;\n };\n [MetaboxModularConfiguratorActions.setEnvironment]: { id: string };\n [MetaboxModularConfiguratorActions.setEnvironmentMaterialById]: {\n slotId: string;\n materialId: string;\n };\n [MetaboxModularConfiguratorActions.setComponent]: {\n id: string;\n typeId: string;\n };\n [MetaboxModularConfiguratorActions.setComponentMaterialById]: {\n componentId: string;\n slotId: string;\n materialId: string;\n };\n [MetaboxModularConfiguratorActions.getScreenshot]: {\n format: MimeType;\n size?: { x: number; y: number };\n };\n [MetaboxModularConfiguratorActions.getCallToActionInformation]: void;\n [MetaboxModularConfiguratorActions.getPdf]: void;\n [MetaboxModularConfiguratorActions.showEmbeddedMenu]: { visible: boolean };\n [MetaboxModularConfiguratorActions.showOverlayInterface]: {\n visible: boolean;\n };\n [MetaboxModularConfiguratorActions.forceSetDeviceType]: {\n deviceType: ApplicationDeviceTypes;\n };\n [MetaboxModularConfiguratorActions.getCamera]: void;\n [MetaboxModularConfiguratorActions.setCamera]: {\n camera: CameraCommandPayload;\n };\n [MetaboxModularConfiguratorActions.resetCamera]: void;\n [MetaboxModularConfiguratorActions.applyZoom]: { zoom: number };\n [MetaboxModularConfiguratorActions.initShowcase]: void;\n [MetaboxModularConfiguratorActions.playShowcase]: void;\n [MetaboxModularConfiguratorActions.pauseShowcase]: void;\n [MetaboxModularConfiguratorActions.stopShowcase]: void;\n [MetaboxModularConfiguratorActions.sendCommandToUnreal]: object;\n [MetaboxModularConfiguratorActions.showMeasurement]: void;\n [MetaboxModularConfiguratorActions.hideMeasurement]: void;\n}\n\n/**\n * Payload for the {@link SetCamera} command describing the desired camera state in the Unreal scene.\n * All fields are optional — only the provided values will be applied.\n *\n * ### What does it unlock?\n * Defines the payload structure for camera commands. Contains camera-related parameters passed to SetCamera command.\n *\n * ### Practical Application\n * Read-only interface defining camera parameters: fov (degrees), mode ('orbit'|'fps'), position ({x,y,z}),\n * rotation ({horizontal: yaw, vertical: pitch}), and restrictions (distance/FOV/rotation limits).\n * Both returned by getCameraResult event and accepted by SetCamera.\n *\n * ### AI Coding Best Practices\n * This interface is bidirectional — returned from GetCamera and accepted by SetCamera.\n * Capture a camera state via getCameraResult and replay it with SetCamera(payload).\n * Only include restriction fields you want to enforce; omitted values keep current settings.\n * In orbit mode, distance limits are relative to the orbit pivot.\n */\nexport interface CameraCommandPayload {\n /** Field of view angle in degrees. */\n fov?: number;\n /** Camera control mode: `'fps'` for first-person or `'orbit'` for orbital rotation around pivot. */\n mode?: 'fps' | 'orbit';\n /** Camera position in 3D world space. */\n position?: { x: number; y: number; z: number };\n /** Camera rotation angles in degrees. */\n rotation?: {\n horizontal: number;\n vertical: number;\n };\n /** Min/max constraints applied to camera movement, zoom, and rotation. */\n restrictions?: {\n maxDistanceToPivot?: number;\n maxFov?: number;\n maxHorizontalRotation?: number;\n maxVerticalRotation?: number;\n minDistanceToPivot?: number;\n minFov?: number;\n minHorizontalRotation?: number;\n minVerticalRotation?: number;\n };\n}\n\n/**\n * @internal\n * @hidden\n * Envelope wrapping an action and its payload for host-to-Metabox postMessage communication.\n *\n * ### What does it unlock?\n * Envelope structure for outgoing MetaBox messages. Encapsulates messages with protocol headers for transmission.\n *\n * ### Practical Application\n * Protocol envelope for outgoing messages — adds headers for transmission to MetaBox iframe.\n * Internal to the communication layer, handled automatically by the Communicator.\n *\n * ### AI Coding Best Practices\n * Do not construct manually. The Communicator handles all message wrapping. Only reference this interface\n * if debugging raw postMessage traffic in browser devtools to diagnose why commands aren't being received.\n */\nexport interface ToMetaBoxMessageEnvelope {\n action: ToMetaBoxActions;\n payload?: ToMetaboxMessagePayload | never;\n}\n\n/**\n * @internal\n * @hidden\n */\nexport type ToMetaboxTarget = 'metabox' | 'child';\n\n/**\n * @internal\n * @hidden\n * Top-level postMessage structure sent from the host to the Metabox iframe.\n *\n * ### What does it unlock?\n * Message interface for sending data to MetaBox. Wraps outgoing commands with necessary protocol information.\n *\n * ### Practical Application\n * Outgoing message format for commands to MetaBox. Wraps commands with protocol information for postMessage delivery.\n * Handled automatically by Communicator.sendCommandToMetabox() — never construct manually.\n *\n * ### AI Coding Best Practices\n * Do not construct ToMetaBoxMessage objects. Always use `api.sendCommandToMetabox(new CommandName(...))`.\n * The Communicator wraps your command in the correct message format automatically.\n */\nexport interface ToMetaBoxMessage {\n host: typeof MetaboxHost;\n envelope: ToMetaBoxMessageEnvelope;\n /**\n * @deprecated, use envelope instead of payload\n */\n payload: ToMetaBoxMessageEnvelope;\n target: ToMetaboxTarget;\n apiVersion: string;\n}\n","import { CommandBase } from './CommandBase';\nimport type { MetaboxCommandConfig } from '../interfaces';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to send Metabox Config to Metabox Modular Configurator.\n *\n * ### What does it unlock?\n * Configuration object passed to MetaBox during initialization. Specifies domain, host, standalone mode,\n * and other parameters that control how the configurator behaves.\n *\n * ### Practical Application\n * Internal configuration object auto-sent during initialization. Contains appId and config.\n * DO NOT call directly — integrateMetabox() handles this automatically as part of its setup sequence.\n *\n * ### AI Coding Best Practices\n * NEVER instantiate or send MetaboxConfig manually. It is auto-sent by integrateMetabox().\n * Use the IntegrateMetaboxConfig parameter of integrateMetabox() instead for setting domain, standalone,\n * loadingImage, introImage, state, etc.\n *\n * @internal\n * Automatically sent when the Communicator instance is ready.\n *\n * @param {string} appId - The unique identifier for the Communicator Instance\n * @param {MetaboxCommandConfig} config - optional initial config: standalone - if true - disable metabox custom template and all logic\n */\n\nexport class MetaboxConfig extends CommandBase {\n constructor(appId: string, config: MetaboxCommandConfig) {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.metaboxConfig,\n payload: { appId, config },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to get a PDF from Metabox Modular Configurator.\n * This class sends a message to the Metabox API to generate a PDF based on the current configuration.\n * **Important**: No need to listen to any events to see changes. Pdf will be downloaded automatically once it's ready.\n *\n * ### What does it unlock?\n * Generates a native MetaBox PDF document. No subscription required — it executes independently.\n *\n * ### Practical Application\n * Generates a branded PDF from the current configurator state server-side. No event subscription needed.\n * Use for B2B quote workflows, downloadable spec sheets, or emailing configured product summaries to prospects.\n *\n * ### AI Coding Best Practices\n * Simply call `api.sendCommandToMetabox(new GetPdf())`. No parameters or event subscription required.\n * The PDF generates inside MetaBox application.\n *\n * @example\n * import { GetPdf, Communicator } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * api.sendCommandToMetabox(new GetPdf());\n * };\n */\nexport class GetPdf extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxModularConfiguratorActions.getPdf };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to get a Call To Action Information from Metabox Modular Configurator.\n * This class sends a message to the Metabox API to generate Call To Action information based on the current\n * configuration and sends it to the endpoint URL from the CTA information.\n *\n * To listen for changes after sending this command, listen to the 'ecomConfiguratorDataUpdated' event.\n *\n * ### What does it unlock?\n * Retrieves information about call-to-action that were added to the configurator. Requires subscription to receive data.\n *\n * ### Practical Application\n * Triggers the CTA (Call-to-Action) workflow configured in MetaBox admin. The CTA label and callback URL are set in admin.\n * When invoked, MetaBox POSTs the full configuration JSON (including BOM) to your callback URL endpoint, which returns a { redirectUrl }.\n *\n * ### AI Coding Best Practices\n * Call only after user completes configuration. Subscribe to ecomConfiguratorDataUpdated to get CTA label/URL for building\n * custom CTA buttons in your UI. The POST payload includes the full bill of materials — your backend endpoint processes it\n * and returns a redirect URL.\n *\n * @example\n * import { Communicator, EcomConfigurator, GetCallToActionInformation } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n *\n * //Subscribe to the event before sending the command to ensure you capture the response\n * api.addEventListener('ecomConfiguratorDataUpdated', (data:EcomConfigurator) => {\n * console.log('Ecom configurator params:', data);\n * });\n *\n * // Send the command to get Call To Action information from Metabox Modular Configurator\n * api.sendCommandToMetabox(new GetCallToActionInformation());\n * };\n */\nexport class GetCallToActionInformation extends CommandBase {\n constructor() {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.getCallToActionInformation,\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to get the camera configuration from Unreal.\n * This class sends a message to the Metabox API to get the camera from a scene.\n * To listen for changes after sending this command, listen to the 'getCameraResult' event.\n *\n * ### What does it unlock?\n * Retrieves camera presets for the configurator; allowing extraction and application of saved camera positions.\n *\n * ### Practical Application\n * Requests current camera state — returns asynchronously via the getCameraResult event. Returns a CameraCommandPayload\n * with fov, mode, position, rotation, and restrictions. Use to save camera positions, create shareable view links,\n * or build 'save this angle' features.\n *\n * ### AI Coding Best Practices\n * ALWAYS subscribe to getCameraResult BEFORE calling GetCamera(). Pattern: `api.addEventListener('getCameraResult', handler);`\n * then `api.sendCommandToMetabox(new GetCamera())`. The returned CameraCommandPayload can be fed directly back into\n * SetCamera to restore the view.\n *\n * @example\n * import { Communicator, CameraCommandPayload, GetCamera } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n *\n * //Subscribe to the event before sending the command to ensure you capture the response\n * api.addEventListener('getCameraResult', (data:CameraCommandPayload) => {\n * console.log('Camera params after get camera command:', data);\n * });\n *\n * api.sendCommandToMetabox(new GetCamera());\n * };\n */\nexport class GetCamera extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxModularConfiguratorActions.getCamera };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport type { CameraCommandPayload } from '../interfaces';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to set the camera configuration.\n * This class sends a message to the Metabox API to set the camera on a scene.\n * **Important**: No need to listen to any events to see changes.\n *\n * ### What does it unlock?\n * Sets camera presets with restriction parameters (FOV, rotation, position).\n *\n * ### Practical Application\n * Sets camera with precise control: fov (degrees), mode ('orbit'|'fps'), position ({x,y,z}),\n * rotation ({horizontal,vertical}), and restrictions (min/max distance, FOV, rotation bounds).\n * Use for guided tours, preset view buttons, or restricting camera to prevent users seeing behind the product.\n *\n * ### AI Coding Best Practices\n * Only include fields you want to change — omitted values keep current settings. Use orbit mode for typical product viewing,\n * fps for walkthrough/room scenes. Apply restrictions to prevent bad angles. Full interface:\n * `{fov?, mode?, position?, rotation?, restrictions?}`.\n *\n * @example\n * import { SetCamera, Communicator } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * api.sendCommandToMetabox(new SetCamera({\n * fov: 45,\n * mode: 'orbit',\n * position: { x: 100, y: 100, z: 100 },\n * rotation: { horizontal: 0, vertical: 0 },\n * restrictions: {\n * maxDistanceToPivot: 0,\n * maxFov: 0,\n * maxHorizontalRotation: 0,\n * maxVerticalRotation: 0,\n * minDistanceToPivot: 0,\n * minFov: 0,\n * minHorizontalRotation: 0,\n * minVerticalRotation: 0,\n * },\n * }));\n * };\n *\n * @param {CameraCommandPayload} camera - The camera configuration.\n */\nexport class SetCamera extends CommandBase {\n constructor(camera: CameraCommandPayload) {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.setCamera,\n payload: { camera },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to reset the camera to its initial position.\n * This class sends a message to the Metabox API to reset the camera on a scene.\n *\n * ### What does it unlock?\n * Resets the camera to its default state and position. Used to return camera to initial configuration after user manipulation.\n *\n * ### Practical Application\n * Resets camera to the default position defined in the component/environment template. Essential for 'Reset View' buttons.\n * Also, useful after programmatic camera moves to return to a known starting state.\n *\n * ### AI Coding Best Practices\n * Call `api.sendCommandToMetabox(new ResetCamera())`. No parameters. Restores template defaults — not the last user position.\n * Good practice to call after SetComponent changes that may shift the focal point of the assembly.\n *\n * @example\n * import { ResetCamera, Communicator } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * api.sendCommandToMetabox(new ResetCamera());\n * };\n */\n\nexport class ResetCamera extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxModularConfiguratorActions.resetCamera };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to apply zoom and change the camera zoom on a scene.\n * This class sends a command to the Metabox API to change zoom on a scene.\n *\n * ### What does it unlock?\n * Controls zoom functionality for the configurator; allowing users to adjust the zoom level of 3D objects and camera presets.\n *\n * ### Practical Application\n * Implements programmatic zoom on the pixel-streamed viewport. Use to build zoom slider controls, pinch-to-zoom on mobile,\n * or 'zoom to detail' buttons. Takes a numeric delta: positive zooms in, negative zooms out\n * (e.g., ApplyZoom(50) zooms in, ApplyZoom(-50) zooms out).\n *\n * ### AI Coding Best Practices\n * Always use numeric delta values, not absolute zoom levels. Pair with a UI slider that sends incremental values.\n * Debounce zoom input to ~100ms intervals to prevent overwhelming the Unreal stream.\n * Pattern: `api.sendCommandToMetabox(new ApplyZoom(50))`.\n *\n * @example\n * import { ApplyZoom, Communicator } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * api.sendCommandToMetabox(new ApplyZoom(50));\n * };\n *\n * @param {number} zoom - The zoom value to apply.\n */\n\nexport class ApplyZoom extends CommandBase {\n constructor(zoom: number) {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.applyZoom,\n payload: { zoom },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to initialize Showcase for a component scene and start a sequence for the component.\n * This class sends a command to the Metabox API to initialize showcase if the component has a sequence.\n * To check this, find the showcase property in the current component and listen to the 'configuratorDataUpdated' event.\n * If this property exists, you can send the init showcase command.\n *\n * To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event.\n *\n * ### What does it unlock?\n * Initializes and displays the showcase/demo view for the configurator. Used when transitioning into presentation or demo mode.\n *\n * ### Practical Application\n * Loads the showcase/animation sequence attached to the current component. Must be called BEFORE PlayShowcase.\n * Use to initialize auto-playing product demos, trade show presentations, or hero section animations on landing pages.\n *\n * ### AI Coding Best Practices\n * ALWAYS call InitShowcase() before PlayShowcase(). Required sequence: InitShowcase → PlayShowcase → PauseShowcase/StopShowcase.\n * Subscribe to showcaseStatusChanged to track playback state ('playing'/'paused'/'stopped').\n *\n * @example\n * import { Communicator, ShowCaseStatus, InitShowcase } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * //Subscribe to the event before sending the command to ensure you capture the response\n * api.addEventListener('showcaseStatusChanged', (data:ShowCaseStatus) => {\n * console.log('Showcase status value after changed:', data);\n * });\n *\n * api.sendCommandToMetabox(new InitShowcase());\n * };\n */\n\nexport class InitShowcase extends CommandBase {\n constructor() {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.initShowcase,\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to play Showcase for a component when it is already initialized and paused.\n * This class sends a command to the Metabox API to play showcase for a component if it is already initialized and paused.\n *\n * To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event.\n *\n * ### What does it unlock?\n * Starts or resumes the showcase/timeline playback. Executes the internal MetaBox play command internally.\n *\n * ### Practical Application\n * Starts or resumes showcase playback. Use for 'Play Demo' buttons on landing pages, auto-play on page load,\n * or resuming demos after inactivity timeout on kiosk displays.\n *\n * ### AI Coding Best Practices\n * Call `api.sendCommandToMetabox(new PlayShowcase())`. Must call InitShowcase() first or it won't play.\n * Subscribe to showcaseStatusChanged to track state. Auto-play pattern: wait for viewportReady → InitShowcase →\n * PlayShowcase.\n *\n * @example\n * import { Communicator, PlayShowcase } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * //Subscribe to the event before sending the command to ensure you capture the response\n * api.addEventListener('showcaseStatusChanged', (data) => {\n * console.log('Showcase status value after changed:', data);\n * });\n *\n * api.sendCommandToMetabox(new PlayShowcase());\n * };\n */\n\nexport class PlayShowcase extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxModularConfiguratorActions.playShowcase };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * @internal\n * @hidden\n * Represents a command to send Unreal command.\n */\n\nexport class UnrealCommand extends CommandBase {\n constructor(payload: object) {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.sendCommandToUnreal,\n payload,\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to pause Showcase for a component when it is already initialized and playing.\n * This class sends a command to the Metabox API to pause showcase for a component if it is already initialized and playing.\n *\n * To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event.\n *\n * ### What does it unlock?\n * Pauses the showcase/timeline playback. Can be called independently without requiring any flag parameters.\n *\n * ### Practical Application\n * Pauses showcase animation playback. The showcase remains initialized and can be resumed with\n * PlayShowcase. Use when you need to temporarily freeze the animation (e.g., on a \"Pause\" button click).\n *\n * ### AI Coding Best Practices\n * Call `api.sendCommandToMetabox(new PauseShowcase())`. No parameters. Subscribe to showcaseStatusChanged\n * to confirm 'pause' state. Use PlayShowcase to resume or StopShowcase to reset.\n *\n * @example\n * import { Communicator, ShowCaseStatus, PauseShowcase } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n *\n * //Subscribe to the event before sending the command to ensure you capture the response\n * api.addEventListener('showcaseStatusChanged', (data:ShowCaseStatus) => {\n * console.log('Showcase status value after changed:', data);\n * });\n *\n * api.sendCommandToMetabox(new PauseShowcase());\n * };\n */\n\nexport class PauseShowcase extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxModularConfiguratorActions.pauseShowcase };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to stop Showcase for a component when it is already initialized, and you want to destroy it.\n * This class sends a command to the Metabox API to stop showcase for a component if it is already initialized.\n *\n * To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event.\n *\n * ### What does it unlock?\n * Stops the showcase/timeline playback and closes the showcase mode. Returns to normal configurator view.\n *\n * ### Practical Application\n * Stops showcase playback and exits showcase mode entirely. Returns to normal interactive configurator view.\n * Use for 'Exit Demo' buttons or auto-trigger when the user starts actively configuring the product.\n *\n * ### AI Coding Best Practices\n * Call `api.sendCommandToMetabox(new StopShowcase())`. Fully resets the showcase state. Subscribe to\n * showcaseStatusChanged to confirm 'stopped' status. After stopping, the configurator returns to full\n * interactive mode — re-enable configuration controls.\n *\n * @example\n * import { Communicator, ShowCaseStatus } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n *\n * //Subscribe to the event before sending the command to ensure you capture the response\n * api.addEventListener('showcaseStatusChanged', (data:ShowCaseStatus) => {\n * console.log('Showcase status value after changed:', data);\n * });\n *\n * api.sendCommandToMetabox(new StopShowcase());\n * };\n */\n\nexport class StopShowcase extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxModularConfiguratorActions.stopShowcase };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Image format.\n * This type represents the allowed image formats.\n *\n * ### What does it unlock?\n * Type alias for MIME types used in file/media handling. Defines supported file formats and media types.\n *\n * ### Practical Application\n * Type alias: 'image/png' | 'image/jpeg' | 'image/webp'. Used as the format parameter in GetScreenshot.\n * PNG for quality/transparency, JPEG for smaller files, WebP for modern browser optimization.\n *\n * ### AI Coding Best Practices\n * Pass as first param to GetScreenshot: `new GetScreenshot('image/png', {x:2048, y:2048})`.\n * Use PNG for highest quality and transparency. JPEG for smaller file size. WebP for modern browser optimization.\n * Match the saveImage filename extension to the format.\n */\nexport type MimeType = 'image/png' | 'image/jpeg' | 'image/webp';\n\n/**\n * Represents a command to get a screenshot.\n *\n * To listen for changes after sending this command, listen to the 'screenshot' event before command is sent.\n *\n * ### What does it unlock?\n * Takes a screenshot on the server side (Unreal Engine) of the 3D scene. Returns high-quality image.\n * Requires subscription to the screenshotReady event to receive the rendered image.\n *\n * ### Practical Application\n * Renders a high-res screenshot on the Unreal Engine server. Takes format ('image/png'|'image/jpeg'|'image/webp')\n * and optional size ({x, y}). Returns base64 data via screenshotReady event. Use for thumbnails, social sharing,\n * saving config snapshots, or attaching images to quotes.\n *\n * ### AI Coding Best Practices\n * Subscribe to screenshotReady BEFORE sending GetScreenshot. Pattern:\n * `api.addEventListener('screenshotReady', (data) => { if(data) saveImage(data, 'name.png'); })`.\n * Specify size for consistent outputs: `new GetScreenshot('image/png', {x:2048, y:2048})`.\n * Use saveImage() helper to convert base64 to downloadable file.\n *\n * @example\n * import { Communicator, saveImage, GetScreenshot } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n *\n * //Subscribe to the event before sending the command to ensure you capture the response\n * api.addEventListener('screenshot', (data:string) => {\n * // The data is a base64 string of the image. You can use it to display the image or save it as a file.\n * console.log('Get screenshot here:', data);\n * saveImage(data, 'Render.png');\n * });\n *\n * api.sendCommandToMetabox(new GetScreenshot('image/png', { x: 1024, y: 1024 }));\n * };\n *\n * @param {MimeType} mimeType - The output format.\n * @param {{ x: number; y: number }} [size] - Optional size in pixels.\n */\nexport class GetScreenshot extends CommandBase {\n constructor(mimeType: MimeType, size?: { x: number; y: number }) {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.getScreenshot,\n payload: { format: mimeType, size },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to set a component by its data (ID, typeId).\n * This action sends a message to the Metabox API to set a component using the provided data.\n * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.\n *\n * ### What does it unlock?\n * Sets a component during initialization, which triggers the reconstruction of the component tree structure.\n * Simulates clicking a component in the menu.\n *\n * ### Practical Application\n * Selects a component in the modular assembly. Takes componentId (UUID), typeId (category string).\n * CRITICAL: Always set root component (isRoot:true) FIRST — nothing renders without it. Then add children (isRoot:false).\n * Simulates clicking a component in the menu.\n *\n * ### AI Coding Best Practices\n * ALWAYS set root first: `new SetComponent('id', 'type', true)`. Then children: `new SetComponent('childId', 'childType', false)`.\n * Get valid IDs from configuratorDataUpdated event data — the configurator definition contains all available components and types.\n * Wrong order = blank viewport. The typeId must match componentType values from the configurator.\n *\n * @example\n * import { Communicator, ModularConfiguratorEnvelope, SetComponent } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n *\n * //Subscribe to the event before sending the command to ensure you capture the response\n * api.addEventListener('configuratorDataUpdated', (data:ModularConfiguratorEnvelope) => {\n * console.log('State updated after applied new component:', data);\n * });\n *\n * api.sendCommandToMetabox(new SetComponent(\n * 'ffea6b5c-3a8a-4f56-9417-e605acb5cca3', 'typeId'\n * ));\n * };\n *\n * @param {string} id - The component ID.\n * @param {string} typeId - The component type ID.\n */\nexport class SetComponent extends CommandBase {\n constructor(id: string, typeId: string) {\n super();\n this.data = {\n payload: { id, typeId },\n action: MetaboxModularConfiguratorActions.setComponent,\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to set component material by its slot ID and Material ID.\n * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.\n *\n * ### What does it unlock?\n * Sets a material variant for a component. Simulates selecting a different material from the menu for a specific component.\n *\n * ### Practical Application\n * Applies a material to a specific slot on a component. Takes componentId (UUID), slotId (string), and materialId (UUID).\n * Use to build swatch pickers, apply preset themes/bundles, or sync material selections from an external\n * PIM/ERP system via externalId mapping.\n *\n * ### AI Coding Best Practices\n * Get valid slotId and materialId values from the configuratorDataUpdated envelope —\n * check component slot definitions and material lists. Pattern:\n * `new SetComponentMaterial('component-uuid', 'slot-name', 'material-uuid')`. The referenced component must already be set in the tree.\n *\n * @example\n * import { Communicator, ModularConfiguratorEnvelope, SetComponentMaterial } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n *\n * //Subscribe to the event before sending the command to ensure you capture the response\n * api.addEventListener('configuratorDataUpdated', (data:ModularConfiguratorEnvelope) => {\n * console.log('State updated after applied new material:', data);\n * });\n *\n * api.sendCommandToMetabox(new SetComponentMaterial(\n * 'ffea6b5c-3a8a-4f56-9417-e605acb5cca3',\n * 'carpaint',\n * 'dd829d6e-9200-47a7-8d5b-af5df89b7e91',\n * ));\n * };\n *\n * @param {string} componentId - The component ID.\n * @param {string} slotId - The slot ID.\n * @param {string} materialId - The material ID.\n */\nexport class SetComponentMaterial extends CommandBase {\n constructor(componentId: string, slotId: string, materialId: string) {\n super();\n this.data = {\n payload: { componentId, slotId, materialId },\n action: MetaboxModularConfiguratorActions.setComponentMaterialById,\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to set the environment by its ID.\n * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.\n *\n * ### What does it unlock?\n * Sets environmental/lighting settings for the scene. Controls factors like lighting conditions and environmental appearance.\n *\n * ### Practical Application\n * Changes the 3D scene/environment (studio, showroom, outdoor, etc.). Takes an environmentId UUID.\n * Environments include lighting, backdrop, and optionally dynamic sky (udsEnabled) with time-of-day (udsHour) control.\n *\n * ### AI Coding Best Practices\n * Call `api.sendCommandToMetabox(new SetEnvironment('env-uuid'))`. Get valid environment IDs from the configurator\n * definition in configuratorDataUpdated. Set environment after root component during initialization. Each environment has\n * its own material slots, thumbnails, and lighting properties.\n *\n * @example\n * import { Communicator, ModularConfiguratorEnvelope } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n *\n * //Subscribe to the event before sending the command to ensure you capture the response\n * api.addEventListener('configuratorDataUpdated', (data:ModularConfiguratorEnvelope) => {\n * console.log('State updated after applied new environment:', data);\n * });\n *\n * api.sendCommandToMetabox(new SetEnvironment('55555555-1234-1234-1234-01234567890'))\n * };\n *\n * @param {string} environmentId - The environment ID.\n */\nexport class SetEnvironment extends CommandBase {\n constructor(environmentId: string) {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.setEnvironment,\n payload: { id: environmentId },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to set an environment material by its slot ID and Material ID.\n * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.\n *\n * ### What does it unlock?\n * Sets environmental material properties such as textures and appearance attributes for the scene environment.\n *\n * ### Practical Application\n * Applies materials to environment slots (floor, walls, backdrop textures). Takes slotId and materialId.\n * Use for scene-based configurators where the environment is also customizable — kitchen visualizers,\n * room planners, trade show booth designers.\n *\n * ### AI Coding Best Practices\n * Pattern: `new SetEnvironmentMaterial('floor-slot-id', 'material-uuid')`. Get valid slot and material IDs from\n * the environment definition's slots array in configuratorDataUpdated. Only useful when the active environment\n * has configurable material slots.\n *\n * @example\n * import { Communicator, ModularConfiguratorEnvelope } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n *\n * //Subscribe to the event before sending the command to ensure you capture the response\n * api.addEventListener('configuratorDataUpdated', (data:ModularConfiguratorEnvelope) => {\n * console.log('State updated after applied new environment material:', data);\n * });\n *\n * api.sendCommandToMetabox(new SetEnvironmentMaterial(\n * 'carpaint',\n * 'dd829d6e-9200-47a7-8d5b-af5df89b7e91',\n * ));\n * };\n *\n * @param {string} slotId - The slot ID.\n * @param {string} materialId - The material ID.\n */\n\nexport class SetEnvironmentMaterial extends CommandBase {\n constructor(slotId: string, materialId: string) {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.setEnvironmentMaterialById,\n payload: { slotId, materialId },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to toggle the embedded Metabox menu.\n * This command can only be used when using the metabox menu.\n *\n * ### What does it unlock?\n * Shows the embedded menu interface. Only works when using the MetaBox native menu (not in standalone/custom menu\n * mode).\n *\n * ### Practical Application\n * Toggles the native MetaBox right sidebar menu. Takes a boolean parameter. Pass false to hide when building custom UI.\n * In standalone mode, the menu is already hidden — this is only relevant in default (non-standalone) mode.\n *\n * ### AI Coding Best Practices\n * In standalone mode (`{standalone:true}`), this is unnecessary (menu already hidden). In default mode,\n * call `new ShowEmbeddedMenu(false)` early in initialization to hide built-in UI before rendering custom controls.\n * Pattern for custom UI: `ShowEmbeddedMenu(false)` + `ShowOverlayInterface(false)`.\n *\n * @example\n * import { ShowEmbeddedMenu, Communicator } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * api.sendCommandToMetabox(new ShowEmbeddedMenu(true));\n * };\n *\n * @param {boolean} visible - A flag indicating whether the embedded menu should be visible.\n */\n\nexport class ShowEmbeddedMenu extends CommandBase {\n constructor(visible: boolean) {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.showEmbeddedMenu,\n payload: { visible },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to toggle the Unreal Overlay Interface Menu.\n * This action sends a message to the Metabox API to toggle the visibility of the Unreal overlay UI.\n *\n * ### What does it unlock?\n * Shows the overlay interface elements. Displays UI controls and buttons overlaid on the 3D scene.\n *\n * ### Practical Application\n * Toggles viewport overlay controls (buttons overlaid on the 3D scene). Takes a boolean.\n * Use `ShowOverlayInterface(false)` alongside `ShowEmbeddedMenu(false)` when building fully custom UI\n * that replaces all native MetaBox controls.\n *\n * ### AI Coding Best Practices\n * In standalone mode, overlays are already hidden. In default mode, call `new ShowOverlayInterface(false)`\n * early in initialization to prevent flash of native UI. Always pair with `ShowEmbeddedMenu(false)` for clean custom UI.\n * Pass true to restore if entering a mode that uses native controls.\n *\n * @example\n * import { ShowOverlayInterface, Communicator } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * api.sendCommandToMetabox(new ShowOverlayInterface(true));\n * };\n *\n * @param {boolean} visible - A flag indicating whether the Unreal overlay UI should be visible.\n */\n\nexport class ShowOverlayInterface extends CommandBase {\n constructor(visible: boolean) {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.showOverlayInterface,\n payload: { visible },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to show measurement for a product when it is already loaded.\n * This class sends a command to the Metabox API to show measurement for a product if it is already initialized.\n *\n * ### What does it unlock?\n * Shows the measurement overlay. Works as a toggle with HideMeasurement to control visibility.\n *\n * ### Practical Application\n * Shows the measurement/dimension overlay tools on the 3D viewport. Use for B2B or technical applications\n * where buyers need to verify product dimensions, check fit specifications, or confirm measurements during procurement.\n *\n * ### AI Coding Best Practices\n * Call `api.sendCommandToMetabox(new ShowMeasurement())`. No parameters. Pair with HideMeasurement for toggle behavior.\n * Track visibility state in your app to keep toggle buttons in sync.\n *\n * @example\n * import { ShowMeasurement, Communicator } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * api.sendCommandToMetabox(new ShowMeasurement());\n * };\n */\n\nexport class ShowMeasurement extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxModularConfiguratorActions.showMeasurement };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to hide measurement for a product when it is already loaded.\n * This class sends a command to the Metabox API to hide measurement for a product if it is already initialized.\n *\n * ### What does it unlock?\n * Hides the measurement overlay. Executes unconditionally to hide the UI controls.\n *\n * ### Practical Application\n * Hides the measurement/dimension overlay. Use when transitioning from a technical spec view back to a clean\n * product presentation, or to keep consumer-facing configurators visually clean.\n *\n * ### AI Coding Best Practices\n * Call `api.sendCommandToMetabox(new HideMeasurement())`. No parameters. Pair with ShowMeasurement as a toggle.\n * Track visibility state in your app state to keep toggle buttons in sync.\n *\n * @example\n * import { HideMeasurement, Communicator } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * api.sendCommandToMetabox(new HideMeasurement());\n * };\n */\n\nexport class HideMeasurement extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxModularConfiguratorActions.hideMeasurement };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport type { ApplicationDeviceTypes } from '../interfaces';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to force set the device type.\n * This class sends a message to the Metabox API to force set the device type.\n *\n * ### What does it unlock?\n * Forces the specification of device type (desktop or mobile) for the MetaBox configurator. Possibly deprecated.\n *\n * ### Practical Application\n * Forces device type override (desktop/tablet/mobile). Likely deprecated — MetaBox auto-detects via ApplicationDeviceTypes.\n * Only relevant for kiosk or showroom setups where you need to force a specific rendering mode.\n *\n * ### AI Coding Best Practices\n * Avoid unless you have a confirmed kiosk/showroom use case. If needed, set it once during initialization only.\n * Prefer letting MetaBox handle device detection automatically.\n *\n * @example\n * import { ForceSetDeviceType, Communicator } from '@3dsource/metabox-modular-configurator-api';\n *\n * window.env3DSource.apiReady = (api: Communicator) => {\n * api.sendCommandToMetabox(new ForceSetDeviceType('desktop'));\n * };\n *\n * @param {ApplicationDeviceTypes} deviceType - The device type to force set.\n */\nexport class ForceSetDeviceType extends CommandBase {\n constructor(deviceType: ApplicationDeviceTypes) {\n super();\n this.data = {\n payload: { deviceType },\n action: MetaboxModularConfiguratorActions.forceSetDeviceType,\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to resume the pixel streaming session.\n * This class sends a message to the Metabox API to resume a paused or disconnected stream.\n *\n * ### What does it unlock?\n * Resumes the Unreal Engine pixel streaming connection after it has been paused, disconnected, or stopped due to inactivity (AFK timeout).\n *\n * ### Practical Application\n * Used to reconnect the 3D streaming session without a full page reload. Essential for 'Reconnect' or 'Resume' buttons\n * shown when the stream is interrupted, e.g., after an idle timeout or network disruption.\n *\n * ### AI Coding Best Practices\n * Call `api.sendCommandToMetabox(new ResumeStream())`. No parameters. Resumes the existing streaming session —\n * does not reinitialize the configurator or reset component/environment state.\n *\n * @example\n * import { ResumeStream, Communicator } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * api.sendCommandToMetabox(new ResumeStream());\n * };\n */\n\nexport class ResumeStream extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxModularConfiguratorActions.resumeStream };\n }\n}\n","/**\n * Represents a callback listener for specific message types.\n * Used internally by EventDispatcher to store event listeners.\n *\n * ### What does it unlock?\n * Event listener interface. Allows subscription to specific events from the configurator to receive real-time data updates.\n *\n * ### Practical Application\n * Event listener interface. addEventListener() and removeEventListener() on Communicator. Subscribe to real-time\n * configurator events: state changes, viewport readiness, screenshots, showcase status, camera results, resolution changes.\n *\n * ### AI Coding Best Practices\n * Set up listeners BEFORE sending commands that trigger them. Always clean up with removeEventListener on component unmount.\n * Key events: configuratorDataUpdated (every state change), viewportReady (init complete), screenshotReady (captures),\n * getCameraResult (camera queries), showcaseStatusChanged (demo playback).\n *\n * @public\n */\nexport interface Listener {\n /** The message type this listener is registered for */\n messageType: string;\n /** The callback function to execute when a message of the specified type is received */\n callback: (data: unknown) => void;\n}\n\n/**\n * EventDispatcher is a class that manages event listeners and dispatches events to them.\n *\n * ### What does it unlock?\n * Parent class of Communicator that dispatches commands. Acts as an event dispatcher that routes command messages internally.\n *\n * ### Practical Application\n * Internal event routing layer — parent class of Communicator. Routes postMessage commands between your app\n * and the Unreal Engine pixel stream. Not used directly but understanding it helps debug message delivery issues.\n *\n * ### AI Coding Best Practices\n * Do not reference or extend EventDispatcher in application code. Use only the Communicator interface methods.\n * If debugging communication failures, check browser console for postMessage errors related to this layer.\n */\nexport class EventDispatcher {\n /**\n * Storage for callback listeners by message type.\n */\n listeners: Listener[] = [];\n\n /**\n * Removes all registered listeners. Subclasses override this to perform additional cleanup.\n * @param key - Instance key (used by subclass overrides for registry cleanup).\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n destroy(key: string) {\n this.listeners = [];\n }\n\n /**\n * Adds an event listener for receiving specific types of messages.\n *\n * @param {string} messageType - The message type to listen for.\n * @param callback - The callback function to execute when a message is received.\n */\n addEventListener(\n messageType: string,\n callback: (data: unknown) => void,\n ): this {\n this.listeners.push({ messageType, callback });\n return this;\n }\n\n /**\n * Dispatches an event to all listeners of a specific message type.\n *\n * @param {string} messageType - The message type.\n * @param data - The data associated with the event.\n */\n dispatchEvent(messageType: string, data: unknown): this {\n this.listeners\n .filter((listener) => listener.messageType === messageType)\n .forEach((listener) => listener.callback(data));\n return this;\n }\n\n /**\n * Removes an event listener for a specific type of message.\n *\n * @param {string} messageType - The message type.\n * @param callback - The callback function to remove.\n */\n removeEventListener(\n messageType: string,\n callback: (data: unknown) => void,\n ): this {\n this.listeners = this.listeners.filter(\n (listener) =>\n !(\n listener.messageType === messageType && listener.callback === callback\n ),\n );\n return this;\n }\n}\n","/**\n * @internal\n * @hidden\n * Core constants used for host-to-iframe communication and URL construction.\n */\n\n/**\n * Storage key for the Metabox Communicator instance registry.\n *\n * ### What does it unlock?\n * Constant string identifier for MetaBox version. Used internally to reference the MetaBox system and versioning.\n *\n * ### Practical Application\n * Internal system reference for versioning.\n * Not needed in front-end application code.\n *\n * ### AI Coding Best Practices\n * Skip in application code. This constant is for internal MetaBox system identification only.\n *\n * @internal\n */\nexport const Metabox = 'metabox';\n\n/**\n * Identifier used as the `host` field in postMessage envelopes sent to the iframe.\n *\n * ### What does it unlock?\n * Constant for the MetaBox host connection point. Specifies endpoint for MetaBox connections.\n *\n * ### Practical Application\n * MetaBox endpoint constant. The host the configurator iframe connects to for Unreal Engine pixel streaming.\n * Not needed in front-end application code.\n *\n * ### AI Coding Best Practices\n * Skip in application code. This constant is for internal MetaBox system identification only.\n *\n * @internal\n */\nexport const MetaboxHost = 'metaboxHost';\n\n/**\n * Identifier used as the `host` field in postMessage envelopes received from the iframe.\n *\n * ### What does it unlock?\n * Constant identifier used internally to reference and compare MetaBox data. Used for data validation and internal routing.\n *\n * ### Practical Application\n * Internal data reference constant used for validation and message routing within the communication layer.\n * Not needed in front-end application code.\n *\n * ### AI Coding Best Practices\n * Skip in application code. Only relevant if debugging very low-level message traffic between your app and the MetaBox iframe.\n *\n * @internal\n */\nexport const MetaboxData = 'metaboxData';\n\n/**\n * Action string dispatched by the iframe when the configurator app has loaded.\n *\n * ### What does it unlock?\n * App initialization flag variable. Signals when MetaBox has completed loading.\n *\n * ### Practical Application\n * Use the viewportReady event (more reliable) to gate your UI rendering — don't show controls until MetaBox confirms it's ready.\n *\n * ### AI Coding Best Practices\n * Prefer the viewportReady event over this variable: `api.addEventListener('viewportReady', (ready) => { if(ready) enableUI(); })`.\n * viewportReady is the reliable signal that MetaBox is ready to accept commands.\n *\n * @internal\n */\nexport const AppLoaded = 'appLoaded_v3';\n\n/**\n * Default MetaBox domain for production environments.\n *\n * ### What does it unlock?\n * Constant for the standard default MetaBox domain. Used as the primary domain for connecting to MetaBox server.\n *\n * ### Practical Application\n * Default MetaBox domain constant (HTTPS). The base domain used when no override is specified.\n * Override only via IntegrateMetaboxConfig.domain if connecting to a custom or self-hosted MetaBox instance.\n *\n * ### AI Coding Best Practices\n * Let integrateMetabox() use the default. Override only if needed:\n * `integrateMetabox(id, container, callback, { domain: 'https://custom.domain.com' })`. HTTPS is mandatory.\n *\n * @internal\n */\n\n/**\n * @deprecated\n */\nexport const Metabox_V3 = 'metabox_v3';\n/**\n * @deprecated\n */\nexport const MetaboxHost_V3 = 'metaboxHost_v3';\n/**\n * @deprecated\n */\nexport const AppLoaded_V3 = 'appLoaded_v3';\n\nexport const MetaboxDomain = 'metabox.3dsource.com';\n\n/**\n * Base route URL segment for the Modular Configurator.\n *\n * ### What does it unlock?\n * Base route URL constant used for loading the configurator. Standard path endpoint for accessing the modular configurator.\n *\n * ### Practical Application\n * The modular configurator URL format is: `https://{domain}/metabox-configurator/modular/{configuratorId}`.\n * Automatically constructed by integrateMetabox().\n *\n * ### AI Coding Best Practices\n * Let integrateMetabox() handle URL construction. Only reference if building URLs manually\n * (e.g., QR codes, email links, server-side rendering). The modular path is `/modular/{id}`.\n *\n * @internal\n */\nexport const BasicRouteUrl = 'metabox-configurator/modular';\n","export const VERSION = '3.0.19-dev.11';\n","import { EventDispatcher } from './event-dispatcher';\nimport type { CommandBase } from '../actions';\nimport { MetaboxConfig } from '../actions';\nimport type {\n FromMetaBoxApiEvents,\n FromMetaBoxMessage,\n FromMetaboxMessagePayloads,\n MCAppLoaded,\n MetaboxCommandConfig,\n MetaboxEnvironment,\n ToMetaBoxMessage,\n} from '../interfaces';\nimport { AppLoaded, Metabox, MetaboxHost, VERSION } from '../constants';\n\nconst communicatorMap = new Map<string, { instance: Communicator }>();\n\n/**\n * Handles messaging between the host page and embedded Metabox content.\n *\n * ### What does it unlock?\n * Internal class that creates a proxy/communication layer between the API and MetaBox.\n * Handles reading and sending commands through the established connection.\n *\n * ### Practical Application\n * The API handle returned in the integrateMetabox callback. Provides sendCommandToMetabox() to send commands,\n * and addEventListener()/removeEventListener() for event subscriptions. This is your entire interface to\n * the MetaBox Unreal Engine stream.\n *\n * ### AI Coding Best Practices\n * Store the Communicator reference from the apiReadyCallback in a module-scoped variable or state store.\n * NEVER send commands before this callback fires. All commands and event listeners go through this single\n * api object. Clean up listeners with removeEventListener on component unmount.\n *\n * @internal Use {@link Communicator.createInstance} or the {@link integrateMetabox} helper to instantiate.\n */\nexport class Communicator extends EventDispatcher {\n /**\n * Bound handler for incoming postMessage events.\n */\n private binder = this.handleMessageReceived.bind(this);\n\n /**\n * Constructs a Communicator, replacing any existing instance, and begins listening for messages.\n * @internal\n */\n constructor(\n data: MCAppLoaded['payload'],\n environment: MetaboxEnvironment,\n config?: Partial<MetaboxCommandConfig>,\n ) {\n super();\n const { appId = 'unknown', version = VERSION } = data ?? {};\n const key = `${version}_${environment}_${appId}`;\n communicatorMap.get(key)?.instance.destroy(key);\n communicatorMap.set(key, { instance: this });\n window.addEventListener('message', this.binder);\n this.sendCommandToMetabox(\n new MetaboxConfig(appId, {\n ...config,\n hostUrl: location.href,\n apiVersion: VERSION,\n }),\n );\n }\n\n /**\n * Listens for Metabox to signal readiness, then initializes communicator.\n * @param apiReadyCallback - Called with the new Communicator once the Metabox is loaded.\n * @param {MetaboxEnvironment} environment - The environment in which the Communicator is running.\n * @param {MetaboxCommandConfig} config - optional initial config: standalone - if true - disable metabox custom template and all logic\n */\n static createInstance(\n apiReadyCallback: (api: Communicator) => void,\n environment: MetaboxEnvironment,\n config?: Partial<MetaboxCommandConfig>,\n ) {\n const startHandler = (event: MessageEvent) => {\n const message = event.data as FromMetaBoxMessage;\n if (message?.envelope?.action === AppLoaded && message.host === Metabox) {\n apiReadyCallback(\n new Communicator(message.envelope.payload, environment, config),\n );\n window.removeEventListener('message', startHandler);\n }\n };\n\n window.addEventListener('message', startHandler);\n }\n\n /**\n * Cleans up resources and stops listening for messages.\n */\n public override destroy(key: string) {\n super.destroy(key);\n window.removeEventListener('message', this.binder);\n }\n\n /** Destroys all active Communicator instances and clears the internal registry. */\n static clearAll() {\n if (communicatorMap.size === 0) {\n return;\n }\n\n communicatorMap.forEach((value, key) => value.instance.destroy(key));\n communicatorMap.clear();\n }\n\n /**\n * Retrieves a registered Communicator instance by its key.\n * @param key - The composite key (`version_environment_appId`) identifying the instance.\n */\n static getCommunicator(key: string) {\n return communicatorMap.get(key);\n }\n\n /**\n * Posts a command to the Metabox iframe.\n * @param command - An action command containing data to send.\n */\n public sendCommandToMetabox<T extends CommandBase>(command: T) {\n const { data } = command;\n const iframe = document.getElementById(\n 'embeddedContent',\n ) as HTMLIFrameElement;\n\n const toMetaboxMessage = {\n host: MetaboxHost,\n envelope: { ...data },\n payload: { ...data },\n target: iframe?.contentWindow ? 'child' : 'metabox',\n apiVersion: VERSION,\n } satisfies ToMetaBoxMessage;\n\n if (!iframe?.contentWindow) {\n console.warn(\n 'Metabox IFrame not found or not ready. Message sends to the same window',\n );\n window.postMessage(toMetaboxMessage, '*');\n return;\n }\n\n iframe.contentWindow.postMessage(toMetaboxMessage, '*');\n }\n\n /**\n * Registers an event listener for messages dispatched by the Metabox.\n * @param messageType - The event name to listen for (e.g. `'configuratorDataUpdated'`).\n * @param callback - Handler invoked with the typed payload when the event fires.\n * @override\n */\n override addEventListener<T extends FromMetaBoxApiEvents>(\n messageType: T,\n callback: (data: FromMetaboxMessagePayloads[T]) => void,\n ) {\n return super.addEventListener(\n messageType,\n callback as (data: unknown) => void,\n );\n }\n\n /**\n * Dispatches a typed event to all registered listeners.\n * @param messageType - The event name to dispatch.\n * @param data - The payload to pass to each listener.\n * @override\n */\n override dispatchEvent<T extends FromMetaBoxApiEvents>(\n messageType: T,\n data: FromMetaboxMessagePayloads[T],\n ) {\n return super.dispatchEvent(messageType, data);\n }\n\n /**\n * Removes a previously registered event listener.\n * @param messageType - The event name the listener was registered for.\n * @param callback - The same function reference that was passed to {@link addEventListener}.\n * @override\n */\n override removeEventListener<T extends FromMetaBoxApiEvents>(\n messageType: T,\n callback: (data: FromMetaboxMessagePayloads[T]) => void,\n ) {\n return super.removeEventListener(\n messageType,\n callback as (data: unknown) => void,\n );\n }\n\n /**\n * Filters and dispatches incoming messages from the Metabox.\n * @param event - The postMessage event received on a window.\n */\n private handleMessageReceived<T extends FromMetaBoxApiEvents>(\n event: MessageEvent,\n ) {\n if (event.data?.host !== Metabox) {\n return;\n }\n const data = event.data?.envelope;\n this.dispatchEvent(data?.eventType as T, data?.payload);\n }\n}\n","import type { IntegrateMetaboxConfig } from '../interfaces';\nimport { BasicRouteUrl, MetaboxDomain } from '../constants';\n\n/**\n * Constructs the iframe source URL for the Metabox Modular Configurator.\n *\n * ### What does it unlock?\n * Utility function that prepares the iframe source URL. Constructs the proper URL with parameters\n * for loading the MetaBox configurator.\n *\n * ### Practical Application\n * Utility function that constructs the iframe source URL with proper parameters.\n * URL format: `https://{domain}/metabox-configurator/modular/{configuratorId}`.\n * Called internally by integrateMetabox() — use directly only for manual URL construction.\n *\n * ### AI Coding Best Practices\n * Usually called internally. Use directly only for pre-constructing embed URLs (QR codes, email links,\n * preview URLs). Verify output is HTTPS. Remember modular configurators use `/modular/` path.\n *\n * @internal\n * @hidden\n *\n * @param {string} configuratorId - An string identifier for the configurator.\n * @param {IntegrateMetaboxConfig} config - An object containing the configuration options.\n */\nexport const prepareIframeSrc = (\n configuratorId: string,\n config?: IntegrateMetaboxConfig,\n) => {\n const base = `https://${config?.domain || MetaboxDomain}/${BasicRouteUrl}/${configuratorId}`;\n const params = new URLSearchParams();\n\n if (config?.introImage) {\n params.set('introImage', config.introImage);\n }\n if (config?.introVideo) {\n params.set('introVideo', config.introVideo);\n }\n if (config?.loadingImage) {\n params.set('loadingImage', config.loadingImage);\n }\n if (config?.state) {\n params.set('state', decodeURIComponent(config.state));\n }\n\n const query = params.toString();\n return query ? `${base}?${query}` : base;\n};\n","import { Communicator } from './communicator';\nimport type { IntegrateMetaboxConfig } from '../interfaces';\nimport { prepareIframeSrc } from './prepare-iframe-src';\n\n/**\n * Integrates the Metabox Modular Configurator into the page by injecting an iframe and\n * initializing a Communicator instance for host-to-iframe messaging.\n *\n * - Builds a secure iframe URL using the provided configuratorId and config options.\n * - Ensures the resulting URL uses HTTPS and that the target container exists.\n * - Removes any previously embedded iframe with id \"embeddedContent\" before inserting a new one.\n *\n * ### What does it unlock?\n * Main initialization function for MetaBox integration. Initializes the configurator, receives an API handle,\n * and sets up all configurations.\n *\n * ### Practical Application\n * THE entry point function. Creates the configurator iframe, establishes postMessage communication, and returns\n * the Communicator api handle via callback. Call ONCE per configurator. Params: configuratorId (modular UUID),\n * containerId (DOM element ID, default 'embed3DSource'), apiReadyCallback, config (IntegrateMetaboxConfig).\n *\n * ### AI Coding Best Practices\n * Pattern: `integrateMetabox('uuid', 'div-id', (api) => {\n * setup listeners, then set root component, then environment, then children\n * }, { standalone: true })`.\n * Ensure container div exists in DOM with non-zero dimensions. HTTPS required.\n * Inside callback: 1) addEventListener for configuratorDataUpdated, 2) SetComponent root, 3) SetEnvironment,\n * 4) SetComponent children, 5) SetComponentMaterial.\n *\n * @param {string} configuratorId - The Modular Configurator ID (not a full URL). It is appended to\n * `https://{domain}/metabox-configurator/modular/{configuratorId}` to form the iframe src.\n *\n * @param {string} containerId - The id of the container element where the iframe will be injected.\n *\n * @param {(api: Communicator) => void} apiReadyCallback - Called when the Communicator instance is created on the host side.\n *\n * @param {IntegrateMetaboxConfig} config - Optional configuration used to build the iframe URL and initialize the communicator.\n * Supported fields:\n * - standalone?: boolean — if true, disables Metabox custom template and related logic.\n * - introImage?: string — URL to an image shown on the intro screen (added as ?introImage=...).\n * - introVideo?: string — URL to a video shown on the intro screen (added as ?introVideo=...).\n * - loadingImage?: string — URL to an image displayed while loading (added as ?loadingImage=...).\n * - state?: string — Predefined state for configurator for initial loading (added as ?state=...).\n * - domain?: string — custom domain for testing (defaults to metabox.3dsource.com). HTTPS is enforced.\n *\n * @throws Error If configuratorId or containerId are empty strings.\n * @throws Error If the computed iframe URL is invalid or does not use HTTPS.\n * @throws Error If the container element with the provided id cannot be found.\n *\n * @example\n * import { integrateMetabox } from '@3dsource/metabox-modular-configurator-api';\n *\n * integrateMetabox(\n * 'configurator-id',\n * 'embed3DSource',\n * (api) => {\n * // Communicator is ready to use\n * },\n * {\n * standalone: false,\n * introImage: 'https://example.com/intro.png',\n * loadingImage: 'https://example.com/loading.png',\n * },\n * );\n */\nexport function integrateMetabox(\n configuratorId: string,\n containerId: string,\n apiReadyCallback: (api: Communicator) => void,\n config?: IntegrateMetaboxConfig,\n) {\n if (!configuratorId.trim()) {\n throw new Error(\n 'integrateMetabox: configuratorId must be a non-empty string',\n );\n }\n const iframeSrc = prepareIframeSrc(configuratorId, config);\n let parsedUrl: URL;\n try {\n parsedUrl = new URL(iframeSrc);\n } catch {\n throw new Error('integrateMetabox: Provided iframeSrc is not a valid URL');\n }\n if (parsedUrl.protocol !== 'https:') {\n throw new Error('integrateMetabox: iframeSrc must use HTTPS protocol');\n }\n if (!containerId.trim()) {\n throw new Error('integrateMetabox: containerId must be a non-empty string');\n }\n\n const container = document.getElementById(containerId);\n if (!container) {\n throw new Error(`Container element with id ${containerId} not found`);\n }\n\n const existingIframe = document.getElementById('embeddedContent');\n if (existingIframe) {\n existingIframe.remove();\n }\n\n Communicator.createInstance(apiReadyCallback, 'host', config);\n\n const style = document.createElement('style');\n style.innerHTML = `\n #${containerId} {\n width: 100%;\n height: 100%;\n overflow: hidden;\n position: relative;\n }\n `;\n document.head.appendChild(style);\n\n const iframe = document.createElement('iframe');\n iframe.setAttribute('allow', 'autoplay; fullscreen; encrypted-media');\n iframe.setAttribute('referrerPolicy', 'no-referrer-when-downgrade');\n iframe.setAttribute('id', 'embeddedContent');\n iframe.style.border = '0';\n iframe.style.width = '100%';\n iframe.style.height = '100%';\n iframe.style.overflow = 'hidden';\n iframe.src = iframeSrc;\n container.appendChild(iframe);\n}\n","/**\n * Saves an image by triggering a download.\n *\n * This function creates an anchor element, sets its `href` attribute to the provided image URL,\n * and triggers a click event to initiate a download with the specified filename.\n *\n * ### What does it unlock?\n * Main exported function to save images from the configurator. Converts base64 image data to actual image\n * files and saves them to the local filesystem.\n *\n * ### Practical Application\n * Exported utility function that converts base64 screenshot data (from screenshotReady event) to a downloadable\n * image file. Handles the base64 → blob → browser download flow. Import directly from the API package.\n *\n * ### AI Coding Best Practices\n * Pattern: `api.addEventListener('screenshotReady', (data) => { if(data) saveImage(data, 'config-screenshot.png'); })`.\n * Filename extension should match the MimeType passed to GetScreenshot.\n * Import: `import { saveImage } from '@3dsource/metabox-modular-configurator-api'`.\n *\n * @param {string} imageUrl - The URL of the image to save.\n * @param {string} filename - The name of the file to save.\n */\nexport function saveImage(imageUrl: string, filename: string): void {\n const a = document.createElement('a');\n a.href = imageUrl;\n a.download = filename;\n document.body.appendChild(a);\n a.click();\n document.body.removeChild(a);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;AAiBG;MAEU,WAAW,CAAA;AAGvB;;AChBD;;;;;;;;;;;;;;;;;;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H,IAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;IAEhC,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC;AAC/C,IAAA,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,uCAAuC,CAAC;AACrE,IAAA,MAAM,CAAC,YAAY,CAAC,gBAAgB,EAAE,4BAA4B,CAAC;AACnE,IAAA,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,iBAAiB,CAAC;AAC5C,IAAA,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG;AACzB,IAAA,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM;AAC3B,IAAA,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM;AAC5B,IAAA,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ;AAChC,IAAA,MAAM,CAAC,GAAG,GAAG,SAAS;AACtB,IAAA,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC;AAC/B;;AC3HA;;;;;;;;;;;;;;;;;;;;;AAqBG;AACG,SAAU,SAAS,CAAC,QAAgB,EAAE,QAAgB,EAAA;IAC1D,MAAM,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC;AACrC,IAAA,CAAC,CAAC,IAAI,GAAG,QAAQ;AACjB,IAAA,CAAC,CAAC,QAAQ,GAAG,QAAQ;AACrB,IAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAC5B,CAAC,CAAC,KAAK,EAAE;AACT,IAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;AAC9B;;AC7BA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"3dsource-metabox-modular-configurator-api.mjs","sources":["../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/CommandBase.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/fromCommunicatorEvent.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/interfaces/ToMetaboxMessagePayloads.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/MetaboxConfig.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/GetPdf.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/GetCallToActionInformation.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/GetCamera.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/SetCamera.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/ResetCamera.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/ApplyZoom.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/InitShowcase.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/PlayShowcase.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/UnrealCommand.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/PauseShowcase.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/StopShowcase.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/GetScreenshot.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/SetComponent.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/SetComponentMaterial.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/SetEnvironment.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/SetEnvironmentMaterial.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/ShowEmbeddedMenu.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/ShowOverlayInterface.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/ShowMeasurement.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/HideMeasurement.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/ForceSetDeviceType.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/ResumeStream.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/helpers/event-dispatcher.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/constants/common.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/constants/version.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/helpers/communicator.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/helpers/prepare-iframe-src.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/helpers/integrate-metabox.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/helpers/save-image.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/3dsource-metabox-modular-configurator-api.ts"],"sourcesContent":["import type { ToMetaBoxMessageEnvelope } from '../interfaces';\n\n/**\n * Base class for commands sent to the Metabox API.\n *\n * ### What does it unlock?\n * Base class that all other commands inherit from in a class hierarchy. Provides common properties\n * and methods that are automatically available to all command subclasses.\n *\n * ### Practical Application\n * Base class all commands inherit from. Never instantiate directly — use specific subclasses like\n * SetProduct, SetCamera, etc. All commands are sent via `api.sendCommandToMetabox(new CommandName(...))`.\n *\n * ### AI Coding Best Practices\n * Never construct a generic CommandBase. Always use the specific typed command class. When generating\n * dynamic command dispatch, use a switch/map pattern matching command names to their constructors.\n *\n * @internal\n * @hidden\n */\n\nexport class CommandBase {\n /** The message envelope populated by subclass constructors and sent via {@link Communicator.sendCommandToMetabox}. */\n data!: ToMetaBoxMessageEnvelope;\n}\n","import type { Communicator } from '../helpers';\nimport type {\n FromMetaBoxApiEvents,\n FromMetaboxMessagePayloads,\n} from '../interfaces';\nimport type { Observable } from 'rxjs';\nimport { fromEvent } from 'rxjs';\n\n/**\n * Wrapper helper function to use with RxJS the same way as `fromEvent`, to listen to events from the Communicator.\n *\n * ### What does it unlock?\n * Function that creates an event listener subscription. Allows developers to subscribe to specific events from the Communicator.\n *\n * ### Practical Application\n * Function that creates event listener subscriptions. Alternative to api.addEventListener() — both subscribe\n * to configurator events. Use to react to state changes, screenshot readiness, viewport loading, showcase status, etc.\n *\n * ### AI Coding Best Practices\n * Prefer api.addEventListener() directly from the Communicator object. If using fromCommunicatorEvent, pass the\n * event name and handler. Key events: configuratorDataUpdated, viewportReady, screenshotReady, showcaseStatusChanged,\n * getCameraResult. Always subscribe BEFORE sending commands that trigger responses.\n *\n * @param {Communicator} target - The Communicator instance to listen on.\n * @param {T} eventName - The event name from {@link FromMetaBoxApiEvents} to subscribe to.\n * @returns An Observable that emits the typed payload each time the event fires.\n * @internal\n */\nexport function fromCommunicatorEvent<T extends FromMetaBoxApiEvents>(\n target: Communicator,\n eventName: T,\n) {\n return fromEvent(target, eventName) as Observable<\n FromMetaboxMessagePayloads[T]\n >;\n}\n","import type { MimeType } from '../actions';\nimport type { ApplicationDeviceTypes } from './application-device-types';\nimport type { MetaboxHost } from '../constants';\nimport type { MetaboxCommandConfig } from './metabox-config';\n\n/**\n * Registry of all action identifiers that can be sent from the host application to the Metabox Modular Configurator.\n * Each key maps to a string used as the `action` field in the postMessage envelope.\n *\n * ### What does it unlock?\n * Variable containing all available action names. Interface listing all actions that the modular configurator supports.\n *\n * ### Practical Application\n * Master action registry object — all supported configurator action names. Invaluable reference for building\n * admin dashboards, permission systems, or feature-availability displays.\n *\n * ### AI Coding Best Practices\n * Iterate this object to dynamically build action dropdowns, command palettes, or feature checklists in admin tools.\n * Each key is an action name, value is its description. Excellent reference for AI coding agents to understand\n * the full command vocabulary available.\n */\nexport const MetaboxModularConfiguratorActions = {\n metaboxConfig: 'metaboxConfig',\n resumeStream: 'resumeStream',\n setEnvironment: 'setEnvironment',\n setEnvironmentMaterialById: 'setEnvironmentMaterialById',\n setComponent: 'setComponent',\n setComponentMaterialById: 'setComponentMaterialById',\n getPdf: 'getPdf',\n getCallToActionInformation: 'getCallToActionInformation',\n getScreenshot: 'getScreenshot',\n showEmbeddedMenu: 'showEmbeddedMenu',\n forceSetDeviceType: 'forceSetDeviceType',\n showOverlayInterface: 'showOverlayInterface',\n getCamera: 'getCamera',\n setCamera: 'setCamera',\n resetCamera: 'resetCamera',\n applyZoom: 'applyZoom',\n initShowcase: 'initShowcase',\n playShowcase: 'playShowcase',\n pauseShowcase: 'pauseShowcase',\n stopShowcase: 'stopShowcase',\n sendCommandToUnreal: 'sendCommandToUnreal',\n showMeasurement: 'showMeasurement',\n hideMeasurement: 'hideMeasurement',\n} as const;\n\n/**\n * Union of all action string literals from {@link MetaboxModularConfiguratorActions}.\n *\n * ### What does it unlock?\n * Type alias for all actions that can be sent to MetaBox. Defines the complete set of command types available.\n *\n * ### Practical Application\n * Type alias enumerating all available outgoing command types. Master list of everything your app can tell MetaBox to do.\n * Use as a checklist when planning which features to implement.\n *\n * ### AI Coding Best Practices\n * Reference for building command dispatchers or admin tools. Full command set includes all values of\n * MetaboxModularConfiguratorActions like: \"metaboxConfig\" | \"setEnvironment\" | \"setEnvironmentMaterialById\" | ...\n */\nexport type ToMetaBoxActions =\n (typeof MetaboxModularConfiguratorActions)[keyof typeof MetaboxModularConfiguratorActions];\n\n/**\n * @internal\n * @hidden\n */\nexport type ToMetaboxMessagePayload =\n ToMetaboxMessagePayloads[keyof ToMetaboxMessagePayloads];\n\n/**\n * Interface for messages sent from the application to the Metabox Modular Configurator.\n *\n * ### What does it unlock?\n * Defines payload structures for different types of outgoing messages to MetaBox. Contains data models for various command parameters.\n *\n * ### Practical Application\n * Payload type definitions for all outgoing command types. Defines required and optional fields per command.\n * Essential TypeScript reference for type-safe command construction.\n *\n * ### AI Coding Best Practices\n * Use as TypeScript type reference for proper typing when building dynamic command dispatchers.\n * Each key corresponds to a command name and its value defines the expected payload structure.\n */\nexport interface ToMetaboxMessagePayloads {\n [MetaboxModularConfiguratorActions.metaboxConfig]: {\n appId: string;\n config: MetaboxCommandConfig;\n };\n [MetaboxModularConfiguratorActions.setEnvironment]: { id: string };\n [MetaboxModularConfiguratorActions.setEnvironmentMaterialById]: {\n slotId: string;\n materialId: string;\n };\n [MetaboxModularConfiguratorActions.setComponent]: {\n id: string;\n typeId: string;\n };\n [MetaboxModularConfiguratorActions.setComponentMaterialById]: {\n componentId: string;\n slotId: string;\n materialId: string;\n };\n [MetaboxModularConfiguratorActions.getScreenshot]: {\n format: MimeType;\n size?: { x: number; y: number };\n };\n [MetaboxModularConfiguratorActions.getCallToActionInformation]: void;\n [MetaboxModularConfiguratorActions.getPdf]: void;\n [MetaboxModularConfiguratorActions.showEmbeddedMenu]: { visible: boolean };\n [MetaboxModularConfiguratorActions.showOverlayInterface]: {\n visible: boolean;\n };\n [MetaboxModularConfiguratorActions.forceSetDeviceType]: {\n deviceType: ApplicationDeviceTypes;\n };\n [MetaboxModularConfiguratorActions.getCamera]: void;\n [MetaboxModularConfiguratorActions.setCamera]: {\n camera: CameraCommandPayload;\n };\n [MetaboxModularConfiguratorActions.resetCamera]: void;\n [MetaboxModularConfiguratorActions.applyZoom]: { zoom: number };\n [MetaboxModularConfiguratorActions.initShowcase]: void;\n [MetaboxModularConfiguratorActions.playShowcase]: void;\n [MetaboxModularConfiguratorActions.pauseShowcase]: void;\n [MetaboxModularConfiguratorActions.stopShowcase]: void;\n [MetaboxModularConfiguratorActions.sendCommandToUnreal]: object;\n [MetaboxModularConfiguratorActions.showMeasurement]: void;\n [MetaboxModularConfiguratorActions.hideMeasurement]: void;\n}\n\n/**\n * Payload for the {@link SetCamera} command describing the desired camera state in the Unreal scene.\n * All fields are optional — only the provided values will be applied.\n *\n * ### What does it unlock?\n * Defines the payload structure for camera commands. Contains camera-related parameters passed to SetCamera command.\n *\n * ### Practical Application\n * Read-only interface defining camera parameters: fov (degrees), mode ('orbit'|'fps'), position ({x,y,z}),\n * rotation ({horizontal: yaw, vertical: pitch}), and restrictions (distance/FOV/rotation limits).\n * Both returned by getCameraResult event and accepted by SetCamera.\n *\n * ### AI Coding Best Practices\n * This interface is bidirectional — returned from GetCamera and accepted by SetCamera.\n * Capture a camera state via getCameraResult and replay it with SetCamera(payload).\n * Only include restriction fields you want to enforce; omitted values keep current settings.\n * In orbit mode, distance limits are relative to the orbit pivot.\n */\nexport interface CameraCommandPayload {\n /** Field of view angle in degrees. */\n fov?: number;\n /** Camera control mode: `'fps'` for first-person or `'orbit'` for orbital rotation around pivot. */\n mode?: 'fps' | 'orbit';\n /** Camera position in 3D world space. */\n position?: { x: number; y: number; z: number };\n /** Camera rotation angles in degrees. */\n rotation?: {\n horizontal: number;\n vertical: number;\n };\n /** Min/max constraints applied to camera movement, zoom, and rotation. */\n restrictions?: {\n maxDistanceToPivot?: number;\n maxFov?: number;\n maxHorizontalRotation?: number;\n maxVerticalRotation?: number;\n minDistanceToPivot?: number;\n minFov?: number;\n minHorizontalRotation?: number;\n minVerticalRotation?: number;\n };\n}\n\n/**\n * @internal\n * @hidden\n * Envelope wrapping an action and its payload for host-to-Metabox postMessage communication.\n *\n * ### What does it unlock?\n * Envelope structure for outgoing MetaBox messages. Encapsulates messages with protocol headers for transmission.\n *\n * ### Practical Application\n * Protocol envelope for outgoing messages — adds headers for transmission to MetaBox iframe.\n * Internal to the communication layer, handled automatically by the Communicator.\n *\n * ### AI Coding Best Practices\n * Do not construct manually. The Communicator handles all message wrapping. Only reference this interface\n * if debugging raw postMessage traffic in browser devtools to diagnose why commands aren't being received.\n */\nexport interface ToMetaBoxMessageEnvelope {\n action: ToMetaBoxActions;\n payload?: ToMetaboxMessagePayload | never;\n}\n\n/**\n * @internal\n * @hidden\n */\nexport type ToMetaboxTarget = 'metabox' | 'child';\n\n/**\n * @internal\n * @hidden\n * Top-level postMessage structure sent from the host to the Metabox iframe.\n *\n * ### What does it unlock?\n * Message interface for sending data to MetaBox. Wraps outgoing commands with necessary protocol information.\n *\n * ### Practical Application\n * Outgoing message format for commands to MetaBox. Wraps commands with protocol information for postMessage delivery.\n * Handled automatically by Communicator.sendCommandToMetabox() — never construct manually.\n *\n * ### AI Coding Best Practices\n * Do not construct ToMetaBoxMessage objects. Always use `api.sendCommandToMetabox(new CommandName(...))`.\n * The Communicator wraps your command in the correct message format automatically.\n */\nexport interface ToMetaBoxMessage {\n host: typeof MetaboxHost;\n envelope: ToMetaBoxMessageEnvelope;\n /**\n * @deprecated, use envelope instead of payload\n */\n payload: ToMetaBoxMessageEnvelope;\n target: ToMetaboxTarget;\n apiVersion: string;\n}\n","import { CommandBase } from './CommandBase';\nimport type { MetaboxCommandConfig } from '../interfaces';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to send Metabox Config to Metabox Modular Configurator.\n *\n * ### What does it unlock?\n * Configuration object passed to MetaBox during initialization. Specifies domain, host, standalone mode,\n * and other parameters that control how the configurator behaves.\n *\n * ### Practical Application\n * Internal configuration object auto-sent during initialization. Contains appId and config.\n * DO NOT call directly — integrateMetabox() handles this automatically as part of its setup sequence.\n *\n * ### AI Coding Best Practices\n * NEVER instantiate or send MetaboxConfig manually. It is auto-sent by integrateMetabox().\n * Use the IntegrateMetaboxConfig parameter of integrateMetabox() instead for setting domain, standalone,\n * loadingImage, introImage, state, etc.\n *\n * @internal\n * Automatically sent when the Communicator instance is ready.\n *\n * @param {string} appId - The unique identifier for the Communicator Instance\n * @param {MetaboxCommandConfig} config - optional initial config: standalone - if true - disable metabox custom template and all logic\n */\n\nexport class MetaboxConfig extends CommandBase {\n constructor(appId: string, config: MetaboxCommandConfig) {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.metaboxConfig,\n payload: { appId, config },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to get a PDF from Metabox Modular Configurator.\n * This class sends a message to the Metabox API to generate a PDF based on the current configuration.\n * **Important**: No need to listen to any events to see changes. Pdf will be downloaded automatically once it's ready.\n *\n * ### What does it unlock?\n * Generates a native MetaBox PDF document. No subscription required — it executes independently.\n *\n * ### Practical Application\n * Generates a branded PDF from the current configurator state server-side. No event subscription needed.\n * Use for B2B quote workflows, downloadable spec sheets, or emailing configured product summaries to prospects.\n *\n * ### AI Coding Best Practices\n * Simply call `api.sendCommandToMetabox(new GetPdf())`. No parameters or event subscription required.\n * The PDF generates inside MetaBox application.\n *\n * @example\n * import { GetPdf, Communicator } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * api.sendCommandToMetabox(new GetPdf());\n * };\n */\nexport class GetPdf extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxModularConfiguratorActions.getPdf };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to get a Call To Action Information from Metabox Modular Configurator.\n * This class sends a message to the Metabox API to generate Call To Action information based on the current\n * configuration and sends it to the endpoint URL from the CTA information.\n *\n * To listen for changes after sending this command, listen to the 'ecomConfiguratorDataUpdated' event.\n *\n * ### What does it unlock?\n * Retrieves information about call-to-action that were added to the configurator. Requires subscription to receive data.\n *\n * ### Practical Application\n * Triggers the CTA (Call-to-Action) workflow configured in MetaBox admin. The CTA label and callback URL are set in admin.\n * When invoked, MetaBox POSTs the full configuration JSON (including BOM) to your callback URL endpoint, which returns a { redirectUrl }.\n *\n * ### AI Coding Best Practices\n * Call only after user completes configuration. Subscribe to ecomConfiguratorDataUpdated to get CTA label/URL for building\n * custom CTA buttons in your UI. The POST payload includes the full bill of materials — your backend endpoint processes it\n * and returns a redirect URL.\n *\n * @example\n * import { Communicator, EcomConfigurator, GetCallToActionInformation } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n *\n * //Subscribe to the event before sending the command to ensure you capture the response\n * api.addEventListener('ecomConfiguratorDataUpdated', (data:EcomConfigurator) => {\n * console.log('Ecom configurator params:', data);\n * });\n *\n * // Send the command to get Call To Action information from Metabox Modular Configurator\n * api.sendCommandToMetabox(new GetCallToActionInformation());\n * };\n */\nexport class GetCallToActionInformation extends CommandBase {\n constructor() {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.getCallToActionInformation,\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to get the camera configuration from Unreal.\n * This class sends a message to the Metabox API to get the camera from a scene.\n * To listen for changes after sending this command, listen to the 'getCameraResult' event.\n *\n * ### What does it unlock?\n * Retrieves camera presets for the configurator; allowing extraction and application of saved camera positions.\n *\n * ### Practical Application\n * Requests current camera state — returns asynchronously via the getCameraResult event. Returns a CameraCommandPayload\n * with fov, mode, position, rotation, and restrictions. Use to save camera positions, create shareable view links,\n * or build 'save this angle' features.\n *\n * ### AI Coding Best Practices\n * ALWAYS subscribe to getCameraResult BEFORE calling GetCamera(). Pattern: `api.addEventListener('getCameraResult', handler);`\n * then `api.sendCommandToMetabox(new GetCamera())`. The returned CameraCommandPayload can be fed directly back into\n * SetCamera to restore the view.\n *\n * @example\n * import { Communicator, CameraCommandPayload, GetCamera } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n *\n * //Subscribe to the event before sending the command to ensure you capture the response\n * api.addEventListener('getCameraResult', (data:CameraCommandPayload) => {\n * console.log('Camera params after get camera command:', data);\n * });\n *\n * api.sendCommandToMetabox(new GetCamera());\n * };\n */\nexport class GetCamera extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxModularConfiguratorActions.getCamera };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport type { CameraCommandPayload } from '../interfaces';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to set the camera configuration.\n * This class sends a message to the Metabox API to set the camera on a scene.\n * **Important**: No need to listen to any events to see changes.\n *\n * ### What does it unlock?\n * Sets camera presets with restriction parameters (FOV, rotation, position).\n *\n * ### Practical Application\n * Sets camera with precise control: fov (degrees), mode ('orbit'|'fps'), position ({x,y,z}),\n * rotation ({horizontal,vertical}), and restrictions (min/max distance, FOV, rotation bounds).\n * Use for guided tours, preset view buttons, or restricting camera to prevent users seeing behind the product.\n *\n * ### AI Coding Best Practices\n * Only include fields you want to change — omitted values keep current settings. Use orbit mode for typical product viewing,\n * fps for walkthrough/room scenes. Apply restrictions to prevent bad angles. Full interface:\n * `{fov?, mode?, position?, rotation?, restrictions?}`.\n *\n * @example\n * import { SetCamera, Communicator } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * api.sendCommandToMetabox(new SetCamera({\n * fov: 45,\n * mode: 'orbit',\n * position: { x: 100, y: 100, z: 100 },\n * rotation: { horizontal: 0, vertical: 0 },\n * restrictions: {\n * maxDistanceToPivot: 0,\n * maxFov: 0,\n * maxHorizontalRotation: 0,\n * maxVerticalRotation: 0,\n * minDistanceToPivot: 0,\n * minFov: 0,\n * minHorizontalRotation: 0,\n * minVerticalRotation: 0,\n * },\n * }));\n * };\n *\n * @param {CameraCommandPayload} camera - The camera configuration.\n */\nexport class SetCamera extends CommandBase {\n constructor(camera: CameraCommandPayload) {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.setCamera,\n payload: { camera },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to reset the camera to its initial position.\n * This class sends a message to the Metabox API to reset the camera on a scene.\n *\n * ### What does it unlock?\n * Resets the camera to its default state and position. Used to return camera to initial configuration after user manipulation.\n *\n * ### Practical Application\n * Resets camera to the default position defined in the component/environment template. Essential for 'Reset View' buttons.\n * Also, useful after programmatic camera moves to return to a known starting state.\n *\n * ### AI Coding Best Practices\n * Call `api.sendCommandToMetabox(new ResetCamera())`. No parameters. Restores template defaults — not the last user position.\n * Good practice to call after SetComponent changes that may shift the focal point of the assembly.\n *\n * @example\n * import { ResetCamera, Communicator } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * api.sendCommandToMetabox(new ResetCamera());\n * };\n */\n\nexport class ResetCamera extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxModularConfiguratorActions.resetCamera };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to apply zoom and change the camera zoom on a scene.\n * This class sends a command to the Metabox API to change zoom on a scene.\n *\n * ### What does it unlock?\n * Controls zoom functionality for the configurator; allowing users to adjust the zoom level of 3D objects and camera presets.\n *\n * ### Practical Application\n * Implements programmatic zoom on the pixel-streamed viewport. Use to build zoom slider controls, pinch-to-zoom on mobile,\n * or 'zoom to detail' buttons. Takes a numeric delta: positive zooms in, negative zooms out\n * (e.g., ApplyZoom(50) zooms in, ApplyZoom(-50) zooms out).\n *\n * ### AI Coding Best Practices\n * Always use numeric delta values, not absolute zoom levels. Pair with a UI slider that sends incremental values.\n * Debounce zoom input to ~100ms intervals to prevent overwhelming the Unreal stream.\n * Pattern: `api.sendCommandToMetabox(new ApplyZoom(50))`.\n *\n * @example\n * import { ApplyZoom, Communicator } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * api.sendCommandToMetabox(new ApplyZoom(50));\n * };\n *\n * @param {number} zoom - The zoom value to apply.\n */\n\nexport class ApplyZoom extends CommandBase {\n constructor(zoom: number) {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.applyZoom,\n payload: { zoom },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to initialize Showcase for a component scene and start a sequence for the component.\n * This class sends a command to the Metabox API to initialize showcase if the component has a sequence.\n * To check this, find the showcase property in the current component and listen to the 'configuratorDataUpdated' event.\n * If this property exists, you can send the init showcase command.\n *\n * To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event.\n *\n * ### What does it unlock?\n * Initializes and displays the showcase/demo view for the configurator. Used when transitioning into presentation or demo mode.\n *\n * ### Practical Application\n * Loads the showcase/animation sequence attached to the current component. Must be called BEFORE PlayShowcase.\n * Use to initialize auto-playing product demos, trade show presentations, or hero section animations on landing pages.\n *\n * ### AI Coding Best Practices\n * ALWAYS call InitShowcase() before PlayShowcase(). Required sequence: InitShowcase → PlayShowcase → PauseShowcase/StopShowcase.\n * Subscribe to showcaseStatusChanged to track playback state ('playing'/'paused'/'stopped').\n *\n * @example\n * import { Communicator, ShowCaseStatus, InitShowcase } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * //Subscribe to the event before sending the command to ensure you capture the response\n * api.addEventListener('showcaseStatusChanged', (data:ShowCaseStatus) => {\n * console.log('Showcase status value after changed:', data);\n * });\n *\n * api.sendCommandToMetabox(new InitShowcase());\n * };\n */\n\nexport class InitShowcase extends CommandBase {\n constructor() {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.initShowcase,\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to play Showcase for a component when it is already initialized and paused.\n * This class sends a command to the Metabox API to play showcase for a component if it is already initialized and paused.\n *\n * To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event.\n *\n * ### What does it unlock?\n * Starts or resumes the showcase/timeline playback. Executes the internal MetaBox play command internally.\n *\n * ### Practical Application\n * Starts or resumes showcase playback. Use for 'Play Demo' buttons on landing pages, auto-play on page load,\n * or resuming demos after inactivity timeout on kiosk displays.\n *\n * ### AI Coding Best Practices\n * Call `api.sendCommandToMetabox(new PlayShowcase())`. Must call InitShowcase() first or it won't play.\n * Subscribe to showcaseStatusChanged to track state. Auto-play pattern: wait for viewportReady → InitShowcase →\n * PlayShowcase.\n *\n * @example\n * import { Communicator, PlayShowcase } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * //Subscribe to the event before sending the command to ensure you capture the response\n * api.addEventListener('showcaseStatusChanged', (data) => {\n * console.log('Showcase status value after changed:', data);\n * });\n *\n * api.sendCommandToMetabox(new PlayShowcase());\n * };\n */\n\nexport class PlayShowcase extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxModularConfiguratorActions.playShowcase };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * @internal\n * @hidden\n * Represents a command to send Unreal command.\n */\n\nexport class UnrealCommand extends CommandBase {\n constructor(payload: object) {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.sendCommandToUnreal,\n payload,\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to pause Showcase for a component when it is already initialized and playing.\n * This class sends a command to the Metabox API to pause showcase for a component if it is already initialized and playing.\n *\n * To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event.\n *\n * ### What does it unlock?\n * Pauses the showcase/timeline playback. Can be called independently without requiring any flag parameters.\n *\n * ### Practical Application\n * Pauses showcase animation playback. The showcase remains initialized and can be resumed with\n * PlayShowcase. Use when you need to temporarily freeze the animation (e.g., on a \"Pause\" button click).\n *\n * ### AI Coding Best Practices\n * Call `api.sendCommandToMetabox(new PauseShowcase())`. No parameters. Subscribe to showcaseStatusChanged\n * to confirm 'pause' state. Use PlayShowcase to resume or StopShowcase to reset.\n *\n * @example\n * import { Communicator, ShowCaseStatus, PauseShowcase } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n *\n * //Subscribe to the event before sending the command to ensure you capture the response\n * api.addEventListener('showcaseStatusChanged', (data:ShowCaseStatus) => {\n * console.log('Showcase status value after changed:', data);\n * });\n *\n * api.sendCommandToMetabox(new PauseShowcase());\n * };\n */\n\nexport class PauseShowcase extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxModularConfiguratorActions.pauseShowcase };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to stop Showcase for a component when it is already initialized, and you want to destroy it.\n * This class sends a command to the Metabox API to stop showcase for a component if it is already initialized.\n *\n * To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event.\n *\n * ### What does it unlock?\n * Stops the showcase/timeline playback and closes the showcase mode. Returns to normal configurator view.\n *\n * ### Practical Application\n * Stops showcase playback and exits showcase mode entirely. Returns to normal interactive configurator view.\n * Use for 'Exit Demo' buttons or auto-trigger when the user starts actively configuring the product.\n *\n * ### AI Coding Best Practices\n * Call `api.sendCommandToMetabox(new StopShowcase())`. Fully resets the showcase state. Subscribe to\n * showcaseStatusChanged to confirm 'stopped' status. After stopping, the configurator returns to full\n * interactive mode — re-enable configuration controls.\n *\n * @example\n * import { Communicator, ShowCaseStatus } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n *\n * //Subscribe to the event before sending the command to ensure you capture the response\n * api.addEventListener('showcaseStatusChanged', (data:ShowCaseStatus) => {\n * console.log('Showcase status value after changed:', data);\n * });\n *\n * api.sendCommandToMetabox(new StopShowcase());\n * };\n */\n\nexport class StopShowcase extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxModularConfiguratorActions.stopShowcase };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Image format.\n * This type represents the allowed image formats.\n *\n * ### What does it unlock?\n * Type alias for MIME types used in file/media handling. Defines supported file formats and media types.\n *\n * ### Practical Application\n * Type alias: 'image/png' | 'image/jpeg' | 'image/webp'. Used as the format parameter in GetScreenshot.\n * PNG for quality/transparency, JPEG for smaller files, WebP for modern browser optimization.\n *\n * ### AI Coding Best Practices\n * Pass as first param to GetScreenshot: `new GetScreenshot('image/png', {x:2048, y:2048})`.\n * Use PNG for highest quality and transparency. JPEG for smaller file size. WebP for modern browser optimization.\n * Match the saveImage filename extension to the format.\n */\nexport type MimeType = 'image/png' | 'image/jpeg' | 'image/webp';\n\n/**\n * Represents a command to get a screenshot.\n *\n * To listen for changes after sending this command, listen to the 'screenshot' event before command is sent.\n *\n * ### What does it unlock?\n * Takes a screenshot on the server side (Unreal Engine) of the 3D scene. Returns high-quality image.\n * Requires subscription to the screenshotReady event to receive the rendered image.\n *\n * ### Practical Application\n * Renders a high-res screenshot on the Unreal Engine server. Takes format ('image/png'|'image/jpeg'|'image/webp')\n * and optional size ({x, y}). Returns base64 data via screenshotReady event. Use for thumbnails, social sharing,\n * saving config snapshots, or attaching images to quotes.\n *\n * ### AI Coding Best Practices\n * Subscribe to screenshotReady BEFORE sending GetScreenshot. Pattern:\n * `api.addEventListener('screenshotReady', (data) => { if(data) saveImage(data, 'name.png'); })`.\n * Specify size for consistent outputs: `new GetScreenshot('image/png', {x:2048, y:2048})`.\n * Use saveImage() helper to convert base64 to downloadable file.\n *\n * @example\n * import { Communicator, saveImage, GetScreenshot } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n *\n * //Subscribe to the event before sending the command to ensure you capture the response\n * api.addEventListener('screenshot', (data:string) => {\n * // The data is a base64 string of the image. You can use it to display the image or save it as a file.\n * console.log('Get screenshot here:', data);\n * saveImage(data, 'Render.png');\n * });\n *\n * api.sendCommandToMetabox(new GetScreenshot('image/png', { x: 1024, y: 1024 }));\n * };\n *\n * @param {MimeType} mimeType - The output format.\n * @param {{ x: number; y: number }} [size] - Optional size in pixels.\n */\nexport class GetScreenshot extends CommandBase {\n constructor(mimeType: MimeType, size?: { x: number; y: number }) {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.getScreenshot,\n payload: { format: mimeType, size },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to set a component by its data (ID, typeId).\n * This action sends a message to the Metabox API to set a component using the provided data.\n * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.\n *\n * ### What does it unlock?\n * Sets a component during initialization, which triggers the reconstruction of the component tree structure.\n * Simulates clicking a component in the menu.\n *\n * ### Practical Application\n * Selects a component in the modular assembly. Takes componentId (UUID), typeId (category string).\n * CRITICAL: Always set root component (isRoot:true) FIRST — nothing renders without it. Then add children (isRoot:false).\n * Simulates clicking a component in the menu.\n *\n * ### AI Coding Best Practices\n * ALWAYS set root first: `new SetComponent('id', 'type', true)`. Then children: `new SetComponent('childId', 'childType', false)`.\n * Get valid IDs from configuratorDataUpdated event data — the configurator definition contains all available components and types.\n * Wrong order = blank viewport. The typeId must match componentType values from the configurator.\n *\n * @example\n * import { Communicator, ModularConfiguratorEnvelope, SetComponent } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n *\n * //Subscribe to the event before sending the command to ensure you capture the response\n * api.addEventListener('configuratorDataUpdated', (data:ModularConfiguratorEnvelope) => {\n * console.log('State updated after applied new component:', data);\n * });\n *\n * api.sendCommandToMetabox(new SetComponent(\n * 'ffea6b5c-3a8a-4f56-9417-e605acb5cca3', 'typeId'\n * ));\n * };\n *\n * @param {string} id - The component ID.\n * @param {string} typeId - The component type ID.\n */\nexport class SetComponent extends CommandBase {\n constructor(id: string, typeId: string) {\n super();\n this.data = {\n payload: { id, typeId },\n action: MetaboxModularConfiguratorActions.setComponent,\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to set component material by its slot ID and Material ID.\n * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.\n *\n * ### What does it unlock?\n * Sets a material variant for a component. Simulates selecting a different material from the menu for a specific component.\n *\n * ### Practical Application\n * Applies a material to a specific slot on a component. Takes componentId (UUID), slotId (string), and materialId (UUID).\n * Use to build swatch pickers, apply preset themes/bundles, or sync material selections from an external\n * PIM/ERP system via externalId mapping.\n *\n * ### AI Coding Best Practices\n * Get valid slotId and materialId values from the configuratorDataUpdated envelope —\n * check component slot definitions and material lists. Pattern:\n * `new SetComponentMaterial('component-uuid', 'slot-name', 'material-uuid')`. The referenced component must already be set in the tree.\n *\n * @example\n * import { Communicator, ModularConfiguratorEnvelope, SetComponentMaterial } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n *\n * //Subscribe to the event before sending the command to ensure you capture the response\n * api.addEventListener('configuratorDataUpdated', (data:ModularConfiguratorEnvelope) => {\n * console.log('State updated after applied new material:', data);\n * });\n *\n * api.sendCommandToMetabox(new SetComponentMaterial(\n * 'ffea6b5c-3a8a-4f56-9417-e605acb5cca3',\n * 'carpaint',\n * 'dd829d6e-9200-47a7-8d5b-af5df89b7e91',\n * ));\n * };\n *\n * @param {string} componentId - The component ID.\n * @param {string} slotId - The slot ID.\n * @param {string} materialId - The material ID.\n */\nexport class SetComponentMaterial extends CommandBase {\n constructor(componentId: string, slotId: string, materialId: string) {\n super();\n this.data = {\n payload: { componentId, slotId, materialId },\n action: MetaboxModularConfiguratorActions.setComponentMaterialById,\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to set the environment by its ID.\n * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.\n *\n * ### What does it unlock?\n * Sets environmental/lighting settings for the scene. Controls factors like lighting conditions and environmental appearance.\n *\n * ### Practical Application\n * Changes the 3D scene/environment (studio, showroom, outdoor, etc.). Takes an environmentId UUID.\n * Environments include lighting, backdrop, and optionally dynamic sky (udsEnabled) with time-of-day (udsHour) control.\n *\n * ### AI Coding Best Practices\n * Call `api.sendCommandToMetabox(new SetEnvironment('env-uuid'))`. Get valid environment IDs from the configurator\n * definition in configuratorDataUpdated. Set environment after root component during initialization. Each environment has\n * its own material slots, thumbnails, and lighting properties.\n *\n * @example\n * import { Communicator, ModularConfiguratorEnvelope } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n *\n * //Subscribe to the event before sending the command to ensure you capture the response\n * api.addEventListener('configuratorDataUpdated', (data:ModularConfiguratorEnvelope) => {\n * console.log('State updated after applied new environment:', data);\n * });\n *\n * api.sendCommandToMetabox(new SetEnvironment('55555555-1234-1234-1234-01234567890'))\n * };\n *\n * @param {string} environmentId - The environment ID.\n */\nexport class SetEnvironment extends CommandBase {\n constructor(environmentId: string) {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.setEnvironment,\n payload: { id: environmentId },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to set an environment material by its slot ID and Material ID.\n * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.\n *\n * ### What does it unlock?\n * Sets environmental material properties such as textures and appearance attributes for the scene environment.\n *\n * ### Practical Application\n * Applies materials to environment slots (floor, walls, backdrop textures). Takes slotId and materialId.\n * Use for scene-based configurators where the environment is also customizable — kitchen visualizers,\n * room planners, trade show booth designers.\n *\n * ### AI Coding Best Practices\n * Pattern: `new SetEnvironmentMaterial('floor-slot-id', 'material-uuid')`. Get valid slot and material IDs from\n * the environment definition's slots array in configuratorDataUpdated. Only useful when the active environment\n * has configurable material slots.\n *\n * @example\n * import { Communicator, ModularConfiguratorEnvelope } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n *\n * //Subscribe to the event before sending the command to ensure you capture the response\n * api.addEventListener('configuratorDataUpdated', (data:ModularConfiguratorEnvelope) => {\n * console.log('State updated after applied new environment material:', data);\n * });\n *\n * api.sendCommandToMetabox(new SetEnvironmentMaterial(\n * 'carpaint',\n * 'dd829d6e-9200-47a7-8d5b-af5df89b7e91',\n * ));\n * };\n *\n * @param {string} slotId - The slot ID.\n * @param {string} materialId - The material ID.\n */\n\nexport class SetEnvironmentMaterial extends CommandBase {\n constructor(slotId: string, materialId: string) {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.setEnvironmentMaterialById,\n payload: { slotId, materialId },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to toggle the embedded Metabox menu.\n * This command can only be used when using the metabox menu.\n *\n * ### What does it unlock?\n * Shows the embedded menu interface. Only works when using the MetaBox native menu (not in standalone/custom menu\n * mode).\n *\n * ### Practical Application\n * Toggles the native MetaBox right sidebar menu. Takes a boolean parameter. Pass false to hide when building custom UI.\n * In standalone mode, the menu is already hidden — this is only relevant in default (non-standalone) mode.\n *\n * ### AI Coding Best Practices\n * In standalone mode (`{standalone:true}`), this is unnecessary (menu already hidden). In default mode,\n * call `new ShowEmbeddedMenu(false)` early in initialization to hide built-in UI before rendering custom controls.\n * Pattern for custom UI: `ShowEmbeddedMenu(false)` + `ShowOverlayInterface(false)`.\n *\n * @example\n * import { ShowEmbeddedMenu, Communicator } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * api.sendCommandToMetabox(new ShowEmbeddedMenu(true));\n * };\n *\n * @param {boolean} visible - A flag indicating whether the embedded menu should be visible.\n */\n\nexport class ShowEmbeddedMenu extends CommandBase {\n constructor(visible: boolean) {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.showEmbeddedMenu,\n payload: { visible },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to toggle the Unreal Overlay Interface Menu.\n * This action sends a message to the Metabox API to toggle the visibility of the Unreal overlay UI.\n *\n * ### What does it unlock?\n * Shows the overlay interface elements. Displays UI controls and buttons overlaid on the 3D scene.\n *\n * ### Practical Application\n * Toggles viewport overlay controls (buttons overlaid on the 3D scene). Takes a boolean.\n * Use `ShowOverlayInterface(false)` alongside `ShowEmbeddedMenu(false)` when building fully custom UI\n * that replaces all native MetaBox controls.\n *\n * ### AI Coding Best Practices\n * In standalone mode, overlays are already hidden. In default mode, call `new ShowOverlayInterface(false)`\n * early in initialization to prevent flash of native UI. Always pair with `ShowEmbeddedMenu(false)` for clean custom UI.\n * Pass true to restore if entering a mode that uses native controls.\n *\n * @example\n * import { ShowOverlayInterface, Communicator } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * api.sendCommandToMetabox(new ShowOverlayInterface(true));\n * };\n *\n * @param {boolean} visible - A flag indicating whether the Unreal overlay UI should be visible.\n */\n\nexport class ShowOverlayInterface extends CommandBase {\n constructor(visible: boolean) {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.showOverlayInterface,\n payload: { visible },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to show measurement for a product when it is already loaded.\n * This class sends a command to the Metabox API to show measurement for a product if it is already initialized.\n *\n * ### What does it unlock?\n * Shows the measurement overlay. Works as a toggle with HideMeasurement to control visibility.\n *\n * ### Practical Application\n * Shows the measurement/dimension overlay tools on the 3D viewport. Use for B2B or technical applications\n * where buyers need to verify product dimensions, check fit specifications, or confirm measurements during procurement.\n *\n * ### AI Coding Best Practices\n * Call `api.sendCommandToMetabox(new ShowMeasurement())`. No parameters. Pair with HideMeasurement for toggle behavior.\n * Track visibility state in your app to keep toggle buttons in sync.\n *\n * @example\n * import { ShowMeasurement, Communicator } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * api.sendCommandToMetabox(new ShowMeasurement());\n * };\n */\n\nexport class ShowMeasurement extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxModularConfiguratorActions.showMeasurement };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to hide measurement for a product when it is already loaded.\n * This class sends a command to the Metabox API to hide measurement for a product if it is already initialized.\n *\n * ### What does it unlock?\n * Hides the measurement overlay. Executes unconditionally to hide the UI controls.\n *\n * ### Practical Application\n * Hides the measurement/dimension overlay. Use when transitioning from a technical spec view back to a clean\n * product presentation, or to keep consumer-facing configurators visually clean.\n *\n * ### AI Coding Best Practices\n * Call `api.sendCommandToMetabox(new HideMeasurement())`. No parameters. Pair with ShowMeasurement as a toggle.\n * Track visibility state in your app state to keep toggle buttons in sync.\n *\n * @example\n * import { HideMeasurement, Communicator } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * api.sendCommandToMetabox(new HideMeasurement());\n * };\n */\n\nexport class HideMeasurement extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxModularConfiguratorActions.hideMeasurement };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport type { ApplicationDeviceTypes } from '../interfaces';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to force set the device type.\n * This class sends a message to the Metabox API to force set the device type.\n *\n * ### What does it unlock?\n * Forces the specification of device type (desktop or mobile) for the MetaBox configurator. Possibly deprecated.\n *\n * ### Practical Application\n * Forces device type override (desktop/tablet/mobile). Likely deprecated — MetaBox auto-detects via ApplicationDeviceTypes.\n * Only relevant for kiosk or showroom setups where you need to force a specific rendering mode.\n *\n * ### AI Coding Best Practices\n * Avoid unless you have a confirmed kiosk/showroom use case. If needed, set it once during initialization only.\n * Prefer letting MetaBox handle device detection automatically.\n *\n * @example\n * import { ForceSetDeviceType, Communicator } from '@3dsource/metabox-modular-configurator-api';\n *\n * window.env3DSource.apiReady = (api: Communicator) => {\n * api.sendCommandToMetabox(new ForceSetDeviceType('desktop'));\n * };\n *\n * @param {ApplicationDeviceTypes} deviceType - The device type to force set.\n */\nexport class ForceSetDeviceType extends CommandBase {\n constructor(deviceType: ApplicationDeviceTypes) {\n super();\n this.data = {\n payload: { deviceType },\n action: MetaboxModularConfiguratorActions.forceSetDeviceType,\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to resume the pixel streaming session.\n * This class sends a message to the Metabox API to resume a paused or disconnected stream.\n *\n * ### What does it unlock?\n * Resumes the Unreal Engine pixel streaming connection after it has been paused, disconnected, or stopped due to inactivity (AFK timeout).\n *\n * ### Practical Application\n * Used to reconnect the 3D streaming session without a full page reload. Essential for 'Reconnect' or 'Resume' buttons\n * shown when the stream is interrupted, e.g., after an idle timeout or network disruption.\n *\n * ### AI Coding Best Practices\n * Call `api.sendCommandToMetabox(new ResumeStream())`. No parameters. Resumes the existing streaming session —\n * does not reinitialize the configurator or reset component/environment state.\n *\n * @example\n * import { ResumeStream, Communicator } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * api.sendCommandToMetabox(new ResumeStream());\n * };\n */\n\nexport class ResumeStream extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxModularConfiguratorActions.resumeStream };\n }\n}\n","/**\n * Represents a callback listener for specific message types.\n * Used internally by EventDispatcher to store event listeners.\n *\n * ### What does it unlock?\n * Event listener interface. Allows subscription to specific events from the configurator to receive real-time data updates.\n *\n * ### Practical Application\n * Event listener interface. addEventListener() and removeEventListener() on Communicator. Subscribe to real-time\n * configurator events: state changes, viewport readiness, screenshots, showcase status, camera results, resolution changes.\n *\n * ### AI Coding Best Practices\n * Set up listeners BEFORE sending commands that trigger them. Always clean up with removeEventListener on component unmount.\n * Key events: configuratorDataUpdated (every state change), viewportReady (init complete), screenshotReady (captures),\n * getCameraResult (camera queries), showcaseStatusChanged (demo playback).\n *\n * @public\n */\nexport interface Listener {\n /** The message type this listener is registered for */\n messageType: string;\n /** The callback function to execute when a message of the specified type is received */\n callback: (data: unknown) => void;\n}\n\n/**\n * EventDispatcher is a class that manages event listeners and dispatches events to them.\n *\n * ### What does it unlock?\n * Parent class of Communicator that dispatches commands. Acts as an event dispatcher that routes command messages internally.\n *\n * ### Practical Application\n * Internal event routing layer — parent class of Communicator. Routes postMessage commands between your app\n * and the Unreal Engine pixel stream. Not used directly but understanding it helps debug message delivery issues.\n *\n * ### AI Coding Best Practices\n * Do not reference or extend EventDispatcher in application code. Use only the Communicator interface methods.\n * If debugging communication failures, check browser console for postMessage errors related to this layer.\n */\nexport class EventDispatcher {\n /**\n * Storage for callback listeners by message type.\n */\n listeners: Listener[] = [];\n\n /**\n * Removes all registered listeners. Subclasses override this to perform additional cleanup.\n * @param key - Instance key (used by subclass overrides for registry cleanup).\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n destroy(key: string) {\n this.listeners = [];\n }\n\n /**\n * Adds an event listener for receiving specific types of messages.\n *\n * @param {string} messageType - The message type to listen for.\n * @param callback - The callback function to execute when a message is received.\n */\n addEventListener(\n messageType: string,\n callback: (data: unknown) => void,\n ): this {\n this.listeners.push({ messageType, callback });\n return this;\n }\n\n /**\n * Dispatches an event to all listeners of a specific message type.\n *\n * @param {string} messageType - The message type.\n * @param data - The data associated with the event.\n */\n dispatchEvent(messageType: string, data: unknown): this {\n this.listeners\n .filter((listener) => listener.messageType === messageType)\n .forEach((listener) => listener.callback(data));\n return this;\n }\n\n /**\n * Removes an event listener for a specific type of message.\n *\n * @param {string} messageType - The message type.\n * @param callback - The callback function to remove.\n */\n removeEventListener(\n messageType: string,\n callback: (data: unknown) => void,\n ): this {\n this.listeners = this.listeners.filter(\n (listener) =>\n !(\n listener.messageType === messageType && listener.callback === callback\n ),\n );\n return this;\n }\n}\n","/**\n * @internal\n * @hidden\n * Core constants used for host-to-iframe communication and URL construction.\n */\n\n/**\n * Storage key for the Metabox Communicator instance registry.\n *\n * ### What does it unlock?\n * Constant string identifier for MetaBox version. Used internally to reference the MetaBox system and versioning.\n *\n * ### Practical Application\n * Internal system reference for versioning.\n * Not needed in front-end application code.\n *\n * ### AI Coding Best Practices\n * Skip in application code. This constant is for internal MetaBox system identification only.\n *\n * @internal\n */\nexport const Metabox = 'metabox';\n\n/**\n * Identifier used as the `host` field in postMessage envelopes sent to the iframe.\n *\n * ### What does it unlock?\n * Constant for the MetaBox host connection point. Specifies endpoint for MetaBox connections.\n *\n * ### Practical Application\n * MetaBox endpoint constant. The host the configurator iframe connects to for Unreal Engine pixel streaming.\n * Not needed in front-end application code.\n *\n * ### AI Coding Best Practices\n * Skip in application code. This constant is for internal MetaBox system identification only.\n *\n * @internal\n */\nexport const MetaboxHost = 'metaboxHost';\n\n/**\n * Action string dispatched by the iframe when the configurator app has loaded.\n *\n * ### What does it unlock?\n * App initialization flag variable. Signals when MetaBox has completed loading.\n *\n * ### Practical Application\n * Use the viewportReady event (more reliable) to gate your UI rendering — don't show controls until MetaBox confirms it's ready.\n *\n * ### AI Coding Best Practices\n * Prefer the viewportReady event over this variable: `api.addEventListener('viewportReady', (ready) => { if(ready) enableUI(); })`.\n * viewportReady is the reliable signal that MetaBox is ready to accept commands.\n *\n * @internal\n */\nexport const AppLoaded = 'appLoaded';\n\n/**\n * Default MetaBox domain for production environments.\n *\n * ### What does it unlock?\n * Constant for the standard default MetaBox domain. Used as the primary domain for connecting to MetaBox server.\n *\n * ### Practical Application\n * Default MetaBox domain constant (HTTPS). The base domain used when no override is specified.\n * Override only via IntegrateMetaboxConfig.domain if connecting to a custom or self-hosted MetaBox instance.\n *\n * ### AI Coding Best Practices\n * Let integrateMetabox() use the default. Override only if needed:\n * `integrateMetabox(id, container, callback, { domain: 'https://custom.domain.com' })`. HTTPS is mandatory.\n *\n * @internal\n */\n\n/**\n * @deprecated\n */\nexport const Metabox_V3 = 'metabox_v3';\n/**\n * @deprecated\n */\nexport const MetaboxHost_V3 = 'metaboxHost_v3';\n/**\n * @deprecated\n */\nexport const AppLoaded_V3 = 'appLoaded_v3';\n\nexport const MetaboxDomain = 'metabox.3dsource.com';\n\n/**\n * Base route URL segment for the Modular Configurator.\n *\n * ### What does it unlock?\n * Base route URL constant used for loading the configurator. Standard path endpoint for accessing the modular configurator.\n *\n * ### Practical Application\n * The modular configurator URL format is: `https://{domain}/metabox-configurator/modular/{configuratorId}`.\n * Automatically constructed by integrateMetabox().\n *\n * ### AI Coding Best Practices\n * Let integrateMetabox() handle URL construction. Only reference if building URLs manually\n * (e.g., QR codes, email links, server-side rendering). The modular path is `/modular/{id}`.\n *\n * @internal\n */\nexport const BasicRouteUrl = 'metabox-configurator/modular';\n","export const VERSION = '3.0.19-dev.12';\n","import { EventDispatcher } from './event-dispatcher';\nimport type { CommandBase } from '../actions';\nimport { MetaboxConfig } from '../actions';\nimport type {\n FromMetaBoxApiEvents,\n FromMetaBoxMessage,\n FromMetaboxMessagePayloads,\n MCAppLoaded,\n MetaboxCommandConfig,\n MetaboxEnvironment,\n ToMetaBoxMessage,\n} from '../interfaces';\nimport { AppLoaded, Metabox, MetaboxHost, VERSION } from '../constants';\n\nconst communicatorMap = new Map<string, { instance: Communicator }>();\n\n/**\n * Handles messaging between the host page and embedded Metabox content.\n *\n * ### What does it unlock?\n * Internal class that creates a proxy/communication layer between the API and MetaBox.\n * Handles reading and sending commands through the established connection.\n *\n * ### Practical Application\n * The API handle returned in the integrateMetabox callback. Provides sendCommandToMetabox() to send commands,\n * and addEventListener()/removeEventListener() for event subscriptions. This is your entire interface to\n * the MetaBox Unreal Engine stream.\n *\n * ### AI Coding Best Practices\n * Store the Communicator reference from the apiReadyCallback in a module-scoped variable or state store.\n * NEVER send commands before this callback fires. All commands and event listeners go through this single\n * api object. Clean up listeners with removeEventListener on component unmount.\n *\n * @internal Use {@link Communicator.createInstance} or the {@link integrateMetabox} helper to instantiate.\n */\nexport class Communicator extends EventDispatcher {\n /**\n * Bound handler for incoming postMessage events.\n */\n private binder = this.handleMessageReceived.bind(this);\n\n /**\n * Constructs a Communicator, replacing any existing instance, and begins listening for messages.\n * @internal\n */\n constructor(\n data: MCAppLoaded['payload'],\n environment: MetaboxEnvironment,\n config?: Partial<MetaboxCommandConfig>,\n ) {\n super();\n const { appId = 'unknown', version = VERSION } = data ?? {};\n const key = `${version}_${environment}_${appId}`;\n communicatorMap.get(key)?.instance.destroy(key);\n communicatorMap.set(key, { instance: this });\n window.addEventListener('message', this.binder);\n this.sendCommandToMetabox(\n new MetaboxConfig(appId, {\n ...config,\n hostUrl: location.href,\n apiVersion: VERSION,\n }),\n );\n }\n\n /**\n * Listens for Metabox to signal readiness, then initializes communicator.\n * @param apiReadyCallback - Called with the new Communicator once the Metabox is loaded.\n * @param {MetaboxEnvironment} environment - The environment in which the Communicator is running.\n * @param {MetaboxCommandConfig} config - optional initial config: standalone - if true - disable metabox custom template and all logic\n */\n static createInstance(\n apiReadyCallback: (api: Communicator) => void,\n environment: MetaboxEnvironment,\n config?: Partial<MetaboxCommandConfig>,\n ) {\n const startHandler = (event: MessageEvent) => {\n const message = event.data as FromMetaBoxMessage;\n if (message?.envelope?.action === AppLoaded && message.host === Metabox) {\n apiReadyCallback(\n new Communicator(message.envelope.payload, environment, config),\n );\n window.removeEventListener('message', startHandler);\n }\n };\n\n window.addEventListener('message', startHandler);\n }\n\n /**\n * Cleans up resources and stops listening for messages.\n */\n public override destroy(key: string) {\n super.destroy(key);\n window.removeEventListener('message', this.binder);\n }\n\n /** Destroys all active Communicator instances and clears the internal registry. */\n static clearAll() {\n if (communicatorMap.size === 0) {\n return;\n }\n\n communicatorMap.forEach((value, key) => value.instance.destroy(key));\n communicatorMap.clear();\n }\n\n /**\n * Retrieves a registered Communicator instance by its key.\n * @param key - The composite key (`version_environment_appId`) identifying the instance.\n */\n static getCommunicator(key: string) {\n return communicatorMap.get(key);\n }\n\n /**\n * Posts a command to the Metabox iframe.\n * @param command - An action command containing data to send.\n */\n public sendCommandToMetabox<T extends CommandBase>(command: T) {\n const { data } = command;\n const iframe = document.getElementById(\n 'embeddedContent',\n ) as HTMLIFrameElement;\n\n const toMetaboxMessage = {\n host: MetaboxHost,\n envelope: { ...data },\n payload: { ...data },\n target: iframe?.contentWindow ? 'child' : 'metabox',\n apiVersion: VERSION,\n } satisfies ToMetaBoxMessage;\n\n if (!iframe?.contentWindow) {\n console.warn(\n 'Metabox IFrame not found or not ready. Message sends to the same window',\n );\n window.postMessage(toMetaboxMessage, '*');\n return;\n }\n\n iframe.contentWindow.postMessage(toMetaboxMessage, '*');\n }\n\n /**\n * Registers an event listener for messages dispatched by the Metabox.\n * @param messageType - The event name to listen for (e.g. `'configuratorDataUpdated'`).\n * @param callback - Handler invoked with the typed payload when the event fires.\n * @override\n */\n override addEventListener<T extends FromMetaBoxApiEvents>(\n messageType: T,\n callback: (data: FromMetaboxMessagePayloads[T]) => void,\n ) {\n return super.addEventListener(\n messageType,\n callback as (data: unknown) => void,\n );\n }\n\n /**\n * Dispatches a typed event to all registered listeners.\n * @param messageType - The event name to dispatch.\n * @param data - The payload to pass to each listener.\n * @override\n */\n override dispatchEvent<T extends FromMetaBoxApiEvents>(\n messageType: T,\n data: FromMetaboxMessagePayloads[T],\n ) {\n return super.dispatchEvent(messageType, data);\n }\n\n /**\n * Removes a previously registered event listener.\n * @param messageType - The event name the listener was registered for.\n * @param callback - The same function reference that was passed to {@link addEventListener}.\n * @override\n */\n override removeEventListener<T extends FromMetaBoxApiEvents>(\n messageType: T,\n callback: (data: FromMetaboxMessagePayloads[T]) => void,\n ) {\n return super.removeEventListener(\n messageType,\n callback as (data: unknown) => void,\n );\n }\n\n /**\n * Filters and dispatches incoming messages from the Metabox.\n * @param event - The postMessage event received on a window.\n */\n private handleMessageReceived<T extends FromMetaBoxApiEvents>(\n event: MessageEvent,\n ) {\n if (event.data?.host !== Metabox) {\n return;\n }\n const data = event.data?.envelope;\n this.dispatchEvent(data?.eventType as T, data?.payload);\n }\n}\n","import type { IntegrateMetaboxConfig } from '../interfaces';\nimport { BasicRouteUrl, MetaboxDomain } from '../constants';\n\n/**\n * Constructs the iframe source URL for the Metabox Modular Configurator.\n *\n * ### What does it unlock?\n * Utility function that prepares the iframe source URL. Constructs the proper URL with parameters\n * for loading the MetaBox configurator.\n *\n * ### Practical Application\n * Utility function that constructs the iframe source URL with proper parameters.\n * URL format: `https://{domain}/metabox-configurator/modular/{configuratorId}`.\n * Called internally by integrateMetabox() — use directly only for manual URL construction.\n *\n * ### AI Coding Best Practices\n * Usually called internally. Use directly only for pre-constructing embed URLs (QR codes, email links,\n * preview URLs). Verify output is HTTPS. Remember modular configurators use `/modular/` path.\n *\n * @internal\n * @hidden\n *\n * @param {string} configuratorId - An string identifier for the configurator.\n * @param {IntegrateMetaboxConfig} config - An object containing the configuration options.\n */\nexport const prepareIframeSrc = (\n configuratorId: string,\n config?: IntegrateMetaboxConfig,\n) => {\n const base = `https://${config?.domain || MetaboxDomain}/${BasicRouteUrl}/${configuratorId}`;\n const params = new URLSearchParams();\n\n if (config?.introImage) {\n params.set('introImage', config.introImage);\n }\n if (config?.introVideo) {\n params.set('introVideo', config.introVideo);\n }\n if (config?.loadingImage) {\n params.set('loadingImage', config.loadingImage);\n }\n if (config?.state) {\n params.set('state', decodeURIComponent(config.state));\n }\n\n const query = params.toString();\n return query ? `${base}?${query}` : base;\n};\n","import { Communicator } from './communicator';\nimport type { IntegrateMetaboxConfig } from '../interfaces';\nimport { prepareIframeSrc } from './prepare-iframe-src';\n\n/**\n * Integrates the Metabox Modular Configurator into the page by injecting an iframe and\n * initializing a Communicator instance for host-to-iframe messaging.\n *\n * - Builds a secure iframe URL using the provided configuratorId and config options.\n * - Ensures the resulting URL uses HTTPS and that the target container exists.\n * - Removes any previously embedded iframe with id \"embeddedContent\" before inserting a new one.\n *\n * ### What does it unlock?\n * Main initialization function for MetaBox integration. Initializes the configurator, receives an API handle,\n * and sets up all configurations.\n *\n * ### Practical Application\n * THE entry point function. Creates the configurator iframe, establishes postMessage communication, and returns\n * the Communicator api handle via callback. Call ONCE per configurator. Params: configuratorId (modular UUID),\n * containerId (DOM element ID, default 'embed3DSource'), apiReadyCallback, config (IntegrateMetaboxConfig).\n *\n * ### AI Coding Best Practices\n * Pattern: `integrateMetabox('uuid', 'div-id', (api) => {\n * setup listeners, then set root component, then environment, then children\n * }, { standalone: true })`.\n * Ensure container div exists in DOM with non-zero dimensions. HTTPS required.\n * Inside callback: 1) addEventListener for configuratorDataUpdated, 2) SetComponent root, 3) SetEnvironment,\n * 4) SetComponent children, 5) SetComponentMaterial.\n *\n * @param {string} configuratorId - The Modular Configurator ID (not a full URL). It is appended to\n * `https://{domain}/metabox-configurator/modular/{configuratorId}` to form the iframe src.\n *\n * @param {string} containerId - The id of the container element where the iframe will be injected.\n *\n * @param {(api: Communicator) => void} apiReadyCallback - Called when the Communicator instance is created on the host side.\n *\n * @param {IntegrateMetaboxConfig} config - Optional configuration used to build the iframe URL and initialize the communicator.\n * Supported fields:\n * - standalone?: boolean — if true, disables Metabox custom template and related logic.\n * - introImage?: string — URL to an image shown on the intro screen (added as ?introImage=...).\n * - introVideo?: string — URL to a video shown on the intro screen (added as ?introVideo=...).\n * - loadingImage?: string — URL to an image displayed while loading (added as ?loadingImage=...).\n * - state?: string — Predefined state for configurator for initial loading (added as ?state=...).\n * - domain?: string — custom domain for testing (defaults to metabox.3dsource.com). HTTPS is enforced.\n *\n * @throws Error If configuratorId or containerId are empty strings.\n * @throws Error If the computed iframe URL is invalid or does not use HTTPS.\n * @throws Error If the container element with the provided id cannot be found.\n *\n * @example\n * import { integrateMetabox } from '@3dsource/metabox-modular-configurator-api';\n *\n * integrateMetabox(\n * 'configurator-id',\n * 'embed3DSource',\n * (api) => {\n * // Communicator is ready to use\n * },\n * {\n * standalone: false,\n * introImage: 'https://example.com/intro.png',\n * loadingImage: 'https://example.com/loading.png',\n * },\n * );\n */\nexport function integrateMetabox(\n configuratorId: string,\n containerId: string,\n apiReadyCallback: (api: Communicator) => void,\n config?: IntegrateMetaboxConfig,\n) {\n if (!configuratorId.trim()) {\n throw new Error(\n 'integrateMetabox: configuratorId must be a non-empty string',\n );\n }\n const iframeSrc = prepareIframeSrc(configuratorId, config);\n let parsedUrl: URL;\n try {\n parsedUrl = new URL(iframeSrc);\n } catch {\n throw new Error('integrateMetabox: Provided iframeSrc is not a valid URL');\n }\n if (parsedUrl.protocol !== 'https:') {\n throw new Error('integrateMetabox: iframeSrc must use HTTPS protocol');\n }\n if (!containerId.trim()) {\n throw new Error('integrateMetabox: containerId must be a non-empty string');\n }\n\n const container = document.getElementById(containerId);\n if (!container) {\n throw new Error(`Container element with id ${containerId} not found`);\n }\n\n const existingIframe = document.getElementById('embeddedContent');\n if (existingIframe) {\n existingIframe.remove();\n }\n\n Communicator.createInstance(apiReadyCallback, 'host', config);\n\n const style = document.createElement('style');\n style.innerHTML = `\n #${containerId} {\n width: 100%;\n height: 100%;\n overflow: hidden;\n position: relative;\n }\n `;\n document.head.appendChild(style);\n\n const iframe = document.createElement('iframe');\n iframe.setAttribute('allow', 'autoplay; fullscreen; encrypted-media');\n iframe.setAttribute('referrerPolicy', 'no-referrer-when-downgrade');\n iframe.setAttribute('id', 'embeddedContent');\n iframe.style.border = '0';\n iframe.style.width = '100%';\n iframe.style.height = '100%';\n iframe.style.overflow = 'hidden';\n iframe.src = iframeSrc;\n container.appendChild(iframe);\n}\n","/**\n * Saves an image by triggering a download.\n *\n * This function creates an anchor element, sets its `href` attribute to the provided image URL,\n * and triggers a click event to initiate a download with the specified filename.\n *\n * ### What does it unlock?\n * Main exported function to save images from the configurator. Converts base64 image data to actual image\n * files and saves them to the local filesystem.\n *\n * ### Practical Application\n * Exported utility function that converts base64 screenshot data (from screenshotReady event) to a downloadable\n * image file. Handles the base64 → blob → browser download flow. Import directly from the API package.\n *\n * ### AI Coding Best Practices\n * Pattern: `api.addEventListener('screenshotReady', (data) => { if(data) saveImage(data, 'config-screenshot.png'); })`.\n * Filename extension should match the MimeType passed to GetScreenshot.\n * Import: `import { saveImage } from '@3dsource/metabox-modular-configurator-api'`.\n *\n * @param {string} imageUrl - The URL of the image to save.\n * @param {string} filename - The name of the file to save.\n */\nexport function saveImage(imageUrl: string, filename: string): void {\n const a = document.createElement('a');\n a.href = imageUrl;\n a.download = filename;\n document.body.appendChild(a);\n a.click();\n document.body.removeChild(a);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;AAiBG;MAEU,WAAW,CAAA;AAGvB;;AChBD;;;;;;;;;;;;;;;;;;;AAmBG;AACG,SAAU,qBAAqB,CACnC,MAAoB,EACpB,SAAY,EAAA;AAEZ,IAAA,OAAO,S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AA,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,uCAAuC,CAAC;AACrE,IAAA,MAAM,CAAC,YAAY,CAAC,gBAAgB,EAAE,4BAA4B,CAAC;AACnE,IAAA,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,iBAAiB,CAAC;AAC5C,IAAA,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG;AACzB,IAAA,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM;AAC3B,IAAA,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM;AAC5B,IAAA,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ;AAChC,IAAA,MAAM,CAAC,GAAG,GAAG,SAAS;AACtB,IAAA,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC;AAC/B;;AC3HA;;;;;;;;;;;;;;;;;;;;;AAqBG;AACG,SAAU,SAAS,CAAC,QAAgB,EAAE,QAAgB,EAAA;IAC1D,MAAM,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC;AACrC,IAAA,CAAC,CAAC,IAAI,GAAG,QAAQ;AACjB,IAAA,CAAC,CAAC,QAAQ,GAAG,QAAQ;AACrB,IAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAC5B,CAAC,CAAC,KAAK,EAAE;AACT,IAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;AAC9B;;AC7BA;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -57,22 +57,6 @@ declare const Metabox = "metabox";
|
|
|
57
57
|
* @internal
|
|
58
58
|
*/
|
|
59
59
|
declare const MetaboxHost = "metaboxHost";
|
|
60
|
-
/**
|
|
61
|
-
* Identifier used as the `host` field in postMessage envelopes received from the iframe.
|
|
62
|
-
*
|
|
63
|
-
* ### What does it unlock?
|
|
64
|
-
* Constant identifier used internally to reference and compare MetaBox data. Used for data validation and internal routing.
|
|
65
|
-
*
|
|
66
|
-
* ### Practical Application
|
|
67
|
-
* Internal data reference constant used for validation and message routing within the communication layer.
|
|
68
|
-
* Not needed in front-end application code.
|
|
69
|
-
*
|
|
70
|
-
* ### AI Coding Best Practices
|
|
71
|
-
* Skip in application code. Only relevant if debugging very low-level message traffic between your app and the MetaBox iframe.
|
|
72
|
-
*
|
|
73
|
-
* @internal
|
|
74
|
-
*/
|
|
75
|
-
declare const MetaboxData = "metaboxData";
|
|
76
60
|
/**
|
|
77
61
|
* Action string dispatched by the iframe when the configurator app has loaded.
|
|
78
62
|
*
|
|
@@ -88,7 +72,7 @@ declare const MetaboxData = "metaboxData";
|
|
|
88
72
|
*
|
|
89
73
|
* @internal
|
|
90
74
|
*/
|
|
91
|
-
declare const AppLoaded = "
|
|
75
|
+
declare const AppLoaded = "appLoaded";
|
|
92
76
|
/**
|
|
93
77
|
* Default MetaBox domain for production environments.
|
|
94
78
|
*
|
|
@@ -136,7 +120,7 @@ declare const MetaboxDomain = "metabox.3dsource.com";
|
|
|
136
120
|
*/
|
|
137
121
|
declare const BasicRouteUrl = "metabox-configurator/modular";
|
|
138
122
|
|
|
139
|
-
declare const VERSION = "3.0.19-dev.
|
|
123
|
+
declare const VERSION = "3.0.19-dev.12";
|
|
140
124
|
|
|
141
125
|
/**
|
|
142
126
|
* Configuration options for integrating the Metabox Modular Configurator iframe into a host page.
|
|
@@ -2189,5 +2173,5 @@ declare class ResumeStream extends CommandBase {
|
|
|
2189
2173
|
constructor();
|
|
2190
2174
|
}
|
|
2191
2175
|
|
|
2192
|
-
export { AppLoaded, AppLoaded_V3, ApplyZoom, BasicRouteUrl, CommandBase, Communicator, EventDispatcher, ForceSetDeviceType, GetCallToActionInformation, GetCamera, GetPdf, GetScreenshot, HideMeasurement, InitShowcase, Metabox, MetaboxConfig,
|
|
2176
|
+
export { AppLoaded, AppLoaded_V3, ApplyZoom, BasicRouteUrl, CommandBase, Communicator, EventDispatcher, ForceSetDeviceType, GetCallToActionInformation, GetCamera, GetPdf, GetScreenshot, HideMeasurement, InitShowcase, Metabox, MetaboxConfig, MetaboxDomain, MetaboxHost, MetaboxHost_V3, MetaboxModularConfiguratorActions, Metabox_V3, PauseShowcase, PlayShowcase, ResetCamera, ResumeStream, SetCamera, SetComponent, SetComponentMaterial, SetEnvironment, SetEnvironmentMaterial, ShowEmbeddedMenu, ShowMeasurement, ShowOverlayInterface, StopShowcase, UnrealCommand, VERSION, fromCommunicatorEvent, integrateMetabox, prepareIframeSrc, saveImage };
|
|
2193
2177
|
export type { ApplicationDeviceTypes, CameraCommandPayload, ComponentWithParent, Cta, EcomConfigurator, Environment, FromMetaBoxAPIEnvelope, FromMetaBoxApiEvents, FromMetaBoxMessage, FromMetaboxMessagePayloads, FromMetaboxTarget, InitialModularConfigurator, IntegrateMetaboxConfig, Listener, MCAppLoaded, Material, MetaBoxApiEnvelope, MetaProperty, MetaboxCommandConfig, MetaboxEnvironment, MimeType, ModularConfiguratorComponent, ModularConfiguratorComponentType, ModularConfiguratorConnector, ModularConfiguratorEnvelope, ModularConfiguratorEnvironment, ModularConfiguratorVirtualSocketToConnector, Product, SelectedIds, ShowCaseStatus, Showcase, Slot, Thumbnail, Timecode, ToMetaBoxActions, ToMetaBoxMessage, ToMetaBoxMessageEnvelope, ToMetaboxMessagePayload, ToMetaboxMessagePayloads, ToMetaboxTarget, VideoResolution };
|