@appbaseio/reactivesearch-vue 3.1.0-alpha.2 → 3.1.0-alpha.3

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.
Files changed (33) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +866 -494
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +4 -4
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/{DropDown-26666911.js → DropDown-1532353d.js} +1 -1
  6. package/dist/cjs/DynamicRangeSlider.js +2 -3
  7. package/dist/cjs/{Input-3ecdb905.js → Input-4279b088.js} +2 -2
  8. package/dist/cjs/MultiDropdownList.js +2 -2
  9. package/dist/cjs/MultiList.js +1 -1
  10. package/dist/cjs/RangeInput.js +3 -4
  11. package/dist/cjs/RangeSlider.js +2 -3
  12. package/dist/cjs/SingleDropdownList.js +2 -2
  13. package/dist/cjs/SingleList.js +1 -1
  14. package/dist/cjs/index.js +5 -6
  15. package/dist/cjs/{install-26ae88c8.js → install-c2974532.js} +291 -167
  16. package/dist/cjs/install.js +5 -6
  17. package/dist/cjs/version.js +1 -1
  18. package/dist/components/search/SearchBox.d.ts +4 -0
  19. package/dist/es/{DropDown-48045fde.js → DropDown-6d1dddde.js} +1 -1
  20. package/dist/es/DynamicRangeSlider.js +2 -3
  21. package/dist/es/{Input-83dee8c5.js → Input-1f6207bc.js} +2 -2
  22. package/dist/es/MultiDropdownList.js +2 -2
  23. package/dist/es/MultiList.js +1 -1
  24. package/dist/es/RangeInput.js +3 -4
  25. package/dist/es/RangeSlider.js +2 -3
  26. package/dist/es/SingleDropdownList.js +2 -2
  27. package/dist/es/SingleList.js +1 -1
  28. package/dist/es/index.js +6 -7
  29. package/dist/es/{install-924d0354.js → install-7ecd1a9c.js} +293 -169
  30. package/dist/es/install.js +5 -6
  31. package/dist/es/version.js +1 -1
  32. package/dist/types.ts +12 -0
  33. package/package.json +91 -92
@@ -1,10 +1,10 @@
1
1
  import { helper, Actions, causes } from '@appbaseio/reactivecore';
2
- import { SEARCH_COMPONENTS_MODES, AI_TRIGGER_MODES, componentTypes, AI_LOCAL_CACHE_KEY, AI_ROLES, TREELIST_VALUES_PATH_SEPARATOR } from '@appbaseio/reactivecore/lib/utils/constants';
2
+ import { SEARCH_COMPONENTS_MODES, AI_TRIGGER_MODES, AI_LOCAL_CACHE_KEY, componentTypes, AI_ROLES, TREELIST_VALUES_PATH_SEPARATOR } from '@appbaseio/reactivecore/lib/utils/constants';
3
3
  import _transformOn from '@vue/babel-helper-vue-transform-on';
