Ubuntu
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["handpicked-products"]=function(e){function t(t){for(var r,i,a=t[0],l=t[1],u=t[2],d=0,b=[];d0&&void 0!==arguments[0]?arguments[0]:[],t=e.map(function(e){return e.id});n({products:t})}})))}},{key:"renderEditMode",value:function(){var e=this.props,t=e.attributes,n=e.debouncedSpeak,c=e.setAttributes;return Object(r.createElement)(m.Placeholder,{icon:Object(r.createElement)(v.i,null),label:Object(o.__)("Hand-picked Products",'woocommerce'),className:"wc-block-products-grid wc-block-handpicked-products"},Object(o.__)("Display a selection of hand-picked products in a grid.",'woocommerce'),Object(r.createElement)("div",{className:"wc-block-handpicked-products__selection"},Object(r.createElement)(E,{selected:t.products,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.map(function(e){return e.id});c({products:t})}}),Object(r.createElement)(m.Button,{isDefault:!0,onClick:function(){c({editMode:!1}),n(Object(o.__)("Showing Hand-picked Products block preview.",'woocommerce'))}},Object(o.__)("Done",'woocommerce'))))}},{key:"render",value:function(){var e=this.props,t=e.attributes,n=e.name,c=e.setAttributes,i=t.editMode;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(O.BlockControls,null,Object(r.createElement)(m.Toolbar,{controls:[{icon:"edit",title:Object(o.__)("Edit"),onClick:function(){return c({editMode:!i})},isActive:i}]})),this.getInspectorControls(),i?this.renderEditMode():Object(r.createElement)(m.Disabled,null,Object(r.createElement)(O.ServerSideRender,{block:n,attributes:t})))}}]),t}(r.Component),S=Object(m.withSpokenMessages)(C),P=n(46);Object(c.registerBlockType)("woocommerce/handpicked-products",{title:Object(o.__)("Hand-picked Products",'woocommerce'),icon:{src:Object(r.createElement)(v.i,null),foreground:"#96588a"},category:"woocommerce",keywords:[Object(o.__)("WooCommerce",'woocommerce')],description:Object(o.__)("Display a selection of hand-picked products in a grid.",'woocommerce'),supports:{align:["wide","full"],html:!1},attributes:{align:{type:"string"},columns:{type:"number",default:i.DEFAULT_COLUMNS},editMode:{type:"boolean",default:!0},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}},orderby:{type:"string",default:"date"},products:{type:"array",default:[]},alignButtons:{type:"boolean",default:!1}},deprecated:[{attributes:{align:{type:"string"},columns:{type:"number",default:i.DEFAULT_COLUMNS},editMode:{type:"boolean",default:!0},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}},orderby:{type:"string",default:"date"},products:{type:"array",default:[]}},save:Object(P.a)("woocommerce/handpicked-products")}],edit:function(e){return Object(r.createElement)(S,e)},save:function(){return null}})},57:function(e,t,n){"use strict";var r=n(0),o=n(1),c=n(2);n(7);t.a=function(e){var t=e.value,n=e.setAttributes;return Object(r.createElement)(c.SelectControl,{label:Object(o.__)("Order products by",'woocommerce'),value:t,options:[{label:Object(o.__)("Newness - newest first",'woocommerce'),value:"date"},{label:Object(o.__)("Price - low to high",'woocommerce'),value:"price_asc"},{label:Object(o.__)("Price - high to low",'woocommerce'),value:"price_desc"},{label:Object(o.__)("Rating - highest first",'woocommerce'),value:"rating"},{label:Object(o.__)("Sales - most first",'woocommerce'),value:"popularity"},{label:Object(o.__)("Title - alphabetical",'woocommerce'),value:"title"},{label:Object(o.__)("Menu Order",'woocommerce'),value:"menu_order"}],onChange:function(e){return n({orderby:e})}})}},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 r=n(16),o=n.n(r),c=n(38),i=n.n(c),a=n(8),l=n.n(a),u=n(9),s=n.n(u),d=n(10),b=n.n(d),p=n(11),g=n.n(p),h=n(15),f=n.n(h),O=n(12),m=n.n(O),w=n(0),v=n(21),j=n(25),y=Object(v.createHigherOrderComponent)(function(e){return function(t){function n(){var e;return l()(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 m()(n,t),s()(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(j.b)(t).then(function(t){e.setState({product:t,loading:!1,error:null})}).catch(function(t){var n="object"===i()(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,r=t.loading,c=t.product;return Object(w.createElement)(e,o()({},this.props,{error:n,getProduct:this.loadProduct,isLoading:r,product:c}))}}]),n}(w.Component)},"withProduct"),_=Object(v.createHigherOrderComponent)(function(e){return function(t){function n(){var e;return l()(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 m()(n,t),s()(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(j.a)(t).then(function(t){e.setState({category:t,loading:!1,error:null})}).catch(function(t){var n="object"===i()(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,r=t.loading,c=t.category;return Object(w.createElement)(e,o()({},this.props,{error:n,getCategory:this.loadCategory,isLoading:r,category:c}))}}]),n}(w.Component)},"withCategory"),E=n(4),k=(n(7),n(5)),C=Object(v.createHigherOrderComponent)(function(e){var t=function(t){function n(){var e;return l()(this,n),(e=b()(this,g()(n).apply(this,arguments))).state={list:[],loading:!0},e.debouncedOnSearch=Object(E.debounce)(e.onSearch.bind(f()(e)),400),e}return m()(n,t),s()(n,[{key:"componentDidMount",value:function(){var e=this,t=this.props.selected;Object(j.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(j.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,r=t.loading,c=this.props.selected;return Object(w.createElement)(e,o()({},this.props,{products:n,isLoading:r,selected:n.filter(function(e){var t=e.id;return c.includes(t)}),onSearch:k.IS_LARGE_CATALOG?this.debouncedOnSearch:null}))}}]),n}(w.Component);return t.defaultProps={selected:[]},t},"withSearchedProducts");n.d(t,"b",function(){return y}),n.d(t,"a",function(){return _}),n.d(t,"c",function(){return C})}});