@3dsource/metabox-front-api 3.0.13 → 3.0.15
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,6 +2,11 @@ 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
12
|
declare const MetaboxData = "metaboxData_v3";
|
|
@@ -9,8 +14,13 @@ declare const AppLoaded = "appLoaded_v3";
|
|
|
9
14
|
declare const MetaboxDomain = "metabox.3dsource.com";
|
|
10
15
|
declare const BasicRouteUrl = "metabox-configurator/basic";
|
|
11
16
|
|
|
12
|
-
declare const VERSION = "3.0.
|
|
17
|
+
declare const VERSION = "3.0.15";
|
|
13
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
* @hidden
|
|
22
|
+
* Represents FromMetaboxApiAction.
|
|
23
|
+
*/
|
|
14
24
|
type FromMetaboxApiAction = 'bridge' | typeof AppLoaded;
|
|
15
25
|
|
|
16
26
|
interface IntegrateMetaboxConfig {
|
|
@@ -142,6 +152,10 @@ interface ToMetaBoxMessageEnvelope {
|
|
|
142
152
|
}
|
|
143
153
|
interface ToMetaBoxMessage {
|
|
144
154
|
host: typeof MetaboxHost;
|
|
155
|
+
envelope: ToMetaBoxMessageEnvelope;
|
|
156
|
+
/**
|
|
157
|
+
* @deprecated, use envelop instead of payload
|
|
158
|
+
*/
|
|
145
159
|
payload: ToMetaBoxMessageEnvelope;
|
|
146
160
|
}
|
|
147
161
|
|
|
@@ -409,7 +423,7 @@ interface FromMetaboxMessagePayloads {
|
|
|
409
423
|
*/
|
|
410
424
|
statusMessageChanged: string | null;
|
|
411
425
|
/**
|
|
412
|
-
* Dispatches every time when Unreal is sending ordered render with new GetScreenshot() command.
|
|
426
|
+
* Dispatches every time when Unreal is sending an ordered render with a new GetScreenshot() command.
|
|
413
427
|
*/
|
|
414
428
|
screenshotReady: string | null;
|
|
415
429
|
/**
|
|
@@ -420,6 +434,11 @@ interface FromMetaboxMessagePayloads {
|
|
|
420
434
|
* Dispatches every time when the User sends get camera command.
|
|
421
435
|
*/
|
|
422
436
|
getCameraResult: CameraCommandPayload;
|
|
437
|
+
/**
|
|
438
|
+
* @deprecated
|
|
439
|
+
* Dispatches every time when the configurator connected/disconnected with Unreal Engine.
|
|
440
|
+
*/
|
|
441
|
+
dataChannelConnected: boolean;
|
|
423
442
|
}
|
|
424
443
|
/**
|
|
425
444
|
* @hidden
|
|
@@ -463,6 +482,8 @@ interface FromMetaBoxMessage {
|
|
|
463
482
|
|
|
464
483
|
/**
|
|
465
484
|
* Base class for commands sent to the Metabox API.
|
|
485
|
+
* @internal
|
|
486
|
+
* @hidden
|
|
466
487
|
*/
|
|
467
488
|
declare class CommandBase {
|
|
468
489
|
data: ToMetaBoxMessageEnvelope;
|
|
@@ -528,9 +549,9 @@ declare class Communicator extends EventDispatcher {
|
|
|
528
549
|
constructor(data: MCAppLoaded['payload'], environment: MetaboxEnvironment, config?: Partial<MetaboxCommandConfig>);
|
|
529
550
|
/**
|
|
530
551
|
* Listens for Metabox to signal readiness, then initializes communicator.
|
|
531
|
-
* @param apiReadyCallback - Called with the new Communicator once
|
|
552
|
+
* @param apiReadyCallback - Called with the new Communicator once the Metabox is loaded.
|
|
532
553
|
* @param {MetaboxEnvironment} environment - The environment in which the Communicator is running.
|
|
533
|
-
* @param {MetaboxCommandConfig} config -
|
|
554
|
+
* @param {MetaboxCommandConfig} config - Optional initial config: standalone - if true, disable metabox custom template and all logic.
|
|
534
555
|
*/
|
|
535
556
|
static createInstance(apiReadyCallback: (api: Communicator) => void, environment: MetaboxEnvironment, config?: Partial<MetaboxCommandConfig>): void;
|
|
536
557
|
/**
|
|
@@ -547,7 +568,7 @@ declare class Communicator extends EventDispatcher {
|
|
|
547
568
|
*/
|
|
548
569
|
sendCommandToMetabox<T extends CommandBase>(command: T): void;
|
|
549
570
|
/**
|
|
550
|
-
* Registers an event listener for messages dispatched by
|
|
571
|
+
* Registers an event listener for messages dispatched by the Metabox.
|
|
551
572
|
* @override
|
|
552
573
|
*/
|
|
553
574
|
addEventListener<T extends FromMetaBoxApiEvents>(messageType: T, callback: (data: FromMetaboxMessagePayloads[T]) => void): this;
|
|
@@ -562,7 +583,7 @@ declare class Communicator extends EventDispatcher {
|
|
|
562
583
|
*/
|
|
563
584
|
removeEventListener<T extends FromMetaBoxApiEvents>(messageType: T, callback: (data: FromMetaboxMessagePayloads[T]) => void): this;
|
|
564
585
|
/**
|
|
565
|
-
* Filters and dispatches incoming messages from
|
|
586
|
+
* Filters and dispatches incoming messages from the Metabox.
|
|
566
587
|
* @param {FromMetaBoxApiEvents | 'metaboxData' } messageType - Expected message type for filtering ('metaboxData').
|
|
567
588
|
* @param {MessageEvent} event - The postMessage event received on a window.
|
|
568
589
|
*/
|
|
@@ -632,6 +653,8 @@ declare function saveImage(imageUrl: string, filename: string): void;
|
|
|
632
653
|
* Sets the URL parameters based on the provided state.
|
|
633
654
|
*
|
|
634
655
|
* @remarks
|
|
656
|
+
* @internal
|
|
657
|
+
* @hidden
|
|
635
658
|
* This function updates the current URL by replacing its search parameters with the key-value pairs from the provided state object.
|
|
636
659
|
*
|
|
637
660
|
* @param {Record<string, string>} state - An object containing key-value pairs to set as URL parameters.
|
|
@@ -641,24 +664,40 @@ declare function setUrlParams(state: Record<string, string>): void;
|
|
|
641
664
|
* Retrieves the URL parameters as an object.
|
|
642
665
|
*
|
|
643
666
|
* @remarks
|
|
667
|
+
* @internal
|
|
668
|
+
* @hidden
|
|
644
669
|
* This function parses the current URL's search parameters and returns them as a key-value object.
|
|
645
670
|
*
|
|
646
671
|
* @returns An object containing the URL parameters.
|
|
647
672
|
*/
|
|
648
673
|
declare function getUrlParams(): Record<string, string>;
|
|
649
674
|
|
|
675
|
+
/**
|
|
676
|
+
*
|
|
677
|
+
* @remarks
|
|
678
|
+
* @internal
|
|
679
|
+
* @hidden
|
|
680
|
+
*
|
|
681
|
+
* @param {string} configuratorId - An string identifier for the configurator.
|
|
682
|
+
* @param {IntegrateMetaboxConfig} config - An object containing the configuration options.
|
|
683
|
+
*/
|
|
650
684
|
declare const prepareIframeSrc: (configuratorId: string, config?: IntegrateMetaboxConfig) => string;
|
|
651
685
|
|
|
652
686
|
/**
|
|
653
687
|
* Wrapper helper function to use it with rxJs the same as `fromEvent` to listen to events from the Communicator.
|
|
688
|
+
*
|
|
654
689
|
* @param {Communicator} target
|
|
655
690
|
* @param eventName
|
|
691
|
+
* @internal
|
|
656
692
|
*/
|
|
657
693
|
declare function fromCommunicatorEvent<T extends FromMetaBoxApiEvents>(target: Communicator, eventName: T): Observable<FromMetaboxMessagePayloads[T]>;
|
|
658
694
|
|
|
659
695
|
/**
|
|
660
696
|
* Represents a command to send Metabox Config to Metabox Basic Configurator.
|
|
661
697
|
* @remarks
|
|
698
|
+
* **Important**: No need to listen to any events to see changes.
|
|
699
|
+
*
|
|
700
|
+
* @internal
|
|
662
701
|
* Automatically sent when the Communicator instance is ready.
|
|
663
702
|
*/
|
|
664
703
|
declare class MetaboxConfig extends CommandBase {
|
|
@@ -674,12 +713,13 @@ declare class MetaboxConfig extends CommandBase {
|
|
|
674
713
|
* Represents a command to get a PDF from Metabox Basic Configurator.
|
|
675
714
|
* @remarks
|
|
676
715
|
* This class sends a message to the Metabox API to generate a PDF based on the current configuration.
|
|
677
|
-
*
|
|
678
|
-
*
|
|
716
|
+
* **Important**: No need to listen to any events to see changes.
|
|
679
717
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
680
718
|
*
|
|
681
719
|
* @example
|
|
682
720
|
* import { GetPdf, Communicator } from '@3dsource/metabox-front-api';
|
|
721
|
+
*
|
|
722
|
+
* @param {Communicator} api - communicator instance api
|
|
683
723
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
684
724
|
* api.sendCommandToMetabox(new GetPdf());
|
|
685
725
|
* };
|
|
@@ -697,13 +737,27 @@ declare class GetPdf extends CommandBase {
|
|
|
697
737
|
/**
|
|
698
738
|
* Represents a command to get a Call To Action Information from Metabox Basic Configurator.
|
|
699
739
|
* @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
|
-
*
|
|
740
|
+
* 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.
|
|
741
|
+
*
|
|
742
|
+
* To listen for changes after sending this command, listen to the 'ecomConfiguratorDataUpdated' event.
|
|
743
|
+
* //...Assume that the integration is already implemented (only once)
|
|
744
|
+
* @example
|
|
745
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
746
|
+
*
|
|
747
|
+
* @param {Communicator} api - communicator instance api
|
|
748
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
749
|
+
* @param {EcomConfigurator} data - description for all ecom configurator params
|
|
750
|
+
* api.addEventListener('ecomConfiguratorDataUpdated', (data) => {
|
|
751
|
+
* console.log('Ecom configurator params:', data);
|
|
752
|
+
* });
|
|
753
|
+
* };
|
|
702
754
|
*
|
|
703
755
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
704
756
|
*
|
|
705
757
|
* @example
|
|
706
758
|
* import { GetCallToActionInformation, Communicator } from '@3dsource/metabox-front-api';
|
|
759
|
+
*
|
|
760
|
+
* @param {Communicator} api - communicator instance api
|
|
707
761
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
708
762
|
* api.sendCommandToMetabox(new GetCallToActionInformation());
|
|
709
763
|
* };
|
|
@@ -719,15 +773,28 @@ declare class GetCallToActionInformation extends CommandBase {
|
|
|
719
773
|
}
|
|
720
774
|
|
|
721
775
|
/**
|
|
722
|
-
* Represents a command to
|
|
776
|
+
* Represents a command to get the camera configuration from Unreal.
|
|
723
777
|
* @remarks
|
|
724
778
|
* This class sends a message to the Metabox API to get the camera from a scene.
|
|
725
|
-
*
|
|
779
|
+
*
|
|
780
|
+
* To listen for changes after sending this command, listen to the 'getCameraResult' event.
|
|
781
|
+
* //...Assume that the integration is already implemented (only once)
|
|
782
|
+
* @example
|
|
783
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
784
|
+
*
|
|
785
|
+
* @param {Communicator} api - communicator instance api
|
|
786
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
787
|
+
* @param {CameraCommandPayload} data - camera params
|
|
788
|
+
* api.addEventListener('getCameraResult', (data) => {
|
|
789
|
+
* console.log('Camera params after get camera command:', data);
|
|
790
|
+
* });
|
|
791
|
+
* };
|
|
726
792
|
*
|
|
727
793
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
728
794
|
*
|
|
729
795
|
* @example
|
|
730
796
|
* import { GetCamera, Communicator } from '@3dsource/metabox-front-api';
|
|
797
|
+
* @param {Communicator} api - communicator instance api
|
|
731
798
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
732
799
|
* api.sendCommandToMetabox(new GetCamera());
|
|
733
800
|
* };
|
|
@@ -743,14 +810,15 @@ declare class GetCamera extends CommandBase {
|
|
|
743
810
|
}
|
|
744
811
|
|
|
745
812
|
/**
|
|
746
|
-
* Represents a command to
|
|
813
|
+
* Represents a command to set the camera configuration.
|
|
747
814
|
* @remarks
|
|
748
815
|
* This class sends a message to the Metabox API to set the camera on a scene.
|
|
749
|
-
*
|
|
816
|
+
* **Important**: No need to listen to any events to see changes.
|
|
750
817
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
751
818
|
*
|
|
752
819
|
* @example
|
|
753
|
-
* import {
|
|
820
|
+
* import { SetCamera, Communicator } from '@3dsource/metabox-front-api';
|
|
821
|
+
* @param {Communicator} api - communicator instance api
|
|
754
822
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
755
823
|
* api.sendCommandToMetabox(new SetCamera({
|
|
756
824
|
* fov: 45,
|
|
@@ -774,22 +842,21 @@ declare class SetCamera extends CommandBase {
|
|
|
774
842
|
/**
|
|
775
843
|
* Creates an instance of SetCamera.
|
|
776
844
|
*
|
|
777
|
-
* @
|
|
778
|
-
* @param {CameraCommandPayload} camera - camera config
|
|
845
|
+
* @param {CameraCommandPayload} camera - The camera configuration.
|
|
779
846
|
*/
|
|
780
847
|
constructor(camera: CameraCommandPayload);
|
|
781
848
|
}
|
|
782
849
|
|
|
783
850
|
/**
|
|
784
|
-
* Represents a command to
|
|
851
|
+
* Represents a command to reset the camera to its initial position.
|
|
785
852
|
* @remarks
|
|
786
853
|
* This class sends a message to the Metabox API to reset the camera on a scene.
|
|
787
|
-
*
|
|
788
|
-
*
|
|
854
|
+
* **Important**: No need to listen to any events to see changes.
|
|
789
855
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
790
856
|
*
|
|
791
857
|
* @example
|
|
792
858
|
* import { ResetCamera, Communicator } from '@3dsource/metabox-front-api';
|
|
859
|
+
* @param {Communicator} api - communicator instance api
|
|
793
860
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
794
861
|
* api.sendCommandToMetabox(new ResetCamera());
|
|
795
862
|
* };
|
|
@@ -805,14 +872,16 @@ declare class ResetCamera extends CommandBase {
|
|
|
805
872
|
}
|
|
806
873
|
|
|
807
874
|
/**
|
|
808
|
-
* Represents a command to
|
|
875
|
+
* Represents a command to apply zoom and change the camera zoom on a scene.
|
|
809
876
|
* @remarks
|
|
810
877
|
* This class sends a command to the Metabox API to change zoom on a scene.
|
|
811
|
-
*
|
|
878
|
+
* **Important**: No need to listen to any events to see changes.
|
|
812
879
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
813
880
|
*
|
|
814
881
|
* @example
|
|
815
882
|
* import { ApplyZoom, Communicator } from '@3dsource/metabox-front-api';
|
|
883
|
+
*
|
|
884
|
+
* @param {Communicator} api - communicator instance api
|
|
816
885
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
817
886
|
* api.sendCommandToMetabox(new ApplyZoom(10));
|
|
818
887
|
* api.sendCommandToMetabox(new ApplyZoom(-10));
|
|
@@ -822,23 +891,49 @@ declare class ApplyZoom extends CommandBase {
|
|
|
822
891
|
/**
|
|
823
892
|
* Creates an instance of ApplyZoom.
|
|
824
893
|
*
|
|
825
|
-
* @param {
|
|
894
|
+
* @param {number} zoom - The zoom value to apply.
|
|
826
895
|
*/
|
|
827
896
|
constructor(zoom: number);
|
|
828
897
|
}
|
|
829
898
|
|
|
830
899
|
/**
|
|
831
|
-
* Represents a command to
|
|
900
|
+
* Represents a command to initialize Showcase for a product scene and start a sequence for the product.
|
|
832
901
|
* @remarks
|
|
833
|
-
* This class sends a command to the Metabox API to
|
|
834
|
-
*
|
|
835
|
-
*
|
|
902
|
+
* This class sends a command to the Metabox API to initialize showcase if the product has a sequence.
|
|
903
|
+
* To check this, find the showcase property in the current product and listen to the 'configuratorDataUpdated' event.
|
|
904
|
+
* //...Assume that the integration is already implemented (only once)
|
|
905
|
+
* @example
|
|
906
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
907
|
+
*
|
|
908
|
+
* @param {Communicator} api - communicator instance api
|
|
909
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
910
|
+
* @param {ConfiguratorEnvelope} data - configurator state after updated
|
|
911
|
+
* api.addEventListener('configuratorDataUpdated', (data) => {
|
|
912
|
+
* console.log('State updated after applied new environment:', data);
|
|
913
|
+
* });
|
|
914
|
+
* };
|
|
915
|
+
*
|
|
916
|
+
* If this property exists, you can send the init showcase command.
|
|
917
|
+
*
|
|
918
|
+
* To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event.
|
|
919
|
+
* //...Assume that the integration is already implemented (only once)
|
|
920
|
+
* @example
|
|
921
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
922
|
+
*
|
|
923
|
+
* @param {Communicator} api - communicator instance api
|
|
924
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
925
|
+
* @param {ShowCaseStatus} data - showcase status value
|
|
926
|
+
* api.addEventListener('showcaseStatusChanged', (data) => {
|
|
927
|
+
* console.log('Showcase status value after changed:', data);
|
|
928
|
+
* });
|
|
929
|
+
* };
|
|
836
930
|
*
|
|
837
931
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
838
932
|
*
|
|
839
933
|
* @example
|
|
840
|
-
* ```typescript
|
|
841
934
|
* import { InitShowcase, Communicator } from '@3dsource/metabox-front-api';
|
|
935
|
+
*
|
|
936
|
+
* @param {Communicator} api - communicator instance api
|
|
842
937
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
843
938
|
* api.sendCommandToMetabox(new InitShowcase());
|
|
844
939
|
* };
|
|
@@ -854,14 +949,29 @@ declare class InitShowcase extends CommandBase {
|
|
|
854
949
|
}
|
|
855
950
|
|
|
856
951
|
/**
|
|
857
|
-
* Represents a command to
|
|
952
|
+
* Represents a command to play Showcase for a product when it is already initialized and paused.
|
|
858
953
|
* @remarks
|
|
859
|
-
* This class sends a command to the Metabox API to play showcase for a product if it is already initialized and
|
|
954
|
+
* This class sends a command to the Metabox API to play showcase for a product if it is already initialized and paused.
|
|
955
|
+
*
|
|
956
|
+
* To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event.
|
|
957
|
+
* //...Assume that the integration is already implemented (only once)
|
|
958
|
+
* @example
|
|
959
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
960
|
+
*
|
|
961
|
+
* @param {Communicator} api - communicator instance api
|
|
962
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
963
|
+
* @param {ShowCaseStatus} data - showcase status value
|
|
964
|
+
* api.addEventListener('showcaseStatusChanged', (data) => {
|
|
965
|
+
* console.log('Showcase status value after changed:', data);
|
|
966
|
+
* });
|
|
967
|
+
* };
|
|
860
968
|
*
|
|
861
969
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
862
970
|
*
|
|
863
971
|
* @example
|
|
864
972
|
* import { PlayShowcase, Communicator } from '@3dsource/metabox-front-api';
|
|
973
|
+
*
|
|
974
|
+
* @param {Communicator} api - communicator instance api
|
|
865
975
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
866
976
|
* api.sendCommandToMetabox(new PlayShowcase());
|
|
867
977
|
* };
|
|
@@ -886,14 +996,29 @@ declare class UnrealCommand extends CommandBase {
|
|
|
886
996
|
}
|
|
887
997
|
|
|
888
998
|
/**
|
|
889
|
-
* Represents a command to
|
|
999
|
+
* Represents a command to pause Showcase for a product when it is already initialized and playing.
|
|
890
1000
|
* @remarks
|
|
891
|
-
* This class sends a command to the Metabox API to pause showcase for a product if it is already initialized and
|
|
1001
|
+
* This class sends a command to the Metabox API to pause showcase for a product if it is already initialized and playing.
|
|
1002
|
+
*
|
|
1003
|
+
* To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event.
|
|
1004
|
+
* //...Assume that the integration is already implemented (only once)
|
|
1005
|
+
* @example
|
|
1006
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
1007
|
+
*
|
|
1008
|
+
* @param {Communicator} api - communicator instance api
|
|
1009
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1010
|
+
* @param {ShowCaseStatus} data - showcase status value
|
|
1011
|
+
* api.addEventListener('showcaseStatusChanged', (data) => {
|
|
1012
|
+
* console.log('Showcase status value after changed:', data);
|
|
1013
|
+
* });
|
|
1014
|
+
* };
|
|
892
1015
|
*
|
|
893
1016
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
894
1017
|
*
|
|
895
1018
|
* @example
|
|
896
1019
|
* import { PauseShowcase, Communicator } from '@3dsource/metabox-front-api';
|
|
1020
|
+
*
|
|
1021
|
+
* @param {Communicator} api - communicator instance api
|
|
897
1022
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
898
1023
|
* api.sendCommandToMetabox(new PauseShowcase());
|
|
899
1024
|
* };
|
|
@@ -909,14 +1034,29 @@ declare class PauseShowcase extends CommandBase {
|
|
|
909
1034
|
}
|
|
910
1035
|
|
|
911
1036
|
/**
|
|
912
|
-
* Represents a command to
|
|
1037
|
+
* Represents a command to stop Showcase for a product when it is already initialized, and you want to destroy it.
|
|
913
1038
|
* @remarks
|
|
914
|
-
* This class sends a command to the Metabox API to
|
|
1039
|
+
* This class sends a command to the Metabox API to stop showcase for a product if it is already initialized.
|
|
1040
|
+
*
|
|
1041
|
+
* To listen for changes after sending this command, listen to the 'showcaseStatusChanged' event.
|
|
1042
|
+
* //...Assume that the integration is already implemented (only once)
|
|
1043
|
+
* @example
|
|
1044
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
1045
|
+
*
|
|
1046
|
+
* @param {Communicator} api - communicator instance api
|
|
1047
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1048
|
+
* @param {ShowCaseStatus} data - showcase status value
|
|
1049
|
+
* api.addEventListener('showcaseStatusChanged', (data) => {
|
|
1050
|
+
* console.log('Showcase status value after changed:', data);
|
|
1051
|
+
* });
|
|
1052
|
+
* };
|
|
915
1053
|
*
|
|
916
1054
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
917
1055
|
*
|
|
918
1056
|
* @example
|
|
919
1057
|
* import { StopShowcase, Communicator } from '@3dsource/metabox-front-api';
|
|
1058
|
+
*
|
|
1059
|
+
* @param {Communicator} api - communicator instance api
|
|
920
1060
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
921
1061
|
* api.sendCommandToMetabox(new StopShowcase());
|
|
922
1062
|
* };
|
|
@@ -939,17 +1079,28 @@ declare class StopShowcase extends CommandBase {
|
|
|
939
1079
|
type MimeType = 'image/png' | 'image/jpeg' | 'image/webp';
|
|
940
1080
|
/**
|
|
941
1081
|
* Represents a command to get a screenshot.
|
|
942
|
-
*
|
|
943
1082
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
944
1083
|
*
|
|
1084
|
+
* @remarks
|
|
1085
|
+
* To listen for changes after sending this command, listen to the 'screenshot' event.
|
|
1086
|
+
* //...Assume that the integration is already implemented (only once)
|
|
1087
|
+
* @example
|
|
1088
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
1089
|
+
*
|
|
1090
|
+
* @param {Communicator} api - communicator instance api
|
|
1091
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1092
|
+
* @param {string} data - base64 string image
|
|
1093
|
+
* api.addEventListener('screenshot', (data) => {
|
|
1094
|
+
* console.log('Get screenshot here:', data);
|
|
1095
|
+
* saveImage(data, 'Render.png');
|
|
1096
|
+
* });
|
|
1097
|
+
* };
|
|
1098
|
+
*
|
|
945
1099
|
* @example
|
|
946
1100
|
* import { GetScreenshot, Communicator, saveImage } from '@3dsource/metabox-front-api';
|
|
1101
|
+
*
|
|
1102
|
+
* @param {Communicator} api - communicator instance api
|
|
947
1103
|
* 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
1104
|
* api.sendCommandToMetabox(new GetScreenshot('image/png', { x: 1024, y: 1024 }));
|
|
954
1105
|
* };
|
|
955
1106
|
*/
|
|
@@ -971,10 +1122,23 @@ declare class GetScreenshot extends CommandBase {
|
|
|
971
1122
|
* @remarks
|
|
972
1123
|
* This action sends a message to the Metabox API to set a product using the provided product ID.
|
|
973
1124
|
*
|
|
1125
|
+
* To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.
|
|
1126
|
+
* //...Assume that the integration is already implemented (only once)
|
|
1127
|
+
* @example
|
|
1128
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
1129
|
+
*
|
|
1130
|
+
* @param {Communicator} api - communicator instance api
|
|
1131
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1132
|
+
* @param {ConfiguratorEnvelope} data - configurator state after updated
|
|
1133
|
+
* api.addEventListener('configuratorDataUpdated', (data) => {
|
|
1134
|
+
* console.log('State updated after applied new product:', data);
|
|
1135
|
+
* });
|
|
1136
|
+
* };
|
|
1137
|
+
*
|
|
974
1138
|
* @example
|
|
975
1139
|
* import { SetProduct, Communicator } from '@3dsource/metabox-front-api';
|
|
976
1140
|
*
|
|
977
|
-
*
|
|
1141
|
+
* @param {Communicator} api - communicator instance api
|
|
978
1142
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
979
1143
|
* api.setCommandToMetaBox(new SetProduct(
|
|
980
1144
|
* 'ffea6b5c-3a8a-4f56-9417-e605acb5cca3'
|
|
@@ -993,10 +1157,25 @@ declare class SetProduct extends CommandBase {
|
|
|
993
1157
|
/**
|
|
994
1158
|
* Represents a command to set a material by its slot ID and Material ID.
|
|
995
1159
|
*
|
|
1160
|
+
* @remarks
|
|
1161
|
+
* To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.
|
|
1162
|
+
* //...Assume that the integration is already implemented (only once)
|
|
1163
|
+
*
|
|
1164
|
+
* @example
|
|
1165
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
1166
|
+
*
|
|
1167
|
+
* @param {Communicator} api - communicator instance api
|
|
1168
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1169
|
+
* @param {ConfiguratorEnvelope} data - configurator state after updated
|
|
1170
|
+
* api.addEventListener('configuratorDataUpdated', (data) => {
|
|
1171
|
+
* console.log('State updated after applied new material:', data);
|
|
1172
|
+
* });
|
|
1173
|
+
* };
|
|
1174
|
+
*
|
|
996
1175
|
* @example
|
|
997
1176
|
* import { SetProductMaterial, Communicator } from '@3dsource/metabox-front-api';
|
|
998
1177
|
*
|
|
999
|
-
*
|
|
1178
|
+
* @param {Communicator} api - communicator instance api
|
|
1000
1179
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1001
1180
|
* api.sendCommandToMetabox(new SetProductMaterial(
|
|
1002
1181
|
* 'carpaint',
|
|
@@ -1017,12 +1196,25 @@ declare class SetProductMaterial extends CommandBase {
|
|
|
1017
1196
|
/**
|
|
1018
1197
|
* Represents a command to set the environment by its ID.
|
|
1019
1198
|
*
|
|
1199
|
+
* @remarks
|
|
1200
|
+
* To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.
|
|
1201
|
+
* //...Assume that the integration is already implemented (only once)
|
|
1202
|
+
* @example
|
|
1203
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
1204
|
+
*
|
|
1205
|
+
* @param {Communicator} api - communicator instance api
|
|
1206
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1207
|
+
* @param {ConfiguratorEnvelope} data - configurator state after updated
|
|
1208
|
+
* api.addEventListener('configuratorDataUpdated', (data) => {
|
|
1209
|
+
* console.log('State updated after applied new environment:', data);
|
|
1210
|
+
* });
|
|
1211
|
+
* };
|
|
1212
|
+
*
|
|
1020
1213
|
* @example
|
|
1021
1214
|
* import { SetEnvironment, Communicator } from '@3dsource/metabox-front-api';
|
|
1022
1215
|
*
|
|
1023
|
-
*
|
|
1216
|
+
* @param {Communicator} api - communicator instance api
|
|
1024
1217
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1025
|
-
* // Change the environment to '55555555-1234-1234-1234-01234567890'
|
|
1026
1218
|
* api.sendCommandToMetabox(new SetEnvironment('55555555-1234-1234-1234-01234567890'));
|
|
1027
1219
|
* };
|
|
1028
1220
|
*/
|
|
@@ -1038,10 +1230,24 @@ declare class SetEnvironment extends CommandBase {
|
|
|
1038
1230
|
/**
|
|
1039
1231
|
* Represents a command to set an environment material by its slot ID and Material ID.
|
|
1040
1232
|
*
|
|
1233
|
+
* @remarks
|
|
1234
|
+
* To listen for changes after sending this command, listen to the 'configuratorDataUpdated' event.
|
|
1235
|
+
* //...Assume that the integration is already implemented (only once)
|
|
1236
|
+
* @example
|
|
1237
|
+
* import { Communicator } from '@3dsource/metabox-front-api';
|
|
1238
|
+
*
|
|
1239
|
+
* @param {Communicator} api - communicator instance api
|
|
1240
|
+
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1241
|
+
* @param {ConfiguratorEnvelope} data - configurator state after updated
|
|
1242
|
+
* api.addEventListener('configuratorDataUpdated', (data) => {
|
|
1243
|
+
* console.log('State updated after applied new environment material:', data);
|
|
1244
|
+
* });
|
|
1245
|
+
* };
|
|
1246
|
+
*
|
|
1041
1247
|
* @example
|
|
1042
1248
|
* import { SetEnvironmentMaterial, Communicator } from '@3dsource/metabox-front-api';
|
|
1043
1249
|
*
|
|
1044
|
-
*
|
|
1250
|
+
* @param {Communicator} api - communicator instance api
|
|
1045
1251
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1046
1252
|
* api.sendCommandToMetabox(new SetEnvironmentMaterial(
|
|
1047
1253
|
* 'carpaint',
|
|
@@ -1060,14 +1266,17 @@ declare class SetEnvironmentMaterial extends CommandBase {
|
|
|
1060
1266
|
}
|
|
1061
1267
|
|
|
1062
1268
|
/**
|
|
1063
|
-
* Represents a command to toggle the
|
|
1269
|
+
* Represents a command to toggle the embedded Metabox menu.
|
|
1270
|
+
* @remarks
|
|
1271
|
+
* This command can only be used when using the metabox menu.
|
|
1272
|
+
* **Important**: No need to listen to any events to see changes.
|
|
1064
1273
|
*
|
|
1065
1274
|
* @example
|
|
1066
1275
|
* import { ShowEmbeddedMenu, Communicator } from '@3dsource/metabox-front-api';
|
|
1067
1276
|
*
|
|
1068
|
-
*
|
|
1277
|
+
* @param {Communicator} api - communicator instance api
|
|
1069
1278
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1070
|
-
* api.
|
|
1279
|
+
* api.sendCommandToMetabox(new ShowEmbeddedMenu(true));
|
|
1071
1280
|
* };
|
|
1072
1281
|
*/
|
|
1073
1282
|
declare class ShowEmbeddedMenu extends CommandBase {
|
|
@@ -1084,11 +1293,12 @@ declare class ShowEmbeddedMenu extends CommandBase {
|
|
|
1084
1293
|
*
|
|
1085
1294
|
* @remarks
|
|
1086
1295
|
* This action sends a message to the Metabox API to toggle the visibility of the Unreal overlay UI.
|
|
1296
|
+
* **Important**: No need to listen to any events to see changes.
|
|
1087
1297
|
*
|
|
1088
1298
|
* @example
|
|
1089
1299
|
* import { ShowOverlayInterface, Communicator } from '@3dsource/metabox-front-api';
|
|
1090
1300
|
*
|
|
1091
|
-
*
|
|
1301
|
+
* @param {Communicator} api - communicator instance api
|
|
1092
1302
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1093
1303
|
* api.setCommandToMetaBox(new ShowOverlayInterface(true));
|
|
1094
1304
|
* };
|
|
@@ -1121,21 +1331,23 @@ declare class WatchCallbacks extends CommandBase {
|
|
|
1121
1331
|
}
|
|
1122
1332
|
|
|
1123
1333
|
/**
|
|
1124
|
-
* Represents a command to
|
|
1334
|
+
* Represents a command to show measurement for a product when it is already loaded.
|
|
1125
1335
|
* @remarks
|
|
1126
|
-
* This class sends a command to the Metabox API to
|
|
1127
|
-
*
|
|
1336
|
+
* This class sends a command to the Metabox API to show measurement for a product if it is already initialized.
|
|
1337
|
+
* **Important**: No need to listen to any events to see changes.
|
|
1128
1338
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
1129
1339
|
*
|
|
1130
1340
|
* @example
|
|
1131
1341
|
* import { ShowMeasurement, Communicator } from '@3dsource/metabox-front-api';
|
|
1342
|
+
*
|
|
1343
|
+
* @param {Communicator} api - communicator instance api
|
|
1132
1344
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1133
1345
|
* api.sendCommandToMetabox(new ShowMeasurement());
|
|
1134
1346
|
* };
|
|
1135
1347
|
*/
|
|
1136
1348
|
declare class ShowMeasurement extends CommandBase {
|
|
1137
1349
|
/**
|
|
1138
|
-
* Creates an instance of
|
|
1350
|
+
* Creates an instance of ShowMeasurement.
|
|
1139
1351
|
*
|
|
1140
1352
|
* @remarks
|
|
1141
1353
|
* This constructor does not require any parameters.
|
|
@@ -1144,14 +1356,16 @@ declare class ShowMeasurement extends CommandBase {
|
|
|
1144
1356
|
}
|
|
1145
1357
|
|
|
1146
1358
|
/**
|
|
1147
|
-
* Represents a command to
|
|
1359
|
+
* Represents a command to hide measurement for a product when it is already loaded.
|
|
1148
1360
|
* @remarks
|
|
1149
|
-
* This class sends a command to the Metabox API to
|
|
1150
|
-
*
|
|
1361
|
+
* This class sends a command to the Metabox API to hide measurement for a product if it is already initialized.
|
|
1362
|
+
* **Important**: No need to listen to any events to see changes.
|
|
1151
1363
|
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
1152
1364
|
*
|
|
1153
1365
|
* @example
|
|
1154
1366
|
* import { HideMeasurement, Communicator } from '@3dsource/metabox-front-api';
|
|
1367
|
+
*
|
|
1368
|
+
* @param {Communicator} api - communicator instance api
|
|
1155
1369
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1156
1370
|
* api.sendCommandToMetabox(new HideMeasurement());
|
|
1157
1371
|
* };
|
|
@@ -1170,12 +1384,14 @@ declare class HideMeasurement extends CommandBase {
|
|
|
1170
1384
|
* Represents a command to force set the device type.
|
|
1171
1385
|
*
|
|
1172
1386
|
* @remarks
|
|
1173
|
-
* This class sends a message to the Metabox API to force
|
|
1387
|
+
* This class sends a message to the Metabox API to force set the device type.
|
|
1388
|
+
* **Important**: No need to listen to any events to see changes.
|
|
1389
|
+
* //...Assume that the integration is already implemented (only once)
|
|
1174
1390
|
*
|
|
1175
1391
|
* @example
|
|
1176
1392
|
* import { ForceSetDeviceType, Communicator } from '@3dsource/metabox-front-api';
|
|
1177
1393
|
*
|
|
1178
|
-
*
|
|
1394
|
+
* @param {Communicator} api - communicator instance api
|
|
1179
1395
|
* window.env3DSource.apiReady = (api: Communicator) => {
|
|
1180
1396
|
* api.sendCommandToMetabox(new ForceSetDeviceType('desktop'));
|
|
1181
1397
|
* };
|