{"version":3,"sources":["index.js"],"names":["define","window","assets","require","ResponsiveBanner","i","banners","document","querySelectorAll","length","banner","filters","initiate","Product","postal","products","element","channel","subscribe","topic","callback","data","batch","LazyLoad","lazyload","ProductGrid","ProductGroupfilter","productGrids","loadMore","querySelector","elementLoadMore","filterClass","lazyLoad","LookCarousel","lookCarousels","ShortText","texts","text","Recommendation","recommendations","recommendationsObjects","push","type","getAttribute","isRecommendationsReady","ready","clearInterval","waitForAllRecommendations","setInterval","publish"],"mappings":"AAAAA,OAAA,8BAAA,WACA,YAEAC,QAAAC,OAAAD,OAAAC,WAEAC,SAAA,4BAAA,SAAAC,kBACA,GACAC,GADAC,QAAAC,SAAAC,iBAAA,iBAEA,KAAAH,EAAA,EAAAA,EAAAC,QAAAG,SAAAJ,EACA,GAAAD,mBACAM,OAAAJ,QAAAD,OAKAF,SAAA,mBAAA,SAAAQ,SACAV,OAAAC,OAAAS,QAAAA,QACAV,OAAAC,OAAAS,QAAAC,SAAA,gBAKAT,SAAA,kBAAA,UAAA,SAAAU,QAAAC,QAEA,GACAT,GADAU,SAAAR,SAAAC,iBAAA,eAEA,KAAAH,EAAA,EAAAA,EAAAU,SAAAN,SAAAJ,EACA,GAAAQ,UACAG,QAAAD,SAAAV,KACAO,UAGAE,QAAAG,QAAA,QAAAC,WACAC,MAAA,eACAC,SAAA,SAAAC,MACA,GACAhB,GADAU,SAAAM,KAAAC,MAAAd,iBAAA,QAEA,KAAAH,EAAA,EAAAA,EAAAU,SAAAN,SAAAJ,EACA,GAAAQ,UACAG,QAAAD,SAAAV,KACAO,gBAOAT,SAAA,oBAAA,SAAAoB,UACAtB,OAAAC,OAAAsB,UAAA,GAAAD,WAAAX,aAIAT,SAAA,sBAAA,8BACA,SAAAsB,YAAAC,oBACA,GAEArB,GAFAsB,aAAApB,SAAAC,iBAAA,UACAoB,SAAArB,SAAAsB,cAAA,aAEA,KAAAxB,EAAA,EAAAA,EAAAsB,aAAAlB,SAAAJ,EACA,GAAAoB,cACAT,QAAAW,aAAAtB,GACAyB,gBAAAF,SACAG,YAAA,GAAAL,wBAAAd,WACAoB,SAAA/B,OAAAC,OAAAsB,WACAZ,aAMAT,SAAA,wBAAA,SAAA8B,cACA,GACA5B,GADA6B,cAAA3B,SAAAC,iBAAA,eAEA,KAAAH,EAAA,EAAAA,EAAA6B,cAAAzB,SAAAJ,EACA,GAAA4B,eACAjB,QAAAkB,cAAA7B,GACA2B,SAAA/B,OAAAC,OAAAsB,WACAZ,aAIAT,SAAA,qBAAA,SAAAgC,WACA,GACA9B,GADA+B,MAAA7B,SAAAC,iBAAA,oBAGA,KAAAH,EAAA,EAAAA,EAAA+B,MAAA3B,SAAAJ,EACA,GAAA8B,YACAE,KAAAD,MAAA/B,OAKAF,SAAA,yBAAA,UAAA,SAAAmC,eAAAxB,QACA,GACAT,GADAkC,gBAAAhC,SAAAC,iBAAA,oBAEAgC,yBACA,KAAAnC,EAAA,EAAAA,EAAAkC,gBAAA9B,SAAAJ,EACAmC,uBAAAC,KAAA,GAAAH,iBACAtB,QAAAuB,gBAAAlC,GACAqC,KAAAH,gBAAAlC,GAAAsC,aAAA,8BACA/B,WAGA,IAAAgC,wBAAA,WACA,IAAAvC,EAAA,EAAAA,EAAAkC,gBAAA9B,SAAAJ,EACA,IAAAmC,uBAAAnC,GAAAwC,MACA,OAAA,CAMA,OAFAC,eAAAC,4BAEA,GAGAA,0BAAAC,YAAA,WACAJ,0BACA9B,OAAAG,QAAA,SAAAgC,SACA9B,MAAA,qBACAE,KAAA,WACAP,OAAAG,QAAA,kBAAAgC,SACA9B,MAAA,eAKA","file":"index.js","sourcesContent":["define('views/productgroup/index',[],function() {\r\n\t'use strict';\r\n\r\n\twindow.assets = window.assets || {};\r\n\r\n\trequire(['classes/responsivebanner'], function(ResponsiveBanner) {\r\n\t\tvar banners = document.querySelectorAll('.header-banner'),\r\n\t\t\ti;\r\n\t\tfor (i = 0; i < banners.length; ++i) {\r\n\t\t\tnew ResponsiveBanner({\r\n\t\t\t\tbanner: banners[i]\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\r\n\trequire(['classes/filters'], function(filters) {\r\n\t\twindow.assets.filters = filters;\r\n\t\twindow.assets.filters.initiate(function() {\r\n\t\t\tconsole.log('filters initiated the old way');\r\n\t\t});\r\n\t});\r\n\r\n\trequire(['classes/product', 'postal'], function(Product, postal) {\r\n\t\t// catch all products\r\n\t\tvar products = document.querySelectorAll('#items .item'),\r\n\t\t\ti;\r\n\t\tfor (i = 0; i < products.length; ++i) {\r\n\t\t\tnew Product({\r\n\t\t\t\telement: products[i]\r\n\t\t\t}).initiate();\r\n\t\t}\r\n\r\n\t\tpostal.channel('page').subscribe({\r\n\t\t\ttopic: 'new.products',\r\n\t\t\tcallback: function(data) {\r\n\t\t\t\tvar products = data.batch.querySelectorAll('.item'),\r\n\t\t\t\t\ti;\r\n\t\t\t\tfor (i = 0; i < products.length; ++i) {\r\n\t\t\t\t\tnew Product({\r\n\t\t\t\t\t\telement: products[i]\r\n\t\t\t\t\t}).initiate();\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n\r\n\trequire(['classes/lazyload'], function(LazyLoad) {\r\n\t window.assets.lazyload = new LazyLoad().initiate();\r\n\t});\r\n \r\n\r\n\trequire(['classes/productgrid', 'classes/productgroupfilter'],\r\n\tfunction (ProductGrid, ProductGroupfilter) {\r\n\t\tvar productGrids = document.querySelectorAll('#items'),\r\n\t\t\tloadMore = document.querySelector('.load-more'),\r\n\t\t\ti;\r\n\t\tfor (i = 0; i < productGrids.length; ++i) {\r\n\t\t\tnew ProductGrid({\r\n\t\t\t\telement: productGrids[i],\r\n\t\t\t\telementLoadMore: loadMore,\r\n\t\t\t\tfilterClass: new ProductGroupfilter({}).initiate(),\r\n\t\t\t\tlazyLoad: window.assets.lazyload\r\n\t\t\t}).initiate();\r\n\t\t}\r\n\t});\r\n\r\n\r\n\r\n\trequire(['classes/lookcarousel'], function(LookCarousel) {\r\n\t\tvar lookCarousels = document.querySelectorAll('.look-swiper'),\r\n\t\t\ti;\r\n\t\tfor (i = 0; i < lookCarousels.length; ++i) {\r\n\t\t\tnew LookCarousel({\r\n\t\t\t\telement: lookCarousels[i],\r\n\t\t\t\tlazyLoad: window.assets.lazyload\r\n\t\t\t}).initiate();\r\n\t\t}\r\n\t});\r\n\r\n\trequire(['classes/shorttext'], function(ShortText) {\r\n\t\tvar texts = document.querySelectorAll('#short-about-text'),\r\n\t\t\ti;\r\n\t\t\tconsole.log('load')\r\n\t\tfor (i = 0; i < texts.length; ++i) {\r\n\t\t\tnew ShortText({\r\n\t\t\t\ttext: texts[i]\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\r\n\trequire(['classes/recommendation', 'postal'], function(Recommendation, postal) {\r\n\t\tvar recommendations = document.querySelectorAll('.recommendations'),\r\n\t\t\ti,\r\n\t\t\trecommendationsObjects = [];\r\n\t\tfor (i = 0; i < recommendations.length; ++i) {\r\n\t\t\trecommendationsObjects.push(new Recommendation({\r\n\t\t\t\telement: recommendations[i],\r\n\t\t\t\ttype: recommendations[i].getAttribute('data-recommendation-type')\r\n\t\t\t}).initiate());\r\n\t\t}\r\n\r\n\t\tvar isRecommendationsReady = function() {\r\n\t\t\tfor (i = 0; i < recommendations.length; ++i) {\r\n\t\t\t\tif (!recommendationsObjects[i].ready) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tclearInterval(waitForAllRecommendations);\r\n\r\n\t\t\treturn true;\r\n\t\t};\r\n\r\n\t\tvar waitForAllRecommendations = setInterval(function() {\r\n\t\t\tif (isRecommendationsReady()) {\r\n\t\t\t\tpostal.channel('nosto').publish({\r\n\t\t\t\t\ttopic: 'recommendation.all',\r\n\t\t\t\t\tdata: function() {\r\n\t\t\t\t\t\tpostal.channel('recommendation').publish({\r\n\t\t\t\t\t\t\ttopic: 'render'\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}, 200);\r\n\t});\r\n\r\n\t\r\n\r\n});\n"]}