PageSourceSearch

https://www.simplemodern.com/cdn/shop/t/1207/assets/theme-upsell.js?v=82696640145608086681789138743

js simplemodern.com collected 2026-09-24 22:26:06 UTC 7,582 bytes, 31 lines download raw bytes

1"use strict";/*! DO NOT EDIT: This file is auto-generated and will be overwritten. [build-fingerprint:assets] */(self.webpackChunkshopify_theme=self.webpackChunkshopify_theme||[]).push([["4045"],{626:function(__unused_webpack_module,__unused_webpack___webpack_exports__,__webpack_require__){
2var klaviyo_cart=__webpack_require__(6690),core_cart=__webpack_require__(5832),create_raw_item_payload=__webpack_require__(5680),payload=__webpack_require__(3921),events=__webpack_require__(3920),guards=__webpack_require__(7696),section_filter=__webpack_require__(
32678),serialize_form=__webpack_require__(9601),traversal=__webpack_require__(5925),strings=__webpack_require__(399),shopify_root=__webpack_require__(1421),cart_drawer_open_request=__webpack_require__(8621),product_variant_selected=__webpack_require__(
41233),may_advertise=__webpack_require__(5099),product_options=__webpack_require__(9504),format_money=__webpack_require__(9570),dist=__webpack_require__(7884);let ProductDetailsIO=(0,dist.type)({currencyCode:(0,dist.size)((0,dist.string)(),3,
53),moneyFormat:(0,dist.string)(),pangvMarket:(0,dist.optional)((0,dist.string)()),pangvLows:(0,dist.defaulted)((0,dist.record)((0,dist.string)(),(0,dist.number)()),{})}),init=async()=>{(shopifyEvent=>{let containers=(0,traversal.findElements)(
6document,".js-upsell").filter((0,section_filter.matchesShopifySection)(void 0)).flatMap(upsell=>(0,traversal.findElements)(upsell,".js-product-details"));if(0===containers.length)return;let cartMachine=(0,core_cart.getCartMachine)(),namespace=(0,
7events.makeEventNamespace)();containers.forEach(container=>{let errorRenderTarget=(0,traversal.findOneElement)(container,".js-product-form-error"),clearError=()=>{errorRenderTarget&&(errorRenderTarget.textContent="")},rawIo=(0,traversal.findOneElement)(
8container,'script[type="application/json"]')?.textContent||"{}",{currencyCode,moneyFormat,pangvMarket,pangvLows}=ProductDetailsIO.create(JSON.parse(rawIo));namespace.addDelegatedEventListener(container,'form[action*="/cart/add"]',"submit",(form,evt)=>{
9evt.preventDefault(),(0,guards.isHTMLFormElement)(form)&&(async()=>{let upsellButtons=(0,traversal.findElements)(container,".Upsell-submitButton"),upsellButtonParent=container.closest(".Upsell-slide");try{let ajaxCartData=form.getAttribute(
10"data-ajax-cart-disabled"),rawItemPayload=(0,create_raw_item_payload.createRawItemPayload)((0,serialize_form.serializeForm)(form)),itemPayload=payload.SingleItemPayload.create(rawItemPayload);clearError();let itemsAddedToCart=await new Promise(
11(resolve,reject)=>{cartMachine.addItems({resolve,reject,input:{items:[itemPayload]}})});if("disabled"===ajaxCartData?window.location.replace((0,shopify_root.atShopifyRoot)("/cart").href):(0,cart_drawer_open_request.sendCartDrawerOpenRequestEvent)(),
12itemsAddedToCart&&upsellButtonParent){upsellButtons.forEach(button=>{button.textContent=(0,strings.t)("products.upsell.added_to_cart")}),console.debug("entrkka Items added to cart",itemsAddedToCart);let currentSwiperInstance=document.querySelector(
13".CartDrawerUpsell .js-upsell");if(currentSwiperInstance&&"swiper"in currentSwiperInstance){let{swiper}=currentSwiperInstance;upsellButtonParent.remove(),"object"==typeof swiper&&null!==swiper&&"update"in swiper&&"function"==typeof swiper.update&&
14swiper.update()}}itemsAddedToCart&&window._learnq&&fetch((0,shopify_root.atShopifyRoot)("/cart.js")).then(res=>res.clone().json().then(data=>{let cart=(0,klaviyo_cart.transformCartToKlaviyoCart)(data);null!=cart&&window._learnq?.push(["trac\
15k","Added to Cart",cart])}))}catch(err){let errMessage=err instanceof Error?err.message:"string"==typeof err?err:"Unknown error";errorRenderTarget&&(errorRenderTarget.textContent=[errMessage,"[a8bed63b434340e982acf019d921f602]"].join(" "))}})()});
16let optionsContainerElement=(0,traversal.findOneElement)(container,".js-product-options");optionsContainerElement&&(0,product_options.load)(optionsContainerElement,({product:{id:productId},selectedVariant:variant})=>{let formattedPrice=(0,format_money.
17formatMoney)(variant.price,moneyFormat),price=variant.available?variant.compare_at_price&&variant.price<variant.compare_at_price&&(0,may_advertise.mayAdvertiseReduction)({market:pangvMarket,lows:pangvLows,variantId:variant.id})?[formattedPrice,
18"<del>",(0,format_money.formatMoney)(variant.compare_at_price,moneyFormat),"</del>",(0,may_advertise.pangvPriceHistoryHtml)({market:pangvMarket,lows:pangvLows,variantId:variant.id,formatMoney:amount=>(0,format_money.formatMoney)(amount,moneyFormat)})].
19join(" "):formattedPrice:["<del>",formattedPrice,"</del> <strong>",(0,strings.t)("products.product.out_of_stock"),"</strong>"].join(" ");(0,traversal.findElements)(container,".js-price-preview").forEach(preview=>{preview.innerHTML=price}),(0,
20traversal.findElements)(container,'form[action*="/cart/add"]').forEach(form=>{(0,traversal.findElements)(form,'[type="submit"]').forEach(submit=>{(submit instanceof HTMLButtonElement||submit instanceof HTMLInputElement)&&(submit.disabled=!variant.
21available)})}),(0,traversal.findElements)(container,".js-variant-selector-dummy").forEach(dummy=>{(dummy instanceof HTMLInputElement||dummy instanceof HTMLSelectElement)&&(dummy.value=`${variant.id}`),dummy.dispatchEvent(new Event("change",
22{bubbles:true}))}),clearError(),(0,product_variant_selected.sendProductVariantSelectedEvent)({productId,variantId:variant.id});let availableCTAs=(0,traversal.findElements)(container,".js-available"),unavailableCTAs=(0,traversal.findElements)(
23container,".js-unavailable"),setDisplay=(elements,display)=>
23{elements.forEach(element=>{element.style.display=display})};variant.available?(setDisplay(availableCTAs,"block"),setDisplay(unavailableCTAs,"none")):(setDisplay(availableCTAs,"non\
24e"),setDisplay(unavailableCTAs,"block"),(0,traversal.findElements)(document,".BackToStock--selectedSize").forEach(label=>{label.textContent=variant.title,label.setAttribute("data-variantid",`${variant.id}`)}))})})})()},qty_controls_init=async()=>{
25(0,traversal.findElements)(document,".js-upsell .js-product-qty-controls").forEach(controls=>{let field=(0,traversal.findOneElement)(controls,'input[name="quantity"]'),indicator=(0,traversal.findOneElement)(controls,".js-qty-indicator");if(!(0,
26guards.isHTMLInputElement)(field))throw Error("Quantity is not a number");let readQty=()=>{let qty=Number.parseInt(field.value,10);if(Number.isNaN(qty))throw Error("Quantity is not a number");return qty},writeQty=qty=>{field.value=`${qty}`,
27indicator&&(indicator.textContent=`${qty}`)};writeQty(readQty()),(0,traversal.findElements)(controls,"button").forEach(button=>{button.addEventListener("click",()=>{let action=button.getAttribute("data-action"),currentQty=readQty();writeQty(
28"plus"===action?currentQty+1:"minus"===action&&currentQty>1?currentQty-1:currentQty)})})})};var scroll_carousel=__webpack_require__(9054);let upsell_init=async()=>{let carousel=(0,traversal.findOneElement)(document,".CartDrawerUpsell .js-up\
29sell");(0,scroll_carousel.initScrollCarousel)(carousel,{onSettle:({direction})=>{let slideInformation={carouselDirection:direction,sliderClass:carousel?.classList[0],eventLabel:document.location.pathname};window.dataLayer?.push(slideInformation,
30{event:"cart_upsell"})}})},logErrors=err=>{console.error(err)};qty_controls_init().catch(logErrors),upsell_init().catch(logErrors),init().catch(logErrors)}},function(__webpack_require__){__webpack_require__.O(0,["1100","1758","2959","386","\
314489","754","7673","8345","8473","9855"],function(){return __webpack_require__(__webpack_require__.s=626)}),__webpack_require__.O()}]);

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.