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