{"version":3,"sources":["QuerySummary.min__ff92a1d47dbcec2611e1.js","./src/ui/QuerySummary/QuerySummary.ts","./src/events/QuerySummaryEvents.ts"],"names":["webpackJsonpCoveo__temporary","269","module","exports","__webpack_require__","__extends","this","extendStatics","Object","setPrototypeOf","__proto__","Array","d","b","p","hasOwnProperty","__","constructor","prototype","create","defineProperty","value","noResultsCssClass","element","options","bindings","QuerySummary","ID","ComponentOptions","initComponentOptions","bind","onRootElement","QueryEvents","querySuccess","data","handleQuerySuccess","queryError","hide","textContainer","$$","el","prepend","_this","addClass","show","removeClass","render","empty","updateNoResultsSnapshot","hideNoResultsPage","onlyDisplaySearchTips","updateSummaryIfResultsWereReceived","queryResults","results","exception","code","toLocaleString","innerHTML","l","length","updateQueryTagsInNoResultsContainer","displayInfoOnNoResults","lastKnownGoodState","queryStateModel","getAttributes","Assert","exists","message","QuerySummaryUtils","htmlMessage","root","noResultsContainer","getNoResultsContainer","noResultsSnapshot","replaceQueryTagsWithHighlightedQuery","template","highlightedQuery","sanitizedQuery","replaceQueryTags","get","escape","QueryStateModel","attributesEnum","q","enumerable","configurable","showNoResultsPage","enableNoResultsFoundMessage","noResultsFoundMessage","getNoResultsFoundMessageElement","appendChild","enableCancelLastAction","cancelLastAction","getCancelLastActionElement","enableSearchTips","searchTipsTitle","getSearchTipsTitleElement","searchTipsList","getSearchTipsListElement","getAllNoResultsContainer","forEach","find","findAll","trim","className","parsedNoResultsFoundMessage","AccessibleButton","withLabel","withElement","withSelectAction","usageAnalytics","logCustomEvent","analyticsActionCauseList","noResultsBack","logSearchEvent","reset","setMultiple","trigger","QuerySummaryEvents","queryController","executeQuery","history","back","build","searchTipsInfo","text","searchTips","checkSpelling","fewerKeywords","atLeastOneFacetIsActive","fewerFilter","doExport","exportGlobally","buildBooleanOption","defaultValue","buildLocalizedStringOption","localizedString","depend","postProcessing","Component","Initialization","registerAutoCreateComponent","519","641"],"mappings":"AAAAA,8BAA8B,KAExBC,IACA,SAAUC,EAAQC,EAASC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AAlE,iBAAiByG,oBAAqBC,cAAc,KAuN1E,GA9RkC,EAAAK,UAArB,GAAAjH,eA+Rb,EAAAkH,eAAeC,4BAA4BnH,ID3BrCoH,IACA,SAAU5I,EAAQC,EAASC,GAEjC,YAEAI,QAAOY,eAAejB,EAAS,cAAgBkB,OAAO,GEpStD,gCAQA,MADgB,GAAAuE,iBAAmB,mBACnC,IARa,GAAA0B,sBFyTPyB,IACA,SAAU7I,EAAQC","file":"QuerySummary.min__ff92a1d47dbcec2611e1.js","sourcesContent":["webpackJsonpCoveo__temporary([46],{\n\n/***/ 269:\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 });\n__webpack_require__(641);\nvar underscore_1 = __webpack_require__(0);\nvar QueryEvents_1 = __webpack_require__(11);\nvar QuerySummaryEvents_1 = __webpack_require__(519);\nvar GlobalExports_1 = __webpack_require__(3);\nvar Assert_1 = __webpack_require__(5);\nvar QueryStateModel_1 = __webpack_require__(13);\nvar Strings_1 = __webpack_require__(6);\nvar Dom_1 = __webpack_require__(1);\nvar QuerySummaryUtils_1 = __webpack_require__(206);\nvar AnalyticsActionListMeta_1 = __webpack_require__(10);\nvar Component_1 = __webpack_require__(7);\nvar ComponentOptions_1 = __webpack_require__(8);\nvar Initialization_1 = __webpack_require__(2);\nvar AccessibleButton_1 = __webpack_require__(15);\nexports.noResultsCssClass = 'coveo-show-if-no-results';\n/**\n * The QuerySummary component can display information about the currently displayed range of results (e.g., \"Results\n * 1-10 of 123\").\n *\n * When the query does not match any items, the QuerySummary component can instead display information to the end users.\n *\n * The information displayed to the end user is customizable through this component.\n */\nvar QuerySummary = /** @class */ (function (_super) {\n __extends(QuerySummary, _super);\n /**\n * Creates a new QuerySummary component.\n * @param element The HTMLElement on which to instantiate the component.\n * @param options The options for the QuerySummary 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 */\n function QuerySummary(element, options, bindings) {\n var _this = _super.call(this, element, QuerySummary.ID, bindings) || this;\n _this.element = element;\n _this.options = options;\n _this.options = ComponentOptions_1.ComponentOptions.initComponentOptions(element, QuerySummary, options);\n _this.bind.onRootElement(QueryEvents_1.QueryEvents.querySuccess, function (data) { return _this.handleQuerySuccess(data); });\n _this.bind.onRootElement(QueryEvents_1.QueryEvents.queryError, function () { return _this.hide(); });\n _this.hide();\n _this.textContainer = Dom_1.$$('span').el;\n Dom_1.$$(_this.element).prepend(_this.textContainer);\n return _this;\n }\n QuerySummary.prototype.hide = function () {\n Dom_1.$$(this.element).addClass('coveo-hidden');\n };\n QuerySummary.prototype.show = function () {\n Dom_1.$$(this.element).removeClass('coveo-hidden');\n };\n QuerySummary.prototype.render = function (data) {\n Dom_1.$$(this.textContainer).empty();\n this.show();\n this.updateNoResultsSnapshot();\n this.hideNoResultsPage();\n if (!this.options.onlyDisplaySearchTips) {\n this.updateSummaryIfResultsWereReceived(data);\n }\n var queryResults = data.results;\n if (queryResults.exception != null && queryResults.exception.code != null) {\n var code = ('QueryException' + queryResults.exception.code).toLocaleString();\n this.textContainer.innerHTML = Strings_1.l('QueryException', code);\n }\n else if (queryResults.results.length == 0) {\n this.updateQueryTagsInNoResultsContainer();\n this.displayInfoOnNoResults();\n }\n else {\n this.lastKnownGoodState = this.queryStateModel.getAttributes();\n }\n };\n QuerySummary.prototype.handleQuerySuccess = function (data) {\n Assert_1.Assert.exists(data);\n this.render(data);\n };\n QuerySummary.prototype.updateSummaryIfResultsWereReceived = function (data) {\n if (!data.results.results.length) {\n return;\n }\n var message = QuerySummaryUtils_1.QuerySummaryUtils.htmlMessage(this.root, data);\n this.textContainer.innerHTML = message;\n };\n QuerySummary.prototype.updateNoResultsSnapshot = function () {\n var noResultsContainer = this.getNoResultsContainer();\n if (this.noResultsSnapshot == null && noResultsContainer) {\n this.noResultsSnapshot = noResultsContainer.innerHTML;\n }\n };\n QuerySummary.prototype.updateQueryTagsInNoResultsContainer = function () {\n var noResultsContainer = this.getNoResultsContainer();\n if (noResultsContainer) {\n noResultsContainer.innerHTML = this.replaceQueryTagsWithHighlightedQuery(this.noResultsSnapshot);\n }\n };\n QuerySummary.prototype.replaceQueryTagsWithHighlightedQuery = function (template) {\n var highlightedQuery = \"\" + this.sanitizedQuery + \"\";\n return QuerySummaryUtils_1.QuerySummaryUtils.replaceQueryTags(template, highlightedQuery);\n };\n Object.defineProperty(QuerySummary.prototype, \"sanitizedQuery\", {\n get: function () {\n return underscore_1.escape(this.queryStateModel.get(QueryStateModel_1.QueryStateModel.attributesEnum.q));\n },\n enumerable: true,\n configurable: true\n });\n QuerySummary.prototype.displayInfoOnNoResults = function () {\n this.showNoResultsPage();\n if (this.options.enableNoResultsFoundMessage) {\n var noResultsFoundMessage = this.getNoResultsFoundMessageElement();\n this.textContainer.appendChild(noResultsFoundMessage.el);\n }\n if (this.options.enableCancelLastAction) {\n var cancelLastAction = this.getCancelLastActionElement();\n this.textContainer.appendChild(cancelLastAction.el);\n }\n if (this.options.enableSearchTips) {\n var searchTipsTitle = this.getSearchTipsTitleElement();\n var searchTipsList = this.getSearchTipsListElement();\n this.textContainer.appendChild(searchTipsTitle.el);\n this.textContainer.appendChild(searchTipsList.el);\n }\n };\n QuerySummary.prototype.hideNoResultsPage = function () {\n var noResultsContainers = this.getAllNoResultsContainer();\n noResultsContainers.forEach(function (noResultsContainer) {\n Dom_1.$$(noResultsContainer).removeClass('coveo-no-results');\n });\n };\n QuerySummary.prototype.showNoResultsPage = function () {\n var noResultsContainers = this.getAllNoResultsContainer();\n noResultsContainers.forEach(function (noResultsContainer) {\n Dom_1.$$(noResultsContainer).addClass('coveo-no-results');\n });\n };\n QuerySummary.prototype.getNoResultsContainer = function () {\n return Dom_1.$$(this.element).find(\".\" + exports.noResultsCssClass);\n };\n QuerySummary.prototype.getAllNoResultsContainer = function () {\n return Dom_1.$$(this.element).findAll(\".\" + exports.noResultsCssClass);\n };\n Object.defineProperty(QuerySummary.prototype, \"parsedNoResultsFoundMessage\", {\n get: function () {\n if (this.sanitizedQuery.trim() === '') {\n return Strings_1.l('noResult');\n }\n return this.replaceQueryTagsWithHighlightedQuery(this.options.noResultsFoundMessage);\n },\n enumerable: true,\n configurable: true\n });\n QuerySummary.prototype.getNoResultsFoundMessageElement = function () {\n var noResultsFoundMessage = Dom_1.$$('div', {\n className: 'coveo-query-summary-no-results-string'\n }, this.parsedNoResultsFoundMessage);\n return noResultsFoundMessage;\n };\n QuerySummary.prototype.getCancelLastActionElement = function () {\n var _this = this;\n var cancelLastAction = Dom_1.$$('div', {\n className: 'coveo-query-summary-cancel-last'\n }, Strings_1.l('CancelLastAction'));\n new AccessibleButton_1.AccessibleButton()\n .withLabel(Strings_1.l('CancelLastAction'))\n .withElement(cancelLastAction)\n .withSelectAction(function () {\n _this.usageAnalytics.logCustomEvent(AnalyticsActionListMeta_1.analyticsActionCauseList.noResultsBack, {}, _this.root);\n _this.usageAnalytics.logSearchEvent(AnalyticsActionListMeta_1.analyticsActionCauseList.noResultsBack, {});\n if (_this.lastKnownGoodState) {\n _this.queryStateModel.reset();\n _this.queryStateModel.setMultiple(_this.lastKnownGoodState);\n Dom_1.$$(_this.root).trigger(QuerySummaryEvents_1.QuerySummaryEvents.cancelLastAction);\n _this.queryController.executeQuery();\n }\n else {\n history.back();\n }\n })\n .build();\n return cancelLastAction;\n };\n QuerySummary.prototype.getSearchTipsTitleElement = function () {\n var searchTipsInfo = Dom_1.$$('div', {\n className: 'coveo-query-summary-search-tips-info'\n });\n searchTipsInfo.text(Strings_1.l('SearchTips'));\n return searchTipsInfo;\n };\n QuerySummary.prototype.getSearchTipsListElement = function () {\n var searchTips = Dom_1.$$('ul');\n var checkSpelling = Dom_1.$$('li');\n checkSpelling.text(Strings_1.l('CheckSpelling'));\n var fewerKeywords = Dom_1.$$('li');\n fewerKeywords.text(Strings_1.l('TryUsingFewerKeywords'));\n searchTips.el.appendChild(checkSpelling.el);\n searchTips.el.appendChild(fewerKeywords.el);\n if (this.queryStateModel.atLeastOneFacetIsActive()) {\n var fewerFilter = Dom_1.$$('li');\n fewerFilter.text(Strings_1.l('SelectFewerFilters'));\n searchTips.el.appendChild(fewerFilter.el);\n }\n return searchTips;\n };\n QuerySummary.ID = 'QuerySummary';\n QuerySummary.doExport = function () {\n GlobalExports_1.exportGlobally({\n QuerySummary: QuerySummary\n });\n };\n /**\n * Options for the component\n * @componentOptions\n */\n QuerySummary.options = {\n /**\n * Specifies whether to hide the number of returned results.\n *\n * When this option is set to true, the number of returned results will be hidden from the page, meaning that your end users will not know how many results were returned for their query.\n *\n * Default value is `false`.\n */\n onlyDisplaySearchTips: ComponentOptions_1.ComponentOptions.buildBooleanOption({ defaultValue: false }),\n /**\n * Specifies whether to display the {@link QuerySummary.options.noResultsFoundMessage} message when there are no search results.\n *\n * Default value is `true`.\n *\n * @availablesince [August 2018 Release (v2.4609.6)](https://docs.coveo.com/410/#august-2018-release-v246096)\n */\n enableNoResultsFoundMessage: ComponentOptions_1.ComponentOptions.buildBooleanOption({ defaultValue: true }),\n /**\n * Specifies a custom message to display when there are no search results.\n *\n * You can refer to the query the end user has entered using the `${query}` query tag.\n *\n * **Example**\n * > For the `noResultFoundMessage` option, you enter `There were no results found for \"${query}\"`.\n * > Your end user searches for `query without results`, which does not return any result.\n * > On your page, they see this message: `There were no results found for \"query without results\"`.\n *\n * Default value is `No results for ${query}`.\n *\n * **Note**\n * > If there is no query, the value will fallback to `No results`.\n *\n * @availablesince [August 2018 Release (v2.4609.6)](https://docs.coveo.com/410/#august-2018-release-v246096)\n */\n noResultsFoundMessage: ComponentOptions_1.ComponentOptions.buildLocalizedStringOption({\n localizedString: function () { return Strings_1.l('noResultFor', '${query}'); },\n depend: 'enableNoResultsFoundMessage',\n postProcessing: function (value) {\n return underscore_1.escape(value);\n }\n }),\n /**\n * Specifies whether to display the `Cancel last action` link when there are no search results.\n *\n * When clicked, the link restores the previous query that contained results.\n *\n * Default value is `true`.\n */\n enableCancelLastAction: ComponentOptions_1.ComponentOptions.buildBooleanOption({ defaultValue: true }),\n /**\n * Specifies whether to display search tips when there are no search results.\n *\n * Default value is `true`.\n */\n enableSearchTips: ComponentOptions_1.ComponentOptions.buildBooleanOption({ defaultValue: true })\n };\n return QuerySummary;\n}(Component_1.Component));\nexports.QuerySummary = QuerySummary;\nInitialization_1.Initialization.registerAutoCreateComponent(QuerySummary);\n\n\n/***/ }),\n\n/***/ 519:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * This static class is there to contains the different string definition for all the events related to the {@link AdvancedSearch} component.\n */\nvar QuerySummaryEvents = /** @class */ (function () {\n function QuerySummaryEvents() {\n }\n /**\n * Triggered when the last action is being cancelled by the query summary component\n *\n * Allows external code to revert their last action.\n * @type {string}\n */\n QuerySummaryEvents.cancelLastAction = 'cancelLastAction';\n return QuerySummaryEvents;\n}());\nexports.QuerySummaryEvents = QuerySummaryEvents;\n\n\n/***/ }),\n\n/***/ 641:\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ })\n\n});\n\n\n// WEBPACK FOOTER //\n// QuerySummary.min__ff92a1d47dbcec2611e1.js","import 'styling/_QuerySummary';\nimport { escape } from 'underscore';\nimport { IQuerySuccessEventArgs, QueryEvents } from '../../events/QueryEvents';\nimport { QuerySummaryEvents } from '../../events/QuerySummaryEvents';\nimport { exportGlobally } from '../../GlobalExports';\nimport { Assert } from '../../misc/Assert';\nimport { QueryStateModel } from '../../models/QueryStateModel';\nimport { l } from '../../strings/Strings';\nimport { $$ } from '../../utils/Dom';\nimport { QuerySummaryUtils } from '../../utils/QuerySummaryUtils';\nimport { analyticsActionCauseList, IAnalyticsNoMeta } from '../Analytics/AnalyticsActionListMeta';\nimport { Component } from '../Base/Component';\nimport { IComponentBindings } from '../Base/ComponentBindings';\nimport { ComponentOptions } from '../Base/ComponentOptions';\nimport { Initialization } from '../Base/Initialization';\nimport { AccessibleButton } from '../../utils/AccessibleButton';\n\nexport interface IQuerySummaryOptions {\n onlyDisplaySearchTips?: boolean;\n enableNoResultsFoundMessage?: boolean;\n noResultsFoundMessage?: string;\n enableCancelLastAction?: boolean;\n enableSearchTips?: boolean;\n}\n\nexport const noResultsCssClass: string = 'coveo-show-if-no-results';\n\n/**\n * The QuerySummary component can display information about the currently displayed range of results (e.g., \"Results\n * 1-10 of 123\").\n *\n * When the query does not match any items, the QuerySummary component can instead display information to the end users.\n *\n * The information displayed to the end user is customizable through this component.\n */\nexport class QuerySummary extends Component {\n static ID = 'QuerySummary';\n\n static doExport = () => {\n exportGlobally({\n QuerySummary: QuerySummary\n });\n };\n\n /**\n * Options for the component\n * @componentOptions\n */\n static options: IQuerySummaryOptions = {\n /**\n * Specifies whether to hide the number of returned results.\n *\n * When this option is set to true, the number of returned results will be hidden from the page, meaning that your end users will not know how many results were returned for their query.\n *\n * Default value is `false`.\n */\n onlyDisplaySearchTips: ComponentOptions.buildBooleanOption({ defaultValue: false }),\n\n /**\n * Specifies whether to display the {@link QuerySummary.options.noResultsFoundMessage} message when there are no search results.\n *\n * Default value is `true`.\n *\n * @availablesince [August 2018 Release (v2.4609.6)](https://docs.coveo.com/410/#august-2018-release-v246096)\n */\n enableNoResultsFoundMessage: ComponentOptions.buildBooleanOption({ defaultValue: true }),\n\n /**\n * Specifies a custom message to display when there are no search results.\n *\n * You can refer to the query the end user has entered using the `${query}` query tag.\n *\n * **Example**\n * > For the `noResultFoundMessage` option, you enter `There were no results found for \"${query}\"`.\n * > Your end user searches for `query without results`, which does not return any result.\n * > On your page, they see this message: `There were no results found for \"query without results\"`.\n *\n * Default value is `No results for ${query}`.\n *\n * **Note**\n * > If there is no query, the value will fallback to `No results`.\n *\n * @availablesince [August 2018 Release (v2.4609.6)](https://docs.coveo.com/410/#august-2018-release-v246096)\n */\n noResultsFoundMessage: ComponentOptions.buildLocalizedStringOption({\n localizedString: () => l('noResultFor', '${query}'),\n depend: 'enableNoResultsFoundMessage',\n postProcessing: (value: string) => {\n return escape(value);\n }\n }),\n\n /**\n * Specifies whether to display the `Cancel last action` link when there are no search results.\n *\n * When clicked, the link restores the previous query that contained results.\n *\n * Default value is `true`.\n */\n enableCancelLastAction: ComponentOptions.buildBooleanOption({ defaultValue: true }),\n\n /**\n * Specifies whether to display search tips when there are no search results.\n *\n * Default value is `true`.\n */\n enableSearchTips: ComponentOptions.buildBooleanOption({ defaultValue: true })\n };\n\n private textContainer: HTMLElement;\n private lastKnownGoodState: any;\n private noResultsSnapshot: string;\n\n /**\n * Creates a new QuerySummary component.\n * @param element The HTMLElement on which to instantiate the component.\n * @param options The options for the QuerySummary 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 */\n constructor(public element: HTMLElement, public options?: IQuerySummaryOptions, bindings?: IComponentBindings) {\n super(element, QuerySummary.ID, bindings);\n\n this.options = ComponentOptions.initComponentOptions(element, QuerySummary, options);\n this.bind.onRootElement(QueryEvents.querySuccess, (data: IQuerySuccessEventArgs) => this.handleQuerySuccess(data));\n this.bind.onRootElement(QueryEvents.queryError, () => this.hide());\n this.hide();\n this.textContainer = $$('span').el;\n $$(this.element).prepend(this.textContainer);\n }\n\n private hide() {\n $$(this.element).addClass('coveo-hidden');\n }\n\n private show() {\n $$(this.element).removeClass('coveo-hidden');\n }\n\n private render(data: IQuerySuccessEventArgs) {\n $$(this.textContainer).empty();\n this.show();\n\n this.updateNoResultsSnapshot();\n this.hideNoResultsPage();\n\n if (!this.options.onlyDisplaySearchTips) {\n this.updateSummaryIfResultsWereReceived(data);\n }\n\n const queryResults = data.results;\n\n if (queryResults.exception != null && queryResults.exception.code != null) {\n const code: string = ('QueryException' + queryResults.exception.code).toLocaleString();\n this.textContainer.innerHTML = l('QueryException', code);\n } else if (queryResults.results.length == 0) {\n this.updateQueryTagsInNoResultsContainer();\n this.displayInfoOnNoResults();\n } else {\n this.lastKnownGoodState = this.queryStateModel.getAttributes();\n }\n }\n\n private handleQuerySuccess(data: IQuerySuccessEventArgs) {\n Assert.exists(data);\n this.render(data);\n }\n\n private updateSummaryIfResultsWereReceived(data: IQuerySuccessEventArgs) {\n if (!data.results.results.length) {\n return;\n }\n\n const message = QuerySummaryUtils.htmlMessage(this.root, data);\n this.textContainer.innerHTML = message;\n }\n\n private updateNoResultsSnapshot() {\n const noResultsContainer = this.getNoResultsContainer();\n if (this.noResultsSnapshot == null && noResultsContainer) {\n this.noResultsSnapshot = noResultsContainer.innerHTML;\n }\n }\n\n private updateQueryTagsInNoResultsContainer() {\n const noResultsContainer = this.getNoResultsContainer();\n if (noResultsContainer) {\n noResultsContainer.innerHTML = this.replaceQueryTagsWithHighlightedQuery(this.noResultsSnapshot);\n }\n }\n\n private replaceQueryTagsWithHighlightedQuery(template: string) {\n const highlightedQuery = `${this.sanitizedQuery}`;\n return QuerySummaryUtils.replaceQueryTags(template, highlightedQuery);\n }\n\n private get sanitizedQuery() {\n return escape(this.queryStateModel.get(QueryStateModel.attributesEnum.q));\n }\n\n private displayInfoOnNoResults() {\n this.showNoResultsPage();\n\n if (this.options.enableNoResultsFoundMessage) {\n const noResultsFoundMessage = this.getNoResultsFoundMessageElement();\n this.textContainer.appendChild(noResultsFoundMessage.el);\n }\n\n if (this.options.enableCancelLastAction) {\n const cancelLastAction = this.getCancelLastActionElement();\n this.textContainer.appendChild(cancelLastAction.el);\n }\n\n if (this.options.enableSearchTips) {\n const searchTipsTitle = this.getSearchTipsTitleElement();\n const searchTipsList = this.getSearchTipsListElement();\n this.textContainer.appendChild(searchTipsTitle.el);\n this.textContainer.appendChild(searchTipsList.el);\n }\n }\n\n private hideNoResultsPage() {\n const noResultsContainers = this.getAllNoResultsContainer();\n noResultsContainers.forEach(noResultsContainer => {\n $$(noResultsContainer).removeClass('coveo-no-results');\n });\n }\n\n private showNoResultsPage() {\n const noResultsContainers = this.getAllNoResultsContainer();\n noResultsContainers.forEach(noResultsContainer => {\n $$(noResultsContainer).addClass('coveo-no-results');\n });\n }\n\n private getNoResultsContainer(): HTMLElement {\n return $$(this.element).find(`.${noResultsCssClass}`);\n }\n\n private getAllNoResultsContainer(): HTMLElement[] {\n return $$(this.element).findAll(`.${noResultsCssClass}`);\n }\n\n private get parsedNoResultsFoundMessage() {\n if (this.sanitizedQuery.trim() === '') {\n return l('noResult');\n }\n\n return this.replaceQueryTagsWithHighlightedQuery(this.options.noResultsFoundMessage);\n }\n\n private getNoResultsFoundMessageElement() {\n const noResultsFoundMessage = $$(\n 'div',\n {\n className: 'coveo-query-summary-no-results-string'\n },\n this.parsedNoResultsFoundMessage\n );\n\n return noResultsFoundMessage;\n }\n\n private getCancelLastActionElement() {\n const cancelLastAction = $$(\n 'div',\n {\n className: 'coveo-query-summary-cancel-last'\n },\n l('CancelLastAction')\n );\n\n new AccessibleButton()\n .withLabel(l('CancelLastAction'))\n .withElement(cancelLastAction)\n .withSelectAction(() => {\n this.usageAnalytics.logCustomEvent(analyticsActionCauseList.noResultsBack, {}, this.root);\n this.usageAnalytics.logSearchEvent(analyticsActionCauseList.noResultsBack, {});\n if (this.lastKnownGoodState) {\n this.queryStateModel.reset();\n this.queryStateModel.setMultiple(this.lastKnownGoodState);\n $$(this.root).trigger(QuerySummaryEvents.cancelLastAction);\n this.queryController.executeQuery();\n } else {\n history.back();\n }\n })\n .build();\n\n return cancelLastAction;\n }\n\n private getSearchTipsTitleElement() {\n const searchTipsInfo = $$('div', {\n className: 'coveo-query-summary-search-tips-info'\n });\n searchTipsInfo.text(l('SearchTips'));\n\n return searchTipsInfo;\n }\n\n private getSearchTipsListElement() {\n const searchTips = $$('ul');\n\n const checkSpelling = $$('li');\n checkSpelling.text(l('CheckSpelling'));\n\n const fewerKeywords = $$('li');\n fewerKeywords.text(l('TryUsingFewerKeywords'));\n\n searchTips.el.appendChild(checkSpelling.el);\n searchTips.el.appendChild(fewerKeywords.el);\n\n if (this.queryStateModel.atLeastOneFacetIsActive()) {\n const fewerFilter = $$('li');\n fewerFilter.text(l('SelectFewerFilters'));\n searchTips.el.appendChild(fewerFilter.el);\n }\n\n return searchTips;\n }\n}\nInitialization.registerAutoCreateComponent(QuerySummary);\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/QuerySummary/QuerySummary.ts","/**\n * Argument sent to all handlers bound on {@link QuerySummaryEvents.cancelLastAction}\n */\nexport interface IQuerySummaryCancelLastActionArgs {}\n\n/**\n * This static class is there to contains the different string definition for all the events related to the {@link AdvancedSearch} component.\n */\nexport class QuerySummaryEvents {\n /**\n * Triggered when the last action is being cancelled by the query summary component\n *\n * Allows external code to revert their last action.\n * @type {string}\n */\n public static cancelLastAction = 'cancelLastAction';\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/events/QuerySummaryEvents.ts"],"sourceRoot":""}