PageSourceSearch

https://coldest.com/cdn/shop/t/237/assets/coldest-bundle-autoapply.js?v=104235659262134199441777862627

js coldest.com collected 2026-09-24 10:04:26 UTC 3,074 bytes, 2 lines download raw bytes

1(function(){"use strict";var STORAGE_KEY="coldest_bundle_applied_code",DEBOUNCE_MS=600;function log(){if(window.location.search.indexOf("debug=1")!==-1)try{console.log.apply(console,["[bundle-auto]"].concat([].slice.call(arguments)))}catch(e){}}function getVariantMap(){return window.__coldestDropVariants&&typeof window.__coldestDropVariants=="object"?window.__coldestDropVariants:null}function fetchCart(){return fetch("/cart.js",{credentials:"same-origin"}).then(function(r){return r.json()}).catch(function(){return null})}function tallyByDrop(cart,variantMap){var tally={};return!cart||!cart.items||cart.items.forEach(function(line){var vid=String(line.variant_id||line.id),dropHandle=variantMap[vid];dropHandle&&(tally[dropHandle]=(tally[dropHandle]||0)+(line.quantity||1))}),tally}function pickEligibleDrop(tally){var best=null,bestCount=0;return Object.keys(tally).forEach(function(handle){tally[handle]>=3&&tally[handle]>bestCount&&(best=handle,bestCount=tally[handle])}),best}function applyDiscount(code){var url="/discount/"+encodeURIComponent(code)+"?redirect="+encodeURIComponent("/cart.js");return fetch(url,{method:"GET",credentials:"same-origin",redirect:"follow"}).catch(function(){try{var f=document.createElement("iframe");f.style.display="none",f.src=url,f.onload=function(){setTimeout(function(){try{f.remove()}catch(e){}},1e3)},document.body.appendChild(f)}catch(e){}})}function clearStoredCode(){try{sessionStorage.removeItem(STORAGE_KEY)}catch(e){}}function setStoredCode(code){try{sessionStorage.setItem(STORAGE_KEY,code)}catch(e){}}function getStoredCode(){try{return sessionStorage.getItem(STORAGE_KEY)||""}catch(e){return""}}var inFlight=!1;function check(){if(!inFlight){var variantMap=getVariantMap();variantMap&&(inFlight=!0,fetchCart().then(function(cart){if(inFlight=!1,!!cart){var tally=tallyByDrop(cart,variantMap),eligible=pickEligibleDrop(tally),stored=getStoredCode();if(eligible){var code="BUNDLE-"+eligible.toUpperCase()+"-10";stored!==code?(log("applying",code,"\u2014 tally:",tally),applyDiscount(code).then(function(){setStoredCode(code);try{document.dispatchEvent(new CustomEvent("cart:refresh"))}catch(e){}try{document.dispatchEvent(new CustomEvent("cart:updated"))}catch(e){}})):log("already applied",code)}else stored&&stored.indexOf("BUNDLE-")===0&&(log("cart no longer eligible, clearing stored code",stored),clearStoredCode())}}))}}var debounceTimer=null;function checkDebounced(){debounceTimer&&clearTimeout(debounceTimer),debounceTimer=setTimeout(check,DEBOUNCE_MS)}["cart:updated","cart:refresh","cart:change","monstercart:updated","cartdrawer:open","theme:cart:change","theme:cart:update"].forEach(function(ev){document.addEventListener(ev,checkDebounced),window.addEventListener(ev,checkDebounced)}),document.addEventListener("visibilitychange",function(){document.visibilityState==="visible"&&checkDebounced()}),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",check):check()})();
2//# sourceMappingURL=/cdn/shop/t/237/assets/coldest-bundle-autoapply.js.map?v=104235659262134199441777862627

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.