@appbaseio/reactivesearch-vue 3.1.0-alpha → 3.1.0-alpha.1

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.
@@ -27,8 +27,8 @@ var ReactiveBase = require('./ReactiveBase.js');
27
27
  var hotkeys = _interopDefault(require('hotkeys-js'));
28
28
  var xss = _interopDefault(require('xss'));
29
29
  var remarkable = require('remarkable');
30
- var DropDown = require('./DropDown-26666911.js');
31
- var Input = require('./Input-3ecdb905.js');
30
+ var DropDown = require('./DropDown-1532353d.js');
31
+ var Input = require('./Input-4279b088.js');
32
32
  var Container = require('./Container-29f049b2.js');
33
33
  var Highlight = _interopDefault(require('vue-highlight-words'));
34
34
  var query = require('@appbaseio/reactivecore/lib/actions/query');
@@ -65,7 +65,7 @@ InputGroup.defaultProps = {
65
65
  };
66
66
 
67
67
  var _templateObject$1;
68
- var InputAddon = vueEmotion.styled('span')(_templateObject$1 || (_templateObject$1 = _rollupPluginBabelHelpers._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"])));
68
+ var InputAddon = vueEmotion.styled('span')(_templateObject$1 || (_templateObject$1 = _rollupPluginBabelHelpers._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"])));
69
69
  InputAddon.defaultProps = {
70
70
  className: 'input-addon'
71
71
  };
@@ -836,7 +836,7 @@ var HorizontalSkeletonLoader = vue.defineComponent({
836
836
 
837
837
  var _templateObject$7, _templateObject2$2, _templateObject3$1, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
838
838
  var Chatbox = vueEmotion.styled('div')(_templateObject$7 || (_templateObject$7 = _rollupPluginBabelHelpers._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) {
839
- return props.theme && props.theme.colors ? props.theme.colors.backgroundColor : '#fff';
839
+ return props.theme && props.theme.colors && props.theme.colors.backgroundColor ? polished.lighten(0.1, props.theme.colors.backgroundColor) : '#fff';
840
840
  });
841
841
  var ChatContainer = vueEmotion.styled('div')(_templateObject2$2 || (_templateObject2$2 = _rollupPluginBabelHelpers._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) {
842
842
  return props.showInput ? 'bottom: 48px;' : '';
@@ -868,7 +868,7 @@ var resetCSS = function resetCSS(props) {
868
868
  // eslint-disable-next-line no-nested-ternary
869
869
  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: " + (
870
870
  // eslint-disable-next-line no-nested-ternary
871
- 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";
871
+ 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";
872
872
  };
873
873
  var messageBGColor = function messageBGColor(props) {
874
874
  var finalBGColor;
@@ -897,16 +897,10 @@ var Message = vueEmotion.styled('div')(_templateObject7 || (_templateObject7 = _
897
897
  return resetCSS(props);
898
898
  });
899
899
  var MessageInputContainer = vueEmotion.styled('form')(_templateObject8 || (_templateObject8 = _rollupPluginBabelHelpers._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"])));
900
- var MessageInput = vueEmotion.styled(Input.TextArea)(_templateObject9 || (_templateObject9 = _rollupPluginBabelHelpers._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) {
900
+ var MessageInput = vueEmotion.styled(Input.TextArea)(_templateObject9 || (_templateObject9 = _rollupPluginBabelHelpers._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) {
901
901
  return props.themePreset === 'dark' ? props.theme.colors.borderColor : '#fff';
902
902
  }, function (props) {
903
903
  return props.themePreset === 'dark' ? props.theme.colors.titleColor : props.theme.colors.textColor;
904
- }, function (props) {
905
- return props.theme.colors.textColor;
906
- }, function (props) {
907
- return props.theme.colors.textColor;
908
- }, function (props) {
909
- return props.theme.colors.textColor;
910
904
  }, function (_ref) {
911
905
  var enterButton = _ref.enterButton;
912
906
  return enterButton && "\n\t\t border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\t";
@@ -1187,7 +1181,8 @@ var SearchBox = vue.defineComponent({
1187
1181
  showFeedbackComponent: false,
1188
1182
  feedbackState: null,
1189
1183
  faqAnswer: '',
1190
- faqQuestion: ''
1184
+ faqQuestion: '',
1185
+ initialHits: null
1191
1186
  };
1192
1187
  this.internalComponent = props.componentId + "__internal";
1193
1188
  return this.__state;
@@ -1244,7 +1239,7 @@ var SearchBox = vue.defineComponent({
1244
1239
  if (Array.isArray(this.suggestions) && this.suggestions.length) {
1245
1240
  suggestionsArray = [].concat(withClickIds(this.suggestions));
1246
1241
  }
1247
- if (this.renderTriggerMessage() && this.currentValue && !this.isLoading) {
1242
+ if (this.renderTriggerMessage() && this.currentValue) {
1248
1243
  suggestionsArray.unshift({
1249
1244
  label: this.renderTriggerMessage(),
1250
1245
  value: 'AI_TRIGGER_MESSAGE',
@@ -1394,9 +1389,47 @@ var SearchBox = vue.defineComponent({
1394
1389
  AIUIConfig: vueTypes.types.AIUIConfig
1395
1390
  },
1396
1391
  mounted: function mounted() {
1392
+ var _this2 = this;
1397
1393
  this.listenForFocusShortcuts();
1394
+ var dropdownEle = this.$refs[_dropdownULRef];
1395
+ if (dropdownEle) {
1396
+ var handleScroll = function handleScroll() {
1397
+ var scrollTop = dropdownEle.scrollTop;
1398
+ _this2.lastScrollTop = scrollTop;
1399
+ if (scrollTop < _this2.lastScrollTop) {
1400
+ // User is scrolling up
1401
+ clearInterval(_this2.scrollTimerRef);
1402
+ _this2.isUserScrolling = true;
1403
+ }
1404
+ // Update lastScrollTop with the current scroll position
1405
+ _this2.lastScrollTop = scrollTop;
1406
+ };
1407
+ dropdownEle.addEventListener('scroll', handleScroll);
1408
+ }
1409
+ },
1410
+ updated: function updated() {
1411
+ if (this.$props.mode === constants.SEARCH_COMPONENTS_MODES.SELECT && this.$options.isTagsMode === true) {
1412
+ this.$options.isTagsMode = false;
1413
+ this.selectedTags = [];
1414
+ } else if (this.$props.mode === constants.SEARCH_COMPONENTS_MODES.TAG && this.$options.isTagsMode === false) {
1415
+ this.$options.isTagsMode = true;
1416
+ }
1398
1417
  },
1399
1418
  watch: {
1419
+ AIResponse: function AIResponse(newVal) {
1420
+ if (newVal) {
1421
+ if (this.$props.AIUIConfig && this.$props.AIUIConfig.showSourceDocuments && newVal.response && newVal.response.answer && Array.isArray(newVal.response.answer.documentIds)) {
1422
+ this.sourceDocIds = newVal.response.answer.documentIds;
1423
+ var localCache = helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) && helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY)[this.$props.componentId];
1424
+ if (localCache && localCache.meta && localCache.meta.hits && localCache.meta.hits.hits) {
1425
+ this.initialHits = localCache.meta.hits.hits;
1426
+ }
1427
+ if (!this.showAIScreenFooter) {
1428
+ this.showAIScreenFooter = true;
1429
+ }
1430
+ }
1431
+ }
1432
+ },
1400
1433
  dataField: function dataField(newVal, oldVal) {
1401
1434
  if (!isEqual(newVal, oldVal)) {
1402
1435
  this.triggerCustomQuery(this.$data.currentValue);
@@ -1471,6 +1504,9 @@ var SearchBox = vue.defineComponent({
1471
1504
  loading: this.isLoading,
1472
1505
  error: this.isError
1473
1506
  });
1507
+ if (newVal && newVal.hits && newVal.hits.hits) {
1508
+ this.initialHits = newVal.hits.hits;
1509
+ }
1474
1510
  },
1475
1511
  aggregationData: function aggregationData(newVal) {
1476
1512
  this.$emit('on-data', {
@@ -1505,9 +1541,10 @@ var SearchBox = vue.defineComponent({
1505
1541
  }
1506
1542
  },
1507
1543
  isAITyping: function isAITyping(newVal, oldVal) {
1508
- var _this2 = this;
1544
+ var _this3 = this;
1509
1545
  var scrollAIContainer = function scrollAIContainer() {
1510
- var dropdownEle = _this2.$refs[_dropdownULRef];
1546
+ if (_this3.isUserScrolling) return;
1547
+ var dropdownEle = _this3.$refs[_dropdownULRef];
1511
1548
  if (dropdownEle) {
1512
1549
  dropdownEle.scrollTo({
1513
1550
  top: dropdownEle.scrollHeight,
@@ -1516,6 +1553,7 @@ var SearchBox = vue.defineComponent({
1516
1553
  }
1517
1554
  };
1518
1555
  if (!newVal && oldVal) {
1556
+ clearInterval(this.scrollTimerRef);
1519
1557
  this.showAIScreenFooter = true;
1520
1558
  if (this.$props.AIUIConfig && typeof this.$props.AIUIConfig.showFeedback === 'boolean' ? this.$props.AIUIConfig.showFeedback : true) {
1521
1559
  this.showFeedbackComponent = true;
@@ -1524,7 +1562,7 @@ var SearchBox = vue.defineComponent({
1524
1562
  scrollAIContainer();
1525
1563
  }, 500);
1526
1564
  } else if (newVal) {
1527
- this.scrollTimerRef = setTimeout(function () {
1565
+ this.scrollTimerRef = setInterval(function () {
1528
1566
  scrollAIContainer();
1529
1567
  }, 2000);
1530
1568
  }
@@ -1541,7 +1579,7 @@ var SearchBox = vue.defineComponent({
1541
1579
  }
1542
1580
  },
1543
1581
  currentValue: function currentValue() {
1544
- this.handleTextAreaHeightChange();
1582
+ this.$nextTick(this.handleTextAreaHeightChange);
1545
1583
  }
1546
1584
  },
1547
1585
  methods: {
@@ -1616,7 +1654,7 @@ var SearchBox = vue.defineComponent({
1616
1654
  }
1617
1655
  },
1618
1656
  setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue, shouldExecuteQuery) {
1619
- var _this3 = this;
1657
+ var _this4 = this;
1620
1658
  if (isDefaultValue === void 0) {
1621
1659
  isDefaultValue = false;
1622
1660
  }
@@ -1633,65 +1671,65 @@ var SearchBox = vue.defineComponent({
1633
1671
  shouldExecuteQuery = true;
1634
1672
  }
1635
1673
  var performUpdate = function performUpdate() {
1636
- if (_this3.$options.isTagsMode && isEqual(value, _this3.selectedTags)) {
1674
+ if (_this4.$options.isTagsMode && isEqual(value, _this4.selectedTags)) {
1637
1675
  return;
1638
1676
  }
1639
- if (_this3.$options.isTagsMode && cause === reactivecore.causes.SUGGESTION_SELECT) {
1640
- if (Array.isArray(_this3.selectedTags) && _this3.selectedTags.length) {
1677
+ if (_this4.$options.isTagsMode && cause === reactivecore.causes.SUGGESTION_SELECT) {
1678
+ if (Array.isArray(_this4.selectedTags) && _this4.selectedTags.length) {
1641
1679
  // check if value already present in selectedTags
1642
- if (typeof value === 'string' && _this3.selectedTags.includes(value)) {
1643
- _this3.isOpen = false;
1680
+ if (typeof value === 'string' && _this4.selectedTags.includes(value)) {
1681
+ _this4.isOpen = false;
1644
1682
  return;
1645
1683
  }
1646
- _this3.selectedTags = [].concat(_this3.selectedTags);
1684
+ _this4.selectedTags = [].concat(_this4.selectedTags);
1647
1685
  if (typeof value === 'string' && !!value) {
1648
- _this3.selectedTags.push(value);
1649
- } else if (Array.isArray(value) && !isEqual(_this3.selectedTags, value)) {
1650
- _this3.selectedTags = value;
1686
+ _this4.selectedTags.push(value);
1687
+ } else if (Array.isArray(value) && !isEqual(_this4.selectedTags, value)) {
1688
+ _this4.selectedTags = value;
1651
1689
  }
1652
1690
  } else if (value) {
1653
- _this3.selectedTags = typeof value !== 'string' ? value : [].concat(value);
1691
+ _this4.selectedTags = typeof value !== 'string' ? value : [].concat(value);
1654
1692
  }
1655
- _this3.currentValue = '';
1693
+ _this4.currentValue = '';
1656
1694
  } else {
1657
- _this3.currentValue = index.decodeHtml(value);
1695
+ _this4.currentValue = index.decodeHtml(value);
1658
1696
  }
1659
1697
  var queryHandlerValue = value;
1660
- if (_this3.$options.isTagsMode && cause === reactivecore.causes.SUGGESTION_SELECT) {
1661
- queryHandlerValue = Array.isArray(_this3.selectedTags) && _this3.selectedTags.length ? _this3.selectedTags : undefined;
1698
+ if (_this4.$options.isTagsMode && cause === reactivecore.causes.SUGGESTION_SELECT) {
1699
+ queryHandlerValue = Array.isArray(_this4.selectedTags) && _this4.selectedTags.length ? _this4.selectedTags : undefined;
1662
1700
  }
1663
- if ((_this3.faqAnswer || _this3.faqQuestion) && value === '') {
1701
+ if ((_this4.faqAnswer || _this4.faqQuestion) && value === '') {
1664
1702
  // Empty the previous state
1665
- _this3.faqAnswer = '';
1666
- _this3.faqQuestion = '';
1667
- _this3.showAIScreen = false;
1703
+ _this4.faqAnswer = '';
1704
+ _this4.faqQuestion = '';
1705
+ _this4.showAIScreen = false;
1668
1706
  }
1669
1707
  if (isDefaultValue) {
1670
- if (_this3.$props.autosuggest) {
1708
+ if (_this4.$props.autosuggest) {
1671
1709
  if (toggleIsOpen) {
1672
- _this3.isOpen = false;
1710
+ _this4.isOpen = false;
1673
1711
  }
1674
- if (typeof _this3.currentValue === 'string') _this3.triggerDefaultQuery(_this3.currentValue, props.enableAI && _this3.currentTriggerMode === constants.AI_TRIGGER_MODES.QUESTION && _this3.currentValue.endsWith('?') ? {
1712
+ if (typeof _this4.currentValue === 'string') _this4.triggerDefaultQuery(_this4.currentValue, props.enableAI && _this4.currentTriggerMode === constants.AI_TRIGGER_MODES.QUESTION && _this4.currentValue.endsWith('?') ? {
1675
1713
  enableAI: true
1676
1714
  } : {}, shouldExecuteQuery);
1677
1715
  } // in case of strict selection only SUGGESTION_SELECT should be able
1678
1716
  // to set the query otherwise the value should reset
1679
1717
  if (props.strictSelection) {
1680
- if (cause === reactivecore.causes.SUGGESTION_SELECT || (_this3.$options.isTagsMode ? _this3.selectedTags.length === 0 : value === '')) {
1681
- _this3.triggerCustomQuery(queryHandlerValue, _this3.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1718
+ if (cause === reactivecore.causes.SUGGESTION_SELECT || (_this4.$options.isTagsMode ? _this4.selectedTags.length === 0 : value === '')) {
1719
+ _this4.triggerCustomQuery(queryHandlerValue, _this4.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1682
1720
  } else {
1683
- _this3.setValue('', true);
1721
+ _this4.setValue('', true);
1684
1722
  }
1685
1723
  } else if (props.value === undefined || cause === reactivecore.causes.SUGGESTION_SELECT || cause === reactivecore.causes.CLEAR_VALUE) {
1686
- _this3.showAIScreen = false;
1687
- _this3.triggerCustomQuery(queryHandlerValue, _this3.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1724
+ _this4.showAIScreen = false;
1725
+ _this4.triggerCustomQuery(queryHandlerValue, _this4.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1688
1726
  }
1689
1727
  } else {
1690
1728
  // debounce for handling text while typing
1691
- _this3.handleTextChange(value, cause);
1729
+ _this4.handleTextChange(value, cause);
1692
1730
  }
1693
- _this3.$emit('valueChange', value);
1694
- _this3.$emit('value-change', value);
1731
+ _this4.$emit('valueChange', value);
1732
+ _this4.$emit('value-change', value);
1695
1733
  };
1696
1734
  checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
1697
1735
  },
@@ -1840,7 +1878,7 @@ var SearchBox = vue.defineComponent({
1840
1878
  this.$emit('key-down', event, this.triggerQuery);
1841
1879
  },
1842
1880
  onInputChange: function onInputChange(e) {
1843
- var _this4 = this;
1881
+ var _this5 = this;
1844
1882
  var inputValue = e.target.value;
1845
1883
  if (!this.$data.isOpen && this.$props.autosuggest) {
1846
1884
  this.isOpen = true;
@@ -1854,7 +1892,7 @@ var SearchBox = vue.defineComponent({
1854
1892
  } else {
1855
1893
  this.$emit('change', inputValue, function (_ref3) {
1856
1894
  var isOpen = _ref3.isOpen;
1857
- return _this4.triggerQuery({
1895
+ return _this5.triggerQuery({
1858
1896
  defaultQuery: true,
1859
1897
  customQuery: true,
1860
1898
  value: inputValue,
@@ -1898,7 +1936,7 @@ var SearchBox = vue.defineComponent({
1898
1936
  }
1899
1937
  },
1900
1938
  onSuggestionSelected: function onSuggestionSelected(suggestion) {
1901
- var _this5 = this;
1939
+ var _this6 = this;
1902
1940
  var value = this.$props.value;
1903
1941
  // The state of the suggestion is open by the time it reaches here. i.e. isOpen = true
1904
1942
  // handle when FAQ suggestion is clicked
@@ -1947,10 +1985,10 @@ var SearchBox = vue.defineComponent({
1947
1985
  this.setValue(emitValue, true, this.$props, reactivecore.causes.SUGGESTION_SELECT, false, suggestion._category);
1948
1986
  this.$emit('change', emitValue, function (_ref4) {
1949
1987
  var isOpen = _ref4.isOpen;
1950
- return _this5.triggerQuery(_rollupPluginBabelHelpers._extends({
1988
+ return _this6.triggerQuery(_rollupPluginBabelHelpers._extends({
1951
1989
  isOpen: isOpen,
1952
1990
  value: emitValue
1953
- }, !_this5.$options.isTagsMode && {
1991
+ }, !_this6.$options.isTagsMode && {
1954
1992
  categoryValue: suggestion._category
1955
1993
  }));
1956
1994
  });
@@ -1990,7 +2028,7 @@ var SearchBox = vue.defineComponent({
1990
2028
  return null;
1991
2029
  },
1992
2030
  renderErrorComponent: function renderErrorComponent(isAIError) {
1993
- var _this6 = this;
2031
+ var _this7 = this;
1994
2032
  if (isAIError === void 0) {
1995
2033
  isAIError = false;
1996
2034
  }
@@ -2017,7 +2055,7 @@ var SearchBox = vue.defineComponent({
2017
2055
  "themePreset": this.themePreset
2018
2056
  }, {
2019
2057
  "default": function _default() {
2020
- return [index.isFunction(renderError) ? renderError(_this6.error) : renderError];
2058
+ return [index.isFunction(renderError) ? renderError(_this7.error) : renderError];
2021
2059
  }
2022
2060
  });
2023
2061
  }
@@ -2097,7 +2135,7 @@ var SearchBox = vue.defineComponent({
2097
2135
  });
2098
2136
  },
2099
2137
  renderEnterButtonElement: function renderEnterButtonElement() {
2100
- var _this7 = this;
2138
+ var _this8 = this;
2101
2139
  var _this$$props2 = this.$props,
2102
2140
  enterButton = _this$$props2.enterButton,
2103
2141
  innerClass = _this$$props2.innerClass;
@@ -2105,12 +2143,12 @@ var SearchBox = vue.defineComponent({
2105
2143
  if (enterButton) {
2106
2144
  var getEnterButtonMarkup = function getEnterButtonMarkup() {
2107
2145
  if (renderEnterButton) {
2108
- return renderEnterButton(_this7.enterButtonOnClick);
2146
+ return renderEnterButton(_this8.enterButtonOnClick);
2109
2147
  }
2110
2148
  return vue.createVNode(Button.Button, {
2111
2149
  "class": "enter-btn " + getClassName$1(innerClass, 'enter-button'),
2112
2150
  "primary": true,
2113
- "onClick": _this7.enterButtonOnClick
2151
+ "onClick": _this8.enterButtonOnClick
2114
2152
  }, {
2115
2153
  "default": function _default() {
2116
2154
  return [vue.createTextVNode("Search")];
@@ -2136,7 +2174,7 @@ var SearchBox = vue.defineComponent({
2136
2174
  return '/';
2137
2175
  },
2138
2176
  renderLeftIcons: function renderLeftIcons() {
2139
- var _this8 = this;
2177
+ var _this9 = this;
2140
2178
  var _slot3;
2141
2179
  var _this$$props3 = this.$props,
2142
2180
  iconPosition = _this$$props3.iconPosition,
@@ -2146,8 +2184,8 @@ var SearchBox = vue.defineComponent({
2146
2184
  }, {
2147
2185
  "default": function _default() {
2148
2186
  return [iconPosition === 'left' && showIcon && vue.createVNode(DropDown.IconWrapper, {
2149
- "onClick": _this8.handleSearchIconClick
2150
- }, _isSlot(_slot3 = _this8.renderIcon()) ? _slot3 : {
2187
+ "onClick": _this9.handleSearchIconClick
2188
+ }, _isSlot(_slot3 = _this9.renderIcon()) ? _slot3 : {
2151
2189
  "default": function _default() {
2152
2190
  return [_slot3];
2153
2191
  }
@@ -2156,7 +2194,7 @@ var SearchBox = vue.defineComponent({
2156
2194
  })]);
2157
2195
  },
2158
2196
  renderRightIcons: function renderRightIcons() {
2159
- var _this9 = this;
2197
+ var _this10 = this;
2160
2198
  var _slot4, _slot5, _slot6;
2161
2199
  var _this$$props4 = this.$props,
2162
2200
  iconPosition = _this$$props4.iconPosition,
@@ -2173,29 +2211,29 @@ var SearchBox = vue.defineComponent({
2173
2211
  }, {
2174
2212
  "default": function _default() {
2175
2213
  return [currentValue && showClear && vue.createVNode(DropDown.IconWrapper, {
2176
- "onClick": _this9.clearValue,
2214
+ "onClick": _this10.clearValue,
2177
2215
  "showIcon": showIcon,
2178
2216
  "isClearIcon": true
2179
- }, _isSlot(_slot4 = _this9.renderCancelIcon()) ? _slot4 : {
2217
+ }, _isSlot(_slot4 = _this10.renderCancelIcon()) ? _slot4 : {
2180
2218
  "default": function _default() {
2181
2219
  return [_slot4];
2182
2220
  }
2183
2221
  }), showFocusShortcutsIcon && vue.createVNode(DropDown.ButtonIconWrapper, {
2184
2222
  "onClick": function onClick(e) {
2185
- return _this9.focusSearchBox(e);
2223
+ return _this10.focusSearchBox(e);
2186
2224
  }
2187
- }, _isSlot(_slot5 = _this9.renderShortcut()) ? _slot5 : {
2225
+ }, _isSlot(_slot5 = _this10.renderShortcut()) ? _slot5 : {
2188
2226
  "default": function _default() {
2189
2227
  return [_slot5];
2190
2228
  }
2191
2229
  }), showVoiceSearch && vue.createVNode(Mic, {
2192
2230
  "getInstance": getMicInstance,
2193
2231
  "render": renderMic,
2194
- "handleResult": _this9.handleVoiceResults,
2232
+ "handleResult": _this10.handleVoiceResults,
2195
2233
  "className": getClassName$1(innerClass, 'mic') || null
2196
2234
  }, null), iconPosition === 'right' && showIcon && vue.createVNode(DropDown.IconWrapper, {
2197
- "onClick": _this9.handleSearchIconClick
2198
- }, _isSlot(_slot6 = _this9.renderIcon()) ? _slot6 : {
2235
+ "onClick": _this10.handleSearchIconClick
2236
+ }, _isSlot(_slot6 = _this10.renderIcon()) ? _slot6 : {
2199
2237
  "default": function _default() {
2200
2238
  return [_slot6];
2201
2239
  }
@@ -2214,7 +2252,7 @@ var SearchBox = vue.defineComponent({
2214
2252
  (_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
2215
2253
  },
2216
2254
  listenForFocusShortcuts: function listenForFocusShortcuts() {
2217
- var _this10 = this;
2255
+ var _this11 = this;
2218
2256
  var _this$$props$focusSho = this.$props.focusShortcuts,
2219
2257
  focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
2220
2258
  if (index.isEmpty(focusShortcuts)) {
@@ -2229,7 +2267,7 @@ var SearchBox = vue.defineComponent({
2229
2267
  function (event, handler) {
2230
2268
  // Prevent the default refresh event under WINDOWS system
2231
2269
  event.preventDefault();
2232
- _this10.focusSearchBox(event);
2270
+ _this11.focusSearchBox(event);
2233
2271
  });
2234
2272
 
2235
2273
  // if one of modifier keys are used, they are handled below
@@ -2239,7 +2277,7 @@ var SearchBox = vue.defineComponent({
2239
2277
  for (var index$1 = 0; index$1 < modifierKeys.length; index$1 += 1) {
2240
2278
  var element = modifierKeys[index$1];
2241
2279
  if (hotkeys[element]) {
2242
- _this10.focusSearchBox(event);
2280
+ _this11.focusSearchBox(event);
2243
2281
  break;
2244
2282
  }
2245
2283
  }
@@ -2252,10 +2290,10 @@ var SearchBox = vue.defineComponent({
2252
2290
  this.triggerDefaultQuery(value);
2253
2291
  },
2254
2292
  renderActionIcon: function renderActionIcon(suggestion) {
2255
- var _this11 = this;
2293
+ var _this12 = this;
2256
2294
  var handleAutoFillClick = function handleAutoFillClick(e) {
2257
2295
  e.stopPropagation();
2258
- _this11.onAutofillClick(suggestion);
2296
+ _this12.onAutofillClick(suggestion);
2259
2297
  };
2260
2298
  if (suggestion._suggestion_type === helper.suggestionTypes.Featured) {
2261
2299
  if (suggestion.action === helper.featuredSuggestionsActionTypes.FUNCTION) {
@@ -2278,7 +2316,7 @@ var SearchBox = vue.defineComponent({
2278
2316
  return null;
2279
2317
  },
2280
2318
  renderTag: function renderTag(item) {
2281
- var _this12 = this;
2319
+ var _this13 = this;
2282
2320
  var innerClass = this.$props.innerClass;
2283
2321
  return vue.createVNode(TagItem, {
2284
2322
  "class": getClassName$1(innerClass, 'selected-tag') || ''
@@ -2289,7 +2327,7 @@ var SearchBox = vue.defineComponent({
2289
2327
  "aria-label": "delete-tag",
2290
2328
  "class": "close-icon",
2291
2329
  "onClick": function onClick() {
2292
- return _this12.clearTag(item);
2330
+ return _this13.clearTag(item);
2293
2331
  }
2294
2332
  }, [vue.createVNode(DropDown.CancelSvg, null, null)])];
2295
2333
  }
@@ -2312,7 +2350,7 @@ var SearchBox = vue.defineComponent({
2312
2350
  }
2313
2351
  },
2314
2352
  renderTags: function renderTags() {
2315
- var _this13 = this;
2353
+ var _this14 = this;
2316
2354
  if (!Array.isArray(this.selectedTags)) {
2317
2355
  return null;
2318
2356
  }
@@ -2326,16 +2364,16 @@ var SearchBox = vue.defineComponent({
2326
2364
  }) : vue.createVNode(TagsContainer, null, {
2327
2365
  "default": function _default() {
2328
2366
  return [tagsList.map(function (item) {
2329
- return _this13.renderTag(item);
2367
+ return _this14.renderTag(item);
2330
2368
  }), shouldRenderClearAllTag && vue.createVNode(TagItem, {
2331
- "class": getClassName$1(_this13.$props.innerClass, 'selected-tag') || ''
2369
+ "class": getClassName$1(_this14.$props.innerClass, 'selected-tag') || ''
2332
2370
  }, {
2333
2371
  "default": function _default() {
2334
2372
  return [vue.createVNode("span", null, [vue.createTextVNode("Clear All")]), vue.createVNode("span", {
2335
2373
  "role": "img",
2336
2374
  "aria-label": "delete-tag",
2337
2375
  "class": "close-icon",
2338
- "onClick": _this13.clearAllTags
2376
+ "onClick": _this14.clearAllTags
2339
2377
  }, [vue.createVNode(DropDown.CancelSvg, null, null)])];
2340
2378
  }
2341
2379
  })];
@@ -2343,13 +2381,13 @@ var SearchBox = vue.defineComponent({
2343
2381
  });
2344
2382
  },
2345
2383
  getAISourceObjects: function getAISourceObjects() {
2346
- var localCache = helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) && helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY)[this.componentId];
2384
+ var _this15 = this;
2347
2385
  var sourceObjects = [];
2348
2386
  if (!this.AIResponse) return sourceObjects;
2349
2387
  var docIds = this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [];
2350
- if (localCache && localCache.meta && localCache.meta.hits && localCache.meta.hits.hits) {
2388
+ if (this.initialHits) {
2351
2389
  docIds.forEach(function (id) {
2352
- var foundSourceObj = localCache.meta.hits.hits.find(function (hit) {
2390
+ var foundSourceObj = _this15.initialHits.find(function (hit) {
2353
2391
  return hit._id === id;
2354
2392
  }) || {};
2355
2393
  if (foundSourceObj) {
@@ -2383,31 +2421,31 @@ var SearchBox = vue.defineComponent({
2383
2421
  },
2384
2422
  renderAIScreenFooter: function renderAIScreenFooter() {
2385
2423
  var _slot8;
2386
- var _this14 = this;
2424
+ var _this16 = this;
2387
2425
  var _this$$props$AIUIConf2 = this.$props.AIUIConfig,
2388
2426
  AIUIConfig = _this$$props$AIUIConf2 === void 0 ? {} : _this$$props$AIUIConf2;
2389
2427
  var _ref6 = AIUIConfig || {},
2390
2428
  _ref6$showSourceDocum = _ref6.showSourceDocuments,
2391
- showSourceDocuments = _ref6$showSourceDocum === void 0 ? true : _ref6$showSourceDocum,
2429
+ showSourceDocuments = _ref6$showSourceDocum === void 0 ? false : _ref6$showSourceDocum,
2392
2430
  _ref6$onSourceClick = _ref6.onSourceClick,
2393
2431
  onSourceClick = _ref6$onSourceClick === void 0 ? function () {} : _ref6$onSourceClick;
2394
2432
  var renderSourceDocumentLabel = function renderSourceDocumentLabel(sourceObj) {
2395
- if (_this14.$props.AIUIConfig && _this14.$props.AIUIConfig.renderSourceDocument) {
2396
- return _this14.$props.AIUIConfig.renderSourceDocument(sourceObj);
2433
+ if (_this16.$props.AIUIConfig && _this16.$props.AIUIConfig.renderSourceDocument) {
2434
+ return _this16.$props.AIUIConfig.renderSourceDocument(sourceObj);
2397
2435
  }
2398
- if (_this14.$slots.renderSourceDocument) {
2399
- return _this14.$slots.renderSourceDocument(sourceObj);
2436
+ if (_this16.$slots.renderSourceDocument) {
2437
+ return _this16.$slots.renderSourceDocument(sourceObj);
2400
2438
  }
2401
2439
  return sourceObj._id;
2402
2440
  };
2403
- return showSourceDocuments && this.showAIScreenFooter && this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds ? vue.createVNode(Footer, {
2441
+ return showSourceDocuments && this.showAIScreenFooter && this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds && this.AIResponse.response.answer.documentIds.length ? vue.createVNode(Footer, {
2404
2442
  "themePreset": this.$props.themePreset
2405
2443
  }, {
2406
2444
  "default": function _default() {
2407
- return [vue.createTextVNode("Summary generated using the following sources:"), ' ', vue.createVNode(SourceTags, null, _isSlot(_slot8 = _this14.getAISourceObjects().map(function (el) {
2445
+ return [vue.createTextVNode("Summary generated using the following sources:"), ' ', vue.createVNode(SourceTags, null, _isSlot(_slot8 = _this16.getAISourceObjects().map(function (el) {
2408
2446
  var _slot7;
2409
2447
  return vue.createVNode(Button.Button, {
2410
- "class": "--ai-source-tag " + (getClassName$1(_this14.$props.innerClass, 'ai-source-tag') || ''),
2448
+ "class": "--ai-source-tag " + (getClassName$1(_this16.$props.innerClass, 'ai-source-tag') || ''),
2411
2449
  "info": true,
2412
2450
  "onClick": function onClick() {
2413
2451
  return onSourceClick && onSourceClick(el);
@@ -2426,7 +2464,7 @@ var SearchBox = vue.defineComponent({
2426
2464
  }) : null;
2427
2465
  },
2428
2466
  renderAIScreen: function renderAIScreen() {
2429
- var _this15 = this;
2467
+ var _this17 = this;
2430
2468
  var customAIRenderer = this.$props.renderAIAnswer || this.$slots.renderAIAnswer;
2431
2469
  if (customAIRenderer) {
2432
2470
  return customAIRenderer({
@@ -2450,11 +2488,11 @@ var SearchBox = vue.defineComponent({
2450
2488
  "hideUI": this.isAIResponseLoading || this.isLoading || !this.sessionIdFromStore,
2451
2489
  "key": this.sessionIdFromStore,
2452
2490
  "onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
2453
- _this15.feedbackState = {
2491
+ _this17.feedbackState = {
2454
2492
  isRecorded: true,
2455
2493
  feedbackType: useful ? 'positive' : 'negative'
2456
2494
  };
2457
- _this15.recordAISessionUsefulness(_this15.sessionIdFromStore, {
2495
+ _this17.recordAISessionUsefulness(_this17.sessionIdFromStore, {
2458
2496
  useful: useful,
2459
2497
  reason: reason
2460
2498
  });
@@ -2489,7 +2527,7 @@ var SearchBox = vue.defineComponent({
2489
2527
  });
2490
2528
  },
2491
2529
  renderAskButtonElement: function renderAskButtonElement() {
2492
- var _this16 = this;
2530
+ var _this18 = this;
2493
2531
  var _this$$props5 = this.$props,
2494
2532
  AIUIConfig = _this$$props5.AIUIConfig,
2495
2533
  innerClass = _this$$props5.innerClass;
@@ -2499,12 +2537,12 @@ var SearchBox = vue.defineComponent({
2499
2537
  if (askButton) {
2500
2538
  var getEnterButtonMarkup = function getEnterButtonMarkup() {
2501
2539
  if (renderAskButton) {
2502
- return renderAskButton(_this16.askButtonOnClick);
2540
+ return renderAskButton(_this18.askButtonOnClick);
2503
2541
  }
2504
2542
  return vue.createVNode(Button.Button, {
2505
2543
  "class": "enter-btn " + getClassName$1(innerClass, 'ask-button'),
2506
2544
  "info": true,
2507
- "onClick": _this16.askButtonOnClick
2545
+ "onClick": _this18.askButtonOnClick
2508
2546
  }, {
2509
2547
  "default": function _default() {
2510
2548
  return [vue.createTextVNode("Ask")];
@@ -2519,28 +2557,28 @@ var SearchBox = vue.defineComponent({
2519
2557
  }
2520
2558
  },
2521
2559
  render: function render() {
2522
- var _this17 = this;
2560
+ var _this19 = this;
2523
2561
  var expandSuggestionsContainer = this.$props.expandSuggestionsContainer;
2524
2562
  var _this$$slots = this.$slots,
2525
2563
  recentSearchesIcon = _this$$slots.recentSearchesIcon,
2526
2564
  popularSearchesIcon = _this$$slots.popularSearchesIcon;
2527
- var hasSuggestions = Array.isArray(this.normalizedSuggestions) && this.normalizedSuggestions.length;
2565
+ var hasSuggestions = Array.isArray(this.parsedSuggestions) && this.parsedSuggestions.length;
2528
2566
  var renderItem = this.$slots.renderItem || this.$props.renderItem;
2529
2567
  return vue.createVNode(Container.Container, {
2530
2568
  "class": this.$props.className
2531
2569
  }, {
2532
2570
  "default": function _default() {
2533
- return [_this17.$props.title && vue.createVNode(Title.Title, {
2534
- "class": getClassName$1(_this17.$props.innerClass, 'title') || ''
2571
+ return [_this19.$props.title && vue.createVNode(Title.Title, {
2572
+ "class": getClassName$1(_this19.$props.innerClass, 'title') || ''
2535
2573
  }, {
2536
2574
  "default": function _default() {
2537
- return [_this17.$props.title];
2575
+ return [_this19.$props.title];
2538
2576
  }
2539
- }), _this17.$props.autosuggest ? vue.createVNode(DropDown.Downshift, {
2540
- "id": _this17.$props.componentId + "-downshift",
2541
- "handleChange": _this17.onSuggestionSelected,
2542
- "handleMouseup": _this17.handleStateChange,
2543
- "isOpen": _this17.$data.isOpen
2577
+ }), _this19.$props.autosuggest ? vue.createVNode(DropDown.Downshift, {
2578
+ "id": _this19.$props.componentId + "-downshift",
2579
+ "handleChange": _this19.onSuggestionSelected,
2580
+ "handleMouseup": _this19.handleStateChange,
2581
+ "isOpen": _this19.$data.isOpen
2544
2582
  }, {
2545
2583
  "default": function _default(_ref8) {
2546
2584
  var getInputEvents = _ref8.getInputEvents,
@@ -2596,21 +2634,21 @@ var SearchBox = vue.defineComponent({
2596
2634
  }
2597
2635
  };
2598
2636
  var indexOffset = 0;
2599
- return vue.createVNode("div", null, [_this17.hasCustomRenderer && _this17.getComponent({
2637
+ return vue.createVNode("div", null, [_this19.hasCustomRenderer && _this19.getComponent({
2600
2638
  isOpen: isOpen,
2601
2639
  getItemProps: getItemProps,
2602
2640
  getItemEvents: getItemEvents,
2603
2641
  highlightedIndex: highlightedIndex
2604
- }), _this17.renderErrorComponent(), !_this17.hasCustomRenderer && isOpen && hasSuggestions ? vue.createVNode("ul", {
2605
- "class": Input.suggestions(_this17.themePreset, _this17.theme) + " " + getClassName$1(_this17.$props.innerClass, 'list') + " " + Input.searchboxSuggestions(_this17.themePreset, _this17.theme) + "\n\t\t\t\t\t\t\t\t\t\t\t\t\t",
2642
+ }), _this19.renderErrorComponent(), !_this19.hasCustomRenderer && isOpen && hasSuggestions ? vue.createVNode("ul", {
2643
+ "class": Input.suggestions(_this19.themePreset, _this19.theme) + " " + getClassName$1(_this19.$props.innerClass, 'list') + " " + Input.searchboxSuggestions(_this19.themePreset, _this19.theme) + "\n\t\t\t\t\t\t\t\t\t\t\t\t\t",
2606
2644
  "ref": _dropdownULRef
2607
- }, [_this17.showAIScreen && vue.createVNode(SearchBoxAISection, {
2608
- "themePreset": _this17.$props.themePreset
2645
+ }, [_this19.showAIScreen && vue.createVNode(SearchBoxAISection, {
2646
+ "themePreset": _this19.$props.themePreset
2609
2647
  }, {
2610
2648
  "default": function _default() {
2611
- return [_this17.renderAIScreen(), ' ', _this17.renderErrorComponent(true)];
2649
+ return [_this19.renderAIScreen(), ' ', _this19.renderErrorComponent(true)];
2612
2650
  }
2613
- }), !_this17.showAIScreen && _this17.parsedSuggestions.map(function (item, itemIndex) {
2651
+ }), !_this19.showAIScreen && _this19.parsedSuggestions.map(function (item, itemIndex) {
2614
2652
  var index = indexOffset + itemIndex;
2615
2653
  if (Array.isArray(item)) {
2616
2654
  var sectionHtml = xss(item[0].sectionLabel);
@@ -2619,7 +2657,7 @@ var SearchBox = vue.defineComponent({
2619
2657
  "key": "section-" + itemIndex,
2620
2658
  "class": "section-container"
2621
2659
  }, [sectionHtml ? vue.createVNode("div", {
2622
- "class": "section-header " + getClassName$1(_this17.$props.innerClass, 'section-label'),
2660
+ "class": "section-header " + getClassName$1(_this19.$props.innerClass, 'section-label'),
2623
2661
  "key": "" + item[0].sectionId,
2624
2662
  "innerHTML": sectionHtml
2625
2663
  }, null) : null, vue.createVNode("ul", {
@@ -2639,7 +2677,7 @@ var SearchBox = vue.defineComponent({
2639
2677
  justifyContent: 'flex-start',
2640
2678
  alignItems: 'center'
2641
2679
  },
2642
- "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this17.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this17.$props.innerClass, 'suggestion-item'))
2680
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this19.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this19.$props.innerClass, 'suggestion-item'))
2643
2681
  }), [renderItem(sectionItem)]);
2644
2682
  }
2645
2683
  if (sectionItem._suggestion_type === '_internal_a_i_trigger') {
@@ -2653,9 +2691,9 @@ var SearchBox = vue.defineComponent({
2653
2691
  justifyContent: 'flex-start',
2654
2692
  alignItems: 'center'
2655
2693
  },
2656
- "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this17.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this17.$props.innerClass, 'suggestion-item'))
2694
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this19.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this19.$props.innerClass, 'suggestion-item'))
2657
2695
  }), [vue.createVNode(SuggestionItem, {
2658
- "currentValue": _this17.currentValue,
2696
+ "currentValue": _this19.currentValue,
2659
2697
  "suggestion": sectionItem
2660
2698
  }, null)]);
2661
2699
  }
@@ -2669,7 +2707,7 @@ var SearchBox = vue.defineComponent({
2669
2707
  justifyContent: 'flex-start',
2670
2708
  alignItems: 'center'
2671
2709
  },
2672
- "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this17.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this17.$props.innerClass, 'suggestion-item'))
2710
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this19.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this19.$props.innerClass, 'suggestion-item'))
2673
2711
  }), [vue.createVNode("div", {
2674
2712
  "style": {
2675
2713
  padding: '0 10px 0 0',
@@ -2677,74 +2715,74 @@ var SearchBox = vue.defineComponent({
2677
2715
  }
2678
2716
  }, [vue.createVNode(CustomSvg, {
2679
2717
  "key": sectionItem._suggestion_type + "-" + sectionIndex,
2680
- "className": getClassName$1(_this17.$props.innerClass, sectionItem._suggestion_type + "-search-icon") || null,
2718
+ "className": getClassName$1(_this19.$props.innerClass, sectionItem._suggestion_type + "-search-icon") || null,
2681
2719
  "icon": getIcon(sectionItem._suggestion_type, sectionItem, suggestionsHaveIcon),
2682
2720
  "type": sectionItem._suggestion_type + "-search-icon"
2683
2721
  }, null)]), vue.createVNode(SuggestionItem, {
2684
- "currentValue": _this17.currentValue,
2722
+ "currentValue": _this19.currentValue,
2685
2723
  "suggestion": sectionItem
2686
- }, null), _this17.renderActionIcon(sectionItem)]);
2724
+ }, null), _this19.renderActionIcon(sectionItem)]);
2687
2725
  })])]);
2688
2726
  }
2689
2727
  return vue.createVNode("div", null, [vue.createTextVNode("No suggestions")]);
2690
- }), !_this17.showAIScreen && _this17.parsedSuggestions.length && _this17.$props.showSuggestionsFooter ? _this17.suggestionsFooter() : null]) : _this17.renderNoSuggestions(_this17.normalizedSuggestions)]);
2728
+ }), !_this19.showAIScreen && _this19.parsedSuggestions.length && _this19.$props.showSuggestionsFooter ? _this19.suggestionsFooter() : null]) : _this19.renderNoSuggestions(_this19.normalizedSuggestions)]);
2691
2729
  };
2692
2730
  return vue.createVNode("div", {
2693
2731
  "class": Input.suggestionsContainer
2694
2732
  }, [vue.createVNode(InputGroup, {
2695
2733
  "searchBox": true,
2696
2734
  "ref": _inputGroupRef,
2697
- "isOpen": _this17.$data.isOpen
2735
+ "isOpen": _this19.$data.isOpen
2698
2736
  }, {
2699
2737
  "default": function _default() {
2700
2738
  return [vue.createVNode(Input.Actions, null, {
2701
2739
  "default": function _default() {
2702
- return [_this17.renderInputAddonBefore(), _this17.renderLeftIcons()];
2740
+ return [_this19.renderInputAddonBefore(), _this19.renderLeftIcons()];
2703
2741
  }
2704
2742
  }), vue.createVNode(DropDown.InputWrapper, null, {
2705
2743
  "default": function _default() {
2706
2744
  return [vue.createVNode(Input.TextArea, vue.mergeProps(_transformOn(getInputEvents({
2707
- onInput: _this17.onInputChange,
2745
+ onInput: _this19.onInputChange,
2708
2746
  onBlur: function onBlur(e) {
2709
- _this17.$emit('blur', e, _this17.triggerQuery);
2747
+ _this19.$emit('blur', e, _this19.triggerQuery);
2710
2748
  },
2711
- onFocus: _this17.handleFocus,
2749
+ onFocus: _this19.handleFocus,
2712
2750
  onKeyPress: function onKeyPress(e) {
2713
- _this17.$emit('keyPress', e, _this17.triggerQuery);
2714
- _this17.$emit('key-press', e, _this17.triggerQuery);
2751
+ _this19.$emit('keyPress', e, _this19.triggerQuery);
2752
+ _this19.$emit('key-press', e, _this19.triggerQuery);
2715
2753
  },
2716
2754
  onKeyDown: function onKeyDown(e) {
2717
- return _this17.handleKeyDown(e, highlightedIndex);
2755
+ return _this19.handleKeyDown(e, highlightedIndex);
2718
2756
  },
2719
2757
  onKeyUp: function onKeyUp(e) {
2720
- _this17.$emit('keyUp', e, _this17.triggerQuery);
2721
- _this17.$emit('key-up', e, _this17.triggerQuery);
2758
+ _this19.$emit('keyUp', e, _this19.triggerQuery);
2759
+ _this19.$emit('key-up', e, _this19.triggerQuery);
2722
2760
  },
2723
2761
  onClick: function onClick() {
2724
2762
  setHighlightedIndex(null);
2725
2763
  }
2726
2764
  })), {
2727
2765
  "searchBox": true,
2728
- "isOpen": _this17.$data.isOpen,
2729
- "id": _this17.$props.componentId + "-input",
2730
- "ref": _this17.$props.innerRef,
2731
- "class": getClassName$1(_this17.$props.innerClass, 'input'),
2732
- "placeholder": _this17.$props.placeholder,
2733
- "autoFocus": _this17.$props.autoFocus
2766
+ "isOpen": _this19.$data.isOpen,
2767
+ "id": _this19.$props.componentId + "-input",
2768
+ "ref": _this19.$props.innerRef,
2769
+ "class": getClassName$1(_this19.$props.innerClass, 'input'),
2770
+ "placeholder": _this19.$props.placeholder,
2771
+ "autoFocus": _this19.$props.autoFocus
2734
2772
  }, getInputProps({
2735
- value: _this17.$data.currentValue === null ? '' : _this17.$data.currentValue
2773
+ value: _this19.$data.currentValue === null ? '' : _this19.$data.currentValue
2736
2774
  }), {
2737
- "themePreset": _this17.themePreset,
2775
+ "themePreset": _this19.themePreset,
2738
2776
  "autocomplete": "off"
2739
2777
  }), null), !expandSuggestionsContainer && renderSuggestionsDropdown()];
2740
2778
  }
2741
2779
  }), vue.createVNode(Input.Actions, null, {
2742
2780
  "default": function _default() {
2743
- return [_this17.renderRightIcons(), _this17.renderInputAddonAfter(), _this17.renderAskButtonElement(), _this17.renderEnterButtonElement()];
2781
+ return [_this19.renderRightIcons(), _this19.renderInputAddonAfter(), _this19.renderAskButtonElement(), _this19.renderEnterButtonElement()];
2744
2782
  }
2745
2783
  })];
2746
2784
  }
2747
- }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this17.renderTags()]);
2785
+ }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this19.renderTags()]);
2748
2786
  }
2749
2787
  }) : vue.createVNode("div", {
2750
2788
  "class": Input.suggestionsContainer
@@ -2755,43 +2793,43 @@ var SearchBox = vue.defineComponent({
2755
2793
  "default": function _default() {
2756
2794
  return [vue.createVNode(Input.Actions, null, {
2757
2795
  "default": function _default() {
2758
- return [_this17.renderInputAddonBefore(), _this17.renderLeftIcons()];
2796
+ return [_this19.renderInputAddonBefore(), _this19.renderLeftIcons()];
2759
2797
  }
2760
2798
  }), vue.createVNode(DropDown.InputWrapper, null, {
2761
2799
  "default": function _default() {
2762
2800
  return [vue.createVNode(Input.TextArea, vue.mergeProps(_transformOn({
2763
2801
  blur: function blur(e) {
2764
- _this17.$emit('blur', e, _this17.triggerQuery);
2802
+ _this19.$emit('blur', e, _this19.triggerQuery);
2765
2803
  },
2766
2804
  keypress: function keypress(e) {
2767
- _this17.$emit('keyPress', e, _this17.triggerQuery);
2768
- _this17.$emit('key-press', e, _this17.triggerQuery);
2805
+ _this19.$emit('keyPress', e, _this19.triggerQuery);
2806
+ _this19.$emit('key-press', e, _this19.triggerQuery);
2769
2807
  },
2770
- input: _this17.onInputChange,
2808
+ input: _this19.onInputChange,
2771
2809
  focus: function focus(e) {
2772
- _this17.$emit('focus', e, _this17.triggerQuery);
2810
+ _this19.$emit('focus', e, _this19.triggerQuery);
2773
2811
  },
2774
- keydown: _this17.handleKeyDown,
2812
+ keydown: _this19.handleKeyDown,
2775
2813
  keyup: function keyup(e) {
2776
- _this17.$emit('keyUp', e, _this17.triggerQuery);
2777
- _this17.$emit('key-up', e, _this17.triggerQuery);
2814
+ _this19.$emit('keyUp', e, _this19.triggerQuery);
2815
+ _this19.$emit('key-up', e, _this19.triggerQuery);
2778
2816
  }
2779
2817
  }), {
2780
2818
  "searchBox": true,
2781
- "class": getClassName$1(_this17.$props.innerClass, 'input') || '',
2782
- "placeholder": _this17.$props.placeholder,
2783
- "autofocus": _this17.$props.autoFocus,
2784
- "value": _this17.$data.currentValue ? _this17.$data.currentValue : '',
2785
- "iconPosition": _this17.$props.iconPosition,
2786
- "showIcon": _this17.$props.showIcon,
2787
- "showClear": _this17.$props.showClear,
2788
- "ref": _this17.$props.innerRef,
2789
- "themePreset": _this17.themePreset
2819
+ "class": getClassName$1(_this19.$props.innerClass, 'input') || '',
2820
+ "placeholder": _this19.$props.placeholder,
2821
+ "autofocus": _this19.$props.autoFocus,
2822
+ "value": _this19.$data.currentValue ? _this19.$data.currentValue : '',
2823
+ "iconPosition": _this19.$props.iconPosition,
2824
+ "showIcon": _this19.$props.showIcon,
2825
+ "showClear": _this19.$props.showClear,
2826
+ "ref": _this19.$props.innerRef,
2827
+ "themePreset": _this19.themePreset
2790
2828
  }), null)];
2791
2829
  }
2792
2830
  }), vue.createVNode(Input.Actions, null, {
2793
2831
  "default": function _default() {
2794
- return [_this17.renderRightIcons(), _this17.renderInputAddonAfter(), _this17.renderEnterButtonElement()];
2832
+ return [_this19.renderRightIcons(), _this19.renderInputAddonAfter(), _this19.renderEnterButtonElement()];
2795
2833
  }
2796
2834
  })];
2797
2835
  }
@@ -3006,12 +3044,14 @@ var AIAnswer = vue.defineComponent({
3006
3044
  message: response.error
3007
3045
  };
3008
3046
  }
3009
-
3010
3047
  // pushing message history so far
3011
3048
  if (messagesHistory && Array.isArray(messagesHistory)) {
3012
3049
  finalMessages.push.apply(finalMessages, messagesHistory.filter(function (msg) {
3013
3050
  return msg.role !== constants.AI_ROLES.SYSTEM;
3014
3051
  }));
3052
+ if (finalMessages[0].role === constants.AI_ROLES.USER) {
3053
+ finalMessages.shift();
3054
+ }
3015
3055
  } else if (response && response.answer && response.answer.text) {
3016
3056
  finalMessages.push({
3017
3057
  role: constants.AI_ROLES.ASSISTANT,