# fluent-cart/1.3.19/assets/BuySectionBlockEditor.js

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

- Page: https://pluginprobe.com/plugins/fluent-cart/1.3.19/code/assets/BuySectionBlockEditor.js
- Raw: https://pluginprobe.com/plugins/fluent-cart/1.3.19/raw/assets/BuySectionBlockEditor.js
- Modified: 2026-04-20T13:45:50+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.3.19/code/assets/BuySectionBlockEditor.js#L10-L20`.

```javascript
import{j as t,b as i}from"./chunks/BlockEditorTranslator.js?ver=1.3.19";import{a as B}from"./chunks/index5.js?ver=1.3.19";import{E as C}from"./chunks/EditorPanel.js?ver=1.3.19";import{E as v}from"./chunks/EditorPanelRow.js?ver=1.3.19";import{C as E}from"./chunks/CustomSelect.js?ver=1.3.19";import{S as q}from"./chunks/SelectProductModal.js?ver=1.3.19";import{B as L}from"./chunks/Icons.js?ver=1.3.19";import{a as M}from"./chunks/add-query-args.js?ver=1.3.19";import"./chunks/index6.js?ver=1.3.19";import"./chunks/ProductListItem.js?ver=1.3.19";const{InspectorControls:I}=wp.blockEditor,$=({attributes:r,setAttributes:c,selectedProduct:o,setSelectedProduct:d})=>t.jsx(I,{children:t.jsx("div",{className:"fct-inspector-control-wrap fct-inspector-control-wrap--product-card",children:t.jsx("div",{className:"fct-inspector-control-group",children:t.jsx("div",{className:"fct-inspector-control-body",children:t.jsxs(C,{title:i("Product"),children:[t.jsxs(v,{children:[t.jsx("span",{className:"fct-inspector-control-label",children:i("Query type")}),t.jsx("div",{className:"actions",children:t.jsx(E,{customKeys:{key:"value",label:"label"},defaultValue:r.query_type,options:[{label:i("Default"),value:"default"},{label:i("Custom"),value:"custom"}],onChange:function(e){c({query_type:e})}})})]}),r.query_type==="custom"&&t.jsxs(v,{className:"flex-col",children:[t.jsx(q,{onModalClosed:e=>{c({product_id:e.ID||""}),d(e)},selectedProduct:o,setSelectedProduct:d,isMultiple:!1}),o&&t.jsxs("div",{className:"fct-selected-variation-info w-full",children:[t.jsx("strong",{children:i("Selected product:")}),t.jsx("p",{children:o.post_title})]})]})]})})})})}),{createContext:R,useContext:D}=wp.element,g=R();g.Provider;const Q=()=>{const r=D(g);return r||(console.warn("useSingleProductData must be used within a SingleProductDataProvider"),null)},V=""+new URL("assets/BuySection.png",import.meta.url).href,{useBlockProps:W}=wp.blockEditor,{registerBlockType:F}=wp.blocks,{useEffect:j,useState:U}=wp.element,{useSelect:z}=wp.data,{store:K}=wp.blockEditor,l=window.fluent_cart_buy_section_data,y=l.placeholder_image,w=window.fluentCartRestVars.rest;F(l.slug+"/"+l.name,{apiVersion:3,title:l.title,description:l.description,icon:{src:L},example:{attributes:{},innerBlocks:[{name:"core/image",attributes:{url:V,alt:"Buy Section Preview",style:{width:"100%",height:"auto"}}}]},category:"fluent-cart",attributes:{product_id:{type:["string","number"],default:""},query_type:{type:"string",default:"default"},inside_product_info:{type:"string",default:"-"}},edit:({attributes:r,setAttributes:c,clientId:o})=>{var m,f,h,x;const d=W(),[e,u]=U({}),N=w.url+"/products/"+r.product_id,a=Q(),p=z(s=>{const{getBlockParents:n,getBlockName:b}=s(K);return n(o).some(k=>{const S=b(k);return["fluent-cart/product-info","fluent-cart/product-carousel"].includes(S)})},[o]);c({inside_product_info:p?"yes":"no"});const _=()=>{B({path:M(N,{with:["variants"]}),headers:{"X-WP-Nonce":w.nonce}}).then(s=>{u(s.product||{})}).finally(()=>{})};return j(()=>{a!=null&&a.product&&u(a.product)},[a==null?void 0:a.product]),j(()=>{p||_()},[r.product_id]),t.jsxs("div",{...d,children:[p?"":t.jsx($,{attributes:r,setAttributes:c,selectedProduct:e,setSelectedProduct:u}),t.jsxs("div",{className:"fct_buy_section",children:[(e==null?void 0:e.variants)&&new Set(e.variants.map(s=>{var n;return(n=s.other_info)==null?void 0:n.payment_type})).size>1&&t.jsx("div",{className:"fct-product-tab-nav",children:[...new Set(e.variants.map(s=>{var n;return(n=s.other_info)==null?void 0:n.payment_type}))].filter(Boolean).map((s,n)=>t.jsx("div",{className:`fct-product-tab-nav-item ${n===0?"active":""}`,children:s},s))}),t.jsx("div",{className:"fct-product-variants",children:(m=e==null?void 0:e.variants)!=null&&m.length?e.variants.map((s,n)=>t.jsx("div",{className:`fct-product-variant-item ${n===0?"selected":""}`,children:t.jsxs("div",{className:"variant-content",children:[t.jsx("div",{className:"fct-product-variant-image",children:t.jsx("img",{src:s.thumbnail??y,alt:s.variation_title??""})}),t.jsx("div",{className:"fct-product-variant-title",children:s.variation_title??i("Select a product")})]})},s.id??n)):t.jsx("div",{className:"fct-product-variant-item",children:t.jsxs("div",{className:"variant-content",children:[t.jsx("div",{className:"fct-product-variant-image",children:t.jsx("img",{src:((h=(f=e==null?void 0:e.detail)==null?void 0:f.featured_media)==null?void 0:h.url)??y,alt:(e==null?void 0:e.post_title)??""})}),t.jsx("div",{className:"fct-product-variant-title",children:(e==null?void 0:e.post_title)??i("Select a product")})]})})}),t.jsx("div",{className:"fct-product-item-price",children:(x=e==null?void 0:e.variants)!=null&&x[0]?`$${(e.variants[0].item_price/100).toFixed(2)}`:"$0.00"}),t.jsxs("div",{className:"fct-product-quantity-container",children:[t.jsx("h5",{className:"quantity-title",children:i("Quantity")}),t.jsxs("div",{className:"fct-product-quantity",children:[t.jsx("button",{className:"fct-quantity-decrease-button",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"2",viewBox:"0 0 14 2",fill:"none",children:t.jsx("path",{d:"M12.3333 1L1.66659 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),t.jsx("input",{type:"text",className:"fct-quantity-input",value:"1",min:"1",max:"10000"}),t.jsx("button",{className:"fct-quantity-increase-button",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:t.jsx("path",{d:"M6.99996 1.66666L6.99996 12.3333M12.3333 6.99999L1.66663 6.99999",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),t.jsxs("div",{className:"fct-product-buttons-wrap",children:[t.jsx("button",{className:"fluent-cart-direct-checkout-button",children:i("Buy Now")}),t.jsx("button",{className:"fluent-cart-add-to-cart-button",children:i("Add To Cart")})]})]})]})},save:function(r){return null}});

```
