{"version":3,"sources":["Recommendation.min__ff92a1d47dbcec2611e1.js","./src/ui/ResponsiveComponents/ResponsiveComponentsUtils.ts","./src/ui/Recommendation/Recommendation.ts","./src/events/QuickviewEvents.ts","./src/ui/Templates/DefaultRecommendationTemplate.ts","./src/ui/ResponsiveComponents/ResponsiveRecommendation.ts","./src/ui/ResponsiveComponents/ResponsiveDropdown/RecommendationDropdownContent.ts","./src/ui/Recommendation/RecommendationQuery.ts"],"names":["webpackJsonpCoveo__temporary","130","module","exports","__webpack_require__","Object","defineProperty","value","shouldDrawFacetSlider","root","facetSliderElement","ResponsiveDropdownContent","isTargetInsideOpenedDropdown","this","isSmallFacetActivated","isSmallTabsActivated","hasClass","smallTabsClassName","smallFacetClassName","isSmallRecommendationActivated","smallRecommendationClassName","activateSmallTabs","addClass","deactivateSmallTabs","removeClass","activateSmallFacet","deactivateSmallFacet","activateSmallRecommendation","deactivateSmallRecommendation","ResponsiveComponentsUtils","200","__extends","extendStatics","setPrototypeOf","__proto__","Array","d","b","p","hasOwnProperty","__","constructor","prototype","create","element","options","analyticsOptions","_window","ComponentOptions","initComponentOptions","Recommendation","style","display","id","generateDefaultId","preventEventPropagation","mainSearchInterface","bindToMainSearchInterface","$$","on","QueryEvents","buildingQuery","e","args","handleRecommendationBuildingQuery","querySuccess","handleRecommendationQuerySuccess","noResults","handleRecommendationNoResults","queryError","handleRecommendationQueryError","ensureCurrentPageViewExistsInStore","ResponsiveRecommendation","init","_this","get","queryController","historyStore","enumerable","configurable","getId","enable","show","disable","hide","historyElement","name","document","location","toString","time","JSON","stringify","Date","title","_","escape","addElement","bindComponentOptionsModelToMainSearchInterface","bindQueryEventsToMainSearchInterface","searchInterfaceComponent","SearchInterface","alreadyInitialized","onceInitialized","mainSearchInterfaceOptionsModel","getBindings","componentOptionsModel","setMultiple","getAttributes","getEventName","MODEL_EVENTS","ALL","InitializationEvents","afterComponentsInitialization","mainInterfaceQuery","mainQuerySearchUID","results","searchUid","mainQueryPipeline","pipeline","length","usageAnalytics","logSearchEvent","analyticsActionCauseList","recommendation","executeQuery","closeModalBox","data","disabled","modifyQueryForRecommendation","addRecommendationInfoInQuery","hideIfNoResults","totalCount","Utils","copyObjectAttributes","queryBuilder","optionsToUse","isEmpty","userContext","addContext","preventEventPropagationOn","OmniboxEvents","ResultListEvents","SettingsEvents","PreferencesPanelEvents","AnalyticsEvents","BreadcrumbEvents","QuickviewEvents","getAllModelEvents","eventType","eventName","event","stopPropagation","events","queryStateModel","each","values","Model","eventTypes","QUERY_STATE_ATTRIBUTES","attribute","NEXT_ID","logger","warn","ID","doExport","exportGlobally","DefaultRecommendationTemplate","RecommendationQuery","RecommendationAnalyticsClient","buildSelectorOption","buildJsonOption","buildStringOption","buildListOption","defaultValue","sendActionsHistory","buildBooleanOption","deprecated","autoTriggerQuery","postProcessing","enableResponsiveMode","responsiveBreakpoint","buildNumberOption","dropdownHeaderLabel","buildLocalizedStringOption","localizedString","l","228","quickviewLoaded","openQuickview","471","_super","apply","arguments","instantiateToString","object","instantiateToElement","Promise","resolve","reject","div","createElement","innerHTML","Template","651","coveoRoot","responsiveDropdown","recommendationRoot","getRecommendationRoot","breakpoint","defineResponsiveBreakpoint","searchInterface","Component","el","dropdown","buildDropdown","registerOnOpenHandler","registerQueryEvents","handleResizeEvent","component","Logger","findParentRootOfRecommendationComponent","find","ResponsiveComponentsManager","register","extend","initializationEventRoot","info","parents","computeCssClassName","needSmallMode","changeToSmallMode","changeToLargeMode","isOpened","dropdownContent","positionDropdown","needDropdownWrapper","isWidthSmallerThanBreakpoint","width","responsiveComponents","getResponsiveMode","close","header","DROPDOWN_HEADER_WRAPPER_CSS_CLASS","append","dropdownHeader","disableFacetPreservePosition","Defer","defer","enableFacetPreservePosition","cleanUp","buildDropdownContent","buildDropdownHeader","ResponsiveDropdown","disablePopupBackground","dropdownHeaderElement","content","text","appendChild","ResponsiveDropdownHeader","dropdownContentElement","recommendationColumn","RecommendationDropdownContent","isNullOrUndefined","RESPONSIVE_BREAKPOINT","getFacetSliders","facetSliders","findAll","computeSelectorForType","forEach","facetSlider","push","getFacets","facets","facetElement","facet","preservePosition","drawFacetSliderGraphs","drawDelayedGraphData","recommendationInstance","handleRecommnendationQuerySucess","DROPDOWN_CONTAINER_CSS_CLASS_NAME","652","componentName","cssClassName","DEFAULT_CSS_CLASS_NAME","dropdownContentWrapper","prepend","window","getComputedStyle","maxHeight","OPENED_DROPDOWN_CSS_CLASS_NAME","hideDropdown","653","654","bindings","tagName","toLowerCase","decodeHTMLEntities","isUndefined","bind","onRootElement","handleBuildingQuery","advancedExpression","add","Initialization","registerAutoCreateComponent","655"],"mappings":"AAAAA,8BAA8B,KAExBC,IACA,SAAUC,EAAQC,EAASC,GAEjC,YAEAC,QAAOC,eAAeH,EAAS,cAAgBI,OAAO,GCNtD,aAEA,2BA4CA,MAvCS,GAAAC,sBAAP,SAA6BC,EAAWC,GACtC,MAAO,GAAAC,0BAA0BC,6BAA6BF,KAAwBG,KAAKC,sBAAsBL,IAG5G,EAAAM,qBAAP,SAA4BN,GAC1B,MAAOA,GAAKO,SAASH,KAAKI,qBAGrB,EAAAH,sBAAP,SAA6BL,GAC3B,MAAOA,GAAKO,SAASH,KAAKK,sBAGrB,EAAAC,+BAAP,SAAsCV,GACpC,MAAOA,GAAKO,SAASH,KAAKO,+BAGrB,EAAAC,kBAAP,SAAyBZ,GACvBA,EAAKa,SAAST,KAAKI,qBAGd,EAAAM,oBAAP,SAA2Bd,GACzBA,EAAKe,YAAYX,KAAKI,qBAGjB,EAAAQ,mBAAP,SAA0BhB,GACxBA,EAAKa,SAAST,KAAKK,sBAGd,EAAAQ,qBAAP,SAA4BjB,GAC1BA,EAAKe,YAAYX,KAAKK,sBAGjB,EAAAS,4BAAP,SAAmClB,GACjCA,EAAKa,SAAST,KAAKO,+BAGd,EAAAQ,8BAAP,SAAqCnB,GACnCA,EAAKe,YAAYX,KAAKO,+BAzCT,EAAAH,mBAA6B,mBAC7B,EAAAC,oBAA8B,qBAC9B,EA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file":"Recommendation.min__ff92a1d47dbcec2611e1.js","sourcesContent":["webpackJsonpCoveo__temporary([22],{\n\n/***/ 130:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar ResponsiveDropdownContent_1 = __webpack_require__(93);\nvar ResponsiveComponentsUtils = /** @class */ (function () {\n function ResponsiveComponentsUtils() {\n }\n ResponsiveComponentsUtils.shouldDrawFacetSlider = function (root, facetSliderElement) {\n return ResponsiveDropdownContent_1.ResponsiveDropdownContent.isTargetInsideOpenedDropdown(facetSliderElement) || !this.isSmallFacetActivated(root);\n };\n ResponsiveComponentsUtils.isSmallTabsActivated = function (root) {\n return root.hasClass(this.smallTabsClassName);\n };\n ResponsiveComponentsUtils.isSmallFacetActivated = function (root) {\n return root.hasClass(this.smallFacetClassName);\n };\n ResponsiveComponentsUtils.isSmallRecommendationActivated = function (root) {\n return root.hasClass(this.smallRecommendationClassName);\n };\n ResponsiveComponentsUtils.activateSmallTabs = function (root) {\n root.addClass(this.smallTabsClassName);\n };\n ResponsiveComponentsUtils.deactivateSmallTabs = function (root) {\n root.removeClass(this.smallTabsClassName);\n };\n ResponsiveComponentsUtils.activateSmallFacet = function (root) {\n root.addClass(this.smallFacetClassName);\n };\n ResponsiveComponentsUtils.deactivateSmallFacet = function (root) {\n root.removeClass(this.smallFacetClassName);\n };\n ResponsiveComponentsUtils.activateSmallRecommendation = function (root) {\n root.addClass(this.smallRecommendationClassName);\n };\n ResponsiveComponentsUtils.deactivateSmallRecommendation = function (root) {\n root.removeClass(this.smallRecommendationClassName);\n };\n ResponsiveComponentsUtils.smallTabsClassName = 'coveo-small-tabs';\n ResponsiveComponentsUtils.smallFacetClassName = 'coveo-small-facets';\n ResponsiveComponentsUtils.smallRecommendationClassName = 'coveo-small-recommendation';\n return ResponsiveComponentsUtils;\n}());\nexports.ResponsiveComponentsUtils = ResponsiveComponentsUtils;\n\n\n/***/ }),\n\n/***/ 200:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar SearchInterface_1 = __webpack_require__(19);\nvar ComponentOptions_1 = __webpack_require__(8);\nvar QueryEvents_1 = __webpack_require__(11);\nvar OmniboxEvents_1 = __webpack_require__(34);\nvar ResultListEvents_1 = __webpack_require__(29);\nvar SettingsEvents_1 = __webpack_require__(56);\nvar PreferencesPanelEvents_1 = __webpack_require__(100);\nvar AnalyticsEvents_1 = __webpack_require__(58);\nvar AnalyticsActionListMeta_1 = __webpack_require__(10);\nvar BreadcrumbEvents_1 = __webpack_require__(35);\nvar QuickviewEvents_1 = __webpack_require__(228);\nvar QueryStateModel_1 = __webpack_require__(13);\nvar Model_1 = __webpack_require__(18);\nvar Utils_1 = __webpack_require__(4);\nvar Dom_1 = __webpack_require__(1);\nvar ResponsiveRecommendation_1 = __webpack_require__(651);\nvar RegisteredNamedMethods_1 = __webpack_require__(30);\nvar InitializationEvents_1 = __webpack_require__(17);\nvar _ = __webpack_require__(0);\nvar GlobalExports_1 = __webpack_require__(3);\nvar DefaultRecommendationTemplate_1 = __webpack_require__(471);\nvar RecommendationQuery_1 = __webpack_require__(654);\nvar RecommendationAnalyticsClient_1 = __webpack_require__(210);\n__webpack_require__(655);\nvar Strings_1 = __webpack_require__(6);\n/**\n * The Recommendation component is a {@link SearchInterface} that displays recommendations typically based on user\n * history.\n *\n * This component usually listens to the main SearchInterface. When the main SearchInterface generates a query, the\n * Recommendation component generates another query to get the recommendations at the same time.\n *\n * To get history-based recommendations, you will likely want to include the `pageview` script in your page (see\n * [coveo.analytics.js](https://github.com/coveo/coveo.analytics.js)). However, including this script is not mandatory.\n * For instance, you could use the Recommendation component without the Coveo Machine Learning service to create a\n * simple \"recommended people\" interface.\n *\n * It is possible to include this component inside another SearchInterface, but it is also possible to instantiate it as\n * a \"standalone\" search interface, without even instantiating a main SearchInterface component. In any case, a\n * Recommendation component always acts as a full-fledged search interface. Therefore, you can include any component\n * inside the Recommendation component (Searchbox, Facet, Sort, etc.), just as you would inside the main SearchInterface\n * component.\n *\n * @availablesince [July 2016 Release (v1.667.24)](https://docs.coveo.com/en/309/#july-2016-release-v166724)\n */\nvar Recommendation = /** @class */ (function (_super) {\n __extends(Recommendation, _super);\n /**\n * Creates a new Recommendation component.\n * @param element The HTMLElement on which to instantiate the component.\n * @param options The options for the Recommendation component.\n * @param bindings The bindings that the component requires to function normally. If not set, these will be\n * automatically resolved (with a slower execution time)\n * @param _window\n */\n function Recommendation(element, options, analyticsOptions, _window) {\n if (options === void 0) { options = {}; }\n if (analyticsOptions === void 0) { analyticsOptions = {}; }\n if (_window === void 0) { _window = window; }\n var _this = _super.call(this, element, ComponentOptions_1.ComponentOptions.initComponentOptions(element, Recommendation, options), analyticsOptions, _window) || this;\n _this.element = element;\n _this.options = options;\n _this.analyticsOptions = analyticsOptions;\n _this.element.style.display = '';\n if (!_this.options.id) {\n _this.generateDefaultId();\n }\n // This is done to allow the component to be included in another search interface without triggering the parent events.\n _this.preventEventPropagation();\n if (_this.options.mainSearchInterface) {\n _this.bindToMainSearchInterface();\n }\n Dom_1.$$(_this.element).on(QueryEvents_1.QueryEvents.buildingQuery, function (e, args) {\n return _this.handleRecommendationBuildingQuery(args);\n });\n Dom_1.$$(_this.element).on(QueryEvents_1.QueryEvents.querySuccess, function (e, args) { return _this.handleRecommendationQuerySuccess(args); });\n Dom_1.$$(_this.element).on(QueryEvents_1.QueryEvents.noResults, function (e, args) { return _this.handleRecommendationNoResults(); });\n Dom_1.$$(_this.element).on(QueryEvents_1.QueryEvents.queryError, function (e, args) { return _this.handleRecommendationQueryError(); });\n if (!_this.options.mainSearchInterface) {\n // When the recommendation component is \"standalone\", we add additional safeguard against bad config.\n _this.ensureCurrentPageViewExistsInStore();\n }\n ResponsiveRecommendation_1.ResponsiveRecommendation.init(_this.root, _this, options);\n return _this;\n }\n Object.defineProperty(Recommendation.prototype, \"historyStore\", {\n get: function () {\n return this.queryController.historyStore;\n },\n enumerable: true,\n configurable: true\n });\n Recommendation.prototype.getId = function () {\n return this.options.id;\n };\n Recommendation.prototype.enable = function () {\n _super.prototype.enable.call(this);\n this.show();\n };\n Recommendation.prototype.disable = function () {\n _super.prototype.disable.call(this);\n this.hide();\n };\n Recommendation.prototype.hide = function () {\n Dom_1.$$(this.element).addClass('coveo-hidden');\n };\n Recommendation.prototype.show = function () {\n Dom_1.$$(this.element).removeClass('coveo-hidden');\n };\n Recommendation.prototype.ensureCurrentPageViewExistsInStore = function () {\n // It's not 100% sure that the element will actually be added in the store.\n // It's possible that an external script configured by the end user to log the page view already did that.\n // So we *could* end up with duplicate values in the store :\n // We rely on the fact that the coveo.analytics lib has defensive code against consecutive page view that are identical.\n // This is mainly done if the recommendation component is being initialized before the page view could be logged correctly by the coveo.analytics externa lib.\n var historyElement = {\n name: 'PageView',\n value: document.location.toString(),\n time: JSON.stringify(new Date()),\n title: _.escape(document.title)\n };\n this.historyStore.addElement(historyElement);\n };\n Recommendation.prototype.bindToMainSearchInterface = function () {\n this.bindComponentOptionsModelToMainSearchInterface();\n this.bindQueryEventsToMainSearchInterface();\n };\n Recommendation.prototype.bindComponentOptionsModelToMainSearchInterface = function () {\n var _this = this;\n // Try to fetch the componentOptions from the main search interface.\n // Since we do not know which interface is init first (recommendation or full search interface)\n // add a mechanism that waits for the full search interface to be correctly initialized\n // then, set the needed values on the component options model.\n var searchInterfaceComponent = RegisteredNamedMethods_1.get(this.options.mainSearchInterface, SearchInterface_1.SearchInterface);\n var alreadyInitialized = searchInterfaceComponent != null;\n var onceInitialized = function () {\n var mainSearchInterfaceOptionsModel = searchInterfaceComponent.getBindings().componentOptionsModel;\n _this.componentOptionsModel.setMultiple(mainSearchInterfaceOptionsModel.getAttributes());\n Dom_1.$$(_this.options.mainSearchInterface).on(_this.componentOptionsModel.getEventName(Model_1.MODEL_EVENTS.ALL), function () {\n _this.componentOptionsModel.setMultiple(mainSearchInterfaceOptionsModel.getAttributes());\n });\n };\n if (alreadyInitialized) {\n onceInitialized();\n }\n else {\n Dom_1.$$(this.options.mainSearchInterface).on(InitializationEvents_1.InitializationEvents.afterComponentsInitialization, function () {\n searchInterfaceComponent = RegisteredNamedMethods_1.get(_this.options.mainSearchInterface, SearchInterface_1.SearchInterface);\n onceInitialized();\n });\n }\n };\n Recommendation.prototype.bindQueryEventsToMainSearchInterface = function () {\n var _this = this;\n // Whenever a query sucessfully returns on the full search interface, refresh the recommendation component.\n Dom_1.$$(this.options.mainSearchInterface).on(QueryEvents_1.QueryEvents.querySuccess, function (e, args) {\n _this.mainInterfaceQuery = args;\n _this.mainQuerySearchUID = args.results.searchUid;\n _this.mainQueryPipeline = args.results.pipeline;\n if (args.results.results.length != 0) {\n _this.usageAnalytics.logSearchEvent(AnalyticsActionListMeta_1.analyticsActionCauseList.recommendation, {});\n _this.queryController.executeQuery({\n closeModalBox: false\n });\n }\n });\n Dom_1.$$(this.options.mainSearchInterface).on(QueryEvents_1.QueryEvents.queryError, function () { return _this.hide(); });\n Dom_1.$$(this.options.mainSearchInterface).on(QueryEvents_1.QueryEvents.noResults, function () { return _this.hide(); });\n };\n Recommendation.prototype.handleRecommendationBuildingQuery = function (data) {\n if (!this.disabled) {\n this.modifyQueryForRecommendation(data);\n this.addRecommendationInfoInQuery(data);\n }\n };\n Recommendation.prototype.handleRecommendationQuerySuccess = function (data) {\n if (!this.disabled) {\n if (this.options.hideIfNoResults) {\n if (data.results.totalCount === 0) {\n this.hide();\n }\n else {\n this.show();\n }\n }\n }\n };\n Recommendation.prototype.handleRecommendationNoResults = function () {\n if (!this.disabled) {\n if (this.options.hideIfNoResults) {\n this.hide();\n }\n }\n };\n Recommendation.prototype.handleRecommendationQueryError = function () {\n if (!this.disabled) {\n this.hide();\n }\n };\n Recommendation.prototype.modifyQueryForRecommendation = function (data) {\n if (this.mainInterfaceQuery) {\n Utils_1.Utils.copyObjectAttributes(data.queryBuilder, this.mainInterfaceQuery.queryBuilder, this.options.optionsToUse);\n }\n };\n Recommendation.prototype.addRecommendationInfoInQuery = function (data) {\n if (!_.isEmpty(this.options.userContext)) {\n data.queryBuilder.addContext(this.options.userContext);\n }\n data.queryBuilder.recommendation = this.options.id;\n };\n Recommendation.prototype.preventEventPropagation = function () {\n this.preventEventPropagationOn(QueryEvents_1.QueryEvents);\n this.preventEventPropagationOn(OmniboxEvents_1.OmniboxEvents);\n this.preventEventPropagationOn(ResultListEvents_1.ResultListEvents);\n this.preventEventPropagationOn(SettingsEvents_1.SettingsEvents);\n this.preventEventPropagationOn(PreferencesPanelEvents_1.PreferencesPanelEvents);\n this.preventEventPropagationOn(AnalyticsEvents_1.AnalyticsEvents);\n this.preventEventPropagationOn(BreadcrumbEvents_1.BreadcrumbEvents);\n this.preventEventPropagationOn(QuickviewEvents_1.QuickviewEvents);\n this.preventEventPropagationOn(InitializationEvents_1.InitializationEvents);\n this.preventEventPropagationOn(this.getAllModelEvents());\n };\n Recommendation.prototype.preventEventPropagationOn = function (eventType, eventName) {\n if (eventName === void 0) { eventName = function (event) {\n return event;\n }; }\n for (var event_1 in eventType) {\n Dom_1.$$(this.root).on(eventName(event_1), function (e) { return e.stopPropagation(); });\n }\n };\n Recommendation.prototype.getAllModelEvents = function () {\n var _this = this;\n var events = {};\n var queryStateModel = this.getBindings().queryStateModel;\n _.each(_.values(Model_1.Model.eventTypes), function (event) {\n var eventName = queryStateModel.getEventName(event);\n events[eventName] = eventName;\n _.each(_.values(QueryStateModel_1.QUERY_STATE_ATTRIBUTES), function (attribute) {\n var eventName = _this.queryStateModel.getEventName(event + attribute);\n events[eventName] = eventName;\n });\n });\n return events;\n };\n Recommendation.prototype.generateDefaultId = function () {\n var id = 'Recommendation';\n if (Recommendation.NEXT_ID !== 1) {\n this.logger.warn('Generating another recommendation default id', 'Consider configuring a human friendly / meaningful id for this interface');\n id = id + '_' + Recommendation.NEXT_ID;\n }\n Recommendation.NEXT_ID++;\n this.options.id = id;\n };\n Recommendation.ID = 'Recommendation';\n Recommendation.NEXT_ID = 1;\n Recommendation.doExport = function () {\n GlobalExports_1.exportGlobally({\n Recommendation: Recommendation,\n DefaultRecommendationTemplate: DefaultRecommendationTemplate_1.DefaultRecommendationTemplate,\n RecommendationQuery: RecommendationQuery_1.RecommendationQuery,\n RecommendationAnalyticsClient: RecommendationAnalyticsClient_1.RecommendationAnalyticsClient\n });\n };\n /**\n * The options for the recommendation component\n * @componentOptions\n */\n Recommendation.options = {\n /**\n * Specifies the main {@link SearchInterface} to listen to.\n */\n mainSearchInterface: ComponentOptions_1.ComponentOptions.buildSelectorOption(),\n /**\n * Specifies the user context to send to Coveo usage analytics.\n * The component sends this information with the query alongside the user history to get the recommendations.\n */\n userContext: ComponentOptions_1.ComponentOptions.buildJsonOption(),\n /**\n * Specifies the ID of the interface.\n * The usage analytics use the interface ID to know which recommendation interface was selected.\n *\n * Default value is `Recommendation` for the first one and `Recommendation_{number}`, where {number} depends on the\n * number of Recommendation interfaces with default IDs in the page for the others.\n */\n id: ComponentOptions_1.ComponentOptions.buildStringOption(),\n /**\n * Specifies which options from the main {@link QueryBuilder} to use in the triggered query.\n *\n * Possible values are:\n * - `expression`\n * - `advancedExpression`\n * - `constantExpression`\n * - `disjunctionExpression`\n *\n * **Example:**\n *\n * Adding the expression (`q`) and the advanced expression (`aq`) parts of the main query in the triggered query:\n *\n * `data-options-to-use=\"expression,advancedExpression\"`\n *\n * Default value is `expression`.\n */\n optionsToUse: ComponentOptions_1.ComponentOptions.buildListOption({\n defaultValue: ['expression']\n }),\n /**\n * Specifies whether to send the actions history along with the triggered query.\n *\n * Setting this option to `false` makes it impossible for this component to get Coveo Machine Learning\n * recommendations.\n *\n * However, setting this option to `false` can be useful to display side results in a search page.\n *\n * Default value is `true`.\n *\n * @deprecated This option is now deprecated. The correct way to control this behavior is to configure an appropriate machine learning model in the administration interface (Recommendation, Relevance tuning, Query suggestions).\n */\n sendActionsHistory: ComponentOptions_1.ComponentOptions.buildBooleanOption({\n defaultValue: true,\n deprecated: 'This option is now deprecated. The correct way to control this behaviour is to configure an appropriate machine learning model in the administration interface (Recommendation, Relevance tuning, Query suggestions)'\n }),\n /**\n * Specifies whether to hide the Recommendations component if no result or recommendation is available.\n *\n * Default value is `true`.\n */\n hideIfNoResults: ComponentOptions_1.ComponentOptions.buildBooleanOption({ defaultValue: true }),\n autoTriggerQuery: ComponentOptions_1.ComponentOptions.buildBooleanOption({\n postProcessing: function (value, options) {\n if (options.mainSearchInterface) {\n return false;\n }\n return value;\n }\n }),\n /**\n * Specifies whether to enable *responsive mode* for Recommendation components. Setting this options to `false` on\n * any Recommendation component in a search interface disables responsive mode for all other Recommendation\n * components in the search interface.\n *\n * Responsive mode displays all Recommendation components under a single dropdown button whenever the width of the\n * HTML element which the search interface is bound to reaches or falls behind a certain threshold (see\n * {@link Recommendation.options.responsiveBreakpoint}).\n *\n * See also {@link Recommendation.options.dropdownHeaderLabel}.\n *\n * Default value is `true`.\n */\n enableResponsiveMode: ComponentOptions_1.ComponentOptions.buildBooleanOption({ defaultValue: true }),\n /**\n * If {@link Recommendation.options.enableResponsiveMode} is `true` for all Recommendation components, specifies the\n * width threshold (in pixels) of the search interface at which Recommendation components go in responsive mode.\n *\n * Recommendation components go in responsive mode when the width of the search interface is equal to or lower than\n * this value.\n *\n * The `search interface` corresponds to the HTML element with the class `CoveoSearchInterface`.\n *\n * If more than one Recommendation component in the search interface specifies a value for this option, then the\n * framework uses the last occurrence of the option.\n *\n * Default value is `1000`.\n */\n responsiveBreakpoint: ComponentOptions_1.ComponentOptions.buildNumberOption({ defaultValue: 1000 }),\n /**\n * If {@link Recommendation.options.enableResponsiveMode} is `true` for all Recommendation components, specifies the\n * label of the dropdown button that allows to display the Recommendation components when in responsive mode.\n *\n * If more than one Recommendation component in the search interface specifies a value for this option, then the\n * framework uses the first occurrence of the option.\n *\n * Default value is `Recommendations`.\n */\n dropdownHeaderLabel: ComponentOptions_1.ComponentOptions.buildLocalizedStringOption({\n localizedString: function () { return Strings_1.l('Recommendations'); }\n })\n };\n return Recommendation;\n}(SearchInterface_1.SearchInterface));\nexports.Recommendation = Recommendation;\n// We do not register the Recommendation component since it is done with .coveo('initRecommendation')\n\n\n/***/ }),\n\n/***/ 228:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * The `QuickviewEvents` static class contains the string definitions of all events that strongly relate to the\n * [`Quickview`]{@link Quickview} component.\n */\nvar QuickviewEvents = /** @class */ (function () {\n function QuickviewEvents() {\n }\n /**\n * Triggered by the [`QuickviewDocument`]{@link QuickviewDocument} component when the content to display in the\n * quickview modal window has just finished downloading.\n *\n * The [`Quickview`]{@link Quickview} component listens to this event to know when to remove its loading animation.\n *\n * All `quickviewLoaded` event handlers receive a [`QuickviewLoadedEventArgs`]{@link IQuickviewLoadedEventArgs} object\n * as an argument.\n *\n * @type {string} The string value is `quickviewLoaded`.\n */\n QuickviewEvents.quickviewLoaded = 'quickviewLoaded';\n /**\n * Triggered by the [`QuickviewDocument`]{@link QuickviewDocument} component when the end user has just clicked the\n * **Quickview** button/link to open the quickview modal window.\n *\n * This event allows external code to modify the terms to highlight before the content of the quickview modal window\n * is rendered.\n *\n * All `openQuickview` event handlers receive an\n * [`OpenQuickviewEventArgs`]{@link ResultListEvents.IOpenQuickviewEventArgs} object as an argument.\n *\n * @type {string} The string value is `openQuickview`.\n */\n QuickviewEvents.openQuickview = 'openQuickview';\n return QuickviewEvents;\n}());\nexports.QuickviewEvents = QuickviewEvents;\n\n\n/***/ }),\n\n/***/ 471:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Template_1 = __webpack_require__(27);\nvar DefaultRecommendationTemplate = /** @class */ (function (_super) {\n __extends(DefaultRecommendationTemplate, _super);\n function DefaultRecommendationTemplate() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n DefaultRecommendationTemplate.prototype.instantiateToString = function (object) {\n var template = \"
\\n
\\n
\\n \\n \\n
\\n
\\n
\\n
\\n \\n \\n
\\n
\\n
\\n
\\n
\";\n return template;\n };\n DefaultRecommendationTemplate.prototype.instantiateToElement = function (object) {\n var _this = this;\n return new Promise(function (resolve, reject) {\n var div = document.createElement('div');\n div.innerHTML = _this.instantiateToString(object);\n resolve(div);\n });\n };\n return DefaultRecommendationTemplate;\n}(Template_1.Template));\nexports.DefaultRecommendationTemplate = DefaultRecommendationTemplate;\n\n\n/***/ }),\n\n/***/ 651:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar ResponsiveComponentsManager_1 = __webpack_require__(62);\nvar ResponsiveComponentsUtils_1 = __webpack_require__(130);\nvar SearchInterface_1 = __webpack_require__(19);\nvar Utils_1 = __webpack_require__(4);\nvar Dom_1 = __webpack_require__(1);\nvar Logger_1 = __webpack_require__(9);\nvar Recommendation_1 = __webpack_require__(200);\nvar RecommendationDropdownContent_1 = __webpack_require__(652);\nvar ResponsiveDropdownHeader_1 = __webpack_require__(135);\nvar ResponsiveDropdown_1 = __webpack_require__(123);\nvar Strings_1 = __webpack_require__(6);\nvar Component_1 = __webpack_require__(7);\nvar RegisteredNamedMethods_1 = __webpack_require__(30);\nvar QueryEvents_1 = __webpack_require__(11);\nvar _ = __webpack_require__(0);\n__webpack_require__(653);\nvar MiscModules_1 = __webpack_require__(67);\nvar ResponsiveRecommendation = /** @class */ (function () {\n function ResponsiveRecommendation(coveoRoot, ID, options, responsiveDropdown) {\n this.coveoRoot = coveoRoot;\n this.ID = ID;\n this.responsiveDropdown = responsiveDropdown;\n this.recommendationRoot = this.getRecommendationRoot();\n this.dropdownHeaderLabel = options.dropdownHeaderLabel;\n this.breakpoint = this.defineResponsiveBreakpoint(options);\n this.searchInterface = Component_1.Component.get(this.coveoRoot.el, SearchInterface_1.SearchInterface, false);\n this.dropdown = this.buildDropdown(responsiveDropdown);\n this.registerOnOpenHandler();\n this.registerQueryEvents();\n this.handleResizeEvent();\n }\n ResponsiveRecommendation.init = function (root, component, options) {\n var logger = new Logger_1.Logger('ResponsiveRecommendation');\n var coveoRoot = this.findParentRootOfRecommendationComponent(root);\n if (!coveoRoot) {\n logger.info('Recommendation component has no parent interface. Disabling responsive mode for this component.');\n return;\n }\n if (!Dom_1.$$(coveoRoot).find('.coveo-results-column')) {\n logger.info('Cannot find element with class coveo-results-column. Disabling responsive mode for this component.');\n return;\n }\n ResponsiveComponentsManager_1.ResponsiveComponentsManager.register(ResponsiveRecommendation, Dom_1.$$(coveoRoot), Recommendation_1.Recommendation.ID, component, _.extend({}, options, { initializationEventRoot: Dom_1.$$(root) }));\n };\n ResponsiveRecommendation.findParentRootOfRecommendationComponent = function (root) {\n var coveoRoot = Dom_1.$$(root).parents(Component_1.Component.computeCssClassName(SearchInterface_1.SearchInterface));\n if (coveoRoot[0]) {\n return Dom_1.$$(coveoRoot[0]);\n }\n return null;\n };\n ResponsiveRecommendation.prototype.handleResizeEvent = function () {\n if (this.needSmallMode() && !ResponsiveComponentsUtils_1.ResponsiveComponentsUtils.isSmallRecommendationActivated(this.coveoRoot)) {\n this.changeToSmallMode();\n }\n else if (!this.needSmallMode() && ResponsiveComponentsUtils_1.ResponsiveComponentsUtils.isSmallRecommendationActivated(this.coveoRoot)) {\n this.changeToLargeMode();\n }\n if (this.dropdown.isOpened) {\n this.dropdown.dropdownContent.positionDropdown();\n }\n };\n ResponsiveRecommendation.prototype.needDropdownWrapper = function () {\n return this.needSmallMode();\n };\n ResponsiveRecommendation.prototype.needSmallMode = function () {\n var isWidthSmallerThanBreakpoint = this.coveoRoot.width() <= this.breakpoint;\n if (!this.searchInterface) {\n return isWidthSmallerThanBreakpoint;\n }\n switch (this.searchInterface.responsiveComponents.getResponsiveMode()) {\n case 'small':\n return true;\n case 'auto':\n return isWidthSmallerThanBreakpoint;\n default:\n return false;\n }\n };\n ResponsiveRecommendation.prototype.changeToSmallMode = function () {\n var _this = this;\n this.dropdown.close();\n var header = this.coveoRoot.find(\".\" + ResponsiveComponentsManager_1.ResponsiveComponentsManager.DROPDOWN_HEADER_WRAPPER_CSS_CLASS);\n if (!header) {\n // It's possible that recommendation gets initialized before the main interface is completed.\n // We defer the resize event execution in that case.\n MiscModules_1.Defer.defer(function () { return _this.handleResizeEvent(); });\n }\n else {\n Dom_1.$$(header).append(this.dropdown.dropdownHeader.element.el);\n this.disableFacetPreservePosition();\n ResponsiveComponentsUtils_1.ResponsiveComponentsUtils.activateSmallRecommendation(this.coveoRoot);\n ResponsiveComponentsUtils_1.ResponsiveComponentsUtils.activateSmallRecommendation(this.recommendationRoot);\n }\n };\n ResponsiveRecommendation.prototype.changeToLargeMode = function () {\n this.enableFacetPreservePosition();\n this.dropdown.cleanUp();\n ResponsiveComponentsUtils_1.ResponsiveComponentsUtils.deactivateSmallRecommendation(this.coveoRoot);\n ResponsiveComponentsUtils_1.ResponsiveComponentsUtils.deactivateSmallRecommendation(this.recommendationRoot);\n };\n ResponsiveRecommendation.prototype.buildDropdown = function (responsiveDropdown) {\n var dropdownContent = this.buildDropdownContent();\n var dropdownHeader = this.buildDropdownHeader();\n var dropdown = responsiveDropdown ? responsiveDropdown : new ResponsiveDropdown_1.ResponsiveDropdown(dropdownContent, dropdownHeader, this.coveoRoot);\n dropdown.disablePopupBackground();\n return dropdown;\n };\n ResponsiveRecommendation.prototype.buildDropdownHeader = function () {\n var dropdownHeaderElement = Dom_1.$$('a');\n var content = Dom_1.$$('p');\n content.text(Strings_1.l(this.dropdownHeaderLabel));\n dropdownHeaderElement.el.appendChild(content.el);\n var dropdownHeader = new ResponsiveDropdownHeader_1.ResponsiveDropdownHeader('recommendation', dropdownHeaderElement);\n return dropdownHeader;\n };\n ResponsiveRecommendation.prototype.buildDropdownContent = function () {\n var dropdownContentElement;\n var recommendationColumn = this.coveoRoot.find('.coveo-recommendation-column');\n if (recommendationColumn) {\n dropdownContentElement = Dom_1.$$(recommendationColumn);\n }\n else {\n dropdownContentElement = Dom_1.$$(this.coveoRoot.find('.' + Component_1.Component.computeCssClassName(Recommendation_1.Recommendation)));\n }\n var dropdownContent = new RecommendationDropdownContent_1.RecommendationDropdownContent('recommendation', dropdownContentElement, this.coveoRoot);\n return dropdownContent;\n };\n ResponsiveRecommendation.prototype.defineResponsiveBreakpoint = function (options) {\n var breakpoint;\n if (Utils_1.Utils.isNullOrUndefined(options.responsiveBreakpoint)) {\n breakpoint = ResponsiveRecommendation.RESPONSIVE_BREAKPOINT;\n }\n else {\n breakpoint = options.responsiveBreakpoint;\n }\n return breakpoint;\n };\n ResponsiveRecommendation.prototype.getFacetSliders = function () {\n var facetSliders = [];\n this.coveoRoot.findAll(Component_1.Component.computeSelectorForType('FacetSlider')).forEach(function (facetSliderElement) {\n var facetSlider = Component_1.Component.get(facetSliderElement);\n facetSlider && facetSliders.push(facetSlider);\n });\n return facetSliders;\n };\n ResponsiveRecommendation.prototype.getFacets = function () {\n var facets = [];\n this.coveoRoot.findAll(Component_1.Component.computeSelectorForType('Facet')).forEach(function (facetElement) {\n var facet = Component_1.Component.get(facetElement);\n facet && facets.push(facet);\n });\n return facets;\n };\n ResponsiveRecommendation.prototype.enableFacetPreservePosition = function () {\n this.getFacets().forEach(function (facet) { return (facet.options.preservePosition = true); });\n };\n ResponsiveRecommendation.prototype.disableFacetPreservePosition = function () {\n this.getFacets().forEach(function (facet) { return (facet.options.preservePosition = false); });\n };\n ResponsiveRecommendation.prototype.drawFacetSliderGraphs = function () {\n this.getFacetSliders().forEach(function (facetSlider) { return facetSlider.drawDelayedGraphData(); });\n };\n ResponsiveRecommendation.prototype.registerOnOpenHandler = function () {\n this.dropdown.registerOnOpenHandler(this.drawFacetSliderGraphs, this);\n };\n ResponsiveRecommendation.prototype.getRecommendationRoot = function () {\n return Dom_1.$$(this.coveoRoot.find('.' + Component_1.Component.computeCssClassName(Recommendation_1.Recommendation)));\n };\n ResponsiveRecommendation.prototype.registerQueryEvents = function () {\n var _this = this;\n var recommendationInstance = RegisteredNamedMethods_1.get(this.recommendationRoot.el, SearchInterface_1.SearchInterface);\n if (recommendationInstance && recommendationInstance.options.hideIfNoResults) {\n this.coveoRoot.on(QueryEvents_1.QueryEvents.querySuccess, function (e, data) { return _this.handleRecommnendationQuerySucess(data); });\n this.coveoRoot.on(QueryEvents_1.QueryEvents.noResults, function (e, data) { return _this.handleRecommendationNoResults(); });\n }\n this.coveoRoot.on(QueryEvents_1.QueryEvents.queryError, function () { return _this.handleRecommendationQueryError(); });\n };\n ResponsiveRecommendation.prototype.handleRecommnendationQuerySucess = function (data) {\n if (data.results.totalCount === 0) {\n this.dropdown.close();\n this.dropdown.dropdownHeader.hide();\n }\n else {\n this.dropdown.dropdownHeader.show();\n }\n };\n ResponsiveRecommendation.prototype.handleRecommendationNoResults = function () {\n this.dropdown.close();\n this.dropdown.dropdownHeader.hide();\n };\n ResponsiveRecommendation.prototype.handleRecommendationQueryError = function () {\n this.dropdown.close();\n this.dropdown.dropdownHeader.hide();\n };\n ResponsiveRecommendation.DROPDOWN_CONTAINER_CSS_CLASS_NAME = 'coveo-recommendation-dropdown-container';\n ResponsiveRecommendation.RESPONSIVE_BREAKPOINT = 1000;\n return ResponsiveRecommendation;\n}());\nexports.ResponsiveRecommendation = ResponsiveRecommendation;\n\n\n/***/ }),\n\n/***/ 652:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar ResponsiveDropdownContent_1 = __webpack_require__(93);\nvar Dom_1 = __webpack_require__(1);\nvar RecommendationDropdownContent = /** @class */ (function () {\n function RecommendationDropdownContent(componentName, element, coveoRoot) {\n this.element = element;\n this.coveoRoot = coveoRoot;\n this.cssClassName = \"coveo-\" + componentName + \"-dropdown-content\";\n this.element.addClass(this.cssClassName);\n this.element.addClass(ResponsiveDropdownContent_1.ResponsiveDropdownContent.DEFAULT_CSS_CLASS_NAME);\n }\n RecommendationDropdownContent.prototype.positionDropdown = function () {\n this.element.el.style.display = '';\n var dropdownContentWrapper = this.coveoRoot.find('.coveo-results-column');\n Dom_1.$$(dropdownContentWrapper).prepend(this.element.el);\n this.element.addClass(ResponsiveDropdownContent_1.ResponsiveDropdownContent.DEFAULT_CSS_CLASS_NAME);\n this.element.addClass(this.cssClassName);\n // forces the browser to reflow the element, so that the transition is applied.\n window.getComputedStyle(this.element.el).maxHeight;\n this.element.addClass(RecommendationDropdownContent.OPENED_DROPDOWN_CSS_CLASS_NAME);\n };\n RecommendationDropdownContent.prototype.hideDropdown = function () {\n this.element.addClass(ResponsiveDropdownContent_1.ResponsiveDropdownContent.DEFAULT_CSS_CLASS_NAME);\n this.element.addClass(this.cssClassName);\n this.element.removeClass(RecommendationDropdownContent.OPENED_DROPDOWN_CSS_CLASS_NAME);\n };\n RecommendationDropdownContent.prototype.cleanUp = function () {\n this.element.removeClass(this.cssClassName);\n this.element.removeClass(ResponsiveDropdownContent_1.ResponsiveDropdownContent.DEFAULT_CSS_CLASS_NAME);\n };\n RecommendationDropdownContent.OPENED_DROPDOWN_CSS_CLASS_NAME = 'coveo-open-dropdown-content';\n return RecommendationDropdownContent;\n}());\nexports.RecommendationDropdownContent = RecommendationDropdownContent;\n\n\n/***/ }),\n\n/***/ 653:\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ }),\n\n/***/ 654:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Component_1 = __webpack_require__(7);\nvar ComponentOptions_1 = __webpack_require__(8);\nvar Utils_1 = __webpack_require__(4);\nvar QueryEvents_1 = __webpack_require__(11);\nvar Initialization_1 = __webpack_require__(2);\nvar Dom_1 = __webpack_require__(1);\nvar _ = __webpack_require__(0);\nvar RecommendationQuery = /** @class */ (function (_super) {\n __extends(RecommendationQuery, _super);\n function RecommendationQuery(element, options, bindings) {\n var _this = _super.call(this, element, RecommendationQuery.ID, bindings) || this;\n _this.element = element;\n _this.options = options;\n _this.options = ComponentOptions_1.ComponentOptions.initComponentOptions(element, RecommendationQuery, options);\n if (_this.element.tagName.toLowerCase() === 'script') {\n try {\n _this.content = Utils_1.Utils.decodeHTMLEntities(Dom_1.$$(_this.element).text());\n }\n catch (e) {\n return _this;\n }\n if (!_.isUndefined(_this.content) && _this.content != '') {\n _this.bind.onRootElement(QueryEvents_1.QueryEvents.buildingQuery, _this.handleBuildingQuery);\n }\n }\n return _this;\n }\n RecommendationQuery.prototype.handleBuildingQuery = function (data) {\n data.queryBuilder.advancedExpression.add(this.content);\n };\n RecommendationQuery.ID = 'RecommendationQuery';\n /**\n * The options for the RecommendationQuery component\n * @componentOptions\n */\n RecommendationQuery.options = {};\n return RecommendationQuery;\n}(Component_1.Component));\nexports.RecommendationQuery = RecommendationQuery;\nInitialization_1.Initialization.registerAutoCreateComponent(RecommendationQuery);\n\n\n/***/ }),\n\n/***/ 655:\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ })\n\n});\n\n\n// WEBPACK FOOTER //\n// Recommendation.min__ff92a1d47dbcec2611e1.js","import { Dom } from '../../utils/Dom';\nimport { ResponsiveDropdownContent } from './ResponsiveDropdown/ResponsiveDropdownContent';\n\nexport class ResponsiveComponentsUtils {\n private static smallTabsClassName: string = 'coveo-small-tabs';\n private static smallFacetClassName: string = 'coveo-small-facets';\n private static smallRecommendationClassName: string = 'coveo-small-recommendation';\n\n static shouldDrawFacetSlider(root: Dom, facetSliderElement: Dom): boolean {\n return ResponsiveDropdownContent.isTargetInsideOpenedDropdown(facetSliderElement) || !this.isSmallFacetActivated(root);\n }\n\n static isSmallTabsActivated(root: Dom): boolean {\n return root.hasClass(this.smallTabsClassName);\n }\n\n static isSmallFacetActivated(root: Dom): boolean {\n return root.hasClass(this.smallFacetClassName);\n }\n\n static isSmallRecommendationActivated(root: Dom): boolean {\n return root.hasClass(this.smallRecommendationClassName);\n }\n\n static activateSmallTabs(root: Dom): void {\n root.addClass(this.smallTabsClassName);\n }\n\n static deactivateSmallTabs(root: Dom): void {\n root.removeClass(this.smallTabsClassName);\n }\n\n static activateSmallFacet(root: Dom): void {\n root.addClass(this.smallFacetClassName);\n }\n\n static deactivateSmallFacet(root: Dom): void {\n root.removeClass(this.smallFacetClassName);\n }\n\n static activateSmallRecommendation(root: Dom): void {\n root.addClass(this.smallRecommendationClassName);\n }\n\n static deactivateSmallRecommendation(root: Dom): void {\n root.removeClass(this.smallRecommendationClassName);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/ResponsiveComponents/ResponsiveComponentsUtils.ts","import { SearchInterface, ISearchInterfaceOptions } from '../SearchInterface/SearchInterface';\nimport { ComponentOptions } from '../Base/ComponentOptions';\nimport { QueryEvents, IQuerySuccessEventArgs, IBuildingQueryEventArgs } from '../../events/QueryEvents';\nimport { OmniboxEvents } from '../../events/OmniboxEvents';\nimport { ResultListEvents } from '../../events/ResultListEvents';\nimport { SettingsEvents } from '../../events/SettingsEvents';\nimport { PreferencesPanelEvents } from '../../events/PreferencesPanelEvents';\nimport { AnalyticsEvents } from '../../events/AnalyticsEvents';\nimport { analyticsActionCauseList, IAnalyticsNoMeta } from '../Analytics/AnalyticsActionListMeta';\nimport { BreadcrumbEvents } from '../../events/BreadcrumbEvents';\nimport { QuickviewEvents } from '../../events/QuickviewEvents';\nimport { QUERY_STATE_ATTRIBUTES } from '../../models/QueryStateModel';\nimport { Model, MODEL_EVENTS } from '../../models/Model';\nimport { Utils } from '../../utils/Utils';\nimport { $$ } from '../../utils/Dom';\nimport { INoResultsEventArgs } from '../../events/QueryEvents';\nimport { IQueryErrorEventArgs } from '../../events/QueryEvents';\nimport { IComponentBindings } from '../Base/ComponentBindings';\nimport { ResponsiveRecommendation } from '../ResponsiveComponents/ResponsiveRecommendation';\nimport { get } from '../Base/RegisteredNamedMethods';\nimport { InitializationEvents } from '../../events/InitializationEvents';\nimport { ComponentOptionsModel } from '../../models/ComponentOptionsModel';\nimport * as _ from 'underscore';\nimport { exportGlobally } from '../../GlobalExports';\nimport { DefaultRecommendationTemplate } from '../Templates/DefaultRecommendationTemplate';\nimport { RecommendationQuery } from './RecommendationQuery';\nimport { RecommendationAnalyticsClient } from '../Analytics/RecommendationAnalyticsClient';\nimport 'styling/_Recommendation';\nimport { IStringMap } from '../../rest/GenericParam';\nimport { l } from '../../strings/Strings';\n\nexport interface IRecommendationOptions extends ISearchInterfaceOptions {\n mainSearchInterface?: HTMLElement;\n userContext?: IStringMap;\n id?: string;\n optionsToUse?: string[];\n sendActionsHistory?: boolean;\n hideIfNoResults?: boolean;\n enableResponsiveMode?: boolean;\n responsiveBreakpoint?: number;\n dropdownHeaderLabel?: string;\n}\n\n/**\n * The Recommendation component is a {@link SearchInterface} that displays recommendations typically based on user\n * history.\n *\n * This component usually listens to the main SearchInterface. When the main SearchInterface generates a query, the\n * Recommendation component generates another query to get the recommendations at the same time.\n *\n * To get history-based recommendations, you will likely want to include the `pageview` script in your page (see\n * [coveo.analytics.js](https://github.com/coveo/coveo.analytics.js)). However, including this script is not mandatory.\n * For instance, you could use the Recommendation component without the Coveo Machine Learning service to create a\n * simple \"recommended people\" interface.\n *\n * It is possible to include this component inside another SearchInterface, but it is also possible to instantiate it as\n * a \"standalone\" search interface, without even instantiating a main SearchInterface component. In any case, a\n * Recommendation component always acts as a full-fledged search interface. Therefore, you can include any component\n * inside the Recommendation component (Searchbox, Facet, Sort, etc.), just as you would inside the main SearchInterface\n * component.\n *\n * @availablesince [July 2016 Release (v1.667.24)](https://docs.coveo.com/en/309/#july-2016-release-v166724)\n */\nexport class Recommendation extends SearchInterface implements IComponentBindings {\n static ID = 'Recommendation';\n private static NEXT_ID = 1;\n\n static doExport = () => {\n exportGlobally({\n Recommendation: Recommendation,\n DefaultRecommendationTemplate: DefaultRecommendationTemplate,\n RecommendationQuery: RecommendationQuery,\n RecommendationAnalyticsClient: RecommendationAnalyticsClient\n });\n };\n\n /**\n * The options for the recommendation component\n * @componentOptions\n */\n static options: IRecommendationOptions = {\n /**\n * Specifies the main {@link SearchInterface} to listen to.\n */\n mainSearchInterface: ComponentOptions.buildSelectorOption(),\n\n /**\n * Specifies the user context to send to Coveo usage analytics.\n * The component sends this information with the query alongside the user history to get the recommendations.\n */\n userContext: ComponentOptions.buildJsonOption(),\n\n /**\n * Specifies the ID of the interface.\n * The usage analytics use the interface ID to know which recommendation interface was selected.\n *\n * Default value is `Recommendation` for the first one and `Recommendation_{number}`, where {number} depends on the\n * number of Recommendation interfaces with default IDs in the page for the others.\n */\n id: ComponentOptions.buildStringOption(),\n\n /**\n * Specifies which options from the main {@link QueryBuilder} to use in the triggered query.\n *\n * Possible values are:\n * - `expression`\n * - `advancedExpression`\n * - `constantExpression`\n * - `disjunctionExpression`\n *\n * **Example:**\n *\n * Adding the expression (`q`) and the advanced expression (`aq`) parts of the main query in the triggered query:\n *\n * `data-options-to-use=\"expression,advancedExpression\"`\n *\n * Default value is `expression`.\n */\n optionsToUse: ComponentOptions.buildListOption<'expression' | 'advancedExpression' | 'constantExpression' | 'disjunctionExpression'>({\n defaultValue: ['expression']\n }),\n\n /**\n * Specifies whether to send the actions history along with the triggered query.\n *\n * Setting this option to `false` makes it impossible for this component to get Coveo Machine Learning\n * recommendations.\n *\n * However, setting this option to `false` can be useful to display side results in a search page.\n *\n * Default value is `true`.\n *\n * @deprecated This option is now deprecated. The correct way to control this behavior is to configure an appropriate machine learning model in the administration interface (Recommendation, Relevance tuning, Query suggestions).\n */\n sendActionsHistory: ComponentOptions.buildBooleanOption({\n defaultValue: true,\n deprecated:\n 'This option is now deprecated. The correct way to control this behaviour is to configure an appropriate machine learning model in the administration interface (Recommendation, Relevance tuning, Query suggestions)'\n }),\n\n /**\n * Specifies whether to hide the Recommendations component if no result or recommendation is available.\n *\n * Default value is `true`.\n */\n hideIfNoResults: ComponentOptions.buildBooleanOption({ defaultValue: true }),\n autoTriggerQuery: ComponentOptions.buildBooleanOption({\n postProcessing: (value: boolean, options: IRecommendationOptions) => {\n if (options.mainSearchInterface) {\n return false;\n }\n return value;\n }\n }),\n\n /**\n * Specifies whether to enable *responsive mode* for Recommendation components. Setting this options to `false` on\n * any Recommendation component in a search interface disables responsive mode for all other Recommendation\n * components in the search interface.\n *\n * Responsive mode displays all Recommendation components under a single dropdown button whenever the width of the\n * HTML element which the search interface is bound to reaches or falls behind a certain threshold (see\n * {@link Recommendation.options.responsiveBreakpoint}).\n *\n * See also {@link Recommendation.options.dropdownHeaderLabel}.\n *\n * Default value is `true`.\n */\n enableResponsiveMode: ComponentOptions.buildBooleanOption({ defaultValue: true }),\n\n /**\n * If {@link Recommendation.options.enableResponsiveMode} is `true` for all Recommendation components, specifies the\n * width threshold (in pixels) of the search interface at which Recommendation components go in responsive mode.\n *\n * Recommendation components go in responsive mode when the width of the search interface is equal to or lower than\n * this value.\n *\n * The `search interface` corresponds to the HTML element with the class `CoveoSearchInterface`.\n *\n * If more than one Recommendation component in the search interface specifies a value for this option, then the\n * framework uses the last occurrence of the option.\n *\n * Default value is `1000`.\n */\n responsiveBreakpoint: ComponentOptions.buildNumberOption({ defaultValue: 1000 }),\n\n /**\n * If {@link Recommendation.options.enableResponsiveMode} is `true` for all Recommendation components, specifies the\n * label of the dropdown button that allows to display the Recommendation components when in responsive mode.\n *\n * If more than one Recommendation component in the search interface specifies a value for this option, then the\n * framework uses the first occurrence of the option.\n *\n * Default value is `Recommendations`.\n */\n dropdownHeaderLabel: ComponentOptions.buildLocalizedStringOption({\n localizedString: () => l('Recommendations')\n })\n };\n\n // These are used by the analytics client for recommendation\n // so that clicks event inside the recommendation component can be modified and attached to the main search interface.\n public mainQuerySearchUID: string;\n public mainQueryPipeline: string;\n\n private mainInterfaceQuery: IQuerySuccessEventArgs;\n\n /**\n * Creates a new Recommendation component.\n * @param element The HTMLElement on which to instantiate the component.\n * @param options The options for the Recommendation component.\n * @param bindings The bindings that the component requires to function normally. If not set, these will be\n * automatically resolved (with a slower execution time)\n * @param _window\n */\n constructor(public element: HTMLElement, public options: IRecommendationOptions = {}, public analyticsOptions = {}, _window = window) {\n super(element, ComponentOptions.initComponentOptions(element, Recommendation, options), analyticsOptions, _window);\n this.element.style.display = '';\n if (!this.options.id) {\n this.generateDefaultId();\n }\n\n // This is done to allow the component to be included in another search interface without triggering the parent events.\n this.preventEventPropagation();\n\n if (this.options.mainSearchInterface) {\n this.bindToMainSearchInterface();\n }\n\n $$(this.element).on(QueryEvents.buildingQuery, (e: Event, args: IBuildingQueryEventArgs) =>\n this.handleRecommendationBuildingQuery(args)\n );\n $$(this.element).on(QueryEvents.querySuccess, (e: Event, args: IQuerySuccessEventArgs) => this.handleRecommendationQuerySuccess(args));\n $$(this.element).on(QueryEvents.noResults, (e: Event, args: INoResultsEventArgs) => this.handleRecommendationNoResults());\n $$(this.element).on(QueryEvents.queryError, (e: Event, args: IQueryErrorEventArgs) => this.handleRecommendationQueryError());\n\n if (!this.options.mainSearchInterface) {\n // When the recommendation component is \"standalone\", we add additional safeguard against bad config.\n this.ensureCurrentPageViewExistsInStore();\n }\n ResponsiveRecommendation.init(this.root, this, options);\n }\n\n public get historyStore() {\n return this.queryController.historyStore;\n }\n\n public getId(): string {\n return this.options.id;\n }\n\n public enable() {\n super.enable();\n this.show();\n }\n\n public disable() {\n super.disable();\n this.hide();\n }\n\n public hide(): void {\n $$(this.element).addClass('coveo-hidden');\n }\n\n public show(): void {\n $$(this.element).removeClass('coveo-hidden');\n }\n\n private ensureCurrentPageViewExistsInStore() {\n // It's not 100% sure that the element will actually be added in the store.\n // It's possible that an external script configured by the end user to log the page view already did that.\n // So we *could* end up with duplicate values in the store :\n // We rely on the fact that the coveo.analytics lib has defensive code against consecutive page view that are identical.\n // This is mainly done if the recommendation component is being initialized before the page view could be logged correctly by the coveo.analytics externa lib.\n const historyElement = {\n name: 'PageView',\n value: document.location.toString(),\n time: JSON.stringify(new Date()),\n title: _.escape(document.title)\n };\n this.historyStore.addElement(historyElement);\n }\n\n private bindToMainSearchInterface() {\n this.bindComponentOptionsModelToMainSearchInterface();\n this.bindQueryEventsToMainSearchInterface();\n }\n\n private bindComponentOptionsModelToMainSearchInterface() {\n // Try to fetch the componentOptions from the main search interface.\n // Since we do not know which interface is init first (recommendation or full search interface)\n // add a mechanism that waits for the full search interface to be correctly initialized\n // then, set the needed values on the component options model.\n let searchInterfaceComponent = get(this.options.mainSearchInterface, SearchInterface);\n const alreadyInitialized = searchInterfaceComponent != null;\n\n const onceInitialized = () => {\n const mainSearchInterfaceOptionsModel = searchInterfaceComponent.getBindings().componentOptionsModel;\n this.componentOptionsModel.setMultiple(mainSearchInterfaceOptionsModel.getAttributes());\n $$(this.options.mainSearchInterface).on(this.componentOptionsModel.getEventName(MODEL_EVENTS.ALL), () => {\n this.componentOptionsModel.setMultiple(mainSearchInterfaceOptionsModel.getAttributes());\n });\n };\n\n if (alreadyInitialized) {\n onceInitialized();\n } else {\n $$(this.options.mainSearchInterface).on(InitializationEvents.afterComponentsInitialization, () => {\n searchInterfaceComponent = get(this.options.mainSearchInterface, SearchInterface);\n onceInitialized();\n });\n }\n }\n\n private bindQueryEventsToMainSearchInterface() {\n // Whenever a query sucessfully returns on the full search interface, refresh the recommendation component.\n $$(this.options.mainSearchInterface).on(QueryEvents.querySuccess, (e: Event, args: IQuerySuccessEventArgs) => {\n this.mainInterfaceQuery = args;\n this.mainQuerySearchUID = args.results.searchUid;\n this.mainQueryPipeline = args.results.pipeline;\n if (args.results.results.length != 0) {\n this.usageAnalytics.logSearchEvent(analyticsActionCauseList.recommendation, {});\n this.queryController.executeQuery({\n closeModalBox: false\n });\n }\n });\n\n $$(this.options.mainSearchInterface).on(QueryEvents.queryError, () => this.hide());\n $$(this.options.mainSearchInterface).on(QueryEvents.noResults, () => this.hide());\n }\n\n private handleRecommendationBuildingQuery(data: IBuildingQueryEventArgs) {\n if (!this.disabled) {\n this.modifyQueryForRecommendation(data);\n this.addRecommendationInfoInQuery(data);\n }\n }\n\n private handleRecommendationQuerySuccess(data: IQuerySuccessEventArgs) {\n if (!this.disabled) {\n if (this.options.hideIfNoResults) {\n if (data.results.totalCount === 0) {\n this.hide();\n } else {\n this.show();\n }\n }\n }\n }\n\n private handleRecommendationNoResults() {\n if (!this.disabled) {\n if (this.options.hideIfNoResults) {\n this.hide();\n }\n }\n }\n\n private handleRecommendationQueryError() {\n if (!this.disabled) {\n this.hide();\n }\n }\n\n private modifyQueryForRecommendation(data: IBuildingQueryEventArgs) {\n if (this.mainInterfaceQuery) {\n Utils.copyObjectAttributes(data.queryBuilder, this.mainInterfaceQuery.queryBuilder, this.options.optionsToUse);\n }\n }\n\n private addRecommendationInfoInQuery(data: IBuildingQueryEventArgs) {\n if (!_.isEmpty(this.options.userContext)) {\n data.queryBuilder.addContext(this.options.userContext);\n }\n\n data.queryBuilder.recommendation = this.options.id;\n }\n\n private preventEventPropagation() {\n this.preventEventPropagationOn(QueryEvents);\n this.preventEventPropagationOn(OmniboxEvents);\n this.preventEventPropagationOn(ResultListEvents);\n this.preventEventPropagationOn(SettingsEvents);\n this.preventEventPropagationOn(PreferencesPanelEvents);\n this.preventEventPropagationOn(AnalyticsEvents);\n this.preventEventPropagationOn(BreadcrumbEvents);\n this.preventEventPropagationOn(QuickviewEvents);\n this.preventEventPropagationOn(InitializationEvents);\n this.preventEventPropagationOn(this.getAllModelEvents());\n }\n\n private preventEventPropagationOn(\n eventType,\n eventName = (event: string) => {\n return event;\n }\n ) {\n for (const event in eventType) {\n $$(this.root).on(eventName(event), (e: Event) => e.stopPropagation());\n }\n }\n\n private getAllModelEvents() {\n const events = {};\n const queryStateModel = this.getBindings().queryStateModel;\n _.each(_.values(Model.eventTypes), event => {\n const eventName = queryStateModel.getEventName(event);\n events[eventName] = eventName;\n _.each(_.values(QUERY_STATE_ATTRIBUTES), attribute => {\n const eventName = this.queryStateModel.getEventName(event + attribute);\n events[eventName] = eventName;\n });\n });\n return events;\n }\n\n private generateDefaultId() {\n let id = 'Recommendation';\n if (Recommendation.NEXT_ID !== 1) {\n this.logger.warn(\n 'Generating another recommendation default id',\n 'Consider configuring a human friendly / meaningful id for this interface'\n );\n id = id + '_' + Recommendation.NEXT_ID;\n }\n Recommendation.NEXT_ID++;\n this.options.id = id;\n }\n}\n\n// We do not register the Recommendation component since it is done with .coveo('initRecommendation')\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/Recommendation/Recommendation.ts","/**\n * The `IQuickviewLoadedEventArgs` interface describes the object that all\n * [`quickviewLoaded`]{@link QuickviewEvents.quickviewLoaded} event handlers receive as an argument.\n */\nexport interface IQuickviewLoadedEventArgs {\n /**\n * The amount of time it took to download the content to display in the quickview modal window (in milliseconds).\n */\n duration: number;\n}\n\n/**\n * The `QuickviewEvents` static class contains the string definitions of all events that strongly relate to the\n * [`Quickview`]{@link Quickview} component.\n */\nexport class QuickviewEvents {\n /**\n * Triggered by the [`QuickviewDocument`]{@link QuickviewDocument} component when the content to display in the\n * quickview modal window has just finished downloading.\n *\n * The [`Quickview`]{@link Quickview} component listens to this event to know when to remove its loading animation.\n *\n * All `quickviewLoaded` event handlers receive a [`QuickviewLoadedEventArgs`]{@link IQuickviewLoadedEventArgs} object\n * as an argument.\n *\n * @type {string} The string value is `quickviewLoaded`.\n */\n public static quickviewLoaded = 'quickviewLoaded';\n\n /**\n * Triggered by the [`QuickviewDocument`]{@link QuickviewDocument} component when the end user has just clicked the\n * **Quickview** button/link to open the quickview modal window.\n *\n * This event allows external code to modify the terms to highlight before the content of the quickview modal window\n * is rendered.\n *\n * All `openQuickview` event handlers receive an\n * [`OpenQuickviewEventArgs`]{@link ResultListEvents.IOpenQuickviewEventArgs} object as an argument.\n *\n * @type {string} The string value is `openQuickview`.\n */\n public static openQuickview = 'openQuickview';\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/events/QuickviewEvents.ts","import { Template } from './Template';\nimport { IQueryResult } from '../../rest/QueryResult';\n\nexport class DefaultRecommendationTemplate extends Template {\n instantiateToString(object?: IQueryResult): string {\n var template = `
\n
\n
\n \n \n
\n
\n
\n
\n \n \n
\n
\n
\n
\n
`;\n return template;\n }\n\n instantiateToElement(object?: IQueryResult): Promise {\n return new Promise((resolve, reject) => {\n var div = document.createElement('div');\n div.innerHTML = this.instantiateToString(object);\n resolve(div);\n });\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/Templates/DefaultRecommendationTemplate.ts","import { ResponsiveComponentsManager, IResponsiveComponent, IResponsiveComponentOptions } from './ResponsiveComponentsManager';\nimport { ResponsiveComponentsUtils } from './ResponsiveComponentsUtils';\nimport { SearchInterface } from '../SearchInterface/SearchInterface';\nimport { Utils } from '../../utils/Utils';\nimport { $$, Dom } from '../../utils/Dom';\nimport { Logger } from '../../misc/Logger';\nimport { Recommendation } from '../Recommendation/Recommendation';\nimport { RecommendationDropdownContent } from './ResponsiveDropdown/RecommendationDropdownContent';\nimport { ResponsiveDropdownHeader } from './ResponsiveDropdown/ResponsiveDropdownHeader';\nimport { ResponsiveDropdown } from './ResponsiveDropdown/ResponsiveDropdown';\nimport { l } from '../../strings/Strings';\nimport { Component } from '../Base/Component';\nimport { get } from '../Base/RegisteredNamedMethods';\nimport { QueryEvents, IQuerySuccessEventArgs, INoResultsEventArgs } from '../../events/QueryEvents';\nimport * as _ from 'underscore';\n\nimport 'styling/_ResponsiveRecommendation';\nimport { Defer } from '../../MiscModules';\n\nexport class ResponsiveRecommendation implements IResponsiveComponent {\n public static DROPDOWN_CONTAINER_CSS_CLASS_NAME: string = 'coveo-recommendation-dropdown-container';\n public static RESPONSIVE_BREAKPOINT = 1000;\n\n public recommendationRoot: Dom;\n private breakpoint: number;\n private dropdown: ResponsiveDropdown;\n private dropdownHeaderLabel: string;\n private searchInterface: SearchInterface;\n\n public static init(root: HTMLElement, component, options: IResponsiveComponentOptions) {\n let logger = new Logger('ResponsiveRecommendation');\n let coveoRoot = this.findParentRootOfRecommendationComponent(root);\n if (!coveoRoot) {\n logger.info('Recommendation component has no parent interface. Disabling responsive mode for this component.');\n return;\n }\n\n if (!$$(coveoRoot).find('.coveo-results-column')) {\n logger.info('Cannot find element with class coveo-results-column. Disabling responsive mode for this component.');\n return;\n }\n\n ResponsiveComponentsManager.register(\n ResponsiveRecommendation,\n $$(coveoRoot),\n Recommendation.ID,\n component,\n _.extend({}, options, { initializationEventRoot: $$(root) })\n );\n }\n\n private static findParentRootOfRecommendationComponent(root: HTMLElement): Dom {\n let coveoRoot = $$(root).parents(Component.computeCssClassName(SearchInterface));\n if (coveoRoot[0]) {\n return $$(coveoRoot[0]);\n }\n return null;\n }\n\n constructor(\n public coveoRoot: Dom,\n public ID: string,\n options: IResponsiveComponentOptions,\n public responsiveDropdown?: ResponsiveDropdown\n ) {\n this.recommendationRoot = this.getRecommendationRoot();\n this.dropdownHeaderLabel = options.dropdownHeaderLabel;\n this.breakpoint = this.defineResponsiveBreakpoint(options);\n this.searchInterface = Component.get(this.coveoRoot.el, SearchInterface, false);\n this.dropdown = this.buildDropdown(responsiveDropdown);\n this.registerOnOpenHandler();\n this.registerQueryEvents();\n this.handleResizeEvent();\n }\n\n public handleResizeEvent(): void {\n if (this.needSmallMode() && !ResponsiveComponentsUtils.isSmallRecommendationActivated(this.coveoRoot)) {\n this.changeToSmallMode();\n } else if (!this.needSmallMode() && ResponsiveComponentsUtils.isSmallRecommendationActivated(this.coveoRoot)) {\n this.changeToLargeMode();\n }\n\n if (this.dropdown.isOpened) {\n this.dropdown.dropdownContent.positionDropdown();\n }\n }\n\n public needDropdownWrapper(): boolean {\n return this.needSmallMode();\n }\n\n private needSmallMode(): boolean {\n const isWidthSmallerThanBreakpoint = this.coveoRoot.width() <= this.breakpoint;\n if (!this.searchInterface) {\n return isWidthSmallerThanBreakpoint;\n }\n\n switch (this.searchInterface.responsiveComponents.getResponsiveMode()) {\n case 'small':\n return true;\n case 'auto':\n return isWidthSmallerThanBreakpoint;\n default:\n return false;\n }\n }\n\n private changeToSmallMode() {\n this.dropdown.close();\n const header = this.coveoRoot.find(`.${ResponsiveComponentsManager.DROPDOWN_HEADER_WRAPPER_CSS_CLASS}`);\n if (!header) {\n // It's possible that recommendation gets initialized before the main interface is completed.\n // We defer the resize event execution in that case.\n Defer.defer(() => this.handleResizeEvent());\n } else {\n $$(header).append(this.dropdown.dropdownHeader.element.el);\n this.disableFacetPreservePosition();\n ResponsiveComponentsUtils.activateSmallRecommendation(this.coveoRoot);\n ResponsiveComponentsUtils.activateSmallRecommendation(this.recommendationRoot);\n }\n }\n\n private changeToLargeMode() {\n this.enableFacetPreservePosition();\n this.dropdown.cleanUp();\n ResponsiveComponentsUtils.deactivateSmallRecommendation(this.coveoRoot);\n ResponsiveComponentsUtils.deactivateSmallRecommendation(this.recommendationRoot);\n }\n\n private buildDropdown(responsiveDropdown?: ResponsiveDropdown): ResponsiveDropdown {\n let dropdownContent = this.buildDropdownContent();\n let dropdownHeader = this.buildDropdownHeader();\n let dropdown = responsiveDropdown ? responsiveDropdown : new ResponsiveDropdown(dropdownContent, dropdownHeader, this.coveoRoot);\n dropdown.disablePopupBackground();\n return dropdown;\n }\n\n private buildDropdownHeader(): ResponsiveDropdownHeader {\n let dropdownHeaderElement = $$('a');\n let content = $$('p');\n content.text(l(this.dropdownHeaderLabel));\n dropdownHeaderElement.el.appendChild(content.el);\n let dropdownHeader = new ResponsiveDropdownHeader('recommendation', dropdownHeaderElement);\n return dropdownHeader;\n }\n\n private buildDropdownContent(): RecommendationDropdownContent {\n let dropdownContentElement: Dom;\n let recommendationColumn = this.coveoRoot.find('.coveo-recommendation-column');\n if (recommendationColumn) {\n dropdownContentElement = $$(recommendationColumn);\n } else {\n dropdownContentElement = $$(this.coveoRoot.find('.' + Component.computeCssClassName(Recommendation)));\n }\n\n let dropdownContent = new RecommendationDropdownContent('recommendation', dropdownContentElement, this.coveoRoot);\n return dropdownContent;\n }\n\n private defineResponsiveBreakpoint(options: IResponsiveComponentOptions): number {\n let breakpoint;\n if (Utils.isNullOrUndefined(options.responsiveBreakpoint)) {\n breakpoint = ResponsiveRecommendation.RESPONSIVE_BREAKPOINT;\n } else {\n breakpoint = options.responsiveBreakpoint;\n }\n return breakpoint;\n }\n\n private getFacetSliders(): any[] {\n const facetSliders = [];\n this.coveoRoot.findAll(Component.computeSelectorForType('FacetSlider')).forEach(facetSliderElement => {\n const facetSlider = Component.get(facetSliderElement);\n facetSlider && facetSliders.push(facetSlider);\n });\n return facetSliders;\n }\n\n private getFacets(): any[] {\n const facets = [];\n this.coveoRoot.findAll(Component.computeSelectorForType('Facet')).forEach(facetElement => {\n const facet = Component.get(facetElement);\n facet && facets.push(facet);\n });\n return facets;\n }\n\n private enableFacetPreservePosition(): void {\n this.getFacets().forEach(facet => (facet.options.preservePosition = true));\n }\n\n private disableFacetPreservePosition(): void {\n this.getFacets().forEach(facet => (facet.options.preservePosition = false));\n }\n\n private drawFacetSliderGraphs(): void {\n this.getFacetSliders().forEach(facetSlider => facetSlider.drawDelayedGraphData());\n }\n\n private registerOnOpenHandler(): void {\n this.dropdown.registerOnOpenHandler(this.drawFacetSliderGraphs, this);\n }\n\n private getRecommendationRoot(): Dom {\n return $$(this.coveoRoot.find('.' + Component.computeCssClassName(Recommendation)));\n }\n\n private registerQueryEvents() {\n let recommendationInstance = get(this.recommendationRoot.el, SearchInterface);\n if (recommendationInstance && recommendationInstance.options.hideIfNoResults) {\n this.coveoRoot.on(QueryEvents.querySuccess, (e: Event, data: IQuerySuccessEventArgs) => this.handleRecommnendationQuerySucess(data));\n this.coveoRoot.on(QueryEvents.noResults, (e: Event, data: INoResultsEventArgs) => this.handleRecommendationNoResults());\n }\n this.coveoRoot.on(QueryEvents.queryError, () => this.handleRecommendationQueryError());\n }\n\n private handleRecommnendationQuerySucess(data: IQuerySuccessEventArgs) {\n if (data.results.totalCount === 0) {\n this.dropdown.close();\n this.dropdown.dropdownHeader.hide();\n } else {\n this.dropdown.dropdownHeader.show();\n }\n }\n\n private handleRecommendationNoResults() {\n this.dropdown.close();\n this.dropdown.dropdownHeader.hide();\n }\n\n private handleRecommendationQueryError() {\n this.dropdown.close();\n this.dropdown.dropdownHeader.hide();\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/ResponsiveComponents/ResponsiveRecommendation.ts","import { IResponsiveDropdownContent, ResponsiveDropdownContent } from './ResponsiveDropdownContent';\nimport { $$, Dom } from '../../../utils/Dom';\n\nexport class RecommendationDropdownContent implements IResponsiveDropdownContent {\n public static OPENED_DROPDOWN_CSS_CLASS_NAME = 'coveo-open-dropdown-content';\n\n private cssClassName: string;\n\n constructor(componentName: string, public element: Dom, private coveoRoot: Dom) {\n this.cssClassName = `coveo-${componentName}-dropdown-content`;\n this.element.addClass(this.cssClassName);\n this.element.addClass(ResponsiveDropdownContent.DEFAULT_CSS_CLASS_NAME);\n }\n\n public positionDropdown() {\n this.element.el.style.display = '';\n\n let dropdownContentWrapper = this.coveoRoot.find('.coveo-results-column');\n $$(dropdownContentWrapper).prepend(this.element.el);\n this.element.addClass(ResponsiveDropdownContent.DEFAULT_CSS_CLASS_NAME);\n this.element.addClass(this.cssClassName);\n\n // forces the browser to reflow the element, so that the transition is applied.\n window.getComputedStyle(this.element.el).maxHeight;\n\n this.element.addClass(RecommendationDropdownContent.OPENED_DROPDOWN_CSS_CLASS_NAME);\n }\n\n public hideDropdown() {\n this.element.addClass(ResponsiveDropdownContent.DEFAULT_CSS_CLASS_NAME);\n this.element.addClass(this.cssClassName);\n\n this.element.removeClass(RecommendationDropdownContent.OPENED_DROPDOWN_CSS_CLASS_NAME);\n }\n\n public cleanUp() {\n this.element.removeClass(this.cssClassName);\n this.element.removeClass(ResponsiveDropdownContent.DEFAULT_CSS_CLASS_NAME);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/ResponsiveComponents/ResponsiveDropdown/RecommendationDropdownContent.ts","import { Component } from '../Base/Component';\nimport { ComponentOptions } from '../Base/ComponentOptions';\nimport { IComponentBindings } from '../Base/ComponentBindings';\nimport { Utils } from '../../utils/Utils';\nimport { QueryEvents, IBuildingQueryEventArgs } from '../../events/QueryEvents';\nimport { Initialization } from '../Base/Initialization';\nimport { $$ } from '../../utils/Dom';\nimport * as _ from 'underscore';\n\nexport interface IRecommendationQueryOptions {}\n\nexport class RecommendationQuery extends Component {\n static ID = 'RecommendationQuery';\n\n /**\n * The options for the RecommendationQuery component\n * @componentOptions\n */\n static options: IRecommendationQueryOptions = {};\n\n private content: string;\n\n constructor(public element: HTMLElement, public options?: IRecommendationQueryOptions, bindings?: IComponentBindings) {\n super(element, RecommendationQuery.ID, bindings);\n this.options = ComponentOptions.initComponentOptions(element, RecommendationQuery, options);\n\n if (this.element.tagName.toLowerCase() === 'script') {\n try {\n this.content = Utils.decodeHTMLEntities($$(this.element).text());\n } catch (e) {\n return;\n }\n if (!_.isUndefined(this.content) && this.content != '') {\n this.bind.onRootElement(QueryEvents.buildingQuery, this.handleBuildingQuery);\n }\n }\n }\n\n private handleBuildingQuery(data: IBuildingQueryEventArgs) {\n data.queryBuilder.advancedExpression.add(this.content);\n }\n}\n\nInitialization.registerAutoCreateComponent(RecommendationQuery);\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/Recommendation/RecommendationQuery.ts"],"sourceRoot":""}