@3dsource/metabox-front-api 3.0.24 → 3.0.26-dev.0

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.
package/README.md CHANGED
@@ -370,18 +370,20 @@ Commands control configurator behavior. Send via `api.sendCommandToMetabox(new C
370
370
 
371
371
  #### Product & Environment Management
372
372
 
373
- | Command | Parameters | Description |
374
- | ------------------------ | ------------------------------------ | ---------------------------------- |
375
- | `SetProduct` | `productId: string` | Switch to specified product |
376
- | `SetProductMaterial` | `slotId: string, materialId: string` | Apply material to product slot |
377
- | `SetEnvironment` | `environmentId: string` | Change environment/scene |
378
- | `SetEnvironmentMaterial` | `slotId: string, materialId: string` | Apply material to environment slot |
373
+ | Command | Parameters | Description |
374
+ | ------------------------ | ------------------------------------ | ---------------------------------------------------------------------- |
375
+ | `SetProduct` | `productId: string` | Switch to specified product |
376
+ | `SetProductMaterial` | `slotId: string, materialId: string` | Apply material to product slot |
377
+ | `SetEnvironment` | `environmentId: string` | Change environment/scene |
378
+ | `SetEnvironmentMaterial` | `slotId: string, materialId: string` | Apply material to environment slot |
379
+ | `ResetConfiguration` | None | Reset configurator state to defaults (product, materials, environment) |
379
380
 
380
381
  **Example:**
381
382
 
382
383
  ```typescript
383
384
  api.sendCommandToMetabox(new SetProduct('product-uuid'));
384
385
  api.sendCommandToMetabox(new SetProductMaterial('body', 'red-metallic'));
386
+ api.sendCommandToMetabox(new ResetConfiguration()); // Restore template defaults
385
387
  ```
386
388
 
387
389
  #### UI Control
@@ -77,6 +77,7 @@ const MetaboxBasicConfiguratorActions = {
77
77
  getCamera: 'getCamera',
78
78
  setCamera: 'setCamera',
79
79
  resetCamera: 'resetCamera',
80
+ resetConfiguration: 'resetConfiguration',
80
81
  applyZoom: 'applyZoom',
81
82
  initShowcase: 'initShowcase',
82
83
  playShowcase: 'playShowcase',
@@ -307,6 +308,49 @@ class ResetCamera extends CommandBase {
307
308
  }
308
309
  }
309
310
 
311
+ /**
312
+ * Represents a command to reset the configurator state to its defaults.
313
+ * This class sends a message to the Metabox API to restore product, materials,
314
+ * and environment selections to the values defined by the configurator template.
315
+ * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.
316
+ *
317
+ * ### What does it unlock?
318
+ * Resets the entire configurator state to defaults — product, product materials, environment, and
319
+ * environment materials all return to the template-defined initial values. Used to give users a clean
320
+ * 'Start Over' affordance without reloading the iframe.
321
+ *
322
+ * ### Practical Application
323
+ * Powers 'Reset to Defaults' / 'Start Over' buttons in product configurators. Unlike ResetCamera (which
324
+ * only touches viewport state), ResetConfiguration wipes all user-applied selections back to template
325
+ * defaults. The configurator responds with a full ConfiguratorEnvelope via configuratorDataUpdated, so
326
+ * UI state derived from the envelope (selected swatches, current product, environment chips) will
327
+ * re-sync automatically.
328
+ *
329
+ * ### AI Coding Best Practices
330
+ * Call `api.sendCommandToMetabox(new ResetConfiguration())`. No parameters. Subscribe to
331
+ * configuratorDataUpdated BEFORE sending so you capture the reset envelope. If your UI maintains local
332
+ * selection state separate from the envelope, clear it in the same handler. Pair with ResetCamera if
333
+ * you also want the viewport returned to its default framing.
334
+ *
335
+ * @example
336
+ * import { ResetConfiguration, Communicator, ConfiguratorEnvelope } from '@3dsource/metabox-front-api';
337
+ * window.env3DSource.apiReady = (api: Communicator) => {
338
+ *
339
+ * //Subscribe to the event before sending the command to ensure you capture the response
340
+ * api.addEventListener('configuratorDataUpdated', (data: ConfiguratorEnvelope) => {
341
+ * console.log('Configurator reset to default state:', data);
342
+ * });
343
+ *
344
+ * api.sendCommandToMetabox(new ResetConfiguration());
345
+ * };
346
+ */
347
+ class ResetConfiguration extends CommandBase {
348
+ constructor() {
349
+ super();
350
+ this.data = { action: MetaboxBasicConfiguratorActions.resetConfiguration };
351
+ }
352
+ }
353
+
310
354
  /**
311
355
  * Represents a command to apply zoom and change the camera zoom on a scene.
312
356
  * This class sends a command to the Metabox API to change zoom on a scene.
@@ -970,9 +1014,18 @@ class EventDispatcher {
970
1014
  * @param data - The data associated with the event.
971
1015
  */
972
1016
  dispatchEvent(messageType, data) {
973
- this.listeners
974
- .filter((listener) => listener.messageType === messageType)
975
- .forEach((listener) => listener.callback(data));
1017
+ // Allocation-free dispatch on the hot message path. The length snapshot
1018
+ // keeps the previous filter-snapshot semantics: listeners added during
1019
+ // dispatch are not invoked for this event, and removeEventListener
1020
+ // reassigns the array so the in-flight loop is unaffected.
1021
+ const listeners = this.listeners;
1022
+ const len = listeners.length;
1023
+ for (let i = 0; i < len; i++) {
1024
+ const listener = listeners[i];
1025
+ if (listener.messageType === messageType) {
1026
+ listener.callback(data);
1027
+ }
1028
+ }
976
1029
  return this;
977
1030
  }
978
1031
  /**
@@ -1086,7 +1139,7 @@ const MetaboxDomain = 'metabox.3dsource.com';
1086
1139
  */
1087
1140
  const BasicRouteUrl = 'metabox-configurator/basic';
1088
1141
 
1089
- const VERSION = '3.0.24';
1142
+ const VERSION = '3.0.26-dev.0';
1090
1143
 
1091
1144
  const communicatorMap = new Map();
1092
1145
  /**
@@ -1139,6 +1192,10 @@ class Communicator extends EventDispatcher {
1139
1192
  * @param apiReadyCallback - Called with the new Communicator once the Metabox is loaded.
1140
1193
  * @param {MetaboxEnvironment} environment - The environment in which the Communicator is running.
1141
1194
  * @param {MetaboxCommandConfig} config - optional initial config: standalone - if true - disable metabox custom template and all logic
1195
+ * @returns A cancel function that removes the handshake `message` listener.
1196
+ * `integrateMetabox` (the public entry point) calls this automatically when
1197
+ * a new integration supersedes a still-pending one, so direct internal
1198
+ * callers only need it for explicit early teardown. Idempotent.
1142
1199
  */
1143
1200
  static createInstance(apiReadyCallback, environment, config) {
1144
1201
  const startHandler = (event) => {
@@ -1149,6 +1206,7 @@ class Communicator extends EventDispatcher {
1149
1206
  }
1150
1207
  };
1151
1208
  window.addEventListener('message', startHandler);
1209
+ return () => window.removeEventListener('message', startHandler);
1152
1210
  }
1153
1211
  /**
1154
1212
  * Cleans up resources and stops listening for messages.
@@ -1182,6 +1240,8 @@ class Communicator extends EventDispatcher {
1182
1240
  const toMetaboxMessage = {
1183
1241
  host: MetaboxHost,
1184
1242
  envelope: { ...data },
1243
+ // Deprecated mirror of `envelope`. Kept as an independent clone so a
1244
+ // receiver mutating one cannot observably change the other.
1185
1245
  payload: { ...data },
1186
1246
  target: iframe?.contentWindow ? 'child' : 'metabox',
1187
1247
  apiVersion: VERSION,
@@ -1286,6 +1346,13 @@ const prepareIframeSrc = (configuratorId, config) => {
1286
1346
  return query ? `${base}?${query}` : base;
1287
1347
  };
1288
1348
 
1349
+ // Cancel for the previous integration's handshake listener while it is still
1350
+ // waiting for the iframe to load. A new integrateMetabox call supersedes it —
1351
+ // it already replaces the single embedded iframe — so a never-completed
1352
+ // handshake (failed load, SPA remount, retry) can't leak a window 'message'
1353
+ // listener for the page lifetime. Idempotent, so a completed handshake's
1354
+ // cancel is a harmless no-op here.
1355
+ let cancelPendingHandshake = null;
1289
1356
  /**
1290
1357
  * Integrates the Metabox Basic Configurator into the page by injecting an iframe and
1291
1358
  * initializing a Communicator instance for host-to-iframe messaging.
@@ -1334,6 +1401,12 @@ const prepareIframeSrc = (configuratorId, config) => {
1334
1401
  * @throws Error If the computed iframe URL is invalid or does not use HTTPS.
1335
1402
  * @throws Error If the container element with the provided id cannot be found.
1336
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
+ *
1337
1410
  * @example
1338
1411
  * import { integrateMetabox } from '@3dsource/metabox-front-api';
1339
1412
  *
@@ -1379,9 +1452,17 @@ function integrateMetabox(configuratorId, containerId, apiReadyCallback, config)
1379
1452
  if (existingIframe) {
1380
1453
  existingIframe.remove();
1381
1454
  }
1382
- Communicator.createInstance(apiReadyCallback, 'host', config);
1383
- const style = document.createElement('style');
1384
- 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 re-parses.
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 = `
1385
1466
  #${containerId} {
