thm-p3-configurator 0.0.346 → 0.0.348

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 (44) hide show
  1. package/dist/src/shared/__containers__/internal/InternalAppointmentForm.js +11 -10
  2. package/package.json +1 -1
  3. package/dist/src/shared/__components__/LocationsSelector/LocationList.js +0 -180
  4. package/dist/src/shared/__components__/LocationsSelector/LocationListItem.js +0 -103
  5. package/dist/src/shared/__components__/LocationsSelector/LocationTreeMarker.js +0 -96
  6. package/dist/src/shared/__components__/LocationsSelector/index.js +0 -162
  7. package/dist/src/shared/__components__/Modal.js +0 -78
  8. package/dist/src/shared/__components__/Navbar.js +0 -58
  9. package/dist/src/shared/__components__/NavigationSteps.js +0 -115
  10. package/dist/src/shared/__components__/Pagination.js +0 -53
  11. package/dist/src/shared/__components__/ProductCard/ProductCardCheckbox.js +0 -38
  12. package/dist/src/shared/__components__/ProductCard/ProductCardDescription.js +0 -77
  13. package/dist/src/shared/__components__/ProductCard/ProductCardDiscountAlert.js +0 -57
  14. package/dist/src/shared/__components__/ProductCard/ProductCardImage.js +0 -28
  15. package/dist/src/shared/__components__/ProductCard/ProductCardPrice.js +0 -37
  16. package/dist/src/shared/__components__/ProductCard/ProductCardRibbon.js +0 -28
  17. package/dist/src/shared/__components__/ProductCard/ProductCardSpecifications.js +0 -77
  18. package/dist/src/shared/__components__/ProductCard/ProductCardUsps.js +0 -82
  19. package/dist/src/shared/__components__/ProductCard/index.js +0 -173
  20. package/dist/src/shared/__components__/ProductTable/ProductTableEditableRow.js +0 -66
  21. package/dist/src/shared/__components__/ProductTable/ProductTableHead.js +0 -32
  22. package/dist/src/shared/__components__/ProductTable/ProductTableSection.js +0 -25
  23. package/dist/src/shared/__components__/ProductTable/ProductTableSectionTotal.js +0 -44
  24. package/dist/src/shared/__components__/ProductTable/ProductTableStaticRow.js +0 -47
  25. package/dist/src/shared/__components__/ProductTable/ProductTableTotal.js +0 -41
  26. package/dist/src/shared/__components__/ProductTable/index.js +0 -127
  27. package/dist/src/shared/__components__/SingleOrderCartCard.js +0 -78
  28. package/dist/src/shared/__components__/SingleOrderProductCard.js +0 -269
  29. package/dist/src/shared/__components__/Spinners/FullPageSpinner.js +0 -73
  30. package/dist/src/shared/__components__/Spinners/InlineSpinner.js +0 -26
  31. package/dist/src/shared/__components__/Spinners/TextSpinner.js +0 -31
  32. package/dist/src/shared/__components__/UspsList.js +0 -27
  33. package/dist/src/shared/__components__/internal/InternalCustomerDetailsForm.js +0 -951
  34. package/dist/src/shared/__constants__/cartTable.js +0 -32
  35. package/dist/src/shared/__constants__/cookiebot.js +0 -7
  36. package/dist/src/shared/__constants__/index.js +0 -311
  37. package/dist/src/shared/__constants__/sentry.js +0 -20
  38. package/dist/src/shared/__containers__/ANWBMembershipInput.js +0 -165
  39. package/dist/src/shared/__containers__/AppointmentForm.js +0 -389
  40. package/dist/src/shared/__containers__/BoardComputerCard.js +0 -137
  41. package/dist/src/shared/__containers__/BottomNavigationBar.js +0 -162
  42. package/dist/src/shared/__containers__/DiscountProductsSelector.js +0 -149
  43. package/dist/src/shared/__containers__/ExitIntentModal.js +0 -278
  44. package/dist/src/shared/__containers__/ExtraProductsOverview.js +0 -227
