PageSourceSearch

https://www.jfkt8ordernow.com/assets/deliveryFlightSelection-st3xgsgg.js

js jfkt8ordernow.com collected 2026-10-09 22:22:22 UTC 30,893 bytes, 282 lines download raw bytes

1import{r as c,T as be,j as e,z as D,y as n,ad as Qe,ae as nt,aD as Je,m as f,c as E,a as oe,U as I,F as P,ai as Ye,bl as se,D as Q,bm as ot,bn as dt,K as Xe,l as ct,v as ht,B as Ke,g as re,s as ne,u as pt,w as gt,Y as qe}from"./index-JgRY7mHr.js";import{T as d,F as mt,u as Le,N as Ze}from"./RootSwitch-B3B0o57V.js";import{R as et}from"./removeFlightConfirmation-DtLQk0EC.js";import{A as ut}from"./AddFlightModal-BVPfl0_0.js";import{A as xt}from"./addFlight-D-pDtMi4.js";import{S as ft}from"./react-select.esm-rKfxPtpd.js";import{S as tt,C as vt}from"./ConfirmationPrompt-VNSt07L2.js";import{d as Oe,f as yt,m as bt,p as jt,c as Ae,e as Ee}from"./config-DA2RNeWM.js";import{d as Re}from"./dateTimeConfig-2-XZjWvp.js";import{A as Tt}from"./FirebaseAnalyticsUtil-CY_qapVo.js";import{r as wt}from"./config-Bj3u974S.js";import{S as Ct}from"./SelectedFlightCard-CyUFhkgb.js";import{c as St,f as Dt}from"./util-BVdOKaJ2.js";import"./Modal-BF2JEKYF.js";import"./ThemeProvider-BrDo-Xes.js";import"./index-C7CL5OQ7.js";import"./removeClass-D0mFdbeO.js";import"./cross-BWYqBfRY.js";import"./DesktopDateTextField-uUVv4TlE.js";import"./unsupportedIterableToArray-CwiH5HRN.js";import"./createSuper-Dw5ei0MH.js";import"./classCallCheck-MFKM5G8b.js";import"./useOutsideClick-D0SFHoTf.js";import"./TextField-BWXln7je.js";import"./Grow-B01vRFHQ.js";/* empty css              */import"./useDesktopPicker-DSOT4ujg.js";import"./IconButton-Bg7RNbKM.js";import"./DesktopDatePicker-LaLj0e_n.js";import"./slicedToArray-BIk3_DdQ.js";import"./toConsumableArray-tw3Z1YS3.js";import"./CustomDesktopDateTimePicker-CNzPgfz3.js";import"./MenuItem-DE16rMYL.js";import"./config-dTDF9yLE.js";const Ft=a=>{let j=[];if(a.length>0){let T=a[0],p=a[0];a.forEach((m,w)=>{p=(parseInt(m)+1).toString(),p!==a[w+1]&&(T===m?j.push(m):j.push(`${T}-${m}`),T=a[w+1])})}return j.join(", ")};function kt(a){var T,p,m;const j=c.useContext(be);return e.jsxs(Nt,{children:[e.jsxs(At,{children:[e.jsxs(Et,{onClick:()=>a.handleGoBack(),children:[e.jsx(Rt,{src:(T=j==null?void 0:j.terminalTwo)==null?void 0:T.backArrow}),e.jsx(Ot,{children:e.jsx(d,{children:"Go Back"})})]}),e.jsx(Lt,{children:e.jsx(d,{type:"extra-bold",children:"DEPARTURE PASSENGERS"})}),e.jsx($t,{children:e.jsx(d,{type:"semi-bold",children:"Before you place your order"})}),e.jsx(Ut,{children:e.jsx(d,{children:"Add a flight so we can deliver to your boarding gate"})})]}),e.jsx(Bt,{children:e.jsx(It,{onClick:()=>a.handleAddFlightShow(),children:e.jsx(d,{type:"extra-bold",children:"+ Add Flight"})})}),e.jsx(_t,{children:e.jsx(Mt,{src:(m=(p=j==null?void 0:j.pages)==null?void 0:p.edpFSTR)==null?void 0:m.addFlightIllustration,alt:"floral-image"})})]})}const Nt=n.section`
2  width: 100%;
3  display: flex;
4  flex-direction: column;
5  padding: 24px 24px 32px 24px;
6  background: var(
7    --grey,
8    linear-gradient(139deg, #60678b -35.77%, #1f2131 140.71%)
9  );
10  position: relative;
11
12  @media ${D.laptop} {
13    flex-direction: row;
14    align-items: center;
15    justify-content: space-between;
16    padding: 32px 136px 95px 136px;
17  }
18`,At=n.div``,Et=n.div`
19  display: none;
20
21  @media ${D.laptop} {
22    display: flex;
23    align-items: center;
24    gap: 10px;
25    cursor: pointer;
26  }
27`,Rt=n.img``,Ot=n.div`
28  font-size: 16px;
29  color: #fff;
30`,Lt=n.div`
31  width: fit-content;
32  display: flex;
33  justify-content: center;
34  align-items: center;
35  padding: 4px 8px;
36  border-radius: 2px;
37  background-color: #f8cf46;
38
39  color: #000;
40  font-size: 10px;
41  letter-spacing: 1px;
42
43  @media ${D.laptop} {
44    margin-top: 32px;
45  }
46`,$t=n.div`
47  color: #fff;
48  font-size: 20px;
49  line-height: 26px;
50  margin-top: 12px;
51`,Ut=n.div`
52  width: 80%;
53  max-width: 80%;
54  color: #fff;
55  font-size: 16px;
56  line-height: 26px;
57  margin-top: 8px;
58`,Bt=n.div`
59  display: flex;
60  justify-content: center;
61  margin-top: 24px;
62`,It=n.div`
63  background-color: #037b79;
64  border: none;
65  border-radius: 100px;
66  color: #fff;
67  cursor: pointer;
68  display: flex;
69  font-size: 16px;
70  font-weight: 400;
71  align-items: center;
72  justify-content: center;
73  padding: 12px 0;
74  position: relative;
75  width: 220px;
76  z-index: 1;
77
78  @media ${D.laptop} {
79    width: 268px;
80    height: 54px;
81    padding: 0px;
82  }
83`,_t=n.div`
84  position: absolute;
85  top: 0px;
86  right: 0px;
87`,Mt=n.img``;function Gt(a){var ae,xe,M;const j=c.useContext(mt),T=c.useContext(Qe),p=c.useContext(be),[m]=nt(["gwLoginData"]),w=c.useContext(Je),{pushHistory:N}=Le(),[s,y]=c.useState(null),[je,de]=c.useState(!0),[U,L]=c.useState(!1),[H,g]=c.useState(!1),[J,X]=c.useState(!1),[K,B]=c.useState(!1),[Te,we]=c.useState(!1),Ce=c.useContext(Ze);c.useEffect(()=>{ce(a.flightData.flightId,a.flightData.scheduleDate,a.flightData.movementType)},[]);const ce=async(t,l,h)=>{let u=f(l,"UTC","UTC").format(),C="Departure";h==="A"&&(C="Arrival");try{let b=E.api.flightSearch.replace("{{date}}",u).replace("{{movementType}}",C).replace("{{flightNo}}",t),F=await(await oe.get(b)).json();if(F.data.length>0)I.sendMessageToReactNative(Tt),y(F.data[0]),F.data[0].airline.checkinUrl.length>0&&B(!0),m.gwLoginData?_(F.data[0]):(de(!1),g(!1)),F.data[0].estimatedDate&&F.data[0].flightStatus&&F.data[0].flightStatus.name&&he(F.data[0].estimatedDate,F.data[0].flightStatus);else throw Error("Flight details have not been updated")}catch(b){console.log(b),P.info(b.message),ee()}},_=async t=>{let l=!1,h=E.api.getFlightTrackData,C=await(await oe.get(h)).json();(C.status===200||C.status===201)&&C.data.forEach(b=>{t.flightNumber===b.flightId&&t.estimatedDate===b.estimatedTime&&(l=!0)}),localStorage.getItem("module")==="homepage"&&(Y(t,l),localStorage.setItem("module",null)),g(l),de(!1)},he=(t,l)=>{let h=f(),u=f(t).add(5,"hour").add(30,"minute");
87(f(h).isAfter(u)||wt.includes(l.name.toLowerCase()))&&(a.setAirportData([]),w.removeFlight(a.flightData.UID))};function Z(t){const l=Math.floor(t%3600/60),h=Math.floor(t%(3600*24)/3600),u=Math.floor(t/(3600*24)),C=V(l,"min"),b=V(h,"hr");return`${V(u,"day")}${b}${C} until flight`.replace(/,\s*$/,"")}function V(t,l){return t>0?t+(t===1?`${l==="min"?" "+l:" "+l+","} `:`${l==="min"?" "+l+"s":" "+l+"s,"} `):""}const pe=t=>{j.openFlightAlert({flightName:t.airline.name,flightId:t.flightNumber,flightStatus:t.flightStatus.name,scheduledTime:t.scheduledDate,estimatedTime:t.estimatedDate,gate:t.gates.length?se(t.gates,"sequenceNumber")[0].gateNumber:"",belt:t.baggageBelts.length?se(t.baggageBelts,"sequenceNumber")[0].beltNumber:""})},Y=async(t,l)=>{const h=()=>{localStorage.setItem("module","homepage"),N("/signin")};if(!l)m.gwLoginData?pe(t):h();else if(L(!0),m.gwLoginData){let u=[];m.gwLoginData.mobile&&u.push("SMS"),m.gwLoginData.email&&u.push("EMAIL");let C=E.api.stopFlightTrack,b={flightName:t.airline.name,flightId:t.flightNumber,flightStatus:t.flightStatus.name,scheduledTime:t.scheduledDate,estimatedTime:t.estimatedDate,gate:t.gates.length?se(t.gates,"sequenceNumber")[0].gateNumber:"",belt:t.baggageBelts.length?se(t.baggageBelts,"sequenceNumber")[0].beltNumber:"",notificationMethod:u,user:{email:m.gwLoginData.email?Ye(m.gwLoginData.email):"",mobile:m.gwLoginData.mobile?Ye(m.gwLoginData.mobile):"",userId:m.gwLoginData.userId}};I.triggerMoEngageEvent("stop_flight_updates",{flight_name:t.airline.name,flight_id:t.flightNumber,flight_status:t.flightStatus.name,scheduled_time:t.scheduledDate,estimated_time:t.estimatedDate,gate:t.gates.length?se(t.gates,"sequenceNumber")[0].gateNumber:""});try{let F=await(await oe.post(C,b)).json();F.status===200||F.status===201?(g(!1),P.info("Your have now stopped tracking your flight!"),L(!1)):(P.info("Stop tracking failed, try re-logging in"),L(!1))}catch(A){console.log(A),P.info("Stop tracking failed, try re-logging in"),L(!1)}}else h()};function ge(){let t=!1,l=T.getCart();Object.values(l).forEach(h=>{h.items.forEach(u=>{u.flightUid===a.flightData.UID&&(t=!0)})}),I.triggerMoEngageEvent("remove_flight_clicked"),t?X(!0):ee()}const ee=()=>{a.setAirportData([]),w.removeFlight(a.flightData.UID),H&&Y()},te=()=>{a.setAirportData([]),w.removeFlight(a.flightData.UID);let t=T.getCart();Object.values(t).forEach(l=>{l.items=l.items.filter(h=>{var u;return h.storeTerminal!==`Terminal${(u=a==null?void 0:a.flightData)==null?void 0:u.terminal}`})}),H&&Y(),X(!1)},ie=()=>{X(!1)},me=t=>{var l,h,u,C;I.triggerMoEngageEvent("checkin_clicked",{flight_name:t.airline.displayName,flight_id:t.flightNumber,flight_status:t.flightStatus.displayName,scheduled_time:t.scheduledDate,estimated_time:t.estimatedDate,flight_type:t.flightType,origin_airport:(l=t==null?void 0:t.originAirport)==null?void 0:l.code,origin_terminal:(h=t==null?void 0:t.originAirport)==null?void 0:h.terminal,destination_airport:(u=t==null?void 0:t.destinationAirport)==null?void 0:u.code,destination_terminal:(C=t==null?void 0:t.destinationAirport)==null?void 0:C.terminal}),t.airline.checkinUrl.length>0&&t.airline.checkinUrl.map(b=>{!I.isWebView()&&b.channel.toLowerCase()==="web"||I.isWebView()&&b.channel.toLowerCase(),window.open(b.href,"_blank")})},ue=()=>{we(!0),Ce.hideAllNavs()},Se=()=>{if(s!=null&&s.estimatedDate){const t=f(s==null?void 0:s.estimatedDate).add(5,"hour").add(30,"minute").format();let l=f(t),h=f(new Date),C=f.duration(l.diff(h)).asSeconds();return Z(C)}},De=()=>{if(s.checkInCounters&&s.checkInCounters!==null){let t=s==null?void 0:s.checkInCounters;if(Array.isArray(t)){t.forEach(h=>{Array.isArray(h.id)&&(h.id=Ft(h.id))});let l=[];return t.forEach(h=>{var C,b,A,F,fe,ve,le;let u="";(C=h.group)!=null&&C.toUpperCase().includes("ROW-")?u=(F=(A=(b=h.group)==null?void 0:b.toUpperCase())==null?void 0:A.replace("ROW-",""))==null?void 0:F.trim():(fe=h.group)!=null&&fe.toUpperCase().includes("COUNTER")&&(u=(le=(ve=h.group)==null?void 0:ve.toUpperCase())==null?void 0:le.replace("COUNTER","").trim()),l.push(`${u} ${h.id}`)}),l=l.slice(0,3),l==null?void 0:l.join(",")}}else return"TBA"},Fe=t=>{let l="";switch(t.toUpperCase()){case"ONTIME":l="ontime";break;case"BOARDING":l="boarding";break;case"GATEOPEN":l="gate-open";break;case"ARRIVED":l="arrived";break;case"DEPARTED":l="departed";break;case"DELAYED":l="delayed";break;case"IMMIGRATION":l="immigration";break;case"DIVERTED":l="diverted";break;case"RESCHEDULED":l="rescheduled";break;case"CANCELLED":l="cancelled";break;case"FINALCALL":l="final-call";break;case"GATECLOSED":l="gate-closed";break;case"SECURITY":l="security";break;case"CHECKIN":l="check-in";break;case"ARRIVING EARLY":l="arriving-early";break;default:return""}return l};return e.jsx(c.Fragment,{children:je?e.jsx(Xe,{height:"100%",loaderWidth:"auto",maxHeight:"80px"}):e.jsxs("div",{className:"flight-card-wrapper",children:[!a.hideCloseIcon&&e.jsx("div",{style:{position:"absolute",right:"5
87px",top:0,cursor:"pointer"},onClick:()=>ge(),children:e.jsx("img",{src:(ae=p==null?void 0:p.profile)==null?void 0:ae.closeIcon,alt:"close-icon"})}),e.jsxs("div",{className:"flight-info-container",children:[e.jsx("div",{className:"bottom-border"}),e.jsxs("div",{className:"flight-src-dest-container",children:[e.jsxs("div",{className:"airline-date-container",children:[e.jsxs("div",{className:"airline-container",children:[e.jsx("img",{className:"airline-tail-image",src:a.flightData.airlineImg}),e.jsx("span",{className:"flight-airline-text",children:e.jsx(d,{type:"semi-bold",children:`${a.flightData.airlineName} ${a.flightData.flightId}`})})]}),e.jsx("div",{className:"flight-date-container",children:e.jsx(d,{type:"regular",children:f(a.flightData.scheduleDate).format("llll")})})]}),e.jsxs("div",{className:"src-dest-wrapper",children:[e.jsxs("div",{className:"src-container",children:[e.jsx("div",{className:"src-text",children:e.jsx(d,{type:"bold",children:a.flightData.baseAirport})}),e.jsxs("div",{className:"src-content",children:[s.terminal&&s.terminal!==""?e.jsx("div",{className:"terminal-text",children:e.jsx(d,{type:"regular",children:`Terminal ${s.terminal}`})}):null,(a.flightData.movementType==="D"||a.flightData.movementType==="Departure")&&e.jsx("div",{className:"arr-dep-time-text",children:e.jsx(d,{type:"bold",children:f(a.flightData.scheduleTime).format(Re.time.twentyFourHourMinute)})})]})]}),e.jsxs("div",{className:"flight-icon-container",children:[e.jsx("img",{src:(xe=p==null?void 0:p.home)==null?void 0:xe.Airplane,onClick:()=>Q("LOCATE_ME_ENABLE")&&s!=null&&s.aircraftRegistrationNumber?ue():null}),Q("LOCATE_ME_ENABLE")&&(s==null?void 0:s.aircraftRegistrationNumber)&&e.jsx(d,{type:"extra-bold",children:"Live Location"})]}),e.jsxs("div",{className:"dest-container",children:[e.jsx("div",{className:"src-text",children:e.jsx(d,{type:"bold",children:a.flightData.srcDestAirport})}),e.jsxs("div",{className:"src-content",children:[s.terminal&&s.terminal!==""?e.jsx("div",{className:"terminal-text",children:e.jsx(d,{type:"regular",children:`Terminal ${s.terminal}`})}):null,(a.flightData.movementType==="A"||a.flightData.movementType==="Arrival")&&e.jsx("div",{className:"arr-dep-time-text",children:e.jsx(d,{type:"bold",children:f(a.flightData.scheduleTime).format(Re.time.twentyFourHourMinute)})})]})]})]}),e.jsx("div",{className:"vertical-divider"})]}),e.jsxs("div",{className:"flight-meta-data-container",children:[e.jsxs("div",{className:"meta-label-value-container",children:[e.jsx("div",{className:"value-text",children:e.jsx(d,{type:"bold",children:s&&s.estimatedDate?f(s.estimatedDate).add(5,"hour").add(30,"minute").format(Re.time.twentyFourHourMinute):"TBD"})}),e.jsx("div",{className:"label-text",children:e.jsx(d,{children:"ESTIMATED"})})]}),e.jsx("div",{className:"meta-label-value-divider"}),e.jsxs("div",{className:"meta-label-value-container",children:[e.jsx("div",{className:"value-text check-in",children:a.flightData.movementType==="D"||a.flightData.movementType==="Departure"?e.jsx(d,{type:"bold",children:De()}):e.jsx(d,{type:"bold",children:"NA"})}),e.jsx("div",{className:"label-text",children:e.jsx(d,{children:"Check-in"})})]}),e.jsx("div",{className:"meta-label-value-divider"}),e.jsxs("div",{className:"meta-label-value-container",children:[e.jsx("div",{className:"value-text",children:a.flightData.movementType==="D"?e.jsx(d,{type:"bold",children:s&&s.gates?ot(s.gates):"TBD"}):e.jsx(d,{type:"bold",children:s&&s.baggageBelts?dt(s.baggageBelts):"TBD"})}),e.jsx("div",{className:"label-text",children:e.jsx(d,{children:a.flightData.movementType==="D"?"GATE":"BELT"})})]}),e.jsx("div",{className:"meta-label-value-divider"}),e.jsxs("div",{className:"meta-label-value-container",children:[e.jsx("div",{className:`status-wrapper ${Fe((M=s==null?void 0:s.flightStatus)==null?void 0:M.name)}`,children:e.jsx(d,{type:"bold",children:s&&s.flightStatus&&s.flightStatus.displayName?s.flightStatus.displayName:"TBD"})}),e.jsx("div",{className:"label-text",children:e.jsx(d,{children:"STATUS"})})]})]})]}),e.jsxs("div",{className:"flight-action-container",children:[e.jsx("div",{className:"until-flight-container",children:e.jsx("span",{className:"until-flight-text",children:e.jsx(d,{type:"extra-bold",children:Se()})})}),e.jsxs("div",{className:"action-item-container",children:[!a.showChangeFlight&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"track-flight-button",onClick:()=>Y(s,H),children:e.jsx(d,{type:"extra-bold",children:H?"Stop Updates":"Get Updates"})}),e.jsx("div",{className:`track-flight-button ${K?null:"ui-state-disabled"}`,onClick:()=>me(s),children:e.jsx(d,{type:"extra-bold",children:"Check-In"})})]}),a.showChangeFlight&&e.jsx("div",{className:"track-flight-button",onClick:()=>{var t;return a.handleChangeFlight(((t=a==null?void 0:a.flightData)==null?void 0:t.UID)||"")},children:e.jsx(d,{type:"extra-bold",children:"Change flight"})})]})]}),J&&e.jsx(et,{handleRemoveFlight:te,onClose:ie})]})})}function Wt(a){var w,N,s;const j=c.useContext(ct),T=c.useContext(be),p=()=>e.jsx(e.Fragment,{}),m=y=>{a.validateEditFlight&&a.validateEditFlight(y)?a.setShowRemoveFlightModal(!0):a.handleAddFlightShow()};return e.jsxs(zt,{children:[e.jsxs(Pt,{children:[e.jsxs(Ht,{children:[e.jsxs(ii,{onClick:()=>a.handleGoBack(),children:[e.jsx(ai,{src:(w=T==null?void 0:T.terminalTwo)==null?void 0:w.backArrow}),e.jsx(li,{children:e.jsx(d,{children:"Go Back"})})]}),e.jsxs(Yt,{children:[e.jsx(qt,{children:e.jsx(d,{children:"We will be delivering your food at:"})}),e.jsx(d,{type:"bold",children:"Please confirm your delivery location"})]}),e.jsx(Qt,{children:e.jsx(Jt,{children:e.jsx("div",{style:{width:"100%",position:"relative"},children:e.jsx(ft,{components:{IndicatorSeparator:p},styles:{valueContainer:y=>({...y,fontSize:"16px",fontWeight:"500",color:"#222",paddingLeft:"20px",fontFamily:"ManropeRegular"}),control:y=>({...y,minHeight:"54px",borderRadius:"8px",border:"1px solid #DCDCDC","&:hover":{border:"1px solid #DCDCDC"}}),menu:y=>
87({...y,boxShadow:"none",borderRadius:"8px",marginTop:"5px",marginBottom:"8px",maxHeight:"80px"}),menuList:y=>({...y,maxHeight:"150px"}),option:y=>({...y,border:"1px solid #DCDCDC",display:"flex",alignItems:"center",fontSize:"16px",fontWeight:"500",color:"#222",backgroundColor:"#fff"}),singleValue:y=>({...y,fontSize:"16px",fontWeight:"500",letterSpacing:"0.35px",color:"#222",fontFamily:"ManropeRegular"}),noOptionsMessage:y=>({...y,fontSize:"16px",fontWeight:"500",letterSpacing:"0.35px",color:"#181818",fontFamily:"ManropeRegular"})},"aria-label":"Boarding Gate",placeholder:"Your boarding gate e.g. 34A",value:a.selectedGate,onChange:y=>a.setSelectedGate(y),options:a.gates})})})}),e.jsx(ei,{children:e.jsx(ti,{theme:j,onClick:()=>a.handleStartOrdering(),disabled:a.selectedGate===null||a.selectedGate===void 0||a.disableStartOrdering===!0,children:e.jsx(d,{type:"bold",children:"Start Ordering Now"})})})]}),e.jsx(Vt,{children:e.jsx(Gt,{flightData:a.flightData,setAirportData:a.setFlightData,handleChangeFlight:m,enableTheme:!1,hideCloseIcon:!0,showChangeFlight:!0})})]}),(a==null?void 0:a.preOrderAvailable)&&e.jsx(Xt,{children:e.jsx(tt,{value:a.time,setValue:a.setTime,minTime:Oe(),label:"Want to pre-order?",triggerStyle:{zIndex:998}})}),e.jsx(Kt,{children:e.jsx(Zt,{src:(s=(N=T==null?void 0:T.pages)==null?void 0:N.edpFSTR)==null?void 0:s.addFlightIllustration,alt:"floral-image"})})]})}const zt=n.section`
88  width: 100%;
89  padding: 24px;
90  background: var(
91    --grey,
92    linear-gradient(139deg, #60678b -35.77%, #1f2131 140.71%)
93  );
94  height: 100%;
95  position: relative;
96
97  @media ${D.laptop} {
98    height: fit-content;
99    padding: 32px 136px 52px 136px;
100  }
101`,Pt=n.div`
102  display: flex;
103  flex-direction: column;
104
105  @media ${D.laptop} {
106    flex-direction: row;
107    align-items: center;
108    gap: 142px;
109  }
110`,Ht=n.div`
111  width: 100%;
112
113  @media ${D.laptop} {
114    width: 40%;
115  }
116`,Vt=n.div`
117  display: none;
118
119  @media ${D.laptop} {
120    display: flex;
121    width: 60%;
122    z-index: 1;
123  }
124`,Yt=n.div`
125  color: #fff;
126  font-size: 20px;
127  line-height: 26px;
128
129  @media ${D.laptop} {
130    padding-top: 24px;
131  }
132`,qt=n.div`
133  color: #fff;
134  font-size: 14px;
135  line-height: 26px;
136  padding-top: 8px;
137
138  @media ${D.laptop} {
139    padding-top: 16px;
140  }
141`,Qt=n.div`
142  width: 100%;
143  margin-top: 24px;
144  background-color: #fff;
145  border-radius: 12px;
146  border: 1px solid #dcdcdc;
147`,Jt=n.div`
148  width: 100%;
149  position: relative;
150  z-index: 999;
151  pointer-events: auto;
152`,Xt=n.div`
153  width: 100%;
154  padding: 32px 0px 0px 0px;
155  display: block;
156
157  @media ${D.laptop} {
158    display: none;
159    width: 50%;
160  }
161`,Kt=n.div`
162  position: absolute;
163  top: 0px;
164  right: 0px;
165`,Zt=n.img``,ei=n.div`
166  display: none;
167
168  @media ${D.laptop} {
169    display: flex;
170    width: 100%;
171    margin-top: 24px;
172  }
173`,ti=n(ht)`
174  width: 100%;
175  height: 54px;
176`,ii=n.div`
177  display: none;
178
179  @media ${D.laptop} {
180    display: flex;
181    align-items: center;
182    gap: 10px;
183    cursor: pointer;
184  }
185`,ai=n.img``,li=n.div`
186  font-size: 16px;
187  color: #fff;
188`;function si(){const{timezone:a}=Ke(),{pushHistory:j}=Le(),T=()=>{var m,w,N,s;let p=re("productsData");if(((m=p==null?void 0:p.deliveryOptions)==null?void 0:m.deliveryOption)===((N=(w=E)==null?void 0:w.deliveryOptions)==null?void 0:N.takeaway)&&((s=p==null?void 0:p.deliveryOptions)==null?void 0:s.isScheduled)===!0)j("/takeaway-selection?domain=Food and Beverages");else{let y={deliveryOptions:{deliveryOption:E.deliveryOptions.takeaway,deliveryTime:f(new Date,"UTC","UTC").format(),isPackagingRequested:!0,timezone:a}};ne("productsData",y),j("/takeaway-selection?domain=Food and Beverages")}};return e.jsxs(ri,{children:[e.jsx(ni,{children:e.jsx(d,{type:"semi-bold",children:"Don't have a departing flight? 🛩"})}),e.jsx(oi,{children:e.jsx(d,{children:"Without your flight details we cannot deliver to your gate, but you can pick up your order!"})}),e.jsx(di,{onClick:()=>T(),children:e.jsx(d,{type:"extra-bold",children:"Opt For Takeaway"})})]})}const ri=n.section`
189  width: 100%;
190  padding: 24px;
191  border-radius: 4px;
192  background: #f2f2f2;
193`,ni=n.div`
194  color: #273135;
195  font-size: 18px;
196  line-height: 23px;
197`,oi=n.div`
198  color: #273135;
199  font-size: 14px;
200  margin-top: 8px;
201`,di=n.div`
202  color: #037b79;
203  font-size: 16px;
204  line-height: 24px;
205  margin-top: 12px;
206`,ci=n.div`
207  width: 100%;
208  height: 100%;
209  position: relative;
210
211  @media ${D.laptop} {
212    height: 100vh;
213    padding-bottom: 100px;
214  }
215`,hi=n.section`
216  width: 100%;
217  padding: 45px 24px 29px 24px;
218  background-color: #fff;
219
220  @media ${D.laptop} {
221    display: none;
222  }
223`,pi=n.div`
224  display: flex;
225  align-items: center;
226  gap: 10px;
227`,gi=n.img``,mi=n.div`
228  color: #273135;
229  font-size: 16px;
230  font-weight: 500;
231`,ui=n.section`
232  width: 100%;
233  height: 100%;
234  position: relative;
235`,xi=n.section`
236  width: 100%;
237  padding: 32px 24px 0px 24px;
238
239  @media ${D.laptop} {
240    width: 50%;
241    padding: 40px 136px 0px 136px;
242  }
243`,fi=n.section`
244  width: 100%;
245  height: 77px;
246  padding: 16px 24px;
247  position: fixed;
248  bottom: 0px;
249  left: 0px;
250  background-color: #fff;
251  z-index: 1;
252
253  @media ${D.laptop} {
254    display: none;
255  }
256`,vi=n.button`
257  width: 100%;
258  display: flex;
259  justify-content: center;
260  align-items: center;
261  padding: 12px 16px;
262  border-radius: 100px;
263  background: #037b79;
264  opacity: ${a=>a.disabled?.5:1};
265`,yi=n.div`
266  color: #fff;
267  font-size: 16px;
268  line-height: 21px;
269`,bi=n.div`
270  width: 100%;
271  padding: 32px 24px 0px 24px;
272  display: none;
273
274  @media ${D.laptop} {
275    display: block;
276    width: 50%;
277    padding: 40px 136px 0px 136px;
278  }
279`;function aa(a){var le,$e;const{pathname:j}=pt(),T=gt(),p=c.useContext(Ze),m=c.useContext(Je),w=c.useContext(Qe),N=c.useContext(be),{pushHistory:s}=Le(),{preOrderAvailable:y,timezone:je}=Ke(),[de,U]=c.useState(!0),[L,H]=c.useState(!1),[g,J]=c.useState({}),[X,K]=c.useState(!1),[B,Te]=c.useState(null),[we,Ce]=c.useState([]),[ce,_]=c.useState(Oe()),[he,Z]=c.useState(!1),[V,pe]=c.useState(!1),[Y,ge]=c.useState([]),[ee,te]=c.useState(!1),[ie,me]=c.useState(!1);c.useEffect(()=>{const i=j==="/delivery-flight-selection";return ue(),Se(),Fe(),I.getQrCodeSource(window.location.href),De(),()=>
279{qe.isMobile&&i&&(p.showHeaderNavs(),p.showFooterNavs(),p.showBottomNavs())}},[j]);const ue=()=>{qe.isMobile?(p.hideHeaderNavs(),p.hideFooterNavs(),p.hideBottomNavs()):(p.showHeaderNavs(),p.hideFooterNavs(),p.showBottomNavs())},Se=()=>{let i=re("productsData");if(i==null){let r={deliveryOptions:{deliveryOption:E.deliveryOptions.deliveryAtGate,deliveryTime:f(new Date,"UTC","UTC").format(),isPackagingRequested:!0,isDelivery:!0,timezone:je}};ne("productsData",r)}},De=()=>{var r,o,x,v;let i=I.getUrlParams(window.location.href);(o=(r=i==null?void 0:i.QRCodescancampaign)==null?void 0:r.toLowerCase())!=null&&o.includes("deliver-to-gate")?(me(!0),w.reset(),w.clearSavedLocalCart(),U(!1)):((v=(x=re("qrCodeSource"))==null?void 0:x.toLowerCase())!=null&&v.includes("deliver-to-gate")&&me(!0),U(!1))},Fe=()=>{let i=m.myFlights();if((i==null?void 0:i.length)>0){const r=i.find(o=>{var x;return o.movementType==="D"||((x=o==null?void 0:o.movementType)==null?void 0:x.toLowerCase())==="departure"});r&&ae(r==null?void 0:r.flightId)}},ae=async i=>{var o,x,v,k,G,q,R,$,ye,Ue,Be,Ie,_e,Me,Ge,We,ze;U(!0);let r=m.getFlightById(i);if(r){let it=i,at=r==null?void 0:r.scheduleDate,lt=r==null?void 0:r.movementType,st=f(at,"UTC","UTC").format(),Pe="Departure";lt==="A"&&(Pe="Arrival");try{let ke=E.api.flightSearch.replace("{{date}}",st).replace("{{movementType}}",Pe).replace("{{flightNo}}",it),O=await(await oe.get(ke)).json();if(O.data.length>0)if((o=O.data[0])!=null&&o.terminal){r.terminal=(x=O.data[0])==null?void 0:x.terminal,r.estimatedDate=f((v=O.data[0])==null?void 0:v.estimatedDate,"UTC","UTC").add(5,"hour").add(30,"minute").format("lll");let S=JSON.parse(JSON.stringify(re("productsData"))),rt=((k=S==null?void 0:S.flightDetails)==null?void 0:k.UID)===(r==null?void 0:r.UID);const W=await xe(r);if((G=S==null?void 0:S.deliveryOptions)!=null&&G.deliveryAddress?M(`${S.deliveryOptions.deliveryAddress}`,`T${(q=O.data[0])==null?void 0:q.terminal}`):($=(R=O.data[0])==null?void 0:R.gates[0])!=null&&$.gateNumber?M(`Gate ${(Ue=(ye=O.data[0])==null?void 0:ye.gates[0])==null?void 0:Ue.gateNumber}`,`T${(Be=O.data[0])==null?void 0:Be.terminal}`):(W==null?void 0:W.length)>0&&((Ie=W==null?void 0:W[0])!=null&&Ie.value)?M(`Gate ${(_e=W[0])==null?void 0:_e.value}`,`T${(Me=O.data[0])==null?void 0:Me.terminal}`):M("Gate",`T${(Ge=O.data[0])==null?void 0:Ge.terminal}`),S.flightDetails=r||[],(We=S==null?void 0:S.deliveryOptions)!=null&&We.deliveryTime&&rt){const z=f(`${(ze=S==null?void 0:S.deliveryOptions)==null?void 0:ze.deliveryTime}`).format();_(z);return}const He=f(r.estimatedDate),Ve=f();if(He.diff(Ve,"minutes")>=yt){const z=He.clone().subtract(bt,"minutes").format();S.deliveryOptions.deliveryTime=z,S.deliveryOptions.isScheduled=!0,ne("productsData",S);const Ne=f(`${z}`).format();_(Ne)}else{const z=Ve.clone().format();S.deliveryOptions.deliveryTime=z,S.deliveryOptions.isScheduled=!1,ne("productsData",S);const Ne=f(`${z}`).format();_(Ne)}U(!1)}else throw Error();else throw Error()}catch(ke){U(!1),console.log(ke)}}else U(!1),console.log("No flights found")},xe=async i=>{var o,x,v;J(i);const r=await t(i);return Ce(r),Q("FSTR_DELIVERY_TERMINAL2_ENABLED")&&((i==null?void 0:i.terminal)==="2"||((o=i==null?void 0:i.terminal)==null?void 0:o.toLowerCase())==="t2"||((x=i==null?void 0:i.terminal)==null?void 0:x.toLowerCase())==="terminal2"||((v=i==null?void 0:i.terminal)==null?void 0:v.toLowerCase())==="terminaltwo"?(Q("FSTR_DELIVERY_TERMINAL2_ERROR_TEXT")&&Q("FSTR_DELIVERY_TERMINAL2_ERROR_TEXT")!==""&&P.error(Q("FSTR_DELIVERY_TERMINAL2_ERROR_TEXT")),pe(!0)):pe(!1)),H(!0),r},M=(i,r)=>{var o;Te({label:`${r==null?void 0:r.replace("Terminal","T")}, Boarding ${i}`,value:(o=i==null?void 0:i.split("Gate")[1])==null?void 0:o.trim()})},t=async i=>{var r;try{ue();let o=(i==null?void 0:i.terminal)||"";const x=(i==null?void 0:i.sector)||"";let v=[],k=[];const G=E.api.flightGate.gateListing;let R=await(await oe.get(G,{terminal:o==null?void 0:o.toString(),type:x==null?void 0:x.toLowerCase()})).json();if(R.status===200&&((r=R==null?void 0:R.data)==null||r.forEach($=>{v=v.concat($.gates)})),v.length>0)return v.sort(($,ye)=>parseInt($)-parseInt(ye)),v.forEach($=>{k.push({value:$,label:`T${o}, Boarding Gate ${$}`})}),k}catch(o){console.log(o)}},l=()=>{K(!0)},h=i=>
279{var x,v;let r=m.myFlights(),o=[];typeof i=="object"&&i!==null&&(i!=null&&i.flight_unique_no)&&((r==null?void 0:r.length)>1&&(o=r.filter(k=>k.UID!==(i==null?void 0:i.uid)),(x=o[0])!=null&&x.UID&&m.removeFlight((v=o[0])==null?void 0:v.UID)),ae(i==null?void 0:i.flight_unique_no)),K(!1)},u=()=>{var v,k,G,q,R;let i=JSON.parse(JSON.stringify(re("productsData")));i.domain=jt.fnb,i.terminal=`Terminal${g==null?void 0:g.terminal}`;let r="Departure";((g==null?void 0:g.movementType)==="A"||((v=g==null?void 0:g.movementType)==null?void 0:v.toLowerCase())==="arrival")&&(r="Arrival"),i.movementType=r;let o="Domestic";((g==null?void 0:g.sector)==="I"||((k=g==null?void 0:g.sector)==null?void 0:k.toLowerCase())==="international")&&(o="International"),i.sector=o,i.deliveryOptions.deliveryAddress=`Gate ${B==null?void 0:B.value}`,i.deliveryOptions.deliveryOption=E.deliveryOptions.deliveryAtGate,i.deliveryOptions.isDelivery=!0;let x=f(g==null?void 0:g.estimatedDate).subtract(o==="Domestic"?Ae:Ee,"minutes").format("lll");if(f(x).isSameOrBefore(f(new Date))){P.error(`Please select a flight which is at least ${o==="Domestic"?Ae:Ee}mins from current time`);return}if((G=i.deliveryOptions)!=null&&G.isScheduled&&f((q=i.deliveryOptions)==null?void 0:q.deliveryTime).isSameOrAfter(x)){P.error(`Please select a time which is at least ${o==="Domestic"?Ae:Ee}mins before flight time`);return}(R=i.deliveryOptions)!=null&&R.isScheduled||i.deliveryOptions&&(i.deliveryOptions.deliveryTime=f(new Date,"UTC","UTC").format()),ne("productsData",i),w.updateFnbItemDelAndFlight(i.deliveryOptions,g.flightId,g.UID),St(i,w,te,ge,T,b)},C=()=>{Dt(w,Y),te(!1),ge([]),s("/takeaway")},b=()=>{s("/takeaway")},A=()=>{ie||s("/")},F=i=>{let r=!1,o=w.getCart();return Object.values(o).forEach(x=>{x.items.forEach(v=>{var k;v.flightUid===i&&((k=v==null?void 0:v.deliveryOptions)==null?void 0:k.deliveryOption)===E.deliveryOptions.deliveryAtGate&&(r=!0)})}),r},fe=()=>{let i=w.getCart();Object.values(i).forEach(r=>{r.items=r.items.filter(o=>{var x;return o.flightUid!==(g==null?void 0:g.UID)&&((x=o==null?void 0:o.deliveryOptions)==null?void 0:x.deliveryOption)!==E.deliveryOptions.deliveryAtGate})}),Z(!1),l()},ve=()=>{Z(!1)};return de?e.jsx(Xe,{}):e.jsxs(ci,{children:[e.jsx(hi,{children:e.jsxs(pi,{onClick:()=>A(),children:[!ie&&e.jsx(gi,{src:($e=(le=N==null?void 0:N.pages)==null?void 0:le.edpFSTR)==null?void 0:$e.backArrow,alt:"back-arrow"}),e.jsx(mi,{children:e.jsx(d,{children:"Deliver To My Gate"})})]})}),e.jsxs(ui,{tabIndex:"0",children:[L?null:e.jsx(kt,{handleAddFlightShow:l,handleGoBack:A}),L?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{flightData:g,setFlightData:J,handleAddFlightShow:l,validateEditFlight:F,showRemoveFlightModal:he,setShowRemoveFlightModal:Z}),e.jsx(Wt,{selectedGate:B,setSelectedGate:Te,gates:we,flightData:g,setFlightData:J,time:ce,setTime:_,handleAddFlightShow:l,handleStartOrdering:u,disableStartOrdering:V,handleGoBack:A,preOrderAvailable:y})]}):null,e.jsx(bi,{children:e.jsx(tt,{value:ce,setValue:_,minTime:Oe(),label:"Want to pre-order?",triggerStyle:{zIndex:998}})}),!L&&!ie?e.jsx(xi,{children:e.jsx(si,{})}):null]}),L?e.jsx(fi,{children:e.jsx(vi,{onClick:()=>u(),disabled:B==null||V===!0,children:e.jsx(yi,{children:e.jsx(d,{type:"extra-bold",children:"Start ordering"})})})}):null,he&&e.jsx(et,{modalText:`You have some items in your cart that are mapped to this flight.
280            Editing this flight will remove those items from your cart. Do
281            you wish to continue?`,handleRemoveFlight:fe,onClose:ve}),ee&&e.jsx(vt,{isDrawerOpen:ee,setIsDrawerOpen:te,clearAndProceed:C}),e.jsx(ut,{show:X,setShow:K,onHide:h,onExited:h,fullscreen:!0,children:e.jsx(xt,{handleOnAddFlight:h,onlyDepartureFlights:!0,flightSuccessHandler:!0})})]})}export{aa as default};
282//# sourceMappingURL=deliveryFlightSelection-st3xgsgg.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.