1386
1467
  width: 100%;
1387
1468
  height: 100%;
@@ -1389,7 +1470,8 @@ function integrateMetabox(configuratorId, containerId, apiReadyCallback, config)
1389
1470
  position: relative;
1390
1471
  }
1391
1472
  `;
1392
- document.head.appendChild(style);
1473
+ document.head.appendChild(style);
1474
+ }
1393
1475
  const iframe = document.createElement('iframe');
1394
1476
  iframe.setAttribute('allow', 'autoplay; fullscreen; encrypted-media');
1395
1477
  iframe.setAttribute('referrerPolicy', 'no-referrer-when-downgrade');
@@ -1400,6 +1482,7 @@ function integrateMetabox(configuratorId, containerId, apiReadyCallback, config)
1400
1482
  iframe.style.overflow = 'hidden';
1401
1483
  iframe.src = iframeSrc;
1402
1484
  container.appendChild(iframe);
1485
+ return cancel;
1403
1486
  }
1404
1487
 
1405
1488
  /**
@@ -1473,5 +1556,5 @@ function getUrlParams() {
1473
1556
  * Generated bundle index. Do not edit.
1474
1557
  */
1475
1558
 
1476
- export { AppLoaded, AppLoaded_V3, ApplyZoom, BasicRouteUrl, CommandBase, Communicator, EventDispatcher, GetCallToActionInformation, GetCamera, GetPdf, GetScreenshot, HideMeasurement, InitShowcase, Metabox, MetaboxBasicConfiguratorActions, MetaboxConfig, MetaboxDomain, MetaboxHost, MetaboxHost_V3, Metabox_V3, PauseShowcase, PlayShowcase, ResetCamera, ResetUserInactivityTimer, ResumeStream, SetCamera, SetEnvironment, SetEnvironmentMaterial, SetProduct, SetProductMaterial, ShowEmbeddedMenu, ShowMeasurement, ShowOverlayInterface, StopShowcase, UnrealCommand, VERSION, fromCommunicatorEvent, getUrlParams, integrateMetabox, prepareIframeSrc, saveImage, setUrlParams };
1559
+ export { AppLoaded, AppLoaded_V3, ApplyZoom, BasicRouteUrl, CommandBase, Communicator, EventDispatcher, GetCallToActionInformation, GetCamera, GetPdf, GetScreenshot, HideMeasurement, InitShowcase, Metabox, MetaboxBasicConfiguratorActions, MetaboxConfig, MetaboxDomain, MetaboxHost, MetaboxHost_V3, Metabox_V3, PauseShowcase, PlayShowcase, ResetCamera, ResetConfiguration, ResetUserInactivityTimer, ResumeStream, SetCamera, SetEnvironment, SetEnvironmentMaterial, SetProduct, SetProductMaterial, ShowEmbeddedMenu, ShowMeasurement, ShowOverlayInterface, StopShowcase, UnrealCommand, VERSION, fromCommunicatorEvent, getUrlParams, integrateMetabox, prepareIframeSrc, saveImage, setUrlParams };
1477
1560
  //# sourceMappingURL=3dsource-metabox-front-api.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"3dsource-metabox-front-api.mjs","sources":["../../../../projects/3dsource/metabox-front-api/src/lib/actions/CommandBase.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/fromCommunicatorEvent.ts","../../../../projects/3dsource/metabox-front-api/src/lib/interfaces/ToMetaboxMessagePayloads.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/MetaboxConfig.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/GetPdf.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/GetCallToActionInformation.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/GetCamera.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/SetCamera.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/ResetCamera.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/ApplyZoom.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/InitShowcase.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/PlayShowcase.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/UnrealCommand.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/PauseShowcase.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/StopShowcase.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/GetScreenshot.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/SetProduct.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/SetProductMaterial.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/SetEnvironment.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/SetEnvironmentMaterial.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/ShowEmbeddedMenu.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/ShowOverlayInterface.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/ShowMeasurement.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/HideMeasurement.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/ResumeStream.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/ResetUserInactivityTimer.ts","../../../../projects/3dsource/metabox-front-api/src/lib/helpers/event-dispatcher.ts","../../../../projects/3dsource/metabox-front-api/src/lib/constants/common.ts","../../../../projects/3dsource/metabox-front-api/src/lib/constants/version.ts","../../../../projects/3dsource/metabox-front-api/src/lib/helpers/communicator.ts","../../../../projects/3dsource/metabox-front-api/src/lib/helpers/prepare-iframe-src.ts","../../../../projects/3dsource/metabox-front-api/src/lib/helpers/integrate-metabox.ts","../../../../projects/3dsource/metabox-front-api/src/lib/helpers/save-image.ts","../../../../projects/3dsource/metabox-front-api/src/lib/helpers/url-utils.ts","../../../../projects/3dsource/metabox-front-api/src/3dsource-metabox-front-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 */\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 Basic 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 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 MetaboxBasicConfiguratorActions = {\n metaboxConfig: 'metaboxConfig',\n resumeStream: 'resumeStream',\n setEnvironment: 'setEnvironment',\n setEnvironmentMaterialById: 'setEnvironmentMaterialById',\n setProduct: 'setProduct',\n setProductMaterialById: 'setProductMaterialById',\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 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 MetaboxBasicConfiguratorActions}.\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 * MetaboxBasicConfiguratorActions like: \"metaboxConfig\" | \"setEnvironment\" | \"setEnvironmentMaterialById\" | ...\n */\nexport type ToMetaBoxActions =\n (typeof MetaboxBasicConfiguratorActions)[keyof typeof MetaboxBasicConfiguratorActions];\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 Basic Metabox API.\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 [MetaboxBasicConfiguratorActions.metaboxConfig]: {\n appId: string;\n config: MetaboxCommandConfig;\n };\n [MetaboxBasicConfiguratorActions.setProduct]: { productId: string };\n [MetaboxBasicConfiguratorActions.setEnvironment]: { id: string };\n [MetaboxBasicConfiguratorActions.getPdf]: void;\n [MetaboxBasicConfiguratorActions.getCallToActionInformation]: void;\n [MetaboxBasicConfiguratorActions.getScreenshot]: {\n format: MimeType;\n size?: { x: number; y: number };\n };\n [MetaboxBasicConfiguratorActions.setProductMaterialById]: {\n slotId: string;\n materialId: string;\n };\n [MetaboxBasicConfiguratorActions.setEnvironmentMaterialById]: {\n slotId: string;\n materialId: string;\n };\n [MetaboxBasicConfiguratorActions.showEmbeddedMenu]: { visible: boolean };\n [MetaboxBasicConfiguratorActions.showOverlayInterface]: { visible: boolean };\n [MetaboxBasicConfiguratorActions.getCamera]: void;\n [MetaboxBasicConfiguratorActions.setCamera]: {\n camera: CameraCommandPayload;\n };\n [MetaboxBasicConfiguratorActions.resetCamera]: void;\n [MetaboxBasicConfiguratorActions.applyZoom]: { zoom: number };\n [MetaboxBasicConfiguratorActions.initShowcase]: void;\n [MetaboxBasicConfiguratorActions.playShowcase]: void;\n [MetaboxBasicConfiguratorActions.pauseShowcase]: void;\n [MetaboxBasicConfiguratorActions.stopShowcase]: void;\n [MetaboxBasicConfiguratorActions.sendCommandToUnreal]: object;\n [MetaboxBasicConfiguratorActions.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 a 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 { MetaboxBasicConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to send Metabox Config to Metabox Basic 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: MetaboxBasicConfiguratorActions.metaboxConfig,\n payload: { appId, config },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to get a PDF from Metabox Basic 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-front-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n *\n * api.sendCommandToMetabox(new GetPdf());\n * };\n */\nexport class GetPdf extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxBasicConfiguratorActions.getPdf };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to get a Call To Action Information from Metabox Basic 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-front-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 Basic Configurator\n * api.sendCommandToMetabox(new GetCallToActionInformation());\n * };\n */\n\nexport class GetCallToActionInformation extends CommandBase {\n constructor() {\n super();\n this.data = {\n action: MetaboxBasicConfiguratorActions.getCallToActionInformation,\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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-front-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 */\n\nexport class GetCamera extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxBasicConfiguratorActions.getCamera };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport type { CameraCommandPayload } from '../interfaces';\nimport { MetaboxBasicConfiguratorActions } 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-front-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: MetaboxBasicConfiguratorActions.setCamera,\n payload: { camera },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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 product/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 SetProduct changes that may shift the focal point.\n *\n * @example\n * import { ResetCamera, Communicator } from '@3dsource/metabox-front-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: MetaboxBasicConfiguratorActions.resetCamera };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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-front-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: MetaboxBasicConfiguratorActions.applyZoom,\n payload: { zoom },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } from '../interfaces';\n\n/**\n * @remarks\n * Represents a command to initialize Showcase for a product scene and start a sequence for the product.\n * This class sends a command to the Metabox API to initialize showcase if the product has a sequence.\n * To check this, find the showcase property in the current product 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 product. 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-front-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: MetaboxBasicConfiguratorActions.initShowcase,\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to play Showcase for a product when it is already initialized and paused.\n * This class sends a command to the Metabox API to play showcase for a product 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-front-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 */\nexport class PlayShowcase extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxBasicConfiguratorActions.playShowcase };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } from '../interfaces';\n\n/**\n * @internal\n * @hidden\n * Represents a command to send Unreal command.\n *\n * @param {Object} payload - An raw command that will be sent into MetaBox Unreal Application.\n */\n\nexport class UnrealCommand extends CommandBase {\n constructor(payload: object) {\n super();\n this.data = {\n action: MetaboxBasicConfiguratorActions.sendCommandToUnreal,\n payload,\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to pause Showcase for a product when it is already initialized and playing.\n * This class sends a command to the Metabox API to pause showcase for a product 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-front-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 */\nexport class PauseShowcase extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxBasicConfiguratorActions.pauseShowcase };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to stop Showcase for a product 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 product 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-front-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: MetaboxBasicConfiguratorActions.stopShowcase };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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-front-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: MetaboxBasicConfiguratorActions.getScreenshot,\n payload: { format: mimeType, size },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to set a product by its ID.\n * This action sends a message to the Metabox API to set a product using the provided product ID.\n * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.\n *\n * ### What does it unlock?\n * Sets the active product in the Basic Configurator by its UUID. Triggers a full state update including\n * available materials, slots, showcase data, and environment compatibility.\n *\n * ### Practical Application\n * Selects which product to display in the 3D viewport. Takes a productId (UUID). Use to build product picker UIs,\n * deep-link to specific products, or switch products programmatically based on external catalog selections.\n * The configurator responds with a full ConfiguratorEnvelope via configuratorDataUpdated.\n *\n * ### AI Coding Best Practices\n * Call `api.sendCommandToMetabox(new SetProduct('product-uuid'))`. Get valid product IDs from\n * `configurator.products` in the configuratorDataUpdated envelope. Subscribe to configuratorDataUpdated\n * BEFORE sending the command. After switching products, material and environment selections may reset —\n * re-apply them if needed.\n *\n * @example\n * import { Communicator,ConfiguratorEnvelope } from '@3dsource/metabox-front-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:ConfiguratorEnvelope) => {\n * console.log('State updated after applied new product:', data);\n * });\n *\n * api.sendCommandToMetabox(new SetProduct(\n * 'ffea6b5c-3a8a-4f56-9417-e605acb5cca3'\n * ));\n * };\n *\n * @param {string} productId - The product ID.\n */\n\nexport class SetProduct extends CommandBase {\n constructor(productId: string) {\n super();\n this.data = {\n action: MetaboxBasicConfiguratorActions.setProduct,\n payload: { productId },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to set a 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 product slot. Simulates selecting a different material/finish from the menu\n * for a specific customizable surface on the product.\n *\n * ### Practical Application\n * Applies a material to a specific slot on the active product. Takes 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 product's slot definitions in the configuratorDataUpdated envelope —\n * check `product.slots` and each slot's `enabledMaterials` list. Pattern:\n * `new SetProductMaterial('slot-name', 'material-uuid')`. The referenced product must already be set.\n *\n * @example\n * import { Communicator,ConfiguratorEnvelope,SetProductMaterial } from '@3dsource/metabox-front-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:ConfiguratorEnvelope) => {\n * console.log('State updated after applied new material:', data);\n * });\n *\n * api.sendCommandToMetabox(new SetProductMaterial(\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 SetProductMaterial extends CommandBase {\n constructor(slotId: string, materialId: string) {\n super();\n this.data = {\n action: MetaboxBasicConfiguratorActions.setProductMaterialById,\n payload: { slotId, materialId },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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 product during initialization. Each environment has\n * its own material slots, thumbnails, and lighting properties.\n *\n * @example\n * import { Communicator,ConfiguratorEnvelope } from '@3dsource/metabox-front-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:ConfiguratorEnvelope) => {\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: MetaboxBasicConfiguratorActions.setEnvironment,\n payload: { id: environmentId },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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,ConfiguratorEnvelope } from '@3dsource/metabox-front-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:ConfiguratorEnvelope) => {\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: MetaboxBasicConfiguratorActions.setEnvironmentMaterialById,\n payload: { slotId, materialId },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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-front-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: MetaboxBasicConfiguratorActions.showEmbeddedMenu,\n payload: { visible },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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-front-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: MetaboxBasicConfiguratorActions.showOverlayInterface,\n payload: { visible },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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-front-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: MetaboxBasicConfiguratorActions.showMeasurement };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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-front-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: MetaboxBasicConfiguratorActions.hideMeasurement };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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 product/environment state.\n *\n * @example\n * import { ResumeStream, Communicator } from '@3dsource/metabox-front-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: MetaboxBasicConfiguratorActions.resumeStream };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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-front-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: MetaboxBasicConfiguratorActions.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 * Indicates when the application has completed initialization.\n *\n * ### Practical Application\n * App initialization flag variable. Signals when MetaBox has completed loading. Use the viewportReady event\n * (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:\n * `api.addEventListener('viewportReady', (ready) => { if(ready) enableUI(); })`.\n * viewportReady with true value is the reliable signal that MetaBox PixelStreaming is become visible.\n *\n * @internal\n */\nexport const AppLoaded = 'appLoaded';\n\n/**\n * Default production domain for the Metabox Basic Configurator.\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 * The base domain used when no override is specified. Override only via IntegrateMetaboxConfig.domain\n * 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' })`.\n * HTTPS is mandatory — HTTP will be rejected.\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 path appended to the domain when building the configurator iframe URL.\n *\n * ### What does it unlock?\n * Base route URL constant used for loading the configurator. Standard path endpoint for accessing the configurator.\n *\n * ### Practical Application\n * The configurator URL format is: `https://{domain}/metabox-configurator/basic/{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).\n */\nexport const BasicRouteUrl = 'metabox-configurator/basic';\n","export const VERSION = '3.0.24';\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 * Singleton reference to the current communicator instance.\n */\n public static instance: Communicator | null = null;\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 ): void {\n const startHandler = (event: MessageEvent): void => {\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): void {\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): void {\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 {MessageEvent} event - The postMessage event received on a window.\n */\n private handleMessageReceived<T extends FromMetaBoxApiEvents>(\n event: MessageEvent,\n ): void {\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 Basic 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/basic/{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 basic configurators use `/basic/` 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 Basic 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 (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 product, then environment\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) SetProduct, 3) SetEnvironment.\n *\n * @param {string} configuratorId - The Basic Configurator ID (not a full URL). It is appended to\n * `https://{domain}/metabox-configurator/basic/{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-front-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-front-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 * Sets the URL parameters based on the provided state.\n *\n * @internal\n * @hidden\n * This function updates the current URL by replacing its search parameters with the key-value pairs from the provided state object.\n *\n * @param {Record<string, string>} state - An object containing key-value pairs to set as URL parameters.\n */\nexport function setUrlParams(state: Record<string, string>): void {\n const url = new URL(window.location.href);\n url.search = '';\n Object.entries(state).forEach(([key, value]) => {\n url.searchParams.set(key, value);\n });\n history.replaceState(null, '', url.toString());\n}\n\n/**\n * Retrieves the URL parameters as an object.\n *\n * @remarks\n * @internal\n * @hidden\n * This function parses the current URL's search parameters and returns them as a key-value object.\n *\n * @returns An object containing the URL parameters.\n */\nexport function getUrlParams(): Record<string, string> {\n const urlParams = new URLSearchParams(window.location.search);\n const selections: Record<string, string> = {};\n urlParams.forEach((value, key) => {\n selections[key] = value;\n });\n return selections;\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;AAEG,SAAU,qBAAqB,CACnC,MAAoB,EACpB,SAAY,EAAA;AAEZ,IAAA,OAAO,SAAS,CAAC,MAAM,EAAE,SAAS,CAEjC;AACH;;AChCA;;;;;;;;;;;;;;;AAeG;AACI,MAAM,+BAA+B,GAAG;AAC7C,IAAA,aAAa,EAAE,eAAe;AAC9B,IAAA,YAAY,EAAE,cAAc;AAC5B,IAAA,cAAc,EAAE,gBAAgB;AAChC,IAAA,0BAA0B,EAAE,4BAA4B;AACxD,IAAA,UAAU,EAAE,YAAY;AACxB,IAAA,sBAAsB,EAAE,wBAAwB;AAChD,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,SAAS,EAAE,WAAW;AACtB,IAAA,YAAY,EAAE,cAAc;AAC5B,IAAA,YAAY,EAAE,cAAc;AAC5B,IAAA,aAAa,EAAE,eAAe;AAC9B,IAAA,YAAY,EAAE,cAAc;AAC5B,IAAA,mBAAmB,EAAE,qBAAqB;AAC1C,IAAA,eAAe,EAAE,iBAAiB;AAClC,IAAA,eAAe,EAAE,iBAAiB;AAClC,IAAA,wBAAwB,EAAE,0BAA0B;;;ACvCtD;;;;;;;;;;;;;;;;;;;;;AAqBG;AAEG,MAAO,aAAc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B,EAAE;IAC7C,SAAS,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,KAAI;AAC/B,QAAA,UAAU,CAAC,GAAG,CAAC,GAAG,KAAK;AACzB,IAAA,CAAC,CAAC;AACF,IAAA,OAAO,UAAU;AACnB;;ACnCA;;AAEG;;;;"}
