thm-p3-configurator 0.0.258 → 0.0.261

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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
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.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.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.AUTH_SESSION_KEY = exports.ARTICLE_SPECS_TRANSLATIONS = exports.ARTICLES_SYSTEM_FIELDS = exports.API_ERROR_CODES = exports.ANWB_DISCOUNT_CODE = exports.ALL_EXPERIMENTS = exports.ACTIVE_VARIANTS = void 0;
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.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.AUTH_SESSION_KEY = exports.ARTICLE_SPECS_TRANSLATIONS = exports.ARTICLES_SYSTEM_FIELDS = exports.API_ERROR_CODES = exports.ANWB_DISCOUNT_CODE = exports.ALL_EXPERIMENTS = exports.ACTIVE_VARIANTS = void 0;
7
7
  const DOSSIER_TYPES = exports.DOSSIER_TYPES = {
8
8
  Quotation: 'quotation',
9
9
  AppointmentRequest: 'appointment-request',
@@ -259,6 +259,7 @@ const NO_PRODUCTS_CONTACT_DETAILS_BY_FORMULA = exports.NO_PRODUCTS_CONTACT_DETAI
259
259
  };
260
260
  const LOCATION_CHANGE_BUTTON_LABEL = exports.LOCATION_CHANGE_BUTTON_LABEL = 'Wijzig de locatie';
261
261
  const TMG_ORGANIZATION_TYPE = exports.TMG_ORGANIZATION_TYPE = 'TowMotive Group';
262
+ const TOWMOTIVE_ORGANIZATION_TYPE = exports.TOWMOTIVE_ORGANIZATION_TYPE = 'TowMotive';
262
263
 
