thm-p3-configurator 0.0.301 → 0.0.303

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.
@@ -240,12 +240,13 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
240
240
  }, [isTmg, marketingChannels, channel === null || channel === void 0 ? void 0 : channel.channelId, dispatch]);
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
243
+ * @description Auto-set checkboxes when TowCenter branch or TMG organization
244
+ * - If TMG organization: always enable (ignore towCenterVestiging)
245
+ * - If NOT TMG: check isTowCenterBranch (from towCenterVestiging)
245
246
  * User can manually toggle checkboxes after auto-enable
246
247
  */
247
248
  (0, _react.useEffect)(() => {
248
- const shouldEnable = isTowCenterBranch || singleOrderFormulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG;
249
+ const shouldEnable = isTmg || isTowCenterBranch;
249
250
  if (shouldEnable) {
250
251
  dispatch({
251
252
  type: _OrderSessionContext.orderSessionActions.SET_ANDER_AFLEVERADRES,
@@ -282,7 +283,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
282
283
  }
283
284
  });
284
285
  }
285
- }, [isTowCenterBranch, singleOrderFormulaCode, dispatch, vehicle === null || vehicle === void 0 ? void 0 : vehicle.singleOrderOwnershipType]);
286
+ }, [isTmg, isTowCenterBranch, dispatch, vehicle === null || vehicle === void 0 ? void 0 : vehicle.singleOrderOwnershipType]);
286
287
  const initialChannel = (0, _react.useMemo)(() => {
287
288
  if (!(channel !== null && channel !== void 0 && channel.channelId) || !(marketingChannels !== null && marketingChannels !== void 0 && marketingChannels.length)) return null;
288
289
  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));
@@ -437,7 +438,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
437
438
  }
438
439
 
439
440
  // When TowCenter or TMG, ownership type is required (Niet van toepassing not allowed)
440
- const isTowCenterOrTmg = isTowCenterBranch || singleOrderFormulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG;
441
+ const isTowCenterOrTmg = isTmg || isTowCenterBranch;
441
442
  if (isTowCenterOrTmg) {
442
443
  validationSchema = validationSchema.shape({
443
444
  singleOrderOwnershipType: (0, _yup.string)().required('Type is verplicht').notOneOf([_constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Empty], 'Type is verplicht')
@@ -531,7 +532,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
531
532
  })), /*#__PURE__*/_react.default.createElement(_RadioButtons.default, {
532
533
  name: "singleOrderOwnershipType",
533
534
  label: "Type:",
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),
535
+ initialValue: (vehicle === null || vehicle === void 0 ? void 0 : vehicle.singleOrderOwnershipType) || (isTmg || isTowCenterBranch ? _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Particulier : _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Empty),
535
536
  onChange: val => {
536
537
  dispatch({
537
538
  type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE,
@@ -540,10 +541,10 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
540
541
  }
541
542
  });
542
543
  },
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,
544
+ options: isTmg || isTowCenterBranch ? 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),
545
+ isRequired: isTmg || isTowCenterBranch,
545
546
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['singleOrderOwnershipType']
546
- }), (isTowCenterBranch || singleOrderFormulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
547
+ }), (isTmg || isTowCenterBranch) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
547
548
  className: (0, _helpers__.withStyle)('col-12 mb-2')
548
549
  }, /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
549
550
  name: "anderAfleveradres",
@@ -76,8 +76,7 @@ const NormalPageModalContent = _ref => {
76
76
  const [_branches, _setBranches] = (0, _react.useState)([]);
77
77
  const [{
78
78
  licensePlate,
79
- model,
80
- singleOrderFormulaCode
79
+ model
81
80
  }] = (0, _OrderSessionContext.useOrderSession)();
82
81
  const {
83
82
  myBranches,
@@ -138,8 +137,7 @@ const NormalPageModalContent = _ref => {
138
137
  const selectedBranchData = isTMGOrganization ? branches === null || branches === void 0 || (_branches$results = branches.results) === null || _branches$results === void 0 ? void 0 : _branches$results.find(b => b.entityId === value) : myBranches === null || myBranches === void 0 ? void 0 : myBranches.find(b => b.entityId === value);
139
138
  if (selectedBranchData) {
140
139
  const isTowCenter = (selectedBranchData === null || selectedBranchData === void 0 ? void 0 : selectedBranchData.towCenterVestiging) === true;
141
- const isTmgFormula = formula === _constants__.CONFIGURATOR_FORMULAS.TMG || singleOrderFormulaCode === _constants__.CONFIGURATOR_FORMULAS.TMG;
142
- const shouldEnable = isTowCenter || isTmgFormula;
140
+ const shouldEnable = isTMGOrganization || isTowCenter;
143
141
  dispatch({
144
142
  type: _OrderSessionContext.orderSessionActions.SET_IS_TOW_CENTER_BRANCH,
145
143
  payload: {
@@ -201,9 +199,6 @@ const SingleOrderModalContent = _ref3 => {
201
199
  limit: 500,
202
200
  offset: 0
203
201
  });
204
- const [{
205
- singleOrderFormulaCode
206
- }] = (0, _OrderSessionContext.useOrderSession)();
207
202
 
208
203
  // Filter branches based on formula if not TMG
209
204
  const filteredBranches = _react.default.useMemo(() => {
@@ -355,8 +350,7 @@ const InternalBranchSelectorModal = () => {
355
350
  existingDossierId,
356
351
  orderType,
357
352
  licensePlate,
358
- model,
359
- singleOrderFormulaCode
353
+ model
360
354
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
361
355
  const {
362
356
  branchById
@@ -384,8 +378,7 @@ const InternalBranchSelectorModal = () => {
384
378
  (0, _react.useEffect)(() => {
385
379
  if (!selectedBranch || !branchById) return;
386
380
  const isTowCenter = (branchById === null || branchById === void 0 ? void 0 : branchById.towCenterVestiging) === true;
387
- const isTmgFormula = isTMGOrganization === true;
388
- const shouldEnable = isTowCenter || isTmgFormula;
381
+ const shouldEnable = isTMGOrganization || isTowCenter;
389
382
  dispatch({
390
383
  type: _OrderSessionContext.orderSessionActions.SET_IS_TOW_CENTER_BRANCH,
391
384
  payload: {
@@ -419,7 +412,7 @@ const InternalBranchSelectorModal = () => {
419
412
  }
420
413
  });
421
414
  }
422
- }, [selectedBranch, branchById, singleOrderFormulaCode, isTMGOrganization, dispatch]);
415
+ }, [selectedBranch, branchById, isTMGOrganization, dispatch]);
423
416
  const handlePrimaryButtonClicked = () => {
424
417
  dispatch({
425
418
  type: _OrderSessionContext.orderSessionActions.SET_SELECTED_BRANCH,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.301",
3
+ "version": "0.0.303",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",