@crystaldesign/product-handler 24.13.0-beta.13 → 24.13.0-beta.14

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.
@@ -758,49 +758,55 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
758
758
  */
759
759
  }, {
760
760
  key: "saveProductMedia",
761
- value: function saveProductMedia(productmedia, organizationId) {
761
+ value: function saveProductMedia(productmedia, organizationId, refCount) {
762
762
  return Promise.resolve(undefined);
763
763
  }
764
+ }, {
765
+ key: "saveMedias",
766
+ value: function saveMedias(mediasToSave, organizationId) {
767
+ return Promise.resolve({});
768
+ }
764
769
  }, {
765
770
  key: "prepareData",
766
771
  value: function () {
767
772
  var _prepareData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref12) {
768
773
  var _this3 = this;
769
- var basket, baseData, classificationData, variantData, removedProducts, removedMedia, classificationFields, fieldConfiguration, optMap, _ref12$oldClassificat, oldClassificationData, originProductId, products, originProduct, sapEinaLifNr, sapEineEkgrp, result, _this$closeModal, _originProduct$percen, _originProduct$discou, _baseData$variantId, _originProduct$create, _originProduct$create2, _originProduct$create3, baseProduct, j, mediaRef, _this$openModal, _this$t, _j, _this$openModal2, _this$t2, savedMedia, _loop, _j2;
770
- return _regeneratorRuntime.wrap(function _callee3$(_context4) {
771
- while (1) switch (_context4.prev = _context4.next) {
774
+ var basket, baseData, classificationData, variantData, removedProducts, removedMedia, classificationFields, fieldConfiguration, optMap, _ref12$oldClassificat, oldClassificationData, originProductId, products, originProduct, mediasToSave, sapEinaLifNr, sapEineEkgrp, result, _this$closeModal, _originProduct$percen, _originProduct$discou, _baseData$variantId, _originProduct$create, _originProduct$create2, _originProduct$create3, baseProduct, j, mediaRef, _this$openModal, _this$t, _j, _this$openModal2, _this$t2, _loop, _j2, mediasForProducts, _loop2, productId;
775
+ return _regeneratorRuntime.wrap(function _callee3$(_context5) {
776
+ while (1) switch (_context5.prev = _context5.next) {
772
777
  case 0:
773
778
  basket = _ref12.basket, baseData = _ref12.baseData, classificationData = _ref12.classificationData, variantData = _ref12.variantData, removedProducts = _ref12.removedProducts, removedMedia = _ref12.removedMedia, classificationFields = _ref12.classificationFields, fieldConfiguration = _ref12.fieldConfiguration, optMap = _ref12.optMap, _ref12$oldClassificat = _ref12.oldClassificationData, oldClassificationData = _ref12$oldClassificat === void 0 ? {} : _ref12$oldClassificat, originProductId = _ref12.originProductId;
774
779
  products = [];
775
780
  originProduct = undefined;
781
+ mediasToSave = [];
776
782
  if (!originProductId) {
777
- _context4.next = 15;
783
+ _context5.next = 16;
778
784
  break;
779
785
  }
780
- _context4.next = 6;
786
+ _context5.next = 7;
781
787
  return this.apiGetProductByFilter([{
782
788
  id: '_id',
783
789
  op: 'eq',
784
790
  value: originProductId
785
791
  }], undefined, true);
786
- case 6:
787
- result = _context4.sent;
792
+ case 7:
793
+ result = _context5.sent;
788
794
  originProduct = result.data[0];
789
795
  if (originProduct) {
790
- _context4.next = 10;
796
+ _context5.next = 11;
791
797
  break;
792
798
  }
793
799
  throw new Error('Origin Product not found');
794
- case 10:
800
+ case 11:
795
801
  sapEinaLifNr = originProduct.customData.SAP_EINA_LIFNR.value;
796
802
  sapEineEkgrp = originProduct.customData.SAP_EINE_EKGRP.value;
797
803
  if (!(!sapEinaLifNr || !sapEineEkgrp)) {
798
- _context4.next = 15;
804
+ _context5.next = 16;
799
805
  break;
800
806
  }
801
807
  (_this$closeModal = this.closeModal) === null || _this$closeModal === void 0 || _this$closeModal.call(this);
802
808
  throw new Error('LiefNr or EkGrp not found');
803
- case 15:
809
+ case 16:
804
810
  if (originProduct) {
805
811
  baseData = _objectSpread(_objectSpread(_objectSpread({}, originProduct), baseData), {}, {
806
812
  classificationInfo: originProduct.classificationInfo,
@@ -861,14 +867,14 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
861
867
 
862
868
  //media removed from the products is deleted from the server
863
869
  j = 0;
864
- case 21:
870
+ case 22:
865
871
  if (!(removedMedia && j < removedMedia.length)) {
866
- _context4.next = 30;
872
+ _context5.next = 31;
867
873
  break;
868
874
  }
869
875
  mediaRef = removedMedia[j];
870
876
  if (!mediaRef.ref) {
871
- _context4.next = 27;
877
+ _context5.next = 28;
872
878
  break;
873
879
  }
874
880
  (_this$openModal = this.openModal) === null || _this$openModal === void 0 || _this$openModal.call(this, {
@@ -876,54 +882,29 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
876
882
  title: (_this$t = this.t) === null || _this$t === void 0 ? void 0 : _this$t.call(this, 'productcreator.remove_old_media_refs'),
877
883
  dontRenderForm: true
878
884
  });
879
- _context4.next = 27;
885
+ _context5.next = 28;
880
886
  return this.apiRemoveMedia(this.mediaService, mediaRef.ref, this.jwt);
881
- case 27:
887
+ case 28:
882
888
  j++;
883
- _context4.next = 21;
889
+ _context5.next = 22;
884
890
  break;
885
- case 30:
886
- if (!baseData.media) {
887
- _context4.next = 42;
888
- break;
889
- }
890
- baseProduct.media = [];
891
- _j = 0;
892
- case 33:
893
- if (!(_j < baseData.media.length)) {
894
- _context4.next = 42;
895
- break;
896
- }
897
- //if a new media is added, the file is present in media object and needs to be saved to the server
898
- (_this$openModal2 = this.openModal) === null || _this$openModal2 === void 0 || _this$openModal2.call(this, {
899
- progress: _j / baseData.media.length / 6 + 2 / 6,
900
- title: (_this$t2 = this.t) === null || _this$t2 === void 0 ? void 0 : _this$t2.call(this, 'productcreator.save_media'),
901
- dontRenderForm: true
902
- });
903
- _context4.next = 37;
904
- return this.saveProductMedia(baseData.media[_j], baseProduct.organizationId);
905
- case 37:
906
- savedMedia = _context4.sent;
907
- if (savedMedia) {
908
- baseProduct.media.push(savedMedia);
909
- } else {
910
- //otherwise the file already exists on the server
911
- baseProduct.media.push({
912
- url: baseData.media[_j].url,
913
- thumbnail: baseData.media[_j].thumbnail,
914
- ref: baseData.media[_j].ref,
915
- mediaType: baseData.media[_j].mediaType,
916
- functionType: baseData.media[_j].functionType,
917
- description: baseData.media[_j].description,
918
- name: baseData.media[_j].name,
919
- "class": baseData.media[_j]["class"]
920
- });
891
+ case 31:
892
+ if (baseData.media) {
893
+ baseProduct.media = [];
894
+ for (_j = 0; _j < baseData.media.length; _j++) {
895
+ //if a new media is added, the file is present in media object and needs to be saved to the server
896
+ (_this$openModal2 = this.openModal) === null || _this$openModal2 === void 0 || _this$openModal2.call(this, {
897
+ progress: _j / baseData.media.length / 6 + 2 / 6,
898
+ title: (_this$t2 = this.t) === null || _this$t2 === void 0 ? void 0 : _this$t2.call(this, 'productcreator.save_media'),
899
+ dontRenderForm: true
900
+ });
901
+ mediasToSave.push({
902
+ media: baseData.media[_j],
903
+ id: baseData._id
904
+ });
905
+ }
921
906
  }
922
- case 39:
923
- _j++;
924
- _context4.next = 33;
925
- break;
926
- case 42:
907
+
927
908
  //orderDescription is only needed in FE to display it, it should not be stored to the server
928
909
  delete baseProduct.orderDescription;
929
910
 
@@ -939,7 +920,7 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
939
920
  }
940
921
  _loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop() {
941
922
  var _basket$getProductCon2, _originProduct;
942
- var vd, varinatBase, classData, customData, variantPos, productId, preparedProduct, configuration, product, _this3$openModal, _this3$t, k, _savedMedia;
923
+ var vd, varinatBase, classData, customData, variantPos, productId, preparedProduct, configuration, product, _this3$openModal, _this3$t, k;
943
924
  return _regeneratorRuntime.wrap(function _loop$(_context3) {
944
925
  while (1) switch (_context3.prev = _context3.next) {
945
926
  case 0:
@@ -1070,79 +1051,91 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
1070
1051
  archived: baseProduct.archived ? baseProduct.archived : false,
1071
1052
  uniqueHash: vd.uniqueHash
1072
1053
  });
1073
- if (!vd.media) {
1074
- _context3.next = 28;
1075
- break;
1076
- }
1077
- product.media = [];
1078
- (_this3$openModal = _this3.openModal) === null || _this3$openModal === void 0 || _this3$openModal.call(_this3, {
1079
- progress: _j2 / variantData.length / 6 + 3 / 6,
1080
- title: (_this3$t = _this3.t) === null || _this3$t === void 0 ? void 0 : _this3$t.call(_this3, 'productcreator.save_media_variants'),
1081
- dontRenderForm: true
1082
- });
1083
- k = 0;
1084
- case 20:
1085
- if (!(k < vd.media.length)) {
1086
- _context3.next = 28;
1087
- break;
1088
- }
1089
- _context3.next = 23;
1090
- return _this3.saveProductMedia(vd.media[k], baseProduct.organizationId);
1091
- case 23:
1092
- _savedMedia = _context3.sent;
1093
- if (_savedMedia) {
1094
- product.media.push(_savedMedia);
1095
- } else {
1096
- //otherwise the file already exists on the server
1097
- product.media.push({
1098
- url: vd.media[k].url,
1099
- thumbnail: vd.media[k].thumbnail,
1100
- ref: vd.media[k].ref,
1101
- mediaType: vd.media[k].mediaType,
1102
- functionType: vd.media[k].functionType,
1103
- description: vd.media[k].description,
1104
- name: vd.media[k].name,
1105
- "class": vd.media[k]["class"]
1054
+ if (vd.media) {
1055
+ product.media = [];
1056
+ (_this3$openModal = _this3.openModal) === null || _this3$openModal === void 0 || _this3$openModal.call(_this3, {
1057
+ progress: _j2 / variantData.length / 6 + 3 / 6,
1058
+ title: (_this3$t = _this3.t) === null || _this3$t === void 0 ? void 0 : _this3$t.call(_this3, 'productcreator.save_media_variants'),
1059
+ dontRenderForm: true
1106
1060
  });
1061
+ for (k = 0; k < vd.media.length; k++) {
1062
+ mediasToSave.push({
1063
+ media: vd.media[k],
1064
+ id: vd._id
1065
+ });
1066
+ }
1107
1067
  }
1108
- case 25:
1109
- k++;
1110
- _context3.next = 20;
1111
- break;
1112
- case 28:
1113
1068
  //add the variant product it the list of products to be saved
1114
1069
  products.push(product);
1115
- case 29:
1070
+ case 18:
1116
1071
  case "end":
1117
1072
  return _context3.stop();
1118
1073
  }
1119
1074
  }, _loop);
1120
1075
  });
1121
1076
  _j2 = 0;
1122
- case 47:
1077
+ case 37:
1123
1078
  if (!(variantData && _j2 < variantData.length)) {
1124
- _context4.next = 54;
1079
+ _context5.next = 44;
1125
1080
  break;
1126
1081
  }
1127
- return _context4.delegateYield(_loop(), "t0", 49);
1128
- case 49:
1129
- if (!_context4.t0) {
1130
- _context4.next = 51;
1082
+ return _context5.delegateYield(_loop(), "t0", 39);
1083
+ case 39:
1084
+ if (!_context5.t0) {
1085
+ _context5.next = 41;
1131
1086
  break;
1132
1087
  }
1133
- return _context4.abrupt("continue", 51);
1134
- case 51:
1088
+ return _context5.abrupt("continue", 41);
1089
+ case 41:
1135
1090
  _j2++;
1136
- _context4.next = 47;
1091
+ _context5.next = 37;
1092
+ break;
1093
+ case 44:
1094
+ _context5.next = 46;
1095
+ return this.saveMedias(mediasToSave, baseData.organizationId);
1096
+ case 46:
1097
+ mediasForProducts = _context5.sent;
1098
+ _loop2 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop2(productId) {
1099
+ var p;
1100
+ return _regeneratorRuntime.wrap(function _loop2$(_context4) {
1101
+ while (1) switch (_context4.prev = _context4.next) {
1102
+ case 0:
1103
+ mediasForProducts[productId];
1104
+ p = products.find(function (p) {
1105
+ return p._id == productId;
1106
+ });
1107
+ if (p) {
1108
+ _context4.next = 4;
1109
+ break;
1110
+ }
1111
+ throw Error('Product with id ' + productId + ' not fount during saving');
1112
+ case 4:
1113
+ p.media = mediasForProducts[productId].medias;
1114
+ case 5:
1115
+ case "end":
1116
+ return _context4.stop();
1117
+ }
1118
+ }, _loop2);
1119
+ });
1120
+ _context5.t1 = _regeneratorRuntime.keys(mediasForProducts);
1121
+ case 49:
1122
+ if ((_context5.t2 = _context5.t1()).done) {
1123
+ _context5.next = 54;
1124
+ break;
1125
+ }
1126
+ productId = _context5.t2.value;
1127
+ return _context5.delegateYield(_loop2(productId), "t3", 52);
1128
+ case 52:
1129
+ _context5.next = 49;
1137
1130
  break;
1138
1131
  case 54:
1139
- return _context4.abrupt("return", {
1132
+ return _context5.abrupt("return", {
1140
1133
  products: products,
1141
1134
  removedProducts: removedProducts
1142
1135
  });
1143
1136
  case 55:
1144
1137
  case "end":
1145
- return _context4.stop();
1138
+ return _context5.stop();
1146
1139
  }
1147
1140
  }, _callee3, this);
1148
1141
  }));
@@ -1165,32 +1158,32 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
1165
1158
  value: function () {
1166
1159
  var _saveProducts = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref29) {
1167
1160
  var products, removedProducts, awaitPDF, _this$closeModal2, savedProducts, _this$closeModal3;
1168
- return _regeneratorRuntime.wrap(function _callee4$(_context5) {
1169
- while (1) switch (_context5.prev = _context5.next) {
1161
+ return _regeneratorRuntime.wrap(function _callee4$(_context6) {
1162
+ while (1) switch (_context6.prev = _context6.next) {
1170
1163
  case 0:
1171
1164
  products = _ref29.products, removedProducts = _ref29.removedProducts, awaitPDF = _ref29.awaitPDF;
1172
1165
  if (this.jwt) {
1173
- _context5.next = 3;
1166
+ _context6.next = 3;
1174
1167
  break;
1175
1168
  }
1176
1169
  throw new Error('jwt not set');
1177
1170
  case 3:
1178
1171
  this.setFirstVariant(products);
1179
- _context5.prev = 4;
1180
- _context5.next = 7;
1172
+ _context6.prev = 4;
1173
+ _context6.next = 7;
1181
1174
  return this.apiSaveProducts(this.catalogService, this.jwt, products, awaitPDF, removedProducts);
1182
1175
  case 7:
1183
- savedProducts = _context5.sent;
1176
+ savedProducts = _context6.sent;
1184
1177
  (_this$closeModal2 = this.closeModal) === null || _this$closeModal2 === void 0 || _this$closeModal2.call(this);
1185
- return _context5.abrupt("return", savedProducts);
1178
+ return _context6.abrupt("return", savedProducts);
1186
1179
  case 12:
1187
- _context5.prev = 12;
1188
- _context5.t0 = _context5["catch"](4);
1180
+ _context6.prev = 12;
1181
+ _context6.t0 = _context6["catch"](4);
1189
1182
  (_this$closeModal3 = this.closeModal) === null || _this$closeModal3 === void 0 || _this$closeModal3.call(this);
1190
- throw new Error(_context5.t0.message);
1183
+ throw new Error(_context6.t0.message);
1191
1184
  case 16:
1192
1185
  case "end":
1193
- return _context5.stop();
1186
+ return _context6.stop();
1194
1187
  }
1195
1188
  }, _callee4, this, [[4, 12]]);
1196
1189
  }));
@@ -1528,35 +1521,35 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
1528
1521
  value: function () {
1529
1522
  var _apiRemoveMedia = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(serviceUrl, ref, jwt) {
1530
1523
  var url, response;
1531
- return _regeneratorRuntime.wrap(function _callee5$(_context6) {
1532
- while (1) switch (_context6.prev = _context6.next) {
1524
+ return _regeneratorRuntime.wrap(function _callee5$(_context7) {
1525
+ while (1) switch (_context7.prev = _context7.next) {
1533
1526
  case 0:
1534
1527
  url = new URL("".concat(serviceUrl, "/v1/mediaitems/refs/") + ref);
1535
- _context6.prev = 1;
1536
- _context6.next = 4;
1528
+ _context7.prev = 1;
1529
+ _context7.next = 4;
1537
1530
  return axios["delete"](url.toString(), {
1538
1531
  headers: _objectSpread(_objectSpread({}, this.getHeaders()), {}, {
1539
1532
  'Content-Type': 'application/json'
1540
1533
  })
1541
1534
  });
1542
1535
  case 4:
1543
- response = _context6.sent;
1536
+ response = _context7.sent;
1544
1537
  if (!((response === null || response === void 0 ? void 0 : response.status) == 200)) {
1545
- _context6.next = 7;
1538
+ _context7.next = 7;
1546
1539
  break;
1547
1540
  }
1548
- return _context6.abrupt("return", response.data);
1541
+ return _context7.abrupt("return", response.data);
1549
1542
  case 7:
1550
1543
  throw new Error('Could not remove Media');
1551
1544
  case 10:
1552
- _context6.prev = 10;
1553
- _context6.t0 = _context6["catch"](1);
1545
+ _context7.prev = 10;
1546
+ _context7.t0 = _context7["catch"](1);
1554
1547
  throw new Error('Could not remove Media', {
1555
- cause: _context6.t0
1548
+ cause: _context7.t0
1556
1549
  });
1557
1550
  case 13:
1558
1551
  case "end":
1559
- return _context6.stop();
1552
+ return _context7.stop();
1560
1553
  }
1561
1554
  }, _callee5, this, [[1, 10]]);
1562
1555
  }));
@@ -1585,34 +1578,34 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
1585
1578
  var _apiGetProducts = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(divanrOrID) {
1586
1579
  var _res;
1587
1580
  var fullUrl, res, resData;
1588
- return _regeneratorRuntime.wrap(function _callee6$(_context7) {
1589
- while (1) switch (_context7.prev = _context7.next) {
1581
+ return _regeneratorRuntime.wrap(function _callee6$(_context8) {
1582
+ while (1) switch (_context8.prev = _context8.next) {
1590
1583
  case 0:
1591
1584
  fullUrl = this.catalogService + '/v1/products/' + divanrOrID + '/list';
1592
- _context7.prev = 1;
1593
- _context7.next = 4;
1585
+ _context8.prev = 1;
1586
+ _context8.next = 4;
1594
1587
  return axios.get(fullUrl, {
1595
1588
  headers: _objectSpread(_objectSpread({}, this.getHeaders()), {}, {
1596
1589
  'Content-Type': 'application/json'
1597
1590
  })
1598
1591
  });
1599
1592
  case 4:
1600
- res = _context7.sent;
1601
- _context7.next = 7;
1593
+ res = _context8.sent;
1594
+ _context8.next = 7;
1602
1595
  return res.data;
1603
1596
  case 7:
1604
- resData = _context7.sent;
1605
- _context7.next = 13;
1597
+ resData = _context8.sent;
1598
+ _context8.next = 13;
1606
1599
  break;
1607
1600
  case 10:
1608
- _context7.prev = 10;
1609
- _context7.t0 = _context7["catch"](1);
1601
+ _context8.prev = 10;
1602
+ _context8.t0 = _context8["catch"](1);
1610
1603
  throw new Error('Could not get existing products', {
1611
- cause: _context7.t0
1604
+ cause: _context8.t0
1612
1605
  });
1613
1606
  case 13:
1614
1607
  if (!(((_res = res) === null || _res === void 0 ? void 0 : _res.status) == 200)) {
1615
- _context7.next = 16;
1608
+ _context8.next = 16;
1616
1609
  break;
1617
1610
  }
1618
1611
  //in order to be backwardscompatible we must transform old products here
@@ -1625,12 +1618,12 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
1625
1618
  }
1626
1619
  return d;
1627
1620
  });
1628
- return _context7.abrupt("return", resData);
1621
+ return _context8.abrupt("return", resData);
1629
1622
  case 16:
1630
1623
  throw new Error(resData.error);
1631
1624
  case 17:
1632
1625
  case "end":
1633
- return _context7.stop();
1626
+ return _context8.stop();
1634
1627
  }
1635
1628
  }, _callee6, this, [[1, 10]]);
1636
1629
  }));
@@ -1645,21 +1638,21 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
1645
1638
  var _apiGetCatalogData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(catalogCodex, catalogId, language, accountId) {
1646
1639
  var _response$CollectionG, _response$Properties, _response$Properties2;
1647
1640
  var currentAccountSessionId, fullUrl, response, actCatalogInfoData;
1648
- return _regeneratorRuntime.wrap(function _callee7$(_context8) {
1649
- while (1) switch (_context8.prev = _context8.next) {
1641
+ return _regeneratorRuntime.wrap(function _callee7$(_context9) {
1642
+ while (1) switch (_context9.prev = _context9.next) {
1650
1643
  case 0:
1651
- _context8.next = 2;
1644
+ _context9.next = 2;
1652
1645
  return this.apiAccountLogin(accountId, catalogId);
1653
1646
  case 2:
1654
- currentAccountSessionId = _context8.sent;
1647
+ currentAccountSessionId = _context9.sent;
1655
1648
  if (currentAccountSessionId) {
1656
- _context8.next = 5;
1649
+ _context9.next = 5;
1657
1650
  break;
1658
1651
  }
1659
- return _context8.abrupt("return");
1652
+ return _context9.abrupt("return");
1660
1653
  case 5:
1661
1654
  fullUrl = this.api2 + '?function=GetJsonCatalogData' + '&catalogCodex=' + catalogCodex + '&IncludeVariantValues=True&lang=' + language.toLocaleUpperCase();
1662
- _context8.next = 8;
1655
+ _context9.next = 8;
1663
1656
  return fetch(fullUrl, {
1664
1657
  headers: {
1665
1658
  sessionGuid: currentAccountSessionId
@@ -1671,9 +1664,9 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
1671
1664
  return res.json();
1672
1665
  });
1673
1666
  case 8:
1674
- response = _context8.sent;
1667
+ response = _context9.sent;
1675
1668
  if (!response.Error) {
1676
- _context8.next = 11;
1669
+ _context9.next = 11;
1677
1670
  break;
1678
1671
  }
1679
1672
  throw new Error(response.Error);
@@ -1706,10 +1699,10 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
1706
1699
  return p.Codex == 'DIVA3D_AR_READY';
1707
1700
  })) !== null && _response$Properties2 !== void 0 && _response$Properties2.Value)
1708
1701
  };
1709
- return _context8.abrupt("return", actCatalogInfoData);
1702
+ return _context9.abrupt("return", actCatalogInfoData);
1710
1703
  case 13:
1711
1704
  case "end":
1712
- return _context8.stop();
1705
+ return _context9.stop();
1713
1706
  }
1714
1707
  }, _callee7, this);
1715
1708
  }));
@@ -1723,63 +1716,63 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
1723
1716
  value: function () {
1724
1717
  var _apiAccountLogin = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(accountId, catalogId) {
1725
1718
  var fullUrl, response, fallbackUrl, fallbackResponse;
1726
- return _regeneratorRuntime.wrap(function _callee8$(_context9) {
1727
- while (1) switch (_context9.prev = _context9.next) {
1719
+ return _regeneratorRuntime.wrap(function _callee8$(_context10) {
1720
+ while (1) switch (_context10.prev = _context10.next) {
1728
1721
  case 0:
1729
1722
  fullUrl = this.api2 + '?function=JsonAccountLogin&UserRole=v&accountGuid=' + accountId;
1730
- _context9.t0 = fetch;
1731
- _context9.t1 = fullUrl;
1732
- _context9.next = 5;
1723
+ _context10.t0 = fetch;
1724
+ _context10.t1 = fullUrl;
1725
+ _context10.next = 5;
1733
1726
  return this.sessionGuid;
1734
1727
  case 5:
1735
- _context9.t2 = _context9.sent;
1736
- _context9.t3 = {
1737
- sessionGuid: _context9.t2
1728
+ _context10.t2 = _context10.sent;
1729
+ _context10.t3 = {
1730
+ sessionGuid: _context10.t2
1738
1731
  };
1739
- _context9.t4 = {
1740
- headers: _context9.t3
1732
+ _context10.t4 = {
1733
+ headers: _context10.t3
1741
1734
  };
1742
- _context9.next = 10;
1743
- return (0, _context9.t0)(_context9.t1, _context9.t4).then(function (res) {
1735
+ _context10.next = 10;
1736
+ return (0, _context10.t0)(_context10.t1, _context10.t4).then(function (res) {
1744
1737
  if (res.status !== 200) {
1745
1738
  throw new Error('Collections not loaded.');
1746
1739
  }
1747
1740
  return res.json();
1748
1741
  });
1749
1742
  case 10:
1750
- response = _context9.sent;
1743
+ response = _context10.sent;
1751
1744
  if (!response.SessionGUID) {
1752
- _context9.next = 13;
1745
+ _context10.next = 13;
1753
1746
  break;
1754
1747
  }
1755
- return _context9.abrupt("return", response.SessionGUID);
1748
+ return _context10.abrupt("return", response.SessionGUID);
1756
1749
  case 13:
1757
1750
  fallbackUrl = this.api2 + '?function=JsonAccountLogin&UserRole=v&catalogGuid=' + catalogId;
1758
- _context9.t5 = fetch;
1759
- _context9.t6 = fallbackUrl;
1760
- _context9.next = 18;
1751
+ _context10.t5 = fetch;
1752
+ _context10.t6 = fallbackUrl;
1753
+ _context10.next = 18;
1761
1754
  return this.sessionGuid;
1762
1755
  case 18:
1763
- _context9.t7 = _context9.sent;
1764
- _context9.t8 = {
1765
- sessionGuid: _context9.t7
1756
+ _context10.t7 = _context10.sent;
1757
+ _context10.t8 = {
1758
+ sessionGuid: _context10.t7
1766
1759
  };
1767
- _context9.t9 = {
1768
- headers: _context9.t8
1760
+ _context10.t9 = {
1761
+ headers: _context10.t8
1769
1762
  };
1770
- _context9.next = 23;
1771
- return (0, _context9.t5)(_context9.t6, _context9.t9).then(function (res) {
1763
+ _context10.next = 23;
1764
+ return (0, _context10.t5)(_context10.t6, _context10.t9).then(function (res) {
1772
1765
  if (res.status !== 200) {
1773
1766
  throw new Error('Collections not loaded.');
1774
1767
  }
1775
1768
  return res.json();
1776
1769
  });
1777
1770
  case 23:
1778
- fallbackResponse = _context9.sent;
1779
- return _context9.abrupt("return", fallbackResponse.SessionGUID);
1771
+ fallbackResponse = _context10.sent;
1772
+ return _context10.abrupt("return", fallbackResponse.SessionGUID);
1780
1773
  case 25:
1781
1774
  case "end":
1782
- return _context9.stop();
1775
+ return _context10.stop();
1783
1776
  }
1784
1777
  }, _callee8, this);
1785
1778
  }));
@@ -1794,42 +1787,42 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
1794
1787
  var _apiGetProductVariants = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(id, full) {
1795
1788
  var _res2;
1796
1789
  var fullUrl, res, resData;
1797
- return _regeneratorRuntime.wrap(function _callee9$(_context10) {
1798
- while (1) switch (_context10.prev = _context10.next) {
1790
+ return _regeneratorRuntime.wrap(function _callee9$(_context11) {
1791
+ while (1) switch (_context11.prev = _context11.next) {
1799
1792
  case 0:
1800
1793
  fullUrl = this.catalogService + '/v1/products/' + id + '/variants' + (full ? '?full=true' : '');
1801
- _context10.prev = 1;
1802
- _context10.next = 4;
1794
+ _context11.prev = 1;
1795
+ _context11.next = 4;
1803
1796
  return axios.get(fullUrl, {
1804
1797
  headers: _objectSpread(_objectSpread({}, this.getHeaders()), {}, {
1805
1798
  'Content-Type': 'application/json'
1806
1799
  })
1807
1800
  });
1808
1801
  case 4:
1809
- res = _context10.sent;
1810
- _context10.next = 7;
1802
+ res = _context11.sent;
1803
+ _context11.next = 7;
1811
1804
  return res.data;
1812
1805
  case 7:
1813
- resData = _context10.sent;
1814
- _context10.next = 13;
1806
+ resData = _context11.sent;
1807
+ _context11.next = 13;
1815
1808
  break;
1816
1809
  case 10:
1817
- _context10.prev = 10;
1818
- _context10.t0 = _context10["catch"](1);
1810
+ _context11.prev = 10;
1811
+ _context11.t0 = _context11["catch"](1);
1819
1812
  throw new Error('Could not get existing products', {
1820
- cause: _context10.t0
1813
+ cause: _context11.t0
1821
1814
  });
1822
1815
  case 13:
1823
1816
  if (!(((_res2 = res) === null || _res2 === void 0 ? void 0 : _res2.status) == 200)) {
1824
- _context10.next = 15;
1817
+ _context11.next = 15;
1825
1818
  break;
1826
1819
  }
1827
- return _context10.abrupt("return", resData);
1820
+ return _context11.abrupt("return", resData);
1828
1821
  case 15:
1829
1822
  throw new Error(resData.error);
1830
1823
  case 16:
1831
1824
  case "end":
1832
- return _context10.stop();
1825
+ return _context11.stop();
1833
1826
  }
1834
1827
  }, _callee9, this, [[1, 10]]);
1835
1828
  }));
@@ -1850,39 +1843,39 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
1850
1843
  res,
1851
1844
  resData,
1852
1845
  filterParam,
1853
- _args11 = arguments;
1854
- return _regeneratorRuntime.wrap(function _callee10$(_context11) {
1855
- while (1) switch (_context11.prev = _context11.next) {
1846
+ _args12 = arguments;
1847
+ return _regeneratorRuntime.wrap(function _callee10$(_context12) {
1848
+ while (1) switch (_context12.prev = _context12.next) {
1856
1849
  case 0:
1857
- limit = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : 1;
1858
- useFilter = _args11.length > 2 ? _args11[2] : undefined;
1859
- hierarchy = _args11.length > 3 ? _args11[3] : undefined;
1850
+ limit = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : 1;
1851
+ useFilter = _args12.length > 2 ? _args12[2] : undefined;
1852
+ hierarchy = _args12.length > 3 ? _args12[3] : undefined;
1860
1853
  fullUrl = this.catalogService + '/v1/products';
1861
- _context11.prev = 4;
1854
+ _context12.prev = 4;
1862
1855
  filterParam = useFilter ? 'filter' : 'search';
1863
- _context11.next = 8;
1856
+ _context12.next = 8;
1864
1857
  return axios.get("".concat(fullUrl, "?organizationIds=").concat(this.organization._id, "&").concat(filterParam, "=").concat(encodeURIComponent(this.parseFilter(filter)), "&limit=").concat(limit, "&hierarchy=").concat(hierarchy !== null && hierarchy !== void 0 ? hierarchy : false), {
1865
1858
  headers: _objectSpread(_objectSpread({}, this.getHeaders()), {}, {
1866
1859
  'Content-Type': 'application/json'
1867
1860
  })
1868
1861
  });
1869
1862
  case 8:
1870
- res = _context11.sent;
1871
- _context11.next = 11;
1863
+ res = _context12.sent;
1864
+ _context12.next = 11;
1872
1865
  return res.data;
1873
1866
  case 11:
1874
- resData = _context11.sent;
1875
- _context11.next = 17;
1867
+ resData = _context12.sent;
1868
+ _context12.next = 17;
1876
1869
  break;
1877
1870
  case 14:
1878
- _context11.prev = 14;
1879
- _context11.t0 = _context11["catch"](4);
1871
+ _context12.prev = 14;
1872
+ _context12.t0 = _context12["catch"](4);
1880
1873
  throw new Error('Could not get existing products', {
1881
- cause: _context11.t0
1874
+ cause: _context12.t0
1882
1875
  });
1883
1876
  case 17:
1884
1877
  if (!(((_res3 = res) === null || _res3 === void 0 ? void 0 : _res3.status) == 200)) {
1885
- _context11.next = 20;
1878
+ _context12.next = 20;
1886
1879
  break;
1887
1880
  }
1888
1881
  //in order to be backwardscompatible we must transform old products here
@@ -1895,12 +1888,12 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
1895
1888
  }
1896
1889
  return d;
1897
1890
  });
1898
- return _context11.abrupt("return", resData);
1891
+ return _context12.abrupt("return", resData);
1899
1892
  case 20:
1900
1893
  throw new Error(resData.error);
1901
1894
  case 21:
1902
1895
  case "end":
1903
- return _context11.stop();
1896
+ return _context12.stop();
1904
1897
  }
1905
1898
  }, _callee10, this, [[4, 14]]);
1906
1899
  }));
@@ -1915,43 +1908,43 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
1915
1908
  var _apiActivateProduct = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11(id, organizationId) {
1916
1909
  var _res4;
1917
1910
  var fullUrl, res, resData;
1918
- return _regeneratorRuntime.wrap(function _callee11$(_context12) {
1919
- while (1) switch (_context12.prev = _context12.next) {
1911
+ return _regeneratorRuntime.wrap(function _callee11$(_context13) {
1912
+ while (1) switch (_context13.prev = _context13.next) {
1920
1913
  case 0:
1921
1914
  fullUrl = new URL(this.catalogService + '/v1/products/' + id + '/activate');
1922
1915
  fullUrl.searchParams.append('organizationId', organizationId);
1923
- _context12.prev = 2;
1924
- _context12.next = 5;
1916
+ _context13.prev = 2;
1917
+ _context13.next = 5;
1925
1918
  return axios.post(fullUrl.toString(), undefined, {
1926
1919
  headers: _objectSpread(_objectSpread({}, this.getHeaders()), {}, {
1927
1920
  'Content-Type': 'application/json'
1928
1921
  })
1929
1922
  });
1930
1923
  case 5:
1931
- res = _context12.sent;
1932
- _context12.next = 8;
1924
+ res = _context13.sent;
1925
+ _context13.next = 8;
1933
1926
  return res.data;
1934
1927
  case 8:
1935
- resData = _context12.sent;
1936
- _context12.next = 14;
1928
+ resData = _context13.sent;
1929
+ _context13.next = 14;
1937
1930
  break;
1938
1931
  case 11:
1939
- _context12.prev = 11;
1940
- _context12.t0 = _context12["catch"](2);
1932
+ _context13.prev = 11;
1933
+ _context13.t0 = _context13["catch"](2);
1941
1934
  throw new Error('Error on activate product', {
1942
- cause: _context12.t0
1935
+ cause: _context13.t0
1943
1936
  });
1944
1937
  case 14:
1945
1938
  if (!(((_res4 = res) === null || _res4 === void 0 ? void 0 : _res4.status) == 200)) {
1946
- _context12.next = 16;
1939
+ _context13.next = 16;
1947
1940
  break;
1948
1941
  }
1949
- return _context12.abrupt("return", resData);
1942
+ return _context13.abrupt("return", resData);
1950
1943
  case 16:
1951
1944
  throw new Error(resData.error);
1952
1945
  case 17:
1953
1946
  case "end":
1954
- return _context12.stop();
1947
+ return _context13.stop();
1955
1948
  }
1956
1949
  }, _callee11, this, [[2, 11]]);
1957
1950
  }));
@@ -1965,8 +1958,8 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
1965
1958
  value: function () {
1966
1959
  var _apiDeleteProducts = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12(products) {
1967
1960
  var fullUrl, headers, productsInChunks, i, _this$openModal3, _this$t3, promises;
1968
- return _regeneratorRuntime.wrap(function _callee12$(_context13) {
1969
- while (1) switch (_context13.prev = _context13.next) {
1961
+ return _regeneratorRuntime.wrap(function _callee12$(_context14) {
1962
+ while (1) switch (_context14.prev = _context14.next) {
1970
1963
  case 0:
1971
1964
  fullUrl = this.catalogService + '/products';
1972
1965
  fullUrl = "".concat(fullUrl, "?organizationId=").concat(this.organization._id);
@@ -1977,7 +1970,7 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
1977
1970
  i = 0;
1978
1971
  case 5:
1979
1972
  if (!(i < productsInChunks.length)) {
1980
- _context13.next = 13;
1973
+ _context14.next = 13;
1981
1974
  break;
1982
1975
  }
1983
1976
  promises = productsInChunks[i].map(function (p) {
@@ -1999,15 +1992,15 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
1999
1992
  title: (_this$t3 = this.t) === null || _this$t3 === void 0 ? void 0 : _this$t3.call(this, 'productcreator.delete_old_products'),
2000
1993
  dontRenderForm: true
2001
1994
  });
2002
- _context13.next = 10;
1995
+ _context14.next = 10;
2003
1996
  return Promise.all(promises);
2004
1997
  case 10:
2005
1998
  i++;
2006
- _context13.next = 5;
1999
+ _context14.next = 5;
2007
2000
  break;
2008
2001
  case 13:
2009
2002
  case "end":
2010
- return _context13.stop();
2003
+ return _context14.stop();
2011
2004
  }
2012
2005
  }, _callee12, this);
2013
2006
  }));
@@ -2030,8 +2023,8 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
2030
2023
  value: function () {
2031
2024
  var _apiLoadProductVariantsGrouped = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref46) {
2032
2025
  var limit, skip, fields, _ref46$search, search, sort, abortController, fullUrl, headers, promise;
2033
- return _regeneratorRuntime.wrap(function _callee13$(_context14) {
2034
- while (1) switch (_context14.prev = _context14.next) {
2026
+ return _regeneratorRuntime.wrap(function _callee13$(_context15) {
2027
+ while (1) switch (_context15.prev = _context15.next) {
2035
2028
  case 0:
2036
2029
  limit = _ref46.limit, skip = _ref46.skip, fields = _ref46.fields, _ref46$search = _ref46.search, search = _ref46$search === void 0 ? [] : _ref46$search, sort = _ref46.sort, _ref46.showAllProducts, abortController = _ref46.abortController;
2037
2030
  fullUrl = this.catalogService + '/v1/products/groups' + '?organizationId=' + this.organization._id + (this._organization.parentOrganizationIds ? '&parentOrganizationIds=' + this._organization.parentOrganizationIds.join(',') : '') + (limit ? '&limit=' + limit : '') + (skip ? '&skip=' + skip : '') + (fields ? '&fileds=' + DivaUtils.fixedEncodeURIComponent('{' + fields.join(',') + '}') : '') + (search ? '&search=' + DivaUtils.fixedEncodeURIComponent(this.parseFilter(search)) : '') + (sort ? '&sort=' + DivaUtils.fixedEncodeURIComponent(sort) : '');
@@ -2055,13 +2048,13 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
2055
2048
  reject('Error loading products grouped by variants: ' + error.message);
2056
2049
  });
2057
2050
  });
2058
- _context14.next = 7;
2051
+ _context15.next = 7;
2059
2052
  return promise;
2060
2053
  case 7:
2061
- return _context14.abrupt("return", _context14.sent);
2054
+ return _context15.abrupt("return", _context15.sent);
2062
2055
  case 8:
2063
2056
  case "end":
2064
- return _context14.stop();
2057
+ return _context15.stop();
2065
2058
  }
2066
2059
  }, _callee13, this);
2067
2060
  }));
@@ -2074,9 +2067,9 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
2074
2067
  key: "apiSaveProducts",
2075
2068
  value: function () {
2076
2069
  var _apiSaveProducts = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14(serverUrl, jwt, products, awaitPDF, removedProductIds) {
2077
- var fullUrl, response, status, BATCH_SIZE, productsPackages, groupIndex, baseProduct, i, _productsPackages$gro, _productsPackages$gro2, responseProducts, _i2, _loop2, j;
2078
- return _regeneratorRuntime.wrap(function _callee14$(_context16) {
2079
- while (1) switch (_context16.prev = _context16.next) {
2070
+ var fullUrl, response, status, BATCH_SIZE, productsPackages, groupIndex, baseProduct, i, _productsPackages$gro, _productsPackages$gro2, responseProducts, _i2, _loop3, j;
2071
+ return _regeneratorRuntime.wrap(function _callee14$(_context17) {
2072
+ while (1) switch (_context17.prev = _context17.next) {
2080
2073
  case 0:
2081
2074
  fullUrl = serverUrl + '/v1/products/groups';
2082
2075
  BATCH_SIZE = 40;
@@ -2085,34 +2078,34 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
2085
2078
  i = 0;
2086
2079
  case 5:
2087
2080
  if (!(i < products.length)) {
2088
- _context16.next = 15;
2081
+ _context17.next = 15;
2089
2082
  break;
2090
2083
  }
2091
2084
  if (!products[i].baseProduct) {
2092
- _context16.next = 9;
2085
+ _context17.next = 9;
2093
2086
  break;
2094
2087
  }
2095
2088
  baseProduct = products[i];
2096
- return _context16.abrupt("continue", 12);
2089
+ return _context17.abrupt("continue", 12);
2097
2090
  case 9:
2098
2091
  if (BATCH_SIZE < ((_productsPackages$gro = (_productsPackages$gro2 = productsPackages[groupIndex]) === null || _productsPackages$gro2 === void 0 ? void 0 : _productsPackages$gro2.length) !== null && _productsPackages$gro !== void 0 ? _productsPackages$gro : 0)) groupIndex++;
2099
2092
  if (!productsPackages[groupIndex]) productsPackages[groupIndex] = [];
2100
2093
  productsPackages[groupIndex].push(products[i]);
2101
2094
  case 12:
2102
2095
  i++;
2103
- _context16.next = 5;
2096
+ _context17.next = 5;
2104
2097
  break;
2105
2098
  case 15:
2106
2099
  responseProducts = [];
2107
2100
  _i2 = 0;
2108
2101
  case 17:
2109
2102
  if (!(_i2 < productsPackages.length)) {
2110
- _context16.next = 40;
2103
+ _context17.next = 40;
2111
2104
  break;
2112
2105
  }
2113
2106
  if (baseProduct) productsPackages[_i2].unshift(baseProduct);
2114
- _context16.prev = 19;
2115
- _context16.next = 22;
2107
+ _context17.prev = 19;
2108
+ _context17.next = 22;
2116
2109
  return fetch(fullUrl, {
2117
2110
  method: 'PUT',
2118
2111
  headers: {
@@ -2132,23 +2125,23 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
2132
2125
  return res.json();
2133
2126
  });
2134
2127
  case 22:
2135
- response = _context16.sent;
2128
+ response = _context17.sent;
2136
2129
  if (!response.Error) {
2137
- _context16.next = 25;
2130
+ _context17.next = 25;
2138
2131
  break;
2139
2132
  }
2140
2133
  throw new Error('Error saving Basket and Products. serverError: ' + response.Error);
2141
2134
  case 25:
2142
- _context16.next = 30;
2135
+ _context17.next = 30;
2143
2136
  break;
2144
2137
  case 27:
2145
- _context16.prev = 27;
2146
- _context16.t0 = _context16["catch"](19);
2138
+ _context17.prev = 27;
2139
+ _context17.t0 = _context17["catch"](19);
2147
2140
  throw Error(status);
2148
2141
  case 30:
2149
- _loop2 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop2(j) {
2150
- return _regeneratorRuntime.wrap(function _loop2$(_context15) {
2151
- while (1) switch (_context15.prev = _context15.next) {
2142
+ _loop3 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop3(j) {
2143
+ return _regeneratorRuntime.wrap(function _loop3$(_context16) {
2144
+ while (1) switch (_context16.prev = _context16.next) {
2152
2145
  case 0:
2153
2146
  if (response.products[j].baseProduct) baseProduct = response.products[j];
2154
2147
  if (!responseProducts.find(function (p) {
@@ -2158,30 +2151,30 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
2158
2151
  }
2159
2152
  case 2:
2160
2153
  case "end":
2161
- return _context15.stop();
2154
+ return _context16.stop();
2162
2155
  }
2163
- }, _loop2);
2156
+ }, _loop3);
2164
2157
  });
2165
2158
  j = 0;
2166
2159
  case 32:
2167
2160
  if (!(j < response.products.length)) {
2168
- _context16.next = 37;
2161
+ _context17.next = 37;
2169
2162
  break;
2170
2163
  }
2171
- return _context16.delegateYield(_loop2(j), "t1", 34);
2164
+ return _context17.delegateYield(_loop3(j), "t1", 34);
2172
2165
  case 34:
2173
2166
  j++;
2174
- _context16.next = 32;
2167
+ _context17.next = 32;
2175
2168
  break;
2176
2169
  case 37:
2177
2170
  _i2++;
2178
- _context16.next = 17;
2171
+ _context17.next = 17;
2179
2172
  break;
2180
2173
  case 40:
2181
- return _context16.abrupt("return", responseProducts);
2174
+ return _context17.abrupt("return", responseProducts);
2182
2175
  case 41:
2183
2176
  case "end":
2184
- return _context16.stop();
2177
+ return _context17.stop();
2185
2178
  }
2186
2179
  }, _callee14, null, [[19, 27]]);
2187
2180
  }));
@@ -2235,7 +2228,7 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
2235
2228
  return true;
2236
2229
  }
2237
2230
  var orderlines = (_product$configuratio2 = (_product$configuratio3 = product.configuration) === null || _product$configuratio3 === void 0 ? void 0 : _product$configuratio3.OrderSets[0].OrderLines) !== null && _product$configuratio2 !== void 0 ? _product$configuratio2 : [];
2238
- var _loop3 = function _loop3() {
2231
+ var _loop4 = function _loop4() {
2239
2232
  var article = orderlines[i];
2240
2233
  var orderLine = orderLines.find(function (ol) {
2241
2234
  return ol.ArticleCodex == article.ArticleCodex && catalogCodex == article.CatalogCodex;
@@ -2246,7 +2239,7 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
2246
2239
  };
2247
2240
  }
2248
2241
  if (article.VariantBasketDatas.length) {
2249
- var _loop4 = function _loop4() {
2242
+ var _loop5 = function _loop5() {
2250
2243
  var varinatValue = article.VariantBasketDatas[j];
2251
2244
  if (!varinatData.find(function (vb) {
2252
2245
  return vb.OPT == varinatValue['OPT'] && vb.OPV == varinatValue['OPV'];
@@ -2260,14 +2253,14 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
2260
2253
  },
2261
2254
  _ret2;
2262
2255
  for (var j = 0; j < article.VariantBasketDatas.length; j++) {
2263
- _ret2 = _loop4();
2256
+ _ret2 = _loop5();
2264
2257
  if (_ret2) return _ret2.v;
2265
2258
  }
2266
2259
  }
2267
2260
  },
2268
2261
  _ret;
2269
2262
  for (var i = 0; i < orderlines.length; i++) {
2270
- _ret = _loop3();
2263
+ _ret = _loop4();
2271
2264
  if (_ret) return _ret.v;
2272
2265
  }
2273
2266
  return true;
@@ -2345,7 +2338,7 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
2345
2338
  //calculate defaultShortDescription from template string
2346
2339
  var shortDescriptionTemplate = (_configurationData$sh = configurationData === null || configurationData === void 0 ? void 0 : configurationData.shortDescription) !== null && _configurationData$sh !== void 0 ? _configurationData$sh : '${modelName} ${subCategory} ${mainColor}';
2347
2340
  var parts = shortDescriptionTemplate.split(/\${|}/);
2348
- var _loop5 = function _loop5() {
2341
+ var _loop6 = function _loop6() {
2349
2342
  var _classificationConfig2, _classificationConfig4, _value;
2350
2343
  var field = parts[i];
2351
2344
  var value;
@@ -2377,7 +2370,7 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
2377
2370
  shortDescriptionTemplate = shortDescriptionTemplate.replace("${".concat(field, "}"), (_value = value) !== null && _value !== void 0 ? _value : '');
2378
2371
  };
2379
2372
  for (var i = 1; i < parts.length; i = i + 2) {
2380
- _loop5();
2373
+ _loop6();
2381
2374
  }
2382
2375
 
2383
2376
  //as long as shortDescription is not modified by user, autocalc it
@@ -2412,8 +2405,8 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
2412
2405
  value: function () {
2413
2406
  var _loadSelectOptions = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15(sessionGuid, dataSource, additionalFilter) {
2414
2407
  var values, apiUrl, i, apiResult, _i3, value, text;
2415
- return _regeneratorRuntime.wrap(function _callee15$(_context17) {
2416
- while (1) switch (_context17.prev = _context17.next) {
2408
+ return _regeneratorRuntime.wrap(function _callee15$(_context18) {
2409
+ while (1) switch (_context18.prev = _context18.next) {
2417
2410
  case 0:
2418
2411
  values = [];
2419
2412
  apiUrl = dataSource.url;
@@ -2422,7 +2415,7 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
2422
2415
  apiUrl += '&' + additionalFilter[i].key + '=' + additionalFilter[i].value;
2423
2416
  }
2424
2417
  }
2425
- _context17.next = 5;
2418
+ _context18.next = 5;
2426
2419
  return fetch(apiUrl, {
2427
2420
  headers: {
2428
2421
  sessionGuid: sessionGuid
@@ -2434,7 +2427,7 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
2434
2427
  return res.json();
2435
2428
  });
2436
2429
  case 5:
2437
- apiResult = _context17.sent;
2430
+ apiResult = _context18.sent;
2438
2431
  if (dataSource.useKey) {
2439
2432
  apiResult = apiResult[dataSource.useKey];
2440
2433
  }
@@ -2446,10 +2439,10 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
2446
2439
  text: text
2447
2440
  });
2448
2441
  }
2449
- return _context17.abrupt("return", values);
2442
+ return _context18.abrupt("return", values);
2450
2443
  case 9:
2451
2444
  case "end":
2452
- return _context17.stop();
2445
+ return _context18.stop();
2453
2446
  }
2454
2447
  }, _callee15);
2455
2448
  }));
@@ -2470,7 +2463,7 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
2470
2463
  key: "getVariantBasketDatasByOrderlines",
2471
2464
  value: function getVariantBasketDatasByOrderlines(orderLines, catalogData) {
2472
2465
  var variantBasketDatas = [];
2473
- var _loop6 = function _loop6() {
2466
+ var _loop7 = function _loop7() {
2474
2467
  var ol = orderLines[i];
2475
2468
  var catalog = catalogData.find(function (c) {
2476
2469
  return c.codex === ol.CatalogCodex;
@@ -2493,7 +2486,7 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
2493
2486
  }
2494
2487
  };
2495
2488
  for (var i = 0; i < orderLines.length; i++) {
2496
- if (_loop6()) continue;
2489
+ if (_loop7()) continue;
2497
2490
  }
2498
2491
  return variantBasketDatas;
2499
2492
  }