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

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 (33) hide show
  1. package/README.md +218 -216
  2. package/package.json +44 -56
  3. package/dist/actions/CommandBase.d.ts +0 -7
  4. package/dist/actions/GetFastRender.d.ts +0 -2
  5. package/dist/actions/GetPdf.d.ts +0 -24
  6. package/dist/actions/GetScreenshot.d.ts +0 -34
  7. package/dist/actions/SetEnvironment.d.ts +0 -21
  8. package/dist/actions/SetEnvironmentMaterial.d.ts +0 -24
  9. package/dist/actions/SetMaterial.d.ts +0 -24
  10. package/dist/actions/SetProduct.d.ts +0 -25
  11. package/dist/actions/ShowEmbeddedMenu.d.ts +0 -20
  12. package/dist/actions/ShowOverlayInterface.d.ts +0 -23
  13. package/dist/actions/UnrealCommand.d.ts +0 -14
  14. package/dist/actions/WatchCallbacks.d.ts +0 -18
  15. package/dist/const/FromMetaboxApiAction.d.ts +0 -52
  16. package/dist/index.d.ts +0 -23
  17. package/dist/index.esm.js +0 -580
  18. package/dist/index.esm.js.map +0 -1
  19. package/dist/index.umd.js +0 -604
  20. package/dist/index.umd.js.map +0 -1
  21. package/dist/interfaces/FromMetaboxMessagePayloads.d.ts +0 -116
  22. package/dist/interfaces/ToMetaboxMessagePayloads.d.ts +0 -72
  23. package/dist/interfaces/UniversalConfigurator.d.ts +0 -213
  24. package/dist/interfaces/application-device-types.d.ts +0 -1
  25. package/dist/lib/Communicator.d.ts +0 -57
  26. package/dist/lib/EventDispatcher.d.ts +0 -39
  27. package/dist/lib/UrlUtils.d.ts +0 -18
  28. package/dist/lib/fromCommunicatorEvent.d.ts +0 -9
  29. package/dist/lib/integrateMetaBox.d.ts +0 -31
  30. package/dist/lib/saveImage.d.ts +0 -11
  31. package/dist/lib/sleep.d.ts +0 -10
  32. package/dist/lib/test/Communicator.spec.d.ts +0 -1
  33. package/dist/lib/test/integrateMetabox.spec.d.ts +0 -9
