{"version":3,"sources":["webpack:///./cartridges/app_accelerator_core/cartridge/client/default/js/product/productPackshots.js"],"names":["_disableEvent","event","preventDefault","stopImmediatePropagation","_setProgressbarPosition","slick","currentSlide","nextSlide","_ele","$","currentTarget","parents","_sliderProgress","find","_imgLength","length","_sliderProgressWidth","_sliderProgressLeft","_getScreenDirection","attr","width","css","marginRight","marginLeft","_setProgressbarPositionOnLoad","productTile","addClass","productPackshotInit","allButtons","document","querySelectorAll","allProductTiles","forEach","call","_ProductTile","currentBtn","addEventListener","pid","modules","tracking","init","trackEvent","trackObject","asyncParams","on"],"mappings":";;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAa;;AAC4B;AACzC;AACA;AACA;AACO,SAASA,aAAaA,CAACC,KAAK,EAAE;EACjCA,KAAK,CAACC,cAAc,CAAC,CAAC;EACtBD,KAAK,CAACE,wBAAwB,CAAC,CAAC;AACpC;AAEO,SAASC,uBAAuBA,CAACH,KAAK,EAAEI,KAAK,EAAEC,YAAY,EAAEC,SAAS,EAAE;EAC3E,IAAIC,IAAI,GAAGC,CAAC,CAACR,KAAK,CAACS,aAAa,CAAC,CAACC,OAAO,CAAC,0BAA0B,CAAC;IACjEC,eAAe,GAAGJ,IAAI,CAACK,IAAI,CAAC,wBAAwB,CAAC;IACrDC,UAAU,GAAGN,IAAI,CAACK,IAAI,CAAC,8BAA8B,CAAC,CAACE,MAAM;IAC7DC,oBAAoB,GAAG,GAAG,GAAGF,UAAU;IACvCG,mBAAmB,GAAGD,oBAAoB,GAAGT,SAAS;IACtDW,mBAAmB,GAAGT,CAAC,CAACR,KAAK,CAACS,aAAa,CAAC,CAACC,OAAO,CAAC,MAAM,CAAC,CAACQ,IAAI,CAAC,KAAK,CAAC;EAE5EP,eAAe,CAACQ,KAAK,CAACJ,oBAAoB,GAAG,GAAG,CAAC;EACjD,IAAIE,mBAAmB,IAAI,KAAK,EAAE;IAC9BN,eAAe,CAACS,GAAG,CAAC;MAAEC,WAAW,EAAE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AE;QACxBC,UAAU,EAAE,kBAAkB;QAC9BC,WAAW,EAAE;UACTC,WAAW,EAAE;YACT,KAAK,EAAEN;UACX;QACJ;MACJ,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC,CAAC;EAEF5B,CAAC,CAAC,gCAAgC,CAAC,CAACmC,EAAE,CAAC,cAAc,EAAE,UAAS3C,KAAK,EAAEI,KAAK,EAAEC,YAAY,EAAEC,SAAS,EAAE;IACnGH,uBAAuB,CAACH,KAAK,EAAEI,KAAK,EAAEC,YAAY,EAAEC,SAAS,CAAC;EAClE,CAAC,CAAC;AACN,C","file":"2.js","sourcesContent":["'use strict';\nimport modules from '../helpers/modules';\n/**\n * Disable the event call.\n */\nexport function _disableEvent(event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n}\n\nexport function _setProgressbarPosition(event, slick, currentSlide, nextSlide) {\n let _ele = $(event.currentTarget).parents('.product-tile__packshots'),\n _sliderProgress = _ele.find('.swiper-scrollbar-drag'),\n _imgLength = _ele.find('.product-tile__packshots-img').length,\n _sliderProgressWidth = 100 / _imgLength,\n _sliderProgressLeft = _sliderProgressWidth * nextSlide,\n _getScreenDirection = $(event.currentTarget).parents('html').attr('dir');\n\n _sliderProgress.width(_sliderProgressWidth + '%');\n if (_getScreenDirection == 'rtl') {\n _sliderProgress.css({ marginRight: _sliderProgressLeft + '%' });\n } else {\n _sliderProgress.css({ marginLeft: _sliderProgressLeft + '%' });\n }\n}\n\nexport function _setProgressbarPositionOnLoad(productTile) {\n let _ele = $(productTile),\n _imgLength = _ele.find('.product-tile__packshots-img').length,\n _sliderProgress = _ele.find('.swiper-scrollbar-drag'),\n _sliderProgressWidth = 100 / _imgLength;\n\n if (_imgLength > 1) {\n _sliderProgress.width(_sliderProgressWidth + '%');\n } else {\n _sliderProgress.addClass('hidden');\n }\n}\n\nexport function productPackshotInit() {\n let allButtons = document.querySelectorAll('.slick-arrow'),\n allProductTiles = document.querySelectorAll('[data-product-packshots]');\n\n [].forEach.call(allProductTiles, function(_ProductTile) {\n _setProgressbarPositionOnLoad(_ProductTile);\n });\n\n [].forEach.call(allButtons, function(currentBtn) {\n currentBtn.addEventListener('click', function(event) {\n let pid = $(event.currentTarget).parents('.product-tile__packshots').attr('data-pid');\n _disableEvent(event);\n modules.tracking.init(null, {\n trackEvent: 'productPackShots',\n trackObject: {\n asyncParams: {\n 'pid': pid\n }\n }\n });\n })\n });\n\n $('.product-tile__packshots-slide').on('beforeChange', function(event, slick, currentSlide, nextSlide) {\n _setProgressbarPosition(event, slick, currentSlide, nextSlide);\n });\n}\n"],"sourceRoot":""}