geno/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/cart-blocks/proceed-to-checkout-frontend.js

1 line
22 KiB
JavaScript
Raw Permalink Normal View History

2024-02-01 17:24:18 +05:30
(self.webpackChunkwebpackWcBlocksJsonp=self.webpackChunkwebpackWcBlocksJsonp||[]).push([[1084],{4877:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(9196),o=n(9685),i=n(4184),s=n.n(i),c=(n(5482),n(4705));const l=({className:e,showSpinner:t=!1,children:n,variant:i="contained",...l})=>{const a=s()("wc-block-components-button","wp-element-button",e,i,{"wc-block-components-button--loading":t});return(0,r.createElement)(o.Z,{className:a,...l},t&&(0,r.createElement)(c.Z,null),(0,r.createElement)("span",{className:"wc-block-components-button__text"},n))}},6654:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>w});var r=n(721),o=n(9196),i=n(4184),s=n.n(i),c=n(9307),l=n(4877),a=n(5271);const u={bottom:0,left:0,opacity:0,pointerEvents:"none",position:"absolute",right:0,top:0,zIndex:-1};var d=n(4617),p=n(9818),m=n(4801),f=n(3554),h=n(6423),g=n(3691);const v=(0,n(5736).__)("Proceed to Checkout","woocommerce"),b={checkoutPageId:{type:"number",default:0},lock:{type:"object",default:{move:!0,remove:!0}},buttonLabel:{type:"string",default:v}},w=(0,r.withFilteredAttributes)(b)((({checkoutPageId:e,className:t,buttonLabel:r})=>{const i=(0,d.getSetting)("page-"+e,!1),b=(0,p.useSelect)((e=>e(m.CHECKOUT_STORE_KEY).isCalculating())),[w,E]=(()=>{const[e,t]=(0,c.useState)(""),n=(0,c.useRef)(null),r=(0,c.useRef)(new IntersectionObserver((e=>{e[0].isIntersecting?t("visible"):t(e[0].boundingClientRect.top>0?"below":"above")}),{threshold:1}));return(0,c.useLayoutEffect)((()=>{const e=n.current,t=r.current;return e&&t.observe(e),()=>{t.unobserve(e)}}),[]),[(0,o.createElement)("div",{"aria-hidden":!0,ref:n,style:u}),e]})(),[y,C]=(0,c.useState)(!1);(0,c.useEffect)((()=>{if("function"!=typeof n.g.addEventListener||"function"!=typeof n.g.removeEventListener)return;const e=()=>{C(!1)};return n.g.addEventListener("pageshow",e),()=>{n.g.removeEventListener("pageshow",e)}}),[]);const S=(0,p.useSelect)((e=>e(m.CART_STORE_KEY).getCartData())),k=(0,f.applyCheckoutFilter)({filterName:"proceedToCheckoutButtonLabel",defaultValue:r||v,arg:{cart:S}}),Z=(0,f.applyCheckoutFilter)({filterName:"proceedToCheckoutButtonLink",defaultValue:i||a.sE,arg:{cart:S}}),{dispatchOnProceedToCheckout:L}=(0,g.b)(),_=(0,o.createElement)(l.Z,{className:"wc-block-cart__submit-button",href:Z,disabled:b,onClick:e=>{L().then((t=>{t.some(h.qm)?e.preventDefault():C(!0)}))},showSpinner:y},k),R=(0,c.useMemo)((()=>getComputedStyle(document.body).backgroundColor),[]);return(0,o.createElement)("div",{className:s()("wc-block-cart__submit",t)},w,(0,o.createElement)("div",{className:"wc-block-cart__submit-container"},_),"below"===E&&(0,o.createElement)("div",{className:"wc-block-cart__submit-container wc-block-cart__submit-container--sticky",style:{backgroundColor:R}},_))}))},4705:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(9196);n(129);const o=()=>(0,r.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})},5482:()=>{},129:()=>{},2444:(e,t,n)=>{"use strict";n.d(t,{T:()=>s});var r=n(4184),o=n.n(r);function i(e){return"appear"===e?"top":"left"}function s(e){if("loading"===e.type)return o()("components-animate__loading");const{type:t,origin:n=i(t)}=e;if("appear"===t){const[e,t="center"]=n.split(" ");return o()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?o()("components-animate__slide-in","is-from-"+n):void 0}},9685:(e,t,n)=>{"use strict";n.d(t,{Z:()=>f});var r=n(7462),o=n(9307),i=n(4184),s=n.n(i),c=n(2819),l=n(7180),a=n.n(l),u=n(9178),d=n(7392),p=n(7593);const m=["onMouseDown","onClick"],f=(0,o.forwardRef)((function(e,t){const{href:n,target:i,isSmall:l,isPressed:f,isBusy:h,isDestructive:g,className:v,disabled:b,icon:w,iconPosition:E="left",iconSize:y,showTooltip:C,tooltipPosition:S,shortcut:k,label:Z,children:L,text:_,variant:R,__experimentalIsFocusable:F,describedBy:x,...N}=function({isDefault:e,isPrimary:t,isSecondary:n,isTertiary:r,isLink:o,variant:i,...s}){let c=i;var l,u,d,p,m;return t&&(null!==(l=c)&&void 0!==l||(c="primary")),r&&(null!==(u=c)&&void 0!==u||(c="tertiary")),n&&(null!==(d=c)&&void 0!=