{"version":3,"file":"directApplication-1b67c5cfa3853c3f2d99.js","mappings":"wLAAA,IAUuC,IAVvC,cACA,WACA,WACA,WAEA,WACA,WACA,GAGuC,EAHvC,WAGuC,gBAAAA,QAAAA,GAFvC,UACA,WACA,WAAuC,4OAAAA,QAAAA,GAAA,4PAAAC,OAAAA,eAAAA,EAAAA,EAAAA,GAAAC,EAAAA,GAAAA,EAAAA,EAAA,QAAAA,EAAAA,QAAAA,EAAA,GAAAC,EAAAA,IAAAA,EAAAA,GAAA,EAEvC,MAAMC,EAA4B,KAChC,MAAMC,GAAkB,aAAS,mBAC3BC,GAAY,aAAS,cAAgB,qBACrCC,GAAW,IAAAC,eACXC,GAAW,IAAAC,eAEXC,GAAc,IAAAC,cAAaC,IAAU,IAAAC,yBAAwBD,EAAOR,MAAqB,CAAC,EAC1FU,GAAQ,IAAAH,cAAaC,IAAU,IAAAG,mBAAkBH,EAAOP,MAAe,CAAC,EACxEW,GACJ,IAAAC,WAAUP,IAAgBQ,EAAEC,SAAST,EAAYU,IAAI,IAAAC,mBAAkBP,IAiBzE,OAfA,IAAAQ,YAAU,KACHN,EAKLR,GACE,IAAAe,gCAA+B,CAC7BC,cAAed,EAAYU,GAC3BhB,gBAAiBM,EAAYe,KAC7BC,QAASZ,EAAMM,MARjBd,EAAS,aAUV,GACA,CAACA,EAAUE,EAAUQ,EAAyBN,EAAYU,GAAIV,EAAYe,KAAMX,EAAMM,KAElF,IAAP,EAAOO,EAAAA,QAAAA,cAACC,EAAAA,iBAAgB,CAACC,MAAM,8BAA8B,EA1BzD1B,EAAyB,8CA4BhBA,EAAyB2B,EAAAA,QAAAA,C","sources":["webpack://opencounter/./ui/containers/projects/DirectApplicationRedirect.js"],"sourcesContent":["import React, { useEffect } from \"react\";\nimport * as R from \"ramda\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { useNavigate } from \"react-router-dom-v5-compat\";\n\nimport { createDirectApplicationProject } from \"actions\";\nimport { FullScreenLoader } from \"components/Loader\";\nimport useParam from \"hooks/useParam\";\nimport { getRequirementIDs, selectGuideByType } from \"reducers/guides\";\nimport { selectRequirementBySlug } from \"reducers/requirements\";\nimport { isPresent } from \"utils/func\";\n\nconst DirectApplicationRedirect = () => {\n const requirementSlug = useParam(\"requirementSlug\");\n const guideType = useParam(\"guideType\") || \"direct_application\";\n const navigate = useNavigate();\n const dispatch = useDispatch();\n\n const requirement = useSelector((state) => selectRequirementBySlug(state, requirementSlug)) || {};\n const guide = useSelector((state) => selectGuideByType(state, guideType)) || {};\n const isRequirementAccessible =\n isPresent(requirement) && R.includes(requirement.id, getRequirementIDs(guide));\n\n useEffect(() => {\n if (!isRequirementAccessible) {\n navigate(\"/not_found\");\n return;\n }\n\n dispatch(\n createDirectApplicationProject({\n requirementID: requirement.id,\n requirementSlug: requirement.slug,\n guideID: guide.id,\n }),\n );\n }, [navigate, dispatch, isRequirementAccessible, requirement.id, requirement.slug, guide.id]);\n\n return ;\n};\nexport default DirectApplicationRedirect;\n"],"names":["default","Object","newObj","cache","DirectApplicationRedirect","requirementSlug","guideType","navigate","useNavigate","dispatch","useDispatch","requirement","useSelector","state","selectRequirementBySlug","guide","selectGuideByType","isRequirementAccessible","isPresent","R","includes","id","getRequirementIDs","useEffect","createDirectApplicationProject","requirementID","slug","guideID","_react","_Loader","label","exports"],"sourceRoot":""}