File "button.js"

Full Path: /home/vantageo/public_html/cache/cache/cache/cache/cache/cache/.wp-cli/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/atomic-block-components/add-to-cart--atomic-block-components/button.js
File size: 6.29 KB
MIME-type: text/plain
Charset: utf-8

(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[3],{177:function(e,t,n){"use strict";n.d(t,"b",(function(){return y})),n.d(t,"a",(function(){return E}));var c=n(4),r=n.n(c),o=n(13),i=n.n(o),a=n(0),s=(n(2),n(21)),u=n(85),f=n(75),l=n(10),d=n.n(l),b=n(7),v=n.n(b),O=n(936),p=(n(224),function(e){var t=e.status;switch(void 0===t?"default":t){case"error":return"woocommerce-error";case"success":return"woocommerce-success";case"info":case"warning":return"woocommerce-info"}return""}),m=function(e){var t=e.className,n=e.notices,c=e.removeNotice,r=n.filter((function(e){return"snackbar"!==e.type}));if(!r.length)return null;var o=v()(t,"wc-block-components-notices");return Object(a.createElement)("div",{className:o},r.map((function(e){return Object(a.createElement)(O.a,d()({key:"store-notice-"+e.id},e,{className:v()("wc-block-components-notices__notice","woocommerce-message",p(e)),onRemove:function(){e.isDismissible&&c(e.id)}}),e.content)})))},j=n(941),g=function(e){var t=e.className,n=e.notices,c=e.removeNotice;if(e.isEditor)return null;var r=n.filter((function(e){return"snackbar"===e.type})),o=v()(t,"wc-block-components-notices__snackbar");return Object(a.createElement)(j.a,{notices:r,className:o,onRemove:c})};function N(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);t&&(c=c.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,c)}return n}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?N(Object(n),!0).forEach((function(t){r()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var w=Object(a.createContext)({notices:[],createNotice:function(e,t,n){},createSnackbarNotice:function(e,t){},removeNotice:function(e,t){},setIsSuppressed:function(e){},context:"wc/core"}),y=function(){return Object(a.useContext)(w)},E=function(e){var t=e.children,n=e.className,c=void 0===n?"":n,r=e.createNoticeContainer,o=void 0===r||r,l=e.context,d=void 0===l?"wc/core":l,b=Object(s.useDispatch)("core/notices"),v=b.createNotice,O=b.removeNotice,p=Object(a.useState)(!1),j=i()(p,2),N=j[0],y=j[1],E=Object(u.a)().dispatchStoreEvent,k=Object(f.b)().isEditor,S=Object(a.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};v(e,t,h(h({},n),{},{context:n.context||d})),E("store-notice-create",{status:e,content:t,options:n})}),[v,E,d]),P=Object(a.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d;O(e,t)}),[O,d]),D=Object(a.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};S("default",e,h(h({},t),{},{type:"snackbar"}))}),[S]),C={notices:Object(s.useSelect)((function(e){return{notices:e("core/notices").getNotices(d)}}),[d]).notices,createNotice:S,createSnackbarNotice:D,removeNotice:P,context:d,setIsSuppressed:y},I=N?null:Object(a.createElement)(m,{className:c,notices:C.notices,removeNotice:C.removeNotice,isEditor:k}),x=N?null:Object(a.createElement)(g,{notices:C.notices,removeNotice:C.removeNotice,isEditor:k});return Object(a.createElement)(w.Provider,{value:C},o&&I,t,x)}},224:function(e,t){},62:function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var c=n(4),r=n.n(c),o=n(0),i=n(177);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);t&&(c=c.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,c)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){r()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var u=function(){var e=Object(i.b)(),t=e.notices,n=e.createNotice,c=e.removeNotice,r=e.createSnackbarNotice,a=e.setIsSuppressed,u=Object(o.useRef)(t);Object(o.useEffect)((function(){u.current=t}),[t]);var f=Object(o.useMemo)((function(){return{hasNoticesOfType:function(e){return u.current.some((function(t){return t.type===e}))},removeNotices:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;u.current.forEach((function(t){null!==e&&t.status!==e||c(t.id)}))},removeNotice:c}}),[c]),l=Object(o.useMemo)((function(){return{addDefaultNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("default",e,s({},t))},addErrorNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("error",e,s({},t))},addWarningNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("warning",e,s({},t))},addInfoNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("info",e,s({},t))},addSuccessNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("success",e,s({},t))},addSnackbarNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r(e,t)}}}),[n,r]);return s(s(s({notices:t},f),l),{},{setIsSuppressed:a})}},846:function(e,t,n){"use strict";n.d(t,"a",(function(){return d}));var c=n(13),r=n.n(c),o=n(0),i=n(21),a=n(36),s=n(26),u=n(51),f=n(62),l=function(e,t){var n=e.find((function(e){return e.id===t}));return n?n.quantity:0},d=function(e){var t=Object(i.useDispatch)(a.CART_STORE_KEY).addItemToCart,n=Object(u.a)(),c=n.cartItems,d=n.cartIsLoading,b=Object(f.a)(),v=b.addErrorNotice,O=b.removeNotice,p=Object(o.useState)(!1),m=r()(p,2),j=m[0],g=m[1],N=Object(o.useRef)(l(c,e));return Object(o.useEffect)((function(){var t=l(c,e);t!==N.current&&(N.current=t)}),[c,e]),{cartQuantity:Number.isFinite(N.current)?N.current:0,addingToCart:j,cartIsLoading:d,addToCart:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return g(!0),t(e,n).then((function(){O("add-to-cart")})).catch((function(e){v(Object(s.decodeEntities)(e.message),{context:"wc/all-products",id:"add-to-cart",isDismissible:!0})})).finally((function(){g(!1)}))}}}}}]);