@3dsource/metabox-front-api 3.0.14 → 3.0.16-dev.1
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.
|
@@ -2,16 +2,30 @@ import { Observable } from 'rxjs';
|
|
|
2
2
|
|
|
3
3
|
type ApplicationDeviceTypes = 'deviceTypeAuto' | 'deviceTypeMobile' | 'deviceTypeDesktop';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
* @hidden
|
|
8
|
+
* Represents main constants.
|
|
9
|
+
*/
|
|
5
10
|
declare const Metabox = "metabox_v3";
|
|
6
11
|
declare const MetaboxHost = "metaboxHost_v3";
|
|
7
|
-
declare const MetaboxData = "metaboxData_v3";
|
|
8
12
|
declare const AppLoaded = "appLoaded_v3";
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated
|
|
15
|
+
*/
|
|
16
|
+
declare const Metabox_V3 = "metabox_v3";
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated
|
|
19
|
+
*/
|
|
20
|
+
declare const MetaboxHost_V3 = "metaboxHost_v3";
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated
|
|
23
|
+
*/
|
|
24
|
+
declare const AppLoaded_V3 = "appLoaded_v3";
|
|
9
25
|
declare const MetaboxDomain = "metabox.3dsource.com";
|
|
10
26
|
declare const BasicRouteUrl = "metabox-configurator/basic";
|
|
11
27
|
|
|
12
|
-
declare const VERSION = "3.0.
|
|
13
|
-
|
|
14
|
-
type FromMetaboxApiAction = 'bridge' | typeof AppLoaded;
|
|
28
|
+
declare const VERSION = "3.0.16-dev.1";
|
|
15
29
|
|
|
16
30
|
interface IntegrateMetaboxConfig {
|
|
17
31
|
standalone?: boolean;
|
|
@@ -48,7 +62,6 @@ declare const MetaboxBasicConfiguratorActions: {
|
|
|
48
62
|
readonly pauseShowcase: "pauseShowcase";
|
|
49
63
|
readonly stopShowcase: "stopShowcase";
|
|
50
64
|
readonly sendCommandToUnreal: "sendCommandToUnreal";
|
|
51
|
-
readonly watchCallbacks: "watchCallbacks";
|
|
52
65
|
readonly showMeasurement: "showMeasurement";
|
|
53
66
|
readonly hideMeasurement: "hideMeasurement";
|
|
54
67
|
};
|
|
@@ -74,7 +87,6 @@ interface ToMetaboxMessagePayloads {
|
|
|
74
87
|
};
|
|
75
88
|
[MetaboxBasicConfiguratorActions.getPdf]: void;
|
|
76
89
|
[MetaboxBasicConfiguratorActions.getCallToActionInformation]: void;
|
|
77
|
-
[MetaboxBasicConfiguratorActions.watchCallbacks]: void;
|
|
78
90
|
[MetaboxBasicConfiguratorActions.getScreenshot]: {
|
|
79
91
|
format: MimeType;
|
|
80
92
|
size?: {
|
|
@@ -140,9 +152,16 @@ interface ToMetaBoxMessageEnvelope {
|
|
|
140
152
|
action: ToMetaBoxActions;
|
|
141
153
|
payload?: ToMetaboxMessagePayload | never;
|
|
142
154
|
}
|
|
155
|
+
type ToMetaboxTarget = 'metabox' | 'child';
|
|
143
156
|
interface ToMetaBoxMessage {
|
|
144
157
|
host: typeof MetaboxHost;
|
|
158
|
+
envelope: ToMetaBoxMessageEnvelope;
|
|
159
|
+
/**
|
|
160
|
+
* @deprecated, use envelope instead of payload
|
|
161
|
+
*/
|
|
145
162
|
payload: ToMetaBoxMessageEnvelope;
|
|
163
|
+
target: ToMetaboxTarget;
|
|
164
|
+
apiVersion: string;
|
|
146
165
|
}
|
|
147
166
|
|
|
148
167
|
/** Represents an ecom configurator object with all necessary information about cta */
|
|
@@ -409,7 +428,7 @@ interface FromMetaboxMessagePayloads {
|
|
|
409
428
|
*/
|
|
410
429
|
statusMessageChanged: string | null;
|
|
411
430
|
/**
|
|
412
|
-
* Dispatches every time when Unreal is sending ordered render with new GetScreenshot() command.
|
|
431
|
+
* Dispatches every time when Unreal is sending an ordered render with a new GetScreenshot() command.
|
|
413
432
|
*/
|
|
414
433
|
screenshotReady: string | null;
|
|
415
434
|
/**
|
|
@@ -420,6 +439,11 @@ interface FromMetaboxMessagePayloads {
|
|
|
420
439
|
* Dispatches every time when the User sends get camera command.
|
|
421
440
|
*/
|
|
422
441
|
getCameraResult: CameraCommandPayload;
|
|
442
|
+
/**
|
|
443
|
+
* @deprecated
|
|
444
|
+
* Dispatches every time when the configurator connected/disconnected with Unreal Engine.
|
|
445
|
+
*/
|
|
446
|
+
dataChannelConnected: boolean;
|
|
423
447
|
}
|
|
424
448
|
/**
|
|
425
449
|
* @hidden
|
|
@@ -456,13 +480,17 @@ interface MCAppLoaded {
|
|
|
456
480
|
type FromMetaBoxAPIEnvelope = {
|
|
457
481
|
[K in keyof FromMetaboxMessagePayloads]: MetaBoxApiEnvelope<K>;
|
|
458
482
|
}[keyof FromMetaboxMessagePayloads] | MCAppLoaded;
|
|
483
|
+
type FromMetaboxTarget = 'parent' | 'communicator';
|
|
459
484
|
interface FromMetaBoxMessage {
|
|
460
485
|
host: typeof Metabox;
|
|
461
486
|
envelope: FromMetaBoxAPIEnvelope;
|
|
487
|
+
target: FromMetaboxTarget;
|
|
462
488
|
}
|
|
463
489
|
|
|
464
490
|
/**
|
|
465
491
|
* Base class for commands sent to the Metabox API.
|
|
492
|
+
* @internal
|
|
493
|
+
* @hidden
|
|
466
494
|
*/
|
|
467
495
|
declare class CommandBase {
|
|
468
496
|
data: ToMetaBoxMessageEnvelope;
|
|
@@ -513,10 +541,14 @@ declare class EventDispatcher {
|
|
|
513
541
|
}
|
|
514
542
|
|
|
515
543
|
/**
|
|
516
|
-
* Handles messaging between the host page and embedded Metabox content.
|
|
544
|
+
* Handles messaging between the host page and embedded to the Metabox content.
|
|
517
545
|
* @internal Use {@link Communicator.createInstance} or the {@link integrateMetabox} helper to instantiate.
|
|
518
546
|
*/
|
|
519
547
|
declare class Communicator extends EventDispatcher {
|
|
548
|
+
/**
|
|
549
|
+
* Singleton reference to the current communicator instance.
|
|
550
|
+
*/
|
|
551
|
+
static instance: Communicator | null;
|
|
520
552
|
/**
|
|
521
553
|
* Bound handler for incoming postMessage events.
|
|
522
554
|
*/
|
|
@@ -528,9 +560,9 @@ declare class Communicator extends EventDispatcher {
|
|
|
528
560
|
constructor(data: MCAppLoaded['payload'], environment: MetaboxEnvironment, config?: Partial<MetaboxCommandConfig>);
|
|
529
561
|
/**
|
|
530
562
|
* Listens for Metabox to signal readiness, then initializes communicator.
|
|
531
|
-
* @param apiReadyCallback - Called with the new Communicator once
|
|
563
|
+
* @param apiReadyCallback - Called with the new Communicator once the Metabox is loaded.
|
|
532
564
|
* @param {MetaboxEnvironment} environment - The environment in which the Communicator is running.
|
|
533
|
-
* @param {MetaboxCommandConfig} config -
|
|
565
|
+
* @param {MetaboxCommandConfig} config - Optional initial config: standalone - if true, disable metabox custom template and all logic.
|
|
534
566
|
*/
|
|
535
567
|
static createInstance(apiReadyCallback: (api: Communicator) => void, environment: MetaboxEnvironment, config?: Partial<MetaboxCommandConfig>): void;
|
|
536
568
|
/**
|
|
@@ -547,7 +579,7 @@ declare class Communicator extends EventDispatcher {
|
|
|
547
579
|
*/
|
|
548
580
|
sendCommandToMetabox<T extends CommandBase>(command: T): void;
|
|
549
581
|
/**
|
|
550
|
-
* Registers an event listener for messages dispatched by
|
|
582
|
+
* Registers an event listener for messages dispatched by the Metabox.
|
|
551
583
|
* @override
|
|
552
584
|
*/
|
|
553
585
|
addEventListener<T extends FromMetaBoxApiEvents>(messageType: T, callback: (data: FromMetaboxMessagePayloads[T]) => void): this;
|
|
@@ -562,8 +594,7 @@ declare class Communicator extends EventDispatcher {
|
|
|
562
594
|
*/
|
|
563
595
|
removeEventListener<T extends FromMetaBoxApiEvents>(messageType: T, callback: (data: FromMetaboxMessagePayloads[T]) => void): this;
|
|
564
596
|
/**
|
|
565
|
-
* Filters and dispatches incoming messages from
|
|
566
|
-
* @param {FromMetaBoxApiEvents | 'metaboxData' } messageType - Expected message type for filtering ('metaboxData').
|
|
597
|
+
* Filters and dispatches incoming messages from the Metabox.
|
|
567
598
|
* @param {MessageEvent} event - The postMessage event received on a window.
|
|
568
599
|
*/
|
|
569
600
|
private handleMessageReceived;
|
|
@@ -632,6 +663,8 @@ declare function saveImage(imageUrl: string, filename: string): void;
|
|
|
632
663
|
* Sets the URL parameters based on the provided state.
|
|
633
664
|
*
|
|
634
665
|
* @remarks
|
|
666
|
+
* @internal
|
|
667
|
+
* @hidden
|
|
635
668
|
* This function updates the current URL by replacing its search parameters with the key-value pairs from the provided state object.
|
|
636
669
|
*
|
|
637
670
|
* @param {Record<string, string>} state - An object containing key-value pairs to set as URL parameters.
|
|
@@ -641,24 +674,40 @@ declare function setUrlParams(state: Record<string, string>): void;
|
|
|
641
674
|
* Retrieves the URL parameters as an object.
|
|
642
675
|
*
|
|
643
676
|
* @remarks
|
|
677
|
+
* @internal
|
|
678
|
+
* @hidden
|
|
644
679
|
* This function parses the current URL's search parameters and returns them as a key-value object.
|
|
645
680
|
*
|
|
646
681
|
* @returns An object containing the URL parameters.
|
|
647
682
|
*/
|
|
648
683
|
declare function getUrlParams(): Record<string, string>;
|
|
649
684
|
|
|
685
|
+
/**
|
|
686
|
+
*
|
|
687
|
+
* @remarks
|
|
688
|
+
* @internal
|
|
689
|
+
* @hidden
|
|
690
|
+
*
|
|
691
|
+
* @param {string} configuratorId - An string identifier for the configurator.
|
|
692
|
+
* @param {IntegrateMetaboxConfig} config - An object containing the configuration options.
|
|
693
|
+
*/
|
|
650
694
|
declare const prepareIframeSrc: (configuratorId: string, config?: IntegrateMetaboxConfig) => string;
|
|
651
695
|
|
|
652
696
|
/**
|
|
653
697
|
* Wrapper helper function to use it with rxJs the same as `fromEvent` to listen to events from the Communicator.
|
|
698
|
+
*
|
|
654
699
|
* @param {Communicator} target
|
|
655
700
|
* @param eventName
|
|
701
|
+
* @internal
|
|
656
702
|
*/
|
|
657
703
|
declare function fromCommunicatorEvent<T extends FromMetaBoxApiEvents>(target: Communicator, eventName: T): Observable<FromMetaboxMessagePayloads[T]>;
|
|
658
704
|
|
|
659
705
|
/**
|
|
660
706
|
* Represents a command to send Metabox Config to Metabox Basic Configurator.
|
|
661
707
|
* @remarks
|
|
708
|
+
* **Important**: No need to listen to any events to see changes.
|
|
709
|
+
*
|
|
710
|
+
* @internal
|
|
662
711
|
* Automatically sent when the Communicator instance is ready.
|
|
663
712
|
*/
|
|
664
713
|
declare class MetaboxConfig extends CommandBase {
|
|
@@ -674,12 +723,13 @@ declare class MetaboxConfig extends CommandBase {
|
|
|
674
723
|
* Represents a command to get a PDF from Metabox Basic Configurator.
|
|
675
724
|
* @remarks
|
|
676
725
|
* This class sends a message to the Metabox API to generate a PDF based on the current configuration.
|
|
677
|
-
*
|
|
678
|
-
*
|
|
726
|
+
* **Important**: No need to listen to any events to see changes.
|
|
679
727
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
680
728
|
*
|
|
681
729
|
* @example
|
|
682
730
|
* import { GetPdf, Communicator } from '@3dsource/metabox-front-api';
|
|
731
|
+
*
|
|
732
|
+
* @param {Communicator} api - communicator instance api
|
|
683
733
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
684
734
|
* api.sendCommandToMetabox(new GetPdf());
|
|
685
735
|
* };
|
|
@@ -697,13 +747,27 @@ declare class GetPdf extends CommandBase {
|
|
|
697
747
|
/**
|
|
698
748
|
* Represents a command to get a Call To Action Information from Metabox Basic Configurator.
|
|
699
749
|
* @remarks
|
|
700
|
-
* This class sends a message to the Metabox API to generate Call To Action information based on the current configuration and sends it to the endpoint
|
|
701
|
-
*
|
|
750
|
+
* This class sends a message to the Metabox API to generate Call To Action information based on the current configuration and sends it to the endpoint URL from the CTA information.
|
|
751
|
+
*
|
|
752
|
+
* To listen for changes after sending this command, listen to the 'ecomConfiguratorDataUpdated' event.
|
|
753
|
+
* //...Assume that the integration is already implemented (only once)
|
|
754
|
+
* @example
|
|
755
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
756
|
+
*
|
|
757
|
+
* @param {Communicator} api - communicator instance api
|
|
758
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
759
|
+
* @param {EcomConfigurator} data - description for all ecom configurator params
|
|
760
|
+
* api.addEventListener('ecomConfiguratorDataUpdated', (data) => {
|
|
761
|
+
* console.log('Ecom configurator params:', data);
|
|
762
|
+
* });
|
|
763
|
+
* };
|
|
702
764
|
*
|
|
703
765
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
704
766
|
*
|
|
705
767
|
* @example
|
|
706
768
|
* import { GetCallToActionInformation, Communicator } from '@3dsource/metabox-front-api';
|
|
769
|
+
*
|
|
770
|
+
* @param {Communicator} api - communicator instance api
|
|
707
771
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
708
772
|
* api.sendCommandToMetabox(new GetCallToActionInformation());
|
|
709
773
|
* };
|
|
@@ -719,15 +783,28 @@ declare class GetCallToActionInformation extends CommandBase {
|
|
|
719
783
|
}
|
|
720
784
|
|
|
721
785
|
/**
|
|
722
|
-
* Represents a command to
|
|
786
|
+
* Represents a command to get the camera configuration from Unreal.
|
|
723
787
|
* @remarks
|
|
724
788
|
* This class sends a message to the Metabox API to get the camera from a scene.
|
|
725
|
-
*
|
|
789
|
+
*
|
|
790
|
+
* To listen for changes after sending this command, listen to the 'getCameraResult' event.
|
|
791
|
+
* //...Assume that the integration is already implemented (only once)
|
|
792
|
+
* @example
|
|
793
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
794
|
+
*
|
|
795
|
+
* @param {Communicator} api - communicator instance api
|
|
796
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
797
|
+
* @param {CameraCommandPayload} data - camera params
|
|
798
|
+
* api.addEventListener('getCameraResult', (data) => {
|
|
799
|
+
* console.log('Camera params after get camera command:', data);
|
|
800
|
+
* });
|
|
801
|
+
* };
|
|
726
802
|
*
|
|
727
803
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
728
804
|
*
|
|
729
805
|
* @example
|
|
730
806
|
* import { GetCamera, Communicator } from '@3dsource/metabox-front-api';
|
|
807
|
+
* @param {Communicator} api - communicator instance api
|
|
731
808
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
732
809
|
* api.sendCommandToMetabox(new GetCamera());
|
|
733
810
|
* };
|
|
@@ -743,14 +820,15 @@ declare class GetCamera extends CommandBase {
|
|
|
743
820
|
}
|
|
744
821
|
|
|
745
822
|
/**
|
|
746
|
-
* Represents a command to
|
|
823
|
+
* Represents a command to set the camera configuration.
|
|
747
824
|
* @remarks
|
|
748
825
|
* This class sends a message to the Metabox API to set the camera on a scene.
|
|
749
|
-
*
|
|
826
|
+
* **Important**: No need to listen to any events to see changes.
|
|
750
827
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
751
828
|
*
|
|
752
829
|
* @example
|
|
753
|
-
* import {
|
|
830
|
+
* import { SetCamera, Communicator } from '@3dsource/metabox-front-api';
|
|
831
|
+
* @param {Communicator} api - communicator instance api
|
|
754
832
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
755
833
|
* api.sendCommandToMetabox(new SetCamera({
|
|
756
834
|
* fov: 45,
|
|
@@ -774,22 +852,21 @@ declare class SetCamera extends CommandBase {
|
|
|
774
852
|
/**
|
|
775
853
|
* Creates an instance of SetCamera.
|
|
776
854
|
*
|
|
777
|
-
* @
|
|
778
|
-
* @param {CameraCommandPayload} camera - camera config
|
|
855
|
+
* @param {CameraCommandPayload} camera - The camera configuration.
|
|
779
856
|
*/
|
|
780
857
|
constructor(camera: CameraCommandPayload);
|
|
781
858
|
}
|
|
782
859
|
|
|
783
860
|
/**
|
|
784
|
-
* Represents a command to
|
|
861
|
+
* Represents a command to reset the camera to its initial position.
|
|
785
862
|
* @remarks
|
|
786
863
|
* This class sends a message to the Metabox API to reset the camera on a scene.
|
|
787
|
-
*
|
|
788
|
-
*
|
|
864
|
+
* **Important**: No need to listen to any events to see changes.
|
|
789
865
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
790
866
|
*
|
|
791
867
|
* @example
|
|
792
868
|
* import { ResetCamera, Communicator } from '@3dsource/metabox-front-api';
|
|
869
|
+
* @param {Communicator} api - communicator instance api
|
|
793
870
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
794
871
|
* api.sendCommandToMetabox(new ResetCamera());
|
|
795
872
|
* };
|
|
@@ -805,14 +882,16 @@ declare class ResetCamera extends CommandBase {
|
|
|
805
882
|
}
|
|
806
883
|
|
|
807
884
|
/**
|
|
808
|
-
* Represents a command to
|
|
885
|
+
* Represents a command to apply zoom and change the camera zoom on a scene.
|
|
809
886
|
* @remarks
|
|
810
887
|
* This class sends a command to the Metabox API to change zoom on a scene.
|
|
811
|
-
*
|
|
888
|
+
* **Important**: No need to listen to any events to see changes.
|
|
812
889
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
813
890
|
*
|
|
814
891
|
* @example
|
|
815
892
|
* import { ApplyZoom, Communicator } from '@3dsource/metabox-front-api';
|
|
893
|
+
*
|
|
894
|
+
* @param {Communicator} api - communicator instance api
|
|
816
895
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
817
896
|
* api.sendCommandToMetabox(new ApplyZoom(10));
|
|
818
897
|
* api.sendCommandToMetabox(new ApplyZoom(-10));
|
|
@@ -822,23 +901,49 @@ declare class ApplyZoom extends CommandBase {
|
|
|
822
901
|
/**
|
|
823
902
|
* Creates an instance of ApplyZoom.
|
|
824
903
|
*
|
|
825
|
-
* @param {
|
|
904
|
+
* @param {number} zoom - The zoom value to apply.
|
|
826
905
|
*/
|
|
827
906
|
constructor(zoom: number);
|
|
828
907
|
}
|
|
829
908
|
|
|
830
909
|
/**
|
|
831
|
-
* Represents a command to
|
|
910
|
+
* Represents a command to initialize Showcase for a product scene and start a sequence for the product.
|
|
832
911
|
* @remarks
|
|
833
|
-
* This class sends a command to the Metabox API to
|
|
834
|
-
*
|
|
835
|
-
*
|
|
912
|
+
* This class sends a command to the Metabox API to initialize showcase if the product has a sequence.
|
|
913
|
+
* To check this, find the showcase property in the current product and listen to the 'configuratorDataUpdated' event.
|
|
914
|
+
* //...Assume that the integration is already implemented (only once)
|
|
915
|
+
* @example
|
|
916
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
917
|
+
*
|
|
918
|
+
* @param {Communicator} api - communicator instance api
|
|
919
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
920
|
+
* @param {ConfiguratorEnvelope} data - configurator state after updated
|
|
921
|
+
* api.addEventListener('configuratorDataUpdated', (data) => {
|
|
922
|
+
* console.log('State updated after applied new environment:', data);
|
|
923
|
+
* });
|
|
924
|
+
* };
|
|
925
|
+
*
|
|
926
|
+
* If this property exists, you can send the init showcase command.
|
|
927
|
+
*
|
|
928
|
+
* To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event.
|
|
929
|
+
* //...Assume that the integration is already implemented (only once)
|
|
930
|
+
* @example
|
|
931
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
932
|
+
*
|
|
933
|
+
* @param {Communicator} api - communicator instance api
|
|
934
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
935
|
+
* @param {ShowCaseStatus} data - showcase status value
|
|
936
|
+
* api.addEventListener('showcaseStatusChanged', (data) => {
|
|
937
|
+
* console.log('Showcase status value after changed:', data);
|
|
938
|
+
* });
|
|
939
|
+
* };
|
|
836
940
|
*
|
|
837
941
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
838
942
|
*
|
|
839
943
|
* @example
|
|
840
|
-
* ```typescript
|
|
841
944
|
* import { InitShowcase, Communicator } from '@3dsource/metabox-front-api';
|
|
945
|
+
*
|
|
946
|
+
* @param {Communicator} api - communicator instance api
|
|
842
947
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
843
948
|
* api.sendCommandToMetabox(new InitShowcase());
|
|
844
949
|
* };
|
|
@@ -854,14 +959,29 @@ declare class InitShowcase extends CommandBase {
|
|
|
854
959
|
}
|
|
855
960
|
|
|
856
961
|
/**
|
|
857
|
-
* Represents a command to
|
|
962
|
+
* Represents a command to play Showcase for a product when it is already initialized and paused.
|
|
858
963
|
* @remarks
|
|
859
|
-
* This class sends a command to the Metabox API to play showcase for a product if it is already initialized and
|
|
964
|
+
* This class sends a command to the Metabox API to play showcase for a product if it is already initialized and paused.
|
|
965
|
+
*
|
|
966
|
+
* To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event.
|
|
967
|
+
* //...Assume that the integration is already implemented (only once)
|
|
968
|
+
* @example
|
|
969
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
970
|
+
*
|
|
971
|
+
* @param {Communicator} api - communicator instance api
|
|
972
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
973
|
+
* @param {ShowCaseStatus} data - showcase status value
|
|
974
|
+
* api.addEventListener('showcaseStatusChanged', (data) => {
|
|
975
|
+
* console.log('Showcase status value after changed:', data);
|
|
976
|
+
* });
|
|
977
|
+
* };
|
|
860
978
|
*
|
|
861
979
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
862
980
|
*
|
|
863
981
|
* @example
|
|
864
982
|
* import { PlayShowcase, Communicator } from '@3dsource/metabox-front-api';
|
|
983
|
+
*
|
|
984
|
+
* @param {Communicator} api - communicator instance api
|
|
865
985
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
866
986
|
* api.sendCommandToMetabox(new PlayShowcase());
|
|
867
987
|
* };
|
|
@@ -886,14 +1006,29 @@ declare class UnrealCommand extends CommandBase {
|
|
|
886
1006
|
}
|
|
887
1007
|
|
|
888
1008
|
/**
|
|
889
|
-
* Represents a command to
|
|
1009
|
+
* Represents a command to pause Showcase for a product when it is already initialized and playing.
|
|
890
1010
|
* @remarks
|
|
891
|
-
* This class sends a command to the Metabox API to pause showcase for a product if it is already initialized and
|
|
1011
|
+
* This class sends a command to the Metabox API to pause showcase for a product if it is already initialized and playing.
|
|
1012
|
+
*
|
|
1013
|
+
* To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event.
|
|
1014
|
+
* //...Assume that the integration is already implemented (only once)
|
|
1015
|
+
* @example
|
|
1016
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
1017
|
+
*
|
|
1018
|
+
* @param {Communicator} api - communicator instance api
|
|
1019
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1020
|
+
* @param {ShowCaseStatus} data - showcase status value
|
|
1021
|
+
* api.addEventListener('showcaseStatusChanged', (data) => {
|
|
1022
|
+
* console.log('Showcase status value after changed:', data);
|
|
1023
|
+
* });
|
|
1024
|
+
* };
|
|
892
1025
|
*
|
|
893
1026
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
894
1027
|
*
|
|
895
1028
|
* @example
|
|
896
1029
|
* import { PauseShowcase, Communicator } from '@3dsource/metabox-front-api';
|
|
1030
|
+
*
|
|
1031
|
+
* @param {Communicator} api - communicator instance api
|
|
897
1032
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
898
1033
|
* api.sendCommandToMetabox(new PauseShowcase());
|
|
899
1034
|
* };
|
|
@@ -909,14 +1044,29 @@ declare class PauseShowcase extends CommandBase {
|
|
|
909
1044
|
}
|
|
910
1045
|
|
|
911
1046
|
/**
|
|
912
|
-
* Represents a command to
|
|
1047
|
+
* Represents a command to stop Showcase for a product when it is already initialized, and you want to destroy it.
|
|
913
1048
|
* @remarks
|
|
914
|
-
* This class sends a command to the Metabox API to
|
|
1049
|
+
* This class sends a command to the Metabox API to stop showcase for a product if it is already initialized.
|
|
1050
|
+
*
|
|
1051
|
+
* To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event.
|
|
1052
|
+
* //...Assume that the integration is already implemented (only once)
|
|
1053
|
+
* @example
|
|
1054
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
1055
|
+
*
|
|
1056
|
+
* @param {Communicator} api - communicator instance api
|
|
1057
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1058
|
+
* @param {ShowCaseStatus} data - showcase status value
|
|
1059
|
+
* api.addEventListener('showcaseStatusChanged', (data) => {
|
|
1060
|
+
* console.log('Showcase status value after changed:', data);
|
|
1061
|
+
* });
|
|
1062
|
+
* };
|
|
915
1063
|
*
|
|
916
1064
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
917
1065
|
*
|
|
918
1066
|
* @example
|
|
919
1067
|
* import { StopShowcase, Communicator } from '@3dsource/metabox-front-api';
|
|
1068
|
+
*
|
|
1069
|
+
* @param {Communicator} api - communicator instance api
|
|
920
1070
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
921
1071
|
* api.sendCommandToMetabox(new StopShowcase());
|
|
922
1072
|
* };
|
|
@@ -939,17 +1089,28 @@ declare class StopShowcase extends CommandBase {
|
|
|
939
1089
|
type MimeType = 'image/png' | 'image/jpeg' | 'image/webp';
|
|
940
1090
|
/**
|
|
941
1091
|
* Represents a command to get a screenshot.
|
|
942
|
-
*
|
|
943
1092
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
944
1093
|
*
|
|
1094
|
+
* @remarks
|
|
1095
|
+
* To listen for changes after sending this command, listen to the 'screenshot' event.
|
|
1096
|
+
* //...Assume that the integration is already implemented (only once)
|
|
1097
|
+
* @example
|
|
1098
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
1099
|
+
*
|
|
1100
|
+
* @param {Communicator} api - communicator instance api
|
|
1101
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1102
|
+
* @param {string} data - base64 string image
|
|
1103
|
+
* api.addEventListener('screenshot', (data) => {
|
|
1104
|
+
* console.log('Get screenshot here:', data);
|
|
1105
|
+
* saveImage(data, 'Render.png');
|
|
1106
|
+
* });
|
|
1107
|
+
* };
|
|
1108
|
+
*
|
|
945
1109
|
* @example
|
|
946
1110
|
* import { GetScreenshot, Communicator, saveImage } from '@3dsource/metabox-front-api';
|
|
1111
|
+
*
|
|
1112
|
+
* @param {Communicator} api - communicator instance api
|
|
947
1113
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
948
|
-
* // Listen for events from to the Metabox API
|
|
949
|
-
* api.addEventListener('screenshot', (data) => {
|
|
950
|
-
* // Process the get screenshot response
|
|
951
|
-
* saveImage(data, 'Render.png');
|
|
952
|
-
* });
|
|
953
1114
|
* api.sendCommandToMetabox(new GetScreenshot('image/png', { x: 1024, y: 1024 }));
|
|
954
1115
|
* };
|
|
955
1116
|
*/
|
|
@@ -971,10 +1132,23 @@ declare class GetScreenshot extends CommandBase {
|
|
|
971
1132
|
* @remarks
|
|
972
1133
|
* This action sends a message to the Metabox API to set a product using the provided product ID.
|
|
973
1134
|
*
|
|
1135
|
+
* To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.
|
|
1136
|
+
* //...Assume that the integration is already implemented (only once)
|
|
1137
|
+
* @example
|
|
1138
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
1139
|
+
*
|
|
1140
|
+
* @param {Communicator} api - communicator instance api
|
|
1141
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1142
|
+
* @param {ConfiguratorEnvelope} data - configurator state after updated
|
|
1143
|
+
* api.addEventListener('configuratorDataUpdated', (data) => {
|
|
1144
|
+
* console.log('State updated after applied new product:', data);
|
|
1145
|
+
* });
|
|
1146
|
+
* };
|
|
1147
|
+
*
|
|
974
1148
|
* @example
|
|
975
1149
|
* import { SetProduct, Communicator } from '@3dsource/metabox-front-api';
|
|
976
1150
|
*
|
|
977
|
-
*
|
|
1151
|
+
* @param {Communicator} api - communicator instance api
|
|
978
1152
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
979
1153
|
* api.setCommandToMetaBox(new SetProduct(
|
|
980
1154
|
* 'ffea6b5c-3a8a-4f56-9417-e605acb5cca3'
|
|
@@ -993,10 +1167,25 @@ declare class SetProduct extends CommandBase {
|
|
|
993
1167
|
/**
|
|
994
1168
|
* Represents a command to set a material by its slot ID and Material ID.
|
|
995
1169
|
*
|
|
1170
|
+
* @remarks
|
|
1171
|
+
* To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.
|
|
1172
|
+
* //...Assume that the integration is already implemented (only once)
|
|
1173
|
+
*
|
|
1174
|
+
* @example
|
|
1175
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
1176
|
+
*
|
|
1177
|
+
* @param {Communicator} api - communicator instance api
|
|
1178
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1179
|
+
* @param {ConfiguratorEnvelope} data - configurator state after updated
|
|
1180
|
+
* api.addEventListener('configuratorDataUpdated', (data) => {
|
|
1181
|
+
* console.log('State updated after applied new material:', data);
|
|
1182
|
+
* });
|
|
1183
|
+
* };
|
|
1184
|
+
*
|
|
996
1185
|
* @example
|
|
997
1186
|
* import { SetProductMaterial, Communicator } from '@3dsource/metabox-front-api';
|
|
998
1187
|
*
|
|
999
|
-
*
|
|
1188
|
+
* @param {Communicator} api - communicator instance api
|
|
1000
1189
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1001
1190
|
* api.sendCommandToMetabox(new SetProductMaterial(
|
|
1002
1191
|
* 'carpaint',
|
|
@@ -1017,12 +1206,25 @@ declare class SetProductMaterial extends CommandBase {
|
|
|
1017
1206
|
/**
|
|
1018
1207
|
* Represents a command to set the environment by its ID.
|
|
1019
1208
|
*
|
|
1209
|
+
* @remarks
|
|
1210
|
+
* To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.
|
|
1211
|
+
* //...Assume that the integration is already implemented (only once)
|
|
1212
|
+
* @example
|
|
1213
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
1214
|
+
*
|
|
1215
|
+
* @param {Communicator} api - communicator instance api
|
|
1216
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1217
|
+
* @param {ConfiguratorEnvelope} data - configurator state after updated
|
|
1218
|
+
* api.addEventListener('configuratorDataUpdated', (data) => {
|
|
1219
|
+
* console.log('State updated after applied new environment:', data);
|
|
1220
|
+
* });
|
|
1221
|
+
* };
|
|
1222
|
+
*
|
|
1020
1223
|
* @example
|
|
1021
1224
|
* import { SetEnvironment, Communicator } from '@3dsource/metabox-front-api';
|
|
1022
1225
|
*
|
|
1023
|
-
*
|
|
1226
|
+
* @param {Communicator} api - communicator instance api
|
|
1024
1227
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1025
|
-
* // Change the environment to '55555555-1234-1234-1234-01234567890'
|
|
1026
1228
|
* api.sendCommandToMetabox(new SetEnvironment('55555555-1234-1234-1234-01234567890'));
|
|
1027
1229
|
* };
|
|
1028
1230
|
*/
|
|
@@ -1038,10 +1240,24 @@ declare class SetEnvironment extends CommandBase {
|
|
|
1038
1240
|
/**
|
|
1039
1241
|
* Represents a command to set an environment material by its slot ID and Material ID.
|
|
1040
1242
|
*
|
|
1243
|
+
* @remarks
|
|
1244
|
+
* To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.
|
|
1245
|
+
* //...Assume that the integration is already implemented (only once)
|
|
1246
|
+
* @example
|
|
1247
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
1248
|
+
*
|
|
1249
|
+
* @param {Communicator} api - communicator instance api
|
|
1250
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1251
|
+
* @param {ConfiguratorEnvelope} data - configurator state after updated
|
|
1252
|
+
* api.addEventListener('configuratorDataUpdated', (data) => {
|
|
1253
|
+
* console.log('State updated after applied new environment material:', data);
|
|
1254
|
+
* });
|
|
1255
|
+
* };
|
|
1256
|
+
*
|
|
1041
1257
|
* @example
|
|
1042
1258
|
* import { SetEnvironmentMaterial, Communicator } from '@3dsource/metabox-front-api';
|
|
1043
1259
|
*
|
|
1044
|
-
*
|
|
1260
|
+
* @param {Communicator} api - communicator instance api
|
|
1045
1261
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1046
1262
|
* api.sendCommandToMetabox(new SetEnvironmentMaterial(
|
|
1047
1263
|
* 'carpaint',
|
|
@@ -1060,14 +1276,17 @@ declare class SetEnvironmentMaterial extends CommandBase {
|
|
|
1060
1276
|
}
|
|
1061
1277
|
|
|
1062
1278
|
/**
|
|
1063
|
-
* Represents a command to toggle the
|
|
1279
|
+
* Represents a command to toggle the embedded Metabox menu.
|
|
1280
|
+
* @remarks
|
|
1281
|
+
* This command can only be used when using the metabox menu.
|
|
1282
|
+
* **Important**: No need to listen to any events to see changes.
|
|
1064
1283
|
*
|
|
1065
1284
|
* @example
|
|
1066
1285
|
* import { ShowEmbeddedMenu, Communicator } from '@3dsource/metabox-front-api';
|
|
1067
1286
|
*
|
|
1068
|
-
*
|
|
1287
|
+
* @param {Communicator} api - communicator instance api
|
|
1069
1288
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1070
|
-
* api.
|
|
1289
|
+
* api.sendCommandToMetabox(new ShowEmbeddedMenu(true));
|
|
1071
1290
|
* };
|
|
1072
1291
|
*/
|
|
1073
1292
|
declare class ShowEmbeddedMenu extends CommandBase {
|
|
@@ -1084,11 +1303,12 @@ declare class ShowEmbeddedMenu extends CommandBase {
|
|
|
1084
1303
|
*
|
|
1085
1304
|
* @remarks
|
|
1086
1305
|
* This action sends a message to the Metabox API to toggle the visibility of the Unreal overlay UI.
|
|
1306
|
+
* **Important**: No need to listen to any events to see changes.
|
|
1087
1307
|
*
|
|
1088
1308
|
* @example
|
|
1089
1309
|
* import { ShowOverlayInterface, Communicator } from '@3dsource/metabox-front-api';
|
|
1090
1310
|
*
|
|
1091
|
-
*
|
|
1311
|
+
* @param {Communicator} api - communicator instance api
|
|
1092
1312
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1093
1313
|
* api.setCommandToMetaBox(new ShowOverlayInterface(true));
|
|
1094
1314
|
* };
|
|
@@ -1103,39 +1323,23 @@ declare class ShowOverlayInterface extends CommandBase {
|
|
|
1103
1323
|
}
|
|
1104
1324
|
|
|
1105
1325
|
/**
|
|
1106
|
-
*
|
|
1107
|
-
* @internal
|
|
1108
|
-
* @hidden
|
|
1326
|
+
* Represents a command to show measurement for a product when it is already loaded.
|
|
1109
1327
|
* @remarks
|
|
1110
|
-
*
|
|
1111
|
-
*
|
|
1112
|
-
*/
|
|
1113
|
-
declare class WatchCallbacks extends CommandBase {
|
|
1114
|
-
/**
|
|
1115
|
-
* Creates an instance of WatchCallbacks.
|
|
1116
|
-
*
|
|
1117
|
-
* @remarks
|
|
1118
|
-
* This constructor does not require any parameters.
|
|
1119
|
-
*/
|
|
1120
|
-
constructor();
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
/**
|
|
1124
|
-
* Represents a command to Show Measurement for a product when it already loaded.
|
|
1125
|
-
* @remarks
|
|
1126
|
-
* This class sends a command to the Metabox API to Show Measurement for a product if it is already initialized.
|
|
1127
|
-
*
|
|
1328
|
+
* This class sends a command to the Metabox API to show measurement for a product if it is already initialized.
|
|
1329
|
+
* **Important**: No need to listen to any events to see changes.
|
|
1128
1330
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
1129
1331
|
*
|
|
1130
1332
|
* @example
|
|
1131
1333
|
* import { ShowMeasurement, Communicator } from '@3dsource/metabox-front-api';
|
|
1334
|
+
*
|
|
1335
|
+
* @param {Communicator} api - communicator instance api
|
|
1132
1336
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1133
1337
|
* api.sendCommandToMetabox(new ShowMeasurement());
|
|
1134
1338
|
* };
|
|
1135
1339
|
*/
|
|
1136
1340
|
declare class ShowMeasurement extends CommandBase {
|
|
1137
1341
|
/**
|
|
1138
|
-
* Creates an instance of
|
|
1342
|
+
* Creates an instance of ShowMeasurement.
|
|
1139
1343
|
*
|
|
1140
1344
|
* @remarks
|
|
1141
1345
|
* This constructor does not require any parameters.
|
|
@@ -1144,14 +1348,16 @@ declare class ShowMeasurement extends CommandBase {
|
|
|
1144
1348
|
}
|
|
1145
1349
|
|
|
1146
1350
|
/**
|
|
1147
|
-
* Represents a command to
|
|
1351
|
+
* Represents a command to hide measurement for a product when it is already loaded.
|
|
1148
1352
|
* @remarks
|
|
1149
|
-
* This class sends a command to the Metabox API to
|
|
1150
|
-
*
|
|
1353
|
+
* This class sends a command to the Metabox API to hide measurement for a product if it is already initialized.
|
|
1354
|
+
* **Important**: No need to listen to any events to see changes.
|
|
1151
1355
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
1152
1356
|
*
|
|
1153
1357
|
* @example
|
|
1154
1358
|
* import { HideMeasurement, Communicator } from '@3dsource/metabox-front-api';
|
|
1359
|
+
*
|
|
1360
|
+
* @param {Communicator} api - communicator instance api
|
|
1155
1361
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1156
1362
|
* api.sendCommandToMetabox(new HideMeasurement());
|
|
1157
1363
|
* };
|
|
@@ -1170,12 +1376,14 @@ declare class HideMeasurement extends CommandBase {
|
|
|
1170
1376
|
* Represents a command to force set the device type.
|
|
1171
1377
|
*
|
|
1172
1378
|
* @remarks
|
|
1173
|
-
* This class sends a message to the Metabox API to force
|
|
1379
|
+
* This class sends a message to the Metabox API to force set the device type.
|
|
1380
|
+
* **Important**: No need to listen to any events to see changes.
|
|
1381
|
+
* //...Assume that the integration is already implemented (only once)
|
|
1174
1382
|
*
|
|
1175
1383
|
* @example
|
|
1176
1384
|
* import { ForceSetDeviceType, Communicator } from '@3dsource/metabox-front-api';
|
|
1177
1385
|
*
|
|
1178
|
-
*
|
|
1386
|
+
* @param {Communicator} api - communicator instance api
|
|
1179
1387
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1180
1388
|
* api.sendCommandToMetabox(new ForceSetDeviceType('desktop'));
|
|
1181
1389
|
* };
|
|
@@ -1189,5 +1397,5 @@ declare class ForceSetDeviceType extends CommandBase {
|
|
|
1189
1397
|
constructor(deviceType: ApplicationDeviceTypes);
|
|
1190
1398
|
}
|
|
1191
1399
|
|
|
1192
|
-
export { AppLoaded, ApplyZoom, BasicRouteUrl, CommandBase, Communicator, EventDispatcher, ForceSetDeviceType, GetCallToActionInformation, GetCamera, GetPdf, GetScreenshot, HideMeasurement, InitShowcase, Metabox, MetaboxBasicConfiguratorActions, MetaboxConfig,
|
|
1193
|
-
export type { ApplicationDeviceTypes, CameraCommandPayload, ConfiguratorEnvelope, Cta, EcomConfigurator, Environment, FromMetaBoxAPIEnvelope, FromMetaBoxApiEvents, FromMetaBoxMessage,
|
|
1400
|
+
export { AppLoaded, AppLoaded_V3, ApplyZoom, BasicRouteUrl, CommandBase, Communicator, EventDispatcher, ForceSetDeviceType, GetCallToActionInformation, GetCamera, GetPdf, GetScreenshot, HideMeasurement, InitShowcase, Metabox, MetaboxBasicConfiguratorActions, MetaboxConfig, MetaboxDomain, MetaboxHost, MetaboxHost_V3, Metabox_V3, PauseShowcase, PlayShowcase, ResetCamera, SetCamera, SetEnvironment, SetEnvironmentMaterial, SetProduct, SetProductMaterial, ShowEmbeddedMenu, ShowMeasurement, ShowOverlayInterface, StopShowcase, UnrealCommand, VERSION, fromCommunicatorEvent, getUrlParams, integrateMetabox, prepareIframeSrc, saveImage, setUrlParams };
|
|
1401
|
+
export type { ApplicationDeviceTypes, CameraCommandPayload, ConfiguratorEnvelope, Cta, EcomConfigurator, Environment, FromMetaBoxAPIEnvelope, FromMetaBoxApiEvents, FromMetaBoxMessage, FromMetaboxMessagePayloads, FromMetaboxTarget, IntegrateMetaboxConfig, Listener, MCAppLoaded, Material, MetaBoxApiEnvelope, MetaProperty, MetaboxCommandConfig, MetaboxEnvironment, MimeType, Product, SelectedIds, ShowCaseStatus, Showcase, Slot, Thumbnail, Timecode, ToMetaBoxActions, ToMetaBoxMessage, ToMetaBoxMessageEnvelope, ToMetaboxMessagePayload, ToMetaboxMessagePayloads, ToMetaboxTarget, UniversalConfigurator, UniversalConfiguratorEnvironment, UniversalConfiguratorProduct, VideoResolution };
|