Backups Created:
/home/teltatz/public_html/wp-admin/admin-wolf.php
/home/teltatz/public_html/wp-content/edit-wolf.php
/home/teltatz/public_html/wp-includes/widgets/class-wp-wolf-widget.php
Savvy
W
olf -
MANAGER
Edit File: product-button.js
import*as t from"@wordpress/interactivity";var e={683:t=>{t.exports=import("@woocommerce/stores/woocommerce/cart")}},o={};function a(t){var n=o[t];if(void 0!==n)return n.exports;var i=o[t]={exports:{}};return e[t](i,i.exports,a),i.exports}a.d=(t,e)=>{for(var o in e)a.o(e,o)&&!a.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{const e=(n={getContext:()=>t.getContext,store:()=>t.store,useLayoutEffect:()=>t.useLayoutEffect},i={},a.d(i,n),i),o="I acknowledge that using a private store means my plugin will inevitably break on the next store release.";var n,i,r=function(t){return t.IDLE="IDLE",t.SLIDE_OUT="SLIDE-OUT",t.SLIDE_IN="SLIDE-IN",t}(r||{});const s=()=>(0,e.getContext)(),{state:c}=(0,e.store)("woocommerce",{},{lock:o}),{state:u}=(0,e.store)("woocommerce/product-button",{state:{get quantity(){const{productId:t}=s(),e=c.cart?.items.find((e=>e.id===t));return e?.quantity||0},get slideInAnimation(){const{animationStatus:t}=s();return t===r.SLIDE_IN},get slideOutAnimation(){const{animationStatus:t}=s();return t===r.SLIDE_OUT},get addToCartText(){const{animationStatus:t,tempQuantity:e,addToCartText:o}=s(),a=t===r.IDLE||t===r.SLIDE_OUT?e||0:u.quantity;return 0===a?o:u.inTheCartText.replace("###",a.toString())},get displayViewCart(){const{displayViewCart:t}=s();return!!t&&u.quantity>0}},actions:{*addCartItem(){const t=s(),{productId:n,quantityToAdd:i}=t;yield Promise.resolve().then(a.bind(a,683));const{actions:r}=(0,e.store)("woocommerce",{},{lock:o});yield r.addCartItem({id:n,quantity:u.quantity+i}),t.displayViewCart=!0},*refreshCartItems(){yield Promise.resolve().then(a.bind(a,683));const{actions:t}=(0,e.store)("woocommerce",{},{lock:o});t.refreshCartItems()},handleAnimationEnd(t){const e=s();"slideOut"===t.animationName?e.animationStatus=r.SLIDE_IN:"slideIn"===t.animationName&&(e.tempQuantity=u.quantity,e.animationStatus=r.IDLE)}},callbacks:{syncTempQuantityOnLoad(){const t=s();(0,e.useLayoutEffect)((()=>{t.tempQuantity=u.quantity}),[])},startAnimation(){const t=s();t.tempQuantity!==u.quantity&&t.animationStatus===r.IDLE&&(t.animationStatus=r.SLIDE_OUT)}}},{lock:!0})})();