thm-p3-configurator 0.0.417 → 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 +1 -22
- package/dist/src/shared/__containers__/AppointmentForm.js +1 -3
- package/dist/src/shared/__containers__/ExitIntentModal.js +1 -3
- 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 +1 -3
- 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/__context__/OrderSessionContext.js +5 -49
- 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__/singleOrderVehicleReceipt.js +0 -117
- package/dist/src/shared/__style__/datepicker-global.scss +0 -3
|
@@ -106,7 +106,6 @@ const useCreateQuotationMutation = () => {
|
|
|
106
106
|
formula,
|
|
107
107
|
discount,
|
|
108
108
|
vehicle,
|
|
109
|
-
skipFilters,
|
|
110
109
|
isExitIntent = false
|
|
111
110
|
} = _ref;
|
|
112
111
|
return _publicProxyApi.publicProxyApi.postQuotation({
|
|
@@ -119,7 +118,6 @@ const useCreateQuotationMutation = () => {
|
|
|
119
118
|
discount,
|
|
120
119
|
answers: answers,
|
|
121
120
|
cart: cart,
|
|
122
|
-
skipFilters,
|
|
123
121
|
selectBoardComputerUpdate: selectBoardComputerUpdate,
|
|
124
122
|
customer: customer,
|
|
125
123
|
branchId
|
|
@@ -151,8 +149,7 @@ const useCreateAppointmentRequestMutation = () => {
|
|
|
151
149
|
vehicle,
|
|
152
150
|
discount,
|
|
153
151
|
formula,
|
|
154
|
-
branchId
|
|
155
|
-
skipFilters
|
|
152
|
+
branchId
|
|
156
153
|
} = _ref2;
|
|
157
154
|
return _publicProxyApi.publicProxyApi.postAppointmentRequest({
|
|
158
155
|
model,
|
|
@@ -161,7 +158,6 @@ const useCreateAppointmentRequestMutation = () => {
|
|
|
161
158
|
formula,
|
|
162
159
|
answers: answers,
|
|
163
160
|
cart: cart,
|
|
164
|
-
skipFilters,
|
|
165
161
|
selectBoardComputerUpdate: selectBoardComputerUpdate,
|
|
166
162
|
customer,
|
|
167
163
|
branchId,
|
|
@@ -188,7 +184,6 @@ const useCreateSingleOrderMutation = () => {
|
|
|
188
184
|
let {
|
|
189
185
|
licensePlate,
|
|
190
186
|
model,
|
|
191
|
-
answers,
|
|
192
187
|
cart,
|
|
193
188
|
customer,
|
|
194
189
|
channel,
|
|
@@ -205,7 +200,6 @@ const useCreateSingleOrderMutation = () => {
|
|
|
205
200
|
return _authenticatedProxyApi.authenticatedProxyApi.postSingleOrder({
|
|
206
201
|
licensePlate,
|
|
207
202
|
model,
|
|
208
|
-
answers,
|
|
209
203
|
cart,
|
|
210
204
|
customer,
|
|
211
205
|
channel,
|
|
@@ -239,7 +233,6 @@ const useCreateShopifyOrderMutation = () => {
|
|
|
239
233
|
let {
|
|
240
234
|
licensePlate,
|
|
241
235
|
model,
|
|
242
|
-
answers,
|
|
243
236
|
cart,
|
|
244
237
|
customer,
|
|
245
238
|
channel,
|
|
@@ -256,7 +249,6 @@ const useCreateShopifyOrderMutation = () => {
|
|
|
256
249
|
return _authenticatedProxyApi.authenticatedProxyApi.postShopifyOrder({
|
|
257
250
|
licensePlate,
|
|
258
251
|
model,
|
|
259
|
-
answers,
|
|
260
252
|
cart,
|
|
261
253
|
customer,
|
|
262
254
|
channel,
|
|
@@ -305,7 +297,6 @@ const useCreatePrivateQuotationMutation = () => {
|
|
|
305
297
|
extraPrice,
|
|
306
298
|
isExitIntent = false,
|
|
307
299
|
montageRate,
|
|
308
|
-
skipFilters,
|
|
309
300
|
leasemaatschappijEntityId,
|
|
310
301
|
leasemaatschappijBedrijfsnaam,
|
|
311
302
|
leasemaatschappijContactpersoonNaam,
|
|
@@ -335,7 +326,6 @@ const useCreatePrivateQuotationMutation = () => {
|
|
|
335
326
|
extraPrice,
|
|
336
327
|
answers,
|
|
337
328
|
cart,
|
|
338
|
-
skipFilters,
|
|
339
329
|
selectBoardComputerUpdate,
|
|
340
330
|
customer: restCustomer,
|
|
341
331
|
branchId,
|
|
@@ -364,7 +354,6 @@ const useCreatePrivateQuotationMutation = () => {
|
|
|
364
354
|
extraPrice,
|
|
365
355
|
answers,
|
|
366
356
|
cart,
|
|
367
|
-
skipFilters,
|
|
368
357
|
selectBoardComputerUpdate,
|
|
369
358
|
customer: restCustomer,
|
|
370
359
|
branchId,
|
|
@@ -430,7 +419,6 @@ const useCreatePrivateAppointmentMutation = () => {
|
|
|
430
419
|
extraPrice,
|
|
431
420
|
customerAgreed,
|
|
432
421
|
montageRate,
|
|
433
|
-
skipFilters,
|
|
434
422
|
leasemaatschappijEntityId,
|
|
435
423
|
leasemaatschappijBedrijfsnaam,
|
|
436
424
|
leasemaatschappijContactpersoonNaam,
|
|
@@ -461,7 +449,6 @@ const useCreatePrivateAppointmentMutation = () => {
|
|
|
461
449
|
extraPrice,
|
|
462
450
|
answers,
|
|
463
451
|
cart,
|
|
464
|
-
skipFilters,
|
|
465
452
|
selectBoardComputerUpdate,
|
|
466
453
|
customer: restCustomer,
|
|
467
454
|
branchId,
|
|
@@ -526,7 +513,6 @@ const useCreatePrivateAppointmentRequestMutation = () => {
|
|
|
526
513
|
discount,
|
|
527
514
|
customerAgreed,
|
|
528
515
|
montageRate,
|
|
529
|
-
skipFilters,
|
|
530
516
|
leasemaatschappijEntityId,
|
|
531
517
|
leasemaatschappijBedrijfsnaam,
|
|
532
518
|
leasemaatschappijContactpersoonNaam,
|
|
@@ -555,7 +541,6 @@ const useCreatePrivateAppointmentRequestMutation = () => {
|
|
|
555
541
|
discount,
|
|
556
542
|
answers,
|
|
557
543
|
cart,
|
|
558
|
-
skipFilters,
|
|
559
544
|
selectBoardComputerUpdate,
|
|
560
545
|
customer: restCustomer,
|
|
561
546
|
branchId,
|
|
@@ -618,7 +603,6 @@ const useUpdatePrivateAppointmentRequestByIdMutation = id => {
|
|
|
618
603
|
priceCalculationDate,
|
|
619
604
|
customerAgreed,
|
|
620
605
|
montageRate,
|
|
621
|
-
skipFilters,
|
|
622
606
|
leasemaatschappijEntityId,
|
|
623
607
|
leasemaatschappijBedrijfsnaam,
|
|
624
608
|
leasemaatschappijContactpersoonNaam,
|
|
@@ -657,7 +641,6 @@ const useUpdatePrivateAppointmentRequestByIdMutation = id => {
|
|
|
657
641
|
discount,
|
|
658
642
|
answers,
|
|
659
643
|
cart,
|
|
660
|
-
skipFilters,
|
|
661
644
|
selectBoardComputerUpdate,
|
|
662
645
|
customer: restCustomer,
|
|
663
646
|
branchId,
|
|
@@ -711,7 +694,6 @@ const useUpdatePrivateQuotationByIdMutation = id => {
|
|
|
711
694
|
extraPrice,
|
|
712
695
|
priceCalculationDate,
|
|
713
696
|
montageRate,
|
|
714
|
-
skipFilters,
|
|
715
697
|
leasemaatschappijEntityId,
|
|
716
698
|
leasemaatschappijBedrijfsnaam,
|
|
717
699
|
leasemaatschappijContactpersoonNaam,
|
|
@@ -750,7 +732,6 @@ const useUpdatePrivateQuotationByIdMutation = id => {
|
|
|
750
732
|
extraPrice,
|
|
751
733
|
answers,
|
|
752
734
|
cart,
|
|
753
|
-
skipFilters,
|
|
754
735
|
selectBoardComputerUpdate,
|
|
755
736
|
customer: restCustomer,
|
|
756
737
|
branchId,
|
|
@@ -805,7 +786,6 @@ const useUpdatePrivateAppointmentByIdMutation = id => {
|
|
|
805
786
|
customerAgreed,
|
|
806
787
|
invoicePaymentByLeaseCompany,
|
|
807
788
|
montageRate,
|
|
808
|
-
skipFilters,
|
|
809
789
|
leasemaatschappijEntityId,
|
|
810
790
|
leasemaatschappijBedrijfsnaam,
|
|
811
791
|
leasemaatschappijContactpersoonNaam,
|
|
@@ -845,7 +825,6 @@ const useUpdatePrivateAppointmentByIdMutation = id => {
|
|
|
845
825
|
extraPrice,
|
|
846
826
|
answers,
|
|
847
827
|
cart,
|
|
848
|
-
skipFilters,
|
|
849
828
|
selectBoardComputerUpdate,
|
|
850
829
|
customer: _objectSpread(_objectSpread({}, restCustomer), {}, {
|
|
851
830
|
invoicePaymentByLeaseCompany
|
|
@@ -159,8 +159,7 @@ const AppointmentForm = () => {
|
|
|
159
159
|
priceCalculationDate,
|
|
160
160
|
selectedDiscountedProducts = [],
|
|
161
161
|
selectedExtras,
|
|
162
|
-
vehicleCodingDiscountPercentage
|
|
163
|
-
skipFilters
|
|
162
|
+
vehicleCodingDiscountPercentage
|
|
164
163
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
165
164
|
const [errors, setErrors] = (0, _react.useState)({});
|
|
166
165
|
const [isTermsAccepted, setIsTermsAccepted] = (0, _react.useState)(false);
|
|
@@ -213,7 +212,6 @@ const AppointmentForm = () => {
|
|
|
213
212
|
formula,
|
|
214
213
|
branchId: selectedBranch,
|
|
215
214
|
selectBoardComputerUpdate: selectedBoardComputer != null,
|
|
216
|
-
skipFilters,
|
|
217
215
|
discount: (() => {
|
|
218
216
|
if (!(discountCode !== null && discountCode !== void 0 && discountCode.length)) return null;
|
|
219
217
|
if (discountCode.toLocaleLowerCase().includes('anwb') && !anwbDiscountValidated) return null;
|
|
@@ -146,8 +146,7 @@ const ExitIntentModal = () => {
|
|
|
146
146
|
priceCalculationDate,
|
|
147
147
|
selectedDiscountedProducts = [],
|
|
148
148
|
selectedExtras,
|
|
149
|
-
vehicleCodingDiscountPercentage
|
|
150
|
-
skipFilters
|
|
149
|
+
vehicleCodingDiscountPercentage
|
|
151
150
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
152
151
|
const formula = (0, _FormulaContext.useFormula)();
|
|
153
152
|
const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
|
|
@@ -230,7 +229,6 @@ const ExitIntentModal = () => {
|
|
|
230
229
|
})),
|
|
231
230
|
branchId: selectedBranch,
|
|
232
231
|
selectBoardComputerUpdate: selectedBoardComputer != null,
|
|
233
|
-
skipFilters,
|
|
234
232
|
cart: (0, _product.buildCartInput)({
|
|
235
233
|
selectedCableset,
|
|
236
234
|
selectedCombiset,
|
|
@@ -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", {
|
|
@@ -150,8 +150,7 @@ const QuotationForm = () => {
|
|
|
150
150
|
discountCode,
|
|
151
151
|
selectedDiscountedProducts = [],
|
|
152
152
|
selectedExtras,
|
|
153
|
-
vehicleCodingDiscountPercentage
|
|
154
|
-
skipFilters
|
|
153
|
+
vehicleCodingDiscountPercentage
|
|
155
154
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
156
155
|
const [errors, setErrors] = (0, _react.useState)({});
|
|
157
156
|
const [isTermsAccepted, setIsTermsAccepted] = (0, _react.useState)(false);
|
|
@@ -215,7 +214,6 @@ const QuotationForm = () => {
|
|
|
215
214
|
customer: (0, _helpers__.removeNullishProps)(customer),
|
|
216
215
|
branchId: selectedBranch,
|
|
217
216
|
selectBoardComputerUpdate: selectedBoardComputer != null,
|
|
218
|
-
skipFilters,
|
|
219
217
|
cart: (0, _product.buildCartInput)({
|
|
220
218
|
selectedCableset,
|
|
221
219
|
selectedCombiset,
|
|
@@ -11,7 +11,6 @@ require("core-js/modules/web.dom-collections.iterator.js");
|
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _reactRouter = require("react-router");
|
|
13
13
|
require("react-datepicker/src/stylesheets/datepicker-cssmodules.scss");
|
|
14
|
-
require("../__style__/datepicker-global.scss");
|
|
15
14
|
var _ThemeContext = require("../__context__/ThemeContext");
|
|
16
15
|
var _helpers__ = require("../__helpers__");
|
|
17
16
|
var _useBranchTheme = require("../__hooks__/useBranchTheme");
|
|
@@ -273,8 +273,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
273
273
|
isTowCenterBranch,
|
|
274
274
|
extraPriceAmount,
|
|
275
275
|
extraPriceDescription,
|
|
276
|
-
orderProcessingNote
|
|
277
|
-
skipFilters
|
|
276
|
+
orderProcessingNote
|
|
278
277
|
} = order;
|
|
279
278
|
|
|
280
279
|
// Track the original ownership type from context
|
|
@@ -672,7 +671,6 @@ const InternalAppointmentForm = _ref => {
|
|
|
672
671
|
}), {}, {
|
|
673
672
|
branchId: selectedBranch,
|
|
674
673
|
selectBoardComputerUpdate: selectedBoardComputer != null,
|
|
675
|
-
skipFilters,
|
|
676
674
|
cart: (0, _product.buildCartInput)({
|
|
677
675
|
selectedCableset,
|
|
678
676
|
selectedCombiset,
|
|
@@ -243,8 +243,7 @@ const InternalQuotationForm = _ref => {
|
|
|
243
243
|
montageRate,
|
|
244
244
|
isTowCenterBranch,
|
|
245
245
|
extraPriceAmount,
|
|
246
|
-
extraPriceDescription
|
|
247
|
-
skipFilters
|
|
246
|
+
extraPriceDescription
|
|
248
247
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
249
248
|
const [errors, setErrors] = (0, _react.useState)({});
|
|
250
249
|
const [companySearchTerm, setCompanySearchTerm] = (0, _react.useState)('');
|
|
@@ -580,7 +579,6 @@ const InternalQuotationForm = _ref => {
|
|
|
580
579
|
}), {}, {
|
|
581
580
|
branchId: selectedBranch,
|
|
582
581
|
selectBoardComputerUpdate: selectedBoardComputer != null,
|
|
583
|
-
skipFilters,
|
|
584
582
|
cart: (0, _product.buildCartInput)({
|
|
585
583
|
selectedCableset,
|
|
586
584
|
selectedCombiset,
|
|
@@ -7,7 +7,6 @@ require("core-js/modules/es.string.search.js");
|
|
|
7
7
|
require("core-js/modules/es.weak-map.js");
|
|
8
8
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
9
9
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
10
|
-
require("core-js/modules/esnext.iterator.find.js");
|
|
11
10
|
require("core-js/modules/esnext.iterator.for-each.js");
|
|
12
11
|
require("core-js/modules/esnext.iterator.map.js");
|
|
13
12
|
require("core-js/modules/esnext.iterator.some.js");
|
|
@@ -25,7 +24,6 @@ require("core-js/modules/es.regexp.exec.js");
|
|
|
25
24
|
require("core-js/modules/es.string.search.js");
|
|
26
25
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
27
26
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
28
|
-
require("core-js/modules/esnext.iterator.find.js");
|
|
29
27
|
require("core-js/modules/esnext.iterator.map.js");
|
|
30
28
|
require("core-js/modules/esnext.iterator.some.js");
|
|
31
29
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
@@ -113,32 +111,6 @@ function _toPrimitive(t, r) {
|
|
|
113
111
|
}
|
|
114
112
|
const OrderSessionContext = /*#__PURE__*/(0, _react.createContext)();
|
|
115
113
|
OrderSessionContext.displayName = 'OrderSessionContext';
|
|
116
|
-
const resolveOptionLabel = function resolveOptionLabel() {
|
|
117
|
-
var _ref, _options$find$label, _options$find;
|
|
118
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
119
|
-
let value = arguments.length > 1 ? arguments[1] : undefined;
|
|
120
|
-
return (_ref = (_options$find$label = (_options$find = options.find(option => option.value === value)) === null || _options$find === void 0 ? void 0 : _options$find.label) !== null && _options$find$label !== void 0 ? _options$find$label : value) !== null && _ref !== void 0 ? _ref : null;
|
|
121
|
-
};
|
|
122
|
-
const buildSingleOrderVehicleContext = state => {
|
|
123
|
-
var _state$durationAnswer, _state$executionAnswe, _state$executionAnswe2;
|
|
124
|
-
if (!state.licensePlate && !state.model) {
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
127
|
-
return {
|
|
128
|
-
licensePlate: state.licensePlate,
|
|
129
|
-
model: state.model,
|
|
130
|
-
answers: {
|
|
131
|
-
duration: (_state$durationAnswer = state.durationAnswer) !== null && _state$durationAnswer !== void 0 ? _state$durationAnswer : null,
|
|
132
|
-
execution1: (_state$executionAnswe = state.executionAnswer1) !== null && _state$executionAnswe !== void 0 ? _state$executionAnswe : null,
|
|
133
|
-
execution2: (_state$executionAnswe2 = state.executionAnswer2) !== null && _state$executionAnswe2 !== void 0 ? _state$executionAnswe2 : null
|
|
134
|
-
},
|
|
135
|
-
labels: {
|
|
136
|
-
duration: resolveOptionLabel(state.durationOptions, state.durationAnswer),
|
|
137
|
-
execution1: resolveOptionLabel(state.execution1Options, state.executionAnswer1),
|
|
138
|
-
execution2: resolveOptionLabel(state.execution2Options, state.executionAnswer2)
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
};
|
|
142
114
|
const INITIAL_ORDER_SESSION_STATE = {
|
|
143
115
|
isTouched: false,
|
|
144
116
|
existingDossierId: null,
|
|
@@ -165,7 +137,6 @@ const INITIAL_ORDER_SESSION_STATE = {
|
|
|
165
137
|
selectedTowbar: null,
|
|
166
138
|
selectedCableset: null,
|
|
167
139
|
selectedCombiset: null,
|
|
168
|
-
skipFilters: false,
|
|
169
140
|
leaseNumberUnknown: true,
|
|
170
141
|
selectedDiscountedProducts: [],
|
|
171
142
|
discountsInitialized: false,
|
|
@@ -264,7 +235,6 @@ const orderSessionActions = exports.orderSessionActions = {
|
|
|
264
235
|
SET_SELECTED_TOWBAR: 'SET_SELECTED_TOWBAR',
|
|
265
236
|
SET_SELECTED_CABLESET: 'SET_SELECTED_CABLESET',
|
|
266
237
|
SET_SELECTED_COMBISET: 'SET_SELECTED_COMBISET',
|
|
267
|
-
SET_SKIP_FILTERS: 'SET_SKIP_FILTERS',
|
|
268
238
|
ADD_DISCOUNTED_PRODUCT: 'ADD_DISCOUNTED_PRODUCT',
|
|
269
239
|
DISCOUNTS_INITIALIZED: 'DISCOUNTS_INITIALIZED',
|
|
270
240
|
RESET_SINGLE_ORDER: 'RESET_SINGLE_ORDER',
|
|
@@ -364,7 +334,6 @@ const orderSessionReducer = (state, action) => {
|
|
|
364
334
|
selectedTowbar: null,
|
|
365
335
|
selectedCableset: null,
|
|
366
336
|
selectedCombiset: null,
|
|
367
|
-
skipFilters: false,
|
|
368
337
|
selectedDiscountedProducts: [],
|
|
369
338
|
selectedBoardComputer: null,
|
|
370
339
|
isBoardComputerDeselected: false,
|
|
@@ -585,16 +554,6 @@ const orderSessionReducer = (state, action) => {
|
|
|
585
554
|
selectedCableset: null
|
|
586
555
|
});
|
|
587
556
|
}
|
|
588
|
-
case orderSessionActions.SET_SKIP_FILTERS:
|
|
589
|
-
{
|
|
590
|
-
const {
|
|
591
|
-
skipFilters
|
|
592
|
-
} = action.payload;
|
|
593
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
594
|
-
skipFilters,
|
|
595
|
-
isTouched: true
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
557
|
case orderSessionActions.ADD_EXTRA:
|
|
599
558
|
{
|
|
600
559
|
const {
|
|
@@ -657,7 +616,6 @@ const orderSessionReducer = (state, action) => {
|
|
|
657
616
|
}
|
|
658
617
|
case orderSessionActions.ADD_SINGLE_ORDER_PRODUCT:
|
|
659
618
|
{
|
|
660
|
-
var _existingProduct$vehi;
|
|
661
619
|
const {
|
|
662
620
|
articleNumber,
|
|
663
621
|
quantity,
|
|
@@ -665,15 +623,13 @@ const orderSessionReducer = (state, action) => {
|
|
|
665
623
|
productPriceInclVat,
|
|
666
624
|
brandNumber
|
|
667
625
|
} = action.payload;
|
|
668
|
-
const existingProduct = state.singleOrderCart.find(p => p.articleNumber === articleNumber);
|
|
669
626
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
670
627
|
singleOrderCart: [...state.singleOrderCart.filter(p => p.articleNumber !== articleNumber), {
|
|
671
628
|
articleNumber,
|
|
672
629
|
quantity,
|
|
673
630
|
productPrice,
|
|
674
631
|
productPriceInclVat,
|
|
675
|
-
brandNumber
|
|
676
|
-
vehicleContext: (_existingProduct$vehi = existingProduct === null || existingProduct === void 0 ? void 0 : existingProduct.vehicleContext) !== null && _existingProduct$vehi !== void 0 ? _existingProduct$vehi : buildSingleOrderVehicleContext(state)
|
|
632
|
+
brandNumber
|
|
677
633
|
}],
|
|
678
634
|
isTouched: true
|
|
679
635
|
});
|
|
@@ -1438,11 +1394,11 @@ const initializeOrderSession = function initializeOrderSession() {
|
|
|
1438
1394
|
}
|
|
1439
1395
|
return cachedSession;
|
|
1440
1396
|
};
|
|
1441
|
-
const AuthSessionRuntimeSync =
|
|
1397
|
+
const AuthSessionRuntimeSync = _ref => {
|
|
1442
1398
|
var _branch$entityId;
|
|
1443
1399
|
let {
|
|
1444
1400
|
authMode = 'internal'
|
|
1445
|
-
} =
|
|
1401
|
+
} = _ref;
|
|
1446
1402
|
const {
|
|
1447
1403
|
authenticated,
|
|
1448
1404
|
initialized,
|
|
@@ -1516,13 +1472,13 @@ const AuthSessionRuntimeSync = _ref2 => {
|
|
|
1516
1472
|
}, [authRuntime, authenticated, initialized, authHeaderBranchId, formula, module, isExternalAuthMode]);
|
|
1517
1473
|
return null;
|
|
1518
1474
|
};
|
|
1519
|
-
const OrderSessionController =
|
|
1475
|
+
const OrderSessionController = _ref2 => {
|
|
1520
1476
|
let {
|
|
1521
1477
|
children,
|
|
1522
1478
|
authMode = 'internal',
|
|
1523
1479
|
externalAuthSession = null,
|
|
1524
1480
|
externalAuthRuntime = null
|
|
1525
|
-
} =
|
|
1481
|
+
} = _ref2;
|
|
1526
1482
|
const isSingleOrderPage = (0, _useIsSingleOrder.default)();
|
|
1527
1483
|
const isExternalAuthMode = authMode === 'external' || Boolean(externalAuthSession);
|
|
1528
1484
|
const runtimeMode = isExternalAuthMode ? 'external' : 'internal';
|
|
@@ -28,8 +28,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
28
28
|
var _reactRouter = require("react-router");
|
|
29
29
|
var _reactRouterDom = require("react-router-dom/cjs/react-router-dom.min");
|
|
30
30
|
var _authenticatedProxyApi = require("../../__api__/authenticatedProxyApi");
|
|
31
|
-
var _queryKeyFactory = require("../../__api__/queryKeyFactory");
|
|
32
31
|
var _queries = require("../../__api__/queries");
|
|
32
|
+
var _queryKeyFactory = require("../../__api__/queryKeyFactory");
|
|
33
33
|
var _FullPageSpinner = _interopRequireDefault(require("../../__components__/Spinners/FullPageSpinner"));
|
|
34
34
|
var _constants__ = require("../../__constants__");
|
|
35
35
|
var _FormulaContext = require("../../__context__/FormulaContext");
|
|
@@ -37,7 +37,6 @@ var _FormulaContext = require("../../__context__/FormulaContext");
|
|
|
37
37
|
var _OrderSessionContext = require("../../__context__/OrderSessionContext");
|
|
38
38
|
var _helpers__ = require("../../__helpers__");
|
|
39
39
|
var _singleOrderArticles = require("../../__helpers__/singleOrderArticles");
|
|
40
|
-
var _singleOrderVehicleReceipt = require("../../__helpers__/singleOrderVehicleReceipt");
|
|
41
40
|
function _interopRequireDefault(e) {
|
|
42
41
|
return e && e.__esModule ? e : {
|
|
43
42
|
default: e
|
|
@@ -332,7 +331,7 @@ const InternalSingleOrderPage = () => {
|
|
|
332
331
|
setCustomerErrors(errors);
|
|
333
332
|
};
|
|
334
333
|
const handleSubmit = async () => {
|
|
335
|
-
var _customerFormRef$curr,
|
|
334
|
+
var _customerFormRef$curr, _response$data2;
|
|
336
335
|
const isValid = await ((_customerFormRef$curr = customerFormRef.current) === null || _customerFormRef$curr === void 0 ? void 0 : _customerFormRef$curr.validateForm());
|
|
337
336
|
if (!isValid) {
|
|
338
337
|
return;
|
|
@@ -359,23 +358,11 @@ const InternalSingleOrderPage = () => {
|
|
|
359
358
|
anderAfleveradres: customerPayload.anderAfleveradres
|
|
360
359
|
});
|
|
361
360
|
const apiCart = (0, _singleOrderArticles.buildSingleOrderApiCart)(singleOrderCart);
|
|
362
|
-
const singleUsedVehicleContext = (0, _singleOrderVehicleReceipt.getSingleUsedVehicleContext)(singleOrderCart);
|
|
363
|
-
const answers = (0, _helpers__.removeNullishProps)({
|
|
364
|
-
duration: singleUsedVehicleContext === null || singleUsedVehicleContext === void 0 || (_singleUsedVehicleCon = singleUsedVehicleContext.answers) === null || _singleUsedVehicleCon === void 0 ? void 0 : _singleUsedVehicleCon.duration,
|
|
365
|
-
execution1: singleUsedVehicleContext === null || singleUsedVehicleContext === void 0 || (_singleUsedVehicleCon2 = singleUsedVehicleContext.answers) === null || _singleUsedVehicleCon2 === void 0 ? void 0 : _singleUsedVehicleCon2.execution1,
|
|
366
|
-
execution2: singleUsedVehicleContext === null || singleUsedVehicleContext === void 0 || (_singleUsedVehicleCon3 = singleUsedVehicleContext.answers) === null || _singleUsedVehicleCon3 === void 0 ? void 0 : _singleUsedVehicleCon3.execution2
|
|
367
|
-
});
|
|
368
|
-
const hasAnswers = Object.keys(answers).length > 0;
|
|
369
|
-
const mergedInternalNote = (0, _singleOrderVehicleReceipt.buildSingleOrderVehicleReceipt)({
|
|
370
|
-
cart: singleOrderCart,
|
|
371
|
-
userNote: internalNote === null || internalNote === void 0 ? void 0 : internalNote.internalNote
|
|
372
|
-
});
|
|
373
361
|
if (webshop) {
|
|
374
|
-
var
|
|
362
|
+
var _response$data;
|
|
375
363
|
const response = await createShopifyOrder(_objectSpread({
|
|
376
|
-
licensePlate:
|
|
377
|
-
model:
|
|
378
|
-
answers: hasAnswers ? answers : undefined,
|
|
364
|
+
licensePlate: filters.licensePlate,
|
|
365
|
+
model: filters.model,
|
|
379
366
|
cart: apiCart,
|
|
380
367
|
vehicle: vehiclePayload,
|
|
381
368
|
customer: customerPayload,
|
|
@@ -383,7 +370,7 @@ const InternalSingleOrderPage = () => {
|
|
|
383
370
|
webshop,
|
|
384
371
|
branchId: selectedBranch,
|
|
385
372
|
channel,
|
|
386
|
-
internalNote:
|
|
373
|
+
internalNote: internalNote === null || internalNote === void 0 ? void 0 : internalNote.internalNote
|
|
387
374
|
}, businessContactPayload));
|
|
388
375
|
if (response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && (_response$data = _response$data.data) !== null && _response$data !== void 0 && _response$data.entityId) {
|
|
389
376
|
setCreatedEntityId(response.data.data.entityId);
|
|
@@ -392,9 +379,8 @@ const InternalSingleOrderPage = () => {
|
|
|
392
379
|
}
|
|
393
380
|
const preferredDateTime = appointment !== null && appointment !== void 0 && appointment.date && appointment !== null && appointment !== void 0 && appointment.time ? (0, _helpers__.parseDateAndTimeToTimestamp)(appointment === null || appointment === void 0 ? void 0 : appointment.date, appointment === null || appointment === void 0 ? void 0 : appointment.time) : null;
|
|
394
381
|
const response = await createSingleOrder(_objectSpread({
|
|
395
|
-
licensePlate:
|
|
396
|
-
model:
|
|
397
|
-
answers: hasAnswers ? answers : undefined,
|
|
382
|
+
licensePlate: filters.licensePlate,
|
|
383
|
+
model: filters.model,
|
|
398
384
|
cart: apiCart,
|
|
399
385
|
vehicle: vehiclePayload,
|
|
400
386
|
customer: customerPayload,
|
|
@@ -402,7 +388,7 @@ const InternalSingleOrderPage = () => {
|
|
|
402
388
|
branchId: selectedBranch,
|
|
403
389
|
channel,
|
|
404
390
|
preferredDateTime,
|
|
405
|
-
internalNote:
|
|
391
|
+
internalNote: internalNote === null || internalNote === void 0 ? void 0 : internalNote.internalNote
|
|
406
392
|
}, businessContactPayload));
|
|
407
393
|
if (response !== null && response !== void 0 && (_response$data2 = response.data) !== null && _response$data2 !== void 0 && (_response$data2 = _response$data2.data) !== null && _response$data2 !== void 0 && _response$data2.entityId) {
|
|
408
394
|
setCreatedEntityId(response.data.data.entityId);
|
package/package.json
CHANGED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.json.stringify.js");
|
|
4
|
-
require("core-js/modules/es.string.trim.js");
|
|
5
|
-
require("core-js/modules/esnext.iterator.constructor.js");
|
|
6
|
-
require("core-js/modules/esnext.iterator.filter.js");
|
|
7
|
-
require("core-js/modules/esnext.iterator.map.js");
|
|
8
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
9
|
-
Object.defineProperty(exports, "__esModule", {
|
|
10
|
-
value: true
|
|
11
|
-
});
|
|
12
|
-
exports.getSingleUsedVehicleContext = exports.buildSingleOrderVehicleReceipt = void 0;
|
|
13
|
-
require("core-js/modules/es.json.stringify.js");
|
|
14
|
-
require("core-js/modules/es.string.trim.js");
|
|
15
|
-
require("core-js/modules/esnext.iterator.constructor.js");
|
|
16
|
-
require("core-js/modules/esnext.iterator.filter.js");
|
|
17
|
-
require("core-js/modules/esnext.iterator.map.js");
|
|
18
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
19
|
-
const getContextKey = context => {
|
|
20
|
-
var _context$licensePlate, _context$model, _context$answers;
|
|
21
|
-
if (!(context !== null && context !== void 0 && context.licensePlate) && !(context !== null && context !== void 0 && context.model)) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
return JSON.stringify({
|
|
25
|
-
licensePlate: (_context$licensePlate = context.licensePlate) !== null && _context$licensePlate !== void 0 ? _context$licensePlate : null,
|
|
26
|
-
model: (_context$model = context.model) !== null && _context$model !== void 0 ? _context$model : null,
|
|
27
|
-
answers: (_context$answers = context.answers) !== null && _context$answers !== void 0 ? _context$answers : {}
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
const formatArticles = function formatArticles() {
|
|
31
|
-
let items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
32
|
-
return items.map(_ref => {
|
|
33
|
-
let {
|
|
34
|
-
articleNumber,
|
|
35
|
-
quantity
|
|
36
|
-
} = _ref;
|
|
37
|
-
return quantity > 1 ? "".concat(articleNumber, " (").concat(quantity, "x)") : articleNumber;
|
|
38
|
-
}).join(', ');
|
|
39
|
-
};
|
|
40
|
-
const formatVehicleContext = (context, items) => {
|
|
41
|
-
var _context$labels, _context$answers2, _context$labels3, _context$answers3, _context$labels5, _context$answers4;
|
|
42
|
-
const lines = [];
|
|
43
|
-
if (context.licensePlate) {
|
|
44
|
-
lines.push("Kenteken: ".concat(context.licensePlate));
|
|
45
|
-
}
|
|
46
|
-
if (context.model) {
|
|
47
|
-
lines.push("Model: ".concat(context.model));
|
|
48
|
-
}
|
|
49
|
-
if ((_context$labels = context.labels) !== null && _context$labels !== void 0 && _context$labels.duration || (_context$answers2 = context.answers) !== null && _context$answers2 !== void 0 && _context$answers2.duration) {
|
|
50
|
-
var _context$labels$durat, _context$labels2;
|
|
51
|
-
lines.push("Looptijd: ".concat((_context$labels$durat = (_context$labels2 = context.labels) === null || _context$labels2 === void 0 ? void 0 : _context$labels2.duration) !== null && _context$labels$durat !== void 0 ? _context$labels$durat : context.answers.duration));
|
|
52
|
-
}
|
|
53
|
-
if ((_context$labels3 = context.labels) !== null && _context$labels3 !== void 0 && _context$labels3.execution1 || (_context$answers3 = context.answers) !== null && _context$answers3 !== void 0 && _context$answers3.execution1) {
|
|
54
|
-
var _context$labels$execu, _context$labels4;
|
|
55
|
-
lines.push("Uitvoering: ".concat((_context$labels$execu = (_context$labels4 = context.labels) === null || _context$labels4 === void 0 ? void 0 : _context$labels4.execution1) !== null && _context$labels$execu !== void 0 ? _context$labels$execu : context.answers.execution1));
|
|
56
|
-
}
|
|
57
|
-
if ((_context$labels5 = context.labels) !== null && _context$labels5 !== void 0 && _context$labels5.execution2 || (_context$answers4 = context.answers) !== null && _context$answers4 !== void 0 && _context$answers4.execution2) {
|
|
58
|
-
var _context$labels$execu2, _context$labels6;
|
|
59
|
-
lines.push("Uitvoering 2: ".concat((_context$labels$execu2 = (_context$labels6 = context.labels) === null || _context$labels6 === void 0 ? void 0 : _context$labels6.execution2) !== null && _context$labels$execu2 !== void 0 ? _context$labels$execu2 : context.answers.execution2));
|
|
60
|
-
}
|
|
61
|
-
lines.push("Artikelnummers: ".concat(formatArticles(items)));
|
|
62
|
-
return lines.join('\n');
|
|
63
|
-
};
|
|
64
|
-
const collectVehicleContextGroups = function collectVehicleContextGroups() {
|
|
65
|
-
let cart = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
66
|
-
const groups = {};
|
|
67
|
-
const ungrouped = [];
|
|
68
|
-
for (const item of cart) {
|
|
69
|
-
var _groups$key;
|
|
70
|
-
const key = getContextKey(item.vehicleContext);
|
|
71
|
-
if (!key) {
|
|
72
|
-
ungrouped.push(item);
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
groups[key] = (_groups$key = groups[key]) !== null && _groups$key !== void 0 ? _groups$key : {
|
|
76
|
-
context: item.vehicleContext,
|
|
77
|
-
items: []
|
|
78
|
-
};
|
|
79
|
-
groups[key].items.push(item);
|
|
80
|
-
}
|
|
81
|
-
return {
|
|
82
|
-
groups: Object.values(groups),
|
|
83
|
-
ungrouped
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
const getSingleUsedVehicleContext = exports.getSingleUsedVehicleContext = function getSingleUsedVehicleContext() {
|
|
87
|
-
let cart = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
88
|
-
const {
|
|
89
|
-
groups,
|
|
90
|
-
ungrouped
|
|
91
|
-
} = collectVehicleContextGroups(cart);
|
|
92
|
-
return groups.length === 1 && ungrouped.length === 0 ? groups[0].context : null;
|
|
93
|
-
};
|
|
94
|
-
const buildSingleOrderVehicleReceipt = _ref2 => {
|
|
95
|
-
let {
|
|
96
|
-
cart = [],
|
|
97
|
-
userNote
|
|
98
|
-
} = _ref2;
|
|
99
|
-
const {
|
|
100
|
-
groups,
|
|
101
|
-
ungrouped
|
|
102
|
-
} = collectVehicleContextGroups(cart);
|
|
103
|
-
const sections = groups.map(_ref3 => {
|
|
104
|
-
let {
|
|
105
|
-
context,
|
|
106
|
-
items
|
|
107
|
-
} = _ref3;
|
|
108
|
-
return formatVehicleContext(context, items);
|
|
109
|
-
});
|
|
110
|
-
if (ungrouped.length) {
|
|
111
|
-
sections.push("Zonder voertuigfilter\nArtikelnummers: ".concat(formatArticles(ungrouped)));
|
|
112
|
-
}
|
|
113
|
-
const receipt = sections.length ? ['Zoekcontext losse order', ...sections].join('\n\n') : '';
|
|
114
|
-
const trimmedUserNote = userNote === null || userNote === void 0 ? void 0 : userNote.trim();
|
|
115
|
-
return [trimmedUserNote, receipt].filter(Boolean).join('\n\n');
|
|
116
|
-
};
|
|
117
|
-
exports.buildSingleOrderVehicleReceipt = buildSingleOrderVehicleReceipt;
|