thm-p3-configurator 0.0.65 → 0.0.67

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.
@@ -137,6 +137,7 @@ const useCreatePrivateQuotationMutation = () => {
137
137
  vehicle,
138
138
  customer,
139
139
  channel,
140
+ chassisNumber,
140
141
  licensePlate,
141
142
  model,
142
143
  answers,
@@ -151,6 +152,7 @@ const useCreatePrivateQuotationMutation = () => {
151
152
  isExitIntent,
152
153
  model,
153
154
  vehicle,
155
+ chassisNumber,
154
156
  licensePlate,
155
157
  channel,
156
158
  formula,
@@ -187,6 +189,7 @@ const useCreatePrivateAppointmentMutation = () => {
187
189
  model,
188
190
  answers,
189
191
  cart,
192
+ chassisNumber,
190
193
  selectBoardComputerUpdate,
191
194
  branchId,
192
195
  formula,
@@ -199,6 +202,7 @@ const useCreatePrivateAppointmentMutation = () => {
199
202
  vehicle,
200
203
  licensePlate,
201
204
  channel,
205
+ chassisNumber,
202
206
  formula,
203
207
  discount,
204
208
  answers,
@@ -279,6 +283,7 @@ const useUpdatePrivateAppointmentByIdMutation = id => {
279
283
  channel,
280
284
  appointment,
281
285
  licensePlate,
286
+ chassisNumber,
282
287
  model,
283
288
  answers,
284
289
  cart,
@@ -295,6 +300,7 @@ const useUpdatePrivateAppointmentByIdMutation = id => {
295
300
  model,
296
301
  vehicle,
297
302
  licensePlate,
303
+ chassisNumber,
298
304
  channel,
299
305
  formula,
300
306
  discount,
@@ -26,7 +26,10 @@ function _interopRequireDefault(e) {
26
26
  default: e
27
27
  };
28
28
  }
29
- const VehicleData = () => {
29
+ const VehicleData = _ref => {
30
+ let {
31
+ isFilter = false
32
+ } = _ref;
30
33
  const [{
31
34
  licensePlate,
32
35
  model,
@@ -53,7 +56,7 @@ const VehicleData = () => {
53
56
  });
54
57
  const history = (0, _reactRouter.useHistory)();
55
58
  return /*#__PURE__*/_react.default.createElement(_ExpandableCard.default, {
56
- title: "Uw voertuig",
59
+ title: isFilter ? 'Voertuig' : 'Uw voertuig',
57
60
  expandLabel: "Toon voertuiggegevens",
58
61
  collapseLabel: "Verberg voertuiggegevens",
59
62
  isDefaultExpanded: true,
@@ -70,7 +73,7 @@ const VehicleData = () => {
70
73
  }, /*#__PURE__*/_react.default.createElement(_LicensePlateInput.default, {
71
74
  initialValue: licensePlate,
72
75
  isReadOnly: true
73
- })), /*#__PURE__*/_react.default.createElement(_LinkButton.default, {
76
+ })), !isFilter && /*#__PURE__*/_react.default.createElement(_LinkButton.default, {
74
77
  isDisabled: false,
75
78
  label: 'Wijzig voertuig',
76
79
  onClick: () => {
@@ -79,8 +82,8 @@ const VehicleData = () => {
79
82
  className: (0, _helpers__.withStyle)('license-plate__edit link-primary col-12'),
80
83
  type: "button"
81
84
  })),
82
- expandedBody: Object.entries(vehicleDetails).map(_ref => {
83
- let [key, value] = _ref;
85
+ expandedBody: Object.entries(vehicleDetails).map(_ref2 => {
86
+ let [key, value] = _ref2;
84
87
  if (!value) {
85
88
  return null;
86
89
  }
@@ -159,6 +159,7 @@ const InternalAppointmentForm = _ref => {
159
159
  licensePlate,
160
160
  model,
161
161
  vehicle,
162
+ chassisNumber,
162
163
  channel,
163
164
  durationAnswer,
164
165
  selectedBoardComputer,
@@ -226,14 +227,15 @@ const InternalAppointmentForm = _ref => {
226
227
  try {
227
228
  var _customer$firstName, _customer$lastName, _customer$phoneNumber, _customer$houseNumber, _customer$streetName, _customer$countryId, _customer$city, _customer$email, _customer$note, _customer$zipCode, _ref2;
228
229
  setErrors([]);
229
-
230
- // Note: this does not throw on error.
231
- const licensePlateErrors = validateLicensePlate();
232
- if (licensePlateErrors) {
233
- setErrors(prev => _objectSpread(_objectSpread({}, prev), {}, {
234
- licensePlate: licensePlateErrors
235
- }));
236
- return;
230
+ if (!model) {
231
+ // Note: this does not throw on error.
232
+ const licensePlateErrors = validateLicensePlate();
233
+ if (licensePlateErrors) {
234
+ setErrors(prev => _objectSpread(_objectSpread({}, prev), {}, {
235
+ licensePlate: licensePlateErrors
236
+ }));
237
+ return;
238
+ }
237
239
  }
238
240
 
239
241
  // Note: this throws on error.
@@ -269,6 +271,7 @@ const InternalAppointmentForm = _ref => {
269
271
  channel,
270
272
  licensePlate: (_ref2 = licensePlate || _licensePlate) === null || _ref2 === void 0 ? void 0 : _ref2.replace(/-/g, ''),
271
273
  model,
274
+ chassisNumber,
272
275
  priceCalculationDate,
273
276
  answers: (0, _helpers__.removeNullishProps)({
274
277
  duration: durationAnswer,
@@ -550,7 +553,7 @@ const InternalAppointmentForm = _ref => {
550
553
  }),
551
554
  isRequired: false,
552
555
  form: "quotation",
553
- label: "Code van de leasemaatschappij:",
556
+ label: "Goedkeuringsnummer:",
554
557
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['leaseNumber']
555
558
  }), !licensePlate && /*#__PURE__*/_react.default.createElement(_TextInput.default, {
556
559
  placeholder: "",
@@ -561,6 +564,20 @@ const InternalAppointmentForm = _ref => {
561
564
  form: "quotation",
562
565
  label: "Kenteken:",
563
566
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['licensePlate']
567
+ }), (vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType) === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij && /*#__PURE__*/_react.default.createElement(_TextInput.default, {
568
+ placeholder: "",
569
+ initialValue: vehicle === null || vehicle === void 0 ? void 0 : vehicle.chassisNumber,
570
+ name: "chassisNumber",
571
+ onChange: value => dispatch({
572
+ type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_CHASSIS_NUMBER,
573
+ payload: {
574
+ chassisNumber: value
575
+ }
576
+ }),
577
+ isRequired: false,
578
+ form: "quotation",
579
+ label: "Chassisnummer:",
580
+ errorMessage: errors === null || errors === void 0 ? void 0 : errors['chassisNumber']
564
581
  }), /*#__PURE__*/_react.default.createElement("div", {
565
582
  className: (0, _helpers__.withStyle)('my-2 fw-bold')
566
583
  }, "Opties aanwezig:"), productSpecifications !== null && productSpecifications !== void 0 && productSpecifications.length ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, ' ', /*#__PURE__*/_react.default.createElement("ul", null, productSpecifications === null || productSpecifications === void 0 ? void 0 : productSpecifications.map(specification => /*#__PURE__*/_react.default.createElement("li", {
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ require("core-js/modules/es.json.stringify.js");
3
4
  require("core-js/modules/es.weak-map.js");
4
5
  require("core-js/modules/esnext.iterator.constructor.js");
5
6
  require("core-js/modules/esnext.iterator.for-each.js");
@@ -10,6 +11,7 @@ Object.defineProperty(exports, "__esModule", {
10
11
  value: true
11
12
  });
12
13
  exports.default = void 0;
14
+ require("core-js/modules/es.json.stringify.js");
13
15
  require("core-js/modules/esnext.iterator.constructor.js");
14
16
  require("core-js/modules/esnext.iterator.for-each.js");
15
17
  require("core-js/modules/esnext.iterator.map.js");
@@ -82,21 +84,29 @@ const NormalPageModalContent = _ref => {
82
84
  });
83
85
  (0, _react.useEffect)(() => {
84
86
  const branchesToSet = isTMGOrganization ? branches === null || branches === void 0 ? void 0 : branches.results : myBranches;
85
- if (branchesToSet) {
87
+ if (!branchesToSet) return;
88
+
89
+ // Only update if the branches have actually changed
90
+ if (JSON.stringify(_branches) !== JSON.stringify(branchesToSet)) {
86
91
  _setBranches(branchesToSet);
87
92
  }
88
- }, [isTMGOrganization, branches === null || branches === void 0 ? void 0 : branches.results, myBranches, isLoadingMyBranches, isLoadingBranches]);
93
+ }, [isTMGOrganization, branches === null || branches === void 0 ? void 0 : branches.results, myBranches]);
89
94
  (0, _react.useEffect)(() => {
90
95
  var _branches$;
91
- const shouldAutoSelect = !isLocation && !existingDossierId && !isTMGOrganization && (_branches === null || _branches === void 0 ? void 0 : _branches.length) === 1 && !selectedBranch;
96
+ if (!(_branches !== null && _branches !== void 0 && _branches.length)) return;
97
+ if (selectedBranch) return;
98
+ const shouldAutoSelect = !isLocation && !existingDossierId && !isTMGOrganization && _branches.length === 1;
92
99
  if (!shouldAutoSelect) return;
93
- dispatch({
94
- type: _OrderSessionContext.orderSessionActions.SET_SELECTED_BRANCH,
95
- payload: {
96
- branchId: (_branches$ = _branches[0]) === null || _branches$ === void 0 ? void 0 : _branches$.entityId
97
- }
98
- });
99
- }, [selectedBranch, branchTypes, isLocation, existingDossierId, _branches, dispatch, isTMGOrganization]);
100
+ const branchToSelect = (_branches$ = _branches[0]) === null || _branches$ === void 0 ? void 0 : _branches$.entityId;
101
+ if (branchToSelect) {
102
+ dispatch({
103
+ type: _OrderSessionContext.orderSessionActions.SET_SELECTED_BRANCH,
104
+ payload: {
105
+ branchId: branchToSelect
106
+ }
107
+ });
108
+ }
109
+ }, [_branches, selectedBranch, isLocation, existingDossierId, isTMGOrganization]);
100
110
  return /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
101
111
  options: _branches === null || _branches === void 0 ? void 0 : _branches.map(branch => ({
102
112
  label: branch === null || branch === void 0 ? void 0 : branch.name,
@@ -121,6 +121,7 @@ const internalQuotationFormSchema = (0, _yup.object)({
121
121
  ownershipType: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
122
122
  leaseNumber: (0, _yup.string)().nullable(),
123
123
  firstName: (0, _yup.string)().nullable(),
124
+ chassisNumber: (0, _yup.string)().nullable(),
124
125
  channelType: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
125
126
  channelId: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
126
127
  infix: (0, _yup.string)().nullable(),
@@ -141,6 +142,7 @@ const InternalQuotationForm = _ref => {
141
142
  customer,
142
143
  licensePlate,
143
144
  model,
145
+ chassisNumber,
144
146
  executionAnswer1,
145
147
  executionAnswer2,
146
148
  priceCalculationDate,
@@ -191,14 +193,15 @@ const InternalQuotationForm = _ref => {
191
193
  try {
192
194
  var _customer$firstName, _customer$lastName, _customer$phoneNumber, _customer$houseNumber, _customer$streetName, _customer$countryId, _customer$city, _customer$email, _customer$note, _customer$zipCode, _ref2;
193
195
  setErrors(null);
194
-
195
- // Note: this does not throw on error.
196
- const licensePlateErrors = validateLicensePlate();
197
- if (licensePlateErrors) {
198
- setErrors(prev => _objectSpread(_objectSpread({}, prev), {}, {
199
- licensePlate: licensePlateErrors
200
- }));
201
- return;
196
+ if (!model) {
197
+ // Note: this does not throw on error.
198
+ const licensePlateErrors = validateLicensePlate();
199
+ if (licensePlateErrors) {
200
+ setErrors(prev => _objectSpread(_objectSpread({}, prev), {}, {
201
+ licensePlate: licensePlateErrors
202
+ }));
203
+ return;
204
+ }
202
205
  }
203
206
 
204
207
  // Note: this throws on error.
@@ -226,6 +229,7 @@ const InternalQuotationForm = _ref => {
226
229
  note: (_customer$note = customer === null || customer === void 0 ? void 0 : customer.note) !== null && _customer$note !== void 0 ? _customer$note : undefined,
227
230
  zipCode: (_customer$zipCode = customer === null || customer === void 0 ? void 0 : customer.zipCode) !== null && _customer$zipCode !== void 0 ? _customer$zipCode : undefined
228
231
  }),
232
+ chassisNumber: chassisNumber !== null && chassisNumber !== void 0 ? chassisNumber : undefined,
229
233
  channel,
230
234
  licensePlate: (_ref2 = licensePlate || _licensePlate) === null || _ref2 === void 0 ? void 0 : _ref2.replace(/-/g, ''),
231
235
  model,
@@ -407,6 +411,20 @@ const InternalQuotationForm = _ref => {
407
411
  form: "quotation",
408
412
  label: "Kenteken:",
409
413
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['licensePlate']
414
+ }), (vehicle === null || vehicle === void 0 ? void 0 : vehicle.ownershipType) === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij && /*#__PURE__*/_react.default.createElement(_TextInput.default, {
415
+ placeholder: "",
416
+ initialValue: vehicle === null || vehicle === void 0 ? void 0 : vehicle.chassisNumber,
417
+ name: "chassisNumber",
418
+ onChange: value => dispatch({
419
+ type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_CHASSIS_NUMBER,
420
+ payload: {
421
+ chassisNumber: value
422
+ }
423
+ }),
424
+ isRequired: false,
425
+ form: "quotation",
426
+ label: "Chassisnummer:",
427
+ errorMessage: errors === null || errors === void 0 ? void 0 : errors['chassisNumber']
410
428
  }), isError && /*#__PURE__*/_react.default.createElement(_ErrorMessage.default, {
411
429
  message: 'Er is een fout opgetreden bij het maken van de offerte, probeer het opnieuw.'
412
430
  }), /*#__PURE__*/_react.default.createElement("div", {
@@ -185,7 +185,6 @@ function InternalSingleOrderFilters(_ref) {
185
185
  placeholder: "Maak een keuze",
186
186
  onChange: option => {
187
187
  setSelectedArticleSubGroup(option.value);
188
- setSelectedArticleGroup(null);
189
188
  },
190
189
  className: "w-100"
191
190
  })), /*#__PURE__*/_react.default.createElement("div", {
@@ -211,6 +211,7 @@ const orderSessionActions = exports.orderSessionActions = {
211
211
  SET_DISCOUNT_AMOUNT: 'SET_DISCOUNT_AMOUNT',
212
212
  SET_DISCOUNT_PERCENTAGE: 'SET_DISCOUNT_PERCENTAGE',
213
213
  CLEAR_DISCOUNT: 'CLEAR_DISCOUNT',
214
+ SET_VEHICLE_CHASSIS_NUMBER: 'SET_VEHICLE_CHASSIS_NUMBER',
214
215
  SET_FRANCHISE_NAME: 'SET_FRANCHISE_NAME',
215
216
  SET_PRICE_CALCULATION_DATE: 'SET_PRICE_CALCULATION_DATE',
216
217
  SET_CUSTOMER_AGREED: 'SET_CUSTOMER_AGREED'
@@ -238,6 +239,7 @@ const orderSessionReducer = (state, action) => {
238
239
  executionAnswer1: null,
239
240
  executionAnswer2: null,
240
241
  durationOptions: [],
242
+ chassisNumber: null,
241
243
  execution1Options: [],
242
244
  execution2Options: [],
243
245
  selectedExtras: {},
@@ -285,6 +287,15 @@ const orderSessionReducer = (state, action) => {
285
287
  isTouched: true
286
288
  });
287
289
  }
290
+ case orderSessionActions.SET_VEHICLE_CHASSIS_NUMBER:
291
+ {
292
+ const {
293
+ chassisNumber
294
+ } = action.payload;
295
+ return _objectSpread(_objectSpread({}, state), {}, {
296
+ chassisNumber
297
+ });
298
+ }
288
299
  case orderSessionActions.SET_SINGLE_ORDER_FORMULA_CODE:
289
300
  {
290
301
  const {
@@ -32,6 +32,7 @@ var _InternalSingleOrderCart = _interopRequireDefault(require("../../__container
32
32
  var _InternalSingleOrderFilters = _interopRequireDefault(require("../../__containers__/internal/InternalSingleOrderFilters"));
33
33
  var _InternalSingleOrderProductOverview = _interopRequireDefault(require("../../__containers__/internal/InternalSingleOrderProductOverview"));
34
34
  var _InternalSingleOrderSuccessModal = _interopRequireDefault(require("../../__containers__/internal/InternalSingleOrderSuccessModal"));
35
+ var _VehicleData = _interopRequireDefault(require("../../__containers__/VehicleData"));
35
36
  var _FormulaContext = require("../../__context__/FormulaContext");
36
37
  var _OrderSessionContext = require("../../__context__/OrderSessionContext");
37
38
  var _helpers__ = require("../../__helpers__");
@@ -143,7 +144,9 @@ const InternalSingleOrderPage = () => {
143
144
  selectedBranch,
144
145
  appointment,
145
146
  internalNote,
146
- singleOrderFormulaCode
147
+ singleOrderFormulaCode,
148
+ licensePlate,
149
+ model
147
150
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
148
151
  let formula = (0, _FormulaContext.useFormula)();
149
152
  if (singleOrderFormulaCode) {
@@ -295,7 +298,9 @@ const InternalSingleOrderPage = () => {
295
298
  onValidationError: handleCustomerValidationError
296
299
  }))), /*#__PURE__*/_react.default.createElement("div", {
297
300
  className: (0, _helpers__.withStyle)("sidebar col-xxl-auto col-lg-12 pt-3")
298
- }, /*#__PURE__*/_react.default.createElement(_InternalSingleOrderCart.default, {
301
+ }, (licensePlate || model) && /*#__PURE__*/_react.default.createElement(_VehicleData.default, {
302
+ isFilter: true
303
+ }), /*#__PURE__*/_react.default.createElement(_InternalSingleOrderCart.default, {
299
304
  resetOrderSession: resetOrderSession,
300
305
  removeFromCart: removeFromCart,
301
306
  handleQuantityChange: handleQuantityChange,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.65",
3
+ "version": "0.0.67",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",