OwlCyberSecurity - MANAGER
Edit File: product-button.js
(self.webpackChunkwebpackWcBlocksMainJsonp=self.webpackChunkwebpackWcBlocksMainJsonp||[]).push([[7409],{1526:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Block:()=>b,default:()=>y});var o=r(1609),n=r(851),s=r(7723),a=r(9499),c=r(1183),i=r(2150),l=r(8537),d=r(2516),u=r(5703),p=r(2796),m=r(1616);r(1546);const _=({product:e,className:t,style:r})=>{const{id:i,permalink:p,add_to_cart:m,has_options:_,is_purchasable:v,is_in_stock:b}=e,{dispatchStoreEvent:y}=(0,a.y)(),{cartQuantity:g,addingToCart:h,addToCart:w}=(0,c.R)(i),f=Number.isFinite(g)&&g>0,C=!_&&v&&b,S=(0,l.decodeEntities)((null==m?void 0:m.description)||""),E=f?(0,s.sprintf)(/* translators: %s number of products in cart. */ /* translators: %s number of products in cart. */ (0,s._n)("%d in cart","%d in cart",g,"woocommerce"),g):(0,l.decodeEntities)((null==m?void 0:m.text)||(0,s.__)("Add to cart","woocommerce")),k=C?"button":"a",T={};return C?T.onClick=async()=>{await w(),y("cart-add-item",{product:e});const{cartRedirectAfterAdd:t}=(0,u.getSetting)("productsSettings");t&&(window.location.href=d.Vo)}:(T.href=p,T.rel="nofollow",T.onClick=()=>{y("product-view-link",{product:e})}),(0,o.createElement)(k,{...T,"aria-label":S,disabled:h,className:(0,n.A)(t,"wp-block-button__link","wp-element-button","add_to_cart_button","wc-block-components-product-button__button",{loading:h,added:f}),style:r},E)},v=({className:e,style:t,isLoading:r})=>(0,o.createElement)("button",{className:(0,n.A)("wp-block-button__link","wp-element-button","add_to_cart_button","wc-block-components-product-button__button",{"wc-block-components-product-button__button--placeholder":r},e),style:t,disabled:!0},(0,s.__)("Add to cart","woocommerce")),b=e=>{const{className:t,textAlign:r}=e,s=(0,i.p)(e),{parentClassName:a}=(0,p.useInnerBlockLayoutContext)(),{isLoading:c,product:l}=(0,p.useProductDataContext)();return(0,o.createElement)("div",{className:(0,n.A)(t,"wp-block-button","wc-block-components-product-button",{[`${a}__product-add-to-cart`]:a,[`align-${r}`]:r})},l.id?(0,o.createElement)(_,{product:l,style:s.style,className:s.className}):(0,o.createElement)(v,{style:s.style,className:s.className,isLoading:c}))},y=(0,m.withProductDataContext)(b)},7057:(e,t,r)=>{"use strict";r.d(t,{A:()=>c});var o=r(7723),n=r(3993),s=r(2516);const a=Object.entries(s.iI).reduce(((e,[t,r])=>(e[t]=Object.entries(r).reduce(((e,[t,r])=>(e[t]=(e=>{const t={};return void 0!==e.label&&(t.label=e.label),void 0!==e.required&&(t.required=e.required),void 0!==e.hidden&&(t.hidden=e.hidden),void 0===e.label||e.optionalLabel||(t.optionalLabel=(0,o.sprintf)(/* translators: %s Field label. */ /* translators: %s Field label. */ (0,o.__)("%s (optional)","woocommerce"),e.label)),e.index&&((0,n.isNumber)(e.index)&&(t.index=e.index),(0,n.isString)(e.index)&&(t.index=parseInt(e.index,10))),e.hidden&&(t.required=!1),t})(r),e)),{}),e)),{}),c=(e,t,r="")=>{const o=r&&void 0!==a[r]?a[r]:{};return e.map((e=>({key:e,...t[e]||{},...o[e]||{}}))).sort(((e,t)=>e.index-t.index))}},52:(e,t,r)=>{"use strict";r.d(t,{U:()=>u});var o=r(6087),n=r(7594),s=r(7143),a=r(6367),c=r(7428);const i=e=>{const t=null==e?void 0:e.detail;t&&t.preserveCartData||(0,s.dispatch)(n.cartStore).invalidateResolutionForStore()},l=e=>{(null!=e&&e.persisted||"back_forward"===(0,a.F)())&&(0,s.dispatch)(n.cartStore).invalidateResolutionForStore()},d=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},u=()=>{(0,o.useEffect)((()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),(null===(e=window.wcBlocksStoreCartListeners)||void 0===e?void 0:e.count)>0)return void window.wcBlocksStoreCartListeners.count++;var e;document.body.addEventListener("wc-blocks_added_to_cart",i),document.body.addEventListener("wc-blocks_removed_from_cart",i),window.addEventListener("pageshow",l);const t=(0,c.f2)("added_to_cart","wc-blocks_added_to_cart"),r=(0,c.f2)("removed_from_cart","wc-blocks_removed_from_cart");window.wcBlocksStoreCartListeners.count=1,window.wcBlocksStoreCartListeners.remove=()=>{document.body.removeEventListener("wc-blocks_added_to_cart",i),document.body.removeEventListener("wc-blocks_removed_from_cart",i),window.removeEventListener("pageshow",l),t(),r()}})(),d)),[])}},8645:(e,t,r)=>{"use strict";r.d(t,{V:()=>y});var o=r(458),n=r.n(o),s=r(6087),a=r(7594),c=r(7143),i=r(8537),l=r(3643),d=r(1759),u=r(52);const p={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},m={...p,email:""},_={total_items:"",total_items_tax:"",total_fees:"",total_fees_tax:"",total_discount:"",total_discount_tax:"",total_shipping:"",total_shipping_tax:"",total_price:"",total_tax:"",tax_lines:a.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},v=e=>Object.fromEntries(Object.entries(e).map((([e,t])=>[e,(0,i.decodeEntities)(t)]))),b={cartCoupons:a.EMPTY_CART_COUPONS,cartItems:a.EMPTY_CART_ITEMS,cartFees:a.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,crossSellsProducts:a.EMPTY_CART_CROSS_SELLS,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:a.EMPTY_CART_ITEM_ERRORS,cartTotals:_,cartIsLoading:!0,cartErrors:a.EMPTY_CART_ERRORS,billingData:m,billingAddress:m,shippingAddress:p,shippingRates:a.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentMethods:a.EMPTY_PAYMENT_METHODS,paymentRequirements:a.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},receiveCartContents:()=>{},extensions:a.EMPTY_EXTENSIONS},y=(e={shouldSelect:!0})=>{const{shouldSelect:t}=e,{isEditor:r,previewData:o}=(0,d.m)(),i=null==o?void 0:o.previewCart,_=(0,s.useRef)(),y=(0,s.useRef)(m),g=(0,s.useRef)(p);(0,u.U)();const h=(0,c.useSelect)(((e,{dispatch:o})=>{if(!t)return b;if(r)return{...b,cartCoupons:i.coupons,cartItems:i.items,crossSellsProducts:i.cross_sells,cartFees:i.fees,cartItemsCount:i.items_count,cartItemsWeight:i.items_weight,cartNeedsPayment:i.needs_payment,cartNeedsShipping:i.needs_shipping,cartTotals:i.totals,shippingRates:i.shipping_rates,cartHasCalculatedShipping:i.has_calculated_shipping,paymentMethods:i.payment_methods,paymentRequirements:i.payment_requirements,cartIsLoading:!1,receiveCart:"function"==typeof(null==i?void 0:i.receiveCart)?i.receiveCart:()=>{},receiveCartContents:"function"==typeof(null==i?void 0:i.receiveCartContents)?i.receiveCartContents:()=>{}};const s=e(a.cartStore),c=s.getCartData(),d=s.getCartErrors(),u=s.getCartTotals(),p=!s.hasFinishedResolution("getCartData"),m=s.isCustomerDataUpdating(),{receiveCart:_,receiveCartContents:h}=o(a.cartStore),w=c.fees.length>0?c.fees.map((e=>v(e))):a.EMPTY_CART_FEES,f=c.coupons.length>0?c.coupons.map((e=>({...e,label:e.code}))):a.EMPTY_CART_COUPONS,C=(0,l.TU)(v(c.billingAddress)),S=c.needsShipping?(0,l.TU)(v(c.shippingAddress)):C;return n()(C,y.current)||(y.current=C),n()(S,g.current)||(g.current=S),{cartCoupons:f,cartItems:c.items,crossSellsProducts:c.crossSells,cartFees:w,cartItemsCount:c.itemsCount,cartItemsWeight:c.itemsWeight,cartNeedsPayment:c.needsPayment,cartNeedsShipping:c.needsShipping,cartItemErrors:c.errors,cartTotals:u,cartIsLoading:p,cartErrors:d,billingData:y.current,billingAddress:y.current,shippingAddress:g.current,extensions:c.extensions,shippingRates:c.shippingRates,isLoadingRates:m,cartHasCalculatedShipping:c.hasCalculatedShipping,paymentRequirements:c.paymentRequirements,receiveCart:_,receiveCartContents:h}}),[t,r]);return _.current&&n()(_.current,h)||(_.current=h),_.current}},1183:(e,t,r)=>{"use strict";r.d(t,{R:()=>l});var o=r(6087),n=r(7143),s=r(7594),a=r(8537),c=r(8645);const i=(e,t)=>{const r=e.find((({id:e})=>e===t));return r?r.quantity:0},l=e=>{const{addItemToCart:t}=(0,n.useDispatch)(s.cartStore),{cartItems:r,cartIsLoading:l}=(0,c.V)(),{createErrorNotice:d,removeNotice:u}=(0,n.useDispatch)("core/notices"),[p,m]=(0,o.useState)(!1),_=(0,o.useRef)(i(r,e));return(0,o.useEffect)((()=>{const t=i(r,e);t!==_.current&&(_.current=t)}),[r,e]),{cartQuantity:Number.isFinite(_.current)?_.current:0,addingToCart:p,cartIsLoading:l,addToCart:(r=1)=>(m(!0),t(e,r).then((()=>{u("add-to-cart")})).catch((e=>{d((0,a.decodeEntities)(e.message),{id:"add-to-cart",context:"wc/all-products",isDismissible:!0})})).finally((()=>{m(!1)})))}}},9499:(e,t,r)=>{"use strict";r.d(t,{y:()=>a});var o=r(2619),n=r(7143),s=r(6087);const a=()=>({dispatchStoreEvent:(0,s.useCallback)(((e,t={})=>{try{(0,o.doAction)(`experimental__woocommerce_blocks-${e}`,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:(0,s.useCallback)(((e,t={})=>{try{(0,o.doAction)(`experimental__woocommerce_blocks-checkout-${e}`,{...t,storeCart:(0,n.select)("wc/store/cart").getCartData()})}catch(e){console.error(e)}}),[])})},1759:(e,t,r)=>{"use strict";r.d(t,{m:()=>s}),r(1609);var o=r(6087);r(7143);const n=(0,o.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>({})}),s=()=>(0,o.useContext)(n)},2150:(e,t,r)=>{"use strict";r.d(t,{p:()=>c});var o=r(851),n=r(3993),s=r(3924),a=r(104);const c=e=>{const t=(e=>{const t=(0,n.isObject)(e)?e:{style:{}};let r=t.style;return(0,n.isString)(r)&&(r=JSON.parse(r)||{}),(0,n.isObject)(r)||(r={}),{...t,style:r}})(e),r=(0,a.BK)(t),c=(0,a.aR)(t),i=(0,a.fo)(t),l=(0,s.x)(t);return{className:(0,o.A)(l.className,r.className,c.className,i.className),style:{...l.style,...r.style,...c.style,...i.style}}}},3924:(e,t,r)=>{"use strict";r.d(t,{x:()=>n});var o=r(3993);const n=e=>{const t=(0,o.isObject)(e.style.typography)?e.style.typography:{},r=(0,o.isString)(t.fontFamily)?t.fontFamily:"";return{className:e.fontFamily?`has-${e.fontFamily}-font-family`:r,style:{fontSize:e.fontSize?`var(--wp--preset--font-size--${e.fontSize})`:t.fontSize,fontStyle:t.fontStyle,fontWeight:t.fontWeight,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,textDecoration:t.textDecoration,textTransform:t.textTransform}}}},3643:(e,t,r)=>{"use strict";r.d(t,{TU:()=>a});var o=r(7057),n=(r(3832),r(3993),r(5703)),s=(r(8537),r(2516));const a=e=>{const t=(0,o.A)(s.Hw,n.defaultFields,e.country),r=Object.assign({},e);return t.forEach((({key:t,hidden:o})=>{o&&((e,t)=>e in t)(t,e)&&(r[t]="")})),r}},104:(e,t,r)=>{"use strict";r.d(t,{BK:()=>l,aR:()=>d,fo:()=>u});var o=r(851),n=r(1194),s=r(9786),a=r(3993);function c(e={}){const t={};return(0,s.getCSSRules)(e,{selector:""}).forEach((e=>{t[e.key]=e.value})),t}function i(e,t){return e&&t?`has-${(0,n.c)(t)}-${e}`:""}function l(e){var t,r,n,s,l,d;const{backgroundColor:u,textColor:p,gradient:m,style:_}=e,v=i("background-color",u),b=i("color",p),y=function(e){if(e)return`has-${e}-gradient-background`}(m),g=y||(null==_||null===(t=_.color)||void 0===t?void 0:t.gradient);return{className:(0,o.A)(b,y,{[v]:!g&&!!v,"has-text-color":p||(null==_||null===(r=_.color)||void 0===r?void 0:r.text),"has-background":u||(null==_||null===(n=_.color)||void 0===n?void 0:n.background)||m||(null==_||null===(s=_.color)||void 0===s?void 0:s.gradient),"has-link-color":(0,a.isObject)(null==_||null===(l=_.elements)||void 0===l?void 0:l.link)?null==_||null===(d=_.elements)||void 0===d||null===(d=d.link)||void 0===d?void 0:d.color:void 0}),style:c({color:(null==_?void 0:_.color)||{}})}}function d(e){var t;const r=(null===(t=e.style)||void 0===t?void 0:t.border)||{};return{className:function(e){var t;const{borderColor:r,style:n}=e,s=r?i("border-color",r):"";return(0,o.A)({"has-border-color":!!r||!(null==n||null===(t=n.border)||void 0===t||!t.color),[s]:!!s})}(e),style:c({border:r})}}function u(e){var t;return{className:void 0,style:c({spacing:(null===(t=e.style)||void 0===t?void 0:t.spacing)||{}})}}},6367:(e,t,r)=>{"use strict";r.d(t,{F:()=>o});const o=()=>window.performance&&window.performance.getEntriesByType("navigation").length?window.performance.getEntriesByType("navigation")[0].type:""},7428:(e,t,r)=>{"use strict";r.d(t,{f2:()=>n});const o=window.CustomEvent||null,n=(e,t,r=!1,n=!1)=>{if("function"!=typeof jQuery)return()=>{};const s=()=>{((e,{bubbles:t=!1,cancelable:r=!1,element:n,detail:s={}})=>{if(!o)return;n||(n=document.body);const a=new o(e,{bubbles:t,cancelable:r,detail:s});n.dispatchEvent(a)})(t,{bubbles:r,cancelable:n})};return jQuery(document).on(e,s),()=>jQuery(document).off(e,s)}},1546:()=>{}}]);