(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[45],{152:function(e,t,o){"use strict";var n=o(0);o(220),t.a=()=>Object(n.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})},153:function(e,t,o){"use strict";var n=o(0),c=o(1),a=o(5),r=o.n(a),s=(o(221),o(152));t.a=e=>{let{children:t,className:o,screenReaderLabel:a,showSpinner:l=!1,isLoading:p=!0}=e;return Object(n.createElement)("div",{className:r()(o,{"wc-block-components-loading-mask":p})},p&&l&&Object(n.createElement)(s.a,null),Object(n.createElement)("div",{className:r()({"wc-block-components-loading-mask__children":p}),"aria-hidden":p},t),p&&Object(n.createElement)("span",{className:"screen-reader-text"},a||Object(c.__)("Loading…","woocommerce")))}},21:function(e,t,o){"use strict";var n=o(0),c=o(5),a=o.n(c);t.a=e=>{let t,{label:o,screenReaderLabel:c,wrapperElement:r,wrapperProps:s={}}=e;const l=null!=o,p=null!=c;return!l&&p?(t=r||"span",s={...s,className:a()(s.className,"screen-reader-text")},Object(n.createElement)(t,s,c)):(t=r||n.Fragment,l&&p&&o!==c?Object(n.createElement)(t,s,Object(n.createElement)("span",{"aria-hidden":"true"},o),Object(n.createElement)("span",{className:"screen-reader-text"},c)):Object(n.createElement)(t,s,o))}},220:function(e,t){},221:function(e,t){},289:function(e,t,o){"use strict";var n=o(15),c=o.n(n),a=o(0),r=o(57),s=o(5),l=o.n(s),p=o(152);o(290),t.a=e=>{let{className:t,showSpinner:o=!1,children:n,variant:s="contained",...i}=e;const u=l()("wc-block-components-button",t,s,{"wc-block-components-button--loading":o});return Object(a.createElement)(r.a,c()({className:u},i),o&&Object(a.createElement)(p.a,null),Object(a.createElement)("span",{className:"wc-block-components-button__text"},n))}},290:function(e,t){},303:function(e,t,o){"use strict";o.d(t,"a",(function(){return l}));var n=o(1),c=o(7),a=o(3),r=o(23),s=o(41);const l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const{cartCoupons:t,cartIsLoading:o}=Object(s.a)(),{createErrorNotice:l}=Object(c.useDispatch)("core/notices"),{createNotice:p}=Object(c.useDispatch)("core/notices"),{setValidationErrors:i}=Object(c.useDispatch)(a.VALIDATION_STORE_KEY),{applyCoupon:u,removeCoupon:b,isApplyingCoupon:d,isRemovingCoupon:m}=Object(c.useSelect)((e,t)=>{let{dispatch:o}=t;const n=e(a.CART_STORE_KEY),c=o(a.CART_STORE_KEY);return{applyCoupon:c.applyCoupon,removeCoupon:c.removeCoupon,isApplyingCoupon:n.isApplyingCoupon(),isRemovingCoupon:n.isRemovingCoupon(),receiveApplyingCoupon:c.receiveApplyingCoupon}},[l,p]),O=t=>{u(t).then(o=>{!0===o&&p("info",Object(n.sprintf)(
/* translators: %s coupon code. */
Object(n.__)('Coupon code "%s" has been applied to your cart.',"woocommerce"),t),{id:"coupon-form",type:"snackbar",context:e})}).catch(e=>{i({coupon:{message:Object(r.decodeEntities)(e.message),hidden:!1}}),receiveApplyingCoupon("")})},g=t=>{b(t).then(o=>{!0===o&&p("info",Object(n.sprintf)(
/* translators: %s coupon code. */
Object(n.__)('Coupon code "%s" has been removed from your cart.',"woocommerce"),t),{id:"coupon-form",type:"snackbar",context:e})}).catch(t=>{l(t.message,{id:"coupon-form",context:e}),receiveApplyingCoupon("")})};return{appliedCoupons:t,isLoading:o,applyCoupon:O,removeCoupon:g,isApplyingCoupon:d,isRemovingCoupon:m}}},353:function(e,t){},414:function(e,t,o){"use strict";var n=o(0),c=o(1),a=o(289),r=o(21),s=o(153),l=o(10),p=o(11),i=o(7),u=o(3);o(353),t.a=Object(l.withInstanceId)(e=>{let{instanceId:t,isLoading:o=!1,initialOpen:l=!1,onSubmit:b=(()=>{})}=e;const[d,m]=Object(n.useState)(""),O=Object(n.useRef)(!1),g="wc-block-components-totals-coupon__input-"+t,{validationError:j,validationErrorId:E}=Object(i.useSelect)(e=>{const t=e(u.VALIDATION_STORE_KEY);return{validationError:t.getValidationError("coupon"),validationErrorId:t.getValidationErrorId(g)}});return Object(n.useEffect)(()=>{O.current!==o&&(o||!d||j||m(""),O.current=o)},[o,d,j]),Object(n.createElement)(p.Panel,{className:"wc-block-components-totals-coupon",hasBorder:!1,initialOpen:l,title:Object(n.createElement)(r.a,{label:Object(c.__)("Coupon code","woocommerce"),screenReaderLabel:Object(c.__)("Apply a coupon code","woocommerce"),htmlFor:g})},Object(n.createElement)(s.a,{screenReaderLabel:Object(c.__)("Applying coupon…","woocommerce"),isLoading:o,showSpinner:!1},Object(n.createElement)("div",{className:"wc-block-components-totals-coupon__content"},Object(n.createElement)("form",{className:"wc-block-components-totals-coupon__form"},Object(n.createElement)(p.ValidatedTextInput,{id:g,errorId:"coupon",className:"wc-block-components-totals-coupon__input",label:Object(c.__)("Enter code","woocommerce"),value:d,ariaDescribedBy:E,onChange:e=>{m(e)},focusOnMount:!0,showError:!1}),Object(n.createElement)(a.a,{className:"wc-block-components-totals-coupon__button",disabled:o||!d,showSpinner:o,onClick:e=>{e.preventDefault(),b(d)},type:"submit"},Object(c.__)("Apply","woocommerce"))),Object(n.createElement)(p.ValidationInputError,{propertyName:"coupon",elementId:g}))))})},493:function(e,t,o){"use strict";o.r(t);var n=o(0),c=o(414),a=o(303),r=o(2),s=o(11);t.default=e=>{let{className:t=""}=e;const o=Object(r.getSetting)("couponsEnabled",!0),{applyCoupon:l,isApplyingCoupon:p}=Object(a.a)("wc/checkout");return o?Object(n.createElement)(s.TotalsWrapper,{className:t},Object(n.createElement)(c.a,{onSubmit:l,isLoading:p})):null}}}]);