kitchen-simulator 3.1.15 → 4.0.0-alpha.12

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.
Files changed (105) hide show
  1. package/es/LiteKitchenConfigurator.js +204 -21
  2. package/es/LiteRenderer.js +277 -12
  3. package/es/actions/items-actions.js +6 -10
  4. package/es/actions/lines-actions.js +1 -3
  5. package/es/actions/project-actions.js +5 -15
  6. package/es/assets/Window.hdr +2100 -0
  7. package/es/assets/gltf/door_sliding.bin +0 -0
  8. package/es/assets/img/1.jpg +0 -0
  9. package/es/catalog/areas/area/planner-element.js +5 -10
  10. package/es/catalog/catalog.js +4 -1
  11. package/es/catalog/factories/area-factory-3d.js +17 -18
  12. package/es/catalog/factories/wall-factory-3d.js +2 -2
  13. package/es/catalog/factories/wall-factory.js +8 -8
  14. package/es/catalog/lines/wall/planner-element.js +9 -18
  15. package/es/catalog/utils/exporter.js +3 -6
  16. package/es/catalog/utils/item-loader.js +197 -202
  17. package/es/catalog/utils/mtl-loader.js +2 -2
  18. package/es/catalog/utils/obj-loader.js +2 -2
  19. package/es/class/item.js +127 -107
  20. package/es/class/line.js +2 -14
  21. package/es/class/project.js +44 -150
  22. package/es/components/content.js +6 -19
  23. package/es/components/viewer2d/grids/grid-streak.js +1 -1
  24. package/es/components/viewer2d/item.js +51 -84
  25. package/es/components/viewer2d/line.js +243 -315
  26. package/es/components/viewer2d/ruler.js +36 -16
  27. package/es/components/viewer2d/rulerDist.js +75 -44
  28. package/es/components/viewer2d/utils.js +0 -6
  29. package/es/components/viewer2d/viewer2d.js +205 -301
  30. package/es/components/viewer3d/front3D.js +2 -3
  31. package/es/components/viewer3d/libs/mtl-loader.js +2 -2
  32. package/es/components/viewer3d/libs/obj-loader.js +2 -2
  33. package/es/components/viewer3d/libs/orbit-controls.js +4 -3
  34. package/es/components/viewer3d/libs/pointer-lock-controls.js +7 -6
  35. package/es/components/viewer3d/viewer3d.js +80 -127
  36. package/es/constants.js +3 -110
  37. package/es/devLiteRenderer.js +38 -597
  38. package/es/index.js +86 -16
  39. package/es/models.js +5 -8
  40. package/es/plugins/SVGLoader.js +5 -7
  41. package/es/plugins/keyboard.js +6 -15
  42. package/es/reducers/items-reducer.js +5 -5
  43. package/es/reducers/lines-reducer.js +1 -1
  44. package/es/reducers/project-reducer.js +3 -5
  45. package/es/shared-style.js +4 -4
  46. package/es/utils/geometry.js +0 -161
  47. package/es/utils/get-edges-of-subgraphs.js +1 -1
  48. package/es/utils/graph-cycles.js +1 -1
  49. package/es/utils/graph.js +1 -1
  50. package/es/utils/helper.js +2 -67
  51. package/es/utils/isolate-event-handler.js +124 -1367
  52. package/es/utils/molding.js +2 -238
  53. package/lib/LiteKitchenConfigurator.js +205 -22
  54. package/lib/LiteRenderer.js +278 -13
  55. package/lib/actions/items-actions.js +6 -10
  56. package/lib/actions/lines-actions.js +1 -3
  57. package/lib/actions/project-actions.js +4 -15
  58. package/lib/assets/Window.hdr +2100 -0
  59. package/lib/assets/gltf/door_sliding.bin +0 -0
  60. package/lib/assets/img/1.jpg +0 -0
  61. package/lib/catalog/areas/area/planner-element.js +5 -11
  62. package/lib/catalog/catalog.js +4 -1
  63. package/lib/catalog/factories/area-factory-3d.js +14 -15
  64. package/lib/catalog/factories/wall-factory-3d.js +2 -2
  65. package/lib/catalog/factories/wall-factory.js +8 -8
  66. package/lib/catalog/lines/wall/planner-element.js +9 -19
  67. package/lib/catalog/utils/exporter.js +3 -6
  68. package/lib/catalog/utils/item-loader.js +194 -199
  69. package/lib/catalog/utils/mtl-loader.js +2 -9
  70. package/lib/catalog/utils/obj-loader.js +2 -10
  71. package/lib/class/item.js +125 -105
  72. package/lib/class/line.js +1 -13
  73. package/lib/class/project.js +43 -149
  74. package/lib/components/content.js +6 -19
  75. package/lib/components/viewer2d/grids/grid-streak.js +1 -1
  76. package/lib/components/viewer2d/item.js +50 -83
  77. package/lib/components/viewer2d/line.js +242 -315
  78. package/lib/components/viewer2d/ruler.js +35 -15
  79. package/lib/components/viewer2d/rulerDist.js +75 -44
  80. package/lib/components/viewer2d/utils.js +0 -7
  81. package/lib/components/viewer2d/viewer2d.js +205 -299
  82. package/lib/components/viewer3d/front3D.js +2 -3
  83. package/lib/components/viewer3d/libs/mtl-loader.js +2 -9
  84. package/lib/components/viewer3d/libs/obj-loader.js +2 -9
  85. package/lib/components/viewer3d/libs/orbit-controls.js +5 -11
  86. package/lib/components/viewer3d/libs/pointer-lock-controls.js +7 -13
  87. package/lib/components/viewer3d/viewer3d.js +79 -125
  88. package/lib/constants.js +7 -115
  89. package/lib/devLiteRenderer.js +33 -592
  90. package/lib/index.js +86 -16
  91. package/lib/models.js +5 -8
  92. package/lib/plugins/SVGLoader.js +5 -7
  93. package/lib/plugins/keyboard.js +6 -15
  94. package/lib/reducers/items-reducer.js +5 -5
  95. package/lib/reducers/lines-reducer.js +1 -1
  96. package/lib/reducers/project-reducer.js +2 -4
  97. package/lib/shared-style.js +4 -4
  98. package/lib/utils/geometry.js +0 -162
  99. package/lib/utils/get-edges-of-subgraphs.js +1 -6
  100. package/lib/utils/graph-cycles.js +8 -7
  101. package/lib/utils/graph.js +1 -6
  102. package/lib/utils/helper.js +3 -70
  103. package/lib/utils/isolate-event-handler.js +121 -1364
  104. package/lib/utils/molding.js +0 -238
  105. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
