{"version":3,"sources":["webpack:///18.52f5a0f9.bundle.js","webpack:///./src/js/components/insights-events/PredictiveSearch.js","webpack:///./src/modules/templates/predictive-search-item-insights.html"],"names":["webpackJsonp","263","module","exports","__webpack_require__","$","_interopRequireDefault","obj","__esModule","default","_asyncToGenerator","fn","gen","apply","this","arguments","Promise","resolve","reject","step","key","arg","info","value","error","done","then","err","_classCallCheck","instance","Constructor","TypeError","_possibleConstructorReturn","self","call","ReferenceError","_inherits","subClass","superClass","prototype","Object","create","constructor","enumerable","writable","configurable","setPrototypeOf","__proto__","defineProperty","_createClass","defineProperties","target","props","i","length","descriptor","protoProps","staticProps","_component2","_component","_debounce3","_debounce2","_template3","_template2","_remove3","_remove2","_isEmpty3","_isEmpty2","_predictiveSearchItemInsights2","_predictiveSearchItemInsights","PredictiveSearch","el","config","_Component","dom","$body","$container","$el","$serchBox","find","$input","$predictiveResults","$searchBtn","$insightBtn","$eventsBtn","$results","$subtype","cssClasses","searchGroup","activeButton","url","dataset","insightUrl","predictiveUrl","predictiveInsightsEndpoint","currentRequest","currentSearchSelection","on","e","onInputUp","collapseSearch","bind","onSearch","onHeadingClick","changeOption","currentTarget","closest","TweenMax","to","height","ease","Expo","easeOut","onComplete","removeClass","keyword","contenttype","requestIndex","queryParms","window","location","search","indexOf","isforperson","addClass","ajax","data","beforeSend","abort","renderResults","_x","_ref","regeneratorRuntime","mark","_callee","items","noResults","noResultsString","wrap","_context","prev","next","all","getResults","INSIGHTS_SEARCH_GROUPS","EVENTS_SEARCH_GROUPS","n","trigger","forEach","item","predictiveTmpl","html","remove","TweenLite","set","from","easeInOut","stop","val","trim","destroyResults","which","catch","statusText","console","$target","hasClass","subtype","parentElement","predictiveSearchSubtype","redirect","href","classList","contains","eventUrl","searchText","eventText","attr","placeholder","predictiveEventsEndpoint","insightText","Component","616"],"mappings":"AAAAA,cAAc,KAERC,IACA,SAAUC,EAAQC,EAASC,GAEjC,cAC4B,SAASC,GAoCrC,QAASC,GAAuBC,GAAO,MA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AoB,MAIzDkL,IACA,SAAUpL,EAAQC,GE/SxBD,EAAOC,QAAU","file":"18.52f5a0f9.bundle.js","sourcesContent":["webpackJsonp([18],{\n\n/***/ 263:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function($) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _component = __webpack_require__(33);\n\nvar _component2 = _interopRequireDefault(_component);\n\nvar _debounce2 = __webpack_require__(206);\n\nvar _debounce3 = _interopRequireDefault(_debounce2);\n\nvar _template2 = __webpack_require__(91);\n\nvar _template3 = _interopRequireDefault(_template2);\n\nvar _remove2 = __webpack_require__(209);\n\nvar _remove3 = _interopRequireDefault(_remove2);\n\nvar _isEmpty2 = __webpack_require__(208);\n\nvar _isEmpty3 = _interopRequireDefault(_isEmpty2);\n\nvar _predictiveSearchItemInsights = __webpack_require__(616);\n\nvar _predictiveSearchItemInsights2 = _interopRequireDefault(_predictiveSearchItemInsights);\n\nvar _constants = __webpack_require__(92);\n\nvar _gsap = __webpack_require__(90);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step(\"next\", value); }, function (err) { step(\"throw\", err); }); } } return step(\"next\"); }); }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar PredictiveSearch = function (_Component) {\n _inherits(PredictiveSearch, _Component);\n\n function PredictiveSearch(el, config) {\n _classCallCheck(this, PredictiveSearch);\n\n return _possibleConstructorReturn(this, (PredictiveSearch.__proto__ || Object.getPrototypeOf(PredictiveSearch)).call(this, el, config));\n }\n\n _createClass(PredictiveSearch, [{\n key: 'setupDefaults',\n value: function setupDefaults() {\n this.dom = {\n $body: $('body'),\n $container: this.$el,\n $serchBox: this.$el.find('.wh-search-box'),\n $input: this.$el.find('.wh-search-box__field'),\n $predictiveResults: this.$el.find('.wh-predictive-search'),\n $searchBtn: this.$el.find('.wh-search-box__button'),\n $insightBtn: this.$el.find('.wh-insights-button-option'),\n $eventsBtn: this.$el.find('.wh-events-button-option'),\n $results: this.$el.find('.wh-predictive-search'),\n $subtype: this.$el.find('wh-predictive-search-group__title')\n };\n\n this.cssClasses = {\n searchGroup: 'wh-predictive-search-group',\n activeButton: 'wh-button-option--active'\n };\n\n this.url = this.dom.$insightBtn[0].dataset.insightUrl;\n this.predictiveUrl = this.config.predictiveInsightsEndpoint;\n this.currentRequest = [];\n this.currentSearchSelection = 'insights';\n }\n }, {\n key: 'addListeners',\n value: function addListeners() {\n var _this2 = this;\n\n this.dom.$input.on('keyup input', (0, _debounce3.default)(function (e) {\n _this2.onInputUp(e);\n }, 100));\n\n this.dom.$body.on('click touch', this.collapseSearch.bind(this));\n this.dom.$searchBtn.on('click touch', this.onSearch.bind(this));\n this.$el.on('click touch', '.wh-predictive-search-group__title', this.onHeadingClick.bind(this));\n this.dom.$insightBtn.on('click', this.changeOption.bind(this));\n this.dom.$eventsBtn.on('click', this.changeOption.bind(this));\n }\n }, {\n key: 'collapseSearch',\n value: function collapseSearch(e) {\n var _this3 = this;\n\n if (!$(e.currentTarget).closest(this.dom.$predictiveResults).length) {\n _gsap.TweenMax.to(this.dom.$predictiveResults, 0.5, {\n height: 0, ease: _gsap.Expo.easeOut, onComplete: function onComplete() {\n _this3.dom.$predictiveResults.removeClass('expanded');\n }\n });\n }\n }\n }, {\n key: 'getResults',\n value: function getResults(keyword, contenttype, requestIndex) {\n var _this4 = this;\n\n var queryParms = { keyword: keyword, contenttype: contenttype };\n if (window.location.search.indexOf('person=') !== -1 && window.location.search.indexOf('personname=') !== -1 && contenttype === 'insight') {\n queryParms = { keyword: keyword, contenttype: contenttype, isforperson: 1 };\n }\n this.dom.$serchBox.addClass('loading');\n\n return $.ajax({\n url: this.predictiveUrl,\n data: queryParms,\n beforeSend: function beforeSend() {\n if (_this4.currentRequest[requestIndex] && _this4.currentRequest[requestIndex] !== null) {\n _this4.currentRequest[requestIndex].abort();\n }\n }\n });\n }\n }, {\n key: 'renderResults',\n value: function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(value) {\n var data, items, noResults, noResultsString;\n return regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n\n //Search between insights or events\n data = void 0, items = '';\n\n if (!(this.currentSearchSelection === 'insights')) {\n _context.next = 7;\n break;\n }\n\n _context.next = 4;\n return Promise.all([this.currentRequest[0] = this.getResults(value, _constants.INSIGHTS_SEARCH_GROUPS[0], 0), this.currentRequest[1] = this.getResults(value, _constants.INSIGHTS_SEARCH_GROUPS[1], 1), this.currentRequest[2] = this.getResults(value, _constants.INSIGHTS_SEARCH_GROUPS[2], 2), this.currentRequest[3] = this.getResults(value, _constants.INSIGHTS_SEARCH_GROUPS[3], 3), this.currentRequest[4] = this.getResults(value, _constants.INSIGHTS_SEARCH_GROUPS[4], 4)]);\n\n case 4:\n data = _context.sent;\n _context.next = 10;\n break;\n\n case 7:\n _context.next = 9;\n return Promise.all([this.currentRequest[0] = this.getResults(value, _constants.EVENTS_SEARCH_GROUPS[0], 0), this.currentRequest[1] = this.getResults(value, _constants.EVENTS_SEARCH_GROUPS[1], 1), this.currentRequest[2] = this.getResults(value, _constants.EVENTS_SEARCH_GROUPS[2], 2)]);\n\n case 9:\n data = _context.sent;\n\n case 10:\n\n (0, _remove3.default)(data, function (n) {\n return (0, _isEmpty3.default)(n);\n });\n\n this.dom.$serchBox.removeClass('loading');\n\n this.$el.trigger('search:keyword', data);\n\n if (data.length > 0) {\n data.forEach(function (item) {\n items += (0, _template3.default)(_predictiveSearchItemInsights2.default)(item);\n });\n\n this.dom.$results.html(items);\n } else {\n noResults = this.dom.$results.data('no-results-txt');\n noResultsString = '
  • ' + noResults + '
  • ';\n\n\n this.dom.$results.find('li').remove();\n this.dom.$results.html(noResultsString);\n }\n\n this.dom.$results.removeClass('loading');\n this.dom.$results.addClass('expanded');\n _gsap.TweenLite.set(this.dom.$results, { height: 'auto', ease: _gsap.Expo.easeOut });\n _gsap.TweenLite.from(this.dom.$results, 0.4, { height: 0, ease: _gsap.Expo.easeInOut });\n\n case 18:\n case 'end':\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n\n function renderResults(_x) {\n return _ref.apply(this, arguments);\n }\n\n return renderResults;\n }()\n }, {\n key: 'destroyResults',\n value: function destroyResults() {\n var _this5 = this;\n\n _gsap.TweenLite.to(this.dom.$results, 0.5, { height: 0, ease: _gsap.Expo.easeOut, onComplete: function onComplete() {\n _this5.dom.$results.removeClass('expanded');\n _this5.dom.$results.find('li').remove();\n } });\n }\n }, {\n key: 'onInputUp',\n value: function onInputUp(e) {\n var value = this.dom.$input.val().trim();\n\n if (value.length < 2) {\n this.destroyResults();\n\n return;\n }\n\n if (e.which === 13) {\n this.destroyResults();\n this.onSearch();\n return;\n }\n\n this.renderResults(value).catch(function (err) {\n if (err.statusText !== 'abort') {\n console.error('There was an error getting your results', err);\n }\n });\n }\n }, {\n key: 'onHeadingClick',\n value: function onHeadingClick(e) {\n var $target = $(e.currentTarget);\n if ($target.hasClass('wh-predictive-search-group__title--false')) {\n return;\n }\n var subtype = $target[0].parentElement.dataset.predictiveSearchSubtype;\n var keyword = this.dom.$input.val().trim();\n var redirect = this.url + '?keyword=' + keyword + '&subtype=' + subtype;\n window.location.href = redirect;\n }\n }, {\n key: 'onSearch',\n value: function onSearch(e) {\n var keyword = this.dom.$input.val().trim();\n var redirect = this.url + '?keyword=' + keyword;\n window.location.href = redirect;\n }\n }, {\n key: 'changeOption',\n value: function changeOption(e) {\n if (!e.currentTarget.classList.contains(this.cssClasses.activeButton)) {\n this.destroyResults();\n if (this.dom.$insightBtn.hasClass(this.cssClasses.activeButton)) {\n this.dom.$eventsBtn.addClass(this.cssClasses.activeButton);\n this.dom.$insightBtn.removeClass(this.cssClasses.activeButton);\n this.url = this.dom.$eventsBtn[0].dataset.eventUrl;\n var searchText = this.dom.$eventsBtn[0].dataset.eventText;\n this.dom.$input.attr({ placeholder: searchText, 'aria-label': searchText });\n this.predictiveUrl = this.config.predictiveEventsEndpoint;\n this.currentSearchSelection = 'events';\n } else {\n this.dom.$insightBtn.addClass(this.cssClasses.activeButton);\n this.dom.$eventsBtn.removeClass(this.cssClasses.activeButton);\n this.url = this.dom.$insightBtn[0].dataset.insightUrl;\n var _searchText = this.dom.$insightBtn[0].dataset.insightText;\n this.dom.$input.attr({ placeholder: _searchText, 'aria-label': _searchText });\n this.predictiveUrl = this.config.predictiveInsightsEndpoint;\n this.currentSearchSelection = 'insights';\n }\n if (this.dom.$input.val().trim()) {\n this.renderResults(this.dom.$input.val().trim());\n }\n }\n }\n }]);\n\n return PredictiveSearch;\n}(_component2.default);\n\nexports.default = PredictiveSearch;\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10)))\n\n/***/ }),\n\n/***/ 616:\n/***/ (function(module, exports) {\n\nmodule.exports = \"
  • \\\" data-predictive-search-subtype=\\\"<%= Subtype %>\\\">

    \\\"> <%= GroupName %> <% if(ViewAll) { %> View All <% } %>

  • \";\n\n/***/ })\n\n});\n\n\n// WEBPACK FOOTER //\n// 18.52f5a0f9.bundle.js","import Component from 'component';\nimport _debounce from 'lodash/debounce';\nimport _template from 'lodash/template';\nimport _remove from 'lodash/remove';\nimport _isEmpty from 'lodash/isEmpty';\nimport predictiveTmpl from 'templates/predictive-search-item-insights';\nimport { EVENTS_SEARCH_GROUPS, INSIGHTS_SEARCH_GROUPS } from '../../constants';\nimport { Expo, TweenLite, TweenMax } from 'gsap';\n\nclass PredictiveSearch extends Component{\n constructor(el, config){\n super(el, config)\n }\n\n setupDefaults(){\n this.dom = {\n $body: $('body'),\n $container: this.$el,\n $serchBox: this.$el.find('.wh-search-box'),\n $input: this.$el.find('.wh-search-box__field'),\n $predictiveResults: this.$el.find('.wh-predictive-search'),\n $searchBtn: this.$el.find('.wh-search-box__button'),\n $insightBtn: this.$el.find('.wh-insights-button-option'),\n $eventsBtn: this.$el.find('.wh-events-button-option'),\n $results: this.$el.find('.wh-predictive-search'),\n $subtype: this.$el.find('wh-predictive-search-group__title')\n };\n\n this.cssClasses= {\n searchGroup: 'wh-predictive-search-group',\n activeButton: 'wh-button-option--active'\n }\n\n this.url = this.dom.$insightBtn[0].dataset.insightUrl;\n this.predictiveUrl = this.config.predictiveInsightsEndpoint;\n this.currentRequest = [];\n this.currentSearchSelection='insights';\n }\n\n addListeners(){\n this.dom.$input.on('keyup input', _debounce(e => {\n this.onInputUp(e);\n }, 100));\n\n this.dom.$body.on('click touch', this.collapseSearch.bind(this));\n this.dom.$searchBtn.on('click touch', ::this.onSearch);\n this.$el.on('click touch', '.wh-predictive-search-group__title', ::this.onHeadingClick);\n this.dom.$insightBtn.on('click', ::this.changeOption);\n this.dom.$eventsBtn.on('click', ::this.changeOption);\n }\n\n collapseSearch(e) {\n if (!$(e.currentTarget).closest(this.dom.$predictiveResults).length) {\n TweenMax.to(this.dom.$predictiveResults, 0.5, {\n height: 0, ease: Expo.easeOut, onComplete: () => {\n this.dom.$predictiveResults.removeClass('expanded');\n }\n });\n }\n }\n\n getResults(keyword, contenttype, requestIndex) {\n let queryParms= { keyword, contenttype }\n if (window.location.search.indexOf('person=') !== -1 && window.location.search.indexOf('personname=') !== -1 && contenttype==='insight'){\n queryParms= { keyword: keyword, contenttype: contenttype, isforperson: 1 }\n }\n this.dom.$serchBox.addClass('loading');\n\n return $.ajax({\n url: this.predictiveUrl,\n data: queryParms,\n beforeSend: () => {\n if (this.currentRequest[requestIndex] && this.currentRequest[requestIndex] !== null) {\n this.currentRequest[requestIndex].abort();\n }\n }\n });\n }\n\n async renderResults(value) {\n\n //Search between insights or events\n let data, items='';\n\n if (this.currentSearchSelection === 'insights'){\n data = await Promise.all([\n this.currentRequest[0] = this.getResults(value, INSIGHTS_SEARCH_GROUPS[0], 0),\n this.currentRequest[1] = this.getResults(value, INSIGHTS_SEARCH_GROUPS[1], 1),\n this.currentRequest[2] = this.getResults(value, INSIGHTS_SEARCH_GROUPS[2], 2),\n this.currentRequest[3] = this.getResults(value, INSIGHTS_SEARCH_GROUPS[3], 3),\n this.currentRequest[4] = this.getResults(value, INSIGHTS_SEARCH_GROUPS[4], 4)\n ]);\n } else {\n data = await Promise.all([\n this.currentRequest[0] = this.getResults(value, EVENTS_SEARCH_GROUPS[0], 0),\n this.currentRequest[1] = this.getResults(value, EVENTS_SEARCH_GROUPS[1], 1),\n this.currentRequest[2] = this.getResults(value, EVENTS_SEARCH_GROUPS[2], 2)\n ]);\n }\n\n\n _remove(data, n => _isEmpty(n));\n\n this.dom.$serchBox.removeClass('loading');\n\n this.$el.trigger('search:keyword', data);\n\n if (data.length > 0) {\n data.forEach(item => {\n items += _template(predictiveTmpl)(item);\n });\n\n this.dom.$results.html(items);\n } else {\n const noResults = this.dom.$results.data('no-results-txt');\n const noResultsString = '
  • ' + noResults + '
  • ';\n\n this.dom.$results.find('li').remove();\n this.dom.$results.html(noResultsString);\n }\n\n this.dom.$results.removeClass('loading');\n this.dom.$results.addClass('expanded');\n TweenLite.set(this.dom.$results, { height: 'auto', ease:Expo.easeOut });\n TweenLite.from(this.dom.$results, 0.4, { height: 0, ease:Expo.easeInOut });\n }\n\n destroyResults(){\n TweenLite.to(this.dom.$results, 0.5, { height: 0, ease:Expo.easeOut, onComplete: () => {\n this.dom.$results.removeClass('expanded');\n this.dom.$results.find('li').remove();\n } });\n }\n\n onInputUp(e) {\n const value = this.dom.$input.val().trim();\n\n if (value.length < 2){\n this.destroyResults();\n\n return;\n }\n\n if (e.which === 13) {\n this.destroyResults();\n this.onSearch();\n return;\n }\n\n this.renderResults(value)\n .catch(err => {\n if (err.statusText !== 'abort') {\n console.error('There was an error getting your results', err);\n }\n });\n }\n\n onHeadingClick(e) {\n const $target = $(e.currentTarget);\n if ($target.hasClass('wh-predictive-search-group__title--false')) {\n return;\n }\n const subtype = $target[0].parentElement.dataset.predictiveSearchSubtype;\n const keyword = this.dom.$input.val().trim();\n const redirect = `${this.url}?keyword=${keyword}&subtype=${subtype}`\n window.location.href = redirect;\n }\n\n onSearch(e){\n const keyword = this.dom.$input.val().trim();\n const redirect = `${this.url}?keyword=${keyword}`\n window.location.href = redirect;\n }\n\n changeOption(e) {\n if (!e.currentTarget.classList.contains(this.cssClasses.activeButton)) {\n this.destroyResults();\n if (this.dom.$insightBtn.hasClass(this.cssClasses.activeButton)){\n this.dom.$eventsBtn.addClass(this.cssClasses.activeButton)\n this.dom.$insightBtn.removeClass(this.cssClasses.activeButton)\n this.url = this.dom.$eventsBtn[0].dataset.eventUrl;\n const searchText = this.dom.$eventsBtn[0].dataset.eventText;\n this.dom.$input.attr({ placeholder: searchText, 'aria-label':searchText });\n this.predictiveUrl = this.config.predictiveEventsEndpoint;\n this.currentSearchSelection='events';\n } else {\n this.dom.$insightBtn.addClass(this.cssClasses.activeButton)\n this.dom.$eventsBtn.removeClass(this.cssClasses.activeButton)\n this.url = this.dom.$insightBtn[0].dataset.insightUrl;\n const searchText = this.dom.$insightBtn[0].dataset.insightText;\n this.dom.$input.attr({ placeholder: searchText, 'aria-label':searchText });\n this.predictiveUrl = this.config.predictiveInsightsEndpoint;\n this.currentSearchSelection='insights';\n }\n if (this.dom.$input.val().trim()){\n this.renderResults(this.dom.$input.val().trim());\n }\n }\n }\n}\n\nexport default PredictiveSearch;\n\n\n\n// WEBPACK FOOTER //\n// ./src/js/components/insights-events/PredictiveSearch.js","module.exports = \"
  • \\\" data-predictive-search-subtype=\\\"<%= Subtype %>\\\">

    \\\"> <%= GroupName %> <% if(ViewAll) { %> View All <% } %>

  • \";\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/modules/templates/predictive-search-item-insights.html\n// module id = 616\n// module chunks = 3 15 16 17 18"],"sourceRoot":""}