PageSourceSearch

https://www.wearpepper.com/cdn/shop/t/870/assets/cart.js?v=44886642808268609551790784184

js wearpepper.com collected 2026-10-02 16:27:25 UTC 18,435 bytes, 1 lines download raw bytes

1class CartRemoveButton extends HTMLElement{constructor(){super(),this.addEventListener("click",(t=>{t.preventDefault();const e=document.querySelector("cart-drawer-items"),r=this.dataset.index.split(",");e.updateQuantity(r,0)}))}}customElements.define("cart-remove-button",CartRemoveButton);class CartItems extends HTMLElement{constructor(){super(),this.lineItemStatusElement=document.getElementById("shopping-cart-line-item-status")||document.getElementById("CartDrawer-LineItemStatus");const t=debounce((t=>{this.onChange(t)}),ON_CHANGE_DEBOUNCE_TIMER);this.addEventListener("change",t.bind(this)),this.updateProgressBar()}cartUpdateUnsubscriber=void 0;connectedCallback(){this.cartUpdateUnsubscriber=subscribe(PUB_SUB_EVENTS.cartUpdate,(t=>{"cart-items"!==t.source&&this.onCartUpdate()}))}disconnectedCallback(){this.cartUpdateUnsubscriber&&this.cartUpdateUnsubscriber()}onChange(t){if("select-one"===t.target.type)return;const e=t.target.dataset.index.split(",");this.updateQuantity(e,t.target.value,document.activeElement.getAttribute("name"),t.target.dataset.quantityVariantId)}onCartUpdate(){const t=document?.querySelector("gift-purchase");fetch(`${routes.cart_url}?section_id=cart-drawer`).then((t=>t.text())).then((e=>{const r=(new DOMParser).parseFromString(e,"text/html"),s=["cart-drawer-items",".cart-drawer__footer"];for(const t of s){const e=document.querySelector(t),s=r.querySelector(t);e&&s&&e.replaceWith(s)}window.loyaltylion?.ui?.refresh?.(),t&&t.giftPurchaseApplyUTMRules()})).catch((t=>{console.error(t)}))}updateProgressBar(t=!1){const e=document.querySelector("cart-drawer").querySelector(".drawer__progress-bar .js");t&&(e.innerText=e.dataset.calculation);let r=!0;"undefined"!=typeof intelligemsSuppressAfterInteraction&&intelligemsSuppressAfterInteraction&&"true"==sessionStorage.getItem("closeAllUpsellsAfterInteraction")&&(this.removeAllOpenUpsells(),r=!1),"undefined"!=typeof intelligemsRemoveAllUpsells&&intelligemsRemoveAllUpsells&&(this.removeAllOpenUpsells(),r=!1),"undefined"!=typeof intelligemsKeepOnlyCertainTypes&&intelligemsKeepOnlyCertainTypes&&intelligemsKeepOnlyCertainTypes.length>0&&(this.removeAllOpenUpsells(intelligemsKeepOnlyCertainTypes),r=!1),1==r&&this.removeCertainOpenUpsells()}updateQuantity(t,e,r,s){const n=t[0];this.enableLoading(t);const a={url:t.length>1?routes.cart_update_url:routes.cart_change_url,data:t.length>1?{updates:t.reduce(((t,r)=>({...t,[r]:e})),{})}:{line:n,quantity:e}},{url:i,data:o}=a,c=JSON.stringify({...o,sections:this.getSectionsToRender().map((t=>t.section)),sections_url:window.location.pathname});fetch(`${i}`,{...fetchConfig(),body:c}).then((t=>t.text())).then((a=>{const i=JSON.parse(a),o=document.getElementById(`Quantity-${s}`)||document.getElementById(`Drawer-quantity-${s}`);if(i.errors)return o.value=o.getAttribute("value"),void this.updateLiveRegions(t,i.errors);this.classList.toggle("is-empty",0===i.item_count),document.querySelector("cart-drawer .drawer__progress-bar")?.classList.toggle("is-empty",0===i.item_count);const c=document.querySelector("cart-drawer"),l=document.getElementById("main-cart-footer");l&&l.classList.toggle("is-empty",0===i.item_count),c&&c.classList.toggle("is-empty",0===i.item_count),this.getSectionsToRender().forEach((t=>{if(!1===t?.validate?.(e))return;(document.getElementById(t.id).querySelector(t.selector)||document.getElementById(t.id)).innerHTML=this.getSectionInnerHTML(i.sections[t.section],t.selector)}));const d=i.items.length?i.items.filter((e=>t.some((t=>t===e.key)))).map((t=>t.quantity)):[],u=d.length&&1===new Set(d).size&&d[0]===parseInt(o.value);let m="";!1===u&&(m=void 0===u?window.cartStrings.error:window.cartStrings.quantityError.replace("[quantity]",u)),this.updateLiveRegions(t,m);const p=document.getElementById(`CartItem-${n}`)||document.getElementById(`CartDrawer-Item-${n}`);p&&p.querySelector(`[name="${r}"]`)?c?trapFocus(c,p.querySelector(`[name="${r}"]`)):p.querySelector(`[name="${r}"]`).focus():0===i.item_count&&c?trapFocus(c.querySelector(".drawer__inner-empty"),c.querySelector("a")):document.querySelector(".cart-item")&&c&&trapFocus(c,document.querySelector(".cart-item__name")),publish(PUB_SUB_EVENTS.cartUpdate,{source:"cart-items",cartData:i,variantId:t})})).catch((t=>{console.log(t),this.querySelectorAll(".loading-overlay").forEach((t=>t.classList.add("hidden")));(document.getElementById("cart-errors")||document.getElementById("CartDrawer-CartErrors")).textContent=window.cartStrings.error})).finally((()=>{this.disableLoading(t);const e=document?.querySelector("gift-purchase");e&&e.giftPurchaseApplyUTMRules()}))}updateLiveRegions(t,e){const r=document.getElementById(`Line-item-error-${t}`)||document.getElementById(`CartDrawer-LineItemError-${t}`);r&&(r.querySelector(".cart-item__error-text").innerHTML=e),this.lineItemStatusElement.setAttribute("aria-hidden",!0);const s=document.getElementById("cart-live-region-text")||document.getElementById("CartDrawer-LiveRegionText");s.setAttribute("aria-hidden",!1),setTimeout((()=>{s.setAttribute("aria-hidden",!0)}),1e3)}getSectionInnerHTML(t,e){return(new DOMParser).parseFromString(t,"text/html").querySelector(e).innerHTML}enableLoading(t){(document.getElementById("main-cart-items")||document.getElementById("CartDrawer-CartItems")).classList.add("cart__items--disabled");this.querySelectorAll(t.map((t=>`[id="CartDrawer-Item-${t}
1"]`)).join(",")).forEach((t=>t.classList.add("loading"))),document.activeElement.blur(),this.lineItemStatusElement.setAttribute("aria-hidden",!1),this.updateProgressBar(!0)}disableLoading(t){(document.getElementById("main-cart-items")||document.getElementById("CartDrawer-CartItems")).classList.remove("cart__items--disabled");this.querySelectorAll(t.map((t=>`[id="CartDrawer-Item-${t}"]`)).join(",")).forEach((t=>t.classList.remove("loading"))),this.updateProgressBar()}removeAllOpenUpsells(t=[]){var e=document.querySelectorAll(".cart-item-upsell__container");e.length>0&&e.forEach((e=>{t.includes(e.dataset.productType)||(e.open=!1)}))}removeCertainOpenUpsells(){let t=sessionStorage.getItem("allClosedUpsells")?JSON.parse(sessionStorage.getItem("allClosedUpsells")):[];t.length>0&&t.forEach((t=>{var e=document.querySelectorAll(`.cart-item[data-id="${t}"] .cart-item-upsell__container`);e.length>0&&e.forEach((t=>{t.open=!1}))}))}}customElements.define("cart-items",CartItems);class CartDrawer extends HTMLElement{constructor(){super(),this.addEventListener("keyup",(t=>"Escape"===t.code&&this.close())),this.querySelector("#CartDrawer-Overlay").addEventListener("click",this.close.bind(this)),this.setHeaderCartIconAccessibility(),"#cart-open"===window.location.hash&&this.open()}setHeaderCartIconAccessibility(){const t=document.querySelector("#cart-icon-bubble");t.setAttribute("role","button"),t.setAttribute("aria-haspopup","dialog"),t.addEventListener("click",(e=>{e.preventDefault(),this.open(t)})),t.addEventListener("keydown",(e=>{"SPACE"===e.code.toUpperCase()&&(e.preventDefault(),this.open(t))}))}open(t){t&&this.setActiveElement(t);const e=this.querySelector('[id^="Details-"] summary');var r,s,n,a;e&&!e.hasAttribute("role")&&this.setSummaryAccessibility(e),setTimeout((()=>{this.classList.add("animate","active")})),this.addEventListener("transitionend",(()=>{const t=this.classList.contains("is-empty")?this.querySelector(".drawer__inner-empty"):document.getElementById("CartDrawer"),e=this.querySelector(".drawer__inner")||this.querySelector(".drawer__close");trapFocus(t,e)}),{once:!0}),document.body.classList.add("overflow-hidden"),r=window,s=document,r.hj=r.hj||function(){(r.hj.q=r.hj.q||[]).push(arguments)},r._hjSettings={hjid:1125876,hjsv:6},n=s.getElementsByTagName("head")[0],(a=s.createElement("script")).async=1,a.src="https://static.hotjar.com/c/hotjar-"+r._hjSettings.hjid+".js?sv="+r._hjSettings.hjsv,n.appendChild(a),hj("event","cart_opened"),window.cart_open=!0}close(){[...this.querySelectorAll(".tooltip-overlay")].forEach((t=>t.click())),this.classList.remove("active"),removeTrapFocus(this.activeElement),document.body.classList.remove("overflow-hidden")}setSummaryAccessibility(t){t.setAttribute("role","button"),t.setAttribute("aria-expanded","false"),t.nextElementSibling.getAttribute("id")&&t.setAttribute("aria-controls",t.nextElementSibling.id),t.addEventListener("click",(t=>{t.currentTarget.setAttribute("aria-expanded",!t.currentTarget.closest("details").hasAttribute("open"))})),t.parentElement.addEventListener("keyup",onKeyUpEscape)}renderContents(t){const e=document?.querySelector("gift-purchase");this.querySelector(".drawer__inner").classList.contains("is-empty")&&this.querySelector(".drawer__inner").classList.remove("is-empty"),this.getSectionsToRender().forEach((e=>{const r=e.selector?document.querySelector(e.selector):document.getElementById(e.id),s=r.querySelector('[data-rebuy-id][data-initialized="true"]');r.innerHTML=this.getSectionInnerHTML(t.sections[e.id],e.selector),s&&r.querySelector(`[data-rebuy-id="${s.dataset.rebuyId}"]`)?.replaceWith(s)})),this.querySelector("#CartDrawer-Overlay").addEventListener("click",this.close.bind(this)),window?.checkForUTM(),this.querySelector("[data-rebuy-id]:not([data-initialized])")&&window.Rebuy?.reinit?.(),e?.giftPurchaseApplyUTMRules(),this.open()}getSectionInnerHTML(t,e=".shopify-section"){return(new DOMParser).parseFromString(t,"text/html").querySelector(e).innerHTML}getSectionsToRender(){return[{id:"cart-drawer",selector:"#CartDrawer"},{id:"cart-icon-bubble"}]}getSectionDOM(t,e=".shopify-section"){return(new DOMParser).parseFromString(t,"text/html").querySelector(e)}setActiveElement(t){this.activeElement=t}}customElements.define("cart-drawer",CartDrawer);class CartDrawerItems extends CartItems{constructor(){super()}getSectionsToRender(){const t={id:"CartDrawer",section:"cart-drawer"};return[{...t,selector:".drawer__content"},{...t,selector:".drawer__recommendations",validate:t=>0===t},{...t,selector:".drawer__footer"},{...t,selector:".drawer__progress-bar"},{id:"cart-icon-bubble",section:"cart-icon-bubble",selector:".shopify-section"},{...t,selector:".drawer__header"}]}}customElements.define("cart-drawer-items",CartDrawerItems);class GiftPurchase extends HTMLElement{constructor(){super()}giftPurchaseApplyUTMRules(){this.elements={cart_drawer_header_box:document.querySelector(".drawer__header .empty-box"),default_cart_texts:document.querySelectorAll(".icon-text-wrapper .text-wrapper.default"),added_cart_texts:document.querySelectorAll(".icon-text-wrapper .text-wrapper.added-to-cart"),cart_utm_msg_wrapper:document.querySelector(".utm-wrapper-cart"),gift_card:document.querySelector('.cart-item[data-is-gift-card="true"]'),utm_gwp_carousel:document.querySelector(".drawer_gwp_carousel"),remove_bt
1n:document.querySelector('cart-remove-button [data-type="free"]'),submit_button:this?.querySelector('[type="submit"]'),form:this.querySelector("product-form form")},this.cart_total=document.querySelector(".gwp-box-total-money")?.dataset?.gwpCartTotal;const t=document.querySelector('[data-is-free="true"]'),e=this.elements.gift_card?.querySelector(".price-item")?.dataset?.giftCardPriceGwp,r=this.elements?.gift_card?.querySelector(".quantity__input")?.value;this.cart_total&&e&&r&&(this.cart_total-=+e*+r);const s="false"!=this.elements.cart_drawer_header_box?.dataset?.categorizedFunctionality,n="false"!=this.elements.cart_drawer_header_box?.dataset?.requiredProductsFunctionality;!t&&this.cart_total&&s&&n&&this.addGift(),t&&(!s||!n||this.cart_total&&+this.cart_total<+window?.utm_threshold)&&this.removeGift()}addGift(){const t=this?.querySelector(".product-id"),e=this?.querySelector(".variant-id");if(t.value=window?.utm_gift_product_id,e.value=window?.utm_gift_product_variant_id,this.elements.cart_utm_msg_wrapper?.classList.remove("hidden"),+this.cart_total>=+window?.utm_threshold)if(window?.use_gwp_carousel)this.elements.utm_gwp_carousel?.classList.remove("hidden"),this.elements.cart_utm_msg_wrapper?.classList.add("hidden");else{let t=this.elements?.form?.querySelector('input[name="quantity"]');t?t.value="1":(t=document.createElement("input"),t.type="hidden",t.name="quantity",t.value="1",this.elements?.form?.appendChild(t)),this.elements?.submit_button.click(),this.elements.default_cart_texts?.forEach((t=>t?.classList.add("hidden"))),this.elements.added_cart_texts?.forEach((t=>t?.classList.remove("hidden")))}else this.elements.default_cart_texts?.forEach((t=>t?.classList.remove("hidden"))),this.elements.added_cart_texts?.forEach((t=>t?.classList.add("hidden")))}removeGift(){this.elements.remove_btn?.click(),this.elements.default_cart_texts?.forEach((t=>t?.classList.remove("hidden"))),this.elements.added_cart_texts?.forEach((t=>t?.classList.add("hidden")))}connectedCallback(){setTimeout((()=>{this.giftPurchaseApplyUTMRules()}),500)}}customElements.define("gift-purchase",GiftPurchase);class UpsellRemoveButton extends HTMLElement{constructor(){super(),this.button=this.querySelector("button"),this.summary=this.querySelector("summary"),this.details=this.querySelector("details"),this.links=this.querySelectorAll("a"),this.cartItemID=this.parentElement?.dataset?.id,this.button?.addEventListener("click",(t=>{this.details.open=!1,this.addToList()})),this.summary?.addEventListener("click",(t=>{this.details.open&&this.addToList()})),this.links?.forEach((t=>{t.addEventListener("click",(t=>{this.details.open&&this.addToList()}))}))}addToList(t){if(!this.cartItemID)return;if("undefined"!=typeof intelligemsSuppressAfterInteraction&&intelligemsSuppressAfterInteraction){let t=document.querySelectorAll(".cart-item-upsell__container");return void(t.length>0&&(t.forEach((t=>{t.open=!1})),sessionStorage.setItem("closeAllUpsellsAfterInteraction",!0)))}let e=sessionStorage.getItem("allClosedUpsells")?JSON.parse(sessionStorage.getItem("allClosedUpsells")):[];e.includes(this.cartItemID)||(e.push(this.cartItemID),sessionStorage.setItem("allClosedUpsells",JSON.stringify(e)))}}customElements.define("upsell-remove-button",UpsellRemoveButton);class LoyaltyPointsCart extends HTMLElement{constructor(){super(),"undefined"!=typeof loyaltylion&&loyaltylion.on("ready",this.loadReward.bind(this))}loadReward(t=0){loyaltylion?.ui?.refresh(),setTimeout((()=>{const e=document.querySelector(".cart-items"),r=this.querySelector(".minicart-loyalty-price"),s=document.querySelector(".loyalty-points-cart-discount")?.textContent||0;let n=0,a=!1;if(e){if([...e.children].forEach((t=>{const e=t.querySelector(".loyalty-points-cart")?.textContent,r=t.querySelector("[data-cart-quantity]")?.value;e&&r&&(a=!0,n+=+e*+r)})),!a&&t<4)return void this.loadReward(t+1);n-=+s,r.textContent=n}}),0===t?1500:700)}connectedCallback(){this.loadReward()}}if(customElements.define("loyalty-points-cart",LoyaltyPointsCart),"function"!=typeof initCartBundleProps){function initCartBundleProps(){const t="_from_shopify_bundle",e="_discount_amount",r=new Map,s=new Map;let n=!1,a=!1,i=!1,o=0;const c=async t=>{if(s.has(t))return s.get(t);let e={};try{const r=window.Shopify?.routes?.root||"/",s=await fetch(`${r}products/${t}?view=line-item-props`);s.ok&&(e=(await s.json()).properties||{})}catch(t){}return s.set(t,e),e},l=r=>{const s=r.components?.nodes||[],n=s.reduce(((t,e)=>t+e.quantity),0),a=s.flatMap((t=>Array(t.quantity).fill(t.productVariant.id.split("/").pop()))).join(","),i=parseFloat(r.compareAtPrice?.amount||0),o=parseFloat(r.price.amount),c=i>o&&n>0?Number(((i-o)/n).toFixed(2)):0;return{[t]:"true",_shopify_bundle_handle:r.product.handle,_set_bundle_title:r.product.title,_bundle_items_ids:a,[e]:String(c)}},d=async()=>
1{if(n)return void(a=!0);n=!0;let u=null;try{u=await(await fetch("/cart.js")).json();const s=u.items.filter((r=>{const s=r.properties||{};return!(s[t]&&void 0!==s[e])})),n=[...new Set(s.map((t=>t.variant_id)))].filter((t=>!r.has(t)));if(n.length){(await(async t=>{const e=t.map((t=>`gid://shopify/ProductVariant/${t}`)),r=await fetch(`https://${Shopify.shop}/api/2024-10/graphql.json`,{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":STOREFRONT.token},body:JSON.stringify({query:"\n\t\t\t\tquery getVariantComponents($ids: [ID!]!) {\n\t\t\t\t\tnodes(ids: $ids) {\n\t\t\t\t\t\t... on ProductVariant {\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\trequiresComponents\n\t\t\t\t\t\t\tprice { amount }\n\t\t\t\t\t\t\tcompareAtPrice { amount }\n\t\t\t\t\t\t\tproduct { title handle }\n\t\t\t\t\t\t\tcomponents(first: 30) {\n\t\t\t\t\t\t\t\tnodes {\n\t\t\t\t\t\t\t\t\tquantity\n\t\t\t\t\t\t\t\t\tproductVariant { id }\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t",variables:{ids:e}})}),{data:s}=await r.json();return s?.nodes?.filter(Boolean)||[]})(n)).forEach((t=>r.set(+t.id.split("/").pop(),t))),n.forEach((t=>{r.has(t)||r.set(t,null)}))}for(const s of u.items){const n=s.properties||{},a={},o=r.get(s.variant_id),d=n[t]&&void 0!==n[e];if(o&&o.requiresComponents&&!d&&Object.assign(a,l(o)),s.handle&&!n._gift_type){const t=await c(s.handle);for(const[e,r]of Object.entries(t))r&&!(e in n)&&(a[e]=r)}Object.keys(a).length&&(await fetch("/cart/change.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:s.key,quantity:s.quantity,properties:{...n,...a}})}),Object.keys(a).some((t=>"_"!==t[0]))&&(i=!0))}}catch(t){console.error("cart-bundle-props:",t)}if(n=!1,a)return a=!1,void d();const p=!!u&&(t=>{const e=document.getElementById("CartDrawer");if(!e)return!1;const r={};for(const e of t.items){const t=e.properties||{};if(!e.handle||t._gift_type)continue;if(t._from_bundle_kit||t._from_prism_bundle||t._bundle_handle)continue;const n=s.get(e.handle)||{};for(const e of Object.keys(n)){if("_"===e[0]||!(e in t))continue;const s=`.product-option.${e.toLowerCase().split(/\s+/).filter(Boolean).join(".")}`;r[s]=(r[s]||0)+1}}return Object.entries(r).some((([t,r])=>{try{return e.querySelectorAll(t).length<r}catch(t){return!1}}))})(u);i||p?(i=!1,o<4&&(o++,(()=>{const t=document.querySelector("cart-drawer-items")||document.querySelector("cart-items");t?.onCartUpdate?.()})(),m(),setTimeout(m,1500))):o=0};let u;const m=()=>{clearTimeout(u),u=setTimeout(d,300)};"function"==typeof subscribe&&"object"==typeof PUB_SUB_EVENTS&&subscribe(PUB_SUB_EVENTS.cartUpdate,m),["rebuy:cart.add","rebuy:cart.change","rebuy:cart.ready","rebuy:smartcart.change"].forEach((t=>{document.addEventListener(t,m)})),m()}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",initCartBundleProps):initCartBundleProps()}

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.