Files
php_assessment_2/wp-content/plugins/woocommerce/assets/client/blocks/mini-cart-component-frontend.js
T

3 lines
20 KiB
JavaScript
Raw Normal View History

2025-02-05 23:15:46 +01:00
var wc;(()=>{var e,t,o,r,a,c={7140:(e,t,o)=>{"use strict";o.r(t);var r=o(8640),a=o(1609),c=o(1456),n=o(4410),i=o(8509),s=o(7082),l=o(4956),m=o(4083),u=o(910),p=o(5703),d=o(3993),f=o(6087),b=o(7723),w=o(851),k=o(812),h=o(7059),g=o(8208),y=o(9202),v=o(7104);o(880);const C=({count:e=0,icon:t,iconColor:o,productCountColor:r,productCountVisibility:c})=>{const n="always"===c||"greater_than_zero"===c&&e>0,i=n?e:"";return(0,a.createElement)("span",{className:"wc-block-mini-cart__quantity-badge"},(0,a.createElement)(v.A,{className:"wc-block-mini-cart__icon",color:null==o?void 0:o.color,size:20,icon:function(e){switch(e){case"cart":default:return h.A;case"bag":return g.A;case"bag-alt":return y.A}}(t)}),n&&(0,a.createElement)("span",{className:"wc-block-mini-cart__badge",style:{background:null==r?void 0:r.color}},i))};var _=o(8939),x=o(1e3);const O=JSON.parse('{"name":"woocommerce/empty-mini-cart-contents-block","version":"1.0.0","title":"Empty Mini-Cart view","description":"Blocks that are displayed when the Mini-Cart is empty.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/mini-cart-contents"],"textdomain":"woocommerce","apiVersion":3,"$schema":"https://schemas.wp.org/trunk/block.json"}'),E=JSON.parse('{"name":"woocommerce/filled-mini-cart-contents-block","version":"1.0.0","title":"Filled Mini-Cart view","description":"Contains blocks that display the content of the Mini-Cart.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/mini-cart-contents"],"textdomain":"woocommerce","apiVersion":3,"$schema":"https://schemas.wp.org/trunk/block.json"}'),S=JSON.parse('{"name":"woocommerce/mini-cart-title-block","version":"1.0.0","title":"Mini-Cart Title","description":"Block that displays the title of the Mini-Cart block.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"color":{"text":true,"background":false},"typography":{"fontSize":true}},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/filled-mini-cart-contents-block"],"textdomain":"woocommerce","apiVersion":3,"$schema":"https://schemas.wp.org/trunk/block.json"}'),j=JSON.parse('{"name":"woocommerce/mini-cart-title-items-counter-block","version":"1.0.0","title":"Mini-Cart Title Items Counter","description":"Block that displays the items counter part of the Mini-Cart Title block.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"color":{"text":true,"background":true},"typography":{"fontSize":true},"spacing":{"padding":true}},"parent":["woocommerce/mini-cart-title-block"],"textdomain":"woocommerce","apiVersion":3,"$schema":"https://schemas.wp.org/trunk/block.json"}'),B=JSON.parse('{"name":"woocommerce/mini-cart-title-label-block","version":"1.0.0","title":"Mini-Cart Title Label","description":"Block that displays the \'Your cart\' part of the Mini-Cart Title block.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"color":{"text":true,"background":true},"typography":{"fontSize":true},"spacing":{"padding":true}},"attributes":{"label":{"type":"string"}},"parent":["woocommerce/mini-cart-title-block"],"textdomain":"woocommerce","apiVersion":3,"$schema":"https://schemas.wp.org/trunk/block.json"}'),N=JSON.parse('{"name":"woocommerce/mini-cart-products-table-block","version":"1.0.0","title":"Mini-Cart Products Table","description":"Block that displays the products table of the Mini-Cart block.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"obj
(0,b._n)("%1$d item in cart","%1$d items in cart",X,"woocommerce"),X):(0,b.sprintf)(/* translators: %1$d is the number of products in the cart. %2$s is the cart total */ /* translators: %1$d is the number of products in the cart. %2$s is the cart total */
(0,b._n)("%1$d item in cart, total price of %2$s","%1$d items in cart, total price of %2$s",X,"woocommerce"),X,(0,u.formatPrice)(Y,(0,u.getCurrencyFromPriceResponse)(K)));return(0,a.createElement)(a.Fragment,null,(0,a.createElement)("button",{className:`wc-block-mini-cart__button ${h}`,onClick:()=>{"navigate_to_checkout"!==_?P||(I(!0),V(!1)):window.location.href=k.tn},"aria-label":G},!x&&(0,a.createElement)("span",{className:"wc-block-mini-cart__amount",style:{color:O.color}},(0,u.formatPrice)(Y,(0,u.getCurrencyFromPriceResponse)(K))),""!==D&&0!==Y&&!x&&(0,a.createElement)("small",{className:"wc-block-mini-cart__tax-label",style:{color:O.color}},D),(0,a.createElement)(C,{count:X,icon:y,iconColor:E,productCountColor:S,productCountVisibility:j})),(0,a.createElement)(n.A,{className:(0,w.A)("wc-block-mini-cart__drawer","is-mobile",{"is-loading":N}),isOpen:P,onClose:()=>{I(!1)},slideIn:!$},(0,a.createElement)("div",{className:"wc-block-mini-cart__template-part",ref:R,dangerouslySetInnerHTML:{__html:g}})))};(()=>{let e=null;if(document.activeElement&&document.activeElement.classList.contains("wc-block-mini-cart__button")&&document.activeElement.parentNode instanceof HTMLElement&&(e=document.activeElement.parentNode),(0,r.Fq)({selector:".wc-block-mini-cart",Block:H,getProps:e=>{var t,o;let r="";const a=e.querySelector(".wc-block-mini-cart__button");return a instanceof HTMLButtonElement&&(r=a.classList.toString().replace("wc-block-mini-cart__button","")),{initialCartTotals:e.dataset.cartTotals?JSON.parse(e.dataset.cartTotals):null,initialCartItemsCount:e.dataset.cartItemsCount?parseInt(e.dataset.cartItemsCount,10):0,isInitiallyOpen:"true"===e.dataset.isInitiallyOpen,colorClassNames:r,style:e.dataset.style?JSON.parse(e.dataset.style):{},miniCartIcon:e.dataset.miniCartIcon,addToCartBehaviour:e.dataset.addToCartBehaviour||"none",onCartClickBehaviour:e.dataset.onCartClickBehaviour||"open_drawer",hasHiddenPrice:"false"!==e.dataset.hasHiddenPrice,priceColor:e.dataset.priceColor?JSON.parse(e.dataset.priceColor):{},iconColor:e.dataset.iconColor?JSON.parse(e.dataset.iconColor):{},productCountColor:e.dataset.productCountColor?JSON.parse(e.dataset.productCountColor):{},contents:null!==(t=null===(o=e.querySelector(".wc-block-mini-cart__template-part"))||void 0===o?void 0:o.innerHTML)&&void 0!==t?t:"",productCountVisibility:e.dataset.productCountVisibility}}}),e instanceof HTMLElement&&!e.dataset.isInitiallyOpen){const t=e.querySelector(".wc-block-mini-cart__button");t instanceof HTMLElement&&t.focus()}})()},24:(e,t,o)=>{"use strict";o.d(t,{m:()=>a});var r=o(3993);const a=e=>(0,r.isObject)(e)&&(0,r.objectHasProp)(e,"type")},880:()=>{},106:()=>{},1609:e=>{"use strict";e.exports=window.React},1e3:e=>{"use strict";e.exports=window.wc.blocksCheckout},4656:e=>{"use strict";e.exports=window.wc.blocksComponents},910:e=>{"use strict";e.exports=window.wc.priceFormat},7594:e=>{"use strict";e.exports=window.wc.wcBlocksData},4083:e=>{"use strict";e.exports=window.wc.wcBlocksRegistry},5703:e=>{"use strict";e.exports=window.wc.wcSettings},3993:e=>{"use strict";e.exports=window.wc.wcTypes},195:e=>{"use strict";e.exports=window.wp.a11y},6004:e=>{"use strict";e.exports=window.wp.autop},9491:e=>{"use strict";e.exports=window.wp.compose},7143:e=>{"use strict";e.exports=window.wp.data},4040:e=>{"use strict";e.exports=window.wp.deprecated},6087:e=>{"use strict";e.exports=window.wp.element},2619:e=>{"use strict";e.exports=window.wp.hooks},8537:e=>{"use strict";e.exports=window.wp.htmlEntities},7723:e=>{"use strict";e.exports=window.wp.i18n},923:e=>{"use strict";e.exports=window.wp.isShallowEqual},8558:e=>{"use strict";e.exports=window.wp.keycodes},5573:e=>{"use strict";e.exports=window.wp.primitives},9786:e=>{"use strict";e.exports=window.wp.styleEngine},3832:e=>{"use strict";e.exports=window.wp.url},9446:e=>{"use strict";e.exports=window.wp.wordcount}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var o=n[e]={exports:{}};return c[e].call(o.exports,o,o.exports,i),o.exports}i.m=c,e=[],i.O=(t,o,r,a)=>{if(!o){var c=1/0;for(m=0;m<e.length;m++){for(var