thm-p3-configurator 0.0.256 → 0.0.258
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/App.js
CHANGED
|
@@ -17,6 +17,7 @@ var _reactRouterDom = require("react-router-dom");
|
|
|
17
17
|
var _Navbar = _interopRequireDefault(require("./__components__/Navbar"));
|
|
18
18
|
var _constants__ = require("./__constants__");
|
|
19
19
|
var _SentryWrapper = _interopRequireDefault(require("./__containers__/SentryWrapper"));
|
|
20
|
+
var _pages__ = _interopRequireDefault(require("./__pages__"));
|
|
20
21
|
var _StyleWrapper = _interopRequireDefault(require("./__containers__/StyleWrapper"));
|
|
21
22
|
var _InternalBranchSelectorModal = _interopRequireDefault(require("./__containers__/internal/InternalBranchSelectorModal"));
|
|
22
23
|
var _ActiveMarkerContext = require("./__context__/ActiveMarkerContext");
|
|
@@ -25,7 +26,6 @@ var _FormulaContext = require("./__context__/FormulaContext");
|
|
|
25
26
|
var _OrderSessionContext = require("./__context__/OrderSessionContext");
|
|
26
27
|
var _cookiebot = require("./__helpers__/cookiebot");
|
|
27
28
|
var _queryClient = _interopRequireDefault(require("./__helpers__/queryClient"));
|
|
28
|
-
var _TEST_ONLY_INTERNAL_ROUTES = _interopRequireDefault(require("./__pages__/internal/__TEST_ONLY_INTERNAL_ROUTES"));
|
|
29
29
|
var _Experiments = _interopRequireDefault(require("./__services__/Experiments"));
|
|
30
30
|
var _mainExternal = _interopRequireDefault(require("./__style__/main-external.scss"));
|
|
31
31
|
var _main = _interopRequireDefault(require("./__style__/main.scss"));
|
|
@@ -69,11 +69,11 @@ const App = () => {
|
|
|
69
69
|
(0, _Experiments.default)();
|
|
70
70
|
});
|
|
71
71
|
return /*#__PURE__*/_react.default.createElement(_SentryWrapper.default, null, /*#__PURE__*/_react.default.createElement(_FormulaContext.FormulaController, {
|
|
72
|
-
defaultFormula: _constants__.CONFIGURATOR_FORMULAS.
|
|
72
|
+
defaultFormula: _constants__.CONFIGURATOR_FORMULAS.THC
|
|
73
73
|
}, /*#__PURE__*/_react.default.createElement(_CountryContext.CountryController, {
|
|
74
74
|
defaultCountry: APP_CONFIG.country
|
|
75
75
|
}, /*#__PURE__*/_react.default.createElement(_OrderSessionContext.OrderSessionController, null, /*#__PURE__*/_react.default.createElement(_reactQuery.QueryClientProvider, {
|
|
76
76
|
client: _queryClient.default
|
|
77
|
-
}, /*#__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),
|
|
77
|
+
}, /*#__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(_pages__.default, null))))))))));
|
|
78
78
|
};
|
|
79
79
|
var _default = exports.default = App;
|
|
@@ -184,9 +184,10 @@ const ProductCartTable = () => {
|
|
|
184
184
|
// Subtotal calculation variables
|
|
185
185
|
let mainProductsSubtotal = 0;
|
|
186
186
|
let accessoireProductsSubtotal = 0;
|
|
187
|
+
// Market correction values (prefer cart item, fallback to totals)
|
|
187
188
|
const marketCorrectionPurchaseExcl = Number(marketCorrection === null || marketCorrection === void 0 ? void 0 : marketCorrection.locationTotal) || 0;
|
|
188
|
-
const
|
|
189
|
-
const
|
|
189
|
+
const marketCorrectionSalesIncl = (marketCorrection === null || marketCorrection === void 0 ? void 0 : marketCorrection.consumerTotal) != null ? Number(marketCorrection.consumerTotal) : Number(totals === null || totals === void 0 ? void 0 : totals.totalMarketCorrectionInclVat) || 0;
|
|
190
|
+
const marketCorrectionSalesExcl = (marketCorrection === null || marketCorrection === void 0 ? void 0 : marketCorrection.consumerTotal) != null ? Number(marketCorrection.consumerTotal) / 1.21 : Number(totals === null || totals === void 0 ? void 0 : totals.totalMarketCorrectionExclVat) || 0;
|
|
190
191
|
const marketCorrectionMargin = marketCorrectionSalesExcl - marketCorrectionPurchaseExcl;
|
|
191
192
|
const calculatePurchaseSubtotal = products => {
|
|
192
193
|
return products.reduce((total, product) => {
|
|
@@ -294,13 +295,39 @@ const ProductCartTable = () => {
|
|
|
294
295
|
}
|
|
295
296
|
const hasMarketCorrectionValue = marketCorrectionPurchaseExcl > 0 || marketCorrectionSalesExcl > 0 || marketCorrectionSalesIncl > 0;
|
|
296
297
|
const shouldIncludeMarketCorrection = isToggled && hasMarketCorrectionValue && marketCorrectionPurchaseExcl > 0;
|
|
297
|
-
|
|
298
|
+
|
|
299
|
+
// Always include market correction purchase in subtotals when present
|
|
300
|
+
if (marketCorrectionPurchaseExcl > 0) {
|
|
298
301
|
mainProductsSubtotal += marketCorrectionPurchaseExcl;
|
|
299
302
|
}
|
|
303
|
+
|
|
304
|
+
// Subtotal for the Trekhaakmontage section as shown in the (incl. VAT) column
|
|
305
|
+
const displayedMainProductsTotalInclVat = !isToggled ? mainProducts.reduce((total, product) => {
|
|
306
|
+
const {
|
|
307
|
+
salesPrice
|
|
308
|
+
} = product.priceInfo || {};
|
|
309
|
+
if (!APP_CONFIG.internal) {
|
|
310
|
+
const isVehicleCodingProduct = (product === null || product === void 0 ? void 0 : product.subgroupName) === _constants__.VEHICLE_CODING_SUBGROUP_NAME || (product === null || product === void 0 ? void 0 : product.groupName) === _constants__.VEHICLE_CODING_SUBGROUP_NAME;
|
|
311
|
+
if (!isVehicleCodingProduct) {
|
|
312
|
+
return total;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return salesPrice > 0 ? total + Number(salesPrice) : total;
|
|
316
|
+
}, 0) : 0;
|
|
317
|
+
const montageDisplayedTotalInclVat = !isToggled && APP_CONFIG.internal ? Number((totals === null || totals === void 0 ? void 0 : totals.montagePricePlusMarketCorrectionInclVat) || 0) : 0;
|
|
318
|
+
const trekhaakmontageSubtotalInclVat = displayedMainProductsTotalInclVat + montageDisplayedTotalInclVat;
|
|
319
|
+
const displayedMainProductsTotalExclVat = isToggled && !isTmg ? mainProducts.reduce((total, product) => {
|
|
320
|
+
const {
|
|
321
|
+
salesPrice
|
|
322
|
+
} = product.priceInfo || {};
|
|
323
|
+
return salesPrice > 0 ? total + Number(salesPrice) : total;
|
|
324
|
+
}, 0) : 0;
|
|
325
|
+
const montageDisplayedTotalExclVat = isToggled && !isTmg ? Number((totals === null || totals === void 0 ? void 0 : totals.totalMontageExclVat) || 0) : 0;
|
|
326
|
+
const marketCorrectionDisplayedTotalExclVat = isToggled && !isTmg && hasMarketCorrectionValue ? Number(marketCorrectionSalesExcl || 0) : 0;
|
|
327
|
+
const trekhaakmontageSubtotalExclVat = displayedMainProductsTotalExclVat + montageDisplayedTotalExclVat + marketCorrectionDisplayedTotalExclVat;
|
|
300
328
|
if (isLoadingProducts) {
|
|
301
329
|
return /*#__PURE__*/_react.default.createElement(_FullPageSpinner.default, null);
|
|
302
330
|
}
|
|
303
|
-
console.log('Hyper API Response:', cart);
|
|
304
331
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
305
332
|
className: (0, _helpers__.withStyle)("content col-lg")
|
|
306
333
|
}, /*#__PURE__*/_react.default.createElement(_TogglableCard.default, {
|
|
@@ -438,10 +465,10 @@ const ProductCartTable = () => {
|
|
|
438
465
|
text: (0, _helpers__.formatPrice)(mainProductsSubtotal),
|
|
439
466
|
className: 'fw-bold text-end pb-2'
|
|
440
467
|
}, {
|
|
441
|
-
text: (0, _helpers__.formatPrice)(
|
|
468
|
+
text: (0, _helpers__.formatPrice)(trekhaakmontageSubtotalExclVat),
|
|
442
469
|
className: 'fw-bold text-end pb-2'
|
|
443
470
|
}] : [{
|
|
444
|
-
text:
|
|
471
|
+
text: (0, _helpers__.formatPrice)(trekhaakmontageSubtotalInclVat),
|
|
445
472
|
className: 'fw-bold text-end pb-2'
|
|
446
473
|
}])]
|
|
447
474
|
})), accessoireProducts.length > 0 && /*#__PURE__*/_react.default.createElement(_ProductTableSection.default, {
|