kitchen-simulator 4.4.1 → 4.4.2-new-json

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 (51) hide show
  1. package/es/LiteRenderer.js +15 -53
  2. package/es/catalog/factories/area-factory-3d.js +0 -4
  3. package/es/catalog/holes/door-double/door_double.png +0 -0
  4. package/es/catalog/holes/door-panic/panicDoor.png +0 -0
  5. package/es/catalog/holes/door-panic-double/panicDoorDouble.png +0 -0
  6. package/es/catalog/holes/gate/gate.jpg +0 -0
  7. package/es/catalog/holes/window-clear/texture.png +0 -0
  8. package/es/catalog/holes/window-cross/texture.png +0 -0
  9. package/es/catalog/holes/window-double-hung/texture.png +0 -0
  10. package/es/catalog/holes/window-vertical/texture.png +0 -0
  11. package/es/catalog/utils/item-loader.js +3 -22
  12. package/es/class/item.js +1 -1
  13. package/es/constants/catalog/skinPanel.js +9 -0
  14. package/es/constants.js +11 -13
  15. package/es/devLiteRenderer.js +91 -109
  16. package/es/mappings/external-events/mapExternalEventPayload.js +21 -0
  17. package/es/mappings/external-events/mappers/addItemMapper.js +86 -0
  18. package/es/mappings/external-events/mappers/ccdfMapper.js +101 -0
  19. package/es/mappings/external-events/mappers/changeDoorStyleMapper.js +65 -0
  20. package/es/mappings/holesToCatalog.js +139 -0
  21. package/es/models.js +3 -1
  22. package/es/utils/helper.js +18 -9
  23. package/es/utils/isolate-event-handler.js +621 -173
  24. package/es/utils/molding.js +20 -236
  25. package/es/utils/skinPanelEngine.js +230 -26
  26. package/lib/LiteRenderer.js +17 -55
  27. package/lib/catalog/factories/area-factory-3d.js +0 -4
  28. package/lib/catalog/holes/door-double/door_double.png +0 -0
  29. package/lib/catalog/holes/door-panic/panicDoor.png +0 -0
  30. package/lib/catalog/holes/door-panic-double/panicDoorDouble.png +0 -0
  31. package/lib/catalog/holes/gate/gate.jpg +0 -0
  32. package/lib/catalog/holes/window-clear/texture.png +0 -0
  33. package/lib/catalog/holes/window-cross/texture.png +0 -0
  34. package/lib/catalog/holes/window-double-hung/texture.png +0 -0
  35. package/lib/catalog/holes/window-vertical/texture.png +0 -0
  36. package/lib/catalog/utils/item-loader.js +2 -21
  37. package/lib/class/item.js +1 -1
  38. package/lib/constants/catalog/skinPanel.js +15 -0
  39. package/lib/constants.js +16 -18
  40. package/lib/devLiteRenderer.js +93 -111
  41. package/lib/mappings/external-events/mapExternalEventPayload.js +26 -0
  42. package/lib/mappings/external-events/mappers/addItemMapper.js +92 -0
  43. package/lib/mappings/external-events/mappers/ccdfMapper.js +108 -0
  44. package/lib/mappings/external-events/mappers/changeDoorStyleMapper.js +72 -0
  45. package/lib/mappings/holesToCatalog.js +148 -0
  46. package/lib/models.js +3 -1
  47. package/lib/utils/helper.js +20 -9
  48. package/lib/utils/isolate-event-handler.js +620 -172
  49. package/lib/utils/molding.js +20 -237
  50. package/lib/utils/skinPanelEngine.js +232 -28
  51. package/package.json +1 -1
@@ -24,6 +24,8 @@ var _molding = require("./molding");
24
24
  var _models = require("../models");
25
25
  var _geometry = require("./geometry");
26
26
  var _skinPanelEngine = require("./skinPanelEngine");
27
+ var _mapExternalEventPayload = require("../mappings/external-events/mapExternalEventPayload");
28
+ var _ccdfMapper = require("../mappings/external-events/mappers/ccdfMapper");
27
29
  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
30
  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; }
29
31
  var PRECISION = 2;
@@ -48,7 +50,7 @@ var __svgCache = new _immutable.Map(); // url -> Promise<svgData|null>
48
50
  function loadJSON(_x) {
49
51
  return _loadJSON.apply(this, arguments);
50
52
  }
51
- /***** Update cabinetPayloadData with updatedTempPlaceholders *****/
53
+ /********Parse TempPlaceholder from cabinetPayloadData **************/
52
54
  function _loadJSON() {
53
55
  _loadJSON = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3(path) {
54
56
  var p;
@@ -87,27 +89,408 @@ function _loadJSON() {
87
89
  }));
88
90
  return _loadJSON.apply(this, arguments);
89
91
  }
