thm-p3-configurator 0.0.295 → 0.0.297

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.
@@ -76,7 +76,8 @@ const ProductActions = _ref2 => {
76
76
  let {
77
77
  isTmg,
78
78
  isOutOfStock,
79
- stock,
79
+ stockQuantity,
80
+ stockStatus,
80
81
  quantity,
81
82
  productId,
82
83
  handleQuantityChange,
@@ -94,11 +95,11 @@ const ProductActions = _ref2 => {
94
95
  className: (0, _helpers__.withStyle)('d-flex flex-column align-items-end')
95
96
  }, !isWebshop && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isOutOfStock ? /*#__PURE__*/_react.default.createElement("div", {
96
97
  className: (0, _helpers__.withStyle)('text-danger mb-1')
97
- }, "Niet op voorraad") : stock === _constants__.StockStatus.InsufficientStock ? /*#__PURE__*/_react.default.createElement("div", {
98
+ }, "Niet op voorraad") : stockStatus === _constants__.StockStatus.InsufficientStock ? /*#__PURE__*/_react.default.createElement("div", {
98
99
  className: (0, _helpers__.withStyle)('text-warning mb-1')
99
- }, isTmg ? "".concat(stock, " op voorraad") : 'Weinig op voorraad') : /*#__PURE__*/_react.default.createElement("div", {
100
+ }, isTmg ? "".concat(stockQuantity, " op voorraad") : 'Weinig op voorraad') : /*#__PURE__*/_react.default.createElement("div", {
100
101
  className: (0, _helpers__.withStyle)('text-success mb-1')
101
- }, isTmg ? "".concat(stock, " op voorraad") : 'Op voorraad')), /*#__PURE__*/_react.default.createElement("div", {
102
+ }, isTmg ? "".concat(stockQuantity, " op voorraad") : 'Op voorraad')), /*#__PURE__*/_react.default.createElement("div", {
102
103
  className: (0, _helpers__.withStyle)('d-flex align-items-center')
103
104
  }, !isWebshop && /*#__PURE__*/_react.default.createElement(_OutlinedButton.default, {
104
105
  style: {
@@ -149,7 +150,8 @@ const SingleOrderProductCard = _ref4 => {
149
150
  let {
150
151
  productId,
151
152
  isSelected,
152
- stock,
153
+ stockQuantity,
154
+ stockStatus,
153
155
  isOutOfStock,
154
156
  formula,
155
157
  handleSelected,
@@ -251,7 +253,8 @@ const SingleOrderProductCard = _ref4 => {
251
253
  showPartStockLevel: showPartStockLevel,
252
254
  setShowPartStockLevel: setShowPartStockLevel,
253
255
  isOutOfStock: isOutOfStock,
254
- stock: stock,
256
+ stockQuantity: stockQuantity,
257
+ stockStatus: stockStatus,
255
258
  isTmg: isTmg,
256
259
  quantity: quantity,
257
260
  productId: productId,
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.mapBranchFormulaToConfiguratorFormula = exports.VESTIGING_TYPE_ID = exports.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE = exports.VEHICLE_OWNERSHIP_TYPE = exports.VEHICLE_CODING_SUBGROUP_NAME = exports.USER_GEOLOCATION_KEY = exports.TOWMOTIVE_ORGANIZATION_TYPE = exports.TMG_ORGANIZATION_TYPE = exports.StockStatus = exports.STATUS_ASSESSMENT = exports.PRODUCT_CATEGORIES = exports.PRIVATE_SINGLE_ORDER_SESSION_KEY = exports.PARTNER_PORTAL_PAGE_TITLES_BY_THEME = exports.PARTNER_PORTAL_CHANNEL_TITLE = exports.ORDER_SESSION_KEY = exports.NO_PRODUCTS_CONTACT_DETAILS_BY_FORMULA = exports.NAVIGATION_STEPS_INTERNAL = exports.NAVIGATION_STEPS_EXTERNAL = exports.NAVIGATION_BUTTONS = exports.MOUSE_EXIT_INTENT_THROTTLE = exports.MOUSE_EXIT_INTENT_OFFSET = exports.LOCATION_TYPE = exports.LOCATION_CHANGE_BUTTON_LABEL = exports.LOCALE = exports.LEASE_TYPE_ID = exports.FORM_ERROR_MESSAGES = exports.DOSSIER_TYPES = exports.DISCOUNT_TYPES = exports.DEFAULT_MAP_LONGITUDE = exports.DEFAULT_MAP_LATITUDE = exports.DEFAULT_ARTICLE_BRAND = exports.DAY_NAMES = exports.CONFIGURATOR_FORMULAS = exports.BRANCH_THEME_BY_FORMULA = exports.BRANCH_FORMULAS = exports.BOARD_COMPUTER_DISABLED_KEY = exports.AUTH_SESSION_KEY = exports.ARTICLE_SPECS_TRANSLATIONS = exports.ARTICLES_SYSTEM_FIELDS = exports.API_ERROR_CODES = exports.ANWB_DISCOUNT_CODE = exports.ALL_EXPERIMENTS = exports.ACTIVE_VARIANTS = void 0;
6
+ exports.mapBranchFormulaToConfiguratorFormula = exports.VESTIGING_TYPE_ID = exports.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE = exports.VEHICLE_OWNERSHIP_TYPE = exports.VEHICLE_CODING_SUBGROUP_NAME = exports.USER_GEOLOCATION_KEY = exports.TOWMOTIVE_ORGANIZATION_TYPE = exports.TMG_ORGANIZATION_TYPE = exports.StockStatus = exports.STATUS_ASSESSMENT = exports.PRODUCT_CATEGORIES = exports.PRIVATE_SINGLE_ORDER_SESSION_KEY = exports.PARTNER_PORTAL_PAGE_TITLES_BY_THEME = exports.PARTNER_PORTAL_CHANNEL_TITLE = exports.ORDER_SESSION_KEY = exports.NO_PRODUCTS_CONTACT_DETAILS_BY_FORMULA = exports.NAVIGATION_STEPS_INTERNAL = exports.NAVIGATION_STEPS_EXTERNAL = exports.NAVIGATION_BUTTONS = exports.MOUSE_EXIT_INTENT_THROTTLE = exports.MOUSE_EXIT_INTENT_OFFSET = exports.LOCATION_TYPE = exports.LOCATION_CHANGE_BUTTON_LABEL = exports.LOCALE = exports.LEASE_TYPE_ID = exports.FORM_ERROR_MESSAGES = exports.DOSSIER_TYPES = exports.DISCOUNT_TYPES = exports.DEFAULT_MAP_LONGITUDE = exports.DEFAULT_MAP_LATITUDE = exports.DEFAULT_ARTICLE_BRAND = exports.DAY_NAMES = exports.CONFIGURATOR_FORMULAS = exports.BRANCH_THEME_BY_FORMULA = exports.BRANCH_FORMULAS = exports.BOARD_COMPUTER_DISABLED_KEY = exports.ApiStockStatus = exports.AUTH_SESSION_KEY = exports.ARTICLE_SPECS_TRANSLATIONS = exports.ARTICLES_SYSTEM_FIELDS = exports.API_ERROR_CODES = exports.ANWB_DISCOUNT_CODE = exports.ALL_EXPERIMENTS = exports.ACTIVE_VARIANTS = void 0;
7
7
  const DOSSIER_TYPES = exports.DOSSIER_TYPES = {
8
8
  Quotation: 'quotation',
9
9
  AppointmentRequest: 'appointment-request',
@@ -211,6 +211,13 @@ const StockStatus = exports.StockStatus = {
211
211
  OutOfStock: 'out_of_stock',
212
212
  InsufficientStock: 'insufficient'
213
213
  };
214
+ const ApiStockStatus = exports.ApiStockStatus = {
215
+ Sufficient: 'sufficient',
216
+ InStock: 'in_stock',
217
+ Insufficient: 'insufficient',
218
+ LowStock: 'low_stock',
219
+ OutOfStock: 'out_of_stock'
220
+ };
214
221
  const CONFIGURATOR_FORMULAS = exports.CONFIGURATOR_FORMULAS = {
215
222
  THM: 'THM',
216
223
  THC: 'THC',
@@ -804,81 +804,15 @@ const InternalAppointmentForm = _ref => {
804
804
  cursor: 'pointer'
805
805
  },
806
806
  onMouseDown: e => {
807
- var _branch$vatNumber, _branch$kvkNumber;
808
807
  e.preventDefault();
808
+
809
+ // Only set company name for lease companies, no other autofills
809
810
  dispatch({
810
811
  type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
811
812
  payload: {
812
813
  companyName: branch.name
813
814
  }
814
815
  });
815
- if (branch.postalCode) {
816
- dispatch({
817
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
818
- payload: {
819
- zipCode: branch.postalCode
820
- }
821
- });
822
- }
823
- if (branch.street) {
824
- dispatch({
825
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
826
- payload: {
827
- streetName: branch.street
828
- }
829
- });
830
- }
831
- if (branch.city) {
832
- dispatch({
833
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
834
- payload: {
835
- city: branch.city
836
- }
837
- });
838
- }
839
- if (branch.street2) {
840
- dispatch({
841
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
842
- payload: {
843
- houseNumber: branch.street2
844
- }
845
- });
846
- }
847
- const vatNumber = (_branch$vatNumber = branch.vatNumber) !== null && _branch$vatNumber !== void 0 ? _branch$vatNumber : branch.btwNummer;
848
- if (vatNumber) {
849
- dispatch({
850
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
851
- payload: {
852
- vatNumber
853
- }
854
- });
855
- }
856
- const kvkNumber = (_branch$kvkNumber = branch.kvkNumber) !== null && _branch$kvkNumber !== void 0 ? _branch$kvkNumber : branch.kvkNummer;
857
- if (kvkNumber) {
858
- dispatch({
859
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
860
- payload: {
861
- kvkNumber
862
- }
863
- });
864
- }
865
- if (branch.huisnummerToevoeging) {
866
- dispatch({
867
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
868
- payload: {
869
- houseNumberAddition: branch.huisnummerToevoeging
870
- }
871
- });
872
- }
873
- if (branch.country && branch.country.entityId) {
874
- dispatch({
875
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
876
- payload: {
877
- countryId: branch.country.entityId
878
- }
879
- });
880
- setRefreshKey(Date.now());
881
- }
882
816
  setCompanySearchTerm('');
883
817
  setIsCompanyInputFocused(false);
884
818
  }
@@ -1176,7 +1110,7 @@ const InternalAppointmentForm = _ref => {
1176
1110
  cursor: 'pointer'
1177
1111
  },
1178
1112
  onMouseDown: e => {
1179
- var _branch$vatNumber2, _branch$kvkNumber2;
1113
+ var _branch$vatNumber, _branch$kvkNumber;
1180
1114
  e.preventDefault();
1181
1115
  dispatch({
1182
1116
  type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
@@ -1216,7 +1150,7 @@ const InternalAppointmentForm = _ref => {
1216
1150
  }
1217
1151
  });
1218
1152
  }
1219
- const vatNumber = (_branch$vatNumber2 = branch.vatNumber) !== null && _branch$vatNumber2 !== void 0 ? _branch$vatNumber2 : branch.btwNummer;
1153
+ const vatNumber = (_branch$vatNumber = branch.vatNumber) !== null && _branch$vatNumber !== void 0 ? _branch$vatNumber : branch.btwNummer;
1220
1154
  if (vatNumber) {
1221
1155
  dispatch({
1222
1156
  type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
@@ -1225,7 +1159,7 @@ const InternalAppointmentForm = _ref => {
1225
1159
  }
1226
1160
  });
1227
1161
  }
1228
- const kvkNumber = (_branch$kvkNumber2 = branch.kvkNumber) !== null && _branch$kvkNumber2 !== void 0 ? _branch$kvkNumber2 : branch.kvkNummer;
1162
+ const kvkNumber = (_branch$kvkNumber = branch.kvkNumber) !== null && _branch$kvkNumber !== void 0 ? _branch$kvkNumber : branch.kvkNummer;
1229
1163
  if (kvkNumber) {
1230
1164
  dispatch({
1231
1165
  type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
@@ -816,81 +816,15 @@ const InternalQuotationForm = _ref => {
816
816
  cursor: 'pointer'
817
817
  },
818
818
  onMouseDown: e => {
819
- var _branch$vatNumber2, _branch$kvkNumber2;
820
819
  e.preventDefault();
820
+
821
+ // Only set company name for lease companies, no other autofills
821
822
  dispatch({
822
823
  type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COMPANY_NAME,
823
824
  payload: {
824
825
  companyName: branch.name
825
826
  }
826
827
  });
827
- if (branch.postalCode) {
828
- dispatch({
829
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
830
- payload: {
831
- zipCode: branch.postalCode
832
- }
833
- });
834
- }
835
- if (branch.street) {
836
- dispatch({
837
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
838
- payload: {
839
- streetName: branch.street
840
- }
841
- });
842
- }
843
- if (branch.city) {
844
- dispatch({
845
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
846
- payload: {
847
- city: branch.city
848
- }
849
- });
850
- }
851
- if (branch.street2) {
852
- dispatch({
853
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
854
- payload: {
855
- houseNumber: branch.street2
856
- }
857
- });
858
- }
859
- const vatNumber = (_branch$vatNumber2 = branch.vatNumber) !== null && _branch$vatNumber2 !== void 0 ? _branch$vatNumber2 : branch.btwNummer;
860
- if (vatNumber) {
861
- dispatch({
862
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_VAT_NUMBER,
863
- payload: {
864
- vatNumber
865
- }
866
- });
867
- }
868
- const kvkNumber = (_branch$kvkNumber2 = branch.kvkNumber) !== null && _branch$kvkNumber2 !== void 0 ? _branch$kvkNumber2 : branch.kvkNummer;
869
- if (kvkNumber) {
870
- dispatch({
871
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_KVK_NUMBER,
872
- payload: {
873
- kvkNumber
874
- }
875
- });
876
- }
877
- if (branch.huisnummerToevoeging) {
878
- dispatch({
879
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
880
- payload: {
881
- houseNumberAddition: branch.huisnummerToevoeging
882
- }
883
- });
884
- }
885
- if (branch.country && branch.country.entityId) {
886
- dispatch({
887
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
888
- payload: {
889
- countryId: branch.country.entityId
890
- }
891
- });
892
- setRefreshKey(Date.now());
893
- }
894
828
  setCompanySearchTerm('');
895
829
  setIsCompanyInputFocused(false);
896
830
  }
@@ -30,6 +30,7 @@ var _FormulaContext = require("../../__context__/FormulaContext");
30
30
  var _OrderSessionContext = require("../../__context__/OrderSessionContext");
31
31
  var _helpers__ = require("../../__helpers__");
32
32
  var _product = require("../../__helpers__/product");
33
+ var _singleOrderArticles = require("../../__helpers__/singleOrderArticles");
33
34
  var _useIsTmg = require("../../__hooks__/useIsTmg");
34
35
  function _interopRequireDefault(e) {
35
36
  return e && e.__esModule ? e : {
@@ -138,10 +139,12 @@ const InternalSingleOrderProductOverview = _ref => {
138
139
  // Otherwise, show if TMG or has price
139
140
  return isTmg || productPrice > 0;
140
141
  })) === null || _articles$articles3 === void 0 ? void 0 : _articles$articles3.map(article => {
141
- var _article$locationPric2, _article$locationPric3, _article$locationPric4, _cart$find$quantity, _cart$find, _article$locationPric7, _article$locationPric8;
142
+ var _article$consumerPric, _article$consumerPric2, _article$consumerPric3, _cart$find$quantity, _cart$find, _article$locationPric4, _article$locationPric5;
142
143
  // Hide stock for webshops (online orders)
143
- const stockQuantity = orderSession.webshop || isTmg ? 0 : (_article$locationPric2 = article === null || article === void 0 || (_article$locationPric3 = article.locationPrices) === null || _article$locationPric3 === void 0 || (_article$locationPric3 = _article$locationPric3.stock) === null || _article$locationPric3 === void 0 ? void 0 : _article$locationPric3.quantity) !== null && _article$locationPric2 !== void 0 ? _article$locationPric2 : 0;
144
- const isOutOfStock = !orderSession.webshop && !isTmg && (article === null || article === void 0 || (_article$locationPric4 = article.locationPrices) === null || _article$locationPric4 === void 0 || (_article$locationPric4 = _article$locationPric4.stock) === null || _article$locationPric4 === void 0 ? void 0 : _article$locationPric4.status) == _constants__.StockStatus.OutOfStock;
144
+ const stockQuantity = orderSession.webshop ? 0 : (_article$consumerPric = article === null || article === void 0 || (_article$consumerPric2 = article.consumerPrices) === null || _article$consumerPric2 === void 0 || (_article$consumerPric2 = _article$consumerPric2.stock) === null || _article$consumerPric2 === void 0 ? void 0 : _article$consumerPric2.quantity) !== null && _article$consumerPric !== void 0 ? _article$consumerPric : 0;
145
+ const apiStockStatus = article === null || article === void 0 || (_article$consumerPric3 = article.consumerPrices) === null || _article$consumerPric3 === void 0 || (_article$consumerPric3 = _article$consumerPric3.stock) === null || _article$consumerPric3 === void 0 ? void 0 : _article$consumerPric3.status;
146
+ const stockStatus = (0, _singleOrderArticles.mapApiStockStatusToStockStatus)(apiStockStatus);
147
+ const isOutOfStock = !orderSession.webshop && !isTmg && stockStatus === _constants__.StockStatus.OutOfStock;
145
148
  return /*#__PURE__*/_react.default.createElement(_SingleOrderProductCard.default, {
146
149
  isTmg: isTmg,
147
150
  branchId: selectedBranch,
@@ -154,11 +157,12 @@ const InternalSingleOrderProductOverview = _ref => {
154
157
  productId: article.articleNumber,
155
158
  quantity: (_cart$find$quantity = (_cart$find = cart.find(product => product.articleNumber === article.articleNumber)) === null || _cart$find === void 0 ? void 0 : _cart$find.quantity) !== null && _cart$find$quantity !== void 0 ? _cart$find$quantity : 0,
156
159
  isSelected: false,
157
- stock: stockQuantity,
160
+ stockQuantity: stockQuantity,
161
+ stockStatus: stockStatus,
158
162
  isOutOfStock: isOutOfStock,
159
163
  handleSelected: () => {
160
- var _article$locationPric5, _article$locationPric6;
161
- return handleQuantityChange(article.articleNumber, 1, article === null || article === void 0 || (_article$locationPric5 = article.locationPrices) === null || _article$locationPric5 === void 0 ? void 0 : _article$locationPric5.priceExclVat, article === null || article === void 0 || (_article$locationPric6 = article.locationPrices) === null || _article$locationPric6 === void 0 ? void 0 : _article$locationPric6.priceInclVat);
164
+ var _article$locationPric2, _article$locationPric3;
165
+ return handleQuantityChange(article.articleNumber, 1, article === null || article === void 0 || (_article$locationPric2 = article.locationPrices) === null || _article$locationPric2 === void 0 ? void 0 : _article$locationPric2.priceExclVat, article === null || article === void 0 || (_article$locationPric3 = article.locationPrices) === null || _article$locationPric3 === void 0 ? void 0 : _article$locationPric3.priceInclVat);
162
166
  },
163
167
  productUsps: [{
164
168
  type: 'excl',
@@ -176,8 +180,8 @@ const InternalSingleOrderProductOverview = _ref => {
176
180
  productImage: article.image,
177
181
  productSpecifications: (0, _product.extractProductSpecsArray)(article),
178
182
  productTitle: article.name,
179
- productPrice: Number(article === null || article === void 0 || (_article$locationPric7 = article.locationPrices) === null || _article$locationPric7 === void 0 ? void 0 : _article$locationPric7.priceExclVat).toFixed(2),
180
- productPriceInclVat: Number(article === null || article === void 0 || (_article$locationPric8 = article.locationPrices) === null || _article$locationPric8 === void 0 ? void 0 : _article$locationPric8.priceInclVat).toFixed(2),
183
+ productPrice: Number(article === null || article === void 0 || (_article$locationPric4 = article.locationPrices) === null || _article$locationPric4 === void 0 ? void 0 : _article$locationPric4.priceExclVat).toFixed(2),
184
+ productPriceInclVat: Number(article === null || article === void 0 || (_article$locationPric5 = article.locationPrices) === null || _article$locationPric5 === void 0 ? void 0 : _article$locationPric5.priceInclVat).toFixed(2),
181
185
  productSubgroup: article === null || article === void 0 ? void 0 : article.subgroup,
182
186
  isWebshop: !!orderSession.webshop
183
187
  });
@@ -19,7 +19,7 @@ require("core-js/modules/esnext.iterator.for-each.js");
19
19
  Object.defineProperty(exports, "__esModule", {
20
20
  value: true
21
21
  });
22
- exports.fetchPartStockLevels = exports.fetchArticlesByLicensePlateAndModel = exports.fetchArticlesByFilters = exports.fetchArticlesByArticleNumbers = exports.enrichArticlesWithBrandsAndPrices = void 0;
22
+ exports.mapApiStockStatusToStockStatus = exports.fetchPartStockLevels = exports.fetchArticlesByLicensePlateAndModel = exports.fetchArticlesByFilters = exports.fetchArticlesByArticleNumbers = exports.enrichArticlesWithBrandsAndPrices = void 0;
23
23
  require("core-js/modules/es.symbol.description.js");
24
24
  require("core-js/modules/es.array.flat-map.js");
25
25
  require("core-js/modules/es.array.unscopables.flat-map.js");
@@ -87,11 +87,33 @@ function _toPrimitive(t, r) {
87
87
  }
88
88
  return ("string" === r ? String : Number)(t);
89
89
  }
90
+ /**
91
+ * @description Maps API stock status values to StockStatus constants
92
+ * @param {string} apiStatus - The stock status from the API
93
+ * @returns {string} The mapped StockStatus constant
94
+ */
95
+ const mapApiStockStatusToStockStatus = apiStatus => {
96
+ if (!apiStatus) {
97
+ return _index2.StockStatus.OutOfStock;
98
+ }
99
+ const statusLower = apiStatus.toLowerCase();
100
+ if (statusLower === _index2.ApiStockStatus.Sufficient || statusLower === _index2.ApiStockStatus.InStock) {
101
+ return _index2.StockStatus.InStock;
102
+ }
103
+ if (statusLower === _index2.ApiStockStatus.Insufficient || statusLower === _index2.ApiStockStatus.LowStock) {
104
+ return _index2.StockStatus.InsufficientStock;
105
+ }
106
+ if (statusLower === _index2.ApiStockStatus.OutOfStock) {
107
+ return _index2.StockStatus.OutOfStock;
108
+ }
109
+ return _index2.StockStatus.OutOfStock;
110
+ };
90
111
  /**
91
112
  * @description Fetch articles by filters
92
113
  * @param {Object} filters - The filters
93
114
  * @returns {Object} The articles
94
115
  */
116
+ exports.mapApiStockStatusToStockStatus = mapApiStockStatusToStockStatus;
95
117
  const fetchArticlesByFilters = async filters => {
96
118
  const articlesParamsString = new URLSearchParams((0, _index.removeNullishProps)(_objectSpread({}, filters))).toString();
97
119
  const response = await _authenticatedProxyApi.authenticatedProxyApi.getArticles(articlesParamsString);
@@ -200,7 +222,12 @@ const fetchPartStockLevels = exports.fetchPartStockLevels = async function fetch
200
222
  if (!(response !== null && response !== void 0 && response.data)) {
201
223
  throw new Error('No response from the API');
202
224
  }
203
- const stockLevel = (_response$data$data = response.data.data) === null || _response$data$data === void 0 || (_response$data$data = _response$data$data.locationPrices) === null || _response$data$data === void 0 || (_response$data$data = _response$data$data[0]) === null || _response$data$data === void 0 ? void 0 : _response$data$data.stock;
225
+ const stockLevel = (_response$data$data = response.data.data) === null || _response$data$data === void 0 || (_response$data$data = _response$data$data.consumerPrices) === null || _response$data$data === void 0 || (_response$data$data = _response$data$data[0]) === null || _response$data$data === void 0 ? void 0 : _response$data$data.stock;
226
+ if (stockLevel) {
227
+ return _objectSpread(_objectSpread({}, stockLevel), {}, {
228
+ status: mapApiStockStatusToStockStatus(stockLevel.status)
229
+ });
230
+ }
204
231
  return stockLevel;
205
232
  };
206
233
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.295",
3
+ "version": "0.0.297",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",