263
264
  /**
264
265
  * Maps branch formula values to CONFIGURATOR_FORMULAS
@@ -21,6 +21,7 @@ var _FormulaContext = require("../__context__/FormulaContext");
21
21
  var _OrderSessionContext = require("../__context__/OrderSessionContext");
22
22
  var _helpers__ = require("../__helpers__");
23
23
  var _product = require("../__helpers__/product");
24
+ var _useIsTowmotive = require("../__hooks__/useIsTowmotive");
24
25
  var _ANWBValidator = require("../__services__/ANWBValidator");
25
26
  function _interopRequireDefault(e) {
26
27
  return e && e.__esModule ? e : {
@@ -67,20 +68,23 @@ const ANWBMembershipValidator = () => {
67
68
  discountCode,
68
69
  executionAnswer1,
69
70
  executionAnswer2,
70
- priceCalculationDate
71
+ priceCalculationDate,
72
+ selectedExtras,
73
+ vehicleCodingDiscountPercentage
71
74
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
72
75
  const [isNumberValid, setIsNumberValid] = (0, _react.useState)();
73
76
  const formula = (0, _FormulaContext.useFormula)();
74
- const cartInput = (0, _product.validateCartInput)([{
75
- articleNumber: selectedCableset,
76
- quantity: 1
77
- }, {
78
- articleNumber: selectedCombiset,
79
- quantity: 1
80
- }, {
81
- articleNumber: selectedTowbar,
82
- quantity: 1
83
- }, ...selectedDiscountedProducts]);
77
+ const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
78
+ const cartInput = (0, _product.buildCartInput)({
79
+ selectedCableset,
80
+ selectedCombiset,
81
+ selectedTowbar,
82
+ selectedBoardComputer,
83
+ selectedExtras,
84
+ selectedDiscountedProducts,
85
+ isTowmotiveFormula: isTowmotive,
86
+ vehicleCodingDiscountPercentage
87
+ });
84
88
  const {
85
89
  discountProducts
86
90
  } = (0, _queries.useProductsQuery)({
@@ -7,7 +7,6 @@ require("core-js/modules/es.weak-map.js");
7
7
  require("core-js/modules/esnext.iterator.constructor.js");
8
8
  require("core-js/modules/esnext.iterator.filter.js");
9
9
  require("core-js/modules/esnext.iterator.for-each.js");
10
- require("core-js/modules/esnext.iterator.map.js");
11
10
  require("core-js/modules/web.dom-collections.iterator.js");
12
11
  require("core-js/modules/es.weak-map.js");
13
12
  require("core-js/modules/esnext.iterator.constructor.js");
@@ -20,7 +19,6 @@ exports.default = void 0;
20
19
  require("core-js/modules/es.promise.js");
21
20
  require("core-js/modules/es.regexp.exec.js");
22
21
  require("core-js/modules/es.string.replace.js");
23
- require("core-js/modules/esnext.iterator.map.js");
24
22
  require("core-js/modules/web.dom-collections.iterator.js");
25
23
  var _react = _interopRequireWildcard(require("react"));
26
24
  var _reactRouter = require("react-router");
@@ -39,6 +37,7 @@ var _FormulaContext = require("../__context__/FormulaContext");
39
37
  var _OrderSessionContext = require("../__context__/OrderSessionContext");
40
38
  var _helpers__ = require("../__helpers__");
41
39
  var _product = require("../__helpers__/product");
40
+ var _useIsTowmotive = require("../__hooks__/useIsTowmotive");
42
41
  function _interopRequireDefault(e) {
43
42
  return e && e.__esModule ? e : {
44
43
  default: e
@@ -143,7 +142,8 @@ const AppointmentForm = () => {
143
142
  executionAnswer2,
144
143
  priceCalculationDate,
145
144
  selectedDiscountedProducts = [],
146
- selectedExtras
145
+ selectedExtras,
146
+ vehicleCodingDiscountPercentage
147
147
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
148
148
  const [errors, setErrors] = (0, _react.useState)({});
149
149
  const [isTermsAccepted, setIsTermsAccepted] = (0, _react.useState)(false);
@@ -154,6 +154,7 @@ const AppointmentForm = () => {
154
154
  createAppointmentRequest
155
155
  } = (0, _mutations.useCreateAppointmentRequestMutation)();
156
156
  const formula = (0, _FormulaContext.useFormula)();
157
+ const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
157
158
  const history = (0, _reactRouter.useHistory)();
158
159
  const handleSubmit = async () => {
159
160
  try {
@@ -187,22 +188,16 @@ const AppointmentForm = () => {
187
188
  discount: discountCode !== null && discountCode !== void 0 && discountCode.length ? {
188
189
  code: discountCode
189
190
  } : null,
190
- cart: (0, _product.validateCartInput)([{
191
- articleNumber: selectedCableset,
192
- quantity: 1
193
- }, {
194
- articleNumber: selectedCombiset,
195
- quantity: 1
196
- }, {
197
- articleNumber: selectedTowbar,
198
- quantity: 1
199
- }, ...Object.entries(selectedExtras).map(_ref => {
200
- let [extraArticleNumber, extraQuantity] = _ref;
201
- return {
202
- articleNumber: extraArticleNumber,
203
- quantity: extraQuantity
204
- };
205
- }), ...selectedDiscountedProducts])
191
+ cart: (0, _product.buildCartInput)({
192
+ selectedCableset,
193
+ selectedCombiset,
194
+ selectedTowbar,
195
+ selectedBoardComputer,
196
+ selectedExtras,
197
+ selectedDiscountedProducts,
198
+ isTowmotiveFormula: isTowmotive,
199
+ vehicleCodingDiscountPercentage
200
+ })
206
201
  }));
207
202
  } catch (ex) {
208
203
  console.error("handleSubmit(): ".concat(ex));
@@ -7,7 +7,6 @@ require("core-js/modules/es.weak-map.js");
7
7
  require("core-js/modules/esnext.iterator.constructor.js");
8
8
  require("core-js/modules/esnext.iterator.filter.js");
9
9
  require("core-js/modules/esnext.iterator.for-each.js");
10
- require("core-js/modules/esnext.iterator.map.js");
11
10
  require("core-js/modules/web.dom-collections.iterator.js");
12
11
  require("core-js/modules/es.weak-map.js");
13
12
  require("core-js/modules/esnext.iterator.constructor.js");
@@ -20,7 +19,6 @@ exports.default = void 0;
20
19
  require("core-js/modules/es.array.includes.js");
21
20
  require("core-js/modules/es.promise.js");
22
21
  require("core-js/modules/es.string.includes.js");
23
- require("core-js/modules/esnext.iterator.map.js");
24
22
  require("core-js/modules/web.dom-collections.iterator.js");
25
23
  var _lodash = require("lodash");
26
24
  var _react = _interopRequireWildcard(require("react"));
@@ -37,6 +35,7 @@ var _OrderSessionContext = require("../__context__/OrderSessionContext");
37
35
  var _helpers__ = require("../__helpers__");
38
36
  var _product = require("../__helpers__/product");
39
37
  var _ui = require("../__helpers__/ui");
38
+ var _useIsTowmotive = require("../__hooks__/useIsTowmotive");
40
39
  function _interopRequireDefault(e) {
41
40
  return e && e.__esModule ? e : {
42
41
  default: e
@@ -137,9 +136,11 @@ const ExitIntentModal = () => {
137
136
  executionAnswer2,
138
137
  priceCalculationDate,
139
138
  selectedDiscountedProducts = [],
140
- selectedExtras
139
+ selectedExtras,
140
+ vehicleCodingDiscountPercentage
141
141
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
142
142
  const formula = (0, _FormulaContext.useFormula)();
143
+ const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
143
144
  (0, _react.useEffect)(() => {
144
145
  (0, _ui.scrollToFirstErrorMessage)();
145
146
  }, [errors]);
@@ -191,22 +192,16 @@ const ExitIntentModal = () => {
191
192
  })),
192
193
  branchId: selectedBranch,
193
194
  selectBoardComputerUpdate: selectedBoardComputer != null,
194
- cart: (0, _product.validateCartInput)([{
195
- articleNumber: selectedCableset,
196
- quantity: 1
197
- }, {
198
- articleNumber: selectedCombiset,
199
- quantity: 1
200
- }, {
201
- articleNumber: selectedTowbar,
202
- quantity: 1
203
- }, ...Object.entries(selectedExtras).map(_ref => {
204
- let [extraArticleNumber, extraQuantity] = _ref;
205
- return {
206
- articleNumber: extraArticleNumber,
207
- quantity: extraQuantity
208
- };
209
- }), ...selectedDiscountedProducts])
195
+ cart: (0, _product.buildCartInput)({
196
+ selectedCableset,
197
+ selectedCombiset,
198
+ selectedTowbar,
199
+ selectedBoardComputer,
200
+ selectedExtras,
201
+ selectedDiscountedProducts,
202
+ isTowmotiveFormula: isTowmotive,
203
+ vehicleCodingDiscountPercentage
204
+ })
210
205
  }));
211
206
  } catch (ex) {
212
207
  console.error("handleSubmit(): ".concat(ex));
@@ -27,7 +27,7 @@ var _helpers__ = require("../__helpers__");
27
27
  var _image = require("../__helpers__/image");
28
28
  var _product = require("../__helpers__/product");
29
29
  var _useIsTmg = require("../__hooks__/useIsTmg");
30
- var _CheckboxInput = _interopRequireDefault(require("../__components__/Form/CheckboxInput"));
30
+ var _useIsTowmotive = require("../__hooks__/useIsTowmotive");
31
31
  function _interopRequireDefault(e) {
32
32
  return e && e.__esModule ? e : {
33
33
  default: e
@@ -75,24 +75,19 @@ const ExtraProductsOverview = () => {
75
75
  discountCode,
76
76
  executionAnswer1,
77
77
  executionAnswer2,
78
- durationAnswer
78
+ durationAnswer,
79
+ vehicleCodingDiscountPercentage
79
80
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
80
- const cartInput = (0, _product.validateCartInput)([{
81
- articleNumber: selectedCableset,
82
- quantity: 1
83
- }, {
84
- articleNumber: selectedCombiset,
85
- quantity: 1
86
- }, {
87
- articleNumber: selectedTowbar,
88
- quantity: 1
89
- }, ...Object.entries(selectedExtras).map(_ref => {
90
- let [extraArticleNumber, extraQuantity] = _ref;
91
- return {
92
- articleNumber: extraArticleNumber,
93
- quantity: extraQuantity
94
- };
95
- })]);
81
+ const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
82
+ const cartInput = (0, _product.buildCartInput)({
83
+ selectedCableset,
84
+ selectedCombiset,
85
+ selectedTowbar,
86
+ selectedBoardComputer,
87
+ selectedExtras,
88
+ isTowmotiveFormula: isTowmotive,
89
+ vehicleCodingDiscountPercentage
90
+ });
96
91
  const {
97
92
  products,
98
93
  isLoadingProducts,
@@ -118,12 +113,12 @@ const ExtraProductsOverview = () => {
118
113
  to: "/configurator/geen-producten"
119
114
  });
120
115
  }
121
- const handleProductSelected = _ref2 => {
116
+ const handleProductSelected = _ref => {
122
117
  let {
123
118
  productId,
124
119
  isSelected,
125
120
  productCategory
126
- } = _ref2;
121
+ } = _ref;
127
122
  switch (productCategory) {
128
123
  case _constants__.PRODUCT_CATEGORIES.EXTRAS:
129
124
  {
@@ -147,8 +142,8 @@ const ExtraProductsOverview = () => {
147
142
  delete products[_constants__.PRODUCT_CATEGORIES.CABLESET];
148
143
  delete products[_constants__.PRODUCT_CATEGORIES.COMBISET];
149
144
  delete products[_constants__.PRODUCT_CATEGORIES.BOARD_COMPUTER];
150
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, Object.entries(products).map((_ref3, index) => {
151
- let [productCategory, productsPerCategory] = _ref3;
145
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, Object.entries(products).map((_ref2, index) => {
146
+ let [productCategory, productsPerCategory] = _ref2;
152
147
  if (!productsPerCategory.length || productCategory !== _constants__.PRODUCT_CATEGORIES.EXTRAS) {
153
148
  return null;
154
149
  }
@@ -158,8 +153,8 @@ const ExtraProductsOverview = () => {
158
153
  items: productsPerCategory,
159
154
  key: 'categoryName'
160
155
  });
161
- const groupedProductsArray = Object.entries(groupedProducts).map(_ref4 => {
162
- let [categoryName, products] = _ref4;
156
+ const groupedProductsArray = Object.entries(groupedProducts).map(_ref3 => {
157
+ let [categoryName, products] = _ref3;
163
158
  return {
164
159
  categoryName,
165
160
  products
@@ -187,11 +182,11 @@ const ExtraProductsOverview = () => {
187
182
  }) : _logoPrimary.default,
188
183
  isDisabled: false,
189
184
  defaultSelected: selectedExtras.hasOwnProperty(product.articleNumber),
190
- onSelect: _ref5 => {
185
+ onSelect: _ref4 => {
191
186
  let {
192
187
  productId,
193
188
  isSelected
194
- } = _ref5;
189
+ } = _ref4;
195
190
  return handleProductSelected({
196
191
  productId,
197
192
  isSelected,
@@ -43,6 +43,7 @@ var _OrderSessionContext = require("../__context__/OrderSessionContext");
43
43
  var _helpers__ = require("../__helpers__");
44
44
  var _image = require("../__helpers__/image");
45
45
  var _product = require("../__helpers__/product");
46
+ var _useIsTowmotive = require("../__hooks__/useIsTowmotive");
46
47
  function _interopRequireDefault(e) {
47
48
  return e && e.__esModule ? e : {
48
49
  default: e
@@ -90,24 +91,19 @@ const ProductCartSide = () => {
90
91
  allArticleNumbers,
91
92
  selectedExtras,
92
93
  canAlterQuantity,
93
- selectedBranch
94
+ selectedBranch,
95
+ vehicleCodingDiscountPercentage
94
96
  } = order;
95
- const cartInput = (0, _product.validateCartInput)([{
96
- articleNumber: selectedCableset,
97
- quantity: 1
98
- }, {
99
- articleNumber: selectedCombiset,
100
- quantity: 1
101
- }, {
102
- articleNumber: selectedTowbar,
103
- quantity: 1
104
- }, ...Object.entries(selectedExtras).map(_ref => {
105
- let [extraArticleNumber, extraQuantity] = _ref;
106
- return {
107
- articleNumber: extraArticleNumber,
108
- quantity: extraQuantity
109
- };
110
- })]);
97
+ const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
98
+ const cartInput = (0, _product.buildCartInput)({
99
+ selectedCableset,
100
+ selectedCombiset,
101
+ selectedTowbar,
102
+ selectedBoardComputer,
103
+ selectedExtras,
104
+ isTowmotiveFormula: isTowmotive,
105
+ vehicleCodingDiscountPercentage
106
+ });
111
107
  const {
112
108
  cart,
113
109
  totals,
@@ -3,8 +3,11 @@
3
3
  require("core-js/modules/es.array.includes.js");
4
4
  require("core-js/modules/es.array.reduce.js");
5
5
  require("core-js/modules/es.json.stringify.js");
6
+ require("core-js/modules/es.parse-int.js");
7
+ require("core-js/modules/es.regexp.exec.js");
6
8
  require("core-js/modules/es.regexp.to-string.js");
7
9
  require("core-js/modules/es.string.includes.js");
10
+ require("core-js/modules/es.string.replace.js");
8
11
  require("core-js/modules/es.weak-map.js");
9
12
  require("core-js/modules/esnext.iterator.constructor.js");
10
13
  require("core-js/modules/esnext.iterator.filter.js");
@@ -22,8 +25,11 @@ exports.default = void 0;
22
25
  require("core-js/modules/es.array.includes.js");
23
26
  require("core-js/modules/es.array.reduce.js");
24
27
  require("core-js/modules/es.json.stringify.js");
28
+ require("core-js/modules/es.parse-int.js");
29
+ require("core-js/modules/es.regexp.exec.js");
25
30
  require("core-js/modules/es.regexp.to-string.js");
26
31
  require("core-js/modules/es.string.includes.js");
32
+ require("core-js/modules/es.string.replace.js");
27
33
  require("core-js/modules/esnext.iterator.constructor.js");
28
34
  require("core-js/modules/esnext.iterator.filter.js");
29
35
  require("core-js/modules/esnext.iterator.find.js");
@@ -35,6 +41,7 @@ var _logoPrimary = _interopRequireDefault(require("../../../public/assets/images
35
41
  var _montagePlaceholder = _interopRequireDefault(require("../../../public/assets/images/montage-placeholder.png"));
36
42
  var _queries = require("../__api__/queries");
37
43
  var _TogglableCard = _interopRequireDefault(require("../__components__/Cards/TogglableCard"));
44
+ var _TextInput = _interopRequireDefault(require("../__components__/Form/TextInput"));
38
45
  var _ProductTableEditableRow = _interopRequireDefault(require("../__components__/ProductTable/ProductTableEditableRow"));
39
46
  var _ProductTableHead = _interopRequireDefault(require("../__components__/ProductTable/ProductTableHead"));
40
47
  var _ProductTableSection = _interopRequireDefault(require("../__components__/ProductTable/ProductTableSection"));
@@ -49,6 +56,7 @@ var _helpers__ = require("../__helpers__");
49
56
  var _image = require("../__helpers__/image");
50
57
  var _product = require("../__helpers__/product");
51
58
  var _useIsTmg = require("../__hooks__/useIsTmg");
59
+ var _useIsTowmotive = require("../__hooks__/useIsTowmotive");
52
60
  var _InternalDiscountForm = _interopRequireDefault(require("./internal/InternalDiscountForm"));
53
61
  function _interopRequireDefault(e) {
54
62
  return e && e.__esModule ? e : {
@@ -126,6 +134,7 @@ function _toPrimitive(t, r) {
126
134
  const ProductCartTable = () => {
127
135
  const formula = (0, _FormulaContext.useFormula)();
128
136
  const isTmg = (0, _useIsTmg.useIsTmg)();
137
+ const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
129
138
  const [isToggled, setIsToggled] = (0, _react.useState)(false);
130
139
  const [{
131
140
  licensePlate,
@@ -142,24 +151,37 @@ const ProductCartTable = () => {
142
151
  executionAnswer2,
143
152
  discountAmount,
144
153
  discountPercentage,
145
- selectedBranch
154
+ selectedBranch,
155
+ vehicleCodingDiscountPercentage
146
156
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
147
- const cartInput = (0, _product.validateCartInput)([{
148
- articleNumber: selectedCableset,
149
- quantity: 1
150
- }, {
151
- articleNumber: selectedCombiset,
152
- quantity: 1
153
- }, {
154
- articleNumber: selectedTowbar,
155
- quantity: 1
156
- }, ...Object.entries(selectedExtras).map(_ref => {
157
- let [extraArticleNumber, extraQuantity] = _ref;
158
- return {
159
- articleNumber: extraArticleNumber,
160
- quantity: extraQuantity
161
- };
162
- })]);
157
+ const handleVehicleCodingDiscountChange = value => {
158
+ const sanitized = value === null || value === void 0 ? void 0 : value.toString().replace(/[^0-9]/g, '');
159
+ if (sanitized === '') {
160
+ dispatch({
161
+ type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_CODING_DISCOUNT_PERCENTAGE,
162
+ payload: {
163
+ percentage: null
164
+ }
165
+ });
166
+ return;
167
+ }
168
+ const parsed = Math.min(100, Math.max(0, parseInt(sanitized, 10)));
169
+ dispatch({
170
+ type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_CODING_DISCOUNT_PERCENTAGE,
171
+ payload: {
172
+ percentage: parsed
173
+ }
174
+ });
175
+ };
176
+ const cartInput = (0, _product.buildCartInput)({
177
+ selectedCableset,
178
+ selectedCombiset,
179
+ selectedTowbar,
180
+ selectedBoardComputer,
181
+ selectedExtras,
182
+ isTowmotiveFormula: isTowmotive,
183
+ vehicleCodingDiscountPercentage
184
+ });
163
185
  const {
164
186
  cart,
165
187
  totals,
@@ -215,6 +237,8 @@ const ProductCartTable = () => {
215
237
  salesPriceIncl: 0
216
238
  };
217
239
  }
240
+ const hasLocationTotal = (cartItem === null || cartItem === void 0 ? void 0 : cartItem.locationTotal) !== undefined && (cartItem === null || cartItem === void 0 ? void 0 : cartItem.locationTotal) !== null;
241
+ const locationTotal = hasLocationTotal ? Number(cartItem.locationTotal) : 0;
218
242
  if (!product) {
219
243
  return {
220
244
  purchasePrice: 0,
@@ -229,19 +253,22 @@ const ProductCartTable = () => {
229
253
 
230
254
  // TMG case: when TMG and toggled, show catalog price excl and verkoop prijs incl
231
255
  if (isTmg && isToggled && product !== null && product !== void 0 && product.consumerPrices) {
256
+ var _product$locationPric, _ref, _ref2, _cartItem$consumerTot, _product$consumerPric;
257
+ const purchasePrice = locationTotal || Number((product === null || product === void 0 || (_product$locationPric = product.locationPrices) === null || _product$locationPric === void 0 ? void 0 : _product$locationPric.priceExclVat) || 0);
258
+ const salesPriceRaw = (_ref = (_ref2 = (_cartItem$consumerTot = cartItem === null || cartItem === void 0 ? void 0 : cartItem.consumerTotal) !== null && _cartItem$consumerTot !== void 0 ? _cartItem$consumerTot : product === null || product === void 0 || (_product$consumerPric = product.consumerPrices) === null || _product$consumerPric === void 0 ? void 0 : _product$consumerPric.priceInclVat) !== null && _ref2 !== void 0 ? _ref2 : product === null || product === void 0 ? void 0 : product.price) !== null && _ref !== void 0 ? _ref : 0;
259
+ const salesPrice = salesPriceRaw && !Number.isNaN(Number(salesPriceRaw)) ? Number(salesPriceRaw) / 1.21 : 0;
260
+ const margin = salesPrice - purchasePrice;
232
261
  return {
233
- purchasePrice: 0,
234
- salesPrice: 0,
235
- margin: 0,
236
- hasLocationTotal: false,
262
+ purchasePrice,
263
+ salesPrice,
264
+ margin,
265
+ hasLocationTotal,
237
266
  catalogPriceExcl: product.consumerPrices.listPriceExclVat || 0,
238
267
  salesPriceIncl: product.consumerPrices.priceInclVat || 0
239
268
  };
240
269
  }
241
270
  let purchasePrice = 0;
242
271
  let salesPrice = 0;
243
- const hasLocationTotal = (cartItem === null || cartItem === void 0 ? void 0 : cartItem.locationTotal) !== undefined && (cartItem === null || cartItem === void 0 ? void 0 : cartItem.locationTotal) !== null;
244
- const locationTotal = hasLocationTotal ? Number(cartItem.locationTotal) : 0;
245
272
 
246
273
  // Get prices directly from product objects
247
274
  if (APP_CONFIG.internal) {
@@ -325,6 +352,34 @@ const ProductCartTable = () => {
325
352
  const montageDisplayedTotalExclVat = isToggled && !isTmg ? Number((totals === null || totals === void 0 ? void 0 : totals.totalMontageExclVat) || 0) : 0;
326
353
  const marketCorrectionDisplayedTotalExclVat = isToggled && !isTmg && hasMarketCorrectionValue ? Number(marketCorrectionSalesExcl || 0) : 0;
327
354
  const trekhaakmontageSubtotalExclVat = displayedMainProductsTotalExclVat + montageDisplayedTotalExclVat + marketCorrectionDisplayedTotalExclVat;
355
+
356
+ // TMG subtotal helpers (excl. btw columns)
357
+ const tmgMainCatalogSubtotal = isTmg ? mainProducts.reduce((total, product) => {
358
+ var _product$priceInfo2;
359
+ return total + Number((product === null || product === void 0 || (_product$priceInfo2 = product.priceInfo) === null || _product$priceInfo2 === void 0 ? void 0 : _product$priceInfo2.catalogPriceExcl) || 0);
360
+ }, 0) : 0;
361
+ const tmgMainMarginSubtotal = isTmg ? mainProducts.reduce((total, product) => {
362
+ var _product$priceInfo3;
363
+ return total + Number((product === null || product === void 0 || (_product$priceInfo3 = product.priceInfo) === null || _product$priceInfo3 === void 0 ? void 0 : _product$priceInfo3.margin) || 0);
364
+ }, 0) + (isToggled && hasMarketCorrectionValue ? Number(marketCorrectionMargin || 0) : 0) : 0;
365
+ const tmgMainPurchaseSubtotal = isTmg ? mainProductsSubtotal : 0;
366
+ const tmgMainSalesSubtotal = isTmg ? mainProducts.reduce((total, product) => {
367
+ var _product$priceInfo4;
368
+ return total + Number((product === null || product === void 0 || (_product$priceInfo4 = product.priceInfo) === null || _product$priceInfo4 === void 0 ? void 0 : _product$priceInfo4.salesPrice) || 0);
369
+ }, 0) + Number((totals === null || totals === void 0 ? void 0 : totals.totalMontageExclVat) || 0) + (isToggled && hasMarketCorrectionValue ? Number(marketCorrectionSalesExcl || 0) : 0) : 0;
370
+ const tmgAccessoriesCatalogSubtotal = isTmg ? accessoireProducts.reduce((total, product) => {
371
+ var _product$priceInfo5;
372
+ return total + Number((product === null || product === void 0 || (_product$priceInfo5 = product.priceInfo) === null || _product$priceInfo5 === void 0 ? void 0 : _product$priceInfo5.catalogPriceExcl) || 0);
373
+ }, 0) : 0;
374
+ const tmgAccessoriesMarginSubtotal = isTmg ? accessoireProducts.reduce((total, product) => {
375
+ var _product$priceInfo6;
376
+ return total + Number((product === null || product === void 0 || (_product$priceInfo6 = product.priceInfo) === null || _product$priceInfo6 === void 0 ? void 0 : _product$priceInfo6.margin) || 0);
377
+ }, 0) : 0;
378
+ const tmgAccessoriesPurchaseSubtotal = isTmg ? accessoireProductsSubtotal : 0;
379
+ const tmgAccessoriesSalesSubtotal = isTmg ? accessoireProducts.reduce((total, product) => {
380
+ var _product$priceInfo7;
381
+ return total + Number((product === null || product === void 0 || (_product$priceInfo7 = product.priceInfo) === null || _product$priceInfo7 === void 0 ? void 0 : _product$priceInfo7.salesPrice) || 0);
382
+ }, 0) : 0;
328
383
  if (isLoadingProducts) {
329
384
  return /*#__PURE__*/_react.default.createElement(_FullPageSpinner.default, null);
