1(this["webpackJsonp@yas/yasisland"]=this["webpackJsonp@yas/yasisland"]||[]).push([[34],{785:function(e,t,a){"use strict";a.r(t),a.d(t,"default",(function(){return O}));var r=a(20),i=a(21),n=a(24),o=a(25),c=a(0),s=a.n(c),l=a(7),m=a.n(l),u=a(896),d=a(16),h=a(84),p=a(2),b=a(1),T=a(134),f=a(11),v=a.n(f),y=a(41),C=a(8),g=a(4),O=function(e){Object(n.a)(a,e);var t=Object(o.a)(a);function a(e){var i;return Object(r.a)(this,a),(i=t.call(this,e)).handleScroll=function(){Object(b.P)(p.a.iamMapping.etihadarena)&&(i.scrollThrottle||(i.scrollThrottle=setTimeout((function(){i.updateHeaderInfo(),i.scrollThrottle=null}),50)))},i.updateHeaderInfo=function(){if(Object(b.P)(p.a.iamMapping.etihadarena)){var e=i.getHeaderHeight();i.setState({headerInfo:e})}},i.setupCartObserver=function(){if(Object(b.P)(p.a.iamMapping.etihadarena)){var e=setInterval((function(){var t=document.querySelector(".c-my-cart-b2c-container");t&&(clearInterval(e),i.cartObserver=new MutationObserver((function(e){e.forEach((function(e){"attributes"===e.type&&"class"===e.attributeName&&i.updateCartTimerPosition()}))})),i.cartObserver.observe(t,{attributes:!0,attributeFilter:["class"],subtree:!0,childList:!0}),i.updateCartTimerPosition())}),100);setTimeout((function(){return clearInterval(e)}),1e4)}},i.updateCartTimerPosition=function(){if(Object(b.P)(p.a.iamMapping.etihadarena)){var e=document.querySelector(".cart-timer-component"),t=document.querySelector(".c-my-cart-b2c-container"),a=window.innerWidth>1023,r=!1;if(t){if(!(r=t.classList.contains("express-cart-expanded")))t.querySelector(".express-cart-expanded")&&(r=!0);document.querySelector(".express-cart-expanded")&&(r=!0)}e&&(e.style.top=r&&!a?"565px":"")}},i.setCartTimerInMobileApp=function(){var e=Object(b.le)()&&Object(b.Ec)();if(i.userAgent&&e&&!e.isCartTimerMobileAppLogin){var t=e.tenantID&&e.tenantID.toLowerCase()===p.a.ymcB2CTenant;t&&T.seatedLocalStorageSvc.RemoveSeatedJourneyKeys(),i.cartActions.getCartOnPageLoad().then((function(e){var a=Object(b.vf)(e,"data.cart.items")&&e.data.cart.items.find((function(e){return Object(b.fe)(e)}));t&&(a?window.PubSub.publish("startCartTimer",{startDate:a.timeStamp}):window.PubSub.publish("stopCartTimer"))})).catch((function(e){t&&window.PubSub.publish("stopCartTimer")})),e.isCartTimerMobileAppLogin=!0,localStorage.setItem("loggedInUser",JSON.stringify(e))}},i.isCartTimeout=function(){var e=i.state.endDate&&m.a.utc(i.state.endDate),t=!1;e?m.a.duration(e.diff(m.a.utc())).asSeconds()<0&&(i.cartTimerTimeout(!0),t=!0):(i.setDisableState(!0),t=!0);return t},i.setDisableState=function(e){e&&(localStorage.removeItem("cartTimerEndDate"),i.setState({endDate:null,hideTimer:"hide-timer"}),window.PubSub.publish("clearCartTimer"))},i.cartTimerTimeoutOverlayContent=function(){var e=i.props.data;return s.a.createElement("div",{className:"cart-timer-timeout-overlay-body"},e.cartTimerTimeoutOverlayContent&&e.cartTimerTimeoutOverlayContent.content&&s.a.createElement(d.a,{tagName:"p",attrs:{className:"body-copy-2"},innerHtml:e.cartTimerTimeoutOverlayContent.content}),s.a.createElement("div",{className:"btn-container"},e.cartTimerTimeoutOverlayContent&&e.cartTimerTimeoutOverlayContent.primaryCTA&&s.a.createElement("div",{className:"btn btn-primary"},s.a.createElement(d.a,{tagName:"a",attrs:{className:"buy-product-cta",href:e.cartTimerTimeoutOverlayContent.primaryCTA.link.href},innerHtml:e.cartTimerTimeoutOverlayContent.primaryCTA.link.label})),!i.userAgent&&e.cartTimerTimeoutOverlayContent&&e.cartTimerTimeoutOverlayContent.secondaryCTA&&s.a.createElement("div",{className:"btn btn-secondary"},s.a.createElement(d.a,{tagName:"a",attrs:{className:"buy-product-cta",href:e.cartTimerTimeoutOverlayContent.secondaryCTA.link.href},innerHtml:e.cartTimerTimeoutOverlayContent.secondaryCTA.link.label}))))},i.cartTimerTimeout=function(e){e&&i.cartActions._clearCart().then((function(e){Object(b.He)()&&i.userAgent?window.JSbridge.nativeCallback({orderID:"",ref:"",status:"",error:{code:"408",text:p.a.mobileAppMessage.eventDetail}}):window.PubSub.publish(p.a.events.TOGGLE_OVERLAY_STATE,{shouldOpen:!0,dataToAppend:i.cartTimerTimeoutOverlayContent(),customClass:"cart-timer-timeout-overlay"}),T.seatedLocalStorageSvc.RemoveSeatedJourneyKeys(),Object(b.He)()&&y.YALocalStorageSvc.removeSelectedPerformanceDetails(),window.PubSub.subscribe("closeOverlay",(function(e,t){Object(b.d)(),window.location.reload()}))})),i.setDisableState(e)},i.userAgent=Object(b.sd)()||!Object(b.Ed)(),i.state={endDate:null,hideTimer:"hide-timer",showCheckoutCTA:!0,headerInfo:{height:0,isInViewport:!1,isPartiallyVisible:!1}},i.cartActions=new h.default({serviceUrl:i.props.data.services,moduleName:"cart-timer",tenantId:Object(b.Ec)().tenantID}
1),i.scrollThrottle=null,i.cartObserver=null,i}return Object(i.a)(a,[{key:"componentDidMount",value:function(){var e=this;Object(b.P)(p.a.iamMapping.etihadarena)&&(this.updateHeaderInfo(),window.addEventListener("scroll",this.handleScroll),this.setupCartObserver());var t=Object(b.w)()&&localStorage.getItem("cartTimerEndDate");t&&this.setState({endDate:t,hideTimer:"show-timer"}),this.isCartTimeout()&&this.setDisableState(!0);var a=this.props.data.timerLimitInMinutes;window.PubSub.subscribe("startCartTimer",(function(t,r){var i=e.props.data.timezoneDifferenceToUTC?parseFloat(e.props.data.timezoneDifferenceToUTC):4;if(r&&r.startDate){var n=m.a.utc(r.startDate),o=n.clone().subtract(i,"hours"),c=a&&parseInt(a,10)||15,s=m.a.utc(),l=o.clone().add(c,"minutes");if(l.diff(s)<0){var u=n.clone().add(c,"minutes");u.diff(s)>0&&(l=u)}var d=l.format(),h="show-timer";if(Object(b.He)())m.a.duration(m.a.utc(d).diff(s))<0&&(h="hide-timer");localStorage.setItem("cartTimerEndDate",d),e.setState({endDate:d,hideTimer:h})}})),window.PubSub.subscribe("stopCartTimer",(function(){e.setDisableState(!0)})),window.PubSub.subscribe("hideCartTimerOnParticularPage",(function(){e.setState({showCheckoutCTA:!1})})),this.setCartTimerInMobileApp()}},{key:"componentWillUnmount",value:function(){Object(b.P)(p.a.iamMapping.etihadarena)&&(window.removeEventListener("scroll",this.handleScroll),this.scrollThrottle&&clearTimeout(this.scrollThrottle),this.cartObserver&&this.cartObserver.disconnect())}},{key:"getHeaderHeight",value:function(){if(!Object(b.P)(p.a.iamMapping.etihadarena))return{height:0,isInViewport:!1};var e=document.getElementById("c-header"),t=document.querySelector(".cart-timer-component"),a=document.querySelectorAll(".ea-express-checkout"),r=window.innerWidth>1023;if(t&&a.length>0&&r?a.forEach((function(e){e.style.marginTop="32px"})):a.length>0&&a.forEach((function(e){e.style.marginTop=""})),e){var i=e.getBoundingClientRect(),n=i.top>=0&&i.left>=0&&i.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&i.right<=(window.innerWidth||document.documentElement.clientWidth);return{height:e.offsetHeight,isInViewport:n}}return{height:0,isInViewport:!1}}},{key:"render",value:function(){var e=this.props.data,t=this.state.headerInfo,a={endDate:this.state.endDate,isCartTimer:!0,options:{minutes:e.options.Minutes,seconds:e.options.Seconds}},r=v()("proceed-to-checkout-cta",{"hide-checkout":e.hideCheckout}),i=Object(b.P)(p.a.iamMapping.etihadarena);try{return s.a.createElement("div",{className:v()("cart-timer-component",this.state.hideTimer,{"sticky-timer":t.isInViewport})},this.state.endDate&&s.a.createElement("div",{className:"cart-timer-container"},i&&s.a.createElement(g.K,{id:"icn-timer"}),s.a.createElement("div",{className:"text-info"},s.a.createElement("span",{className:"text-info-desktop"},e.cartTimerText.desktop),s.a.createElement("span",{className:"text-info-mobile"},e.cartTimerText.mobile)),s.a.createElement("div",{className:"timer-wrapper"},s.a.createElement(u.a,{data:a,disableSelection:this.cartTimerTimeout})),this.state.showCheckoutCTA&&s.a.createElement("div",{className:r},e.ctaDetails&&e.ctaDetails.link&&s.a.createElement(d.a,{tagName:"a",attrs:{className:"proceed-to-checkout-desktop",href:e.ctaDetails.link.href},innerHtml:e.ctaDetails.label.desktop}),e.ctaDetails&&e.ctaDetails.link&&s.a.createElement(d.a,{tagName:"a",attrs:{className:"proceed-to-checkout-mobile",href:e.ctaDetails.link.href},innerHtml:e.ctaDetails.label.mobile}))))}catch(n){return Object(C.b)(n,"CartTimer")}}}]),a}(s.a.Component)}}]);
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.