4
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
5
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
6
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
@@ -7,7 +8,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
7
8
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
8
9
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
9
10
  import _inherits from "@babel/runtime/helpers/esm/inherits";
10
- var _excluded = ["width", "height", "configData", "options", "user", "auth", "featureFlags", "sentry", "analytics", "externalEvent", "onInternalEvent", "onError"];
11
+ var _excluded = ["width", "height", "projectElement", "categoryData", "dataBundle", "configData", "options", "user", "auth", "featureFlags", "sentry", "analytics", "externalEvent", "onExternalEventProcessed", "onError"];
11
12
  import _regeneratorRuntime from "@babel/runtime/regenerator";
12
13
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
13
14
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -23,13 +24,17 @@ import PlannerReducer from "./reducers/reducer";
23
24
  import AppContext from "./AppContext";
24
25
  import Catalog from "./catalog/catalog";
25
26
  import { SVGLoader } from 'three/addons/loaders/SVGLoader';
27
+ import { isEmpty } from "./utils/helper";
26
28
  import { TOE_KICK_MOLDING } from "./constants";
27
29
  import * as Areas from "./catalog/areas/area/planner-element";
28
30
  import * as Lines from "./catalog/lines/wall/planner-element";
29
31
  import * as Holes from "./catalog/holes/export";
32
+ import { render2DItem, render3DApplianceItem, render3DItem, render3DLightingItem } from "./catalog/utils/item-loader";
30
33
  import { ConsoleDebugger, Keyboard } from "./plugins/export";
31
34
  import { Map } from 'immutable';
32
35
  import * as Sentry from '@sentry/react';
36
+ import { loadProject, rename } from "./actions/project-actions";
37
+ import exporter from "./catalog/utils/exporter";
33
38
  import * as THREE from 'three';
