@abcagency/hc-ui-components 1.3.49 → 1.3.51
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/maps/info-window-content-container.js +2 -1
- package/dist/components/containers/maps/info-window-content-container.js.map +1 -1
- package/dist/components/containers/maps/map-container.js +5 -0
- package/dist/components/containers/maps/map-container.js.map +1 -1
- package/dist/components/modules/maps/info-window-content.js +25 -4
- package/dist/components/modules/maps/info-window-content.js.map +1 -1
- package/dist/contexts/mapListContext.js +3 -7
- package/dist/contexts/mapListContext.js.map +1 -1
- package/package.json +1 -1
- package/src/components/containers/maps/info-window-content-container.js +1 -1
- package/src/components/containers/maps/map-container.js +5 -1
- package/src/components/modules/maps/info-window-content.js +64 -36
- package/src/contexts/mapListContext.tsx +3 -7
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';\r\nconst baseURL = process.env.HC_API_BASE_URL as string;\r\n\r\ninterface MemoryStorage {\r\n\tauthToken: string | null;\r\n\ttokenExpiration: string | null;\r\n}\r\n\r\nconst memoryStorage: MemoryStorage = {\r\n\tauthToken: null,\r\n\ttokenExpiration: null\r\n};\r\n\r\nfunction setStorage(key: keyof MemoryStorage, value: string): void {\r\n\ttry {\r\n\t\tsessionStorage.setItem(key, value);\r\n\t} catch (error) {\r\n\t\tmemoryStorage[key] = value;\r\n\t}\r\n}\r\n\r\nfunction getStorage(key: keyof MemoryStorage): string | null {\r\n\ttry {\r\n\t\treturn sessionStorage.getItem(key) || memoryStorage[key];\r\n\t} catch (error) {\r\n\t\treturn memoryStorage[key];\r\n\t}\r\n}\r\n\r\ninterface AuthResponse {\r\n\ttoken: string;\r\n\texpiration: string;\r\n}\r\n\r\nconst login = async (): Promise<AuthResponse> => {\r\n\tconst clientAuthKey = getClientAuthKey();\r\n\r\n\ttry {\r\n\t\tconst response = await fetch(`${baseURL}/auth/login`, {\r\n\t\t\tmethod: 'POST',\r\n\t\t\theaders: {\r\n\t\t\t\t'Content-Type': 'application/json'\r\n\t\t\t},\r\n\t\t\tbody: JSON.stringify({\r\n\t\t\t\tclientAuthKey: clientAuthKey\r\n\t\t\t})\r\n\t\t});\r\n\r\n\t\tif (!response.ok) {\r\n\t\t\tthrow new Error('Login failed');\r\n\t\t}\r\n\r\n\t\tconst data = await response.json();\r\n\r\n\t\tif (data.token && data.expiration) {\r\n\t\t\tsetStorage('authToken', data.token);\r\n\t\t\tsetStorage('tokenExpiration', data.expiration);\r\n\t\t\treturn { token: data.token, expiration: data.expiration };\r\n\t\t} else {\r\n\t\t\tthrow new Error('Invalid login response');\r\n\t\t}\r\n\t} catch (error) {\r\n\t\tconsole.error('Login failed:', error);\r\n\t\tthrow error;\r\n\t}\r\n};\r\n\r\nconst fetchWithAuth = async (url: string, options: RequestInit = {}): Promise<Response> => {\r\n\tlet token = getStorage('authToken');\r\n\r\n\tconst expirationDateTime = getStorage('tokenExpiration');\r\n\tconst currentTime = new Date();\r\n\r\n\tif (!token || !expirationDateTime || new Date(expirationDateTime) <= currentTime) {\r\n\t\tconst authResponse = await login();\r\n\t\ttoken = authResponse.token;\r\n\t}\r\n\r\n\tconst headers = new Headers(options.headers || {});\r\n\theaders.append('Authorization', `Bearer ${token}`);\r\n\r\n\tconst finalOptions = {\r\n\t\t...options,\r\n\t\theaders\r\n\t};\r\n\r\n\tconst response = await fetch(`${baseURL}${url}`, finalOptions);\r\n\r\n\tif (!response.ok) throw new Error('Network response was not ok.');\r\n\r\n\treturn response;\r\n};\r\n\r\nexport default {\r\n\tget: async <T>(url: string): Promise<T> => {\r\n\t\tconst response = await fetchWithAuth(url);\r\n\t\treturn await response.json() as T;\r\n\t},\r\n\tpost: async <T>(url: string, data: any): Promise<T> => {\r\n\t\tconst response = await fetchWithAuth(url, {\r\n\t\t\tmethod: 'POST',\r\n\t\t\theaders: {\r\n\t\t\t\t'Content-Type': 'application/json'\r\n\t\t\t},\r\n\t\t\tbody: JSON.stringify(data)\r\n\t\t});\r\n\t\treturn await response.json() as T;\r\n\t}\r\n};\r\n"],"names":[],"mappings":";;AACA,MAAM,OAAO,GAAG
|
|
1
|
+
{"version":3,"file":"hcApi.js","sources":["../../src/apis/hcApi.ts"],"sourcesContent":["import { getClientAuthKey } from '~/clientToken';\r\nconst baseURL = process.env.HC_API_BASE_URL as string;\r\n\r\ninterface MemoryStorage {\r\n\tauthToken: string | null;\r\n\ttokenExpiration: string | null;\r\n}\r\n\r\nconst memoryStorage: MemoryStorage = {\r\n\tauthToken: null,\r\n\ttokenExpiration: null\r\n};\r\n\r\nfunction setStorage(key: keyof MemoryStorage, value: string): void {\r\n\ttry {\r\n\t\tsessionStorage.setItem(key, value);\r\n\t} catch (error) {\r\n\t\tmemoryStorage[key] = value;\r\n\t}\r\n}\r\n\r\nfunction getStorage(key: keyof MemoryStorage): string | null {\r\n\ttry {\r\n\t\treturn sessionStorage.getItem(key) || memoryStorage[key];\r\n\t} catch (error) {\r\n\t\treturn memoryStorage[key];\r\n\t}\r\n}\r\n\r\ninterface AuthResponse {\r\n\ttoken: string;\r\n\texpiration: string;\r\n}\r\n\r\nconst login = async (): Promise<AuthResponse> => {\r\n\tconst clientAuthKey = getClientAuthKey();\r\n\r\n\ttry {\r\n\t\tconst response = await fetch(`${baseURL}/auth/login`, {\r\n\t\t\tmethod: 'POST',\r\n\t\t\theaders: {\r\n\t\t\t\t'Content-Type': 'application/json'\r\n\t\t\t},\r\n\t\t\tbody: JSON.stringify({\r\n\t\t\t\tclientAuthKey: clientAuthKey\r\n\t\t\t})\r\n\t\t});\r\n\r\n\t\tif (!response.ok) {\r\n\t\t\tthrow new Error('Login failed');\r\n\t\t}\r\n\r\n\t\tconst data = await response.json();\r\n\r\n\t\tif (data.token && data.expiration) {\r\n\t\t\tsetStorage('authToken', data.token);\r\n\t\t\tsetStorage('tokenExpiration', data.expiration);\r\n\t\t\treturn { token: data.token, expiration: data.expiration };\r\n\t\t} else {\r\n\t\t\tthrow new Error('Invalid login response');\r\n\t\t}\r\n\t} catch (error) {\r\n\t\tconsole.error('Login failed:', error);\r\n\t\tthrow error;\r\n\t}\r\n};\r\n\r\nconst fetchWithAuth = async (url: string, options: RequestInit = {}): Promise<Response> => {\r\n\tlet token = getStorage('authToken');\r\n\r\n\tconst expirationDateTime = getStorage('tokenExpiration');\r\n\tconst currentTime = new Date();\r\n\r\n\tif (!token || !expirationDateTime || new Date(expirationDateTime) <= currentTime) {\r\n\t\tconst authResponse = await login();\r\n\t\ttoken = authResponse.token;\r\n\t}\r\n\r\n\tconst headers = new Headers(options.headers || {});\r\n\theaders.append('Authorization', `Bearer ${token}`);\r\n\r\n\tconst finalOptions = {\r\n\t\t...options,\r\n\t\theaders\r\n\t};\r\n\r\n\tconst response = await fetch(`${baseURL}${url}`, finalOptions);\r\n\r\n\tif (!response.ok) throw new Error('Network response was not ok.');\r\n\r\n\treturn response;\r\n};\r\n\r\nexport default {\r\n\tget: async <T>(url: string): Promise<T> => {\r\n\t\tconst response = await fetchWithAuth(url);\r\n\t\treturn await response.json() as T;\r\n\t},\r\n\tpost: async <T>(url: string, data: any): Promise<T> => {\r\n\t\tconst response = await fetchWithAuth(url, {\r\n\t\t\tmethod: 'POST',\r\n\t\t\theaders: {\r\n\t\t\t\t'Content-Type': 'application/json'\r\n\t\t\t},\r\n\t\t\tbody: JSON.stringify(data)\r\n\t\t});\r\n\t\treturn await response.json() as T;\r\n\t}\r\n};\r\n"],"names":[],"mappings":";;AACA,MAAM,OAAO,GAAG,wBAAqC,CAAC;AAOtD,MAAM,aAAa,GAAkB;AACpC,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,eAAe,EAAE,IAAI;CACrB,CAAC;AAEF,SAAS,UAAU,CAAC,GAAwB,EAAE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;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;;;;"}
|
|
@@ -59,7 +59,8 @@ var InfoWindowContentContainer = function InfoWindowContentContainer(_ref) {
|
|
|
59
59
|
return /*#__PURE__*/React__default.createElement(InfoWindowContent, {
|
|
60
60
|
items: items,
|
|
61
61
|
fullAddress: fullAddress,
|
|
62
|
-
applyFilters: applyFilters
|
|
62
|
+
applyFilters: applyFilters,
|
|
63
|
+
mapInfoWindowConfig: siteConfig.mapInfoWindowConfig
|
|
63
64
|
});
|
|
64
65
|
};
|
|
65
66
|
|
|
@@ -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\tfilterListingsByLocation\n}) => {\n\tconst { trackEvent, eventTypes } = useTrackEvent();\n\tconst { setSelectedFilters, setMobileTab, selectedFilters, siteConfig, filteredListings } = 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\titems[0].mapDetails?.address?.state,\n\t\titems[0].mapDetails?.address?.zip\n\t];\n\tconst fullAddress = addressParts.filter(Boolean).join(', ');\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} />;\n};\n\nexport default InfoWindowContentContainer;\n"],"names":["InfoWindowContentContainer","_ref","_items$0$mapDetails","_items$0$mapDetails2","_items$0$mapDetails3","_items$0$mapDetails4","item","filterListingsByLocation","_useTrackEvent","useTrackEvent","trackEvent","eventTypes","_useMapList","useMapList","setSelectedFilters","setMobileTab","selectedFilters","siteConfig","filteredListings","fieldsShown","locationFiltersShown","items","Object","values","addressParts","mapDetails","address","street","city","state","zip","fullAddress","filter","Boolean","join","applyFilters","newFilters","_objectSpread","filters","includes","cityState","_defineProperty","fields","push","filterType","filterChecked","entityName","VIEW_JOBS_AT_Location","filtersApplied","React","createElement","InfoWindowContent"],"mappings":";;;;;;AAKA,IAAMA,0BAA0B,GAAG,SAA7BA,0BAA0BA,CAAAC,IAAA,EAG1B;AAAA,EAAA,IAAAC,mBAAA,EAAAC,oBAAA,EAAAC,oBAAA,EAAAC,oBAAA,CAAA;AAAA,EAAA,IAFLC,IAAI,GAAAL,IAAA,CAAJK,IAAI,CAAA;IACoBL,IAAA,CAAxBM,yBAAwB;AAExB,EAAA,IAAAC,cAAA,GAAmCC,aAAa,EAAE;IAA1CC,UAAU,GAAAF,cAAA,CAAVE,UAAU;IAAEC,UAAU,GAAAH,cAAA,CAAVG,UAAU,CAAA;AAC9B,EAAA,IAAAC,WAAA,GAA4FC,UAAU,EAAE,CAAA;IAAhGC,kBAAkB,GAAAF,WAAA,CAAlBE,kBAAkB,CAAA;IAAEC,YAAY,GAAAH,WAAA,CAAZG,YAAY,CAAA;IAAEC,eAAe,GAAAJ,WAAA,CAAfI,eAAe,CAAA;IAAEC,UAAU,GAAAL,WAAA,CAAVK,UAAU,CAAA;IAAkBL,WAAA,CAAhBM,iBAAgB;AACvF,EAAA,IAAMC,WAAW,GAAGF,UAAU,CAACG,oBAAoB,CAAA;AACnD,EAAA,IAAIC,KAAK,GAAGf,IAAI,IAAIA,IAAI,CAACe,KAAK,GAAGC,MAAM,CAACC,MAAM,CAACjB,IAAI,CAACe,KAAK,CAAC,GAAG,IAAI,CAAA;EAEjE,IAAMG,YAAY,GAAG,CAAAtB,CAAAA,mBAAA,GACpBmB,KAAK,CAAC,CAAC,CAAC,CAACI,UAAU,MAAAvB,IAAAA,IAAAA,mBAAA,gBAAAA,mBAAA,GAAnBA,mBAAA,CAAqBwB,OAAO,cAAAxB,mBAAA,KAAA,KAAA,CAA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ACI,UAAAA;AAAW,KAAC,CAAC,CAAA;AAErFpC,IAAAA,UAAU,CAACC,UAAU,CAACoC,qBAAqB,EAAE;AAAEC,MAAAA,cAAc,EAAEV,OAAAA;AAAQ,KAAC,CAAC,CAAA;IACzExB,kBAAkB,CAACsB,UAAU,CAAC,CAAA;GAC9B,CAAA;AAED,EAAA,oBAAOa,cAAA,CAAAC,aAAA,CAACC,iBAAiB,EAAA;AAAC9B,IAAAA,KAAK,EAAEA,KAAM;AAACU,IAAAA,WAAW,EAAEA,WAAY;AAACI,IAAAA,YAAY,EAAEA,
|
|
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\tfilterListingsByLocation\n}) => {\n\tconst { trackEvent, eventTypes } = useTrackEvent();\n\tconst { setSelectedFilters, setMobileTab, selectedFilters, siteConfig, filteredListings } = 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\titems[0].mapDetails?.address?.state,\n\t\titems[0].mapDetails?.address?.zip\n\t];\n\tconst fullAddress = addressParts.filter(Boolean).join(', ');\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","filterListingsByLocation","_useTrackEvent","useTrackEvent","trackEvent","eventTypes","_useMapList","useMapList","setSelectedFilters","setMobileTab","selectedFilters","siteConfig","filteredListings","fieldsShown","locationFiltersShown","items","Object","values","addressParts","mapDetails","address","street","city","state","zip","fullAddress","filter","Boolean","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,EAG1B;AAAA,EAAA,IAAAC,mBAAA,EAAAC,oBAAA,EAAAC,oBAAA,EAAAC,oBAAA,CAAA;AAAA,EAAA,IAFLC,IAAI,GAAAL,IAAA,CAAJK,IAAI,CAAA;IACoBL,IAAA,CAAxBM,yBAAwB;AAExB,EAAA,IAAAC,cAAA,GAAmCC,aAAa,EAAE;IAA1CC,UAAU,GAAAF,cAAA,CAAVE,UAAU;IAAEC,UAAU,GAAAH,cAAA,CAAVG,UAAU,CAAA;AAC9B,EAAA,IAA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C,CAAC,CAAA;AAC1E,KAAA;AAEA,IAAA,IAAIT,WAAW,CAACoB,QAAQ,CAAC,OAAO,CAAC,EAAE;AAClCH,MAAAA,UAAU,CAACP,KAAK,GAAAY,eAAA,KAAMpB,KAAK,CAAC,CAAC,CAAC,CAACqB,MAAM,CAACb,KAAK,EAAG,IAAI,CAAE,CAAA;MACpDS,OAAO,CAACK,IAAI,CAAC;AAAEC,QAAAA,UAAU,EAAE,OAAO;AAAEC,QAAAA,aAAa,EAAExB,KAAK,CAAC,CAAC,CAAC,CAACqB,MAAM,CAACb,KAAAA;AAAM,OAAC,CAAC,CAAA;AAC5E,KAAA;AAEAO,IAAAA,UAAU,CAACU,UAAU,GAAAL,eAAA,KAAMpB,KAAK,CAAC,CAAC,CAAC,CAACqB,MAAM,CAACI,UAAU,EAAG,IAAI,CAAE,CAAA;IAC9DR,OAAO,CAACK,IAAI,CAAC;AAAEC,MAAAA,UAAU,EAAE,YAAY;AAAEC,MAAAA,aAAa,EAAExB,KAAK,CAAC,CAAC,CAAC,CAACqB,MAAM,CAACI,UAAAA;AAAW,KAAC,CAAC,CAAA;AAErFpC,IAAAA,UAAU,CAACC,UAAU,CAACoC,qBAAqB,EAAE;AAAEC,MAAAA,cAAc,EAAEV,OAAAA;AAAQ,KAAC,CAAC,CAAA;IACzExB,kBAAkB,CAACsB,UAAU,CAAC,CAAA;GAC9B,CAAA;AAED,EAAA,oBAAOa,cAAA,CAAAC,aAAA,CAACC,iBAAiB,EAAA;AAAC9B,IAAAA,KAAK,EAAEA,KAAM;AAACU,IAAAA,WAAW,EAAEA,WAAY;AAACI,IAAAA,YAAY,EAAEA,YAAa;IAACiB,mBAAmB,EAAEnC,UAAU,CAACmC,mBAAAA;AAAoB,GAAC,CAAC,CAAA;AACrJ;;;;"}
|
|
@@ -107,6 +107,11 @@ var MapContainer = function MapContainer(_ref) {
|
|
|
107
107
|
mapItems.forEach(function (item) {
|
|
108
108
|
bounds.extend(new google.maps.LatLng(item.latitude, item.longitude));
|
|
109
109
|
});
|
|
110
|
+
if (siteConfig.optionalShowLocationClusterConfig) {
|
|
111
|
+
var configLocation = new google.maps.LatLng(siteConfig.optionalShowLocationClusterConfig.latitude, siteConfig.optionalShowLocationClusterConfig.longitude);
|
|
112
|
+
map.panTo(configLocation);
|
|
113
|
+
bounds.extend(new google.maps.LatLng(siteConfig.optionalShowLocationClusterConfig.latitude, siteConfig.optionalShowLocationClusterConfig.longitude));
|
|
114
|
+
}
|
|
110
115
|
if (!map) return;
|
|
111
116
|
var _currentCenter = map.getCenter();
|
|
112
117
|
map.fitBounds(bounds);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-container.js","sources":["../../../../src/components/containers/maps/map-container.js"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\r\n\r\nimport MapMarker from \"~/components/containers/maps/map-marker-container\";\r\nimport PlaceMarker from \"~/components/modules/maps/place-marker\";\r\n\r\nimport { usePlaces } from \"~/contexts/placesContext\";\r\nimport { useMap } from \"~/contexts/mapContext\";\r\nimport { useMapList } from \"~/contexts/mapListContext\";\r\n\r\nimport { markerIconSelected, markerIcon, pinIcon } from \"~/util/mapIconUtil\";\r\n\r\nimport Map from \"~/components/modules/maps/map\";\r\nimport { MarkerClustererF } from \"@react-google-maps/api\";\r\nimport { clusterOptions } from \"~/util/mapUtil\";\r\n\r\nconst MapContainer = ({\r\n\tmarkerConfigs,\r\n\tinfoWindowClasses,\r\n\tclusterGridSize = 60\r\n}) => {\r\n\tconst {\r\n\t\tlocation,\r\n\t\tzoom,\r\n\t\tcenter,\r\n\t\tselectLocationEntity,\r\n\t\tsetLocation,\r\n\t\tmapInteracted,\r\n\t\tsetMapInteracted\r\n\t} = useMap();\r\n\r\n\tconst {\r\n\t\tmapItems, filteredListings, setSelectedFilters,\r\n\t\tsetQuery,\r\n\t\tsiteConfig\r\n\t} = useMapList();\r\n\r\n\tconst mapRef = useRef();\r\n\tconst markerRefs = useRef({});\r\n\tconst mapContainerRef = useRef(null);\r\n\tconst {\r\n\t\tpoiMarkers,\r\n\t\tsetCurrentCenter,\r\n\t\tcurrentCenter,\r\n\t\tsetCurrentZoom,\r\n\t\tcurrentZoom,\r\n\t\tselectedPlaceMarker,\r\n\t\tsetSelectedPlaceMarker,\r\n\t\tplacesWindow,\r\n\t\tsetPlacesWindow } = usePlaces();\r\n\r\n\tconst onIdle = () => {\r\n\t\tif (!currentCenter || !mapRef.current) return;\r\n\t\tconst newCenter = mapRef.current.getCenter().toJSON();\r\n\t\tconst newZoom = mapRef.current.zoom;\r\n\r\n\t\tsetCurrentCenter(newCenter);\r\n\r\n\t\tif (newZoom !== currentZoom) {\r\n\t\t\tsetCurrentZoom(newZoom);\r\n\t\t}\r\n\t};\r\n\r\n\tuseEffect(() => {\r\n\t\tif (mapContainerRef.current) {\r\n\t\t\tconst handleScroll = () => {\r\n\t\t\t\tsetMapInteracted(true);\r\n\t\t\t};\r\n\t\t\tvar mapContainerRefCurrent = mapContainerRef.current;\r\n\t\t\tmapContainerRef.current.addEventListener('wheel', handleScroll);\r\n\t\t\treturn () => mapContainerRefCurrent.removeEventListener('wheel', handleScroll);\r\n\t\t}\r\n\t}, [mapContainerRef.current]);\r\n\r\n\tuseEffect(() => {\r\n\t\tif (mapRef.current) {\r\n\t\t\tconst mapInstance = mapRef.current;\r\n\t\t\tconst dragStartListener = mapInstance.addListener('dragstart', () => setMapInteracted(true));\r\n\t\t\tconst mouseDownListener = mapInstance.addListener('mousedown', () => setMapInteracted(true));\r\n\t\t\treturn () => {\r\n\t\t\t\tgoogle.maps.event.removeListener(dragStartListener);\r\n\t\t\t\tgoogle.maps.event.removeListener(mouseDownListener);\r\n\t\t\t};\r\n\t\t}\r\n\t}, [mapRef.current, mapContainerRef.current]);\r\n\r\n\tuseEffect(() => {\r\n\t\tif ((mapItems && mapItems.length > 0 || poiMarkers.length > 0) && mapRef.current) {\r\n\t\t\tfitBounds(mapRef.current);\r\n\t\t}\r\n\t}, [mapItems, mapRef.current, location]);\r\n\r\n\tuseEffect(() => {\r\n\t\tif ((mapItems && mapItems.length > 0 || poiMarkers.length > 0) && mapRef.current && mapInteracted) {\r\n\t\t\tfitBounds(mapRef.current, true);\r\n\t\t}\r\n\t\tif (mapRef.current) {\r\n\t\t\tlet currZoom = mapRef.current.zoom;\r\n\t\t\tlet setZoomVal = currZoom < 13 ? currZoom : 12;\r\n\t\t\tmapRef.current.setZoom(setZoomVal);\r\n\t\t}\r\n\t}, [filteredListings]);\r\n\r\n\tuseEffect(() => {\r\n\t\tif (!mapRef.current || !location || mapInteracted) return;\r\n\t\tmapRef.current.panTo(\r\n\t\t\tnew google.maps.LatLng(location.latitude, location.longitude)\r\n\t\t);\r\n\t\tif (mapRef.current) {\r\n\t\t\tlet setZoomVal = zoom < 13 ? zoom : 12;\r\n\t\t\tmapRef.current.setZoom(setZoomVal);\r\n\t\t}\r\n\t}, [location, zoom, mapRef.current]);\r\n\r\n\tconst fitBounds = (map, overload = false) => {\r\n\t\tif ((mapInteracted === false || overload) && mapItems != null) {\r\n\t\t const bounds = new window.google.maps.LatLngBounds();\r\n\t\t mapItems.forEach(item => {\r\n\t\t\t\tbounds.extend(new google.maps.LatLng(item.latitude, item.longitude));\r\n\t\t });\r\n\r\n\t\t if (!map) return;\r\n\t\t const currentCenter = map.getCenter();\r\n\t\t map.fitBounds(bounds);\r\n\t\t const newCenter = bounds.getCenter();\r\n\t\t if (currentCenter && newCenter) {\r\n\t\t\t\tmap.panTo(newCenter);\r\n\t\t }\r\n\t\t}\r\n\t\tif (mapRef.current.zoom > 17) {\r\n\t\t mapRef.current.setZoom(16);\r\n\t\t}\r\n\t };\r\n\r\n\tconst markerClickHandler = mapLocation => {\r\n\t\tsetMapInteracted(true);\r\n\t\tselectLocationEntity(mapLocation);\r\n\t};\r\n\r\n\tconst onLoad = map => {\r\n\t\tif (!location || location === null) {\r\n\t\t\tmapRef.current = map;\r\n\t\t\tfitBounds(map, true);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tmapRef.current = map;\r\n\r\n\t\tif (mapInteracted === false) {\r\n\t\t\tmapRef.current.panTo(\r\n\t\t\t\tnew google.maps.LatLng(location.latitude, location.longitude)\r\n\t\t\t);\r\n\r\n\t\t\tmapRef.current.setZoom(zoom);\r\n\t\t}\r\n\t};\r\n\r\n\tconst pinIconUrl = pinIcon({\r\n\t\tfillColor: markerConfigs.fillColor,\r\n\t\tstrokeColor: markerConfigs.strokeColor\r\n\t});\r\n\r\n\tconst onClusterClick = cluster => {\r\n\t\tif(!siteConfig.optionalShowLocationClusterConfig || (mapRef.current.zoom > siteConfig.optionalShowLocationClusterConfig.showForZoomLevelLessThan)) {\r\n\t\t\tconsole.log(\"should return\");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!cluster || typeof cluster.getMarkers !== 'function') {\r\n\t\t console.error('Cluster object or getMarkers method not available.');\r\n\t\t return;\r\n\t\t}\r\n\r\n\t\tconst markers = cluster.getMarkers();\r\n\r\n\t\tif (!markers || markers.length === 0) {\r\n\t\t console.error('No markers found in the cluster.');\r\n\t\t return;\r\n\t\t}\r\n\r\n\t\tsetTimeout(() => {\r\n\t\t const bounds = new window.google.maps.LatLngBounds();\r\n\r\n\t\t markers.forEach(marker => {\r\n\t\t\t\tbounds.extend(marker.getPosition());\r\n\t\t });\r\n\r\n\t\t bounds.extend(new google.maps.LatLng(siteConfig.optionalShowLocationClusterConfig.latitude, siteConfig.optionalShowLocationClusterConfig.longitude));\r\n\r\n\t\t if (mapRef.current) {\r\n\t\t\t\tmapRef.current.fitBounds(bounds);\r\n\t\t }\r\n\t\t}, 500);\r\n\t };\r\n\r\n\treturn (\r\n\t\t<Map\r\n\t\t\tzoom={zoom}\r\n\t\t\tcenter={center}\r\n\t\t\tmapContainerRef={mapContainerRef}\r\n\t\t\tonLoad={onLoad}\r\n\t\t\tonIdle={onIdle}\r\n\t\t\tmapInteracted={mapInteracted}\r\n\t\t\tpinIconUrl={pinIconUrl}\r\n\t\t\tsetMapInteracted={setMapInteracted}\r\n\t\t\tfitBounds={fitBounds}\r\n\t\t\tmapRef={mapRef}\r\n\t\t\tsetQuery={setQuery}\r\n\t\t\tfilteredListingsLength={filteredListings.length}\r\n\t\t\tsetSelectedFilters={setSelectedFilters}\r\n\t\t>\r\n\t\t\t<MarkerClustererF options={clusterOptions(clusterGridSize, markerConfigs.fillColor)} onClick={onClusterClick}>\r\n\t\t\t\t{clusterer => (\r\n\t\t\t\t\t<>\r\n\t\t\t\t\t\t{mapItems.map(item => (\r\n\t\t\t\t\t\t\t<MapMarker\r\n\t\t\t\t\t\t\t\tkey={item.id}\r\n\t\t\t\t\t\t\t\titem={item}\r\n\t\t\t\t\t\t\t\tselectedLocation={location}\r\n\t\t\t\t\t\t\t\tmarkerRefs={markerRefs}\r\n\t\t\t\t\t\t\t\tinfoWindowClasses={infoWindowClasses}\r\n\t\t\t\t\t\t\t\tsetSelectedLocation={setLocation}\r\n\t\t\t\t\t\t\t\tmarkerClickHandler={markerClickHandler}\r\n\t\t\t\t\t\t\t\tclusterer={clusterer}\r\n\t\t\t\t\t\t\t\tmarkerIcon={markerIcon(markerConfigs)}\r\n\t\t\t\t\t\t\t\tmarkerIconSelected={markerIconSelected(markerConfigs)}\r\n\t\t\t\t\t\t\t\tsetMapInteracted={setMapInteracted}\r\n\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t))}\r\n\t\t\t\t\t\t{poiMarkers && poiMarkers.markers.map((marker, index) => (\r\n\t\t\t\t\t\t\t<PlaceMarker\r\n\t\t\t\t\t\t\t\tkey={`marker-${marker.title}-${index}`}\r\n\t\t\t\t\t\t\t\tmarker={marker}\r\n\t\t\t\t\t\t\t\tindex={index}\r\n\t\t\t\t\t\t\t\tselectedPlaceMarker={selectedPlaceMarker}\r\n\t\t\t\t\t\t\t\tplacesWindow={placesWindow}\r\n\t\t\t\t\t\t\t\tsetPlacesWindow={setPlacesWindow}\r\n\t\t\t\t\t\t\t\tsetSelectedPlaceMarker={setSelectedPlaceMarker}\r\n\t\t\t\t\t\t\t />\r\n\t\t\t\t\t\t))}\r\n\t\t\t\t\t</>\r\n\t\t\t\t)}\r\n\t\t\t</MarkerClustererF>\r\n\t\t</Map>\r\n\t);\r\n};\r\n\r\nexport default MapContainer;\r\n"],"names":["MapContainer","_ref","markerConfigs","infoWindowClasses","_ref$clusterGridSize","clusterGridSize","_useMap","useMap","location","zoom","center","selectLocationEntity","setLocation","mapInteracted","setMapInteracted","_useMapList","useMapList","mapItems","filteredListings","setSelectedFilters","setQuery","siteConfig","mapRef","useRef","markerRefs","mapContainerRef","_usePlaces","usePlaces","poiMarkers","setCurrentCenter","currentCenter","setCurrentZoom","currentZoom","selectedPlaceMarker","setSelectedPlaceMarker","placesWindow","setPlacesWindow","onIdle","current","newCenter","getCenter","toJSON","newZoom","useEffect","handleScroll","mapContainerRefCurrent","addEventListener","removeEventListener","mapInstance","dragStartListener","addListener","mouseDownListener","google","maps","event","removeListener","length","fitBounds","currZoom","setZoomVal","setZoom","panTo","LatLng","latitude","longitude","map","overload","arguments","undefined","bounds","window","LatLngBounds","forEach","item","extend","markerClickHandler","mapLocation","onLoad","pinIconUrl","pinIcon","fillColor","strokeColor","onClusterClick","cluster","optionalShowLocationClusterConfig","showForZoomLevelLessThan","console","log","getMarkers","error","markers","setTimeout","marker","getPosition","React","createElement","Map","filteredListingsLength","MarkerClustererF","options","clusterOptions","onClick","clusterer","Fragment","MapMarker","key","id","selectedLocation","setSelectedLocation","markerIcon","markerIconSelected","index","PlaceMarker","concat","title"],"mappings":";;;;;;;;;;;AAeA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA,EAIZ;AAAA,EAAA,IAHLC,aAAa,GAAAD,IAAA,CAAbC,aAAa;IACbC,iBAAiB,GAAAF,IAAA,CAAjBE,iBAAiB;IAAAC,oBAAA,GAAAH,IAAA,CACjBI,eAAe;AAAfA,IAAAA,eAAe,GAAAD,oBAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,oBAAA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AAAC,aAAA,CAACS,kBAAS,EAAA;QACTC,GAAG,EAAEhC,IAAI,CAACiC,EAAG;AACbjC,QAAAA,IAAI,EAAEA,IAAK;AACXkC,QAAAA,gBAAgB,EAAEnG,QAAS;AAC3BgB,QAAAA,UAAU,EAAEA,UAAW;AACvBrB,QAAAA,iBAAiB,EAAEA,iBAAkB;AACrCyG,QAAAA,mBAAmB,EAAEhG,WAAY;AACjC+D,QAAAA,kBAAkB,EAAEA,kBAAmB;AACvC2B,QAAAA,SAAS,EAAEA,SAAU;AACrBO,QAAAA,UAAU,EAAEA,UAAU,CAAC3G,aAAa,CAAE;AACtC4G,QAAAA,kBAAkB,EAAEA,kBAAkB,CAAC5G,aAAa,CAAE;AACtDY,QAAAA,gBAAgB,EAAEA,gBAAAA;AAAiB,OACnC,CAAC,CAAA;AAAA,KACF,CAAC,EACDc,UAAU,IAAIA,UAAU,CAAC8D,OAAO,CAACzB,GAAG,CAAC,UAAC2B,MAAM,EAAEmB,KAAK,EAAA;AAAA,MAAA,oBACnDjB,cAAA,CAAAC,aAAA,CAACiB,WAAW,EAAA;QACXP,GAAG,EAAA,SAAA,CAAAQ,MAAA,CAAYrB,MAAM,CAACsB,KAAK,EAAAD,GAAAA,CAAAA,CAAAA,MAAA,CAAIF,KAAK,CAAG;AACvCnB,QAAAA,MAAM,EAAEA,MAAO;AACfmB,QAAAA,KAAK,EAAEA,KAAM;AACb9E,QAAAA,mBAAmB,EAAEA,mBAAoB;AACzCE,QAAAA,YAAY,EAAEA,YAAa;AAC3BC,QAAAA,eAAe,EAAEA,eAAgB;AACjCF,QAAAA,sBAAsB,EAAEA,sBAAAA;AAAuB,OAC7C,CAAC,CAAA;AAAA,KACJ,CACA,CAAC,CAAA;AAAA,GAEa,CACd,CAAC,CAAA;AAER;;;;"}
|
|
1
|
+
{"version":3,"file":"map-container.js","sources":["../../../../src/components/containers/maps/map-container.js"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\r\n\r\nimport MapMarker from \"~/components/containers/maps/map-marker-container\";\r\nimport PlaceMarker from \"~/components/modules/maps/place-marker\";\r\n\r\nimport { usePlaces } from \"~/contexts/placesContext\";\r\nimport { useMap } from \"~/contexts/mapContext\";\r\nimport { useMapList } from \"~/contexts/mapListContext\";\r\n\r\nimport { markerIconSelected, markerIcon, pinIcon } from \"~/util/mapIconUtil\";\r\n\r\nimport Map from \"~/components/modules/maps/map\";\r\nimport { MarkerClustererF } from \"@react-google-maps/api\";\r\nimport { clusterOptions } from \"~/util/mapUtil\";\r\n\r\nconst MapContainer = ({\r\n\tmarkerConfigs,\r\n\tinfoWindowClasses,\r\n\tclusterGridSize = 60\r\n}) => {\r\n\tconst {\r\n\t\tlocation,\r\n\t\tzoom,\r\n\t\tcenter,\r\n\t\tselectLocationEntity,\r\n\t\tsetLocation,\r\n\t\tmapInteracted,\r\n\t\tsetMapInteracted\r\n\t} = useMap();\r\n\r\n\tconst {\r\n\t\tmapItems, filteredListings, setSelectedFilters,\r\n\t\tsetQuery,\r\n\t\tsiteConfig\r\n\t} = useMapList();\r\n\r\n\tconst mapRef = useRef();\r\n\tconst markerRefs = useRef({});\r\n\tconst mapContainerRef = useRef(null);\r\n\tconst {\r\n\t\tpoiMarkers,\r\n\t\tsetCurrentCenter,\r\n\t\tcurrentCenter,\r\n\t\tsetCurrentZoom,\r\n\t\tcurrentZoom,\r\n\t\tselectedPlaceMarker,\r\n\t\tsetSelectedPlaceMarker,\r\n\t\tplacesWindow,\r\n\t\tsetPlacesWindow } = usePlaces();\r\n\r\n\tconst onIdle = () => {\r\n\t\tif (!currentCenter || !mapRef.current) return;\r\n\t\tconst newCenter = mapRef.current.getCenter().toJSON();\r\n\t\tconst newZoom = mapRef.current.zoom;\r\n\r\n\t\tsetCurrentCenter(newCenter);\r\n\r\n\t\tif (newZoom !== currentZoom) {\r\n\t\t\tsetCurrentZoom(newZoom);\r\n\t\t}\r\n\t};\r\n\r\n\tuseEffect(() => {\r\n\t\tif (mapContainerRef.current) {\r\n\t\t\tconst handleScroll = () => {\r\n\t\t\t\tsetMapInteracted(true);\r\n\t\t\t};\r\n\t\t\tvar mapContainerRefCurrent = mapContainerRef.current;\r\n\t\t\tmapContainerRef.current.addEventListener('wheel', handleScroll);\r\n\t\t\treturn () => mapContainerRefCurrent.removeEventListener('wheel', handleScroll);\r\n\t\t}\r\n\t}, [mapContainerRef.current]);\r\n\r\n\tuseEffect(() => {\r\n\t\tif (mapRef.current) {\r\n\t\t\tconst mapInstance = mapRef.current;\r\n\t\t\tconst dragStartListener = mapInstance.addListener('dragstart', () => setMapInteracted(true));\r\n\t\t\tconst mouseDownListener = mapInstance.addListener('mousedown', () => setMapInteracted(true));\r\n\t\t\treturn () => {\r\n\t\t\t\tgoogle.maps.event.removeListener(dragStartListener);\r\n\t\t\t\tgoogle.maps.event.removeListener(mouseDownListener);\r\n\t\t\t};\r\n\t\t}\r\n\t}, [mapRef.current, mapContainerRef.current]);\r\n\r\n\tuseEffect(() => {\r\n\t\tif ((mapItems && mapItems.length > 0 || poiMarkers.length > 0) && mapRef.current) {\r\n\t\t\tfitBounds(mapRef.current);\r\n\t\t}\r\n\t}, [mapItems, mapRef.current, location]);\r\n\r\n\tuseEffect(() => {\r\n\t\tif ((mapItems && mapItems.length > 0 || poiMarkers.length > 0) && mapRef.current && mapInteracted) {\r\n\t\t\tfitBounds(mapRef.current, true);\r\n\t\t}\r\n\t\tif (mapRef.current) {\r\n\t\t\tlet currZoom = mapRef.current.zoom;\r\n\t\t\tlet setZoomVal = currZoom < 13 ? currZoom : 12;\r\n\t\t\tmapRef.current.setZoom(setZoomVal);\r\n\t\t}\r\n\t}, [filteredListings]);\r\n\r\n\tuseEffect(() => {\r\n\t\tif (!mapRef.current || !location || mapInteracted) return;\r\n\t\tmapRef.current.panTo(\r\n\t\t\tnew google.maps.LatLng(location.latitude, location.longitude)\r\n\t\t);\r\n\t\tif (mapRef.current) {\r\n\t\t\tlet setZoomVal = zoom < 13 ? zoom : 12;\r\n\t\t\tmapRef.current.setZoom(setZoomVal);\r\n\t\t}\r\n\t}, [location, zoom, mapRef.current]);\r\n\r\n\tconst fitBounds = (map, overload = false) => {\r\n\t\tif ((mapInteracted === false || overload) && mapItems != null) {\r\n\t\t const bounds = new window.google.maps.LatLngBounds();\r\n\t\t mapItems.forEach(item => {\r\n\t\t\t\tbounds.extend(new google.maps.LatLng(item.latitude, item.longitude));\r\n\t\t });\r\n\t\t if(siteConfig.optionalShowLocationClusterConfig){\r\n\t\t\t\tlet configLocation = new google.maps.LatLng(siteConfig.optionalShowLocationClusterConfig.latitude, siteConfig.optionalShowLocationClusterConfig.longitude);\r\n\t\t\t\tmap.panTo(configLocation);\r\n\t\t\t\tbounds.extend(new google.maps.LatLng(siteConfig.optionalShowLocationClusterConfig.latitude, siteConfig.optionalShowLocationClusterConfig.longitude));\r\n\t\t }\r\n\t\t if (!map) return;\r\n\t\t const currentCenter = map.getCenter();\r\n\t\t map.fitBounds(bounds);\r\n\t\t const newCenter = bounds.getCenter();\r\n\t\t if (currentCenter && newCenter) {\r\n\t\t\t\tmap.panTo(newCenter);\r\n\t\t }\r\n\t\t}\r\n\t\tif (mapRef.current.zoom > 17) {\r\n\t\t mapRef.current.setZoom(16);\r\n\t\t}\r\n\t };\r\n\r\n\tconst markerClickHandler = mapLocation => {\r\n\t\tsetMapInteracted(true);\r\n\t\tselectLocationEntity(mapLocation);\r\n\t};\r\n\r\n\tconst onLoad = map => {\r\n\t\tif (!location || location === null) {\r\n\t\t\tmapRef.current = map;\r\n\t\t\tfitBounds(map, true);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tmapRef.current = map;\r\n\r\n\t\tif (mapInteracted === false) {\r\n\t\t\tmapRef.current.panTo(\r\n\t\t\t\tnew google.maps.LatLng(location.latitude, location.longitude)\r\n\t\t\t);\r\n\r\n\t\t\tmapRef.current.setZoom(zoom);\r\n\t\t}\r\n\t};\r\n\r\n\tconst pinIconUrl = pinIcon({\r\n\t\tfillColor: markerConfigs.fillColor,\r\n\t\tstrokeColor: markerConfigs.strokeColor\r\n\t});\r\n\r\n\tconst onClusterClick = cluster => {\r\n\t\tif(!siteConfig.optionalShowLocationClusterConfig || (mapRef.current.zoom > siteConfig.optionalShowLocationClusterConfig.showForZoomLevelLessThan)) {\r\n\t\t\tconsole.log(\"should return\");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (!cluster || typeof cluster.getMarkers !== 'function') {\r\n\t\t console.error('Cluster object or getMarkers method not available.');\r\n\t\t return;\r\n\t\t}\r\n\r\n\t\tconst markers = cluster.getMarkers();\r\n\r\n\t\tif (!markers || markers.length === 0) {\r\n\t\t console.error('No markers found in the cluster.');\r\n\t\t return;\r\n\t\t}\r\n\r\n\t\tsetTimeout(() => {\r\n\t\t const bounds = new window.google.maps.LatLngBounds();\r\n\r\n\t\t markers.forEach(marker => {\r\n\t\t\t\tbounds.extend(marker.getPosition());\r\n\t\t });\r\n\r\n\t\t bounds.extend(new google.maps.LatLng(siteConfig.optionalShowLocationClusterConfig.latitude, siteConfig.optionalShowLocationClusterConfig.longitude));\r\n\r\n\t\t if (mapRef.current) {\r\n\t\t\t\tmapRef.current.fitBounds(bounds);\r\n\t\t }\r\n\t\t}, 500);\r\n\t };\r\n\r\n\treturn (\r\n\t\t<Map\r\n\t\t\tzoom={zoom}\r\n\t\t\tcenter={center}\r\n\t\t\tmapContainerRef={mapContainerRef}\r\n\t\t\tonLoad={onLoad}\r\n\t\t\tonIdle={onIdle}\r\n\t\t\tmapInteracted={mapInteracted}\r\n\t\t\tpinIconUrl={pinIconUrl}\r\n\t\t\tsetMapInteracted={setMapInteracted}\r\n\t\t\tfitBounds={fitBounds}\r\n\t\t\tmapRef={mapRef}\r\n\t\t\tsetQuery={setQuery}\r\n\t\t\tfilteredListingsLength={filteredListings.length}\r\n\t\t\tsetSelectedFilters={setSelectedFilters}\r\n\t\t>\r\n\t\t\t<MarkerClustererF options={clusterOptions(clusterGridSize, markerConfigs.fillColor)} onClick={onClusterClick}>\r\n\t\t\t\t{clusterer => (\r\n\t\t\t\t\t<>\r\n\t\t\t\t\t\t{mapItems.map(item => (\r\n\t\t\t\t\t\t\t<MapMarker\r\n\t\t\t\t\t\t\t\tkey={item.id}\r\n\t\t\t\t\t\t\t\titem={item}\r\n\t\t\t\t\t\t\t\tselectedLocation={location}\r\n\t\t\t\t\t\t\t\tmarkerRefs={markerRefs}\r\n\t\t\t\t\t\t\t\tinfoWindowClasses={infoWindowClasses}\r\n\t\t\t\t\t\t\t\tsetSelectedLocation={setLocation}\r\n\t\t\t\t\t\t\t\tmarkerClickHandler={markerClickHandler}\r\n\t\t\t\t\t\t\t\tclusterer={clusterer}\r\n\t\t\t\t\t\t\t\tmarkerIcon={markerIcon(markerConfigs)}\r\n\t\t\t\t\t\t\t\tmarkerIconSelected={markerIconSelected(markerConfigs)}\r\n\t\t\t\t\t\t\t\tsetMapInteracted={setMapInteracted}\r\n\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t))}\r\n\t\t\t\t\t\t{poiMarkers && poiMarkers.markers.map((marker, index) => (\r\n\t\t\t\t\t\t\t<PlaceMarker\r\n\t\t\t\t\t\t\t\tkey={`marker-${marker.title}-${index}`}\r\n\t\t\t\t\t\t\t\tmarker={marker}\r\n\t\t\t\t\t\t\t\tindex={index}\r\n\t\t\t\t\t\t\t\tselectedPlaceMarker={selectedPlaceMarker}\r\n\t\t\t\t\t\t\t\tplacesWindow={placesWindow}\r\n\t\t\t\t\t\t\t\tsetPlacesWindow={setPlacesWindow}\r\n\t\t\t\t\t\t\t\tsetSelectedPlaceMarker={setSelectedPlaceMarker}\r\n\t\t\t\t\t\t\t />\r\n\t\t\t\t\t\t))}\r\n\t\t\t\t\t</>\r\n\t\t\t\t)}\r\n\t\t\t</MarkerClustererF>\r\n\t\t</Map>\r\n\t);\r\n};\r\n\r\nexport default MapContainer;\r\n"],"names":["MapContainer","_ref","markerConfigs","infoWindowClasses","_ref$clusterGridSize","clusterGridSize","_useMap","useMap","location","zoom","center","selectLocationEntity","setLocation","mapInteracted","setMapInteracted","_useMapList","useMapList","mapItems","filteredListings","setSelectedFilters","setQuery","siteConfig","mapRef","useRef","markerRefs","mapContainerRef","_usePlaces","usePlaces","poiMarkers","setCurrentCenter","currentCenter","setCurrentZoom","currentZoom","selectedPlaceMarker","setSelectedPlaceMarker","placesWindow","setPlacesWindow","onIdle","current","newCenter","getCenter","toJSON","newZoom","useEffect","handleScroll","mapContainerRefCurrent","addEventListener","removeEventListener","mapInstance","dragStartListener","addListener","mouseDownListener","google","maps","event","removeListener","length","fitBounds","currZoom","setZoomVal","setZoom","panTo","LatLng","latitude","longitude","map","overload","arguments","undefined","bounds","window","LatLngBounds","forEach","item","extend","optionalShowLocationClusterConfig","configLocation","markerClickHandler","mapLocation","onLoad","pinIconUrl","pinIcon","fillColor","strokeColor","onClusterClick","cluster","showForZoomLevelLessThan","console","log","getMarkers","error","markers","setTimeout","marker","getPosition","React","createElement","Map","filteredListingsLength","MarkerClustererF","options","clusterOptions","onClick","clusterer","Fragment","MapMarker","key","id","selectedLocation","setSelectedLocation","markerIcon","markerIconSelected","index","PlaceMarker","concat","title"],"mappings":";;;;;;;;;;;AAeA,IAAMA,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA,EAIZ;AAAA,EAAA,IAHLC,aAAa,GAAAD,IAAA,CAAbC,aAAa;IACbC,iBAAiB,GAAAF,IAAA,CAAjBE,iBAAiB;IAAAC,oBAAA,GAAAH,IAAA,CACjBI,eAAe;AAAfA,IAAAA,eAAe,GAAAD,oBAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,oBAAA,CAAA;AAEpB,EAAA,IAAAE,OAAA,GAQIC,MAAM,EAAE;IAPXC,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,CA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A,KACJ,CACA,CAAC,CAAA;AAAA,GAEa,CACd,CAAC,CAAA;AAER;;;;"}
|
|
@@ -1,19 +1,40 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
|
|
3
3
|
var InfoWindowContent = function InfoWindowContent(_ref) {
|
|
4
|
-
var _items$0$mapDetails, _items$0$mapDetails2, _items$0$mapDetails3;
|
|
5
4
|
var items = _ref.items,
|
|
6
5
|
fullAddress = _ref.fullAddress,
|
|
7
|
-
applyFilters = _ref.applyFilters
|
|
6
|
+
applyFilters = _ref.applyFilters,
|
|
7
|
+
mapInfoWindowConfig = _ref.mapInfoWindowConfig;
|
|
8
8
|
if (!items || items.length < 0) {
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
11
|
-
var
|
|
11
|
+
var mapDetails = items[0].mapDetails;
|
|
12
|
+
var entityDisplayName = mapDetails === null || mapDetails === void 0 ? void 0 : mapDetails.entityDisplayName;
|
|
13
|
+
var address = mapDetails === null || mapDetails === void 0 ? void 0 : mapDetails.address;
|
|
14
|
+
var displayHeader = entityDisplayName;
|
|
15
|
+
var displayAddress = fullAddress;
|
|
16
|
+
if (mapInfoWindowConfig) {
|
|
17
|
+
if (mapInfoWindowConfig.entityHeaderField && mapDetails[mapInfoWindowConfig.entityHeaderField]) {
|
|
18
|
+
displayHeader = mapDetails[mapInfoWindowConfig.entityHeaderField];
|
|
19
|
+
}
|
|
20
|
+
if (mapInfoWindowConfig.showEntityAddressFields) {
|
|
21
|
+
var addressFields = mapInfoWindowConfig.showEntityAddressFields.map(function (field) {
|
|
22
|
+
return address[field];
|
|
23
|
+
}).filter(Boolean).join(', ');
|
|
24
|
+
displayAddress = addressFields;
|
|
25
|
+
}
|
|
26
|
+
} else {
|
|
27
|
+
if (!entityDisplayName.includes(address === null || address === void 0 ? void 0 : address.street) && !entityDisplayName.includes(address === null || address === void 0 ? void 0 : address.zip)) {
|
|
28
|
+
displayAddress = fullAddress;
|
|
29
|
+
} else {
|
|
30
|
+
displayAddress = '';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
12
33
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
13
34
|
className: "hc-flex-auto hc-p-2"
|
|
14
35
|
}, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("h4", {
|
|
15
36
|
className: "hc-text-lg hc-font-bold hc-leading-tight hc-mb-3"
|
|
16
|
-
},
|
|
37
|
+
}, displayHeader), /*#__PURE__*/React__default.createElement("p", null, displayAddress), /*#__PURE__*/React__default.createElement("div", {
|
|
17
38
|
className: "hc-pt-2"
|
|
18
39
|
}, /*#__PURE__*/React__default.createElement("button", {
|
|
19
40
|
className: "hc-cursor-pointer hover:hc-opacity-70 hc-text-primary",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"info-window-content.js","sources":["../../../../src/components/modules/maps/info-window-content.js"],"sourcesContent":["import React from 'react';\
|
|
1
|
+
{"version":3,"file":"info-window-content.js","sources":["../../../../src/components/modules/maps/info-window-content.js"],"sourcesContent":["import React from 'react';\n\nconst InfoWindowContent = ({\n\titems,\n\tfullAddress,\n\tapplyFilters,\n\tmapInfoWindowConfig\n}) => {\n\tif (!items || items.length < 0) {\n\t\treturn null;\n\t}\n\n\tlet mapDetails = items[0].mapDetails;\n\tlet entityDisplayName = mapDetails?.entityDisplayName;\n\tlet address = mapDetails?.address;\n\n\tlet displayHeader = entityDisplayName;\n\tlet displayAddress = fullAddress;\n\n\tif (mapInfoWindowConfig) {\n\t\tif (mapInfoWindowConfig.entityHeaderField && mapDetails[mapInfoWindowConfig.entityHeaderField]) {\n\t\t\tdisplayHeader = mapDetails[mapInfoWindowConfig.entityHeaderField];\n\t\t}\n\n\t\tif (mapInfoWindowConfig.showEntityAddressFields) {\n\t\t\tconst addressFields = mapInfoWindowConfig.showEntityAddressFields\n\t\t\t\t.map(field => address[field])\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(', ');\n\t\t\tdisplayAddress = addressFields;\n\t\t}\n\t} else {\n\t\tif (!entityDisplayName.includes(address?.street) && !entityDisplayName.includes(address?.zip)) {\n\t\t\tdisplayAddress = fullAddress;\n\t\t} else {\n\t\t\tdisplayAddress = '';\n\t\t}\n\t}\n\n\treturn (\n\t\t<div className=\"hc-flex-auto hc-p-2\">\n\t\t\t<div>\n\t\t\t\t<div>\n\t\t\t\t\t<h4 className=\"hc-text-lg hc-font-bold hc-leading-tight hc-mb-3\">\n\t\t\t\t\t\t{displayHeader}\n\t\t\t\t\t</h4>\n\t\t\t\t\t<p>{displayAddress}</p>\n\t\t\t\t\t<div className=\"hc-pt-2\">\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\tclassName=\"hc-cursor-pointer hover:hc-opacity-70 hc-text-primary\"\n\t\t\t\t\t\t\tonClick={applyFilters}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{items.length > 1\n\t\t\t\t\t\t\t\t? `View All ${items.length} jobs at this location`\n\t\t\t\t\t\t\t\t: `View job at this location`}\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default InfoWindowContent;\n"],"names":["InfoWindowContent","_ref","items","fullAddress","applyFilters","mapInfoWindowConfig","length","mapDetails","entityDisplayName","address","displayHeader","displayAddress","entityHeaderField","showEntityAddressFields","addressFields","map","field","filter","Boolean","join","includes","street","zip","React","createElement","className","onClick","concat"],"mappings":";;AAEA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,IAAA,EAKjB;AAAA,EAAA,IAJLC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,WAAW,GAAAF,IAAA,CAAXE,WAAW;IACXC,YAAY,GAAAH,IAAA,CAAZG,YAAY;IACZC,mBAAmB,GAAAJ,IAAA,CAAnBI,mBAAmB,CAAA;EAEnB,IAAI,CAACH,KAAK,IAAIA,KAAK,CAACI,MAAM,GAAG,CAAC,EAAE;AAC/B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AAA,GAAA,KAAA,CAAA,GAAPA,OAAO,CAAEa,GAAG,CAAC,EAAE;AAC9FX,MAAAA,cAAc,GAAGR,WAAW,CAAA;AAC7B,KAAC,MAAM;AACNQ,MAAAA,cAAc,GAAG,EAAE,CAAA;AACpB,KAAA;AACD,GAAA;EAEA,oBACCY,cAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,SAAS,EAAC,qBAAA;GACdF,eAAAA,cAAA,CAAAC,aAAA,CACCD,KAAAA,EAAAA,IAAAA,eAAAA,cAAA,CAAAC,aAAA,CAAA,KAAA,EAAA,IAAA,eACCD,cAAA,CAAAC,aAAA,CAAA,IAAA,EAAA;AAAIC,IAAAA,SAAS,EAAC,kDAAA;AAAkD,GAAA,EAC9Df,aACE,CAAC,eACLa,cAAA,CAAAC,aAAA,CAAIb,GAAAA,EAAAA,IAAAA,EAAAA,cAAkB,CAAC,eACvBY,cAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,SAAS,EAAC,SAAA;GACdF,eAAAA,cAAA,CAAAC,aAAA,CAAA,QAAA,EAAA;AACCC,IAAAA,SAAS,EAAC,uDAAuD;AACjEC,IAAAA,OAAO,EAAEtB,YAAAA;AAAa,GAAA,EAErBF,KAAK,CAACI,MAAM,GAAG,CAAC,eAAAqB,MAAA,CACFzB,KAAK,CAACI,MAAM,EAEpB,wBAAA,CAAA,GAAA,2BAAA,CACJ,CACD,CACD,CACD,CAAC,CAAA;AAER;;;;"}
|
|
@@ -25,18 +25,18 @@ const MapListProvider = ({ children, siteConfig, resetFilters, navigateToDetails
|
|
|
25
25
|
let urlFilters = filtersFromURL(window.location)?.filters;
|
|
26
26
|
return (setFiltersUrl === true && urlFilters && Object.keys(urlFilters).length > 0) ? urlFilters : getStorageObject('selectedFilters', {}) || {};
|
|
27
27
|
};
|
|
28
|
-
const [allListings, setAllListings] = useState(
|
|
28
|
+
const [allListings, setAllListings] = useState([]);
|
|
29
29
|
const [filteredListings, setFilteredListings] = useState([]);
|
|
30
30
|
const [loading, setLoading] = useState(false);
|
|
31
31
|
const [mapItems, setMapItems] = useState(getStorageObject('mapItems', []) || []);
|
|
32
32
|
const [query, setQuery] = useState(() => resetFilters ? null : getQuery());
|
|
33
33
|
const [sortSetting, setSortSetting] = useState(getStorageObject('sortSetting', { field: 'position', type: 'asc' }) || { field: 'position', type: 'asc' });
|
|
34
|
-
const [listingEntities, setListingEntities] = useState(
|
|
34
|
+
const [listingEntities, setListingEntities] = useState({});
|
|
35
35
|
const [firstLoad, setFirstLoad] = useState(true);
|
|
36
36
|
const [commuteLocation, setCommuteLocation] = useState(getStorageObject('commuteLocation'));
|
|
37
37
|
const [selectedFilters, setSelectedFilters] = useState(() => resetFilters ? {} : firstLoadFilters());
|
|
38
38
|
const [filterOptions, setFilterOptions] = useState();
|
|
39
|
-
const [recruiters, setRecruiters] = useState(
|
|
39
|
+
const [recruiters, setRecruiters] = useState({});
|
|
40
40
|
const [filterDialogIsOpen, setFilterDialogIsOpen] = useState(false);
|
|
41
41
|
const [mobileTab, setMobileTab] = useState("listTab");
|
|
42
42
|
const [favorites, setFavorites] = useState([]);
|
|
@@ -99,10 +99,6 @@ const MapListProvider = ({ children, siteConfig, resetFilters, navigateToDetails
|
|
|
99
99
|
setRecruiters(fetchedRecruiters);
|
|
100
100
|
setListingEntities(fetchedEntities);
|
|
101
101
|
setMapItems(distinctItems);
|
|
102
|
-
setStorageObject("mapItems", distinctItems);
|
|
103
|
-
setStorageObject("listingEntities", fetchedEntities);
|
|
104
|
-
setStorageObject("recruiters", fetchedRecruiters);
|
|
105
|
-
setStorageObject("listings", listingsResult);
|
|
106
102
|
}
|
|
107
103
|
catch (error) {
|
|
108
104
|
console.log(error);
|
|
@@ -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 sortSetting: { field: string; type: string };\n setSortSetting: (setting: { field: string; type: string }) => void;\n trackEvent: (event: string) => void;\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 trackEvent: (event: string) => void;\n listings?: Listing[];\n setFiltersUrl?:boolean;\n handleUrlUpdate: (searchParams: string) => void;\n}\n\nexport const MapListProvider: React.FC<MapListProviderProps> = ({\n\tchildren,\n\tsiteConfig,\n\tresetFilters,\n\tnavigateToDetails,\n\tnavigateToEasyApply,\n\tLink,\n\tlinkFormat,\n\ttrackEvent,\n\tlistings = [],\n\tsetFiltersUrl,\n\thandleUrlUpdate,\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('selectedFilters', {}) || {}\n\t}\n\tconst [allListings, setAllListings] = useState<Listing[]>(getStorageObject(\"listings\", listings) || []);\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>(getStorageObject(\"listingEntities\", 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>>(getStorageObject(\"recruiters\", {}) || {});\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\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\tfetchedRecruiters,\n\t\t\t\t\tfetchedEntities,\n\t\t\t\t\tdistinctItems\n\t\t\t\t} = await fetchListings(query ?? '', siteConfig, commuteLocation);\n\t\t\t\tsetAllListings(listingsResult);\n\t\t\t\tsetRecruiters(fetchedRecruiters);\n\t\t\t\tsetListingEntities(fetchedEntities);\n\t\t\t\tsetMapItems(distinctItems);\n\t\t\t\tsetStorageObject(\"mapItems\", distinctItems);\n\t\t\t\tsetStorageObject(\"listingEntities\", fetchedEntities);\n\t\t\t\tsetStorageObject(\"recruiters\", fetchedRecruiters);\n\t\t\t\tsetStorageObject(\"listings\", listingsResult);\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]);\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('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\tfirstLoad ? allListings : filteredListings,\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);\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\tsortSetting,\n\t\t\tsetSortSetting,\n\t\t\ttrackEvent\n\t\t}}>\n\t\t\t{children}\n\t\t</MapListContext.Provider>\n\t);\n};\n"],"names":["React"],"mappings":";;;;;;;AAiDA,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;IACp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ACH;;;;"}
|
|
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 sortSetting: { field: string; type: string };\n setSortSetting: (setting: { field: string; type: string }) => void;\n trackEvent: (event: string) => void;\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 trackEvent: (event: string) => void;\n listings?: Listing[];\n setFiltersUrl?:boolean;\n handleUrlUpdate: (searchParams: string) => void;\n}\n\nexport const MapListProvider: React.FC<MapListProviderProps> = ({\n\tchildren,\n\tsiteConfig,\n\tresetFilters,\n\tnavigateToDetails,\n\tnavigateToEasyApply,\n\tLink,\n\tlinkFormat,\n\ttrackEvent,\n\tlistings = [],\n\tsetFiltersUrl,\n\thandleUrlUpdate,\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('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\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\tfetchedRecruiters,\n\t\t\t\t\tfetchedEntities,\n\t\t\t\t\tdistinctItems\n\t\t\t\t} = await fetchListings(query ?? '', siteConfig, commuteLocation);\n\t\t\t\tsetAllListings(listingsResult);\n\t\t\t\tsetRecruiters(fetchedRecruiters);\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]);\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('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\tfirstLoad ? allListings : filteredListings,\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);\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\tsortSetting,\n\t\t\tsetSortSetting,\n\t\t\ttrackEvent\n\t\t}}>\n\t\t\t{children}\n\t\t</MapListContext.Provider>\n\t);\n};\n"],"names":["React"],"mappings":";;;;;;;AAiDA,MAAM,cAAc,GAAG,aAAa,CAAkC,SAAS,CAAC,CAAC;AAE1E,MAAM,UAAU,GAAG,MAAK;AAC9B,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAC3C,IAAI,CAAC,OAAO,EAAE;AACb,QAAA,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;AACpE,KAAA;AACD,IAAA,OAAO,OAAO,CAAC;AAChB,EAAE;AAEF,MAAM,QAAQ,GAAG,MAAoB;IACpC,IAAI,KAAK,GAAkB,IAAI,CAAC;AAChC,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW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AI,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,WAAW;YACX,cAAc;YACd,UAAU;SACV,EACC,EAAA,QAAQ,CACgB,EACzB;AACH;;;;"}
|
package/package.json
CHANGED
|
@@ -47,7 +47,7 @@ const InfoWindowContentContainer = ({
|
|
|
47
47
|
setSelectedFilters(newFilters);
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
return <InfoWindowContent items={items} fullAddress={fullAddress} applyFilters={applyFilters} />;
|
|
50
|
+
return <InfoWindowContent items={items} fullAddress={fullAddress} applyFilters={applyFilters} mapInfoWindowConfig={siteConfig.mapInfoWindowConfig}/>;
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
export default InfoWindowContentContainer;
|
|
@@ -117,7 +117,11 @@ const MapContainer = ({
|
|
|
117
117
|
mapItems.forEach(item => {
|
|
118
118
|
bounds.extend(new google.maps.LatLng(item.latitude, item.longitude));
|
|
119
119
|
});
|
|
120
|
-
|
|
120
|
+
if(siteConfig.optionalShowLocationClusterConfig){
|
|
121
|
+
let configLocation = new google.maps.LatLng(siteConfig.optionalShowLocationClusterConfig.latitude, siteConfig.optionalShowLocationClusterConfig.longitude);
|
|
122
|
+
map.panTo(configLocation);
|
|
123
|
+
bounds.extend(new google.maps.LatLng(siteConfig.optionalShowLocationClusterConfig.latitude, siteConfig.optionalShowLocationClusterConfig.longitude));
|
|
124
|
+
}
|
|
121
125
|
if (!map) return;
|
|
122
126
|
const currentCenter = map.getCenter();
|
|
123
127
|
map.fitBounds(bounds);
|
|
@@ -1,36 +1,64 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
const InfoWindowContent = ({
|
|
4
|
-
items,
|
|
5
|
-
fullAddress,
|
|
6
|
-
applyFilters
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
const InfoWindowContent = ({
|
|
4
|
+
items,
|
|
5
|
+
fullAddress,
|
|
6
|
+
applyFilters,
|
|
7
|
+
mapInfoWindowConfig
|
|
8
|
+
}) => {
|
|
9
|
+
if (!items || items.length < 0) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let mapDetails = items[0].mapDetails;
|
|
14
|
+
let entityDisplayName = mapDetails?.entityDisplayName;
|
|
15
|
+
let address = mapDetails?.address;
|
|
16
|
+
|
|
17
|
+
let displayHeader = entityDisplayName;
|
|
18
|
+
let displayAddress = fullAddress;
|
|
19
|
+
|
|
20
|
+
if (mapInfoWindowConfig) {
|
|
21
|
+
if (mapInfoWindowConfig.entityHeaderField && mapDetails[mapInfoWindowConfig.entityHeaderField]) {
|
|
22
|
+
displayHeader = mapDetails[mapInfoWindowConfig.entityHeaderField];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (mapInfoWindowConfig.showEntityAddressFields) {
|
|
26
|
+
const addressFields = mapInfoWindowConfig.showEntityAddressFields
|
|
27
|
+
.map(field => address[field])
|
|
28
|
+
.filter(Boolean)
|
|
29
|
+
.join(', ');
|
|
30
|
+
displayAddress = addressFields;
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
if (!entityDisplayName.includes(address?.street) && !entityDisplayName.includes(address?.zip)) {
|
|
34
|
+
displayAddress = fullAddress;
|
|
35
|
+
} else {
|
|
36
|
+
displayAddress = '';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<div className="hc-flex-auto hc-p-2">
|
|
42
|
+
<div>
|
|
43
|
+
<div>
|
|
44
|
+
<h4 className="hc-text-lg hc-font-bold hc-leading-tight hc-mb-3">
|
|
45
|
+
{displayHeader}
|
|
46
|
+
</h4>
|
|
47
|
+
<p>{displayAddress}</p>
|
|
48
|
+
<div className="hc-pt-2">
|
|
49
|
+
<button
|
|
50
|
+
className="hc-cursor-pointer hover:hc-opacity-70 hc-text-primary"
|
|
51
|
+
onClick={applyFilters}
|
|
52
|
+
>
|
|
53
|
+
{items.length > 1
|
|
54
|
+
? `View All ${items.length} jobs at this location`
|
|
55
|
+
: `View job at this location`}
|
|
56
|
+
</button>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export default InfoWindowContent;
|
|
@@ -96,18 +96,18 @@ export const MapListProvider: React.FC<MapListProviderProps> = ({
|
|
|
96
96
|
let urlFilters = filtersFromURL(window.location)?.filters;
|
|
97
97
|
return (setFiltersUrl === true && urlFilters && Object.keys(urlFilters).length > 0) ? urlFilters : getStorageObject('selectedFilters', {}) || {}
|
|
98
98
|
}
|
|
99
|
-
const [allListings, setAllListings] = useState<Listing[]>(
|
|
99
|
+
const [allListings, setAllListings] = useState<Listing[]>([]);
|
|
100
100
|
const [filteredListings, setFilteredListings] = useState<Listing[]>([]);
|
|
101
101
|
const [loading, setLoading] = useState<boolean>(false);
|
|
102
102
|
const [mapItems, setMapItems] = useState<any>(getStorageObject('mapItems', []) || []);
|
|
103
103
|
const [query, setQuery] = useState<string | null>(() => resetFilters ? null : getQuery());
|
|
104
104
|
const [sortSetting, setSortSetting] = useState<{ field: string; type: string }>(getStorageObject('sortSetting', { field: 'position', type: 'asc' }) || { field: 'position', type: 'asc' });
|
|
105
|
-
const [listingEntities, setListingEntities] = useState<Record<number, ListingEntity> | null>(
|
|
105
|
+
const [listingEntities, setListingEntities] = useState<Record<number, ListingEntity> | null>({});
|
|
106
106
|
const [firstLoad, setFirstLoad] = useState<boolean>(true);
|
|
107
107
|
const [commuteLocation, setCommuteLocation] = useState<any | null>(getStorageObject('commuteLocation'));
|
|
108
108
|
const [selectedFilters, setSelectedFilters] = useState<Record<string, any>>(() => resetFilters ? {} : firstLoadFilters());
|
|
109
109
|
const [filterOptions, setFilterOptions] = useState<any>();
|
|
110
|
-
const [recruiters, setRecruiters] = useState<Record<number, Recruiter>>(
|
|
110
|
+
const [recruiters, setRecruiters] = useState<Record<number, Recruiter>>({});
|
|
111
111
|
const [filterDialogIsOpen, setFilterDialogIsOpen] = useState<boolean>(false);
|
|
112
112
|
const [mobileTab, setMobileTab] = useState<string>("listTab");
|
|
113
113
|
const [favorites, setFavorites] = useState<number[]>([]);
|
|
@@ -189,10 +189,6 @@ export const MapListProvider: React.FC<MapListProviderProps> = ({
|
|
|
189
189
|
setRecruiters(fetchedRecruiters);
|
|
190
190
|
setListingEntities(fetchedEntities);
|
|
191
191
|
setMapItems(distinctItems);
|
|
192
|
-
setStorageObject("mapItems", distinctItems);
|
|
193
|
-
setStorageObject("listingEntities", fetchedEntities);
|
|
194
|
-
setStorageObject("recruiters", fetchedRecruiters);
|
|
195
|
-
setStorageObject("listings", listingsResult);
|
|
196
192
|
} catch (error) {
|
|
197
193
|
console.log(error);
|
|
198
194
|
}
|