kitchen-simulator 5.0.1-react.18 → 5.0.3-react.18

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/es/AppContext.js CHANGED
@@ -1,3 +1,6 @@
1
1
  import React from 'react';
2
- var AppContext = /*#__PURE__*/React.createContext({});
2
+ var AppContext = /*#__PURE__*/React.createContext({
3
+ translator: null,
4
+ catalog: null
5
+ });
3
6
  export default AppContext;
@@ -21,7 +21,7 @@ import { connect } from 'react-redux';
21
21
  import { bindActionCreators } from 'redux';
22
22
  import * as constants from "./constants";
23
23
  import { base64Decode } from "./utils/helper";
24
- import actions from "./actions/export";
24
+ import actions, { projectActions } from "./actions/export";
25
25
  import Catalog from "./catalog/catalog";
26
26
  import { Content } from "./components/export";
27
27
  import Translator from "./translator/translator";
@@ -40,23 +40,9 @@ var SubCategoryItemImage = styled.img(_templateObject2 || (_templateObject2 = _t
40
40
  });
41
41
  var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
42
42
  function LiteKitchenConfigurator(props) {
43
- var _utmRequestData2, _utmRequestData3, _utmRequestData4, _utmRequestData5, _utmRequestData6, _utmRequestData7, _utmRequestData8, _utmRequestData9, _utmRequestData0;
44
43
  var _this;
45
44
  _classCallCheck(this, LiteKitchenConfigurator);
46
45
  _this = _callSuper(this, LiteKitchenConfigurator, [props]);
47
- var utmDetailParams = new URLSearchParams(_this.props.location && _this.props.location.search);
48
- var utmStrEncoded = utmDetailParams.get('details');
49
- var utmRequestData = null;
50
- if (utmStrEncoded) {
51
- try {
52
- var _utmRequestData;
53
- utmRequestData = JSON.parse(base64Decode(utmStrEncoded));
54
- utmRequestData = JSON.parse((_utmRequestData = utmRequestData) === null || _utmRequestData === void 0 ? void 0 : _utmRequestData.utm);
55
- } catch (e) {
56
- console.error('Cannot parse utm parameter: ', e);
57
- utmRequestData = null;
58
- }
59
- }
60
46
  _this.state = {
61
47
  savePopupVisible: false,
62
48
  quotePopupVisible: false,
@@ -89,17 +75,6 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
89
75
  isSaved: false,
90
76
  isLeaving: false
91
77
  };
92
- _this.utm = {
93
- utm_source: ((_utmRequestData2 = utmRequestData) === null || _utmRequestData2 === void 0 ? void 0 : _utmRequestData2.source) || 'source',
94
- utm_medium: ((_utmRequestData3 = utmRequestData) === null || _utmRequestData3 === void 0 ? void 0 : _utmRequestData3.medium) || 'medium',
95
- utm_campaign: ((_utmRequestData4 = utmRequestData) === null || _utmRequestData4 === void 0 ? void 0 : _utmRequestData4.campaign) || 'campaign',
96
- utm_term: ((_utmRequestData5 = utmRequestData) === null || _utmRequestData5 === void 0 ? void 0 : _utmRequestData5.term) || 'term',
97
- utm_content: ((_utmRequestData6 = utmRequestData) === null || _utmRequestData6 === void 0 ? void 0 : _utmRequestData6.content) || 'content',
98
- gclid: ((_utmRequestData7 = utmRequestData) === null || _utmRequestData7 === void 0 ? void 0 : _utmRequestData7.gclid) || 'gclid',
99
- msclkid: ((_utmRequestData8 = utmRequestData) === null || _utmRequestData8 === void 0 ? void 0 : _utmRequestData8.msclkid) || 'msclkid',
100
- fbclid: ((_utmRequestData9 = utmRequestData) === null || _utmRequestData9 === void 0 ? void 0 : _utmRequestData9.fbclid) || 'fbclid',
101
- ttclid: ((_utmRequestData0 = utmRequestData) === null || _utmRequestData0 === void 0 ? void 0 : _utmRequestData0.ttclid) || 'ttclid'
102
- };
103
78
  _this.openFloor = _this.openFloor.bind(_this);
104
79
  _this.openCabinet = _this.openCabinet.bind(_this);
105
80
  _this.openFinishing = _this.openFinishing.bind(_this);
@@ -316,25 +291,30 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
316
291
  }, {
317
292
  key: "componentDidMount",
318
293
  value: function componentDidMount() {
294
+ var _extractedState$getIn;
319
295
  window.forRedo = [];
296
+ var _this$props = this.props,
297
+ catalog = _this$props.catalog,
298
+ extractedState = _this$props.extractedState,
299
+ projectActions = _this$props.projectActions;
300
+ var catalogReady = extractedState === null || extractedState === void 0 || (_extractedState$getIn = extractedState.getIn) === null || _extractedState$getIn === void 0 ? void 0 : _extractedState$getIn.call(extractedState, ['catalog', 'ready']);
301
+ if (!catalogReady) projectActions.initCatalog(catalog);
320
302
  }
321
303
  }, {
322
304
  key: "componentDidUpdate",
323
305
  value: function componentDidUpdate(prevProps) {
324
- var _extractedState$getIn;
325
- var _this$props = this.props,
326
- externalEvent = _this$props.externalEvent,
327
- extractedState = _this$props.extractedState,
328
- projectActions = _this$props.projectActions,
329
- catalog = _this$props.catalog;
306
+ var _extractedState$getIn2;
307
+ var _this$props2 = this.props,
308
+ externalEvent = _this$props2.externalEvent,
309
+ extractedState = _this$props2.extractedState,
310
+ projectActions = _this$props2.projectActions,
311
+ catalog = _this$props2.catalog;
330
312
 
331
313
  // same behavior: handle external event when it changes
332
314
  if (prevProps.externalEvent !== externalEvent) {
333
315
  handleExternalEvent(this.props);
334
316
  }
335
-
336
- // same behavior: init catalog until ready
337
- var catalogReady = extractedState === null || extractedState === void 0 || (_extractedState$getIn = extractedState.getIn) === null || _extractedState$getIn === void 0 ? void 0 : _extractedState$getIn.call(extractedState, ['catalog', 'ready']);
317
+ var catalogReady = extractedState === null || extractedState === void 0 || (_extractedState$getIn2 = extractedState.getIn) === null || _extractedState$getIn2 === void 0 ? void 0 : _extractedState$getIn2.call(extractedState, ['catalog', 'ready']);
338
318
  if (!catalogReady) projectActions.initCatalog(catalog);
339
319
  }
340
320
  }, {
@@ -386,11 +366,11 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
386
366
  key: "render",
387
367
  value: function render() {
388
368
  var _this2 = this;
389
- var _this$props2 = this.props,
390
- width = _this$props2.width,
391
- height = _this$props2.height,
392
- extractedState = _this$props2.extractedState,
393
- props = _objectWithoutProperties(_this$props2, _excluded);
369
+ var _this$props3 = this.props,
370
+ width = _this$props3.width,
371
+ height = _this$props3.height,
372
+ extractedState = _this$props3.extractedState,
373
+ props = _objectWithoutProperties(_this$props3, _excluded);
394
374
  var _this$state = this.state,
395
375
  savePopupVisible = _this$state.savePopupVisible,
396
376
  quotePopupVisible = _this$state.quotePopupVisible,
@@ -319,6 +319,9 @@ export default function LiteRenderer(props) {
319
319
  var _ref = configData || {},
320
320
  logoImg = _ref.logoImg,
321
321
  companyUrl = _ref.companyUrl;
322
+ if (!catalogRef.current) {
323
+ return null;
324
+ }
322
325
  return /*#__PURE__*/React.createElement(Provider, {
323
326
  store: storeRef.current
324
327
  }, /*#__PURE__*/React.createElement(ToolErrorBoundary, {
package/es/WorkSpace.js CHANGED
@@ -54,6 +54,10 @@ var onInternalEvent = /*#__PURE__*/function () {
54
54
  }();
55
55
  document.getElementById('app').style.display = 'block';
56
56
  function WorkSpace(props) {
57
+ var _useResizeDetector = useResizeDetector(),
58
+ width = _useResizeDetector.width,
59
+ height = _useResizeDetector.height,
60
+ ref = _useResizeDetector.ref;
57
61
  var _useState = useState(null),
58
62
  _useState2 = _slicedToArray(_useState, 2),
59
63
  externalEvent = _useState2[0],
@@ -798,9 +802,27 @@ function WorkSpace(props) {
798
802
  };
799
803
  setExternalEvent(evt);
800
804
  }
801
- }, "Setting-MeasurementUnit-'mm'")), /*#__PURE__*/React.createElement(LiteRenderer, {
802
- width: props.width,
803
- height: props.height,
805
+ }, "Setting-MeasurementUnit-'mm'")), /*#__PURE__*/React.createElement("div", {
806
+ style: {
807
+ display: 'flex',
808
+ width: '100vw',
809
+ height: '100vh'
810
+ }
811
+ }, /*#__PURE__*/React.createElement("div", {
812
+ style: {
813
+ flex: 1,
814
+ minWidth: 0,
815
+ minHeight: 0
816
+ }
817
+ }, /*#__PURE__*/React.createElement("div", {
818
+ ref: ref,
819
+ style: {
820
+ width: '100%',
821
+ height: '100%'
822
+ }
823
+ }, /*#__PURE__*/React.createElement(LiteRenderer, {
824
+ width: width !== null && width !== void 0 ? width : 0,
825
+ height: height !== null && height !== void 0 ? height : 0,
804
826
  configData: mockProps.configData,
805
827
  options: options,
806
828
  logoImg: "/assets/logo.png",
@@ -818,36 +840,10 @@ function WorkSpace(props) {
818
840
  // }
819
841
  console.error('TOOL ERROR:', payload);
820
842
  }
821
- }));
843
+ })))));
822
844
  }
