thm-p3-configurator 0.0.142 → 0.0.144

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.
@@ -25,6 +25,7 @@ var _FormulaContext = require("./__context__/FormulaContext");
25
25
  var _OrderSessionContext = require("./__context__/OrderSessionContext");
26
26
  var _cookiebot = require("./__helpers__/cookiebot");
27
27
  var _queryClient = _interopRequireDefault(require("./__helpers__/queryClient"));
28
+ var _index = _interopRequireDefault(require("./__pages__/index"));
28
29
  var _TEST_ONLY_INTERNAL_ROUTES = _interopRequireDefault(require("./__pages__/internal/__TEST_ONLY_INTERNAL_ROUTES"));
29
30
  var _Experiments = _interopRequireDefault(require("./__services__/Experiments"));
30
31
  var _mainExternal = _interopRequireDefault(require("./__style__/main-external.scss"));
@@ -59,8 +60,6 @@ function _interopRequireWildcard(e, r) {
59
60
  }
60
61
  return n.default = e, t && t.set(e, n), n;
61
62
  }
62
- // import Routes from './__pages__/index';
63
-
64
63
  _reactGtmModule.default.initialize({
65
64
  gtmId: APP_CONFIG.googleTagManagerId || 'GTM-TC67SZ4'
66
65
  });
@@ -76,6 +75,6 @@ const App = () => {
76
75
  defaultCountry: APP_CONFIG.country
77
76
  }, /*#__PURE__*/_react.default.createElement(_OrderSessionContext.OrderSessionController, null, /*#__PURE__*/_react.default.createElement(_reactQuery.QueryClientProvider, {
78
77
  client: _queryClient.default
79
- }, /*#__PURE__*/_react.default.createElement(_reactRouterDom.BrowserRouter, null, /*#__PURE__*/_react.default.createElement(_reactHotLoader.AppContainer, null, /*#__PURE__*/_react.default.createElement(_ActiveMarkerContext.ActiveMarkerProvider, null, /*#__PURE__*/_react.default.createElement(_StyleWrapper.default, null, !APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_Navbar.default, null), APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_InternalBranchSelectorModal.default, null), APP_CONFIG.nodeEnv === 'development' && APP_CONFIG.internal === true && /*#__PURE__*/_react.default.createElement(_TEST_ONLY_INTERNAL_ROUTES.default, null))))))))));
78
+ }, /*#__PURE__*/_react.default.createElement(_reactRouterDom.BrowserRouter, null, /*#__PURE__*/_react.default.createElement(_reactHotLoader.AppContainer, null, /*#__PURE__*/_react.default.createElement(_ActiveMarkerContext.ActiveMarkerProvider, null, /*#__PURE__*/_react.default.createElement(_StyleWrapper.default, null, !APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_Navbar.default, null), APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_InternalBranchSelectorModal.default, null), /*#__PURE__*/_react.default.createElement(_index.default, null))))))))));
80
79
  };
81
80
  var _default = exports.default = App;
@@ -35,15 +35,20 @@ const ProductCardSpecifications = _ref => {
35
35
  }
36
36
 
37
37
  // convert the key to a human readable format
