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/src/blocks/information_banner/information_banner.analytics.js","webpack://cms-web/./app/frontend/src/blocks/information_banner/information_banner.js","webpack://cms-web/./app/frontend/src/utils/load_hls_video.js","webpack://cms-web/./node_modules/dayjs/plugin/isSameOrAfter.js"],"sourcesContent":["import { sendUtagEvent } from '../../core/analytics/utag_events'\nimport on from '../../utils/events_delegation'\nimport { getCleanedString, normalizeString } from '../../utils/utilities'\n\nconst BLOCK_SELECTOR = '.js-information-banner'\n\nexport function initializeUtagEvents() {\n on({\n eventName: 'click',\n selector: `${BLOCK_SELECTOR} .utag-apply-code, ${BLOCK_SELECTOR} .utag-promo-btn`,\n handler() {\n const element = this\n const block = element.closest(BLOCK_SELECTOR)\n const areMetricsEnabled = block.dataset.metrics === 'true'\n\n if (!areMetricsEnabled) return\n\n const code = block.querySelector('.promo .text') !== null ? block.querySelector('.promo .text').innerHTML : ''\n\n sendUtagEvent({\n data: {\n event_name: 'offers_apply',\n event_cat: 'offers',\n event_act: 'apply offer',\n event_lbl: getCleanedString(code),\n event_purpose: 'booking',\n event_structure: 'body',\n },\n })\n },\n })\n\n on({\n eventName: 'click',\n selector: `${BLOCK_SELECTOR} .utag-information-banner-link`,\n handler() {\n const element = this\n const block = element.closest(BLOCK_SELECTOR)\n const areMetricsEnabled = block.dataset.metrics === 'true'\n\n if (!areMetricsEnabled) return\n\n sendUtagEvent({\n data: {\n event_name: 'information_banner_module',\n event_cat: normalizeString(block.dataset.eventCat || 'information banner'),\n event_act: normalizeString(block.dataset.eventAct || block.dataset.eventContentName || ''),\n event_lbl: normalizeString(block.dataset.eventLbl || ''),\n event_purpose: 'information',\n event_structure: 'body',\n },\n })\n },\n })\n}\n","import { FASTBOOKING_EVENTS } from '../../shared/fastbooking/constants'\nimport fastbooking from '../../shared/fastbooking/ibh_fastbooking'\nimport { hideHeaderStickyHotel } from '../../shared/header_sticky_hotel/header_sticky_hotel'\nimport { loadHlsVideoByElem } from '../../utils/load_hls_video'\n\nimport { initializeUtagEvents } from './information_banner.analytics'\n\nconst BLOCK_NAME = '.js-information-banner'\n\nfunction copyToClipboard(element) {\n const temp = document.createElement('input')\n temp.readOnly = true\n document.querySelector('body').appendChild(temp)\n temp.value = element !== null ? element.textContent : ''\n temp.select()\n document.execCommand('copy')\n temp.remove()\n}\n\nfunction showOverlayGreenMessagePromoCopied(block) {\n const copiedMsg = block.querySelector('.js-code-applied')\n\n if (IB.currentDevice !== 'mobile' && copiedMsg) {\n copiedMsg.style.display = 'flex'\n setTimeout(() => {\n copiedMsg.style.display = 'none'\n block.classList.add('copied')\n }, 3000)\n } else {\n block.classList.add('copied')\n }\n}\n\nfunction init() {\n const blocks = document.querySelectorAll(BLOCK_NAME)\n blocks.forEach(function (block) {\n const code = block.querySelector('.js-promo-text') !== null ? block.querySelector('.js-promo-text').innerHTML : ''\n\n block.querySelectorAll('.js-layer-apply-code, .js-promo-btn').forEach(element => {\n let timeout\n element.addEventListener('click', function (e) {\n e.preventDefault()\n if (block.querySelector('.visible')) block.querySelector('.visible').classList.remove('visible')\n\n if (block.classList.contains('copied')) return\n if (typeof timeout === 'number') clearTimeout(timeout)\n\n copyToClipboard(block.querySelector('.js-promo-text'))\n\n fastbooking.setPromocode(code)\n showOverlayGreenMessagePromoCopied(block)\n\n if (IB.currentDevice === 'mobile') {\n fastbooking.openStickyFastbooking()\n fastbooking.openDates()\n }\n })\n })\n\n if (block.querySelector('.js-fb-launch')) {\n block.querySelector('.js-fb-launch').addEventListener('click', function (e) {\n e.preventDefault()\n hideHeaderStickyHotel()\n fastbooking.openStickyFastbooking()\n fastbooking.openDates()\n })\n }\n\n const prevElement = block.previousElementSibling\n\n if (prevElement && prevElement.classList.contains('js-tiro-countdown')) {\n block.classList.add('has-top-countdown')\n }\n\n loadHlsVideoByElem(block)\n\n document.addEventListener(FASTBOOKING_EVENTS.RESET_PROMOCODE, () => {\n block.classList.remove('copied')\n })\n })\n\n initializeUtagEvents()\n}\n\ninit()\n","import Hls from 'hls.js'\n\nimport inViewport from '../utils/inViewport'\n\nconst HLS_LOADED_CLASS = 'is-hls-loaded'\n\nfunction init(hlsVideos, config = {}) {\n const autoplay = config.autoplay !== undefined ? config.autoPlay : true\n const loop = config.loop !== undefined ? config.loop : true\n const playsWhenEnterViewport = config.playsWhenEnterViewport !== undefined ? config.playsWhenEnterViewport : true\n\n hlsVideos.forEach(video => {\n if (video.classList.contains(HLS_LOADED_CLASS)) return\n\n const videoSrc = video.dataset.url ? video.dataset.url : ''\n\n if (Hls.isSupported()) {\n const hls = new Hls()\n hls.loadSource(videoSrc)\n hls.attachMedia(video)\n } else if (video.canPlayType('application/vnd.apple.mpegurl')) {\n video.setAttribute('src', videoSrc)\n }\n\n video.classList.add(HLS_LOADED_CLASS)\n\n video.muted = true\n video.autoplay = autoplay\n video.loop = loop\n video.playsInline = autoplay\n\n if (playsWhenEnterViewport) {\n inViewport(video, element => {\n if (element.isIntersecting) {\n ;['canplaythrough', 'ended'].forEach(event => {\n video.addEventListener(event, () => {\n const timeout = event === 'ended' ? 10 : 0\n setTimeout(() => {\n video\n .play()\n .then(() => {\n // console.log(`Video played on event ${event}`)\n })\n .catch(error => {\n // console.log(`Error calling play() on video on event${event}`, error)\n })\n }, timeout)\n })\n })\n }\n })\n }\n })\n}\n\nexport function loadHlsVideo(baseSelector, config) {\n const videoElements = document.querySelectorAll(`${baseSelector} .hls-video`)\n\n if (videoElements.length) {\n init(videoElements, config)\n }\n}\n\nexport function loadHlsVideoByElem(elem, config) {\n const videoElements = elem.querySelectorAll('.hls-video')\n\n if (videoElements.length) {\n init(videoElements, config)\n }\n}\n","!function(e,t){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=t():\"function\"==typeof define&&define.amd?define(t):(e=\"undefined\"!=typeof globalThis?globalThis:e||self).dayjs_plugin_isSameOrAfter=t()}(this,(function(){\"use strict\";return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)}}}));"],"names":["BLOCK_SELECTOR","initializeUtagEvents","on","eventName","selector","handler","block","this","closest","dataset","metrics","code","querySelector","innerHTML","sendUtagEvent","data","event_name","event_cat","event_act","event_lbl","getCleanedString","event_purpose","event_structure","normalizeString","eventCat","eventAct","eventContentName","eventLbl","document","querySelectorAll","forEach","element","addEventListener","e","preventDefault","classList","remove","contains","temp","createElement","readOnly","appendChild","value","textContent","select","execCommand","copyToClipboard","fastbooking","setPromocode","copiedMsg","IB","currentDevice","style","display","setTimeout","add","showOverlayGreenMessagePromoCopied","openStickyFastbooking","openDates","hideHeaderStickyHotel","prevElement","previousElementSibling","loadHlsVideoByElem","FASTBOOKING_EVENTS","RESET_PROMOCODE","HLS_LOADED_CLASS","init","hlsVideos","config","arguments","length","undefined","autoplay","autoPlay","loop","playsWhenEnterViewport","video","videoSrc","url","Hls","hls","loadSource","attachMedia","canPlayType","setAttribute","muted","playsInline","inViewport","isIntersecting","event","play","then","catch","error","loadHlsVideo","baseSelector","videoElements","elem","module","exports","t","prototype","isSameOrAfter","isSame","isAfter"],"sourceRoot":""}