text: (window.webpackJsonp=window.webpackJsonp||[]).push([[15],{362:function(e,t,o){"use strict";o.r(t);var n=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"cmp"},[e.isCheckoutReadonly&&e.$translate("Ceres::Template.couponReadonlyInfoText")?o("p",[e._v("\n        "+e._s(e.couponReadonlyInfoText)+"\n    ")]):e._e(),e._v(" "),o("div",{class:{"input-group":!0,"component-loading":e.isCheckoutReadonly,"is-loading":e.isCheckoutReadonly}},[o("input",{directives:[{name:"model",rawName:"v-model",value:e.couponCode,expression:"couponCode"}],staticClass:"form-control",attrs:{type:"text",placeholder:e.$translate("Ceres::Template.couponEnterCoupon"),disabled:e.disabled||e.isCheckoutReadonly,"data-testing":"coupon-input"},domProps:{value:e.couponCode},on:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.redeemCode()},input:function(t){t.target.composing||(e.couponCode=t.target.value)}}}),e._v(" "),o("span",{staticClass:"input-group-btn"},[e.disabled?o("button",{staticClass:"btn btn-medium btn-danger",attrs:{type:"button",disabled:e.waiting||e.isCheckoutReadonly,"data-testing":"coupon-remove"},on:{click:function(t){return e.removeCode()}}},[o("icon",{attrs:{icon:"trash",loading:e.waiting}}),e._v("\n                "+e._s(e.$translate("Ceres::Template.couponRemove"))+"\n            ")],1):o("button",{staticClass:"btn btn-medium btn-primary btn-appearance",attrs:{type:"button",disabled:e.waiting||e.isCheckoutReadonly,"data-testing":"coupon-redeem"},on:{click:function(t){return e.redeemCode()}}},[o("icon",{attrs:{icon:"gift",loading:e.waiting}}),e._v("\n                "+e._s(e.$translate("Ceres::Template.couponRedeem"))+"\n            ")],1)])])])};n._withStripped=!0;o(46),o(13),o(4),o(72),o(29),o(8),o(3),o(49),o(16),o(50);var r=o(88),a=o(5),i=o(30);function s(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function c(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var u=o(21),p={name:"coupon",props:{template:{type:String,default:"#vue-coupon"}},data:function(){return{waiting:!1,couponCode:""}},watch:{redeemedCouponCode:function(e){this.couponCode=e}},computed:function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?s(Object(o),!0).forEach((function(t){c(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):s(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}({disabled:function(){return!!this.redeemedCouponCode}},Object(i.e)({redeemedCouponCode:function(e){return e.basket.data.couponCode},isBasketLoading:function(e){return e.basket.isBasketLoading},isCheckoutReadonly:function(e){return e.checkout.readOnly}})),mounted:function(){var e=this;this.$nextTick((function(){e.redeemedCouponCode&&(e.couponCode=e.redeemedCouponCode)}))},methods:{redeemCode:function(){var e=this;this.couponCode=this.couponCode.replace(/\s/g,""),this.couponCode.length>0?(this.waiting=!0,this.$store.dispatch("redeemCouponCode",this.couponCode).then((function(t){e.waiting=!1,u.success(a.a.translate("Ceres::Template.couponRedeemSuccess")).closeAfter(1e4)}),(function(t){e.waiting=!1,u.error(e.getCouponRedemptionErrorMessage(t)).closeAfter(1e4)}))):u.error(a.a.translate("Ceres::Template.couponIsEmpty")).closeAfter(1e4)},removeCode:function(){var e=this;this.waiting=!0,this.$store.dispatch("removeCouponCode",this.couponCode).then((function(t){e.waiting=!1,u.success(a.a.translate("Ceres::Template.couponRemoveSuccess")).closeAfter(1e4)}),(function(t){e.waiting=!1,u.error(a.a.translate("Ceres::Template.couponRemoveFailure")).closeAfter(1e4)}))},getCouponRedemptionErrorMessage:function(e){var t=e&&e.warn&&e.warn.code||0;return t>0&&r.a.has(t.toString())?a.a.translate("Ceres::Template."+r.a.get(t.toString())):a.a.translate("Ceres::Template.couponRedeemFailure")}}},d=o(2),l=Object(d.a)(p,n,[],!1,null,null,null);l.options.__file="resources/js/src/app/components/basket/Coupon.vue";t.default=l.exports}}]);
  //# sourceMappingURL=ceres-client-15.min.js.map