38
- const convertedSpecifications = specifications.map(_ref2 => {
38
+ const convertedSpecifications = specifications.filter(_ref2 => {
39
+ let {
40
+ key
41
+ } = _ref2;
42
+ return key !== 'Weight';
43
+ }).map(_ref3 => {
39
44
  let {
40
45
  key,
41
46
  value
42
- } = _ref2;
43
- const translation = _constants__.ARTICLE_SPECS_TRANSLATIONS.find(_ref3 => {
47
+ } = _ref3;
48
+ const translation = _constants__.ARTICLE_SPECS_TRANSLATIONS.find(_ref4 => {
44
49
  let {
45
50
  key: translationKey
46
- } = _ref3;
51
+ } = _ref4;
47
52
  return translationKey === key;
48
53
  });
49
54
  return {
@@ -53,16 +58,16 @@ const ProductCardSpecifications = _ref => {
53
58
  });
54
59
  return /*#__PURE__*/_react.default.createElement("ul", {
55
60
  className: (0, _helpers__.withStyle)("col-md-6 list-unstyled product-critera__text mb-2 ".concat(className))
56
- }, convertedSpecifications.filter(_ref4 => {
61
+ }, convertedSpecifications.filter(_ref5 => {
57
62
  let {
58
63
  key
59
- } = _ref4;
64
+ } = _ref5;
60
65
  return !excludeKeys.includes(key);
61
- }).map(_ref5 => {
66
+ }).map(_ref6 => {
62
67
  let {
63
68
  key,
64
69
  value
65
- } = _ref5;
70
+ } = _ref6;
66
71
  return /*#__PURE__*/_react.default.createElement("li", {
67
72
  key: key + value,
68
73
  className: (0, _helpers__.withStyle)('d-flex justify-content-between card-text__criterea')
@@ -21,6 +21,7 @@ var _ProductCardPrice = _interopRequireDefault(require("./ProductCardPrice"));
21
21
  var _ProductCardRibbon = _interopRequireDefault(require("./ProductCardRibbon"));
22
22
  var _ProductCardSpecifications = _interopRequireDefault(require("./ProductCardSpecifications"));
23
23
  var _ProductCardUsps = _interopRequireDefault(require("./ProductCardUsps"));
24
+ var _constants__ = require("../../__constants__");
24
25
  function _interopRequireDefault(e) {
25
26
  return e && e.__esModule ? e : {
26
27
  default: e
@@ -52,12 +53,14 @@ function _interopRequireWildcard(e, r) {
52
53
  return n.default = e, t && t.set(e, n), n;
53
54
  }
54
55
  const ProductCard = _ref => {
56
+ var _stock$quantity, _stock$quantity2;
55
57
  let {
56
58
  hasCheckbox = true,
57
59
  isRecommended = false,
58
60
  productId,
59
61
  productTitle,
60
62
  productDescription,
63
+ stock = null,
61
64
  productUsps = [],
62
65
  productImage = null,
63
66
  isDisabled = false,
@@ -70,7 +73,8 @@ const ProductCard = _ref => {
70
73
  canUnselect = true,
71
74
  onSelect = () => {},
72
75
  isOnlyProductInCategory = false,
73
- isAnotherProductSelected = true
76
+ isAnotherProductSelected = true,
77
+ isTmg = false
74
78
  } = _ref;
75
79
  const [isSelected, setIsSelected] = (0, _react.useState)(defaultSelected);
76
80
  const {
@@ -146,10 +150,18 @@ const ProductCard = _ref => {
146
150
  description: productDescription
147
151
  })), /*#__PURE__*/_react.default.createElement("div", {
148
152
  className: (0, _helpers__.withStyle)('card-footer pt-2 col-12 col-md-8 col-xxl-6 pb-0 justify-content-end')
149
- }, hasCheckbox && /*#__PURE__*/_react.default.createElement(_ProductCardCheckbox.default, {
153
+ }, /*#__PURE__*/_react.default.createElement("div", {
154
+ className: (0, _helpers__.withStyle)('d-flex flex-column align-items-end')
155
+ }, showPrice && stock && /*#__PURE__*/_react.default.createElement("div", null, (stock === null || stock === void 0 ? void 0 : stock.status) === _constants__.StockStatus.OutOfStock ? /*#__PURE__*/_react.default.createElement("div", {
156
+ className: (0, _helpers__.withStyle)('text-danger mb-1')
157
+ }, "Niet op voorraad") : stock === _constants__.StockStatus.InsufficientStock ? /*#__PURE__*/_react.default.createElement("div", {
158
+ className: (0, _helpers__.withStyle)('text-warning mb-1')
159
+ }, isTmg ? "".concat((_stock$quantity = stock === null || stock === void 0 ? void 0 : stock.quantity) !== null && _stock$quantity !== void 0 ? _stock$quantity : 0, " op voorraad") : 'Weinig op voorraad') : /*#__PURE__*/_react.default.createElement("div", {
160
+ className: (0, _helpers__.withStyle)('text-success mb-1')
161
+ }, isTmg ? "".concat((_stock$quantity2 = stock === null || stock === void 0 ? void 0 : stock.quantity) !== null && _stock$quantity2 !== void 0 ? _stock$quantity2 : 0, " op voorraad") : 'Op voorraad')), hasCheckbox && /*#__PURE__*/_react.default.createElement(_ProductCardCheckbox.default, {
150
162
  id: productId,
151
163
  isDisabled: isDisabled,
152
164
  defaultChecked: isSelected
153
- }))))));
165
+ })))))));
154
166
  };
155
167
  var _default = exports.default = ProductCard;
