{"version":3,"sources":["webpack:///./app/javascript/ga/eligibility-checker-ga-data.js","webpack:///./app/javascript/data/optionCategories.js","webpack:///./app/javascript/hooks.js","webpack:///./app/javascript/controllers/shared sync _controller\\.js$","webpack:///./app/javascript/controllers/shared/auto_submit_controller.js","webpack:///./app/javascript/controllers/shared/clickable_controller.js","webpack:///./app/javascript/controllers/shared/drawer_controller.js","webpack:///./app/javascript/controllers/shared/dropdown_controller.js","webpack:///./app/javascript/controllers/shared/modal_controller.js","webpack:///./app/javascript/ga/form_ga_data.js"],"names":["pushData","data","event","step","step_name","stepName","action","selection","currentValue","dataLayer","push","categoriesColour","categoriesEquipment","categoriesExterior","categoriesInterior","categoriesPacks","categoriesTrim","allCategories","useIsomorphicLayoutEffect","window","useLayoutEffect","useEffect","useWindowSize","useState","width","height","windowSize","setWindowSize","handleSize","innerWidth","innerHeight","addEventListener","removeEventListener","map","webpackContext","req","id","webpackContextResolve","__webpack_require__","o","e","Error","code","keys","Object","resolve","module","exports","this","element","getAttribute","Array","from","children","forEach","child","classList","add","loader","document","createElement","appendChild","dispatchEvent","Event","bubbles","additionalParams","target","nodeName","name","value","type","history","pushState","turbolinks","location","pathname","formToQueryString","submit","Controller","hasAnchorTarget","style","cursor","toLowerCase","Turbolinks","visit","anchorTarget","href","targets","currentID","preventDefault","$","length","setTimeout","closest","empty","body","remove","isNew","currentTarget","request","FormData","Rails","ajax","url","dataType","accept","success","result","populate","html","error","xhr","status","console","log","$drawers","insertAdjacentHTML","containerTarget","innerHTML","drawer","on","close","ReactRailsUJS","mountComponents","drawerName","dataset","load","handleClickOutside","bind","toggleClass","dropdownToggleClass","getParentToggleClass","tagName","parentDropdown","getClosestDropdownElement","dropdown","contains","toggle","parentElement","targetID","useDebounce","handleBeforeCache","removeBootstrapModalClass","clearModalContent","getElement","modal","selector","getElementById","outerHTML","show","unmountComponents","setHtml","debounces","form_name","lease_type","signup","item","user_data","email","phone_number","item_name","item_brand","item_variant","item_category","item_category2","item_category3","price","quantity","duration","annual_miles","initial_payment_duration","initial_payment_price","maintenance","maintenance_price","item_list_name","localStorage","getItem","item_list_id","currency","removeItem"],"mappings":"0FAAA,kCAAO,IAAMA,EAAW,SAAC,GAA8C,IAC/DC,EAAO,CACXC,MAAO,sBACPC,KAHkE,EAA3CA,KAGV,EACbC,UAJkE,EAArCC,SAK7BC,OALkE,EAA3BA,OAMvCC,UANkE,EAAnBC,cAMpB,IAE7BC,UAAUC,KAAKT,K,gCCRjB,8OAAO,IAAMU,EAAmB,CAC9B,GACA,GACA,GACA,GACA,GACA,GACA,IACA,IACA,IACA,IACA,KAGWC,EAAsB,CACjC,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,IACA,IACA,KAGWC,EAAqB,CAChC,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,IAGWC,EAAqB,CAChC,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,IACA,IACA,KAGWC,EAAkB,CAAC,IAEnBC,EAAiB,CAC5B,GACA,GACA,GACA,GACA,GACA,GACA,GACA,IACA,IACA,IACA,IACA,KAGWC,EAAa,UACrBN,EACAC,EACAC,EACAC,EACAC,EACAC,I,giCC9CL,IAAME,EAA8C,qBAAXC,OAAyBC,kBAAkBC,YAE7E,SAASC,IACd,QAAoCC,mBAAS,CAC3CC,MAAO,EACPC,OAAQ,IAFV,GAAOC,EAAP,KAAmBC,EAAnB,KAKMC,EAAa,WACjBD,EAAc,CACZH,MAAOL,OAAOU,WACdJ,OAAQN,OAAOW,eAcnB,OAVAT,qBAAU,WAGR,OAFAF,OAAOY,iBAAiB,SAAUH,GAE3B,kBAAMT,OAAOa,oBAAoB,SAAUJ,MACjD,CAACA,IAEJV,GAA0B,WACxBU,MACC,IAEI,CAACF,EAAWF,MAAOE,EAAWD,U,oBC7DvC,IAAIQ,EAAM,CACT,8BAA+B,IAC/B,4BAA6B,IAC7B,yBAA0B,IAC1B,2BAA4B,IAC5B,wBAAyB,KAI1B,SA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,OAAO4J,aAAaC,QAAQ,YAG9C/K,EAAKyJ,WAAaA,EAClBzJ,EAAKoE,MAAQA,EACbpE,EAAKiL,SAAW,OAGlBzK,UAAUC,KAAKT,GAEfkB,OAAO4J,aAAaI,WAAW,YAC/BhK,OAAO4J,aAAaI,WAAW","file":"js/application~1f075a2e-86ef0934c986a9a8aa36.chunk.js","sourcesContent":["export const pushData = ({ step, stepName, action, currentValue }) => {\n  const data = {\n    event: 'eligibility_checker',\n    step: step + 1,\n    step_name: stepName,\n    action,\n    selection: currentValue || '',\n  };\n  dataLayer.push(data);\n};\n","export const categoriesColour = [\n  44, // Paint - Metallic\n  45, // Paint - Solid\n  73, // Paint - Mica\n  74, // Paint - Pearlescent\n  75, // Paint - Special\n  76, // Paint - Two Tone\n  103, // Paint - Metallic\n  104, // Paint - Mica\n  105, // Paint - Pearlescent\n  106, // Paint - Solid\n  107, // Paint - Special\n];\n\nexport const categoriesEquipment = [\n  46, // Driver Convenience\n  48, // Security\n  64, // Engine\n  65, // Transmission\n  67, // Driver Aids\n  68, // Communication\n  77, // Safety\n  79, // Towing\n  89, // Wheels - Spare\n  95, // PTO\n  99, // Security\n  101, // Electrical\n  102, // Load Area\n  116, // Driver Aids\n];\n\nexport const categoriesExterior = [\n  26, // Wheels\n  58, // Exterior Body Features\n  59, // Chassis/Suspension\n  60, // Hoods\n  62, // Body Glass\n  63, // Brakes\n  69, // Driving Mirrors\n  71, // Exterior Lights\n  88, // Wheels - Alloy\n  96, // Doors\n  98, // Wheels - Alloys\n];\n\nexport const categoriesInterior = [\n  24, // Entertainment\n  49, // Seats\n  61, // Interior Features\n  66, // Driver Information\n  70, // Interior Lights\n  72, // Vanity Mirrors\n  80, // Carpets/Rugs\n  87, // Heating/Cooling/Ventilation\n  100, // Driver Information\n  114, // Interior Lights\n  115, // Communication\n];\n\nexport const categoriesPacks = [34];\n\nexport const categoriesTrim = [\n  81, // Trim - Cloth\n  82, // Trim - Leather\n  83, // Seat Piping/Additional Trimming\n  84, // Embellishment Trims\n  86, // Trim - Alcantara Suede\n  90, // Trim - Vinyl\n  97, // both Trim - Part Leather, and Bulkhead/Partition\n  109, // Trim - Alcantara\n  110, // Trim - Cloth\n  111, // Trim - Leather\n  112, // Trim - Part Leather\n  113, // Trim - Vinyl\n];\n\nexport const allCategories = [\n  ...categoriesColour,\n  ...categoriesEquipment,\n  ...categoriesExterior,\n  ...categoriesInterior,\n  ...categoriesPacks,\n  ...categoriesTrim,\n];\n","import { useEffect, useRef, useLayoutEffect, useState } from 'react';\n\n// useEventListener from https://usehooks.com/useEventListener/\nexport function useEventListener(eventName, handler, element = window) {\n  // Create a ref that stores handler\n  const savedHandler = useRef();\n\n  // Update ref.current value if handler changes.\n  // This allows our effect below to always get latest handler without us needing to pass it in\n  // effect deps array and potentially cause effect to re-run every render.\n  useEffect(() => {\n    savedHandler.current = handler;\n  }, [handler]);\n\n  useEffect(\n    () => {\n      // Make sure element supports addEventListener\n      // On\n      const isSupported = element && element.addEventListener;\n      if (!isSupported) return;\n\n      // Create event listener that calls handler function stored in ref\n      const eventListener = (event) => savedHandler.current(event);\n\n      // Add event listener\n      element.addEventListener(eventName, eventListener);\n\n      // Remove event listener on cleanup\n      return () => {\n        element.removeEventListener(eventName, eventListener);\n      };\n    },\n    [eventName, element], // Re-run if eventName or element changes\n  );\n}\n\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\nexport function useWindowSize() {\n  const [windowSize, setWindowSize] = useState({\n    width: 0,\n    height: 0,\n  });\n\n  const handleSize = () => {\n    setWindowSize({\n      width: window.innerWidth,\n      height: window.innerHeight,\n    });\n  };\n\n  useEffect(() => {\n    window.addEventListener('resize', handleSize);\n\n    return () => window.removeEventListener('resize', handleSize);\n  }, [handleSize]);\n\n  useIsomorphicLayoutEffect(() => {\n    handleSize();\n  }, []);\n\n  return [windowSize.width, windowSize.height];\n}\n","var map = {\n\t\"./auto_submit_controller.js\": 580,\n\t\"./clickable_controller.js\": 581,\n\t\"./drawer_controller.js\": 582,\n\t\"./dropdown_controller.js\": 583,\n\t\"./modal_controller.js\": 584\n};\n\n\nfunction webpackContext(req) {\n\tvar id = webpackContextResolve(req);\n\treturn __webpack_require__(id);\n}\nfunction webpackContextResolve(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\treturn map[req];\n}\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 579;","import { Controller } from '@hotwired/stimulus';\n\nimport { formToQueryString } from '../../utils';\n\nexport default class extends Controller {\n  connect() {\n    this.element.addEventListener('submit', () => {\n      if (this.element.getAttribute('data-show-auto-submit-loader') === 'false') {\n        return;\n      }\n\n      Array.from(this.element.children).forEach((child) => child.classList.add('is-loading'));\n\n      const loader = document.createElement('div');\n      loader.id = 'loader';\n\n      this.element.appendChild(loader);\n    });\n  }\n\n  change(event) {\n    if (this.element.getAttribute('data-remote') === 'true') {\n      this.element.dispatchEvent(new Event('submit', { bubbles: true }));\n\n      const additionalParams = {};\n\n      // Handle submit buttons or inputs that have names and values\n      if (event.target.nodeName === 'BUTTON' && event.target.name && typeof event.target.value !== 'undefined') {\n        additionalParams[event.target.name] = event.target.value;\n      }\n\n      if (event.target.nodeName !== 'INPUT' || event.target.type !== 'checkbox') {\n        window.history.pushState(\n          { turbolinks: {} },\n          '',\n          `${window.location.pathname}?${formToQueryString(this.element, additionalParams)}`,\n        );\n      }\n    } else {\n      this.element.submit();\n    }\n  }\n}\n","import { Controller } from '@hotwired/stimulus';\n\nexport default class extends Controller {\n  static targets = ['anchor'];\n\n  connect() {\n    if (this.hasAnchorTarget) {\n      this.element.style.cursor = 'pointer';\n\n      this.element.addEventListener('click', (event) => {\n        if (event.target.nodeName.toLowerCase() !== 'a') {\n          Turbolinks.visit(this.anchorTarget.href);\n        }\n      });\n    }\n  }\n}\n","import { Controller } from '@hotwired/stimulus';\nimport Rails from '@rails/ujs';\n\nlet currentID = '';\n\nexport default class extends Controller {\n  static targets = ['container'];\n\n  close(event) {\n    event.preventDefault();\n\n    // Check if only one drawer open and update current ID for this\n    if ($('[data-drawer-content]').length === 1) {\n      currentID = $('[data-drawer-content]')[0].id;\n    }\n\n    // Wait for bootstrap plugin animation to finish\n    setTimeout(() => {\n      $(`#${currentID}`).closest('[data-drawer-container]').empty();\n\n      // If no drawers are open remove has-drawer class\n      if (!$('[data-drawer-content]').length) {\n        document.body.classList.remove('has-drawer');\n      }\n    }, 100);\n  }\n\n  load(event, isNew) {\n    event.preventDefault();\n    currentID = event.currentTarget.getAttribute('data-target');\n\n    switch (event.currentTarget.nodeName.toLowerCase()) {\n      case 'a':\n        this.request(event.currentTarget.getAttribute('data-path'), 'GET', '', isNew);\n        break;\n      case 'form':\n        this.request(event.currentTarget.action, 'POST', new FormData(event.currentTarget), isNew);\n        break;\n      default:\n    }\n  }\n\n  request(href, type, data, isNew) {\n    Rails.ajax({\n      url: href,\n      type,\n      dataType: 'json',\n      data,\n      accept: 'application/json',\n      success: (result) => {\n        this.populate(result.html, isNew);\n      },\n      error: (xhr, status, error) => {\n        console.log(error);\n      },\n    });\n  }\n\n  populate(html, isNew) {\n    const $drawers = $('[data-drawer-container]');\n    document.body.classList.add('has-drawer');\n\n    if (isNew) {\n      if ($(`#${isNew}`).length === 0) {\n        // Inject html for new container with id\n        $drawers[$drawers.length - 1].insertAdjacentHTML('afterend', `<div data-drawer-container id=\"${isNew}\"></div>`);\n      }\n      $(`#${isNew}`)[0].insertAdjacentHTML('afterbegin', html);\n    } else {\n      // Add html response to modal container\n      this.containerTarget.innerHTML = html;\n    }\n\n    // Initialise & open drawer programmatically\n    $(`#${currentID}`).drawer().drawer('open');\n\n    // Drawer close event listener\n    $(`#${currentID}`).on('drawer.closed', (event) => {\n      this.close(event);\n    });\n\n    // Load react-rails components after ajax request\n    ReactRailsUJS.mountComponents();\n  }\n\n  createNewDrawer(event) {\n    event.preventDefault();\n    // Create new drawer container\n    const drawerName = event.currentTarget.dataset.id;\n\n    this.load(event, `${drawerName}-drawer`);\n  }\n}\n","import { Controller } from '@hotwired/stimulus';\n\nexport default class extends Controller {\n  connect() {\n    document.addEventListener('click', this.handleClickOutside.bind(this));\n  }\n\n  disconnect() {\n    document.removeEventListener('click', this.handleClickOutside.bind(this));\n  }\n\n  toggle(event) {\n    const toggleClass = this.element.dataset.dropdownToggleClass || this.getParentToggleClass();\n\n    if (event.target.tagName === 'INPUT' && event.target.type === 'radio') {\n      setTimeout(() => {\n        const parentDropdown = this.getClosestDropdownElement(event.target);\n        this.toggleClass(toggleClass, parentDropdown);\n      }, 200);\n    } else {\n      this.toggleClass(toggleClass, this.element);\n    }\n  }\n\n  close() {\n    setTimeout(() => {\n      const toggleClass = this.element.dataset.dropdownToggleClass || this.getParentToggleClass();\n      this.element.classList.remove(toggleClass);\n    }, 200);\n  }\n\n  handleClickOutside(event) {\n    const dropdown = this.element;\n    const toggleClass = this.element.dataset.dropdownToggleClass || this.getParentToggleClass();\n\n    if (!dropdown.contains(event.target) && dropdown.classList.contains(toggleClass)) {\n      dropdown.classList.remove(toggleClass);\n    }\n  }\n\n  toggleClass(toggleClass, element) {\n    if (toggleClass && element) {\n      element.classList.toggle(toggleClass);\n    }\n  }\n\n  getParentToggleClass() {\n    const parentElement = this.element.closest('.drv-ui.drv-filter-controls__sort');\n    return parentElement ? parentElement.dataset.dropdownToggleClass : null;\n  }\n\n  getClosestDropdownElement(target) {\n    return target.closest('.drv-ui.drv-filter-controls__sort');\n  }\n}\n","import { Controller } from '@hotwired/stimulus';\nimport { useDebounce } from 'stimulus-use';\nimport Rails from '@rails/ujs';\n\nlet targetID = '';\n// eslint-disable-next-line no-unused-vars\nlet closeTimeout;\n\nexport default class extends Controller {\n  static targets = ['container'];\n\n  static debounces = ['request'];\n\n  connect() {\n    useDebounce(this);\n    this.handleBeforeCache();\n  }\n\n  disconnect() {\n    this.close();\n    this.removeBootstrapModalClass();\n    this.clearModalContent();\n  }\n\n  close(event) {\n    if (event) {\n      event.preventDefault();\n    }\n    this.getElement().modal('hide');\n  }\n\n  getElement() {\n    const selector = targetID ? `#${targetID}` : '.modal';\n    return $(selector, this.containerTarget);\n  }\n\n  show(event) {\n    event.preventDefault();\n\n    targetID = event.target.getAttribute('data-target');\n    const modal = document.getElementById(targetID);\n\n    this.containerTarget.innerHTML = modal.outerHTML;\n\n    this.getElement()\n      .show()\n      .modal('show')\n      .on('hide.bs.modal', () => {\n        this.removeBootstrapModalClass();\n      });\n  }\n\n  load(event) {\n    event.preventDefault();\n\n    switch (event.currentTarget.nodeName.toLowerCase()) {\n      case 'a':\n        this.request(event.currentTarget.getAttribute('data-path'), 'GET', '');\n        break;\n      case 'form':\n        this.request(event.target.action, 'POST', new FormData(event.currentTarget));\n        break;\n      default:\n    }\n  }\n\n  request(href, type, data) {\n    Rails.ajax({\n      url: href,\n      type,\n      dataType: 'json',\n      data,\n      accept: 'application/json',\n      success: (result) => {\n        this.populate(result.html);\n      },\n      error: (xhr, status, error) => {\n        console.log(error);\n      },\n    });\n  }\n\n  removeBootstrapModalClass() {\n    document.body.classList.remove('has-modal', 'modal-open');\n    $('.modal-backdrop').remove(); // Remove any modal backdrops\n  }\n\n  setHtml(html) {\n    ReactRailsUJS.unmountComponents(this.containerTarget);\n    this.containerTarget.innerHTML = html;\n  }\n\n  populate(html) {\n    $('.modal-backdrop').remove(); // Remove any modal backdrops\n\n    // Add html response to modal container\n    this.setHtml(html);\n\n    // Load react-rails components after ajax request\n    ReactRailsUJS.mountComponents(this.containerTarget);\n    this.getElement()\n      .modal('show')\n      .on('shown.bs.modal', () => {\n        document.body.classList.add('has-modal', 'modal-open');\n      })\n      .on('hide.bs.modal', () => {\n        this.removeBootstrapModalClass();\n        closeTimeout = setTimeout(() => {\n          this.clearModalContent();\n        }, 0);\n      });\n  }\n\n  handleBeforeCache() {\n    document.addEventListener('turbo:before-cache', () => {\n      this.close();\n      this.removeBootstrapModalClass();\n      this.clearModalContent();\n    });\n  }\n\n  clearModalContent() {\n    this.containerTarget.innerHTML = '';\n  }\n}\n","export const pushData = ({ form_name, lease_type, signup, value, item, user_data }) => {\n  const data = {\n    event: 'generate_lead',\n    form_name,\n    signup,\n    user_data: {\n      email: user_data.email,\n      phone_number: user_data.phone_number,\n    },\n  };\n\n  if (item) {\n    data.item = [\n      {\n        item_name: item.item_name,\n        item_brand: item.item_brand,\n        item_variant: item.item_variant,\n        item_category: item.item_category,\n        item_category2: item.item_category2,\n        item_category3: item.item_category3,\n        price: item.price,\n        quantity: 1,\n        duration: item.duration,\n        annual_miles: item.annual_miles,\n        initial_payment_duration: item.initial_payment_duration,\n        initial_payment_price: item.initial_payment_price,\n        maintenance: item.maintenance,\n        maintenance_price: item.maintenance_price,\n        item_list_name: window.localStorage.getItem('listPath'),\n        item_list_id: window.localStorage.getItem('listID'),\n      },\n    ];\n    data.lease_type = lease_type;\n    data.value = value;\n    data.currency = 'GBP';\n  }\n\n  dataLayer.push(data);\n\n  window.localStorage.removeItem('listPath');\n  window.localStorage.removeItem('listID');\n};\n"],"sourceRoot":""}