@3dsource/metabox-modular-configurator-api 3.0.19-dev.10 → 3.0.19-dev.11

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/README.md CHANGED
@@ -35,6 +35,7 @@ TypeScript/JavaScript API for integrating Metabox Modular Configurator into web
35
35
  - [Camera Control](#camera-control)
36
36
  - [Showcase/Animation Control](#showcaseanimation-control)
37
37
  - [Measurement Tools](#measurement-tools)
38
+ - [Stream Control](#stream-control)
38
39
  - [Export & Media](#export--media)
39
40
  - [Advanced Commands (Use with Caution)](#advanced-commands-use-with-caution)
40
41
  - [Event Handling](#event-handling)
@@ -422,7 +423,7 @@ interface IntegrateMetaboxConfig {
422
423
  introImage?: string; // URL for intro image
423
424
  introVideo?: string; // URL for intro video
424
425
  loadingImage?: string; // URL for loading spinner
425
- state?: ConfiguratorState; // Initial component tree state
426
+ state?: string; // Initial component tree state (rison format)
426
427
  domain?: string; // Override domain (HTTPS only)
427
428
  }
428
429
  ```
@@ -467,10 +468,10 @@ The API provides comprehensive TypeScript support with the following key interfa
467
468
  The main API interface for sending commands and listening to events.
468
469
 
469
470
  ```typescript
470
- interface Communicator {
471
- sendCommandToMetabox<T extends keyof ToMetaboxMessagePayloads>(command: CommandBase<T>): void;
472
- addEventListener<K extends keyof FromMetaboxMessagePayloads>(eventType: K, listener: (data: FromMetaboxMessagePayloads[K]) => void): void;
473
- removeEventListener<K extends keyof FromMetaboxMessagePayloads>(eventType: K, listener: (data: FromMetaboxMessagePayloads[K]) => void): void;
471
+ class Communicator extends EventDispatcher {
472
+ sendCommandToMetabox<T extends CommandBase>(command: T): void;
473
+ addEventListener<T extends FromMetaBoxApiEvents>(messageType: T, callback: (data: FromMetaboxMessagePayloads[T]) => void): this;
474
+ removeEventListener<T extends FromMetaBoxApiEvents>(messageType: T, callback: (data: FromMetaboxMessagePayloads[T]) => void): this;
474
475
  }
475
476
  ```
476
477
 
@@ -562,6 +563,151 @@ interface Environment {
562
563
  }
563
564
  ```
564
565
 
566
+ ##### `InitialModularConfigurator`
567
+
568
+ The full configurator definition containing all available components, environments, and component types.
569
+
570
+ ```typescript
571
+ interface InitialModularConfigurator {
572
+ /** Unique identifier for the configurator. */
573
+ id: string;
574
+ /** The name of the configurator. */
575
+ name: string;
576
+ /** A list of components for the configurator. */
577
+ components: ModularConfiguratorComponent[];
578
+ /** A list of available environments. */
579
+ environments: ModularConfiguratorEnvironment[];
580
+ /** A list of component types for the configurator. */
581
+ componentTypes: ModularConfiguratorComponentType[];
582
+ /** Indicates if the configurator is active. */
583
+ isActive: boolean;
584
+ /** Indicates if the CTA in ecom configurator is enabled. */
585
+ ctaEnabled: boolean;
586
+ /** A list of connectors showing connections between component types. */
587
+ connectors: ModularConfiguratorConnector[];
588
+ __typename: 'ModularConfigurator';
589
+ }
590
+ ```
591
+
592
+ ##### `ModularConfiguratorComponentType`
593
+
594
+ Represents a component category/classification (e.g., "wheel", "bumper", "seat").
595
+
596
+ ```typescript
597
+ interface ModularConfiguratorComponentType {
598
+ /** Display name for the component type. */
599
+ name: string;
600
+ /** Position index of the component type. */
601
+ position: number;
602
+ /** Is root component type. */
603
+ isRoot: boolean;
604
+ /** Is required component type. */
605
+ isRequired: boolean;
606
+ /** Unique identifier. */
607
+ id: string;
608
+ __typename: 'ModularConfiguratorComponentType';
609
+ }
610
+ ```
611
+
612
+ ##### `Product`
613
+
614
+ Base 3D digital twin referenced by each component.
615
+
616
+ ```typescript
617
+ interface Product {
618
+ /** The title of the product. */
619
+ title: string;
620
+ /** List of thumbnails for the product. */
621
+ thumbnailList: Thumbnail[];
622
+ /** Available material slots for the product. */
623
+ slots: Slot[];
624
+ /** List of meta properties for the product. */
625
+ metaProperties: MetaProperty[];
626
+ /** Unique identifier for the product. */
627
+ id: string;
628
+ /** External SKU/identifier for ERP/PIM integration. */
629
+ externalId: string;
630
+ /** Showcase animation details (optional). */
631
+ showcase?: Showcase;
632
+ __typename: 'Product';
633
+ }
634
+ ```
635
+
636
+ ##### `Slot`
637
+
638
+ A material slot on a component or environment — a customizable surface.
639
+
640
+ ```typescript
641
+ interface Slot {
642
+ /** Unique identifier for the slot. */
643
+ id: string;
644
+ /** Display label for the slot. */
645
+ label: string;
646
+ /** Available materials for this slot. */
647
+ enabledMaterials: Material[];
648
+ __typename: 'Slot';
649
+ }
650
+ ```
651
+
652
+ ##### `ModularConfiguratorEnvironment`
653
+
654
+ Environment wrapper containing position and label for environment selector UIs.
655
+
656
+ ```typescript
657
+ interface ModularConfiguratorEnvironment {
658
+ /** Unique identifier for the environment. */
659
+ environmentId: string;
660
+ /** Position index of the environment. */
661
+ position: number;
662
+ /** Display label for the environment. */
663
+ label: string;
664
+ /** Detailed environment configuration. */
665
+ environment: Environment;
666
+ __typename: 'ModularConfiguratorEnvironment';
667
+ }
668
+ ```
669
+
670
+ ##### `ComponentWithParent`
671
+
672
+ Represents a node in the component assembly tree hierarchy.
673
+
674
+ ```typescript
675
+ interface ComponentWithParent {
676
+ id: string;
677
+ componentTypeId: string;
678
+ parentId: string | null;
679
+ }
680
+ ```
681
+
682
+ ##### `SelectedIds`
683
+
684
+ Record type tracking currently selected material/component IDs.
685
+
686
+ ```typescript
687
+ type SelectedIds = Record<string, Record<string, string>>;
688
+ ```
689
+
690
+ ##### `ShowCaseStatus`
691
+
692
+ Showcase animation playback status.
693
+
694
+ ```typescript
695
+ type ShowCaseStatus = 'init' | 'play' | 'pause' | 'stop';
696
+ ```
697
+
698
+ ##### `ModularConfiguratorConnector`
699
+
700
+ Defines connection rules between component types for modular assembly.
701
+
702
+ ```typescript
703
+ interface ModularConfiguratorConnector {
704
+ id: string;
705
+ componentTypeId1: string;
706
+ componentTypeId2: string;
707
+ __typename: 'ModularConfiguratorConnector';
708
+ }
709
+ ```
710
+
565
711
  #### Utility Types
566
712
 
567
713
  ##### `MimeType`
@@ -577,7 +723,7 @@ type MimeType = 'image/png' | 'image/jpeg' | 'image/webp';
577
723
  Device type options for responsive behavior.
578
724
 
579
725
  ```typescript
580
- type ApplicationDeviceTypes = 'desktop' | 'tablet' | 'mobile';
726
+ type ApplicationDeviceTypes = 'deviceTypeAuto' | 'deviceTypeMobile' | 'deviceTypeDesktop';
581
727
  ```
582
728
 
583
729
  ### Command Classes
@@ -609,10 +755,11 @@ api.sendCommandToMetabox(new SetComponentMaterial('wheel-fr', 'rim', 'chrome'));
609
755
 
610
756
  #### UI Control
611
757
 
612
- | Command | Parameters | Description |
613
- | ---------------------- | ------------------ | ---------------------------- |
614
- | `ShowEmbeddedMenu` | `visible: boolean` | Show/hide right sidebar menu |
615
- | `ShowOverlayInterface` | `visible: boolean` | Show/hide viewport controls |
758
+ | Command | Parameters | Description |
759
+ | ---------------------- | ------------------------------------ | ------------------------------------ |
760
+ | `ShowEmbeddedMenu` | `visible: boolean` | Show/hide right sidebar menu |
761
+ | `ShowOverlayInterface` | `visible: boolean` | Show/hide viewport controls |
762
+ | `ForceSetDeviceType` | `deviceType: ApplicationDeviceTypes` | Override responsive device detection |
616
763
 
617
764
  #### Camera Control
618
765
 
@@ -626,8 +773,8 @@ api.sendCommandToMetabox(new SetComponentMaterial('wheel-fr', 'rim', 'chrome'));
626
773
  **Example:**
627
774
 
628
775
  ```typescript
629
- api.sendCommandToMetabox(new ApplyZoom(0.5)); // Zoom in
630
- api.sendCommandToMetabox(new ApplyZoom(-0.25)); // Zoom out
776
+ api.sendCommandToMetabox(new ApplyZoom(50)); // Zoom in
777
+ api.sendCommandToMetabox(new ApplyZoom(-25)); // Zoom out
631
778
  api.sendCommandToMetabox(new ResetCamera()); // Reset view
632
779
  api.sendCommandToMetabox(
633
780
  new SetCamera({
@@ -720,6 +867,19 @@ Notes:
720
867
  | `ShowMeasurement` | None | Display component dimensions |
721
868
  | `HideMeasurement` | None | Hide dimension overlay |
722
869
 
870
+ #### Stream Control
871
+
872
+ | Command | Parameters | Description |
873
+ | -------------- | ---------- | ----------------------------------------------------------- |
874
+ | `ResumeStream` | None | Resume pixel streaming session after pause or disconnection |
875
+
876
+ **Example:**
877
+
878
+ ```typescript
879
+ // Resume the stream after an idle timeout or network interruption
880
+ api.sendCommandToMetabox(new ResumeStream());
881
+ ```
882
+
723
883
  #### Export & Media
724
884
 
725
885
  | Command | Parameters | Description | Event Triggered |
@@ -728,6 +888,21 @@ Notes:
728
888
  | `GetPdf` | None | Generate PDF export | Server-side (no event) |
729
889
  | `GetCallToActionInformation` | None | Trigger CTA workflow | Backend redirect |
730
890
 
891
+ ##### `saveImage()`
892
+
893
+ Triggers a browser download of an image from a data URL or blob URL.
894
+
895
+ **Signature:**
896
+
897
+ ```typescript
898
+ function saveImage(imageUrl: string, filename: string): void;
899
+ ```
900
+
901
+ | Parameter | Type | Description |
902
+ | ---------- | -------- | ----------------------------------- |
903
+ | `imageUrl` | `string` | Base64 data URL or blob URL to save |
904
+ | `filename` | `string` | Suggested filename for the download |
905
+
731
906
  **Screenshot Example:**
732
907
 
733
908
  ```typescript
@@ -740,10 +915,10 @@ api.addEventListener('screenshotReady', (imageData) => {
740
915
 
741
916
  #### Advanced Commands (Use with Caution)
742
917
 
743
- | Command | Parameters | Description |
744
- | --------------- | ------------------------------- | ----------------------------------- |
745
- | `UnrealCommand` | `command: object \| string` | Send raw command to Unreal Engine |
746
- | `MetaboxConfig` | `appId: string, config: object` | Internal initialization (auto-sent) |
918
+ | Command | Parameters | Description |
919
+ | --------------- | --------------------------------------------- | ----------------------------------- |
920
+ | `UnrealCommand` | `payload: object` | Send raw command to Unreal Engine |
921
+ | `MetaboxConfig` | `appId: string, config: MetaboxCommandConfig` | Internal initialization (auto-sent) |
747
922
 
748
923
  **Warning:** `UnrealCommand` bypasses API validation. Use only for custom Unreal-specific features.
749
924
 
@@ -757,8 +932,8 @@ api.sendCommandToMetabox(
757
932
  }),
758
933
  );
759
934
 
760
- // String-based command (if supported)
761
- api.sendCommandToMetabox(new UnrealCommand('SetSunTime 14:30'));
935
+ // Object-based command
936
+ api.sendCommandToMetabox(new UnrealCommand({ action: 'SetSunTime', value: '14:30' }));
762
937
  ```
763
938
 
764
939
  ### Event Handling
@@ -928,7 +1103,7 @@ import { Communicator } from '@3dsource/metabox-modular-configurator-api/types';
928
1103
  }
929
1104
  ```
930
1105
 
931
- #### 4. Component Tree Issues
1106
+ #### Component Tree Issues
932
1107
 
933
1108
  **Problem:** Components not appearing in correct hierarchy
934
1109