@threekit-tools/treble 0.0.41 → 0.0.45

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.
@@ -33,8 +33,8 @@ var App = function (props) {
33
33
  var dispatch = (0, store_1.useThreekitDispatch)();
34
34
  (0, react_1.useEffect)(function () {
35
35
  var init = function () {
36
- var playerConfig = props.playerConfig, project = props.project, locale = props.locale, threekitEnv = props.threekitEnv;
37
- dispatch((0, threekit_1.launch)({ playerConfig: playerConfig, project: project, locale: locale, threekitEnv: threekitEnv }));
36
+ var playerConfig = props.playerConfig, project = props.project, locale = props.locale, threekitEnv = props.threekitEnv, eventHandlers = props.eventHandlers;
37
+ dispatch((0, threekit_1.launch)({ playerConfig: playerConfig, project: project, locale: locale, threekitEnv: threekitEnv, eventHandlers: eventHandlers }));
38
38
  };
39
39
  init();
40
40
  return;
@@ -45,6 +45,6 @@ var ThreekitProvider = function (props) {
45
45
  return (react_1.default.createElement(react_redux_1.Provider, { store: store_1.default },
46
46
  react_1.default.createElement(styled_components_1.ThemeProvider, { theme: theme_1.default },
47
47
  react_1.default.createElement(GlobalStyles_styles_1.default, null),
48
- react_1.default.createElement(App, { locale: props.locale, project: props.project, playerConfig: props.playerConfig, threekitEnv: props.threekitEnv }, props.children))));
48
+ react_1.default.createElement(App, { locale: props.locale, project: props.project, playerConfig: props.playerConfig, threekitEnv: props.threekitEnv, eventHandlers: props.eventHandlers }, props.children))));
49
49
  };
50
50
  exports.default = ThreekitProvider;
@@ -1,5 +1,5 @@
1
1
  import { IConfigurationColor, IThreekitDisplayAttribute } from '../../threekit';
2
- export declare type AttributeValue = string | number | IConfigurationColor;
2
+ export declare type AttributeValue = string | number | boolean | IConfigurationColor;
3
3
  declare type UseAttributeError = [undefined, undefined];
4
4
  declare type UseAttributeSuccess = [
5
5
  IThreekitDisplayAttribute,
@@ -16,8 +16,6 @@ var useAttribute = function (attributeName) {
16
16
  var handleChange = function (value) {
17
17
  var _a;
18
18
  var preppedValue = (0, utils_1.selectionToConfiguration)(value, attribute.type);
19
- if (!preppedValue)
20
- return;
21
19
  dispatch((0, threekit_1.setConfiguration)((_a = {},
22
20
  _a[attributeName] = preppedValue,
23
21
  _a)));
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"));
@@ -6,7 +6,7 @@ import { ISaveConfigurationConfig, WishlistArray } from '../Treble';
6
6
  * Types and Interfaces
7
7
  ****************************************************/
8
8
  interface EventHandlers {
9
- postConfigurationChange?: (attributes: Array<IThreekitDisplayAttribute>) => void | Promise<void>;
9
+ postConfigurationChange?: (updatedAttributes: Array<IThreekitDisplayAttribute>, configurationChange: ISetConfiguration, previousConfiguration: Array<IThreekitDisplayAttribute>) => void | Promise<void>;
10
10
  }
11
11
  export interface ILaunchConfig {
12
12
  threekitEnv: string;
@@ -390,17 +390,18 @@ var launch = function (launchConfig) {
390
390
  exports.launch = launch;
391
391
  // Configurator
392
392
  var setConfiguration = function (config) { return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
393
- var updatedAttributes;
393
+ var previousConfiguration, updatedAttributes;
394
394
  return __generator(this, function (_a) {
395
395
  switch (_a.label) {
396
396
  case 0:
397
+ previousConfiguration = window.threekit.configurator.getDisplayAttributes();
397
398
  dispatch(setPlayerLoading(true));
398
399
  return [4 /*yield*/, window.threekit.configurator.setConfiguration(config)];
399
400
  case 1:
400
401
  _a.sent();
401
402
  updatedAttributes = window.threekit.configurator.getDisplayAttributes();
402
403
  if (!EVENTS.postConfigurationChange) return [3 /*break*/, 3];
403
- return [4 /*yield*/, EVENTS.postConfigurationChange(updatedAttributes)];
404
+ return [4 /*yield*/, EVENTS.postConfigurationChange(updatedAttributes, config, previousConfiguration)];
404
405
  case 2:
405
406
  _a.sent();
406
407
  _a.label = 3;
package/dist/utils.d.ts CHANGED
@@ -53,9 +53,9 @@ export declare const metadataValueToObject: (data: string) => Record<string, str
53
53
  */
54
54
  export declare const createThreekitScriptEl: (threekitDomain: string) => Promise<void>;
55
55
  export declare const translateAttribute: (attributes: Array<IThreekitDisplayAttribute>, translations?: ITranslationMap | undefined, language?: string | undefined) => IThreekitDisplayAttribute;
56
- export declare const selectionToConfiguration: (value: string | number | IConfigurationColor, attributeType: string) => string | number | IConfigurationColor | {
57
- assetId: string | number | IConfigurationColor;
58
- } | undefined;
56
+ export declare const selectionToConfiguration: (value: string | number | boolean | IConfigurationColor, attributeType: string) => string | number | boolean | IConfigurationColor | {
57
+ assetId: string | number | boolean | IConfigurationColor;
58
+ };
59
59
  export declare const filterFormAttributes: (attributes: Record<string, IThreekitDisplayAttribute>, attributeComponentProps: IAttributesComponentProps, includeReservedAttributes: boolean) => IThreekitDisplayAttribute[];
60
60
  export declare const isUuid: (str?: string | undefined) => boolean;
61
61
  export declare const loadTrebleConfig: () => Partial<ITrebleConfig>;
package/dist/utils.js CHANGED
@@ -306,8 +306,6 @@ var translateAttribute = function (attributes, translations, language) {
306
306
  };
307
307
  exports.translateAttribute = translateAttribute;
308
308
  var selectionToConfiguration = function (value, attributeType) {
309
- if (!value)
310
- return undefined;
311
309
  switch (attributeType) {
312
310
  case constants_1.ATTRIBUTE_TYPES.number:
313
311
  case constants_1.ATTRIBUTE_TYPES.string:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threekit-tools/treble",
3
- "version": "0.0.41",
3
+ "version": "0.0.45",
4
4
  "author": "Amaan Saeed",
5
5
  "license": "MIT",
6
6
  "files": [