90
- function updateCabinetPayload(_x2) {
92
+ function parseTempPlaceholdersFromCabinetPayload(_x2) {
93
+ return _parseTempPlaceholdersFromCabinetPayload.apply(this, arguments);
94
+ }
95
+ /***** Update cabinetPayloadData with updatedTempPlaceholders *****/
96
+ function _parseTempPlaceholdersFromCabinetPayload() {
97
+ _parseTempPlaceholdersFromCabinetPayload = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(cabinetPayload) {
98
+ var link, keys, temp, i, _cabinetPayload$struc, _cabinetPayload$struc2, tempPlaceholdersData, _loop, tempData, doorKey, drawerKey, fixedKey, doorPHs, drawerPHs, has_single_door, fixedPHs, k, _cabinetPayload$struc3, _t2, _t3, _t4;
99
+ return _regenerator["default"].wrap(function (_context5) {
100
+ while (1) switch (_context5.prev = _context5.next) {
101
+ case 0:
102
+ link = '';
103
+ keys = Object.keys(cabinetPayload.structure_json);
104
+ temp = [];
105
+ i = 0;
106
+ case 1:
107
+ if (!(i < keys.length)) {
108
+ _context5.next = 4;
109
+ break;
110
+ }
111
+ if (!((_cabinetPayload$struc = cabinetPayload.structure_json[keys[i]]) !== null && _cabinetPayload$struc !== void 0 && (_cabinetPayload$struc = _cabinetPayload$struc.toString()) !== null && _cabinetPayload$struc !== void 0 && _cabinetPayload$struc.includes('.gltf') && (_cabinetPayload$struc2 = cabinetPayload.structure_json[keys[i]]) !== null && _cabinetPayload$struc2 !== void 0 && (_cabinetPayload$struc2 = _cabinetPayload$struc2.toString()) !== null && _cabinetPayload$struc2 !== void 0 && _cabinetPayload$struc2.startsWith('http'))) {
112
+ _context5.next = 3;
113
+ break;
114
+ }
115
+ link = cabinetPayload.structure_json[keys[i]];
116
+ _t2 = temp;
117
+ _t3 = keys[i];
118
+ _context5.next = 2;
119
+ return loadJSON(link);
120
+ case 2:
121
+ _t4 = _context5.sent;
122
+ _t2.push.call(_t2, {
123
+ name: _t3,
124
+ data: _t4
125
+ });
126
+ case 3:
127
+ i++;
128
+ _context5.next = 1;
129
+ break;
130
+ case 4:
131
+ tempPlaceholdersData = [];
132
+ _loop = /*#__PURE__*/_regenerator["default"].mark(function _loop(k) {
133
+ var el;
134
+ return _regenerator["default"].wrap(function (_context4) {
135
+ while (1) switch (_context4.prev = _context4.next) {
136
+ case 0:
137
+ el = cabinetPayload.structure_json.tempPlaceholders[k].id;
138
+ tempData = {};
139
+ doorKey = 0;
140
+ drawerKey = 0;
141
+ fixedKey = 0;
142
+ doorPHs = 0;
143
+ drawerPHs = 0;
144
+ has_single_door = false;
145
+ fixedPHs = 0;
146
+ temp.forEach(function (t, index) {
147
+ var nodes = t.data.nodes;
148
+ if (nodes === undefined) {
149
+ nodes = [];
150
+ }
151
+ var tempPlaceholders = nodes.filter(function (element) {
152
+ return element.name.startsWith('ph_');
153
+ });
154
+ tempPlaceholders.sort(function (a, b) {
155
+ return a.name > b.name ? 1 : -1;
156
+ });
157
+ if (tempPlaceholders.length > 0) {
158
+ if (t.name === 'base') {
159
+ tempPlaceholders.map(function (element) {
160
+ var sink_match = element.name.match(/\d_(sink_[^LR12]*)(_[LR12])?$/);
161
+ if (sink_match && sink_match.length >= 2) {
162
+ var _process$env$API_URL, _cabinetPayload$struc4;
163
+ tempData['sink'] = tempData['sink'] || [];
164
+ tempData['sink'].push(element.name);
165
+ var sink_url = (_process$env$API_URL = process.env.API_URL) !== null && _process$env$API_URL !== void 0 ? _process$env$API_URL :
166
+ // server url from 3DTool env
167
+ import.meta.env.VITE_APP_API_URL + // server url from Host env
168
+ "/uploads/assets/default/".concat(sink_match[1], ".gltf");
169
+ if (cabinetPayload !== null && cabinetPayload !== void 0 && (_cabinetPayload$struc4 = cabinetPayload.structure_json) !== null && _cabinetPayload$struc4 !== void 0 && (_cabinetPayload$struc4 = _cabinetPayload$struc4.tempPlaceholders[k]) !== null && _cabinetPayload$struc4 !== void 0 && _cabinetPayload$struc4.structure) cabinetPayload.structure_json.tempPlaceholders[k].structure.sink = sink_url;
170
+ } else if (temp.some(function (felement) {
171
+ return felement.name.includes('base_drawer');
172
+ }) && element.name.includes('interior_drawer')) {
173
+ var objCnt = temp.filter(function (felement) {
174
+ return felement.name.includes('base_drawer') && !felement.name.includes('_door');
175
+ }).length;
176
+ var phCnt = tempPlaceholders.filter(function (felement) {
177
+ return felement.name.includes('interior');
178
+ }).length;
179
+ drawerPHs = phCnt;
180
+ if (objCnt === 1 || phCnt % objCnt !== 0) {
181
+ if (tempData['base_drawer_1'] === undefined) {
182
+ tempData['base_drawer_1'] = [];
183
+ }
184
+ tempData['base_drawer_1'].push(element.name);
185
+ drawerKey++;
186
+ } else if (objCnt > 1 && phCnt % objCnt === 0) {
187
+ if (tempData['base_drawer_' + (drawerKey % objCnt + 1)] === undefined) {
188
+ tempData['base_drawer_' + (drawerKey % objCnt + 1)] = [];
189
+ }
190
+ tempData['base_drawer_' + (drawerKey % objCnt + 1)].push(element.name);
191
+ drawerKey++;
192
+ }
193
+ } else if (temp.some(function (felement) {
194
+ return felement.name.includes('base_door');
195
+ }) && !element.name.includes('interior_drawer') && !element.name.includes('drawer') && element.name.includes('door')) {
196
+ var _objCnt = temp.filter(function (felement) {
197
+ return felement.name.includes('base_door');
198
+ }).length;
199
+ var _phCnt = tempPlaceholders.filter(function (felement) {
200
+ return !felement.name.includes('interior') && !felement.name.includes('drawer') && felement.name.includes('door');
201
+ }).length;
202
+ doorPHs = _phCnt;
203
+ if (_objCnt === 1 || _phCnt % _objCnt !== 0) {
204
+ if (tempData['base_door_1'] === undefined) {
205
+ tempData['base_door_1'] = [];
206
+ }
207
+ tempData['base_door_1'].push(element.name);
208
+ doorKey++;
209
+ } else if (_objCnt > 1) {
210
+ if (tempData['base_door_' + (doorKey % _objCnt + 1)] === undefined) {
211
+ tempData['base_door_' + (doorKey % _objCnt + 1)] = [];
212
+ }
213
+ tempData['base_door_' + (doorKey % _objCnt + 1)].push(element.name);
214
+ doorKey++;
215
+ }
216
+ } else if (temp.some(function (felement) {
217
+ return felement.name.includes('base_fixed_drawer_door');
218
+ }) && element.name.includes('_drawer_door_fixed')) {
219
+ var _objCnt2 = temp.filter(function (felement) {
220
+ return felement.name.includes('base_fixed_drawer_door');
221
+ }).length;
222
+ var _phCnt2 = tempPlaceholders.filter(function (felement) {
223
+ return felement.name.includes('_drawer_door_fixed');
224
+ }).length;
225
+ fixedPHs = _phCnt2;
226
+ if (_objCnt2 === 1 || _phCnt2 % _objCnt2 !== 0) {
227
+ if (tempData['base_fixed_drawer_door_1'] === undefined) {
228
+ tempData['base_fixed_drawer_door_1'] = [];
229
+ }
230
+ tempData['base_fixed_drawer_door_1'].push(element.name);
231
+ fixedKey++;
232
+ } else if (_objCnt2 > 1) {
233
+ if (tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] === undefined) {
234
+ tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] = [];
235
+ }
236
+ tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)].push(element.name);
237
+ fixedKey++;
238
+ }
239
+ }
240
+ });
241
+ } else if (t.name.includes('base_drawer') && !t.name.includes('_door')) {
242
+ var objCnt = temp.filter(function (felement) {
243
+ return felement.name.includes('base_drawer') && !felement.name.includes('_door');
244
+ }).length;
245
+ if (objCnt === 1 || drawerPHs % objCnt !== 0) {
246
+ if (tempData['base_drawer_door_1'] === undefined) tempData['base_drawer_door_1'] = [];
247
+ //get drawer door handle placeholders
248
+ var ph_temp = temp.find(function (felement) {
249
+ return felement.name === 'base_drawer_door_1';
250
+ });
251
+ if (ph_temp != undefined) {
252
+ var ph_drawer_door_handle = ph_temp.data.nodes;
253
+ ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
254
+ return element.name.startsWith('ph_') && element.name.includes('handle');
255
+ });
256
+ for (var w = 0; w < drawerPHs; w++) {
257
+ if (!tempData['base_drawer_door_1'].some(function (el) {
258
+ return el === 'base_drawer_door_1/' + tempPlaceholders[0].name;
259
+ })) {
260
+ tempData['base_drawer_door_1'].push('base_drawer_1/' + tempPlaceholders[0].name);
261
+ //add drawer door handle placeholders
262
+ if (tempData['drawer_door_handle_1'] === undefined) tempData['drawer_door_handle_1'] = [];
263
+ if (ph_drawer_door_handle.length > 0) tempData['drawer_door_handle_1'].push('base_drawer_door_1/' + ph_drawer_door_handle[0].name);
264
+ }
265
+ }
266
+ }
267
+ } else if (objCnt > 1 && drawerPHs > 0 && drawerPHs % objCnt === 0) {
268
+ if (tempData['base_drawer_door' + t.name.slice(-2)] === undefined) tempData['base_drawer_door' + t.name.slice(-2)] = [];
269
+ //get drawer door handle placeholders
270
+ var ph_temp = temp.find(function (felement) {
271
+ return felement.name === 'base_drawer_door' + t.name.slice(-2);
272
+ });
273
+ if (ph_temp != undefined) {
274
+ var ph_drawer_door_handle = ph_temp.data.nodes;
275
+ ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
276
+ return element.name.startsWith('ph_') && element.name.includes('handle');
277
+ });
278
+ tempPlaceholders.forEach(function (element) {
279
+ if (!tempData['base_drawer_door' + t.name.slice(-2)].some(function (el) {
280
+ return el === t.name + '/' + element.name;
281
+ })) {
282
+ tempData['base_drawer_door' + t.name.slice(-2)].push(t.name + '/' + element.name);
283
+ //add drawer door handle placeholders
284
+ if (tempData['drawer_door_handle' + t.name.slice(-2)] === undefined) tempData['drawer_door_handle' + t.name.slice(-2)] = [];
285
+ if (ph_drawer_door_handle.length > 0) tempData['drawer_door_handle' + t.name.slice(-2)].push('base_drawer_door' + t.name.slice(-2) + '/' + ph_drawer_door_handle[0].name);
286
+ }
287
+ });
288
+ }
289
+ }
290
+ } else if (t.name.includes('base_door')) {
291
+ var _objCnt3 = temp.filter(function (felement) {
292
+ return felement.name.includes('base_door');
293
+ }).length;
294
+ tempPlaceholders = tempPlaceholders.filter(function (el) {
295
+ return el.name.includes('handle');
296
+ });
297
+ if (tempPlaceholders.length > 0) if (_objCnt3 === 1 || doorPHs % _objCnt3 !== 0) {
298
+ if (tempData['door_handle_1'] === undefined) {
299
+ tempData['door_handle_1'] = [];
300
+ }
301
+ var _loop2 = function _loop2() {
302
+ var phname = tempPlaceholders[0].name;
303
+ var newph = undefined;
304
+ if (tempData['base_door_1'][_w].isLeftPlaceholder()) {
305
+ newph = tempPlaceholders.find(function (el) {
306
+ return el.name.isRightPlaceholder();
307
+ });
308
+ }
309
+ if (tempData['base_door_1'][_w].isRightPlaceholder()) {
310
+ newph = tempPlaceholders.find(function (el) {
311
+ return el.name.isLeftPlaceholder();
312
+ });
313
+ }
314
+ if (newph != undefined) {
315
+ phname = newph.name;
316
+ }
317
+ if (doorPHs === 1 && tempPlaceholders.find(function (el) {
318
+ return el.name.isLeftPlaceholder();
319
+ }) != undefined && tempPlaceholders.find(function (el) {
320
+ return el.name.isRightPlaceholder();
321
+ }) != undefined) {
322
+ has_single_door = true;
323
+ }
324
+ if (!tempData['door_handle_1'].some(function (el) {
325
+ return el === 'door_handle_1/' + phname;
326
+ })) {
327
+ tempData['door_handle_1'].push('base_door_1/' + phname);
328
+ }
329
+ };
330
+ for (var _w = 0; _w < doorPHs; _w++) {
331
+ _loop2();
332
+ }
333
+ } else if (_objCnt3 > 1 && doorPHs > 0 && doorPHs % _objCnt3 === 0) {
334
+ if (tempData['door_handle' + t.name.slice(-2)] === undefined) tempData['door_handle' + t.name.slice(-2)] = [];
335
+ var phname = tempPlaceholders[0].name;
336
+ var newph = undefined;
337
+ var blAdd = true;
338
+ if (cabinetPayload.is_corner) {
339
+ if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
340
+ newph = tempPlaceholders.find(function (el) {
341
+ return el.name.isLeftPlaceholder();
342
+ });
343
+ } else {
344
+ blAdd = false;
345
+ }
346
+ } else {
347
+ if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
348
+ newph = tempPlaceholders.find(function (el) {
349
+ return el.name.isRightPlaceholder();
350
+ });
351
+ }
352
+ if (tempData['base_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
353
+ newph = tempPlaceholders.find(function (el) {
354
+ return el.name.isLeftPlaceholder();
355
+ });
356
+ }
357
+ }
358
+ if (blAdd) {
359
+ if (newph != undefined) {
360
+ phname = newph.name;
361
+ }
362
+ if (!tempData['door_handle' + t.name.slice(-2)].some(function (el) {
363
+ return el === t.name + '/' + phname;
364
+ })) {
365
+ tempData['door_handle' + t.name.slice(-2)].push(t.name + '/' + phname);
366
+ }
367
+ }
368
+ }
369
+ } else if (t.name.includes('base_fixed_drawer_door')) {
370
+ var _objCnt4 = temp.filter(function (felement) {
371
+ return felement.name.includes('base_fixed_drawer_door');
372
+ }).length;
373
+ tempPlaceholders = tempPlaceholders.filter(function (el) {
374
+ return el.name.includes('handle');
375
+ });
376
+ if (tempPlaceholders.length > 0) if (_objCnt4 === 1 || fixedPHs % _objCnt4 !== 0) {
377
+ if (tempData['fixed_drawer_door_handle_1'] === undefined) tempData['fixed_drawer_door_handle_1'] = [];
378
+ var _loop3 = function _loop3() {
379
+ var phname = tempPlaceholders[0].name;
380
+ var newph = undefined;
381
+ if (tempData['base_fixed_drawer_door_1'][_w2].isLeftPlaceholder()) {
382
+ newph = tempPlaceholders.find(function (el) {
383
+ return el.name.isRightPlaceholder();
384
+ });
385
+ }
386
+ if (tempData['base_fixed_drawer_door_1'][_w2].isRightPlaceholder()) {
387
+ newph = tempPlaceholders.find(function (el) {
388
+ return el.name.isLeftPlaceholder();
389
+ });
390
+ }
391
+ if (newph != undefined) {
392
+ phname = newph.name;
393
+ }
394
+ if (!tempData['fixed_drawer_door_handle_1'].some(function (el) {
395
+ return el === 'fixed_drawer_door_handle_1/' + phname;
396
+ })) {
397
+ tempData['fixed_drawer_door_handle_1'].push('base_fixed_drawer_door_1/' + phname);
398
+ }
399
+ };
400
+ for (var _w2 = 0; _w2 < fixedPHs; _w2++) {
401
+ _loop3();
402
+ }
403
+ } else if (_objCnt4 > 1 && fixedPHs > 0 && fixedPHs % _objCnt4 === 0) {
404
+ if (tempData['fixed_drawer_door_handle' + t.name.slice(-2)] === undefined) {
405
+ tempData['fixed_drawer_door_handle' + t.name.slice(-2)] = [];
406
+ }
407
+ var _phname = tempPlaceholders[0].name;
408
+ var _newph = undefined;
409
+ if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
410
+ _newph = tempPlaceholders.find(function (el) {
411
+ return el.name.isRightPlaceholder();
412
+ });
413
+ }
414
+ if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
415
+ _newph = tempPlaceholders.find(function (el) {
416
+ return el.name.isLeftPlaceholder();
417
+ });
418
+ }
419
+ if (_newph != undefined) {
420
+ _phname = _newph.name;
421
+ }
422
+ if (!tempData['fixed_drawer_door_handle' + t.name.slice(-2)].some(function (el) {
423
+ return el === t.name + '/' + _phname;
424
+ })) {
425
+ tempData['fixed_drawer_door_handle' + t.name.slice(-2)].push(t.name + '/' + _phname);
426
+ }
427
+ }
428
+ }
429
+ }
430
+ });
431
+ tempPlaceholdersData.push({
432
+ id: parseInt(el, 10),
433
+ placeholders: tempData,
434
+ structure: cabinetPayload.structure_json.tempPlaceholders[k].structure
435
+ });
436
+ case 1:
437
+ case "end":
438
+ return _context4.stop();
439
+ }
440
+ }, _loop);
441
+ });
442
+ k = 0;
443
+ case 5:
444
+ if (!(k < (cabinetPayload === null || cabinetPayload === void 0 || (_cabinetPayload$struc3 = cabinetPayload.structure_json) === null || _cabinetPayload$struc3 === void 0 || (_cabinetPayload$struc3 = _cabinetPayload$struc3.tempPlaceholders) === null || _cabinetPayload$struc3 === void 0 ? void 0 : _cabinetPayload$struc3.length))) {
445
+ _context5.next = 7;
446
+ break;
447
+ }
448
+ return _context5.delegateYield(_loop(k), "t0", 6);
449
+ case 6:
450
+ k++;
451
+ _context5.next = 5;
452
+ break;
453
+ case 7:
454
+ return _context5.abrupt("return", tempPlaceholdersData);
455
+ case 8:
456
+ case "end":
457
+ return _context5.stop();
458
+ }
459
+ }, _callee4);
460
+ }));
461
+ return _parseTempPlaceholdersFromCabinetPayload.apply(this, arguments);
462
+ }
463
+ function updateCabinetPayload(_x3) {
91
464
  return _updateCabinetPayload.apply(this, arguments);
92
465
  }
