PageSourceSearch

https://www.antoniospizzafl.com/_next/static/chunks/pages/checkout-1bb8dd34bbb4092e.js

js antoniospizzafl.com collected 2026-10-02 01:23:32 UTC 16,626 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[222],{57250:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/checkout",function(){return t(65573)}])},20743:function(e,n,t){"use strict";t.d(n,{T:function(){return i}});var l=t(85893),s=t(67294),a=t(94184),r=t.n(a),o=t(79127);let i=e=>{var n,t;let{brand:a}=(0,s.useContext)(o.I),i=null!==(t=null!==(n=e.url)&&void 0!==n?n:a.background)&&void 0!==t?t:"/images/default-brand-background.png";return(0,l.jsxs)("div",{className:r()("text-white flex flex-col text-3xl z-10 relative w-full",e.className),style:{...e.style,backgroundImage:"url(".concat(i,")"),backgroundSize:"cover",zIndex:1,backgroundPosition:"center"},children:[(0,l.jsx)("div",{className:"absolute top-0 left-0 bg-black bg-opacity-60 z-20 w-full h-full",style:{zIndex:-1}}),(0,l.jsx)("div",{className:"relative z-30 flex justify-center items-center flex-grow",children:e.children})]})}},4703:function(e,n,t){"use strict";t.d(n,{b:function(){return d}});var l=t(85893),s=t(67294),a=t(87399),r=t(50948),o=t(76822);let i=e=>{let{label:n,value:t,tooltip:s}=e;return(0,l.jsxs)("div",{className:"border-b border-dashed justify-between flex items-center text-sm",children:[s?(0,l.jsxs)("div",{className:"flex justify-center items-center space-x-2",children:[(0,l.jsx)("div",{children:n}),(0,l.jsx)(r.Icon,{src:o.Z,tooltip:s})]}):(0,l.jsx)("div",{children:n}),(0,l.jsx)("div",{children:t})]})};var c=t(79127);let d=e=>{let{order:n}=e,{brand:t}=(0,s.useContext)(c.I);return n?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(i,{label:"Sub Total",value:(0,a.CZ)(null==n?void 0:n.sub_total,!1)}),(null==n?void 0:n.rewards_discount)&&n.rewards_discount<0?(0,l.jsx)(i,{label:"Rewards Discount",value:(0,a.CZ)(n.rewards_discount)}):null,(null==n?void 0:n.coupon_discount)&&n.coupon_discount<0?(0,l.jsx)(i,{label:"Coupon Discount",value:(0,a.CZ)(n.coupon_discount)}):null,!t.has_tips||(null==n?void 0:n.third_party_delivery_tip)?null:(0,l.jsx)(i,{label:"Tip",value:(0,a.CZ)(null==n?void 0:n.tip,!1)}),(null==n?void 0:n.third_party_delivery_tip)?(0,l.jsx)(i,{label:"Third Party Delivery Tip",value:(0,a.CZ)(null==n?void 0:n.third_party_delivery_tip)}):null,(0,l.jsx)(i,{label:"Taxes and Fees",value:(0,a.CZ)((null==n?void 0:n.sales_tax)+(null==n?void 0:n.customer_service_fee),!1),tooltip:(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{children:"Sales Tax: ".concat((0,a.CZ)(null==n?void 0:n.sales_tax,!1))}),(null==n?void 0:n.customer_service_fee)?(0,l.jsx)("div",{children:"Platform Fee: ".concat((0,a.CZ)(n.customer_service_fee,!1)," (This helps maintain our website)")}):null]})}),(null==n?void 0:n.third_party_delivery_fee)?(0,l.jsx)(i,{label:"Third Party Delivery Fee",value:(0,a.CZ)(null==n?void 0:n.third_party_delivery_fee,!1)}):null,(null==n?void 0:n.delivery_fee)?(0,l.jsx)(i,{label:"Delivery Fee",value:(0,a.CZ)(null==n?void 0:n.delivery_fee,!1)}):null,(null==n?void 0:n.gratuity_fee)?(0,l.jsx)(i,{tooltip:(0,l.jsx)("div",{children:"Certain items in your cart have a gratuity fee attached to them."}),label:"Gratuity Fee",value:(0,a.CZ)(null==n?void 0:n.gratuity_fee,!1)}):null,(0,l.jsx)(i,{label:"Total",value:(0,a.CZ)(null==n?void 0:n.total,!1)})]}):null}},65573:function(e,n,t){"use strict";t.r(n),t.d(n,{__N_SSP:function(){return M},default:function(){return D}});var l=t(85893),s=t(50948),a=t(67294),r=t(11163),o=t(15109),i=t(94143),c=t(76822),d=t(32438),u=t(56126),h=t(60729),x=t(58067),m=t(19819),p=t(82849),j=t(79127),v=t(87399),f=t(94184),y=t.n(f);let b=()=>{let[e,n]=(0,a.useState)(!1),{order:t,setOrder:r,brand:o}=(0,a.useContext)(j.I),i=async e=>{let t=await (0,s.enhancedFetch)("/api/order/update",{method:"PUT",body:{tip:e}});n(!1),r(t)},c=(null==t?void 0:t.tip)||(null==t?void 0:t.third_party_delivery_tip),d=o.tip_options,u=(0,a.useMemo)(()=>d?function(e,n){let t=[];return e.forEach(e=>{let l=e.includes("%"),s=l?e.replace("%","")/100*(null==n?void 0:n.sub_total):100*e;t.push({label:l?e:"$".concat(e),amount:Math.round(s)})}),t}(d,t):function(e){let n=[],t=Math.round((null==e?void 0:e.sub_total)*.2);return t>300?n.push({label:"20%",amount:t},{label:"25%",amount:Math.round((null==e?void 0:e.sub_total)*.25)}):n.push({label:"$3.00",amount:300},{label:"$5.00",amount:500}),n}(t),[d,t]);return(0,a.useEffect)(()=>{n(0!==c&&!u.some(e=>e.amount===c))},[c,u]),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex justify-center space-x-4 items-center",children:[u.map(n=>(0,l.jsx)(s.Button,{className:y()("flex-grow justify-center",{primary:!e&&c===n.amount}),onClick:()=>i(n.amount),children:n.label},n.label)),(0,l.jsx)(s.Button,{className:y()("flex-grow justify-center",{primary:e}),onClick:()=>n(!0),children:"Other"})]}),e&&(0,l.jsx)("div",{className:"flex items-center justify-center space-x-2",children:(0,l.jsx)(s.PriceInput,{label:"Custom Amount",value:c,onChange:e=>i(100*e.target.value)})})]})};var _=t(93049),g=t(40952);let w=()=>{let{order:e,setOrder:n}=(0,a.useContext)(j.I),t=async()=>{n(await (0,s.enhancedFetch)("/api/order/update",{method:"PUT",body:{is_cash:!e.is_cash}}))};return(0,l.jsx)(s.CheckboxInput,{className:"size-sm",label:"Pay With Cash",checked:null==e?void 0:e.is_cash,onChange:t})},C=()=>{let[e,n]=(0,a.useState)(""),[t,r]=(0,a.useState)(""),{order:o,setOrder:i}=(0,a.useContext)(j.I);(0,a.useEffect)(()=>{n(null==o?void 0:o.coupon_code)},[null==o?void 0:o.coupon_code]);let c=async e=>{i(await (0,s.enhancedFetch)("/api/order/remove-coupon",{method:"POST"}))},d=async()=>{r("");try{let n=await (0,s.enhancedFetch)("/api/order/apply-coupon",{method:"POST",body:{code:e}});i(n)}catch(e){r(e.message)}};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex",children:[(0,l.jsx)(s.TextInput,{className:"flex-grow w-auto rounded-none",label:"Coupon Code",value:e,error:t,onChange:e=>{n(e.target.value)}}),(0,l.jsx)(s.Button,{className:"rounded-none",onClick:d,children:"Apply"})]}),(0,l.jsx)("div",{children:(null==o?void 0:o.coupon_code)&&(0,l.jsxs)("div",{className:"p-2 bg-green-700 text-white flex justify-center items-center space-x-2",children:[(0,l.jsx)("span",{children:'Applied coupon "'.concat(o.coupon_code,'"')}),(0,l.jsx)(s.Button,{className:"danger border-none size-sm justify-center items-center",onClick:c,children:"X"})]})})]})};var N=t(34977),k=t.n(N);let I=e=>{let{brand:n}=(0,a.useContext)(j.I),{onInstanceCreated:t}=e,[r,o,i]=(0,s.useFetch)({url:"/api/user/generate-braintree-token?brand_hash_id=".concat(n.hash_id),isAllowed:!!(null==n?void 0:n.hash_id),swrOptions:{revalidateOnFocus:!1}});return((0,a.useEffect)(()=>{r&&k().create({authorization:r.token,selector:"#dropin-container"},(e,n)=>{if(e){console.error(e);return}t(n)})},[r,t]),!r&&(null==i?void 0:i.error))?(0,l.jsx)("div",{children:"Oops, it appears our credit card provider couldn't connect, please try refreshing in a few minutes."}):(0,l.jsx)("div",{id:"dropin-container"})};var T=t(20743),S=t(4703);let P=e=>{let{balance:n,setBalance:t,minRewardPoints:r}=e,{order:o,setOrder:i,user:c}=(0,a.useContext)(j.I),d=async()=>{let{order:e,rewards_balance:n}
1=await (0,s.enhancedFetch)("/api/order/apply-rewards",{method:"POST"});i(e),t(n)},h=async()=>{let{order:e,rewards_balance:n}=await (0,s.enhancedFetch)("/api/order/remove-rewards",{method:"POST"});i(e),t(n)};return(0,l.jsxs)(l.Fragment,{children:[(null==o?void 0:o.rewards_discount)!==0?(0,l.jsx)(l.Fragment,{children:(0,l.jsxs)("div",{className:"bg-green-500 text-white font-bold p-2 rounded flex items-center space-x-2",children:[(0,l.jsx)(s.Icon,{src:u.Z}),(0,l.jsx)("span",{children:"Successfully applied a $".concat((0,v.CZ)(r)," discount to your order.")})]})}):null,(0,l.jsxs)("div",{className:"flex items-center space-x-3",children:[(null==o?void 0:o.rewards_discount)===0?(0,l.jsx)(s.Button,{className:"rounded-none",onClick:d,children:"Use $".concat((0,v.CZ)(r)," Discount (costs ").concat(r," points)")}):(0,l.jsx)(s.Button,{className:"rounded-none danger",onClick:h,children:"Remove Rewards Discount"}),(0,l.jsx)("span",{children:"You have ".concat(n," reward points.")})]}),(0,l.jsx)("div",{children:(null==o?void 0:o.coupon_code)&&(0,l.jsxs)("div",{className:"p-2 bg-green-700 text-white flex justify-center items-center space-x-2",children:[(0,l.jsx)("span",{children:'Applied coupon "'.concat(o.coupon_code,'"')}),(0,l.jsx)(s.Button,{className:"danger border-none size-sm justify-center items-center",onClick:h,children:"X"})]})})]})};var Z=t(36203),F=t(54465),E=t(86664);let O=e=>{let{onGetNonceRef:n}=e,t=(0,E.useStripe)(),r=(0,E.useElements)(),{order:o}=(0,a.useContext)(j.I),{setAlert:i}=(0,a.useContext)(s.JourneyAppContext);n.current=async()=>{if(!t||!r)return;await r.submit();let{error:e,paymentMethod:n}=await t.createPaymentMethod({elements:r,params:{billing_details:{name:o.name,email:o.email}}});return(null==e?void 0:e.message)?(i({label:e.message,buttons:[{label:"Close",onClick:()=>{}}]}),null):n.id};let c={layout:"tabs",defaultValues:{billingDetails:{name:null==o?void 0:o.name,email:null==o?void 0:o.email,phone:null==o?void 0:o.phone_number}}};return(0,l.jsx)("form",{id:"payment-form",children:(0,l.jsx)(E.PaymentElement,{id:"payment-element",options:c})})},B=(0,F.J)("pk_live_51OV3DVLNNxbS3EcwYvKo3VNTfAk72Zvzumgs7VfgKjnW6Ew4ZJ7aI9DIUJvYOCYZyThoWjlOHtSqQuEuQABzdeHH00CNA9FQvu"),z=e=>{let{getStripePaymentMethodRef:n}=e,{brand:t,order:r}=(0,a.useContext)(j.I),[o,i]=(0,a.useState)(""),[c,d]=(0,a.useState)(!1),u=t.hash_id;if((0,a.useEffect)(()=>{u&&(d(!1),(0,s.enhancedFetch)("/api/user/generate-stripe-token",{method:"POST",body:{brand_hash_id:u}}).then(e=>{i(e.stripeAccountId)}).catch(e=>{console.error(e),d(!0)}))},[u]),!r)return null;let h={mode:"payment",amount:null==r?void 0:r.total,currency:"usd",paymentMethodCreation:"manual",paymentMethodTypes:["card"],appearance:{theme:"stripe"}};return(0,l.jsxs)("div",{className:"py-2",children:[c&&(0,l.jsx)("div",{className:"text-center",children:"Something went wrong loading our payment widget, please try again later."}),c||""!==o?null:(0,l.jsx)(s.Spinner,{}),o&&(0,l.jsx)(E.Elements,{options:h,stripe:B,children:(0,l.jsx)("div",{children:(0,l.jsx)(O,{onGetNonceRef:n})})})]})},A=s.Journey.div("text-2xl font-bold flex heading-font flex-row"),R=s.Journey.div("border-b-2 w-full border-dashed border-gray p-2 space-y-2");var M=!0,D=e=>{let{brand:n,has_rewards:t,payment_service_name:f,confirm_menu_notification:y,menu_notification:N,min_reward_points:k,has_coupons:F,rewards_balance:E}=e,{order:O,setOrder:B,user:M}=(0,a.useContext)(j.I),{name:D,phone_number:J,email:U,hash_id:W,instructions:V}=null!=O?O:{},$=(0,r.useRouter)(),[K,X]=(0,a.useState)(E);(0,a.useEffect)(()=>{if(!W)return;let e=setTimeout(()=>{(0,s.enhancedFetch)("/api/order/update",{method:"PUT",body:{name:D,phone_number:J,email:U,instructions:V}}).catch(console.error)},500);return()=>clearTimeout(e)},[D,J,U,V,W]);let[Y,q]=(0,a.useState)(),H=(0,a.useCallback)(e=>{q(e)},[]),Q=()=>new Promise((e,n)=>{if(O.is_cash){e("");return}Y.requestPaymentMethod((t,l)=>{if(t){n(Error("We couldn't submit your order because your payment information was incomplete. Please scroll all the way down and fill out the remaining details."));return}e(l.nonce)})}),[G,L]=(0,a.useState)(!0),ee=(0,a.useRef)(async()=>(console.log("nonce ref not set"),"")),en=async()=>
1{try{let e={is_email_marketable:G};(null==O?void 0:O.is_cash)?e.payment_nonce="":"Braintree"===f?e.payment_nonce=await Q():"Stripe"===f&&(e.payment_nonce=await ee.current());let t=await (0,s.enhancedFetch)("/api/order/checkout",{method:"POST",body:e});B(void 0),$.push("/order/".concat(t.hash_id)),n.google_tag_conversion_id&&Z.S.conversion(n.google_tag_conversion_id,t.hash_id,t.total/100)}catch(e){console.error(e),es({label:(0,s.parseTimeBlocks)(e.message),buttons:[{label:"Close",onClick:()=>{}}]})}},et=(0,a.useRef)(!1),el=async()=>{if(!M&&y&&N&&!et.current){let e=new Promise((e,n)=>{es({onClose:()=>n(Error("Closed")),label:N,buttons:[{label:"I understand",onClick:()=>{et.current=!0,e(!0)}},{label:"Stop checkout",onClick:async()=>{n(Error("Stop checkout"))}}]})});try{await Promise.all([e]),await en()}catch(e){}return}await en()},{setAlert:es}=(0,a.useContext)(s.JourneyAppContext);return(0,l.jsxs)(p.n,{brand:n,title:"Checkout",description:"Finish you order and get your food!",backUrl:"/menu",className:"full-screen",children:[(0,l.jsx)(T.T,{className:"h-40",children:(0,l.jsx)("h2",{className:"text-3xl z-20 font-bold",children:"Checkout"})}),(0,l.jsx)("div",{children:(0,l.jsxs)(s.Row,{className:"justify-start",children:[(0,l.jsx)(s.Col,{lg:4,xs:12,children:(0,l.jsxs)(s.Card,{children:[(0,l.jsxs)(R,{children:[(0,l.jsxs)(A,{children:["Options",(0,l.jsx)(s.Icon,{src:o.Z,className:"pb-2.5 pt-0.5"})]}),(0,l.jsxs)("div",{className:"flex flex-wrap md:flex-nowrap lg:flex-wrap justify-between items-center space-y-2 md:space-y-0 md:space-x-2 lg:space-y-2 lg:space-x-0 xl:w-3/4",children:[(0,l.jsx)(_.M,{className:"w-full"}),(0,l.jsx)(g.u,{className:"w-full"})]}),(null==O?void 0:O.scheduled_at)?(0,l.jsx)("div",{className:"flex justify-center items-center py-2 font-bold text-lg",children:(0,l.jsx)(s.DateFormat,{prefix:"Scheduled at ",value:null==O?void 0:O.scheduled_at,format:"M/d/yy h:mma"})}):null]}),(0,l.jsxs)(R,{children:[(0,l.jsxs)(A,{children:["Customer Info",(0,l.jsx)(s.Icon,{src:i.Z,className:"pb-2 pt-0.5 pl-1"})]}),(0,l.jsxs)(s.Form,{value:O,onChange:B,onError:e=>{e.find(e=>e.message.includes("Sorry, we weren't able to charge your card.")||"payment_service"===e.attribute)&&Y&&Y.clearSelectedPaymentMethod();let n=[{label:"Okay",onClick:async()=>{}}];e.find(e=>e.message.includes("Would you like to place your order"))&&n.push({label:"Place At Opening",onClick:async()=>{B(await (0,s.enhancedFetch)("/api/order/place-at-opening",{method:"POST"}))}}),es({label:(0,s.parseTimeBlocks)(e.map(e=>e.message).join(". ")),buttons:n})},children:[(0,l.jsx)(s.TextInput,{label:"Name",name:"name"}),(0,l.jsx)(s.TextInput,{type:"phone",name:"phone_number",label:"Phone"}),(0,l.jsx)(s.TextInput,{label:"Email",type:"email",name:"email"}),(0,l.jsx)(s.TextAreaInput,{name:"instructions",placeholder:"Knock quietly, gate security code, etc"}),(0,l.jsxs)("div",{className:"is-email-marketable-wrapper flex space-x-3 items-center",children:[(0,l.jsx)(s.CheckboxInput,{className:"w-11/12",name:"is_email_marketable",label:"Receive promotions, deals, coupons, etc",checked:!0===G,onChange:()=>L(!G)}),(0,l.jsx)(s.Icon,{className:"flex-shrink-0 mb-2",src:c.Z,tooltip:"Keeping this box checked grants us permission to send you emails/texts for promotions, deals, coupons, etc."})]})]})]})]})}),(0,l.jsx)(s.Col,{lg:4,xs:12,children:(0,l.jsxs)(s.Card,{children:[n.has_tips&&(0,l.jsxs)(R,{children:[(0,l.jsxs)(A,{children:["Tip",(0,l.jsx)(s.Icon,{src:d.Z,className:"pb-2 pt-0.5"})]}),(0,l.jsx)(b,{})]}),F?(0,l.jsx)(R,{children:(0,l.jsx)(C,{})}):null,t&&E>0?(0,l.jsxs)(R,{children:[(0,l.jsx)(A,{children:"Rewards"}),(0,l.jsx)(P,{minRewardPoints:k,balance:K,setBalance:X})]}):null,(0,l.jsxs)(R,{children:[(0,l.jsxs)(A,{children:["".concat((0,v.kC)(null==O?void 0:O.type)," Order Review"),(0,l.jsx)(s.Icon,{src:u.Z,className:"pb-2 pt-0.5 pl-1"})]}),null==O?void 0:O.items.map(e=>(0,l.jsxs)("div",{className:"flex justify-between items-center",children:[(0,l.jsxs)("div",{className:"flex space-x-2",children:[e.parent_hash_id?(0,l.jsx)(s.Icon,{className:"ml-4",src:h.Z}):null,(0,l.jsx)("span",{children:e.name})]}),(0,l.jsx)("span",{children:(0,v.CZ)(e.price)})]},e.hash_id)),(0,l.jsx)("div",{className:"border-b border-dashed"}),(0,l.jsx)(S.b,{order:O})]})]})}),(0,l.jsxs)(s.Col,{lg:4,xs:12,children:[(0,l.jsx)(s.Card,{children:(0,l.jsxs)(R,{children:[(0,l.jsxs)(A,{children:["Payment",(0,l.jsx)(s.Icon,{src:x.Z,className:"pb-2 pt-0.5 pl-1"})]}),n.has_cash_orders?(0,l.jsx)(w,{}):null,(null==O?void 0:O.is_cash)?null:(0,l.jsxs)(l.Fragment,{children:["Braintree"===f?(0,l.jsx)(I,{onInstanceCreated:H}):null,"Stripe"===f?(0,l.jsx)(z,{getStripePaymentMethodRef:ee}):null]})]})}),(0,l.jsx)("div",{className:"text-sm flex w-full text-center items-center justify-center my-2",children:(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{className:"mx-1",children:"We are located at"}),(0,l.jsx)("span",{className:"font-bold",children:n.location_display})]})}),(0,l.jsx)("div",{className:"flex justify-center items-center w-full flex-col p-2 mb-6",children:(0,l.jsxs)(s.Button,{className:"text-xl w-full md:w-96 h-16 uppercase justify-center font-bold primary",onClick:el,children:["Place ".concat((0,v.kC)(null==O?void 0:O.type)," Order"),(0,l.jsx)(s.Icon,{src:m.Z,className:"pb-1.5 pt-0.5"})]})})]})]})})]})}}},function(e){e.O(0,[110,101,849,888,774,179],function(){return e(e.s=57250)}),_N_E=e.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.