@abcagency/hc-ui-components 1.3.96 → 1.3.98
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 +1 -1
- package/dist/apis/hcApi.js.map +1 -1
- package/dist/components/containers/accordions/map-accordion-item-container.js +3 -1
- 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 +0 -1
- package/dist/components/containers/maps/map-container.js.map +1 -1
- package/dist/contexts/mapListContext.js +16 -12
- package/dist/contexts/mapListContext.js.map +1 -1
- package/dist/services/listingAggregatorService.js +11 -10
- package/dist/services/listingAggregatorService.js.map +1 -1
- package/dist/services/listingEntityService.js +3 -2
- package/dist/services/listingEntityService.js.map +1 -1
- package/dist/services/listingService.js +14 -15
- package/dist/services/listingService.js.map +1 -1
- package/dist/types/services/listingAggregatorService.d.ts +1 -1
- package/dist/types/services/listingEntityService.d.ts +2 -3
- package/dist/types/types/ListingEntity.d.ts +2 -1
- package/dist/types/types/ListingFields.d.ts +1 -0
- package/dist/types/types/Listings.d.ts +0 -1
- package/dist/types/util/mapUtil.d.ts +3 -3
- package/dist/util/mapUtil.js +33 -25
- package/dist/util/mapUtil.js.map +1 -1
- package/package.json +1 -1
- package/src/components/containers/accordions/map-accordion-item-container.js +3 -1
- package/src/components/containers/maps/info-window-content-container.js +1 -1
- package/src/components/containers/maps/map-container.js +2 -1
- package/src/contexts/mapListContext.tsx +16 -13
- package/src/services/listingAggregatorService.ts +13 -12
- package/src/services/listingEntityService.ts +3 -3
- package/src/services/listingService.ts +19 -11
- package/src/types/ListingEntity.ts +2 -1
- package/src/types/ListingFields.ts +1 -0
- package/src/types/Listings.ts +0 -1
- package/src/util/mapUtil.js +48 -41
package/dist/apis/hcApi.js
CHANGED
package/dist/apis/hcApi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hcApi.js","sources":["../../src/apis/hcApi.ts"],"sourcesContent":["import { getClientAuthKey } from '~/clientToken';\nconst baseURL = process.env.HC_API_BASE_URL as string;\n\ninterface MemoryStorage {\n\tauthToken: string | null;\n\ttokenExpiration: string | null;\n}\n\nconst memoryStorage: MemoryStorage = {\n\tauthToken: null,\n\ttokenExpiration: null\n};\n\nfunction setStorage(key: keyof MemoryStorage, value: string): void {\n\ttry {\n\t\tsessionStorage.setItem(key, value);\n\t} catch (error) {\n\t\tmemoryStorage[key] = value;\n\t}\n}\n\nfunction getStorage(key: keyof MemoryStorage): string | null {\n\ttry {\n\t\treturn sessionStorage.getItem(key) || memoryStorage[key];\n\t} catch (error) {\n\t\treturn memoryStorage[key];\n\t}\n}\n\ninterface AuthResponse {\n\ttoken: string;\n\texpiration: string;\n}\n\nconst login = async (): Promise<AuthResponse> => {\n\tconst clientAuthKey = getClientAuthKey();\n\n\ttry {\n\t\tconst response = await fetch(`${baseURL}/auth/login`, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: {\n\t\t\t\t'Content-Type': 'application/json'\n\t\t\t},\n\t\t\tbody: JSON.stringify({\n\t\t\t\tclientAuthKey: clientAuthKey\n\t\t\t})\n\t\t});\n\n\t\tif (!response.ok) {\n\t\t\tthrow new Error('Login failed');\n\t\t}\n\n\t\tconst data = await response.json();\n\n\t\tif (data.token && data.expiration) {\n\t\t\tsetStorage('authToken', data.token);\n\t\t\tsetStorage('tokenExpiration', data.expiration);\n\t\t\treturn { token: data.token, expiration: data.expiration };\n\t\t} else {\n\t\t\tthrow new Error('Invalid login response');\n\t\t}\n\t} catch (error) {\n\t\tconsole.error('Login failed:', error);\n\t\tthrow error;\n\t}\n};\n\nconst fetchWithAuth = async (url: string, options: RequestInit = {}): Promise<Response> => {\n\tlet token = getStorage('authToken');\n\n\tconst expirationDateTime = getStorage('tokenExpiration');\n\tconst currentTime = new Date();\n\n\tif (!token || !expirationDateTime || new Date(expirationDateTime) <= currentTime) {\n\t\tconst authResponse = await login();\n\t\ttoken = authResponse.token;\n\t}\n\n\tconst headers = new Headers(options.headers || {});\n\theaders.append('Authorization', `Bearer ${token}`);\n\n\tconst finalOptions = {\n\t\t...options,\n\t\theaders\n\t};\n\n\tconst response = await fetch(`${baseURL}${url}`, finalOptions);\n\n\tif (!response.ok) throw new Error('Network response was not ok.');\n\n\treturn response;\n};\n\nexport default {\n\tget: async <T>(url: string): Promise<T> => {\n\t\tconst response = await fetchWithAuth(url);\n\t\treturn await response.json() as T;\n\t},\n\tpost: async <T>(url: string, data: any): Promise<T> => {\n\t\tconst response = await fetchWithAuth(url, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: {\n\t\t\t\t'Content-Type': 'application/json'\n\t\t\t},\n\t\t\tbody: JSON.stringify(data)\n\t\t});\n\t\treturn await response.json() as T;\n\t}\n};\n"],"names":[],"mappings":";;AACA,MAAM,OAAO,GAAG
|
|
1
|
+
{"version":3,"file":"hcApi.js","sources":["../../src/apis/hcApi.ts"],"sourcesContent":["import { getClientAuthKey } from '~/clientToken';\nconst baseURL = process.env.HC_API_BASE_URL as string;\n\ninterface MemoryStorage {\n\tauthToken: string | null;\n\ttokenExpiration: string | null;\n}\n\nconst memoryStorage: MemoryStorage = {\n\tauthToken: null,\n\ttokenExpiration: null\n};\n\nfunction setStorage(key: keyof MemoryStorage, value: string): void {\n\ttry {\n\t\tsessionStorage.setItem(key, value);\n\t} catch (error) {\n\t\tmemoryStorage[key] = value;\n\t}\n}\n\nfunction getStorage(key: keyof MemoryStorage): string | null {\n\ttry {\n\t\treturn sessionStorage.getItem(key) || memoryStorage[key];\n\t} catch (error) {\n\t\treturn memoryStorage[key];\n\t}\n}\n\ninterface AuthResponse {\n\ttoken: string;\n\texpiration: string;\n}\n\nconst login = async (): Promise<AuthResponse> => {\n\tconst clientAuthKey = getClientAuthKey();\n\n\ttry {\n\t\tconst response = await fetch(`${baseURL}/auth/login`, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: {\n\t\t\t\t'Content-Type': 'application/json'\n\t\t\t},\n\t\t\tbody: JSON.stringify({\n\t\t\t\tclientAuthKey: clientAuthKey\n\t\t\t})\n\t\t});\n\n\t\tif (!response.ok) {\n\t\t\tthrow new Error('Login failed');\n\t\t}\n\n\t\tconst data = await response.json();\n\n\t\tif (data.token && data.expiration) {\n\t\t\tsetStorage('authToken', data.token);\n\t\t\tsetStorage('tokenExpiration', data.expiration);\n\t\t\treturn { token: data.token, expiration: data.expiration };\n\t\t} else {\n\t\t\tthrow new Error('Invalid login response');\n\t\t}\n\t} catch (error) {\n\t\tconsole.error('Login failed:', error);\n\t\tthrow error;\n\t}\n};\n\nconst fetchWithAuth = async (url: string, options: RequestInit = {}): Promise<Response> => {\n\tlet token = getStorage('authToken');\n\n\tconst expirationDateTime = getStorage('tokenExpiration');\n\tconst currentTime = new Date();\n\n\tif (!token || !expirationDateTime || new Date(expirationDateTime) <= currentTime) {\n\t\tconst authResponse = await login();\n\t\ttoken = authResponse.token;\n\t}\n\n\tconst headers = new Headers(options.headers || {});\n\theaders.append('Authorization', `Bearer ${token}`);\n\n\tconst finalOptions = {\n\t\t...options,\n\t\theaders\n\t};\n\n\tconst response = await fetch(`${baseURL}${url}`, finalOptions);\n\n\tif (!response.ok) throw new Error('Network response was not ok.');\n\n\treturn response;\n};\n\nexport default {\n\tget: async <T>(url: string): Promise<T> => {\n\t\tconst response = await fetchWithAuth(url);\n\t\treturn await response.json() as T;\n\t},\n\tpost: async <T>(url: string, data: any): Promise<T> => {\n\t\tconst response = await fetchWithAuth(url, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: {\n\t\t\t\t'Content-Type': 'application/json'\n\t\t\t},\n\t\t\tbody: JSON.stringify(data)\n\t\t});\n\t\treturn await response.json() as T;\n\t}\n};\n"],"names":[],"mappings":";;AACA,MAAM,OAAO,GAAG,uBAAqC,CAAC;AAOtD,MAAM,aAAa,GAAkB;AACpC,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,eAAe,EAAE,IAAI;CACrB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CAAC;IAE/D,IAAI,CAAC,QAAQ,CAAC,EAAE;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;AAElE,IAAA,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC;AAEF,UAAe;AACd,IAAA,GAAG,EAAE,OAAU,GAAW,KAAgB;AACzC,QAAA,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,GAAG,CAAC,CAAC;AAC1C,QAAA,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAO,CAAC;KAClC;AACD,IAAA,IAAI,EAAE,OAAU,GAAW,EAAE,IAAS,KAAgB;AACrD,QAAA,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,GAAG,EAAE;AACzC,YAAA,MAAM,EAAE,MAAM;AACd,YAAA,OAAO,EAAE;AACR,gBAAA,cAAc,EAAE,kBAAkB;AAClC,aAAA;AACD,YAAA,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;AAC1B,SAAA,CAAC,CAAC;AACH,QAAA,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAO,CAAC;KAClC;CACD;;;;"}
|
|
@@ -31,8 +31,10 @@ var MapAccordionItemContainer = function MapAccordionItemContainer(_ref) {
|
|
|
31
31
|
});
|
|
32
32
|
} else {
|
|
33
33
|
setStorageObject("selectedListItem", item);
|
|
34
|
+
console.log('mapItems here', mapItems);
|
|
35
|
+
//edited here for new structure of entity key
|
|
34
36
|
var location = mapItems.find(function (x) {
|
|
35
|
-
return Object.prototype.hasOwnProperty.call(x.items, item.
|
|
37
|
+
return Object.prototype.hasOwnProperty.call(x.items, item.entityKey);
|
|
36
38
|
}) || null;
|
|
37
39
|
selectItem(item, location, 12, {
|
|
38
40
|
lat: location === null || location === void 0 ? void 0 : location.latitude,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-accordion-item-container.js","sources":["../../../../src/components/containers/accordions/map-accordion-item-container.js"],"sourcesContent":["import React from 'react';\nimport { useMap } from '~/contexts/mapContext';\nimport { useMapList } from '~/contexts/mapListContext';\nimport { useTrackEvent } from '~/contexts/trackEventContext';\nimport { setStorageObject } from '~/util/localStorageUtil';\nimport MapAccordionItem from '~/components/modules/accordions/MapAccordionItem';\nimport ListItemContainer from '~/components/containers/list/list-item/list-item-container';\n\nconst MapAccordionItemContainer = ({\n\tshowMap,\n\titem,\n\titemRefs,\n\tfieldsShown,\n\titemExpandedContent,\n\tspecialFeatures,\n\tisActive\n}) => {\n\tconst { mapItems, recruiters } = useMapList();\n\tconst { selectItem } = useMap();\n\tconst { trackEvent, eventTypes } = useTrackEvent();\n\n\tconst setSelectedItemAndZoomMap = (item, isActive) => {\n\t\tif (isActive) {\n\t\t\tlocalStorage.removeItem(\"selectedListItem\");\n\t\t\tselectItem(null, null, 9, { lat: 39.8283, lng: -98.5795 });\n\t\t} else {\n\t\t\tsetStorageObject(\"selectedListItem\", item);\n\t\t\tconst location = mapItems.find(x => Object.prototype.hasOwnProperty.call(x.items, item.
|
|
1
|
+
{"version":3,"file":"map-accordion-item-container.js","sources":["../../../../src/components/containers/accordions/map-accordion-item-container.js"],"sourcesContent":["import React from 'react';\nimport { useMap } from '~/contexts/mapContext';\nimport { useMapList } from '~/contexts/mapListContext';\nimport { useTrackEvent } from '~/contexts/trackEventContext';\nimport { setStorageObject } from '~/util/localStorageUtil';\nimport MapAccordionItem from '~/components/modules/accordions/MapAccordionItem';\nimport ListItemContainer from '~/components/containers/list/list-item/list-item-container';\n\nconst MapAccordionItemContainer = ({\n\tshowMap,\n\titem,\n\titemRefs,\n\tfieldsShown,\n\titemExpandedContent,\n\tspecialFeatures,\n\tisActive\n}) => {\n\tconst { mapItems, recruiters } = useMapList();\n\tconst { selectItem } = useMap();\n\tconst { trackEvent, eventTypes } = useTrackEvent();\n\n\tconst setSelectedItemAndZoomMap = (item, isActive) => {\n\t\tif (isActive) {\n\t\t\tlocalStorage.removeItem(\"selectedListItem\");\n\t\t\tselectItem(null, null, 9, { lat: 39.8283, lng: -98.5795 });\n\t\t} else {\n\t\t\tsetStorageObject(\"selectedListItem\", item);\n\t\t\tconsole.log('mapItems here', mapItems);\n\t\t\t//edited here for new structure of entity key\n\t\t\tconst location = mapItems.find(x => Object.prototype.hasOwnProperty.call(x.items, item.entityKey)) || null;\n\t\t\tselectItem(item, location, 12, {\n\t\t\t\tlat: location?.latitude,\n\t\t\t\tlng: location?.longitude\n\t\t\t});\n\t\t}\n\t};\n\n\tconst handleItemClick = item => {\n\t\ttrackEvent(eventTypes.JOB_LISTING_SELECTED, {\n\t\t\tjobTitle: item.fields.position,\n\t\t\tjobCategory: item.fields.category,\n\t\t\tentityDisplayName: item?.mapDetails?.entityDisplayName\n\t\t});\n\n\t\tsetSelectedItemAndZoomMap(item, isActive);\n\t};\n\n\treturn (\n\t\t<MapAccordionItem\n\t\t\titem={item}\n\t\t\titemRefs={itemRefs}\n\t\t\titemExpandedContent={itemExpandedContent}\n\t\t\tisActive={isActive}\n\t\t\trecruiter={recruiters[item.recruiterId]}\n\t\t>\n\t\t\t<ListItemContainer\n\t\t\t\tshowMap={showMap}\n\t\t\t\titem={item}\n\t\t\t\tfieldsShown={fieldsShown}\n\t\t\t\tspecialFeatures={specialFeatures}\n\t\t\t\tisActive={isActive}\n\t\t\t\tonClick={() => handleItemClick(item)}\n\t\t\t/>\n\t\t</MapAccordionItem>\n\t);\n};\n\nexport default MapAccordionItemContainer;\n"],"names":["MapAccordionItemContainer","_ref","showMap","item","itemRefs","fieldsShown","itemExpandedContent","specialFeatures","isActive","_useMapList","useMapList","mapItems","recruiters","_useMap","useMap","selectItem","_useTrackEvent","useTrackEvent","trackEvent","eventTypes","setSelectedItemAndZoomMap","localStorage","removeItem","lat","lng","setStorageObject","console","log","location","find","x","Object","prototype","hasOwnProperty","call","items","entityKey","latitude","longitude","handleItemClick","_item$mapDetails","JOB_LISTING_SELECTED","jobTitle","fields","position","jobCategory","category","entityDisplayName","mapDetails","React","createElement","MapAccordionItem","recruiter","recruiter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oBACCyC,cAAA,CAAAC,aAAA,CAACC,gBAAgB,EAAA;AAChBhD,IAAAA,IAAI,EAAEA,IAAK;AACXC,IAAAA,QAAQ,EAAEA,QAAS;AACnBE,IAAAA,mBAAmB,EAAEA,mBAAoB;AACzCE,IAAAA,QAAQ,EAAEA,QAAS;AACnB4C,IAAAA,SAAS,EAAExC,UAAU,CAACT,IAAI,CAACkD,WAAW,CAAA;AAAE,GAAA,eAExCJ,cAAA,CAAAC,aAAA,CAACI,iBAAiB,EAAA;AACjBpD,IAAAA,OAAO,EAAEA,OAAQ;AACjBC,IAAAA,IAAI,EAAEA,IAAK;AACXE,IAAAA,WAAW,EAAEA,WAAY;AACzBE,IAAAA,eAAe,EAAEA,eAAgB;AACjCC,IAAAA,QAAQ,EAAEA,QAAS;IACnB+C,OAAO,EAAE,SAAAA,OAAA,GAAA;MAAA,OAAMhB,eAAe,CAACpC,IAAI,CAAC,CAAA;AAAA,KAAA;AAAC,GACrC,CACgB,CAAC,CAAA;AAErB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"info-window-content-container.js","sources":["../../../../src/components/containers/maps/info-window-content-container.js"],"sourcesContent":["import React from 'react';\nimport InfoWindowContent from '~/components/modules/maps/info-window-content';\nimport { useMapList } from '~/contexts/mapListContext';\nimport { useTrackEvent } from '~/contexts/trackEventContext';\n\nconst InfoWindowContentContainer = ({\n\titem\n}) => {\n\tconst { trackEvent, eventTypes } = useTrackEvent();\n\tconst { setSelectedFilters, setMobileTab, selectedFilters, siteConfig } = useMapList();\n\tconst fieldsShown = siteConfig.locationFiltersShown;\n\tlet items = item && item.items ? Object.values(item.items) : null;\n\n\tconst addressParts = [\n\t\titems[0].mapDetails?.address?.street,\n\t\titems[0].mapDetails?.address?.city\n\t];\n\n\t// Filter out any falsy values from the main parts\n\tconst filteredParts = addressParts.filter(Boolean);\n\n\t// Handle state and zip separately to avoid comma between them\n\tconst state = items[0].mapDetails?.address?.state;\n\tconst zip = items[0].mapDetails?.address?.zip;\n\n\tlet stateZip = '';\n\tif (state && zip) {\n\t\tstateZip = `${state} ${zip}`;\n\t} else if (state) {\n\t\tstateZip = state;\n\t} else if (zip) {\n\t\tstateZip = zip;\n\t}\n\n\t// Combine all parts\n\tlet fullAddress = filteredParts.join(', ');\n\tif (stateZip) {\n\t\tfullAddress = fullAddress ? `${fullAddress}, ${stateZip}` : stateZip;\n\t}\n\n\tconst applyFilters = () => {\n\t\tsetMobileTab(\"listTab\");\n\t\tconst newFilters = { ...selectedFilters };\n\t\tlet filters = [];\n\n\t\tif (fieldsShown.includes('cityState')) {\n\t\t\tnewFilters.cityState = { [items[0].fields.cityState]: true };\n\t\t\tfilters.push({ filterType: 'cityState', filterChecked: items[0].fields.cityState });\n\t\t}\n\n\t\tif (fieldsShown.includes('city')) {\n\t\t\tnewFilters.city = { [items[0].fields.city]: true };\n\t\t\tfilters.push({ filterType: 'city', filterChecked: items[0].fields.city });\n\t\t}\n\n\t\tif (fieldsShown.includes('state')) {\n\t\t\tnewFilters.state = { [items[0].fields.state]: true };\n\t\t\tfilters.push({ filterType: 'state', filterChecked: items[0].fields.state });\n\t\t}\n\n\t\tnewFilters.entityName = { [items[0].fields.entityName]: true };\n\t\tfilters.push({ filterType: 'entityName', filterChecked: items[0].fields.entityName });\n\n\t\ttrackEvent(eventTypes.VIEW_JOBS_AT_Location, { filtersApplied: filters });\n\t\tsetSelectedFilters(newFilters);\n\t};\n\n\treturn <InfoWindowContent items={items} fullAddress={fullAddress} applyFilters={applyFilters} mapInfoWindowConfig={siteConfig.mapInfoWindowConfig}/>;\n};\n\nexport default InfoWindowContentContainer;\n"],"names":["InfoWindowContentContainer","_ref","_items$0$mapDetails","_items$0$mapDetails2","_items$0$mapDetails3","_items$0$mapDetails4","item","_useTrackEvent","useTrackEvent","trackEvent","eventTypes","_useMapList","useMapList","setSelectedFilters","setMobileTab","selectedFilters","siteConfig","fieldsShown","locationFiltersShown","items","Object","values","addressParts","mapDetails","address","street","city","filteredParts","filter","Boolean","state","zip","stateZip","concat","fullAddress","join","applyFilters","newFilters","_objectSpread","filters","includes","cityState","_defineProperty","fields","push","filterType","filterChecked","entityName","VIEW_JOBS_AT_Location","filtersApplied","React","createElement","InfoWindowContent","mapInfoWindowConfig"],"mappings":";;;;;;AAKA,IAAMA,0BAA0B,GAAG,SAA7BA,0BAA0BA,CAAAC,IAAA,EAE1B;AAAA,EAAA,IAAAC,mBAAA,EAAAC,oBAAA,EAAAC,oBAAA,EAAAC,oBAAA,CAAA;AAAA,EAAA,IADLC,IAAI,GAAAL,IAAA,CAAJK,IAAI,CAAA;AAEJ,EAAA,IAAAC,cAAA,GAAmCC,aAAa,EAAE;IAA1CC,UAAU,GAAAF,cAAA,CAAVE,UAAU;IAAEC,UAAU,GAAAH,cAAA,CAAVG,UAAU,CAAA;AAC9B,EAAA,IAAAC,WAAA,GAA0EC,UAAU,EAAE;IAA9EC,kBAAkB,GAAAF,WAAA,CAAlBE,kBAAkB;IAAEC,YAAY,GAAAH,WAAA,CAAZG,YAAY;IAAEC,eAAe,GAAAJ,WAAA,CAAfI,eAAe;IAAEC,UAAU,GAAAL,WAAA,CAAVK,UAAU,CAAA;AACrE,EAAA,IAAMC,WAAW,GAAGD,UAAU,CAACE,oBAAoB,CAAA;AACnD,EAAA,IAAIC,KAAK,GAAGb,IAAI,IAAIA,IAAI,CAACa,KAAK,GAAGC,MAAM,CAACC,MAAM,CAACf,IAAI,CAACa,KAAK,CAAC,GAAG,IAAI,CAAA;EAEjE,IAAMG,YAAY,GAAG,CAAApB,CAAAA,mBAAA,GACpBiB,KAAK,CAAC,CAAC,CAAC,CAACI,UAAU,cAAArB,mBAAA,KAAA,KAAA,CAAA,IAAA,CAAAA,mBAAA,GAAnBA,mBAAA,CAAqBsB,OAAO,MAAA,IAAA,IAAAtB,mBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAA5BA,mBAAA,CAA8BuB,MAAM,EAAAtB,CAAAA,oBAAA,GACpCgB,K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CAAC,EAAE;AAClCH,MAAAA,UAAU,CAACP,KAAK,GAAAY,eAAA,KAAMvB,KAAK,CAAC,CAAC,CAAC,CAACwB,MAAM,CAACb,KAAK,EAAG,IAAI,CAAE,CAAA;MACpDS,OAAO,CAACK,IAAI,CAAC;AAAEC,QAAAA,UAAU,EAAE,OAAO;AAAEC,QAAAA,aAAa,EAAE3B,KAAK,CAAC,CAAC,CAAC,CAACwB,MAAM,CAACb,KAAAA;AAAM,OAAC,CAAC,CAAA;AAC5E,KAAA;AAEAO,IAAAA,UAAU,CAACU,UAAU,GAAAL,eAAA,KAAMvB,KAAK,CAAC,CAAC,CAAC,CAACwB,MAAM,CAACI,UAAU,EAAG,IAAI,CAAE,CAAA;IAC9DR,OAAO,CAACK,IAAI,CAAC;AAAEC,MAAAA,UAAU,EAAE,YAAY;AAAEC,MAAAA,aAAa,EAAE3B,KAAK,CAAC,CAAC,CAAC,CAACwB,MAAM,CAACI,UAAAA;AAAW,KAAC,CAAC,CAAA;AAErFtC,IAAAA,UAAU,CAACC,UAAU,CAACsC,qBAAqB,EAAE;AAAEC,MAAAA,cAAc,EAAEV,OAAAA;AAAQ,KAAC,CAAC,CAAA;IACzE1B,kBAAkB,CAACwB,UAAU,CAAC,CAAA;GAC9B,CAAA;AAED,EAAA,oBAAOa,cAAA,CAAAC,aAAA,CAACC,iBAAiB,EAAA;AAACjC,IAAAA,KAAK,EAAEA,KAAM;AAACe,IAAAA,WAAW,EAAEA,WAAY;AAACE,IAAAA,YAAY,EAAEA,YAAa;IAACiB,mBAAmB,EAAErC,UAAU,CAACqC,mBAAAA;AAAoB,GAAC,CAAC,CAAA;AACrJ;;;;"}
|
|
1
|
+
{"version":3,"file":"info-window-content-container.js","sources":["../../../../src/components/containers/maps/info-window-content-container.js"],"sourcesContent":["import React from 'react';\nimport InfoWindowContent from '~/components/modules/maps/info-window-content';\nimport { useMapList } from '~/contexts/mapListContext';\nimport { useTrackEvent } from '~/contexts/trackEventContext';\n\nconst InfoWindowContentContainer = ({\n\titem\n}) => {\n\tconst { trackEvent, eventTypes } = useTrackEvent();\n\tconst { setSelectedFilters, setMobileTab, selectedFilters, siteConfig } = useMapList();\n\tconst fieldsShown = siteConfig.locationFiltersShown;\n\tlet items = item && item.items ? Object.values(item.items) : null;\n\n\tconst addressParts = [\n\t\titems[0].mapDetails?.address?.street,\n\t\titems[0].mapDetails?.address?.city\n\t];\n\n\t// Filter out any falsy values from the main parts\n\tconst filteredParts = addressParts.filter(Boolean);\n\n\t// Handle state and zip separately to avoid comma between them\n\tconst state = items[0].mapDetails?.address?.state;\n\tconst zip = items[0].mapDetails?.address?.zip;\n\n\tlet stateZip = '';\n\tif (state && zip) {\n\t\tstateZip = `${state} ${zip}`;\n\t} else if (state) {\n\t\tstateZip = state;\n\t} else if (zip) {\n\t\tstateZip = zip;\n\t}\n\n\t// Combine all parts\n\tlet fullAddress = filteredParts.join(', ');\n\tif (stateZip) {\n\t\tfullAddress = fullAddress ? `${fullAddress}, ${stateZip}` : stateZip;\n\t}\n\n\tconst applyFilters = () => {\n\t\tsetMobileTab(\"listTab\");\n\t\tconst newFilters = { ...selectedFilters };\n\t\tlet filters = [];\n\n\t\tif (fieldsShown.includes('cityState')) {\n\t\t\tnewFilters.cityState = { [items[0].fields.cityState]: true };\n\t\t\tfilters.push({ filterType: 'cityState', filterChecked: items[0].fields.cityState });\n\t\t}\n\n\t\tif (fieldsShown.includes('city')) {\n\t\t\tnewFilters.city = { [items[0].fields.city]: true };\n\t\t\tfilters.push({ filterType: 'city', filterChecked: items[0].fields.city });\n\t\t}\n\n\t\tif (fieldsShown.includes('state')) {\n\t\t\tnewFilters.state = { [items[0].fields.state]: true };\n\t\t\tfilters.push({ filterType: 'state', filterChecked: items[0].fields.state });\n\t\t}\n\t\t\n\t\tnewFilters.entityName = { [items[0].fields.entityName]: true };\n\t\tfilters.push({ filterType: 'entityName', filterChecked: items[0].fields.entityName });\n\n\t\ttrackEvent(eventTypes.VIEW_JOBS_AT_Location, { filtersApplied: filters });\n\t\tsetSelectedFilters(newFilters);\n\t};\n\n\treturn <InfoWindowContent items={items} fullAddress={fullAddress} applyFilters={applyFilters} mapInfoWindowConfig={siteConfig.mapInfoWindowConfig}/>;\n};\n\nexport default InfoWindowContentContainer;\n"],"names":["InfoWindowContentContainer","_ref","_items$0$mapDetails","_items$0$mapDetails2","_items$0$mapDetails3","_items$0$mapDetails4","item","_useTrackEvent","useTrackEvent","trackEvent","eventTypes","_useMapList","useMapList","setSelectedFilters","setMobileTab","selectedFilters","siteConfig","fieldsShown","locationFiltersShown","items","Object","values","addressParts","mapDetails","address","street","city","filteredParts","filter","Boolean","state","zip","stateZip","concat","fullAddress","join","applyFilters","newFilters","_objectSpread","filters","includes","cityState","_defineProperty","fields","push","filterType","filterChecked","entityName","VIEW_JOBS_AT_Location","filtersApplied","React","createElement","InfoWindowContent","mapInfoWindowConfig"],"mappings":";;;;;;AAKA,IAAMA,0BAA0B,GAAG,SAA7BA,0BAA0BA,CAAAC,IAAA,EAE1B;AAAA,EAAA,IAAAC,mBAAA,EAAAC,oBAAA,EAAAC,oBAAA,EAAAC,oBAAA,CAAA;AAAA,EAAA,IADLC,IAAI,GAAAL,IAAA,CAAJK,IAAI,CAAA;AAEJ,EAAA,IAAAC,cAAA,GAAmCC,aAAa,EAAE;IAA1CC,UAAU,GAAAF,cAAA,CAAVE,UAAU;IAAEC,UAAU,GAAAH,cAAA,CAAVG,UAAU,CAAA;AAC9B,EAAA,IAAAC,WAAA,GAA0EC,UAAU,EAAE;IAA9EC,kBAAkB,GAAAF,WAAA,CAAlBE,kBAAkB;IAAEC,YAAY,GAAAH,WAAA,CAAZG,YAAY;IAAEC,eAAe,GAAAJ,WAAA,CAAfI,eAAe;IAAEC,UAAU,GAAAL,WAAA,CAAVK,UAAU,CAAA;AACrE,EAAA,IAAMC,WAAW,GAAGD,UAAU,CAACE,oBAAoB,CAAA;AACnD,EAAA,IAAIC,KAAK,GAAGb,IAAI,IAAIA,IAAI,CAACa,K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jC,IAAAA,KAAK,EAAEA,KAAM;AAACe,IAAAA,WAAW,EAAEA,WAAY;AAACE,IAAAA,YAAY,EAAEA,YAAa;IAACiB,mBAAmB,EAAErC,UAAU,CAACqC,mBAAAA;AAAoB,GAAC,CAAC,CAAA;AACrJ;;;;"}
|
|
@@ -223,7 +223,6 @@ var MapContainer = function MapContainer(_ref) {
|
|
|
223
223
|
var mapItemsKey = mapItems.map(function (item) {
|
|
224
224
|
return item.id;
|
|
225
225
|
}).join("-");
|
|
226
|
-
console.log(location);
|
|
227
226
|
return /*#__PURE__*/React__default.createElement(Map, {
|
|
228
227
|
zoom: zoom,
|
|
229
228
|
center: center,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-container.js","sources":["../../../../src/components/containers/maps/map-container.js"],"sourcesContent":["\"use client\";\n\nimport React, { useEffect, useRef, useState } from \"react\";\n\nimport MapMarker from \"~/components/containers/maps/map-marker-container\";\nimport PlaceMarker from \"~/components/modules/maps/place-marker\";\n\nimport { usePlaces } from \"~/contexts/placesContext\";\nimport { useMap } from \"~/contexts/mapContext\";\nimport { useMapList } from \"~/contexts/mapListContext\";\n\nimport { markerIconSelected, markerIcon, pinIcon } from \"~/util/mapIconUtil\";\n\nimport Map from \"~/components/modules/maps/map\";\nimport { MarkerClustererF, Marker } from \"@react-google-maps/api\";\nimport { clusterOptions } from \"~/util/mapUtil\";\n\nconst MapContainer = ({ markerConfigs, infoWindowClasses, clusterGridSize = 60 }) => {\n\tconst {\n\t\tlocation,\n\t\tzoom,\n\t\tcenter,\n\t\tselectLocationEntity,\n\t\tsetLocation,\n\t\tmapInteracted,\n\t\tsetMapInteracted,\n\t\tdefaultZoomOverride\n\t} = useMap();\n\n\tconst {\n\t\tmapItems: oldMapItems,\n\t\tfilteredListings,\n\t\tselectedFilters,\n\t\tsetSelectedFilters,\n\t\tsetQuery,\n\t\tsiteConfig\n\t} = useMapList();\n\tconst [mapItems, setMapItems] = useState(null);\n\tconst [markersToHideFromBounds, setMarkersToHideFromBounds] = useState([]);\n\n\tconst mapRef = useRef();\n\tconst markerRefs = useRef({});\n\tconst mapContainerRef = useRef(null);\n\tconst {\n\t\tpoiMarkers,\n\t\tsetCurrentCenter,\n\t\tcurrentCenter,\n\t\tsetCurrentZoom,\n\t\tcurrentZoom,\n\t\tselectedPlaceMarker,\n\t\tsetSelectedPlaceMarker,\n\t\tplacesWindow,\n\t\tsetPlacesWindow,\n\t\tadditionalMapMarkers\n\t} = usePlaces();\n\n\tconst onIdle = () => {\n\t\tif (!currentCenter || !mapRef.current) return;\n\t\tconst newCenter = mapRef.current.getCenter().toJSON();\n\t\tconst newZoom = mapRef.current.zoom;\n\t\tsetCurrentCenter(newCenter);\n\n\t\tif (newZoom !== currentZoom) {\n\t\t\tsetCurrentZoom(newZoom);\n\t\t}\n\t};\n\n\tuseEffect(() => {\n\t\tif (!oldMapItems || oldMapItems.length === 0) return;\n\n\t\tif (!siteConfig.defaultMapState || mapInteracted || selectedFilters?.state || selectedFilters?.city) {\n\t\t\tsetMapItems(oldMapItems);\n\t\t\tsetMarkersToHideFromBounds([]);\n\t\t\treturn;\n\t\t}\n\n\t\tconst markersToHide = oldMapItems\n\t\t\t.filter(x => x.address.state !== siteConfig.defaultMapState)\n\t\t\t.map(item => item.id);\n\n\t\tsetMarkersToHideFromBounds(markersToHide);\n\t\tsetMapItems(oldMapItems);\n\t}, [oldMapItems, selectedFilters, siteConfig, mapInteracted]);\n\n\tuseEffect(() => {\n\t\tif (mapContainerRef.current) {\n\t\t\tconst handleScroll = () => {\n\t\t\t\tsetMapInteracted(true);\n\t\t\t};\n\t\t\tvar mapContainerRefCurrent = mapContainerRef.current;\n\t\t\tmapContainerRef.current.addEventListener(\"wheel\", handleScroll);\n\t\t\treturn () => mapContainerRefCurrent.removeEventListener(\"wheel\", handleScroll);\n\t\t}\n\t}, [mapContainerRef.current]);\n\n\tuseEffect(() => {\n\t\tif (mapRef.current && defaultZoomOverride && !mapInteracted && !location) {\n\t\t\tmapRef.current.setZoom(defaultZoomOverride);\n\t\t}\n\t}, [mapInteracted]);\n\n\tuseEffect(() => {\n\t\tif (mapRef.current) {\n\t\t\tconst mapInstance = mapRef.current;\n\t\t\tconst dragStartListener = mapInstance.addListener(\"dragstart\", () => {\n\t\t\t\tsetMapInteracted(true);\n\t\t\t\tsetMarkersToHideFromBounds([]);\n\t\t\t});\n\t\t\tconst mouseDownListener = mapInstance.addListener(\"mousedown\", () => {\n\t\t\t\tsetMapInteracted(true);\n\t\t\t\tsetMarkersToHideFromBounds([]);\n\t\t\t});\n\t\t\treturn () => {\n\t\t\t\tgoogle.maps.event.removeListener(dragStartListener);\n\t\t\t\tgoogle.maps.event.removeListener(mouseDownListener);\n\t\t\t};\n\t\t}\n\t}, [mapRef.current, mapContainerRef.current]);\n\n\tuseEffect(() => {\n\t\tif (((mapItems && mapItems.length > 0) || poiMarkers.length > 0) && mapRef.current && !mapInteracted) {\n\t\t\tfitBounds(mapRef.current);\n\t\t}\n\t}, [mapItems, mapRef.current, location]);\n\n\tuseEffect(() => {\n\t\tif (((mapItems && mapItems.length > 0) || poiMarkers.length > 0) && mapRef.current && !mapInteracted) {\n\t\t\tfitBounds(mapRef.current, true);\n\t\t}\n\t\tif (mapRef.current && !mapInteracted) {\n\t\t\tconst currZoom = mapRef.current.zoom;\n\t\t\tconst setZoomVal = currZoom < 13 ? currZoom : 12;\n\t\t\tmapRef.current.setZoom(setZoomVal);\n\t\t}\n\t}, [filteredListings]);\n\n\tuseEffect(() => {\n\t\tif (!mapRef.current || !location || mapInteracted) return;\n\t\tmapRef.current.panTo(new google.maps.LatLng(location.latitude, location.longitude));\n\t\tif (mapRef.current) {\n\t\t\tconst setZoomVal = zoom < 13 ? zoom : 12;\n\t\t\tmapRef.current.setZoom(setZoomVal);\n\t\t}\n\t}, [location, zoom, mapRef.current]);\n\n\tconst fitBounds = (map, overload = false) => {\n\t\tif ((mapInteracted === false || overload) && mapItems != null) {\n\t\t\tconst bounds = new window.google.maps.LatLngBounds();\n\n\t\t\tmapItems.forEach(item => {\n\t\t\t\tif (!mapInteracted && markersToHideFromBounds.includes(item.id)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tbounds.extend(new google.maps.LatLng(item.latitude, item.longitude));\n\t\t\t});\n\n\t\t\tif (siteConfig.optionalShowLocationClusterConfig) {\n\t\t\t\tconst configLocation = new google.maps.LatLng(\n\t\t\t\t\tsiteConfig.optionalShowLocationClusterConfig.latitude,\n\t\t\t\t\tsiteConfig.optionalShowLocationClusterConfig.longitude\n\t\t\t\t);\n\t\t\t\tmap.panTo(configLocation);\n\t\t\t\tbounds.extend(\n\t\t\t\t\tnew google.maps.LatLng(\n\t\t\t\t\t\tsiteConfig.optionalShowLocationClusterConfig.latitude,\n\t\t\t\t\t\tsiteConfig.optionalShowLocationClusterConfig.longitude\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!map) return;\n\t\t\tconst currentCenter = map.getCenter();\n\t\t\tmap.fitBounds(bounds);\n\t\t\tconst newCenter = bounds.getCenter();\n\t\t\tif (currentCenter && newCenter) {\n\t\t\t\tmap.panTo(newCenter);\n\t\t\t}\n\t\t}\n\t\tif (defaultZoomOverride && !mapInteracted && !location) {\n\t\t\tmapRef.current.setZoom(defaultZoomOverride);\n\t\t} else if (mapRef.current.zoom > 17) {\n\t\t\tmapRef.current.setZoom(16);\n\t\t}\n\t};\n\n\tconst markerClickHandler = mapLocation => {\n\t\tsetMapInteracted(true);\n\t\tsetMarkersToHideFromBounds([]);\n\t\tselectLocationEntity(mapLocation);\n\t};\n\n\tconst onLoad = map => {\n\t\tif (!location || location === null) {\n\t\t\tmapRef.current = map;\n\t\t\tfitBounds(map, true);\n\t\t\treturn;\n\t\t}\n\t\tmapRef.current = map;\n\n\t\tif (mapInteracted === false) {\n\t\t\tmapRef.current.panTo(new google.maps.LatLng(location.latitude, location.longitude));\n\n\t\t\tmapRef.current.setZoom(zoom);\n\t\t}\n\t};\n\n\tconst pinIconUrl = pinIcon({\n\t\tfillColor: markerConfigs.fillColor,\n\t\tstrokeColor: markerConfigs.strokeColor\n\t});\n\n\tconst onClusterClick = cluster => {\n\t\tif (\n\t\t\t!siteConfig.optionalShowLocationClusterConfig ||\n mapRef.current.zoom > siteConfig.optionalShowLocationClusterConfig.showForZoomLevelLessThan\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!cluster || typeof cluster.getMarkers !== \"function\") {\n\t\t\tconsole.error(\"Cluster object or getMarkers method not available.\");\n\t\t\treturn;\n\t\t}\n\n\t\tconst markers = cluster.getMarkers();\n\n\t\tif (!markers || markers.length === 0) {\n\t\t\tconsole.error(\"No markers found in the cluster.\");\n\t\t\treturn;\n\t\t}\n\n\t\tsetTimeout(() => {\n\t\t\tconst bounds = new window.google.maps.LatLngBounds();\n\n\t\t\tmarkers.forEach(marker => {\n\t\t\t\tbounds.extend(marker.getPosition());\n\t\t\t});\n\t\t\tconst clusterCenter = bounds.getCenter();\n\n\t\t\tconst configLat = siteConfig.optionalShowLocationClusterConfig.latitude;\n\t\t\tconst configLng = siteConfig.optionalShowLocationClusterConfig.longitude;\n\n\t\t\tconst latDiff = clusterCenter.lat() - configLat;\n\t\t\tconst lngDiff = clusterCenter.lng() - configLng;\n\t\t\tconst distance = Math.sqrt(latDiff * latDiff + lngDiff * lngDiff);\n\n\t\t\tconst distanceThreshold = 1;\n\t\t\tif (distance <= distanceThreshold) {\n\t\t\t\tbounds.extend(new google.maps.LatLng(configLat, configLng));\n\t\t\t}\n\n\t\t\tif (mapRef.current) {\n\t\t\t\tmapRef.current.fitBounds(bounds);\n\t\t\t}\n\t\t}, 300);\n\t};\n\tif (!mapItems) {\n\t\treturn null;\n\t}\n\tconst mapItemsKey = mapItems.map(item => item.id).join(\"-\");\n\n\tconsole.log(location);\n\treturn (\n\t\t<Map\n\t\t\tzoom={zoom}\n\t\t\tcenter={center}\n\t\t\tmapContainerRef={mapContainerRef}\n\t\t\tonLoad={onLoad}\n\t\t\tonIdle={onIdle}\n\t\t\tmapInteracted={mapInteracted}\n\t\t\tpinIconUrl={pinIconUrl}\n\t\t\tsetMapInteracted={setMapInteracted}\n\t\t\tfitBounds={fitBounds}\n\t\t\tmapRef={mapRef}\n\t\t\tsetQuery={setQuery}\n\t\t\tfilteredListingsLength={filteredListings.length}\n\t\t\tsetSelectedFilters={setSelectedFilters}\n\t\t>\n\t\t\t<MarkerClustererF\n\t\t\t\tkey={mapItemsKey}\n\t\t\t\tcalculator={markers => {\n\t\t\t\t\tconst totalCount = markers.reduce((sum, marker) => sum + (marker.get(\"count\") || 1), 0);\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttext: totalCount.toString(),\n\t\t\t\t\t\tindex: Math.min(5, Math.floor(totalCount / 10))\n\t\t\t\t\t};\n\t\t\t\t}}\n\t\t\t\toptions={{\n\t\t\t\t\t...clusterOptions(clusterGridSize, markerConfigs.fillColor)\n\t\t\t\t}}\n\t\t\t\tonClick={onClusterClick}\n\t\t\t>\n\t\t\t\t{clusterer => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{mapItems.map(item => {\n\t\t\t\t\t\t\tconst markerCount = Object.values(item.items).length;\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<MapMarker\n\t\t\t\t\t\t\t\t\tkey={item.id}\n\t\t\t\t\t\t\t\t\titem={item}\n\t\t\t\t\t\t\t\t\tselectedLocation={location}\n\t\t\t\t\t\t\t\t\tmarkerRefs={markerRefs}\n\t\t\t\t\t\t\t\t\tinfoWindowClasses={infoWindowClasses}\n\t\t\t\t\t\t\t\t\tsetSelectedLocation={setLocation}\n\t\t\t\t\t\t\t\t\tmarkerClickHandler={markerClickHandler}\n\t\t\t\t\t\t\t\t\tclusterer={clusterer}\n\t\t\t\t\t\t\t\t\tmarkerIcon={markerIcon(markerConfigs, markerCount)}\n\t\t\t\t\t\t\t\t\tmarkerIconSelected={markerIconSelected(markerConfigs, markerCount)}\n\t\t\t\t\t\t\t\t\tsetMapInteracted={setMapInteracted}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t})}\n\n\t\t\t\t\t\t{additionalMapMarkers &&\n additionalMapMarkers.map(\n \t(marker, index) =>\n \t\tcurrentZoom >= marker.minZoom &&\n currentZoom <= marker.maxZoom && (\n \t\t\t<Marker\n \t\t\t\tkey={`marker-${marker.title}-${index}`}\n \t\t\t\tposition={marker.position}\n \t\t\t\ttitle={marker.title}\n \t\t\t\ticon={{\n \t\t\t\t\turl: marker.iconUrl,\n \t\t\t\t\tscaledSize: new window.google.maps.Size(40, 40)\n \t\t\t\t}}\n \t\t\t/>\n \t\t)\n )}\n\n\t\t\t\t\t\t{poiMarkers &&\n poiMarkers.markers.map((marker, index) => (\n \t<PlaceMarker\n \t\tkey={`marker-${marker.title}-${index}`}\n \t\tmarker={marker}\n \t\tindex={index}\n \t\tselectedPlaceMarker={selectedPlaceMarker}\n \t\tplacesWindow={placesWindow}\n \t\tsetPlacesWindow={setPlacesWindow}\n \t\tsetSelectedPlaceMarker={setSelectedPlaceMarker}\n \t/>\n ))}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</MarkerClustererF>\n\t\t</Map>\n\t);\n};\n\nexport default MapContainer;\n\n"],"names":["MapContainer","_ref","markerConfigs","infoWindowClasses","_ref$clusterGridSize","clusterGridSize","_useMap","useMap","location","zoom","center","selectLocationEntity","setLocation","mapInteracted","setMapInteracted","defaultZoomOverride","_useMapList","useMapList","oldMapItems","mapItems","filteredListings","selectedFilters","setSelectedFilters","setQuery","siteConfig","_useState","useState","_useState2","_slicedToArray","setMapItems","_useState3","_useState4","markersToHideFromBounds","setMarkersToHideFromBounds","mapRef","useRef","markerRefs","mapContainerRef","_usePlaces","usePlaces","poiMarkers","setCurrentCenter","currentCenter","setCurrentZoom","currentZoom","selectedPlaceMarker","setSelectedPlaceMarker","placesWindow","setPlacesWindow","additionalMapMarkers","onIdle","current","newCenter","getCenter","toJSON","newZoom","useEffect","length","defaultMapState","state","city","markersToHide","filter","x","address","map","item","id","handleScroll","mapContainerRefCurrent","addEventListener","removeEventListener","setZoom","mapInstance","dragStartListener","addListener","mouseDownListener","google","maps","event","removeListener","fitBounds","currZoom","setZoomVal","panTo","LatLng","latitude","longitude","overload","arguments","undefined","bounds","window","LatLngBounds","forEach","includes","extend","optionalShowLocationClusterConfig","configLocation","markerClickHandler","mapLocation","onLoad","pinIconUrl","pinIcon","fillColor","strokeColor","onClusterClick","cluster","showForZoomLevelLessThan","getMarkers","console","error","markers","setTimeout","marker","getPosition","clusterCenter","configLat","configLng","latDiff","lat","lngDiff","lng","distance","Math","sqrt","distanceThreshold","mapItemsKey","join","log","React","createElement","Map","filteredListingsLength","MarkerClustererF","key","calculator","totalCount","reduce","sum","get","text","toString","index","min","floor","options","_objectSpread","clusterOptions","onClick","clusterer","Fragment","markerCount","Object","values","items","MapMarker","selectedLocation","setSelectedLocation","markerIcon","markerIconSelected","minZoom","maxZoom","Marker","concat","title","position","icon","url","iconUrl","scaledSize","Size","PlaceMarker"],"mappings":";;;;;;;;;;;;AAiBA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA,EAAmE;AAAA,EAAA,IAA7DC,aAAa,GAAAD,IAAA,CAAbC,aAAa;IAAEC,iBAAiB,GAAAF,IAAA,CAAjBE,iBAAiB;IAAAC,oBAAA,GAAAH,IAAA,CAAEI,eAAe;AAAfA,IAAAA,eAAe,GAAAD,oBAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,oBAAA,CAAA;AAC7E,EAAA,IAAAE,OAAA,GASIC,MAAM,EAAE;IARXC,QAAQ,GAAAF,OAAA,CAARE,QAAQ;IACRC,IAAI,GAAAH,OAAA,CAAJG,IAAI;IACJC,MAAM,GAAAJ,OAAA,CAANI,MAAM;IACNC,oBAAoB,GAAAL,OAAA,CAApBK,oBAAoB;IACpBC,WAAW,GAAAN,OAAA,CAAXM,WAAW;IACXC,aAAa,GAAAP,OA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E,CAAA;AAC/C,SAAA;AAAE,OACF,CACD,CAAA;AAAA,KACH,CAAC,EAERnI,UAAU,IACHA,UAAU,CAACwE,OAAO,CAAC/C,GAAG,CAAC,UAACiD,MAAM,EAAE6B,KAAK,EAAA;AAAA,MAAA,oBACpCb,cAAA,CAAAC,aAAA,CAACyC,WAAW,EAAA;QACXrC,GAAG,EAAA,SAAA,CAAA6B,MAAA,CAAYlD,MAAM,CAACmD,KAAK,EAAAD,GAAAA,CAAAA,CAAAA,MAAA,CAAIrB,KAAK,CAAG;AACvC7B,QAAAA,MAAM,EAAEA,MAAO;AACf6B,QAAAA,KAAK,EAAEA,KAAM;AACblG,QAAAA,mBAAmB,EAAEA,mBAAoB;AACzCE,QAAAA,YAAY,EAAEA,YAAa;AAC3BC,QAAAA,eAAe,EAAEA,eAAgB;AACjCF,QAAAA,sBAAsB,EAAEA,sBAAAA;AAAuB,OAC/C,CAAC,CAAA;AAAA,KACF,CACR,CAAC,CAAA;AAAA,GAEa,CACd,CAAC,CAAA;AAER;;;;"}
|
|
1
|
+
{"version":3,"file":"map-container.js","sources":["../../../../src/components/containers/maps/map-container.js"],"sourcesContent":["\"use client\";\n\nimport React, { useEffect, useRef, useState } from \"react\";\n\nimport MapMarker from \"~/components/containers/maps/map-marker-container\";\nimport PlaceMarker from \"~/components/modules/maps/place-marker\";\n\nimport { usePlaces } from \"~/contexts/placesContext\";\nimport { useMap } from \"~/contexts/mapContext\";\nimport { useMapList } from \"~/contexts/mapListContext\";\n\nimport { markerIconSelected, markerIcon, pinIcon } from \"~/util/mapIconUtil\";\n\nimport Map from \"~/components/modules/maps/map\";\nimport { MarkerClustererF, Marker } from \"@react-google-maps/api\";\nimport { clusterOptions } from \"~/util/mapUtil\";\n\nconst MapContainer = ({ markerConfigs, infoWindowClasses, clusterGridSize = 60 }) => {\n\tconst {\n\t\tlocation,\n\t\tzoom,\n\t\tcenter,\n\t\tselectLocationEntity,\n\t\tsetLocation,\n\t\tmapInteracted,\n\t\tsetMapInteracted,\n\t\tdefaultZoomOverride\n\t} = useMap();\n\n\tconst {\n\t\tmapItems: oldMapItems,\n\t\tfilteredListings,\n\t\tselectedFilters,\n\t\tsetSelectedFilters,\n\t\tsetQuery,\n\t\tsiteConfig\n\t} = useMapList();\n\tconst [mapItems, setMapItems] = useState(null);\n\tconst [markersToHideFromBounds, setMarkersToHideFromBounds] = useState([]);\n\n\tconst mapRef = useRef();\n\tconst markerRefs = useRef({});\n\tconst mapContainerRef = useRef(null);\n\tconst {\n\t\tpoiMarkers,\n\t\tsetCurrentCenter,\n\t\tcurrentCenter,\n\t\tsetCurrentZoom,\n\t\tcurrentZoom,\n\t\tselectedPlaceMarker,\n\t\tsetSelectedPlaceMarker,\n\t\tplacesWindow,\n\t\tsetPlacesWindow,\n\t\tadditionalMapMarkers\n\t} = usePlaces();\n\n\tconst onIdle = () => {\n\t\tif (!currentCenter || !mapRef.current) return;\n\t\tconst newCenter = mapRef.current.getCenter().toJSON();\n\t\tconst newZoom = mapRef.current.zoom;\n\t\tsetCurrentCenter(newCenter);\n\n\t\tif (newZoom !== currentZoom) {\n\t\t\tsetCurrentZoom(newZoom);\n\t\t}\n\t};\n\n\tuseEffect(() => {\n\t\tif (!oldMapItems || oldMapItems.length === 0) return;\n\n\t\tif (!siteConfig.defaultMapState || mapInteracted || selectedFilters?.state || selectedFilters?.city) {\n\t\t\tsetMapItems(oldMapItems);\n\t\t\tsetMarkersToHideFromBounds([]);\n\t\t\treturn;\n\t\t}\n\n\t\tconst markersToHide = oldMapItems\n\t\t\t.filter(x => x.address.state !== siteConfig.defaultMapState)\n\t\t\t.map(item => item.id);\n\n\t\tsetMarkersToHideFromBounds(markersToHide);\n\t\tsetMapItems(oldMapItems);\n\t}, [oldMapItems, selectedFilters, siteConfig, mapInteracted]);\n\n\tuseEffect(() => {\n\t\tif (mapContainerRef.current) {\n\t\t\tconst handleScroll = () => {\n\t\t\t\tsetMapInteracted(true);\n\t\t\t};\n\t\t\tvar mapContainerRefCurrent = mapContainerRef.current;\n\t\t\tmapContainerRef.current.addEventListener(\"wheel\", handleScroll);\n\t\t\treturn () => mapContainerRefCurrent.removeEventListener(\"wheel\", handleScroll);\n\t\t}\n\t}, [mapContainerRef.current]);\n\n\tuseEffect(() => {\n\t\tif (mapRef.current && defaultZoomOverride && !mapInteracted && !location) {\n\t\t\tmapRef.current.setZoom(defaultZoomOverride);\n\t\t}\n\t}, [mapInteracted]);\n\n\tuseEffect(() => {\n\t\tif (mapRef.current) {\n\t\t\tconst mapInstance = mapRef.current;\n\t\t\tconst dragStartListener = mapInstance.addListener(\"dragstart\", () => {\n\t\t\t\tsetMapInteracted(true);\n\t\t\t\tsetMarkersToHideFromBounds([]);\n\t\t\t});\n\t\t\tconst mouseDownListener = mapInstance.addListener(\"mousedown\", () => {\n\t\t\t\tsetMapInteracted(true);\n\t\t\t\tsetMarkersToHideFromBounds([]);\n\t\t\t});\n\t\t\treturn () => {\n\t\t\t\tgoogle.maps.event.removeListener(dragStartListener);\n\t\t\t\tgoogle.maps.event.removeListener(mouseDownListener);\n\t\t\t};\n\t\t}\n\t}, [mapRef.current, mapContainerRef.current]);\n\n\tuseEffect(() => {\n\t\tif (((mapItems && mapItems.length > 0) || poiMarkers.length > 0) && mapRef.current && !mapInteracted) {\n\t\t\tfitBounds(mapRef.current);\n\t\t}\n\t}, [mapItems, mapRef.current, location]);\n\n\tuseEffect(() => {\n\t\tif (((mapItems && mapItems.length > 0) || poiMarkers.length > 0) && mapRef.current && !mapInteracted) {\n\t\t\tfitBounds(mapRef.current, true);\n\t\t}\n\t\tif (mapRef.current && !mapInteracted) {\n\t\t\tconst currZoom = mapRef.current.zoom;\n\t\t\tconst setZoomVal = currZoom < 13 ? currZoom : 12;\n\t\t\tmapRef.current.setZoom(setZoomVal);\n\t\t}\n\t}, [filteredListings]);\n\n\tuseEffect(() => {\n\t\tif (!mapRef.current || !location || mapInteracted) return;\n\t\tmapRef.current.panTo(new google.maps.LatLng(location.latitude, location.longitude));\n\t\tif (mapRef.current) {\n\t\t\tconst setZoomVal = zoom < 13 ? zoom : 12;\n\t\t\tmapRef.current.setZoom(setZoomVal);\n\t\t}\n\t}, [location, zoom, mapRef.current]);\n\n\tconst fitBounds = (map, overload = false) => {\n\t\tif ((mapInteracted === false || overload) && mapItems != null) {\n\t\t\tconst bounds = new window.google.maps.LatLngBounds();\n\n\t\t\tmapItems.forEach(item => {\n\t\t\t\tif (!mapInteracted && markersToHideFromBounds.includes(item.id)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tbounds.extend(new google.maps.LatLng(item.latitude, item.longitude));\n\t\t\t});\n\n\t\t\tif (siteConfig.optionalShowLocationClusterConfig) {\n\t\t\t\tconst configLocation = new google.maps.LatLng(\n\t\t\t\t\tsiteConfig.optionalShowLocationClusterConfig.latitude,\n\t\t\t\t\tsiteConfig.optionalShowLocationClusterConfig.longitude\n\t\t\t\t);\n\t\t\t\tmap.panTo(configLocation);\n\t\t\t\tbounds.extend(\n\t\t\t\t\tnew google.maps.LatLng(\n\t\t\t\t\t\tsiteConfig.optionalShowLocationClusterConfig.latitude,\n\t\t\t\t\t\tsiteConfig.optionalShowLocationClusterConfig.longitude\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!map) return;\n\t\t\tconst currentCenter = map.getCenter();\n\t\t\tmap.fitBounds(bounds);\n\t\t\tconst newCenter = bounds.getCenter();\n\t\t\tif (currentCenter && newCenter) {\n\t\t\t\tmap.panTo(newCenter);\n\t\t\t}\n\t\t}\n\t\tif (defaultZoomOverride && !mapInteracted && !location) {\n\t\t\tmapRef.current.setZoom(defaultZoomOverride);\n\t\t} else if (mapRef.current.zoom > 17) {\n\t\t\tmapRef.current.setZoom(16);\n\t\t}\n\t};\n\n\tconst markerClickHandler = mapLocation => {\n\t\tsetMapInteracted(true);\n\t\tsetMarkersToHideFromBounds([]);\n\t\tselectLocationEntity(mapLocation);\n\t};\n\n\tconst onLoad = map => {\n\t\tif (!location || location === null) {\n\t\t\tmapRef.current = map;\n\t\t\tfitBounds(map, true);\n\t\t\treturn;\n\t\t}\n\t\tmapRef.current = map;\n\n\t\tif (mapInteracted === false) {\n\t\t\tmapRef.current.panTo(new google.maps.LatLng(location.latitude, location.longitude));\n\n\t\t\tmapRef.current.setZoom(zoom);\n\t\t}\n\t};\n\n\tconst pinIconUrl = pinIcon({\n\t\tfillColor: markerConfigs.fillColor,\n\t\tstrokeColor: markerConfigs.strokeColor\n\t});\n\n\tconst onClusterClick = cluster => {\n\t\tif (\n\t\t\t!siteConfig.optionalShowLocationClusterConfig ||\n mapRef.current.zoom > siteConfig.optionalShowLocationClusterConfig.showForZoomLevelLessThan\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!cluster || typeof cluster.getMarkers !== \"function\") {\n\t\t\tconsole.error(\"Cluster object or getMarkers method not available.\");\n\t\t\treturn;\n\t\t}\n\n\t\tconst markers = cluster.getMarkers();\n\n\t\tif (!markers || markers.length === 0) {\n\t\t\tconsole.error(\"No markers found in the cluster.\");\n\t\t\treturn;\n\t\t}\n\n\t\tsetTimeout(() => {\n\t\t\tconst bounds = new window.google.maps.LatLngBounds();\n\n\t\t\tmarkers.forEach(marker => {\n\t\t\t\tbounds.extend(marker.getPosition());\n\t\t\t});\n\t\t\tconst clusterCenter = bounds.getCenter();\n\n\t\t\tconst configLat = siteConfig.optionalShowLocationClusterConfig.latitude;\n\t\t\tconst configLng = siteConfig.optionalShowLocationClusterConfig.longitude;\n\n\t\t\tconst latDiff = clusterCenter.lat() - configLat;\n\t\t\tconst lngDiff = clusterCenter.lng() - configLng;\n\t\t\tconst distance = Math.sqrt(latDiff * latDiff + lngDiff * lngDiff);\n\n\t\t\tconst distanceThreshold = 1;\n\t\t\tif (distance <= distanceThreshold) {\n\t\t\t\tbounds.extend(new google.maps.LatLng(configLat, configLng));\n\t\t\t}\n\n\t\t\tif (mapRef.current) {\n\t\t\t\tmapRef.current.fitBounds(bounds);\n\t\t\t}\n\t\t}, 300);\n\t};\n\tif (!mapItems) {\n\t\treturn null;\n\t}\n\n\tconst mapItemsKey = mapItems.map(item => item.id).join(\"-\");\n\n\n\treturn (\n\t\t<Map\n\t\t\tzoom={zoom}\n\t\t\tcenter={center}\n\t\t\tmapContainerRef={mapContainerRef}\n\t\t\tonLoad={onLoad}\n\t\t\tonIdle={onIdle}\n\t\t\tmapInteracted={mapInteracted}\n\t\t\tpinIconUrl={pinIconUrl}\n\t\t\tsetMapInteracted={setMapInteracted}\n\t\t\tfitBounds={fitBounds}\n\t\t\tmapRef={mapRef}\n\t\t\tsetQuery={setQuery}\n\t\t\tfilteredListingsLength={filteredListings.length}\n\t\t\tsetSelectedFilters={setSelectedFilters}\n\t\t>\n\t\t\t<MarkerClustererF\n\t\t\t\tkey={mapItemsKey}\n\t\t\t\tcalculator={markers => {\n\t\t\t\t\tconst totalCount = markers.reduce((sum, marker) => sum + (marker.get(\"count\") || 1), 0);\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttext: totalCount.toString(),\n\t\t\t\t\t\tindex: Math.min(5, Math.floor(totalCount / 10))\n\t\t\t\t\t};\n\t\t\t\t}}\n\t\t\t\toptions={{\n\t\t\t\t\t...clusterOptions(clusterGridSize, markerConfigs.fillColor)\n\t\t\t\t}}\n\t\t\t\tonClick={onClusterClick}\n\t\t\t>\n\t\t\t\t{clusterer => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{mapItems.map(item => {\n\t\t\t\t\t\t\tconst markerCount = Object.values(item.items).length;\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<MapMarker\n\t\t\t\t\t\t\t\t\tkey={item.id}\n\t\t\t\t\t\t\t\t\titem={item}\n\t\t\t\t\t\t\t\t\tselectedLocation={location}\n\t\t\t\t\t\t\t\t\tmarkerRefs={markerRefs}\n\t\t\t\t\t\t\t\t\tinfoWindowClasses={infoWindowClasses}\n\t\t\t\t\t\t\t\t\tsetSelectedLocation={setLocation}\n\t\t\t\t\t\t\t\t\tmarkerClickHandler={markerClickHandler}\n\t\t\t\t\t\t\t\t\tclusterer={clusterer}\n\t\t\t\t\t\t\t\t\tmarkerIcon={markerIcon(markerConfigs, markerCount)}\n\t\t\t\t\t\t\t\t\tmarkerIconSelected={markerIconSelected(markerConfigs, markerCount)}\n\t\t\t\t\t\t\t\t\tsetMapInteracted={setMapInteracted}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t})}\n\n\t\t\t\t\t\t{additionalMapMarkers &&\n additionalMapMarkers.map(\n \t(marker, index) =>\n \t\tcurrentZoom >= marker.minZoom &&\n currentZoom <= marker.maxZoom && (\n \t\t\t<Marker\n \t\t\t\tkey={`marker-${marker.title}-${index}`}\n \t\t\t\tposition={marker.position}\n \t\t\t\ttitle={marker.title}\n \t\t\t\ticon={{\n \t\t\t\t\turl: marker.iconUrl,\n \t\t\t\t\tscaledSize: new window.google.maps.Size(40, 40)\n \t\t\t\t}}\n \t\t\t/>\n \t\t)\n )}\n\n\t\t\t\t\t\t{poiMarkers &&\n poiMarkers.markers.map((marker, index) => (\n \t<PlaceMarker\n \t\tkey={`marker-${marker.title}-${index}`}\n \t\tmarker={marker}\n \t\tindex={index}\n \t\tselectedPlaceMarker={selectedPlaceMarker}\n \t\tplacesWindow={placesWindow}\n \t\tsetPlacesWindow={setPlacesWindow}\n \t\tsetSelectedPlaceMarker={setSelectedPlaceMarker}\n \t/>\n ))}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</MarkerClustererF>\n\t\t</Map>\n\t);\n};\n\nexport default MapContainer;\n\n"],"names":["MapContainer","_ref","markerConfigs","infoWindowClasses","_ref$clusterGridSize","clusterGridSize","_useMap","useMap","location","zoom","center","selectLocationEntity","setLocation","mapInteracted","setMapInteracted","defaultZoomOverride","_useMapList","useMapList","oldMapItems","mapItems","filteredListings","selectedFilters","setSelectedFilters","setQuery","siteConfig","_useState","useState","_useState2","_slicedToArray","setMapItems","_useState3","_useState4","markersToHideFromBounds","setMarkersToHideFromBounds","mapRef","useRef","markerRefs","mapContainerRef","_usePlaces","usePlaces","poiMarkers","setCurrentCenter","currentCenter","setCurrentZoom","currentZoom","selectedPlaceMarker","setSelectedPlaceMarker","placesWindow","setPlacesWindow","additionalMapMarkers","onIdle","current","newCenter","getCenter","toJSON","newZoom","useEffect","length","defaultMapState","state","city","markersToHide","filter","x","address","map","item","id","handleScroll","mapContainerRefCurrent","addEventListener","removeEventListener","setZoom","mapInstance","dragStartListener","addListener","mouseDownListener","google","maps","event","removeListener","fitBounds","currZoom","setZoomVal","panTo","LatLng","latitude","longitude","overload","arguments","undefined","bounds","window","LatLngBounds","forEach","includes","extend","optionalShowLocationClusterConfig","configLocation","markerClickHandler","mapLocation","onLoad","pinIconUrl","pinIcon","fillColor","strokeColor","onClusterClick","cluster","showForZoomLevelLessThan","getMarkers","console","error","markers","setTimeout","marker","getPosition","clusterCenter","configLat","configLng","latDiff","lat","lngDiff","lng","distance","Math","sqrt","distanceThreshold","mapItemsKey","join","React","createElement","Map","filteredListingsLength","MarkerClustererF","key","calculator","totalCount","reduce","sum","get","text","toString","index","min","floor","options","_objectSpread","clusterOptions","onClick","clusterer","Fragment","markerCount","Object","values","items","MapMarker","selectedLocation","setSelectedLocation","markerIcon","markerIconSelected","minZoom","maxZoom","Marker","concat","title","position","icon","url","iconUrl","scaledSize","Size","PlaceMarker"],"mappings":";;;;;;;;;;;;AAiBA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA,EAAmE;AAAA,EAAA,IAA7DC,aAAa,GAAAD,IAAA,CAAbC,aAAa;IAAEC,iBAAiB,GAAAF,IAAA,CAAjBE,iBAAiB;IAAAC,oBAAA,GAAAH,IAAA,CAAEI,eAAe;AAAfA,IAAAA,eAAe,GAAAD,oBAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,oBAAA,CAAA;AAC7E,EAAA,IAAAE,OAAA,GASIC,MAAM,EAAE;IARXC,QAAQ,GAAAF,O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LC,GAAG,EAAErD,MAAM,CAACsD,OAAO;AACnBC,UAAAA,UAAU,EAAE,IAAI7E,MAAM,CAACf,MAAM,CAACC,IAAI,CAAC4F,IAAI,CAAC,EAAE,EAAE,EAAE,CAAA;AAC/C,SAAA;AAAE,OACF,CACD,CAAA;AAAA,KACH,CAAC,EAERlI,UAAU,IACHA,UAAU,CAACwE,OAAO,CAAC/C,GAAG,CAAC,UAACiD,MAAM,EAAE4B,KAAK,EAAA;AAAA,MAAA,oBACpCb,cAAA,CAAAC,aAAA,CAACyC,WAAW,EAAA;QACXrC,GAAG,EAAA,SAAA,CAAA6B,MAAA,CAAYjD,MAAM,CAACkD,KAAK,EAAAD,GAAAA,CAAAA,CAAAA,MAAA,CAAIrB,KAAK,CAAG;AACvC5B,QAAAA,MAAM,EAAEA,MAAO;AACf4B,QAAAA,KAAK,EAAEA,KAAM;AACbjG,QAAAA,mBAAmB,EAAEA,mBAAoB;AACzCE,QAAAA,YAAY,EAAEA,YAAa;AAC3BC,QAAAA,eAAe,EAAEA,eAAgB;AACjCF,QAAAA,sBAAsB,EAAEA,sBAAAA;AAAuB,OAC/C,CAAC,CAAA;AAAA,KACF,CACR,CAAC,CAAA;AAAA,GAEa,CACd,CAAC,CAAA;AAER;;;;"}
|
|
@@ -61,22 +61,26 @@ const MapListProvider = ({ children, siteConfig, resetFilters, navigateToDetails
|
|
|
61
61
|
if (!commuteLocation)
|
|
62
62
|
return;
|
|
63
63
|
async function fetchEntities() {
|
|
64
|
-
const distinctEntityIds = [
|
|
65
|
-
...new Set(allListings.map(listing => listing.entityId ?? -1))
|
|
66
|
-
];
|
|
67
64
|
try {
|
|
68
|
-
|
|
65
|
+
//gonna need to fix this here
|
|
66
|
+
console.log("Fetching entities for commute location", commuteLocation);
|
|
67
|
+
const fetchedEntities = await getListingEntities(`${commuteLocation.lat}, ${commuteLocation.lng}`);
|
|
68
|
+
const entitiesByKey = fetchedEntities;
|
|
69
69
|
setListingEntities(fetchedEntities);
|
|
70
70
|
const newFilteredListings = [...filteredListings] ?? [];
|
|
71
|
+
console.log("Filtered lsitngs:", newFilteredListings);
|
|
72
|
+
console.log("all listings", allListings);
|
|
71
73
|
for (let i = 0; i < allListings.length; i++) {
|
|
72
74
|
const listing = newFilteredListings[i];
|
|
73
75
|
if (listing &&
|
|
74
76
|
listing.fields &&
|
|
75
|
-
listing.
|
|
76
|
-
listing.
|
|
77
|
-
const
|
|
78
|
-
const travelTime =
|
|
77
|
+
listing.fields.entityKey !== undefined &&
|
|
78
|
+
listing.fields.entityKey !== '') {
|
|
79
|
+
const entityKey = listing.fields.entityKey;
|
|
80
|
+
const travelTime = entitiesByKey[entityKey]?.travelTime;
|
|
81
|
+
console.log("Entity for listing with travel time", entityKey, entitiesByKey[entityKey]);
|
|
79
82
|
if (travelTime !== undefined && listing.fields) {
|
|
83
|
+
console.log("Setting travel time for listing", travelTime);
|
|
80
84
|
listing.fields.travelTime = travelTime;
|
|
81
85
|
}
|
|
82
86
|
}
|
|
@@ -94,7 +98,7 @@ const MapListProvider = ({ children, siteConfig, resetFilters, navigateToDetails
|
|
|
94
98
|
setLoading(true);
|
|
95
99
|
}
|
|
96
100
|
try {
|
|
97
|
-
const { listingsResult,
|
|
101
|
+
const { listingsResult, entitiesByKey, distinctItems } = await fetchListings(commuteLocation, entities, listings);
|
|
98
102
|
if (defaultFilters) {
|
|
99
103
|
const filteredListings = listingsResult.filter(listing => {
|
|
100
104
|
if (!listing.fields)
|
|
@@ -110,8 +114,8 @@ const MapListProvider = ({ children, siteConfig, resetFilters, navigateToDetails
|
|
|
110
114
|
else {
|
|
111
115
|
setAllListings(listingsResult);
|
|
112
116
|
}
|
|
113
|
-
setListingEntities(
|
|
114
|
-
setMapItems(
|
|
117
|
+
setListingEntities(entitiesByKey);
|
|
118
|
+
setMapItems(Object.values(mapItems));
|
|
115
119
|
}
|
|
116
120
|
catch (error) {
|
|
117
121
|
console.log(error);
|
|
@@ -142,7 +146,7 @@ const MapListProvider = ({ children, siteConfig, resetFilters, navigateToDetails
|
|
|
142
146
|
updateURLWithFilters(tempSelectedFilters, window.location, tempQuery, handleUrlUpdate);
|
|
143
147
|
}
|
|
144
148
|
tempQuery != null ? localStorage.setItem('query', tempQuery) : localStorage.removeItem('query');
|
|
145
|
-
setMapItems(mapItems);
|
|
149
|
+
setMapItems(Object.values(mapItems));
|
|
146
150
|
if (tempSelectedFilters) {
|
|
147
151
|
const keys = Object.keys(tempSelectedFilters);
|
|
148
152
|
const lastKey = keys[keys.length - 1];
|
|
@@ -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\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\tconst fetchedEntities = 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);\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":";;;;;;;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;AACh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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';\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,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BAAsB,GAAG,CAAC,YAA6B,KAAI;QAChE,IAAI,YAAY,IAAI,IAAI,EAAE;AACzB,YAAA,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;AACrC,SAAA;AAAM,aAAA;YACN,YAAY,CAAC,YAAY,CAAC,CAAC;AAC3B,YAAA,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;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;;;;"}
|
|
@@ -5,26 +5,27 @@ import { getDistinctItemsByProximity } from '../util/mapUtil.js';
|
|
|
5
5
|
const fetchListings = async (commuteLocation = null, entities, listings) => {
|
|
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
|
-
];
|
|
11
8
|
const fetchedEntities = !commuteLocation
|
|
12
|
-
? entities && entities.length > 0 ? entities : await getListingEntities(
|
|
13
|
-
: await getListingEntities(
|
|
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;
|
|
14
13
|
for (let i = 0; i < listingsResult.length; i++) {
|
|
15
14
|
const listing = listingsResult[i];
|
|
16
|
-
if (listing.
|
|
17
|
-
const entity =
|
|
15
|
+
if (listing.fields && listing.fields.entityKey && listing.fields.entityKey !== '' && listing.fields) {
|
|
16
|
+
const entity = entitiesByKey[listing.fields.entityKey];
|
|
17
|
+
console.log("Entity for listing with travel time", listing.fields.entityKey, entity);
|
|
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, entitiesByKey);
|
|
24
24
|
return {
|
|
25
25
|
listingsResult,
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
entitiesByKey,
|
|
27
|
+
//temp fix, need to fix the proximity function to work with entity key and use
|
|
28
|
+
distinctItems: distinctItems
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
31
|
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 entitiesByKey: Record<string, 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): Promise<FetchListingsResult> => {\n\ttry {\n\t\tconst listingsResult = listings && listings.length > 0 ? listings : await getListings();\n\n\t\tconst fetchedEntities = !commuteLocation\n\t\t\t? entities && entities.length > 0 ? entities : await getListingEntities()\n\t\t\t: await getListingEntities(\n\t\t\t\t`${commuteLocation.lat}, ${commuteLocation.lng}`\n\t\t\t);\n\n\t\t//possible quick workaround fix, need to implement clearer code\n\n\t\tconst entitiesByKey = fetchedEntities;\n\t\tfor (let i = 0; i < listingsResult.length; i++) {\n\t\t\tconst listing = listingsResult[i];\n\t\t\tif (listing.fields && listing.fields.entityKey && listing.fields.entityKey !== '' && listing.fields) {\n\t\t\t\tconst entity = entitiesByKey[listing.fields.entityKey];\n\t\t\t\tconsole.log(\"Entity for listing with travel time\", listing.fields.entityKey, entity);\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\t\tconst distinctItems = getDistinctItemsByProximity(\n\t\t\tlistingsResult,\n\t\t\tentitiesByKey,\n\t\t);\n\n\t\treturn {\n\t\t\tlistingsResult,\n\t\t\tentitiesByKey,\n\t\t\t//temp fix, need to fix the proximity function to work with entity key and use\n\t\t\tdistinctItems: distinctItems\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":";;;;AAYM,MAAA,aAAa,GAAG,OACrB,eAAA,GA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KAAA;AAAC,IAAA,OAAO,KAAK,EAAE;AACf,QAAA,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;AACjD,QAAA,MAAM,KAAK,CAAC;AACZ,KAAA;AACF;;;;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import api from '../apis/hcApi.js';
|
|
2
2
|
|
|
3
|
-
const getListingEntities = async (
|
|
3
|
+
const getListingEntities = async (origin = '') => {
|
|
4
4
|
try {
|
|
5
|
-
|
|
5
|
+
//need to update / or add better endpoint fo this to match original functioanlity
|
|
6
|
+
const response = await api.get(`/listingentities/MapEntities?origin=${origin}`);
|
|
6
7
|
return response;
|
|
7
8
|
}
|
|
8
9
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listingEntityService.js","sources":["../../src/services/listingEntityService.ts"],"sourcesContent":["import api from '~/apis/hcApi';\
|
|
1
|
+
{"version":3,"file":"listingEntityService.js","sources":["../../src/services/listingEntityService.ts"],"sourcesContent":["import api from '~/apis/hcApi';\n\nexport const getListingEntities = async (origin = ''): Promise<any> => {\n\ttry {\n\t\t//need to update / or add better endpoint fo this to match original functioanlity\n\t\tconst response = await api.get<any>(`/listingentities/MapEntities?origin=${origin}`);\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":";;AAEa,MAAA,kBAAkB,GAAG,OAAO,MAAM,GAAG,EAAE,KAAkB;IACrE,IAAI;;QAEH,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,GAAG,CAAM,CAAuC,oCAAA,EAAA,MAAM,CAAE,CAAA,CAAC,CAAC;AACrF,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,22 +2,21 @@ import api from '../apis/hcApi.js';
|
|
|
2
2
|
|
|
3
3
|
const getListings = async (params) => {
|
|
4
4
|
try {
|
|
5
|
-
const query = new URLSearchParams();
|
|
6
|
-
if (params) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
5
|
+
// const query = new URLSearchParams();
|
|
6
|
+
// if (params) {
|
|
7
|
+
// if (params.location) params.location.forEach(loc => query.append('location', loc));
|
|
8
|
+
// if (params.category) params.category.forEach(cat => query.append('category', cat));
|
|
9
|
+
// if (params.categoryClass) params.categoryClass.forEach(catClass => query.append('categoryClass', catClass));
|
|
10
|
+
// if (params.education) params.education.forEach(edu => query.append('education', edu));
|
|
11
|
+
// if (params.city) params.city.forEach(cty => query.append('city', cty));
|
|
12
|
+
// if (params.state) params.state.forEach(st => query.append('state', st));
|
|
13
|
+
// }
|
|
14
|
+
const response = await api.get(`/joblistings/maplistings`);
|
|
15
|
+
for (var i = 0; i < response.length; i++) {
|
|
16
|
+
response[i].fields.position = response[i].fields.title;
|
|
17
|
+
response[i].fields.categoryClass = response[i].fields.category;
|
|
18
|
+
response[i].fields.category = response[i].fields.subCategory;
|
|
19
19
|
}
|
|
20
|
-
const response = await api.get(`/Listings?${query.toString()}`);
|
|
21
20
|
return response;
|
|
22
21
|
}
|
|
23
22
|
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\t// const query = new URLSearchParams();\n\n\t\t// if (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(`/joblistings/maplistings`);\n\t\tfor(var i = 0; i < (response as any).length; i++) {\n\n\t\t\t(response as any)[i].fields.position = (response as any)[i].fields.title;\n\t\t\t\t(response as any)[i].fields.categoryClass = (response as any)[i].fields.category;\n\t\t\t\t\t\t(response as any)[i].fields.category = (response as any)[i].fields.subCategory;\n\n\n\t\t}\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;;;;;;;;;;QAYH,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,CAA0B,wBAAA,CAAA,CAAC,CAAC;AAC3D,QAAA,KAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAI,QAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAEhD,YAAA,QAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,GAAI,QAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;AACvE,YAAA,QAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,GAAI,QAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;AAC9E,YAAA,QAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,GAAI,QAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC;AAGlF,SAAA;AACD,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;;;;"}
|
|
@@ -2,7 +2,7 @@ import { Listing } from '~/types/Listings';
|
|
|
2
2
|
import { ListingEntity } from '~/types/ListingEntity';
|
|
3
3
|
interface FetchListingsResult {
|
|
4
4
|
listingsResult: Listing[];
|
|
5
|
-
|
|
5
|
+
entitiesByKey: Record<string, ListingEntity>;
|
|
6
6
|
distinctItems: any;
|
|
7
7
|
}
|
|
8
8
|
declare const fetchListings: (commuteLocation: any | null, entities: ListingEntity[] | null, listings: Listing[] | null) => Promise<FetchListingsResult>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const getListingEntities: (entityIds: number[], origin?: string) => Promise<ListingEntity[]>;
|
|
1
|
+
export declare const getListingEntities: (origin?: string) => Promise<any>;
|
|
3
2
|
declare const _default: {
|
|
4
|
-
getListingEntities: (
|
|
3
|
+
getListingEntities: (origin?: string) => Promise<any>;
|
|
5
4
|
};
|
|
6
5
|
export default _default;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export function getDistinctItemsByProximity(items: any,
|
|
2
|
-
export function findCloseItems(
|
|
1
|
+
export function getDistinctItemsByProximity(items: any, listingEntitiesDetailsInput: any): any[];
|
|
2
|
+
export function findCloseItems(entitiesByKey: any): {
|
|
3
3
|
item1: any;
|
|
4
4
|
item2: any;
|
|
5
5
|
}[];
|
|
6
|
-
export function adjustItemPositions(
|
|
6
|
+
export function adjustItemPositions(entitiesByKey: 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,34 +1,40 @@
|
|
|
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, listingEntitiesDetailsInput) {
|
|
4
4
|
var clusters = {};
|
|
5
|
-
if (!
|
|
5
|
+
if (!listingEntitiesDetailsInput) return [];
|
|
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;
|
|
6
10
|
var closeItemPairs = findCloseItems(listingEntitiesDetails);
|
|
7
11
|
if (closeItemPairs.length > 0) {
|
|
8
|
-
|
|
12
|
+
var adjusted = adjustItemPositions(listingEntitiesDetails, closeItemPairs);
|
|
13
|
+
Object.assign(listingEntitiesDetails, adjusted);
|
|
9
14
|
}
|
|
10
15
|
items === null || items === void 0 || items.forEach(function (item) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
var _item$fields;
|
|
17
|
+
var entityKey = item === null || item === void 0 || (_item$fields = item.fields) === null || _item$fields === void 0 ? void 0 : _item$fields.entityKey;
|
|
18
|
+
if (!entityKey || entityKey === '-1') return;
|
|
19
|
+
var entityDetails = listingEntitiesDetails[entityKey];
|
|
20
|
+
if (!entityDetails) {
|
|
21
|
+
console.error("Details not found for entityKey: ".concat(entityKey));
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
item.mapDetails = entityDetails;
|
|
25
|
+
if (!clusters[entityKey]) {
|
|
26
|
+
clusters[entityKey] = _objectSpread2(_objectSpread2({}, entityDetails), {}, {
|
|
27
|
+
items: _defineProperty({}, item.id, item)
|
|
28
|
+
});
|
|
29
|
+
} else {
|
|
30
|
+
clusters[entityKey].items[item.id] = item;
|
|
25
31
|
}
|
|
26
32
|
});
|
|
27
33
|
return Object.values(clusters);
|
|
28
34
|
};
|
|
29
|
-
var findCloseItems = function findCloseItems(
|
|
35
|
+
var findCloseItems = function findCloseItems(entitiesByKey) {
|
|
30
36
|
var closeItems = [];
|
|
31
|
-
var items = Object.values(
|
|
37
|
+
var items = Object.values(entitiesByKey); // Convert object to array
|
|
32
38
|
var proximityThreshold = 0.0001;
|
|
33
39
|
for (var i = 0; i < items.length; i++) {
|
|
34
40
|
for (var j = i + 1; j < items.length; j++) {
|
|
@@ -44,14 +50,16 @@ var findCloseItems = function findCloseItems(itemsObj) {
|
|
|
44
50
|
}
|
|
45
51
|
return closeItems;
|
|
46
52
|
};
|
|
47
|
-
var adjustItemPositions = function adjustItemPositions(
|
|
53
|
+
var adjustItemPositions = function adjustItemPositions(entitiesByKey, closeItemPairs) {
|
|
48
54
|
var adjustmentValue = 0.0001;
|
|
49
|
-
var adjustedItems = _objectSpread2({},
|
|
50
|
-
|
|
55
|
+
var adjustedItems = _objectSpread2({}, entitiesByKey);
|
|
51
56
|
closeItemPairs.forEach(function (pair) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
adjustedItems[
|
|
57
|
+
var key2 = pair.item2.entityKey;
|
|
58
|
+
if (adjustedItems[key2]) {
|
|
59
|
+
adjustedItems[key2] = _objectSpread2(_objectSpread2({}, adjustedItems[key2]), {}, {
|
|
60
|
+
latitude: adjustedItems[key2].latitude + adjustmentValue,
|
|
61
|
+
longitude: adjustedItems[key2].longitude + adjustmentValue
|
|
62
|
+
});
|
|
55
63
|
}
|
|
56
64
|
});
|
|
57
65
|
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, listingEntitiesDetailsInput) => {\n\tconst clusters = {};\n\n\tif (!listingEntitiesDetailsInput) return [];\n\n\tconst listingEntitiesDetails = Array.isArray(listingEntitiesDetailsInput)\n\t\t? listingEntitiesDetailsInput.reduce((acc, entity) => {\n\t\t\tif (entity?.entityKey) acc[entity.entityKey] = entity;\n\t\t\treturn acc;\n\t\t }, {})\n\t\t: listingEntitiesDetailsInput;\n\n\tconst closeItemPairs = findCloseItems(listingEntitiesDetails);\n\tif (closeItemPairs.length > 0) {\n\t\tconst adjusted = adjustItemPositions(listingEntitiesDetails, closeItemPairs);\n\t\tObject.assign(listingEntitiesDetails, adjusted);\n\t}\n\n\titems?.forEach(item => {\n\t\tconst entityKey = item?.fields?.entityKey;\n\t\tif (!entityKey || entityKey === '-1') return;\n\t\tconst entityDetails = listingEntitiesDetails[entityKey];\n\t\tif (!entityDetails) {\n\t\t\tconsole.error(`Details not found for entityKey: ${entityKey}`);\n\t\t\treturn;\n\t\t}\n\n\t\titem.mapDetails = entityDetails;\n\n\t\tif (!clusters[entityKey]) {\n\t\t\tclusters[entityKey] = {\n\t\t\t\t...entityDetails,\n\t\t\t\titems: { [item.id]: item }\n\t\t\t};\n\t\t} else {\n\t\t\tclusters[entityKey].items[item.id] = item;\n\t\t}\n\t});\n\n\treturn Object.values(clusters);\n};\n\nexport const findCloseItems = entitiesByKey => {\n\tconst closeItems = [];\n\tconst items = Object.values(entitiesByKey); // Convert object to array\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 (distanceLat < proximityThreshold && distanceLng < proximityThreshold) {\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 = (entitiesByKey, closeItemPairs) => {\n\tconst adjustmentValue = 0.0001;\n\tconst adjustedItems = { ...entitiesByKey };\n\n\tcloseItemPairs.forEach(pair => {\n\t\tconst key2 = pair.item2.entityKey;\n\t\tif (adjustedItems[key2]) {\n\t\t\tadjustedItems[key2] = {\n\t\t\t\t...adjustedItems[key2],\n\t\t\t\tlatitude: adjustedItems[key2].latitude + adjustmentValue,\n\t\t\t\tlongitude: adjustedItems[key2].longitude + adjustmentValue\n\t\t\t};\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\t{\n\t\t\t\turl: createSvgDataUri(fillColor),\n\t\t\t\ttextColor: 'white',\n\t\t\t\theight: 40,\n\t\t\t\twidth: 40\n\t\t\t}\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","listingEntitiesDetailsInput","clusters","listingEntitiesDetails","Array","isArray","reduce","acc","entity","entityKey","closeItemPairs","findCloseItems","length","adjusted","adjustItemPositions","Object","assign","forEach","item","_item$fields","fields","entityDetails","console","error","concat","mapDetails","_objectSpread","_defineProperty","id","values","entitiesByKey","closeItems","proximityThreshold","i","j","distanceLat","Math","abs","latitude","distanceLng","longitude","push","item1","item2","adjustmentValue","adjustedItems","pair","key2","clusterOptions","clusterGridSize","fillColor","gridSize","maxZoom","styles","url","createSvgDataUri","textColor","height","width","svg","btoa"],"mappings":";;AAAO,IAAMA,2BAA2B,GAAG,SAA9BA,2BAA2BA,CAAIC,KAAK,EAAEC,2BAA2B,EAAK;EAClF,IAAMC,QAAQ,GAAG,EAAE,CAAA;AAEnB,EAAA,IAAI,CAACD,2BAA2B,EAAE,OAAO,EAAE,CAAA;AAE3C,EAAA,IAAME,sBAAsB,GAAGC,KAAK,CAACC,OAAO,CAACJ,2BAA2B,CAAC,GACtEA,2BAA2B,CAACK,MAAM,CAAC,UAACC,GAAG,EAAEC,MAAM,EAAK;AACrD,IAAA,IAAIA,MAAM,KAAA,IAAA,IAANA,MAAM,KAAA,KAAA,CAAA,IAANA,MAAM,CAAEC,SAAS,EAAEF,GAAG,CAACC,MAAM,CAACC,SAAS,CAAC,GAAGD,MAAM,CAAA;AACrD,IAAA,OAAOD,GAAG,CAAA;AACT,GAAC,EAAE,EAAE,CAAC,GACNN,2BAA2B,CAAA;AAE9B,EAAA,IAAMS,cAAc,GAAGC,cAAc,CAACR,sBAAsB,CAAC,CAAA;AAC7D,EAAA,IAAIO,cAAc,CAACE,MAAM,GAAG,CAAC,EAAE;AAC9B,IAAA,IAAMC,QAAQ,GAAGC,mBAAmB,CAACX,sBAAsB,EAAEO,cAAc,CAAC,CAAA;AAC5EK,IAAAA,MAAM,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Container = ({
|
|
|
25
25
|
selectItem(null, null, 9, { lat: 39.8283, lng: -98.5795 });
|
|
26
26
|
} else {
|
|
27
27
|
setStorageObject("selectedListItem", item);
|
|
28
|
-
|
|
28
|
+
console.log('mapItems here', mapItems);
|
|
29
|
+
//edited here for new structure of entity key
|
|
30
|
+
const location = mapItems.find(x => Object.prototype.hasOwnProperty.call(x.items, item.entityKey)) || null;
|
|
29
31
|
selectItem(item, location, 12, {
|
|
30
32
|
lat: location?.latitude,
|
|
31
33
|
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,9 +256,10 @@ const MapContainer = ({ markerConfigs, infoWindowClasses, clusterGridSize = 60 }
|
|
|
256
256
|
if (!mapItems) {
|
|
257
257
|
return null;
|
|
258
258
|
}
|
|
259
|
+
|
|
259
260
|
const mapItemsKey = mapItems.map(item => item.id).join("-");
|
|
260
261
|
|
|
261
|
-
|
|
262
|
+
|
|
262
263
|
return (
|
|
263
264
|
<Map
|
|
264
265
|
zoom={zoom}
|
|
@@ -161,28 +161,31 @@ export const MapListProvider: React.FC<MapListProviderProps> = ({
|
|
|
161
161
|
if (!commuteLocation) return;
|
|
162
162
|
|
|
163
163
|
async function fetchEntities() {
|
|
164
|
-
const distinctEntityIds = [
|
|
165
|
-
...new Set(allListings.map(listing => listing.entityId ?? -1))
|
|
166
|
-
];
|
|
167
164
|
try {
|
|
165
|
+
//gonna need to fix this here
|
|
166
|
+
console.log("Fetching entities for commute location", commuteLocation);
|
|
168
167
|
const fetchedEntities = await getListingEntities(
|
|
169
|
-
distinctEntityIds,
|
|
170
168
|
`${commuteLocation.lat}, ${commuteLocation.lng}`
|
|
171
169
|
);
|
|
170
|
+
const entitiesByKey = fetchedEntities;
|
|
171
|
+
|
|
172
172
|
setListingEntities(fetchedEntities);
|
|
173
173
|
const newFilteredListings: Listing[] = [...filteredListings] ?? [];
|
|
174
|
+
console.log("Filtered lsitngs:", newFilteredListings);
|
|
175
|
+
console.log("all listings", allListings);
|
|
174
176
|
for (let i = 0; i < allListings.length; i++) {
|
|
175
177
|
const listing = newFilteredListings[i];
|
|
176
178
|
if (
|
|
177
179
|
listing &&
|
|
178
180
|
listing.fields &&
|
|
179
|
-
listing.
|
|
180
|
-
listing.
|
|
181
|
+
listing.fields.entityKey !== undefined &&
|
|
182
|
+
listing.fields.entityKey !== ''
|
|
181
183
|
) {
|
|
182
|
-
const
|
|
183
|
-
const travelTime =
|
|
184
|
-
|
|
184
|
+
const entityKey = listing.fields.entityKey;
|
|
185
|
+
const travelTime = entitiesByKey[entityKey]?.travelTime;
|
|
186
|
+
console.log("Entity for listing with travel time", entityKey, entitiesByKey[entityKey]);
|
|
185
187
|
if (travelTime !== undefined && listing.fields) {
|
|
188
|
+
console.log("Setting travel time for listing", travelTime);
|
|
186
189
|
listing.fields.travelTime = travelTime;
|
|
187
190
|
}
|
|
188
191
|
}
|
|
@@ -204,7 +207,7 @@ export const MapListProvider: React.FC<MapListProviderProps> = ({
|
|
|
204
207
|
try {
|
|
205
208
|
const {
|
|
206
209
|
listingsResult,
|
|
207
|
-
|
|
210
|
+
entitiesByKey,
|
|
208
211
|
distinctItems
|
|
209
212
|
} = await fetchListings(commuteLocation, entities, listings);
|
|
210
213
|
if (defaultFilters) {
|
|
@@ -221,8 +224,8 @@ export const MapListProvider: React.FC<MapListProviderProps> = ({
|
|
|
221
224
|
} else {
|
|
222
225
|
setAllListings(listingsResult);
|
|
223
226
|
}
|
|
224
|
-
setListingEntities(
|
|
225
|
-
setMapItems(
|
|
227
|
+
setListingEntities(entitiesByKey);
|
|
228
|
+
setMapItems(Object.values(mapItems));
|
|
226
229
|
} catch (error) {
|
|
227
230
|
console.log(error);
|
|
228
231
|
}
|
|
@@ -263,7 +266,7 @@ export const MapListProvider: React.FC<MapListProviderProps> = ({
|
|
|
263
266
|
updateURLWithFilters(tempSelectedFilters, window.location, tempQuery, handleUrlUpdate);
|
|
264
267
|
}
|
|
265
268
|
tempQuery != null ? localStorage.setItem('query', tempQuery) : localStorage.removeItem('query');
|
|
266
|
-
setMapItems(mapItems);
|
|
269
|
+
setMapItems(Object.values(mapItems));
|
|
267
270
|
|
|
268
271
|
if (tempSelectedFilters) {
|
|
269
272
|
const keys = Object.keys(tempSelectedFilters);
|
|
@@ -6,7 +6,7 @@ import { ListingEntity } from '~/types/ListingEntity';
|
|
|
6
6
|
|
|
7
7
|
interface FetchListingsResult {
|
|
8
8
|
listingsResult: Listing[];
|
|
9
|
-
|
|
9
|
+
entitiesByKey: Record<string, ListingEntity>;
|
|
10
10
|
distinctItems: any; // Update this type based on the return type of getDistinctItemsByProximity
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -17,35 +17,36 @@ const fetchListings = async (
|
|
|
17
17
|
): Promise<FetchListingsResult> => {
|
|
18
18
|
try {
|
|
19
19
|
const listingsResult = listings && listings.length > 0 ? listings : await getListings();
|
|
20
|
-
const distinctEntityIds: number[] = [
|
|
21
|
-
...new Set(listingsResult.map(listing => listing.entityId))
|
|
22
|
-
] as number[];
|
|
23
20
|
|
|
24
21
|
const fetchedEntities = !commuteLocation
|
|
25
|
-
? entities && entities.length > 0 ? entities : await getListingEntities(
|
|
22
|
+
? entities && entities.length > 0 ? entities : await getListingEntities()
|
|
26
23
|
: await getListingEntities(
|
|
27
|
-
distinctEntityIds,
|
|
28
24
|
`${commuteLocation.lat}, ${commuteLocation.lng}`
|
|
29
25
|
);
|
|
26
|
+
|
|
27
|
+
//possible quick workaround fix, need to implement clearer code
|
|
28
|
+
|
|
29
|
+
const entitiesByKey = fetchedEntities;
|
|
30
30
|
for (let i = 0; i < listingsResult.length; i++) {
|
|
31
31
|
const listing = listingsResult[i];
|
|
32
|
-
if (listing.
|
|
33
|
-
const entity =
|
|
32
|
+
if (listing.fields && listing.fields.entityKey && listing.fields.entityKey !== '' && listing.fields) {
|
|
33
|
+
const entity = entitiesByKey[listing.fields.entityKey];
|
|
34
|
+
console.log("Entity for listing with travel time", listing.fields.entityKey, entity);
|
|
34
35
|
if (entity) {
|
|
35
36
|
listing.fields.travelTime = entity.travelTime;
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
|
-
|
|
40
40
|
const distinctItems = getDistinctItemsByProximity(
|
|
41
41
|
listingsResult,
|
|
42
|
-
|
|
42
|
+
entitiesByKey,
|
|
43
43
|
);
|
|
44
44
|
|
|
45
45
|
return {
|
|
46
46
|
listingsResult,
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
entitiesByKey,
|
|
48
|
+
//temp fix, need to fix the proximity function to work with entity key and use
|
|
49
|
+
distinctItems: distinctItems
|
|
49
50
|
};
|
|
50
51
|
} catch (error) {
|
|
51
52
|
console.error("Error fetching listings:", error);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import api from '~/apis/hcApi';
|
|
2
|
-
import { ListingEntity } from '~/types/ListingEntity';
|
|
3
2
|
|
|
4
|
-
export const getListingEntities = async (
|
|
3
|
+
export const getListingEntities = async (origin = ''): Promise<any> => {
|
|
5
4
|
try {
|
|
6
|
-
|
|
5
|
+
//need to update / or add better endpoint fo this to match original functioanlity
|
|
6
|
+
const response = await api.get<any>(`/listingentities/MapEntities?origin=${origin}`);
|
|
7
7
|
return response;
|
|
8
8
|
} catch (error) {
|
|
9
9
|
console.error("Error fetching listing entities:", error);
|
|
@@ -5,18 +5,26 @@ import { Listing } from '../types/Listings';
|
|
|
5
5
|
|
|
6
6
|
export const getListings = async (params?: GetListingsParams): Promise<Listing[]> => {
|
|
7
7
|
try {
|
|
8
|
-
const query = new URLSearchParams();
|
|
9
|
-
|
|
10
|
-
if (params) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
8
|
+
// const query = new URLSearchParams();
|
|
9
|
+
|
|
10
|
+
// if (params) {
|
|
11
|
+
// if (params.location) params.location.forEach(loc => query.append('location', loc));
|
|
12
|
+
// if (params.category) params.category.forEach(cat => query.append('category', cat));
|
|
13
|
+
// if (params.categoryClass) params.categoryClass.forEach(catClass => query.append('categoryClass', catClass));
|
|
14
|
+
// if (params.education) params.education.forEach(edu => query.append('education', edu));
|
|
15
|
+
// if (params.city) params.city.forEach(cty => query.append('city', cty));
|
|
16
|
+
// if (params.state) params.state.forEach(st => query.append('state', st));
|
|
17
|
+
// }
|
|
18
|
+
|
|
19
|
+
const response = await api.get(`/joblistings/maplistings`);
|
|
20
|
+
for(var i = 0; i < (response as any).length; i++) {
|
|
18
21
|
|
|
19
|
-
|
|
22
|
+
(response as any)[i].fields.position = (response as any)[i].fields.title;
|
|
23
|
+
(response as any)[i].fields.categoryClass = (response as any)[i].fields.category;
|
|
24
|
+
(response as any)[i].fields.category = (response as any)[i].fields.subCategory;
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
}
|
|
20
28
|
return response as Listing[];
|
|
21
29
|
} catch (error) {
|
|
22
30
|
console.error(error);
|
package/src/types/Listings.ts
CHANGED
package/src/util/mapUtil.js
CHANGED
|
@@ -1,54 +1,55 @@
|
|
|
1
|
-
export const getDistinctItemsByProximity = (items,
|
|
1
|
+
export const getDistinctItemsByProximity = (items, listingEntitiesDetailsInput) => {
|
|
2
2
|
const clusters = {};
|
|
3
3
|
|
|
4
|
-
if (!
|
|
4
|
+
if (!listingEntitiesDetailsInput) return [];
|
|
5
|
+
|
|
6
|
+
const listingEntitiesDetails = Array.isArray(listingEntitiesDetailsInput)
|
|
7
|
+
? listingEntitiesDetailsInput.reduce((acc, entity) => {
|
|
8
|
+
if (entity?.entityKey) acc[entity.entityKey] = entity;
|
|
9
|
+
return acc;
|
|
10
|
+
}, {})
|
|
11
|
+
: listingEntitiesDetailsInput;
|
|
5
12
|
|
|
6
13
|
const closeItemPairs = findCloseItems(listingEntitiesDetails);
|
|
7
14
|
if (closeItemPairs.length > 0) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
closeItemPairs
|
|
11
|
-
);
|
|
15
|
+
const adjusted = adjustItemPositions(listingEntitiesDetails, closeItemPairs);
|
|
16
|
+
Object.assign(listingEntitiesDetails, adjusted);
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
items?.forEach(item => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
20
|
+
const entityKey = item?.fields?.entityKey;
|
|
21
|
+
if (!entityKey || entityKey === '-1') return;
|
|
22
|
+
const entityDetails = listingEntitiesDetails[entityKey];
|
|
23
|
+
if (!entityDetails) {
|
|
24
|
+
console.error(`Details not found for entityKey: ${entityKey}`);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
item.mapDetails = entityDetails;
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
if (!clusters[entityKey]) {
|
|
31
|
+
clusters[entityKey] = {
|
|
32
|
+
...entityDetails,
|
|
33
|
+
items: { [item.id]: item }
|
|
34
|
+
};
|
|
35
|
+
} else {
|
|
36
|
+
clusters[entityKey].items[item.id] = item;
|
|
37
|
+
}
|
|
34
38
|
});
|
|
35
39
|
|
|
36
40
|
return Object.values(clusters);
|
|
37
41
|
};
|
|
38
42
|
|
|
39
|
-
export const findCloseItems =
|
|
43
|
+
export const findCloseItems = entitiesByKey => {
|
|
40
44
|
const closeItems = [];
|
|
41
|
-
const items = Object.values(
|
|
45
|
+
const items = Object.values(entitiesByKey); // Convert object to array
|
|
42
46
|
const proximityThreshold = 0.0001;
|
|
43
47
|
|
|
44
48
|
for (let i = 0; i < items.length; i++) {
|
|
45
49
|
for (let j = i + 1; j < items.length; j++) {
|
|
46
50
|
const distanceLat = Math.abs(items[i].latitude - items[j].latitude);
|
|
47
51
|
const distanceLng = Math.abs(items[i].longitude - items[j].longitude);
|
|
48
|
-
if (
|
|
49
|
-
distanceLat < proximityThreshold &&
|
|
50
|
-
distanceLng < proximityThreshold
|
|
51
|
-
) {
|
|
52
|
+
if (distanceLat < proximityThreshold && distanceLng < proximityThreshold) {
|
|
52
53
|
closeItems.push({ item1: items[i], item2: items[j] });
|
|
53
54
|
}
|
|
54
55
|
}
|
|
@@ -57,14 +58,18 @@ export const findCloseItems = itemsObj => {
|
|
|
57
58
|
return closeItems;
|
|
58
59
|
};
|
|
59
60
|
|
|
60
|
-
export const adjustItemPositions = (
|
|
61
|
+
export const adjustItemPositions = (entitiesByKey, closeItemPairs) => {
|
|
61
62
|
const adjustmentValue = 0.0001;
|
|
62
|
-
const adjustedItems = { ...
|
|
63
|
+
const adjustedItems = { ...entitiesByKey };
|
|
63
64
|
|
|
64
65
|
closeItemPairs.forEach(pair => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
adjustedItems[
|
|
66
|
+
const key2 = pair.item2.entityKey;
|
|
67
|
+
if (adjustedItems[key2]) {
|
|
68
|
+
adjustedItems[key2] = {
|
|
69
|
+
...adjustedItems[key2],
|
|
70
|
+
latitude: adjustedItems[key2].latitude + adjustmentValue,
|
|
71
|
+
longitude: adjustedItems[key2].longitude + adjustmentValue
|
|
72
|
+
};
|
|
68
73
|
}
|
|
69
74
|
});
|
|
70
75
|
|
|
@@ -74,13 +79,15 @@ export const adjustItemPositions = (itemsObj, closeItemPairs) => {
|
|
|
74
79
|
export const clusterOptions = (clusterGridSize, fillColor) => {
|
|
75
80
|
return {
|
|
76
81
|
gridSize: clusterGridSize,
|
|
77
|
-
maxZoom:15,
|
|
78
|
-
styles:[
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
maxZoom: 15,
|
|
83
|
+
styles: [
|
|
84
|
+
{
|
|
85
|
+
url: createSvgDataUri(fillColor),
|
|
86
|
+
textColor: 'white',
|
|
87
|
+
height: 40,
|
|
88
|
+
width: 40
|
|
89
|
+
}
|
|
90
|
+
]
|
|
84
91
|
};
|
|
85
92
|
};
|
|
86
93
|
|