woocommerce/packages/woocommerce-blocks/build/featured-product.js

5 lines
32 KiB
JavaScript
Raw Normal View History

2021-12-10 12:03:04 +00:00
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["featured-product"]=function(e){function t(t){for(var n,i,a=t[0],u=t[1],s=t[2],d=0,p=[];d<a.length;d++)i=a[d],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&p.push(o[i][0]),o[i]=0;for(n in u)Object.prototype.hasOwnProperty.call(u,n)&&(e[n]=u[n]);for(l&&l(t);p.length;)p.shift()();return c.push.apply(c,s||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],n=!0,a=1;a<r.length;a++){var u=r[a];0!==o[u]&&(n=!1)}n&&(c.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={24:0},c=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],u=a.push.bind(a);a.push=t,a=a.slice();for(var s=0;s<a.length;s++)t(a[s]);var l=u;return c.push([769,0]),r()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},106:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(66)),i=r(150),a=r(6),u=r.n(a),s=r(4),l=r(52);r(153),t.a=function(e){var t=e.className,r=e.error,a=e.isLoading,d=e.onRetry;return Object(n.createElement)(s.Placeholder,{icon:Object(n.createElement)(c.a,{srcElement:i.a}),label:Object(o.__)("Sorry, an error occurred",'woocommerce'),className:u()("wc-block-api-error",t)},Object(n.createElement)(l.a,{error:r}),d&&Object(n.createElement)(n.Fragment,null,a?Object(n.createElement)(s.Spinner,null):Object(n.createElement)(s.Button,{isSecondary:!0,onClick:d},Object(o.__)("Retry",'woocommerce'))))}},11:function(e,t){e.exports=window.React},12:function(e,t){e.exports=window.wp.blockEditor},121:function(e,t){},122:function(e,t){e.exports=window.wp.coreData},131:function(e,t,r){"use strict";var n=r(9),o=r.n(n),c=r(16),i=r.n(c),a=r(0),u=r(49),s=r(4),l=r(6),d=r.n(l),p=["className","item","isSelected","isLoading","onSelect","disabled"];t.a=function(e){var t=e.className,r=e.item,n=e.isSelected,c=e.isLoading,l=e.onSelect,f=e.disabled,b=i()(e,p);return Object(a.createElement)(a.Fragment,null,Object(a.createElement)(u.c,o()({},b,{key:r.id,className:t,isSelected:n,item:r,onSelect:l,isSingle:!0,disabled:f})),n&&c&&Object(a.createElement)("div",{key:"loading",className:d()("woocommerce-search-list__item","woocommerce-product-attributes__item","depth-1","is-loading","is-not-active")},Object(a.createElement)(s.Spinner,null)))}},14:function(e,t){e.exports=window.wp.data},149:function(e,t,r){"use strict";var n=r(33),o=r.n(n),c=r(5),i=r.n(c),a=r(9),u=r.n(a),s=r(0),l=r(1),d=r(7),p=(r(2),r(49)),f=r(21),b=r(17),g=r.n(b),m=r(18),h=r.n(m),w=r(19),O=r.n(w),v=r(20),j=r.n(v),y=r(10),_=r.n(y);var k=Object(f.createHigherOrderComponent)((function(e){var t=function(t){O()(c,t);var r,n,o=(r=c,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=_()(r);if(n){var o=_()(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return j()(this,e)});function c(){return g()(this,c),o.apply(this,arguments)}return h()(c,[{key:"render",value:function(){var t=this.props.selected,r=null==t;return Object(s.createElement)(e,u()({},this.props,{select
/* translators: %1$d is the number of variations of a product product. */
Object(l.__)("%1$d variations",'woocommerce'),t.variations.length):null,name:"products-".concat(n),"aria-label":Object(l.sprintf)(
/* translators: %1$s is the product name, %2$d is the number of variations of that product. */
Object(l._n)("%1$s, has %2$d variation","%1$s, has %2$d variations",t.variations.length,'woocommerce'),t.name,t.variations.length)}));var m=Object(d.isEmpty)(t.variation)?e:z(z({},e),{},{item:z(z({},e.item),{},{name:t.variation}),"aria-label":"".concat(t.breadcrumbs[0],": ").concat(t.variation)});return Object(s.createElement)(p.c,u()({},m,{className:g,name:"variations-".concat(n)}))}:null),onSearch:f,messages:q,isHierarchical:!0})};Q.defaultProps={isCompact:!1,expandedProduct:null,selected:[],showVariations:!1},t.a=k(Object(P.a)(N(Object(f.withInstanceId)(Q))))},15:function(e,t){e.exports=window.wp.apiFetch},150:function(e,t,r){"use strict";var n=r(0),o=r(28),c=Object(n.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}));t.a=c},153:function(e,t){},21:function(e,t){e.exports=window.wp.compose},214:function(e,t){},22:function(e,t){e.exports=window.regeneratorRuntime},23:function(e,t){e.exports=window.wp.url},25:function(e,t){e.exports=window.wp.htmlEntities},26:function(e,t){e.exports=window.wp.blocks},28:function(e,t){e.exports=window.wp.primitives},3:function(e,t){e.exports=window.wc.wcSettings},302:function(e,t,r){"use strict";var n=r(9),o=r.n(n),c=r(29),i=r.n(c),a=r(8),u=r.n(a),s=r(16),l=r.n(s),d=r(0),p=r(22),f=r.n(p),b=r(37),g=r(39),m=r(222),h=r(42),w=["selected"];t.a=function(e){return function(t){var r=t.selected,n=l()(t,w),c=Object(d.useState)(!0),a=u()(c,2),s=a[0],p=a[1],O=Object(d.useState)(null),v=u()(O,2),j=v[0],y=v[1],_=Object(d.useState)([]),k=u()(_,2),P=k[0],S=k[1],E=b.o.productCount>100,x=function(){var e=i()(f.a.mark((function e(t){var r;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(h.a)(t);case 2:r=e.sent,y(r),p(!1);case 5:case"end":return e.stop()}}),e)})));return function(_x){return e.apply(this,arguments)}}();Object(d.useEffect)((function(){Object(g.h)({selected:r}).then((function(e){S(e),p(!1)})).catch(x)}),[r]);var C=Object(m.a)((function(e){Object(g.h)({selected:r,search:e}).then((function(e){S(e),p(!1)})).catch(x)}),400),R=u()(C,1)[0],A=Object(d.useCallback)((function(e){p(!0),R(e)}),[p,R]);return Object(d.createElement)(e,o()({},n,{selected:r,error:j,products:P,isLoading:s,onSearch:E?A:null}))}}},31:function(e,t){e.exports=window.moment},34:function(e,t){e.exports=window.wp.isShallowEqual},36:function(e,t){e.exports=window.wp.dataControls},37:function(e,t,r){"use strict";r.d(t,"o",(function(){return c})),r.d(t,"m",(function(){return i})),r.d(t,"l",(function(){return a})),r.d(t,"n",(function(){return u})),r.d(t,"j",(function(){return s})),r.d(t,"e",(function(){return l})),r.d(t,"f",(function(){return d})),r.d(t,"g",(function(){return p})),r.d(t,"k",(function(){return f})),r.d(t,"c",(function(){return b})),r.d(t,"d",(function(){return g})),r.d(t,"h",(function(){return m})),r.d(t,"a",(function(){return h})),r.d(t,"i",(function(){return w})),r.d(t,"b",(function(){return O}));var n,o=r(3),c=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),i=c.pluginUrl+"images/",a=c.pluginUrl+"build/",u=c.buildPhase,s=null===(n=o.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,l=o.STORE_PAGES.checkout.id,d=o.STORE_PAGES.checkout.permalink,p=o.STORE_PAGES.privacy.permalink,f=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),b=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id),g=o.STORE_PAGES.cart.permalink,m=(o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),Object(o.getSetting)("shippingCountries",{})),h=Object(o.getSetting)("allowedCountries",{}),w=Object(o.getSetting)("shippingStates",{}),O=Object(o.getSetting)("allowedStates",{})},39:function(e,t,r){"use strict";r.d(t,"h",(function(){return f})),r.d(t,"e",(function(){return b})),r.d(t,"b",(function(){return g})),r.d(t,"i",(function(){return m})),r.d(t,"f",(function(){return h})),r.d(t,"c",(function(