PageSourceSearch

https://www.skinnydiplondon.com/cdn/shop/t/914/assets/bao-cart.js?v=168350961570972676971787650454

js skinnydiplondon.com collected 2026-09-24 08:43:16 UTC 6,234 bytes, 2 lines download raw bytes

1const{fetchJSON,getDefaultRequestConfig,getElement}=window.BAO.Utils,defaultSectionsUrl=()=>["/apps/","/a/","/tools/","/community/"].some(url=>window.location.pathname.includes(url))?"/":window.location.pathname,DEFAULT_SECTIONS_URL=defaultSectionsUrl();class BaoCart{async addItemFromForm(form,{sections=window.BAO.sectionRenderer.pushCartSections.map(s=>s.section),sectionsUrl=DEFAULT_SECTIONS_URL}={}){const formData=new FormData(form);formData.append("sections",sections),formData.append("sections_url",sectionsUrl),window.BAO.dispatchEvent(window.BAO.EVENTS.PUSH_CART.BEFORE_ADD_FROM_FORM,{form,formData});const config=getDefaultRequestConfig("javascript");config.headers["X-Requested-With"]="XMLHttpRequest",delete config.headers["Content-Type"],config.body=formData;try{const state=await fetchJSON(`${window.routes.cartAddUrl}`,config);return"sections"in state&&state.sections==null&&sections.length&&(state.sections=await window.BAO.sectionRenderer.fetch(sections,sectionsUrl)),window.BAO.dispatchEvent(window.BAO.EVENTS.PUSH_CART.AFTER_ADD_FROM_FORM,{form,formData,state}),window.BAO.dispatchEvent(window.BAO.EVENTS.PUSH_CART.CHANGED,{state}),state}catch(err){this.handleAddToCartError(err),window.BAO.dispatchEvent(window.BAO.EVENTS.PUSH_CART.AFTER_ADD_FROM_FORM_ERROR)}}async addItem(items,{sections=window.BAO.sectionRenderer.pushCartSections.map(s=>s.section),sectionsUrl=DEFAULT_SECTIONS_URL,attributes={},form}={}){Array.isArray(items)||(items=[items]),window.BAO.dispatchEvent(window.BAO.EVENTS.PUSH_CART.BEFORE_ADD,{items,attributes,form});const body={items,attributes};sections.length&&(body.sections=sections,body.sections_url=sectionsUrl);try{const state=await this.cartAdd(body);return"sections"in state&&state.sections==null&&sections.length&&(state.sections=await window.BAO.sectionRenderer.fetch(sections,sectionsUrl)),window.BAO.dispatchEvent(window.BAO.EVENTS.PUSH_CART.AFTER_ADD,{items,state,form}),window.BAO.dispatchEvent(window.BAO.EVENTS.PUSH_CART.CHANGED,{state}),state}catch(err){this.handleAddToCartError(err)}}async updateQuantity(key,quantity,{sections=window.BAO.sectionRenderer.pushCartSections.map(s=>s.section),sectionsUrl=DEFAULT_SECTIONS_URL}={}){window.BAO.dispatchEvent(window.BAO.EVENTS.PUSH_CART.BEFORE_UPDATE_ITEM_QUANTITY,{key,quantity});const body={id:key,quantity};sections.length&&(body.sections=sections,body.sections_url=sectionsUrl);try{const state=await this.cartChange(body);return"sections"in state&&state.sections==null&&sections.length&&(state.sections=await window.BAO.sectionRenderer.fetch(sections,sectionsUrl)),window.BAO.dispatchEvent(window.BAO.EVENTS.PUSH_CART.AFTER_UPDATE_ITEM_QUANTITY,{state}),window.BAO.dispatchEvent(window.BAO.EVENTS.PUSH_CART.CHANGED,{state}),state}catch(err){console.error(err)}}async removeItem(key,{sections=window.BAO.sectionRenderer.pushCartSections.map(s=>s.section),sectionsUrl=DEFAULT_SECTIONS_URL}={}){window.BAO.dispatchEvent(window.BAO.EVENTS.PUSH_CART.BEFORE_UPDATE_REMOVE_ITEM,{key});const body={id:key,quantity:0};sections.length&&(body.sections=sections,body.sections_url=sectionsUrl);try{const state=await this.cartChange(body);return"sections"in state&&state.sections==null&&sections.length&&(state.sections=await window.BAO.sectionRenderer.fetch(sections,sectionsUrl)),window.BAO.dispatchEvent(window.BAO.EVENTS.PUSH_CART.AFTER_UPDATE_REMOVE_ITEM,{state}),window.BAO.dispatchEvent(window.BAO.EVENTS.PUSH_CART.CHANGED,{state}),state}catch(err){console.error(err)}}async removeItems(keys,{sections=window.BAO.sectionRenderer.pushCartSections.map(s=>s.section),sectionsUrl=DEFAULT_SECTIONS_URL}={}){window.BAO.dispatchEvent(window.BAO.EVENTS.PUSH_CART.BEFORE_UPDATE_REMOVE_ITEM,{keys});const body={updates:Object.fromEntries(keys.map(k=>[k,0]))};sections.length&&(body.sections=sections,body.sections_url=sectionsUrl);try{const state=await this.cartUpdate(body);return"sections"in state&&state.sections==null&&sections.length&&(state.sections=await window.BAO.sectionRenderer.fetch(sections,sectionsUrl)),window.BAO.dispatchEvent(window.BAO.EVENTS.PUSH_CART.AFTER_UPDATE_REMOVE_ITEM,{state}),window.BAO.dispatchEvent(window.BAO.EVENTS.PUSH_CART.CHANGED,{state}),state}catch(err){console.error(err)}}async updateItemProperties(key,quantity,properties,{sections=window.BAO.sectionRenderer.pushCartSections.map(s=>s.section),sectionsUrl=DEFAULT_SECTIONS_URL}={}){const body={id:key,properties,quantity};sections.length&&(body.sections=sections,body.sections_url=sectionsUrl);try{return this.cartChange(body)}catch(e){console.error(e)}}async updateCartAttributes(attributes,{sections=window.BAO.sectionRenderer.pushCartSections.map(s=>s.section),sectionsUrl=DEFAULT_SECTIONS_URL}={}){window.BAO.dispatchEvent(window.BAO.EVENTS.PUSH_CART.BEFORE_UPDATE_CART_ATTRIBUTES,{attributes});const body={attributes};sections.length&&(body.sections=sections,body.sections_url=sectionsUrl);try{const state=await this.cartUpdate(body);return"sections"in state&&state.sections==null&&sections.length&&(state.sections=await window.BAO.sectionRenderer.fetch(sections,sectionsUrl)),window.BAO.dispatchEvent(window.BAO.EVENTS.PUSH_CART.AFTER_UPDATE_CART_ATTRIBUTES,{attributes}),window.BAO.dispatchEvent(window.BAO.EVENTS.PUSH_CART.CHANGED,{state}),state}catch(e){console.error(e)}}async updateNote(note){window.BAO.dispatchEvent(window.BAO.EVENTS.CART_NOTE.BEFORE_CHANGE,{note});try{const state=await this.cartUpdate({note});return window.BAO.dispatchEvent(window.BAO.EVENTS.CART_NOTE.AFTER_CHANGE,{state,note}),state}catch(e){console.error(e)}}handleAddToCartError(res){const recipientForm=getElement("recipient-form");if(recipientForm){recipientForm.displayErrorMessage(res);return}const pushCart=getElement("push-cart");pushCart&&pushCart.handleError(res)}cartAdd(body){return fetchJSON(`${window.routes.cartAddUrl}`,{...getDefaultRequestConfig(),body:JSON.stringify(body)})}cartChange(body){return fetchJSON(`${window.routes.cartChangeUrl}`,{...getDefaultRequestConfig(),body:JSON.stringify(body)})}
1cartUpdate(body){return fetchJSON(`${window.routes.cartUpdateUrl}`,{...getDefaultRequestConfig(),body:JSON.stringify(body)})}}window.BAO.Cart=new BaoCart;
2//# sourceMappingURL=/cdn/shop/t/914/assets/bao-cart.js.map?v=168350961570972676971787650454

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.