thm-p3-configurator 0.0.299 → 0.0.300

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.
@@ -9,7 +9,6 @@ require("core-js/modules/esnext.iterator.for-each.js");
9
9
  require("core-js/modules/esnext.iterator.map.js");
10
10
  require("core-js/modules/web.dom-collections.iterator.js");
11
11
  require("core-js/modules/es.weak-map.js");
12
- require("core-js/modules/esnext.iterator.filter.js");
13
12
  require("core-js/modules/esnext.iterator.for-each.js");
14
13
  Object.defineProperty(exports, "__esModule", {
15
14
  value: true
@@ -17,6 +16,7 @@ Object.defineProperty(exports, "__esModule", {
17
16
  exports.default = void 0;
18
17
  require("core-js/modules/es.promise.js");
19
18
  require("core-js/modules/esnext.iterator.constructor.js");
19
+ require("core-js/modules/esnext.iterator.filter.js");
20
20
  require("core-js/modules/esnext.iterator.find.js");
21
21
  require("core-js/modules/esnext.iterator.map.js");
22
22
  require("core-js/modules/web.dom-collections.iterator.js");
@@ -162,6 +162,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
162
162
  afhalenInWinkel,
163
163
  singleOrderFormulaCode
164
164
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
165
+ console;
165
166
  const {
166
167
  branchById
167
168
  } = (0, _queries.useBranchByIdOrWidgetId)(selectedBranch);
@@ -240,26 +241,48 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
240
241
 
241
242
  /**
242
243
  * @description Auto-set checkboxes when TowCenter branch or TMG formula is selected
244
+ * Only triggers when isTowCenterBranch or singleOrderFormulaCode changes
245
+ * User can manually toggle checkboxes after auto-enable
243
246
  */
244
247
  (0, _react.useEffect)(() => {
245
248
  const shouldEnable = isTowCenterBranch || singleOrderFormulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG;
246
- if (shouldEnable && !anderAfleveradres) {
249
+ if (shouldEnable) {
247
250
  dispatch({
248
251
  type: _OrderSessionContext.orderSessionActions.SET_ANDER_AFLEVERADRES,
249
252
  payload: {
250
253
  anderAfleveradres: true
251
254
  }
252
255
  });
253
- }
254
- if (shouldEnable && !afhalenInWinkel) {
255
256
  dispatch({
256
257
  type: _OrderSessionContext.orderSessionActions.SET_AFHALEN_IN_WINKEL,
257
258
  payload: {
258
259
  afhalenInWinkel: true
259
260
  }
260
261
  });
262
+ // Set default ownership type to Particulier if not already set
263
+ if (!(vehicle !== null && vehicle !== void 0 && vehicle.singleOrderOwnershipType) || (vehicle === null || vehicle === void 0 ? void 0 : vehicle.singleOrderOwnershipType) === _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Empty) {
264
+ dispatch({
265
+ type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE,
266
+ payload: {
267
+ singleOrderOwnershipType: _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Particulier
268
+ }
269
+ });
270
+ }
271
+ } else {
272
+ dispatch({
273
+ type: _OrderSessionContext.orderSessionActions.SET_ANDER_AFLEVERADRES,
274
+ payload: {
275
+ anderAfleveradres: false
276
+ }
277
+ });
278
+ dispatch({
279
+ type: _OrderSessionContext.orderSessionActions.SET_AFHALEN_IN_WINKEL,
280
+ payload: {
281
+ afhalenInWinkel: false
282
+ }
283
+ });
261
284
  }
262
- }, [isTowCenterBranch, singleOrderFormulaCode, anderAfleveradres, afhalenInWinkel, dispatch]);
285
+ }, [isTowCenterBranch, singleOrderFormulaCode, dispatch, vehicle === null || vehicle === void 0 ? void 0 : vehicle.singleOrderOwnershipType]);
263
286
  const initialChannel = (0, _react.useMemo)(() => {
264
287
  if (!(channel !== null && channel !== void 0 && channel.channelId) || !(marketingChannels !== null && marketingChannels !== void 0 && marketingChannels.length)) return null;
265
288
  const selectedChannel = marketingChannels === null || marketingChannels === void 0 ? void 0 : marketingChannels.find(marketingC => (marketingC === null || marketingC === void 0 ? void 0 : marketingC.entityId) === (channel === null || channel === void 0 ? void 0 : channel.channelId));
@@ -413,6 +436,14 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
413
436
  });
414
437
  }
415
438
 
439
+ // When TowCenter or TMG, ownership type is required (Niet van toepassing not allowed)
440
+ const isTowCenterOrTmg = isTowCenterBranch || singleOrderFormulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG;
441
+ if (isTowCenterOrTmg) {
442
+ validationSchema = validationSchema.shape({
443
+ singleOrderOwnershipType: (0, _yup.string)().required('Type is verplicht').notOneOf([_constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Empty], 'Type is verplicht')
444
+ });
445
+ }
446
+
416
447
  // When anderAfleveradres is enabled, make address fields required
417
448
  if (anderAfleveradres) {
418
449
  const isZakelijk = (vehicle === null || vehicle === void 0 ? void 0 : vehicle.singleOrderOwnershipType) === _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Zakelijk;
@@ -420,6 +451,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
420
451
  firstName: (0, _yup.string)().required('Voornaam is verplicht'),
421
452
  lastName: (0, _yup.string)().required('Achternaam is verplicht'),
422
453
  streetName: (0, _yup.string)().required('Straatnaam is verplicht'),
454
+ houseNumber: (0, _yup.string)().required('Huisnummer is verplicht'),
423
455
  zipCode: (0, _yup.string)().required('Postcode is verplicht'),
424
456
  city: (0, _yup.string)().required('Stad is verplicht'),
425
457
  countryId: (0, _yup.string)().required('Land is verplicht')
@@ -430,6 +462,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
430
462
  validationSchema = validationSchema.shape(requiredFields);
431
463
  }
432
464
  await validationSchema.validate(_objectSpread(_objectSpread({}, customer), {}, {
465
+ singleOrderOwnershipType: (vehicle === null || vehicle === void 0 ? void 0 : vehicle.singleOrderOwnershipType) || '',
433
466
  channelType: (channel === null || channel === void 0 ? void 0 : channel.channelType) || '',
434
467
  channelId: (channel === null || channel === void 0 ? void 0 : channel.channelId) || ''
435
468
  }), {
@@ -498,7 +531,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
498
531
  })), /*#__PURE__*/_react.default.createElement(_RadioButtons.default, {
499
532
  name: "singleOrderOwnershipType",
500
533
  label: "Type:",
501
- initialValue: (vehicle === null || vehicle === void 0 ? void 0 : vehicle.singleOrderOwnershipType) || _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Empty,
534
+ initialValue: (vehicle === null || vehicle === void 0 ? void 0 : vehicle.singleOrderOwnershipType) || (isTowCenterBranch || singleOrderFormulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG ? _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Particulier : _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Empty),
502
535
  onChange: val => {
503
536
  dispatch({
504
537
  type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE,
@@ -507,8 +540,8 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
507
540
  }
508
541
  });
509
542
  },
510
- options: Object.values(_constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE),
511
- isRequired: false,
543
+ options: isTowCenterBranch || singleOrderFormulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG ? Object.values(_constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE).filter(option => option !== _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Empty) : Object.values(_constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE),
544
+ isRequired: isTowCenterBranch || singleOrderFormulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG,
512
545
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['singleOrderOwnershipType']
513
546
  }), (isTowCenterBranch || singleOrderFormulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
514
547
  className: (0, _helpers__.withStyle)('col-12 mb-2')
@@ -816,7 +849,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
816
849
  handleAddressLookup(customer.zipCode, value);
817
850
  }
