kitchen-simulator 2.0.17 → 2.0.21

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.
@@ -61,7 +61,7 @@ var STYLE_FNT0 = {
61
61
  };
62
62
  var EPSILON = 3;
63
63
  export default {
64
- name: 'Closet Door',
64
+ name: 'Closet',
65
65
  prototype: 'holes',
66
66
  info: {
67
67
  title: 'Closet',
@@ -62,7 +62,7 @@ var STYLE_FNT0 = {
62
62
  };
63
63
  var EPSILON = 3;
64
64
  export default {
65
- name: 'Exterior Door',
65
+ name: 'Exterior',
66
66
  prototype: 'holes',
67
67
  info: {
68
68
  title: 'Exterior',
@@ -62,7 +62,7 @@ var STYLE_FNT0 = {
62
62
  };
63
63
  var EPSILON = 3;
64
64
  export default {
65
- name: 'Interior Door',
65
+ name: 'Interior',
66
66
  prototype: 'holes',
67
67
  info: {
68
68
  title: 'Interior',
@@ -8,7 +8,7 @@ import { loadGLTF } from "../../utils/load-obj";
8
8
  import { OBJTYPE_MESH } from "../../../constants";
9
9
  var cached3DDoor = null;
10
10
  export default {
11
- name: 'Sliding Door',
11
+ name: 'Sliding',
12
12
  prototype: 'holes',
13
13
  info: {
14
14
  tag: ['door'],
@@ -16,7 +16,7 @@ var STYLE_HOLE_SELECTED = {
16
16
  };
17
17
  var EPSILON = 3;
18
18
  export default {
19
- name: 'Vertical Window',
19
+ name: 'window-vertical',
20
20
  prototype: 'holes',
21
21
  info: {
22
22
  tag: ['window'],
@@ -797,14 +797,6 @@ export default function Viewer2D(_ref, _ref2) {
797
797
  break;
798
798
  }
799
799
  }
800
- if (!isEmpty(elementPrototype)) {
801
- var elementID = state.getIn(['scene', 'layers', layerID, 'selected', elementPrototype]).first();
802
- var currentObject = state.getIn(['scene', 'layers', layerID, elementPrototype, elementID]);
803
- onInternalEvent === null || onInternalEvent === void 0 || onInternalEvent({
804
- type: internalType,
805
- value: currentObject === null || currentObject === void 0 ? void 0 : currentObject.toJS()
806
- });
807
- }
808
800
  viewerEvent.originalEvent.stopPropagation();
809
801
  };
810
802
  var onMouseDown = function onMouseDown(viewerEvent) {
@@ -133,10 +133,11 @@ function _parseTempPlaceholdersFromCabinetPayload() {
133
133
  tempPlaceholders.map(function (element) {
134
134
  var sink_match = element.name.match(/\d_(sink_[^LR12]*)(_[LR12])?$/);
135
135
  if (sink_match && sink_match.length >= 2) {
136
+ var _cabinetPayload$struc2;
136
137
  tempData['sink'] = tempData['sink'] || [];
137
138
  tempData['sink'].push(element.name);
138
- var sink_url = process.env.DEV_HTTP + process.env.DEV_PORT + "/uploads/assets/default/".concat(sink_match[1], ".gltf");
139
- json_data.sink = sink_url;
139
+ var sink_url = process.env.API_URL + "/uploads/assets/default/".concat(sink_match[1], ".gltf");
140
+ if (cabinetPayload !== null && cabinetPayload !== void 0 && (_cabinetPayload$struc2 = cabinetPayload.structure_json) !== null && _cabinetPayload$struc2 !== void 0 && (_cabinetPayload$struc2 = _cabinetPayload$struc2.tempPlaceholders[0]) !== null && _cabinetPayload$struc2 !== void 0 && _cabinetPayload$struc2.structure) cabinetPayload.structure_json.tempPlaceholders[0].structure.sink = sink_url;
140
141
  } else if (temp.some(function (felement) {
141
142
  return felement.name.includes('base_drawer');
142
143
  }) && element.name.includes('interior_drawer')) {
@@ -499,19 +500,26 @@ function addItemToCatalog(_x5, _x6, _x7, _x8) {
499
500
  } // Get attributs of current selected element
500
501
  function _addItemToCatalog() {
501
502
  _addItemToCatalog = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(element, state, catalogInstance, projectActions) {
503
+ var _element, _element2;
502
504
  var elementJs, catalog, outlineSVGData, updatedStructureJson;
503
505
  return _regeneratorRuntime.wrap(function (_context5) {
504
506
  while (1) switch (_context5.prev = _context5.next) {
505
507
  case 0:
508
+ if (!isEmpty((_element = element) === null || _element === void 0 ? void 0 : _element.name)) {
509
+ _context5.next = 1;
510
+ break;
511
+ }
512
+ return _context5.abrupt("return");
513
+ case 1:
506
514
  elementJs = element;
507
515
  catalog = state.getIn(['catalog']).toJS(); // add item to catalog of state
508
516
  // if (isEmpty(catalog?.elements[element.name])) {
509
- _context5.next = 1;
517
+ _context5.next = 2;
510
518
  return loadSVGsByItem(element);
511
- case 1:
519
+ case 2:
512
520
  outlineSVGData = _context5.sent;
513
- if (!(element.type === 'cabinet')) {
514
- _context5.next = 3;
521
+ if (!(((_element2 = element) === null || _element2 === void 0 ? void 0 : _element2.type) === 'cabinet')) {
522
+ _context5.next = 4;
515
523
  break;
516
524
  }
517
525
  // make placeholders of element and tempPlaceholder
@@ -523,11 +531,11 @@ function _addItemToCatalog() {
523
531
  itemID: element.itemID
524
532
  }
525
533
  });
526
- _context5.next = 2;
534
+ _context5.next = 3;
527
535
  return updateCabinetPayload(element);
528
- case 2:
529
- elementJs = _context5.sent;
530
536
  case 3:
537
+ elementJs = _context5.sent;
538
+ case 4:
531
539
  elementJs = _objectSpread(_objectSpread({}, elementJs), {}, {
532
540
  outlineSVGData: outlineSVGData,
533
541
  type: element.type,
@@ -540,7 +548,7 @@ function _addItemToCatalog() {
540
548
  projectActions.addElementToCatalog(elementJs);
541
549
  }
542
550
  // }
543
- case 4:
551
+ case 5:
544
552
  case "end":
545
553
  return _context5.stop();
546
554
  }
@@ -1007,9 +1015,13 @@ function _handleExternalEvent() {
1007
1015
  it = evt === null || evt === void 0 || (_evt$payload2 = evt.payload) === null || _evt$payload2 === void 0 || (_evt$payload2 = _evt$payload2.layers['layer-1']) === null || _evt$payload2 === void 0 ? void 0 : _evt$payload2.items[itemKeys[i]];
1008
1016
  if (!cdsItems.some(function (v) {
1009
1017
  var _it$doorStyle;
1010
- return it.type === v.type && ((_it$doorStyle = it.doorStyle) === null || _it$doorStyle === void 0 || (_it$doorStyle = _it$doorStyle.doorStyles) === null || _it$doorStyle === void 0 ? void 0 : _it$doorStyle.cabinet_door_style_id) === v.cdsId;
1018
+ return it.itemId === v.itemId && it.name === v.name && ((_it$doorStyle = it.doorStyle) === null || _it$doorStyle === void 0 || (_it$doorStyle = _it$doorStyle.doorStyles) === null || _it$doorStyle === void 0 ? void 0 : _it$doorStyle.cabinet_door_style_id) === v.cdsId;
1011
1019
  })) cdsItems.push({
1012
- type: it.type,
1020
+ itemId: it.itemId,
1021
+ name: it.name,
1022
+ sku_number: it.sku_number,
1023
+ category: it.category,
1024
+ prototype: it.prototype,
1013
1025
  cdsId: (_it$doorStyle2 = it.doorStyle) === null || _it$doorStyle2 === void 0 || (_it$doorStyle2 = _it$doorStyle2.doorStyles) === null || _it$doorStyle2 === void 0 ? void 0 : _it$doorStyle2.cabinet_door_style_id
1014
1026
  });
1015
1027
  case 1:
@@ -70,7 +70,7 @@ var STYLE_FNT0 = {
70
70
  };
71
71
  var EPSILON = 3;
72
72
  var _default = exports["default"] = {
73
- name: 'Closet Door',
73
+ name: 'Closet',
74
74
  prototype: 'holes',
75
75
  info: {
76
76
  title: 'Closet',
@@ -71,7 +71,7 @@ var STYLE_FNT0 = {
71
71
  };
72
72
  var EPSILON = 3;
73
73
  var _default = exports["default"] = {
74
- name: 'Exterior Door',
74
+ name: 'Exterior',
75
75
  prototype: 'holes',
76
76
  info: {
77
77
  title: 'Exterior',
@@ -71,7 +71,7 @@ var STYLE_FNT0 = {
71
71
  };
72
72
  var EPSILON = 3;
73
73
  var _default = exports["default"] = {
74
- name: 'Interior Door',
74
+ name: 'Interior',
75
75
  prototype: 'holes',
76
76
  info: {
77
77
  title: 'Interior',
@@ -17,7 +17,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
17
17
 
18
18
  var cached3DDoor = null;
19
19
  var _default = exports["default"] = {
20
- name: 'Sliding Door',
20
+ name: 'Sliding',
21
21
  prototype: 'holes',
22
22
  info: {
23
23
  tag: ['door'],
@@ -25,7 +25,7 @@ var STYLE_HOLE_SELECTED = {
25
25
  };
26
26
  var EPSILON = 3;
27
27
  var _default = exports["default"] = {
28
- name: 'Vertical Window',
28
+ name: 'window-vertical',
29
29
  prototype: 'holes',
30
30
  info: {
31
31
  tag: ['window'],
@@ -807,14 +807,6 @@ function Viewer2D(_ref, _ref2) {
807
807
  break;
808
808
  }
809
809
  }
810
- if (!(0, _helper.isEmpty)(elementPrototype)) {
811
- var elementID = state.getIn(['scene', 'layers', layerID, 'selected', elementPrototype]).first();
812
- var currentObject = state.getIn(['scene', 'layers', layerID, elementPrototype, elementID]);
813
- onInternalEvent === null || onInternalEvent === void 0 || onInternalEvent({
814
- type: internalType,
815
- value: currentObject === null || currentObject === void 0 ? void 0 : currentObject.toJS()
816
- });
817
- }
818
810
  viewerEvent.originalEvent.stopPropagation();
819
811
  };
820
812
  var onMouseDown = function onMouseDown(viewerEvent) {
@@ -140,10 +140,11 @@ function _parseTempPlaceholdersFromCabinetPayload() {
140
140
  tempPlaceholders.map(function (element) {
141
141
  var sink_match = element.name.match(/\d_(sink_[^LR12]*)(_[LR12])?$/);
142
142
  if (sink_match && sink_match.length >= 2) {
143
+ var _cabinetPayload$struc2;
143
144
  tempData['sink'] = tempData['sink'] || [];
144
145
  tempData['sink'].push(element.name);
145
- var sink_url = process.env.DEV_HTTP + process.env.DEV_PORT + "/uploads/assets/default/".concat(sink_match[1], ".gltf");
146
- json_data.sink = sink_url;
146
+ var sink_url = process.env.API_URL + "/uploads/assets/default/".concat(sink_match[1], ".gltf");
147
+ if (cabinetPayload !== null && cabinetPayload !== void 0 && (_cabinetPayload$struc2 = cabinetPayload.structure_json) !== null && _cabinetPayload$struc2 !== void 0 && (_cabinetPayload$struc2 = _cabinetPayload$struc2.tempPlaceholders[0]) !== null && _cabinetPayload$struc2 !== void 0 && _cabinetPayload$struc2.structure) cabinetPayload.structure_json.tempPlaceholders[0].structure.sink = sink_url;
147
148
  } else if (temp.some(function (felement) {
148
149
  return felement.name.includes('base_drawer');
149
150
  }) && element.name.includes('interior_drawer')) {
@@ -506,19 +507,26 @@ function addItemToCatalog(_x5, _x6, _x7, _x8) {
506
507
  } // Get attributs of current selected element
507
508
  function _addItemToCatalog() {
508
509
  _addItemToCatalog = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(element, state, catalogInstance, projectActions) {
510
+ var _element, _element2;
509
511
  var elementJs, catalog, outlineSVGData, updatedStructureJson;
510
512
  return _regenerator["default"].wrap(function (_context5) {
511
513
  while (1) switch (_context5.prev = _context5.next) {
512
514
  case 0:
515
+ if (!(0, _helper.isEmpty)((_element = element) === null || _element === void 0 ? void 0 : _element.name)) {
516
+ _context5.next = 1;
517
+ break;
518
+ }
519
+ return _context5.abrupt("return");
520
+ case 1:
513
521
  elementJs = element;
514
522
  catalog = state.getIn(['catalog']).toJS(); // add item to catalog of state
515
523
  // if (isEmpty(catalog?.elements[element.name])) {
516
- _context5.next = 1;
524
+ _context5.next = 2;
517
525
  return loadSVGsByItem(element);
518
- case 1:
526
+ case 2:
519
527
  outlineSVGData = _context5.sent;
520
- if (!(element.type === 'cabinet')) {
521
- _context5.next = 3;
528
+ if (!(((_element2 = element) === null || _element2 === void 0 ? void 0 : _element2.type) === 'cabinet')) {
529
+ _context5.next = 4;
522
530
  break;
523
531
  }
524
532
  // make placeholders of element and tempPlaceholder
@@ -530,11 +538,11 @@ function _addItemToCatalog() {
530
538
  itemID: element.itemID
531
539
  }
532
540
  });
533
- _context5.next = 2;
541
+ _context5.next = 3;
534
542
  return updateCabinetPayload(element);
535
- case 2:
536
- elementJs = _context5.sent;
537
543
  case 3:
544
+ elementJs = _context5.sent;
545
+ case 4:
538
546
  elementJs = _objectSpread(_objectSpread({}, elementJs), {}, {
539
547
  outlineSVGData: outlineSVGData,
540
548
  type: element.type,
@@ -547,7 +555,7 @@ function _addItemToCatalog() {
547
555
  projectActions.addElementToCatalog(elementJs);
548
556
  }
549
557
  // }
550
- case 4:
558
+ case 5:
551
559
  case "end":
552
560
  return _context5.stop();
553
561
  }
@@ -1014,9 +1022,13 @@ function _handleExternalEvent() {
1014
1022
  it = evt === null || evt === void 0 || (_evt$payload2 = evt.payload) === null || _evt$payload2 === void 0 || (_evt$payload2 = _evt$payload2.layers['layer-1']) === null || _evt$payload2 === void 0 ? void 0 : _evt$payload2.items[itemKeys[i]];
1015
1023
  if (!cdsItems.some(function (v) {
1016
1024
  var _it$doorStyle;
1017
- return it.type === v.type && ((_it$doorStyle = it.doorStyle) === null || _it$doorStyle === void 0 || (_it$doorStyle = _it$doorStyle.doorStyles) === null || _it$doorStyle === void 0 ? void 0 : _it$doorStyle.cabinet_door_style_id) === v.cdsId;
1025
+ return it.itemId === v.itemId && it.name === v.name && ((_it$doorStyle = it.doorStyle) === null || _it$doorStyle === void 0 || (_it$doorStyle = _it$doorStyle.doorStyles) === null || _it$doorStyle === void 0 ? void 0 : _it$doorStyle.cabinet_door_style_id) === v.cdsId;
1018
1026
  })) cdsItems.push({
1019
- type: it.type,
1027
+ itemId: it.itemId,
1028
+ name: it.name,
1029
+ sku_number: it.sku_number,
1030
+ category: it.category,
1031
+ prototype: it.prototype,
1020
1032
  cdsId: (_it$doorStyle2 = it.doorStyle) === null || _it$doorStyle2 === void 0 || (_it$doorStyle2 = _it$doorStyle2.doorStyles) === null || _it$doorStyle2 === void 0 ? void 0 : _it$doorStyle2.cabinet_door_style_id
1021
1033
  });
1022
1034
  case 1:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitchen-simulator",
3
- "version": "2.0.17",
3
+ "version": "2.0.21",
4
4
  "description": "It is a kitchen simulator (self-contained micro-frontend).",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",