# fluent-cart/1.7.1/assets/ProductReviewSummaryBlockEditor.js

FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler, version 1.7.1. 2 lines.

- Page: https://pluginprobe.com/plugins/fluent-cart/1.7.1/code/assets/ProductReviewSummaryBlockEditor.js
- Raw: https://pluginprobe.com/plugins/fluent-cart/1.7.1/raw/assets/ProductReviewSummaryBlockEditor.js
- Modified: 2026-10-08T14:52:14+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-cart/1.7.1/code/assets/ProductReviewSummaryBlockEditor.js#L10-L20`.

```javascript
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 as h}from"./chunks/EditorPanel.js?ver=1.7.1";import{E as j}from"./chunks/EditorPanelRow.js?ver=1.7.1";import{R as g,u as N,a as _}from"./chunks/reviewBlockShared.js?ver=1.7.1";import{R as u,t as y}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:P}=wp.blockEditor,{ColorPicker:R}=wp.components,E=({attributes:t,setAttributes:a,selectedProduct:c,setSelectedProduct:l,insideParent:o})=>e.jsx(P,{children:e.jsx("div",{className:"fct-inspector-control-wrap fct-inspector-control-wrap--product-card fct-inspector-control-wrap--review-summary",children:e.jsx("div",{className:"fct-inspector-control-group",children:e.jsxs("div",{className:"fct-inspector-control-body",children:[!o&&e.jsx(g,{attributes:t,setAttributes:a,selectedProduct:c,setSelectedProduct:l}),e.jsx(h,{title:i("Star Color"),children:e.jsx(j,{children:e.jsx(R,{color:t.starColor,onChange:r=>a({starColor:r}),enableAlpha:!1})})})]})})})}),C=({hasProductData:t,avgRating:a,reviewCount:c,ratingBreakdown:l,starColor:o})=>t?e.jsxs("div",{className:"fct-reviews-block-real-summary",children:[e.jsxs("div",{className:"fct-reviews-block-real-average",children:[e.jsx("span",{className:"fct-reviews-block-real-average-number",children:a||0}),e.jsx("span",{className:"fct-reviews-block-real-average-max",children:"/5"})]}),e.jsx("div",{className:"fct-reviews-block-real-stars",children:[1,2,3,4,5].map(r=>e.jsx("span",{style:{color:r<=Math.round(a)?o:"#d1d5db"},children:e.jsx(u,{})},r))}),e.jsxs("div",{className:"fct-reviews-block-real-total",children:[i("Based on")," ",c," ",c===1?i("review"):i("reviews")]}),e.jsx("div",{className:"fct-reviews-block-real-bars",children:[5,4,3,2,1].map(r=>{const n=parseInt(l[r],10)||0,s=c>0?Math.round(n/c*100):0;return e.jsxs("div",{className:"fct-reviews-block-real-bar-row",children:[e.jsxs("span",{className:"fct-reviews-block-real-bar-label",children:[r," ",e.jsx(u,{})]}),e.jsx("div",{className:"fct-reviews-block-skeleton-bar-track",children:e.jsx("div",{className:"fct-reviews-block-real-bar-fill",style:{width:`${s}%`,background:o}})}),e.jsx("span",{className:"fct-reviews-block-real-bar-count",children:n})]},r)})})]}):e.jsxs("div",{className:"fct-reviews-block-skeleton-aside",children:[e.jsx("div",{className:"fct-reviews-block-skeleton-score"}),e.jsx("div",{className:"fct-reviews-block-skeleton-line is-short"}),[5,4,3,2,1].map(r=>e.jsxs("div",{className:"fct-reviews-block-skeleton-bar-row",children:[e.jsx("div",{className:"fct-reviews-block-skeleton-bar-label"}),e.jsx("div",{className:"fct-reviews-block-skeleton-bar-track"})]},r))]}),{useBlockProps:I}=wp.blockEditor,{registerBlockType:B}=wp.blocks,{useEffect:q}=wp.element,d=window.fluent_cart_product_review_summary_data;B(d.slug+"/"+d.name,{apiVersion:3,title:d.title,description:d.description,icon:{src:y},category:"fluent-cart",attributes:{query_type:{type:"string",default:"default"},product_id:{type:["string","number"],default:""},starColor:{type:"string",default:"#f59e0b"}},edit:({attributes:t,setAttributes:a,clientId:c})=>{var f;const l=I({className:"fct-review-summary-block-editor"}),o=N(c),{selectedProduct:r,setSelectedProduct:n,reviewSummary:s,effectiveProductId:v}=_(t,o,!0);q(()=>{o&&t.query_type!=="default"&&a({query_type:"default"})},[o,t.query_type]);const p=((f=r==null?void 0:r.detail)==null?void 0:f.other_info)||{},b=parseFloat((s==null?void 0:s.average)??p.average_rating)||0,k=parseInt((s==null?void 0:s.total)??p.review_count,10)||0,w=(s==null?void 0:s.breakdown)||p.rating_breakdown||{},x=t.starColor||"#f59e0b",m=!!v&&!!(r!=null&&r.ID);return e.jsxs("div",{...l,children:[e.jsx(E,{attributes:t,setAttributes:a,selectedProduct:r,setSelectedProduct:n,insideParent:o}),e.jsxs("div",{className:"fct-reviews-block-skeleton",children:[e.jsx(C,{hasProductData:m,avgRating:b,reviewCount:k,ratingBreakdown:w,starColor:x}),!m&&!o&&e.jsx("div",{className:"fct-reviews-block-skeleton-caption",children:i("Reviews will be displayed for the current product")})]})]})},save:function(){return null},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}}});

```
