zakeke-configurator-react 0.0.76 → 0.0.79

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 (2) hide show
  1. package/dist/index.js +66 -49
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -21967,11 +21967,11 @@ class SceneViewer {
21967
21967
  this._sceneHelper.dispose();
21968
21968
  this._sceneHelper = null;
21969
21969
  }
21970
- if (this._environmentManager !== null) {
21970
+ if (this._environmentManager) {
21971
21971
  this._environmentManager.dispose();
21972
21972
  this._environmentManager = null;
21973
21973
  }
21974
- if (this._glowManager !== null) {
21974
+ if (this._glowManager) {
21975
21975
  this._glowManager.dispose();
21976
21976
  this._glowManager = null;
21977
21977
  }
@@ -23256,78 +23256,71 @@ class SceneViewer {
23256
23256
  });
23257
23257
  }
23258
23258
  refreshMeshDesignAsync(meshID, submeshID = 0, effect) {
23259
+ var _a;
23259
23260
  return __awaiter(this, void 0, void 0, function* () {
23260
- if (this._sceneDesignManager)
23261
- this._sceneDesignManager.refreshMeshDesignAsync(meshID, submeshID, effect);
23261
+ (_a = this._sceneDesignManager) === null || _a === void 0 ? void 0 : _a.refreshMeshDesignAsync(meshID, submeshID, effect);
23262
23262
  });
23263
23263
  }
23264
23264
  setCustomizerGrids(grids) {
23265
+ var _a;
23265
23266
  this._grids = grids;
23266
- if (this._sceneDesignManager)
23267
- this._sceneDesignManager.setCustomizerGrids(grids);
23267
+ (_a = this._sceneDesignManager) === null || _a === void 0 ? void 0 : _a.setCustomizerGrids(grids);
23268
23268
  }
23269
23269
  removeDesignItem(guid) {
23270
- if (this._sceneDesignManager)
23271
- this._sceneDesignManager.removeItem(guid);
23270
+ var _a;
23271
+ (_a = this._sceneDesignManager) === null || _a === void 0 ? void 0 : _a.removeItem(guid);
23272
23272
  }
23273
23273
  addDesignItemText(settings, sideId) {
23274
- if (this._sceneDesignManager) {
23275
- return this._sceneDesignManager.addItemText(settings, sideId);
23276
- }
23277
- return null;
23274
+ var _a;
23275
+ return (_a = this._sceneDesignManager) === null || _a === void 0 ? void 0 : _a.addItemText(settings, sideId);
23278
23276
  }
23279
23277
  addDesignItemImage(imageID, sideId) {
23278
+ var _a;
23280
23279
  return __awaiter(this, void 0, void 0, function* () {
23281
- if (this._sceneDesignManager)
23282
- yield this._sceneDesignManager.addItemImage(imageID, sideId);
23280
+ yield ((_a = this._sceneDesignManager) === null || _a === void 0 ? void 0 : _a.addItemImage(imageID, sideId));
23283
23281
  });
23284
23282
  }
23285
23283
  getDesignItemsInfo() {
23286
- if (this._sceneDesignManager)
23287
- return this._sceneDesignManager.getItemsInfo();
23288
- return null;
23284
+ var _a, _b;
23285
+ return (_b = (_a = this._sceneDesignManager) === null || _a === void 0 ? void 0 : _a.getItemsInfo()) !== null && _b !== void 0 ? _b : [];
23289
23286
  }
23290
23287
  setDesignItemText(guid, text) {
23291
- if (this._sceneDesignManager) {
23292
- this._sceneDesignManager.setItemText(guid, text);
23293
- }
23288
+ var _a;
23289
+ (_a = this._sceneDesignManager) === null || _a === void 0 ? void 0 : _a.setItemText(guid, text);
23294
23290
  }
23295
23291
  setDesignItemBold(guid, bold) {
23296
- if (this._sceneDesignManager)
23297
- this._sceneDesignManager.setItemBold(guid, bold);
23292
+ var _a;
23293
+ (_a = this._sceneDesignManager) === null || _a === void 0 ? void 0 : _a.setItemBold(guid, bold);
23298
23294
  }
23299
23295
  setDesignItemItalic(guid, italic) {
23300
- if (this._sceneDesignManager)
23301
- this._sceneDesignManager.setItemItalic(guid, italic);
23296
+ var _a;
23297
+ (_a = this._sceneDesignManager) === null || _a === void 0 ? void 0 : _a.setItemItalic(guid, italic);
23302
23298
  }
23303
23299
  setDesignItemColor(guid, color) {
23304
- if (this._sceneDesignManager)
23305
- this._sceneDesignManager.setItemColor(guid, color);
23300
+ var _a;
23301
+ (_a = this._sceneDesignManager) === null || _a === void 0 ? void 0 : _a.setItemColor(guid, color);
23306
23302
  }
23307
23303
  setDesignItemFontFamily(guid, fontFamily) {
23308
- if (this._sceneDesignManager) {
23309
- this._sceneDesignManager.setItemFontFamily(guid, fontFamily);
23310
- }
23304
+ var _a;
23305
+ (_a = this._sceneDesignManager) === null || _a === void 0 ? void 0 : _a.setItemFontFamily(guid, fontFamily);
23311
23306
  }
