PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 1.0.0
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v1.0.0
3.1.13 3.1.12 3.1.11 3.1.10 3.1.9 3.1.8 3.1.7 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 All 122 releases
firebox / media / admin / js / fb_gutenberg_block.js

fb_gutenberg_block.js in FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment 1.0.0, at media/admin/js/fb_gutenberg_block.js

3 lines 3.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var FBox_Gutenberg_Block=function(){function e(){if(!this.canRun())return!1;this.init()}var t=e.prototype;return t.canRun=function(){return document.body.classList.contains("block-editor-page")},t.init=function(){var b=wp.i18n,u=wp.element.createElement,e=wp.data.withSelect,c=wp.components.Spinner,p=wp.components.SelectControl,f=wp.components.TextControl,_=wp.components.ToggleControl,t=wp.blockEditor.RichText,o=this,n=null;wp.apiFetch({path:"/fireplugins/firebox/boxes"}).then(function(e){n=e}),wp.blocks.registerBlockType("fireplugins/firebox",{title:b.__("FireBox","firebox"),description:b.__("Choose the FireBox you'd like to handle","firebox"),icon:"update",category:"fireplugins",attributes:{box_id:{type:"select"},box_action:{type:"select",default:"close"},buttonLabel:{type:"text",default:b.__("Close","firebox")},buttonClasses:{type:"text",default:"button"},preventDefault:{type:"boolean",default:!0}},edit:e(function(e){return{boxes:n}})(function(t){var e=t.boxes,o=t.className+" fpf-content-wrapper fpf-gutenberg-block-item",n=t.attributes.box_id,a=t.attributes.box_action,i=t.attributes.buttonLabel,l=t.attributes.buttonClasses;if(preventDefault=t.attributes.preventDefault,!e)return u("p",{className:o},u(c,null),b.__("Loading popups...","firebox"));if(0===e.length)return u("div",{className:o},u("div",{className:"text-center"},u("img",{src:fbox_admin_js_object.media_url+"admin/images/logo.svg"}),u("h6",{className:"fp-gutenberg-block-head-plugin-name margin-0"},b.__("FireBox","firebox")),u("p",{className:"fp-gutenberg-block-head-subtitle margin-top-1 margin-bottom-1"},b.__("No popups found. Please create or enable a popup and try again.","firebox")),u("a",{href:fpf_js_object.admin_url+"admin.php?page=firebox",target:"_blank",className:"fpf-button primary"},b.__("Get Started","firebox"))));void 0===n&&t.setAttributes({box_id:e[0].id});var r,s=(r=[],e.map(function(e){r.push({label:e.title,value:e.id})}),r);return u("div",{className:o+" text-center"},u("div",{className:"text-center"},u("img",{src:fbox_admin_js_object.media_url+"admin/images/logo.svg"}),u("h5",{className:"fp-gutenberg-block-head-title"},b.__("Add a FireBox Button","firebox")),u("p",{className:"fp-gutenberg-block-head-subtitle"},b.__("Choose the FireBox you'd like to handle.","firebox")),u("hr"),u(p,{label:b.__("Select a FireBox","firebox"),className:"",type:"number",value:n,options:s,onChange:function(e){t.setAttributes({box_id:e})}}),u(p,{label:b.__("FireBox Action","firebox"),className:"",type:"text",value:a,options:[{value:"open",label:b.__("Open","firebox")},{value:"close",label:b.__("Close","firebox")},{value:"toggle",label:b.__("Toggle","firebox")}],onChange:function(e){t.setAttributes({box_action:e})}}),u(f,{label:b.__("Button Label","firebox"),className:"",type:"text",value:i,onChange:function(e){t.setAttributes({buttonLabel:e})}}),u(f,{label:b.__("Button Classes","firebox"),className:"",type:"text",value:l,onChange:function(e){t.setAttributes({buttonClasses:e})}}),u(_,{label:b.__("Prevent Default Action","firebox"),className:"",type:"boolean",checked:preventDefault,onChange:function(e){t.setAttributes({preventDefault:e})}})))}),save:function(e){return u(t.Content,{tagName:"p",value:o.fireboxItem(e.attributes)})}})},t.fireboxItem=function(e){if(null!=e.box_id&&null!=e.box_action&&null!=e.buttonLabel){var t='<a href="#"';return void 0!==e.box_id&&(t+=' data-fbox="'+e.box_id+'"'),void 0!==e.box_action&&(t+=' data-fbox-cmd="'+e.box_action+'"'),void 0!==e.buttonClasses&&(t+=' class="'+e.buttonClasses+'"'),t+=' data-fbox-prevent="'+(e.preventDefault?"1":"0")+'"',t+=">"+e.buttonLabel+"</a>"}},e}();document.addEventListener("DOMContentLoaded",function(){new FBox_Gutenberg_Block});
2
3