@3dsource/metabox-modular-configurator-api 0.0.4-dev.0 → 0.0.4-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.
Files changed (3) hide show
  1. package/README.md +45 -6
  2. package/index.d.ts +3 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -26,6 +26,7 @@ components, component types, materials, and capture screenshots or PDFs.
26
26
  - 📱 Responsive design support
27
27
  - 🎨 Full control over materials, environments, and components
28
28
  - 📸 Screenshot and PDF generation
29
+ - 🛒 Call-to-Action (CTA) data generation
29
30
  - 🎬 Showcase management
30
31
  - 📦 TypeScript support with full type definitions
31
32
  - 🌐 CDN support for quick prototyping
@@ -33,7 +34,7 @@ components, component types, materials, and capture screenshots or PDFs.
33
34
  ## Prerequisites
34
35
 
35
36
  - Modern web browser with ES6 module support
36
- - HTTPS connection (required for unreal engine)
37
+ - HTTPS connection (required for Unreal Engine)
37
38
  - Valid Metabox modular configurator URL
38
39
 
39
40
  ## Installation
@@ -56,15 +57,14 @@ import { integrateMetabox, Communicator, SetEnvironment, SetComponent } from 'ht
56
57
 
57
58
  Alternative CDN options:
58
59
 
59
- - **jsDelivr**: `https://cdn.jsdelivr.net/npm/@3dsource/metabox-modular-configurator-api@0.0.3/+esm`
60
+ - **jsDelivr**: `https://cdn.jsdelivr.net/npm/@3dsource/metabox-modular-configurator-api@0.0.5/+esm`
60
61
 
61
62
  ## Quick Start
62
63
 
63
64
  ### 1. HTML Setup
64
65
 
65
66
  Ensure your HTML page has the following structure, where the Metabox Configurator will be integrated.
66
- You **MUST** control CSS style of `embed3DSource` element to make the configurator responsive and fit your needs on your
67
- own.
67
+ You must provide CSS for the `#embed3DSource` element to make the configurator responsive and fit your layout needs.
68
68
  Create a container element where the configurator will be embedded:
69
69
 
70
70
  ```html
@@ -97,7 +97,7 @@ Create a container element where the configurator will be embedded:
97
97
 
98
98
  ```html
99
99
  <script type="module">
100
- import { GetPdf, GetScreenshot, integrateMetabox, saveImage, SetComponent, SetComponentMaterial, SetEnvironment, SetEnvironmentMaterial, ShowEmbeddedMenu, ShowOverlayInterface } from 'https://cdn.jsdelivr.net/npm/@3dsource/metabox-modular-configurator-api';
100
+ import { GetPdf, GetScreenshot, GetCallToActionInformation, integrateMetabox, saveImage, SetComponent, SetComponentMaterial, SetEnvironment, SetEnvironmentMaterial, ShowEmbeddedMenu, ShowOverlayInterface, ResetCamera, ApplyZoom } from 'https://cdn.jsdelivr.net/npm/@3dsource/metabox-modular-configurator-api';
101
101
 
102
102
  // Replace it with your actual configurator URL
103
103
  const configuratorUrl = 'https://metabox.3dsource.com/metabox-configurator/modular/your-configurator-id';
@@ -251,6 +251,19 @@ configurator.changeMaterial('seat-fabric', 'leather-brown');
251
251
  - **component** - Product in the Modular configurator context.
252
252
  - **componentId** - Unique Component ID within the Metabox system; mandatory. Assigned by the Metabox system automatically after the Modular configurator is created in Metabox.
253
253
  - **componentType** - Exists in Modular Configurator only; the name of the type of the product component, which can include one or several separate products of the same category (examples of product component types: truck wheel, truck bumper). It is set by an unreal artist while creating the digital twin model and is automatically added to the Metabox system after this twin is uploaded to Metabox.
