kitchen-simulator 10.3.0 → 10.5.0

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 (33) hide show
  1. package/es/catalog/utils/item-loader.js +4 -4
  2. package/es/class/item.js +1 -3
  3. package/es/class/line.js +1 -3
  4. package/es/components/viewer2d/item.js +3 -4
  5. package/es/components/viewer2d/utils.js +0 -6
  6. package/es/components/viewer2d/viewer2d.js +3 -3
  7. package/es/components/viewer3d/ruler-utils/layer3D.js +2 -2
  8. package/es/components/viewer3d/scene-creator.js +40 -75
  9. package/es/components/viewer3d/viewer3d.js +4 -7
  10. package/es/devLiteRenderer.js +2 -15
  11. package/es/events/external/handleExternalEvent.js +1 -0
  12. package/es/events/external/handlers.syncScene.js +1 -1
  13. package/es/shared/domain/cabinet-warning.js +14 -0
  14. package/es/utils/geometry.js +4 -7
  15. package/es/utils/helper.js +13 -22
  16. package/es/utils/skinPanelEngine.js +5 -9
  17. package/lib/catalog/utils/item-loader.js +3 -3
  18. package/lib/class/item.js +1 -3
  19. package/lib/class/line.js +1 -3
  20. package/lib/components/viewer2d/item.js +3 -4
  21. package/lib/components/viewer2d/utils.js +0 -7
  22. package/lib/components/viewer2d/viewer2d.js +3 -3
  23. package/lib/components/viewer3d/ruler-utils/layer3D.js +2 -2
  24. package/lib/components/viewer3d/scene-creator.js +39 -75
  25. package/lib/components/viewer3d/viewer3d.js +4 -7
  26. package/lib/devLiteRenderer.js +2 -15
  27. package/lib/events/external/handleExternalEvent.js +1 -0
  28. package/lib/events/external/handlers.syncScene.js +1 -1
  29. package/lib/shared/domain/cabinet-warning.js +19 -0
  30. package/lib/utils/geometry.js +4 -7
  31. package/lib/utils/helper.js +13 -23
  32. package/lib/utils/skinPanelEngine.js +4 -8
  33. package/package.json +1 -1
@@ -12,8 +12,8 @@ import { ARROW_COLOR, BASE_CABINET_LAYOUTPOS, OBJTYPE_GROUP, OBJTYPE_MESH, SHADE
12
12
  import { Item } from "../../models";
13
13
  import * as GeomUtils from "./geom-utils";
14
14
  import { loadGLTF } from "./load-obj";
15
- import { animateDoor, getSkuAliasFromCatalogElement, isEmpty, translateDrawer } from "../../utils/helper";
16
- import { isWarningItem } from "../../components/viewer2d/utils";
15
+ import { animateDoor, getCatalogCabinetSku, isEmpty, translateDrawer } from "../../utils/helper";
16
+ import { isWarningCabinet } from "../../shared/domain/cabinet-warning";
17
17
  import { orderCabinetAssemblyKeys } from "../cabinet/cabinet-assembly-order";
18
18
  var INITIAL_NORMAL_MAP = '';
19
19
 
@@ -124,7 +124,7 @@ export function render2DItem(element, layer, scene, sizeinfo, layoutpos, is_corn
124
124
  var rowCount = 0; //parseInt((element.type.length / lineCount - 0.51).toFixed(), 10);
125
125
 
126
126
  // Get SKU Alias
127
- var objSKU = getSkuAliasFromCatalogElement(this, element);
127
+ var objSKU = getCatalogCabinetSku(element);
128
128
  if (rowCount > 0) {
129
129
  for (var _x = 0; _x < rowCount; _x++) {
130
130
  splitStr.push(objSKU.slice(lineCount * _x, lineCount * (_x + 1)));
@@ -293,7 +293,7 @@ export function render2DItem(element, layer, scene, sizeinfo, layoutpos, is_corn
293
293
  }), /*#__PURE__*/React.createElement("g", {
294
294
  transform: "translate(".concat(padding_width, ",").concat(padding_depth, ")")
295
295
  }, txtContent)), element.category === 'cabinet' && /*#__PURE__*/React.createElement("g", {
296
- visibility: isWarningItem(element) ? 'visible' : 'hidden'
296
+ visibility: isWarningCabinet(element) ? 'visible' : 'hidden'
297
297
  }, warning_buttons)));
