Ubuntu

­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­ this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["featured-category"]=function(e){function t(t){for(var c,a,l=t[0],i=t[1],s=t[2],d=0,b=[];d0&&void 0!==arguments[0]?arguments[0]:[],t=e[0]?e[0].id:0;w({categoryId:t,mediaId:0,mediaSrc:""})},isSingle:!0}),Object(c.createElement)(i.Button,{isDefault:!0,onClick:function(){w({editMode:!1}),S(Object(o.__)("Showing Featured Product block preview.",'woocommerce'))}},Object(o.__)("Done",'woocommerce')))):Object(c.createElement)(c.Fragment,null,(d=O.contentAlign,m=O.mediaId||function(e){return e&&Object(h.isObject)(e.image)?e.image.id:0}(_),Object(c.createElement)(r.BlockControls,null,Object(c.createElement)(r.AlignmentToolbar,{value:d,onChange:function(e){w({contentAlign:e})}}),Object(c.createElement)(r.MediaUploadCheck,null,Object(c.createElement)(i.Toolbar,null,Object(c.createElement)(r.MediaUpload,{onSelect:function(e){w({mediaId:e.id,mediaSrc:e.url})},allowedTypes:["image"],value:m,render:function(e){var t=e.open;return Object(c.createElement)(i.IconButton,{className:"components-toolbar__control",label:Object(o.__)("Edit media"),icon:"format-image",onClick:t,disabled:!_})}}))))),(t=O.mediaSrc||f(_),n=O.focalPoint,a=void 0===n?{x:.5,y:.5}:n,s="function"==typeof i.FocalPointPicker,Object(c.createElement)(r.InspectorControls,{key:"inspector"},Object(c.createElement)(i.PanelBody,{title:Object(o.__)("Content",'woocommerce')},Object(c.createElement)(i.ToggleControl,{label:Object(o.__)("Show description",'woocommerce'),checked:O.showDesc,onChange:function(){return w({showDesc:!O.showDesc})}})),Object(c.createElement)(r.PanelColorSettings,{title:Object(o.__)("Overlay",'woocommerce'),colorSettings:[{value:k.color,onChange:C,label:Object(o.__)("Overlay Color",'woocommerce')}]},!!t&&Object(c.createElement)(c.Fragment,null,Object(c.createElement)(i.RangeControl,{label:Object(o.__)("Background Opacity",'woocommerce'),value:O.dimRatio,onChange:function(e){return w({dimRatio:e})},min:0,max:100,step:10}),s&&Object(c.createElement)(i.FocalPointPicker,{label:Object(o.__)("Focal Point Picker"),url:t,value:a,onChange:function(e){return w({focalPoint:e})}}))))),_?function(){var e,t,n=O.className,a=O.contentAlign,s=O.dimRatio,d=O.focalPoint,b=O.height,p=O.showDesc,g=u()("wc-block-featured-category",{"is-selected":j,"is-loading":!_&&E,"is-not-found":!_&&!E,"has-background-dim":0!==s},0===(e=s)||50===e?null:"has-background-dim-".concat(10*Math.round(e/10)),"center"!==a&&"has-".concat(a,"-content"),n),h=O.mediaSrc||f(_),m=_?(t=h)?{backgroundImage:"url(".concat(t,")")}:{}:{};k.color&&(m.backgroundColor=k.color),d&&(m.backgroundPosition="".concat(100*d.x,"% ").concat(100*d.y,"%"));return Object(c.createElement)(i.ResizableBox,{className:g,size:{height:b},minHeight:l.MIN_HEIGHT,enable:{bottom:!0},onResizeStop:function(e,t,n){w({height:parseInt(n.style.height)})},style:m},Object(c.createElement)("div",{className:"wc-block-featured-category__wrapper"},Object(c.createElement)("h2",{className:"wc-block-featured-category__title",dangerouslySetInnerHTML:{__html:_.name}}),p&&Object(c.createElement)("div",{className:"wc-block-featured-category__description",dangerouslySetInnerHTML:{__html:_.description}}),Object(c.createElement)("div",{className:"wc-block-featured-category__link"},Object(c.createElement)(r.InnerBlocks,{template:[["core/button",{text:Object(o.__)("Shop now",'woocommerce'),url:_.permalink,align:"center"}]],templateLock:"all"}))))}():Object(c.createElement)(i.Placeholder,{className:"wc-block-featured-category",icon:Object(c.createElement)(b.c,null),label:Object(o.__)("Featured Category",'woocommerce')},E?Object(c.createElement)(i.Spinner,null):Object(o.__)("No product category is selected.",'woocommerce')))});Object(a.registerBlockType)("woocommerce/featured-category",{title:Object(o.__)("Featured Category",'woocommerce'),icon:{src:Object(c.createElement)(b.c,null),foreground:"#96588a"},category:"woocommerce",keywords:[Object(o.__)("WooCommerce",'woocommerce')],description:Object(o.__)("Visually highlight a product category and encourage prompt action.",'woocommerce'),supports:{align:["wide","full"],html:!1},attributes:{contentAlign:{type:"string",default:"center"},dimRatio:{type:"number",default:50},editMode:{type:"boolean",default:!0},focalPoint:{type:"object"},height:{type:"number",default:l.DEFAULT_HEIGHT},mediaId:{type:"number",default:0},mediaSrc:{type:"string",default:""},overlayColor:{type:"string"},customOverlayColor:{type:"string"},linkText:{type:"string",default:Object(o.__)("Shop now",'woocommerce')},categoryId:{type:"number"},showDesc:{type:"boolean",default:!0}},edit:function(e){return Object(c.createElement)(O,e)},save:function(){return Object(c.createElement)(r.InnerBlocks.Content,null)}})},61:function(e,t){!function(){e.exports=this.wp.dom}()},64:function(e,t){},65:function(e,t){},67:function(e,t){},68:function(e,t){},71:function(e,t,n){"use strict";var c=n(16),o=n.n(c),r=n(38),a=n.n(r),l=n(8),i=n.n(l),s=n(9),u=n.n(s),d=n(10),b=n.n(d),p=n(11),g=n.n(p),h=n(15),f=n.n(h),m=n(12),O=n.n(m),j=n(0),w=n(21),v=n(25),y=Object(w.createHigherOrderComponent)(function(e){return function(t){function n(){var e;return i()(this,n),(e=b()(this,g()(n).apply(this,arguments))).state={error:null,loading:!1,product:null},e.loadProduct=e.loadProduct.bind(f()(e)),e}return O()(n,t),u()(n,[{key:"componentDidMount",value:function(){this.loadProduct()}},{key:"componentDidUpdate",value:function(e){e.attributes.productId!==this.props.attributes.productId&&this.loadProduct()}},{key:"loadProduct",value:function(){var e=this,t=this.props.attributes.productId;t?(this.setState({loading:!0}),Object(v.b)(t).then(function(t){e.setState({product:t,loading:!1,error:null})}).catch(function(t){var n="object"===a()(t)&&t.hasOwnProperty("message")?{apiMessage:t.message}:{apiMessage:null};e.setState({product:null,loading:!1,error:n})})):this.setState({product:null,loading:!1,error:null})}},{key:"render",value:function(){var t=this.state,n=t.error,c=t.loading,r=t.product;return Object(j.createElement)(e,o()({},this.props,{error:n,getProduct:this.loadProduct,isLoading:c,product:r}))}}]),n}(j.Component)},"withProduct"),E=Object(w.createHigherOrderComponent)(function(e){return function(t){function n(){var e;return i()(this,n),(e=b()(this,g()(n).apply(this,arguments))).state={error:null,loading:!1,category:null},e.loadCategory=e.loadCategory.bind(f()(e)),e}return O()(n,t),u()(n,[{key:"componentDidMount",value:function(){this.loadCategory()}},{key:"componentDidUpdate",value:function(e){e.attributes.categoryId!==this.props.attributes.categoryId&&this.loadCategory()}},{key:"loadCategory",value:function(){var e=this,t=this.props.attributes.categoryId;t?(this.setState({loading:!0}),Object(v.a)(t).then(function(t){e.setState({category:t,loading:!1,error:null})}).catch(function(t){var n="object"===a()(t)&&t.hasOwnProperty("message")?{apiMessage:t.message}:{apiMessage:null};e.setState({category:null,loading:!1,error:n})})):this.setState({category:null,loading:!1,error:null})}},{key:"render",value:function(){var t=this.state,n=t.error,c=t.loading,r=t.category;return Object(j.createElement)(e,o()({},this.props,{error:n,getCategory:this.loadCategory,isLoading:c,category:r}))}}]),n}(j.Component)},"withCategory"),_=n(4),k=(n(7),n(5)),C=Object(w.createHigherOrderComponent)(function(e){var t=function(t){function n(){var e;return i()(this,n),(e=b()(this,g()(n).apply(this,arguments))).state={list:[],loading:!0},e.debouncedOnSearch=Object(_.debounce)(e.onSearch.bind(f()(e)),400),e}return O()(n,t),u()(n,[{key:"componentDidMount",value:function(){var e=this,t=this.props.selected;Object(v.d)({selected:t}).then(function(t){e.setState({list:t,loading:!1})}).catch(function(){e.setState({list:[],loading:!1})})}},{key:"componentWillUnmount",value:function(){this.debouncedOnSearch.cancel()}},{key:"onSearch",value:function(e){var t=this,n=this.props.selected;Object(v.d)({selected:n,search:e}).then(function(e){t.setState({list:e,loading:!1})}).catch(function(){t.setState({list:[],loading:!1})})}},{key:"render",value:function(){var t=this.state,n=t.list,c=t.loading,r=this.props.selected;return Object(j.createElement)(e,o()({},this.props,{products:n,isLoading:c,selected:n.filter(function(e){var t=e.id;return r.includes(t)}),onSearch:k.IS_LARGE_CATALOG?this.debouncedOnSearch:null}))}}]),n}(j.Component);return t.defaultProps={selected:[]},t},"withSearchedProducts");n.d(t,"b",function(){return y}),n.d(t,"a",function(){return E}),n.d(t,"c",function(){return C})}});