{"version":3,"sources":["DidYouMean.min__00ecf0bd3e47c7b52b32.js","./src/ui/DidYouMean/DidYouMean.ts"],"names":["webpackJsonpCoveo__temporary","246","module","exports","__webpack_require__","__extends","this","extendStatics","Object","setPrototypeOf","__proto__","Array","d","b","p","hasOwnProperty","__","constructor","prototype","create","defineProperty","value","element","options","bindings","DidYouMean","ID","ComponentOptions","initComponentOptions","Assert","exists","hideNext","correctedTerm","bind","onRootElement","QueryEvents","buildingQuery","handlePrepareQueryBuilder","querySuccess","handleProcessNewQueryResults","noResults","handleNoResults","newQuery","handleNewQuery","$$","hide","_this","doQueryWithCorrectedTerm","queryStateModel","set","QueryStateModel","attributesEnum","q","queryController","deferExecuteQuery","beforeExecuteQuery","usageAnalytics","logSearchEvent","analyticsActionCauseList","didyoumeanClick","empty","data","queryBuilder","enableDidYouMean","Utils","isNonEmptyArray","results","queryCorrections","searchAsYouType","enableAutoCorrection","originalQuery","get","correctedQuery","correctedSentence","buildCorrectedSentence","searchInterface","historyManager","replaceState","getAttributes","retryTheQuery","noResultsFor","className","el","innerHTML","l","StringUtils","htmlEncode","appendChild","automaticCorrect","show","didyoumeanAutomatic","logger","trace","correctedWordEl","didYouMean","outerHTML","appendedCorrectedWordEl","find","tagName","on","correction","toReturn","currentOffset","_","each","wordCorrections","wordCorrection","push","slice","offset","length","join","doExport","exportGlobally","buildBooleanOption","defaultValue","Component","Initialization","registerAutoCreateComponent","602"],"mappings":"AAAAA,8BAA8B,KAExBC,IACA,SAAUC,EAAQC,EAASC,GAEjC,YAEA,IAAIC,GAAaC,MAAQA,KAAKD,WAAc,WACxC,GAAIE,GAAgBC,OAAOC,iBACpBC,uBAA2BC,QAAS,SAAUC,EAAGC,GAAKD,EAAEF,UAAYG,IACvE,SAAUD,EAAGC,GAAK,IAAK,GAAIC,KAAKD,GAAOA,EAAEE,eAAeD,KAAIF,EAAEE,GAAKD,EAAEC,IACzE,OAAO,UAAUF,EAAGC,GAEhB,QAASG,KAAOV,KAAKW,YAAcL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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__(602);\nvar _ = __webpack_require__(0);\nvar GlobalExports_1 = __webpack_require__(3);\nvar QueryEvents_1 = __webpack_require__(11);\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 StringUtils_1 = __webpack_require__(22);\nvar Utils_1 = __webpack_require__(4);\nvar AnalyticsActionListMeta_1 = __webpack_require__(9);\nvar Component_1 = __webpack_require__(7);\nvar ComponentOptions_1 = __webpack_require__(8);\nvar Initialization_1 = __webpack_require__(2);\n/**\n * The DidYouMean component is responsible for displaying query corrections. If this component is in the page and the\n * query returns no result but finds a possible query correction, the component either suggests the correction or\n * automatically triggers a new query with the suggested term.\n */\nvar DidYouMean = /** @class */ (function (_super) {\n __extends(DidYouMean, _super);\n /**\n * Creates a new DidYouMean component.\n * @param element The HTMLElement on which to instantiate the component.\n * @param options The options for the DidYouMean 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 DidYouMean(element, options, bindings) {\n var _this = _super.call(this, element, DidYouMean.ID, bindings) || this;\n _this.element = element;\n _this.options = options;\n _this.bindings = bindings;\n _this.options = ComponentOptions_1.ComponentOptions.initComponentOptions(element, DidYouMean, options);\n Assert_1.Assert.exists(element);\n Assert_1.Assert.exists(_this.options);\n _this.hideNext = true;\n _this.correctedTerm = null;\n _this.bind.onRootElement(QueryEvents_1.QueryEvents.buildingQuery, _this.handlePrepareQueryBuilder);\n _this.bind.onRootElement(QueryEvents_1.QueryEvents.querySuccess, _this.handleProcessNewQueryResults);\n _this.bind.onRootElement(QueryEvents_1.QueryEvents.noResults, _this.handleNoResults);\n _this.bind.onRootElement(QueryEvents_1.QueryEvents.newQuery, _this.handleNewQuery);\n Dom_1.$$(_this.element).hide();\n return _this;\n }\n /**\n * Executes a query with the corrected term.\n * Throws an exception if the corrected term has not been initialized.\n * If successful, logs a `didyoumeanClick` event in the usage analytics.\n */\n DidYouMean.prototype.doQueryWithCorrectedTerm = function () {\n var _this = this;\n Assert_1.Assert.exists(this.correctedTerm);\n this.queryStateModel.set(QueryStateModel_1.QueryStateModel.attributesEnum.q, this.correctedTerm);\n this.queryController.deferExecuteQuery({\n beforeExecuteQuery: function () { return _this.usageAnalytics.logSearchEvent(AnalyticsActionListMeta_1.analyticsActionCauseList.didyoumeanClick, {}); }\n });\n };\n DidYouMean.prototype.handleNewQuery = function () {\n if (this.hideNext) {\n Dom_1.$$(this.element).empty();\n Dom_1.$$(this.element).hide();\n this.correctedTerm = null;\n }\n else {\n this.hideNext = true;\n }\n };\n DidYouMean.prototype.handlePrepareQueryBuilder = function (data) {\n Assert_1.Assert.exists(data);\n data.queryBuilder.enableDidYouMean = true;\n };\n DidYouMean.prototype.handleNoResults = function (data) {\n // We do not auto-correct on search-as-you-type queries\n if (Utils_1.Utils.isNonEmptyArray(data.results.queryCorrections) && !data.searchAsYouType && this.options.enableAutoCorrection) {\n var originalQuery = this.queryStateModel.get(QueryStateModel_1.QueryStateModel.attributesEnum.q);\n this.correctedTerm = data.results.queryCorrections[0].correctedQuery;\n var correctedSentence = this.buildCorrectedSentence(data.results.queryCorrections[0]);\n this.queryStateModel.set(QueryStateModel_1.QueryStateModel.attributesEnum.q, data.results.queryCorrections[0].correctedQuery);\n this.searchInterface.historyManager.replaceState(this.queryStateModel.getAttributes());\n data.retryTheQuery = true;\n this.hideNext = false;\n var noResultsFor = Dom_1.$$('div', { className: 'coveo-did-you-mean-no-results-for' }).el;\n noResultsFor.innerHTML = Strings_1.l('noResultFor', '' + StringUtils_1.StringUtils.htmlEncode(originalQuery) + '');\n this.element.appendChild(noResultsFor);\n var automaticCorrect = Dom_1.$$('div', { className: 'coveo-did-you-mean-automatic-correct' }).el;\n automaticCorrect.innerHTML = Strings_1.l('autoCorrectedQueryTo', '' + correctedSentence + '');\n this.element.appendChild(automaticCorrect);\n Dom_1.$$(this.element).show();\n this.usageAnalytics.logSearchEvent(AnalyticsActionListMeta_1.analyticsActionCauseList.didyoumeanAutomatic, {});\n }\n };\n DidYouMean.prototype.handleProcessNewQueryResults = function (data) {\n var _this = this;\n Assert_1.Assert.exists(data);\n Assert_1.Assert.exists(data.results);\n var results = data.results;\n this.logger.trace('Received query results from new query', results);\n if (Utils_1.Utils.isNonEmptyArray(results.queryCorrections)) {\n var correctedSentence = this.buildCorrectedSentence(results.queryCorrections[0]);\n this.correctedTerm = results.queryCorrections[0].correctedQuery;\n var correctedWordEl = Dom_1.$$('button', {}, correctedSentence).el;\n var didYouMean = Dom_1.$$('div', { className: 'coveo-did-you-mean-suggestion' }, Strings_1.l('didYouMean', correctedWordEl.outerHTML));\n this.element.appendChild(didYouMean.el);\n var appendedCorrectedWordEl = didYouMean.find(correctedWordEl.tagName);\n Dom_1.$$(appendedCorrectedWordEl).on('click', function () { return _this.doQueryWithCorrectedTerm(); });\n Dom_1.$$(this.element).show();\n }\n };\n DidYouMean.prototype.buildCorrectedSentence = function (correction) {\n var toReturn = [];\n var tagStart = \"\";\n var tagEnd = '';\n var currentOffset = 0;\n _.each(correction.wordCorrections, function (wordCorrection) {\n toReturn.push(StringUtils_1.StringUtils.htmlEncode(correction.correctedQuery.slice(currentOffset, wordCorrection.offset)));\n currentOffset = wordCorrection.offset;\n toReturn.push(tagStart);\n toReturn.push(StringUtils_1.StringUtils.htmlEncode(correction.correctedQuery.slice(currentOffset, wordCorrection.length + currentOffset)));\n toReturn.push(tagEnd);\n currentOffset = wordCorrection.offset + wordCorrection.length;\n });\n toReturn.push(StringUtils_1.StringUtils.htmlEncode(correction.correctedQuery.slice(currentOffset)));\n return toReturn.join('');\n };\n DidYouMean.ID = 'DidYouMean';\n DidYouMean.doExport = function () {\n GlobalExports_1.exportGlobally({\n DidYouMean: DidYouMean\n });\n };\n /**\n * The options for the component\n * @componentOptions\n */\n DidYouMean.options = {\n /**\n * Specifies whether the DidYouMean component automatically triggers a new query when a query returns no result and\n * a possible correction is available.\n *\n * Default value is `true`.\n */\n enableAutoCorrection: ComponentOptions_1.ComponentOptions.buildBooleanOption({ defaultValue: true })\n };\n return DidYouMean;\n}(Component_1.Component));\nexports.DidYouMean = DidYouMean;\nInitialization_1.Initialization.registerAutoCreateComponent(DidYouMean);\n\n\n/***/ }),\n\n/***/ 602:\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ })\n\n});\n\n\n// WEBPACK FOOTER //\n// DidYouMean.min__00ecf0bd3e47c7b52b32.js","import 'styling/_DidYouMean';\nimport * as _ from 'underscore';\nimport { exportGlobally } from '../../GlobalExports';\nimport { IBuildingQueryEventArgs, INoResultsEventArgs, IQuerySuccessEventArgs, QueryEvents } from '../../events/QueryEvents';\nimport { Assert } from '../../misc/Assert';\nimport { QueryStateModel } from '../../models/QueryStateModel';\nimport { IQueryCorrection } from '../../rest/QueryCorrection';\nimport { l } from '../../strings/Strings';\nimport { $$ } from '../../utils/Dom';\nimport { StringUtils } from '../../utils/StringUtils';\nimport { Utils } from '../../utils/Utils';\nimport { IAnalyticsNoMeta, analyticsActionCauseList } from '../Analytics/AnalyticsActionListMeta';\nimport { Component } from '../Base/Component';\nimport { IComponentBindings } from '../Base/ComponentBindings';\nimport { ComponentOptions } from '../Base/ComponentOptions';\nimport { Initialization } from '../Base/Initialization';\n\nexport interface IDidYouMeanOptions {\n enableAutoCorrection?: boolean;\n}\n\n/**\n * The DidYouMean component is responsible for displaying query corrections. If this component is in the page and the\n * query returns no result but finds a possible query correction, the component either suggests the correction or\n * automatically triggers a new query with the suggested term.\n */\nexport class DidYouMean extends Component {\n static ID = 'DidYouMean';\n\n static doExport = () => {\n exportGlobally({\n DidYouMean: DidYouMean\n });\n };\n\n /**\n * The options for the component\n * @componentOptions\n */\n static options: IDidYouMeanOptions = {\n /**\n * Specifies whether the DidYouMean component automatically triggers a new query when a query returns no result and\n * a possible correction is available.\n *\n * Default value is `true`.\n */\n enableAutoCorrection: ComponentOptions.buildBooleanOption({ defaultValue: true })\n };\n\n public correctedTerm: string;\n\n private hideNext: boolean;\n\n /**\n * Creates a new DidYouMean component.\n * @param element The HTMLElement on which to instantiate the component.\n * @param options The options for the DidYouMean 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?: IDidYouMeanOptions, public bindings?: IComponentBindings) {\n super(element, DidYouMean.ID, bindings);\n\n this.options = ComponentOptions.initComponentOptions(element, DidYouMean, options);\n Assert.exists(element);\n Assert.exists(this.options);\n\n this.hideNext = true;\n\n this.correctedTerm = null;\n\n this.bind.onRootElement(QueryEvents.buildingQuery, this.handlePrepareQueryBuilder);\n this.bind.onRootElement(QueryEvents.querySuccess, this.handleProcessNewQueryResults);\n this.bind.onRootElement(QueryEvents.noResults, this.handleNoResults);\n this.bind.onRootElement(QueryEvents.newQuery, this.handleNewQuery);\n $$(this.element).hide();\n }\n\n /**\n * Executes a query with the corrected term.\n * Throws an exception if the corrected term has not been initialized.\n * If successful, logs a `didyoumeanClick` event in the usage analytics.\n */\n public doQueryWithCorrectedTerm() {\n Assert.exists(this.correctedTerm);\n this.queryStateModel.set(QueryStateModel.attributesEnum.q, this.correctedTerm);\n this.queryController.deferExecuteQuery({\n beforeExecuteQuery: () => this.usageAnalytics.logSearchEvent(analyticsActionCauseList.didyoumeanClick, {})\n });\n }\n\n private handleNewQuery() {\n if (this.hideNext) {\n $$(this.element).empty();\n $$(this.element).hide();\n this.correctedTerm = null;\n } else {\n this.hideNext = true;\n }\n }\n\n private handlePrepareQueryBuilder(data: IBuildingQueryEventArgs) {\n Assert.exists(data);\n data.queryBuilder.enableDidYouMean = true;\n }\n\n private handleNoResults(data: INoResultsEventArgs) {\n // We do not auto-correct on search-as-you-type queries\n if (Utils.isNonEmptyArray(data.results.queryCorrections) && !data.searchAsYouType && this.options.enableAutoCorrection) {\n let originalQuery = this.queryStateModel.get(QueryStateModel.attributesEnum.q);\n this.correctedTerm = data.results.queryCorrections[0].correctedQuery;\n let correctedSentence = this.buildCorrectedSentence(data.results.queryCorrections[0]);\n this.queryStateModel.set(QueryStateModel.attributesEnum.q, data.results.queryCorrections[0].correctedQuery);\n this.searchInterface.historyManager.replaceState(this.queryStateModel.getAttributes());\n data.retryTheQuery = true;\n this.hideNext = false;\n\n let noResultsFor = $$('div', { className: 'coveo-did-you-mean-no-results-for' }).el;\n noResultsFor.innerHTML = l(\n 'noResultFor',\n '' + StringUtils.htmlEncode(originalQuery) + ''\n );\n this.element.appendChild(noResultsFor);\n\n let automaticCorrect = $$('div', { className: 'coveo-did-you-mean-automatic-correct' }).el;\n automaticCorrect.innerHTML = l('autoCorrectedQueryTo', '' + correctedSentence + '');\n this.element.appendChild(automaticCorrect);\n\n $$(this.element).show();\n this.usageAnalytics.logSearchEvent(analyticsActionCauseList.didyoumeanAutomatic, {});\n }\n }\n\n private handleProcessNewQueryResults(data: IQuerySuccessEventArgs) {\n Assert.exists(data);\n Assert.exists(data.results);\n\n let results = data.results;\n this.logger.trace('Received query results from new query', results);\n\n if (Utils.isNonEmptyArray(results.queryCorrections)) {\n const correctedSentence = this.buildCorrectedSentence(results.queryCorrections[0]);\n this.correctedTerm = results.queryCorrections[0].correctedQuery;\n\n const correctedWordEl = $$('button', {}, correctedSentence).el;\n const didYouMean = $$('div', { className: 'coveo-did-you-mean-suggestion' }, l('didYouMean', correctedWordEl.outerHTML));\n this.element.appendChild(didYouMean.el);\n\n const appendedCorrectedWordEl = didYouMean.find(correctedWordEl.tagName);\n $$(appendedCorrectedWordEl).on('click', () => this.doQueryWithCorrectedTerm());\n\n $$(this.element).show();\n }\n }\n\n private buildCorrectedSentence(correction: IQueryCorrection) {\n let toReturn = [];\n let tagStart = \"\";\n let tagEnd = '';\n let currentOffset = 0;\n _.each(correction.wordCorrections, wordCorrection => {\n toReturn.push(StringUtils.htmlEncode(correction.correctedQuery.slice(currentOffset, wordCorrection.offset)));\n currentOffset = wordCorrection.offset;\n toReturn.push(tagStart);\n toReturn.push(StringUtils.htmlEncode(correction.correctedQuery.slice(currentOffset, wordCorrection.length + currentOffset)));\n toReturn.push(tagEnd);\n currentOffset = wordCorrection.offset + wordCorrection.length;\n });\n toReturn.push(StringUtils.htmlEncode(correction.correctedQuery.slice(currentOffset)));\n return toReturn.join('');\n }\n}\n\nInitialization.registerAutoCreateComponent(DidYouMean);\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/DidYouMean/DidYouMean.ts"],"sourceRoot":""}