@3dsource/metabox-modular-configurator-api 3.0.29 → 3.0.30

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,9 +1016,18 @@ class EventDispatcher {
1016
1016
  * @param data - The data associated with the event.
1017
1017
  */
1018
1018
  dispatchEvent(messageType, data) {
1019
- this.listeners
1020
- .filter((listener) => listener.messageType === messageType)
1021
- .forEach((listener) => listener.callback(data));
1019
+ // Allocation-free dispatch on the hot message path. The length snapshot
1020
+ // keeps the previous filter-snapshot semantics: listeners added during
1021
+ // dispatch are not invoked for this event, and removeEventListener
1022
+ // reassigns the array so the in-flight loop is unaffected.
1023
+ const listeners = this.listeners;
1024
+ const len = listeners.length;
1025
+ for (let i = 0; i < len; i++) {
1026
+ const listener = listeners[i];
1027
+ if (listener.messageType === messageType) {
1028
+ listener.callback(data);
1029
+ }
1030
+ }
1022
1031
  return this;
1023
1032
  }
1024
1033
  /**
@@ -1133,7 +1142,7 @@ const MetaboxDomain = 'metabox.3dsource.com';
1133
1142
  */
1134
1143
  const BasicRouteUrl = 'metabox-configurator/modular';
1135
1144
 
1136
- const VERSION = '3.0.29';
1145
+ const VERSION = '3.0.30';
1137
1146
 
1138
1147
  const communicatorMap = new Map();
1139
1148
  /**
@@ -1182,6 +1191,10 @@ class Communicator extends EventDispatcher {
1182
1191
  * @param apiReadyCallback - Called with the new Communicator once the Metabox is loaded.
1183
1192
  * @param {MetaboxEnvironment} environment - The environment in which the Communicator is running.
1184
1193
  * @param {MetaboxCommandConfig} config - optional initial config: standalone - if true - disable metabox custom template and all logic
1194
+ * @returns A cancel function that removes the handshake `message` listener.
1195
+ * `integrateMetabox` (the public entry point) calls this automatically when
1196
+ * a new integration supersedes a still-pending one, so direct internal
1197
+ * callers only need it for explicit early teardown. Idempotent.
1185
1198
  */
1186
1199
  static createInstance(apiReadyCallback, environment, config) {
1187
1200
  const startHandler = (event) => {
@@ -1192,6 +1205,7 @@ class Communicator extends EventDispatcher {
1192
1205
  }
1193
1206
  };
1194
1207
  window.addEventListener('message', startHandler);
1208
+ return () => window.removeEventListener('message', startHandler);
1195
1209
  }
1196
1210
  /**
1197
1211
  * Cleans up resources and stops listening for messages.
@@ -1225,6 +1239,8 @@ class Communicator extends EventDispatcher {
1225
1239
  const toMetaboxMessage = {
1226
1240
  host: MetaboxHost,
1227
1241
  envelope: { ...data },
1242
+ // Deprecated mirror of `envelope`. Kept as an independent clone so a
1243
+ // receiver mutating one cannot observably change the other.
1228
1244
  payload: { ...data },
1229
1245
  target: iframe?.contentWindow ? 'child' : 'metabox',
1230
1246
  apiVersion: VERSION,
@@ -1329,6 +1345,13 @@ const prepareIframeSrc = (configuratorId, config) => {
1329
1345
  return query ? `${base}?${query}` : base;
1330
1346
  };
1331
1347
 
1348
+ // Cancel for the previous integration's handshake listener while it is still
1349
+ // waiting for the iframe to load. A new integrateMetabox call supersedes it —
1350
+ // it already replaces the single embedded iframe — so a never-completed
1351
+ // handshake (failed load, SPA remount, retry) can't leak a window 'message'
1352
+ // listener for the page lifetime. Idempotent, so a completed handshake's
1353
+ // cancel is a harmless no-op here.
1354
+ let cancelPendingHandshake = null;
1332
1355
  /**
1333
1356
  * Integrates the Metabox Modular Configurator into the page by injecting an iframe and
1334
1357
  * initializing a Communicator instance for host-to-iframe messaging.
@@ -1378,6 +1401,12 @@ const prepareIframeSrc = (configuratorId, config) => {
1378
1401
  * @throws Error If the computed iframe URL is invalid or does not use HTTPS.
1379
1402
  * @throws Error If the container element with the provided id cannot be found.
1380
1403
  *
1404
+ * @returns A cancel function that stops waiting for the Metabox to load.
1405
+ * Calling it is optional — a later `integrateMetabox` call automatically
1406
+ * supersedes a still-pending handshake — but it lets you remove the handshake
1407
+ * listener immediately on teardown (e.g. SPA route change before
1408
+ * `apiReadyCallback` fires). Idempotent.
1409
+ *
1381
1410
  * @example
1382
1411
  * import { integrateMetabox } from '@3dsource/metabox-modular-configurator-api';
1383
1412
  *
@@ -1423,9 +1452,17 @@ function integrateMetabox(configuratorId, containerId, apiReadyCallback, config)
1423
1452
  if (existingIframe) {
1424
1453
  existingIframe.remove();
1425
1454
  }
1426
- Communicator.createInstance(apiReadyCallback, 'host', config);
1427
- const style = document.createElement('style');
1428
- style.innerHTML = `
1455
+ // Supersede a prior integration still waiting for its handshake.
1456
+ cancelPendingHandshake?.();
1457
+ const cancel = Communicator.createInstance(apiReadyCallback, 'host', config);
1458
+ cancelPendingHandshake = cancel ?? null;
1459
+ // Inject the container rules once per containerId — repeated integrations
1460
+ // were appending identical <style> tags, forcing CSSOM reparses.
1461
+ const styleId = `metabox-integration-style-${containerId}`;
1462
+ if (!document.getElementById(styleId)) {
1463
+ const style = document.createElement('style');
1464
+ style.id = styleId;
1465
+ style.innerHTML = `
1429
1466
  #${containerId} {
1430
1467
  width: 100%;
1431
1468
  height: 100%;
@@ -1433,7 +1470,8 @@ function integrateMetabox(configuratorId, containerId, apiReadyCallback, config)
1433
1470
  position: relative;
1434
1471
  }
1435
1472
  `;
1436
- document.head.appendChild(style);
1473
+ document.head.appendChild(style);
1474
+ }
1437
1475
  const iframe = document.createElement('iframe');
1438
1476
  iframe.setAttribute('allow', 'autoplay; fullscreen; encrypted-media');
1439
1477
  iframe.setAttribute('referrerPolicy', 'no-referrer-when-downgrade');
@@ -1444,6 +1482,7 @@ function integrateMetabox(configuratorId, containerId, apiReadyCallback, config)
1444
1482
  iframe.style.overflow = 'hidden';
1445
1483
  iframe.src = iframeSrc;
1446
1484
  container.appendChild(iframe);
1485
+ return cancel;
1447
1486
  }
1448
1487
 
1449
1488
  /**
@@ -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/ResetConfiguration.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/ResumeStream.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/ResetUserInactivityTimer.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 { 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 showOverlayInterface: 'showOverlayInterface',\n getCamera: 'getCamera',\n setCamera: 'setCamera',\n resetCamera: 'resetCamera',\n resetConfiguration: 'resetConfiguration',\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 resetUserInactivityTimer: 'resetUserInactivityTimer',\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.getCamera]: void;\n [MetaboxModularConfiguratorActions.setCamera]: {\n camera: CameraCommandPayload;\n };\n [MetaboxModularConfiguratorActions.resetCamera]: void;\n [MetaboxModularConfiguratorActions.resetConfiguration]: 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 [MetaboxModularConfiguratorActions.resetUserInactivityTimer]: 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 reset the modular configurator state to its defaults.\n * This class sends a message to the Metabox API to restore the component tree, component materials,\n * environment, and environment materials to the values defined by the configurator template.\n * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.\n *\n * ### What does it unlock?\n * Resets the entire modular configurator state to defaults — root and child components, all component\n * material selections, environment, and environment materials all return to the template-defined initial\n * values. Used to give users a clean 'Start Over' affordance without reloading the iframe.\n *\n * ### Practical Application\n * Powers 'Reset to Defaults' / 'Start Over' buttons in modular configurators where users have built up\n * an assembly with multiple SetComponent / SetComponentMaterial calls. Unlike ResetCamera (which only\n * touches viewport state), ResetConfiguration wipes all user-applied selections back to template\n * defaults. The configurator responds with a full ModularConfiguratorEnvelope via configuratorDataUpdated,\n * so UI state derived from the envelope (configurationTree, componentsByComponentType, material chips)\n * will re-sync automatically.\n *\n * ### AI Coding Best Practices\n * Call `api.sendCommandToMetabox(new ResetConfiguration())`. No parameters. Subscribe to\n * configuratorDataUpdated BEFORE sending so you capture the reset envelope. If your UI maintains local\n * selection state separate from the envelope, clear it in the same handler. After reset, the root\n * component is back to the template default — no need to re-issue SetComponent for the root unless you\n * want a different starting assembly. Pair with ResetCamera if you also want the viewport returned to\n * its default framing.\n *\n * @example\n * import { ResetConfiguration, 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('Configurator reset to default state:', data);\n * });\n *\n * api.sendCommandToMetabox(new ResetConfiguration());\n * };\n */\n\nexport class ResetConfiguration extends CommandBase {\n constructor() {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.resetConfiguration,\n };\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 { 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","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to reset the user inactivity (AFK) timer.\n * This class sends a message to the Metabox API to restart the inactivity countdown,\n * keeping the session alive when activity is detected programmatically.\n *\n * ### What does it unlock?\n * Resets the AFK inactivity timer, preventing an imminent disconnect when the countdown is active.\n *\n * ### Practical Application\n * Used to programmatically signal user activity and reset the inactivity countdown.\n * Pair with the `userInactivityDetected` event to show a custom \"Stay connected?\" prompt\n * and call this command when the user confirms, dismissing the countdown.\n *\n * ### AI Coding Best Practices\n * Call `api.sendCommandToMetabox(new ResetUserInactivityTimer())`. No parameters.\n * Typically triggered from a \"Stay connected\" or \"I'm still here\" button rendered when\n * `userInactivityDetected.countdownVisible` is `true`.\n *\n * @example\n * import { ResetUserInactivityTimer, Communicator } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * api.addEventListener('userInactivityDetected', ({ countdownVisible }) => {\n * if (countdownVisible) {\n * // show custom UI, then on user confirmation:\n * api.sendCommandToMetabox(new ResetUserInactivityTimer());\n * }\n * });\n * };\n */\n\nexport class ResetUserInactivityTimer extends CommandBase {\n constructor() {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.resetUserInactivityTimer,\n };\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.29';\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';\nimport { Logger } from '@3dsource/utils';\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 Logger.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';\nimport { isDefined } from '@3dsource/utils';\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 if (isDefined(config?.showLoadingProgress)) {\n params.set('showLoadingProgress', String(config.showLoadingProgress));\n }\n if (isDefined(config?.showResumeStreamPopup)) {\n params.set('showResumeStreamPopup', String(config.showResumeStreamPopup));\n }\n if (isDefined(config?.showUserInactivityTimer)) {\n params.set(\n 'showUserInactivityTimer',\n String(config.showUserInactivityTimer),\n );\n }\n if (isDefined(config?.userInactivityTimeout)) {\n params.set('userInactivityTimeout', String(config.userInactivityTimeout));\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 * is 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 * set up listeners, then set a root component, then environment, then children\n * }, { standalone: true })`.\n * Ensure a 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 * - showLoadingProgress?: boolean — if true, shows the loading progress bar (added as ?showLoadingProgress=true).\n * - showResumeStreamPopup?: boolean — if true, shows the resume stream popup (added as ?showResumeStreamPopup=true).\n * - showUserInactivityTimer?: boolean — if true, shows the AFK countdown popup (added as ?showUserInactivityTimer=true).\n * - userInactivityTimeout?: number — inactivity timeout in seconds before disconnect (added as ?userInactivityTimeout=...).\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('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 * showLoadingProgress: true,\n * showResumeStreamPopup: true,\n * showUserInactivityTimer: true,\n * userInactivityTimeout: 20,\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,SAAS,CAAC,MAAM,EAAE,SAAS,CAEjC;AACH;;AC/BA;;;;;;;;;;;;;;;AAeG;AACI,MAAM,iCAAiC,GAAG;AAC/C,IAAA,aAAa,EAAE,eAAe;AAC9B,IAAA,YAAY,EAAE,cAAc;AAC5B,IAAA,cAAc,EAAE,gBAAgB;AAChC,IAAA,0BAA0B,EAAE,4BAA4B;AACxD,IAAA,YAAY,EAAE,cAAc;AAC5B,IAAA,wBAAwB,EAAE,0BAA0B;AACpD,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,0BAA0B,EAAE,4BAA4B;AACxD,IAAA,aAAa,EAAE,eAAe;AAC9B,IAAA,gBAAgB,EAAE,kBAAkB;AACpC,IAAA,oBAAoB,EAAE,sBAAsB;AAC5C,IAAA,SAAS,EAAE,WAAW;AACtB,IAAA,SAAS,EAAE,WAAW;AACtB,IAAA,WAAW,EAAE,aAAa;AAC1B,IAAA,kBAAkB,EAAE,oBAAo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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/ResetConfiguration.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/ResumeStream.ts","../../../../projects/3dsource/metabox-modular-configurator-api/src/lib/actions/ResetUserInactivityTimer.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 { 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 showOverlayInterface: 'showOverlayInterface',\n getCamera: 'getCamera',\n setCamera: 'setCamera',\n resetCamera: 'resetCamera',\n resetConfiguration: 'resetConfiguration',\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 resetUserInactivityTimer: 'resetUserInactivityTimer',\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.getCamera]: void;\n [MetaboxModularConfiguratorActions.setCamera]: {\n camera: CameraCommandPayload;\n };\n [MetaboxModularConfiguratorActions.resetCamera]: void;\n [MetaboxModularConfiguratorActions.resetConfiguration]: 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 [MetaboxModularConfiguratorActions.resetUserInactivityTimer]: 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 reset the modular configurator state to its defaults.\n * This class sends a message to the Metabox API to restore the component tree, component materials,\n * environment, and environment materials to the values defined by the configurator template.\n * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.\n *\n * ### What does it unlock?\n * Resets the entire modular configurator state to defaults — root and child components, all component\n * material selections, environment, and environment materials all return to the template-defined initial\n * values. Used to give users a clean 'Start Over' affordance without reloading the iframe.\n *\n * ### Practical Application\n * Powers 'Reset to Defaults' / 'Start Over' buttons in modular configurators where users have built up\n * an assembly with multiple SetComponent / SetComponentMaterial calls. Unlike ResetCamera (which only\n * touches viewport state), ResetConfiguration wipes all user-applied selections back to template\n * defaults. The configurator responds with a full ModularConfiguratorEnvelope via configuratorDataUpdated,\n * so UI state derived from the envelope (configurationTree, componentsByComponentType, material chips)\n * will re-sync automatically.\n *\n * ### AI Coding Best Practices\n * Call `api.sendCommandToMetabox(new ResetConfiguration())`. No parameters. Subscribe to\n * configuratorDataUpdated BEFORE sending so you capture the reset envelope. If your UI maintains local\n * selection state separate from the envelope, clear it in the same handler. After reset, the root\n * component is back to the template default — no need to re-issue SetComponent for the root unless you\n * want a different starting assembly. Pair with ResetCamera if you also want the viewport returned to\n * its default framing.\n *\n * @example\n * import { ResetConfiguration, 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('Configurator reset to default state:', data);\n * });\n *\n * api.sendCommandToMetabox(new ResetConfiguration());\n * };\n */\n\nexport class ResetConfiguration extends CommandBase {\n constructor() {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.resetConfiguration,\n };\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 { 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","import { CommandBase } from './CommandBase';\nimport { MetaboxModularConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to reset the user inactivity (AFK) timer.\n * This class sends a message to the Metabox API to restart the inactivity countdown,\n * keeping the session alive when activity is detected programmatically.\n *\n * ### What does it unlock?\n * Resets the AFK inactivity timer, preventing an imminent disconnect when the countdown is active.\n *\n * ### Practical Application\n * Used to programmatically signal user activity and reset the inactivity countdown.\n * Pair with the `userInactivityDetected` event to show a custom \"Stay connected?\" prompt\n * and call this command when the user confirms, dismissing the countdown.\n *\n * ### AI Coding Best Practices\n * Call `api.sendCommandToMetabox(new ResetUserInactivityTimer())`. No parameters.\n * Typically triggered from a \"Stay connected\" or \"I'm still here\" button rendered when\n * `userInactivityDetected.countdownVisible` is `true`.\n *\n * @example\n * import { ResetUserInactivityTimer, Communicator } from '@3dsource/metabox-modular-configurator-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n * api.addEventListener('userInactivityDetected', ({ countdownVisible }) => {\n * if (countdownVisible) {\n * // show custom UI, then on user confirmation:\n * api.sendCommandToMetabox(new ResetUserInactivityTimer());\n * }\n * });\n * };\n */\n\nexport class ResetUserInactivityTimer extends CommandBase {\n constructor() {\n super();\n this.data = {\n action: MetaboxModularConfiguratorActions.resetUserInactivityTimer,\n };\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 // Allocation-free dispatch on the hot message path. The length snapshot\n // keeps the previous filter-snapshot semantics: listeners added during\n // dispatch are not invoked for this event, and removeEventListener\n // reassigns the array so the in-flight loop is unaffected.\n const listeners = this.listeners;\n const len = listeners.length;\n for (let i = 0; i < len; i++) {\n const listener = listeners[i];\n if (listener.messageType === messageType) {\n listener.callback(data);\n }\n }\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.30';\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';\nimport { Logger } from '@3dsource/utils';\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 * @returns A cancel function that removes the handshake `message` listener.\n * `integrateMetabox` (the public entry point) calls this automatically when\n * a new integration supersedes a still-pending one, so direct internal\n * callers only need it for explicit early teardown. Idempotent.\n */\n static createInstance(\n apiReadyCallback: (api: Communicator) => void,\n environment: MetaboxEnvironment,\n config?: Partial<MetaboxCommandConfig>,\n ): () => void {\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 return () => window.removeEventListener('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 // Deprecated mirror of `envelope`. Kept as an independent clone so a\n // receiver mutating one cannot observably change the other.\n payload: { ...data },\n target: iframe?.contentWindow ? 'child' : 'metabox',\n apiVersion: VERSION,\n } satisfies ToMetaBoxMessage;\n\n if (!iframe?.contentWindow) {\n Logger.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';\nimport { isDefined } from '@3dsource/utils';\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 if (isDefined(config?.showLoadingProgress)) {\n params.set('showLoadingProgress', String(config.showLoadingProgress));\n }\n if (isDefined(config?.showResumeStreamPopup)) {\n params.set('showResumeStreamPopup', String(config.showResumeStreamPopup));\n }\n if (isDefined(config?.showUserInactivityTimer)) {\n params.set(\n 'showUserInactivityTimer',\n String(config.showUserInactivityTimer),\n );\n }\n if (isDefined(config?.userInactivityTimeout)) {\n params.set('userInactivityTimeout', String(config.userInactivityTimeout));\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// Cancel for the previous integration's handshake listener while it is still\n// waiting for the iframe to load. A new integrateMetabox call supersedes it —\n// it already replaces the single embedded iframe — so a never-completed\n// handshake (failed load, SPA remount, retry) can't leak a window 'message'\n// listener for the page lifetime. Idempotent, so a completed handshake's\n// cancel is a harmless no-op here.\nlet cancelPendingHandshake: (() => void) | null = null;\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 * is 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 * set up listeners, then set a root component, then environment, then children\n * }, { standalone: true })`.\n * Ensure a 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 * - showLoadingProgress?: boolean — if true, shows the loading progress bar (added as ?showLoadingProgress=true).\n * - showResumeStreamPopup?: boolean — if true, shows the resume stream popup (added as ?showResumeStreamPopup=true).\n * - showUserInactivityTimer?: boolean — if true, shows the AFK countdown popup (added as ?showUserInactivityTimer=true).\n * - userInactivityTimeout?: number — inactivity timeout in seconds before disconnect (added as ?userInactivityTimeout=...).\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 * @returns A cancel function that stops waiting for the Metabox to load.\n * Calling it is optional — a later `integrateMetabox` call automatically\n * supersedes a still-pending handshake — but it lets you remove the handshake\n * listener immediately on teardown (e.g. SPA route change before\n * `apiReadyCallback` fires). Idempotent.\n *\n * @example\n * import { integrateMetabox } from '@3dsource/metabox-modular-configurator-api';\n *\n * integrateMetabox('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 * showLoadingProgress: true,\n * showResumeStreamPopup: true,\n * showUserInactivityTimer: true,\n * userInactivityTimeout: 20,\n * },\n * );\n */\nexport function integrateMetabox(\n configuratorId: string,\n containerId: string,\n apiReadyCallback: (api: Communicator) => void,\n config?: IntegrateMetaboxConfig,\n): () => void {\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 // Supersede a prior integration still waiting for its handshake.\n cancelPendingHandshake?.();\n const cancel = Communicator.createInstance(apiReadyCallback, 'host', config);\n cancelPendingHandshake = cancel ?? null;\n\n // Inject the container rules once per containerId — repeated integrations\n // were appending identical <style> tags, forcing CSSOM reparses.\n const styleId = `metabox-integration-style-${containerId}`;\n if (!document.getElementById(styleId)) {\n const style = document.createElement('style');\n style.id = styleId;\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\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 return cancel;\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,SAAS,CAAC,MAAM,EAAE,SAAS,CAEjC;AACH;;AC/BA;;;;;;;;;;;;;;;AAeG;AACI,MAAM,iCAAiC,GAAG;AAC/C,IAAA,aAAa,EAAE,eAAe;AAC9B,IAAA,YAAY,EAAE,cAAc;AAC5B,IAAA,cAAc,EAAE,gBAAgB;AAChC,IAAA,0BAA0B,EAAE,4BAA4B;AACxD,IAAA,YAAY,EAAE,cAAc;AAC5B,IAAA,wBAAwB,EAAE,0BAA0B;AACpD,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,0BAA0B,EAAE,4BAA4B;AACxD,IAAA,aAAa,EAAE,eAAe;AAC9B,IAAA,gBAAgB,EAAE,kBAAkB;AACpC,IAAA,oBAAoB,EAAE,sBAAsB;AAC5C,IAAA,SAAS,EAAE,WAAW;AACtB,IAAA,SAAS,EAAE,WAAW;AACtB,IAAA,WAAW,EAAE,aAAa;AAC1B,IAAA,kBAAkB,EAAE,oBAAoB;AACxC,IAAA,SAAS,EAAE,WAAW;AACtB,IAAA,YAAY,EAAE,cAAc;AAC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Q;AAChC,IAAA,MAAM,CAAC,GAAG,GAAG,SAAS;AACtB,IAAA,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC;AAE7B,IAAA,OAAO,MAAM;AACf;;AC3JA;;;;;;;;;;;;;;;;;;;;;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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3dsource/metabox-modular-configurator-api",
3
- "version": "3.0.29",
3
+ "version": "3.0.30",
4
4
  "description": "API for Metabox MODULAR configurator",
5
5
  "keywords": [
6
6
  "metabox",
@@ -100,7 +100,7 @@ declare const MetaboxDomain = "metabox.3dsource.com";
100
100
  */
101
101
  declare const BasicRouteUrl = "metabox-configurator/modular";
102
102
 
103
- declare const VERSION = "3.0.29";
103
+ declare const VERSION = "3.0.30";
104
104
 
105
105
  /**
106
106
  * Configuration options for integrating the Metabox Modular Configurator iframe into a host page.
@@ -1369,8 +1369,12 @@ declare class Communicator extends EventDispatcher {
1369
1369
  * @param apiReadyCallback - Called with the new Communicator once the Metabox is loaded.
1370
1370
  * @param {MetaboxEnvironment} environment - The environment in which the Communicator is running.
1371
1371
  * @param {MetaboxCommandConfig} config - optional initial config: standalone - if true - disable metabox custom template and all logic
1372
+ * @returns A cancel function that removes the handshake `message` listener.
1373
+ * `integrateMetabox` (the public entry point) calls this automatically when
1374
+ * a new integration supersedes a still-pending one, so direct internal
1375
+ * callers only need it for explicit early teardown. Idempotent.
1372
1376
  */
1373
- static createInstance(apiReadyCallback: (api: Communicator) => void, environment: MetaboxEnvironment, config?: Partial<MetaboxCommandConfig>): void;
1377
+ static createInstance(apiReadyCallback: (api: Communicator) => void, environment: MetaboxEnvironment, config?: Partial<MetaboxCommandConfig>): () => void;
1374
1378
  /**
1375
1379
  * Cleans up resources and stops listening for messages.
1376
1380
  */
@@ -1466,6 +1470,12 @@ declare class Communicator extends EventDispatcher {
1466
1470
  * @throws Error If the computed iframe URL is invalid or does not use HTTPS.
1467
1471
  * @throws Error If the container element with the provided id cannot be found.
1468
1472
  *
1473
+ * @returns A cancel function that stops waiting for the Metabox to load.
1474
+ * Calling it is optional — a later `integrateMetabox` call automatically
1475
+ * supersedes a still-pending handshake — but it lets you remove the handshake
1476
+ * listener immediately on teardown (e.g. SPA route change before
1477
+ * `apiReadyCallback` fires). Idempotent.
1478
+ *
1469
1479
  * @example
1470
1480
  * import { integrateMetabox } from '@3dsource/metabox-modular-configurator-api';
1471
1481
  *
@@ -1485,7 +1495,7 @@ declare class Communicator extends EventDispatcher {
1485
1495
  * },
1486
1496
  * );
1487
1497
  */
1488
- declare function integrateMetabox(configuratorId: string, containerId: string, apiReadyCallback: (api: Communicator) => void, config?: IntegrateMetaboxConfig): void;
1498
+ declare function integrateMetabox(configuratorId: string, containerId: string, apiReadyCallback: (api: Communicator) => void, config?: IntegrateMetaboxConfig): () => void;
1489
1499
 
1490
1500
  /**
1491
1501
  * Saves an image by triggering a download.