4
4
  import { _ as _taggedTemplateLiteralLoose, a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-ded08042.js';
5
5
  import { createVNode, createTextVNode, defineComponent, ref, watch, isVNode, mergeProps, h } from 'vue';
6
6
  import VueTypes from 'vue-types';
7
- import { getQueryOptions, featuredSuggestionsActionTypes, suggestionTypes, getObjectFromLocalStorage, getClassName as getClassName$2, setObjectInLocalStorage, recLookup, updateCustomQuery as updateCustomQuery$1, updateDefaultQuery as updateDefaultQuery$1, transformTreeListLocalStateIntoQueryComptaibleFormat, isEqual as isEqual$1, transformRawTreeListData, setDeep, getComponent as getComponent$1, getOptionsFromQuery, checkValueChange as checkValueChange$1, getAggsQuery, updateInternalQuery, isFunction as isFunction$1 } from '@appbaseio/reactivecore/lib/utils/helper';
7
+ import { suggestionTypes, getObjectFromLocalStorage, getQueryOptions, featuredSuggestionsActionTypes, getClassName as getClassName$2, setObjectInLocalStorage, recLookup, updateCustomQuery as updateCustomQuery$1, updateDefaultQuery as updateDefaultQuery$1, transformTreeListLocalStateIntoQueryComptaibleFormat, isEqual as isEqual$1, transformRawTreeListData, setDeep, getComponent as getComponent$1, getOptionsFromQuery, checkValueChange as checkValueChange$1, getAggsQuery, updateInternalQuery, isFunction as isFunction$1 } from '@appbaseio/reactivecore/lib/utils/helper';
8
8
  import { styled } from '@appbaseio/vue-emotion';
9
9
  import { css, keyframes } from '@emotion/css';
10
10
  import { lighten } from 'polished';
@@ -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-48045fde.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-83dee8c5.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';
@@ -61,7 +61,7 @@ InputGroup.defaultProps = {
61
61
  };
62
62
 
63
63
  var _templateObject$1;
64
- var InputAddon = styled('span')(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #fafafa;\n border: 1px solid #ccc;\n border-radius: 2px;\n color: rgba(0, 0, 0, 0.85);\n font-size: 14px;\n font-weight: 400;\n padding: 0 11px;\n position: relative;\n transition: all 0.3s;\n box-sizing: border-box;\n overflow: hidden;\n\n &:first-of-type {\n border-right: none;\n }\n &:last-of-type {\n border-left: none;\n }\n"])));
64
+ var InputAddon = styled('span')(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #fafafa;\n border: 1px solid transparent;\n border-radius: 6px;\n color: rgba(0, 0, 0, 0.85);\n font-size: 14px;\n font-weight: 400;\n padding: 0 11px;\n position: relative;\n transition: all 0.3s;\n box-sizing: border-box;\n overflow: hidden;\n\n &:first-of-type {\n border-right: none;\n }\n &:last-of-type {\n border-left: none;\n }\n"])));
65
65
  InputAddon.defaultProps = {
66
66
  className: 'input-addon'
67
67
  };
@@ -97,7 +97,30 @@ var SuggestionItem = {
97
97
  name: 'SuggestionItem',
98
98
  props: {
99
99
  currentValue: types.string,
100
- suggestion: types.any
100
+ suggestion: types.any,
101
+ innerHTML: types.string.isRequired
102
+ },
103
+ data: function data() {
104
+ return {
105
+ isOverflowing: false
106
+ };
107
+ },
108
+ methods: {
109
+ updateOverflowing: function updateOverflowing() {
110
+ if (this.$refs.container && this.$refs.content) {
111
+ var _this$$refs = this.$refs,
112
+ container = _this$$refs.container,
113
+ content = _this$$refs.content;
114
+ var containerWidth = container.offsetWidth;
115
+ var contentWidth = content.scrollWidth;
116
+ this.isOverflowing = contentWidth > containerWidth;
117
+ } else {
118
+ this.isOverflowing = false;
119
+ }
120
+ }
121
+ },
122
+ mounted: function mounted() {
123
+ this.updateOverflowing();
101
124
  },
102
125
  render: function render() {
103
126
  var _this = this;
@@ -113,7 +136,11 @@ var SuggestionItem = {
113
136
  if (label) {
114
137
  // label has highest precedence
115
138
  return typeof label === 'string' ? createVNode("div", {
116
- "class": "trim"
139
+ "ref": "container",
140
+ "class": "trim",
141
+ "title": this.isOverflowing ? label : ''
142
+ }, [createVNode("div", {
143
+ "ref": "content"
117
144
  }, [(_category ? false : isPredictiveSuggestion
118
145
  // eslint-disable-next-line
119
146
  || !!_suggestion_type) ? createVNode(PredictiveSuggestion, {
@@ -123,7 +150,7 @@ var SuggestionItem = {
123
150
  "textToHighlight": label,
124
151
  "autoEscape": true,
125
152
  "highlightStyle": highlightStyle
126
- }, null)]) : label;
153
+ }, null)])]) : label;
127
154
  }
128
155
  if (title || image || description) {
129
156
  return createVNode(Flex, {
@@ -805,7 +832,7 @@ var HorizontalSkeletonLoader = defineComponent({
805
832
 
806
833
  var _templateObject$7, _templateObject2$2, _templateObject3$1, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
807
834
  var Chatbox = styled('div')(_templateObject$7 || (_templateObject$7 = _taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tmargin: 0 auto;\n\tpadding: 10px;\n\tbackground-color: #fafafa;\n\twidth: 100%;\n\tbox-shadow: rgb(0 0 0 / 20%) 0px 0px 6px;\n\tborder-radius: 6px;\n\tmargin-bottom: 20px;\n\tbackground-color: ", ";\n\n\t.--trigger-message-wrapper {\n\t\tcursor: pointer;\n\t}\n"])), function (props) {
808
- return props.theme && props.theme.colors ? props.theme.colors.backgroundColor : '#fff';
835
+ return props.theme && props.theme.colors && props.theme.colors.backgroundColor ? lighten(0.1, props.theme.colors.backgroundColor) : '#fff';
809
836
  });
810
837
  var ChatContainer = styled('div')(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\theight: 100%;\n\tposition: relative;\n\t.--ai-answer-error-container {\n\t\ttext-align: center;\n\t\tposition: absolute;\n\t\tbottom: 0px;\n\t\t", ";\n\t\tz-index: 1;\n\t\tleft: 50%;\n\t\ttransform: translateX(-50%);\n\t\twidth: 100%;\n\n\t\t.--default-error-element {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\talign-items: center;\n\t\t\tpadding: 10px;\n\t\t\tbackground-color: ", ";\n\t\t\tbox-shadow: 0 -5px 5px -2px\n\t\t\t\t", ";\n\n\t\t\tspan {\n\t\t\t\tmargin-bottom: 5px;\n\t\t\t}\n\n\t\t\tbutton {\n\t\t\t}\n\t\t}\n\t}\n\n\t", ";\n"])), function (props) {
811
838
  return props.showInput ? 'bottom: 48px;' : '';
@@ -837,7 +864,7 @@ var resetCSS = function resetCSS(props) {
837
864
  // eslint-disable-next-line no-nested-ternary
838
865
  props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor : props.theme.colors.primaryTextColor) + ";\n\t\tborder-radius: 3px;\n\t\tfont-size: 85%;\n\t\tpadding: 0.2em 0.4em;\n\t\tmargin-top: 5px;\n\t\tdisplay: inline-block;\n\t\toverflow: auto;\n\t\twidth: fit-content;\n\t\tmax-width: 100%;\n\t}\n\ncode[class*='language-'],\n\tpre[class*='language-'] {\n\t\tcolor: " + (
839
866
  // eslint-disable-next-line no-nested-ternary
840
- props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor : props.theme.colors.primaryTextColor) + ";\n\t\ttext-shadow: none;\n\t}\n\n\tul,\n\tol {\n\t\tlist-style-position: inside;\n\t\tpadding-left: 10px;\n\n\t}\n\n\tli{\n\t\tdisplay: list-item;\n\t\tcursor: default;\n\t\tpadding: initial;\n\n\t\t&:hover{\n\t\t\tbackground-color: initial;\n\t\t}\n\t}\n\tp {\n\t\tmargin: inherit;\n\t}\n";
867
+ props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor : props.theme.colors.primaryTextColor) + ";\n\t\ttext-shadow: none;\n\t}\n\n\tul,\n\tol {\n\t\tlist-style-position: inside;\n\t\tpadding-left: 10px;\n\n\t}\n\n\tli{\n\t\tdisplay: list-item;\n\t\tcursor: default;\n\t\tpadding: initial;\n\n\t\t&:hover{\n\t\t\tbackground-color: initial;\n\t\t}\n\t}\n\tp {\n\t\tmargin: inherit;\n\t}\n\n\t" + (props.themePreset === 'dark' && "a{\n\t\tcolor: cornflowerblue\n\t\t}") + ";\n";
841
868
  };
842
869
  var messageBGColor = function messageBGColor(props) {
843
870
  var finalBGColor;
@@ -866,16 +893,10 @@ var Message = styled('div')(_templateObject7 || (_templateObject7 = _taggedTempl
866
893
  return resetCSS(props);
867
894
  });
868
895
  var MessageInputContainer = styled('form')(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tpadding-top: 12px;\n\talign-items: stretch;\n\tmargin-top: 10px;\n\t.ai-enter-button-wrapper {\n\t\talign-self: baseline;\n\t\theight: 41px;\n\t}\n"])));
869
- var MessageInput = styled(TextArea)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tborder-radius: 5px;\n\tborder: 1px solid #ccc;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\n\t::placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t:-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t::-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n\t", "\n\tpadding-left: 35px;\n"])), function (props) {
896
+ var MessageInput = styled(TextArea)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tborder-radius: 5px;\n\tborder: 1px solid #ccc;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\n\t", "\n\tpadding-left: 35px;\n"])), function (props) {
870
897
  return props.themePreset === 'dark' ? props.theme.colors.borderColor : '#fff';
871
898
  }, function (props) {
872
899
  return props.themePreset === 'dark' ? props.theme.colors.titleColor : props.theme.colors.textColor;
873
- }, function (props) {
874
- return props.theme.colors.textColor;
875
- }, function (props) {
876
- return props.theme.colors.textColor;
877
- }, function (props) {
878
- return props.theme.colors.textColor;
879
900
  }, function (_ref) {
880
901
  var enterButton = _ref.enterButton;
881
902
  return enterButton && "\n\t\t border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\t";
@@ -1080,6 +1101,42 @@ var AIFeedback = defineComponent({
1080
1101
  }
1081
1102
  });
1082
1103
 
1104
+ // eslint-disable-next-line import/prefer-default-export
1105
+ var innerText = function innerText(jsx) {
1106
+ // Empty
1107
+ if (jsx === null || typeof jsx === 'boolean' || typeof jsx === 'undefined') {
1108
+ return '';
1109
+ }
1110
+
1111
+ // Numeric children.
1112
+ if (typeof jsx === 'number') {
1113
+ return jsx.toString();
1114
+ }
1115
+
1116
+ // String literals.
1117
+ if (typeof jsx === 'string') {
1118
+ return jsx;
1119
+ }
1120
+
1121
+ // Array of JSX.
1122
+ if (Array.isArray(jsx)) {
1123
+ // eslint-disable-next-line no-use-before-define
1124
+ return jsx.reduce(reduceJsxToString, '');
1125
+ }
1126
+
1127
+ // Children prop.
1128
+ if (Object.prototype.hasOwnProperty.call(jsx, 'children')) {
1129
+ return innerText(jsx.children);
1130
+ }
1131
+
1132
+ // Default
1133
+ return '';
1134
+ };
1135
+ innerText["default"] = innerText;
1136
+ function reduceJsxToString(previous, current) {
1137
+ return previous + innerText(current);
1138
+ }
1139
+
1083
1140
  var _excluded = ["_source"];
1084
1141
  function _isSlot(s) {
1085
1142
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
@@ -1120,7 +1177,8 @@ var SearchBox = defineComponent({
1120
1177
  showFeedbackComponent: false,
1121
1178
  feedbackState: null,
1122
1179
  faqAnswer: '',
1123
- faqQuestion: ''
1180
+ faqQuestion: '',
1181
+ initialHits: null
1124
1182
  };
1125
1183
  this.internalComponent = props.componentId + "__internal";
1126
1184
  return this.__state;
@@ -1172,11 +1230,12 @@ var SearchBox = defineComponent({
1172
1230
  return this.faqAnswer || this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text;
1173
1231
  },
1174
1232
  parsedSuggestions: function parsedSuggestions() {
1233
+ var _this = this;
1175
1234
  var suggestionsArray = [];
1176
1235
  if (Array.isArray(this.suggestions) && this.suggestions.length) {
1177
1236
  suggestionsArray = [].concat(withClickIds(this.suggestions));
1178
1237
  }
1179
- if (this.renderTriggerMessage() && this.currentValue && !this.isLoading) {
1238
+ if (this.renderTriggerMessage() && this.currentValue) {
1180
1239
  suggestionsArray.unshift({
1181
1240
  label: this.renderTriggerMessage(),
1182
1241
  value: 'AI_TRIGGER_MESSAGE',
@@ -1190,6 +1249,20 @@ var SearchBox = defineComponent({
1190
1249
  return _extends({}, s, {
1191
1250
  sectionId: s._suggestion_type
1192
1251
  });
1252
+ }).map(function (suggestion) {
1253
+ if (suggestion._suggestion_type === suggestionTypes.Document) {
1254
+ // Document suggestions don't have a meaningful label and value
1255
+ var newSuggestion = _extends({}, suggestion);
1256
+ newSuggestion.label = 'For document suggestions, please implement a renderItem method to display label.';
1257
+ var renderItem = _this.$slots.renderItem || _this.$props.renderItem;
1258
+ if (typeof renderItem === 'function') {
1259
+ var jsxEl = renderItem(newSuggestion);
1260
+ var innerValue = innerText(jsxEl);
1261
+ newSuggestion.value = xss(innerValue);
1262
+ }
1263
+ return newSuggestion;
1264
+ }
1265
+ return suggestion;
1193
1266
  });
1194
1267
  var sectionsAccumulated = [];
1195
1268
  var sectionisedSuggestions = suggestionsArray.reduce(function (acc, d, currentIndex) {
@@ -1238,6 +1311,12 @@ var SearchBox = defineComponent({
1238
1311
  enablePopularSuggestions: VueTypes.bool.def(false),
1239
1312
  enableRecentSuggestions: VueTypes.bool.def(false),
1240
1313
  enableFAQSuggestions: VueTypes.bool.def(false),
1314
+ enableDocumentSuggestions: VueTypes.bool.def(false),
1315
+ documentSuggestionsConfig: VueTypes.shape({
1316
+ size: VueTypes.number,
1317
+ from: VueTypes.number,
1318
+ maxChars: VueTypes.number
1319
+ }),
1241
1320
  FAQSuggestionsConfig: VueTypes.shape({
1242
1321
  sectionLabel: VueTypes.string,
1243
1322
  size: VueTypes.number
@@ -1306,9 +1385,47 @@ var SearchBox = defineComponent({
1306
1385
  AIUIConfig: types.AIUIConfig
1307
1386
  },
1308
1387
  mounted: function mounted() {
1388
+ var _this2 = this;
1309
1389
  this.listenForFocusShortcuts();
1390
+ var dropdownEle = this.$refs[_dropdownULRef];
1391
+ if (dropdownEle) {
1392
+ var handleScroll = function handleScroll() {
1393
+ var scrollTop = dropdownEle.scrollTop;
1394
+ _this2.lastScrollTop = scrollTop;
1395
+ if (scrollTop < _this2.lastScrollTop) {
1396
+ // User is scrolling up
1397
+ clearInterval(_this2.scrollTimerRef);
1398
+ _this2.isUserScrolling = true;
1399
+ }
1400
+ // Update lastScrollTop with the current scroll position
1401
+ _this2.lastScrollTop = scrollTop;
1402
+ };
1403
+ dropdownEle.addEventListener('scroll', handleScroll);
1404
+ }
1405
+ },
1406
+ updated: function updated() {
1407
+ if (this.$props.mode === SEARCH_COMPONENTS_MODES.SELECT && this.$options.isTagsMode === true) {
1408
+ this.$options.isTagsMode = false;
1409
+ this.selectedTags = [];
1410
+ } else if (this.$props.mode === SEARCH_COMPONENTS_MODES.TAG && this.$options.isTagsMode === false) {
1411
+ this.$options.isTagsMode = true;
1412
+ }
1310
1413
  },
1311
1414
  watch: {
1415
+ AIResponse: function AIResponse(newVal) {
1416
+ if (newVal) {
1417
+ if (this.$props.AIUIConfig && this.$props.AIUIConfig.showSourceDocuments && newVal.response && newVal.response.answer && Array.isArray(newVal.response.answer.documentIds)) {
1418
+ this.sourceDocIds = newVal.response.answer.documentIds;
1419
+ var localCache = getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) && getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY)[this.$props.componentId];
1420
+ if (localCache && localCache.meta && localCache.meta.hits && localCache.meta.hits.hits) {
1421
+ this.initialHits = localCache.meta.hits.hits;
1422
+ }
1423
+ if (!this.showAIScreenFooter) {
1424
+ this.showAIScreenFooter = true;
1425
+ }
1426
+ }
1427
+ }
1428
+ },
1312
1429
  dataField: function dataField(newVal, oldVal) {
1313
1430
  if (!isEqual(newVal, oldVal)) {
1314
1431
  this.triggerCustomQuery(this.$data.currentValue);
@@ -1383,6 +1500,9 @@ var SearchBox = defineComponent({
1383
1500
  loading: this.isLoading,
1384
1501
  error: this.isError
1385
1502
  });
1503
+ if (newVal && newVal.hits && newVal.hits.hits) {
1504
+ this.initialHits = newVal.hits.hits;
1505
+ }
1386
1506
  },
1387
1507
  aggregationData: function aggregationData(newVal) {
1388
1508
  this.$emit('on-data', {
@@ -1417,9 +1537,10 @@ var SearchBox = defineComponent({
1417
1537
  }
1418
1538
  },
1419
1539
  isAITyping: function isAITyping(newVal, oldVal) {
1420
- var _this = this;
1540
+ var _this3 = this;
1421
1541
  var scrollAIContainer = function scrollAIContainer() {
1422
- var dropdownEle = _this.$refs[_dropdownULRef];
1542
+ if (_this3.isUserScrolling) return;
1543
+ var dropdownEle = _this3.$refs[_dropdownULRef];
1423
1544
  if (dropdownEle) {
1424
1545
  dropdownEle.scrollTo({
1425
1546
  top: dropdownEle.scrollHeight,
@@ -1428,6 +1549,7 @@ var SearchBox = defineComponent({
1428
1549
  }
1429
1550
  };
1430
1551
  if (!newVal && oldVal) {
1552
+ clearInterval(this.scrollTimerRef);
1431
1553
  this.showAIScreenFooter = true;
1432
1554
  if (this.$props.AIUIConfig && typeof this.$props.AIUIConfig.showFeedback === 'boolean' ? this.$props.AIUIConfig.showFeedback : true) {
1433
1555
  this.showFeedbackComponent = true;
@@ -1436,7 +1558,7 @@ var SearchBox = defineComponent({
1436
1558
  scrollAIContainer();
1437
1559
  }, 500);
1438
1560
  } else if (newVal) {
1439
- this.scrollTimerRef = setTimeout(function () {
1561
+ this.scrollTimerRef = setInterval(function () {
1440
1562
  scrollAIContainer();
1441
1563
  }, 2000);
1442
1564
  }
@@ -1453,7 +1575,7 @@ var SearchBox = defineComponent({
1453
1575
  }
1454
1576
  },
1455
1577
  currentValue: function currentValue() {
1456
- this.handleTextAreaHeightChange();
1578
+ this.$nextTick(this.handleTextAreaHeightChange);
1457
1579
  }
1458
1580
  },
1459
1581
  methods: {
@@ -1528,7 +1650,7 @@ var SearchBox = defineComponent({
1528
1650
  }
1529
1651
  },
1530
1652
  setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue, shouldExecuteQuery) {
1531
- var _this2 = this;
1653
+ var _this4 = this;
1532
1654
  if (isDefaultValue === void 0) {
1533
1655
  isDefaultValue = false;
1534
1656
  }
@@ -1545,65 +1667,65 @@ var SearchBox = defineComponent({
1545
1667
  shouldExecuteQuery = true;
1546
1668
  }
1547
1669
  var performUpdate = function performUpdate() {
1548
- if (_this2.$options.isTagsMode && isEqual(value, _this2.selectedTags)) {
1670
+ if (_this4.$options.isTagsMode && isEqual(value, _this4.selectedTags)) {
1549
1671
  return;
1550
1672
  }
1551
- if (_this2.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1552
- if (Array.isArray(_this2.selectedTags) && _this2.selectedTags.length) {
1673
+ if (_this4.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1674
+ if (Array.isArray(_this4.selectedTags) && _this4.selectedTags.length) {
1553
1675
  // check if value already present in selectedTags
1554
- if (typeof value === 'string' && _this2.selectedTags.includes(value)) {
1555
- _this2.isOpen = false;
1676
+ if (typeof value === 'string' && _this4.selectedTags.includes(value)) {
1677
+ _this4.isOpen = false;
1556
1678
  return;
1557
1679
  }
1558
- _this2.selectedTags = [].concat(_this2.selectedTags);
1680
+ _this4.selectedTags = [].concat(_this4.selectedTags);
1559
1681
  if (typeof value === 'string' && !!value) {
1560
- _this2.selectedTags.push(value);
1561
- } else if (Array.isArray(value) && !isEqual(_this2.selectedTags, value)) {
1562
- _this2.selectedTags = value;
1682
+ _this4.selectedTags.push(value);
1683
+ } else if (Array.isArray(value) && !isEqual(_this4.selectedTags, value)) {
1684
+ _this4.selectedTags = value;
1563
1685
  }
1564
1686
  } else if (value) {
1565
- _this2.selectedTags = typeof value !== 'string' ? value : [].concat(value);
1687
+ _this4.selectedTags = typeof value !== 'string' ? value : [].concat(value);
1566
1688
  }
1567
- _this2.currentValue = '';
1689
+ _this4.currentValue = '';
1568
1690
  } else {
1569
- _this2.currentValue = decodeHtml(value);
1691
+ _this4.currentValue = decodeHtml(value);
1570
1692
  }
1571
1693
  var queryHandlerValue = value;
1572
- if (_this2.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1573
- queryHandlerValue = Array.isArray(_this2.selectedTags) && _this2.selectedTags.length ? _this2.selectedTags : undefined;
1694
+ if (_this4.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1695
+ queryHandlerValue = Array.isArray(_this4.selectedTags) && _this4.selectedTags.length ? _this4.selectedTags : undefined;
1574
1696
  }
1575
- if ((_this2.faqAnswer || _this2.faqQuestion) && value === '') {
1697
+ if ((_this4.faqAnswer || _this4.faqQuestion) && value === '') {
1576
1698
  // Empty the previous state
1577
- _this2.faqAnswer = '';
1578
- _this2.faqQuestion = '';
1579
- _this2.showAIScreen = false;
1699
+ _this4.faqAnswer = '';
1700
+ _this4.faqQuestion = '';
1701
+ _this4.showAIScreen = false;
1580
1702
  }
1581
1703
  if (isDefaultValue) {
1582
- if (_this2.$props.autosuggest) {
1704
+ if (_this4.$props.autosuggest) {
1583
1705
  if (toggleIsOpen) {
1584
- _this2.isOpen = false;
1706
+ _this4.isOpen = false;
1585
1707
  }
1586
- if (typeof _this2.currentValue === 'string') _this2.triggerDefaultQuery(_this2.currentValue, props.enableAI && _this2.currentTriggerMode === AI_TRIGGER_MODES.QUESTION && _this2.currentValue.endsWith('?') ? {
1708
+ if (typeof _this4.currentValue === 'string') _this4.triggerDefaultQuery(_this4.currentValue, props.enableAI && _this4.currentTriggerMode === AI_TRIGGER_MODES.QUESTION && _this4.currentValue.endsWith('?') ? {
1587
1709
  enableAI: true
1588
1710
  } : {}, shouldExecuteQuery);
1589
1711
  } // in case of strict selection only SUGGESTION_SELECT should be able
1590
1712
  // to set the query otherwise the value should reset
1591
1713
  if (props.strictSelection) {
1592
- if (cause === causes.SUGGESTION_SELECT || (_this2.$options.isTagsMode ? _this2.selectedTags.length === 0 : value === '')) {
1593
- _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1714
+ if (cause === causes.SUGGESTION_SELECT || (_this4.$options.isTagsMode ? _this4.selectedTags.length === 0 : value === '')) {
1715
+ _this4.triggerCustomQuery(queryHandlerValue, _this4.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1594
1716
  } else {
1595
- _this2.setValue('', true);
1717
+ _this4.setValue('', true);
1596
1718
  }
1597
1719
  } else if (props.value === undefined || cause === causes.SUGGESTION_SELECT || cause === causes.CLEAR_VALUE) {
1598
- _this2.showAIScreen = false;
1599
- _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1720
+ _this4.showAIScreen = false;
1721
+ _this4.triggerCustomQuery(queryHandlerValue, _this4.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1600
1722
  }
1601
1723
  } else {
1602
1724
  // debounce for handling text while typing
1603
- _this2.handleTextChange(value, cause);
1725
+ _this4.handleTextChange(value, cause);
1604
1726
  }
1605
- _this2.$emit('valueChange', value);
1606
- _this2.$emit('value-change', value);
1727
+ _this4.$emit('valueChange', value);
1728
+ _this4.$emit('value-change', value);
1607
1729
  };
1608
1730
  checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
1609
1731
  },
@@ -1752,7 +1874,7 @@ var SearchBox = defineComponent({
1752
1874
  this.$emit('key-down', event, this.triggerQuery);
1753
1875
  },
1754
1876
  onInputChange: function onInputChange(e) {
1755
- var _this3 = this;
1877
+ var _this5 = this;
1756
1878
  var inputValue = e.target.value;
1757
1879
  if (!this.$data.isOpen && this.$props.autosuggest) {
1758
1880
  this.isOpen = true;
@@ -1766,7 +1888,7 @@ var SearchBox = defineComponent({
1766
1888
  } else {
1767
1889
  this.$emit('change', inputValue, function (_ref3) {
1768
1890
  var isOpen = _ref3.isOpen;
1769
- return _this3.triggerQuery({
1891
+ return _this5.triggerQuery({
1770
1892
  defaultQuery: true,
1771
1893
  customQuery: true,
1772
1894
  value: inputValue,
@@ -1810,7 +1932,7 @@ var SearchBox = defineComponent({
1810
1932
  }
1811
1933
  },
1812
1934
  onSuggestionSelected: function onSuggestionSelected(suggestion) {
1813
- var _this4 = this;
1935
+ var _this6 = this;
1814
1936
  var value = this.$props.value;
1815
1937
  // The state of the suggestion is open by the time it reaches here. i.e. isOpen = true
1816
1938
  // handle when FAQ suggestion is clicked
@@ -1859,10 +1981,10 @@ var SearchBox = defineComponent({
1859
1981
  this.setValue(emitValue, true, this.$props, causes.SUGGESTION_SELECT, false, suggestion._category);
1860
1982
  this.$emit('change', emitValue, function (_ref4) {
1861
1983
  var isOpen = _ref4.isOpen;
1862
- return _this4.triggerQuery(_extends({
1984
+ return _this6.triggerQuery(_extends({
1863
1985
  isOpen: isOpen,
1864
1986
  value: emitValue
1865
- }, !_this4.$options.isTagsMode && {
1987
+ }, !_this6.$options.isTagsMode && {
1866
1988
  categoryValue: suggestion._category
1867
1989
  }));
1868
1990
  });
@@ -1902,7 +2024,7 @@ var SearchBox = defineComponent({
1902
2024
  return null;
1903
2025
  },
1904
2026
  renderErrorComponent: function renderErrorComponent(isAIError) {
1905
- var _this5 = this;
2027
+ var _this7 = this;
1906
2028
  if (isAIError === void 0) {
1907
2029
  isAIError = false;
1908
2030
  }
@@ -1929,7 +2051,7 @@ var SearchBox = defineComponent({
1929
2051
  "themePreset": this.themePreset
1930
2052
  }, {
1931
2053
  "default": function _default() {
1932
- return [isFunction(renderError) ? renderError(_this5.error) : renderError];
2054
+ return [isFunction(renderError) ? renderError(_this7.error) : renderError];
1933
2055
  }
1934
2056
  });
1935
2057
  }
@@ -2009,7 +2131,7 @@ var SearchBox = defineComponent({
2009
2131
  });
2010
2132
  },
2011
2133
  renderEnterButtonElement: function renderEnterButtonElement() {
2012
- var _this6 = this;
2134
+ var _this8 = this;
2013
2135
  var _this$$props2 = this.$props,
2014
2136
  enterButton = _this$$props2.enterButton,
2015
2137
  innerClass = _this$$props2.innerClass;
@@ -2017,12 +2139,12 @@ var SearchBox = defineComponent({
2017
2139
  if (enterButton) {
2018
2140
  var getEnterButtonMarkup = function getEnterButtonMarkup() {
2019
2141
  if (renderEnterButton) {
2020
- return renderEnterButton(_this6.enterButtonOnClick);
2142
+ return renderEnterButton(_this8.enterButtonOnClick);
2021
2143
  }
2022
2144
  return createVNode(Button, {
2023
2145
  "class": "enter-btn " + getClassName$1(innerClass, 'enter-button'),
2024
2146
  "primary": true,
2025
- "onClick": _this6.enterButtonOnClick
2147
+ "onClick": _this8.enterButtonOnClick
2026
2148
  }, {
2027
2149
  "default": function _default() {
2028
2150
  return [createTextVNode("Search")];
@@ -2048,7 +2170,7 @@ var SearchBox = defineComponent({
2048
2170
  return '/';
2049
2171
  },
2050
2172
  renderLeftIcons: function renderLeftIcons() {
2051
- var _this7 = this;
2173
+ var _this9 = this;
2052
2174
  var _slot3;
2053
2175
  var _this$$props3 = this.$props,
2054
2176
  iconPosition = _this$$props3.iconPosition,
@@ -2058,8 +2180,8 @@ var SearchBox = defineComponent({
2058
2180
  }, {
2059
2181
  "default": function _default() {
2060
2182
  return [iconPosition === 'left' && showIcon && createVNode(IconWrapper, {
2061
- "onClick": _this7.handleSearchIconClick
2062
- }, _isSlot(_slot3 = _this7.renderIcon()) ? _slot3 : {
2183
+ "onClick": _this9.handleSearchIconClick
2184
+ }, _isSlot(_slot3 = _this9.renderIcon()) ? _slot3 : {
2063
2185
  "default": function _default() {
2064
2186
  return [_slot3];
2065
2187
  }
@@ -2068,7 +2190,7 @@ var SearchBox = defineComponent({
2068
2190
  })]);
2069
2191
  },
2070
2192
  renderRightIcons: function renderRightIcons() {
2071
- var _this8 = this;
2193
+ var _this10 = this;
2072
2194
  var _slot4, _slot5, _slot6;
2073
2195
  var _this$$props4 = this.$props,
2074
2196
  iconPosition = _this$$props4.iconPosition,
@@ -2085,29 +2207,29 @@ var SearchBox = defineComponent({
2085
2207
  }, {
2086
2208
  "default": function _default() {
2087
2209
  return [currentValue && showClear && createVNode(IconWrapper, {
2088
- "onClick": _this8.clearValue,
2210
+ "onClick": _this10.clearValue,
2089
2211
  "showIcon": showIcon,
2090
2212
  "isClearIcon": true
2091
- }, _isSlot(_slot4 = _this8.renderCancelIcon()) ? _slot4 : {
2213
+ }, _isSlot(_slot4 = _this10.renderCancelIcon()) ? _slot4 : {
2092
2214
  "default": function _default() {
2093
2215
  return [_slot4];
2094
2216
  }
2095
2217
  }), showFocusShortcutsIcon && createVNode(ButtonIconWrapper, {
2096
2218
  "onClick": function onClick(e) {
2097
- return _this8.focusSearchBox(e);
2219
+ return _this10.focusSearchBox(e);
2098
2220
  }
2099
- }, _isSlot(_slot5 = _this8.renderShortcut()) ? _slot5 : {
2221
+ }, _isSlot(_slot5 = _this10.renderShortcut()) ? _slot5 : {
2100
2222
  "default": function _default() {
2101
2223
  return [_slot5];
2102
2224
  }
2103
2225
  }), showVoiceSearch && createVNode(Mic, {
2104
2226
  "getInstance": getMicInstance,
2105
2227
  "render": renderMic,
2106
- "handleResult": _this8.handleVoiceResults,
2228
+ "handleResult": _this10.handleVoiceResults,
2107
2229
  "className": getClassName$1(innerClass, 'mic') || null
2108
2230
  }, null), iconPosition === 'right' && showIcon && createVNode(IconWrapper, {
2109
- "onClick": _this8.handleSearchIconClick
2110
- }, _isSlot(_slot6 = _this8.renderIcon()) ? _slot6 : {
2231
+ "onClick": _this10.handleSearchIconClick
2232
+ }, _isSlot(_slot6 = _this10.renderIcon()) ? _slot6 : {
2111
2233
  "default": function _default() {
2112
2234
  return [_slot6];
2113
2235
  }
@@ -2126,7 +2248,7 @@ var SearchBox = defineComponent({
2126
2248
  (_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
2127
2249
  },
2128
2250
  listenForFocusShortcuts: function listenForFocusShortcuts() {
2129
- var _this9 = this;
2251
+ var _this11 = this;
2130
2252
  var _this$$props$focusSho = this.$props.focusShortcuts,
2131
2253
  focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
2132
2254
  if (isEmpty(focusShortcuts)) {
@@ -2141,7 +2263,7 @@ var SearchBox = defineComponent({
2141
2263
  function (event, handler) {
2142
2264
  // Prevent the default refresh event under WINDOWS system
2143
2265
  event.preventDefault();
2144
- _this9.focusSearchBox(event);
2266
+ _this11.focusSearchBox(event);
2145
2267
  });
2146
2268
 
2147
2269
  // if one of modifier keys are used, they are handled below
@@ -2151,7 +2273,7 @@ var SearchBox = defineComponent({
2151
2273
  for (var index = 0; index < modifierKeys.length; index += 1) {
2152
2274
  var element = modifierKeys[index];
2153
2275
  if (hotkeys[element]) {
2154
- _this9.focusSearchBox(event);
2276
+ _this11.focusSearchBox(event);
2155
2277
  break;
2156
2278
  }
2157
2279
  }
@@ -2164,10 +2286,10 @@ var SearchBox = defineComponent({
2164
2286
  this.triggerDefaultQuery(value);
2165
2287
  },
2166
2288
  renderActionIcon: function renderActionIcon(suggestion) {
2167
- var _this10 = this;
2289
+ var _this12 = this;
2168
2290
  var handleAutoFillClick = function handleAutoFillClick(e) {
2169
2291
  e.stopPropagation();
2170
- _this10.onAutofillClick(suggestion);
2292
+ _this12.onAutofillClick(suggestion);
2171
2293
  };
2172
2294
  if (suggestion._suggestion_type === suggestionTypes.Featured) {
2173
2295
  if (suggestion.action === featuredSuggestionsActionTypes.FUNCTION) {
@@ -2190,7 +2312,7 @@ var SearchBox = defineComponent({
2190
2312
  return null;
2191
2313
  },
2192
2314
  renderTag: function renderTag(item) {
2193
- var _this11 = this;
2315
+ var _this13 = this;
2194
2316
  var innerClass = this.$props.innerClass;
2195
2317
  return createVNode(TagItem, {
2196
2318
  "class": getClassName$1(innerClass, 'selected-tag') || ''
@@ -2201,7 +2323,7 @@ var SearchBox = defineComponent({
2201
2323
  "aria-label": "delete-tag",
2202
2324
  "class": "close-icon",
2203
2325
  "onClick": function onClick() {
2204
- return _this11.clearTag(item);
2326
+ return _this13.clearTag(item);
2205
2327
  }
2206
2328
  }, [createVNode(CancelSvg, null, null)])];
2207
2329
  }
@@ -2224,7 +2346,7 @@ var SearchBox = defineComponent({
2224
2346
  }
2225
2347
  },
2226
2348
  renderTags: function renderTags() {
2227
- var _this12 = this;
2349
+ var _this14 = this;
2228
2350
  if (!Array.isArray(this.selectedTags)) {
2229
2351
  return null;
2230
2352
  }
@@ -2238,16 +2360,16 @@ var SearchBox = defineComponent({
2238
2360
  }) : createVNode(TagsContainer, null, {
2239
2361
  "default": function _default() {
2240
2362
  return [tagsList.map(function (item) {
2241
- return _this12.renderTag(item);
2363
+ return _this14.renderTag(item);
2242
2364
  }), shouldRenderClearAllTag && createVNode(TagItem, {
2243
- "class": getClassName$1(_this12.$props.innerClass, 'selected-tag') || ''
2365
+ "class": getClassName$1(_this14.$props.innerClass, 'selected-tag') || ''
2244
2366
  }, {
2245
2367
  "default": function _default() {
2246
2368
  return [createVNode("span", null, [createTextVNode("Clear All")]), createVNode("span", {
2247
2369
  "role": "img",
2248
2370
  "aria-label": "delete-tag",
2249
2371
  "class": "close-icon",
2250
- "onClick": _this12.clearAllTags
2372
+ "onClick": _this14.clearAllTags
2251
2373
  }, [createVNode(CancelSvg, null, null)])];
2252
2374
  }
2253
2375
  })];
@@ -2255,13 +2377,13 @@ var SearchBox = defineComponent({
2255
2377
  });
2256
2378
  },
2257
2379
  getAISourceObjects: function getAISourceObjects() {
2258
- var localCache = getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) && getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY)[this.componentId];
2380
+ var _this15 = this;
2259
2381
  var sourceObjects = [];
2260
2382
  if (!this.AIResponse) return sourceObjects;
2261
2383
  var docIds = this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [];
2262
- if (localCache && localCache.meta && localCache.meta.hits && localCache.meta.hits.hits) {
2384
+ if (this.initialHits) {
2263
2385
  docIds.forEach(function (id) {
2264
- var foundSourceObj = localCache.meta.hits.hits.find(function (hit) {
2386
+ var foundSourceObj = _this15.initialHits.find(function (hit) {
2265
2387
  return hit._id === id;
2266
2388
  }) || {};
2267
2389
  if (foundSourceObj) {
@@ -2295,31 +2417,31 @@ var SearchBox = defineComponent({
2295
2417
  },
2296
2418
  renderAIScreenFooter: function renderAIScreenFooter() {
2297
2419
  var _slot8;
2298
- var _this13 = this;
2420
+ var _this16 = this;
2299
2421
  var _this$$props$AIUIConf2 = this.$props.AIUIConfig,
2300
2422
  AIUIConfig = _this$$props$AIUIConf2 === void 0 ? {} : _this$$props$AIUIConf2;
2301
2423
  var _ref6 = AIUIConfig || {},
2302
2424
  _ref6$showSourceDocum = _ref6.showSourceDocuments,
2303
- showSourceDocuments = _ref6$showSourceDocum === void 0 ? true : _ref6$showSourceDocum,
2425
+ showSourceDocuments = _ref6$showSourceDocum === void 0 ? false : _ref6$showSourceDocum,
2304
2426
  _ref6$onSourceClick = _ref6.onSourceClick,
2305
2427
  onSourceClick = _ref6$onSourceClick === void 0 ? function () {} : _ref6$onSourceClick;
2306
2428
  var renderSourceDocumentLabel = function renderSourceDocumentLabel(sourceObj) {
2307
- if (_this13.$props.AIUIConfig && _this13.$props.AIUIConfig.renderSourceDocument) {
2308
- return _this13.$props.AIUIConfig.renderSourceDocument(sourceObj);
2429
+ if (_this16.$props.AIUIConfig && _this16.$props.AIUIConfig.renderSourceDocument) {
2430
+ return _this16.$props.AIUIConfig.renderSourceDocument(sourceObj);
2309
2431
  }
2310
- if (_this13.$slots.renderSourceDocument) {
2311
- return _this13.$slots.renderSourceDocument(sourceObj);
2432
+ if (_this16.$slots.renderSourceDocument) {
2433
+ return _this16.$slots.renderSourceDocument(sourceObj);
2312
2434
  }
2313
2435
  return sourceObj._id;
2314
2436
  };
2315
- return showSourceDocuments && this.showAIScreenFooter && this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds ? createVNode(Footer, {
2437
+ return showSourceDocuments && this.showAIScreenFooter && this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds && this.AIResponse.response.answer.documentIds.length ? createVNode(Footer, {
2316
2438
  "themePreset": this.$props.themePreset
2317
2439
  }, {
2318
2440
  "default": function _default() {
2319
- return [createTextVNode("Summary generated using the following sources:"), ' ', createVNode(SourceTags, null, _isSlot(_slot8 = _this13.getAISourceObjects().map(function (el) {
2441
+ return [createTextVNode("Summary generated using the following sources:"), ' ', createVNode(SourceTags, null, _isSlot(_slot8 = _this16.getAISourceObjects().map(function (el) {
2320
2442
  var _slot7;
2321
2443
  return createVNode(Button, {
2322
- "class": "--ai-source-tag " + (getClassName$1(_this13.$props.innerClass, 'ai-source-tag') || ''),
2444
+ "class": "--ai-source-tag " + (getClassName$1(_this16.$props.innerClass, 'ai-source-tag') || ''),
2323
2445
  "info": true,
2324
2446
  "onClick": function onClick() {
2325
2447
  return onSourceClick && onSourceClick(el);
@@ -2338,7 +2460,7 @@ var SearchBox = defineComponent({
2338
2460
  }) : null;
2339
2461
  },
2340
2462
  renderAIScreen: function renderAIScreen() {
2341
- var _this14 = this;
2463
+ var _this17 = this;
2342
2464
  var customAIRenderer = this.$props.renderAIAnswer || this.$slots.renderAIAnswer;
2343
2465
  if (customAIRenderer) {
2344
2466
  return customAIRenderer({
@@ -2362,11 +2484,11 @@ var SearchBox = defineComponent({
2362
2484
  "hideUI": this.isAIResponseLoading || this.isLoading || !this.sessionIdFromStore,
2363
2485
  "key": this.sessionIdFromStore,
2364
2486
  "onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
2365
- _this14.feedbackState = {
2487
+ _this17.feedbackState = {
2366
2488
  isRecorded: true,
2367
2489
  feedbackType: useful ? 'positive' : 'negative'
2368
2490
  };
2369
- _this14.recordAISessionUsefulness(_this14.sessionIdFromStore, {
2491
+ _this17.recordAISessionUsefulness(_this17.sessionIdFromStore, {
2370
2492
  useful: useful,
2371
2493
  reason: reason
2372
2494
  });
@@ -2401,7 +2523,7 @@ var SearchBox = defineComponent({
2401
2523
  });
2402
2524
  },
2403
2525
  renderAskButtonElement: function renderAskButtonElement() {
2404
- var _this15 = this;
2526
+ var _this18 = this;
2405
2527
  var _this$$props5 = this.$props,
2406
2528
  AIUIConfig = _this$$props5.AIUIConfig,
2407
2529
  innerClass = _this$$props5.innerClass;
@@ -2411,12 +2533,12 @@ var SearchBox = defineComponent({
2411
2533
  if (askButton) {
2412
2534
  var getEnterButtonMarkup = function getEnterButtonMarkup() {
2413
2535
  if (renderAskButton) {
2414
- return renderAskButton(_this15.askButtonOnClick);
2536
+ return renderAskButton(_this18.askButtonOnClick);
2415
2537
  }
2416
2538
  return createVNode(Button, {
2417
2539
  "class": "enter-btn " + getClassName$1(innerClass, 'ask-button'),
2418
2540
  "info": true,
2419
- "onClick": _this15.askButtonOnClick
2541
+ "onClick": _this18.askButtonOnClick
2420
2542
  }, {
2421
2543
  "default": function _default() {
2422
2544
  return [createTextVNode("Ask")];
@@ -2431,28 +2553,28 @@ var SearchBox = defineComponent({
2431
2553
  }
2432
2554
  },
2433
2555
  render: function render() {
2434
- var _this16 = this;
2556
+ var _this19 = this;
2435
2557
  var expandSuggestionsContainer = this.$props.expandSuggestionsContainer;
2436
2558
  var _this$$slots = this.$slots,
2437
2559
  recentSearchesIcon = _this$$slots.recentSearchesIcon,
2438
2560
  popularSearchesIcon = _this$$slots.popularSearchesIcon;
2439
- var hasSuggestions = Array.isArray(this.normalizedSuggestions) && this.normalizedSuggestions.length;
2561
+ var hasSuggestions = Array.isArray(this.parsedSuggestions) && this.parsedSuggestions.length;
2440
2562
  var renderItem = this.$slots.renderItem || this.$props.renderItem;
2441
2563
  return createVNode(Container, {
2442
2564
  "class": this.$props.className
2443
2565
  }, {
2444
2566
  "default": function _default() {
2445
- return [_this16.$props.title && createVNode(Title, {
2446
- "class": getClassName$1(_this16.$props.innerClass, 'title') || ''
2567
+ return [_this19.$props.title && createVNode(Title, {
2568
+ "class": getClassName$1(_this19.$props.innerClass, 'title') || ''
2447
2569
  }, {
2448
2570
  "default": function _default() {
2449
- return [_this16.$props.title];
2571
+ return [_this19.$props.title];
2450
2572
  }
2451
- }), _this16.$props.autosuggest ? createVNode(Downshift, {
2452
- "id": _this16.$props.componentId + "-downshift",
2453
- "handleChange": _this16.onSuggestionSelected,
2454
- "handleMouseup": _this16.handleStateChange,
2455
- "isOpen": _this16.$data.isOpen
2573
+ }), _this19.$props.autosuggest ? createVNode(Downshift, {
2574
+ "id": _this19.$props.componentId + "-downshift",
2575
+ "handleChange": _this19.onSuggestionSelected,
2576
+ "handleMouseup": _this19.handleStateChange,
2577
+ "isOpen": _this19.$data.isOpen
2456
2578
  }, {
2457
2579
  "default": function _default(_ref8) {
2458
2580
  var getInputEvents = _ref8.getInputEvents,
@@ -2508,21 +2630,21 @@ var SearchBox = defineComponent({
2508
2630
  }
2509
2631
  };
2510
2632
  var indexOffset = 0;
2511
- return createVNode("div", null, [_this16.hasCustomRenderer && _this16.getComponent({
2633
+ return createVNode("div", null, [_this19.hasCustomRenderer && _this19.getComponent({
2512
2634
  isOpen: isOpen,
2513
2635
  getItemProps: getItemProps,
2514
2636
  getItemEvents: getItemEvents,
2515
2637
  highlightedIndex: highlightedIndex
2516
- }), _this16.renderErrorComponent(), !_this16.hasCustomRenderer && isOpen && hasSuggestions ? createVNode("ul", {
2517
- "class": suggestions(_this16.themePreset, _this16.theme) + " " + getClassName$1(_this16.$props.innerClass, 'list') + " " + searchboxSuggestions(_this16.themePreset, _this16.theme) + "\n\t\t\t\t\t\t\t\t\t\t\t\t\t",
2638
+ }), _this19.renderErrorComponent(), !_this19.hasCustomRenderer && isOpen && hasSuggestions ? createVNode("ul", {
2639
+ "class": suggestions(_this19.themePreset, _this19.theme) + " " + getClassName$1(_this19.$props.innerClass, 'list') + " " + searchboxSuggestions(_this19.themePreset, _this19.theme) + "\n\t\t\t\t\t\t\t\t\t\t\t\t\t",
2518
2640
  "ref": _dropdownULRef
2519
- }, [_this16.showAIScreen && createVNode(SearchBoxAISection, {
2520
- "themePreset": _this16.$props.themePreset
2641
+ }, [_this19.showAIScreen && createVNode(SearchBoxAISection, {
2642
+ "themePreset": _this19.$props.themePreset
2521
2643
  }, {
2522
2644
  "default": function _default() {
2523
- return [_this16.renderAIScreen(), ' ', _this16.renderErrorComponent(true)];
2645
+ return [_this19.renderAIScreen(), ' ', _this19.renderErrorComponent(true)];
2524
2646
  }
2525
- }), !_this16.showAIScreen && _this16.parsedSuggestions.map(function (item, itemIndex) {
2647
+ }), !_this19.showAIScreen && _this19.parsedSuggestions.map(function (item, itemIndex) {
2526
2648
  var index = indexOffset + itemIndex;
2527
2649
  if (Array.isArray(item)) {
2528
2650
  var sectionHtml = xss(item[0].sectionLabel);
@@ -2531,7 +2653,7 @@ var SearchBox = defineComponent({
2531
2653
  "key": "section-" + itemIndex,
2532
2654
  "class": "section-container"
2533
2655
  }, [sectionHtml ? createVNode("div", {
2534
- "class": "section-header " + getClassName$1(_this16.$props.innerClass, 'section-label'),
2656
+ "class": "section-header " + getClassName$1(_this19.$props.innerClass, 'section-label'),
2535
2657
  "key": "" + item[0].sectionId,
2536
2658
  "innerHTML": sectionHtml
2537
2659
  }, null) : null, createVNode("ul", {
@@ -2551,7 +2673,7 @@ var SearchBox = defineComponent({
2551
2673
  justifyContent: 'flex-start',
2552
2674
  alignItems: 'center'
2553
2675
  },
2554
- "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this16.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this16.$props.innerClass, 'suggestion-item'))
2676
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this19.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this19.$props.innerClass, 'suggestion-item'))
2555
2677
  }), [renderItem(sectionItem)]);
2556
2678
  }
2557
2679
  if (sectionItem._suggestion_type === '_internal_a_i_trigger') {
@@ -2565,9 +2687,9 @@ var SearchBox = defineComponent({
2565
2687
  justifyContent: 'flex-start',
2566
2688
  alignItems: 'center'
2567
2689
  },
2568
- "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this16.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this16.$props.innerClass, 'suggestion-item'))
2690
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this19.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this19.$props.innerClass, 'suggestion-item'))
2569
2691
  }), [createVNode(SuggestionItem, {
2570
- "currentValue": _this16.currentValue,
2692
+ "currentValue": _this19.currentValue,
2571
2693
  "suggestion": sectionItem
2572
2694
  }, null)]);
2573
2695
  }
@@ -2581,7 +2703,7 @@ var SearchBox = defineComponent({
2581
2703
  justifyContent: 'flex-start',
2582
2704
  alignItems: 'center'
2583
2705
  },
2584
- "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this16.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this16.$props.innerClass, 'suggestion-item'))
2706
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this19.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this19.$props.innerClass, 'suggestion-item'))
2585
2707
  }), [createVNode("div", {
2586
2708
  "style": {
2587
2709
  padding: '0 10px 0 0',
@@ -2589,74 +2711,74 @@ var SearchBox = defineComponent({
2589
2711
  }
2590
2712
  }, [createVNode(CustomSvg, {
2591
2713
  "key": sectionItem._suggestion_type + "-" + sectionIndex,
2592
- "className": getClassName$1(_this16.$props.innerClass, sectionItem._suggestion_type + "-search-icon") || null,
2714
+ "className": getClassName$1(_this19.$props.innerClass, sectionItem._suggestion_type + "-search-icon") || null,
2593
2715
  "icon": getIcon(sectionItem._suggestion_type, sectionItem, suggestionsHaveIcon),
2594
2716
  "type": sectionItem._suggestion_type + "-search-icon"
2595
2717
  }, null)]), createVNode(SuggestionItem, {
2596
- "currentValue": _this16.currentValue,
2718
+ "currentValue": _this19.currentValue,
2597
2719
  "suggestion": sectionItem
2598
- }, null), _this16.renderActionIcon(sectionItem)]);
2720
+ }, null), _this19.renderActionIcon(sectionItem)]);
2599
2721
  })])]);
2600
2722
  }
2601
2723
  return createVNode("div", null, [createTextVNode("No suggestions")]);
2602
- }), !_this16.showAIScreen && _this16.parsedSuggestions.length && _this16.$props.showSuggestionsFooter ? _this16.suggestionsFooter() : null]) : _this16.renderNoSuggestions(_this16.normalizedSuggestions)]);
2724
+ }), !_this19.showAIScreen && _this19.parsedSuggestions.length && _this19.$props.showSuggestionsFooter ? _this19.suggestionsFooter() : null]) : _this19.renderNoSuggestions(_this19.normalizedSuggestions)]);
2603
2725
  };
2604
2726
  return createVNode("div", {
2605
2727
  "class": suggestionsContainer
2606
2728
  }, [createVNode(InputGroup, {
2607
2729
  "searchBox": true,
2608
2730
  "ref": _inputGroupRef,
2609
- "isOpen": _this16.$data.isOpen
2731
+ "isOpen": _this19.$data.isOpen
2610
2732
  }, {
2611
2733
  "default": function _default() {
2612
2734
  return [createVNode(Actions$1, null, {
2613
2735
  "default": function _default() {
2614
- return [_this16.renderInputAddonBefore(), _this16.renderLeftIcons()];
2736
+ return [_this19.renderInputAddonBefore(), _this19.renderLeftIcons()];
2615
2737
  }
2616
2738
  }), createVNode(InputWrapper, null, {
2617
2739
  "default": function _default() {
2618
2740
  return [createVNode(TextArea, mergeProps(_transformOn(getInputEvents({
2619
- onInput: _this16.onInputChange,
2741
+ onInput: _this19.onInputChange,
2620
2742
  onBlur: function onBlur(e) {
2621
- _this16.$emit('blur', e, _this16.triggerQuery);
2743
+ _this19.$emit('blur', e, _this19.triggerQuery);
2622
2744
  },
2623
- onFocus: _this16.handleFocus,
2745
+ onFocus: _this19.handleFocus,
2624
2746
  onKeyPress: function onKeyPress(e) {
2625
- _this16.$emit('keyPress', e, _this16.triggerQuery);
2626
- _this16.$emit('key-press', e, _this16.triggerQuery);
2747
+ _this19.$emit('keyPress', e, _this19.triggerQuery);
2748
+ _this19.$emit('key-press', e, _this19.triggerQuery);
2627
2749
  },
2628
2750
  onKeyDown: function onKeyDown(e) {
2629
- return _this16.handleKeyDown(e, highlightedIndex);
2751
+ return _this19.handleKeyDown(e, highlightedIndex);
2630
2752
  },
2631
2753
  onKeyUp: function onKeyUp(e) {
2632
- _this16.$emit('keyUp', e, _this16.triggerQuery);
2633
- _this16.$emit('key-up', e, _this16.triggerQuery);
2754
+ _this19.$emit('keyUp', e, _this19.triggerQuery);
2755
+ _this19.$emit('key-up', e, _this19.triggerQuery);
2634
2756
  },
2635
2757
  onClick: function onClick() {
2636
2758
  setHighlightedIndex(null);
2637
2759
  }
2638
2760
  })), {
2639
2761
  "searchBox": true,
2640
- "isOpen": _this16.$data.isOpen,
2641
- "id": _this16.$props.componentId + "-input",
2642
- "ref": _this16.$props.innerRef,
2643
- "class": getClassName$1(_this16.$props.innerClass, 'input'),
2644
- "placeholder": _this16.$props.placeholder,
2645
- "autoFocus": _this16.$props.autoFocus
2762
+ "isOpen": _this19.$data.isOpen,
2763
+ "id": _this19.$props.componentId + "-input",
2764
+ "ref": _this19.$props.innerRef,
2765
+ "class": getClassName$1(_this19.$props.innerClass, 'input'),
2766
+ "placeholder": _this19.$props.placeholder,
2767
+ "autoFocus": _this19.$props.autoFocus
2646
2768
  }, getInputProps({
2647
- value: _this16.$data.currentValue === null ? '' : _this16.$data.currentValue
2769
+ value: _this19.$data.currentValue === null ? '' : _this19.$data.currentValue
2648
2770
  }), {
2649
- "themePreset": _this16.themePreset,
2771
+ "themePreset": _this19.themePreset,
2650
2772
  "autocomplete": "off"
2651
2773
  }), null), !expandSuggestionsContainer && renderSuggestionsDropdown()];
2652
2774
  }
2653
2775
  }), createVNode(Actions$1, null, {
2654
2776
  "default": function _default() {
2655
- return [_this16.renderRightIcons(), _this16.renderInputAddonAfter(), _this16.renderAskButtonElement(), _this16.renderEnterButtonElement()];
2777
+ return [_this19.renderRightIcons(), _this19.renderInputAddonAfter(), _this19.renderAskButtonElement(), _this19.renderEnterButtonElement()];
2656
2778
  }
2657
2779
  })];
2658
2780
  }
2659
- }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this16.renderTags()]);
2781
+ }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this19.renderTags()]);
2660
2782
  }
2661
2783
  }) : createVNode("div", {
2662
2784
  "class": suggestionsContainer
@@ -2667,43 +2789,43 @@ var SearchBox = defineComponent({
2667
2789
  "default": function _default() {
2668
2790
  return [createVNode(Actions$1, null, {
2669
2791
  "default": function _default() {
2670
- return [_this16.renderInputAddonBefore(), _this16.renderLeftIcons()];
2792
+ return [_this19.renderInputAddonBefore(), _this19.renderLeftIcons()];
2671
2793
  }
2672
2794
  }), createVNode(InputWrapper, null, {
2673
2795
  "default": function _default() {
2674
2796
  return [createVNode(TextArea, mergeProps(_transformOn({
2675
2797
  blur: function blur(e) {
2676
- _this16.$emit('blur', e, _this16.triggerQuery);
2798
+ _this19.$emit('blur', e, _this19.triggerQuery);
2677
2799
  },
2678
2800
  keypress: function keypress(e) {
2679
- _this16.$emit('keyPress', e, _this16.triggerQuery);
2680
- _this16.$emit('key-press', e, _this16.triggerQuery);
2801
+ _this19.$emit('keyPress', e, _this19.triggerQuery);
2802
+ _this19.$emit('key-press', e, _this19.triggerQuery);
2681
2803
  },
2682
- input: _this16.onInputChange,
2804
+ input: _this19.onInputChange,
2683
2805
  focus: function focus(e) {
2684
- _this16.$emit('focus', e, _this16.triggerQuery);
2806
+ _this19.$emit('focus', e, _this19.triggerQuery);
2685
2807
  },
2686
- keydown: _this16.handleKeyDown,
2808
+ keydown: _this19.handleKeyDown,
2687
2809
  keyup: function keyup(e) {
2688
- _this16.$emit('keyUp', e, _this16.triggerQuery);
2689
- _this16.$emit('key-up', e, _this16.triggerQuery);
2810
+ _this19.$emit('keyUp', e, _this19.triggerQuery);
2811
+ _this19.$emit('key-up', e, _this19.triggerQuery);
2690
2812
  }
2691
2813
  }), {
2692
2814
  "searchBox": true,
2693
- "class": getClassName$1(_this16.$props.innerClass, 'input') || '',
2694
- "placeholder": _this16.$props.placeholder,
2695
- "autofocus": _this16.$props.autoFocus,
2696
- "value": _this16.$data.currentValue ? _this16.$data.currentValue : '',
2697
- "iconPosition": _this16.$props.iconPosition,
2698
- "showIcon": _this16.$props.showIcon,
2699
- "showClear": _this16.$props.showClear,
2700
- "ref": _this16.$props.innerRef,
2701
- "themePreset": _this16.themePreset
2815
+ "class": getClassName$1(_this19.$props.innerClass, 'input') || '',
2816
+ "placeholder": _this19.$props.placeholder,
2817
+ "autofocus": _this19.$props.autoFocus,
2818
+ "value": _this19.$data.currentValue ? _this19.$data.currentValue : '',
2819
+ "iconPosition": _this19.$props.iconPosition,
2820
+ "showIcon": _this19.$props.showIcon,
2821
+ "showClear": _this19.$props.showClear,
2822
+ "ref": _this19.$props.innerRef,
2823
+ "themePreset": _this19.themePreset
2702
2824
  }), null)];
2703
2825
  }
2704
2826
  }), createVNode(Actions$1, null, {
2705
2827
  "default": function _default() {
2706
- return [_this16.renderRightIcons(), _this16.renderInputAddonAfter(), _this16.renderEnterButtonElement()];
2828
+ return [_this19.renderRightIcons(), _this19.renderInputAddonAfter(), _this19.renderEnterButtonElement()];
2707
2829
  }
2708
2830
  })];
2709
2831
  }
@@ -2918,12 +3040,14 @@ var AIAnswer = defineComponent({
2918
3040
  message: response.error
2919
3041
  };
2920
3042
  }
2921
-
2922
3043
  // pushing message history so far
2923
3044
  if (messagesHistory && Array.isArray(messagesHistory)) {
2924
3045
  finalMessages.push.apply(finalMessages, messagesHistory.filter(function (msg) {
2925
3046
  return msg.role !== AI_ROLES.SYSTEM;
2926
3047
  }));
3048
+ if (finalMessages[0].role === AI_ROLES.USER) {
3049
+ finalMessages.shift();
3050
+ }
2927
3051
  } else if (response && response.answer && response.answer.text) {
2928
3052
  finalMessages.push({
2929
3053
  role: AI_ROLES.ASSISTANT,