auto-patch 81-dev-dev01-2023-12-05T22_45_26 * auto-patch 81-dev-dev01-2023-12-05T22_45_26
1 line
2.1 KiB
JavaScript
1 line
2.1 KiB
JavaScript
"use strict";(self.webpackChunkwebpackWcBlocksJsonp=self.webpackChunkwebpackWcBlocksJsonp||[]).push([[1084],{25439:(e,t,c)=>{c.r(t),c.d(t,{default:()=>h});var n=c(80721),o=c(69307),r=c(89814),a=c.n(r),s=c(34877),l=c(75271);const u={bottom:0,left:0,opacity:0,pointerEvents:"none",position:"absolute",right:0,top:0,zIndex:-1};var i=c(74617),b=c(9818),d=c(94801),p=c(33554),m=c(66423),k=c(8790),f=c(61092);var g=c(72265);const h=(0,n.withFilteredAttributes)(g.Z)((({checkoutPageId:e,className:t,buttonLabel:n})=>{const r=(0,i.getSetting)("page-"+e,!1),g=(0,b.useSelect)((e=>e(d.CHECKOUT_STORE_KEY).isCalculating())),[h,v]=(()=>{const[e,t]=(0,o.useState)(""),c=(0,o.useRef)(null),n=(0,o.useRef)(new IntersectionObserver((e=>{e[0].isIntersecting?t("visible"):t(e[0].boundingClientRect.top>0?"below":"above")}),{threshold:1}));return(0,o.useLayoutEffect)((()=>{const e=c.current,t=n.current;return e&&t.observe(e),()=>{t.unobserve(e)}}),[]),[(0,o.createElement)("div",{"aria-hidden":!0,ref:c,style:u}),e]})(),[E,C]=(0,o.useState)(!1);(0,o.useEffect)((()=>{if("function"!=typeof c.g.addEventListener||"function"!=typeof c.g.removeEventListener)return;const e=()=>{C(!1)};return c.g.addEventListener("pageshow",e),()=>{c.g.removeEventListener("pageshow",e)}}),[]);const w=(0,b.useSelect)((e=>e(d.CART_STORE_KEY).getCartData())),_=(0,p.applyCheckoutFilter)({filterName:"proceedToCheckoutButtonLabel",defaultValue:n||f.B,arg:{cart:w}}),y=(0,p.applyCheckoutFilter)({filterName:"proceedToCheckoutButtonLink",defaultValue:r||l.sE,arg:{cart:w}}),{dispatchOnProceedToCheckout:S}=(0,k.b)(),L=(0,o.createElement)(s.Z,{className:"wc-block-cart__submit-button",href:y,disabled:g,onClick:e=>{S().then((t=>{t.some(m.qm)?e.preventDefault():C(!0)}))},showSpinner:E},_),N=(0,o.useMemo)((()=>getComputedStyle(document.body).backgroundColor),[]);return(0,o.createElement)("div",{className:a()("wc-block-cart__submit",t)},h,(0,o.createElement)("div",{className:"wc-block-cart__submit-container"},L),"below"===v&&(0,o.createElement)("div",{className:"wc-block-cart__submit-container wc-block-cart__submit-container--sticky",style:{backgroundColor:N}},L))}))}}]); |