11 lines
26 KiB
JavaScript
11 lines
26 KiB
JavaScript
|
(()=>{var e,t={2930:(e,t,r)=>{"use strict";r.r(t);var o=r(9196),l=r(5736);const n=window.wp.blocks;var c=r(1984),a=r(3183);const s=window.wp.components,i=window.wp.serverSideRender;var d=r.n(i);const u=(0,o.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"}},(0,o.createElement)("title",null,"Grid Block Preview"),(0,o.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),(0,o.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),(0,o.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),(0,o.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),(0,o.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),(0,o.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),(0,o.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),(0,o.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),(0,o.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),(0,o.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),(0,o.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),(0,o.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),(0,o.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),(0,o.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fi
|
|||
|
/* Translators: %s search term */
|
|||
|
noResults:(0,l.__)("No results for %s","woocommerce"),search:(0,l.__)("Search for items","woocommerce"),selected:e=>(0,l.sprintf)(/* translators: Number of items selected from list. */
|
|||
|
(0,l._n)("%d item selected","%d items selected",e,"woocommerce"),e),updated:(0,l.__)("Search results updated.","woocommerce")},y=(e,t=e)=>{const r=e.reduce(((e,t)=>{const r=t.parent||0;return e[r]||(e[r]=[]),e[r].push(t),e}),{}),o=("id",t.reduce(((e,t)=>(e[String(t.id)]=t,e)),{}));const l=["0"],n=(e={})=>e.parent?[...n(o[e.parent]),e.name]:e.name?[e.name]:[],c=e=>e.map((e=>{const t=r[e.id];return l.push(""+e.id),{...e,breadcrumbs:n(o[e.parent]),children:t&&t.length?c(t):[]}})),a=c(r[0]||[]);return Object.entries(r).forEach((([e,t])=>{l.includes(e)||a.push(...c(t||[]))})),a},k=(e,t)=>{if(!t)return e;const r=new RegExp(`(${t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")})`,"ig");return e.split(r).map(((e,t)=>r.test(e)?(0,o.createElement)("strong",{key:t},e):(0,o.createElement)(w.Fragment,{key:t},e)))},v=({label:e})=>(0,o.createElement)("span",{className:"woocommerce-search-list__item-count"},e),C=e=>{const{item:t,search:r}=e,l=t.breadcrumbs&&t.breadcrumbs.length;return(0,o.createElement)("span",{className:"woocommerce-search-list__item-label"},l?(0,o.createElement)("span",{className:"woocommerce-search-list__item-prefix"},1===(n=t.breadcrumbs).length?n.slice(0,1).toString():2===n.length?n.slice(0,1).toString()+" › "+n.slice(-1).toString():n.slice(0,1).toString()+" … "+n.slice(-1).toString()):null,(0,o.createElement)("span",{className:"woocommerce-search-list__item-name"},k((0,f.decodeEntities)(t.name),r)));var n},S=({countLabel:e,className:t,depth:r=0,controlId:l="",item:n,isSelected:c,isSingle:a,onSelect:i,search:d="",selected:u,useExpandedPanelId:m,...g})=>{var h,E;const[p,x]=m,y=null!=e&&void 0!==n.count&&null!==n.count,S=!(null===(h=n.breadcrumbs)||void 0===h||!h.length),N=!(null===(E=n.children)||void 0===E||!E.length),O=p===n.id,P=b()(["woocommerce-search-list__item",`depth-${r}`,t],{"has-breadcrumbs":S,"has-children":N,"has-count":y,"is-expanded":O,"is-radio-button":a}),I=g.name||`search-list-item-${l}`,R=`${I}-${n.id}`,B=(0,w.useCallback)((()=>{x(O?-1:Number(n.id))}),[O,n.id,x]);return N?(0,o.createElement)("div",{className:P,onClick:B,onKeyDown:e=>"Enter"===e.key||" "===e.key?B():null,role:"treeitem",tabIndex:0},a?(0,o.createElement)(o.Fragment,null,(0,o.createElement)("input",{type:"radio",id:R,name:I,value:n.value,onChange:i(n),onClick:e=>e.stopPropagation(),checked:c,className:"woocommerce-search-list__item-input",...g}),(0,o.createElement)(C,{item:n,search:d}),y?(0,o.createElement)(v,{label:e||n.count}):null):(0,o.createElement)(o.Fragment,null,(0,o.createElement)(s.CheckboxControl,{className:"woocommerce-search-list__item-input",checked:c,...!c&&n.children.some((e=>u.find((t=>t.id===e.id))))?{indeterminate:!0}:{},label:k((0,f.decodeEntities)(n.name),d),onChange:()=>{c?i(_(u,n.children,"id"))():i(function(e,t,r){const o=_(t,e,"id");return[...e,...o]}(u,n.children))()},onClick:e=>e.stopPropagation()}),y?(0,o.createElement)(v,{label:e||n.count}):null)):(0,o.createElement)("label",{htmlFor:R,className:P},a?(0,o.createElement)(o.Fragment,null,(0,o.createElement)("input",{...g,type:"radio",id:R,name:I,value:n.value,onChange:i(n),checked:c,className:"woocommerce-search-list__item-input"}),(0,o.createElement)(C,{item:n,search:d})):(0,o.createElement)(s.CheckboxControl,{...g,id:R,name:I,className:"woocommerce-search-list__item-input",value:(0,f.decodeEntities)(n.value),label:k((0,f.decodeEntities)(n.name),d),onChange:i(n),checked:c}),y?(0,o.createElement)(v,{label:e||n.count}):null)},N=S;var O=r(5430),P=r(4333),I=r(906);r(5932);const R=({id:e,label:t,popoverContents:r,remove:n,screenReaderLabel:a,className:i=""})=>{const[d,u]=(0,w.useState)(!1),m=(0,P.useInstanceId)(R);if(a=a||t,!t)return null;t=(0,f.decodeEntities)(t);const g=b()("woocommerce-tag",i,{"has-remove":!!n}),h=`woocommerce-tag__label-${m}`,E=(0,o.createElement)(o.Fragment,null,(0,o.createElement)("span",{className:"screen-reader-text"},a),(0,o.createElement)("span",{"aria-hidden":"true"},t));return(0,o.createElement)("span",{className:g},r?(0,o.createElement)(s.Button,{className:"woocommerce-tag__text",id:h,onClick:()=>u(!0)},E):(0,o.createElement)("span",
|
|||
|
// Translators: %s label.
|
|||
|
(0,l.__)("Remove %s","woocommerce"),t),"aria-describedby":h},(0,o.createElement)(c.Z,{icon:I.Z,size:20,className:"clear-icon",role:"img"})))},B=R;r(8462);const T=e=>(0,o.createElement)(N,{...e}),$=e=>{const{list:t,selected:r,renderItem:l,depth:n=0,onSelect:c,instanceId:a,isSingle:s,search:i,useExpandedPanelId:d}=e,[u]=d;return t?(0,o.createElement)(w.Fragment,null,t.map((t=>{var m,g;const h=null!==(m=t.children)&&void 0!==m&&m.length&&!s?t.children.every((({id:e})=>r.find((t=>t.id===e)))):!!r.find((({id:e})=>e===t.id)),E=(null===(g=t.children)||void 0===g?void 0:g.length)&&u===t.id;return(0,o.createElement)(w.Fragment,{key:t.id},(0,o.createElement)("li",null,l({item:t,isSelected:h,onSelect:c,isSingle:s,selected:r,search:i,depth:n,useExpandedPanelId:d,controlId:a})),E?(0,o.createElement)($,{...e,list:t.children,depth:n+1}):null)}))):null},A=({isLoading:e,isSingle:t,selected:r,messages:n,onChange:c,onRemove:a})=>{if(e||t||!r)return null;const i=r.length;return(0,o.createElement)("div",{className:"woocommerce-search-list__selected"},(0,o.createElement)("div",{className:"woocommerce-search-list__selected-header"},(0,o.createElement)("strong",null,n.selected(i)),i>0?(0,o.createElement)(s.Button,{isLink:!0,isDestructive:!0,onClick:()=>c([]),"aria-label":n.clear},(0,l.__)("Clear all","woocommerce")):null),i>0?(0,o.createElement)("ul",null,r.map(((e,t)=>(0,o.createElement)("li",{key:t},(0,o.createElement)(B,{label:e.name,id:e.id,remove:a}))))):null)},F=({filteredList:e,search:t,onSelect:r,instanceId:n,useExpandedPanelId:a,...s})=>{const{messages:i,renderItem:d,selected:u,isSingle:m}=s,g=d||T;return 0===e.length?(0,o.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},(0,o.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},(0,o.createElement)(c.Z,{icon:O.Z,role:"img"})),(0,o.createElement)("span",{className:"woocommerce-search-list__not-found-text"},t?(0,l.sprintf)(i.noResults,t):i.noItems)):(0,o.createElement)("ul",{className:"woocommerce-search-list__list"},(0,o.createElement)($,{useExpandedPanelId:a,list:e,selected:u,renderItem:g,onSelect:r,instanceId:n,isSingle:m,search:t}))},j=e=>{const{className:t="",isCompact:r,isHierarchical:n,isLoading:c,isSingle:a,list:i,messages:d=x,onChange:u,onSearch:m,selected:g,type:h="text",debouncedSpeak:E}=e,[p,_]=(0,w.useState)(""),f=(0,w.useState)(-1),k=(0,P.useInstanceId)(j),v=(0,w.useMemo)((()=>({...x,...d})),[d]),C=(0,w.useMemo)((()=>((e,t,r)=>{if(!t)return r?y(e):e;const o=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),l=e.map((e=>!!o.test(e.name)&&e)).filter(Boolean);return r?y(l,e):l})(i,p,n)),[i,p,n]);(0,w.useEffect)((()=>{E&&E(v.updated)}),[E,v]),(0,w.useEffect)((()=>{"function"==typeof m&&m(p)}),[p,m]);const S=(0,w.useCallback)((e=>()=>{a&&u([]);const t=g.findIndex((({id:t})=>t===e));u([...g.slice(0,t),...g.slice(t+1)])}),[a,g,u]),N=(0,w.useCallback)((e=>()=>{Array.isArray(e)?u(e):-1===g.findIndex((({id:t})=>t===e.id))?u(a?[e]:[...g,e]):S(e.id)()}),[a,S,u,g]),O=(0,w.useCallback)((e=>{const[t]=g.filter((t=>!e.find((e=>t.id===e.id))));S(t.id)()}),[S,g]);return(0,o.createElement)("div",{className:b()("woocommerce-search-list",t,{"is-compact":r,"is-loading":c,"is-token":"token"===h})},"text"===h&&(0,o.createElement)(A,{...e,onRemove:S,messages:v}),(0,o.createElement)("div",{className:"woocommerce-search-list__search"},"text"===h?(0,o.createElement)(s.TextControl,{label:v.search,type:"search",value:p,onChange:e=>_(e)}):(0,o.createElement)(s.FormTokenField,{disabled:c,label:v.search,onChange:O,onInputChange:e=>_(e),suggestions:[],__experimentalValidateInput:()=>!1,value:c?[(0,l.__)("Loading…","woocommerce")]:g.map((e=>({...e,value:e.name}))),__experimentalShowHowTo:!1})),c?(0,o.createElement)("div",{className:"woocommerce-search-list__list"},(0,o.createElement)(s.Spinner,null)):(0,o.createElement)(F,{...e,search:p,filteredList:C,messages:v,onSelect:N,instanceId:k,useExpandedPanelId:f}))},L=((0,s.withSpokenMessages)(j),window.wp.url),M=window.wp.apiFetch;var Z=r.n(M);const H=window.wc.wcSettings,D=(0,P.createHigherOrderCompone
|
|||
|
(0,l._n)("%d category selected","%d categories selected",e,"woocommerce"),e),updated:(0,l.__)("Category search results updated.","woocommerce")};return t?(0,o.createElement)(W,{error:t}):(0,o.createElement)(o.Fragment,null,(0,o.createElement)(j,{className:"woocommerce-product-categories",list:e,isLoading:r,selected:i.map((t=>e.find((e=>e.id===t)))).filter(Boolean),onChange:n,renderItem:e=>{const{item:t,search:r,depth:n=0}=e,c=t.breadcrumbs.length?`${t.breadcrumbs.join(", ")}, ${t.name}`:t.name,a=m?(0,l.sprintf)(/* translators: %1$s is the item name, %2$d is the count of reviews for the item. */
|
|||
|
(0,l._n)("%1$s, has %2$d review","%1$s, has %2$d reviews",t.review_count,"woocommerce"),c,t.review_count):(0,l.sprintf)(/* translators: %1$s is the item name, %2$d is the count of products for the item. */
|
|||
|
(0,l._n)("%1$s, has %2$d product","%1$s, has %2$d products",t.count,"woocommerce"),c,t.count),s=m?(0,l.sprintf)(/* translators: %d is the count of reviews. */
|
|||
|
(0,l._n)("%d review","%d reviews",t.review_count,"woocommerce"),t.review_count):(0,l.sprintf)(/* translators: %d is the count of products. */
|
|||
|
(0,l._n)("%d product","%d products",t.count,"woocommerce"),t.count);return(0,o.createElement)(S,{className:b()("woocommerce-product-categories__item","has-count",{"is-searching":r.length>0,"is-skip-level":0===n&&0!==t.parent}),...e,countLabel:s,"aria-label":a})},messages:g,isCompact:d,isHierarchical:!0,isSingle:u}),!!c&&(0,o.createElement)("div",{hidden:i.length<2},(0,o.createElement)(s.SelectControl,{className:"woocommerce-product-categories__operator",label:(0,l.__)("Display products matching","woocommerce"),help:(0,l.__)("Pick at least two categories to use this setting.","woocommerce"),value:a,onChange:c,options:[{label:(0,l.__)("Any selected categories","woocommerce"),value:"any"},{label:(0,l.__)("All selected categories","woocommerce"),value:"all"}]})))};J.defaultProps={operator:"any",isCompact:!1,isSingle:!1};const z=D(J),G=({value:e,setAttributes:t})=>(0,o.createElement)(s.SelectControl,{label:(0,l.__)("Order products by","woocommerce"),value:e,options:[{label:(0,l.__)("Newness - newest first","woocommerce"),value:"date"},{label:(0,l.__)("Price - low to high","woocommerce"),value:"price_asc"},{label:(0,l.__)("Price - high to low","woocommerce"),value:"price_desc"},{label:(0,l.__)("Rating - highest first","woocommerce"),value:"rating"},{label:(0,l.__)("Sales - most first","woocommerce"),value:"popularity"},{label:(0,l.__)("Title - alphabetical","woocommerce"),value:"title"},{label:(0,l.__)("Menu Order","woocommerce"),value:"menu_order"}],onChange:e=>t({orderby:e})}),K=(0,H.getSetting)("hideOutOfStockItems",!1),Q=(0,H.getSetting)("stockStatusOptions",{}),Y=({value:e,setAttributes:t})=>{const{outofstock:r,...n}=Q,c=K?n:Q,a=Object.entries(c).map((([e,t])=>({value:e,label:t}))).filter((e=>!!e.label)),i=Object.keys(c).filter((e=>!!e)),[d,u]=(0,w.useState)(e||i);(0,w.useEffect)((()=>{t({stockStatus:["",...d]})}),[d,t]);const m=(0,w.useCallback)((e=>{const t=d.includes(e),r=d.filter((t=>t!==e));t||(r.push(e),r.sort()),u(r)}),[d]);return(0,o.createElement)(o.Fragment,null,a.map((e=>{const t=d.includes(e.value)?/* translators: %s stock status. */(0,l.__)('Stock status "%s" visible.',"woocommerce"):/* translators: %s stock status. */(0,l.__)('Stock status "%s" hidden.',"woocommerce");return(0,o.createElement)(s.ToggleControl,{label:e.label,key:e.value,help:(0,l.sprintf)(t,e.label),checked:d.includes(e.value),onChange:()=>m(e.value)})})))},q=e=>{const{attributes:t,setAttributes:r}=e,{categories:n,catOperator:c,columns:a,contentVisibility:i,rows:d,orderby:u,alignButtons:h,stockStatus:p}=t;return(0,o.createElement)(m.InspectorControls,{key:"inspector"},(0,o.createElement)(s.PanelBody,{title:(0,l.__)("Layout","woocommerce"),initialOpen:!0},(0,o.createElement)(E,{columns:a,rows:d,alignButtons:h,setAttributes:r,minColumns:(0,H.getSetting)("minColumns",1),maxColumns:(0,H.getSetting)("maxColumns",6),minRows:(0,H.getSetting)("minRows",1),maxRows:(0,H.getSetting)("maxRows",6)})),(0,o.createElement)(s.PanelBody,{title:(0,l.__)("Content","woocommerce"),initialOpen:!0},(0,o.createElement)(g,{settings:i,onChange:e=>r({contentVisibility:e})})),(0,o.createElement)(s.PanelBody,{title:(0,l.__)("Order By","woocommerce"),initialOpen:!1},(0,o.createElement)(G,{setAttributes:r,value:u})),(0,o.createElement)(s.PanelBody,{title:(0,l.__)("Filter by Product Category","woocommerce"),initialOpen:!1},(0,o.createElement)(z,{selected:n,onChange:(e=[])=>{const t=e.map((({id:e})=>e));r({categories:t})},operator:c,onOperatorChange:(e="any")=>r({catOperator:e})})),(0,o.createElement)(s.PanelBody,{title:(0,l.__)("Filter by stock status","woocommerce"),initialOpen:!1},(0,o.createElement)(Y,{setAttributes:r,value:p})))},U=()=>(0,o.createElement)(s.Placeholder,{icon:(0,o.createElement)(c.Z,{icon:a.Z}),label:(0,l.__)("On Sale Products","woocommerce"),className:"wc-block-product-on-sale"},(0,l.__)("This block shows on-sale products. There are currently no discounted products in your store.","woocommerce")),X=e=>{const{attributes:t,setAttributes:r,name:l}=e;return t.isPreview?u:(0,o.createElement)(o.Fragment,null,(0,o.createElement)(q,{attributes:t,setAttributes:r
|