@threekit-tools/treble 0.0.93 → 0.0.94

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.
@@ -22,7 +22,7 @@ declare class Treble {
22
22
  _player: IThreekitPrivatePlayer;
23
23
  wishlist: IWishlist;
24
24
  private _snapshots;
25
- takeSnapshots: typeof snapshots['takeSnapshots'];
25
+ takeSnapshots: (typeof snapshots)['takeSnapshots'];
26
26
  _debugMode: boolean;
27
27
  constructor({ player, orgId }: ITreble);
28
28
  createOrder: (order?: IOrder) => Promise<import("../http/orders").IOrderResponse>;
@@ -66,6 +66,11 @@ function TrebleApp(props) {
66
66
  react_1.Children.forEach(Object.values(productComponents).map(function (el) { return el({}); }), function (jsx, i) {
67
67
  if (!jsx)
68
68
  return;
69
+ if (typeof jsx === 'string' ||
70
+ typeof jsx === 'boolean' ||
71
+ typeof jsx === 'number' ||
72
+ !('props' in jsx))
73
+ return;
69
74
  if (!jsx.props.products)
70
75
  return;
71
76
  var products = jsx.props.products;
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React from 'react';
2
2
  export interface IIconProps {
3
3
  color?: string;
4
4
  }
package/dist/types.d.ts CHANGED
@@ -277,6 +277,7 @@ export interface IThreekitConfigurator {
277
277
  getMetadata: () => IMetadata;
278
278
  getAttributes: () => Array<IThreekitAttribute>;
279
279
  getConfiguration: () => IConfiguration;
280
+ getResolvedConfiguration: () => IConfiguration;
280
281
  setConfiguration: (configuration: ISetConfiguration | IConfiguration) => Promise<IConfiguration>;
281
282
  getPrice: (pricebookId: string, currency: string) => number;
282
283
  getDisplayAttributes: (config?: IDisplayAttributeConfig) => Array<IThreekitDisplayAttribute>;
package/dist/utils.js CHANGED
@@ -304,7 +304,9 @@ var metadataValueToObject = function (data) {
304
304
  };
305
305
  exports.metadataValueToObject = metadataValueToObject;
306
306
  var hydrateAttribute = function (data, optionSelectionHandler) {
307
+ var _a, _b;
307
308
  var attributes = data[0], translations = data[1];
309
+ var resolvedConfig = (_b = (_a = window.threekit) === null || _a === void 0 ? void 0 : _a.configurator) === null || _b === void 0 ? void 0 : _b.getResolvedConfiguration();
308
310
  return Object.values(attributes).reduce(function (output, attribute) {
309
311
  var _a;
310
312
  var _b;
@@ -339,7 +341,11 @@ var hydrateAttribute = function (data, optionSelectionHandler) {
339
341
  _a[attribute.name] = { assetId: el.assetId },
340
342
  _a));
341
343
  },
342
- selected: attribute.value.assetId === el.assetId,
344
+ selected: resolvedConfig
345
+ ? el.assetId ===
346
+ resolvedConfig[attribute.name]
347
+ .assetId
348
+ : el.assetId === attribute.value.assetId,
343
349
  });
344
350
  }),
345
351
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threekit-tools/treble",
3
- "version": "0.0.93",
3
+ "version": "0.0.94",
4
4
  "author": "Amaan Saeed",
5
5
  "license": "MIT",
6
6
  "files": [