@3dsource/metabox-front-api 1.2.1-dev.3 → 1.2.1-dev.5

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
@@ -1,34 +1,33 @@
1
- # MetaBox Basic Configurators API
1
+ # Metabox Basic Configurators API
2
2
 
3
- This package provides an API for interacting with the MetaBox Basic Configurator using plain JavaScript.
3
+ This package provides an API for interacting with the Metabox Basic Configurator using plain JavaScript.
4
4
 
5
5
  ### Installation (for using with frameworks like Angular, React, etc.) This is the recommended method
6
6
 
7
7
  ```sh
8
- npm install @3dsource/metabox-front-api@^1.0.0 --save
8
+ npm install @3dsource/metabox-front-api@^1.2.1 --save
9
9
  ```
10
10
 
11
11
  then
12
12
 
13
13
  ```typescript
14
- import { FromMetaBoxApiAction, GetFastRender, GetPdf, integrateMetaBox, saveImage, SetEnvironment, SetMaterial, SetProduct, ShowEmbeddedMenu, ShowOverlayInterface, SetEnvironmentMaterial, Communicator, ConfiguratorEnvelope } from '@3dsource/metabox-front-api';
14
+ import { FromMetaboxApiAction, GetFastRender, GetPdf, integrateMetaBox, saveImage, SetEnvironment, SetMaterial, SetProduct, ShowEmbeddedMenu, ShowOverlayInterface, SetEnvironmentMaterial, Communicator, ConfiguratorEnvelope } from '@3dsource/metabox-front-api';
15
15
  ```
16
16
 
17
17
  **OR** work with direct import from `NPM` using `CDN` network `unpkg.com` or `jsdelivr.net` (you can also download package and use it locally):
18
18
 
19
19
  ```javascript
20
- import { FromMetaBoxApiAction, GetFastRender, GetPdf, integrateMetaBox, saveImage, SetEnvironment, SetMaterial, SetProduct, ShowEmbeddedMenu, ShowOverlayInterface, SetEnvironmentMaterial, Communicator, ConfiguratorEnvelope } from 'https://cdn.jsdelivr.net/npm/@3dsource/metabox-front-api@1.2.0';
20
+ import { FromMetaboxApiAction, GetFastRender, GetPdf, integrateMetaBox, saveImage, SetEnvironment, SetMaterial, SetProduct, ShowEmbeddedMenu, ShowOverlayInterface, SetEnvironmentMaterial, Communicator, ConfiguratorEnvelope } from 'https://cdn.jsdelivr.net/npm/@3dsource/metabox-front-api@1.2.1';
21
21
  ```
22
22
 
23
23
  ## Usage
24
24
 
25
25
  ### 1. Create HTML Structure
26
26
 
27
- Ensure your HTML page has the following structure, where the MetaBox Configurator will be integrated.
27
+ Ensure your HTML page has the following structure, where the Metabox Configurator will be integrated.
28
28
  You **MUST** control CSS style of `embed3DSource` element to make the configurator responsive and fit your needs on your own.
29
29
 
30
30
  ```html
31
-
32
31
  <div id="embed3DSource">
33
32
  <!-- Your Configurator iframe will be embedded here -->
34
33
  </div>
@@ -36,7 +35,7 @@ You **MUST** control CSS style of `embed3DSource` element to make the configurat
36
35
 
37
36
  ### 2. Include Required Scripts
38
37
 
39
- Below is an example demonstrating how to use the MetaBox API functions:
38
+ Below is an example demonstrating how to use the Metabox API functions:
40
39
 
41
40
  Insert this code into your HTML file just before the closing `</body>` tag:
42
41
 
@@ -45,9 +44,8 @@ Insert this code into your HTML file just before the closing `</body>` tag:
45
44
  HTML:
46
45
 
47
46
  ```html
48
-
49
47
  <script type="module">
