@3dsource/metabox-front-api 0.0.17 → 0.0.18
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 +202 -202
- package/dist/index.esm.js +9 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +9 -8
- package/dist/index.umd.js.map +1 -1
- package/dist/interfaces/FromMetaboxMessagePayloads.d.ts +11 -11
- package/dist/interfaces/ToMetaboxMessagePayloads.d.ts +4 -2
- package/dist/interfaces/application-device-types.d.ts +1 -1
- package/package.json +48 -48
package/README.md
CHANGED
|
@@ -1,202 +1,202 @@
|
|
|
1
|
-
# MetaBox Basic Configurators API
|
|
2
|
-
|
|
3
|
-
This package provides an API for interacting with the MetaBox Basic Configurator using plain JavaScript.
|
|
4
|
-
|
|
5
|
-
### Installation (for using with frameworks like Angular, React, etc.) This is recommended method
|
|
6
|
-
|
|
7
|
-
```sh
|
|
8
|
-
npm install @3dsource/metabox-front-api --save
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
then
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
import { FromMetaBoxApiAction, GetFastRender, GetPdf, integrateMetaBox, saveImage, SetEnvironment, SetMaterial, SetProduct, ShowEmbeddedMenu,... } from '@3dsource/metabox-front-api';
|
|
15
|
-
```
|
|
16
|
-
|
|
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
|
-
|
|
19
|
-
```javascript
|
|
20
|
-
import { FromMetaBoxApiAction, GetFastRender, GetPdf, integrateMetaBox, saveImage, SetEnvironment, SetMaterial, SetProduct, ShowEmbeddedMenu,... } from 'https://cdn.jsdelivr.net/npm/@3dsource/metabox-front-api@latest';
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
**We strongly recommend using the first option with npm and locking it to the latest version at the time of integration, as the second option can change rapidly and may cause unexpected behavior in your existing code.**
|
|
24
|
-
|
|
25
|
-
## Usage
|
|
26
|
-
|
|
27
|
-
### 1. Create HTML Structure
|
|
28
|
-
|
|
29
|
-
Ensure your HTML page has the following structure, where the MetaBox Configurator will be integrated.
|
|
30
|
-
You **MUST** control CSS style of `embed3DSource` element to make the configurator responsive and fit your needs on your own.
|
|
31
|
-
|
|
32
|
-
```html
|
|
33
|
-
<div id="embed3DSource">
|
|
34
|
-
<!-- Your Configurator iframe will be embedded here -->
|
|
35
|
-
</div>
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### 2. Include Required Scripts
|
|
39
|
-
|
|
40
|
-
Below is an example demonstrating how to use the MetaBox API functions:
|
|
41
|
-
|
|
42
|
-
Insert this code into your HTML file just before the closing `</body>` tag:
|
|
43
|
-
|
|
44
|
-
**EXAMPLE:**
|
|
45
|
-
|
|
46
|
-
```html
|
|
47
|
-
<script type="module">
|
|
48
|
-
import { integrateMetaBox, SetEnvironment, ShowOverlayInterface, SetEnvironmentMaterial, SetMaterial, SetProduct, ShowEmbeddedMenu, GetFastRender, GetPdf, saveImage, FromMetaboxApiAction } from 'https://cdn.jsdelivr.net/npm/@3dsource/metabox-front-api@latest';
|
|
49
|
-
// Expose API
|
|
50
|
-
window.env3DSource = { ...window.env3DSource };
|
|
51
|
-
window.env3DSource.apiReady = (api) => {
|
|
52
|
-
api.addEventListener('metaboxData', (data) => {
|
|
53
|
-
const { action, payload, eventType } = data;
|
|
54
|
-
if (action !== FromMetaboxApiAction.bridge) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (eventType === 'basicConfiguratorDataWithState') {
|
|
59
|
-
updateConfiguratorData(data);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (eventType === 'fastRender') {
|
|
63
|
-
//Catches the render image
|
|
64
|
-
saveImage(payload, 'Render.png');
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
setupInitialState();
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* @see examples, @see documentation
|
|
72
|
-
* @param data
|
|
73
|
-
*/
|
|
74
|
-
function updateConfiguratorData(data) {
|
|
75
|
-
//Use data on your own
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Setup initial state,
|
|
80
|
-
* Executes additional commands as example
|
|
81
|
-
*/
|
|
82
|
-
function setupInitialState() {
|
|
83
|
-
// All commands can be used at any time from the moment api is ready and will be buffered automatically
|
|
84
|
-
// i.e. GetFastRender and GetPdf will be executed when the viewport is ready
|
|
85
|
-
|
|
86
|
-
// Set product
|
|
87
|
-
new SetProduct('productId');
|
|
88
|
-
|
|
89
|
-
// Set environment
|
|
90
|
-
new SetEnvironment('environmentId');
|
|
91
|
-
|
|
92
|
-
// Set material
|
|
93
|
-
new SetMaterial('productId', 'slotId', 'materialId');
|
|
94
|
-
|
|
95
|
-
// Set environment material
|
|
96
|
-
new SetEnvironmentMaterial('productId', 'slotId', 'materialId');
|
|
97
|
-
|
|
98
|
-
// Toggle embedded menu
|
|
99
|
-
new ShowEmbeddedMenu(false);
|
|
100
|
-
|
|
101
|
-
// Toggle overlay interface
|
|
102
|
-
new ShowOverlayInterface(false);
|
|
103
|
-
|
|
104
|
-
//Request Pdf, Will execute as stream is ready, will be auto-downloaded
|
|
105
|
-
new GetPdf();
|
|
106
|
-
|
|
107
|
-
//Request Fast Render, Will execute as stream is ready, will be sent back as a callback
|
|
108
|
-
new GetFastRender('image/png', { x: 1024, y: 1024 });
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Integrate the 3D configurator into your page
|
|
112
|
-
/**
|
|
113
|
-
* Additional url parameters:
|
|
114
|
-
* @see integrateMetaBox
|
|
115
|
-
* @type {string}
|
|
116
|
-
*/
|
|
117
|
-
const url = 'https://metabox.3dsource.com/metabox-configurator/basic/your-configurator-id?sidebar=false';
|
|
118
|
-
integrateMetaBox(url, 'embed3DSource');
|
|
119
|
-
</script>
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### Documentation for current example
|
|
123
|
-
|
|
124
|
-
### `integrateMetaBox`
|
|
125
|
-
|
|
126
|
-
- **Description**: Integrates the MetaBox configurator into the specified container.
|
|
127
|
-
- **Usage**:
|
|
128
|
-
```typescript
|
|
129
|
-
integrateMetaBox(configuratorUrl: string, containerId: string): void;
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### `SetEnvironment`
|
|
133
|
-
|
|
134
|
-
- **Description**: Sets the environment by ID.
|
|
135
|
-
- **Constructor**:
|
|
136
|
-
```typescript
|
|
137
|
-
new SetEnvironment(environmentId: string);
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### `SetMaterial`
|
|
141
|
-
|
|
142
|
-
- **Description**: Sets the material for a given product slot.
|
|
143
|
-
- **Constructor**:
|
|
144
|
-
```typescript
|
|
145
|
-
new SetMaterial(productId: string, slotId: string, materialId: string);
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
### `SetEnvironmentMaterial`
|
|
149
|
-
|
|
150
|
-
- **Description**: Sets the material for a given environment slot.
|
|
151
|
-
- **Constructor**:
|
|
152
|
-
```typescript
|
|
153
|
-
new SetEnvironmentMaterial(productId: string, slotId: string, materialId: string);
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
### `SetProduct`
|
|
157
|
-
|
|
158
|
-
- **Description**: Sets the product by ID.
|
|
159
|
-
- **Constructor**:
|
|
160
|
-
```typescript
|
|
161
|
-
new SetProduct(productId: string);
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
### `ShowEmbeddedMenu`
|
|
165
|
-
|
|
166
|
-
- **Description**: Toggles the embedded menu in the MetaBox configurator.
|
|
167
|
-
- **Constructor**:
|
|
168
|
-
```typescript
|
|
169
|
-
new ShowEmbeddedMenu(visible: boolean);
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### `ShowOverlayInterface`
|
|
173
|
-
|
|
174
|
-
- **Description**: Toggles the overlay interface over Unreal viewport.
|
|
175
|
-
- **Constructor**:
|
|
176
|
-
```typescript
|
|
177
|
-
new ShowOverlayInterface(visible: boolean);
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
### `GetFastRender`
|
|
181
|
-
|
|
182
|
-
- **Description**: Retrieves a fast render of the current view.
|
|
183
|
-
- **Usage**:
|
|
184
|
-
```typescript
|
|
185
|
-
new GetFastRender(mimeType: string, size?: { x: number, y: number });
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
### `GetPdf`
|
|
189
|
-
|
|
190
|
-
- **Description**: Generates a PDF of the current view.
|
|
191
|
-
- **Usage**:
|
|
192
|
-
```typescript
|
|
193
|
-
new GetPdf();
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
### `saveImage`
|
|
197
|
-
|
|
198
|
-
- **Description**: Saves the arrived rendered image to a file using utility function.
|
|
199
|
-
- **Usage**:
|
|
200
|
-
```typescript
|
|
201
|
-
saveImage(renderData: string, fileName: string): void;
|
|
202
|
-
```
|
|
1
|
+
# MetaBox Basic Configurators API
|
|
2
|
+
|
|
3
|
+
This package provides an API for interacting with the MetaBox Basic Configurator using plain JavaScript.
|
|
4
|
+
|
|
5
|
+
### Installation (for using with frameworks like Angular, React, etc.) This is recommended method
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @3dsource/metabox-front-api --save
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
then
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { FromMetaBoxApiAction, GetFastRender, GetPdf, integrateMetaBox, saveImage, SetEnvironment, SetMaterial, SetProduct, ShowEmbeddedMenu,... } from '@3dsource/metabox-front-api';
|
|
15
|
+
```
|
|
16
|
+
|
|
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
|
+
|
|
19
|
+
```javascript
|
|
20
|
+
import { FromMetaBoxApiAction, GetFastRender, GetPdf, integrateMetaBox, saveImage, SetEnvironment, SetMaterial, SetProduct, ShowEmbeddedMenu,... } from 'https://cdn.jsdelivr.net/npm/@3dsource/metabox-front-api@latest';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**We strongly recommend using the first option with npm and locking it to the latest version at the time of integration, as the second option can change rapidly and may cause unexpected behavior in your existing code.**
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
### 1. Create HTML Structure
|
|
28
|
+
|
|
29
|
+
Ensure your HTML page has the following structure, where the MetaBox Configurator will be integrated.
|
|
30
|
+
You **MUST** control CSS style of `embed3DSource` element to make the configurator responsive and fit your needs on your own.
|
|
31
|
+
|
|
32
|
+
```html
|
|
33
|
+
<div id="embed3DSource">
|
|
34
|
+
<!-- Your Configurator iframe will be embedded here -->
|
|
35
|
+
</div>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 2. Include Required Scripts
|
|
39
|
+
|
|
40
|
+
Below is an example demonstrating how to use the MetaBox API functions:
|
|
41
|
+
|
|
42
|
+
Insert this code into your HTML file just before the closing `</body>` tag:
|
|
43
|
+
|
|
44
|
+
**EXAMPLE:**
|
|
45
|
+
|
|
46
|
+
```html
|
|
47
|
+
<script type="module">
|
|
48
|
+
import { integrateMetaBox, SetEnvironment, ShowOverlayInterface, SetEnvironmentMaterial, SetMaterial, SetProduct, ShowEmbeddedMenu, GetFastRender, GetPdf, saveImage, FromMetaboxApiAction } from 'https://cdn.jsdelivr.net/npm/@3dsource/metabox-front-api@latest';
|
|
49
|
+
// Expose API
|
|
50
|
+
window.env3DSource = { ...window.env3DSource };
|
|
51
|
+
window.env3DSource.apiReady = (api) => {
|
|
52
|
+
api.addEventListener('metaboxData', (data) => {
|
|
53
|
+
const { action, payload, eventType } = data;
|
|
54
|
+
if (action !== FromMetaboxApiAction.bridge) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (eventType === 'basicConfiguratorDataWithState') {
|
|
59
|
+
updateConfiguratorData(data);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (eventType === 'fastRender') {
|
|
63
|
+
//Catches the render image
|
|
64
|
+
saveImage(payload, 'Render.png');
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
setupInitialState();
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @see examples, @see documentation
|
|
72
|
+
* @param data
|
|
73
|
+
*/
|
|
74
|
+
function updateConfiguratorData(data) {
|
|
75
|
+
//Use data on your own
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Setup initial state,
|
|
80
|
+
* Executes additional commands as example
|
|
81
|
+
*/
|
|
82
|
+
function setupInitialState() {
|
|
83
|
+
// All commands can be used at any time from the moment api is ready and will be buffered automatically
|
|
84
|
+
// i.e. GetFastRender and GetPdf will be executed when the viewport is ready
|
|
85
|
+
|
|
86
|
+
// Set product
|
|
87
|
+
new SetProduct('productId');
|
|
88
|
+
|
|
89
|
+
// Set environment
|
|
90
|
+
new SetEnvironment('environmentId');
|
|
91
|
+
|
|
92
|
+
// Set material
|
|
93
|
+
new SetMaterial('productId', 'slotId', 'materialId');
|
|
94
|
+
|
|
95
|
+
// Set environment material
|
|
96
|
+
new SetEnvironmentMaterial('productId', 'slotId', 'materialId');
|
|
97
|
+
|
|
98
|
+
// Toggle embedded menu
|
|
99
|
+
new ShowEmbeddedMenu(false);
|
|
100
|
+
|
|
101
|
+
// Toggle overlay interface
|
|
102
|
+
new ShowOverlayInterface(false);
|
|
103
|
+
|
|
104
|
+
//Request Pdf, Will execute as stream is ready, will be auto-downloaded
|
|
105
|
+
new GetPdf();
|
|
106
|
+
|
|
107
|
+
//Request Fast Render, Will execute as stream is ready, will be sent back as a callback
|
|
108
|
+
new GetFastRender('image/png', { x: 1024, y: 1024 });
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Integrate the 3D configurator into your page
|
|
112
|
+
/**
|
|
113
|
+
* Additional url parameters:
|
|
114
|
+
* @see integrateMetaBox
|
|
115
|
+
* @type {string}
|
|
116
|
+
*/
|
|
117
|
+
const url = 'https://metabox.3dsource.com/metabox-configurator/basic/your-configurator-id?sidebar=false';
|
|
118
|
+
integrateMetaBox(url, 'embed3DSource');
|
|
119
|
+
</script>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Documentation for current example
|
|
123
|
+
|
|
124
|
+
### `integrateMetaBox`
|
|
125
|
+
|
|
126
|
+
- **Description**: Integrates the MetaBox configurator into the specified container.
|
|
127
|
+
- **Usage**:
|
|
128
|
+
```typescript
|
|
129
|
+
integrateMetaBox(configuratorUrl: string, containerId: string): void;
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### `SetEnvironment`
|
|
133
|
+
|
|
134
|
+
- **Description**: Sets the environment by ID.
|
|
135
|
+
- **Constructor**:
|
|
136
|
+
```typescript
|
|
137
|
+
new SetEnvironment(environmentId: string);
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### `SetMaterial`
|
|
141
|
+
|
|
142
|
+
- **Description**: Sets the material for a given product slot.
|
|
143
|
+
- **Constructor**:
|
|
144
|
+
```typescript
|
|
145
|
+
new SetMaterial(productId: string, slotId: string, materialId: string);
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### `SetEnvironmentMaterial`
|
|
149
|
+
|
|
150
|
+
- **Description**: Sets the material for a given environment slot.
|
|
151
|
+
- **Constructor**:
|
|
152
|
+
```typescript
|
|
153
|
+
new SetEnvironmentMaterial(productId: string, slotId: string, materialId: string);
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### `SetProduct`
|
|
157
|
+
|
|
158
|
+
- **Description**: Sets the product by ID.
|
|
159
|
+
- **Constructor**:
|
|
160
|
+
```typescript
|
|
161
|
+
new SetProduct(productId: string);
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### `ShowEmbeddedMenu`
|
|
165
|
+
|
|
166
|
+
- **Description**: Toggles the embedded menu in the MetaBox configurator.
|
|
167
|
+
- **Constructor**:
|
|
168
|
+
```typescript
|
|
169
|
+
new ShowEmbeddedMenu(visible: boolean);
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### `ShowOverlayInterface`
|
|
173
|
+
|
|
174
|
+
- **Description**: Toggles the overlay interface over Unreal viewport.
|
|
175
|
+
- **Constructor**:
|
|
176
|
+
```typescript
|
|
177
|
+
new ShowOverlayInterface(visible: boolean);
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### `GetFastRender`
|
|
181
|
+
|
|
182
|
+
- **Description**: Retrieves a fast render of the current view.
|
|
183
|
+
- **Usage**:
|
|
184
|
+
```typescript
|
|
185
|
+
new GetFastRender(mimeType: string, size?: { x: number, y: number });
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### `GetPdf`
|
|
189
|
+
|
|
190
|
+
- **Description**: Generates a PDF of the current view.
|
|
191
|
+
- **Usage**:
|
|
192
|
+
```typescript
|
|
193
|
+
new GetPdf();
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### `saveImage`
|
|
197
|
+
|
|
198
|
+
- **Description**: Saves the arrived rendered image to a file using utility function.
|
|
199
|
+
- **Usage**:
|
|
200
|
+
```typescript
|
|
201
|
+
saveImage(renderData: string, fileName: string): void;
|
|
202
|
+
```
|
package/dist/index.esm.js
CHANGED
|
@@ -44,6 +44,7 @@ const ToMetaBoxApiAction = {
|
|
|
44
44
|
sendCommandToUnreal: 'sendCommandToUnreal',
|
|
45
45
|
showOverlayInterface: 'showOverlayInterface',
|
|
46
46
|
setEnvironmentMaterialById: 'setEnvironmentMaterialById',
|
|
47
|
+
resetCamera: 'resetCamera',
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
/**
|
|
@@ -534,13 +535,13 @@ function integrateMetaBox(iframeSrc, containerId = 'embed3DSource') {
|
|
|
534
535
|
}
|
|
535
536
|
Communicator.createInstance();
|
|
536
537
|
const style = document.createElement('style');
|
|
537
|
-
style.innerHTML = `
|
|
538
|
-
#${containerId} {
|
|
539
|
-
width: 100%;
|
|
540
|
-
height: 100%;
|
|
541
|
-
overflow: hidden;
|
|
542
|
-
position: relative;
|
|
543
|
-
}
|
|
538
|
+
style.innerHTML = `
|
|
539
|
+
#${containerId} {
|
|
540
|
+
width: 100%;
|
|
541
|
+
height: 100%;
|
|
542
|
+
overflow: hidden;
|
|
543
|
+
position: relative;
|
|
544
|
+
}
|
|
544
545
|
`;
|
|
545
546
|
document.head.appendChild(style);
|
|
546
547
|
const iframe = document.createElement('iframe');
|
|
@@ -664,7 +665,7 @@ const FromMetaboxApiAction = {
|
|
|
664
665
|
videoSize: 'videoSize',
|
|
665
666
|
/**
|
|
666
667
|
* @hidden
|
|
667
|
-
* Used in platform, must be removed in future
|
|
668
|
+
* Used in a platform, must be removed in future
|
|
668
669
|
* @deprecated
|
|
669
670
|
*/
|
|
670
671
|
unrealResponse: 'unrealResponse',
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.umd.js
CHANGED
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
sendCommandToUnreal: 'sendCommandToUnreal',
|
|
51
51
|
showOverlayInterface: 'showOverlayInterface',
|
|
52
52
|
setEnvironmentMaterialById: 'setEnvironmentMaterialById',
|
|
53
|
+
resetCamera: 'resetCamera',
|
|
53
54
|
};
|
|
54
55
|
|
|
55
56
|
/**
|
|
@@ -540,13 +541,13 @@
|
|
|
540
541
|
}
|
|
541
542
|
Communicator.createInstance();
|
|
542
543
|
const style = document.createElement('style');
|
|
543
|
-
style.innerHTML = `
|
|
544
|
-
#${containerId} {
|
|
545
|
-
width: 100%;
|
|
546
|
-
height: 100%;
|
|
547
|
-
overflow: hidden;
|
|
548
|
-
position: relative;
|
|
549
|
-
}
|
|
544
|
+
style.innerHTML = `
|
|
545
|
+
#${containerId} {
|
|
546
|
+
width: 100%;
|
|
547
|
+
height: 100%;
|
|
548
|
+
overflow: hidden;
|
|
549
|
+
position: relative;
|
|
550
|
+
}
|
|
550
551
|
`;
|
|
551
552
|
document.head.appendChild(style);
|
|
552
553
|
const iframe = document.createElement('iframe');
|
|
@@ -670,7 +671,7 @@
|
|
|
670
671
|
videoSize: 'videoSize',
|
|
671
672
|
/**
|
|
672
673
|
* @hidden
|
|
673
|
-
* Used in platform, must be removed in future
|
|
674
|
+
* Used in a platform, must be removed in future
|
|
674
675
|
* @deprecated
|
|
675
676
|
*/
|
|
676
677
|
unrealResponse: 'unrealResponse',
|
package/dist/index.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -44,7 +44,7 @@ export declare const FromMetaboxApiAction: {
|
|
|
44
44
|
readonly videoSize: "videoSize";
|
|
45
45
|
/**
|
|
46
46
|
* @hidden
|
|
47
|
-
* Used in platform, must be removed in future
|
|
47
|
+
* Used in a platform, must be removed in future
|
|
48
48
|
* @deprecated
|
|
49
49
|
*/
|
|
50
50
|
readonly unrealResponse: "unrealResponse";
|
|
@@ -68,29 +68,29 @@ export interface MCAppLoaded {
|
|
|
68
68
|
export interface FromMetaboxMessagePayloads {
|
|
69
69
|
/**
|
|
70
70
|
* Dispatches Every time the configurator data is updated.
|
|
71
|
-
* I.e
|
|
71
|
+
* I.e., when the user changes the configuration. (Material, Product, Environment)
|
|
72
72
|
*/
|
|
73
73
|
basicConfiguratorDataWithState: ConfiguratorEnvelope;
|
|
74
74
|
/**
|
|
75
|
-
* Dispatches Every time when configurator connected/disconnected with Unreal Engine.
|
|
75
|
+
* Dispatches Every time when the configurator connected/disconnected with Unreal Engine.
|
|
76
76
|
*/
|
|
77
77
|
dataChannelConnected: boolean;
|
|
78
78
|
/**
|
|
79
|
-
* Dispatches Every time when Unreal Viewport is visible/hidden.
|
|
79
|
+
* Dispatches Every time when the Unreal Viewport is visible/hidden.
|
|
80
80
|
*/
|
|
81
81
|
viewportReady: boolean;
|
|
82
82
|
/**
|
|
83
|
-
* Dispatches Every when user
|
|
83
|
+
* Dispatches Every when user toggles fullscreen button in an internal menu.
|
|
84
84
|
*/
|
|
85
85
|
isFullScreen: boolean;
|
|
86
86
|
/**
|
|
87
|
-
* Dispatches at the moment while configurator loads. Shows status information.
|
|
87
|
+
* Dispatches at the moment while the configurator loads. Shows status information.
|
|
88
88
|
*/
|
|
89
89
|
statusMessage: string | null;
|
|
90
90
|
/**
|
|
91
91
|
* @internal
|
|
92
92
|
* @hidden
|
|
93
|
-
* Dispatches every time when freeze-frame is arrived or updated.
|
|
93
|
+
* Dispatches every time when the freeze-frame is arrived or updated.
|
|
94
94
|
*/
|
|
95
95
|
freezeFrame: {
|
|
96
96
|
dataUrl: string | null;
|
|
@@ -98,8 +98,8 @@ export interface FromMetaboxMessagePayloads {
|
|
|
98
98
|
};
|
|
99
99
|
/**
|
|
100
100
|
* @experimental
|
|
101
|
-
* Dispatches every Unreal is sending command callback.
|
|
102
|
-
* Works only after new WatchCallbacks() command is sent.
|
|
101
|
+
* Dispatches every Unreal is sending a command callback.
|
|
102
|
+
* Works only after the new WatchCallbacks () command is sent.
|
|
103
103
|
*/
|
|
104
104
|
unrealCallback: object;
|
|
105
105
|
/**
|
|
@@ -121,13 +121,13 @@ export interface FromMetaboxMessagePayloads {
|
|
|
121
121
|
*/
|
|
122
122
|
streamResolution: {
|
|
123
123
|
width: number;
|
|
124
|
-
|
|
124
|
+
height: number;
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
export type FromMetaBoxApiEvents = keyof FromMetaboxMessagePayloads;
|
|
128
128
|
/**
|
|
129
129
|
* @internal
|
|
130
|
-
* This creates
|
|
130
|
+
* This creates all event envelopes defined in MetaBoxAPIPayloads.
|
|
131
131
|
*/
|
|
132
132
|
export interface MetaBoxApiEnvelope<T extends FromMetaBoxApiEvents> {
|
|
133
133
|
action: 'bridge';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MimeType } from '../actions/GetFastRender';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ApplicationDeviceTypesKeys } from './application-device-types';
|
|
3
3
|
export declare const ToMetaBoxApiAction: {
|
|
4
4
|
readonly getPdf: "getPdf";
|
|
5
5
|
readonly loadLevel: "loadLevel";
|
|
@@ -18,6 +18,7 @@ export declare const ToMetaBoxApiAction: {
|
|
|
18
18
|
readonly sendCommandToUnreal: "sendCommandToUnreal";
|
|
19
19
|
readonly showOverlayInterface: "showOverlayInterface";
|
|
20
20
|
readonly setEnvironmentMaterialById: "setEnvironmentMaterialById";
|
|
21
|
+
readonly resetCamera: "resetCamera";
|
|
21
22
|
};
|
|
22
23
|
export type ToMetaBoxActions = (typeof ToMetaBoxApiAction)[keyof typeof ToMetaBoxApiAction];
|
|
23
24
|
/**
|
|
@@ -63,8 +64,9 @@ export interface ToMetaboxMessagePayloads {
|
|
|
63
64
|
visible: boolean;
|
|
64
65
|
};
|
|
65
66
|
forceSetDeviceType: {
|
|
66
|
-
deviceType:
|
|
67
|
+
deviceType: ApplicationDeviceTypesKeys;
|
|
67
68
|
};
|
|
69
|
+
resetCamera: void;
|
|
68
70
|
}
|
|
69
71
|
export interface ToMetaBoxMessageEnvelope {
|
|
70
72
|
action: ToMetaBoxActions;
|
|
@@ -7,4 +7,4 @@ export declare const APPLICATION_DEVICE_TYPES: {
|
|
|
7
7
|
* @internal
|
|
8
8
|
* Represents the type of device for the application.
|
|
9
9
|
*/
|
|
10
|
-
export type
|
|
10
|
+
export type ApplicationDeviceTypesKeys = (typeof APPLICATION_DEVICE_TYPES)[keyof typeof APPLICATION_DEVICE_TYPES];
|
package/package.json
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@3dsource/metabox-front-api",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "API for MetaBox BASIC configurator",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"metabox",
|
|
7
|
-
"api",
|
|
8
|
-
"configurator"
|
|
9
|
-
],
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
"dist
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@3dsource/metabox-front-api",
|
|
3
|
+
"version": "0.0.18",
|
|
4
|
+
"description": "API for MetaBox BASIC configurator",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"metabox",
|
|
7
|
+
"api",
|
|
8
|
+
"configurator"
|
|
9
|
+
],
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git@bitbucket.org:dreamsoft/ams_vps-frontend.git"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"author": "3dsource.com",
|
|
16
|
+
"type": "module",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"require": "./dist/index.umd.js",
|
|
21
|
+
"import": "./dist/index.esm.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"main": "dist/index.umd.js",
|
|
25
|
+
"jsdelivr": "dist/index.esm.js",
|
|
26
|
+
"unpkg": "dist/index.esm.js",
|
|
27
|
+
"module": "dist/index.esm.js",
|
|
28
|
+
"types": "dist/index.d.ts",
|
|
29
|
+
"files": [
|
|
30
|
+
"dist/**/*"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"apiDoc": "typedoc --entryPointStrategy Expand src/index.ts --tsconfig ./../../../tsconfig.typedoc.json --out ./../../../dist/browser/apiDocBasic",
|
|
34
|
+
"build": "rollup -c",
|
|
35
|
+
"clean": "rimraf dist",
|
|
36
|
+
"packAll": "npm run clean && npm run build && npm pack",
|
|
37
|
+
"publishApi": "npm run packAll && npm publish --access public"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"rimraf": "^3.0.2",
|
|
41
|
+
"rollup": "^4.39.0",
|
|
42
|
+
"rollup-plugin-typescript2": "^0.36.0",
|
|
43
|
+
"typescript": "~5.7.3"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
}
|
|
48
|
+
}
|