thm-p3-configurator 0.0.20 → 0.0.24

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.
Files changed (28) hide show
  1. package/dist/index.js +6 -13
  2. package/dist/src/shared/App.js +1 -1
  3. package/dist/src/shared/__api__/queries.js +7 -5
  4. package/dist/src/shared/__components__/LocationsSelector/LocationClusteredTreeMarkers.js +1 -1
  5. package/dist/src/shared/__components__/LocationsSelector/LocationList.js +2 -2
  6. package/dist/src/shared/__components__/LocationsSelector/LocationTreeMarker.js +2 -2
  7. package/dist/src/shared/__components__/LocationsSelector/index.js +10 -3
  8. package/dist/src/shared/__containers__/ANWBMembershipInput.js +5 -4
  9. package/dist/src/shared/__containers__/AppointmentForm.js +6 -5
  10. package/dist/src/shared/__containers__/DiscountProductsSelector.js +4 -9
  11. package/dist/src/shared/__containers__/ExitIntentModal.js +6 -5
  12. package/dist/src/shared/__containers__/ProductDiscountCard.js +4 -8
  13. package/dist/src/shared/__containers__/ProductsOverview.js +4 -3
  14. package/dist/src/shared/__containers__/QuestionsForm.js +125 -58
  15. package/dist/src/shared/__containers__/QuotationForm.js +6 -5
  16. package/dist/src/shared/__containers__/VehicleData.js +4 -3
  17. package/dist/src/shared/__containers__/internal/InternalAppointmentForm.js +7 -7
  18. package/dist/src/shared/__containers__/internal/InternalQuotationForm.js +6 -6
  19. package/dist/src/shared/__context__/OrderSessionContext.js +85 -11
  20. package/dist/src/shared/__pages__/LicensePlatePage.js +11 -1
  21. package/dist/src/shared/__pages__/LocationsPage.js +2 -50
  22. package/dist/src/shared/__pages__/ManualSelectionPage.js +11 -1
  23. package/dist/src/shared/__pages__/NoProductsPage.js +2 -2
  24. package/dist/src/shared/__pages__/index.js +10 -11
  25. package/dist/src/shared/__pages__/internal/InternalLocationsPage.js +3 -1
  26. package/dist/src/shared/__pages__/internal/InternalNoProductsPage.js +90 -0
  27. package/dist/src/shared/__pages__/internal/index.js +7 -0
  28. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -57,6 +57,12 @@ Object.defineProperty(exports, "InternalManualSelectionPage", {
57
57
  return _index.InternalManualSelectionPage;
58
58
  }
59
59
  });
