15 lines
19 KiB
JavaScript
15 lines
19 KiB
JavaScript
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["legacy-template"]=function(e){function t(t){for(var c,i,l=t[0],u=t[1],a=t[2],p=0,d=[];p<l.length;p++)i=l[p],Object.prototype.hasOwnProperty.call(r,i)&&r[i]&&d.push(r[i][0]),r[i]=0;for(c in u)Object.prototype.hasOwnProperty.call(u,c)&&(e[c]=u[c]);for(s&&s(t);d.length;)d.shift()();return n.push.apply(n,a||[]),o()}function o(){for(var e,t=0;t<n.length;t++){for(var o=n[t],c=!0,l=1;l<o.length;l++){var u=o[l];0!==r[u]&&(c=!1)}c&&(n.splice(t--,1),e=i(i.s=o[0]))}return e}var c={},r={18:0},n=[];function i(t){if(c[t])return c[t].exports;var o=c[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=e,i.c=c,i.d=function(e,t,o){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},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 o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)i.d(o,c,function(t){return e[t]}.bind(null,c));return o},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 l=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],u=l.push.bind(l);l.push=t,l=l.slice();for(var a=0;a<l.length;a++)t(l[a]);var s=u;return n.push([457,0]),o()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},108:function(e,t,o){"use strict";o.d(t,"a",(function(){return u})),o.d(t,"b",(function(){return a}));var c=o(0),r=o(2),n=o(1),i=o(326),l=o(66);const u="core/post-template",a="woocommerce/product-query/product-template";Object(l.a)(u,{blockDescription:Object(n.__)("Contains the block elements used to render a product, like its name, featured image, rating, and more.","woocommerce"),blockIcon:Object(c.createElement)(r.Icon,{icon:i.a}),blockTitle:Object(n.__)("Product template","woocommerce"),variationName:a})},11:function(e,t){e.exports=window.wp.primitives},168:function(e,t,o){"use strict";o.d(t,"a",(function(){return u})),o.d(t,"b",(function(){return a}));var c=o(0),r=o(2),n=o(77),i=o(190),l=o(66);const u="core/post-excerpt",a="woocommerce/product-query/product-summary";Object(l.a)(u,{blockDescription:n.a,blockIcon:Object(c.createElement)(r.Icon,{icon:i.a}),blockTitle:n.c,variationName:a})},19:function(e,t,o){"use strict";o.d(t,"o",(function(){return n})),o.d(t,"m",(function(){return i})),o.d(t,"l",(function(){return l})),o.d(t,"n",(function(){return u})),o.d(t,"j",(function(){return a})),o.d(t,"e",(function(){return s})),o.d(t,"g",(function(){return p})),o.d(t,"k",(function(){return d})),o.d(t,"c",(function(){return b})),o.d(t,"d",(function(){return m})),o.d(t,"h",(function(){return g})),o.d(t,"a",(function(){return f})),o.d(t,"i",(function(){return k})),o.d(t,"b",(function(){return w})),o.d(t,"f",(function(){return O}));var c,r=o(3);const n=Object(r.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),i=n.pluginUrl+"images/",l=n.pluginUrl+"build/",u=n.buildPhase,a=null===(c=r.STORE_PAGES.shop)||void 0===c?void 0:c.permalink,s=r.STORE_PAGES.checkout.id,p=(r.STORE_PAGES.checkout.permalink,r.STORE_PAGES.privacy.permalink),d=(r.STORE_PAGES.privacy.title,r.STORE_PAGES.terms.permalink),b=(r.STORE_PAGES.terms.title,r.STORE_PAGES.cart.id),m=r.STORE_PAGES.cart.permalink,g=(r.STORE_PAGES.myaccount.permalink?r.STORE_PAGES.myaccount.permalink:Object(r.getSetting)("wpLoginUrl","/wp-login.php"),Object(r.getSetting)("shippingCountries",{})),f=Object(r.getSetting)("allowedCountries",{}),k=Object(r.getSetting)("shippingStates",{}),w=Object(r.getSetting)("allowedStates",{}),O=Object(r.getSetting)("localPickupEnabled",!1)},193:function(e,t,o){"use strict";o.d(t,"a",(function(){return p}));var c=o(0),r=o(8),n=o(2),i=o(1),l=o(200),u=o(3),a=o(7),s=o(42);const p="woocommerce/product-query",d=["woocommerce/woocommerce//archive-product","woocommerce/woocommerce//taxonomy-product_cat","woocommerce/woocommerce//taxonomy-product_tag","woocommerce/woocommerce//taxonomy-product_attribute","woocommerce/woocommerce//product-search-results"],b=e=>{Object(r.registerBlockVariation)(s.f,{description:Object(i.__)("A block that displays a selection of products in your store.","woocommerce"),name:p,
|
|
/* translators: “Products“ is the name of the block. */
|
|
title:Object(i.__)("Products (Beta)","woocommerce"),isActive:e=>e.namespace===p,icon:Object(c.createElement)(n.Icon,{icon:l.a,className:"wc-block-editor-components-block-icon wc-block-editor-components-block-icon--stacks"}),attributes:{...e,namespace:p},allowedControls:s.b,innerBlocks:s.d,scope:["inserter"]})};if(Object(u.isWpVersion)("6.1",">=")){const e=Object(a.select)("core/edit-site");if(e){let t;Object(a.subscribe)(()=>{const o=t;if(t=null==e?void 0:e.getEditedPostId(),o===t)return;const c={...s.e,query:{...s.e.query,inherit:d.includes(t)}};Object(r.unregisterBlockVariation)(s.f,p),b(c)})}else b(s.e)}},2:function(e,t){e.exports=window.wp.components},200:function(e,t,o){"use strict";var c=o(0),r=o(11);const n=Object(c.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.5 19.375L4.5 7.625C4.5 7.55596 4.55596 7.5 4.625 7.5L16.375 7.5C16.444 7.5 16.5 7.55596 16.5 7.625L16.5 19.375C16.5 19.444 16.444 19.5 16.375 19.5L4.625 19.5C4.55596 19.5 4.5 19.444 4.5 19.375ZM4.625 21C3.72754 21 3 20.2725 3 19.375L3 7.625C3 6.72754 3.72754 6 4.625 6L16.375 6C17.2725 6 18 6.72754 18 7.625L18 19.375C18 20.2725 17.2725 21 16.375 21L4.625 21ZM19 3.75L8 3.75L8 2.25L19 2.25C20.5183 2.25 21.75 3.4796 21.75 4.99891L21.75 18L20.25 18L20.25 4.99891C20.25 4.30909 19.6909 3.75 19 3.75Z"}));t.a=n},3:function(e,t){e.exports=window.wc.wcSettings},42:function(e,t,o){"use strict";o.d(t,"c",(function(){return i})),o.d(t,"f",(function(){return l})),o.d(t,"a",(function(){return u})),o.d(t,"b",(function(){return a})),o.d(t,"g",(function(){return s})),o.d(t,"e",(function(){return d})),o.d(t,"d",(function(){return b}));var c=o(3),r=o(80),n=o(108);const i="/wp-admin/edit.php?post_type=product&page=product_attributes",l="core/query",u=["attributes","presets","onSale","stockStatus","wooInherit"],a=["taxQuery","search",...u],s=Object(c.getSetting)("stockStatusOptions",[]),p=Object(c.getSetting)("hideOutOfStockItems",!1),d={allowedControls:a,displayLayout:{type:"flex",columns:3},query:{perPage:9,pages:0,offset:0,postType:"product",order:"asc",orderBy:"title",author:"",search:"",exclude:[],sticky:"",inherit:!1,__woocommerceAttributes:[],__woocommerceStockStatus:p?Object.keys(function(e,t){const{[t]:o,...c}=e;return c}(s,"outofstock")):Object.keys(s)}},b=[["core/post-template",{__woocommerceNamespace:n.b},[["woocommerce/product-image",{style:{spacing:{margin:{bottom:"0.75rem",top:"0"}}}}],["core/post-title",{textAlign:"center",level:3,fontSize:"medium",style:{spacing:{margin:{bottom:"0.75rem",top:"0"}}},isLink:!0,__woocommerceNamespace:r.b},[]],["woocommerce/product-price",{textAlign:"center",fontSize:"small",style:{spacing:{margin:{bottom:"0.75rem",top:"0"}}}},[]],["woocommerce/product-button",{textAlign:"center",fontSize:"small",style:{spacing:{margin:{bottom:"0.75rem",top:"0"}}}},[]]]],["core/query-pagination",{layout:{type:"flex",justifyContent:"center"}},[]],["core/query-no-results"]]},457:function(e,t,o){e.exports=o(510)},458:function(e,t){},459:function(e,t){},5:function(e,t){e.exports=window.wp.blockEditor},510:function(e,t,o){"use strict";o.r(t);var c={};o.r(c),o.d(c,"getBlockifiedTemplate",(function(){return L})),o.d(c,"isConversionPossible",(function(){return I})),o.d(c,"getDescription",(function(){return q})),o.d(c,"getButtonLabel",(function(){return N}));var r={};o.r(r),o.d(r,"getBlockifiedTemplate",(function(){return D})),o.d(r,"isConversionPossible",(function(){return R})),o.d(r,"getDescription",(function(){return G})),o.d(r,"getButtonLabel",(function(){return V}));var n=o(0),i=o(8),l=o(19),u=o(90),a=o(5),s=o(2),p=o(1),d=o(556),b=o(72),m=o(7);o(458),o(459);const g="woocommerce/legacy-template",f={"single-product":{type:"single-product",title:Object(p.__)("WooCommerce Single Product Block","woocommerce"),placeholder:"single-product"},"archive-product":{type:"product-catalog",title:Object(p.__)("WooCommerce Product Grid Block","woocommerce"),placeholder:"archive-product"},"taxonomy-product_cat":{type:"product-taxonomy",title:Object(p.__)("WooCommerce Product Taxonomy Block","woocommerce"),placeholder:"archive-product"},"taxonomy-product_tag":{type:"product-taxonomy",title:Object(p.__)("WooCommerce Product Tag Block","woocommerce"),placeholder:"archive-product"},"taxonomy-product_attribute":{type:"product-taxonomy",title:Object(p.__)("WooCommerce Product Attribute Block","woocommerce"),placeholder:"archive-product"},"product-search-results":{type:"product-search-results",title:Object(p.__)("WooCommerce Product Search Results Block","woocommerce"),placeholder:"archive-product"}};function k(e,t){const o=Object.keys(t);let c=null;for(let r=0;o.length>r;r++){const n=t[e.substr(0,o[r].length)];if(n){c=n;break}}return c}function w(e,t){return!!k(e,t)}const O=(e,t)=>{var o;const c=((null===(o=Object(i.getBlockType)("core/query-title"))||void 0===o?void 0:o.variations)||[]).find(t=>{let{name:o}=t;return o===e});if(!c)return null;const{attributes:r}=c,n={...r,...t,showPrefix:!1};return Object(i.createBlock)("core/query-title",n)},y=(e,t)=>{var o;const c=((null===(o=Object(i.getBlockType)("core/group"))||void 0===o?void 0:o.variations)||[]).find(e=>{let{name:t}=e;return"group-row"===t});if(!c)return null;const{attributes:r}=c,n={...r,...t,layout:{...r.layout,justifyContent:"space-between"}};return Object(i.createBlock)("core/group",n,e)};var j=o(3),h=o(42),v=o(193);const _=e=>Object(i.createBlock)("core/query",{...h.e,...e,namespace:v.a,query:{...h.e.query,inherit:!0}},Object(i.createBlocksFromInnerBlocksTemplate)(h.d)),B=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return[Object(i.createBlock)("woocommerce/breadcrumbs",e),O("archive-title",e),t?Object(i.createBlock)("core/term-description",e):null,Object(i.createBlock)("woocommerce/store-notices",e),y([Object(i.createBlock)("woocommerce/product-results-count"),Object(i.createBlock)("woocommerce/catalog-sorting")],e),_(e)].filter(Boolean)},S=()=>Object(u.a)()&&Object(j.isWpVersion)("6.1",">="),P=(e,t)=>t?(e=>Object(p.sprintf)(
|
|
/* translators: %s is the template title */
|
|
Object(p.__)("This block serves as a placeholder for your %s. We recommend upgrading to the Products block for more features to edit your products visually. Don't worry, you can always revert back.","woocommerce"),e))(e):(e=>Object(p.sprintf)(
|
|
/* translators: %s is the template title */
|
|
Object(p.__)("This block serves as a placeholder for your %s. It will display the actual product image, title, price in your store. You can move this placeholder around and add more blocks around to customize the template.","woocommerce"),e))(e),E=()=>Object(p.__)("Upgrade to Products block","woocommerce"),T={getBlockifiedTemplate:B,isConversionPossible:S,getDescription:P,getButtonLabel:E},x={getBlockifiedTemplate:e=>B(e,!0),isConversionPossible:S,getDescription:P,getButtonLabel:E};var C=o(80),A=o(168);const L=()=>[Object(i.createBlock)("woocommerce/breadcrumbs"),Object(i.createBlock)("woocommerce/store-notices"),Object(i.createBlock)("core/columns",{align:"wide"},[Object(i.createBlock)("core/column",{type:"constrained",justifyContent:"right"},[Object(i.createBlock)("woocommerce/product-image-gallery")]),Object(i.createBlock)("core/column",{},[Object(i.createBlock)("core/post-title",{__woocommerceNamespace:C.b}),Object(i.createBlock)("woocommerce/product-price",{fontSize:"large"}),Object(i.createBlock)("core/post-excerpt",{__woocommerceNamespace:A.b}),Object(i.createBlock)("woocommerce/add-to-cart-form"),Object(i.createBlock)("woocommerce/product-meta")])]),Object(i.createBlock)("woocommerce/product-details",{align:"wide"}),Object(i.createBlock)("woocommerce/related-products",{align:"wide"})].filter(Boolean),I=()=>Object(j.isWpVersion)("6.1",">="),q=(e,t)=>t?(e=>Object(p.sprintf)(
|
|
/* translators: %s is the template title */
|
|
Object(p.__)("This block serves as a placeholder for your %s. We recommend upgrading to the Single Products block for more features to edit your products visually. Don't worry, you can always revert back.","woocommerce"),e))(e):(e=>Object(p.sprintf)(
|
|
/* translators: %s is the template title */
|
|
Object(p.__)("This block serves as a placeholder for your %s. It will display the actual product image, title, price in your store. You can move this placeholder around and add more blocks around to customize the template.","woocommerce"),e))(e),N=()=>Object(p.__)("Upgrade to Blockified Single Product template","woocommerce"),W=e=>{const t=((e,t)=>{const o=[Object(i.createBlock)("core/paragraph",{content:Object(p.__)("No products were found matching your selection.","woocommerce")}),Object(i.createBlock)("core/search",{buttonPosition:"button-outside",buttonText:Object(p.__)("Search","woocommerce"),buttonUseIcon:!1,showLabel:!1,placeholder:Object(p.__)("Search products…","woocommerce"),query:{post_type:"product"}})],c=e.findIndex(e=>"core/query-no-results"===e[0]),r=["core/query-no-results",{...e[c][1]||{},...t},o];return[...h.d.slice(0,c),r,...h.d.slice(c+1)]})(h.d,e);return Object(i.createBlock)("core/query",{...h.e,...e,namespace:v.a,query:{...h.e.query,inherit:!0}},Object(i.createBlocksFromInnerBlocksTemplate)(t))},D=e=>[O("search-title",e),Object(i.createBlock)("woocommerce/store-notices",e),y([Object(i.createBlock)("woocommerce/product-results-count"),Object(i.createBlock)("woocommerce/catalog-sorting")],e),W(e)].filter(Boolean),R=()=>Object(u.a)()&&Object(j.isWpVersion)("6.1",">="),G=(e,t)=>t?(e=>Object(p.sprintf)(
|
|
/* translators: %s is the template title */
|
|
Object(p.__)("This block serves as a placeholder for your %s. We recommend upgrading to the Products block for more features to edit your products visually. Don't worry, you can always revert back.","woocommerce"),e))(e):(e=>Object(p.sprintf)(
|
|
/* translators: %s is the template title */
|
|
Object(p.__)("This block serves as a placeholder for your %s. It will display the actual product image, title, price in your store. You can move this placeholder around and add more blocks around to customize the template.","woocommerce"),e))(e),V=()=>Object(p.__)("Upgrade to Products block","woocommerce"),U={"product-catalog":T,"product-taxonomy":x,"single-product":c,"product-search-results":r,fallback:{isConversionPossible:()=>!1,getBlockifiedTemplate:()=>[],getDescription:()=>"",getButtonLabel:()=>""}},z=e=>{var t,o,c;let{clientId:r,attributes:i,setAttributes:u}=e;const{replaceBlock:p}=Object(m.useDispatch)("core/block-editor"),b=Object(a.useBlockProps)(),g=k(i.template,f),w=null!==(t=null==g?void 0:g.title)&&void 0!==t?t:i.template,O=null!==(o=null==g?void 0:g.placeholder)&&void 0!==o?o:"fallback",y=null!==(c=null==g?void 0:g.type)&&void 0!==c?c:"fallback";Object(n.useEffect)(()=>{var e;return u({template:i.template,align:null!==(e=i.align)&&void 0!==e?e:"wide"})},[i.align,i.template,u]);const{getBlockifiedTemplate:j,isConversionPossible:h,getDescription:v,getButtonLabel:_}=U[y],B=h(),S=v(w,B);return Object(n.createElement)("div",b,Object(n.createElement)(s.Placeholder,{icon:d.a,label:w,className:"wp-block-woocommerce-classic-template__placeholder"},Object(n.createElement)("div",{className:"wp-block-woocommerce-classic-template__placeholder-copy"},Object(n.createElement)("p",null,S)),Object(n.createElement)("div",{className:"wp-block-woocommerce-classic-template__placeholder-wireframe"},B&&Object(n.createElement)("div",{className:"wp-block-woocommerce-classic-template__placeholder-migration-button-container"},Object(n.createElement)(s.Button,{isPrimary:!0,onClick:()=>{p(r,j(i))},text:_()})),Object(n.createElement)("img",{className:"wp-block-woocommerce-classic-template__placeholder-image",src:`${l.m}template-placeholders/${O}.svg`,alt:w}))))},M=e=>{let{template:t,inserter:o}=e;Object(i.registerBlockType)(g,{title:t&&f[t]?f[t].title:Object(p.__)("WooCommerce Classic Template","woocommerce"),icon:Object(n.createElement)(b.a,{icon:d.a,className:"wc-block-editor-components-block-icon"}),category:"woocommerce",apiVersion:2,keywords:[Object(p.__)("WooCommerce","woocommerce")],description:Object(p.__)("Renders classic WooCommerce PHP templates.","woocommerce"),supports:{align:["wide","full"],html:!1,multiple:!1,reusable:!1,inserter:o},attributes:{template:{type:"string",default:"any"},align:{type:"string",default:"wide"}},edit:e=>{let{attributes:o,clientId:c,setAttributes:r}=e;const i=null!=t?t:o.template;return Object(n.createElement)(z,{attributes:{...o,template:i},setAttributes:r,clientId:c})},save:()=>null})};let Y;Object(u.a)()?Object(m.subscribe)(()=>{var e;const t=Y,o=Object(m.select)("core/edit-site");if(Y=null==o?void 0:o.getEditedPostId(),t===Y)return;const c=null===(e=Y)||void 0===e?void 0:e.split("//")[1];if(null==c)return;const r=Object(i.getBlockType)(g);if(void 0!==r&&(!w(c,f)||function(e,t){const o=k(t,f);return(null==e?void 0:e.title)!==(null==o?void 0:o.title)}(r,c)))return Object(i.unregisterBlockType)(g),void(Y=void 0);void 0===r&&w(c,f)&&M({template:c,inserter:!0})}):M({inserter:!1})},66:function(e,t,o){"use strict";o.d(t,"a",(function(){return r}));var c=o(8);function r(e,t){let{blockDescription:o,blockIcon:r,blockTitle:n,variationName:i}=t;Object(c.registerBlockVariation)(e,{description:o,name:i,title:n,isActive:e=>e.__woocommerceNamespace===i,icon:{src:r},attributes:{__woocommerceNamespace:i},scope:["block","inserter"]})}},7:function(e,t){e.exports=window.wp.data},70:function(e,t,o){"use strict";o.d(t,"c",(function(){return l})),o.d(t,"b",(function(){return u})),o.d(t,"a",(function(){return a}));var c=o(0),r=o(1),n=o(72),i=o(173);const l=Object(r.__)("Product Title","woocommerce"),u=Object(c.createElement)(n.a,{icon:i.a,className:"wc-block-editor-components-block-icon"}),a=Object(r.__)("Display the title of a product.","woocommerce")},77:function(e,t,o){"use strict";o.d(t,"c",(function(){return l})),o.d(t,"b",(function(){return u})),o.d(t,"a",(function(){return a}));var c=o(0),r=o(1),n=o(72),i=o(190);const l=Object(r.__)("Product Summary","woocommerce"),u=Object(c.createElement)(n.a,{icon:i.a,className:"wc-block-editor-components-block-icon"}),a=Object(r.__)("Display a short description about a product.","woocommerce")},8:function(e,t){e.exports=window.wp.blocks},80:function(e,t,o){"use strict";o.d(t,"a",(function(){return u})),o.d(t,"b",(function(){return a}));var c=o(0),r=o(2),n=o(70),i=o(173),l=o(66);const u="core/post-title",a="woocommerce/product-query/product-title";Object(l.a)(u,{blockDescription:n.a,blockIcon:Object(c.createElement)(r.Icon,{icon:i.a}),blockTitle:n.c,variationName:a})},90:function(e,t,o){"use strict";o.d(t,"c",(function(){return n})),o.d(t,"a",(function(){return i})),o.d(t,"b",(function(){return l}));var c=o(8),r=o(19);const n=(e,t)=>{if(r.n>2)return Object(c.registerBlockType)(e,t)},i=()=>r.n>2,l=()=>r.n>1}}); |