PageSourceSearch

https://www.lieuditwinery.com/cdn/shop/t/9/assets/loop_bundle.js?v=134193039818244484621774992385

js lieuditwinery.com collected 2026-10-04 13:24:20 UTC 25,004 bytes, 256 lines download raw bytes

1const BUNDLE_LINK_PREFIX="/a/loop_subscriptions/bundle",LOOP_BUNDLE_URL="https://api-service.loopwork.co/bundleTransaction/getBundleCartDetails",LOOP_API_SERVICE_URL="https://api-service.loopwork.co";let BUNDLE_CONTAINER_CLASS="BUNDLE_CONTAINER_CLASS",CART_SUBTOTAL_CLASS="CART_SUBTOTAL_CLASS";const getItemsHtmlLoop=(item,bundleQuantityMapping)=>{let quantity=item.quantity;if(bundleQuantityMapping){let variant=bundleQuantityMapping.find(v=>v.childProductId===item.id);variant&&(quantity=variant.quantity)}return`<p><span style="display:block;" class="data-cart-item-selling-plan-name">${item.title||""} x ${quantity||""}</span></p>`},getEditCartButton=(bundleTransactionId,editBtnText="Edit")=>`<button onclick="event.preventDefault(); changeBundleCartItems('${bundleTransactionId}');" style="background:none;border:none;display:flex;align-items:center;gap:3px;cursor:pointer;padding:0; text-decoration:underline;">
2        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pen" viewBox="0 0 17 17">
3            <path fill-rule="evenodd" d="M15.655 4.344a2.695 2.695 0 0 0-3.81 0l-.599.599-.009-.009-1.06 1.06.008.01-5.88 5.88a2.75 2.75 0 0 0-.805 1.944v1.922a.75.75 0 0 0 .75.75h1.922a2.75 2.75 0 0 0 1.944-.806l7.54-7.539a2.695 2.695 0 0 0 0-3.81Zm-4.409 2.72-5.88 5.88a1.25 1.25 0 0 0-.366.884v1.172h1.172c.331 0 .65-.132.883-.366l5.88-5.88-1.689-1.69Zm2.75.629.599-.599a1.195 1.195 0 1 0-1.69-1.689l-.598.599 1.69 1.689Z"></path>
4        </svg>
5        <p style="padding:0px;margin:0px;margin-top:5px">${editBtnText??"Edit"}</p>
6    </button>`,getBundleCartTableTemplateLoop=(bundleItem,index,bundleLink)=>`
7        <tr class="cart-item" id="CartBundleItem-${index}">
8    <td class="cart-item__media">
9        <a href="${bundleLink}" class="cart-item__link" aria-hidden="true" tabindex="-1"> </a>
10          <div class="cart-item__image-container gradient global-media-settings">
11            <img src="${bundleItem.image||""}"  class="cart-item__image" alt="" loading="lazy" width="150" height="94">
12          </div>
13    </td>
14
15    <td class="cart-item__details"><a href="" class="cart-item__name h4 break">${bundleItem.label}</a>
16                <div class="product-option">
17            ${bundleItem.items.map(item=>getItemsHtmlLoop(item)).join("")}
18              <br/>
19        </div>
20        <div class="product-option">
21         ${bundleItem.price}
22        </div><dl></dl>
23        <p class="product-option">${bundleItem.sellingPlan||""}</p><ul class="discounts list-unstyled" role="list" aria-label="Discount"></ul>
24        ${getEditCartButton(bundleItem.bundleId,bundleItem.editBtnText)}
25    </td>
26
27    <td class="cart-item__totals right medium-hide large-up-hide">
28      <div class="cart-item__price-wrapper">
29        <span class="price price--end">
30             ${bundleItem.price}
31        </span>
32      </div>
33    </td>
34
35    <td class="cart-item__quantity">
36      <div class="cart-item__quantity-wrapper">
37        <quantity-input class="quantity">
38          <input disabled class="quantity__input" type="number" value="1" min="0">
39        </quantity-input>
40        <cart-remove-button>
41          <a onclick="removeBundleLoop('${bundleItem.bundleId}')" class="button button--tertiary" aria-label="${bundleItem.label}" style="cursor : pointer">
42            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" aria-hidden="true" role="presentation" class="icon icon-remove">
43                <path d="M14 3h-3.53a3.07 3.07 0 00-.6-1.65C9.44.82 8.8.5 8 .5s-1.44.32-1.87.85A3.06 3.06 0 005.53 3H2a.5.5 0 000 1h1.25v10c0 .28.22.5.5.5h8.5a.5.5 0 00.5-.5V4H14a.5.5 0 000-1zM6.91 1.98c.23-.29.58-.48 1.09-.48s.85.19 1.09.48c.2.24.3.6.36 1.02h-2.9c.05-.42.17-.78.36-1.02zm4.84 11.52h-7.5V4h7.5v9.5z" fill="currentColor"></path>
44                <path d="M6.55 5.25a.5.5 0 00-.5.5v6a.5.5 0 001 0v-6a.5.5 0 00-.5-.5zM9.45 5.25a.5.5 0 00-.5.5v6a.5.5 0 001 0v-6a.5.5 0 00-.5-.5z" fill="currentColor"></path>
45            </svg>
46          </a>
47        </cart-remove-button>
48      </div>
49    </td>
50
51    <td class="cart-item__totals right small-hide">
52      <div class="cart-item__price-wrapper"><span class="price price--end">
53           ${bundleItem.price}
54          </span></div>
55    </td>
56  </tr>
57    `,getBundleCartDrawerTemplateLoop=(bundleItem,index,bundleLink)=>`
58        <tr class="cart-item" id="CartBundleItem-${index}">
59          <td class="cart-item__media" style="text-align:center;">
60            <img class="cart-item__image"
61              src="${bundleItem.image||""}"
62              alt="${bundleItem.label}" loading="lazy" width="75" height="75">
63          </td>
64          <td class="cart-item__details">
65            <a href="${bundleLink}"
66              class="cart-item__name break">
67              ${bundleItem.label||""}
68            </a>
69            <dl>
70              <div class="product-option">
71                ${bundleItem.items.map(item=>getItemsHtmlLoop(item)).join("")}
72                  <br/>
73                  <p><span class="data-cart-item-selling-plan-name">
74                    ${bundleItem.sellingPlan||""}
75                  </span></p>
76              </div>
77            </dl>
78          </td>
79          <td class="cart-item__quantity small-hide">
80            ${bundleItem.quantity}
81          </td>
82          <td class="right medium-hide large-up-hide">
83            <div class="cart-item__price-wrapper medium-up" style="display: flex; gap: 10px;">
84              ${bundleItem.priceWithoutDiscount!==bundleItem.price?`<span class="price price--end" style="text-decoration:line-through;">
85                    ${bundleItem.priceWithoutDiscount}
86                </span>`:""}
87              <span class="price price--end" style="font-weight: 600;">
88                ${bundleItem.price}
89              </span>
90            </div>
91            ${getEditCartButton(bundleItem.bundleId,bundleItem.editBtnText)}
92            <div onclick="removeBundleLoop('${bundleItem.bundleId}')" style="cursor:pointer; width: fit-content;height: 15px;display: inline-flex;flex-direction: row-reverse;">
93              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" style="width: 1em; height: 1em;" aria-hidden="true" focusable="false" role="presentation" class="icon icon-remove">
94                    <path d="M14 3h-3.53a3.07 3.07 0 00-.6-1.65C9.44.82 8.8.5 8 .5s-1.44.32-1.87.85A3.06 3.06 0 005.53 3H2a.5.5 0 000 1h1.25v10c0 .28.22.5.5.5h8.5a.5.5 0 00.5-.5V4H14a.5.5 0 000-1zM6.91 1.98c.23-.29.58-.48 1.09-.48s.85.19 1.09.48c.2.24.3.6.36 1.02h-2.9c.05-.42.17-.78.36-1.02zm4.84 11.52h-7.5V4h7.5v9.5z" fill="currentColor"></path>
95                    <path d="M6.55 5.25a.5.5 0 00-.5.5v6a.5.5 0 001 0v-6a.5.5 0 00-.5-.5zM9.45 5.25a.5.5 0 00-.5.5v6a.5.5 0 001 0v-6a.5.5 0 00-.5-.5z" fill="currentColor"></path>
96              </svg>
97            </div>
98          </td>
99        </tr>
100    `,getBundleCartItemsDivTemplateLoop=(bundleItem,index,bundleLink)=>`
101        <div style="display:flex; gap:20px; justify-content: space-between;" id="CartBundleItem-${index}">
102          <div style="display:flex; gap:20px;">
103            <div style="text-align:center;">
104              <img
105                src="${bundleItem.image||""}"
106                alt="${bundleItem.label}" loading="lazy" width="75" height="75">
107            </div>
108            <div>
109              <a href="${bundleLink}"
110                 style="font-weight:600">
111                ${bundleItem.label||""}
112              </a>
113              <div>
114                ${bundleItem.items.map(item=>getItemsHtmlLoop(item)).join("")}
115                  <br/>
116                  <p><span>${bundleItem.sellingPlan||""}</span></p>
117              </div>
118            </div>
119          </div>
120          <div>
121            ${bundleItem.quantity}
122          </div>
123          <div>
124            <div style="display: flex; gap: 10px;">
125                ${bundleItem.priceWithoutDiscount!==bundleItem.price?`<span style="text-decoration:line-through;">
126                        ${bundleItem.priceWithoutDiscount}
127                    </span>`:""}
128              <span style="font-weight: 600;">${bundleItem.price}</span>
129            </div>
130            ${getEditCartButton(bundleItem.bundleId,bundleItem.editBtnText)}
131            <div onclick="removeBundleLoop('${bundleItem.bundleId}')" style="cursor:pointer; vertical-align: text-top; width: fit-content;height: 15px;display: inline-flex;flex-direction: row-reverse;">
132              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" style="width: 1em; height: 1em;" aria-hidden="true" focusable="false" role="presentation" class="icon icon-remove">
133                    <path d="M14 3h-3.53a3.07 3.07 0 00-.6-1.65C9.44.82 8.8.5 8 .5s-1.44.32-1.87.85A3.06 3.06 0 005.53 3H2a.5.5 0 000 1h1.25v10c0 .28.22.5.5.5h8.5a.5.5 0 00.5-.5V4H14a.5.5 0 000-1zM6.91 1.98c.23-.29.58-.48 1.09-.48s.85.19 1.09.48c.2.24.3.6.36 1.02h-2.9c.05-.42.17-.78.36-1.02zm4.84 11.52h-7.5V4h7.5v9.5z" fill="currentColor"></path>
134                    <path d="M6.55 5.25a.5.5 0 00-.5.5v6a.5.5 0 001 0v-6a.5.5 0 00-.5-.5zM9.45 5.25a.5.5 0 00-.5.5v6a.5.5 0 001 0v-6a.5.5 0 00-.5-.5z" fill="currentColor"></path>
135              </svg>
136            </div>
137          </div>
138        </div>
139    `,getPresetBundleCartTemplateLoop=(bundleItem,index,bundleLink)=>`
140        <tr class="cart-item" id="CartBundleItem-${index}">
141    <td class="cart-item__media">
142        <a href="${bundleLink}" class="cart-item__link" aria-hidden="true" tabindex="-1"> </a>
143          <div class="cart-item__image-container gradient global-media-settings">
144            <img src="${bundleItem.image||""}"  class="cart-item__image" alt="" loading="lazy" width="150" height="94">
145          </div>
146    </td>
147
148    <td class="cart-item__details"><a href="${bundleLink}" class="cart-item__name h4 break">${bundleItem.label}</a>
149        <div class="product-option">
150            ${bundleItem.items.map(item=>getItemsHtmlLoop(item,bundleItem.bundleQuantityMapping)).join("")}
151              <br/>
152        </div>
153        <div class="product-option">
154         ${bundleItem.eachBundleAmount}
155        </div><dl></dl>
156
157        <p class="product-option">${bundleItem.sellingPlan||""}</p>
158        ${bundleItem.discountTitle?`<ul class="discounts list-unstyled" role="list" aria-label="Discount">
159            <li class="discounts__discount">
160                <svg aria-hidden="true" focusable="false" role="presentation" class="icon icon-discount color-foreground-text" viewBox="0 0 12 12">
161                    <path fill-rule="evenodd" clip-rule="evenodd" d="M7 0h3a2 2 0 012 2v3a1 1 0 01-.3.7l-6 6a1 1 0 01-1.4 0l-4-4a1 1 0 010-1.4l6-6A1 1 0 017 0zm2 2a1 1 0 102 0 1 1 0 00-2 0z" fill="currentColor">
162                    </path>
163                </svg>
164                ${bundleItem.discountTitle}
165            </li>
166        </ul>`:""}
167    </td>
168
169    <td class="cart-item__totals right medium-hide large-up-hide">
170      <div class="cart-item__price-wrapper"><span class="price price--end">
171           ${bundleItem.final_line_price}
172          </span></div>
173    </td>
174
175    <td class="cart-item__quantity">
176      <div class="cart-item__quantity-wrapper">
177        <quantity-input class="quantity">
178          <input disabled class="quantity__input" type="number" value="${bundleItem.bundleProductQuantity}" min="0">
179        </quantity-input>
180        <cart-remove-button>
181          <a onclick="removeBundleLoop('${bundleItem.bundleId}')" class="button button--tertiary" aria-label="${bundleItem.label}" style="cursor : pointer">
182            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" aria-hidden="true" role="presentation" class="icon icon-remove">
183                <path d="M14 3h-3.53a3.07 3.07 0 00-.6-1.65C9.44.82 8.8.5 8 .5s-1.44.32-1.87.85A3.06 3.06 0 005.53 3H2a.5.5 0 000 1h1.25v10c0 .28.22.5.5.5h8.5a.5.5 0 00.5-.5V4H14a.5.5 0 000-1zM6.91 1.98c.23-.29.58-.48 1.09-.48s.85.19 1.09.48c.2.24.3.6.36 1.02h-2.9c.05-.42.17-.78.36-1.02zm4.84 11.52h-7.5V4h7.5v9.5z" fill="currentColor"></path>
184                <path d="M6.55 5.25a.5.5 0 00-.5.5v6a.5.5 0 001 0v-6a.5.5 0 00-.5-.5zM9.45 5.25a.5.5 0 00-.5.5v6a.5.5 0 001 0v-6a.5.5 0 00-.5-.5z" fill="currentColor"></path>
185            </svg>
186          </a>
187        </cart-remove-button>
188      </div>
189    </td>
190
191    <td class="cart-item__totals right small-hide">
192      <div class="cart-item__price-wrapper"><span class="price price--end">
193           ${bundleItem.final_line_price_currency}
194          </span></div>
195    </td>
196  </tr>
197    `,getPresetBundleCartDrawerTemplateLoop=(bundleItem,index,bundleLink)=>`
198        <tr class="cart-item" id="CartBundleItem-${index}">
199    <td class="cart-item__media">
200        <a href="${bundleLink}" class="cart-item__link" aria-hidden="true" tabindex="-1"> </a>
201          <div class="cart-item__image-container gradient global-media-settings">
202            <img src="${bundleItem.image||""}"  class="cart-item__image" alt="" loading="lazy" width="150" height="94">
203          </div>
204    </td>
205
206    <td class="cart-item__details"><a href="${bundleLink}" class="cart-item__name h4 break">${bundleItem.label}</a>
207                <div class="product-option">
208            ${bundleItem.items.map(item=>getItemsHtmlLoop(item,bundleItem.bundleQuantityMapping)).join("")}
209              <br/>
210        </div>
211        <div class="product-option">
212         ${bundleItem.eachBundleAmount}
213        </div><dl></dl>
214
215        <p class="product-option">${bundleItem.sellingPlan||""}</p>
216        ${bundleItem.discountTitle?`<ul class="discounts list-unstyled" role="list" aria-label="Discount">
217            <li class="discounts__discount">
218                <svg aria-hidden="true" focusable="false" role="presentation" class="icon icon-discount color-foreground-text" viewBox="0 0 12 12">
219                    <path fill-rule="evenodd" clip-rule="evenodd" d="M7 0h3a2 2 0 012 2v3a1 1 0 01-.3.7l-6 6a1 1 0 01-1.4 0l-4-4a1 1 0 010-1.4l6-6A1 1 0 017 0zm2 2a1 1 0 102 0 1 1 0 00-2 0z" fill="currentColor">
220                    </path>
221                </svg>
222                ${bundleItem.discountTitle}
223            </li>
224        </ul>`:""}
225    </td>
226
227    <td class="cart-item__totals right medium-hide large-up-hide">
228      <div class="cart-item__price-wrapper"><span class="price price--end">
229           ${bundleItem.final_line_price}
230          </span></div>
231    </td>
232
233    <td class="cart-item__quantity">
234      <div class="cart-item__quantity-wrapper">
235        <quantity-input class="quantity">
236          <input disabled class="quantity__input" type="number" value="${bundleItem.bundleProductQuantity}" min="0">
237        </quantity-input>
238        <cart-remove-button>
239          <a onclick="removeBundleLoop('${bundleItem.bundleId}')" class="button button--tertiary" aria-label="${bundleItem.label}" style="cursor : pointer">
240            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" aria-hidden="true" role="presentation" class="icon icon-remove">
241                <path d="M14 3h-3.53a3.07 3.07 0 00-.6-1.65C9.44.82 8.8.5 8 .5s-1.44.32-1.87.85A3.06 3.06 0 005.53 3H2a.5.5 0 000 1h1.25v10c0 .28.22.5.5.5h8.5a.5.5 0 00.5-.5V4H14a.5.5 0 000-1zM6.91 1.98c.23-.29.58-.48 1.09-.48s.85.19 1.09.48c.2.24.3.6.36 1.02h-2.9c.05-.42.17-.78.36-1.02zm4.84 11.52h-7.5V4h7.5v9.5z" fill="currentColor"></path>
242                <path d="M6.55 5.25a.5.5 0 00-.5.5v6a.5.5 0 001 0v-6a.5.5 0 00-.5-.5zM9.45 5.25a.5.5 0 00-.5.5v6a.5.5 0 001 0v-6a.5.5 0 00-.5-.5z" fill="currentColor"></path>
243            </svg>
244          </a>
245        </cart-remove-button>
246      </div>
247    </td>
248
249    <td class="cart-item__totals right small-hide">
250      <div class="cart-item__price-wrapper"><span class="price price--end">
251           ${bundleItem.final_line_price_currency}
252          </span></div>
253    </td>
254  </tr>
255    `,getItemKeysByBundleIdLoop=bundleId=>{const cartItems=window.Loop.bundleCartAllItems,data={updates:{}};for(const item of cartItems){const _bundleId=item?.properties?._bundleId??item?.properties?.bundleId;!_bundleId||_bundleId!==bundleId||(data.updates[item.key]=0)}return data},removeBundleLoop=async bundleId=>{const data=getItemKeysByBundleIdLoop(bundleId),endpoint=`${window.Shopify.routes.root}cart/update.js`;await fetch(endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(data)}),window.location.href=window.location.href},changeBundleCartItems=async bundleTransactionId=>{disableEditButton();const currentLocale=window?.Shopify?.locale,root=window?.Shopify?.routes?.root??"/";if(bundleTransactionId){const _editBundleRef=`${BUNDLE_LINK_PREFIX}/change/${bundleTransactionId}`;currentLocale&&root!=="/"?window.location.href=`/${currentLocale}${_editBundleRef}`:window.location.href=_editBundleRef}},disableEditButton=bundleId=>{console.log(`disabling bundle edit button: ${bundleId}`);const editButttons=document.querySelectorAll(`loop-edit-bundle-${bundleId}`);for(const button of editButttons)button.disabled=!0}
255,fetchLoopBundleTransactionCartDetails=async loopBundleGuid=>{const{locale}=window.Shopify,_locale=locale.split("-")[0],_endpoint=`${LOOP_BUNDLE_URL}/${loopBundleGuid}?locale=${_locale}`;return await(await fetch(_endpoint)).json()},addExtraDetailsToBundleItemsLoop=async bundleItems=>{let totalDiscount=0,currencySymbol="",currency="";const fetchDetailsPromises=bundleItems.map(bundleItem=>fetchLoopBundleTransactionCartDetails(bundleItem.bundleId)),allExtraDetails=await Promise.all(fetchDetailsPromises);for(let i=0;i<allExtraDetails.length;++i){const extraDetails=allExtraDetails[i],bundleItem=bundleItems[i],quantityMapping=extraDetails?.variantMap?.[bundleItem.bundleId]??[],isPresetBundleProduct=bundleItem.isPresetBundleProduct,totalBundleItemsQuantity=bundleItem.items.reduce((acc,item)=>acc+item.quantity,0);let price=isPresetBundleProduct?bundleItem.discounted_price:bundleItem.price;bundleItem.label=extraDetails?.label,bundleItem.image=extraDetails?.image,bundleItem.sellingPlan=extraDetails?.name,bundleItem.editBtnText=extraDetails.editBtnText??"Edit",bundleItem.priceWithoutDiscount=`${extraDetails.currencySymbol}${price.toFixed(2)}`,bundleItem.final_line_price_currency=`${extraDetails.currencySymbol}${parseFloat(bundleItem.final_line_price).toFixed(2)}`,bundleItem.loopBundleId=extraDetails.loopBundleId,currencySymbol=extraDetails.currencySymbol,currency=extraDetails.currency,extraDetails.discountType&&extraDetails.discountValue&&!isPresetBundleProduct&&(extraDetails.discountType==="PERCENTAGE"?extraDetails.appliesOnEachItem?(totalDiscount+=price*(parseFloat(extraDetails.discountValue)/100)*totalBundleItemsQuantity,price=price-price*(parseFloat(extraDetails.discountValue)/100)*totalBundleItemsQuantity):(totalDiscount+=price*(parseFloat(extraDetails.discountValue)/100),price=price-price*(parseFloat(extraDetails.discountValue)/100)):extraDetails.appliesOnEachItem?(totalDiscount+=parseFloat(extraDetails.discountValue)*totalBundleItemsQuantity,price=price-parseFloat(extraDetails.discountValue)*totalBundleItemsQuantity):(totalDiscount+=parseFloat(extraDetails.discountValue),price=price-parseFloat(extraDetails.discountValue))),bundleItem.price=`${extraDetails.currencySymbol}${parseFloat(price).toFixed(2)}`,extraDetails?.productsQuantity?(bundleItems[i].bundleProductQuantity=extraDetails.productsQuantity,bundleItems[i].eachBundleAmount=`${extraDetails.currencySymbol}${parseFloat(bundleItems[i].final_line_price/extraDetails.productsQuantity).toFixed(2)}`):(bundleItems[i].bundleProductQuantity=1,bundleItems[i].eachBundleAmount=`${extraDetails.currencySymbol}${parseFloat(price/1).toFixed(2)}`),quantityMapping.length&&(bundleItem.bundleQuantityMapping=quantityMapping),isPresetBundleProduct&&(bundleItem.productHandle=extraDetails.product_handle)}removeDiscountFromSubtotalInCartLoop(totalDiscount,currencySymbol,currency)},removeDiscountFromSubtotalInCartLoop=(totalDiscount,currencySymbol,currency)=>{let targetNode=null;targetNode=document.querySelector(".totals__subtotal-value"),targetNode&&applyDiscountByCartLineItemsLoop(targetNode,totalDiscount,currencySymbol,currency)};function applyDiscountByCartLineItemsLoop(element,discount,currencySymbol,currency){const discountedPrice=((window.Loop.bundleCartAllItems.reduce((acc,item)=>acc+(item.properties._isPresetBundleProduct?item.discounted_price:item.price)*item.quantity,0)/100).toFixed(2)-discount).toFixed(2);isNaN(discountedPrice)||(element.innerHTML=`${currencySymbol??""}${discountedPrice} ${currency??""}`)}const getBundleItemsLoop=items=>{const bundleItemsMap={};for(const item of items){const bundleId=item?.properties?._bundleId??item?.properties?.bundleId;bundleId&&(Object.hasOwn(bundleItemsMap,bundleId)?(bundleItemsMap[bundleId].price+=Number(item.price)*Number(item.quantity)/100,bundleItemsMap[bundleId].discounted_price+=Number(item.discounted_price)*Number(item.quantity)/100,bundleItemsMap[bundleId].amount+=Number(item.price)*Number(item.quantity)/100,bundleItemsMap[bundleId].final_line_price+=Number(item.final_line_price)/100,bundleItemsMap[bundleId].items.push(item)):bundleItemsMap[bundleId]={bundleId,quantity:1,price:Number(item.price)*Number(item.quantity)/100,amount:Number(item.price)*Number(item.quantity)/100,items:[item],discounted_price:Number(item.discounted_price)*Number(item.quantity)/100,isPresetBundleProduct:item?.properties?._isPresetBundleProduct,discountTitle:item?.discounts?.[0]?.title??"",final_line_price:Number(item.final_line_price)/100})}
255return sortItemsByTitleLoop(Object.values(bundleItemsMap))},sortItemsByTitleLoop=bundles=>bundles.map(bundle=>(bundle.items.sort((a,b)=>{let titleA=a.title.toUpperCase(),titleB=b.title.toUpperCase();return titleA<titleB?-1:titleA>titleB?1:0}),bundle)),renderBundleItemsLoop=(bundleItems,clientId)=>{let _parent=document.querySelector(`.${clientId}`);if(_parent||(_parent=document.querySelector(`.${BUNDLE_CONTAINER_CLASS}`)),!!_parent)for(let i=0;i<bundleItems.length;++i){let bundleItem=bundleItems[i];const _bundleLink=bundleItem.isPresetBundleProduct?`https://${window.Shopify.shop}/products/${bundleItem.productHandle}`:`${BUNDLE_LINK_PREFIX}/${bundleItem.loopBundleId}`;let _template,hasTable=document.getElementsByTagName("table");bundleItem.isPresetBundleProduct&&window.location.pathname==="/cart"?_template=getPresetBundleCartTemplateLoop(bundleItem,i+1,_bundleLink):bundleItem.isPresetBundleProduct&&window.location.pathname!=="/cart"?_template=getPresetBundleCartDrawerTemplateLoop(bundleItem,i+1,_bundleLink):clientId.includes("drawer")&&hasTable.length?_template=getBundleCartDrawerTemplateLoop(bundleItem,i+1,_bundleLink):hasTable.length?_template=getBundleCartTableTemplateLoop(bundleItem,i+1,_bundleLink):_template=getBundleCartItemsDivTemplateLoop(bundleItem,i+1,_bundleLink),_parent.innerHTML=`${_template} ${_parent.innerHTML}`}};async function getCartItemsLoop(){const url=`https://${Shopify.cdnHost.split("/cdn")[0]}/cart.json`;return(await(await fetch(url)).json())?.items??[]}function setupMutationLoop(_bundleItems){if(!_bundleItems?.length||window.location.pathname.includes("/a/loop_subscriptions/bundle"))return;let previousQuantity=window.Loop.bundleCartAllItems.reduce((acc,curr)=>acc+curr.quantity,0),timeoutId;const handleChanges=async()=>{(await getCartItemsLoop()).reduce((acc,curr)=>acc+curr.quantity,0)!==previousQuantity&&window.location.reload()};let targetNodes=document.querySelectorAll("form");const config={childList:!0,subtree:!0};targetNodes.forEach(targetNode=>{new MutationObserver(()=>{clearTimeout(timeoutId),timeoutId=setTimeout(handleChanges,500)}).observe(targetNode,config)})}function setupMutationIfElementDelete(){let firstChange=!0,timeoutId;const handleChanges=()=>{firstChange?firstChange=!1:window.location.pathname.includes("/a/loop_subscriptions/bundle")||(firstChange=!0,window.location.reload())};let targetNode=document.querySelector(".cart-container");if(targetNode||(targetNode=document.querySelector(".cart__blocks")),!targetNode)return;const observer=new MutationObserver(()=>{clearTimeout(timeoutId),timeoutId=setTimeout(handleChanges,1e3)}),config={childList:!0,subtree:!0};observer.observe(targetNode,config)}function setupMutationOldLoop(){var firstChange=!0;let targetNode=null,observerNode=null;if(targetNode=document.querySelectorAll("[data-cart-subtotal]"),targetNode&&targetNode.length>1||!targetNode.length?observerNode=document.querySelector(`.${CART_SUBTOTAL_CLASS}`):observerNode=targetNode[0],!observerNode)return;const config={attributes:!0,childList:!0,subtree:!0},callback=(mutationList,observer2)=>{if(firstChange){firstChange=!1;return}else firstChange=!0,setTimeout(window.location.reload(),1e3)};new MutationObserver(callback).observe(observerNode,config)}const initLoopBundle=async clientId=>{console.log(`Loop Bundle Initialized for ${clientId}`);const _cartItems=window.Loop.bundleCartAllItems,_bundleItems=getBundleItemsLoop(_cartItems);await addExtraDetailsToBundleItemsLoop(_bundleItems),setupMutationLoop(_bundleItems),renderBundleItemsLoop(_bundleItems,clientId)};
256//# sourceMappingURL=/cdn/shop/t/9/assets/loop_bundle.js.map?v=134193039818244484621774992385

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.