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/ProductRatingBlockEditor.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{b as i}from"./chunks/BlockEditorTranslator.js?ver=1.7.0";import{E as b}from"./chunks/EditorPanel.js?ver=1.7.0";import{E}from"./chunks/EditorPanelRow.js?ver=1.7.0";import{R as P,u as H,a as M}from"./chunks/reviewBlockShared.js?ver=1.7.0";import{o as S}from"./chunks/Icons.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";import"./chunks/SingleProductContext.js?ver=1.7.0";const{InspectorControls:I}=wp.blockEditor,{__experimentalNumberControl:_}=wp.components,q=({attributes:r,setAttributes:o,selectedProduct:p,setSelectedProduct:d,insideParent:s})=>e.jsx(I,{children:e.jsx("div",{className:"fct-inspector-control-wrap fct-inspector-control-wrap--product-card fct-inspector-control-wrap--product-rating",children:e.jsx("div",{className:"fct-inspector-control-group",children:e.jsxs("div",{className:"fct-inspector-control-body",children:[!s&&e.jsx(P,{attributes:r,setAttributes:o,selectedProduct:p,setSelectedProduct:d}),e.jsx(b,{title:i("Visibility"),children:e.jsxs(E,{className:"flex-col",children:[e.jsx(_,{label:i("Minimum Reviews"),help:i("Hide the rating until the product has at least this many reviews. 0 always shows it, including five empty stars on a product with none."),value:r.minReviewCount,min:0,step:1,onChange:t=>{const n=parseInt(t,10);o({minReviewCount:isNaN(n)||n<0?0:n})}}),e.jsx(_,{label:i("Minimum Average Rating"),help:i("Hide the rating unless the product averages at least this many stars. 0 shows every rating. Half stars are allowed."),value:r.minAverageRating,min:0,max:5,step:.5,onChange:t=>{const n=parseFloat(t);if(isNaN(n)||n<0){o({minAverageRating:0});return}o({minAverageRating:Math.min(5,n)})}})]})})]})})})}),{useBlockProps:B}=wp.blockEditor,{registerBlockType:F}=wp.blocks,l=window.fluent_cart_product_rating_data;F(l.slug+"/"+l.name,{apiVersion:3,title:l.title,description:l.description,icon:{src:S},category:"fluent-cart",attributes:{query_type:{type:"string",default:"default"},product_id:{type:["string","number"],default:""},minReviewCount:{type:"number",default:0},minAverageRating:{type:"number",default:0}},edit:({attributes:r,setAttributes:o,clientId:p})=>{var v,w,y,x;const d=B({className:"fct-product-rating-block-editor"}),s=H(p),{selectedProduct:t,setSelectedProduct:n}=M(r,s,!1);wp.element.useEffect(()=>{s&&r.query_type!=="default"&&o({query_type:"default"})},[s,r.query_type]);const u=((w=(v=t==null?void 0:t.detail)==null?void 0:v.other_info)==null?void 0:w.average_rating)||0,f=((x=(y=t==null?void 0:t.detail)==null?void 0:y.other_info)==null?void 0:x.review_count)||0,N=c=>{const R=[];for(let a=1;a<=5;a++){const j=a<=Math.floor(c),k=!j&&a===Math.floor(c)+1&&c-Math.floor(c)>=.5;let m="fct-star fct-star-empty";j?m="fct-star fct-star-filled":k&&(m="fct-star fct-star-half"),R.push(e.jsx("span",{className:m,children:"★"},a))}return R},h=parseInt(r.minReviewCount,10)||0,g=parseFloat(r.minAverageRating)||0,C=h>0&&f<h||g>0&&u<g;return e.jsxs("div",{...d,children:[e.jsx(q,{attributes:r,setAttributes:o,selectedProduct:t,setSelectedProduct:n,insideParent:s}),C?e.jsx("span",{className:"fct-product-rating-block-editor-hidden",children:i("Hidden — this product is below the thresholds set here")}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"fct-product-card-stars",children:N(u)}),e.jsxs("span",{className:"fct-product-card-review-count",children:["(",f,")"]})]})]})},save:function(){return null},supports:{html:!1,align:["left","center","right"],typography:{fontSize:!0,lineHeight:!0,__experimentalDefaultControls:{fontSize:!0}},color:{text:!0},spacing:{margin:!0,padding:!0}}});
1 +import{j as e}from"./chunks/jsx-runtime.js?ver=1.7.1";import{b as i}from"./chunks/BlockEditorTranslator.js?ver=1.7.1";import{E}from"./chunks/EditorPanel.js?ver=1.7.1";import{E as P}from"./chunks/EditorPanelRow.js?ver=1.7.1";import{R as S,u as H,a as M}from"./chunks/reviewBlockShared.js?ver=1.7.1";import{o as I,R as q}from"./chunks/Icons.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/SingleProductContext.js?ver=1.7.1";import"./chunks/reviewStar2.js?ver=1.7.1";const{InspectorControls:A}=wp.blockEditor,{__experimentalNumberControl:_}=wp.components,B=({attributes:r,setAttributes:s,selectedProduct:l,setSelectedProduct:p,insideParent:d})=>e.jsx(A,{children:e.jsx("div",{className:"fct-inspector-control-wrap fct-inspector-control-wrap--product-card fct-inspector-control-wrap--product-rating",children:e.jsx("div",{className:"fct-inspector-control-group",children:e.jsxs("div",{className:"fct-inspector-control-body",children:[!d&&e.jsx(S,{attributes:r,setAttributes:s,selectedProduct:l,setSelectedProduct:p}),e.jsx(E,{title:i("Visibility"),children:e.jsxs(P,{className:"flex-col",children:[e.jsx(_,{label:i("Minimum Reviews"),help:i("Hide the rating until the product has at least this many reviews. 0 always shows it, including five empty stars on a product with none."),value:r.minReviewCount,min:0,step:1,onChange:n=>{const t=parseInt(n,10);s({minReviewCount:isNaN(t)||t<0?0:t})}}),e.jsx(_,{label:i("Minimum Average Rating"),help:i("Hide the rating unless the product averages at least this many stars. 0 shows every rating. Half stars are allowed."),value:r.minAverageRating,min:0,max:5,step:.5,onChange:n=>{const t=parseFloat(n);if(isNaN(t)||t<0){s({minAverageRating:0});return}s({minAverageRating:Math.min(5,t)})}})]})})]})})})}),{useBlockProps:F}=wp.blockEditor,{registerBlockType:z}=wp.blocks,o=window.fluent_cart_product_rating_data;z(o.slug+"/"+o.name,{apiVersion:3,title:o.title,description:o.description,icon:{src:I},category:"fluent-cart",attributes:{query_type:{type:"string",default:"default"},product_id:{type:["string","number"],default:""},minReviewCount:{type:"number",default:0},minAverageRating:{type:"number",default:0}},edit:({attributes:r,setAttributes:s,clientId:l})=>{var v,w,x,y;const p=F({className:"fct-product-rating-block-editor"}),d=!!o.reviews_active,n=H(l),{selectedProduct:t,setSelectedProduct:N}=M(r,n,!1);wp.element.useEffect(()=>{n&&r.query_type!=="default"&&s({query_type:"default"})},[n,r.query_type]);const u=((w=(v=t==null?void 0:t.detail)==null?void 0:v.other_info)==null?void 0:w.average_rating)||0,f=((y=(x=t==null?void 0:t.detail)==null?void 0:x.other_info)==null?void 0:y.review_count)||0,C=c=>{const R=[];for(let a=1;a<=5;a++){const j=a<=Math.floor(c),b=!j&&a===Math.floor(c)+1&&c-Math.floor(c)>=.5;let m="fct-star fct-star-empty";j?m="fct-star fct-star-filled":b&&(m="fct-star fct-star-half"),R.push(e.jsx("span",{className:m,children:e.jsx(q,{})},a))}return R},h=parseInt(r.minReviewCount,10)||0,g=parseFloat(r.minAverageRating)||0,k=h>0&&f<h||g>0&&u<g;return d?e.jsxs("div",{...p,children:[e.jsx(B,{attributes:r,setAttributes:s,selectedProduct:t,setSelectedProduct:N,insideParent:n}),k?e.jsx("span",{className:"fct-product-rating-block-editor-hidden",children:i("Hidden — this product is below the thresholds set here")}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"fct-product-card-stars",children:C(u)}),e.jsxs("span",{className:"fct-product-card-review-count",children:["(",f,")"]})]})]}):null},save:function(){return null},supports:{inserter:!!o.reviews_active,html:!1,align:["left","center","right"],typography:{fontSize:!0,lineHeight:!0,__experimentalDefaultControls:{fontSize:!0}},color:{text:!0},spacing:{margin:!0,padding:!0}}});