@crystaldesign/diva-seller 24.12.0-rc.7 → 24.12.0-rc.8

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/build/esm/index.js +36 -10
  2. package/package.json +5 -5
@@ -99,7 +99,6 @@ import ListItemText from '@material-ui/core/ListItemText';
99
99
  import SearchField from '@crystaldesign/searchfield';
100
100
  import Drawer from '@material-ui/core/Drawer';
101
101
  import AssetEditor, { DivaFile } from '@crystaldesign/media-upload';
102
- import { flatten, unflatten } from 'flat';
103
102
  import AddIcon$1 from '@material-ui/icons/NoteAdd';
104
103
  import DeleteIcon from '@material-ui/icons/Delete';
105
104
  import debounce from 'lodash/debounce';
@@ -6521,8 +6520,8 @@ function useRenderjobDetail (_ref) {
6521
6520
  return atob(d3dps);
6522
6521
  };
6523
6522
  var getHqRenderScript = function getHqRenderScript(product) {
6524
- var _product$hqRenderScri, _product$configuratio6;
6525
- var hqRenderScript = (_product$hqRenderScri = product.hqRenderScript) !== null && _product$hqRenderScri !== void 0 ? _product$hqRenderScri : (_product$configuratio6 = product.configuration) === null || _product$configuratio6 === void 0 || (_product$configuratio6 = _product$configuratio6.OrderSets[0]) === null || _product$configuratio6 === void 0 ? void 0 : _product$configuratio6.HQRenderScript;
6523
+ var _product$configuratio6;
6524
+ var hqRenderScript = (_product$configuratio6 = product.configuration) === null || _product$configuratio6 === void 0 || (_product$configuratio6 = _product$configuratio6.OrderSets[0]) === null || _product$configuratio6 === void 0 ? void 0 : _product$configuratio6.HQRenderScript;
6526
6525
  if (!hqRenderScript) throw new Error('cant order renderjob without hqrenderscript');
6527
6526
  return hqRenderScript;
6528
6527
  };
@@ -14114,15 +14113,12 @@ function updateVariants(prevState, currentState, configurationData, baseDataFiel
14114
14113
  } else if (field.includes('.')) {
14115
14114
  var _currentState$modifie2;
14116
14115
  //handle nested fields
14117
- var flatVarinat = flatten(variant);
14118
- var flatNewVarinat = newVariant ? flatten(newVariant) : {};
14119
- var flatFinalVariant = flatten(finalVariant);
14120
- var flatBase = flatten(currentState.baseData);
14121
- var _ProductHandler$calcu2 = ProductHandler.calculateComputedValue(flatVarinat[field], flatNewVarinat[field], flatBase[field], (_currentState$modifie2 = currentState.modified.variantData[_i]) === null || _currentState$modifie2 === void 0 ? void 0 : _currentState$modifie2[field]),
14116
+
14117
+ var path = field.split('.');
14118
+ var _ProductHandler$calcu2 = ProductHandler.calculateComputedValue(getData(path, variant), newVariant ? getData(path, newVariant) : undefined, getData(path, currentState.baseData), (_currentState$modifie2 = currentState.modified.variantData[_i]) === null || _currentState$modifie2 === void 0 ? void 0 : _currentState$modifie2[field]),
14122
14119
  _value2 = _ProductHandler$calcu2.value,
14123
14120
  _modified2 = _ProductHandler$calcu2.modified;
14124
- flatFinalVariant[field] = _value2;
14125
- finalVariant = unflatten(flatFinalVariant);
14121
+ setData(path, _value2, finalVariant);
14126
14122
  finalVariant.media = variant.media;
14127
14123
  newModified[field] = _modified2;
14128
14124
  } else if (custom) {
@@ -14461,6 +14457,36 @@ function getMediaObjectbyDivaFile(logofile) {
14461
14457
  name: logofile.fileName
14462
14458
  };
14463
14459
  }
14460
+ function getData(id, data) {
14461
+ if (typeof id === 'string') {
14462
+ return data[id];
14463
+ } else {
14464
+ var names = _toConsumableArray(id);
14465
+ var obj = data;
14466
+ while (names.length > 1) {
14467
+ if (!obj[names[0]]) return undefined;
14468
+ obj = obj[names[0]];
14469
+ names.shift();
14470
+ }
14471
+ return obj[names[0]];
14472
+ }
14473
+ }
14474
+ function setData(id, value, data) {
14475
+ if (typeof id === 'string') {
14476
+ data[id] = value;
14477
+ } else {
14478
+ var names = _toConsumableArray(id);
14479
+ var obj = data;
14480
+ while (names.length > 1) {
14481
+ if (!obj[names[0]]) {
14482
+ obj[names[0]] = {};
14483
+ }
14484
+ obj = obj[names[0]];
14485
+ names.shift();
14486
+ }
14487
+ obj[names[0]] = value;
14488
+ }
14489
+ }
14464
14490
 
14465
14491
  var _excluded$1 = ["value", "onChange"];
14466
14492
  function ownKeys$4(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; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystaldesign/diva-seller",
3
- "version": "24.12.0-rc.7",
3
+ "version": "24.12.0-rc.8",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -29,9 +29,9 @@
29
29
  "react-dom": "^18.3.1"
30
30
  },
31
31
  "dependencies": {
32
- "@crystaldesign/analytics": "24.12.0-rc.7",
33
- "@crystaldesign/products-component": "24.12.0-rc.7",
34
- "@crystaldesign/real-time-viewer": "24.12.0-rc.7",
32
+ "@crystaldesign/analytics": "24.12.0-rc.8",
33
+ "@crystaldesign/products-component": "24.12.0-rc.8",
34
+ "@crystaldesign/real-time-viewer": "24.12.0-rc.8",
35
35
  "@material-ui/core": "^4.12.4",
36
36
  "@material-ui/icons": "^4.11.2",
37
37
  "react-error-boundary": "^4.0.13",
@@ -41,5 +41,5 @@
41
41
  },
42
42
  "types": "./build/types/seller/src/index.d.ts",
43
43
  "module": "build/esm/index.js",
44
- "gitHead": "a4c7151630eec15f6bdca8b558a6ecc548f2077c"
44
+ "gitHead": "995317afb00cc899c6ddb5976de7e6b0aede68d6"
45
45
  }