@3dsource/metabox-front-api 1.2.1-dev.4 → 1.2.2-dev.0
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 +80 -24
- 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/index.d.ts
CHANGED
|
@@ -2,102 +2,157 @@ import { MetaBoxCommandPacket } from '@3dsource/types-unreal';
|
|
|
2
2
|
import { UnrealCallBackJson, UnrealState, StreamResolutionProps } from '@3dsource/angular-unreal-module';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
|
|
5
|
+
type ApplicationDeviceTypes = 'deviceTypeAuto' | 'deviceTypeMobile' | 'deviceTypeDesktop';
|
|
6
|
+
|
|
7
|
+
type FromMetaboxApiAction = 'bridge' | 'appLoaded';
|
|
5
8
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
+
* @hidden
|
|
10
|
+
* Preserved for backward compatibility.
|
|
11
|
+
* @deprecated Use FromMetaboxApiAction type instead.
|
|
9
12
|
*/
|
|
10
|
-
type
|
|
13
|
+
type FromMetaboxDeprecatedApiAction =
|
|
11
14
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* import { GetScreenshot,Communicator,saveImage } from '@3dsource/metabox-front-api';
|
|
18
|
-
* window.env3DSource.apiReady = (api:Communicator) => {
|
|
19
|
-
* // Listen for events from the MetaBox API
|
|
20
|
-
* api.addEventListener('screenshot', (data) => {
|
|
21
|
-
* // Process the fast render response
|
|
22
|
-
* saveImage(data, 'Render.png');
|
|
23
|
-
* });
|
|
24
|
-
* api.sendCommandToMetaBox(new GetScreenshot('image/png', { x: 1024, y: 1024 }));
|
|
25
|
-
* };
|
|
15
|
+
* @hidden
|
|
16
|
+
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "unrealFeature"
|
|
26
17
|
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
18
|
+
'unrealFeatureBridge'
|
|
19
|
+
/**
|
|
20
|
+
* @hidden
|
|
21
|
+
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "unrealCallback"
|
|
22
|
+
*/
|
|
23
|
+
| 'unrealCallback'
|
|
24
|
+
/**
|
|
25
|
+
* @hidden
|
|
26
|
+
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "configuratorDataWithState"
|
|
27
|
+
*/
|
|
28
|
+
| 'configuratorDataWithStateBridge'
|
|
29
|
+
/**
|
|
30
|
+
* @hidden
|
|
31
|
+
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "configuratorDataWithState"
|
|
32
|
+
*/
|
|
33
|
+
| 'configuratorDataBridge'
|
|
34
|
+
/**
|
|
35
|
+
* @hidden
|
|
36
|
+
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "configuratorDataWithState"
|
|
37
|
+
*/
|
|
38
|
+
| 'menuDataBridge'
|
|
39
|
+
/**
|
|
40
|
+
* @hidden
|
|
41
|
+
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "configuratorDataWithState"
|
|
42
|
+
*/
|
|
43
|
+
| 'flatMenuDataBridge'
|
|
44
|
+
/**
|
|
45
|
+
* @hidden
|
|
46
|
+
* @deprecated, use Bridge with isFullscreen
|
|
47
|
+
*/
|
|
48
|
+
| 'fullScreenBridge'
|
|
49
|
+
/**
|
|
50
|
+
* @hidden
|
|
51
|
+
* @deprecated, use Bridge with streamResolution
|
|
52
|
+
*/
|
|
53
|
+
| 'videoSize'
|
|
54
|
+
/**
|
|
55
|
+
* @hidden
|
|
56
|
+
* Used in a platform, must be removed in future
|
|
57
|
+
* @deprecated
|
|
58
|
+
*/
|
|
59
|
+
| 'unrealResponse'
|
|
60
|
+
/**
|
|
61
|
+
* @hidden
|
|
62
|
+
* @deprecated\
|
|
63
|
+
*/
|
|
64
|
+
| 'getFastRender';
|
|
40
65
|
|
|
41
|
-
|
|
66
|
+
declare const MetaboxBasicConfiguratorActions: {
|
|
67
|
+
readonly loadLevel: "loadLevel";
|
|
68
|
+
readonly setEnvironmentMaterialById: "setEnvironmentMaterialById";
|
|
69
|
+
readonly setProduct: "setProduct";
|
|
70
|
+
readonly setMaterialById: "setMaterialById";
|
|
71
|
+
readonly sendCommandToUnreal: "sendCommandToUnreal";
|
|
72
|
+
readonly getPdf: "getPdf";
|
|
73
|
+
readonly getScreenshot: "getScreenshot";
|
|
74
|
+
readonly getFastRender: "getFastRender";
|
|
75
|
+
readonly showEmbeddedMenu: "showEmbeddedMenu";
|
|
76
|
+
readonly forceSetDeviceType: "forceSetDeviceType";
|
|
77
|
+
readonly showOverlayInterface: "showOverlayInterface";
|
|
78
|
+
readonly resetCamera: "resetCamera";
|
|
79
|
+
readonly applyZoom: "applyZoom";
|
|
80
|
+
readonly initShowcase: "initShowcase";
|
|
81
|
+
readonly playShowcase: "playShowcase";
|
|
82
|
+
readonly pauseShowcase: "pauseShowcase";
|
|
83
|
+
readonly stopShowcase: "stopShowcase";
|
|
84
|
+
readonly watchCallbacks: "watchCallbacks";
|
|
85
|
+
readonly addResponse: "addResponse";
|
|
86
|
+
};
|
|
87
|
+
type ToMetaBoxActions = (typeof MetaboxBasicConfiguratorActions)[keyof typeof MetaboxBasicConfiguratorActions];
|
|
42
88
|
/**
|
|
43
89
|
* @internal
|
|
44
90
|
* @hidden
|
|
45
91
|
*/
|
|
46
92
|
type ToMetaboxMessagePayload = ToMetaboxMessagePayloads[keyof ToMetaboxMessagePayloads];
|
|
47
93
|
/**
|
|
48
|
-
* Interface for messages sent from the application to the
|
|
94
|
+
* Interface for messages sent from the application to the Basic Metabox API.
|
|
49
95
|
*/
|
|
50
96
|
interface ToMetaboxMessagePayloads {
|
|
51
|
-
getPdf: void;
|
|
52
|
-
loadLevel: {
|
|
97
|
+
[MetaboxBasicConfiguratorActions.getPdf]: void;
|
|
98
|
+
[MetaboxBasicConfiguratorActions.loadLevel]: {
|
|
53
99
|
id: string;
|
|
54
100
|
};
|
|
55
|
-
setProduct: {
|
|
101
|
+
[MetaboxBasicConfiguratorActions.setProduct]: {
|
|
56
102
|
productId: string;
|
|
57
103
|
};
|
|
58
104
|
/**
|
|
59
105
|
* @deprecated
|
|
60
106
|
* @hidden
|
|
61
107
|
*/
|
|
62
|
-
addResponse: void;
|
|
108
|
+
[MetaboxBasicConfiguratorActions.addResponse]: void;
|
|
63
109
|
/**
|
|
64
110
|
* @deprecated
|
|
65
111
|
* @hidden
|
|
66
112
|
*/
|
|
67
|
-
getFastRender: {
|
|
113
|
+
[MetaboxBasicConfiguratorActions.getFastRender]: {
|
|
68
114
|
format: MimeType;
|
|
69
115
|
size?: {
|
|
70
116
|
x: number;
|
|
71
117
|
y: number;
|
|
72
118
|
};
|
|
73
119
|
};
|
|
74
|
-
getScreenshot: {
|
|
120
|
+
[MetaboxBasicConfiguratorActions.getScreenshot]: {
|
|
75
121
|
format: MimeType;
|
|
76
122
|
size?: {
|
|
77
123
|
x: number;
|
|
78
124
|
y: number;
|
|
79
125
|
};
|
|
80
126
|
};
|
|
81
|
-
watchCallbacks: void;
|
|
82
|
-
setMaterialById: {
|
|
127
|
+
[MetaboxBasicConfiguratorActions.watchCallbacks]: void;
|
|
128
|
+
[MetaboxBasicConfiguratorActions.setMaterialById]: {
|
|
83
129
|
slotId: string;
|
|
84
130
|
materialId: string;
|
|
85
131
|
};
|
|
86
|
-
sendCommandToUnreal: MetaBoxCommandPacket;
|
|
87
|
-
setEnvironmentMaterialById: {
|
|
132
|
+
[MetaboxBasicConfiguratorActions.sendCommandToUnreal]: MetaBoxCommandPacket;
|
|
133
|
+
[MetaboxBasicConfiguratorActions.setEnvironmentMaterialById]: {
|
|
88
134
|
slotId: string;
|
|
89
135
|
materialId: string;
|
|
90
136
|
};
|
|
91
|
-
showEmbeddedMenu: {
|
|
137
|
+
[MetaboxBasicConfiguratorActions.showEmbeddedMenu]: {
|
|
92
138
|
visible: boolean;
|
|
93
139
|
};
|
|
94
|
-
showOverlayInterface: {
|
|
140
|
+
[MetaboxBasicConfiguratorActions.showOverlayInterface]: {
|
|
95
141
|
visible: boolean;
|
|
96
142
|
};
|
|
97
|
-
forceSetDeviceType: {
|
|
143
|
+
[MetaboxBasicConfiguratorActions.forceSetDeviceType]: {
|
|
98
144
|
deviceType: ApplicationDeviceTypes;
|
|
99
145
|
};
|
|
100
|
-
resetCamera: void;
|
|
146
|
+
[MetaboxBasicConfiguratorActions.resetCamera]: void;
|
|
147
|
+
[MetaboxBasicConfiguratorActions.applyZoom]: {
|
|
148
|
+
zoom: number;
|
|
149
|
+
};
|
|
150
|
+
[MetaboxBasicConfiguratorActions.initShowcase]: {
|
|
151
|
+
productId: string;
|
|
152
|
+
};
|
|
153
|
+
[MetaboxBasicConfiguratorActions.playShowcase]: void;
|
|
154
|
+
[MetaboxBasicConfiguratorActions.pauseShowcase]: void;
|
|
155
|
+
[MetaboxBasicConfiguratorActions.stopShowcase]: void;
|
|
101
156
|
}
|
|
102
157
|
interface ToMetaBoxMessageEnvelope {
|
|
103
158
|
action: ToMetaBoxActions;
|
|
@@ -109,297 +164,59 @@ interface ToMetaBoxMessage {
|
|
|
109
164
|
}
|
|
110
165
|
|
|
111
166
|
/**
|
|
112
|
-
*
|
|
113
|
-
|
|
114
|
-
declare class CommandBase {
|
|
115
|
-
data: ToMetaBoxMessageEnvelope;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Represents a command to toggle the Unreal Overlay Interface Menu.
|
|
120
|
-
*
|
|
121
|
-
* @remarks
|
|
122
|
-
* This action sends a message to the MetaBox API to toggle the visibility of the Unreal overlay UI.
|
|
123
|
-
*
|
|
124
|
-
* @example
|
|
125
|
-
* import { ShowOverlayInterface,Communicator } from '@3dsource/metabox-front-api';
|
|
126
|
-
*
|
|
127
|
-
* //...Assume that the integration is already implemented
|
|
128
|
-
* window.env3DSource.apiReady = (api:Communicator) => {
|
|
129
|
-
* api.setCommandToMetaBox(new ShowOverlayInterface(true));
|
|
130
|
-
* };
|
|
131
|
-
*/
|
|
132
|
-
declare class ShowOverlayInterface extends CommandBase {
|
|
133
|
-
/**
|
|
134
|
-
* Creates an instance of ShowOverlayInterface.
|
|
135
|
-
*
|
|
136
|
-
* @param visible - A flag indicating whether the Unreal overlay UI should be visible.
|
|
137
|
-
*/
|
|
138
|
-
constructor(visible: boolean);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Represents a command to toggle the Embedded MetaBox Menu.
|
|
143
|
-
*
|
|
144
|
-
* @example
|
|
145
|
-
* import { ShowEmbeddedMenu,Communicator } from '@3dsource/metabox-front-api';
|
|
146
|
-
*
|
|
147
|
-
* //...Assume that the integration is already implemented
|
|
148
|
-
* window.env3DSource.apiReady = (api:Communicator) => {
|
|
149
|
-
* api.setCommandToMetaBox(new ShowEmbeddedMenu(true));
|
|
150
|
-
* };
|
|
167
|
+
* Represents a basic configurator object with its configuration, selected materials,
|
|
168
|
+
* product identifier, and associated environment with its materials.
|
|
151
169
|
*/
|
|
152
|
-
|
|
170
|
+
interface ConfiguratorEnvelope {
|
|
153
171
|
/**
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* @param visible - A flag indicating whether the embedded menu should be visible.
|
|
172
|
+
* A reference to the universal configurator.
|
|
157
173
|
*/
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Represents a command to set the environment by its ID.
|
|
163
|
-
*
|
|
164
|
-
* @example
|
|
165
|
-
* import { SetEnvironment,Communicator } from '@3dsource/metabox-front-api';
|
|
166
|
-
*
|
|
167
|
-
* //...Assume that the integration is already implemented
|
|
168
|
-
* window.env3DSource.apiReady = (api:Communicator) => {
|
|
169
|
-
* // Change the environment to '55555555-1234-1234-1234-01234567890'
|
|
170
|
-
* api.sendCommandToMetaBox(new SetEnvironment('55555555-1234-1234-1234-01234567890'));
|
|
171
|
-
* };
|
|
172
|
-
*/
|
|
173
|
-
declare class SetEnvironment extends CommandBase {
|
|
174
|
+
configurator: UniversalConfigurator;
|
|
174
175
|
/**
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
* @param environmentId - The environment ID.
|
|
176
|
+
* The unique product identifier.
|
|
178
177
|
*/
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Represents a command to set a product by its ID.
|
|
184
|
-
*
|
|
185
|
-
* @remarks
|
|
186
|
-
* This action sends a message to the MetaBox API to set a product using the provided product ID.
|
|
187
|
-
*
|
|
188
|
-
* @example
|
|
189
|
-
* import { SetProduct,Communicator } from '@3dsource/metabox-front-api';
|
|
190
|
-
*
|
|
191
|
-
* //...Assume that the integration is already implemented
|
|
192
|
-
* window.env3DSource.apiReady = (api:Communicator) => {
|
|
193
|
-
* api.setCommandToMetaBox(new SetProduct(
|
|
194
|
-
* 'ffea6b5c-3a8a-4f56-9417-e605acb5cca3'
|
|
195
|
-
* ));
|
|
196
|
-
* };
|
|
197
|
-
*/
|
|
198
|
-
declare class SetProduct extends CommandBase {
|
|
178
|
+
productId: string;
|
|
199
179
|
/**
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
* @param productId - The product ID.
|
|
180
|
+
* A record mapping product material selections.
|
|
203
181
|
*/
|
|
204
|
-
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Represents a command to get a PDF from Metabox.
|
|
209
|
-
* @remarks
|
|
210
|
-
* This class sends a message to the MetaBox API to generate a PDF based on the current configuration.
|
|
211
|
-
* This action does not require any parameters.
|
|
212
|
-
*
|
|
213
|
-
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
214
|
-
*
|
|
215
|
-
* @example
|
|
216
|
-
* import { GetPdf,Communicator } from '@3dsource/metabox-front-api';
|
|
217
|
-
* window.env3DSource.apiReady = (api:Communicator) => {
|
|
218
|
-
* api.sendCommandToMetaBox(new GetPdf());
|
|
219
|
-
* };
|
|
220
|
-
*/
|
|
221
|
-
declare class GetPdf extends CommandBase {
|
|
182
|
+
productMaterialsIds: SelectedIds;
|
|
222
183
|
/**
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
* @
|
|
226
|
-
* This constructor does not require any parameters.
|
|
184
|
+
* @deprecated,
|
|
185
|
+
* use `productMaterialsIds` instead.
|
|
186
|
+
* @hidden
|
|
227
187
|
*/
|
|
228
|
-
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Represents a command to set a material by its ID.
|
|
233
|
-
*
|
|
234
|
-
* @example
|
|
235
|
-
* import { SetMaterial,Communicator } from '@3dsource/metabox-front-api';
|
|
236
|
-
*
|
|
237
|
-
* //...Assume that the integration is already implemented
|
|
238
|
-
* window.env3DSource.apiReady = (api:Communicator) => {
|
|
239
|
-
* api.sendCommandToMetaBox(new SetMaterial(
|
|
240
|
-
* 'carpaint',
|
|
241
|
-
* 'dd829d6e-9200-47a7-8d5b-af5df89b7e91',
|
|
242
|
-
* ));
|
|
243
|
-
* };
|
|
244
|
-
*/
|
|
245
|
-
declare class SetMaterial extends CommandBase {
|
|
188
|
+
selectedMaterials: SelectedIds;
|
|
246
189
|
/**
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
* @param slotId - The slot ID.
|
|
250
|
-
* @param materialId - The material ID.
|
|
190
|
+
* The unique environment identifier.
|
|
251
191
|
*/
|
|
252
|
-
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Represents a command to set an environment material by its ID.
|
|
257
|
-
*
|
|
258
|
-
* @example
|
|
259
|
-
* import { SetEnvironmentMaterial,Communicator } from '@3dsource/metabox-front-api';
|
|
260
|
-
*
|
|
261
|
-
* //...Assume that the integration is already implemented
|
|
262
|
-
* window.env3DSource.apiReady = (api:Communicator) => {
|
|
263
|
-
* api.sendCommandToMetaBox(new SetEnvironmentMaterial(
|
|
264
|
-
* 'carpaint',
|
|
265
|
-
* 'dd829d6e-9200-47a7-8d5b-af5df89b7e91',
|
|
266
|
-
* ));
|
|
267
|
-
* };
|
|
268
|
-
*/
|
|
269
|
-
declare class SetEnvironmentMaterial extends CommandBase {
|
|
192
|
+
environmentId: string;
|
|
270
193
|
/**
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
* @param slotId - The slot ID.
|
|
274
|
-
* @param materialId - The material ID.
|
|
194
|
+
* A record mapping environment material selections.
|
|
275
195
|
*/
|
|
276
|
-
|
|
196
|
+
environmentMaterialsIds: SelectedIds;
|
|
277
197
|
}
|
|
278
|
-
|
|
279
198
|
/**
|
|
280
|
-
*
|
|
281
|
-
* @hidden
|
|
282
|
-
* Represents a command to send Unreal command.
|
|
199
|
+
* Represents the universal configurator with its basic properties and components.
|
|
283
200
|
*/
|
|
284
|
-
|
|
285
|
-
|
|
201
|
+
interface UniversalConfigurator {
|
|
202
|
+
/** Unique identifier for the configurator. */
|
|
203
|
+
id: string;
|
|
204
|
+
/** Client information associated with the configurator. */
|
|
205
|
+
/** The name of the configurator. */
|
|
206
|
+
name: string;
|
|
207
|
+
/** Label for the product collection. */
|
|
208
|
+
productCollectionLabel: string;
|
|
209
|
+
/** A list of products for the configurator. */
|
|
210
|
+
products: UniversalConfiguratorProduct[];
|
|
211
|
+
/** A list of available environments. */
|
|
212
|
+
environments: UniversalConfiguratorEnvironment[];
|
|
213
|
+
/** The camera settings used in the configurator. */
|
|
214
|
+
/** Indicates if the configurator is active. */
|
|
215
|
+
/** GraphQL typename for the configurator. */
|
|
216
|
+
__typename: 'UniversalConfigurator';
|
|
286
217
|
}
|
|
287
218
|
/**
|
|
288
|
-
*
|
|
289
|
-
*/
|
|
290
|
-
declare const SendCommandToUnreal: typeof UnrealCommand;
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* @experimental
|
|
294
|
-
* @internal
|
|
295
|
-
* @hidden
|
|
296
|
-
* @remarks
|
|
297
|
-
* Represents a command to watch Unreal callbacks from Unreal engine.
|
|
298
|
-
* Can be useful for custom solutions.
|
|
299
|
-
*/
|
|
300
|
-
declare class WatchCallbacks extends CommandBase {
|
|
301
|
-
/**
|
|
302
|
-
* Creates an instance of WatchCallbacks.
|
|
303
|
-
*
|
|
304
|
-
* @remarks
|
|
305
|
-
* This constructor does not require any parameters.
|
|
306
|
-
*/
|
|
307
|
-
constructor();
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* Represents a callback listener for specific message types.
|
|
312
|
-
*/
|
|
313
|
-
interface Listener {
|
|
314
|
-
messageType: string;
|
|
315
|
-
callback: (data: unknown) => void;
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* EventDispatcher is a class that manages event listeners and dispatches events to them.
|
|
319
|
-
*/
|
|
320
|
-
declare class EventDispatcher {
|
|
321
|
-
/**
|
|
322
|
-
* Storage for callback listeners by message type.
|
|
323
|
-
*/
|
|
324
|
-
listeners: Listener[];
|
|
325
|
-
destroy(): void;
|
|
326
|
-
/**
|
|
327
|
-
* Adds an event listener for receiving specific types of messages.
|
|
328
|
-
*
|
|
329
|
-
* @param messageType - The message type to listen for.
|
|
330
|
-
* @param callback - The callback function to execute when a message is received.
|
|
331
|
-
*/
|
|
332
|
-
addEventListener(messageType: string, callback: (data: unknown) => void): this;
|
|
333
|
-
/**
|
|
334
|
-
* Dispatches an event to all listeners of a specific message type.
|
|
335
|
-
*
|
|
336
|
-
* @param messageType - The message type.
|
|
337
|
-
* @param data - The data associated with the event.
|
|
338
|
-
*/
|
|
339
|
-
dispatchEvent(messageType: string, data: unknown): this;
|
|
340
|
-
/**
|
|
341
|
-
* Removes an event listener for a specific type of message.
|
|
342
|
-
*
|
|
343
|
-
* @param messageType - The message type.
|
|
344
|
-
* @param callback - The callback function to remove.
|
|
345
|
-
*/
|
|
346
|
-
removeEventListener(messageType: string, callback: (data: unknown) => void): this;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* Represents a configurator object with its configuration, selected materials,
|
|
351
|
-
* product identifier, and associated environment.
|
|
352
|
-
*/
|
|
353
|
-
interface ConfiguratorEnvelope {
|
|
354
|
-
/**
|
|
355
|
-
* A reference to the universal configurator.
|
|
356
|
-
*/
|
|
357
|
-
configurator: UniversalConfigurator;
|
|
358
|
-
/**
|
|
359
|
-
* The unique product identifier.
|
|
360
|
-
*/
|
|
361
|
-
productId: string;
|
|
362
|
-
/**
|
|
363
|
-
* A record mapping product material selections.
|
|
364
|
-
*/
|
|
365
|
-
productMaterialsIds: SelectedIds;
|
|
366
|
-
/**
|
|
367
|
-
* @deprecated,
|
|
368
|
-
* use `productMaterialsIds` instead.
|
|
369
|
-
* @hidden
|
|
370
|
-
*/
|
|
371
|
-
selectedMaterials: SelectedIds;
|
|
372
|
-
/**
|
|
373
|
-
* The unique environment identifier.
|
|
374
|
-
*/
|
|
375
|
-
environmentId: string;
|
|
376
|
-
/**
|
|
377
|
-
* A record mapping environment material selections.
|
|
378
|
-
*/
|
|
379
|
-
environmentMaterialsIds: SelectedIds;
|
|
380
|
-
}
|
|
381
|
-
/**
|
|
382
|
-
* Represents the universal configurator with its basic properties and components.
|
|
383
|
-
*/
|
|
384
|
-
interface UniversalConfigurator {
|
|
385
|
-
/** Unique identifier for the configurator. */
|
|
386
|
-
id: string;
|
|
387
|
-
/** Indicates if the configurator is active. */
|
|
388
|
-
/** Label for the product collection. */
|
|
389
|
-
productCollectionLabel: string;
|
|
390
|
-
/** The name of the configurator. */
|
|
391
|
-
name: string;
|
|
392
|
-
/** The camera settings used in the configurator. */
|
|
393
|
-
/** Client information associated with the configurator. */
|
|
394
|
-
/** A list of products for the configurator. */
|
|
395
|
-
products: UniversalConfiguratorProduct[];
|
|
396
|
-
/** A list of available environments. */
|
|
397
|
-
environments: UniversalConfiguratorEnvironment[];
|
|
398
|
-
/** GraphQL typename for the configurator. */
|
|
399
|
-
__typename: 'UniversalConfigurator';
|
|
400
|
-
}
|
|
401
|
-
/**
|
|
402
|
-
* Represents a product within the universal configurator.
|
|
219
|
+
* Represents a product within the universal configurator.
|
|
403
220
|
*/
|
|
404
221
|
interface UniversalConfiguratorProduct {
|
|
405
222
|
/** The product's unique identifier. */
|
|
@@ -529,65 +346,10 @@ interface Environment {
|
|
|
529
346
|
* Defines the structure for a mapping of selected materials.
|
|
530
347
|
*/
|
|
531
348
|
type SelectedIds = Record<string, Record<string, string>>;
|
|
532
|
-
|
|
533
|
-
type FromMetaboxApiAction = 'bridge' | 'appLoaded';
|
|
534
|
-
/**
|
|
535
|
-
* @hidden
|
|
536
|
-
* Preserved for backward compatibility.
|
|
537
|
-
* @deprecated Use FromMetaboxApiAction type instead.
|
|
538
|
-
*/
|
|
539
|
-
type FromMetaboxDeprecatedApiAction =
|
|
540
|
-
/**
|
|
541
|
-
* @hidden
|
|
542
|
-
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "unrealFeature"
|
|
543
|
-
*/
|
|
544
|
-
'unrealFeatureBridge'
|
|
545
|
-
/**
|
|
546
|
-
* @hidden
|
|
547
|
-
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "unrealCallback"
|
|
548
|
-
*/
|
|
549
|
-
| 'unrealCallback'
|
|
550
|
-
/**
|
|
551
|
-
* @hidden
|
|
552
|
-
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "configuratorDataWithState"
|
|
553
|
-
*/
|
|
554
|
-
| 'configuratorDataWithStateBridge'
|
|
555
|
-
/**
|
|
556
|
-
* @hidden
|
|
557
|
-
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "configuratorDataWithState"
|
|
558
|
-
*/
|
|
559
|
-
| 'configuratorDataBridge'
|
|
560
|
-
/**
|
|
561
|
-
* @hidden
|
|
562
|
-
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "configuratorDataWithState"
|
|
563
|
-
*/
|
|
564
|
-
| 'menuDataBridge'
|
|
565
|
-
/**
|
|
566
|
-
* @hidden
|
|
567
|
-
* @deprecated, use MetaBoxApiAction.Bridge with eventType: "configuratorDataWithState"
|
|
568
|
-
*/
|
|
569
|
-
| 'flatMenuDataBridge'
|
|
570
|
-
/**
|
|
571
|
-
* @hidden
|
|
572
|
-
* @deprecated, use Bridge with isFullscreen
|
|
573
|
-
*/
|
|
574
|
-
| 'fullScreenBridge'
|
|
575
|
-
/**
|
|
576
|
-
* @hidden
|
|
577
|
-
* @deprecated, use Bridge with streamResolution
|
|
578
|
-
*/
|
|
579
|
-
| 'videoSize'
|
|
580
|
-
/**
|
|
581
|
-
* @hidden
|
|
582
|
-
* Used in a platform, must be removed in future
|
|
583
|
-
* @deprecated
|
|
584
|
-
*/
|
|
585
|
-
| 'unrealResponse'
|
|
586
349
|
/**
|
|
587
|
-
*
|
|
588
|
-
* @deprecated\
|
|
350
|
+
* Defines the structure for an available showcase status for the current product on a scene.
|
|
589
351
|
*/
|
|
590
|
-
| '
|
|
352
|
+
type ShowCaseStatus = 'init' | 'play' | 'pause' | 'stop';
|
|
591
353
|
|
|
592
354
|
interface FromMetaboxMessagePayloads {
|
|
593
355
|
/**
|
|
@@ -600,6 +362,10 @@ interface FromMetaboxMessagePayloads {
|
|
|
600
362
|
* @deprecated, use configuratorData instead.
|
|
601
363
|
*/
|
|
602
364
|
basicConfiguratorDataWithState: ConfiguratorEnvelope;
|
|
365
|
+
/**
|
|
366
|
+
* Dispatches Every time when the configurator product showcase will be changed.
|
|
367
|
+
*/
|
|
368
|
+
showcaseStatus: ShowCaseStatus;
|
|
603
369
|
/**
|
|
604
370
|
* Dispatches Every time when the configurator connected/disconnected with Unreal Engine.
|
|
605
371
|
*/
|
|
@@ -722,7 +488,53 @@ interface FromMetaBoxMessage {
|
|
|
722
488
|
}
|
|
723
489
|
|
|
724
490
|
/**
|
|
725
|
-
*
|
|
491
|
+
* Base class for commands sent to the Metabox API.
|
|
492
|
+
*/
|
|
493
|
+
declare class CommandBase {
|
|
494
|
+
data: ToMetaBoxMessageEnvelope;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Represents a callback listener for specific message types.
|
|
499
|
+
*/
|
|
500
|
+
interface Listener {
|
|
501
|
+
messageType: string;
|
|
502
|
+
callback: (data: unknown) => void;
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* EventDispatcher is a class that manages event listeners and dispatches events to them.
|
|
506
|
+
*/
|
|
507
|
+
declare class EventDispatcher {
|
|
508
|
+
/**
|
|
509
|
+
* Storage for callback listeners by message type.
|
|
510
|
+
*/
|
|
511
|
+
listeners: Listener[];
|
|
512
|
+
destroy(): void;
|
|
513
|
+
/**
|
|
514
|
+
* Adds an event listener for receiving specific types of messages.
|
|
515
|
+
*
|
|
516
|
+
* @param messageType - The message type to listen for.
|
|
517
|
+
* @param callback - The callback function to execute when a message is received.
|
|
518
|
+
*/
|
|
519
|
+
addEventListener(messageType: string, callback: (data: unknown) => void): this;
|
|
520
|
+
/**
|
|
521
|
+
* Dispatches an event to all listeners of a specific message type.
|
|
522
|
+
*
|
|
523
|
+
* @param messageType - The message type.
|
|
524
|
+
* @param data - The data associated with the event.
|
|
525
|
+
*/
|
|
526
|
+
dispatchEvent(messageType: string, data: unknown): this;
|
|
527
|
+
/**
|
|
528
|
+
* Removes an event listener for a specific type of message.
|
|
529
|
+
*
|
|
530
|
+
* @param messageType - The message type.
|
|
531
|
+
* @param callback - The callback function to remove.
|
|
532
|
+
*/
|
|
533
|
+
removeEventListener(messageType: string, callback: (data: unknown) => void): this;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Handles messaging between the host page and embedded Metabox content.
|
|
726
538
|
* @internal Use {@link Communicator.createInstance} or the {@link integrateMetaBox} helper to instantiate.
|
|
727
539
|
*/
|
|
728
540
|
declare class Communicator extends EventDispatcher {
|
|
@@ -740,8 +552,8 @@ declare class Communicator extends EventDispatcher {
|
|
|
740
552
|
*/
|
|
741
553
|
constructor();
|
|
742
554
|
/**
|
|
743
|
-
* Listens for
|
|
744
|
-
* @param apiReadyCallback - Called with the new Communicator once
|
|
555
|
+
* Listens for Metabox to signal readiness, then initializes communicator.
|
|
556
|
+
* @param apiReadyCallback - Called with the new Communicator once to the Metabox is loaded.
|
|
745
557
|
*/
|
|
746
558
|
static createInstance(apiReadyCallback: (api: Communicator) => void): void;
|
|
747
559
|
/**
|
|
@@ -749,12 +561,12 @@ declare class Communicator extends EventDispatcher {
|
|
|
749
561
|
*/
|
|
750
562
|
destroy(): void;
|
|
751
563
|
/**
|
|
752
|
-
* Posts a command to the
|
|
564
|
+
* Posts a command to the Metabox iframe.
|
|
753
565
|
* @param command - An action command containing data to send.
|
|
754
566
|
*/
|
|
755
567
|
sendCommandToMetaBox<T extends CommandBase>(command: T): void;
|
|
756
568
|
/**
|
|
757
|
-
* Registers an event listener for messages dispatched by
|
|
569
|
+
* Registers an event listener for messages dispatched by to the Metabox.
|
|
758
570
|
* @override
|
|
759
571
|
*/
|
|
760
572
|
addEventListener<T extends FromMetaBoxApiEvents>(messageType: T, callback: (data: FromMetaboxMessagePayloads[T]) => void): this;
|
|
@@ -769,29 +581,29 @@ declare class Communicator extends EventDispatcher {
|
|
|
769
581
|
*/
|
|
770
582
|
removeEventListener<T extends FromMetaBoxApiEvents>(messageType: T, callback: (data: FromMetaboxMessagePayloads[T]) => void): this;
|
|
771
583
|
/**
|
|
772
|
-
* Filters and dispatches incoming messages from
|
|
773
|
-
* @param messageType - Expected message type for filtering ('metaboxData').
|
|
774
|
-
* @param event - The postMessage event received on window.
|
|
584
|
+
* Filters and dispatches incoming messages from to the Metabox.
|
|
585
|
+
* @param {FromMetaBoxApiEvents | 'metaboxData' } messageType - Expected message type for filtering ('metaboxData').
|
|
586
|
+
* @param {MessageEvent} event - The postMessage event received on a window.
|
|
775
587
|
*/
|
|
776
588
|
private handleMessageReceived;
|
|
777
589
|
}
|
|
778
590
|
|
|
779
591
|
/**
|
|
780
|
-
* Integrates
|
|
592
|
+
* Integrates Metabox Basic Configurator into the provided layout.
|
|
781
593
|
*
|
|
782
594
|
* @remarks
|
|
783
595
|
* This function injects an iframe into a specified container element in the DOM and initializes
|
|
784
|
-
* the communicator for interacting with the
|
|
596
|
+
* the communicator for interacting with the Metabox embedded content.
|
|
785
597
|
*
|
|
786
|
-
* @param iframeSrc - The source URL of the
|
|
598
|
+
* @param {string} iframeSrc - The source URL of the Metabox iframe.
|
|
787
599
|
* Additional url parameters:
|
|
788
600
|
* ```javascript
|
|
789
|
-
* sidebar=false - disables the internal
|
|
601
|
+
* sidebar=false - disables the internal Metabox menu
|
|
790
602
|
* introImage=https://example.com/image.png - sets the intro image
|
|
791
603
|
* ```
|
|
792
|
-
* i.e
|
|
604
|
+
* i.e., a final link will look like https://metabox.3dsource.com/metabox-configurator/basic/your-configurator-id?sidebar=false&introImage=https://example.com/image.png
|
|
793
605
|
*
|
|
794
|
-
* @param containerId - The ID of the layout element. Defaults to 'embed3DSource'.
|
|
606
|
+
* @param {string} containerId - The ID of the layout element. Defaults to 'embed3DSource'.
|
|
795
607
|
* @param apiReadyCallback
|
|
796
608
|
* @throws Error if the container element with the specified ID is not found.
|
|
797
609
|
*
|
|
@@ -807,13 +619,6 @@ declare class Communicator extends EventDispatcher {
|
|
|
807
619
|
*/
|
|
808
620
|
declare function integrateMetaBox(iframeSrc: string, containerId: string | undefined, apiReadyCallback: (api: Communicator) => void): void;
|
|
809
621
|
|
|
810
|
-
/**
|
|
811
|
-
* Wrapper helper function to use it with rxJs the same as `fromEvent` to listen to events from the Communicator.
|
|
812
|
-
* @param target
|
|
813
|
-
* @param eventName
|
|
814
|
-
*/
|
|
815
|
-
declare function fromCommunicatorEvent<T extends FromMetaBoxApiEvents>(target: Communicator, eventName: T): Observable<FromMetaboxMessagePayloads[T]>;
|
|
816
|
-
|
|
817
622
|
/**
|
|
818
623
|
* Saves an image by triggering a download.
|
|
819
624
|
*
|
|
@@ -821,8 +626,8 @@ declare function fromCommunicatorEvent<T extends FromMetaBoxApiEvents>(target: C
|
|
|
821
626
|
* This function creates an anchor element, sets its `href` attribute to the provided image URL,
|
|
822
627
|
* and triggers a click event to initiate a download with the specified filename.
|
|
823
628
|
*
|
|
824
|
-
* @param imageUrl - The URL of the image to save.
|
|
825
|
-
* @param filename - The name of the file to save.
|
|
629
|
+
* @param {string} imageUrl - The URL of the image to save.
|
|
630
|
+
* @param {string} filename - The name of the file to save.
|
|
826
631
|
*/
|
|
827
632
|
declare function saveImage(imageUrl: string, filename: string): void;
|
|
828
633
|
|
|
@@ -832,7 +637,7 @@ declare function saveImage(imageUrl: string, filename: string): void;
|
|
|
832
637
|
* @remarks
|
|
833
638
|
* This function returns a promise that resolves after the given number of milliseconds.
|
|
834
639
|
*
|
|
835
|
-
* @param time - The time to sleep in milliseconds.
|
|
640
|
+
* @param {number} time - The time to sleep in milliseconds.
|
|
836
641
|
* @returns A promise that resolves after the specified duration.
|
|
837
642
|
*/
|
|
838
643
|
declare function sleep(time: number): Promise<void>;
|
|
@@ -843,7 +648,7 @@ declare function sleep(time: number): Promise<void>;
|
|
|
843
648
|
* @remarks
|
|
844
649
|
* This function updates the current URL by replacing its search parameters with the key-value pairs from the provided state object.
|
|
845
650
|
*
|
|
846
|
-
* @param state - An object containing key-value pairs to set as URL parameters.
|
|
651
|
+
* @param {Record<string, string>} state - An object containing key-value pairs to set as URL parameters.
|
|
847
652
|
*/
|
|
848
653
|
declare function setUrlParams(state: Record<string, string>): void;
|
|
849
654
|
/**
|
|
@@ -856,5 +661,372 @@ declare function setUrlParams(state: Record<string, string>): void;
|
|
|
856
661
|
*/
|
|
857
662
|
declare function getUrlParams(): Record<string, string>;
|
|
858
663
|
|
|
859
|
-
|
|
860
|
-
|
|
664
|
+
/**
|
|
665
|
+
* Wrapper helper function to use it with rxJs the same as `fromEvent` to listen to events from the Communicator.
|
|
666
|
+
* @param {Communicator} target
|
|
667
|
+
* @param eventName
|
|
668
|
+
*/
|
|
669
|
+
declare function fromCommunicatorEvent<T extends FromMetaBoxApiEvents>(target: Communicator, eventName: T): Observable<FromMetaboxMessagePayloads[T]>;
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* Represents a command to get a PDF from Metabox.
|
|
673
|
+
* @remarks
|
|
674
|
+
* This class sends a message to the Metabox API to generate a PDF based on the current configuration.
|
|
675
|
+
* This action does not require any parameters.
|
|
676
|
+
*
|
|
677
|
+
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
678
|
+
*
|
|
679
|
+
* @example
|
|
680
|
+
* import { GetPdf, Communicator } from '@3dsource/metabox-front-api';
|
|
681
|
+
* window.env3DSource.apiReady = (api:Communicator) => {
|
|
682
|
+
* api.sendCommandToMetaBox(new GetPdf());
|
|
683
|
+
* };
|
|
684
|
+
*/
|
|
685
|
+
declare class GetPdf extends CommandBase {
|
|
686
|
+
/**
|
|
687
|
+
* Creates an instance of GetPdf.
|
|
688
|
+
*
|
|
689
|
+
* @remarks
|
|
690
|
+
* This constructor does not require any parameters.
|
|
691
|
+
*/
|
|
692
|
+
constructor();
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* Represents a command to send to unreal and reset camera to initial.
|
|
697
|
+
* @remarks
|
|
698
|
+
* This class sends a message to the Metabox API to reset the camera on a scene.
|
|
699
|
+
* This action does not require any parameters.
|
|
700
|
+
*
|
|
701
|
+
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
702
|
+
*
|
|
703
|
+
* @example
|
|
704
|
+
* import { ResetCamera, Communicator } from '@3dsource/metabox-front-api';
|
|
705
|
+
* window.env3DSource.apiReady = (api:Communicator) => {
|
|
706
|
+
* api.sendCommandToMetaBox(new ResetCamera());
|
|
707
|
+
* };
|
|
708
|
+
*/
|
|
709
|
+
declare class ResetCamera extends CommandBase {
|
|
710
|
+
/**
|
|
711
|
+
* Creates an instance of ResetCamera.
|
|
712
|
+
*
|
|
713
|
+
* @remarks
|
|
714
|
+
* This constructor does not require any parameters.
|
|
715
|
+
*/
|
|
716
|
+
constructor();
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* Represents a command to ApplyZoom and change zoom camera on a scene.
|
|
721
|
+
* @remarks
|
|
722
|
+
* This class sends a command to the Metabox API to change zoom on a scene.
|
|
723
|
+
*
|
|
724
|
+
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
725
|
+
*
|
|
726
|
+
* @example
|
|
727
|
+
* import { ApplyZoom, Communicator } from '@3dsource/metabox-front-api';
|
|
728
|
+
* window.env3DSource.apiReady = (api:Communicator) => {
|
|
729
|
+
* api.sendCommandToMetaBox(new ApplyZoom(10));
|
|
730
|
+
* api.sendCommandToMetaBox(new ApplyZoom(-10));
|
|
731
|
+
* };
|
|
732
|
+
*/
|
|
733
|
+
declare class ApplyZoom extends CommandBase {
|
|
734
|
+
/**
|
|
735
|
+
* Creates an instance of ApplyZoom.
|
|
736
|
+
*
|
|
737
|
+
* @param {...number} zoom
|
|
738
|
+
*/
|
|
739
|
+
constructor(zoom: number);
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* Represents a command to Init Showcase for a product on a scene and start a sequence for the product.
|
|
744
|
+
* @remarks
|
|
745
|
+
* This class sends a command to the Metabox API to init showcase if the product has a sequence.
|
|
746
|
+
*
|
|
747
|
+
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
748
|
+
*
|
|
749
|
+
* @example
|
|
750
|
+
* import { InitShowcase, Communicator } from '@3dsource/metabox-front-api';
|
|
751
|
+
* window.env3DSource.apiReady = (api:Communicator) => {
|
|
752
|
+
* api.sendCommandToMetaBox(new InitShowcase('ffea6b5c-3a8a-4f56-9417-e605acb5cca3');
|
|
753
|
+
* };
|
|
754
|
+
*/
|
|
755
|
+
declare class InitShowcase extends CommandBase {
|
|
756
|
+
/**
|
|
757
|
+
* Creates an instance of InitShowcase.
|
|
758
|
+
*
|
|
759
|
+
* @param {string} productId
|
|
760
|
+
*/
|
|
761
|
+
constructor(productId: string);
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* Represents a command to Play Showcase for a product when it already init, and you call pause, for example, before it.
|
|
766
|
+
* @remarks
|
|
767
|
+
* This class sends a command to the Metabox API to play showcase for a product if it is already initialized and pause.
|
|
768
|
+
*
|
|
769
|
+
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
770
|
+
*
|
|
771
|
+
* @example
|
|
772
|
+
* import { PlayShowcase, Communicator } from '@3dsource/metabox-front-api';
|
|
773
|
+
* window.env3DSource.apiReady = (api:Communicator) => {
|
|
774
|
+
* api.sendCommandToMetaBox(new PlayShowcase());
|
|
775
|
+
* };
|
|
776
|
+
*/
|
|
777
|
+
declare class PlayShowcase extends CommandBase {
|
|
778
|
+
/**
|
|
779
|
+
* Creates an instance of PlayShowcase.
|
|
780
|
+
*
|
|
781
|
+
* @remarks
|
|
782
|
+
* This constructor does not require any parameters.
|
|
783
|
+
*/
|
|
784
|
+
constructor();
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* Represents a command to Pause Showcase for a product when it already init and play, and you call pause.
|
|
789
|
+
* @remarks
|
|
790
|
+
* This class sends a command to the Metabox API to pause showcase for a product if it is already initialized and play.
|
|
791
|
+
*
|
|
792
|
+
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
793
|
+
*
|
|
794
|
+
* @example
|
|
795
|
+
* import { PauseShowcase, Communicator } from '@3dsource/metabox-front-api';
|
|
796
|
+
* window.env3DSource.apiReady = (api:Communicator) => {
|
|
797
|
+
* api.sendCommandToMetaBox(new PauseShowcase());
|
|
798
|
+
* };
|
|
799
|
+
*/
|
|
800
|
+
declare class PauseShowcase extends CommandBase {
|
|
801
|
+
/**
|
|
802
|
+
* Creates an instance of PauseShowcase.
|
|
803
|
+
*
|
|
804
|
+
* @remarks
|
|
805
|
+
* This constructor does not require any parameters.
|
|
806
|
+
*/
|
|
807
|
+
constructor();
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* Represents a command to Stop Showcase for a product when it already init, and you want to destroy it.
|
|
812
|
+
* @remarks
|
|
813
|
+
* This class sends a command to the Metabox API to Stop showcase for a product if it is already initialized.
|
|
814
|
+
*
|
|
815
|
+
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
816
|
+
*
|
|
817
|
+
* @example
|
|
818
|
+
* import { StopShowcase, Communicator } from '@3dsource/metabox-front-api';
|
|
819
|
+
* window.env3DSource.apiReady = (api:Communicator) => {
|
|
820
|
+
* api.sendCommandToMetaBox(new StopShowcase());
|
|
821
|
+
* };
|
|
822
|
+
*/
|
|
823
|
+
declare class StopShowcase extends CommandBase {
|
|
824
|
+
/**
|
|
825
|
+
* Creates an instance of StopShowcase.
|
|
826
|
+
*
|
|
827
|
+
* @remarks
|
|
828
|
+
* This constructor does not require any parameters.
|
|
829
|
+
*/
|
|
830
|
+
constructor();
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
/**
|
|
834
|
+
* Image format.
|
|
835
|
+
* @remarks
|
|
836
|
+
* This type represents the allowed image formats.
|
|
837
|
+
*/
|
|
838
|
+
type MimeType = 'image/png' | 'image/jpeg' | 'image/webp';
|
|
839
|
+
/**
|
|
840
|
+
* Represents a command to get a screenshot.
|
|
841
|
+
*
|
|
842
|
+
* **Important**: Invoking this command will buffer it until the viewport is ready. Only then will the request be processed.
|
|
843
|
+
*
|
|
844
|
+
* @example
|
|
845
|
+
* import { GetScreenshot, Communicator, saveImage } from '@3dsource/metabox-front-api';
|
|
846
|
+
* window.env3DSource.apiReady = (api:Communicator) => {
|
|
847
|
+
* // Listen for events from to the Metabox API
|
|
848
|
+
* api.addEventListener('screenshot', (data) => {
|
|
849
|
+
* // Process the get screenshot response
|
|
850
|
+
* saveImage(data, 'Render.png');
|
|
851
|
+
* });
|
|
852
|
+
* api.sendCommandToMetaBox(new GetScreenshot('image/png', { x: 1024, y: 1024 }));
|
|
853
|
+
* };
|
|
854
|
+
*/
|
|
855
|
+
declare class GetScreenshot extends CommandBase {
|
|
856
|
+
/**
|
|
857
|
+
* Constructs an instance of GetScreenshot.
|
|
858
|
+
* @param {MimeType} mimeType - The output format.
|
|
859
|
+
* @param {{ x: number; y: number }} [size] - Optional size in pixels.
|
|
860
|
+
*/
|
|
861
|
+
constructor(mimeType: MimeType, size?: {
|
|
862
|
+
x: number;
|
|
863
|
+
y: number;
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* Represents a command to set a product by its ID.
|
|
869
|
+
*
|
|
870
|
+
* @remarks
|
|
871
|
+
* This action sends a message to the Metabox API to set a product using the provided product ID.
|
|
872
|
+
*
|
|
873
|
+
* @example
|
|
874
|
+
* import { SetProduct, Communicator } from '@3dsource/metabox-front-api';
|
|
875
|
+
*
|
|
876
|
+
* //...Assume that the integration is already implemented
|
|
877
|
+
* window.env3DSource.apiReady = (api:Communicator) => {
|
|
878
|
+
* api.setCommandToMetaBox(new SetProduct(
|
|
879
|
+
* 'ffea6b5c-3a8a-4f56-9417-e605acb5cca3'
|
|
880
|
+
* ));
|
|
881
|
+
* };
|
|
882
|
+
*/
|
|
883
|
+
declare class SetProduct extends CommandBase {
|
|
884
|
+
/**
|
|
885
|
+
* Creates an instance of SetProduct.
|
|
886
|
+
*
|
|
887
|
+
* @param {string} productId - The product ID.
|
|
888
|
+
*/
|
|
889
|
+
constructor(productId: string);
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
/**
|
|
893
|
+
* Represents a command to set a material by its slot ID and Material ID.
|
|
894
|
+
*
|
|
895
|
+
* @example
|
|
896
|
+
* import { SetMaterial, Communicator } from '@3dsource/metabox-front-api';
|
|
897
|
+
*
|
|
898
|
+
* //...Assume that the integration is already implemented
|
|
899
|
+
* window.env3DSource.apiReady = (api:Communicator) => {
|
|
900
|
+
* api.sendCommandToMetaBox(new SetMaterial(
|
|
901
|
+
* 'carpaint',
|
|
902
|
+
* 'dd829d6e-9200-47a7-8d5b-af5df89b7e91',
|
|
903
|
+
* ));
|
|
904
|
+
* };
|
|
905
|
+
*/
|
|
906
|
+
declare class SetMaterial extends CommandBase {
|
|
907
|
+
/**
|
|
908
|
+
* Creates an instance of SetMaterial.
|
|
909
|
+
*
|
|
910
|
+
* @param {string} slotId - The slot ID.
|
|
911
|
+
* @param {string} materialId - The material ID.
|
|
912
|
+
*/
|
|
913
|
+
constructor(slotId: string, materialId: string);
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
/**
|
|
917
|
+
* Represents a command to set the environment by its ID.
|
|
918
|
+
*
|
|
919
|
+
* @example
|
|
920
|
+
* import { SetEnvironment, Communicator } from '@3dsource/metabox-front-api';
|
|
921
|
+
*
|
|
922
|
+
* //...Assume that the integration is already implemented
|
|
923
|
+
* window.env3DSource.apiReady = (api:Communicator) => {
|
|
924
|
+
* // Change the environment to '55555555-1234-1234-1234-01234567890'
|
|
925
|
+
* api.sendCommandToMetaBox(new SetEnvironment('55555555-1234-1234-1234-01234567890'));
|
|
926
|
+
* };
|
|
927
|
+
*/
|
|
928
|
+
declare class SetEnvironment extends CommandBase {
|
|
929
|
+
/**
|
|
930
|
+
* Creates an instance of SetEnvironment.
|
|
931
|
+
*
|
|
932
|
+
* @param {string} environmentId - The environment ID.
|
|
933
|
+
*/
|
|
934
|
+
constructor(environmentId: string);
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
/**
|
|
938
|
+
* Represents a command to set an environment material by its slot ID and Material ID.
|
|
939
|
+
*
|
|
940
|
+
* @example
|
|
941
|
+
* import { SetEnvironmentMaterial, Communicator } from '@3dsource/metabox-front-api';
|
|
942
|
+
*
|
|
943
|
+
* //...Assume that the integration is already implemented
|
|
944
|
+
* window.env3DSource.apiReady = (api:Communicator) => {
|
|
945
|
+
* api.sendCommandToMetaBox(new SetEnvironmentMaterial(
|
|
946
|
+
* 'carpaint',
|
|
947
|
+
* 'dd829d6e-9200-47a7-8d5b-af5df89b7e91',
|
|
948
|
+
* ));
|
|
949
|
+
* };
|
|
950
|
+
*/
|
|
951
|
+
declare class SetEnvironmentMaterial extends CommandBase {
|
|
952
|
+
/**
|
|
953
|
+
* Creates an instance of SetEnvironmentMaterial.
|
|
954
|
+
*
|
|
955
|
+
* @param {string} slotId - The slot ID.
|
|
956
|
+
* @param {string} materialId - The material ID.
|
|
957
|
+
*/
|
|
958
|
+
constructor(slotId: string, materialId: string);
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
/**
|
|
962
|
+
* Represents a command to toggle the Embedded to the Metabox Menu.
|
|
963
|
+
*
|
|
964
|
+
* @example
|
|
965
|
+
* import { ShowEmbeddedMenu, Communicator } from '@3dsource/metabox-front-api';
|
|
966
|
+
*
|
|
967
|
+
* //...Assume that the integration is already implemented
|
|
968
|
+
* window.env3DSource.apiReady = (api:Communicator) => {
|
|
969
|
+
* api.setCommandToMetaBox(new ShowEmbeddedMenu(true));
|
|
970
|
+
* };
|
|
971
|
+
*/
|
|
972
|
+
declare class ShowEmbeddedMenu extends CommandBase {
|
|
973
|
+
/**
|
|
974
|
+
* Creates an instance of ShowEmbeddedMenu.
|
|
975
|
+
*
|
|
976
|
+
* @param {boolean} visible - A flag indicating whether the embedded menu should be visible.
|
|
977
|
+
*/
|
|
978
|
+
constructor(visible: boolean);
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* Represents a command to toggle the Unreal Overlay Interface Menu.
|
|
983
|
+
*
|
|
984
|
+
* @remarks
|
|
985
|
+
* This action sends a message to the Metabox API to toggle the visibility of the Unreal overlay UI.
|
|
986
|
+
*
|
|
987
|
+
* @example
|
|
988
|
+
* import { ShowOverlayInterface, Communicator } from '@3dsource/metabox-front-api';
|
|
989
|
+
*
|
|
990
|
+
* //...Assume that the integration is already implemented
|
|
991
|
+
* window.env3DSource.apiReady = (api:Communicator) => {
|
|
992
|
+
* api.setCommandToMetaBox(new ShowOverlayInterface(true));
|
|
993
|
+
* };
|
|
994
|
+
*/
|
|
995
|
+
declare class ShowOverlayInterface extends CommandBase {
|
|
996
|
+
/**
|
|
997
|
+
* Creates an instance of ShowOverlayInterface.
|
|
998
|
+
*
|
|
999
|
+
* @param {boolean} visible - A flag indicating whether the Unreal overlay UI should be visible.
|
|
1000
|
+
*/
|
|
1001
|
+
constructor(visible: boolean);
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
/**
|
|
1005
|
+
* @internal
|
|
1006
|
+
* @hidden
|
|
1007
|
+
* Represents a command to send Unreal command.
|
|
1008
|
+
*/
|
|
1009
|
+
declare class UnrealCommand extends CommandBase {
|
|
1010
|
+
constructor(payload: MetaBoxCommandPacket);
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
/**
|
|
1014
|
+
* @experimental
|
|
1015
|
+
* @internal
|
|
1016
|
+
* @hidden
|
|
1017
|
+
* @remarks
|
|
1018
|
+
* Represents a command to watch Unreal callbacks from Unreal engine.
|
|
1019
|
+
* Can be useful for custom solutions.
|
|
1020
|
+
*/
|
|
1021
|
+
declare class WatchCallbacks extends CommandBase {
|
|
1022
|
+
/**
|
|
1023
|
+
* Creates an instance of WatchCallbacks.
|
|
1024
|
+
*
|
|
1025
|
+
* @remarks
|
|
1026
|
+
* This constructor does not require any parameters.
|
|
1027
|
+
*/
|
|
1028
|
+
constructor();
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
export { ApplyZoom, CommandBase, Communicator, EventDispatcher, GetPdf, GetScreenshot, InitShowcase, MetaboxBasicConfiguratorActions, PauseShowcase, PlayShowcase, ResetCamera, SetEnvironment, SetEnvironmentMaterial, SetMaterial, SetProduct, ShowEmbeddedMenu, ShowOverlayInterface, StopShowcase, UnrealCommand, WatchCallbacks, fromCommunicatorEvent, getUrlParams, integrateMetaBox, saveImage, setUrlParams, sleep };
|
|
1032
|
+
export type { ApplicationDeviceTypes, ConfiguratorEnvelope, DeprecatedEnvelope, Environment, FromMetaBoxAPIEnvelope, FromMetaBoxApiEvents, FromMetaBoxMessage, FromMetaboxApiAction, FromMetaboxDeprecatedApiAction, FromMetaboxMessagePayloads, MCAppLoaded, Material, MetaBoxApiEnvelope, MetaProperty, MimeType, Product, SelectedIds, ShowCaseStatus, Slot, Thumbnail, ToMetaBoxActions, ToMetaBoxMessage, ToMetaBoxMessageEnvelope, ToMetaboxMessagePayload, ToMetaboxMessagePayloads, UniversalConfigurator, UniversalConfiguratorEnvironment, UniversalConfiguratorProduct };
|