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,oCACA,WACE,OAAO,EAAQ,Y","sources":["webpack://_N_E/./pages/policy/committees/advisory-lists.js","webpack://_N_E/./src/shared/components/MembershipPageWrap/index.js","webpack://_N_E/?0c3b"],"sourcesContent":["import { useRouter } from 'next/router';\nimport React from 'react';\nimport { connect } from 'react-redux';\n\nimport withMembershipAccessWrap, {\n mapStateToProps,\n} from '@/src/shared/components/MembershipPageWrap';\nimport { ADVOCACY_ACCESS } from '@/src/shared/constants';\n\nfunction RedirectPage() {\n const router = useRouter();\n\n if (typeof window !== 'undefined') {\n router.push('/policy/committees/');\n }\n return null;\n}\n\nexport default connect(mapStateToProps)(\n withMembershipAccessWrap(RedirectPage, ADVOCACY_ACCESS.POLICY_COMMITTEES)\n);\n","import { useAuth0 } from '@auth0/auth0-react';\nimport Router from 'next/router';\nimport React, { useEffect } from 'react';\nimport { useSelector } from 'react-redux';\n\nimport Error from '@/pages/_error';\nimport { checkAccess } from '@/src/shared/constants';\n\nimport LoadingPage from '../LoadingPage/LoadingPage';\n\nconst isBrowser = typeof window !== 'undefined';\n\nconst withMembershipAccessWrap = (PageComponent, memberLevels, ssr = false) => {\n return function PageComponentWithAccess(props) {\n const { loginWithRedirect, isLoading } = useAuth0();\n const { isLoggedIn, role } = useSelector(state => state.auth);\n const stateLoading = useSelector(state => state.auth.isLoading);\n const personId = useSelector(state => state.auth.userinfo.PersonID);\n\n useEffect(() => {\n if (!stateLoading && !isLoggedIn) {\n loginWithRedirect({\n appState: {\n returnTo: Router.pathname,\n },\n });\n }\n }, [isLoggedIn, stateLoading]);\n\n const hasAccess = checkAccess(memberLevels, role);\n const isAuthorized = personId && Array.isArray(role) && hasAccess;\n const errorCode = isLoggedIn && !hasAccess ? 401.4 : 401;\n\n if (!ssr || isBrowser) {\n if (isLoading || stateLoading) return ;\n if (!stateLoading && !isLoggedIn) {\n loginWithRedirect({\n appState: {\n returnTo: Router.pathname,\n },\n });\n }\n if (!stateLoading && isLoggedIn && !isAuthorized) return ;\n }\n\n return ;\n };\n};\n\nexport const mapStateToProps = state => {\n const {\n auth: {\n isLoggedIn,\n isLoading,\n role,\n userinfo: { PersonID },\n },\n } = state;\n return {\n isLoggedIn,\n isLoading,\n role,\n personId: PersonID,\n };\n};\n\nexport default withMembershipAccessWrap;\n","\n (window.__NEXT_P = window.__NEXT_P || []).push([\n \"/policy/committees/advisory-lists\",\n function () {\n return require(\"private-next-pages/policy/committees/advisory-lists.js\");\n }\n ]);\n if(module.hot) {\n module.hot.dispose(function () {\n window.__NEXT_P.push([\"/policy/committees/advisory-lists\"])\n });\n }\n "],"names":["connect","mapStateToProps","withMembershipAccessWrap","useRouter","push","ADVOCACY_ACCESS","state","auth","isLoggedIn","isLoading","role","personId","userinfo","PersonID","PageComponent","memberLevels","props","useAuth0","loginWithRedirect","useSelector","stateLoading","useEffect","appState","returnTo","Router","hasAccess","checkAccess","isAuthorized","Array","isArray","errorCode","status","window","__NEXT_P"],"sourceRoot":""}