thm-p3-configurator 0.0.296 → 0.0.298
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/shared/__components__/SingleOrderProductCard.js +9 -6
- package/dist/src/shared/__constants__/index.js +8 -1
- package/dist/src/shared/__containers__/ProductsCartOverview.js +1 -1
- package/dist/src/shared/__containers__/internal/InternalSingleOrderProductOverview.js +12 -8
- package/dist/src/shared/__helpers__/singleOrderArticles.js +29 -2
- package/package.json +1 -1
|
@@ -76,7 +76,8 @@ const ProductActions = _ref2 => {
|
|
|
76
76
|
let {
|
|
77
77
|
isTmg,
|
|
78
78
|
isOutOfStock,
|
|
79
|
-
|
|
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") :
|
|
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(
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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',
|
|
@@ -795,6 +795,6 @@ const ProductCartTable = () => {
|
|
|
795
795
|
value: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalAfterDiscountInclVat),
|
|
796
796
|
className: 'fw-bold text-end'
|
|
797
797
|
}, showCatalogPrice)]
|
|
798
|
-
})))), APP_CONFIG.internal &&
|
|
798
|
+
})))), APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_InternalDiscountForm.default, null)));
|
|
799
799
|
};
|
|
800
800
|
var _default = exports.default = ProductCartTable;
|
|
@@ -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$
|
|
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
|
|
144
|
-
const
|
|
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
|
-
|
|
160
|
+
stockQuantity: stockQuantity,
|
|
161
|
+
stockStatus: stockStatus,
|
|
158
162
|
isOutOfStock: isOutOfStock,
|
|
159
163
|
handleSelected: () => {
|
|
160
|
-
var _article$
|
|
161
|
-
return handleQuantityChange(article.articleNumber, 1, article === null || article === void 0 || (_article$
|
|
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$
|
|
180
|
-
productPriceInclVat: Number(article === null || article === void 0 || (_article$
|
|
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.
|
|
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
|
|