34
39
  import LiteKitchenConfigurator from "./LiteKitchenConfigurator";
35
40
  if (typeof window !== 'undefined') window.THREE = THREE;
@@ -139,6 +144,9 @@ var ToolErrorBoundary = /*#__PURE__*/function (_React$Component) {
139
144
  export default function LiteRenderer(props) {
140
145
  var width = props.width,
141
146
  height = props.height,
147
+ projectElement = props.projectElement,
148
+ categoryData = props.categoryData,
149
+ dataBundle = props.dataBundle,
142
150
  configData = props.configData,
143
151
  options = props.options,
144
152
  user = props.user,
@@ -147,7 +155,7 @@ export default function LiteRenderer(props) {
147
155
  sentry = props.sentry,
148
156
  analytics = props.analytics,
149
157
  externalEvent = props.externalEvent,
150
- onInternalEvent = props.onInternalEvent,
158
+ onExternalEventProcessed = props.onExternalEventProcessed,
151
159
  onError = props.onError,
152
160
  passThrough = _objectWithoutProperties(props, _excluded);
153
161
 
@@ -237,12 +245,35 @@ export default function LiteRenderer(props) {
237
245
  emit(lastExternalEventRef.current, last.errors);
238
246
  }
239
247
  }, [externalEvent, emit]);
248
+ var _ref = categoryData && categoryData.data || {},
249
+ catalogs = _ref.catalogs,
250
+ colorAlias = _ref.colorAlias,
251
+ subgroups = _ref.subgroups;
252
+ var _ref2 = dataBundle || {},
253
+ _ref2$data = _ref2.data,
254
+ data = _ref2$data === void 0 ? [] : _ref2$data,
255
+ _ref2$appliances = _ref2.appliances,
256
+ appliances = _ref2$appliances === void 0 ? [] : _ref2$appliances,
257
+ _ref2$furnishing = _ref2.furnishing,
258
+ furnishing = _ref2$furnishing === void 0 ? [] : _ref2$furnishing,
259
+ _ref2$lighting = _ref2.lighting,
260
+ lighting = _ref2$lighting === void 0 ? [] : _ref2$lighting;
261
+ var _projectElement = _slicedToArray(projectElement, 1),
262
+ project_data = _projectElement[0].project_data;
240
263
  var id = configData.id,
241
264
  logoImg = configData.logoImg,
242
265
  companyUrl = configData.companyUrl;
266
+ var _React$useState = React.useState([]),
267
+ _React$useState2 = _slicedToArray(_React$useState, 2),
268
+ outlineSVGData = _React$useState2[0],
269
+ setOutlineSVGData = _React$useState2[1];
270
+ var _React$useState3 = React.useState(false),
271
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
272
+ catalogInitiated = _React$useState4[0],
273
+ setCatalogInitiated = _React$useState4[1];
243
274
  useEffect(function () {
244
275
  var initMyCatalog = /*#__PURE__*/function () {
245
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
276
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
246
277
  var x, _x, _x2;
247
278
  return _regeneratorRuntime.wrap(function (_context) {
248
279
  while (1) switch (_context.prev = _context.next) {
@@ -259,29 +290,258 @@ export default function LiteRenderer(props) {
259
290
  }, _callee);
260
291
  }));
261
292
  return function initMyCatalog() {
262
- return _ref.apply(this, arguments);
293
+ return _ref3.apply(this, arguments);
263
294
  };
264
295
  }();
265
- var initCatalog = /*#__PURE__*/function () {
266
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
296
+ var loadMoldings = /*#__PURE__*/function () {
297
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
298
+ var door_color_alias, subgroup_ids, door_color_alias_ids, doorStyleData, molding, toeMoldingData, cabinets, promises;
267
299
  return _regeneratorRuntime.wrap(function (_context2) {
268
300
  while (1) switch (_context2.prev = _context2.next) {
269
301
  case 0:
270
- _context2.next = 1;
271
- return initMyCatalog();
302
+ door_color_alias = [];
303
+ subgroup_ids = catalogs.filter(function (item) {
304
+ return item.id == id;
305
+ })[0].manufacturer_subgroup_ids.split(',');
306
+ door_color_alias_ids = [];
307
+ subgroups.forEach(function (subgroup) {
308
+ if (subgroup_ids.some(function (id) {
309
+ return id == subgroup.id.toString();
310
+ })) {
311
+ subgroup.door_color_alias_ids.split(',').forEach(function (item) {
312
+ item != '' && door_color_alias_ids.push(item);
313
+ });
314
+ }
315
+ });
316
+ colorAlias.forEach(function (color) {
317
+ return door_color_alias_ids.some(function (id) {
318
+ return id == color.id.toString();
319
+ }) && door_color_alias.push(color);
320
+ });
321
+ doorStyleData = categoryData.data.doorStyles.items;
322
+ categoryData.data.doorStyles.items = doorStyleData.treeStruct;
323
+ door_color_alias.forEach(function (dca) {
324
+ doorStyleData.doorColorData.forEach(function (dc) {
325
+ dc.door_style_id = parseInt(dc.door_style_id);
326
+ if (dc.id !== dca.door_color_id) return;
327
+ dc.name = dca.alias_name;
328
+ dc.color_sku_alias = dca.sku_alias_name;
329
+ doorStyleData.treeStruct.forEach(function (el) {
330
+ el.items.forEach(function (elem) {
331
+ return dc.door_style_id === elem.id && (dc.door_style_name = elem.name);
332
+ });
333
+ });
334
+ dca.alias_installation_type = isEmpty(dca.alias_installation_type) ? [] : dca.alias_installation_type.split(',').map(function (n) {
335
+ return parseInt(n);
336
+ });
337
+ categoryData.data.doorStyles.items.forEach(function (item) {
338
+ if (dca.alias_installation_type.some(function (ait) {
339
+ return ait === item.id;
340
+ })) item.items.forEach(function (ds) {
341
+ if (ds.name === dc.door_style_name) ds.items.push(dc);
342
+ });
343
+ });
344
+ });
345
+ });
346
+ molding = [];
347
+ toeMoldingData = [];
348
+ cabinets = categoryData.data.cabinets;
349
+ cabinets[cabinets.length - 1].items.forEach(function (index) {
350
+ if (index.name.toLowerCase().includes('molding')) {
351
+ index.items.forEach(function (item) {
352
+ return molding.push(item);
353
+ });
354
+ }
355
+ if (index.name.includes(TOE_KICK_MOLDING)) {
356
+ index.items.forEach(function (item) {
357
+ return toeMoldingData.push(item);
358
+ });
359
+ }
360
+ });
361
+ categoryData.data.toeMoldingData = toeMoldingData;
362
+ promises = molding.map(function (child) {
363
+ return new Promise(function (resolve, reject) {
364
+ var url = child === null || child === void 0 ? void 0 : child.shape_svg;
365
+ if (!url) return resolve();
366
+ var loader = new SVGLoader();
367
+ loader.load(url, function (data) {
368
+ var _data$xml$viewBox$ani, _data$xml, _data$xml$viewBox$ani2, _data$xml2;
369
+ child.data = {
370
+ paths: data.paths,
371
+ svg_width: (_data$xml$viewBox$ani = (_data$xml = data.xml) === null || _data$xml === void 0 || (_data$xml = _data$xml.viewBox) === null || _data$xml === void 0 || (_data$xml = _data$xml.animVal) === null || _data$xml === void 0 ? void 0 : _data$xml.width) !== null && _data$xml$viewBox$ani !== void 0 ? _data$xml$viewBox$ani : 0,
372
+ svg_height: (_data$xml$viewBox$ani2 = (_data$xml2 = data.xml) === null || _data$xml2 === void 0 || (_data$xml2 = _data$xml2.viewBox) === null || _data$xml2 === void 0 || (_data$xml2 = _data$xml2.animVal) === null || _data$xml2 === void 0 ? void 0 : _data$xml2.height) !== null && _data$xml$viewBox$ani2 !== void 0 ? _data$xml$viewBox$ani2 : 0
373
+ };
374
+ resolve();
375
+ }, null, function (error) {
376
+ console.error(error);
377
+ reject(error);
378
+ });
379
+ });
380
+ });
381
+ return _context2.abrupt("return", Promise.all(promises));
272
382
  case 1:
273
383
  case "end":
274
384
  return _context2.stop();
275
385
  }
276
386
  }, _callee2);
277
387
  }));
388
+ return function loadMoldings() {
389
+ return _ref4.apply(this, arguments);
390
+ };
391
+ }();
392
+ var loadSVGs = /*#__PURE__*/function () {
393
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
394
+ var svgLoadPromises, outlineData;
395
+ return _regeneratorRuntime.wrap(function (_context4) {
396
+ while (1) switch (_context4.prev = _context4.next) {
397
+ case 0:
398
+ svgLoadPromises = data.map(/*#__PURE__*/function () {
399
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(item) {
400
+ var _parsed$xml$viewBox, _parsed$xml$viewBox2, response, svgText, loader, parsed, _t;
401
+ return _regeneratorRuntime.wrap(function (_context3) {
402
+ while (1) switch (_context3.prev = _context3.next) {
403
+ case 0:
404
+ if (item.outline) {
405
+ _context3.next = 1;
406
+ break;
407
+ }
408
+ return _context3.abrupt("return", null);
409
+ case 1:
410
+ _context3.prev = 1;
411
+ _context3.next = 2;
412
+ return fetch(item.outline, {
413
+ cache: 'no-store'
414
+ });
415
+ case 2:
416
+ response = _context3.sent;
417
+ _context3.next = 3;
418
+ return response.text();
419
+ case 3:
420
+ svgText = _context3.sent;
421
+ loader = new SVGLoader();
422
+ parsed = loader.parse(svgText);
423
+ if (!isEmpty(parsed.paths)) {
424
+ _context3.next = 4;
425
+ break;
426
+ }
427
+ return _context3.abrupt("return", null);
428
+ case 4:
429
+ return _context3.abrupt("return", {
430
+ paths: parsed.paths,
431
+ svgWidth: parseFloat(parsed.xml.getAttribute('width')) || ((_parsed$xml$viewBox = parsed.xml.viewBox) === null || _parsed$xml$viewBox === void 0 || (_parsed$xml$viewBox = _parsed$xml$viewBox.animVal) === null || _parsed$xml$viewBox === void 0 ? void 0 : _parsed$xml$viewBox.width) || 0,
432
+ svgHeight: parseFloat(parsed.xml.getAttribute('height')) || ((_parsed$xml$viewBox2 = parsed.xml.viewBox) === null || _parsed$xml$viewBox2 === void 0 || (_parsed$xml$viewBox2 = _parsed$xml$viewBox2.animVal) === null || _parsed$xml$viewBox2 === void 0 ? void 0 : _parsed$xml$viewBox2.height) || 0,
433
+ reverse: !parseFloat(parsed.xml.getAttribute('height'))
434
+ });
435
+ case 5:
436
+ _context3.prev = 5;
437
+ _t = _context3["catch"](1);
438
+ console.error('Failed to load SVG:', item.outline, _t);
439
+ return _context3.abrupt("return", null);
440
+ case 6:
441
+ case "end":
442
+ return _context3.stop();
443
+ }
444
+ }, _callee3, null, [[1, 5]]);
445
+ }));
446
+ return function (_x3) {
447
+ return _ref6.apply(this, arguments);
448
+ };
449
+ }());
450
+ _context4.next = 1;
451
+ return Promise.all(svgLoadPromises);
452
+ case 1:
453
+ outlineData = _context4.sent;
454
+ setOutlineSVGData(outlineData);
455
+ case 2:
456
+ case "end":
457
+ return _context4.stop();
458
+ }
459
+ }, _callee4);
460
+ }));
461
+ return function loadSVGs() {
462
+ return _ref5.apply(this, arguments);
463
+ };
464
+ }();
465
+ var initCatalog = /*#__PURE__*/function () {
466
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
467
+ return _regeneratorRuntime.wrap(function (_context5) {
468
+ while (1) switch (_context5.prev = _context5.next) {
469
+ case 0:
470
+ setCatalogInitiated(false);
471
+ _context5.next = 1;
472
+ return initMyCatalog();
473
+ case 1:
474
+ _context5.next = 2;
475
+ return loadMoldings();
476
+ case 2:
477
+ _context5.next = 3;
478
+ return loadSVGs();
479
+ case 3:
480
+ setCatalogInitiated(true);
481
+ case 4:
482
+ case "end":
483
+ return _context5.stop();
484
+ }
485
+ }, _callee5);
486
+ }));
278
487
  return function initCatalog() {
279
- return _ref2.apply(this, arguments);
488
+ return _ref7.apply(this, arguments);
280
489
  };
