@3dsource/metabox-front-api 1.2.3-dev.1 → 1.2.4

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 (2) hide show
  1. package/README.md +65 -3
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -11,6 +11,7 @@ their material slots, and materials, environments.
11
11
  - [Installation](#installation)
12
12
  - [Quick Start](#quick-start)
13
13
  - [API Reference](#api-reference)
14
+ - [Steps to build custom menu](#steps-to-build-custom-menu)
14
15
  - [System Terminology](#system-terminology)
15
16
  - [Core Functions](#core-functions)
16
17
  - [Command Classes](#command-classes)
@@ -45,7 +46,7 @@ their material slots, and materials, environments.
45
46
  For use with frameworks like Angular, React, Vue, etc.:
46
47
 
47
48
  ```bash
48
- npm install @3dsource/metabox-front-api@^1.2.2 --save
49
+ npm install @3dsource/metabox-front-api@^1.2.4 --save
49
50
  ```
50
51
 
51
52
  Then import the required components:
@@ -58,7 +59,7 @@ import { integrateMetaBox, Communicator, ConfiguratorEnvelope, SetProduct, SetMa
58
59
 
59
60
  Alternative CDN options:
60
61
 
61
- - **jsDelivr**: `https://cdn.jsdelivr.net/npm/@3dsource/metabox-front-api@^1.2.2/+esm`
62
+ - **jsDelivr**: `https://cdn.jsdelivr.net/npm/@3dsource/metabox-front-api@^1.2.4/+esm`
62
63
 
63
64
  For quick prototyping or vanilla JavaScript projects:
64
65
 
@@ -102,7 +103,7 @@ Create a container element where the Metabox Configurator will be embedded:
102
103
 
103
104
  ```html
104
105
  <script type="module">
105
- import { integrateMetaBox, SetProduct, SetMaterial, SetEnvironment, GetScreenshot, saveImage } from 'https://cdn.jsdelivr.net/npm/@3dsource/metabox-front-api@1.2.2';
106
+ import { integrateMetaBox, SetProduct, SetMaterial, SetEnvironment, GetScreenshot, saveImage } from 'https://cdn.jsdelivr.net/npm/@3dsource/metabox-front-api@1.2.4';
106
107
 
107
108
  class MetaboxIntegrator {
108
109
  constructor() {
@@ -300,6 +301,19 @@ const metaboxIntegrator = new MetaboxIntegrator();
300
301
  - Your backend decides how to use the configuration JSON (e.g., generate a PDF or build a product list).
301
302
  - 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.).
302
303
 
304
+ ### Steps to build custom menu
305
+
306
+ - **configuratorDataUpdated** - add event listener to receive get configurator data and then updates
307
+ - **showEmbeddedMenu** - hide embedded metabox right sidebar, but if you want to show it again, you can use this method
308
+ - **showOverlayInterface** - hide viewport metabox actions if you want to add yours
309
+ - **setEnvironment** - set active environment when you want to change environment
310
+ - **setEnvironmentMaterialById** - set environment material by slot ID
311
+ - **setProduct** - set active product when you want to change product
312
+ - **setProductMaterialById** - set product material by slot ID
313
+ - **getScreenshot** - get screenshot
314
+ - **getCallToActionInformation** - send call to action information to api endpoint provided in CTA configuration
315
+ - **getPdf** - get PDF.
316
+
303
317
  ### Core Functions
304
318
 
305
319
  #### `integrateMetaBox`
@@ -330,6 +344,54 @@ integrateMetaBox('https://metabox.3dsource.com/metabox-configurator/basic/your-i
330
344
 
331
345
  All commands are sent to the configurator using the `api.sendCommandToMetaBox()` method.
332
346
 
347
+ #### Command Payload Types
348
+
349
+ All commands use strongly typed payloads defined in `ToMetaboxMessagePayloads`:
350
+
351
+ ```typescript
352
+ interface ToMetaboxMessagePayloads {
353
+ [MetaboxBasicConfiguratorActions.getPdf]: void;
354
+ [MetaboxBasicConfiguratorActions.getCallToActionInformation]: void;
355
+ [MetaboxBasicConfiguratorActions.loadLevel]: { id: string };
356
+ [MetaboxBasicConfiguratorActions.setProduct]: { productId: string };
357
+ /**
358
+ * @deprecated
359
+ * @hidden use
360
+ * {@link MetaboxBasicConfiguratorActions.watchCallbacks}
361
+ */
362
+ [MetaboxBasicConfiguratorActions.addResponse]: void;
363
+ [MetaboxBasicConfiguratorActions.watchCallbacks]: void;
364
+ [MetaboxBasicConfiguratorActions.getFastRender]: {
365
+ format: MimeType;
366
+ size?: { x: number; y: number };
367
+ };
368
+ [MetaboxBasicConfiguratorActions.getScreenshot]: {
369
+ format: MimeType;
370
+ size?: { x: number; y: number };
371
+ };
372
+ [MetaboxBasicConfiguratorActions.setMaterialById]: {
373
+ slotId: string;
374
+ materialId: string;
375
+ };
376
+ [MetaboxBasicConfiguratorActions.setEnvironmentMaterialById]: {
377
+ slotId: string;
378
+ materialId: string;
379
+ };
380
+ [MetaboxBasicConfiguratorActions.showEmbeddedMenu]: { visible: boolean };
381
+ [MetaboxBasicConfiguratorActions.showOverlayInterface]: { visible: boolean };
382
+ [MetaboxBasicConfiguratorActions.forceSetDeviceType]: {
383
+ deviceType: ApplicationDeviceTypes;
384
+ };
385
+ [MetaboxBasicConfiguratorActions.resetCamera]: void;
386
+ [MetaboxBasicConfiguratorActions.applyZoom]: { zoom: number };
387
+ [MetaboxBasicConfiguratorActions.initShowcase]: { productId: string };
388
+ [MetaboxBasicConfiguratorActions.playShowcase]: void;
389
+ [MetaboxBasicConfiguratorActions.pauseShowcase]: void;
390
+ [MetaboxBasicConfiguratorActions.stopShowcase]: void;
391
+ [MetaboxBasicConfiguratorActions.sendCommandToUnreal]: object;
392
+ }
393
+ ```
394
+
333
395
  #### Product Configuration
334
396
 
335
397
  ##### `SetProduct`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3dsource/metabox-front-api",
3
- "version": "1.2.3-dev.1",
3
+ "version": "1.2.4",
4
4
  "description": "API for Metabox BASIC configurator",
5
5
  "keywords": [
6
6
  "metabox",