50
- import { integrateMetaBox, SetEnvironment, ShowOverlayInterface, SetEnvironmentMaterial, SetMaterial, SetProduct, ShowEmbeddedMenu, GetFastRender, GetPdf, saveImage, Communicator, FromMetaboxApiAction } from 'https://cdn.jsdelivr.net/npm/@3dsource/metabox-front-api@1.2.0';
48
+ import { integrateMetaBox, SetEnvironment, ShowOverlayInterface, SetEnvironmentMaterial, SetMaterial, SetProduct, ShowEmbeddedMenu, GetFastRender, GetPdf, saveImage, Communicator, FromMetaboxApiAction } from 'https://cdn.jsdelivr.net/npm/@3dsource/metabox-front-api@1.2.1';
51
49
 
52
50
  class JsIntegrator {
53
51
  constructor() {
@@ -72,8 +70,8 @@ HTML:
72
70
  setupInitialState(api) {
73
71
  api.sendCommandToMetaBox(new SetProduct('productId'));
74
72
  api.sendCommandToMetaBox(new SetEnvironment('environmentId'));
75
- api.sendCommandToMetaBox(new SetMaterial('productId', 'slotId', 'materialId'));
76
- api.sendCommandToMetaBox(new SetEnvironmentMaterial('productId', 'slotId', 'materialId'));
73
+ api.sendCommandToMetaBox(new SetMaterial('slotId', 'materialId'));
74
+ api.sendCommandToMetaBox(new SetEnvironmentMaterial('slotId', 'materialId'));
77
75
  api.sendCommandToMetaBox(new ShowEmbeddedMenu(false));
78
76
  api.sendCommandToMetaBox(new ShowOverlayInterface(false));
79
77
  api.sendCommandToMetaBox(new GetPdf());
@@ -113,8 +111,8 @@ class TsIntegrator {
113
111
  setupInitialState(api: Communicator) {
114
112
  api.sendCommandToMetaBox(new SetProduct('productId'));
115
113
  api.sendCommandToMetaBox(new SetEnvironment('environmentId'));
116
- api.sendCommandToMetaBox(new SetMaterial('productId', 'slotId', 'materialId'));
117
- api.sendCommandToMetaBox(new SetEnvironmentMaterial('productId', 'slotId', 'materialId'));
114
+ api.sendCommandToMetaBox(new SetMaterial('slotId', 'materialId'));
115
+ api.sendCommandToMetaBox(new SetEnvironmentMaterial('slotId', 'materialId'));
118
116
  api.sendCommandToMetaBox(new ShowEmbeddedMenu(false));
119
117
  api.sendCommandToMetaBox(new ShowOverlayInterface(false));
120
118
  api.sendCommandToMetaBox(new GetPdf());
@@ -129,7 +127,7 @@ new TsIntegrator();
129
127
 
130
128
  #### `integrateMetaBox`
131
129
 
132
- - **Description**: Integrates the MetaBox configurator into the specified container.
130
+ - **Description**: Integrates the Metabox configurator into the specified container.
133
131
  - **Usage**:
134
132
 
135
133
  ```typescript
@@ -151,7 +149,7 @@ new TsIntegrator();
151
149
  - **Usage**:
152
150
 
153
151
  ```typescript
154
- api.sendCommandToMetaBox(new SetMaterial(productId: string, slotId: string, materialId: string));
152
+ api.sendCommandToMetaBox(new SetMaterial(slotId: string, materialId: string));
155
153
  ```
156
154
 
157
155
  #### `SetEnvironmentMaterial`
@@ -160,7 +158,7 @@ new TsIntegrator();
160
158
  - **Usage**:
161
159
 
162
160
  ```typescript
163
- api.sendCommandToMetaBox(new SetEnvironmentMaterial(productId: string, slotId: string, materialId: string));
161
+ api.sendCommandToMetaBox(new SetEnvironmentMaterial(slotId: string, materialId: string));
164
162
  ```
165
163
 
166
164
  #### `SetProduct`
@@ -174,7 +172,7 @@ new TsIntegrator();
174
172
 
175
173
  #### `ShowEmbeddedMenu`
176
174
 
177
- - **Description**: Toggles the embedded menu in the MetaBox configurator.
175
+ - **Description**: Toggles the embedded menu in the Metabox configurator.
178
176
  - **Usage**:
179
177
 
180
178
  ```typescript