PageSourceSearch

https://www.allbirds.co.uk/cdn/shop/t/3608/assets/post-atc-modal-section.js

js allbirds.co.uk collected 2026-10-02 06:16:43 UTC 3,388 bytes, 1 lines download raw bytes

1import{c as O,o as R,x as D,r as P,m as l}from"./vue.esm-bundler.js";import{u as E}from"./use-focus-management.js";import{i as z,u as F}from"./use-post-atc-modal.js";import{e as y}from"./ScrollTrigger.js";import{B as U}from"./base-section.js";import"./navigation.js";import"./create-element-if-not-defined.js";import"./swiper-core.js";import"./pagination.js";import"./classes-to-selector.js";import"./use-scroll-lock.js";import"./use-viewport-size.js";import"./animations.js";import"./swiper.js";class Y extends U{constructor(){super('[data-section-type="post-atc-modal-section"]')}init(u){const d=u.container;if(!d){y("[Allbirds section] - Post-ATC Modal - init - Container not found",{},new Error("Container not found"));return}const n=d.dataset;let A=[];try{A=JSON.parse(n.recommendations||"[]")}catch(h){y("[Allbirds section] - Post-ATC Modal - init - Error parsing recommendations",{dataset:n},h)}const N=parseInt(n.freeShippingThreshold,10)||7500;z({recommendations:A,settings:{continueShoppingLabel:n.continueShoppingLabel||"Continue shopping",freeShippingMessageAchieved:n.freeShippingMessageAchieved||"You've earned free shipping!",freeShippingMessageNotAchieved:n.freeShippingMessageNotAchieved||"Spend {amount} more to earn free shipping!",freeShippingThreshold:N,recommendationsTitle:n.recommendationsTitle||"You may also like",viewCartLabel:n.viewCartLabel||"View cart & check out"}}),O({name:"PostAtcModalApp",setup(){const{cart:h}=E(),t=F("post-atc-modal-section"),T=P(d),C=P({}),b=(e,r)=>{C.value[e]=r},$=l(()=>{const e=[],r=new Set;for(const f of t.recommendations.value){if(!Array.isArray(f)||f.length===0)continue;const s=f.filter(o=>!!o.colorName);if(s.length===0)continue;const i=s[0],c=i.productName||i.productId||i.handle;if(!i||!c||r.has(c))continue;r.add(c);const I=C.value[c]||i.handle,a=s.find(o=>o.handle===I)||i,S=a.sizes?.map(o=>o.price)||[],M=S.length>0?Math.min(...S):0,v=a.sizes?.map(o=>o.compareAtPrice).filter(Boolean)||[],m=v.length>0?Math.min(...v):null,x=s.map(o=>{const w=o.swatchColors||[];return w.length===0?null:{handle:o.handle,hues:w}}).filter(Boolean);e.push({colorCount:s.length,colorName:a.colorName,compareAtPrice:m?m*100:null,handle:a.handle,hasDiscount:m&&m>M,image:a.image,masterKey:c,price:M*100,productId:a.productId,productName:a.productName,swatchData:x})}return e.slice(0,10)}),p=l(()=>t.settings.value.freeShippingThreshold||0),g=l(()=>h.value?.total_price||0),k=l(()=>Math.max(0,p.value-g.value)),L=l(()=>p.value<=0?100:Math.min(100,g.value/p.value*100)),_=e=>{if(e==null||isNaN(e))return"";const r=e/100;return`$${r%1===0?r:r.toFixed(2)}`},B=e=>!Array.isArray(e)||e.length===0?"background: transparent":e.length===3?`background: linear-gradient(to right, ${e[0]} 33%, ${e[1]} 33%, ${e[1]} 66%, ${e[2]} 66%)`:e.length===2?`background: linear-gradient(135deg, ${e[0]} 50%, ${e[1]} 50%)`:`background: ${e[0]}`;return R(()=>{t.init(T)}),D(()=>{t.cleanup()}),{addedProduct:t.addedProduct,amountToFreeShipping:k,closePostAtcModal:t.closeModal,currentCartTotal:g,formatMoney:_,freeShippingProgress:L,freeShippingThreshold:p,getSwatchStyle:B,handleRecommendationClick:t.handleRecommendationClick,handleSwatchClick:b,modalSettings:t.settings,postAtcModalIsOpen:t.isOpen,processedRecommendations:$,viewCart:t.viewCart}}}).mount(d)}onUnload(u){u.container.__vue_app__?.unmount()}}document.addEventListener("DOMContentLoaded",()=>{new Y});

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.