@3dsource/metabox-front-api 3.0.16-dev.3 → 3.0.16-dev.6

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.
@@ -1,15 +1,111 @@
1
1
  import { Observable } from 'rxjs';
2
2
 
3
+ /**
4
+ * Device type identifiers used by {@link ForceSetDeviceType} to override the auto-detected device.
5
+ *
6
+ * - `'deviceTypeAuto'` — let the configurator detect the device automatically.
7
+ * - `'deviceTypeMobile'` — force mobile layout and controls.
8
+ * - `'deviceTypeDesktop'` — force desktop layout and controls.
9
+ *
10
+ * ### What does it unlock?
11
+ * Type alias defining available application device types (desktop, mobile, etc.). Specifies supported device targets.
12
+ *
13
+ * ### Practical Application
14
+ * Used by MetaBox for responsive rendering behavior. Typically auto-detected — only override with
15
+ * ForceSetDeviceType for specific kiosk or showroom setups.
16
+ *
17
+ * ### AI Coding Best Practices
18
+ * Prefer auto-detection. Use standard browser APIs for your own responsive logic. Only reference this type
19
+ * if you need to force a device mode via ForceSetDeviceType, which is likely deprecated.
20
+ */
3
21
  type ApplicationDeviceTypes = 'deviceTypeAuto' | 'deviceTypeMobile' | 'deviceTypeDesktop';
4
22
 
5
23
  /**
6
24
  * @internal
7
25
  * @hidden
8
- * Represents main constants.
26
+ * Core constants used for host-to-iframe communication and URL construction.
27
+ */
28
+ /**
29
+ * Storage key for the Metabox Communicator instance registry.
30
+ *
31
+ * ### What does it unlock?
32
+ * Constant string identifier for MetaBox version. Used internally to reference the MetaBox system and versioning.
33
+ *
34
+ * ### Practical Application
35
+ * Internal system reference for versioning.
36
+ * Not needed in front-end application code.
37
+ *
38
+ * ### AI Coding Best Practices
39
+ * Skip in application code. This constant is for internal MetaBox system identification only.
40
+ *
41
+ * @internal
42
+ */
43
+ declare const Metabox = "metabox_v3";
44
+ /**
45
+ * Identifier used as the `host` field in postMessage envelopes sent to the iframe.
46
+ *
47
+ * ### What does it unlock?
48
+ * Constant for the MetaBox host connection point. Specifies endpoint for MetaBox connections.
49
+ *
50
+ * ### Practical Application
51
+ * MetaBox endpoint constant. The host the configurator iframe connects to for Unreal Engine pixel streaming.
52
+ * Not needed in front-end application code.
53
+ *
54
+ * ### AI Coding Best Practices
55
+ * Skip in application code. This constant is for internal MetaBox system identification only.
56
+ *
57
+ * @internal
9
58
  */
10
- declare const Metabox = "metabox";
11
59
  declare const MetaboxHost = "metaboxHost";
60
+ /**
61
+ * Identifier used as the `host` field in postMessage envelopes received from the iframe.
62
+ *
63
+ * ### What does it unlock?
64
+ * Constant identifier used internally to reference and compare MetaBox data. Used for data validation and internal routing.
65
+ *
66
+ * ### Practical Application
67
+ * Internal data reference constant used for validation and message routing within the communication layer.
68
+ * Not needed in front-end application code.
69
+ *
70
+ * ### AI Coding Best Practices
71
+ * Skip in application code. Only relevant if debugging very low-level message traffic between your app and the MetaBox iframe.
72
+ *
73
+ * @internal
74
+ */
75
+ declare const MetaboxData = "metaboxData";
76
+ /**
77
+ * Action string dispatched by the iframe when the configurator app has loaded.
78
+ *
79
+ * ### What does it unlock?
80
+ * Indicates when the application has completed initialization.
81
+ *
82
+ * ### Practical Application
83
+ * App initialization flag variable. Signals when MetaBox has completed loading. Use the viewportReady event
84
+ * (more reliable) to gate your UI rendering — don't show controls until MetaBox confirms it's ready.
85
+ *
86
+ * ### AI Coding Best Practices
87
+ * Prefer the viewportReady event over this variable:
88
+ * `api.addEventListener('viewportReady', (ready) => { if(ready) enableUI(); })`.
89
+ * viewportReady with true value is the reliable signal that MetaBox PixelStreaming is become visible.
90
+ *
91
+ * @internal
92
+ */
12
93
  declare const AppLoaded = "appLoaded";
94
+ /**
95
+ * Default production domain for the Metabox Basic Configurator.
96
+ *
97
+ * ### What does it unlock?
98
+ * Constant for the standard default MetaBox domain. Used as the primary domain for connecting to MetaBox server.
99
+ *
100
+ * ### Practical Application
101
+ * The base domain used when no override is specified. Override only via IntegrateMetaboxConfig.domain
102
+ * if connecting to a custom or self-hosted MetaBox instance.
103
+ *
104
+ * ### AI Coding Best Practices
105
+ * Let integrateMetabox() use the default. Override only if needed:
106
+ * `integrateMetabox(id, container, callback, { domain: 'https://custom.domain.com' })`.
107
+ * HTTPS is mandatory — HTTP will be rejected.
108
+ */
13
109
  /**
14
110
  * @deprecated
15
111
  */
@@ -23,26 +119,99 @@ declare const MetaboxHost_V3 = "metaboxHost_v3";
23
119
  */
24
120
  declare const AppLoaded_V3 = "appLoaded_v3";
25
121
  declare const MetaboxDomain = "metabox.3dsource.com";
122
+ /**
123
+ * Base route path appended to the domain when building the configurator iframe URL.
124
+ *
125
+ * ### What does it unlock?
126
+ * Base route URL constant used for loading the configurator. Standard path endpoint for accessing the configurator.
127
+ *
128
+ * ### Practical Application
129
+ * The configurator URL format is: `https://{domain}/metabox-configurator/basic/{configuratorId}`.
130
+ * Automatically constructed by integrateMetabox().
131
+ *
132
+ * ### AI Coding Best Practices
133
+ * Let integrateMetabox() handle URL construction. Only reference if building URLs manually
134
+ * (e.g., QR codes, email links, server-side rendering).
135
+ */
26
136
  declare const BasicRouteUrl = "metabox-configurator/basic";
27
137
 
28
- declare const VERSION = "3.0.16-dev.3";
138
+ declare const VERSION = "3.0.16-dev.6";
29
139
 
140
+ /**
141
+ * Configuration options for integrating the Metabox Basic Configurator iframe into a host page.
142
+ * Passed as the `config` parameter to {@link integrateMetabox}.
143
+ *
144
+ * ### What does it unlock?
145
+ * Configuration interface for initializing the configurator. Passed to integrateMetabox function with settings
146
+ * like domain, host, and standalone mode.
147
+ *
148
+ * ### Practical Application
149
+ * Config interface for integrateMetabox() initialization. Supports: standalone (boolean — disables all built-in UI),
150
+ * introImage/introVideo (URLs), loadingImage (URL), state (initial state), domain (HTTPS override).
151
+ *
152
+ * ### AI Coding Best Practices
153
+ * Pass as 4th parameter to integrateMetabox(). Key: `standalone:true` for custom UI builds. loadingImage for branded
154
+ * loading. domain only if overriding the default MetaBox server. All URLs must be HTTPS. The state field lets you
155
+ * restore a previously saved configuration.
156
+ */
30
157
  interface IntegrateMetaboxConfig {
158
+ /** If true, disables Metabox custom template and all related logic. */
31
159
  standalone?: boolean;
160
+ /** URL to an image displayed while the configurator is loading (added as `?loadingImage=...`). */
32
161
  loadingImage?: string;
162
+ /** URL to a video shown on the intro screen (added as `?introVideo=...`). */
33
163
  introVideo?: string;
164
+ /** URL to an image shown on the intro screen (added as `?introImage=...`). */
34
165
  introImage?: string;
166
+ /** Predefined state for the configurator on initial loading in rison format (see
167
+ * https://github.com/Nanonid/rison) (added as `?state=...`). */
35
168
  state?: string;
169
+ /** Custom domain for testing purposes. Defaults to `metabox.3dsource.com`. HTTPS is enforced. */
36
170
  domain?: string;
37
171
  }
172
+ /**
173
+ * Internal configuration sent to the Metabox Basic Configurator via postMessage.
174
+ * Used by {@link Communicator} when establishing host-to-iframe communication.
175
+ *
176
+ * ### What does it unlock?
177
+ * Configuration object for MetaBox commands. Contains parameters for command execution and behavior settings.
178
+ *
179
+ * ### Practical Application
180
+ * Configuration object for MetaBox command execution. Contains parameters controlling command behavior and settings.
181
+ * Used internally by the command dispatch system.
182
+ *
183
+ * ### AI Coding Best Practices
184
+ * Read-only reference — commands use this internally. When building dynamic command systems, refer to individual
185
+ * command class constructors for their specific parameter requirements rather than this config.
186
+ */
38
187
  interface MetaboxCommandConfig {
188
+ /** If true, disables Metabox custom template and all related logic. */
39
189
  standalone?: boolean;
190
+ /** The URL of the host page embedding the configurator. */
40
191
  hostUrl: string;
192
+ /** The API version string sent to the configurator for compatibility. */
41
193
  apiVersion: string;
42
194
  }
43
195
 
