@3dsource/metabox-modular-configurator-api 0.0.1-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts ADDED
@@ -0,0 +1,940 @@
1
+ import { MetaBoxCommandPacket } from '@3dsource/types-unreal';
2
+ import { UnrealCallBackJson, UnrealState, StreamResolutionProps } from '@3dsource/angular-unreal-module';
3
+ import { Observable } from 'rxjs';
4
+
5
+ type ApplicationDeviceTypes = 'deviceTypeAuto' | 'deviceTypeMobile' | 'deviceTypeDesktop';
6
+
7
+ type FromMetaboxApiAction = 'bridge' | 'appLoaded';
8
+
9
+ declare const MetaboxModularConfiguratorActions: {
10
+ readonly setEnvironment: "setEnvironment";
11
+ readonly setEnvironmentMaterialById: "setEnvironmentMaterialById";
12
+ readonly setComponent: "setComponent";
13
+ readonly setComponentType: "setComponentType";
14
+ readonly setComponentMaterialById: "setComponentMaterialById";
15
+ readonly sendCommandToUnreal: "sendCommandToUnreal";
16
+ readonly getPdf: "getPdf";
17
+ readonly getScreenshot: "getScreenshot";
18
+ readonly watchCallbacks: "watchCallbacks";
19
+ readonly showEmbeddedMenu: "showEmbeddedMenu";
20
+ readonly forceSetDeviceType: "forceSetDeviceType";
21
+ readonly showOverlayInterface: "showOverlayInterface";
22
+ readonly resetCamera: "resetCamera";
23
+ readonly applyZoom: "applyZoom";
24
+ readonly initShowcase: "initShowcase";
25
+ readonly playShowcase: "playShowcase";
26
+ readonly pauseShowcase: "pauseShowcase";
27
+ readonly stopShowcase: "stopShowcase";
28
+ };
29
+ type ToMetaBoxActions = (typeof MetaboxModularConfiguratorActions)[keyof typeof MetaboxModularConfiguratorActions];
30
+ /**
31
+ * @internal
32
+ * @hidden
33
+ */
34
+ type ToMetaboxMessagePayload = ToMetaboxMessagePayloads[keyof ToMetaboxMessagePayloads];
35
+ type Test = Record<ToMetaBoxActions, object>;
36
+ /**
37
+ * Interface for messages sent from the application to the Metabox Modular Configurator.
38
+ */
39
+ interface ToMetaboxMessagePayloads {
40
+ [MetaboxModularConfiguratorActions.setEnvironment]: {
41
+ id: string;
42
+ };
43
+ [MetaboxModularConfiguratorActions.setEnvironmentMaterialById]: {
44
+ slotId: string;
45
+ materialId: string;
46
+ };
47
+ [MetaboxModularConfiguratorActions.setComponentType]: {
48
+ typeId: string;
49
+ };
50
+ [MetaboxModularConfiguratorActions.setComponent]: {
51
+ id: string;
52
+ typeId: string;
53
+ isRoot: boolean;
54
+ };
55
+ [MetaboxModularConfiguratorActions.setComponentMaterialById]: {
56
+ slotId: string;
57
+ materialId: string;
58
+ };
59
+ [MetaboxModularConfiguratorActions.sendCommandToUnreal]: MetaBoxCommandPacket;
60
+ [MetaboxModularConfiguratorActions.getScreenshot]: {
61
+ format: MimeType;
62
+ size?: {
63
+ x: number;
64
+ y: number;
65
+ };
66
+ };
67
+ [MetaboxModularConfiguratorActions.getPdf]: void;
68
+ [MetaboxModularConfiguratorActions.watchCallbacks]: void;
69
+ [MetaboxModularConfiguratorActions.showEmbeddedMenu]: {
70
+ visible: boolean;
71
+ };
72
+ [MetaboxModularConfiguratorActions.showOverlayInterface]: {
73
+ isVisible: boolean;
74
+ };
75
+ [MetaboxModularConfiguratorActions.forceSetDeviceType]: {
76
+ deviceType: ApplicationDeviceTypes;
77
+ };
78
+ [MetaboxModularConfiguratorActions.resetCamera]: void;
79
+ [MetaboxModularConfiguratorActions.applyZoom]: {
80
+ zoom: number;
81
+ };
82
+ [MetaboxModularConfiguratorActions.initShowcase]: {
83
+ productId: string;
84
+ };
85
+ [MetaboxModularConfiguratorActions.playShowcase]: void;
86
+ [MetaboxModularConfiguratorActions.pauseShowcase]: void;
87
+ [MetaboxModularConfiguratorActions.stopShowcase]: void;
88
+ }
89
+ interface ToMetaBoxMessageEnvelope {
90
+ action: ToMetaBoxActions;
91
+ payload?: ToMetaboxMessagePayload | never;
92
+ }
93
+ interface ToMetaBoxMessage {
94
+ host: 'metaBoxHost';
95
+ payload: ToMetaBoxMessageEnvelope;
96
+ }
97
+
98
+ /**
99
+ * Represents a modular configurator object with its configuration, selected materials,
100
+ * product identifier, and associated environment.
101
+ */
102
+ interface ModularConfiguratorEnvelope {
103
+ /**
104
+ * A reference to the universal configurator.
105
+ */
106
+ configurator: ModularConfigurator;
107
+ /**
108
+ * The unique product identifier.
109
+ */
110
+ productId: string;
111
+ /**
112
+ * A record mapping product material selections.
113
+ */
114
+ productMaterialsIds: SelectedIds;
115
+ /**
116
+ * The unique environment identifier.
117
+ */
118
+ environmentId: string;
119
+ /**
120
+ * A record mapping environment material selections.
121
+ */
122
+ environmentMaterialsIds: SelectedIds;
123
+ }
124
+ /**
125
+ * Represents the universal configurator with its modular properties and components.
126
+ */
127
+ interface ModularConfigurator {
128
+ /** Unique identifier for the configurator. */
129
+ id: string;
130
+ /** Indicates if the configurator is active. */
131
+ /** Label for the product collection. */
132
+ productCollectionLabel: string;
133
+ /** The name of the configurator. */
134
+ name: string;
135
+ /** The camera settings used in the configurator. */
136
+ /** Client information associated with the configurator. */
137
+ /** A list of products for the configurator. */
138
+ products: UniversalConfiguratorProduct[];
139
+ /** A list of available environments. */
140
+ environments: UniversalConfiguratorEnvironment[];
141
+ /** GraphQL typename for the configurator. */
142
+ __typename: 'UniversalConfigurator';
143
+ }
144
+ /**
145
+ * Represents a product within the universal configurator.
146
+ */
147
+ interface UniversalConfiguratorProduct {
148
+ /** The product's unique identifier. */
149
+ productId: string;
150
+ /** Position index of the product. */
151
+ position: number;
152
+ /** Display label for the product. */
153
+ label: string;
154
+ /** Optional camera settings for the product. */
155
+ /** The detailed product information. */
156
+ product: Product;
157
+ /** GraphQL typename for the product. */
158
+ __typename: 'UniversalConfiguratorProduct';
159
+ }
160
+ /**
161
+ * Represents product details including visual assets and configuration.
162
+ */
163
+ interface Product {
164
+ /** The title of the product. */
165
+ title: string;
166
+ /** List of thumbnails for the product. */
167
+ thumbnailList: Thumbnail[];
168
+ /** Available slots for the product. */
169
+ slots: Slot[];
170
+ /** List of metaProperties for the product (optional). */
171
+ metaProperties: MetaProperty[];
172
+ /** The model information associated with the product. */
173
+ /** Unique identifier for the product. */
174
+ id: string;
175
+ /** Unique external id for the product. */
176
+ externalId: string;
177
+ /** Showcase details for the product. */
178
+ /** GraphQL typename for the product. */
179
+ __typename: 'Product';
180
+ }
181
+ /**
182
+ * Represents a thumbnail image entity with dimensions and URL path.
183
+ */
184
+ interface Thumbnail {
185
+ /** Width of the thumbnail. */
186
+ width: number;
187
+ /** Height of the thumbnail. */
188
+ height: number;
189
+ /** URL path to the thumbnail image. */
190
+ urlPath: string;
191
+ /** GraphQL typename (as a string, flexible type). */
192
+ __typename: 'Thumbnail';
193
+ }
194
+ /**
195
+ * Represents a slot within a product that may allow material customization.
196
+ */
197
+ interface Slot {
198
+ /** Unique identifier for the slot. */
199
+ id: string;
200
+ /** Display a label for the slot. */
201
+ label: string;
202
+ /** A list of enabled materials for the slot. */
203
+ enabledMaterials: Material[];
204
+ /** GraphQL typename for the slot. */
205
+ __typename: 'Slot';
206
+ }
207
+ /**
208
+ * Represents a metaProperty within a product that may allow business logic customization.
209
+ */
210
+ interface MetaProperty {
211
+ /** Unique identifier for the metaProperty. */
212
+ id: string;
213
+ /** Display the name for the metaProperty. */
214
+ name: string;
215
+ /** Value for the metaProperty. */
216
+ value: string;
217
+ /** Type for the metaProperty. */
218
+ type: string;
219
+ /** GraphQL typename for the metaProperty. */
220
+ __typename: 'MetaProperty';
221
+ }
222
+ /**
223
+ * Represents a material that can be applied to a product slot.
224
+ */
225
+ interface Material {
226
+ /** Unique identifier for the material. */
227
+ id: string;
228
+ /** Title or name of the material. */
229
+ title: string;
230
+ /** Unique external id for the material. */
231
+ externalId: string;
232
+ /** List of thumbnails for the material. */
233
+ thumbnailList: Thumbnail[];
234
+ /** The model information associated with the material. */
235
+ /** GraphQL typename for the material. */
236
+ __typename: 'Material';
237
+ }
238
+ /**
239
+ * Represents the environment settings for a universal configurator.
240
+ */
241
+ interface UniversalConfiguratorEnvironment {
242
+ /** Unique identifier for the environment. */
243
+ environmentId: string;
244
+ /** Position index of the environment. */
245
+ position: number;
246
+ /** Display label for the environment. */
247
+ label: string;
248
+ /** Detailed environment configuration. */
249
+ environment: Environment;
250
+ /** GraphQL typename for the environment. */
251
+ __typename: 'UniversalConfiguratorEnvironment';
252
+ }
253
+ /**
254
+ * Represents an environment with associated media and configuration.
255
+ */
256
+ interface Environment {
257
+ /** Unique identifier for the environment. */
258
+ id: string;
259
+ /** Title or name of the environment. */
260
+ title: string;
261
+ /** Flag indicating if UDS is enabled. */
262
+ /** The north yaw of the sun in the environment. */
263
+ /** The UDS hour setting for the environment. */
264
+ /** GraphQL typename for the environment. */
265
+ __typename: 'Environment';
266
+ /** List of thumbnails for the environment (optional). */
267
+ thumbnailList: Thumbnail[];
268
+ /** List of slots for the environment (optional). */
269
+ slots: Slot[];
270
+ }
271
+ /**
272
+ * Defines the structure for a mapping of selected materials.
273
+ */
274
+ type SelectedIds = Record<string, Record<string, string>>;
275
+ /**
276
+ * Defines the structure for an available showcase status for the current product on a scene.
277
+ */
278
+ declare const ShowCaseStatus: {
279
+ readonly INIT: "init";
280
+ readonly PLAY: "play";
281
+ readonly PAUSE: "pause";
282
+ readonly STOP: "stop";
283
+ };
284
+ type ShowCaseStatusKeys = (typeof ShowCaseStatus)[keyof typeof ShowCaseStatus];
285
+
286
+ interface FromMetaboxMessagePayloads {
287
+ /**
288
+ * Dispatches Every time the configurator data is updated.
289
+ * I.e., when the user changes the configuration. (Material, Product, Environment)
290
+ */
291
+ configuratorData: ModularConfiguratorEnvelope;
292
+ /**
293
+ * Dispatches Every time when the configurator product showcase will be changed.
294
+ */
295
+ showcaseStatus: ShowCaseStatusKeys;
296
+ /**
297
+ * Dispatches Every time when the configurator connected/disconnected with Unreal Engine.
298
+ */
299
+ dataChannelConnected: boolean;
300
+ /**
301
+ * Dispatches Every time when the Unreal Viewport is visible/hidden.
302
+ */
303
+ viewportReady: boolean;
304
+ /**
305
+ * Dispatches Every when user toggles fullscreen button in an internal menu.
306
+ */
307
+ isFullScreen: boolean;
308
+ /**
309
+ * Dispatches at the moment while the configurator loads. Shows status information.
310
+ */
311
+ statusMessage: string | null;
312
+ /**
313
+ * @experimental
314
+ * Dispatches every Unreal is sending a command callback.
315
+ * Works only after the new WatchCallbacks () command is sent.
316
+ */
317
+ unrealCallback: {
318
+ json: UnrealCallBackJson;
319
+ };
320
+ /**
321
+ * Dispatches every time when Unreal is sending ordered render with new GetFastRender() command.
322
+ */
323
+ screenshot: string | null;
324
+ fastRender: string | null;
325
+ /**
326
+ * @experimental
327
+ * Dispatches every Unreal state is changing, including all unreal module state.
328
+ */
329
+ unrealState: UnrealState;
330
+ /**
331
+ * Dispatches every time when Unreal is changing its video stream size.
332
+ */
333
+ videoResolution: StreamResolutionProps;
334
+ }
335
+ /**
336
+ * @hidden
337
+ */
338
+ type FromMetaBoxApiEvents = keyof FromMetaboxMessagePayloads;
339
+ /**
340
+ * @internal
341
+ * This creates all event envelopes defined in MetaBoxAPIPayloads.
342
+ */
343
+ interface MetaBoxApiEnvelope<T extends FromMetaBoxApiEvents> {
344
+ action: 'bridge';
345
+ eventType: T;
346
+ payload: FromMetaboxMessagePayloads[T];
347
+ }
348
+ /**
349
+ * @hidden
350
+ * @internal
351
+ * Used for signaling that the app is loaded and ready to open api.
352
+ */
353
+ interface MCAppLoaded {
354
+ action: 'appLoaded';
355
+ eventType?: unknown;
356
+ payload?: unknown;
357
+ }
358
+ /**
359
+ * @internal
360
+ * @hidden
361
+ * This creates a union of all event envelopes defined in MetaBoxAPIPayloads.
362
+ */
363
+ type FromMetaBoxAPIEnvelope = {
364
+ [K in keyof FromMetaboxMessagePayloads]: MetaBoxApiEnvelope<K>;
365
+ }[keyof FromMetaboxMessagePayloads] | MCAppLoaded;
366
+ interface FromMetaBoxMessage {
367
+ host: 'metabox';
368
+ envelope: FromMetaBoxAPIEnvelope;
369
+ }
370
+
371
+ /**
372
+ * Base class for commands sent to the Metabox.
373
+ */
374
+ declare class CommandBase {
375
+ data: ToMetaBoxMessageEnvelope;
376
+ }
377
+
378
+ /**
379
+ * Represents a callback listener for specific message types.
380
+ */
381
+ interface Listener {
382
+ messageType: string;
383
+ callback: (data: unknown) => void;
384
+ }
385
+ /**
386
+ * EventDispatcher is a class that manages event listeners and dispatches events to them.
387
+ */
388
+ declare class EventDispatcher {
389
+ /**
390
+ * Storage for callback listeners by message type.
391
+ */
392
+ listeners: Listener[];
393
+ destroy(): void;
394
+ /**
395
+ * Adds an event listener for receiving specific types of messages.
396
+ *
397
+ * @param messageType - The message type to listen for.
398
+ * @param callback - The callback function to execute when a message is received.
399
+ */
400
+ addEventListener(messageType: string, callback: (data: unknown) => void): this;
401
+ /**
402
+ * Dispatches an event to all listeners of a specific message type.
403
+ *
404
+ * @param messageType - The message type.
405
+ * @param data - The data associated with the event.
406
+ */
407
+ dispatchEvent(messageType: string, data: unknown): this;
408
+ /**
409
+ * Removes an event listener for a specific type of message.
410
+ *
411
+ * @param messageType - The message type.
412
+ * @param callback - The callback function to remove.
413
+ */
414
+ removeEventListener(messageType: string, callback: (data: unknown) => void): this;
415
+ }
416
+
417
+ /**
418
+ * Handles messaging between the host page and embedded to the Metabox content.
419
+ * @internal Use {@link Communicator.createInstance} or the {@link integrateMetaBox} helper to instantiate.
420
+ */
421
+ declare class Communicator extends EventDispatcher {
422
+ /**
423
+ * Singleton reference to the current communicator instance.
424
+ */
425
+ static instance: Communicator | null;
426
+ /**
427
+ * Bound handler for incoming postMessage events.
428
+ */
429
+ private binder;
430
+ /**
431
+ * Constructs a Communicator, replacing any existing instance, and begins listening for messages.
432
+ * @internal
433
+ */
434
+ constructor();
435
+ /**
436
+ * Listens for to the Metabox to signal readiness, then initializes communicator.
437
+ * @param apiReadyCallback - Called with the new Communicator once to the Metabox is loaded.
438
+ */
439
+ static createInstance(apiReadyCallback: (api: Communicator) => void): void;
440
+ /**
441
+ * Cleans up resources and stops listening for messages.
442
+ */
443
+ destroy(): void;
444
+ /**
445
+ * Posts a command to the Metabox iframe.
446
+ * @param command - An action command containing data to send.
447
+ */
448
+ sendCommandToMetaBox<T extends CommandBase>(command: T): void;
449
+ /**
450
+ * Registers an event listener for messages dispatched by Metabox.
451
+ * @override
452
+ */
453
+ addEventListener<T extends FromMetaBoxApiEvents>(messageType: T, callback: (data: FromMetaboxMessagePayloads[T]) => void): this;
454
+ /**
455
+ * Dispatches a typed event to all registered listeners.
456
+ * @override
457
+ */
458
+ dispatchEvent<T extends FromMetaBoxApiEvents>(messageType: T, data: FromMetaboxMessagePayloads[T]): this;
459
+ /**
460
+ * Removes a previously registered event listener.
461
+ * @override
462
+ */
463
+ removeEventListener<T extends FromMetaBoxApiEvents>(messageType: T, callback: (data: FromMetaboxMessagePayloads[T]) => void): this;
464
+ /**
465
+ * Filters and dispatches incoming messages from to the Metabox.
466
+ * @param messageType - Expected message type for filtering ('metaboxData').
467
+ * @param event - The postMessage event received on window.
468
+ */
469
+ private handleMessageReceived;
470
+ }
471
+
472
+ /**
473
+ * Integrates Metabox Modular Configurator into the provided layout.
474
+ *
475
+ * @remarks
476
+ * This function injects an iframe into a specified container element in the DOM and initializes
477
+ * the communicator for interacting with the Metabox embedded content.
478
+ *
479
+ * @param iframeSrc - The source URL of the Metabox iframe.
480
+ * Additional url parameters:
481
+ * ```javascript
482
+ * sidebar=false - disables the internal Metabox menu
483
+ * introImage=https://example.com/image.png - sets the intro image
484
+ * ```
485
+ * i.e., a final link will look like https://metabox.3dsource.com/metabox-configurator/modular/your-configurator-id?sidebar=false&introImage=https://example.com/image.png
486
+ *
487
+ * @param containerId - The ID of the layout element. Defaults to 'embed3DSource'.
488
+ * @param apiReadyCallback
489
+ * @throws Error if the container element with the specified ID is not found.
490
+ *
491
+ * @example
492
+ * import {
493
+ * integrateMetaBox,
494
+ * } from '@3dsource/metabox-modular-configurator-api';
495
+ *
496
+ * integrateMetaBox(
497
+ * 'https://metabox.3dsource.com/metabox-configurator/modular/12345678-1234-1234-1234-01234567890?introImage=https://example.com/intro.webp&sidebar=false',
498
+ * 'embed3DSource'
499
+ * );
500
+ */
501
+ declare function integrateMetabox(iframeSrc: string, containerId: string | undefined, apiReadyCallback: (api: Communicator) => void): void;
502
+
503
+ /**
504
+ * Saves an image by triggering a download.
505
+ *
506
+ * @remarks
507
+ * This function creates an anchor element, sets its `href` attribute to the provided image URL,
508
+ * and triggers a click event to initiate a download with the specified filename.
509
+ *
510
+ * @param imageUrl - The URL of the image to save.
511
+ * @param filename - The name of the file to save.
512
+ */
513
+ declare function saveImage(imageUrl: string, filename: string): void;
514
+
515
+ /**
516
+ * Pauses execution for a specified duration.
517
+ *
518
+ * @remarks
519
+ * This function returns a promise that resolves after the given number of milliseconds.
520
+ *
521
+ * @param time - The time to sleep in milliseconds.
522
+ * @returns A promise that resolves after the specified duration.
523
+ */
524
+ declare function sleep(time: number): Promise<void>;
525
+
526
+ /**
527
+ * Sets the URL parameters based on the provided state.
528
+ *
529
+ * @remarks
530
+ * This function updates the current URL by replacing its search parameters with the key-value pairs from the provided state object.
531
+ *
532
+ * @param state - An object containing key-value pairs to set as URL parameters.
533
+ */
534
+ declare function setUrlParams(state: Record<string, string>): void;
535
+ /**
536
+ * Retrieves the URL parameters as an object.
537
+ *
538
+ * @remarks
539
+ * This function parses the current URL's search parameters and returns them as a key-value object.
540
+ *
541
+ * @returns An object containing the URL parameters.
542
+ */
543
+ declare function getUrlParams(): Record<string, string>;
544
+
545
+ /**
546
+ * Wrapper helper function to use it with rxJs the same as `fromEvent` to listen to events from the Communicator.
547
+ * @param target
548
+ * @param eventName
549
+ */
550
+ declare function fromCommunicatorEvent<T extends FromMetaBoxApiEvents>(target: Communicator, eventName: T): Observable<FromMetaboxMessagePayloads[T]>;
551
+
552
+ /**
553
+ * Represents a command to get a PDF from Metabox.
554
+ * @remarks
555
+ * This class sends a message to the Metabox API to generate a PDF based on the current configuration.
556
+ * This action does not require any parameters.
557
+ *
558
+ * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
559
+ *
560
+ * @example
561
+ * import { GetPdf, Communicator } from '@3dsource/metabox-modular-configurator-api';
562
+ * window.env3DSource.apiReady = (api:Communicator) => {
563
+ * api.sendCommandToMetaBox(new GetPdf());
564
+ * };
565
+ */
566
+ declare class GetPdf extends CommandBase {
567
+ /**
568
+ * Creates an instance of GetPdf.
569
+ *
570
+ * @remarks
571
+ * This constructor does not require any parameters.
572
+ */
573
+ constructor();
574
+ }
575
+
576
+ /**
577
+ * Represents a command to send to unreal and reset camera to initial.
578
+ * @remarks
579
+ * This class sends a message to the Metabox API to reset the camera on a scene.
580
+ * This action does not require any parameters.
581
+ *
582
+ * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
583
+ *
584
+ * @example
585
+ * import { ResetCamera, Communicator } from '@3dsource/metabox-modular-configurator-api';
586
+ * window.env3DSource.apiReady = (api:Communicator) => {
587
+ * api.sendCommandToMetaBox(new ResetCamera());
588
+ * };
589
+ */
590
+ declare class ResetCamera extends CommandBase {
591
+ /**
592
+ * Creates an instance of ResetCamera.
593
+ *
594
+ * @remarks
595
+ * This constructor does not require any parameters.
596
+ */
597
+ constructor();
598
+ }
599
+
600
+ /**
601
+ * Represents a command to ApplyZoom and change zoom camera on a scene.
602
+ * @remarks
603
+ * This class sends a command to the Metabox API to change zoom on a scene.
604
+ *
605
+ * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
606
+ *
607
+ * @example
608
+ * import { ApplyZoom, Communicator } from '@3dsource/metabox-modular-configurator-api';
609
+ * window.env3DSource.apiReady = (api:Communicator) => {
610
+ * api.sendCommandToMetaBox(new ApplyZoom(10));
611
+ * api.sendCommandToMetaBox(new ApplyZoom(-10));
612
+ * };
613
+ */
614
+ declare class ApplyZoom extends CommandBase {
615
+ /**
616
+ * Creates an instance of ApplyZoom.
617
+ *
618
+ * @param {...number} zoom
619
+ */
620
+ constructor(zoom: number);
621
+ }
622
+
623
+ /**
624
+ * Represents a command to Init Showcase for a product on a scene and start a sequence for the product.
625
+ * @remarks
626
+ * This class sends a command to the Metabox API to init showcase if the product has a sequence.
627
+ *
628
+ * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
629
+ *
630
+ * @example
631
+ * import { InitShowcase, Communicator } from '@3dsource/metabox-modular-configurator-api';
632
+ * window.env3DSource.apiReady = (api:Communicator) => {
633
+ * api.sendCommandToMetaBox(new InitShowcase('ffea6b5c-3a8a-4f56-9417-e605acb5cca3');
634
+ * };
635
+ */
636
+ declare class InitShowcase extends CommandBase {
637
+ /**
638
+ * Creates an instance of InitShowcase.
639
+ *
640
+ * @param {string} productId
641
+ */
642
+ constructor(productId: string);
643
+ }
644
+
645
+ /**
646
+ * Represents a command to Play Showcase for a product when it already init, and you call pause, for example, before it.
647
+ * @remarks
648
+ * This class sends a command to the Metabox API to play showcase for a product if it is already initialized and pause.
649
+ *
650
+ * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
651
+ *
652
+ * @example
653
+ * import { PlayShowcase, Communicator } from '@3dsource/metabox-modular-configurator-api';
654
+ * window.env3DSource.apiReady = (api:Communicator) => {
655
+ * api.sendCommandToMetaBox(new PlayShowcase());
656
+ * };
657
+ */
658
+ declare class PlayShowcase extends CommandBase {
659
+ /**
660
+ * Creates an instance of PlayShowcase.
661
+ *
662
+ * @remarks
663
+ * This constructor does not require any parameters.
664
+ */
665
+ constructor();
666
+ }
667
+
668
+ /**
669
+ * Represents a command to Pause Showcase for a product when it already init and play, and you call pause.
670
+ * @remarks
671
+ * This class sends a command to the Metabox API to pause showcase for a product if it is already initialized and play.
672
+ *
673
+ * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
674
+ *
675
+ * @example
676
+ * import { PauseShowcase, Communicator } from '@3dsource/metabox-modular-configurator-api';
677
+ * window.env3DSource.apiReady = (api:Communicator) => {
678
+ * api.sendCommandToMetaBox(new PauseShowcase());
679
+ * };
680
+ */
681
+ declare class PauseShowcase extends CommandBase {
682
+ /**
683
+ * Creates an instance of PauseShowcase.
684
+ *
685
+ * @remarks
686
+ * This constructor does not require any parameters.
687
+ */
688
+ constructor();
689
+ }
690
+
691
+ /**
692
+ * Represents a command to Stop Showcase for a product when it already init, and you want to destroy it.
693
+ * @remarks
694
+ * This class sends a command to the Metabox API to Stop showcase for a product if it is already initialized.
695
+ *
696
+ * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
697
+ *
698
+ * @example
699
+ * import { StopShowcase, Communicator } from '@3dsource/metabox-modular-configurator-api';
700
+ * window.env3DSource.apiReady = (api:Communicator) => {
701
+ * api.sendCommandToMetaBox(new StopShowcase());
702
+ * };
703
+ */
704
+ declare class StopShowcase extends CommandBase {
705
+ /**
706
+ * Creates an instance of StopShowcase.
707
+ *
708
+ * @remarks
709
+ * This constructor does not require any parameters.
710
+ */
711
+ constructor();
712
+ }
713
+
714
+ /**
715
+ * Image format.
716
+ * @remarks
717
+ * This type represents the allowed image formats.
718
+ */
719
+ type MimeType = 'image/png' | 'image/jpeg' | 'image/webp';
720
+ /**
721
+ * Represents a command to get a screenshot.
722
+ *
723
+ * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
724
+ *
725
+ * @example
726
+ * import { GetScreenshot, Communicator, saveImage } from '@3dsource/metabox-modular-configurator-api';
727
+ * window.env3DSource.apiReady = (api:Communicator) => {
728
+ * // Listen for events from to the Metabox API
729
+ * api.addEventListener('screenshot', (data) => {
730
+ * // Process the get screenshot response
731
+ * saveImage(data, 'Render.png');
732
+ * });
733
+ * api.sendCommandToMetaBox(new GetScreenshot('image/png', { x: 1024, y: 1024 }));
734
+ * };
735
+ */
736
+ declare class GetScreenshot extends CommandBase {
737
+ /**
738
+ * Constructs an instance of GetScreenshot.
739
+ * @param {MimeType} mimeType - The output format.
740
+ * @param {{ x: number; y: number }} [size] - Optional size in pixels.
741
+ */
742
+ constructor(mimeType: MimeType, size?: {
743
+ x: number;
744
+ y: number;
745
+ });
746
+ }
747
+
748
+ /**
749
+ * Represents a command to set a component by its data (ID, typeId, isRoot).
750
+ *
751
+ * @remarks
752
+ * This action sends a message to the Metabox API to set a component using the provided component ID and its component type data.
753
+ *
754
+ * @example
755
+ * import { SetComponent, Communicator } from '@3dsource/metabox-modular-configurator-api';
756
+ *
757
+ * //...Assume that the integration is already implemented
758
+ * window.env3DSource.apiReady = (api:Communicator) => {
759
+ * api.setCommandToMetaBox(new SetComponent(
760
+ * 'ffea6b5c-3a8a-4f56-9417-e605acb5cca3', 'typeId', true
761
+ * ));
762
+ * };
763
+ */
764
+ declare class SetComponent extends CommandBase {
765
+ /**
766
+ * Creates an instance of SetComponent.
767
+ *
768
+ * @param {string} id
769
+ * @param {string} typeId
770
+ * @param {boolean} isRoot
771
+ */
772
+ constructor(id: string, typeId: string, isRoot: boolean);
773
+ }
774
+
775
+ /**
776
+ * Represents a command to set component material by its slot ID and Material ID.
777
+ *
778
+ * @example
779
+ * import { SetComponentMaterial, Communicator } from '@3dsource/metabox-modular-configurator-api';
780
+ *
781
+ * //...Assume that the integration is already implemented
782
+ * window.env3DSource.apiReady = (api:Communicator) => {
783
+ * api.sendCommandToMetaBox(new SetComponentMaterial(
784
+ * 'carpaint',
785
+ * 'dd829d6e-9200-47a7-8d5b-af5df89b7e91',
786
+ * ));
787
+ * };
788
+ */
789
+ declare class SetComponentMaterial extends CommandBase {
790
+ /**
791
+ * Creates an instance of SetComponentMaterial.
792
+ *
793
+ * @param {string} slotId - The slot ID.
794
+ * @param {string} materialId - The material ID.
795
+ */
796
+ constructor(slotId: string, materialId: string);
797
+ }
798
+
799
+ /**
800
+ * Represents a command to set a component type by its ID.
801
+ *
802
+ * @remarks
803
+ * This action sends a message to the Metabox API to set a component type using the provided component type ID.
804
+ *
805
+ * @example
806
+ * import { SetComponentType, Communicator } from '@3dsource/metabox-modular-configurator-api';
807
+ *
808
+ * //...Assume that the integration is already implemented
809
+ * window.env3DSource.apiReady = (api:Communicator) => {
810
+ * api.setCommandToMetaBox(new SetComponentType(
811
+ * 'ffea6b5c-3a8a-4f56-9417-e605acb5cca3'
812
+ * ));
813
+ * };
814
+ */
815
+ declare class SetComponentType extends CommandBase {
816
+ /**
817
+ * Creates an instance of SetComponentType.
818
+ *
819
+ * @param {string} typeId
820
+ */
821
+ constructor(typeId: string);
822
+ }
823
+
824
+ /**
825
+ * Represents a command to set the environment by its ID.
826
+ *
827
+ * @example
828
+ * import { SetEnvironment, Communicator } from '@3dsource/metabox-modular-configurator-api';
829
+ *
830
+ * //...Assume that the integration is already implemented
831
+ * window.env3DSource.apiReady = (api:Communicator) => {
832
+ * // Change the environment to '55555555-1234-1234-1234-01234567890'
833
+ * api.sendCommandToMetaBox(new SetEnvironment('55555555-1234-1234-1234-01234567890'));
834
+ * };
835
+ */
836
+ declare class SetEnvironment extends CommandBase {
837
+ /**
838
+ * Creates an instance of SetEnvironment.
839
+ *
840
+ * @param {string} environmentId - The environment ID.
841
+ */
842
+ constructor(environmentId: string);
843
+ }
844
+
845
+ /**
846
+ * Represents a command to set an environment material by its slot ID and Material ID.
847
+ *
848
+ * @example
849
+ * import { SetEnvironmentMaterial, Communicator } from '@3dsource/metabox-modular-configurator-api';
850
+ *
851
+ * //...Assume that the integration is already implemented
852
+ * window.env3DSource.apiReady = (api:Communicator) => {
853
+ * api.sendCommandToMetaBox(new SetEnvironmentMaterial(
854
+ * 'carpaint',
855
+ * 'dd829d6e-9200-47a7-8d5b-af5df89b7e91',
856
+ * ));
857
+ * };
858
+ */
859
+ declare class SetEnvironmentMaterial extends CommandBase {
860
+ /**
861
+ * Creates an instance of SetEnvironmentMaterial.
862
+ *
863
+ * @param {string} slotId - The slot ID.
864
+ * @param {string} materialId - The material ID.
865
+ */
866
+ constructor(slotId: string, materialId: string);
867
+ }
868
+
869
+ /**
870
+ * Represents a command to toggle the Embedded to the Metabox Menu.
871
+ *
872
+ * @example
873
+ * import { ShowEmbeddedMenu, Communicator } from '@3dsource/metabox-modular-configurator-api';
874
+ *
875
+ * //...Assume that the integration is already implemented
876
+ * window.env3DSource.apiReady = (api:Communicator) => {
877
+ * api.setCommandToMetaBox(new ShowEmbeddedMenu(true));
878
+ * };
879
+ */
880
+ declare class ShowEmbeddedMenu extends CommandBase {
881
+ /**
882
+ * Creates an instance of ShowEmbeddedMenu.
883
+ *
884
+ * @param {boolean} visible - A flag indicating whether the embedded menu should be visible.
885
+ */
886
+ constructor(visible: boolean);
887
+ }
888
+
889
+ /**
890
+ * Represents a command to toggle the Unreal Overlay Interface Menu.
891
+ *
892
+ * @remarks
893
+ * This action sends a message to the Metabox API to toggle the visibility of the Unreal overlay UI.
894
+ *
895
+ * @example
896
+ * import { ShowOverlayInterface, Communicator } from '@3dsource/metabox-modular-configurator-api';
897
+ *
898
+ * //...Assume that the integration is already implemented
899
+ * window.env3DSource.apiReady = (api:Communicator) => {
900
+ * api.setCommandToMetaBox(new ShowOverlayInterface(true));
901
+ * };
902
+ */
903
+ declare class ShowOverlayInterface extends CommandBase {
904
+ /**
905
+ * Creates an instance of ShowOverlayInterface.
906
+ *
907
+ * @param {boolean} visible - A flag indicating whether the Unreal overlay UI should be visible.
908
+ */
909
+ constructor(visible: boolean);
910
+ }
911
+
912
+ /**
913
+ * @internal
914
+ * @hidden
915
+ * Represents a command to send Unreal command.
916
+ */
917
+ declare class UnrealCommand extends CommandBase {
918
+ constructor(payload: MetaBoxCommandPacket);
919
+ }
920
+
921
+ /**
922
+ * @experimental
923
+ * @internal
924
+ * @hidden
925
+ * @remarks
926
+ * Represents a command to watch Unreal callbacks from Unreal engine.
927
+ * Can be useful for custom solutions.
928
+ */
929
+ declare class WatchCallbacks extends CommandBase {
930
+ /**
931
+ * Creates an instance of WatchCallbacks.
932
+ *
933
+ * @remarks
934
+ * This constructor does not require any parameters.
935
+ */
936
+ constructor();
937
+ }
938
+
939
+ export { ApplyZoom, CommandBase, Communicator, EventDispatcher, GetPdf, GetScreenshot, InitShowcase, MetaboxModularConfiguratorActions, PauseShowcase, PlayShowcase, ResetCamera, SetComponent, SetComponentMaterial, SetComponentType, SetEnvironment, SetEnvironmentMaterial, ShowCaseStatus, ShowEmbeddedMenu, ShowOverlayInterface, StopShowcase, UnrealCommand, WatchCallbacks, fromCommunicatorEvent, getUrlParams, integrateMetabox, saveImage, setUrlParams, sleep };
940
+ export type { ApplicationDeviceTypes, Environment, FromMetaBoxAPIEnvelope, FromMetaBoxApiEvents, FromMetaBoxMessage, FromMetaboxApiAction, FromMetaboxMessagePayloads, MCAppLoaded, Material, MetaBoxApiEnvelope, MetaProperty, MimeType, ModularConfigurator, ModularConfiguratorEnvelope, Product, SelectedIds, ShowCaseStatusKeys, Slot, Test, Thumbnail, ToMetaBoxActions, ToMetaBoxMessage, ToMetaBoxMessageEnvelope, ToMetaboxMessagePayload, ToMetaboxMessagePayloads, UniversalConfiguratorEnvironment, UniversalConfiguratorProduct };