thm-p3-configurator 0.0.86 → 0.0.87

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.VEHICLE_OWNERSHIP_TYPE = exports.USER_GEOLOCATION_KEY = exports.TMG_ORGANIZATION_TYPE = exports.StockStatus = exports.PRODUCT_CATEGORIES = exports.PRIVATE_SINGLE_ORDER_SESSION_KEY = exports.ORDER_SESSION_KEY = 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.FORM_ERROR_MESSAGES = exports.DOSSIER_TYPES = exports.DISCOUNT_TYPES = exports.DEFAULT_MAP_LONGITUDE = exports.DEFAULT_MAP_LATITUDE = exports.DEFAULT_ARTICLE_BRAND = exports.CONFIGURATOR_FORMULAS = exports.BOARD_COMPUTER_DISABLED_KEY = exports.AUTH_SESSION_KEY = exports.ARTICLES_SYSTEM_FIELDS = exports.API_ERROR_CODES = exports.ANWB_DISCOUNT_CODE = exports.ALL_EXPERIMENTS = exports.ACTIVE_VARIANTS = void 0;
6
+ exports.VESTIGING_TYPE_ID = exports.VEHICLE_OWNERSHIP_TYPE = exports.USER_GEOLOCATION_KEY = exports.TMG_ORGANIZATION_TYPE = exports.StockStatus = exports.PRODUCT_CATEGORIES = exports.PRIVATE_SINGLE_ORDER_SESSION_KEY = exports.ORDER_SESSION_KEY = 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.FORM_ERROR_MESSAGES = exports.DOSSIER_TYPES = exports.DISCOUNT_TYPES = exports.DEFAULT_MAP_LONGITUDE = exports.DEFAULT_MAP_LATITUDE = exports.DEFAULT_ARTICLE_BRAND = exports.CONFIGURATOR_FORMULAS = exports.BOARD_COMPUTER_DISABLED_KEY = exports.AUTH_SESSION_KEY = 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',
@@ -18,6 +18,7 @@ const FORM_ERROR_MESSAGES = exports.FORM_ERROR_MESSAGES = {
18
18
  licensePlateMin: 'Kenteken moet minimaal 6 characters bevatten',
19
19
  licensePlateMax: 'Kenteken mag maximaal 8 characters bevatten'
20
20
  };
21
+ const VESTIGING_TYPE_ID = exports.VESTIGING_TYPE_ID = 'kyDouClQsfmXWWloLdwzG';
21
22
  const NAVIGATION_STEPS_INTERNAL = exports.NAVIGATION_STEPS_INTERNAL = [{
22
23
  to: '/configurator/trekhaakpakket',
23
24
  title: '1. Trekhaakpakket',
@@ -93,6 +93,7 @@ const BottomNavigationBar = () => {
93
93
  selectedCombiset,
94
94
  selectedBranch,
95
95
  existingDossierType,
96
+ existingDossierId,
96
97
  allowLocationChange,
97
98
  currentDossierType
98
99
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
@@ -114,7 +115,7 @@ const BottomNavigationBar = () => {
114
115
  }, APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement("div", {
115
116
  className: (0, _helpers__.withStyle)('col-12 mt-2 mb-1')
116
117
  }, /*#__PURE__*/_react.default.createElement(_InternalPriceCalculationSelector.default, null)), buttons.map(_ref2 => {
117
- var _history$location3, _history$location4;
118
+ var _history$location3;
118
119
  let {
119
120
  to,
120
121
  label,
@@ -154,7 +155,7 @@ const BottomNavigationBar = () => {
154
155
  state: {
155
156
  prevPathName: history.location.pathname
156
157
  },
157
- isDisabled: !(existingDossierType === _constants__.DOSSIER_TYPES.Quotation && (history === null || history === void 0 || (_history$location3 = history.location) === null || _history$location3 === void 0 ? void 0 : _history$location3.pathname) === '/configurator/montagelocatie') && ((!selectedCableset || !selectedTowbar) && !selectedCombiset && type === 'next' || type === 'next' && (history === null || history === void 0 || (_history$location4 = history.location) === null || _history$location4 === void 0 ? void 0 : _history$location4.pathname) === '/configurator/montagelocatie' && !selectedBranch)
158
+ isDisabled: (!selectedCableset || !selectedTowbar) && !selectedCombiset && type === 'next' || type === 'next' && (history === null || history === void 0 || (_history$location3 = history.location) === null || _history$location3 === void 0 ? void 0 : _history$location3.pathname) === '/configurator/montagelocatie' && !selectedBranch
158
159
  })));
159
160
  })))));
