@abcagency/hc-ui-components 1.3.58 → 1.3.59

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 (152) hide show
  1. package/dist/apis/hcApi.js +85 -85
  2. package/dist/apis/hcApi.js.map +1 -1
  3. package/dist/clientToken.js.map +1 -1
  4. package/dist/components/containers/accordions/filter-container.js.map +1 -1
  5. package/dist/components/containers/accordions/map-accordion-item-container.js.map +1 -1
  6. package/dist/components/containers/jobListing/listing-details-container.js.map +1 -1
  7. package/dist/components/containers/list/item-list-container.js +21 -21
  8. package/dist/components/containers/list/list-item/list-item-container.js.map +1 -1
  9. package/dist/components/containers/maps/map-container.js.map +1 -1
  10. package/dist/components/modules/accordions/MapAccordionItem.js.map +1 -1
  11. package/dist/components/modules/accordions/default.js.map +1 -1
  12. package/dist/components/modules/buttons/commute-pill.js.map +1 -1
  13. package/dist/components/modules/buttons/default.js.map +1 -1
  14. package/dist/components/modules/buttons/items-pill.js.map +1 -1
  15. package/dist/components/modules/buttons/pill-wrapper.js.map +1 -1
  16. package/dist/components/modules/buttons/show-all-button.js.map +1 -1
  17. package/dist/components/modules/cards/default.js.map +1 -1
  18. package/dist/components/modules/cards/filter.js.map +1 -1
  19. package/dist/components/modules/filter/item.js.map +1 -1
  20. package/dist/components/modules/filter/sort.js.map +1 -1
  21. package/dist/components/modules/grid.js.map +1 -1
  22. package/dist/components/modules/icon.js.map +1 -1
  23. package/dist/components/modules/list/header.js.map +1 -1
  24. package/dist/components/modules/list/item-list.js +40 -40
  25. package/dist/components/modules/maps/info-window-card.js.map +1 -1
  26. package/dist/components/modules/maps/map.js.map +1 -1
  27. package/dist/components/modules/maps/place-marker.js.map +1 -1
  28. package/dist/components/modules/maps/tabs.js.map +1 -1
  29. package/dist/constants/placeTypes.js.map +1 -1
  30. package/dist/contexts/mapContext.js +83 -83
  31. package/dist/contexts/mapListContext.js +190 -190
  32. package/dist/contexts/trackEventContext.js.map +1 -1
  33. package/dist/hooks/useList.js.map +1 -1
  34. package/dist/services/configService.js +9 -9
  35. package/dist/services/googlePlacesNearbyService.js +32 -32
  36. package/dist/services/googlePlacesNearbyService.js.map +1 -1
  37. package/dist/services/listingAggregatorService.js +34 -34
  38. package/dist/services/listingAggregatorService.js.map +1 -1
  39. package/dist/services/listingEntityService.js +9 -9
  40. package/dist/services/listingService.js +24 -24
  41. package/dist/services/recruiterService.js +10 -10
  42. package/dist/types/apis/hcApi.d.ts +5 -5
  43. package/dist/types/clientToken.d.ts +2 -2
  44. package/dist/types/components/containers/accordions/map-accordion-item-container.d.ts +12 -12
  45. package/dist/types/components/containers/jobListing/listing-details-container.d.ts +6 -6
  46. package/dist/types/components/containers/list/item-list-container.d.ts +9 -9
  47. package/dist/types/components/containers/list/list-item/list-item-container.d.ts +14 -14
  48. package/dist/types/components/modules/accordions/MapAccordionItem.d.ts +10 -10
  49. package/dist/types/components/modules/accordions/default.d.ts +19 -19
  50. package/dist/types/components/modules/buttons/button-group-apply.d.ts +24 -24
  51. package/dist/types/components/modules/buttons/commute-pill.d.ts +5 -5
  52. package/dist/types/components/modules/buttons/default.d.ts +48 -48
  53. package/dist/types/components/modules/buttons/pill-wrapper.d.ts +3 -3
  54. package/dist/types/components/modules/dialogs/apply-dialog.d.ts +8 -8
  55. package/dist/types/components/modules/filter/sort.d.ts +8 -8
  56. package/dist/types/components/modules/grid.d.ts +8 -8
  57. package/dist/types/components/modules/icon.d.ts +10 -10
  58. package/dist/types/components/modules/jobListing/listing-details.d.ts +18 -18
  59. package/dist/types/components/modules/list/field-mapper.d.ts +10 -10
  60. package/dist/types/components/modules/list/header-item.d.ts +11 -11
  61. package/dist/types/components/modules/list/header.d.ts +12 -12
  62. package/dist/types/components/modules/list/item-expand-card/index.d.ts +7 -7
  63. package/dist/types/components/modules/list/item-expand-card/recruiter-contact-nav.d.ts +17 -17
  64. package/dist/types/components/modules/list/item-expand-card/recruiter-details.d.ts +21 -21
  65. package/dist/types/components/modules/list/item-expand-card/recruiter-headshot.d.ts +8 -8
  66. package/dist/types/components/modules/list/item-list.d.ts +20 -20
  67. package/dist/types/components/modules/list/list-item/list-item.d.ts +3 -3
  68. package/dist/types/constants/eventTypes.d.ts +14 -14
  69. package/dist/types/contexts/mapContext.d.ts +29 -29
  70. package/dist/types/contexts/mapListContext.d.ts +61 -61
  71. package/dist/types/contexts/trackEventContext.d.ts +6 -6
  72. package/dist/types/enums/SectionType.d.ts +9 -9
  73. package/dist/types/hooks/useList.d.ts +13 -13
  74. package/dist/types/services/configService.d.ts +6 -6
  75. package/dist/types/services/googlePlacesNearbyService.d.ts +5 -5
  76. package/dist/types/services/listingAggregatorService.d.ts +12 -12
  77. package/dist/types/services/listingEntityService.d.ts +6 -6
  78. package/dist/types/services/listingService.d.ts +9 -9
  79. package/dist/types/services/recruiterService.d.ts +6 -6
  80. package/dist/types/types/Address.d.ts +7 -7
  81. package/dist/types/types/ContentSection.d.ts +8 -8
  82. package/dist/types/types/GetListingParams.d.ts +8 -8
  83. package/dist/types/types/LatLng.d.ts +4 -4
  84. package/dist/types/types/ListingEntity.d.ts +10 -10
  85. package/dist/types/types/ListingFields.d.ts +25 -25
  86. package/dist/types/types/Listings.d.ts +31 -31
  87. package/dist/types/types/Recruiter.d.ts +9 -9
  88. package/dist/types/types/SimilarListing.d.ts +24 -24
  89. package/dist/types/types/config/Colors.d.ts +8 -8
  90. package/dist/types/types/config/MapConfig.d.ts +30 -30
  91. package/dist/types/types/config/PointsOfInterestConfig.d.ts +13 -13
  92. package/dist/types/types/config/SearchConfig.d.ts +4 -4
  93. package/dist/types/util/filterUtil.d.ts +28 -28
  94. package/dist/types/util/loading.d.ts +3 -3
  95. package/dist/types/util/localStorageUtil.d.ts +3 -3
  96. package/dist/types/util/mapUtil.d.ts +16 -16
  97. package/dist/types/util/sortUtil.d.ts +1 -1
  98. package/dist/types/util/stringUtils.d.ts +1 -1
  99. package/dist/types/util/urlFilterUtil.d.ts +8 -8
  100. package/dist/util/filterUtil.js +2 -2
  101. package/dist/util/filterUtil.js.map +1 -1
  102. package/dist/util/loading.js.map +1 -1
  103. package/dist/util/localStorageUtil.js +37 -37
  104. package/dist/util/localStorageUtil.js.map +1 -1
  105. package/dist/util/sortUtil.js.map +1 -1
  106. package/dist/util/stringUtils.js.map +1 -1
  107. package/dist/util/urlFilterUtil.js.map +1 -1
  108. package/package.json +1 -1
  109. package/src/apis/hcApi.ts +109 -109
  110. package/src/clientToken.js +9 -9
  111. package/src/components/containers/accordions/filter-container.js +48 -48
  112. package/src/components/containers/accordions/map-accordion-item-container.js +70 -70
  113. package/src/components/containers/jobListing/listing-details-container.js +40 -40
  114. package/src/components/containers/list/list-item/list-item-container.js +43 -43
  115. package/src/components/containers/maps/map-container.js +249 -249
  116. package/src/components/modules/accordions/MapAccordionItem.js +30 -30
  117. package/src/components/modules/accordions/default.js +171 -171
  118. package/src/components/modules/buttons/commute-pill.js +22 -22
  119. package/src/components/modules/buttons/default.js +194 -194
  120. package/src/components/modules/buttons/items-pill.js +35 -35
  121. package/src/components/modules/buttons/pill-wrapper.js +27 -27
  122. package/src/components/modules/buttons/show-all-button.js +19 -19
  123. package/src/components/modules/cards/default.js +167 -167
  124. package/src/components/modules/cards/filter.js +56 -56
  125. package/src/components/modules/filter/item.js +69 -69
  126. package/src/components/modules/filter/sort.js +83 -83
  127. package/src/components/modules/grid.js +54 -54
  128. package/src/components/modules/icon.js +33 -33
  129. package/src/components/modules/list/header.js +51 -51
  130. package/src/components/modules/list/item-expand-card/recruiter-contact-nav.js +50 -50
  131. package/src/components/modules/list/item-expand-card/recruiter-details.js +68 -68
  132. package/src/components/modules/list/item-expand-card/recruiter-headshot.js +22 -22
  133. package/src/components/modules/maps/info-window-card.js +17 -17
  134. package/src/components/modules/maps/map.js +64 -64
  135. package/src/components/modules/maps/place-marker.js +41 -41
  136. package/src/components/modules/maps/tabs.js +81 -81
  137. package/src/constants/placeTypes.js +8 -8
  138. package/src/contexts/trackEventContext.js +14 -14
  139. package/src/enums/SectionType.ts +9 -9
  140. package/src/hooks/useList.js +89 -89
  141. package/src/index.js +3 -3
  142. package/src/services/googlePlacesNearbyService.ts +42 -42
  143. package/src/services/listingAggregatorService.ts +76 -76
  144. package/src/util/arrayUtil.js +3 -3
  145. package/src/util/fieldMapper.js +22 -22
  146. package/src/util/filterUtil.js +311 -310
  147. package/src/util/loading.js +17 -17
  148. package/src/util/localStorageUtil.ts +34 -34
  149. package/src/util/sortUtil.js +32 -32
  150. package/src/util/stringUtils.js +6 -6
  151. package/src/util/urlFilterUtil.js +85 -85
  152. package/dist/types/contexts/themeContext.d.ts +0 -11