281
490
  }();
282
491
  initCatalog();
283
492
  // eslint-disable-next-line react-hooks/exhaustive-deps
284
- }, [id]);
493
+ }, [categoryData, data, id, catalogs, colorAlias, subgroups]);
494
+
495
+ // Register items once SVGs are loaded
496
+ useEffect(function () {
497
+ if (!outlineSVGData.length) return;
498
+ var Item = [];
499
+ data.forEach(function (obj, index) {
500
+ Item.push(exporter(_objectSpread(_objectSpread({}, obj), {}, {
501
+ type: 'cabinet',
502
+ outlineSVGData: outlineSVGData[index],
503
+ render2DItem: render2DItem,
504
+ render3DItem: render3DItem
505
+ })));
506
+ });
507
+ appliances.forEach(function (obj) {
508
+ Item.push(exporter(_objectSpread(_objectSpread({}, obj), {}, {
509
+ render2DItem: render2DItem,
510
+ render3DItem: render3DApplianceItem,
511
+ type: 'appliance'
512
+ })));
513
+ });
514
+ lighting.forEach(function (obj) {
515
+ Item.push(exporter(_objectSpread(_objectSpread({}, obj), {}, {
516
+ type: 'lighting',
517
+ render2DItem: render2DItem,
518
+ render3DItem: render3DLightingItem
519
+ })));
520
+ });
521
+ furnishing.forEach(function (obj) {
522
+ Item.push(exporter(_objectSpread(_objectSpread({}, obj), {}, {
523
+ type: 'furnishing',
524
+ render2DItem: render2DItem,
525
+ render3DItem: render3DApplianceItem
526
+ })));
527
+ });
528
+ for (var x in Item) MyCatalog.registerElement(Item[x]);
529
+ }, [outlineSVGData, data, appliances, furnishing, lighting]);
530
+ useEffect(function () {
531
+ if (projectElement.length === 0) return;
532
+ if (!catalogInitiated) return;
533
+ sessionStorage.setItem('projectTitle', projectElement[0].title);
534
+ store.dispatch(rename(projectElement[0].title));
535
+ sessionStorage.setItem('projectId', projectElement[0].id);
536
+ sessionStorage.setItem('email', projectElement[0].email);
537
+ sessionStorage.setItem('firstName', projectElement[0].firstName);
538
+ sessionStorage.setItem('lastName', projectElement[0].lastName);
539
+ sessionStorage.setItem('phone', projectElement[0].phone);
540
+ var jsonData;
541
+ jsonData = JSON.parse(projectElement[0].project_data);
542
+ jsonData.isLoadingCabinet = false;
543
+ store.dispatch(loadProject(jsonData, categoryData));
544
+ }, [project_data, catalogInitiated]);
285
545
  return /*#__PURE__*/React.createElement(AppContext.Provider, null, /*#__PURE__*/React.createElement(Provider, {
286
546
  store: store
287
547
  }, /*#__PURE__*/React.createElement(ToolErrorBoundary, {
@@ -296,9 +556,11 @@ export default function LiteRenderer(props) {
296
556
  stateExtractor: function stateExtractor(state) {
297
557
  return state.get('KitchenConfigurator');
298
558
  },
559
+ categoryData: categoryData,
560
+ data: data,
299
561
  configData: configData,
300
562
  externalEvent: externalEvent,
301
- onInternalEvent: onInternalEvent
563
+ onExternalEventProcessed: onExternalEventProcessed
302
564
  }, passThrough)))));
