thm-p3-configurator 0.0.261 → 0.0.263
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 +3 -2
- package/dist/src/shared/__api__/mutations.js +12 -6
- package/dist/src/shared/__components__/Form/DecimalInput.js +102 -0
- package/dist/src/shared/__constants__/cartTable.js +29 -0
- package/dist/src/shared/__containers__/ProductCartSide.js +13 -5
- package/dist/src/shared/__containers__/ProductsCartOverview.js +408 -463
- package/dist/src/shared/__containers__/internal/InternalAppointmentForm.js +15 -4
- package/dist/src/shared/__containers__/internal/InternalQuotationForm.js +14 -4
- package/dist/src/shared/__context__/OrderSessionContext.js +42 -3
- package/dist/src/shared/__helpers__/cartTable.js +317 -0
- package/dist/src/shared/__helpers__/product.js +15 -6
- package/package.json +1 -1
package/dist/src/shared/App.js
CHANGED
|
@@ -18,6 +18,7 @@ var _Navbar = _interopRequireDefault(require("./__components__/Navbar"));
|
|
|
18
18
|
var _constants__ = require("./__constants__");
|
|
19
19
|
var _SentryWrapper = _interopRequireDefault(require("./__containers__/SentryWrapper"));
|
|
20
20
|
var _pages__ = _interopRequireDefault(require("./__pages__"));
|
|
21
|
+
var _TEST_ONLY_INTERNAL_ROUTES = _interopRequireDefault(require("./__pages__/internal/__TEST_ONLY_INTERNAL_ROUTES"));
|
|
21
22
|
var _StyleWrapper = _interopRequireDefault(require("./__containers__/StyleWrapper"));
|
|
22
23
|
var _InternalBranchSelectorModal = _interopRequireDefault(require("./__containers__/internal/InternalBranchSelectorModal"));
|
|
23
24
|
var _ActiveMarkerContext = require("./__context__/ActiveMarkerContext");
|
|
@@ -69,11 +70,11 @@ const App = () => {
|
|
|
69
70
|
(0, _Experiments.default)();
|
|
70
71
|
});
|
|
71
72
|
return /*#__PURE__*/_react.default.createElement(_SentryWrapper.default, null, /*#__PURE__*/_react.default.createElement(_FormulaContext.FormulaController, {
|
|
72
|
-
defaultFormula: _constants__.CONFIGURATOR_FORMULAS.
|
|
73
|
+
defaultFormula: _constants__.CONFIGURATOR_FORMULAS.TOW
|
|
73
74
|
}, /*#__PURE__*/_react.default.createElement(_CountryContext.CountryController, {
|
|
74
75
|
defaultCountry: APP_CONFIG.country
|
|
75
76
|
}, /*#__PURE__*/_react.default.createElement(_OrderSessionContext.OrderSessionController, null, /*#__PURE__*/_react.default.createElement(_reactQuery.QueryClientProvider, {
|
|
76
77
|
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), /*#__PURE__*/_react.default.createElement(
|
|
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), APP_CONFIG.nodeEnv === 'development' && APP_CONFIG.internal === true && /*#__PURE__*/_react.default.createElement(_TEST_ONLY_INTERNAL_ROUTES.default, null))))))))));
|
|
78
79
|
};
|
|
79
80
|
var _default = exports.default = App;
|
|
@@ -190,7 +190,8 @@ const useCreatePrivateQuotationMutation = () => {
|
|
|
190
190
|
branchId,
|
|
191
191
|
formula,
|
|
192
192
|
discount,
|
|
193
|
-
isExitIntent = false
|
|
193
|
+
isExitIntent = false,
|
|
194
|
+
montageRate
|
|
194
195
|
} = _ref5;
|
|
195
196
|
return _authenticatedProxyApi.authenticatedProxyApi.postQuotation({
|
|
196
197
|
isExitIntent,
|
|
@@ -205,7 +206,8 @@ const useCreatePrivateQuotationMutation = () => {
|
|
|
205
206
|
cart,
|
|
206
207
|
selectBoardComputerUpdate,
|
|
207
208
|
customer: customer,
|
|
208
|
-
branchId
|
|
209
|
+
branchId,
|
|
210
|
+
montageRate
|
|
209
211
|
});
|
|
210
212
|
});
|
|
211
213
|
return {
|
|
@@ -240,7 +242,8 @@ const useCreatePrivateAppointmentMutation = () => {
|
|
|
240
242
|
formula,
|
|
241
243
|
discount,
|
|
242
244
|
customerAgreed,
|
|
243
|
-
invoicePaymentByLeaseCompany
|
|
245
|
+
invoicePaymentByLeaseCompany,
|
|
246
|
+
montageRate
|
|
244
247
|
} = _ref6;
|
|
245
248
|
return _authenticatedProxyApi.authenticatedProxyApi.postAppointment({
|
|
246
249
|
appointment,
|
|
@@ -257,7 +260,8 @@ const useCreatePrivateAppointmentMutation = () => {
|
|
|
257
260
|
customer: customer,
|
|
258
261
|
branchId,
|
|
259
262
|
customerAgreed,
|
|
260
|
-
invoicePaymentByLeaseCompany
|
|
263
|
+
invoicePaymentByLeaseCompany,
|
|
264
|
+
montageRate
|
|
261
265
|
});
|
|
262
266
|
});
|
|
263
267
|
return {
|
|
@@ -291,7 +295,8 @@ const useCreatePrivateAppointmentRequestMutation = () => {
|
|
|
291
295
|
branchId,
|
|
292
296
|
formula,
|
|
293
297
|
discount,
|
|
294
|
-
customerAgreed
|
|
298
|
+
customerAgreed,
|
|
299
|
+
montageRate
|
|
295
300
|
} = _ref7;
|
|
296
301
|
return _authenticatedProxyApi.authenticatedProxyApi.postAppointmentRequest({
|
|
297
302
|
appointment,
|
|
@@ -307,7 +312,8 @@ const useCreatePrivateAppointmentRequestMutation = () => {
|
|
|
307
312
|
selectBoardComputerUpdate,
|
|
308
313
|
customer: customer,
|
|
309
314
|
branchId,
|
|
310
|
-
customerAgreed
|
|
315
|
+
customerAgreed,
|
|
316
|
+
montageRate
|
|
311
317
|
});
|
|
312
318
|
});
|
|
313
319
|
return {
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.regexp.to-string.js");
|
|
4
|
+
require("core-js/modules/es.weak-map.js");
|
|
5
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
6
|
+
require("core-js/modules/es.weak-map.js");
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
require("core-js/modules/es.regexp.to-string.js");
|
|
12
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _helpers__ = require("../../__helpers__");
|
|
15
|
+
var _ErrorMessage = _interopRequireDefault(require("./ErrorMessage"));
|
|
16
|
+
function _interopRequireDefault(e) {
|
|
17
|
+
return e && e.__esModule ? e : {
|
|
18
|
+
default: e
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function _getRequireWildcardCache(e) {
|
|
22
|
+
if ("function" != typeof WeakMap) return null;
|
|
23
|
+
var r = new WeakMap(),
|
|
24
|
+
t = new WeakMap();
|
|
25
|
+
return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
|
|
26
|
+
return e ? t : r;
|
|
27
|
+
})(e);
|
|
28
|
+
}
|
|
29
|
+
function _interopRequireWildcard(e, r) {
|
|
30
|
+
if (!r && e && e.__esModule) return e;
|
|
31
|
+
if (null === e || "object" != typeof e && "function" != typeof e) return {
|
|
32
|
+
default: e
|
|
33
|
+
};
|
|
34
|
+
var t = _getRequireWildcardCache(r);
|
|
35
|
+
if (t && t.has(e)) return t.get(e);
|
|
36
|
+
var n = {
|
|
37
|
+
__proto__: null
|
|
38
|
+
},
|
|
39
|
+
a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
40
|
+
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
41
|
+
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
42
|
+
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
43
|
+
}
|
|
44
|
+
return n.default = e, t && t.set(e, n), n;
|
|
45
|
+
}
|
|
46
|
+
const toDisplayValue = value => value === null || value === undefined ? '' : value.toString();
|
|
47
|
+
const DecimalInput = _ref => {
|
|
48
|
+
let {
|
|
49
|
+
placeholder = '',
|
|
50
|
+
initialValue = '',
|
|
51
|
+
value,
|
|
52
|
+
name,
|
|
53
|
+
onClick = () => {},
|
|
54
|
+
isDisabled = false,
|
|
55
|
+
onChange = () => {},
|
|
56
|
+
isRequired = true,
|
|
57
|
+
form,
|
|
58
|
+
label,
|
|
59
|
+
errorMessage = '',
|
|
60
|
+
className = '',
|
|
61
|
+
min,
|
|
62
|
+
max,
|
|
63
|
+
step = '0.01',
|
|
64
|
+
inputMode = 'decimal',
|
|
65
|
+
pattern = '-?[0-9]*[.,]?[0-9]*'
|
|
66
|
+
} = _ref;
|
|
67
|
+
const [localValue, setLocalValue] = (0, _react.useState)(toDisplayValue(initialValue));
|
|
68
|
+
const hasControlledValue = value !== undefined;
|
|
69
|
+
const displayValue = hasControlledValue ? toDisplayValue(value) : localValue;
|
|
70
|
+
(0, _react.useEffect)(() => {
|
|
71
|
+
setLocalValue(toDisplayValue(initialValue));
|
|
72
|
+
}, [initialValue]);
|
|
73
|
+
const handleChange = newValue => {
|
|
74
|
+
setLocalValue(newValue);
|
|
75
|
+
onChange(newValue);
|
|
76
|
+
};
|
|
77
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
78
|
+
className: (0, _helpers__.withStyle)("form-group ".concat(className))
|
|
79
|
+
}, label && /*#__PURE__*/_react.default.createElement("label", {
|
|
80
|
+
htmlFor: name,
|
|
81
|
+
className: (0, _helpers__.withStyle)('form-label')
|
|
82
|
+
}, label, isRequired && /*#__PURE__*/_react.default.createElement("span", null, "*")), /*#__PURE__*/_react.default.createElement("input", {
|
|
83
|
+
placeholder: placeholder,
|
|
84
|
+
name: name,
|
|
85
|
+
type: "number",
|
|
86
|
+
inputMode: inputMode,
|
|
87
|
+
pattern: pattern,
|
|
88
|
+
min: min,
|
|
89
|
+
max: max,
|
|
90
|
+
step: step,
|
|
91
|
+
onClick: onClick,
|
|
92
|
+
form: form,
|
|
93
|
+
value: displayValue,
|
|
94
|
+
disabled: isDisabled,
|
|
95
|
+
onChange: e => handleChange(e.target.value),
|
|
96
|
+
required: isRequired,
|
|
97
|
+
className: "".concat((0, _helpers__.withStyle)('form-control'), " ").concat(errorMessage ? (0, _helpers__.withStyle)('is-invalid') : '')
|
|
98
|
+
}), errorMessage && /*#__PURE__*/_react.default.createElement(_ErrorMessage.default, {
|
|
99
|
+
message: errorMessage
|
|
100
|
+
}));
|
|
101
|
+
};
|
|
102
|
+
var _default = exports.default = DecimalInput;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.VAT_RATE = exports.MARKET_CORRECTION_ARTICLE_NUMBER = exports.CART_TABLE_PRICE_CELL_CLASS = exports.CART_TABLE_DISPLAY_MODES = exports.CART_TABLE_BOLD_END_CLASS = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Display modes for the cart table:
|
|
9
|
+
* - DEFAULT: No purchase prices shown (7 columns)
|
|
10
|
+
* - TOGGLED_TMG: TMG with purchase prices (8 columns)
|
|
11
|
+
* - TOGGLED_STANDARD: Standard with purchase prices (9 columns)
|
|
12
|
+
*/
|
|
13
|
+
const CART_TABLE_DISPLAY_MODES = exports.CART_TABLE_DISPLAY_MODES = {
|
|
14
|
+
DEFAULT: 'default',
|
|
15
|
+
TOGGLED_TMG: 'toggled_tmg',
|
|
16
|
+
TOGGLED_STANDARD: 'toggled_standard'
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** CSS class for price cells in cart table */
|
|
20
|
+
const CART_TABLE_PRICE_CELL_CLASS = exports.CART_TABLE_PRICE_CELL_CLASS = 'cart__table-price text-end';
|
|
21
|
+
|
|
22
|
+
/** CSS class for bold end-aligned cells */
|
|
23
|
+
const CART_TABLE_BOLD_END_CLASS = exports.CART_TABLE_BOLD_END_CLASS = 'fw-bold text-end';
|
|
24
|
+
|
|
25
|
+
/** VAT rate for price calculations */
|
|
26
|
+
const VAT_RATE = exports.VAT_RATE = 1.21;
|
|
27
|
+
|
|
28
|
+
/** Market correction article number */
|
|
29
|
+
const MARKET_CORRECTION_ARTICLE_NUMBER = exports.MARKET_CORRECTION_ARTICLE_NUMBER = 'MC';
|
|
@@ -92,7 +92,11 @@ const ProductCartSide = () => {
|
|
|
92
92
|
selectedExtras,
|
|
93
93
|
canAlterQuantity,
|
|
94
94
|
selectedBranch,
|
|
95
|
-
vehicleCodingDiscountPercentage
|
|
95
|
+
vehicleCodingDiscountPercentage,
|
|
96
|
+
consumerDiscounts,
|
|
97
|
+
discountAmount,
|
|
98
|
+
discountPercentage,
|
|
99
|
+
montageRate
|
|
96
100
|
} = order;
|
|
97
101
|
const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
|
|
98
102
|
const cartInput = (0, _product.buildCartInput)({
|
|
@@ -102,7 +106,8 @@ const ProductCartSide = () => {
|
|
|
102
106
|
selectedBoardComputer,
|
|
103
107
|
selectedExtras,
|
|
104
108
|
isTowmotiveFormula: isTowmotive,
|
|
105
|
-
vehicleCodingDiscountPercentage
|
|
109
|
+
vehicleCodingDiscountPercentage,
|
|
110
|
+
consumerDiscounts
|
|
106
111
|
});
|
|
107
112
|
const {
|
|
108
113
|
cart,
|
|
@@ -118,7 +123,10 @@ const ProductCartSide = () => {
|
|
|
118
123
|
selectBoardComputerUpdate: selectedBoardComputer != null ? 'true' : 'false',
|
|
119
124
|
cart: cartInput ? JSON.stringify(cartInput) : undefined,
|
|
120
125
|
formula,
|
|
121
|
-
branchId: isToggled ? selectedBranch : undefined
|
|
126
|
+
branchId: isToggled ? selectedBranch : undefined,
|
|
127
|
+
discountAmount,
|
|
128
|
+
discountPercentage,
|
|
129
|
+
montageRate: montageRate !== null && montageRate !== void 0 ? montageRate : undefined
|
|
122
130
|
});
|
|
123
131
|
const marketCorrection = cart === null || cart === void 0 ? void 0 : cart.find(item => item.articleNumber === 'MC');
|
|
124
132
|
let mainProducts = [];
|
|
@@ -275,7 +283,7 @@ const ProductCartSide = () => {
|
|
|
275
283
|
text: isToggled ? 'Subtotaal (excl. btw)' : 'Subtotaal (incl. btw)',
|
|
276
284
|
className: 'fw-bold text-end pb-2'
|
|
277
285
|
}, {
|
|
278
|
-
text: isToggled ? (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalLocationPriceExclVat) : (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.
|
|
286
|
+
text: isToggled ? (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalLocationPriceExclVat) : (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalAfterDiscountInclVat),
|
|
279
287
|
className: 'fw-bold text-end pb-2'
|
|
280
288
|
}]
|
|
281
289
|
}), /*#__PURE__*/_react.default.createElement(_ProductTableTotal.default, {
|
|
@@ -283,7 +291,7 @@ const ProductCartSide = () => {
|
|
|
283
291
|
text: 'Producten (excl. btw)',
|
|
284
292
|
className: 'text-end pt-2'
|
|
285
293
|
}, {
|
|
286
|
-
text: isToggled ? (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalLocationPriceExclVat) : (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.
|
|
294
|
+
text: isToggled ? (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalLocationPriceExclVat) : (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalAfterDiscountExclVat),
|
|
287
295
|
className: 'text-end pt-2'
|
|
288
296
|
}], [{}, {
|
|
289
297
|
text: 'btw',
|