thm-p3-configurator 0.0.423 → 0.0.426
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/__containers__/AppointmentForm.js +14 -5
- package/dist/src/shared/__containers__/BottomNavigationBar.js +6 -4
- package/dist/src/shared/__containers__/ExitIntentModal.js +14 -6
- package/dist/src/shared/__containers__/ProductCartSide.js +17 -3
- package/dist/src/shared/__containers__/ProductsCartOverview.js +17 -6
- package/dist/src/shared/__containers__/ProductsOverview.js +21 -4
- package/dist/src/shared/__containers__/QuotationForm.js +14 -5
- package/dist/src/shared/__containers__/internal/InternalAppointmentForm.js +14 -5
- package/dist/src/shared/__containers__/internal/InternalQuotationForm.js +14 -5
- package/dist/src/shared/__context__/OrderSessionContext.js +36 -7
- package/dist/src/shared/__helpers__/__tests__/dossier.test.js +68 -0
- package/dist/src/shared/__helpers__/__tests__/product.test.js +0 -8
- package/dist/src/shared/__helpers__/dossier.js +27 -9
- package/dist/src/shared/__helpers__/product.js +41 -23
- package/package.json +1 -1
- package/dist/src/shared/__components__/ProductCard/index.js +0 -228
- package/dist/src/shared/__components__/ProductTable/ProductTableEditableRow.js +0 -66
- package/dist/src/shared/__components__/ProductTable/ProductTableHead.js +0 -32
- package/dist/src/shared/__components__/ProductTable/ProductTableSection.js +0 -25
- package/dist/src/shared/__components__/ProductTable/ProductTableSectionTotal.js +0 -46
- package/dist/src/shared/__components__/ProductTable/ProductTableStaticRow.js +0 -47
- package/dist/src/shared/__components__/ProductTable/ProductTableTotal.js +0 -41
- package/dist/src/shared/__components__/ProductTable/index.js +0 -127
- package/dist/src/shared/__components__/SingleOrderCartCard.js +0 -79
- package/dist/src/shared/__components__/SingleOrderProductCard.js +0 -360
- package/dist/src/shared/__components__/Spinners/FullPageSpinner.js +0 -73
- package/dist/src/shared/__components__/Spinners/InlineSpinner.js +0 -26
- package/dist/src/shared/__components__/Spinners/TextSpinner.js +0 -31
- package/dist/src/shared/__components__/UspsList.js +0 -27
|
@@ -148,6 +148,9 @@ const AppointmentForm = () => {
|
|
|
148
148
|
buildYear,
|
|
149
149
|
durationAnswer,
|
|
150
150
|
selectedBoardComputer,
|
|
151
|
+
initialSelectedBoardComputer,
|
|
152
|
+
isBoardComputerSelectionResolved,
|
|
153
|
+
isBoardComputerTouched,
|
|
151
154
|
selectedCableset,
|
|
152
155
|
selectedCombiset,
|
|
153
156
|
selectedTowbar,
|
|
@@ -175,6 +178,12 @@ const AppointmentForm = () => {
|
|
|
175
178
|
} = (0, _mutations.useCreateAppointmentRequestMutation)();
|
|
176
179
|
const formula = (0, _FormulaContext.useFormula)();
|
|
177
180
|
const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
|
|
181
|
+
const boardComputerSelection = {
|
|
182
|
+
selectedBoardComputer,
|
|
183
|
+
initialSelectedBoardComputer,
|
|
184
|
+
isBoardComputerTouched,
|
|
185
|
+
isBoardComputerSelectionResolved
|
|
186
|
+
};
|
|
178
187
|
const history = (0, _reactRouter.useHistory)();
|
|
179
188
|
const handleSubmit = async () => {
|
|
180
189
|
(0, _Datalayer.pushToDataLayer)({
|
|
@@ -212,7 +221,7 @@ const AppointmentForm = () => {
|
|
|
212
221
|
})),
|
|
213
222
|
formula,
|
|
214
223
|
branchId: selectedBranch,
|
|
215
|
-
selectBoardComputerUpdate:
|
|
224
|
+
selectBoardComputerUpdate: (0, _product.shouldSelectBoardComputerUpdate)(boardComputerSelection),
|
|
216
225
|
skipFilters,
|
|
217
226
|
discount: (() => {
|
|
218
227
|
if (!(discountCode !== null && discountCode !== void 0 && discountCode.length)) return null;
|
|
@@ -221,16 +230,16 @@ const AppointmentForm = () => {
|
|
|
221
230
|
code: discountCode
|
|
222
231
|
};
|
|
223
232
|
})(),
|
|
224
|
-
cart: (0, _product.buildCartInput)({
|
|
233
|
+
cart: (0, _product.buildCartInput)(_objectSpread(_objectSpread({
|
|
225
234
|
selectedCableset,
|
|
226
235
|
selectedCombiset,
|
|
227
|
-
selectedTowbar
|
|
228
|
-
|
|
236
|
+
selectedTowbar
|
|
237
|
+
}, boardComputerSelection), {}, {
|
|
229
238
|
selectedExtras,
|
|
230
239
|
selectedDiscountedProducts,
|
|
231
240
|
isTowmotiveFormula: isTowmotive,
|
|
232
241
|
vehicleCodingDiscountPercentage
|
|
233
|
-
})
|
|
242
|
+
}))
|
|
234
243
|
});
|
|
235
244
|
await createAppointmentRequest(appointmentRequestPayload);
|
|
236
245
|
(0, _Datalayer.pushToDataLayer)({
|
|
@@ -100,7 +100,8 @@ const BottomNavigationBar = () => {
|
|
|
100
100
|
selectedBranch,
|
|
101
101
|
existingDossierType,
|
|
102
102
|
allowLocationChange,
|
|
103
|
-
currentDossierType
|
|
103
|
+
currentDossierType,
|
|
104
|
+
isBoardComputerSelectionResolved
|
|
104
105
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
105
106
|
if (!existingDossierType && (history === null || history === void 0 || (_history$location2 = history.location) === null || _history$location2 === void 0 ? void 0 : _history$location2.pathname) == '/configurator/overzicht') {
|
|
106
107
|
dispatch({
|
|
@@ -122,7 +123,7 @@ const BottomNavigationBar = () => {
|
|
|
122
123
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
123
124
|
className: (0, _helpers__.withStyle)('row justify-content-center')
|
|
124
125
|
}, buttons.map(_ref2 => {
|
|
125
|
-
var _history$location3, _history$location4, _history$location5;
|
|
126
|
+
var _history$location3, _history$location4, _history$location5, _history$location6;
|
|
126
127
|
let {
|
|
127
128
|
to,
|
|
128
129
|
label,
|
|
@@ -144,6 +145,7 @@ const BottomNavigationBar = () => {
|
|
|
144
145
|
to = '/configurator/gegevens';
|
|
145
146
|
}
|
|
146
147
|
const component = COMPONENT_BY_PATH[history === null || history === void 0 || (_history$location3 = history.location) === null || _history$location3 === void 0 ? void 0 : _history$location3.pathname];
|
|
148
|
+
const isWaitingForBoardComputerSelection = existingDossierType && (history === null || history === void 0 || (_history$location4 = history.location) === null || _history$location4 === void 0 ? void 0 : _history$location4.pathname) === '/configurator/trekhaakpakket' && !isBoardComputerSelectionResolved;
|
|
147
149
|
const handleClick = () => {
|
|
148
150
|
if (component) {
|
|
149
151
|
(0, _Datalayer.pushToDataLayer)({
|
|
@@ -165,7 +167,7 @@ const BottomNavigationBar = () => {
|
|
|
165
167
|
}
|
|
166
168
|
};
|
|
167
169
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
168
|
-
key: "link-".concat(history === null || history === void 0 || (_history$
|
|
170
|
+
key: "link-".concat(history === null || history === void 0 || (_history$location5 = history.location) === null || _history$location5 === void 0 ? void 0 : _history$location5.pathname, "-").concat(label, "-").concat(to, "-").concat(type),
|
|
169
171
|
className: (0, _helpers__.withStyle)("col-12 col-sm-auto d-flex order-2 order-sm-0 justify-content-".concat(buttons.length > 1 ? 'center' : 'end', " mt-1"))
|
|
170
172
|
}, /*#__PURE__*/_react.default.createElement(ButtonByType, {
|
|
171
173
|
onClick: handleClick,
|
|
@@ -175,7 +177,7 @@ const BottomNavigationBar = () => {
|
|
|
175
177
|
state: {
|
|
176
178
|
prevPathName: history.location.pathname
|
|
177
179
|
},
|
|
178
|
-
isDisabled: (!selectedCableset || !selectedTowbar) && !selectedCombiset && type === 'next' || type === 'next' && (history === null || history === void 0 || (_history$
|
|
180
|
+
isDisabled: (!selectedCableset || !selectedTowbar) && !selectedCombiset && type === 'next' || type === 'next' && isWaitingForBoardComputerSelection || type === 'next' && (history === null || history === void 0 || (_history$location6 = history.location) === null || _history$location6 === void 0 ? void 0 : _history$location6.pathname) === '/configurator/montagelocatie' && !selectedBranch
|
|
179
181
|
}));
|
|
180
182
|
})))))));
|
|
181
183
|
};
|
|
@@ -136,6 +136,9 @@ const ExitIntentModal = () => {
|
|
|
136
136
|
buildYear,
|
|
137
137
|
durationAnswer,
|
|
138
138
|
selectedBoardComputer,
|
|
139
|
+
initialSelectedBoardComputer,
|
|
140
|
+
isBoardComputerSelectionResolved,
|
|
141
|
+
isBoardComputerTouched,
|
|
139
142
|
selectedCableset,
|
|
140
143
|
selectedCombiset,
|
|
141
144
|
selectedTowbar,
|
|
@@ -143,7 +146,6 @@ const ExitIntentModal = () => {
|
|
|
143
146
|
discountCode,
|
|
144
147
|
executionAnswer1,
|
|
145
148
|
executionAnswer2,
|
|
146
|
-
priceCalculationDate,
|
|
147
149
|
selectedDiscountedProducts = [],
|
|
148
150
|
selectedExtras,
|
|
149
151
|
vehicleCodingDiscountPercentage,
|
|
@@ -151,6 +153,12 @@ const ExitIntentModal = () => {
|
|
|
151
153
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
152
154
|
const formula = (0, _FormulaContext.useFormula)();
|
|
153
155
|
const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
|
|
156
|
+
const boardComputerSelection = {
|
|
157
|
+
selectedBoardComputer,
|
|
158
|
+
initialSelectedBoardComputer,
|
|
159
|
+
isBoardComputerTouched,
|
|
160
|
+
isBoardComputerSelectionResolved
|
|
161
|
+
};
|
|
154
162
|
(0, _react.useEffect)(() => {
|
|
155
163
|
(0, _ui.scrollToFirstErrorMessage)();
|
|
156
164
|
}, [errors]);
|
|
@@ -229,18 +237,18 @@ const ExitIntentModal = () => {
|
|
|
229
237
|
lastName: (_customer$lastName = customer === null || customer === void 0 ? void 0 : customer.lastName) !== null && _customer$lastName !== void 0 ? _customer$lastName : undefined
|
|
230
238
|
})),
|
|
231
239
|
branchId: selectedBranch,
|
|
232
|
-
selectBoardComputerUpdate:
|
|
240
|
+
selectBoardComputerUpdate: (0, _product.shouldSelectBoardComputerUpdate)(boardComputerSelection),
|
|
233
241
|
skipFilters,
|
|
234
|
-
cart: (0, _product.buildCartInput)({
|
|
242
|
+
cart: (0, _product.buildCartInput)(_objectSpread(_objectSpread({
|
|
235
243
|
selectedCableset,
|
|
236
244
|
selectedCombiset,
|
|
237
|
-
selectedTowbar
|
|
238
|
-
|
|
245
|
+
selectedTowbar
|
|
246
|
+
}, boardComputerSelection), {}, {
|
|
239
247
|
selectedExtras,
|
|
240
248
|
selectedDiscountedProducts,
|
|
241
249
|
isTowmotiveFormula: isTowmotive,
|
|
242
250
|
vehicleCodingDiscountPercentage
|
|
243
|
-
})
|
|
251
|
+
}))
|
|
244
252
|
}));
|
|
245
253
|
(0, _Datalayer.pushToDataLayer)({
|
|
246
254
|
event: 'form',
|
|
@@ -93,6 +93,9 @@ const ProductCartSide = () => {
|
|
|
93
93
|
selectedCableset,
|
|
94
94
|
selectedCombiset,
|
|
95
95
|
selectedBoardComputer,
|
|
96
|
+
initialSelectedBoardComputer,
|
|
97
|
+
isBoardComputerSelectionResolved,
|
|
98
|
+
isBoardComputerTouched,
|
|
96
99
|
allArticleNumbers,
|
|
97
100
|
existingDossierId,
|
|
98
101
|
selectedExtras,
|
|
@@ -106,7 +109,8 @@ const ProductCartSide = () => {
|
|
|
106
109
|
montageRate,
|
|
107
110
|
extraPriceAmount,
|
|
108
111
|
discountCode,
|
|
109
|
-
priceCalculationDate
|
|
112
|
+
priceCalculationDate,
|
|
113
|
+
skipFilters
|
|
110
114
|
} = order;
|
|
111
115
|
const isTmg = (0, _useIsTmg.useIsTmg)();
|
|
112
116
|
const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
|
|
@@ -116,13 +120,18 @@ const ProductCartSide = () => {
|
|
|
116
120
|
selectedCombiset,
|
|
117
121
|
selectedTowbar,
|
|
118
122
|
selectedBoardComputer,
|
|
123
|
+
initialSelectedBoardComputer,
|
|
124
|
+
isBoardComputerTouched,
|
|
125
|
+
isBoardComputerSelectionResolved,
|
|
119
126
|
selectedExtras,
|
|
120
127
|
isTowmotiveFormula: isTowmotive,
|
|
121
128
|
vehicleCodingDiscountPercentage,
|
|
122
129
|
consumerDiscounts,
|
|
123
130
|
touchedConsumerDiscounts
|
|
124
131
|
});
|
|
125
|
-
|
|
132
|
+
// Use the session skipFilters so this query matches the product page's;
|
|
133
|
+
// an unfiltered request can return a different catalogue than the page.
|
|
134
|
+
const shouldRequestUnfilteredProducts = skipFilters || Boolean(existingDossierId && (allArticleNumbers === null || allArticleNumbers === void 0 ? void 0 : allArticleNumbers.length) > 0);
|
|
126
135
|
const {
|
|
127
136
|
cart,
|
|
128
137
|
totals,
|
|
@@ -136,7 +145,12 @@ const ProductCartSide = () => {
|
|
|
136
145
|
executionAnswer2,
|
|
137
146
|
durationAnswer: durationAnswerForQuery,
|
|
138
147
|
buildYear,
|
|
139
|
-
selectBoardComputerUpdate:
|
|
148
|
+
selectBoardComputerUpdate: (0, _product.shouldSelectBoardComputerUpdate)({
|
|
149
|
+
selectedBoardComputer,
|
|
150
|
+
initialSelectedBoardComputer,
|
|
151
|
+
isBoardComputerTouched,
|
|
152
|
+
isBoardComputerSelectionResolved
|
|
153
|
+
}) ? 'true' : 'false',
|
|
140
154
|
cart: cartInput ? JSON.stringify(cartInput) : undefined,
|
|
141
155
|
formula,
|
|
142
156
|
branchId: isToggled ? selectedBranch : undefined,
|
|
@@ -263,6 +263,9 @@ const ProductCartTable = () => {
|
|
|
263
263
|
selectedCableset,
|
|
264
264
|
selectedCombiset,
|
|
265
265
|
selectedBoardComputer,
|
|
266
|
+
initialSelectedBoardComputer,
|
|
267
|
+
isBoardComputerSelectionResolved,
|
|
268
|
+
isBoardComputerTouched,
|
|
266
269
|
selectedExtras,
|
|
267
270
|
executionAnswer1,
|
|
268
271
|
allArticleNumbers,
|
|
@@ -277,7 +280,8 @@ const ProductCartTable = () => {
|
|
|
277
280
|
touchedConsumerDiscounts,
|
|
278
281
|
montageRate,
|
|
279
282
|
isMontageTariffFixed,
|
|
280
|
-
extraPriceAmount
|
|
283
|
+
extraPriceAmount,
|
|
284
|
+
skipFilters
|
|
281
285
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
282
286
|
|
|
283
287
|
// Determine display mode
|
|
@@ -342,16 +346,18 @@ const ProductCartTable = () => {
|
|
|
342
346
|
selectedCombiset,
|
|
343
347
|
selectedTowbar,
|
|
344
348
|
selectedBoardComputer,
|
|
349
|
+
initialSelectedBoardComputer,
|
|
350
|
+
isBoardComputerTouched,
|
|
351
|
+
isBoardComputerSelectionResolved,
|
|
345
352
|
selectedExtras,
|
|
346
353
|
isTowmotiveFormula: isTowmotive,
|
|
347
354
|
vehicleCodingDiscountPercentage,
|
|
348
355
|
consumerDiscounts,
|
|
349
356
|
touchedConsumerDiscounts
|
|
350
357
|
});
|
|
351
|
-
//
|
|
352
|
-
//
|
|
353
|
-
|
|
354
|
-
const shouldRequestUnfilteredProducts = (0, _product.shouldRequestUnfilteredProductsForCart)(cartInput) || Boolean(existingDossierId && (allArticleNumbers === null || allArticleNumbers === void 0 ? void 0 : allArticleNumbers.length) > 0);
|
|
358
|
+
// Use the session skipFilters so this query matches the product page's;
|
|
359
|
+
// an unfiltered request can return a different catalogue than the page.
|
|
360
|
+
const shouldRequestUnfilteredProducts = skipFilters || Boolean(existingDossierId && (allArticleNumbers === null || allArticleNumbers === void 0 ? void 0 : allArticleNumbers.length) > 0);
|
|
355
361
|
const durationAnswerForQuery = durationAnswerIsPrefilled ? undefined : durationAnswer;
|
|
356
362
|
const {
|
|
357
363
|
cart,
|
|
@@ -366,7 +372,12 @@ const ProductCartTable = () => {
|
|
|
366
372
|
executionAnswer2,
|
|
367
373
|
durationAnswer: durationAnswerForQuery,
|
|
368
374
|
buildYear,
|
|
369
|
-
selectBoardComputerUpdate:
|
|
375
|
+
selectBoardComputerUpdate: (0, _product.shouldSelectBoardComputerUpdate)({
|
|
376
|
+
selectedBoardComputer,
|
|
377
|
+
initialSelectedBoardComputer,
|
|
378
|
+
isBoardComputerTouched,
|
|
379
|
+
isBoardComputerSelectionResolved
|
|
380
|
+
}) ? 'true' : 'false',
|
|
370
381
|
cart: JSON.stringify(cartInput || []),
|
|
371
382
|
branchId: isToggled ? selectedBranch : null,
|
|
372
383
|
discountAmount,
|
|
@@ -88,6 +88,9 @@ const ProductsOverview = () => {
|
|
|
88
88
|
selectedCombiset,
|
|
89
89
|
selectedExtras,
|
|
90
90
|
selectedBoardComputer,
|
|
91
|
+
initialSelectedBoardComputer,
|
|
92
|
+
isBoardComputerSelectionResolved,
|
|
93
|
+
isBoardComputerTouched,
|
|
91
94
|
isBoardComputerDeselected,
|
|
92
95
|
discountCode,
|
|
93
96
|
priceCalculationDate,
|
|
@@ -108,6 +111,9 @@ const ProductsOverview = () => {
|
|
|
108
111
|
selectedCombiset,
|
|
109
112
|
selectedTowbar,
|
|
110
113
|
selectedBoardComputer,
|
|
114
|
+
initialSelectedBoardComputer,
|
|
115
|
+
isBoardComputerTouched,
|
|
116
|
+
isBoardComputerSelectionResolved,
|
|
111
117
|
selectedExtras,
|
|
112
118
|
isTowmotiveFormula: isTowmotive,
|
|
113
119
|
vehicleCodingDiscountPercentage,
|
|
@@ -126,7 +132,12 @@ const ProductsOverview = () => {
|
|
|
126
132
|
executionAnswer2,
|
|
127
133
|
durationAnswer: durationAnswerForQuery,
|
|
128
134
|
buildYear,
|
|
129
|
-
selectBoardComputerUpdate:
|
|
135
|
+
selectBoardComputerUpdate: (0, _product.shouldSelectBoardComputerUpdate)({
|
|
136
|
+
selectedBoardComputer,
|
|
137
|
+
initialSelectedBoardComputer,
|
|
138
|
+
isBoardComputerTouched,
|
|
139
|
+
isBoardComputerSelectionResolved
|
|
140
|
+
}) ? 'true' : 'false',
|
|
130
141
|
cart: cartInput ? JSON.stringify(cartInput) : undefined,
|
|
131
142
|
formula,
|
|
132
143
|
discountCode,
|
|
@@ -227,11 +238,16 @@ const ProductsOverview = () => {
|
|
|
227
238
|
dispatch({
|
|
228
239
|
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_BOARDCOMPUTER,
|
|
229
240
|
payload: {
|
|
230
|
-
id: boardComputerId
|
|
241
|
+
id: boardComputerId,
|
|
242
|
+
userModified: false
|
|
231
243
|
}
|
|
232
244
|
});
|
|
245
|
+
} else if (!isLoadingProducts && !isBoardComputerSelectionResolved) {
|
|
246
|
+
dispatch({
|
|
247
|
+
type: _OrderSessionContext.orderSessionActions.SET_BOARDCOMPUTER_SELECTION_RESOLVED
|
|
248
|
+
});
|
|
233
249
|
}
|
|
234
|
-
}, [isLoadingProducts, products, selectedTowbar, selectedCableset, selectedBoardComputer, isBoardComputerDeselected, existingDossierId, dispatch]);
|
|
250
|
+
}, [isLoadingProducts, products, selectedTowbar, selectedCableset, selectedBoardComputer, initialSelectedBoardComputer, isBoardComputerSelectionResolved, isBoardComputerTouched, isBoardComputerDeselected, existingDossierId, dispatch]);
|
|
235
251
|
if (isProductsError || !isLoadingProducts && (!(products !== null && products !== void 0 && (_products$Trekhaak4 = products.Trekhaak) !== null && _products$Trekhaak4 !== void 0 && _products$Trekhaak4.length) || !(products !== null && products !== void 0 && (_products$Kabelset = products.Kabelset) !== null && _products$Kabelset !== void 0 && _products$Kabelset.length)) && !(products !== null && products !== void 0 && (_products$Combiset = products.Combiset) !== null && _products$Combiset !== void 0 && _products$Combiset.length)) {
|
|
236
252
|
return /*#__PURE__*/_react.default.createElement(_reactRouter.Redirect, {
|
|
237
253
|
to: "/configurator/geen-producten"
|
|
@@ -342,7 +358,8 @@ const ProductsOverview = () => {
|
|
|
342
358
|
dispatch({
|
|
343
359
|
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_BOARDCOMPUTER,
|
|
344
360
|
payload: {
|
|
345
|
-
id: isSelected ? productId : null
|
|
361
|
+
id: isSelected ? productId : null,
|
|
362
|
+
userModified: true
|
|
346
363
|
}
|
|
347
364
|
});
|
|
348
365
|
break;
|
|
@@ -141,6 +141,9 @@ const QuotationForm = () => {
|
|
|
141
141
|
buildYear,
|
|
142
142
|
durationAnswer,
|
|
143
143
|
selectedBoardComputer,
|
|
144
|
+
initialSelectedBoardComputer,
|
|
145
|
+
isBoardComputerSelectionResolved,
|
|
146
|
+
isBoardComputerTouched,
|
|
144
147
|
selectedCableset,
|
|
145
148
|
selectedCombiset,
|
|
146
149
|
executionAnswer1,
|
|
@@ -164,6 +167,12 @@ const QuotationForm = () => {
|
|
|
164
167
|
} = (0, _mutations.useCreateQuotationMutation)();
|
|
165
168
|
const formula = (0, _FormulaContext.useFormula)();
|
|
166
169
|
const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
|
|
170
|
+
const boardComputerSelection = {
|
|
171
|
+
selectedBoardComputer,
|
|
172
|
+
initialSelectedBoardComputer,
|
|
173
|
+
isBoardComputerTouched,
|
|
174
|
+
isBoardComputerSelectionResolved
|
|
175
|
+
};
|
|
167
176
|
(0, _react.useEffect)(() => {
|
|
168
177
|
(0, _ui.scrollToFirstErrorMessage)();
|
|
169
178
|
}, [errors]);
|
|
@@ -214,18 +223,18 @@ const QuotationForm = () => {
|
|
|
214
223
|
formula,
|
|
215
224
|
customer: (0, _helpers__.removeNullishProps)(customer),
|
|
216
225
|
branchId: selectedBranch,
|
|
217
|
-
selectBoardComputerUpdate:
|
|
226
|
+
selectBoardComputerUpdate: (0, _product.shouldSelectBoardComputerUpdate)(boardComputerSelection),
|
|
218
227
|
skipFilters,
|
|
219
|
-
cart: (0, _product.buildCartInput)({
|
|
228
|
+
cart: (0, _product.buildCartInput)(_objectSpread(_objectSpread({
|
|
220
229
|
selectedCableset,
|
|
221
230
|
selectedCombiset,
|
|
222
|
-
selectedTowbar
|
|
223
|
-
|
|
231
|
+
selectedTowbar
|
|
232
|
+
}, boardComputerSelection), {}, {
|
|
224
233
|
selectedExtras,
|
|
225
234
|
selectedDiscountedProducts,
|
|
226
235
|
isTowmotiveFormula: isTowmotive,
|
|
227
236
|
vehicleCodingDiscountPercentage
|
|
228
|
-
})
|
|
237
|
+
}))
|
|
229
238
|
}));
|
|
230
239
|
} catch (ex) {
|
|
231
240
|
(0, _Datalayer.pushToDataLayer)({
|
|
@@ -249,6 +249,9 @@ const InternalAppointmentForm = _ref => {
|
|
|
249
249
|
allowLocationChange,
|
|
250
250
|
existingDossierId,
|
|
251
251
|
selectedBoardComputer,
|
|
252
|
+
initialSelectedBoardComputer,
|
|
253
|
+
isBoardComputerSelectionResolved,
|
|
254
|
+
isBoardComputerTouched,
|
|
252
255
|
selectedCableset,
|
|
253
256
|
selectedCombiset,
|
|
254
257
|
selectedTowbar,
|
|
@@ -523,6 +526,12 @@ const InternalAppointmentForm = _ref => {
|
|
|
523
526
|
const formula = (0, _FormulaContext.useFormula)();
|
|
524
527
|
const showBranchAutofillLink = [_constants__.CONFIGURATOR_FORMULAS.TOW, _constants__.CONFIGURATOR_FORMULAS.TMG, _constants__.CONFIGURATOR_FORMULAS.TowMotive].includes(formula);
|
|
525
528
|
const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
|
|
529
|
+
const boardComputerSelection = {
|
|
530
|
+
selectedBoardComputer,
|
|
531
|
+
initialSelectedBoardComputer,
|
|
532
|
+
isBoardComputerTouched,
|
|
533
|
+
isBoardComputerSelectionResolved
|
|
534
|
+
};
|
|
526
535
|
(0, _react.useEffect)(() => {
|
|
527
536
|
(0, _ui.scrollToFirstErrorMessage)();
|
|
528
537
|
}, [errors]);
|
|
@@ -671,20 +680,20 @@ const InternalAppointmentForm = _ref => {
|
|
|
671
680
|
formula
|
|
672
681
|
}), {}, {
|
|
673
682
|
branchId: selectedBranch,
|
|
674
|
-
selectBoardComputerUpdate:
|
|
683
|
+
selectBoardComputerUpdate: (0, _product.shouldSelectBoardComputerUpdate)(boardComputerSelection),
|
|
675
684
|
skipFilters,
|
|
676
|
-
cart: (0, _product.buildCartInput)({
|
|
685
|
+
cart: (0, _product.buildCartInput)(_objectSpread(_objectSpread({
|
|
677
686
|
selectedCableset,
|
|
678
687
|
selectedCombiset,
|
|
679
|
-
selectedTowbar
|
|
680
|
-
|
|
688
|
+
selectedTowbar
|
|
689
|
+
}, boardComputerSelection), {}, {
|
|
681
690
|
selectedExtras,
|
|
682
691
|
selectedDiscountedProducts,
|
|
683
692
|
isTowmotiveFormula: isTowmotive,
|
|
684
693
|
vehicleCodingDiscountPercentage,
|
|
685
694
|
consumerDiscounts,
|
|
686
695
|
touchedConsumerDiscounts
|
|
687
|
-
}),
|
|
696
|
+
})),
|
|
688
697
|
montageRate: montageRate !== null && montageRate !== void 0 ? montageRate : undefined
|
|
689
698
|
}));
|
|
690
699
|
payload.vehicle = _objectSpread(_objectSpread({}, payload.vehicle), {}, {
|
|
@@ -227,6 +227,9 @@ const InternalQuotationForm = _ref => {
|
|
|
227
227
|
existingDossierId,
|
|
228
228
|
buildYear,
|
|
229
229
|
selectedBoardComputer,
|
|
230
|
+
initialSelectedBoardComputer,
|
|
231
|
+
isBoardComputerSelectionResolved,
|
|
232
|
+
isBoardComputerTouched,
|
|
230
233
|
selectedCableset,
|
|
231
234
|
selectedCombiset,
|
|
232
235
|
selectedTowbar,
|
|
@@ -399,6 +402,12 @@ const InternalQuotationForm = _ref => {
|
|
|
399
402
|
}, [isTmg, marketingChannels, channel === null || channel === void 0 ? void 0 : channel.channelId, dispatch]);
|
|
400
403
|
const formula = (0, _FormulaContext.useFormula)();
|
|
401
404
|
const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
|
|
405
|
+
const boardComputerSelection = {
|
|
406
|
+
selectedBoardComputer,
|
|
407
|
+
initialSelectedBoardComputer,
|
|
408
|
+
isBoardComputerTouched,
|
|
409
|
+
isBoardComputerSelectionResolved
|
|
410
|
+
};
|
|
402
411
|
const isBusinessOwnership = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk;
|
|
403
412
|
const isLeaseOwnership = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij;
|
|
404
413
|
const {
|
|
@@ -579,20 +588,20 @@ const InternalQuotationForm = _ref => {
|
|
|
579
588
|
formula
|
|
580
589
|
}), {}, {
|
|
581
590
|
branchId: selectedBranch,
|
|
582
|
-
selectBoardComputerUpdate:
|
|
591
|
+
selectBoardComputerUpdate: (0, _product.shouldSelectBoardComputerUpdate)(boardComputerSelection),
|
|
583
592
|
skipFilters,
|
|
584
|
-
cart: (0, _product.buildCartInput)({
|
|
593
|
+
cart: (0, _product.buildCartInput)(_objectSpread(_objectSpread({
|
|
585
594
|
selectedCableset,
|
|
586
595
|
selectedCombiset,
|
|
587
|
-
selectedTowbar
|
|
588
|
-
|
|
596
|
+
selectedTowbar
|
|
597
|
+
}, boardComputerSelection), {}, {
|
|
589
598
|
selectedExtras,
|
|
590
599
|
selectedDiscountedProducts,
|
|
591
600
|
isTowmotiveFormula: isTowmotive,
|
|
592
601
|
vehicleCodingDiscountPercentage,
|
|
593
602
|
consumerDiscounts,
|
|
594
603
|
touchedConsumerDiscounts
|
|
595
|
-
}),
|
|
604
|
+
})),
|
|
596
605
|
montageRate: montageRate !== null && montageRate !== void 0 ? montageRate : undefined
|
|
597
606
|
}));
|
|
598
607
|
payload.vehicle = _objectSpread(_objectSpread({}, payload.vehicle), {}, {
|
|
@@ -156,6 +156,9 @@ const INITIAL_ORDER_SESSION_STATE = {
|
|
|
156
156
|
touchedConsumerDiscounts: {},
|
|
157
157
|
montageRate: null,
|
|
158
158
|
isMontageTariffFixed: false,
|
|
159
|
+
initialSelectedBoardComputer: null,
|
|
160
|
+
isBoardComputerSelectionResolved: true,
|
|
161
|
+
isBoardComputerTouched: false,
|
|
159
162
|
vehicle: {
|
|
160
163
|
ownershipType: _constants__.VEHICLE_OWNERSHIP_TYPE.Particulier,
|
|
161
164
|
singleOrderOwnershipType: null,
|
|
@@ -250,6 +253,7 @@ const orderSessionActions = exports.orderSessionActions = {
|
|
|
250
253
|
REMOVE_SINGLE_ORDER_PRODUCT: 'REMOVE_SINGLE_ORDER_PRODUCT',
|
|
251
254
|
UPDATE_EXTRA_QUANTITY: 'UPDATE_EXTRA_QUANTITY',
|
|
252
255
|
SET_SELECTED_BOARDCOMPUTER: 'SET_IS_BOARDCOMPUTER_DESELECTED',
|
|
256
|
+
SET_BOARDCOMPUTER_SELECTION_RESOLVED: 'SET_BOARDCOMPUTER_SELECTION_RESOLVED',
|
|
253
257
|
SET_SELECTED_BRANCH: 'SET_SELECTED_BRANCH',
|
|
254
258
|
SET_CUSTOMER_FIRST_NAME: 'SET_CUSTOMER_FIRST_NAME',
|
|
255
259
|
SET_CUSTOMER_LAST_NAME: 'SET_CUSTOMER_LAST_NAME',
|
|
@@ -339,6 +343,9 @@ const orderSessionReducer = (state, action) => {
|
|
|
339
343
|
skipFilters: false,
|
|
340
344
|
selectedDiscountedProducts: [],
|
|
341
345
|
selectedBoardComputer: null,
|
|
346
|
+
initialSelectedBoardComputer: null,
|
|
347
|
+
isBoardComputerSelectionResolved: true,
|
|
348
|
+
isBoardComputerTouched: false,
|
|
342
349
|
isBoardComputerDeselected: false,
|
|
343
350
|
singleOrderCart: singleOrderCart || INITIAL_ORDER_SESSION_STATE.singleOrderCart,
|
|
344
351
|
discountCode: discountCode || INITIAL_ORDER_SESSION_STATE.discountCode,
|
|
@@ -354,16 +361,24 @@ const orderSessionReducer = (state, action) => {
|
|
|
354
361
|
}
|
|
355
362
|
case orderSessionActions.INITIALIZE_EXISTING_ORDER:
|
|
356
363
|
{
|
|
357
|
-
var _existingOrder$vehicl, _existingOrder$consum, _existingOrder$touche;
|
|
364
|
+
var _ref, _existingOrder$initia, _existingOrder$vehicl, _existingOrder$consum, _existingOrder$touche;
|
|
358
365
|
const {
|
|
359
366
|
existingOrder,
|
|
360
367
|
existingDossierId,
|
|
361
368
|
existingDossierType
|
|
362
369
|
} = action.payload;
|
|
370
|
+
const initialSelectedBoardComputer = (_ref = (_existingOrder$initia = existingOrder === null || existingOrder === void 0 ? void 0 : existingOrder.initialSelectedBoardComputer) !== null && _existingOrder$initia !== void 0 ? _existingOrder$initia : existingOrder === null || existingOrder === void 0 ? void 0 : existingOrder.selectedBoardComputer) !== null && _ref !== void 0 ? _ref : null;
|
|
363
371
|
return _objectSpread(_objectSpread({}, existingOrder), {}, {
|
|
364
372
|
isTouched: true,
|
|
365
373
|
existingDossierId,
|
|
366
374
|
existingDossierType,
|
|
375
|
+
initialSelectedBoardComputer,
|
|
376
|
+
// Existing dossiers start unresolved: the trekhaakpakket page must
|
|
377
|
+
// finish loading its products (which resolves the board computer
|
|
378
|
+
// selection) before the user may continue to the next step.
|
|
379
|
+
isBoardComputerSelectionResolved: false,
|
|
380
|
+
isBoardComputerTouched: false,
|
|
381
|
+
isBoardComputerDeselected: (existingOrder === null || existingOrder === void 0 ? void 0 : existingOrder.isBoardComputerDeselected) || initialSelectedBoardComputer == null,
|
|
367
382
|
vehicleCodingDiscountPercentage: (_existingOrder$vehicl = existingOrder === null || existingOrder === void 0 ? void 0 : existingOrder.vehicleCodingDiscountPercentage) !== null && _existingOrder$vehicl !== void 0 ? _existingOrder$vehicl : null,
|
|
368
383
|
consumerDiscounts: (_existingOrder$consum = existingOrder === null || existingOrder === void 0 ? void 0 : existingOrder.consumerDiscounts) !== null && _existingOrder$consum !== void 0 ? _existingOrder$consum : {},
|
|
369
384
|
touchedConsumerDiscounts: (_existingOrder$touche = existingOrder === null || existingOrder === void 0 ? void 0 : existingOrder.touchedConsumerDiscounts) !== null && _existingOrder$touche !== void 0 ? _existingOrder$touche : {}
|
|
@@ -554,6 +569,8 @@ const orderSessionReducer = (state, action) => {
|
|
|
554
569
|
selectedCombiset: combisetId,
|
|
555
570
|
selectedTowbar: null,
|
|
556
571
|
selectedBoardComputer: null,
|
|
572
|
+
isBoardComputerSelectionResolved: true,
|
|
573
|
+
isBoardComputerTouched: true,
|
|
557
574
|
selectedCableset: null
|
|
558
575
|
});
|
|
559
576
|
}
|
|
@@ -604,20 +621,32 @@ const orderSessionReducer = (state, action) => {
|
|
|
604
621
|
case orderSessionActions.SET_SELECTED_BOARDCOMPUTER:
|
|
605
622
|
{
|
|
606
623
|
const {
|
|
607
|
-
id
|
|
624
|
+
id,
|
|
625
|
+
userModified = true
|
|
608
626
|
} = action.payload;
|
|
609
627
|
|
|
610
628
|
// Show warning first
|
|
611
|
-
if (!state.isBoardComputerDeselected && id == null) {
|
|
629
|
+
if (userModified && !state.isBoardComputerDeselected && id == null) {
|
|
612
630
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
631
|
+
isBoardComputerSelectionResolved: true,
|
|
632
|
+
isBoardComputerTouched: true,
|
|
613
633
|
isBoardComputerDeselected: true,
|
|
614
634
|
selectedBoardComputer: null
|
|
615
635
|
});
|
|
616
636
|
}
|
|
617
637
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
638
|
+
isBoardComputerSelectionResolved: true,
|
|
639
|
+
isBoardComputerTouched: userModified ? true : state.isBoardComputerTouched,
|
|
640
|
+
isBoardComputerDeselected: userModified && id != null ? false : state.isBoardComputerDeselected,
|
|
618
641
|
selectedBoardComputer: id
|
|
619
642
|
});
|
|
620
643
|
}
|
|
644
|
+
case orderSessionActions.SET_BOARDCOMPUTER_SELECTION_RESOLVED:
|
|
645
|
+
{
|
|
646
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
647
|
+
isBoardComputerSelectionResolved: true
|
|
648
|
+
});
|
|
649
|
+
}
|
|
621
650
|
case orderSessionActions.REMOVE_SINGLE_ORDER_PRODUCT:
|
|
622
651
|
{
|
|
623
652
|
const {
|
|
@@ -1407,11 +1436,11 @@ const initializeOrderSession = function initializeOrderSession() {
|
|
|
1407
1436
|
}
|
|
1408
1437
|
return cachedSession;
|
|
1409
1438
|
};
|
|
1410
|
-
const AuthSessionRuntimeSync =
|
|
1439
|
+
const AuthSessionRuntimeSync = _ref2 => {
|
|
1411
1440
|
var _branch$entityId;
|
|
1412
1441
|
let {
|
|
1413
1442
|
authMode = 'internal'
|
|
1414
|
-
} =
|
|
1443
|
+
} = _ref2;
|
|
1415
1444
|
const {
|
|
1416
1445
|
authenticated,
|
|
1417
1446
|
initialized,
|
|
@@ -1485,13 +1514,13 @@ const AuthSessionRuntimeSync = _ref => {
|
|
|
1485
1514
|
}, [authRuntime, authenticated, initialized, authHeaderBranchId, formula, module, isExternalAuthMode]);
|
|
1486
1515
|
return null;
|
|
1487
1516
|
};
|
|
1488
|
-
const OrderSessionController =
|
|
1517
|
+
const OrderSessionController = _ref3 => {
|
|
1489
1518
|
let {
|
|
1490
1519
|
children,
|
|
1491
1520
|
authMode = 'internal',
|
|
1492
1521
|
externalAuthSession = null,
|
|
1493
1522
|
externalAuthRuntime = null
|
|
1494
|
-
} =
|
|
1523
|
+
} = _ref3;
|
|
1495
1524
|
const isSingleOrderPage = (0, _useIsSingleOrder.default)();
|
|
1496
1525
|
const isExternalAuthMode = authMode === 'external' || Boolean(externalAuthSession);
|
|
1497
1526
|
const runtimeMode = isExternalAuthMode ? 'external' : 'internal';
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _dossier = require("../dossier");
|
|
4
|
+
describe('dossier helpers', () => {
|
|
5
|
+
it('extracts the active boardcomputer update from the order article match', () => {
|
|
6
|
+
const result = (0, _dossier.extractSessionProductsByOrder)({
|
|
7
|
+
lines: [{
|
|
8
|
+
articleNumber: 'BC-1',
|
|
9
|
+
activeArticle: true,
|
|
10
|
+
quantity: 1,
|
|
11
|
+
name: 'Voertuigcodering'
|
|
12
|
+
}],
|
|
13
|
+
orderProducts: {
|
|
14
|
+
towbars: [],
|
|
15
|
+
cablesets: [],
|
|
16
|
+
combisets: [],
|
|
17
|
+
extras: [],
|
|
18
|
+
discountCode: []
|
|
19
|
+
},
|
|
20
|
+
boardComputerUpdate: {
|
|
21
|
+
articleNumber: 'BC-1'
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
expect(result.selectedBoardComputer).toBe('BC-1');
|
|
25
|
+
expect(result.initialSelectedBoardComputer).toBe('BC-1');
|
|
26
|
+
});
|
|
27
|
+
it('falls back to an unclassified active vehicle coding line', () => {
|
|
28
|
+
const result = (0, _dossier.extractSessionProductsByOrder)({
|
|
29
|
+
lines: [{
|
|
30
|
+
articleNumber: 'BC-2',
|
|
31
|
+
activeArticle: true,
|
|
32
|
+
quantity: 1,
|
|
33
|
+
name: 'Voertuigcodering trekhaak'
|
|
34
|
+
}],
|
|
35
|
+
orderProducts: {
|
|
36
|
+
towbars: [],
|
|
37
|
+
cablesets: [],
|
|
38
|
+
combisets: [],
|
|
39
|
+
extras: [],
|
|
40
|
+
discountCode: []
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
expect(result.selectedBoardComputer).toBe('BC-2');
|
|
44
|
+
expect(result.initialSelectedBoardComputer).toBe('BC-2');
|
|
45
|
+
});
|
|
46
|
+
it('does not treat a classified boardcomputer cableset as vehicle coding', () => {
|
|
47
|
+
const result = (0, _dossier.extractSessionProductsByOrder)({
|
|
48
|
+
lines: [{
|
|
49
|
+
articleNumber: 'CABLESET-1',
|
|
50
|
+
activeArticle: true,
|
|
51
|
+
quantity: 1,
|
|
52
|
+
boardComputer: true
|
|
53
|
+
}],
|
|
54
|
+
orderProducts: {
|
|
55
|
+
towbars: [],
|
|
56
|
+
cablesets: [{
|
|
57
|
+
articleNumber: 'CABLESET-1'
|
|
58
|
+
}],
|
|
59
|
+
combisets: [],
|
|
60
|
+
extras: [],
|
|
61
|
+
discountCode: []
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
expect(result.selectedCableset).toBe('CABLESET-1');
|
|
65
|
+
expect(result.selectedBoardComputer).toBe(null);
|
|
66
|
+
expect(result.initialSelectedBoardComputer).toBe(null);
|
|
67
|
+
});
|
|
68
|
+
});
|