PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
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 1.3.20 1.3.19 trunk All 48 releases
← All changes | assets/ShopAppBlockEditor.js +1 -1 1.3.19 → 1.6.5 View file →
@@ -1 +1 @@
1 -import{j as e,b as r}from"./chunks/BlockEditorTranslator.js?ver=1.3.19";import"./chunks/ColorPickerField.js?ver=1.3.19";import{C as j}from"./chunks/CustomSelect.js?ver=1.3.19";import{P as E}from"./chunks/Icons.js?ver=1.3.19";import{E as z}from"./chunks/ErrorBoundary.js?ver=1.3.19";import{P as F}from"./chunks/ProductContext.js?ver=1.3.19";import{a as B}from"./chunks/index5.js?ver=1.3.19";import"./chunks/index6.js?ver=1.3.19";const{Panel:O,PanelBody:$}=wp.components,x=s=>{const{title:t,children:a,initialOpen:n=!1}=s;return e.jsx("div",{className:"fct-block-editor-control",children:e.jsx(O,{children:e.jsx($,{title:t||null,initialOpen:n,children:e.jsx("div",{className:"fct-block-editor-control-body",children:a})})})})},{useEffect:ce}=wp.element,{ColorPicker:ie,__experimentalRadio:ne,__experimentalRadioGroup:de,RangeControl:pe}=wp.components,{__experimentalRadio:k,__experimentalRadioGroup:D,RangeControl:G}=wp.components,T=s=>{const{attributes:t,setAttributes:a,blockEditorData:n}=s,d=l=>{a({paginator:l})};return e.jsxs(x,{title:r("Paginator"),children:[e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("View")}),e.jsx("div",{className:"actions",children:e.jsxs(D,{className:"fct-block-editor-radio-group",label:r("Pagination Type"),onChange:d,checked:t.paginator,children:[e.jsx(k,{value:"scroll",children:r("Scroll")}),e.jsx(k,{value:"numbers",children:r("Numbers")})]})})]})}),e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Per Page/Scroll")}),e.jsx("div",{className:"actions",children:e.jsx(G,{value:t.per_page,onChange:l=>a({per_page:l}),min:1,max:50})})]})})]})},{TextControl:A,ToggleControl:m}=wp.components,L=s=>{const{attributes:t,setAttributes:a,blockEditorData:n}=s,d=(l,_)=>{let o={...t.filters??{}};o[l]=_,a({filters:{...o}})};return e.jsxs(x,{title:r("Filter Option"),children:[e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Enable Filter")}),e.jsx("div",{className:"actions",children:e.jsx(m,{checked:t.enable_filter,onChange:l=>{a({enable_filter:l})}})})]})}),t.enable_filter&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Wildcard Filter")}),e.jsx("div",{className:"actions",children:e.jsx(m,{checked:t.enable_wildcard_filter,onChange:l=>{a({enable_wildcard_filter:l})}})})]})}),t.enable_wildcard_filter&&e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Also search in Content")}),e.jsx("div",{className:"actions",children:e.jsx(m,{checked:t.enable_wildcard_for_post_content,onChange:l=>{a({enable_wildcard_for_post_content:l})}})})]})}),e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Live Filter")}),e.jsx("div",{className:"actions",children:e.jsx(m,{checked:t.live_filter,onChange:l=>{a({live_filter:l})}})})]})}),Object.keys(t.default_filter_options).map((l,_)=>{var c,f,h;let o={};return(c=t.filters)!=null&&c.hasOwnProperty(l)?o=t.filters[l]:(f=t.default_filter_options)!=null&&f.hasOwnProperty(l)&&(o=t.default_filter_options[l]),l!=="enabled"?e.jsxs("div",{className:"mt-5",children:[e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label capitalize",children:l.replace(/[-_]/g," ")}),e.jsx("div",{className:"actions",children:e.jsx(m,{checked:typeof t.filters<"u"&&typeof t.filters[l]<"u"&&((h=t.filters[l])==null?void 0:h.enabled),onChange:p=>{var u,w;let i={};(u=t.filters)!=null&&u.hasOwnProperty(l)?i=t.filters[l]:(w=t.default_filter_options)!=null&&w.hasOwnProperty(l)&&(i=t.default_filter_options[l]),i.enabled=p,i.filter_type=t.default_filter_options[l].filter_type,i.is_meta=t.default_filter_options[l].is_meta,i.multiple=t.default_filter_options[l].multiple,d(l,i)}})})]})}),e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Display Name")}),e.jsx("div",{className:"actions",children:e.jsx(A,{value:o.label,onChange:p=>{var u;let i={};(u=t.filters)!=null&&u.hasOwnProperty(l)?i=t.filters[l]:i.enabled=!0,i.label=p,d(l,i)}})})]})})]},l):e.jsx(e.Fragment,{})})]})]})};let R=[],S={};Object.keys(window.fluent_cart_shop_app_block_editor_data.taxonomies).map((s,t)=>{let a=window.fluent_cart_shop_app_block_editor_data.taxonomies[s];R[s]=[],S[s]={filter_type:"options",is_meta:!0,label:a.label,enabled:!1,multiple:!1}});const N={paginator:{type:"string",default:"scroll"},per_page:{type:"number",default:10},view_mode:{type:"string",default:"grid"},price_format:{type:"string",default:"starts_from"},search_grid_size:{type:"number",default:0},product_grid_size:{type:"number",default:0},product_box_grid_size:{type:"number",default:0},use_default_style:{type:"boolean",default:!0},enable_filter:{type:"boolean",default:!1},live_filter:{type:"boolean",default:!0},enable_wildcard_filter:{type:"boolean",default:!1},enable_wildcard_for_post_content:{type:"boolean",default:!1},order_type:{type:"string",default:"DESC"},order_by:{type:"string",default:"ID"},filters:{},default_filter_options:{type:"object",default:{...S,price_range:{filter_type:"range",is_meta:!1,label:"Price",enabled:!1}}},default_filters:{type:"object",default:{enabled:!1,allow_out_of_stock:!1,wildcard:"",...R}},colors:{}},{InspectorControls:V}=wp.blockEditor,{TextControl:I,Card:fe,CardHeader:ue,CardBody:me,ToggleControl:y,Button:_e,Tooltip:he,__experimentalRadio:xe,__experimentalRadioGroup:be,RangeControl:g}=wp.components,M=s=>{const{attributes:t,setAttributes:a,blockEditorData:n}=s,d=o=>{a({search_grid_size:o})},l=o=>{a({product_grid_size:o})},_=o=>{a({product_box_grid_size:o})};return e.jsx(V,{children:e.jsx("div",{id:"gutenpride-controls",className:"fluent-cart-product-block-editor",children:e.jsxs("div",{className:"fluent-cart-product-block-editor-inner",children:[e.jsx(T,{attributes:t,setAttributes:a,blockEditorData:n}),e.jsxs(x,{title:r("Product Grid Option"),children:[e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("View Mode")}),e.jsx("div",{className:"actions",children:e.jsx(j,{customKeys:{key:"value",label:"label"},defaultValue:t.view_mode,options:[{label:r("Grid"),value:"grid"},{label:r("List"),value:"list"}],onChange:function(o){a({view_mode:o})}})})]})}),e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Price Format")}),e.jsx("div",{className:"actions",children:e.jsx(j,{customKeys:{key:"value",label:"label"},defaultValue:t.price_format,options:[{label:r("Starts From"),value:"starts_from"},{label:r("Range"),value:"range"}],onChange:function(o){a({price_format:o})}})})]})}),e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Product Per Row")}),e.jsx("div",{className:"actions",children:e.jsx(g,{value:t.product_box_grid_size,onChange:_,min:0,max:5})})]})}),t.enable_filter&&e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Search Grid Size")}),e.jsx("div",{className:"actions",children:e.jsx(g,{value:t.search_grid_size,onChange:d,min:0,max:5})})]})}),t.enable_filter&&e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Product Grid Size")}),e.jsx("div",{className:"actions",children:e.jsx(g,{value:t.product_grid_size,onChange:l,min:0,max:5})})]})})]}),e.jsx(L,{attributes:t,setAttributes:a,blockEditorData:n}),e.jsx(x,{title:r("Default Filter"),children:e.jsxs("div",{children:[e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Enable Filtering")}),e.jsx("div",{className:"actions",children:e.jsx(y,{checked:t.default_filters.enabled,onChange:o=>{let c=t.default_filters;c.enabled=o,a({default_filters:{...c}})}})})]})}),t.default_filters.enabled&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Allow Out Of Stock")}),e.jsx("div",{className:"actions",children:e.jsx(y,{checked:t.default_filters.allow_out_of_stock,onChange:o=>{let c=t.default_filters;c.allow_out_of_stock=o,a({default_filters:{...c}})}})})]})}),e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Search")}),e.jsx("div",{className:"actions",children:e.jsx(I,{value:t.default_filters.wildcard,onChange:o=>{let c=t.default_filters;c.wildcard=o,a({default_filters:{...c}})}})})]})}),Object.keys(window.fluent_cart_shop_app_block_editor_data.taxonomies).map((o,c)=>{let f=window.fluent_cart_shop_app_block_editor_data.taxonomies[o];return e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:f.label}),e.jsx("div",{className:"actions",children:e.jsx(j,{placeholder:r("Select"),isMulti:!0,customKeys:{key:"value",label:"label"},defaultValue:t.default_filters[o],options:f.terms,onChange:function(h){let p={...t.default_filters};p[o]=h,a({default_filters:p})}})})]})},c)})]})]})})]})})},"setting")},U=""+new URL("assets/Products.png",import.meta.url).href,{registerBlockType:K}=wp.blocks,{useEffect:C,useState:H,Component:je,useMemo:ge,createContext:W}=wp.element;wp.serverSideRender;W();const{useBlockProps:P,InnerBlocks:v,BlockContextProvider:ve}=wp.blockEditor,b=window.fluent_cart_shop_app_block_editor_data;window.fluentCartShopAppTranslator=s=>{var t;return((t=window.fluent_cart_shop_app_block_editor_data)==null?void 0:t.trans[s])||s};const Y=s=>({...N.colors,...s.colors||{}}),q=window.fluentCartRestVars.rest.url,J=q+"/public/products",Q=[["fluent-cart/shopapp-product-action-container",{},[["fluent-cart/shopapp-product-view-switcher"],["fluent-cart/shopapp-product-filter-sort-by"]]],["fluent-cart/shopapp-product-container",{className:"fluent-product-container"},[["fluent-cart/shopapp-product-filter",{},[["fluent-cart/shopapp-product-filter-search-box"],["fluent-cart/shopapp-product-filter-filters"],["fluent-cart/shopapp-product-filter-button",{},[["fluent-cart/shopapp-product-filter-apply-button"],["fluent-cart/shopapp-product-filter-reset-button"]]]]],["fluent-cart/shopapp-product-loop",{className:"fluent-product-loop",layout:{type:"constrained"},metadata:{name:"Product Loop"}},[["fluent-cart/product-image"],["fluent-cart/product-title"],["fluent-cart/price-range"],["fluent-cart/shopapp-product-buttons"]]],["fluent-cart/shopapp-product-no-result",{className:"fluent-product-no-result",layout:{type:"constrained"},metadata:{name:"No Result"}},[["core/paragraph",{content:"No results found",align:"center",fontSize:"large"}],["core/paragraph",{content:r("You can try %1$s clearing any filters %2$s or head to our %3$s store's home %4$s",'<a href="#">',"</a>",'<a href="#">',"</a>"),align:"center"}]]],["fluent-cart/shopapp-product-loader",{layout:{type:"constrained"},metadata:{name:"Product Loader"}},[["fluent-cart/shopapp-product-spinner"]]]]],["fluent-cart/product-paginator",{className:"fluent-product-paginator",layout:{type:"constrained"},metadata:{name:"Paginator"}},[["fluent-cart/product-paginator-info"],["fluent-cart/product-paginator-number"]]]],X=`${b.slug}/${b.name}`;K(X,{apiVersion:3,providesContext:{"fluent-cart/paginator":"paginator","fluent-cart/per_page":"per_page","fluent-cart/enable_filter":"enable_filter","fluent-cart/product_box_grid_size":"product_box_grid_size","fluent-cart/view_mode":"view_mode","fluent-cart/filters":"filters","fluent-cart/default_filters":"default_filters","fluent-cart/order_type":"order_type","fluent-cart/order_by":"order_by","fluent-cart/live_filter":"live_filter","fluent-cart/price_format":"price_format","fluent-cart/enable_wildcard_filter":"enable_wildcard_filter"},title:b.title,icon:{src:E},example:{attributes:{},innerBlocks:[{name:"core/image",attributes:{url:U,alt:"Shop App Preview",style:{width:"100%",height:"auto"}}}]},supports:{html:!1,reusable:!1,innerBlocks:!0},category:"fluent-cart",attributes:{colors:{type:"object",default:N.colors||{}},message:{type:"string",default:""},variations:{type:"object",default:{}},...N},edit:({attributes:s,setAttributes:t})=>{const a=P({className:"fluent-cart-product-block-editor"}),[n,d]=H([]);return C(()=>{try{(!s.colors||Object.keys(s.colors).length===0)&&t({colors:Y(s)}),s.variations||t({variations:{}})}catch(l){console.error("Error in useEffect:",l)}},[]),C(()=>{B({path:J}).then(l=>{d(l.products.products.data)})},[]),e.jsx("div",{...a,children:e.jsx(z,{children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(M,{attributes:s,setAttributes:t,blockEditorData:b}),e.jsx("div",{className:"fluent-cart-inner-blocks",children:e.jsx(F,{value:{products:n},children:e.jsx(v,{template:Q,allowedBlocks:["core/group","core/columns","core/paragraph","core/image","core/heading"],templateLock:!1,renderAppender:v.ButtonBlockAppender})})})]})})})},save({attributes:s}){const t=P.save();return e.jsx("div",{...t,children:e.jsx("div",{className:"fct-products-wrapper","data-fluent-cart-shop-app":!0,"data-fluent-cart-product-wrapper":"",children:e.jsx(v.Content,{})})})}});
1 +import{j as e}from"./chunks/jsx-runtime.js?ver=1.6.5";import{b as r}from"./chunks/BlockEditorTranslator.js?ver=1.6.5";import{C as v}from"./chunks/CustomSelect.js?ver=1.6.5";import{P as z}from"./chunks/Icons.js?ver=1.6.5";import{E as F}from"./chunks/ErrorBoundary.js?ver=1.6.5";import{P as R}from"./chunks/ProductContext.js?ver=1.6.5";import{a as O}from"./chunks/index5.js?ver=1.6.5";import"./chunks/index6.js?ver=1.6.5";const{Panel:B,PanelBody:D}=wp.components,b=o=>{const{title:t,children:s,initialOpen:d=!1}=o;return e.jsx("div",{className:"fct-block-editor-control",children:e.jsx(B,{children:e.jsx(D,{title:t||null,initialOpen:d,children:e.jsx("div",{className:"fct-block-editor-control-body",children:s})})})})},{__experimentalRadio:w,__experimentalRadioGroup:T,RangeControl:$}=wp.components,G=o=>{const{attributes:t,setAttributes:s,blockEditorData:d}=o,n=l=>{s({paginator:l})};return e.jsxs(b,{title:r("Paginator"),children:[e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("View")}),e.jsx("div",{className:"actions",children:e.jsxs(T,{className:"fct-block-editor-radio-group",label:r("Pagination Type"),onChange:n,checked:t.paginator,children:[e.jsx(w,{value:"scroll",children:r("Scroll")}),e.jsx(w,{value:"numbers",children:r("Numbers")})]})})]})}),e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Per Page/Scroll")}),e.jsx("div",{className:"actions",children:e.jsx($,{value:t.per_page,onChange:l=>s({per_page:l}),min:1,max:50})})]})})]})},{TextControl:A,ToggleControl:u}=wp.components,L=o=>{const{attributes:t,setAttributes:s,blockEditorData:d}=o,n=(l,h)=>{let a={...t.filters??{}};a[l]=h,s({filters:{...a}})};return e.jsxs(b,{title:r("Filter Option"),children:[e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Enable Filter")}),e.jsx("div",{className:"actions",children:e.jsx(u,{checked:t.enable_filter,onChange:l=>{s({enable_filter:l})}})})]})}),t.enable_filter&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Wildcard Filter")}),e.jsx("div",{className:"actions",children:e.jsx(u,{checked:t.enable_wildcard_filter,onChange:l=>{s({enable_wildcard_filter:l})}})})]})}),t.enable_wildcard_filter&&e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Also search in Content")}),e.jsx("div",{className:"actions",children:e.jsx(u,{checked:t.enable_wildcard_for_post_content,onChange:l=>{s({enable_wildcard_for_post_content:l})}})})]})}),e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Live Filter")}),e.jsx("div",{className:"actions",children:e.jsx(u,{checked:t.live_filter,onChange:l=>{s({live_filter:l})}})})]})}),Object.keys(t.default_filter_options).map((l,h)=>{var c,m,x;let a={};return(c=t.filters)!=null&&c.hasOwnProperty(l)?a=t.filters[l]:(m=t.default_filter_options)!=null&&m.hasOwnProperty(l)&&(a=t.default_filter_options[l]),l!=="enabled"?e.jsxs("div",{className:"mt-5",children:[e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label capitalize",children:l.replace(/[-_]/g," ")}),e.jsx("div",{className:"actions",children:e.jsx(u,{checked:typeof t.filters<"u"&&typeof t.filters[l]<"u"&&((x=t.filters[l])==null?void 0:x.enabled),onChange:p=>{var f,_;let i={};(f=t.filters)!=null&&f.hasOwnProperty(l)?i=t.filters[l]:(_=t.default_filter_options)!=null&&_.hasOwnProperty(l)&&(i=t.default_filter_options[l]),i.enabled=p,i.filter_type=t.default_filter_options[l].filter_type,i.is_meta=t.default_filter_options[l].is_meta,i.multiple=t.default_filter_options[l].multiple,n(l,i)}})})]})}),e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Display Name")}),e.jsx("div",{className:"actions",children:e.jsx(A,{value:a.label,onChange:p=>{var f;let i={};(f=t.filters)!=null&&f.hasOwnProperty(l)?i=t.filters[l]:i.enabled=!0,i.label=p,n(l,i)}})})]})}),a.filter_type==="options"&&a.enabled&&e.jsxs("div",{className:"fct-block-editor-control-item",children:[e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Show empty")}),e.jsx("div",{className:"actions",children:e.jsx(u,{checked:a.show_empty!==!1,onChange:p=>{var f,_;let i={};(f=t.filters)!=null&&f.hasOwnProperty(l)?i={...t.filters[l]}:(_=t.default_filter_options)!=null&&_.hasOwnProperty(l)&&(i={...t.default_filter_options[l]}),i.show_empty=p,n(l,i)}})})]}),e.jsx("span",{className:"text-xs text-system-light leading-tight",children:r("Display %1$s even if they have no products.",l.replace("product-",""))})]})]},l):e.jsx(e.Fragment,{})})]})]})};let S=[],E={};Object.keys(window.fluent_cart_shop_app_block_editor_data.taxonomies).map((o,t)=>{let s=window.fluent_cart_shop_app_block_editor_data.taxonomies[o];S[o]=[],E[o]={filter_type:"options",is_meta:!0,label:s.label,enabled:!1,multiple:!1,show_empty:!1}});const y={paginator:{type:"string",default:"scroll"},per_page:{type:"number",default:10},view_mode:{type:"string",default:"grid"},price_format:{type:"string",default:"starts_from"},search_grid_size:{type:"number",default:0},product_grid_size:{type:"number",default:0},product_box_grid_size:{type:"number",default:0},use_default_style:{type:"boolean",default:!0},enable_filter:{type:"boolean",default:!1},live_filter:{type:"boolean",default:!0},enable_wildcard_filter:{type:"boolean",default:!1},enable_wildcard_for_post_content:{type:"boolean",default:!1},order_type:{type:"string",default:"DESC"},order_by:{type:"string",default:"ID"},filters:{},default_filter_options:{type:"object",default:{...E,price_range:{filter_type:"range",is_meta:!1,label:"Price",enabled:!1}}},default_filters:{type:"object",default:{enabled:!1,allow_out_of_stock:!1,wildcard:"",...S}},colors:{}},{InspectorControls:V}=wp.blockEditor,{TextControl:I,Card:oe,CardHeader:ie,CardBody:ce,ToggleControl:C,Button:ne,Tooltip:de,__experimentalRadio:pe,__experimentalRadioGroup:fe,RangeControl:g}=wp.components,M=o=>{const{attributes:t,setAttributes:s,blockEditorData:d}=o,n=a=>{s({search_grid_size:a})},l=a=>{s({product_grid_size:a})},h=a=>{s({product_box_grid_size:a})};return e.jsx(V,{children:e.jsx("div",{id:"gutenpride-controls",className:"fluent-cart-product-block-editor",children:e.jsxs("div",{className:"fluent-cart-product-block-editor-inner",children:[e.jsx(G,{attributes:t,setAttributes:s,blockEditorData:d}),e.jsxs(b,{title:r("Product Grid Option"),children:[e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("View Mode")}),e.jsx("div",{className:"actions",children:e.jsx(v,{customKeys:{key:"value",label:"label"},defaultValue:t.view_mode,options:[{label:r("Grid"),value:"grid"},{label:r("List"),value:"list"}],onChange:function(a){s({view_mode:a})}})})]})}),e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Price Format")}),e.jsx("div",{className:"actions",children:e.jsx(v,{customKeys:{key:"value",label:"label"},defaultValue:t.price_format,options:[{label:r("Starts From"),value:"starts_from"},{label:r("Range"),value:"range"}],onChange:function(a){s({price_format:a})}})})]})}),e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Product Per Row")}),e.jsx("div",{className:"actions",children:e.jsx(g,{value:t.product_box_grid_size,onChange:h,min:0,max:5})})]})}),t.enable_filter&&e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Search Grid Size")}),e.jsx("div",{className:"actions",children:e.jsx(g,{value:t.search_grid_size,onChange:n,min:0,max:5})})]})}),t.enable_filter&&e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Product Grid Size")}),e.jsx("div",{className:"actions",children:e.jsx(g,{value:t.product_grid_size,onChange:l,min:0,max:5})})]})})]}),e.jsx(L,{attributes:t,setAttributes:s,blockEditorData:d}),e.jsx(b,{title:r("Default Filter"),children:e.jsxs("div",{children:[e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Enable Filtering")}),e.jsx("div",{className:"actions",children:e.jsx(C,{checked:t.default_filters.enabled,onChange:a=>{let c=t.default_filters;c.enabled=a,s({default_filters:{...c}})}})})]})}),t.default_filters.enabled&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Allow Out Of Stock")}),e.jsx("div",{className:"actions",children:e.jsx(C,{checked:t.default_filters.allow_out_of_stock,onChange:a=>{let c=t.default_filters;c.allow_out_of_stock=a,s({default_filters:{...c}})}})})]})}),e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:r("Search")}),e.jsx("div",{className:"actions",children:e.jsx(I,{value:t.default_filters.wildcard,onChange:a=>{let c=t.default_filters;c.wildcard=a,s({default_filters:{...c}})}})})]})}),Object.keys(window.fluent_cart_shop_app_block_editor_data.taxonomies).map((a,c)=>{let m=window.fluent_cart_shop_app_block_editor_data.taxonomies[a];return e.jsx("div",{className:"fct-block-editor-control-item",children:e.jsxs("div",{className:"fct-inspector-control-row",children:[e.jsx("span",{className:"label",children:m.label}),e.jsx("div",{className:"actions",children:e.jsx(v,{placeholder:r("Select"),isMulti:!0,customKeys:{key:"value",label:"label"},defaultValue:t.default_filters[a],options:m.terms,onChange:function(x){let p={...t.default_filters};p[a]=x,s({default_filters:p})}})})]})},c)})]})]})})]})})},"setting")},U=""+new URL("assets/Products.png",import.meta.url).href,{registerBlockType:K}=wp.blocks,{useEffect:k,useState:H,Component:ue,useMemo:me,createContext:W}=wp.element;wp.serverSideRender;W();const{useBlockProps:P,InnerBlocks:N,BlockContextProvider:_e}=wp.blockEditor,j=window.fluent_cart_shop_app_block_editor_data;window.fluentCartShopAppTranslator=o=>{var t;return((t=window.fluent_cart_shop_app_block_editor_data)==null?void 0:t.trans[o])||o};const Y=window.fluentCartRestVars.rest.url,q=Y+"/public/products",J=[["fluent-cart/shopapp-product-action-container",{},[["fluent-cart/shopapp-product-view-switcher"],["fluent-cart/shopapp-product-filter-sort-by"]]],["fluent-cart/shopapp-product-container",{className:"fluent-product-container"},[["fluent-cart/shopapp-product-filter",{},[["fluent-cart/shopapp-product-filter-search-box"],["fluent-cart/shopapp-product-filter-filters"],["fluent-cart/shopapp-product-filter-button",{},[["fluent-cart/shopapp-product-filter-apply-button"],["fluent-cart/shopapp-product-filter-reset-button"]]]]],["fluent-cart/shopapp-product-loop",{className:"fluent-product-loop",layout:{type:"constrained"},metadata:{name:"Product Loop"}},[["fluent-cart/product-image"],["fluent-cart/product-title"],["fluent-cart/price-range"],["fluent-cart/shopapp-product-buttons"]]],["fluent-cart/shopapp-product-no-result",{className:"fluent-product-no-result",layout:{type:"constrained"},metadata:{name:"No Result"}},[["core/paragraph",{content:"No results found",align:"center",fontSize:"large"}],["core/paragraph",{content:r("You can try %1$s clearing any filters %2$s or head to our %3$s store's home %4$s",'<a href="#">',"</a>",'<a href="#">',"</a>"),align:"center"}]]],["fluent-cart/shopapp-product-loader",{layout:{type:"constrained"},metadata:{name:"Product Loader"}},[["fluent-cart/shopapp-product-spinner"]]]]],["fluent-cart/product-paginator",{className:"fluent-product-paginator",layout:{type:"constrained"},metadata:{name:"Paginator"}},[["fluent-cart/product-paginator-info"],["fluent-cart/product-paginator-number"]]]],Q=`${j.slug}/${j.name}`;K(Q,{apiVersion:3,providesContext:{"fluent-cart/paginator":"paginator","fluent-cart/per_page":"per_page","fluent-cart/enable_filter":"enable_filter","fluent-cart/product_box_grid_size":"product_box_grid_size","fluent-cart/view_mode":"view_mode","fluent-cart/filters":"filters","fluent-cart/default_filters":"default_filters","fluent-cart/order_type":"order_type","fluent-cart/order_by":"order_by","fluent-cart/live_filter":"live_filter","fluent-cart/price_format":"price_format","fluent-cart/enable_wildcard_filter":"enable_wildcard_filter"},title:j.title,icon:{src:z},example:{attributes:{},innerBlocks:[{name:"core/image",attributes:{url:U,alt:"Shop App Preview",style:{width:"100%",height:"auto"}}}]},supports:{html:!1,reusable:!1,innerBlocks:!0},category:"fluent-cart",attributes:{colors:{type:"object",default:y.colors||{}},message:{type:"string",default:""},variations:{type:"object",default:{}},...y},edit:({attributes:o,setAttributes:t})=>{const s=P({className:"fluent-cart-product-block-editor"}),[d,n]=H([]);return k(()=>{try{o.variations||t({variations:{}})}catch(l){console.error("Error in useEffect:",l)}},[]),k(()=>{O({path:q}).then(l=>{n(l.products.products.data)})},[]),e.jsx("div",{...s,children:e.jsx(F,{children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(M,{attributes:o,setAttributes:t,blockEditorData:j}),e.jsx("div",{className:"fluent-cart-inner-blocks",children:e.jsx(R,{value:{products:d},children:e.jsx(N,{template:J,allowedBlocks:["core/group","core/columns","core/paragraph","core/image","core/heading"],templateLock:!1,renderAppender:N.ButtonBlockAppender})})})]})})})},save({attributes:o}){const t=P.save();return e.jsx("div",{...t,children:e.jsx("div",{className:"fct-products-wrapper","data-fluent-cart-shop-app":!0,"data-fluent-cart-product-wrapper":"",children:e.jsx(N.Content,{})})})}});