thm-p3-configurator 0.0.418 → 0.0.419
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/__api__/mutations.js +4 -29
- package/dist/src/shared/__components__/SingleOrderProductCard.js +2 -6
- package/dist/src/shared/__containers__/AppointmentForm.js +12 -16
- package/dist/src/shared/__containers__/ExitIntentModal.js +16 -29
- package/dist/src/shared/__containers__/ProductCartSide.js +5 -6
- package/dist/src/shared/__containers__/ProductsCartOverview.js +5 -14
- package/dist/src/shared/__containers__/ProductsOverview.js +16 -53
- package/dist/src/shared/__containers__/QuotationForm.js +12 -16
- package/dist/src/shared/__containers__/StyleWrapper.js +0 -1
- package/dist/src/shared/__containers__/internal/InternalAppointmentForm.js +1 -3
- package/dist/src/shared/__containers__/internal/InternalQuotationForm.js +1 -3
- package/dist/src/shared/__containers__/internal/InternalSingleOrderProductOverview.js +1 -5
- package/dist/src/shared/__context__/OrderSessionContext.js +5 -49
- package/dist/src/shared/__helpers__/__tests__/product.test.js +7 -33
- package/dist/src/shared/__helpers__/product.js +22 -25
- package/dist/src/shared/__pages__/internal/InternalSessionEditPage.js +1 -1
- package/dist/src/shared/__pages__/internal/InternalSingleOrderPage.js +8 -22
- package/package.json +1 -1
- package/dist/src/shared/__helpers__/prospectTracking.js +0 -39
- package/dist/src/shared/__helpers__/singleOrderVehicleReceipt.js +0 -117
- package/dist/src/shared/__style__/datepicker-global.scss +0 -3
|
@@ -106,9 +106,7 @@ const useCreateQuotationMutation = () => {
|
|
|
106
106
|
formula,
|
|
107
107
|
discount,
|
|
108
108
|
vehicle,
|
|
109
|
-
|
|
110
|
-
isExitIntent = false,
|
|
111
|
-
prospectId
|
|
109
|
+
isExitIntent = false
|
|
112
110
|
} = _ref;
|
|
113
111
|
return _publicProxyApi.publicProxyApi.postQuotation({
|
|
114
112
|
isExitIntent,
|
|
@@ -120,11 +118,9 @@ const useCreateQuotationMutation = () => {
|
|
|
120
118
|
discount,
|
|
121
119
|
answers: answers,
|
|
122
120
|
cart: cart,
|
|
123
|
-
skipFilters,
|
|
124
121
|
selectBoardComputerUpdate: selectBoardComputerUpdate,
|
|
125
122
|
customer: customer,
|
|
126
|
-
branchId
|
|
127
|
-
prospectId
|
|
123
|
+
branchId
|
|
128
124
|
});
|
|
129
125
|
});
|
|
130
126
|
return {
|
|
@@ -146,7 +142,6 @@ const useCreateAppointmentRequestMutation = () => {
|
|
|
146
142
|
licensePlate,
|
|
147
143
|
model,
|
|
148
144
|
constructionYear,
|
|
149
|
-
prospectId,
|
|
150
145
|
answers,
|
|
151
146
|
cart,
|
|
152
147
|
selectBoardComputerUpdate,
|
|
@@ -154,8 +149,7 @@ const useCreateAppointmentRequestMutation = () => {
|
|
|
154
149
|
vehicle,
|
|
155
150
|
discount,
|
|
156
151
|
formula,
|
|
157
|
-
branchId
|
|
158
|
-
skipFilters
|
|
152
|
+
branchId
|
|
159
153
|
} = _ref2;
|
|
160
154
|
return _publicProxyApi.publicProxyApi.postAppointmentRequest({
|
|
161
155
|
model,
|
|
@@ -164,13 +158,11 @@ const useCreateAppointmentRequestMutation = () => {
|
|
|
164
158
|
formula,
|
|
165
159
|
answers: answers,
|
|
166
160
|
cart: cart,
|
|
167
|
-
skipFilters,
|
|
168
161
|
selectBoardComputerUpdate: selectBoardComputerUpdate,
|
|
169
162
|
customer,
|
|
170
163
|
branchId,
|
|
171
164
|
discount,
|
|
172
|
-
vehicle
|
|
173
|
-
prospectId
|
|
165
|
+
vehicle
|
|
174
166
|
});
|
|
175
167
|
}, {});
|
|
176
168
|
return {
|
|
@@ -192,7 +184,6 @@ const useCreateSingleOrderMutation = () => {
|
|
|
192
184
|
let {
|
|
193
185
|
licensePlate,
|
|
194
186
|
model,
|
|
195
|
-
answers,
|
|
196
187
|
cart,
|
|
197
188
|
customer,
|
|
198
189
|
channel,
|
|
@@ -209,7 +200,6 @@ const useCreateSingleOrderMutation = () => {
|
|
|
209
200
|
return _authenticatedProxyApi.authenticatedProxyApi.postSingleOrder({
|
|
210
201
|
licensePlate,
|
|
211
202
|
model,
|
|
212
|
-
answers,
|
|
213
203
|
cart,
|
|
214
204
|
customer,
|
|
215
205
|
channel,
|
|
@@ -243,7 +233,6 @@ const useCreateShopifyOrderMutation = () => {
|
|
|
243
233
|
let {
|
|
244
234
|
licensePlate,
|
|
245
235
|
model,
|
|
246
|
-
answers,
|
|
247
236
|
cart,
|
|
248
237
|
customer,
|
|
249
238
|
channel,
|
|
@@ -260,7 +249,6 @@ const useCreateShopifyOrderMutation = () => {
|
|
|
260
249
|
return _authenticatedProxyApi.authenticatedProxyApi.postShopifyOrder({
|
|
261
250
|
licensePlate,
|
|
262
251
|
model,
|
|
263
|
-
answers,
|
|
264
252
|
cart,
|
|
265
253
|
customer,
|
|
266
254
|
channel,
|
|
@@ -309,7 +297,6 @@ const useCreatePrivateQuotationMutation = () => {
|
|
|
309
297
|
extraPrice,
|
|
310
298
|
isExitIntent = false,
|
|
311
299
|
montageRate,
|
|
312
|
-
skipFilters,
|
|
313
300
|
leasemaatschappijEntityId,
|
|
314
301
|
leasemaatschappijBedrijfsnaam,
|
|
315
302
|
leasemaatschappijContactpersoonNaam,
|
|
@@ -339,7 +326,6 @@ const useCreatePrivateQuotationMutation = () => {
|
|
|
339
326
|
extraPrice,
|
|
340
327
|
answers,
|
|
341
328
|
cart,
|
|
342
|
-
skipFilters,
|
|
343
329
|
selectBoardComputerUpdate,
|
|
344
330
|
customer: restCustomer,
|
|
345
331
|
branchId,
|
|
@@ -368,7 +354,6 @@ const useCreatePrivateQuotationMutation = () => {
|
|
|
368
354
|
extraPrice,
|
|
369
355
|
answers,
|
|
370
356
|
cart,
|
|
371
|
-
skipFilters,
|
|
372
357
|
selectBoardComputerUpdate,
|
|
373
358
|
customer: restCustomer,
|
|
374
359
|
branchId,
|
|
@@ -434,7 +419,6 @@ const useCreatePrivateAppointmentMutation = () => {
|
|
|
434
419
|
extraPrice,
|
|
435
420
|
customerAgreed,
|
|
436
421
|
montageRate,
|
|
437
|
-
skipFilters,
|
|
438
422
|
leasemaatschappijEntityId,
|
|
439
423
|
leasemaatschappijBedrijfsnaam,
|
|
440
424
|
leasemaatschappijContactpersoonNaam,
|
|
@@ -465,7 +449,6 @@ const useCreatePrivateAppointmentMutation = () => {
|
|
|
465
449
|
extraPrice,
|
|
466
450
|
answers,
|
|
467
451
|
cart,
|
|
468
|
-
skipFilters,
|
|
469
452
|
selectBoardComputerUpdate,
|
|
470
453
|
customer: restCustomer,
|
|
471
454
|
branchId,
|
|
@@ -530,7 +513,6 @@ const useCreatePrivateAppointmentRequestMutation = () => {
|
|
|
530
513
|
discount,
|
|
531
514
|
customerAgreed,
|
|
532
515
|
montageRate,
|
|
533
|
-
skipFilters,
|
|
534
516
|
leasemaatschappijEntityId,
|
|
535
517
|
leasemaatschappijBedrijfsnaam,
|
|
536
518
|
leasemaatschappijContactpersoonNaam,
|
|
@@ -559,7 +541,6 @@ const useCreatePrivateAppointmentRequestMutation = () => {
|
|
|
559
541
|
discount,
|
|
560
542
|
answers,
|
|
561
543
|
cart,
|
|
562
|
-
skipFilters,
|
|
563
544
|
selectBoardComputerUpdate,
|
|
564
545
|
customer: restCustomer,
|
|
565
546
|
branchId,
|
|
@@ -622,7 +603,6 @@ const useUpdatePrivateAppointmentRequestByIdMutation = id => {
|
|
|
622
603
|
priceCalculationDate,
|
|
623
604
|
customerAgreed,
|
|
624
605
|
montageRate,
|
|
625
|
-
skipFilters,
|
|
626
606
|
leasemaatschappijEntityId,
|
|
627
607
|
leasemaatschappijBedrijfsnaam,
|
|
628
608
|
leasemaatschappijContactpersoonNaam,
|
|
@@ -661,7 +641,6 @@ const useUpdatePrivateAppointmentRequestByIdMutation = id => {
|
|
|
661
641
|
discount,
|
|
662
642
|
answers,
|
|
663
643
|
cart,
|
|
664
|
-
skipFilters,
|
|
665
644
|
selectBoardComputerUpdate,
|
|
666
645
|
customer: restCustomer,
|
|
667
646
|
branchId,
|
|
@@ -715,7 +694,6 @@ const useUpdatePrivateQuotationByIdMutation = id => {
|
|
|
715
694
|
extraPrice,
|
|
716
695
|
priceCalculationDate,
|
|
717
696
|
montageRate,
|
|
718
|
-
skipFilters,
|
|
719
697
|
leasemaatschappijEntityId,
|
|
720
698
|
leasemaatschappijBedrijfsnaam,
|
|
721
699
|
leasemaatschappijContactpersoonNaam,
|
|
@@ -754,7 +732,6 @@ const useUpdatePrivateQuotationByIdMutation = id => {
|
|
|
754
732
|
extraPrice,
|
|
755
733
|
answers,
|
|
756
734
|
cart,
|
|
757
|
-
skipFilters,
|
|
758
735
|
selectBoardComputerUpdate,
|
|
759
736
|
customer: restCustomer,
|
|
760
737
|
branchId,
|
|
@@ -809,7 +786,6 @@ const useUpdatePrivateAppointmentByIdMutation = id => {
|
|
|
809
786
|
customerAgreed,
|
|
810
787
|
invoicePaymentByLeaseCompany,
|
|
811
788
|
montageRate,
|
|
812
|
-
skipFilters,
|
|
813
789
|
leasemaatschappijEntityId,
|
|
814
790
|
leasemaatschappijBedrijfsnaam,
|
|
815
791
|
leasemaatschappijContactpersoonNaam,
|
|
@@ -849,7 +825,6 @@ const useUpdatePrivateAppointmentByIdMutation = id => {
|
|
|
849
825
|
extraPrice,
|
|
850
826
|
answers,
|
|
851
827
|
cart,
|
|
852
|
-
skipFilters,
|
|
853
828
|
selectBoardComputerUpdate,
|
|
854
829
|
customer: _objectSpread(_objectSpread({}, restCustomer), {}, {
|
|
855
830
|
invoicePaymentByLeaseCompany
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.number.to-fixed.js");
|
|
4
3
|
require("core-js/modules/es.promise.js");
|
|
5
4
|
require("core-js/modules/es.string.trim.js");
|
|
6
5
|
require("core-js/modules/es.weak-map.js");
|
|
@@ -17,7 +16,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
17
16
|
value: true
|
|
18
17
|
});
|
|
19
18
|
exports.default = void 0;
|
|
20
|
-
require("core-js/modules/es.number.to-fixed.js");
|
|
21
19
|
require("core-js/modules/es.promise.js");
|
|
22
20
|
require("core-js/modules/es.string.trim.js");
|
|
23
21
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
@@ -220,8 +218,6 @@ const SingleOrderProductCard = _ref4 => {
|
|
|
220
218
|
productTitle,
|
|
221
219
|
productPrice,
|
|
222
220
|
productPriceInclVat,
|
|
223
|
-
locationPriceExclVat = null,
|
|
224
|
-
consumerPriceExclVat = null,
|
|
225
221
|
productBrandNumber,
|
|
226
222
|
productSpecifications,
|
|
227
223
|
quantity = 0,
|
|
@@ -319,8 +315,8 @@ const SingleOrderProductCard = _ref4 => {
|
|
|
319
315
|
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h5", {
|
|
320
316
|
className: (0, _helpers__.withStyle)('card-title mb-3')
|
|
321
317
|
}, productTitle, /*#__PURE__*/_react.default.createElement("span", {
|
|
322
|
-
className: (0, _helpers__.withStyle)('ms-2
|
|
323
|
-
},
|
|
318
|
+
className: (0, _helpers__.withStyle)('ms-2')
|
|
319
|
+
}, "\u20AC", productPrice)), /*#__PURE__*/_react.default.createElement("div", {
|
|
324
320
|
className: (0, _helpers__.withStyle)(isModelArticle ? 'd-flex justify-content-between' : '')
|
|
325
321
|
}, (productSubgroup || articleNumber || preferredPart) && /*#__PURE__*/_react.default.createElement(ProductCategories, {
|
|
326
322
|
brandName: brandName,
|
|
@@ -40,7 +40,6 @@ var _constants__ = require("../__constants__");
|
|
|
40
40
|
var _FormulaContext = require("../__context__/FormulaContext");
|
|
41
41
|
var _OrderSessionContext = require("../__context__/OrderSessionContext");
|
|
42
42
|
var _helpers__ = require("../__helpers__");
|
|
43
|
-
var _prospectTracking = require("../__helpers__/prospectTracking");
|
|
44
43
|
var _Datalayer = require("../__services__/Datalayer");
|
|
45
44
|
var _product = require("../__helpers__/product");
|
|
46
45
|
var _useDebouncedPush = _interopRequireDefault(require("../__hooks__/useDebouncedPush"));
|
|
@@ -160,13 +159,10 @@ const AppointmentForm = () => {
|
|
|
160
159
|
priceCalculationDate,
|
|
161
160
|
selectedDiscountedProducts = [],
|
|
162
161
|
selectedExtras,
|
|
163
|
-
vehicleCodingDiscountPercentage
|
|
164
|
-
skipFilters
|
|
162
|
+
vehicleCodingDiscountPercentage
|
|
165
163
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
166
164
|
const [errors, setErrors] = (0, _react.useState)({});
|
|
167
165
|
const [isTermsAccepted, setIsTermsAccepted] = (0, _react.useState)(false);
|
|
168
|
-
const hasTrackedValidSubmitRef = (0, _react.useRef)(false);
|
|
169
|
-
const prospectIdRef = (0, _react.useRef)(null);
|
|
170
166
|
const trackInput = (0, _useDebouncedPush.default)();
|
|
171
167
|
const APPOINTMENT_REQUEST_ERROR_FALLBACK = 'Er is een fout opgetreden bij het maken van de afspraak, probeer het opnieuw.';
|
|
172
168
|
const {
|
|
@@ -197,10 +193,7 @@ const AppointmentForm = () => {
|
|
|
197
193
|
strict: false,
|
|
198
194
|
abortEarly: false
|
|
199
195
|
});
|
|
200
|
-
const prospectId = (0, _prospectTracking.createProspectId)();
|
|
201
|
-
prospectIdRef.current = prospectId;
|
|
202
196
|
const appointmentRequestPayload = (0, _helpers__.removeNullishProps)({
|
|
203
|
-
prospectId,
|
|
204
197
|
licensePlate: licensePlate === null || licensePlate === void 0 ? void 0 : licensePlate.replace(/-/g, ''),
|
|
205
198
|
model,
|
|
206
199
|
constructionYear: buildYear !== null && buildYear !== void 0 ? buildYear : undefined,
|
|
@@ -219,7 +212,6 @@ const AppointmentForm = () => {
|
|
|
219
212
|
formula,
|
|
220
213
|
branchId: selectedBranch,
|
|
221
214
|
selectBoardComputerUpdate: selectedBoardComputer != null,
|
|
222
|
-
skipFilters,
|
|
223
215
|
discount: (() => {
|
|
224
216
|
if (!(discountCode !== null && discountCode !== void 0 && discountCode.length)) return null;
|
|
225
217
|
if (discountCode.toLocaleLowerCase().includes('anwb') && !anwbDiscountValidated) return null;
|
|
@@ -239,6 +231,17 @@ const AppointmentForm = () => {
|
|
|
239
231
|
})
|
|
240
232
|
});
|
|
241
233
|
await createAppointmentRequest(appointmentRequestPayload);
|
|
234
|
+
(0, _Datalayer.pushToDataLayer)({
|
|
235
|
+
event: 'form',
|
|
236
|
+
component: 'afspraak',
|
|
237
|
+
element: 'button',
|
|
238
|
+
action: 'submit',
|
|
239
|
+
action_value: 'valid'
|
|
240
|
+
});
|
|
241
|
+
(0, _Datalayer.pushToDataLayer)({
|
|
242
|
+
event: 'form_submit',
|
|
243
|
+
form_name: 'config_afspraak'
|
|
244
|
+
});
|
|
242
245
|
} catch (ex) {
|
|
243
246
|
(0, _Datalayer.pushToDataLayer)({
|
|
244
247
|
event: 'form',
|
|
@@ -257,13 +260,6 @@ const AppointmentForm = () => {
|
|
|
257
260
|
}
|
|
258
261
|
};
|
|
259
262
|
if (isCreateAppointmentRequestSuccess) {
|
|
260
|
-
if (!hasTrackedValidSubmitRef.current) {
|
|
261
|
-
hasTrackedValidSubmitRef.current = true;
|
|
262
|
-
(0, _prospectTracking.pushProspectCreated)({
|
|
263
|
-
formName: 'afspraak',
|
|
264
|
-
prospectId: prospectIdRef.current
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
263
|
return /*#__PURE__*/_react.default.createElement(_reactRouter.Redirect, {
|
|
268
264
|
to: {
|
|
269
265
|
pathname: "/configurator/gegevens/bedankt",
|
|
@@ -37,7 +37,6 @@ var _Datalayer = require("../__services__/Datalayer");
|
|
|
37
37
|
var _product = require("../__helpers__/product");
|
|
38
38
|
var _ui = require("../__helpers__/ui");
|
|
39
39
|
var _useIsTowmotive = require("../__hooks__/useIsTowmotive");
|
|
40
|
-
var _prospectTracking = require("../__helpers__/prospectTracking");
|
|
41
40
|
function _interopRequireDefault(e) {
|
|
42
41
|
return e && e.__esModule ? e : {
|
|
43
42
|
default: e
|
|
@@ -126,7 +125,6 @@ const ExitIntentModal = () => {
|
|
|
126
125
|
const [errors, setErrors] = (0, _react.useState)(null);
|
|
127
126
|
const hasTrackedOpenRef = (0, _react.useRef)(false);
|
|
128
127
|
const hasTrackedValidSubmitRef = (0, _react.useRef)(false);
|
|
129
|
-
const prospectIdRef = (0, _react.useRef)(null);
|
|
130
128
|
const inputDebounceRefs = (0, _react.useRef)({
|
|
131
129
|
email: null,
|
|
132
130
|
phoneNumber: null
|
|
@@ -145,37 +143,16 @@ const ExitIntentModal = () => {
|
|
|
145
143
|
discountCode,
|
|
146
144
|
executionAnswer1,
|
|
147
145
|
executionAnswer2,
|
|
146
|
+
priceCalculationDate,
|
|
148
147
|
selectedDiscountedProducts = [],
|
|
149
148
|
selectedExtras,
|
|
150
|
-
vehicleCodingDiscountPercentage
|
|
151
|
-
skipFilters
|
|
149
|
+
vehicleCodingDiscountPercentage
|
|
152
150
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
153
151
|
const formula = (0, _FormulaContext.useFormula)();
|
|
154
152
|
const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
|
|
155
153
|
(0, _react.useEffect)(() => {
|
|
156
154
|
(0, _ui.scrollToFirstErrorMessage)();
|
|
157
155
|
}, [errors]);
|
|
158
|
-
(0, _react.useEffect)(() => {
|
|
159
|
-
if (!isCreateQuotationSuccess || hasTrackedValidSubmitRef.current) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
hasTrackedValidSubmitRef.current = true;
|
|
163
|
-
(0, _Datalayer.pushToDataLayer)({
|
|
164
|
-
event: 'form',
|
|
165
|
-
component: 'exit_intent',
|
|
166
|
-
element: 'button',
|
|
167
|
-
action: 'submit',
|
|
168
|
-
action_value: 'valid'
|
|
169
|
-
});
|
|
170
|
-
(0, _prospectTracking.pushProspectCreated)({
|
|
171
|
-
formName: 'offerte',
|
|
172
|
-
prospectId: prospectIdRef.current
|
|
173
|
-
});
|
|
174
|
-
(0, _Datalayer.pushToDataLayer)({
|
|
175
|
-
event: 'form_submit',
|
|
176
|
-
form_name: 'config_exitintent'
|
|
177
|
-
});
|
|
178
|
-
}, [isCreateQuotationSuccess]);
|
|
179
156
|
const handleMouseLeave = event => {
|
|
180
157
|
if (document.cookie.includes('exitIntentModalShown=true')) {
|
|
181
158
|
return;
|
|
@@ -232,10 +209,7 @@ const ExitIntentModal = () => {
|
|
|
232
209
|
strict: false,
|
|
233
210
|
abortEarly: false
|
|
234
211
|
});
|
|
235
|
-
const prospectId = (0, _prospectTracking.createProspectId)();
|
|
236
|
-
prospectIdRef.current = prospectId;
|
|
237
212
|
await createQuotation((0, _helpers__.removeNullishProps)({
|
|
238
|
-
prospectId,
|
|
239
213
|
isExitIntent: true,
|
|
240
214
|
licensePlate,
|
|
241
215
|
model,
|
|
@@ -255,7 +229,6 @@ const ExitIntentModal = () => {
|
|
|
255
229
|
})),
|
|
256
230
|
branchId: selectedBranch,
|
|
257
231
|
selectBoardComputerUpdate: selectedBoardComputer != null,
|
|
258
|
-
skipFilters,
|
|
259
232
|
cart: (0, _product.buildCartInput)({
|
|
260
233
|
selectedCableset,
|
|
261
234
|
selectedCombiset,
|
|
@@ -267,6 +240,20 @@ const ExitIntentModal = () => {
|
|
|
267
240
|
vehicleCodingDiscountPercentage
|
|
268
241
|
})
|
|
269
242
|
}));
|
|
243
|
+
(0, _Datalayer.pushToDataLayer)({
|
|
244
|
+
event: 'form',
|
|
245
|
+
component: 'exit_intent',
|
|
246
|
+
element: 'button',
|
|
247
|
+
action: 'submit',
|
|
248
|
+
action_value: 'valid'
|
|
249
|
+
});
|
|
250
|
+
if (!hasTrackedValidSubmitRef.current) {
|
|
251
|
+
hasTrackedValidSubmitRef.current = true;
|
|
252
|
+
(0, _Datalayer.pushToDataLayer)({
|
|
253
|
+
event: 'form_submit',
|
|
254
|
+
form_name: 'config_exitintent'
|
|
255
|
+
});
|
|
256
|
+
}
|
|
270
257
|
} catch (ex) {
|
|
271
258
|
(0, _Datalayer.pushToDataLayer)({
|
|
272
259
|
event: 'form',
|
|
@@ -94,7 +94,6 @@ const ProductCartSide = () => {
|
|
|
94
94
|
selectedCombiset,
|
|
95
95
|
selectedBoardComputer,
|
|
96
96
|
allArticleNumbers,
|
|
97
|
-
existingDossierId,
|
|
98
97
|
selectedExtras,
|
|
99
98
|
canAlterQuantity,
|
|
100
99
|
selectedBranch,
|
|
@@ -122,7 +121,7 @@ const ProductCartSide = () => {
|
|
|
122
121
|
consumerDiscounts,
|
|
123
122
|
touchedConsumerDiscounts
|
|
124
123
|
});
|
|
125
|
-
const shouldRequestUnfilteredProducts = (0, _product.shouldRequestUnfilteredProductsForCart)(cartInput)
|
|
124
|
+
const shouldRequestUnfilteredProducts = (0, _product.shouldRequestUnfilteredProductsForCart)(cartInput);
|
|
126
125
|
const {
|
|
127
126
|
cart,
|
|
128
127
|
totals,
|
|
@@ -159,10 +158,10 @@ const ProductCartSide = () => {
|
|
|
159
158
|
let mainProducts = [];
|
|
160
159
|
let accessoireProducts = [];
|
|
161
160
|
if (products) {
|
|
162
|
-
var _products$Trekhaak, _products$
|
|
163
|
-
const towbar = selectedTowbar && ((_products$Trekhaak = products.Trekhaak) === null || _products$Trekhaak === void 0 ? void 0 : _products$Trekhaak.find(product => product.articleNumber === selectedTowbar)) ||
|
|
164
|
-
const combiset = selectedCombiset && ((_products$Combiset = products.Combiset) === null || _products$Combiset === void 0 ? void 0 : _products$Combiset.find(product => product.articleNumber === selectedCombiset)) ||
|
|
165
|
-
const cableset = selectedCableset && ((_products$Kabelset = products.Kabelset) === null || _products$Kabelset === void 0 ? void 0 : _products$Kabelset.find(product => product.articleNumber === selectedCableset)) ||
|
|
161
|
+
var _products$Trekhaak, _products$Combiset, _products$Kabelset, _products$Elektronica, _products$Extras;
|
|
162
|
+
const towbar = selectedTowbar && ((_products$Trekhaak = products.Trekhaak) === null || _products$Trekhaak === void 0 ? void 0 : _products$Trekhaak.find(product => product.articleNumber === selectedTowbar)) || null;
|
|
163
|
+
const combiset = selectedCombiset && ((_products$Combiset = products.Combiset) === null || _products$Combiset === void 0 ? void 0 : _products$Combiset.find(product => product.articleNumber === selectedCombiset)) || null;
|
|
164
|
+
const cableset = selectedCableset && ((_products$Kabelset = products.Kabelset) === null || _products$Kabelset === void 0 ? void 0 : _products$Kabelset.find(product => product.articleNumber === selectedCableset)) || null;
|
|
166
165
|
const boardComputer = selectedBoardComputer && ((_products$Elektronica = products['Elektronica boordcomputer updaten']) === null || _products$Elektronica === void 0 ? void 0 : _products$Elektronica.find(product => product.articleNumber === selectedBoardComputer)) || null;
|
|
167
166
|
const extras = Object.keys(selectedExtras);
|
|
168
167
|
mainProducts = [towbar, combiset, cableset, boardComputer].filter(Boolean);
|
|
@@ -266,7 +266,6 @@ const ProductCartTable = () => {
|
|
|
266
266
|
selectedExtras,
|
|
267
267
|
executionAnswer1,
|
|
268
268
|
allArticleNumbers,
|
|
269
|
-
existingDossierId,
|
|
270
269
|
canAlterQuantity,
|
|
271
270
|
executionAnswer2,
|
|
272
271
|
discountAmount,
|
|
@@ -348,10 +347,7 @@ const ProductCartTable = () => {
|
|
|
348
347
|
consumerDiscounts,
|
|
349
348
|
touchedConsumerDiscounts
|
|
350
349
|
});
|
|
351
|
-
|
|
352
|
-
// article numbers that could not be classified into selectedTowbar etc. during
|
|
353
|
-
// hydration (e.g. formula-specific articles not in the TM catalogue).
|
|
354
|
-
const shouldRequestUnfilteredProducts = (0, _product.shouldRequestUnfilteredProductsForCart)(cartInput) || Boolean(existingDossierId && (allArticleNumbers === null || allArticleNumbers === void 0 ? void 0 : allArticleNumbers.length) > 0);
|
|
350
|
+
const shouldRequestUnfilteredProducts = (0, _product.shouldRequestUnfilteredProductsForCart)(cartInput);
|
|
355
351
|
const durationAnswerForQuery = durationAnswerIsPrefilled ? undefined : durationAnswer;
|
|
356
352
|
const {
|
|
357
353
|
cart,
|
|
@@ -476,19 +472,14 @@ const ProductCartTable = () => {
|
|
|
476
472
|
mainProducts,
|
|
477
473
|
accessoireProducts
|
|
478
474
|
} = (0, _react.useMemo)(() => {
|
|
479
|
-
var _products$Trekhaak, _products$
|
|
475
|
+
var _products$Trekhaak, _products$Combiset, _products$Kabelset, _products$Elektronica, _products$Extras;
|
|
480
476
|
if (!products) return {
|
|
481
477
|
mainProducts: [],
|
|
482
478
|
accessoireProducts: []
|
|
483
479
|
};
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
// fall back to finding the article by matching allArticleNumbers against the
|
|
488
|
-
// product category returned by Hyper (possible because skipFilters=true above).
|
|
489
|
-
const towbar = selectedTowbar ? (_products$Trekhaak = products.Trekhaak) === null || _products$Trekhaak === void 0 ? void 0 : _products$Trekhaak.find(p => p.articleNumber === selectedTowbar) : existingDossierId ? (_products$Trekhaak$fi = (_products$Trekhaak2 = products.Trekhaak) === null || _products$Trekhaak2 === void 0 ? void 0 : _products$Trekhaak2.find(p => allArticleNumbers === null || allArticleNumbers === void 0 ? void 0 : allArticleNumbers.includes(p.articleNumber))) !== null && _products$Trekhaak$fi !== void 0 ? _products$Trekhaak$fi : null : null;
|
|
490
|
-
const combiset = selectedCombiset ? (_products$Combiset = products.Combiset) === null || _products$Combiset === void 0 ? void 0 : _products$Combiset.find(p => p.articleNumber === selectedCombiset) : existingDossierId ? (_products$Combiset$fi = (_products$Combiset2 = products.Combiset) === null || _products$Combiset2 === void 0 ? void 0 : _products$Combiset2.find(p => allArticleNumbers === null || allArticleNumbers === void 0 ? void 0 : allArticleNumbers.includes(p.articleNumber))) !== null && _products$Combiset$fi !== void 0 ? _products$Combiset$fi : null : null;
|
|
491
|
-
const cableset = selectedCableset ? (_products$Kabelset = products.Kabelset) === null || _products$Kabelset === void 0 ? void 0 : _products$Kabelset.find(p => p.articleNumber === selectedCableset) : existingDossierId ? (_products$Kabelset$fi = (_products$Kabelset2 = products.Kabelset) === null || _products$Kabelset2 === void 0 ? void 0 : _products$Kabelset2.find(p => allArticleNumbers === null || allArticleNumbers === void 0 ? void 0 : allArticleNumbers.includes(p.articleNumber))) !== null && _products$Kabelset$fi !== void 0 ? _products$Kabelset$fi : null : null;
|
|
480
|
+
const towbar = selectedTowbar ? (_products$Trekhaak = products.Trekhaak) === null || _products$Trekhaak === void 0 ? void 0 : _products$Trekhaak.find(p => p.articleNumber === selectedTowbar) : null;
|
|
481
|
+
const combiset = selectedCombiset ? (_products$Combiset = products.Combiset) === null || _products$Combiset === void 0 ? void 0 : _products$Combiset.find(p => p.articleNumber === selectedCombiset) : null;
|
|
482
|
+
const cableset = selectedCableset ? (_products$Kabelset = products.Kabelset) === null || _products$Kabelset === void 0 ? void 0 : _products$Kabelset.find(p => p.articleNumber === selectedCableset) : null;
|
|
492
483
|
const boardComputer = selectedBoardComputer ? (_products$Elektronica = products['Elektronica boordcomputer updaten']) === null || _products$Elektronica === void 0 ? void 0 : _products$Elektronica.find(p => p.articleNumber === selectedBoardComputer) : null;
|
|
493
484
|
const rawMainProducts = [towbar, combiset, cableset, boardComputer].filter(Boolean);
|
|
494
485
|
const extras = Object.keys(selectedExtras);
|
|
@@ -7,7 +7,6 @@ require("core-js/modules/es.weak-map.js");
|
|
|
7
7
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
8
8
|
require("core-js/modules/esnext.iterator.find.js");
|
|
9
9
|
require("core-js/modules/esnext.iterator.map.js");
|
|
10
|
-
require("core-js/modules/esnext.iterator.some.js");
|
|
11
10
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
12
11
|
require("core-js/modules/es.weak-map.js");
|
|
13
12
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -20,7 +19,6 @@ require("core-js/modules/es.json.stringify.js");
|
|
|
20
19
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
21
20
|
require("core-js/modules/esnext.iterator.find.js");
|
|
22
21
|
require("core-js/modules/esnext.iterator.map.js");
|
|
23
|
-
require("core-js/modules/esnext.iterator.some.js");
|
|
24
22
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
25
23
|
var _react = _interopRequireWildcard(require("react"));
|
|
26
24
|
var _reactRouter = require("react-router");
|
|
@@ -71,10 +69,11 @@ function _interopRequireWildcard(e, r) {
|
|
|
71
69
|
return n.default = e, t && t.set(e, n), n;
|
|
72
70
|
}
|
|
73
71
|
const ProductsOverview = () => {
|
|
74
|
-
var _products$
|
|
72
|
+
var _products$Trekhaak3, _products$Kabelset, _products$Combiset;
|
|
75
73
|
const isProductsInitialLoad = (0, _react.useRef)(true);
|
|
76
74
|
const formula = (0, _FormulaContext.useFormula)();
|
|
77
75
|
const isTmg = (0, _useIsTmg.useIsTmg)();
|
|
76
|
+
const [skipFilters, setSkipFilters] = (0, _react.useState)(false);
|
|
78
77
|
const [{
|
|
79
78
|
licensePlate,
|
|
80
79
|
model,
|
|
@@ -97,9 +96,7 @@ const ProductsOverview = () => {
|
|
|
97
96
|
discountAmount,
|
|
98
97
|
discountPercentage,
|
|
99
98
|
montageRate,
|
|
100
|
-
extraPriceAmount
|
|
101
|
-
existingDossierId,
|
|
102
|
-
skipFilters
|
|
99
|
+
extraPriceAmount
|
|
103
100
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
104
101
|
const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
|
|
105
102
|
const durationAnswerForQuery = durationAnswerIsPrefilled ? undefined : durationAnswer;
|
|
@@ -137,40 +134,11 @@ const ProductsOverview = () => {
|
|
|
137
134
|
montageRate: (0, _montageRate.toApiMontageRate)(montageRate),
|
|
138
135
|
extraPriceAmount
|
|
139
136
|
});
|
|
140
|
-
|
|
141
|
-
// When a saved or newly selected article was only available via "Toon alle
|
|
142
|
-
// artikelen", the standard filtered product list won't contain it. Detect this
|
|
143
|
-
// mismatch and auto-enable skipFilters so the article is rendered and submitted
|
|
144
|
-
// with the cart.
|
|
145
137
|
(0, _react.useEffect)(() => {
|
|
146
|
-
var _products$Trekhaak, _products$
|
|
147
|
-
if (isLoadingProducts || skipFilters) {
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
const towbarMissing = selectedTowbar && (products === null || products === void 0 || (_products$Trekhaak = products.Trekhaak) === null || _products$Trekhaak === void 0 ? void 0 : _products$Trekhaak.length) > 0 && !products.Trekhaak.some(p => p.articleNumber === selectedTowbar);
|
|
151
|
-
const cablesetMissing = selectedCableset && (products === null || products === void 0 || (_products$PRODUCT_CAT = products[_constants__.PRODUCT_CATEGORIES.CABLESET]) === null || _products$PRODUCT_CAT === void 0 ? void 0 : _products$PRODUCT_CAT.length) > 0 && !products[_constants__.PRODUCT_CATEGORIES.CABLESET].some(p => p.articleNumber === selectedCableset);
|
|
152
|
-
const combisetMissing = selectedCombiset && (products === null || products === void 0 || (_products$PRODUCT_CAT2 = products[_constants__.PRODUCT_CATEGORIES.COMBISET]) === null || _products$PRODUCT_CAT2 === void 0 ? void 0 : _products$PRODUCT_CAT2.length) > 0 && !products[_constants__.PRODUCT_CATEGORIES.COMBISET].some(p => p.articleNumber === selectedCombiset);
|
|
153
|
-
if (towbarMissing || cablesetMissing || combisetMissing) {
|
|
154
|
-
dispatch({
|
|
155
|
-
type: _OrderSessionContext.orderSessionActions.SET_SKIP_FILTERS,
|
|
156
|
-
payload: {
|
|
157
|
-
skipFilters: true
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
}, [isLoadingProducts, skipFilters, products, selectedTowbar, selectedCableset, selectedCombiset, dispatch]);
|
|
162
|
-
(0, _react.useEffect)(() => {
|
|
163
|
-
var _products$Trekhaak2, _products$Trekhaak3, _products$PRODUCT_CAT5;
|
|
164
|
-
// When editing an existing dossier, the saved selection from the cart is the
|
|
165
|
-
// source of truth. Skip auto-selection entirely so we never overwrite it with
|
|
166
|
-
// the default recommended towbar.
|
|
167
|
-
if (existingDossierId) {
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
|
|
138
|
+
var _products$Trekhaak, _products$Trekhaak2, _products$PRODUCT_CAT3;
|
|
171
139
|
// Only run this if we have products loaded and no towbar is currently selected
|
|
172
|
-
if (!isLoadingProducts && (products === null || products === void 0 || (_products$
|
|
173
|
-
var _products$
|
|
140
|
+
if (!isLoadingProducts && (products === null || products === void 0 || (_products$Trekhaak = products.Trekhaak) === null || _products$Trekhaak === void 0 ? void 0 : _products$Trekhaak.length) === 1 && !selectedTowbar && !selectedCombiset) {
|
|
141
|
+
var _products$PRODUCT_CAT;
|
|
174
142
|
const towbarId = products.Trekhaak[0].articleNumber;
|
|
175
143
|
dispatch({
|
|
176
144
|
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_TOWBAR,
|
|
@@ -180,7 +148,7 @@ const ProductsOverview = () => {
|
|
|
180
148
|
});
|
|
181
149
|
|
|
182
150
|
// Auto-select kabelset if there's exactly one kabelset available (reusing existing logic)
|
|
183
|
-
if (!selectedCableset && ((_products$
|
|
151
|
+
if (!selectedCableset && ((_products$PRODUCT_CAT = products[_constants__.PRODUCT_CATEGORIES.CABLESET]) === null || _products$PRODUCT_CAT === void 0 ? void 0 : _products$PRODUCT_CAT.length) === 1) {
|
|
184
152
|
const kabelsetId = products[_constants__.PRODUCT_CATEGORIES.CABLESET][0].articleNumber;
|
|
185
153
|
dispatch({
|
|
186
154
|
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_CABLESET,
|
|
@@ -191,7 +159,7 @@ const ProductsOverview = () => {
|
|
|
191
159
|
}
|
|
192
160
|
}
|
|
193
161
|
// If we have multiple towbars, pre-select the recommended one if no other is selected
|
|
194
|
-
else if (!isLoadingProducts && (products === null || products === void 0 || (_products$
|
|
162
|
+
else if (!isLoadingProducts && (products === null || products === void 0 || (_products$Trekhaak2 = products.Trekhaak) === null || _products$Trekhaak2 === void 0 ? void 0 : _products$Trekhaak2.length) > 1 && !selectedTowbar && !selectedCombiset) {
|
|
195
163
|
// Find the recommended towbar
|
|
196
164
|
const recommendedTowbar = products.Trekhaak.find(product => (0, _product.checkIfTowbarIsRecommended)({
|
|
197
165
|
product,
|
|
@@ -200,7 +168,7 @@ const ProductsOverview = () => {
|
|
|
200
168
|
|
|
201
169
|
// If there's a recommended towbar, select it
|
|
202
170
|
if (recommendedTowbar) {
|
|
203
|
-
var _products$
|
|
171
|
+
var _products$PRODUCT_CAT2;
|
|
204
172
|
dispatch({
|
|
205
173
|
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_TOWBAR,
|
|
206
174
|
payload: {
|
|
@@ -209,7 +177,7 @@ const ProductsOverview = () => {
|
|
|
209
177
|
});
|
|
210
178
|
|
|
211
179
|
// Auto-select kabelset if no kabelset is currently selected
|
|
212
|
-
if (!selectedCableset && ((_products$
|
|
180
|
+
if (!selectedCableset && ((_products$PRODUCT_CAT2 = products[_constants__.PRODUCT_CATEGORIES.CABLESET]) === null || _products$PRODUCT_CAT2 === void 0 ? void 0 : _products$PRODUCT_CAT2.length) === 1) {
|
|
213
181
|
const kabelsetId = products[_constants__.PRODUCT_CATEGORIES.CABLESET][0].articleNumber;
|
|
214
182
|
dispatch({
|
|
215
183
|
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_CABLESET,
|
|
@@ -222,7 +190,7 @@ const ProductsOverview = () => {
|
|
|
222
190
|
}
|
|
223
191
|
|
|
224
192
|
// Auto-select boardcomputer if one is available and none is currently selected
|
|
225
|
-
if (!isLoadingProducts && (products === null || products === void 0 || (_products$
|
|
193
|
+
if (!isLoadingProducts && (products === null || products === void 0 || (_products$PRODUCT_CAT3 = products[_constants__.PRODUCT_CATEGORIES.BOARD_COMPUTER]) === null || _products$PRODUCT_CAT3 === void 0 ? void 0 : _products$PRODUCT_CAT3.length) > 0 && !selectedBoardComputer && !isBoardComputerDeselected) {
|
|
226
194
|
const boardComputerId = products[_constants__.PRODUCT_CATEGORIES.BOARD_COMPUTER][0].articleNumber;
|
|
227
195
|
dispatch({
|
|
228
196
|
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_BOARDCOMPUTER,
|
|
@@ -231,8 +199,8 @@ const ProductsOverview = () => {
|
|
|
231
199
|
}
|
|
232
200
|
});
|
|
233
201
|
}
|
|
234
|
-
}, [isLoadingProducts, products, selectedTowbar, selectedCableset, selectedBoardComputer, isBoardComputerDeselected,
|
|
235
|
-
if (isProductsError || !isLoadingProducts && (!(products !== null && products !== void 0 && (_products$
|
|
202
|
+
}, [isLoadingProducts, products, selectedTowbar, selectedCableset, selectedBoardComputer, isBoardComputerDeselected, dispatch]);
|
|
203
|
+
if (isProductsError || !isLoadingProducts && (!(products !== null && products !== void 0 && (_products$Trekhaak3 = products.Trekhaak) !== null && _products$Trekhaak3 !== void 0 && _products$Trekhaak3.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
204
|
return /*#__PURE__*/_react.default.createElement(_reactRouter.Redirect, {
|
|
237
205
|
to: "/configurator/geen-producten"
|
|
238
206
|
});
|
|
@@ -275,9 +243,9 @@ const ProductsOverview = () => {
|
|
|
275
243
|
|
|
276
244
|
// Auto-select kabelset if towbar is selected and no kabelset is currently selected
|
|
277
245
|
if (isSelected && !selectedCableset) {
|
|
278
|
-
var _products$
|
|
246
|
+
var _products$PRODUCT_CAT4;
|
|
279
247
|
// Check if there's exactly one kabelset available
|
|
280
|
-
if (((_products$
|
|
248
|
+
if (((_products$PRODUCT_CAT4 = products[_constants__.PRODUCT_CATEGORIES.CABLESET]) === null || _products$PRODUCT_CAT4 === void 0 ? void 0 : _products$PRODUCT_CAT4.length) === 1) {
|
|
281
249
|
const kabelsetId = products[_constants__.PRODUCT_CATEGORIES.CABLESET][0].articleNumber;
|
|
282
250
|
dispatch({
|
|
283
251
|
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_CABLESET,
|
|
@@ -360,12 +328,7 @@ const ProductsOverview = () => {
|
|
|
360
328
|
name: 'skipFilters',
|
|
361
329
|
initialValue: skipFilters,
|
|
362
330
|
onChange: value => {
|
|
363
|
-
|
|
364
|
-
type: _OrderSessionContext.orderSessionActions.SET_SKIP_FILTERS,
|
|
365
|
-
payload: {
|
|
366
|
-
skipFilters: value
|
|
367
|
-
}
|
|
368
|
-
});
|
|
331
|
+
setSkipFilters(value);
|
|
369
332
|
},
|
|
370
333
|
label: "Toon alle artikelen"
|
|
371
334
|
}), isLoadingProducts && isProductsInitialLoad.current === true ? /*#__PURE__*/_react.default.createElement("div", {
|