JezK
Edit File: saved-for-later.js
(()=>{var e,o,t,r={42873:(e,o,t)=>{"use strict";const r=window.wp.blocks;var c=t(93450),n=t(77092);const i=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"woocommerce/saved-for-later","version":"1.0.0","title":"Saved for Later","description":"Display items the shopper has saved from their cart for later.","category":"woocommerce","keywords":["WooCommerce","Saved for Later"],"textdomain":"woocommerce","blockHooks":{"woocommerce/cart":"after"},"attributes":{"columnCount":{"type":"number"}},"allowedBlocks":["core/heading"],"supports":{"align":["wide","full"],"interactivity":true,"html":false,"multiple":false,"reusable":false,"spacing":{"margin":true,"padding":true,"blockGap":true},"typography":{"fontSize":true,"lineHeight":true},"color":{"text":true,"background":true}},"viewScriptModule":"woocommerce/saved-for-later","style":["file:../woocommerce/saved-for-later-style.css","wc-blocks-style-product-image","woocommerce-product-price-style","woocommerce-product-button-style"]}');var a=t(27723);const s=window.wp.blockEditor,l=window.wp.components;var m=t(78592);const p=window.wc.wcSettings,u=window.wc.wcTypes;var d=t(10790);const w=[["core/heading",{content:(0,a.__)("Saved for later","woocommerce"),level:2}]],_=[{key:"preview-1",name:(0,a.__)("Sample product one","woocommerce"),variation:(0,a.__)("Size: M","woocommerce"),price:"$19.99",quantity:(0,a.__)("Qty: 2","woocommerce")},{key:"preview-2",name:(0,a.__)("Sample product two","woocommerce"),variation:(0,a.__)("Color: Blue","woocommerce"),price:"$29.99",quantity:(0,a.__)("Qty: 1","woocommerce")},{key:"preview-3",name:(0,a.__)("Sample product three","woocommerce"),variation:"",price:"$9.99",quantity:(0,a.__)("Qty: 3","woocommerce")},{key:"preview-4",name:(0,a.__)("Sample product four","woocommerce"),variation:(0,a.__)("Size: L","woocommerce"),price:"$24.99",quantity:(0,a.__)("Qty: 1","woocommerce")},{key:"preview-5",name:(0,a.__)("Sample product five","woocommerce"),variation:"",price:"$14.99",quantity:(0,a.__)("Qty: 2","woocommerce")},{key:"preview-6",name:(0,a.__)("Sample product six","woocommerce"),variation:(0,a.__)("Color: Red","woocommerce"),price:"$39.99",quantity:(0,a.__)("Qty: 1","woocommerce")}];t(41986),(0,r.registerBlockType)(i,{icon:{src:(0,d.jsx)(c.A,{icon:n.A,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e,setAttributes:o})=>{const t=e.columnCount??5,r=(0,p.getSettingWithCoercion)("experimentalCartSaveForLater",!1,u.isBoolean),i=(0,s.useBlockProps)({className:"wc-block-saved-for-later"}),b=(0,s.useInnerBlocksProps)({className:"wc-block-saved-for-later__header"},{template:w});return r?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(s.InspectorControls,{children:(0,d.jsx)(l.PanelBody,{title:(0,a.__)("Settings","woocommerce"),children:(0,d.jsx)(l.RangeControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,a.__)("Columns","woocommerce"),value:t,onChange:e=>{"number"==typeof e&&o({columnCount:e})},min:2,max:6})})}),(0,d.jsxs)("section",{...i,children:[(0,d.jsx)("div",{...b}),(0,d.jsx)("ul",{className:`wc-block-saved-for-later__list columns-${t}`,children:_.map(e=>(0,d.jsxs)("li",{className:"wc-block-shopper-list-item",children:[(0,d.jsxs)("div",{className:"wc-block-components-product-image wc-block-components-product-image--aspect-ratio-auto",children:[(0,d.jsx)("a",{href:"#preview",onClick:e=>e.preventDefault(),children:(0,d.jsx)("img",{src:p.PLACEHOLDER_IMG_SRC,alt:""})}),(0,d.jsx)("button",{type:"button",className:"wc-block-shopper-list-item__remove","aria-label":(0,a.sprintf)(/* translators: %s: product name. */ /* translators: %s: product name. */ (0,a.__)("Remove %s from Saved for later list","woocommerce"),e.name),disabled:!0,children:(0,d.jsx)(c.A,{icon:m.A,size:24})}),e.variation&&(0,d.jsx)("span",{className:"wc-block-shopper-list-item__variation",children:e.variation})]}),(0,d.jsx)("h2",{className:"wp-block-post-title has-text-align-center has-medium-font-size",children:(0,d.jsx)("a",{href:"#preview",onClick:e=>e.preventDefault(),children:e.name})}),(0,d.jsx)("div",{className:"price wc-block-components-product-price has-text-align-center has-small-font-size",children:(0,d.jsx)("span",{className:"wc-block-components-product-price__value",children:e.price})}),(0,d.jsx)("span",{className:"wc-block-shopper-list-item__quantity",children:e.quantity}),(0,d.jsx)("div",{className:"wp-block-button wc-block-components-product-button",children:(0,d.jsx)("button",{type:"button",className:"wp-block-button__link wp-element-button add_to_cart_button wc-block-components-product-button__button",disabled:!0,children:(0,a.__)("Move to cart","woocommerce")})})]},e.key))})]})]}):(0,d.jsx)("div",{...i,children:(0,d.jsx)(l.Placeholder,{icon:(0,d.jsx)(c.A,{icon:n.A}),label:(0,a.__)("Saved for later","woocommerce"),instructions:(0,a.sprintf)(/* translators: %s: the feature name ("Save for Later in Cart"). */ /* translators: %s: the feature name ("Save for Later in Cart"). */ (0,a.__)("The ā%sā feature is off, so this block will not appear on your store.","woocommerce"),(0,a.__)("Save for Later in Cart","woocommerce")),children:(0,d.jsx)(l.ExternalLink,{href:(0,p.getAdminLink)("admin.php?page=wc-settings&tab=advanced§ion=features"),children:(0,a.__)("Enable it in WooCommerce settings","woocommerce")})})})},save:()=>(0,d.jsx)(s.InnerBlocks.Content,{})})},41986:()=>{},10790:e=>{"use strict";e.exports=window.ReactJSXRuntime},86087:e=>{"use strict";e.exports=window.wp.element},27723:e=>{"use strict";e.exports=window.wp.i18n},5573:e=>{"use strict";e.exports=window.wp.primitives}},c={};function n(e){var o=c[e];if(void 0!==o)return o.exports;var t=c[e]={exports:{}};return r[e](t,t.exports,n),t.exports}n.m=r,e=[],n.O=(o,t,r,c)=>{if(!t){var i=1/0;for(m=0;m<e.length;m++){for(var[t,r,c]=e[m],a=!0,s=0;s<t.length;s++)(!1&c||i>=c)&&Object.keys(n.O).every(e=>n.O[e](t[s]))?t.splice(s--,1):(a=!1,c<i&&(i=c));if(a){e.splice(m--,1);var l=r();void 0!==l&&(o=l)}}return o}c=c||0;for(var m=e.length;m>0&&e[m-1][2]>c;m--)e[m]=e[m-1];e[m]=[t,r,c]},n.n=e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return n.d(o,{a:o}),o},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,n.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var c=Object.create(null);n.r(c);var i={};o=o||[null,t({}),t([]),t(t)];for(var a=2&r&&e;"object"==typeof a&&!~o.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach(o=>i[o]=()=>e[o]);return i.default=()=>e,n.d(c,i),c},n.d=(e,o)=>{for(var t in o)n.o(o,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:o[t]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.j=1623,(()=>{var e={1623:0};n.O.j=o=>0===e[o];var o=(o,t)=>{var r,c,[i,a,s]=t,l=0;if(i.some(o=>0!==e[o])){for(r in a)n.o(a,r)&&(n.m[r]=a[r]);if(s)var m=s(n)}for(o&&o(t);l<i.length;l++)c=i[l],n.o(e,c)&&e[c]&&e[c][0](),e[c]=0;return n.O(m)},t=globalThis.webpackChunkwebpackWcBlocksMainJsonp=globalThis.webpackChunkwebpackWcBlocksMainJsonp||[];t.forEach(o.bind(null,0)),t.push=o.bind(null,t.push.bind(t))})();var i=n.O(void 0,[94],()=>n(42873));i=n.O(i),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["saved-for-later"]=i})();