{"version":3,"file":"catalogMixin-ojPr8Lkh.js","sources":["../../src/mixins/catalogTextListMixin.vue","../../src/mixins/catalogMixin.vue"],"sourcesContent":["<script>\nexport default {\n  methods: {\n    textListValue(textList, key) {\n      if (textList) {\n        const item = textList.find((textListItem) =>\n          textListItem.Key === key || textListItem.AttributeKey === key ? textListItem.Value : null,\n        );\n\n        if (item) {\n          return item.Value;\n        }\n      }\n\n      return null;\n    },\n  },\n};\n</script>\n","<script>\nimport axios from 'axios';\n\nimport catalogTextListMixin from './catalogTextListMixin';\n\nexport default {\n  mixins: [catalogTextListMixin],\n  data() {\n    return {\n      mediaDownloadLink: null,\n    };\n  },\n  computed: {\n    catalogService() {\n      let url;\n      switch (APP_ENVIRONMENT) {\n        case 'PROD':\n          url = 'https://api.fischer.group/catalog/v1/';\n          break;\n        case 'UAT':\n          url = 'https://api-uat.fischer.group/catalog/v1/';\n          break;\n        default:\n          url = 'https://api-test.fischer.group/catalog/v1/';\n          break;\n      }\n      return url;\n    },\n  },\n  methods: {\n    checkForMediaDownload({ type, id }) {\n      const lang =\n        this.$fischer.catalogLocale() ||\n        (this.$fischer.siteLanguage() || '').replace('-', '_') ||\n        'de_DE';\n      const url = `${this.catalogService}media/${type}/${id}/${this.$fischer.brandId()}/${lang}`;\n      this.mediaDownloadLink = url;\n\n      if (IS_SSR) {\n        return;\n      }\n      try {\n        // note: not using async to allow SSR without prefetch\n        axios.head(url).then((res) => {\n          if (res.status === 204) {\n            this.mediaDownloadLink = null;\n          }\n        });\n      } catch (error) {\n        console.info(error);\n        this.mediaDownloadLink = null;\n      }\n    },\n    getFamilyThumbnails(catalogData) {\n      if (!catalogData?.Media) {\n        return [];\n      }\n      return catalogData.Media.filter(\n        (media) =>\n          (media.OutputType === 'PR' &&\n            (media.Type === 'Product Picture' ||\n              media.Type === 'Product Category Picture' ||\n              media.Type === 'Packaging' ||\n              media.Type === 'Application Picture')) ||\n          (media.OutputType === 'IS' && media.Type === 'Video'),\n      );\n    },\n  },\n};\n</script>\n"],"names":["_sfc_main","textList","key","item","textListItem","catalogTextListMixin","url","type","id","lang","axios","res","error","catalogData","media"],"mappings":"uCACK,MAAAA,EAAU,CACb,QAAS,CACP,cAAcC,EAAUC,EAAK,CAC3B,GAAID,EAAU,CACZ,MAAME,EAAOF,EAAS,KAAMG,GAC1BA,EAAa,MAAQF,GAAOE,EAAa,eAAiBF,EAAME,EAAa,MAAQ,MAGvF,GAAID,EACF,OAAOA,EAAK,KAEhB,CAEA,OAAO,IACR,CACF,CACH,ECZKH,EAAU,CACb,OAAQ,CAACK,CAAoB,EAC7B,MAAO,CACE,MAAA,CACL,kBAAmB,IAAA,CAEvB,EACA,SAAU,CACR,gBAAiB,CACX,IAAAC,EACJ,OAAQ,OAAiB,CACvB,IAAK,OACGA,EAAA,wCACN,MACF,IAAK,MACGA,EAAA,4CACN,MACF,QACQA,EAAA,6CACN,KACJ,CACO,OAAAA,CACT,CACF,EACA,QAAS,CACP,sBAAsB,CAAE,KAAAC,EAAM,GAAAC,GAAM,CAClC,MAAMC,EACJ,KAAK,SAAS,cACb,IAAA,KAAK,SAAS,aAAkB,GAAA,IAAI,QAAQ,IAAK,GAAG,GACrD,QACIH,EAAM,GAAG,KAAK,cAAc,SAASC,CAAI,IAAIC,CAAE,IAAI,KAAK,SAAS,QAAS,CAAA,IAAIC,CAAI,GACxF,KAAK,kBAAoBH,EAKrB,GAAA,CAEFI,EAAM,KAAKJ,CAAG,EAAE,KAAMK,GAAQ,CACxBA,EAAI,SAAW,MACjB,KAAK,kBAAoB,KAC3B,CACD,QACMC,EAAO,CACd,QAAQ,KAAKA,CAAK,EAClB,KAAK,kBAAoB,IAC3B,CACF,EACA,oBAAoBC,EAAa,CAC3B,OAACA,GAAA,MAAAA,EAAa,MAGXA,EAAY,MAAM,OACtBC,GACEA,EAAM,aAAe,OACnBA,EAAM,OAAS,mBACdA,EAAM,OAAS,4BACfA,EAAM,OAAS,aACfA,EAAM,OAAS,wBAClBA,EAAM,aAAe,MAAQA,EAAM,OAAS,OAAA,EATxC,EAWX,CACF,CACF"}