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,eAA0B,OAATuC,GAC7C,OAAOA,CACT,EAEA9B,EAAgB2D,aAAe,SAASW,GACtC,IAAIiB,EAAWlE,EAAE,aAAeiD,GAEhC,OAAU,GAANA,GAAWiB,EAASjE,OAAS,EACxB,CAAC,EAEDgC,KAAKC,MAAMgC,EAAS/B,OAE/B,EAEAxD,EAAgByD,YAAc,WAC5B,OAAOH,KAAKC,MAAMlC,EAAE,kBAAkBmC,OACxC,EAEAxD,EAAgBiC,SAAW,SAASH,GACtB,OAATA,GACD0D,UAAUxD,KAAKF,EAEnB,CACD,CAhTD,CAgTGO,O","sources":["webpack://cms-web/./app/frontend/src/shared/js_tabs/js_tabs.js","webpack://cms-web/./app/frontend/src/vendors/layer_handler_ecc/layer_handler_eec.js"],"sourcesContent":["import '../../vendors/layer_handler_ecc/layer_handler_eec'\n\nfunction changeTab(activeTab, activeTarget) {\n activeTab.classList.add('active')\n Array.from(activeTab.parentElement.children).forEach(sibling => {\n if (sibling !== activeTab) sibling.classList.remove('active')\n })\n activeTarget.classList.add('active')\n Array.from(activeTarget.parentElement.children).forEach(sibling => {\n if (sibling !== activeTarget) sibling.classList.remove('active')\n })\n activeTarget.querySelectorAll('.swiper-container:visible').forEach(function (swiperContainer) {\n if (swiperContainer.swiper) swiperContainer.swiper.update()\n })\n LayerHandlerEec.pushVisibleProducts(\n '.destination-tabs-list .js-tab.active .js-tab.active .card-container .call-to-action a[data-ecc-product]'\n )\n}\ndocument.addEventListener('click', function (e) {\n if (e.target.closest('.js-tabs-nav li a')) {\n e.preventDefault()\n const el = e.target.closest('li')\n const target = document.querySelector(el.getAttribute('data-tab'))\n changeTab(el, target)\n }\n})\ndocument.addEventListener('click', function (e) {\n if (e.target.closest('.js-link-nav')) {\n e.preventDefault()\n const el = e.target.closest('.js-link-nav')\n const dataTab = el.getAttribute('data-tab')\n const target = document.querySelector(dataTab)\n const activeTab = el.closest('.js-tabs-parent').querySelector(`.js-tabs-nav li[data-tab=\"${dataTab}\"]`)\n changeTab(activeTab, target)\n }\n})\n\ndocument.addEventListener('click', function (e) {\n if (e.target.closest('.js-tabs-actions li')) {\n e.preventDefault()\n const el = e.target.closest('li')\n const wrapper = el.closest('.js-tabs')\n const klass = el.getAttribute('data-klass')\n\n el.classList.add('active')\n Array.from(el.parentElement.children).forEach(sibling => {\n if (sibling !== el) sibling.classList.remove('active')\n })\n\n wrapper.className = `js-tabs ${klass}`\n\n wrapper.querySelectorAll('.swiper-container').forEach(function (swiperContainer) {\n if (swiperContainer.swiper) swiperContainer.swiper.update(true)\n })\n }\n})\n/**\n * Función que activa la pestaña seleccionada y su contenido\n * @param {element} activeTab\n * @param {element} activeTarget\n */\n","(function(global) {\n var LayerHandlerEec = {};\n global.LayerHandlerEec = LayerHandlerEec;\n\n LayerHandlerEec.init = function(gtm_id) {\n //Bindeamos los clicks de productos y promos, y las búsquedas desde fastbooking.\n this.bindEvents();\n //Mandamos las impresiones de los productos y las promociones de algunos módulos. Se juega con los selectores para identificar exactamente qué se manda\n //Algunos módulos mandarán impresiones también al avanzar la tab o el carrusel\n this.pushVisiblePromotions(\".home-static-banner a[data-ecc-promo]\");\n\n this.pushVisiblePromotions(\".offers-index-list .card-container .call-to-action a[data-ecc-promo]\");\n this.pushVisibleProducts(\".offers-index-list .card-container .call-to-action a[data-ecc-product]\");\n this.pushVisiblePromotions(\".offers-list .card-container .call-to-action a[data-ecc-promo]\");\n this.pushVisibleProducts(\".offers-list .card-container .call-to-action a[data-ecc-product]\");\n\n this.pushVisibleProducts(\".destination-tabs-list .js-tab.active .js-tab.active .card-container .call-to-action a[data-ecc-product]\");\n this.pushVisibleProducts(\".hotel-list .card-container .call-to-action a[data-ecc-product]\");\n\n if ($('.masonry-modules').length && IB.currentDevice === 'mobile') {\n //Nada aquí, lo hacemos en el masonry_modules.js, masonry_offers, etc.\n }else{\n this.pushVisiblePromotions(\".masonry-modules div[class*='masonry-link'] [data-ecc-promo]\");\n this.pushVisibleProducts(\".masonry-modules div[class*='masonry-link'] [data-ecc-product]\");\n this.pushVisibleProducts(\".masonry-modules div[class*='masonry-offer'] [data-ecc-product]\");\n this.pushVisiblePromotions(\".offers-in-a-row [data-ecc-promo]\");\n this.pushVisibleProducts(\".offers-in-a-row [data-ecc-product]\");\n this.pushVisiblePromotions(\".multi-offers-slider [data-ecc-promo]\");\n this.pushVisibleProducts(\".multi-offers-slider [data-ecc-product]\");\n\n //this.pushVisibleProducts(\".near-hotels-slider .card-container a[data-ecc-product]:visible\");\n }\n };\n\n LayerHandlerEec.bindEvents = function() {\n this.bindClicks();\n this.bindSearchs();\n };\n\n LayerHandlerEec.pushVisiblePromotions = function(selector) {\n promos = [];\n $(selector).each(function(){\n data = LayerHandlerEec.promoBaseData(this);\n if(data !== null) {\n promos.push(data);\n }\n });\n if (promos.length > 0){\n data = {\"ecommerce\": { \"promoView\": { \"promotions\": promos } } };\n this.pushData(data);\n }\n };\n\n LayerHandlerEec.pushVisibleProducts = function(selector) {\n products = [];\n currencyCode = \"\";\n is_fastbooking_result_page = (window.location.pathname.indexOf('/bookings') != -1 || window.location.pathname.indexOf('/reservas') != -1);\n is_still_working = $('#watch-job').length > 0;\n $(selector).each(function(){\n data = LayerHandlerEec.productBaseData(this);\n if(data !== null) {\n currencyCode = data[\"currency\"];\n delete data[\"currency\"];\n delete data[\"cart\"];\n if (is_fastbooking_result_page && is_still_working) {\n data[\"dimension194\"] = \"Buscando precios\";\n }\n products.push(data);\n }\n });\n if (products.length > 0){\n data = {\"ecommerce\": { \"currencyCode\": currencyCode, \"impressions\": products } };\n if (is_fastbooking_result_page && !is_still_working) {\n data[\"event\"] = \"loadProductDetails\";\n }\n this.pushData(data);\n }\n };\n\n LayerHandlerEec.bindClicks = function() {\n document.body.addEventListener('click', function(event) {\n var element = event.target,\n data;\n data = this.promoClickData(element);\n this.pushData(data);\n data = this.productClickData(element);\n this.pushData(data);\n }.bind(this));\n }\n\n LayerHandlerEec.bindSearchs = function() {\n document.body.addEventListener('submit', function(event) {\n var element = event.target;\n\n data = this.searchBaseData(element);\n //Rellenamos el resto de datos del bloque y de la página\n if (data !== undefined){\n scr = $(element).closest(\"div\").find(\"script[id*=ee-block]\")\n if (scr.length > 0){\n block_data = JSON.parse($(scr).html());\n data[\"dimension190\"] = block_data[\"title\"];\n data[\"dimension193\"] = block_data[\"type\"];\n }\n data[\"dimension196\"] = this.getPageData()[\"subcategory\"];\n data = {\"event\": \"addToCart\", \"ecommerce\": { \"add\": { \"products\": [data] } } } ;\n this.pushData(data);\n }\n }.bind(this));\n }\n\n LayerHandlerEec.promoClickData = function(element) {\n data = this.promoBaseData(element);\n if (data !== null) {\n data = {\"event\": \"promotionClick\", \"ecommerce\": { \"promoClick\": { \"promotions\": [data] } } };\n }\n return data;\n }\n\n LayerHandlerEec.promoBaseData = function(element) {\n data = this.getElementData(element, 'data-ecc-promo');\n if (data !== null) {\n data = JSON.parse(data);\n block_data = this.getBlockData(data[\"block\"]);\n delete data[\"block\"];\n if (data[\"size\"] !== undefined) {\n switch (data[\"size\"]) {\n case 'masonry-link1x1':\n data[\"creative\"] = \"280x280\";\n break;\n case 'masonry-link2x1':\n data[\"creative\"] = \"570x280\";\n break;\n case 'masonry-link2x2':\n data[\"creative\"] = \"570x570\";\n break;\n }\n delete data[\"size\"];\n }else{\n data[\"creative\"] = block_data[\"type\"];\n }\n\n data[\"moduleTitleProm\"] = block_data[\"title\"];\n data[\"moduleTypeProm\"] = block_data[\"type\"];\n data[\"contentTypeProm\"] = data[\"category\"];\n delete data[\"category\"];\n data[\"position\"] = this.getPageData(data[\"block\"])[\"category\"];\n }\n return data;\n }\n\n LayerHandlerEec.productClickData = function(element) {\n data = this.productBaseData(element);\n if (data !== null) {\n if (data[\"cart\"] == true){\n currencyCode = data[\"currency\"];\n delete data[\"cart\"];\n delete data[\"currency\"];\n delete data[\"hotel\"];\n data = {\"event\": \"addToCart\", \"ecommerce\": { \"currencyCode\": currencyCode, \"add\": { \"products\": [data] } } } ;\n }else\n if(data[\"hotel\"] == true){\n delete data[\"hotel\"];\n data = {\"event\": \"viewProductDetails\", \"ecommerce\": { \"detail\": { \"actionField\": { \"list\": data[\"list\"] }, \"products\": [data] } } };\n }\n else{\n data = {\"ecommerce\": { \"detail\": { \"actionField\": { \"list\": data[\"list\"] }, \"products\": [data] } } };\n }\n }\n return data;\n }\n\n LayerHandlerEec.productBaseData = function(element) {\n var data = this.getElementData(element, 'data-ecc-product')\n if (data !== null) {\n data = JSON.parse(data);\n hotel_data = IB.hotels_data.check() ? LayerHandlerEec.recoverHotelDataFromJson(\"h\" + data[\"id\"]) : IB.hotels_data.get(function(){ LayerHandlerEec.recoverHotelDataFromJson(\"h\" + data[\"id\"])});\n if (hotel_data){\n data[\"name\"] = hotel_data[\"name\"];\n data[\"id\"] = hotel_data[\"id\"];\n data[\"category\"] = hotel_data[\"category\"];\n data[\"hotel\"] = true;\n }\n block_data = this.getBlockData(data[\"block\"]);\n delete data[\"block\"];\n data[\"dimension190\"] = block_data[\"title\"];\n data[\"dimension193\"] = block_data[\"type\"];\n if (data[\"price\"] !== null && data[\"price\"] != \"0\"){\n data[\"dimension194\"] = \"Dispo\";\n }else{\n data[\"dimension194\"] = \"NoDispo\";\n }\n\n page_data = this.getPageData();\n data[\"list\"] = page_data[\"category\"];\n data[\"dimension196\"] = page_data[\"subcategory\"];\n\n delete data[\"size\"];\n }\n return data;\n }\n\n LayerHandlerEec.searchBaseData = function(element) {\n var hotel_id, data;\n //Si vamos a saltar a CRS (buscamos un hotel y buscamos con fechas), buscamos ese hotel en el JSON y rellenamos los datos\n if ($(element).find(\"[name*=check_in_date]\").val() == \"\" || $(element).find(\"[name*=check_out_date]\").val() == \"\"){\n return data;\n }\n if ($(element).find(\"[name*=place_to_go]\").length > 0) {\n hotel_id = $(element).find(\"[name*=place_to_go]\").val();\n if (!hotel_id.match(\"^h\")) {\n hotel_id = LayerHandlerEec.recoverHotelFromPlaceToGo(hotel_id);\n }\n }else{\n hotel_id = \"h\" + $(element).find(\"[name*=hotel_id]\").val();\n }\n if (hotel_id) {\n data = (IB.hotels_data.check() ? LayerHandlerEec.recoverHotelDataFromJson(hotel_id) : IB.hotels_data.get(function(){LayerHandlerEec.recoverHotelDataFromJson(hotel_id)}));\n }\n return data;\n }\n\n LayerHandlerEec.recoverHotelFromPlaceToGo = function(id) {\n if (!id.match(\"^d\")){\n return null;\n }\n //Cogemos el destino actual y todos los destinos hijos\n var hotels_data = JSON.parse(sessionStorage.getItem('fastbooking_data'));\n if(hotels_data === undefined)\n return null;\n var destination_ids = current_ids = [id];\n do {\n var child_destinations = $.grep(hotels_data[\"destinations\"][1], function( n, i ) {\n return $.inArray(n[\"data\"][\"parent_id\"], current_ids) >= 0;\n });\n current_ids = [];\n for (var i = 0; i < child_destinations.length; i++) {\n destination_ids.push(child_destinations[i][\"id\"]);\n current_ids.push(child_destinations[i][\"id\"]);\n }\n } while (current_ids.length > 0);\n\n //Buscamos los hoteles de esos destinos, si solo es un hotel lo devolvemos\n var hotels = $.grep(hotels_data[\"hotels\"][1], function( n, i ) {\n return $.inArray(n[\"data\"][\"destination\"], destination_ids) >= 0;\n });\n if (hotels.length == 1) {\n return hotels[0][\"id\"];\n }else{\n return null;\n }\n }\n\n LayerHandlerEec.recoverHotelDataFromJson = function(hotel_id) {\n var data;\n var hotels_data = IB.hotels_data.getData();\n //Buscamos el hotel en el Json\n const hotel = $.grep(hotels_data[\"hotels\"][1], function( n, i ) {\n return n[\"id\"] == hotel_id;\n });\n if (hotel.length > 0){\n var category = \"\";\n //Buscamos los destinos para rellenar el árbol hacia arriba\n var destination_id = hotel[0][\"data\"][\"destination\"];\n while (destination_id != \"d\"){\n const destination = $.grep(hotels_data[\"destinations\"][1], function( n, i ) {\n return n[\"id\"] == destination_id;\n })\n category = \"/\" + destination[0][\"data\"][\"title_es\"] + category;\n destination_id = destination[0][\"data\"][\"parent_id\"];\n }\n\n data = {\"name\": hotel[0][\"title\"], \"id\": hotel[0][\"data\"][\"code\"], \"category\": category }\n }\n return data;\n }\n\n LayerHandlerEec.getElementData = function(element, attribute) {\n var data = null;\n do {\n data = element.getAttribute(attribute);\n element = element.parentElement;\n } while (element && element.parentElement && data === null);\n return data;\n }\n\n LayerHandlerEec.getBlockData = function(id) {\n var $eeBlock = $('#ee-block-' + id);\n\n if (id == 0 || $eeBlock.length < 1) {\n return {};\n } else {\n return JSON.parse($eeBlock.html());\n }\n }\n\n LayerHandlerEec.getPageData = function() {\n return JSON.parse($('#eec-page-data').html());\n }\n\n LayerHandlerEec.pushData = function(data) {\n if(data !== null) {\n dataLayer.push(data);\n }\n }\n})(window);\n"],"names":["changeTab","activeTab","activeTarget","classList","add","Array","from","parentElement","children","forEach","sibling","remove","querySelectorAll","swiperContainer","swiper","update","LayerHandlerEec","pushVisibleProducts","document","addEventListener","e","target","closest","preventDefault","el","querySelector","getAttribute","dataTab","wrapper","klass","className","global","init","gtm_id","this","bindEvents","pushVisiblePromotions","$","length","IB","currentDevice","bindClicks","bindSearchs","selector","promos","each","data","promoBaseData","push","pushData","products","currencyCode","is_fastbooking_result_page","window","location","pathname","indexOf","is_still_working","productBaseData","body","event","element","promoClickData","productClickData","bind","searchBaseData","undefined","scr","find","block_data","JSON","parse","html","getPageData","getElementData","getBlockData","hotel_data","hotels_data","check","recoverHotelDataFromJson","get","page_data","hotel_id","val","match","recoverHotelFromPlaceToGo","id","sessionStorage","getItem","destination_ids","current_ids","child_destinations","grep","n","i","inArray","hotels","getData","hotel","category","destination_id","destination","attribute","$eeBlock","dataLayer"],"sourceRoot":""}