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