{"version":3,"file":"main.js","sources":["../../src/js/animations/animations.ts","../../src/js/components/navbar.ts","../../src/js/components/cookie.ts","../../src/js/components/modal.ts","../../src/js/utils/cookie.ts","../../src/js/GA4/consent.ts","../../src/js/GA4/utils/viewCart.ts","../../src/js/GA4/viewCartDrawer.ts","../../src/js/GA4/utils/removeFromCart.ts","../../src/js/GA4/addAndRemoveFromCart.ts","../../src/js/components/cart.ts","../../src/js/components/popup.ts","../../src/js/main.ts"],"sourcesContent":["export function toggleVisibility(\n element: HTMLElement,\n showClass: string,\n hideClass: string,\n duration: number,\n) {\n element.classList.remove(hideClass);\n element.classList.add(showClass);\n\n element.style.transition = `opacity ${duration}ms ease-in-out`;\n element.style.opacity = '1';\n\n setTimeout(() => {\n if (element.classList.contains(hideClass)) {\n element.style.opacity = '0';\n }\n }, duration);\n}\n","import { toggleVisibility } from '../animations/animations';\n\nexport function initNavbar() {\n const menus = document.querySelectorAll('[data-menu-button]');\n\n // initSearch();\n\n menus.forEach((menuButton) => {\n const menuId = menuButton.getAttribute('data-menu-button');\n const menuContent = document.getElementById(`${menuId}__content`);\n\n if (!menuContent) return;\n const duration = 200;\n menuContent.style.transition = `opacity ${duration}ms ease-in-out`;\n menuContent.style.opacity = '0';\n\n let hoverTimeout: number | null = null;\n\n const showMenu = () => {\n if (hoverTimeout) {\n clearTimeout(hoverTimeout);\n hoverTimeout = null;\n }\n menuContent.classList.remove('hidden');\n menuContent.classList.add('flex');\n setTimeout(() => {\n menuContent.style.opacity = '1';\n }, duration);\n };\n\n const hideMenu = () => {\n hoverTimeout = window.setTimeout(() => {\n menuContent.style.opacity = '0';\n setTimeout(() => {\n menuContent.classList.remove('flex');\n menuContent.classList.add('hidden');\n }, duration);\n }, 300);\n };\n\n menuButton.addEventListener('mouseenter', showMenu);\n menuContent.addEventListener('mouseenter', showMenu);\n\n menuButton.addEventListener('mouseleave', hideMenu);\n menuContent.addEventListener('mouseleave', hideMenu);\n\n menuButton.addEventListener('keydown', (event) => {\n const e = event as KeyboardEvent;\n if (e?.key === 'Enter' || e?.key === ' ')\n if (menuContent.classList.contains('hidden')) {\n showMenu();\n } else {\n toggleVisibility(menuContent, 'hidden', 'flex', 200);\n }\n });\n\n document.addEventListener('click', (event) => {\n if (\n !menuButton.contains(event.target as Node) &&\n !menuContent.contains(event.target as Node)\n ) {\n toggleVisibility(menuContent, 'hidden', 'flex', 200);\n }\n });\n });\n}\n\nfunction initSearch() {\n const searchBackgroundBlur = document.querySelector(\n '[data-search-background-blur]',\n );\n const searchButton = document.querySelector(\n '[data-search-button]',\n );\n const searchResultsContainer = document.querySelector(\n '[data-search-results]',\n );\n const searchBar = document.querySelector('[data-search-bar]');\n const searchInput = document.querySelector(\n '[data-search-input]',\n );\n const navBar = document.querySelector('[data-header');\n\n // TODO: Apply focus trap: Take from Modal.ts and make utility function\n\n document.addEventListener('click', (event: MouseEvent) => {\n const target = event.target as HTMLElement;\n\n if (\n searchButton &&\n searchBar &&\n searchResultsContainer &&\n searchBackgroundBlur\n ) {\n const isOpen = searchResultsContainer.dataset.state === 'open';\n if (searchButton.contains(target)) {\n searchResultsContainer.dataset.state = isOpen ? 'closed' : 'open';\n searchBackgroundBlur.dataset.state = isOpen ? 'closed' : 'open';\n if (!isOpen) {\n document.body.classList.add('overflow-hidden');\n searchInput?.focus();\n } else {\n document.body.classList.remove('overflow-hidden');\n }\n } else if (\n (searchBackgroundBlur.contains(target) || navBar?.contains(target)) &&\n !searchBar.contains(target) &&\n isOpen\n ) {\n searchResultsContainer.dataset.state = 'closed';\n searchBackgroundBlur.dataset.state = 'closed';\n document.body.classList.remove('overflow-hidden');\n }\n }\n });\n}\n","export function initCookie() {\n const banner = document.getElementById('cookieConsent');\n if (!banner) return;\n\n const acceptButton = document.getElementById('acceptCookies');\n const rejectButton = document.getElementById('rejectCookies');\n const footer = document.querySelector('footer');\n\n const consentGiven = document.cookie\n .split('; ')\n .some((cookie) => cookie.startsWith('.AspNet.Consent='));\n\n if (consentGiven) {\n banner.remove();\n } else {\n banner.classList.remove('hidden');\n footer!.style.marginBottom = `${banner.clientHeight}px`;\n }\n\n acceptButton?.addEventListener('click', () => {\n setConsentCookie(true, banner, footer!);\n updateGA4Consent();\n });\n rejectButton?.addEventListener('click', () =>\n setConsentCookie(false, banner, footer!),\n );\n}\n\nfunction setConsentCookie(\n value: boolean,\n banner: HTMLElement,\n footer: HTMLElement,\n) {\n const dt = new Date();\n dt.setFullYear(dt.getFullYear() + 1);\n document.cookie = `.AspNet.Consent=${value}; expires=${dt.toUTCString()}; path=/; samesite=strict`;\n removeBanner(banner, footer);\n const event = new CustomEvent('cookieConsent');\n document.dispatchEvent(event);\n}\n\nfunction updateGA4Consent() {\n gtag('consent', 'update', {\n ad_storage: 'granted',\n ad_user_data: 'granted',\n ad_personalization: 'granted',\n analytics_storage: 'granted',\n });\n}\n\nfunction removeBanner(banner: HTMLElement, footer: HTMLElement) {\n banner.remove();\n footer.style.marginBottom = '0';\n}\n","// To add a modal to a page:\n// hx-get=\"/api/modal?name=modalName\"\n// hx-trigger=\"load delay:5000\"\n// hx-target=\"#modal-container\"\n// hx-swap=\"innerHTML\"\n// and add the placeholder on the page if it isn't already there\n//
\n\nimport { applyFocusTrap } from '../utils/focustrap';\n\nexport function initModals() {\n const addEventListeners = () => {\n const modal = document.querySelector('[data-modal]') as HTMLElement;\n const modalBox = document.querySelector(\n '[data-modal-content]',\n ) as HTMLElement;\n const buttons: NodeListOf = document.querySelectorAll(\n '[data-modal-button]',\n );\n if (!modal) return;\n\n document.body.classList.add('overflow-hidden'); // Disable scrolling\n\n buttons.forEach((button) => {\n const closeModal = () => {\n hideModal(modal);\n\n if (button.dataset.modalButton === 'cancel') {\n return false;\n }\n if (button.dataset.modalButton === 'continue') {\n return true;\n }\n };\n\n button.addEventListener('click', closeModal);\n });\n\n // Close modal when clicking outside of it\n document.addEventListener('click', (event: MouseEvent) => {\n const target = event.target as HTMLElement;\n\n if (!modalBox.contains(target)) {\n hideModal(modal);\n }\n });\n\n // Close modal on Esc key press\n document.addEventListener('keydown', (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n hideModal(modal);\n }\n });\n\n applyFocusTrap(modal);\n };\n\n // Wait for htmx swap to occur before binding event listeners\n document.addEventListener('htmx:afterSwap', (event: Event) => {\n const customEvent = event as CustomEvent;\n if (customEvent.detail.target.id === 'modal-container') {\n addEventListeners();\n }\n });\n}\n\nfunction hideModal(modal: HTMLElement) {\n modal.classList.add('hidden'); // Hide the modal\n document.body.classList.remove('overflow-hidden'); // Enable scrolling\n}\n","export function getCookie(name: string): string | null {\n const nameEQ = name + '=';\n const cookies = document.cookie.split(';');\n\n for (let i = 0; i < cookies.length; i++) {\n let cookie = cookies[i].trim();\n if (cookie.startsWith(nameEQ)) {\n return decodeURIComponent(cookie.substring(nameEQ.length));\n }\n }\n\n return null;\n}\n","import { getCookie } from '../utils/cookie';\n\nexport function initConsent() {\n const cookie = getCookie('.AspNet.Consent');\n const consent = cookie === 'true' ? true : false;\n window.dataLayer = window.dataLayer || [];\n globalThis.gtag = function (..._: any[]) {\n window.dataLayer.push(arguments);\n };\n\n gtag('consent', 'default', {\n ad_storage: consent ? 'granted' : 'denied',\n ad_user_data: consent ? 'granted' : 'denied',\n ad_personalization: consent ? 'granted' : 'denied',\n analytics_storage: consent ? 'granted' : 'denied',\n });\n\n loadGtagScript()\n .then(() => {\n setConsent();\n const event = new CustomEvent('gaLoaded');\n document.dispatchEvent(event);\n })\n .catch((error) => {\n console.error('Error loading gtag.js:', error);\n });\n}\n\nfunction loadGtagScript(): Promise {\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.async = true;\n script.src = 'https://www.googletagmanager.com/gtag/js?id=G-57FS1GG828';\n script.onload = () => {\n resolve();\n };\n script.onerror = () => {\n console.error('Failed to load gtag.js');\n reject(new Error('Failed to load gtag.js'));\n };\n document.head.appendChild(script);\n });\n}\n\nfunction setConsent() {\n gtag('js', new Date());\n gtag('config', 'G-57FS1GG828', {\n cookie_flags: 'samesite=none; secure',\n });\n}\n","export function viewCartEvent(\n allItems: Item[],\n currency: string = 'GBP',\n value?: number,\n coupon?: string,\n) {\n gtag('event', 'view_cart', {\n currency: currency,\n value: value,\n coupon: coupon,\n items: allItems,\n });\n}\n","import { viewCartEvent } from './utils/viewCart';\n\nexport function viewCartDrawerEvent() {\n const cartDrawer = document.getElementById(\n 'cart-drawer',\n ) as HTMLElement | null;\n const cartButton = document.getElementById(\n 'cart-button',\n ) as HTMLButtonElement | null;\n\n cartButton?.addEventListener('click', () => {\n const allItems =\n cartDrawer?.querySelectorAll('[data-cart-item]');\n let allCartItems: Item[] = [];\n let value = 0;\n\n allItems?.forEach((item) => {\n const name = item.dataset.ga4ProductName;\n const price = Number(item.dataset.ga4ProductPrice);\n const quantity = Number(item.dataset.ga4ProductQuantity);\n const id = item.dataset.ga4ProductId;\n\n if (!name || !price || !quantity || !id) {\n console.error('Missing a value for viewCartEvent');\n return;\n }\n\n const cartItem: Item = {\n item_id: id,\n item_name: name,\n quantity: quantity,\n price: price,\n };\n\n allCartItems.push(cartItem);\n value += price;\n });\n\n viewCartEvent(allCartItems, undefined, value);\n });\n}\n","export function removeFromCartEvent(\n addedProduct: Product,\n currency: string = 'GBP',\n value?: number,\n) {\n const object: Product = {\n item_id: addedProduct.item_id,\n item_name: addedProduct.item_name,\n price: addedProduct.price,\n quantity: addedProduct.quantity ?? 1,\n index: addedProduct.index, // Optional\n item_list_name: addedProduct.item_list_name, // Optional\n coupon: addedProduct.coupon, // Optional\n };\n\n if (value === undefined || value === null) {\n value = object.price * object.quantity;\n }\n\n gtag('event', 'remove_from_cart', {\n currency: currency,\n value: value,\n items: [object],\n });\n}\n","import { addToCartEvent } from './utils/addToCart';\nimport { removeFromCartEvent } from './utils/removeFromCart';\n\nexport function addAndRemoveFromCartEvent() {\n // Initialise the event listeners\n const itemList = document.getElementById('cart-drawer__content');\n const allCartItems = document.querySelectorAll(\n '[data-cart-item]',\n ) as NodeListOf;\n allCartItems.forEach((item) => {\n attachEvents(item);\n });\n\n itemList?.addEventListener('htmx:afterSwap', (event) => {\n const e = event as CustomEvent;\n const swappedElement = e.detail.elt;\n if (!(swappedElement.id == 'cart-drawer__content')) {\n attachEvents(swappedElement);\n } else {\n const allCartItems = document.querySelectorAll(\n '[data-cart-item]',\n ) as NodeListOf;\n allCartItems.forEach((item) => {\n attachEvents(item);\n });\n }\n });\n}\n\nfunction attachEvents(item: HTMLElement) {\n const increaseItemQButton = item.querySelector(\n '[data-cart-add-item]',\n );\n const decreaseItemQButton = item.querySelector(\n '[data-cart-remove-item]',\n );\n const deleteItemButton = item.querySelector(\n '[data-cart-remove-all]',\n );\n\n const itemName = item.dataset.ga4ProductName;\n const itemId = item.dataset.ga4ProductId;\n const itemPrice = Number(item.dataset.ga4ProductPrice);\n const itemQuantity = Number(item.dataset.ga4ProductQuantity);\n const itemUnitPrice = Number((itemPrice / itemQuantity).toFixed(2));\n\n if (!itemId || !itemName || !itemPrice || !itemQuantity) {\n console.error('value is missing from addAndRemoveFromCart events');\n return;\n }\n\n increaseItemQButton?.addEventListener('click', () => {\n const addedItem: Item = {\n item_id: itemId,\n item_name: itemName,\n price: itemUnitPrice,\n quantity: 1,\n };\n\n addToCartEvent(addedItem, undefined, itemPrice);\n });\n\n decreaseItemQButton?.addEventListener('click', () => {\n const removedItem: Item = {\n item_id: itemId,\n item_name: itemName,\n price: itemUnitPrice,\n quantity: 1,\n };\n\n removeFromCartEvent(removedItem, undefined, itemPrice);\n });\n\n deleteItemButton?.addEventListener('click', () => {\n const removedItem: Item = {\n item_id: itemId,\n item_name: itemName,\n price: itemPrice,\n quantity: itemQuantity,\n };\n\n removeFromCartEvent(removedItem, undefined, itemPrice);\n });\n}\n","import { viewCartDrawerEvent } from '../GA4/viewCartDrawer';\nimport { addAndRemoveFromCartEvent } from '../GA4/addAndRemoveFromCart';\n\nexport function initCart() {\n document.addEventListener('gaLoaded', () => {\n viewCartDrawerEvent();\n addAndRemoveFromCartEvent();\n });\n}\n","import { applyFocusTrap } from '../utils/focustrap';\n\nexport function initPopups() {\n const triggers = document.querySelectorAll('[data-popup-trigger]');\n const popups = document.querySelectorAll('[data-popup]');\n const openPopup = (popup: HTMLElement) => {\n popup.classList.remove('hidden');\n document.body.style.overflow = 'hidden';\n setTimeout(() => {\n popup.dataset.state = 'open';\n }, 50);\n // If it contains input, focus on first input\n const input = popup.querySelector('input');\n if (input) {\n input.value = '';\n input.focus();\n }\n };\n const closePopup = (popup: HTMLElement) => {\n popup.dataset.state = 'closed';\n document.body.style.overflow = 'auto';\n setTimeout(() => {\n popup.classList.add('hidden');\n }, 150);\n };\n // Attach the triggers to open\n triggers.forEach((trig) => {\n const triggeredPopup = (trig as HTMLElement).dataset.popupTrigger;\n const popup = document.querySelector(\n `[data-popup=\"${triggeredPopup}\"]`,\n );\n\n if (!popup) return;\n\n trig.addEventListener('click', () => {\n applyFocusTrap(popup);\n openPopup(popup);\n });\n\n document.addEventListener('keydown', (event) => {\n if (event.key === 'Escape') {\n closePopup(popup);\n }\n });\n });\n\n // Attach the triggers to close the popup\n popups.forEach((pi) => {\n const p = pi as HTMLElement;\n const button = p.querySelector('[data-popup-close]');\n const background = p.querySelector('[data-popup-background]');\n const content = p.querySelector('[data-popup-content]');\n\n button?.addEventListener('click', () => {\n closePopup(p);\n });\n\n background?.addEventListener('click', (event) => {\n const target = event.target as HTMLElement;\n if (!content?.contains(target)) closePopup(p);\n });\n });\n}\n","import { initNavbar } from './components/navbar';\nimport { initCookie } from './components/cookie';\nimport { initModals } from './components/modal';\nimport { initConsent } from './GA4/consent';\nimport { initCart } from './components/cart';\nimport { initAllDrawers, initDrawer } from './components/drawer';\nimport { applyFocusTrap, removeFocusTrap } from './utils/focustrap';\nimport { initPopups } from './components/popup';\n\ndocument.addEventListener('DOMContentLoaded', () => {\n initCookie();\n initNavbar();\n initModals();\n initConsent();\n initCart();\n initAllDrawers();\n resizeCartContent();\n initPopups();\n initSearch();\n});\n\nfunction resizeCartContent() {\n // TODO: Consider just using htmx:afterSwap instead of this custom event and a timeout\n document.addEventListener('resizeCartContent', (event) => {\n setTimeout(() => {\n const e = event as CustomEvent;\n const cartContainer = document.getElementById(\n 'cart-drawer__scrollable-area',\n );\n const hasRelatedProducts = e.detail.value;\n\n if (hasRelatedProducts) {\n cartContainer?.classList.remove('noRelatedProducts');\n cartContainer?.classList.add('hasRelatedProducts');\n } else {\n cartContainer?.classList.add('noRelatedProducts');\n cartContainer?.classList.remove('hasRelatedProducts');\n }\n }, 100); // add a 100ms delay\n });\n}\n\nfunction initSearch() {\n const input = document.getElementById(\n 'search-input',\n ) as HTMLInputElement | null;\n const placeholder = document.getElementById(\n 'search-placeholder',\n ) as HTMLInputElement | null;\n if (!input || !placeholder) return;\n\n let index = 1;\n let lastTime = 0;\n let pause = false;\n const delay = 1500;\n const elements: HTMLElement[] = [];\n const searchTerms = ['Skin', 'Ashwagandha', 'Digestion', 'Iron', 'Vitamin'];\n\n searchTerms.forEach((term) => {\n const spanElement = document.createElement('span');\n spanElement.classList.add(\n 'absolute',\n 'top-0',\n 'left-0',\n 'opacity-0',\n 'transition-all',\n 'whitespace-nowrap',\n 'duration-300',\n );\n spanElement.textContent = 'Search' + \" '\" + term + \"'\";\n elements.push(spanElement);\n placeholder.appendChild(spanElement);\n });\n\n let currentElement = elements[0];\n\n // Pause animation and hide fake placeholder if input is empty\n input.addEventListener('input', () => {\n pause = input.value != '';\n if (pause) {\n placeholder.classList.add('opacity-0');\n } else {\n placeholder.classList.remove('opacity-0');\n }\n });\n\n // placeholder animation\n const animatePlaceholder = (timestamp: number) => {\n const deltaTime = timestamp - lastTime;\n const container = document.querySelector(\n '[data-drawer-wrapper=\"search-drawer\"]',\n );\n const searchIsOpen = container ? container.dataset.state === 'open' : false;\n\n if (deltaTime >= delay && !pause && searchIsOpen) {\n currentElement.classList.add('opacity-0');\n elements[index].classList.remove('opacity-0');\n\n currentElement = elements[index];\n index == searchTerms.length - 1 ? (index = 0) : index++;\n lastTime = timestamp; // Update last time to the current timestamp\n }\n\n requestAnimationFrame(animatePlaceholder);\n };\n\n requestAnimationFrame(animatePlaceholder);\n\n // Add event listeners to the buttons\n const clearButton = document.getElementById('search-clear');\n const enterButton = document.getElementById('search-enter');\n\n clearButton?.addEventListener('click', () => {\n input.value = '';\n });\n\n enterButton?.addEventListener('click', () => {\n window.location.href = '/search?query=' + input.value;\n });\n\n input.addEventListener('keydown', (event) => {\n if (event.key === 'Enter') {\n window.location.href = '/search?query=' + input.value;\n }\n });\n}\n"],"names":["toggleVisibility","element","showClass","hideClass","duration","initNavbar","menuButton","menuId","menuContent","hoverTimeout","showMenu","hideMenu","event","e","initCookie","banner","acceptButton","rejectButton","footer","cookie","setConsentCookie","updateGA4Consent","value","dt","removeBanner","initModals","addEventListeners","modal","modalBox","buttons","button","closeModal","hideModal","target","applyFocusTrap","getCookie","name","nameEQ","cookies","i","initConsent","consent","_","loadGtagScript","setConsent","error","resolve","reject","script","viewCartEvent","allItems","currency","coupon","viewCartDrawerEvent","cartDrawer","cartButton","allCartItems","item","price","quantity","id","cartItem","removeFromCartEvent","addedProduct","object","_a","addAndRemoveFromCartEvent","itemList","attachEvents","swappedElement","increaseItemQButton","decreaseItemQButton","deleteItemButton","itemName","itemId","itemPrice","itemQuantity","itemUnitPrice","addToCartEvent","initCart","initPopups","triggers","popups","openPopup","popup","input","closePopup","trig","triggeredPopup","pi","p","background","content","initAllDrawers","resizeCartContent","initSearch","cartContainer","placeholder","index","lastTime","pause","delay","elements","searchTerms","term","spanElement","currentElement","animatePlaceholder","timestamp","deltaTime","container","searchIsOpen","clearButton","enterButton"],"mappings":"4GAAO,SAASA,EACdC,EACAC,EACAC,EACAC,EACA,CACQH,EAAA,UAAU,OAAOE,CAAS,EAC1BF,EAAA,UAAU,IAAIC,CAAS,EAEvBD,EAAA,MAAM,WAAa,WAAWG,CAAQ,iBAC9CH,EAAQ,MAAM,QAAU,IAExB,WAAW,IAAM,CACXA,EAAQ,UAAU,SAASE,CAAS,IACtCF,EAAQ,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