13 lines
5.9 KiB
JavaScript
13 lines
5.9 KiB
JavaScript
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[38],{122:function(e,t){},136:function(e,t,c){"use strict";var o=c(0);c(195),t.a=()=>Object(o.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})},138:function(e,t,c){"use strict";var o=c(0),n=c(1),a=c(5),s=c.n(a),r=(c(197),c(136));t.a=e=>{let{children:t,className:c,screenReaderLabel:a,showSpinner:l=!1,isLoading:i=!0}=e;return Object(o.createElement)("div",{className:s()(c,{"wc-block-components-loading-mask":i})},i&&l&&Object(o.createElement)(r.a,null),Object(o.createElement)("div",{className:s()({"wc-block-components-loading-mask__children":i}),"aria-hidden":i},t),i&&Object(o.createElement)("span",{className:"screen-reader-text"},a||Object(n.__)("Loading…","woocommerce")))}},195:function(e,t){},197:function(e,t){},200:function(e,t,c){"use strict";var o=c(0),n=c(14);const a=Object(o.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(n.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));t.a=a},204:function(e,t,c){"use strict";var o=c(12),n=c.n(o),a=c(0),s=c(5),r=c.n(s),l=c(1),i=c(104),u=c(200);c(122);var p=e=>{let{text:t,screenReaderText:c="",element:o="li",className:s="",radius:l="small",children:i=null,...u}=e;const p=o,b=r()(s,"wc-block-components-chip","wc-block-components-chip--radius-"+l),m=Boolean(c&&c!==t);return Object(a.createElement)(p,n()({className:b},u),Object(a.createElement)("span",{"aria-hidden":m,className:"wc-block-components-chip__text"},t),m&&Object(a.createElement)("span",{className:"screen-reader-text"},c),i)};t.a=e=>{let{ariaLabel:t="",className:c="",disabled:o=!1,onRemove:s=(()=>{}),removeOnAnyClick:b=!1,text:m,screenReaderText:d="",...g}=e;const O=b?"span":"button";if(!t){const e=d&&"string"==typeof d?d:m;t="string"!=typeof e?
|
|
/* translators: Remove chip. */
|
|
Object(l.__)("Remove","woocommerce"):Object(l.sprintf)(
|
|
/* translators: %s text of the chip to remove. */
|
|
Object(l.__)('Remove "%s"',"woocommerce"),e)}const j={"aria-label":t,disabled:o,onClick:s,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||s()}},_=b?j:{},v=b?{"aria-hidden":!0}:j;return Object(a.createElement)(p,n()({},g,_,{className:r()(c,"is-removable"),element:b?"button":g.element,screenReaderText:d,text:m}),Object(a.createElement)(O,n()({className:"wc-block-components-chip__remove"},v),Object(a.createElement)(i.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},270:function(e,t,c){"use strict";c.d(t,"a",(function(){return i}));var o=c(1),n=c(8),a=c(6),s=c(18),r=c(33),l=c(198);const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const{cartCoupons:t,cartIsLoading:c}=Object(r.a)(),{createErrorNotice:i}=Object(n.useDispatch)("core/notices"),{createNotice:u}=Object(n.useDispatch)("core/notices"),{setValidationErrors:p}=Object(l.b)(),b=Object(n.useSelect)((t,c)=>{let{dispatch:n}=c;const r=t(a.CART_STORE_KEY),l=r.isApplyingCoupon(),b=r.isRemovingCoupon(),{applyCoupon:m,removeCoupon:d,receiveApplyingCoupon:g}=n(a.CART_STORE_KEY);return{applyCoupon:t=>{m(t).then(c=>{!0===c&&u("info",Object(o.sprintf)(
|
|
/* translators: %s coupon code. */
|
|
Object(o.__)('Coupon code "%s" has been applied to your cart.',"woocommerce"),t),{id:"coupon-form",type:"snackbar",context:e})}).catch(e=>{p({coupon:{message:Object(s.decodeEntities)(e.message),hidden:!1}}),g("")})},removeCoupon:t=>{d(t).then(c=>{!0===c&&u("info",Object(o.sprintf)(
|
|
/* translators: %s coupon code. */
|
|
Object(o.__)('Coupon code "%s" has been removed from your cart.',"woocommerce"),t),{id:"coupon-form",type:"snackbar",context:e})}).catch(t=>{i(t.message,{id:"coupon-form",context:e}),g("")})},isApplyingCoupon:l,isRemovingCoupon:b}},[i,u]);return{appliedCoupons:t,isLoading:c,...b}}},310:function(e,t){},379:function(e,t,c){"use strict";var o=c(0),n=c(1),a=c(138),s=c(204),r=c(10),l=c(2);c(310);const i={context:"summary"};t.a=e=>{let{cartCoupons:t=[],currency:c,isRemovingCoupon:u,removeCoupon:p,values:b}=e;const{total_discount:m,total_discount_tax:d}=b,g=parseInt(m,10);if(!g&&0===t.length)return null;const O=parseInt(d,10),j=Object(l.getSetting)("displayCartPricesIncludingTax",!1)?g+O:g,_=Object(r.__experimentalApplyCheckoutFilter)({arg:i,filterName:"coupons",defaultValue:t});return Object(o.createElement)(r.TotalsItem,{className:"wc-block-components-totals-discount",currency:c,description:0!==_.length&&Object(o.createElement)(a.a,{screenReaderLabel:Object(n.__)("Removing coupon…","woocommerce"),isLoading:u,showSpinner:!1},Object(o.createElement)("ul",{className:"wc-block-components-totals-discount__coupon-list"},_.map(e=>Object(o.createElement)(s.a,{key:"coupon-"+e.code,className:"wc-block-components-totals-discount__coupon-list-item",text:e.label,screenReaderText:Object(n.sprintf)(
|
|
/* translators: %s Coupon code. */
|
|
Object(n.__)("Coupon: %s","woocommerce"),e.label),disabled:u,onRemove:()=>{p(e.code)},radius:"large",ariaLabel:Object(n.sprintf)(
|
|
/* translators: %s is a coupon code. */
|
|
Object(n.__)('Remove coupon "%s"',"woocommerce"),e.label)})))),label:j?Object(n.__)("Discount","woocommerce"):Object(n.__)("Coupons","woocommerce"),value:j?-1*j:"-"})}},464:function(e,t,c){"use strict";c.r(t);var o=c(0),n=c(379),a=c(41),s=c(33),r=c(270),l=c(10);const i=()=>{const{extensions:e,receiveCart:t,...c}=Object(s.a)(),n={extensions:e,cart:c,context:"woocommerce/checkout"};return Object(o.createElement)(l.ExperimentalDiscountsMeta.Slot,n)};t.default=e=>{let{className:t=""}=e;const{cartTotals:c,cartCoupons:u}=Object(s.a)(),{removeCoupon:p,isRemovingCoupon:b}=Object(r.a)("wc/checkout"),m=Object(a.getCurrencyFromPriceResponse)(c);return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(l.TotalsWrapper,{className:t},Object(o.createElement)(n.a,{cartCoupons:u,currency:m,isRemovingCoupon:b,removeCoupon:p,values:c})),Object(o.createElement)(i,null))}}}]); |