818
851
  },
819
- isRequired: false,
852
+ isRequired: anderAfleveradres,
820
853
  form: form,
821
854
  label: "Huisnummer:",
822
855
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['houseNumber']
@@ -624,7 +624,6 @@ const ProductCartTable = () => {
624
624
 
625
625
  const showCatalogPrice = !isThc;
626
626
  const headerColumns = (0, _cartTable2.getCartTableHeaderColumns)(displayMode, showCatalogPrice);
627
- console.log(mainProducts);
628
627
  const montageRateInputCell = isThc ? {} : {
629
628
  text: renderMontageRateInput(),
630
629
  className: _cartTable.CART_TABLE_PRICE_CELL_CLASS
@@ -217,7 +217,8 @@ const InternalAppointmentForm = _ref => {
217
217
  webshop,
218
218
  vehicleCodingDiscountPercentage,
219
219
  consumerDiscounts,
220
- montageRate
220
+ montageRate,
221
+ hasGoedkeuringsnummerActivity
221
222
  } = order;
222
223
  const [errors, setErrors] = (0, _react.useState)({});
223
224
  const [_licensePlate, _setLicensePlate] = (0, _react.useState)();
@@ -816,19 +817,23 @@ const InternalAppointmentForm = _ref => {
816
817
  setCompanySearchTerm('');
817
818
  setIsCompanyInputFocused(false);
818
819
  }
819
- }, branch.name)))), /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
820
+ }, branch.name)))), (branchById === null || branchById === void 0 ? void 0 : branchById.towCenterVestiging) === true && /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
820
821
  name: "invoicePaymentByLeaseCompany",
