PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.7.1
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.7.1
1.7.1 1.7.0 1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 All 51 releases
← All changes | assets/ProductReviewsBlockEditor.js +1 -1 1.7.0 → 1.7.1 View file →
@@ -1 +1 @@
1 -import{j as e}from"./chunks/jsx-runtime.js?ver=1.7.0";import{R as le,u as ae,a as de}from"./chunks/reviewBlockShared.js?ver=1.7.0";import{b as h}from"./chunks/BlockEditorTranslator.js?ver=1.7.0";import{S as ue}from"./chunks/SingleProductContext.js?ver=1.7.0";import{F as pe}from"./chunks/Icons.js?ver=1.7.0";import"./chunks/EditorPanel.js?ver=1.7.0";import"./chunks/EditorPanelRow.js?ver=1.7.0";import"./chunks/SelectProductModal.js?ver=1.7.0";import"./chunks/index6.js?ver=1.7.0";import"./chunks/ProductListItem.js?ver=1.7.0";import"./chunks/index5.js?ver=1.7.0";import"./chunks/add-query-args.js?ver=1.7.0";const R=()=>(window.fluent_cart_product_reviews_data||{}).presets||{},y=new Proxy({},{get:(t,r)=>R()[r],has:(t,r)=>Object.prototype.hasOwnProperty.call(R(),r),ownKeys:()=>Object.keys(R()),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0})}),D=()=>Object.keys(y)[0],fe=()=>Object.entries(y).map(([t,{label:r}])=>({value:t,label:r})),xe=t=>{const r=y[t];return!!(r&&r.pro)},he=t=>{const r=y[t];return r?r.category:"list"},we=t=>{const r=y[t]||y[D()];return r?r.help:""},V=t=>Array.isArray(t)?t[0]:"",Y=t=>Array.isArray(t)&&t[1]&&typeof t[1]=="object"?t[1]:{},Q=t=>Array.isArray(t)&&Array.isArray(t[2])?t[2]:[],X=["gridColumns","perPage","sliderSettings","defaultSortBy","defaultSortOrder","paginationType"],P="fluent-cart/product-review-list",ye="fluent-cart/review-list-pagination",L=(t,r)=>{for(const s of t||[]){if((s==null?void 0:s.name)===r)return s;const c=L(s==null?void 0:s.innerBlocks,r);if(c)return c}return null},Z=(t,r)=>{for(const s of t||[]){if(V(s)===r)return s;const c=Z(Q(s),r);if(c)return c}return null},je=(t,r)=>{var i,l,a;const s=(l=(i=wp.blocks).getBlockType)==null?void 0:l.call(i,t),c=(a=s==null?void 0:s.attributes)==null?void 0:a[r];return c&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:void 0},me={gridColumns:P,perPage:P,sliderSettings:P,defaultSortBy:P,defaultSortOrder:P,paginationType:ye},ge=t=>{var c;const r=y[te(t)],s={};for(const i of X){const l=me[i],a=l?L(t,l):null,d=(c=a==null?void 0:a.attributes)==null?void 0:c[i];if(d===void 0)continue;const u=r?Y(Z(r.template,l)):{},j=Object.prototype.hasOwnProperty.call(u,i)?u[i]:je(l,i);JSON.stringify(d)!==JSON.stringify(j)&&(s[l]={...s[l]||{},[i]:d})}return s},ee=(t,r)=>{var l;if(!t||V(r)!==t.name)return!1;const s=Y(r);for(const a of Object.keys(s))if(!(X.indexOf(a)>-1)&&JSON.stringify((l=t.attributes)==null?void 0:l[a])!==JSON.stringify(s[a]))return!1;const c=t.innerBlocks||[],i=Q(r);return c.length===i.length&&i.every((a,d)=>ee(c[d],a))},te=t=>{if(ve(t))return D();for(const[r,s]of Object.entries(y)){const c=s.template;if(t.length===c.length&&c.every((i,l)=>ee(t[l],i)))return r}return"custom"},ve=t=>{var x,k;if(!Array.isArray(t)||t.length!==1)return!1;const[r]=t,s=(r==null?void 0:r.innerBlocks)||[];if((r==null?void 0:r.name)!=="core/columns"||s.length!==2)return!1;const[c,i]=s,l=(c==null?void 0:c.innerBlocks)||[],a=(i==null?void 0:i.innerBlocks)||[];if((c==null?void 0:c.name)!=="core/column"||l.length!==1||(i==null?void 0:i.name)!=="core/column"||a.length!==1)return!1;const[d]=l,[u]=a,j=(d==null?void 0:d.innerBlocks)||[];return(d==null?void 0:d.name)==="fluent-cart/product-review-summary-group"&&j.length===2&&((x=j[0])==null?void 0:x.name)==="fluent-cart/product-review-summary"&&((k=j[1])==null?void 0:k.name)==="fluent-cart/write-a-review-button"&&(u==null?void 0:u.name)==="fluent-cart/product-review-list"&&!(u.innerBlocks||[]).length},be=(t,r)=>{const s=y[t];if(!s||!r)return!1;const c=wp.data.select("core/block-editor").getBlocks(r),i=ge(c),l=wp.blocks.createBlocksFromInnerBlocksTemplate(s.template);for(const[a,d]of Object.entries(i)){const u=L(l,a);u&&(u.attributes={...u.attributes,...d})}return wp.data.dispatch("core/block-editor").replaceInnerBlocks(r,l,!1),!0},ke="#eef1f7",re="#ffffff",w="#ccd1db",T="#dfe3ea",$="#e6e9ef",m="#f2b134",se="#becffa",Pe="#3b5bdb",K=120,W=66,o=({x:t,y:r,w:s,h:c=3,fill:i=T})=>e.jsx("rect",{x:t,y:r,width:s,height:c,rx:c/2,fill:i}),b=({cx:t,cy:r,r:s=4,fill:c=w})=>e.jsx("circle",{cx:t,cy:r,r:s,fill:c}),_=({x:t,y:r,w:s,h:c})=>e.jsx("rect",{x:t,y:r,width:s,height:c,rx:3,fill:re}),H=({x:t,y:r,w:s,h:c,rx:i=2})=>e.jsx("rect",{x:t,y:r,width:s,height:c,rx:i,fill:se}),q=({y:t,width:r=84})=>e.jsxs(e.Fragment,{children:[e.jsx(b,{cx:14,cy:t+4,r:5}),e.jsx(o,{x:23,y:t+2,w:22,h:4,fill:w}),e.jsx(o,{x:49,y:t+2,w:18,h:4,fill:m}),e.jsx(o,{x:71,y:t+2.5,w:36}),e.jsx(o,{x:23,y:t+11,w:r})]}),g=({x:t,y:r,w:s,h:c})=>e.jsxs(e.Fragment,{children:[e.jsx(_,{x:t,y:r,w:s,h:c}),e.jsx(o,{x:t+4,y:r+5,w:16,h:4,fill:m}),e.jsx(o,{x:t+4,y:r+13,w:s-8}),c>20&&e.jsx(o,{x:t+4,y:r+19,w:s-14})]}),Be={classic:e.jsxs(e.Fragment,{children:[e.jsx(q,{y:10}),e.jsx(q,{y:38,width:62})]}),minimal:e.jsxs(e.Fragment,{children:[e.jsx(o,{x:9,y:10,w:38,h:4,fill:w}),e.jsx(o,{x:9,y:18,w:102}),e.jsx("rect",{x:9,y:24,width:102,height:1,fill:$}),e.jsx(o,{x:9,y:29,w:30,h:4,fill:w}),e.jsx(o,{x:9,y:37,w:92}),e.jsx("rect",{x:9,y:43,width:102,height:1,fill:$}),e.jsx(o,{x:9,y:48,w:34,h:4,fill:w}),e.jsx(o,{x:9,y:56,w:102})]}),compact:e.jsx(e.Fragment,{children:[13,26,39,52].map(t=>e.jsxs("g",{children:[e.jsx(b,{cx:13,cy:t,r:3.5}),e.jsx(o,{x:21,y:t-2,w:22,h:4,fill:w}),e.jsx(o,{x:48,y:t-1.5,w:59})]},t))}),"summary-top":e.jsxs(e.Fragment,{children:[e.jsx(_,{x:8,y:6,w:104,h:30}),e.jsx("rect",{x:13,y:11,width:14,height:10,rx:2,fill:w}),e.jsx(o,{x:32,y:11,w:67,h:5,fill:m}),e.jsx(o,{x:13,y:25,w:14,h:4,fill:m}),e.jsx(o,{x:32,y:25,w:30,h:4}),e.jsx(o,{x:8,y:42,w:44,h:4,fill:w}),e.jsx(o,{x:8,y:51,w:104}),e.jsx(o,{x:8,y:58,w:78})]}),grid:e.jsx(e.Fragment,{children:[[8,8],[44,8],[80,8],[8,36],[44,36],[80,36]].map(([t,r])=>e.jsx("g",{children:e.jsx(g,{x:t,y:r,w:32,h:24})},`${t}-${r}`))}),masonry:e.jsxs(e.Fragment,{children:[e.jsx(g,{x:8,y:8,w:32,h:26}),e.jsx(g,{x:8,y:38,w:32,h:19}),e.jsx(g,{x:44,y:8,w:32,h:19}),e.jsx(g,{x:44,y:31,w:32,h:26}),e.jsx(g,{x:80,y:8,w:32,h:30}),e.jsx(g,{x:80,y:42,w:32,h:15})]}),carousel:e.jsxs(e.Fragment,{children:[[8,62].map(t=>e.jsxs("g",{children:[e.jsx(_,{x:t,y:8,w:50,h:34}),e.jsx(b,{cx:t+10,cy:18,r:4}),e.jsx(o,{x:t+18,y:15,w:22,h:5,fill:m}),e.jsx(o,{x:t+6,y:27,w:38}),e.jsx(o,{x:t+6,y:33,w:28})]},t)),e.jsx(o,{x:48,y:50,w:9,h:3.5,fill:w}),e.jsx(b,{cx:63,cy:51.5,r:1.8,fill:T}),e.jsx(b,{cx:70,cy:51.5,r:1.8,fill:T})]}),testimonials:e.jsxs(e.Fragment,{children:[e.jsx("text",{x:60,y:26,textAnchor:"middle",fontSize:"26",fontFamily:"Georgia, serif",fill:Pe,opacity:"0.3",children:"“"}),e.jsx(o,{x:38,y:24,w:44,h:4,fill:w}),e.jsx(o,{x:22,y:33,w:76}),e.jsx(o,{x:32,y:40,w:56}),e.jsx(b,{cx:46,cy:53,r:4}),e.jsx(o,{x:54,y:51,w:20,h:4,fill:m})]}),"photo-grid":e.jsx(e.Fragment,{children:[8,44,80].map(t=>e.jsxs("g",{children:[e.jsx(_,{x:t,y:6,w:32,h:54}),e.jsx("path",{d:`M${t} 9a3 3 0 0 1 3-3h26a3 3 0 0 1 3 3v22H${t}z`,fill:se}),e.jsx(o,{x:t+4,y:37,w:16,h:4,fill:m}),e.jsx(o,{x:t+4,y:45,w:24}),e.jsx(o,{x:t+4,y:52,w:18})]},t))}),"photo-wall":e.jsx(e.Fragment,{children:[8,44,80].map(t=>e.jsxs("g",{children:[e.jsx(H,{x:t,y:9,w:32,h:48,rx:3}),e.jsx(o,{x:t+5,y:38,w:14,h:4,fill:m}),e.jsx(o,{x:t+5,y:46,w:22,h:3.5,fill:re})]},t))}),"photo-strip":e.jsx(e.Fragment,{children:[9.5,30.5,51.5,72.5,93.5].map(t=>e.jsx("g",{children:e.jsx(H,{x:t,y:10,w:17,h:46,rx:3})},t))})},Oe=e.jsxs(e.Fragment,{children:[e.jsx(o,{x:9,y:16,w:102}),e.jsx(o,{x:9,y:31,w:84}),e.jsx(o,{x:9,y:46,w:62})]}),_e=({value:t})=>e.jsxs("svg",{className:"fct-review-preset-icon",viewBox:`0 0 ${K} ${W}`,preserveAspectRatio:"xMidYMid meet","aria-hidden":"true",focusable:"false",children:[e.jsx("rect",{x:"0",y:"0",width:K,height:W,rx:"4",fill:ke}),Be[t]||Oe]}),{InspectorControls:Ne}=wp.blockEditor,{Notice:Se,PanelBody:Ae}=wp.components,{useSelect:Ce}=wp.data,{useEffect:z,useRef:Fe,useState:E}=wp.element,J=2,Re=({attributes:t,setAttributes:r,selectedProduct:s,setSelectedProduct:c,insideParent:i,clientId:l})=>{const a=Ce(n=>n("core/block-editor").getBlocks(l),[l]),[d,u]=E("all"),j=te(a),x=a.length?j==="custom"?"custom":j:t.preset||D(),k=(n,p)=>{if(n!=="custom"){if(B(n)){A(p);return}if(A(""),n===x){t.preset!==n&&r({preset:n});return}r({preset:n}),be(n,l)}},N=Fe([]),[ne,S]=E(0),ce=!!(window.fluent_cart_product_reviews_data||{}).is_pro,B=n=>!ce&&xe(n),[I,A]=E(""),M=fe(),v=d==="all"?M:M.filter(n=>he(n.value)===d),C=v.findIndex(n=>n.value===x);z(()=>{S(C>-1?C:0)},[C]),z(()=>{S(n=>Math.min(n,Math.max(v.length-1,0)))},[v.length]);const oe=(n,p)=>{const f=v.length-1,U={ArrowRight:Math.min(p+1,f),ArrowLeft:Math.max(p-1,0),ArrowDown:Math.min(p+J,f),ArrowUp:Math.max(p-J,0),Home:0,End:f};if(!Object.prototype.hasOwnProperty.call(U,n.key))return;n.preventDefault(),n.stopPropagation();const F=U[n.key];S(F),N.current[F]&&N.current[F].focus()},ie=(n,p)=>{if(n.key!=="Enter"&&n.key!==" ")return;n.preventDefault(),n.stopPropagation();const f=v[p];f&&k(f.value,f.label)};return e.jsx(Ne,{children:e.jsx("div",{className:"fct-inspector-control-wrap fct-inspector-control-wrap--product-card fct-inspector-control-wrap--product-reviews",children:e.jsx("div",{className:"fct-inspector-control-group",children:e.jsxs("div",{className:"fct-inspector-control-body",children:[!i&&e.jsx(le,{attributes:t,setAttributes:r,selectedProduct:s,setSelectedProduct:c}),e.jsxs(Ae,{title:h("Layout"),initialOpen:!0,children:[e.jsx("p",{className:"fct-review-preset-label",children:h("Layout preset")}),e.jsx("div",{className:"fct-review-preset-tabs",role:"group","aria-label":h("Review layout categories"),children:["all","list","grid","carousel","photo"].map(n=>e.jsx("button",{type:"button","aria-pressed":d===n,className:`fct-review-preset-tab${d===n?" is-active":""}`,onClick:()=>u(n),children:h(n==="all"?"All layouts":n[0].toUpperCase()+n.slice(1))},n))}),x==="custom"&&e.jsxs("div",{className:"fct-review-preset-current",children:[e.jsx("span",{className:"fct-review-preset-current-mark",children:"✓"}),h("Custom layout")]}),e.jsx("div",{className:"fct-review-preset-grid",role:"radiogroup","aria-label":h("Review layout presets"),children:v.map((n,p)=>e.jsxs("button",{type:"button",role:"radio","aria-checked":x===n.value,"aria-disabled":B(n.value)||void 0,tabIndex:p===ne?0:-1,ref:f=>{N.current[p]=f},onKeyDown:f=>{oe(f,p),ie(f,p)},className:["fct-review-preset-card",x===n.value?"is-selected":"",B(n.value)?"is-locked":""].filter(Boolean).join(" "),onClick:()=>k(n.value,n.label),children:[e.jsx(_e,{value:n.value}),e.jsx("span",{className:"fct-review-preset-card-name",children:n.label}),B(n.value)&&e.jsx("span",{className:"fct-review-preset-pro",children:h("Pro")}),x===n.value&&e.jsx("span",{className:"fct-review-preset-check","aria-hidden":"true",children:"✓"})]},n.value))}),I&&e.jsx("div",{className:"fct-review-preset-locked",children:e.jsx(Se,{status:"warning",isDismissible:!0,onRemove:()=>A(""),children:h("%s is a Pro layout. Upgrade to FluentCart Pro to build the section from it.",I)})}),e.jsx("p",{className:"fct-review-preset-help",children:x==="custom"?h("Custom layout. Choose a preset to replace it with a starter layout."):we(x)}),e.jsx("p",{className:"fct-preset-note",children:h("Builds the section from these blocks. Anything arranged inside it is replaced.")})]})]})})})})},{useBlockProps:Ee,InnerBlocks:G}=wp.blockEditor,{registerBlockType:Te}=wp.blocks,{useEffect:De,useMemo:Le}=wp.element,O=window.fluent_cart_product_reviews_data,Ie=()=>[["core/columns",{style:{spacing:{blockGap:"24px"}}},[["core/column",{width:"320px"},[["fluent-cart/product-review-summary-group",{},[["fluent-cart/product-review-summary",{}],["fluent-cart/write-a-review-button",{}]]]]],["core/column",{},[["fluent-cart/product-review-list",{}]]]]]],Me=["fluent-cart/product-review-summary-group","fluent-cart/write-a-review-button","fluent-cart/product-review-form","fluent-cart/product-review-list","core/columns","core/group","core/heading","core/paragraph","core/spacer"];Te(O.slug+"/"+O.name,{apiVersion:3,title:O.title,description:O.description,icon:{src:pe},category:"fluent-cart",attributes:{query_type:{type:"string",default:"default"},product_id:{type:["string","number"],default:""},preset:{type:"string",default:"classic"}},edit:({attributes:t,setAttributes:r,clientId:s})=>{const c=Ee({className:"fct-product-reviews-block-editor"}),i=ae(s),{selectedProduct:l,setSelectedProduct:a}=de(t,i,!1);De(()=>{i&&t.query_type!=="default"&&r({query_type:"default"})},[i,t.query_type]);const d=Le(()=>Ie(),[]);return e.jsxs("div",{...c,children:[e.jsx(Re,{attributes:t,setAttributes:r,selectedProduct:l,setSelectedProduct:a,insideParent:i,clientId:s}),e.jsx(ue,{value:{product:l},children:e.jsx(G,{template:d,templateLock:!1,allowedBlocks:Me})})]})},save:function(){return e.jsx(G.Content,{})},supports:{html:!1,align:!0,typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalDefaultControls:{fontSize:!0}},color:{text:!0,background:!0},spacing:{margin:!0,padding:!0},__experimentalBorder:{color:!0,radius:!0,style:!0,width:!0}}});
1 +import{j as e}from"./chunks/jsx-runtime.js?ver=1.7.1";import{R as le,u as ae,a as de}from"./chunks/reviewBlockShared.js?ver=1.7.1";import{b as h}from"./chunks/BlockEditorTranslator.js?ver=1.7.1";import{S as ue}from"./chunks/SingleProductContext.js?ver=1.7.1";import{G as pe}from"./chunks/Icons.js?ver=1.7.1";import"./chunks/EditorPanel.js?ver=1.7.1";import"./chunks/EditorPanelRow.js?ver=1.7.1";import"./chunks/SelectProductModal.js?ver=1.7.1";import"./chunks/index6.js?ver=1.7.1";import"./chunks/ProductListItem.js?ver=1.7.1";import"./chunks/index5.js?ver=1.7.1";import"./chunks/add-query-args.js?ver=1.7.1";import"./chunks/reviewStar2.js?ver=1.7.1";const R=()=>(window.fluent_cart_product_reviews_data||{}).presets||{},y=new Proxy({},{get:(t,r)=>R()[r],has:(t,r)=>Object.prototype.hasOwnProperty.call(R(),r),ownKeys:()=>Object.keys(R()),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0})}),D=()=>Object.keys(y)[0],fe=()=>Object.entries(y).map(([t,{label:r}])=>({value:t,label:r})),xe=t=>{const r=y[t];return!!(r&&r.pro)},he=t=>{const r=y[t];return r?r.category:"list"},we=t=>{const r=y[t]||y[D()];return r?r.help:""},V=t=>Array.isArray(t)?t[0]:"",Y=t=>Array.isArray(t)&&t[1]&&typeof t[1]=="object"?t[1]:{},Q=t=>Array.isArray(t)&&Array.isArray(t[2])?t[2]:[],X=["gridColumns","perPage","sliderSettings","defaultSortBy","defaultSortOrder","paginationType"],P="fluent-cart/product-review-list",ye="fluent-cart/review-list-pagination",L=(t,r)=>{for(const s of t||[]){if((s==null?void 0:s.name)===r)return s;const c=L(s==null?void 0:s.innerBlocks,r);if(c)return c}return null},Z=(t,r)=>{for(const s of t||[]){if(V(s)===r)return s;const c=Z(Q(s),r);if(c)return c}return null},je=(t,r)=>{var i,l,a;const s=(l=(i=wp.blocks).getBlockType)==null?void 0:l.call(i,t),c=(a=s==null?void 0:s.attributes)==null?void 0:a[r];return c&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:void 0},me={gridColumns:P,perPage:P,sliderSettings:P,defaultSortBy:P,defaultSortOrder:P,paginationType:ye},ge=t=>{var c;const r=y[te(t)],s={};for(const i of X){const l=me[i],a=l?L(t,l):null,d=(c=a==null?void 0:a.attributes)==null?void 0:c[i];if(d===void 0)continue;const u=r?Y(Z(r.template,l)):{},j=Object.prototype.hasOwnProperty.call(u,i)?u[i]:je(l,i);JSON.stringify(d)!==JSON.stringify(j)&&(s[l]={...s[l]||{},[i]:d})}return s},ee=(t,r)=>{var l;if(!t||V(r)!==t.name)return!1;const s=Y(r);for(const a of Object.keys(s))if(!(X.indexOf(a)>-1)&&JSON.stringify((l=t.attributes)==null?void 0:l[a])!==JSON.stringify(s[a]))return!1;const c=t.innerBlocks||[],i=Q(r);return c.length===i.length&&i.every((a,d)=>ee(c[d],a))},te=t=>{if(ve(t))return D();for(const[r,s]of Object.entries(y)){const c=s.template;if(t.length===c.length&&c.every((i,l)=>ee(t[l],i)))return r}return"custom"},ve=t=>{var x,k;if(!Array.isArray(t)||t.length!==1)return!1;const[r]=t,s=(r==null?void 0:r.innerBlocks)||[];if((r==null?void 0:r.name)!=="core/columns"||s.length!==2)return!1;const[c,i]=s,l=(c==null?void 0:c.innerBlocks)||[],a=(i==null?void 0:i.innerBlocks)||[];if((c==null?void 0:c.name)!=="core/column"||l.length!==1||(i==null?void 0:i.name)!=="core/column"||a.length!==1)return!1;const[d]=l,[u]=a,j=(d==null?void 0:d.innerBlocks)||[];return(d==null?void 0:d.name)==="fluent-cart/product-review-summary-group"&&j.length===2&&((x=j[0])==null?void 0:x.name)==="fluent-cart/product-review-summary"&&((k=j[1])==null?void 0:k.name)==="fluent-cart/write-a-review-button"&&(u==null?void 0:u.name)==="fluent-cart/product-review-list"&&!(u.innerBlocks||[]).length},be=(t,r)=>{const s=y[t];if(!s||!r)return!1;const c=wp.data.select("core/block-editor").getBlocks(r),i=ge(c),l=wp.blocks.createBlocksFromInnerBlocksTemplate(s.template);for(const[a,d]of Object.entries(i)){const u=L(l,a);u&&(u.attributes={...u.attributes,...d})}return wp.data.dispatch("core/block-editor").replaceInnerBlocks(r,l,!1),!0},ke="#eef1f7",re="#ffffff",w="#ccd1db",T="#dfe3ea",$="#e6e9ef",m="#f2b134",se="#becffa",Pe="#3b5bdb",K=120,W=66,o=({x:t,y:r,w:s,h:c=3,fill:i=T})=>e.jsx("rect",{x:t,y:r,width:s,height:c,rx:c/2,fill:i}),b=({cx:t,cy:r,r:s=4,fill:c=w})=>e.jsx("circle",{cx:t,cy:r,r:s,fill:c}),_=({x:t,y:r,w:s,h:c})=>e.jsx("rect",{x:t,y:r,width:s,height:c,rx:3,fill:re}),H=({x:t,y:r,w:s,h:c,rx:i=2})=>e.jsx("rect",{x:t,y:r,width:s,height:c,rx:i,fill:se}),q=({y:t,width:r=84})=>e.jsxs(e.Fragment,{children:[e.jsx(b,{cx:14,cy:t+4,r:5}),e.jsx(o,{x:23,y:t+2,w:22,h:4,fill:w}),e.jsx(o,{x:49,y:t+2,w:18,h:4,fill:m}),e.jsx(o,{x:71,y:t+2.5,w:36}),e.jsx(o,{x:23,y:t+11,w:r})]}),g=({x:t,y:r,w:s,h:c})=>e.jsxs(e.Fragment,{children:[e.jsx(_,{x:t,y:r,w:s,h:c}),e.jsx(o,{x:t+4,y:r+5,w:16,h:4,fill:m}),e.jsx(o,{x:t+4,y:r+13,w:s-8}),c>20&&e.jsx(o,{x:t+4,y:r+19,w:s-14})]}),Be={classic:e.jsxs(e.Fragment,{children:[e.jsx(q,{y:10}),e.jsx(q,{y:38,width:62})]}),minimal:e.jsxs(e.Fragment,{children:[e.jsx(o,{x:9,y:10,w:38,h:4,fill:w}),e.jsx(o,{x:9,y:18,w:102}),e.jsx("rect",{x:9,y:24,width:102,height:1,fill:$}),e.jsx(o,{x:9,y:29,w:30,h:4,fill:w}),e.jsx(o,{x:9,y:37,w:92}),e.jsx("rect",{x:9,y:43,width:102,height:1,fill:$}),e.jsx(o,{x:9,y:48,w:34,h:4,fill:w}),e.jsx(o,{x:9,y:56,w:102})]}),compact:e.jsx(e.Fragment,{children:[13,26,39,52].map(t=>e.jsxs("g",{children:[e.jsx(b,{cx:13,cy:t,r:3.5}),e.jsx(o,{x:21,y:t-2,w:22,h:4,fill:w}),e.jsx(o,{x:48,y:t-1.5,w:59})]},t))}),"summary-top":e.jsxs(e.Fragment,{children:[e.jsx(_,{x:8,y:6,w:104,h:30}),e.jsx("rect",{x:13,y:11,width:14,height:10,rx:2,fill:w}),e.jsx(o,{x:32,y:11,w:67,h:5,fill:m}),e.jsx(o,{x:13,y:25,w:14,h:4,fill:m}),e.jsx(o,{x:32,y:25,w:30,h:4}),e.jsx(o,{x:8,y:42,w:44,h:4,fill:w}),e.jsx(o,{x:8,y:51,w:104}),e.jsx(o,{x:8,y:58,w:78})]}),grid:e.jsx(e.Fragment,{children:[[8,8],[44,8],[80,8],[8,36],[44,36],[80,36]].map(([t,r])=>e.jsx("g",{children:e.jsx(g,{x:t,y:r,w:32,h:24})},`${t}-${r}`))}),masonry:e.jsxs(e.Fragment,{children:[e.jsx(g,{x:8,y:8,w:32,h:26}),e.jsx(g,{x:8,y:38,w:32,h:19}),e.jsx(g,{x:44,y:8,w:32,h:19}),e.jsx(g,{x:44,y:31,w:32,h:26}),e.jsx(g,{x:80,y:8,w:32,h:30}),e.jsx(g,{x:80,y:42,w:32,h:15})]}),carousel:e.jsxs(e.Fragment,{children:[[8,62].map(t=>e.jsxs("g",{children:[e.jsx(_,{x:t,y:8,w:50,h:34}),e.jsx(b,{cx:t+10,cy:18,r:4}),e.jsx(o,{x:t+18,y:15,w:22,h:5,fill:m}),e.jsx(o,{x:t+6,y:27,w:38}),e.jsx(o,{x:t+6,y:33,w:28})]},t)),e.jsx(o,{x:48,y:50,w:9,h:3.5,fill:w}),e.jsx(b,{cx:63,cy:51.5,r:1.8,fill:T}),e.jsx(b,{cx:70,cy:51.5,r:1.8,fill:T})]}),testimonials:e.jsxs(e.Fragment,{children:[e.jsx("text",{x:60,y:26,textAnchor:"middle",fontSize:"26",fontFamily:"Georgia, serif",fill:Pe,opacity:"0.3",children:"“"}),e.jsx(o,{x:38,y:24,w:44,h:4,fill:w}),e.jsx(o,{x:22,y:33,w:76}),e.jsx(o,{x:32,y:40,w:56}),e.jsx(b,{cx:46,cy:53,r:4}),e.jsx(o,{x:54,y:51,w:20,h:4,fill:m})]}),"photo-grid":e.jsx(e.Fragment,{children:[8,44,80].map(t=>e.jsxs("g",{children:[e.jsx(_,{x:t,y:6,w:32,h:54}),e.jsx("path",{d:`M${t} 9a3 3 0 0 1 3-3h26a3 3 0 0 1 3 3v22H${t}z`,fill:se}),e.jsx(o,{x:t+4,y:37,w:16,h:4,fill:m}),e.jsx(o,{x:t+4,y:45,w:24}),e.jsx(o,{x:t+4,y:52,w:18})]},t))}),"photo-wall":e.jsx(e.Fragment,{children:[8,44,80].map(t=>e.jsxs("g",{children:[e.jsx(H,{x:t,y:9,w:32,h:48,rx:3}),e.jsx(o,{x:t+5,y:38,w:14,h:4,fill:m}),e.jsx(o,{x:t+5,y:46,w:22,h:3.5,fill:re})]},t))}),"photo-strip":e.jsx(e.Fragment,{children:[9.5,30.5,51.5,72.5,93.5].map(t=>e.jsx("g",{children:e.jsx(H,{x:t,y:10,w:17,h:46,rx:3})},t))})},Oe=e.jsxs(e.Fragment,{children:[e.jsx(o,{x:9,y:16,w:102}),e.jsx(o,{x:9,y:31,w:84}),e.jsx(o,{x:9,y:46,w:62})]}),_e=({value:t})=>e.jsxs("svg",{className:"fct-review-preset-icon",viewBox:`0 0 ${K} ${W}`,preserveAspectRatio:"xMidYMid meet","aria-hidden":"true",focusable:"false",children:[e.jsx("rect",{x:"0",y:"0",width:K,height:W,rx:"4",fill:ke}),Be[t]||Oe]}),{InspectorControls:Ne}=wp.blockEditor,{Notice:Se,PanelBody:Ae}=wp.components,{useSelect:Ce}=wp.data,{useEffect:z,useRef:Fe,useState:E}=wp.element,G=2,Re=({attributes:t,setAttributes:r,selectedProduct:s,setSelectedProduct:c,insideParent:i,clientId:l})=>{const a=Ce(n=>n("core/block-editor").getBlocks(l),[l]),[d,u]=E("all"),j=te(a),x=a.length?j==="custom"?"custom":j:t.preset||D(),k=(n,p)=>{if(n!=="custom"){if(B(n)){A(p);return}if(A(""),n===x){t.preset!==n&&r({preset:n});return}r({preset:n}),be(n,l)}},N=Fe([]),[ne,S]=E(0),ce=!!(window.fluent_cart_product_reviews_data||{}).is_pro,B=n=>!ce&&xe(n),[I,A]=E(""),M=fe(),v=d==="all"?M:M.filter(n=>he(n.value)===d),C=v.findIndex(n=>n.value===x);z(()=>{S(C>-1?C:0)},[C]),z(()=>{S(n=>Math.min(n,Math.max(v.length-1,0)))},[v.length]);const oe=(n,p)=>{const f=v.length-1,U={ArrowRight:Math.min(p+1,f),ArrowLeft:Math.max(p-1,0),ArrowDown:Math.min(p+G,f),ArrowUp:Math.max(p-G,0),Home:0,End:f};if(!Object.prototype.hasOwnProperty.call(U,n.key))return;n.preventDefault(),n.stopPropagation();const F=U[n.key];S(F),N.current[F]&&N.current[F].focus()},ie=(n,p)=>{if(n.key!=="Enter"&&n.key!==" ")return;n.preventDefault(),n.stopPropagation();const f=v[p];f&&k(f.value,f.label)};return e.jsx(Ne,{children:e.jsx("div",{className:"fct-inspector-control-wrap fct-inspector-control-wrap--product-card fct-inspector-control-wrap--product-reviews",children:e.jsx("div",{className:"fct-inspector-control-group",children:e.jsxs("div",{className:"fct-inspector-control-body",children:[!i&&e.jsx(le,{attributes:t,setAttributes:r,selectedProduct:s,setSelectedProduct:c}),e.jsxs(Ae,{title:h("Layout"),initialOpen:!0,children:[e.jsx("p",{className:"fct-review-preset-label",children:h("Layout preset")}),e.jsx("div",{className:"fct-review-preset-tabs",role:"group","aria-label":h("Review layout categories"),children:["all","list","grid","carousel","photo"].map(n=>e.jsx("button",{type:"button","aria-pressed":d===n,className:`fct-review-preset-tab${d===n?" is-active":""}`,onClick:()=>u(n),children:h(n==="all"?"All layouts":n[0].toUpperCase()+n.slice(1))},n))}),x==="custom"&&e.jsxs("div",{className:"fct-review-preset-current",children:[e.jsx("span",{className:"fct-review-preset-current-mark",children:"✓"}),h("Custom layout")]}),e.jsx("div",{className:"fct-review-preset-grid",role:"radiogroup","aria-label":h("Review layout presets"),children:v.map((n,p)=>e.jsxs("button",{type:"button",role:"radio","aria-checked":x===n.value,"aria-disabled":B(n.value)||void 0,tabIndex:p===ne?0:-1,ref:f=>{N.current[p]=f},onKeyDown:f=>{oe(f,p),ie(f,p)},className:["fct-review-preset-card",x===n.value?"is-selected":"",B(n.value)?"is-locked":""].filter(Boolean).join(" "),onClick:()=>k(n.value,n.label),children:[e.jsx(_e,{value:n.value}),e.jsx("span",{className:"fct-review-preset-card-name",children:n.label}),B(n.value)&&e.jsx("span",{className:"fct-review-preset-pro",children:h("Pro")}),x===n.value&&e.jsx("span",{className:"fct-review-preset-check","aria-hidden":"true",children:"✓"})]},n.value))}),I&&e.jsx("div",{className:"fct-review-preset-locked",children:e.jsx(Se,{status:"warning",isDismissible:!0,onRemove:()=>A(""),children:h("%s is a Pro layout. Upgrade to FluentCart Pro to build the section from it.",I)})}),e.jsx("p",{className:"fct-review-preset-help",children:x==="custom"?h("Custom layout. Choose a preset to replace it with a starter layout."):we(x)}),e.jsx("p",{className:"fct-preset-note",children:h("Builds the section from these blocks. Anything arranged inside it is replaced.")})]})]})})})})},{useBlockProps:Ee,InnerBlocks:J}=wp.blockEditor,{registerBlockType:Te}=wp.blocks,{useEffect:De,useMemo:Le}=wp.element,O=window.fluent_cart_product_reviews_data,Ie=()=>[["core/columns",{style:{spacing:{blockGap:"24px"}}},[["core/column",{width:"320px"},[["fluent-cart/product-review-summary-group",{},[["fluent-cart/product-review-summary",{}],["fluent-cart/write-a-review-button",{}]]]]],["core/column",{},[["fluent-cart/product-review-list",{}]]]]]],Me=["fluent-cart/product-review-summary-group","fluent-cart/write-a-review-button","fluent-cart/product-review-form","fluent-cart/product-review-list","core/columns","core/group","core/heading","core/paragraph","core/spacer"];Te(O.slug+"/"+O.name,{apiVersion:3,title:O.title,description:O.description,icon:{src:pe},category:"fluent-cart",attributes:{query_type:{type:"string",default:"default"},product_id:{type:["string","number"],default:""},preset:{type:"string",default:"classic"}},edit:({attributes:t,setAttributes:r,clientId:s})=>{const c=Ee({className:"fct-product-reviews-block-editor"}),i=ae(s),{selectedProduct:l,setSelectedProduct:a}=de(t,i,!1);De(()=>{i&&t.query_type!=="default"&&r({query_type:"default"})},[i,t.query_type]);const d=Le(()=>Ie(),[]);return e.jsxs("div",{...c,children:[e.jsx(Re,{attributes:t,setAttributes:r,selectedProduct:l,setSelectedProduct:a,insideParent:i,clientId:s}),e.jsx(ue,{value:{product:l},children:e.jsx(J,{template:d,templateLock:!1,allowedBlocks:Me})})]})},save:function(){return e.jsx(J.Content,{})},supports:{html:!1,align:!0,typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalDefaultControls:{fontSize:!0}},color:{text:!0,background:!0},spacing:{margin:!0,padding:!0},__experimentalBorder:{color:!0,radius:!0,style:!0,width:!0}}});