{"version":3,"file":"7b25e6fe.js","sources":["../../../src/components/base/foursixty-carousel/chevron-left.svg","../../../src/components/base/foursixty-carousel/content-square-tracking.js","../../../src/components/base/foursixty-carousel/add-click-through-events.js","../../../src/components/base/foursixty-carousel/FoursixtyCarousel.client.tsx"],"sourcesContent":["export default \"__VITE_ASSET__a9ec255a__\"","import {isBrowser} from '@shopify/hydrogen';\n\n/**\n * ContentSquare Tracking\n * https://docs.contentsquare.com/uxa-en/#sending-an-artificial-pageview-trackpageview-\n * https://docs.contentsquare.com/webtracking-impl-en/#modal-windows-and-artificial-pageviews-tracking\n */\n\nconst contentSquare = {\n /**\n * Track event when modals are opened\n */\n opened: (modal) => {\n if (!isBrowser()) return;\n window._uxa = window._uxa || [];\n window._uxa.push([\n 'trackPageview',\n `${window.location.pathname}${window.location.hash.replace(\n '#',\n '?__',\n )}?cs-apv-${modal}`,\n ]);\n },\n\n /**\n * Track event when modals are closed\n */\n closed: () => {\n if (!isBrowser()) return;\n window._uxa = window._uxa || [];\n window._uxa.push([\n 'trackPageview',\n window.location.pathname + window.location.hash.replace('#', '?__'),\n ]);\n },\n\n /**\n * Tracking FourSixty Modal\n */\n fourSixtyEvent: (element) => {\n if (!isBrowser()) return;\n const $fourSixty =\n element || document.querySelector('.js-foursixty-carousel');\n let runOnce = true;\n\n // Wait for foursixty to load all\n const observer = new MutationObserver((mutations) => {\n mutations.forEach((mt) => {\n const node = mt.addedNodes[0];\n if (\n node &&\n node.classList &&\n node.classList.contains('fs-entry-container')\n ) {\n const $fsSocial = document.querySelectorAll('.fs-timeline-entry');\n\n if (runOnce) {\n runOnce = false;\n // Add click event listener to Foursixty image\n $fsSocial.forEach(($el) => {\n $el.addEventListener('click', () => {\n contentSquare.opened('social');\n\n // Wait for the Foursixty modal to open\n setTimeout(() => {\n const $fsCloseModal =\n document.getElementById('fs-detail-close');\n\n // Add event listener to modal close button\n if ($fsCloseModal) {\n $fsCloseModal.addEventListener(\n 'click',\n contentSquare.closed,\n );\n }\n }, 2500);\n });\n });\n }\n observer.disconnect();\n }\n });\n });\n observer.observe($fourSixty, {\n childList: true,\n subtree: true,\n attributes: true,\n });\n },\n};\n\nexport default contentSquare;\n","/**\n * Add Click Through Events\n * @param {Element} $element for observer\n */\nconst addClickThroughEvents = ($element) => {\n let isMounted = false;\n\n /**\n * Add Click Through\n */\n const addClickThrough = () => {\n setTimeout(() => {\n const $fsDetailProducts = document.getElementById('fs-detail-products');\n const $fsPrevPost = document.getElementById('fs-prev-post');\n const $fsNextPost = document.getElementById('fs-next-post');\n if (!$fsDetailProducts) return;\n\n const $fsDetailProductsLinks = $fsDetailProducts.querySelectorAll(\n 'a[data-original-url]',\n );\n if (!$fsDetailProductsLinks || !$fsDetailProductsLinks.length) return;\n\n $fsDetailProductsLinks.forEach(($fsDetailProductsLink) => {\n const {originalUrl} = $fsDetailProductsLink.dataset;\n if ($fsDetailProductsLink.href === originalUrl) return;\n $fsDetailProductsLink.href = originalUrl;\n });\n\n if ($fsPrevPost) {\n $fsPrevPost.addEventListener('click', addClickThrough);\n }\n\n if ($fsNextPost) {\n $fsNextPost.addEventListener('click', addClickThrough);\n }\n }, 2500); // Wait for modal to change content within\n };\n\n // Wait for foursixty to load all\n const observer = new MutationObserver((mutations) => {\n mutations.forEach((mt) => {\n const node = mt.addedNodes[0];\n if (\n node &&\n node.classList &&\n node.classList.contains('fs-entry-container')\n ) {\n const $fsSocial = document.querySelectorAll('.fs-timeline-entry');\n\n if (isMounted) return;\n isMounted = true;\n\n $fsSocial.forEach(($el) => {\n $el.addEventListener('click', addClickThrough);\n });\n\n observer.disconnect();\n }\n });\n });\n\n observer.observe($element, {\n childList: true,\n subtree: true,\n attributes: true,\n });\n};\n\nexport default addClickThroughEvents;\n","import './FoursixtyCarousel.scss';\nimport {useRef, useEffect} from 'react';\nimport icon from './chevron-left.svg';\nimport contentSquare from './content-square-tracking';\nimport addClickThroughEvents from './add-click-through-events';\nimport {isBrowser} from '@shopify/hydrogen';\n\nexport default function FrontPageCarousel(): JSX.Element {\n const fsStyles = `\n .fs-slider-next-button::before,\n .fs-slider-prev-button::before {\n background-image: url(${icon});\n }\n `;\n\n const carousel = useRef(null);\n\n useEffect(() => {\n addEvents();\n }, []);\n\n const addEvents = () => {\n document.addEventListener('scroll', initScripts);\n };\n\n const removeEvents = () => {\n document.removeEventListener('scroll', initScripts);\n };\n\n const initScripts = () => {\n if (!isBrowser()) return;\n const $carousel = carousel.current;\n // Hardcoding ignore colors for now\n const ignoreColors =\n '(marble|quartz|sand|mica|talc|clay|ochre|sienna|jasper|umber|oxide|cocoa|onyxsand|mica|taupe|honey|clay|ochre|desert-clay|sienna|jasper|amethyst|smoke|umber|oxide|cocoa|onyx|bone|light-heather-grey|iris-mica|mineral|slate-green|kyanite|talc|rose|citrine|copper|cypress|soot)';\n // TODO: ignore colors?\n\n // only needs to init once\n removeEvents();\n\n // missing required elements or data\n if (!$carousel) return;\n\n const forUrl = $carousel.dataset.forUrl || 'true';\n const categoryFilter = $carousel.dataset.categoryFilter || '';\n const $carouselScript = document.createElement('script');\n $carouselScript.type = 'text/javascript';\n $carouselScript.src = '//foursixty.com/media/scripts/fs.slider.v2.5.js';\n $carouselScript.setAttribute('data-re-ignore', ignoreColors);\n $carouselScript.setAttribute('data-for-url', forUrl);\n $carouselScript.setAttribute('data-url-related', 'true');\n $carouselScript.setAttribute('data-has-posts-selector', '#fs_header');\n $carouselScript.setAttribute('data-feed-id', 'skims');\n $carouselScript.setAttribute('data-domain-override', 'skims.com');\n $carouselScript.setAttribute('data-theme', 'slider_v2_5');\n $carouselScript.setAttribute('data-show-okendo-stars', 'true');\n $carouselScript.setAttribute('data-cell-size', '20%');\n $carouselScript.setAttribute('data-use-app-proxy', 'true');\n $carouselScript.setAttribute('data-track-link-performance', 'false');\n $carouselScript.setAttribute('data-force-ada-focus', 'true');\n $carouselScript.setAttribute(\n 'ata-override-entry-template',\n '#fs_entry_override',\n );\n\n if (categoryFilter !== '') {\n $carouselScript.setAttribute('data-category-filter', categoryFilter);\n }\n\n const $scriptFunctions = document.createElement('script');\n $scriptFunctions.type = 'text/javascript';\n const scriptFunctions = `\n window.foursixtyTranslations = {\n ADD_TO_CART: 'Add to bag',\n ADDED_TO_CART: 'Added to bag'\n };\n window.foursixtyThumbnailProductImage = function(url) {\n return url.replace('.jpg', '_medium.jpg');\n }\n window.foursixtyLinkUrlRegex = {\n from: /skimsbody.myshopify.com/,\n to: 'skims.com'\n }\n `;\n\n /*\n * The try..catch block is required as most browsers like the first method,\n * but some will throw an error and prefer the second\n */\n try {\n $scriptFunctions.appendChild(document.createTextNode(scriptFunctions));\n $carousel.appendChild($carouselScript);\n $carousel.appendChild($scriptFunctions);\n\n // Add Click Through events\n addClickThroughEvents($carousel);\n\n // Fire contentSquare tracker\n contentSquare.fourSixtyEvent($carousel);\n } catch (e) {\n $scriptFunctions.text = scriptFunctions;\n $carousel.appendChild($carouselScript);\n $carousel.appendChild($scriptFunctions);\n }\n };\n\n return (\n <>\n \n
\n \n );\n}\n"],"names":["icon","contentSquare","modal","isBrowser","element","$fourSixty","runOnce","observer","mutations","mt","node","$fsSocial","$el","$fsCloseModal","contentSquare$1","addClickThroughEvents","$element","isMounted","addClickThrough","$fsDetailProducts","$fsPrevPost","$fsNextPost","$fsDetailProductsLinks","$fsDetailProductsLink","originalUrl","addClickThroughEvents$1","FrontPageCarousel","fsStyles","carousel","useRef","useEffect","addEvents","addEventListener","initScripts","removeEvents","removeEventListener","$carousel","current","ignoreColors","forUrl","dataset","categoryFilter","$carouselScript","document","createElement","type","src","setAttribute","$scriptFunctions","scriptFunctions","appendChild","createTextNode","fourSixtyEvent","text","_Fragment","_jsx"],"mappings":"uWAAA,IAAeA,EAAA,8FCQf,MAAMC,EAAgB,CAIpB,OAASC,GAAU,CACb,CAACC,EAAS,IACd,OAAO,KAAO,OAAO,MAAQ,CAAA,EAC7B,OAAO,KAAK,KAAK,CACf,gBACA,GAAG,OAAO,SAAS,WAAW,OAAO,SAAS,KAAK,QACjD,IAC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