woocommerce/packages/woocommerce-blocks/build/atomic-block-components/price.js

3 lines
5.9 KiB
JavaScript
Raw Normal View History

2021-12-10 12:03:04 +00:00
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[12],{124:function(e,r,c){"use strict";var t=c(5),a=c.n(t),n=c(0),o=c(1),l=c(53),i=c(6),s=c.n(i),u=(c(2),c(47)),p=(c(206),function(e){var r=e.currency,c=e.maxPrice,t=e.minPrice,a=e.priceClassName,i=e.priceStyle;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)("span",{className:"screen-reader-text"},Object(o.sprintf)(
/* translators: %1$s min price, %2$s max price */
Object(o.__)("Price between %1$s and %2$s",'woocommerce'),Object(u.formatPrice)(t),Object(u.formatPrice)(c))),Object(n.createElement)("span",{"aria-hidden":!0},Object(n.createElement)(l.a,{className:s()("wc-block-components-product-price__value",a),currency:r,value:t,style:i})," — ",Object(n.createElement)(l.a,{className:s()("wc-block-components-product-price__value",a),currency:r,value:c,style:i})))}),m=function(e){var r=e.currency,c=e.regularPriceClassName,t=e.regularPriceStyle,a=e.regularPrice,i=e.priceClassName,u=e.priceStyle,p=e.price;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)("span",{className:"screen-reader-text"},Object(o.__)("Previous price:",'woocommerce')),Object(n.createElement)(l.a,{currency:r,renderText:function(e){return Object(n.createElement)("del",{className:s()("wc-block-components-product-price__regular",c),style:t},e)},value:a}),Object(n.createElement)("span",{className:"screen-reader-text"},Object(o.__)("Discounted price:",'woocommerce')),Object(n.createElement)(l.a,{currency:r,renderText:function(e){return Object(n.createElement)("ins",{className:s()("wc-block-components-product-price__value","is-discounted",i),style:u},e)},value:p}))};r.a=function(e){var r=e.align,c=e.className,t=e.currency,o=e.format,i=void 0===o?"<price/>":o,u=e.maxPrice,b=void 0===u?null:u,d=e.minPrice,O=void 0===d?null:d,f=e.price,j=void 0===f?null:f,y=e.priceClassName,g=e.priceStyle,v=e.regularPrice,_=e.regularPriceClassName,P=e.regularPriceStyle,N=s()(c,"price","wc-block-components-product-price",a()({},"wc-block-components-product-price--align-".concat(r),r));i.includes("<price/>")||(i="<price/>",console.error("Price formats need to include the `<price/>` tag."));var w=v&&j!==v,S=Object(n.createElement)("span",{className:s()("wc-block-components-product-price__value",y)});return w?S=Object(n.createElement)(m,{currency:t,price:j,priceClassName:y,priceStyle:g,regularPrice:v,regularPriceClassName:_,regularPriceStyle:P}):null!==O&&null!==b?S=Object(n.createElement)(p,{currency:t,maxPrice:b,minPrice:O,priceClassName:y,priceStyle:g}):null!==j&&(S=Object(n.createElement)(l.a,{className:s()("wc-block-components-product-price__value",y),currency:t,value:j,style:g})),Object(n.createElement)("span",{className:N},Object(n.createInterpolateElement)(i,{price:S}))}},175:function(e,r){},206:function(e,r){},482:function(e,r,c){"use strict";c.r(r);var t=c(5),a=c.n(t),n=c(0),o=(c(2),c(6)),l=c.n(o),i=c(124),s=c(47),u=c(45),p=c(12),m=c(159),b=c(86);r.default=Object(b.withProductDataContext)((function(e){var r,c,t,o,b,d,O,f=e.className,j=e.align,y=e.fontSize,g=e.customFontSize,v=e.saleFontSize,_=e.customSaleFontSize,P=e.color,N=e.customColor,w=e.saleColor,S=e.customSaleColor,C=Object(u.useInnerBlockLayoutContext)().parentClassName,E=Object(u.useProductDataContext)().product,x=l()(f,a()({},"".concat(C,"__product-price"),C));if(!E.id)return Object(n.createElement)(i.a,{align:j,className:x});var h=Object(p.getColorClassName)("color",P),k=Object(p.getFontSizeClass)(y),z=Object(p.getColorClassName)("color",w),F=Object(p.getFontSizeClass)(v),D=l()((r={"has-text-color":P||N,"has-font-size":y||g},a()(r,h,h),a()(r,k,k),r)),T=l()((c={"has-text-color":w||S,"has-font-size":v||_},a()(c,z,z),a()(c,F,F),c)),V={color:N,fontSize:g},B={color:S,fontSize:_},I=E.prices,U=Object(s.getCurrencyFromPriceResponse)(I),J=I.price!==I.regular_price,M=J?l()((t={},a()(t,"".concat(C,"__product-price__value"),C),a()(t,T,Object(m.b)()),t)):l()((o={},a()(o,"".concat(C,"__product-price__value"),C),a()(o,D,Object(m.b)()),o)),W=J?B:V;return Object(n.createElement)(i.a,{align:j,className:x,currency:U,price:I.price,priceClassName:M,priceStyle:Object(m.b)()?W:{},minPrice:null==I||null===(b=I.price_range)||void 0===b?void 0:b.min_amount,maxPrice:null==I||null===(d=I.price_range)||void 0===d?void 0:d.max_amount,regularPrice:I.regular_price,regularPriceClassName:l()((O={},a()(O,"".concat(C,"__product-price__regular"),C),a()(O,D,Object(m.b)()),O)),regularPriceStyle:Object(m.b)()?V:{}})}))},53:function(e,r,c){"use strict";var t=c(9),a=c.n(t),n=c(5),o=c.n(n),l