{"version":3,"sources":["ShareQuery.min__d67acfe80778de2e04cc.js","./src/ui/ShareQuery/ShareQuery.ts"],"names":["webpackJsonpCoveo__temporary","283","module","exports","__webpack_require__","__extends","this","extendStatics","Object","setPrototypeOf","__proto__","Array","d","b","p","hasOwnProperty","__","constructor","prototype","create","defineProperty","value","element","options","bindings","ModalBox","ShareQuery","ID","bind","onRootElement","SettingsEvents","settingsPopulateMenu","args","menuData","push","className","text","l","onOpen","open","onClose","close","svgIcon","SVGIcons","icons","dropdownShareQuery","svgIconClassName","_this","modalbox","dialogBoxContent","buildContent","title","body","searchInterface","modalContainer","getLinkToThisQuery","linkToThisQuery","buildLinkToThisQuery","setLinkToThisQuery","link","getCompleteQuery","completeQuery","buildCompleteQuery","setCompleteQuery","outputIfNotNull","content","$$","el","boxes","appendChild","buildTextBoxWithLabel","Component","pointElementsToDummyForm","type","lastQuery","queryController","getLastQuery","Utils","trim","q","aq","cq","on","select","window","location","href","label","input","labelElement","returnDiv","doExport","exportGlobally","Initialization","registerAutoCreateComponent","673"],"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,EADnCL,EAAcK,EAAGC,GAEjBD,EAAEM,UAAkB,OAANL,EAAaL,OAAOW,OAAON,IAAMG,EAAGE,UAAYL,EAAEK,UAAW,GAAIF,OAGvFR,QAAOY,eAAejB,EAAS,cAAgBkB,OAAO,GCjBtD,YAEA,QAEA,OACA,OACA,OACA,OACA,OACA,OAEA,OACA,aASA,cAsBE,WACSC,EACAC,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cesContent":["webpackJsonpCoveo__temporary([62],{\n\n/***/ 283:\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 SettingsEvents_1 = __webpack_require__(55);\nvar Dom_1 = __webpack_require__(1);\nvar Strings_1 = __webpack_require__(6);\nvar Utils_1 = __webpack_require__(4);\nvar Initialization_1 = __webpack_require__(2);\nvar GlobalExports_1 = __webpack_require__(3);\nvar ExternalModulesShim_1 = __webpack_require__(26);\n__webpack_require__(673);\nvar SVGIcons_1 = __webpack_require__(12);\n/**\n * The ShareQuery component populates the {@link Settings} popup menu with the **Share Query** menu item. When the end\n * user clicks this item, it displays a panel containing two input boxes: one containing a shareable link and the other\n * containing the complete current query expression.\n */\nvar ShareQuery = /** @class */ (function (_super) {\n __extends(ShareQuery, _super);\n /**\n * Creates a new ShareQuery component.\n * @param element The HTMLElement on which to instantiate the component.\n * @param options The options for the ShareQuery 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 ShareQuery(element, options, bindings, ModalBox) {\n if (ModalBox === void 0) { ModalBox = ExternalModulesShim_1.ModalBox; }\n var _this = _super.call(this, element, ShareQuery.ID, bindings) || this;\n _this.element = element;\n _this.options = options;\n _this.ModalBox = ModalBox;\n _this.bind.onRootElement(SettingsEvents_1.SettingsEvents.settingsPopulateMenu, function (args) {\n args.menuData.push({\n className: 'coveo-share-query',\n text: Strings_1.l('ShareQuery'),\n onOpen: function () { return _this.open(); },\n onClose: function () { return _this.close(); },\n svgIcon: SVGIcons_1.SVGIcons.icons.dropdownShareQuery,\n svgIconClassName: 'coveo-share-query-svg'\n });\n });\n return _this;\n }\n /**\n * Open the **Share Query** modal box.\n */\n ShareQuery.prototype.open = function () {\n if (this.modalbox == null) {\n this.dialogBoxContent = this.buildContent();\n this.modalbox = this.ModalBox.open(this.dialogBoxContent, {\n title: Strings_1.l('ShareQuery'),\n className: 'coveo-share-query-opened',\n body: this.searchInterface.options.modalContainer\n });\n }\n };\n /**\n * Close the **Share Query** modal box.\n */\n ShareQuery.prototype.close = function () {\n if (this.modalbox) {\n this.modalbox.close();\n this.modalbox = null;\n }\n };\n /**\n * Gets the link to the current query.\n */\n ShareQuery.prototype.getLinkToThisQuery = function () {\n if (!this.linkToThisQuery) {\n this.buildLinkToThisQuery();\n }\n return this.linkToThisQuery.value;\n };\n /**\n * Sets the link to the current query.\n */\n ShareQuery.prototype.setLinkToThisQuery = function (link) {\n if (!this.linkToThisQuery) {\n this.buildLinkToThisQuery();\n }\n this.linkToThisQuery.value = link;\n };\n /**\n * Gets the complete query expression string\n */\n ShareQuery.prototype.getCompleteQuery = function () {\n if (!this.completeQuery) {\n this.buildCompleteQuery();\n }\n return this.completeQuery.value;\n };\n /**\n * Set the complete query expression string.\n */\n ShareQuery.prototype.setCompleteQuery = function (completeQuery) {\n if (!this.completeQuery) {\n this.buildCompleteQuery();\n }\n this.completeQuery.value = completeQuery;\n };\n ShareQuery.prototype.outputIfNotNull = function (value) {\n if (value) {\n return '(' + value + ')';\n }\n return '';\n };\n ShareQuery.prototype.buildContent = function () {\n var content = Dom_1.$$('div', {\n className: 'coveo-share-query-summary-info'\n }).el;\n var boxes = Dom_1.$$('div', {\n className: 'coveo-share-query-summary-info-boxes'\n }).el;\n this.buildLinkToThisQuery();\n this.buildCompleteQuery();\n boxes.appendChild(this.buildTextBoxWithLabel(Strings_1.l('Link'), this.linkToThisQuery));\n boxes.appendChild(this.buildTextBoxWithLabel(Strings_1.l('CompleteQuery'), this.completeQuery));\n content.appendChild(boxes);\n Component_1.Component.pointElementsToDummyForm(content);\n return content;\n };\n ShareQuery.prototype.buildCompleteQuery = function () {\n this.completeQuery = Dom_1.$$('input', {\n type: 'text',\n className: 'coveo-share-query-summary-info-input'\n }).el;\n var lastQuery = this.queryController.getLastQuery();\n this.completeQuery.value = Utils_1.Utils.trim(this.outputIfNotNull(lastQuery.q) + \" \" + this.outputIfNotNull(lastQuery.aq) + \" \" + this.outputIfNotNull(lastQuery.cq));\n };\n ShareQuery.prototype.buildLinkToThisQuery = function () {\n var _this = this;\n this.linkToThisQuery = Dom_1.$$('input', {\n type: 'text',\n className: 'coveo-share-query-summary-info-input'\n }).el;\n Dom_1.$$(this.linkToThisQuery).on('click', function () { return _this.linkToThisQuery.select(); });\n this.linkToThisQuery.value = window.location.href;\n };\n ShareQuery.prototype.buildTextBoxWithLabel = function (label, input) {\n var labelElement = Dom_1.$$('span', {\n className: 'coveo-share-query-summary-info-label'\n });\n labelElement.text(label);\n var returnDiv = Dom_1.$$('div').el;\n returnDiv.appendChild(labelElement.el);\n returnDiv.appendChild(input);\n return returnDiv;\n };\n ShareQuery.ID = 'ShareQuery';\n ShareQuery.options = {};\n ShareQuery.doExport = function () {\n GlobalExports_1.exportGlobally({\n ShareQuery: ShareQuery\n });\n };\n return ShareQuery;\n}(Component_1.Component));\nexports.ShareQuery = ShareQuery;\nInitialization_1.Initialization.registerAutoCreateComponent(ShareQuery);\n\n\n/***/ }),\n\n/***/ 673:\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ })\n\n});\n\n\n// WEBPACK FOOTER //\n// ShareQuery.min__d67acfe80778de2e04cc.js","import { Component } from '../Base/Component';\nimport { IComponentBindings } from '../Base/ComponentBindings';\nimport { SettingsEvents } from '../../events/SettingsEvents';\nimport { ISettingsPopulateMenuArgs } from '../Settings/Settings';\nimport { $$ } from '../../utils/Dom';\nimport { l } from '../../strings/Strings';\nimport { Utils } from '../../utils/Utils';\nimport { Initialization } from '../Base/Initialization';\nimport { exportGlobally } from '../../GlobalExports';\nimport { ModalBox as ModalBoxModule } from '../../ExternalModulesShim';\n\nimport 'styling/_ShareQuery';\nimport { SVGIcons } from '../../utils/SVGIcons';\n\nexport interface IShareQueryOptions {}\n\n/**\n * The ShareQuery component populates the {@link Settings} popup menu with the **Share Query** menu item. When the end\n * user clicks this item, it displays a panel containing two input boxes: one containing a shareable link and the other\n * containing the complete current query expression.\n */\nexport class ShareQuery extends Component {\n static ID = 'ShareQuery';\n static options: IShareQueryOptions = {};\n\n static doExport = () => {\n exportGlobally({\n ShareQuery: ShareQuery\n });\n };\n\n public dialogBoxContent: HTMLElement;\n private linkToThisQuery: HTMLInputElement;\n private completeQuery: HTMLInputElement;\n private modalbox: Coveo.ModalBox.ModalBox;\n\n /**\n * Creates a new ShareQuery component.\n * @param element The HTMLElement on which to instantiate the component.\n * @param options The options for the ShareQuery 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(\n public element: HTMLElement,\n public options: IShareQueryOptions,\n bindings?: IComponentBindings,\n private ModalBox = ModalBoxModule\n ) {\n super(element, ShareQuery.ID, bindings);\n\n this.bind.onRootElement(SettingsEvents.settingsPopulateMenu, (args: ISettingsPopulateMenuArgs) => {\n args.menuData.push({\n className: 'coveo-share-query',\n text: l('ShareQuery'),\n onOpen: () => this.open(),\n onClose: () => this.close(),\n svgIcon: SVGIcons.icons.dropdownShareQuery,\n svgIconClassName: 'coveo-share-query-svg'\n });\n });\n }\n\n /**\n * Open the **Share Query** modal box.\n */\n public open() {\n if (this.modalbox == null) {\n this.dialogBoxContent = this.buildContent();\n this.modalbox = this.ModalBox.open(this.dialogBoxContent, {\n title: l('ShareQuery'),\n className: 'coveo-share-query-opened',\n body: this.searchInterface.options.modalContainer\n });\n }\n }\n\n /**\n * Close the **Share Query** modal box.\n */\n public close() {\n if (this.modalbox) {\n this.modalbox.close();\n this.modalbox = null;\n }\n }\n\n /**\n * Gets the link to the current query.\n */\n public getLinkToThisQuery(): string {\n if (!this.linkToThisQuery) {\n this.buildLinkToThisQuery();\n }\n return this.linkToThisQuery.value;\n }\n\n /**\n * Sets the link to the current query.\n */\n public setLinkToThisQuery(link: string): void {\n if (!this.linkToThisQuery) {\n this.buildLinkToThisQuery();\n }\n this.linkToThisQuery.value = link;\n }\n\n /**\n * Gets the complete query expression string\n */\n public getCompleteQuery(): string {\n if (!this.completeQuery) {\n this.buildCompleteQuery();\n }\n return this.completeQuery.value;\n }\n\n /**\n * Set the complete query expression string.\n */\n public setCompleteQuery(completeQuery: string) {\n if (!this.completeQuery) {\n this.buildCompleteQuery();\n }\n this.completeQuery.value = completeQuery;\n }\n\n private outputIfNotNull(value: string): string {\n if (value) {\n return '(' + value + ')';\n }\n return '';\n }\n\n private buildContent(): HTMLElement {\n const content = $$('div', {\n className: 'coveo-share-query-summary-info'\n }).el;\n\n const boxes = $$('div', {\n className: 'coveo-share-query-summary-info-boxes'\n }).el;\n\n this.buildLinkToThisQuery();\n this.buildCompleteQuery();\n\n boxes.appendChild(this.buildTextBoxWithLabel(l('Link'), this.linkToThisQuery));\n boxes.appendChild(this.buildTextBoxWithLabel(l('CompleteQuery'), this.completeQuery));\n content.appendChild(boxes);\n\n Component.pointElementsToDummyForm(content);\n\n return content;\n }\n\n private buildCompleteQuery() {\n this.completeQuery = <HTMLInputElement>$$('input', {\n type: 'text',\n className: 'coveo-share-query-summary-info-input'\n }).el;\n\n const lastQuery = this.queryController.getLastQuery();\n this.completeQuery.value = Utils.trim(\n `${this.outputIfNotNull(lastQuery.q)} ${this.outputIfNotNull(lastQuery.aq)} ${this.outputIfNotNull(lastQuery.cq)}`\n );\n }\n\n private buildLinkToThisQuery() {\n this.linkToThisQuery = <HTMLInputElement>$$('input', {\n type: 'text',\n className: 'coveo-share-query-summary-info-input'\n }).el;\n\n $$(this.linkToThisQuery).on('click', () => this.linkToThisQuery.select());\n this.linkToThisQuery.value = window.location.href;\n }\n\n private buildTextBoxWithLabel(label: string, input: HTMLInputElement): HTMLElement {\n const labelElement = $$('span', {\n className: 'coveo-share-query-summary-info-label'\n });\n labelElement.text(label);\n\n const returnDiv = $$('div').el;\n returnDiv.appendChild(labelElement.el);\n returnDiv.appendChild(input);\n return returnDiv;\n }\n}\n\nInitialization.registerAutoCreateComponent(ShareQuery);\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/ShareQuery/ShareQuery.ts"],"sourceRoot":""}