PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.7.1
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.7.1
1.7.1 1.7.0 1.6.6 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 All 51 releases
← All changes | assets/WriteAReviewButtonBlockEditor.js +1 -1 1.7.0 → 1.7.1 View file →
@@ -1 +1 @@
1 -import{j as t}from"./chunks/jsx-runtime.js?ver=1.7.0";import{a as _}from"./chunks/index6.js?ver=1.7.0";import{b as e}from"./chunks/BlockEditorTranslator.js?ver=1.7.0";import{E as h}from"./chunks/EditorPanel.js?ver=1.7.0";import{E as f}from"./chunks/EditorPanelRow.js?ver=1.7.0";import{R,u as j}from"./chunks/reviewBlockShared.js?ver=1.7.0";import{u as B}from"./chunks/SingleProductContext.js?ver=1.7.0";import{W as k,A as S}from"./chunks/Icons.js?ver=1.7.0";import{a as T}from"./chunks/add-query-args.js?ver=1.7.0";import"./chunks/SelectProductModal.js?ver=1.7.0";import"./chunks/ProductListItem.js?ver=1.7.0";import"./chunks/index5.js?ver=1.7.0";const{InspectorControls:E}=wp.blockEditor,{TextControl:p,SelectControl:v}=wp.components,b=({attributes:o,setAttributes:n,selectedProduct:c,setSelectedProduct:i,insideParent:d})=>t.jsx(E,{children:t.jsx("div",{className:"fct-inspector-control-wrap fct-inspector-control-wrap--product-card fct-inspector-control-wrap--write-a-review-button",children:t.jsx("div",{className:"fct-inspector-control-group",children:t.jsxs("div",{className:"fct-inspector-control-body",children:[!d&&t.jsx(R,{attributes:o,setAttributes:n,selectedProduct:c,setSelectedProduct:i}),t.jsx(h,{title:e("Button Settings"),children:t.jsxs(f,{className:"flex-col",children:[t.jsx(v,{label:e("Open In"),help:e("Where the form appears when the button is clicked."),value:o.container,options:[{label:e("Drawer (slides in from the side)"),value:"drawer"},{label:e("Modal (centered on the screen)"),value:"modal"}],onChange:r=>n({container:r})}),t.jsx(v,{label:e("Field Layout"),help:e("Steps walks the reviewer through rating, details and photos. Inline shows every field at once."),value:o.layout,options:[{label:e("Inline (all fields at once)"),value:"inline"},{label:e("Steps (one at a time)"),value:"steps"}],onChange:r=>n({layout:r})})]})}),t.jsx(h,{title:e("Button Text"),children:t.jsxs(f,{className:"flex-col",children:[t.jsx(p,{label:e("New Review"),help:e("Shown when the visitor has not reviewed this product yet"),value:o.addReviewButtonText,placeholder:e("Write a Review"),onChange:r=>n({addReviewButtonText:r})}),t.jsx(p,{label:e("Edit Review"),help:e("Shown when the visitor already has a review for this product"),value:o.editReviewButtonText,placeholder:e("Edit your review"),onChange:r=>n({editReviewButtonText:r})}),t.jsx(p,{label:e("Logged Out"),help:e("Shown when a visitor must log in before reviewing"),value:o.loginReviewButtonText,placeholder:e("Log in to Review"),onChange:r=>n({loginReviewButtonText:r})})]})})]})})})}),{useBlockProps:C}=wp.blockEditor,{registerBlockType:P}=wp.blocks,{useEffect:m,useState:N}=wp.element;var x;const w=((x=window.fluentCartRestVars)==null?void 0:x.rest)||{},s=window.fluent_cart_write_a_review_button_data;P(s.slug+"/"+s.name,{apiVersion:3,title:s.title,description:s.description,icon:{src:k},category:"fluent-cart",attributes:{query_type:{type:"string",default:"default"},product_id:{type:["string","number"],default:""},container:{type:"string",default:"drawer"},layout:{type:"string",default:"inline"},addReviewButtonText:{type:"string",default:""},editReviewButtonText:{type:"string",default:""},loginReviewButtonText:{type:"string",default:""}},edit:({attributes:o,setAttributes:n,clientId:c})=>{const i=B(),[d,r]=N({}),l=j(c),g=C({className:"fct-write-a-review-button-block-editor"+(l?" is-inside-container":"")});m(()=>{l&&o.query_type!=="default"&&n({query_type:"default"})},[l,o.query_type]);const y=a=>{w.url&&_({path:T(w.url+"/products/"+o.product_id,{with:["block_product_detail"]}),headers:{"X-WP-Nonce":w.nonce}}).then(u=>{a()||r(u.product||{})}).catch(()=>{a()||r({})})};return m(()=>{let a=!1;const u=()=>a;return o.query_type==="custom"&&!l?o.product_id?y(u):r({}):r((i==null?void 0:i.product)||{}),()=>{a=!0}},[i==null?void 0:i.product,o.query_type,o.product_id,l]),t.jsxs("div",{...g,children:[t.jsx(b,{attributes:o,setAttributes:n,selectedProduct:d,setSelectedProduct:r,insideParent:l}),t.jsxs("div",{className:"fct-write-a-review-button-block-editor-cta"+(l?" is-full":""),children:[o.addReviewButtonText||e("Write a Review"),t.jsx(S,{})]})]})},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}}});
1 +import{j as t}from"./chunks/jsx-runtime.js?ver=1.7.1";import{a as _}from"./chunks/index6.js?ver=1.7.1";import{b as e}from"./chunks/BlockEditorTranslator.js?ver=1.7.1";import{E as h}from"./chunks/EditorPanel.js?ver=1.7.1";import{E as f}from"./chunks/EditorPanelRow.js?ver=1.7.1";import{R,u as j}from"./chunks/reviewBlockShared.js?ver=1.7.1";import{u as B}from"./chunks/SingleProductContext.js?ver=1.7.1";import{W as k,A as S}from"./chunks/Icons.js?ver=1.7.1";import{a as T}from"./chunks/add-query-args.js?ver=1.7.1";import"./chunks/SelectProductModal.js?ver=1.7.1";import"./chunks/ProductListItem.js?ver=1.7.1";import"./chunks/index5.js?ver=1.7.1";import"./chunks/reviewStar2.js?ver=1.7.1";const{InspectorControls:E}=wp.blockEditor,{TextControl:p,SelectControl:m}=wp.components,b=({attributes:o,setAttributes:n,selectedProduct:c,setSelectedProduct:i,insideParent:d})=>t.jsx(E,{children:t.jsx("div",{className:"fct-inspector-control-wrap fct-inspector-control-wrap--product-card fct-inspector-control-wrap--write-a-review-button",children:t.jsx("div",{className:"fct-inspector-control-group",children:t.jsxs("div",{className:"fct-inspector-control-body",children:[!d&&t.jsx(R,{attributes:o,setAttributes:n,selectedProduct:c,setSelectedProduct:i}),t.jsx(h,{title:e("Button Settings"),children:t.jsxs(f,{className:"flex-col",children:[t.jsx(m,{label:e("Open In"),help:e("Where the form appears when the button is clicked."),value:o.container,options:[{label:e("Drawer (slides in from the side)"),value:"drawer"},{label:e("Modal (centered on the screen)"),value:"modal"}],onChange:r=>n({container:r})}),t.jsx(m,{label:e("Field Layout"),help:e("Steps walks the reviewer through rating, details and photos. Inline shows every field at once."),value:o.layout,options:[{label:e("Inline (all fields at once)"),value:"inline"},{label:e("Steps (one at a time)"),value:"steps"}],onChange:r=>n({layout:r})})]})}),t.jsx(h,{title:e("Button Text"),children:t.jsxs(f,{className:"flex-col",children:[t.jsx(p,{label:e("New Review"),help:e("Shown when the visitor has not reviewed this product yet"),value:o.addReviewButtonText,placeholder:e("Write a Review"),onChange:r=>n({addReviewButtonText:r})}),t.jsx(p,{label:e("Edit Review"),help:e("Shown when the visitor already has a review for this product"),value:o.editReviewButtonText,placeholder:e("Edit your review"),onChange:r=>n({editReviewButtonText:r})}),t.jsx(p,{label:e("Logged Out"),help:e("Shown when a visitor must log in before reviewing"),value:o.loginReviewButtonText,placeholder:e("Log in to Review"),onChange:r=>n({loginReviewButtonText:r})})]})})]})})})}),{useBlockProps:C}=wp.blockEditor,{registerBlockType:P}=wp.blocks,{useEffect:v,useState:N}=wp.element;var x;const w=((x=window.fluentCartRestVars)==null?void 0:x.rest)||{},s=window.fluent_cart_write_a_review_button_data;P(s.slug+"/"+s.name,{apiVersion:3,title:s.title,description:s.description,icon:{src:k},category:"fluent-cart",attributes:{query_type:{type:"string",default:"default"},product_id:{type:["string","number"],default:""},container:{type:"string",default:"drawer"},layout:{type:"string",default:"inline"},addReviewButtonText:{type:"string",default:""},editReviewButtonText:{type:"string",default:""},loginReviewButtonText:{type:"string",default:""}},edit:({attributes:o,setAttributes:n,clientId:c})=>{const i=B(),[d,r]=N({}),l=j(c),g=C({className:"fct-write-a-review-button-block-editor"+(l?" is-inside-container":"")});v(()=>{l&&o.query_type!=="default"&&n({query_type:"default"})},[l,o.query_type]);const y=a=>{w.url&&_({path:T(w.url+"/products/"+o.product_id,{with:["block_product_detail"]}),headers:{"X-WP-Nonce":w.nonce}}).then(u=>{a()||r(u.product||{})}).catch(()=>{a()||r({})})};return v(()=>{let a=!1;const u=()=>a;return o.query_type==="custom"&&!l?o.product_id?y(u):r({}):r((i==null?void 0:i.product)||{}),()=>{a=!0}},[i==null?void 0:i.product,o.query_type,o.product_id,l]),t.jsxs("div",{...g,children:[t.jsx(b,{attributes:o,setAttributes:n,selectedProduct:d,setSelectedProduct:r,insideParent:l}),t.jsxs("div",{className:"fct-write-a-review-button-block-editor-cta"+(l?" is-full":""),children:[o.addReviewButtonText||e("Write a Review"),t.jsx(S,{})]})]})},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}}});