2 lines
7.1 KiB
JavaScript
2 lines
7.1 KiB
JavaScript
|
(self.webpackChunkwebpackWcBlocksJsonp=self.webpackChunkwebpackWcBlocksJsonp||[]).push([[3706,5432],{4304:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>b});var o=n(721),r=n(9196),l=n(9307),a=n(5736),s=n(4184),c=n.n(s),i=n(4617),u=n(2864),d=n(3611),p=n(5918),g=n(4498);n(8854);let f=function(e){return e.SINGLE="single",e.THUMBNAIL="thumbnail",e}({});const m=e=>(0,r.createElement)("img",{...e,src:i.PLACEHOLDER_IMG_SRC,alt:"",width:void 0,height:void 0}),h=({image:e,loaded:t,showFullSize:n,fallbackAlt:o,width:a,scale:s,height:c,aspectRatio:i})=>{const{thumbnail:u,src:d,srcset:p,sizes:g,alt:f}=e||{},h={alt:f||o,hidden:!t,src:u,...n&&{src:d,srcSet:p,sizes:g}},y={height:c,width:a,objectFit:s,aspectRatio:i};return(0,r.createElement)(l.Fragment,null,h.src&&(0,r.createElement)("img",{style:y,"data-testid":"product-image",...h}),!e&&(0,r.createElement)(m,{style:y}))},y=(0,o.withProductDataContext)((e=>{const{className:t,imageSizing:n=f.SINGLE,showProductLink:o=!0,showSaleBadge:s,saleBadgeAlign:i="right",height:y,width:v,scale:b,aspectRatio:k,...w}=e,S=(0,d.F)(e),{parentClassName:N}=(0,u.useInnerBlockLayoutContext)(),{product:E,isLoading:C}=(0,u.useProductDataContext)(),{dispatchStoreEvent:L}=(0,p.n)();if(!E.id)return(0,r.createElement)("div",{className:c()(t,"wc-block-components-product-image",{[`${N}__product-image`]:N},S.className),style:S.style},(0,r.createElement)(m,null));const x=!!E.images.length,F=x?E.images[0]:null,_=o?"a":l.Fragment,A=(0,a.sprintf)(/* translators: %s is referring to the product name */
|
||
|
(0,a.__)("Link to %s","woocommerce"),E.name),B={href:E.permalink,...!x&&{"aria-label":A},onClick:()=>{L("product-view-link",{product:E})}};return(0,r.createElement)("div",{className:c()(t,"wc-block-components-product-image",{[`${N}__product-image`]:N},S.className),style:S.style},(0,r.createElement)(_,{...o&&B},!!s&&(0,r.createElement)(g.default,{align:i,...w}),(0,r.createElement)(h,{fallbackAlt:E.name,image:F,loaded:!C,showFullSize:n!==f.THUMBNAIL,width:v,height:y,scale:b,aspectRatio:k})))})),v={showProductLink:{type:"boolean",default:!0},showSaleBadge:{type:"boolean",default:!0},saleBadgeAlign:{type:"string",default:"right"},imageSizing:{type:"string",default:f.SINGLE},productId:{type:"number",default:0},isDescendentOfQueryLoop:{type:"boolean",default:!1},isDescendentOfSingleProductBlock:{type:"boolean",default:!1},width:{type:"string"},height:{type:"string"},scale:{type:"string",default:"cover"},aspectRatio:{type:"string"}},b=(0,o.withFilteredAttributes)(v)(y)},4498:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Block:()=>d,default:()=>p});var o=n(9196),r=n(5736),l=n(4184),a=n.n(l),s=n(711),c=n(2864),i=n(3611),u=n(721);n(1314);const d=e=>{const{className:t,align:n}=e,l=(0,i.F)(e),{parentClassName:u}=(0,c.useInnerBlockLayoutContext)(),{product:d}=(0,c.useProductDataContext)();if(!(d.id&&d.on_sale||e.isDescendentOfSingleProductTemplate))return null;const p="string"==typeof n?`wc-block-components-product-sale-badge--align-${n}`:"";return(0,o.createElement)("div",{className:a()("wc-block-components-product-sale-badge",t,p,{[`${u}__product-onsale`]:u},l.className),style:l.style},(0,o.createElement)(s.Label,{label:(0,r.__)("Sale","woocommerce"),screenReaderLabel:(0,r.__)("Product on sale","woocommerce")}))},p=(0,u.withProductDataContext)(d)},3611:(e,t,n)=>{"use strict";n.d(t,{F:()=>i});var o=n(4184),r=n.n(o),l=n(7884),a=n(2646),s=n(1473),c=n(2661);const i=e=>{const t=(e=>{const t=(0,l.Kn)(e)?e:{style:{}};let n=t.style;return(0,a.H)(n)&&(n=JSON.parse(n)||{}),(0,l.Kn)(n)||(n={}),{...t,style:n}})(e),n=(0,c.vc)(t),o=(0,c.l8)(t),i=(0,c.su)(t),u=(0,s.f)(t);return{className:r()(u.className,n.className,o.className,i.className),style:{...u.style,...n.style,...o.style,...i.style}}}},1473:(e,t,n)=>{"use strict";n.d(t,{f:()=>l});var o=n(7884),r=n(2646);const l=e=>{const t=(0,o.Kn)(e.style.typography)?e.style.typography:{},n=(0,r.H)(t.fontFamily)?t.fontFamily:"";return{className:e.fontFamily?`has-${e.fontFamily}-font-family`:n,style:{fontSize:e.fontSize?`var(--wp--preset--font-size--${e.fontSize})`:t.fontSize,fontStyle:t.fontStyle,fontWeight:t.fontWeight,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,textDecoration:t.textDecoration,textTransform:t.textTransform}}}},2661:(e,t,n)=>{"use strict";n.d(t,{l8:()=>d,su:()=>p,vc:()=>u});var o=n(4184),r=n.n(o),l=n(9784),a=n(2289),s=n(7884);function c(e={}){const t={};return(0,a.getCSSRules)(e,{selector:""}).forEach((e=>{t[e.key]=e.value})),t}function i(e,t){return e&&t?`has-${(0,l.o)(t)}-${e}`:""}function u(e){var t,n,o,l,a,u,d;const{backgroundColor:p,textColor:g,gradient:f,style:m}=e,h=i("background-color",p),y=i("color",g),v=function(e){if(e)return`has-${e}-gradient-background`}(f),b=v||(null==m||null===(t=m.color)||void 0===t?void 0:t.gradient);return{className:r()(y,v,{[h]:!b&&!!h,"has-text-color":g||(null==m||null===(n=m.color)||void 0===n?void 0:n.text),"has-background":p||(null==m||null===(o=m.color)||void 0===o?void 0:o.background)||f||(null==m||null===(l=m.color)||void 0===l?void 0:l.gradient),"has-link-color":(0,s.Kn)(null==m||null===(a=m.elements)||void 0===a?void 0:a.link)?null==m||null===(u=m.elements)||void 0===u||null===(d=u.link)||void 0===d?void 0:d.color:void 0}),style:c({color:(null==m?void 0:m.color)||{}})}}function d(e){var t;const n=(null===(t=e.style)||void 0===t?void 0:t.border)||{};return{className:function(e){var t;const{borderColor:n,style:o}=e,l=n?i("border-color",n):"";return r()({"has-border-color":!!n||!(null==o||null===(t=o.border)||void 0===t||!t.color),[l]:!!l})}(e),style:c({border:n})}}function p(e){var t;return{className:void 0,style:c({spacing:(null===(t=e.style)
|