package/README.md CHANGED
@@ -1,216 +1,218 @@
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 the recommended method
6
-
7
- ```sh
8
- npm install @3dsource/metabox-front-api@^1.0.0 --save
9
- ```
10
-
11
- then
12
-
13
- ```typescript
14
- import { FromMetaBoxApiAction, GetFastRender, GetPdf, integrateMetaBox, saveImage, SetEnvironment, SetMaterial, SetProduct, ShowEmbeddedMenu, ShowOverlayInterface, SetEnvironmentMaterial, Communicator, ConfiguratorEnvelope } 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, ShowOverlayInterface, SetEnvironmentMaterial, Communicator, ConfiguratorEnvelope } from 'https://cdn.jsdelivr.net/npm/@3dsource/metabox-front-api@1.0.0';
21
- ```
22
-
23
- ## Usage
24
-
25
- ### 1. Create HTML Structure
26
-
27
- Ensure your HTML page has the following structure, where the MetaBox Configurator will be integrated.
28
- You **MUST** control CSS style of `embed3DSource` element to make the configurator responsive and fit your needs on your own.
29
-
30
- ```html
31
- <div id="embed3DSource">
32
- <!-- Your Configurator iframe will be embedded here -->
33
- </div>
34
- ```
35
-
36
- ### 2. Include Required Scripts
37
-
38
- Below is an example demonstrating how to use the MetaBox API functions:
39
-
40
- Insert this code into your HTML file just before the closing `</body>` tag:
41
-
42
- **EXAMPLE:**
43
-
44
- HTML:
45
-
46
- ```html
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.0.0';
49
-
50
- class JsIntegrator {
51
- constructor() {
52
- const url = 'https://metabox.3dsource.com/metabox-configurator/basic/your-configurator-id?sidebar=false';
53
- integrateMetaBox(url, 'embed3DSource', (api) => this.apiReady(api));
54
- }
55
-
56
- apiReady(api) {
57
- api.addEventListener('basicConfiguratorDataWithState', (data) => {
58
- this.updateConfiguratorData(data);
59
- });
60
- api.addEventListener('fastRender', (data) => {
61
- saveImage(data, 'Render.png');
62
- });
63
- this.setupInitialState(api);
64
- }
65
-
66
- updateConfiguratorData(data) {
67
- // Use data on your own
68
- }
69
-
70
- setupInitialState(api) {
71
- api.sendCommandToMetaBox(new SetProduct('productId'));
72
- api.sendCommandToMetaBox(new SetEnvironment('environmentId'));
73
- api.sendCommandToMetaBox(new SetMaterial('productId', 'slotId', 'materialId'));
74
- api.sendCommandToMetaBox(new SetEnvironmentMaterial('productId', 'slotId', 'materialId'));
75
- api.sendCommandToMetaBox(new ShowEmbeddedMenu(false));
76
- api.sendCommandToMetaBox(new ShowOverlayInterface(false));
77
- api.sendCommandToMetaBox(new GetPdf());
78
- api.sendCommandToMetaBox(new GetFastRender('image/png', { x: 1024, y: 1024 }));
79
- }
80
- }
81
-
82
- new JsIntegrator();
83
- </script>
84
- ```
85
-
86
- TypeScript:
87
-
88
- ```typescript
89
- import { ConfiguratorEnvelope, UniversalConfigurator, integrateMetaBox, SetEnvironment, ShowOverlayInterface, SetEnvironmentMaterial, SetMaterial, SetProduct, ShowEmbeddedMenu, GetFastRender, GetPdf, saveImage, Communicator, FromMetaboxApiAction } from '@3dsource/metabox-front-api';
90
-
91
- class TsIntegrator {
92
- constructor() {
93
- const url = 'https://metabox.3dsource.com/metabox-configurator/basic/your-configurator-id?sidebar=false';
94
- integrateMetaBox(url, 'embed3DSource', (api) => this.apiReady(api));
95
- }
96
-
97
- apiReady(api: Communicator) {
98
- api.addEventListener('basicConfiguratorDataWithState', (data) => {
99
- this.updateConfiguratorData(data);
100
- });
101
- api.addEventListener('fastRender', (data) => {
102
- saveImage(data, 'Render.png');
103
- });
104
- this.setupInitialState(api);
105
- }
106
-
107
- updateConfiguratorData(data: ConfiguratorEnvelope) {
108
- // Use data on your own
109
- }
110
-
111
- setupInitialState(api: Communicator) {
112
- api.sendCommandToMetaBox(new SetProduct('productId'));
113
- api.sendCommandToMetaBox(new SetEnvironment('environmentId'));
114
- api.sendCommandToMetaBox(new SetMaterial('productId', 'slotId', 'materialId'));
115
- api.sendCommandToMetaBox(new SetEnvironmentMaterial('productId', 'slotId', 'materialId'));
116
- api.sendCommandToMetaBox(new ShowEmbeddedMenu(false));
117
- api.sendCommandToMetaBox(new ShowOverlayInterface(false));
118
- api.sendCommandToMetaBox(new GetPdf());
119
- api.sendCommandToMetaBox(new GetFastRender('image/png', { x: 1024, y: 1024 }));
120
- }
121
- }
122
-
123
- new TsIntegrator();
124
- ```
125
-
126
- ### Documentation for current example
127
-
128
- #### `integrateMetaBox`
129
-
130
- - **Description**: Integrates the MetaBox configurator into the specified container.
131
- - **Usage**:
132
-
133
- ```typescript
134
- integrateMetaBox(configuratorUrl: string, containerId: string, apiReadyCallback: (api: Communicator) => void);
135
- ```
136
-
137
- #### `SetEnvironment`
138
-
139
- - **Description**: Sets the environment by ID.
140
- - **Usage**:
141
-
142
- ```typescript
143
- api.sendCommandToMetaBox(new SetEnvironment(environmentId: string));
144
- ```
145
-
146
- #### `SetMaterial`
147
-
148
- - **Description**: Sets the material for a given product slot.
149
- - **Usage**:
150
-
151
- ```typescript
152
- api.sendCommandToMetaBox(new SetMaterial(productId: string, slotId: string, materialId: string));
153
- ```
154
-
155
- #### `SetEnvironmentMaterial`
156
-
157
- - **Description**: Sets the material for a given environment slot.
158
- - **Usage**:
159
-
160
- ```typescript
161
- api.sendCommandToMetaBox(new SetEnvironmentMaterial(productId: string, slotId: string, materialId: string));
162
- ```
163
-
164
- #### `SetProduct`
165
-
166
- - **Description**: Sets the product by ID.
167
- - **Usage**:
168
-
169
- ```typescript
170
- api.sendCommandToMetaBox(new SetProduct(productId: string));
171
- ```
172
-
173
- #### `ShowEmbeddedMenu`
174
-
175
- - **Description**: Toggles the embedded menu in the MetaBox configurator.
176
- - **Usage**:
177
-
178
- ```typescript
179
- api.sendCommandToMetaBox(new ShowEmbeddedMenu(visible: boolean));
180
- ```
181
-
182
- #### `ShowOverlayInterface`
183
-
184
- - **Description**: Toggles the overlay interface over Unreal viewport.
185
- - **Usage**:
186
-
187
- ```typescript
188
- api.sendCommandToMetaBox(new ShowOverlayInterface(visible: boolean));
189
- ```
190
-
191
- #### `GetFastRender`
192
-
193
- - **Description**: Retrieves a fast render of the current view.
194
- - **Usage**:
195
-
196
- ```typescript
197
- api.sendCommandToMetaBox(new GetFastRender(mimeType: string, size?: { x: number, y: number }));
198
- ```
199
-
200
- #### `GetPdf`
201
-
202
- - **Description**: Generates a PDF of the current view.
203
- - **Usage**:
204
-
205
- ```typescript
206
- api.sendCommandToMetaBox(new GetPdf());
207
- ```
208
-
209
- #### `saveImage`
210
-
211
- - **Description**: Saves the arrived rendered image to a file using utility function.
212
- - **Usage**:
213
-
214
- ```typescript
215
- saveImage(renderData: string, fileName: string): void;
216
- ```
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 the recommended method
6
+
7
+ ```sh
8
+ npm install @3dsource/metabox-front-api@^1.0.0 --save
9
+ ```
10
+
11
+ then
12
+
13
+ ```typescript
14
+ import { FromMetaBoxApiAction, GetFastRender, GetPdf, integrateMetaBox, saveImage, SetEnvironment, SetMaterial, SetProduct, ShowEmbeddedMenu, ShowOverlayInterface, SetEnvironmentMaterial, Communicator, ConfiguratorEnvelope } 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, ShowOverlayInterface, SetEnvironmentMaterial, Communicator, ConfiguratorEnvelope } from 'https://cdn.jsdelivr.net/npm/@3dsource/metabox-front-api@1.2.0';
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ### 1. Create HTML Structure
26
+
27
+ Ensure your HTML page has the following structure, where the MetaBox Configurator will be integrated.
28
+ You **MUST** control CSS style of `embed3DSource` element to make the configurator responsive and fit your needs on your own.
29
+
30
+ ```html
31
+
32
+ <div id="embed3DSource">
33
+ <!-- Your Configurator iframe will be embedded here -->
34
+ </div>
35
+ ```
36
+
37
+ ### 2. Include Required Scripts
38
+
39
+ Below is an example demonstrating how to use the MetaBox API functions:
40
+
41
+ Insert this code into your HTML file just before the closing `</body>` tag:
42
+
43
+ **EXAMPLE:**
44
+
45
+ HTML:
46
+
47
+ ```html
48
+
49
+ <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';
51
+
52
+ class JsIntegrator {
53
+ constructor() {
54
+ const url = 'https://metabox.3dsource.com/metabox-configurator/basic/your-configurator-id?sidebar=false';
55
+ integrateMetaBox(url, 'embed3DSource', (api) => this.apiReady(api));
56
+ }
57
+
58
+ apiReady(api) {
59
+ api.addEventListener('basicConfiguratorDataWithState', (data) => {
60
+ this.updateConfiguratorData(data);
61
+ });
62
+ api.addEventListener('fastRender', (data) => {
63
+ saveImage(data, 'Render.png');
64
+ });
65
+ this.setupInitialState(api);
66
+ }
67
+
68
+ updateConfiguratorData(data) {
69
+ // Use data on your own
70
+ }
71
+
72
+ setupInitialState(api) {
73
+ api.sendCommandToMetaBox(new SetProduct('productId'));
74
+ api.sendCommandToMetaBox(new SetEnvironment('environmentId'));
75
+ api.sendCommandToMetaBox(new SetMaterial('productId', 'slotId', 'materialId'));
76
+ api.sendCommandToMetaBox(new SetEnvironmentMaterial('productId', 'slotId', 'materialId'));
77
+ api.sendCommandToMetaBox(new ShowEmbeddedMenu(false));
78
+ api.sendCommandToMetaBox(new ShowOverlayInterface(false));
79
+ api.sendCommandToMetaBox(new GetPdf());
80
+ api.sendCommandToMetaBox(new GetFastRender('image/png', { x: 1024, y: 1024 }));
81
+ }
82
+ }
83
+
84
+ new JsIntegrator();
85
+ </script>
86
+ ```
87
+
88
+ TypeScript:
89
+
90
+ ```typescript
91
+ import { ConfiguratorEnvelope, UniversalConfigurator, integrateMetaBox, SetEnvironment, ShowOverlayInterface, SetEnvironmentMaterial, SetMaterial, SetProduct, ShowEmbeddedMenu, GetFastRender, GetPdf, saveImage, Communicator, FromMetaboxApiAction } from '@3dsource/metabox-front-api';
92
+
93
+ class TsIntegrator {
94
+ constructor() {
95
+ const url = 'https://metabox.3dsource.com/metabox-configurator/basic/your-configurator-id?sidebar=false';
96
+ integrateMetaBox(url, 'embed3DSource', (api) => this.apiReady(api));
97
+ }
98
+
99
+ apiReady(api: Communicator) {
100
+ api.addEventListener('basicConfiguratorDataWithState', (data) => {
101
+ this.updateConfiguratorData(data);
102
+ });
103
+ api.addEventListener('fastRender', (data) => {
104
+ saveImage(data, 'Render.png');
105
+ });
106
+ this.setupInitialState(api);
107
+ }
108
+
109
+ updateConfiguratorData(data: ConfiguratorEnvelope) {
110
+ // Use data on your own
111
+ }
112
+
113
+ setupInitialState(api: Communicator) {
114
+ api.sendCommandToMetaBox(new SetProduct('productId'));
115
+ api.sendCommandToMetaBox(new SetEnvironment('environmentId'));
116
+ api.sendCommandToMetaBox(new SetMaterial('productId', 'slotId', 'materialId'));
117
+ api.sendCommandToMetaBox(new SetEnvironmentMaterial('productId', 'slotId', 'materialId'));
118
+ api.sendCommandToMetaBox(new ShowEmbeddedMenu(false));
119
+ api.sendCommandToMetaBox(new ShowOverlayInterface(false));
120
+ api.sendCommandToMetaBox(new GetPdf());
121
+ api.sendCommandToMetaBox(new GetFastRender('image/png', { x: 1024, y: 1024 }));
122
+ }
123
+ }
124
+
125
+ new TsIntegrator();
126
+ ```
127
+
128
+ ### Documentation for current example
129
+
130
+ #### `integrateMetaBox`
131
+
132
+ - **Description**: Integrates the MetaBox configurator into the specified container.
133
+ - **Usage**:
134
+
135
+ ```typescript
136
+ integrateMetaBox(configuratorUrl: string, containerId: string, apiReadyCallback: (api: Communicator) => void);
137
+ ```
138
+
139
+ #### `SetEnvironment`
140
+
141
+ - **Description**: Sets the environment by ID.
142
+ - **Usage**:
143
+
144
+ ```typescript
145
+ api.sendCommandToMetaBox(new SetEnvironment(environmentId: string));
146
+ ```
147
+
148
+ #### `SetMaterial`
149
+
150
+ - **Description**: Sets the material for a given product slot.
151
+ - **Usage**:
152
+
153
+ ```typescript
154
+ api.sendCommandToMetaBox(new SetMaterial(productId: string, slotId: string, materialId: string));
155
+ ```
156
+
157
+ #### `SetEnvironmentMaterial`
158
+
159
+ - **Description**: Sets the material for a given environment slot.
160
+ - **Usage**:
161
+
162
+ ```typescript
163
+ api.sendCommandToMetaBox(new SetEnvironmentMaterial(productId: string, slotId: string, materialId: string));
164
+ ```
165
+
166
+ #### `SetProduct`
167
+
168
+ - **Description**: Sets the product by ID.
169
+ - **Usage**:
170
+
171
+ ```typescript
172
+ api.sendCommandToMetaBox(new SetProduct(productId: string));
173
+ ```
174
+
175
+ #### `ShowEmbeddedMenu`
176
+
177
+ - **Description**: Toggles the embedded menu in the MetaBox configurator.
178
+ - **Usage**:
179
+
180
+ ```typescript
181
+ api.sendCommandToMetaBox(new ShowEmbeddedMenu(visible: boolean));
182
+ ```
183
+
184
+ #### `ShowOverlayInterface`
185
+
186
+ - **Description**: Toggles the overlay interface over Unreal viewport.
187
+ - **Usage**:
188
+
189
+ ```typescript
190
+ api.sendCommandToMetaBox(new ShowOverlayInterface(visible: boolean));
191
+ ```
192
+
193
+ #### `GetFastRender`
194
+
195
+ - **Description**: Retrieves a fast render of the current view.
196
+ - **Usage**:
197
+
198
+ ```typescript
199
+ api.sendCommandToMetaBox(new GetFastRender(mimeType: string, size?: { x: number, y: number }));
200
+ ```
201
+
202
+ #### `GetPdf`
203
+
204
+ - **Description**: Generates a PDF of the current view.
205
+ - **Usage**:
206
+
207
+ ```typescript
208
+ api.sendCommandToMetaBox(new GetPdf());
209
+ ```
210
+
211
+ #### `saveImage`
212
+
213
+ - **Description**: Saves the arrived rendered image to a file using utility function.
214
+ - **Usage**:
215
+
216
+ ```typescript
217
+ saveImage(renderData: string, fileName: string): void;
218
+ ```
package/package.json CHANGED
@@ -1,56 +1,44 @@
1
- {
2
- "name": "@3dsource/metabox-front-api",
3
- "version": "1.2.0",
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": "Sergii Karanda @ 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
- "bump:dev": "npm version prerelease --preid=dev && npm run publish:dev",
36
- "bump:minor": "npm version minor && npm run publish:prod",
37
- "bump:preminor:beta": "npm version preminor --preid=beta && npm run publish:dev --tag beta",
38
- "bump:preminor:dev": "npm version preminor --preid=dev && npm run publish:dev",
39
- "bump:prepatch:beta": "npm version prepatch --preid=beta && npm run publish:dev --tag beta",
40
- "bump:prod": "npm version patch && npm run publish:prod",
41
- "clean": "rimraf dist",
42
- "packAll": "npm run clean && npm run build && npm pack",
43
- "publish:dev": "npm run packAll && npm publish --access public --tag dev",
44
- "publish:prod": "npm run packAll && npm publish --access public"
45
- },
46
- "peerDependencies": {
47
- "@3dsource/angular-unreal-module": "^0.0.29",
48
- "rimraf": ">=6.0.0",
49
- "rollup": ">=4.0.0",
50
- "rollup-plugin-typescript2": ">=0.36.0",
51
- "typescript": ">=5.0.0"
52
- },
53
- "publishConfig": {
54
- "access": "public"
55
- }
56
- }
1
+ {
2
+ "name": "@3dsource/metabox-front-api",
3
+ "version": "1.2.1-dev.2",
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": "UNLICENSED",
15
+ "author": "3dsource",
16
+ "sideEffects": false,
17
+ "type": "module",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./index.d.ts",
21
+ "require": "./dist/index.umd.js",
22
+ "import": "./dist/index.esm.js",
23
+ "default": "./fesm2022/3dsource-metabox-front-api.mjs"
24
+ },
25
+ "./package.json": {
26
+ "default": "./package.json"
27
+ }
28
+ },
29
+ "main": "dist/index.umd.js",
30
+ "jsdelivr": "dist/index.esm.js",
31
+ "unpkg": "dist/index.esm.js",
32
+ "module": "fesm2022/3dsource-metabox-front-api.mjs",
33
+ "types": "dist/index.d.ts",
34
+ "files": [
35
+ "dist/**/*"
36
+ ],
37
+ "peerDependencies": {
38
+ "@3dsource/angular-unreal-module": ">=0.0.29"
39
+ },
40
+ "dependencies": {
41
+ "tslib": "^2.8.1"
42
+ },
43
+ "typings": "index.d.ts"
44
+ }
@@ -1,7 +0,0 @@
1
- import type { ToMetaBoxMessageEnvelope } from '../interfaces/ToMetaboxMessagePayloads';
2
- /**
3
- * Base class for commands sent to the MetaBox.
4
- */
5
- export declare class CommandBase {
6
- data: ToMetaBoxMessageEnvelope;
7
- }
@@ -1,2 +0,0 @@
1
- import { GetScreenshot } from './GetScreenshot';
2
- export declare const GetFastRender: typeof GetScreenshot;
@@ -1,24 +0,0 @@
1
- import { CommandBase } from './CommandBase';
2
- /**
3
- * Represents a command to get a PDF from Metabox.
4
- * @remarks
5
- * This class sends a message to the MetaBox API to generate a PDF based on the current configuration.
6
- * This action does not require any parameters.
7
- *
8
- * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
9
- *
10
- * @example
11
- * import { GetPdf,Communicator } from '@3dsource/metabox-front-api';
12
- * window.env3DSource.apiReady = (api:Communicator) => {
13
- * api.sendCommandToMetaBox(new GetPdf());
14
- * };
15
- */
16
- export declare class GetPdf extends CommandBase {
17
- /**
18
- * Creates an instance of GetPdf.
19
- *
20
- * @remarks
21
- * This constructor does not require any parameters.
22
- */
23
- constructor();
24
- }
@@ -1,34 +0,0 @@
1
- import { CommandBase } from './CommandBase';
2
- /**
3
- * Image format.
4
- * @remarks
5
- * This type represents the allowed image formats.
6
- */
7
- export type MimeType = 'image/png' | 'image/jpeg' | 'image/webp';
8
- /**
9
- * Represents a command to get fast render.
10
- *
11
- * **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
12
- *
13
- * @example
14
- * import { GetScreenshot,Communicator,saveImage } from '@3dsource/metabox-front-api';
15
- * window.env3DSource.apiReady = (api:Communicator) => {
16
- * // Listen for events from the MetaBox API
17
- * api.addEventListener('screenshot', (data) => {
18
- * // Process the fast render response
19
- * saveImage(data, 'Render.png');
20
- * });
21
- * api.sendCommandToMetaBox(new GetScreenshot('image/png', { x: 1024, y: 1024 }));
22
- * };
23
- */
24
- export declare class GetScreenshot extends CommandBase {
25
- /**
26
- * Constructs an instance of GetScreenshot.
27
- * @param mimeType - The output format.
28
- * @param size - Optional size in pixels.
29
- */
30
- constructor(mimeType: MimeType, size?: {
31
- x: number;
32
- y: number;
33
- });
34
- }
@@ -1,21 +0,0 @@
1
- import { CommandBase } from './CommandBase';
2
- /**
3
- * Represents a command to set the environment by its ID.
4
- *
5
- * @example
6
- * import { SetEnvironment,Communicator } from '@3dsource/metabox-front-api';
7
- *
8
- * //...Assume that the integration is already implemented
9
- * window.env3DSource.apiReady = (api:Communicator) => {
10
- * // Change the environment to '55555555-1234-1234-1234-01234567890'
11
- * api.sendCommandToMetaBox(new SetEnvironment('55555555-1234-1234-1234-01234567890'));
12
- * };
13
- */
14
- export declare class SetEnvironment extends CommandBase {
15
- /**
16
- * Creates an instance of SetEnvironment.
17
- *
18
- * @param environmentId - The environment ID.
19
- */
20
- constructor(environmentId: string);
21
- }
@@ -1,24 +0,0 @@
1
- import { CommandBase } from './CommandBase';
2
- /**
3
- * Represents a command to set an environment material by its ID.
4
- *
5
- * @example
6
- * import { SetEnvironmentMaterial,Communicator } from '@3dsource/metabox-front-api';
7
- *
8
- * //...Assume that the integration is already implemented
9
- * window.env3DSource.apiReady = (api:Communicator) => {
10
- * api.sendCommandToMetaBox(new SetEnvironmentMaterial(
11
- * 'carpaint',
12
- * 'dd829d6e-9200-47a7-8d5b-af5df89b7e91',
13
- * ));
14
- * };
15
- */
16
- export declare class SetEnvironmentMaterial extends CommandBase {
17
- /**
18
- * Creates an instance of SetEnvironmentMaterial.
19
- *
20
- * @param slotId - The slot ID.
21
- * @param materialId - The material ID.
22
- */
23
- constructor(slotId: string, materialId: string);
24
- }