{"version":3,"sources":["webpack:///./assets/javascripts/modules/components/WishlistTogglerComponent.js"],"names":["WishlistTogglerComponent","_classCallCheck","this","_this","_possibleConstructorReturn","__proto__","Object","getPrototypeOf","call","onWishlistClass","trackingComponent","TrackingComponent","Component","main","_this2","allHearts","document","querySelectorAll","SELECTORS","cssClass","_loop","heart","addEventListener","e","classList","contains","heartLink","currentTarget","querySelector","trackAction","dataset","toggle","_iteratorNormalCompletion","_didIteratorError","_iteratorError","undefined","_step","_iterator","Symbol","iterator","next","done","value","err","return","initToggler","myName","constructor","name","console","log"],"mappings":"kXAGqBA,cAQnB,SAAAA,iGAAcC,CAAAC,KAAAF,GAAA,IAAAG,mKAAAC,CAAAF,MAAAF,EAAAK,WAAAC,OAAAC,eAAAP,IAAAQ,KAAAN,OAAA,OAEZC,EAAKM,gBAAkB,cACvBN,EAAKO,kBAAoB,IAAIC,UAHjBR,qUARsCS,6CAGlD,OACEC,KAAM,6DAUI,IAAAC,EAAAZ,KACRa,EAAYC,SAASC,iBAAiBf,KAAKgB,UAAUL,MACrDM,EAAWjB,KAAKO,gBAFRW,EAAA,SAGHC,GACPA,EAAMC,iBAAiB,QAAS,SAACC,GAC/B,IAAKF,EAAMG,UAAUC,SAAS,eAAgB,CAC5C,IAAIC,EAAYH,EAAEI,cAAcC,cAAc,eAC9Cd,EAAKJ,kBAAkBmB,YAAY,cAAeH,EAAUI,QAASJ,GAEvEL,EAAMG,UAAUO,OAAOZ,MATfa,GAAA,EAAAC,GAAA,EAAAC,OAAAC,EAAA,IAGZ,QAAAC,EAAAC,EAAkBtB,EAAlBuB,OAAAC,cAAAP,GAAAI,EAAAC,EAAAG,QAAAC,MAAAT,GAAA,EAA6B,CAAAZ,EAAAgB,EAAAM,QAHjB,MAAAC,GAAAV,GAAA,EAAAC,EAAAS,EAAA,aAAAX,GAAAK,EAAAO,QAAAP,EAAAO,SAAA,WAAAX,EAAA,MAAAC,qCAgBRlB,SAASY,cAAc1B,KAAKgB,UAAUL,OACxCX,KAAK2C,cAGP,IAAIC,EAAS5C,KAAK6C,YAAYC,KAC9BC,QAAQC,IAAR,IAAgBJ,EAAhB,0BAnCiB9C","file":"components-WishlistTogglerComponent.chunks.js","sourcesContent":["import Component from '../abstracts/Component';\nimport TrackingComponent from '../components/TrackingComponent';\n\nexport default class WishlistTogglerComponent extends Component {\n\n  get SELECTORS() {\n    return {\n      main: '.wish-switch',\n    };\n  }\n\n  constructor() {\n    super();\n    this.onWishlistClass = 'on-wishlist';\n    this.trackingComponent = new TrackingComponent();\n  }\n\n  initToggler() {\n    let allHearts = document.querySelectorAll(this.SELECTORS.main);\n    let cssClass = this.onWishlistClass;\n    for (let heart of allHearts) {\n      heart.addEventListener('click', (e) => {\n        if (!heart.classList.contains('on-wishlist')) {\n          let heartLink = e.currentTarget.querySelector('[data-code]');\n          this.trackingComponent.trackAction('wishlistAdd', heartLink.dataset, heartLink);\n        }\n        heart.classList.toggle(cssClass);\n      })\n    }\n  }\n\n  render() {\n\n    if (document.querySelector(this.SELECTORS.main)) {\n      this.initToggler();\n    }\n\n    let myName = this.constructor.name;\n    console.log(`[${myName}] Rendering..`);\n  }\n}\n"],"sourceRoot":""}