254
+ - **E‑Com Configurator** — can be created from any Basic or Modular Configurator by adding a CTA (call‑to‑action) button to the standard configurator right‑nav menu in the Metabox Configurator Manager (where users create and edit configurators).
255
+ To enable the CTA button, add two mandatory parameters in the Configurator Manager:
256
+ - Text label for the CTA button (examples: "Get Quote", "Contact Dealer").
257
+ - Callback URL for an HTTP POST request. Response requirements:
258
+ ```json
259
+ {
260
+ "redirectUrl": "https://your.site/thank-you-or-checkout"
261
+ }
262
+ ```
263
+ When the user clicks the CTA button in the configurator:
264
+ - Metabox generates a JSON payload with the current configuration and sends it to the specified Callback URL.
265
+ - Your backend decides how to use the configuration JSON (e.g., generate a PDF or build a product list).
266
+ - After your endpoint responds with a JSON containing "redirectUrl", the user is redirected in a new browser tab to that URL (a non‑Metabox page on your side) to complete the flow (e.g., leave contact information, proceed to checkout, etc.).
254
267
 
255
268
  ### Core Integration
256
269
 
@@ -593,7 +606,7 @@ Captures a screenshot of the current configurator view.
593
606
 
594
607
  **Parameters:**
595
608
 
596
- - `mimeType` (`string`): Image format ('image/png', 'image/jpeg')
609
+ - `mimeType` (`string`): Image format ('image/png', 'image/jpeg', 'image/webp')
597
610
  - `size` (`{ x: number; y: number }`, optional): Screenshot dimensions in pixels
598
611
 
599
612
  **TypeScript Interface:**
@@ -621,6 +634,21 @@ Generates a PDF document of the current configuration.
621
634
  api.sendCommandToMetaBox(new GetPdf());
622
635
  ```
623
636
 
637
+ ### Commerce & CTA
638
+
639
+ #### `GetCallToActionInformation()`
640
+
641
+ Requests Call-To-Action information based on the current configuration. The configurator will compile CTA data and post it to the endpoint specified in the CTA configuration.
642
+
643
+ - No parameters.
644
+ - The response is delivered to the configured endpoint URL; listen to your backend or proxy endpoint to handle it.
645
+
646
+ **Example:**
647
+
648
+ ```typescript
649
+ api.sendCommandToMetaBox(new GetCallToActionInformation());
650
+ ```
651
+
624
652
  #### `saveImage(renderData, fileName)`
625
653
 
626
654
  Utility function to save image data to a file.
@@ -682,6 +710,17 @@ api.sendCommandToMetaBox(new UnrealCommand('SetLightIntensity 2.5'));
682
710
 
683
711
  ## Examples
684
712
 
713
+ ### CTA Request Example
714
+
715
+ ```typescript
716
+ import { integrateMetabox, Communicator, GetCallToActionInformation } from '@3dsource/metabox-modular-configurator-api';
717
+
718
+ integrateMetabox('https://metabox.3dsource.com/metabox-configurator/modular/your-configurator-id', 'embed3DSource', (api: Communicator) => {
719
+ // Request CTA data for the current configuration
720
+ api.sendCommandToMetaBox(new GetCallToActionInformation());
721
+ });
722
+ ```
723
+
685
724
  ### Complete Product Configurator
686
725
 
687
726
  ```typescript
package/index.d.ts CHANGED
@@ -128,6 +128,9 @@ interface InitialModularConfigurator {
128
128
  /** The camera settings used in the configurator. */
129
129
  /** Indicates if the configurator is active. */
130
130
  isActive: boolean;
131
+ /** Indicates if the cta in ecom configurator is enabled or not. */
132
+ ctaEnabled: boolean;
133
+ /** A list of available connectors shows connections between all component types . */
131
134
  connectors: ModularConfiguratorConnector[];
132
135
  /** GraphQL typename for the Modular Configurator. */
133
136
  __typename: 'ModularConfigurator';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3dsource/metabox-modular-configurator-api",
3
- "version": "0.0.4-dev.0",
3
+ "version": "0.0.4-dev.1",
4
4
  "description": "API for Metabox MODULAR configurator",
5
5
  "keywords": [
6
6
  "metabox",