821
822
  label: "Factuur betaling door Leasemaatschappij",
822
823
  initialValue: invoicePaymentByLeaseCompany,
823
824
  onChange: val => {
824
- dispatch({
825
- type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_INVOICE_PAYMENT_BY_LEASE_COMPANY,
826
- payload: {
827
- invoicePaymentByLeaseCompany: val
828
- }
829
- });
825
+ // Only allow if no existingDossierId OR hasGoedkeuringsnummerActivity
826
+ if (!existingDossierId || hasGoedkeuringsnummerActivity) {
827
+ dispatch({
828
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_INVOICE_PAYMENT_BY_LEASE_COMPANY,
829
+ payload: {
830
+ invoicePaymentByLeaseCompany: val
831
+ }
832
+ });
833
+ }
830
834
  },
831
- isRequired: false
835
+ isRequired: false,
836
+ isDisabled: existingDossierId && !hasGoedkeuringsnummerActivity
832
837
  }))), /*#__PURE__*/_react.default.createElement("h5", {
833
838
  className: (0, _helpers__.withStyle)('my-2')
834
839
  }, "Persoonlijke gegevens"), /*#__PURE__*/_react.default.createElement("div", {
@@ -159,6 +159,19 @@ const NormalPageModalContent = _ref => {
159
159
  afhalenInWinkel: true
160
160
  }
161
161
  });
162
+ } else {
163
+ dispatch({
164
+ type: _OrderSessionContext.orderSessionActions.SET_ANDER_AFLEVERADRES,
165
+ payload: {
166
+ anderAfleveradres: false
167
+ }
168
+ });
169
+ dispatch({
170
+ type: _OrderSessionContext.orderSessionActions.SET_AFHALEN_IN_WINKEL,
171
+ payload: {
172
+ afhalenInWinkel: false
173
+ }
174
+ });
162
175
  }
163
176
  }
164
177
  }
@@ -284,12 +297,37 @@ const SingleOrderModalContent = _ref3 => {
284
297
  anderAfleveradres: true
285
298
  }
286
299
  });
300
+ dispatch({
301
+ type: _OrderSessionContext.orderSessionActions.SET_IS_TOW_CENTER_BRANCH,
302
+ payload: {
303
+ isTowCenterBranch: isTowCenter
304
+ }
305
+ });
287
306
  dispatch({
288
307
  type: _OrderSessionContext.orderSessionActions.SET_AFHALEN_IN_WINKEL,
289
308
  payload: {
290
309
  afhalenInWinkel: true
291
310
  }
292
311
  });
312
+ } else {
313
+ dispatch({
314
+ type: _OrderSessionContext.orderSessionActions.SET_ANDER_AFLEVERADRES,
315
+ payload: {
316
+ anderAfleveradres: false
317
+ }
318
+ });
319
+ dispatch({
320
+ type: _OrderSessionContext.orderSessionActions.SET_IS_TOW_CENTER_BRANCH,
321
+ payload: {
322
+ isTowCenterBranch: isTowCenter
323
+ }
324
+ });
325
+ dispatch({
326
+ type: _OrderSessionContext.orderSessionActions.SET_AFHALEN_IN_WINKEL,
327
+ payload: {
328
+ afhalenInWinkel: false
329
+ }
330
+ });
293
331
  }
294
332
  }
295
333
  }
@@ -367,6 +405,19 @@ const InternalBranchSelectorModal = () => {
367
405
  afhalenInWinkel: true
368
406
  }
369
407
  });