823
845
  function App() {
824
- var _useResizeDetector = useResizeDetector(),
825
- width = _useResizeDetector.width,
826
- height = _useResizeDetector.height,
827
- ref = _useResizeDetector.ref;
828
- return /*#__PURE__*/React.createElement("div", {
829
- id: "kitchen-simulator-container",
830
- style: {
831
- display: 'flex',
832
- width: '100vw',
833
- height: '100vh'
834
- }
835
- }, /*#__PURE__*/React.createElement("div", {
836
- style: {
837
- flex: 1,
838
- minWidth: 0,
839
- minHeight: 0
840
- }
841
- }, /*#__PURE__*/React.createElement("div", {
842
- ref: ref,
843
- style: {
844
- width: '100%',
845
- height: '100%'
846
- }
847
- }, width && height ? /*#__PURE__*/React.createElement(WorkSpace, {
848
- width: width,
849
- height: height
850
- }) : null)));
846
+ return /*#__PURE__*/React.createElement(WorkSpace, null);
851
847
  }
852
848
  var container = document.getElementById('app');
853
849
  var root = createRoot(container);
@@ -878,6 +878,7 @@ export default function Line(_ref) {
878
878
 
879
879
  // Angle SVG Path
880
880
  lines.push(/*#__PURE__*/React.createElement("path", {
881
+ key: 'angle-line-' + vertex[0].id + '-' + vertex[1].id + '-' + rotDir,
881
882
  style: STYLE_ANGLE,
882
883
  d: "\n M ".concat(vertex[0].x, ",").concat(vertex[0].y, " L ").concat(pos1.x, ",").concat(pos1.y, " A ").concat(minLineLength, " ").concat(minLineLength, " ").concat(angle, " 0 ").concat(t > 0 ? 1 : 0, " ").concat(pos2.x, ",").concat(pos2.y, " z\n ")
883
884
  }));