@abcagency/hc-ui-components 1.3.59 → 1.3.61

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 (277) 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/HireControlMap.js +11 -1
  5. package/dist/components/HireControlMap.js.map +1 -1
  6. package/dist/components/containers/accordions/filter-container.js.map +1 -1
  7. package/dist/components/containers/accordions/filter-item-container.js.map +1 -1
  8. package/dist/components/containers/accordions/map-accordion-item-container.js.map +1 -1
  9. package/dist/components/containers/filter/commute-container.js +1 -1
  10. package/dist/components/containers/filter/commute-container.js.map +1 -1
  11. package/dist/components/containers/filter/filter-container.js.map +1 -1
  12. package/dist/components/containers/filter/filter-item-container.js.map +1 -1
  13. package/dist/components/containers/filter/location-container.js.map +1 -1
  14. package/dist/components/containers/filter/points-of-interest-container.js.map +1 -1
  15. package/dist/components/containers/filter/points-of-interest-radio-item-container.js.map +1 -1
  16. package/dist/components/containers/filter/search-container.js.map +1 -1
  17. package/dist/components/containers/jobListing/listing-details-container.js +5 -1
  18. package/dist/components/containers/jobListing/listing-details-container.js.map +1 -1
  19. package/dist/components/containers/list/item-list-container.js +21 -21
  20. package/dist/components/containers/list/item-list-container.js.map +1 -1
  21. package/dist/components/containers/list/list-item/list-item-container.js.map +1 -1
  22. package/dist/components/containers/maps/info-window-content-container.js.map +1 -1
  23. package/dist/components/containers/maps/map-container.js +1 -1
  24. package/dist/components/containers/maps/map-container.js.map +1 -1
  25. package/dist/components/containers/maps/map-list-container.js.map +1 -1
  26. package/dist/components/containers/maps/map-marker-container.js +1 -1
  27. package/dist/components/containers/maps/map-marker-container.js.map +1 -1
  28. package/dist/components/modules/accordions/MapAccordionItem.js.map +1 -1
  29. package/dist/components/modules/accordions/default.js +2 -2
  30. package/dist/components/modules/accordions/default.js.map +1 -1
  31. package/dist/components/modules/accordions/filterItem.js.map +1 -1
  32. package/dist/components/modules/accordions/filters.js.map +1 -1
  33. package/dist/components/modules/buttons/button-group-apply.js +45 -54
  34. package/dist/components/modules/buttons/button-group-apply.js.map +1 -1
  35. package/dist/components/modules/buttons/commute-pill.js.map +1 -1
  36. package/dist/components/modules/buttons/default.js +2 -2
  37. package/dist/components/modules/buttons/default.js.map +1 -1
  38. package/dist/components/modules/buttons/items-pill.js.map +1 -1
  39. package/dist/components/modules/buttons/pill-wrapper.js.map +1 -1
  40. package/dist/components/modules/buttons/show-all-button.js.map +1 -1
  41. package/dist/components/modules/cards/default.js +2 -2
  42. package/dist/components/modules/cards/default.js.map +1 -1
  43. package/dist/components/modules/cards/filter.js.map +1 -1
  44. package/dist/components/modules/dialogs/apply-dialog.js +1 -1
  45. package/dist/components/modules/dialogs/apply-dialog.js.map +1 -1
  46. package/dist/components/modules/filter/commute.js +2 -2
  47. package/dist/components/modules/filter/commute.js.map +1 -1
  48. package/dist/components/modules/filter/index.js.map +1 -1
  49. package/dist/components/modules/filter/item.js.map +1 -1
  50. package/dist/components/modules/filter/location.js.map +1 -1
  51. package/dist/components/modules/filter/radio-item.js.map +1 -1
  52. package/dist/components/modules/filter/search.js.map +1 -1
  53. package/dist/components/modules/filter/sort.js +2 -2
  54. package/dist/components/modules/filter/sort.js.map +1 -1
  55. package/dist/components/modules/grid.js +1 -1
  56. package/dist/components/modules/grid.js.map +1 -1
  57. package/dist/components/modules/icon.js +1 -1
  58. package/dist/components/modules/icon.js.map +1 -1
  59. package/dist/components/modules/jobListing/listing-details.js +8 -7
  60. package/dist/components/modules/jobListing/listing-details.js.map +1 -1
  61. package/dist/components/modules/list/field-mapper.js.map +1 -1
  62. package/dist/components/modules/list/header-item.js.map +1 -1
  63. package/dist/components/modules/list/header.js +1 -1
  64. package/dist/components/modules/list/header.js.map +1 -1
  65. package/dist/components/modules/list/item-expand-card/index.js +1 -1
  66. package/dist/components/modules/list/item-expand-card/index.js.map +1 -1
  67. package/dist/components/modules/list/item-expand-card/recruiter-contact-nav.js +38 -38
  68. package/dist/components/modules/list/item-expand-card/recruiter-details.js +40 -40
  69. package/dist/components/modules/list/item-expand-card/recruiter-headshot.js +20 -20
  70. package/dist/components/modules/list/item-list.js +43 -43
  71. package/dist/components/modules/list/item-list.js.map +1 -1
  72. package/dist/components/modules/list/list-item/list-item.js.map +1 -1
  73. package/dist/components/modules/maps/info-window-card.js.map +1 -1
  74. package/dist/components/modules/maps/info-window-content.js.map +1 -1
  75. package/dist/components/modules/maps/map-list.js.map +1 -1
  76. package/dist/components/modules/maps/map-marker.js +1 -1
  77. package/dist/components/modules/maps/map-marker.js.map +1 -1
  78. package/dist/components/modules/maps/map.js +1 -1
  79. package/dist/components/modules/maps/map.js.map +1 -1
  80. package/dist/components/modules/maps/place-marker.js +1 -1
  81. package/dist/components/modules/maps/place-marker.js.map +1 -1
  82. package/dist/components/modules/maps/tabs.js +1 -1
  83. package/dist/components/modules/maps/tabs.js.map +1 -1
  84. package/dist/constants/eventTypes.js +1 -0
  85. package/dist/constants/eventTypes.js.map +1 -1
  86. package/dist/constants/placeTypes.js.map +1 -1
  87. package/dist/contexts/mapContext.js +83 -83
  88. package/dist/contexts/mapContext.js.map +1 -1
  89. package/dist/contexts/mapListContext.js +192 -190
  90. package/dist/contexts/mapListContext.js.map +1 -1
  91. package/dist/contexts/placesContext.js.map +1 -1
  92. package/dist/contexts/themeContext.js.map +1 -1
  93. package/dist/contexts/trackEventContext.js.map +1 -1
  94. package/dist/hooks/useList.js.map +1 -1
  95. package/dist/services/configService.js +9 -9
  96. package/dist/services/configService.js.map +1 -1
  97. package/dist/services/googlePlacesNearbyService.js +32 -32
  98. package/dist/services/googlePlacesNearbyService.js.map +1 -1
  99. package/dist/services/listingAggregatorService.js +34 -34
  100. package/dist/services/listingAggregatorService.js.map +1 -1
  101. package/dist/services/listingEntityService.js +9 -9
  102. package/dist/services/listingEntityService.js.map +1 -1
  103. package/dist/services/listingService.js +24 -24
  104. package/dist/services/listingService.js.map +1 -1
  105. package/dist/services/recruiterService.js +10 -10
  106. package/dist/services/recruiterService.js.map +1 -1
  107. package/dist/types/apis/hcApi.d.ts +5 -5
  108. package/dist/types/clientToken.d.ts +2 -2
  109. package/dist/types/components/containers/accordions/map-accordion-item-container.d.ts +12 -12
  110. package/dist/types/components/containers/jobListing/listing-details-container.d.ts +6 -6
  111. package/dist/types/components/containers/list/item-list-container.d.ts +9 -9
  112. package/dist/types/components/containers/list/list-item/list-item-container.d.ts +14 -14
  113. package/dist/types/components/modules/accordions/MapAccordionItem.d.ts +10 -10
  114. package/dist/types/components/modules/accordions/default.d.ts +19 -19
  115. package/dist/types/components/modules/buttons/button-group-apply.d.ts +24 -24
  116. package/dist/types/components/modules/buttons/commute-pill.d.ts +5 -5
  117. package/dist/types/components/modules/buttons/default.d.ts +48 -48
  118. package/dist/types/components/modules/buttons/pill-wrapper.d.ts +3 -3
  119. package/dist/types/components/modules/dialogs/apply-dialog.d.ts +8 -8
  120. package/dist/types/components/modules/filter/sort.d.ts +8 -8
  121. package/dist/types/components/modules/grid.d.ts +8 -8
  122. package/dist/types/components/modules/icon.d.ts +10 -10
  123. package/dist/types/components/modules/jobListing/listing-details.d.ts +20 -18
  124. package/dist/types/components/modules/list/field-mapper.d.ts +10 -10
  125. package/dist/types/components/modules/list/header-item.d.ts +11 -11
  126. package/dist/types/components/modules/list/header.d.ts +12 -12
  127. package/dist/types/components/modules/list/item-expand-card/index.d.ts +7 -7
  128. package/dist/types/components/modules/list/item-expand-card/recruiter-contact-nav.d.ts +17 -17
  129. package/dist/types/components/modules/list/item-expand-card/recruiter-details.d.ts +21 -21
  130. package/dist/types/components/modules/list/item-expand-card/recruiter-headshot.d.ts +8 -8
  131. package/dist/types/components/modules/list/item-list.d.ts +20 -20
  132. package/dist/types/components/modules/list/list-item/list-item.d.ts +3 -3
  133. package/dist/types/constants/eventTypes.d.ts +15 -14
  134. package/dist/types/contexts/mapContext.d.ts +29 -29
  135. package/dist/types/contexts/mapListContext.d.ts +65 -61
  136. package/dist/types/contexts/trackEventContext.d.ts +6 -6
  137. package/dist/types/enums/SectionType.d.ts +9 -9
  138. package/dist/types/hooks/useList.d.ts +13 -13
  139. package/dist/types/services/configService.d.ts +6 -6
  140. package/dist/types/services/googlePlacesNearbyService.d.ts +5 -5
  141. package/dist/types/services/listingAggregatorService.d.ts +12 -12
  142. package/dist/types/services/listingEntityService.d.ts +6 -6
  143. package/dist/types/services/listingService.d.ts +9 -9
  144. package/dist/types/services/recruiterService.d.ts +6 -6
  145. package/dist/types/types/Address.d.ts +7 -7
  146. package/dist/types/types/ContentSection.d.ts +8 -8
  147. package/dist/types/types/GetListingParams.d.ts +8 -8
  148. package/dist/types/types/LatLng.d.ts +4 -4
  149. package/dist/types/types/ListingEntity.d.ts +10 -10
  150. package/dist/types/types/ListingFields.d.ts +25 -25
  151. package/dist/types/types/Listings.d.ts +31 -31
  152. package/dist/types/types/Recruiter.d.ts +9 -9
  153. package/dist/types/types/SimilarListing.d.ts +24 -24
  154. package/dist/types/types/config/Colors.d.ts +8 -8
  155. package/dist/types/types/config/MapConfig.d.ts +30 -30
  156. package/dist/types/types/config/PointsOfInterestConfig.d.ts +13 -13
  157. package/dist/types/types/config/SearchConfig.d.ts +4 -4
  158. package/dist/types/util/filterUtil.d.ts +28 -28
  159. package/dist/types/util/loading.d.ts +3 -3
  160. package/dist/types/util/localStorageUtil.d.ts +3 -3
  161. package/dist/types/util/mapUtil.d.ts +16 -16
  162. package/dist/types/util/sortUtil.d.ts +1 -1
  163. package/dist/types/util/stringUtils.d.ts +1 -1
  164. package/dist/types/util/urlFilterUtil.d.ts +8 -8
  165. package/dist/util/filterUtil.js +1 -1
  166. package/dist/util/filterUtil.js.map +1 -1
  167. package/dist/util/loading.js.map +1 -1
  168. package/dist/util/localStorageUtil.js +37 -37
  169. package/dist/util/localStorageUtil.js.map +1 -1
  170. package/dist/util/mapIconUtil.js.map +1 -1
  171. package/dist/util/mapUtil.js.map +1 -1
  172. package/dist/util/sortUtil.js.map +1 -1
  173. package/dist/util/stringUtils.js.map +1 -1
  174. package/dist/util/urlFilterUtil.js.map +1 -1
  175. package/package.json +90 -90
  176. package/src/.editorconfig +12 -12
  177. package/src/apis/hcApi.ts +109 -109
  178. package/src/bundleIndex.js +14 -14
  179. package/src/clientToken.js +9 -9
  180. package/src/components/HireControlMap.js +148 -142
  181. package/src/components/containers/accordions/filter-container.js +48 -48
  182. package/src/components/containers/accordions/filter-item-container.js +83 -83
  183. package/src/components/containers/accordions/map-accordion-item-container.js +70 -70
  184. package/src/components/containers/filter/commute-container.js +89 -89
  185. package/src/components/containers/filter/filter-container.js +76 -76
  186. package/src/components/containers/filter/filter-item-container.js +117 -117
  187. package/src/components/containers/filter/location-container.js +45 -45
  188. package/src/components/containers/filter/points-of-interest-container.js +33 -33
  189. package/src/components/containers/filter/points-of-interest-radio-item-container.js +35 -35
  190. package/src/components/containers/filter/search-container.js +61 -61
  191. package/src/components/containers/jobListing/listing-details-container.js +42 -40
  192. package/src/components/containers/list/item-list-container.tsx +81 -81
  193. package/src/components/containers/list/list-item/list-item-container.js +43 -43
  194. package/src/components/containers/maps/info-window-content-container.js +53 -53
  195. package/src/components/containers/maps/map-container.js +249 -249
  196. package/src/components/containers/maps/map-list-container.js +50 -50
  197. package/src/components/containers/maps/map-marker-container.js +78 -78
  198. package/src/components/modules/accordions/MapAccordionItem.js +30 -30
  199. package/src/components/modules/accordions/default.js +171 -171
  200. package/src/components/modules/accordions/filterItem.js +27 -27
  201. package/src/components/modules/accordions/filters.js +32 -32
  202. package/src/components/modules/buttons/button-group-apply.js +115 -135
  203. package/src/components/modules/buttons/commute-pill.js +22 -22
  204. package/src/components/modules/buttons/default.js +194 -194
  205. package/src/components/modules/buttons/items-pill.js +35 -35
  206. package/src/components/modules/buttons/pill-wrapper.js +27 -27
  207. package/src/components/modules/buttons/show-all-button.js +19 -19
  208. package/src/components/modules/cards/default.js +167 -167
  209. package/src/components/modules/cards/filter.js +56 -56
  210. package/src/components/modules/dialogs/apply-dialog.js +48 -48
  211. package/src/components/modules/filter/commute.js +108 -108
  212. package/src/components/modules/filter/index.js +55 -55
  213. package/src/components/modules/filter/item.js +69 -69
  214. package/src/components/modules/filter/location.js +51 -51
  215. package/src/components/modules/filter/radio-item.js +42 -42
  216. package/src/components/modules/filter/search.js +79 -79
  217. package/src/components/modules/filter/sort.js +83 -83
  218. package/src/components/modules/grid.js +54 -54
  219. package/src/components/modules/icon.js +33 -33
  220. package/src/components/modules/jobListing/listing-details.js +110 -108
  221. package/src/components/modules/list/field-mapper.js +130 -130
  222. package/src/components/modules/list/header-item.js +92 -92
  223. package/src/components/modules/list/header.js +51 -51
  224. package/src/components/modules/list/item-expand-card/index.js +22 -22
  225. package/src/components/modules/list/item-expand-card/recruiter-contact-nav.js +50 -50
  226. package/src/components/modules/list/item-expand-card/recruiter-details.js +68 -68
  227. package/src/components/modules/list/item-expand-card/recruiter-headshot.js +22 -22
  228. package/src/components/modules/list/item-list.tsx +117 -117
  229. package/src/components/modules/list/list-item/list-item.js +130 -130
  230. package/src/components/modules/maps/info-window-card.js +17 -17
  231. package/src/components/modules/maps/info-window-content.js +64 -64
  232. package/src/components/modules/maps/map-list.js +38 -38
  233. package/src/components/modules/maps/map-marker.js +29 -29
  234. package/src/components/modules/maps/map.js +64 -64
  235. package/src/components/modules/maps/place-marker.js +41 -41
  236. package/src/components/modules/maps/tabs.js +81 -81
  237. package/src/constants/eventTypes.js +15 -14
  238. package/src/constants/placeTypes.js +8 -8
  239. package/src/contexts/mapContext.tsx +129 -129
  240. package/src/contexts/mapListContext.tsx +326 -318
  241. package/src/contexts/placesContext.js +102 -102
  242. package/src/contexts/themeContext.js +40 -40
  243. package/src/contexts/trackEventContext.js +14 -14
  244. package/src/enums/SectionType.ts +9 -9
  245. package/src/hooks/useList.js +89 -89
  246. package/src/index.js +3 -3
  247. package/src/services/configService.ts +16 -16
  248. package/src/services/googlePlacesNearbyService.ts +42 -42
  249. package/src/services/listingAggregatorService.ts +76 -76
  250. package/src/services/listingEntityService.ts +16 -16
  251. package/src/services/listingService.ts +40 -40
  252. package/src/services/recruiterService.ts +18 -18
  253. package/src/styles/bundle.css +268 -268
  254. package/src/styles/index.css +33 -33
  255. package/src/types/Address.ts +7 -7
  256. package/src/types/ContentSection.ts +9 -9
  257. package/src/types/GetListingParams.ts +8 -8
  258. package/src/types/LatLng.ts +4 -4
  259. package/src/types/ListingEntity.ts +11 -11
  260. package/src/types/ListingFields.ts +25 -25
  261. package/src/types/Listings.ts +32 -32
  262. package/src/types/Recruiter.ts +9 -9
  263. package/src/types/SimilarListing.ts +24 -24
  264. package/src/types/config/Colors.ts +8 -8
  265. package/src/types/config/MapConfig.ts +31 -31
  266. package/src/types/config/PointsOfInterestConfig.ts +13 -13
  267. package/src/types/config/SearchConfig.ts +4 -4
  268. package/src/util/arrayUtil.js +3 -3
  269. package/src/util/fieldMapper.js +22 -22
  270. package/src/util/filterUtil.js +311 -311
  271. package/src/util/loading.js +17 -17
  272. package/src/util/localStorageUtil.ts +34 -34
  273. package/src/util/mapIconUtil.js +180 -180
  274. package/src/util/mapUtil.js +92 -92
  275. package/src/util/sortUtil.js +32 -32
  276. package/src/util/stringUtils.js +6 -6
  277. package/src/util/urlFilterUtil.js +85 -85
