File "reviews-by-product.js"
Full Path: /home/jlklyejr/public_html/wp-content/test/wp-content/plugins/woocommerce/assets/client/blocks/reviews-by-product.js
File size: 43.05 KB
MIME-type: text/plain
Charset: utf-8
(()=>{var e,t={42:(e,t,r)=>{"use strict";r.r(t);var o=r(9196),a=r(5736);const n=window.wp.blocks;var s=r(2911),i=r(6554);r(6097);const c=window.wp.blockEditor,l=window.wp.components;var d=r(3849),m=r.n(d),u=r(9307);function p(e,t,r){const o=new Set(t.map((e=>e[r])));return e.filter((e=>!o.has(e[r])))}const w=window.wp.htmlEntities,h={clear:(0,a.__)("Clear all selected items","woocommerce"),noItems:(0,a.__)("No items found.","woocommerce"),
/* Translators: %s search term */
noResults:(0,a.__)("No results for %s","woocommerce"),search:(0,a.__)("Search for items","woocommerce"),selected:e=>(0,a.sprintf)(/* translators: Number of items selected from list. */ /* translators: Number of items selected from list. */
(0,a._n)("%d item selected","%d items selected",e,"woocommerce"),e),updated:(0,a.__)("Search results updated.","woocommerce")},v=(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 a=["0"],n=(e={})=>e.parent?[...n(o[e.parent]),e.name]:e.name?[e.name]:[],s=e=>e.map((e=>{const t=r[e.id];return a.push(""+e.id),{...e,breadcrumbs:n(o[e.parent]),children:t&&t.length?s(t):[]}})),i=s(r[0]||[]);return Object.entries(r).forEach((([e,t])=>{a.includes(e)||i.push(...s(t||[]))})),i},g=(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)(u.Fragment,{key:t},e)))},_=({label:e})=>(0,o.createElement)("span",{className:"woocommerce-search-list__item-count"},e),b=e=>{const{item:t,search:r}=e,a=t.breadcrumbs&&t.breadcrumbs.length;return(0,o.createElement)("span",{className:"woocommerce-search-list__item-label"},a?(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"},g((0,w.decodeEntities)(t.name),r)));var n},E=({countLabel:e,className:t,depth:r=0,controlId:a="",item:n,isSelected:s,isSingle:i,onSelect:c,search:d="",selected:h,useExpandedPanelId:v,...E})=>{var y,f;const[k,R]=v,S=null!=e&&void 0!==n.count&&null!==n.count,C=!(null===(y=n.breadcrumbs)||void 0===y||!y.length),N=!(null===(f=n.children)||void 0===f||!f.length),P=k===n.id,I=m()(["woocommerce-search-list__item",`depth-${r}`,t],{"has-breadcrumbs":C,"has-children":N,"has-count":S,"is-expanded":P,"is-radio-button":i}),L=E.name||`search-list-item-${a}`,x=`${L}-${n.id}`,O=(0,u.useCallback)((()=>{R(P?-1:Number(n.id))}),[P,n.id,R]);return N?(0,o.createElement)("div",{className:I,onClick:O,onKeyDown:e=>"Enter"===e.key||" "===e.key?O():null,role:"treeitem",tabIndex:0},i?(0,o.createElement)(o.Fragment,null,(0,o.createElement)("input",{type:"radio",id:x,name:L,value:n.value,onChange:c(n),onClick:e=>e.stopPropagation(),checked:s,className:"woocommerce-search-list__item-input",...E}),(0,o.createElement)(b,{item:n,search:d}),S?(0,o.createElement)(_,{label:e||n.count}):null):(0,o.createElement)(o.Fragment,null,(0,o.createElement)(l.CheckboxControl,{className:"woocommerce-search-list__item-input",checked:s,...!s&&n.children.some((e=>h.find((t=>t.id===e.id))))?{indeterminate:!0}:{},label:g((0,w.decodeEntities)(n.name),d),onChange:()=>{s?c(p(h,n.children,"id"))():c(function(e,t,r){const o=p(t,e,"id");return[...e,...o]}(h,n.children))()},onClick:e=>e.stopPropagation()}),S?(0,o.createElement)(_,{label:e||n.count}):null)):(0,o.createElement)("label",{htmlFor:x,className:I},i?(0,o.createElement)(o.Fragment,null,(0,o.createElement)("input",{...E,type:"radio",id:x,name:L,value:n.value,onChange:c(n),checked:s,className:"woocommerce-search-list__item-input"}),(0,o.createElement)(b,{item:n,search:d})):(0,o.createElement)(l.CheckboxControl,{...E,id:x,name:L,className:"woocommerce-search-list__item-input",value:(0,w.decodeEntities)(n.value),label:g((0,w.decodeEntities)(n.name),d),onChange:c(n),checked:s}),S?(0,o.createElement)(_,{label:e||n.count}):null)},y=E;var f=r(2720),k=r(4333),R=r(837);r(1058);const S=({id:e,label:t,popoverContents:r,remove:n,screenReaderLabel:i,className:c=""})=>{const[d,p]=(0,u.useState)(!1),h=(0,k.useInstanceId)(S);if(i=i||t,!t)return null;t=(0,w.decodeEntities)(t);const v=m()("woocommerce-tag",c,{"has-remove":!!n}),g=`woocommerce-tag__label-${h}`,_=(0,o.createElement)(o.Fragment,null,(0,o.createElement)("span",{className:"screen-reader-text"},i),(0,o.createElement)("span",{"aria-hidden":"true"},t));return(0,o.createElement)("span",{className:v},r?(0,o.createElement)(l.Button,{className:"woocommerce-tag__text",id:g,onClick:()=>p(!0)},_):(0,o.createElement)("span",{className:"woocommerce-tag__text",id:g},_),r&&d&&(0,o.createElement)(l.Popover,{onClose:()=>p(!1)},r),n&&(0,o.createElement)(l.Button,{className:"woocommerce-tag__remove",onClick:n(e),label:(0,a.sprintf)(
// Translators: %s label.
// Translators: %s label.
(0,a.__)("Remove %s","woocommerce"),t),"aria-describedby":g},(0,o.createElement)(s.Z,{icon:R.Z,size:20,className:"clear-icon",role:"img"})))},C=S;r(9658);const N=e=>(0,o.createElement)(y,{...e}),P=e=>{const{list:t,selected:r,renderItem:a,depth:n=0,onSelect:s,instanceId:i,isSingle:c,search:l,useExpandedPanelId:d}=e,[m]=d;return t?(0,o.createElement)(u.Fragment,null,t.map((t=>{var p,w;const h=null!==(p=t.children)&&void 0!==p&&p.length&&!c?t.children.every((({id:e})=>r.find((t=>t.id===e)))):!!r.find((({id:e})=>e===t.id)),v=(null===(w=t.children)||void 0===w?void 0:w.length)&&m===t.id;return(0,o.createElement)(u.Fragment,{key:t.id},(0,o.createElement)("li",null,a({item:t,isSelected:h,onSelect:s,isSingle:c,selected:r,search:l,depth:n,useExpandedPanelId:d,controlId:i})),v?(0,o.createElement)(P,{...e,list:t.children,depth:n+1}):null)}))):null},I=({isLoading:e,isSingle:t,selected:r,messages:n,onChange:s,onRemove:i})=>{if(e||t||!r)return null;const c=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(c)),c>0?(0,o.createElement)(l.Button,{variant:"link",isDestructive:!0,onClick:()=>s([]),"aria-label":n.clear},(0,a.__)("Clear all","woocommerce")):null),c>0?(0,o.createElement)("ul",null,r.map(((e,t)=>(0,o.createElement)("li",{key:t},(0,o.createElement)(C,{label:e.name,id:e.id,remove:i}))))):null)},L=({filteredList:e,search:t,onSelect:r,instanceId:n,useExpandedPanelId:i,...c})=>{const{messages:l,renderItem:d,selected:m,isSingle:u}=c,p=d||N;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)(s.Z,{icon:f.Z,role:"img"})),(0,o.createElement)("span",{className:"woocommerce-search-list__not-found-text"},t?(0,a.sprintf)(l.noResults,t):l.noItems)):(0,o.createElement)("ul",{className:"woocommerce-search-list__list"},(0,o.createElement)(P,{useExpandedPanelId:i,list:e,selected:m,renderItem:p,onSelect:r,instanceId:n,isSingle:u,search:t}))},x=e=>{const{className:t="",isCompact:r,isHierarchical:n,isLoading:s,isSingle:i,list:c,messages:d=h,onChange:p,onSearch:w,selected:g,type:_="text",debouncedSpeak:b}=e,[E,y]=(0,u.useState)(""),f=(0,u.useState)(-1),R=(0,k.useInstanceId)(x),S=(0,u.useMemo)((()=>({...h,...d})),[d]),C=(0,u.useMemo)((()=>((e,t,r)=>{if(!t)return r?v(e):e;const o=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),a=e.map((e=>!!o.test(e.name)&&e)).filter(Boolean);return r?v(a,e):a})(c,E,n)),[c,E,n]);(0,u.useEffect)((()=>{b&&b(S.updated)}),[b,S]),(0,u.useEffect)((()=>{"function"==typeof w&&w(E)}),[E,w]);const N=(0,u.useCallback)((e=>()=>{i&&p([]);const t=g.findIndex((({id:t})=>t===e));p([...g.slice(0,t),...g.slice(t+1)])}),[i,g,p]),P=(0,u.useCallback)((e=>()=>{Array.isArray(e)?p(e):-1===g.findIndex((({id:t})=>t===e.id))?p(i?[e]:[...g,e]):N(e.id)()}),[i,N,p,g]),O=(0,u.useCallback)((e=>{const[t]=g.filter((t=>!e.find((e=>t.id===e.id))));N(t.id)()}),[N,g]);return(0,o.createElement)("div",{className:m()("woocommerce-search-list",t,{"is-compact":r,"is-loading":s,"is-token":"token"===_})},"text"===_&&(0,o.createElement)(I,{...e,onRemove:N,messages:S}),(0,o.createElement)("div",{className:"woocommerce-search-list__search"},"text"===_?(0,o.createElement)(l.TextControl,{label:S.search,type:"search",value:E,onChange:e=>y(e)}):(0,o.createElement)(l.FormTokenField,{disabled:s,label:S.search,onChange:O,onInputChange:e=>y(e),suggestions:[],__experimentalValidateInput:()=>!1,value:s?[(0,a.__)("Loading…","woocommerce")]:g.map((e=>({...e,value:e.name}))),__experimentalShowHowTo:!1})),s?(0,o.createElement)("div",{className:"woocommerce-search-list__list"},(0,o.createElement)(l.Spinner,null)):(0,o.createElement)(L,{...e,search:E,filteredList:C,messages:S,onSelect:P,instanceId:R,useExpandedPanelId:f}))},O=((0,l.withSpokenMessages)(x),e=>t=>{let{selected:r}=t;r=void 0===r?null:r;const a=null===r;return Array.isArray(r)?(0,o.createElement)(e,{...t}):(0,o.createElement)(e,{...t,selected:a?[]:[r]})}),T=window.wc.wcSettings;var A,M,j,D,Z,$,F,B,H,G;const V=(0,T.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),U=(V.pluginUrl,V.pluginUrl,V.buildPhase,null===(A=T.STORE_PAGES.shop)||void 0===A||A.permalink,null===(M=T.STORE_PAGES.checkout)||void 0===M||M.id,null===(j=T.STORE_PAGES.checkout)||void 0===j||j.permalink,null===(D=T.STORE_PAGES.privacy)||void 0===D||D.permalink,null===(Z=T.STORE_PAGES.privacy)||void 0===Z||Z.title,null===($=T.STORE_PAGES.terms)||void 0===$||$.permalink,null===(F=T.STORE_PAGES.terms)||void 0===F||F.title,null===(B=T.STORE_PAGES.cart)||void 0===B||B.id,null===(H=T.STORE_PAGES.cart)||void 0===H||H.permalink,null!==(G=T.STORE_PAGES.myaccount)&&void 0!==G&&G.permalink?T.STORE_PAGES.myaccount.permalink:(0,T.getSetting)("wpLoginUrl","/wp-login.php"),(0,T.getSetting)("localPickupEnabled",!1),(0,T.getSetting)("countries",{})),W=(0,T.getSetting)("countryData",{}),q=(Object.fromEntries(Object.keys(W).filter((e=>!0===W[e].allowBilling)).map((e=>[e,U[e]||""]))),Object.fromEntries(Object.keys(W).filter((e=>!0===W[e].allowBilling)).map((e=>[e,W[e].states||[]]))),Object.fromEntries(Object.keys(W).filter((e=>!0===W[e].allowShipping)).map((e=>[e,U[e]||""]))),Object.fromEntries(Object.keys(W).filter((e=>!0===W[e].allowShipping)).map((e=>[e,W[e].states||[]]))),Object.fromEntries(Object.keys(W).map((e=>[e,W[e].locale||[]]))),{address:["first_name","last_name","company","address_1","address_2","city","postcode","country","state","phone"],contact:["email"],additional:[]}),J=((0,T.getSetting)("addressFieldsLocations",q).address,(0,T.getSetting)("addressFieldsLocations",q).contact,(0,T.getSetting)("addressFieldsLocations",q).additional,(0,T.getSetting)("additionalFields",{}),(0,T.getSetting)("additionalContactFields",{}),(0,T.getSetting)("additionalAddressFields",{}),window.wp.url),z=window.wp.apiFetch;var Q=r.n(z);const K=({selected:e=[],search:t="",queryArgs:r={}})=>{const o=(({selected:e=[],search:t="",queryArgs:r={}})=>{const o=V.productCount>100,a={per_page:o?100:0,catalog_visibility:"any",search:t,orderby:"title",order:"asc"},n=[(0,J.addQueryArgs)("/wc/store/v1/products",{...a,...r})];return o&&e.length&&n.push((0,J.addQueryArgs)("/wc/store/v1/products",{catalog_visibility:"any",include:e,per_page:0})),n})({selected:e,search:t,queryArgs:r});return Promise.all(o.map((e=>Q()({path:e})))).then((e=>{const t=((e,t)=>{const r=new Map;return e.filter((e=>{const o=t(e);return!r.has(o)&&(r.set(o,e),!0)}))})(e.flat(),(e=>e.id));return t.map((e=>({...e,parent:0})))})).catch((e=>{throw e}))};var Y=r(2600);const X=async e=>{if(!("json"in e))return{message:e.message,type:e.type||"general"};try{const t=await e.json();return{message:t.message,type:t.type||"api"}}catch(e){return{message:e.message,type:"general"}}};var ee=r(7708),te=r(9127),re=r.n(te);const oe=(0,k.createHigherOrderComponent)((e=>{class t extends u.Component{constructor(...e){super(...e),(0,ee.Z)(this,"state",{error:null,loading:!1,variations:{}}),(0,ee.Z)(this,"loadVariations",(()=>{const{products:e}=this.props,{loading:t,variations:r}=this.state;if(t)return;const o=this.getExpandedProduct();if(!o||r[o])return;const a=e.find((e=>e.id===o));var n;a.variations&&0!==a.variations.length?(this.setState({loading:!0}),(n=o,Q()({path:(0,J.addQueryArgs)("wc/store/v1/products",{per_page:0,type:"variation",parent:n})})).then((e=>{const t=e.map((e=>({...e,parent:o})));this.setState({variations:{...this.state.variations,[o]:t},loading:!1,error:null})})).catch((async e=>{const t=await X(e);this.setState({variations:{...this.state.variations,[o]:null},loading:!1,error:t})}))):this.setState({variations:{...this.state.variations,[o]:null},loading:!1,error:null})}))}componentDidMount(){const{selected:e,showVariations:t}=this.props;e&&t&&this.loadVariations()}componentDidUpdate(e){const{isLoading:t,selected:r,showVariations:o}=this.props;o&&(!re()(e.selected,r)||e.isLoading&&!t)&&this.loadVariations()}isProductId(e){const{products:t}=this.props;return t.some((t=>t.id===e))}findParentProduct(e){var t;const{products:r}=this.props;return null===(t=r.filter((t=>t.variations&&t.variations.find((({id:t})=>t===e))))[0])||void 0===t?void 0:t.id}getExpandedProduct(){const{isLoading:e,selected:t,showVariations:r}=this.props;if(!r)return null;let o=t&&t.length?t[0]:null;return o?this.prevSelectedItem=o:this.prevSelectedItem&&(e||this.isProductId(this.prevSelectedItem)||(o=this.prevSelectedItem)),!e&&o?this.isProductId(o)?o:this.findParentProduct(o):null}render(){const{error:t,isLoading:r}=this.props,{error:a,loading:n,variations:s}=this.state;return(0,o.createElement)(e,{...this.props,error:a||t,expandedProduct:this.getExpandedProduct(),isLoading:r,variations:s,variationsLoading:n})}}return(0,ee.Z)(t,"defaultProps",{selected:[],showVariations:!1}),t}),"withProductVariations"),ae=e=>{const{id:t,name:r,parent:o}=e;return{id:t,name:r,parent:o,breadcrumbs:[],children:[],details:e,value:e.slug}},ne=window.wp.escapeHtml,se=({error:e})=>(0,o.createElement)("div",{className:"wc-block-error-message"},(({message:e,type:t})=>e?"general"===t?(0,o.createElement)("span",null,(0,a.__)("The following error was returned","woocommerce"),(0,o.createElement)("br",null),(0,o.createElement)("code",null,(0,ne.escapeHTML)(e))):"api"===t?(0,o.createElement)("span",null,(0,a.__)("The following error was returned from the API","woocommerce"),(0,o.createElement)("br",null),(0,o.createElement)("code",null,(0,ne.escapeHTML)(e))):e:(0,a.__)("An error has prevented the block from being updated.","woocommerce"))(e)),ie=({className:e,item:t,isSelected:r,isLoading:a,onSelect:n,disabled:s,...i})=>(0,o.createElement)(o.Fragment,null,(0,o.createElement)(E,{...i,key:t.id,className:e,isSelected:r,item:t,onSelect:n,disabled:s}),r&&a&&(0,o.createElement)("div",{key:"loading",className:m()("woocommerce-search-list__item","woocommerce-product-attributes__item","depth-1","is-loading","is-not-active")},(0,o.createElement)(l.Spinner,null)));r(8550);const ce={list:(0,a.__)("Products","woocommerce"),noItems:(0,a.__)("Your store doesn't have any products.","woocommerce"),search:(0,a.__)("Search for a product to display","woocommerce"),updated:(0,a.__)("Product search results updated.","woocommerce")},le=O((de=oe((0,k.withInstanceId)((e=>{const{expandedProduct:t=null,error:r,instanceId:n,isCompact:s=!1,isLoading:i,onChange:c,onSearch:l,products:d,renderItem:u,selected:p=[],showVariations:w=!1,variations:h,variationsLoading:v}=e;if(r)return(0,o.createElement)(se,{error:r});const g=[...d,...h&&t&&h[t]?h[t]:[]].map(ae);return(0,o.createElement)(x,{className:"woocommerce-products",list:g,isCompact:s,isLoading:i,isSingle:!0,selected:g.filter((({id:e})=>p.includes(Number(e)))),onChange:c,renderItem:u||(w?e=>{var t,r,s,c;const{item:l,search:d,depth:u=0,isSelected:p,onSelect:w}=e,h=null!==(t=l.details)&&void 0!==t&&t.variations&&Array.isArray(l.details.variations)?l.details.variations.length:0,g=m()("woocommerce-search-product__item","woocommerce-search-list__item",`depth-${u}`,"has-count",{"is-searching":d.length>0,"is-skip-level":0===u&&0!==l.parent,"is-variable":h>0});if(!l.breadcrumbs.length){var _,b,y,f,k;const t=(null===(_=l.details)||void 0===_?void 0:_.variations)&&l.details.variations.length>0;return(0,o.createElement)(ie,{...e,className:m()(g,{"is-selected":p}),isSelected:p,item:l,onSelect:()=>()=>{w(l)()},isLoading:i||v,countLabel:t?(0,a.sprintf)(/* translators: %1$d is the number of variations of a product product. */ /* translators: %1$d is the number of variations of a product product. */
(0,a.__)("%1$d variations","woocommerce"),null===(b=l.details)||void 0===b?void 0:b.variations.length):null,name:`products-${n}`,"aria-label":t?(0,a.sprintf)(/* translators: %1$s is the product name, %2$d is the number of variations of that product. */ /* translators: %1$s is the product name, %2$d is the number of variations of that product. */
(0,a._n)("%1$s, has %2$d variation","%1$s, has %2$d variations",null===(y=l.details)||void 0===y||null===(f=y.variations)||void 0===f?void 0:f.length,"woocommerce"),l.name,null===(k=l.details)||void 0===k?void 0:k.variations.length):void 0})}const R=null==(S=null===(r=l.details)||void 0===r?void 0:r.variation)||"object"==typeof S&&0===Object.keys(S).length||"string"==typeof S&&0===S.trim().length?e:{...e,item:{...e.item,name:null===(s=l.details)||void 0===s?void 0:s.variation},"aria-label":`${l.breadcrumbs[0]}: ${null===(c=l.details)||void 0===c?void 0:c.variation}`};var S;return(0,o.createElement)(E,{...R,className:g,name:`variations-${n}`})}:()=>null),onSearch:l,messages:ce,isHierarchical:!0})}))),({selected:e,...t})=>{const[r,a]=(0,u.useState)(!0),[n,s]=(0,u.useState)(null),[i,c]=(0,u.useState)([]),l=V.productCount>100,d=async e=>{const t=await X(e);s(t),a(!1)},m=(0,u.useRef)(e);(0,u.useEffect)((()=>{K({selected:m.current}).then((e=>{c(e),a(!1)})).catch(d)}),[m]);const p=(0,Y.y1)((t=>{K({selected:e,search:t}).then((e=>{c(e),a(!1)})).catch(d)}),400),w=(0,u.useCallback)((e=>{a(!0),p(e)}),[a,p]);return(0,o.createElement)(de,{...t,selected:e,error:n,products:i,isLoading:r,onSearch:l?w:null})}));var de,me=r(1117);r(9032);const ue=({className:e="",error:t,isLoading:r=!1,onRetry:n})=>(0,o.createElement)(l.Placeholder,{icon:(0,o.createElement)(s.Z,{icon:me.Z}),label:(0,a.__)("Sorry, an error occurred","woocommerce"),className:m()("wc-block-api-error",e)},(0,o.createElement)(se,{error:t}),n&&(0,o.createElement)(o.Fragment,null,r?(0,o.createElement)(l.Spinner,null):(0,o.createElement)(l.Button,{variant:"secondary",onClick:n},(0,a.__)("Retry","woocommerce"))));r(1069);const pe=({label:e,screenReaderLabel:t,wrapperElement:r,wrapperProps:a={}})=>{let n;const s=null!=e,i=null!=t;return!s&&i?(n=r||"span",a={...a,className:m()(a.className,"screen-reader-text")},(0,o.createElement)(n,{...a},t)):(n=r||u.Fragment,s&&i&&e!==t?(0,o.createElement)(n,{...a},(0,o.createElement)("span",{"aria-hidden":"true"},e),(0,o.createElement)("span",{className:"screen-reader-text"},t)):(0,o.createElement)(n,{...a},e))},we=({onClick:e,label:t=(0,a.__)("Load more","woocommerce"),screenReaderLabel:r=(0,a.__)("Load more","woocommerce")})=>(0,o.createElement)("div",{className:"wp-block-button wc-block-load-more wc-block-components-load-more"},(0,o.createElement)("button",{className:"wp-block-button__link",onClick:e},(0,o.createElement)(pe,{label:t,screenReaderLabel:r}))),he=window.wc.blocksComponents;r(7082);const ve=({onChange:e,readOnly:t,value:r})=>(0,o.createElement)(he.SortSelect,{className:"wc-block-review-sort-select wc-block-components-review-sort-select",label:(0,a.__)("Order by","woocommerce"),onChange:e,options:[{key:"most-recent",label:(0,a.__)("Most recent","woocommerce")},{key:"highest-rating",label:(0,a.__)("Highest rating","woocommerce")},{key:"lowest-rating",label:(0,a.__)("Lowest rating","woocommerce")}],readOnly:t,screenReaderLabel:(0,a.__)("Order reviews by","woocommerce"),value:r});function ge(e){let t,r,o,a=[];for(let n=0;n<e.length;n++)t=e.substring(n),r=t.match(/^&[a-z0-9#]+;/),r?(o=r[0],a.push(o),n+=o.length-1):a.push(e[n]);return a}const _e=(e,t,r="...")=>{const o=function(e,t){const r=(t=t||{}).limit||100,o=void 0===t.preserveTags||t.preserveTags,a=void 0!==t.wordBreak&&t.wordBreak,n=t.suffix||"...",s=t.moreLink||"",i=t.moreText||"»",c=t.preserveWhiteSpace||!1,l=e.replace(/</g,"\n<").replace(/>/g,">\n").replace(/\n\n/g,"\n").replace(/^\n/g,"").replace(/\n$/g,"").split("\n");let d,m,u,p,w,h,v=0,g=[],_=!1;for(let e=0;e<l.length;e++){if(d=l[e],p=c?d:d.replace(/[ ]+/g," "),!d.length)continue;const t=ge(p);if("<"!==d[0])if(v>=r)d="";else if(v+t.length>=r){if(m=r-v," "===t[m-1])for(;m&&(m-=1," "===t[m-1]););else u=t.slice(m).indexOf(" "),a||(-1!==u?m+=u:m=d.length);d=t.slice(0,m).join("")+n,s&&(d+='<a href="'+s+'" style="display:inline">'+i+"</a>"),v=r,_=!0}else v+=t.length;else if(o){if(v>=r)if(w=d.match(/[a-zA-Z]+/),h=w?w[0]:"",h)if("</"!==d.substring(0,2))g.push(h),d="";else{for(;g[g.length-1]!==h&&g.length;)g.pop();g.length&&(d=""),g.pop()}else d=""}else d="";l[e]=d}return{html:l.join("\n").replace(/\n/g,""),more:_}}(e,{suffix:r,limit:t});return o.html},be=(e,t,r)=>(t<=r?e.start=e.middle+1:e.end=e.middle-1,e),Ee=(e,t,r,o)=>{const a=((e,t,r)=>{let o={start:0,middle:0,end:e.length};for(;o.start<=o.end;)o.middle=Math.floor((o.start+o.end)/2),t.innerHTML=_e(e,o.middle),o=be(o,t.clientHeight,r);return o.middle})(e,t,r);return _e(e,a-o.length,o)},ye={className:"read-more-content",ellipsis:"…",lessText:(0,a.__)("Read less","woocommerce"),maxLines:3,moreText:(0,a.__)("Read more","woocommerce")};class fe extends u.Component{constructor(e){super(e),(0,ee.Z)(this,"reviewSummary",void 0),(0,ee.Z)(this,"reviewContent",void 0),this.state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},this.reviewContent=(0,u.createRef)(),this.reviewSummary=(0,u.createRef)(),this.getButton=this.getButton.bind(this),this.onClick=this.onClick.bind(this)}componentDidMount(){this.setSummary()}componentDidUpdate(e){e.maxLines===this.props.maxLines&&e.children===this.props.children||this.setState({clampEnabled:null,summary:"."},this.setSummary)}setSummary(){if(this.props.children){const{maxLines:e,ellipsis:t}=this.props;if(!this.reviewSummary.current||!this.reviewContent.current)return;const r=(this.reviewSummary.current.clientHeight+1)*e+1,o=this.reviewContent.current.clientHeight+1>r;this.setState({clampEnabled:o}),o&&this.setState({summary:Ee(this.reviewContent.current.innerHTML,this.reviewSummary.current,r,t)})}}getButton(){const{isExpanded:e}=this.state,{className:t,lessText:r,moreText:a}=this.props,n=e?r:a;if(n)return(0,o.createElement)("a",{href:"#more",className:t+"__read_more",onClick:this.onClick,"aria-expanded":!e,role:"button"},n)}onClick(e){e.preventDefault();const{isExpanded:t}=this.state;this.setState({isExpanded:!t})}render(){const{className:e}=this.props,{content:t,summary:r,clampEnabled:a,isExpanded:n}=this.state;return t?!1===a?(0,o.createElement)("div",{className:e},(0,o.createElement)("div",{ref:this.reviewContent},t)):(0,o.createElement)("div",{className:e},(!n||null===a)&&(0,o.createElement)("div",{ref:this.reviewSummary,"aria-hidden":n,dangerouslySetInnerHTML:{__html:r}}),(n||null===a)&&(0,o.createElement)("div",{ref:this.reviewContent,"aria-hidden":!n},t),this.getButton()):null}}(0,ee.Z)(fe,"defaultProps",ye);const ke=fe;r(9191);const Re=({attributes:e,review:t={}})=>{const{imageType:r,showReviewDate:n,showReviewerName:s,showReviewImage:i,showReviewRating:c,showReviewContent:l,showProductName:d}=e,{rating:u}=t,p=!(Object.keys(t).length>0),w=Number.isFinite(u)&&c;return(0,o.createElement)("li",{className:m()("wc-block-review-list-item__item","wc-block-components-review-list-item__item",{"is-loading":p,"wc-block-components-review-list-item__item--has-image":i}),"aria-hidden":p},(d||n||s||i||w)&&(0,o.createElement)("div",{className:"wc-block-review-list-item__info wc-block-components-review-list-item__info"},i&&function(e,t,r){var n,s;return r||!e?(0,o.createElement)("div",{className:"wc-block-review-list-item__image wc-block-components-review-list-item__image"}):(0,o.createElement)("div",{className:"wc-block-review-list-item__image wc-block-components-review-list-item__image"},"product"===t?(0,o.createElement)("img",{"aria-hidden":"true",alt:(null===(n=e.product_image)||void 0===n?void 0:n.alt)||"",src:(null===(s=e.product_image)||void 0===s?void 0:s.thumbnail)||""}):(0,o.createElement)("img",{"aria-hidden":"true",alt:"",src:e.reviewer_avatar_urls[96]||""}),e.verified&&(0,o.createElement)("div",{className:"wc-block-review-list-item__verified wc-block-components-review-list-item__verified",title:(0,a.__)("Verified buyer","woocommerce")},(0,a.__)("Verified buyer","woocommerce")))}(t,r,p),(d||s||w||n)&&(0,o.createElement)("div",{className:"wc-block-review-list-item__meta wc-block-components-review-list-item__meta"},w&&function(e){const{rating:t}=e,r={width:t/5*100+"%"},n=(0,a.sprintf)(/* translators: %f is referring to the average rating value */ /* translators: %f is referring to the average rating value */
(0,a.__)("Rated %f out of 5","woocommerce"),t),s={__html:(0,a.sprintf)(/* translators: %s is referring to the average rating value */ /* translators: %s is referring to the average rating value */
(0,a.__)("Rated %s out of 5","woocommerce"),(0,a.sprintf)('<strong class="rating">%f</strong>',t))};return(0,o.createElement)("div",{className:"wc-block-review-list-item__rating wc-block-components-review-list-item__rating"},(0,o.createElement)("div",{className:"wc-block-review-list-item__rating__stars wc-block-components-review-list-item__rating__stars",role:"img","aria-label":n},(0,o.createElement)("span",{style:r,dangerouslySetInnerHTML:s})))}(t),d&&function(e){return(0,o.createElement)("div",{className:"wc-block-review-list-item__product wc-block-components-review-list-item__product"},(0,o.createElement)("a",{href:e.product_permalink,dangerouslySetInnerHTML:{__html:e.product_name}}))}(t),s&&function(e){const{reviewer:t=""}=e;return(0,o.createElement)("div",{className:"wc-block-review-list-item__author wc-block-components-review-list-item__author"},t)}(t),n&&function(e){const{date_created:t,formatted_date_created:r}=e;return(0,o.createElement)("time",{className:"wc-block-review-list-item__published-date wc-block-components-review-list-item__published-date",dateTime:t},r)}(t))),l&&function(e){return(0,o.createElement)(ke,{maxLines:10,moreText:(0,a.__)("Read full review","woocommerce"),lessText:(0,a.__)("Hide full review","woocommerce"),className:"wc-block-review-list-item__text wc-block-components-review-list-item__text"},(0,o.createElement)("div",{dangerouslySetInnerHTML:{__html:e.review||""}}))}(t))};r(5779);const Se=({attributes:e,reviews:t})=>{const r=(0,T.getSetting)("showAvatars",!0),a=(0,T.getSetting)("reviewRatingsEnabled",!0),n=(r||"product"===e.imageType)&&e.showReviewImage,s=a&&e.showReviewRating,i={...e,showReviewImage:n,showReviewRating:s};return(0,o.createElement)("ul",{className:"wc-block-review-list wc-block-components-review-list"},0===t.length?(0,o.createElement)(Re,{attributes:i}):t.map(((e,t)=>(0,o.createElement)(Re,{key:e.id||t,attributes:i,review:e}))))},Ce=e=>{const{className:t,categoryIds:r,productId:o,showReviewDate:a,showReviewerName:n,showReviewContent:s,showProductName:i,showReviewImage:c,showReviewRating:l}=e;let d="wc-block-all-reviews";return o&&(d="wc-block-reviews-by-product"),Array.isArray(r)&&(d="wc-block-reviews-by-category"),m()(d,t,{"has-image":c,"has-name":n,"has-date":a,"has-rating":l,"has-content":s,"has-product-name":i})},Ne=e=>{const{categoryIds:t,imageType:r,orderby:o,productId:a,reviewsOnPageLoad:n,reviewsOnLoadMore:s,showLoadMore:i,showOrderby:c}=e,l={"data-image-type":r,"data-orderby":o,"data-reviews-on-page-load":n,"data-reviews-on-load-more":s,"data-show-load-more":i,"data-show-orderby":c};return a&&(l["data-product-id"]=a),Array.isArray(t)&&(l["data-category-ids"]=t.join(",")),l};class Pe extends u.Component{render(){const{attributes:e,error:t,isLoading:r,noReviewsPlaceholder:n,reviews:s,totalReviews:i}=this.props;if(t)return(0,o.createElement)(ue,{className:"wc-block-featured-product-error",error:t,isLoading:r});if(0===s.length&&!r)return(0,o.createElement)(n,{attributes:e});const c=(0,T.getSetting)("reviewRatingsEnabled",!0);return(0,o.createElement)(l.Disabled,null,e.showOrderby&&c&&(0,o.createElement)(ve,{readOnly:!0,value:e.orderby,onChange:()=>null}),(0,o.createElement)(Se,{attributes:e,reviews:s}),e.showLoadMore&&i>s.length&&(0,o.createElement)(we,{screenReaderLabel:(0,a.__)("Load more reviews","woocommerce"),onClick:()=>null}))}}const Ie=(e=>{class t extends u.Component{constructor(...e){super(...e),(0,ee.Z)(this,"isPreview",!!this.props.attributes.previewReviews),(0,ee.Z)(this,"delayedAppendReviews",this.props.delayFunction(this.appendReviews)),(0,ee.Z)(this,"isMounted",!1),(0,ee.Z)(this,"state",{error:null,loading:!0,reviews:this.isPreview?this.props.attributes.previewReviews:[],totalReviews:this.isPreview?this.props.attributes.previewReviews.length:0}),(0,ee.Z)(this,"setError",(async e=>{if(!this.isMounted)return;const{onReviewsLoadError:t}=this.props,r=await X(e);this.setState({reviews:[],loading:!1,error:r}),t(r)}))}componentDidMount(){this.isMounted=!0,this.replaceReviews()}componentDidUpdate(e){e.reviewsToDisplay<this.props.reviewsToDisplay?this.delayedAppendReviews():this.shouldReplaceReviews(e,this.props)&&this.replaceReviews()}shouldReplaceReviews(e,t){return e.orderby!==t.orderby||e.order!==t.order||e.productId!==t.productId||!re()(e.categoryIds,t.categoryIds)}componentWillUnmount(){this.isMounted=!1,this.delayedAppendReviews.cancel&&this.delayedAppendReviews.cancel()}getArgs(e){const{categoryIds:t,order:r,orderby:o,productId:a,reviewsToDisplay:n}=this.props,s={order:r,orderby:o,per_page:n-e,offset:e};if(t){const e=Array.isArray(t)?t:JSON.parse(t);s.category_id=Array.isArray(e)?e.join(","):e}return a&&(s.product_id=a),s}replaceReviews(){if(this.isPreview)return;const{onReviewsReplaced:e}=this.props;this.updateListOfReviews().then(e)}appendReviews(){if(this.isPreview)return;const{onReviewsAppended:e,reviewsToDisplay:t}=this.props,{reviews:r}=this.state;t<=r.length||this.updateListOfReviews(r).then(e)}updateListOfReviews(e=[]){const{reviewsToDisplay:t}=this.props,{totalReviews:r}=this.state,o=Math.min(r,t)-e.length;return this.setState({loading:!0,reviews:e.concat(Array(o).fill({}))}),(a=this.getArgs(e.length),Q()({path:"/wc/store/v1/products/reviews?"+Object.entries(a).map((e=>e.join("="))).join("&"),parse:!1}).then((e=>e.json().then((t=>({reviews:t,totalReviews:parseInt(e.headers.get("x-wp-total"),10)})))))).then((({reviews:t,totalReviews:r})=>(this.isMounted&&this.setState({reviews:e.filter((e=>Object.keys(e).length)).concat(t),totalReviews:r,loading:!1,error:null}),{newReviews:t}))).catch(this.setError);var a}render(){const{reviewsToDisplay:t}=this.props,{error:r,loading:a,reviews:n,totalReviews:s}=this.state;return(0,o.createElement)(e,{...this.props,error:r,isLoading:a,reviews:n.slice(0,t),totalReviews:s})}}(0,ee.Z)(t,"defaultProps",{delayFunction:e=>e,onReviewsAppended:()=>{},onReviewsLoadError:()=>{},onReviewsReplaced:()=>{}});const{displayName:r=e.name||"Component"}=e;return t.displayName=`WithReviews( ${r} )`,t})(Pe),Le=({attributes:e,icon:t,name:r,noReviewsPlaceholder:n})=>{const{categoryIds:s,productId:i,reviewsOnPageLoad:d,showProductName:m,showReviewDate:u,showReviewerName:p,showReviewContent:w,showReviewImage:h,showReviewRating:v}=e,{order:g,orderby:_}=(e=>{if((0,T.getSetting)("reviewRatingsEnabled",!0)){if("lowest-rating"===e)return{order:"asc",orderby:"rating"};if("highest-rating"===e)return{order:"desc",orderby:"rating"}}return{order:"desc",orderby:"date_gmt"}})(e.orderby),b=!(w||v||u||p||h||m),E=(0,c.useBlockProps)({className:Ce(e)});return b?(0,o.createElement)(l.Placeholder,{icon:t,label:r},(0,a.__)("The content for this block is hidden due to block settings.","woocommerce")):(0,o.createElement)("div",{...E},(0,o.createElement)(Ie,{attributes:e,categoryIds:s,delayFunction:e=>((e,t,r)=>{let o,a=null;const n=(...t)=>{a=t,o&&clearTimeout(o),o=setTimeout((()=>{o=null,a&&e(...a)}),400)};return n.flush=()=>{o&&a&&(e(...a),clearTimeout(o),o=null)},n})(e),noReviewsPlaceholder:n,orderby:_,order:g,productId:i,reviewsToDisplay:d}))},xe=(0,k.createHigherOrderComponent)((e=>class extends u.Component{constructor(...e){super(...e),(0,ee.Z)(this,"state",{error:null,loading:!1,product:"preview"===this.props.attributes.productId?this.props.attributes.previewProduct:null}),(0,ee.Z)(this,"loadProduct",(()=>{const{productId:e}=this.props.attributes;"preview"!==e&&(e?(this.setState({loading:!0}),(e=>Q()({path:`/wc/store/v1/products/${e}`}))(e).then((e=>{this.setState({product:e,loading:!1,error:null})})).catch((async e=>{const t=await X(e);this.setState({product:null,loading:!1,error:t})}))):this.setState({product:null,loading:!1,error:null}))}))}componentDidMount(){this.loadProduct()}componentDidUpdate(e){e.attributes.productId!==this.props.attributes.productId&&this.loadProduct()}render(){const{error:t,loading:r,product:a}=this.state;return(0,o.createElement)(e,{...this.props,error:t,getProduct:this.loadProduct,isLoading:r,product:a})}}),"withProduct")((({error:e,getProduct:t,isLoading:r,product:n})=>{if(e)return(0,o.createElement)(ue,{className:"wc-block-featured-product-error",error:e,isLoading:r,onRetry:t});const c=!n||r?(0,o.createElement)(l.Spinner,null):(0,a.sprintf)(/* translators: %s is the product name. */ /* translators: %s is the product name. */
(0,a.__)("This block lists reviews for a selected product. %s doesn't have any reviews yet, but they will show up here when it does.","woocommerce"),(0,w.decodeEntities)(n.name));return(0,o.createElement)(l.Placeholder,{className:"wc-block-reviews-by-product",icon:(0,o.createElement)(s.Z,{icon:i.Z,className:"block-editor-block-icon"}),label:(0,a.__)("Reviews by Product","woocommerce")},c)})),Oe=(0,l.withSpokenMessages)((({attributes:e,debouncedSpeak:t,setAttributes:r})=>{const{editMode:n,productId:d}=e,m=e=>{const{item:t=0}=e;return(0,o.createElement)(E,{...e,item:{...t,count:t.details.review_count},countLabel:(0,a.sprintf)(/* translators: %d is the review count. */ /* translators: %d is the review count. */
(0,a._n)("%d review","%d reviews",t.details.review_count,"woocommerce"),t.details.review_count),"aria-label":(0,a.sprintf)(/* translators: %1$s is the item name, and %2$d is the number of reviews for the item. */ /* translators: %1$s is the item name, and %2$d is the number of reviews for the item. */
(0,a._n)("%1$s, has %2$d review","%1$s, has %2$d reviews",t.details.review_count,"woocommerce"),(0,w.decodeEntities)(t.name),t.details.review_count)})};if(!d||n)return(0,o.createElement)(l.Placeholder,{icon:(0,o.createElement)(s.Z,{icon:i.Z,className:"block-editor-block-icon"}),label:(0,a.__)("Reviews by Product","woocommerce"),className:"wc-block-reviews-by-product"},(0,a.__)("Show reviews of your product to build trust","woocommerce"),(0,o.createElement)("div",{className:"wc-block-reviews__selection"},(0,o.createElement)(le,{selected:e.productId||0,onChange:(e=[])=>{const t=e[0]?e[0].id:0;r({productId:t})},queryArgs:{orderby:"comment_count",order:"desc"},renderItem:m}),(0,o.createElement)(l.Button,{variant:"primary",onClick:()=>{r({editMode:!1}),t((0,a.__)("Showing Reviews by Product block preview.","woocommerce"))}},(0,a.__)("Done","woocommerce"))));const p=(0,a.__)("Edit selected product","woocommerce");return(0,o.createElement)(o.Fragment,null,((e,t,r)=>(0,o.createElement)(c.BlockControls,null,(0,o.createElement)(l.ToolbarGroup,{controls:[{icon:"edit",title:r,onClick:()=>t({editMode:!e}),isActive:e}]})))(n,r,p),(0,o.createElement)(c.InspectorControls,{key:"inspector"},(0,o.createElement)(l.PanelBody,{title:(0,a.__)("Product","woocommerce"),initialOpen:!1},(0,o.createElement)(le,{selected:e.productId||0,onChange:(e=[])=>{const t=e[0]?e[0].id:0;r({productId:t})},renderItem:m,isCompact:!0})),(0,o.createElement)(l.PanelBody,{title:(0,a.__)("Content","woocommerce")},((e,t)=>{const r=(0,T.getSetting)("showAvatars",!0),n=(0,T.getSetting)("reviewRatingsEnabled",!0);return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(l.ToggleControl,{label:(0,a.__)("Product rating","woocommerce"),checked:e.showReviewRating,onChange:()=>t({showReviewRating:!e.showReviewRating})}),e.showReviewRating&&!n&&(0,o.createElement)(l.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},(0,u.createInterpolateElement)((0,a.__)("Product rating is disabled in your <a>store settings</a>.","woocommerce"),{a:(0,o.createElement)("a",{href:(0,T.getAdminLink)("admin.php?page=wc-settings&tab=products"),target:"_blank",rel:"noopener noreferrer"})})),(0,o.createElement)(l.ToggleControl,{label:(0,a.__)("Reviewer name","woocommerce"),checked:e.showReviewerName,onChange:()=>t({showReviewerName:!e.showReviewerName})}),(0,o.createElement)(l.ToggleControl,{label:(0,a.__)("Image","woocommerce"),checked:e.showReviewImage,onChange:()=>t({showReviewImage:!e.showReviewImage})}),(0,o.createElement)(l.ToggleControl,{label:(0,a.__)("Review date","woocommerce"),checked:e.showReviewDate,onChange:()=>t({showReviewDate:!e.showReviewDate})}),(0,o.createElement)(l.ToggleControl,{label:(0,a.__)("Review content","woocommerce"),checked:e.showReviewContent,onChange:()=>t({showReviewContent:!e.showReviewContent})}),e.showReviewImage&&(0,o.createElement)(o.Fragment,null,(0,o.createElement)(l.__experimentalToggleGroupControl,{label:(0,a.__)("Review image","woocommerce"),value:e.imageType,onChange:e=>t({imageType:e})},(0,o.createElement)(l.__experimentalToggleGroupControlOption,{value:"reviewer",label:(0,a.__)("Reviewer photo","woocommerce")}),(0,o.createElement)(l.__experimentalToggleGroupControlOption,{value:"product",label:(0,a.__)("Product","woocommerce")})),"reviewer"===e.imageType&&!r&&(0,o.createElement)(l.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},(0,u.createInterpolateElement)((0,a.__)("Reviewer photo is disabled in your <a>site settings</a>.","woocommerce"),{a:(0,o.createElement)("a",{href:(0,T.getAdminLink)("options-discussion.php"),target:"_blank",rel:"noopener noreferrer"})}))))})(e,r)),(0,o.createElement)(l.PanelBody,{title:(0,a.__)("List Settings","woocommerce")},((e,t)=>(0,o.createElement)(o.Fragment,null,(0,o.createElement)(l.ToggleControl,{label:(0,a.__)("Order by","woocommerce"),checked:e.showOrderby,onChange:()=>t({showOrderby:!e.showOrderby})}),(0,o.createElement)(l.SelectControl,{label:(0,a.__)("Order Product Reviews by","woocommerce"),value:e.orderby,options:[{label:"Most recent",value:"most-recent"},{label:"Highest Rating",value:"highest-rating"},{label:"Lowest Rating",value:"lowest-rating"}],onChange:e=>t({orderby:e})}),(0,o.createElement)(l.RangeControl,{label:(0,a.__)("Starting Number of Reviews","woocommerce"),value:e.reviewsOnPageLoad,onChange:e=>t({reviewsOnPageLoad:e}),max:20,min:1}),(0,o.createElement)(l.ToggleControl,{label:(0,a.__)("Load more","woocommerce"),checked:e.showLoadMore,onChange:()=>t({showLoadMore:!e.showLoadMore})}),e.showLoadMore&&(0,o.createElement)(l.RangeControl,{label:(0,a.__)("Load More Reviews","woocommerce"),value:e.reviewsOnLoadMore,onChange:e=>t({reviewsOnLoadMore:e}),max:20,min:1})))(e,r))),(0,o.createElement)(Le,{attributes:e,icon:(0,o.createElement)(s.Z,{icon:i.Z,className:"block-editor-block-icon"}),name:(0,a.__)("Reviews by Product","woocommerce"),noReviewsPlaceholder:xe}))})),Te={attributes:{editMode:!1,imageType:"reviewer",orderby:"most-recent",reviewsOnLoadMore:10,reviewsOnPageLoad:10,showLoadMore:!0,showOrderby:!0,showReviewDate:!0,showReviewerName:!0,showReviewImage:!0,showReviewRating:!0,showReviewContent:!0,previewReviews:[{id:1,date_created:"2019-07-15T17:05:04",formatted_date_created:(0,a.__)("July 15, 2019","woocommerce"),date_created_gmt:"2019-07-15T15:05:04",product_id:0,product_name:(0,a.__)("WordPress Pennant","woocommerce"),product_permalink:"#",
/* translators: An example person name used for the block previews. */
reviewer:(0,a.__)("Alice","woocommerce"),review:`<p>${(0,a.__)("I bought this product last week and I'm very happy with it.","woocommerce")}</p>\n`,reviewer_avatar_urls:{48:V.defaultAvatar,96:V.defaultAvatar},rating:5,verified:!0},{id:2,date_created:"2019-07-12T12:39:39",formatted_date_created:(0,a.__)("July 12, 2019","woocommerce"),date_created_gmt:"2019-07-12T10:39:39",product_id:0,product_name:(0,a.__)("WordPress Pennant","woocommerce"),product_permalink:"#",
/* translators: An example person name used for the block previews. */
reviewer:(0,a.__)("Bob","woocommerce"),review:`<p>${(0,a.__)("This product is awesome, I love it!","woocommerce")}</p>\n`,reviewer_avatar_urls:{48:V.defaultAvatar,96:V.defaultAvatar},rating:null,verified:!1}]}};(0,n.registerBlockType)("woocommerce/reviews-by-product",{apiVersion:2,title:(0,a.__)("Reviews by Product","woocommerce"),icon:{src:(0,o.createElement)(s.Z,{icon:i.Z,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[(0,a.__)("WooCommerce","woocommerce")],description:(0,a.__)("Display reviews for your products.","woocommerce"),supports:{html:!1,color:{background:!1},typography:{fontSize:!0}},example:{...Te,attributes:{...Te.attributes,productId:1}},attributes:{editMode:{type:"boolean",default:!0},imageType:{type:"string",default:"reviewer"},orderby:{type:"string",default:"most-recent"},reviewsOnLoadMore:{type:"number",default:10},reviewsOnPageLoad:{type:"number",default:10},showLoadMore:{type:"boolean",default:!0},showOrderby:{type:"boolean",default:!0},showReviewDate:{type:"boolean",default:!0},showReviewerName:{type:"boolean",default:!0},showReviewImage:{type:"boolean",default:!0},showReviewRating:{type:"boolean",default:!0},showReviewContent:{type:"boolean",default:!0},previewReviews:{type:"array",default:null},productId:{type:"number"}},edit:e=>(0,o.createElement)(Oe,{...e}),save:({attributes:e})=>(0,o.createElement)("div",{...c.useBlockProps.save({className:Ce(e)}),...Ne(e)})})},1069:()=>{},9191:()=>{},5779:()=>{},7082:()=>{},6097:()=>{},9032:()=>{},8550:()=>{},9658:()=>{},1058:()=>{},9196:e=>{"use strict";e.exports=window.React},4333:e=>{"use strict";e.exports=window.wp.compose},9307:e=>{"use strict";e.exports=window.wp.element},5736:e=>{"use strict";e.exports=window.wp.i18n},9127:e=>{"use strict";e.exports=window.wp.isShallowEqual},444:e=>{"use strict";e.exports=window.wp.primitives}},r={};function o(e){var a=r[e];if(void 0!==a)return a.exports;var n=r[e]={exports:{}};return t[e].call(n.exports,n,n.exports,o),n.exports}o.m=t,e=[],o.O=(t,r,a,n)=>{if(!r){var s=1/0;for(d=0;d<e.length;d++){for(var[r,a,n]=e[d],i=!0,c=0;c<r.length;c++)(!1&n||s>=n)&&Object.keys(o.O).every((e=>o.O[e](r[c])))?r.splice(c--,1):(i=!1,n<s&&(s=n));if(i){e.splice(d--,1);var l=a();void 0!==l&&(t=l)}}return t}n=n||0;for(var d=e.length;d>0&&e[d-1][2]>n;d--)e[d]=e[d-1];e[d]=[r,a,n]},o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.j=7874,(()=>{var e={7874:0};o.O.j=t=>0===e[t];var t=(t,r)=>{var a,n,[s,i,c]=r,l=0;if(s.some((t=>0!==e[t]))){for(a in i)o.o(i,a)&&(o.m[a]=i[a]);if(c)var d=c(o)}for(t&&t(r);l<s.length;l++)n=s[l],o.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return o.O(d)},r=self.webpackChunkwebpackWcBlocksJsonp=self.webpackChunkwebpackWcBlocksJsonp||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a=o.O(void 0,[2869],(()=>o(42)));a=o.O(a),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["reviews-by-product"]=a})();