@appbaseio/reactivesearch-vue 3.0.4 → 3.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,8 +23,8 @@ import ReactiveBase from './ReactiveBase.js';
23
23
  import hotkeys from 'hotkeys-js';
24
24
  import xss from 'xss';
25
25
  import { Remarkable } from 'remarkable';
26
- import { I as IconWrapper, C as CancelSvg, a as IconGroup, B as ButtonIconWrapper, D as Downshift, b as InputWrapper } from './DropDown-0075753d.js';
27
- import { n as noSuggestions, T as TextArea, I as Input, s as suggestionsContainer, A as Actions$1, a as suggestions, b as searchboxSuggestions } from './Input-a36286ea.js';
26
+ import { I as IconWrapper, C as CancelSvg, a as IconGroup, B as ButtonIconWrapper, D as Downshift, b as InputWrapper } from './DropDown-6d1dddde.js';
27
+ import { n as noSuggestions, T as TextArea, I as Input, s as suggestionsContainer, A as Actions$1, a as suggestions, b as searchboxSuggestions } from './Input-1f6207bc.js';
28
28
  import { C as Container } from './Container-d00219f7.js';
29
29
  import Highlight from 'vue-highlight-words';
30
30
  import { fetchAIResponse, createAISession } from '@appbaseio/reactivecore/lib/actions/query';
