@commercetools/sync-actions 7.2.0 → 7.3.1

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.
@@ -945,13 +945,17 @@ function actionsMapAddresses(diff, oldObj, newObj) {
945
945
  }));
946
946
  return handler(diff, oldObj, newObj);
947
947
  }
948
- function actionsMapBillingAddresses(diff, oldObj, newObj) {
949
- var handler = createBuildArrayActions('billingAddressIds', _defineProperty(_defineProperty({}, ADD_ACTIONS, function (addressId) {
948
+ function actionsMapAddBillingAddresses(diff, oldObj, newObj) {
949
+ var handler = createBuildArrayActions('billingAddressIds', _defineProperty({}, ADD_ACTIONS, function (addressId) {
950
950
  return {
951
951
  action: 'addBillingAddressId',
952
952
  addressId: addressId
953
953
  };
954
- }), REMOVE_ACTIONS, function (addressId) {
954
+ }));
955
+ return handler(diff, oldObj, newObj);
956
+ }
957
+ function actionsMapRemoveBillingAddresses(diff, oldObj, newObj) {
958
+ var handler = createBuildArrayActions('billingAddressIds', _defineProperty({}, REMOVE_ACTIONS, function (addressId) {
955
959
  return {
956
960
  action: 'removeBillingAddressId',
957
961
  addressId: addressId
@@ -959,13 +963,17 @@ function actionsMapBillingAddresses(diff, oldObj, newObj) {
959
963
  }));
960
964
  return handler(diff, oldObj, newObj);
961
965
  }
962
- function actionsMapShippingAddresses(diff, oldObj, newObj) {
963
- var handler = createBuildArrayActions('shippingAddressIds', _defineProperty(_defineProperty({}, ADD_ACTIONS, function (addressId) {
966
+ function actionsMapAddShippingAddresses(diff, oldObj, newObj) {
967
+ var handler = createBuildArrayActions('shippingAddressIds', _defineProperty({}, ADD_ACTIONS, function (addressId) {
964
968
  return {
965
969
  action: 'addShippingAddressId',
966
970
  addressId: addressId
967
971
  };
968
- }), REMOVE_ACTIONS, function (addressId) {
972
+ }));
973
+ return handler(diff, oldObj, newObj);
974
+ }
975
+ function actionsMapRemoveShippingAddresses(diff, oldObj, newObj) {
976
+ var handler = createBuildArrayActions('shippingAddressIds', _defineProperty({}, REMOVE_ACTIONS, function (addressId) {
969
977
  return {
970
978
  action: 'removeShippingAddressId',
971
979
  addressId: addressId
@@ -1042,6 +1050,12 @@ function createCustomerMapActions$1(mapActionGroup, syncActionConfig) {
1042
1050
  allActions.push(mapActionGroup('references', function () {
1043
1051
  return actionsMapReferences$2(diff, oldObj, newObj);
1044
1052
  }));
1053
+ allActions.push(mapActionGroup('billingAddressIds', function () {
1054
+ return actionsMapRemoveBillingAddresses(diff, oldObj, newObj);
1055
+ }));
1056
+ allActions.push(mapActionGroup('shippingAddressIds', function () {
1057
+ return actionsMapRemoveShippingAddresses(diff, oldObj, newObj);
1058
+ }));
1045
1059
  allActions.push(mapActionGroup('addresses', function () {
1046
1060
  return actionsMapAddresses(diff, oldObj, newObj);
1047
1061
  }));
@@ -1049,10 +1063,10 @@ function createCustomerMapActions$1(mapActionGroup, syncActionConfig) {
1049
1063
  return actionsMapSetDefaultBase(diff, oldObj, newObj, syncActionConfig);
1050
1064
  }));
1051
1065
  allActions.push(mapActionGroup('billingAddressIds', function () {
1052
- return actionsMapBillingAddresses(diff, oldObj, newObj);
1066
+ return actionsMapAddBillingAddresses(diff, oldObj, newObj);
1053
1067
  }));
1054
1068
  allActions.push(mapActionGroup('shippingAddressIds', function () {
1055
- return actionsMapShippingAddresses(diff, oldObj, newObj);
1069
+ return actionsMapAddShippingAddresses(diff, oldObj, newObj);
1056
1070
  }));
1057
1071
  allActions.push(mapActionGroup('custom', function () {
1058
1072
  return actionsMapCustom(diff, newObj, oldObj);
@@ -1312,14 +1326,45 @@ function _buildKeyActions(variantDiff, oldVariant) {
1312
1326
  }
1313
1327
  return null;
1314
1328
  }
1315
- function _buildNewSetAttributeAction(id, el, sameForAllAttributeNames) {
1316
- var attributeName = el && el.name;
1329
+ function _buildAttributeValue(diffedValue, oldAttributeValue, newAttributeValue) {
1330
+ var value;
1331
+ if (Array.isArray(diffedValue)) value = getDeltaValue(diffedValue, oldAttributeValue);else if (typeof diffedValue === 'string')
1332
+ // LText: value: {en: "", de: ""}
1333
+ // Enum: value: {key: "foo", label: "Foo"}
1334
+ // LEnum: value: {key: "foo", label: {en: "Foo", de: "Foo"}}
1335
+ // Money: value: {centAmount: 123, currencyCode: ""}
1336
+ // *: value: ""
1337
+
1338
+ // normal
1339
+ value = getDeltaValue(diffedValue, oldAttributeValue);else if (diffedValue.centAmount || diffedValue.currencyCode)
1340
+ // Money
1341
+ value = {
1342
+ centAmount: diffedValue.centAmount ? getDeltaValue(diffedValue.centAmount) : newAttributeValue.centAmount,
1343
+ currencyCode: diffedValue.currencyCode ? getDeltaValue(diffedValue.currencyCode) : newAttributeValue.currencyCode
1344
+ };else if (diffedValue.key)
1345
+ // Enum / LEnum (use only the key)
1346
+ value = getDeltaValue(diffedValue.key);else if (_typeof(diffedValue) === 'object') if ({}.hasOwnProperty.call(diffedValue, '_t') && diffedValue._t === 'a') {
1347
+ // set-typed attribute
1348
+ value = newAttributeValue;
1349
+ } else {
1350
+ // LText
1351
+
1352
+ var updatedValue = Object.keys(diffedValue).reduce(function (acc, lang) {
1353
+ var patchedValue = getDeltaValue(diffedValue[lang], acc[lang]);
1354
+ return Object.assign(acc, _defineProperty({}, lang, patchedValue));
1355
+ }, _objectSpread2({}, oldAttributeValue));
1356
+ value = updatedValue;
1357
+ }
1358
+ return value;
1359
+ }
1360
+ function _buildNewSetAttributeAction(variantId, attr, sameForAllAttributeNames) {
1361
+ var attributeName = attr && attr.name;
1317
1362
  if (!attributeName) return undefined;
1318
1363
  var action = {
1319
1364
  action: 'setAttribute',
1320
- variantId: id,
1365
+ variantId: variantId,
1321
1366
  name: attributeName,
1322
- value: el.value
1367
+ value: attr.value
1323
1368
  };
1324
1369
  if (sameForAllAttributeNames.indexOf(attributeName) !== -1) {
1325
1370
  action = _objectSpread2(_objectSpread2({}, action), {}, {
@@ -1347,35 +1392,31 @@ function _buildSetAttributeAction(diffedValue, oldVariant, attribute, sameForAll
1347
1392
  });
1348
1393
  delete action.variantId;
1349
1394
  }
1350
- if (Array.isArray(diffedValue)) action.value = getDeltaValue(diffedValue, oldAttribute.value);else if (typeof diffedValue === 'string')
1351
- // LText: value: {en: "", de: ""}
1352
- // Enum: value: {key: "foo", label: "Foo"}
1353
- // LEnum: value: {key: "foo", label: {en: "Foo", de: "Foo"}}
1354
- // Money: value: {centAmount: 123, currencyCode: ""}
1355
- // *: value: ""
1356
-
1357
- // normal
1358
- action.value = getDeltaValue(diffedValue, oldAttribute.value);else if (diffedValue.centAmount || diffedValue.currencyCode)
1359
- // Money
1360
- action.value = {
1361
- centAmount: diffedValue.centAmount ? getDeltaValue(diffedValue.centAmount) : attribute.value.centAmount,
1362
- currencyCode: diffedValue.currencyCode ? getDeltaValue(diffedValue.currencyCode) : attribute.value.currencyCode
1363
- };else if (diffedValue.key)
1364
- // Enum / LEnum (use only the key)
1365
- action.value = getDeltaValue(diffedValue.key);else if (_typeof(diffedValue) === 'object') if ({}.hasOwnProperty.call(diffedValue, '_t') && diffedValue._t === 'a') {
1366
- // set-typed attribute
1367
- action = _objectSpread2(_objectSpread2({}, action), {}, {
1368
- value: attribute.value
1369
- });
1370
- } else {
1371
- // LText
1395
+ action.value = _buildAttributeValue(diffedValue, oldAttribute.value, attribute.value);
1396
+ return action;
1397
+ }
1398
+ function _buildNewSetProductAttributeAction(attr) {
1399
+ var attributeName = attr && attr.name;
1400
+ if (!attributeName) return undefined;
1401
+ var action = {
1402
+ action: 'setProductAttribute',
1403
+ name: attributeName,
1404
+ value: attr.value
1405
+ };
1406
+ return action;
1407
+ }
1408
+ function _buildSetProductAttributeAction(diffedValue, oldProductData, newAttribute) {
1409
+ if (!newAttribute) return undefined;
1410
+ var action = {
1411
+ action: 'setProductAttribute',
1412
+ name: newAttribute.name
1413
+ };
1372
1414
 
1373
- var updatedValue = Object.keys(diffedValue).reduce(function (acc, lang) {
1374
- var patchedValue = getDeltaValue(diffedValue[lang], acc[lang]);
1375
- return Object.assign(acc, _defineProperty({}, lang, patchedValue));
1376
- }, _objectSpread2({}, oldAttribute.value));
1377
- action.value = updatedValue;
1378
- }
1415
+ // Used as original object for patching long diff text
1416
+ var oldAttribute = oldProductData.attributes.find(function (a) {
1417
+ return a.name === newAttribute.name;
1418
+ }) || {};
1419
+ action.value = _buildAttributeValue(diffedValue, oldAttribute.value, newAttribute.value);
1379
1420
  return action;
1380
1421
  }
1381
1422
  function _buildVariantImagesAction(diffedImages) {
@@ -1486,6 +1527,41 @@ function _buildVariantPricesAction(diffedPrices) {
1486
1527
  });
1487
1528
  return [addPriceActions, changePriceActions, removePriceActions];
1488
1529
  }
1530
+ function _buildProductAttributesActions(diffedAttributes, oldProductData, newProductData) {
1531
+ var actions = [];
1532
+ if (!diffedAttributes) return actions;
1533
+ forEach__default["default"](diffedAttributes, function (value, key) {
1534
+ if (REGEX_NUMBER$2.test(key)) {
1535
+ if (Array.isArray(value)) {
1536
+ var setAction = _buildNewSetProductAttributeAction(getDeltaValue(value));
1537
+ if (setAction) actions.push(setAction);
1538
+ } else if (newProductData.attributes) {
1539
+ var _setAction = _buildSetProductAttributeAction(value.value, oldProductData, newProductData.attributes[key]);
1540
+ if (_setAction) actions.push(_setAction);
1541
+ }
1542
+ } else if (REGEX_UNDERSCORE_NUMBER$2.test(key)) {
1543
+ if (Array.isArray(value)) {
1544
+ // Ignore pure array moves!
1545
+ if (value.length === 3 && value[2] === 3) return;
1546
+ var deltaValue = getDeltaValue(value);
1547
+ if (!deltaValue) if (value[0] && value[0].name)
1548
+ // unset attribute if
1549
+ deltaValue = {
1550
+ name: value[0].name
1551
+ };else deltaValue = undefined;
1552
+ var _setAction2 = _buildNewSetProductAttributeAction(deltaValue);
1553
+ if (_setAction2) actions.push(_setAction2);
1554
+ } else {
1555
+ var index = key.substring(1);
1556
+ if (newProductData.attributes) {
1557
+ var _setAction3 = _buildSetProductAttributeAction(value.value, oldProductData, newProductData.attributes[index]);
1558
+ if (_setAction3) actions.push(_setAction3);
1559
+ }
1560
+ }
1561
+ }
1562
+ });
1563
+ return actions;
1564
+ }
1489
1565
  function _buildVariantAttributesActions(attributes, oldVariant, newVariant, sameForAllAttributeNames) {
1490
1566
  var actions = [];
1491
1567
  if (!attributes) return actions;
@@ -1497,8 +1573,8 @@ function _buildVariantAttributesActions(attributes, oldVariant, newVariant, same
1497
1573
  var setAction = _buildNewSetAttributeAction(id, deltaValue, sameForAllAttributeNames);
1498
1574
  if (setAction) actions.push(setAction);
1499
1575
  } else if (newVariant.attributes) {
1500
- var _setAction = _buildSetAttributeAction(value.value, oldVariant, newVariant.attributes[key], sameForAllAttributeNames);
1501
- if (_setAction) actions.push(_setAction);
1576
+ var _setAction4 = _buildSetAttributeAction(value.value, oldVariant, newVariant.attributes[key], sameForAllAttributeNames);
1577
+ if (_setAction4) actions.push(_setAction4);
1502
1578
  }
1503
1579
  } else if (REGEX_UNDERSCORE_NUMBER$2.test(key)) if (Array.isArray(value)) {
1504
1580
  // Ignore pure array moves!
@@ -1510,13 +1586,13 @@ function _buildVariantAttributesActions(attributes, oldVariant, newVariant, same
1510
1586
  _deltaValue = {
1511
1587
  name: value[0].name
1512
1588
  };else _deltaValue = undefined;
1513
- var _setAction2 = _buildNewSetAttributeAction(_id, _deltaValue, sameForAllAttributeNames);
1514
- if (_setAction2) actions.push(_setAction2);
1589
+ var _setAction5 = _buildNewSetAttributeAction(_id, _deltaValue, sameForAllAttributeNames);
1590
+ if (_setAction5) actions.push(_setAction5);
1515
1591
  } else {
1516
1592
  var index = key.substring(1);
1517
1593
  if (newVariant.attributes) {
1518
- var _setAction3 = _buildSetAttributeAction(value.value, oldVariant, newVariant.attributes[index], sameForAllAttributeNames);
1519
- if (_setAction3) actions.push(_setAction3);
1594
+ var _setAction6 = _buildSetAttributeAction(value.value, oldVariant, newVariant.attributes[index], sameForAllAttributeNames);
1595
+ if (_setAction6) actions.push(_setAction6);
1520
1596
  }
1521
1597
  }
1522
1598
  });
@@ -1731,6 +1807,9 @@ function actionsMapAssets(diff, oldObj, newObj, variantHashMap) {
1731
1807
  });
1732
1808
  return allAssetsActions;
1733
1809
  }
1810
+ function actionsMapProductAttributes(diffedProductData, oldProductData, newProductData) {
1811
+ return _buildProductAttributesActions(diffedProductData.attributes, oldProductData, newProductData);
1812
+ }
1734
1813
  function actionsMapAttributes$1(diff, oldObj, newObj) {
1735
1814
  var sameForAllAttributeNames = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
1736
1815
  var variantHashMap = arguments.length > 4 ? arguments[4] : undefined;
@@ -1851,6 +1930,9 @@ function createProductMapActions(mapActionGroup, syncActionConfig) {
1851
1930
  var publish = newObj.publish,
1852
1931
  staged = newObj.staged;
1853
1932
  var variantHashMap = findMatchingPairs(diff.variants, oldObj.variants, newObj.variants);
1933
+ allActions.push(mapActionGroup('productAttributes', function () {
1934
+ return actionsMapProductAttributes(diff, oldObj, newObj);
1935
+ }));
1854
1936
  allActions.push(mapActionGroup('attributes', function () {
1855
1937
  return actionsMapAttributes$1(diff, oldObj, newObj, sameForAllAttributeNames || [], variantHashMap);
1856
1938
  }));
@@ -3808,6 +3890,12 @@ var createCustomerMapActions = function createCustomerMapActions(mapActionGroup,
3808
3890
  allActions.push(mapActionGroup('base', function () {
3809
3891
  return actionsMapBase$1(diff, oldObj, newObj, syncActionConfig);
3810
3892
  }));
3893
+ allActions.push(mapActionGroup('billingAddressIds', function () {
3894
+ return actionsMapRemoveBillingAddresses(diff, oldObj, newObj);
3895
+ }));
3896
+ allActions.push(mapActionGroup('shippingAddressIds', function () {
3897
+ return actionsMapRemoveShippingAddresses(diff, oldObj, newObj);
3898
+ }));
3811
3899
  allActions.push(mapActionGroup('addresses', function () {
3812
3900
  return actionsMapAddresses(diff, oldObj, newObj);
3813
3901
  }));
@@ -3815,10 +3903,10 @@ var createCustomerMapActions = function createCustomerMapActions(mapActionGroup,
3815
3903
  return actionsMapSetDefaultBase(diff, oldObj, newObj, syncActionConfig);
3816
3904
  }));
3817
3905
  allActions.push(mapActionGroup('billingAddressIds', function () {
3818
- return actionsMapBillingAddresses(diff, oldObj, newObj);
3906
+ return actionsMapAddBillingAddresses(diff, oldObj, newObj);
3819
3907
  }));
3820
3908
  allActions.push(mapActionGroup('shippingAddressIds', function () {
3821
- return actionsMapShippingAddresses(diff, oldObj, newObj);
3909
+ return actionsMapAddShippingAddresses(diff, oldObj, newObj);
3822
3910
  }));
3823
3911
  allActions.push(mapActionGroup('associates', function () {
3824
3912
  return actionsMapAssociates(diff, oldObj, newObj);
@@ -945,13 +945,17 @@ function actionsMapAddresses(diff, oldObj, newObj) {
945
945
  }));
946
946
  return handler(diff, oldObj, newObj);
947
947
  }
948
- function actionsMapBillingAddresses(diff, oldObj, newObj) {
949
- var handler = createBuildArrayActions('billingAddressIds', _defineProperty(_defineProperty({}, ADD_ACTIONS, function (addressId) {
948
+ function actionsMapAddBillingAddresses(diff, oldObj, newObj) {
949
+ var handler = createBuildArrayActions('billingAddressIds', _defineProperty({}, ADD_ACTIONS, function (addressId) {
950
950
  return {
951
951
  action: 'addBillingAddressId',
952
952
  addressId: addressId
953
953
  };
954
- }), REMOVE_ACTIONS, function (addressId) {
954
+ }));
955
+ return handler(diff, oldObj, newObj);
956
+ }
957
+ function actionsMapRemoveBillingAddresses(diff, oldObj, newObj) {
958
+ var handler = createBuildArrayActions('billingAddressIds', _defineProperty({}, REMOVE_ACTIONS, function (addressId) {
955
959
  return {
956
960
  action: 'removeBillingAddressId',
957
961
  addressId: addressId
@@ -959,13 +963,17 @@ function actionsMapBillingAddresses(diff, oldObj, newObj) {
959
963
  }));
960
964
  return handler(diff, oldObj, newObj);
961
965
  }
962
- function actionsMapShippingAddresses(diff, oldObj, newObj) {
963
- var handler = createBuildArrayActions('shippingAddressIds', _defineProperty(_defineProperty({}, ADD_ACTIONS, function (addressId) {
966
+ function actionsMapAddShippingAddresses(diff, oldObj, newObj) {
967
+ var handler = createBuildArrayActions('shippingAddressIds', _defineProperty({}, ADD_ACTIONS, function (addressId) {
964
968
  return {
965
969
  action: 'addShippingAddressId',
966
970
  addressId: addressId
967
971
  };
968
- }), REMOVE_ACTIONS, function (addressId) {
972
+ }));
973
+ return handler(diff, oldObj, newObj);
974
+ }
975
+ function actionsMapRemoveShippingAddresses(diff, oldObj, newObj) {
976
+ var handler = createBuildArrayActions('shippingAddressIds', _defineProperty({}, REMOVE_ACTIONS, function (addressId) {
969
977
  return {
970
978
  action: 'removeShippingAddressId',
971
979
  addressId: addressId
@@ -1042,6 +1050,12 @@ function createCustomerMapActions$1(mapActionGroup, syncActionConfig) {
1042
1050
  allActions.push(mapActionGroup('references', function () {
1043
1051
  return actionsMapReferences$2(diff, oldObj, newObj);
1044
1052
  }));
1053
+ allActions.push(mapActionGroup('billingAddressIds', function () {
1054
+ return actionsMapRemoveBillingAddresses(diff, oldObj, newObj);
1055
+ }));
1056
+ allActions.push(mapActionGroup('shippingAddressIds', function () {
1057
+ return actionsMapRemoveShippingAddresses(diff, oldObj, newObj);
1058
+ }));
1045
1059
  allActions.push(mapActionGroup('addresses', function () {
1046
1060
  return actionsMapAddresses(diff, oldObj, newObj);
1047
1061
  }));
@@ -1049,10 +1063,10 @@ function createCustomerMapActions$1(mapActionGroup, syncActionConfig) {
1049
1063
  return actionsMapSetDefaultBase(diff, oldObj, newObj, syncActionConfig);
1050
1064
  }));
1051
1065
  allActions.push(mapActionGroup('billingAddressIds', function () {
1052
- return actionsMapBillingAddresses(diff, oldObj, newObj);
1066
+ return actionsMapAddBillingAddresses(diff, oldObj, newObj);
1053
1067
  }));
1054
1068
  allActions.push(mapActionGroup('shippingAddressIds', function () {
1055
- return actionsMapShippingAddresses(diff, oldObj, newObj);
1069
+ return actionsMapAddShippingAddresses(diff, oldObj, newObj);
1056
1070
  }));
1057
1071
  allActions.push(mapActionGroup('custom', function () {
1058
1072
  return actionsMapCustom(diff, newObj, oldObj);
@@ -1312,14 +1326,45 @@ function _buildKeyActions(variantDiff, oldVariant) {
1312
1326
  }
1313
1327
  return null;
1314
1328
  }
1315
- function _buildNewSetAttributeAction(id, el, sameForAllAttributeNames) {
1316
- var attributeName = el && el.name;
1329
+ function _buildAttributeValue(diffedValue, oldAttributeValue, newAttributeValue) {
1330
+ var value;
1331
+ if (Array.isArray(diffedValue)) value = getDeltaValue(diffedValue, oldAttributeValue);else if (typeof diffedValue === 'string')
1332
+ // LText: value: {en: "", de: ""}
1333
+ // Enum: value: {key: "foo", label: "Foo"}
1334
+ // LEnum: value: {key: "foo", label: {en: "Foo", de: "Foo"}}
1335
+ // Money: value: {centAmount: 123, currencyCode: ""}
1336
+ // *: value: ""
1337
+
1338
+ // normal
1339
+ value = getDeltaValue(diffedValue, oldAttributeValue);else if (diffedValue.centAmount || diffedValue.currencyCode)
1340
+ // Money
1341
+ value = {
1342
+ centAmount: diffedValue.centAmount ? getDeltaValue(diffedValue.centAmount) : newAttributeValue.centAmount,
1343
+ currencyCode: diffedValue.currencyCode ? getDeltaValue(diffedValue.currencyCode) : newAttributeValue.currencyCode
1344
+ };else if (diffedValue.key)
1345
+ // Enum / LEnum (use only the key)
1346
+ value = getDeltaValue(diffedValue.key);else if (_typeof(diffedValue) === 'object') if ({}.hasOwnProperty.call(diffedValue, '_t') && diffedValue._t === 'a') {
1347
+ // set-typed attribute
1348
+ value = newAttributeValue;
1349
+ } else {
1350
+ // LText
1351
+
1352
+ var updatedValue = Object.keys(diffedValue).reduce(function (acc, lang) {
1353
+ var patchedValue = getDeltaValue(diffedValue[lang], acc[lang]);
1354
+ return Object.assign(acc, _defineProperty({}, lang, patchedValue));
1355
+ }, _objectSpread2({}, oldAttributeValue));
1356
+ value = updatedValue;
1357
+ }
1358
+ return value;
1359
+ }
1360
+ function _buildNewSetAttributeAction(variantId, attr, sameForAllAttributeNames) {
1361
+ var attributeName = attr && attr.name;
1317
1362
  if (!attributeName) return undefined;
1318
1363
  var action = {
1319
1364
  action: 'setAttribute',
1320
- variantId: id,
1365
+ variantId: variantId,
1321
1366
  name: attributeName,
1322
- value: el.value
1367
+ value: attr.value
1323
1368
  };
1324
1369
  if (sameForAllAttributeNames.indexOf(attributeName) !== -1) {
1325
1370
  action = _objectSpread2(_objectSpread2({}, action), {}, {
@@ -1347,35 +1392,31 @@ function _buildSetAttributeAction(diffedValue, oldVariant, attribute, sameForAll
1347
1392
  });
1348
1393
  delete action.variantId;
1349
1394
  }
1350
- if (Array.isArray(diffedValue)) action.value = getDeltaValue(diffedValue, oldAttribute.value);else if (typeof diffedValue === 'string')
1351
- // LText: value: {en: "", de: ""}
1352
- // Enum: value: {key: "foo", label: "Foo"}
1353
- // LEnum: value: {key: "foo", label: {en: "Foo", de: "Foo"}}
1354
- // Money: value: {centAmount: 123, currencyCode: ""}
1355
- // *: value: ""
1356
-
1357
- // normal
1358
- action.value = getDeltaValue(diffedValue, oldAttribute.value);else if (diffedValue.centAmount || diffedValue.currencyCode)
1359
- // Money
1360
- action.value = {
1361
- centAmount: diffedValue.centAmount ? getDeltaValue(diffedValue.centAmount) : attribute.value.centAmount,
1362
- currencyCode: diffedValue.currencyCode ? getDeltaValue(diffedValue.currencyCode) : attribute.value.currencyCode
1363
- };else if (diffedValue.key)
1364
- // Enum / LEnum (use only the key)
1365
- action.value = getDeltaValue(diffedValue.key);else if (_typeof(diffedValue) === 'object') if ({}.hasOwnProperty.call(diffedValue, '_t') && diffedValue._t === 'a') {
1366
- // set-typed attribute
1367
- action = _objectSpread2(_objectSpread2({}, action), {}, {
1368
- value: attribute.value
1369
- });
1370
- } else {
1371
- // LText
1395
+ action.value = _buildAttributeValue(diffedValue, oldAttribute.value, attribute.value);
1396
+ return action;
1397
+ }
1398
+ function _buildNewSetProductAttributeAction(attr) {
1399
+ var attributeName = attr && attr.name;
1400
+ if (!attributeName) return undefined;
1401
+ var action = {
1402
+ action: 'setProductAttribute',
1403
+ name: attributeName,
1404
+ value: attr.value
1405
+ };
1406
+ return action;
1407
+ }
1408
+ function _buildSetProductAttributeAction(diffedValue, oldProductData, newAttribute) {
1409
+ if (!newAttribute) return undefined;
1410
+ var action = {
1411
+ action: 'setProductAttribute',
1412
+ name: newAttribute.name
1413
+ };
1372
1414
 
1373
- var updatedValue = Object.keys(diffedValue).reduce(function (acc, lang) {
1374
- var patchedValue = getDeltaValue(diffedValue[lang], acc[lang]);
1375
- return Object.assign(acc, _defineProperty({}, lang, patchedValue));
1376
- }, _objectSpread2({}, oldAttribute.value));
1377
- action.value = updatedValue;
1378
- }
1415
+ // Used as original object for patching long diff text
1416
+ var oldAttribute = oldProductData.attributes.find(function (a) {
1417
+ return a.name === newAttribute.name;
1418
+ }) || {};
1419
+ action.value = _buildAttributeValue(diffedValue, oldAttribute.value, newAttribute.value);
1379
1420
  return action;
1380
1421
  }
1381
1422
  function _buildVariantImagesAction(diffedImages) {
@@ -1486,6 +1527,41 @@ function _buildVariantPricesAction(diffedPrices) {
1486
1527
  });
1487
1528
  return [addPriceActions, changePriceActions, removePriceActions];
1488
1529
  }
1530
+ function _buildProductAttributesActions(diffedAttributes, oldProductData, newProductData) {
1531
+ var actions = [];
1532
+ if (!diffedAttributes) return actions;
1533
+ forEach__default["default"](diffedAttributes, function (value, key) {
1534
+ if (REGEX_NUMBER$2.test(key)) {
1535
+ if (Array.isArray(value)) {
1536
+ var setAction = _buildNewSetProductAttributeAction(getDeltaValue(value));
1537
+ if (setAction) actions.push(setAction);
1538
+ } else if (newProductData.attributes) {
1539
+ var _setAction = _buildSetProductAttributeAction(value.value, oldProductData, newProductData.attributes[key]);
1540
+ if (_setAction) actions.push(_setAction);
1541
+ }
1542
+ } else if (REGEX_UNDERSCORE_NUMBER$2.test(key)) {
1543
+ if (Array.isArray(value)) {
1544
+ // Ignore pure array moves!
1545
+ if (value.length === 3 && value[2] === 3) return;
1546
+ var deltaValue = getDeltaValue(value);
1547
+ if (!deltaValue) if (value[0] && value[0].name)
1548
+ // unset attribute if
1549
+ deltaValue = {
1550
+ name: value[0].name
1551
+ };else deltaValue = undefined;
1552
+ var _setAction2 = _buildNewSetProductAttributeAction(deltaValue);
1553
+ if (_setAction2) actions.push(_setAction2);
1554
+ } else {
1555
+ var index = key.substring(1);
1556
+ if (newProductData.attributes) {
1557
+ var _setAction3 = _buildSetProductAttributeAction(value.value, oldProductData, newProductData.attributes[index]);
1558
+ if (_setAction3) actions.push(_setAction3);
1559
+ }
1560
+ }
1561
+ }
1562
+ });
1563
+ return actions;
1564
+ }
1489
1565
  function _buildVariantAttributesActions(attributes, oldVariant, newVariant, sameForAllAttributeNames) {
1490
1566
  var actions = [];
1491
1567
  if (!attributes) return actions;
@@ -1497,8 +1573,8 @@ function _buildVariantAttributesActions(attributes, oldVariant, newVariant, same
1497
1573
  var setAction = _buildNewSetAttributeAction(id, deltaValue, sameForAllAttributeNames);
1498
1574
  if (setAction) actions.push(setAction);
1499
1575
  } else if (newVariant.attributes) {
1500
- var _setAction = _buildSetAttributeAction(value.value, oldVariant, newVariant.attributes[key], sameForAllAttributeNames);
1501
- if (_setAction) actions.push(_setAction);
1576
+ var _setAction4 = _buildSetAttributeAction(value.value, oldVariant, newVariant.attributes[key], sameForAllAttributeNames);
1577
+ if (_setAction4) actions.push(_setAction4);
1502
1578
  }
1503
1579
  } else if (REGEX_UNDERSCORE_NUMBER$2.test(key)) if (Array.isArray(value)) {
1504
1580
  // Ignore pure array moves!
@@ -1510,13 +1586,13 @@ function _buildVariantAttributesActions(attributes, oldVariant, newVariant, same
1510
1586
  _deltaValue = {
1511
1587
  name: value[0].name
1512
1588
  };else _deltaValue = undefined;
1513
- var _setAction2 = _buildNewSetAttributeAction(_id, _deltaValue, sameForAllAttributeNames);
1514
- if (_setAction2) actions.push(_setAction2);
1589
+ var _setAction5 = _buildNewSetAttributeAction(_id, _deltaValue, sameForAllAttributeNames);
1590
+ if (_setAction5) actions.push(_setAction5);
1515
1591
  } else {
1516
1592
  var index = key.substring(1);
1517
1593
  if (newVariant.attributes) {
1518
- var _setAction3 = _buildSetAttributeAction(value.value, oldVariant, newVariant.attributes[index], sameForAllAttributeNames);
1519
- if (_setAction3) actions.push(_setAction3);
1594
+ var _setAction6 = _buildSetAttributeAction(value.value, oldVariant, newVariant.attributes[index], sameForAllAttributeNames);
1595
+ if (_setAction6) actions.push(_setAction6);
1520
1596
  }
1521
1597
  }
1522
1598
  });
@@ -1731,6 +1807,9 @@ function actionsMapAssets(diff, oldObj, newObj, variantHashMap) {
1731
1807
  });
1732
1808
  return allAssetsActions;
1733
1809
  }
1810
+ function actionsMapProductAttributes(diffedProductData, oldProductData, newProductData) {
1811
+ return _buildProductAttributesActions(diffedProductData.attributes, oldProductData, newProductData);
1812
+ }
1734
1813
  function actionsMapAttributes$1(diff, oldObj, newObj) {
1735
1814
  var sameForAllAttributeNames = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
1736
1815
  var variantHashMap = arguments.length > 4 ? arguments[4] : undefined;
@@ -1851,6 +1930,9 @@ function createProductMapActions(mapActionGroup, syncActionConfig) {
1851
1930
  var publish = newObj.publish,
1852
1931
  staged = newObj.staged;
1853
1932
  var variantHashMap = findMatchingPairs(diff.variants, oldObj.variants, newObj.variants);
1933
+ allActions.push(mapActionGroup('productAttributes', function () {
1934
+ return actionsMapProductAttributes(diff, oldObj, newObj);
1935
+ }));
1854
1936
  allActions.push(mapActionGroup('attributes', function () {
1855
1937
  return actionsMapAttributes$1(diff, oldObj, newObj, sameForAllAttributeNames || [], variantHashMap);
1856
1938
  }));
@@ -3808,6 +3890,12 @@ var createCustomerMapActions = function createCustomerMapActions(mapActionGroup,
3808
3890
  allActions.push(mapActionGroup('base', function () {
3809
3891
  return actionsMapBase$1(diff, oldObj, newObj, syncActionConfig);
3810
3892
  }));
3893
+ allActions.push(mapActionGroup('billingAddressIds', function () {
3894
+ return actionsMapRemoveBillingAddresses(diff, oldObj, newObj);
3895
+ }));
3896
+ allActions.push(mapActionGroup('shippingAddressIds', function () {
3897
+ return actionsMapRemoveShippingAddresses(diff, oldObj, newObj);
3898
+ }));
3811
3899
  allActions.push(mapActionGroup('addresses', function () {
3812
3900
  return actionsMapAddresses(diff, oldObj, newObj);
3813
3901
  }));
@@ -3815,10 +3903,10 @@ var createCustomerMapActions = function createCustomerMapActions(mapActionGroup,
3815
3903
  return actionsMapSetDefaultBase(diff, oldObj, newObj, syncActionConfig);
3816
3904
  }));
3817
3905
  allActions.push(mapActionGroup('billingAddressIds', function () {
3818
- return actionsMapBillingAddresses(diff, oldObj, newObj);
3906
+ return actionsMapAddBillingAddresses(diff, oldObj, newObj);
3819
3907
  }));
3820
3908
  allActions.push(mapActionGroup('shippingAddressIds', function () {
3821
- return actionsMapShippingAddresses(diff, oldObj, newObj);
3909
+ return actionsMapAddShippingAddresses(diff, oldObj, newObj);
3822
3910
  }));
3823
3911
  allActions.push(mapActionGroup('associates', function () {
3824
3912
  return actionsMapAssociates(diff, oldObj, newObj);
@@ -930,13 +930,17 @@ function actionsMapAddresses(diff, oldObj, newObj) {
930
930
  }));
931
931
  return handler(diff, oldObj, newObj);
932
932
  }
933
- function actionsMapBillingAddresses(diff, oldObj, newObj) {
934
- var handler = createBuildArrayActions('billingAddressIds', _defineProperty(_defineProperty({}, ADD_ACTIONS, function (addressId) {
933
+ function actionsMapAddBillingAddresses(diff, oldObj, newObj) {
934
+ var handler = createBuildArrayActions('billingAddressIds', _defineProperty({}, ADD_ACTIONS, function (addressId) {
935
935
  return {
936
936
  action: 'addBillingAddressId',
937
937
  addressId: addressId
938
938
  };
939
- }), REMOVE_ACTIONS, function (addressId) {
939
+ }));
940
+ return handler(diff, oldObj, newObj);
941
+ }
942
+ function actionsMapRemoveBillingAddresses(diff, oldObj, newObj) {
943
+ var handler = createBuildArrayActions('billingAddressIds', _defineProperty({}, REMOVE_ACTIONS, function (addressId) {
940
944
  return {
941
945
  action: 'removeBillingAddressId',
942
946
  addressId: addressId
@@ -944,13 +948,17 @@ function actionsMapBillingAddresses(diff, oldObj, newObj) {
944
948
  }));
945
949
  return handler(diff, oldObj, newObj);
946
950
  }
947
- function actionsMapShippingAddresses(diff, oldObj, newObj) {
948
- var handler = createBuildArrayActions('shippingAddressIds', _defineProperty(_defineProperty({}, ADD_ACTIONS, function (addressId) {
951
+ function actionsMapAddShippingAddresses(diff, oldObj, newObj) {
952
+ var handler = createBuildArrayActions('shippingAddressIds', _defineProperty({}, ADD_ACTIONS, function (addressId) {
949
953
  return {
950
954
  action: 'addShippingAddressId',
951
955
  addressId: addressId
952
956
  };
953
- }), REMOVE_ACTIONS, function (addressId) {
957
+ }));
958
+ return handler(diff, oldObj, newObj);
959
+ }
960
+ function actionsMapRemoveShippingAddresses(diff, oldObj, newObj) {
961
+ var handler = createBuildArrayActions('shippingAddressIds', _defineProperty({}, REMOVE_ACTIONS, function (addressId) {
954
962
  return {
955
963
  action: 'removeShippingAddressId',
956
964
  addressId: addressId
@@ -1027,6 +1035,12 @@ function createCustomerMapActions$1(mapActionGroup, syncActionConfig) {
1027
1035
  allActions.push(mapActionGroup('references', function () {
1028
1036
  return actionsMapReferences$2(diff, oldObj, newObj);
1029
1037
  }));
1038
+ allActions.push(mapActionGroup('billingAddressIds', function () {
1039
+ return actionsMapRemoveBillingAddresses(diff, oldObj, newObj);
1040
+ }));
1041
+ allActions.push(mapActionGroup('shippingAddressIds', function () {
1042
+ return actionsMapRemoveShippingAddresses(diff, oldObj, newObj);
1043
+ }));
1030
1044
  allActions.push(mapActionGroup('addresses', function () {
1031
1045
  return actionsMapAddresses(diff, oldObj, newObj);
1032
1046
  }));
@@ -1034,10 +1048,10 @@ function createCustomerMapActions$1(mapActionGroup, syncActionConfig) {
1034
1048
  return actionsMapSetDefaultBase(diff, oldObj, newObj, syncActionConfig);
1035
1049
  }));
1036
1050
  allActions.push(mapActionGroup('billingAddressIds', function () {
1037
- return actionsMapBillingAddresses(diff, oldObj, newObj);
1051
+ return actionsMapAddBillingAddresses(diff, oldObj, newObj);
1038
1052
  }));
1039
1053
  allActions.push(mapActionGroup('shippingAddressIds', function () {
1040
- return actionsMapShippingAddresses(diff, oldObj, newObj);
1054
+ return actionsMapAddShippingAddresses(diff, oldObj, newObj);
1041
1055
  }));
1042
1056
  allActions.push(mapActionGroup('custom', function () {
1043
1057
  return actionsMapCustom(diff, newObj, oldObj);
@@ -1297,14 +1311,45 @@ function _buildKeyActions(variantDiff, oldVariant) {
1297
1311
  }
1298
1312
  return null;
1299
1313
  }
1300
- function _buildNewSetAttributeAction(id, el, sameForAllAttributeNames) {
1301
- var attributeName = el && el.name;
1314
+ function _buildAttributeValue(diffedValue, oldAttributeValue, newAttributeValue) {
1315
+ var value;
1316
+ if (Array.isArray(diffedValue)) value = getDeltaValue(diffedValue, oldAttributeValue);else if (typeof diffedValue === 'string')
1317
+ // LText: value: {en: "", de: ""}
1318
+ // Enum: value: {key: "foo", label: "Foo"}
1319
+ // LEnum: value: {key: "foo", label: {en: "Foo", de: "Foo"}}
1320
+ // Money: value: {centAmount: 123, currencyCode: ""}
1321
+ // *: value: ""
1322
+
1323
+ // normal
1324
+ value = getDeltaValue(diffedValue, oldAttributeValue);else if (diffedValue.centAmount || diffedValue.currencyCode)
1325
+ // Money
1326
+ value = {
1327
+ centAmount: diffedValue.centAmount ? getDeltaValue(diffedValue.centAmount) : newAttributeValue.centAmount,
1328
+ currencyCode: diffedValue.currencyCode ? getDeltaValue(diffedValue.currencyCode) : newAttributeValue.currencyCode
1329
+ };else if (diffedValue.key)
1330
+ // Enum / LEnum (use only the key)
1331
+ value = getDeltaValue(diffedValue.key);else if (_typeof(diffedValue) === 'object') if ({}.hasOwnProperty.call(diffedValue, '_t') && diffedValue._t === 'a') {
1332
+ // set-typed attribute
1333
+ value = newAttributeValue;
1334
+ } else {
1335
+ // LText
1336
+
1337
+ var updatedValue = Object.keys(diffedValue).reduce(function (acc, lang) {
1338
+ var patchedValue = getDeltaValue(diffedValue[lang], acc[lang]);
1339
+ return Object.assign(acc, _defineProperty({}, lang, patchedValue));
1340
+ }, _objectSpread2({}, oldAttributeValue));
1341
+ value = updatedValue;
1342
+ }
1343
+ return value;
1344
+ }
1345
+ function _buildNewSetAttributeAction(variantId, attr, sameForAllAttributeNames) {
1346
+ var attributeName = attr && attr.name;
1302
1347
  if (!attributeName) return undefined;
1303
1348
  var action = {
1304
1349
  action: 'setAttribute',
1305
- variantId: id,
1350
+ variantId: variantId,
1306
1351
  name: attributeName,
1307
- value: el.value
1352
+ value: attr.value
1308
1353
  };
1309
1354
  if (sameForAllAttributeNames.indexOf(attributeName) !== -1) {
1310
1355
  action = _objectSpread2(_objectSpread2({}, action), {}, {
@@ -1332,35 +1377,31 @@ function _buildSetAttributeAction(diffedValue, oldVariant, attribute, sameForAll
1332
1377
  });
1333
1378
  delete action.variantId;
1334
1379
  }
1335
- if (Array.isArray(diffedValue)) action.value = getDeltaValue(diffedValue, oldAttribute.value);else if (typeof diffedValue === 'string')
1336
- // LText: value: {en: "", de: ""}
1337
- // Enum: value: {key: "foo", label: "Foo"}
1338
- // LEnum: value: {key: "foo", label: {en: "Foo", de: "Foo"}}
1339
- // Money: value: {centAmount: 123, currencyCode: ""}
1340
- // *: value: ""
1341
-
1342
- // normal
1343
- action.value = getDeltaValue(diffedValue, oldAttribute.value);else if (diffedValue.centAmount || diffedValue.currencyCode)
1344
- // Money
1345
- action.value = {
1346
- centAmount: diffedValue.centAmount ? getDeltaValue(diffedValue.centAmount) : attribute.value.centAmount,
1347
- currencyCode: diffedValue.currencyCode ? getDeltaValue(diffedValue.currencyCode) : attribute.value.currencyCode
1348
- };else if (diffedValue.key)
1349
- // Enum / LEnum (use only the key)
1350
- action.value = getDeltaValue(diffedValue.key);else if (_typeof(diffedValue) === 'object') if ({}.hasOwnProperty.call(diffedValue, '_t') && diffedValue._t === 'a') {
1351
- // set-typed attribute
1352
- action = _objectSpread2(_objectSpread2({}, action), {}, {
1353
- value: attribute.value
1354
- });
1355
- } else {
1356
- // LText
1380
+ action.value = _buildAttributeValue(diffedValue, oldAttribute.value, attribute.value);
1381
+ return action;
1382
+ }
1383
+ function _buildNewSetProductAttributeAction(attr) {
1384
+ var attributeName = attr && attr.name;
1385
+ if (!attributeName) return undefined;
1386
+ var action = {
1387
+ action: 'setProductAttribute',
1388
+ name: attributeName,
1389
+ value: attr.value
1390
+ };
1391
+ return action;
1392
+ }
1393
+ function _buildSetProductAttributeAction(diffedValue, oldProductData, newAttribute) {
1394
+ if (!newAttribute) return undefined;
1395
+ var action = {
1396
+ action: 'setProductAttribute',
1397
+ name: newAttribute.name
1398
+ };
1357
1399
 
1358
- var updatedValue = Object.keys(diffedValue).reduce(function (acc, lang) {
1359
- var patchedValue = getDeltaValue(diffedValue[lang], acc[lang]);
1360
- return Object.assign(acc, _defineProperty({}, lang, patchedValue));
1361
- }, _objectSpread2({}, oldAttribute.value));
1362
- action.value = updatedValue;
1363
- }
1400
+ // Used as original object for patching long diff text
1401
+ var oldAttribute = oldProductData.attributes.find(function (a) {
1402
+ return a.name === newAttribute.name;
1403
+ }) || {};
1404
+ action.value = _buildAttributeValue(diffedValue, oldAttribute.value, newAttribute.value);
1364
1405
  return action;
1365
1406
  }
1366
1407
  function _buildVariantImagesAction(diffedImages) {
@@ -1471,6 +1512,41 @@ function _buildVariantPricesAction(diffedPrices) {
1471
1512
  });
1472
1513
  return [addPriceActions, changePriceActions, removePriceActions];
1473
1514
  }
1515
+ function _buildProductAttributesActions(diffedAttributes, oldProductData, newProductData) {
1516
+ var actions = [];
1517
+ if (!diffedAttributes) return actions;
1518
+ forEach(diffedAttributes, function (value, key) {
1519
+ if (REGEX_NUMBER$2.test(key)) {
1520
+ if (Array.isArray(value)) {
1521
+ var setAction = _buildNewSetProductAttributeAction(getDeltaValue(value));
1522
+ if (setAction) actions.push(setAction);
1523
+ } else if (newProductData.attributes) {
1524
+ var _setAction = _buildSetProductAttributeAction(value.value, oldProductData, newProductData.attributes[key]);
1525
+ if (_setAction) actions.push(_setAction);
1526
+ }
1527
+ } else if (REGEX_UNDERSCORE_NUMBER$2.test(key)) {
1528
+ if (Array.isArray(value)) {
1529
+ // Ignore pure array moves!
1530
+ if (value.length === 3 && value[2] === 3) return;
1531
+ var deltaValue = getDeltaValue(value);
1532
+ if (!deltaValue) if (value[0] && value[0].name)
1533
+ // unset attribute if
1534
+ deltaValue = {
1535
+ name: value[0].name
1536
+ };else deltaValue = undefined;
1537
+ var _setAction2 = _buildNewSetProductAttributeAction(deltaValue);
1538
+ if (_setAction2) actions.push(_setAction2);
1539
+ } else {
1540
+ var index = key.substring(1);
1541
+ if (newProductData.attributes) {
1542
+ var _setAction3 = _buildSetProductAttributeAction(value.value, oldProductData, newProductData.attributes[index]);
1543
+ if (_setAction3) actions.push(_setAction3);
1544
+ }
1545
+ }
1546
+ }
1547
+ });
1548
+ return actions;
1549
+ }
1474
1550
  function _buildVariantAttributesActions(attributes, oldVariant, newVariant, sameForAllAttributeNames) {
1475
1551
  var actions = [];
1476
1552
  if (!attributes) return actions;
@@ -1482,8 +1558,8 @@ function _buildVariantAttributesActions(attributes, oldVariant, newVariant, same
1482
1558
  var setAction = _buildNewSetAttributeAction(id, deltaValue, sameForAllAttributeNames);
1483
1559
  if (setAction) actions.push(setAction);
1484
1560
  } else if (newVariant.attributes) {
1485
- var _setAction = _buildSetAttributeAction(value.value, oldVariant, newVariant.attributes[key], sameForAllAttributeNames);
1486
- if (_setAction) actions.push(_setAction);
1561
+ var _setAction4 = _buildSetAttributeAction(value.value, oldVariant, newVariant.attributes[key], sameForAllAttributeNames);
1562
+ if (_setAction4) actions.push(_setAction4);
1487
1563
  }
1488
1564
  } else if (REGEX_UNDERSCORE_NUMBER$2.test(key)) if (Array.isArray(value)) {
1489
1565
  // Ignore pure array moves!
@@ -1495,13 +1571,13 @@ function _buildVariantAttributesActions(attributes, oldVariant, newVariant, same
1495
1571
  _deltaValue = {
1496
1572
  name: value[0].name
1497
1573
  };else _deltaValue = undefined;
1498
- var _setAction2 = _buildNewSetAttributeAction(_id, _deltaValue, sameForAllAttributeNames);
1499
- if (_setAction2) actions.push(_setAction2);
1574
+ var _setAction5 = _buildNewSetAttributeAction(_id, _deltaValue, sameForAllAttributeNames);
1575
+ if (_setAction5) actions.push(_setAction5);
1500
1576
  } else {
1501
1577
  var index = key.substring(1);
1502
1578
  if (newVariant.attributes) {
1503
- var _setAction3 = _buildSetAttributeAction(value.value, oldVariant, newVariant.attributes[index], sameForAllAttributeNames);
1504
- if (_setAction3) actions.push(_setAction3);
1579
+ var _setAction6 = _buildSetAttributeAction(value.value, oldVariant, newVariant.attributes[index], sameForAllAttributeNames);
1580
+ if (_setAction6) actions.push(_setAction6);
1505
1581
  }
1506
1582
  }
1507
1583
  });
@@ -1716,6 +1792,9 @@ function actionsMapAssets(diff, oldObj, newObj, variantHashMap) {
1716
1792
  });
1717
1793
  return allAssetsActions;
1718
1794
  }
1795
+ function actionsMapProductAttributes(diffedProductData, oldProductData, newProductData) {
1796
+ return _buildProductAttributesActions(diffedProductData.attributes, oldProductData, newProductData);
1797
+ }
1719
1798
  function actionsMapAttributes$1(diff, oldObj, newObj) {
1720
1799
  var sameForAllAttributeNames = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
1721
1800
  var variantHashMap = arguments.length > 4 ? arguments[4] : undefined;
@@ -1836,6 +1915,9 @@ function createProductMapActions(mapActionGroup, syncActionConfig) {
1836
1915
  var publish = newObj.publish,
1837
1916
  staged = newObj.staged;
1838
1917
  var variantHashMap = findMatchingPairs(diff.variants, oldObj.variants, newObj.variants);
1918
+ allActions.push(mapActionGroup('productAttributes', function () {
1919
+ return actionsMapProductAttributes(diff, oldObj, newObj);
1920
+ }));
1839
1921
  allActions.push(mapActionGroup('attributes', function () {
1840
1922
  return actionsMapAttributes$1(diff, oldObj, newObj, sameForAllAttributeNames || [], variantHashMap);
1841
1923
  }));
@@ -3793,6 +3875,12 @@ var createCustomerMapActions = function createCustomerMapActions(mapActionGroup,
3793
3875
  allActions.push(mapActionGroup('base', function () {
3794
3876
  return actionsMapBase$1(diff, oldObj, newObj, syncActionConfig);
3795
3877
  }));
3878
+ allActions.push(mapActionGroup('billingAddressIds', function () {
3879
+ return actionsMapRemoveBillingAddresses(diff, oldObj, newObj);
3880
+ }));
3881
+ allActions.push(mapActionGroup('shippingAddressIds', function () {
3882
+ return actionsMapRemoveShippingAddresses(diff, oldObj, newObj);
3883
+ }));
3796
3884
  allActions.push(mapActionGroup('addresses', function () {
3797
3885
  return actionsMapAddresses(diff, oldObj, newObj);
3798
3886
  }));
@@ -3800,10 +3888,10 @@ var createCustomerMapActions = function createCustomerMapActions(mapActionGroup,
3800
3888
  return actionsMapSetDefaultBase(diff, oldObj, newObj, syncActionConfig);
3801
3889
  }));
3802
3890
  allActions.push(mapActionGroup('billingAddressIds', function () {
3803
- return actionsMapBillingAddresses(diff, oldObj, newObj);
3891
+ return actionsMapAddBillingAddresses(diff, oldObj, newObj);
3804
3892
  }));
3805
3893
  allActions.push(mapActionGroup('shippingAddressIds', function () {
3806
- return actionsMapShippingAddresses(diff, oldObj, newObj);
3894
+ return actionsMapAddShippingAddresses(diff, oldObj, newObj);
3807
3895
  }));
3808
3896
  allActions.push(mapActionGroup('associates', function () {
3809
3897
  return actionsMapAssociates(diff, oldObj, newObj);
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "node": ">=18"
7
7
  },
8
8
  "name": "@commercetools/sync-actions",
9
- "version": "7.2.0",
9
+ "version": "7.3.1",
10
10
  "description": "Build API update actions for the commercetools platform.",
11
11
  "keywords": [
12
12
  "commercetools",