{"version":3,"sources":["webpack:///./ClientApp/components/Pages/Resources/FamilyResources/FRFaq.tsx"],"names":["FRFaq","props","match","categoriesFAQ","setCategoriesFAQ","currentCategoryFAQ","setCurrentCategoryFAQ","searchQuery","React","questions","setQuestions","isLoaded","setIsLoaded","fetchAll","Promise","all","map","category","rest","get","name","then","res","list","queriedQuestions","concat","apply","showCategory","window","scrollTo","document","querySelector","className","length","carrotIcon","require","item","index","key","maxCount","linkCategory","toLowerCase","replace","withSeo","state","faqPage"],"mappings":"+zCAUMA,EAAQ,SAACC,GAE2FA,EAAlGC,MAFiB,IAEVC,EAA2FF,EAA3FE,cAAeC,EAA4EH,EAA5EG,iBAAkBC,EAA0DJ,EAA1DI,mBAAoBC,EAAsCL,EAAtCK,sBAAuBC,EAAeN,EAAfM,YAFlE,IAGUC,WAA4B,IAHtC,GAGjBC,EAHiB,KAGNC,EAHM,SAIQF,YAAwB,GAJhC,GAIjBG,EAJiB,KAIPC,EAJO,KAMlBC,EAAW,WAChBH,EAAa,IACbI,QAAQC,IACPZ,EAAca,KAAI,SAACC,GAClB,OAAOC,IAAKC,IAAL,iBAAoCF,EAASG,KAA7C,iBAA0Db,IAC/Dc,MAAK,SAACC,GACN,OAAOA,EAAIC,YAGbF,MAAK,SAACC,GACP,IACME,EADQ,GACiBC,OAAOC,MAAM,GAAIJ,GAChDZ,EAAac,OAIfhB,aAAgB,WACdD,EACAM,IADcK,IAAKC,IAAkB,qBAAqBE,MAAK,SAAAC,GAAG,OAAIlB,EAAiBkB,EAAIC,WAG1F,CAAChB,IAEJC,aAAgB,YACXH,aAAJ,EAAIA,EAAoBe,MACvBF,IAAKC,IAAL,iBAAoCd,EAAmBe,MAAvD,OAA8Db,EAAc,SAAH,OAAYA,GAAgB,KACnGc,MAAK,SAACC,GACNZ,EAAaY,EAAIC,MACjBX,GAAY,MAGdL,GAAcM,MAEb,CAACR,EAAoBE,IAExB,IAAMoB,EAAe,SAACV,GAAa,MAClCX,EAAsBW,GACtBW,OAAOC,SAAS,EAAG,GACnB,UAAAC,SAASC,cAAc,qBAAvB,SAAsCF,SAAS,EAAG,IAGnD,OACC,2BAASG,UAAU,sBAClB,uBAAKA,UAAU,kBACZzB,EA4CAE,EAAUwB,OACV,gBAAC,IAAD,CAAUxB,UAAWA,EAAWyB,WAAYC,EAAQ,OAEnD,uBAAKH,UAAU,oBAAf,sEA9CF,uBAAKA,UAAU,qBAEb3B,GAAsBA,EAAmBe,MACzC,gCACC,0BAAQY,UAAU,oBAChB3B,EAAmBe,MAEpBX,EAAUwB,OACT,gBAAC,IAAD,CACCxB,UAAWA,EAAWyB,WAAYC,EAAQ,OAG3CxB,EACD,uBAAKqB,UAAU,oBAAf,sEADY,uBAAKA,UAAU,oBAAf,yDAMZ3B,GAAsBA,EAAmBe,OAASjB,EAAc8B,QACnE9B,EAAca,KAAI,SAACoB,EAAMC,GAAP,OACjB,gBAAC,WAAD,CAAgBC,IAAG,mBAAcF,EAAKhB,KAAnB,YAA2BiB,IAC7C,0BAAQC,IAAG,qBAAgBD,GAASL,UAAU,oBAC5CI,EAAKhB,MAENgB,EAAK3B,UACL,gBAAC,IAAD,CACC6B,IAAKF,EAAKhB,KAAOiB,EACjB5B,UAAW2B,EAAK3B,UAChByB,WAAYC,EAAQ,KACpBI,SAAU,EACVC,aAAY,eAAUJ,EAAKhB,KAAKqB,cAAcC,QAAQ,OAAQ,OAAOA,QAAQ,OAAQ,MACrFzB,SAAUmB,EACVT,aAAcA,IAGf,uBAAKK,UAAU,oBAAf,8E,EArFHhC,E,yHAuGS2C,YAAQ3C,GAAO,SAAA4C,GAAK,OAAIA,EAAMC,UAAS,UAAW,OAAlD,a,6FAvGT7C,E","file":"chunks/FRFaq.chunk.b896629aadea04a9eeff.js","sourcesContent":["import * as React from 'react';\r\n\r\nimport {List} from '@common/typescript/objects/List';\r\n\r\nimport FaqBlock from '@app/components/UI/FaqBlock/FaqBlock';\r\nimport {ResourceTopic} from '@app/objects/ResourceTopic';\r\nimport {Issues, Questions} from '@app/objects/Questions';\r\nimport {rest} from '@app/components/Api';\r\nimport withSeo from '@app/components/LocalCommon/HigherOrderComponents/WithSeo';\r\n\r\nconst FRFaq = (props) => {\r\n\r\n\tconst {match, categoriesFAQ, setCategoriesFAQ, currentCategoryFAQ, setCurrentCategoryFAQ, searchQuery} = props;\r\n\tconst [questions, setQuestions] = React.useState([]);\r\n\tconst [isLoaded, setIsLoaded] = React.useState(false);\r\n\r\n\tconst fetchAll = () => {\r\n\t\tsetQuestions([]);\r\n\t\tPromise.all(\r\n\t\t\tcategoriesFAQ.map((category) => {\r\n\t\t\t\treturn rest.get>(`v1/faq/${category.name}?text=${searchQuery}`)\r\n\t\t\t\t\t.then((res) => {\r\n\t\t\t\t\t\treturn res.list;\r\n\t\t\t\t\t});\r\n\t\t\t})\r\n\t\t).then((res) => {\r\n\t\t\tconst empty = [] as Questions[];\r\n\t\t\tconst queriedQuestions = empty.concat.apply([], res as Questions[]);\r\n\t\t\tsetQuestions(queriedQuestions);\r\n\t\t});\r\n\t};\r\n\r\n\tReact.useEffect(() => {\r\n\t\t!searchQuery ? rest.get>('v1/faqCategories/').then(res => setCategoriesFAQ(res.list)) :\r\n\t\t\tfetchAll();\r\n\r\n\t}, [searchQuery]);\r\n\r\n\tReact.useEffect(() => {\r\n\t\tif (currentCategoryFAQ?.name) {\r\n\t\t\trest.get>(`v1/faq/${currentCategoryFAQ.name}${searchQuery ? `?text=${searchQuery}` : ''}`)\r\n\t\t\t\t.then((res) => {\r\n\t\t\t\t\tsetQuestions(res.list);\r\n\t\t\t\t\tsetIsLoaded(true);\r\n\t\t\t\t});\r\n\t\t} else {\r\n\t\t\tsearchQuery ? fetchAll() : null;\r\n\t\t}\r\n\t}, [currentCategoryFAQ, searchQuery]);\r\n\r\n\tconst showCategory = (category) => {\r\n\t\tsetCurrentCategoryFAQ(category);\r\n\t\twindow.scrollTo(0, 0);\r\n\t\tdocument.querySelector('#react-app')?.scrollTo(0, 0);\r\n\t};\r\n\r\n\treturn (\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t{!searchQuery ?\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t{/*--------------certain FAQ category--------------*/}\r\n\t\t\t\t\t\t{currentCategoryFAQ && currentCategoryFAQ.name && (\r\n\t\t\t\t\t\t\t<>\r\n\t\t\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\t\t{currentCategoryFAQ.name}\r\n\t\t\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\t{questions.length ?\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t:\r\n\t\t\t\t\t\t\t\t\t!isLoaded ?
Woof! Looks like we're still loading a few things.
:\r\n\t\t\t\t\t\t\t\t\t
Woof! We were not able to find a match. Please try another search.
\r\n\t\t\t\t\t\t\t\t}\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{/*--------------all FAQ categories--------------*/}\r\n\t\t\t\t\t\t{!(currentCategoryFAQ && currentCategoryFAQ.name) && categoriesFAQ.length &&\r\n\t\t\t\t\t\tcategoriesFAQ.map((item, index) => (\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\t\t{item.name}\r\n\t\t\t\t\t\t\t\t
\r\n\t\t\t\t\t\t\t\t{item.questions ?\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t:\r\n\t\t\t\t\t\t\t\t\t
Woof! We were not able to find a match. Please try another search.
\r\n\t\t\t\t\t\t\t\t}\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}\r\n\r\n\t\t\t\t\t
\r\n\t\t\t\t\t:\r\n\t\t\t\t\t\tquestions.length ?\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t:\r\n\t\t\t\t\t\t\t
Woof! We were not able to find a match. Please try another search.
\r\n\t\t\t\t}\r\n\t\t\t
\r\n\t\t
\r\n\t);\r\n};\r\n\r\nexport default withSeo(FRFaq, state => state.faqPage, 'faqPage', 'faq');"],"sourceRoot":""}