@abcagency/hc-ui-components 1.3.17 → 1.3.19
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.
- package/dist/apis/hcApi.js +85 -183
- package/dist/apis/hcApi.js.map +1 -1
- package/dist/components/HireControlMap.js +10 -5
- package/dist/components/HireControlMap.js.map +1 -1
- package/dist/components/modules/accordions/MapAccordionItem.js +10 -67
- package/dist/components/modules/accordions/MapAccordionItem.js.map +1 -1
- package/dist/components/modules/filter/index.js.map +1 -1
- package/dist/components/modules/filter/radio-item.js +1 -2
- package/dist/components/modules/filter/radio-item.js.map +1 -1
- package/dist/components/modules/filter/search.js +4 -4
- package/dist/components/modules/filter/search.js.map +1 -1
- package/dist/components/modules/jobListing/listing-details-container.js +45 -0
- package/dist/components/modules/jobListing/listing-details-container.js.map +1 -0
- package/dist/components/modules/jobListing/listing-details.js +24 -24
- package/dist/components/modules/jobListing/listing-details.js.map +1 -1
- package/dist/components/modules/{maps/list → list}/field-mapper.js +8 -7
- package/dist/components/modules/list/field-mapper.js.map +1 -0
- package/dist/components/modules/{maps/list → list}/header-item.js +2 -2
- package/dist/components/modules/list/header-item.js.map +1 -0
- package/dist/components/modules/{maps/list → list}/header.js +6 -4
- package/dist/components/modules/list/header.js.map +1 -0
- package/dist/components/modules/list/index.js +36 -0
- package/dist/components/modules/list/index.js.map +1 -0
- package/dist/components/modules/{maps/list → list}/item-expand-card/index.js +3 -1
- package/dist/components/modules/list/item-expand-card/index.js.map +1 -0
- package/dist/components/modules/{maps/list → list}/item-expand-card/recruiter-contact-nav.js +2 -2
- package/dist/components/modules/list/item-expand-card/recruiter-contact-nav.js.map +1 -0
- package/dist/components/modules/{maps/list → list}/item-expand-card/recruiter-details.js +1 -1
- package/dist/components/modules/list/item-expand-card/recruiter-details.js.map +1 -0
- package/dist/components/modules/list/item-expand-card/recruiter-headshot.js.map +1 -0
- package/dist/components/modules/list/item-list.js +28 -0
- package/dist/components/modules/list/item-list.js.map +1 -0
- package/dist/components/modules/list/list-item/index.js +75 -0
- package/dist/components/modules/list/list-item/index.js.map +1 -0
- package/dist/components/modules/list/list-item/list-item-container.js +47 -0
- package/dist/components/modules/list/list-item/list-item-container.js.map +1 -0
- package/dist/components/modules/{maps/list/list-item/index.js → list/list-item/list-item.js} +29 -33
- package/dist/components/modules/list/list-item/list-item.js.map +1 -0
- package/dist/components/modules/maps/map-list.js +3 -3
- package/dist/components/modules/maps/map-list.js.map +1 -1
- package/dist/constants/eventTypes.js +1 -1
- package/dist/constants/eventTypes.js.map +1 -1
- package/dist/contexts/mapContext.js +84 -113
- package/dist/contexts/mapContext.js.map +1 -1
- package/dist/contexts/mapListContext.js +181 -290
- package/dist/contexts/mapListContext.js.map +1 -1
- package/dist/contexts/trackEventContext.js +1 -1
- package/dist/services/configService.js +10 -28
- package/dist/services/configService.js.map +1 -1
- package/dist/services/googlePlacesNearbyService.js +33 -58
- package/dist/services/googlePlacesNearbyService.js.map +1 -1
- package/dist/services/listingAggregatorService.js +35 -75
- package/dist/services/listingAggregatorService.js.map +1 -1
- package/dist/services/listingEntityService.js +10 -31
- package/dist/services/listingEntityService.js.map +1 -1
- package/dist/services/listingService.js +26 -60
- package/dist/services/listingService.js.map +1 -1
- package/dist/services/recruiterService.js +11 -31
- package/dist/services/recruiterService.js.map +1 -1
- package/dist/types/apis/hcApi.d.ts +5 -0
- package/dist/types/clientToken.d.ts +2 -0
- package/dist/types/components/modules/accordions/MapAccordionItem.d.ts +9 -0
- package/dist/types/components/modules/accordions/default.d.ts +19 -0
- package/dist/types/components/modules/buttons/button-group-apply.d.ts +24 -0
- package/dist/types/components/modules/buttons/commute-pill.d.ts +5 -0
- package/dist/types/components/modules/buttons/default.d.ts +48 -0
- package/dist/types/components/modules/buttons/pill-wrapper.d.ts +3 -0
- package/dist/types/components/modules/dialogs/apply-dialog.d.ts +8 -0
- package/dist/types/components/modules/filter/sort.d.ts +8 -0
- package/dist/types/components/modules/grid.d.ts +8 -0
- package/dist/types/components/modules/icon.d.ts +10 -0
- package/dist/types/components/modules/jobListing/listing-details-container.d.ts +6 -0
- package/dist/types/components/modules/jobListing/listing-details.d.ts +18 -0
- package/dist/types/components/modules/list/field-mapper.d.ts +10 -0
- package/dist/types/components/modules/list/header-item.d.ts +11 -0
- package/dist/types/components/modules/list/header.d.ts +11 -0
- package/dist/types/components/modules/list/index.d.ts +9 -0
- package/dist/types/components/modules/list/item-expand-card/index.d.ts +7 -0
- package/dist/types/components/modules/list/item-expand-card/recruiter-contact-nav.d.ts +17 -0
- package/dist/types/components/modules/list/item-expand-card/recruiter-details.d.ts +21 -0
- package/dist/types/components/modules/list/item-expand-card/recruiter-headshot.d.ts +8 -0
- package/dist/types/components/modules/list/item-list.d.ts +21 -0
- package/dist/types/components/modules/list/list-item/index.d.ts +12 -0
- package/dist/types/components/modules/list/list-item/list-item-container.d.ts +14 -0
- package/dist/types/components/modules/list/list-item/list-item.d.ts +3 -0
- package/dist/types/constants/eventTypes.d.ts +13 -0
- package/dist/types/contexts/mapContext.d.ts +29 -0
- package/dist/types/contexts/mapListContext.d.ts +58 -0
- package/dist/types/contexts/trackEventContext.d.ts +6 -0
- package/dist/types/enums/SectionType.d.ts +9 -0
- package/dist/types/hooks/useList.d.ts +13 -0
- package/dist/types/services/configService.d.ts +6 -0
- package/dist/types/services/googlePlacesNearbyService.d.ts +5 -0
- package/dist/types/services/listingAggregatorService.d.ts +12 -0
- package/dist/types/services/listingEntityService.d.ts +6 -0
- package/dist/types/services/listingService.d.ts +9 -0
- package/dist/types/services/recruiterService.d.ts +6 -0
- package/dist/types/types/Address.d.ts +7 -0
- package/dist/types/types/ContentSection.d.ts +8 -0
- package/dist/types/types/GetListingParams.d.ts +8 -0
- package/dist/types/types/LatLng.d.ts +4 -0
- package/dist/types/types/ListingEntity.d.ts +10 -0
- package/dist/types/types/ListingFields.d.ts +20 -0
- package/dist/types/types/Listings.d.ts +31 -0
- package/dist/types/types/Recruiter.d.ts +9 -0
- package/dist/types/types/SimilarListing.d.ts +24 -0
- package/dist/types/types/config/Colors.d.ts +8 -0
- package/dist/types/types/config/MapConfig.d.ts +29 -0
- package/dist/types/types/config/PointsOfInterestConfig.d.ts +13 -0
- package/dist/types/types/config/SearchConfig.d.ts +4 -0
- package/dist/types/util/filterUtil.d.ts +28 -0
- package/dist/types/util/loading.d.ts +3 -0
- package/dist/types/util/localStorageUtil.d.ts +3 -0
- package/dist/types/util/mapUtil.d.ts +15 -0
- package/dist/types/util/sortUtil.d.ts +1 -0
- package/dist/types/util/stringUtils.d.ts +1 -0
- package/dist/util/filterUtil.js +34 -10
- package/dist/util/filterUtil.js.map +1 -1
- package/dist/util/localStorageUtil.js +37 -28
- package/dist/util/localStorageUtil.js.map +1 -1
- package/dist/util/mapUtil.js.map +1 -1
- package/package.json +22 -14
- package/rollup.config.mjs +23 -19
- package/src/apis/{hcApi.js → hcApi.ts} +27 -11
- package/src/components/HireControlMap.js +132 -129
- package/src/components/modules/accordions/MapAccordionItem.js +32 -74
- package/src/components/modules/filter/index.js +89 -89
- package/src/components/modules/filter/radio-item.js +0 -1
- package/src/components/modules/filter/search.js +93 -92
- package/src/components/modules/jobListing/listing-details-container.js +40 -0
- package/src/components/modules/jobListing/listing-details.js +209 -99
- package/src/components/modules/{maps/list → list}/field-mapper.js +114 -112
- package/src/components/modules/{maps/list → list}/header.js +49 -47
- package/src/components/modules/list/index.tsx +83 -0
- package/src/components/modules/{maps/list → list}/item-expand-card/index.js +24 -22
- package/src/components/modules/list/item-list.tsx +198 -0
- package/src/components/modules/list/list-item/index.js +70 -0
- package/src/components/modules/list/list-item/list-item-container.js +43 -0
- package/src/components/modules/{maps/list/list-item/index.js → list/list-item/list-item.js} +129 -135
- package/src/components/modules/maps/map-list.js +74 -74
- package/src/constants/eventTypes.js +13 -13
- package/src/contexts/mapContext.tsx +129 -0
- package/src/contexts/mapListContext.tsx +297 -0
- package/src/enums/SectionType.ts +9 -0
- package/src/services/{configService.js → configService.ts} +16 -16
- package/src/services/{googlePlacesNearbyService.js → googlePlacesNearbyService.ts} +11 -2
- package/src/services/listingAggregatorService.ts +76 -0
- package/src/services/listingEntityService.ts +16 -0
- package/src/services/listingService.ts +40 -0
- package/src/services/{recruiterService.js → recruiterService.ts} +18 -17
- package/src/types/Address.ts +7 -0
- package/src/types/ContentSection.ts +9 -0
- package/src/types/GetListingParams.ts +8 -0
- package/src/types/LatLng.ts +4 -0
- package/src/types/ListingEntity.ts +11 -0
- package/src/types/ListingFields.ts +20 -0
- package/src/types/Listings.ts +32 -0
- package/src/types/Recruiter.ts +9 -0
- package/src/types/SimilarListing.ts +24 -0
- package/src/types/config/Colors.ts +8 -0
- package/src/types/config/MapConfig.ts +30 -0
- package/src/types/config/PointsOfInterestConfig.ts +13 -0
- package/src/types/config/SearchConfig.ts +4 -0
- package/src/util/filterUtil.js +50 -6
- package/src/util/localStorageUtil.ts +34 -0
- package/src/util/mapUtil.js +91 -91
- package/tsconfig.json +23 -0
- package/dist/components/modules/maps/list/field-mapper.js.map +0 -1
- package/dist/components/modules/maps/list/header-item.js.map +0 -1
- package/dist/components/modules/maps/list/header.js.map +0 -1
- package/dist/components/modules/maps/list/index.js +0 -102
- package/dist/components/modules/maps/list/index.js.map +0 -1
- package/dist/components/modules/maps/list/item-expand-card/index.js.map +0 -1
- package/dist/components/modules/maps/list/item-expand-card/recruiter-contact-nav.js.map +0 -1
- package/dist/components/modules/maps/list/item-expand-card/recruiter-details.js.map +0 -1
- package/dist/components/modules/maps/list/item-expand-card/recruiter-headshot.js.map +0 -1
- package/dist/components/modules/maps/list/list-item/index.js.map +0 -1
- package/dist/services/_virtual/_rollupPluginBabelHelpers.js +0 -372
- package/dist/services/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
- package/dist/services/apis/hcApi.js +0 -189
- package/dist/services/apis/hcApi.js.map +0 -1
- package/dist/services/clientToken.js +0 -7
- package/dist/services/clientToken.js.map +0 -1
- package/dist/services/styles/index.css +0 -3
- package/src/components/modules/maps/list/index.js +0 -112
- package/src/contexts/mapContext.js +0 -101
- package/src/contexts/mapListContext.js +0 -242
- package/src/services/listingAggregatorService.js +0 -50
- package/src/services/listingEntityService.js +0 -15
- package/src/services/listingService.js +0 -26
- package/src/util/localStorageUtil.js +0 -27
- /package/dist/components/modules/{maps/list → list}/item-expand-card/recruiter-headshot.js +0 -0
- /package/src/components/modules/{maps/list → list}/header-item.js +0 -0
- /package/src/components/modules/{maps/list → list}/item-expand-card/recruiter-contact-nav.js +0 -0
- /package/src/components/modules/{maps/list → list}/item-expand-card/recruiter-details.js +0 -0
- /package/src/components/modules/{maps/list → list}/item-expand-card/recruiter-headshot.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapContext.js","sources":["../../src/contexts/mapContext.
|
|
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":[],"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,C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AC7C,mBAAmB,CAAC,IAAI,CAAC,CAAC;AAC3B,KAAC,CAAC;AAEF,IAAA,QACC,KAAC,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;;;;"}
|
|
@@ -1,298 +1,189 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React, { useContext, useState, useEffect, createContext } from 'react';
|
|
1
|
+
import React, { createContext, useState, useEffect, useContext } from 'react';
|
|
3
2
|
import { applyFilters, generateFilterOptions, filterListingsByLocation } from '../util/filterUtil.js';
|
|
4
3
|
import { getStorageObject, setStorageObject } from '../util/localStorageUtil.js';
|
|
5
4
|
import { getListingEntities } from '../services/listingEntityService.js';
|
|
6
5
|
import fetchListings from '../services/listingAggregatorService.js';
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
setStorageObject("listingEntities", fetchedEntities);
|
|
189
|
-
setStorageObject("recruiters", fetchedRecruiters);
|
|
190
|
-
setStorageObject("listings", listingsResult);
|
|
191
|
-
_context2.next = 22;
|
|
192
|
-
break;
|
|
193
|
-
case 19:
|
|
194
|
-
_context2.prev = 19;
|
|
195
|
-
_context2.t0 = _context2["catch"](1);
|
|
196
|
-
console.log(_context2.t0);
|
|
197
|
-
case 22:
|
|
198
|
-
setLoading(false);
|
|
199
|
-
case 23:
|
|
200
|
-
case "end":
|
|
201
|
-
return _context2.stop();
|
|
202
|
-
}
|
|
203
|
-
}, _callee2, null, [[1, 19]]);
|
|
204
|
-
}));
|
|
205
|
-
return function handleFetchListings() {
|
|
206
|
-
return _ref2.apply(this, arguments);
|
|
207
|
-
};
|
|
208
|
-
}();
|
|
209
|
-
handleFetchListings();
|
|
210
|
-
}, [query, siteConfig]);
|
|
211
|
-
useEffect(function () {
|
|
212
|
-
var processListings = function processListings() {
|
|
213
|
-
var _applyFilters = applyFilters(allListings, selectedFilters, query, listingEntities, favorites, siteConfig),
|
|
214
|
-
filteredListings = _applyFilters.filteredListings,
|
|
215
|
-
mapItems = _applyFilters.mapItems;
|
|
216
|
-
if (filterByFavorites) {
|
|
217
|
-
filteredListings = filteredListings.filter(function (x) {
|
|
218
|
-
return favorites.includes(x.id);
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
setNewFilteredListings(filteredListings);
|
|
222
|
-
// if (firstLoad && hasFiltersInURL(location)) {
|
|
223
|
-
// const { filters } = filtersFromURL(location);
|
|
224
|
-
// setSelectedFilters(filters);
|
|
225
|
-
// }
|
|
226
|
-
if (firstLoad && selectedFilters) ; else if (Object.keys(selectedFilters).length === 0 && !firstLoad) {
|
|
227
|
-
localStorage.removeItem('selectedFilters');
|
|
228
|
-
//updateURLWithFilters(selectedFilters,location, navigate, query);
|
|
229
|
-
} else if (!firstLoad) {
|
|
230
|
-
setStorageObject('selectedFilters', selectedFilters);
|
|
231
|
-
//updateURLWithFilters(selectedFilters,location, navigate, query);
|
|
232
|
-
}
|
|
233
|
-
query != null ? localStorage.setItem('query', query) : localStorage.removeItem('query');
|
|
234
|
-
setMapItems(mapItems);
|
|
235
|
-
if (selectedFilters) {
|
|
236
|
-
var keys = Object.keys(selectedFilters);
|
|
237
|
-
var lastKey = keys[keys.length - 1];
|
|
238
|
-
var options = generateFilterOptions(firstLoad ? allListings : filteredListings, allListings, siteConfig, filterOptions, lastKey, favorites);
|
|
239
|
-
if (options) {
|
|
240
|
-
setFilterOptions(options);
|
|
241
|
-
if (firstLoad) setFirstLoad(false);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
};
|
|
245
|
-
processListings();
|
|
246
|
-
}, [selectedFilters, query, listingEntities, filterByFavorites, favorites]);
|
|
247
|
-
var handleFilterListingsByLocation = function handleFilterListingsByLocation(selectedLocation) {
|
|
248
|
-
var _filterListingsByLoca = filterListingsByLocation(allListings, selectedLocation, listingEntities),
|
|
249
|
-
filteredListings = _filterListingsByLoca.filteredListings;
|
|
250
|
-
setNewFilteredListings(filteredListings);
|
|
251
|
-
//setMapItems(mapItems);
|
|
252
|
-
};
|
|
253
|
-
var handleSettingFavorites = function handleSettingFavorites(newFavorites) {
|
|
254
|
-
if (newFavorites == null) {
|
|
255
|
-
localStorage.removeItem('favorites');
|
|
256
|
-
} else {
|
|
257
|
-
setFavorites(newFavorites);
|
|
258
|
-
localStorage.setItem('favorites', JSON.stringify(newFavorites));
|
|
259
|
-
}
|
|
260
|
-
};
|
|
261
|
-
return /*#__PURE__*/React.createElement(MapListContext.Provider, {
|
|
262
|
-
value: {
|
|
263
|
-
loading: loading,
|
|
264
|
-
allListings: allListings,
|
|
265
|
-
filteredListings: filteredListings,
|
|
266
|
-
mapItems: mapItems,
|
|
267
|
-
query: query,
|
|
268
|
-
setNewFilteredListings: setNewFilteredListings,
|
|
269
|
-
setQuery: setQuery,
|
|
270
|
-
listingEntities: listingEntities,
|
|
271
|
-
selectedFilters: selectedFilters,
|
|
272
|
-
setSelectedFilters: setSelectedFilters,
|
|
273
|
-
filterOptions: filterOptions,
|
|
274
|
-
recruiters: recruiters,
|
|
275
|
-
handleFilterListingsByLocation: handleFilterListingsByLocation,
|
|
276
|
-
filterDialogIsOpen: filterDialogIsOpen,
|
|
277
|
-
setFilterDialogIsOpen: setFilterDialogIsOpen,
|
|
278
|
-
setMobileTab: setMobileTab,
|
|
279
|
-
mobileTab: mobileTab,
|
|
280
|
-
siteConfig: siteConfig,
|
|
281
|
-
favorites: favorites,
|
|
282
|
-
handleSettingFavorites: handleSettingFavorites,
|
|
283
|
-
setFilterByFavorites: setFilterByFavorites,
|
|
284
|
-
filterByFavorites: filterByFavorites,
|
|
285
|
-
commuteLocation: commuteLocation,
|
|
286
|
-
setCommuteLocation: setCommuteLocation,
|
|
287
|
-
navigateToDetails: navigateToDetails,
|
|
288
|
-
navigateToEasyApply: navigateToEasyApply,
|
|
289
|
-
Link: Link,
|
|
290
|
-
linkFormat: linkFormat,
|
|
291
|
-
sortSetting: sortSetting,
|
|
292
|
-
setSortSetting: setSortSetting,
|
|
293
|
-
trackEvent: trackEvent
|
|
294
|
-
}
|
|
295
|
-
}, children);
|
|
7
|
+
const MapListContext = createContext(undefined);
|
|
8
|
+
const useMapList = () => {
|
|
9
|
+
const context = useContext(MapListContext);
|
|
10
|
+
if (!context) {
|
|
11
|
+
throw new Error('useMapList must be used within a MapListProvider');
|
|
12
|
+
}
|
|
13
|
+
return context;
|
|
14
|
+
};
|
|
15
|
+
const getQuery = () => {
|
|
16
|
+
let query = null;
|
|
17
|
+
if (typeof window !== 'undefined') {
|
|
18
|
+
query = localStorage.getItem('query');
|
|
19
|
+
}
|
|
20
|
+
return query;
|
|
21
|
+
};
|
|
22
|
+
const MapListProvider = ({ children, siteConfig, resetFilters, navigateToDetails, navigateToEasyApply, Link, linkFormat, trackEvent, listings = [] }) => {
|
|
23
|
+
const [allListings, setAllListings] = useState(getStorageObject("listings", listings) || []);
|
|
24
|
+
const [filteredListings, setFilteredListings] = useState([]);
|
|
25
|
+
const [loading, setLoading] = useState(false);
|
|
26
|
+
const [mapItems, setMapItems] = useState(getStorageObject('mapItems', []) || []);
|
|
27
|
+
const [query, setQuery] = useState(() => resetFilters ? null : getQuery());
|
|
28
|
+
const [sortSetting, setSortSetting] = useState(getStorageObject('sortSetting', { field: 'position', type: 'asc' }) || { field: 'position', type: 'asc' });
|
|
29
|
+
const [listingEntities, setListingEntities] = useState(getStorageObject("listingEntities", null));
|
|
30
|
+
const [firstLoad, setFirstLoad] = useState(true);
|
|
31
|
+
const [commuteLocation, setCommuteLocation] = useState(getStorageObject('commuteLocation'));
|
|
32
|
+
const [selectedFilters, setSelectedFilters] = useState(() => resetFilters ? {} : getStorageObject('selectedFilters', {}) || {});
|
|
33
|
+
const [filterOptions, setFilterOptions] = useState();
|
|
34
|
+
const [recruiters, setRecruiters] = useState(getStorageObject("recruiters", {}) || {});
|
|
35
|
+
const [filterDialogIsOpen, setFilterDialogIsOpen] = useState(false);
|
|
36
|
+
const [mobileTab, setMobileTab] = useState("listTab");
|
|
37
|
+
const [favorites, setFavorites] = useState([]);
|
|
38
|
+
const [filterByFavorites, setFilterByFavorites] = useState(false);
|
|
39
|
+
const setNewFilteredListings = (filteredListings) => {
|
|
40
|
+
setFilteredListings(filteredListings);
|
|
41
|
+
};
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (!sortSetting)
|
|
44
|
+
return;
|
|
45
|
+
localStorage.setItem('sortSetting', JSON.stringify(sortSetting));
|
|
46
|
+
setNewFilteredListings(filteredListings);
|
|
47
|
+
}, [sortSetting]);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
const loadedFavorites = JSON.parse(localStorage.getItem('favorites') || '[]');
|
|
50
|
+
setFavorites(loadedFavorites);
|
|
51
|
+
}, []);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
setStorageObject("commuteLocation", commuteLocation);
|
|
54
|
+
}, [commuteLocation]);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (!commuteLocation)
|
|
57
|
+
return;
|
|
58
|
+
async function fetchEntities() {
|
|
59
|
+
const distinctEntityIds = [
|
|
60
|
+
...new Set(allListings.map(listing => listing.entityId ?? -1))
|
|
61
|
+
];
|
|
62
|
+
try {
|
|
63
|
+
const fetchedEntities = await getListingEntities(distinctEntityIds, `${commuteLocation.lat}, ${commuteLocation.lng}`);
|
|
64
|
+
setListingEntities(fetchedEntities);
|
|
65
|
+
const newFilteredListings = [...filteredListings] ?? [];
|
|
66
|
+
for (let i = 0; i < allListings.length; i++) {
|
|
67
|
+
const listing = newFilteredListings[i];
|
|
68
|
+
if (listing &&
|
|
69
|
+
listing.fields &&
|
|
70
|
+
listing.entityId !== undefined &&
|
|
71
|
+
listing.entityId !== -1) {
|
|
72
|
+
const entityId = listing.entityId;
|
|
73
|
+
const travelTime = fetchedEntities[entityId]?.travelTime;
|
|
74
|
+
if (travelTime !== undefined && listing.fields) {
|
|
75
|
+
listing.fields.travelTime = travelTime;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
setNewFilteredListings(newFilteredListings);
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
console.error("Failed to fetch listing entities:", error);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
fetchEntities();
|
|
86
|
+
}, [commuteLocation, allListings, siteConfig.companyId]);
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
const handleFetchListings = async () => {
|
|
89
|
+
if (!getStorageObject('listings') ?? [].length) {
|
|
90
|
+
setLoading(true);
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
const { listingsResult, fetchedRecruiters, fetchedEntities, distinctItems } = await fetchListings(query ?? '', siteConfig, commuteLocation);
|
|
94
|
+
setAllListings(listingsResult);
|
|
95
|
+
setRecruiters(fetchedRecruiters);
|
|
96
|
+
setListingEntities(fetchedEntities);
|
|
97
|
+
setMapItems(distinctItems);
|
|
98
|
+
setStorageObject("mapItems", distinctItems);
|
|
99
|
+
setStorageObject("listingEntities", fetchedEntities);
|
|
100
|
+
setStorageObject("recruiters", fetchedRecruiters);
|
|
101
|
+
setStorageObject("listings", listingsResult);
|
|
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
|
+
const { mapItems, filteredListings: tempFilteredListings } = applyFilters(allListings, selectedFilters, query, listingEntities, favorites, siteConfig);
|
|
114
|
+
filteredListings = tempFilteredListings;
|
|
115
|
+
if (filterByFavorites) {
|
|
116
|
+
filteredListings = filteredListings.filter((x) => favorites.includes(x.id));
|
|
117
|
+
}
|
|
118
|
+
setNewFilteredListings(filteredListings);
|
|
119
|
+
if (firstLoad && selectedFilters) ;
|
|
120
|
+
else if (Object.keys(selectedFilters).length === 0 && !firstLoad) {
|
|
121
|
+
localStorage.removeItem('selectedFilters');
|
|
122
|
+
}
|
|
123
|
+
else if (!firstLoad) {
|
|
124
|
+
setStorageObject('selectedFilters', selectedFilters);
|
|
125
|
+
}
|
|
126
|
+
query != null ? localStorage.setItem('query', query) : localStorage.removeItem('query');
|
|
127
|
+
setMapItems(mapItems);
|
|
128
|
+
if (selectedFilters) {
|
|
129
|
+
const keys = Object.keys(selectedFilters);
|
|
130
|
+
const lastKey = keys[keys.length - 1];
|
|
131
|
+
const options = generateFilterOptions(firstLoad ? allListings : filteredListings, allListings, siteConfig, filterOptions, lastKey, favorites);
|
|
132
|
+
if (options) {
|
|
133
|
+
setFilterOptions(options);
|
|
134
|
+
if (firstLoad)
|
|
135
|
+
setFirstLoad(false);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
processListings();
|
|
140
|
+
}, [selectedFilters, query, listingEntities, filterByFavorites, favorites]);
|
|
141
|
+
const handleFilterListingsByLocation = (selectedLocation) => {
|
|
142
|
+
const { filteredListings } = filterListingsByLocation(allListings, selectedLocation, listingEntities);
|
|
143
|
+
setNewFilteredListings(filteredListings);
|
|
144
|
+
};
|
|
145
|
+
const handleSettingFavorites = (newFavorites) => {
|
|
146
|
+
if (newFavorites == null) {
|
|
147
|
+
localStorage.removeItem('favorites');
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
setFavorites(newFavorites);
|
|
151
|
+
localStorage.setItem('favorites', JSON.stringify(newFavorites));
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
return (React.createElement(MapListContext.Provider, { value: {
|
|
155
|
+
loading,
|
|
156
|
+
allListings,
|
|
157
|
+
filteredListings,
|
|
158
|
+
mapItems,
|
|
159
|
+
query,
|
|
160
|
+
setNewFilteredListings,
|
|
161
|
+
setQuery,
|
|
162
|
+
listingEntities,
|
|
163
|
+
selectedFilters,
|
|
164
|
+
setSelectedFilters,
|
|
165
|
+
filterOptions,
|
|
166
|
+
recruiters,
|
|
167
|
+
handleFilterListingsByLocation,
|
|
168
|
+
filterDialogIsOpen,
|
|
169
|
+
setFilterDialogIsOpen,
|
|
170
|
+
setMobileTab,
|
|
171
|
+
mobileTab,
|
|
172
|
+
siteConfig,
|
|
173
|
+
favorites,
|
|
174
|
+
handleSettingFavorites,
|
|
175
|
+
setFilterByFavorites,
|
|
176
|
+
filterByFavorites,
|
|
177
|
+
commuteLocation,
|
|
178
|
+
setCommuteLocation,
|
|
179
|
+
navigateToDetails,
|
|
180
|
+
navigateToEasyApply,
|
|
181
|
+
Link,
|
|
182
|
+
linkFormat,
|
|
183
|
+
sortSetting,
|
|
184
|
+
setSortSetting,
|
|
185
|
+
trackEvent
|
|
186
|
+
} }, children));
|
|
296
187
|
};
|
|
297
188
|
|
|
298
189
|
export { MapListProvider, useMapList };
|