{"version":3,"file":"index-11d65537.js","sources":["../../../../src/scripts/react-components/shingle-detail-masthead/image-swiper.tsx","../../../../src/scripts/react-components/shingle-detail-masthead/color-swiper.tsx","../../../../src/scripts/react-components/shingle-detail-masthead/index.tsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport { Swiper as SwiperModule, SwiperSlide } from 'swiper/react';\nimport { FreeMode, Navigation } from 'swiper';\nimport 'swiper/css';\nimport 'swiper/css/navigation';\nimport 'swiper/css/free-mode';\nimport { createDataLayerString } from '../../helpers/helpers';\nimport { BREAKPOINTS } from '../../helpers/breakpoints';\n\ntype ImageSwiperProps = {\n images: {\n media_url: string;\n alt_text: string;\n }[];\n nextLabel: string;\n prevLabel: string;\n productHeading: string;\n fullScreen?: boolean;\n};\n\nexport const ImageSwiper = ({\n images,\n nextLabel,\n prevLabel,\n productHeading,\n fullScreen\n}: ImageSwiperProps) => {\n const nextButton = useRef(null);\n const backButton = useRef(null);\n\n return (\n
Error on loading
;\n }\n\n const handleBazarClick = () => {\n const reviewsSection = document.querySelector(\n '[data-module=\"review-embed\"]'\n ) as HTMLElement;\n const sectionName = reviewsSection.dataset?.section;\n const sectionId = reviewsSection.id;\n const navigationLinks = document.querySelectorAll(\n '.navigation-jumplinks__link'\n );\n const dropdown = document.querySelector(\n '.navigation-jumplinks .field__select'\n ) as HTMLSelectElement;\n\n window.dispatchEvent(new Event('pause-jumplinks'));\n\n if (navigationLinks) {\n navigationLinks.forEach(link => {\n if (link.ariaLabel !== sectionName) {\n link.classList.remove('active');\n } else {\n link.classList.add('active');\n }\n });\n }\n\n if (dropdown) {\n setTimeout(() => {\n dropdown.value = sectionId;\n }, 500);\n }\n };\n\n useEffect(() => {\n if (bazarRef.current) {\n const bazarContainer = bazarRef.current;\n let maxTries = 10;\n\n const interval = setInterval(() => {\n maxTries--;\n const button = bazarContainer.querySelector('.bv_ratings_summary');\n\n if (button) {\n clearInterval(interval);\n button.addEventListener('click', handleBazarClick.bind(this));\n\n window.addEventListener('click', e => {\n const target = e.target as HTMLElement;\n\n if (target.closest('.bv_modal_inner_content')) {\n handleBazarClick();\n }\n });\n }\n\n if (maxTries === 0) {\n clearInterval(interval);\n }\n }, 1000);\n }\n }, [bazarRef, data]);\n\n useEffect(() => {\n let observer: MutationObserver;\n\n const targetNode = document.querySelector('.personalize-buttons');\n\n if (targetNode) {\n const targetInnerHtml = targetNode.innerHTML;\n\n setPersonalizeButtons(targetInnerHtml);\n\n const config = { attributes: true, childList: true, subtree: true };\n\n const callback = (mutationList: MutationRecord[]) => {\n for (const mutation of mutationList) {\n if (mutation.type === 'childList') {\n setPersonalizeButtons(targetNode.innerHTML);\n }\n }\n };\n\n observer = new MutationObserver(callback);\n observer.observe(targetNode, config);\n }\n\n const newData = (window as ExtendedWindowType).mastheadData;\n\n if (newData) {\n setData((window as ExtendedWindowType).mastheadData);\n } else {\n setError(true);\n }\n\n return () => {\n if (observer) observer.disconnect();\n };\n }, []);\n\n return (\n\n {noResultsError?.replace('{zipCode}', address.zip)}\n
\n