3 lines
7.7 KiB
JavaScript
3 lines
7.7 KiB
JavaScript
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["legacy-template"]=function(e){function t(t){for(var r,l,i=t[0],u=t[1],a=t[2],p=0,d=[];p<i.length;p++)l=i[p],Object.prototype.hasOwnProperty.call(c,l)&&c[l]&&d.push(c[l][0]),c[l]=0;for(r in u)Object.prototype.hasOwnProperty.call(u,r)&&(e[r]=u[r]);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],r=!0,i=1;i<o.length;i++){var u=o[i];0!==c[u]&&(r=!1)}r&&(n.splice(t--,1),e=l(l.s=o[0]))}return e}var r={},c={15:0},n=[];function l(t){if(r[t])return r[t].exports;var o=r[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,l),o.l=!0,o.exports}l.m=e,l.c=r,l.d=function(e,t,o){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(l.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)l.d(o,r,function(t){return e[t]}.bind(null,r));return o},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],u=i.push.bind(i);i.push=t,i=i.slice();for(var a=0;a<i.length;a++)t(i[a]);var s=u;return n.push([481,0]),o()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},11:function(e,t){e.exports=window.wp.primitives},13:function(e,t){e.exports=window.wp.blocks},2:function(e,t){e.exports=window.wc.wcSettings},22:function(e,t,o){"use strict";o.d(t,"o",(function(){return n})),o.d(t,"m",(function(){return l})),o.d(t,"l",(function(){return i})),o.d(t,"n",(function(){return u})),o.d(t,"j",(function(){return a})),o.d(t,"e",(function(){return s})),o.d(t,"f",(function(){return p})),o.d(t,"g",(function(){return d})),o.d(t,"k",(function(){return b})),o.d(t,"c",(function(){return m})),o.d(t,"d",(function(){return f})),o.d(t,"h",(function(){return g})),o.d(t,"a",(function(){return w})),o.d(t,"i",(function(){return O})),o.d(t,"b",(function(){return h}));var r,c=o(2);const n=Object(c.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),l=n.pluginUrl+"images/",i=n.pluginUrl+"build/",u=n.buildPhase,a=null===(r=c.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,s=c.STORE_PAGES.checkout.id,p=c.STORE_PAGES.checkout.permalink,d=c.STORE_PAGES.privacy.permalink,b=(c.STORE_PAGES.privacy.title,c.STORE_PAGES.terms.permalink),m=(c.STORE_PAGES.terms.title,c.STORE_PAGES.cart.id),f=c.STORE_PAGES.cart.permalink,g=(c.STORE_PAGES.myaccount.permalink?c.STORE_PAGES.myaccount.permalink:Object(c.getSetting)("wpLoginUrl","/wp-login.php"),Object(c.getSetting)("shippingCountries",{})),w=Object(c.getSetting)("allowedCountries",{}),O=Object(c.getSetting)("shippingStates",{}),h=Object(c.getSetting)("allowedStates",{})},3:function(e,t){e.exports=window.wp.components},481:function(e,t,o){e.exports=o(512)},482:function(e,t){},483:function(e,t){},5:function(e,t){e.exports=window.wp.blockEditor},512:function(e,t,o){"use strict";o.r(t);var r=o(0),c=o(13),n=o(65),l=o(22),i=o(5),u=o(3),a=o(1),s=o(547),p=o(115),d=o(9);o(482),o(483);const b="woocommerce/legacy-template",m={"single-product":{title:Object(a.__)("WooCommerce Single Product Block","woocommerce"),placeholder:"single-product"},"archive-product":{title:Object(a.__)("WooCommerce Product Grid Block","woocommerce"),placeholder:"archive-product"},"taxonomy-product_cat":{title:Object(a.__)("WooCommerce Product Taxonomy Block","woocommerce"),placeholder:"archive-product"},"taxonomy-product_tag":{title:Object(a.__)("WooCommerce Product Tag Block","woocommerce"),placeholder:"archive-product"},"product-search-results":{title:Object(a.__)("WooCommerce Product Search Results Block","woocommerce"),placeholder:"archive-product"}},f=e=>{var t,o,p,b;let{clientId:f,attributes:g,setAttributes:w}=e;const{replaceBlock:O}=Object(d.useDispatch)("core/block-editor"),h=Object(i.useBlockProps)(),k=null!==(t=null===(o=m[g.template])||void 0===o?void 0:o.title)&&void 0!==t?t:g.template,v=null!==(p=null===(b=m[g.template])||void 0===b?void 0:b.placeholder)&&void 0!==p?p:"fallback";return Object(r.useEffect)(()=>{var e;return w({template:g.template,align:null!==(e=g.align)&&void 0!==e?e:"wide"})},[g.align,g.template,w]),Object(r.createElement)("div",h,Object(r.createElement)(u.Placeholder,{icon:s.a,label:k,className:"wp-block-woocommerce-classic-template__placeholder"},Object(r.createElement)("div",{className:"wp-block-woocommerce-classic-template__placeholder-copy"},Object(r.createElement)("p",{className:"wp-block-woocommerce-classic-template__placeholder-warning"},Object(r.createElement)("strong",null,Object(a.__)("Attention: Do not remove this block!","woocommerce"))," ",Object(a.__)("Removal will cause unintended effects on your store.","woocommerce")),Object(r.createElement)("p",null,Object(a.sprintf)(
|
|
/* translators: %s is the template title */
|
|
Object(a.__)("This is an editor placeholder for the %s. On your store this will be replaced by the template and display with your product image(s), title, price, etc. You can move this placeholder around and add further blocks around it to extend the template.","woocommerce"),k))),Object(r.createElement)("div",{className:"wp-block-woocommerce-classic-template__placeholder-wireframe"},Object(n.a)()&&Object(r.createElement)("div",{className:"wp-block-woocommerce-classic-template__placeholder-migration-button-container"},Object(r.createElement)(u.Button,{isPrimary:!0,onClick:()=>{O(f,Object(c.createBlock)("core/paragraph",{content:"Instead of this block, the new Product Grid Block will be rendered"}))},text:Object(a.__)("Use the blockified Product Grid Block","woocommerce")})),Object(r.createElement)("img",{className:"wp-block-woocommerce-classic-template__placeholder-image",src:`${l.m}template-placeholders/${v}.svg`,alt:k}))))},g=Object.keys(m),w=e=>{let{template:t,inserter:o}=e;Object(c.registerBlockType)(b,{title:t?m[t].title:Object(a.__)("WooCommerce Classic Template","woocommerce"),icon:Object(r.createElement)(p.a,{icon:s.a,className:"wc-block-editor-components-block-icon"}),category:"woocommerce",apiVersion:2,keywords:[Object(a.__)("WooCommerce","woocommerce")],description:Object(a.__)("Renders classic WooCommerce PHP templates.","woocommerce"),supports:{align:["wide","full"],html:!1,multiple:!1,reusable:!1,inserter:o},example:{attributes:{isPreview:!0}},attributes:{template:{type:"string",default:"any"},align:{type:"string",default:"wide"}},edit:e=>{let{attributes:o,clientId:c,setAttributes:n}=e;const l=null!=t?t:o.template;return Object(r.createElement)(f,{attributes:{...o,template:l},setAttributes:n,clientId:c})},save:()=>null})},O=e=>g.includes(e);let h;Object(n.a)()?Object(d.subscribe)(()=>{var e;const t=h,o=Object(d.select)("core/edit-site");if(h=null==o?void 0:o.getEditedPostId(),t===h)return;const r=null===(e=h)||void 0===e?void 0:e.split("//")[1];if(null==r)return;const n=Object(c.getBlockType)(b);if(void 0!==n&&(!O(r)||((e,t)=>(null==e?void 0:e.title)!==m[t].title)(n,r)))return Object(c.unregisterBlockType)(b),void(h=void 0);void 0===n&&O(r)&&w({template:r,inserter:!0})}):w({inserter:!1})},65:function(e,t,o){"use strict";o.d(t,"c",(function(){return n})),o.d(t,"d",(function(){return l})),o.d(t,"a",(function(){return i})),o.d(t,"b",(function(){return u}));var r=o(13),c=o(22);const n=(e,t)=>{if(c.n>2)return Object(r.registerBlockType)(e,t)},l=(e,t)=>{if(c.n>1)return Object(r.registerBlockType)(e,t)},i=()=>c.n>2,u=()=>c.n>1},9:function(e,t){e.exports=window.wp.data}}); |