60
+ Object.defineProperty(exports, "InternalNoProductsPage", {
61
+ enumerable: true,
62
+ get: function get() {
63
+ return _index.InternalNoProductsPage;
64
+ }
65
+ });
60
66
  Object.defineProperty(exports, "InternalOverviewPage", {
61
67
  enumerable: true,
62
68
  get: function get() {
@@ -75,18 +81,6 @@ Object.defineProperty(exports, "InternalQuotationPage", {
75
81
  return _index.InternalQuotationPage;
76
82
  }
77
83
  });
78
- Object.defineProperty(exports, "NoProductsPage", {
79
- enumerable: true,
80
- get: function get() {
81
- return _NoProductsPage.NoProductsPage;
82
- }
83
- });
84
- Object.defineProperty(exports, "NotFoundPage", {
85
- enumerable: true,
86
- get: function get() {
87
- return _NoProductsPage.NotFoundPage;
88
- }
89
- });
90
84
  Object.defineProperty(exports, "OrderSessionController", {
91
85
  enumerable: true,
92
86
  get: function get() {
@@ -153,7 +147,6 @@ var _ActiveMarkerContext = require("./src/shared/__context__/ActiveMarkerContext
153
147
  var _CountryContext = require("./src/shared/__context__/CountryContext.js");
154
148
  var _FormulaContext = require("./src/shared/__context__/FormulaContext.js");
155
149
  var _OrderSessionContext = require("./src/shared/__context__/OrderSessionContext.js");
156
- var _NoProductsPage = require("./src/shared/__pages__/NoProductsPage.js");
157
150
  var _index = require("./src/shared/__pages__/internal/index.js");
158
151
  var _mainModule = _interopRequireDefault(require("./src/shared/__style__/main.module.scss"));
159
152
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -16,7 +16,7 @@ var _reactQuery = require("react-query");
16
16
  var _reactRouterDom = require("react-router-dom");
17
17
  var _Navbar = _interopRequireDefault(require("./__components__/Navbar"));
18
18
  var _constants__ = require("./__constants__");
19
- var _InternalBranchSelectorModal = _interopRequireDefault(require("./__containers__/Internal/InternalBranchSelectorModal"));
19
+ var _InternalBranchSelectorModal = _interopRequireDefault(require("./__containers__/internal/InternalBranchSelectorModal"));
20
20
  var _SentryWrapper = _interopRequireDefault(require("./__containers__/SentryWrapper"));
21
21
  var _StyleWrapper = _interopRequireDefault(require("./__containers__/StyleWrapper"));
22
22
  var _ActiveMarkerContext = require("./__context__/ActiveMarkerContext");
@@ -171,7 +171,7 @@ const useProductsQuery = orderParameters => {
171
171
  */
172
172
  exports.useProductsQuery = useProductsQuery;
173
173
  const useQuestionsQuery = questionParams => {
174
- var _questionsQuery$error, _questionsQuery$data$, _questionsQuery$data, _questionsQuery$data$2, _questionsQuery$data2;
174
+ var _questionsQuery$error, _questionsQuery$data$, _questionsQuery$data, _questionsQuery$data$2, _questionsQuery$data2, _questionsQuery$data$3, _questionsQuery$data3;
175
175
  const {
176
176
  licensePlate,
177
177
  model
@@ -180,10 +180,11 @@ const useQuestionsQuery = questionParams => {
180
180
  const questionsQuery = (0, _reactQuery.useQuery)(['questions', questionsParamsString], {
181
181
  enabled: (licensePlate === null || licensePlate === void 0 ? void 0 : licensePlate.length) > 5 || !!(model !== null && model !== void 0 && model.length),
182
182
  queryFn: () => _orderApi.orderApi.getOrder(questionsParamsString).then(res => {
183
- var _res$data5, _res$data$data$execut, _res$data6;
183
+ var _res$data5, _res$data6, _res$data7;
184
184
  return {
185
185
  durationQuestion: (0, _helpers__.parseArrayToInputOptions)(res === null || res === void 0 || (_res$data5 = res.data) === null || _res$data5 === void 0 || (_res$data5 = _res$data5.data) === null || _res$data5 === void 0 ? void 0 : _res$data5.durationAnswerOptions),
186
- questions: Object.values((_res$data$data$execut = res === null || res === void 0 || (_res$data6 = res.data) === null || _res$data6 === void 0 || (_res$data6 = _res$data6.data) === null || _res$data6 === void 0 ? void 0 : _res$data6.executionAnswerOptions) !== null && _res$data$data$execut !== void 0 ? _res$data$data$execut : {}).map(answersSet => (0, _helpers__.parseArrayToInputOptions)(answersSet))
186
+ execution1AnswerOptions: (0, _helpers__.parseArrayToInputOptions)(res === null || res === void 0 || (_res$data6 = res.data) === null || _res$data6 === void 0 || (_res$data6 = _res$data6.data) === null || _res$data6 === void 0 || (_res$data6 = _res$data6.executionAnswerOptions) === null || _res$data6 === void 0 ? void 0 : _res$data6.execution1AnswerOptions),
187
+ execution2AnswerOptions: (0, _helpers__.parseArrayToInputOptions)(res === null || res === void 0 || (_res$data7 = res.data) === null || _res$data7 === void 0 || (_res$data7 = _res$data7.data) === null || _res$data7 === void 0 || (_res$data7 = _res$data7.executionAnswerOptions) === null || _res$data7 === void 0 ? void 0 : _res$data7.execution2AnswerOptions)
187
188
  };
188
189
  })
189
190
  });
@@ -191,8 +192,9 @@ const useQuestionsQuery = questionParams => {
191
192
  isLoadingQuestions: questionsQuery.isFetching,
192
193
  isQuestionsError: questionsQuery.isError,
193
194
  questionsError: ((_questionsQuery$error = questionsQuery.error) === null || _questionsQuery$error === void 0 || (_questionsQuery$error = _questionsQuery$error.response) === null || _questionsQuery$error === void 0 || (_questionsQuery$error = _questionsQuery$error.data) === null || _questionsQuery$error === void 0 ? void 0 : _questionsQuery$error.code) || questionsQuery.error,
194
- questions: (_questionsQuery$data$ = questionsQuery === null || questionsQuery === void 0 || (_questionsQuery$data = questionsQuery.data) === null || _questionsQuery$data === void 0 ? void 0 : _questionsQuery$data.questions) !== null && _questionsQuery$data$ !== void 0 ? _questionsQuery$data$ : [],
195
- durationQuestion: (_questionsQuery$data$2 = questionsQuery === null || questionsQuery === void 0 || (_questionsQuery$data2 = questionsQuery.data) === null || _questionsQuery$data2 === void 0 ? void 0 : _questionsQuery$data2.durationQuestion) !== null && _questionsQuery$data$2 !== void 0 ? _questionsQuery$data$2 : []
195
+ execution1AnswerOptions: (_questionsQuery$data$ = questionsQuery === null || questionsQuery === void 0 || (_questionsQuery$data = questionsQuery.data) === null || _questionsQuery$data === void 0 ? void 0 : _questionsQuery$data.execution1AnswerOptions) !== null && _questionsQuery$data$ !== void 0 ? _questionsQuery$data$ : [],
196
+ execution2AnswerOptions: (_questionsQuery$data$2 = questionsQuery === null || questionsQuery === void 0 || (_questionsQuery$data2 = questionsQuery.data) === null || _questionsQuery$data2 === void 0 ? void 0 : _questionsQuery$data2.execution2AnswerOptions) !== null && _questionsQuery$data$2 !== void 0 ? _questionsQuery$data$2 : [],
197
+ durationQuestion: (_questionsQuery$data$3 = questionsQuery === null || questionsQuery === void 0 || (_questionsQuery$data3 = questionsQuery.data) === null || _questionsQuery$data3 === void 0 ? void 0 : _questionsQuery$data3.durationQuestion) !== null && _questionsQuery$data$3 !== void 0 ? _questionsQuery$data$3 : []
196
198
  };
197
199
  };
198
200
 
@@ -194,7 +194,7 @@ const LocationClusteredTreeMarkers = _ref => {
194
194
  }, [setActiveMarkerId, dispatch]);
195
195
  const memoizedTreeMarkers = (0, _react.useMemo)(() => {
196
196
  return trees.map(tree => /*#__PURE__*/_react.default.createElement(_LocationTreeMarker.default, {
197
- key: tree.entityId,
197
+ key: tree === null || tree === void 0 ? void 0 : tree.entityId,
198
198
  tree: tree,
199
199
  onClick: handleMarkerClick,
200
200
  setMarkerRef: setMarkerRef
@@ -149,13 +149,13 @@ const LocationList = _ref => {
149
149
  return a.distance - b.distance;
150
150
  });
151
151
  (0, _react.useEffect)(() => {
152
- if (selectedRef.current) {
152
+ if (sortedLocations !== null && sortedLocations !== void 0 && sortedLocations.length && selectedRef.current) {
153
153
  selectedRef.current.scrollIntoView({
154
154
  behavior: 'smooth',
155
155
  block: 'center'
156
156
  });
157
157
  }
158
- }, [activeMarkerId, selectedBranch]);
158
+ }, [activeMarkerId, selectedBranch, sortedLocations]);
159
159
  return /*#__PURE__*/_react.default.createElement("div", {
160
160
  className: (0, _helpers__.withStyle)('dealer-list')
161
161
  }, /*#__PURE__*/_react.default.createElement("h5", null, userLocation ? 'Dichtsbijzijnde montagelocaties' : 'Montagelocaties'), isLoading && /*#__PURE__*/_react.default.createElement(LocationsLoading, null), !isLoading && !locationIds.length && /*#__PURE__*/_react.default.createElement(NoLocationFound, null), sortedLocations.map(location => /*#__PURE__*/_react.default.createElement(_LocationListItem.default, {
@@ -50,8 +50,8 @@ const LocationTreeMarker = props => {
50
50
  setMarkerRef
51
51
  } = props;
52
52
  const handleClick = (0, _react.useCallback)(() => onClick(tree), [onClick, tree]);
53
- const ref = (0, _react.useCallback)(marker => setMarkerRef(marker, tree.entityId), [setMarkerRef, tree.entityId]);
54
- const coordinates = tree.googleMapsLocation;
53
+ 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]);
54
+ const coordinates = tree === null || tree === void 0 ? void 0 : tree.googleMapsLocation;
55
55
  if (!coordinates) {
56
56
  return null;
57
57
  }
@@ -12,6 +12,7 @@ var _reactGoogleMaps = require("@vis.gl/react-google-maps");
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
  var _queries = require("../../__api__/queries");
14
14
  var _FormulaContext = require("../../__context__/FormulaContext");
15
+ var _OrderSessionContext = require("../../__context__/OrderSessionContext");
15
16
  var _helpers__ = require("../../__helpers__");
16
17
  var _useBreakpoint = _interopRequireDefault(require("../../__hooks__/useBreakpoint"));
17
18
  var _useUserLocation = _interopRequireDefault(require("../../__hooks__/useUserLocation"));
@@ -62,12 +63,16 @@ const LocationsSelector = /*#__PURE__*/_react.default.memo(() => {
62
63
  const isDesktop = screen.size >= 1200;
63
64
  const [visibleIds, setVisibleIds] = (0, _react.useState)([]);
64
65
  const formula = (0, _FormulaContext.useFormula)();
66
+ const [{
67
+ franchiseName
68
+ }] = (0, _OrderSessionContext.useOrderSession)();
65
69
  const {
66
70
  branches: locations
67
71
  } = (0, _queries.useBranchesQuery)({
68
72
  offset: 0,
69
- limit: 200,
70
- formula
73
+ limit: 400,
74
+ formula,
75
+ franchiseName
71
76
  });
72
77
  const {
73
78
  byId,
@@ -115,7 +120,9 @@ const LocationsSelector = /*#__PURE__*/_react.default.memo(() => {
115
120
  className: "".concat((0, _helpers__.withStyle)('dealer-sidebar col-xl-4 mt-3 mt-xl-0'))
116
121
  }, isDesktop && /*#__PURE__*/_react.default.createElement(_LocationAutoComplete.default, {
117
122
  setUserLocation: setUserLocation
118
- }), /*#__PURE__*/_react.default.createElement(_LocationList.default, {
123
+ }), franchiseName && /*#__PURE__*/_react.default.createElement("h6", {
124
+ className: (0, _helpers__.withStyle)('my-2')
125
+ }, "Keten: ", franchiseName), /*#__PURE__*/_react.default.createElement(_LocationList.default, {
119
126
  locationIds: visibleIds,
120
127
  locationsById: byId,
121
128
  userLocation: userLocation
@@ -56,14 +56,15 @@ const ANWBMembershipValidator = () => {
56
56
  customer,
57
57
  licensePlate,
58
58
  model,
59
- answers,
60
59
  durationAnswer,
61
60
  selectedBoardComputer,
62
61
  selectedDiscountedProducts = [],
63
62
  selectedCableset,
64
63
  selectedCombiset,
65
64
  selectedTowbar,
66
- discountCode
65
+ discountCode,
66
+ executionAnswer1,
67
+ executionAnswer2
67
68
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
68
69
  const [isNumberValid, setIsNumberValid] = (0, _react.useState)();
69
70
  const formula = (0, _FormulaContext.useFormula)();
@@ -82,8 +83,8 @@ const ANWBMembershipValidator = () => {
82
83
  } = (0, _queries.useProductsQuery)({
83
84
  licensePlate,
84
85
  model,
85
- executionAnswer1: answers === null || answers === void 0 ? void 0 : answers['0'],
86
- executionAnswer2: answers === null || answers === void 0 ? void 0 : answers['1'],
86
+ executionAnswer1,
87
+ executionAnswer2,
87
88
  durationAnswer: durationAnswer,
88
89
  selectBoardComputerUpdate: selectedBoardComputer != null,
89
90
  cart: cartInput ? JSON.stringify(cartInput) : undefined,
@@ -123,7 +123,6 @@ const AppointmentForm = () => {
123
123
  customer,
124
124
  licensePlate,
125
125
  model,
126
- answers,
127
126
  durationAnswer,
128
127
  selectedBoardComputer,
129
128
  selectedCableset,
@@ -131,6 +130,8 @@ const AppointmentForm = () => {
131
130
  selectedTowbar,
132
131
  selectedBranch,
133
132
  discountCode,
133
+ executionAnswer1,
134
+ executionAnswer2,
134
135
  selectedDiscountedProducts = []
135
136
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
136
137
  const [errors, setErrors] = (0, _react.useState)({});
@@ -149,8 +150,8 @@ const AppointmentForm = () => {
149
150
  } = (0, _queries.useProductsQuery)({
150
151
  licensePlate,
151
152
  model,
152
- executionAnswer1: answers === null || answers === void 0 ? void 0 : answers['0'],
153
- executionAnswer2: answers === null || answers === void 0 ? void 0 : answers['1'],
153
+ executionAnswer1,
154
+ executionAnswer2,
154
155
  durationAnswer: durationAnswer,
155
156
  formula,
156
157
  discountCode
@@ -169,8 +170,8 @@ const AppointmentForm = () => {
169
170
  model,
170
171
  answers: (0, _helpers__.removeNullishProps)({
171
172
  duration: durationAnswer || (vehicleDetails === null || vehicleDetails === void 0 ? void 0 : vehicleDetails.duration),
172
- execution1: answers === null || answers === void 0 ? void 0 : answers['0'],
173
- execution2: answers === null || answers === void 0 ? void 0 : answers['1']
173
+ execution1: executionAnswer1,
174
+ execution2: executionAnswer2
174
175
  }),
175
176
  customer: _objectSpread(_objectSpread({}, customer), {}, {
176
177
  firstName: (customer === null || customer === void 0 ? void 0 : customer.firstName) || '(Onbekend)',
@@ -19,16 +19,11 @@ function _interopRequireDefault(obj) {
19
19
  }
20
20
  const DiscountProductsSelector = () => {
21
21
  const [{
22
- customer,
23
22
  licensePlate,
24
23
  model,
25
- answers,
26
24
  durationAnswer,
27
- selectedBoardComputer,
28
- selectedCableset,
29
- selectedCombiset,
30
- selectedTowbar,
31
- selectedBranch,
25
+ executionAnswer1,
26
+ executionAnswer2,
32
27
  discountCode,
33
28
  selectedDiscountedProducts
34
29
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
@@ -38,8 +33,8 @@ const DiscountProductsSelector = () => {
38
33
  } = (0, _queries.useProductsQuery)({
39
34
  licensePlate,
40
35
  model,
41
- executionAnswer1: answers === null || answers === void 0 ? void 0 : answers['0'],
42
- executionAnswer2: answers === null || answers === void 0 ? void 0 : answers['1'],
36
+ executionAnswer1,
37
+ executionAnswer2,
43
38
  durationAnswer: durationAnswer,
44
39
  formula,
45
40
  discountCode
@@ -125,7 +125,6 @@ const ExitIntentModal = () => {
125
125
  customer,
126
126
  licensePlate,
127
127
  model,
128
- answers,
129
128
  durationAnswer,
130
129
  selectedBoardComputer,
131
130
  selectedCableset,
@@ -133,6 +132,8 @@ const ExitIntentModal = () => {
133
132
  selectedTowbar,
134
133
  selectedBranch,
135
134
  discountCode,
135
+ executionAnswer1,
136
+ executionAnswer2,
136
137
  selectedDiscountedProducts = []
137
138
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
138
139
  const formula = (0, _FormulaContext.useFormula)();
@@ -141,8 +142,8 @@ const ExitIntentModal = () => {
141
142
  } = (0, _queries.useProductsQuery)({
142
143
  licensePlate,
143
144
  model,
144
- executionAnswer1: answers === null || answers === void 0 ? void 0 : answers['0'],
145
- executionAnswer2: answers === null || answers === void 0 ? void 0 : answers['1'],
145
+ executionAnswer1,
146
+ executionAnswer2,
146
147
  durationAnswer: durationAnswer,
147
148
  formula,
148
149
  discountCode
@@ -181,8 +182,8 @@ const ExitIntentModal = () => {
181
182
  model,
182
183
  answers: (0, _helpers__.removeNullishProps)({
183
184
  duration: durationAnswer || vehicleDetails.duration,
184
- execution1: answers === null || answers === void 0 ? void 0 : answers['0'],
185
- execution2: answers === null || answers === void 0 ? void 0 : answers['1']
185
+ execution1: executionAnswer1,
186
+ execution2: executionAnswer2
186
187
  }),
187
188
  formula,
188
189
  discount: discountCode ? {
@@ -55,13 +55,9 @@ const ProductDiscountCard = () => {
55
55
  customer,
56
56
  licensePlate,
57
57
  model,
58
- answers,
59
58
  durationAnswer,
60
- selectedBoardComputer,
61
- selectedCableset,
62
- selectedCombiset,
63
- selectedTowbar,
64
- selectedBranch,
59
+ executionAnswer1,
60
+ executionAnswer2,
65
61
  discountCode
66
62
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
67
63
  const formula = (0, _FormulaContext.useFormula)();
@@ -71,8 +67,8 @@ const ProductDiscountCard = () => {
71
67
  } = (0, _queries.useProductsQuery)({
72
68
  licensePlate,
73
69
  model,
74
- executionAnswer1: answers === null || answers === void 0 ? void 0 : answers['0'],
75
- executionAnswer2: answers === null || answers === void 0 ? void 0 : answers['1'],
70
+ executionAnswer1,
71
+ executionAnswer2,
76
72
  durationAnswer: durationAnswer,
77
73
  formula,
78
74
  discountCode
@@ -64,7 +64,8 @@ const ProductsOverview = () => {
64
64
  const [{
65
65
  licensePlate,
66
66
  model,
67
- answers,
67
+ executionAnswer1,
68
+ executionAnswer2,
68
69
  durationAnswer,
69
70
  selectedTowbar,
70
71
  selectedCableset,
@@ -90,8 +91,8 @@ const ProductsOverview = () => {
90
91
  } = (0, _queries.useProductsQuery)({
91
92
  licensePlate,
92
93
  model,
93
- executionAnswer1: answers === null || answers === void 0 ? void 0 : answers['0'],
94
- executionAnswer2: answers === null || answers === void 0 ? void 0 : answers['1'],
94
+ executionAnswer1,
95
+ executionAnswer2,
95
96
  durationAnswer: durationAnswer,
96
97
  selectBoardComputerUpdate: selectedBoardComputer != null,
97
98
  cart: cartInput ? JSON.stringify(cartInput) : undefined,
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
 
3
+ require("core-js/modules/es.weak-map.js");
3
4
  require("core-js/modules/web.dom-collections.iterator.js");
5
+ require("core-js/modules/es.weak-map.js");
4
6
  Object.defineProperty(exports, "__esModule", {
5
7
  value: true
6
8
  });
7
9
  exports.default = void 0;
8
10
  require("core-js/modules/web.dom-collections.iterator.js");
9
- var _react = _interopRequireDefault(require("react"));
11
+ var _react = _interopRequireWildcard(require("react"));
10
12
  var _reactRouter = require("react-router");
11
13
  var _queries = require("../__api__/queries");
12
14
  var _LinkButton = _interopRequireDefault(require("../__components__/Buttons/LinkButton"));
@@ -22,40 +24,105 @@ function _interopRequireDefault(obj) {
22
24
  default: obj
23
25
  };
24
26
  }
27
+ function _getRequireWildcardCache(e) {
28
+ if ("function" != typeof WeakMap) return null;
29
+ var r = new WeakMap(),
30
+ t = new WeakMap();
31
+ return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
32
+ return e ? t : r;
33
+ })(e);
34
+ }
35
+ function _interopRequireWildcard(e, r) {
36
+ if (!r && e && e.__esModule) return e;
37
+ if (null === e || "object" != typeof e && "function" != typeof e) return {
38
+ default: e
39
+ };
40
+ var t = _getRequireWildcardCache(r);
41
+ if (t && t.has(e)) return t.get(e);
42
+ var n = {
43
+ __proto__: null
44
+ },
45
+ a = Object.defineProperty && Object.getOwnPropertyDescriptor;
46
+ for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
47
+ var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
48
+ i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
49
+ }
50
+ return n.default = e, t && t.set(e, n), n;
51
+ }
25
52
  const QuestionsForm = _ref => {
26
53
  let {
27
- onPrev,
28
- onSubmit
54
+ onPrev = () => {},
55
+ onSubmit = () => {}
29
56
  } = _ref;
30
57
  const [{
31
58
  licensePlate,
32
59
  model,
33
- answers,
34
60
  durationAnswer,
35
- discountCode
61
+ executionAnswer1,
62
+ executionAnswer2,
63
+ discountCode,
64
+ execution1Options,
65
+ execution2Options,
66
+ durationOptions
36
67
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
37
68
  const formula = (0, _FormulaContext.useFormula)();
38
69
  const {
39
70
  isLoadingQuestions,
40
- questions,
71
+ execution1AnswerOptions,
72
+ execution2AnswerOptions,
41
73
  questionsError,
42
74
  durationQuestion
43
75
  } = (0, _queries.useQuestionsQuery)({
44
76
  licensePlate,
45
77
  model,
46
78
  formula,
47
- discountCode
79
+ discountCode,
80
+ executionAnswer1,
81
+ executionAnswer2,
82
+ durationAnswer: durationAnswer
48
83
  });
49
- (0, _queries.useProductsQuery)({
50
- licensePlate,
51
- model,
52
- executionAnswer1: answers === null || answers === void 0 ? void 0 : answers['0'],
53
- executionAnswer2: answers === null || answers === void 0 ? void 0 : answers['1'],
54
- durationAnswer: durationAnswer,
55
- formula,
56
- discountCode
57
- }); // Prefetch
58
84
 
85
+ // useProductsQuery({
86
+ // licensePlate,
87
+ // model,
88
+ // executionAnswer1,
89
+ // executionAnswer2,
90
+ // durationAnswer,
91
+ // formula,
92
+ // discountCode,
93
+ // }); // Prefetch
94
+
95
+ (0, _react.useEffect)(() => {
96
+ if (durationQuestion !== null && durationQuestion !== void 0 && durationQuestion.length) {
97
+ console.log('Retry');
98
+ dispatch({
99
+ type: _OrderSessionContext.orderSessionActions.SET_DURATION_OPTIONS,
100
+ payload: {
101
+ options: durationQuestion
102
+ }
103
+ });
104
+ }
105
+ }, [durationQuestion]);
106
+ (0, _react.useEffect)(() => {
107
+ if (execution1AnswerOptions !== null && execution1AnswerOptions !== void 0 && execution1AnswerOptions.length) {
108
+ dispatch({
109
+ type: _OrderSessionContext.orderSessionActions.SET_EXECUTION1_OPTIONS,
110
+ payload: {
111
+ options: execution1AnswerOptions
112
+ }
113
+ });
114
+ }
115
+ }, [execution1AnswerOptions]);
116
+ (0, _react.useEffect)(() => {
117
+ if (execution2AnswerOptions !== null && execution2AnswerOptions !== void 0 && execution2AnswerOptions.length) {
118
+ dispatch({
119
+ type: _OrderSessionContext.orderSessionActions.SET_EXECUTION2_OPTIONS,
120
+ payload: {
121
+ options: execution2AnswerOptions
122
+ }
123
+ });
124
+ }
125
+ }, [execution2AnswerOptions]);
59
126
  if (questionsError === _constants__.API_ERROR_CODES.notFound || questionsError === _constants__.API_ERROR_CODES.notFoundAldoc) {
60
127
  return /*#__PURE__*/_react.default.createElement(_reactRouter.Redirect, {
61
128
  to: "/configurator/geen-producten"
@@ -74,58 +141,54 @@ const QuestionsForm = _ref => {
74
141
  description: 'Dit kan ongeveer 15 seconden duren'
75
142
  }));
76
143
  }
77
- if (!(questions !== null && questions !== void 0 && questions.length) && !(durationQuestion !== null && durationQuestion !== void 0 && durationQuestion.length)) {
144
+ if (!(durationOptions !== null && durationOptions !== void 0 && durationOptions.length) && !(execution1Options !== null && execution1Options !== void 0 && execution1Options.length) && !(execution2Options !== null && execution2Options !== void 0 && execution2Options.length) && !(execution2AnswerOptions !== null && execution2AnswerOptions !== void 0 && execution2AnswerOptions.length) && !(execution1AnswerOptions !== null && execution1AnswerOptions !== void 0 && execution1AnswerOptions.length) && !(durationQuestion !== null && durationQuestion !== void 0 && durationQuestion.length)) {
78
145
  return /*#__PURE__*/_react.default.createElement(_reactRouter.Redirect, {
79
146
  to: "/configurator/trekhaakpakket"
80
147
  });
81
148
  }
82
- const handleAnswerSelected = _ref2 => {
83
- let {
84
- number,
85
- answer
86
- } = _ref2;
87
- dispatch({
88
- type: _OrderSessionContext.orderSessionActions.SET_ANSWER,
89
- payload: {
90
- number,
91
- answer
92
- }
93
- });
94
- };
95
- const handleDurationAnswerSelected = _ref3 => {
96
- let {
97
- answer
98
- } = _ref3;
149
+ const handlePrev = () => {
99
150
  dispatch({
100
- type: _OrderSessionContext.orderSessionActions.SET_DURATION_ANSWER,
101
- payload: {
102
- answer
103
- }
151
+ type: _OrderSessionContext.orderSessionActions.CLEAR_ANSWERS
104
152
  });
153
+ onPrev();
105
154
  };
106
155
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("p", null, "We hebben nog een aantal vragen (max 4) voordat we de juiste trekhaak voor jouw auto kunnen adviseren."), /*#__PURE__*/_react.default.createElement("div", {
107
156
  className: (0, _helpers__.withStyle)('my-2')
108
- }, questions.map((options, index) => {
109
- return /*#__PURE__*/_react.default.createElement(_RadioInput.default, {
110
- key: index,
111
- name: "questions-".concat(index),
112
- label: "Selecteer uw uitvoering",
113
- onChange: value => handleAnswerSelected({
114
- number: index,
115
- answer: value
116
- }),
117
- initialValue: answers === null || answers === void 0 ? void 0 : answers["".concat(index)],
118
- options: options,
119
- isRequired: true
120
- });
121
- }), (durationQuestion === null || durationQuestion === void 0 ? void 0 : durationQuestion.length) > 0 && /*#__PURE__*/_react.default.createElement(_RadioInput.default, {
157
+ }, (durationOptions === null || durationOptions === void 0 ? void 0 : durationOptions.length) > 0 && /*#__PURE__*/_react.default.createElement(_RadioInput.default, {
122
158
  name: "questions-duration",
123
159
  label: "Selecteer uw uitvoering",
124
- onChange: value => handleDurationAnswerSelected({
125
- answer: value
160
+ onChange: value => dispatch({
161
+ type: _OrderSessionContext.orderSessionActions.SET_DURATION_ANSWER,
162
+ payload: {
163
+ answer: value
164
+ }
126
165
  }),
127
166
  initialValue: durationAnswer,
128
- options: durationQuestion,
167
+ options: durationOptions,
168
+ isRequired: true
169
+ }), (execution1Options === null || execution1Options === void 0 ? void 0 : execution1Options.length) > 0 && /*#__PURE__*/_react.default.createElement(_RadioInput.default, {
170
+ name: "questions-1",
171
+ label: "Selecteer uw uitvoering",
172
+ onChange: value => dispatch({
173
+ type: _OrderSessionContext.orderSessionActions.SET_EXECUTION1_ANSWER,
174
+ payload: {
175
+ answer: value
176
+ }
177
+ }),
178
+ initialValue: executionAnswer1,
179
+ options: execution1Options,
180
+ isRequired: true
181
+ }), (execution2Options === null || execution2Options === void 0 ? void 0 : execution2Options.length) > 0 && /*#__PURE__*/_react.default.createElement(_RadioInput.default, {
182
+ name: "questions-2",
183
+ label: "Selecteer uw uitvoering",
184
+ onChange: value => dispatch({
185
+ type: _OrderSessionContext.orderSessionActions.SET_EXECUTION2_ANSWER,
186
+ payload: {
187
+ answer: value
188
+ }
189
+ }),
190
+ initialValue: executionAnswer2,
191
+ options: execution2Options,
129
192
  isRequired: true
130
193
  })), /*#__PURE__*/_react.default.createElement("div", {
131
194
  className: (0, _helpers__.withStyle)('row align-items-center justify-content-end mt-2')
@@ -136,15 +199,19 @@ const QuestionsForm = _ref => {
136
199
  }, /*#__PURE__*/_react.default.createElement(_LinkButton.default, {
137
200
  type: "button",
138
201
  isDisabled: false,
139
- onClick: onPrev,
202
+ onClick: handlePrev,
140
203
  label: 'Ga terug'
141
204
  }))), /*#__PURE__*/_react.default.createElement("div", {
142
205
  className: (0, _helpers__.withStyle)("col col-sm-auto mt-1")
143
206
  }, /*#__PURE__*/_react.default.createElement("div", {
144
207
  className: (0, _helpers__.withStyle)('d-grid gap-2')
145
208
  }, /*#__PURE__*/_react.default.createElement(_PrimaryButton.default, {
146
- isDisabled: Object.keys(answers).length !== questions.length || durationQuestion.length && !durationAnswer,
147
- onClick: () => onSubmit(answers),
209
+ isDisabled: execution1AnswerOptions.length && !executionAnswer1 || execution2AnswerOptions.length && !executionAnswer2 || durationQuestion.length && !durationAnswer,
210
+ onClick: () => onSubmit({
211
+ executionAnswer1,
212
+ executionAnswer2,
213
+ durationAnswer
214
+ }),
148
215
  label: "Bekijk de mogelijkheden"
149
216
  })))));
150
217
  };
@@ -118,11 +118,12 @@ const QuotationForm = () => {
118
118
  customer,
119
119
  licensePlate,
120
120
  model,
121
- answers,
122
121
  durationAnswer,
123
122
  selectedBoardComputer,
124
123
  selectedCableset,
125
124
  selectedCombiset,
125
+ executionAnswer1,
126
+ executionAnswer2,
126
127
  selectedTowbar,
127
128
  selectedBranch,
128
129
  discountCode,
@@ -143,8 +144,8 @@ const QuotationForm = () => {
143
144
  } = (0, _queries.useProductsQuery)({
144
145
  licensePlate,
145
146
  model,
146
- executionAnswer1: answers === null || answers === void 0 ? void 0 : answers['0'],
147
- executionAnswer2: answers === null || answers === void 0 ? void 0 : answers['1'],
147
+ executionAnswer1,
148
+ executionAnswer2,
148
149
  durationAnswer: durationAnswer,
149
150
  formula,
150
151
  discountCode
@@ -164,8 +165,8 @@ const QuotationForm = () => {
164
165
  model,
165
166
  answers: (0, _helpers__.removeNullishProps)({
166
167
  duration: durationAnswer || (vehicleDetails === null || vehicleDetails === void 0 ? void 0 : vehicleDetails.duration),
167
- execution1: answers === null || answers === void 0 ? void 0 : answers['0'],
168
- execution2: answers === null || answers === void 0 ? void 0 : answers['1']
168
+ execution1: executionAnswer1,
169
+ execution2: executionAnswer2
169
170
  }),
170
171
  discount: discountCode ? {
171
172
  code: discountCode
@@ -26,7 +26,8 @@ const VehicleData = () => {
26
26
  const [{
27
27
  licensePlate,
28
28
  model,
29
- answers,
29
+ executionAnswer1,
30
+ executionAnswer2,
30
31
  durationAnswer,
31
32
  discountCode
32
33
  }] = (0, _OrderSessionContext.useOrderSession)();
@@ -37,8 +38,8 @@ const VehicleData = () => {
37
38
  } = (0, _queries.useProductsQuery)({
38
39
  licensePlate,
39
40
  model,
40
- executionAnswer1: answers === null || answers === void 0 ? void 0 : answers['0'],
41
- executionAnswer2: answers === null || answers === void 0 ? void 0 : answers['1'],
41
+ executionAnswer1,
42
+ executionAnswer2,
42
43
  durationAnswer: durationAnswer,
43
44
  formula,
44
45
  discountCode
@@ -141,7 +141,6 @@ const InternalAppointmentForm = () => {
141
141
  model,
142
142
  vehicle,
143
143
  channel,
144
- answers,
145
144
  durationAnswer,
146
145
  selectedBoardComputer,
147
146
  selectedCableset,
@@ -152,7 +151,9 @@ const InternalAppointmentForm = () => {
152
151
  discountCode,
153
152
  discountPercentage,
154
153
  discountAmount,
155
- selectedDiscountedProducts = []
154
+ selectedDiscountedProducts = [],
155
+ executionAnswer1,
156
+ executionAnswer2
156
157
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
157
158
  const [errors, setErrors] = (0, _react.useState)({});
158
159
  const [_licensePlate, _setLicensePlate] = (0, _react.useState)();
@@ -176,8 +177,8 @@ const InternalAppointmentForm = () => {
176
177
  } = (0, _queries.useProductsQuery)({
177
178
  licensePlate,
178
179
  model,
179
- executionAnswer1: answers === null || answers === void 0 ? void 0 : answers['0'],
180
- executionAnswer2: answers === null || answers === void 0 ? void 0 : answers['1'],
180
+ executionAnswer1,
181
+ executionAnswer2,
181
182
  durationAnswer: durationAnswer,
182
183
  formula,
183
184
  discountCode
@@ -224,12 +225,11 @@ const InternalAppointmentForm = () => {
224
225
  appointment,
225
226
  channel,
226
227
  licensePlate: (_ref = licensePlate || _licensePlate) === null || _ref === void 0 ? void 0 : _ref.replace(/-/g, ''),
227
- answers,
228
228
  model,
229
229
  answers: (0, _helpers__.removeNullishProps)({
230
230
  duration: durationAnswer || (vehicleDetails === null || vehicleDetails === void 0 ? void 0 : vehicleDetails.duration),
231
- execution1: answers === null || answers === void 0 ? void 0 : answers['0'],
232
- execution2: answers === null || answers === void 0 ? void 0 : answers['1']
231
+ execution1: executionAnswer1,
232
+ execution2: executionAnswer2
233
233
  }),
234
234
  discount: (0, _helpers__.removeNullishProps)({
235
235
  code: discountCode,
@@ -129,7 +129,8 @@ const InternalQuotationForm = () => {
129
129
  customer,
130
130
  licensePlate,
131
131
  model,
132
- answers,
132
+ executionAnswer1,
133
+ executionAnswer2,
133
134
  durationAnswer,
134
135
  selectedBoardComputer,
135
136
  selectedCableset,
@@ -160,8 +161,8 @@ const InternalQuotationForm = () => {
160
161
  } = (0, _queries.useProductsQuery)({
161
162
  licensePlate,
162
163
  model,
163
- executionAnswer1: answers === null || answers === void 0 ? void 0 : answers['0'],
164
- executionAnswer2: answers === null || answers === void 0 ? void 0 : answers['1'],
164
+ executionAnswer1,
165
+ executionAnswer2,
165
166
  durationAnswer: durationAnswer,
166
167
  formula,
167
168
  discountCode
@@ -208,12 +209,11 @@ const InternalQuotationForm = () => {
208
209
  }),
209
210
  channel,
210
211
  licensePlate: (_ref = licensePlate || _licensePlate) === null || _ref === void 0 ? void 0 : _ref.replace(/-/g, ''),
211
- answers,
212
212
  model,
213
213
  answers: (0, _helpers__.removeNullishProps)({
214
214
  duration: durationAnswer || (vehicleDetails === null || vehicleDetails === void 0 ? void 0 : vehicleDetails.duration),
215
- execution1: answers === null || answers === void 0 ? void 0 : answers['0'],
216
- execution2: answers === null || answers === void 0 ? void 0 : answers['1']
215
+ execution1: executionAnswer1,
216
+ execution2: executionAnswer2
217
217
  }),
218
218
  discount: (0, _helpers__.removeNullishProps)({
219
219
  code: discountCode,
@@ -96,8 +96,12 @@ const INITIAL_ORDER_SESSION_STATE = {
96
96
  model: null,
97
97
  brand: null,
98
98
  channel: null,
99
- answers: {},
100
99
  durationAnswer: null,
100
+ executionAnswer1: null,
101
+ executionAnswer2: null,
102
+ durationOptions: [],
103
+ execution1Options: [],
104
+ execution2Options: [],
101
105
  selectedExtras: {},
102
106
  selectedTowbar: null,
103
107
  selectedCableset: null,
@@ -107,6 +111,7 @@ const INITIAL_ORDER_SESSION_STATE = {
107
111
  isBoardComputerDeselected: false,
108
112
  selectedBranch: null,
109
113
  discountCode: null,
114
+ franchiseName: null,
110
115
  vehicle: {
111
116
  ownershipType: _constants__.VEHICLE_OWNERSHIP_TYPE.Particulier,
112
117
  leaseNumber: ''
@@ -134,8 +139,13 @@ const orderSessionActions = exports.orderSessionActions = {
134
139
  SET_BUILD_YEAR: 'SET_BUILD_YEAR',
135
140
  SET_MODEL: 'SET_MODEL',
136
141
  SET_BRAND: 'SET_BRAND',
137
- SET_ANSWER: 'SET_ANSWER',
138
142
  SET_DURATION_ANSWER: 'SET_DURATION_ANSWER',
143
+ SET_EXECUTION1_ANSWER: 'SET_EXECUTION1_ANSWER',
144
+ SET_EXECUTION2_ANSWER: 'SET_EXECUTION2_ANSWER',
145
+ SET_DURATION_OPTIONS: 'SET_DURATION_OPTIONS',
146
+ SET_EXECUTION1_OPTIONS: 'SET_EXECUTION1_OPTIONS',
147
+ SET_EXECUTION2_OPTIONS: 'SET_EXECUTION2_OPTIONS',
148
+ CLEAR_ANSWERS: 'CLEAR_ANSWERS',
139
149
  SET_SELECTED_TOWBAR: 'SET_SELECTED_TOWBAR',
140
150
  SET_SELECTED_CABLESET: 'SET_SELECTED_CABLESET',
141
151
  SET_SELECTED_COMBISET: 'SET_SELECTED_COMBISET',
@@ -166,7 +176,8 @@ const orderSessionActions = exports.orderSessionActions = {
166
176
  SET_APPOINTMENT_NOTE: 'SET_APPOINTMENT_NOTE',
167
177
  SET_DISCOUNT_AMOUNT: 'SET_DISCOUNT_AMOUNT',
168
178
  SET_DISCOUNT_PERCENTAGE: 'SET_DISCOUNT_PERCENTAGE',
169
- CLEAR_DISCOUNT: 'CLEAR_DISCOUNT'
179
+ CLEAR_DISCOUNT: 'CLEAR_DISCOUNT',
180
+ SET_FRANCHISE_NAME: 'SET_FRANCHISE_NAME'
170
181
  };
171
182
  const orderSessionReducer = (state, action) => {
172
183
  switch (action.type) {
@@ -381,25 +392,72 @@ const orderSessionReducer = (state, action) => {
381
392
  })
382
393
  });
383
394
  }
384
- case orderSessionActions.SET_ANSWER:
395
+ case orderSessionActions.SET_DURATION_ANSWER:
385
396
  {
386
397
  const {
387
- answer,
388
- number
398
+ answer
389
399
  } = action.payload;
390
400
  return _objectSpread(_objectSpread({}, state), {}, {
391
- answers: _objectSpread(_objectSpread({}, state.answers), {}, {
392
- [number]: answer
393
- })
401
+ durationAnswer: answer,
402
+ // Remove subsequent questions and answers
403
+ executionAnswer1: null,
404
+ executionAnswer2: null,
405
+ execution1Options: [],
406
+ execution2Options: []
394
407
  });
395
408
  }
396
- case orderSessionActions.SET_DURATION_ANSWER:
409
+ case orderSessionActions.SET_EXECUTION1_ANSWER:
410
+ {
411
+ const {
412
+ answer
413
+ } = action.payload;
414
+ return _objectSpread(_objectSpread({}, state), {}, {
415
+ executionAnswer1: answer,
416
+ // Remove subsequent question and answer
417
+ executionAnswer2: null,
418
+ execution2Options: []
419
+ });
420
+ }
421
+ case orderSessionActions.SET_EXECUTION2_ANSWER:
397
422
  {
398
423
  const {
399
424
  answer
400
425
  } = action.payload;
401
426
  return _objectSpread(_objectSpread({}, state), {}, {
402
- durationAnswer: answer
427
+ executionAnswer2: answer
428
+ });
429
+ }
430
+ case orderSessionActions.SET_DURATION_OPTIONS:
431
+ {
432
+ const {
433
+ options
434
+ } = action.payload;
435
+ return _objectSpread(_objectSpread({}, state), {}, {
436
+ durationOptions: options,
437
+ executionAnswer1: null,
438
+ executionAnswer2: null,
439
+ execution1Options: [],
440
+ execution2Options: []
441
+ });
442
+ }
443
+ case orderSessionActions.SET_EXECUTION1_OPTIONS:
444
+ {
445
+ const {
446
+ options
447
+ } = action.payload;
448
+ return _objectSpread(_objectSpread({}, state), {}, {
449
+ execution1Options: options,
450
+ executionAnswer2: null,
451
+ execution2Options: []
452
+ });
453
+ }
454
+ case orderSessionActions.SET_EXECUTION2_OPTIONS:
455
+ {
456
+ const {
457
+ options
458
+ } = action.payload;
459
+ return _objectSpread(_objectSpread({}, state), {}, {
460
+ execution2Options: options
403
461
  });
404
462
  }
405
463
  case orderSessionActions.SET_CUSTOMER_ZIP_CODE:
@@ -619,6 +677,22 @@ const orderSessionReducer = (state, action) => {
619
677
  discountAmount: null
620
678
  });
621
679
  }
680
+ case orderSessionActions.SET_FRANCHISE_NAME:
681
+ {
682
+ const {
683
+ franchiseName
684
+ } = action.payload;
685
+ return _objectSpread(_objectSpread({}, state), {}, {
686
+ franchiseName
687
+ });
688
+ }
689
+ case orderSessionActions.CLEAR_ANSWERS:
690
+ {
691
+ return _objectSpread(_objectSpread({}, state), {}, {
692
+ answers: {},
693
+ durationAnswer: null
694
+ });
695
+ }
622
696
  default:
623
697
  return state;
624
698
  }
@@ -73,7 +73,7 @@ const LicensePlatePage = () => {
73
73
  const [activeStep, setActiveStep] = (0, _react.useState)(0);
74
74
  const [orderSession, dispatch] = (0, _OrderSessionContext.useOrderSession)();
75
75
  const formula = (0, _FormulaContext.useFormula)();
76
- const [licensePlateURL, widgetOrEntityId, discountCode] = (0, _useSearchParam.default)(['licensePlate', 'vestigingRecId', 'discountCode']);
76
+ const [licensePlateURL, widgetOrEntityId, discountCode, franchiseName] = (0, _useSearchParam.default)(['licensePlate', 'vestigingRecId', 'discountCode', 'naamKeten']);
77
77
  const {
78
78
  branchById,
79
79
  isLoadingBranchById
@@ -118,6 +118,16 @@ const LicensePlatePage = () => {
118
118
  });
119
119
  }
120
120
  }, [branchById]);
121
+ (0, _react.useEffect)(() => {
122
+ if (franchiseName) {
123
+ dispatch({
124
+ type: _OrderSessionContext.orderSessionActions.SET_FRANCHISE_NAME,
125
+ payload: {
126
+ franchiseName
127
+ }
128
+ });
129
+ }
130
+ }, [franchiseName]);
121
131
  (0, _react.useEffect)(() => {
122
132
  if (discountCode) {
123
133
  dispatch({
@@ -1,71 +1,23 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.weak-map.js");
4
- require("core-js/modules/web.dom-collections.iterator.js");
5
- require("core-js/modules/es.weak-map.js");
6
3
  Object.defineProperty(exports, "__esModule", {
7
4
  value: true
8
5
  });
9
6
  exports.default = void 0;
10
- require("core-js/modules/web.dom-collections.iterator.js");
11
- var _react = _interopRequireWildcard(require("react"));
12
- var _reactRouter = require("react-router");
7
+ var _react = _interopRequireDefault(require("react"));
13
8
  var _LocationsSelector = _interopRequireDefault(require("../__components__/LocationsSelector"));
14
9
  var _NavigationSteps = _interopRequireDefault(require("../__components__/NavigationSteps"));
15
10
  var _constants__ = require("../__constants__");
16
11
  var _BottomNavigationBar = _interopRequireDefault(require("../__containers__/BottomNavigationBar"));
17
12
  var _FormulaContext = require("../__context__/FormulaContext");
18
- var _OrderSessionContext = require("../__context__/OrderSessionContext");
19
13
  var _helpers__ = require("../__helpers__");
20
14
  function _interopRequireDefault(obj) {
21
15
  return obj && obj.__esModule ? obj : {
22
16
  default: obj
23
17
  };
24
18
  }
25
- function _getRequireWildcardCache(e) {
26
- if ("function" != typeof WeakMap) return null;
27
- var r = new WeakMap(),
28
- t = new WeakMap();
29
- return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
30
- return e ? t : r;
31
- })(e);
32
- }
33
- function _interopRequireWildcard(e, r) {
34
- if (!r && e && e.__esModule) return e;
35
- if (null === e || "object" != typeof e && "function" != typeof e) return {
36
- default: e
37
- };
38
- var t = _getRequireWildcardCache(r);
39
- if (t && t.has(e)) return t.get(e);
40
- var n = {
41
- __proto__: null
42
- },
43
- a = Object.defineProperty && Object.getOwnPropertyDescriptor;
44
- for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
45
- var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
46
- i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
47
- }
48
- return n.default = e, t && t.set(e, n), n;
49
- }
50
- const LocationPage = _ref => {
51
- var _location$state2;
52
- let {
53
- location
54
- } = _ref;
55
- const [{
56
- selectedBranch
57
- }] = (0, _OrderSessionContext.useOrderSession)();
58
- const history = (0, _reactRouter.useHistory)();
19
+ const LocationPage = () => {
59
20
  const formula = (0, _FormulaContext.useFormula)();
60
- (0, _react.useEffect)(() => {
61
- var _location$state;
62
- // Note: skip this page if
63
- // - branch was already selected
64
- // - Previous page was /overzicht
65
- if (selectedBranch && (location === null || location === void 0 || (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.prevPathName) === '/configurator/overzicht') {
66
- history.push('/configurator/gegevens');
67
- }
68
- }, [location === null || location === void 0 || (_location$state2 = location.state) === null || _location$state2 === void 0 ? void 0 : _location$state2.prevPathName]);
69
21
  return /*#__PURE__*/_react.default.createElement("section", {
70
22
  className: "".concat((0, _helpers__.withStyle)("thm-configurator-wrapper ".concat(formula === _constants__.CONFIGURATOR_FORMULAS.THC ? 'thc' : '')))
71
23
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -70,7 +70,7 @@ const ManualSelectionPage = () => {
70
70
  const [activeStep, setActiveStep] = (0, _react.useState)(0);
71
71
  const history = (0, _reactRouter.useHistory)();
72
72
  const formula = (0, _FormulaContext.useFormula)();
73
- const [widgetOrEntityId, discountCode] = (0, _useSearchParam.default)(['vestigingRecId', 'discountCode']);
73
+ const [widgetOrEntityId, discountCode, franchiseName] = (0, _useSearchParam.default)(['vestigingRecId', 'discountCode', 'naamKeten']);
74
74
  const {
75
75
  branchById,
76
76
  isLoadingBranchById
@@ -105,6 +105,16 @@ const ManualSelectionPage = () => {
105
105
  });
106
106
  }
107
107
  }, [discountCode]);
108
+ (0, _react.useEffect)(() => {
109
+ if (franchiseName) {
110
+ dispatch({
111
+ type: _OrderSessionContext.orderSessionActions.SET_FRANCHISE_NAME,
112
+ payload: {
113
+ franchiseName
114
+ }
115
+ });
116
+ }
117
+ }, [franchiseName]);
108
118
  const handleNext = () => {
109
119
  setActiveStep(prev => prev + 1);
110
120
  };
@@ -55,8 +55,8 @@ const NoProductsPage = () => {
55
55
  }
56
56
  };
57
57
  return /*#__PURE__*/_react.default.createElement("section", {
58
- className: (0, _helpers__.withStyle)("thm-configurator-wrapper thm-configurator-home ".concat(formula === _constants__.CONFIGURATOR_FORMULAS.THC ? 'thc' : ''), APP_CONFIG.internal ? 'thm-configurator-wrapper--offset' : '')
59
- }, !APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement("img", {
58
+ className: (0, _helpers__.withStyle)("thm-configurator-wrapper thm-configurator-home ".concat(formula === _constants__.CONFIGURATOR_FORMULAS.THC ? 'thc' : ''))
59
+ }, /*#__PURE__*/_react.default.createElement("img", {
60
60
  className: (0, _helpers__.withStyle)('thm-configurator-home__logo img-fluid'),
61
61
  src: _logoPrimaryIcon.default,
62
62
  alt: "Trekhaakmontage"
@@ -90,7 +90,6 @@ var _OverviewPage = _interopRequireDefault(require("./OverviewPage"));
90
90
  var _ProductsPage = _interopRequireDefault(require("./ProductsPage"));
91
91
  var _QuotationPage = _interopRequireDefault(require("./QuotationPage"));
92
92
  var _QuotationThanksPage = _interopRequireDefault(require("./QuotationThanksPage"));
93
- var _internal = require("./internal");
94
93
  function _interopRequireDefault(obj) {
95
94
  return obj && obj.__esModule ? obj : {
96
95
  default: obj
@@ -102,7 +101,7 @@ const Routes = () => {
102
101
  return /*#__PURE__*/_react.default.createElement(_reactRouterDom.Switch, null, /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
103
102
  exact: true,
104
103
  path: "/",
105
- render: props => /*#__PURE__*/_react.default.createElement(_internal.InternalLicensePlatePage, props)
104
+ render: props => /*#__PURE__*/_react.default.createElement(_LicensePlatePage.default, props)
106
105
  }), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
107
106
  exact: true,
108
107
  path: "/configurator/geen-producten",
@@ -110,40 +109,40 @@ const Routes = () => {
110
109
  }), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
111
110
  exact: true,
112
111
  path: "/configurator/montagelocatie",
113
- render: props => /*#__PURE__*/_react.default.createElement(_internal.InternalLocationsPage, props)
112
+ render: props => /*#__PURE__*/_react.default.createElement(_LocationsPage.default, props)
114
113
  }), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
115
114
  exact: true,
116
115
  path: "/configurator/gegevens/bedankt",
117
- render: props => /*#__PURE__*/_react.default.createElement(_internal.InternalAppointmentPage, props)
116
+ render: props => /*#__PURE__*/_react.default.createElement(_AppointmentThanksPage.default, props)
118
117
  }), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
119
118
  exact: true,
120
119
  path: "/configurator/offerte/bedankt",
121
120
  render: props => /*#__PURE__*/_react.default.createElement(_QuotationThanksPage.default, props)
122
121
  }), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
123
122
  path: "/configurator/trekhaakpakket",
124
- render: props => /*#__PURE__*/_react.default.createElement(_internal.InternalProductsPage, null)
123
+ render: props => /*#__PURE__*/_react.default.createElement(_ProductsPage.default, null)
125
124
  }), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
126
125
  path: "/configurator/manual",
127
- render: props => /*#__PURE__*/_react.default.createElement(_internal.InternalManualSelectionPage, props)
126
+ render: props => /*#__PURE__*/_react.default.createElement(_ManualSelectionPage.default, props)
128
127
  }), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
129
128
  exact: true,
130
129
  path: "/configurator/overzicht",
131
- render: props => /*#__PURE__*/_react.default.createElement(_internal.InternalOverviewPage, null)
130
+ render: props => /*#__PURE__*/_react.default.createElement(_OverviewPage.default, null)
132
131
  }), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
133
132
  exact: true,
134
133
  path: "/configurator/offerte",
135
- render: props => /*#__PURE__*/_react.default.createElement(_internal.InternalQuotationPage, null)
134
+ render: props => /*#__PURE__*/_react.default.createElement(_QuotationPage.default, null)
136
135
  }), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
137
136
  exact: true,
138
137
  path: "/configurator/gegevens",
139
- render: props => /*#__PURE__*/_react.default.createElement(_internal.InternalAppointmentPage, null)
138
+ render: props => /*#__PURE__*/_react.default.createElement(_AppointmentPage.default, null)
140
139
  }), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
141
140
  exact: true,
142
141
  path: "/configurator/toebehoren",
143
- render: props => /*#__PURE__*/_react.default.createElement(_internal.InternalExtraProductsPage, null)
142
+ render: props => /*#__PURE__*/_react.default.createElement(_ExtraProductsPage.default, null)
144
143
  }), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
145
144
  path: "/configurator",
146
- render: props => /*#__PURE__*/_react.default.createElement(_internal.InternalLicensePlatePage, null)
145
+ render: props => /*#__PURE__*/_react.default.createElement(_LicensePlatePage.default, null)
147
146
  }), /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
148
147
  path: "/niet-gevonden",
149
148
  render: () => /*#__PURE__*/_react.default.createElement(_NotFoundPage.default, null)
@@ -62,11 +62,13 @@ const InternalLocationsPage = _ref => {
62
62
  (0, _react.useEffect)(() => {
63
63
  var _branchTypes$byId$aut, _authSession$branch, _location$state;
64
64
  const branchType = branchTypes === null || branchTypes === void 0 || (_branchTypes$byId$aut = branchTypes.byId[authSession === null || authSession === void 0 || (_authSession$branch = authSession.branch) === null || _authSession$branch === void 0 || (_authSession$branch = _authSession$branch.organisatietype) === null || _authSession$branch === void 0 ? void 0 : _authSession$branch[0]]) === null || _branchTypes$byId$aut === void 0 ? void 0 : _branchTypes$byId$aut.title;
65
+
66
+ // Step 1: If no branch type was found, or the branch type is TMG: dont proceed to the next step
65
67
  if (!branchType || branchType === _constants__.TMG_ORGANIZATION_TYPE) {
66
68
  return;
67
69
  }
68
70
 
69
- // Note: skip this page if the branch type is not TowMotive Group
71
+ // Step 2: skip this page if the branch type is not TowMotive Group
70
72
  // If the previous page is appointment page ("gegevens") -> go back to overview ("overzicht")
71
73
  // Otherwise: proceed to the appointment page ("gegevens")
72
74
 
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.weak-map.js");
4
+ require("core-js/modules/web.dom-collections.iterator.js");
5
+ require("core-js/modules/es.weak-map.js");
6
+ require("core-js/modules/web.dom-collections.iterator.js");
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.default = void 0;
11
+ var _react = _interopRequireWildcard(require("react"));
12
+ var _NavigationButton = _interopRequireDefault(require("../../__components__/Buttons/NavigationButton"));
13
+ var _PrimaryButton = _interopRequireDefault(require("../../__components__/Buttons/PrimaryButton"));
14
+ var _CardWide = _interopRequireDefault(require("../../__components__/Cards/CardWide"));
15
+ var _constants__ = require("../../__constants__");
16
+ var _FormulaContext = require("../../__context__/FormulaContext");
17
+ var _helpers__ = require("../../__helpers__");
18
+ function _interopRequireDefault(obj) {
19
+ return obj && obj.__esModule ? obj : {
20
+ default: obj
21
+ };
22
+ }
23
+ function _getRequireWildcardCache(e) {
24
+ if ("function" != typeof WeakMap) return null;
25
+ var r = new WeakMap(),
26
+ t = new WeakMap();
27
+ return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
28
+ return e ? t : r;
29
+ })(e);
30
+ }
31
+ function _interopRequireWildcard(e, r) {
32
+ if (!r && e && e.__esModule) return e;
33
+ if (null === e || "object" != typeof e && "function" != typeof e) return {
34
+ default: e
35
+ };
36
+ var t = _getRequireWildcardCache(r);
37
+ if (t && t.has(e)) return t.get(e);
38
+ var n = {
39
+ __proto__: null
40
+ },
41
+ a = Object.defineProperty && Object.getOwnPropertyDescriptor;
42
+ for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
43
+ var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
44
+ i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
45
+ }
46
+ return n.default = e, t && t.set(e, n), n;
47
+ }
48
+ const InternalNoProductsPage = () => {
49
+ const mailLinkRef = (0, _react.useRef)(null);
50
+ const formula = (0, _FormulaContext.useFormula)();
51
+ const handleClick = () => {
52
+ if (mailLinkRef.current) {
53
+ mailLinkRef.current.click();
54
+ }
55
+ };
56
+ return /*#__PURE__*/_react.default.createElement("section", {
57
+ className: (0, _helpers__.withStyle)("thm-configurator-wrapper thm-configurator-home thm-configurator-wrapper--offset ".concat(formula === _constants__.CONFIGURATOR_FORMULAS.THC ? 'thc' : ''))
58
+ }, /*#__PURE__*/_react.default.createElement("div", {
59
+ className: (0, _helpers__.withStyle)('container')
60
+ }, /*#__PURE__*/_react.default.createElement("div", {
61
+ className: (0, _helpers__.withStyle)('row')
62
+ }, /*#__PURE__*/_react.default.createElement("div", {
63
+ className: (0, _helpers__.withStyle)('thm-configurator-modal-form modal d-block'),
64
+ tabIndex: "-1"
65
+ }, /*#__PURE__*/_react.default.createElement(_CardWide.default, {
66
+ title: ''
67
+ }, /*#__PURE__*/_react.default.createElement("h5", {
68
+ className: (0, _helpers__.withStyle)('text-center mb-2')
69
+ }, "We hebben geen trekhaak voor uw auto in ons systeem kunnen vinden"), /*#__PURE__*/_react.default.createElement("p", {
70
+ className: (0, _helpers__.withStyle)('mb-4 text-center')
71
+ }, "Dit betekent niet dat er geen trekhaak op uw auto gemonteerd kan worden. Een van onze medewerkers kijkt graag met u mee naar de mogelijkheden. Neem hiervoor contact met ons op via mail order@trekhaakmontage.nl of bel ons op +31 85-000 4122."), /*#__PURE__*/_react.default.createElement("a", {
72
+ href: "mailto:order@trekhaakmontage.nl",
73
+ "aria-hidden": true,
74
+ hidden: true,
75
+ className: (0, _helpers__.withStyle)('d-none'),
76
+ ref: mailLinkRef
77
+ }), /*#__PURE__*/_react.default.createElement("div", {
78
+ className: (0, _helpers__.withStyle)("d-flex justify-content-center gap-2 flex-md-nowrap flex-wrap")
79
+ }, /*#__PURE__*/_react.default.createElement(_PrimaryButton.default, {
80
+ isDisabled: false,
81
+ onClick: handleClick,
82
+ label: "Mail order@trekhaakmontage.nl"
83
+ }), /*#__PURE__*/_react.default.createElement(_NavigationButton.default, {
84
+ to: '/configurator',
85
+ variant: "outline-primary",
86
+ isDisabled: false,
87
+ label: "Terug naar startpagina"
88
+ })))))));
89
+ };
90
+ var _default = exports.default = InternalNoProductsPage;
@@ -33,6 +33,12 @@ Object.defineProperty(exports, "InternalManualSelectionPage", {
33
33
  return _InternalManualSelectionPage.default;
34
34
  }
35
35
  });
36
+ Object.defineProperty(exports, "InternalNoProductsPage", {
37
+ enumerable: true,
38
+ get: function get() {
39
+ return _InternalNoProductsPage.default;
40
+ }
41
+ });
36
42
  Object.defineProperty(exports, "InternalOverviewPage", {
37
43
  enumerable: true,
38
44
  get: function get() {
@@ -56,6 +62,7 @@ var _InternalExtraProductsPage = _interopRequireDefault(require("./InternalExtra
56
62
  var _InternalLicensePlatePage = _interopRequireDefault(require("./InternalLicensePlatePage"));
57
63
  var _InternalLocationsPage = _interopRequireDefault(require("./InternalLocationsPage"));
58
64
  var _InternalManualSelectionPage = _interopRequireDefault(require("./InternalManualSelectionPage"));
65
+ var _InternalNoProductsPage = _interopRequireDefault(require("./InternalNoProductsPage"));
59
66
  var _InternalOverviewPage = _interopRequireDefault(require("./InternalOverviewPage"));
60
67
  var _InternalProductsPage = _interopRequireDefault(require("./InternalProductsPage"));
61
68
  var _InternalQuotationPage = _interopRequireDefault(require("./InternalQuotationPage"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.20",
3
+ "version": "0.0.24",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",