geno/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/product-price-frontend.js
2024-02-01 11:54:18 +00:00

2 lines
No EOL
7.9 KiB
JavaScript

(self.webpackChunkwebpackWcBlocksJsonp=self.webpackChunkwebpackWcBlocksJsonp||[]).push([[5579],{6669:(e,r,t)=>{"use strict";t.r(r),t.d(r,{Block:()=>p,default:()=>m});var c=t(9196),n=t(4184),o=t.n(n),l=t(6805),a=t(4293),s=t(2864),i=t(3611),u=t(721);const p=e=>{var r,t;const{className:n,textAlign:u,isDescendentOfSingleProductTemplate:p}=e,m=(0,i.F)(e),{parentName:d,parentClassName:y}=(0,s.useInnerBlockLayoutContext)(),{product:v}=(0,s.useProductDataContext)(),g="woocommerce/all-products"===d,f=o()("wc-block-components-product-price",n,m.className,{[`${y}__product-price`]:y});if(!v.id&&!p){const e=(0,c.createElement)(l.Z,{align:u,className:f});return g?(0,c.createElement)("div",{className:"wp-block-woocommerce-product-price"},e):e}const b=v.prices,N=p?(0,a.getCurrencyFromPriceResponse)():(0,a.getCurrencyFromPriceResponse)(b),_="5000",k=b.price!==b.regular_price,P=o()({[`${y}__product-price__value`]:y,[`${y}__product-price__value--on-sale`]:k}),E=(0,c.createElement)(l.Z,{align:u,className:f,style:m.style,regularPriceStyle:m.style,priceStyle:m.style,priceClassName:P,currency:N,price:p?_:b.price,minPrice:null==b||null===(r=b.price_range)||void 0===r?void 0:r.min_amount,maxPrice:null==b||null===(t=b.price_range)||void 0===t?void 0:t.max_amount,regularPrice:p?_:b.regular_price,regularPriceClassName:o()({[`${y}__product-price__regular`]:y})});return g?(0,c.createElement)("div",{className:"wp-block-woocommerce-product-price"},E):E},m=e=>e.isDescendentOfSingleProductTemplate?(0,c.createElement)(p,{...e}):(0,u.withProductDataContext)(p)(e)},6805:(e,r,t)=>{"use strict";t.d(r,{Z:()=>m});var c=t(9196),n=t(5736),o=t(711),l=t(4184),a=t.n(l),s=t(4293),i=t(9307);t(5138);const u=({currency:e,maxPrice:r,minPrice:t,priceClassName:l,priceStyle:i={}})=>(0,c.createElement)(c.Fragment,null,(0,c.createElement)("span",{className:"screen-reader-text"},(0,n.sprintf)(/* translators: %1$s min price, %2$s max price */
(0,n.__)("Price between %1$s and %2$s","woocommerce"),(0,s.formatPrice)(t),(0,s.formatPrice)(r))),(0,c.createElement)("span",{"aria-hidden":!0},(0,c.createElement)(o.FormattedMonetaryAmount,{className:a()("wc-block-components-product-price__value",l),currency:e,value:t,style:i})," — ",(0,c.createElement)(o.FormattedMonetaryAmount,{className:a()("wc-block-components-product-price__value",l),currency:e,value:r,style:i}))),p=({currency:e,regularPriceClassName:r,regularPriceStyle:t,regularPrice:l,priceClassName:s,priceStyle:i,price:u})=>(0,c.createElement)(c.Fragment,null,(0,c.createElement)("span",{className:"screen-reader-text"},(0,n.__)("Previous price:","woocommerce")),(0,c.createElement)(o.FormattedMonetaryAmount,{currency:e,renderText:e=>(0,c.createElement)("del",{className:a()("wc-block-components-product-price__regular",r),style:t},e),value:l}),(0,c.createElement)("span",{className:"screen-reader-text"},(0,n.__)("Discounted price:","woocommerce")),(0,c.createElement)(o.FormattedMonetaryAmount,{currency:e,renderText:e=>(0,c.createElement)("ins",{className:a()("wc-block-components-product-price__value","is-discounted",s),style:i},e),value:u})),m=({align:e,className:r,currency:t,format:n="<price/>",maxPrice:l,minPrice:s,price:m,priceClassName:d,priceStyle:y,regularPrice:v,regularPriceClassName:g,regularPriceStyle:f,style:b})=>{const N=a()(r,"price","wc-block-components-product-price",{[`wc-block-components-product-price--align-${e}`]:e});n.includes("<price/>")||(n="<price/>",console.error("Price formats need to include the `<price/>` tag."));const _=v&&m&&m<v;let k=(0,c.createElement)("span",{className:a()("wc-block-components-product-price__value",d)});return _?k=(0,c.createElement)(p,{currency:t,price:m,priceClassName:d,priceStyle:y,regularPrice:v,regularPriceClassName:g,regularPriceStyle:f}):void 0!==s&&void 0!==l?k=(0,c.createElement)(u,{currency:t,maxPrice:l,minPrice:s,priceClassName:d,priceStyle:y}):m&&(k=(0,c.createElement)(o.FormattedMonetaryAmount,{className:a()("wc-block-components-product-price__value",d),currency:t,value:m,style:y})),(0,c.createElement)("span",{className:N,style:b},(0,i.createInterpolateElement)(n,{price:k}))}},3611:(e,r,t)=>{"use strict";t.d(r,{F:()=>i});var c=t(4184),n=t.n(c),o=t(7884),l=t(2646),a=t(1473),s=t(2661);const i=e=>{const r=(e=>{const r=(0,o.Kn)(e)?e:{style:{}};let t=r.style;return(0,l.H)(t)&&(t=JSON.parse(t)||{}),(0,o.Kn)(t)||(t={}),{...r,style:t}})(e),t=(0,s.vc)(r),c=(0,s.l8)(r),i=(0,s.su)(r),u=(0,a.f)(r);return{className:n()(u.className,t.className,c.className,i.className),style:{...u.style,...t.style,...c.style,...i.style}}}},1473:(e,r,t)=>{"use strict";t.d(r,{f:()=>o});var c=t(7884),n=t(2646);const o=e=>{const r=(0,c.Kn)(e.style.typography)?e.style.typography:{},t=(0,n.H)(r.fontFamily)?r.fontFamily:"";return{className:e.fontFamily?`has-${e.fontFamily}-font-family`:t,style:{fontSize:e.fontSize?`var(--wp--preset--font-size--${e.fontSize})`:r.fontSize,fontStyle:r.fontStyle,fontWeight:r.fontWeight,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,textDecoration:r.textDecoration,textTransform:r.textTransform}}}},2661:(e,r,t)=>{"use strict";t.d(r,{l8:()=>p,su:()=>m,vc:()=>u});var c=t(4184),n=t.n(c),o=t(9784),l=t(2289),a=t(7884);function s(e={}){const r={};return(0,l.getCSSRules)(e,{selector:""}).forEach((e=>{r[e.key]=e.value})),r}function i(e,r){return e&&r?`has-${(0,o.o)(r)}-${e}`:""}function u(e){var r,t,c,o,l,u,p;const{backgroundColor:m,textColor:d,gradient:y,style:v}=e,g=i("background-color",m),f=i("color",d),b=function(e){if(e)return`has-${e}-gradient-background`}(y),N=b||(null==v||null===(r=v.color)||void 0===r?void 0:r.gradient);return{className:n()(f,b,{[g]:!N&&!!g,"has-text-color":d||(null==v||null===(t=v.color)||void 0===t?void 0:t.text),"has-background":m||(null==v||null===(c=v.color)||void 0===c?void 0:c.background)||y||(null==v||null===(o=v.color)||void 0===o?void 0:o.gradient),"has-link-color":(0,a.Kn)(null==v||null===(l=v.elements)||void 0===l?void 0:l.link)?null==v||null===(u=v.elements)||void 0===u||null===(p=u.link)||void 0===p?void 0:p.color:void 0}),style:s({color:(null==v?void 0:v.color)||{}})}}function p(e){var r;const t=(null===(r=e.style)||void 0===r?void 0:r.border)||{};return{className:function(e){var r;const{borderColor:t,style:c}=e,o=t?i("border-color",t):"";return n()({"has-border-color":!!t||!(null==c||null===(r=c.border)||void 0===r||!r.color),[o]:!!o})}(e),style:s({border:t})}}function m(e){var r;return{className:void 0,style:s({spacing:(null===(r=e.style)||void 0===r?void 0:r.spacing)||{}})}}},8519:(e,r,t)=>{"use strict";t.d(r,{F:()=>c});const c=e=>null===e},7884:(e,r,t)=>{"use strict";t.d(r,{$n:()=>o,Kn:()=>n});var c=t(8519);const n=e=>!(0,c.F)(e)&&e instanceof Object&&e.constructor===Object;function o(e,r){return n(e)&&r in e}},2646:(e,r,t)=>{"use strict";t.d(r,{H:()=>c});const c=e=>"string"==typeof e},1290:(e,r,t)=>{"use strict";t.d(r,{$:()=>o});var c=t(7582),n=t(307);function o(e,r){return void 0===r&&(r={}),(0,n.B)(e,(0,c.pi)({delimiter:"."},r))}},5138:()=>{},9562:(e,r,t)=>{"use strict";function c(e){return e.toLowerCase()}t.d(r,{U:()=>c})},307:(e,r,t)=>{"use strict";t.d(r,{B:()=>l});var c=t(9562),n=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],o=/[^A-Z0-9]+/gi;function l(e,r){void 0===r&&(r={});for(var t=r.splitRegexp,l=void 0===t?n:t,s=r.stripRegexp,i=void 0===s?o:s,u=r.transform,p=void 0===u?c.U:u,m=r.delimiter,d=void 0===m?" ":m,y=a(a(e,l,"$1\0$2"),i,"\0"),v=0,g=y.length;"\0"===y.charAt(v);)v++;for(;"\0"===y.charAt(g-1);)g--;return y.slice(v,g).split("\0").map(p).join(d)}function a(e,r,t){return r instanceof RegExp?e.replace(r,t):r.reduce((function(e,r){return e.replace(r,t)}),e)}},9784:(e,r,t)=>{"use strict";t.d(r,{o:()=>o});var c=t(7582),n=t(1290);function o(e,r){return void 0===r&&(r={}),(0,n.$)(e,(0,c.pi)({delimiter:"-"},r))}},7582:(e,r,t)=>{"use strict";t.d(r,{pi:()=>c});var c=function(){return c=Object.assign||function(e){for(var r,t=1,c=arguments.length;t<c;t++)for(var n in r=arguments[t])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e},c.apply(this,arguments)};Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError}}]);