196
+ /**
197
+ * Registry of all action identifiers that can be sent from the host application to the Metabox Basic Configurator.
198
+ * Each key maps to a string used as the `action` field in the postMessage envelope.
199
+ *
200
+ * ### What does it unlock?
201
+ * Variable containing all available action names. Interface listing all actions that the configurator supports.
202
+ *
203
+ * ### Practical Application
204
+ * Master action registry object — all supported configurator action names. Invaluable reference for building
205
+ * admin dashboards, permission systems, or feature-availability displays.
206
+ *
207
+ * ### AI Coding Best Practices
208
+ * Iterate this object to dynamically build action dropdowns, command palettes, or feature checklists in admin tools.
209
+ * Each key is an action name, value is its description. Excellent reference for AI coding agents to understand
210
+ * the full command vocabulary available.
211
+ */
44
212
  declare const MetaboxBasicConfiguratorActions: {
45
213
  readonly metaboxConfig: "metaboxConfig";
214
+ readonly resumeStream: "resumeStream";
46
215
  readonly setEnvironment: "setEnvironment";
47
216
  readonly setEnvironmentMaterialById: "setEnvironmentMaterialById";
48
217
  readonly setProduct: "setProduct";
@@ -65,6 +234,20 @@ declare const MetaboxBasicConfiguratorActions: {
65
234
  readonly showMeasurement: "showMeasurement";
66
235
  readonly hideMeasurement: "hideMeasurement";
67
236
  };
237
+ /**
238
+ * Union of all action string literals from {@link MetaboxBasicConfiguratorActions}.
239
+ *
240
+ * ### What does it unlock?
241
+ * Type alias for all actions that can be sent to MetaBox. Defines the complete set of command types available.
242
+ *
243
+ * ### Practical Application
244
+ * Type alias enumerating all available outgoing command types. Master list of everything your app can tell MetaBox to do.
245
+ * Use as a checklist when planning which features to implement.
246
+ *
247
+ * ### AI Coding Best Practices
248
+ * Reference for building command dispatchers or admin tools. Full command set includes all values of
249
+ * MetaboxBasicConfiguratorActions like: "metaboxConfig" | "setEnvironment" | "setEnvironmentMaterialById" | ...
250
+ */
68
251
  type ToMetaBoxActions = (typeof MetaboxBasicConfiguratorActions)[keyof typeof MetaboxBasicConfiguratorActions];
69
252
  /**
70
253
  * @internal
@@ -73,6 +256,17 @@ type ToMetaBoxActions = (typeof MetaboxBasicConfiguratorActions)[keyof typeof Me
73
256
  type ToMetaboxMessagePayload = ToMetaboxMessagePayloads[keyof ToMetaboxMessagePayloads];
74
257
  /**
75
258
  * Interface for messages sent from the application to the Basic Metabox API.
259
+ *
260
+ * ### What does it unlock?
261
+ * Defines payload structures for different types of outgoing messages to MetaBox. Contains data models for various command parameters.
262
+ *
263
+ * ### Practical Application
264
+ * Payload type definitions for all outgoing command types. Defines required and optional fields per command.
265
+ * Essential TypeScript reference for type-safe command construction.
266
+ *
267
+ * ### AI Coding Best Practices
268
+ * Use as TypeScript type reference for proper typing when building dynamic command dispatchers.
269
+ * Each key corresponds to a command name and its value defines the expected payload structure.
76
270
  */
77
271
  interface ToMetaboxMessagePayloads {
78
272
  [MetaboxBasicConfiguratorActions.metaboxConfig]: {
@@ -125,18 +319,41 @@ interface ToMetaboxMessagePayloads {
125
319
  [MetaboxBasicConfiguratorActions.stopShowcase]: void;
126
320
  [MetaboxBasicConfiguratorActions.sendCommandToUnreal]: object;
127
321
  }
322
+ /**
323
+ * Payload for the {@link SetCamera} command describing the desired camera state in the Unreal scene.
324
+ * All fields are optional — only the provided values will be applied.
325
+ *
326
+ * ### What does it unlock?
327
+ * Defines the payload structure for camera commands. Contains camera-related parameters passed to SetCamera command.
328
+ *
329
+ * ### Practical Application
330
+ * Read-only interface defining camera parameters: fov (degrees), mode ('orbit'|'fps'), position ({x,y,z}),
331
+ * rotation ({horizontal: yaw, vertical: pitch}), and restrictions (distance/FOV/rotation limits).
332
+ * Both returned by getCameraResult event and accepted by SetCamera.
333
+ *
334
+ * ### AI Coding Best Practices
335
+ * This interface is bidirectional — returned from GetCamera and accepted by SetCamera.
336
+ * Capture a camera state via getCameraResult and replay it with SetCamera(payload).
337
+ * Only include restriction fields you want to enforce; omitted values keep current settings.
338
+ * In orbit mode, distance limits are relative to the orbit pivot.
339
+ */
128
340
  interface CameraCommandPayload {
341
+ /** Field of a view angle in degrees. */
129
342
  fov?: number;
343
+ /** Camera control mode: `'fps'` for first-person or `'orbit'` for orbital rotation around pivot. */
130
344
  mode?: 'fps' | 'orbit';
345
+ /** Camera position in 3D world space. */
131
346
  position?: {
132
347
  x: number;
133
348
  y: number;
134
349
  z: number;
135
350
  };
351
+ /** Camera rotation angles in degrees. */
136
352
  rotation?: {
137
353
  horizontal: number;
138
354
  vertical: number;
139
355
  };
356
+ /** Min/max constraints applied to camera movement, zoom, and rotation. */
140
357
  restrictions?: {
141
358
  maxDistanceToPivot?: number;
142
359
  maxFov?: number;
@@ -148,11 +365,47 @@ interface CameraCommandPayload {
148
365
  minVerticalRotation?: number;
149
366
  };
150
367
  }
368
+ /**
369
+ * @internal
370
+ * @hidden
371
+ * Envelope wrapping an action and its payload for host-to-Metabox postMessage communication.
372
+ *
373
+ * ### What does it unlock?
374
+ * Envelope structure for outgoing MetaBox messages. Encapsulates messages with protocol headers for transmission.
375
+ *
376
+ * ### Practical Application
377
+ * Protocol envelope for outgoing messages — adds headers for transmission to MetaBox iframe.
378
+ * Internal to the communication layer, handled automatically by the Communicator.
379
+ *
380
+ * ### AI Coding Best Practices
381
+ * Do not construct manually. The Communicator handles all message wrapping. Only reference this interface
382
+ * if debugging raw postMessage traffic in browser devtools to diagnose why commands aren't being received.
383
+ */
151
384
  interface ToMetaBoxMessageEnvelope {
152
385
  action: ToMetaBoxActions;
153
386
  payload?: ToMetaboxMessagePayload | never;
154
387
  }
388
+ /**
389
+ * @internal
390
+ * @hidden
391
+ */
155
392
  type ToMetaboxTarget = 'metabox' | 'child';
393
+ /**
394
+ * @internal
395
+ * @hidden
396
+ * Top-level postMessage structure sent from the host to the Metabox iframe.
397
+ *
398
+ * ### What does it unlock?
399
+ * Message interface for sending data to MetaBox. Wraps outgoing commands with necessary protocol information.
400
+ *
401
+ * ### Practical Application
402
+ * Outgoing message format for commands to MetaBox. Wraps commands with protocol information for postMessage delivery.
403
+ * Handled automatically by Communicator.sendCommandToMetabox() — never construct manually.
404
+ *
405
+ * ### AI Coding Best Practices
406
+ * Do not construct ToMetaBoxMessage objects. Always use `api.sendCommandToMetabox(new CommandName(...))`.
407
+ * The Communicator wraps your command in the correct message format automatically.
408
+ */
156
409
  interface ToMetaBoxMessage {
157
410
  host: typeof MetaboxHost;
158
411
  envelope: ToMetaBoxMessageEnvelope;
@@ -164,7 +417,21 @@ interface ToMetaBoxMessage {
164
417
  apiVersion: string;
165
418
  }
166
419
 
167
- /** Represents an ecom configurator object with all necessary information about cta */
420
+ /**
421
+ * Represents an ecom configurator object with all necessary information about cta.
422
+ *
423
+ * ### What does it unlock?
424
+ * Configuration interface for the embedded MetaBox menu. Specifies settings and behavior for the menu system.
425
+ *
426
+ * ### Practical Application
427
+ * Configuration interface for the e-commerce/CTA system. Received via ecomConfiguratorDataUpdated event.
428
+ * Defines CTA button settings (label, callback URL) for the built-in or custom purchase workflow.
429
+ *
430
+ * ### AI Coding Best Practices
431
+ * Read-only data — subscribe to ecomConfiguratorDataUpdated to receive. If building custom UI, extract
432
+ * the CTA label and display it on your own button. The callback URL is where MetaBox POSTs the
433
+ * configuration data when CTA is triggered.
434
+ */
168
435
  interface EcomConfigurator {
169
436
  /** The unique ecom configurator identifier. */
170
437
  id: string;
@@ -172,11 +439,24 @@ interface EcomConfigurator {
172
439
  createdAt: string;
173
440
  /** A reference to the Call To Action Information. */
174
441
  cta?: Cta;
175
- /** GraphQL typename for the ecom configurator. */
442
+ /** Represents object typename for the ecom configurator. */
176
443
  __typename: 'Configurator';
177
444
  }
178
445
  /**
179
446
  * Represents the call-to-action information for an ecom configurator.
447
+ *
448
+ * ### What does it unlock?
449
+ * Call-to-Action interface. Defines interactive elements and buttons for user actions within the configurator.
450
+ *
451
+ * ### Practical Application
452
+ * Read-only CTA definition containing the label text and action URL configured in MetaBox admin. Received via
453
+ * ecomConfiguratorDataUpdated event. Use to render custom CTA buttons matching admin-configured actions
454
+ * (e.g., 'Request Quote', 'Add to Cart').
455
+ *
456
+ * ### AI Coding Best Practices
457
+ * Subscribe to ecomConfiguratorDataUpdated to receive CTA config. Use the label for button text.
458
+ * The actual CTA trigger is `api.sendCommandToMetabox(new GetCallToActionInformation())` — which POSTs
459
+ * the config JSON to the callback URL. The backend returns `{ redirectUrl }`.
180
460
  */
181
461
  interface Cta {
182
462
  /** The indicator of whether the call-to-action is enabled or not. */
@@ -185,13 +465,28 @@ interface Cta {
185
465
  label: string;
186
466
  /** Callback URL using for sent configurator selected information to this url and redirected to the url after get response. */
187
467
  callbackUrl: string;
188
- /** GraphQL typename for the CTA object. */
468
+ /** Represents object typename for the CTA object. */
189
469
  __typename: 'Cta';
190
470
  }
191
471
 
192
472
  /**
193
473
  * Represents a basic configurator object with its configuration, selected materials,
194
474
  * product identifier, and associated environment with its materials.
475
+ *
476
+ * ### What does it unlock?
477
+ * Main data envelope received from MetaBox on every state change. Contains the full configurator
478
+ * definition, currently selected product, environment, and all material selections.
479
+ *
480
+ * ### Practical Application
481
+ * Delivered as the payload of the `configuratorDataUpdated` event. Use it to build and update custom UI:
482
+ * read `configurator` for available options, `productId`/`environmentId` for current selections,
483
+ * and `productMaterialsIds`/`environmentMaterialsIds` for active materials.
484
+ *
485
+ * ### AI Coding Best Practices
486
+ * Subscribe to `configuratorDataUpdated` to receive this on every state change.
487
+ * Key fields: `configurator` (full definition — parse once for menu building), `productId` (active product),
488
+ * `productMaterialsIds` (active materials), `environmentId` (active scene), `environmentMaterialsIds`
489
+ * (scene materials). Rebuild affected UI sections on each update.
195
490
  */
196
491
  interface ConfiguratorEnvelope {
197
492
  /**
@@ -217,6 +512,20 @@ interface ConfiguratorEnvelope {
217
512
  }
218
513
  /**
219
514
  * Represents the universal configurator with its basic properties and components.
515
+ *
516
+ * ### What does it unlock?
517
+ * Full configurator definition containing all available products, environments, and metadata.
518
+ * This is the catalog of everything the configurator supports.
519
+ *
520
+ * ### Practical Application
521
+ * Accessed via `ConfiguratorEnvelope.configurator` from the `configuratorDataUpdated` event.
522
+ * Use `products` to build product selectors, `environments` to build scene pickers,
523
+ * and `ctaEnabled` to conditionally show call-to-action buttons.
524
+ *
525
+ * ### AI Coding Best Practices
526
+ * Parse once on first `configuratorDataUpdated` to build menus. The configurator definition
527
+ * rarely changes — only current selections change between updates. Use `products` array for
528
+ * product listing, each product's `slots` for material options, and `environments` for scene switching.
220
529
  */
221
530
  interface UniversalConfigurator {
222
531
  /** Unique identifier for the configurator. */
@@ -234,11 +543,23 @@ interface UniversalConfigurator {
234
543
  isActive: boolean;
235
544
  /** Indicates if the cta in ecom configurator is enabled or not. */
236
545
  ctaEnabled: boolean;
237
- /** GraphQL typename for the configurator. */
546
+ /** Represents object typename for the configurator. */
238
547
  __typename: 'UniversalConfigurator';
239
548
  }
240
549
  /**
241
550
  * Represents a product within the universal configurator.
551
+ *
552
+ * ### What does it unlock?
553
+ * Wrapper linking a product to its position and label inside the configurator's product list.
554
+ * Each entry in `UniversalConfigurator.products` is of this type.
555
+ *
556
+ * ### Practical Application
557
+ * Iterate `UniversalConfigurator.products` to build a product selector. Use `label` for display text,
558
+ * `productId` to switch products via {@link SetProduct}, and `product` for thumbnails and slot details.
559
+ *
560
+ * ### AI Coding Best Practices
561
+ * Use `productId` (not `product.id`) when calling `new SetProduct(productId)`.
562
+ * Sort by `position` if rendering a product list to match the order configured in MetaBox admin.
242
563
  */
243
564
  interface UniversalConfiguratorProduct {
244
565
  /** The product's unique identifier. */
@@ -249,11 +570,21 @@ interface UniversalConfiguratorProduct {
249
570
  label: string;
250
571
  /** The detailed product information. */
251
572
  product: Product;
252
- /** GraphQL typename for the product. */
573
+ /** Represents object typename for the product. */
253
574
  __typename: 'UniversalConfiguratorProduct';
254
575
  }
255
576
  /**
256
577
  * Represents product details including visual assets and configuration.
578
+ *
579
+ * ### What does it unlock?
580
+ * Interface representing a product in the configurator system. Contains product metadata, components, and configuration options.
581
+ *
582
+ * ### Practical Application
583
+ * Product data model: the base 3D digital twin. Contains product metadata and externalId (SKU) for e-commerce/ERP mapping.
584
+ *
585
+ * ### AI Coding Best Practices
586
+ * Access via configurator data. Use product.externalId to look up pricing, inventory, and specs in external systems
587
+ * (ERP, PIM, Shopify, etc.). The product represents the underlying 3D asset rendered in the Unreal viewport.
257
588
  */
258
589
  interface Product {
259
590
  /** The title of the product. */
@@ -271,11 +602,22 @@ interface Product {
271
602
  externalId: string;
272
603
  /** Showcase details for the product. */
273
604
  showcase?: Showcase;
274
- /** GraphQL typename for the product. */
605
+ /** Represents object typename for the product. */
275
606
  __typename: 'Product';
276
607
  }
277
608
  /**
278
609
  * Represents a thumbnail image entity with dimensions and URL path.
610
+ *
611
+ * ### What does it unlock?
612
+ * Thumbnail interface representing preview images. Contains image data and metadata for visual representation.
613
+ *
614
+ * ### Practical Application
615
+ * Preview image data: contains URLs and metadata for thumbnails used in product selectors, material swatch pickers,
616
+ * and environment preview cards. Essential for building visual option pickers.
617
+ *
618
+ * ### AI Coding Best Practices
619
+ * Access thumbnailList arrays from materials, environments, and products. Use URLs directly in img tags.
620
+ * Implement lazy loading for grids with many options. Consider preloading thumbnails for the currently visible category.
279
621
  */
280
622
  interface Thumbnail {
281
623
  /** Width of the thumbnail. */
@@ -284,11 +626,24 @@ interface Thumbnail {
284
626
  height: number;
285
627
  /** URL path to the thumbnail image. */
286
628
  urlPath: string;
287
- /** GraphQL typename (as a string, flexible type). */
629
+ /** Represents object typename (as a string, flexible type). */
288
630
  __typename: 'Thumbnail';
289
631
  }
290
632
  /**
291
633
  * Represents a slot within a product that may allow material customization.
634
+ *
635
+ * ### What does it unlock?
636
+ * Represents a material slot. Defines customizable surfaces within a product or environment.
637
+ *
638
+ * ### Practical Application
639
+ * Material slot on a product or environment — represents a customizable surface. Each slot has an id
640
+ * (used in SetProductMaterial/SetEnvironmentMaterial) and a list of available materials.
641
+ * Use to build per-surface material pickers.
642
+ *
643
+ * ### AI Coding Best Practices
644
+ * Access slot definitions from product or environment data in the envelope. Each slot's id is the slotId parameter
645
+ * for SetProductMaterial or SetEnvironmentMaterial. Iterate slot.enabledMaterials to build the swatch picker
646
+ * for that specific surface.
292
647
  */
293
648
  interface Slot {
294
649
  /** Unique identifier for the slot. */
@@ -297,11 +652,22 @@ interface Slot {
297
652
  label: string;
298
653
  /** A list of enabled materials for the slot. */
299
654
  enabledMaterials: Material[];
300
- /** GraphQL typename for the slot. */
655
+ /** Represents object typename for the slot. */
301
656
  __typename: 'Slot';
302
657
  }
303
658
  /**
304
659
  * Represents a metaProperty within a product that may allow business logic customization.
660
+ *
661
+ * ### What does it unlock?
662
+ * Represents metadata properties. May contain custom key-value data set in MetaBox admin.
663
+ *
664
+ * ### Practical Application
665
+ * Represents metadata with properties and hierarchy info. May contain custom key-value data
666
+ * (pricing hints, availability flags, descriptions) set in MetaBox admin.
667
+ *
668
+ * ### AI Coding Best Practices
669
+ * Check for MetaProperty data in product definitions from the configurator data. Custom metadata can be used for
670
+ * display purposes — tooltips, pricing, lead times, availability badges. These are set by content teams in MetaBox admin.
305
671
  */
306
672
  interface MetaProperty {
307
673
  /** Unique identifier for the metaProperty. */
@@ -312,11 +678,24 @@ interface MetaProperty {
312
678
  value: string;
313
679
  /** Type for the metaProperty. */
314
680
  type: string;
315
- /** GraphQL typename for the metaProperty. */
681
+ /** Represents object typename for the metaProperty. */
316
682
  __typename: 'MetaProperty';
317
683
  }
318
684
  /**
319
685
  * Represents a material that can be applied to a product slot.
686
+ *
687
+ * ### What does it unlock?
688
+ * Describes material characteristics. Contains properties like name, textures, and appearance attributes.
689
+ *
690
+ * ### Practical Application
691
+ * Material data model: id (UUID), title (display name), externalId (SKU for ERP mapping), and thumbnailList
692
+ * (swatch preview images). Use to build material/finish pickers with visual swatches and to map selections
693
+ * to external product systems.
694
+ *
695
+ * ### AI Coding Best Practices
696
+ * Access material data from product slot definitions in configuratorDataUpdated. Use title for labels,
697
+ * thumbnailList for swatch images, externalId to map to your PIM/ERP for pricing and inventory.
698
+ * Pass material.id to SetProductMaterial or SetEnvironmentMaterial.
320
699
  */
321
700
  interface Material {
322
701
  /** Unique identifier for the material. */
@@ -328,29 +707,52 @@ interface Material {
328
707
  /** List of thumbnails for the material. */
329
708
  thumbnailList: Thumbnail[];
330
709
  /** The model information associated with the material. */
331
- /** GraphQL typename for the material. */
710
+ /** Represents object typename for the material. */
332
711
  __typename: 'Material';
333
712
  }
334
713
  /**
335
714
  * Details showcase the presentation of a product.
715
+ *
716
+ * ### What does it unlock?
717
+ * Interface for showcase/demo mode features. Defines properties for timeline-based presentation of the configurator state.
718
+ *
719
+ * ### Practical Application
720
+ * Showcase/demo animation data. Defines camera animation sequences for auto-playing product presentations —
721
+ * timeline-based with camera movements, transitions, and durations.
722
+ *
723
+ * ### AI Coding Best Practices
724
+ * Check if products have associated showcase data before enabling demo playback buttons. Use showcase metadata
725
+ * (duration, slot count) to build custom timeline controls. Playback sequence: InitShowcase → PlayShowcase → monitor
726
+ * via showcaseStatusChanged.
336
727
  */
337
728
  interface Showcase {
338
729
  /** A list of low-bandwidth versions for the showcase (optional). */
339
730
  lowBandwidth?: (Timecode | null)[] | null;
340
731
  /** Duration for the showcase (optional). */
341
732
  duration?: number;
342
- /** GraphQL typename for the showcase. */
733
+ /** Represents object typename for the showcase. */
343
734
  __typename: 'Showcase';
344
735
  }
345
736
  /**
346
737
  * Represents a low-bandwidth entity used in showcases in LBM mode.
738
+ *
739
+ * ### What does it unlock?
740
+ * Timecode interface for showcase timeline management. Tracks timing and playback position information.
741
+ *
742
+ * ### Practical Application
743
+ * Playback position tracking for showcase animations. Contains current timestamp within the animation timeline.
744
+ * Use for building progress bars, time displays, or syncing external content to showcase playback.
745
+ *
746
+ * ### AI Coding Best Practices
747
+ * Access timecode data from showcase status events during playback. Use to update progress indicators in custom playback UIs.
748
+ * Combine with showcaseStatusChanged to build full media player controls for product demo presentations.
347
749
  */
348
750
  interface Timecode {
349
751
  /** Time marker for the entity. */
350
752
  time: number;
351
753
  /** Duration of the entity display. */
352
754
  duration: number;
353
- /** GraphQL typename (as a string, flexible type). */
755
+ /** Represents object typename (as a string, flexible type). */
354
756
  __typename: 'Timecode';
355
757
  }
356
758
  /**
@@ -365,11 +767,22 @@ interface UniversalConfiguratorEnvironment {
365
767
  label: string;
366
768
  /** Detailed environment configuration. */
367
769
  environment: Environment;
368
- /** GraphQL typename for the environment. */
770
+ /** Represents object typename for the environment. */
369
771
  __typename: 'UniversalConfiguratorEnvironment';
370
772
  }
371
773
  /**
372
774
  * Represents an environment with associated media and configuration.
775
+ *
776
+ * ### What does it unlock?
777
+ * Internal interface for environment data model used by MetaBox.
778
+ *
779
+ * ### Practical Application
780
+ * Environment data model: id, title, udsEnabled (dynamic sky toggle), sunNorthYaw, udsHour (time of day for dynamic sky),
781
+ * thumbnailList (preview images), and slots (configurable material slots). Use to build environment/scene picker UIs.
782
+ *
783
+ * ### AI Coding Best Practices
784
+ * Access environment definitions from the configuratorDataUpdated envelope. Use thumbnailList for preview cards.
785
+ * Check udsEnabled to know if time-of-day controls are available. Iterate slots array to build environment material pickers.
373
786
  */
374
787
  interface Environment {
375
788
  /** Unique identifier for the environment. */
@@ -382,7 +795,7 @@ interface Environment {
382
795
  sunNorthYaw: number;
383
796
  /** The UDS hour setting for the environment. */
384
797
  udsHour: number;
385
- /** GraphQL typename for the environment. */
798
+ /** Represents object typename for the environment. */
386
799
  __typename: 'Environment';
387
800
  /** List of thumbnails for the environment (optional). */
388
801
  thumbnailList: Thumbnail[];
@@ -391,20 +804,69 @@ interface Environment {
391
804
  }
392
805
  /**
393
806
  * Defines the structure for a mapping of selected materials.
807
+ *
808
+ * ### What does it unlock?
809
+ * Type alias representing selected item IDs. Used to track which entities are currently selected in the configurator UI.
810
+ *
811
+ * ### Practical Application
812
+ * Record type (key-value map) tracking currently selected IDs. Found in the configurator envelope.
813
+ * Maps slot or type keys to selected material/product UUIDs.
814
+ *
815
+ * ### AI Coding Best Practices
816
+ * Access from configuratorDataUpdated envelope. Use to mark 'active/selected' state on material swatches in your UI.
817
+ * Updates on every state change.
394
818
  */
395
819
  type SelectedIds = Record<string, Record<string, string>>;
396
820
  /**
397
821
  * Defines the structure for an available showcase status for the current product on a scene.
822
+ *
823
+ * ### What does it unlock?
824
+ * Type alias for showcase status states. Defines possible states of showcase/timeline playback.
825
+ *
826
+ * ### Practical Application
827
+ * Type alias: 'init' | 'play' | 'pause' | 'stop'. Received via showcaseStatusChanged event.
828
+ * Use to conditionally render playback controls and toggle configurator interactivity during demos.
829
+ *
830
+ * ### AI Coding Best Practices
831
+ * Subscribe to showcaseStatusChanged and switch UI state: 'play' → show pause button, disable config controls;
832
+ * 'pause' → show play/stop buttons; 'stop' → show play button, re-enable all config controls.
398
833
  */
399
834
  type ShowCaseStatus = 'init' | 'play' | 'pause' | 'stop';
400
835
  /**
401
836
  * Defines the structure for a video resolution.
837
+ *
838
+ * ### What does it unlock?
839
+ * Defines video resolution settings for the configurator display. Specifies viewport dimensions and rendering parameters.
840
+ *
841
+ * ### Practical Application
842
+ * Video resolution interface: {width: number|null, height: number|null}. Received via videoResolutionChanged event
843
+ * when the pixel stream resolution changes. Use for responsive layout adjustments or displaying stream quality info.
844
+ *
845
+ * ### AI Coding Best Practices
846
+ * Subscribe to videoResolutionChanged to monitor stream resolution. Use to dynamically adjust UI overlay positioning,
847
+ * inform users about stream quality, or scale screenshot size requests proportionally.
402
848
  */
403
849
  interface VideoResolution {
404
850
  width: number | null;
405
851
  height: number | null;
406
852
  }
407
853
 
854
+ /**
855
+ * Maps event names received from the Metabox iframe to their typed payloads.
856
+ * Used by {@link Communicator.addEventListener} to provide type-safe event subscriptions.
857
+ *
858
+ * ### What does it unlock?
859
+ * Message format for MetaBox communication protocol. Wraps data for transmission between API and MetaBox.
860
+ *
861
+ * ### Practical Application
862
+ * Payload type map for all incoming event types. Defines the data shape for each event name
863
+ * (configuratorDataUpdated, screenshotReady, viewportReady, etc.). Essential TypeScript reference for properly typing event handlers.
864
+ *
865
+ * ### AI Coding Best Practices
866
+ * Use as TypeScript type reference: `api.addEventListener('configuratorDataUpdated', (data: FromMetaboxMessagePayloads['configuratorDataUpdated']) => {...})`.
867
+ * Key events and their types: configuratorDataUpdated→ConfiguratorEnvelope, screenshotReady→string|null,
868
+ * viewportReady→boolean, showcaseStatusChanged→ShowCaseStatus.
869
+ */
408
870
  interface FromMetaboxMessagePayloads {
409
871
  /**
410
872
  * Dispatches every time the configurator data is updated.
@@ -436,7 +898,7 @@ interface FromMetaboxMessagePayloads {
436
898
  */
437
899
  videoResolutionChanged: VideoResolution;
438
900
  /**
439
- * Dispatches every time when the User sends get camera command.
901
+ * Dispatches every time when the User sends get camera command new GetCamera() command.
440
902
  */
441
903
  getCameraResult: CameraCommandPayload;
442
904
  /**
@@ -446,18 +908,58 @@ interface FromMetaboxMessagePayloads {
446
908
  dataChannelConnected: boolean;
447
909
  }
448
910
  /**
911
+ * Union of all event names received from MetaBox.
912
+ *
913
+ * ### What does it unlock?
914
+ * Type alias for MetaBox API actions coming from the server. Defines all possible action types.
915
+ *
916
+ * ### Practical Application
917
+ * Type alias enumerating all possible incoming action/event types from MetaBox. Reference as a complete
918
+ * checklist of subscribable events for building comprehensive event handling.
919
+ *
920
+ * ### AI Coding Best Practices
921
+ * Use as a reference for all valid event names in api.addEventListener(). Key events:
922
+ * configuratorDataUpdated, viewportReady, screenshotReady, showcaseStatusChanged, getCameraResult,
923
+ * statusMessageChanged, ecomConfiguratorDataUpdated, videoResolutionChanged.
924
+ *
449
925
  * @hidden
450
926
  */
451
927
  type FromMetaBoxApiEvents = keyof FromMetaboxMessagePayloads;
452
928
  /**
453
929
  * @internal
454
930
  * This creates all event envelopes defined in MetaBoxAPIPayloads.
931
+ *
932
+ * ### What does it unlock?
933
+ * Envelope structure for wrapping MetaBox API messages. Encapsulates commands and data for transmission.
934
+ *
935
+ * ### Practical Application
936
+ * Protocol envelope structure wrapping all MetaBox API messages. Internal to the communication layer — adds
937
+ * routing and protocol headers. The Communicator handles this automatically.
938
+ *
939
+ * ### AI Coding Best Practices
940
+ * For debugging: inspect postMessage events in browser devtools and match
941
+ * against this structure to diagnose malformed messages. The Communicator handles all wrapping/unwrapping.
455
942
  */
456
943
  interface MetaBoxApiEnvelope<T extends FromMetaBoxApiEvents> {
457
944
  action: 'bridge';
458
945
  eventType: T;
459
946
  payload: FromMetaboxMessagePayloads[T];
460
947
  }
948
+ /**
949
+ * Identifies which side of the iframe boundary the Communicator is running on.
950
+ *
951
+ * ### What does it unlock?
952
+ * Distinguishes which side of the postMessage channel the Communicator is operating on —
953
+ * `'host'` for the embedding page and `'metabox'` for the iframe.
954
+ *
955
+ * ### Practical Application
956
+ * Used internally by the Communicator to tag outgoing messages so the receiving side can verify their origin.
957
+ * You never need to set or check this value in application code.
958
+ *
959
+ * ### AI Coding Best Practices
960
+ * Skip in application code. The Communicator sets this automatically based on the `createInstance()` call.
961
+ * Only relevant if debugging raw postMessage traffic between your page and the MetaBox iframe.
962
+ */
461
963
  type MetaboxEnvironment = 'metabox' | 'host';
462
964
  /**
463
965
  * @hidden
@@ -480,7 +982,27 @@ interface MCAppLoaded {
480
982
  type FromMetaBoxAPIEnvelope = {
481
983
  [K in keyof FromMetaboxMessagePayloads]: MetaBoxApiEnvelope<K>;
482
984
  }[keyof FromMetaboxMessagePayloads] | MCAppLoaded;
985
+ /**
986
+ * @internal
987
+ * @hidden
988
+ */
483
989
  type FromMetaboxTarget = 'parent' | 'communicator';
990
+ /**
991
+ * @internal
992
+ * @hidden
993
+ * Top-level postMessage structure received from the Metabox iframe.
994
+ *
995
+ * ### What does it unlock?
996
+ * Represents the Top-level postMessage structure received from the Metabox iframe. Contains read-only data.
997
+ *
998
+ * ### Practical Application
999
+ * Incoming message wrapper from MetaBox. Defines how MetaBox wraps response data for postMessage delivery.
1000
+ * Internal to communication layer — the Communicator parses these automatically.
1001
+ *
1002
+ * ### AI Coding Best Practices
1003
+ * Do not parse these manually. The Communicator handles unwrapping and delivers typed payloads to your event listeners.
1004
+ * Only reference if debugging raw postMessage traffic in browser devtools.
1005
+ */
484
1006
  interface FromMetaBoxMessage {
485
1007
  host: typeof Metabox;
486
1008
  envelope: FromMetaBoxAPIEnvelope;
@@ -489,10 +1011,24 @@ interface FromMetaBoxMessage {
489
1011
 
490
1012
  /**
491
1013
  * Base class for commands sent to the Metabox API.
1014
+ *
1015
+ * ### What does it unlock?
1016
+ * Base class that all other commands inherit from in a class hierarchy. Provides common properties
1017
+ * and methods that are automatically available to all command subclasses.
1018
+ *
1019
+ * ### Practical Application
1020
+ * Base class all commands inherit from. Never instantiate directly — use specific subclasses like
1021
+ * SetProduct, SetCamera, etc. All commands are sent via `api.sendCommandToMetabox(new CommandName(...))`.
1022
+ *
1023
+ * ### AI Coding Best Practices
1024
+ * Never construct a generic CommandBase. Always use the specific typed command class. When generating
1025
+ * dynamic command dispatch, use a switch/map pattern matching command names to their constructors.
1026
+ *
492
1027
  * @internal
493
1028
  * @hidden
494
1029
  */
495
1030
  declare class CommandBase {
1031
+ /** The message envelope populated by subclass constructors and sent via {@link Communicator.sendCommandToMetabox}. */
496
1032
  data: ToMetaBoxMessageEnvelope;
497
1033
  }
498
1034
 
@@ -500,6 +1036,18 @@ declare class CommandBase {
500
1036
  * Represents a callback listener for specific message types.
501
1037
  * Used internally by EventDispatcher to store event listeners.
502
1038
  *
1039
+ * ### What does it unlock?
1040
+ * Event listener interface. Allows subscription to specific events from the configurator to receive real-time data updates.
1041
+ *
1042
+ * ### Practical Application
1043
+ * Event listener interface. addEventListener() and removeEventListener() on Communicator. Subscribe to real-time
1044
+ * configurator events: state changes, viewport readiness, screenshots, showcase status, camera results, resolution changes.
1045
+ *
1046
+ * ### AI Coding Best Practices
1047
+ * Set up listeners BEFORE sending commands that trigger them. Always clean up with removeEventListener on component unmount.
1048
+ * Key events: configuratorDataUpdated (every state change), viewportReady (init complete), screenshotReady (captures),
1049
+ * getCameraResult (camera queries), showcaseStatusChanged (demo playback).
1050
+ *
503
1051
  * @public
504
1052
  */
505
1053
  interface Listener {
@@ -510,38 +1058,68 @@ interface Listener {
510
1058
  }
511
1059
  /**
512
1060
  * EventDispatcher is a class that manages event listeners and dispatches events to them.
1061
+ *
1062
+ * ### What does it unlock?
1063
+ * Parent class of Communicator that dispatches commands. Acts as an event dispatcher that routes command messages internally.
1064
+ *
1065
+ * ### Practical Application
1066
+ * Internal event routing layer — parent class of Communicator. Routes postMessage commands between your app
1067
+ * and the Unreal Engine pixel stream. Not used directly but understanding it helps debug message delivery issues.
1068
+ *
1069
+ * ### AI Coding Best Practices
1070
+ * Do not reference or extend EventDispatcher in application code. Use only the Communicator interface methods.
1071
+ * If debugging communication failures, check browser console for postMessage errors related to this layer.
513
1072
  */
514
1073
  declare class EventDispatcher {
515
1074
  /**
516
1075
  * Storage for callback listeners by message type.
517
1076
  */
518
1077
  listeners: Listener[];
1078
+ /**
1079
+ * Removes all registered listeners. Subclasses override this to perform additional cleanup.
1080
+ * @param key - Instance key (used by subclass overrides for registry cleanup).
1081
+ */
519
1082
  destroy(key: string): void;
520
1083
  /**
521
1084
  * Adds an event listener for receiving specific types of messages.
522
1085
  *
523
- * @param messageType - The message type to listen for.
1086
+ * @param {string} messageType - The message type to listen for.
524
1087
  * @param callback - The callback function to execute when a message is received.
525
1088
  */
526
1089
  addEventListener(messageType: string, callback: (data: unknown) => void): this;
527
1090
  /**
528
1091
  * Dispatches an event to all listeners of a specific message type.
529
1092
  *
530
- * @param messageType - The message type.
1093
+ * @param {string} messageType - The message type.
531
1094
  * @param data - The data associated with the event.
532
1095
  */
533
1096
  dispatchEvent(messageType: string, data: unknown): this;
534
1097
  /**
535
1098
  * Removes an event listener for a specific type of message.
536
1099
  *
537
- * @param messageType - The message type.
1100
+ * @param {string} messageType - The message type.
538
1101
  * @param callback - The callback function to remove.
539
1102
  */
540
1103
  removeEventListener(messageType: string, callback: (data: unknown) => void): this;
541
1104
  }
542
1105
 
543
1106
  /**
544
- * Handles messaging between the host page and embedded to the Metabox content.
1107
+ * Handles messaging between the host page and embedded Metabox content.
1108
+ *
1109
+ * ### What does it unlock?
1110
+ * Internal class that creates a proxy/communication layer between the API and MetaBox.
1111
+ * Handles reading and sending commands through the established connection.
1112
+ *
1113
+ * ### Practical Application
1114
+ * The API handle returned in the integrateMetabox callback. Provides sendCommandToMetabox() to send commands,
1115
+ * and addEventListener()/removeEventListener() for event subscriptions. This is your entire interface to
1116
+ * the MetaBox Unreal Engine stream.
1117
+ *
1118
+ * ### AI Coding Best Practices
1119
+ * Store the Communicator reference from the apiReadyCallback in a module-scoped variable or state store.
1120
+ * NEVER send commands before this callback fires. All commands and event listeners go through this single
1121
+ * api object. Clean up listeners with removeEventListener on component unmount.
1122
+ *
545
1123
  * @internal Use {@link Communicator.createInstance} or the {@link integrateMetabox} helper to instantiate.
546
1124
  */
547
1125
  declare class Communicator extends EventDispatcher {
@@ -562,14 +1140,19 @@ declare class Communicator extends EventDispatcher {
562
1140
  * Listens for Metabox to signal readiness, then initializes communicator.
563
1141
  * @param apiReadyCallback - Called with the new Communicator once the Metabox is loaded.
564
1142
  * @param {MetaboxEnvironment} environment - The environment in which the Communicator is running.
565
- * @param {MetaboxCommandConfig} config - Optional initial config: standalone - if true, disable metabox custom template and all logic.
1143
+ * @param {MetaboxCommandConfig} config - optional initial config: standalone - if true - disable metabox custom template and all logic
566
1144
  */
567
1145
  static createInstance(apiReadyCallback: (api: Communicator) => void, environment: MetaboxEnvironment, config?: Partial<MetaboxCommandConfig>): void;
568
1146
  /**
569
1147
  * Cleans up resources and stops listening for messages.
570
1148
  */
571
1149
  destroy(key: string): void;
1150
+ /** Destroys all active Communicator instances and clears the internal registry. */
572
1151
  static clearAll(): void;
1152
+ /**
1153
+ * Retrieves a registered Communicator instance by its key.
1154
+ * @param key - The composite key (`version_environment_appId`) identifying the instance.
1155
+ */
573
1156
  static getCommunicator(key: string): {
574
1157
  instance: Communicator;
575
1158
  } | undefined;
@@ -580,16 +1163,22 @@ declare class Communicator extends EventDispatcher {
580
1163
  sendCommandToMetabox<T extends CommandBase>(command: T): void;
581
1164
  /**
582
1165
  * Registers an event listener for messages dispatched by the Metabox.
1166
+ * @param messageType - The event name to listen for (e.g. `'configuratorDataUpdated'`).
1167
+ * @param callback - Handler invoked with the typed payload when the event fires.
583
1168
  * @override
584
1169
  */
585
1170
  addEventListener<T extends FromMetaBoxApiEvents>(messageType: T, callback: (data: FromMetaboxMessagePayloads[T]) => void): this;
586
1171
  /**
587
1172
  * Dispatches a typed event to all registered listeners.
1173
+ * @param messageType - The event name to dispatch.
1174
+ * @param data - The payload to pass to each listener.
588
1175
  * @override
589
1176
  */
590
1177
  dispatchEvent<T extends FromMetaBoxApiEvents>(messageType: T, data: FromMetaboxMessagePayloads[T]): this;
591
1178
  /**
592
1179
  * Removes a previously registered event listener.
1180
+ * @param messageType - The event name the listener was registered for.
1181
+ * @param callback - The same function reference that was passed to {@link addEventListener}.
593
1182
  * @override
594
1183
  */
595
1184
  removeEventListener<T extends FromMetaBoxApiEvents>(messageType: T, callback: (data: FromMetaboxMessagePayloads[T]) => void): this;
@@ -604,15 +1193,30 @@ declare class Communicator extends EventDispatcher {
604
1193
  * Integrates the Metabox Basic Configurator into the page by injecting an iframe and
605
1194
  * initializing a Communicator instance for host-to-iframe messaging.
606
1195
  *
607
- * @remarks
608
1196
  * - Builds a secure iframe URL using the provided configuratorId and config options.
609
1197
  * - Ensures the resulting URL uses HTTPS and that the target container exists.
610
1198
  * - Removes any previously embedded iframe with id "embeddedContent" before inserting a new one.
611
1199
  *
1200
+ * ### What does it unlock?
1201
+ * Main initialization function for MetaBox integration. Initializes the configurator, receives an API handle,
1202
+ * and sets up all configurations.
1203
+ *
1204
+ * ### Practical Application
1205
+ * THE entry point function. Creates the configurator iframe, establishes postMessage communication, and returns
1206
+ * the Communicator api handle via callback. Call ONCE per configurator. Params: configuratorId (UUID),
1207
+ * containerId (DOM element ID, default 'embed3DSource'), apiReadyCallback, config (IntegrateMetaboxConfig).
1208
+ *
1209
+ * ### AI Coding Best Practices
1210
+ * Pattern: `integrateMetabox('uuid', 'div-id', (api) => {
1211
+ * setup listeners, then set product, then environment
1212
+ * }, { standalone: true })`.
1213
+ * Ensure container div exists in DOM with non-zero dimensions. HTTPS required.
1214
+ * Inside callback: 1) addEventListener for configuratorDataUpdated, 2) SetProduct, 3) SetEnvironment.
1215
+ *
612
1216
  * @param {string} configuratorId - The Basic Configurator ID (not a full URL). It is appended to
613
1217
  * `https://{domain}/metabox-configurator/basic/{configuratorId}` to form the iframe src.
614
1218
  *
615
- * @param {string} [containerId='embed3DSource'] - The id of the container element where the iframe will be injected.
1219
+ * @param {string} containerId - The id of the container element where the iframe will be injected.
616
1220
  *
617
1221
  * @param {(api: Communicator) => void} apiReadyCallback - Called when the Communicator instance is created on the host side.
618
1222
  *
@@ -645,15 +1249,27 @@ declare class Communicator extends EventDispatcher {
645
1249
  * },
646
1250
  * );
647
1251
  */
648
- declare function integrateMetabox(configuratorId: string, containerId: string | undefined, apiReadyCallback: (api: Communicator) => void, config?: IntegrateMetaboxConfig): void;
1252
+ declare function integrateMetabox(configuratorId: string, containerId: string, apiReadyCallback: (api: Communicator) => void, config?: IntegrateMetaboxConfig): void;
649
1253
 
650
1254
  /**
651
1255
  * Saves an image by triggering a download.
652
1256
  *
653
- * @remarks
654
1257
  * This function creates an anchor element, sets its `href` attribute to the provided image URL,
655
1258
  * and triggers a click event to initiate a download with the specified filename.
656
1259
  *
1260
+ * ### What does it unlock?
1261
+ * Main exported function to save images from the configurator. Converts base64 image data to actual image
1262
+ * files and saves them to the local filesystem.
1263
+ *
1264
+ * ### Practical Application
1265
+ * Exported utility function that converts base64 screenshot data (from screenshotReady event) to a downloadable
1266
+ * image file. Handles the base64 → blob → browser download flow. Import directly from the API package.
1267
+ *
1268
+ * ### AI Coding Best Practices
1269
+ * Pattern: `api.addEventListener('screenshotReady', (data) => { if(data) saveImage(data, 'config-screenshot.png'); })`.
1270
+ * Filename extension should match the MimeType passed to GetScreenshot.
1271
+ * Import: `import { saveImage } from '@3dsource/metabox-front-api'`.
1272
+ *
657
1273
  * @param {string} imageUrl - The URL of the image to save.
658
1274
  * @param {string} filename - The name of the file to save.
659
1275
  */
@@ -662,7 +1278,6 @@ declare function saveImage(imageUrl: string, filename: string): void;
662
1278
  /**
663
1279
  * Sets the URL parameters based on the provided state.
664
1280
  *
665
- * @remarks
666
1281
  * @internal
667
1282
  * @hidden
668
1283
  * This function updates the current URL by replacing its search parameters with the key-value pairs from the provided state object.
@@ -683,8 +1298,21 @@ declare function setUrlParams(state: Record<string, string>): void;
683
1298
  declare function getUrlParams(): Record<string, string>;
684
1299
 
685
1300
  /**
1301
+ * Constructs the iframe source URL for the Metabox Basic Configurator.
1302
+ *
1303
+ * ### What does it unlock?
1304
+ * Utility function that prepares the iframe source URL. Constructs the proper URL with parameters
1305
+ * for loading the MetaBox configurator.
1306
+ *
1307
+ * ### Practical Application
1308
+ * Utility function that constructs the iframe source URL with proper parameters.
1309
+ * URL format: `https://{domain}/metabox-configurator/basic/{configuratorId}`.
1310
+ * Called internally by integrateMetabox() — use directly only for manual URL construction.
1311
+ *
1312
+ * ### AI Coding Best Practices
1313
+ * Usually called internally. Use directly only for pre-constructing embed URLs (QR codes, email links,
1314
+ * preview URLs). Verify output is HTTPS. Remember basic configurators use `/basic/` path.
686
1315
  *
687
- * @remarks
688
1316
  * @internal
689
1317
  * @hidden
690
1318
  *
@@ -694,141 +1322,170 @@ declare function getUrlParams(): Record<string, string>;
694
1322
  declare const prepareIframeSrc: (configuratorId: string, config?: IntegrateMetaboxConfig) => string;
695
1323
 
696
1324
  /**
697
- * Wrapper helper function to use it with rxJs the same as `fromEvent` to listen to events from the Communicator.
1325
+ * Wrapper helper function to use with RxJS the same way as `fromEvent`, to listen to events from the Communicator.
1326
+ *
1327
+ * ### What does it unlock?
1328
+ * Function that creates an event listener subscription. Allows developers to subscribe to specific events from the Communicator.
1329
+ *
1330
+ * ### Practical Application
1331
+ * Function that creates event listener subscriptions. Alternative to api.addEventListener() — both subscribe
1332
+ * to configurator events. Use to react to state changes, screenshot readiness, viewport loading, showcase status, etc.
698
1333
  *
699
- * @param {Communicator} target
700
- * @param eventName
1334
+ * ### AI Coding Best Practices
1335
+ * Prefer api.addEventListener() directly from the Communicator object. If using fromCommunicatorEvent, pass the
1336
+ * event name and handler. Key events: configuratorDataUpdated, viewportReady, screenshotReady, showcaseStatusChanged,
1337
+ * getCameraResult. Always subscribe BEFORE sending commands that trigger responses.
1338
+ *
1339
+ * @param {Communicator} target - The Communicator instance to listen on.
1340
+ * @param {T} eventName - The event name from {@link FromMetaBoxApiEvents} to subscribe to.
1341
+ * @returns An Observable that emits the typed payload each time the event fires.
701
1342
  * @internal
702
1343
  */
703
1344
  declare function fromCommunicatorEvent<T extends FromMetaBoxApiEvents>(target: Communicator, eventName: T): Observable<FromMetaboxMessagePayloads[T]>;
704
1345
 
705
1346
  /**
706
1347
  * Represents a command to send Metabox Config to Metabox Basic Configurator.
707
- * @remarks
708
- * **Important**: No need to listen to any events to see changes.
1348
+ *
1349
+ * ### What does it unlock?
1350
+ * Configuration object passed to MetaBox during initialization. Specifies domain, host, standalone mode,
1351
+ * and other parameters that control how the configurator behaves.
1352
+ *
1353
+ * ### Practical Application
1354
+ * Internal configuration object auto-sent during initialization. Contains appId and config.
1355
+ * DO NOT call directly — integrateMetabox() handles this automatically as part of its setup sequence.
1356
+ *
1357
+ * ### AI Coding Best Practices
1358
+ * NEVER instantiate or send MetaboxConfig manually. It is auto-sent by integrateMetabox().
1359
+ * Use the IntegrateMetaboxConfig parameter of integrateMetabox() instead for setting domain, standalone,
1360
+ * loadingImage, introImage, state, etc.
709
1361
  *
710
1362
  * @internal
711
1363
  * Automatically sent when the Communicator instance is ready.
1364
+ *
1365
+ * @param {string} appId - The unique identifier for the Communicator Instance
1366
+ * @param {MetaboxCommandConfig} config - optional initial config: standalone - if true - disable metabox custom template and all logic
712
1367
  */
713
1368
  declare class MetaboxConfig extends CommandBase {
714
- /**
715
- * Creates an instance of MetaboxConfig.
716
- * @param {string} appId - The unique identifier for the Communicator Instance
717
- * @param {MetaboxCommandConfig} config - optional initial config: standalone - if true - disable metabox custom template and all logic
718
- */
719
1369
  constructor(appId: string, config: MetaboxCommandConfig);
720
1370
  }
721
1371
 
722
1372
  /**
723
1373
  * Represents a command to get a PDF from Metabox Basic Configurator.
724
- * @remarks
725
1374
  * This class sends a message to the Metabox API to generate a PDF based on the current configuration.
726
- * **Important**: No need to listen to any events to see changes.
727
- * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
1375
+ * **Important**: No need to listen to any events to see changes. Pdf will be downloaded automatically once it's ready.
1376
+ *
1377
+ * ### What does it unlock?
1378
+ * Generates a native MetaBox PDF document. No subscription required — it executes independently.
1379
+ *
1380
+ * ### Practical Application
1381
+ * Generates a branded PDF from the current configurator state server-side. No event subscription needed.
1382
+ * Use for B2B quote workflows, downloadable spec sheets, or emailing configured product summaries to prospects.
1383
+ *
1384
+ * ### AI Coding Best Practices
1385
+ * Simply call `api.sendCommandToMetabox(new GetPdf())`. No parameters or event subscription required.
1386
+ * The PDF generates inside MetaBox application.
728
1387
  *
729
1388
  * @example
730
1389
  * import { GetPdf, Communicator } from '@3dsource/metabox-front-api';
731
- *
732
- * @param {Communicator} api - communicator instance api
733
1390
  * window.env3DSource.apiReady = (api: Communicator) => {
1391
+ *
734
1392
  * api.sendCommandToMetabox(new GetPdf());
735
1393
  * };
736
1394
  */
737
1395
  declare class GetPdf extends CommandBase {
738
- /**
739
- * Creates an instance of GetPdf.
740
- *
741
- * @remarks
742
- * This constructor does not require any parameters.
743
- */
744
1396
  constructor();
745
1397
  }
746
1398
 
747
1399
  /**
748
1400
  * Represents a command to get a Call To Action Information from Metabox Basic Configurator.
749
- * @remarks
750
- * This class sends a message to the Metabox API to generate Call To Action information based on the current configuration and sends it to the endpoint URL from the CTA information.
1401
+ * This class sends a message to the Metabox API to generate Call To Action information based on the current
1402
+ * configuration and sends it to the endpoint URL from the CTA information.
751
1403
  *
752
1404
  * To listen for changes after sending this command, listen to the 'ecomConfiguratorDataUpdated' event.
753
- * //...Assume that the integration is already implemented (only once)
754
- * @example
755
- * import { Communicator } from '@3dsource/metabox-front-api';
756
1405
  *
757
- * @param {Communicator} api - communicator instance api
758
- * window.env3DSource.apiReady = (api: Communicator) => {
759
- * @param {EcomConfigurator} data - description for all ecom configurator params
760
- * api.addEventListener('ecomConfiguratorDataUpdated', (data) => {
761
- * console.log('Ecom configurator params:', data);
762
- * });
763
- * };
1406
+ * ### What does it unlock?
1407
+ * Retrieves information about call-to-action that were added to the configurator. Requires subscription to receive data.
764
1408
  *
765
- * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
1409
+ * ### Practical Application
1410
+ * Triggers the CTA (Call-to-Action) workflow configured in MetaBox admin. The CTA label and callback URL are set in admin.
1411
+ * When invoked, MetaBox POSTs the full configuration JSON (including BOM) to your callback URL endpoint, which returns a { redirectUrl }.
766
1412
  *
767
- * @example
768
- * import { GetCallToActionInformation, Communicator } from '@3dsource/metabox-front-api';
1413
+ * ### AI Coding Best Practices
1414
+ * Call only after user completes configuration. Subscribe to ecomConfiguratorDataUpdated to get CTA label/URL for building
1415
+ * custom CTA buttons in your UI. The POST payload includes the full bill of materials — your backend endpoint processes it
1416
+ * and returns a redirect URL.
769
1417
  *
770
- * @param {Communicator} api - communicator instance api
1418
+ * @example
1419
+ * import { Communicator, EcomConfigurator,GetCallToActionInformation } from '@3dsource/metabox-front-api';
771
1420
  * window.env3DSource.apiReady = (api: Communicator) => {
1421
+ *
1422
+ * //Subscribe to the event before sending the command to ensure you capture the response
1423
+ * api.addEventListener('ecomConfiguratorDataUpdated', (data:EcomConfigurator) => {
1424
+ * console.log('Ecom configurator params:', data);
1425
+ * });
1426
+ *
1427
+ * Send the command to get Call To Action information from Metabox Basic Configurator
772
1428
  * api.sendCommandToMetabox(new GetCallToActionInformation());
773
1429
  * };
774
1430
  */
775
1431
  declare class GetCallToActionInformation extends CommandBase {
776
- /**
777
- * Creates an instance of GetCallToActionInformation.
778
- *
779
- * @remarks
780
- * This constructor does not require any parameters.
781
- */
782
1432
  constructor();
783
1433
  }
784
1434
 
785
1435
  /**
786
1436
  * Represents a command to get the camera configuration from Unreal.
787
- * @remarks
788
1437
  * This class sends a message to the Metabox API to get the camera from a scene.
789
- *
790
1438
  * To listen for changes after sending this command, listen to the 'getCameraResult' event.
791
- * //...Assume that the integration is already implemented (only once)
792
- * @example
793
- * import { Communicator } from '@3dsource/metabox-front-api';
794
1439
  *
795
- * @param {Communicator} api - communicator instance api
796
- * window.env3DSource.apiReady = (api: Communicator) => {
797
- * @param {CameraCommandPayload} data - camera params
798
- * api.addEventListener('getCameraResult', (data) => {
799
- * console.log('Camera params after get camera command:', data);
800
- * });
801
- * };
1440
+ * ### What does it unlock?
1441
+ * Retrieves camera presets for the configurator; allowing extraction and application of saved camera positions.
802
1442
  *
803
- * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
1443
+ * ### Practical Application
1444
+ * Requests current camera state — returns asynchronously via the getCameraResult event. Returns a CameraCommandPayload
1445
+ * with fov, mode, position, rotation, and restrictions. Use to save camera positions, create shareable view links,
1446
+ * or build 'save this angle' features.
1447
+ *
1448
+ * ### AI Coding Best Practices
1449
+ * ALWAYS subscribe to getCameraResult BEFORE calling GetCamera(). Pattern: `api.addEventListener('getCameraResult', handler);`
1450
+ * then `api.sendCommandToMetabox(new GetCamera())`. The returned CameraCommandPayload can be fed directly back into
1451
+ * SetCamera to restore the view.
804
1452
  *
805
1453
  * @example
806
- * import { GetCamera, Communicator } from '@3dsource/metabox-front-api';
807
- * @param {Communicator} api - communicator instance api
1454
+ * import { Communicator, CameraCommandPayload,GetCamera } from '@3dsource/metabox-front-api';
808
1455
  * window.env3DSource.apiReady = (api: Communicator) => {
1456
+ *
1457
+ * //Subscribe to the event before sending the command to ensure you capture the response
1458
+ * api.addEventListener('getCameraResult', (data:CameraCommandPayload) => {
1459
+ * console.log('Camera params after get camera command:', data);
1460
+ * });
1461
+ *
809
1462
  * api.sendCommandToMetabox(new GetCamera());
810
1463
  * };
811
1464
  */
812
1465
  declare class GetCamera extends CommandBase {
813
- /**
814
- * Creates an instance of GetCamera.
815
- *
816
- * @remarks
817
- * This constructor does not require any parameters.
818
- */
819
1466
  constructor();
820
1467
  }
821
1468
 
822
1469
  /**
823
1470
  * Represents a command to set the camera configuration.
824
- * @remarks
825
1471
  * This class sends a message to the Metabox API to set the camera on a scene.
826
1472
  * **Important**: No need to listen to any events to see changes.
827
- * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
1473
+ *
1474
+ * ### What does it unlock?
1475
+ * Sets camera presets with restriction parameters (FOV, rotation, position).
1476
+ *
1477
+ * ### Practical Application
1478
+ * Sets camera with precise control: fov (degrees), mode ('orbit'|'fps'), position ({x,y,z}),
1479
+ * rotation ({horizontal,vertical}), and restrictions (min/max distance, FOV, rotation bounds).
1480
+ * Use for guided tours, preset view buttons, or restricting camera to prevent users seeing behind the product.
1481
+ *
1482
+ * ### AI Coding Best Practices
1483
+ * Only include fields you want to change — omitted values keep current settings. Use orbit mode for typical product viewing,
1484
+ * fps for walkthrough/room scenes. Apply restrictions to prevent bad angles. Full interface:
1485
+ * `{fov?, mode?, position?, rotation?, restrictions?}`.
828
1486
  *
829
1487
  * @example
830
1488
  * import { SetCamera, Communicator } from '@3dsource/metabox-front-api';
831
- * @param {Communicator} api - communicator instance api
832
1489
  * window.env3DSource.apiReady = (api: Communicator) => {
833
1490
  * api.sendCommandToMetabox(new SetCamera({
834
1491
  * fov: 45,
@@ -844,155 +1501,135 @@ declare class GetCamera extends CommandBase {
844
1501
  * minFov: 0,
845
1502
  * minHorizontalRotation: 0,
846
1503
  * minVerticalRotation: 0,
847
- * },
1504
+ * },
848
1505
  * }));
849
1506
  * };
1507
+ *
1508
+ * @param {CameraCommandPayload} camera - The camera configuration.
850
1509
  */
851
1510
  declare class SetCamera extends CommandBase {
852
- /**
853
- * Creates an instance of SetCamera.
854
- *
855
- * @param {CameraCommandPayload} camera - The camera configuration.
856
- */
857
1511
  constructor(camera: CameraCommandPayload);
858
1512
  }
859
1513
 
860
1514
  /**
861
1515
  * Represents a command to reset the camera to its initial position.
862
- * @remarks
863
1516
  * This class sends a message to the Metabox API to reset the camera on a scene.
864
- * **Important**: No need to listen to any events to see changes.
865
- * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
1517
+ *
1518
+ * ### What does it unlock?
1519
+ * Resets the camera to its default state and position. Used to return camera to initial configuration after user manipulation.
1520
+ *
1521
+ * ### Practical Application
1522
+ * Resets camera to the default position defined in the product/environment template. Essential for 'Reset View' buttons.
1523
+ * Also, useful after programmatic camera moves to return to a known starting state.
1524
+ *
1525
+ * ### AI Coding Best Practices
1526
+ * Call `api.sendCommandToMetabox(new ResetCamera())`. No parameters. Restores template defaults — not the last user position.
1527
+ * Good practice to call after SetProduct changes that may shift the focal point.
866
1528
  *
867
1529
  * @example
868
1530
  * import { ResetCamera, Communicator } from '@3dsource/metabox-front-api';
869
- * @param {Communicator} api - communicator instance api
870
1531
  * window.env3DSource.apiReady = (api: Communicator) => {
871
1532
  * api.sendCommandToMetabox(new ResetCamera());
872
1533
  * };
873
1534
  */
874
1535
  declare class ResetCamera extends CommandBase {
875
- /**
876
- * Creates an instance of ResetCamera.
877
- *
878
- * @remarks
879
- * This constructor does not require any parameters.
880
- */
881
1536
  constructor();
882
1537
  }
883
1538
 
884
1539
  /**
885
1540
  * Represents a command to apply zoom and change the camera zoom on a scene.
886
- * @remarks
887
1541
  * This class sends a command to the Metabox API to change zoom on a scene.
888
- * **Important**: No need to listen to any events to see changes.
889
- * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
1542
+ *
1543
+ * ### What does it unlock?
1544
+ * Controls zoom functionality for the configurator; allowing users to adjust the zoom level of 3D objects and camera presets.
1545
+ *
1546
+ * ### Practical Application
1547
+ * Implements programmatic zoom on the pixel-streamed viewport. Use to build zoom slider controls, pinch-to-zoom on mobile,
1548
+ * or 'zoom to detail' buttons. Takes a numeric delta: positive zooms in, negative zooms out
1549
+ * (e.g., ApplyZoom(50) zooms in, ApplyZoom(-50) zooms out).
1550
+ *
1551
+ * ### AI Coding Best Practices
1552
+ * Always use numeric delta values, not absolute zoom levels. Pair with a UI slider that sends incremental values.
1553
+ * Debounce zoom input to ~100ms intervals to prevent overwhelming the Unreal stream.
1554
+ * Pattern: `api.sendCommandToMetabox(new ApplyZoom(50))`.
890
1555
  *
891
1556
  * @example
892
1557
  * import { ApplyZoom, Communicator } from '@3dsource/metabox-front-api';
893
- *
894
- * @param {Communicator} api - communicator instance api
895
1558
  * window.env3DSource.apiReady = (api: Communicator) => {
896
- * api.sendCommandToMetabox(new ApplyZoom(10));
897
- * api.sendCommandToMetabox(new ApplyZoom(-10));
1559
+ * api.sendCommandToMetabox(new ApplyZoom(50));
898
1560
  * };
1561
+ *
1562
+ * @param {number} zoom - The zoom value to apply.
899
1563
  */
900
1564
  declare class ApplyZoom extends CommandBase {
901
- /**
902
- * Creates an instance of ApplyZoom.
903
- *
904
- * @param {number} zoom - The zoom value to apply.
905
- */
906
1565
  constructor(zoom: number);
907
1566
  }
908
1567
 
909
1568
  /**
910
- * Represents a command to initialize Showcase for a product scene and start a sequence for the product.
911
1569
  * @remarks
1570
+ * Represents a command to initialize Showcase for a product scene and start a sequence for the product.
912
1571
  * This class sends a command to the Metabox API to initialize showcase if the product has a sequence.
913
1572
  * To check this, find the showcase property in the current product and listen to the 'configuratorDataUpdated' event.
914
- * //...Assume that the integration is already implemented (only once)
915
- * @example
916
- * import { Communicator } from '@3dsource/metabox-front-api';
917
- *
918
- * @param {Communicator} api - communicator instance api
919
- * window.env3DSource.apiReady = (api: Communicator) => {
920
- * @param {ConfiguratorEnvelope} data - configurator state after updated
921
- * api.addEventListener('configuratorDataUpdated', (data) => {
922
- * console.log('State updated after applied new environment:', data);
923
- * });
924
- * };
925
- *
926
1573
  * If this property exists, you can send the init showcase command.
927
1574
  *
928
1575
  * To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event.
929
- * //...Assume that the integration is already implemented (only once)
930
- * @example
931
- * import { Communicator } from '@3dsource/metabox-front-api';
932
1576
  *
933
- * @param {Communicator} api - communicator instance api
934
- * window.env3DSource.apiReady = (api: Communicator) => {
935
- * @param {ShowCaseStatus} data - showcase status value
936
- * api.addEventListener('showcaseStatusChanged', (data) => {
937
- * console.log('Showcase status value after changed:', data);
938
- * });
939
- * };
1577
+ * ### What does it unlock?
1578
+ * Initializes and displays the showcase/demo view for the configurator. Used when transitioning into presentation or demo mode.
940
1579
  *
941
- * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
1580
+ * ### Practical Application
1581
+ * Loads the showcase/animation sequence attached to the current product. Must be called BEFORE PlayShowcase.
1582
+ * Use to initialize auto-playing product demos, trade show presentations, or hero section animations on landing pages.
942
1583
  *
943
- * @example
944
- * import { InitShowcase, Communicator } from '@3dsource/metabox-front-api';
1584
+ * ### AI Coding Best Practices
1585
+ * ALWAYS call InitShowcase() before PlayShowcase(). Required sequence: InitShowcase → PlayShowcase → PauseShowcase/StopShowcase.
1586
+ * Subscribe to showcaseStatusChanged to track playback state ('playing'/'paused'/'stopped').
945
1587
  *
946
- * @param {Communicator} api - communicator instance api
1588
+ * @example
1589
+ * import { Communicator,ShowCaseStatus,InitShowcase } from '@3dsource/metabox-front-api';
947
1590
  * window.env3DSource.apiReady = (api: Communicator) => {
1591
+ * //Subscribe to the event before sending the command to ensure you capture the response
1592
+ * api.addEventListener('showcaseStatusChanged', (data:ShowCaseStatus) => {
1593
+ * console.log('Showcase status value after changed:', data);
1594
+ * });
1595
+ *
948
1596
  * api.sendCommandToMetabox(new InitShowcase());
949
1597
  * };
950
1598
  */
951
1599
  declare class InitShowcase extends CommandBase {
952
- /**
953
- * Creates an instance of InitShowcase.
954
- *
955
- * @remarks
956
- * This constructor does not require any parameters.
957
- */
958
1600
  constructor();
959
1601
  }
960
1602
 
961
1603
  /**
962
1604
  * Represents a command to play Showcase for a product when it is already initialized and paused.
963
- * @remarks
964
1605
  * This class sends a command to the Metabox API to play showcase for a product if it is already initialized and paused.
965
1606
  *
966
1607
  * To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event.
967
- * //...Assume that the integration is already implemented (only once)
968
- * @example
969
- * import { Communicator } from '@3dsource/metabox-front-api';
970
1608
  *
971
- * @param {Communicator} api - communicator instance api
1609
+ * ### What does it unlock?
1610
+ * Starts or resumes the showcase/timeline playback. Executes the internal MetaBox play command internally.
1611
+ *
1612
+ * ### Practical Application
1613
+ * Starts or resumes showcase playback. Use for 'Play Demo' buttons on landing pages, auto-play on page load,
1614
+ * or resuming demos after inactivity timeout on kiosk displays.
1615
+ *
1616
+ * ### AI Coding Best Practices
1617
+ * Call `api.sendCommandToMetabox(new PlayShowcase())`. Must call InitShowcase() first or it won't play.
1618
+ * Subscribe to showcaseStatusChanged to track state. Auto-play pattern: wait for viewportReady → InitShowcase →
1619
+ * PlayShowcase.
1620
+ *
1621
+ * @example
1622
+ * import { Communicator,PlayShowcase } from '@3dsource/metabox-front-api';
972
1623
  * window.env3DSource.apiReady = (api: Communicator) => {
973
- * @param {ShowCaseStatus} data - showcase status value
1624
+ * //Subscribe to the event before sending the command to ensure you capture the response
974
1625
  * api.addEventListener('showcaseStatusChanged', (data) => {
975
1626
  * console.log('Showcase status value after changed:', data);
976
1627
  * });
977
- * };
978
1628
  *
979
- * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
980
- *
981
- * @example
982
- * import { PlayShowcase, Communicator } from '@3dsource/metabox-front-api';
983
- *
984
- * @param {Communicator} api - communicator instance api
985
- * window.env3DSource.apiReady = (api: Communicator) => {
986
1629
  * api.sendCommandToMetabox(new PlayShowcase());
987
1630
  * };
988
1631
  */
989
1632
  declare class PlayShowcase extends CommandBase {
990
- /**
991
- * Creates an instance of PlayShowcase.
992
- *
993
- * @remarks
994
- * This constructor does not require any parameters.
995
- */
996
1633
  constructor();
997
1634
  }
998
1635
 
@@ -1000,6 +1637,8 @@ declare class PlayShowcase extends CommandBase {
1000
1637
  * @internal
1001
1638
  * @hidden
1002
1639
  * Represents a command to send Unreal command.
1640
+ *
1641
+ * @param {Object} payload - An raw command that will be sent into MetaBox Unreal Application.
1003
1642
  */
1004
1643
  declare class UnrealCommand extends CommandBase {
1005
1644
  constructor(payload: object);
@@ -1007,119 +1646,126 @@ declare class UnrealCommand extends CommandBase {
1007
1646
 
1008
1647
  /**
1009
1648
  * Represents a command to pause Showcase for a product when it is already initialized and playing.
1010
- * @remarks
1011
1649
  * This class sends a command to the Metabox API to pause showcase for a product if it is already initialized and playing.
1012
1650
  *
1013
1651
  * To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event.
1014
- * //...Assume that the integration is already implemented (only once)
1015
- * @example
1016
- * import { Communicator } from '@3dsource/metabox-front-api';
1017
1652
  *
1018
- * @param {Communicator} api - communicator instance api
1019
- * window.env3DSource.apiReady = (api: Communicator) => {
1020
- * @param {ShowCaseStatus} data - showcase status value
1021
- * api.addEventListener('showcaseStatusChanged', (data) => {
1022
- * console.log('Showcase status value after changed:', data);
1023
- * });
1024
- * };
1653
+ * ### What does it unlock?
1654
+ * Pauses the showcase/timeline playback. Can be called independently without requiring any flag parameters.
1025
1655
  *
1026
- * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
1656
+ * ### Practical Application
1657
+ * Pauses showcase animation playback. The showcase remains initialized and can be resumed with
1658
+ * PlayShowcase. Use when you need to temporarily freeze the animation (e.g., on a "Pause" button click).
1027
1659
  *
1028
- * @example
1029
- * import { PauseShowcase, Communicator } from '@3dsource/metabox-front-api';
1660
+ * ### AI Coding Best Practices
1661
+ * Call `api.sendCommandToMetabox(new PauseShowcase())`. No parameters. Subscribe to showcaseStatusChanged
1662
+ * to confirm 'pause' state. Use PlayShowcase to resume or StopShowcase to reset.
1030
1663
  *
1031
- * @param {Communicator} api - communicator instance api
1664
+ * @example
1665
+ * import { Communicator,ShowCaseStatus,PauseShowcase } from '@3dsource/metabox-front-api';
1032
1666
  * window.env3DSource.apiReady = (api: Communicator) => {
1033
- * api.sendCommandToMetabox(new PauseShowcase());
1667
+ *
1668
+ * //Subscribe to the event before sending the command to ensure you capture the response
1669
+ * api.addEventListener('showcaseStatusChanged', (data:ShowCaseStatus) => {
1670
+ * console.log('Showcase status value after changed:', data);
1671
+ * });
1672
+ *
1673
+ * api.sendCommandToMetabox(new PauseShowcase());
1034
1674
  * };
1035
1675
  */
1036
1676
  declare class PauseShowcase extends CommandBase {
1037
- /**
1038
- * Creates an instance of PauseShowcase.
1039
- *
1040
- * @remarks
1041
- * This constructor does not require any parameters.
1042
- */
1043
1677
  constructor();
1044
1678
  }
1045
1679
 
1046
1680
  /**
1047
1681
  * Represents a command to stop Showcase for a product when it is already initialized, and you want to destroy it.
1048
- * @remarks
1049
1682
  * This class sends a command to the Metabox API to stop showcase for a product if it is already initialized.
1050
1683
  *
1051
1684
  * To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event.
1052
- * //...Assume that the integration is already implemented (only once)
1053
- * @example
1054
- * import { Communicator } from '@3dsource/metabox-front-api';
1055
1685
  *
1056
- * @param {Communicator} api - communicator instance api
1057
- * window.env3DSource.apiReady = (api: Communicator) => {
1058
- * @param {ShowCaseStatus} data - showcase status value
1059
- * api.addEventListener('showcaseStatusChanged', (data) => {
1060
- * console.log('Showcase status value after changed:', data);
1061
- * });
1062
- * };
1686
+ * ### What does it unlock?
1687
+ * Stops the showcase/timeline playback and closes the showcase mode. Returns to normal configurator view.
1063
1688
  *
1064
- * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
1689
+ * ### Practical Application
1690
+ * Stops showcase playback and exits showcase mode entirely. Returns to normal interactive configurator view.
1691
+ * Use for 'Exit Demo' buttons or auto-trigger when the user starts actively configuring the product.
1065
1692
  *
1066
- * @example
1067
- * import { StopShowcase, Communicator } from '@3dsource/metabox-front-api';
1693
+ * ### AI Coding Best Practices
1694
+ * Call `api.sendCommandToMetabox(new StopShowcase())`. Fully resets the showcase state. Subscribe to
1695
+ * showcaseStatusChanged to confirm 'stopped' status. After stopping, the configurator returns to full
1696
+ * interactive mode — re-enable configuration controls.
1068
1697
  *
1069
- * @param {Communicator} api - communicator instance api
1698
+ * @example
1699
+ * import { Communicator,ShowCaseStatus } from '@3dsource/metabox-front-api';
1070
1700
  * window.env3DSource.apiReady = (api: Communicator) => {
1071
- * api.sendCommandToMetabox(new StopShowcase());
1701
+ *
1702
+ * //Subscribe to the event before sending the command to ensure you capture the response
1703
+ * api.addEventListener('showcaseStatusChanged', (data:ShowCaseStatus) => {
1704
+ * console.log('Showcase status value after changed:', data);
1705
+ * });
1706
+ *
1707
+ * api.sendCommandToMetabox(new StopShowcase());
1072
1708
  * };
1073
1709
  */
1074
1710
  declare class StopShowcase extends CommandBase {
1075
- /**
1076
- * Creates an instance of StopShowcase.
1077
- *
1078
- * @remarks
1079
- * This constructor does not require any parameters.
1080
- */
1081
1711
  constructor();
1082
1712
  }
1083
1713
 
1084
1714
  /**
1085
1715
  * Image format.
1086
- * @remarks
1087
1716
  * This type represents the allowed image formats.
1717
+ *
1718
+ * ### What does it unlock?
1719
+ * Type alias for MIME types used in file/media handling. Defines supported file formats and media types.
1720
+ *
1721
+ * ### Practical Application
1722
+ * Type alias: 'image/png' | 'image/jpeg' | 'image/webp'. Used as the format parameter in GetScreenshot.
1723
+ * PNG for quality/transparency, JPEG for smaller files, WebP for modern browser optimization.
1724
+ *
1725
+ * ### AI Coding Best Practices
1726
+ * Pass as first param to GetScreenshot: `new GetScreenshot('image/png', {x:2048, y:2048})`.
1727
+ * Use PNG for highest quality and transparency. JPEG for smaller file size. WebP for modern browser optimization.
1728
+ * Match the saveImage filename extension to the format.
1088
1729
  */
1089
1730
  type MimeType = 'image/png' | 'image/jpeg' | 'image/webp';
1090
1731
  /**
1091
1732
  * Represents a command to get a screenshot.
1092
- * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
1093
1733
  *
1094
- * @remarks
1095
- * To listen for changes after sending this command, listen to the 'screenshot' event.
1096
- * //...Assume that the integration is already implemented (only once)
1097
- * @example
1098
- * import { Communicator } from '@3dsource/metabox-front-api';
1734
+ * To listen for changes after sending this command, listen to the 'screenshot' event before command is sent.
1099
1735
  *
1100
- * @param {Communicator} api - communicator instance api
1736
+ * ### What does it unlock?
1737
+ * Takes a screenshot on the server side (Unreal Engine) of the 3D scene. Returns high-quality image.
1738
+ * Requires subscription to the screenshotReady event to receive the rendered image.
1739
+ *
1740
+ * ### Practical Application
1741
+ * Renders a high-res screenshot on the Unreal Engine server. Takes format ('image/png'|'image/jpeg'|'image/webp')
1742
+ * and optional size ({x, y}). Returns base64 data via screenshotReady event. Use for thumbnails, social sharing,
1743
+ * saving config snapshots, or attaching images to quotes.
1744
+ *
1745
+ * ### AI Coding Best Practices
1746
+ * Subscribe to screenshotReady BEFORE sending GetScreenshot. Pattern:
1747
+ * `api.addEventListener('screenshotReady', (data) => { if(data) saveImage(data, 'name.png'); })`.
1748
+ * Specify size for consistent outputs: `new GetScreenshot('image/png', {x:2048, y:2048})`.
1749
+ * Use saveImage() helper to convert base64 to downloadable file.
1750
+ *
1751
+ * @example
1752
+ * import { Communicator,saveImage,GetScreenshot } from '@3dsource/metabox-front-api';
1101
1753
  * window.env3DSource.apiReady = (api: Communicator) => {
1102
- * @param {string} data - base64 string image
1103
- * api.addEventListener('screenshot', (data) => {
1754
+ *
1755
+ * //Subscribe to the event before sending the command to ensure you capture the response
1756
+ * api.addEventListener('screenshot', (data:string) => {
1757
+ * // The data is a base64 string of the image. You can use it to display the image or save it as a file.
1104
1758
  * console.log('Get screenshot here:', data);
1105
1759
  * saveImage(data, 'Render.png');
1106
1760
  * });
1107
- * };
1108
- *
1109
- * @example
1110
- * import { GetScreenshot, Communicator, saveImage } from '@3dsource/metabox-front-api';
1111
1761
  *
1112
- * @param {Communicator} api - communicator instance api
1113
- * window.env3DSource.apiReady = (api: Communicator) => {
1114
- * api.sendCommandToMetabox(new GetScreenshot('image/png', { x: 1024, y: 1024 }));
1762
+ * api.sendCommandToMetabox(new GetScreenshot('image/png', { x: 1024, y: 1024 }));
1115
1763
  * };
1764
+ *
1765
+ * @param {MimeType} mimeType - The output format.
1766
+ * @param {{ x: number; y: number }} [size] - Optional size in pixels.
1116
1767
  */
1117
1768
  declare class GetScreenshot extends CommandBase {
1118
- /**
1119
- * Constructs an instance of GetScreenshot.
1120
- * @param {MimeType} mimeType - The output format.
1121
- * @param {{ x: number; y: number }} [size] - Optional size in pixels.
1122
- */
1123
1769
  constructor(mimeType: MimeType, size?: {
1124
1770
  x: number;
1125
1771
  y: number;
@@ -1128,274 +1774,317 @@ declare class GetScreenshot extends CommandBase {
1128
1774
 
1129
1775
  /**
1130
1776
  * Represents a command to set a product by its ID.
1131
- *
1132
- * @remarks
1133
1777
  * This action sends a message to the Metabox API to set a product using the provided product ID.
1134
- *
1135
1778
  * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.
1136
- * //...Assume that the integration is already implemented (only once)
1137
- * @example
1138
- * import { Communicator } from '@3dsource/metabox-front-api';
1139
1779
  *
1140
- * @param {Communicator} api - communicator instance api
1780
+ * ### What does it unlock?
1781
+ * Sets the active product in the Basic Configurator by its UUID. Triggers a full state update including
1782
+ * available materials, slots, showcase data, and environment compatibility.
1783
+ *
1784
+ * ### Practical Application
1785
+ * Selects which product to display in the 3D viewport. Takes a productId (UUID). Use to build product picker UIs,
1786
+ * deep-link to specific products, or switch products programmatically based on external catalog selections.
1787
+ * The configurator responds with a full ConfiguratorEnvelope via configuratorDataUpdated.
1788
+ *
1789
+ * ### AI Coding Best Practices
1790
+ * Call `api.sendCommandToMetabox(new SetProduct('product-uuid'))`. Get valid product IDs from
1791
+ * `configurator.products` in the configuratorDataUpdated envelope. Subscribe to configuratorDataUpdated
1792
+ * BEFORE sending the command. After switching products, material and environment selections may reset —
1793
+ * re-apply them if needed.
1794
+ *
1795
+ * @example
1796
+ * import { Communicator,ConfiguratorEnvelope } from '@3dsource/metabox-front-api';
1141
1797
  * window.env3DSource.apiReady = (api: Communicator) => {
1142
- * @param {ConfiguratorEnvelope} data - configurator state after updated
1143
- * api.addEventListener('configuratorDataUpdated', (data) => {
1798
+ *
1799
+ * //Subscribe to the event before sending the command to ensure you capture the response
1800
+ * api.addEventListener('configuratorDataUpdated', (data:ConfiguratorEnvelope) => {
1144
1801
  * console.log('State updated after applied new product:', data);
1145
1802
  * });
1146
- * };
1147
- *
1148
- * @example
1149
- * import { SetProduct, Communicator } from '@3dsource/metabox-front-api';
1150
1803
  *
1151
- * @param {Communicator} api - communicator instance api
1152
- * window.env3DSource.apiReady = (api: Communicator) => {
1153
- * api.setCommandToMetaBox(new SetProduct(
1804
+ * api.sendCommandToMetabox(new SetProduct(
1154
1805
  * 'ffea6b5c-3a8a-4f56-9417-e605acb5cca3'
1155
1806
  * ));
1156
1807
  * };
1808
+ *
1809
+ * @param {string} productId - The product ID.
1157
1810
  */
1158
1811
  declare class SetProduct extends CommandBase {
1159
- /**
1160
- * Creates an instance of SetProduct.
1161
- *
1162
- * @param {string} productId - The product ID.
1163
- */
1164
1812
  constructor(productId: string);
1165
1813
  }
1166
1814
 
1167
1815
  /**
1168
1816
  * Represents a command to set a material by its slot ID and Material ID.
1169
- *
1170
- * @remarks
1171
1817
  * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.
1172
- * //...Assume that the integration is already implemented (only once)
1173
1818
  *
1174
- * @example
1175
- * import { Communicator } from '@3dsource/metabox-front-api';
1819
+ * ### What does it unlock?
1820
+ * Sets a material variant for a product slot. Simulates selecting a different material/finish from the menu
1821
+ * for a specific customizable surface on the product.
1822
+ *
1823
+ * ### Practical Application
1824
+ * Applies a material to a specific slot on the active product. Takes slotId (string) and materialId (UUID).
1825
+ * Use to build swatch pickers, apply preset themes/bundles, or sync material selections from an external
1826
+ * PIM/ERP system via externalId mapping.
1176
1827
  *
1177
- * @param {Communicator} api - communicator instance api
1828
+ * ### AI Coding Best Practices
1829
+ * Get valid slotId and materialId values from the product's slot definitions in the configuratorDataUpdated envelope —
1830
+ * check `product.slots` and each slot's `enabledMaterials` list. Pattern:
1831
+ * `new SetProductMaterial('slot-name', 'material-uuid')`. The referenced product must already be set.
1832
+ *
1833
+ * @example
1834
+ * import { Communicator,ConfiguratorEnvelope,SetProductMaterial } from '@3dsource/metabox-front-api';
1178
1835
  * window.env3DSource.apiReady = (api: Communicator) => {
1179
- * @param {ConfiguratorEnvelope} data - configurator state after updated
1180
- * api.addEventListener('configuratorDataUpdated', (data) => {
1836
+ *
1837
+ * //Subscribe to the event before sending the command to ensure you capture the response
1838
+ * api.addEventListener('configuratorDataUpdated', (data:ConfiguratorEnvelope) => {
1181
1839
  * console.log('State updated after applied new material:', data);
1182
1840
  * });
1183
- * };
1184
- *
1185
- * @example
1186
- * import { SetProductMaterial, Communicator } from '@3dsource/metabox-front-api';
1187
1841
  *
1188
- * @param {Communicator} api - communicator instance api
1189
- * window.env3DSource.apiReady = (api: Communicator) => {
1190
- * api.sendCommandToMetabox(new SetProductMaterial(
1842
+ * api.sendCommandToMetabox(new SetProductMaterial(
1191
1843
  * 'carpaint',
1192
1844
  * 'dd829d6e-9200-47a7-8d5b-af5df89b7e91',
1193
1845
  * ));
1194
1846
  * };
1847
+ *
1848
+ * @param {string} slotId - The slot ID.
1849
+ * @param {string} materialId - The material ID.
1195
1850
  */
1196
1851
  declare class SetProductMaterial extends CommandBase {
1197
- /**
1198
- * Creates an instance of SetProductMaterial.
1199
- *
1200
- * @param {string} slotId - The slot ID.
1201
- * @param {string} materialId - The material ID.
1202
- */
1203
1852
  constructor(slotId: string, materialId: string);
1204
1853
  }
1205
1854
 
1206
1855
  /**
1207
1856
  * Represents a command to set the environment by its ID.
1208
- *
1209
- * @remarks
1210
1857
  * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.
1211
- * //...Assume that the integration is already implemented (only once)
1212
- * @example
1213
- * import { Communicator } from '@3dsource/metabox-front-api';
1214
1858
  *
1215
- * @param {Communicator} api - communicator instance api
1859
+ * ### What does it unlock?
1860
+ * Sets environmental/lighting settings for the scene. Controls factors like lighting conditions and environmental appearance.
1861
+ *
1862
+ * ### Practical Application
1863
+ * Changes the 3D scene/environment (studio, showroom, outdoor, etc.). Takes an environmentId UUID.
1864
+ * Environments include lighting, backdrop, and optionally dynamic sky (udsEnabled) with time-of-day (udsHour) control.
1865
+ *
1866
+ * ### AI Coding Best Practices
1867
+ * Call `api.sendCommandToMetabox(new SetEnvironment('env-uuid'))`. Get valid environment IDs from the configurator
1868
+ * definition in configuratorDataUpdated. Set environment after product during initialization. Each environment has
1869
+ * its own material slots, thumbnails, and lighting properties.
1870
+ *
1871
+ * @example
1872
+ * import { Communicator,ConfiguratorEnvelope } from '@3dsource/metabox-front-api';
1216
1873
  * window.env3DSource.apiReady = (api: Communicator) => {
1217
- * @param {ConfiguratorEnvelope} data - configurator state after updated
1218
- * api.addEventListener('configuratorDataUpdated', (data) => {
1874
+ *
1875
+ * //Subscribe to the event before sending the command to ensure you capture the response
1876
+ * api.addEventListener('configuratorDataUpdated', (data:ConfiguratorEnvelope) => {
1219
1877
  * console.log('State updated after applied new environment:', data);
1220
1878
  * });
1221
- * };
1222
1879
  *
1223
- * @example
1224
- * import { SetEnvironment, Communicator } from '@3dsource/metabox-front-api';
1225
- *
1226
- * @param {Communicator} api - communicator instance api
1227
- * window.env3DSource.apiReady = (api: Communicator) => {
1228
- * api.sendCommandToMetabox(new SetEnvironment('55555555-1234-1234-1234-01234567890'));
1880
+ * api.sendCommandToMetabox(new SetEnvironment('55555555-1234-1234-1234-01234567890'))
1229
1881
  * };
1882
+ *
1883
+ * @param {string} environmentId - The environment ID.
1230
1884
  */
1231
1885
  declare class SetEnvironment extends CommandBase {
1232
- /**
1233
- * Creates an instance of SetEnvironment.
1234
- *
1235
- * @param {string} environmentId - The environment ID.
1236
- */
1237
1886
  constructor(environmentId: string);
1238
1887
  }
1239
1888
 
1240
1889
  /**
1241
1890
  * Represents a command to set an environment material by its slot ID and Material ID.
1242
- *
1243
- * @remarks
1244
1891
  * To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.
1245
- * //...Assume that the integration is already implemented (only once)
1246
- * @example
1247
- * import { Communicator } from '@3dsource/metabox-front-api';
1248
1892
  *
1249
- * @param {Communicator} api - communicator instance api
1893
+ * ### What does it unlock?
1894
+ * Sets environmental material properties such as textures and appearance attributes for the scene environment.
1895
+ *
1896
+ * ### Practical Application
1897
+ * Applies materials to environment slots (floor, walls, backdrop textures). Takes slotId and materialId.
1898
+ * Use for scene-based configurators where the environment is also customizable — kitchen visualizers,
1899
+ * room planners, trade show booth designers.
1900
+ *
1901
+ * ### AI Coding Best Practices
1902
+ * Pattern: `new SetEnvironmentMaterial('floor-slot-id', 'material-uuid')`. Get valid slot and material IDs from
1903
+ * the environment definition's slots array in configuratorDataUpdated. Only useful when the active environment
1904
+ * has configurable material slots.
1905
+ *
1906
+ * @example
1907
+ * import { Communicator,ConfiguratorEnvelope } from '@3dsource/metabox-front-api';
1250
1908
  * window.env3DSource.apiReady = (api: Communicator) => {
1251
- * @param {ConfiguratorEnvelope} data - configurator state after updated
1252
- * api.addEventListener('configuratorDataUpdated', (data) => {
1909
+ *
1910
+ * //Subscribe to the event before sending the command to ensure you capture the response
1911
+ * api.addEventListener('configuratorDataUpdated', (data:ConfiguratorEnvelope) => {
1253
1912
  * console.log('State updated after applied new environment material:', data);
1254
1913
  * });
1255
- * };
1256
1914
  *
1257
- * @example
1258
- * import { SetEnvironmentMaterial, Communicator } from '@3dsource/metabox-front-api';
1259
- *
1260
- * @param {Communicator} api - communicator instance api
1261
- * window.env3DSource.apiReady = (api: Communicator) => {
1262
- * api.sendCommandToMetabox(new SetEnvironmentMaterial(
1915
+ * api.sendCommandToMetabox(new SetEnvironmentMaterial(
1263
1916
  * 'carpaint',
1264
1917
  * 'dd829d6e-9200-47a7-8d5b-af5df89b7e91',
1265
1918
  * ));
1266
1919
  * };
1920
+ *
1921
+ * @param {string} slotId - The slot ID.
1922
+ * @param {string} materialId - The material ID.
1267
1923
  */
1268
1924
  declare class SetEnvironmentMaterial extends CommandBase {
1269
- /**
1270
- * Creates an instance of SetEnvironmentMaterial.
1271
- *
1272
- * @param {string} slotId - The slot ID.
1273
- * @param {string} materialId - The material ID.
1274
- */
1275
1925
  constructor(slotId: string, materialId: string);
1276
1926
  }
1277
1927
 
1278
1928
  /**
1279
1929
  * Represents a command to toggle the embedded Metabox menu.
1280
- * @remarks
1281
1930
  * This command can only be used when using the metabox menu.
1282
- * **Important**: No need to listen to any events to see changes.
1931
+ *
1932
+ * ### What does it unlock?
1933
+ * Shows the embedded menu interface. Only works when using the MetaBox native menu (not in standalone/custom menu
1934
+ * mode).
1935
+ *
1936
+ * ### Practical Application
1937
+ * Toggles the native MetaBox right sidebar menu. Takes a boolean parameter. Pass false to hide when building custom UI.
1938
+ * In standalone mode, the menu is already hidden — this is only relevant in default (non-standalone) mode.
1939
+ *
1940
+ * ### AI Coding Best Practices
1941
+ * In standalone mode (`{standalone:true}`), this is unnecessary (menu already hidden). In default mode,
1942
+ * call `new ShowEmbeddedMenu(false)` early in initialization to hide built-in UI before rendering custom controls.
1943
+ * Pattern for custom UI: `ShowEmbeddedMenu(false)` + `ShowOverlayInterface(false)`.
1283
1944
  *
1284
1945
  * @example
1285
1946
  * import { ShowEmbeddedMenu, Communicator } from '@3dsource/metabox-front-api';
1286
- *
1287
- * @param {Communicator} api - communicator instance api
1288
1947
  * window.env3DSource.apiReady = (api: Communicator) => {
1289
1948
  * api.sendCommandToMetabox(new ShowEmbeddedMenu(true));
1290
1949
  * };
1950
+ *
1951
+ * @param {boolean} visible - A flag indicating whether the embedded menu should be visible.
1291
1952
  */
1292
1953
  declare class ShowEmbeddedMenu extends CommandBase {
1293
- /**
1294
- * Creates an instance of ShowEmbeddedMenu.
1295
- *
1296
- * @param {boolean} visible - A flag indicating whether the embedded menu should be visible.
1297
- */
1298
1954
  constructor(visible: boolean);
1299
1955
  }
1300
1956
 
1301
1957
  /**
1302
1958
  * Represents a command to toggle the Unreal Overlay Interface Menu.
1303
- *
1304
- * @remarks
1305
1959
  * This action sends a message to the Metabox API to toggle the visibility of the Unreal overlay UI.
1306
- * **Important**: No need to listen to any events to see changes.
1960
+ *
1961
+ * ### What does it unlock?
1962
+ * Shows the overlay interface elements. Displays UI controls and buttons overlaid on the 3D scene.
1963
+ *
1964
+ * ### Practical Application
1965
+ * Toggles viewport overlay controls (buttons overlaid on the 3D scene). Takes a boolean.
1966
+ * Use `ShowOverlayInterface(false)` alongside `ShowEmbeddedMenu(false)` when building fully custom UI
1967
+ * that replaces all native MetaBox controls.
1968
+ *
1969
+ * ### AI Coding Best Practices
1970
+ * In standalone mode, overlays are already hidden. In default mode, call `new ShowOverlayInterface(false)`
1971
+ * early in initialization to prevent flash of native UI. Always pair with `ShowEmbeddedMenu(false)` for clean custom UI.
1972
+ * Pass true to restore if entering a mode that uses native controls.
1307
1973
  *
1308
1974
  * @example
1309
1975
  * import { ShowOverlayInterface, Communicator } from '@3dsource/metabox-front-api';
1310
- *
1311
- * @param {Communicator} api - communicator instance api
1312
1976
  * window.env3DSource.apiReady = (api: Communicator) => {
1313
- * api.setCommandToMetaBox(new ShowOverlayInterface(true));
1977
+ * api.sendCommandToMetabox(new ShowOverlayInterface(true));
1314
1978
  * };
1979
+ *
1980
+ * @param {boolean} visible - A flag indicating whether the Unreal overlay UI should be visible.
1315
1981
  */
1316
1982
  declare class ShowOverlayInterface extends CommandBase {
1317
- /**
1318
- * Creates an instance of ShowOverlayInterface.
1319
- *
1320
- * @param {boolean} visible - A flag indicating whether the Unreal overlay UI should be visible.
1321
- */
1322
1983
  constructor(visible: boolean);
1323
1984
  }
1324
1985
 
1325
1986
  /**
1326
1987
  * Represents a command to show measurement for a product when it is already loaded.
1327
- * @remarks
1328
1988
  * This class sends a command to the Metabox API to show measurement for a product if it is already initialized.
1329
- * **Important**: No need to listen to any events to see changes.
1330
- * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
1989
+ *
1990
+ * ### What does it unlock?
1991
+ * Shows the measurement overlay. Works as a toggle with HideMeasurement to control visibility.
1992
+ *
1993
+ * ### Practical Application
1994
+ * Shows the measurement/dimension overlay tools on the 3D viewport. Use for B2B or technical applications
1995
+ * where buyers need to verify product dimensions, check fit specifications, or confirm measurements during procurement.
1996
+ *
1997
+ * ### AI Coding Best Practices
1998
+ * Call `api.sendCommandToMetabox(new ShowMeasurement())`. No parameters. Pair with HideMeasurement for toggle behavior.
1999
+ * Track visibility state in your app to keep toggle buttons in sync.
1331
2000
  *
1332
2001
  * @example
1333
2002
  * import { ShowMeasurement, Communicator } from '@3dsource/metabox-front-api';
1334
- *
1335
- * @param {Communicator} api - communicator instance api
1336
2003
  * window.env3DSource.apiReady = (api: Communicator) => {
1337
2004
  * api.sendCommandToMetabox(new ShowMeasurement());
1338
2005
  * };
1339
2006
  */
1340
2007
  declare class ShowMeasurement extends CommandBase {
1341
- /**
1342
- * Creates an instance of ShowMeasurement.
1343
- *
1344
- * @remarks
1345
- * This constructor does not require any parameters.
1346
- */
1347
2008
  constructor();
1348
2009
  }
1349
2010
 
1350
2011
  /**
1351
2012
  * Represents a command to hide measurement for a product when it is already loaded.
1352
- * @remarks
1353
2013
  * This class sends a command to the Metabox API to hide measurement for a product if it is already initialized.
1354
- * **Important**: No need to listen to any events to see changes.
1355
- * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
2014
+ *
2015
+ * ### What does it unlock?
2016
+ * Hides the measurement overlay. Executes unconditionally to hide the UI controls.
2017
+ *
2018
+ * ### Practical Application
2019
+ * Hides the measurement/dimension overlay. Use when transitioning from a technical spec view back to a clean
2020
+ * product presentation, or to keep consumer-facing configurators visually clean.
2021
+ *
2022
+ * ### AI Coding Best Practices
2023
+ * Call `api.sendCommandToMetabox(new HideMeasurement())`. No parameters. Pair with ShowMeasurement as a toggle.
2024
+ * Track visibility state in your app state to keep toggle buttons in sync.
1356
2025
  *
1357
2026
  * @example
1358
2027
  * import { HideMeasurement, Communicator } from '@3dsource/metabox-front-api';
1359
- *
1360
- * @param {Communicator} api - communicator instance api
1361
2028
  * window.env3DSource.apiReady = (api: Communicator) => {
1362
2029
  * api.sendCommandToMetabox(new HideMeasurement());
1363
2030
  * };
1364
2031
  */
1365
2032
  declare class HideMeasurement extends CommandBase {
1366
- /**
1367
- * Creates an instance of HideMeasurement.
1368
- *
1369
- * @remarks
1370
- * This constructor does not require any parameters.
1371
- */
1372
2033
  constructor();
1373
2034
  }
1374
2035
 
1375
2036
  /**
1376
2037
  * Represents a command to force set the device type.
1377
- *
1378
- * @remarks
1379
2038
  * This class sends a message to the Metabox API to force set the device type.
1380
- * **Important**: No need to listen to any events to see changes.
1381
- * //...Assume that the integration is already implemented (only once)
2039
+ *
2040
+ * ### What does it unlock?
2041
+ * Forces the specification of device type (desktop or mobile) for the MetaBox configurator. Possibly deprecated.
2042
+ *
2043
+ * ### Practical Application
2044
+ * Forces device type override (desktop/tablet/mobile). Likely deprecated — MetaBox auto-detects via ApplicationDeviceTypes.
2045
+ * Only relevant for kiosk or showroom setups where you need to force a specific rendering mode.
2046
+ *
2047
+ * ### AI Coding Best Practices
2048
+ * Avoid unless you have a confirmed kiosk/showroom use case. If needed, set it once during initialization only.
2049
+ * Prefer letting MetaBox handle device detection automatically.
1382
2050
  *
1383
2051
  * @example
1384
2052
  * import { ForceSetDeviceType, Communicator } from '@3dsource/metabox-front-api';
1385
2053
  *
1386
- * @param {Communicator} api - communicator instance api
1387
2054
  * window.env3DSource.apiReady = (api: Communicator) => {
1388
2055
  * api.sendCommandToMetabox(new ForceSetDeviceType('desktop'));
1389
2056
  * };
2057
+ *
2058
+ * @param {ApplicationDeviceTypes} deviceType - The device type to force set.
1390
2059
  */
1391
2060
  declare class ForceSetDeviceType extends CommandBase {
1392
- /**
1393
- * Creates an instance of ForceSetDeviceType.
1394
- *
1395
- * @param {ApplicationDeviceTypes} deviceType - The device type to force set.
1396
- */
1397
2061
  constructor(deviceType: ApplicationDeviceTypes);
1398
2062
  }
1399
2063
 
1400
- export { AppLoaded, AppLoaded_V3, ApplyZoom, BasicRouteUrl, CommandBase, Communicator, EventDispatcher, ForceSetDeviceType, GetCallToActionInformation, GetCamera, GetPdf, GetScreenshot, HideMeasurement, InitShowcase, Metabox, MetaboxBasicConfiguratorActions, MetaboxConfig, MetaboxDomain, MetaboxHost, MetaboxHost_V3, Metabox_V3, PauseShowcase, PlayShowcase, ResetCamera, SetCamera, SetEnvironment, SetEnvironmentMaterial, SetProduct, SetProductMaterial, ShowEmbeddedMenu, ShowMeasurement, ShowOverlayInterface, StopShowcase, UnrealCommand, VERSION, fromCommunicatorEvent, getUrlParams, integrateMetabox, prepareIframeSrc, saveImage, setUrlParams };
2064
+ /**
2065
+ * Represents a command to resume the pixel streaming session.
2066
+ * This class sends a message to the Metabox API to resume a paused or disconnected stream.
2067
+ *
2068
+ * ### What does it unlock?
2069
+ * Resumes the Unreal Engine pixel streaming connection after it has been paused, disconnected, or stopped due to inactivity (AFK timeout).
2070
+ *
2071
+ * ### Practical Application
2072
+ * Used to reconnect the 3D streaming session without a full page reload. Essential for 'Reconnect' or 'Resume' buttons
2073
+ * shown when the stream is interrupted, e.g., after an idle timeout or network disruption.
2074
+ *
2075
+ * ### AI Coding Best Practices
2076
+ * Call `api.sendCommandToMetabox(new ResumeStream())`. No parameters. Resumes the existing streaming session —
2077
+ * does not reinitialize the configurator or reset product/environment state.
2078
+ *
2079
+ * @example
2080
+ * import { ResumeStream, Communicator } from '@3dsource/metabox-front-api';
2081
+ * window.env3DSource.apiReady = (api: Communicator) => {
2082
+ * api.sendCommandToMetabox(new ResumeStream());
2083
+ * };
2084
+ */
2085
+ declare class ResumeStream extends CommandBase {
2086
+ constructor();
2087
+ }
2088
+
2089
+ export { AppLoaded, AppLoaded_V3, ApplyZoom, BasicRouteUrl, CommandBase, Communicator, EventDispatcher, ForceSetDeviceType, GetCallToActionInformation, GetCamera, GetPdf, GetScreenshot, HideMeasurement, InitShowcase, Metabox, MetaboxBasicConfiguratorActions, MetaboxConfig, MetaboxData, MetaboxDomain, MetaboxHost, MetaboxHost_V3, Metabox_V3, PauseShowcase, PlayShowcase, ResetCamera, ResumeStream, SetCamera, SetEnvironment, SetEnvironmentMaterial, SetProduct, SetProductMaterial, ShowEmbeddedMenu, ShowMeasurement, ShowOverlayInterface, StopShowcase, UnrealCommand, VERSION, fromCommunicatorEvent, getUrlParams, integrateMetabox, prepareIframeSrc, saveImage, setUrlParams };
1401
2090
  export type { ApplicationDeviceTypes, 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 };