PageSourceSearch

https://www.marhabaservices.com/on/demandware.static/Sites-dnata-U…/js/app/product/ChauffeurStandalone.js

js marhabaservices.com collected 2026-09-24 23:14:13 UTC 13,506 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkapp_dnata=self.webpackChunkapp_dnata||[]).push([[5497],{42453:function(e,t,a){a.r(t),a.d(t,{default:function(){return C}});var r=a(70491),i=a(25763),n=a(4008),s=a(20058),o=a(7471),c=a(49272),u=a(6790);function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function h(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,r)}return a}function f(e,t,a){return(t=v(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function d(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?p(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,r=Array(t);a<t;a++)r[a]=e[a];return r}function g(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,v(r.key),r)}}function v(e){var t=function(e,t){if("object"!=l(e)||!e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var r=a.call(e,t||"default");if("object"!=l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==l(t)?t:t+""}function m(e,t,a){return t=b(t),function(e,t){if(t&&("object"==l(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,y()?Reflect.construct(t,a||[],b(e).constructor):t.apply(e,a))}function y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(y=function(){return!!e})()}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}function D(e,t){return D=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},D(e,t)}var C=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),m(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&D(e,t)}(t,e),a=t,r=[{key:"initCache",value:function(){this.classes={},this.classes.hidden="hidden",this.classes.serviceBlock="js-service-block",this.classes.servicesBlock="js-services-block",this.classes.searchFieldsGroup="js-search_widget-group",this.selectors.chauffeurDetailsButton=this.element.querySelector(".js-chauffeur-details-button"),this.selectors.chauffeurDataMissedError=this.element.querySelector(".js-chauffeur-data_missed-error"),this.selectors.serviceRadio=this.element.querySelectorAll(".js-search_widget-tab-radio"),this.selectors.flightDataFields=this.element.querySelectorAll(".".concat(this.classes.servicesBlock," input,select")),this.selectors.widgetForm=this.element.querySelector(".js-search-widget-inner"),this.componentData={currentProduct:null,chauffeurData:null,productCode:"",flightChanged:!1,carType:this.options.variationAttributes&&this.options.variationAttributes.tier,carName:this.options.variationAttributesDisplayValues&&this.options.variationAttributesDisplayValues.tier}}},{key:"initState",value:function(){var e=this;this.productFlags={attributesSelected:this.options.isVarAttributesSelected,flightDataFilled:!1},this.options.dataPreFilled&&n.Event.on("component.register.SearchWidget",function(){e.fillFlightData()})}},{key:"bindEvents",value:function(){(0,s.on)("click",this.selectors.chauffeurDetailsButton,this.openChauffeurModal.bind(this)),(0,s.on)("change",this.selectors.serviceRadio,this.serviceChanged.bind(this)),(0,s.on)("change",this.selectors.flightDataFields,this.flightDataChanged.bind(this)),$(this.selectors.flightDataFields).on("dp.change",this.flightDataChanged.bind(this)),n.Event.on("pdp.attributeSelected",this.variationAttributeChanged,this),n.Event.on("pdp.availabilityData",this.processAvailabilityData,this),n.Event.on("pdp.chauffeurDetailsChanged",this.chauffeurDetailsChanged,this),n.Event.on("pdp.flightChanged",this.flightChanged,this),n.Event.on("pdp.getAllProductData",this.getAllProductData,this),n.Event.on("pdp.getFormData",this.getFormData,this),n.Event.on("pdp.getMaxPassengersPerCar",this.getMaxPassengersPerCar,this),n.Event.on("pdp.passengersChanged",this.passengersChanged,this),n.Event.on("pdp.updateImages",this.updateImages,this),n.Event.on("chauffeurModal.open",this.openChauffeurModal,this)}},{key:"variationAttributeChanged",value:function(e){if(e&&e.product&&e.product.variationAttributes){this.currentProduct=e.product;var t=e.product.variationAttributes;this.componentData.currentProduct=e.product,this.productFlags.attributesSelected=t.every(function(e){var t=e.selectedValue,a=!1;if(t)for(var r=0,i=e.values.length;r<i;r++)if(e.values[r].id===t){a=!0;break}return a}),this.getMaxPassengersPerCar(),this.dataChanged(),this.flightChanged()}}},{key:"getMaxPassengersPerCar",value:function(e){var t=this.getCarData(),a=t.carType&&this.options.carTypes&&this.options.carTypes[t.carType]||{};e?e.resolve(a):n.Event.emit("pdp.maxPassengersPerCarChanged",a)}},{key:"passengersChanged",value:function(){this.dataChanged()}},{key:"openChauffeurModal",value:function(){var e,t=this,a=this.getSelectedServiceData(),r=new 
1URL(this.element.dataset.chauffeurUrl,document.location.origin),n=this.componentData.currentProduct,s=n&&n.id||null,o=a.serviceName;a.serviceBlock&&(e=a.serviceBlock.querySelector("select[name$=FlightNumber]").value),o&&e?(s&&r.searchParams.set("pid",s),r.searchParams.append("flightNumber",e),r.searchParams.append("service",o),this.componentData.flightChanged&&r.searchParams.append("flightChanged",this.componentData.flightChanged),$.ajax({url:r.toString(),method:"GET"}).done(function(e,a,r){i.y.open({content:e,cssClass:["m-large"],callback:function(){document.body.style.top=null}}),t.componentData.flightChanged=!1}).fail(function(e,t,a){})):this.selectors.chauffeurDataMissedError.classList.remove(this.classes.hidden)}},{key:"fillFlightData",value:function(){var e=this,t=this.getSelectedServiceData();t.serviceBlock&&t.serviceBlock.querySelectorAll("select[name$=FlightNumber]").forEach(function(t){if(1===t.options.length){var a=t.closest(".".concat(e.classes.searchFieldsGroup));(0,s.hZ)("updateFlights",a)}})}},{key:"toggleEditChauffeurDetailsButton",value:function(e){var t=this.selectors.chauffeurDetailsButton.querySelector(".js-edit-details"),a=this.selectors.chauffeurDetailsButton.querySelector(".js-enter-details");e?(t.classList.remove("hidden"),a.classList.add("hidden")):(t.classList.add("hidden"),a.classList.remove("hidden"))}},{key:"chauffeurDetailsChanged",value:function(e){e?(this.componentData.chauffeurData=e,this.dataChanged()):this.resetChauffeurData(),this.toggleEditChauffeurDetailsButton(!!e),n.Event.emit("chauffeur.toggleEnterDetails",!e)}},{key:"getSelectedServiceData",value:function(){var e=d(this.selectors.serviceRadio).filter(function(e){return e.checked})[0],t={serviceName:null,serviceBlock:null};return e&&(t.serviceName=e.dataset.attrValue,t.serviceBlock=this.element.querySelector(".".concat(this.classes.serviceBlock,'[data-service="').concat(t.serviceName,'"]'))),t}},{key:"resetChauffeurData",value:function(){this.componentData.chauffeurData=null,this.selectors.chauffeurDataMissedError.classList.add(this.classes.hidden),this.toggleEditChauffeurDetailsButton(!1)}},{key:"dataChanged",value:function(){var e=this,t=Object.keys(this.productFlags).every(function(t){return e.productFlags[t]});n.Event.emit("pdp.attributesChanged",t)}},{key:"flightChanged",value:function(e){this.selectors.chauffeurDataMissedError.classList.add(this.classes.hidden),e&&this.resetChauffeurData(),this.componentData.flightChanged=!0}},{key:"serviceChanged",value:function(e){var t=this.element.querySelector(".".concat(this.classes.serviceBlock,'[data-service="').concat(e.currentTarget.dataset.attrValue,'"]'));t&&(this.checkFlightData(t),this.resetChauffeurData())}},{key:"flightDataChanged",value:function(e){var t=e.currentTarget.closest(".".concat(this.classes.serviceBlock));t&&this.checkFlightData(t)}},{key:"processAvailabilityData",value:function(e){e.result&&e.result.productCodes&&(this.componentData.productCode=e.result.productCodes.productCode)}},{key:"checkFlightData",value:function(e){var t=e.querySelectorAll("input,select");this.productFlags.flightDataFilled=d(t).every(function(e){return!!e.value}),n.Event.emit("chauffeur.toggleEnterDetails",this.productFlags.flightDataFilled),this.dataChanged()}},{key:"getCarData",value:function(){var e=this.componentData.currentProduct,t={};return t.carType=e&&e.variationAttributesObj.tier&&e.variationAttributesObj.tier.selectedValue||this.componentData.carType,t.carName=e&&e.variationAttributesObj.tier&&e.variationAttributesObj.tier.selectedDisplayValue||this.componentData.carName,t.carCode=t.carType&&this.options.carTypes&&this.options.carTypes[t.carType]&&this.options.carTypes[t.carType].code,t}},{key:"getChauffeurData",value:function(){this.componentData.chauffeurData.numberOfCars=this.element.querySelector("input[name$=numberOfCars]").value;var e=this.getCarData();return this.componentData.chauffeurData.carType=e.carType,this.componentData.chauffeurData.carName=e.carName,this.componentData.chauffeurData.carCode=e.carCode,JSON.stringify(this.componentData.chauffeurData)}},{key:"getFormData",value:function(e){if(this.componentData.chauffeurData){var t=this.getSelectedServiceData(),a=[],r={};t.serviceBlock&&(a=t.serviceBlock.querySelectorAll("select[name$=FlightNumber]")),r.adults=this.element.querySelector("input[name$=adults]").value,r.children=this.element.querySelector("input[name$=children]").value,r.infants=this.element.querySelector("input[name$=infants]").value,r.service=t.serviceName,r.chauffeurData=this.getChauffeurData(),d(a).forEac
1h(function(e){r[e.dataset.type]=e.options[e.selectedIndex].value}),e.resolve(r)}else e.reject(this.selectors.chauffeurDetailsButton.dataset.missingDataError)}},{key:"getAllProductData",value:function(e){if(this.componentData.chauffeurData){var t,a=this.getSelectedServiceData(),r=new o.A(this.selectors.widgetForm),i={adults:this.element.querySelector("input[name$=adults]").value,children:this.element.querySelector("input[name$=children]").value,infants:this.element.querySelector("input[name$=infants]").value,nmosProductCode:this.componentData.productCode};switch(i.chauffeurData=this.getChauffeurData(),a.serviceName){case"arrival":t=a.serviceBlock.querySelectorAll("select,input"),i.arrivalFlightFormData=r.getData(t),i.departureFlightFormData=null;break;case"departure":t=a.serviceBlock.querySelectorAll("select,input"),i.departureFlightFormData=r.getData(t),i.arrivalFlightFormData=null}i.service=a.serviceName,e.resolve(i)}else e.reject(this.selectors.chauffeurDetailsButton.dataset.missingDataError)}},{key:"destroy",value:function(){(0,s.AU)("click",this.selectors.chauffeurDetailsButton,this.openChauffeurModal.bind(this)),(0,s.AU)("change",this.selectors.serviceRadio,this.serviceChanged.bind(this)),(0,s.AU)("change",this.selectors.flightDataFields,this.flightDataChanged.bind(this))}},{key:"updateImages",value:function(e,t){var a=e.product;if(a){var r=a.images&&a.images.large?a.images.large.length:0,i=a.images&&a.images.small?a.images.small.length:0,n=(0,u.$)("mgImageCarousel")(function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?h(Object(a),!0).forEach(function(t){f(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):h(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}({largeImageCount:r,smallImageCount:i},a)),s=t.get(0).querySelector(".js-pdp-product-image-container"),o=s.querySelector(".js-prs-image-container");this.destroyImageCarousel(o),o.remove(),s.insertAdjacentHTML("afterbegin",n),this.reInitImageCarousel()}}},{key:"reInitImageCarousel",value:function(){var e=document.querySelector(".js-prs-image-container");n.Event.emit("registry.registerElement",e),$(e).find(".lazy").Lazy()}},{key:"destroyImageCarousel",value:function(e){var t=e.querySelectorAll("[data-component]");n.Event.emit("prsCarousel:stopVideo"),t.forEach(function(e){var t=e.dataset.componentId,a=c.A.getComponent(t);a&&a.destroy()})}}],r&&g(a.prototype,r),l&&g(a,l),Object.defineProperty(a,"prototype",{writable:!1}),a;var a,r,l}(r.A)}}]);

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.