@@ -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 };
@@ -1 +1 @@
1
- {"version":3,"file":"mapContext.js","sources":["../../src/contexts/mapContext.tsx"],"sourcesContent":["import React, { createContext, useState, useContext, useEffect, useRef, ReactNode } from 'react';\nimport { getStorageObject, setStorageObject } from '~/util/localStorageUtil';\nimport { Listing } from '~/types/Listings';\nimport { LatLng } from '~/types/LatLng';\ninterface IMapContext {\n selectedListItem: Listing | null;\n setSelectedListItem: (item: Listing | null) => void;\n location: any | null;\n setLocation: (location: LatLng | null) => void;\n center: LatLng;\n setCenter: (center: LatLng) => void;\n zoom: number;\n setZoom: (zoom: number) => void;\n selectedPlaces: string[];\n setSelectedPlaces: (places: string[]) => void;\n mapInteracted: boolean;\n setMapInteracted: (interacted: boolean) => void;\n userSetZoom: React.MutableRefObject<boolean>;\n firstLoadListItem: any;\n selectItem: (item: Listing, itemLocation: LatLng | null, zoom: number, center: LatLng) => void;\n filterReset: () => void;\n selectLocationEntity: (location: LatLng) => void;\n}\n\nconst MapContext = createContext<IMapContext | undefined>(undefined);\n\nexport const useMap = () => {\n\tconst context = useContext(MapContext);\n\tif (!context) {\n\t\tthrow new Error(\"useMap must be used within a MapProvider\");\n\t}\n\treturn context;\n};\n\ninterface MapProviderProps {\n children: ReactNode;\n resetFilters: boolean;\n}\n\nexport const MapProvider: React.FC<MapProviderProps> = ({ children, resetFilters }) => {\n\tconst [selectedListItem, setSelectedListItem] = useState<Listing | null>(getStorageObject('selectedListItem'));\n\tconst [location, setLocation] = useState<any>(getStorageObject('location'));\n\tconst [center, setCenter] = useState<LatLng>(getStorageObject(\"center\", { lat: 39.8283, lng: -98.5795 }) || { lat: 39.8283, lng: -98.5795 });\n\tconst [zoom, setZoom] = useState<number>(getStorageObject(\"zoom\", 10) || 10);\n\tconst [selectedPlaces, setSelectedPlaces] = useState<string[]>([]);\n\tconst [mapInteracted, setMapInteracted] = useState<boolean>(false);\n\tconst [firstLoadListItem] = useState<any>(getStorageObject('selectedListItem', { id: \"defaultId\" }));\n\tconst userSetZoom = useRef<boolean>(true);\n\n\tuseEffect(() => {\n\t\tsetStorageObject(\"selectedListItem\", selectedListItem);\n\t}, [selectedListItem]);\n\n\tuseEffect(() => {\n\t\tlocalStorage.setItem(\"zoom\", zoom.toString());\n\t}, [zoom]);\n\n\tuseEffect(() => {\n\t\tif (location == null) {\n\t\t\tlocalStorage.removeItem(\"location\");\n\t\t} else {\n\t\t\tsetStorageObject(\"location\", location);\n\t\t}\n\t}, [location]);\n\n\tuseEffect(() => {\n\t\tsetStorageObject(\"center\", center);\n\t}, [center]);\n\n\tconst selectItem = (item: Listing, itemLocation: LatLng | null, zoom: number, center: LatLng) => {\n\t\tsetSelectedListItem(item);\n\t\tif (mapInteracted === false && itemLocation != null) {\n\t\t\tsetLocation(itemLocation);\n\t\t}\n\t\tif (mapInteracted === false || itemLocation != null) {\n\t\t\tsetLocation(itemLocation);\n\t\t\tsetCenter(center);\n\t\t}\n\t\tif (mapInteracted === false) {\n\t\t\tsetZoom(zoom);\n\t\t}\n\t};\n\n\tconst filterReset = () => {\n\t\tsetSelectedPlaces([]);\n\t\tsetSelectedListItem(null);\n\t\tsetLocation(null);\n\t\tsetZoom(8);\n\t\tsetMapInteracted(false);\n\t};\n\n\tuseEffect(() => {\n\t\tif (resetFilters === true) {\n\t\t\tfilterReset();\n\t\t}\n\t}, [resetFilters]);\n\n\tconst selectLocationEntity = (location: LatLng) => {\n\t\tlocalStorage.removeItem(\"selectedListItem\");\n\t\tsetTimeout(() => setLocation(location), 200);\n\t\tsetSelectedListItem(null);\n\t};\n\n\treturn (\n\t\t<MapContext.Provider\n\t\t\tvalue={{\n\t\t\t\tselectedListItem,\n\t\t\t\tsetSelectedListItem,\n\t\t\t\tlocation,\n\t\t\t\tcenter,\n\t\t\t\tsetCenter,\n\t\t\t\tzoom,\n\t\t\t\tsetZoom,\n\t\t\t\tselectItem,\n\t\t\t\tsetSelectedPlaces,\n\t\t\t\tselectedPlaces,\n\t\t\t\tselectLocationEntity,\n\t\t\t\tsetLocation,\n\t\t\t\tsetMapInteracted,\n\t\t\t\tmapInteracted,\n\t\t\t\tuserSetZoom,\n\t\t\t\tfirstLoadListItem,\n\t\t\t\tfilterReset\n\t\t\t}}\n\t\t>\n\t\t\t{children}\n\t\t</MapContext.Provider>\n\t);\n};\n"],"names":["React"],"mappings":";;;AAwBA,MAAM,UAAU,GAAG,aAAa,CAA0B,SAAS,CAAC,CAAC;AAE9D,MAAM,MAAM,GAAG,MAAK;AAC1B,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IACvC,IAAI,CAAC,OAAO,EAAE;AACb,QAAA,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;AAC5D,KAAA;AACD,IAAA,OAAO,OAAO,CAAC;AAChB,EAAE;AAOW,MAAA,WAAW,GAA+B,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAI;AACrF,IAAA,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAiB,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAC/G,IAAA,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAM,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC;AAC5E,IAAA,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAS,gBAAgB,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG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,EAAE;YACN,gBAAgB;YAChB,mBAAmB;YACnB,QAAQ;YACR,MAAM;YACN,SAAS;YACT,IAAI;YACJ,OAAO;YACP,UAAU;YACV,iBAAiB;YACjB,cAAc;YACd,oBAAoB;YACpB,WAAW;YACX,gBAAgB;YAChB,aAAa;YACb,WAAW;YACX,iBAAiB;YACjB,WAAW;SACX,EAEA,EAAA,QAAQ,CACY,EACrB;AACH;;;;"}
1
+ {"version":3,"file":"mapContext.js","sources":["../../src/contexts/mapContext.tsx"],"sourcesContent":["import React, { createContext, useState, useContext, useEffect, useRef, ReactNode } from 'react';\r\nimport { getStorageObject, setStorageObject } from '~/util/localStorageUtil';\r\nimport { Listing } from '~/types/Listings';\r\nimport { LatLng } from '~/types/LatLng';\r\ninterface IMapContext {\r\n selectedListItem: Listing | null;\r\n setSelectedListItem: (item: Listing | null) => void;\r\n location: any | null;\r\n setLocation: (location: LatLng | null) => void;\r\n center: LatLng;\r\n setCenter: (center: LatLng) => void;\r\n zoom: number;\r\n setZoom: (zoom: number) => void;\r\n selectedPlaces: string[];\r\n setSelectedPlaces: (places: string[]) => void;\r\n mapInteracted: boolean;\r\n setMapInteracted: (interacted: boolean) => void;\r\n userSetZoom: React.MutableRefObject<boolean>;\r\n firstLoadListItem: any;\r\n selectItem: (item: Listing, itemLocation: LatLng | null, zoom: number, center: LatLng) => void;\r\n filterReset: () => void;\r\n selectLocationEntity: (location: LatLng) => void;\r\n}\r\n\r\nconst MapContext = createContext<IMapContext | undefined>(undefined);\r\n\r\nexport const useMap = () => {\r\n\tconst context = useContext(MapContext);\r\n\tif (!context) {\r\n\t\tthrow new Error(\"useMap must be used within a MapProvider\");\r\n\t}\r\n\treturn context;\r\n};\r\n\r\ninterface MapProviderProps {\r\n children: ReactNode;\r\n resetFilters: boolean;\r\n}\r\n\r\nexport const MapProvider: React.FC<MapProviderProps> = ({ children, resetFilters }) => {\r\n\tconst [selectedListItem, setSelectedListItem] = useState<Listing | null>(getStorageObject('selectedListItem'));\r\n\tconst [location, setLocation] = useState<any>(getStorageObject('location'));\r\n\tconst [center, setCenter] = useState<LatLng>(getStorageObject(\"center\", { lat: 39.8283, lng: -98.5795 }) || { lat: 39.8283, lng: -98.5795 });\r\n\tconst [zoom, setZoom] = useState<number>(getStorageObject(\"zoom\", 10) || 10);\r\n\tconst [selectedPlaces, setSelectedPlaces] = useState<string[]>([]);\r\n\tconst [mapInteracted, setMapInteracted] = useState<boolean>(false);\r\n\tconst [firstLoadListItem] = useState<any>(getStorageObject('selectedListItem', { id: \"defaultId\" }));\r\n\tconst userSetZoom = useRef<boolean>(true);\r\n\r\n\tuseEffect(() => {\r\n\t\tsetStorageObject(\"selectedListItem\", selectedListItem);\r\n\t}, [selectedListItem]);\r\n\r\n\tuseEffect(() => {\r\n\t\tlocalStorage.setItem(\"zoom\", zoom.toString());\r\n\t}, [zoom]);\r\n\r\n\tuseEffect(() => {\r\n\t\tif (location == null) {\r\n\t\t\tlocalStorage.removeItem(\"location\");\r\n\t\t} else {\r\n\t\t\tsetStorageObject(\"location\", location);\r\n\t\t}\r\n\t}, [location]);\r\n\r\n\tuseEffect(() => {\r\n\t\tsetStorageObject(\"center\", center);\r\n\t}, [center]);\r\n\r\n\tconst selectItem = (item: Listing, itemLocation: LatLng | null, zoom: number, center: LatLng) => {\r\n\t\tsetSelectedListItem(item);\r\n\t\tif (mapInteracted === false && itemLocation != null) {\r\n\t\t\tsetLocation(itemLocation);\r\n\t\t}\r\n\t\tif (mapInteracted === false || itemLocation != null) {\r\n\t\t\tsetLocation(itemLocation);\r\n\t\t\tsetCenter(center);\r\n\t\t}\r\n\t\tif (mapInteracted === false) {\r\n\t\t\tsetZoom(zoom);\r\n\t\t}\r\n\t};\r\n\r\n\tconst filterReset = () => {\r\n\t\tsetSelectedPlaces([]);\r\n\t\tsetSelectedListItem(null);\r\n\t\tsetLocation(null);\r\n\t\tsetZoom(8);\r\n\t\tsetMapInteracted(false);\r\n\t};\r\n\r\n\tuseEffect(() => {\r\n\t\tif (resetFilters === true) {\r\n\t\t\tfilterReset();\r\n\t\t}\r\n\t}, [resetFilters]);\r\n\r\n\tconst selectLocationEntity = (location: LatLng) => {\r\n\t\tlocalStorage.removeItem(\"selectedListItem\");\r\n\t\tsetTimeout(() => setLocation(location), 200);\r\n\t\tsetSelectedListItem(null);\r\n\t};\r\n\r\n\treturn (\r\n\t\t<MapContext.Provider\r\n\t\t\tvalue={{\r\n\t\t\t\tselectedListItem,\r\n\t\t\t\tsetSelectedListItem,\r\n\t\t\t\tlocation,\r\n\t\t\t\tcenter,\r\n\t\t\t\tsetCenter,\r\n\t\t\t\tzoom,\r\n\t\t\t\tsetZoom,\r\n\t\t\t\tselectItem,\r\n\t\t\t\tsetSelectedPlaces,\r\n\t\t\t\tselectedPlaces,\r\n\t\t\t\tselectLocationEntity,\r\n\t\t\t\tsetLocation,\r\n\t\t\t\tsetMapInteracted,\r\n\t\t\t\tmapInteracted,\r\n\t\t\t\tuserSetZoom,\r\n\t\t\t\tfirstLoadListItem,\r\n\t\t\t\tfilterReset\r\n\t\t\t}}\r\n\t\t>\r\n\t\t\t{children}\r\n\t\t</MapContext.Provider>\r\n\t);\r\n};\r\n"],"names":["React"],"mappings":";;;AAwBA,MAAM,UAAU,GAAG,aAAa,CAA0B,SAAS,CAAC,CAAC;AAE9D,MAAM,MAAM,GAAG,MAAK;AAC1B,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IACvC,IAAI,CAAC,OAAO,EAAE;AACb,QAAA,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;AAC5D,KAAA;AACD,IAAA,OAAO,OAAO,CAAC;AAChB,EAAE;AAOW,MAAA,WAAW,GAA+B,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAI;AACrF,IAAA,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAiB,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAC/G,IAAA,MA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CAAC,CAAC;QAC5C,UAAU,CAAC,MAAM,WAAW,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAC;QAC7C,mBAAmB,CAAC,IAAI,CAAC,CAAC;AAC3B,KAAC,CAAC;AAEF,IAAA,QACCA,cAAC,CAAA,aAAA,CAAA,UAAU,CAAC,QAAQ,EAAA,EACnB,KAAK,EAAE;YACN,gBAAgB;YAChB,mBAAmB;YACnB,QAAQ;YACR,MAAM;YACN,SAAS;YACT,IAAI;YACJ,OAAO;YACP,UAAU;YACV,iBAAiB;YACjB,cAAc;YACd,oBAAoB;YACpB,WAAW;YACX,gBAAgB;YAChB,aAAa;YACb,WAAW;YACX,iBAAiB;YACjB,WAAW;SACX,EAEA,EAAA,QAAQ,CACY,EACrB;AACH;;;;"}
@@ -5,196 +5,198 @@ 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, easyApplyUrl, easyApplyText, 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
+ easyApplyUrl,
195
+ easyApplyText,
196
+ sortSetting,
197
+ setSortSetting,
198
+ trackEvent
199
+ } }, children));
198
200
  };
199
201
 
200
202
  export { MapListProvider, useMapList };