93
466
  function _updateCabinetPayload() {
94
- _updateCabinetPayload = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(cabinetPayload) {
95
- var cabinetPayloadKeys, i, _cabinetPayload$cabin, _cabinetPayload$cabin2;
96
- return _regenerator["default"].wrap(function (_context4) {
97
- while (1) switch (_context4.prev = _context4.next) {
467
+ _updateCabinetPayload = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(cabinetPayload) {
468
+ var tempPlaceholders, cabinetPayloadKeys, i;
469
+ return _regenerator["default"].wrap(function (_context6) {
470
+ while (1) switch (_context6.prev = _context6.next) {
98
471
  case 0:
472
+ tempPlaceholders = [];
473
+ _context6.next = 1;
474
+ return parseTempPlaceholdersFromCabinetPayload(cabinetPayload);
475
+ case 1:
476
+ tempPlaceholders = _context6.sent;
99
477
  cabinetPayloadKeys = Object.keys(cabinetPayload);
100
478
  for (i = 0; i < cabinetPayloadKeys.length; i++) {
101
479
  if (cabinetPayloadKeys[i] === 'structure_json') {
102
- cabinetPayload[cabinetPayloadKeys[i]]['placeholders'] = (_cabinetPayload$cabin = (_cabinetPayload$cabin2 = cabinetPayload[cabinetPayloadKeys[i]]['tempPlaceholders'][0]) === null || _cabinetPayload$cabin2 === void 0 ? void 0 : _cabinetPayload$cabin2.placeholders) !== null && _cabinetPayload$cabin !== void 0 ? _cabinetPayload$cabin : [];
480
+ // cabinetPayload[cabinetPayloadKeys[i]]['placeholders'] =
481
+ // cabinetPayload[cabinetPayloadKeys[i]]['tempPlaceholders'][0]
482
+ // ?.placeholders ?? [];
483
+
484
+ cabinetPayload[cabinetPayloadKeys[i]]['placeholders'] = tempPlaceholders[0].placeholders;
485
+ cabinetPayload[cabinetPayloadKeys[i]]['tempPlaceholders'] = tempPlaceholders;
103
486
  }
104
487
  }
105
- return _context4.abrupt("return", cabinetPayload);
106
- case 1:
488
+ return _context6.abrupt("return", cabinetPayload);
489
+ case 2:
107
490
  case "end":
108
- return _context4.stop();
491
+ return _context6.stop();
109
492
  }
110
- }, _callee4);
493
+ }, _callee5);
111
494
  }));
112
495
  return _updateCabinetPayload.apply(this, arguments);
113
496
  }
@@ -179,34 +562,34 @@ var loadSVGsByItem = /*#__PURE__*/function () {
179
562
  }
180
563
  }, _callee2);
181
564
  }));
182
- return function loadSVGsByItem(_x3) {
565
+ return function loadSVGsByItem(_x4) {
183
566
  return _ref.apply(this, arguments);
184
567
  };
185
568
  }();
