<commit_before>import EventBus from '@vue-storefront/core/compatibility/plugins/event-bus'
import { htmlDecode } from '@vue-storefront/core/filters/html-decode'
import Composite from '@vue-storefront/core/mixins/composite'

export default {
  name: 'CmsPage',
  mixins: [Composite],
  computed: {
    pageTitle () {
      return this.$store.state.cms_page.current ? this.$store.state.cms_page.current.title : ''
    }
  },
  watch: {
    '$route': 'validateRoute'
  },
  asyncData ({ store, route, context }) { // this is for SSR purposes to prefetch data
    return new Promise((resolve, reject) => {
      if (context) context.output.cacheTags.add(`cmsPage`)
      store.dispatch('cms_page/single', {
        value: route.params.slug
      }).then(res => {
        if (res) {
          store.state.cms_page.current = res
          EventBus.$emitFilter('cms_page-after-load', { store: store, route: route }).then(results => {
            return resolve()
          }).catch(err => {
            console.error(err)
            reject(err)
          })
        }
      }).catch(err => {
        console.error(err)
        reject(err)
      })
    })
  },
  methods: {
    validateRoute () {
      this.$store.dispatch('cms_page/single', { key: 'slug', value: this.$route.params.slug }).then(cmsPage => {
        if (!cmsPage) {
          this.$router.push('/')
        } else {
          this.$bus.$emit('cms_page-changed', this.$store.state.cms_page.current_path)
          EventBus.$emitFilter('cms_page-after-load', { store: this.$store, route: this.$route })
        }
      })
    }
  },
  metaInfo () {
    return {
      title: htmlDecode(this.pageTitle || this.$route.meta.title),
      meta: this.$route.meta.description ? [{ vmid: 'description', description: htmlDecode(this.$route.meta.description) }] : []
    }
  }
}<commit_msg>Remove using deprecated EventBus<commit_after>import { htmlDecode } from '@vue-storefront/core/filters/html-decode'
import Composite from '@vue-storefront/core/mixins/composite'

export default {
  name: 'CmsPage',
  mixins: [Composite],
  computed: {
    pageTitle () {
      return this.$store.state.cms_page.current ? this.$store.state.cms_page.current.title : ''
    }
  },
  watch: {
    '$route': 'validateRoute'
  },
  asyncData ({ store, route, context }) { // this is for SSR purposes to prefetch data
    return new Promise((resolve, reject) => {
      if (context) context.output.cacheTags.add(`cmsPage`)
      store.dispatch('cms_page/single', {
        value: route.params.slug
      }).then(res => {
        if (res) {
          store.state.cms_page.current = res
          return resolve(res)
        }
      }).catch(err => {
        console.error(err)
        reject(err)
      })
    })
  },
  methods: {
    validateRoute () {
      this.$store.dispatch('cms_page/single', { key: 'slug', value: this.$route.params.slug }).then(cmsPage => {
        if (!cmsPage) {
          this.$router.push('/')
        }
      })
    }
  },
  metaInfo () {
    return {
      title: htmlDecode(this.pageTitle || this.$route.meta.title),
      meta: this.$route.meta.description ? [{ vmid: 'description', description: htmlDecode(this.$route.meta.description) }] : []
    }
  }
}
{'fraction_non_alphanumeric': 0.1617008069522036, 'fraction_numerical': 0.0, 'mean_word_length': 2.5070729053318823, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6234711', 'n_tokens_mistral': 1019, 'n_tokens_neox': 1002, 'n_words': 176}