@crystaldesign/diva-seller 24.10.0-beta.16 → 24.10.0-beta.18
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.
- package/build/esm/index.js +44 -23
- package/package.json +5 -5
package/build/esm/index.js
CHANGED
|
@@ -12309,10 +12309,31 @@ function addBasket(prevState, basket, productData) {
|
|
|
12309
12309
|
function updateVariants(prevState, currentState, configurationData, baseDataFields, classificationConfig, availableLanguages) {
|
|
12310
12310
|
var newVarinatList = [];
|
|
12311
12311
|
var newModifiedList = [];
|
|
12312
|
-
|
|
12312
|
+
var customBaseFields = [];
|
|
12313
|
+
if (baseDataFields.some(function (field) {
|
|
12314
|
+
return field.manualFields && field.field == 'customData';
|
|
12315
|
+
}) && currentState.baseData.customData) {
|
|
12316
|
+
var manualFields = Object.entries(currentState.baseData.customData).filter(function (_ref9) {
|
|
12317
|
+
var _ref10 = _slicedToArray(_ref9, 2);
|
|
12318
|
+
_ref10[0];
|
|
12319
|
+
var valueObj = _ref10[1];
|
|
12320
|
+
return valueObj.manual;
|
|
12321
|
+
});
|
|
12322
|
+
for (var i = 0; i < manualFields.length; i++) {
|
|
12323
|
+
customBaseFields.push({
|
|
12324
|
+
field: manualFields[i][0],
|
|
12325
|
+
type: 'string',
|
|
12326
|
+
title: "productcreator.fields.".concat(manualFields[i][0]),
|
|
12327
|
+
fieldType: 'BASE',
|
|
12328
|
+
custom: true
|
|
12329
|
+
});
|
|
12330
|
+
}
|
|
12331
|
+
}
|
|
12332
|
+
baseDataFields = [].concat(_toConsumableArray(baseDataFields), customBaseFields);
|
|
12333
|
+
for (var _i = 0; _i < prevState.variantData.length; _i++) {
|
|
12313
12334
|
var _currentState$modifie6, _configurationData$Pr3, _currentState$modifie7;
|
|
12314
|
-
var variant = prevState.variantData[
|
|
12315
|
-
var newVariant = currentState.variantData[
|
|
12335
|
+
var variant = prevState.variantData[_i];
|
|
12336
|
+
var newVariant = currentState.variantData[_i];
|
|
12316
12337
|
var finalVariant = _objectSpread$a({}, variant);
|
|
12317
12338
|
var newModified = {};
|
|
12318
12339
|
var _iterator = _createForOfIteratorHelper$3(prevState.classificationFields || []),
|
|
@@ -12321,7 +12342,7 @@ function updateVariants(prevState, currentState, configurationData, baseDataFiel
|
|
|
12321
12342
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
12322
12343
|
var _currentState$modifie8;
|
|
12323
12344
|
var _field2 = _step.value.field;
|
|
12324
|
-
var _ProductHandler$calcu6 = ProductHandler.calculateComputedValue(variant[_field2], newVariant === null || newVariant === void 0 ? void 0 : newVariant[_field2], currentState.classificationData[_field2], (_currentState$modifie8 = currentState.modified.variantData[
|
|
12345
|
+
var _ProductHandler$calcu6 = ProductHandler.calculateComputedValue(variant[_field2], newVariant === null || newVariant === void 0 ? void 0 : newVariant[_field2], currentState.classificationData[_field2], (_currentState$modifie8 = currentState.modified.variantData[_i]) === null || _currentState$modifie8 === void 0 ? void 0 : _currentState$modifie8[_field2]),
|
|
12325
12346
|
_value6 = _ProductHandler$calcu6.value,
|
|
12326
12347
|
_modified6 = _ProductHandler$calcu6.modified;
|
|
12327
12348
|
finalVariant[_field2] = _value6;
|
|
@@ -12341,13 +12362,13 @@ function updateVariants(prevState, currentState, configurationData, baseDataFiel
|
|
|
12341
12362
|
var _loop = function _loop() {
|
|
12342
12363
|
var fieldgroup = _step2.value.fieldgroup;
|
|
12343
12364
|
if (fieldgroup) {
|
|
12344
|
-
var _loop2 = function _loop2(
|
|
12365
|
+
var _loop2 = function _loop2(_i2) {
|
|
12345
12366
|
if (allBaseFields.findIndex(function (f) {
|
|
12346
|
-
return f.field == fieldgroup[
|
|
12347
|
-
}) === -1) allBaseFields.push(fieldgroup[
|
|
12367
|
+
return f.field == fieldgroup[_i2].field;
|
|
12368
|
+
}) === -1) allBaseFields.push(fieldgroup[_i2]);
|
|
12348
12369
|
};
|
|
12349
|
-
for (var
|
|
12350
|
-
_loop2(
|
|
12370
|
+
for (var _i2 = 0; _i2 < fieldgroup.length; _i2++) {
|
|
12371
|
+
_loop2(_i2);
|
|
12351
12372
|
}
|
|
12352
12373
|
}
|
|
12353
12374
|
};
|
|
@@ -12362,12 +12383,12 @@ function updateVariants(prevState, currentState, configurationData, baseDataFiel
|
|
|
12362
12383
|
for (var j = 0; j < allBaseFields.length; j++) {
|
|
12363
12384
|
var field = allBaseFields[j].field;
|
|
12364
12385
|
var custom = allBaseFields[j].custom;
|
|
12365
|
-
if (field == 'shortDescription') {
|
|
12386
|
+
if (field == 'shortDescription' || field == ' customData') {
|
|
12366
12387
|
//updated shortDescription as last value
|
|
12367
12388
|
continue;
|
|
12368
12389
|
} else if (field == 'addedPrice' || field == 'calculatedPrice') {
|
|
12369
12390
|
var _currentState$modifie;
|
|
12370
|
-
var _ProductHandler$calcu = ProductHandler.calculateComputedValue(variant[field], newVariant === null || newVariant === void 0 ? void 0 : newVariant[field], currentState.baseData[field], (_currentState$modifie = currentState.modified.variantData[
|
|
12391
|
+
var _ProductHandler$calcu = ProductHandler.calculateComputedValue(variant[field], newVariant === null || newVariant === void 0 ? void 0 : newVariant[field], currentState.baseData[field], (_currentState$modifie = currentState.modified.variantData[_i]) === null || _currentState$modifie === void 0 ? void 0 : _currentState$modifie[field]),
|
|
12371
12392
|
_value = _ProductHandler$calcu.value,
|
|
12372
12393
|
_modified = _ProductHandler$calcu.modified;
|
|
12373
12394
|
finalVariant[field] = _value;
|
|
@@ -12379,7 +12400,7 @@ function updateVariants(prevState, currentState, configurationData, baseDataFiel
|
|
|
12379
12400
|
var flatNewVarinat = newVariant ? flatten(newVariant) : {};
|
|
12380
12401
|
var flatFinalVariant = flatten(finalVariant);
|
|
12381
12402
|
var flatBase = flatten(currentState.baseData);
|
|
12382
|
-
var _ProductHandler$calcu2 = ProductHandler.calculateComputedValue(flatVarinat[field], flatNewVarinat[field], flatBase[field], (_currentState$modifie2 = currentState.modified.variantData[
|
|
12403
|
+
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]),
|
|
12383
12404
|
_value2 = _ProductHandler$calcu2.value,
|
|
12384
12405
|
_modified2 = _ProductHandler$calcu2.modified;
|
|
12385
12406
|
flatFinalVariant[field] = _value2;
|
|
@@ -12388,7 +12409,7 @@ function updateVariants(prevState, currentState, configurationData, baseDataFiel
|
|
|
12388
12409
|
newModified[field] = _modified2;
|
|
12389
12410
|
} else if (custom) {
|
|
12390
12411
|
var _variant$customData, _newVariant$customDat, _currentState$baseDat, _currentState$modifie3;
|
|
12391
|
-
var _ProductHandler$calcu3 = ProductHandler.calculateComputedValue(variant === null || variant === void 0 || (_variant$customData = variant.customData) === null || _variant$customData === void 0 ? void 0 : _variant$customData[field], newVariant === null || newVariant === void 0 || (_newVariant$customDat = newVariant.customData) === null || _newVariant$customDat === void 0 ? void 0 : _newVariant$customDat[field], (_currentState$baseDat = currentState.baseData.customData) === null || _currentState$baseDat === void 0 ? void 0 : _currentState$baseDat[field], (_currentState$modifie3 = currentState.modified.variantData[
|
|
12412
|
+
var _ProductHandler$calcu3 = ProductHandler.calculateComputedValue(variant === null || variant === void 0 || (_variant$customData = variant.customData) === null || _variant$customData === void 0 ? void 0 : _variant$customData[field], newVariant === null || newVariant === void 0 || (_newVariant$customDat = newVariant.customData) === null || _newVariant$customDat === void 0 ? void 0 : _newVariant$customDat[field], (_currentState$baseDat = currentState.baseData.customData) === null || _currentState$baseDat === void 0 ? void 0 : _currentState$baseDat[field], (_currentState$modifie3 = currentState.modified.variantData[_i]) === null || _currentState$modifie3 === void 0 ? void 0 : _currentState$modifie3['customData.' + field]),
|
|
12392
12413
|
_value3 = _ProductHandler$calcu3.value,
|
|
12393
12414
|
_modified3 = _ProductHandler$calcu3.modified;
|
|
12394
12415
|
if (!finalVariant.customData) {
|
|
@@ -12403,7 +12424,7 @@ function updateVariants(prevState, currentState, configurationData, baseDataFiel
|
|
|
12403
12424
|
for (var m = 0; m < availableLanguages.length; m++) {
|
|
12404
12425
|
var _variant$field, _newVariant$field, _field, _currentState$modifie4;
|
|
12405
12426
|
var lang = availableLanguages[m];
|
|
12406
|
-
var _ProductHandler$calcu4 = ProductHandler.calculateComputedValue((_variant$field = variant[field]) === null || _variant$field === void 0 ? void 0 : _variant$field[lang], newVariant === null || newVariant === void 0 || (_newVariant$field = newVariant[field]) === null || _newVariant$field === void 0 ? void 0 : _newVariant$field[lang], (_field = currentState.baseData[field]) === null || _field === void 0 ? void 0 : _field[lang], (_currentState$modifie4 = currentState.modified.variantData[
|
|
12427
|
+
var _ProductHandler$calcu4 = ProductHandler.calculateComputedValue((_variant$field = variant[field]) === null || _variant$field === void 0 ? void 0 : _variant$field[lang], newVariant === null || newVariant === void 0 || (_newVariant$field = newVariant[field]) === null || _newVariant$field === void 0 ? void 0 : _newVariant$field[lang], (_field = currentState.baseData[field]) === null || _field === void 0 ? void 0 : _field[lang], (_currentState$modifie4 = currentState.modified.variantData[_i]) === null || _currentState$modifie4 === void 0 ? void 0 : _currentState$modifie4[field]),
|
|
12407
12428
|
_value4 = _ProductHandler$calcu4.value,
|
|
12408
12429
|
_modified4 = _ProductHandler$calcu4.modified;
|
|
12409
12430
|
if (_value4 !== undefined) valTotal[lang] = _value4;
|
|
@@ -12413,7 +12434,7 @@ function updateVariants(prevState, currentState, configurationData, baseDataFiel
|
|
|
12413
12434
|
newModified[field] = modTotal;
|
|
12414
12435
|
} else {
|
|
12415
12436
|
var _currentState$modifie5;
|
|
12416
|
-
var _ProductHandler$calcu5 = ProductHandler.calculateComputedValue(variant[field], newVariant === null || newVariant === void 0 ? void 0 : newVariant[field], currentState.baseData[field], (_currentState$modifie5 = currentState.modified.variantData[
|
|
12437
|
+
var _ProductHandler$calcu5 = ProductHandler.calculateComputedValue(variant[field], newVariant === null || newVariant === void 0 ? void 0 : newVariant[field], currentState.baseData[field], (_currentState$modifie5 = currentState.modified.variantData[_i]) === null || _currentState$modifie5 === void 0 ? void 0 : _currentState$modifie5[field]),
|
|
12417
12438
|
_value5 = _ProductHandler$calcu5.value,
|
|
12418
12439
|
_modified5 = _ProductHandler$calcu5.modified;
|
|
12419
12440
|
finalVariant[field] = _value5;
|
|
@@ -12424,11 +12445,11 @@ function updateVariants(prevState, currentState, configurationData, baseDataFiel
|
|
|
12424
12445
|
//as long as shortDescription is not modified by user, autocalc it
|
|
12425
12446
|
var _ProductHandler$calcS = ProductHandler.calcShortDescription(variant.shortDescription, ProductHandler.assign({}, currentState.baseData, currentState.classificationData, finalVariant, {
|
|
12426
12447
|
shortDescription: newVariant.shortDescription
|
|
12427
|
-
}), (_currentState$modifie6 = currentState.modified.variantData[
|
|
12448
|
+
}), (_currentState$modifie6 = currentState.modified.variantData[_i]) === null || _currentState$modifie6 === void 0 ? void 0 : _currentState$modifie6['shortDescription'], (_configurationData$Pr3 = configurationData.ProductCreator) === null || _configurationData$Pr3 === void 0 ? void 0 : _configurationData$Pr3.fields, classificationConfig),
|
|
12428
12449
|
value = _ProductHandler$calcS.value,
|
|
12429
12450
|
modified = _ProductHandler$calcS.modified;
|
|
12430
12451
|
//if the shortDescription of the varinat is not modified, but that of the baseData is, use the value of baseData
|
|
12431
|
-
if (!modified && (currentState.modified.shortDescription || prevState.baseData.shortDescription !== ((_currentState$modifie7 = currentState.modified.variantData[
|
|
12452
|
+
if (!modified && (currentState.modified.shortDescription || prevState.baseData.shortDescription !== ((_currentState$modifie7 = currentState.modified.variantData[_i]) === null || _currentState$modifie7 === void 0 ? void 0 : _currentState$modifie7['shortDescription']))) {
|
|
12432
12453
|
finalVariant.shortDescription = currentState.baseData.shortDescription;
|
|
12433
12454
|
newModified.shortDescription = false;
|
|
12434
12455
|
} else {
|
|
@@ -12579,10 +12600,10 @@ function updateOptMap(currentState, optMap, mediaService, jwt) {
|
|
|
12579
12600
|
LOG$5.debug("Product ".concat(product._id, " has no class mapping for OPT ").concat(optField.field));
|
|
12580
12601
|
return;
|
|
12581
12602
|
}
|
|
12582
|
-
var className = (_optMapEntries$find = optMapEntries.find(function (
|
|
12583
|
-
var
|
|
12584
|
-
|
|
12585
|
-
var optValueField =
|
|
12603
|
+
var className = (_optMapEntries$find = optMapEntries.find(function (_ref11) {
|
|
12604
|
+
var _ref12 = _slicedToArray(_ref11, 2);
|
|
12605
|
+
_ref12[0];
|
|
12606
|
+
var optValueField = _ref12[1];
|
|
12586
12607
|
return (optValueField === null || optValueField === void 0 ? void 0 : optValueField.field) == optField.field;
|
|
12587
12608
|
})) === null || _optMapEntries$find === void 0 ? void 0 : _optMapEntries$find[0];
|
|
12588
12609
|
if (!className) {
|
|
@@ -12703,9 +12724,9 @@ function removeMedia(currentState, data, variants) {
|
|
|
12703
12724
|
return m.url == data.url;
|
|
12704
12725
|
});
|
|
12705
12726
|
if (product.media && index != undefined) {
|
|
12706
|
-
var
|
|
12727
|
+
var _ref13;
|
|
12707
12728
|
var deleted = product.media.splice(index, 1);
|
|
12708
|
-
(
|
|
12729
|
+
(_ref13 = newState.removedMedia).push.apply(_ref13, _toConsumableArray(deleted));
|
|
12709
12730
|
}
|
|
12710
12731
|
});
|
|
12711
12732
|
return newState;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crystaldesign/diva-seller",
|
|
3
|
-
"version": "24.10.0-beta.
|
|
3
|
+
"version": "24.10.0-beta.18",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"react-i18next": "^11.7.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@crystaldesign/analytics": "24.10.0-beta.
|
|
39
|
-
"@crystaldesign/products-component": "24.10.0-beta.
|
|
40
|
-
"@crystaldesign/real-time-viewer": "24.10.0-beta.
|
|
38
|
+
"@crystaldesign/analytics": "24.10.0-beta.18",
|
|
39
|
+
"@crystaldesign/products-component": "24.10.0-beta.18",
|
|
40
|
+
"@crystaldesign/real-time-viewer": "24.10.0-beta.18",
|
|
41
41
|
"@tinymce/tinymce-react": "^3.13.0",
|
|
42
42
|
"react-error-boundary": "^4.0.13",
|
|
43
43
|
"react-material-ui-carousel": "^2.1.1",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
},
|
|
46
46
|
"types": "./build/types/seller/src/index.d.ts",
|
|
47
47
|
"module": "build/esm/index.js",
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "3036ef2a8c69377db55bbd68b75ec558f20805e4"
|
|
49
49
|
}
|