PageSourceSearch

https://order.doughnutplant.com/js/703.d97103b1.js

js doughnutplant.com collected 2026-09-26 05:07:02 UTC 14,305 bytes, 2 lines download raw bytes

1"use strict";(self["webpackChunklunchbox_storefront"]=self["webpackChunklunchbox_storefront"]||[]).push([[703],{12703:function(e,t,s){s(44114),s(18111),s(81148),s(22489),s(20116),s(7588),s(13579),s(33110);var r=s(49148),o=s.n(r),a=s(79634),i=s(5771),d=s(31006),c=s(18325);t.A={methods:{async reorderClicked(e){if(this.errorInReorderProcess=!1,this.selectedOrderId=e,this.SET_BUTTON_LOADER(!0),localStorage.removeItem("selectedOrderType"),await this.getOrder(e),this.errorInReorderProcess)return;this.SET_ORDER_DATA(null);let t=this.reorderData.order.service_type_id,s=this.reorderData.restaurant.store_id,r=this.reorderData.order.customer_location_id,o=this.reorderData.customer_location;if(await this.getStore(s,t,o),this.errorInReorderProcess)return;if(!this.selectedStore?.is_open&&this.storeConfig?.disable_future_orders)return this.SET_BUTTON_LOADER(!1),this.SET_TOASTER({show:!0,message:"This store is currently closed. Please try again during business hours."}),void(this.errorInReorderProcess=!0);if(this.reorderData.customer_location&&await this.getAddress(r),this.errorInReorderProcess)return;if(await this.createOrder(s,t,r,e),this.errorInReorderProcess)return;this.SET_BUTTON_LOADER(!1);let a=this.selectedStore.name.toLowerCase().replace(/ /g,"-").replace(/[^\w-]+/g,"");this.$router.push({name:"MenuView",params:{storeId:s,storeName:a}})},async getOrder(e){await i.A.getOrder(e).then(e=>{this.reorderData=e.data.data,this.SET_COOKIES(e.data.cookies)}).catch(e=>{console.log(e),this.SET_BUTTON_LOADER(!1);let t={show:!0,message:"Something went wrong. Please try again"};this.SET_TOASTER(t),this.errorInReorderProcess=!0})},async getStore(e,t,s){let r={store_id:e,service_schedule:!0,service_type_id:t};s&&(r.latitude=s.latitude,r.longitude=s.longitude),await d.A.getStore(null,r).then(e=>{this.SET_SELECTED_STORE(e.data.data[0]),localStorage.setItem("selectedStoreId",e.data.data[0].store_id),localStorage.setItem("deliveryInfo",JSON.stringify(e.data.data[0].delivery_info));let s=this.storeConfig.services.find(e=>e.service_type_id==t);localStorage.setItem("selectedServiceId",s.service_type_id),this.SET_SELECTED_SERVICE(s),this.SET_COOKIES(e.data.cookies);let r=e.data.data[0];const a=this.selectedStore.timezone_offset_mins,i=o()().utcOffset(a).format("MM/DD/YYYY"),d=!0===this.branding?.display_options?.asap_schedule_toggle_enabled;d?this.getDayAndHoursForOrderType(r,t,i,a):this.getDaysAndHours(r,t,i,a)}).catch(e=>{console.log(e),this.SET_BUTTON_LOADER(!1);let t={show:!0,message:"The location that this order was placed from is no longer available."};this.SET_TOASTER(t),this.errorInReorderProcess=!0})},async getAddress(e){let t=localStorage.getItem("customerId"),s={address_id:e};await c.A.getAddresses(t,s).then(e=>{localStorage.setItem("selectedAddress",JSON.stringify(e.data.data[0])),this.SET_COOKIES(e.data.cookies)}).catch(()=>{this.SET_BUTTON_LOADER(!1);let e={show:!0,message:"Something went wrong. Please try again"};this.SET_TOASTER(e),this.errorInReorderProcess=!0})},async createOrder(e,t,s,r){const o=!0===this.branding?.display_options?.asap_schedule_toggle_enabled;if(!this.selectedStoreDays||0===this.selectedStoreDays.length)return this.SET_BUTTON_LOADER(!1),this.SET_TOASTER({show:!0,message:"This store is currently closed and unavailable for orders. Please try again during business hours!"}),void(this.errorInReorderProcess=!0);const a="ASAP"===this.selectedStoreDays?.[0]?.hours?.[0]?.hour,d=a?"ASAP":"future";localStorage.setItem("selectedOrderType",d);let c={customer_id:localStorage.getItem("customerId"),is_asap:o?"ASAP"===d:"ASAP"==this.selectedStoreDays?.[0]?.hours?.[0]?.hour,store_id:e,service_type_id:parseInt(t),base_order_id:r};const l=this.selectedDay||this.selectedStoreDays?.[0],n=this.selectedHour||this.selectedStoreDays?.[0]?.hours?.[0];let h=l,u=n;if(o&&"future"===d&&(!u||"ASAP"===u.hour)){const e=()=>{if(h&&Array.isArray(h.hours)){const e=h.hours.find(e=>"ASAP"!==e.hour);if(e)return{d:h,h:e}}if(Array.isArray(this.selectedStoreDays))for(let e=0;e<this.selectedStoreDays.length;e++){const t=this.selectedStoreDays[e];if(!t||!Array.isArray(t.hours))continue;const s=t.hours.find(e=>"ASAP"!==e.hour);if(s)return{d:t,h:s}}return{d:h,h:u}},t=e();h=t.d,u=t.h,h&&(this.SET_SELECTED_DAY(h),localStorage.setItem("selectedDay",JSON.stringify(h))),u&&(this.SET_SELECTED_HOUR(u),localStorage.setItem("selectedHour",JSON.stringify(u)))}o?"ASAP"!==d&&u&&"ASAP"!==u.hour&&(c.ready_ts=u.nextDayDate?u.nextDayDate+" "+u.hour:h.date+" "+u.hour):u&&"ASAP"!=u.hour&&(c.ready_ts=h.date+" "+u.hour),this.reorderData.customer_location&&(c.address_id=s),await i.A.createOrder(c).then(async e=>{localStorage.setItem("orderId",e.data.data.order.order_id),this.SET_ORDER_DATA(e.data.data),localStorage.setItem("dayAndTimeSelected",!0),this.SET_DAY_AND_TIME_SELECTED(!0),this.SET_COOKIES(e.data.cookies);const t=await this.removeReorderedDonationItem(e.data.data);await this.removeReorderedDisabledNotes(t),e.data.data.coupons&&e.data.data.coupons.length>0&&await this.removeAutoAppliedCoupons(e.data.data)}).catch(e=>{console.log(e),this.SET_BUTTON_LOADER(!1);let t={show:!0,message:"Something went wrong. Please try again"};this.SET_TOASTER(t),this.errorInReorderProcess=!0})},async removeReorderedDonationItem(e){let t=e;try{const s=e?.order?.items||[],r=s.filter(e=>"donation"===e.item_type);if(0===r.length)return t;const o=e.order.order_id;for(const e of r){const s=await i.A.removeItemFromCart(o,e.order_item_id);t=s.data.data,this.SET_ORDER_DATA(t),this.SET_COOKIES(s.data.cookies)}}catch(s){console.log("Error removing donation from reorder:",s)}return t},isDeliveryInstructionsDisabled(e){const t=this.branding?.display_options;return!(t?.display_delivery_note&&t?.delivery_note_service_types?.includes(e?.service_type_id))},isItemNoteDisabled(e,t){return"boolean"===typeof e?.disable_special_instructions?e.disable_special_instructions:t},async removeReorderedDisabledNotes(e){let t=e;try{const e=t?.order;if(!e)return t;const s=e.order_id,r=!0===e.disable_special_instructions,o={};if(r&&e.comments_to_restaurant&&(o.comments_to_restaurant=""),this.isDeliveryInstructionsDisabled(e)&&e.delivery_directions&&(o.delivery_directions=""),Object.keys(o).length>0){const e=await i.A.updateOrderWithPut(s,{order:o});t=e.data.data,this.SET_ORDER_DATA(t),this.SET_COOKIES(e.data.cookies)}const a=localStorage.getItem("customerId")||localStorage.getItem("guestCustomerId"),d=(t?.order?.items||[]).filter(e=>e.comment&&this.isItemNoteDisabled(e,r));for(const c of d){const e={customer_id:a,items:[{...c,comment:""}]},r=await i.A.updateItemOnCart(s,e);t=r.data.data,this.SET_ORDER_DATA(t),this.SET_COOKIES(r.data.cookies)}}catch(s){console.log("Error removing disabled notes from reorder:",s)}return t},async removeAutoAppliedCoupons(e){try{const t=e.order.order_id,s=localStorage.getItem("customerId")||localStorage.getItem("guestCustomerId"),r=this.reorderData?.coupons||[];for(const o of e.coupons){const e=r.some(e=>e.coupon_id===o.coupon_id||e.clu===o.clu);if(e){const e={customer_id:parseInt(s),discount_id:parseInt(o.coupon_id)};await i.A.removeDiscount(t,e).then(e=>{this.SET_ORDER_DATA(e.data.data),this.SET_COOKIES(e.data.cookies)}).catch(e=>{console.log("Error removing coupon from base order:",e)})}}}catch(t){console.log("Error in removeAutoAppliedCoupons:",t)}},getDaysAndHours(e,t,s,r){let i=[],d=o()().utcOffset(r).format("HH:mm"),c=localStorage.getItem("selectedServiceId"),l=this.selectedStore.services.find(e=>e.service_type_id==c),n=l?.base_prep_time||0,h=l?.lead_time||0,u=o()().utcOffset(r).minutes()+60*o()().utcOffset(r).hours();if("undefined"===typeof e.service_schedule[t]||0===Object.keys(e.service_schedule[t]).length||Object.values(e.service_schedule[t]).every(e=>0===e.length))return this.SET_SELECTED_STORE_DAYS([]),null;
1Object.entries(e.service_schedule[t]).forEach(([r,a])=>{0==a.length&&delete e.service_schedule[t][r],a.forEach(a=>{if(a[1]>1440&&o()(r).isBefore(o()(s,"MM/DD/YYYY").format("YYYY-MM-DD"))){let s=o()(r,"YYYY-MM-DD").add(1,"days").format("YYYY-MM-DD");"undefined"===typeof e.service_schedule[t][s]&&(e.service_schedule[t][s]=[]),e.service_schedule[t][s].unshift([a[0]-1440,a[1]-1440])}})}),Object.entries(e.service_schedule[t]).forEach(([e,t])=>{if(!o()(e,"YYYY-MM-DD").isBefore(o()(s,"MM/DD/YYYY"),"day")){var r=[];t.forEach(t=>{let s=t[1];1440!==s?s-=15:s=1435;for(var i=t[0];i<=s;i+=15){let t=this.calculateTimeToHour(i),s=!1,d=null;i>=1440&&(t=this.calculateTimeToHour(i-1440),s=!0,d=o()(e,"YYYY-MM-DD").add(1,"days").format("YYYY-MM-DD")),r.push({hour:t,formatted:(0,a.Wk)(o()(t,"HH:mm")),originalHour:i,isNextDay:s,nextDayDate:d})}}),r.sort((e,t)=>e.originalHour-t.originalHour),i.push({date:e,formatted:e==o()(s,"MM/DD/YYYY").format("YYYY-MM-DD")?`Today (${(0,a.lW)(o()(e))})`:e==o()(s,"MM/DD/YYYY").add(1,"days").format("YYYY-MM-DD")?`Tomorrow (${(0,a.lW)(o()(e))})`:`${o()(e,"YYYY-MM-DD").format("dddd")} (${(0,a.lW)(o()(e))})`,hours:r})}});let _=u+n,S=o()().format("YYYY-MM-DD"),D=o()().subtract(1,"days").format("YYYY-MM-DD"),f=e.service_schedule[t][S]||[],m=e.service_schedule[t][D]||[],E=(m[0]?.[1]||-1)-1440,g=(m[0]?.[0]||-1)-1440,Y=f[0]?.[1]||-1,y=f[0]?.[0]||-1,T=!1;const A=this.storeConfig?.delivery_provider_grace_period||0;m.length>0?g-h<=_&&_<=E&&(T=!0):y-h<=_&&_<=Y&&(T=!0);const O=this.selectedStore.services.find(e=>e.service_type_id==c);O&&O.requires_address&&A>0&&(T=!0);const p=o()().utcOffset(r).format("YYYY-MM-DD");let v=i.find(e=>e.date===p);if(!v&&this.selectedStore.is_open&&T&&(v={date:p,formatted:`Today (${(0,a.lW)(o()(p))})`,hours:[]},i.push(v)),v&&(this.selectedStore.is_open&&T?v.hours.unshift({hour:"ASAP",asapTime:d,formatted:"ASAP"}):0===v.hours.length&&(i=i.filter(e=>e.date!==p))),i.sort((e,t)=>o()(e.date).diff(o()(t.date))),this.storeConfig?.disable_future_orders){if(i.length>0){const e=[{...i[0],hours:[]}];e.forEach(e=>{e.hours.push({hour:"ASAP",asapTime:d,formatted:"ASAP"})}),this.SET_SELECTED_STORE_DAYS(e),localStorage.setItem("selectedStoreDays",JSON.stringify(e))}}else if(this.SET_SELECTED_STORE_DAYS(i),localStorage.setItem("selectedStoreDays",JSON.stringify(i)),0===i.length||i.every(e=>0===e.hours.length))return void this.SET_SELECTED_STORE_DAYS([]);if(this.selectedStoreDays&&this.selectedStoreDays.length>0){this.SET_SELECTED_DAY(this.selectedStoreDays[0]),localStorage.setItem("selectedDay",JSON.stringify(this.selectedStoreDays[0])),this.SET_SELECTED_HOUR(this.selectedStoreDays[0].hours[0]),localStorage.setItem("selectedHour",JSON.stringify(this.selectedStoreDays[0].hours[0]));const e="ASAP"==this.selectedStoreDays[0].hours[0].hour?"ASAP":"future";localStorage.setItem("selectedOrderType",e)}},getDayAndHoursForOrderType(e,t,s,r){let i=[],d=!1;if("undefined"===typeof e.service_schedule[t]||0===Object.keys(e.service_schedule[t]).length||Object.values(e.service_schedule[t]).every(e=>0===e.length))return this.SET_SELECTED_STORE_DAYS([]),null;let c=localStorage.getItem("selectedServiceId"),l=this.selectedStore.services.find(e=>e.service_type_id==c),n=l?.base_prep_time||0,h=l?.lead_time||0,u=o()().utcOffset(r).minutes()+60*o()().utcOffset(r).hours();Object.entries(e.service_schedule[t]).forEach(([r,a])=>{0==a.length&&delete e.service_schedule[t][r],a.forEach(a=>{if(a[1]>1440&&o()(r).isBefore(o()(s,"MM/DD/YYYY").format("YYYY-MM-DD"))){let s=o()(r,"YYYY-MM-DD").add(1,"days").format("YYYY-MM-DD");"undefined"===typeof e.service_schedule[t][s]&&(e.service_schedule[t][s]=[]),e.service_schedule[t][s].unshift([a[0]-1440,a[1]-1440])}})}),Object.entries(e.service_schedule[t]).forEach(([e,t])=>{if(!o()(e,"YYYY-MM-DD").isBefore(o()(s,"MM/DD/YYYY"),"day")){var r=[];t.forEach(t=>{let s=t[1];1440!==s?s-=15:s=1435;for(var i=t[0];i<=s;i+=15){let t=this.calculateTimeToHour(i),s=!1,d=null;i>=1440&&(t=this.calculateTimeToHour(i-1440),s=!0,d=o()(e,"YYYY-MM-DD").add(1,"days").format("YYYY-MM-DD")),r.push({hour:t,formatted:(0,a.Wk)(o()(t,"HH:mm")),originalHour:i,isNextDay:s,nextDayDate:d})}}
1),r.sort((e,t)=>e.originalHour-t.originalHour),i.push({date:e,formatted:e==o()(s,"MM/DD/YYYY").format("YYYY-MM-DD")?`Today (${(0,a.lW)(o()(e))})`:e==o()(s,"MM/DD/YYYY").add(1,"days").format("YYYY-MM-DD")?`Tomorrow (${(0,a.lW)(o()(e))})`:`${o()(e,"YYYY-MM-DD").format("dddd")} (${(0,a.lW)(o()(e))})`,hours:r})}});let _=u+n,S=o()().format("YYYY-MM-DD"),D=o()().subtract(1,"days").format("YYYY-MM-DD"),f=e.service_schedule[t][S]||[],m=e.service_schedule[t][D]||[],E=(m[0]?.[1]||-1)-1440,g=(m[0]?.[0]||-1)-1440,Y=f[0]?.[1]||-1,y=f[0]?.[0]||-1,T=!1;const A=this.storeConfig?.delivery_provider_grace_period||0;m.length>0?g-h<=_&&_<=E&&(T=!0):y-h<=_&&_<=Y&&(T=!0),l&&l.requires_address&&A>0&&(T=!0);const O=o()().utcOffset(r).format("YYYY-MM-DD");let p=i.find(e=>e.date===O);if(!p&&this.selectedStore.is_open&&T&&(p={date:O,formatted:`Today (${(0,a.lW)(o()(O))})`,hours:[]},i.push(p)),p)if(this.selectedStore.is_open&&T){d=!0;let e=o()().utcOffset(r).format("HH:mm");p.hours.unshift({hour:"ASAP",asapTime:e,formatted:"ASAP"})}else 0===p.hours.length&&(i=i.filter(e=>e.date!==O));if(localStorage.setItem("selectedOrderType",d?"ASAP":"future"),i.sort((e,t)=>o()(e.date).diff(o()(t.date))),this.storeConfig?.disable_future_orders){const e=i.length>0?[{...i[0],hours:[]}]:[];e.forEach(e=>{e.hours.push({hour:"ASAP",asapTime:o()().utcOffset(r).format("HH:mm"),formatted:"ASAP"})}),this.SET_SELECTED_STORE_DAYS(e),localStorage.setItem("selectedStoreDays",JSON.stringify(e)),localStorage.setItem("selectedOrderType","ASAP")}else if(this.SET_SELECTED_STORE_DAYS(i),localStorage.setItem("selectedStoreDays",JSON.stringify(i)),0===i.length||i.every(e=>0===e.hours.length))return void this.SET_SELECTED_STORE_DAYS([]);if(this.selectedStoreDays&&this.selectedStoreDays.length>0)if(this.SET_SELECTED_DAY(this.selectedStoreDays[0]),localStorage.setItem("selectedDay",JSON.stringify(this.selectedStoreDays[0])),"ASAP"===this.selectedStoreDays[0].hours[0].hour){const e=this.selectedStoreDays[0].hours[0];this.SET_SELECTED_HOUR(e),localStorage.setItem("selectedHour",JSON.stringify(e))}else this.SET_SELECTED_HOUR(this.selectedStoreDays[0].hours[0]),localStorage.setItem("selectedHour",JSON.stringify(this.selectedStoreDays[0].hours[0]))},calculateTimeToHour(e){return("0"+Math.floor(parseInt(e)/60)).slice(-2)+":"+("0"+e%60).slice(-2)}}}}}]);
2//# sourceMappingURL=703.d97103b1.js.map

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.