{"version":3,"sources":["webpack:///./resources/js/src/app/components/item/AddToWishList.vue?41e4","webpack:///resources/js/src/app/components/item/AddToWishList.vue","webpack:///./resources/js/src/app/components/item/AddToWishList.vue?6174","webpack:///./resources/js/src/app/components/item/AddToWishList.vue"],"names":["render","_vm","this","_h","$createElement","_c","_self","directives","name","rawName","ref","staticClass","attrs","title","tooltipText","on","click","$event","preventDefault","switchState","class","isVariationInWishList","icon","loading","isLoading","_v","_s","$translate","_withStripped","component","options","__file"],"mappings":"kGAAA,IAAIA,EAAS,WACX,IAAIC,EAAMC,KACNC,EAAKF,EAAIG,eACTC,EAAKJ,EAAIK,MAAMD,IAAMF,EACzB,OAAOE,EACL,SACA,CACEE,WAAY,CAAC,CAAEC,KAAM,UAAWC,QAAS,cACzCC,IAAK,gBACLC,YAAa,iCACbC,MAAO,CACL,cAAe,UACf,iBAAkB,MAClBC,MAAOZ,EAAIa,aAEbC,GAAI,CACFC,MAAO,SAASC,GAEd,OADAA,EAAOC,iBACAjB,EAAIkB,iBAIjB,CACEd,EAAG,OAAQ,CACTM,YAAa,gBACbS,MAAO,CAAE,8BAA+BnB,EAAIoB,uBAC5CT,MAAO,CAAEU,KAAM,QAASC,QAAStB,EAAIuB,aAEvCvB,EAAIwB,GACF,SACExB,EAAIyB,GAAGzB,EAAI0B,WAAW,uCACtB,OAGN,IAIJ3B,EAAO4B,eAAgB,E,6ZCrBvB,YCjBqN,EDmBrN,CAEE,KAAF,mBAEE,MAAF,CACI,YAAJ,QAGE,OAAF,CACI,OAAJ,CACM,QAAN,OAIE,KAdF,WAgBI,MAAJ,CACM,WAAN,IAIE,S,+VAAF,EAEI,sBAFJ,WAIM,OAAN,oDAGI,mBAPJ,WASM,OAAN,iFAGI,4BAZJ,WAcM,IAAN,sEAEM,OAAN,eAEA,KAGA,gCAGI,YAxBJ,WA0BM,IAAN,kBACA,oGAIM,OAAN,IAGA,aACI,YAAJ,YAAM,OAAN,2BAIE,QACF,CACI,YADJ,WAGA,2BAEQ,KAAR,qBAIQ,KAAR,iBAII,cAbJ,WAcM,IAAN,OACA,iBAEQ,KAAR,aACQ,KAAR,yEACA,YAEU,EAAV,aAEU,EAAV,QACA,yDACA,mBAEA,YAEU,EAAV,kBAKI,mBAlCJ,WAmCM,IAAN,OACA,iBAEQ,KAAR,aACQ,KAAR,sCAAU,GAAV,sDAEU,EAAV,aAEU,EAAV,QACA,2DACA,mBAEA,YAEU,EAAV,oB,OE1HIC,EAAY,YACd,EACA7B,EH4BoB,IG1BpB,EACA,KACA,KACA,MAuBF6B,EAAUC,QAAQC,OAAS,yDACZ,UAAAF,E","file":"chunks/ceres-34.min.js","sourcesContent":["var render = function() {\n  var _vm = this\n  var _h = _vm.$createElement\n  var _c = _vm._self._c || _h\n  return _c(\n    \"button\",\n    {\n      directives: [{ name: \"tooltip\", rawName: \"v-tooltip\" }],\n      ref: \"addToWishList\",\n      staticClass: \"btn btn-link btn-sm text-muted\",\n      attrs: {\n        \"data-toggle\": \"tooltip\",\n        \"data-placement\": \"top\",\n        title: _vm.tooltipText\n      },\n      on: {\n        click: function($event) {\n          $event.preventDefault()\n          return _vm.switchState()\n        }\n      }\n    },\n    [\n      _c(\"icon\", {\n        staticClass: \"default-float\",\n        class: { \"text-appearance text-danger\": _vm.isVariationInWishList },\n        attrs: { icon: \"heart\", loading: _vm.isLoading }\n      }),\n      _vm._v(\n        \"\\n    \" +\n          _vm._s(_vm.$translate(\"Ceres::Template.singleItemWishList\")) +\n          \"\\n\"\n      )\n    ],\n    1\n  )\n}\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns }","<template>\n    <button class=\"btn btn-link btn-sm text-muted\"\n        @click.prevent=\"switchState()\"\n        data-toggle=\"tooltip\"\n        data-placement=\"top\"\n        ref=\"addToWishList\"\n        v-tooltip\n        :title=\"tooltipText\">\n        <icon icon=\"heart\" class=\"default-float\" :class=\"{'text-appearance text-danger': isVariationInWishList}\" :loading=\"isLoading\"></icon>\n        {{ $translate(\"Ceres::Template.singleItemWishList\") }}\n    </button>\n</template>\n\n<script>\nimport { isNullOrUndefined } from \"../../helper/utils\";\nimport { mapState } from \"vuex\";\n\nconst NotificationService = require(\"../../services/NotificationService\");\n\nexport default {\n\n    name: \"add-to-wish-list\",\n\n    props: {\n        variationId: Number\n    },\n\n    inject: {\n        itemId: {\n            default: null\n        }\n    },\n\n    data()\n    {\n        return {\n            isLoading: false\n        };\n    },\n\n    computed:\n    {\n        isVariationInWishList()\n        {\n            return this.wishListIds.includes(this.currentVariationId);\n        },\n\n        currentVariationId()\n        {\n            return !isNullOrUndefined(this.variationId) ? this.variationId : this.currentVariationVariationId;\n        },\n\n        currentVariationVariationId()\n        {\n            const currentVariation = this.$store.getters[`${this.itemId}/currentItemVariation`];\n\n            if (isNullOrUndefined(currentVariation))\n            {\n                return null;\n            }\n\n            return currentVariation && currentVariation.variation && currentVariation.variation.id;\n        },\n\n        tooltipText()\n        {\n            const tooltipText = this.$translate(\n                \"Ceres::Template.\" + (this.isVariationInWishList ? \"singleItemWishListRemove\" : \"singleItemWishListAdd\")\n            );\n\n\n            return tooltipText;\n        },\n\n        ...mapState({\n            wishListIds: state => state.wishList.wishListIds\n        })\n    },\n\n    methods:\n    {\n        switchState()\n        {\n            if (this.isVariationInWishList)\n            {\n                this.removeFromWishList();\n            }\n            else\n            {\n                this.addToWishList();\n            }\n        },\n\n        addToWishList()\n        {\n            if (!this.isLoading)\n            {\n                this.isLoading = true;\n                this.$store.dispatch(\"addToWishList\", parseInt(this.currentVariationId)).then(\n                    response =>\n                    {\n                        this.isLoading = false;\n\n                        NotificationService.success(\n                            this.$translate(\"Ceres::Template.singleItemWishListAdded\")\n                        ).closeAfter(3000);\n                    },\n                    error =>\n                    {\n                        this.isLoading = false;\n                    });\n            }\n        },\n\n        removeFromWishList()\n        {\n            if (!this.isLoading)\n            {\n                this.isLoading = true;\n                this.$store.dispatch(\"removeWishListItem\", { id: parseInt(this.currentVariationId) }).then(response =>\n                    {\n                        this.isLoading = false;\n\n                        NotificationService.success(\n                            this.$translate(\"Ceres::Template.singleItemWishListRemoved\")\n                        ).closeAfter(3000);\n                    },\n                    error =>\n                    {\n                        this.isLoading = false;\n                    });\n            }\n        }\n    }\n}\n\n</script>\n","import mod from \"-!../../../../../../node_modules/babel-loader/lib/index.js!../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AddToWishList.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../../../node_modules/babel-loader/lib/index.js!../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AddToWishList.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./AddToWishList.vue?vue&type=template&id=4c3118d2&\"\nimport script from \"./AddToWishList.vue?vue&type=script&lang=js&\"\nexport * from \"./AddToWishList.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n  script,\n  render,\n  staticRenderFns,\n  false,\n  null,\n  null,\n  null\n  \n)\n\n/* hot reload */\nif (module.hot) {\n  var api = require(\"/home/runner/work/plugin-ceres/plugin-ceres/node_modules/vue-hot-reload-api/dist/index.js\")\n  api.install(require('vue'))\n  if (api.compatible) {\n    module.hot.accept()\n    if (!api.isRecorded('4c3118d2')) {\n      api.createRecord('4c3118d2', component.options)\n    } else {\n      api.reload('4c3118d2', component.options)\n    }\n    module.hot.accept(\"./AddToWishList.vue?vue&type=template&id=4c3118d2&\", function () {\n      api.rerender('4c3118d2', {\n        render: render,\n        staticRenderFns: staticRenderFns\n      })\n    })\n  }\n}\ncomponent.options.__file = \"resources/js/src/app/components/item/AddToWishList.vue\"\nexport default component.exports"],"sourceRoot":""}