@@ -481,7 +481,7 @@ const InternalAppointmentForm = _ref => {
481
481
  const handleSubmit = async function handleSubmit() {
482
482
  let appointmentType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _constants__.DOSSIER_TYPES.PlannedAppointment;
483
483
  try {
484
- var _customer$kvkNumber, _customer$vatNumber, _customer$firstName, _customer$lastName, _customer$phoneNumber, _customer$houseNumber, _customer$houseNumber2, _customer$streetName, _customer$countryId, _customer$city, _customer$email, _contextCustomer$note, _customer$zipCode, _customer$companyName, _customer$kvkNumber2, _customer$vatNumber2, _ref3;
484
+ var _customer$kvkNumber, _customer$vatNumber, _customer$firstName, _customer$lastName, _customer$phoneNumber, _customer$houseNumber, _customer$houseNumber2, _customer$streetName, _customer$countryId, _customer$city, _customer$email, _ref3, _contextCustomer$anwb, _contextCustomer$note, _customer$zipCode, _customer$companyName, _customer$kvkNumber2, _customer$vatNumber2, _ref4;
485
485
  setErrors({});
486
486
  if (!model) {
487
487
  // Note: this does not throw on error.
@@ -552,6 +552,7 @@ const InternalAppointmentForm = _ref => {
552
552
  countryId: (_customer$countryId = customer === null || customer === void 0 ? void 0 : customer.countryId) !== null && _customer$countryId !== void 0 ? _customer$countryId : undefined,
553
553
  city: (_customer$city = customer === null || customer === void 0 ? void 0 : customer.city) !== null && _customer$city !== void 0 ? _customer$city : undefined,
554
554
  email: (_customer$email = customer === null || customer === void 0 ? void 0 : customer.email) !== null && _customer$email !== void 0 ? _customer$email : undefined,
555
+ anwbId: discountCode !== null && discountCode !== void 0 && discountCode.toLocaleLowerCase().includes('anwb') ? (_ref3 = (_contextCustomer$anwb = contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.anwbId) !== null && _contextCustomer$anwb !== void 0 ? _contextCustomer$anwb : customer === null || customer === void 0 ? void 0 : customer.anwbId) !== null && _ref3 !== void 0 ? _ref3 : undefined : undefined,
555
556
  note: (_contextCustomer$note = contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.note) !== null && _contextCustomer$note !== void 0 ? _contextCustomer$note : undefined,
556
557
  zipCode: (_customer$zipCode = customer === null || customer === void 0 ? void 0 : customer.zipCode) !== null && _customer$zipCode !== void 0 ? _customer$zipCode : undefined,
557
558
  companyName: activeOwnershipType !== _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? (_customer$companyName = customer === null || customer === void 0 ? void 0 : customer.companyName) !== null && _customer$companyName !== void 0 ? _customer$companyName : undefined : undefined,
@@ -562,7 +563,7 @@ const InternalAppointmentForm = _ref => {
562
563
  appointment,
563
564
  appointmentType,
564
565
  channel,
565
- licensePlate: (_ref3 = licensePlate || _licensePlate) === null || _ref3 === void 0 ? void 0 : _ref3.replace(/-/g, ''),
566
+ licensePlate: (_ref4 = licensePlate || _licensePlate) === null || _ref4 === void 0 ? void 0 : _ref4.replace(/-/g, ''),
566
567
  model,
567
568
  chassisNumber,
568
569
  priceCalculationDate,
@@ -758,12 +759,12 @@ const InternalAppointmentForm = _ref => {
758
759
  placeholder: "Maak een keuze",
759
760
  errorMessage: (errors === null || errors === void 0 ? void 0 : errors['channelType']) || (errors === null || errors === void 0 ? void 0 : errors['channelId']),
760
761
  initialValue: initialChannel,
761
- onChange: _ref4 => {
762
+ onChange: _ref5 => {
762
763
  var _value$kanaalType, _value$kanaalType2;
763
764
  let {
764
765
  label,
765
766
  value
766
- } = _ref4;
767
+ } = _ref5;
767
768
  return dispatch({
768
769
  type: _OrderSessionContext.orderSessionActions.SET_MARKETING_CHANNEL,
769
770
  payload: {
@@ -1232,10 +1233,10 @@ const InternalAppointmentForm = _ref => {
1232
1233
  placeholder: "Selecteer een land",
1233
1234
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['countryId'],
1234
1235
  initialValue: (countryOptions === null || countryOptions === void 0 ? void 0 : countryOptions.find(option => option.value === (customer === null || customer === void 0 ? void 0 : customer.countryId))) || null,
1235
- onChange: _ref5 => {
1236
+ onChange: _ref6 => {
1236
1237
  let {
1237
1238
  value
1238
- } = _ref5;
1239
+ } = _ref6;
1239
1240
  return dispatch({
1240
1241
  type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
1241
1242
  payload: {
@@ -1341,10 +1342,10 @@ const InternalAppointmentForm = _ref => {
1341
1342
  placeholder: "Selecteer een land",
1342
1343
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['countryId'],
1343
1344
  initialValue: (countryOptions === null || countryOptions === void 0 ? void 0 : countryOptions.find(option => option.value === (customer === null || customer === void 0 ? void 0 : customer.countryId))) || null,
1344
- onChange: _ref6 => {
1345
+ onChange: _ref7 => {
1345
1346
  let {
1346
1347
  value
1347
- } = _ref6;
1348
+ } = _ref7;
1348
1349
  return dispatch({
1349
1350
  type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
1350
1351
  payload: {
@@ -1429,10 +1430,10 @@ const InternalAppointmentForm = _ref => {
1429
1430
  placeholder: "Selecteer een land",
1430
1431
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['countryId'],
1431
1432
  initialValue: (countryOptions === null || countryOptions === void 0 ? void 0 : countryOptions.find(option => option.value === (customer === null || customer === void 0 ? void 0 : customer.countryId))) || null,
1432
- onChange: _ref7 => {
1433
+ onChange: _ref8 => {
1433
1434
  let {
1434
1435
  value
1435
- } = _ref7;
1436
+ } = _ref8;
1436
1437
  return dispatch({
1437
1438
  type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
1438
1439
  payload: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.346",
3
+ "version": "0.0.348",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",
@@ -1,180 +0,0 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.array.sort.js");
4
- require("core-js/modules/es.number.to-fixed.js");
5
- require("core-js/modules/es.parse-float.js");
6
- require("core-js/modules/es.weak-map.js");
7
- require("core-js/modules/esnext.iterator.constructor.js");
8
- require("core-js/modules/esnext.iterator.filter.js");
9
- require("core-js/modules/esnext.iterator.for-each.js");
10
- require("core-js/modules/esnext.iterator.map.js");
11
- require("core-js/modules/web.dom-collections.iterator.js");
12
- require("core-js/modules/es.weak-map.js");
13
- require("core-js/modules/esnext.iterator.for-each.js");
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- exports.default = void 0;
18
- require("core-js/modules/es.array.sort.js");
19
- require("core-js/modules/es.number.to-fixed.js");
20
- require("core-js/modules/es.parse-float.js");
21
- require("core-js/modules/esnext.iterator.constructor.js");
22
- require("core-js/modules/esnext.iterator.filter.js");
23
- require("core-js/modules/esnext.iterator.map.js");
24
- require("core-js/modules/web.dom-collections.iterator.js");
25
- var _react = _interopRequireWildcard(require("react"));
26
- var _ActiveMarkerContext = require("../../__context__/ActiveMarkerContext");
27
- var _OrderSessionContext = require("../../__context__/OrderSessionContext");
28
- var _helpers__ = require("../../__helpers__");
29
- var _geolocation = require("../../__helpers__/geolocation");
30
- var _LocationListItem = _interopRequireDefault(require("./LocationListItem"));
31
- function _interopRequireDefault(e) {
32
- return e && e.__esModule ? e : {
33
- default: e
34
- };
35
- }
36
- function _getRequireWildcardCache(e) {
37
- if ("function" != typeof WeakMap) return null;
38
- var r = new WeakMap(),
39
- t = new WeakMap();
40
- return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
41
- return e ? t : r;
42
- })(e);
43
- }
44
- function _interopRequireWildcard(e, r) {
45
- if (!r && e && e.__esModule) return e;
46
- if (null === e || "object" != typeof e && "function" != typeof e) return {
47
- default: e
48
- };
49
- var t = _getRequireWildcardCache(r);
50
- if (t && t.has(e)) return t.get(e);
51
- var n = {
52
- __proto__: null
53
- },
54
- a = Object.defineProperty && Object.getOwnPropertyDescriptor;
55
- for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
56
- var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
57
- i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
58
- }
59
- return n.default = e, t && t.set(e, n), n;
60
- }
61
- function ownKeys(e, r) {
62
- var t = Object.keys(e);
63
- if (Object.getOwnPropertySymbols) {
64
- var o = Object.getOwnPropertySymbols(e);
65
- r && (o = o.filter(function (r) {
66
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
67
- })), t.push.apply(t, o);
68
- }
69
- return t;
70
- }
71
- function _objectSpread(e) {
72
- for (var r = 1; r < arguments.length; r++) {
73
- var t = null != arguments[r] ? arguments[r] : {};
74
- r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
75
- _defineProperty(e, r, t[r]);
76
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
77
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
78
- });
79
- }
80
- return e;
81
- }
82
- function _defineProperty(e, r, t) {
83
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
84
- value: t,
85
- enumerable: !0,
86
- configurable: !0,
87
- writable: !0
88
- }) : e[r] = t, e;
89
- }
90
- function _toPropertyKey(t) {
91
- var i = _toPrimitive(t, "string");
92
- return "symbol" == typeof i ? i : i + "";
93
- }
94
- function _toPrimitive(t, r) {
95
- if ("object" != typeof t || !t) return t;
96
- var e = t[Symbol.toPrimitive];
97
- if (void 0 !== e) {
98
- var i = e.call(t, r || "default");
99
- if ("object" != typeof i) return i;
100
- throw new TypeError("@@toPrimitive must return a primitive value.");
101
- }
102
- return ("string" === r ? String : Number)(t);
103
- }
104
- const LocationsLoading = () => {
105
- return /*#__PURE__*/_react.default.createElement("div", {
106
- className: (0, _helpers__.withStyle)('w-100 text-center')
107
- }, /*#__PURE__*/_react.default.createElement("div", {
108
- className: (0, _helpers__.withStyle)('spinner-border text-primary mx-auto'),
109
- role: "status"
110
- }, /*#__PURE__*/_react.default.createElement("span", {
111
- className: "sr-only"
112
- }, "Loading...")));
113
- };
114
- const NoLocationFound = () => {
115
- return /*#__PURE__*/_react.default.createElement("h4", null, "Geen montagelocaties gevonden");
116
- };
117
- const LocationList = _ref => {
118
- let {
119
- locationsById,
120
- locationIds,
121
- userLocation,
122
- isLocationSetViaSearch = false,
123
- isLoading = false
124
- } = _ref;
125
- const {
126
- activeMarkerId
127
- } = (0, _ActiveMarkerContext.useActiveMarker)();
128
- const [{
129
- selectedBranch
130
- }] = (0, _OrderSessionContext.useOrderSession)();
131
- const listRef = (0, _react.useRef)(null);
132
- const locationsWithDistance = locationIds.map((locationId, index) => {
133
- const location = locationsById[locationId];
134
- const coordinates = location.googleMapsLocation;
135
- if (!coordinates) return null;
136
- const [latStr, lngStr] = coordinates.split(',');
137
- const lat = parseFloat(latStr);
138
- const lng = parseFloat(lngStr);
139
- const distance = userLocation ? (0, _geolocation.calculateDistance)({
140
- lat1: userLocation.lat,
141
- lng1: userLocation.lng,
142
- lat2: lat,
143
- lng2: lng
144
- }).toFixed(2) : null;
145
- return _objectSpread(_objectSpread({}, location), {}, {
146
- distance: distance ? parseFloat(distance) : null
147
- });
148
- }).filter(location => location !== null);
149
- const sortedLocations = locationsWithDistance.sort((a, b) => {
150
- const aIsSelected = a.entityId === activeMarkerId || a.entityId === selectedBranch;
151
- const bIsSelected = b.entityId === activeMarkerId || b.entityId === selectedBranch;
152
- if (aIsSelected && !bIsSelected) return -1; // a goes to top
153
- if (!aIsSelected && bIsSelected) return 1; // b goes to top
154
-
155
- if (a.distance === null) return 1;
156
- if (b.distance === null) return -1;
157
- return a.distance - b.distance;
158
- });
159
-
160
- // Handle scrolling when location is set via search
161
- (0, _react.useEffect)(() => {
162
- if (isLocationSetViaSearch && listRef.current) {
163
- listRef.current.scrollTop = 0;
164
- }
165
- }, [isLocationSetViaSearch, userLocation]);
166
- return /*#__PURE__*/_react.default.createElement("div", {
167
- ref: listRef,
168
- className: (0, _helpers__.withStyle)('dealer-list')
169
- }, /*#__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, {
170
- openingHours: location.openingstijden,
171
- title: location.naamVestiging,
172
- city: location.city,
173
- distance: location.distance ? location.distance : null,
174
- id: location.entityId,
175
- key: location.entityId,
176
- isSelected: location.entityId === activeMarkerId || location.entityId === selectedBranch,
177
- userLocation: userLocation
178
- })));
179
- };
180
- var _default = exports.default = LocationList;
@@ -1,103 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", {
7
- value: true
8
- });
9
- exports.default = void 0;
10
- require("core-js/modules/web.dom-collections.iterator.js");
11
- var _react = _interopRequireWildcard(require("react"));
12
- var _ActiveMarkerContext = require("../../__context__/ActiveMarkerContext");
13
- var _OrderSessionContext = require("../../__context__/OrderSessionContext");
14
- var _helpers__ = require("../../__helpers__");
15
- var _LocationDetails = _interopRequireDefault(require("./LocationDetails"));
16
- function _interopRequireDefault(e) {
17
- return e && e.__esModule ? e : {
18
- default: e
19
- };
20
- }
21
- function _getRequireWildcardCache(e) {
22
- if ("function" != typeof WeakMap) return null;
23
- var r = new WeakMap(),
24
- t = new WeakMap();
25
- return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
26
- return e ? t : r;
27
- })(e);
28
- }
29
- function _interopRequireWildcard(e, r) {
30
- if (!r && e && e.__esModule) return e;
31
- if (null === e || "object" != typeof e && "function" != typeof e) return {
32
- default: e
33
- };
34
- var t = _getRequireWildcardCache(r);
35
- if (t && t.has(e)) return t.get(e);
36
- var n = {
37
- __proto__: null
38
- },
39
- a = Object.defineProperty && Object.getOwnPropertyDescriptor;
40
- for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
41
- var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
42
- i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
43
- }
44
- return n.default = e, t && t.set(e, n), n;
45
- }
46
- const LocationListItem = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
47
- let {
48
- title,
49
- city,
50
- distance,
51
- id,
52
- isSelected,
53
- userLocation
54
- } = _ref;
55
- const [{
56
- selectedBranch
57
- }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
58
- const {
59
- setActiveMarkerId
60
- } = (0, _ActiveMarkerContext.useActiveMarker)();
61
- const handleClick = () => {
62
- setActiveMarkerId(prevId => prevId === id ? null : id);
63
- dispatch({
64
- payload: {
65
- branchId: selectedBranch === id ? null : id
66
- },
67
- type: _OrderSessionContext.orderSessionActions.SET_SELECTED_BRANCH
68
- });
69
- };
70
- return /*#__PURE__*/_react.default.createElement("div", {
71
- ref: ref,
72
- className: (0, _helpers__.withStyle)("dealer-item ".concat(isSelected ? 'active' : '')),
73
- onClick: handleClick
74
- }, /*#__PURE__*/_react.default.createElement("div", {
75
- className: (0, _helpers__.withStyle)('row justify-content-between')
76
- }, /*#__PURE__*/_react.default.createElement("div", {
77
- className: (0, _helpers__.withStyle)('col d-flex flex-column justify-content-between')
78
- }, /*#__PURE__*/_react.default.createElement("h5", {
79
- className: (0, _helpers__.withStyle)('fw-bold text-black')
80
- }, city), /*#__PURE__*/_react.default.createElement("small", null, title)), /*#__PURE__*/_react.default.createElement("div", {
81
- className: (0, _helpers__.withStyle)('col-auto d-flex flex-column align-items-end justify-content-between text-end')
82
- }, userLocation && isNaN(distance) === false && /*#__PURE__*/_react.default.createElement("p", {
83
- className: (0, _helpers__.withStyle)('dealer-item__distance')
84
- }, /*#__PURE__*/_react.default.createElement("i", {
85
- className: "fas fa-map-marker-alt"
86
- }), Math.round(distance), " km"), /*#__PURE__*/_react.default.createElement("div", {
87
- className: (0, _helpers__.withStyle)('form-check mb-0')
88
- }, /*#__PURE__*/_react.default.createElement("input", {
89
- type: "radio",
90
- className: (0, _helpers__.withStyle)('form-check-input'),
91
- name: "dealer-item-check",
92
- id: "dealer-item-check-".concat(id),
93
- autoComplete: "off",
94
- readOnly: true,
95
- checked: isSelected
96
- }), /*#__PURE__*/_react.default.createElement("label", {
97
- className: (0, _helpers__.withStyle)('form-check-label'),
98
- htmlFor: "dealer-item-check-".concat(id)
99
- }, isSelected ? 'Geselecteerd' : 'Selecteren')))), isSelected && APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_LocationDetails.default, {
100
- id: id
101
- }));
102
- });
103
- var _default = exports.default = LocationListItem;
@@ -1,96 +0,0 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.parse-float.js");
4
- require("core-js/modules/es.weak-map.js");
5
- require("core-js/modules/web.dom-collections.iterator.js");
6
- require("core-js/modules/es.weak-map.js");
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports.default = void 0;
11
- require("core-js/modules/es.parse-float.js");
12
- require("core-js/modules/web.dom-collections.iterator.js");
13
- var _reactGoogleMaps = require("@vis.gl/react-google-maps");
14
- var _react = _interopRequireWildcard(require("react"));
15
- var _mapMarkerThc = _interopRequireDefault(require("../../../../public/assets/images/map-marker-thc.png"));
16
- var _mapMarker = _interopRequireDefault(require("../../../../public/assets/images/map-marker.png"));
17
- var _constants__ = require("../../__constants__");
18
- var _FormulaContext = require("../../__context__/FormulaContext");
19
- function _interopRequireDefault(e) {
20
- return e && e.__esModule ? e : {
21
- default: e
22
- };
23
- }
24
- function _getRequireWildcardCache(e) {
25
- if ("function" != typeof WeakMap) return null;
26
- var r = new WeakMap(),
27
- t = new WeakMap();
28
- return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
29
- return e ? t : r;
30
- })(e);
31
- }
32
- function _interopRequireWildcard(e, r) {
33
- if (!r && e && e.__esModule) return e;
34
- if (null === e || "object" != typeof e && "function" != typeof e) return {
35
- default: e
36
- };
37
- var t = _getRequireWildcardCache(r);
38
- if (t && t.has(e)) return t.get(e);
39
- var n = {
40
- __proto__: null
41
- },
42
- a = Object.defineProperty && Object.getOwnPropertyDescriptor;
43
- for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
44
- var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
45
- i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
46
- }
47
- return n.default = e, t && t.set(e, n), n;
48
- }
49
- const LocationTreeMarker = /*#__PURE__*/_react.default.memo(_ref => {
50
- let {
51
- tree,
52
- onClick,
53
- setMarkerRef
54
- } = _ref;
55
- const core = (0, _reactGoogleMaps.useMapsLibrary)('core');
56
- const formula = (0, _FormulaContext.useFormula)();
57
- // Cache marker icon configuration
58
- const markerIcon = (0, _react.useMemo)(() => {
59
- if (!core) return {
60
- url: formula == _constants__.CONFIGURATOR_FORMULAS.THC ? _mapMarkerThc.default : _mapMarker.default
61
- };
62
- return {
63
- url: formula == _constants__.CONFIGURATOR_FORMULAS.THC ? _mapMarkerThc.default : _mapMarker.default,
64
- size: new core.Size(32, 42),
65
- anchor: new core.Point(16, 32),
66
- scaledSize: new core.Size(32, 42)
67
- };
68
- }, [core]);
69
- const handleClick = (0, _react.useCallback)(() => onClick(tree), [onClick, tree]);
70
- const ref = (0, _react.useCallback)(marker => setMarkerRef(marker, tree === null || tree === void 0 ? void 0 : tree.entityId), [setMarkerRef, tree === null || tree === void 0 ? void 0 : tree.entityId]);
71
-
72
- // Memoize position calculation
73
- const position = (0, _react.useMemo)(() => {
74
- const coordinates = tree === null || tree === void 0 ? void 0 : tree.googleMapsLocation;
75
- if (!coordinates) return null;
76
- const [latStr, lngStr] = coordinates.split(',');
77
- const lat = parseFloat(latStr);
78
- const lng = parseFloat(lngStr);
79
- return isNaN(lat) || isNaN(lng) ? null : {
80
- lat,
81
- lng
82
- };
83
- }, [tree === null || tree === void 0 ? void 0 : tree.googleMapsLocation]);
84
- if (!position) return null;
85
- return /*#__PURE__*/_react.default.createElement(_reactGoogleMaps.Marker, {
86
- optimized: true,
87
- position: position,
88
- ref: ref,
89
- onClick: handleClick,
90
- icon: markerIcon,
91
- clickable: true,
92
- visible: true,
93
- zIndex: 1
94
- });
95
- });
96
- var _default = exports.default = LocationTreeMarker;
@@ -1,162 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", {
7
- value: true
8
- });
9
- exports.default = void 0;
10
- require("core-js/modules/web.dom-collections.iterator.js");
11
- var _reactGoogleMaps = require("@vis.gl/react-google-maps");
12
- var _react = _interopRequireWildcard(require("react"));
13
- var _queries = require("../../__api__/queries");
14
- var _constants__ = require("../../__constants__");
15
- var _ActiveMarkerContext = require("../../__context__/ActiveMarkerContext");
16
- var _AuthSessionContext = require("../../__context__/AuthSessionContext");
17
- var _FormulaContext = require("../../__context__/FormulaContext");
18
- var _OrderSessionContext = require("../../__context__/OrderSessionContext");
19
- var _helpers__ = require("../../__helpers__");
20
- var _useBreakpoint = _interopRequireDefault(require("../../__hooks__/useBreakpoint"));
21
- var _useUserLocation = _interopRequireDefault(require("../../__hooks__/useUserLocation"));
22
- var _LocationAutoComplete = _interopRequireDefault(require("./LocationAutoComplete"));
23
- var _LocationClusteredMap = _interopRequireDefault(require("./LocationClusteredMap"));
24
- var _LocationList = _interopRequireDefault(require("./LocationList"));
25
- function _interopRequireDefault(e) {
26
- return e && e.__esModule ? e : {
27
- default: e
28
- };
29
- }
30
- function _getRequireWildcardCache(e) {
31
- if ("function" != typeof WeakMap) return null;
32
- var r = new WeakMap(),
33
- t = new WeakMap();
34
- return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
35
- return e ? t : r;
36
- })(e);
37
- }
38
- function _interopRequireWildcard(e, r) {
39
- if (!r && e && e.__esModule) return e;
40
- if (null === e || "object" != typeof e && "function" != typeof e) return {
41
- default: e
42
- };
43
- var t = _getRequireWildcardCache(r);
44
- if (t && t.has(e)) return t.get(e);
45
- var n = {
46
- __proto__: null
47
- },
48
- a = Object.defineProperty && Object.getOwnPropertyDescriptor;
49
- for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
50
- var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
51
- i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
52
- }
53
- return n.default = e, t && t.set(e, n), n;
54
- }
55
- const Loaded = /*#__PURE__*/_react.default.memo(_ref => {
56
- let {
57
- children
58
- } = _ref;
59
- const markers = (0, _reactGoogleMaps.useMapsLibrary)('marker');
60
- const isLoaded = (0, _reactGoogleMaps.useApiIsLoaded)();
61
- return isLoaded && markers && children;
62
- });
63
- const LocationsSelector = /*#__PURE__*/_react.default.memo(() => {
64
- const [userLocation, setUserLocation] = (0, _useUserLocation.default)();
65
- const [isLocationSetViaSearch, setIsLocationSetViaSearch] = (0, _react.useState)(false);
66
- const {
67
- setActiveMarkerId
68
- } = (0, _ActiveMarkerContext.useActiveMarker)();
69
- const [, dispatch] = (0, _OrderSessionContext.useOrderSession)();
70
- const screen = (0, _useBreakpoint.default)();
71
- const isDesktop = screen.size >= 1200;
72
- const formula = (0, _FormulaContext.useFormula)();
73
- const [{
74
- franchiseName
75
- }] = (0, _OrderSessionContext.useOrderSession)();
76
- const authSession = (0, _AuthSessionContext.useAuthSession)();
77
- const {
78
- branchTypes
79
- } = (0, _queries.useBranchTypes)();
80
- const isTMGOrganization = _react.default.useMemo(() => {
81
- var _branchTypes$byId$aut, _authSession$branch;
82
- return (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) === _constants__.TMG_ORGANIZATION_TYPE;
83
- }, [branchTypes, authSession]);
84
- const {
85
- branches
86
- } = (0, _queries.useBranchesQuery)({
87
- offset: 0,
88
- limit: 400,
89
- formula,
90
- franchiseName
91
- });
92
- const {
93
- myBranches
94
- } = (0, _queries.useMyBranches)(formula);
95
- const locations = isTMGOrganization || !APP_CONFIG.internal ? (branches === null || branches === void 0 ? void 0 : branches.results) || [] : myBranches || [];
96
- const {
97
- byId,
98
- allIds
99
- } = (0, _react.useMemo)(() => (0, _helpers__.normalizeArray)({
100
- array: locations || [],
101
- key: 'entityId'
102
- }), [locations]);
103
-
104
- // Handle location updates from search
105
- const handleLocationUpdate = function handleLocationUpdate(newLocation) {
106
- let fromSearch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
107
- setUserLocation(newLocation);
108
- setIsLocationSetViaSearch(fromSearch);
109
-
110
- // Close any open marker popups when searching for a new location
111
- if (fromSearch) {
112
- setActiveMarkerId(null);
113
-
114
- // Also clear any selected branch to avoid confusion
115
- dispatch({
116
- payload: {
117
- branchId: null
118
- },
119
- type: _OrderSessionContext.orderSessionActions.SET_SELECTED_BRANCH
120
- });
121
- }
122
- };
123
- return /*#__PURE__*/_react.default.createElement(_reactGoogleMaps.APIProvider, {
124
- apiKey: APP_CONFIG.googleMapsApiKey,
125
- libraries: ['marker']
126
- }, /*#__PURE__*/_react.default.createElement(Loaded, null, APP_CONFIG.internal ? /*#__PURE__*/_react.default.createElement("div", {
127
- className: (0, _helpers__.withStyle)('row gx-5 mt-3 mt-xl-5')
128
- }, /*#__PURE__*/_react.default.createElement("div", {
129
- className: (0, _helpers__.withStyle)('content col-xl-8')
130
- }, /*#__PURE__*/_react.default.createElement("div", {
131
- className: (0, _helpers__.withStyle)(isDesktop ? 'dealer-map__container' : 'dealer-map')
132
- }, /*#__PURE__*/_react.default.createElement(_LocationClusteredMap.default, {
133
- locationIds: allIds,
134
- locationsById: byId,
135
- userLocation: userLocation
136
- }))), /*#__PURE__*/_react.default.createElement("aside", {
137
- className: (0, _helpers__.withStyle)('dealer-sidebar col-xl-4 mt-3 mt-xl-0')
138
- }, isDesktop && /*#__PURE__*/_react.default.createElement(_LocationAutoComplete.default, {
139
- onLocationUpdate: handleLocationUpdate
140
- }), franchiseName && /*#__PURE__*/_react.default.createElement("h6", {
141
- className: (0, _helpers__.withStyle)('my-2')
142
- }, "Keten: ", franchiseName), /*#__PURE__*/_react.default.createElement(_LocationList.default, {
143
- locationIds: allIds,
144
- locationsById: byId,
145
- userLocation: userLocation,
146
- isLocationSetViaSearch: isLocationSetViaSearch
147
- }))) : /*#__PURE__*/_react.default.createElement("div", {
148
- className: (0, _helpers__.withStyle)('row gx-5 mt-3 mt-xl-5 justify-content-center')
149
- }, /*#__PURE__*/_react.default.createElement("aside", {
150
- className: (0, _helpers__.withStyle)('dealer-sidebar col-xl-4 mt-3 mt-xl-0')
151
- }, isDesktop && /*#__PURE__*/_react.default.createElement(_LocationAutoComplete.default, {
152
- onLocationUpdate: handleLocationUpdate
153
- }), franchiseName && /*#__PURE__*/_react.default.createElement("h6", {
154
- className: (0, _helpers__.withStyle)('my-2')
155
- }, "Keten: ", franchiseName), /*#__PURE__*/_react.default.createElement(_LocationList.default, {
156
- locationIds: allIds,
157
- locationsById: byId,
158
- userLocation: userLocation,
159
- isLocationSetViaSearch: isLocationSetViaSearch
160
- })))));
161
- });
162
- var _default = exports.default = LocationsSelector;