298
298
  } else {
299
299
  rendered = /*#__PURE__*/React.createElement("g", {
package/es/class/item.js CHANGED
@@ -567,9 +567,7 @@ var Item = /*#__PURE__*/function () {
567
567
  break;
568
568
  }
569
569
  if (onInternalEvent && duplicatedElement) {
570
- var _state$get;
571
- var catalog = (_state$get = state.get('catalog')) === null || _state$get === void 0 ? void 0 : _state$get.toJS();
572
- var jsElement = updatePayloadOfInternalEvent(duplicatedElement, layer, catalog);
570
+ var jsElement = updatePayloadOfInternalEvent(duplicatedElement, layer);
573
571
  onInternalEvent({
574
572
  type: INTERNAL_EVENT_DRAW_ELEMENT,
575
573
  value: jsElement
package/es/class/line.js CHANGED
@@ -427,7 +427,6 @@ var Line = /*#__PURE__*/function () {
427
427
  }, {
428
428
  key: "beginDrawingLine",
429
429
  value: function beginDrawingLine(state, layerID, x, y, onInternalEvent) {
430
- var _state$get;
431
430
  // if end drawing by created area
432
431
  if (state.mode == MODE_IDLE) {
433
432
  return {
@@ -481,8 +480,7 @@ var Line = /*#__PURE__*/function () {
481
480
  drawingSupport: drawingSupport
482
481
  });
483
482
  var layer = state.getIn(['scene', 'layers', layerID]);
484
- var catalog = (_state$get = state.get('catalog')) === null || _state$get === void 0 ? void 0 : _state$get.toJS();
485
- var payload = updatePayloadOfInternalEvent(line, layer, catalog);
483
+ var payload = updatePayloadOfInternalEvent(line, layer);
486
484
  if (onInternalEvent) onInternalEvent({
487
485
  type: INTERNAL_EVENT_START_DRAW_WALL,
488
486
  value: payload
@@ -3,9 +3,8 @@ import React, { useState } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import RulerDist from "./rulerDist";
5
5
  import { convert } from "../../utils/convert-units-lite";
6
- import { GeometryUtils } from "../../utils/export";
7
6
  import { MODE_ROTATING_ITEM, WALL_CABINET_LAYOUTPOS } from "../../constants";
8
- import { isEmpty, isWarningItem, returnReplaceableDeepSearchType } from "./utils";
7
+ import { isWarningCabinet } from "../../shared/domain/cabinet-warning";
9
8
  import { calcDistancesFromItemToWalls, findCatalogElement } from "../../utils/geometry";
10
9
  var STYLE_LINE = {
11
10
  fill: '#0096fd',
@@ -88,7 +87,7 @@ export default function Item(_ref, _ref2) {
88
87
  length: itemDistanceFromLine,
89
88
  angle: rotation,
90
89
  rotation: element[1],
91
- transform: "translate(".concat(element[1] === 180 ? -nw : element[1] === 0 ? nw : 0, ", ").concat(element[1] === 90 ? nh : element[1] === -90 ? cat.info.is_corner !== 1 ? -(nh + 4) : -nh : 0, ") rotate(").concat(element[1], ", 0, 0)")
90
+ transform: "translate(".concat(element[1] === 180 ? -nw : element[1] === 0 ? nw : 0, ", ").concat(element[1] === 90 ? nh : element[1] === -90 ? (item === null || item === void 0 ? void 0 : item.is_corner) !== 1 ? -(nh + 4) : -nh : 0, ") rotate(").concat(element[1], ", 0, 0)")
92
91
  })));
93
92
  }
94
93
  });
@@ -170,7 +169,7 @@ export default function Item(_ref, _ref2) {
170
169
  y: "-19",
171
170
  height: "16",
172
171
  width: "16",
173
- style: isWarningItem(item) ? {
172
+ style: isWarningCabinet(item) ? {
174
173
  transform: 'rotateX(180deg)',
175
174
  opacity: 0.5
176
175
  } : {
@@ -184,10 +184,4 @@ export var areaPolygon = function areaPolygon(points) {
184
184
  }
185
185
  var area = det / 2;
186
186
  return signed ? area : Math.abs(area);
187
- };
188
- export var isWarningItem = function isWarningItem(item) {
189
- var _item$toJS$doorStyle;
190
- if (item.category === 'cabinet') return !(item !== null && item !== void 0 && (_item$toJS$doorStyle = item.toJS().doorStyle) !== null && _item$toJS$doorStyle !== void 0 && (_item$toJS$doorStyle = _item$toJS$doorStyle.doorStyles) !== null && _item$toJS$doorStyle !== void 0 && (_item$toJS$doorStyle = _item$toJS$doorStyle.cds) !== null && _item$toJS$doorStyle !== void 0 && _item$toJS$doorStyle.filter(function (cd) {
191
- return cd.itemID == (item === null || item === void 0 ? void 0 : item.getIn(['itemID']));
192
- }).length) > 0;else return false;
193
187
  };
@@ -16,7 +16,7 @@ import { convert } from "../../utils/convert-units-lite";
16
16
  import { Map } from 'immutable';
17
17
  import { formatNumber } from "../../utils/math";
18
18
  import { isEmpty, updatePayloadOfInternalEvent } from "../../utils/helper"; // variables
19
- import { isWarningItem } from "./utils";
19
+ import { isWarningCabinet } from "../../shared/domain/cabinet-warning";
20
20
  // variables
21
21
  var pinFlag = false;
22
22
  var sFlag = false; //for all object move
@@ -953,7 +953,7 @@ export default function Viewer2D(_ref, _ref2) {
953
953
  case 'items':
954
954
  if (elementData.part === 'duplicate') {
955
955
  var currentObject = state.getIn(['scene', 'layers', layerID, 'items', elementData.id]);
956
- if (!isWarningItem(currentObject)) itemsActions.duplicateSelected(currentObject, onInternalEvent); // send draw internal event when duplicating
956
+ if (!isWarningCabinet(currentObject)) itemsActions.duplicateSelected(currentObject, onInternalEvent); // send draw internal event when duplicating
957
957
  break;
958
958
  } else if (elementData.part === 'remove') {
959
959
  projectActions.remove();
@@ -1256,7 +1256,7 @@ export default function Viewer2D(_ref, _ref2) {
1256
1256
  _currentObject = state.getIn(['scene', 'layers', layerID, elementPrototype, elementID]);
1257
1257
  }
1258
1258
  if (_currentObject) {
1259
- var payload = updatePayloadOfInternalEvent(_currentObject, layer, catalog);
1259
+ var payload = updatePayloadOfInternalEvent(_currentObject, layer);
1260
1260
 
1261
1261
  // send selection event befor replace event
1262
1262
  if (internalType === constants.INTERNAL_EVENT_REPLACE_CABINET) {
@@ -94,8 +94,8 @@ export default function Layer3D(_ref) {
94
94
  depth: depth,
95
95
  altitude: altitude
96
96
  };
97
- val.layoutpos = cat && cat.info.layoutpos;
98
- val.is_corner = cat && cat.info.is_corner;
97
+ val.layoutpos = item === null || item === void 0 ? void 0 : item.layoutpos;
98
+ val.is_corner = item.is_corner;
99
99
  val.item = item.toJS();
100
100
  var calcrect = GeometryUtils.getCalcRectFromItem3D(val);
101
101
  if (isSnapped(calcrect.rect[3], calcrect.rect[2]) || isSnapped(calcrect.rect[2], calcrect.rect[1]) || isSnapped(calcrect.rect[0], calcrect.rect[3])) {
@@ -6,15 +6,17 @@ import * as Three from 'three';
6
6
  import { Color, Group } from 'three';
7
7
  import createGrid from "./grid-creator";
8
8
  import { disposeObject } from "./three-memory-cleaner";
9
- import { ANIMATE_STEP_MAX, ANIMATE_STEP_MIN, ARRAY_3D_MODES, ARROW_TEXT_BACKCOLOR, ARROW_TEXT_FONTFACE, ARROW_TEXT_FORECOLOR, BASE_CABINET_LAYOUTPOS, BOTTOM_MOLDING_LOCATION, DECIMAL_PLACES_2, DIFFERENT_VALUES_PATH_LENGTH, DISTANCE_EPSILON, EPSILON, MIDDLE_MOLDING_LOCATION, MODE_DRAGGING_ITEM_3D, MODE_DRAWING_ITEM_3D, MODE_IDLE, MODE_IDLE_3D, MODE_ROTATING_ITEM_3D, OBJTYPE_MESH, SHADE_DARK_PURPLE_COLOR, TOP_MOLDING_LOCATION, UNIT_CENTIMETER, UNIT_FOOT, UNIT_INCH, UNIT_METER, WALL_CABINET_LAYOUTPOS } from "../../constants";
9
+ import { ANIMATE_STEP_MAX, ANIMATE_STEP_MIN, ARRAY_3D_MODES, ARROW_TEXT_BACKCOLOR, ARROW_TEXT_FONTFACE, ARROW_TEXT_FORECOLOR, BASE_CABINET_LAYOUTPOS, BOTTOM_MOLDING_LOCATION, DECIMAL_PLACES_2, DIFFERENT_VALUES_PATH_LENGTH, DISTANCE_EPSILON, EPSILON, ITEM_TYPE, MIDDLE_MOLDING_LOCATION, MODE_DRAGGING_ITEM_3D, MODE_DRAWING_ITEM_3D, MODE_IDLE, MODE_IDLE_3D, MODE_ROTATING_ITEM_3D, OBJTYPE_MESH, SHADE_DARK_PURPLE_COLOR, TOP_MOLDING_LOCATION, UNIT_CENTIMETER, UNIT_FOOT, UNIT_INCH, UNIT_METER, WALL_CABINET_LAYOUTPOS } from "../../constants";
10
10
  import { GeometryUtils, IDBroker, MoldingUtils } from "../../utils/export";
11
11
  import { convert } from "../../utils/convert-units-lite";
12
12
  import { calcDistancesFromItemToWalls, getLineSnapPointsOfItem, getSnappedWallLines, isOverlappedTwoItemsOnOneLine, pointsDistance, verticesDistance } from "../../utils/geometry";
13
13
  import * as GeomUtils from "../../catalog/utils/geom-utils";
14
14
  import { loadTexture } from "../../catalog/utils/item-loader";
15
+ import { isWarningCabinet } from "../../shared/domain/cabinet-warning";
15
16
  import { returnReplaceableDeepSearchType } from "../viewer2d/utils";
16
17
  import { animateDoor, isElevationView, isEmpty, isImmutable, replaceMeshesWithLineSegments, translateDrawer } from "../../utils/helper";
17
18
  import { formatNumber } from "../../utils/math";
19
+ import { toJSIfNeeded } from "../../shared/objects/immutable";
18
20
  export var fVLine = [];
19
21
  var scene_mode = null;
20
22
  export function parseData(sceneData, actions, catalog, camera, renderer, mode) {
@@ -502,16 +504,14 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
502
504
  }
503
505
  var mBoxColor = 0x99c3fb;
504
506
  var _item = item.toJS();
505
- if (_item.doorStyle.doorStyles !== undefined && _item.doorStyle.doorStyles.cds) {
506
- if (showYelloBox(_item)) {
507
- mBoxColor = 'rgba(232,187,47,1)';
508
- var mBox = GeomUtils.makeMBoxfromObject(item3D, mBoxColor);
509
- var warningObj = createWarningObject();
510
- warningObj.position.set(0, item.properties.get('height').get('length') / 3, 0);
511
- if (mBox) {
512
- mBox.add(warningObj);
513
- item3D.add(mBox);
514
- }
507
+ if (isWarningCabinet(_item)) {
508
+ mBoxColor = 'rgba(232,187,47,1)';
509
+ var mBox = GeomUtils.makeMBoxfromObject(item3D, mBoxColor);
510
+ var warningObj = createWarningObject();
511
+ warningObj.position.set(0, item.properties.get('height').get('length') / 3, 0);
512
+ if (mBox) {
513
+ mBox.add(warningObj);
514
+ item3D.add(mBox);
515
515
  }
516
516
  }
517
517
  }
@@ -692,16 +692,14 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
692
692
  if (item3D) {
693
693
  var _mBoxColor = 0x99c3fb;
694
694
  var _item2 = item.toJS();
695
- if (_item2.doorStyle.doorStyles !== undefined && _item2.doorStyle.doorStyles.cds) {
696
- if (showYelloBox(_item2)) {
697
- _mBoxColor = 'rgba(232,187,47,1)';
698
- var _mBox2 = GeomUtils.makeMBoxfromObject(item3D, _mBoxColor);
699
- var _warningObj = createWarningObject();
700
- _warningObj.position.set(0, item.properties.get('height').get('length') / 3, 0);
701
- if (_mBox2) {
702
- _mBox2.add(_warningObj);
703
- item3D.add(_mBox2);
704
- }
695
+ if (isWarningCabinet(_item2)) {
696
+ _mBoxColor = 'rgba(232,187,47,1)';
697
+ var _mBox2 = GeomUtils.makeMBoxfromObject(item3D, _mBoxColor);
698
+ var _warningObj = createWarningObject();
699
+ _warningObj.position.set(0, item.properties.get('height').get('length') / 3, 0);
700
+ if (_mBox2) {
701
+ _mBox2.add(_warningObj);
702
+ item3D.add(_mBox2);
705
703
  }
706
704
  }
707
705
  }
@@ -824,10 +822,8 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
824
822
  }
825
823
  var _mBoxColor2 = 0x99c3fb;
826
824
  var _item3 = item.toJS();
827
- if (_item3.doorStyle.doorStyles !== undefined && _item3.doorStyle.doorStyles.cds) {
828
- if (showYelloBox(_item3)) {
829
- _mBoxColor2 = 'rgba(232,187,47,1)';
830
- }
825
+ if (isWarningCabinet(_item3)) {
826
+ _mBoxColor2 = 'rgba(232,187,47,1)';
831
827
  }
832
828
  rItem.children[0].children.forEach(function (rItemElement) {
833
829
  rItemElement.visible = false;
@@ -2047,21 +2043,19 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
2047
2043
  if (pivot) {
2048
2044
  var mBoxColor = 0x99c3fb;
2049
2045
  var _item = item.toJS();
2050
- if (_item.doorStyle.doorStyles !== undefined && _item.doorStyle.doorStyles.cds) {
2051
- if (showYelloBox(_item)) {
2052
- mBoxColor = 'rgba(232,187,47,1)';
2053
- } else {
2054
- pivot.children[0].children.forEach(function (pivotElement) {
2055
- pivotElement.visible = false;
2056
- });
2057
- }
2058
- var mBox = GeomUtils.makeMBoxfromObject(pivot, mBoxColor);
2059
- var warningObj = createWarningObject();
2060
- warningObj.position.set(0, item.properties.get('height').get('length') / 3, 0);
2061
- if (mBox) {
2062
- mBox.add(warningObj);
2063
- pivot.add(mBox);
2064
- }
2046
+ if (isWarningCabinet(_item)) {
2047
+ mBoxColor = 'rgba(232,187,47,1)';
2048
+ } else {
2049
+ pivot.children[0].children.forEach(function (pivotElement) {
2050
+ pivotElement.visible = false;
2051
+ });
2052
+ }
2053
+ var mBox = GeomUtils.makeMBoxfromObject(pivot, mBoxColor);
2054
+ var warningObj = createWarningObject();
2055
+ warningObj.position.set(0, item.properties.get('height').get('length') / 3, 0);
2056
+ if (mBox) {
2057
+ mBox.add(warningObj);
2058
+ pivot.add(mBox);
2065
2059
  }
2066
2060
  }
2067
2061
 
@@ -2159,8 +2153,8 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
2159
2153
  height: height,
2160
2154
  depth: depth
2161
2155
  };
2162
- val.layoutpos = cat.info.layoutpos;
2163
- val.is_corner = cat.info.is_corner;
2156
+ val.layoutpos = item === null || item === void 0 ? void 0 : item.layoutpos;
2157
+ val.is_corner = item === null || item === void 0 ? void 0 : item.is_corner;
2164
2158
  val.item = item;
2165
2159
  var calcrect = GeometryUtils.getCalcRectFromItem3D(val);
2166
2160
 
@@ -2187,13 +2181,9 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
2187
2181
  });
2188
2182
  if (pivot.children.length > 1) {
2189
2183
  var _item4 = item.toJS();
2190
- if (_item4.doorStyle.doorStyles !== undefined) {
2191
- if (_item4.category === 'cabinet') {
2192
- if (_item4.doorStyle.doorStyles.cds.some(function (element) {
2193
- return element.itemID === item.itemID;
2194
- })) {
2195
- pivot.children.pop();
2196
- }
2184
+ if (_item4.category === ITEM_TYPE.CABINET) {
2185
+ if (!isWarningCabinet(item)) {
2186
+ pivot.children.pop();
2197
2187
  } else {
2198
2188
  pivot.children.pop();
2199
2189
  }
@@ -2910,31 +2900,6 @@ export function threedfabs(a) {
2910
2900
  export function getDistanceBetweenLineSegment(pos1, pos2, pos3, pos4) {
2911
2901
  if (pos1.x == pos2.x && pos3.x == pos4.x) return pos3.x - pos1.x;else if (pos1.y == pos2.y && pos3.y == pos4.y) return pos3.y - pos1.y;else return -1;
2912
2902
  }
2913
-
2914
- /**
2915
- * check to see if an item is suitable for the given doorStyle.
2916
- * @param _item
2917
- * @returns true if it's not suitable.
2918
- */
2919
- export function showYelloBox(_item) {
2920
- var _doorStyle;
2921
- var doorStyle = _item === null || _item === void 0 ? void 0 : _item.doorStyle;
2922
-
2923
- // If doorStyle is an Immutable Map, convert to plain JS
2924
- if (doorStyle && typeof doorStyle.toJS === 'function') {
2925
- doorStyle = doorStyle.toJS();
2926
- }
2927
- var isItemCabinet = (_item === null || _item === void 0 ? void 0 : _item.category) === 'cabinet';
2928
- var cds = (_doorStyle = doorStyle) === null || _doorStyle === void 0 || (_doorStyle = _doorStyle.doorStyles) === null || _doorStyle === void 0 ? void 0 : _doorStyle.cds;
2929
-
2930
- // hasItemCDS: item is suitable if its itemID exists in cds
2931
- var hasItemCDS = isItemCabinet && Array.isArray(cds) ? cds.some(function (element) {
2932
- return element.itemID === _item.itemID;
2933
- }) : false;
2934
-
2935
- // return true if it's a cabinet but not suitable for the current doorStyle
2936
- return isItemCabinet && !hasItemCDS;
2937
- }
2938
2903
  function isSimilar(a, b) {
2939
2904
  if (threedfabs(a - b) <= 0.01) return 1;
2940
2905
  return 0;
@@ -3473,7 +3438,7 @@ export function addMolding(MGArray, addItem, planData, layer, itemActions, mode)
3473
3438
  if (addItem.selected && [MODE_DRAGGING_ITEM_3D, MODE_ROTATING_ITEM_3D].includes(mode)) return false;
3474
3439
 
3475
3440
  // If the item is not available for current doorStyle
3476
- if (showYelloBox(addItem))
3441
+ if (isWarningCabinet(addItem))
3477
3442
  // Do not add molding to that item
3478
3443
  return MGArray;
3479
3444
 
@@ -544,7 +544,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
544
544
  if (item !== null) {
545
545
  var catid = item.type;
546
546
  var cat = catalog.elements[catid];
547
- layoutpos = cat.info.layoutpos;
547
+ layoutpos = item === null || item === void 0 ? void 0 : item.layoutpos;
548
548
  }
549
549
  var oPos = new Three.Vector2(pos.clone().x, pos.clone().y);
550
550
  var sBounding = obj.children[0].userData;
@@ -564,9 +564,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
564
564
  return false;
565
565
  }
566
566
  var _item = layer.items.getIn([data.id]);
567
- var ocatid = _item.type;
568
- var ocat = catalog.elements[ocatid];
569
- var olayoutpos = ocat.info.layoutpos;
567
+ var olayoutpos = _item.layoutpos;
570
568
  if (!(layoutpos === BASE_CABINET_LAYOUTPOS && olayoutpos === WALL_CABINET_LAYOUTPOS || layoutpos === WALL_CABINET_LAYOUTPOS && olayoutpos === BASE_CABINET_LAYOUTPOS)) {
571
569
  var tRot = _item.rotation;
572
570
  var tPos = new Three.Vector2(_item.x, _item.y);
@@ -1192,9 +1190,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
1192
1190
  var curLayerId = _this2.props.state.scene.selectedLayer;
1193
1191
  var curLayer = _this2.props.state.scene.getIn(['layers', curLayerId]);
1194
1192
  if (!isEmpty(evtType) && !isEmpty(evtElement)) {
1195
- var _state$get, _this2$props$onIntern, _this2$props;
1196
- var catalog = (_state$get = state.get('catalog')) === null || _state$get === void 0 ? void 0 : _state$get.toJS();
1197
- var payload = updatePayloadOfInternalEvent(evtElement, curLayer, catalog, pointArray);
1193
+ var _this2$props$onIntern, _this2$props;
1194
+ var payload = updatePayloadOfInternalEvent(evtElement, curLayer, pointArray);
1198
1195
  (_this2$props$onIntern = (_this2$props = _this2.props).onInternalEvent) === null || _this2$props$onIntern === void 0 || _this2$props$onIntern.call(_this2$props, {
1199
1196
  type: evtType,
1200
1197
  value: payload
@@ -4,8 +4,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import React, { useState, useEffect } from 'react';
5
5
  import { Map } from 'immutable';
6
6
  import ContainerDimensions from 'react-container-dimensions';
7
- import ccdfPayload1 from "./mocks/get_ccdf_of_b12_brilliant.json";
8
- import ccdfPayload2 from "./mocks/get_ccdf_of_b12_cambridge.json";
7
+ import ccdfPayload from "./mocks/getCCDFPayload.json";
9
8
  import configData from "./mocks/configData.json";
10
9
  import projectJson from "./mocks/project.json";
11
10
  import cabinetPaylod from "./mocks/cabinetPayload.json";
@@ -29,7 +28,6 @@ var options = {
29
28
  unit: 'in',
30
29
  enable3D: true
31
30
  };
32
- var test_num = 0;
33
31
  var onInternalEvent = /*#__PURE__*/function () {
34
32
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(evt, callback) {
35
33
  var _t;
@@ -41,9 +39,8 @@ var onInternalEvent = /*#__PURE__*/function () {
41
39
  _context.next = _t === INTERNAL_EVENT_ITEMS_CATALOG ? 1 : 3;
42
40
  break;
43
41
  case 1:
44
- console.log("Use ".concat(test_num % 2 === 1 ? 'Brilliant' : 'Cambridge'));
45
42
  _context.next = 2;
46
- return callback(test_num % 2 === 1 ? ccdfPayload1 : ccdfPayload2);
43
+ return callback(ccdfPayload);
47
44
  case 2:
48
45
  return _context.abrupt("continue", 3);
49
46
  case 3:
@@ -221,11 +218,6 @@ function WorkSpace(props) {
221
218
  setExternalEvent(evt);
222
219
  }
223
220
  }, "Add B12 Cabinet"), /*#__PURE__*/React.createElement(Button, {
224
- actionType: "danger",
225
- onClick: function onClick() {
226
- test_num = 1;
227
- }
228
- }, "Use Brilliant for ITEMS_CATALOG"), /*#__PURE__*/React.createElement(Button, {
229
221
  actionType: "danger",
230
222
  onClick: function onClick() {
231
223
  var evt = {
@@ -238,11 +230,6 @@ function WorkSpace(props) {
238
230
  setExternalEvent(evt);
239
231
  }
240
232
  }, "DoorStyle Change(Brilliant)"), /*#__PURE__*/React.createElement(Button, {
241
- actionType: "danger",
242
- onClick: function onClick() {
243
- test_num = 2;
244
- }
245
- }, "Use Cambridge for ITEMS_CATALOG"), /*#__PURE__*/React.createElement(Button, {
246
233
  actionType: "danger",
247
234
  onClick: function onClick() {
248
235
  var evt = {
@@ -128,6 +128,7 @@ function _handleExternalEvent() {
128
128
  handleSetFinishing(props, state, evt.payload);
129
129
  return _context.abrupt("continue", 31);
130
130
  case 30:
131
+ console.log('*** catalog ***', props.catalog);
131
132
  handleSyncScene(props, state, layer, layerId, getMoldingDataOfScene2, computeSkinPanels, DEFAULT_MOLDING_PIECE_LENGTH, INTERNAL_EVENT_SYNC_SCENE);
132
133
  return _context.abrupt("continue", 31);
133
134
  case 31:
@@ -9,7 +9,7 @@ export function handleSyncScene(props, state, layer, layerId, getMoldingDataOfSc
9
9
 
10
10
  // get skin panel data
11
11
  var skinPanelExclusionSKUs = (_props$configData$ski = props === null || props === void 0 || (_props$configData2 = props.configData) === null || _props$configData2 === void 0 ? void 0 : _props$configData2.skinPanelExclusionSKUs) !== null && _props$configData$ski !== void 0 ? _props$configData$ski : [];
12
- sceneData.layers[layerId].skinPanelData = computeSkinPanels(layer, skinPanelExclusionSKUs, props.catalog);
12
+ sceneData.layers[layerId].skinPanelData = computeSkinPanels(layer, skinPanelExclusionSKUs);
13
13
 
14
14
  // send scene object from 3DTool to HostApp using internalEvent
15
15
  (_props$onInternalEven = props.onInternalEvent) === null || _props$onInternalEven === void 0 || _props$onInternalEven.call(props, {
@@ -0,0 +1,14 @@
1
+ // Centralized warning heuristic for cabinets across 2D/3D.
2
+ // Rule: a cabinet is "warning" when there are no assets for the current door style.
3
+
4
+ import { ITEM_TYPE } from "../../constants";
5
+ import { toJSIfNeeded } from "../objects/immutable";
6
+
7
+ // Implementation: return true if item.category === 'cabinet' and (no ccdf or empty ccdf.assets3d)
8
+ export function isWarningCabinet(item) {
9
+ var js = toJSIfNeeded(item);
10
+ var isCabinet = (js === null || js === void 0 ? void 0 : js.category) === ITEM_TYPE.CABINET;
11
+ var ccdf = js === null || js === void 0 ? void 0 : js.ccdf;
12
+ var hasCcdf = !!ccdf && !!(ccdf !== null && ccdf !== void 0 && ccdf.id);
13
+ return isCabinet && !hasCcdf;
14
+ }
@@ -739,7 +739,8 @@ export function getAllItemSpecified(scene, catalog, filter) {
739
739
  rotRad: item.rotation / 180 * Math.PI
740
740
  };
741
741
  var cat = item.type ? findCatalogElement(catalog, item.type) : null;
742
- var info = cat === null || cat === void 0 ? void 0 : cat.info;
742
+ val.layoutpos = item.layoutpos;
743
+ val.is_corner = item.is_corner;
743
744
  var props = item.properties;
744
745
  var getSize = function getSize(key) {
745
746
  var _props$getIn, _props$getIn2, _props$getIn3;
@@ -752,15 +753,11 @@ export function getAllItemSpecified(scene, catalog, filter) {
752
753
  depth: getSize('depth')
753
754
  };
754
755
  val.item = item;
755
- if (info) {
756
- val.layoutpos = info.layoutpos;
757
- val.is_corner = info.is_corner;
758
- }
759
756
 
760
757
  // Filter check
761
758
  if (Array.isArray(filter)) {
762
- if (info && !filter.includes(info.layoutpos)) return;
763
- } else if ((info === null || info === void 0 ? void 0 : info.layoutpos) !== filter || isEmpty(cat) || (cat === null || cat === void 0 ? void 0 : cat.type) === 'appliance' && ['Cook Top', 'Microwave'].includes(cat === null || cat === void 0 || (_cat$obj = cat.obj) === null || _cat$obj === void 0 ? void 0 : _cat$obj.category)) {
759
+ if (!val.layoutpos || !filter.includes(val.layoutpos)) return;
760
+ } else if (val.layoutpos !== filter || isEmpty(cat) || (cat === null || cat === void 0 ? void 0 : cat.type) === 'appliance' && ['Cook Top', 'Microwave'].includes(cat === null || cat === void 0 || (_cat$obj = cat.obj) === null || _cat$obj === void 0 ? void 0 : _cat$obj.category)) {
764
761
  return;
765
762
  }
766
763
 
@@ -5,12 +5,14 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
5
5
  import { HDRCubeTextureLoader } from 'three/examples/jsm/loaders/HDRCubeTextureLoader.js';
6
6
  import { ANIMATE_OBJECT_OPEN_DOOR_ROTATION_UNIT, ANIMATE_STEP_MAX, DECIMAL_PLACES_2, HDR_URLS, MAX_ZOOM_IN_SCALE, MODE_ELEVATION_VIEW, UNIT_CENTIMETER, ZOOM_VARIABLE } from "../constants";
7
7
  import * as Three from 'three';
8
- import { isWarningItem, returnReplaceableDeepSearchType } from "./../components/viewer2d/utils";
8
+ import { returnReplaceableDeepSearchType } from "./../components/viewer2d/utils";
9
+ import { isWarningCabinet } from "../shared/domain/cabinet-warning";
9
10
  import { convert } from "./convert-units-lite";
10
11
  import { formatNumber } from "./math";
11
12
  import AWS from 'aws-sdk';
12
13
  import { GeometryUtils, MoldingUtils } from "./export";
13
14
  import { calcDistancesFromHoleToNearestOneOrWall } from "./geometry";
15
+ import { toJSIfNeeded } from "../shared/objects/immutable";
14
16
  var s3 = new AWS.S3({
15
17
  accessKeyId: process.env.REACT_APP_AWS_ID,
16
18
  secretAccessKey: process.env.REACT_APP_AWS_SECRET
@@ -399,11 +401,11 @@ export function centering2D(state) {
399
401
  if (viewer2DActions) updateViwer2D(viewer, viewer2DActions);
400
402
  return state;
401
403
  }
402
- export function updatePayloadOfInternalEvent(currentObject, layer, catalog) {
403
- var pointArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
404
+ export function updatePayloadOfInternalEvent(currentObject, layer) {
405
+ var pointArray = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
404
406
  if (isEmpty(currentObject)) return null;
405
407
  var updatedPayload = currentObject.toJS();
406
- if (isEmpty(layer) || isEmpty(catalog)) return updatedPayload;
408
+ if (isEmpty(layer)) return updatedPayload;
407
409
  if ((currentObject === null || currentObject === void 0 ? void 0 : currentObject.prototype) === 'lines') {
408
410
  // caculating length of selected line//
409
411
  var v_a = layer.vertices.get(currentObject.vertices.get(0));
@@ -414,7 +416,7 @@ export function updatePayloadOfInternalEvent(currentObject, layer, catalog) {
414
416
  //////////////////////////////////////
415
417
  } else if ((currentObject === null || currentObject === void 0 ? void 0 : currentObject.prototype) === 'items') {
416
418
  // check this cabinet has warning box
417
- updatedPayload.isWarning = isWarningItem(currentObject);
419
+ updatedPayload.isWarning = isWarningCabinet(currentObject);
418
420
  // check this item is available molding
419
421
  updatedPayload.isMoldingAvailable = MoldingUtils.isEnableItemForMolding(layer, currentObject);
420
422
  // check this item is snapped to wall
@@ -423,7 +425,7 @@ export function updatePayloadOfInternalEvent(currentObject, layer, catalog) {
423
425
  if (pointArray) updatedPayload.distArray = pointArray;
424
426
 
425
427
  // update sku_number using sku_array
426
- updatedPayload.sku_number = getSkuAliasFromCatalog(catalog, currentObject);
428
+ updatedPayload.sku_number = getCatalogCabinetSku(currentObject);
427
429
  } else if ((currentObject === null || currentObject === void 0 ? void 0 : currentObject.prototype) === 'holes') {
428
430
  var _calcDistancesFromHol = calcDistancesFromHoleToNearestOneOrWall(currentObject, layer),
429
431
  distLeft = _calcDistancesFromHol.distLeft,
@@ -441,20 +443,9 @@ export function updatePayloadOfInternalEvent(currentObject, layer, catalog) {
441
443
  }
442
444
  return updatedPayload;
443
445
  }
444
- export function getSkuAliasFromCatalog(catalog, sceneObject) {
445
- var _catalog$elements;
446
- var sceneObjectJS = typeof (sceneObject === null || sceneObject === void 0 ? void 0 : sceneObject.toJS) === 'function' ? sceneObject.toJS() : sceneObject;
447
- var elementName = sceneObjectJS === null || sceneObjectJS === void 0 ? void 0 : sceneObjectJS.name;
448
- var catalogElement = catalog === null || catalog === void 0 || (_catalog$elements = catalog.elements) === null || _catalog$elements === void 0 ? void 0 : _catalog$elements[elementName];
449
- return getSkuAliasFromCatalogElement(catalogElement, sceneObjectJS);
450
- }
451
- export function getSkuAliasFromCatalogElement(catalogElement, sceneObject) {
452
- var _sceneObjectJS$doorSt, _catalogElement$obj, _skuAlias$sku;
453
- var sceneObjectJS = typeof (sceneObject === null || sceneObject === void 0 ? void 0 : sceneObject.toJS) === 'function' ? sceneObject.toJS() : sceneObject;
454
- var doorColorId = sceneObjectJS === null || sceneObjectJS === void 0 || (_sceneObjectJS$doorSt = sceneObjectJS.doorStyle) === null || _sceneObjectJS$doorSt === void 0 ? void 0 : _sceneObjectJS$doorSt.id;
455
- var skuArray = catalogElement === null || catalogElement === void 0 || (_catalogElement$obj = catalogElement.obj) === null || _catalogElement$obj === void 0 ? void 0 : _catalogElement$obj.skuArray;
456
- var skuAlias = skuArray === null || skuArray === void 0 ? void 0 : skuArray.find(function (sku) {
457
- return sku.door_color_id === doorColorId;
458
- });
459
- return (_skuAlias$sku = skuAlias === null || skuAlias === void 0 ? void 0 : skuAlias.sku) !== null && _skuAlias$sku !== void 0 ? _skuAlias$sku : sceneObjectJS === null || sceneObjectJS === void 0 ? void 0 : sceneObjectJS.sku_number;
446
+ export function getCatalogCabinetSku(sceneObject) {
447
+ var _sceneObjectJS$ccdf;
448
+ var sceneObjectJS = toJSIfNeeded(sceneObject);
449
+ var ccdfSku = sceneObjectJS === null || sceneObjectJS === void 0 || (_sceneObjectJS$ccdf = sceneObjectJS.ccdf) === null || _sceneObjectJS$ccdf === void 0 ? void 0 : _sceneObjectJS$ccdf.catalog_cabinet_sku;
450
+ return ccdfSku;
460
451
  }
@@ -6,7 +6,7 @@ import { BASE_CABINET_LAYOUTPOS, WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS,
6
6
  import { buildRectFromLines, getAllLines, pointsDistance, relationshipOfTwoOverlappedLines, rotatePointAroundPoint } from "./geometry";
7
7
  import { MathUtils } from "./export";
8
8
  import { convert } from "./convert-units-lite";
9
- import { getSkuAliasFromCatalog, isEmpty } from "./helper";
9
+ import { getCatalogCabinetSku, isEmpty } from "./helper";
10
10
  import { SKIN_SKU_BSV_24, SKIN_SKU_BSV_48, SKIN_SKU_WSV_1242, SKIN_SKU_WSV_2442, SKIN_SKU_WSV_2460, SKIN_SKU_USV245325, SKIN_HEIGHT_53_25 } from "../constants/catalog/skinPanel";
11
11
  function toCm(item, prop) {
12
12
  var unit = item.properties.get(prop).get('_unit') || 'cm';
@@ -493,16 +493,12 @@ function buildSkinPanelData(faces) {
493
493
  });
494
494
  return result;
495
495
  }
496
- function shouldExcludeSkinPanel(itemJS, exclusionSet, catalog) {
497
- var _itemJS$doorStyle;
498
- var cabinetSku = getSkuAliasFromCatalog(catalog, itemJS);
499
- var doorColorSku = itemJS === null || itemJS === void 0 || (_itemJS$doorStyle = itemJS.doorStyle) === null || _itemJS$doorStyle === void 0 ? void 0 : _itemJS$doorStyle.sku;
500
- if (!cabinetSku || !doorColorSku) return false;
501
- return exclusionSet.has("".concat(cabinetSku, "-").concat(doorColorSku));
496
+ function shouldExcludeSkinPanel(itemJS, exclusionSet) {
497
+ var catalogCabinetSku = getCatalogCabinetSku(itemJS);
498
+ return exclusionSet.has(catalogCabinetSku);
502
499
  }
503
500
  export function computeSkinPanels(layer) {
504
501
  var skinPanelExclusionSKUs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
505
- var catalog = arguments.length > 2 ? arguments[2] : undefined;
506
502
  var exclusionSet = new Set(skinPanelExclusionSKUs);
507
503
 
508
504
  // Get candidate skin panel items and other items
@@ -510,7 +506,7 @@ export function computeSkinPanels(layer) {
510
506
  skinPanelItems = _collectLayerItems.skinPanelItems,
511
507
  otherItems = _collectLayerItems.otherItems;
512
508
  var filteredSkinPanelItems = skinPanelItems.filter(function (item) {
513
- return !shouldExcludeSkinPanel(item.toJS(), exclusionSet, catalog);
509
+ return !shouldExcludeSkinPanel(item.toJS(), exclusionSet);
514
510
  });
515
511
 
516
512
  // Get all skin face list of [skinPanelItems] & [otherItems]
@@ -24,7 +24,7 @@ var _models = require("../../models");
24
24
  var GeomUtils = _interopRequireWildcard(require("./geom-utils"));
25
25
  var _loadObj = require("./load-obj");
26
26
  var _helper = require("../../utils/helper");
27
- var _utils = require("../../components/viewer2d/utils");
27
+ var _cabinetWarning = require("../../shared/domain/cabinet-warning");
28
28
  var _cabinetAssemblyOrder = require("../cabinet/cabinet-assembly-order");
29
29
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
30
30
  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; }
@@ -138,7 +138,7 @@ function render2DItem(element, layer, scene, sizeinfo, layoutpos, is_corner, sha
138
138
  var rowCount = 0; //parseInt((element.type.length / lineCount - 0.51).toFixed(), 10);
139
139
 
140
140
  // Get SKU Alias
141
- var objSKU = (0, _helper.getSkuAliasFromCatalogElement)(this, element);
141
+ var objSKU = (0, _helper.getCatalogCabinetSku)(element);
142
142
  if (rowCount > 0) {
143
143
  for (var _x = 0; _x < rowCount; _x++) {
144
144
  splitStr.push(objSKU.slice(lineCount * _x, lineCount * (_x + 1)));
@@ -307,7 +307,7 @@ function render2DItem(element, layer, scene, sizeinfo, layoutpos, is_corner, sha
307
307
  }), /*#__PURE__*/_react["default"].createElement("g", {
308
308
  transform: "translate(".concat(padding_width, ",").concat(padding_depth, ")")
309
309
  }, txtContent)), element.category === 'cabinet' && /*#__PURE__*/_react["default"].createElement("g", {
310
- visibility: (0, _utils.isWarningItem)(element) ? 'visible' : 'hidden'
310
+ visibility: (0, _cabinetWarning.isWarningCabinet)(element) ? 'visible' : 'hidden'
311
311
  }, warning_buttons)));
312
312
  } else {
313
313
  rendered = /*#__PURE__*/_react["default"].createElement("g", {
package/lib/class/item.js CHANGED
@@ -574,9 +574,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
574
574
  break;
575
575
  }
576
576
  if (onInternalEvent && duplicatedElement) {
577
- var _state$get;
578
- var catalog = (_state$get = state.get('catalog')) === null || _state$get === void 0 ? void 0 : _state$get.toJS();
579
- var jsElement = (0, _helper.updatePayloadOfInternalEvent)(duplicatedElement, layer, catalog);
577
+ var jsElement = (0, _helper.updatePayloadOfInternalEvent)(duplicatedElement, layer);
580
578
  onInternalEvent({
581
579
  type: _constants.INTERNAL_EVENT_DRAW_ELEMENT,
582
580
  value: jsElement
package/lib/class/line.js CHANGED
@@ -436,7 +436,6 @@ var Line = exports["default"] = /*#__PURE__*/function () {
436
436
  }, {
437
437
  key: "beginDrawingLine",
438
438
  value: function beginDrawingLine(state, layerID, x, y, onInternalEvent) {
439
- var _state$get;
440
439
  // if end drawing by created area
441
440
  if (state.mode == _constants.MODE_IDLE) {
442
441
  return {
@@ -490,8 +489,7 @@ var Line = exports["default"] = /*#__PURE__*/function () {
490
489
  drawingSupport: drawingSupport
491
490
  });
492
491
  var layer = state.getIn(['scene', 'layers', layerID]);
493
- var catalog = (_state$get = state.get('catalog')) === null || _state$get === void 0 ? void 0 : _state$get.toJS();
494
- var payload = (0, _helper.updatePayloadOfInternalEvent)(line, layer, catalog);
492
+ var payload = (0, _helper.updatePayloadOfInternalEvent)(line, layer);
495
493
  if (onInternalEvent) onInternalEvent({
496
494
  type: _constants.INTERNAL_EVENT_START_DRAW_WALL,
497
495
  value: payload
@@ -11,9 +11,8 @@ var _react = _interopRequireWildcard(require("react"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
12
  var _rulerDist = _interopRequireDefault(require("./rulerDist"));
13
13
  var _convertUnitsLite = require("../../utils/convert-units-lite");
14
- var _export = require("../../utils/export");
15
14
  var _constants = require("../../constants");
16
- var _utils = require("./utils");
15
+ var _cabinetWarning = require("../../shared/domain/cabinet-warning");
17
16
  var _geometry = require("../../utils/geometry");
18
17
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
19
18
  var STYLE_LINE = {
@@ -97,7 +96,7 @@ function Item(_ref, _ref2) {
97
96
  length: itemDistanceFromLine,
98
97
  angle: rotation,
99
98
  rotation: element[1],
100
- transform: "translate(".concat(element[1] === 180 ? -nw : element[1] === 0 ? nw : 0, ", ").concat(element[1] === 90 ? nh : element[1] === -90 ? cat.info.is_corner !== 1 ? -(nh + 4) : -nh : 0, ") rotate(").concat(element[1], ", 0, 0)")
99
+ transform: "translate(".concat(element[1] === 180 ? -nw : element[1] === 0 ? nw : 0, ", ").concat(element[1] === 90 ? nh : element[1] === -90 ? (item === null || item === void 0 ? void 0 : item.is_corner) !== 1 ? -(nh + 4) : -nh : 0, ") rotate(").concat(element[1], ", 0, 0)")
101
100
  })));
102
101
  }
103
102
  });
@@ -179,7 +178,7 @@ function Item(_ref, _ref2) {
179
178
  y: "-19",
180
179
  height: "16",
181
180
  width: "16",
182
- style: (0, _utils.isWarningItem)(item) ? {
181
+ style: (0, _cabinetWarning.isWarningCabinet)(item) ? {
183
182
  transform: 'rotateX(180deg)',
184
183
  opacity: 0.5
185
184
  } : {
@@ -9,7 +9,6 @@ exports.getInstallationSuffix = getInstallationSuffix;
9
9
  exports.getToeKickSKU = void 0;
10
10
  exports.isEmpty = isEmpty;
11
11
  exports.isEqualInstallationType = isEqualInstallationType;
12
- exports.isWarningItem = void 0;
13
12
  exports.makeSKUForMagento = makeSKUForMagento;
14
13
  exports.searchForSkuValue = exports.returnReplaceableDeepSearchType = void 0;
15
14
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
@@ -198,10 +197,4 @@ var areaPolygon = exports.areaPolygon = function areaPolygon(points) {
198
197
  }
199
198
  var area = det / 2;
200
199
  return signed ? area : Math.abs(area);
201
- };
202
- var isWarningItem = exports.isWarningItem = function isWarningItem(item) {
203
- var _item$toJS$doorStyle;
204
- if (item.category === 'cabinet') return !(item !== null && item !== void 0 && (_item$toJS$doorStyle = item.toJS().doorStyle) !== null && _item$toJS$doorStyle !== void 0 && (_item$toJS$doorStyle = _item$toJS$doorStyle.doorStyles) !== null && _item$toJS$doorStyle !== void 0 && (_item$toJS$doorStyle = _item$toJS$doorStyle.cds) !== null && _item$toJS$doorStyle !== void 0 && _item$toJS$doorStyle.filter(function (cd) {
205
- return cd.itemID == (item === null || item === void 0 ? void 0 : item.getIn(['itemID']));
206
- }).length) > 0;else return false;
207
200
  };
@@ -22,7 +22,7 @@ var _convertUnitsLite = require("../../utils/convert-units-lite");
22
22
  var _immutable = require("immutable");
23
23
  var _math = require("../../utils/math");
24
24
  var _helper = require("../../utils/helper");
25
- var _utils = require("./utils");
25
+ var _cabinetWarning = require("../../shared/domain/cabinet-warning");
26
26
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
27
27
  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; }
28
28
  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) { (0, _defineProperty2["default"])(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; } // variables
@@ -962,7 +962,7 @@ function Viewer2D(_ref, _ref2) {
962
962
  case 'items':
963
963
  if (elementData.part === 'duplicate') {
964
964
  var currentObject = state.getIn(['scene', 'layers', layerID, 'items', elementData.id]);
965
- if (!(0, _utils.isWarningItem)(currentObject)) itemsActions.duplicateSelected(currentObject, onInternalEvent); // send draw internal event when duplicating
965
+ if (!(0, _cabinetWarning.isWarningCabinet)(currentObject)) itemsActions.duplicateSelected(currentObject, onInternalEvent); // send draw internal event when duplicating
966
966
  break;
967
967
  } else if (elementData.part === 'remove') {
968
968
  projectActions.remove();
@@ -1265,7 +1265,7 @@ function Viewer2D(_ref, _ref2) {
1265
1265
  _currentObject = state.getIn(['scene', 'layers', layerID, elementPrototype, elementID]);
1266
1266
  }
1267
1267
  if (_currentObject) {
1268
- var payload = (0, _helper.updatePayloadOfInternalEvent)(_currentObject, layer, catalog);
1268
+ var payload = (0, _helper.updatePayloadOfInternalEvent)(_currentObject, layer);
1269
1269
 
1270
1270
  // send selection event befor replace event
1271
1271
  if (internalType === constants.INTERNAL_EVENT_REPLACE_CABINET) {
@@ -101,8 +101,8 @@ function Layer3D(_ref) {
101
101
  depth: depth,
102
102
  altitude: altitude
103
103
  };
104
- val.layoutpos = cat && cat.info.layoutpos;
105
- val.is_corner = cat && cat.info.is_corner;
104
+ val.layoutpos = item === null || item === void 0 ? void 0 : item.layoutpos;
105
+ val.is_corner = item.is_corner;
106
106
  val.item = item.toJS();
107
107
  var calcrect = _export.GeometryUtils.getCalcRectFromItem3D(val);
108
108
  if (isSnapped(calcrect.rect[3], calcrect.rect[2]) || isSnapped(calcrect.rect[2], calcrect.rect[1]) || isSnapped(calcrect.rect[0], calcrect.rect[3])) {
@@ -25,7 +25,6 @@ exports.parseData = parseData;
25
25
  exports.removeItem = removeItem;
26
26
  exports.removeSelItemMesh = removeSelItemMesh;
27
27
  exports.sameSign = sameSign;
28
- exports.showYelloBox = showYelloBox;
29
28
  exports.threedfabs = threedfabs;
30
29
  exports.tryAdjacentMD = tryAdjacentMD;
31
30
  exports.updateDoorHandleMesh = updateDoorHandleMesh;
@@ -44,9 +43,11 @@ var _convertUnitsLite = require("../../utils/convert-units-lite");
44
43
  var _geometry2 = require("../../utils/geometry");
45
44
  var GeomUtils = _interopRequireWildcard(require("../../catalog/utils/geom-utils"));
46
45
  var _itemLoader = require("../../catalog/utils/item-loader");
46
+ var _cabinetWarning = require("../../shared/domain/cabinet-warning");
47
47
  var _utils = require("../viewer2d/utils");
48
48
  var _helper = require("../../utils/helper");
49
49
  var _math = require("../../utils/math");
50
+ var _immutable = require("../../shared/objects/immutable");
50
51
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
51
52
  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; }
52
53
  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) { (0, _defineProperty2["default"])(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; }
@@ -537,16 +538,14 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
537
538
  }
538
539
  var mBoxColor = 0x99c3fb;
539
540
  var _item = item.toJS();
540
- if (_item.doorStyle.doorStyles !== undefined && _item.doorStyle.doorStyles.cds) {
541
- if (showYelloBox(_item)) {
542
- mBoxColor = 'rgba(232,187,47,1)';
543
- var mBox = GeomUtils.makeMBoxfromObject(item3D, mBoxColor);
544
- var warningObj = createWarningObject();
545
- warningObj.position.set(0, item.properties.get('height').get('length') / 3, 0);
546
- if (mBox) {
547
- mBox.add(warningObj);
548
- item3D.add(mBox);
549
- }
541
+ if ((0, _cabinetWarning.isWarningCabinet)(_item)) {
542
+ mBoxColor = 'rgba(232,187,47,1)';
543
+ var mBox = GeomUtils.makeMBoxfromObject(item3D, mBoxColor);
544
+ var warningObj = createWarningObject();
545
+ warningObj.position.set(0, item.properties.get('height').get('length') / 3, 0);
546
+ if (mBox) {
547
+ mBox.add(warningObj);
548
+ item3D.add(mBox);
550
549
  }
551
550
  }
552
551
  }
@@ -727,16 +726,14 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
727
726
  if (item3D) {
728
727
  var _mBoxColor = 0x99c3fb;
729
728
  var _item2 = item.toJS();
730
- if (_item2.doorStyle.doorStyles !== undefined && _item2.doorStyle.doorStyles.cds) {
731
- if (showYelloBox(_item2)) {
732
- _mBoxColor = 'rgba(232,187,47,1)';
733
- var _mBox2 = GeomUtils.makeMBoxfromObject(item3D, _mBoxColor);
734
- var _warningObj = createWarningObject();
735
- _warningObj.position.set(0, item.properties.get('height').get('length') / 3, 0);
736
- if (_mBox2) {
737
- _mBox2.add(_warningObj);
738
- item3D.add(_mBox2);
739
- }
729
+ if ((0, _cabinetWarning.isWarningCabinet)(_item2)) {
730
+ _mBoxColor = 'rgba(232,187,47,1)';
731
+ var _mBox2 = GeomUtils.makeMBoxfromObject(item3D, _mBoxColor);
732
+ var _warningObj = createWarningObject();
733
+ _warningObj.position.set(0, item.properties.get('height').get('length') / 3, 0);
734
+ if (_mBox2) {
735
+ _mBox2.add(_warningObj);
736
+ item3D.add(_mBox2);
740
737
  }
741
738
  }
742
739
  }
@@ -859,10 +856,8 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
859
856
  }
860
857
  var _mBoxColor2 = 0x99c3fb;
861
858
  var _item3 = item.toJS();
862
- if (_item3.doorStyle.doorStyles !== undefined && _item3.doorStyle.doorStyles.cds) {
863
- if (showYelloBox(_item3)) {
864
- _mBoxColor2 = 'rgba(232,187,47,1)';
865
- }
859
+ if ((0, _cabinetWarning.isWarningCabinet)(_item3)) {
860
+ _mBoxColor2 = 'rgba(232,187,47,1)';
866
861
  }
867
862
  rItem.children[0].children.forEach(function (rItemElement) {
868
863
  rItemElement.visible = false;
@@ -2082,21 +2077,19 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
2082
2077
  if (pivot) {
2083
2078
  var mBoxColor = 0x99c3fb;
2084
2079
  var _item = item.toJS();
2085
- if (_item.doorStyle.doorStyles !== undefined && _item.doorStyle.doorStyles.cds) {
2086
- if (showYelloBox(_item)) {
2087
- mBoxColor = 'rgba(232,187,47,1)';
2088
- } else {
2089
- pivot.children[0].children.forEach(function (pivotElement) {
2090
- pivotElement.visible = false;
2091
- });
2092
- }
2093
- var mBox = GeomUtils.makeMBoxfromObject(pivot, mBoxColor);
2094
- var warningObj = createWarningObject();
2095
- warningObj.position.set(0, item.properties.get('height').get('length') / 3, 0);
2096
- if (mBox) {
2097
- mBox.add(warningObj);
2098
- pivot.add(mBox);
2099
- }
2080
+ if ((0, _cabinetWarning.isWarningCabinet)(_item)) {
2081
+ mBoxColor = 'rgba(232,187,47,1)';
2082
+ } else {
2083
+ pivot.children[0].children.forEach(function (pivotElement) {
2084
+ pivotElement.visible = false;
2085
+ });
2086
+ }
2087
+ var mBox = GeomUtils.makeMBoxfromObject(pivot, mBoxColor);
2088
+ var warningObj = createWarningObject();
2089
+ warningObj.position.set(0, item.properties.get('height').get('length') / 3, 0);
2090
+ if (mBox) {
2091
+ mBox.add(warningObj);
2092
+ pivot.add(mBox);
2100
2093
  }
2101
2094
  }
2102
2095
 
@@ -2194,8 +2187,8 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
2194
2187
  height: height,
2195
2188
  depth: depth
2196
2189
  };
2197
- val.layoutpos = cat.info.layoutpos;
2198
- val.is_corner = cat.info.is_corner;
2190
+ val.layoutpos = item === null || item === void 0 ? void 0 : item.layoutpos;
2191
+ val.is_corner = item === null || item === void 0 ? void 0 : item.is_corner;
2199
2192
  val.item = item;
2200
2193
  var calcrect = _export.GeometryUtils.getCalcRectFromItem3D(val);
2201
2194
 
@@ -2222,13 +2215,9 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
2222
2215
  });
2223
2216
  if (pivot.children.length > 1) {
2224
2217
  var _item4 = item.toJS();
2225
- if (_item4.doorStyle.doorStyles !== undefined) {
2226
- if (_item4.category === 'cabinet') {
2227
- if (_item4.doorStyle.doorStyles.cds.some(function (element) {
2228
- return element.itemID === item.itemID;
2229
- })) {
2230
- pivot.children.pop();
2231
- }
2218
+ if (_item4.category === _constants.ITEM_TYPE.CABINET) {
2219
+ if (!(0, _cabinetWarning.isWarningCabinet)(item)) {
2220
+ pivot.children.pop();
2232
2221
  } else {
2233
2222
  pivot.children.pop();
2234
2223
  }
@@ -2945,31 +2934,6 @@ function threedfabs(a) {
2945
2934
  function getDistanceBetweenLineSegment(pos1, pos2, pos3, pos4) {
2946
2935
  if (pos1.x == pos2.x && pos3.x == pos4.x) return pos3.x - pos1.x;else if (pos1.y == pos2.y && pos3.y == pos4.y) return pos3.y - pos1.y;else return -1;
2947
2936
  }
2948
-
2949
- /**
2950
- * check to see if an item is suitable for the given doorStyle.
2951
- * @param _item
2952
- * @returns true if it's not suitable.
2953
- */
2954
- function showYelloBox(_item) {
2955
- var _doorStyle;
2956
- var doorStyle = _item === null || _item === void 0 ? void 0 : _item.doorStyle;
2957
-
2958
- // If doorStyle is an Immutable Map, convert to plain JS
2959
- if (doorStyle && typeof doorStyle.toJS === 'function') {
2960
- doorStyle = doorStyle.toJS();
2961
- }
2962
- var isItemCabinet = (_item === null || _item === void 0 ? void 0 : _item.category) === 'cabinet';
2963
- var cds = (_doorStyle = doorStyle) === null || _doorStyle === void 0 || (_doorStyle = _doorStyle.doorStyles) === null || _doorStyle === void 0 ? void 0 : _doorStyle.cds;
2964
-
2965
- // hasItemCDS: item is suitable if its itemID exists in cds
2966
- var hasItemCDS = isItemCabinet && Array.isArray(cds) ? cds.some(function (element) {
2967
- return element.itemID === _item.itemID;
2968
- }) : false;
2969
-
2970
- // return true if it's a cabinet but not suitable for the current doorStyle
2971
- return isItemCabinet && !hasItemCDS;
2972
- }
2973
2937
  function isSimilar(a, b) {
2974
2938
  if (threedfabs(a - b) <= 0.01) return 1;
2975
2939
  return 0;
@@ -3508,7 +3472,7 @@ function addMolding(MGArray, addItem, planData, layer, itemActions, mode) {
3508
3472
  if (addItem.selected && [_constants.MODE_DRAGGING_ITEM_3D, _constants.MODE_ROTATING_ITEM_3D].includes(mode)) return false;
3509
3473
 
3510
3474
  // If the item is not available for current doorStyle
3511
- if (showYelloBox(addItem))
3475
+ if ((0, _cabinetWarning.isWarningCabinet)(addItem))
3512
3476
  // Do not add molding to that item
3513
3477
  return MGArray;
3514
3478
 
@@ -551,7 +551,7 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
551
551
  if (item !== null) {
552
552
  var catid = item.type;
553
553
  var cat = catalog.elements[catid];
554
- layoutpos = cat.info.layoutpos;
554
+ layoutpos = item === null || item === void 0 ? void 0 : item.layoutpos;
555
555
  }
556
556
  var oPos = new Three.Vector2(pos.clone().x, pos.clone().y);
557
557
  var sBounding = obj.children[0].userData;
@@ -571,9 +571,7 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
571
571
  return false;
572
572
  }
573
573
  var _item = layer.items.getIn([data.id]);
574
- var ocatid = _item.type;
575
- var ocat = catalog.elements[ocatid];
576
- var olayoutpos = ocat.info.layoutpos;
574
+ var olayoutpos = _item.layoutpos;
577
575
  if (!(layoutpos === _constants.BASE_CABINET_LAYOUTPOS && olayoutpos === _constants.WALL_CABINET_LAYOUTPOS || layoutpos === _constants.WALL_CABINET_LAYOUTPOS && olayoutpos === _constants.BASE_CABINET_LAYOUTPOS)) {
578
576
  var tRot = _item.rotation;
579
577
  var tPos = new Three.Vector2(_item.x, _item.y);
@@ -1199,9 +1197,8 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
1199
1197
  var curLayerId = _this2.props.state.scene.selectedLayer;
1200
1198
  var curLayer = _this2.props.state.scene.getIn(['layers', curLayerId]);
1201
1199
  if (!(0, _helper.isEmpty)(evtType) && !(0, _helper.isEmpty)(evtElement)) {
1202
- var _state$get, _this2$props$onIntern, _this2$props;
1203
- var catalog = (_state$get = state.get('catalog')) === null || _state$get === void 0 ? void 0 : _state$get.toJS();
1204
- var payload = (0, _helper.updatePayloadOfInternalEvent)(evtElement, curLayer, catalog, pointArray);
1200
+ var _this2$props$onIntern, _this2$props;
1201
+ var payload = (0, _helper.updatePayloadOfInternalEvent)(evtElement, curLayer, pointArray);
1205
1202
  (_this2$props$onIntern = (_this2$props = _this2.props).onInternalEvent) === null || _this2$props$onIntern === void 0 || _this2$props$onIntern.call(_this2$props, {
1206
1203
  type: evtType,
1207
1204
  value: payload
@@ -8,8 +8,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _immutable = require("immutable");
10
10
  var _reactContainerDimensions = _interopRequireDefault(require("react-container-dimensions"));
11
- var _get_ccdf_of_b12_brilliant = _interopRequireDefault(require("./mocks/get_ccdf_of_b12_brilliant.json"));
12
- var _get_ccdf_of_b12_cambridge = _interopRequireDefault(require("./mocks/get_ccdf_of_b12_cambridge.json"));
11
+ var _getCCDFPayload = _interopRequireDefault(require("./mocks/getCCDFPayload.json"));
13
12
  var _configData = _interopRequireDefault(require("./mocks/configData.json"));
14
13
  var _project = _interopRequireDefault(require("./mocks/project.json"));
15
14
  var _cabinetPayload = _interopRequireDefault(require("./mocks/cabinetPayload.json"));
@@ -33,7 +32,6 @@ var options = {
33
32
  unit: 'in',
34
33
  enable3D: true
35
34
  };
36
- var test_num = 0;
37
35
  var onInternalEvent = /*#__PURE__*/function () {
38
36
  var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(evt, callback) {
39
37
  var _t;
@@ -45,9 +43,8 @@ var onInternalEvent = /*#__PURE__*/function () {
45
43
  _context.next = _t === _constants.INTERNAL_EVENT_ITEMS_CATALOG ? 1 : 3;
46
44
  break;
47
45
  case 1:
48
- console.log("Use ".concat(test_num % 2 === 1 ? 'Brilliant' : 'Cambridge'));
49
46
  _context.next = 2;
50
- return callback(test_num % 2 === 1 ? _get_ccdf_of_b12_brilliant["default"] : _get_ccdf_of_b12_cambridge["default"]);
47
+ return callback(_getCCDFPayload["default"]);
51
48
  case 2:
52
49
  return _context.abrupt("continue", 3);
53
50
  case 3:
@@ -225,11 +222,6 @@ function WorkSpace(props) {
225
222
  setExternalEvent(evt);
226
223
  }
227
224
  }, "Add B12 Cabinet"), /*#__PURE__*/_react["default"].createElement(_antd.Button, {
228
- actionType: "danger",
229
- onClick: function onClick() {
230
- test_num = 1;
231
- }
232
- }, "Use Brilliant for ITEMS_CATALOG"), /*#__PURE__*/_react["default"].createElement(_antd.Button, {
233
225
  actionType: "danger",
234
226
  onClick: function onClick() {
235
227
  var evt = {
@@ -242,11 +234,6 @@ function WorkSpace(props) {
242
234
  setExternalEvent(evt);
243
235
  }
244
236
  }, "DoorStyle Change(Brilliant)"), /*#__PURE__*/_react["default"].createElement(_antd.Button, {
245
- actionType: "danger",
246
- onClick: function onClick() {
247
- test_num = 2;
248
- }
249
- }, "Use Cambridge for ITEMS_CATALOG"), /*#__PURE__*/_react["default"].createElement(_antd.Button, {
250
237
  actionType: "danger",
251
238
  onClick: function onClick() {
252
239
  var evt = {
@@ -135,6 +135,7 @@ function _handleExternalEvent() {
135
135
  (0, _handlers5.handleSetFinishing)(props, state, evt.payload);
136
136
  return _context.abrupt("continue", 31);
137
137
  case 30:
138
+ console.log('*** catalog ***', props.catalog);
138
139
  (0, _handlers10.handleSyncScene)(props, state, layer, layerId, _molding.getMoldingDataOfScene2, _skinPanelEngine.computeSkinPanels, _constants.DEFAULT_MOLDING_PIECE_LENGTH, _constants.INTERNAL_EVENT_SYNC_SCENE);
139
140
  return _context.abrupt("continue", 31);
140
141
  case 31:
@@ -15,7 +15,7 @@ function handleSyncScene(props, state, layer, layerId, getMoldingDataOfScene2, c
15
15
 
16
16
  // get skin panel data
17
17
  var skinPanelExclusionSKUs = (_props$configData$ski = props === null || props === void 0 || (_props$configData2 = props.configData) === null || _props$configData2 === void 0 ? void 0 : _props$configData2.skinPanelExclusionSKUs) !== null && _props$configData$ski !== void 0 ? _props$configData$ski : [];
18
- sceneData.layers[layerId].skinPanelData = computeSkinPanels(layer, skinPanelExclusionSKUs, props.catalog);
18
+ sceneData.layers[layerId].skinPanelData = computeSkinPanels(layer, skinPanelExclusionSKUs);
19
19
 
20
20
  // send scene object from 3DTool to HostApp using internalEvent
21
21
  (_props$onInternalEven = props.onInternalEvent) === null || _props$onInternalEven === void 0 || _props$onInternalEven.call(props, {
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isWarningCabinet = isWarningCabinet;
7
+ var _constants = require("../../constants");
8
+ var _immutable = require("../objects/immutable");
9
+ // Centralized warning heuristic for cabinets across 2D/3D.
10
+ // Rule: a cabinet is "warning" when there are no assets for the current door style.
11
+
12
+ // Implementation: return true if item.category === 'cabinet' and (no ccdf or empty ccdf.assets3d)
13
+ function isWarningCabinet(item) {
14
+ var js = (0, _immutable.toJSIfNeeded)(item);
15
+ var isCabinet = (js === null || js === void 0 ? void 0 : js.category) === _constants.ITEM_TYPE.CABINET;
16
+ var ccdf = js === null || js === void 0 ? void 0 : js.ccdf;
17
+ var hasCcdf = !!ccdf && !!(ccdf !== null && ccdf !== void 0 && ccdf.id);
18
+ return isCabinet && !hasCcdf;
19
+ }
@@ -843,7 +843,8 @@ function getAllItemSpecified(scene, catalog, filter) {
843
843
  rotRad: item.rotation / 180 * Math.PI
844
844
  };
845
845
  var cat = item.type ? findCatalogElement(catalog, item.type) : null;
846
- var info = cat === null || cat === void 0 ? void 0 : cat.info;
846
+ val.layoutpos = item.layoutpos;
847
+ val.is_corner = item.is_corner;
847
848
  var props = item.properties;
848
849
  var getSize = function getSize(key) {
849
850
  var _props$getIn, _props$getIn2, _props$getIn3;
@@ -856,15 +857,11 @@ function getAllItemSpecified(scene, catalog, filter) {
856
857
  depth: getSize('depth')
857
858
  };
858
859
  val.item = item;
859
- if (info) {
860
- val.layoutpos = info.layoutpos;
861
- val.is_corner = info.is_corner;
862
- }
863
860
 
864
861
  // Filter check
865
862
  if (Array.isArray(filter)) {
866
- if (info && !filter.includes(info.layoutpos)) return;
867
- } else if ((info === null || info === void 0 ? void 0 : info.layoutpos) !== filter || (0, _helper.isEmpty)(cat) || (cat === null || cat === void 0 ? void 0 : cat.type) === 'appliance' && ['Cook Top', 'Microwave'].includes(cat === null || cat === void 0 || (_cat$obj = cat.obj) === null || _cat$obj === void 0 ? void 0 : _cat$obj.category)) {
863
+ if (!val.layoutpos || !filter.includes(val.layoutpos)) return;
864
+ } else if (val.layoutpos !== filter || (0, _helper.isEmpty)(cat) || (cat === null || cat === void 0 ? void 0 : cat.type) === 'appliance' && ['Cook Top', 'Microwave'].includes(cat === null || cat === void 0 || (_cat$obj = cat.obj) === null || _cat$obj === void 0 ? void 0 : _cat$obj.category)) {
868
865
  return;
869
866
  }
870
867
 
@@ -11,9 +11,8 @@ exports.base64Decode = void 0;
11
11
  exports.centering2D = centering2D;
12
12
  exports.compareSVGRect = void 0;
13
13
  exports.debugUtil = debugUtil;
14
+ exports.getCatalogCabinetSku = getCatalogCabinetSku;
14
15
  exports.getSignedUrl = exports.getPathInfo = exports.getPath = void 0;
15
- exports.getSkuAliasFromCatalog = getSkuAliasFromCatalog;
16
- exports.getSkuAliasFromCatalogElement = getSkuAliasFromCatalogElement;
17
16
  exports.handleCamRect = handleCamRect;
18
17
  exports.isCeilLimitation = isCeilLimitation;
19
18
  exports.isElevationView = isElevationView;
@@ -33,11 +32,13 @@ var _HDRCubeTextureLoader = require("three/examples/jsm/loaders/HDRCubeTextureLo
33
32
  var _constants = require("../constants");
34
33
  var Three = _interopRequireWildcard(require("three"));
35
34
  var _utils = require("./../components/viewer2d/utils");
35
+ var _cabinetWarning = require("../shared/domain/cabinet-warning");
36
36
  var _convertUnitsLite = require("./convert-units-lite");
37
37
  var _math = require("./math");
38
38
  var _awsSdk = _interopRequireDefault(require("aws-sdk"));
39
39
  var _export = require("./export");
40
40
  var _geometry = require("./geometry");
41
+ var _immutable = require("../shared/objects/immutable");
41
42
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
42
43
  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; }
43
44
  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) { (0, _defineProperty2["default"])(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; }
@@ -429,11 +430,11 @@ function centering2D(state) {
429
430
  if (viewer2DActions) updateViwer2D(viewer, viewer2DActions);
430
431
  return state;
431
432
  }
432
- function updatePayloadOfInternalEvent(currentObject, layer, catalog) {
433
- var pointArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
433
+ function updatePayloadOfInternalEvent(currentObject, layer) {
434
+ var pointArray = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
434
435
  if (isEmpty(currentObject)) return null;
435
436
  var updatedPayload = currentObject.toJS();
436
- if (isEmpty(layer) || isEmpty(catalog)) return updatedPayload;
437
+ if (isEmpty(layer)) return updatedPayload;
437
438
  if ((currentObject === null || currentObject === void 0 ? void 0 : currentObject.prototype) === 'lines') {
438
439
  // caculating length of selected line//
439
440
  var v_a = layer.vertices.get(currentObject.vertices.get(0));
@@ -444,7 +445,7 @@ function updatePayloadOfInternalEvent(currentObject, layer, catalog) {
444
445
  //////////////////////////////////////
445
446
  } else if ((currentObject === null || currentObject === void 0 ? void 0 : currentObject.prototype) === 'items') {
446
447
  // check this cabinet has warning box
447
- updatedPayload.isWarning = (0, _utils.isWarningItem)(currentObject);
448
+ updatedPayload.isWarning = (0, _cabinetWarning.isWarningCabinet)(currentObject);
448
449
  // check this item is available molding
449
450
  updatedPayload.isMoldingAvailable = _export.MoldingUtils.isEnableItemForMolding(layer, currentObject);
450
451
  // check this item is snapped to wall
@@ -453,7 +454,7 @@ function updatePayloadOfInternalEvent(currentObject, layer, catalog) {
453
454
  if (pointArray) updatedPayload.distArray = pointArray;
454
455
 
455
456
  // update sku_number using sku_array
456
- updatedPayload.sku_number = getSkuAliasFromCatalog(catalog, currentObject);
457
+ updatedPayload.sku_number = getCatalogCabinetSku(currentObject);
457
458
  } else if ((currentObject === null || currentObject === void 0 ? void 0 : currentObject.prototype) === 'holes') {
458
459
  var _calcDistancesFromHol = (0, _geometry.calcDistancesFromHoleToNearestOneOrWall)(currentObject, layer),
459
460
  distLeft = _calcDistancesFromHol.distLeft,
@@ -471,20 +472,9 @@ function updatePayloadOfInternalEvent(currentObject, layer, catalog) {
471
472
  }
472
473
  return updatedPayload;
473
474
  }
474
- function getSkuAliasFromCatalog(catalog, sceneObject) {
475
- var _catalog$elements;
476
- var sceneObjectJS = typeof (sceneObject === null || sceneObject === void 0 ? void 0 : sceneObject.toJS) === 'function' ? sceneObject.toJS() : sceneObject;
477
- var elementName = sceneObjectJS === null || sceneObjectJS === void 0 ? void 0 : sceneObjectJS.name;
478
- var catalogElement = catalog === null || catalog === void 0 || (_catalog$elements = catalog.elements) === null || _catalog$elements === void 0 ? void 0 : _catalog$elements[elementName];
479
- return getSkuAliasFromCatalogElement(catalogElement, sceneObjectJS);
480
- }
481
- function getSkuAliasFromCatalogElement(catalogElement, sceneObject) {
482
- var _sceneObjectJS$doorSt, _catalogElement$obj, _skuAlias$sku;
483
- var sceneObjectJS = typeof (sceneObject === null || sceneObject === void 0 ? void 0 : sceneObject.toJS) === 'function' ? sceneObject.toJS() : sceneObject;
484
- var doorColorId = sceneObjectJS === null || sceneObjectJS === void 0 || (_sceneObjectJS$doorSt = sceneObjectJS.doorStyle) === null || _sceneObjectJS$doorSt === void 0 ? void 0 : _sceneObjectJS$doorSt.id;
485
- var skuArray = catalogElement === null || catalogElement === void 0 || (_catalogElement$obj = catalogElement.obj) === null || _catalogElement$obj === void 0 ? void 0 : _catalogElement$obj.skuArray;
486
- var skuAlias = skuArray === null || skuArray === void 0 ? void 0 : skuArray.find(function (sku) {
487
- return sku.door_color_id === doorColorId;
488
- });
489
- return (_skuAlias$sku = skuAlias === null || skuAlias === void 0 ? void 0 : skuAlias.sku) !== null && _skuAlias$sku !== void 0 ? _skuAlias$sku : sceneObjectJS === null || sceneObjectJS === void 0 ? void 0 : sceneObjectJS.sku_number;
475
+ function getCatalogCabinetSku(sceneObject) {
476
+ var _sceneObjectJS$ccdf;
477
+ var sceneObjectJS = (0, _immutable.toJSIfNeeded)(sceneObject);
478
+ var ccdfSku = sceneObjectJS === null || sceneObjectJS === void 0 || (_sceneObjectJS$ccdf = sceneObjectJS.ccdf) === null || _sceneObjectJS$ccdf === void 0 ? void 0 : _sceneObjectJS$ccdf.catalog_cabinet_sku;
479
+ return ccdfSku;
490
480
  }
@@ -501,16 +501,12 @@ function buildSkinPanelData(faces) {
501
501
  });
502
502
  return result;
503
503
  }
504
- function shouldExcludeSkinPanel(itemJS, exclusionSet, catalog) {
505
- var _itemJS$doorStyle;
506
- var cabinetSku = (0, _helper.getSkuAliasFromCatalog)(catalog, itemJS);
507
- var doorColorSku = itemJS === null || itemJS === void 0 || (_itemJS$doorStyle = itemJS.doorStyle) === null || _itemJS$doorStyle === void 0 ? void 0 : _itemJS$doorStyle.sku;
508
- if (!cabinetSku || !doorColorSku) return false;
509
- return exclusionSet.has("".concat(cabinetSku, "-").concat(doorColorSku));
504
+ function shouldExcludeSkinPanel(itemJS, exclusionSet) {
505
+ var catalogCabinetSku = (0, _helper.getCatalogCabinetSku)(itemJS);
506
+ return exclusionSet.has(catalogCabinetSku);
510
507
  }
511
508
  function computeSkinPanels(layer) {
512
509
  var skinPanelExclusionSKUs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
513
- var catalog = arguments.length > 2 ? arguments[2] : undefined;
514
510
  var exclusionSet = new Set(skinPanelExclusionSKUs);
515
511
 
516
512
  // Get candidate skin panel items and other items
@@ -518,7 +514,7 @@ function computeSkinPanels(layer) {
518
514
  skinPanelItems = _collectLayerItems.skinPanelItems,
519
515
  otherItems = _collectLayerItems.otherItems;
520
516
  var filteredSkinPanelItems = skinPanelItems.filter(function (item) {
521
- return !shouldExcludeSkinPanel(item.toJS(), exclusionSet, catalog);
517
+ return !shouldExcludeSkinPanel(item.toJS(), exclusionSet);
522
518
  });
523
519
 
524
520
  // Get all skin face list of [skinPanelItems] & [otherItems]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitchen-simulator",
3
- "version": "10.3.0",
3
+ "version": "10.5.0",
4
4
  "description": "It is a kitchen simulator (self-contained micro-frontend).",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",