"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4936],{94936:function(e,t,r){r.r(t),r.d(t,{CartProvider:function(){return p},useCart:function(){return g}});var n=r(91674),s=r(86655),a=r(34449),o=r(78141),i=r(88905),u=r(59096),c=r(55454),d=r(3372);let l=(0,s.createContext)(void 0);function p(e){let{children:t,entityId:r,entityGuid:p}=e,g=(0,i.cg)(r),y=(0,a.U0)(),[h,m]=(0,s.useState)(null),[S,E]=(0,s.useState)([]),[_,I]=(0,s.useState)(null),[f,P]=(0,s.useState)(!1),[D,A]=(0,s.useState)(!1),T=async(e,t)=>{var r;let{response:n}=null!==(r=await (0,d.Qk)(e))&&void 0!==r?r:{};n&&E(n),I(t),P(!0)},O=(0,s.useCallback)(async()=>{if(null===g)return;let{status:e,response:t}=await (0,d.n4)(g);if(200===e&&t){if(g===t.businessEntityId)m(t),T(g,t.paymentTypeId);else{let{response:e}=await (0,d.$J)({businessEntityId:g,businessEntityGuid:p,orderTypeId:o.hv.PickUp,scheduledFor:null,deliveryAddress:null});m(e),e&&T(g,e.paymentTypeId)}return}let{response:r}=await (0,d.$J)({businessEntityId:g,businessEntityGuid:p,orderTypeId:o.hv.PickUp,scheduledFor:null,deliveryAddress:null});m(r),r&&T(g,r.paymentTypeId)},[g,p]);(0,s.useEffect)(()=>{O()},[g,p,O]);let{toast:R}=(0,u.c)(),N=(0,s.useMemo)(()=>{let e=async e=>{try{let{status:t,response:r,error:n}=await (0,d.eC)(e);if(200===t&&r)return m(r),{success:!0,error:null};return{success:!1,error:n||"Error adding item to cart"}}catch(e){return R({title:"Error adding item to cart",description:e.message||"",type:"error"}),{success:!1,error:e.message||""}}},t=async e=>{try{let{response:t}=await (0,d.S3)({orderItemId:e},g);if(t)return m(t),{success:!0,error:null};return{success:!1,error:"Error deleting item from cart"}}catch(e){return R({title:"Error deleting item from cart",description:e.message||"",type:"error"}),{success:!1,error:e.message||""}}},r=async e=>{try{let{status:t,response:r,error:n}=await (0,d.dU)(e,g);if(200===t&&r)return m(r),{success:!0,error:null};return{success:!1,error:n||"Error editing item in cart"}}catch(e){return R({title:"Error editing item in cart",description:e.message||"",type:"error"}),{success:!1,error:e.message||""}}},n=async e=>{try{let{status:r,error:n,response:s}=await (0,d.S)(e,g);if(s){var t;return m(s),null==y||y.capture("update_shopping_cart",{restaurant_id:g,order_type:null==e?void 0:e.orderTypeId,can_checkout:null==s?void 0:s.canCheckOut,can_not_checkout_message:null==s?void 0:null===(t=s.canNotCheckOutDetails)||void 0===t?void 0:t.message,return_value:r,return_message:"Updated successfully."}),T(s.businessEntityId,s.paymentTypeId),{success:!0,error:null}}return null==y||y.capture("update_shopping_cart_error",{error_type:c.qz.Api,restaurant_id:g,order_type:null==e?void 0:e.orderTypeId,return_value:r,return_message:n}),{success:!1,error:"Error updating shopping cart"}}catch(t){return null==y||y.capture("update_shopping_cart_error",{error_type:c.qz.Api,restaurant_id:g,order_type:null==e?void 0:e.orderTypeId,return_value:500,return_message:t.message||""}),{success:!1,error:t.message||""}}},s=async(e,t)=>{try{let{response:r,error:n}=await (0,d.M6)(e,t);if(r)return m(r),{success:!0,error:null};return{success:!1,error:n}}catch(e){return{success:!1,error:e.message||""}}},a=async(e,t)=>{try{let{response:r,error:n}=await (0,d.S7)(e,t);if(r)return m(r),{success:!0,error:null};return{success:!1,error:n}}catch(e){return{success:!1,error:e.message}}},o=async e=>{try{let{response:t}=await (0,d.zS)(e);if(t)return m(t),{success:!0,error:null};return{success:!1,error:"Error removing coupon"}}catch(e){return{success:!1,error:e.message||""}}},i=async(e,t,r)=>{try{let{status:n,error:s,response:a}=await (0,d.mV)(e,t,r);if(a)return m(a),{success:!0,error:null};return null==y||y.capture("set_tip_amount_error",{error_type:c.qz.Api,restaurant_id:t,tip_amount:Number(e),return_value:n,return_message:s}),{success:!1,error:"Error setting tip amount"}}catch(r){return null==y||y.capture("set_tip_amount_error",{error_type:c.qz.Exception,restaurant_id:t,tip_amount:Number(e),return_value:500,return_message:r.message||""}),{success:!1,error:r.message||""}}},u=async(e,t,r)=>{try{let{response:n}=await (0,d.JU)(e,t,r);if(n)return m(n),{success:!0,error:null};return{success:!1,error:"Error setting tip percentage"}}catch(e){return{success:!1,error:e.message||""}}},l=async e=>{try{let{response:t}=await (0,d.q5)({paymentTypeId:e},g);if(I(e),t)return m(t),{success:!0,error:null};return{success:!1,error:"Error setting payment type"}}catch(e){return{success:!1,error:e.message||""}}};return{storageCart:h,paymentTypes:S,selectedPaymentType:_,setStorageCart:m,updateStoragePaymentType:l,loaded:f,cartDrawerIsOpen:D,closeCartDrawer:()=>A(!1),openCartDrawer:()=>A(!0),addItem:e,deleteItem:t,editItem:r,updateShoppingCart:n,addCouponById:s,addCouponByCode:a,removeCoupon:o,setTipAmount:i,setTipPercentage:u}},[h,S,_,f,D,R,g,y]);return(0,n.jsx)(l.Provider,{value:N,children:t})}function g(){let e=(0,s.useContext)(l);if(void 0===e)throw Error("useCart must be used within a CartProvider");return e}},3372:function(e,t,r){r.d(t,{$J:function(){return c},DK:function(){return v},JU:function(){return R},M6:function(){return _},Qk:function(){return i},S:function(){return l},S3:function(){return S},S7:function(){return f},dU:function(){return h},eC:function(){return g},mV:function(){return T},n4:function(){return o},q5:function(){return C},zS:function(){return D}});var n=r(88905);let s=async e=>{let t=(0,n.MS)(e);return fetch("/api/cart/".concat(t,"/getshoppingcart"),{method:"GET",credentials:"include"}).then(async e=>({status:e.status,response:await e.json()}))},a=async e=>fetch("/api/payments/".concat((0,n.MS)(e),"/payment-types"),{method:"GET",credentials:"include"}).then(async e=>({status:e.status,response:(await e.json()).paymentTypes})),o=e=>s(e).then(e=>{let{status:t,response:r}=e;return{status:t,error:200!==t&&r.message||"Something wrong happened!",response:200===t?r:null}}),i=e=>a(e).then(e=>{let{status:t,response:r}=e;return{status:t,error:200!==t&&r.message||"Something wrong happened!",response:200===t?r:null}}),u=async e=>{let t=(0,n.MS)(e.businessEntityId);return fetch("/api/cart/".concat(t,"/createshoppingcart"),{method:"POST",body:JSON.stringify(e),credentials:"include"}).then(async e=>({status:e.status,response:await e.json()}))},c=e=>u(e).then(e=>{let{status:t,response:r}=e;return{status:t,error:200!==t&&r.message||"Something wrong happened!",response:200===t?r:null}}),d=async(e,t)=>{let r=(0,n.MS)(t);return fetch("/api/cart/".concat(r,"/updateshoppingcart"),{method:"POST",body:JSON.stringify(e),credentials:"include"}).then(async e=>({status:e.status,response:await e.json()}))},l=(e,t)=>d(e,t).then(e=>{let{status:t,response:r}=e;return{status:t,error:200!==t&&r.message||"Something wrong happened!",response:200===t?r:null}}),p=async e=>{let t=(0,n.MS)(e.businessEntityId);return fetch("/api/cart/".concat(t,"/addorderitem"),{body:JSON.stringify(e),method:"POST",credentials:"include"}).then(async e=>({status:e.status,response:await e.json()}))},g=e=>p(e).then(e=>{let{status:t,response:r}=e;return{status:t,error:200!==t&&r.message||"Something wrong happened!",response:200===t?r:null}}),y=async(e,t)=>{let r=(0,n.MS)(t);return fetch("/api/cart/".concat(r,"/editorderitem"),{body:JSON.stringify(e),method:"PATCH",credentials:"include"}).then(async e=>({status:e.status,response:await e.json()}))},h=(e,t)=>y(e,t).then(e=>{let{status:t,response:r}=e;return{status:t,error:200!==t&&r.message||"Something wrong happened!",response:200===t?r:null}}),m=async(e,t)=>{let r=(0,n.MS)(t);return fetch("/api/cart/".concat(r,"/deleteorderitem"),{body:JSON.stringify(e),method:"POST",credentials:"include"}).then(async e=>({status:e.status,response:await e.json()}))},S=(e,t)=>m(e,t).then(e=>{let{status:t,response:r}=e;return{status:t,error:200!==t&&r.message||"Something wrong happened!",response:200===t?r:null}}),E=async(e,t)=>{let r=(0,n.MS)(e);return fetch("/api/cart/".concat(r,"/addcouponbyid"),{body:JSON.stringify({discountId:t}),method:"POST",credentials:"include"}).then(async e=>({status:e.status,response:await e.json()}))},_=(e,t)=>E(e,t).then(e=>{let{status:t,response:r}=e;return{status:t,error:200!==t&&r.message||"Something wrong happened!",response:200===t?r:null}}),I=async(e,t)=>{let r=(0,n.MS)(e);return fetch("/api/cart/".concat(r,"/addcouponbycode"),{body:JSON.stringify({discountCode:t}),method:"POST",credentials:"include"}).then(async e=>({status:e.status,response:await e.json()}))},f=(e,t)=>I(e,t).then(e=>{let{status:t,response:r}=e;return{status:t,error:200!==t&&r.message||"Something wrong happened!",response:200===t?r:null}}),P=async e=>{let t=(0,n.MS)(e);return fetch("/api/cart/".concat(t,"/removecoupon"),{method:"POST",credentials:"include"}).then(async e=>({status:e.status,response:await e.json()}))},D=e=>P(e).then(e=>{let{status:t,response:r}=e;return{status:t,error:200!==t&&r.message||"Something wrong happened!",response:200===t?r:null}}),A=async(e,t,r)=>{let s=(0,n.MS)(t);return fetch("/api/cart/".concat(s,"/settipamount"),{body:JSON.stringify({tipAmount:e,setTouched:r}),method:"POST",credentials:"include"}).then(async e=>({status:e.status,response:await e.json()}))},T=(e,t,r)=>A(e,t,r).then(e=>{let{status:t,response:r}=e;return{status:t,error:200!==t&&r.message||"Something wrong happened!",response:200===t?r:null}}),O=async(e,t,r)=>{let s=(0,n.MS)(t);return fetch("/api/cart/".concat(s,"/settippercentage"),{body:JSON.stringify({tipPercentage:e,setTouched:r}),method:"POST",credentials:"include"}).then(async e=>({status:e.status,response:await e.json()}))},R=(e,t,r)=>O(e,t,r).then(e=>{let{status:t,response:r}=e;return{status:t,error:200!==t&&r.message||"Something wrong happened!",response:200===t?r:null}}),N=async(e,t)=>{let r=(0,n.MS)(t);return fetch("/api/cart/".concat(r,"/submitorder"),{body:JSON.stringify(e),method:"POST",credentials:"include"}).then(async e=>({status:e.status,response:await e.json()}))},v=(e,t)=>N(e,t).then(async e=>{let{status:t,response:r}=e;return{status:t,error:200!==t&&497!==t?r.message||"Something wrong happened!":"",successResponse:200===t?r.response:null,stripePaymentIntentClientSecret:497===t&&r.stripePaymentIntentClientSecret||null}}),C=async(e,t)=>{let r=(0,n.MS)(t);return fetch("/api/cart/".concat(r,"/setpaymenttype"),{body:JSON.stringify(e),method:"POST",credentials:"include"}).then(async e=>({status:e.status,response:await e.json()})).then(e=>{let{status:t,response:r}=e;return{status:t,error:200!==t?r.message||"Something wrong happened!":"",response:200===t?r:null}})}},55454:function(e,t,r){var n,s,a,o,i,u,c,d,l,p,g,y,h,m;function S(e){var t;return/(iphone|ipad|ipod|android)/.test((null==e?void 0:null===(t=e.userAgent)||void 0===t?void 0:t.toLowerCase())||"")}r.d(t,{Vb:function(){return c},qz:function(){return n},r3:function(){return S},w9:function(){return u}}),(d=n||(n={})).Api="api",d.Exception="exception",(l=s||(s={})).REPUTATION_MANAGEMENT="reputation_management",l.SURVEY="survey",l.APP_INSTALLATION="app_installation",(p=a||(a={})).GoogleInlineWidget="GoogleInlineWidget",p.PopupDialogSimple="PopupDialogSimple",p.PopupDialogWithHeaderImage="PopupDialogWithHeaderImage",p.FloatingFooterDialog="FloatingFooterDialog",(g=o||(o={})).PopupDialogSimple="PopupDialogSimple",g.PopupDialogWithHeaderImage="PopupDialogWithHeaderImage",g.FloatingFooterDialog="FloatingFooterDialog",(y=i||(i={})).PopupDialogSimple="PopupDialogSimple",y.PopupDialogWithHeaderImage="PopupDialogWithHeaderImage",y.FloatingFooterDialog="FloatingFooterDialog",(h=u||(u={})).HIDDEN="Hidden",h.DISPLAYED="Displayed",(m=c||(c={})).SpeedUpDialog="SpeedUpDialog",m.WinIphone16Dialog="ChanceToWinIphoneDialog"},69089:function(e,t,r){r.d(t,{c:function(){return T},d:function(){return O},h:function(){return C},i:function(){return U}});var n,s,a,o,i,u,c,d,l,p,g,y,h,m,S,E,_,I,f,P,D=((n=D||{}).Saturday="Saturday",n.Sunday="Sunday",n.Monday="Monday",n.Tuesday="Tuesday",n.Wednesday="Wednesday",n.Thursday="Thursday",n.Friday="Friday",n),A=((s=A||{})[s.Sunday=0]="Sunday",s[s.Monday=1]="Monday",s[s.Tuesday=2]="Tuesday",s[s.Wednesday=3]="Wednesday",s[s.Thursday=4]="Thursday",s[s.Friday=5]="Friday",s[s.Saturday=6]="Saturday",s),T=((a=T||{})[a.All=-1]="All",a[a.PickUp=1]="PickUp",a[a.Delivery=2]="Delivery",a[a.DineIn=3]="DineIn",a[a.Reservation=4]="Reservation",a),O=((o=O||{}).OrderPlaced="order_placed",o.OrderAccepted="order_accepted",o),R=((i=R||{})[i.Unconfirmed=1]="Unconfirmed",i[i.Confirmed=2]="Confirmed",i[i.Ready=3]="Ready",i),N=((u=N||{})[u.Unresolved=1]="Unresolved",u[u.Resolved=2]="Resolved",u),v=((c=v||{})[c.FAILURE=0]="FAILURE",c[c.OK=1]="OK",c[c.REQUIRE_REAUTH=2]="REQUIRE_REAUTH",c[c.INVALID_ACTION=3]="INVALID_ACTION",c[c.INVALID_REQUEST=4]="INVALID_REQUEST",c[c.NEED_SIGNUP=5]="NEED_SIGNUP",c[c.UPGRADE_REQUIRED=6]="UPGRADE_REQUIRED",c[c.PERMISSION_CHANGED=7]="PERMISSION_CHANGED",c[c.TEMPORARY_UPGRADE=8]="TEMPORARY_UPGRADE",c[c.SHOPPINGCART=101]="SHOPPINGCART",c[c.INVALID_MENU=102]="INVALID_MENU",c[c.NO_STOREHOUR=103]="NO_STOREHOUR",c[c.OPERATION_FAILED=104]="OPERATION_FAILED",c[c.INVALID_ADDRESS=105]="INVALID_ADDRESS",c[c.INVALID_MENU_NEED_ACTION=106]="INVALID_MENU_NEED_ACTION",c[c.PAY_AMOUNT_INVALID=201]="PAY_AMOUNT_INVALID",c[c.PAY_PROCESSING_ERROR=202]="PAY_PROCESSING_ERROR",c[c.PAY_NEED_SMS_VERIFY=203]="PAY_NEED_SMS_VERIFY",c[c.PAY_STRIPE_REQUIRES_ACTION=204]="PAY_STRIPE_REQUIRES_ACTION",c[c.ORDER_VER_OUTDATED=301]="ORDER_VER_OUTDATED",c[c.ORDER_NOT_VIEWED=302]="ORDER_NOT_VIEWED",c[c.ORDER_DUPLICATE=303]="ORDER_DUPLICATE",c),C=((d=C||{})[d.PERCENT=1]="PERCENT",d[d.CURRENCY=2]="CURRENCY",d[d.FREEITEM=3]="FREEITEM",d),U=((l=U||{})[l.Cash=1]="Cash",l[l.CreditCard=2]="CreditCard",l[l.DriverCreditCard=3]="DriverCreditCard",l[l.PayPal=4]="PayPal",l[l.GooglePay=5]="GooglePay",l[l.ApplePay=6]="ApplePay",l[l.SRC=7]="SRC",l),w=((p=w||{})[p.PartnerWithUs=10]="PartnerWithUs",p[p.PartnerWithUsChinese=11]="PartnerWithUsChinese",p[p.WebsiteIssue=12]="WebsiteIssue",p[p.MenuWrong=13]="MenuWrong",p[p.OrderIssue=14]="OrderIssue",p[p.Other=15]="Other",p),M=((g=M||{}).Internal="internal",g.Location="location",g.Brand="brand",g.Org="org",g),b=((y=b||{}).Admin="internal-admin",y.Manager="internal-manager",y.PhoneAgent="internal-phone-agent",y.OnboardingAgent="internal-onboarding-agent",y.SupportL1="internal-support-l1",y.SupportL2="internal-support-l2",y),F=((h=F||{}).LocationAdmin="location-admin",h.LocationManager="location-manager",h),L=((m=L||{}).BrandAdmin="brand-admin",m.BrandManager="brand-manager",m),V=((S=V||{}).OrgAdmin="org-admin",S),W=((E=W||{})[E.Negative=0]="Negative",E[E.Positive=1]="Positive",E),G=((_=G||{})[_.Pending=1]="Pending",_[_.Processing=2]="Processing",_[_.Denied=3]="Denied",_[_.Approved=4]="Approved",_),k=((I=k||{})[I.Overwritten=0]="Overwritten",I[I.Scheduled=1]="Scheduled",I[I.Cancelled=2]="Cancelled",I[I.Processed=4]="Processed",I),H=((f=H||{})[f.Pending=1]="Pending",f[f.Processing=2]="Processing",f[f.Denied=3]="Denied",f[f.Approved=4]="Approved",f),J=((P=J||{})[P.Camera=1]="Camera",P[P.PhoneFile=2]="PhoneFile",P[P.DesktopFile=3]="DesktopFile",P)},78141:function(e,t,r){r.d(t,{IX:function(){return n.i},Ik:function(){return n.h},g6:function(){return n.d},hv:function(){return n.c}});var n=r(69089)},59096:function(e,t,r){r.d(t,{a:function(){return d},b:function(){return l},c:function(){return p}});var n=r(86655),s=0,a=new Map,o=[],i={toasts:[]};function u(e){i=d(i,e),o.forEach(e=>{e(i)})}function c(e){if(a.has(e))return;let t=setTimeout(()=>{a.delete(e),u({type:"REMOVE_TOAST",toastId:e})},3e3);a.set(e,t)}var d=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,50)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:r}=t;return r?c(r):e.toasts.forEach(e=>{c(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===r||void 0===r?{...e,open:!1}:e)}}case"REMOVE_TOAST":return void 0===t.toastId?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)};default:return e}};function l(e){let{...t}=e,r=(s=(s+1)%Number.MAX_VALUE).toString(),n=()=>u({type:"DISMISS_TOAST",toastId:r});return u({type:"ADD_TOAST",toast:{...t,id:r,open:!0,onOpenChange:e=>{e||n()}}}),{id:r,dismiss:n,update:e=>u({type:"UPDATE_TOAST",toast:{...e,id:r}})}}function p(){let[e,t]=(0,n.useState)(i);return(0,n.useEffect)(()=>(o.push(t),()=>{let e=o.indexOf(t);e>-1&&o.splice(e,1)}),[e]),{...e,toast:l,dismiss:e=>u({type:"DISMISS_TOAST",toastId:e})}}}}]);