thm-p3-configurator 0.0.405 → 0.0.406

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.
@@ -90,7 +90,7 @@ describe('queryKeyFactory', () => {
90
90
  });
91
91
  it('includes formula in brands and build-years keys', () => {
92
92
  expect((0, _queryKeyFactory.getBrandsQueryKey)('TMG')).toEqual(['brands', 'TMG']);
93
- expect((0, _queryKeyFactory.getBrandsQueryKey)('THCB')).toEqual(['brands', 'THCB']);
93
+ expect((0, _queryKeyFactory.getBrandsQueryKey)('TBE')).toEqual(['brands', 'TBE']);
94
94
  expect((0, _queryKeyFactory.getBuildYearsQueryKey)({
95
95
  brand: 'Volvo',
96
96
  formula: 'TMG'
@@ -54,7 +54,9 @@ const DatePickerInput = _ref => {
54
54
  label,
55
55
  errorMessage,
56
56
  minDate = new Date(),
57
- maxDate
57
+ maxDate,
58
+ filterDate,
59
+ includeDates
58
60
  } = _ref;
59
61
  const [value, setValue] = (0, _react.useState)(null);
60
62
  const [isTouched, setIsTouched] = (0, _react.useState)(false);
@@ -112,6 +114,8 @@ const DatePickerInput = _ref => {
112
114
  },
113
115
  minDate: minDate,
114
116
  maxDate: maxDate,
117
+ filterDate: filterDate,
118
+ includeDates: includeDates,
115
119
  locale: "nl",
116
120
  onFocus: handleFocus,
117
121
  onChange: date => handleChange(date),
@@ -1,19 +1,27 @@
1
1
  "use strict";
2
2
 
3
3
  require("core-js/modules/es.weak-map.js");
4
+ require("core-js/modules/esnext.iterator.constructor.js");
5
+ require("core-js/modules/esnext.iterator.filter.js");
6
+ require("core-js/modules/esnext.iterator.for-each.js");
4
7
  require("core-js/modules/web.dom-collections.iterator.js");
5
8
  require("core-js/modules/es.weak-map.js");
9
+ require("core-js/modules/esnext.iterator.constructor.js");
10
+ require("core-js/modules/esnext.iterator.filter.js");
11
+ require("core-js/modules/esnext.iterator.for-each.js");
6
12
  Object.defineProperty(exports, "__esModule", {
7
13
  value: true
8
14
  });
9
15
  exports.default = void 0;
10
16
  require("core-js/modules/web.dom-collections.iterator.js");
11
17
  var _nl = _interopRequireDefault(require("date-fns/locale/nl"));
18
+ var _dateFns = require("date-fns");
12
19
  var _setHours = _interopRequireDefault(require("date-fns/setHours"));
13
20
  var _setMinutes = _interopRequireDefault(require("date-fns/setMinutes"));
14
21
  var _moment = _interopRequireDefault(require("moment"));
15
22
  var _react = _interopRequireWildcard(require("react"));
16
23
  var _reactDatepicker = _interopRequireWildcard(require("react-datepicker"));
24
+ var _openingHours = require("../../__helpers__/openingHours");
17
25
  var _helpers__ = require("../../__helpers__");
18
26
  var _ErrorMessage = _interopRequireDefault(require("./ErrorMessage"));
19
27
  function _getRequireWildcardCache(e) {
@@ -46,30 +54,127 @@ function _interopRequireDefault(e) {
46
54
  default: e
47
55
  };
48
56
  }
57
+ function ownKeys(e, r) {
58
+ var t = Object.keys(e);
59
+ if (Object.getOwnPropertySymbols) {
60
+ var o = Object.getOwnPropertySymbols(e);
61
+ r && (o = o.filter(function (r) {
62
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
63
+ })), t.push.apply(t, o);
64
+ }
65
+ return t;
66
+ }
67
+ function _objectSpread(e) {
68
+ for (var r = 1; r < arguments.length; r++) {
69
+ var t = null != arguments[r] ? arguments[r] : {};
70
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
71
+ _defineProperty(e, r, t[r]);
72
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
73
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
74
+ });
75
+ }
76
+ return e;
77
+ }
78
+ function _defineProperty(e, r, t) {
79
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
80
+ value: t,
81
+ enumerable: !0,
82
+ configurable: !0,
83
+ writable: !0
84
+ }) : e[r] = t, e;
85
+ }
86
+ function _toPropertyKey(t) {
87
+ var i = _toPrimitive(t, "string");
88
+ return "symbol" == typeof i ? i : i + "";
89
+ }
90
+ function _toPrimitive(t, r) {
91
+ if ("object" != typeof t || !t) return t;
92
+ var e = t[Symbol.toPrimitive];
93
+ if (void 0 !== e) {
94
+ var i = e.call(t, r || "default");
95
+ if ("object" != typeof i) return i;
96
+ throw new TypeError("@@toPrimitive must return a primitive value.");
97
+ }
98
+ return ("string" === r ? String : Number)(t);
99
+ }
49
100
  (0, _reactDatepicker.registerLocale)('nl', _nl.default);
101
+ const getTimeInMinutes = date => {
102
+ if (!date) {
103
+ return null;
104
+ }
105
+ const value = new Date(date);
106
+ return value.getHours() * 60 + value.getMinutes();
107
+ };
50
108
  const TimePickerInput = _ref => {
109
+ var _openToDate$getTime, _openToDate$getTime2, _resolvedOpenToDate$g, _resolvedOpenToDate$g2, _minTime$getTime, _minTime$getTime2, _maxTime$getTime, _maxTime$getTime2;
51
110
  let {
52
111
  initialValue,
112
+ value: controlledValue,
53
113
  onChange,
54
114
  name,
55
115
  isRequired,
56
116
  label,
57
117
  isStrict = false,
118
+ isDisabled = false,
119
+ minTime: minTimeProp = null,
120
+ maxTime: maxTimeProp = null,
121
+ openToDate = null,
58
122
  errorMessage
59
123
  } = _ref;
60
- const [value, setValue] = (0, _react.useState)(null);
124
+ const isControlled = controlledValue !== undefined;
125
+ const [internalValue, setInternalValue] = (0, _react.useState)(null);
61
126
  const [isTouched, setIsTouched] = (0, _react.useState)(false);
127
+ const strictMinTime = isStrict ? (0, _setHours.default)((0, _setMinutes.default)(new Date(), 0), 6) : null;
128
+ const strictMaxTime = isStrict ? (0, _setHours.default)((0, _setMinutes.default)(new Date(), 0), 20) : null;
129
+ const minTime = minTimeProp !== null && minTimeProp !== void 0 ? minTimeProp : strictMinTime;
130
+ const maxTime = maxTimeProp !== null && maxTimeProp !== void 0 ? maxTimeProp : strictMaxTime;
131
+ const resolvedOpenToDate = (0, _react.useMemo)(() => openToDate ? new Date(openToDate) : null, [(_openToDate$getTime = openToDate === null || openToDate === void 0 || (_openToDate$getTime2 = openToDate.getTime) === null || _openToDate$getTime2 === void 0 ? void 0 : _openToDate$getTime2.call(openToDate)) !== null && _openToDate$getTime !== void 0 ? _openToDate$getTime : openToDate]);
132
+ const pickerMinDate = (0, _react.useMemo)(() => resolvedOpenToDate ? (0, _dateFns.startOfDay)(resolvedOpenToDate) : (0, _dateFns.startOfDay)(new Date()), [(_resolvedOpenToDate$g = resolvedOpenToDate === null || resolvedOpenToDate === void 0 || (_resolvedOpenToDate$g2 = resolvedOpenToDate.getTime) === null || _resolvedOpenToDate$g2 === void 0 ? void 0 : _resolvedOpenToDate$g2.call(resolvedOpenToDate)) !== null && _resolvedOpenToDate$g !== void 0 ? _resolvedOpenToDate$g : resolvedOpenToDate]);
133
+ const selectedValue = isControlled ? controlledValue !== null && controlledValue !== void 0 ? controlledValue : null : internalValue;
134
+ const initialTimestamp = initialValue instanceof Date ? initialValue.getTime() : initialValue ? new Date(initialValue).getTime() : null;
62
135
  (0, _react.useEffect)(() => {
63
- if ((0, _moment.default)().isValid(initialValue)) {
64
- setValue(initialValue);
136
+ if (isControlled) {
137
+ return;
138
+ }
139
+ if (initialTimestamp && (0, _moment.default)(initialTimestamp).isValid()) {
140
+ setInternalValue(new Date(initialTimestamp));
141
+ return;
65
142
  }
66
- }, [initialValue]);
143
+ setInternalValue(null);
144
+ }, [isControlled, initialTimestamp]);
145
+ const filterTime = (0, _react.useCallback)(time => {
146
+ if (!minTime && !maxTime) {
147
+ return true;
148
+ }
149
+ const selectedMinutes = getTimeInMinutes(time);
150
+ if (selectedMinutes == null) {
151
+ return false;
152
+ }
153
+ const minMinutes = getTimeInMinutes(minTime);
154
+ if (minMinutes != null && selectedMinutes < minMinutes) {
155
+ return false;
156
+ }
157
+ const maxMinutes = getTimeInMinutes(maxTime);
158
+ if (maxMinutes != null && selectedMinutes > maxMinutes) {
159
+ return false;
160
+ }
161
+ return true;
162
+ }, [(_minTime$getTime = minTime === null || minTime === void 0 || (_minTime$getTime2 = minTime.getTime) === null || _minTime$getTime2 === void 0 ? void 0 : _minTime$getTime2.call(minTime)) !== null && _minTime$getTime !== void 0 ? _minTime$getTime : minTime, (_maxTime$getTime = maxTime === null || maxTime === void 0 || (_maxTime$getTime2 = maxTime.getTime) === null || _maxTime$getTime2 === void 0 ? void 0 : _maxTime$getTime2.call(maxTime)) !== null && _maxTime$getTime !== void 0 ? _maxTime$getTime : maxTime]);
67
163
  const handleFocus = () => {
164
+ if (isDisabled) {
165
+ return;
166
+ }
68
167
  setIsTouched(true);
69
168
  };
70
169
  const handleChange = date => {
71
- setValue(date);
72
- onChange(date);
170
+ if (isDisabled) {
171
+ return;
172
+ }
173
+ const nextValue = date && resolvedOpenToDate ? (0, _openingHours.copyTimeToDate)(date, resolvedOpenToDate) : date;
174
+ if (!isControlled) {
175
+ setInternalValue(nextValue);
176
+ }
177
+ onChange(nextValue);
73
178
  };
74
179
  return /*#__PURE__*/_react.default.createElement("div", {
75
180
  className: (0, _helpers__.withStyle)('form-group')
@@ -80,10 +185,14 @@ const TimePickerInput = _ref => {
80
185
  className: isTouched && errorMessage ? (0, _helpers__.withStyle)('is-invalid') : ''
81
186
  }, /*#__PURE__*/_react.default.createElement("div", {
82
187
  className: (0, _helpers__.withStyle)('form-group__icon-field'),
83
- style: {
188
+ style: _objectSpread({
84
189
  position: 'relative',
85
190
  width: '100%'
86
- }
191
+ }, isDisabled ? {
192
+ pointerEvents: 'none',
193
+ opacity: 0.65,
194
+ cursor: 'not-allowed'
195
+ } : {})
87
196
  }, /*#__PURE__*/_react.default.createElement("span", {
88
197
  className: "fal fa-clock",
89
198
  "aria-hidden": "true",
@@ -107,13 +216,14 @@ const TimePickerInput = _ref => {
107
216
  timeCaption: name,
108
217
  id: name,
109
218
  name: name,
110
- selected: value,
219
+ disabled: isDisabled,
220
+ selected: selectedValue,
111
221
  onKeyDown: e => {
112
222
  e.preventDefault();
113
223
  },
114
- minDate: new Date(),
115
- minTime: isStrict ? (0, _setHours.default)((0, _setMinutes.default)(new Date(), 0), 6) : null,
116
- maxTime: isStrict ? (0, _setHours.default)((0, _setMinutes.default)(new Date(), 0), 20) : null,
224
+ minDate: pickerMinDate,
225
+ openToDate: resolvedOpenToDate !== null && resolvedOpenToDate !== void 0 ? resolvedOpenToDate : undefined,
226
+ filterTime: minTime || maxTime ? filterTime : undefined,
117
227
  locale: "nl",
118
228
  onFocus: handleFocus,
119
229
  wrapperClassName: (0, _helpers__.withStyle)('react-datepicker-wrapper'),
@@ -32,7 +32,9 @@ var _queries = require("../../__api__/queries");
32
32
  var _constants__ = require("../../__constants__");
33
33
  var _AuthSessionContext = require("../../__context__/AuthSessionContext");
34
34
  var _OrderSessionContext = require("../../__context__/OrderSessionContext");
35
+ var _openingHours = require("../../__helpers__/openingHours");
35
36
  var _helpers__ = require("../../__helpers__");
37
+ var _countryOptions = require("../../__helpers__/countryOptions");
36
38
  var _useIsTmg = require("../../__hooks__/useIsTmg");
37
39
  var _AddressLookupService = _interopRequireDefault(require("../../__services__/AddressLookupService"));
38
40
  var _LinkButton = _interopRequireDefault(require("../Buttons/LinkButton"));
@@ -160,7 +162,7 @@ const customerDetailsFormSchema = (0, _yup.object)({
160
162
  })
161
163
  });
162
164
  const InternalCustomerDetailsForm = (_ref, ref) => {
163
- var _customer$vatNumber, _customer$kvkNumber, _branchTypes$byId$aut, _authSession$branch, _authSession$branch2;
165
+ var _appointment$time$get, _appointment$time, _appointment$time$get2, _appointment$date$get, _appointment$date, _appointment$date$get2, _customer$vatNumber, _customer$kvkNumber, _branchTypes$byId$aut, _authSession$branch, _authSession$branch2, _ref5, _appointment$date$get3, _appointment$date2, _appointment$date2$ge;
164
166
  let {
165
167
  errors = {},
166
168
  onValidationError,
@@ -187,14 +189,13 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
187
189
  countries,
188
190
  isLoadingCountries
189
191
  } = (0, _queries.useCountriesQuery)();
190
- const countryOptions = (0, _react.useMemo)(() => {
191
- var _countries$results;
192
- if (!(countries !== null && countries !== void 0 && (_countries$results = countries.results) !== null && _countries$results !== void 0 && _countries$results.length)) return [];
193
- return countries.results.map(country => ({
194
- label: country.title,
195
- value: country.entityId
196
- }));
197
- }, [countries]);
192
+ const countryOptions = (0, _react.useMemo)(() => (0, _countryOptions.buildCountryDropdownOptions)(countries === null || countries === void 0 ? void 0 : countries.results), [countries]);
193
+ const appointmentTimeValue = (0, _react.useMemo)(() => {
194
+ if (!(appointment !== null && appointment !== void 0 && appointment.time) || !(appointment !== null && appointment !== void 0 && appointment.date)) {
195
+ return null;
196
+ }
197
+ return (0, _openingHours.copyTimeToDate)(new Date(appointment.time), new Date(appointment.date));
198
+ }, [(_appointment$time$get = appointment === null || appointment === void 0 || (_appointment$time = appointment.time) === null || _appointment$time === void 0 || (_appointment$time$get2 = _appointment$time.getTime) === null || _appointment$time$get2 === void 0 ? void 0 : _appointment$time$get2.call(_appointment$time)) !== null && _appointment$time$get !== void 0 ? _appointment$time$get : appointment === null || appointment === void 0 ? void 0 : appointment.time, (_appointment$date$get = appointment === null || appointment === void 0 || (_appointment$date = appointment.date) === null || _appointment$date === void 0 || (_appointment$date$get2 = _appointment$date.getTime) === null || _appointment$date$get2 === void 0 ? void 0 : _appointment$date$get2.call(_appointment$date)) !== null && _appointment$date$get !== void 0 ? _appointment$date$get : appointment === null || appointment === void 0 ? void 0 : appointment.date]);
198
199
  const authSession = (0, _AuthSessionContext.useAuthSession)();
199
200
  const isTmg = (0, _useIsTmg.useIsTmg)();
200
201
  const [companySearchTerm, setCompanySearchTerm] = (0, _react.useState)('');
@@ -263,10 +264,15 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
263
264
  const needsCustomerDeliveryIdentity = isDirectDeliveryEnabled;
264
265
  const isNetherlandsSelected = (0, _react.useMemo)(() => {
265
266
  if (!(selectedCountry !== null && selectedCountry !== void 0 && selectedCountry.label)) return false;
266
- return selectedCountry.label.toUpperCase() === 'NEDERLAND';
267
+ return selectedCountry.label.toUpperCase() === _constants__.COUNTRY_NAMES.NETHERLANDS;
267
268
  }, [selectedCountry === null || selectedCountry === void 0 ? void 0 : selectedCountry.label]);
268
- const shouldRequireKvkNumber = needsCustomerDeliveryIdentity && isBusinessOwnership && (isNetherlandsSelected || !(customer !== null && customer !== void 0 && (_customer$vatNumber = customer.vatNumber) !== null && _customer$vatNumber !== void 0 && _customer$vatNumber.trim()));
269
- const shouldRequireVatNumber = needsCustomerDeliveryIdentity && isBusinessOwnership && !isNetherlandsSelected && !(customer !== null && customer !== void 0 && (_customer$kvkNumber = customer.kvkNumber) !== null && _customer$kvkNumber !== void 0 && _customer$kvkNumber.trim());
269
+ const isBelgiumSelected = (0, _react.useMemo)(() => {
270
+ if (!(selectedCountry !== null && selectedCountry !== void 0 && selectedCountry.label)) return false;
271
+ const normalizedCountryLabel = selectedCountry.label.trim().toUpperCase();
272
+ return normalizedCountryLabel === _constants__.COUNTRY_NAMES.BELGIUM || normalizedCountryLabel === _constants__.COUNTRY_NAMES.BELGIUM_FALLBACK;
273
+ }, [selectedCountry === null || selectedCountry === void 0 ? void 0 : selectedCountry.label]);
274
+ const shouldRequireKvkNumber = needsCustomerDeliveryIdentity && isBusinessOwnership && (isNetherlandsSelected || !isNetherlandsSelected && !isBelgiumSelected && !(customer !== null && customer !== void 0 && (_customer$vatNumber = customer.vatNumber) !== null && _customer$vatNumber !== void 0 && _customer$vatNumber.trim()));
275
+ const shouldRequireVatNumber = needsCustomerDeliveryIdentity && isBusinessOwnership && (isBelgiumSelected || !isNetherlandsSelected && !isBelgiumSelected && !(customer !== null && customer !== void 0 && (_customer$kvkNumber = customer.kvkNumber) !== null && _customer$kvkNumber !== void 0 && _customer$kvkNumber.trim()));
270
276
 
271
277
  // Helper to update customer data for the active ownership type
272
278
  const updateCustomerField = (0, _react.useCallback)((field, value) => {
@@ -341,13 +347,15 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
341
347
  enabled: isBusinessOwnership
342
348
  });
343
349
  (0, _react.useEffect)(() => {
344
- if (!(customer !== null && customer !== void 0 && customer.countryId) && countryOptions !== null && countryOptions !== void 0 && countryOptions.length) {
345
- const defaultCountry = countryOptions.find(option => option.label === 'NEDERLAND');
346
- if (defaultCountry) {
347
- updateCustomerField('countryId', defaultCountry.value);
348
- }
350
+ if (customer !== null && customer !== void 0 && customer.countryId || !(countryOptions !== null && countryOptions !== void 0 && countryOptions.length)) {
351
+ return;
349
352
  }
350
- }, [customer === null || customer === void 0 ? void 0 : customer.countryId, countryOptions, updateCustomerField]);
353
+ const inferredCountry = (0, _helpers__.getCountryOptionForPostalCode)(customer === null || customer === void 0 ? void 0 : customer.zipCode, countryOptions);
354
+ const defaultCountry = inferredCountry || countryOptions.find(option => option.label === 'NEDERLAND');
355
+ if (defaultCountry) {
356
+ updateCustomerField('countryId', defaultCountry.value);
357
+ }
358
+ }, [customer === null || customer === void 0 ? void 0 : customer.countryId, customer === null || customer === void 0 ? void 0 : customer.zipCode, countryOptions, updateCustomerField]);
351
359
  (0, _react.useEffect)(() => {
352
360
  if (checkboxAvailability.shouldForceDirectDelivery && !Boolean(anderAfleveradres)) {
353
361
  dispatch({
@@ -505,6 +513,18 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
505
513
 
506
514
  setAddressLookupTimeoutId(newTimeoutId);
507
515
  };
516
+ const handlePostalCodeChange = value => {
517
+ updateCustomerField('zipCode', value);
518
+ const inferredCountry = (0, _helpers__.getCountryOptionForPostalCode)(value, countryOptions);
519
+ if (inferredCountry && inferredCountry.value !== (customer === null || customer === void 0 ? void 0 : customer.countryId)) {
520
+ updateCustomerField('countryId', inferredCountry.value);
521
+ }
522
+
523
+ // Trigger address lookup if house number is also available
524
+ if (customer.houseNumber) {
525
+ handleAddressLookup(value, customer.houseNumber);
526
+ }
527
+ };
508
528
 
509
529
  // Cleanup timeout on unmount
510
530
  (0, _react.useEffect)(() => {
@@ -526,7 +546,13 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
526
546
  });
527
547
  return false;
528
548
  }
529
- if (!isNetherlandsSelected && !hasKvkNumber && !hasVatNumber) {
549
+ if (isBelgiumSelected && !hasVatNumber) {
550
+ onValidationError === null || onValidationError === void 0 || onValidationError({
551
+ vatNumber: 'BTW-nummer is verplicht voor zakelijke dossiers in België'
552
+ });
553
+ return false;
554
+ }
555
+ if (!isNetherlandsSelected && !isBelgiumSelected && !hasKvkNumber && !hasVatNumber) {
530
556
  onValidationError === null || onValidationError === void 0 || onValidationError({
531
557
  kvkNumber: 'Vul een KVK- of BTW-nummer in',
532
558
  vatNumber: 'Vul een KVK- of BTW-nummer in'
@@ -843,13 +869,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
843
869
  placeholder: "",
844
870
  value: customer.zipCode,
845
871
  name: "zipCode",
846
- onChange: value => {
847
- updateCustomerField('zipCode', value);
848
- // Trigger address lookup if house number is also available
849
- if (customer.houseNumber) {
850
- handleAddressLookup(value, customer.houseNumber);
851
- }
852
- },
872
+ onChange: handlePostalCodeChange,
853
873
  isRequired: isDirectDeliveryEnabled,
854
874
  key: "zipCode-".concat(refreshKey),
855
875
  form: form,
@@ -902,6 +922,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
902
922
  label: "Stad:".concat(addressLookupLoading ? ' (wordt opgezocht...)' : ''),
903
923
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['city']
904
924
  }), /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
925
+ key: "country-".concat((customer === null || customer === void 0 ? void 0 : customer.countryId) || 'default'),
905
926
  options: countryOptions,
906
927
  name: "country",
907
928
  label: "Land:",
@@ -958,25 +979,35 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
958
979
  }, "Gegevens voor de afspraak", /*#__PURE__*/_react.default.createElement("br", null)), /*#__PURE__*/_react.default.createElement("div", {
959
980
  className: (0, _helpers__.withStyle)('col-12 col-md-6')
960
981
  }, /*#__PURE__*/_react.default.createElement(_DatePickerInput.default, {
961
- onChange: value => dispatch({
962
- type: _OrderSessionContext.orderSessionActions.SET_APPOINTMENT_DATE,
963
- payload: {
964
- date: value
965
- }
966
- }),
982
+ onChange: value => {
983
+ dispatch({
984
+ type: _OrderSessionContext.orderSessionActions.SET_APPOINTMENT_DATE,
985
+ payload: {
986
+ date: value
987
+ }
988
+ });
989
+ dispatch({
990
+ type: _OrderSessionContext.orderSessionActions.SET_APPOINTMENT_TIME,
991
+ payload: {
992
+ time: null
993
+ }
994
+ });
995
+ },
967
996
  name: 'Datum',
968
997
  label: "Datum",
969
998
  initialValue: appointment !== null && appointment !== void 0 && appointment.date ? new Date(appointment === null || appointment === void 0 ? void 0 : appointment.date) : null,
970
999
  isStrict: false,
971
1000
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['date']
972
1001
  }), /*#__PURE__*/_react.default.createElement(_TimePickerInput.default, {
973
- onChange: value => dispatch({
1002
+ key: "appointment-time-".concat((_ref5 = (_appointment$date$get3 = appointment === null || appointment === void 0 || (_appointment$date2 = appointment.date) === null || _appointment$date2 === void 0 || (_appointment$date2$ge = _appointment$date2.getTime) === null || _appointment$date2$ge === void 0 ? void 0 : _appointment$date2$ge.call(_appointment$date2)) !== null && _appointment$date$get3 !== void 0 ? _appointment$date$get3 : appointment === null || appointment === void 0 ? void 0 : appointment.date) !== null && _ref5 !== void 0 ? _ref5 : 'none'),
1003
+ value: appointmentTimeValue,
1004
+ onChange: time => dispatch({
974
1005
  type: _OrderSessionContext.orderSessionActions.SET_APPOINTMENT_TIME,
975
1006
  payload: {
976
- time: value
1007
+ time
977
1008
  }
978
1009
  }),
979
- initialValue: appointment !== null && appointment !== void 0 && appointment.time ? new Date(appointment === null || appointment === void 0 ? void 0 : appointment.time) : null,
1010
+ openToDate: appointment !== null && appointment !== void 0 && appointment.date ? new Date(appointment.date) : null,
980
1011
  name: 'Tijd',
981
1012
  label: "Tijd",
982
1013
  isStrict: false,
@@ -2,19 +2,19 @@
2
2
 
3
3
  var _index = require("../index");
4
4
  describe('__constants__/formula helpers', () => {
5
- it('keeps THCB exact when normalizing branch formulas', () => {
6
- expect((0, _index.mapBranchFormulaToConfiguratorFormula)('THCB')).toBe(_index.CONFIGURATOR_FORMULAS.THCB);
7
- expect((0, _index.mapBranchFormulaToConfiguratorFormula)('Trekhaakcentrum Business')).toBe(_index.CONFIGURATOR_FORMULAS.THCB);
5
+ it('keeps TBE exact when normalizing branch formulas', () => {
6
+ expect((0, _index.mapBranchFormulaToConfiguratorFormula)('TBE')).toBe(_index.CONFIGURATOR_FORMULAS.TBE);
7
+ expect((0, _index.mapBranchFormulaToConfiguratorFormula)('Trekhaakcentrum Business')).toBe(_index.CONFIGURATOR_FORMULAS.TBE);
8
8
  });
9
9
  it('normalizes known formula titles and codes without collapsing unknown codes', () => {
10
10
  expect((0, _index.getConfiguratorFormulaCode)('Trekhaakcentrum')).toBe(_index.CONFIGURATOR_FORMULAS.THC);
11
11
  expect((0, _index.getConfiguratorFormulaCode)('TowMotive')).toBe(_index.CONFIGURATOR_FORMULAS.TOW);
12
- expect((0, _index.getConfiguratorFormulaCode)('thcb')).toBe(_index.CONFIGURATOR_FORMULAS.THCB);
12
+ expect((0, _index.getConfiguratorFormulaCode)('tbe')).toBe(_index.CONFIGURATOR_FORMULAS.TBE);
13
13
  expect((0, _index.getConfiguratorFormulaCode)('abc')).toBe('ABC');
14
14
  });
15
- it('treats THCB as THC-family for theme decisions only', () => {
15
+ it('treats TBE as THC-family for theme decisions only', () => {
16
16
  expect((0, _index.isThcFamilyFormula)(_index.CONFIGURATOR_FORMULAS.THC)).toBe(true);
17
- expect((0, _index.isThcFamilyFormula)(_index.CONFIGURATOR_FORMULAS.THCB)).toBe(true);
18
- expect((0, _index.getThemeFormulaForConfiguratorFormula)(_index.CONFIGURATOR_FORMULAS.THCB)).toBe(_index.CONFIGURATOR_FORMULAS.THC);
17
+ expect((0, _index.isThcFamilyFormula)(_index.CONFIGURATOR_FORMULAS.TBE)).toBe(true);
18
+ expect((0, _index.getThemeFormulaForConfiguratorFormula)(_index.CONFIGURATOR_FORMULAS.TBE)).toBe(_index.CONFIGURATOR_FORMULAS.THC);
19
19
  });
20
20
  });
@@ -6,7 +6,7 @@ require("core-js/modules/es.string.trim.js");
6
6
  Object.defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
- exports.mapBranchFormulaToConfiguratorFormula = exports.isThcFamilyFormula = exports.getThemeFormulaForConfiguratorFormula = exports.getConfiguratorFormulaCode = exports.VESTIGING_TYPE_ID = exports.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE = exports.VEHICLE_OWNERSHIP_TYPE = exports.VEHICLE_CODING_SUBGROUP_NAME = exports.USER_GEOLOCATION_KEY = exports.TOWMOTIVE_ORGANIZATION_TYPE = exports.TMG_ORGANIZATION_TYPE = exports.StockStatus = exports.STATUS_ASSESSMENT = exports.PRODUCT_CATEGORIES = exports.PRIVATE_SINGLE_ORDER_SESSION_KEY = exports.PARTNER_PORTAL_PAGE_TITLES_BY_THEME = exports.PARTNER_PORTAL_CHANNEL_TITLE = exports.ORDER_SESSION_KEY = exports.NO_PRODUCTS_CONTACT_DETAILS_BY_FORMULA = exports.NAVIGATION_STEPS_INTERNAL = exports.NAVIGATION_STEPS_EXTERNAL = exports.NAVIGATION_BUTTONS = exports.MOUSE_EXIT_INTENT_THROTTLE = exports.MOUSE_EXIT_INTENT_OFFSET = exports.LOCATION_TYPE = exports.LOCATION_CHANGE_BUTTON_LABEL = exports.LOCALE = exports.LEASE_TYPE_ID = exports.FORM_ERROR_MESSAGES = exports.EXECUTION_HELP_CONTACT_DETAILS_BY_FORMULA = exports.DOSSIER_TYPES = exports.DISCOUNT_TYPES = exports.DEFAULT_MAP_LONGITUDE = exports.DEFAULT_MAP_LATITUDE = exports.DEFAULT_ARTICLE_BRAND = exports.DAY_NAMES = exports.CONFIGURATOR_FORMULAS = exports.BRANCH_THEME_BY_FORMULA = exports.BRANCH_FORMULAS = exports.BOARD_COMPUTER_DISABLED_KEY = exports.ApiStockStatus = exports.AUTH_SESSION_KEY = exports.ARTICLE_SPECS_TRANSLATIONS = exports.ARTICLES_SYSTEM_FIELDS = exports.API_ERROR_CODES = exports.ALL_EXPERIMENTS = exports.ACTIVE_VARIANTS = void 0;
9
+ exports.mapBranchFormulaToConfiguratorFormula = exports.isThcFamilyFormula = exports.getThemeFormulaForConfiguratorFormula = exports.getConfiguratorFormulaCode = exports.VESTIGING_TYPE_ID = exports.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE = exports.VEHICLE_OWNERSHIP_TYPE = exports.VEHICLE_CODING_SUBGROUP_NAME = exports.USER_GEOLOCATION_KEY = exports.TOWMOTIVE_ORGANIZATION_TYPE = exports.TMG_ORGANIZATION_TYPE = exports.StockStatus = exports.STATUS_ASSESSMENT = exports.PRODUCT_CATEGORIES = exports.PRIVATE_SINGLE_ORDER_SESSION_KEY = exports.PARTNER_PORTAL_PAGE_TITLES_BY_THEME = exports.PARTNER_PORTAL_CHANNEL_TITLE = exports.ORDER_SESSION_KEY = exports.NO_PRODUCTS_CONTACT_DETAILS_BY_FORMULA = exports.NAVIGATION_STEPS_INTERNAL = exports.NAVIGATION_STEPS_EXTERNAL = exports.NAVIGATION_BUTTONS = exports.MOUSE_EXIT_INTENT_THROTTLE = exports.MOUSE_EXIT_INTENT_OFFSET = exports.LOCATION_TYPE = exports.LOCATION_CHANGE_BUTTON_LABEL = exports.LOCALE = exports.LEASE_TYPE_ID = exports.FORM_ERROR_MESSAGES = exports.EXECUTION_HELP_CONTACT_DETAILS_BY_FORMULA = exports.DOSSIER_TYPES = exports.DISCOUNT_TYPES = exports.DEFAULT_MAP_LONGITUDE = exports.DEFAULT_MAP_LATITUDE = exports.DEFAULT_ARTICLE_BRAND = exports.DAY_NAMES = exports.COUNTRY_NAMES = exports.CONFIGURATOR_FORMULAS = exports.BRANCH_THEME_BY_FORMULA = exports.BRANCH_FORMULAS = exports.BOARD_COMPUTER_DISABLED_KEY = exports.ApiStockStatus = exports.AUTH_SESSION_KEY = exports.ARTICLE_SPECS_TRANSLATIONS = exports.ARTICLES_SYSTEM_FIELDS = exports.API_ERROR_CODES = exports.ALL_EXPERIMENTS = exports.ACTIVE_VARIANTS = void 0;
10
10
  require("core-js/modules/es.array.includes.js");
11
11
  require("core-js/modules/es.string.includes.js");
12
12
  require("core-js/modules/es.string.trim.js");
@@ -27,6 +27,11 @@ const FORM_ERROR_MESSAGES = exports.FORM_ERROR_MESSAGES = {
27
27
  licensePlateMin: 'Kenteken moet minimaal 6 characters bevatten',
28
28
  licensePlateMax: 'Kenteken mag maximaal 8 characters bevatten'
29
29
  };
30
+ const COUNTRY_NAMES = exports.COUNTRY_NAMES = {
31
+ NETHERLANDS: 'NEDERLAND',
32
+ BELGIUM: 'BELGIË',
33
+ BELGIUM_FALLBACK: 'BELGIE'
34
+ };
30
35
  const BRANCH_FORMULAS = exports.BRANCH_FORMULAS = {
31
36
  Trekhaakcentrum: 'Trekhaakcentrum',
32
37
  TowMotiveGroup: 'TowMotive Group',
@@ -228,7 +233,7 @@ const ApiStockStatus = exports.ApiStockStatus = {
228
233
  const CONFIGURATOR_FORMULAS = exports.CONFIGURATOR_FORMULAS = {
229
234
  THM: 'THM',
230
235
  THC: 'THC',
231
- THCB: 'THCB',
236
+ TBE: 'TBE',
232
237
  TMG: 'TMG',
233
238
  TOW: 'TOW',
234
239
  TM: 'TOW',
@@ -267,10 +272,10 @@ const getConfiguratorFormulaCode = formula => {
267
272
  case 'thc':
268
273
  case 'trekhaakcentrum':
269
274
  return CONFIGURATOR_FORMULAS.THC;
270
- case 'thcb':
275
+ case 'tbe':
271
276
  case 'trekhaakcentrum belgie':
272
277
  case 'trekhaakcentrum business':
273
- return CONFIGURATOR_FORMULAS.THCB;
278
+ return CONFIGURATOR_FORMULAS.TBE;
274
279
  case 'thm':
275
280
  case 'trekhaakmontage':
276
281
  return CONFIGURATOR_FORMULAS.THM;
@@ -281,7 +286,7 @@ const getConfiguratorFormulaCode = formula => {
281
286
  exports.getConfiguratorFormulaCode = getConfiguratorFormulaCode;
282
287
  const isThcFamilyFormula = formula => {
283
288
  const normalizedFormula = getConfiguratorFormulaCode(formula);
284
- return normalizedFormula === CONFIGURATOR_FORMULAS.THC || normalizedFormula === CONFIGURATOR_FORMULAS.THCB;
289
+ return normalizedFormula === CONFIGURATOR_FORMULAS.THC || normalizedFormula === CONFIGURATOR_FORMULAS.TBE;
285
290
  };
286
291
  exports.isThcFamilyFormula = isThcFamilyFormula;
287
292
  const getThemeFormulaForConfiguratorFormula = formula => {
@@ -307,7 +312,7 @@ const NO_PRODUCTS_CONTACT_DETAILS_BY_FORMULA = exports.NO_PRODUCTS_CONTACT_DETAI
307
312
  companyName: 'Trekhaakcentrum',
308
313
  logoAltText: 'Trekhaakcentrum Logo'
309
314
  },
310
- [CONFIGURATOR_FORMULAS.THCB]: {
315
+ [CONFIGURATOR_FORMULAS.TBE]: {
311
316
  email: 'order@trekhaakcentrum.nl',
312
317
  phoneDisplay: '+31 162 - 490 910',
313
318
  phoneHref: 'tel:+31162490910',
@@ -345,7 +350,7 @@ const EXECUTION_HELP_CONTACT_DETAILS_BY_FORMULA = exports.EXECUTION_HELP_CONTACT
345
350
  phoneDisplay: '+31 85 202 0660',
346
351
  phoneHref: 'tel:+31852020660'
347
352
  },
348
- [CONFIGURATOR_FORMULAS.THCB]: {
353
+ [CONFIGURATOR_FORMULAS.TBE]: {
349
354
  phoneDisplay: '+31 85 202 0660',
350
355
  phoneHref: 'tel:+31852020660'
351
356
  }
@@ -612,11 +612,13 @@ const ProductCartTable = () => {
612
612
  var _p$priceInfo14;
613
613
  return t + Number((p === null || p === void 0 || (_p$priceInfo14 = p.priceInfo) === null || _p$priceInfo14 === void 0 ? void 0 : _p$priceInfo14.salesPrice) || 0);
614
614
  }, 0) : 0;
615
+ const apiMontageSubtotalIncl = (totals === null || totals === void 0 ? void 0 : totals.subtotalMontageInclVat) != null ? Number(totals.subtotalMontageInclVat) : null;
616
+ const mainSubtotalIncl = !isToggled && apiMontageSubtotalIncl !== null && Number.isFinite(apiMontageSubtotalIncl) ? apiMontageSubtotalIncl : mainInclVat + montageInclVat;
615
617
  return {
616
618
  main: {
617
619
  purchase: mainPurchase,
618
620
  margin: mainMargin,
619
- inclVat: mainInclVat + montageInclVat,
621
+ inclVat: mainSubtotalIncl,
620
622
  exclVat: mainExclVat + montageExclVat + marketCorrectionExclVat,
621
623
  tmg: {
622
624
  catalog: tmgCatalog,