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AS,CAACzE,EAAUC,KAC5D,MAAM,YAAE2D,EAAW,KAAEc,EAAI,aAAEC,IAAiBC,EAAAA,EAAAA,IAAW3E,KAEvD,OADoB0E,EAAeE,EAAAA,GAAkCC,EAAAA,IAClD,CAAElB,cAAaE,SAAUY,EAAMD,UAAS9D,MAAKoE,IAAqB,IAApB,YAAEhB,GAAagB,EAC1EhB,GACF/D,GAASgE,EAAAA,EAAAA,IAAgBD,GAC3B,GACA,C","sources":["webpack://web-pwa/./src/routes/SEO/department.route.js","webpack://web-pwa/./src/domain/seo/department.page.jsx","webpack://web-pwa/./src/store/seo/seo-zone.actions.js"],"sourcesContent":["import { ROUTE_SEO_DEPARTMENT } from '..'\nimport AddressNotFoundError from '../../domain/error/AddressNotFoundError'\nimport PermanentRedirectError from '../../domain/error/PermanentRedirectError'\nimport { bboxArrayToBboxArrays } from '../../domain/map/conversion'\nimport { generateFullRoute } from '../../domain/router/routeUtils'\nimport { renderPage } from '../../domain/seo/department.page'\nimport { searchArea } from '../../store/address/address.actions'\nimport { selectFirstAddress } from '../../store/address/address.selectors'\nimport { mapUpdated } from '../../store/map/mapSlice'\nimport { geocodeForwardCtx, searchServiceCtx } from '../../store/search/search.service.constants'\nimport { setSearchTerms } from '../../store/search/searchSlice'\nimport { searchDepartmentCities } from '../../store/seo/seo-address.actions'\nimport { searchDepartmentDescription } from '../../store/seo/seo-zone.actions'\nimport { slugify } from '../../utils/string'\nimport { technicalErrorCatcher } from '../routeErrors.utils'\nimport { handleRouteLoading } from '../routeService'\n\nexport const onRouteEnter = ({ params, store: { dispatch, getState }, avoidRefetchingPageData }) => {\n if (avoidRefetchingPageData) {\n return searchDepartmentDescription()(dispatch, getState)\n }\n\n const { departmentCode, department } = params\n const location = `${departmentCode}-${department}`\n\n return searchArea(location, geocodeForwardCtx.filter.county)(dispatch, getState)\n .then(() => {\n const firstAddress = selectFirstAddress(getState())\n\n if (firstAddress.geocode_level !== searchServiceCtx.geocodeLevel.admin7 || !firstAddress.departmentCode) {\n throw new AddressNotFoundError()\n }\n\n if (firstAddress.departmentCode !== departmentCode || slugify(firstAddress.departmentLabel) !== department)\n throw new PermanentRedirectError(\n generateFullRoute(ROUTE_SEO_DEPARTMENT, {\n departmentCode: firstAddress.departmentCode,\n department: slugify(firstAddress.departmentLabel)\n })\n )\n\n return Promise.all([\n dispatch(setSearchTerms(location)),\n __SERVER__ && searchDepartmentCities()(dispatch, getState),\n searchDepartmentDescription()(dispatch, getState),\n dispatch(mapUpdated({ bbox: bboxArrayToBboxArrays(firstAddress.bbox) }))\n ])\n })\n .catch(technicalErrorCatcher)\n}\n\nexport default handleRouteLoading({ onRouteEnter, renderPage })\n","import React from 'react'\nimport AddressSearchDialogContent from '../../routes/address/AddressSearchDialogContent'\nimport { PAGE_CLASSES } from '../../routes/pageClasses.constants'\nimport AddressHeaderForm from '../address/AddressHeaderForm'\nimport Page from '../genericComponents/Page'\nimport Header from '../header/Header'\nimport Main from '../main/Main'\nimport Map from '../map/Map'\nimport PushNotificationPopup from '../PushNotification/PushNotificationPopup'\nimport SearchDialog from '../search/SearchDialog'\nimport AddressSuggestContent from '../suggest/AddressSuggestContent'\nimport SeoZoneMapImage from './zones/SeoZoneMapImage'\nimport SeoZoneMetaManager from './zones/SeoZoneMetaManager'\nimport { DepartmentTitle } from './zones/ZoneContent'\nimport ZoneMainContent from './zones/ZoneMainContent'\n\nexport const renderPage = () => {\n const { AddressPage, withToaster } = PAGE_CLASSES\n\n return (\n \n \n } />\n
\n \n
\n }>\n \n \n \n
\n } />\n
\n
\n )\n}\n","import {\n fetchDepartmentDescription,\n fetchLayerDepartmentDescription,\n fetchLayerRegionDescription,\n fetchRegionDescription\n} from '../../dataSource/seo/seo.request'\nimport { selectFirstAddress, selectZone } from '../address/address.selectors'\n\nimport PermanentRedirectError from '../../domain/error/PermanentRedirectError'\nimport { generateFullRoute } from '../../domain/router/routeUtils'\nimport { loadDescription } from '../address/addressSlice'\n\nexport const redirectLayerRegionRouteIfTownUpperCased = (regionCode, region, routeName) => {\n if (region.toLowerCase() !== region)\n throw new PermanentRedirectError(\n generateFullRoute(routeName, {\n regionCode,\n region: region.toLowerCase()\n })\n )\n}\n\nexport const redirectLayerDepartmentRouteIfTownUpperCased = (departmentCode, department, routeName) => {\n if (department.toLowerCase() !== department)\n throw new PermanentRedirectError(\n generateFullRoute(routeName, {\n departmentCode,\n department: department.toLowerCase()\n })\n )\n}\n\nexport const searchDepartmentDescription = () => (dispatch, getState) => {\n const address = selectFirstAddress(getState())\n const { countryCode, departmentCode } = address\n return fetchDepartmentDescription({ countryCode, zoneCode: departmentCode })\n .then(({ description }) => {\n if (description) {\n dispatch(loadDescription(description))\n }\n })\n .catch(e => console.warn(`searchDepartmentDescription: no zone description for ${countryCode}-${departmentCode}`))\n}\n\nexport const searchRegionDescription = () => (dispatch, getState) => {\n const address = selectFirstAddress(getState())\n const { countryCode, regionCode } = address\n return fetchRegionDescription({ countryCode, zoneCode: regionCode })\n .then(({ description }) => {\n if (description) {\n dispatch(loadDescription(description))\n }\n })\n .catch(e => console.warn(`searchRegionDescription: no zone description for ${countryCode}-${regionCode}`))\n}\n\nexport const searchLayerZoneDescription = layer => (dispatch, getState) => {\n const { countryCode, code, isDepartment } = selectZone(getState())\n const fetchMethod = isDepartment ? fetchLayerDepartmentDescription : fetchLayerRegionDescription\n return fetchMethod({ countryCode, zoneCode: code, layer }).then(({ description }) => {\n if (description) {\n dispatch(loadDescription(description))\n }\n })\n}\n"],"names":["onRouteEnter","_ref","params","store","dispatch","getState","avoidRefetchingPageData","searchDepartmentDescription","departmentCode","department","location","searchArea","geocodeForwardCtx","filter","county","then","firstAddress","selectFirstAddress","geocode_level","searchServiceCtx","geocodeLevel","admin7","AddressNotFoundError","slugify","departmentLabel","PermanentRedirectError","generateFullRoute","ROUTE_SEO_DEPARTMENT","Promise","all","setSearchTerms","__SERVER__","mapUpdated","bbox","bboxArrayToBboxArrays","catch","technicalErrorCatcher","handleRouteLoading","renderPage","AddressPage","withToaster","PAGE_CLASSES","React","Page","cssClasses","key","SeoZoneMetaManager","Map","staticMap","SeoZoneMapImage","Header","transparent","AddressHeaderForm","SearchDialog","suggestContent","AddressSuggestContent","AddressSearchDialogContent","PushNotificationPopup","Main","withoutSubHeader","ZoneMainContent","titleContent","DepartmentTitle","address","countryCode","fetchDepartmentDescription","zoneCode","description","loadDescription","e","console","warn","searchRegionDescription","regionCode","fetchRegionDescription","_ref2","searchLayerZoneDescription","layer","code","isDepartment","selectZone","fetchLayerDepartmentDescription","fetchLayerRegionDescription","_ref3"],"sourceRoot":""}