{"version":3,"sources":["pages/AgencySearchPage/styles.js","pages/AgencySearchPage/index.tsx"],"names":["AgencySearchHero","styled","div","withConfig","componentId","rgba","color","CityList","Container","textStyles","MediumText","H2","memo","connect","state","doc","document","_ref","agencies","agencyCityList","urlParameters","cityList","keyword","agenciesTitle","isValidPostcode","concat","noAgencies","smooth","SmoothScroll","onPageLoad","scrollTo","useEffect","hasWindow","body","addEventListener","removeEventListener","isEmpty","firstAgency","historyTracker","trackHistory","city","React","createElement","Fragment","RancidBanner","type","bannerColor","NavigationCityList","inputPlaceholder","id","AgencyList"],"mappings":"0LAKO,MAAMA,EAAmBC,IAAOC,IAAGC,WAAA,CAAAC,YAAA,eAAVH,CAAU,sGAC3BI,YAAKC,YAAM,cAAe,GAAI,MAShCC,EAAWN,YAAOO,KAAUL,WAAA,CAAAC,YAAA,eAAjBH,CAAiB,+dAmB7BK,YAAM,OAAQ,GAIdA,YAAM,cAAe,GAKJA,YAAM,OAAQ,GAQ/BA,YAAM,OAAQ,GACrBG,IAAWC,WASZD,IAAWE,GACJL,YAAM,cAAe,I,4EC0BjBM,yBAAKC,kBAJKC,IAAwB,CAChDC,IAAKD,EAAME,WAGQH,CArEKI,IAAoB,IAAnB,IAAEF,GAAaE,EACxC,MAAM,SAAEC,EAAQ,eAAEC,EAAc,cAAEC,GAAkBL,EAC9CM,EAAWF,GAAkB,IAC7B,QAAEG,GAAYF,GAAiB,CAAEE,QAAS,MAE1CC,EACHD,GAAWE,YAAgBF,GAAW,uBAAHG,OAA0BH,EAAO,mBAAoBA,EACrFI,EACHJ,GAAWE,YAAgBF,GAC1B,yDACA,+CAEEK,EAAS,IAAIC,IAEbC,EAAaA,KAClBF,EAAOG,SAAS,YAejB,GAZAC,oBAAU,KACLC,KACHhB,SAASiB,KAAKC,iBAAiB,YAAaL,GAGtC,KACFG,KACHhB,SAASiB,KAAKE,oBAAoB,YAAaN,KAG/C,IAEGP,IAAYc,YAAQlB,GAAW,CACpC,MAAMmB,EAAcnB,EAAS,GACzBmB,IACHC,IAAeC,aAAa,kBAAmBjB,GAC3Ce,EAAYG,MACfF,IAAeC,aAAa,gBAAiBF,EAAYG,OAK5D,OACCC,IAAAC,cAACC,WAAQ,KACRF,IAAAC,cAAC1C,EAAgB,KAChByC,IAAAC,cAAA,UAAI,yBAGLD,IAAAC,cAACE,IAAY,CAACC,KAAK,gBAAgBC,YAAY,UAE/CL,IAAAC,cAACnC,EAAQ,KACRkC,IAAAC,cAACK,IAAkB,CAAC1B,SAAUA,EAAU2B,iBAAiB,qCAGvD1B,GACFmB,IAAAC,cAAClC,IAAS,CAACyC,GAAG,WACbR,IAAAC,cAAA,UAAKnB,IAEHa,YAAQlB,IAAauB,IAAAC,cAACQ,IAAU,CAAChC,SAAUA,IAE5CkB,YAAQlB,IAAauB,IAAAC,cAAA,UAAKhB","file":"assets/js/pages-AgencySearchPage.chunk.js?cb=aad45c6352fd72c06804","sourcesContent":["import styled from \"styled-components\";\nimport { rgba } from \"polished\";\nimport { color, media, textStyles } from \"@utils/style-utils\";\nimport { Container } from \"@components/Grid\";\n\nexport const AgencySearchHero = styled.div`\n\tbackground: ${rgba(color(\"greenBright\", 4), 0.25)};\n\tpadding: 164px 0 118px;\n\ttext-align: center;\n\n\t+ .rancid-banner {\n\t\twidth: calc(100% - 30px);\n\t}\n`;\n\nexport const CityList = styled(Container)`\n\tpadding-bottom: 60px;\n\tpadding-top: 80px;\n\twidth: 100%;\n\n\t.postcode-search {\n\t\twidth: 311px;\n\n\t\tlabel {\n\t\t\tdisplay: none;\n\t\t}\n\n\t\tinput,\n\t\t.form-group {\n\t\t\tmax-width: 100%;\n\t\t\twidth: 100%;\n\t\t}\n\n\t\tinput {\n\t\t\tcolor: ${color(\"grey\", 1)};\n\t\t}\n\n\t\tbutton.is-valid {\n\t\t\tcolor: ${color(\"greenBright\", 1)};\n\t\t}\n\t}\n\n\t.city-list-header {\n\t\tborder-bottom: 1px solid ${color(\"grey\", 6)};\n\n\t\t@media (max-width: 650px) {\n\t\t\talign-items: flex-start;\n\t\t\tflex-direction: column;\n\t\t}\n\n\t\th4 {\n\t\t\tcolor: ${color(\"grey\", 1)};\n\t\t\t${textStyles.MediumText}\n\n\t\t\t@media (max-width: 650px) {\n\t\t\t\tmargin-bottom: 20px;\n\t\t\t}\n\t\t}\n\t}\n\n\t.city-list-group-title {\n\t\t${textStyles.H2}\n\t\tcolor: ${color(\"greenBright\", 1)};\n\t\tmargin-bottom: 15px !important;\n\t}\n\n\t.city-list-group a {\n\t\tmargin-bottom: 4px;\n\t}\n`;\n","import React, { memo, Fragment, useEffect } from \"react\";\nimport { connect } from \"react-redux\";\nimport { IDocument } from \"@redux/document\";\nimport { IApplicationState } from \"@redux\";\nimport { AgencySearchHero, CityList } from \"./styles\";\nimport NavigationCityList from \"@components/SiteHeader/NavigationCityList\";\nimport AgencyList from \"@components/AgencyList\";\nimport isEmpty from \"lodash-es/isEmpty\";\nimport { Container } from \"@components/Grid\";\nimport { isValidPostcode } from \"@utils/validators\";\nimport { SmoothScroll } from \"@utils/anchor-scroll\";\nimport { hasWindow } from \"@utils\";\nimport historyTracker from \"@services/history-tracker\";\nimport RancidBanner from \"@components/RancidBanner\";\n\ninterface IProps {\n\tdoc: IDocument;\n}\n\nconst AgencySearchPage = ({ doc }: IProps) => {\n\tconst { agencies, agencyCityList, urlParameters } = doc;\n\tconst cityList = agencyCityList || {};\n\tconst { keyword } = urlParameters || { keyword: null };\n\n\tconst agenciesTitle =\n\t\t!!keyword && isValidPostcode(keyword) ? `Postinumeroalueella ${keyword} Sinua palvelee` : keyword;\n\tconst noAgencies =\n\t\t!!keyword && isValidPostcode(keyword)\n\t\t\t? \"Ei yhtään myymälää postinumeroalueella.\"\n\t\t\t: \"Hakusanalla ei löytynyt myymälää\";\n\n\tconst smooth = new SmoothScroll();\n\n\tconst onPageLoad = () => {\n\t\tsmooth.scrollTo(\"myymala\");\n\t};\n\n\tuseEffect(() => {\n\t\tif (hasWindow) {\n\t\t\tdocument.body.addEventListener(\"js-loaded\", onPageLoad);\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (hasWindow) {\n\t\t\t\tdocument.body.removeEventListener(\"js-loaded\", onPageLoad);\n\t\t\t}\n\t\t};\n\t}, []);\n\n\tif (!!keyword && !isEmpty(agencies)) {\n\t\tconst firstAgency = agencies[0];\n\t\tif (firstAgency) {\n\t\t\thistoryTracker.trackHistory(\"seller-postcode\", keyword);\n\t\t\tif (firstAgency.city) {\n\t\t\t\thistoryTracker.trackHistory(\"seller-county\", firstAgency.city);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<AgencySearchHero>\n\t\t\t\t<h1>Asuntomyymälät</h1>\n\t\t\t</AgencySearchHero>\n\n\t\t\t<RancidBanner type=\"seller-county\" bannerColor=\"green\" />\n\n\t\t\t<CityList>\n\t\t\t\t<NavigationCityList cityList={cityList} inputPlaceholder=\"Hae postinumerosi perusteella\" />\n\t\t\t</CityList>\n\n\t\t\t{!!keyword && (\n\t\t\t\t<Container id=\"myymala\">\n\t\t\t\t\t<h2>{agenciesTitle}</h2>\n\n\t\t\t\t\t{!isEmpty(agencies) && <AgencyList agencies={agencies} />}\n\n\t\t\t\t\t{isEmpty(agencies) && <h4>{noAgencies}</h4>}\n\t\t\t\t</Container>\n\t\t\t)}\n\t\t</Fragment>\n\t);\n};\n\nconst mapStateToProps = (state: IApplicationState) => ({\n\tdoc: state.document,\n});\n\nexport default memo(connect(mapStateToProps)(AgencySearchPage));\n"],"sourceRoot":""}