@abcagency/hc-ui-components 1.4.5 → 1.4.8
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/components/HireControlMap.js +4 -0
- package/dist/components/HireControlMap.js.map +1 -1
- package/dist/components/containers/accordions/map-accordion-item-container.js +1 -3
- package/dist/components/containers/accordions/map-accordion-item-container.js.map +1 -1
- package/dist/components/containers/maps/info-window-content-container.js.map +1 -1
- package/dist/components/containers/maps/map-container.js +1 -0
- package/dist/components/containers/maps/map-container.js.map +1 -1
- package/dist/components/modules/buttons/button-group-apply.js +4 -4
- package/dist/components/modules/buttons/button-group-apply.js.map +1 -1
- package/dist/contexts/mapListContext.js +15 -17
- package/dist/contexts/mapListContext.js.map +1 -1
- package/dist/services/listingAggregatorService.js +11 -12
- package/dist/services/listingAggregatorService.js.map +1 -1
- package/dist/services/listingEntityService.js +2 -3
- package/dist/services/listingEntityService.js.map +1 -1
- package/dist/services/listingService.js +16 -10
- package/dist/services/listingService.js.map +1 -1
- package/dist/types/contexts/mapListContext.d.ts +1 -0
- package/dist/types/services/listingAggregatorService.d.ts +2 -2
- package/dist/types/services/listingEntityService.d.ts +3 -2
- package/dist/types/types/ListingEntity.d.ts +1 -2
- package/dist/types/types/ListingFields.d.ts +2 -4
- package/dist/types/types/Listings.d.ts +1 -0
- package/dist/types/util/mapUtil.d.ts +3 -3
- package/dist/util/mapUtil.js +25 -33
- package/dist/util/mapUtil.js.map +1 -1
- package/package.json +1 -1
- package/src/components/HireControlMap.js +5 -0
- package/src/components/containers/accordions/map-accordion-item-container.js +1 -3
- package/src/components/containers/maps/info-window-content-container.js +1 -1
- package/src/components/containers/maps/map-container.js +1 -2
- package/src/components/modules/buttons/button-group-apply.js +4 -4
- package/src/contexts/mapListContext.tsx +21 -18
- package/src/services/listingAggregatorService.ts +17 -16
- package/src/services/listingEntityService.ts +3 -3
- package/src/services/listingService.ts +10 -11
- package/src/types/ListingEntity.ts +1 -2
- package/src/types/ListingFields.ts +2 -4
- package/src/types/Listings.ts +1 -0
- package/src/util/mapUtil.js +41 -48
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapListContext.js","sources":["../../src/contexts/mapListContext.tsx"],"sourcesContent":["import React, { createContext, useState, useEffect, useContext, ReactNode } from 'react';\n\nimport { generateFilterOptions, applyFilters, filterListingsByLocation } from '~/util/filterUtil';\nimport { getStorageObject, setStorageObject } from '~/util/localStorageUtil';\nimport { updateURLWithFilters, filtersFromURL } from '~/util/urlFilterUtil';\n\nimport { getListingEntities } from \"~/services/listingEntityService\";\nimport fetchListings from '~/services/listingAggregatorService';\n\nimport { Listing } from '~/types/Listings';\nimport { ListingEntity } from '~/types/ListingEntity';\nimport { Recruiter } from '~/types/Recruiter';\nimport { MapConfig, MapConfig as SiteConfig } from '~/types/config/MapConfig';\n\ninterface MapListContextProps {\n loading: boolean;\n allListings: Listing[];\n filteredListings: Listing[];\n mapItems: any;\n query: string | null;\n setNewFilteredListings: (filteredListings: Listing[]) => void;\n setQuery: (query: string | null) => void;\n listingEntities: Record<number, ListingEntity> | null;\n selectedFilters: Record<string, any>;\n setSelectedFilters: (filters: Record<string, any>) => void;\n filterOptions: any;\n recruiters: Record<number, Recruiter>;\n handleFilterListingsByLocation: (selectedLocation: any) => void;\n filterDialogIsOpen: boolean;\n setFilterDialogIsOpen: (isOpen: boolean) => void;\n setMobileTab: (tab: string) => void;\n mobileTab: string;\n siteConfig: SiteConfig;\n favorites: number[];\n resetEntityFilter: () => void;\n handleSettingFavorites: (favorites: number[] | null) => void;\n setFilterByFavorites: (filter: boolean) => void;\n filterByFavorites: boolean;\n commuteLocation: any | null;\n setCommuteLocation: (location: any | null) => void;\n navigateToDetails: (id: number) => void;\n navigateToEasyApply: (id: number) => void;\n Link: React.ComponentType<any>;\n linkFormat: string;\n easyApplyUrl: string;\n easyApplyText: string;\n\tisIframe: boolean;\n sortSetting: { field: string; type: string };\n setSortSetting: (setting: { field: string; type: string }) => void;\n trackEvent: (event: string) => void;\n defaultFilters?: Record<string, any>;\n hiddenFilters?: string[];\n containerStyle?: any;\n ExpandListComponent?: React.ComponentType<{ listing: any }> | ((listing: any) => JSX.Element) | null;\n}\n\nconst MapListContext = createContext<MapListContextProps | undefined>(undefined);\n\nexport const useMapList = () => {\n\tconst context = useContext(MapListContext);\n\tif (!context) {\n\t\tthrow new Error('useMapList must be used within a MapListProvider');\n\t}\n\treturn context;\n};\n\nconst getQuery = (): string | null => {\n\tlet query: string | null = null;\n\tif (typeof window !== 'undefined') {\n\t\tquery = localStorage.getItem('query');\n\t}\n\treturn query;\n};\n\ninterface MapListProviderProps {\n children: ReactNode;\n siteConfig: MapConfig;\n resetFilters: boolean;\n navigateToDetails: (id: number) => void;\n navigateToEasyApply: (id: number) => void;\n Link: React.ComponentType<any>;\n linkFormat: string;\n easyApplyUrl: string;\n easyApplyText: string;\n\tisIframe: boolean;\n trackEvent: (event: string) => void;\n listings?: Listing[];\n\tentities?: ListingEntity[];\n setFiltersUrl?:boolean;\n hiddenFilters?: string[];\n handleUrlUpdate: (searchParams: string) => void;\n defaultFilters?: Record<string, any>;\n containerStyle?: any;\n\tlocalStorageKey: string;\n ExpandListComponent?: React.ComponentType<{ listing: Listing }> | ((listing: Listing) => JSX.Element) | null;\n}\n\nexport const MapListProvider: React.FC<MapListProviderProps> = ({\n\tchildren,\n\tsiteConfig,\n\tresetFilters,\n\tnavigateToDetails,\n\tnavigateToEasyApply,\n\tLink,\n\tlinkFormat,\n\teasyApplyUrl,\n\teasyApplyText,\n\tisIframe,\n\ttrackEvent,\n\tlistings = [],\n\tentities = [],\n\tsetFiltersUrl,\n\thiddenFilters,\n\thandleUrlUpdate,\n\tdefaultFilters,\n\tcontainerStyle,\n\tExpandListComponent,\n\tlocalStorageKey\n}) => {\n\tconst firstLoadFilters = () =>{\n\t\tlet urlFilters = filtersFromURL(window.location)?.filters;\n\t\treturn (setFiltersUrl === true && urlFilters && Object.keys(urlFilters).length > 0) ? urlFilters : getStorageObject(localStorageKey + 'selectedFilters', {}) || {}\n\t}\n\tconst [allListings, setAllListings] = useState<Listing[]>([]);\n\tconst [filteredListings, setFilteredListings] = useState<Listing[]>([]);\n\tconst [loading, setLoading] = useState<boolean>(false);\n\tconst [mapItems, setMapItems] = useState<any>(getStorageObject('mapItems', []) || []);\n\tconst [query, setQuery] = useState<string | null>(() => resetFilters ? null : getQuery());\n\tconst [sortSetting, setSortSetting] = useState<{ field: string; type: string }>(getStorageObject('sortSetting', { field: 'position', type: 'asc' }) || { field: 'position', type: 'asc' });\n\tconst [listingEntities, setListingEntities] = useState<Record<number, ListingEntity> | null>({});\n\tconst [firstLoad, setFirstLoad] = useState<boolean>(true);\n\tconst [commuteLocation, setCommuteLocation] = useState<any | null>(getStorageObject('commuteLocation'));\n\tconst [selectedFilters, setSelectedFilters] = useState<Record<string, any>>(() => resetFilters ? {} : firstLoadFilters());\n\tconst [filterOptions, setFilterOptions] = useState<any>();\n\tconst [recruiters, setRecruiters] = useState<Record<number, Recruiter>>({});\n\tconst [filterDialogIsOpen, setFilterDialogIsOpen] = useState<boolean>(false);\n\tconst [mobileTab, setMobileTab] = useState<string>(\"listTab\");\n\tconst [favorites, setFavorites] = useState<number[]>([]);\n\tconst [filterByFavorites, setFilterByFavorites] = useState<boolean>(false);\n\n\tconst setNewFilteredListings = (filteredListings: Listing[]) => {\n\t\tsetFilteredListings(filteredListings);\n\t};\n\n\tuseEffect(() => {\n\t\tif (!sortSetting) return;\n\t\tlocalStorage.setItem('sortSetting', JSON.stringify(sortSetting));\n\t\tsetNewFilteredListings(filteredListings);\n\t}, [sortSetting]);\n\n\tuseEffect(() => {\n\t\tconst loadedFavorites = JSON.parse(localStorage.getItem('favorites') || '[]');\n\t\tsetFavorites(loadedFavorites);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tsetStorageObject(\"commuteLocation\", commuteLocation);\n\t}, [commuteLocation]);\n\n\tuseEffect(() => {\n\t\tif (!commuteLocation) return;\n\n\t\tasync function fetchEntities() {\n\t\t\ttry {\n\t\t\t\t//gonna need to fix this here\n\t\t\t\tconsole.log(\"Fetching entities for commute location\", commuteLocation);\n\t\t\t\tconst fetchedEntities = await getListingEntities(\n\t\t\t\t\t`${commuteLocation.lat}, ${commuteLocation.lng}`\n\t\t\t\t);\n\t\t\t\tconst entitiesByKey = fetchedEntities;\n\n\t\t\t\tsetListingEntities(fetchedEntities);\n\t\t\t\tconst newFilteredListings: Listing[] = [...filteredListings] ?? [];\n\t\t\t\tconsole.log(\"Filtered lsitngs:\", newFilteredListings);\n\t\t\t\tconsole.log(\"all listings\", allListings);\n\t\t\t\tfor (let i = 0; i < allListings.length; i++) {\n\t\t\t\t\tconst listing = newFilteredListings[i];\n\t\t\t\t\tif (\n\t\t\t\t\t\tlisting &&\n\t\t\t\t\t\tlisting.fields &&\n\t\t\t\t\t\tlisting.fields.entityKey !== undefined &&\n\t\t\t\t\t\tlisting.fields.entityKey !== ''\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst entityKey = listing.fields.entityKey;\n\t\t\t\t\t\tconst travelTime = entitiesByKey[entityKey]?.travelTime;\n\t\t\t\t\t\tconsole.log(\"Entity for listing with travel time\", entityKey, entitiesByKey[entityKey]);\n\t\t\t\t\t\tif (travelTime !== undefined && listing.fields) {\n\t\t\t\t\t\t\tconsole.log(\"Setting travel time for listing\", travelTime);\n\t\t\t\t\t\t\tlisting.fields.travelTime = travelTime;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(\"Failed to fetch listing entities:\", error);\n\t\t\t}\n\t\t}\n\n\t\tfetchEntities();\n\t}, [commuteLocation, allListings, siteConfig.companyId]);\n\n\tuseEffect(() => {\n\t\tconst handleFetchListings = async () => {\n\t\t\tif (!getStorageObject('listings') ?? [].length) {\n\t\t\t\tsetLoading(true);\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst {\n\t\t\t\t\tlistingsResult,\n\t\t\t\t\tentitiesByKey,\n\t\t\t\t\tdistinctItems\n\t\t\t\t} = await fetchListings(commuteLocation, entities, listings);\n\t\t\t\tif (defaultFilters) {\n\t\t\t\t\tconst filteredListings = listingsResult.filter(listing => {\n\t\t\t\t\tif (!listing.fields) return false;\n\n\t\t\t\t\treturn Object.keys(defaultFilters).every(filterKey => {\n\t\t\t\t\t\tconst filterValues = defaultFilters[filterKey as keyof typeof defaultFilters];\n\t\t\t\t\t\tconst listingValue = listing.fields ? listing.fields[filterKey as keyof typeof listing.fields] : null;\n\t\t\t\t\t\treturn filterValues.includes(listingValue);\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t\tsetAllListings(filteredListings);\n\t\t\t} else {\n\t\t\t\tsetAllListings(listingsResult);\n\t\t\t}\n\t\t\t\tsetListingEntities(entitiesByKey);\n\t\t\t\tsetMapItems(Object.values(mapItems));\n\t\t\t} catch (error) {\n\t\t\t\tconsole.log(error);\n\t\t\t}\n\t\t\tsetLoading(false);\n\t\t};\n\t\thandleFetchListings();\n\t}, [query, siteConfig, commuteLocation]);\n\n\tuseEffect(() => {\n\t\tconst processListings = () => {\n\t\t\tlet filteredListings: Listing[];\n\t\t\tlet tempSelectedFilters = selectedFilters;\n\t\t\tlet tempQuery = query;\n\n\t\t\tconst { mapItems, filteredListings: tempFilteredListings } = applyFilters(\n\t\t\t\tallListings,\n\t\t\t\ttempSelectedFilters,\n\t\t\t\ttempQuery,\n\t\t\t\tlistingEntities,\n\t\t\t\tfavorites,\n\t\t\t\tsiteConfig\n\t\t\t);\n\t\t\tfilteredListings = tempFilteredListings;\n\n\t\t\tif (filterByFavorites) {\n\t\t\t\tfilteredListings = filteredListings.filter((x: Listing) => favorites.includes(x.id));\n\t\t\t}\n\t\t\tsetNewFilteredListings(filteredListings);\n\t\t\tif (firstLoad && tempSelectedFilters) {\n\t\t\t\t// Update URL with filters if needed\n\t\t\t} else if (Object.keys(tempSelectedFilters).length === 0 && !firstLoad) {\n\t\t\t\tlocalStorage.removeItem('selectedFilters');\n\t\t\t} else if (!firstLoad) {\n\t\t\t\tsetStorageObject(localStorageKey + 'selectedFilters', tempSelectedFilters);\n\t\t\t}\n\t\t\tif(setFiltersUrl === true)\n\t\t\t{\n\t\t\t\tupdateURLWithFilters(tempSelectedFilters, window.location, tempQuery, handleUrlUpdate);\n\t\t\t}\n\t\t\ttempQuery != null ? localStorage.setItem('query', tempQuery) : localStorage.removeItem('query');\n\t\t\tsetMapItems(Object.values(mapItems));\n\n\t\t\tif (tempSelectedFilters) {\n\t\t\t\tconst keys = Object.keys(tempSelectedFilters);\n\t\t\t\tconst lastKey = keys[keys.length - 1];\n\t\t\t\tconst options = generateFilterOptions(\n\t\t\t\t\tfilteredListings,\n\t\t\t\t\tallListings,\n\t\t\t\t\tsiteConfig,\n\t\t\t\t\tfilterOptions,\n\t\t\t\t\tlastKey,\n\t\t\t\t\tfavorites,\n\t\t\t\t\ttempSelectedFilters\n\t\t\t\t);\n\t\t\t\tif (options) {\n\t\t\t\t\tsetFilterOptions(options);\n\t\t\t\t\tif (firstLoad) setFirstLoad(false);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tprocessListings();\n\t}, [selectedFilters, query, listingEntities, filterByFavorites, favorites]);\n\n\tconst handleFilterListingsByLocation = (selectedLocation: any) => {\n\t\tconst { filteredListings } = filterListingsByLocation(\n\t\t\tallListings,\n\t\t\tselectedLocation,\n\t\t\tlistingEntities\n\t\t);\n\t\tsetNewFilteredListings(filteredListings);\n\t};\n\n\tconst resetEntityFilter = () => {\n\t\tlet newFilters = {...selectedFilters};\n\t\tdelete newFilters.entityId;\n\t\tsetSelectedFilters(newFilters);\n\t}\n\n\tconst handleSettingFavorites = (newFavorites: number[] | null) => {\n\t\tif (newFavorites == null) {\n\t\t\tlocalStorage.removeItem('favorites');\n\t\t} else {\n\t\t\tsetFavorites(newFavorites);\n\t\t\tlocalStorage.setItem('favorites', JSON.stringify(newFavorites));\n\t\t}\n\t};\n\n\treturn (\n\t\t<MapListContext.Provider value={{\n\t\t\tloading,\n\t\t\tallListings,\n\t\t\tfilteredListings,\n\t\t\tmapItems,\n\t\t\tquery,\n\t\t\tsetNewFilteredListings,\n\t\t\tsetQuery,\n\t\t\tlistingEntities,\n\t\t\tselectedFilters,\n\t\t\tsetSelectedFilters,\n\t\t\tfilterOptions,\n\t\t\trecruiters,\n\t\t\thandleFilterListingsByLocation,\n\t\t\tfilterDialogIsOpen,\n\t\t\tsetFilterDialogIsOpen,\n\t\t\tsetMobileTab,\n\t\t\tmobileTab,\n\t\t\tsiteConfig,\n\t\t\tfavorites,\n\t\t\thandleSettingFavorites,\n\t\t\tresetEntityFilter,\n\t\t\tsetFilterByFavorites,\n\t\t\tfilterByFavorites,\n\t\t\tcommuteLocation,\n\t\t\tsetCommuteLocation,\n\t\t\tnavigateToDetails,\n\t\t\tnavigateToEasyApply,\n\t\t\tLink,\n\t\t\tlinkFormat,\n\t\t\teasyApplyUrl,\n\t\t\teasyApplyText,\n\t\t\tisIframe,\n\t\t\tsortSetting,\n\t\t\tsetSortSetting,\n\t\t\ttrackEvent,\n\t\t\tdefaultFilters,\n\t\t\thiddenFilters,\n\t\t\tcontainerStyle,\n\t\t\tExpandListComponent\n\t\t}}>\n\t\t\t{children}\n\t\t</MapListContext.Provider>\n\t);\n};\n"],"names":["React"],"mappings":";;;;;;;AAwDA,MAAM,cAAc,GAAG,aAAa,CAAkC,SAAS,CAAC,CAAC;AAE1E,MAAM,UAAU,GAAG,MAAK;AAC9B,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAC3C,IAAI,CAAC,OAAO,EAAE;AACb,QAAA,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;AACpE,KAAA;AACD,IAAA,OAAO,OAAO,CAAC;AAChB,EAAE;AAEF,MAAM,QAAQ,GAAG,MAAoB;IACpC,IAAI,KAAK,GAAkB,IAAI,CAAC;AAChC,IAAA,IAAI,OAAO,MAAM,KAAK,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AC;AAChE,SAAA;AACF,KAAC,CAAC;AAEF,IAAA,QACCA,cAAC,CAAA,aAAA,CAAA,cAAc,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE;YAC/B,OAAO;YACP,WAAW;YACX,gBAAgB;YAChB,QAAQ;YACR,KAAK;YACL,sBAAsB;YACtB,QAAQ;YACR,eAAe;YACf,eAAe;YACf,kBAAkB;YAClB,aAAa;YACb,UAAU;YACV,8BAA8B;YAC9B,kBAAkB;YAClB,qBAAqB;YACrB,YAAY;YACZ,SAAS;YACT,UAAU;YACV,SAAS;YACT,sBAAsB;YACtB,iBAAiB;YACjB,oBAAoB;YACpB,iBAAiB;YACjB,eAAe;YACf,kBAAkB;YAClB,iBAAiB;YACjB,mBAAmB;YACnB,IAAI;YACJ,UAAU;YACV,YAAY;YACZ,aAAa;YACb,QAAQ;YACR,WAAW;YACX,cAAc;YACd,UAAU;YACV,cAAc;YACd,aAAa;YACb,cAAc;YACd,mBAAmB;SACnB,EACC,EAAA,QAAQ,CACgB,EACzB;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"mapListContext.js","sources":["../../src/contexts/mapListContext.tsx"],"sourcesContent":["import React, { createContext, useState, useEffect, useContext, ReactNode } from 'react';\n\nimport { generateFilterOptions, applyFilters, filterListingsByLocation } from '~/util/filterUtil';\nimport { getStorageObject, setStorageObject } from '~/util/localStorageUtil';\nimport { updateURLWithFilters, filtersFromURL } from '~/util/urlFilterUtil';\n\nimport { getListingEntities } from \"~/services/listingEntityService\";\nimport fetchListings from '~/services/listingAggregatorService';\n\nimport { Listing } from '~/types/Listings';\nimport { ListingEntity } from '~/types/ListingEntity';\nimport { Recruiter } from '~/types/Recruiter';\nimport { MapConfig, MapConfig as SiteConfig } from '~/types/config/MapConfig';\nimport { get } from 'http';\n\ninterface MapListContextProps {\n loading: boolean;\n allListings: Listing[];\n filteredListings: Listing[];\n mapItems: any;\n query: string | null;\n setNewFilteredListings: (filteredListings: Listing[]) => void;\n setQuery: (query: string | null) => void;\n listingEntities: Record<number, ListingEntity> | null;\n selectedFilters: Record<string, any>;\n setSelectedFilters: (filters: Record<string, any>) => void;\n filterOptions: any;\n recruiters: Record<number, Recruiter>;\n handleFilterListingsByLocation: (selectedLocation: any) => void;\n filterDialogIsOpen: boolean;\n setFilterDialogIsOpen: (isOpen: boolean) => void;\n setMobileTab: (tab: string) => void;\n mobileTab: string;\n siteConfig: SiteConfig;\n favorites: number[];\n resetEntityFilter: () => void;\n handleSettingFavorites: (favorites: number[] | null) => void;\n setFilterByFavorites: (filter: boolean) => void;\n filterByFavorites: boolean;\n commuteLocation: any | null;\n setCommuteLocation: (location: any | null) => void;\n navigateToDetails: (id: number) => void;\n navigateToEasyApply: (id: number) => void;\n Link: React.ComponentType<any>;\n linkFormat: string;\n easyApplyUrl: string;\n easyApplyText: string;\n\tisIframe: boolean;\n sortSetting: { field: string; type: string };\n setSortSetting: (setting: { field: string; type: string }) => void;\n trackEvent: (event: string) => void;\n defaultFilters?: Record<string, any>;\n hiddenFilters?: string[];\n containerStyle?: any;\n ExpandListComponent?: React.ComponentType<{ listing: any }> | ((listing: any) => JSX.Element) | null;\n}\n\nconst MapListContext = createContext<MapListContextProps | undefined>(undefined);\n\nexport const useMapList = () => {\n\tconst context = useContext(MapListContext);\n\tif (!context) {\n\t\tthrow new Error('useMapList must be used within a MapListProvider');\n\t}\n\treturn context;\n};\n\nconst getQuery = (): string | null => {\n\tlet query: string | null = null;\n\tif (typeof window !== 'undefined') {\n\t\tquery = localStorage.getItem('query');\n\t}\n\treturn query;\n};\n\ninterface MapListProviderProps {\n children: ReactNode;\n siteConfig: MapConfig;\n resetFilters: boolean;\n navigateToDetails: (id: number) => void;\n navigateToEasyApply: (id: number) => void;\n Link: React.ComponentType<any>;\n linkFormat: string;\n easyApplyUrl: string;\n easyApplyText: string;\n\tisIframe: boolean;\n trackEvent: (event: string) => void;\n listings?: Listing[];\n\tentities?: ListingEntity[];\n setFiltersUrl?:boolean;\n hiddenFilters?: string[];\n handleUrlUpdate: (searchParams: string) => void;\n defaultFilters?: Record<string, any>;\n containerStyle?: any;\n\tlocalStorageKey: string;\n\tgetListingEntitiesCallback?: (entityIds: number[], origin?: string) => Promise<ListingEntity[]>;\n ExpandListComponent?: React.ComponentType<{ listing: Listing }> | ((listing: Listing) => JSX.Element) | null;\n}\n\nexport const MapListProvider: React.FC<MapListProviderProps> = ({\n\tchildren,\n\tsiteConfig,\n\tresetFilters,\n\tnavigateToDetails,\n\tnavigateToEasyApply,\n\tLink,\n\tlinkFormat,\n\teasyApplyUrl,\n\teasyApplyText,\n\tisIframe,\n\ttrackEvent,\n\tlistings = [],\n\tentities = [],\n\tsetFiltersUrl,\n\thiddenFilters,\n\thandleUrlUpdate,\n\tdefaultFilters,\n\tcontainerStyle,\n\tExpandListComponent,\n\tgetListingEntitiesCallback,\n\tlocalStorageKey\n}) => {\n\tconst firstLoadFilters = () =>{\n\t\tlet urlFilters = filtersFromURL(window.location)?.filters;\n\t\treturn (setFiltersUrl === true && urlFilters && Object.keys(urlFilters).length > 0) ? urlFilters : getStorageObject(localStorageKey + 'selectedFilters', {}) || {}\n\t}\n\tconst [allListings, setAllListings] = useState<Listing[]>([]);\n\tconst [filteredListings, setFilteredListings] = useState<Listing[]>([]);\n\tconst [loading, setLoading] = useState<boolean>(false);\n\tconst [mapItems, setMapItems] = useState<any>(getStorageObject('mapItems', []) || []);\n\tconst [query, setQuery] = useState<string | null>(() => resetFilters ? null : getQuery());\n\tconst [sortSetting, setSortSetting] = useState<{ field: string; type: string }>(getStorageObject('sortSetting', { field: 'position', type: 'asc' }) || { field: 'position', type: 'asc' });\n\tconst [listingEntities, setListingEntities] = useState<Record<number, ListingEntity> | null>({});\n\tconst [firstLoad, setFirstLoad] = useState<boolean>(true);\n\tconst [commuteLocation, setCommuteLocation] = useState<any | null>(getStorageObject('commuteLocation'));\n\tconst [selectedFilters, setSelectedFilters] = useState<Record<string, any>>(() => resetFilters ? {} : firstLoadFilters());\n\tconst [filterOptions, setFilterOptions] = useState<any>();\n\tconst [recruiters, setRecruiters] = useState<Record<number, Recruiter>>({});\n\tconst [filterDialogIsOpen, setFilterDialogIsOpen] = useState<boolean>(false);\n\tconst [mobileTab, setMobileTab] = useState<string>(\"listTab\");\n\tconst [favorites, setFavorites] = useState<number[]>([]);\n\tconst [filterByFavorites, setFilterByFavorites] = useState<boolean>(false);\n\n\tconst setNewFilteredListings = (filteredListings: Listing[]) => {\n\t\tsetFilteredListings(filteredListings);\n\t};\n\n\tuseEffect(() => {\n\t\tif (!sortSetting) return;\n\t\tlocalStorage.setItem('sortSetting', JSON.stringify(sortSetting));\n\t\tsetNewFilteredListings(filteredListings);\n\t}, [sortSetting]);\n\n\tuseEffect(() => {\n\t\tconst loadedFavorites = JSON.parse(localStorage.getItem('favorites') || '[]');\n\t\tsetFavorites(loadedFavorites);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tsetStorageObject(\"commuteLocation\", commuteLocation);\n\t}, [commuteLocation]);\n\n\tuseEffect(() => {\n\t\tif (!commuteLocation) return;\n\n\t\tasync function fetchEntities() {\n\t\t\tconst distinctEntityIds = [\n\t\t\t\t...new Set(allListings.map(listing => listing.entityId ?? -1))\n\t\t\t];\n\t\t\ttry {\n\t\t\t\tconsole.log(getListingEntitiesCallback);\n\t\t\t\tconsole.log(\"fetching entities\")\n\t\t\t\tconst fetchedEntities = getListingEntitiesCallback !== null && getListingEntitiesCallback !== undefined ? await getListingEntitiesCallback(distinctEntityIds,\n\t\t\t\t\t`${commuteLocation.lat}, ${commuteLocation.lng}`) : await getListingEntities(\n\t\t\t\t\tdistinctEntityIds,\n\t\t\t\t\t`${commuteLocation.lat}, ${commuteLocation.lng}`\n\t\t\t\t);\n\t\t\t\tsetListingEntities(fetchedEntities);\n\t\t\t\tconst newFilteredListings: Listing[] = [...filteredListings] ?? [];\n\t\t\t\tfor (let i = 0; i < allListings.length; i++) {\n\t\t\t\t\tconst listing = newFilteredListings[i];\n\t\t\t\t\tif (\n\t\t\t\t\t\tlisting &&\n\t\t\t\t\t\tlisting.fields &&\n\t\t\t\t\t\tlisting.entityId !== undefined &&\n\t\t\t\t\t\tlisting.entityId !== -1\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst entityId = listing.entityId;\n\t\t\t\t\t\tconst travelTime = fetchedEntities[entityId]?.travelTime;\n\n\t\t\t\t\t\tif (travelTime !== undefined && listing.fields) {\n\t\t\t\t\t\t\tlisting.fields.travelTime = travelTime;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(\"Failed to fetch listing entities:\", error);\n\t\t\t}\n\t\t}\n\n\t\tfetchEntities();\n\t}, [commuteLocation, allListings, siteConfig.companyId]);\n\n\tuseEffect(() => {\n\t\tconst handleFetchListings = async () => {\n\t\t\tif (!getStorageObject('listings') ?? [].length) {\n\t\t\t\tsetLoading(true);\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst {\n\t\t\t\t\tlistingsResult,\n\t\t\t\t\tfetchedEntities,\n\t\t\t\t\tdistinctItems\n\t\t\t\t} = await fetchListings(commuteLocation, entities, listings, getListingEntitiesCallback);\n\t\t\t\tif (defaultFilters) {\n\t\t\t\t\tconst filteredListings = listingsResult.filter(listing => {\n\t\t\t\t\tif (!listing.fields) return false;\n\n\t\t\t\t\treturn Object.keys(defaultFilters).every(filterKey => {\n\t\t\t\t\t\tconst filterValues = defaultFilters[filterKey as keyof typeof defaultFilters];\n\t\t\t\t\t\tconst listingValue = listing.fields ? listing.fields[filterKey as keyof typeof listing.fields] : null;\n\t\t\t\t\t\treturn filterValues.includes(listingValue);\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t\tsetAllListings(filteredListings);\n\t\t\t} else {\n\t\t\t\tsetAllListings(listingsResult);\n\t\t\t}\n\t\t\t\tsetListingEntities(fetchedEntities);\n\t\t\t\tsetMapItems(distinctItems);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.log(error);\n\t\t\t}\n\t\t\tsetLoading(false);\n\t\t};\n\t\thandleFetchListings();\n\t}, [query, siteConfig, commuteLocation]);\n\n\tuseEffect(() => {\n\t\tconst processListings = () => {\n\t\t\tlet filteredListings: Listing[];\n\t\t\tlet tempSelectedFilters = selectedFilters;\n\t\t\tlet tempQuery = query;\n\n\t\t\tconst { mapItems, filteredListings: tempFilteredListings } = applyFilters(\n\t\t\t\tallListings,\n\t\t\t\ttempSelectedFilters,\n\t\t\t\ttempQuery,\n\t\t\t\tlistingEntities,\n\t\t\t\tfavorites,\n\t\t\t\tsiteConfig\n\t\t\t);\n\t\t\tfilteredListings = tempFilteredListings;\n\n\t\t\tif (filterByFavorites) {\n\t\t\t\tfilteredListings = filteredListings.filter((x: Listing) => favorites.includes(x.id));\n\t\t\t}\n\t\t\tsetNewFilteredListings(filteredListings);\n\t\t\tif (firstLoad && tempSelectedFilters) {\n\t\t\t\t// Update URL with filters if needed\n\t\t\t} else if (Object.keys(tempSelectedFilters).length === 0 && !firstLoad) {\n\t\t\t\tlocalStorage.removeItem('selectedFilters');\n\t\t\t} else if (!firstLoad) {\n\t\t\t\tsetStorageObject(localStorageKey + 'selectedFilters', tempSelectedFilters);\n\t\t\t}\n\t\t\tif(setFiltersUrl === true)\n\t\t\t{\n\t\t\t\tupdateURLWithFilters(tempSelectedFilters, window.location, tempQuery, handleUrlUpdate);\n\t\t\t}\n\t\t\ttempQuery != null ? localStorage.setItem('query', tempQuery) : localStorage.removeItem('query');\n\t\t\tsetMapItems(mapItems);\n\n\t\t\tif (tempSelectedFilters) {\n\t\t\t\tconst keys = Object.keys(tempSelectedFilters);\n\t\t\t\tconst lastKey = keys[keys.length - 1];\n\t\t\t\tconst options = generateFilterOptions(\n\t\t\t\t\tfilteredListings,\n\t\t\t\t\tallListings,\n\t\t\t\t\tsiteConfig,\n\t\t\t\t\tfilterOptions,\n\t\t\t\t\tlastKey,\n\t\t\t\t\tfavorites,\n\t\t\t\t\ttempSelectedFilters\n\t\t\t\t);\n\t\t\t\tif (options) {\n\t\t\t\t\tsetFilterOptions(options);\n\t\t\t\t\tif (firstLoad) setFirstLoad(false);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tprocessListings();\n\t}, [selectedFilters, query, listingEntities, filterByFavorites, favorites]);\n\n\tconst handleFilterListingsByLocation = (selectedLocation: any) => {\n\t\tconst { filteredListings } = filterListingsByLocation(\n\t\t\tallListings,\n\t\t\tselectedLocation,\n\t\t\tlistingEntities\n\t\t);\n\t\tsetNewFilteredListings(filteredListings);\n\t};\n\n\tconst resetEntityFilter = () => {\n\t\tlet newFilters = {...selectedFilters};\n\t\tdelete newFilters.entityId;\n\t\tsetSelectedFilters(newFilters);\n\t}\n\n\tconst handleSettingFavorites = (newFavorites: number[] | null) => {\n\t\tif (newFavorites == null) {\n\t\t\tlocalStorage.removeItem('favorites');\n\t\t} else {\n\t\t\tsetFavorites(newFavorites);\n\t\t\tlocalStorage.setItem('favorites', JSON.stringify(newFavorites));\n\t\t}\n\t};\n\n\treturn (\n\t\t<MapListContext.Provider value={{\n\t\t\tloading,\n\t\t\tallListings,\n\t\t\tfilteredListings,\n\t\t\tmapItems,\n\t\t\tquery,\n\t\t\tsetNewFilteredListings,\n\t\t\tsetQuery,\n\t\t\tlistingEntities,\n\t\t\tselectedFilters,\n\t\t\tsetSelectedFilters,\n\t\t\tfilterOptions,\n\t\t\trecruiters,\n\t\t\thandleFilterListingsByLocation,\n\t\t\tfilterDialogIsOpen,\n\t\t\tsetFilterDialogIsOpen,\n\t\t\tsetMobileTab,\n\t\t\tmobileTab,\n\t\t\tsiteConfig,\n\t\t\tfavorites,\n\t\t\thandleSettingFavorites,\n\t\t\tresetEntityFilter,\n\t\t\tsetFilterByFavorites,\n\t\t\tfilterByFavorites,\n\t\t\tcommuteLocation,\n\t\t\tsetCommuteLocation,\n\t\t\tnavigateToDetails,\n\t\t\tnavigateToEasyApply,\n\t\t\tLink,\n\t\t\tlinkFormat,\n\t\t\teasyApplyUrl,\n\t\t\teasyApplyText,\n\t\t\tisIframe,\n\t\t\tsortSetting,\n\t\t\tsetSortSetting,\n\t\t\ttrackEvent,\n\t\t\tdefaultFilters,\n\t\t\thiddenFilters,\n\t\t\tcontainerStyle,\n\t\t\tExpandListComponent\n\t\t}}>\n\t\t\t{children}\n\t\t</MapListContext.Provider>\n\t);\n};\n"],"names":["React"],"mappings":";;;;;;;AAyDA,MAAM,cAAc,GAAG,aAAa,CAAkC,SAAS,CAAC,CAAC;AAE1E,MAAM,UAAU,GAAG,MAAK;AAC9B,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAC3C,IAAI,CAAC,OAAO,EAAE;AACb,QAAA,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;AACpE,KAAA;AACD,IAAA,OAAO,OAAO,CAAC;AAChB,EAAE;AAEF,MAAM,QAAQ,GAAG,MAAoB;IACpC,IAAI,KAAK,GAAkB,IAAI,CAAC;AAChC,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AAClC,QAAA,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AACtC,KAAA;AACD,IAAA,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AA0BW,MAAA,eAAe,GAAmC,CAAC,EAC/D,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,UAAU,EACV,QAAQ,GAAG,EAAE,EACb,QAAQ,GAAG,EAAE,EACb,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,0BAA0B,EAC1B,eAAe,EACf,KAAI;IACJ,MAAM,gBAAgB,GAAG,MAAK;QAC7B,IAAI,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;AAC1D,QAAA,OAAQ,CAAC,aAAa,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ACnB,EACC,EAAA,QAAQ,CACgB,EACzB;AACH;;;;"}
|
|
@@ -2,30 +2,29 @@ import { getListings } from './listingService.js';
|
|
|
2
2
|
import { getListingEntities } from './listingEntityService.js';
|
|
3
3
|
import { getDistinctItemsByProximity } from '../util/mapUtil.js';
|
|
4
4
|
|
|
5
|
-
const fetchListings = async (commuteLocation = null, entities, listings) => {
|
|
5
|
+
const fetchListings = async (commuteLocation = null, entities, listings, getListingEntitiesCallback) => {
|
|
6
6
|
try {
|
|
7
7
|
const listingsResult = listings && listings.length > 0 ? listings : await getListings();
|
|
8
|
+
const distinctEntityIds = [
|
|
9
|
+
...new Set(listingsResult.map(listing => listing.entityId))
|
|
10
|
+
];
|
|
8
11
|
const fetchedEntities = !commuteLocation
|
|
9
|
-
? entities && entities.length > 0 ? entities : await getListingEntities()
|
|
10
|
-
: await getListingEntities(`${commuteLocation.lat}, ${commuteLocation.lng}`);
|
|
11
|
-
//possible quick workaround fix, need to implement clearer code
|
|
12
|
-
const entitiesByKey = fetchedEntities;
|
|
12
|
+
? entities && entities.length > 0 ? entities : !getListingEntitiesCallback ? await getListingEntities(distinctEntityIds) : await getListingEntitiesCallback(distinctEntityIds)
|
|
13
|
+
: !getListingEntitiesCallback ? await getListingEntities(distinctEntityIds, `${commuteLocation.lat}, ${commuteLocation.lng}`) : await getListingEntitiesCallback(distinctEntityIds, `${commuteLocation.lat}, ${commuteLocation.lng}`);
|
|
13
14
|
for (let i = 0; i < listingsResult.length; i++) {
|
|
14
15
|
const listing = listingsResult[i];
|
|
15
|
-
if (listing.
|
|
16
|
-
const entity =
|
|
17
|
-
console.log("Entity for listing with travel time", listing.fields.entityKey, entity);
|
|
16
|
+
if (listing.entityId && listing.entityId !== -1 && listing.fields) {
|
|
17
|
+
const entity = fetchedEntities[listing.entityId];
|
|
18
18
|
if (entity) {
|
|
19
19
|
listing.fields.travelTime = entity.travelTime;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
const distinctItems = getDistinctItemsByProximity(listingsResult,
|
|
23
|
+
const distinctItems = getDistinctItemsByProximity(listingsResult, fetchedEntities);
|
|
24
24
|
return {
|
|
25
25
|
listingsResult,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
distinctItems: distinctItems
|
|
26
|
+
fetchedEntities,
|
|
27
|
+
distinctItems
|
|
29
28
|
};
|
|
30
29
|
}
|
|
31
30
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listingAggregatorService.js","sources":["../../src/services/listingAggregatorService.ts"],"sourcesContent":["import { getListings } from '~/services/listingService';\nimport { getListingEntities } from '~/services/listingEntityService';\nimport { getDistinctItemsByProximity } from '~/util/mapUtil';\nimport { Listing } from '~/types/Listings';\nimport { ListingEntity } from '~/types/ListingEntity';\n\ninterface FetchListingsResult {\n listingsResult: Listing[];\n
|
|
1
|
+
{"version":3,"file":"listingAggregatorService.js","sources":["../../src/services/listingAggregatorService.ts"],"sourcesContent":["import { getListings } from '~/services/listingService';\nimport { getListingEntities } from '~/services/listingEntityService';\nimport { getDistinctItemsByProximity } from '~/util/mapUtil';\nimport { Listing } from '~/types/Listings';\nimport { ListingEntity } from '~/types/ListingEntity';\n\ninterface FetchListingsResult {\n listingsResult: Listing[];\n fetchedEntities: Record<number, ListingEntity>;\n distinctItems: any; // Update this type based on the return type of getDistinctItemsByProximity\n}\n\nconst fetchListings = async (\n\tcommuteLocation: any | null = null,\n\tentities: ListingEntity[] | null,\n\tlistings: Listing[] | null,\n\tgetListingEntitiesCallback?: (entityIds: number[], origin?: string) => Promise<ListingEntity[]>,\n): Promise<FetchListingsResult> => {\n\ttry {\n\t\tconst listingsResult = listings && listings.length > 0 ? listings : await getListings();\n\t\tconst distinctEntityIds: number[] = [\n\t\t\t...new Set(listingsResult.map(listing => listing.entityId))\n\t\t] as number[];\n\n\t\tconst fetchedEntities = !commuteLocation\n\t\t\t? entities && entities.length > 0 ? entities : !getListingEntitiesCallback ? await getListingEntities(distinctEntityIds) : await getListingEntitiesCallback(distinctEntityIds)\n\t\t\t: !getListingEntitiesCallback ? await getListingEntities(\n\t\t\t\tdistinctEntityIds,\n\t\t\t\t`${commuteLocation.lat}, ${commuteLocation.lng}`\n\t\t\t) : await getListingEntitiesCallback(\tdistinctEntityIds,\n\t\t\t\t`${commuteLocation.lat}, ${commuteLocation.lng}`);\n\t\tfor (let i = 0; i < listingsResult.length; i++) {\n\t\t\tconst listing = listingsResult[i];\n\t\t\tif (listing.entityId && listing.entityId !== -1 && listing.fields) {\n\t\t\t\tconst entity = fetchedEntities[listing.entityId];\n\t\t\t\tif (entity) {\n\t\t\t\t\tlisting.fields.travelTime = entity.travelTime;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst distinctItems = getDistinctItemsByProximity(\n\t\t\tlistingsResult,\n\t\t\tfetchedEntities\n\t\t);\n\n\t\treturn {\n\t\t\tlistingsResult,\n\t\t\tfetchedEntities,\n\t\t\tdistinctItems\n\t\t};\n\t} catch (error) {\n\t\tconsole.error(\"Error fetching listings:\", error);\n\t\tthrow error;\n\t}\n};\n\nexport default fetchListings;\n"],"names":[],"mappings":";;;;AAYA,MAAM,aAAa,GAAG,OACrB,eAA8B,GAAA,IAAI,EAClC,QAAgC,EAChC,QAA0B,EAC1B,0BAA+F,KAC9D;IACjC,IAAI;AACH,QAAA,MAAM,cAAc,GAAG,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,GAAG,QAAQ,GAAG,MAAM,WAAW,EAAE,CAAC;AACxF,QAAA,MAAM,iBAAiB,GAAa;AACnC,YAAA,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;SAC/C,CAAC;QAEd,MAAM,eAAe,GAAG,CAAC,eAAe;AACvC,cAAE,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,GAAG,QAAQ,GAAG,CAAC,0BAA0B,GAAG,MAAM,k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Entities = async (entityIds, origin = '') => {
|
|
4
4
|
try {
|
|
5
|
-
|
|
6
|
-
const response = await api.get(`/listingentities/MapEntities?origin=${origin}`);
|
|
5
|
+
const response = await api.post(`/ListingEntities?origin=${origin}`, entityIds);
|
|
7
6
|
return response;
|
|
8
7
|
}
|
|
9
8
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listingEntityService.js","sources":["../../src/services/listingEntityService.ts"],"sourcesContent":["import api from '~/apis/hcApi';\n\nexport const getListingEntities = async (origin = ''): Promise<
|
|
1
|
+
{"version":3,"file":"listingEntityService.js","sources":["../../src/services/listingEntityService.ts"],"sourcesContent":["import api from '~/apis/hcApi';\nimport { ListingEntity } from '~/types/ListingEntity';\n\nexport const getListingEntities = async (entityIds: number[], origin = ''): Promise<ListingEntity[]> => {\n\ttry {\n\t\tconst response = await api.post<ListingEntity[]>(`/ListingEntities?origin=${origin}`, entityIds);\n\t\treturn response;\n\t} catch (error) {\n\t\tconsole.error(\"Error fetching listing entities:\", error);\n\t\tthrow error;\n\t}\n};\n\nexport default {\n\tgetListingEntities\n};\n"],"names":[],"mappings":";;AAGO,MAAM,kBAAkB,GAAG,OAAO,SAAmB,EAAE,MAAM,GAAG,EAAE,KAA8B;IACtG,IAAI;AACH,QAAA,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,IAAI,CAAkB,CAAA,wBAAA,EAA2B,MAAM,CAAA,CAAE,EAAE,SAAS,CAAC,CAAC;AACjG,QAAA,OAAO,QAAQ,CAAC;AAChB,KAAA;AAAC,IAAA,OAAO,KAAK,EAAE;AACf,QAAA,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;AACzD,QAAA,MAAM,KAAK,CAAC;AACZ,KAAA;AACF;;;;"}
|
|
@@ -2,16 +2,22 @@ import api from '../apis/hcApi.js';
|
|
|
2
2
|
|
|
3
3
|
const getListings = async (params) => {
|
|
4
4
|
try {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
const query = new URLSearchParams();
|
|
6
|
+
if (params) {
|
|
7
|
+
if (params.location)
|
|
8
|
+
params.location.forEach(loc => query.append('location', loc));
|
|
9
|
+
if (params.category)
|
|
10
|
+
params.category.forEach(cat => query.append('category', cat));
|
|
11
|
+
if (params.categoryClass)
|
|
12
|
+
params.categoryClass.forEach(catClass => query.append('categoryClass', catClass));
|
|
13
|
+
if (params.education)
|
|
14
|
+
params.education.forEach(edu => query.append('education', edu));
|
|
15
|
+
if (params.city)
|
|
16
|
+
params.city.forEach(cty => query.append('city', cty));
|
|
17
|
+
if (params.state)
|
|
18
|
+
params.state.forEach(st => query.append('state', st));
|
|
19
|
+
}
|
|
20
|
+
const response = await api.get(`/Listings?${query.toString()}`);
|
|
15
21
|
return response;
|
|
16
22
|
}
|
|
17
23
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listingService.js","sources":["../../src/services/listingService.ts"],"sourcesContent":["// listingService.ts\nimport { GetListingsParams } from '~/types/GetListingParams';\nimport api from '../apis/hcApi';\nimport { Listing } from '../types/Listings';\n\nexport const getListings = async (params?: GetListingsParams): Promise<Listing[]> => {\n\ttry {\n\t\
|
|
1
|
+
{"version":3,"file":"listingService.js","sources":["../../src/services/listingService.ts"],"sourcesContent":["// listingService.ts\nimport { GetListingsParams } from '~/types/GetListingParams';\nimport api from '../apis/hcApi';\nimport { Listing } from '../types/Listings';\n\nexport const getListings = async (params?: GetListingsParams): Promise<Listing[]> => {\n\ttry {\n\t\tconst query = new URLSearchParams();\n\n\t\tif (params) {\n\t\t\tif (params.location) params.location.forEach(loc => query.append('location', loc));\n\t\t\tif (params.category) params.category.forEach(cat => query.append('category', cat));\n\t\t\tif (params.categoryClass) params.categoryClass.forEach(catClass => query.append('categoryClass', catClass));\n\t\t\tif (params.education) params.education.forEach(edu => query.append('education', edu));\n\t\t\tif (params.city) params.city.forEach(cty => query.append('city', cty));\n\t\t\tif (params.state) params.state.forEach(st => query.append('state', st));\n\t\t}\n\n\t\tconst response = await api.get(`/Listings?${query.toString()}`);\n\t\treturn response as Listing[];\n\t} catch (error) {\n\t\tconsole.error(error);\n\t\tthrow error;\n\t}\n};\n\nexport const getListingDetails = async (listingId: string) => {\n\ttry {\n\t\tconst response = await api.get(`/ListingDetails/${listingId}`);\n\t\treturn response;\n\t} catch (error) {\n\t\tconsole.error(error);\n\t\tthrow error;\n\t}\n};\n\nexport default {\n\tgetListings,\n\tgetListingDetails\n};\n"],"names":[],"mappings":";;MAKa,WAAW,GAAG,OAAO,MAA0B,KAAwB;IACnF,IAAI;AACH,QAAA,MAAM,KAAK,GAAG,IAAI,eAAe,EAAE,CAAC;AAEpC,QAAA,IAAI,MAAM,EAAE;YACX,IAAI,MAAM,CAAC,QAAQ;AAAE,gBAAA,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;YACnF,IAAI,MAAM,CAAC,QAAQ;AAAE,gBAAA,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;YACnF,IAAI,MAAM,CAAC,aAAa;AAAE,gBAAA,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC;YAC5G,IAAI,MAAM,CAAC,SAAS;AAAE,gBAAA,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC;YACtF,IAAI,MAAM,CAAC,IAAI;AAAE,gBAAA,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;YACvE,IAAI,MAAM,CAAC,KAAK;AAAE,gBAAA,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AACxE,SAAA;AAED,QAAA,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,CAAa,UAAA,EAAA,KAAK,CAAC,QAAQ,EAAE,CAAA,CAAE,CAAC,CAAC;AAChE,QAAA,OAAO,QAAqB,CAAC;AAC7B,KAAA;AAAC,IAAA,OAAO,KAAK,EAAE;AACf,QAAA,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACrB,QAAA,MAAM,KAAK,CAAC;AACZ,KAAA;AACF;;;;"}
|
|
@@ -73,6 +73,7 @@ interface MapListProviderProps {
|
|
|
73
73
|
defaultFilters?: Record<string, any>;
|
|
74
74
|
containerStyle?: any;
|
|
75
75
|
localStorageKey: string;
|
|
76
|
+
getListingEntitiesCallback?: (entityIds: number[], origin?: string) => Promise<ListingEntity[]>;
|
|
76
77
|
ExpandListComponent?: React.ComponentType<{
|
|
77
78
|
listing: Listing;
|
|
78
79
|
}> | ((listing: Listing) => JSX.Element) | null;
|
|
@@ -2,8 +2,8 @@ import { Listing } from '~/types/Listings';
|
|
|
2
2
|
import { ListingEntity } from '~/types/ListingEntity';
|
|
3
3
|
interface FetchListingsResult {
|
|
4
4
|
listingsResult: Listing[];
|
|
5
|
-
|
|
5
|
+
fetchedEntities: Record<number, ListingEntity>;
|
|
6
6
|
distinctItems: any;
|
|
7
7
|
}
|
|
8
|
-
declare const fetchListings: (commuteLocation: any | null, entities: ListingEntity[] | null, listings: Listing[] | null) => Promise<FetchListingsResult>;
|
|
8
|
+
declare const fetchListings: (commuteLocation: any | null, entities: ListingEntity[] | null, listings: Listing[] | null, getListingEntitiesCallback?: ((entityIds: number[], origin?: string) => Promise<ListingEntity[]>) | undefined) => Promise<FetchListingsResult>;
|
|
9
9
|
export default fetchListings;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ListingEntity } from '~/types/ListingEntity';
|
|
2
|
+
export declare const getListingEntities: (entityIds: number[], origin?: string) => Promise<ListingEntity[]>;
|
|
2
3
|
declare const _default: {
|
|
3
|
-
getListingEntities: (origin?: string) => Promise<
|
|
4
|
+
getListingEntities: (entityIds: number[], origin?: string) => Promise<ListingEntity[]>;
|
|
4
5
|
};
|
|
5
6
|
export default _default;
|
|
@@ -2,10 +2,9 @@ export type ListingFields = {
|
|
|
2
2
|
posted?: string;
|
|
3
3
|
subTitle?: string;
|
|
4
4
|
education?: string;
|
|
5
|
-
|
|
5
|
+
position?: string;
|
|
6
6
|
category?: string;
|
|
7
|
-
|
|
8
|
-
applyUrl?: string;
|
|
7
|
+
categoryClass?: string;
|
|
9
8
|
shift?: string;
|
|
10
9
|
custom1?: string;
|
|
11
10
|
custom2?: string;
|
|
@@ -23,6 +22,5 @@ export type ListingFields = {
|
|
|
23
22
|
useClientJobUrl?: boolean;
|
|
24
23
|
dateCreated: Date;
|
|
25
24
|
dateLastEdited?: Date;
|
|
26
|
-
entityKey: string;
|
|
27
25
|
travelTime?: string;
|
|
28
26
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export function getDistinctItemsByProximity(items: any,
|
|
2
|
-
export function findCloseItems(
|
|
1
|
+
export function getDistinctItemsByProximity(items: any, listingEntitiesDetails: any): any[];
|
|
2
|
+
export function findCloseItems(itemsObj: any): {
|
|
3
3
|
item1: any;
|
|
4
4
|
item2: any;
|
|
5
5
|
}[];
|
|
6
|
-
export function adjustItemPositions(
|
|
6
|
+
export function adjustItemPositions(itemsObj: any, closeItemPairs: any): any;
|
|
7
7
|
export function clusterOptions(clusterGridSize: any, fillColor: any): {
|
|
8
8
|
gridSize: any;
|
|
9
9
|
maxZoom: number;
|
package/dist/util/mapUtil.js
CHANGED
|
@@ -1,40 +1,34 @@
|
|
|
1
1
|
import { objectSpread2 as _objectSpread2, defineProperty as _defineProperty } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
2
|
|
|
3
|
-
var getDistinctItemsByProximity = function getDistinctItemsByProximity(items,
|
|
3
|
+
var getDistinctItemsByProximity = function getDistinctItemsByProximity(items, listingEntitiesDetails) {
|
|
4
4
|
var clusters = {};
|
|
5
|
-
if (!
|
|
6
|
-
var listingEntitiesDetails = Array.isArray(listingEntitiesDetailsInput) ? listingEntitiesDetailsInput.reduce(function (acc, entity) {
|
|
7
|
-
if (entity !== null && entity !== void 0 && entity.entityKey) acc[entity.entityKey] = entity;
|
|
8
|
-
return acc;
|
|
9
|
-
}, {}) : listingEntitiesDetailsInput;
|
|
5
|
+
if (!listingEntitiesDetails) return [];
|
|
10
6
|
var closeItemPairs = findCloseItems(listingEntitiesDetails);
|
|
11
7
|
if (closeItemPairs.length > 0) {
|
|
12
|
-
|
|
13
|
-
Object.assign(listingEntitiesDetails, adjusted);
|
|
8
|
+
listingEntitiesDetails = adjustItemPositions(listingEntitiesDetails, closeItemPairs);
|
|
14
9
|
}
|
|
15
10
|
items === null || items === void 0 || items.forEach(function (item) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
clusters[entityKey].items[item.id] = item;
|
|
11
|
+
if (item.entityId !== -1) {
|
|
12
|
+
var entityDetails = listingEntitiesDetails[item.entityId];
|
|
13
|
+
if (!entityDetails) {
|
|
14
|
+
console.error("Details not found for entityId: ".concat(item.entityId));
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
item.mapDetails = entityDetails;
|
|
18
|
+
if (!clusters[item.entityId]) {
|
|
19
|
+
clusters[item.entityId] = _objectSpread2(_objectSpread2({}, item.mapDetails), {}, {
|
|
20
|
+
items: _defineProperty({}, item.id, item)
|
|
21
|
+
});
|
|
22
|
+
} else {
|
|
23
|
+
clusters[item.entityId].items[item.id] = item;
|
|
24
|
+
}
|
|
31
25
|
}
|
|
32
26
|
});
|
|
33
27
|
return Object.values(clusters);
|
|
34
28
|
};
|
|
35
|
-
var findCloseItems = function findCloseItems(
|
|
29
|
+
var findCloseItems = function findCloseItems(itemsObj) {
|
|
36
30
|
var closeItems = [];
|
|
37
|
-
var items = Object.values(
|
|
31
|
+
var items = Object.values(itemsObj); // Convert object to array for iteration
|
|
38
32
|
var proximityThreshold = 0.0001;
|
|
39
33
|
for (var i = 0; i < items.length; i++) {
|
|
40
34
|
for (var j = i + 1; j < items.length; j++) {
|
|
@@ -50,16 +44,14 @@ var findCloseItems = function findCloseItems(entitiesByKey) {
|
|
|
50
44
|
}
|
|
51
45
|
return closeItems;
|
|
52
46
|
};
|
|
53
|
-
var adjustItemPositions = function adjustItemPositions(
|
|
47
|
+
var adjustItemPositions = function adjustItemPositions(itemsObj, closeItemPairs) {
|
|
54
48
|
var adjustmentValue = 0.0001;
|
|
55
|
-
var adjustedItems = _objectSpread2({},
|
|
49
|
+
var adjustedItems = _objectSpread2({}, itemsObj); // Create a shallow copy of the object
|
|
50
|
+
|
|
56
51
|
closeItemPairs.forEach(function (pair) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
adjustedItems[
|
|
60
|
-
latitude: adjustedItems[key2].latitude + adjustmentValue,
|
|
61
|
-
longitude: adjustedItems[key2].longitude + adjustmentValue
|
|
62
|
-
});
|
|
52
|
+
if (adjustedItems[pair.item1.id] && adjustedItems[pair.item2.id]) {
|
|
53
|
+
adjustedItems[pair.item2.id].latitude += adjustmentValue;
|
|
54
|
+
adjustedItems[pair.item2.id].longitude += adjustmentValue;
|
|
63
55
|
}
|
|
64
56
|
});
|
|
65
57
|
return adjustedItems;
|
package/dist/util/mapUtil.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapUtil.js","sources":["../../src/util/mapUtil.js"],"sourcesContent":["export const getDistinctItemsByProximity = (items,
|
|
1
|
+
{"version":3,"file":"mapUtil.js","sources":["../../src/util/mapUtil.js"],"sourcesContent":["export const getDistinctItemsByProximity = (items, listingEntitiesDetails) => {\n\tconst clusters = {};\n\n\tif (!listingEntitiesDetails) return [];\n\n\tconst closeItemPairs = findCloseItems(listingEntitiesDetails);\n\tif (closeItemPairs.length > 0) {\n\t\tlistingEntitiesDetails = adjustItemPositions(\n\t\t\tlistingEntitiesDetails,\n\t\t\tcloseItemPairs\n\t\t);\n\t}\n\n\titems?.forEach(item => {\n\t\tif(item.entityId !== -1){\n\n\t\t\tconst entityDetails = listingEntitiesDetails[item.entityId];\n\n\t\t\tif (!entityDetails) {\n\t\t\t\tconsole.error(`Details not found for entityId: ${item.entityId}`);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\titem.mapDetails = entityDetails;\n\n\t\t\tif (!clusters[item.entityId]) {\n\t\t\t\tclusters[item.entityId] = {\n\t\t\t\t\t...item.mapDetails,\n\t\t\t\t\titems: { [item.id]: item }\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tclusters[item.entityId].items[item.id] = item;\n\t\t\t}}\n\t});\n\n\treturn Object.values(clusters);\n};\n\nexport const findCloseItems = itemsObj => {\n\tconst closeItems = [];\n\tconst items = Object.values(itemsObj); // Convert object to array for iteration\n\tconst proximityThreshold = 0.0001;\n\n\tfor (let i = 0; i < items.length; i++) {\n\t\tfor (let j = i + 1; j < items.length; j++) {\n\t\t\tconst distanceLat = Math.abs(items[i].latitude - items[j].latitude);\n\t\t\tconst distanceLng = Math.abs(items[i].longitude - items[j].longitude);\n\t\t\tif (\n\t\t\t\tdistanceLat < proximityThreshold &&\n\t\t\t\tdistanceLng < proximityThreshold\n\t\t\t) {\n\t\t\t\tcloseItems.push({ item1: items[i], item2: items[j] });\n\t\t\t}\n\t\t}\n\t}\n\n\treturn closeItems;\n};\n\nexport const adjustItemPositions = (itemsObj, closeItemPairs) => {\n\tconst adjustmentValue = 0.0001;\n\tconst adjustedItems = { ...itemsObj }; // Create a shallow copy of the object\n\n\tcloseItemPairs.forEach(pair => {\n\t\tif (adjustedItems[pair.item1.id] && adjustedItems[pair.item2.id]) {\n\t\t\tadjustedItems[pair.item2.id].latitude += adjustmentValue;\n\t\t\tadjustedItems[pair.item2.id].longitude += adjustmentValue;\n\t\t}\n\t});\n\n\treturn adjustedItems;\n};\n\nexport const clusterOptions = (clusterGridSize, fillColor) => {\n\treturn {\n\t\tgridSize: clusterGridSize,\n\t\tmaxZoom:15,\n\t\tstyles:[{\n\t\t\turl: createSvgDataUri(fillColor),\n\t\t\ttextColor:'white',\n\t\t\theight: 40,\n\t\t\twidth: 40\n\t\t}]\n\t};\n};\n\nfunction createSvgDataUri(fillColor) {\n\tconst svg = `<svg width=\"50\" height=\"50\" xmlns=\"http://www.w3.org/2000/svg\">\n\t <circle cx=\"25\" cy=\"25\" r=\"20\" fill=\"${fillColor}\" />\n\t</svg>`;\n\treturn `data:image/svg+xml;base64,${btoa(svg)}`;\n}\n"],"names":["getDistinctItemsByProximity","items","listingEntitiesDetails","clusters","closeItemPairs","findCloseItems","length","adjustItemPositions","forEach","item","entityId","entityDetails","console","error","concat","mapDetails","_objectSpread","_defineProperty","id","Object","values","itemsObj","closeItems","proximityThreshold","i","j","distanceLat","Math","abs","latitude","distanceLng","longitude","push","item1","item2","adjustmentValue","adjustedItems","pair","clusterOptions","clusterGridSize","fillColor","gridSize","maxZoom","styles","url","createSvgDataUri","textColor","height","width","svg","btoa"],"mappings":";;AAAO,IAAMA,2BAA2B,GAAG,SAA9BA,2BAA2BA,CAAIC,KAAK,EAAEC,sBAAsB,EAAK;EAC7E,IAAMC,QAAQ,GAAG,EAAE,CAAA;AAEnB,EAAA,IAAI,CAACD,sBAAsB,EAAE,OAAO,EAAE,CAAA;AAEtC,EAAA,IAAME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AE,CAAC;;AAEtCjB,EAAAA,cAAc,CAACI,OAAO,CAAC,UAAA6B,IAAI,EAAI;AAC9B,IAAA,IAAID,aAAa,CAACC,IAAI,CAACJ,KAAK,CAACf,EAAE,CAAC,IAAIkB,aAAa,CAACC,IAAI,CAACH,KAAK,CAAChB,EAAE,CAAC,EAAE;MACjEkB,aAAa,CAACC,IAAI,CAACH,KAAK,CAAChB,EAAE,CAAC,CAACW,QAAQ,IAAIM,eAAe,CAAA;MACxDC,aAAa,CAACC,IAAI,CAACH,KAAK,CAAChB,EAAE,CAAC,CAACa,SAAS,IAAII,eAAe,CAAA;AAC1D,KAAA;AACD,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOC,aAAa,CAAA;AACrB,EAAC;AAEM,IAAME,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,eAAe,EAAEC,SAAS,EAAK;EAC7D,OAAO;AACNC,IAAAA,QAAQ,EAAEF,eAAe;AACzBG,IAAAA,OAAO,EAAC,EAAE;AACVC,IAAAA,MAAM,EAAC,CAAC;AACPC,MAAAA,GAAG,EAAEC,gBAAgB,CAACL,SAAS,CAAC;AAChCM,MAAAA,SAAS,EAAC,OAAO;AACjBC,MAAAA,MAAM,EAAE,EAAE;AACVC,MAAAA,KAAK,EAAE,EAAA;KACP,CAAA;GACD,CAAA;AACF,EAAC;AAED,SAASH,gBAAgBA,CAACL,SAAS,EAAE;AACpC,EAAA,IAAMS,GAAG,GAAA,yHAAA,CAAAnC,MAAA,CACgC0B,SAAS,EAC3C,iBAAA,CAAA,CAAA;AACP,EAAA,OAAA,4BAAA,CAAA1B,MAAA,CAAoCoC,IAAI,CAACD,GAAG,CAAC,CAAA,CAAA;AAC9C;;;;"}
|
package/package.json
CHANGED
|
@@ -100,14 +100,17 @@ export const HireControlMap = ({
|
|
|
100
100
|
console.log(eventType);
|
|
101
101
|
console.log(eventObj);
|
|
102
102
|
},
|
|
103
|
+
//providing listings entities and a getListingEntities function should negate the need for map code to fetch data
|
|
103
104
|
listings = [],
|
|
104
105
|
entities = [],
|
|
106
|
+
getListingEntitiesCallback = null,
|
|
105
107
|
defaultFilters = null,
|
|
106
108
|
hiddenFilters = null,
|
|
107
109
|
setFiltersUrl = null,
|
|
108
110
|
ExpandListComponent = null,
|
|
109
111
|
additionalMapMarkers = [],
|
|
110
112
|
defaultZoomOverride = null,
|
|
113
|
+
//Default site configuration file passed here stops need to fetch from api
|
|
111
114
|
siteConfiguration = null,
|
|
112
115
|
localStorageKey = 'defaultKey.'
|
|
113
116
|
}) => {
|
|
@@ -136,6 +139,8 @@ export const HireControlMap = ({
|
|
|
136
139
|
easyApplyText,
|
|
137
140
|
listings,
|
|
138
141
|
entities,
|
|
142
|
+
siteConfig,
|
|
143
|
+
getListingEntitiesCallback,
|
|
139
144
|
setFiltersUrl,
|
|
140
145
|
hiddenFilters,
|
|
141
146
|
handleUrlUpdate,
|
|
@@ -25,9 +25,7 @@ const MapAccordionItemContainer = ({
|
|
|
25
25
|
selectItem(null, null, 9, { lat: 39.8283, lng: -98.5795 });
|
|
26
26
|
} else {
|
|
27
27
|
setStorageObject("selectedListItem", item);
|
|
28
|
-
|
|
29
|
-
//edited here for new structure of entity key
|
|
30
|
-
const location = mapItems.find(x => Object.prototype.hasOwnProperty.call(x.items, item.entityKey)) || null;
|
|
28
|
+
const location = mapItems.find(x => Object.prototype.hasOwnProperty.call(x.items, item.id)) || null;
|
|
31
29
|
selectItem(item, location, 12, {
|
|
32
30
|
lat: location?.latitude,
|
|
33
31
|
lng: location?.longitude
|
|
@@ -57,7 +57,7 @@ const InfoWindowContentContainer = ({
|
|
|
57
57
|
newFilters.state = { [items[0].fields.state]: true };
|
|
58
58
|
filters.push({ filterType: 'state', filterChecked: items[0].fields.state });
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
newFilters.entityName = { [items[0].fields.entityName]: true };
|
|
62
62
|
filters.push({ filterType: 'entityName', filterChecked: items[0].fields.entityName });
|
|
63
63
|
|
|
@@ -256,10 +256,9 @@ const MapContainer = ({ markerConfigs, infoWindowClasses, clusterGridSize = 60 }
|
|
|
256
256
|
if (!mapItems) {
|
|
257
257
|
return null;
|
|
258
258
|
}
|
|
259
|
-
|
|
260
259
|
const mapItemsKey = mapItems.map(item => item.id).join("-");
|
|
261
260
|
|
|
262
|
-
|
|
261
|
+
console.log(location);
|
|
263
262
|
return (
|
|
264
263
|
<Map
|
|
265
264
|
zoom={zoom}
|
|
@@ -78,9 +78,9 @@ const ButtonGroupApply = ({
|
|
|
78
78
|
</Button.Anchor>
|
|
79
79
|
) : null}
|
|
80
80
|
|
|
81
|
-
{item.
|
|
81
|
+
{item.applyOnline == 1 && item.applyUrl && !includeDialog &&
|
|
82
82
|
<Button.Anchor
|
|
83
|
-
href={item.
|
|
83
|
+
href={item.applyUrl}
|
|
84
84
|
variant={applyButtonVariant}
|
|
85
85
|
size={buttonSize}
|
|
86
86
|
className={"map-apply-now-button"}
|
|
@@ -91,8 +91,8 @@ const ButtonGroupApply = ({
|
|
|
91
91
|
{applyNowText}
|
|
92
92
|
</Button.Anchor>
|
|
93
93
|
}
|
|
94
|
-
{item.
|
|
95
|
-
<ApplyDialog applyUrl={item.
|
|
94
|
+
{item.applyOnline == 1 && item.applyUrl && includeDialog &&
|
|
95
|
+
<ApplyDialog applyUrl={item.applyUrl} internalApplyLink={internalApplyLink} companyName={companyName} item={item} trackEvent={trackEvent} eventTypes={eventTypes} isIframe={isIframe}>
|
|
96
96
|
<Button.Anchor
|
|
97
97
|
variant={applyButtonVariant}
|
|
98
98
|
size={buttonSize}
|