160
161
  };
@@ -3,6 +3,7 @@
3
3
  require("core-js/modules/es.json.stringify.js");
4
4
  require("core-js/modules/es.weak-map.js");
5
5
  require("core-js/modules/esnext.iterator.constructor.js");
6
+ require("core-js/modules/esnext.iterator.filter.js");
6
7
  require("core-js/modules/esnext.iterator.for-each.js");
7
8
  require("core-js/modules/esnext.iterator.map.js");
8
9
  require("core-js/modules/web.dom-collections.iterator.js");
@@ -13,6 +14,7 @@ Object.defineProperty(exports, "__esModule", {
13
14
  exports.default = void 0;
14
15
  require("core-js/modules/es.json.stringify.js");
15
16
  require("core-js/modules/esnext.iterator.constructor.js");
17
+ require("core-js/modules/esnext.iterator.filter.js");
16
18
  require("core-js/modules/esnext.iterator.for-each.js");
17
19
  require("core-js/modules/esnext.iterator.map.js");
18
20
  require("core-js/modules/web.dom-collections.iterator.js");
@@ -63,11 +65,11 @@ const NormalPageModalContent = _ref => {
63
65
  isLocation,
64
66
  selectedBranch,
65
67
  existingDossierId,
68
+ formula,
66
69
  dispatch
67
70
  } = _ref;
68
71
  const [_selectedBranchId, _setSelectedBranchId] = (0, _react.useState)();
69
72
  const [_branches, _setBranches] = (0, _react.useState)([]);
70
- const formula = (0, _FormulaContext.useFormula)();
71
73
  const {
72
74
  myBranches,
73
75
  isLoadingMyBranches
@@ -132,7 +134,8 @@ const SingleOrderModalContent = _ref3 => {
132
134
  authSession,
133
135
  selectedBranch,
134
136
  dispatch,
135
- isTMGOrganization
137
+ isTMGOrganization,
138
+ formula
136
139
  } = _ref3;
137
140
  const [singleOrderBranchType, setSingleOrderBranchType] = (0, _react.useState)();
138
141
  const [selectedBranchId, setLocalBranchId] = (0, _react.useState)();
@@ -144,14 +147,25 @@ const SingleOrderModalContent = _ref3 => {
144
147
  singleOrderBranches,
145
148
  isLoadingSingleOrderBranches
146
149
  } = (0, _queries.useSingleOrderBranchesQuery)({
147
- branchTypeId: singleOrderBranchType,
150
+ branchTypeId: formula === _constants__.CONFIGURATOR_FORMULAS.TMG ? singleOrderBranchType : _constants__.VESTIGING_TYPE_ID,
148
151
  limit: 500,
149
152
  offset: 0
150
153
  });
154
+
155
+ // Filter branches based on formula if not TMG
156
+ const filteredBranches = _react.default.useMemo(() => {
157
+ if (formula === _constants__.CONFIGURATOR_FORMULAS.TMG || !singleOrderBranches) {
158
+ return singleOrderBranches;
159
+ }
160
+ return singleOrderBranches.filter(branch => {
161
+ var _branch$formule;
162
+ return (branch === null || branch === void 0 || (_branch$formule = branch.formule) === null || _branch$formule === void 0 ? void 0 : _branch$formule.code) === formula;
163
+ });
164
+ }, [singleOrderBranches, formula]);
151
165
  const branchIdWithFormulaCode = new Map();
152
- singleOrderBranches === null || singleOrderBranches === void 0 || singleOrderBranches.forEach(branch => {
153
- var _branch$formule$code, _branch$formule;
154
- 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);
166
+ filteredBranches === null || filteredBranches === void 0 || filteredBranches.forEach(branch => {
167
+ var _branch$formule$code, _branch$formule2;
168
+ branchIdWithFormulaCode.set(branch === null || branch === void 0 ? void 0 : branch.entityId, (_branch$formule$code = branch === null || branch === void 0 || (_branch$formule2 = branch.formule) === null || _branch$formule2 === void 0 ? void 0 : _branch$formule2.code) !== null && _branch$formule$code !== void 0 ? _branch$formule$code : _constants__.CONFIGURATOR_FORMULAS.THC);
155
169
  });
156
170
  (0, _react.useEffect)(() => {
157
171
  if (isLocation && !selectedBranch && !isTMGOrganization) {
@@ -164,7 +178,7 @@ const SingleOrderModalContent = _ref3 => {
164
178
  });
165
179
  }
166
180
  }, [dispatch, isLocation, authSession, selectedBranch, isTMGOrganization]);
167
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
181
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, formula === _constants__.CONFIGURATOR_FORMULAS.TMG && /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
168
182
  options: singleOrderBranchTypes === null || singleOrderBranchTypes === void 0 ? void 0 : singleOrderBranchTypes.map(branchType => ({
169
183
  label: branchType === null || branchType === void 0 ? void 0 : branchType.title,
170
184
  value: branchType === null || branchType === void 0 ? void 0 : branchType.entityId
@@ -185,8 +199,8 @@ const SingleOrderModalContent = _ref3 => {
185
199
  setSelectedBranchId(undefined);
186
200
  setLocalBranchId(undefined);
187
201
  }
188
- }), singleOrderBranchType && /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
189
- options: singleOrderBranches === null || singleOrderBranches === void 0 ? void 0 : singleOrderBranches.map(branch => ({
202
+ }), (formula === _constants__.CONFIGURATOR_FORMULAS.TMG ? singleOrderBranchType : true) && /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
203
+ options: filteredBranches === null || filteredBranches === void 0 ? void 0 : filteredBranches.map(branch => ({
190
204
  label: branch === null || branch === void 0 ? void 0 : branch.name,
191
205
  value: branch === null || branch === void 0 ? void 0 : branch.entityId
192
206
  })),
@@ -221,6 +235,7 @@ const InternalBranchSelectorModal = () => {
221
235
  const [_selectedBranchId, _setSelectedBranchId] = (0, _react.useState)();
222
236
  const authSession = _LocalStorageWorker.lsw.getJson(_constants__.AUTH_SESSION_KEY);
223
237
  const isSingleOrderPage = (0, _useIsSingleOrder.default)();
238
+ const formula = (0, _FormulaContext.useFormula)();
224
239
  const isTMGOrganization = _react.default.useMemo(() => {
225
240
  var _branchTypes$byId$aut, _authSession$branch2;
226
241
  return (branchTypes === null || branchTypes === void 0 || (_branchTypes$byId$aut = branchTypes.byId[authSession === null || authSession === void 0 || (_authSession$branch2 = authSession.branch) === null || _authSession$branch2 === void 0 || (_authSession$branch2 = _authSession$branch2.organisatietype) === null || _authSession$branch2 === void 0 ? void 0 : _authSession$branch2[0]]) === null || _branchTypes$byId$aut === void 0 ? void 0 : _branchTypes$byId$aut.title) === _constants__.TMG_ORGANIZATION_TYPE;
@@ -262,7 +277,8 @@ const InternalBranchSelectorModal = () => {
262
277
  authSession: authSession,
263
278
  selectedBranch: selectedBranch,
264
279
  dispatch: dispatch,
265
- isTMGOrganization: isTMGOrganization
280
+ isTMGOrganization: isTMGOrganization,
281
+ formula: formula
266
282
  }) : /*#__PURE__*/_react.default.createElement(NormalPageModalContent, {
267
283
  setSelectedBranchId: _setSelectedBranchId,
268
284
  isTMGOrganization: isTMGOrganization,
@@ -270,7 +286,8 @@ const InternalBranchSelectorModal = () => {
270
286
  authSession: authSession,
271
287
  selectedBranch: selectedBranch,
272
288
  existingDossierId: existingDossierId,
273
- dispatch: dispatch
289
+ dispatch: dispatch,
290
+ formula: formula
274
291
  }));
275
292
  };
276
293
  var _default = exports.default = InternalBranchSelectorModal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.86",
3
+ "version": "0.0.87",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",