| @@ -1 +1 @@ | ||
| 1 | -import{j as t}from"./chunks/jsx-runtime.js?ver=1.6.4";import{n as _}from"./chunks/Icons.js?ver=1.6.4";import{a as y}from"./chunks/index5.js?ver=1.6.4";import{S as k}from"./chunks/SelectProductModal.js?ver=1.6.4";import{E as b}from"./chunks/EditorPanel.js?ver=1.6.4";import{E as u}from"./chunks/EditorPanelRow.js?ver=1.6.4";import{b as c}from"./chunks/BlockEditorTranslator.js?ver=1.6.4";import{S as v}from"./chunks/SingleProductContext.js?ver=1.6.4";import{a as w}from"./chunks/add-query-args.js?ver=1.6.4";import"./chunks/ProductListItem.js?ver=1.6.4";import"./chunks/index6.js?ver=1.6.4";const{InspectorControls:N}=wp.blockEditor,{__experimentalToggleGroupControl:E,__experimentalToggleGroupControlOption:C}=wp.components,S=E,d=C,I=({attributes:e,setAttributes:s,selectedProduct:o,setSelectedProduct:n})=>t.jsx(N,{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(b,{title:c("Product"),children:[t.jsx(u,{children:t.jsxs(S,{isBlock:!0,label:c("Query type"),value:e.query_type,onChange:r=>{s({query_type:r})},children:[t.jsx(d,{value:"default",label:c("Default")}),t.jsx(d,{value:"custom",label:c("Custom")})]})}),e.query_type==="custom"&&t.jsxs(u,{className:"flex-col",children:[t.jsx(k,{onModalClosed:r=>{s({product_id:r!=null&&r.ID?String(r.ID):""}),n(r)},selectedProduct:o,setSelectedProduct:n,isMultiple:!1}),(o==null?void 0:o.post_title)&&t.jsxs("div",{className:"fct-selected-products",children:[t.jsx("span",{className:"fct-selected-products__label",children:c("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:o.post_title})})})]})]})]})})})})}),P=""+new URL("assets/ProductInfo.png",import.meta.url).href,{useBlockProps:f,InnerBlocks:m}=wp.blockEditor,{registerBlockType:B}=wp.blocks,{useEffect:T,useState:g}=wp.element,l=window.fluent_cart_product_info_data;l.placeholder_image;const h=window.fluentCartRestVars.rest,D=[["core/columns",{},[["core/column",{},[["fluent-cart/product-gallery",{}]]],["core/column",{},[["fluent-cart/product-title",{}],["fluent-cart/excerpt",{}],["fluent-cart/stock",{}],["fluent-cart/product-sku",{}],["fluent-cart/price-range",{}],["fluent-cart/product-package-description",{}],["fluent-cart/buy-section",{}]]]]]];B(l.slug+"/"+l.name,{apiVersion:3,title:l.title,description:l.description,example:{attributes:{},innerBlocks:[{name:"core/image",attributes:{url:P,alt:"Product Info Preview",style:{width:"100%",height:"auto"}}}]},icon:{src:_},category:"fluent-cart",supports:{html:!1,reusable:!1,innerBlocks:!0},attributes:{product_id:{type:["string","number"],default:""},variant_id:{type:"string",default:""},query_type:{type:"string",default:"default"}},edit:({attributes:e,setAttributes:s})=>{const o=f({className:"my-plugin-product-card"}),[n,r]=g({}),[i,a]=g(null),x=p=>{if(!p){a(null);return}y({path:w(h.url+"/products/"+p,{with:["block_product_detail"]}),headers:{"X-WP-Nonce":h.nonce}}).then(j=>{a(j.product||null)})};return T(()=>{x(e.product_id)},[e.product_id]),t.jsxs("div",{...o,children:[t.jsx(I,{attributes:e,setAttributes:s,selectedProduct:i,setSelectedProduct:a}),t.jsx("div",{className:"product-card-inner",style:{border:"1px solid #eee",padding:"16px",borderRadius:"8px"},children:t.jsx(v,{value:{product:i},children:t.jsx(m,{template:D,templateLock:!1,allowedBlocks:["core/heading","fluent-cart/buy-section","fluent-cart/product-gallery","fluent-cart/stock","fluent-cart/product-sku","fluent-cart/price-range","core/columns","core/paragraph","core/title","fluent-cart/shopapp-product-title","fluent-cart/excerpt","fluent-cart/sale-badge","fluent-cart/product-package-description"]})})})]})},save:()=>{const e=f.save({className:"my-plugin-product-card"});return t.jsx("div",{...e,children:t.jsx("div",{className:"product-card-inner",children:t.jsx(m.Content,{})})})}}); | |
| 1 | +import{j as t}from"./chunks/jsx-runtime.js?ver=1.6.5";import{n as _}from"./chunks/Icons.js?ver=1.6.5";import{a as y}from"./chunks/index5.js?ver=1.6.5";import{S as k}from"./chunks/SelectProductModal.js?ver=1.6.5";import{E as b}from"./chunks/EditorPanel.js?ver=1.6.5";import{E as u}from"./chunks/EditorPanelRow.js?ver=1.6.5";import{b as c}from"./chunks/BlockEditorTranslator.js?ver=1.6.5";import{S as v}from"./chunks/SingleProductContext.js?ver=1.6.5";import{a as w}from"./chunks/add-query-args.js?ver=1.6.5";import"./chunks/ProductListItem.js?ver=1.6.5";import"./chunks/index6.js?ver=1.6.5";const{InspectorControls:N}=wp.blockEditor,{__experimentalToggleGroupControl:E,__experimentalToggleGroupControlOption:C}=wp.components,S=E,d=C,I=({attributes:e,setAttributes:s,selectedProduct:o,setSelectedProduct:n})=>t.jsx(N,{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(b,{title:c("Product"),children:[t.jsx(u,{children:t.jsxs(S,{isBlock:!0,label:c("Query type"),value:e.query_type,onChange:r=>{s({query_type:r})},children:[t.jsx(d,{value:"default",label:c("Default")}),t.jsx(d,{value:"custom",label:c("Custom")})]})}),e.query_type==="custom"&&t.jsxs(u,{className:"flex-col",children:[t.jsx(k,{onModalClosed:r=>{s({product_id:r!=null&&r.ID?String(r.ID):""}),n(r)},selectedProduct:o,setSelectedProduct:n,isMultiple:!1}),(o==null?void 0:o.post_title)&&t.jsxs("div",{className:"fct-selected-products",children:[t.jsx("span",{className:"fct-selected-products__label",children:c("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:o.post_title})})})]})]})]})})})})}),P=""+new URL("assets/ProductInfo.png",import.meta.url).href,{useBlockProps:f,InnerBlocks:m}=wp.blockEditor,{registerBlockType:B}=wp.blocks,{useEffect:T,useState:g}=wp.element,l=window.fluent_cart_product_info_data;l.placeholder_image;const h=window.fluentCartRestVars.rest,D=[["core/columns",{},[["core/column",{},[["fluent-cart/product-gallery",{}]]],["core/column",{},[["fluent-cart/product-title",{}],["fluent-cart/excerpt",{}],["fluent-cart/stock",{}],["fluent-cart/product-sku",{}],["fluent-cart/price-range",{}],["fluent-cart/product-package-description",{}],["fluent-cart/buy-section",{}]]]]]];B(l.slug+"/"+l.name,{apiVersion:3,title:l.title,description:l.description,example:{attributes:{},innerBlocks:[{name:"core/image",attributes:{url:P,alt:"Product Info Preview",style:{width:"100%",height:"auto"}}}]},icon:{src:_},category:"fluent-cart",supports:{html:!1,reusable:!1,innerBlocks:!0},attributes:{product_id:{type:["string","number"],default:""},variant_id:{type:"string",default:""},query_type:{type:"string",default:"default"}},edit:({attributes:e,setAttributes:s})=>{const o=f({className:"my-plugin-product-card"}),[n,r]=g({}),[i,a]=g(null),x=p=>{if(!p){a(null);return}y({path:w(h.url+"/products/"+p,{with:["block_product_detail"]}),headers:{"X-WP-Nonce":h.nonce}}).then(j=>{a(j.product||null)})};return T(()=>{x(e.product_id)},[e.product_id]),t.jsxs("div",{...o,children:[t.jsx(I,{attributes:e,setAttributes:s,selectedProduct:i,setSelectedProduct:a}),t.jsx("div",{className:"product-card-inner",style:{border:"1px solid #eee",padding:"16px",borderRadius:"8px"},children:t.jsx(v,{value:{product:i},children:t.jsx(m,{template:D,templateLock:!1,allowedBlocks:["core/heading","fluent-cart/buy-section","fluent-cart/product-gallery","fluent-cart/stock","fluent-cart/product-sku","fluent-cart/price-range","core/columns","core/paragraph","core/title","fluent-cart/shopapp-product-title","fluent-cart/excerpt","fluent-cart/sale-badge","fluent-cart/product-package-description"]})})})]})},save:()=>{const e=f.save({className:"my-plugin-product-card"});return t.jsx("div",{...e,children:t.jsx("div",{className:"product-card-inner",children:t.jsx(m.Content,{})})})}}); | |