@threekit-tools/treble 0.0.44 → 0.0.48

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.
@@ -1,13 +1,10 @@
1
1
  import React from 'react';
2
- interface TabPaneProps extends React.FC {
2
+ interface ITabPaneProps {
3
3
  label: string;
4
4
  onClick: () => void;
5
5
  }
6
- interface TabsProps<T> {
7
- children: React.FunctionComponentElement<T>;
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;
package/dist/index.d.ts CHANGED
@@ -25,7 +25,7 @@ import AttributeTitle from './components/AttributeTitle';
25
25
  import AttributeValue from './components/AttributeValue';
26
26
  import TotalPrice from './components/TotalPrice';
27
27
  import message from './components/message';
28
- import Modal from './components/TotalPrice';
28
+ import Modal from './components/Modal';
29
29
  import Drawer from './components/Drawer';
30
30
  import Accordion from './components/Accordion';
31
31
  import Tabs from './components/Tabs';
package/dist/index.js CHANGED
@@ -74,8 +74,8 @@ exports.TotalPrice = TotalPrice_1.default;
74
74
  var message_1 = __importDefault(require("./components/message"));
75
75
  exports.message = message_1.default;
76
76
  // Layouts
77
- var TotalPrice_2 = __importDefault(require("./components/TotalPrice"));
78
- exports.Modal = TotalPrice_2.default;
77
+ var Modal_1 = __importDefault(require("./components/Modal"));
78
+ exports.Modal = Modal_1.default;
79
79
  var Drawer_1 = __importDefault(require("./components/Drawer"));
80
80
  exports.Drawer = Drawer_1.default;
81
81
  var Accordion_1 = __importDefault(require("./components/Accordion"));
@@ -292,11 +292,13 @@ var launch = function (launchConfig) {
292
292
  configurationId = product;
293
293
  }
294
294
  else {
295
- if ((0, utils_1.isUuid)(product.assetId))
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 }, playerConfig)),
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));
@@ -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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threekit-tools/treble",
3
- "version": "0.0.44",
3
+ "version": "0.0.48",
4
4
  "author": "Amaan Saeed",
5
5
  "license": "MIT",
6
6
  "files": [