@@ -1301,7 +1301,23 @@ var SearchBox = defineComponent({
1301
1301
  AIUIConfig: types.AIUIConfig
1302
1302
  },
1303
1303
  mounted: function mounted() {
1304
+ var _this = this;
1304
1305
  this.listenForFocusShortcuts();
1306
+ var dropdownEle = this.$refs[_dropdownULRef];
1307
+ if (dropdownEle) {
1308
+ var handleScroll = function handleScroll() {
1309
+ var scrollTop = dropdownEle.scrollTop;
1310
+ _this.lastScrollTop = scrollTop;
1311
+ if (scrollTop < _this.lastScrollTop) {
1312
+ // User is scrolling up
1313
+ clearInterval(_this.scrollTimerRef);
1314
+ _this.isUserScrolling = true;
1315
+ }
1316
+ // Update lastScrollTop with the current scroll position
1317
+ _this.lastScrollTop = scrollTop;
1318
+ };
1319
+ dropdownEle.addEventListener('scroll', handleScroll);
1320
+ }
1305
1321
  },
1306
1322
  updated: function updated() {
1307
1323
  if (this.$props.mode === SEARCH_COMPONENTS_MODES.SELECT && this.$options.isTagsMode === true) {
@@ -1437,9 +1453,10 @@ var SearchBox = defineComponent({
1437
1453
  }
1438
1454
  },
1439
1455
  isAITyping: function isAITyping(newVal, oldVal) {
1440
- var _this = this;
1456
+ var _this2 = this;
1441
1457
  var scrollAIContainer = function scrollAIContainer() {
1442
- var dropdownEle = _this.$refs[_dropdownULRef];
1458
+ if (_this2.isUserScrolling) return;
1459
+ var dropdownEle = _this2.$refs[_dropdownULRef];
1443
1460
  if (dropdownEle) {
1444
1461
  dropdownEle.scrollTo({
1445
1462
  top: dropdownEle.scrollHeight,
@@ -1448,6 +1465,7 @@ var SearchBox = defineComponent({
1448
1465
  }
1449
1466
  };
1450
1467
  if (!newVal && oldVal) {
1468
+ clearInterval(this.scrollTimerRef);
1451
1469
  this.showAIScreenFooter = true;
1452
1470
  if (this.$props.AIUIConfig && typeof this.$props.AIUIConfig.showFeedback === 'boolean' ? this.$props.AIUIConfig.showFeedback : true) {
1453
1471
  this.showFeedbackComponent = true;
@@ -1456,7 +1474,7 @@ var SearchBox = defineComponent({
1456
1474
  scrollAIContainer();
1457
1475
  }, 500);
1458
1476
  } else if (newVal) {
1459
- this.scrollTimerRef = setTimeout(function () {
1477
+ this.scrollTimerRef = setInterval(function () {
1460
1478
  scrollAIContainer();
1461
1479
  }, 2000);
1462
1480
  }
@@ -1548,7 +1566,7 @@ var SearchBox = defineComponent({
1548
1566
  }
1549
1567
  },
1550
1568
  setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue, shouldExecuteQuery) {
1551
- var _this2 = this;
1569
+ var _this3 = this;
1552
1570
  if (isDefaultValue === void 0) {
1553
1571
  isDefaultValue = false;
1554
1572
  }
@@ -1565,65 +1583,65 @@ var SearchBox = defineComponent({
1565
1583
  shouldExecuteQuery = true;
1566
1584
  }
1567
1585
  var performUpdate = function performUpdate() {
1568
- if (_this2.$options.isTagsMode && isEqual(value, _this2.selectedTags)) {
1586
+ if (_this3.$options.isTagsMode && isEqual(value, _this3.selectedTags)) {
1569
1587
  return;
1570
1588
  }
1571
- if (_this2.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1572
- if (Array.isArray(_this2.selectedTags) && _this2.selectedTags.length) {
1589
+ if (_this3.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1590
+ if (Array.isArray(_this3.selectedTags) && _this3.selectedTags.length) {
1573
1591
  // check if value already present in selectedTags
1574
- if (typeof value === 'string' && _this2.selectedTags.includes(value)) {
1575
- _this2.isOpen = false;
1592
+ if (typeof value === 'string' && _this3.selectedTags.includes(value)) {
1593
+ _this3.isOpen = false;
1576
1594
  return;
1577
1595
  }
1578
- _this2.selectedTags = [].concat(_this2.selectedTags);
1596
+ _this3.selectedTags = [].concat(_this3.selectedTags);
1579
1597
  if (typeof value === 'string' && !!value) {
1580
- _this2.selectedTags.push(value);
1581
- } else if (Array.isArray(value) && !isEqual(_this2.selectedTags, value)) {
1582
- _this2.selectedTags = value;
1598
+ _this3.selectedTags.push(value);
1599
+ } else if (Array.isArray(value) && !isEqual(_this3.selectedTags, value)) {
1600
+ _this3.selectedTags = value;
1583
1601
  }
1584
1602
  } else if (value) {
1585
- _this2.selectedTags = typeof value !== 'string' ? value : [].concat(value);
1603
+ _this3.selectedTags = typeof value !== 'string' ? value : [].concat(value);
1586
1604
  }
1587
- _this2.currentValue = '';
1605
+ _this3.currentValue = '';
1588
1606
  } else {
1589
- _this2.currentValue = decodeHtml(value);
1607
+ _this3.currentValue = decodeHtml(value);
1590
1608
  }
1591
1609
  var queryHandlerValue = value;
1592
- if (_this2.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1593
- queryHandlerValue = Array.isArray(_this2.selectedTags) && _this2.selectedTags.length ? _this2.selectedTags : undefined;
1610
+ if (_this3.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1611
+ queryHandlerValue = Array.isArray(_this3.selectedTags) && _this3.selectedTags.length ? _this3.selectedTags : undefined;
1594
1612
  }
1595
- if ((_this2.faqAnswer || _this2.faqQuestion) && value === '') {
1613
+ if ((_this3.faqAnswer || _this3.faqQuestion) && value === '') {
1596
1614
  // Empty the previous state
1597
- _this2.faqAnswer = '';
1598
- _this2.faqQuestion = '';
1599
- _this2.showAIScreen = false;
1615
+ _this3.faqAnswer = '';
1616
+ _this3.faqQuestion = '';
1617
+ _this3.showAIScreen = false;
1600
1618
  }
1601
1619
  if (isDefaultValue) {
1602
- if (_this2.$props.autosuggest) {
1620
+ if (_this3.$props.autosuggest) {
1603
1621
  if (toggleIsOpen) {
1604
- _this2.isOpen = false;
1622
+ _this3.isOpen = false;
1605
1623
  }
1606
- if (typeof _this2.currentValue === 'string') _this2.triggerDefaultQuery(_this2.currentValue, props.enableAI && _this2.currentTriggerMode === AI_TRIGGER_MODES.QUESTION && _this2.currentValue.endsWith('?') ? {
1624
+ if (typeof _this3.currentValue === 'string') _this3.triggerDefaultQuery(_this3.currentValue, props.enableAI && _this3.currentTriggerMode === AI_TRIGGER_MODES.QUESTION && _this3.currentValue.endsWith('?') ? {
1607
1625
  enableAI: true
1608
1626
  } : {}, shouldExecuteQuery);
1609
1627
  } // in case of strict selection only SUGGESTION_SELECT should be able
1610
1628
  // to set the query otherwise the value should reset
1611
1629
  if (props.strictSelection) {
1612
- if (cause === causes.SUGGESTION_SELECT || (_this2.$options.isTagsMode ? _this2.selectedTags.length === 0 : value === '')) {
1613
- _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1630
+ if (cause === causes.SUGGESTION_SELECT || (_this3.$options.isTagsMode ? _this3.selectedTags.length === 0 : value === '')) {
1631
+ _this3.triggerCustomQuery(queryHandlerValue, _this3.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1614
1632
  } else {
1615
- _this2.setValue('', true);
1633
+ _this3.setValue('', true);
1616
1634
  }
1617
1635
  } else if (props.value === undefined || cause === causes.SUGGESTION_SELECT || cause === causes.CLEAR_VALUE) {
1618
- _this2.showAIScreen = false;
1619
- _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1636
+ _this3.showAIScreen = false;
1637
+ _this3.triggerCustomQuery(queryHandlerValue, _this3.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1620
1638
  }
1621
1639
  } else {
1622
1640
  // debounce for handling text while typing
1623
- _this2.handleTextChange(value, cause);
1641
+ _this3.handleTextChange(value, cause);
1624
1642
  }
1625
- _this2.$emit('valueChange', value);
1626
- _this2.$emit('value-change', value);
1643
+ _this3.$emit('valueChange', value);
1644
+ _this3.$emit('value-change', value);
1627
1645
  };
1628
1646
  checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
1629
1647
  },
@@ -1772,7 +1790,7 @@ var SearchBox = defineComponent({
1772
1790
  this.$emit('key-down', event, this.triggerQuery);
1773
1791
  },
1774
1792
  onInputChange: function onInputChange(e) {
1775
- var _this3 = this;
1793
+ var _this4 = this;
1776
1794
  var inputValue = e.target.value;
1777
1795
  if (!this.$data.isOpen && this.$props.autosuggest) {
1778
1796
  this.isOpen = true;
@@ -1786,7 +1804,7 @@ var SearchBox = defineComponent({
1786
1804
  } else {
1787
1805
  this.$emit('change', inputValue, function (_ref3) {
1788
1806
  var isOpen = _ref3.isOpen;
1789
- return _this3.triggerQuery({
1807
+ return _this4.triggerQuery({
1790
1808
  defaultQuery: true,
1791
1809
  customQuery: true,
1792
1810
  value: inputValue,
@@ -1830,7 +1848,7 @@ var SearchBox = defineComponent({
1830
1848
  }
1831
1849
  },
1832
1850
  onSuggestionSelected: function onSuggestionSelected(suggestion) {
1833
- var _this4 = this;
1851
+ var _this5 = this;
1834
1852
  var value = this.$props.value;
1835
1853
  // The state of the suggestion is open by the time it reaches here. i.e. isOpen = true
1836
1854
  // handle when FAQ suggestion is clicked
@@ -1879,10 +1897,10 @@ var SearchBox = defineComponent({
1879
1897
  this.setValue(emitValue, true, this.$props, causes.SUGGESTION_SELECT, false, suggestion._category);
1880
1898
  this.$emit('change', emitValue, function (_ref4) {
1881
1899
  var isOpen = _ref4.isOpen;
1882
- return _this4.triggerQuery(_extends({
1900
+ return _this5.triggerQuery(_extends({
1883
1901
  isOpen: isOpen,
1884
1902
  value: emitValue
1885
- }, !_this4.$options.isTagsMode && {
1903
+ }, !_this5.$options.isTagsMode && {
1886
1904
  categoryValue: suggestion._category
1887
1905
  }));
1888
1906
  });
@@ -1922,7 +1940,7 @@ var SearchBox = defineComponent({
1922
1940
  return null;
1923
1941
  },
1924
1942
  renderErrorComponent: function renderErrorComponent(isAIError) {
1925
- var _this5 = this;
1943
+ var _this6 = this;
1926
1944
  if (isAIError === void 0) {
1927
1945
  isAIError = false;
1928
1946
  }
@@ -1949,7 +1967,7 @@ var SearchBox = defineComponent({
1949
1967
  "themePreset": this.themePreset
1950
1968
  }, {
1951
1969
  "default": function _default() {
1952
- return [isFunction(renderError) ? renderError(_this5.error) : renderError];
1970
+ return [isFunction(renderError) ? renderError(_this6.error) : renderError];
1953
1971
  }
1954
1972
  });
1955
1973
  }
@@ -2029,7 +2047,7 @@ var SearchBox = defineComponent({
2029
2047
  });
2030
2048
  },
2031
2049
  renderEnterButtonElement: function renderEnterButtonElement() {
2032
- var _this6 = this;
2050
+ var _this7 = this;
2033
2051
  var _this$$props2 = this.$props,
2034
2052
  enterButton = _this$$props2.enterButton,
2035
2053
  innerClass = _this$$props2.innerClass;
@@ -2037,12 +2055,12 @@ var SearchBox = defineComponent({
2037
2055
  if (enterButton) {
2038
2056
  var getEnterButtonMarkup = function getEnterButtonMarkup() {
2039
2057
  if (renderEnterButton) {
2040
- return renderEnterButton(_this6.enterButtonOnClick);
2058
+ return renderEnterButton(_this7.enterButtonOnClick);
2041
2059
  }
2042
2060
  return createVNode(Button, {
2043
2061
  "class": "enter-btn " + getClassName$1(innerClass, 'enter-button'),
2044
2062
  "primary": true,
2045
- "onClick": _this6.enterButtonOnClick
2063
+ "onClick": _this7.enterButtonOnClick
2046
2064
  }, {
2047
2065
  "default": function _default() {
2048
2066
  return [createTextVNode("Search")];
@@ -2068,7 +2086,7 @@ var SearchBox = defineComponent({
2068
2086
  return '/';
2069
2087
  },
2070
2088
  renderLeftIcons: function renderLeftIcons() {
2071
- var _this7 = this;
2089
+ var _this8 = this;
2072
2090
  var _slot3;
2073
2091
  var _this$$props3 = this.$props,
2074
2092
  iconPosition = _this$$props3.iconPosition,
@@ -2078,8 +2096,8 @@ var SearchBox = defineComponent({
2078
2096
  }, {
2079
2097
  "default": function _default() {
2080
2098
  return [iconPosition === 'left' && showIcon && createVNode(IconWrapper, {
2081
- "onClick": _this7.handleSearchIconClick
2082
- }, _isSlot(_slot3 = _this7.renderIcon()) ? _slot3 : {
2099
+ "onClick": _this8.handleSearchIconClick
2100
+ }, _isSlot(_slot3 = _this8.renderIcon()) ? _slot3 : {
2083
2101
  "default": function _default() {
2084
2102
  return [_slot3];
2085
2103
  }
@@ -2088,7 +2106,7 @@ var SearchBox = defineComponent({
2088
2106
  })]);
2089
2107
  },
2090
2108
  renderRightIcons: function renderRightIcons() {
2091
- var _this8 = this;
2109
+ var _this9 = this;
2092
2110
  var _slot4, _slot5, _slot6;
2093
2111
  var _this$$props4 = this.$props,
2094
2112
  iconPosition = _this$$props4.iconPosition,
@@ -2105,29 +2123,29 @@ var SearchBox = defineComponent({
2105
2123
  }, {
2106
2124
  "default": function _default() {
2107
2125
  return [currentValue && showClear && createVNode(IconWrapper, {
2108
- "onClick": _this8.clearValue,
2126
+ "onClick": _this9.clearValue,
2109
2127
  "showIcon": showIcon,
2110
2128
  "isClearIcon": true
2111
- }, _isSlot(_slot4 = _this8.renderCancelIcon()) ? _slot4 : {
2129
+ }, _isSlot(_slot4 = _this9.renderCancelIcon()) ? _slot4 : {
2112
2130
  "default": function _default() {
2113
2131
  return [_slot4];
2114
2132
  }
2115
2133
  }), showFocusShortcutsIcon && createVNode(ButtonIconWrapper, {
2116
2134
  "onClick": function onClick(e) {
2117
- return _this8.focusSearchBox(e);
2135
+ return _this9.focusSearchBox(e);
2118
2136
  }
2119
- }, _isSlot(_slot5 = _this8.renderShortcut()) ? _slot5 : {
2137
+ }, _isSlot(_slot5 = _this9.renderShortcut()) ? _slot5 : {
2120
2138
  "default": function _default() {
2121
2139
  return [_slot5];
2122
2140
  }
2123
2141
  }), showVoiceSearch && createVNode(Mic, {
2124
2142
  "getInstance": getMicInstance,
2125
2143
  "render": renderMic,
2126
- "handleResult": _this8.handleVoiceResults,
2144
+ "handleResult": _this9.handleVoiceResults,
2127
2145
  "className": getClassName$1(innerClass, 'mic') || null
2128
2146
  }, null), iconPosition === 'right' && showIcon && createVNode(IconWrapper, {
2129
- "onClick": _this8.handleSearchIconClick
2130
- }, _isSlot(_slot6 = _this8.renderIcon()) ? _slot6 : {
2147
+ "onClick": _this9.handleSearchIconClick
2148
+ }, _isSlot(_slot6 = _this9.renderIcon()) ? _slot6 : {
2131
2149
  "default": function _default() {
2132
2150
  return [_slot6];
2133
2151
  }
@@ -2146,7 +2164,7 @@ var SearchBox = defineComponent({
2146
2164
  (_this$$refs4 = this.$refs) == null || (_this$$refs4 = _this$$refs4[this.$props.innerRef]) == null || (_this$$refs4 = _this$$refs4.$el) == null ? void 0 : _this$$refs4.focus(); // eslint-disable-line
2147
2165
  },
2148
2166
  listenForFocusShortcuts: function listenForFocusShortcuts() {
2149
- var _this9 = this;
2167
+ var _this10 = this;
2150
2168
  var _this$$props$focusSho = this.$props.focusShortcuts,
2151
2169
  focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
2152
2170
  if (isEmpty(focusShortcuts)) {
@@ -2161,7 +2179,7 @@ var SearchBox = defineComponent({
2161
2179
  function (event, handler) {
2162
2180
  // Prevent the default refresh event under WINDOWS system
2163
2181
  event.preventDefault();
2164
- _this9.focusSearchBox(event);
2182
+ _this10.focusSearchBox(event);
2165
2183
  });
2166
2184
 
2167
2185
  // if one of modifier keys are used, they are handled below
@@ -2171,7 +2189,7 @@ var SearchBox = defineComponent({
2171
2189
  for (var index = 0; index < modifierKeys.length; index += 1) {
2172
2190
  var element = modifierKeys[index];
2173
2191
  if (hotkeys[element]) {
2174
- _this9.focusSearchBox(event);
2192
+ _this10.focusSearchBox(event);
2175
2193
  break;
2176
2194
  }
2177
2195
  }
@@ -2184,10 +2202,10 @@ var SearchBox = defineComponent({
2184
2202
  this.triggerDefaultQuery(value);
2185
2203
  },
2186
2204
  renderActionIcon: function renderActionIcon(suggestion) {
2187
- var _this10 = this;
2205
+ var _this11 = this;
2188
2206
  var handleAutoFillClick = function handleAutoFillClick(e) {
2189
2207
  e.stopPropagation();
2190
- _this10.onAutofillClick(suggestion);
2208
+ _this11.onAutofillClick(suggestion);
2191
2209
  };
2192
2210
  if (suggestion._suggestion_type === suggestionTypes.Featured) {
2193
2211
  if (suggestion.action === featuredSuggestionsActionTypes.FUNCTION) {
@@ -2210,7 +2228,7 @@ var SearchBox = defineComponent({
2210
2228
  return null;
2211
2229
  },
2212
2230
  renderTag: function renderTag(item) {
2213
- var _this11 = this;
2231
+ var _this12 = this;
2214
2232
  var innerClass = this.$props.innerClass;
2215
2233
  return createVNode(TagItem, {
2216
2234
  "class": getClassName$1(innerClass, 'selected-tag') || ''
@@ -2221,7 +2239,7 @@ var SearchBox = defineComponent({
2221
2239
  "aria-label": "delete-tag",
2222
2240
  "class": "close-icon",
2223
2241
  "onClick": function onClick() {
2224
- return _this11.clearTag(item);
2242
+ return _this12.clearTag(item);
2225
2243
  }
2226
2244
  }, [createVNode(CancelSvg, null, null)])];
2227
2245
  }
@@ -2244,7 +2262,7 @@ var SearchBox = defineComponent({
2244
2262
  }
2245
2263
  },
2246
2264
  renderTags: function renderTags() {
2247
- var _this12 = this;
2265
+ var _this13 = this;
2248
2266
  if (!Array.isArray(this.selectedTags)) {
2249
2267
  return null;
2250
2268
  }
@@ -2258,16 +2276,16 @@ var SearchBox = defineComponent({
2258
2276
  }) : createVNode(TagsContainer, null, {
2259
2277
  "default": function _default() {
2260
2278
  return [tagsList.map(function (item) {
2261
- return _this12.renderTag(item);
2279
+ return _this13.renderTag(item);
2262
2280
  }), shouldRenderClearAllTag && createVNode(TagItem, {
2263
- "class": getClassName$1(_this12.$props.innerClass, 'selected-tag') || ''
2281
+ "class": getClassName$1(_this13.$props.innerClass, 'selected-tag') || ''
2264
2282
  }, {
2265
2283
  "default": function _default() {
2266
2284
  return [createVNode("span", null, [createTextVNode("Clear All")]), createVNode("span", {
2267
2285
  "role": "img",
2268
2286
  "aria-label": "delete-tag",
2269
2287
  "class": "close-icon",
2270
- "onClick": _this12.clearAllTags
2288
+ "onClick": _this13.clearAllTags
2271
2289
  }, [createVNode(CancelSvg, null, null)])];
2272
2290
  }
2273
2291
  })];
@@ -2275,13 +2293,13 @@ var SearchBox = defineComponent({
2275
2293
  });
2276
2294
  },
2277
2295
  getAISourceObjects: function getAISourceObjects() {
2278
- var _this13 = this;
2296
+ var _this14 = this;
2279
2297
  var sourceObjects = [];
2280
2298
  if (!this.AIResponse) return sourceObjects;
2281
2299
  var docIds = this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [];
2282
2300
  if (this.initialHits) {
2283
2301
  docIds.forEach(function (id) {
2284
- var foundSourceObj = _this13.initialHits.find(function (hit) {
2302
+ var foundSourceObj = _this14.initialHits.find(function (hit) {
2285
2303
  return hit._id === id;
2286
2304
  }) || {};
2287
2305
  if (foundSourceObj) {
@@ -2315,7 +2333,7 @@ var SearchBox = defineComponent({
2315
2333
  },
2316
2334
  renderAIScreenFooter: function renderAIScreenFooter() {
2317
2335
  var _slot8;
2318
- var _this14 = this;
2336
+ var _this15 = this;
2319
2337
  var _this$$props$AIUIConf2 = this.$props.AIUIConfig,
2320
2338
  AIUIConfig = _this$$props$AIUIConf2 === void 0 ? {} : _this$$props$AIUIConf2;
2321
2339
  var _ref6 = AIUIConfig || {},
@@ -2324,11 +2342,11 @@ var SearchBox = defineComponent({
2324
2342
  _ref6$onSourceClick = _ref6.onSourceClick,
2325
2343
  onSourceClick = _ref6$onSourceClick === void 0 ? function () {} : _ref6$onSourceClick;
2326
2344
  var renderSourceDocumentLabel = function renderSourceDocumentLabel(sourceObj) {
2327
- if (_this14.$props.AIUIConfig && _this14.$props.AIUIConfig.renderSourceDocument) {
2328
- return _this14.$props.AIUIConfig.renderSourceDocument(sourceObj);
2345
+ if (_this15.$props.AIUIConfig && _this15.$props.AIUIConfig.renderSourceDocument) {
2346
+ return _this15.$props.AIUIConfig.renderSourceDocument(sourceObj);
2329
2347
  }
2330
- if (_this14.$slots.renderSourceDocument) {
2331
- return _this14.$slots.renderSourceDocument(sourceObj);
2348
+ if (_this15.$slots.renderSourceDocument) {
2349
+ return _this15.$slots.renderSourceDocument(sourceObj);
2332
2350
  }
2333
2351
  return sourceObj._id;
2334
2352
  };
@@ -2336,10 +2354,10 @@ var SearchBox = defineComponent({
2336
2354
  "themePreset": this.$props.themePreset
2337
2355
  }, {
2338
2356
  "default": function _default() {
2339
- return [createTextVNode("Summary generated using the following sources:"), ' ', createVNode(SourceTags, null, _isSlot(_slot8 = _this14.getAISourceObjects().map(function (el) {
2357
+ return [createTextVNode("Summary generated using the following sources:"), ' ', createVNode(SourceTags, null, _isSlot(_slot8 = _this15.getAISourceObjects().map(function (el) {
2340
2358
  var _slot7;
2341
2359
  return createVNode(Button, {
2342
- "class": "--ai-source-tag " + (getClassName$1(_this14.$props.innerClass, 'ai-source-tag') || ''),
2360
+ "class": "--ai-source-tag " + (getClassName$1(_this15.$props.innerClass, 'ai-source-tag') || ''),
2343
2361
  "info": true,
2344
2362
  "onClick": function onClick() {
2345
2363
  return onSourceClick && onSourceClick(el);
@@ -2358,7 +2376,7 @@ var SearchBox = defineComponent({
2358
2376
  }) : null;
2359
2377
  },
2360
2378
  renderAIScreen: function renderAIScreen() {
2361
- var _this15 = this;
2379
+ var _this16 = this;
2362
2380
  var customAIRenderer = this.$props.renderAIAnswer || this.$slots.renderAIAnswer;
2363
2381
  if (customAIRenderer) {
2364
2382
  return customAIRenderer({
@@ -2382,11 +2400,11 @@ var SearchBox = defineComponent({
2382
2400
  "hideUI": this.isAIResponseLoading || this.isLoading || !this.sessionIdFromStore,
2383
2401
  "key": this.sessionIdFromStore,
2384
2402
  "onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
2385
- _this15.feedbackState = {
2403
+ _this16.feedbackState = {
2386
2404
  isRecorded: true,
2387
2405
  feedbackType: useful ? 'positive' : 'negative'
2388
2406
  };
2389
- _this15.recordAISessionUsefulness(_this15.sessionIdFromStore, {
2407
+ _this16.recordAISessionUsefulness(_this16.sessionIdFromStore, {
2390
2408
  useful: useful,
2391
2409
  reason: reason
2392
2410
  });
@@ -2421,7 +2439,7 @@ var SearchBox = defineComponent({
2421
2439
  });
2422
2440
  },
2423
2441
  renderAskButtonElement: function renderAskButtonElement() {
2424
- var _this16 = this;
2442
+ var _this17 = this;
2425
2443
  var _this$$props5 = this.$props,
2426
2444
  AIUIConfig = _this$$props5.AIUIConfig,
2427
2445
  innerClass = _this$$props5.innerClass;
@@ -2431,12 +2449,12 @@ var SearchBox = defineComponent({
2431
2449
  if (askButton) {
2432
2450
  var getEnterButtonMarkup = function getEnterButtonMarkup() {
2433
2451
  if (renderAskButton) {
2434
- return renderAskButton(_this16.askButtonOnClick);
2452
+ return renderAskButton(_this17.askButtonOnClick);
2435
2453
  }
2436
2454
  return createVNode(Button, {
2437
2455
  "class": "enter-btn " + getClassName$1(innerClass, 'ask-button'),
2438
2456
  "info": true,
2439
- "onClick": _this16.askButtonOnClick
2457
+ "onClick": _this17.askButtonOnClick
2440
2458
  }, {
2441
2459
  "default": function _default() {
2442
2460
  return [createTextVNode("Ask")];
@@ -2451,28 +2469,28 @@ var SearchBox = defineComponent({
2451
2469
  }
2452
2470
  },
2453
2471
  render: function render() {
2454
- var _this17 = this;
2472
+ var _this18 = this;
2455
2473
  var expandSuggestionsContainer = this.$props.expandSuggestionsContainer;
2456
2474
  var _this$$slots = this.$slots,
2457
2475
  recentSearchesIcon = _this$$slots.recentSearchesIcon,
2458
2476
  popularSearchesIcon = _this$$slots.popularSearchesIcon;
2459
- var hasSuggestions = Array.isArray(this.normalizedSuggestions) && this.normalizedSuggestions.length;
2477
+ var hasSuggestions = Array.isArray(this.parsedSuggestions) && this.parsedSuggestions.length;
2460
2478
  var renderItem = this.$slots.renderItem || this.$props.renderItem;
2461
2479
  return createVNode(Container, {
2462
2480
  "class": this.$props.className
2463
2481
  }, {
2464
2482
  "default": function _default() {
2465
- return [_this17.$props.title && createVNode(Title, {
2466
- "class": getClassName$1(_this17.$props.innerClass, 'title') || ''
2483
+ return [_this18.$props.title && createVNode(Title, {
2484
+ "class": getClassName$1(_this18.$props.innerClass, 'title') || ''
2467
2485
  }, {
2468
2486
  "default": function _default() {
2469
- return [_this17.$props.title];
2487
+ return [_this18.$props.title];
2470
2488
  }
2471
- }), _this17.$props.autosuggest ? createVNode(Downshift, {
2472
- "id": _this17.$props.componentId + "-downshift",
2473
- "handleChange": _this17.onSuggestionSelected,
2474
- "handleMouseup": _this17.handleStateChange,
2475
- "isOpen": _this17.$data.isOpen
2489
+ }), _this18.$props.autosuggest ? createVNode(Downshift, {
2490
+ "id": _this18.$props.componentId + "-downshift",
2491
+ "handleChange": _this18.onSuggestionSelected,
2492
+ "handleMouseup": _this18.handleStateChange,
2493
+ "isOpen": _this18.$data.isOpen
2476
2494
  }, {
2477
2495
  "default": function _default(_ref8) {
2478
2496
  var getInputEvents = _ref8.getInputEvents,
@@ -2528,21 +2546,21 @@ var SearchBox = defineComponent({
2528
2546
  }
2529
2547
  };
2530
2548
  var indexOffset = 0;
2531
- return createVNode("div", null, [_this17.hasCustomRenderer && _this17.getComponent({
2549
+ return createVNode("div", null, [_this18.hasCustomRenderer && _this18.getComponent({
2532
2550
  isOpen: isOpen,
2533
2551
  getItemProps: getItemProps,
2534
2552
  getItemEvents: getItemEvents,
2535
2553
  highlightedIndex: highlightedIndex
2536
- }), _this17.renderErrorComponent(), !_this17.hasCustomRenderer && isOpen && hasSuggestions ? createVNode("ul", {
2537
- "class": suggestions(_this17.themePreset, _this17.theme) + " " + getClassName$1(_this17.$props.innerClass, 'list') + " " + searchboxSuggestions(_this17.themePreset, _this17.theme) + "\n\t\t\t\t\t\t\t\t\t\t\t\t\t",
2554
+ }), _this18.renderErrorComponent(), !_this18.hasCustomRenderer && isOpen && hasSuggestions ? createVNode("ul", {
2555
+ "class": suggestions(_this18.themePreset, _this18.theme) + " " + getClassName$1(_this18.$props.innerClass, 'list') + " " + searchboxSuggestions(_this18.themePreset, _this18.theme) + "\n\t\t\t\t\t\t\t\t\t\t\t\t\t",
2538
2556
  "ref": _dropdownULRef
2539
- }, [_this17.showAIScreen && createVNode(SearchBoxAISection, {
2540
- "themePreset": _this17.$props.themePreset
2557
+ }, [_this18.showAIScreen && createVNode(SearchBoxAISection, {
2558
+ "themePreset": _this18.$props.themePreset
2541
2559
  }, {
2542
2560
  "default": function _default() {
2543
- return [_this17.renderAIScreen(), ' ', _this17.renderErrorComponent(true)];
2561
+ return [_this18.renderAIScreen(), ' ', _this18.renderErrorComponent(true)];
2544
2562
  }
2545
- }), !_this17.showAIScreen && _this17.parsedSuggestions.map(function (item, itemIndex) {
2563
+ }), !_this18.showAIScreen && _this18.parsedSuggestions.map(function (item, itemIndex) {
2546
2564
  var index = indexOffset + itemIndex;
2547
2565
  if (Array.isArray(item)) {
2548
2566
  var sectionHtml = xss(item[0].sectionLabel);
@@ -2551,7 +2569,7 @@ var SearchBox = defineComponent({
2551
2569
  "key": "section-" + itemIndex,
2552
2570
  "class": "section-container"
2553
2571
  }, [sectionHtml ? createVNode("div", {
2554
- "class": "section-header " + getClassName$1(_this17.$props.innerClass, 'section-label'),
2572
+ "class": "section-header " + getClassName$1(_this18.$props.innerClass, 'section-label'),
2555
2573
  "key": "" + item[0].sectionId,
2556
2574
  "innerHTML": sectionHtml
2557
2575
  }, null) : null, createVNode("ul", {
@@ -2571,7 +2589,7 @@ var SearchBox = defineComponent({
2571
2589
  justifyContent: 'flex-start',
2572
2590
  alignItems: 'center'
2573
2591
  },
2574
- "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this17.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this17.$props.innerClass, 'suggestion-item'))
2592
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this18.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this18.$props.innerClass, 'suggestion-item'))
2575
2593
  }), [renderItem(sectionItem)]);
2576
2594
  }
2577
2595
  if (sectionItem._suggestion_type === '_internal_a_i_trigger') {
@@ -2585,9 +2603,9 @@ var SearchBox = defineComponent({
2585
2603
  justifyContent: 'flex-start',
2586
2604
  alignItems: 'center'
2587
2605
  },
2588
- "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this17.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this17.$props.innerClass, 'suggestion-item'))
2606
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this18.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this18.$props.innerClass, 'suggestion-item'))
2589
2607
  }), [createVNode(SuggestionItem, {
2590
- "currentValue": _this17.currentValue,
2608
+ "currentValue": _this18.currentValue,
2591
2609
  "suggestion": sectionItem
2592
2610
  }, null)]);
2593
2611
  }
@@ -2601,7 +2619,7 @@ var SearchBox = defineComponent({
2601
2619
  justifyContent: 'flex-start',
2602
2620
  alignItems: 'center'
2603
2621
  },
2604
- "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this17.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this17.$props.innerClass, 'suggestion-item'))
2622
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this18.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this18.$props.innerClass, 'suggestion-item'))
2605
2623
  }), [createVNode("div", {
2606
2624
  "style": {
2607
2625
  padding: '0 10px 0 0',
@@ -2609,74 +2627,74 @@ var SearchBox = defineComponent({
2609
2627
  }
2610
2628
  }, [createVNode(CustomSvg, {
2611
2629
  "key": sectionItem._suggestion_type + "-" + sectionIndex,
2612
- "className": getClassName$1(_this17.$props.innerClass, sectionItem._suggestion_type + "-search-icon") || null,
2630
+ "className": getClassName$1(_this18.$props.innerClass, sectionItem._suggestion_type + "-search-icon") || null,
2613
2631
  "icon": getIcon(sectionItem._suggestion_type, sectionItem, suggestionsHaveIcon),
2614
2632
  "type": sectionItem._suggestion_type + "-search-icon"
2615
2633
  }, null)]), createVNode(SuggestionItem, {
2616
- "currentValue": _this17.currentValue,
2634
+ "currentValue": _this18.currentValue,
2617
2635
  "suggestion": sectionItem
2618
- }, null), _this17.renderActionIcon(sectionItem)]);
2636
+ }, null), _this18.renderActionIcon(sectionItem)]);
2619
2637
  })])]);
2620
2638
  }
2621
2639
  return createVNode("div", null, [createTextVNode("No suggestions")]);
2622
- }), !_this17.showAIScreen && _this17.parsedSuggestions.length && _this17.$props.showSuggestionsFooter ? _this17.suggestionsFooter() : null]) : _this17.renderNoSuggestions(_this17.normalizedSuggestions)]);
2640
+ }), !_this18.showAIScreen && _this18.parsedSuggestions.length && _this18.$props.showSuggestionsFooter ? _this18.suggestionsFooter() : null]) : _this18.renderNoSuggestions(_this18.normalizedSuggestions)]);
2623
2641
  };
2624
2642
  return createVNode("div", {
2625
2643
  "class": suggestionsContainer
2626
2644
  }, [createVNode(InputGroup, {
2627
2645
  "searchBox": true,
2628
2646
  "ref": _inputGroupRef,
2629
- "isOpen": _this17.$data.isOpen
2647
+ "isOpen": _this18.$data.isOpen
2630
2648
  }, {
2631
2649
  "default": function _default() {
2632
2650
  return [createVNode(Actions$1, null, {
2633
2651
  "default": function _default() {
2634
- return [_this17.renderInputAddonBefore(), _this17.renderLeftIcons()];
2652
+ return [_this18.renderInputAddonBefore(), _this18.renderLeftIcons()];
2635
2653
  }
2636
2654
  }), createVNode(InputWrapper, null, {
2637
2655
  "default": function _default() {
2638
2656
  return [createVNode(TextArea, mergeProps(_transformOn(getInputEvents({
2639
- onInput: _this17.onInputChange,
2657
+ onInput: _this18.onInputChange,
2640
2658
  onBlur: function onBlur(e) {
2641
- _this17.$emit('blur', e, _this17.triggerQuery);
2659
+ _this18.$emit('blur', e, _this18.triggerQuery);
2642
2660
  },
2643
- onFocus: _this17.handleFocus,
2661
+ onFocus: _this18.handleFocus,
2644
2662
  onKeyPress: function onKeyPress(e) {
2645
- _this17.$emit('keyPress', e, _this17.triggerQuery);
2646
- _this17.$emit('key-press', e, _this17.triggerQuery);
2663
+ _this18.$emit('keyPress', e, _this18.triggerQuery);
2664
+ _this18.$emit('key-press', e, _this18.triggerQuery);
2647
2665
  },
2648
2666
  onKeyDown: function onKeyDown(e) {
2649
- return _this17.handleKeyDown(e, highlightedIndex);
2667
+ return _this18.handleKeyDown(e, highlightedIndex);
2650
2668
  },
2651
2669
  onKeyUp: function onKeyUp(e) {
2652
- _this17.$emit('keyUp', e, _this17.triggerQuery);
2653
- _this17.$emit('key-up', e, _this17.triggerQuery);
2670
+ _this18.$emit('keyUp', e, _this18.triggerQuery);
2671
+ _this18.$emit('key-up', e, _this18.triggerQuery);
2654
2672
  },
2655
2673
  onClick: function onClick() {
2656
2674
  setHighlightedIndex(null);
2657
2675
  }
2658
2676
  })), {
2659
2677
  "searchBox": true,
2660
- "isOpen": _this17.$data.isOpen,
2661
- "id": _this17.$props.componentId + "-input",
2662
- "ref": _this17.$props.innerRef,
2663
- "class": getClassName$1(_this17.$props.innerClass, 'input'),
2664
- "placeholder": _this17.$props.placeholder,
2665
- "autoFocus": _this17.$props.autoFocus
2678
+ "isOpen": _this18.$data.isOpen,
2679
+ "id": _this18.$props.componentId + "-input",
2680
+ "ref": _this18.$props.innerRef,
2681
+ "class": getClassName$1(_this18.$props.innerClass, 'input'),
2682
+ "placeholder": _this18.$props.placeholder,
2683
+ "autoFocus": _this18.$props.autoFocus
2666
2684
  }, getInputProps({
2667
- value: _this17.$data.currentValue === null ? '' : _this17.$data.currentValue
2685
+ value: _this18.$data.currentValue === null ? '' : _this18.$data.currentValue
2668
2686
  }), {
2669
- "themePreset": _this17.themePreset,
2687
+ "themePreset": _this18.themePreset,
2670
2688
  "autocomplete": "off"
2671
2689
  }), null), !expandSuggestionsContainer && renderSuggestionsDropdown()];
2672
2690
  }
2673
2691
  }), createVNode(Actions$1, null, {
2674
2692
  "default": function _default() {
2675
- return [_this17.renderRightIcons(), _this17.renderInputAddonAfter(), _this17.renderAskButtonElement(), _this17.renderEnterButtonElement()];
2693
+ return [_this18.renderRightIcons(), _this18.renderInputAddonAfter(), _this18.renderAskButtonElement(), _this18.renderEnterButtonElement()];
2676
2694
  }
2677
2695
  })];
2678
2696
  }
2679
- }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this17.renderTags()]);
2697
+ }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this18.renderTags()]);
2680
2698
  }
2681
2699
  }) : createVNode("div", {
2682
2700
  "class": suggestionsContainer
@@ -2687,43 +2705,43 @@ var SearchBox = defineComponent({
2687
2705
  "default": function _default() {
2688
2706
  return [createVNode(Actions$1, null, {
2689
2707
  "default": function _default() {
2690
- return [_this17.renderInputAddonBefore(), _this17.renderLeftIcons()];
2708
+ return [_this18.renderInputAddonBefore(), _this18.renderLeftIcons()];
2691
2709
  }
2692
2710
  }), createVNode(InputWrapper, null, {
2693
2711
  "default": function _default() {
2694
2712
  return [createVNode(TextArea, mergeProps(_transformOn({
2695
2713
  blur: function blur(e) {
2696
- _this17.$emit('blur', e, _this17.triggerQuery);
2714
+ _this18.$emit('blur', e, _this18.triggerQuery);
2697
2715
  },
2698
2716
  keypress: function keypress(e) {
2699
- _this17.$emit('keyPress', e, _this17.triggerQuery);
2700
- _this17.$emit('key-press', e, _this17.triggerQuery);
2717
+ _this18.$emit('keyPress', e, _this18.triggerQuery);
2718
+ _this18.$emit('key-press', e, _this18.triggerQuery);
2701
2719
  },
2702
- input: _this17.onInputChange,
2720
+ input: _this18.onInputChange,
2703
2721
  focus: function focus(e) {
2704
- _this17.$emit('focus', e, _this17.triggerQuery);
2722
+ _this18.$emit('focus', e, _this18.triggerQuery);
2705
2723
  },
2706
- keydown: _this17.handleKeyDown,
2724
+ keydown: _this18.handleKeyDown,
2707
2725
  keyup: function keyup(e) {
2708
- _this17.$emit('keyUp', e, _this17.triggerQuery);
2709
- _this17.$emit('key-up', e, _this17.triggerQuery);
2726
+ _this18.$emit('keyUp', e, _this18.triggerQuery);
2727
+ _this18.$emit('key-up', e, _this18.triggerQuery);
2710
2728
  }
2711
2729
  }), {
2712
2730
  "searchBox": true,
2713
- "class": getClassName$1(_this17.$props.innerClass, 'input') || '',
2714
- "placeholder": _this17.$props.placeholder,
2715
- "autofocus": _this17.$props.autoFocus,
2716
- "value": _this17.$data.currentValue ? _this17.$data.currentValue : '',
2717
- "iconPosition": _this17.$props.iconPosition,
2718
- "showIcon": _this17.$props.showIcon,
2719
- "showClear": _this17.$props.showClear,
2720
- "ref": _this17.$props.innerRef,
2721
- "themePreset": _this17.themePreset
2731
+ "class": getClassName$1(_this18.$props.innerClass, 'input') || '',
2732
+ "placeholder": _this18.$props.placeholder,
2733
+ "autofocus": _this18.$props.autoFocus,
2734
+ "value": _this18.$data.currentValue ? _this18.$data.currentValue : '',
2735
+ "iconPosition": _this18.$props.iconPosition,
2736
+ "showIcon": _this18.$props.showIcon,
2737
+ "showClear": _this18.$props.showClear,
2738
+ "ref": _this18.$props.innerRef,
2739
+ "themePreset": _this18.themePreset
2722
2740
  }), null)];
2723
2741
  }
2724
2742
  }), createVNode(Actions$1, null, {
2725
2743
  "default": function _default() {
2726
- return [_this17.renderRightIcons(), _this17.renderInputAddonAfter(), _this17.renderEnterButtonElement()];
2744
+ return [_this18.renderRightIcons(), _this18.renderInputAddonAfter(), _this18.renderEnterButtonElement()];
2727
2745
  }
2728
2746
  })];
2729
2747
  }