303
565
  }
304
566
 
@@ -307,6 +569,9 @@ export default function LiteRenderer(props) {
307
569
  LiteRenderer.propTypes = {
308
570
  width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
309
571
  height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
572
+ projectElement: PropTypes.arrayOf(PropTypes.object),
573
+ categoryData: PropTypes.any,
574
+ dataBundle: PropTypes.any,
310
575
  configData: PropTypes.any,
311
576
  catalog: PropTypes.oneOfType([PropTypes.object, PropTypes.instanceOf(Models.Catalog)]),
312
577
  logoImg: PropTypes.any,
@@ -320,7 +585,7 @@ LiteRenderer.propTypes = {
320
585
  environment: PropTypes.string
321
586
  }),
322
587
  externalEvent: PropTypes.object,
323
- onInternalEvent: PropTypes.func,
588
+ onExternalEventProcessed: PropTypes.func,
324
589
  onError: PropTypes.func,
325
590
  store: PropTypes.object
326
591
  };
@@ -32,11 +32,9 @@ export function editWidth(newWidth, layerID, itemID) {
32
32
  };
33
33
  }
34
34
  export function duplicateSelected(currentObject) {
35
- var onInternalEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
36
35
  return {
37
36
  type: DUPLICATE_SELECTED,
38
- currentObject: currentObject,
39
- onInternalEvent: onInternalEvent
37
+ currentObject: currentObject
40
38
  };
41
39
  }
