{"version":3,"file":"PressReleaseSection-CzJajAjf.js","sources":["../../src/queries/GetPressReleaseSection.js","../../src/components/press/PressReleaseSection.vue"],"sourcesContent":["import gql from 'graphql-tag';\nimport { paginationQuery } from '@/queries/PaginationQuery';\n\nexport const pressReleaseSectionQuery = gql`\n query getPressRelease(\n $filter: String,\n $limit: Int,\n $paged: Int,\n $subType: String,\n $subTypeValue: String,\n $type: String\n ) {\n pressReleases(first: $limit, where: { paged: $paged }) {\n nodes {\n date\n excerpt\n featuredImage {\n node {\n altText\n sourceUrl\n }\n }\n imageSrcset\n slug\n title\n }\n }\n ${paginationQuery}\n }\n`;\n","<template>\n <div :class=\"[$style.container, 'container']\">\n <header v-if=\"releases.pressReleases.nodes.length\">\n <nav>\n <BackLink\n component=\"PressReleaseSection\"\n group=\"press\"\n label=\"Press Room\"\n path=\"/press-room\"\n ></BackLink>\n </nav>\n <h1 class=\"space-24-32-above\">Press Releases</h1>\n </header>\n <SectionArticleList\n v-if=\"releases.pressReleases.nodes.length\"\n :page=\"page\"\n :post-data=\"releases.pressReleases.nodes\"\n :total-page-count=\"pageCount\"\n type=\"press_release\"\n ></SectionArticleList>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport BackLink from '@/components/common/BackLink.vue';\nimport { computed, ref } from 'vue';\nimport { dataLoaded, useHandleError, useMetaData } from '@/composables/Common.js';\nimport { pressReleaseSectionQuery } from '@/queries/GetPressReleaseSection';\nimport SectionArticleList from '@/components/common/SectionArticleList.vue';\nimport { useQuery } from 'villus';\n\nconst props = withDefaults(\n defineProps<{\n page: number;\n }>(),\n { page: 1 },\n);\n\nconst { handleError } = useHandleError();\nconst { setMetaDescription, setMetaTitle } = useMetaData();\n\nconst limit = 8;\nconst releases = ref({\n pressReleases: {\n nodes: [],\n },\n totalCount: 0,\n});\n\nconst pageCount = computed(() => Math.ceil(releases.value.totalCount / limit));\n\nconst { data } = useQuery({\n onData: (data) => {\n if (Object.keys(data).length) {\n if (data.pressReleases.nodes.length) {\n releases.value.pressReleases = data.pressReleases;\n releases.value.totalCount = data.totalCount;\n setMetaTitle('Press Releases');\n setMetaDescription();\n dataLoaded();\n }\n\n if (data.pressReleases.nodes.length === 0) {\n handleError('PressReleaseSection', `Page ${props.page}, limit ${limit}`);\n }\n }\n },\n query: pressReleaseSectionQuery,\n skip: ({ paged }) => isNaN(paged),\n variables: {\n limit: limit,\n paged: +props.page,\n type: 'press_release',\n },\n});\n\nif (isNaN(props.page)) {\n handleError('PressReleaseSection', `Page ${props.page}, limit ${limit}`);\n}\n</script>\n\n<script lang=\"ts\">\nexport default {\n beforeRoute(params, villusClient) {\n return new Promise<void>((resolve, reject) => {\n villusClient\n .executeQuery({\n query: pressReleaseSectionQuery,\n variables: {\n limit: 8,\n paged: params.page ? +params.page : 1,\n type: 'press_release',\n },\n })\n .then(() => resolve())\n .catch((err) => reject(err));\n });\n },\n};\n</script>\n\n<style lang=\"scss\" module>\n@media (min-width: $break-point) {\n .container {\n @include grid;\n\n > * {\n grid-column: span 12;\n }\n }\n}\n</style>\n"],"names":["pressReleaseSectionQuery","gql","paginationQuery","__default__","params","villusClient","resolve","reject","err","props","__props","handleError","useHandleError","setMetaDescription","setMetaTitle","useMetaData","limit","releases","ref","pageCount","computed","useQuery","data","dataLoaded","paged"],"mappings":"6aAGO,MAAMA,EAA2BC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAwBlCC,CAAe;AAAA;AAAA,YCuDNC,EAAA,CACb,YAAYC,EAAQC,EAAc,CAChC,OAAO,IAAI,QAAc,CAACC,EAASC,IAAW,CAC5CF,EACG,aAAa,CACZ,MAAOL,EACP,UAAW,CACT,MAAO,EACP,MAAOI,EAAO,KAAO,CAACA,EAAO,KAAO,EACpC,KAAM,eAAA,CACR,CACD,EACA,KAAK,IAAME,GAAS,EACpB,MAAOE,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