186
- function addItemToCatalog(_x4, _x5, _x6, _x7) {
569
+ function addItemToCatalog(_x5, _x6, _x7, _x8) {
187
570
  return _addItemToCatalog.apply(this, arguments);
188
571
  } // Get attributs of current selected element
189
572
  function _addItemToCatalog() {
190
- _addItemToCatalog = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(element, state, catalogInstance, projectActions) {
573
+ _addItemToCatalog = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee6(element, state, catalogInstance, projectActions) {
191
574
  var _elementJs, _elementJs3;
192
575
  var elementJs, outlineSVGData, _state$getIn, _elementJs$structure_, _elementJs$structure_2, _elementJs$structure_3, cds, _cds$find, _elementJs2, currentCdsId, cdsIdx, ttph, updatedStructureJson, catalogElements, catalogElementKeys, catalogItem, k, _catalogElements$cata, tempPlaceholderArray, _catalogItem$structur, newTempPlaceholderArray, mergedTempPlaceholder;
193
- return _regenerator["default"].wrap(function (_context5) {
194
- while (1) switch (_context5.prev = _context5.next) {
576
+ return _regenerator["default"].wrap(function (_context7) {
577
+ while (1) switch (_context7.prev = _context7.next) {
195
578
  case 0:
196
579
  if (!(0, _helper.isEmpty)(element === null || element === void 0 ? void 0 : element.name)) {
197
- _context5.next = 1;
580
+ _context7.next = 1;
198
581
  break;
199
582
  }
200
- return _context5.abrupt("return");
583
+ return _context7.abrupt("return");
201
584
  case 1:
202
585
  // clone element
203
586
  elementJs = Object.assign({}, element); // if (isEmpty(catalog?.elements[element.name])) {
204
- _context5.next = 2;
587
+ _context7.next = 2;
205
588
  return loadSVGsByItem(elementJs);
206
589
  case 2:
207
- outlineSVGData = _context5.sent;
590
+ outlineSVGData = _context7.sent;
208
591
  if (!(((_elementJs = elementJs) === null || _elementJs === void 0 ? void 0 : _elementJs.type) === 'cabinet')) {
209
- _context5.next = 4;
592
+ _context7.next = 4;
210
593
  break;
211
594
  }
212
595
  // move the tempPlaceholder of current door style to first of tempPlaceholders array
@@ -234,13 +617,13 @@ function _addItemToCatalog() {
234
617
  }
235
618
  });
236
619
  if ((0, _helper.isEmpty)((_elementJs$structure_3 = elementJs.structure_json) === null || _elementJs$structure_3 === void 0 ? void 0 : _elementJs$structure_3.tempPlaceholders)) {
237
- _context5.next = 4;
620
+ _context7.next = 4;
238
621
  break;
239
622
  }
240
- _context5.next = 3;
623
+ _context7.next = 3;
241
624
  return updateCabinetPayload(elementJs);
242
625
  case 3:
243
- elementJs = _context5.sent;
626
+ elementJs = _context7.sent;
244
627
  case 4:
245
628
  elementJs = _objectSpread(_objectSpread({}, elementJs), {}, {
246
629
  outlineSVGData: outlineSVGData,
@@ -257,18 +640,18 @@ function _addItemToCatalog() {
257
640
  k = 0;
258
641
  case 5:
259
642
  if (!(k < catalogElementKeys.length)) {
260
- _context5.next = 7;
643
+ _context7.next = 7;
261
644
  break;
262
645
  }
263
646
  if (!(((_catalogElements$cata = catalogElements[catalogElementKeys[k]]) === null || _catalogElements$cata === void 0 ? void 0 : _catalogElements$cata.itemID) === elementJs.itemID)) {
264
- _context5.next = 6;
647
+ _context7.next = 6;
265
648
  break;
266
649
  }
267
650
  catalogItem = catalogElements[catalogElementKeys[k]];
268
- return _context5.abrupt("continue", 7);
651
+ return _context7.abrupt("continue", 7);
269
652
  case 6:
270
653
  k++;
271
- _context5.next = 5;
654
+ _context7.next = 5;
272
655
  break;
273
656
  case 7:
274
657
  // get old tempPlaceholder array from catalog item
@@ -299,9 +682,9 @@ function _addItemToCatalog() {
299
682
  }
300
683
  case 8:
301
684
  case "end":
302
- return _context5.stop();
685
+ return _context7.stop();
303
686
  }
304
- }, _callee5);
687
+ }, _callee6);
305
688
  }));
306
689
  return _addItemToCatalog.apply(this, arguments);
307
690
  }
@@ -661,15 +1044,15 @@ function getElement(objProps, state) {
661
1044
  }
662
1045
  return curObject;
663
1046
  }
664
- function loadMoldingSvg(_x8) {
1047
+ function loadMoldingSvg(_x9) {
665
1048
  return _loadMoldingSvg.apply(this, arguments);
666
1049
  }
667
1050
  function _loadMoldingSvg() {
668
- _loadMoldingSvg = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee6(molding) {
669
- return _regenerator["default"].wrap(function (_context6) {
670
- while (1) switch (_context6.prev = _context6.next) {
1051
+ _loadMoldingSvg = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee7(molding) {
1052
+ return _regenerator["default"].wrap(function (_context8) {
1053
+ while (1) switch (_context8.prev = _context8.next) {
671
1054
  case 0:
672
- return _context6.abrupt("return", new Promise(function (resolve, reject) {
1055
+ return _context8.abrupt("return", new Promise(function (resolve, reject) {
673
1056
  var url = molding === null || molding === void 0 ? void 0 : molding.shape_svg;
674
1057
  if (!url) {
675
1058
  // Skip if no SVG URL available
@@ -691,9 +1074,9 @@ function _loadMoldingSvg() {
691
1074
  }));
692
1075
  case 1:
693
1076
  case "end":
694
- return _context6.stop();
1077
+ return _context8.stop();
695
1078
  }
696
- }, _callee6);
1079
+ }, _callee7);
697
1080
  }));
698
1081
  return _loadMoldingSvg.apply(this, arguments);
699
1082
  }
@@ -809,68 +1192,124 @@ function moveAndRotatePan2D3D(eventType, props, payload, state) {
809
1192
  }
810
1193
  }
811
1194
  }
812
- function mergeSameElements(projectItemsCatalog) {
813
- var result = [];
814
- var _loop = function _loop(i) {
815
- var idx = result.findIndex(function (v) {
816
- return v.itemID === projectItemsCatalog[i].itemID;
817
- });
818
- if (idx < 0) result.push(projectItemsCatalog[i]);else {
819
- var _loop2 = function _loop2(j) {
820
- var _result$idx$structure, _result$idx$structure2;
821
- var idx2 = (_result$idx$structure = result[idx].structure_json) === null || _result$idx$structure === void 0 || (_result$idx$structure = _result$idx$structure.tempPlaceholders) === null || _result$idx$structure === void 0 ? void 0 : _result$idx$structure.findIndex(function (v) {
822
- return v.id === projectItemsCatalog[i].structure_json.tempPlaceholders[j].id;
823
- });
824
- if (idx2 < 0) (_result$idx$structure2 = result[idx].structure_json) === null || _result$idx$structure2 === void 0 || (_result$idx$structure2 = _result$idx$structure2.tempPlaceholders) === null || _result$idx$structure2 === void 0 || _result$idx$structure2.push(projectItemsCatalog[i].structure_json.tempPlaceholders[j]);else result[idx].structure_json.tempPlaceholders[idx2] = projectItemsCatalog[i].structure_json.tempPlaceholders[j];
825
- };
826
- for (var j = 0; j < ((_projectItemsCatalog$ = projectItemsCatalog[i].structure_json) === null || _projectItemsCatalog$ === void 0 || (_projectItemsCatalog$ = _projectItemsCatalog$.tempPlaceholders) === null || _projectItemsCatalog$ === void 0 ? void 0 : _projectItemsCatalog$.length); j++) {
827
- var _projectItemsCatalog$;
828
- _loop2(j);
1195
+ function mergeSameElements(_x0) {
1196
+ return _mergeSameElements.apply(this, arguments);
1197
+ }
1198
+ function _mergeSameElements() {
1199
+ _mergeSameElements = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee8(projectItemsCatalog) {
1200
+ var result, _loop4, i;
1201
+ return _regenerator["default"].wrap(function (_context1) {
1202
+ while (1) switch (_context1.prev = _context1.next) {
1203
+ case 0:
1204
+ result = [];
1205
+ _loop4 = /*#__PURE__*/_regenerator["default"].mark(function _loop4(i) {
1206
+ var idx, _loop5, j, _projectItemsCatalog$;
1207
+ return _regenerator["default"].wrap(function (_context0) {
1208
+ while (1) switch (_context0.prev = _context0.next) {
1209
+ case 0:
1210
+ idx = result.findIndex(function (v) {
1211
+ return v.itemID === projectItemsCatalog[i].itemID;
1212
+ });
1213
+ if (!(idx < 0)) {
1214
+ _context0.next = 1;
1215
+ break;
1216
+ }
1217
+ result.push(projectItemsCatalog[i]);
1218
+ _context0.next = 4;
1219
+ break;
1220
+ case 1:
1221
+ _loop5 = /*#__PURE__*/_regenerator["default"].mark(function _loop5(j) {
1222
+ var _result$idx$structure, _result$idx$structure2;
1223
+ var idx2;
1224
+ return _regenerator["default"].wrap(function (_context9) {
1225
+ while (1) switch (_context9.prev = _context9.next) {
1226
+ case 0:
1227
+ idx2 = (_result$idx$structure = result[idx].structure_json) === null || _result$idx$structure === void 0 || (_result$idx$structure = _result$idx$structure.tempPlaceholders) === null || _result$idx$structure === void 0 ? void 0 : _result$idx$structure.findIndex(function (v) {
1228
+ return v.id === projectItemsCatalog[i].structure_json.tempPlaceholders[j].id;
1229
+ });
1230
+ if (idx2 < 0) (_result$idx$structure2 = result[idx].structure_json) === null || _result$idx$structure2 === void 0 || (_result$idx$structure2 = _result$idx$structure2.tempPlaceholders) === null || _result$idx$structure2 === void 0 || _result$idx$structure2.push(projectItemsCatalog[i].structure_json.tempPlaceholders[j]);else result[idx].structure_json.tempPlaceholders[idx2] = projectItemsCatalog[i].structure_json.tempPlaceholders[j];
1231
+ case 1:
1232
+ case "end":
1233
+ return _context9.stop();
1234
+ }
1235
+ }, _loop5);
1236
+ });
1237
+ j = 0;
1238
+ case 2:
1239
+ if (!(j < ((_projectItemsCatalog$ = projectItemsCatalog[i].structure_json) === null || _projectItemsCatalog$ === void 0 || (_projectItemsCatalog$ = _projectItemsCatalog$.tempPlaceholders) === null || _projectItemsCatalog$ === void 0 ? void 0 : _projectItemsCatalog$.length))) {
1240
+ _context0.next = 4;
1241
+ break;
1242
+ }
1243
+ return _context0.delegateYield(_loop5(j), "t0", 3);
1244
+ case 3:
1245
+ j++;
1246
+ _context0.next = 2;
1247
+ break;
1248
+ case 4:
1249
+ case "end":
1250
+ return _context0.stop();
1251
+ }
1252
+ }, _loop4);
1253
+ });
1254
+ i = 0;
1255
+ case 1:
1256
+ if (!(i < (projectItemsCatalog === null || projectItemsCatalog === void 0 ? void 0 : projectItemsCatalog.length))) {
1257
+ _context1.next = 3;
1258
+ break;
1259
+ }
1260
+ return _context1.delegateYield(_loop4(i), "t0", 2);
1261
+ case 2:
1262
+ i++;
1263
+ _context1.next = 1;
1264
+ break;
1265
+ case 3:
1266
+ return _context1.abrupt("return", result);
1267
+ case 4:
1268
+ case "end":
1269
+ return _context1.stop();
829
1270
  }
830
- }
831
- };
832
- for (var i = 0; i < (projectItemsCatalog === null || projectItemsCatalog === void 0 ? void 0 : projectItemsCatalog.length); i++) {
833
- _loop(i);
834
- }
835
- return result;
1271
+ }, _callee8);
1272
+ }));
1273
+ return _mergeSameElements.apply(this, arguments);
836
1274
  }
837
- function handleExternalEvent(_x9) {
1275
+ function handleExternalEvent(_x1) {
838
1276
  return _handleExternalEvent.apply(this, arguments);
839
1277
  }
840
1278
  function _handleExternalEvent() {
841
- _handleExternalEvent = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee9(props) {
1279
+ _handleExternalEvent = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee1(props) {
842
1280
  var _evt$payload3, _evt$payload4;
843
- var evt, state, layerId, layer, _evt$payload, _state$catalog, cdsItems, itemKeys, _loop3, i, newScene, tempState, _props$onInternalEven, sLineCnt, element, _state$viewer2D, _evt$payload$initialP, mouseX, mouseY, v2d, vPosX, vPosY, layerID, defaulTitle, _evt$payload5, doorStyle, itemCDS, applyScope, _evt$payload5$itemIds, itemIds, _layerId, allItems, targetItems, idSet, selectedItemIds, _cdsItems, _loop4, _i2, _props$onInternalEven2, _evt$payload6, roomShapeType, width, height, measurementUnit, _doorStyle, value, _value, _evt$payload7, moldingInfo, isGlobal, distElement, _distElement, _evt$payload8, option, _value2, _layerId2, _layer, _layer$getIn, selectedLines, selectedHoles, selectedItems, _i4, _i5, _i6, _evt$payload9, _evt$payload0, _evt$payload1, _evt$payload10, _layerID, _layer2, orginalItemInfo, originalItem, originalItemPos, replaceItem, _props$onInternalEven3, sceneData, currentTexture, _t2, _t3, _t4;
844
- return _regenerator["default"].wrap(function (_context1) {
845
- while (1) switch (_context1.prev = _context1.next) {
1281
+ var state, evt, layerId, layer, catalog, _evt$payload, _state$catalog, cdsItems, itemKeys, _loop6, i, newScene, tempState, _props$onInternalEven, sLineCnt, element, _state$viewer2D, _evt$payload$initialP, mouseX, mouseY, v2d, vPosX, vPosY, layerID, defaulTitle, _evt$payload5, doorStyle, applyScope, itemCDS, _evt$payload5$itemIds, itemIds, _layerId, allItems, targetItems, idSet, selectedItemIds, ccdf_list, _loop7, _i2, _props$onInternalEven2, _evt$payload6, roomShapeType, width, height, measurementUnit, _doorStyle, value, _value, _evt$payload7, moldingInfo, isGlobal, distElement, _distElement, _evt$payload8, option, _value2, _layerId2, _layer, _layer$getIn, selectedLines, selectedHoles, selectedItems, _i4, _i5, _i6, _evt$payload9, _evt$payload0, _evt$payload1, _evt$payload10, _layerID, _layer2, orginalItemInfo, originalItem, originalItemPos, replaceItem, _layer$doorStyle, _currentTexture, _props$configData$mol, _props$configData, _props$configData$ski, _props$configData2, _props$onInternalEven3, sceneData, currentTexture, moldingPieceLength, skinPanelExclusionSKUs, _t5, _t6, _t7;
1282
+ return _regenerator["default"].wrap(function (_context14) {
1283
+ while (1) switch (_context14.prev = _context14.next) {
846
1284
  case 0:
847
1285
  // console.log('***external event****', props.externalEvent);
848
- evt = props.externalEvent;
849
1286
  state = getPlannerStateFromProps(props);
850
1287
  if (state) {
851
- _context1.next = 1;
1288
+ _context14.next = 1;
852
1289
  break;
853
1290
  }
854
- return _context1.abrupt("return");
1291
+ return _context14.abrupt("return");
855
1292
  case 1:
1293
+ evt = (0, _mapExternalEventPayload.mapExternalEventPayload)(props.externalEvent, state);
856
1294
  layerId = state.getIn(['scene', 'selectedLayer']);
857
1295
  layer = state.getIn(['scene', 'layers', layerId]);
858
- _t2 = evt === null || evt === void 0 ? void 0 : evt.type;
859
- _context1.next = _t2 === _constants.EXTERNAL_EVENT_LOAD_PROJECT ? 2 : _t2 === _constants.EXTERNAL_EVENT_TOGGLE_TO_3D ? 7 : _t2 === _constants.EXTERNAL_EVENT_TOGGLE_TO_2D ? 8 : _t2 === _constants.EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 9 : _t2 === _constants.EXTERNAL_EVENT_ADD_WALL ? 10 : _t2 === _constants.EXTERNAL_EVENT_ADD_ITEM ? 11 : _t2 === _constants.EXTERNAL_EVENT_ADD_HOLE ? 14 : _t2 === _constants.EXTERNAL_EVENT_ROTATE_PAN ? 15 : _t2 === _constants.EXTERNAL_EVENT_MOVE_PAN ? 15 : _t2 === _constants.EXTERNAL_EVENT_NEW_PROJECT ? 16 : _t2 === _constants.EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 17 : _t2 === _constants.EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 25 : _t2 === _constants.EXTERNAL_EVENT_ZOOM_IN ? 26 : _t2 === _constants.EXTERNAL_EVENT_ZOOM_OUT ? 27 : _t2 === _constants.EXTERNAL_EVENT_CENTERING_2D ? 28 : _t2 === _constants.EXTERNAL_EVENT_UNDO ? 29 : _t2 === _constants.EXTERNAL_EVENT_REDO ? 30 : _t2 === _constants.EXTERNAL_EVENT_SET_MOLDING ? 31 : _t2 === _constants.EXTERNAL_EVENT_DUPLICATE_ELEMENT ? 33 : _t2 === _constants.EXTERNAL_EVENT_DELETE_ELEMENT ? 34 : _t2 === _constants.EXTERNAL_EVENT_PROJECT_SETTING ? 35 : _t2 === _constants.EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? 44 : _t2 === _constants.EXTERNAL_EVENT_UPDATE_PROPERTY ? 44 : _t2 === _constants.EXTERNAL_EVENT_REPLACE_CABINET ? 45 : _t2 === _constants.EXTERNAL_EVENT_SET_FINISHING ? 47 : _t2 === _constants.EXTERNAL_EVENT_SYNC_SCENE ? 48 : 49;
1296
+ catalog = state.catalog.toJS();
1297
+ _t5 = evt === null || evt === void 0 ? void 0 : evt.type;
1298
+ _context14.next = _t5 === _constants.EXTERNAL_EVENT_LOAD_PROJECT ? 2 : _t5 === _constants.EXTERNAL_EVENT_TOGGLE_TO_3D ? 7 : _t5 === _constants.EXTERNAL_EVENT_TOGGLE_TO_2D ? 8 : _t5 === _constants.EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 9 : _t5 === _constants.EXTERNAL_EVENT_ADD_WALL ? 10 : _t5 === _constants.EXTERNAL_EVENT_ADD_ITEM ? 11 : _t5 === _constants.EXTERNAL_EVENT_ADD_HOLE ? 14 : _t5 === _constants.EXTERNAL_EVENT_ROTATE_PAN ? 15 : _t5 === _constants.EXTERNAL_EVENT_MOVE_PAN ? 15 : _t5 === _constants.EXTERNAL_EVENT_NEW_PROJECT ? 16 : _t5 === _constants.EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 17 : _t5 === _constants.EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 25 : _t5 === _constants.EXTERNAL_EVENT_ZOOM_IN ? 26 : _t5 === _constants.EXTERNAL_EVENT_ZOOM_OUT ? 27 : _t5 === _constants.EXTERNAL_EVENT_CENTERING_2D ? 28 : _t5 === _constants.EXTERNAL_EVENT_UNDO ? 29 : _t5 === _constants.EXTERNAL_EVENT_REDO ? 30 : _t5 === _constants.EXTERNAL_EVENT_SET_MOLDING ? 31 : _t5 === _constants.EXTERNAL_EVENT_DUPLICATE_ELEMENT ? 33 : _t5 === _constants.EXTERNAL_EVENT_DELETE_ELEMENT ? 34 : _t5 === _constants.EXTERNAL_EVENT_PROJECT_SETTING ? 35 : _t5 === _constants.EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? 44 : _t5 === _constants.EXTERNAL_EVENT_UPDATE_PROPERTY ? 44 : _t5 === _constants.EXTERNAL_EVENT_REPLACE_CABINET ? 45 : _t5 === _constants.EXTERNAL_EVENT_SET_FINISHING ? 47 : _t5 === _constants.EXTERNAL_EVENT_SYNC_SCENE ? 48 : 49;
860
1299
  break;
861
1300
  case 2:
862
1301
  if (!(evt !== null && evt !== void 0 && evt.payload)) {
863
- _context1.next = 6;
1302
+ _context14.next = 6;
864
1303
  break;
865
1304
  }
866
1305
  // prepare item data request
867
1306
  cdsItems = [];
868
1307
  itemKeys = evt !== null && evt !== void 0 && (_evt$payload = evt.payload) !== null && _evt$payload !== void 0 && (_evt$payload = _evt$payload.layers['layer-1']) !== null && _evt$payload !== void 0 && _evt$payload.items ? Object.keys(evt.payload.layers['layer-1'].items) : [];
869
- _loop3 = /*#__PURE__*/_regenerator["default"].mark(function _loop3() {
1308
+ _loop6 = /*#__PURE__*/_regenerator["default"].mark(function _loop6() {
870
1309
  var _evt$payload2, _it$properties, _it$properties2, _it$properties3, _it$doorStyle2;
871
1310
  var it;
872
- return _regenerator["default"].wrap(function (_context8) {
873
- while (1) switch (_context8.prev = _context8.next) {
1311
+ return _regenerator["default"].wrap(function (_context11) {
1312
+ while (1) switch (_context11.prev = _context11.next) {
874
1313
  case 0:
875
1314
  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]]; //////// check altitude of item property and change length from _length (convert length from 'in' fo 'cm')
876
1315
  if (it !== null && it !== void 0 && (_it$properties = it.properties) !== null && _it$properties !== void 0 && (_it$properties = _it$properties.altitude) !== null && _it$properties !== void 0 && _it$properties.length && it !== null && it !== void 0 && (_it$properties2 = it.properties) !== null && _it$properties2 !== void 0 && (_it$properties2 = _it$properties2.altitude) !== null && _it$properties2 !== void 0 && _it$properties2._unit && it !== null && it !== void 0 && (_it$properties3 = it.properties) !== null && _it$properties3 !== void 0 && (_it$properties3 = _it$properties3.altitude) !== null && _it$properties3 !== void 0 && _it$properties3._length && it.properties.altitude.length !== (0, _convertUnitsLite.convert)(it.properties.altitude._length).from(it.properties.altitude._unit).to('cm')) {
@@ -891,20 +1330,20 @@ function _handleExternalEvent() {
891
1330
  });
892
1331
  case 1:
893
1332
  case "end":
894
- return _context8.stop();
1333
+ return _context11.stop();
895
1334
  }
896
- }, _loop3);
1335
+ }, _loop6);
897
1336
  });
898
1337
  i = 0;
899
1338
  case 3:
900
1339
  if (!(i < itemKeys.length)) {
901
- _context1.next = 5;
1340
+ _context14.next = 5;
902
1341
  break;
903
1342
  }
904
- return _context1.delegateYield(_loop3(), "t0", 4);
1343
+ return _context14.delegateYield(_loop6(), "t0", 4);
905
1344
  case 4:
906
1345
  i++;
907
- _context1.next = 3;
1346
+ _context14.next = 3;
908
1347
  break;
909
1348
  case 5:
910
1349
  newScene = new _models.Scene(evt === null || evt === void 0 ? void 0 : evt.payload);
@@ -919,63 +1358,63 @@ function _handleExternalEvent() {
919
1358
  cdsItems: cdsItems
920
1359
  }
921
1360
  }, /*#__PURE__*/function () {
922
- var _ref3 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee7(result) {
1361
+ var _ref3 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee9(result) {
923
1362
  var rt, _i;
924
- return _regenerator["default"].wrap(function (_context7) {
925
- while (1) switch (_context7.prev = _context7.next) {
1363
+ return _regenerator["default"].wrap(function (_context10) {
1364
+ while (1) switch (_context10.prev = _context10.next) {
926
1365
  case 0:
927
1366
  rt = mergeSameElements(result === null || result === void 0 ? void 0 : result.elements);
928
1367
  _i = 0;
929
1368
  case 1:
930
1369
  if (!(_i < (rt === null || rt === void 0 ? void 0 : rt.length))) {
931
- _context7.next = 3;
1370
+ _context10.next = 3;
932
1371
  break;
933
1372
  }
934
- _context7.next = 2;
1373
+ _context10.next = 2;
935
1374
  return addItemToCatalog(rt[_i], tempState, props.catalog, props.projectActions);
936
1375
  case 2:
937
1376
  _i++;
938
- _context7.next = 1;
1377
+ _context10.next = 1;
939
1378
  break;
940
1379
  case 3:
941
1380
  props.projectActions.loadProject(evt.payload);
942
1381
  case 4:
943
1382
  case "end":
944
- return _context7.stop();
1383
+ return _context10.stop();
945
1384
  }
946
- }, _callee7);
1385
+ }, _callee9);
947
1386
  }));
948
- return function (_x0) {
1387
+ return function (_x10) {
949
1388
  return _ref3.apply(this, arguments);
950
1389
  };
951
1390
  }());
952
1391
  } else props.projectActions.loadProject(evt.payload);
953
1392
  case 6:
954
- return _context1.abrupt("continue", 49);
1393
+ return _context14.abrupt("continue", 49);
955
1394
  case 7:
956
1395
  props.projectActions.unselectAll();
957
1396
  props.projectActions.setMode(_constants.MODE_IDLE_3D);
958
- return _context1.abrupt("continue", 49);
1397
+ return _context14.abrupt("continue", 49);
959
1398
  case 8:
960
1399
  props.projectActions.setMode(_constants.MODE_IDLE);
961
- return _context1.abrupt("continue", 49);
1400
+ return _context14.abrupt("continue", 49);
962
1401
  case 9:
963
1402
  sLineCnt = layer.selected.lines.size;
964
1403
  if (sLineCnt > 0) props.projectActions.setMode(_constants.MODE_ELEVATION_VIEW);
965
- return _context1.abrupt("continue", 49);
1404
+ return _context14.abrupt("continue", 49);
966
1405
  case 10:
967
1406
  if (state.mode === _constants.MODE_IDLE || state.mode === _constants.MODE_2D_PAN) props.linesActions.selectToolDrawingLine('wall');else {
968
1407
  props.projectActions.setMode(_constants.MODE_IDLE);
969
1408
  props.linesActions.selectToolDrawingLine('wall');
970
1409
  }
971
- return _context1.abrupt("continue", 49);
1410
+ return _context14.abrupt("continue", 49);
972
1411
  case 11:
973
1412
  if ((0, _helper.isEmpty)(evt === null || evt === void 0 ? void 0 : evt.payload)) {
974
- _context1.next = 13;
1413
+ _context14.next = 13;
975
1414
  break;
976
1415
  }
977
1416
  element = evt.payload;
978
- _context1.next = 12;
1417
+ _context14.next = 12;
979
1418
  return addItemToCatalog(element, state, props.catalog, props.projectActions);
980
1419
  case 12:
981
1420
  // start drawing item
@@ -999,20 +1438,20 @@ function _handleExternalEvent() {
999
1438
  props.projectActions.pushLastSelectedCatalogElementToHistory(element);
1000
1439
  props.projectActions.setIsCabinetDrawing(true);
1001
1440
  case 13:
1002
- return _context1.abrupt("continue", 49);
1441
+ return _context14.abrupt("continue", 49);
1003
1442
  case 14:
1004
1443
  _constants.ARRAY_3D_MODES.includes(state.mode) ? props.holesActions.selectToolDrawingHole3D(evt === null || evt === void 0 || (_evt$payload3 = evt.payload) === null || _evt$payload3 === void 0 ? void 0 : _evt$payload3.holeName) : props.holesActions.selectToolDrawingHole(evt === null || evt === void 0 || (_evt$payload4 = evt.payload) === null || _evt$payload4 === void 0 ? void 0 : _evt$payload4.holeName);
1005
- return _context1.abrupt("continue", 49);
1444
+ return _context14.abrupt("continue", 49);
1006
1445
  case 15:
1007
1446
  moveAndRotatePan2D3D(evt.type, props, evt.payload, state);
1008
- return _context1.abrupt("continue", 49);
1447
+ return _context14.abrupt("continue", 49);
1009
1448
  case 16:
1010
1449
  defaulTitle = 'Untitle';
1011
1450
  props.projectActions.newProject();
1012
1451
  props.projectActions.rename(defaulTitle);
1013
- return _context1.abrupt("continue", 49);
1452
+ return _context14.abrupt("continue", 49);
1014
1453
  case 17:
1015
- _evt$payload5 = evt.payload, doorStyle = _evt$payload5.doorStyle, itemCDS = _evt$payload5.itemCDS, applyScope = _evt$payload5.applyScope, _evt$payload5$itemIds = _evt$payload5.itemIds, itemIds = _evt$payload5$itemIds === void 0 ? [] : _evt$payload5$itemIds;
1454
+ _evt$payload5 = evt.payload, doorStyle = _evt$payload5.doorStyle, applyScope = _evt$payload5.applyScope, itemCDS = _evt$payload5.itemCDS, _evt$payload5$itemIds = _evt$payload5.itemIds, itemIds = _evt$payload5$itemIds === void 0 ? [] : _evt$payload5$itemIds;
1016
1455
  _layerId = state.getIn(['scene', 'selectedLayer']);
1017
1456
  allItems = state.getIn(['scene', 'layers', _layerId, 'items']).toJS();
1018
1457
  targetItems = []; // Prepare idSet for SINGLE or MULTIPLE
@@ -1025,108 +1464,114 @@ function _handleExternalEvent() {
1025
1464
  // itemIds contains item.id (instance IDs)
1026
1465
  idSet = new Set(itemIds);
1027
1466
  }
1028
- _t3 = applyScope;
1029
- _context1.next = _t3 === _constants.DOORSTYLE_SCOPE_ALL ? 18 : _t3 === _constants.DOORSTYLE_SCOPE_SINGLE ? 19 : _t3 === _constants.DOORSTYLE_SCOPE_MULTIPLE ? 19 : 20;
1467
+ _t6 = applyScope;
1468
+ _context14.next = _t6 === _constants.DOORSTYLE_SCOPE_ALL ? 18 : _t6 === _constants.DOORSTYLE_SCOPE_SINGLE ? 19 : _t6 === _constants.DOORSTYLE_SCOPE_MULTIPLE ? 19 : 20;
1030
1469
  break;
1031
1470
  case 18:
1032
1471
  targetItems = Object.values(allItems);
1033
- return _context1.abrupt("continue", 21);
1472
+ return _context14.abrupt("continue", 21);
1034
1473
  case 19:
1035
1474
  targetItems = Object.values(allItems).filter(function (item) {
1036
1475
  var _idSet;
1037
1476
  return (_idSet = idSet) === null || _idSet === void 0 ? void 0 : _idSet.has(item.id);
1038
1477
  });
1039
- return _context1.abrupt("continue", 21);
1478
+ return _context14.abrupt("continue", 21);
1040
1479
  case 20:
1041
- return _context1.abrupt("continue", 21);
1480
+ return _context14.abrupt("continue", 21);
1042
1481
  case 21:
1043
- _cdsItems = [];
1044
- _loop4 = /*#__PURE__*/_regenerator["default"].mark(function _loop4() {
1045
- var _itemCDS$find;
1046
- var item, cdsId;
1047
- return _regenerator["default"].wrap(function (_context0) {
1048
- while (1) switch (_context0.prev = _context0.next) {
1482
+ ccdf_list = [];
1483
+ _loop7 = /*#__PURE__*/_regenerator["default"].mark(function _loop7() {
1484
+ var item;
1485
+ return _regenerator["default"].wrap(function (_context13) {
1486
+ while (1) switch (_context13.prev = _context13.next) {
1049
1487
  case 0:
1050
1488
  item = targetItems[_i2];
1051
- cdsId = (_itemCDS$find = itemCDS.find(function (itCDS) {
1052
- return itCDS.itemID === item.itemID;
1053
- })) === null || _itemCDS$find === void 0 ? void 0 : _itemCDS$find.cabinet_door_style_id;
1054
- if (cdsId && !_cdsItems.some(function (v) {
1055
- return item.itemID === v.itemID && item.name === v.name && cdsId === v.cdsId;
1489
+ if (!ccdf_list.some(function (v) {
1490
+ return item.itemID === v.itemID && item.name === v.name && doorStyle.id === v.doorFinishId;
1056
1491
  })) {
1057
- _cdsItems.push({
1492
+ ccdf_list.push({
1058
1493
  itemID: item.itemID,
1059
1494
  prototype: item.prototype,
1060
1495
  category: item.category,
1061
1496
  name: item.name,
1062
1497
  type: item.type,
1063
1498
  sku_number: item.sku_number,
1064
- cdsId: cdsId
1499
+ doorFinishId: doorStyle.id
1065
1500
  });
1066
1501
  }
1067
1502
  case 1:
1068
1503
  case "end":
1069
- return _context0.stop();
1504
+ return _context13.stop();
1070
1505
  }
1071
- }, _loop4);
1506
+ }, _loop7);
1072
1507
  });
1073
1508
  _i2 = 0;
1074
1509
  case 22:
1075
1510
  if (!(_i2 < targetItems.length)) {
1076
- _context1.next = 24;
1511
+ _context14.next = 24;
1077
1512
  break;
1078
1513
  }
1079
- return _context1.delegateYield(_loop4(), "t1", 23);
1514
+ return _context14.delegateYield(_loop7(), "t1", 23);
1080
1515
  case 23:
1081
1516
  _i2++;
1082
- _context1.next = 22;
1517
+ _context14.next = 22;
1083
1518
  break;
1084
1519
  case 24:
1085
- if (_cdsItems.length > 0) {
1520
+ if (ccdf_list.length > 0) {
1086
1521
  (_props$onInternalEven2 = props.onInternalEvent) === null || _props$onInternalEven2 === void 0 || _props$onInternalEven2.call(props, {
1087
1522
  type: _constants.INTERNAL_EVENT_ITEMS_CATALOG,
1088
1523
  value: {
1089
- cdsItems: _cdsItems
1524
+ ccdf_list: ccdf_list
1090
1525
  }
1091
- }, /*#__PURE__*/function () {
1092
- var _ref4 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee8(result) {
1093
- var rt, _i3;
1094
- return _regenerator["default"].wrap(function (_context9) {
1095
- while (1) switch (_context9.prev = _context9.next) {
1526
+ },
1527
+ /*#__PURE__*/
1528
+ // result is ccdf_list
1529
+ function () {
1530
+ var _ref4 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee0(result) {
1531
+ var mappedCabinetDefinitionList, rt, _i3;
1532
+ return _regenerator["default"].wrap(function (_context12) {
1533
+ while (1) switch (_context12.prev = _context12.next) {
1096
1534
  case 0:
1097
- rt = mergeSameElements(result === null || result === void 0 ? void 0 : result.elements);
1098
- _i3 = 0;
1535
+ _context12.next = 1;
1536
+ return (0, _ccdfMapper.ccdfMapper)(result.ccdf_list, layer, catalog);
1099
1537
  case 1:
1538
+ mappedCabinetDefinitionList = _context12.sent;
1539
+ _context12.next = 2;
1540
+ return mergeSameElements(mappedCabinetDefinitionList);
1541
+ case 2:
1542
+ rt = _context12.sent;
1543
+ _i3 = 0;
1544
+ case 3:
1100
1545
  if (!(_i3 < (rt === null || rt === void 0 ? void 0 : rt.length))) {
1101
- _context9.next = 3;
1546
+ _context12.next = 5;
1102
1547
  break;
1103
1548
  }
1104
- _context9.next = 2;
1549
+ _context12.next = 4;
1105
1550
  return addItemToCatalog(rt[_i3], state, props.catalog, props.projectActions);
1106
- case 2:
1551
+ case 4:
1107
1552
  _i3++;
1108
- _context9.next = 1;
1553
+ _context12.next = 3;
1109
1554
  break;
1110
- case 3:
1555
+ case 5:
1111
1556
  props.itemsActions.setDoorStyle(doorStyle, itemCDS, applyScope, itemIds);
1112
- case 4:
1557
+ case 6:
1113
1558
  case "end":
1114
- return _context9.stop();
1559
+ return _context12.stop();
1115
1560
  }
1116
- }, _callee8);
1561
+ }, _callee0);
1117
1562
  }));
1118
- return function (_x1) {
1563
+ return function (_x11) {
1119
1564
  return _ref4.apply(this, arguments);
1120
1565
  };
1121
1566
  }());
1122
1567
  } else {
1123
1568
  props.itemsActions.setDoorStyle(doorStyle, itemCDS, applyScope, itemIds);
1124
1569
  }
1125
- return _context1.abrupt("continue", 49);
1570
+ return _context14.abrupt("continue", 49);
1126
1571
  case 25:
1127
1572
  _evt$payload6 = evt.payload, roomShapeType = _evt$payload6.roomShapeType, width = _evt$payload6.width, height = _evt$payload6.height, measurementUnit = _evt$payload6.measurementUnit, _doorStyle = _evt$payload6.doorStyle;
1128
1573
  props.projectActions.createRoomWithShape(roomShapeType, width, height, measurementUnit, _doorStyle);
1129
- return _context1.abrupt("continue", 49);
1574
+ return _context14.abrupt("continue", 49);
1130
1575
  case 26:
1131
1576
  value = state.getIn(['viewer2D']).toJS();
1132
1577
  value.a += 0.1;
@@ -1134,7 +1579,7 @@ function _handleExternalEvent() {
1134
1579
  value.e -= value.SVGWidth * 0.1 / 2;
1135
1580
  value.f -= value.SVGHeight * 0.1 / 2;
1136
1581
  (0, _helper.updateViwer2D)(value, props.viewer2DActions);
1137
- return _context1.abrupt("continue", 49);
1582
+ return _context14.abrupt("continue", 49);
1138
1583
  case 27:
1139
1584
  _value = state.getIn(['viewer2D']).toJS();
1140
1585
  _value.a -= 0.1;
@@ -1142,62 +1587,62 @@ function _handleExternalEvent() {
1142
1587
  _value.e += _value.SVGWidth * 0.1 / 2;
1143
1588
  _value.f += _value.SVGHeight * 0.1 / 2;
1144
1589
  (0, _helper.updateViwer2D)(_value, props.viewer2DActions);
1145
- return _context1.abrupt("continue", 49);
1590
+ return _context14.abrupt("continue", 49);
1146
1591
  case 28:
1147
1592
  (0, _helper.centering2D)(state, props.viewer2DActions);
1148
- return _context1.abrupt("continue", 49);
1593
+ return _context14.abrupt("continue", 49);
1149
1594
  case 29:
1150
1595
  props.projectActions.undo();
1151
- return _context1.abrupt("continue", 49);
1596
+ return _context14.abrupt("continue", 49);
1152
1597
  case 30:
1153
1598
  props.projectActions.redo();
1154
- return _context1.abrupt("continue", 49);
1599
+ return _context14.abrupt("continue", 49);
1155
1600
  case 31:
1156
1601
  _evt$payload7 = evt.payload, moldingInfo = _evt$payload7.moldingInfo, isGlobal = _evt$payload7.isGlobal;
1157
- _context1.next = 32;
1602
+ _context14.next = 32;
1158
1603
  return loadMoldingSvg(moldingInfo);
1159
1604
  case 32:
1160
1605
  props.itemsActions.setMolding(moldingInfo, isGlobal);
1161
- return _context1.abrupt("continue", 49);
1606
+ return _context14.abrupt("continue", 49);
1162
1607
  case 33:
1163
1608
  distElement = getElement(evt.payload, state);
1164
1609
  if (distElement) props.itemsActions.duplicateSelected(distElement, props.onInternalEvent);
1165
- return _context1.abrupt("continue", 49);
1610
+ return _context14.abrupt("continue", 49);
1166
1611
  case 34:
1167
1612
  _distElement = getElement(evt.payload, state);
1168
1613
  if (_distElement) props.projectActions.remove(_distElement);
1169
- return _context1.abrupt("continue", 49);
1614
+ return _context14.abrupt("continue", 49);
1170
1615
  case 35:
1171
1616
  _evt$payload8 = evt.payload, option = _evt$payload8.option, _value2 = _evt$payload8.value;
1172
- _t4 = option;
1173
- _context1.next = _t4 === _constants.PROJECT_SETTING_OPTION.CHANGE_MEASUREMENT_UNIT ? 36 : _t4 === _constants.PROJECT_SETTING_OPTION.UPDATE_CEIL_HEIGHT ? 37 : _t4 === _constants.PROJECT_SETTING_OPTION.CHANGE_WALL_LENGTH_MEASURE ? 38 : _t4 === _constants.PROJECT_SETTING_OPTION.CHANGE_BASE_CABINET_MEASURE ? 39 : _t4 === _constants.PROJECT_SETTING_OPTION.CHANGE_WALL_CABINET_MEASURE ? 40 : _t4 === _constants.PROJECT_SETTING_OPTION.CHANGE_WINDOW_DOOR_MEASURE ? 41 : 42;
1617
+ _t7 = option;
1618
+ _context14.next = _t7 === _constants.PROJECT_SETTING_OPTION.CHANGE_MEASUREMENT_UNIT ? 36 : _t7 === _constants.PROJECT_SETTING_OPTION.UPDATE_CEIL_HEIGHT ? 37 : _t7 === _constants.PROJECT_SETTING_OPTION.CHANGE_WALL_LENGTH_MEASURE ? 38 : _t7 === _constants.PROJECT_SETTING_OPTION.CHANGE_BASE_CABINET_MEASURE ? 39 : _t7 === _constants.PROJECT_SETTING_OPTION.CHANGE_WALL_CABINET_MEASURE ? 40 : _t7 === _constants.PROJECT_SETTING_OPTION.CHANGE_WINDOW_DOOR_MEASURE ? 41 : 42;
1174
1619
  break;
1175
1620
  case 36:
1176
1621
  props.viewer2DActions.updateCeilHeight((0, _convertUnitsLite.convert)(layer.ceilHeight).from(layer.unit).to(_value2));
1177
1622
  props.viewer2DActions.updateCeilHeightUnit(_value2);
1178
1623
  props.viewer3DActions.update3DCeilHeightUnit(_value2);
1179
1624
  props.viewer3DActions.update3DCeilHeight((0, _convertUnitsLite.convert)(layer.ceilHeight).from(layer.unit).to(_value2));
1180
- return _context1.abrupt("continue", 43);
1625
+ return _context14.abrupt("continue", 43);
1181
1626
  case 37:
1182
1627
  props.viewer2DActions.updateCeilHeight(_value2);
1183
1628
  props.viewer3DActions.update3DCeilHeight(_value2);
1184
- return _context1.abrupt("continue", 43);
1629
+ return _context14.abrupt("continue", 43);
1185
1630
  case 38:
1186
1631
  props.viewer2DActions.changeWallLengthMeasure(_value2);
1187
- return _context1.abrupt("continue", 43);
1632
+ return _context14.abrupt("continue", 43);
1188
1633
  case 39:
1189
1634
  props.viewer2DActions.changeBaseCabinetMeasure(_value2);
1190
- return _context1.abrupt("continue", 43);
1635
+ return _context14.abrupt("continue", 43);
1191
1636
  case 40:
1192
1637
  props.viewer2DActions.changeWallCabinetMeasure(_value2);
1193
- return _context1.abrupt("continue", 43);
1638
+ return _context14.abrupt("continue", 43);
1194
1639
  case 41:
1195
1640
  props.viewer2DActions.changeWindowDoorMeasure(_value2);
1196
- return _context1.abrupt("continue", 43);
1641
+ return _context14.abrupt("continue", 43);
1197
1642
  case 42:
1198
- return _context1.abrupt("continue", 43);
1643
+ return _context14.abrupt("continue", 43);
1199
1644
  case 43:
1200
- return _context1.abrupt("continue", 49);
1645
+ return _context14.abrupt("continue", 49);
1201
1646
  case 44:
1202
1647
  _layerId2 = state.getIn(['scene', 'selectedLayer']);
1203
1648
  _layer = state.getIn(['scene', 'layers', _layerId2]);
@@ -1205,13 +1650,13 @@ function _handleExternalEvent() {
1205
1650
  for (_i4 = 0; _i4 < selectedLines.size; _i4++) (evt === null || evt === void 0 ? void 0 : evt.type) === _constants.EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(_layer.getIn(['lines', selectedLines.get(_i4)]), evt.payload, state, _layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(_layer.getIn(['lines', selectedLines.get(_i4)]), evt.payload, props.catalog, props.projectActions, evt.callback);
1206
1651
  for (_i5 = 0; _i5 < selectedHoles.size; _i5++) (evt === null || evt === void 0 ? void 0 : evt.type) === _constants.EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(_layer.getIn(['holes', selectedHoles.get(_i5)]), evt.payload, state, _layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(_layer.getIn(['holes', selectedHoles.get(_i5)]), evt.payload, props.catalog, props.projectActions, evt.callback);
1207
1652
  for (_i6 = 0; _i6 < selectedItems.size; _i6++) (evt === null || evt === void 0 ? void 0 : evt.type) === _constants.EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(_layer.getIn(['items', selectedItems.get(_i6)]), evt.payload, state, _layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(_layer.getIn(['items', selectedItems.get(_i6)]), evt.payload, props.catalog, props.projectActions, evt.callback);
1208
- return _context1.abrupt("continue", 49);
1653
+ return _context14.abrupt("continue", 49);
1209
1654
  case 45:
1210
1655
  _layerID = state.scene.selectedLayer;
1211
1656
  _layer2 = state.scene.getIn(['layers', _layerID]).toJS();
1212
1657
  orginalItemInfo = evt === null || evt === void 0 || (_evt$payload9 = evt.payload) === null || _evt$payload9 === void 0 ? void 0 : _evt$payload9.orginalItemInfo;
1213
1658
  originalItem = _layer2 === null || _layer2 === void 0 ? void 0 : _layer2.items[orginalItemInfo.id];
1214
- _context1.next = 46;
1659
+ _context14.next = 46;
1215
1660
  return addItemToCatalog(evt.payload.replaceItemInfo, state, props.catalog, props.projectActions);
1216
1661
  case 46:
1217
1662
  originalItemPos = {
@@ -1228,17 +1673,20 @@ function _handleExternalEvent() {
1228
1673
  }
1229
1674
  };
1230
1675
  props.itemsActions.replaceItem(originalItemPos, originalItem, replaceItem);
1231
- return _context1.abrupt("continue", 49);
1676
+ return _context14.abrupt("continue", 49);
1232
1677
  case 47:
1233
1678
  setFinishing(props, state, evt.payload);
1234
- return _context1.abrupt("continue", 49);
1679
+ return _context14.abrupt("continue", 49);
1235
1680
  case 48:
1236
1681
  sceneData = state.scene.toJS(); // get molding data for "ReviewForQuote"
1237
- currentTexture = layer.doorStyle !== null || layer.doorStyle !== undefined ? layer.doorStyle : props.state.doorStyle.toJS();
1238
- sceneData.layers[layerId].moldingData = (0, _molding.getMoldingDataOfScene2)(layer, props.catalog, currentTexture);
1682
+ currentTexture = (_layer$doorStyle = layer === null || layer === void 0 ? void 0 : layer.doorStyle) !== null && _layer$doorStyle !== void 0 ? _layer$doorStyle : props.state.doorStyle;
1683
+ if (!(0, _helper.isEmpty)(currentTexture) && _immutable.Map.isMap(currentTexture)) currentTexture = (_currentTexture = currentTexture) === null || _currentTexture === void 0 ? void 0 : _currentTexture.toJS();
1684
+ moldingPieceLength = (_props$configData$mol = props === null || props === void 0 || (_props$configData = props.configData) === null || _props$configData === void 0 ? void 0 : _props$configData.moldingPieceLength) !== null && _props$configData$mol !== void 0 ? _props$configData$mol : _constants.DEFAULT_MOLDING_PIECE_LENGTH;
1685
+ sceneData.layers[layerId].moldingData = (0, _molding.getMoldingDataOfScene2)(layer, props.catalog, currentTexture, moldingPieceLength);
1239
1686
 
1240
1687
  // get skin panel data
1241
- sceneData.layers[layerId].skinPanelData = (0, _skinPanelEngine.computeSkinPanels)(layer);
1688
+ 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 : [];
1689
+ sceneData.layers[layerId].skinPanelData = (0, _skinPanelEngine.computeSkinPanels)(layer, skinPanelExclusionSKUs, props.catalog);
1242
1690
 
1243
1691
  // send scene object from 3DTool to HostApp using internalEvent
1244
1692
  (_props$onInternalEven3 = props.onInternalEvent) === null || _props$onInternalEven3 === void 0 || _props$onInternalEven3.call(props, {
@@ -1247,12 +1695,12 @@ function _handleExternalEvent() {
1247
1695
  scene: sceneData
1248
1696
  }
1249
1697
  });
1250
- return _context1.abrupt("continue", 49);
1698
+ return _context14.abrupt("continue", 49);
1251
1699
  case 49:
1252
1700
  case "end":
1253
- return _context1.stop();
1701
+ return _context14.stop();
1254
1702
  }
1255
- }, _callee9);
1703
+ }, _callee1);
1256
1704
  }));
1257
1705
  return _handleExternalEvent.apply(this, arguments);
1258
1706
  }