@@ -1,89 +1,89 @@
1
1
  import React__default, { createContext, useState, useRef, useEffect, useContext } from 'react';
2
2
  import { getStorageObject, setStorageObject } from '../util/localStorageUtil.js';
3
3
 
4
- const MapContext = createContext(undefined);
5
- const useMap = () => {
6
- const context = useContext(MapContext);
7
- if (!context) {
8
- throw new Error("useMap must be used within a MapProvider");
9
- }
10
- return context;
11
- };
12
- const MapProvider = ({ children, resetFilters }) => {
13
- const [selectedListItem, setSelectedListItem] = useState(getStorageObject('selectedListItem'));
14
- const [location, setLocation] = useState(getStorageObject('location'));
15
- const [center, setCenter] = useState(getStorageObject("center", { lat: 39.8283, lng: -98.5795 }) || { lat: 39.8283, lng: -98.5795 });
16
- const [zoom, setZoom] = useState(getStorageObject("zoom", 10) || 10);
17
- const [selectedPlaces, setSelectedPlaces] = useState([]);
18
- const [mapInteracted, setMapInteracted] = useState(false);
19
- const [firstLoadListItem] = useState(getStorageObject('selectedListItem', { id: "defaultId" }));
20
- const userSetZoom = useRef(true);
21
- useEffect(() => {
22
- setStorageObject("selectedListItem", selectedListItem);
23
- }, [selectedListItem]);
24
- useEffect(() => {
25
- localStorage.setItem("zoom", zoom.toString());
26
- }, [zoom]);
27
- useEffect(() => {
28
- if (location == null) {
29
- localStorage.removeItem("location");
30
- }
31
- else {
32
- setStorageObject("location", location);
33
- }
34
- }, [location]);
35
- useEffect(() => {
36
- setStorageObject("center", center);
37
- }, [center]);
38
- const selectItem = (item, itemLocation, zoom, center) => {
39
- setSelectedListItem(item);
40
- if (mapInteracted === false && itemLocation != null) {
41
- setLocation(itemLocation);
42
- }
43
- if (mapInteracted === false || itemLocation != null) {
44
- setLocation(itemLocation);
45
- setCenter(center);
46
- }
47
- if (mapInteracted === false) {
48
- setZoom(zoom);
49
- }
50
- };
51
- const filterReset = () => {
52
- setSelectedPlaces([]);
53
- setSelectedListItem(null);
54
- setLocation(null);
55
- setZoom(8);
56
- setMapInteracted(false);
57
- };
58
- useEffect(() => {
59
- if (resetFilters === true) {
60
- filterReset();
61
- }
62
- }, [resetFilters]);
63
- const selectLocationEntity = (location) => {
64
- localStorage.removeItem("selectedListItem");
65
- setTimeout(() => setLocation(location), 200);
66
- setSelectedListItem(null);
67
- };
68
- return (React__default.createElement(MapContext.Provider, { value: {
69
- selectedListItem,
70
- setSelectedListItem,
71
- location,
72
- center,
73
- setCenter,
74
- zoom,
75
- setZoom,
76
- selectItem,
77
- setSelectedPlaces,
78
- selectedPlaces,
79
- selectLocationEntity,
80
- setLocation,
81
- setMapInteracted,
82
- mapInteracted,
83
- userSetZoom,
84
- firstLoadListItem,
85
- filterReset
86
- } }, children));
4
+ const MapContext = createContext(undefined);
5
+ const useMap = () => {
6
+ const context = useContext(MapContext);
7
+ if (!context) {
8
+ throw new Error("useMap must be used within a MapProvider");
9
+ }
10
+ return context;
11
+ };
12
+ const MapProvider = ({ children, resetFilters }) => {
13
+ const [selectedListItem, setSelectedListItem] = useState(getStorageObject('selectedListItem'));
14
+ const [location, setLocation] = useState(getStorageObject('location'));
15
+ const [center, setCenter] = useState(getStorageObject("center", { lat: 39.8283, lng: -98.5795 }) || { lat: 39.8283, lng: -98.5795 });
16
+ const [zoom, setZoom] = useState(getStorageObject("zoom", 10) || 10);
17
+ const [selectedPlaces, setSelectedPlaces] = useState([]);
18
+ const [mapInteracted, setMapInteracted] = useState(false);
19
+ const [firstLoadListItem] = useState(getStorageObject('selectedListItem', { id: "defaultId" }));
20
+ const userSetZoom = useRef(true);
21
+ useEffect(() => {
22
+ setStorageObject("selectedListItem", selectedListItem);
23
+ }, [selectedListItem]);
24
+ useEffect(() => {
25
+ localStorage.setItem("zoom", zoom.toString());
26
+ }, [zoom]);
27
+ useEffect(() => {
28
+ if (location == null) {
29
+ localStorage.removeItem("location");
30
+ }
31
+ else {
32
+ setStorageObject("location", location);
33
+ }
34
+ }, [location]);
35
+ useEffect(() => {
36
+ setStorageObject("center", center);
37
+ }, [center]);
38
+ const selectItem = (item, itemLocation, zoom, center) => {
39
+ setSelectedListItem(item);
40
+ if (mapInteracted === false && itemLocation != null) {
41
+ setLocation(itemLocation);
42
+ }
43
+ if (mapInteracted === false || itemLocation != null) {
44
+ setLocation(itemLocation);
45
+ setCenter(center);
46
+ }
47
+ if (mapInteracted === false) {
48
+ setZoom(zoom);
49
+ }
50
+ };
51
+ const filterReset = () => {
52
+ setSelectedPlaces([]);
53
+ setSelectedListItem(null);
54
+ setLocation(null);
55
+ setZoom(8);
56
+ setMapInteracted(false);
57
+ };
58
+ useEffect(() => {
59
+ if (resetFilters === true) {
60
+ filterReset();
61
+ }
62
+ }, [resetFilters]);
63
+ const selectLocationEntity = (location) => {
64
+ localStorage.removeItem("selectedListItem");
65
+ setTimeout(() => setLocation(location), 200);
66
+ setSelectedListItem(null);
67
+ };
68
+ return (React__default.createElement(MapContext.Provider, { value: {
69
+ selectedListItem,
70
+ setSelectedListItem,
71
+ location,
72
+ center,
73
+ setCenter,
74
+ zoom,
75
+ setZoom,
76
+ selectItem,
77
+ setSelectedPlaces,
78
+ selectedPlaces,
79
+ selectLocationEntity,
80
+ setLocation,
81
+ setMapInteracted,
82
+ mapInteracted,
83
+ userSetZoom,
84
+ firstLoadListItem,
85
+ filterReset
86
+ } }, children));
87
87
  };
88
88
 
89
89
  export { MapProvider, useMap };
@@ -5,196 +5,196 @@ import { filtersFromURL, updateURLWithFilters } from '../util/urlFilterUtil.js';
5
5
  import { getListingEntities } from '../services/listingEntityService.js';
6
6
  import fetchListings from '../services/listingAggregatorService.js';
7
7
 
8
- const MapListContext = createContext(undefined);
9
- const useMapList = () => {
10
- const context = useContext(MapListContext);
11
- if (!context) {
12
- throw new Error('useMapList must be used within a MapListProvider');
13
- }
14
- return context;
15
- };
16
- const getQuery = () => {
17
- let query = null;
18
- if (typeof window !== 'undefined') {
19
- query = localStorage.getItem('query');
20
- }
21
- return query;
22
- };
23
- const MapListProvider = ({ children, siteConfig, resetFilters, navigateToDetails, navigateToEasyApply, Link, linkFormat, trackEvent, listings = [], setFiltersUrl, handleUrlUpdate, }) => {
24
- const firstLoadFilters = () => {
25
- let urlFilters = filtersFromURL(window.location)?.filters;
26
- return (setFiltersUrl === true && urlFilters && Object.keys(urlFilters).length > 0) ? urlFilters : getStorageObject('selectedFilters', {}) || {};
27
- };
28
- const [allListings, setAllListings] = useState([]);
29
- const [filteredListings, setFilteredListings] = useState([]);
30
- const [loading, setLoading] = useState(false);
31
- const [mapItems, setMapItems] = useState(getStorageObject('mapItems', []) || []);
32
- const [query, setQuery] = useState(() => resetFilters ? null : getQuery());
33
- const [sortSetting, setSortSetting] = useState(getStorageObject('sortSetting', { field: 'position', type: 'asc' }) || { field: 'position', type: 'asc' });
34
- const [listingEntities, setListingEntities] = useState({});
35
- const [firstLoad, setFirstLoad] = useState(true);
36
- const [commuteLocation, setCommuteLocation] = useState(getStorageObject('commuteLocation'));
37
- const [selectedFilters, setSelectedFilters] = useState(() => resetFilters ? {} : firstLoadFilters());
38
- const [filterOptions, setFilterOptions] = useState();
39
- const [recruiters, setRecruiters] = useState({});
40
- const [filterDialogIsOpen, setFilterDialogIsOpen] = useState(false);
41
- const [mobileTab, setMobileTab] = useState("listTab");
42
- const [favorites, setFavorites] = useState([]);
43
- const [filterByFavorites, setFilterByFavorites] = useState(false);
44
- const setNewFilteredListings = (filteredListings) => {
45
- setFilteredListings(filteredListings);
46
- };
47
- useEffect(() => {
48
- if (!sortSetting)
49
- return;
50
- localStorage.setItem('sortSetting', JSON.stringify(sortSetting));
51
- setNewFilteredListings(filteredListings);
52
- }, [sortSetting]);
53
- useEffect(() => {
54
- const loadedFavorites = JSON.parse(localStorage.getItem('favorites') || '[]');
55
- setFavorites(loadedFavorites);
56
- }, []);
57
- useEffect(() => {
58
- setStorageObject("commuteLocation", commuteLocation);
59
- }, [commuteLocation]);
60
- useEffect(() => {
61
- if (!commuteLocation)
62
- return;
63
- async function fetchEntities() {
64
- const distinctEntityIds = [
65
- ...new Set(allListings.map(listing => listing.entityId ?? -1))
66
- ];
67
- try {
68
- const fetchedEntities = await getListingEntities(distinctEntityIds, `${commuteLocation.lat}, ${commuteLocation.lng}`);
69
- setListingEntities(fetchedEntities);
70
- const newFilteredListings = [...filteredListings] ?? [];
71
- for (let i = 0; i < allListings.length; i++) {
72
- const listing = newFilteredListings[i];
73
- if (listing &&
74
- listing.fields &&
75
- listing.entityId !== undefined &&
76
- listing.entityId !== -1) {
77
- const entityId = listing.entityId;
78
- const travelTime = fetchedEntities[entityId]?.travelTime;
79
- if (travelTime !== undefined && listing.fields) {
80
- listing.fields.travelTime = travelTime;
81
- }
82
- }
83
- }
84
- }
85
- catch (error) {
86
- console.error("Failed to fetch listing entities:", error);
87
- }
88
- }
89
- fetchEntities();
90
- }, [commuteLocation, allListings, siteConfig.companyId]);
91
- useEffect(() => {
92
- const handleFetchListings = async () => {
93
- if (!getStorageObject('listings') ?? [].length) {
94
- setLoading(true);
95
- }
96
- try {
97
- const { listingsResult, fetchedRecruiters, fetchedEntities, distinctItems } = await fetchListings(query ?? '', siteConfig, commuteLocation);
98
- setAllListings(listingsResult);
99
- setRecruiters(fetchedRecruiters);
100
- setListingEntities(fetchedEntities);
101
- setMapItems(distinctItems);
102
- }
103
- catch (error) {
104
- console.log(error);
105
- }
106
- setLoading(false);
107
- };
108
- handleFetchListings();
109
- }, [query, siteConfig]);
110
- useEffect(() => {
111
- const processListings = () => {
112
- let filteredListings;
113
- let tempSelectedFilters = selectedFilters;
114
- let tempQuery = query;
115
- const { mapItems, filteredListings: tempFilteredListings } = applyFilters(allListings, tempSelectedFilters, tempQuery, listingEntities, favorites, siteConfig);
116
- filteredListings = tempFilteredListings;
117
- if (filterByFavorites) {
118
- filteredListings = filteredListings.filter((x) => favorites.includes(x.id));
119
- }
120
- setNewFilteredListings(filteredListings);
121
- if (firstLoad && tempSelectedFilters) ;
122
- else if (Object.keys(tempSelectedFilters).length === 0 && !firstLoad) {
123
- localStorage.removeItem('selectedFilters');
124
- }
125
- else if (!firstLoad) {
126
- setStorageObject('selectedFilters', tempSelectedFilters);
127
- }
128
- if (setFiltersUrl === true) {
129
- updateURLWithFilters(tempSelectedFilters, window.location, tempQuery, handleUrlUpdate);
130
- }
131
- tempQuery != null ? localStorage.setItem('query', tempQuery) : localStorage.removeItem('query');
132
- setMapItems(mapItems);
133
- if (tempSelectedFilters) {
134
- const keys = Object.keys(tempSelectedFilters);
135
- const lastKey = keys[keys.length - 1];
136
- const options = generateFilterOptions(filteredListings, allListings, siteConfig, filterOptions, lastKey, favorites, tempSelectedFilters);
137
- if (options) {
138
- setFilterOptions(options);
139
- if (firstLoad)
140
- setFirstLoad(false);
141
- }
142
- }
143
- };
144
- processListings();
145
- }, [selectedFilters, query, listingEntities, filterByFavorites, favorites]);
146
- const handleFilterListingsByLocation = (selectedLocation) => {
147
- const { filteredListings } = filterListingsByLocation(allListings, selectedLocation, listingEntities);
148
- setNewFilteredListings(filteredListings);
149
- };
150
- const resetEntityFilter = () => {
151
- let newFilters = { ...selectedFilters };
152
- delete newFilters.entityId;
153
- setSelectedFilters(newFilters);
154
- };
155
- const handleSettingFavorites = (newFavorites) => {
156
- if (newFavorites == null) {
157
- localStorage.removeItem('favorites');
158
- }
159
- else {
160
- setFavorites(newFavorites);
161
- localStorage.setItem('favorites', JSON.stringify(newFavorites));
162
- }
163
- };
164
- return (React__default.createElement(MapListContext.Provider, { value: {
165
- loading,
166
- allListings,
167
- filteredListings,
168
- mapItems,
169
- query,
170
- setNewFilteredListings,
171
- setQuery,
172
- listingEntities,
173
- selectedFilters,
174
- setSelectedFilters,
175
- filterOptions,
176
- recruiters,
177
- handleFilterListingsByLocation,
178
- filterDialogIsOpen,
179
- setFilterDialogIsOpen,
180
- setMobileTab,
181
- mobileTab,
182
- siteConfig,
183
- favorites,
184
- handleSettingFavorites,
185
- resetEntityFilter,
186
- setFilterByFavorites,
187
- filterByFavorites,
188
- commuteLocation,
189
- setCommuteLocation,
190
- navigateToDetails,
191
- navigateToEasyApply,
192
- Link,
193
- linkFormat,
194
- sortSetting,
195
- setSortSetting,
196
- trackEvent
197
- } }, children));
8
+ const MapListContext = createContext(undefined);
9
+ const useMapList = () => {
10
+ const context = useContext(MapListContext);
11
+ if (!context) {
12
+ throw new Error('useMapList must be used within a MapListProvider');
13
+ }
14
+ return context;
15
+ };
16
+ const getQuery = () => {
17
+ let query = null;
18
+ if (typeof window !== 'undefined') {
19
+ query = localStorage.getItem('query');
20
+ }
21
+ return query;
22
+ };
23
+ const MapListProvider = ({ children, siteConfig, resetFilters, navigateToDetails, navigateToEasyApply, Link, linkFormat, trackEvent, listings = [], setFiltersUrl, handleUrlUpdate, }) => {
24
+ const firstLoadFilters = () => {
25
+ let urlFilters = filtersFromURL(window.location)?.filters;
26
+ return (setFiltersUrl === true && urlFilters && Object.keys(urlFilters).length > 0) ? urlFilters : getStorageObject('selectedFilters', {}) || {};
27
+ };
28
+ const [allListings, setAllListings] = useState([]);
29
+ const [filteredListings, setFilteredListings] = useState([]);
30
+ const [loading, setLoading] = useState(false);
31
+ const [mapItems, setMapItems] = useState(getStorageObject('mapItems', []) || []);
32
+ const [query, setQuery] = useState(() => resetFilters ? null : getQuery());
33
+ const [sortSetting, setSortSetting] = useState(getStorageObject('sortSetting', { field: 'position', type: 'asc' }) || { field: 'position', type: 'asc' });
34
+ const [listingEntities, setListingEntities] = useState({});
35
+ const [firstLoad, setFirstLoad] = useState(true);
36
+ const [commuteLocation, setCommuteLocation] = useState(getStorageObject('commuteLocation'));
37
+ const [selectedFilters, setSelectedFilters] = useState(() => resetFilters ? {} : firstLoadFilters());
38
+ const [filterOptions, setFilterOptions] = useState();
39
+ const [recruiters, setRecruiters] = useState({});
40
+ const [filterDialogIsOpen, setFilterDialogIsOpen] = useState(false);
41
+ const [mobileTab, setMobileTab] = useState("listTab");
42
+ const [favorites, setFavorites] = useState([]);
43
+ const [filterByFavorites, setFilterByFavorites] = useState(false);
44
+ const setNewFilteredListings = (filteredListings) => {
45
+ setFilteredListings(filteredListings);
46
+ };
47
+ useEffect(() => {
48
+ if (!sortSetting)
49
+ return;
50
+ localStorage.setItem('sortSetting', JSON.stringify(sortSetting));
51
+ setNewFilteredListings(filteredListings);
52
+ }, [sortSetting]);
53
+ useEffect(() => {
54
+ const loadedFavorites = JSON.parse(localStorage.getItem('favorites') || '[]');
55
+ setFavorites(loadedFavorites);
56
+ }, []);
57
+ useEffect(() => {
58
+ setStorageObject("commuteLocation", commuteLocation);
59
+ }, [commuteLocation]);
60
+ useEffect(() => {
61
+ if (!commuteLocation)
62
+ return;
63
+ async function fetchEntities() {
64
+ const distinctEntityIds = [
65
+ ...new Set(allListings.map(listing => listing.entityId ?? -1))
66
+ ];
67
+ try {
68
+ const fetchedEntities = await getListingEntities(distinctEntityIds, `${commuteLocation.lat}, ${commuteLocation.lng}`);
69
+ setListingEntities(fetchedEntities);
70
+ const newFilteredListings = [...filteredListings] ?? [];
71
+ for (let i = 0; i < allListings.length; i++) {
72
+ const listing = newFilteredListings[i];
73
+ if (listing &&
74
+ listing.fields &&
75
+ listing.entityId !== undefined &&
76
+ listing.entityId !== -1) {
77
+ const entityId = listing.entityId;
78
+ const travelTime = fetchedEntities[entityId]?.travelTime;
79
+ if (travelTime !== undefined && listing.fields) {
80
+ listing.fields.travelTime = travelTime;
81
+ }
82
+ }
83
+ }
84
+ }
85
+ catch (error) {
86
+ console.error("Failed to fetch listing entities:", error);
87
+ }
88
+ }
89
+ fetchEntities();
90
+ }, [commuteLocation, allListings, siteConfig.companyId]);
91
+ useEffect(() => {
92
+ const handleFetchListings = async () => {
93
+ if (!getStorageObject('listings') ?? [].length) {
94
+ setLoading(true);
95
+ }
96
+ try {
97
+ const { listingsResult, fetchedRecruiters, fetchedEntities, distinctItems } = await fetchListings(query ?? '', siteConfig, commuteLocation);
98
+ setAllListings(listingsResult);
99
+ setRecruiters(fetchedRecruiters);
100
+ setListingEntities(fetchedEntities);
101
+ setMapItems(distinctItems);
102
+ }
103
+ catch (error) {
104
+ console.log(error);
105
+ }
106
+ setLoading(false);
107
+ };
108
+ handleFetchListings();
109
+ }, [query, siteConfig]);
110
+ useEffect(() => {
111
+ const processListings = () => {
112
+ let filteredListings;
113
+ let tempSelectedFilters = selectedFilters;
114
+ let tempQuery = query;
115
+ const { mapItems, filteredListings: tempFilteredListings } = applyFilters(allListings, tempSelectedFilters, tempQuery, listingEntities, favorites, siteConfig);
116
+ filteredListings = tempFilteredListings;
117
+ if (filterByFavorites) {
118
+ filteredListings = filteredListings.filter((x) => favorites.includes(x.id));
119
+ }
120
+ setNewFilteredListings(filteredListings);
121
+ if (firstLoad && tempSelectedFilters) ;
122
+ else if (Object.keys(tempSelectedFilters).length === 0 && !firstLoad) {
123
+ localStorage.removeItem('selectedFilters');
124
+ }
125
+ else if (!firstLoad) {
126
+ setStorageObject('selectedFilters', tempSelectedFilters);
127
+ }
128
+ if (setFiltersUrl === true) {
129
+ updateURLWithFilters(tempSelectedFilters, window.location, tempQuery, handleUrlUpdate);
130
+ }
131
+ tempQuery != null ? localStorage.setItem('query', tempQuery) : localStorage.removeItem('query');
132
+ setMapItems(mapItems);
133
+ if (tempSelectedFilters) {
134
+ const keys = Object.keys(tempSelectedFilters);
135
+ const lastKey = keys[keys.length - 1];
136
+ const options = generateFilterOptions(filteredListings, allListings, siteConfig, filterOptions, lastKey, favorites, tempSelectedFilters);
137
+ if (options) {
138
+ setFilterOptions(options);
139
+ if (firstLoad)
140
+ setFirstLoad(false);
141
+ }
142
+ }
143
+ };
144
+ processListings();
145
+ }, [selectedFilters, query, listingEntities, filterByFavorites, favorites]);
146
+ const handleFilterListingsByLocation = (selectedLocation) => {
147
+ const { filteredListings } = filterListingsByLocation(allListings, selectedLocation, listingEntities);
148
+ setNewFilteredListings(filteredListings);
149
+ };
150
+ const resetEntityFilter = () => {
151
+ let newFilters = { ...selectedFilters };
152
+ delete newFilters.entityId;
153
+ setSelectedFilters(newFilters);
154
+ };
155
+ const handleSettingFavorites = (newFavorites) => {
156
+ if (newFavorites == null) {
157
+ localStorage.removeItem('favorites');
158
+ }
159
+ else {
160
+ setFavorites(newFavorites);
161
+ localStorage.setItem('favorites', JSON.stringify(newFavorites));
162
+ }
163
+ };
164
+ return (React__default.createElement(MapListContext.Provider, { value: {
165
+ loading,
166
+ allListings,
167
+ filteredListings,
168
+ mapItems,
169
+ query,
170
+ setNewFilteredListings,
171
+ setQuery,
172
+ listingEntities,
173
+ selectedFilters,
174
+ setSelectedFilters,
175
+ filterOptions,
176
+ recruiters,
177
+ handleFilterListingsByLocation,
178
+ filterDialogIsOpen,
179
+ setFilterDialogIsOpen,
180
+ setMobileTab,
181
+ mobileTab,
182
+ siteConfig,
183
+ favorites,
184
+ handleSettingFavorites,
185
+ resetEntityFilter,
186
+ setFilterByFavorites,
187
+ filterByFavorites,
188
+ commuteLocation,
189
+ setCommuteLocation,
190
+ navigateToDetails,
191
+ navigateToEasyApply,
192
+ Link,
193
+ linkFormat,
194
+ sortSetting,
195
+ setSortSetting,
196
+ trackEvent
197
+ } }, children));
198
198
  };
199
199
 
200
200
  export { MapListProvider, useMapList };
@@ -1 +1 @@
1
- {"version":3,"file":"trackEventContext.js","sources":["../../src/contexts/trackEventContext.js"],"sourcesContent":["import React, { createContext, useContext } from 'react';\r\nimport { eventTypes } from '~/constants/eventTypes';\r\n\r\nconst TrackEventContext = createContext();\r\n\r\nexport const useTrackEvent = () => useContext(TrackEventContext);\r\n\r\nexport const TrackEventProvider = ({ children, trackEvent }) => {\r\n\treturn (\r\n\t\t<TrackEventContext.Provider value={{ trackEvent, eventTypes }}>\r\n\t\t\t{children}\r\n\t\t</TrackEventContext.Provider>\r\n\t);\r\n};\r\n"],"names":["TrackEventContext","createContext","useTrackEvent","useContext","TrackEventProvider","_ref","children","trackEvent","React","createElement","Provider","value","eventTypes"],"mappings":";;;AAGA,IAAMA,iBAAiB,gBAAGC,aAAa,EAAE,CAAA;AAE5BC,IAAAA,aAAa,GAAG,SAAhBA,aAAaA,GAAA;EAAA,OAASC,UAAU,CAACH,iBAAiB,CAAC,CAAA;AAAA,EAAA;IAEnDI,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAAiC;AAAA,EAAA,IAA3BC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAEC,UAAU,GAAAF,IAAA,CAAVE,UAAU,CAAA;AACxD,EAAA,oBACCC,cAAA,CAAAC,aAAA,CAACT,iBAAiB,CAACU,QAAQ,EAAA;AAACC,IAAAA,KAAK,EAAE;AAAEJ,MAAAA,UAAU,EAAVA,UAAU;AAAEK,MAAAA,UAAU,EAAVA,UAAAA;AAAW,KAAA;AAAE,GAAA,EAC5DN,QAC0B,CAAC,CAAA;AAE/B;;;;"}
1
+ {"version":3,"file":"trackEventContext.js","sources":["../../src/contexts/trackEventContext.js"],"sourcesContent":["import React, { createContext, useContext } from 'react';\nimport { eventTypes } from '~/constants/eventTypes';\n\nconst TrackEventContext = createContext();\n\nexport const useTrackEvent = () => useContext(TrackEventContext);\n\nexport const TrackEventProvider = ({ children, trackEvent }) => {\n\treturn (\n\t\t<TrackEventContext.Provider value={{ trackEvent, eventTypes }}>\n\t\t\t{children}\n\t\t</TrackEventContext.Provider>\n\t);\n};\n"],"names":["TrackEventContext","createContext","useTrackEvent","useContext","TrackEventProvider","_ref","children","trackEvent","React","createElement","Provider","value","eventTypes"],"mappings":";;;AAGA,IAAMA,iBAAiB,gBAAGC,aAAa,EAAE,CAAA;AAE5BC,IAAAA,aAAa,GAAG,SAAhBA,aAAaA,GAAA;EAAA,OAASC,UAAU,CAACH,iBAAiB,CAAC,CAAA;AAAA,EAAA;IAEnDI,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAAiC;AAAA,EAAA,IAA3BC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAEC,UAAU,GAAAF,IAAA,CAAVE,UAAU,CAAA;AACxD,EAAA,oBACCC,cAAA,CAAAC,aAAA,CAACT,iBAAiB,CAACU,QAAQ,EAAA;AAACC,IAAAA,KAAK,EAAE;AAAEJ,MAAAA,UAAU,EAAVA,UAAU;AAAEK,MAAAA,UAAU,EAAVA,UAAAA;AAAW,KAAA;AAAE,GAAA,EAC5DN,QAC0B,CAAC,CAAA;AAE/B;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useList.js","sources":["../../src/hooks/useList.js"],"sourcesContent":["import { useEffect, useState, useRef } from 'react';\r\n\r\nimport { getStorageObject } from '~/util/localStorageUtil';\r\n\r\nconst getDefaultItemId = () => {\r\n\tlet item = getStorageObject(\"selectedListItem\");\r\n\tif (item?.expanded == true) {\r\n\t\treturn item.id;\r\n\t} else {\r\n\t\treturn null;\r\n\t}\r\n};\r\n\r\nconst useListLogic = filteredListings => {\r\n\tconst [itemLimit, setItemLimit] = useState(100);\r\n\tconst [expandedId] = useState(getDefaultItemId());\r\n\tconst [sortSetting, setSortSetting] = useState(getStorageObject('sortSetting', null));\r\n\tconst [scrollPosition, setScrollPosition] = useState(getStorageObject('scrollPosition', 0));\r\n\tconst loader = useRef(null);\r\n\tconst scrollContainerRef = useRef(null);\r\n\tconst itemRefs = useRef({});\r\n\tconst observer = useRef(null);\r\n\r\n\tuseEffect(() => {\r\n\t\tobserver.current = new IntersectionObserver(handleObserver, {\r\n\t\t\troot: scrollContainerRef.current,\r\n\t\t\trootMargin: \"100px 0px\",\r\n\t\t\tthreshold: 0.5\r\n\t\t});\r\n\t\tconst { current } = loader;\r\n\t\tif (current) {\r\n\t\t\tobserver.current.observe(current);\r\n\t\t}\r\n\t\treturn () => {\r\n\t\t\tif (observer.current && current) {\r\n\t\t\t\tobserver.current.unobserve(current);\r\n\t\t\t}\r\n\t\t};\r\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\r\n\t}, [filteredListings.length, itemLimit]);\r\n\r\n\tuseEffect(() => {\r\n\t\tlocalStorage.setItem('scrollPosition', scrollPosition.toString());\r\n\t}, [scrollPosition]);\r\n\r\n\tuseEffect(() => {\r\n\t\tconst savedScrollPosition = scrollPosition;\r\n\t\tif (parseInt(savedScrollPosition) > 3000) {\r\n\t\t\tsetItemLimit(savedScrollPosition / 10);\r\n\t\t}\r\n\t\tif (savedScrollPosition && scrollContainerRef.current) {\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tscrollContainerRef.current.scrollTop = parseInt(savedScrollPosition, 10);\r\n\t\t\t}, 300);\r\n\t\t}\r\n\t}, []);\r\n\r\n\tuseEffect(() => {\r\n\t\tconst { current } = scrollContainerRef;\r\n\t\tif (current) {\r\n\t\t\tcurrent.addEventListener('scroll', handleScroll);\r\n\t\t}\r\n\t\treturn () => {\r\n\t\t\tif (current) {\r\n\t\t\t\tcurrent.removeEventListener('scroll', handleScroll);\r\n\t\t\t}\r\n\t\t};\r\n\t}, []);\r\n\r\n\tconst handleObserver = entities => {\r\n\t\tconst target = entities[0];\r\n\t\tif (!target.isIntersecting) return;\r\n\t\tif (filteredListings.length > itemLimit) {\r\n\t\t\tsetItemLimit(prevLimit => prevLimit + 100);\r\n\t\t} else if (observer.current) {\r\n\t\t\tobserver.current.disconnect();\r\n\t\t}\r\n\t};\r\n\r\n\tconst handleScroll = () => {\r\n\t\tif (scrollContainerRef.current) {\r\n\t\t\tsetScrollPosition(scrollContainerRef.current.scrollTop);\r\n\t\t}\r\n\t};\r\n\r\n\treturn { itemLimit, expandedId, sortSetting, scrollPosition, loader, scrollContainerRef, itemRefs, setSortSetting, setScrollPosition, filteredListings };\r\n};\r\n\r\nexport default useListLogic;\r\n"],"names":["getDefaultItemId","item","getStorageObject","expanded","id","useListLogic","filteredListings","_useState","useState","_useState2","_slicedToArray","itemLimit","setItemLimit","_useState3","_useState4","expandedId","_useState5","_useState6","sortSetting","setSortSetting","_useState7","_useState8","scrollPosition","setScrollPosition","loader","useRef","scrollContainerRef","itemRefs","observer","useEffect","current","IntersectionObserver","handleObserver","root","rootMargin","threshold","observe","unobserve","length","localStorage","setItem","toString","savedScrollPosition","parseInt","setTimeout","scrollTop","addEventListener","handleScroll","removeEventListener","entities","target","isIntersecting","prevLimit","disconnect"],"mappings":";;;;AAIA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgBA,GAAS;AAC9B,EAAA,IAAIC,IAAI,GAAGC,gBAAgB,CAAC,kBAAkB,CAAC,CAAA;EAC/C,IAAI,CAAAD,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAJA,IAAI,CAAEE,QAAQ,KAAI,IAAI,EAAE;IAC3B,OAAOF,IAAI,CAACG,EAAE,CAAA;AACf,GAAC,MAAM;AACN,IAAA,OAAO,IAAI,CAAA;AACZ,GAAA;AACD,CAAC,CAAA;AAED,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAGC,gBAAgB,EAAI;AACxC,EAAA,IAAAC,SAAA,GAAkCC,QAAQ,CAAC,GAAG,CAAC;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAxCI,IAAAA,SAAS,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,YAAY,GAAAH,UAAA,CAAA,CAAA,CAAA,CAAA;AAC9B,EAAA,IAAAI,UAAA,GAAqBL,QAAQ,CAACR,gBAAgB,EAAE,CAAC;IAAAc,UAAA,GAAAJ,cAAA,CAAAG,UAAA,EAAA,CAAA,CAAA;AAA1CE,IAAAA,UAAU,GAAAD,UAAA,CAAA,CAAA,CAAA,CAAA;EACjB,IAAAE,UAAA,GAAsCR,QAA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AAcA,CAAGiB,QAAQ,EAAI;AAClC,IAAA,IAAMC,MAAM,GAAGD,QAAQ,CAAC,CAAC,CAAC,CAAA;AAC1B,IAAA,IAAI,CAACC,MAAM,CAACC,cAAc,EAAE,OAAA;AAC5B,IAAA,IAAI7C,gBAAgB,CAACgC,MAAM,GAAG3B,SAAS,EAAE;MACxCC,YAAY,CAAC,UAAAwC,SAAS,EAAA;QAAA,OAAIA,SAAS,GAAG,GAAG,CAAA;OAAC,CAAA,CAAA;AAC3C,KAAC,MAAM,IAAIxB,QAAQ,CAACE,OAAO,EAAE;AAC5BF,MAAAA,QAAQ,CAACE,OAAO,CAACuB,UAAU,EAAE,CAAA;AAC9B,KAAA;GACA,CAAA;AAED,EAAA,IAAMN,YAAY,GAAG,SAAfA,YAAYA,GAAS;IAC1B,IAAIrB,kBAAkB,CAACI,OAAO,EAAE;AAC/BP,MAAAA,iBAAiB,CAACG,kBAAkB,CAACI,OAAO,CAACe,SAAS,CAAC,CAAA;AACxD,KAAA;GACA,CAAA;EAED,OAAO;AAAElC,IAAAA,SAAS,EAATA,SAAS;AAAEI,IAAAA,UAAU,EAAVA,UAAU;AAAEG,IAAAA,WAAW,EAAXA,WAAW;AAAEI,IAAAA,cAAc,EAAdA,cAAc;AAAEE,IAAAA,MAAM,EAANA,MAAM;AAAEE,IAAAA,kBAAkB,EAAlBA,kBAAkB;AAAEC,IAAAA,QAAQ,EAARA,QAAQ;AAAER,IAAAA,cAAc,EAAdA,cAAc;AAAEI,IAAAA,iBAAiB,EAAjBA,iBAAiB;AAAEjB,IAAAA,gBAAgB,EAAhBA,gBAAAA;GAAkB,CAAA;AACzJ;;;;"}
1
+ {"version":3,"file":"useList.js","sources":["../../src/hooks/useList.js"],"sourcesContent":["import { useEffect, useState, useRef } from 'react';\n\nimport { getStorageObject } from '~/util/localStorageUtil';\n\nconst getDefaultItemId = () => {\n\tlet item = getStorageObject(\"selectedListItem\");\n\tif (item?.expanded == true) {\n\t\treturn item.id;\n\t} else {\n\t\treturn null;\n\t}\n};\n\nconst useListLogic = filteredListings => {\n\tconst [itemLimit, setItemLimit] = useState(100);\n\tconst [expandedId] = useState(getDefaultItemId());\n\tconst [sortSetting, setSortSetting] = useState(getStorageObject('sortSetting', null));\n\tconst [scrollPosition, setScrollPosition] = useState(getStorageObject('scrollPosition', 0));\n\tconst loader = useRef(null);\n\tconst scrollContainerRef = useRef(null);\n\tconst itemRefs = useRef({});\n\tconst observer = useRef(null);\n\n\tuseEffect(() => {\n\t\tobserver.current = new IntersectionObserver(handleObserver, {\n\t\t\troot: scrollContainerRef.current,\n\t\t\trootMargin: \"100px 0px\",\n\t\t\tthreshold: 0.5\n\t\t});\n\t\tconst { current } = loader;\n\t\tif (current) {\n\t\t\tobserver.current.observe(current);\n\t\t}\n\t\treturn () => {\n\t\t\tif (observer.current && current) {\n\t\t\t\tobserver.current.unobserve(current);\n\t\t\t}\n\t\t};\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [filteredListings.length, itemLimit]);\n\n\tuseEffect(() => {\n\t\tlocalStorage.setItem('scrollPosition', scrollPosition.toString());\n\t}, [scrollPosition]);\n\n\tuseEffect(() => {\n\t\tconst savedScrollPosition = scrollPosition;\n\t\tif (parseInt(savedScrollPosition) > 3000) {\n\t\t\tsetItemLimit(savedScrollPosition / 10);\n\t\t}\n\t\tif (savedScrollPosition && scrollContainerRef.current) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tscrollContainerRef.current.scrollTop = parseInt(savedScrollPosition, 10);\n\t\t\t}, 300);\n\t\t}\n\t}, []);\n\n\tuseEffect(() => {\n\t\tconst { current } = scrollContainerRef;\n\t\tif (current) {\n\t\t\tcurrent.addEventListener('scroll', handleScroll);\n\t\t}\n\t\treturn () => {\n\t\t\tif (current) {\n\t\t\t\tcurrent.removeEventListener('scroll', handleScroll);\n\t\t\t}\n\t\t};\n\t}, []);\n\n\tconst handleObserver = entities => {\n\t\tconst target = entities[0];\n\t\tif (!target.isIntersecting) return;\n\t\tif (filteredListings.length > itemLimit) {\n\t\t\tsetItemLimit(prevLimit => prevLimit + 100);\n\t\t} else if (observer.current) {\n\t\t\tobserver.current.disconnect();\n\t\t}\n\t};\n\n\tconst handleScroll = () => {\n\t\tif (scrollContainerRef.current) {\n\t\t\tsetScrollPosition(scrollContainerRef.current.scrollTop);\n\t\t}\n\t};\n\n\treturn { itemLimit, expandedId, sortSetting, scrollPosition, loader, scrollContainerRef, itemRefs, setSortSetting, setScrollPosition, filteredListings };\n};\n\nexport default useListLogic;\n"],"names":["getDefaultItemId","item","getStorageObject","expanded","id","useListLogic","filteredListings","_useState","useState","_useState2","_slicedToArray","itemLimit","setItemLimit","_useState3","_useState4","expandedId","_useState5","_useState6","sortSetting","setSortSetting","_useState7","_useState8","scrollPosition","setScrollPosition","loader","useRef","scrollContainerRef","itemRefs","observer","useEffect","current","IntersectionObserver","handleObserver","root","rootMargin","threshold","observe","unobserve","length","localStorage","setItem","toString","savedScrollPosition","parseInt","setTimeout","scrollTop","addEventListener","handleScroll","removeEventListener","entities","target","isIntersecting","prevLimit","disconnect"],"mappings":";;;;AAIA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgBA,GAAS;AAC9B,EAAA,IAAIC,IAAI,GAAGC,gBAAgB,CAAC,kBAAkB,CAAC,CAAA;EAC/C,IAAI,CAAAD,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAJA,IAAI,CAAEE,QAAQ,KAAI,IAAI,EAAE;IAC3B,OAAOF,IAAI,CAACG,EAAE,CAAA;AACf,GAAC,MAAM;AACN,IAAA,OAAO,IAAI,CAAA;AACZ,GAAA;AACD,CAAC,CAAA;AAED,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAGC,gBAAgB,EAAI;AACxC,EAAA,IAAAC,SAAA,GAAkCC,QAAQ,CAAC,GAAG,CAAC;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAA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dA,cAAc;AAAEI,IAAAA,iBAAiB,EAAjBA,iBAAiB;AAAEjB,IAAAA,gBAAgB,EAAhBA,gBAAAA;GAAkB,CAAA;AACzJ;;;;"}
@@ -1,14 +1,14 @@
1
1
  import api from '../apis/hcApi.js';
2
2
 
3
- const getMapConfig = async () => {
4
- try {
5
- const response = await api.get(`/MapConfig`);
6
- return response;
7
- }
8
- catch (error) {
9
- console.error("Error retrieving map configuration:", error);
10
- throw error;
11
- }
3
+ const getMapConfig = async () => {
4
+ try {
5
+ const response = await api.get(`/MapConfig`);
6
+ return response;
7
+ }
8
+ catch (error) {
9
+ console.error("Error retrieving map configuration:", error);
10
+ throw error;
11
+ }
12
12
  };
13
13
 
14
14
  export { getMapConfig };