23312
23307
  setDesignItemImage(guid, image) {
23308
+ var _a;
23313
23309
  return __awaiter(this, void 0, void 0, function* () {
23314
- if (this._sceneDesignManager) {
23315
- yield this._sceneDesignManager.setItemImage(guid, image);
23316
- }
23310
+ yield ((_a = this._sceneDesignManager) === null || _a === void 0 ? void 0 : _a.setItemImage(guid, image));
23317
23311
  });
23318
23312
  }
23319
23313
  setItemTextOnPath(guid, areaId, value) {
23320
- if (this._sceneDesignManager) {
23321
- this._sceneDesignManager.setItemTextOnPath(guid, areaId, value);
23322
- }
23314
+ var _a;
23315
+ (_a = this._sceneDesignManager) === null || _a === void 0 ? void 0 : _a.setItemTextOnPath(guid, areaId, value);
23323
23316
  }
23324
23317
  removeDesignItemImage(guid) {
23325
- if (this._sceneDesignManager) {
23326
- this._sceneDesignManager.removeItemImage(guid);
23327
- }
23318
+ var _a;
23319
+ (_a = this._sceneDesignManager) === null || _a === void 0 ? void 0 : _a.removeItemImage(guid);
23328
23320
  }
23329
23321
  setDesignVisibility(meshId, opacity) {
23330
- this._sceneDesignManager.setDesignVisibility(meshId, opacity);
23322
+ var _a;
23323
+ (_a = this._sceneDesignManager) === null || _a === void 0 ? void 0 : _a.setDesignVisibility(meshId, opacity);
23331
23324
  }
23332
23325
  setupShaderMaterialsCameraPosition() {
23333
23326
  if (this._scene) {
@@ -38476,15 +38469,21 @@ class ZakekeEnvironment {
38476
38469
  // Search the attribute
38477
38470
  this.zkProduct.get("attributes").each(attribute => {
38478
38471
  if (Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["isPlatformCode"])(attribute.get("attributeCode"))) {
38479
- if (Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["compare"])(JSON.parse(attribute.get("attributeCode")), JSON.parse(platformSelection.attributeCode))) {
38480
- let option = attribute.get("options").find(option => {
38481
- return Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["compare"])(JSON.parse(option.get("optionCode")), JSON.parse(platformSelection.optionCode));
38482
- });
38483
- if (option) {
38484
- this.selection.selectAttributeValue(attribute.get('attributeID'), option.get('optionID'));
38485
- platformSelection.attributeLabel = attribute.get("name");
38472
+ try {
38473
+ if (Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["compare"])(JSON.parse(attribute.get("attributeCode")), JSON.parse(platformSelection.attributeCode))) {
38474
+ let option = attribute.get("options").find(option => {
38475
+ return Object(_helpers__WEBPACK_IMPORTED_MODULE_5__["compare"])(JSON.parse(option.get("optionCode")), JSON.parse(platformSelection.optionCode));
38476
+ });
38477
+ if (option) {
38478
+ this.selection.selectAttributeValue(attribute.get('attributeID'), option.get('optionID'));
38479
+ platformSelection.attributeLabel = attribute.get("name");
38480
+ }
38486
38481
  }
38487
38482
  }
38483
+ catch (ex) {
38484
+ console.error("Failed parsing attribute from data:", platformSelection);
38485
+ console.error(ex);
38486
+ }
38488
38487
  }
38489
38488
  });
38490
38489
  }
@@ -39886,6 +39885,21 @@ function compare(_obj1, _obj2) {
39886
39885
  }
39887
39886
  let obj1 = copy(_obj1);
39888
39887
  let obj2 = copy(_obj2);
39888
+ // Special DIS case, where the code is a object with id and other parameters.
39889
+ // We need to expand it
39890
+ try {
39891
+ const idJson1 = JSON.parse(obj1.id);
39892
+ if (idJson1.id) {
39893
+ obj1 = idJson1;
39894
+ }
39895
+ console.log("Code is a valid json with Id for obj1, use json instead", obj1, obj2);
39896
+ const idJson2 = JSON.parse(obj2.id);
39897
+ if (idJson2.id) {
39898
+ obj2 = idJson2;
39899
+ }
39900
+ console.log("Code is a valid json with Id for obj2, use json instead", obj1, obj2);
39901
+ }
39902
+ catch (ex) { }
39889
39903
  // Remove dummy property
39890
39904
  delete obj1.zakekePlatform;
39891
39905
  delete obj2.zakekePlatform;
@@ -39908,9 +39922,12 @@ function compare(_obj1, _obj2) {
39908
39922
  same = compare(v, obj2[k]);
39909
39923
  }
39910
39924
  if (isValidJSON(v) || isValidJSON(obj2[k])) {
39911
- const a = typeof v === "object" ? v : JSON.parse(v);
39912
- const b = typeof obj2[k] === "object" ? obj2[k] : JSON.parse(obj2[k]);
39913
- same = compare(a, b);
39925
+ try {
39926
+ const a = typeof v === "object" ? v : JSON.parse(v);
39927
+ const b = typeof obj2[k] === "object" ? obj2[k] : JSON.parse(obj2[k]);
39928
+ same = compare(a, b);
39929
+ }
39930
+ catch (_a) { }
39914
39931
  }
39915
39932
  if (!same)
39916
39933
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zakeke-configurator-react",
3
- "version": "0.0.76",
3
+ "version": "0.0.79",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/declarations/composer/Module/src/index.d.ts",