File "proceed-to-checkout-style.js"

Full Path: /home/siazco/grocery.siazco.se/wp-content/plugins/woocommerce/assets/client/blocks/cart-blocks/proceed-to-checkout-style.js
File size: 2.06 KB
MIME-type: text/plain
Charset: utf-8

"use strict";(self.webpackChunkwebpackWcBlocksStylingJsonp=self.webpackChunkwebpackWcBlocksStylingJsonp||[]).push([[9936],{12854:(e,t,n)=>{n.r(t),n.d(t,{default:()=>h});var o=n(41616),c=n(51609),r=n(70851),a=n(86087),s=n(74845),l=n(40812);const u={bottom:0,left:0,opacity:0,pointerEvents:"none",position:"absolute",right:0,top:0,zIndex:-1};var i=n(15703),b=n(47143),d=n(47594),p=n(71e3),k=n(72379),f=n(68939),g=n(46170);var m=n(59726);const h=(0,o.withFilteredAttributes)(m.A)((({checkoutPageId:e,className:t,buttonLabel:o})=>{const m=(0,i.getSetting)("page-"+e,!1),h=(0,b.useSelect)((e=>e(d.CHECKOUT_STORE_KEY).isCalculating())),[v,C]=(()=>{const[e,t]=(0,a.useState)(""),n=(0,a.useRef)(null),o=(0,a.useRef)(new IntersectionObserver((e=>{e[0].isIntersecting?t("visible"):t(e[0].boundingClientRect.top>0?"below":"above")}),{threshold:[0,.5,1]}));return(0,a.useLayoutEffect)((()=>{const e=n.current,t=o.current;return e&&t.observe(e),()=>{t.unobserve(e)}}),[]),[(0,c.createElement)("div",{"aria-hidden":!0,ref:n,style:u}),e]})(),[E,w]=(0,a.useState)(!1);(0,a.useEffect)((()=>{if("function"!=typeof n.g.addEventListener||"function"!=typeof n.g.removeEventListener)return;const e=()=>{w(!1)};return n.g.addEventListener("pageshow",e),()=>{n.g.removeEventListener("pageshow",e)}}),[]);const y=(0,b.useSelect)((e=>e(d.CART_STORE_KEY).getCartData())),_=(0,p.applyCheckoutFilter)({filterName:"proceedToCheckoutButtonLabel",defaultValue:o||g.G,arg:{cart:y}}),S=(0,p.applyCheckoutFilter)({filterName:"proceedToCheckoutButtonLink",defaultValue:m||l.tn,arg:{cart:y}}),{dispatchOnProceedToCheckout:L}=(0,f.e)(),R=(0,c.createElement)(s.A,{className:"wc-block-cart__submit-button",href:S,disabled:h,onClick:e=>{L().then((t=>{t.some(k.CR)?e.preventDefault():w(!0)}))},showSpinner:E},_),T=(0,a.useMemo)((()=>getComputedStyle(document.body).backgroundColor),[]),A="below"===C,N=(0,r.A)("wc-block-cart__submit-container",{"wc-block-cart__submit-container--sticky":A});return(0,c.createElement)("div",{className:(0,r.A)("wc-block-cart__submit",t)},v,(0,c.createElement)("div",{className:N,style:A?{backgroundColor:T}:{}},R))}))}}]);