@@ -93,7 +93,9 @@ const ProductActions = _ref2 => {
93
93
  className: (0, _helpers__.withStyle)('d-flex flex-column align-items-end')
94
94
  }, isOutOfStock ? /*#__PURE__*/_react.default.createElement("div", {
95
95
  className: (0, _helpers__.withStyle)('text-danger mb-1')
96
- }, "Niet op voorraad") : /*#__PURE__*/_react.default.createElement("div", {
96
+ }, "Niet op voorraad") : stock === _constants__.StockStatus.InsufficientStock ? /*#__PURE__*/_react.default.createElement("div", {
97
+ className: (0, _helpers__.withStyle)('text-warning mb-1')
98
+ }, isTmg ? "".concat(stock, " op voorraad") : 'Weinig op voorraad') : /*#__PURE__*/_react.default.createElement("div", {
97
99
  className: (0, _helpers__.withStyle)('text-success mb-1')
98
100
  }, isTmg ? "".concat(stock, " op voorraad") : 'Op voorraad'), /*#__PURE__*/_react.default.createElement("div", {
99
101
  className: (0, _helpers__.withStyle)('d-flex align-items-center')
@@ -143,8 +145,8 @@ const ProductCategories = _ref3 => {
143
145
  }, /*#__PURE__*/_react.default.createElement("strong", null, "Voorkeur onderdeel:"), " ", preferredPart.preferredPart), showPartStockLevel && (partStockLevels === null || partStockLevels === void 0 ? void 0 : partStockLevels.status) && /*#__PURE__*/_react.default.createElement("p", {
144
146
  className: (0, _helpers__.withStyle)('fst-italic mb-0')
145
147
  }, /*#__PURE__*/_react.default.createElement("small", {
146
- className: (0, _helpers__.withStyle)(partStockLevels.status === _constants__.StockStatus.OutOfStock ? 'text-danger' : 'text-success')
147
- }, partStockLevels.status === _constants__.StockStatus.OutOfStock ? 'Niet op voorraad' : 'Op voorraad'), partStockLevels.quantity ? /*#__PURE__*/_react.default.createElement("small", null, ": ".concat(partStockLevels.quantity)) : ''));
148
+ className: (0, _helpers__.withStyle)(partStockLevels.status === _constants__.StockStatus.OutOfStock ? 'text-danger' : partStockLevels.status === _constants__.StockStatus.InsufficientStock ? 'text-warning' : 'text-success')
149
+ }, partStockLevels.status === _constants__.StockStatus.OutOfStock ? 'Niet op voorraad' : partStockLevels.status === _constants__.StockStatus.InsufficientStock ? 'Weinig op voorraad' : 'Op voorraad'), partStockLevels.quantity ? /*#__PURE__*/_react.default.createElement("small", null, ": ".concat(partStockLevels.quantity)) : ''));
148
150
  };
149
151
  const SingleOrderProductCard = _ref4 => {
150
152
  let {
@@ -206,7 +208,7 @@ const SingleOrderProductCard = _ref4 => {
206
208
  key,
207
209
  value
208
210
  } = _ref5;
209
- return (productFieldLabels === null || productFieldLabels === void 0 ? void 0 : productFieldLabels[key]) && value !== 'kg';
211
+ return (productFieldLabels === null || productFieldLabels === void 0 ? void 0 : productFieldLabels[key]) && (value !== 'kg' || key !== 'weight');
210
212
  }).map(_ref6 => {
211
213
  let {
212
214
  key,
@@ -178,7 +178,8 @@ const ARTICLE_SPECS_TRANSLATIONS = exports.ARTICLE_SPECS_TRANSLATIONS = [{
178
178
  }];
179
179
  const StockStatus = exports.StockStatus = {
180
180
  InStock: 'in_stock',
181
- OutOfStock: 'out_of_stock'
181
+ OutOfStock: 'out_of_stock',
182
+ InsufficientStock: 'insufficient'
182
183
  };
183
184
  const CONFIGURATOR_FORMULAS = exports.CONFIGURATOR_FORMULAS = {
184
185
  THM: 'THM',
@@ -207,7 +207,7 @@ const ProductsOverview = () => {
207
207
  product: a,
208
208
  category: productCategory
209
209
  }) ? -1 : 0).map(product => {
210
- var _product$images, _product$images2;
210
+ var _product$locationPric, _product$images, _product$images2;
211
211
  const isRecommended = (0, _product.checkIfTowbarIsRecommended)({
212
212
  product,
213
213
  category: productCategory
@@ -237,6 +237,8 @@ const ProductsOverview = () => {
237
237
  });
238
238
  }
239
239
  return /*#__PURE__*/_react.default.createElement(_ProductCard.default, {
240
+ isTmg: isTmg,
241
+ stock: product === null || product === void 0 || (_product$locationPric = product.locationPrices) === null || _product$locationPric === void 0 ? void 0 : _product$locationPric.stock,
240
242
  key: product.articleNumber,
241
243
  hasCheckbox: (productsPerCategory === null || productsPerCategory === void 0 ? void 0 : productsPerCategory.length) > 1,
242
244
  isRecommended: isRecommended,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.142",
3
+ "version": "0.0.144",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",