|
const GB_BUY={availableWindows:[],loadAvailableWindows:()=>{const t=encodeURIComponent(window.CART_COLLECTIONS.filter((t,e)=>window.CART_COLLECTIONS.indexOf(t)===e).join(",")),e=Shopify.shop.replace(".myshopify.com","");fetch(`https://grocerbox.ngrok.io/shopify/private_shops/${encodeURIComponent(e)}/available_windows?collections=${t}&window_count=30`,{method:"GET",mode:"cors",cache:"no-cache"}).then(t=>t.json()).then(t=>{GB_BUY.availableWindows=t.map(t=>{const[e,n,a]=t.date.split("-"),i=new Date(e,parseInt(n,10)-1,a);return{window:t,code:t.code,day:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][i.getDay()],month:["January","February","March","April","May","June","July","August","September","October","November","December"][i.getMonth()],date:i.getDate(),name:t.name}})})},initializeTimeSlots:t=>{const e=t.model.customAttributes.filter(({key:t})=>"Date"===t)[0],n=t.model.customAttributes.filter(({key:t})=>"code"===t)[0],a=t.model.customAttributes.filter(({key:t})=>"window"===t)[0];let i |