@3dsource/metabox-front-api 0.0.7 → 0.0.9
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 +23 -22
- package/dist/actions/ApiAction.d.ts +4 -0
- package/dist/actions/ApiAction.js +4 -0
- package/dist/actions/GetFastRender.d.ts +1 -1
- package/dist/actions/GetFastRender.js +1 -1
- package/dist/actions/SetEnvironmentMaterial.d.ts +49 -0
- package/dist/actions/SetEnvironmentMaterial.js +65 -0
- package/dist/actions/WatchCallbacks.d.ts +3 -3
- package/dist/actions/WatchCallbacks.js +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/interfaces/FromMetaboxMessagePayloads.d.ts +23 -2
- package/dist/interfaces/FromMetaboxMessagePayloads.js +18 -2
- package/dist/interfaces/ToMetaboxMessagePayloads.d.ts +11 -1
- package/dist/interfaces/ToMetaboxMessagePayloads.js +3 -1
- package/dist/interfaces/UniversalConfigurator.d.ts +15 -7
- package/dist/lib/initializeCommunicator.d.ts +2 -1
- package/dist/lib/initializeCommunicator.js +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# MetaBox API
|
|
1
|
+
# MetaBox Basic Configurators API
|
|
2
2
|
|
|
3
|
-
This package provides an API for interacting with the MetaBox
|
|
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 recommended method
|
|
6
6
|
|
|
@@ -24,7 +24,18 @@ import { FromMetaBoxApiAction, GetFastRender, GetPdf, integrateMetaBox, saveImag
|
|
|
24
24
|
|
|
25
25
|
## Usage
|
|
26
26
|
|
|
27
|
-
### 1.
|
|
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
|
|
28
39
|
|
|
29
40
|
Below is an example demonstrating how to use the MetaBox API functions:
|
|
30
41
|
|
|
@@ -34,12 +45,11 @@ Insert this code into your HTML file just before the closing `</body>` tag:
|
|
|
34
45
|
|
|
35
46
|
```html
|
|
36
47
|
<script type="module">
|
|
37
|
-
import { integrateMetaBox, SetEnvironment, SetMaterial, SetProduct, ShowEmbeddedMenu, GetFastRender, GetPdf, saveImage } from '@3dsource/metabox-front-api';
|
|
38
|
-
|
|
48
|
+
import { integrateMetaBox, SetEnvironment, SetMaterial, SetProduct, ShowEmbeddedMenu, GetFastRender, GetPdf, saveImage, FromMetaboxApiAction } from '@3dsource/metabox-front-api';
|
|
49
|
+
let initilaized = false;
|
|
39
50
|
// Expose API
|
|
40
51
|
window.env3DSource.apiReady = (api) => {
|
|
41
|
-
|
|
42
|
-
this.api.addEventListener('metaboxData', (data) => {
|
|
52
|
+
api.addEventListener('metaboxData', (data) => {
|
|
43
53
|
const { action, payload, eventType } = data;
|
|
44
54
|
if (action !== FromMetaboxApiAction.bridge) {
|
|
45
55
|
return;
|
|
@@ -57,11 +67,11 @@ Insert this code into your HTML file just before the closing `</body>` tag:
|
|
|
57
67
|
}
|
|
58
68
|
|
|
59
69
|
if (eventType === 'basicConfiguratorDataWithState') {
|
|
60
|
-
|
|
61
|
-
|
|
70
|
+
updateConfiguratorData(data);
|
|
71
|
+
setupInitialState();
|
|
62
72
|
}
|
|
63
73
|
|
|
64
|
-
if (eventType === '
|
|
74
|
+
if (eventType === 'fastRender') {
|
|
65
75
|
//Catches the render image
|
|
66
76
|
saveImage(payload, 'Render.png');
|
|
67
77
|
}
|
|
@@ -80,6 +90,9 @@ Insert this code into your HTML file just before the closing `</body>` tag:
|
|
|
80
90
|
* Setup initial state
|
|
81
91
|
*/
|
|
82
92
|
function setupInitialState() {
|
|
93
|
+
if (initilaized) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
83
96
|
// Set product
|
|
84
97
|
new SetProduct('product-id');
|
|
85
98
|
|
|
@@ -105,18 +118,6 @@ Insert this code into your HTML file just before the closing `</body>` tag:
|
|
|
105
118
|
</script>
|
|
106
119
|
```
|
|
107
120
|
|
|
108
|
-
### 2. HTML Structure
|
|
109
|
-
|
|
110
|
-
Ensure your HTML page has the following structure, where the MetaBox Configurator will be integrated:
|
|
111
|
-
|
|
112
|
-
```html
|
|
113
|
-
<div class="container">
|
|
114
|
-
<div id="embed3DSource">
|
|
115
|
-
<!-- Your Configurator iframe will be embedded here -->
|
|
116
|
-
</div>
|
|
117
|
-
</div>
|
|
118
|
-
```
|
|
119
|
-
|
|
120
121
|
### Documentation for current example
|
|
121
122
|
|
|
122
123
|
### `integrateMetaBox`
|
|
@@ -36,7 +36,7 @@ export type MimeType = 'image/png' | 'image/jpeg' | 'image/webp';
|
|
|
36
36
|
* new GetFastRender('image/png', { x: 1024, y: 1024 });
|
|
37
37
|
* }
|
|
38
38
|
* // Process the fast render response
|
|
39
|
-
* if (data.eventType === '
|
|
39
|
+
* if (data.eventType === 'fastRender') {
|
|
40
40
|
* saveImage(data.payload, 'Render.png');
|
|
41
41
|
* }
|
|
42
42
|
* });
|
|
@@ -36,7 +36,7 @@ import { ToMetaBoxApiAction } from '../interfaces/ToMetaboxMessagePayloads';
|
|
|
36
36
|
* new GetFastRender('image/png', { x: 1024, y: 1024 });
|
|
37
37
|
* }
|
|
38
38
|
* // Process the fast render response
|
|
39
|
-
* if (data.eventType === '
|
|
39
|
+
* if (data.eventType === 'fastRender') {
|
|
40
40
|
* saveImage(data.payload, 'Render.png');
|
|
41
41
|
* }
|
|
42
42
|
* });
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ApiAction } from './ApiAction';
|
|
2
|
+
/**
|
|
3
|
+
* Represents an action to set a material by its ID.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This action sends a message to the MetaBox API to update the material on a specific product slot using the provided identifiers.
|
|
7
|
+
|
|
8
|
+
* **Important:** Before invoking this action, ensure that the MetaBox already dispatched
|
|
9
|
+
* as minimum one eventType:"basicConfiguratorDataWithState":
|
|
10
|
+
* ```javascript
|
|
11
|
+
* data.eventType === 'basicConfiguratorDataWithState'.
|
|
12
|
+
* ```
|
|
13
|
+
* Only then request be processed.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* import { SetMaterial } from 'https://unpkg.com/@3dsource/metabox-front-api@latest/dist/index.js';
|
|
17
|
+
*
|
|
18
|
+
* // Integrate the MetaBox configurator into an HTML element with the ID 'embed3DSource'
|
|
19
|
+
* integrateMetaBox(
|
|
20
|
+
* 'https://metabox.3dsource.com/metabox-configurator/basic/12345678-1234-1234-1234-01234567890?introImage=https://example.com/intro.webp&sidebar=false',
|
|
21
|
+
* 'embed3DSource'
|
|
22
|
+
* );
|
|
23
|
+
*
|
|
24
|
+
* // Set up the global API environment
|
|
25
|
+
* window.env3DSource = window.env3DSource || {};
|
|
26
|
+
* window.env3DSource.apiReady = (api) => {
|
|
27
|
+
* // Listen for events from the MetaBox API
|
|
28
|
+
* api.addEventListener('metaboxData', (data) => {
|
|
29
|
+
* // Process SetMaterial
|
|
30
|
+
* if (data.eventType === 'basicConfiguratorDataWithState') {
|
|
31
|
+
* new SetEnvironmentMaterial(
|
|
32
|
+
* 'ffea6b5c-3a8a-4f56-9417-e605acb5cca3',
|
|
33
|
+
* 'carpaint',
|
|
34
|
+
* 'dd829d6e-9200-47a7-8d5b-af5df89b7e91',
|
|
35
|
+
* );
|
|
36
|
+
* }
|
|
37
|
+
* });
|
|
38
|
+
* };
|
|
39
|
+
*/
|
|
40
|
+
export declare class SetEnvironmentMaterial extends ApiAction {
|
|
41
|
+
/**
|
|
42
|
+
* Creates an instance of SetMaterial.
|
|
43
|
+
*
|
|
44
|
+
* @param productId - The product ID.
|
|
45
|
+
* @param slotId - The slot ID.
|
|
46
|
+
* @param materialId - The material ID.
|
|
47
|
+
*/
|
|
48
|
+
constructor(productId: string, slotId: string, materialId: string);
|
|
49
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025.
|
|
3
|
+
* 3DSource.com, Sergii Karanda steve@3dsource.com
|
|
4
|
+
* All Rights Reserved
|
|
5
|
+
*/
|
|
6
|
+
import { ApiAction } from './ApiAction';
|
|
7
|
+
import { ToMetaBoxApiAction } from '../interfaces/ToMetaboxMessagePayloads';
|
|
8
|
+
/**
|
|
9
|
+
* Represents an action to set a material by its ID.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* This action sends a message to the MetaBox API to update the material on a specific product slot using the provided identifiers.
|
|
13
|
+
|
|
14
|
+
* **Important:** Before invoking this action, ensure that the MetaBox already dispatched
|
|
15
|
+
* as minimum one eventType:"basicConfiguratorDataWithState":
|
|
16
|
+
* ```javascript
|
|
17
|
+
* data.eventType === 'basicConfiguratorDataWithState'.
|
|
18
|
+
* ```
|
|
19
|
+
* Only then request be processed.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* import { SetMaterial } from 'https://unpkg.com/@3dsource/metabox-front-api@latest/dist/index.js';
|
|
23
|
+
*
|
|
24
|
+
* // Integrate the MetaBox configurator into an HTML element with the ID 'embed3DSource'
|
|
25
|
+
* integrateMetaBox(
|
|
26
|
+
* 'https://metabox.3dsource.com/metabox-configurator/basic/12345678-1234-1234-1234-01234567890?introImage=https://example.com/intro.webp&sidebar=false',
|
|
27
|
+
* 'embed3DSource'
|
|
28
|
+
* );
|
|
29
|
+
*
|
|
30
|
+
* // Set up the global API environment
|
|
31
|
+
* window.env3DSource = window.env3DSource || {};
|
|
32
|
+
* window.env3DSource.apiReady = (api) => {
|
|
33
|
+
* // Listen for events from the MetaBox API
|
|
34
|
+
* api.addEventListener('metaboxData', (data) => {
|
|
35
|
+
* // Process SetMaterial
|
|
36
|
+
* if (data.eventType === 'basicConfiguratorDataWithState') {
|
|
37
|
+
* new SetEnvironmentMaterial(
|
|
38
|
+
* 'ffea6b5c-3a8a-4f56-9417-e605acb5cca3',
|
|
39
|
+
* 'carpaint',
|
|
40
|
+
* 'dd829d6e-9200-47a7-8d5b-af5df89b7e91',
|
|
41
|
+
* );
|
|
42
|
+
* }
|
|
43
|
+
* });
|
|
44
|
+
* };
|
|
45
|
+
*/
|
|
46
|
+
export class SetEnvironmentMaterial extends ApiAction {
|
|
47
|
+
/**
|
|
48
|
+
* Creates an instance of SetMaterial.
|
|
49
|
+
*
|
|
50
|
+
* @param productId - The product ID.
|
|
51
|
+
* @param slotId - The slot ID.
|
|
52
|
+
* @param materialId - The material ID.
|
|
53
|
+
*/
|
|
54
|
+
constructor(productId, slotId, materialId) {
|
|
55
|
+
super();
|
|
56
|
+
this.api.sendMessageToMetaBox({
|
|
57
|
+
payload: {
|
|
58
|
+
productId,
|
|
59
|
+
slotId,
|
|
60
|
+
materialId,
|
|
61
|
+
},
|
|
62
|
+
action: ToMetaBoxApiAction.setEnvironmentMaterialById,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ApiAction } from './ApiAction';
|
|
2
2
|
/**
|
|
3
|
-
* @
|
|
4
|
-
* Represents an action to watch Unreal callbacks from Unreal engine.
|
|
3
|
+
* @experimental
|
|
5
4
|
* @remarks
|
|
6
|
-
*
|
|
5
|
+
* Represents an action to watch Unreal callbacks from Unreal engine.
|
|
6
|
+
* Can be useful for custom solutions.
|
|
7
7
|
*/
|
|
8
8
|
export declare class WatchCallbacks extends ApiAction {
|
|
9
9
|
/**
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
import { ApiAction } from './ApiAction';
|
|
7
7
|
import { ToMetaBoxApiAction } from '../interfaces/ToMetaboxMessagePayloads';
|
|
8
8
|
/**
|
|
9
|
-
* @
|
|
10
|
-
* Represents an action to watch Unreal callbacks from Unreal engine.
|
|
9
|
+
* @experimental
|
|
11
10
|
* @remarks
|
|
12
|
-
*
|
|
11
|
+
* Represents an action to watch Unreal callbacks from Unreal engine.
|
|
12
|
+
* Can be useful for custom solutions.
|
|
13
13
|
*/
|
|
14
14
|
export class WatchCallbacks extends ApiAction {
|
|
15
15
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -3,9 +3,11 @@ export { SetEnvironment } from './actions/SetEnvironment';
|
|
|
3
3
|
export { SetProduct } from './actions/SetProduct';
|
|
4
4
|
export { GetPdf } from './actions/GetPdf';
|
|
5
5
|
export { SetMaterial } from './actions/SetMaterial';
|
|
6
|
+
export { SetEnvironmentMaterial } from './actions/SetEnvironmentMaterial';
|
|
6
7
|
export { GetFastRender } from './actions/GetFastRender';
|
|
7
8
|
export { WatchCallbacks } from './actions/WatchCallbacks';
|
|
8
9
|
export { MimeType } from './actions/GetFastRender';
|
|
10
|
+
export { ApiAction } from './actions/ApiAction';
|
|
9
11
|
export * from './lib/integrateMetaBox';
|
|
10
12
|
export * from './lib/initializeCommunicator';
|
|
11
13
|
export * from './lib/saveImage';
|
package/dist/index.js
CHANGED
|
@@ -8,8 +8,10 @@ export { SetEnvironment } from './actions/SetEnvironment';
|
|
|
8
8
|
export { SetProduct } from './actions/SetProduct';
|
|
9
9
|
export { GetPdf } from './actions/GetPdf';
|
|
10
10
|
export { SetMaterial } from './actions/SetMaterial';
|
|
11
|
+
export { SetEnvironmentMaterial } from './actions/SetEnvironmentMaterial';
|
|
11
12
|
export { GetFastRender } from './actions/GetFastRender';
|
|
12
13
|
export { WatchCallbacks } from './actions/WatchCallbacks';
|
|
14
|
+
export { ApiAction } from './actions/ApiAction';
|
|
13
15
|
export * from './lib/integrateMetaBox';
|
|
14
16
|
export * from './lib/initializeCommunicator';
|
|
15
17
|
export * from './lib/saveImage';
|
|
@@ -1,39 +1,55 @@
|
|
|
1
1
|
import type { ConfiguratorEnvelope } from './UniversalConfigurator';
|
|
2
2
|
export declare const FromMetaboxApiAction: {
|
|
3
3
|
readonly bridge: "bridge";
|
|
4
|
-
readonly unrealCallback: "unrealCallback";
|
|
5
|
-
readonly unrealFeatureBridge: "unrealFeatureBridge";
|
|
6
4
|
readonly appLoaded: "appLoaded";
|
|
7
5
|
/**
|
|
6
|
+
* @hidden
|
|
7
|
+
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "unrealFeature"
|
|
8
|
+
*/
|
|
9
|
+
readonly unrealFeatureBridge: "unrealFeatureBridge";
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "unrealCallback"
|
|
13
|
+
*/
|
|
14
|
+
readonly unrealCallback: "unrealCallback";
|
|
15
|
+
/**
|
|
16
|
+
* @hidden
|
|
8
17
|
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "configuratorDataWithState"
|
|
9
18
|
*/
|
|
10
19
|
readonly configuratorDataWithStateBridge: "configuratorDataWithStateBridge";
|
|
11
20
|
/**
|
|
21
|
+
* @hidden
|
|
12
22
|
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "configuratorDataWithState"
|
|
13
23
|
*/
|
|
14
24
|
readonly configuratorDataBridge: "configuratorDataBridge";
|
|
15
25
|
/**
|
|
26
|
+
* @hidden
|
|
16
27
|
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "configuratorDataWithState"
|
|
17
28
|
*/
|
|
18
29
|
readonly menuDataBridge: "menuDataBridge";
|
|
19
30
|
/**
|
|
31
|
+
* @hidden
|
|
20
32
|
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "configuratorDataWithState"
|
|
21
33
|
*/
|
|
22
34
|
readonly flatMenuDataBridge: "flatMenuDataBridge";
|
|
23
35
|
/**
|
|
36
|
+
* @hidden
|
|
24
37
|
* @deprecated, use Bridge with isFullscreen
|
|
25
38
|
*/
|
|
26
39
|
readonly fullScreenBridge: "fullScreenBridge";
|
|
27
40
|
/**
|
|
41
|
+
* @hidden
|
|
28
42
|
* @deprecated, use Bridge with streamResolution
|
|
29
43
|
*/
|
|
30
44
|
readonly videoSize: "videoSize";
|
|
31
45
|
/**
|
|
46
|
+
* @hidden
|
|
32
47
|
* Used in platform, must be removed in future
|
|
33
48
|
* @deprecated
|
|
34
49
|
*/
|
|
35
50
|
readonly unrealResponse: "unrealResponse";
|
|
36
51
|
/**
|
|
52
|
+
* @hidden
|
|
37
53
|
* @deprecated\
|
|
38
54
|
*/
|
|
39
55
|
readonly getFastRender: "getFastRender";
|
|
@@ -89,6 +105,11 @@ export interface FromMetaboxMessagePayloads {
|
|
|
89
105
|
/**
|
|
90
106
|
* Dispatches every time when Unreal is sending ordered render with new GetFastRender() command.
|
|
91
107
|
*/
|
|
108
|
+
fastRender: string | null;
|
|
109
|
+
/**
|
|
110
|
+
* @hidden
|
|
111
|
+
* @Deprecated, use fastRender
|
|
112
|
+
*/
|
|
92
113
|
getFastRender: string | null;
|
|
93
114
|
/**
|
|
94
115
|
* @internal
|
|
@@ -5,39 +5,55 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export const FromMetaboxApiAction = {
|
|
7
7
|
bridge: 'bridge',
|
|
8
|
-
unrealCallback: 'unrealCallback',
|
|
9
|
-
unrealFeatureBridge: 'unrealFeatureBridge',
|
|
10
8
|
appLoaded: 'appLoaded',
|
|
11
9
|
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "unrealFeature"
|
|
12
|
+
*/
|
|
13
|
+
unrealFeatureBridge: 'unrealFeatureBridge',
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "unrealCallback"
|
|
17
|
+
*/
|
|
18
|
+
unrealCallback: 'unrealCallback',
|
|
19
|
+
/**
|
|
20
|
+
* @hidden
|
|
12
21
|
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "configuratorDataWithState"
|
|
13
22
|
*/
|
|
14
23
|
configuratorDataWithStateBridge: 'configuratorDataWithStateBridge',
|
|
15
24
|
/**
|
|
25
|
+
* @hidden
|
|
16
26
|
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "configuratorDataWithState"
|
|
17
27
|
*/
|
|
18
28
|
configuratorDataBridge: 'configuratorDataBridge',
|
|
19
29
|
/**
|
|
30
|
+
* @hidden
|
|
20
31
|
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "configuratorDataWithState"
|
|
21
32
|
*/
|
|
22
33
|
menuDataBridge: 'menuDataBridge',
|
|
23
34
|
/**
|
|
35
|
+
* @hidden
|
|
24
36
|
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "configuratorDataWithState"
|
|
25
37
|
*/
|
|
26
38
|
flatMenuDataBridge: 'flatMenuDataBridge',
|
|
27
39
|
/**
|
|
40
|
+
* @hidden
|
|
28
41
|
* @deprecated, use Bridge with isFullscreen
|
|
29
42
|
*/
|
|
30
43
|
fullScreenBridge: 'fullScreenBridge',
|
|
31
44
|
/**
|
|
45
|
+
* @hidden
|
|
32
46
|
* @deprecated, use Bridge with streamResolution
|
|
33
47
|
*/
|
|
34
48
|
videoSize: 'videoSize',
|
|
35
49
|
/**
|
|
50
|
+
* @hidden
|
|
36
51
|
* Used in platform, must be removed in future
|
|
37
52
|
* @deprecated
|
|
38
53
|
*/
|
|
39
54
|
unrealResponse: 'unrealResponse',
|
|
40
55
|
/**
|
|
56
|
+
* @hidden
|
|
41
57
|
* @deprecated\
|
|
42
58
|
*/
|
|
43
59
|
getFastRender: 'getFastRender',
|
|
@@ -6,7 +6,8 @@ export declare const ToMetaBoxApiAction: {
|
|
|
6
6
|
readonly setProduct: "setProduct";
|
|
7
7
|
/**
|
|
8
8
|
* @deprecated, use 'watchCallbacks'"
|
|
9
|
-
*
|
|
9
|
+
* use MetaBoxApiAction.Bridge with eventType: "configuratorDataWithState"
|
|
10
|
+
* @hidden
|
|
10
11
|
*/
|
|
11
12
|
readonly addResponse: "addResponse";
|
|
12
13
|
readonly getFastRender: "getFastRender";
|
|
@@ -14,8 +15,12 @@ export declare const ToMetaBoxApiAction: {
|
|
|
14
15
|
readonly setMaterialById: "setMaterialById";
|
|
15
16
|
readonly showEmbeddedMenu: "showEmbeddedMenu";
|
|
16
17
|
readonly forceSetDeviceType: "forceSetDeviceType";
|
|
18
|
+
readonly setEnvironmentMaterialById: "setEnvironmentMaterialById";
|
|
17
19
|
};
|
|
18
20
|
export type ToMetaBoxActions = (typeof ToMetaBoxApiAction)[keyof typeof ToMetaBoxApiAction];
|
|
21
|
+
/**
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
19
24
|
export type ToMetaboxMessagePayload = ToMetaboxMessagePayloads[keyof ToMetaboxMessagePayloads];
|
|
20
25
|
export interface ToMetaboxMessagePayloads {
|
|
21
26
|
getPdf: void;
|
|
@@ -43,6 +48,11 @@ export interface ToMetaboxMessagePayloads {
|
|
|
43
48
|
slotId: string;
|
|
44
49
|
materialId: string;
|
|
45
50
|
};
|
|
51
|
+
setEnvironmentMaterialById: {
|
|
52
|
+
productId: string;
|
|
53
|
+
slotId: string;
|
|
54
|
+
materialId: string;
|
|
55
|
+
};
|
|
46
56
|
showEmbeddedMenu: {
|
|
47
57
|
visible: boolean;
|
|
48
58
|
};
|
|
@@ -9,7 +9,8 @@ export const ToMetaBoxApiAction = {
|
|
|
9
9
|
setProduct: 'setProduct',
|
|
10
10
|
/**
|
|
11
11
|
* @deprecated, use 'watchCallbacks'"
|
|
12
|
-
*
|
|
12
|
+
* use MetaBoxApiAction.Bridge with eventType: "configuratorDataWithState"
|
|
13
|
+
* @hidden
|
|
13
14
|
*/
|
|
14
15
|
addResponse: 'addResponse',
|
|
15
16
|
getFastRender: 'getFastRender',
|
|
@@ -17,4 +18,5 @@ export const ToMetaBoxApiAction = {
|
|
|
17
18
|
setMaterialById: 'setMaterialById',
|
|
18
19
|
showEmbeddedMenu: 'showEmbeddedMenu',
|
|
19
20
|
forceSetDeviceType: 'forceSetDeviceType',
|
|
21
|
+
setEnvironmentMaterialById: 'setEnvironmentMaterialById',
|
|
20
22
|
};
|
|
@@ -7,18 +7,26 @@ export interface ConfiguratorEnvelope {
|
|
|
7
7
|
* A reference to the universal configurator.
|
|
8
8
|
*/
|
|
9
9
|
configurator: UniversalConfigurator | null;
|
|
10
|
-
/**
|
|
11
|
-
* A record mapping material selections.
|
|
12
|
-
*/
|
|
13
|
-
selectedMaterials: SelectedMaterials;
|
|
14
10
|
/**
|
|
15
11
|
* The unique product identifier.
|
|
16
12
|
*/
|
|
17
13
|
productId: string;
|
|
18
14
|
/**
|
|
19
|
-
*
|
|
15
|
+
* A record mapping product material selections.
|
|
16
|
+
*/
|
|
17
|
+
productMaterialsIds: SelectedIds;
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated, use `productMaterialsIds` instead.
|
|
20
|
+
*/
|
|
21
|
+
selectedMaterials: SelectedIds;
|
|
22
|
+
/**
|
|
23
|
+
* The unique environment identifier.
|
|
24
|
+
*/
|
|
25
|
+
environmentId: string;
|
|
26
|
+
/**
|
|
27
|
+
* A record mapping environment material selections.
|
|
20
28
|
*/
|
|
21
|
-
|
|
29
|
+
environmentMaterialsIds: SelectedIds;
|
|
22
30
|
}
|
|
23
31
|
/**
|
|
24
32
|
* Represents the universal configurator with its basic properties and components.
|
|
@@ -149,4 +157,4 @@ export interface Environment {
|
|
|
149
157
|
/**
|
|
150
158
|
* Defines the structure for a mapping of selected materials.
|
|
151
159
|
*/
|
|
152
|
-
export type
|
|
160
|
+
export type SelectedIds = Record<string, Record<string, string>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ToMetaBoxMessageEnvelope } from '../interfaces/ToMetaboxMessagePayloads';
|
|
1
|
+
import type { ToMetaBoxMessageEnvelope } from '../interfaces/ToMetaboxMessagePayloads';
|
|
2
2
|
declare global {
|
|
3
3
|
interface Window {
|
|
4
4
|
env3DSource: {
|
|
@@ -14,6 +14,7 @@ declare global {
|
|
|
14
14
|
*
|
|
15
15
|
* @remarks
|
|
16
16
|
* This class sets up a communication channel with the embedded content via window messages.
|
|
17
|
+
* @hidden
|
|
17
18
|
*/
|
|
18
19
|
export declare class Communicator {
|
|
19
20
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@3dsource/metabox-front-api",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "API for MetaBox configurator",
|
|
3
|
+
"version": "0.0.9",
|
|
4
|
+
"description": "API for MetaBox BASIC configurator",
|
|
5
5
|
"main": "dist/index.ts",
|
|
6
6
|
"unpkg": "dist/index.js",
|
|
7
7
|
"type": "module",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"clean": "rimraf dist",
|
|
11
11
|
"packAll": "npm run clean && npm run build && npm pack",
|
|
12
12
|
"publishApi": "npm run packAll && npm publish --access public",
|
|
13
|
-
"apiDoc": "typedoc --entryPointStrategy Expand src/index.ts --tsconfig
|
|
13
|
+
"apiDoc": "typedoc --entryPointStrategy Expand src/index.ts --tsconfig ./../../../tsconfig.typedoc.json --out ./../../../dist/browser/apiDocBasic"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"dist"
|