File "popup-trigger-block.min.js"

Full Path: /home/londdqdw/public_html/06/wp-content/plugins/wordpress-popup/inc/providers/gutenberg/js/popup-trigger-block.min.js
File size: 6.53 KB
MIME-type: text/plain
Charset: utf-8

!function(){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var o=0;o<e.length;o++){var n=e[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function n(e,o){return!o||"object"!==t(o)&&"function"!=typeof o?a(e):o}function r(t){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var i=wp.blocks,l=i.registerBlockType,p=i.createBlock,u=wp.element,c=u.createElement,d=u.Component,_=(u.RawHTML,wp.shortcode),h=_.string,g=_.next,m=c("svg",{class:"dashicon",viewBox:"0 0 24 24",width:20,height:20,xmlns:"http://www.w3.org/2000/svg",preserveAspectRatio:"xMidYMid meet","aria-hidden":"true",role:"img"},c("path",{d:"M1.5 0h21c.422 0 .777.145 1.066.434.29.289.434.644.434 1.066v21c0 .422-.145.777-.434 1.066A1.45 1.45 0 0 1 22.5 24h-21a1.45 1.45 0 0 1-1.066-.434A1.45 1.45 0 0 1 0 22.5v-21C0 1.078.145.723.434.434A1.45 1.45 0 0 1 1.5 0zM6 6a1.45 1.45 0 0 0-1.066.434A1.45 1.45 0 0 0 4.5 7.5v9c0 .422.145.777.434 1.066.289.29.644.434 1.066.434h12a1.45 1.45 0 0 0 1.066-.434c.29-.289.434-.644.434-1.066v-9a1.45 1.45 0 0 0-.434-1.066A1.45 1.45 0 0 0 18 6H6zm10.5 1.5c.422 0 .777.145 1.066.434.29.289.434.644.434 1.066 0 .422-.145.777-.434 1.066a1.45 1.45 0 0 1-1.066.434 1.45 1.45 0 0 1-1.066-.434A1.45 1.45 0 0 1 15 9c0-.422.145-.777.434-1.066A1.45 1.45 0 0 1 16.5 7.5z"})),f=function(t){function i(){var t;return e(this,i),(t=n(this,r(i).apply(this,arguments))).update_id=t.update_id.bind(a(a(t))),t.update_css_class=t.update_css_class.bind(a(a(t))),t.update_content=t.update_content.bind(a(a(t))),t.state={loading:!1},t}var l,p;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&s(t,e)}(i,t),l=i,(p=[{key:"update_module_id",value:function(t){this.props.setAttributes({module_id:t})}},{key:"update_id",value:function(t){this.props.setAttributes({id:t})}},{key:"update_content",value:function(t){this.props.setAttributes({content:t})}},{key:"update_css_class",value:function(t){this.props.setAttributes({css_class:t})}},{key:"set_module_id_from_shortcode_id",value:function(t){var e=this;if(!this.state.loading){this.setState({loading:!0});var o=ajaxurl+"?action=hustle_get_module_id_by_shortcode&_wpnonce="+hustle_popup_trigger_data.nonce+"&shortcode_id="+t;window.fetch(o).then((function(t){return t.json()})).then((function(t){t.success&&t.data.module_id&&e.update_module_id(t.data.module_id),e.setState({loading:!1})}))}}},{key:"componentDidUpdate",value:function(t){var e=this.props.attributes.id;t.attributes.id!==e&&e&&this.set_module_id_from_shortcode_id(e)}},{key:"componentDidMount",value:function(){var t=this.props.attributes,e=t.module_id,o=t.id;o&&!e&&this.set_module_id_from_shortcode_id(o)}},{key:"open_settings",value:function(t){var e=hustle_popup_trigger_data.admin_url+"?page="+hustle_popup_trigger_data.wizard_page+"&id="+t;window.open(e)}},{key:"render",value:function(){var t=this,e=this.state.loading,o=this.props,n=o.attributes,r=o.isSelected,s=n.module_id,a=n.id,i=n.content,l=n.css_class,p=hustle_popup_trigger_data.modules,u=[r&&c(wp.editor.InspectorControls,{key:"inspector"},c(wp.components.PanelBody,{title:hustle_popup_trigger_data.l10n.module,initialOpen:!0},c(wp.components.PanelRow,null,c(wp.components.SelectControl,{label:hustle_popup_trigger_data.l10n.name,value:a,options:p,onChange:this.update_id}))),c(wp.components.PanelBody,{title:hustle_popup_trigger_data.l10n.advanced,initialOpen:!0},c(wp.components.PanelRow,null,c(wp.components.TextControl,{label:hustle_popup_trigger_data.l10n.trigger_content,value:i,onChange:this.update_content})),c(wp.components.PanelRow,null,c(wp.components.TextControl,{label:hustle_popup_trigger_data.l10n.additional_css_classes,value:l,onChange:this.update_css_class})))),c(wp.editor.BlockControls,null,!!a&&c(wp.components.Toolbar,null,c(wp.components.IconButton,{className:"components-toolbar__control",label:hustle_popup_trigger_data.l10n.customize_module,icon:"edit",onClick:function(e){return t.open_settings(s)}})))];return e?[u,c("div",{key:"loading",className:"wp-block-embed is-loading"},c(wp.components.Spinner,null),c("span",null,hustle_popup_trigger_data.l10n.rendering))]:a?[u,c(wp.editor.RichText,{tagName:"a",multiline:!1,formattingControls:[],value:i,onChange:this.update_content,keepPlaceholderOnFocus:!0,placeholder:hustle_popup_trigger_data.l10n.content_here})]:[u,c(wp.components.Placeholder,{key:"placeholder",className:"wp-block-embed",instructions:hustle_popup_trigger_data.l10n.block_description,icon:m,label:hustle_popup_trigger_data.l10n.block_name},c("form",null,c("select",{value:a,onChange:function(e){return t.update_id(e.target.value)}},p.map((function(t){return c("option",{key:t.value,value:t.value},t.label)})))),c("div",{class:"components-placeholder__instructions"},hustle_popup_trigger_data.l10n.block_more_description))]}}])&&o(l.prototype,p),i}(d);l("hustle/popup-trigger",{title:hustle_popup_trigger_data.l10n.block_name,description:hustle_popup_trigger_data.l10n.block_description,icon:m,category:"hustle",keywords:["Hustle",hustle_popup_trigger_data.l10n.block_name],attributes:{module_id:{type:"string"},id:{type:"string"},type:{type:"string"},content:{type:"string",default:hustle_popup_trigger_data.l10n.click_here},css_class:{type:"string"}},supports:{customClassName:!1,className:!1,html:!1},transforms:{to:[{type:"block",blocks:["core/shortcode"],transform:function(t){var e=t.id,o=t.content,n=t.css_class,r={tag:hustle_popup_trigger_data.shortcode_tag,attrs:{id:e||"",css_class:n||"",type:"popup"},content:o,type:"closed"},s=h(r);return p("core/shortcode",{text:s})}}],from:[{type:"block",blocks:["core/shortcode"],isMatch:function(t){var e=t.text,o=g("wd_hustle",e);return void 0!==o&&"popup"===o.shortcode.attrs.named.type},transform:function(t){var e=t.text,o=g("wd_hustle",e).shortcode,n=o.content,r=o.attrs.named,s=r.id,a=r.type,i=r.css_class;return p("hustle/popup-trigger",{id:s,type:a,css_class:i,content:n})}}]},edit:f,save:function(){return null}})}();