PageSourceSearch

https://www.cycologygear.eu/cdn/shop/t/148/assets/jci-bundle-disco…?v=150307450406782096741787374126

js cycologygear.eu collected 2026-10-04 21:48:55 UTC 3,149 bytes, 2 lines download raw bytes

1const HAS_DISCOUNT_PROP="_has_bundle_discount";async function patchLineProps(lineKey,quantity,existingProps={},hasDisc){const props={...existingProps,[HAS_DISCOUNT_PROP]:!!hasDisc};await fetch("/cart/change.js",{method:"POST",headers:{"Content-Type":"application/json","X-Has-Disc-Patch":"1"},credentials:"same-origin",body:JSON.stringify({id:lineKey,quantity,properties:props})}).catch(console.error)}function getSectionInnerHTML(html,selector){return new DOMParser().parseFromString(html,"text/html").querySelector(selector).innerHTML}function getSectionsToRender(){return[{id:"main-cart-items",section:document.getElementById("main-cart-items")?.dataset?.id,selector:".js-contents"},{id:"cart-icon-bubble",section:"cart-icon-bubble",selector:".shopify-section"},{id:"cart-live-region-text",section:"cart-live-region-text",selector:".shopify-section"},{id:"main-cart-footer",section:document.getElementById("main-cart-footer")?.dataset?.id,selector:".js-contents"},{id:"CartDrawer",section:"cart-drawer",selector:"#CartDrawer"}]}async function removeByKeys(lineKeys=[]){const updates={};for(const k of lineKeys)updates[k]=0;const res=await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json","X-Has-Disc-Patch":"1"},credentials:"same-origin",body:JSON.stringify({updates,sections:this.getSectionsToRender().map(section=>section.section),sections_url:window.location.pathname})}).then(res2=>res2.json());if(!res)throw new Error("Failed to update cart");return getSectionsToRender().forEach((section=>{const elementToReplace=document.getElementById(section.id)?.querySelector(section.selector)||document.getElementById(section.id);elementToReplace&&(elementToReplace.innerHTML=getSectionInnerHTML(res.sections[section.section],section.selector))})),res}document.addEventListener("DOMContentLoaded",function(){const origFetch=window.fetch;window.fetch=async function(...args){const res=await origFetch.apply(this,args);try{const url=typeof args[0]=="string"?args[0]:args[0].url||"";if(/\/cart\/(add|change|update)(\?|$)/.test(url)){const json=await res.clone().json().catch(()=>null);if(!json?.items?.length)return res;const tasks=[];for(const item of json.items){const hasDisc=(item.line_level_discount_allocations||item.discount_allocations||[]).length>0,flagSet=!!item.properties?.[HAS_DISCOUNT_PROP];hasDisc&&!flagSet?tasks.push(patchLineProps(item.key,item.quantity,item.properties||{},!0)):!hasDisc&&flagSet&&tasks.push(patchLineProps(item.key,item.quantity,item.properties||{},!1))}await Promise.allSettled(tasks);let totalSum=json.items.filter(i=>i.properties._free_gift).reduce((sum,item)=>sum+item.price,0);const totalPriceWithoutFree=json.total_price/100-totalSum/100;if(console.log(totalPriceWithoutFree),promo_product.threshold_amount>totalPriceWithoutFree){let free_gift_items_keys=json.items.filter(i=>i.properties._free_gift).map(i=>i.key);free_gift_items_keys.length>0&&setTimeout(async()=>{await removeByKeys(free_gift_items_keys)},100)}return res}}catch(e){console.error(e)}return res}});
2//# sourceMappingURL=/cdn/shop/t/148/assets/jci-bundle-discount-checker.js.map?v=150307450406782096741787374126

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.