42
40
  export function replaceItem(selectedPos, currentObject, selectedObject) {
@@ -78,13 +76,11 @@ export function selectToolDrawingItem3D(sceneComponentType) {
78
76
  };
79
77
  }
80
78
  export function updateDrawingItem(layerID, x, y) {
81
- var isInitialPos = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
82
79
  return {
83
80
  type: UPDATE_DRAWING_ITEM,
84
81
  layerID: layerID,
85
82
  x: x,
86
- y: y,
87
- isInitialPos: isInitialPos
83
+ y: y
88
84
  };
89
85
  }
90
86
  export function endDrawingItem(layerID, x, y) {
@@ -227,11 +223,10 @@ export function updateItemsAltitude(layerID, itemID, value) {
227
223
  value: value
228
224
  };
229
225
  }
230
- export function setDoorStyle(doorStyle, itemCDS, isAll) {
226
+ export function setDoorStyle(doorStyle, isAll) {
231
227
  return {
232
228
  type: SET_DOOR_STYLE,
233
229
  doorStyle: doorStyle,
234
- itemCDS: itemCDS,
235
230
  isAll: isAll
236
231
  };
237
232
  }
@@ -296,10 +291,11 @@ export function setModelling(model) {
296
291
  model: model
297
292
  };
298
293
  }
