{"version":3,"sources":["webpack:///./widgets/featureBlock.js","webpack:///./viewsHandler.js"],"names":["FeatureBlock","$el","_classCallCheck","this","key","value","setFeatureBlock","$element","$","initCompactView","initFullWindowHeight","Object","assign","prototype","compactViewMixin","fullWindowHeightMixinBlock","self","element","_","isNil","data","setElementHeight","$tplHeader","headerHeight","length","height","setTimeout","css","minHeight","concat","window","visibility","resize","debounce","classes","$tplScroller","document","body","applyCompactView","attr","forEach","classItem","find","isBlockExceedingHeight","clientHeight","outerHeight","toggleCompactViewAttribute","removeAttr","trackingItemsMixinBlock","initTrackingItems","$items","trackingId","$tracker","each","index","activeItems","on","event","currentTarget","trackingItemId","item","push","trigger"],"mappings":"62BAGA,IAUaA,EAAY,WAIvB,O,EAHD,SAAAA,EAAYC,I,4FAAKC,CAAA,KAAAF,GAEhBG,KAAKF,IAAMA,I,EACX,EAAAG,IAAA,OAAAC,MAED,WACCF,KAAKG,oBACL,CAAAF,IAAA,kBAAAC,MAED,WAECF,KAAKI,SAAWC,EAAEL,KAAKF,KAEvBE,KAAKM,gBAAgBN,MACrBA,KAAKO,qBAAqBP,W,0FAfH,GAqBzBQ,OAAOC,OAAOZ,EAAaa,UAAWC,KACtCH,OAAOC,OAAOZ,EAAaa,UAAWE,M,mDCnCtC,uIAIWA,EAA6B,CACvCL,qBAAsB,SAACM,GAGtB,GAFAA,EAAKT,SAAWS,EAAKT,UAAYC,EAAEQ,EAAKC,UAEnCC,IAAEC,MAAMH,EAAKT,SAASa,KAAK,gBAAkBJ,EAAKT,SAASa,KAAK,cAAe,CACnF,IAAIC,EAAmB,WACtB,IAAIC,EAAad,EAAE,eACfe,EAAe,EAEfD,EAAWE,OAAS,IACvBD,EAAeD,EAAWG,UAI3BC,YAAW,WACVV,EAAKT,SAASoB,IAAI,CACjBC,UAAW,GAAFC,OAAKrB,EAAEsB,QAAQL,SAAWF,EAAY,MAC/CQ,WAAY,cAEX,MAGJvB,EAAEsB,QAAQE,OAAOd,IAAEe,UAAS,WAC3BZ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AAWC,EAAES,GACjBV,EAASgC,KAAK,wBAAyBe,GACvC/C,EAASgC,KAAK,+BAA+B,MAG9C,IAAIgB,EAAc,GAElBL,EAAOM,GAAG,SAAS,SAACC,GACnB,IAAIlD,EAAWC,EAAEiD,EAAMC,eACnBC,EAAiBpD,EAASa,KAAK,kBAGrBF,IAAEwB,KAAKa,GAAa,SAACK,GAClC,OAAOA,IAASD,OAGhBJ,EAAYM,KAAKF,GACjBpD,EAASgC,KAAK,+BAA+B,GAEzCW,EAAO1B,SAAW+B,EAAY/B,SACjC4B,EAASU,QAAQ,oBAAqB,CACrCvD,SAAUS,EAAKT,SACf4C,WAAYA,IAEbnC,EAAKT,SAASa,KAAK,oBAAoB,a","file":"33.js","sourcesContent":["/* eslint-disable max-len */\n/* eslint-disable no-unused-vars */\n// CONSTANTS are all caps.\nconst NS = 'FeatureBlock';\nconst CLS = 'featureBlock';\nconst WG = '.' + CLS + '-';\n\n// Import stuff here if you need to or even better to import them dynamically\n// for ex. of dynamic import check out src/scripts/loadWg/featureBlock.js using Webpack dynamic imports as chunks.\n// import $ from 'jquery'\n\nimport {fullWindowHeightMixinBlock, compactViewMixin} from '../viewsHandler';\n\nexport class FeatureBlock {\n\tconstructor($el) {\n\t\t// $el is the widget node return by the loadFeatureBlock function\n\t\tthis.$el = $el;\n\t}\n\n\tinit() {\n\t\tthis.setFeatureBlock();\n\t}\n\n\tsetFeatureBlock() {\n\t\t// Add Some logic here\n\t\tthis.$element = $(this.$el);\n\n\t\tthis.initCompactView(this);\n\t\tthis.initFullWindowHeight(this);\n\t}\n\n\t// Add more functions like on above here\n}\n\nObject.assign(FeatureBlock.prototype, compactViewMixin);\nObject.assign(FeatureBlock.prototype, fullWindowHeightMixinBlock);\n","/* eslint-disable no-console */\n/* eslint-disable max-len */\nimport _ from 'lodash';\n\nexport let fullWindowHeightMixinBlock = {\n\tinitFullWindowHeight: (self) => {\n\t\tself.$element = self.$element || $(self.element);\n\n\t\tif (!_.isNil(self.$element.data('fullscreen')) && self.$element.data('fullscreen')) {\n\t\t\tlet setElementHeight = () => {\n\t\t\t\tlet $tplHeader = $('.siteHeader');\n\t\t\t\tlet headerHeight = 0;\n\n\t\t\t\tif ($tplHeader.length > 0) {\n\t\t\t\t\theaderHeight = $tplHeader.height();\n\t\t\t\t}\n\n\t\t\t\t// Slight delay\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tself.$element.css({\n\t\t\t\t\t\tminHeight: `${$(window).height() - headerHeight}px`,\n\t\t\t\t\t\tvisibility: 'visible',\n\t\t\t\t\t});\n\t\t\t\t}, 250);\n\t\t\t};\n\n\t\t\t$(window).resize(_.debounce(() => {\n\t\t\t\tsetElementHeight();\n\t\t\t}, 250));\n\n\t\t\tsetElementHeight();\n\t\t} else {\n\t\t\t// Slight delay\n\t\t\tsetTimeout(() => {\n\t\t\t\tself.$element.css({\n\t\t\t\t\tvisibility: 'visible',\n\t\t\t\t});\n\t\t\t}, 250);\n\t\t}\n\t},\n};\n\nexport let compactViewMixin = {\n\tinitCompactView: (self, classes) => {\n\t\tlet minimumHeight = 550; // 550px was the chosen number to have compact views\n\t\tself.$element = self.$element || $(self.element);\n\t\tself.$tplScroller = self.$tplScroller || $(document.body);\n\t\tclasses = classes || [];\n\n\t\tif (self.$tplScroller && self.$tplScroller.length > 0) {\n\t\t\tlet applyCompactView = () => {\n\t\t\t\tself.$element.attr('compact-view', 'true');\n\n\t\t\t\tif (classes.length > 0) {\n\t\t\t\t\tclasses.forEach((classItem) => {\n\t\t\t\t\t\tself.$element.find(classItem).attr('compact-view', true);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tlet unapplyCompactView = () => {\n\t\t\t\tself.$element.removeAttr('compact-view');\n\n\t\t\t\tif (classes.length > 0) {\n\t\t\t\t\tclasses.forEach((classItem) => {\n\t\t\t\t\t\tself.$element.find(classItem).removeAttr('compact-view');\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tlet isBlockExceedingHeight = () => {\n\t\t\t\treturn self.$tplScroller[0].clientHeight <= minimumHeight ||\n\t\t\t\t\t((self.$element.outerHeight() > minimumHeight) && self.$element.outerHeight() > self.$tplScroller[0].clientHeight);\n\t\t\t};\n\n\t\t\tlet toggleCompactViewAttribute = () => {\n\t\t\t\tif (isBlockExceedingHeight()) {\n\t\t\t\t\tapplyCompactView();\n\n\t\t\t\t\t// Re-render\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tif (isBlockExceedingHeight()) {\n\t\t\t\t\t\t\tapplyCompactView();\n\t\t\t\t\t\t}\n\t\t\t\t\t}, 500);\n\t\t\t\t} else {\n\t\t\t\t\tunapplyCompactView();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t$(window).resize(_.debounce(() => {\n\t\t\t\ttoggleCompactViewAttribute();\n\t\t\t}, 250));\n\n\t\t\ttoggleCompactViewAttribute();\n\t\t}\n\t},\n};\n\nexport let trackingItemsMixinBlock = {\n\tinitTrackingItems: (self, $items) => {\n\t\tself.$element = self.$element || $(self.element);\n\n\t\tlet trackingId = self.$element.data('trackingId');\n\t\tif (!_.isNil(trackingId) && trackingId !== '') {\n\t\t\tlet $tracker = $('[data-pg][data-tracker=\"true\"]');\n\n\t\t\tif (!($tracker && $tracker.length > 0)) {\n\t\t\t\tconsole.error('TrackingItemsMixinBlock::Error', 'Please ensure that the [data-pg][data-tracker=\"true\"] element exists');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!($items && $items.length > 0)) {\n\t\t\t\tconsole.error('TrackingItemsMixinBlock::Error', 'Please supply jQuery object for the list of clickable items');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t$items.each((index, element) => {\n\t\t\t\tlet $element = $(element);\n\t\t\t\t$element.attr('data-tracking-item-id', index);\n\t\t\t\t$element.attr('data-tracking-item-complete', false);\n\t\t\t});\n\n\t\t\tlet activeItems = [];\n\n\t\t\t$items.on('click', (event) => {\n\t\t\t\tlet $element = $(event.currentTarget);\n\t\t\t\tlet trackingItemId = $element.data('trackingItemId'); // TrackingItem of the item inside the block\n\n\t\t\t\t// If the item is active\n\t\t\t\tlet isFound = _.find(activeItems, (item) => {\n\t\t\t\t\treturn item === trackingItemId;\n\t\t\t\t});\n\t\t\t\tif (!isFound) {\n\t\t\t\t\tactiveItems.push(trackingItemId);\n\t\t\t\t\t$element.attr('data-tracking-item-complete', true); // Mark item as complete\n\n\t\t\t\t\tif ($items.length === activeItems.length) {\n\t\t\t\t\t\t$tracker.trigger('tracking.complete', {\n\t\t\t\t\t\t\t$element: self.$element,\n\t\t\t\t\t\t\ttrackingId: trackingId,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tself.$element.data('trackingComplete', true);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t},\n};\n"],"sourceRoot":""}