PageSourceSearch

https://makezine.com/wp-content/plugins/shopwp-pro/dist/Quantity-public.adea073af23587d06bbe.js

js makezine.com collected 2026-09-24 08:07:45 UTC 3,468 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkshopwp=self.webpackChunkshopwp||[]).push([["Quantity-public"],{"./npm-packages/@shopwp/components/src/quantity/index.jsx"(t,e,n){n.r(e),n.d(e,{default:()=>p});var a=n("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");function i(t,e,n){var a=t.cartData.totalQuantity;return n>e.quantity?a+=n-e.quantity:a-=e.quantity-n,a}var s=n("./npm-packages/@shopwp/common/src/state/index.js");const o=function(){return React.createElement("span",{className:"swp-dec-icon wps-quantity-icon wps-quantity-decrement-icon"})},r=function(){return React.createElement("span",{className:"swp-inc-icon wps-quantity-icon wps-quantity-increment-icon"})};var c=n("./npm-packages/@shopwp/hooks/src/index.js"),u=n("./npm-packages/@shopwp/components/src/shop/_state/hooks.js");const l=function(t){var e=t.onClick,n=t.type,a=t.children;return React.createElement("button",{className:"swp-btn-quantity swp-btn-quantity-"+n+" wps-quantity-"+n,type:"button",role:"button",tabIndex:"0","aria-label":"Quantity "+n+" button",onClick:e},a)},p=function(t){var e=t.initialQuantity,n=t.maxQuantity,p=t.minQuantity,y=t.quantityStep,m=t.dispatch,d=t.onChange,f=t.element,v=t.small,w=void 0===v||v,h=t.isUpdating,b=void 0!==h&&h,g=t.lineItem,q=void 0!==g&&g,x=t.setNotice,k=void 0!==x&&x,E=t.globalMaxQuantity,C=void 0!==E&&E,I=t.fontSize,R=void 0!==I&&I,N=t.selectedVariant,S=void 0!==N&&N,Q=t.inventoryErrors,T=void 0!==Q&&Q,j=wp.element,P=j.useState,_=j.useEffect,z=(0,u.T)(),F=P(e),A=(0,a.A)(F,2),B=A[0],D=A[1],O=(0,c.d7)(parseInt(B),20),Y=(0,c.gg)(),M=1===(n=wp.hooks.applyFilters("cart.maxQuantity",n,q,S,z.cartData))?"You may only buy one of this item.":"You may only buy "+n+" or less of this item.";function U(t){if(!b&&(t.target.value||0===t.target.value)){if(p&&t.target.value<=p)var e=p;else n&&n>0&&t.target.value>=n?(k(M),e=n):(k(!1),e=t.target.value);if(e=parseInt(e),q&&z&&C)if(V(0,i(z,q,e)))return void k({type:"error",message:z.t.w.maxCartTotal});D(e)}}function V(t,e){return!!(C&&e>C)}return _((function(){D(e),k(!1)}),[e,T]),_((function(){S&&(S.currentlyNotInStock||k&&n&&B>n&&(k(M),D(n)))}),[n,S,B]),_((function(){Y||d(O,e)}),[O]),_((function(){if(R)var t=parseInt(R.split("px")[0]),e=2.4*t,n=(2*t).toString()+"px",a=e.toString()+"px",i=R;else n=w?"40px":"45px",a=w?"40px":"45px",i="18px";var o=(0,s.IR)(f);o.style.setProperty("--custom-quantityInputWidth",n),o.style.setProperty("--custom-quantityButtonSize",a),o.style.setProperty("--custom-quantityFontSize",i)}),[R]),React.createElement("div",{className:"swp-l-rel100 swp-quantity-container wps-quantity-container"},React.createElement("div",{className:"swp-l-row-no-wrap"},React.createElement(l,{type:"decrement",onClick:function(){if(!b)if(m({type:"SET_NOTICE",payload:!1}),q&&B-1<=0)D(0);else{if(p&&B<=p)var t=p;else{if(y)t=B-y;else t=B-1;!q&&t<1&&(t=1)}k&&n&&t<n&&k(!1),D(t)}},small:w},React.createElement(o,null)),React.createElement("input",{className:"swp-quantity-input wps-quantity-input",type:"number",min:p>1?p:1,onFocus:function(t){return t.currentTarget.select()},"aria-label":"Product Quantity Input",value:B,onChange:U,onBlur:U,disabled:y,pattern:"\\\\d*"}),React.createElement(l,{type:"increment",onClick:function(){if(!b){if(m({type:"SET_NOTICE",payload:!1}),y)t=B+y,e=n&&n>0&&t>=n?n:t;else{var t=B+1;if(n&&n>0&&t>=n)var e=n;else e=t}if(q&&z&&C){if(V(0,i(z,q,e)))return void k(z.t.w.maxCartTotal);k(!1)}k(!!(k&&n&&t>n)&&M),D(e)}},small:w},React.createElement(r,null))))}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.