1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[246],{9637:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/confirm-quote",function(){return a(5803)}])},4274:function(e,t,a){"use strict";a.d(t,{s:function(){return n}});var i=a(5384);let n=e=>{let t=e.includes("/costco/");return t?i.NM.COSTCO:i.NM.CUBEIT}},5803:function(e,t,a){"use strict";a.r(t),a.d(t,{EstimateFromEmail:function(){return b},__N_SSP:function(){return x}});var i=a(2322),n=a(5793),o=a(3417),r=a(1813),s=a(5384),l=a(2784),c=a(5632),u=a(6577),m=a.n(u),d=a(5535),f=a(6236),p=a(1778),h=a(4274),x=!0;function b(){let e=(0,c.useRouter)(),{locale:t,push:a}=e,[n,o]=(0,l.useState)(!1),[r,u]=(0,l.useState)(!1),[x,b]=(0,l.useState)(!1),[y,_]=(0,l.useState)(0),[w,v]=(0,l.useState)(),[C,q]=(0,l.useState)(),[g,j]=(0,l.useState)(),N=(0,h.s)(e.asPath),S=N===s.NM.COSTCO?"/costco/confirm-quote/":"/confirm-quote/",{st:k}=(0,p.xf)({options:{keyPrefix:"confirmQuote"}}),T=(0,i.jsx)("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-neutral-500 opacity-80",children:(0,i.jsx)(m(),{src:"/assets/icons/ellipse.svg",alt:"loading",width:60,height:60,className:"animate-spin opacity-100"})}),E=async(e,t)=>{let i=f.Yr({name:"getQuoteDetailsFromToken"});f.e(e=>e.setSpan(i));try{let n=await fetch("/api/parq/quotes/".concat(e,"/details/").concat(t),{method:"GET",headers:{"Content-Type":"application/json"}});if(!n.ok){let r=await n.json();if(r.message&&"Quote expired"===r.message)return a("".concat(S,"expired"));throw Error("Failed to get quote details")}let l=await n.json();if(!l.quote||!l.cartData)throw Error("Failed to get quote details");let c=l.quote.get_quote_type_display,u={quote:{Quote:l.quote},cartData:{CartPricing:l.cartData},quoteDetails:{date:l.quote.delivery_date,containerUse:c===s.Q_.st||c===s.Q_.sc?s.Pn.STORAGE:s.Pn.MOVING,containerLocation:c===s.Q_.st||c===s.Q_.mv?s.aR.HOME:s.aR.FACILITY}},m="PS_API"===l.quote.created_by__username||null===l.quote.created_by__username;q(!m);let d=l.quote.email;if(j(d||null),m)d&&(u.clientDetails={email:d});else{let{first_name:p,last_name:h,phone:x,email:b}=l.quote;u.clientDetails={email:b,phone:x,name:p+" "+h}}v(u),o(!1)}catch(y){f.Tb(y,i.toContext()),await a("".concat(S,"error"))}finally{o(!1),i.finish()}},P=async(e,t)=>{var a;let i=e.quote.Quote.quote_id,n=e.clientDetails,o=null===(a=n.name)||void 0===a?void 0:a.split(" "),r=null==o?void 0:o.pop(),s=(null==o?void 0:o.join(" "))||"Unknown",l=await fetch("/api/parq/quotes/".concat(i,"/confirmReservation"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({Comments:n.comments,Quote:{email:n.email,first_name:s,last_name:r,language:t,phone:n.phone,additional_fields:n.membershipNumber?{costco_number:n.membershipNumber}:void 0}})});if(!l.ok)return Promise.reject(Error("Failed to reserve cube for quote ".concat(i)))},D=(0,l.useCallback)(async()=>{if(!C&&(!x||!(0,d.tV)(w.clientDetails,s.NM.CUBEIT))){_(y+1);return}let e=f.Yr({name:"getQuoteDetailsFromToken"});f.e(t=>t.setSpan(e));try{return o(!0),await P(w,t),o(!1),await a("".concat(S,"thank-you"))}catch(i){f.Tb(i,e.toContext()),await a("".concat(S,"error"))}finally{o(!1),e.finish()}},[C,x,t,a,w,y,S]),O=(0,l.useCallback)(e=>b(e),[]),Q=(0,l.useCallback)(e=>{v(t=>({...t,clientDetails:e})),D()},[D]),F=(0,l.useCallback)((e,t)=>{v(a=>{let i={...a.clientDetails};return i[e]=t,{...a,clientDetails:i}})},[]);return(0,l.useEffect)(()=>{o(!0),E(e.query.id,e.query.token)},[]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"m-auto flex justify-center py-24",children:[n&&T,w&&!r&&(0,i.jsx)("div",{className:"max-w-[830px] px-16 md:px-40",children:(0,i.jsx)(d.tY,{state:w})}),w&&r&&(0,i.jsx)("div",{className:"max-w-[830px] px-16 md:px-40",children:(0,i.jsx)(d.d4,{initialState:w.clientDetails,isInboundCall:C,isSentEstimate:null!==g,siteType:N,onSubmit:Q,onFormValidityChange:O,onChange:F,triggerValidation:y})})]}),(0,i.jsx)("div",{className:"relative sticky bottom-0 z-[60] flex flex-row-reverse items-center justify-between border-t-2 bg-white py-16 before:absolute before:top-0 before:mt-[-34px] before:h-32 before:w-full before:bg-gradient-to-t before:from-white before:to-transparent",children:(0,i.jsxs)("div",{className:"m-auto flex w-full max-w-[830px] justify-end px-16 py-24 md:px-40",children:[!r&&(0,i.jsx)(d.zx,{label:k("reserve","Reserve now"),variant:"primary",size:"medium",onClick:()=>{window.scrollTo(0,0),u(!0)}}),r&&(0,i.jsx)(d.zx,{label:k("confirm","Confirm my reservation"),variant:"primary",size:"medium",onClick:D})]})})]})}t.default=(0,n.th)({adapters:(0,s.P0)({estimate:b},o.y),rootComponent:r.T,templateSlug:"estimate-from-email"})}},function(e){e.O(0,[716,774,888,179],function(){return e(e.s=9637)}),_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.