299
- export function setInitialDoorStyle(doorStyle) {
294
+ export function setInitialDoorStyle(doorStyle, oStyle) {
300
295
  return {
301
296
  type: SET_INITIAL_DOOR_STYLE,
302
- doorStyle: doorStyle
297
+ doorStyle: doorStyle,
298
+ oStyle: oStyle
303
299
  };
304
300
  }
305
301
  export function setMoveStatus(status) {
@@ -13,14 +13,12 @@ export function selectToolDrawingLine(sceneComponentType) {
13
13
  };
14
14
  }
15
15
  export function beginDrawingLine(layerID, x, y, snapMask) {
16
- var onInternalEvent = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
17
16
  return {
18
17
  type: BEGIN_DRAWING_LINE,
19
18
  layerID: layerID,
20
19
  x: x,
21
20
  y: y,
22
- snapMask: snapMask,
23
- onInternalEvent: onInternalEvent
21
+ snapMask: snapMask
24
22
  };
25
23
  }
26
24
  export function updateDrawingLine(x, y, relatedLines, snapMask) {
@@ -1,4 +1,4 @@
1
- import { NEW_PROJECT, LOAD_PROJECT, SAVE_PROJECT, OPEN_CATALOG, SELECT_TOOL_EDIT, UNSELECT_ALL, SET_PROPERTIES, SET_ITEMS_ATTRIBUTES, SET_LINES_ATTRIBUTES, SET_HOLES_ATTRIBUTES, REMOVE, INVERT, UNDO, REDO, UNCREATE, PROJECT_RE_NAME, RECREATE, ROLLBACK, OPEN_PROJECT_CONFIGURATOR, SET_PROJECT_PROPERTIES, SET_PROJECT_ID, INIT_CATALOG, UPDATE_MOUSE_COORDS, UPDATE_ZOOM_SCALE, TOGGLE_SNAP, CHANGE_CATALOG_PAGE, GO_BACK_TO_CATALOG_PAGE, THROW_ERROR, THROW_WARNING, COPY_PROPERTIES, PASTE_PROPERTIES, PUSH_LAST_SELECTED_CATALOG_ELEMENT_TO_HISTORY, ALTERATE_STATE, SET_MODE, ADD_HORIZONTAL_GUIDE, ADD_VERTICAL_GUIDE, ADD_CIRCULAR_GUIDE, REMOVE_HORIZONTAL_GUIDE, REMOVE_VERTICAL_GUIDE, REMOVE_CIRCULAR_GUIDE, REMOVE_DRAWING_SUPPORT, SELECT_ALL, SET_STATE_PROPERTIES, SHIFT2DOFF, SHIFT2DON, SET_IS_HELP, SET_IS_CABINET_DRAWING, ADD_ELEMENT_TO_CATALOG, CREATE_ROOM_WITH_SHAPE } from "../constants";
1
+ import { NEW_PROJECT, LOAD_PROJECT, SAVE_PROJECT, OPEN_CATALOG, SELECT_TOOL_EDIT, UNSELECT_ALL, SET_PROPERTIES, SET_ITEMS_ATTRIBUTES, SET_LINES_ATTRIBUTES, SET_HOLES_ATTRIBUTES, REMOVE, INVERT, UNDO, REDO, UNCREATE, PROJECT_RE_NAME, RECREATE, ROLLBACK, OPEN_PROJECT_CONFIGURATOR, SET_PROJECT_PROPERTIES, SET_PROJECT_ID, INIT_CATALOG, UPDATE_MOUSE_COORDS, UPDATE_ZOOM_SCALE, TOGGLE_SNAP, CHANGE_CATALOG_PAGE, GO_BACK_TO_CATALOG_PAGE, THROW_ERROR, THROW_WARNING, COPY_PROPERTIES, PASTE_PROPERTIES, PUSH_LAST_SELECTED_CATALOG_ELEMENT_TO_HISTORY, ALTERATE_STATE, SET_MODE, ADD_HORIZONTAL_GUIDE, ADD_VERTICAL_GUIDE, ADD_CIRCULAR_GUIDE, REMOVE_HORIZONTAL_GUIDE, REMOVE_VERTICAL_GUIDE, REMOVE_CIRCULAR_GUIDE, REMOVE_DRAWING_SUPPORT, SELECT_ALL, SET_STATE_PROPERTIES, SHIFT2DOFF, SHIFT2DON, SET_IS_HELP, SET_IS_CABINET_DRAWING, ADD_ELEMENT_TO_CATALOG } from "../constants";
2
2
  export function setIsHelp(isHelp) {
3
3
  return {
4
4
  type: SET_IS_HELP,
@@ -17,10 +17,11 @@ export function setStateProperties(properties) {
17
17
  properties: properties
18
18
  };
19
19
  }
20
- export function loadProject(sceneJSON) {
20
+ export function loadProject(sceneJSON, categoryData) {
21
21
  return {
22
22
  type: LOAD_PROJECT,
23
- sceneJSON: sceneJSON
23
+ sceneJSON: sceneJSON,
24
+ categoryData: categoryData
24
25
  };
25
26
  }
26
27
  export function newProject() {
@@ -98,10 +99,8 @@ export function setHolesAttributes(holesAttributes) {
98
99
  };
99
100
  }
100
101
  export function remove() {
101
- var delObject = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
102
102
  return {
103
- type: REMOVE,
104
- delObject: delObject
103
+ type: REMOVE
105
104
  };
106
105
  }
107
106
  export function undo() {
@@ -285,13 +284,4 @@ export function selectAll() {
285
284
  type: SELECT_ALL,
286
285
  value: value
287
286
  };
288
- }
289
- export function createRoomWithShape(roomShapeType, width, height, doorStyle) {
290
- return {
291
- type: CREATE_ROOM_WITH_SHAPE,
292
- width: width,
293
- height: height,
294
- roomShapeType: roomShapeType,
295
- doorStyle: doorStyle
296
- };
297
287
  }