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