# fluent-cart/1.4.1/assets/ProductImageBlockEditor.js

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

- Page: https://pluginprobe.com/plugins/fluent-cart/1.4.1/code/assets/ProductImageBlockEditor.js
- Raw: https://pluginprobe.com/plugins/fluent-cart/1.4.1/raw/assets/ProductImageBlockEditor.js
- Modified: 2026-06-12T12:04:56+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.4.1/code/assets/ProductImageBlockEditor.js#L10-L20`.

```javascript
import{j as t,b as f}from"./chunks/BlockEditorTranslator.js?ver=1.4.1";import{a as k}from"./chunks/index5.js?ver=1.4.1";import{S as v}from"./chunks/SelectProductModal.js?ver=1.4.1";import{E as y}from"./chunks/EditorPanel.js?ver=1.4.1";import{E as N}from"./chunks/EditorPanelRow.js?ver=1.4.1";import{u as E}from"./chunks/SingleProductContext.js?ver=1.4.1";import{h as B}from"./chunks/Icons.js?ver=1.4.1";import{a as S}from"./chunks/add-query-args.js?ver=1.4.1";import"./chunks/ProductListItem.js?ver=1.4.1";import"./chunks/index6.js?ver=1.4.1";const{InspectorControls:I}=wp.blockEditor,C=({attributes:l,setAttributes:p,selectedProduct:e,setSelectedProduct:d,isInsideProductInfo:r})=>{var s,a;return r?null: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.jsx(y,{title:f("Product"),children:t.jsxs(N,{className:"flex-col",children:[t.jsx(v,{onModalClosed:o=>{p({product_id:o!=null&&o.ID?String(o.ID):""}),d(o)},selectedProduct:e,setSelectedProduct:d,isMultiple:!1}),(e==null?void 0:e.post_title)&&t.jsxs("div",{className:"fct-selected-products",children:[t.jsx("span",{className:"fct-selected-products__label",children:f("Selected Product")}),t.jsx("div",{className:"fct-selected-products__list",children:t.jsx("div",{className:"fct-product-chip-group",children:t.jsx("span",{className:"fct-product-chip fct-product-chip--parent",children:e.post_title})})}),((a=(s=e==null?void 0:e.detail)==null?void 0:s.featured_media)==null?void 0:a.url)&&t.jsx("div",{className:"fct-selected-products__preview",children:t.jsx("img",{src:e.detail.featured_media.url,alt:e.post_title,style:{width:"100%",maxHeight:"150px",objectFit:"cover",borderRadius:"4px",marginTop:"8px"}})})]})]})})})})})})},{useBlockProps:R,InnerBlocks:u}=wp.blockEditor,{registerBlockType:q,createBlock:F}=wp.blocks,{useEffect:m,useState:M}=wp.element,{useSelect:A}=wp.data,{store:T}=wp.blockEditor,n=window.fluent_cart_product_image_data;var _;const c=(_=window.fluentCartRestVars)==null?void 0:_.rest;q(n.slug+"/"+n.name,{apiVersion:3,title:n.title,description:n.description,icon:{src:B},category:"fluent-cart",attributes:{product_id:{type:["string","number"],default:""},query_type:{type:"string",default:"default"},inside_product_info:{type:"string",default:"-"}},edit:({attributes:l,setAttributes:p,clientId:e})=>{const d=R(),[r,s]=M({}),a=E(),o=A(i=>{const{getBlockParents:g,getBlockName:j}=i(T);return g(e).some(w=>{const b=j(w);return["fluent-cart/product-info","fluent-cart/products","fluent-cart/shopapp-product-container","fluent-cart/shopapp-product-loop","fluent-cart/product-carousel"].includes(b)})},[e]);m(()=>{p({inside_product_info:o?"yes":"no",...o?{}:{query_type:"custom"}})},[o]);const h=()=>{c!=null&&c.url&&k({path:S(c.url+"/products/"+l.product_id,{with:["detail","variants"]}),headers:{"X-WP-Nonce":c==null?void 0:c.nonce}}).then(i=>{s((i==null?void 0:i.product)||{})}).catch(()=>{s({})})};m(()=>{a!=null&&a.product?s(a.product):!o&&l.product_id&&h()},[l.product_id,a==null?void 0:a.product]);const x=()=>{const i=window.fluent_cart_block_editor_asset.placeholder_image;return r&&r.detail&&r.detail.featured_media&&r.detail.featured_media!==null&&typeof r.detail.featured_media=="object"&&r.detail.featured_media.url?r.detail.featured_media.url:i};return t.jsxs("div",{...d,children:[t.jsx(C,{attributes:l,setAttributes:p,selectedProduct:r,setSelectedProduct:s,isInsideProductInfo:o}),t.jsxs("div",{className:"relative group-[.list]:flex-shrink-0",children:[t.jsx("img",{src:x(),className:"w-full aspect-square object-cover rounded-md group-[.list]:w-[214px] pointer-events-none",alt:r.post_title||"Product"}),t.jsx("div",{className:"absolute inset-0",style:{pointerEvents:"auto"},children:t.jsx(u,{allowedBlocks:["fluent-cart/sold-out-badge","fluent-cart/sale-badge","fluent-cart/shopapp-product-title"],renderAppender:u.ButtonBlockAppender})})]})]})},save:function(){return t.jsx(u.Content,{})},deprecated:[{save:()=>null}],transforms:{from:[{type:"block",blocks:["fluent-cart/shopapp-product-image"],transform:()=>F(n.slug+"/"+n.name)}]},supports:{html:!1,align:["left","center","right"],__experimentalBorder:{color:!0,radius:!0,style:!0,width:!0},spacing:{margin:!0,padding:!0},shadow:!0,__experimentalFilter:{duotone:!0}}});

```