1
+ {"version":3,"file":"3dsource-metabox-front-api.mjs","sources":["../../../../projects/3dsource/metabox-front-api/src/lib/actions/CommandBase.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/fromCommunicatorEvent.ts","../../../../projects/3dsource/metabox-front-api/src/lib/interfaces/ToMetaboxMessagePayloads.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/MetaboxConfig.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/GetPdf.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/GetCallToActionInformation.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/GetCamera.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/SetCamera.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/ResetCamera.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/ResetConfiguration.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/ApplyZoom.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/InitShowcase.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/PlayShowcase.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/UnrealCommand.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/PauseShowcase.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/StopShowcase.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/GetScreenshot.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/SetProduct.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/SetProductMaterial.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/SetEnvironment.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/SetEnvironmentMaterial.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/ShowEmbeddedMenu.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/ShowOverlayInterface.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/ShowMeasurement.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/HideMeasurement.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/ResumeStream.ts","../../../../projects/3dsource/metabox-front-api/src/lib/actions/ResetUserInactivityTimer.ts","../../../../projects/3dsource/metabox-front-api/src/lib/helpers/event-dispatcher.ts","../../../../projects/3dsource/metabox-front-api/src/lib/constants/common.ts","../../../../projects/3dsource/metabox-front-api/src/lib/constants/version.ts","../../../../projects/3dsource/metabox-front-api/src/lib/helpers/communicator.ts","../../../../projects/3dsource/metabox-front-api/src/lib/helpers/prepare-iframe-src.ts","../../../../projects/3dsource/metabox-front-api/src/lib/helpers/integrate-metabox.ts","../../../../projects/3dsource/metabox-front-api/src/lib/helpers/save-image.ts","../../../../projects/3dsource/metabox-front-api/src/lib/helpers/url-utils.ts","../../../../projects/3dsource/metabox-front-api/src/3dsource-metabox-front-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 */\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 Basic 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 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 MetaboxBasicConfiguratorActions = {\n metaboxConfig: 'metaboxConfig',\n resumeStream: 'resumeStream',\n setEnvironment: 'setEnvironment',\n setEnvironmentMaterialById: 'setEnvironmentMaterialById',\n setProduct: 'setProduct',\n setProductMaterialById: 'setProductMaterialById',\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 MetaboxBasicConfiguratorActions}.\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 * MetaboxBasicConfiguratorActions like: \"metaboxConfig\" | \"setEnvironment\" | \"setEnvironmentMaterialById\" | ...\n */\nexport type ToMetaBoxActions =\n (typeof MetaboxBasicConfiguratorActions)[keyof typeof MetaboxBasicConfiguratorActions];\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 Basic Metabox API.\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 [MetaboxBasicConfiguratorActions.metaboxConfig]: {\n appId: string;\n config: MetaboxCommandConfig;\n };\n [MetaboxBasicConfiguratorActions.setProduct]: { productId: string };\n [MetaboxBasicConfiguratorActions.setEnvironment]: { id: string };\n [MetaboxBasicConfiguratorActions.getPdf]: void;\n [MetaboxBasicConfiguratorActions.getCallToActionInformation]: void;\n [MetaboxBasicConfiguratorActions.getScreenshot]: {\n format: MimeType;\n size?: { x: number; y: number };\n };\n [MetaboxBasicConfiguratorActions.setProductMaterialById]: {\n slotId: string;\n materialId: string;\n };\n [MetaboxBasicConfiguratorActions.setEnvironmentMaterialById]: {\n slotId: string;\n materialId: string;\n };\n [MetaboxBasicConfiguratorActions.showEmbeddedMenu]: { visible: boolean };\n [MetaboxBasicConfiguratorActions.showOverlayInterface]: { visible: boolean };\n [MetaboxBasicConfiguratorActions.getCamera]: void;\n [MetaboxBasicConfiguratorActions.setCamera]: {\n camera: CameraCommandPayload;\n };\n [MetaboxBasicConfiguratorActions.resetCamera]: void;\n [MetaboxBasicConfiguratorActions.resetConfiguration]: void;\n [MetaboxBasicConfiguratorActions.applyZoom]: { zoom: number };\n [MetaboxBasicConfiguratorActions.initShowcase]: void;\n [MetaboxBasicConfiguratorActions.playShowcase]: void;\n [MetaboxBasicConfiguratorActions.pauseShowcase]: void;\n [MetaboxBasicConfiguratorActions.stopShowcase]: void;\n [MetaboxBasicConfiguratorActions.sendCommandToUnreal]: object;\n [MetaboxBasicConfiguratorActions.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 a 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 { MetaboxBasicConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to send Metabox Config to Metabox Basic 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: MetaboxBasicConfiguratorActions.metaboxConfig,\n payload: { appId, config },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to get a PDF from Metabox Basic 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-front-api';\n * window.env3DSource.apiReady = (api: Communicator) => {\n *\n * api.sendCommandToMetabox(new GetPdf());\n * };\n */\nexport class GetPdf extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxBasicConfiguratorActions.getPdf };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to get a Call To Action Information from Metabox Basic 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-front-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 Basic Configurator\n * api.sendCommandToMetabox(new GetCallToActionInformation());\n * };\n */\n\nexport class GetCallToActionInformation extends CommandBase {\n constructor() {\n super();\n this.data = {\n action: MetaboxBasicConfiguratorActions.getCallToActionInformation,\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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-front-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 */\n\nexport class GetCamera extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxBasicConfiguratorActions.getCamera };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport type { CameraCommandPayload } from '../interfaces';\nimport { MetaboxBasicConfiguratorActions } 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-front-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: MetaboxBasicConfiguratorActions.setCamera,\n payload: { camera },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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 product/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 SetProduct changes that may shift the focal point.\n *\n * @example\n * import { ResetCamera, Communicator } from '@3dsource/metabox-front-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: MetaboxBasicConfiguratorActions.resetCamera };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to reset the configurator state to its defaults.\n * This class sends a message to the Metabox API to restore product, materials,\n * and environment selections 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 configurator state to defaults — product, product materials, environment, and\n * environment materials all return to the template-defined initial values. Used to give users a clean\n * 'Start Over' affordance without reloading the iframe.\n *\n * ### Practical Application\n * Powers 'Reset to Defaults' / 'Start Over' buttons in product configurators. Unlike ResetCamera (which\n * only touches viewport state), ResetConfiguration wipes all user-applied selections back to template\n * defaults. The configurator responds with a full ConfiguratorEnvelope via configuratorDataUpdated, so\n * UI state derived from the envelope (selected swatches, current product, environment chips) will\n * 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. Pair with ResetCamera if\n * you also want the viewport returned to its default framing.\n *\n * @example\n * import { ResetConfiguration, Communicator, ConfiguratorEnvelope } from '@3dsource/metabox-front-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: ConfiguratorEnvelope) => {\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 = { action: MetaboxBasicConfiguratorActions.resetConfiguration };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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-front-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: MetaboxBasicConfiguratorActions.applyZoom,\n payload: { zoom },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } from '../interfaces';\n\n/**\n * @remarks\n * Represents a command to initialize Showcase for a product scene and start a sequence for the product.\n * This class sends a command to the Metabox API to initialize showcase if the product has a sequence.\n * To check this, find the showcase property in the current product 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 product. 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-front-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: MetaboxBasicConfiguratorActions.initShowcase,\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to play Showcase for a product when it is already initialized and paused.\n * This class sends a command to the Metabox API to play showcase for a product 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-front-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 */\nexport class PlayShowcase extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxBasicConfiguratorActions.playShowcase };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } from '../interfaces';\n\n/**\n * @internal\n * @hidden\n * Represents a command to send Unreal command.\n *\n * @param {Object} payload - An raw command that will be sent into MetaBox Unreal Application.\n */\n\nexport class UnrealCommand extends CommandBase {\n constructor(payload: object) {\n super();\n this.data = {\n action: MetaboxBasicConfiguratorActions.sendCommandToUnreal,\n payload,\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to pause Showcase for a product when it is already initialized and playing.\n * This class sends a command to the Metabox API to pause showcase for a product 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-front-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 */\nexport class PauseShowcase extends CommandBase {\n constructor() {\n super();\n this.data = { action: MetaboxBasicConfiguratorActions.pauseShowcase };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to stop Showcase for a product 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 product 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-front-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: MetaboxBasicConfiguratorActions.stopShowcase };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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-front-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: MetaboxBasicConfiguratorActions.getScreenshot,\n payload: { format: mimeType, size },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to set a product by its ID.\n * This action sends a message to the Metabox API to set a product using the provided product ID.\n * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.\n *\n * ### What does it unlock?\n * Sets the active product in the Basic Configurator by its UUID. Triggers a full state update including\n * available materials, slots, showcase data, and environment compatibility.\n *\n * ### Practical Application\n * Selects which product to display in the 3D viewport. Takes a productId (UUID). Use to build product picker UIs,\n * deep-link to specific products, or switch products programmatically based on external catalog selections.\n * The configurator responds with a full ConfiguratorEnvelope via configuratorDataUpdated.\n *\n * ### AI Coding Best Practices\n * Call `api.sendCommandToMetabox(new SetProduct('product-uuid'))`. Get valid product IDs from\n * `configurator.products` in the configuratorDataUpdated envelope. Subscribe to configuratorDataUpdated\n * BEFORE sending the command. After switching products, material and environment selections may reset —\n * re-apply them if needed.\n *\n * @example\n * import { Communicator,ConfiguratorEnvelope } from '@3dsource/metabox-front-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:ConfiguratorEnvelope) => {\n * console.log('State updated after applied new product:', data);\n * });\n *\n * api.sendCommandToMetabox(new SetProduct(\n * 'ffea6b5c-3a8a-4f56-9417-e605acb5cca3'\n * ));\n * };\n *\n * @param {string} productId - The product ID.\n */\n\nexport class SetProduct extends CommandBase {\n constructor(productId: string) {\n super();\n this.data = {\n action: MetaboxBasicConfiguratorActions.setProduct,\n payload: { productId },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } from '../interfaces';\n\n/**\n * Represents a command to set a 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 product slot. Simulates selecting a different material/finish from the menu\n * for a specific customizable surface on the product.\n *\n * ### Practical Application\n * Applies a material to a specific slot on the active product. Takes 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 product's slot definitions in the configuratorDataUpdated envelope —\n * check `product.slots` and each slot's `enabledMaterials` list. Pattern:\n * `new SetProductMaterial('slot-name', 'material-uuid')`. The referenced product must already be set.\n *\n * @example\n * import { Communicator,ConfiguratorEnvelope,SetProductMaterial } from '@3dsource/metabox-front-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:ConfiguratorEnvelope) => {\n * console.log('State updated after applied new material:', data);\n * });\n *\n * api.sendCommandToMetabox(new SetProductMaterial(\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 SetProductMaterial extends CommandBase {\n constructor(slotId: string, materialId: string) {\n super();\n this.data = {\n action: MetaboxBasicConfiguratorActions.setProductMaterialById,\n payload: { slotId, materialId },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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 product during initialization. Each environment has\n * its own material slots, thumbnails, and lighting properties.\n *\n * @example\n * import { Communicator,ConfiguratorEnvelope } from '@3dsource/metabox-front-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:ConfiguratorEnvelope) => {\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: MetaboxBasicConfiguratorActions.setEnvironment,\n payload: { id: environmentId },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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,ConfiguratorEnvelope } from '@3dsource/metabox-front-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:ConfiguratorEnvelope) => {\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: MetaboxBasicConfiguratorActions.setEnvironmentMaterialById,\n payload: { slotId, materialId },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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-front-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: MetaboxBasicConfiguratorActions.showEmbeddedMenu,\n payload: { visible },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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-front-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: MetaboxBasicConfiguratorActions.showOverlayInterface,\n payload: { visible },\n };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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-front-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: MetaboxBasicConfiguratorActions.showMeasurement };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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-front-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: MetaboxBasicConfiguratorActions.hideMeasurement };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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 product/environment state.\n *\n * @example\n * import { ResumeStream, Communicator } from '@3dsource/metabox-front-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: MetaboxBasicConfiguratorActions.resumeStream };\n }\n}\n","import { CommandBase } from './CommandBase';\nimport { MetaboxBasicConfiguratorActions } 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-front-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: MetaboxBasicConfiguratorActions.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 * Indicates when the application has completed initialization.\n *\n * ### Practical Application\n * App initialization flag variable. Signals when MetaBox has completed loading. Use the viewportReady event\n * (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:\n * `api.addEventListener('viewportReady', (ready) => { if(ready) enableUI(); })`.\n * viewportReady with true value is the reliable signal that MetaBox PixelStreaming is become visible.\n *\n * @internal\n */\nexport const AppLoaded = 'appLoaded';\n\n/**\n * Default production domain for the Metabox Basic Configurator.\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 * The base domain used when no override is specified. Override only via IntegrateMetaboxConfig.domain\n * 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' })`.\n * HTTPS is mandatory — HTTP will be rejected.\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 path appended to the domain when building the configurator iframe URL.\n *\n * ### What does it unlock?\n * Base route URL constant used for loading the configurator. Standard path endpoint for accessing the configurator.\n *\n * ### Practical Application\n * The configurator URL format is: `https://{domain}/metabox-configurator/basic/{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).\n */\nexport const BasicRouteUrl = 'metabox-configurator/basic';\n","export const VERSION = '3.0.26-dev.0';\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 * Singleton reference to the current communicator instance.\n */\n public static instance: Communicator | null = null;\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): void => {\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): void {\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): void {\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 {MessageEvent} event - The postMessage event received on a window.\n */\n private handleMessageReceived<T extends FromMetaBoxApiEvents>(\n event: MessageEvent,\n ): void {\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 Basic 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/basic/{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 basic configurators use `/basic/` 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 Basic 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 (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 product, then environment\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) SetProduct, 3) SetEnvironment.\n *\n * @param {string} configuratorId - The Basic Configurator ID (not a full URL). It is appended to\n * `https://{domain}/metabox-configurator/basic/{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-front-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 re-parses.\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-front-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 * Sets the URL parameters based on the provided state.\n *\n * @internal\n * @hidden\n * This function updates the current URL by replacing its search parameters with the key-value pairs from the provided state object.\n *\n * @param {Record<string, string>} state - An object containing key-value pairs to set as URL parameters.\n */\nexport function setUrlParams(state: Record<string, string>): void {\n const url = new URL(window.location.href);\n url.search = '';\n Object.entries(state).forEach(([key, value]) => {\n url.searchParams.set(key, value);\n });\n history.replaceState(null, '', url.toString());\n}\n\n/**\n * Retrieves the URL parameters as an object.\n *\n * @remarks\n * @internal\n * @hidden\n * This function parses the current URL's search parameters and returns them as a key-value object.\n *\n * @returns An object containing the URL parameters.\n */\nexport function getUrlParams(): Record<string, string> {\n const urlParams = new URLSearchParams(window.location.search);\n const selections: Record<string, string> = {};\n urlParams.forEach((value, key) => {\n selections[key] = value;\n });\n return selections;\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;AAEG,SAAU,qBAAqB,CACnC,MAAoB,EACpB,SAAY,EAAA;AAEZ,IAAA,OAAO,SAAS,CAAC,MAAM,EAAE,SAAS,CAEjC;AACH;;AChCA;;;;;;;;;;;;;;;AAeG;AACI,MAAM,+BAA+B,GAAG;AAC7C,IAAA,aAAa,EAAE,eAAe;AAC9B,IAAA,YAAY,EAAE,cAAc;AAC5B,IAAA,cAAc,EAAE,gBAAgB;AAChC,IAAA,0BAA0B,EAAE,4BAA4B;AACxD,IAAA,UAAU,EAAE,YAAY;AACxB,IAAA,sBAAsB,EAAE,wBAAwB;AAChD,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,0BAA0B,EAAE,4BAA4B;AACxD,IAAA,aAAa,EAAE,eAAe;AAC9B,IAAA,gBAAgB,EAAE,kBAAkB;AACpC,IAAA,oBAAoB,EAA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,GAAA;IAC1B,MAAM,SAAS,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC7D,MAAM,UAAU,GAA2B,EAAE;IAC7C,SAAS,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,KAAI;AAC/B,QAAA,UAAU,CAAC,GAAG,CAAC,GAAG,KAAK;AACzB,IAAA,CAAC,CAAC;AACF,IAAA,OAAO,UAAU;AACnB;;ACnCA;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3dsource/metabox-front-api",
3
- "version": "3.0.24",
3
+ "version": "3.0.26-dev.0",
4
4
  "description": "API for Metabox BASIC configurator",
5
5
  "keywords": [
6
6
  "metabox",
@@ -19,8 +19,7 @@
19
19
  "tslib": "^2.8.1"
20
20
  },
21
21
  "engines": {
22
- "node": ">=20",
23
- "npm": ">9"
22
+ "node": ">=20"
24
23
  },
25
24
  "module": "fesm2022/3dsource-metabox-front-api.mjs",
26
25
  "typings": "types/3dsource-metabox-front-api.d.ts",
@@ -99,7 +99,7 @@ declare const MetaboxDomain = "metabox.3dsource.com";
99
99
  */
100
100
  declare const BasicRouteUrl = "metabox-configurator/basic";
101
101
 
102
- declare const VERSION = "3.0.24";
102
+ declare const VERSION = "3.0.26-dev.0";
103
103
 
104
104
  /**
105
105
  * Configuration options for integrating the Metabox Basic Configurator iframe into a host page.
@@ -196,6 +196,7 @@ declare const MetaboxBasicConfiguratorActions: {
196
196
  readonly getCamera: "getCamera";
197
197
  readonly setCamera: "setCamera";
198
198
  readonly resetCamera: "resetCamera";
199
+ readonly resetConfiguration: "resetConfiguration";
199
200
  readonly applyZoom: "applyZoom";
200
201
  readonly initShowcase: "initShowcase";
201
202
  readonly playShowcase: "playShowcase";
@@ -279,6 +280,7 @@ interface ToMetaboxMessagePayloads {
279
280
  camera: CameraCommandPayload;
280
281
  };
281
282
  [MetaboxBasicConfiguratorActions.resetCamera]: void;
283
+ [MetaboxBasicConfiguratorActions.resetConfiguration]: void;
282
284
  [MetaboxBasicConfiguratorActions.applyZoom]: {
283
285
  zoom: number;
284
286
  };
@@ -1165,8 +1167,12 @@ declare class Communicator extends EventDispatcher {
1165
1167
  * @param apiReadyCallback - Called with the new Communicator once the Metabox is loaded.
1166
1168
  * @param {MetaboxEnvironment} environment - The environment in which the Communicator is running.
1167
1169
  * @param {MetaboxCommandConfig} config - optional initial config: standalone - if true - disable metabox custom template and all logic
1170
+ * @returns A cancel function that removes the handshake `message` listener.
1171
+ * `integrateMetabox` (the public entry point) calls this automatically when
1172
+ * a new integration supersedes a still-pending one, so direct internal
1173
+ * callers only need it for explicit early teardown. Idempotent.
1168
1174
  */
1169
- static createInstance(apiReadyCallback: (api: Communicator) => void, environment: MetaboxEnvironment, config?: Partial<MetaboxCommandConfig>): void;
1175
+ static createInstance(apiReadyCallback: (api: Communicator) => void, environment: MetaboxEnvironment, config?: Partial<MetaboxCommandConfig>): () => void;
1170
1176
  /**
1171
1177
  * Cleans up resources and stops listening for messages.
1172
1178
  */
@@ -1261,6 +1267,12 @@ declare class Communicator extends EventDispatcher {
1261
1267
  * @throws Error If the computed iframe URL is invalid or does not use HTTPS.
1262
1268
  * @throws Error If the container element with the provided id cannot be found.
1263
1269
  *
1270
+ * @returns A cancel function that stops waiting for the Metabox to load.
1271
+ * Calling it is optional — a later `integrateMetabox` call automatically
1272
+ * supersedes a still-pending handshake — but it lets you remove the handshake
1273
+ * listener immediately on teardown (e.g. SPA route change before
1274
+ * `apiReadyCallback` fires). Idempotent.
1275
+ *
1264
1276
  * @example
1265
1277
  * import { integrateMetabox } from '@3dsource/metabox-front-api';
1266
1278
  *
@@ -1280,7 +1292,7 @@ declare class Communicator extends EventDispatcher {
1280
1292
  * },
1281
1293
  * );
1282
1294
  */
1283
- declare function integrateMetabox(configuratorId: string, containerId: string, apiReadyCallback: (api: Communicator) => void, config?: IntegrateMetaboxConfig): void;
1295
+ declare function integrateMetabox(configuratorId: string, containerId: string, apiReadyCallback: (api: Communicator) => void, config?: IntegrateMetaboxConfig): () => void;
1284
1296
 
1285
1297
  /**
1286
1298
  * Saves an image by triggering a download.
@@ -1567,6 +1579,46 @@ declare class ResetCamera extends CommandBase {
1567
1579
  constructor();
1568
1580
  }
1569
1581
 
1582
+ /**
1583
+ * Represents a command to reset the configurator state to its defaults.
1584
+ * This class sends a message to the Metabox API to restore product, materials,
1585
+ * and environment selections to the values defined by the configurator template.
1586
+ * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.
1587
+ *
1588
+ * ### What does it unlock?
1589
+ * Resets the entire configurator state to defaults — product, product materials, environment, and
1590
+ * environment materials all return to the template-defined initial values. Used to give users a clean
1591
+ * 'Start Over' affordance without reloading the iframe.
1592
+ *
1593
+ * ### Practical Application
1594
+ * Powers 'Reset to Defaults' / 'Start Over' buttons in product configurators. Unlike ResetCamera (which
1595
+ * only touches viewport state), ResetConfiguration wipes all user-applied selections back to template
1596
+ * defaults. The configurator responds with a full ConfiguratorEnvelope via configuratorDataUpdated, so
1597
+ * UI state derived from the envelope (selected swatches, current product, environment chips) will
1598
+ * re-sync automatically.
1599
+ *
1600
+ * ### AI Coding Best Practices
1601
+ * Call `api.sendCommandToMetabox(new ResetConfiguration())`. No parameters. Subscribe to
1602
+ * configuratorDataUpdated BEFORE sending so you capture the reset envelope. If your UI maintains local
1603
+ * selection state separate from the envelope, clear it in the same handler. Pair with ResetCamera if
1604
+ * you also want the viewport returned to its default framing.
1605
+ *
1606
+ * @example
1607
+ * import { ResetConfiguration, Communicator, ConfiguratorEnvelope } from '@3dsource/metabox-front-api';
1608
+ * window.env3DSource.apiReady = (api: Communicator) => {
1609
+ *
1610
+ * //Subscribe to the event before sending the command to ensure you capture the response
1611
+ * api.addEventListener('configuratorDataUpdated', (data: ConfiguratorEnvelope) => {
1612
+ * console.log('Configurator reset to default state:', data);
1613
+ * });
1614
+ *
1615
+ * api.sendCommandToMetabox(new ResetConfiguration());
1616
+ * };
1617
+ */
1618
+ declare class ResetConfiguration extends CommandBase {
1619
+ constructor();
1620
+ }
1621
+
1570
1622
  /**
1571
1623
  * Represents a command to apply zoom and change the camera zoom on a scene.
1572
1624
  * This class sends a command to the Metabox API to change zoom on a scene.
@@ -2122,5 +2174,5 @@ declare class ResetUserInactivityTimer extends CommandBase {
2122
2174
  constructor();
2123
2175
  }
2124
2176
 
2125
- export { AppLoaded, AppLoaded_V3, ApplyZoom, BasicRouteUrl, CommandBase, Communicator, EventDispatcher, GetCallToActionInformation, GetCamera, GetPdf, GetScreenshot, HideMeasurement, InitShowcase, Metabox, MetaboxBasicConfiguratorActions, MetaboxConfig, MetaboxDomain, MetaboxHost, MetaboxHost_V3, Metabox_V3, PauseShowcase, PlayShowcase, ResetCamera, ResetUserInactivityTimer, ResumeStream, SetCamera, SetEnvironment, SetEnvironmentMaterial, SetProduct, SetProductMaterial, ShowEmbeddedMenu, ShowMeasurement, ShowOverlayInterface, StopShowcase, UnrealCommand, VERSION, fromCommunicatorEvent, getUrlParams, integrateMetabox, prepareIframeSrc, saveImage, setUrlParams };
2177
+ export { AppLoaded, AppLoaded_V3, ApplyZoom, BasicRouteUrl, CommandBase, Communicator, EventDispatcher, GetCallToActionInformation, GetCamera, GetPdf, GetScreenshot, HideMeasurement, InitShowcase, Metabox, MetaboxBasicConfiguratorActions, MetaboxConfig, MetaboxDomain, MetaboxHost, MetaboxHost_V3, Metabox_V3, PauseShowcase, PlayShowcase, ResetCamera, ResetConfiguration, ResetUserInactivityTimer, ResumeStream, SetCamera, SetEnvironment, SetEnvironmentMaterial, SetProduct, SetProductMaterial, ShowEmbeddedMenu, ShowMeasurement, ShowOverlayInterface, StopShowcase, UnrealCommand, VERSION, fromCommunicatorEvent, getUrlParams, integrateMetabox, prepareIframeSrc, saveImage, setUrlParams };
2126
2178
  export type { CameraCommandPayload, ConfiguratorEnvelope, Cta, EcomConfigurator, Environment, FromMetaBoxAPIEnvelope, FromMetaBoxApiEvents, FromMetaBoxMessage, FromMetaboxMessagePayloads, FromMetaboxTarget, IntegrateMetaboxConfig, Listener, MCAppLoaded, Material, MetaBoxApiEnvelope, MetaProperty, MetaboxCommandConfig, MetaboxEnvironment, MimeType, Product, SelectedIds, ShowCaseStatus, Showcase, Slot, Thumbnail, Timecode, ToMetaBoxActions, ToMetaBoxMessage, ToMetaBoxMessageEnvelope, ToMetaboxMessagePayload, ToMetaboxMessagePayloads, ToMetaboxTarget, UniversalConfigurator, UniversalConfiguratorEnvironment, UniversalConfiguratorProduct, VideoResolution, VideoStats };