408
+ } else {
409
+ dispatch({
410
+ type: _OrderSessionContext.orderSessionActions.SET_ANDER_AFLEVERADRES,
411
+ payload: {
412
+ anderAfleveradres: false
413
+ }
414
+ });
415
+ dispatch({
416
+ type: _OrderSessionContext.orderSessionActions.SET_AFHALEN_IN_WINKEL,
417
+ payload: {
418
+ afhalenInWinkel: false
419
+ }
420
+ });
370
421
  }
371
422
  }, [selectedBranch, branchById, singleOrderFormulaCode, dispatch]);
372
423
  const handlePrimaryButtonClicked = () => {
@@ -177,7 +177,8 @@ const INITIAL_ORDER_SESSION_STATE = {
177
177
  webshop: null,
178
178
  isTowCenterBranch: false,
179
179
  anderAfleveradres: false,
180
- afhalenInWinkel: false
180
+ afhalenInWinkel: false,
181
+ hasGoedkeuringsnummerActivity: false
181
182
  };
182
183
  const orderSessionActions = exports.orderSessionActions = {
183
184
  INITIALIZE_NEW_ORDER: 'INITIALIZE_NEW_ORDER',
@@ -73,7 +73,7 @@ function _toPrimitive(t, r) {
73
73
  * @description Covnerts an existing hyper dossier object into a local order session
74
74
  */
75
75
  const parseDossierToOrderSession = exports.parseDossierToOrderSession = function parseDossierToOrderSession() {
76
- var _dossier$statusBeoord, _dossier$kanaal, _dossier$kanaalPartne, _dossier$kanaalHoofka, _dossier$statusDossie, _dossier$statusDossie2, _dossier$lines$some, _dossier$lines, _dossier$vestiging, _dossier$typeEigendom, _dossier$klant, _dossier$klant2, _dossier$klant3, _dossier$klant4, _dossier$klant$postal, _dossier$klant5, _dossier$klant$city, _dossier$klant6, _dossier$klant$street, _dossier$klant7, _dossier$klant$huisnu, _dossier$klant8, _dossier$anwbId, _dossier$bedrijfsnaam, _dossier$placeholderB, _dossier$kvkNummer, _dossier$btwNummer;
76
+ var _dossier$statusBeoord, _dossier$kanaal, _dossier$kanaalPartne, _dossier$kanaalHoofka, _dossier$statusDossie, _dossier$statusDossie2, _dossier$lines$some, _dossier$lines, _dossier$vestiging, _dossier$typeEigendom, _dossier$klant, _dossier$klant2, _dossier$klant3, _dossier$klant4, _dossier$klant$postal, _dossier$klant5, _dossier$klant$city, _dossier$klant6, _dossier$klant$street, _dossier$klant7, _dossier$klant$huisnu, _dossier$klant8, _dossier$anwbId, _dossier$bedrijfsnaam, _dossier$placeholderB, _dossier$kvkNummer, _dossier$btwNummer, _dossier$hasGoedkeuri;
77
77
  let dossier = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
78
78
  return {
79
79
  canAlterQuantity: (dossier === null || dossier === void 0 || (_dossier$statusBeoord = dossier.statusBeoordeling) === null || _dossier$statusBeoord === void 0 ? void 0 : _dossier$statusBeoord.title) === _constants__.STATUS_ASSESSMENT.Open,
@@ -143,7 +143,8 @@ const parseDossierToOrderSession = exports.parseDossierToOrderSession = function
143
143
  companyNamePlaceholder: (_dossier$placeholderB = dossier === null || dossier === void 0 ? void 0 : dossier.placeholderBedrijfsnaam) !== null && _dossier$placeholderB !== void 0 ? _dossier$placeholderB : undefined,
144
144
  kvkNumber: (_dossier$kvkNummer = dossier === null || dossier === void 0 ? void 0 : dossier.kvkNummer) !== null && _dossier$kvkNummer !== void 0 ? _dossier$kvkNummer : undefined,
145
145
  vatNumber: (_dossier$btwNummer = dossier === null || dossier === void 0 ? void 0 : dossier.btwNummer) !== null && _dossier$btwNummer !== void 0 ? _dossier$btwNummer : undefined
146
- }
146
+ },
147
+ hasGoedkeuringsnummerActivity: (_dossier$hasGoedkeuri = dossier === null || dossier === void 0 ? void 0 : dossier.hasGoedkeuringsnummerActivity) !== null && _dossier$hasGoedkeuri !== void 0 ? _dossier$hasGoedkeuri : false
147
148
  };
148
149
  };
149
150
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.299",
3
+ "version": "0.0.300",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",