@threekit-tools/treble 0.0.45 → 0.0.49
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.
|
@@ -35,18 +35,20 @@ var Player = function (props) {
|
|
|
35
35
|
minHeight: '600px',
|
|
36
36
|
width: '100%',
|
|
37
37
|
}, props), height = _a.height, width = _a.width, minHeight = _a.minHeight, children = _a.children;
|
|
38
|
-
var hasMoved = (0, react_1.useRef)(false);
|
|
39
38
|
var _b = (0, usePlayerPortal_1.default)(), portalPlayerTo = _b[0], portalBack = _b[1];
|
|
39
|
+
var hasMoved = (0, react_1.useRef)(false);
|
|
40
40
|
(0, react_1.useEffect)(function () {
|
|
41
41
|
if (portalPlayerTo && !hasMoved.current) {
|
|
42
42
|
portalPlayerTo(exports.PLAYER_DIV_ID);
|
|
43
43
|
hasMoved.current = true;
|
|
44
44
|
}
|
|
45
45
|
return function () {
|
|
46
|
-
if (portalBack)
|
|
46
|
+
if (portalBack) {
|
|
47
47
|
portalBack();
|
|
48
|
+
hasMoved.current = false;
|
|
49
|
+
}
|
|
48
50
|
};
|
|
49
|
-
});
|
|
51
|
+
}, [portalPlayerTo]);
|
|
50
52
|
return (react_1.default.createElement(player_styles_1.Wrapper, { height: height, width: width, minHeight: minHeight, className: className },
|
|
51
53
|
react_1.default.createElement("div", { id: exports.PLAYER_DIV_ID }),
|
|
52
54
|
children));
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
interface
|
|
2
|
+
interface ITabPaneProps {
|
|
3
3
|
label: string;
|
|
4
4
|
onClick: () => void;
|
|
5
5
|
}
|
|
6
|
-
interface
|
|
7
|
-
|
|
6
|
+
interface ITabs {
|
|
7
|
+
TabPane: React.FC<ITabPaneProps>;
|
|
8
8
|
}
|
|
9
|
-
export declare const Tabs:
|
|
10
|
-
({ children }: TabsProps<TabPaneProps>): JSX.Element | null;
|
|
11
|
-
TabPane: React.FC<{}>;
|
|
12
|
-
};
|
|
9
|
+
export declare const Tabs: ITabs;
|
|
13
10
|
export default Tabs;
|
|
@@ -31,7 +31,7 @@ var productComponents = [];
|
|
|
31
31
|
var productToComponentMap = {};
|
|
32
32
|
function TrebleApp(props) {
|
|
33
33
|
var _a;
|
|
34
|
-
var project = props.project, productId = props.productId, playerConfig = props.playerConfig, threekitEnv = props.threekitEnv, locale = props.locale, theme = props.theme;
|
|
34
|
+
var project = props.project, productId = props.productId, playerConfig = props.playerConfig, threekitEnv = props.threekitEnv, locale = props.locale, theme = props.theme, eventHandlers = props.eventHandlers;
|
|
35
35
|
var config = constants_1.IS_TREBLE_SCRIPTS ? (0, utils_1.loadTrebleConfig)() : {};
|
|
36
36
|
if (!((_a = config.treble) === null || _a === void 0 ? void 0 : _a.productsCtx)) {
|
|
37
37
|
console.error('Treble Config is not setup correctly');
|
|
@@ -75,7 +75,7 @@ function TrebleApp(props) {
|
|
|
75
75
|
var preppedProject = Object.assign({}, project, {
|
|
76
76
|
products: productsMap[id],
|
|
77
77
|
});
|
|
78
|
-
return (react_1.default.createElement(ThreekitProvider_1.default, { project: preppedProject, locale: locale, playerConfig: playerConfig, theme: theme, threekitEnv: threekitEnv },
|
|
78
|
+
return (react_1.default.createElement(ThreekitProvider_1.default, { project: preppedProject, locale: locale, playerConfig: playerConfig, theme: theme, threekitEnv: threekitEnv, eventHandlers: eventHandlers },
|
|
79
79
|
react_1.default.createElement(Product, null)));
|
|
80
80
|
}
|
|
81
81
|
exports.default = TrebleApp;
|
|
@@ -26,7 +26,6 @@ var usePlayerPortal = function () {
|
|
|
26
26
|
htmlElements.current.playerWrapper.appendChild(htmlElements.current.player);
|
|
27
27
|
};
|
|
28
28
|
var returnPlayer = function () {
|
|
29
|
-
constants_1.TK_PLAYER_LOADER_DIV;
|
|
30
29
|
if (!htmlElements.current.player)
|
|
31
30
|
htmlElements.current.player = document.getElementById(playerElementId);
|
|
32
31
|
if (!htmlElements.current.playerLoader)
|
package/dist/store/threekit.js
CHANGED
|
@@ -292,11 +292,13 @@ var launch = function (launchConfig) {
|
|
|
292
292
|
configurationId = product;
|
|
293
293
|
}
|
|
294
294
|
else {
|
|
295
|
-
|
|
295
|
+
stageId = product.stageId;
|
|
296
|
+
if (product.configurationId)
|
|
297
|
+
configurationId = product.configurationId;
|
|
298
|
+
else if ((0, utils_1.isUuid)(product.assetId))
|
|
296
299
|
assetId = product.assetId;
|
|
297
300
|
else
|
|
298
301
|
configurationId = product.assetId;
|
|
299
|
-
stageId = product.stageId;
|
|
300
302
|
}
|
|
301
303
|
if (playerConfig.elementId) {
|
|
302
304
|
el = document.getElementById(playerConfig.elementId);
|
|
@@ -340,9 +342,9 @@ var launch = function (launchConfig) {
|
|
|
340
342
|
// We create the threekit script
|
|
341
343
|
_j.sent();
|
|
342
344
|
return [4 /*yield*/, Promise.all([
|
|
343
|
-
window.threekitPlayer(__assign({ el: el,
|
|
345
|
+
window.threekitPlayer(__assign(__assign({ el: el,
|
|
344
346
|
// Variables to sort out
|
|
345
|
-
authToken: authToken, stageId: stageId, assetId: updatedAssetId, initialConfiguration: initialConfiguration }
|
|
347
|
+
authToken: authToken, stageId: stageId, assetId: updatedAssetId }, playerConfig), { initialConfiguration: initialConfiguration })),
|
|
346
348
|
api_1.default.products.fetchTranslations(),
|
|
347
349
|
api_1.default.price.getPricebooksList(),
|
|
348
350
|
])];
|
|
@@ -357,6 +359,9 @@ var launch = function (launchConfig) {
|
|
|
357
359
|
_b.threekit = (_c.configurator = _j.sent(),
|
|
358
360
|
_c.treble = new Treble_1.default({ player: player }),
|
|
359
361
|
_c);
|
|
362
|
+
window.threekit.player.on('setConfiguration', function () {
|
|
363
|
+
dispatch(setAttributes(window.threekit.configurator.getDisplayAttributes()));
|
|
364
|
+
});
|
|
360
365
|
if (launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.locale) {
|
|
361
366
|
dispatch(setLanguage(launchConfig.locale));
|
|
362
367
|
dispatch(setTranslations(translations));
|
package/dist/threekit.d.ts
CHANGED
|
@@ -187,7 +187,7 @@ export interface IThreekitPlayer {
|
|
|
187
187
|
tools: IThreekitTools;
|
|
188
188
|
camera: IThreekitCamera;
|
|
189
189
|
setActiveCamera: () => void;
|
|
190
|
-
on: (phase: SCENE_PHASES) => void;
|
|
190
|
+
on: (phase: SCENE_PHASES | string, callback: (args: any) => void) => void;
|
|
191
191
|
getConfigurator: () => Promise<IThreekitConfigurator>;
|
|
192
192
|
enableApi: (api: PRIVATE_APIS) => any;
|
|
193
193
|
snapshotAsync: (snapshotConfig: ISnapshotConfig) => Promise<string>;
|
|
@@ -237,6 +237,7 @@ export interface IPlayerConfig extends Omit<ThreekitInitConfig, 'el' | 'authToke
|
|
|
237
237
|
elementId?: string;
|
|
238
238
|
}
|
|
239
239
|
export interface IProduct extends Pick<ThreekitInitConfig, 'assetId' | 'stageId' | 'initialConfiguration'> {
|
|
240
|
+
configurationId?: string;
|
|
240
241
|
}
|
|
241
242
|
export interface IProducts extends Record<string, string | Partial<IProduct>> {
|
|
242
243
|
}
|