330
385
  }
@@ -338,11 +393,17 @@ const ProductCartTable = () => {
338
393
  }, /*#__PURE__*/_react.default.createElement("table", {
339
394
  className: (0, _helpers__.withStyle)('cart__table table table-borderless align-middle')
340
395
  }, /*#__PURE__*/_react.default.createElement(_ProductTableHead.default, {
341
- columns: [{}, {}, {}, {}, ...(isToggled ? isTmg ? [{}, {
396
+ columns: [{}, {}, {}, {}, ...(isToggled ? isTmg ? [{
342
397
  text: 'Catalogprijs (excl. btw)',
343
398
  className: 'fw-bold text-end'
344
399
  }, {
345
- text: 'Verkoop Prijs (incl. btw)',
400
+ text: 'Marge (excl. btw)',
401
+ className: 'fw-bold text-end'
402
+ }, {
403
+ text: 'Inkoopprijs (excl. btw)',
404
+ className: 'fw-bold text-end'
405
+ }, {
406
+ text: 'Verkoop Prijs (excl. btw)',
346
407
  className: 'fw-bold text-end'
347
408
  }] : [{
348
409
  text: 'Marge (excl. btw)',
@@ -371,17 +432,43 @@ const ProductCartTable = () => {
371
432
  catalogPriceExcl,
372
433
  salesPriceIncl
373
434
  } = product.priceInfo;
435
+ const isVehicleCodingProduct = (product === null || product === void 0 ? void 0 : product.subgroupName) === _constants__.VEHICLE_CODING_SUBGROUP_NAME || (product === null || product === void 0 ? void 0 : product.groupName) === _constants__.VEHICLE_CODING_SUBGROUP_NAME;
436
+ const vehicleCodingInputCell = isTowmotive && isVehicleCodingProduct ? {
437
+ text: /*#__PURE__*/_react.default.createElement("div", {
438
+ className: (0, _helpers__.withStyle)('text-end')
439
+ }, /*#__PURE__*/_react.default.createElement("span", {
440
+ className: (0, _helpers__.withStyle)('small text-muted d-block mb-1')
441
+ }, "Korting voertuigcodering"), /*#__PURE__*/_react.default.createElement("div", {
442
+ className: (0, _helpers__.withStyle)('d-flex align-items-center justify-content-end gap-2')
443
+ }, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
444
+ className: "mb-0",
445
+ name: "vehicle-coding-discount",
446
+ placeholder: "0-100",
447
+ value: vehicleCodingDiscountPercentage === null || vehicleCodingDiscountPercentage === undefined ? '' : vehicleCodingDiscountPercentage.toString(),
448
+ isRequired: false,
449
+ onChange: handleVehicleCodingDiscountChange
450
+ }), /*#__PURE__*/_react.default.createElement("span", {
451
+ className: (0, _helpers__.withStyle)('small text-muted')
452
+ }, "%"))),
453
+ className: 'cart__table-price text-end'
454
+ } : {};
374
455
  return /*#__PURE__*/_react.default.createElement(_ProductTableStaticRow.default, {
375
456
  key: product.articleNumber,
376
457
  productTitle: (product === null || product === void 0 ? void 0 : product.subgroupName) || (product === null || product === void 0 ? void 0 : product.groupName) || product.title,
377
458
  productImage: product !== null && product !== void 0 && (_product$images = product.images) !== null && _product$images !== void 0 && _product$images[0] ? (0, _image.getImageFromHyper)({
378
459
  imageId: (_product$images2 = product.images) === null || _product$images2 === void 0 ? void 0 : _product$images2[0]
379
460
  }) : _logoPrimary.default,
380
- extraCells: [{}, {}, {}, ...(isToggled ? isTmg ? [{}, {
461
+ extraCells: [vehicleCodingInputCell, {}, {}, ...(isToggled ? isTmg ? [{
381
462
  text: (0, _helpers__.formatPrice)(catalogPriceExcl),
382
463
  className: 'cart__table-price text-end'
383
464
  }, {
384
- text: (0, _helpers__.formatPrice)(salesPriceIncl),
465
+ text: hasLocationTotal ? (0, _helpers__.formatPrice)(margin) : 'N.v.t.',
466
+ className: 'cart__table-price text-end'
467
+ }, {
468
+ text: hasLocationTotal ? (0, _helpers__.formatPrice)(purchasePrice) : 'N.v.t.',
469
+ className: 'cart__table-price text-end'
470
+ }, {
471
+ text: salesPrice > 0 ? (0, _helpers__.formatPrice)(salesPrice) : 'N.v.t.',
385
472
  className: 'cart__table-price text-end'
386
473
  }] : [{
387
474
  text: hasLocationTotal ? (0, _helpers__.formatPrice)(margin) : 'N.v.t.',
@@ -401,11 +488,17 @@ const ProductCartTable = () => {
401
488
  productTitle: 'Montage',
402
489
  productSubtitle: (0, _helpers__.formatMontageTime)(totals === null || totals === void 0 ? void 0 : totals.montageTime),
403
490
  productImage: _montagePlaceholder.default,
404
- extraCells: [{}, {}, {}, ...(isToggled ? isTmg ? [{}, {
491
+ extraCells: [{}, {}, {}, ...(isToggled ? isTmg ? [{
405
492
  text: 'N.v.t.',
406
493
  className: 'cart__table-price text-end'
407
494
  }, {
408
- text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.montagePriceInclVat),
495
+ text: 'N.v.t.',
496
+ className: 'cart__table-price text-end'
497
+ }, {
498
+ text: 'N.v.t.',
499
+ className: 'cart__table-price text-end'
500
+ }, {
501
+ text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalMontageExclVat),
409
502
  className: 'cart__table-price text-end'
410
503
  }] : [{
411
504
  text: 'N.v.t.',
@@ -423,11 +516,17 @@ const ProductCartTable = () => {
423
516
  }), isToggled && hasMarketCorrectionValue && /*#__PURE__*/_react.default.createElement(_ProductTableStaticRow.default, {
424
517
  productTitle: 'Marktcorrectie',
425
518
  productImage: _montagePlaceholder.default,
426
- extraCells: [{}, {}, {}, ...(isTmg ? [{}, {
519
+ extraCells: [{}, {}, {}, ...(isTmg ? [{
427
520
  text: 'N.v.t.',
428
521
  className: 'cart__table-price text-end'
429
522
  }, {
430
- text: (0, _helpers__.formatPrice)(marketCorrectionSalesIncl),
523
+ text: (0, _helpers__.formatPrice)(marketCorrectionMargin),
524
+ className: 'cart__table-price text-end'
525
+ }, {
526
+ text: (0, _helpers__.formatPrice)(marketCorrectionPurchaseExcl),
527
+ className: 'cart__table-price text-end'
528
+ }, {
529
+ text: (0, _helpers__.formatPrice)(marketCorrectionSalesExcl),
431
530
  className: 'cart__table-price text-end'
432
531
  }] : [{
433
532
  text: (0, _helpers__.formatPrice)(marketCorrectionMargin),
@@ -443,12 +542,18 @@ const ProductCartTable = () => {
443
542
  isEditable: true,
444
543
  editLabel: 'Wijzig je trekhaakpakket',
445
544
  editLink: '/configurator/trekhaakpakket',
446
- extraCells: [{}, {}, ...(isToggled ? isTmg ? [{}, {
447
- text: '',
545
+ extraCells: [{}, {}, ...(isToggled ? isTmg ? [{}, {}, {
546
+ text: (0, _helpers__.formatPrice)(tmgMainCatalogSubtotal),
448
547
  className: 'fw-bold text-end'
449
548
  }, {
450
- text: '',
549
+ text: (0, _helpers__.formatPrice)(tmgMainMarginSubtotal),
451
550
  className: 'fw-bold text-end'
551
+ }, {
552
+ text: (0, _helpers__.formatPrice)(tmgMainPurchaseSubtotal),
553
+ className: 'fw-bold text-end'
554
+ }, {
555
+ text: (0, _helpers__.formatPrice)(tmgMainSalesSubtotal),
556
+ className: 'fw-bold text-end pb-2'
452
557
  }] : [{
453
558
  text: '',
454
559
  className: 'fw-bold text-end'
@@ -496,11 +601,17 @@ const ProductCartTable = () => {
496
601
  productImage: product !== null && product !== void 0 && (_product$images3 = product.images) !== null && _product$images3 !== void 0 && _product$images3[0] ? (0, _image.getImageFromHyper)({
497
602
  imageId: (_product$images4 = product.images) === null || _product$images4 === void 0 ? void 0 : _product$images4[0]
498
603
  }) : _logoPrimary.default,
499
- extraCells: [{}, {}, {}, ...(isToggled ? isTmg ? [{}, {
604
+ extraCells: [{}, {}, {}, ...(isToggled ? isTmg ? [{
500
605
  text: (0, _helpers__.formatPrice)(catalogPriceExcl),
501
606
  className: 'cart__table-price text-end'
502
607
  }, {
503
- text: (0, _helpers__.formatPrice)(salesPriceIncl),
608
+ text: hasLocationTotal ? (0, _helpers__.formatPrice)(margin) : 'N.v.t.',
609
+ className: 'cart__table-price text-end'
610
+ }, {
611
+ text: hasLocationTotal ? (0, _helpers__.formatPrice)(purchasePrice) : 'N.v.t.',
612
+ className: 'cart__table-price text-end'
613
+ }, {
614
+ text: salesPrice > 0 ? (0, _helpers__.formatPrice)(salesPrice) : 'N.v.t.',
504
615
  className: 'cart__table-price text-end'
505
616
  }] : [{
506
617
  text: hasLocationTotal ? (0, _helpers__.formatPrice)(margin) : 'N.v.t.',
@@ -536,12 +647,18 @@ const ProductCartTable = () => {
536
647
  });
537
648
  }), /*#__PURE__*/_react.default.createElement(_ProductTableSectionTotal.default, {
538
649
  isEditable: false,
539
- extraCells: [{}, {}, ...(isToggled ? isTmg ? [{}, {
540
- text: '',
650
+ extraCells: [{}, {}, ...(isToggled ? isTmg ? [{}, {}, {
651
+ text: (0, _helpers__.formatPrice)(tmgAccessoriesCatalogSubtotal),
541
652
  className: 'fw-bold text-end'
542
653
  }, {
543
- text: '',
654
+ text: (0, _helpers__.formatPrice)(tmgAccessoriesMarginSubtotal),
544
655
  className: 'fw-bold text-end'
656
+ }, {
657
+ text: (0, _helpers__.formatPrice)(tmgAccessoriesPurchaseSubtotal),
658
+ className: 'fw-bold text-end'
659
+ }, {
660
+ text: (0, _helpers__.formatPrice)(tmgAccessoriesSalesSubtotal),
661
+ className: 'fw-bold text-end pb-2'
545
662
  }] : [{
546
663
  text: '',
547
664
  className: 'fw-bold text-end'
@@ -565,7 +682,7 @@ const ProductCartTable = () => {
565
682
  className: 'fw-bold text-end pb-2'
566
683
  }])]
567
684
  })), /*#__PURE__*/_react.default.createElement(_ProductTableTotal.default, {
568
- rows: [[{}, {}, {}, ...(isToggled ? [{
685
+ rows: [[{}, {}, {}, ...(isToggled && isTmg ? [{}] : []), ...(isToggled ? [{
569
686
  text: '',
570
687
  className: 'text-end pt-2'
571
688
  }, {
@@ -583,7 +700,7 @@ const ProductCartTable = () => {
583
700
  }] : [{
584
701
  text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalAfterDiscountExclVat),
585
702
  className: 'text-end pt-2'
586
- }])], [{}, {}, {}, ...(isToggled ? [{
703
+ }])], [{}, {}, {}, ...(isToggled && isTmg ? [{}] : []), ...(isToggled ? [{
587
704
  text: '',
588
705
  className: 'text-end'
589
706
  }, {
@@ -601,7 +718,7 @@ const ProductCartTable = () => {
601
718
  }] : [{
602
719
  text: APP_CONFIG.internal ? (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalVatAfterDiscount) : (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalVatAfterDiscount),
603
720
  className: 'text-end'
604
- }])], [{}, {}, {}, ...(isToggled ? [{
721
+ }])], [{}, {}, {}, ...(isToggled && isTmg ? [{}] : []), ...(isToggled ? [{
605
722
  text: '',
606
723
  className: 'fw-bold text-end'
607
724
  }, {
@@ -624,7 +741,7 @@ const ProductCartTable = () => {
624
741
  colSpan: "10",
625
742
  className: (0, _helpers__.withStyle)('pt-4 pb-2')
626
743
  }, /*#__PURE__*/_react.default.createElement("hr", null))), /*#__PURE__*/_react.default.createElement(_ProductTableTotal.default, {
627
- rows: [[{}, {}, {}, ...(isToggled ? [{
744
+ rows: [[{}, {}, {}, ...(isToggled && isTmg ? [{}] : []), ...(isToggled ? [{
628
745
  text: '',
629
746
  className: 'text-end text-success'
630
747
  }, {
@@ -639,7 +756,7 @@ const ProductCartTable = () => {
639
756
  }]), {
640
757
  text: "-".concat((0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.discountInclVat)),
641
758
  className: 'text-end text-success'
642
- }], [{}, {}, {}, ...(isToggled ? [{
759
+ }], [{}, {}, {}, ...(isToggled && isTmg ? [{}] : []), ...(isToggled ? [{
643
760
  text: '',
644
761
  className: 'text-end'
645
762
  }, {
@@ -654,7 +771,7 @@ const ProductCartTable = () => {
654
771
  }]), {
655
772
  text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalAfterDiscountExclVat),
656
773
  className: 'text-end'
657
- }], [{}, {}, {}, ...(isToggled ? [{
774
+ }], [{}, {}, {}, ...(isToggled && isTmg ? [{}] : []), ...(isToggled ? [{
658
775
  text: '',
659
776
  className: 'fw-bold text-end'
660
777
  }, {
@@ -34,6 +34,7 @@ var _helpers__ = require("../__helpers__");
34
34
  var _image = require("../__helpers__/image");
35
35
  var _product = require("../__helpers__/product");
36
36
  var _useIsTmg = require("../__hooks__/useIsTmg");
37
+ var _useIsTowmotive = require("../__hooks__/useIsTowmotive");
37
38
  var _BoardComputerCard = _interopRequireDefault(require("./BoardComputerCard"));
38
39
  function _interopRequireDefault(e) {
39
40
  return e && e.__esModule ? e : {
@@ -84,24 +85,19 @@ const ProductsOverview = () => {
84
85
  selectedBoardComputer,
85
86
  isBoardComputerDeselected,
86
87
  discountCode,
87
- priceCalculationDate
88
+ priceCalculationDate,
89
+ vehicleCodingDiscountPercentage
88
90
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
89
- const cartInput = (0, _product.validateCartInput)([{
90
- articleNumber: selectedCableset,
91
- quantity: 1
92
- }, {
93
- articleNumber: selectedCombiset,
94
- quantity: 1
95
- }, {
96
- articleNumber: selectedTowbar,
97
- quantity: 1
98
- }, ...Object.entries(selectedExtras).map(_ref => {
99
- let [extraArticleNumber, extraQuantity] = _ref;
100
- return {
101
- articleNumber: extraArticleNumber,
102
- quantity: extraQuantity
103
- };
104
- })]);
91
+ const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
92
+ const cartInput = (0, _product.buildCartInput)({
93
+ selectedCableset,
94
+ selectedCombiset,
95
+ selectedTowbar,
96
+ selectedBoardComputer,
97
+ selectedExtras,
98
+ isTowmotiveFormula: isTowmotive,
99
+ vehicleCodingDiscountPercentage
100
+ });
105
101
  const {
106
102
  products,
107
103
  isLoadingProducts,
@@ -194,12 +190,12 @@ const ProductsOverview = () => {
194
190
  to: "/configurator/geen-producten"
195
191
  });
196
192
  }
197
- const handleProductSelected = _ref2 => {
193
+ const handleProductSelected = _ref => {
198
194
  let {
199
195
  productId,
200
196
  isSelected,
201
197
  productCategory
202
- } = _ref2;
198
+ } = _ref;
203
199
  switch (productCategory) {
204
200
  case _constants__.PRODUCT_CATEGORIES.TOWBAR:
205
201
  {
@@ -309,8 +305,8 @@ const ProductsOverview = () => {
309
305
  setSkipFilters(value);
310
306
  },
311
307
  label: "Toon alle artikelen"
312
- }), Object.entries(products).map((_ref3, index) => {
313
- let [productCategory, productsPerCategory] = _ref3;
308
+ }), Object.entries(products).map((_ref2, index) => {
309
+ let [productCategory, productsPerCategory] = _ref2;
314
310
  if (!productsPerCategory.length) {
315
311
  return null;
316
312
  }
@@ -334,11 +330,11 @@ const ProductsOverview = () => {
334
330
  if (productCategory === _constants__.PRODUCT_CATEGORIES.BOARD_COMPUTER && selectedCableset) {
335
331
  return /*#__PURE__*/_react.default.createElement(_BoardComputerCard.default, {
336
332
  defaultSelected: selectedBoardComputer === product.articleNumber,
337
- onSelect: _ref4 => {
333
+ onSelect: _ref3 => {
338
334
  let {
339
335
  productId,
340
336
  isSelected
341
- } = _ref4;
337
+ } = _ref3;
342
338
  return handleProductSelected({
343
339
  productId,
344
340
  isSelected,
@@ -380,11 +376,11 @@ const ProductsOverview = () => {
380
376
 
381
377
  isAnotherProductSelected: true,
382
378
  isOnlyProductInCategory: false,
383
- onSelect: _ref5 => {
379
+ onSelect: _ref4 => {
384
380
  let {
385
381
  productId,
386
382
  isSelected
387
- } = _ref5;
383
+ } = _ref4;
388
384
  return handleProductSelected({
389
385
  productId,
390
386
  isSelected,
@@ -5,7 +5,6 @@ require("core-js/modules/es.weak-map.js");
5
5
  require("core-js/modules/esnext.iterator.constructor.js");
6
6
  require("core-js/modules/esnext.iterator.filter.js");
7
7
  require("core-js/modules/esnext.iterator.for-each.js");
8
- require("core-js/modules/esnext.iterator.map.js");
9
8
  require("core-js/modules/web.dom-collections.iterator.js");
10
9
  require("core-js/modules/es.weak-map.js");
11
10
  require("core-js/modules/esnext.iterator.constructor.js");
@@ -16,7 +15,6 @@ Object.defineProperty(exports, "__esModule", {
16
15
  });
17
16
  exports.default = void 0;
18
17
  require("core-js/modules/es.promise.js");
19
- require("core-js/modules/esnext.iterator.map.js");
20
18
  require("core-js/modules/web.dom-collections.iterator.js");
21
19
  var _react = _interopRequireWildcard(require("react"));
22
20
  var _reactRouter = require("react-router");
@@ -35,6 +33,7 @@ var _FormulaContext = require("../__context__/FormulaContext");
35
33
  var _OrderSessionContext = require("../__context__/OrderSessionContext");
36
34
  var _helpers__ = require("../__helpers__");
37
35
  var _product = require("../__helpers__/product");
36
+ var _useIsTowmotive = require("../__hooks__/useIsTowmotive");
38
37
  var _ui = require("../__helpers__/ui");
39
38
  function _interopRequireDefault(e) {
40
39
  return e && e.__esModule ? e : {
@@ -139,7 +138,8 @@ const QuotationForm = () => {
139
138
  selectedBranch,
140
139
  discountCode,
141
140
  selectedDiscountedProducts = [],
142
- selectedExtras
141
+ selectedExtras,
142
+ vehicleCodingDiscountPercentage
143
143
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
144
144
  const [errors, setErrors] = (0, _react.useState)({});
145
145
  const [isTermsAccepted, setIsTermsAccepted] = (0, _react.useState)(false);
@@ -150,6 +150,7 @@ const QuotationForm = () => {
150
150
  isCreatingQuotation
151
151
  } = (0, _mutations.useCreateQuotationMutation)();
152
152
  const formula = (0, _FormulaContext.useFormula)();
153
+ const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
153
154
  (0, _react.useEffect)(() => {
154
155
  (0, _ui.scrollToFirstErrorMessage)();
155
156
  }, [errors]);
@@ -182,22 +183,16 @@ const QuotationForm = () => {
182
183
  customer: (0, _helpers__.removeNullishProps)(customer),
183
184
  branchId: selectedBranch,
184
185
  selectBoardComputerUpdate: selectedBoardComputer != null,
185
- cart: (0, _product.validateCartInput)([{
186
- articleNumber: selectedCableset,
187
- quantity: 1
188
- }, {
189
- articleNumber: selectedCombiset,
190
- quantity: 1
191
- }, {
192
- articleNumber: selectedTowbar,
193
- quantity: 1
194
- }, ...Object.entries(selectedExtras).map(_ref => {
195
- let [extraArticleNumber, extraQuantity] = _ref;
196
- return {
197
- articleNumber: extraArticleNumber,
198
- quantity: extraQuantity
199
- };
200
- }), ...selectedDiscountedProducts])
186
+ cart: (0, _product.buildCartInput)({
187
+ selectedCableset,
188
+ selectedCombiset,
189
+ selectedTowbar,
190
+ selectedBoardComputer,
191
+ selectedExtras,
192
+ selectedDiscountedProducts,
193
+ isTowmotiveFormula: isTowmotive,
194
+ vehicleCodingDiscountPercentage
195
+ })
201
196
  }));
202
197
  } catch (ex) {
203
198
  console.error("handleSubmit(): ".concat(ex));
@@ -47,6 +47,7 @@ var _helpers__ = require("../../__helpers__");
47
47
  var _product = require("../../__helpers__/product");
48
48
  var _ui = require("../../__helpers__/ui");
49
49
  var _useIsTmg = require("../../__hooks__/useIsTmg");
50
+ var _useIsTowmotive = require("../../__hooks__/useIsTowmotive");
50
51
  var _AddressLookupService = _interopRequireDefault(require("../../__services__/AddressLookupService"));
51
52
  var _LicensePlateValidator = _interopRequireDefault(require("../../__services__/LicensePlateValidator"));
52
53
  var _LocalStorageWorker = require("../../__services__/LocalStorageWorker");
@@ -207,7 +208,8 @@ const InternalAppointmentForm = _ref => {
207
208
  priceCalculationDate,
208
209
  selectedExtras,
209
210
  invoicePaymentByLeaseCompany,
210
- webshop
211
+ webshop,
212
+ vehicleCodingDiscountPercentage
211
213
  } = order;
212
214
  const [errors, setErrors] = (0, _react.useState)({});
213
215
  const [_licensePlate, _setLicensePlate] = (0, _react.useState)();
@@ -285,6 +287,7 @@ const InternalAppointmentForm = _ref => {
285
287
  } = (0, _queries.useBranchByIdOrWidgetId)(selectedBranch);
286
288
  const history = (0, _reactRouter.useHistory)();
287
289
  const formula = (0, _FormulaContext.useFormula)();
290
+ const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
288
291
  (0, _react.useEffect)(() => {
289
292
  (0, _ui.scrollToFirstErrorMessage)();
290
293
  }, [errors]);
@@ -405,22 +408,16 @@ const InternalAppointmentForm = _ref => {
405
408
  }), {}, {
406
409
  branchId: selectedBranch,
407
410
  selectBoardComputerUpdate: selectedBoardComputer != null,
408
- cart: (0, _product.validateCartInput)([{
409
- articleNumber: selectedCableset,
410
- quantity: 1
411
- }, {
412
- articleNumber: selectedCombiset,
413
- quantity: 1
414
- }, {
415
- articleNumber: selectedTowbar,
416
- quantity: 1
417
- }, ...Object.entries(selectedExtras).map(_ref3 => {
418
- let [extraArticleNumber, extraQuantity] = _ref3;
419
- return {
420
- articleNumber: extraArticleNumber,
421
- quantity: extraQuantity
422
- };
423
- }), ...selectedDiscountedProducts])
411
+ cart: (0, _product.buildCartInput)({
412
+ selectedCableset,
413
+ selectedCombiset,
414
+ selectedTowbar,
415
+ selectedBoardComputer,
416
+ selectedExtras,
417
+ selectedDiscountedProducts,
418
+ isTowmotiveFormula: isTowmotive,
419
+ vehicleCodingDiscountPercentage
420
+ })
424
421
  })));
425
422
  } catch (ex) {
426
423
  console.error("handleSubmit(): ".concat(ex));
@@ -678,12 +675,12 @@ const InternalAppointmentForm = _ref => {
678
675
  placeholder: "Maak een keuze",
679
676
  errorMessage: (errors === null || errors === void 0 ? void 0 : errors['channelType']) || (errors === null || errors === void 0 ? void 0 : errors['channelId']),
680
677
  initialValue: initialChannel,
681
- onChange: _ref4 => {
678
+ onChange: _ref3 => {
682
679
  var _value$kanaalType;
683
680
  let {
684
681
  label,
685
682
  value
686
- } = _ref4;
683
+ } = _ref3;
687
684
  return dispatch({
688
685
  type: _OrderSessionContext.orderSessionActions.SET_MARKETING_CHANNEL,
689
686
  payload: {
@@ -1331,10 +1328,10 @@ const InternalAppointmentForm = _ref => {
1331
1328
  placeholder: "Selecteer een land",
1332
1329
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['countryId'],
1333
1330
  initialValue: (countryOptions === null || countryOptions === void 0 ? void 0 : countryOptions.find(option => option.value === (customer === null || customer === void 0 ? void 0 : customer.countryId))) || null,
1334
- onChange: _ref5 => {
1331
+ onChange: _ref4 => {
1335
1332
  let {
1336
1333
  value
1337
- } = _ref5;
1334
+ } = _ref4;
1338
1335
  return dispatch({
1339
1336
  type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
1340
1337
  payload: {
@@ -1435,10 +1432,10 @@ const InternalAppointmentForm = _ref => {
1435
1432
  placeholder: "Selecteer een land",
1436
1433
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['countryId'],
1437
1434
  initialValue: (countryOptions === null || countryOptions === void 0 ? void 0 : countryOptions.find(option => option.value === (customer === null || customer === void 0 ? void 0 : customer.countryId))) || null,
1438
- onChange: _ref6 => {
1435
+ onChange: _ref5 => {
1439
1436
  let {
1440
1437
  value
1441
- } = _ref6;
1438
+ } = _ref5;
1442
1439
  return dispatch({
1443
1440
  type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
1444
1441
  payload: {
@@ -1553,10 +1550,10 @@ const InternalAppointmentForm = _ref => {
1553
1550
  placeholder: "Selecteer een land",
1554
1551
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['countryId'],
1555
1552
  initialValue: (countryOptions === null || countryOptions === void 0 ? void 0 : countryOptions.find(option => option.value === (customer === null || customer === void 0 ? void 0 : customer.countryId))) || null,
1556
- onChange: _ref7 => {
1553
+ onChange: _ref6 => {
1557
1554
  let {
1558
1555
  value
1559
- } = _ref7;
1556
+ } = _ref6;
1560
1557
  return dispatch({
1561
1558
  type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
1562
1559
  payload: {
@@ -43,6 +43,7 @@ var _helpers__ = require("../../__helpers__");
43
43
  var _product = require("../../__helpers__/product");
44
44
  var _ui = require("../../__helpers__/ui");
45
45
  var _useIsTmg = require("../../__hooks__/useIsTmg");
46
+ var _useIsTowmotive = require("../../__hooks__/useIsTowmotive");
46
47
  var _LicensePlateValidator = _interopRequireDefault(require("../../__services__/LicensePlateValidator"));
47
48
  var _LocalStorageWorker = require("../../__services__/LocalStorageWorker");
48
49
  var _InternalQuotationSuccessModal = _interopRequireDefault(require("./InternalQuotationSuccessModal"));
@@ -181,7 +182,8 @@ const InternalQuotationForm = _ref => {
181
182
  discountPercentage,
182
183
  selectedDiscountedProducts = [],
183
184
  channel,
184
- selectedExtras
185
+ selectedExtras,
186
+ vehicleCodingDiscountPercentage
185
187
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
186
188
  const [errors, setErrors] = (0, _react.useState)({});
187
189
  const [companySearchTerm, setCompanySearchTerm] = (0, _react.useState)('');
@@ -223,6 +225,7 @@ const InternalQuotationForm = _ref => {
223
225
  }
224
226
  }, [isTmg, marketingChannels, channel === null || channel === void 0 ? void 0 : channel.channelId, dispatch]);
225
227
  const formula = (0, _FormulaContext.useFormula)();
228
+ const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
226
229
  const {
227
230
  branchesByType,
228
231
  isLoadingBranchesByType
@@ -377,22 +380,16 @@ const InternalQuotationForm = _ref => {
377
380
  }), {}, {
378
381
  branchId: selectedBranch,
379
382
  selectBoardComputerUpdate: selectedBoardComputer != null,
380
- cart: (0, _product.validateCartInput)([{
381
- articleNumber: selectedCableset,
382
- quantity: 1
383
- }, {
384
- articleNumber: selectedCombiset,
385
- quantity: 1
386
- }, {
387
- articleNumber: selectedTowbar,
388
- quantity: 1
389
- }, ...Object.entries(selectedExtras).map(_ref3 => {
390
- let [extraArticleNumber, extraQuantity] = _ref3;
391
- return {
392
- articleNumber: extraArticleNumber,
393
- quantity: extraQuantity
394
- };
395
- }), ...selectedDiscountedProducts])
383
+ cart: (0, _product.buildCartInput)({
384
+ selectedCableset,
385
+ selectedCombiset,
386
+ selectedTowbar,
387
+ selectedBoardComputer,
388
+ selectedExtras,
389
+ selectedDiscountedProducts,
390
+ isTowmotiveFormula: isTowmotive,
391
+ vehicleCodingDiscountPercentage
392
+ })
396
393
  })));
397
394
  } catch (ex) {
398
395
  console.error("handleSubmit(): ".concat(ex));
@@ -521,12 +518,12 @@ const InternalQuotationForm = _ref => {
521
518
  placeholder: "Maak een keuze",
522
519
  errorMessage: (errors === null || errors === void 0 ? void 0 : errors['channelId']) || (errors === null || errors === void 0 ? void 0 : errors['channelType']),
523
520
  initialValue: initialChannel,
524
- onChange: _ref4 => {
521
+ onChange: _ref3 => {
525
522
  var _value$kanaalType;
526
523
  let {
527
524
  label,
528
525
  value
529
- } = _ref4;
526
+ } = _ref3;
530
527
  return dispatch({
531
528
  type: _OrderSessionContext.orderSessionActions.SET_MARKETING_CHANNEL,
532
529
  payload: {
@@ -134,6 +134,7 @@ const INITIAL_ORDER_SESSION_STATE = {
134
134
  singleOrderFormulaCode: null,
135
135
  franchiseName: null,
136
136
  customerAgreed: undefined,
137
+ vehicleCodingDiscountPercentage: null,
137
138
  vehicle: {
138
139
  ownershipType: _constants__.VEHICLE_OWNERSHIP_TYPE.Particulier,
139
140
  singleOrderOwnershipType: null,
@@ -243,7 +244,8 @@ const orderSessionActions = exports.orderSessionActions = {
243
244
  SET_CUSTOMER_KVK_NUMBER: 'SET_CUSTOMER_KVK_NUMBER',
244
245
  SET_CUSTOMER_VAT_NUMBER: 'SET_CUSTOMER_VAT_NUMBER',
245
246
  SET_CUSTOMER_HOUSE_NUMBER_ADDITION: 'SET_CUSTOMER_HOUSE_NUMBER_ADDITION',
246
- SET_CUSTOMER_INVOICE_PAYMENT_BY_LEASE_COMPANY: 'SET_CUSTOMER_INVOICE_PAYMENT_BY_LEASE_COMPANY'
247
+ SET_CUSTOMER_INVOICE_PAYMENT_BY_LEASE_COMPANY: 'SET_CUSTOMER_INVOICE_PAYMENT_BY_LEASE_COMPANY',
248
+ SET_VEHICLE_CODING_DISCOUNT_PERCENTAGE: 'SET_VEHICLE_CODING_DISCOUNT_PERCENTAGE'
247
249
  };
248
250
  const orderSessionReducer = (state, action) => {
249
251
  switch (action.type) {
@@ -290,6 +292,7 @@ const orderSessionReducer = (state, action) => {
290
292
  }
291
293
  case orderSessionActions.INITIALIZE_EXISTING_ORDER:
292
294
  {
295
+ var _existingOrder$vehicl;
293
296
  const {
294
297
  existingOrder,
295
298
  existingDossierId,
@@ -298,7 +301,8 @@ const orderSessionReducer = (state, action) => {
298
301
  return _objectSpread(_objectSpread({}, existingOrder), {}, {
299
302
  isTouched: true,
300
303
  existingDossierId,
301
- existingDossierType
304
+ existingDossierType,
305
+ vehicleCodingDiscountPercentage: (_existingOrder$vehicl = existingOrder === null || existingOrder === void 0 ? void 0 : existingOrder.vehicleCodingDiscountPercentage) !== null && _existingOrder$vehicl !== void 0 ? _existingOrder$vehicl : null
302
306
  });
303
307
  }
304
308
  case orderSessionActions.SET_CUSTOMER_COUNTRY_ID:
@@ -816,6 +820,16 @@ const orderSessionReducer = (state, action) => {
816
820
  })
817
821
  });
818
822
  }
823
+ case orderSessionActions.SET_VEHICLE_CODING_DISCOUNT_PERCENTAGE:
824
+ {
825
+ const {
826
+ percentage
827
+ } = action.payload;
828
+ return _objectSpread(_objectSpread({}, state), {}, {
829
+ vehicleCodingDiscountPercentage: percentage,
830
+ isTouched: true
831
+ });
832
+ }
819
833
  case orderSessionActions.SET_APPOINTMENT_TIME:
820
834
  {
821
835
  const {
@@ -13,7 +13,7 @@ require("core-js/modules/web.dom-collections.iterator.js");
13
13
  Object.defineProperty(exports, "__esModule", {
14
14
  value: true
15
15
  });
16
- exports.validateCartInput = exports.parseProductSpecifications = exports.formatHyperDescription = exports.extractProductSpecsArray = exports.checkIfTowbarIsRecommended = void 0;
16
+ exports.validateCartInput = exports.parseProductSpecifications = exports.formatHyperDescription = exports.extractProductSpecsArray = exports.checkIfTowbarIsRecommended = exports.buildCartInput = void 0;
17
17
  require("core-js/modules/es.array.flat-map.js");
18
18
  require("core-js/modules/es.array.includes.js");
19
19
  require("core-js/modules/es.array.unscopables.flat-map.js");
@@ -25,6 +25,49 @@ require("core-js/modules/esnext.iterator.for-each.js");
25
25
  require("core-js/modules/esnext.iterator.map.js");
26
26
  require("core-js/modules/web.dom-collections.iterator.js");
27
27
  var _constants__ = require("../__constants__");
28
+ function ownKeys(e, r) {
29
+ var t = Object.keys(e);
30
+ if (Object.getOwnPropertySymbols) {
31
+ var o = Object.getOwnPropertySymbols(e);
32
+ r && (o = o.filter(function (r) {
33
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
34
+ })), t.push.apply(t, o);
35
+ }
36
+ return t;
37
+ }
38
+ function _objectSpread(e) {
39
+ for (var r = 1; r < arguments.length; r++) {
40
+ var t = null != arguments[r] ? arguments[r] : {};
41
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
42
+ _defineProperty(e, r, t[r]);
43
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
44
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
45
+ });
46
+ }
47
+ return e;
48
+ }
49
+ function _defineProperty(e, r, t) {
50
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
51
+ value: t,
52
+ enumerable: !0,
53
+ configurable: !0,
54
+ writable: !0
55
+ }) : e[r] = t, e;
56
+ }
57
+ function _toPropertyKey(t) {
58
+ var i = _toPrimitive(t, "string");
59
+ return "symbol" == typeof i ? i : i + "";
60
+ }
61
+ function _toPrimitive(t, r) {
62
+ if ("object" != typeof t || !t) return t;
63
+ var e = t[Symbol.toPrimitive];
64
+ if (void 0 !== e) {
65
+ var i = e.call(t, r || "default");
66
+ if ("object" != typeof i) return i;
67
+ throw new TypeError("@@toPrimitive must return a primitive value.");
68
+ }
69
+ return ("string" === r ? String : Number)(t);
70
+ }
28
71
  /**
29
72
  * @description Extracts Specs from a product object by omitting "system" fields
30
73
  */
@@ -54,15 +97,53 @@ const validateCartInput = exports.validateCartInput = function validateCartInput
54
97
  return;
55
98
  };
56
99
 
100
+ /**
101
+ * @description Builds the cart input including optional TowMotive vehicle coding discount
102
+ */
103
+ const buildCartInput = _ref3 => {
104
+ let {
105
+ selectedCableset,
106
+ selectedCombiset,
107
+ selectedTowbar,
108
+ selectedBoardComputer,
109
+ selectedExtras = {},
110
+ selectedDiscountedProducts = [],
111
+ isTowmotiveFormula = false,
112
+ vehicleCodingDiscountPercentage = null
113
+ } = _ref3;
114
+ return validateCartInput([{
115
+ articleNumber: selectedCableset,
116
+ quantity: 1
117
+ }, {
118
+ articleNumber: selectedCombiset,
119
+ quantity: 1
120
+ }, {
121
+ articleNumber: selectedTowbar,
122
+ quantity: 1
123
+ }, ...(selectedBoardComputer ? [_objectSpread({
124
+ articleNumber: selectedBoardComputer,
125
+ quantity: 1
126
+ }, isTowmotiveFormula && vehicleCodingDiscountPercentage !== null && vehicleCodingDiscountPercentage !== undefined ? {
127
+ consumerDiscountPercentage: vehicleCodingDiscountPercentage
128
+ } : {})] : []), ...Object.entries(selectedExtras).map(_ref4 => {
129
+ let [extraArticleNumber, extraQuantity] = _ref4;
130
+ return {
131
+ articleNumber: extraArticleNumber,
132
+ quantity: extraQuantity
133
+ };
134
+ }), ...selectedDiscountedProducts]);
135
+ };
136
+
57
137
  /**
58
138
  * @description Checks if a product is recommended, by checking if it both a towbar and is detachable
59
139
  */
60
- const checkIfTowbarIsRecommended = _ref3 => {
140
+ exports.buildCartInput = buildCartInput;
141
+ const checkIfTowbarIsRecommended = _ref5 => {
61
142
  var _product$subgroupName;
62
143
  let {
63
144
  product,
64
145
  category
65
- } = _ref3;
146
+ } = _ref5;
66
147
  return category === _constants__.PRODUCT_CATEGORIES.TOWBAR && ((product === null || product === void 0 ? void 0 : product.subgroupName.toLowerCase().includes('afneembaar')) || (product === null || product === void 0 || (_product$subgroupName = product.subgroupName) === null || _product$subgroupName === void 0 ? void 0 : _product$subgroupName.toLowerCase().includes('afneembare')));
67
148
  };
68
149
 
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useIsTowmotive = void 0;
7
+ var _react = require("react");
8
+ var _queries = require("../__api__/queries");
9
+ var _constants__ = require("../__constants__");
10
+ var _useAuthSession = require("./useAuthSession");
11
+ const useIsTowmotive = exports.useIsTowmotive = function useIsTowmotive() {
12
+ let internal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
13
+ const {
14
+ branchTypes
15
+ } = (0, _queries.useBranchTypes)() || {};
16
+ const session = (0, _useAuthSession.useAuthSession)();
17
+ return (0, _react.useMemo)(() => {
18
+ if ((session === null || session === void 0 ? void 0 : session.formula) !== _constants__.BRANCH_FORMULAS.TowMotive) {
19
+ return false;
20
+ }
21
+ return true;
22
+ }, [session === null || session === void 0 ? void 0 : session.formula]);
23
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.258",
3
+ "version": "0.0.261",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",