{"version":3,"sources":["webpack:///./node_modules/@logitravel/alex-comp-cru/components/main-campaigns-cru/client/js/components.js","webpack:///./node_modules/@logitravel/alex-comp-cru/components/main-campaigns-cru/client/js/index.js"],"names":["COMPONENTS","loader","name","module","exports","resolveComponents","getClickToCall","getProductCardListFilter","require","elementExist","_require2","selector","arguments","length","undefined","element","document","querySelector","config","_objectSpread","dataset","result","JSON","parse","publicPath","__webpack_public_path__","then","default","components","map","component","concat","filter","observerConfig","root","rootMargin","threshold","observer","IntersectionObserver","entries","forEach","entry","intersectionRatio","target","reduce","acc","unobserve","observe"],"mappings":";kIAGA,IA0FMA,EAAa,CACf,CACIC,OAxEoB,WACxB,OAAO,6DAwEHC,KAAM,oBAEV,CACID,OAtFgB,WACpB,OAAO,4DAsFHC,KAAM,gBAEV,CACID,OAtEa,WACjB,OAAO,oEAsEHC,KAAM,aAEV,CACID,OAhEgB,WACpB,OAAO,6DAgEHC,KAAM,oBAEV,CACID,OA1DmB,WACvB,OAAO,oEA0DHC,KAAM,mBAEV,CACID,OApDiB,WACrB,OAAO,6DAoDHC,KAAM,iBAEV,CACID,OApCmB,WACvB,OAAO,4DAoCHC,KAAM,oBAWdC,EAAOC,QAAU,CACbC,kBALJ,WACI,OAAOL,GAKPM,eAlImB,WACnB,OAAO,4DAkIPC,yBA7D6B,WAC7B,OAAO,sE,wsBCpEXC,EAAQ,QAER,IAAQC,EAAiBD,EAAQ,QAAzBC,aAERC,EAAwEF,EAAQ,QAAxEH,EAAiBK,EAAjBL,kBAAmBC,EAAcI,EAAdJ,eAAgBC,EAAwBG,EAAxBH,yBAM3CJ,EAAOC,QAAU,WAA0E,IAAhDO,EAAQC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,oCAClD,GAAIH,EAAaE,GAAW,CACxB,IAAMI,EAAUC,SAASC,cAAcN,GAEjCO,EAAMC,EAAA,GACJ,WACA,IAAKJ,EAAQK,QAAQF,OAAQ,MAAO,GAEpC,IAAMG,EAASC,KAAKC,MAAMR,EAAQK,QAAQF,QAE1C,OADAH,EAAQK,QAAQF,OAAS,GAClBG,EALP,IAaJH,EAAOM,aAAYC,IAA0BP,EAAOM,YAIxDjB,IAA2BmB,MAAK,SAAAvB,GAAM,OAAIA,EAAOwB,aAEjD,IAAMC,EAAavB,IACdwB,KAAI,SAAAC,GAAS,MAAK,CACf7B,OAAQ6B,EAAU7B,OAClBc,QAASC,SAASC,cAAc,oBAADc,OAAqBD,EAAU5B,KAAI,WAErE8B,QAAO,SAAAF,GAAS,OAAIA,EAAUf,WAG7BkB,EAAiB,CACnBC,KAAM,KACNC,WAAY,MACZC,UAAW,KAOTC,EAAW,IAAIC,sBAAqB,SAAAC,GACtCA,EAAQC,SAAQ,SAAAC,GACRA,EAAMC,kBAAoB,IAW1BzC,EAVmB2B,EACdI,QAAO,SAAAF,GAAS,OAAIA,EAAUf,UAAY0B,EAAME,UAChDC,QAAO,SAAAC,GAAG,OAAIA,KAFX5C,UAUCyB,MAAK,SAAAvB,GACVA,EAAOwB,UAEPU,EAASS,UAAUL,EAAME,gBAItCV,GAEHL,EAAWY,SAAQ,SAAAV,GACfO,EAASU,QAAQjB,EAAUf,YAI/BT,IAAiBoB,MAAK,SAAAvB,GAAM,OAAIA,EAAOwB","file":"main-campaigns-cru.5d0ec9f1a27cd92e4b17.bundle.js","sourcesContent":["/**\n * ClickToCall\n */\nconst getClickToCall = () => {\n return import(\n /* webpackChunkName: \"click-to-call\" */\n '@bluekiri/alexandria-contrib-components/components/click-to-call/client/js'\n );\n};\n\n/**\n * HeaderBanner\n */\nconst getHeaderBanner = () => {\n return import(\n /* webpackChunkName: \"header-banner\" */\n '../../../header-banner/client/js'\n );\n};\n\n/**\n * BreadcrumbsIdCru\n */\nconst getBreadcrumbsIdCru = () => {\n return import(\n /* webpackChunkName: \"breadcrumbs-id-cru\" */\n '../../../breadcrumbs-id-cru/client/js'\n );\n};\n\n/**\n * TextMedia\n */\nconst getTextMedia = () => {\n return import(\n /* webpackChunkName: \"text-media\" */\n '../../../text-media/client/js'\n );\n};\n\n/**\n * ShippingLine\n */\nconst getShippingLine = () => {\n return import(\n /* webpackChunkName: \"shipping-line-rxjs\" */\n '../../../shipping-line-rxjs/client/js'\n );\n};\n\n/**\n * SearcherCruises\n */\nconst getSearcherCruises = () => {\n return import(\n /* webpackChunkName: \"section-searcher\" */\n '../../../searcher-section/client/js'\n );\n};\n\n/**\n * SpecialOffers\n */\nconst getSpecialOffers = () => {\n return import(\n /* webpackChunkName: \"special-offers\" */\n '../../../special-offers/client/js'\n );\n};\n\n/**\n * ProductCardListFilter\n */\nconst getProductCardListFilter = () => {\n return import(\n /* webpackChunkName: \"product-card-list-filter\" */\n '../../../product-card-list-filter/client/js'\n );\n};\n\n/**\n * NewsletterAgent\n */\nconst getNewsletterAgent = () => {\n return import(\n /* webpackChunkName: \"newsletter-agent\" */\n '../../../newsletter-agent/client/js'\n );\n};\n\n/**\n * Components\n */\nconst COMPONENTS = [\n {\n loader: getBreadcrumbsIdCru,\n name: 'BreadcrumbsIdCru'\n },\n {\n loader: getHeaderBanner,\n name: 'HeaderBanner'\n },\n {\n loader: getTextMedia,\n name: 'TextMedia'\n },\n {\n loader: getShippingLine,\n name: 'ShippingLineRxjs'\n },\n {\n loader: getSearcherCruises,\n name: 'SearcherSection'\n },\n {\n loader: getSpecialOffers,\n name: 'SpecialOffers'\n },\n {\n loader: getNewsletterAgent,\n name: 'NewsletterAgent'\n }\n];\n\n/**\n * Resolver components\n */\nfunction resolveComponents() {\n return COMPONENTS;\n}\n\nmodule.exports = {\n resolveComponents,\n getClickToCall,\n getProductCardListFilter\n};\n","/* ==========================================================================\n MainCampaignsCru > Client\n ========================================================================== */\n\n/* Import modules */\n\nrequire('intersection-observer');\n\nconst { elementExist } = require('@bluekiri/alexandria/helpers/domHelpers');\n\nconst { resolveComponents, getClickToCall, getProductCardListFilter } = require('./components');\n\n/**\n * MainCampaignsCru component\n * @param {selector} String selector for the component in the client side.\n */\nmodule.exports = function MainCampaignsCru(selector = '[data-component=MainCampaignsCru]') {\n if (elementExist(selector)) {\n const element = document.querySelector(selector);\n\n const config = {\n ...(function getConfig() {\n if (!element.dataset.config) return '';\n\n const result = JSON.parse(element.dataset.config);\n element.dataset.config = '';\n return result;\n })()\n };\n\n /**\n * Setting public path to the webpack exposed variable\n */\n /* eslint-disable */\n if (config.publicPath) __webpack_public_path__ = config.publicPath;\n /* eslint-enable */\n\n /* ProductCardListFilter */\n getProductCardListFilter().then(module => module.default());\n\n const components = resolveComponents()\n .map(component => ({\n loader: component.loader,\n element: document.querySelector(`[data-component=\"${component.name}\"]`)\n }))\n .filter(component => component.element);\n\n /* Observer Config */\n const observerConfig = {\n root: null, // avoiding 'root' or setting it to 'null' sets it to default value: viewport\n rootMargin: '0px',\n threshold: 0.15\n };\n\n /**\n * Observer to lazy load modules based on\n * currently viewed components in the viewport\n */\n const observer = new IntersectionObserver(entries => {\n entries.forEach(entry => {\n if (entry.intersectionRatio > 0) {\n const { loader } = components\n .filter(component => component.element === entry.target)\n .reduce(acc => acc);\n\n /**\n * Init component with its loader and then\n * unobserve from this entry so we dont\n * call the init of the component more\n * than once\n */\n loader().then(module => {\n module.default();\n\n observer.unobserve(entry.target);\n });\n }\n });\n }, observerConfig);\n\n components.forEach(component => {\n observer.observe(component.element);\n });\n\n /* ClickToCall */\n getClickToCall().then(module => module.default());\n }\n};\n"],"sourceRoot":""}