thm-p3-configurator 0.0.365 → 0.0.367

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.
@@ -106,7 +106,7 @@ const App = () => {
106
106
  (0, _Experiments.default)();
107
107
  });
108
108
  return /*#__PURE__*/_react.default.createElement(_SentryWrapper.default, null, /*#__PURE__*/_react.default.createElement(_FormulaContext.FormulaController, {
109
- defaultFormula: _constants__.CONFIGURATOR_FORMULAS.THM
109
+ defaultFormula: APP_CONFIG.internal ? null : _constants__.CONFIGURATOR_FORMULAS.THM
110
110
  }, /*#__PURE__*/_react.default.createElement(_CountryContext.CountryController, {
111
111
  defaultCountry: APP_CONFIG.country
112
112
  }, /*#__PURE__*/_react.default.createElement(_OrderSessionContext.OrderSessionController, null, /*#__PURE__*/_react.default.createElement(_reactQuery.QueryClientProvider, {
@@ -81,6 +81,7 @@ describe('queryKeyFactory', () => {
81
81
  });
82
82
  it('includes formula in brands and build-years keys', () => {
83
83
  expect((0, _queryKeyFactory.getBrandsQueryKey)('TMG')).toEqual(['brands', 'TMG']);
84
+ expect((0, _queryKeyFactory.getBrandsQueryKey)('THCB')).toEqual(['brands', 'THCB']);
84
85
  expect((0, _queryKeyFactory.getBuildYearsQueryKey)({
85
86
  brand: 'Volvo',
86
87
  formula: 'TMG'
@@ -16,19 +16,13 @@ const publicOrderClient = _axios.default.create({
16
16
  });
17
17
  const orderApi = exports.orderApi = {
18
18
  getArticles: filters => publicOrderClient("api/public/articles?".concat(filters)),
19
- getBrands: function getBrands() {
20
- let formula = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'THC';
21
- return publicOrderClient("api/public/v1/configurator/makes?formula=".concat(formula));
22
- },
23
- getBuildYears: function getBuildYears(brand) {
24
- let formula = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'THC';
25
- return publicOrderClient("api/public/v1/configurator/makes/".concat(brand, "/years?formula=").concat(formula));
26
- },
19
+ getBrands: formula => publicOrderClient("api/public/v1/configurator/makes?formula=".concat(formula)),
20
+ getBuildYears: (brand, formula) => publicOrderClient("api/public/v1/configurator/makes/".concat(brand, "/years?formula=").concat(formula)),
27
21
  getModels: _ref => {
28
22
  let {
29
23
  brand,
30
24
  year,
31
- formula = 'THC'
25
+ formula
32
26
  } = _ref;
33
27
  return publicOrderClient("api/public/v1/configurator/makes/".concat(brand, "/models").concat(year ? "?year=".concat(year, "&formula=").concat(formula) : "?formula=".concat(formula)));
34
28
  }
@@ -90,8 +90,9 @@ function _toPrimitive(t, r) {
90
90
  * @description Retrieves the car brand options
91
91
  */
92
92
  const useBrandsQuery = exports.useBrandsQuery = function useBrandsQuery() {
93
- let formula = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'THC';
93
+ let formula = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
94
94
  const brandsQuery = (0, _reactQuery.useQuery)((0, _queryKeyFactory.getBrandsQueryKey)(formula), {
95
+ enabled: Boolean(formula),
95
96
  queryFn: () => _orderApi.orderApi.getBrands(formula).then(res => {
96
97
  var _res$data;
97
98
  return (0, _helpers__.parseArrayToInputOptions)((_res$data = res === null || res === void 0 ? void 0 : res.data) !== null && _res$data !== void 0 ? _res$data : []);
@@ -110,13 +111,13 @@ const useBrandsQuery = exports.useBrandsQuery = function useBrandsQuery() {
110
111
  const useBuildYearsQuery = _ref => {
111
112
  let {
112
113
  brand,
113
- formula = 'THC'
114
+ formula = null
114
115
  } = _ref;
115
116
  const buildYearsQuery = (0, _reactQuery.useQuery)((0, _queryKeyFactory.getBuildYearsQueryKey)({
116
117
  brand,
117
118
  formula
118
119
  }), {
119
- enabled: !!(brand !== null && brand !== void 0 && brand.length),
120
+ enabled: !!(brand !== null && brand !== void 0 && brand.length) && Boolean(formula),
120
121
  queryFn: () => _orderApi.orderApi.getBuildYears(brand, formula).then(res => {
121
122
  var _res$data2;
122
123
  return (0, _helpers__.parseArrayToInputOptions)((_res$data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _res$data2 !== void 0 ? _res$data2 : []);
@@ -219,14 +220,14 @@ const useModelsQuery = _ref2 => {
219
220
  let {
220
221
  brand,
221
222
  year,
222
- formula = 'THC'
223
+ formula = null
223
224
  } = _ref2;
224
225
  const modelsQuery = (0, _reactQuery.useQuery)(['models', JSON.stringify({
225
226
  brand,
226
227
  year,
227
228
  formula
228
229
  })], {
229
- enabled: !!(brand !== null && brand !== void 0 && brand.length),
230
+ enabled: !!(brand !== null && brand !== void 0 && brand.length) && Boolean(formula),
230
231
  queryFn: () => {
231
232
  return _orderApi.orderApi.getModels({
232
233
  brand,
@@ -721,12 +722,13 @@ const useBranchesByType = _ref4 => {
721
722
  };
722
723
  exports.useBranchesByType = useBranchesByType;
723
724
  const useBusinessBranches = _ref5 => {
725
+ var _getConfiguratorFormu;
724
726
  let {
725
727
  searchTerm,
726
728
  formula: formulaRaw,
727
729
  enabled = true
728
730
  } = _ref5;
729
- const formula = formulaRaw == null ? undefined : typeof formulaRaw === 'string' ? formulaRaw : formulaRaw === null || formulaRaw === void 0 ? void 0 : formulaRaw.entityId;
731
+ const formula = (_getConfiguratorFormu = (0, _constants__.getConfiguratorFormulaCode)(formulaRaw)) !== null && _getConfiguratorFormu !== void 0 ? _getConfiguratorFormu : typeof formulaRaw === 'string' ? formulaRaw : formulaRaw === null || formulaRaw === void 0 ? void 0 : formulaRaw.entityId;
730
732
  const businessBranchesQuery = (0, _reactQuery.useQuery)(['businessBranches', searchTerm, formula], {
731
733
  queryFn: async () => {
732
734
  const response = await _authenticatedProxyApi.authenticatedProxyApi.getBusinessBranches({
@@ -125,13 +125,13 @@ const getOrderQueryKey = exports.getOrderQueryKey = function getOrderQueryKey()
125
125
  return ['order', serializeOrderParams(orderParameters)];
126
126
  };
127
127
  const getBrandsQueryKey = exports.getBrandsQueryKey = function getBrandsQueryKey() {
128
- let formula = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'THC';
128
+ let formula = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
129
129
  return ['brands', formula];
130
130
  };
131
131
  const getBuildYearsQueryKey = exports.getBuildYearsQueryKey = function getBuildYearsQueryKey() {
132
132
  let {
133
133
  brand,
134
- formula = 'THC'
134
+ formula = null
135
135
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
136
136
  return ['buildYears', brand, formula];
137
137
  };
@@ -124,7 +124,7 @@ function _toPrimitive(t, r) {
124
124
  return ("string" === r ? String : Number)(t);
125
125
  }
126
126
  const LocationClusteredTreeMarkers = _ref => {
127
- var _selectedTree$afbeeld;
127
+ var _ref2, _selectedTree$formula, _selectedTree$formule, _selectedTree$afbeeld;
128
128
  let {
129
129
  locationIds,
130
130
  locationsById
@@ -232,7 +232,7 @@ const LocationClusteredTreeMarkers = _ref => {
232
232
  anchor: markers[activeMarkerId],
233
233
  onCloseClick: handleInfoWindowClose
234
234
  }, /*#__PURE__*/_react.default.createElement(_LocationInfo.default, {
235
- formula: selectedTree === null || selectedTree === void 0 ? void 0 : selectedTree.formule,
235
+ formula: (_ref2 = (_selectedTree$formula = selectedTree === null || selectedTree === void 0 ? void 0 : selectedTree.formulaCode) !== null && _selectedTree$formula !== void 0 ? _selectedTree$formula : selectedTree === null || selectedTree === void 0 || (_selectedTree$formule = selectedTree.formule) === null || _selectedTree$formule === void 0 ? void 0 : _selectedTree$formule.code) !== null && _ref2 !== void 0 ? _ref2 : selectedTree === null || selectedTree === void 0 ? void 0 : selectedTree.formule,
236
236
  openingHours: selectedTree === null || selectedTree === void 0 ? void 0 : selectedTree.openingstijden,
237
237
  locationImage: selectedTree === null || selectedTree === void 0 || (_selectedTree$afbeeld = selectedTree.afbeeldingLogo) === null || _selectedTree$afbeeld === void 0 ? void 0 : _selectedTree$afbeeld[0],
238
238
  street: selectedTree === null || selectedTree === void 0 ? void 0 : selectedTree.street,
@@ -24,6 +24,7 @@ const FORMULAS = {
24
24
  nFbSnWdtLZBmEhhpHFGVO: _logoThcWhite.default
25
25
  };
26
26
  const LocationInfo = _ref => {
27
+ var _FORMULAS$formula;
27
28
  let {
28
29
  street,
29
30
  houseNumber,
@@ -39,7 +40,7 @@ const LocationInfo = _ref => {
39
40
  province,
40
41
  formula
41
42
  } = _ref;
42
- const address = [street, postCode, city].join(', ');
43
+ const fallbackLogo = (0, _constants__.getThemeFormulaForConfiguratorFormula)(formula) === _constants__.CONFIGURATOR_FORMULAS.THC ? _logoThcWhite.default : (_FORMULAS$formula = FORMULAS[formula]) !== null && _FORMULAS$formula !== void 0 ? _FORMULAS$formula : _thLogoBlack.default;
43
44
 
44
45
  // Function to format opening hours display text
45
46
  const formatOpeningHours = dayData => {
@@ -132,7 +133,7 @@ const LocationInfo = _ref => {
132
133
  className: (0, _helpers__.withStyle)('mb-1'),
133
134
  src: locationImage !== null && locationImage !== void 0 && locationImage.length ? (0, _image.getImageFromHyper)({
134
135
  imageId: locationImage
135
- }) : FORMULAS[formula],
136
+ }) : fallbackLogo,
136
137
  alt: title
137
138
  }))));
138
139
  };
@@ -56,16 +56,17 @@ const LocationTreeMarker = /*#__PURE__*/_react.default.memo(_ref => {
56
56
  const formula = (0, _FormulaContext.useFormula)();
57
57
  // Cache marker icon configuration
58
58
  const markerIcon = (0, _react.useMemo)(() => {
59
+ const markerIconUrl = (0, _constants__.isThcFamilyFormula)(formula) ? _mapMarkerThc.default : _mapMarker.default;
59
60
  if (!core) return {
60
- url: formula == _constants__.CONFIGURATOR_FORMULAS.THC ? _mapMarkerThc.default : _mapMarker.default
61
+ url: markerIconUrl
61
62
  };
62
63
  return {
63
- url: formula == _constants__.CONFIGURATOR_FORMULAS.THC ? _mapMarkerThc.default : _mapMarker.default,
64
+ url: markerIconUrl,
64
65
  size: new core.Size(32, 42),
65
66
  anchor: new core.Point(16, 32),
66
67
  scaledSize: new core.Size(32, 42)
67
68
  };
68
- }, [core]);
69
+ }, [core, formula]);
69
70
  const handleClick = (0, _react.useCallback)(() => onClick(tree), [onClick, tree]);
70
71
  const ref = (0, _react.useCallback)(marker => setMarkerRef(marker, tree === null || tree === void 0 ? void 0 : tree.entityId), [setMarkerRef, tree === null || tree === void 0 ? void 0 : tree.entityId]);
71
72
 
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ var _index = require("../index");
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);
8
+ });
9
+ it('normalizes known formula titles and codes without collapsing unknown codes', () => {
10
+ expect((0, _index.getConfiguratorFormulaCode)('Trekhaakcentrum')).toBe(_index.CONFIGURATOR_FORMULAS.THC);
11
+ expect((0, _index.getConfiguratorFormulaCode)('TowMotive')).toBe(_index.CONFIGURATOR_FORMULAS.TOW);
12
+ expect((0, _index.getConfiguratorFormulaCode)('thcb')).toBe(_index.CONFIGURATOR_FORMULAS.THCB);
13
+ expect((0, _index.getConfiguratorFormulaCode)('abc')).toBe('ABC');
14
+ });
15
+ it('treats THCB as THC-family for theme decisions only', () => {
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);
19
+ });
20
+ });
@@ -1,9 +1,15 @@
1
1
  "use strict";
2
2
 
3
+ require("core-js/modules/es.array.includes.js");
4
+ require("core-js/modules/es.string.includes.js");
5
+ require("core-js/modules/es.string.trim.js");
3
6
  Object.defineProperty(exports, "__esModule", {
4
7
  value: true
5
8
  });
6
- exports.mapBranchFormulaToConfiguratorFormula = 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.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
+ require("core-js/modules/es.array.includes.js");
11
+ require("core-js/modules/es.string.includes.js");
12
+ require("core-js/modules/es.string.trim.js");
7
13
  const DOSSIER_TYPES = exports.DOSSIER_TYPES = {
8
14
  Quotation: 'quotation',
9
15
  AppointmentRequest: 'appointment-request',
@@ -222,12 +228,69 @@ const ApiStockStatus = exports.ApiStockStatus = {
222
228
  const CONFIGURATOR_FORMULAS = exports.CONFIGURATOR_FORMULAS = {
223
229
  THM: 'THM',
224
230
  THC: 'THC',
231
+ THCB: 'THCB',
225
232
  TMG: 'TMG',
226
233
  TOW: 'TOW',
227
234
  TM: 'TOW',
228
235
  TH: 'TH',
229
236
  TowMotive: 'TowMotive'
230
237
  };
238
+ const normalizeFormulaInput = formula => {
239
+ if (formula == null) {
240
+ return null;
241
+ }
242
+ if (typeof formula === 'object') {
243
+ var _ref, _ref2, _ref3, _formula$code;
244
+ return normalizeFormulaInput((_ref = (_ref2 = (_ref3 = (_formula$code = formula === null || formula === void 0 ? void 0 : formula.code) !== null && _formula$code !== void 0 ? _formula$code : formula === null || formula === void 0 ? void 0 : formula.title) !== null && _ref3 !== void 0 ? _ref3 : formula === null || formula === void 0 ? void 0 : formula.formulaCode) !== null && _ref2 !== void 0 ? _ref2 : formula === null || formula === void 0 ? void 0 : formula.formule) !== null && _ref !== void 0 ? _ref : null);
245
+ }
246
+ if (typeof formula !== 'string') {
247
+ return null;
248
+ }
249
+ const normalizedFormula = formula.trim();
250
+ return normalizedFormula.length > 0 ? normalizedFormula : null;
251
+ };
252
+ const getConfiguratorFormulaCode = formula => {
253
+ const normalizedFormula = normalizeFormulaInput(formula);
254
+ if (!normalizedFormula) {
255
+ return null;
256
+ }
257
+ switch (normalizedFormula.toLowerCase()) {
258
+ case 'tow':
259
+ case 'tm':
260
+ case 'th':
261
+ case 'towmotive':
262
+ return CONFIGURATOR_FORMULAS.TOW;
263
+ case 'tmg':
264
+ case 'towmotive group':
265
+ return CONFIGURATOR_FORMULAS.TMG;
266
+ case 'thc':
267
+ case 'trekhaakcentrum':
268
+ return CONFIGURATOR_FORMULAS.THC;
269
+ case 'thcb':
270
+ case 'trekhaakcentrum belgie':
271
+ case 'trekhaakcentrum business':
272
+ return CONFIGURATOR_FORMULAS.THCB;
273
+ case 'thm':
274
+ case 'trekhaakmontage':
275
+ return CONFIGURATOR_FORMULAS.THM;
276
+ default:
277
+ return normalizedFormula.includes(' ') ? normalizedFormula : normalizedFormula.toUpperCase();
278
+ }
279
+ };
280
+ exports.getConfiguratorFormulaCode = getConfiguratorFormulaCode;
281
+ const isThcFamilyFormula = formula => {
282
+ const normalizedFormula = getConfiguratorFormulaCode(formula);
283
+ return normalizedFormula === CONFIGURATOR_FORMULAS.THC || normalizedFormula === CONFIGURATOR_FORMULAS.THCB;
284
+ };
285
+ exports.isThcFamilyFormula = isThcFamilyFormula;
286
+ const getThemeFormulaForConfiguratorFormula = formula => {
287
+ const normalizedFormula = getConfiguratorFormulaCode(formula);
288
+ if (!normalizedFormula) {
289
+ return null;
290
+ }
291
+ return isThcFamilyFormula(normalizedFormula) ? CONFIGURATOR_FORMULAS.THC : normalizedFormula;
292
+ };
293
+ exports.getThemeFormulaForConfiguratorFormula = getThemeFormulaForConfiguratorFormula;
231
294
  const NO_PRODUCTS_CONTACT_DETAILS_BY_FORMULA = exports.NO_PRODUCTS_CONTACT_DETAILS_BY_FORMULA = {
232
295
  [CONFIGURATOR_FORMULAS.THM]: {
233
296
  email: 'order@trekhaakmontage.nl',
@@ -243,6 +306,13 @@ const NO_PRODUCTS_CONTACT_DETAILS_BY_FORMULA = exports.NO_PRODUCTS_CONTACT_DETAI
243
306
  companyName: 'Trekhaakcentrum',
244
307
  logoAltText: 'Trekhaakcentrum Logo'
245
308
  },
309
+ [CONFIGURATOR_FORMULAS.THCB]: {
310
+ email: 'order@trekhaakcentrum.nl',
311
+ phoneDisplay: '+31 162 - 490 910',
312
+ phoneHref: 'tel:+31162490910',
313
+ companyName: 'Trekhaakcentrum',
314
+ logoAltText: 'Trekhaakcentrum Logo'
315
+ },
246
316
  [CONFIGURATOR_FORMULAS.TMG]: {
247
317
  email: 'order@towmotivegroup.com',
248
318
  phoneDisplay: '+31 85 - 203 0167',
@@ -273,6 +343,10 @@ const EXECUTION_HELP_CONTACT_DETAILS_BY_FORMULA = exports.EXECUTION_HELP_CONTACT
273
343
  [CONFIGURATOR_FORMULAS.THC]: {
274
344
  phoneDisplay: '+31 85 202 0660',
275
345
  phoneHref: 'tel:+31852020660'
346
+ },
347
+ [CONFIGURATOR_FORMULAS.THCB]: {
348
+ phoneDisplay: '+31 85 202 0660',
349
+ phoneHref: 'tel:+31852020660'
276
350
  }
277
351
  };
278
352
  const LOCATION_CHANGE_BUTTON_LABEL = exports.LOCATION_CHANGE_BUTTON_LABEL = 'Wijzig de locatie';
@@ -283,23 +357,7 @@ const TOWMOTIVE_ORGANIZATION_TYPE = exports.TOWMOTIVE_ORGANIZATION_TYPE = 'TowMo
283
357
  * Maps branch formula values to CONFIGURATOR_FORMULAS
284
358
  */
285
359
  const mapBranchFormulaToConfiguratorFormula = branchFormula => {
286
- if (!branchFormula) return CONFIGURATOR_FORMULAS.THM;
287
- switch (branchFormula.toLowerCase()) {
288
- case 'tow':
289
- case 'tm':
290
- case 'th':
291
- return CONFIGURATOR_FORMULAS.TOW;
292
- case 'tmg':
293
- case 'towmotive group':
294
- return CONFIGURATOR_FORMULAS.TMG;
295
- case 'thc':
296
- return CONFIGURATOR_FORMULAS.THC;
297
- case 'thm':
298
- case 'trekhaakmontage':
299
- return CONFIGURATOR_FORMULAS.THM;
300
- default:
301
- return CONFIGURATOR_FORMULAS.THM;
302
- }
360
+ return getConfiguratorFormulaCode(branchFormula);
303
361
  };
304
362
  exports.mapBranchFormulaToConfiguratorFormula = mapBranchFormulaToConfiguratorFormula;
305
363
  const LOCATION_TYPE = exports.LOCATION_TYPE = 'Vestiging';
@@ -248,7 +248,7 @@ const DeferredMontageRateInput = _ref2 => {
248
248
 
249
249
  const ProductCartTable = () => {
250
250
  const formula = (0, _FormulaContext.useFormula)();
251
- const isThc = formula === _constants__.CONFIGURATOR_FORMULAS.THC;
251
+ const isThc = (0, _constants__.isThcFamilyFormula)(formula);
252
252
  const isTowFormula = formula === _constants__.CONFIGURATOR_FORMULAS.TOW || formula === _constants__.CONFIGURATOR_FORMULAS.TM;
253
253
  const isTmg = (0, _useIsTmg.useIsTmg)();
254
254
  const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
@@ -220,12 +220,20 @@ const SingleOrderModalContent = _ref6 => {
220
220
  if (formula === _constants__.CONFIGURATOR_FORMULAS.TMG || !singleOrderBranches) {
221
221
  return singleOrderBranches;
222
222
  }
223
- return singleOrderBranches.filter(branch => (branch === null || branch === void 0 ? void 0 : branch.formulaCode) === formula);
223
+ const normalizedFormula = (0, _constants__.getConfiguratorFormulaCode)(formula);
224
+ return singleOrderBranches.filter(branch => {
225
+ var _ref7, _branch$formulaCode, _branch$formule;
226
+ const branchFormula = (0, _constants__.getConfiguratorFormulaCode)((_ref7 = (_branch$formulaCode = branch === null || branch === void 0 ? void 0 : branch.formulaCode) !== null && _branch$formulaCode !== void 0 ? _branch$formulaCode : branch === null || branch === void 0 || (_branch$formule = branch.formule) === null || _branch$formule === void 0 ? void 0 : _branch$formule.code) !== null && _ref7 !== void 0 ? _ref7 : branch === null || branch === void 0 ? void 0 : branch.formule);
227
+ if ((0, _constants__.isThcFamilyFormula)(normalizedFormula)) {
228
+ return (0, _constants__.isThcFamilyFormula)(branchFormula);
229
+ }
230
+ return branchFormula === normalizedFormula;
231
+ });
224
232
  }, [singleOrderBranches, formula]);
225
233
  const branchIdWithFormulaCode = new Map();
226
234
  filteredBranches === null || filteredBranches === void 0 || filteredBranches.forEach(branch => {
227
- var _branch$formule$code, _branch$formule;
228
- branchIdWithFormulaCode.set(branch === null || branch === void 0 ? void 0 : branch.entityId, (_branch$formule$code = branch === null || branch === void 0 || (_branch$formule = branch.formule) === null || _branch$formule === void 0 ? void 0 : _branch$formule.code) !== null && _branch$formule$code !== void 0 ? _branch$formule$code : _constants__.CONFIGURATOR_FORMULAS.THC);
235
+ var _getConfiguratorFormu, _ref8, _branch$formulaCode2, _branch$formule2;
236
+ branchIdWithFormulaCode.set(branch === null || branch === void 0 ? void 0 : branch.entityId, (_getConfiguratorFormu = (0, _constants__.getConfiguratorFormulaCode)((_ref8 = (_branch$formulaCode2 = branch === null || branch === void 0 ? void 0 : branch.formulaCode) !== null && _branch$formulaCode2 !== void 0 ? _branch$formulaCode2 : branch === null || branch === void 0 || (_branch$formule2 = branch.formule) === null || _branch$formule2 === void 0 ? void 0 : _branch$formule2.code) !== null && _ref8 !== void 0 ? _ref8 : branch === null || branch === void 0 ? void 0 : branch.formule)) !== null && _getConfiguratorFormu !== void 0 ? _getConfiguratorFormu : (0, _constants__.getConfiguratorFormulaCode)(formula));
229
237
  });
230
238
  const branchOptions = filteredBranches === null || filteredBranches === void 0 ? void 0 : filteredBranches.map(branch => ({
231
239
  label: "".concat(branch === null || branch === void 0 ? void 0 : branch.naamVestiging, " - ").concat(branch === null || branch === void 0 ? void 0 : branch.name),
@@ -243,11 +251,11 @@ const SingleOrderModalContent = _ref6 => {
243
251
  noOptionsMessage: "Geen opties beschikbaar",
244
252
  placeholder: "Maak een keuze",
245
253
  initialValue: singleOrderBranchType,
246
- onChange: _ref7 => {
254
+ onChange: _ref9 => {
247
255
  let {
248
256
  label,
249
257
  value
250
- } = _ref7;
258
+ } = _ref9;
251
259
  setSingleOrderBranchType(value);
252
260
  setSelectedBranchId(undefined);
253
261
  setLocalBranchId(undefined);
@@ -261,11 +269,11 @@ const SingleOrderModalContent = _ref6 => {
261
269
  noOptionsMessage: "Geen opties beschikbaar",
262
270
  placeholder: "Maak een keuze",
263
271
  initialValue: selectedBranchId,
264
- onChange: _ref8 => {
272
+ onChange: _ref10 => {
265
273
  let {
266
274
  label,
267
275
  value
268
- } = _ref8;
276
+ } = _ref10;
269
277
  setSelectedBranchId(value);
270
278
  setLocalBranchId(value);
271
279
  const formulaCode = branchIdWithFormulaCode.get(value);
@@ -134,14 +134,14 @@ const getConfiguratorThemeClass = theme => {
134
134
  };
135
135
  exports.getConfiguratorThemeClass = getConfiguratorThemeClass;
136
136
  const getConfiguratorThemeClassByFormula = formula => {
137
- switch (formula) {
138
- case 'THC':
137
+ switch ((0, _constants__.getThemeFormulaForConfiguratorFormula)(formula)) {
138
+ case _constants__.CONFIGURATOR_FORMULAS.THC:
139
139
  return 'thc';
140
- case 'TMG':
140
+ case _constants__.CONFIGURATOR_FORMULAS.TMG:
141
141
  return 'tmg';
142
- case 'TOW':
143
- case 'TH':
144
- case 'TowMotive':
142
+ case _constants__.CONFIGURATOR_FORMULAS.TOW:
143
+ case _constants__.CONFIGURATOR_FORMULAS.TH:
144
+ case _constants__.CONFIGURATOR_FORMULAS.TowMotive:
145
145
  return 'tm';
146
146
  default:
147
147
  return '';
@@ -60,6 +60,7 @@ const getEmptySingleOrderCustomer = () => ({
60
60
  lastName: '',
61
61
  email: '',
62
62
  phoneNumber: '',
63
+ note: '',
63
64
  zipCode: '',
64
65
  houseNumber: '',
65
66
  houseNumberAddition: '',
@@ -114,6 +115,7 @@ const buildSingleOrderCustomerPayload = _ref3 => {
114
115
  const baseCustomer = _objectSpread(_objectSpread({}, getEmptySingleOrderCustomer()), customer);
115
116
  if (!webshop && !anderAfleveradres) {
116
117
  return _objectSpread(_objectSpread({}, getEmptySingleOrderCustomer()), {}, {
118
+ note: (customer === null || customer === void 0 ? void 0 : customer.note) || '',
117
119
  anderAfleveradres: false,
118
120
  afhalenInWinkel: false,
119
121
  anderFactuuradres: false
@@ -37,23 +37,19 @@ const useBranchTheme = () => {
37
37
  if (!formula) {
38
38
  return cachedTheme || _constants__.BRANCH_THEME_BY_FORMULA.Trekhaakmontage;
39
39
  }
40
- switch (formula) {
41
- case _constants__.BRANCH_FORMULAS.Trekhaakmontage:
40
+ switch ((0, _constants__.getThemeFormulaForConfiguratorFormula)(formula)) {
42
41
  case _constants__.CONFIGURATOR_FORMULAS.THM:
43
42
  {
44
43
  return _constants__.BRANCH_THEME_BY_FORMULA.Trekhaakmontage;
45
44
  }
46
- case _constants__.BRANCH_FORMULAS.Trekhaakcentrum:
47
45
  case _constants__.CONFIGURATOR_FORMULAS.THC:
48
46
  {
49
47
  return _constants__.BRANCH_THEME_BY_FORMULA.Trekhaakcentrum;
50
48
  }
51
- case _constants__.BRANCH_FORMULAS.TowMotiveGroup:
52
49
  case _constants__.CONFIGURATOR_FORMULAS.TMG:
53
50
  {
54
51
  return _constants__.BRANCH_THEME_BY_FORMULA.TowMotiveGroup;
55
52
  }
56
- case _constants__.BRANCH_FORMULAS.TowMotive:
57
53
  case _constants__.CONFIGURATOR_FORMULAS.TOW:
58
54
  case _constants__.CONFIGURATOR_FORMULAS.TH:
59
55
  case _constants__.CONFIGURATOR_FORMULAS.TowMotive:
@@ -62,7 +58,7 @@ const useBranchTheme = () => {
62
58
  }
63
59
  default:
64
60
  {
65
- return cachedTheme;
61
+ return cachedTheme || null;
66
62
  }
67
63
  }
68
64
  }, [themeFromContext, cachedTheme, formula]);
@@ -54,8 +54,15 @@ function _interopRequireWildcard(e, r) {
54
54
  const NoProductsPage = () => {
55
55
  const mailLinkRef = (0, _react.useRef)(null);
56
56
  const formula = (0, _FormulaContext.useFormula)();
57
- const themeClass = (0, _helpers__.getConfiguratorThemeClass)((0, _useBranchTheme.useBranchTheme)());
58
- const contactDetails = _constants__.NO_PRODUCTS_CONTACT_DETAILS_BY_FORMULA[formula] || _constants__.NO_PRODUCTS_CONTACT_DETAILS_BY_FORMULA[_constants__.CONFIGURATOR_FORMULAS.THM];
57
+ const branchTheme = (0, _useBranchTheme.useBranchTheme)();
58
+ const themeClass = (0, _helpers__.getConfiguratorThemeClass)(branchTheme);
59
+ const fallbackFormulaByTheme = {
60
+ [_constants__.BRANCH_THEME_BY_FORMULA.Trekhaakcentrum]: _constants__.CONFIGURATOR_FORMULAS.THC,
61
+ [_constants__.BRANCH_THEME_BY_FORMULA.Trekhaakmontage]: _constants__.CONFIGURATOR_FORMULAS.THM,
62
+ [_constants__.BRANCH_THEME_BY_FORMULA.TowMotiveGroup]: _constants__.CONFIGURATOR_FORMULAS.TMG,
63
+ [_constants__.BRANCH_THEME_BY_FORMULA.TowMotive]: _constants__.CONFIGURATOR_FORMULAS.TOW
64
+ };
65
+ const contactDetails = _constants__.NO_PRODUCTS_CONTACT_DETAILS_BY_FORMULA[(0, _constants__.getThemeFormulaForConfiguratorFormula)(formula)] || _constants__.NO_PRODUCTS_CONTACT_DETAILS_BY_FORMULA[fallbackFormulaByTheme[branchTheme]];
59
66
  const handleClick = () => {
60
67
  (0, _Datalayer.pushToDataLayer)({
61
68
  event: 'configurator',
@@ -50,8 +50,15 @@ function _interopRequireWildcard(e, r) {
50
50
  const InternalNoProductsPage = () => {
51
51
  const mailLinkRef = (0, _react.useRef)(null);
52
52
  const formula = (0, _FormulaContext.useFormula)();
53
- const themeClass = (0, _helpers__.getConfiguratorThemeClass)((0, _useBranchTheme.useBranchTheme)());
54
- const contactDetails = _constants__.NO_PRODUCTS_CONTACT_DETAILS_BY_FORMULA[formula] || _constants__.NO_PRODUCTS_CONTACT_DETAILS_BY_FORMULA[_constants__.CONFIGURATOR_FORMULAS.THM];
53
+ const branchTheme = (0, _useBranchTheme.useBranchTheme)();
54
+ const themeClass = (0, _helpers__.getConfiguratorThemeClass)(branchTheme);
55
+ const fallbackFormulaByTheme = {
56
+ [_constants__.BRANCH_THEME_BY_FORMULA.Trekhaakcentrum]: _constants__.CONFIGURATOR_FORMULAS.THC,
57
+ [_constants__.BRANCH_THEME_BY_FORMULA.Trekhaakmontage]: _constants__.CONFIGURATOR_FORMULAS.THM,
58
+ [_constants__.BRANCH_THEME_BY_FORMULA.TowMotiveGroup]: _constants__.CONFIGURATOR_FORMULAS.TMG,
59
+ [_constants__.BRANCH_THEME_BY_FORMULA.TowMotive]: _constants__.CONFIGURATOR_FORMULAS.TOW
60
+ };
61
+ const contactDetails = _constants__.NO_PRODUCTS_CONTACT_DETAILS_BY_FORMULA[(0, _constants__.getThemeFormulaForConfiguratorFormula)(formula)] || _constants__.NO_PRODUCTS_CONTACT_DETAILS_BY_FORMULA[fallbackFormulaByTheme[branchTheme]];
55
62
  const handleClick = () => {
56
63
  if (mailLinkRef.current) {
57
64
  mailLinkRef.current.click();
@@ -339,12 +339,14 @@ const InternalSingleOrderPage = () => {
339
339
  vehicle,
340
340
  ownershipType
341
341
  });
342
- const customerPayload = (0, _helpers__.buildSingleOrderCustomerPayload)({
342
+ const customerPayload = _objectSpread(_objectSpread({}, (0, _helpers__.buildSingleOrderCustomerPayload)({
343
343
  customer,
344
344
  webshop,
345
345
  anderAfleveradres,
346
346
  afhalenInWinkel,
347
347
  ownershipType
348
+ })), {}, {
349
+ note: (customer === null || customer === void 0 ? void 0 : customer.note) || (internalNote === null || internalNote === void 0 ? void 0 : internalNote.internalNote) || ''
348
350
  });
349
351
  const businessContactPayload = (0, _helpers__.buildSingleOrderBusinessContactPayload)({
350
352
  customer: customerPayload,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.365",
3
+ "version": "0.0.367",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",