PageSourceSearch

https://tweezerman.com/cdn/shop/t/103/assets/tz-free-gifts.js?v=55690796614661120461789394761

js tweezerman.com collected 2026-09-25 19:02:11 UTC 4,388 bytes, 21 lines download raw bytes

1(function(){function initTzGifts(){if(!window.tzFreeGiftsConfig||!window.tzFreeGiftsConfig.thresholds){setTimeout(initTzGifts,300);return}document.addEventListener("click",e=>{if(e.target.matches(".add-gift-button")){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();const btn=e.target,productId=btn.dataset.productId,rangeKey=btn.dataset.range,block=btn.closest(".gift-threshold-block");block&&block.remove(),fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:productId,quantity:1,properties:{is_free_gift:!0,_gift_series_range:rangeKey}})}).then(()=>fetch("/cart.js")).then(res=>res.json()).then(cart=>{document.dispatchEvent(new CustomEvent("theme:cart:change",{detail:{cart},bubbles:!0})),document.dispatchEvent(new CustomEvent("theme:cart:reload",{bubbles:!0})),window.cartItems?.loadHTML&&window.cartItems.loadHTML(cart)})}}),fetch("/cart.js").then(res=>res.json()).then(cart=>renderTzGifts(cart))}async function renderTzGifts(cart){const wrapper=document.querySelector("#free-gifts-wrapper");if(wrapper&&(wrapper.innerHTML="",window.tzFreeGiftsConfig))for(const threshold of window.tzFreeGiftsConfig.thresholds){const{min,max,eligibleTag,rangeKey}=threshold;let subtotal=0;for(const item of cart.items)if(item.handle)try{(await fetch(`/products/${item.handle}.js`).then(r=>r.json())).tags.includes(eligibleTag)&&(subtotal+=item.line_price/100)}catch{}const inRange=subtotal>=min&&(max===99999||subtotal<max),giftInOtherRange=cart.items.find(item=>item.properties?._gift_series_range&&item.properties._gift_series_range!==rangeKey),giftInThisRange=cart.items.find(item=>item.properties?._gift_series_range===rangeKey);if(inRange&&giftInOtherRange&&(await fetch("/cart/change.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:giftInOtherRange.key,quantity:0})}),console.log("\u{1F5D1}\uFE0F Removed gift from previous range")),!inRange&&giftInThisRange){console.log("\u{1F9F9} Removing out-of-range gift",giftInThisRange.key),await fetch("/cart/change.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:giftInThisRange.key,quantity:0})});const updatedCart=await fetch("/cart.js").then(res=>res.json());window.cartItems?.loadHTML&&window.cartItems.loadHTML(updatedCart),document.dispatchEvent(new CustomEvent("theme:cart:change",{detail:{cart:updatedCart},bubbles:!0})),document.dispatchEvent(new CustomEvent("theme:cart:reload",{bubbles:!0}));return}const safeRangeKey=rangeKey.replace(/\./g,"-");if(!document.querySelector(`#gift-series-${safeRangeKey}`)&&inRange&&!giftInThisRange){const block=document.createElement("div");block.className="gift-threshold-block",block.id=`gift-series-${safeRangeKey}`,block.innerHTML=`
2            <h3 class="text-base font-semibold mb-2 text-left pl-[10px]">
3              ${window.location.hostname.includes("tweezerman.de")||window.location.hostname.includes("zwillingbeauty.com")?"W\xE4hlen Sie Ihr Gratisgeschenk":"Select your free gift!"}
4            </h3>
5            <div class="flex flex-wrap gap-4 px-[10px]">
6              ${threshold.products.map(p=>`
7                <div class="gift-product flex items-center gap-4 border p-3 rounded mb-2 w-full">
8                  <img src="${p.image}" alt="" class="w-[20%] max-w-[80px] h-auto object-contain rounded" />
9                  <div class="flex flex-col w-[80%]">
10                    <p class="text-sm font-semibold mb-2">${p.title}</p>
11                    <button class="add-gift-button bg-black text-white text-xs px-3 py-2 rounded self-start"
12                      data-product-id="${p.id}"
13                      data-range="${rangeKey}">
14                      ${window.location.hostname.includes("tweezerman.de")||window.location.hostname.includes("zwillingbeauty.com")?"Geschenk hinzuf\xFCgen":"Add Free Gift"}
15                    </button>
16                  </div>
17                </div>
18              `).join("")}
19            </div>
20          `,wrapper.appendChild(block)}}}let renderTimeout;document.addEventListener("theme:cart:change",e=>{clearTimeout(renderTimeout),renderTimeout=setTimeout(()=>{const cart=e.detail?.cart;cart?renderTzGifts(cart):fetch("/cart.js").then(res=>res.json()).then(renderTzGifts)},150)}),initTzGifts()})();
21//# sourceMappingURL=/cdn/shop/t/103/assets/tz-free-gifts.js.map?v=55690796614661120461789394761

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.