{"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","ref","staticClass","attrs","title","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,IACA,CACEE,IAAK,gBACLC,YAAa,iCACbC,MAAO,CAAE,cAAe,UAAW,iBAAkB,MAAOC,MAAO,IACnEC,GAAI,CACFC,MAAO,SAASC,GAEd,OADAA,EAAOC,iBACAb,EAAIc,iBAIjB,CACEV,EAAG,OAAQ,CACTG,YAAa,gBACbQ,MAAO,CAAE,8BAA+Bf,EAAIgB,uBAC5CR,MAAO,CAAES,KAAM,QAASC,QAASlB,EAAImB,aAEvCnB,EAAIoB,GACF,SACEpB,EAAIqB,GAAGrB,EAAIsB,WAAW,uCACtB,OAGN,IAIJvB,EAAOwB,eAAgB,E,6ZCjBvB,YChBqN,EDkBrN,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,iCAGA,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,kBAKI,kBAtDJ,WAwDM,IAAN,kBACA,oGAGM,EAAN,qBACA,8BACA,gBACA,wBAIE,MACF,CACI,sBADJ,WAGM,KAAN,uB,OErIIC,EAAY,YACd,EACAzB,EHuBoB,IGrBpB,EACA,KACA,KACA,MAuBFyB,EAAUC,QAAQC,OAAS,yDACZ,UAAAF,E","file":"chunks/ceres-29.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    \"a\",\n    {\n      ref: \"addToWishList\",\n      staticClass: \"btn btn-link btn-sm text-muted\",\n      attrs: { \"data-toggle\": \"tooltip\", \"data-placement\": \"top\", title: \"\" },\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    <a class=\"btn btn-link btn-sm text-muted\"\n        @click.prevent=\"switchState()\"\n        data-toggle=\"tooltip\"\n        data-placement=\"top\"\n        ref=\"addToWishList\"\n        title=\"\">\n        <icon icon=\"heart\" class=\"default-float\" :class=\"{'text-appearance text-danger': isVariationInWishList}\" :loading=\"isLoading\"></icon>\n        {{ $translate(\"Ceres::Template.singleItemWishList\") }}\n    </a>\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        ...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        changeTooltipText()\n        {\n            const tooltipText = this.$translate(\n                \"Ceres::Template.\" + (this.isVariationInWishList ? \"singleItemWishListRemove\" : \"singleItemWishListAdd\")\n            );\n\n            $(\".add-to-wish-list\")\n                .attr(\"data-original-title\", tooltipText)\n                .tooltip(\"hide\")\n                .tooltip(\"setContent\");\n        }\n    },\n\n    watch:\n    {\n        isVariationInWishList()\n        {\n            this.changeTooltipText();\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/jenkins/workspace/Ceres_Build_Stable/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":""}