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C,KAC5D,MAAM,YAAE4D,EAAW,KAAEa,EAAI,aAAEC,IAAiBC,EAAAA,EAAAA,IAAW3E,KAEvD,OADoB0E,EAAeE,EAAAA,GAAkCC,EAAAA,IAClD,CAAEjB,cAAaG,SAAUU,EAAMD,UAAS9D,MAAKoE,IAAqB,IAApB,YAAEd,GAAac,EAC1Ed,GACFjE,GAASkE,EAAAA,EAAAA,IAAgBD,GAC3B,GACA,C","sources":["webpack://web-pwa/./src/routes/SEO/region.route.js","webpack://web-pwa/./src/domain/seo/region.page.jsx","webpack://web-pwa/./src/store/seo/seo-zone.actions.js"],"sourcesContent":["import { ROUTE_SEO_REGION } 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/region.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 { searchRegionCities } from '../../store/seo/seo-address.actions'\nimport { searchRegionDescription } 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 searchRegionDescription()(dispatch, getState)\n }\n\n const { regionCode, region } = params\n const location = `${regionCode}-${region}`\n\n return searchArea(location, geocodeForwardCtx.filter.state)(dispatch, getState)\n .then(() => {\n const firstAddress = selectFirstAddress(getState())\n\n if (firstAddress.geocode_level !== searchServiceCtx.geocodeLevel.admin1 || !firstAddress.regionCode) {\n throw new AddressNotFoundError()\n }\n\n if (firstAddress.regionCode !== regionCode || slugify(firstAddress.regionLabel) !== region) {\n throw new PermanentRedirectError(\n generateFullRoute(ROUTE_SEO_REGION, {\n regionCode: firstAddress.regionCode,\n region: slugify(firstAddress.regionLabel)\n })\n )\n }\n\n return Promise.all([\n dispatch(setSearchTerms(location)),\n __SERVER__ && searchRegionCities()(dispatch, getState),\n searchRegionDescription()(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 PushNotificationPopup from '../PushNotification/PushNotificationPopup'\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 SearchDialog from '../search/SearchDialog'\nimport AddressSuggestContent from '../suggest/AddressSuggestContent'\nimport SeoZoneMapImage from './zones/SeoZoneMapImage'\nimport SeoZoneMetaManager from './zones/SeoZoneMetaManager'\nimport { RegionTitle } 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","searchRegionDescription","regionCode","region","location","searchArea","geocodeForwardCtx","filter","state","then","firstAddress","selectFirstAddress","geocode_level","searchServiceCtx","geocodeLevel","admin1","AddressNotFoundError","slugify","regionLabel","PermanentRedirectError","generateFullRoute","ROUTE_SEO_REGION","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","RegionTitle","searchDepartmentDescription","address","countryCode","departmentCode","fetchDepartmentDescription","zoneCode","description","loadDescription","e","console","warn","fetchRegionDescription","_ref2","searchLayerZoneDescription","layer","code","isDepartment","selectZone","fetchLayerDepartmentDescription","fetchLayerRegionDescription","_ref3"],"sourceRoot":""}