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