thm-p3-configurator 0.0.431 → 0.0.433

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.
@@ -171,7 +171,7 @@ const ProductsOverview = () => {
171
171
  }
172
172
  }, [isLoadingProducts, skipFilters, products, selectedTowbar, selectedCableset, selectedCombiset, dispatch]);
173
173
  (0, _react.useEffect)(() => {
174
- var _products$Trekhaak2, _products$Trekhaak3, _products$PRODUCT_CAT5;
174
+ var _products$Trekhaak2, _products$Trekhaak3;
175
175
  // When editing an existing dossier, the saved selection from the cart is the
176
176
  // source of truth. Skip auto-selection entirely so we never overwrite it with
177
177
  // the default recommended towbar.
@@ -231,9 +231,20 @@ const ProductsOverview = () => {
231
231
  }
232
232
  }
233
233
  }
234
+ }, [isLoadingProducts, products, selectedTowbar, selectedCableset, existingDossierId, dispatch]);
235
+
236
+ // Board computer resolution lives outside the existing-dossier early return
237
+ // above: editing a dossier starts with isBoardComputerSelectionResolved
238
+ // false, and a dossier whose vehicle has no board computer update would
239
+ // otherwise never resolve, leaving the step navigation locked (39028).
240
+ (0, _react.useEffect)(() => {
241
+ var _products$PRODUCT_CAT5;
242
+ if (isLoadingProducts) {
243
+ return;
244
+ }
234
245
 
235
246
  // Auto-select boardcomputer if one is available and none is currently selected
236
- 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) {
247
+ if ((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) {
237
248
  const boardComputerId = products[_constants__.PRODUCT_CATEGORIES.BOARD_COMPUTER][0].articleNumber;
238
249
  dispatch({
239
250
  type: _OrderSessionContext.orderSessionActions.SET_SELECTED_BOARDCOMPUTER,
@@ -242,12 +253,12 @@ const ProductsOverview = () => {
242
253
  userModified: false
243
254
  }
244
255
  });
245
- } else if (!isLoadingProducts && !isBoardComputerSelectionResolved) {
256
+ } else if (!isBoardComputerSelectionResolved) {
246
257
  dispatch({
247
258
  type: _OrderSessionContext.orderSessionActions.SET_BOARDCOMPUTER_SELECTION_RESOLVED
248
259
  });
249
260
  }
250
- }, [isLoadingProducts, products, selectedTowbar, selectedCableset, selectedBoardComputer, initialSelectedBoardComputer, isBoardComputerSelectionResolved, isBoardComputerTouched, isBoardComputerDeselected, existingDossierId, dispatch]);
261
+ }, [isLoadingProducts, products, selectedBoardComputer, isBoardComputerSelectionResolved, isBoardComputerDeselected, dispatch]);
251
262
  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)) {
252
263
  return /*#__PURE__*/_react.default.createElement(_reactRouter.Redirect, {
253
264
  to: "/configurator/geen-producten"
@@ -114,7 +114,7 @@ const getDossierCountryId = function getDossierCountryId() {
114
114
  * @description Covnerts an existing hyper dossier object into a local order session
115
115
  */
116
116
  const parseDossierToOrderSession = exports.parseDossierToOrderSession = function parseDossierToOrderSession() {
117
- var _ref2, _ref3, _ref4, _dossier$construction, _dossier$typeEigendom, _dossier$bedrijf, _dossier$bedrijf2, _dossier$bedrijf3, _dossier$lines, _dossier$statusBeoord, _dossier$kanaal, _dossier$kanaalPartne, _dossier$kanaalHoofka, _dossier$kanaalWebsit, _dossier$kanaal2, _dossier$statusDossie, _dossier$statusDossie2, _dossier$merk, _dossier$vestiging, _getConfiguratorFormu, _dossier$chassisnumme, _dossier$typeEigendom2, _getDossierValue, _getDossierValue2, _getDossierValue3, _getDossierValue4, _getDossierValue5, _dossier$anwbId, _dossier$leasemaatsch, _dossier$leasemaatsch2, _dossier$placeholderB, _dossier$kvkNummer, _dossier$btwNummer, _ref5, _ref6, _dossier$leasemaatsch3, _dossier$leasemaatsch4, _dossier$bedrijf4, _ref7, _ref8, _ref9, _dossier$leasemaatsch5, _dossier$leasemaatsch6, _dossier$leasemaatsch7, _dossier$leasemaatsch8, _dossier$leasemaatsch9, _dossier$leasemaatsch10, _dossier$zakelijkCont, _dossier$zakelijkCont2, _ref10, _dossier$zakeiljkCont, _dossier$zakelijkCont3, _dossier$hasGoedkeuri, _meerprijsLine$consum, _meerprijsLine$extraN;
117
+ var _ref2, _ref3, _ref4, _dossier$construction, _dossier$typeEigendom, _dossier$bedrijf, _dossier$bedrijf2, _dossier$bedrijf3, _dossier$lines, _dossier$statusBeoord, _dossier$modelcode, _dossier$kanaal, _dossier$kanaalPartne, _dossier$kanaalHoofka, _dossier$kanaalWebsit, _dossier$kanaal2, _dossier$statusDossie, _dossier$statusDossie2, _dossier$merk, _dossier$vestiging, _getConfiguratorFormu, _dossier$chassisnumme, _dossier$typeEigendom2, _getDossierValue, _getDossierValue2, _getDossierValue3, _getDossierValue4, _getDossierValue5, _dossier$anwbId, _dossier$leasemaatsch, _dossier$leasemaatsch2, _dossier$placeholderB, _dossier$kvkNummer, _dossier$btwNummer, _ref5, _ref6, _dossier$leasemaatsch3, _dossier$leasemaatsch4, _dossier$bedrijf4, _ref7, _ref8, _ref9, _dossier$leasemaatsch5, _dossier$leasemaatsch6, _dossier$leasemaatsch7, _dossier$leasemaatsch8, _dossier$leasemaatsch9, _dossier$leasemaatsch10, _dossier$zakelijkCont, _dossier$zakelijkCont2, _ref10, _dossier$zakeiljkCont, _dossier$zakelijkCont3, _dossier$hasGoedkeuri, _meerprijsLine$consum, _meerprijsLine$extraN;
118
118
  let dossier = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
119
119
  const resolvedBuildYear = (_ref2 = (_ref3 = (_ref4 = (_dossier$construction = dossier === null || dossier === void 0 ? void 0 : dossier.constructionYear) !== null && _dossier$construction !== void 0 ? _dossier$construction : dossier === null || dossier === void 0 ? void 0 : dossier.bouwjaar) !== null && _ref4 !== void 0 ? _ref4 : dossier === null || dossier === void 0 ? void 0 : dossier.bouwjaar2) !== null && _ref3 !== void 0 ? _ref3 : dossier === null || dossier === void 0 ? void 0 : dossier.modeljaar) !== null && _ref2 !== void 0 ? _ref2 : null;
120
120
  const isLeaseOwnership = (dossier === null || dossier === void 0 || (_dossier$typeEigendom = dossier.typeEigendomAuto) === null || _dossier$typeEigendom === void 0 ? void 0 : _dossier$typeEigendom.title) === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij;
@@ -130,6 +130,9 @@ const parseDossierToOrderSession = exports.parseDossierToOrderSession = function
130
130
  licensePlateBrandModel: dossier === null || dossier === void 0 ? void 0 : dossier.kentekenMerkmodel,
131
131
  model: dossier !== null && dossier !== void 0 && dossier.kenteken ? null : dossier === null || dossier === void 0 ? void 0 : dossier.model,
132
132
  // Note: only fill in when license plate is empty
133
+ // Note: the model code survives model renames in Hyper; the middleware uses
134
+ // it to recover when the stored model title no longer resolves.
135
+ modelCode: dossier !== null && dossier !== void 0 && dossier.kenteken ? null : (_dossier$modelcode = dossier === null || dossier === void 0 ? void 0 : dossier.modelcode) !== null && _dossier$modelcode !== void 0 ? _dossier$modelcode : null,
133
136
  channel: {
134
137
  channelType: dossier === null || dossier === void 0 || (_dossier$kanaal = dossier.kanaal) === null || _dossier$kanaal === void 0 ? void 0 : _dossier$kanaal.entityId,
135
138
  channelId: (dossier === null || dossier === void 0 || (_dossier$kanaalPartne = dossier.kanaalPartner) === null || _dossier$kanaalPartne === void 0 ? void 0 : _dossier$kanaalPartne.entityId) || (dossier === null || dossier === void 0 || (_dossier$kanaalHoofka = dossier.kanaalHoofkantoor) === null || _dossier$kanaalHoofka === void 0 ? void 0 : _dossier$kanaalHoofka.entityId) || (dossier === null || dossier === void 0 || (_dossier$kanaalWebsit = dossier.kanaalWebsite) === null || _dossier$kanaalWebsit === void 0 ? void 0 : _dossier$kanaalWebsit.entityId),
@@ -14,6 +14,7 @@ var _CardWide = _interopRequireDefault(require("../../__components__/Cards/CardW
14
14
  var _OrderSessionContext = require("../../__context__/OrderSessionContext");
15
15
  var _helpers__ = require("../../__helpers__");
16
16
  var _useBranchTheme = require("../../__hooks__/useBranchTheme");
17
+ var _useSearchParam = _interopRequireDefault(require("../../__hooks__/useSearchParam"));
17
18
  function _interopRequireDefault(e) {
18
19
  return e && e.__esModule ? e : {
19
20
  default: e
@@ -44,9 +45,22 @@ function _interopRequireWildcard(e, r) {
44
45
  }
45
46
  return n.default = e, t && t.set(e, n), n;
46
47
  }
48
+ const NO_DOSSIER_MESSAGES = {
49
+ default: {
50
+ title: 'We kunnen geen dossier vinden met de opgegeven specificaties',
51
+ body: 'Controleer uw vestiging of dossiergegevens en probeer het opnieuw. '
52
+ },
53
+ 'model-niet-beschikbaar': {
54
+ title: 'Dit dossier kan momenteel niet bewerkt worden',
55
+ body: 'De voertuiggegevens in dit dossier zijn verouderd en konden niet ' + 'automatisch worden bijgewerkt. Neem contact op met TowMotive, ' + 'dan zorgen zij dat het dossier weer bewerkbaar wordt.'
56
+ }
57
+ };
47
58
  const InternalNoDossierPage = () => {
59
+ var _NO_DOSSIER_MESSAGES$;
48
60
  const themeClass = (0, _helpers__.getConfiguratorThemeClass)((0, _useBranchTheme.useBranchTheme)());
49
61
  const [_, dispatch] = (0, _OrderSessionContext.useOrderSession)();
62
+ const [reden] = (0, _useSearchParam.default)(['reden']);
63
+ const message = (_NO_DOSSIER_MESSAGES$ = NO_DOSSIER_MESSAGES[reden]) !== null && _NO_DOSSIER_MESSAGES$ !== void 0 ? _NO_DOSSIER_MESSAGES$ : NO_DOSSIER_MESSAGES.default;
50
64
  (0, _react.useEffect)(() => {
51
65
  dispatch({
52
66
  type: _OrderSessionContext.orderSessionActions.INITIALIZE_NEW_ORDER,
@@ -68,9 +82,9 @@ const InternalNoDossierPage = () => {
68
82
  title: ''
69
83
  }, /*#__PURE__*/_react.default.createElement("h5", {
70
84
  className: (0, _helpers__.withStyle)('text-center mb-2')
71
- }, "We kunnen geen dossier vinden met de opgegeven specificaties"), /*#__PURE__*/_react.default.createElement("p", {
85
+ }, message.title), /*#__PURE__*/_react.default.createElement("p", {
72
86
  className: (0, _helpers__.withStyle)('mb-4 text-center')
73
- }, "Controleer uw vestiging of dossiergegevens en probeer het opnieuw.", ' '), /*#__PURE__*/_react.default.createElement("div", {
87
+ }, message.body), /*#__PURE__*/_react.default.createElement("div", {
74
88
  className: (0, _helpers__.withStyle)("d-flex justify-content-center gap-2 flex-md-nowrap flex-wrap")
75
89
  }, /*#__PURE__*/_react.default.createElement(_NavigationButton.default, {
76
90
  to: '/configurator',
@@ -126,7 +126,7 @@ const InternalSessionEditPage = props => {
126
126
  const history = (0, _reactRouter.useHistory)();
127
127
  const hydrateOrderSessionByDossier = (0, _react.useCallback)(async dossierById => {
128
128
  try {
129
- var _dossierById$akkoordO, _getConfiguratorFormu, _orderRes$data, _orderRes$data2, _session$discountCode, _session$customer, _sessionProducts$sele;
129
+ var _dossierById$akkoordO, _getConfiguratorFormu, _orderRes$data, _orderRes$data2, _orderRes$data3, _session$discountCode, _session$customer, _sessionProducts$sele;
130
130
  window.sessionStorage.removeItem(_constants__.ORDER_SESSION_KEY);
131
131
  const session = (0, _dossier.parseDossierToOrderSession)(dossierById);
132
132
  session.customerAgreed = (_dossierById$akkoordO = dossierById === null || dossierById === void 0 ? void 0 : dossierById.akkoordOpmerkingen) !== null && _dossierById$akkoordO !== void 0 ? _dossierById$akkoordO : false;
@@ -137,6 +137,7 @@ const InternalSessionEditPage = props => {
137
137
  const orderRes = await _authenticatedProxyApi.authenticatedProxyApi.getOrder((0, _queryKeyFactory.serializeOrderParams)({
138
138
  licensePlate: session.licensePlate,
139
139
  model: session.model,
140
+ modelCode: session.modelCode,
140
141
  executionAnswer1: session.executionAnswer1,
141
142
  executionAnswer2: session.executionAnswer2,
142
143
  durationAnswer: session.durationAnswer,
@@ -153,12 +154,21 @@ const InternalSessionEditPage = props => {
153
154
  skipFilters: true
154
155
  }));
155
156
 
157
+ // Note: adopt the model title the order API resolved to. The dossier may
158
+ // still carry an old (renamed) model title; using the current one keeps
159
+ // later order calls and the final save working, and repairs the dossier
160
+ // model field once the user saves.
161
+ const resolvedModelTitle = orderRes === null || orderRes === void 0 || (_orderRes$data = orderRes.data) === null || _orderRes$data === void 0 || (_orderRes$data = _orderRes$data.data) === null || _orderRes$data === void 0 || (_orderRes$data = _orderRes$data.vehicleInfo) === null || _orderRes$data === void 0 || (_orderRes$data = _orderRes$data.model) === null || _orderRes$data === void 0 ? void 0 : _orderRes$data.name;
162
+ if (!session.licensePlate && resolvedModelTitle) {
163
+ session.model = resolvedModelTitle;
164
+ }
165
+
156
166
  // Note: we need to use this function to classify the products found in the dossier orderlines
157
167
  // Since the orderlines don't give us an indication of the type of the product
158
168
  const sessionProducts = (0, _dossier.extractSessionProductsByOrder)({
159
169
  lines: dossierById === null || dossierById === void 0 ? void 0 : dossierById.lines,
160
- orderProducts: orderRes === null || orderRes === void 0 || (_orderRes$data = orderRes.data) === null || _orderRes$data === void 0 || (_orderRes$data = _orderRes$data.data) === null || _orderRes$data === void 0 ? void 0 : _orderRes$data.articles,
161
- boardComputerUpdate: orderRes === null || orderRes === void 0 || (_orderRes$data2 = orderRes.data) === null || _orderRes$data2 === void 0 || (_orderRes$data2 = _orderRes$data2.data) === null || _orderRes$data2 === void 0 || (_orderRes$data2 = _orderRes$data2.articles) === null || _orderRes$data2 === void 0 ? void 0 : _orderRes$data2.boardComputerUpdate
170
+ orderProducts: orderRes === null || orderRes === void 0 || (_orderRes$data2 = orderRes.data) === null || _orderRes$data2 === void 0 || (_orderRes$data2 = _orderRes$data2.data) === null || _orderRes$data2 === void 0 ? void 0 : _orderRes$data2.articles,
171
+ boardComputerUpdate: orderRes === null || orderRes === void 0 || (_orderRes$data3 = orderRes.data) === null || _orderRes$data3 === void 0 || (_orderRes$data3 = _orderRes$data3.data) === null || _orderRes$data3 === void 0 || (_orderRes$data3 = _orderRes$data3.articles) === null || _orderRes$data3 === void 0 ? void 0 : _orderRes$data3.boardComputerUpdate
162
172
  });
163
173
  const isAnwbCode = session === null || session === void 0 || (_session$discountCode = session.discountCode) === null || _session$discountCode === void 0 ? void 0 : _session$discountCode.toLocaleLowerCase().includes('anwb');
164
174
  const shouldKeepAnwbValidated = isAnwbCode && Boolean((session === null || session === void 0 || (_session$customer = session.customer) === null || _session$customer === void 0 ? void 0 : _session$customer.anwbId) || (sessionProducts === null || sessionProducts === void 0 || (_sessionProducts$sele = sessionProducts.selectedDiscountedProducts) === null || _sessionProducts$sele === void 0 ? void 0 : _sessionProducts$sele.length));
@@ -174,8 +184,10 @@ const InternalSessionEditPage = props => {
174
184
  });
175
185
  history.push('/configurator/trekhaakpakket');
176
186
  } catch (ex) {
187
+ var _ex$response;
177
188
  console.error('hydrateOrderSessionByDossier(): ', ex);
178
- history.push('/configurator/geen-dossiers');
189
+ const isModelNotFound = (ex === null || ex === void 0 || (_ex$response = ex.response) === null || _ex$response === void 0 || (_ex$response = _ex$response.data) === null || _ex$response === void 0 ? void 0 : _ex$response.code) === 'MODEL_NOT_FOUND';
190
+ history.push(isModelNotFound ? '/configurator/geen-dossiers?reden=model-niet-beschikbaar' : '/configurator/geen-dossiers');
179
191
  }
180
192
  }, [dossierType, dispatch, history, setFormula]);
181
193
  (0, _react.useEffect)(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.431",
3
+ "version": "0.0.433",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",