thm-p3-configurator 0.0.414 → 0.0.415
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.
|
@@ -9,7 +9,7 @@ describe('queryKeyFactory', () => {
|
|
|
9
9
|
internal: true
|
|
10
10
|
};
|
|
11
11
|
});
|
|
12
|
-
it('normalizes
|
|
12
|
+
it('normalizes buildYear into constructionYear without mutating input', () => {
|
|
13
13
|
const params = {
|
|
14
14
|
buildYear: '2024',
|
|
15
15
|
formula: 'THC',
|
|
@@ -19,7 +19,7 @@ describe('queryKeyFactory', () => {
|
|
|
19
19
|
};
|
|
20
20
|
const normalized = (0, _queryKeyFactory.normalizeOrderParams)(params);
|
|
21
21
|
expect(normalized).toEqual({
|
|
22
|
-
|
|
22
|
+
constructionYear: '2024',
|
|
23
23
|
formula: 'THC',
|
|
24
24
|
skipFilters: false,
|
|
25
25
|
discountAmount: 0,
|
|
@@ -33,13 +33,13 @@ describe('queryKeyFactory', () => {
|
|
|
33
33
|
priceCalculationDate: '2026-03-09'
|
|
34
34
|
});
|
|
35
35
|
});
|
|
36
|
-
it('
|
|
36
|
+
it('preserves constructionYear when buildYear is absent', () => {
|
|
37
37
|
expect((0, _queryKeyFactory.normalizeOrderParams)({
|
|
38
38
|
formula: 'THC',
|
|
39
39
|
constructionYear: '02/2020 tot heden'
|
|
40
40
|
})).toEqual({
|
|
41
41
|
formula: 'THC',
|
|
42
|
-
|
|
42
|
+
constructionYear: '02/2020 tot heden'
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
45
|
it('drops priceCalculationDate for external mode', () => {
|
|
@@ -70,7 +70,7 @@ describe('queryKeyFactory', () => {
|
|
|
70
70
|
cart: '[]',
|
|
71
71
|
buildYear: '2024'
|
|
72
72
|
});
|
|
73
|
-
expect(first).toBe('licensePlate=12AB34&formula=THC&
|
|
73
|
+
expect(first).toBe('licensePlate=12AB34&formula=THC&constructionYear=2024&durationAnswer=Lang&extraPriceAmount=10');
|
|
74
74
|
expect(second).toBe(first);
|
|
75
75
|
});
|
|
76
76
|
it('preserves legacy getOrder request semantics by omitting falsy values', () => {
|
|
@@ -69,7 +69,7 @@ function _toPrimitive(t, r) {
|
|
|
69
69
|
}
|
|
70
70
|
return ("string" === r ? String : Number)(t);
|
|
71
71
|
}
|
|
72
|
-
const ORDER_PARAM_PRIORITY = ['licensePlate', 'model', 'formula', '
|
|
72
|
+
const ORDER_PARAM_PRIORITY = ['licensePlate', 'model', 'formula', 'constructionYear', 'durationAnswer', 'executionAnswer1', 'executionAnswer2', 'selectBoardComputerUpdate', 'branchId', 'existingDossierEntityId', 'skipFilters', 'discountCode', 'discountAmount', 'discountPercentage', 'montageRate', 'extraPriceAmount', 'priceCalculationDate', 'cart'];
|
|
73
73
|
const removeNullishEntries = function removeNullishEntries() {
|
|
74
74
|
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
75
75
|
return Object.fromEntries(Object.entries(value).filter(_ref => {
|
|
@@ -94,10 +94,10 @@ const sortObjectKeys = function sortObjectKeys() {
|
|
|
94
94
|
const normalizeOrderParams = exports.normalizeOrderParams = function normalizeOrderParams() {
|
|
95
95
|
let orderParameters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
96
96
|
const normalizedParams = removeNullishEntries(_objectSpread({}, orderParameters));
|
|
97
|
-
if (normalizedParams.buildYear
|
|
98
|
-
normalizedParams.
|
|
97
|
+
if (normalizedParams.buildYear != null) {
|
|
98
|
+
normalizedParams.constructionYear = normalizedParams.buildYear;
|
|
99
|
+
delete normalizedParams.buildYear;
|
|
99
100
|
}
|
|
100
|
-
delete normalizedParams.constructionYear;
|
|
101
101
|
if (normalizedParams.selectBoardComputerUpdate === false || normalizedParams.selectBoardComputerUpdate === 'false') {
|
|
102
102
|
delete normalizedParams.selectBoardComputerUpdate;
|
|
103
103
|
}
|