@3dsource/metabox-front-api 1.2.1-dev.4 → 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 +16 -16
- package/fesm2022/3dsource-metabox-front-api.mjs +301 -138
- package/fesm2022/3dsource-metabox-front-api.mjs.map +1 -1
- package/index.d.ts +576 -404
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Metabox Basic Configurators API
|
|
2
2
|
|
|
3
|
-
This package provides an API for interacting with the
|
|
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.
|
|
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 {
|
|
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 {
|
|
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
|
|
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
|
|
@@ -35,7 +35,7 @@ You **MUST** control CSS style of `embed3DSource` element to make the configurat
|
|
|
35
35
|
|
|
36
36
|
### 2. Include Required Scripts
|
|
37
37
|
|
|
38
|
-
Below is an example demonstrating how to use the
|
|
38
|
+
Below is an example demonstrating how to use the Metabox API functions:
|
|
39
39
|
|
|
40
40
|
Insert this code into your HTML file just before the closing `</body>` tag:
|
|
41
41
|
|
|
@@ -45,7 +45,7 @@ HTML:
|
|
|
45
45
|
|
|
46
46
|
```html
|
|
47
47
|
<script type="module">
|
|
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.
|
|
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';
|
|
49
49
|
|
|
50
50
|
class JsIntegrator {
|
|
51
51
|
constructor() {
|
|
@@ -70,8 +70,8 @@ HTML:
|
|
|
70
70
|
setupInitialState(api) {
|
|
71
71
|
api.sendCommandToMetaBox(new SetProduct('productId'));
|
|
72
72
|
api.sendCommandToMetaBox(new SetEnvironment('environmentId'));
|
|
73
|
-
api.sendCommandToMetaBox(new SetMaterial('
|
|
74
|
-
api.sendCommandToMetaBox(new SetEnvironmentMaterial('
|
|
73
|
+
api.sendCommandToMetaBox(new SetMaterial('slotId', 'materialId'));
|
|
74
|
+
api.sendCommandToMetaBox(new SetEnvironmentMaterial('slotId', 'materialId'));
|
|
75
75
|
api.sendCommandToMetaBox(new ShowEmbeddedMenu(false));
|
|
76
76
|
api.sendCommandToMetaBox(new ShowOverlayInterface(false));
|
|
77
77
|
api.sendCommandToMetaBox(new GetPdf());
|
|
@@ -111,8 +111,8 @@ class TsIntegrator {
|
|
|
111
111
|
setupInitialState(api: Communicator) {
|
|
112
112
|
api.sendCommandToMetaBox(new SetProduct('productId'));
|
|
113
113
|
api.sendCommandToMetaBox(new SetEnvironment('environmentId'));
|
|
114
|
-
api.sendCommandToMetaBox(new SetMaterial('
|
|
115
|
-
api.sendCommandToMetaBox(new SetEnvironmentMaterial('
|
|
114
|
+
api.sendCommandToMetaBox(new SetMaterial('slotId', 'materialId'));
|
|
115
|
+
api.sendCommandToMetaBox(new SetEnvironmentMaterial('slotId', 'materialId'));
|
|
116
116
|
api.sendCommandToMetaBox(new ShowEmbeddedMenu(false));
|
|
117
117
|
api.sendCommandToMetaBox(new ShowOverlayInterface(false));
|
|
118
118
|
api.sendCommandToMetaBox(new GetPdf());
|
|
@@ -127,7 +127,7 @@ new TsIntegrator();
|
|
|
127
127
|
|
|
128
128
|
#### `integrateMetaBox`
|
|
129
129
|
|
|
130
|
-
- **Description**: Integrates the
|
|
130
|
+
- **Description**: Integrates the Metabox configurator into the specified container.
|
|
131
131
|
- **Usage**:
|
|
132
132
|
|
|
133
133
|
```typescript
|
|
@@ -149,7 +149,7 @@ new TsIntegrator();
|
|
|
149
149
|
- **Usage**:
|
|
150
150
|
|
|
151
151
|
```typescript
|
|
152
|
-
api.sendCommandToMetaBox(new SetMaterial(
|
|
152
|
+
api.sendCommandToMetaBox(new SetMaterial(slotId: string, materialId: string));
|
|
153
153
|
```
|
|
154
154
|
|
|
155
155
|
#### `SetEnvironmentMaterial`
|
|
@@ -158,7 +158,7 @@ new TsIntegrator();
|
|
|
158
158
|
- **Usage**:
|
|
159
159
|
|
|
160
160
|
```typescript
|
|
161
|
-
api.sendCommandToMetaBox(new SetEnvironmentMaterial(
|
|
161
|
+
api.sendCommandToMetaBox(new SetEnvironmentMaterial(slotId: string, materialId: string));
|
|
162
162
|
```
|
|
163
163
|
|
|
164
164
|
#### `SetProduct`
|
|
@@ -172,7 +172,7 @@ new TsIntegrator();
|
|
|
172
172
|
|
|
173
173
|
#### `ShowEmbeddedMenu`
|
|
174
174
|
|
|
175
|
-
- **Description**: Toggles the embedded menu in the
|
|
175
|
+
- **Description**: Toggles the embedded menu in the Metabox configurator.
|
|
176
176
|
- **Usage**:
|
|
177
177
|
|
|
178
178
|
```typescript
|