{"version":3,"sources":["ResultsFiltersPreferences.min__d67acfe80778de2e04cc.js","./src/ui/FormWidgets/FormGroup.ts","./src/ui/FormWidgets/MultiSelect.ts","./src/ui/ResultsFiltersPreferences/ResultsFiltersPreferences.ts"],"names":["webpackJsonpCoveo__temporary","139","module","exports","__webpack_require__","Object","defineProperty","value","contents","label","this","labelElement","$$","className","text","element","_","each","content","append","build","doExport","exportGlobally","FormGroup","el","193","onChange","options","multiSelect","buildContent","MultiSelect","getElement","getValue","chain","toArray","filter","opt","selected","map","getUnselectedValues","setValue","values","currentlySelected","currentStateSplit","partition","contains","newStateToApplySplit","toSelect","toUnSelect","hasChanged","Utils","arrayEqual","trigger","reset","selectedIndex","isEmptyArray","multiple","size","length","toString","optgroup","l","appendChild","on","275","__extends","extendStatics","setPrototypeOf","__proto__","Array","d","b","p","hasOwnProperty","__","constructor","prototype","create","bindings","ResultsFiltersPreferences","ID","preferencePanelCheckboxInput","ComponentOptions","initComponentOptions","preferencePanel","closest","Component","computeCssClassNameForType","preferencePanelLocalStorage","LocalStorageUtils","mergeLocalPreferencesWithStaticPreferences","bindPreferencePanelEvent","bindBreadcrumbEvent","bindQueryEvent","bind","oneRootElement","InitializationEvents","afterComponentsInitialization","createDom","oneQueryState","MODEL_EVENTS","CHANGE_ONE","QUERY_STATE_ATTRIBUTES","T","fromPreferencesToCheckboxInput","_this","logger","warn","container","buildCheckboxesInput","showAdvancedFilters","buildAdvancedFilters","save","fromCheckboxInputToPreferences","toSave","omit","preferences","info","exitWithoutSave","hideAdvancedFilterBuilder","PreferencesPanelEvents","savePreferences","exitPreferencesWithoutSave","includeInBreadcrumb","onRootElement","BreadcrumbEvents","populateBreadcrumb","args","handlePopulateBreadcrumb","clearBreadcrumb","handleClearBreadcrumb","QueryEvents","buildingQuery","handleBuildingQuery","getActiveFilters","isNonEmptyString","expression","queryBuilder","advancedExpression","add","actives","isNonEmptyArray","title","getHeadingTag","headingLevel","valuesContainer","i","buildBreadcrumb","breadcrumbs","push","isFullBreadcrumbClear","advancedFilters","AccessibleButton","withElement","withoutLabelOrTitle","withSelectAction","openAdvancedFilterSectionOrSaveFilters","buildAdvancedFilterInput","buildAdvancedFilterFormValidate","advancedFiltersBuilder","advancedFilterFormValidate","onlineHelp","href","find","insertAfter","advancedFiltersTextInputCaption","TextInput","getInput","setAttribute","advancedFiltersTextInputExpression","advancedFiltersTabSelect","getAllTabs","formSubmit","type","saveFormButton","SVGIcons","icons","SVGDom","addClassToSVGInContainer","withLabel","click","closeFormButton","close","saveAndCloseContainer","inputCaption","addClass","filtersTabSelect","filtersExpression","e","validateAndSaveAdvancedFilter","tabRef","getComponentRef","tabsElement","root","findAll","computeCssClassName","tabElement","get","id","getPreferencesBoxInputToBuild","caption","tab","undefined","preferenceContainer","remove","toBuild","filterToBuild","checkbox","Checkbox","queryController","firstQuery","fromFilterToAnalyticsEvent","executeQuery","closeModalBox","choiceContainer","buildEditAdvancedFilter","buildDeleteAdvancedFilter","custom","deleteElement","delete","confirmDelete","getFilterElementByCaption","editElement","edit","elem","clear","mainClear","onSelectAction","filterElement","confirm","isSelected","deleteFilterPreference","oldCaption","oldTab","oldExpression","populateEditSection","toPopulate","detach","hasClass","showAdvancedFilterBuilder","preventDefault","tabs","queryStateModel","set","QueryStateModel","attributesEnum","t","getActiveTab","select","getInactiveFilters","getDormantFilters","activeTab","filterIsInActiveTab","compact","replace","parentElement","fromResultsFilterOptionToResultsPreferenceInterface","ret","filters","staticPreferences","localPreferences","load","localPreferencesWithoutRemoved","preference","isCustom","existsInStatic","staticPreference","localToMerge","extendDeep","usageAnalytics","logSearchEvent","analyticsActionCauseList","customfiltersChange","customFilterName","customFilterExpression","customFilterType","enlargeModalBox","modalBoxContainer","document","body","shrinkModalBox","removeClass","buildBooleanOption","defaultValue","buildJsonOption","Initialization","registerAutoCreateComponent","566","578","665"],"mappings":"AAAAA,8BAA8B,GAAG,GAAG,KAE9BC,IACA,SAAUC,EAAQC,EAASC,GAEjC,YAEAC,QAAOC,eAA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ACE,GAAMH,GAAoB,EAAAzQ,GAAG0Q,SAASC,MAAMpH,KAAK,yBAC7CkH,IACF,EAAAzQ,GAAGyQ,GAAmBI,YAAY,kBAI9B,YAAA1C,0BAAR,WACMrO,KAAKqJ,yBACP,EAAAnJ,GAAGF,KAAKqJ,wBAAwB0B,SAAS,gBACzC/K,KAAK0Q,oBAID,YAAA7J,0BAAR,WACM7G,KAAKqJ,yBACP,EAAAnJ,GAAGF,KAAKqJ,wBAAwB0H,YAAY,gBAC5C/Q,KAAK8Q,mBAtnBF,EAAAxM,GAAK,4BAEL,EAAA3D,SAAW,WAChB,EAAAC,gBACEyD,0BAA2BA,KAQxB,EAAApD,SAMLgG,oBAAqB,EAAAzC,iBAAiBwM,oBAAqBC,cAAc,IAUzE7K,oBAAqB,EAAA5B,iBAAiBwM,oBAAqBC,cAAc,IAoDzEzB,QAAc,EAAAhL,iBAAiB0M,mBAyiBnC,GA1nB+C,EAAAtM,UAAlC,GAAAP,4BA4nBb,EAAA8M,eAAeC,4BAA4B/M,IHyFrCgN,IACA,SAAU7R,EAAQC,KAMlB6R,IACA,SAAU9R,EAAQC,KAMlB8R,IACA,SAAU/R,EAAQC","file":"ResultsFiltersPreferences.min__d67acfe80778de2e04cc.js","sourcesContent":["webpackJsonpCoveo__temporary([26,57,58],{\n\n/***/ 139:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Dom_1 = __webpack_require__(1);\nvar _ = __webpack_require__(0);\n__webpack_require__(566);\nvar GlobalExports_1 = __webpack_require__(3);\n/**\n * A simple `fieldset` HTMLElement containing multiple form widgets.\n */\nvar FormGroup = /** @class */ (function () {\n /**\n * Creates a new `FormGroup`.\n * @param contents The form widgets to include in the form group.\n * @param label The label to display for the form group.\n */\n function FormGroup(contents, label) {\n var _this = this;\n this.labelElement = Dom_1.$$('span', { className: 'coveo-form-group-label' });\n this.labelElement.text(label);\n this.element = Dom_1.$$('fieldset', { className: 'coveo-form-group' }, this.labelElement);\n _.each(contents, function (content) {\n _this.element.append(content.build());\n });\n }\n FormGroup.doExport = function () {\n GlobalExports_1.exportGlobally({\n FormGroup: FormGroup\n });\n };\n /**\n * Gets the element on which the form group is bound.\n * @returns {HTMLElement} The form group element.\n */\n FormGroup.prototype.build = function () {\n return this.element.el;\n };\n return FormGroup;\n}());\nexports.FormGroup = FormGroup;\n\n\n/***/ }),\n\n/***/ 193:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Dom_1 = __webpack_require__(1);\nvar _ = __webpack_require__(0);\nvar Strings_1 = __webpack_require__(6);\n__webpack_require__(578);\nvar Utils_1 = __webpack_require__(4);\nvar GlobalExports_1 = __webpack_require__(3);\n/**\n * A multi select widget with standard styling.\n */\nvar MultiSelect = /** @class */ (function () {\n /**\n * Creates a new `MultiSelect`.\n * @param onChange The function to call when the widget selected values change. This function takes the current\n * `MultiSelect` instance as an argument.\n * @param options The values which can be selected with the multi select.\n * @param label The label to display for the multi select.\n */\n function MultiSelect(onChange, options, label) {\n if (onChange === void 0) { onChange = function (multiSelect) { }; }\n this.onChange = onChange;\n this.options = options;\n this.label = label;\n this.buildContent();\n }\n MultiSelect.doExport = function () {\n GlobalExports_1.exportGlobally({\n MultiSelect: MultiSelect\n });\n };\n /**\n * Gets the element on which the multi select is bound.\n * @returns {HTMLSelectElement} The multi select element.\n */\n MultiSelect.prototype.build = function () {\n return this.element;\n };\n /**\n * Gets the element on which the multi select is bound.\n * @returns {HTMLSelectElement} The multi select element.\n */\n MultiSelect.prototype.getElement = function () {\n return this.element;\n };\n /**\n * Gets the currently selected values.\n * @returns {string[]} The array of selected multi select values.\n */\n MultiSelect.prototype.getValue = function () {\n return _.chain(this.element.options)\n .toArray()\n .filter(function (opt) { return opt.selected; })\n .map(function (selected) { return selected.value; })\n .value();\n };\n /**\n * Gets the currently un-selected values.\n * @returns {string[]} The array of un-selected multi select values.\n */\n MultiSelect.prototype.getUnselectedValues = function () {\n return _.chain(this.element.options)\n .toArray()\n .filter(function (opt) { return !opt.selected; })\n .map(function (selected) { return selected.value; })\n .value();\n };\n /**\n * Sets the currently selected values.\n * @param values The values to select.\n */\n MultiSelect.prototype.setValue = function (values) {\n var currentlySelected = this.getValue();\n var currentStateSplit = _.partition(_.toArray(this.element.options), function (opt) {\n return _.contains(currentlySelected, opt.value);\n });\n var newStateToApplySplit = _.partition(_.toArray(this.element.options), function (opt) { return _.contains(values, opt.value); });\n _.each(newStateToApplySplit[0], function (toSelect) { return (toSelect.selected = true); });\n _.each(newStateToApplySplit[1], function (toUnSelect) { return (toUnSelect.selected = false); });\n var hasChanged = false;\n if (!Utils_1.Utils.arrayEqual(currentStateSplit[0], newStateToApplySplit[0], false)) {\n hasChanged = true;\n }\n if (!Utils_1.Utils.arrayEqual(currentStateSplit[1], newStateToApplySplit[1], false)) {\n hasChanged = true;\n }\n if (hasChanged) {\n Dom_1.$$(this.element).trigger('change');\n }\n };\n /**\n * Resets the multi select.\n */\n MultiSelect.prototype.reset = function () {\n var currentlySelected = this.getValue();\n this.element.selectedIndex = -1;\n if (!Utils_1.Utils.isEmptyArray(currentlySelected)) {\n Dom_1.$$(this.element).trigger('change');\n }\n };\n MultiSelect.prototype.buildContent = function () {\n var _this = this;\n this.element = Dom_1.$$('select', {\n className: 'coveo-multi-select',\n multiple: '',\n size: this.options.length.toString()\n }).el;\n var optgroup = Dom_1.$$('optgroup', {\n className: 'coveo-list-group',\n label: this.label\n });\n var options = _.map(this.options, function (opt) {\n return Dom_1.$$('option', { value: opt, className: 'coveo-list-item' }, Strings_1.l(opt));\n });\n _.each(options, function (opt) { return optgroup.append(opt.el); });\n this.element.appendChild(optgroup.el);\n Dom_1.$$(this.element).on('change', function () { return _this.onChange(_this); });\n };\n return MultiSelect;\n}());\nexports.MultiSelect = MultiSelect;\n\n\n/***/ }),\n\n/***/ 275:\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__(665);\nvar _ = __webpack_require__(0);\nvar BreadcrumbEvents_1 = __webpack_require__(35);\nvar InitializationEvents_1 = __webpack_require__(17);\nvar PreferencesPanelEvents_1 = __webpack_require__(100);\nvar QueryEvents_1 = __webpack_require__(11);\nvar GlobalExports_1 = __webpack_require__(3);\nvar Model_1 = __webpack_require__(18);\nvar QueryStateModel_1 = __webpack_require__(13);\nvar Strings_1 = __webpack_require__(6);\nvar AccessibilityUtils_1 = __webpack_require__(48);\nvar AccessibleButton_1 = __webpack_require__(15);\nvar Dom_1 = __webpack_require__(1);\nvar LocalStorageUtils_1 = __webpack_require__(41);\nvar SVGDom_1 = __webpack_require__(16);\nvar SVGIcons_1 = __webpack_require__(12);\nvar Utils_1 = __webpack_require__(4);\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 Checkbox_1 = __webpack_require__(65);\nvar FormGroup_1 = __webpack_require__(139);\nvar MultiSelect_1 = __webpack_require__(193);\nvar TextInput_1 = __webpack_require__(56);\n/**\n * The `ResultFiltersPreferences` component allows end users to create custom filters to apply to queries. These filters\n * are saved to local storage.\n *\n * Only advanced end users who understand the Coveo query syntax should use this feature (see\n * [Coveo Query Syntax Reference](https://docs.coveo.com/en/1552/searching-with-coveo/coveo-cloud-query-syntax)).\n *\n * This component is normally accessible through the [`Settings`]{@link Settings} menu. Its usual location in the DOM is\n * inside the [`PreferencesPanel`]{@link PreferencesPanel} element.\n *\n * See also the {@link ResultsPreferences} component.\n */\nvar ResultsFiltersPreferences = /** @class */ (function (_super) {\n __extends(ResultsFiltersPreferences, _super);\n /**\n * Creates a new `ResultsFiltersPreferences` component.\n * @param element The HTMLElement on which to instantiate the component.\n * @param options The options for the `ResultsFiltersPreferences` 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 ResultsFiltersPreferences(element, options, bindings) {\n var _this = _super.call(this, element, ResultsFiltersPreferences.ID, bindings) || this;\n _this.element = element;\n _this.options = options;\n _this.bindings = bindings;\n _this.preferencePanelCheckboxInput = {};\n _this.options = ComponentOptions_1.ComponentOptions.initComponentOptions(element, ResultsFiltersPreferences, options);\n _this.preferencePanel = Dom_1.$$(_this.element).closest(Component_1.Component.computeCssClassNameForType('PreferencesPanel'));\n if (!_this.preferencePanel) {\n _this.logger.warn(\"Cannot instantiate ResultsFilterPreferences, as there is no \\\"CoveoPreferencesPanel\\\" in your page !\");\n return _this;\n }\n _this.preferencePanelLocalStorage = new LocalStorageUtils_1.LocalStorageUtils(ResultsFiltersPreferences.ID);\n _this.mergeLocalPreferencesWithStaticPreferences();\n _this.bindPreferencePanelEvent();\n _this.bindBreadcrumbEvent();\n _this.bindQueryEvent();\n // We need to wait after all components are initialized before building the dom, because this component interacts with Tab\n // And we don't know if Tab(s) are initialized before or after this component.\n _this.bind.oneRootElement(InitializationEvents_1.InitializationEvents.afterComponentsInitialization, function () { return _this.createDom(); });\n _this.bind.oneQueryState(Model_1.MODEL_EVENTS.CHANGE_ONE, QueryStateModel_1.QUERY_STATE_ATTRIBUTES.T, function () { return _this.fromPreferencesToCheckboxInput(); });\n return _this;\n }\n ResultsFiltersPreferences.prototype.createDom = function () {\n this.container = new FormGroup_1.FormGroup([], Strings_1.l('ResultsFilteringExpression')).build();\n this.element.appendChild(this.container);\n this.buildCheckboxesInput();\n if (this.options.showAdvancedFilters) {\n this.buildAdvancedFilters();\n }\n };\n ResultsFiltersPreferences.prototype.save = function () {\n this.fromCheckboxInputToPreferences();\n var toSave = _.omit(this.preferences, 'tab');\n this.logger.info('Saving preferences', toSave);\n this.preferencePanelLocalStorage.save(toSave);\n };\n ResultsFiltersPreferences.prototype.exitWithoutSave = function () {\n this.fromPreferencesToCheckboxInput();\n this.hideAdvancedFilterBuilder();\n };\n ResultsFiltersPreferences.prototype.bindPreferencePanelEvent = function () {\n var _this = this;\n this.bind.on(this.preferencePanel, PreferencesPanelEvents_1.PreferencesPanelEvents.savePreferences, function () { return _this.save(); });\n this.bind.on(this.preferencePanel, PreferencesPanelEvents_1.PreferencesPanelEvents.exitPreferencesWithoutSave, function () { return _this.exitWithoutSave(); });\n };\n ResultsFiltersPreferences.prototype.bindBreadcrumbEvent = function () {\n var _this = this;\n if (this.options.includeInBreadcrumb) {\n this.bind.onRootElement(BreadcrumbEvents_1.BreadcrumbEvents.populateBreadcrumb, function (args) {\n return _this.handlePopulateBreadcrumb(args);\n });\n this.bind.onRootElement(BreadcrumbEvents_1.BreadcrumbEvents.clearBreadcrumb, function () { return _this.handleClearBreadcrumb(); });\n }\n };\n ResultsFiltersPreferences.prototype.bindQueryEvent = function () {\n var _this = this;\n this.bind.onRootElement(QueryEvents_1.QueryEvents.buildingQuery, function (args) { return _this.handleBuildingQuery(args); });\n };\n ResultsFiltersPreferences.prototype.handleBuildingQuery = function (args) {\n _.each(this.getActiveFilters(), function (filter) {\n if (Utils_1.Utils.isNonEmptyString(filter.expression)) {\n args.queryBuilder.advancedExpression.add(filter.expression);\n }\n });\n };\n ResultsFiltersPreferences.prototype.handlePopulateBreadcrumb = function (args) {\n var actives = this.getActiveFilters();\n if (Utils_1.Utils.isNonEmptyArray(actives)) {\n var container = Dom_1.$$('div', { className: 'coveo-results-filter-preferences-breadcrumb' });\n var title = Dom_1.$$(AccessibilityUtils_1.getHeadingTag(args.headingLevel, 'span'), { className: 'coveo-title' });\n title.text(Strings_1.l('FiltersInYourPreferences') + ':');\n container.el.appendChild(title.el);\n var valuesContainer = Dom_1.$$('span', { className: 'coveo-values' });\n container.el.appendChild(valuesContainer.el);\n for (var i = 0; i < actives.length; i++) {\n valuesContainer.el.appendChild(this.buildBreadcrumb(actives[i]));\n }\n args.breadcrumbs.push({ element: container.el });\n }\n };\n ResultsFiltersPreferences.prototype.handleClearBreadcrumb = function () {\n this.isFullBreadcrumbClear = true;\n _.each(this.getActiveFilters(), function (filter) {\n filter.selected = false;\n });\n this.fromPreferencesToCheckboxInput();\n this.isFullBreadcrumbClear = false;\n };\n ResultsFiltersPreferences.prototype.buildAdvancedFilters = function () {\n var _this = this;\n this.advancedFilters = Dom_1.$$('div', { className: 'coveo-advanced-filters' }, Strings_1.l('Create')).el;\n new AccessibleButton_1.AccessibleButton()\n .withElement(this.advancedFilters)\n .withoutLabelOrTitle()\n .withSelectAction(function () { return _this.openAdvancedFilterSectionOrSaveFilters(); })\n .build();\n this.buildAdvancedFilterInput();\n this.buildAdvancedFilterFormValidate();\n this.advancedFiltersBuilder = Dom_1.$$('div', { className: 'coveo-advanced-filters-builder' }).el;\n this.advancedFiltersBuilder.appendChild(this.advancedFilterFormValidate);\n var onlineHelp = Dom_1.$$('a', {\n href: 'https://docs.coveo.com/en/2053/index-content/inspect-items-with-the-content-browser#result-filtering-expressions',\n className: 'coveo-online-help'\n }, '?');\n var title = Dom_1.$$(this.container).find('.coveo-form-group-label');\n onlineHelp.insertAfter(title);\n Dom_1.$$(this.advancedFilters).insertAfter(title);\n this.container.appendChild(this.advancedFiltersBuilder);\n };\n ResultsFiltersPreferences.prototype.buildAdvancedFilterInput = function () {\n this.advancedFiltersTextInputCaption = new TextInput_1.TextInput(function () { }, Strings_1.l('Caption'));\n this.advancedFiltersTextInputCaption.getInput().setAttribute('required', '');\n this.advancedFiltersTextInputExpression = new TextInput_1.TextInput(function () { }, Strings_1.l('Expression'));\n this.advancedFiltersTextInputExpression.getInput().setAttribute('required', '');\n this.advancedFiltersTabSelect = new MultiSelect_1.MultiSelect(function () { }, this.getAllTabs(), Strings_1.l('Tab'));\n };\n ResultsFiltersPreferences.prototype.buildAdvancedFilterFormValidate = function () {\n var _this = this;\n this.advancedFilterFormValidate = Dom_1.$$('form').el;\n var formSubmit = Dom_1.$$('input', {\n type: 'submit'\n });\n var saveFormButton = Dom_1.$$('span', {\n className: 'coveo-save'\n }, SVGIcons_1.SVGIcons.icons.save);\n SVGDom_1.SVGDom.addClassToSVGInContainer(saveFormButton.el, 'coveo-save-svg');\n new AccessibleButton_1.AccessibleButton()\n .withElement(saveFormButton.el)\n .withLabel(Strings_1.l('Save'))\n .withSelectAction(function () { return formSubmit.el.click(); })\n .build();\n var closeFormButton = Dom_1.$$('span', {\n className: 'coveo-close'\n }, SVGIcons_1.SVGIcons.icons.close);\n SVGDom_1.SVGDom.addClassToSVGInContainer(closeFormButton.el, 'coveo-close-svg');\n new AccessibleButton_1.AccessibleButton()\n .withElement(closeFormButton.el)\n .withLabel(Strings_1.l('Close'))\n .withSelectAction(function () { return _this.hideAdvancedFilterBuilder(); })\n .build();\n var saveAndCloseContainer = Dom_1.$$('div', {\n className: 'coveo-choice-container coveo-close-and-save'\n });\n saveAndCloseContainer.el.appendChild(saveFormButton.el);\n saveAndCloseContainer.el.appendChild(closeFormButton.el);\n var inputCaption = this.advancedFiltersTextInputCaption.build();\n Dom_1.$$(inputCaption).addClass('coveo-caption');\n var filtersTabSelect = this.advancedFiltersTabSelect.build();\n Dom_1.$$(filtersTabSelect).addClass('coveo-tab');\n var filtersExpression = this.advancedFiltersTextInputExpression.build();\n Dom_1.$$(filtersExpression).addClass('coveo-expression');\n _.each([inputCaption, filtersExpression, filtersTabSelect, saveAndCloseContainer.el, formSubmit.el], function (el) {\n _this.advancedFilterFormValidate.appendChild(el);\n });\n Dom_1.$$(this.advancedFilterFormValidate).on('submit', function (e) { return _this.validateAndSaveAdvancedFilter(e); });\n };\n ResultsFiltersPreferences.prototype.getAllTabs = function () {\n var tabRef = Component_1.Component.getComponentRef('Tab');\n if (tabRef) {\n var tabsElement = Dom_1.$$(this.root).findAll('.' + Component_1.Component.computeCssClassName(tabRef));\n return _.map(tabsElement, function (tabElement) {\n var tab = Component_1.Component.get(tabElement);\n return tab.options.id;\n });\n }\n else {\n return [];\n }\n };\n ResultsFiltersPreferences.prototype.getPreferencesBoxInputToBuild = function () {\n return _.map(this.preferences, function (filter) {\n return {\n label: filter.caption,\n tab: filter.tab,\n expression: filter.expression\n };\n });\n };\n ResultsFiltersPreferences.prototype.buildCheckboxesInput = function () {\n var _this = this;\n if (this.preferenceContainer != undefined) {\n this.preferenceContainer.remove();\n }\n var toBuild = this.getPreferencesBoxInputToBuild();\n if (Utils_1.Utils.isNonEmptyArray(toBuild)) {\n this.preferenceContainer = Dom_1.$$('div', {\n className: 'coveo-choices-container'\n }).el;\n _.each(toBuild, function (filterToBuild) {\n var checkbox = new Checkbox_1.Checkbox(function (checkbox) {\n _this.save();\n var filter = _this.preferences[checkbox.getValue()];\n if (!_this.queryController.firstQuery && !_this.isFullBreadcrumbClear) {\n _this.fromFilterToAnalyticsEvent(filter, filter.selected ? 'selected' : 'unselected');\n _this.queryController.executeQuery({\n closeModalBox: false\n });\n }\n }, filterToBuild.label);\n Dom_1.$$(checkbox.build()).addClass('coveo-choice-container');\n _this.preferencePanelCheckboxInput[filterToBuild.label] = checkbox;\n _this.preferenceContainer.appendChild(checkbox.getElement());\n });\n _.each(Dom_1.$$(this.preferenceContainer).findAll('.coveo-choice-container'), function (choiceContainer) {\n choiceContainer.appendChild(Dom_1.$$('div', { className: 'coveo-section coveo-section-edit-delete' }).el);\n });\n Dom_1.$$(this.container).append(this.preferenceContainer);\n this.buildEditAdvancedFilter();\n this.buildDeleteAdvancedFilter();\n this.fromPreferencesToCheckboxInput();\n }\n };\n ResultsFiltersPreferences.prototype.buildDeleteAdvancedFilter = function () {\n var _this = this;\n _.each(this.preferences, function (filter) {\n if (filter.custom) {\n var deleteElement = Dom_1.$$('span', {\n className: 'coveo-delete'\n }, SVGIcons_1.SVGIcons.icons.delete).el;\n new AccessibleButton_1.AccessibleButton()\n .withElement(deleteElement)\n .withLabel(Strings_1.l('Delete'))\n .withSelectAction(function () { return _this.confirmDelete(filter, filterElement_1); })\n .build();\n SVGDom_1.SVGDom.addClassToSVGInContainer(deleteElement, 'coveo-delete-svg');\n var filterElement_1 = _this.getFilterElementByCaption(filter.caption);\n var insertInto = Dom_1.$$(filterElement_1).find('.coveo-section-edit-delete');\n insertInto.appendChild(deleteElement);\n }\n });\n };\n ResultsFiltersPreferences.prototype.buildEditAdvancedFilter = function () {\n var _this = this;\n _.each(this.preferences, function (filter) {\n if (filter.custom) {\n var editElement = Dom_1.$$('span', {\n className: 'coveo-edit'\n }, SVGIcons_1.SVGIcons.icons.edit);\n new AccessibleButton_1.AccessibleButton()\n .withElement(editElement)\n .withLabel(Strings_1.l('Edit'))\n .withSelectAction(function () { return _this.editElement(filter, filterElement_2); })\n .build();\n SVGDom_1.SVGDom.addClassToSVGInContainer(editElement.el, 'coveo-edit-svg');\n var filterElement_2 = _this.getFilterElementByCaption(filter.caption);\n var insertInto = Dom_1.$$(filterElement_2).find('.coveo-section-edit-delete');\n insertInto.appendChild(editElement.el);\n }\n });\n };\n ResultsFiltersPreferences.prototype.buildBreadcrumb = function (filter) {\n var _this = this;\n var elem = Dom_1.$$('span', { className: 'coveo-value' });\n var caption = Dom_1.$$('span', { className: 'coveo-caption' });\n caption.text(filter.caption);\n elem.el.appendChild(caption.el);\n var clear = Dom_1.$$('span', { className: 'coveo-clear' }, SVGIcons_1.SVGIcons.icons.mainClear);\n elem.el.appendChild(clear.el);\n var onSelectAction = function () {\n filter.selected = false;\n _this.fromFilterToAnalyticsEvent(filter, 'cleared from breadcrumb');\n _this.fromPreferencesToCheckboxInput();\n };\n new AccessibleButton_1.AccessibleButton().withElement(elem).withLabel(Strings_1.l('RemoveFilterOn', filter.caption)).withSelectAction(onSelectAction).build();\n return elem.el;\n };\n ResultsFiltersPreferences.prototype.confirmDelete = function (filter, filterElement) {\n if (confirm(Strings_1.l('AreYouSureDeleteFilter', filter.caption, filter.expression))) {\n var isSelected = filter.selected;\n this.deleteFilterPreference(filter, filterElement);\n if (isSelected) {\n this.fromFilterToAnalyticsEvent(filter, 'deleted');\n this.queryController.executeQuery({\n closeModalBox: false\n });\n }\n }\n };\n ResultsFiltersPreferences.prototype.editElement = function (filter, filterElement) {\n var oldCaption = this.preferences[filter.caption].caption;\n var oldTab = this.preferences[filter.caption].tab;\n var oldExpression = this.preferences[filter.caption].expression;\n this.deleteFilterPreference(filter, filterElement);\n this.openAdvancedFilterSectionOrSaveFilters();\n this.populateEditSection({ tab: oldTab, caption: oldCaption, expression: oldExpression });\n };\n ResultsFiltersPreferences.prototype.populateEditSection = function (toPopulate) {\n if (toPopulate === void 0) { toPopulate = { tab: [''], caption: '', expression: '' }; }\n this.advancedFiltersTextInputCaption.setValue(toPopulate.caption);\n this.advancedFiltersTextInputExpression.setValue(toPopulate.expression);\n this.advancedFiltersTabSelect.setValue(toPopulate.tab);\n };\n ResultsFiltersPreferences.prototype.deleteFilterPreference = function (filter, filterElement) {\n this.preferencePanelLocalStorage.remove(filter.caption);\n delete this.preferences[filter.caption];\n Dom_1.$$(Dom_1.$$(filterElement).closest('.coveo-choice-container')).detach();\n };\n ResultsFiltersPreferences.prototype.openAdvancedFilterSectionOrSaveFilters = function () {\n if (Dom_1.$$(this.advancedFiltersBuilder).hasClass('coveo-active')) {\n Dom_1.$$(Dom_1.$$(this.advancedFilterFormValidate).find('input[type=submit]')).trigger('click');\n this.hideAdvancedFilterBuilder();\n }\n else {\n this.populateEditSection();\n this.showAdvancedFilterBuilder();\n }\n };\n ResultsFiltersPreferences.prototype.validateAndSaveAdvancedFilter = function (e) {\n e.preventDefault();\n this.hideAdvancedFilterBuilder();\n var caption = this.advancedFiltersTextInputCaption.getValue();\n var expression = this.advancedFiltersTextInputExpression.getValue();\n var tabs = this.advancedFiltersTabSelect.getValue();\n this.preferences[caption] = {\n caption: caption,\n custom: true,\n expression: expression,\n tab: tabs,\n selected: true\n };\n this.buildCheckboxesInput();\n this.save();\n this.queryStateModel.set(QueryStateModel_1.QueryStateModel.attributesEnum.t, this.getActiveTab());\n this.advancedFiltersTextInputCaption.reset();\n this.advancedFiltersTextInputExpression.reset();\n this.advancedFiltersTabSelect.reset();\n this.container.appendChild(this.advancedFiltersBuilder);\n this.fromFilterToAnalyticsEvent(this.preferences[caption], 'saved');\n this.queryController.executeQuery({\n closeModalBox: false\n });\n };\n ResultsFiltersPreferences.prototype.fromPreferencesToCheckboxInput = function () {\n var _this = this;\n _.each(this.getActiveFilters(), function (filter) {\n _this.preferencePanelCheckboxInput[filter.caption].select();\n });\n _.each(this.getInactiveFilters(), function (filter) {\n _this.preferencePanelCheckboxInput[filter.caption].reset();\n });\n _.each(this.getDormantFilters(), function (filter) {\n _this.preferencePanelCheckboxInput[filter.caption].select();\n });\n };\n ResultsFiltersPreferences.prototype.fromCheckboxInputToPreferences = function () {\n if (this.preferencePanelCheckboxInput) {\n var selecteds_1 = _.map(_.filter(this.preferencePanelCheckboxInput, function (checkbox) { return checkbox.isSelected(); }), function (selected) { return selected.getValue(); });\n _.each(this.preferences, function (filter) {\n if (_.contains(selecteds_1, filter.caption)) {\n filter.selected = true;\n }\n else {\n filter.selected = false;\n }\n });\n }\n };\n ResultsFiltersPreferences.prototype.getDormantFilters = function () {\n var _this = this;\n var activeTab = this.getActiveTab();\n return _.filter(this.preferences, function (filter) {\n return filter.selected && !_this.filterIsInActiveTab(filter, activeTab);\n });\n };\n ResultsFiltersPreferences.prototype.getActiveFilters = function () {\n var _this = this;\n var activeTab = this.getActiveTab();\n return _.filter(this.preferences, function (filter) {\n return filter.selected && _this.filterIsInActiveTab(filter, activeTab);\n });\n };\n ResultsFiltersPreferences.prototype.getInactiveFilters = function () {\n var _this = this;\n var activeTab = this.getActiveTab();\n return _.filter(this.preferences, function (filter) {\n return !filter.selected || !_this.filterIsInActiveTab(filter, activeTab);\n });\n };\n ResultsFiltersPreferences.prototype.getActiveTab = function () {\n return this.queryStateModel.get(QueryStateModel_1.QueryStateModel.attributesEnum.t);\n };\n ResultsFiltersPreferences.prototype.filterIsInActiveTab = function (filter, tab) {\n filter.tab = _.compact(filter.tab);\n return _.contains(filter.tab, tab) || Utils_1.Utils.isEmptyArray(filter.tab);\n };\n ResultsFiltersPreferences.prototype.getFilterElementByCaption = function (caption) {\n return Dom_1.$$(this.preferenceContainer).find(\"input[value='\" + caption.replace(/'/g, \"\\\\'\") + \"']\").parentElement;\n };\n ResultsFiltersPreferences.prototype.fromResultsFilterOptionToResultsPreferenceInterface = function () {\n var ret = {};\n _.each(this.options.filters, function (filter, caption) {\n ret[caption] = {\n expression: filter.expression,\n tab: filter.tab,\n selected: filter.selected ? filter.selected : false,\n custom: false,\n caption: caption\n };\n });\n return ret;\n };\n ResultsFiltersPreferences.prototype.mergeLocalPreferencesWithStaticPreferences = function () {\n var staticPreferences = this.fromResultsFilterOptionToResultsPreferenceInterface();\n var localPreferences = this.preferencePanelLocalStorage.load();\n var localPreferencesWithoutRemoved = _.filter(localPreferences, function (preference) {\n var isCustom = preference.custom;\n var existsInStatic = _.find(staticPreferences, function (staticPreference) {\n return staticPreference.caption == preference.caption;\n });\n return isCustom || existsInStatic != undefined;\n });\n var localToMerge = {};\n _.each(localPreferencesWithoutRemoved, function (filter) {\n localToMerge[filter.caption] = {\n expression: filter.expression,\n tab: filter.tab,\n selected: filter.selected,\n custom: filter.custom,\n caption: filter.caption\n };\n });\n this.preferences = Utils_1.Utils.extendDeep(staticPreferences, localToMerge);\n };\n ResultsFiltersPreferences.prototype.fromFilterToAnalyticsEvent = function (filter, type) {\n this.usageAnalytics.logSearchEvent(AnalyticsActionListMeta_1.analyticsActionCauseList.customfiltersChange, {\n customFilterName: filter.caption,\n customFilterExpression: filter.expression,\n customFilterType: type\n });\n };\n ResultsFiltersPreferences.prototype.enlargeModalBox = function () {\n var modalBoxContainer = Dom_1.$$(document.body).find('.coveo-modal-container');\n if (modalBoxContainer) {\n Dom_1.$$(modalBoxContainer).addClass('coveo-mod-big');\n }\n };\n ResultsFiltersPreferences.prototype.shrinkModalBox = function () {\n var modalBoxContainer = Dom_1.$$(document.body).find('.coveo-modal-container');\n if (modalBoxContainer) {\n Dom_1.$$(modalBoxContainer).removeClass('coveo-mod-big');\n }\n };\n ResultsFiltersPreferences.prototype.showAdvancedFilterBuilder = function () {\n if (this.advancedFiltersBuilder) {\n Dom_1.$$(this.advancedFiltersBuilder).addClass('coveo-active');\n this.enlargeModalBox();\n }\n };\n ResultsFiltersPreferences.prototype.hideAdvancedFilterBuilder = function () {\n if (this.advancedFiltersBuilder) {\n Dom_1.$$(this.advancedFiltersBuilder).removeClass('coveo-active');\n this.shrinkModalBox();\n }\n };\n ResultsFiltersPreferences.ID = 'ResultsFiltersPreferences';\n ResultsFiltersPreferences.doExport = function () {\n GlobalExports_1.exportGlobally({\n ResultsFiltersPreferences: ResultsFiltersPreferences\n });\n };\n /**\n * The options for the component\n * @componentOptions\n */\n ResultsFiltersPreferences.options = {\n /**\n * Specifies whether to display the active filter(s) in the [`Breadcrumb`]{@link Breadcrumb}.\n *\n * Default value is `true`.\n */\n includeInBreadcrumb: ComponentOptions_1.ComponentOptions.buildBooleanOption({ defaultValue: true }),\n /**\n * Specifies whether to show the **Create** button that allows the end user to create filters.\n *\n * If you set this option to `false`, only the pre-populated\n * [`filters`]{@link ResultsFiltersPreferences.options.filters} are available to the end user.\n *\n * Default value is `true`.\n */\n showAdvancedFilters: ComponentOptions_1.ComponentOptions.buildBooleanOption({ defaultValue: true }),\n /**\n * Specifies the default filters which all end users can apply.\n *\n * End users cannot modify or delete these filters. These filters do not count as \"user-made\" filters, but rather as\n * \"built-in\" filters created by the developer of the search page.\n *\n * **Note:**\n * > You cannot set this option directly in the component markup as an HTML attribute. You must either set it in the\n * > [`init`]{@link init} call of your search interface (see\n * > [Passing Component Options in the init Call](https://docs.coveo.com/en/346/#passing-component-options-in-the-init-call)),\n * > or before the `init` call, using the `options` top-level function (see\n * > [Passing Component Options Before the init Call](https://docs.coveo.com/en/346/#passing-component-options-before-the-init-call)).\n *\n * Filters should follow this definition:\n *\n * `filters : { [caption : string] : { expression : string, tab? : string[] } }`;\n *\n * **Example:**\n *\n * var myFilters = {\n * \"Only Google Drive Items\" : {\n * expression : \"@connectortype == 'GoogleDriveCrawler'\",\n * tab : [\"Tab1\", \"Tab2\"]\n * },\n *\n * \"Another Filter\" : {\n * expression : [ ... another expression ... ]\n * },\n *\n * [ ... ]\n * };\n *\n * ```javascript\n * // You can set the option in the 'init' call:\n * Coveo.init(document.querySelector(\"#search\"), {\n * ResultsFiltersPreferences : {\n * filters : myFilters\n * }\n * });\n *\n * // Or before the 'init' call, using the 'options' top-level function:\n * // Coveo.options(document.querySelector(\"#search\"), {\n * // ResultsFiltersPreferences : {\n * filters : myFilters\n * }\n * // });\n * ```\n *\n * Default value is `undefined`.\n */\n filters: ComponentOptions_1.ComponentOptions.buildJsonOption()\n };\n return ResultsFiltersPreferences;\n}(Component_1.Component));\nexports.ResultsFiltersPreferences = ResultsFiltersPreferences;\nInitialization_1.Initialization.registerAutoCreateComponent(ResultsFiltersPreferences);\n\n\n/***/ }),\n\n/***/ 566:\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ }),\n\n/***/ 578:\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ }),\n\n/***/ 665:\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ })\n\n});\n\n\n// WEBPACK FOOTER //\n// ResultsFiltersPreferences.min__d67acfe80778de2e04cc.js","import { IFormWidget } from './FormWidgets';\nimport { Dom, $$ } from '../../utils/Dom';\nimport * as _ from 'underscore';\n\nimport 'styling/vapor/_FormGroup';\nimport { exportGlobally } from '../../GlobalExports';\n\n/**\n * A simple `fieldset` HTMLElement containing multiple form widgets.\n */\nexport class FormGroup {\n private element: Dom;\n public labelElement: Dom;\n\n static doExport() {\n exportGlobally({\n FormGroup: FormGroup\n });\n }\n\n /**\n * Creates a new `FormGroup`.\n * @param contents The form widgets to include in the form group.\n * @param label The label to display for the form group.\n */\n constructor(contents: IFormWidget[], label: string) {\n this.labelElement = $$('span', { className: 'coveo-form-group-label' });\n this.labelElement.text(label);\n this.element = $$('fieldset', { className: 'coveo-form-group' }, this.labelElement);\n _.each(contents, (content: IFormWidget) => {\n this.element.append(content.build());\n });\n }\n\n /**\n * Gets the element on which the form group is bound.\n * @returns {HTMLElement} The form group element.\n */\n public build(): HTMLElement {\n return this.element.el;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/FormWidgets/FormGroup.ts","import { IFormWidget, IFormWidgetSettable } from './FormWidgets';\nimport { $$ } from '../../utils/Dom';\nimport * as _ from 'underscore';\nimport { l } from '../../strings/Strings';\nimport 'styling/vapor/_MultiSelect';\nimport { Utils } from '../../utils/Utils';\nimport { exportGlobally } from '../../GlobalExports';\n\n/**\n * A multi select widget with standard styling.\n */\nexport class MultiSelect implements IFormWidget, IFormWidgetSettable {\n private element: HTMLSelectElement;\n\n static doExport() {\n exportGlobally({\n MultiSelect: MultiSelect\n });\n }\n\n /**\n * Creates a new `MultiSelect`.\n * @param onChange The function to call when the widget selected values change. This function takes the current\n * `MultiSelect` instance as an argument.\n * @param options The values which can be selected with the multi select.\n * @param label The label to display for the multi select.\n */\n constructor(\n public onChange: (multiSelect: MultiSelect) => void = (multiSelect: MultiSelect) => {},\n public options: string[],\n public label: string\n ) {\n this.buildContent();\n }\n\n /**\n * Gets the element on which the multi select is bound.\n * @returns {HTMLSelectElement} The multi select element.\n */\n public build(): HTMLElement {\n return this.element;\n }\n\n /**\n * Gets the element on which the multi select is bound.\n * @returns {HTMLSelectElement} The multi select element.\n */\n public getElement(): HTMLElement {\n return this.element;\n }\n\n /**\n * Gets the currently selected values.\n * @returns {string[]} The array of selected multi select values.\n */\n public getValue(): string[] {\n return _.chain(<any>this.element.options)\n .toArray()\n .filter((opt: HTMLOptionElement) => opt.selected)\n .map((selected: HTMLOptionElement) => selected.value)\n .value();\n }\n\n /**\n * Gets the currently un-selected values.\n * @returns {string[]} The array of un-selected multi select values.\n */\n public getUnselectedValues(): string[] {\n return _.chain(<any>this.element.options)\n .toArray()\n .filter((opt: HTMLOptionElement) => !opt.selected)\n .map((selected: HTMLOptionElement) => selected.value)\n .value();\n }\n\n /**\n * Sets the currently selected values.\n * @param values The values to select.\n */\n public setValue(values: string[]) {\n const currentlySelected = this.getValue();\n\n const currentStateSplit = _.partition(_.toArray(this.element.options), (opt: HTMLOptionElement) =>\n _.contains(currentlySelected, opt.value)\n );\n const newStateToApplySplit = _.partition(_.toArray(this.element.options), (opt: HTMLOptionElement) => _.contains(values, opt.value));\n\n _.each(newStateToApplySplit[0], (toSelect: HTMLOptionElement) => (toSelect.selected = true));\n _.each(newStateToApplySplit[1], (toUnSelect: HTMLOptionElement) => (toUnSelect.selected = false));\n\n let hasChanged = false;\n if (!Utils.arrayEqual(currentStateSplit[0], newStateToApplySplit[0], false)) {\n hasChanged = true;\n }\n if (!Utils.arrayEqual(currentStateSplit[1], newStateToApplySplit[1], false)) {\n hasChanged = true;\n }\n\n if (hasChanged) {\n $$(this.element).trigger('change');\n }\n }\n\n /**\n * Resets the multi select.\n */\n public reset() {\n const currentlySelected = this.getValue();\n this.element.selectedIndex = -1;\n if (!Utils.isEmptyArray(currentlySelected)) {\n $$(this.element).trigger('change');\n }\n }\n\n private buildContent() {\n this.element = <HTMLSelectElement>$$('select', {\n className: 'coveo-multi-select',\n multiple: '',\n size: this.options.length.toString()\n }).el;\n const optgroup = $$('optgroup', {\n className: 'coveo-list-group',\n label: this.label\n });\n const options = _.map(this.options, opt => {\n return $$('option', { value: opt, className: 'coveo-list-item' }, l(opt));\n });\n _.each(options, opt => optgroup.append(opt.el));\n this.element.appendChild(optgroup.el);\n $$(this.element).on('change', () => this.onChange(this));\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/FormWidgets/MultiSelect.ts","import 'styling/_ResultsFiltersPreferences';\nimport * as _ from 'underscore';\nimport { BreadcrumbEvents, IPopulateBreadcrumbEventArgs } from '../../events/BreadcrumbEvents';\nimport { InitializationEvents } from '../../events/InitializationEvents';\nimport { PreferencesPanelEvents } from '../../events/PreferencesPanelEvents';\nimport { IBuildingQueryEventArgs, QueryEvents } from '../../events/QueryEvents';\nimport { exportGlobally } from '../../GlobalExports';\nimport { MODEL_EVENTS } from '../../models/Model';\nimport { QueryStateModel, QUERY_STATE_ATTRIBUTES } from '../../models/QueryStateModel';\nimport { l } from '../../strings/Strings';\nimport { getHeadingTag } from '../../utils/AccessibilityUtils';\nimport { AccessibleButton } from '../../utils/AccessibleButton';\nimport { $$ } from '../../utils/Dom';\nimport { LocalStorageUtils } from '../../utils/LocalStorageUtils';\nimport { SVGDom } from '../../utils/SVGDom';\nimport { SVGIcons } from '../../utils/SVGIcons';\nimport { Utils } from '../../utils/Utils';\nimport { analyticsActionCauseList, IAnalyticsCustomFiltersChangeMeta } from '../Analytics/AnalyticsActionListMeta';\nimport { Component } from '../Base/Component';\nimport { IComponentBindings } from '../Base/ComponentBindings';\nimport { ComponentOptions } from '../Base/ComponentOptions';\nimport { Initialization } from '../Base/Initialization';\nimport { Checkbox } from '../FormWidgets/Checkbox';\nimport { FormGroup } from '../FormWidgets/FormGroup';\nimport { MultiSelect } from '../FormWidgets/MultiSelect';\nimport { TextInput } from '../FormWidgets/TextInput';\nimport { Tab } from '../Tab/Tab';\n\nexport interface IResultFilterPreference {\n selected?: boolean;\n custom?: boolean;\n tab?: string[];\n caption: string;\n expression: string;\n}\n\nexport interface IResultsFiltersPreferencesOptions {\n filters?: {\n [caption: string]: { expression: string; tab?: string[] };\n };\n includeInBreadcrumb?: boolean;\n showAdvancedFilters?: boolean;\n}\n\n/**\n * The `ResultFiltersPreferences` component allows end users to create custom filters to apply to queries. These filters\n * are saved to local storage.\n *\n * Only advanced end users who understand the Coveo query syntax should use this feature (see\n * [Coveo Query Syntax Reference](https://docs.coveo.com/en/1552/searching-with-coveo/coveo-cloud-query-syntax)).\n *\n * This component is normally accessible through the [`Settings`]{@link Settings} menu. Its usual location in the DOM is\n * inside the [`PreferencesPanel`]{@link PreferencesPanel} element.\n *\n * See also the {@link ResultsPreferences} component.\n */\nexport class ResultsFiltersPreferences extends Component {\n static ID = 'ResultsFiltersPreferences';\n\n static doExport = () => {\n exportGlobally({\n ResultsFiltersPreferences: ResultsFiltersPreferences\n });\n };\n\n /**\n * The options for the component\n * @componentOptions\n */\n static options: IResultsFiltersPreferencesOptions = {\n /**\n * Specifies whether to display the active filter(s) in the [`Breadcrumb`]{@link Breadcrumb}.\n *\n * Default value is `true`.\n */\n includeInBreadcrumb: ComponentOptions.buildBooleanOption({ defaultValue: true }),\n\n /**\n * Specifies whether to show the **Create** button that allows the end user to create filters.\n *\n * If you set this option to `false`, only the pre-populated\n * [`filters`]{@link ResultsFiltersPreferences.options.filters} are available to the end user.\n *\n * Default value is `true`.\n */\n showAdvancedFilters: ComponentOptions.buildBooleanOption({ defaultValue: true }),\n\n /**\n * Specifies the default filters which all end users can apply.\n *\n * End users cannot modify or delete these filters. These filters do not count as \"user-made\" filters, but rather as\n * \"built-in\" filters created by the developer of the search page.\n *\n * **Note:**\n * > You cannot set this option directly in the component markup as an HTML attribute. You must either set it in the\n * > [`init`]{@link init} call of your search interface (see\n * > [Passing Component Options in the init Call](https://docs.coveo.com/en/346/#passing-component-options-in-the-init-call)),\n * > or before the `init` call, using the `options` top-level function (see\n * > [Passing Component Options Before the init Call](https://docs.coveo.com/en/346/#passing-component-options-before-the-init-call)).\n *\n * Filters should follow this definition:\n *\n * `filters : { [caption : string] : { expression : string, tab? : string[] } }`;\n *\n * **Example:**\n *\n * var myFilters = {\n * \"Only Google Drive Items\" : {\n * expression : \"@connectortype == 'GoogleDriveCrawler'\",\n * tab : [\"Tab1\", \"Tab2\"]\n * },\n *\n * \"Another Filter\" : {\n * expression : [ ... another expression ... ]\n * },\n *\n * [ ... ]\n * };\n *\n * ```javascript\n * // You can set the option in the 'init' call:\n * Coveo.init(document.querySelector(\"#search\"), {\n * ResultsFiltersPreferences : {\n * filters : myFilters\n * }\n * });\n *\n * // Or before the 'init' call, using the 'options' top-level function:\n * // Coveo.options(document.querySelector(\"#search\"), {\n * // ResultsFiltersPreferences : {\n * filters : myFilters\n * }\n * // });\n * ```\n *\n * Default value is `undefined`.\n */\n filters: <any>ComponentOptions.buildJsonOption()\n };\n\n public preferences: { [caption: string]: IResultFilterPreference };\n public container: HTMLFieldSetElement;\n private preferencePanelLocalStorage: LocalStorageUtils<{ [caption: string]: IResultFilterPreference }>;\n private preferencePanel: HTMLElement;\n private preferenceContainer: HTMLElement;\n private preferencePanelCheckboxInput: { [caption: string]: Checkbox } = {};\n private advancedFilters: HTMLElement;\n private advancedFiltersBuilder: HTMLElement;\n private advancedFiltersTextInputCaption: TextInput;\n private advancedFiltersTextInputExpression: TextInput;\n private advancedFiltersTabSelect: MultiSelect;\n private advancedFilterFormValidate: HTMLFormElement;\n private isFullBreadcrumbClear: boolean;\n\n /**\n * Creates a new `ResultsFiltersPreferences` component.\n * @param element The HTMLElement on which to instantiate the component.\n * @param options The options for the `ResultsFiltersPreferences` 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: IResultsFiltersPreferencesOptions, public bindings: IComponentBindings) {\n super(element, ResultsFiltersPreferences.ID, bindings);\n\n this.options = ComponentOptions.initComponentOptions(element, ResultsFiltersPreferences, options);\n\n this.preferencePanel = $$(this.element).closest(Component.computeCssClassNameForType('PreferencesPanel'));\n if (!this.preferencePanel) {\n this.logger.warn(`Cannot instantiate ResultsFilterPreferences, as there is no \"CoveoPreferencesPanel\" in your page !`);\n return;\n }\n this.preferencePanelLocalStorage = new LocalStorageUtils<{ [caption: string]: IResultFilterPreference }>(ResultsFiltersPreferences.ID);\n this.mergeLocalPreferencesWithStaticPreferences();\n\n this.bindPreferencePanelEvent();\n this.bindBreadcrumbEvent();\n this.bindQueryEvent();\n\n // We need to wait after all components are initialized before building the dom, because this component interacts with Tab\n // And we don't know if Tab(s) are initialized before or after this component.\n this.bind.oneRootElement(InitializationEvents.afterComponentsInitialization, () => this.createDom());\n\n this.bind.oneQueryState(MODEL_EVENTS.CHANGE_ONE, QUERY_STATE_ATTRIBUTES.T, () => this.fromPreferencesToCheckboxInput());\n }\n\n public createDom() {\n this.container = <HTMLFieldSetElement>new FormGroup([], l('ResultsFilteringExpression')).build();\n this.element.appendChild(this.container);\n this.buildCheckboxesInput();\n if (this.options.showAdvancedFilters) {\n this.buildAdvancedFilters();\n }\n }\n\n public save() {\n this.fromCheckboxInputToPreferences();\n const toSave = _.omit(this.preferences, 'tab');\n this.logger.info('Saving preferences', toSave);\n this.preferencePanelLocalStorage.save(toSave);\n }\n\n public exitWithoutSave() {\n this.fromPreferencesToCheckboxInput();\n this.hideAdvancedFilterBuilder();\n }\n\n private bindPreferencePanelEvent() {\n this.bind.on(this.preferencePanel, PreferencesPanelEvents.savePreferences, () => this.save());\n this.bind.on(this.preferencePanel, PreferencesPanelEvents.exitPreferencesWithoutSave, () => this.exitWithoutSave());\n }\n\n private bindBreadcrumbEvent() {\n if (this.options.includeInBreadcrumb) {\n this.bind.onRootElement(BreadcrumbEvents.populateBreadcrumb, (args: IPopulateBreadcrumbEventArgs) =>\n this.handlePopulateBreadcrumb(args)\n );\n this.bind.onRootElement(BreadcrumbEvents.clearBreadcrumb, () => this.handleClearBreadcrumb());\n }\n }\n\n private bindQueryEvent() {\n this.bind.onRootElement(QueryEvents.buildingQuery, (args: IBuildingQueryEventArgs) => this.handleBuildingQuery(args));\n }\n\n private handleBuildingQuery(args: IBuildingQueryEventArgs) {\n _.each(this.getActiveFilters(), filter => {\n if (Utils.isNonEmptyString(filter.expression)) {\n args.queryBuilder.advancedExpression.add(filter.expression);\n }\n });\n }\n\n private handlePopulateBreadcrumb(args: IPopulateBreadcrumbEventArgs) {\n const actives = this.getActiveFilters();\n if (Utils.isNonEmptyArray(actives)) {\n const container = $$('div', { className: 'coveo-results-filter-preferences-breadcrumb' });\n const title = $$(getHeadingTag(args.headingLevel, 'span'), { className: 'coveo-title' });\n title.text(l('FiltersInYourPreferences') + ':');\n container.el.appendChild(title.el);\n\n const valuesContainer = $$('span', { className: 'coveo-values' });\n container.el.appendChild(valuesContainer.el);\n\n for (var i = 0; i < actives.length; i++) {\n valuesContainer.el.appendChild(this.buildBreadcrumb(actives[i]));\n }\n args.breadcrumbs.push({ element: container.el });\n }\n }\n\n private handleClearBreadcrumb() {\n this.isFullBreadcrumbClear = true;\n _.each(this.getActiveFilters(), filter => {\n filter.selected = false;\n });\n this.fromPreferencesToCheckboxInput();\n this.isFullBreadcrumbClear = false;\n }\n\n private buildAdvancedFilters() {\n this.advancedFilters = $$('div', { className: 'coveo-advanced-filters' }, l('Create')).el;\n new AccessibleButton()\n .withElement(this.advancedFilters)\n .withoutLabelOrTitle()\n .withSelectAction(() => this.openAdvancedFilterSectionOrSaveFilters())\n .build();\n\n this.buildAdvancedFilterInput();\n this.buildAdvancedFilterFormValidate();\n this.advancedFiltersBuilder = $$('div', { className: 'coveo-advanced-filters-builder' }).el;\n this.advancedFiltersBuilder.appendChild(this.advancedFilterFormValidate);\n const onlineHelp = $$(\n 'a',\n {\n href: 'https://docs.coveo.com/en/2053/index-content/inspect-items-with-the-content-browser#result-filtering-expressions',\n className: 'coveo-online-help'\n },\n '?'\n );\n\n const title = $$(this.container).find('.coveo-form-group-label');\n\n onlineHelp.insertAfter(title);\n $$(this.advancedFilters).insertAfter(title);\n this.container.appendChild(this.advancedFiltersBuilder);\n }\n\n private buildAdvancedFilterInput() {\n this.advancedFiltersTextInputCaption = new TextInput(() => {}, l('Caption'));\n\n this.advancedFiltersTextInputCaption.getInput().setAttribute('required', '');\n\n this.advancedFiltersTextInputExpression = new TextInput(() => {}, l('Expression'));\n\n this.advancedFiltersTextInputExpression.getInput().setAttribute('required', '');\n\n this.advancedFiltersTabSelect = new MultiSelect(() => {}, this.getAllTabs(), l('Tab'));\n }\n\n private buildAdvancedFilterFormValidate() {\n this.advancedFilterFormValidate = <HTMLFormElement>$$('form').el;\n\n const formSubmit = $$('input', {\n type: 'submit'\n });\n\n const saveFormButton = $$(\n 'span',\n {\n className: 'coveo-save'\n },\n SVGIcons.icons.save\n );\n SVGDom.addClassToSVGInContainer(saveFormButton.el, 'coveo-save-svg');\n new AccessibleButton()\n .withElement(saveFormButton.el)\n .withLabel(l('Save'))\n .withSelectAction(() => formSubmit.el.click())\n .build();\n\n const closeFormButton = $$(\n 'span',\n {\n className: 'coveo-close'\n },\n SVGIcons.icons.close\n );\n SVGDom.addClassToSVGInContainer(closeFormButton.el, 'coveo-close-svg');\n new AccessibleButton()\n .withElement(closeFormButton.el)\n .withLabel(l('Close'))\n .withSelectAction(() => this.hideAdvancedFilterBuilder())\n .build();\n\n const saveAndCloseContainer = $$('div', {\n className: 'coveo-choice-container coveo-close-and-save'\n });\n\n saveAndCloseContainer.el.appendChild(saveFormButton.el);\n saveAndCloseContainer.el.appendChild(closeFormButton.el);\n\n const inputCaption = this.advancedFiltersTextInputCaption.build();\n $$(inputCaption).addClass('coveo-caption');\n\n const filtersTabSelect = this.advancedFiltersTabSelect.build();\n $$(filtersTabSelect).addClass('coveo-tab');\n\n const filtersExpression = this.advancedFiltersTextInputExpression.build();\n $$(filtersExpression).addClass('coveo-expression');\n\n _.each([inputCaption, filtersExpression, filtersTabSelect, saveAndCloseContainer.el, formSubmit.el], (el: HTMLElement) => {\n this.advancedFilterFormValidate.appendChild(el);\n });\n\n $$(this.advancedFilterFormValidate).on('submit', (e: Event) => this.validateAndSaveAdvancedFilter(e));\n }\n\n private getAllTabs() {\n const tabRef = Component.getComponentRef('Tab');\n if (tabRef) {\n const tabsElement = $$(this.root).findAll('.' + Component.computeCssClassName(tabRef));\n return _.map(tabsElement, (tabElement: HTMLElement) => {\n let tab = <Tab>Component.get(tabElement);\n return tab.options.id;\n });\n } else {\n return [];\n }\n }\n\n private getPreferencesBoxInputToBuild() {\n return _.map(this.preferences, (filter: IResultFilterPreference) => {\n return {\n label: filter.caption,\n tab: filter.tab,\n expression: filter.expression\n };\n });\n }\n\n private buildCheckboxesInput() {\n if (this.preferenceContainer != undefined) {\n this.preferenceContainer.remove();\n }\n const toBuild = this.getPreferencesBoxInputToBuild();\n if (Utils.isNonEmptyArray(toBuild)) {\n this.preferenceContainer = $$('div', {\n className: 'coveo-choices-container'\n }).el;\n\n _.each(toBuild, filterToBuild => {\n const checkbox = new Checkbox((checkbox: Checkbox) => {\n this.save();\n const filter = this.preferences[checkbox.getValue()];\n\n if (!this.queryController.firstQuery && !this.isFullBreadcrumbClear) {\n this.fromFilterToAnalyticsEvent(filter, filter.selected ? 'selected' : 'unselected');\n this.queryController.executeQuery({\n closeModalBox: false\n });\n }\n }, filterToBuild.label);\n $$(checkbox.build()).addClass('coveo-choice-container');\n this.preferencePanelCheckboxInput[filterToBuild.label] = checkbox;\n this.preferenceContainer.appendChild(checkbox.getElement());\n });\n\n _.each($$(this.preferenceContainer).findAll('.coveo-choice-container'), (choiceContainer: HTMLElement) => {\n choiceContainer.appendChild($$('div', { className: 'coveo-section coveo-section-edit-delete' }).el);\n });\n\n $$(this.container).append(this.preferenceContainer);\n this.buildEditAdvancedFilter();\n this.buildDeleteAdvancedFilter();\n this.fromPreferencesToCheckboxInput();\n }\n }\n\n private buildDeleteAdvancedFilter() {\n _.each(this.preferences, filter => {\n if (filter.custom) {\n const deleteElement = $$(\n 'span',\n {\n className: 'coveo-delete'\n },\n SVGIcons.icons.delete\n ).el;\n new AccessibleButton()\n .withElement(deleteElement)\n .withLabel(l('Delete'))\n .withSelectAction(() => this.confirmDelete(filter, filterElement))\n .build();\n SVGDom.addClassToSVGInContainer(deleteElement, 'coveo-delete-svg');\n const filterElement = this.getFilterElementByCaption(filter.caption);\n const insertInto = $$(filterElement).find('.coveo-section-edit-delete');\n insertInto.appendChild(deleteElement);\n }\n });\n }\n\n private buildEditAdvancedFilter() {\n _.each(this.preferences, filter => {\n if (filter.custom) {\n const editElement = $$(\n 'span',\n {\n className: 'coveo-edit'\n },\n SVGIcons.icons.edit\n );\n new AccessibleButton()\n .withElement(editElement)\n .withLabel(l('Edit'))\n .withSelectAction(() => this.editElement(filter, filterElement))\n .build();\n SVGDom.addClassToSVGInContainer(editElement.el, 'coveo-edit-svg');\n const filterElement = this.getFilterElementByCaption(filter.caption);\n const insertInto = $$(filterElement).find('.coveo-section-edit-delete');\n insertInto.appendChild(editElement.el);\n }\n });\n }\n\n private buildBreadcrumb(filter: IResultFilterPreference): HTMLElement {\n const elem = $$('span', { className: 'coveo-value' });\n\n const caption = $$('span', { className: 'coveo-caption' });\n caption.text(filter.caption);\n elem.el.appendChild(caption.el);\n\n const clear = $$('span', { className: 'coveo-clear' }, SVGIcons.icons.mainClear);\n elem.el.appendChild(clear.el);\n\n const onSelectAction = () => {\n filter.selected = false;\n this.fromFilterToAnalyticsEvent(filter, 'cleared from breadcrumb');\n this.fromPreferencesToCheckboxInput();\n };\n\n new AccessibleButton().withElement(elem).withLabel(l('RemoveFilterOn', filter.caption)).withSelectAction(onSelectAction).build();\n\n return elem.el;\n }\n\n private confirmDelete(filter: IResultFilterPreference, filterElement: HTMLElement) {\n if (confirm(l('AreYouSureDeleteFilter', filter.caption, filter.expression))) {\n const isSelected = filter.selected;\n this.deleteFilterPreference(filter, filterElement);\n if (isSelected) {\n this.fromFilterToAnalyticsEvent(filter, 'deleted');\n this.queryController.executeQuery({\n closeModalBox: false\n });\n }\n }\n }\n\n private editElement(filter: IResultFilterPreference, filterElement: HTMLElement) {\n const oldCaption = this.preferences[filter.caption].caption;\n const oldTab = this.preferences[filter.caption].tab;\n const oldExpression = this.preferences[filter.caption].expression;\n this.deleteFilterPreference(filter, filterElement);\n this.openAdvancedFilterSectionOrSaveFilters();\n this.populateEditSection({ tab: oldTab, caption: oldCaption, expression: oldExpression });\n }\n\n private populateEditSection(toPopulate = { tab: [''], caption: '', expression: '' }) {\n this.advancedFiltersTextInputCaption.setValue(toPopulate.caption);\n this.advancedFiltersTextInputExpression.setValue(toPopulate.expression);\n this.advancedFiltersTabSelect.setValue(toPopulate.tab);\n }\n\n private deleteFilterPreference(filter: IResultFilterPreference, filterElement: HTMLElement) {\n this.preferencePanelLocalStorage.remove(filter.caption);\n delete this.preferences[filter.caption];\n $$($$(filterElement).closest('.coveo-choice-container')).detach();\n }\n\n private openAdvancedFilterSectionOrSaveFilters() {\n if ($$(this.advancedFiltersBuilder).hasClass('coveo-active')) {\n $$($$(this.advancedFilterFormValidate).find('input[type=submit]')).trigger('click');\n this.hideAdvancedFilterBuilder();\n } else {\n this.populateEditSection();\n this.showAdvancedFilterBuilder();\n }\n }\n\n private validateAndSaveAdvancedFilter(e: Event) {\n e.preventDefault();\n this.hideAdvancedFilterBuilder();\n const caption = this.advancedFiltersTextInputCaption.getValue();\n const expression = this.advancedFiltersTextInputExpression.getValue();\n const tabs = this.advancedFiltersTabSelect.getValue();\n this.preferences[caption] = {\n caption: caption,\n custom: true,\n expression: expression,\n tab: tabs,\n selected: true\n };\n this.buildCheckboxesInput();\n this.save();\n this.queryStateModel.set(QueryStateModel.attributesEnum.t, this.getActiveTab());\n this.advancedFiltersTextInputCaption.reset();\n this.advancedFiltersTextInputExpression.reset();\n this.advancedFiltersTabSelect.reset();\n this.container.appendChild(this.advancedFiltersBuilder);\n this.fromFilterToAnalyticsEvent(this.preferences[caption], 'saved');\n this.queryController.executeQuery({\n closeModalBox: false\n });\n }\n\n private fromPreferencesToCheckboxInput() {\n _.each(this.getActiveFilters(), (filter: IResultFilterPreference) => {\n this.preferencePanelCheckboxInput[filter.caption].select();\n });\n _.each(this.getInactiveFilters(), (filter: IResultFilterPreference) => {\n this.preferencePanelCheckboxInput[filter.caption].reset();\n });\n _.each(this.getDormantFilters(), (filter: IResultFilterPreference) => {\n this.preferencePanelCheckboxInput[filter.caption].select();\n });\n }\n\n private fromCheckboxInputToPreferences() {\n if (this.preferencePanelCheckboxInput) {\n const selecteds = _.map(\n _.filter(this.preferencePanelCheckboxInput, (checkbox: Checkbox) => checkbox.isSelected()),\n (selected: Checkbox) => selected.getValue()\n );\n _.each(this.preferences, (filter: IResultFilterPreference) => {\n if (_.contains(selecteds, filter.caption)) {\n filter.selected = true;\n } else {\n filter.selected = false;\n }\n });\n }\n }\n\n private getDormantFilters() {\n const activeTab = this.getActiveTab();\n return _.filter(this.preferences, (filter: IResultFilterPreference) => {\n return filter.selected && !this.filterIsInActiveTab(filter, activeTab);\n });\n }\n\n private getActiveFilters() {\n const activeTab = this.getActiveTab();\n return _.filter(this.preferences, (filter: IResultFilterPreference) => {\n return filter.selected && this.filterIsInActiveTab(filter, activeTab);\n });\n }\n\n private getInactiveFilters() {\n const activeTab = this.getActiveTab();\n return _.filter(this.preferences, (filter: IResultFilterPreference) => {\n return !filter.selected || !this.filterIsInActiveTab(filter, activeTab);\n });\n }\n\n private getActiveTab() {\n return this.queryStateModel.get(QueryStateModel.attributesEnum.t);\n }\n\n private filterIsInActiveTab(filter: IResultFilterPreference, tab: string) {\n filter.tab = _.compact(filter.tab);\n return _.contains(filter.tab, tab) || Utils.isEmptyArray(filter.tab);\n }\n\n private getFilterElementByCaption(caption: string): HTMLElement {\n return $$(this.preferenceContainer).find(\"input[value='\" + caption.replace(/'/g, \"\\\\'\") + \"']\").parentElement;\n }\n\n private fromResultsFilterOptionToResultsPreferenceInterface() {\n const ret: { [key: string]: IResultFilterPreference } = {};\n _.each(<any>this.options.filters, (filter: { expression: string; tab?: string[]; selected?: boolean }, caption: string) => {\n ret[caption] = {\n expression: filter.expression,\n tab: filter.tab,\n selected: filter.selected ? filter.selected : false,\n custom: false,\n caption: caption\n };\n });\n return ret;\n }\n\n private mergeLocalPreferencesWithStaticPreferences() {\n const staticPreferences = this.fromResultsFilterOptionToResultsPreferenceInterface();\n const localPreferences = this.preferencePanelLocalStorage.load();\n const localPreferencesWithoutRemoved = _.filter<IResultFilterPreference>(localPreferences, preference => {\n const isCustom = preference.custom;\n const existsInStatic = _.find<IResultFilterPreference>(staticPreferences, staticPreference => {\n return staticPreference.caption == preference.caption;\n });\n return isCustom || existsInStatic != undefined;\n });\n\n const localToMerge = {};\n _.each(localPreferencesWithoutRemoved, (filter: IResultFilterPreference) => {\n localToMerge[filter.caption] = {\n expression: filter.expression,\n tab: filter.tab,\n selected: filter.selected,\n custom: filter.custom,\n caption: filter.caption\n };\n });\n this.preferences = <{ [caption: string]: IResultFilterPreference }>Utils.extendDeep(staticPreferences, localToMerge);\n }\n\n private fromFilterToAnalyticsEvent(filter: IResultFilterPreference, type: string) {\n this.usageAnalytics.logSearchEvent<IAnalyticsCustomFiltersChangeMeta>(analyticsActionCauseList.customfiltersChange, {\n customFilterName: filter.caption,\n customFilterExpression: filter.expression,\n customFilterType: type\n });\n }\n\n private enlargeModalBox() {\n const modalBoxContainer = $$(document.body).find('.coveo-modal-container');\n if (modalBoxContainer) {\n $$(modalBoxContainer).addClass('coveo-mod-big');\n }\n }\n\n private shrinkModalBox() {\n const modalBoxContainer = $$(document.body).find('.coveo-modal-container');\n if (modalBoxContainer) {\n $$(modalBoxContainer).removeClass('coveo-mod-big');\n }\n }\n\n private showAdvancedFilterBuilder() {\n if (this.advancedFiltersBuilder) {\n $$(this.advancedFiltersBuilder).addClass('coveo-active');\n this.enlargeModalBox();\n }\n }\n\n private hideAdvancedFilterBuilder() {\n if (this.advancedFiltersBuilder) {\n $$(this.advancedFiltersBuilder).removeClass('coveo-active');\n this.shrinkModalBox();\n }\n }\n}\n\nInitialization.registerAutoCreateComponent(ResultsFiltersPreferences);\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/ResultsFiltersPreferences/ResultsFiltersPreferences.ts"],"sourceRoot":""}