thm-p3-configurator 0.0.411 → 0.0.412

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.
@@ -106,6 +106,7 @@ const useCreateQuotationMutation = () => {
106
106
  formula,
107
107
  discount,
108
108
  vehicle,
109
+ skipFilters,
109
110
  isExitIntent = false
110
111
  } = _ref;
111
112
  return _publicProxyApi.publicProxyApi.postQuotation({
@@ -118,6 +119,7 @@ const useCreateQuotationMutation = () => {
118
119
  discount,
119
120
  answers: answers,
120
121
  cart: cart,
122
+ skipFilters,
121
123
  selectBoardComputerUpdate: selectBoardComputerUpdate,
122
124
  customer: customer,
123
125
  branchId
@@ -149,7 +151,8 @@ const useCreateAppointmentRequestMutation = () => {
149
151
  vehicle,
150
152
  discount,
151
153
  formula,
152
- branchId
154
+ branchId,
155
+ skipFilters
153
156
  } = _ref2;
154
157
  return _publicProxyApi.publicProxyApi.postAppointmentRequest({
155
158
  model,
@@ -158,6 +161,7 @@ const useCreateAppointmentRequestMutation = () => {
158
161
  formula,
159
162
  answers: answers,
160
163
  cart: cart,
164
+ skipFilters,
161
165
  selectBoardComputerUpdate: selectBoardComputerUpdate,
162
166
  customer,
163
167
  branchId,
@@ -297,6 +301,7 @@ const useCreatePrivateQuotationMutation = () => {
297
301
  extraPrice,
298
302
  isExitIntent = false,
299
303
  montageRate,
304
+ skipFilters,
300
305
  leasemaatschappijEntityId,
301
306
  leasemaatschappijBedrijfsnaam,
302
307
  leasemaatschappijContactpersoonNaam,
@@ -326,6 +331,7 @@ const useCreatePrivateQuotationMutation = () => {
326
331
  extraPrice,
327
332
  answers,
328
333
  cart,
334
+ skipFilters,
329
335
  selectBoardComputerUpdate,
330
336
  customer: restCustomer,
331
337
  branchId,
@@ -354,6 +360,7 @@ const useCreatePrivateQuotationMutation = () => {
354
360
  extraPrice,
355
361
  answers,
356
362
  cart,
363
+ skipFilters,
357
364
  selectBoardComputerUpdate,
358
365
  customer: restCustomer,
359
366
  branchId,
@@ -419,6 +426,7 @@ const useCreatePrivateAppointmentMutation = () => {
419
426
  extraPrice,
420
427
  customerAgreed,
421
428
  montageRate,
429
+ skipFilters,
422
430
  leasemaatschappijEntityId,
423
431
  leasemaatschappijBedrijfsnaam,
424
432
  leasemaatschappijContactpersoonNaam,
@@ -449,6 +457,7 @@ const useCreatePrivateAppointmentMutation = () => {
449
457
  extraPrice,
450
458
  answers,
451
459
  cart,
460
+ skipFilters,
452
461
  selectBoardComputerUpdate,
453
462
  customer: restCustomer,
454
463
  branchId,
@@ -513,6 +522,7 @@ const useCreatePrivateAppointmentRequestMutation = () => {
513
522
  discount,
514
523
  customerAgreed,
515
524
  montageRate,
525
+ skipFilters,
516
526
  leasemaatschappijEntityId,
517
527
  leasemaatschappijBedrijfsnaam,
518
528
  leasemaatschappijContactpersoonNaam,
@@ -541,6 +551,7 @@ const useCreatePrivateAppointmentRequestMutation = () => {
541
551
  discount,
542
552
  answers,
543
553
  cart,
554
+ skipFilters,
544
555
  selectBoardComputerUpdate,
545
556
  customer: restCustomer,
546
557
  branchId,
@@ -603,6 +614,7 @@ const useUpdatePrivateAppointmentRequestByIdMutation = id => {
603
614
  priceCalculationDate,
604
615
  customerAgreed,
605
616
  montageRate,
617
+ skipFilters,
606
618
  leasemaatschappijEntityId,
607
619
  leasemaatschappijBedrijfsnaam,
608
620
  leasemaatschappijContactpersoonNaam,
@@ -641,6 +653,7 @@ const useUpdatePrivateAppointmentRequestByIdMutation = id => {
641
653
  discount,
642
654
  answers,
643
655
  cart,
656
+ skipFilters,
644
657
  selectBoardComputerUpdate,
645
658
  customer: restCustomer,
646
659
  branchId,
@@ -694,6 +707,7 @@ const useUpdatePrivateQuotationByIdMutation = id => {
694
707
  extraPrice,
695
708
  priceCalculationDate,
696
709
  montageRate,
710
+ skipFilters,
697
711
  leasemaatschappijEntityId,
698
712
  leasemaatschappijBedrijfsnaam,
699
713
  leasemaatschappijContactpersoonNaam,
@@ -732,6 +746,7 @@ const useUpdatePrivateQuotationByIdMutation = id => {
732
746
  extraPrice,
733
747
  answers,
734
748
  cart,
749
+ skipFilters,
735
750
  selectBoardComputerUpdate,
736
751
  customer: restCustomer,
737
752
  branchId,
@@ -786,6 +801,7 @@ const useUpdatePrivateAppointmentByIdMutation = id => {
786
801
  customerAgreed,
787
802
  invoicePaymentByLeaseCompany,
788
803
  montageRate,
804
+ skipFilters,
789
805
  leasemaatschappijEntityId,
790
806
  leasemaatschappijBedrijfsnaam,
791
807
  leasemaatschappijContactpersoonNaam,
@@ -825,6 +841,7 @@ const useUpdatePrivateAppointmentByIdMutation = id => {
825
841
  extraPrice,
826
842
  answers,
827
843
  cart,
844
+ skipFilters,
828
845
  selectBoardComputerUpdate,
829
846
  customer: _objectSpread(_objectSpread({}, restCustomer), {}, {
830
847
  invoicePaymentByLeaseCompany
@@ -159,7 +159,8 @@ const AppointmentForm = () => {
159
159
  priceCalculationDate,
160
160
  selectedDiscountedProducts = [],
161
161
  selectedExtras,
162
- vehicleCodingDiscountPercentage
162
+ vehicleCodingDiscountPercentage,
163
+ skipFilters
163
164
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
164
165
  const [errors, setErrors] = (0, _react.useState)({});
165
166
  const [isTermsAccepted, setIsTermsAccepted] = (0, _react.useState)(false);
@@ -212,6 +213,7 @@ const AppointmentForm = () => {
212
213
  formula,
213
214
  branchId: selectedBranch,
214
215
  selectBoardComputerUpdate: selectedBoardComputer != null,
216
+ skipFilters,
215
217
  discount: (() => {
216
218
  if (!(discountCode !== null && discountCode !== void 0 && discountCode.length)) return null;
217
219
  if (discountCode.toLocaleLowerCase().includes('anwb') && !anwbDiscountValidated) return null;
@@ -146,7 +146,8 @@ const ExitIntentModal = () => {
146
146
  priceCalculationDate,
147
147
  selectedDiscountedProducts = [],
148
148
  selectedExtras,
149
- vehicleCodingDiscountPercentage
149
+ vehicleCodingDiscountPercentage,
150
+ skipFilters
150
151
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
151
152
  const formula = (0, _FormulaContext.useFormula)();
152
153
  const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
@@ -229,6 +230,7 @@ const ExitIntentModal = () => {
229
230
  })),
230
231
  branchId: selectedBranch,
231
232
  selectBoardComputerUpdate: selectedBoardComputer != null,
233
+ skipFilters,
232
234
  cart: (0, _product.buildCartInput)({
233
235
  selectedCableset,
234
236
  selectedCombiset,
@@ -94,6 +94,7 @@ const ProductCartSide = () => {
94
94
  selectedCombiset,
95
95
  selectedBoardComputer,
96
96
  allArticleNumbers,
97
+ existingDossierId,
97
98
  selectedExtras,
98
99
  canAlterQuantity,
99
100
  selectedBranch,
@@ -121,7 +122,7 @@ const ProductCartSide = () => {
121
122
  consumerDiscounts,
122
123
  touchedConsumerDiscounts
123
124
  });
124
- const shouldRequestUnfilteredProducts = (0, _product.shouldRequestUnfilteredProductsForCart)(cartInput);
125
+ const shouldRequestUnfilteredProducts = (0, _product.shouldRequestUnfilteredProductsForCart)(cartInput) || Boolean(existingDossierId && (allArticleNumbers === null || allArticleNumbers === void 0 ? void 0 : allArticleNumbers.length) > 0);
125
126
  const {
126
127
  cart,
127
128
  totals,
@@ -158,10 +159,10 @@ const ProductCartSide = () => {
158
159
  let mainProducts = [];
159
160
  let accessoireProducts = [];
160
161
  if (products) {
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;
162
+ var _products$Trekhaak, _products$Trekhaak$fi, _products$Trekhaak2, _products$Combiset, _products$Combiset$fi, _products$Combiset2, _products$Kabelset, _products$Kabelset$fi, _products$Kabelset2, _products$Elektronica, _products$Extras;
163
+ const towbar = selectedTowbar && ((_products$Trekhaak = products.Trekhaak) === null || _products$Trekhaak === void 0 ? void 0 : _products$Trekhaak.find(product => product.articleNumber === selectedTowbar)) || (existingDossierId ? (_products$Trekhaak$fi = (_products$Trekhaak2 = products.Trekhaak) === null || _products$Trekhaak2 === void 0 ? void 0 : _products$Trekhaak2.find(product => allArticleNumbers === null || allArticleNumbers === void 0 ? void 0 : allArticleNumbers.includes(product.articleNumber))) !== null && _products$Trekhaak$fi !== void 0 ? _products$Trekhaak$fi : null : null);
164
+ const combiset = selectedCombiset && ((_products$Combiset = products.Combiset) === null || _products$Combiset === void 0 ? void 0 : _products$Combiset.find(product => product.articleNumber === selectedCombiset)) || (existingDossierId ? (_products$Combiset$fi = (_products$Combiset2 = products.Combiset) === null || _products$Combiset2 === void 0 ? void 0 : _products$Combiset2.find(product => allArticleNumbers === null || allArticleNumbers === void 0 ? void 0 : allArticleNumbers.includes(product.articleNumber))) !== null && _products$Combiset$fi !== void 0 ? _products$Combiset$fi : null : null);
165
+ const cableset = selectedCableset && ((_products$Kabelset = products.Kabelset) === null || _products$Kabelset === void 0 ? void 0 : _products$Kabelset.find(product => product.articleNumber === selectedCableset)) || (existingDossierId ? (_products$Kabelset$fi = (_products$Kabelset2 = products.Kabelset) === null || _products$Kabelset2 === void 0 ? void 0 : _products$Kabelset2.find(product => allArticleNumbers === null || allArticleNumbers === void 0 ? void 0 : allArticleNumbers.includes(product.articleNumber))) !== null && _products$Kabelset$fi !== void 0 ? _products$Kabelset$fi : null : null);
165
166
  const boardComputer = selectedBoardComputer && ((_products$Elektronica = products['Elektronica boordcomputer updaten']) === null || _products$Elektronica === void 0 ? void 0 : _products$Elektronica.find(product => product.articleNumber === selectedBoardComputer)) || null;
166
167
  const extras = Object.keys(selectedExtras);
167
168
  mainProducts = [towbar, combiset, cableset, boardComputer].filter(Boolean);
@@ -266,6 +266,7 @@ const ProductCartTable = () => {
266
266
  selectedExtras,
267
267
  executionAnswer1,
268
268
  allArticleNumbers,
269
+ existingDossierId,
269
270
  canAlterQuantity,
270
271
  executionAnswer2,
271
272
  discountAmount,
@@ -347,7 +348,10 @@ const ProductCartTable = () => {
347
348
  consumerDiscounts,
348
349
  touchedConsumerDiscounts
349
350
  });
350
- const shouldRequestUnfilteredProducts = (0, _product.shouldRequestUnfilteredProductsForCart)(cartInput);
351
+ // Also request unfiltered products when editing an existing dossier with
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);
351
355
  const durationAnswerForQuery = durationAnswerIsPrefilled ? undefined : durationAnswer;
352
356
  const {
353
357
  cart,
@@ -472,14 +476,19 @@ const ProductCartTable = () => {
472
476
  mainProducts,
473
477
  accessoireProducts
474
478
  } = (0, _react.useMemo)(() => {
475
- var _products$Trekhaak, _products$Combiset, _products$Kabelset, _products$Elektronica, _products$Extras;
479
+ var _products$Trekhaak, _products$Trekhaak$fi, _products$Trekhaak2, _products$Combiset, _products$Combiset$fi, _products$Combiset2, _products$Kabelset, _products$Kabelset$fi, _products$Kabelset2, _products$Elektronica, _products$Extras;
476
480
  if (!products) return {
477
481
  mainProducts: [],
478
482
  accessoireProducts: []
479
483
  };
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;
484
+
485
+ // When selectedTowbar/Cableset/Combiset is null (hydration failed to classify
486
+ // the article, e.g. a non-standard towbar not in the formula catalogue),
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;
483
492
  const boardComputer = selectedBoardComputer ? (_products$Elektronica = products['Elektronica boordcomputer updaten']) === null || _products$Elektronica === void 0 ? void 0 : _products$Elektronica.find(p => p.articleNumber === selectedBoardComputer) : null;
484
493
  const rawMainProducts = [towbar, combiset, cableset, boardComputer].filter(Boolean);
485
494
  const extras = Object.keys(selectedExtras);
@@ -7,6 +7,7 @@ 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");
10
11
  require("core-js/modules/web.dom-collections.iterator.js");
11
12
  require("core-js/modules/es.weak-map.js");
12
13
  Object.defineProperty(exports, "__esModule", {
@@ -19,6 +20,7 @@ require("core-js/modules/es.json.stringify.js");
19
20
  require("core-js/modules/esnext.iterator.constructor.js");
20
21
  require("core-js/modules/esnext.iterator.find.js");
21
22
  require("core-js/modules/esnext.iterator.map.js");
23
+ require("core-js/modules/esnext.iterator.some.js");
22
24
  require("core-js/modules/web.dom-collections.iterator.js");
23
25
  var _react = _interopRequireWildcard(require("react"));
24
26
  var _reactRouter = require("react-router");
@@ -69,11 +71,10 @@ function _interopRequireWildcard(e, r) {
69
71
  return n.default = e, t && t.set(e, n), n;
70
72
  }
71
73
  const ProductsOverview = () => {
72
- var _products$Trekhaak3, _products$Kabelset, _products$Combiset;
74
+ var _products$Trekhaak4, _products$Kabelset, _products$Combiset;
73
75
  const isProductsInitialLoad = (0, _react.useRef)(true);
74
76
  const formula = (0, _FormulaContext.useFormula)();
75
77
  const isTmg = (0, _useIsTmg.useIsTmg)();
76
- const [skipFilters, setSkipFilters] = (0, _react.useState)(false);
77
78
  const [{
78
79
  licensePlate,
79
80
  model,
@@ -96,7 +97,9 @@ const ProductsOverview = () => {
96
97
  discountAmount,
97
98
  discountPercentage,
98
99
  montageRate,
99
- extraPriceAmount
100
+ extraPriceAmount,
101
+ existingDossierId,
102
+ skipFilters
100
103
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
101
104
  const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
102
105
  const durationAnswerForQuery = durationAnswerIsPrefilled ? undefined : durationAnswer;
@@ -134,11 +137,40 @@ const ProductsOverview = () => {
134
137
  montageRate: (0, _montageRate.toApiMontageRate)(montageRate),
135
138
  extraPriceAmount
136
139
  });
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.
137
145
  (0, _react.useEffect)(() => {
138
- var _products$Trekhaak, _products$Trekhaak2, _products$PRODUCT_CAT3;
146
+ var _products$Trekhaak, _products$PRODUCT_CAT, _products$PRODUCT_CAT2;
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
+
139
171
  // Only run this if we have products loaded and no towbar is currently selected
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;
172
+ if (!isLoadingProducts && (products === null || products === void 0 || (_products$Trekhaak2 = products.Trekhaak) === null || _products$Trekhaak2 === void 0 ? void 0 : _products$Trekhaak2.length) === 1 && !selectedTowbar && !selectedCombiset) {
173
+ var _products$PRODUCT_CAT3;
142
174
  const towbarId = products.Trekhaak[0].articleNumber;
143
175
  dispatch({
144
176
  type: _OrderSessionContext.orderSessionActions.SET_SELECTED_TOWBAR,
@@ -148,7 +180,7 @@ const ProductsOverview = () => {
148
180
  });
149
181
 
150
182
  // Auto-select kabelset if there's exactly one kabelset available (reusing existing logic)
151
- if (!selectedCableset && ((_products$PRODUCT_CAT = products[_constants__.PRODUCT_CATEGORIES.CABLESET]) === null || _products$PRODUCT_CAT === void 0 ? void 0 : _products$PRODUCT_CAT.length) === 1) {
183
+ if (!selectedCableset && ((_products$PRODUCT_CAT3 = products[_constants__.PRODUCT_CATEGORIES.CABLESET]) === null || _products$PRODUCT_CAT3 === void 0 ? void 0 : _products$PRODUCT_CAT3.length) === 1) {
152
184
  const kabelsetId = products[_constants__.PRODUCT_CATEGORIES.CABLESET][0].articleNumber;
153
185
  dispatch({
154
186
  type: _OrderSessionContext.orderSessionActions.SET_SELECTED_CABLESET,
@@ -159,7 +191,7 @@ const ProductsOverview = () => {
159
191
  }
160
192
  }
161
193
  // If we have multiple towbars, pre-select the recommended one if no other is selected
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) {
194
+ else if (!isLoadingProducts && (products === null || products === void 0 || (_products$Trekhaak3 = products.Trekhaak) === null || _products$Trekhaak3 === void 0 ? void 0 : _products$Trekhaak3.length) > 1 && !selectedTowbar && !selectedCombiset) {
163
195
  // Find the recommended towbar
164
196
  const recommendedTowbar = products.Trekhaak.find(product => (0, _product.checkIfTowbarIsRecommended)({
165
197
  product,
@@ -168,7 +200,7 @@ const ProductsOverview = () => {
168
200
 
169
201
  // If there's a recommended towbar, select it
170
202
  if (recommendedTowbar) {
171
- var _products$PRODUCT_CAT2;
203
+ var _products$PRODUCT_CAT4;
172
204
  dispatch({
173
205
  type: _OrderSessionContext.orderSessionActions.SET_SELECTED_TOWBAR,
174
206
  payload: {
@@ -177,7 +209,7 @@ const ProductsOverview = () => {
177
209
  });
178
210
 
179
211
  // Auto-select kabelset if no kabelset is currently selected
180
- if (!selectedCableset && ((_products$PRODUCT_CAT2 = products[_constants__.PRODUCT_CATEGORIES.CABLESET]) === null || _products$PRODUCT_CAT2 === void 0 ? void 0 : _products$PRODUCT_CAT2.length) === 1) {
212
+ if (!selectedCableset && ((_products$PRODUCT_CAT4 = products[_constants__.PRODUCT_CATEGORIES.CABLESET]) === null || _products$PRODUCT_CAT4 === void 0 ? void 0 : _products$PRODUCT_CAT4.length) === 1) {
181
213
  const kabelsetId = products[_constants__.PRODUCT_CATEGORIES.CABLESET][0].articleNumber;
182
214
  dispatch({
183
215
  type: _OrderSessionContext.orderSessionActions.SET_SELECTED_CABLESET,
@@ -190,7 +222,7 @@ const ProductsOverview = () => {
190
222
  }
191
223
 
192
224
  // Auto-select boardcomputer if one is available and none is currently selected
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) {
225
+ if (!isLoadingProducts && (products === null || products === void 0 || (_products$PRODUCT_CAT5 = products[_constants__.PRODUCT_CATEGORIES.BOARD_COMPUTER]) === null || _products$PRODUCT_CAT5 === void 0 ? void 0 : _products$PRODUCT_CAT5.length) > 0 && !selectedBoardComputer && !isBoardComputerDeselected) {
194
226
  const boardComputerId = products[_constants__.PRODUCT_CATEGORIES.BOARD_COMPUTER][0].articleNumber;
195
227
  dispatch({
196
228
  type: _OrderSessionContext.orderSessionActions.SET_SELECTED_BOARDCOMPUTER,
@@ -199,8 +231,8 @@ const ProductsOverview = () => {
199
231
  }
200
232
  });
201
233
  }
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)) {
234
+ }, [isLoadingProducts, products, selectedTowbar, selectedCableset, selectedBoardComputer, isBoardComputerDeselected, existingDossierId, dispatch]);
235
+ 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)) {
204
236
  return /*#__PURE__*/_react.default.createElement(_reactRouter.Redirect, {
205
237
  to: "/configurator/geen-producten"
206
238
  });
@@ -243,9 +275,9 @@ const ProductsOverview = () => {
243
275
 
244
276
  // Auto-select kabelset if towbar is selected and no kabelset is currently selected
245
277
  if (isSelected && !selectedCableset) {
246
- var _products$PRODUCT_CAT4;
278
+ var _products$PRODUCT_CAT6;
247
279
  // Check if there's exactly one kabelset available
248
- if (((_products$PRODUCT_CAT4 = products[_constants__.PRODUCT_CATEGORIES.CABLESET]) === null || _products$PRODUCT_CAT4 === void 0 ? void 0 : _products$PRODUCT_CAT4.length) === 1) {
280
+ if (((_products$PRODUCT_CAT6 = products[_constants__.PRODUCT_CATEGORIES.CABLESET]) === null || _products$PRODUCT_CAT6 === void 0 ? void 0 : _products$PRODUCT_CAT6.length) === 1) {
249
281
  const kabelsetId = products[_constants__.PRODUCT_CATEGORIES.CABLESET][0].articleNumber;
250
282
  dispatch({
251
283
  type: _OrderSessionContext.orderSessionActions.SET_SELECTED_CABLESET,
@@ -328,7 +360,12 @@ const ProductsOverview = () => {
328
360
  name: 'skipFilters',
329
361
  initialValue: skipFilters,
330
362
  onChange: value => {
331
- setSkipFilters(value);
363
+ dispatch({
364
+ type: _OrderSessionContext.orderSessionActions.SET_SKIP_FILTERS,
365
+ payload: {
366
+ skipFilters: value
367
+ }
368
+ });
332
369
  },
333
370
  label: "Toon alle artikelen"
334
371
  }), isLoadingProducts && isProductsInitialLoad.current === true ? /*#__PURE__*/_react.default.createElement("div", {
@@ -150,7 +150,8 @@ const QuotationForm = () => {
150
150
  discountCode,
151
151
  selectedDiscountedProducts = [],
152
152
  selectedExtras,
153
- vehicleCodingDiscountPercentage
153
+ vehicleCodingDiscountPercentage,
154
+ skipFilters
154
155
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
155
156
  const [errors, setErrors] = (0, _react.useState)({});
156
157
  const [isTermsAccepted, setIsTermsAccepted] = (0, _react.useState)(false);
@@ -214,6 +215,7 @@ const QuotationForm = () => {
214
215
  customer: (0, _helpers__.removeNullishProps)(customer),
215
216
  branchId: selectedBranch,
216
217
  selectBoardComputerUpdate: selectedBoardComputer != null,
218
+ skipFilters,
217
219
  cart: (0, _product.buildCartInput)({
218
220
  selectedCableset,
219
221
  selectedCombiset,
@@ -273,7 +273,8 @@ const InternalAppointmentForm = _ref => {
273
273
  isTowCenterBranch,
274
274
  extraPriceAmount,
275
275
  extraPriceDescription,
276
- orderProcessingNote
276
+ orderProcessingNote,
277
+ skipFilters
277
278
  } = order;
278
279
 
279
280
  // Track the original ownership type from context
@@ -671,6 +672,7 @@ const InternalAppointmentForm = _ref => {
671
672
  }), {}, {
672
673
  branchId: selectedBranch,
673
674
  selectBoardComputerUpdate: selectedBoardComputer != null,
675
+ skipFilters,
674
676
  cart: (0, _product.buildCartInput)({
675
677
  selectedCableset,
676
678
  selectedCombiset,
@@ -243,7 +243,8 @@ const InternalQuotationForm = _ref => {
243
243
  montageRate,
244
244
  isTowCenterBranch,
245
245
  extraPriceAmount,
246
- extraPriceDescription
246
+ extraPriceDescription,
247
+ skipFilters
247
248
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
248
249
  const [errors, setErrors] = (0, _react.useState)({});
249
250
  const [companySearchTerm, setCompanySearchTerm] = (0, _react.useState)('');
@@ -579,6 +580,7 @@ const InternalQuotationForm = _ref => {
579
580
  }), {}, {
580
581
  branchId: selectedBranch,
581
582
  selectBoardComputerUpdate: selectedBoardComputer != null,
583
+ skipFilters,
582
584
  cart: (0, _product.buildCartInput)({
583
585
  selectedCableset,
584
586
  selectedCombiset,
@@ -137,6 +137,7 @@ const INITIAL_ORDER_SESSION_STATE = {
137
137
  selectedTowbar: null,
138
138
  selectedCableset: null,
139
139
  selectedCombiset: null,
140
+ skipFilters: false,
140
141
  leaseNumberUnknown: true,
141
142
  selectedDiscountedProducts: [],
142
143
  discountsInitialized: false,
@@ -235,6 +236,7 @@ const orderSessionActions = exports.orderSessionActions = {
235
236
  SET_SELECTED_TOWBAR: 'SET_SELECTED_TOWBAR',
236
237
  SET_SELECTED_CABLESET: 'SET_SELECTED_CABLESET',
237
238
  SET_SELECTED_COMBISET: 'SET_SELECTED_COMBISET',
239
+ SET_SKIP_FILTERS: 'SET_SKIP_FILTERS',
238
240
  ADD_DISCOUNTED_PRODUCT: 'ADD_DISCOUNTED_PRODUCT',
239
241
  DISCOUNTS_INITIALIZED: 'DISCOUNTS_INITIALIZED',
240
242
  RESET_SINGLE_ORDER: 'RESET_SINGLE_ORDER',
@@ -334,6 +336,7 @@ const orderSessionReducer = (state, action) => {
334
336
  selectedTowbar: null,
335
337
  selectedCableset: null,
336
338
  selectedCombiset: null,
339
+ skipFilters: false,
337
340
  selectedDiscountedProducts: [],
338
341
  selectedBoardComputer: null,
339
342
  isBoardComputerDeselected: false,
@@ -554,6 +557,16 @@ const orderSessionReducer = (state, action) => {
554
557
  selectedCableset: null
555
558
  });
556
559
  }
560
+ case orderSessionActions.SET_SKIP_FILTERS:
561
+ {
562
+ const {
563
+ skipFilters
564
+ } = action.payload;
565
+ return _objectSpread(_objectSpread({}, state), {}, {
566
+ skipFilters,
567
+ isTouched: true
568
+ });
569
+ }
557
570
  case orderSessionActions.ADD_EXTRA:
558
571
  {
559
572
  const {
@@ -219,6 +219,12 @@ const parseDossierToOrderSession = exports.parseDossierToOrderSession = function
219
219
  extraPriceDescription: (_meerprijsLine$extraN = meerprijsLine === null || meerprijsLine === void 0 ? void 0 : meerprijsLine.extraNote) !== null && _meerprijsLine$extraN !== void 0 ? _meerprijsLine$extraN : null
220
220
  };
221
221
  };
222
+ const PSEUDO_ORDER_LINE_ARTICLES = new Set(['MC', 'Montage', 'MEERPRIJS']);
223
+ const isVoertuigcoderingDossierLine = function isVoertuigcoderingDossierLine() {
224
+ var _line$name3, _line$groupName, _line$subgroupName;
225
+ let line = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
226
+ return (line === null || line === void 0 || (_line$name3 = line.name) === null || _line$name3 === void 0 ? void 0 : _line$name3.includes('Voertuigcodering')) || (line === null || line === void 0 || (_line$groupName = line.groupName) === null || _line$groupName === void 0 ? void 0 : _line$groupName.includes('Voertuigcodering')) || (line === null || line === void 0 || (_line$subgroupName = line.subgroupName) === null || _line$subgroupName === void 0 ? void 0 : _line$subgroupName.includes('Voertuigcodering'));
227
+ };
222
228
 
223
229
  /**
224
230
  * @description Categorizes the selected lines from a dossier `dossier.line`, using the order API `articles` field
@@ -249,9 +255,17 @@ const extractSessionProductsByOrder = _ref11 => {
249
255
  const touchedConsumerDiscounts = hasLineDiscount ? _objectSpread(_objectSpread({}, acc.touchedConsumerDiscounts), {}, {
250
256
  [lineItem.articleNumber]: true
251
257
  }) : acc.touchedConsumerDiscounts;
252
- if ((lineItem === null || lineItem === void 0 ? void 0 : lineItem.articleNumber) === (boardComputerUpdate === null || boardComputerUpdate === void 0 ? void 0 : boardComputerUpdate.articleNumber)) {
258
+ if (PSEUDO_ORDER_LINE_ARTICLES.has(lineItem === null || lineItem === void 0 ? void 0 : lineItem.articleNumber)) {
259
+ return _objectSpread(_objectSpread({}, acc), {}, {
260
+ allArticleNumbers,
261
+ consumerDiscounts,
262
+ touchedConsumerDiscounts
263
+ });
264
+ }
265
+ if ((lineItem === null || lineItem === void 0 ? void 0 : lineItem.articleNumber) === (boardComputerUpdate === null || boardComputerUpdate === void 0 ? void 0 : boardComputerUpdate.articleNumber) || isVoertuigcoderingDossierLine(lineItem)) {
266
+ var _boardComputerUpdate$;
253
267
  return _objectSpread(_objectSpread({}, acc), {}, {
254
- selectedBoardComputer: lineItem === null || lineItem === void 0 ? void 0 : lineItem.articleNumber,
268
+ selectedBoardComputer: (_boardComputerUpdate$ = boardComputerUpdate === null || boardComputerUpdate === void 0 ? void 0 : boardComputerUpdate.articleNumber) !== null && _boardComputerUpdate$ !== void 0 ? _boardComputerUpdate$ : lineItem === null || lineItem === void 0 ? void 0 : lineItem.articleNumber,
255
269
  allArticleNumbers,
256
270
  consumerDiscounts,
257
271
  touchedConsumerDiscounts
@@ -139,7 +139,10 @@ const InternalSessionEditPage = props => {
139
139
  }
140
140
  const orderRes = await _authenticatedProxyApi.authenticatedProxyApi.getOrder(new URLSearchParams((0, _helpers__.removeNullishProps)(_objectSpread(_objectSpread({}, session), {}, {
141
141
  formula: dossierFormula,
142
- existingDossierEntityId: dossierById === null || dossierById === void 0 ? void 0 : dossierById.entityId
142
+ existingDossierEntityId: dossierById === null || dossierById === void 0 ? void 0 : dossierById.entityId,
143
+ // Fetch all articles (including non-standard ones selected via "Toon alle
144
+ // artikelen") so extractSessionProductsByOrder can classify every dossier line
145
+ skipFilters: true
143
146
  }))).toString());
144
147
 
145
148
  // Note: we need to use this function to classify the products found in the dossier orderlines
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.411",
3
+ "version": "0.0.412",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",