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

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 +493 -863
  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-1532353d.js → DropDown-26666911.js} +1 -1
  6. package/dist/cjs/DynamicRangeSlider.js +3 -2
  7. package/dist/cjs/{Input-4279b088.js → Input-3ecdb905.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 +4 -3
  11. package/dist/cjs/RangeSlider.js +3 -2
  12. package/dist/cjs/SingleDropdownList.js +2 -2
  13. package/dist/cjs/SingleList.js +1 -1
  14. package/dist/cjs/index.js +6 -5
  15. package/dist/cjs/{install-05fcf590.js → install-26ae88c8.js} +167 -291
  16. package/dist/cjs/install.js +6 -5
  17. package/dist/cjs/version.js +1 -1
  18. package/dist/components/search/SearchBox.d.ts +0 -4
  19. package/dist/es/{DropDown-6d1dddde.js → DropDown-48045fde.js} +1 -1
  20. package/dist/es/DynamicRangeSlider.js +3 -2
  21. package/dist/es/{Input-1f6207bc.js → Input-83dee8c5.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 +4 -3
  25. package/dist/es/RangeSlider.js +3 -2
  26. package/dist/es/SingleDropdownList.js +2 -2
  27. package/dist/es/SingleList.js +1 -1
  28. package/dist/es/index.js +7 -6
  29. package/dist/es/{install-2b5814e0.js → install-924d0354.js} +169 -293
  30. package/dist/es/install.js +6 -5
  31. package/dist/es/version.js +1 -1
  32. package/dist/types.ts +0 -12
  33. package/package.json +92 -91
@@ -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-1532353d.js');
31
- var Input = require('./Input-4279b088.js');
30
+ var DropDown = require('./DropDown-26666911.js');
31
+ var Input = require('./Input-3ecdb905.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 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"])));
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"])));
69
69
  InputAddon.defaultProps = {
70
70
  className: 'input-addon'
71
71
  };
@@ -101,30 +101,7 @@ var SuggestionItem = {
101
101
  name: 'SuggestionItem',
102
102
  props: {
103
103
  currentValue: vueTypes.types.string,
104
- suggestion: vueTypes.types.any,
105
- innerHTML: vueTypes.types.string.isRequired
106
- },
107
- data: function data() {
108
- return {
109
- isOverflowing: false
110
- };
111
- },
112
- methods: {
113
- updateOverflowing: function updateOverflowing() {
114
- if (this.$refs.container && this.$refs.content) {
115
- var _this$$refs = this.$refs,
116
- container = _this$$refs.container,
117
- content = _this$$refs.content;
118
- var containerWidth = container.offsetWidth;
119
- var contentWidth = content.scrollWidth;
120
- this.isOverflowing = contentWidth > containerWidth;
121
- } else {
122
- this.isOverflowing = false;
123
- }
124
- }
125
- },
126
- mounted: function mounted() {
127
- this.updateOverflowing();
104
+ suggestion: vueTypes.types.any
128
105
  },
129
106
  render: function render() {
130
107
  var _this = this;
@@ -140,11 +117,7 @@ var SuggestionItem = {
140
117
  if (label) {
141
118
  // label has highest precedence
142
119
  return typeof label === 'string' ? vue.createVNode("div", {
143
- "ref": "container",
144
- "class": "trim",
145
- "title": this.isOverflowing ? label : ''
146
- }, [vue.createVNode("div", {
147
- "ref": "content"
120
+ "class": "trim"
148
121
  }, [(_category ? false : isPredictiveSuggestion
149
122
  // eslint-disable-next-line
150
123
  || !!_suggestion_type) ? vue.createVNode(PredictiveSuggestion, {
@@ -154,7 +127,7 @@ var SuggestionItem = {
154
127
  "textToHighlight": label,
155
128
  "autoEscape": true,
156
129
  "highlightStyle": highlightStyle
157
- }, null)])]) : label;
130
+ }, null)]) : label;
158
131
  }
159
132
  if (title || image || description) {
160
133
  return vue.createVNode(Flex.Flex, {
@@ -836,7 +809,7 @@ var HorizontalSkeletonLoader = vue.defineComponent({
836
809
 
837
810
  var _templateObject$7, _templateObject2$2, _templateObject3$1, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
838
811
  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 ? polished.lighten(0.1, props.theme.colors.backgroundColor) : '#fff';
812
+ return props.theme && props.theme.colors ? props.theme.colors.backgroundColor : '#fff';
840
813
  });
841
814
  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
815
  return props.showInput ? 'bottom: 48px;' : '';
@@ -868,7 +841,7 @@ var resetCSS = function resetCSS(props) {
868
841
  // eslint-disable-next-line no-nested-ternary
869
842
  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
843
  // 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\n\t" + (props.themePreset === 'dark' && "a{\n\t\tcolor: cornflowerblue\n\t\t}") + ";\n";
844
+ 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";
872
845
  };
873
846
  var messageBGColor = function messageBGColor(props) {
874
847
  var finalBGColor;
@@ -897,10 +870,16 @@ var Message = vueEmotion.styled('div')(_templateObject7 || (_templateObject7 = _
897
870
  return resetCSS(props);
898
871
  });
899
872
  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", "\n\tpadding-left: 35px;\n"])), function (props) {
873
+ 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) {
901
874
  return props.themePreset === 'dark' ? props.theme.colors.borderColor : '#fff';
902
875
  }, function (props) {
903
876
  return props.themePreset === 'dark' ? props.theme.colors.titleColor : props.theme.colors.textColor;
877
+ }, function (props) {
878
+ return props.theme.colors.textColor;
879
+ }, function (props) {
880
+ return props.theme.colors.textColor;
881
+ }, function (props) {
882
+ return props.theme.colors.textColor;
904
883
  }, function (_ref) {
905
884
  var enterButton = _ref.enterButton;
906
885
  return enterButton && "\n\t\t border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\t";
@@ -1105,42 +1084,6 @@ var AIFeedback = vue.defineComponent({
1105
1084
  }
1106
1085
  });
1107
1086
 
1108
- // eslint-disable-next-line import/prefer-default-export
1109
- var innerText = function innerText(jsx) {
1110
- // Empty
1111
- if (jsx === null || typeof jsx === 'boolean' || typeof jsx === 'undefined') {
1112
- return '';
1113
- }
1114
-
1115
- // Numeric children.
1116
- if (typeof jsx === 'number') {
1117
- return jsx.toString();
1118
- }
1119
-
1120
- // String literals.
1121
- if (typeof jsx === 'string') {
1122
- return jsx;
1123
- }
1124
-
1125
- // Array of JSX.
1126
- if (Array.isArray(jsx)) {
1127
- // eslint-disable-next-line no-use-before-define
1128
- return jsx.reduce(reduceJsxToString, '');
1129
- }
1130
-
1131
- // Children prop.
1132
- if (Object.prototype.hasOwnProperty.call(jsx, 'children')) {
1133
- return innerText(jsx.children);
1134
- }
1135
-
1136
- // Default
1137
- return '';
1138
- };
1139
- innerText["default"] = innerText;
1140
- function reduceJsxToString(previous, current) {
1141
- return previous + innerText(current);
1142
- }
1143
-
1144
1087
  var _excluded = ["_source"];
1145
1088
  function _isSlot(s) {
1146
1089
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
@@ -1181,8 +1124,7 @@ var SearchBox = vue.defineComponent({
1181
1124
  showFeedbackComponent: false,
1182
1125
  feedbackState: null,
1183
1126
  faqAnswer: '',
1184
- faqQuestion: '',
1185
- initialHits: null
1127
+ faqQuestion: ''
1186
1128
  };
1187
1129
  this.internalComponent = props.componentId + "__internal";
1188
1130
  return this.__state;
@@ -1234,12 +1176,11 @@ var SearchBox = vue.defineComponent({
1234
1176
  return this.faqAnswer || this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text;
1235
1177
  },
1236
1178
  parsedSuggestions: function parsedSuggestions() {
1237
- var _this = this;
1238
1179
  var suggestionsArray = [];
1239
1180
  if (Array.isArray(this.suggestions) && this.suggestions.length) {
1240
1181
  suggestionsArray = [].concat(withClickIds(this.suggestions));
1241
1182
  }
1242
- if (this.renderTriggerMessage() && this.currentValue) {
1183
+ if (this.renderTriggerMessage() && this.currentValue && !this.isLoading) {
1243
1184
  suggestionsArray.unshift({
1244
1185
  label: this.renderTriggerMessage(),
1245
1186
  value: 'AI_TRIGGER_MESSAGE',
@@ -1253,20 +1194,6 @@ var SearchBox = vue.defineComponent({
1253
1194
  return _rollupPluginBabelHelpers._extends({}, s, {
1254
1195
  sectionId: s._suggestion_type
1255
1196
  });
1256
- }).map(function (suggestion) {
1257
- if (suggestion._suggestion_type === 'document') {
1258
- // Document suggestions don't have a meaningful label and value
1259
- var newSuggestion = _rollupPluginBabelHelpers._extends({}, suggestion);
1260
- newSuggestion.label = 'For recent document suggestion, please implement a renderItem method to display label.';
1261
- var renderItem = _this.$slots.renderItem || _this.$props.renderItem;
1262
- if (typeof renderItem === 'function') {
1263
- var jsxEl = renderItem(newSuggestion);
1264
- var innerValue = innerText(jsxEl);
1265
- newSuggestion.value = xss(innerValue);
1266
- }
1267
- return newSuggestion;
1268
- }
1269
- return suggestion;
1270
1197
  });
1271
1198
  var sectionsAccumulated = [];
1272
1199
  var sectionisedSuggestions = suggestionsArray.reduce(function (acc, d, currentIndex) {
@@ -1315,12 +1242,6 @@ var SearchBox = vue.defineComponent({
1315
1242
  enablePopularSuggestions: VueTypes.bool.def(false),
1316
1243
  enableRecentSuggestions: VueTypes.bool.def(false),
1317
1244
  enableFAQSuggestions: VueTypes.bool.def(false),
1318
- enableDocumentSuggestions: VueTypes.bool.def(false),
1319
- documentSuggestionsConfig: VueTypes.shape({
1320
- size: VueTypes.number,
1321
- from: VueTypes.number,
1322
- maxChars: VueTypes.number
1323
- }),
1324
1245
  FAQSuggestionsConfig: VueTypes.shape({
1325
1246
  sectionLabel: VueTypes.string,
1326
1247
  size: VueTypes.number
@@ -1389,47 +1310,9 @@ var SearchBox = vue.defineComponent({
1389
1310
  AIUIConfig: vueTypes.types.AIUIConfig
1390
1311
  },
1391
1312
  mounted: function mounted() {
1392
- var _this2 = this;
1393
1313
  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
- }
1417
1314
  },
1418
1315
  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
- },
1433
1316
  dataField: function dataField(newVal, oldVal) {
1434
1317
  if (!isEqual(newVal, oldVal)) {
1435
1318
  this.triggerCustomQuery(this.$data.currentValue);
@@ -1504,9 +1387,6 @@ var SearchBox = vue.defineComponent({
1504
1387
  loading: this.isLoading,
1505
1388
  error: this.isError
1506
1389
  });
1507
- if (newVal && newVal.hits && newVal.hits.hits) {
1508
- this.initialHits = newVal.hits.hits;
1509
- }
1510
1390
  },
1511
1391
  aggregationData: function aggregationData(newVal) {
1512
1392
  this.$emit('on-data', {
@@ -1541,10 +1421,9 @@ var SearchBox = vue.defineComponent({
1541
1421
  }
1542
1422
  },
1543
1423
  isAITyping: function isAITyping(newVal, oldVal) {
1544
- var _this3 = this;
1424
+ var _this = this;
1545
1425
  var scrollAIContainer = function scrollAIContainer() {
1546
- if (_this3.isUserScrolling) return;
1547
- var dropdownEle = _this3.$refs[_dropdownULRef];
1426
+ var dropdownEle = _this.$refs[_dropdownULRef];
1548
1427
  if (dropdownEle) {
1549
1428
  dropdownEle.scrollTo({
1550
1429
  top: dropdownEle.scrollHeight,
@@ -1553,7 +1432,6 @@ var SearchBox = vue.defineComponent({
1553
1432
  }
1554
1433
  };
1555
1434
  if (!newVal && oldVal) {
1556
- clearInterval(this.scrollTimerRef);
1557
1435
  this.showAIScreenFooter = true;
1558
1436
  if (this.$props.AIUIConfig && typeof this.$props.AIUIConfig.showFeedback === 'boolean' ? this.$props.AIUIConfig.showFeedback : true) {
1559
1437
  this.showFeedbackComponent = true;
@@ -1562,7 +1440,7 @@ var SearchBox = vue.defineComponent({
1562
1440
  scrollAIContainer();
1563
1441
  }, 500);
1564
1442
  } else if (newVal) {
1565
- this.scrollTimerRef = setInterval(function () {
1443
+ this.scrollTimerRef = setTimeout(function () {
1566
1444
  scrollAIContainer();
1567
1445
  }, 2000);
1568
1446
  }
@@ -1579,7 +1457,7 @@ var SearchBox = vue.defineComponent({
1579
1457
  }
1580
1458
  },
1581
1459
  currentValue: function currentValue() {
1582
- this.$nextTick(this.handleTextAreaHeightChange);
1460
+ this.handleTextAreaHeightChange();
1583
1461
  }
1584
1462
  },
1585
1463
  methods: {
@@ -1654,7 +1532,7 @@ var SearchBox = vue.defineComponent({
1654
1532
  }
1655
1533
  },
1656
1534
  setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue, shouldExecuteQuery) {
1657
- var _this4 = this;
1535
+ var _this2 = this;
1658
1536
  if (isDefaultValue === void 0) {
1659
1537
  isDefaultValue = false;
1660
1538
  }
@@ -1671,65 +1549,65 @@ var SearchBox = vue.defineComponent({
1671
1549
  shouldExecuteQuery = true;
1672
1550
  }
1673
1551
  var performUpdate = function performUpdate() {
1674
- if (_this4.$options.isTagsMode && isEqual(value, _this4.selectedTags)) {
1552
+ if (_this2.$options.isTagsMode && isEqual(value, _this2.selectedTags)) {
1675
1553
  return;
1676
1554
  }
1677
- if (_this4.$options.isTagsMode && cause === reactivecore.causes.SUGGESTION_SELECT) {
1678
- if (Array.isArray(_this4.selectedTags) && _this4.selectedTags.length) {
1555
+ if (_this2.$options.isTagsMode && cause === reactivecore.causes.SUGGESTION_SELECT) {
1556
+ if (Array.isArray(_this2.selectedTags) && _this2.selectedTags.length) {
1679
1557
  // check if value already present in selectedTags
1680
- if (typeof value === 'string' && _this4.selectedTags.includes(value)) {
1681
- _this4.isOpen = false;
1558
+ if (typeof value === 'string' && _this2.selectedTags.includes(value)) {
1559
+ _this2.isOpen = false;
1682
1560
  return;
1683
1561
  }
1684
- _this4.selectedTags = [].concat(_this4.selectedTags);
1562
+ _this2.selectedTags = [].concat(_this2.selectedTags);
1685
1563
  if (typeof value === 'string' && !!value) {
1686
- _this4.selectedTags.push(value);
1687
- } else if (Array.isArray(value) && !isEqual(_this4.selectedTags, value)) {
1688
- _this4.selectedTags = value;
1564
+ _this2.selectedTags.push(value);
1565
+ } else if (Array.isArray(value) && !isEqual(_this2.selectedTags, value)) {
1566
+ _this2.selectedTags = value;
1689
1567
  }
1690
1568
  } else if (value) {
1691
- _this4.selectedTags = typeof value !== 'string' ? value : [].concat(value);
1569
+ _this2.selectedTags = typeof value !== 'string' ? value : [].concat(value);
1692
1570
  }
1693
- _this4.currentValue = '';
1571
+ _this2.currentValue = '';
1694
1572
  } else {
1695
- _this4.currentValue = index.decodeHtml(value);
1573
+ _this2.currentValue = index.decodeHtml(value);
1696
1574
  }
1697
1575
  var queryHandlerValue = value;
1698
- if (_this4.$options.isTagsMode && cause === reactivecore.causes.SUGGESTION_SELECT) {
1699
- queryHandlerValue = Array.isArray(_this4.selectedTags) && _this4.selectedTags.length ? _this4.selectedTags : undefined;
1576
+ if (_this2.$options.isTagsMode && cause === reactivecore.causes.SUGGESTION_SELECT) {
1577
+ queryHandlerValue = Array.isArray(_this2.selectedTags) && _this2.selectedTags.length ? _this2.selectedTags : undefined;
1700
1578
  }
1701
- if ((_this4.faqAnswer || _this4.faqQuestion) && value === '') {
1579
+ if ((_this2.faqAnswer || _this2.faqQuestion) && value === '') {
1702
1580
  // Empty the previous state
1703
- _this4.faqAnswer = '';
1704
- _this4.faqQuestion = '';
1705
- _this4.showAIScreen = false;
1581
+ _this2.faqAnswer = '';
1582
+ _this2.faqQuestion = '';
1583
+ _this2.showAIScreen = false;
1706
1584
  }
1707
1585
  if (isDefaultValue) {
1708
- if (_this4.$props.autosuggest) {
1586
+ if (_this2.$props.autosuggest) {
1709
1587
  if (toggleIsOpen) {
1710
- _this4.isOpen = false;
1588
+ _this2.isOpen = false;
1711
1589
  }
1712
- if (typeof _this4.currentValue === 'string') _this4.triggerDefaultQuery(_this4.currentValue, props.enableAI && _this4.currentTriggerMode === constants.AI_TRIGGER_MODES.QUESTION && _this4.currentValue.endsWith('?') ? {
1590
+ if (typeof _this2.currentValue === 'string') _this2.triggerDefaultQuery(_this2.currentValue, props.enableAI && _this2.currentTriggerMode === constants.AI_TRIGGER_MODES.QUESTION && _this2.currentValue.endsWith('?') ? {
1713
1591
  enableAI: true
1714
1592
  } : {}, shouldExecuteQuery);
1715
1593
  } // in case of strict selection only SUGGESTION_SELECT should be able
1716
1594
  // to set the query otherwise the value should reset
1717
1595
  if (props.strictSelection) {
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);
1596
+ if (cause === reactivecore.causes.SUGGESTION_SELECT || (_this2.$options.isTagsMode ? _this2.selectedTags.length === 0 : value === '')) {
1597
+ _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1720
1598
  } else {
1721
- _this4.setValue('', true);
1599
+ _this2.setValue('', true);
1722
1600
  }
1723
1601
  } else if (props.value === undefined || cause === reactivecore.causes.SUGGESTION_SELECT || cause === reactivecore.causes.CLEAR_VALUE) {
1724
- _this4.showAIScreen = false;
1725
- _this4.triggerCustomQuery(queryHandlerValue, _this4.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1602
+ _this2.showAIScreen = false;
1603
+ _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1726
1604
  }
1727
1605
  } else {
1728
1606
  // debounce for handling text while typing
1729
- _this4.handleTextChange(value, cause);
1607
+ _this2.handleTextChange(value, cause);
1730
1608
  }
1731
- _this4.$emit('valueChange', value);
1732
- _this4.$emit('value-change', value);
1609
+ _this2.$emit('valueChange', value);
1610
+ _this2.$emit('value-change', value);
1733
1611
  };
1734
1612
  checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
1735
1613
  },
@@ -1878,7 +1756,7 @@ var SearchBox = vue.defineComponent({
1878
1756
  this.$emit('key-down', event, this.triggerQuery);
1879
1757
  },
1880
1758
  onInputChange: function onInputChange(e) {
1881
- var _this5 = this;
1759
+ var _this3 = this;
1882
1760
  var inputValue = e.target.value;
1883
1761
  if (!this.$data.isOpen && this.$props.autosuggest) {
1884
1762
  this.isOpen = true;
@@ -1892,7 +1770,7 @@ var SearchBox = vue.defineComponent({
1892
1770
  } else {
1893
1771
  this.$emit('change', inputValue, function (_ref3) {
1894
1772
  var isOpen = _ref3.isOpen;
1895
- return _this5.triggerQuery({
1773
+ return _this3.triggerQuery({
1896
1774
  defaultQuery: true,
1897
1775
  customQuery: true,
1898
1776
  value: inputValue,
@@ -1936,7 +1814,7 @@ var SearchBox = vue.defineComponent({
1936
1814
  }
1937
1815
  },
1938
1816
  onSuggestionSelected: function onSuggestionSelected(suggestion) {
1939
- var _this6 = this;
1817
+ var _this4 = this;
1940
1818
  var value = this.$props.value;
1941
1819
  // The state of the suggestion is open by the time it reaches here. i.e. isOpen = true
1942
1820
  // handle when FAQ suggestion is clicked
@@ -1985,10 +1863,10 @@ var SearchBox = vue.defineComponent({
1985
1863
  this.setValue(emitValue, true, this.$props, reactivecore.causes.SUGGESTION_SELECT, false, suggestion._category);
1986
1864
  this.$emit('change', emitValue, function (_ref4) {
1987
1865
  var isOpen = _ref4.isOpen;
1988
- return _this6.triggerQuery(_rollupPluginBabelHelpers._extends({
1866
+ return _this4.triggerQuery(_rollupPluginBabelHelpers._extends({
1989
1867
  isOpen: isOpen,
1990
1868
  value: emitValue
1991
- }, !_this6.$options.isTagsMode && {
1869
+ }, !_this4.$options.isTagsMode && {
1992
1870
  categoryValue: suggestion._category
1993
1871
  }));
1994
1872
  });
@@ -2028,7 +1906,7 @@ var SearchBox = vue.defineComponent({
2028
1906
  return null;
2029
1907
  },
2030
1908
  renderErrorComponent: function renderErrorComponent(isAIError) {
2031
- var _this7 = this;
1909
+ var _this5 = this;
2032
1910
  if (isAIError === void 0) {
2033
1911
  isAIError = false;
2034
1912
  }
@@ -2055,7 +1933,7 @@ var SearchBox = vue.defineComponent({
2055
1933
  "themePreset": this.themePreset
2056
1934
  }, {
2057
1935
  "default": function _default() {
2058
- return [index.isFunction(renderError) ? renderError(_this7.error) : renderError];
1936
+ return [index.isFunction(renderError) ? renderError(_this5.error) : renderError];
2059
1937
  }
2060
1938
  });
2061
1939
  }
@@ -2135,7 +2013,7 @@ var SearchBox = vue.defineComponent({
2135
2013
  });
2136
2014
  },
2137
2015
  renderEnterButtonElement: function renderEnterButtonElement() {
2138
- var _this8 = this;
2016
+ var _this6 = this;
2139
2017
  var _this$$props2 = this.$props,
2140
2018
  enterButton = _this$$props2.enterButton,
2141
2019
  innerClass = _this$$props2.innerClass;
@@ -2143,12 +2021,12 @@ var SearchBox = vue.defineComponent({
2143
2021
  if (enterButton) {
2144
2022
  var getEnterButtonMarkup = function getEnterButtonMarkup() {
2145
2023
  if (renderEnterButton) {
2146
- return renderEnterButton(_this8.enterButtonOnClick);
2024
+ return renderEnterButton(_this6.enterButtonOnClick);
2147
2025
  }
2148
2026
  return vue.createVNode(Button.Button, {
2149
2027
  "class": "enter-btn " + getClassName$1(innerClass, 'enter-button'),
2150
2028
  "primary": true,
2151
- "onClick": _this8.enterButtonOnClick
2029
+ "onClick": _this6.enterButtonOnClick
2152
2030
  }, {
2153
2031
  "default": function _default() {
2154
2032
  return [vue.createTextVNode("Search")];
@@ -2174,7 +2052,7 @@ var SearchBox = vue.defineComponent({
2174
2052
  return '/';
2175
2053
  },
2176
2054
  renderLeftIcons: function renderLeftIcons() {
2177
- var _this9 = this;
2055
+ var _this7 = this;
2178
2056
  var _slot3;
2179
2057
  var _this$$props3 = this.$props,
2180
2058
  iconPosition = _this$$props3.iconPosition,
@@ -2184,8 +2062,8 @@ var SearchBox = vue.defineComponent({
2184
2062
  }, {
2185
2063
  "default": function _default() {
2186
2064
  return [iconPosition === 'left' && showIcon && vue.createVNode(DropDown.IconWrapper, {
2187
- "onClick": _this9.handleSearchIconClick
2188
- }, _isSlot(_slot3 = _this9.renderIcon()) ? _slot3 : {
2065
+ "onClick": _this7.handleSearchIconClick
2066
+ }, _isSlot(_slot3 = _this7.renderIcon()) ? _slot3 : {
2189
2067
  "default": function _default() {
2190
2068
  return [_slot3];
2191
2069
  }
@@ -2194,7 +2072,7 @@ var SearchBox = vue.defineComponent({
2194
2072
  })]);
2195
2073
  },
2196
2074
  renderRightIcons: function renderRightIcons() {
2197
- var _this10 = this;
2075
+ var _this8 = this;
2198
2076
  var _slot4, _slot5, _slot6;
2199
2077
  var _this$$props4 = this.$props,
2200
2078
  iconPosition = _this$$props4.iconPosition,
@@ -2211,29 +2089,29 @@ var SearchBox = vue.defineComponent({
2211
2089
  }, {
2212
2090
  "default": function _default() {
2213
2091
  return [currentValue && showClear && vue.createVNode(DropDown.IconWrapper, {
2214
- "onClick": _this10.clearValue,
2092
+ "onClick": _this8.clearValue,
2215
2093
  "showIcon": showIcon,
2216
2094
  "isClearIcon": true
2217
- }, _isSlot(_slot4 = _this10.renderCancelIcon()) ? _slot4 : {
2095
+ }, _isSlot(_slot4 = _this8.renderCancelIcon()) ? _slot4 : {
2218
2096
  "default": function _default() {
2219
2097
  return [_slot4];
2220
2098
  }
2221
2099
  }), showFocusShortcutsIcon && vue.createVNode(DropDown.ButtonIconWrapper, {
2222
2100
  "onClick": function onClick(e) {
2223
- return _this10.focusSearchBox(e);
2101
+ return _this8.focusSearchBox(e);
2224
2102
  }
2225
- }, _isSlot(_slot5 = _this10.renderShortcut()) ? _slot5 : {
2103
+ }, _isSlot(_slot5 = _this8.renderShortcut()) ? _slot5 : {
2226
2104
  "default": function _default() {
2227
2105
  return [_slot5];
2228
2106
  }
2229
2107
  }), showVoiceSearch && vue.createVNode(Mic, {
2230
2108
  "getInstance": getMicInstance,
2231
2109
  "render": renderMic,
2232
- "handleResult": _this10.handleVoiceResults,
2110
+ "handleResult": _this8.handleVoiceResults,
2233
2111
  "className": getClassName$1(innerClass, 'mic') || null
2234
2112
  }, null), iconPosition === 'right' && showIcon && vue.createVNode(DropDown.IconWrapper, {
2235
- "onClick": _this10.handleSearchIconClick
2236
- }, _isSlot(_slot6 = _this10.renderIcon()) ? _slot6 : {
2113
+ "onClick": _this8.handleSearchIconClick
2114
+ }, _isSlot(_slot6 = _this8.renderIcon()) ? _slot6 : {
2237
2115
  "default": function _default() {
2238
2116
  return [_slot6];
2239
2117
  }
@@ -2252,7 +2130,7 @@ var SearchBox = vue.defineComponent({
2252
2130
  (_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
2253
2131
  },
2254
2132
  listenForFocusShortcuts: function listenForFocusShortcuts() {
2255
- var _this11 = this;
2133
+ var _this9 = this;
2256
2134
  var _this$$props$focusSho = this.$props.focusShortcuts,
2257
2135
  focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
2258
2136
  if (index.isEmpty(focusShortcuts)) {
@@ -2267,7 +2145,7 @@ var SearchBox = vue.defineComponent({
2267
2145
  function (event, handler) {
2268
2146
  // Prevent the default refresh event under WINDOWS system
2269
2147
  event.preventDefault();
2270
- _this11.focusSearchBox(event);
2148
+ _this9.focusSearchBox(event);
2271
2149
  });
2272
2150
 
2273
2151
  // if one of modifier keys are used, they are handled below
@@ -2277,7 +2155,7 @@ var SearchBox = vue.defineComponent({
2277
2155
  for (var index$1 = 0; index$1 < modifierKeys.length; index$1 += 1) {
2278
2156
  var element = modifierKeys[index$1];
2279
2157
  if (hotkeys[element]) {
2280
- _this11.focusSearchBox(event);
2158
+ _this9.focusSearchBox(event);
2281
2159
  break;
2282
2160
  }
2283
2161
  }
@@ -2290,10 +2168,10 @@ var SearchBox = vue.defineComponent({
2290
2168
  this.triggerDefaultQuery(value);
2291
2169
  },
2292
2170
  renderActionIcon: function renderActionIcon(suggestion) {
2293
- var _this12 = this;
2171
+ var _this10 = this;
2294
2172
  var handleAutoFillClick = function handleAutoFillClick(e) {
2295
2173
  e.stopPropagation();
2296
- _this12.onAutofillClick(suggestion);
2174
+ _this10.onAutofillClick(suggestion);
2297
2175
  };
2298
2176
  if (suggestion._suggestion_type === helper.suggestionTypes.Featured) {
2299
2177
  if (suggestion.action === helper.featuredSuggestionsActionTypes.FUNCTION) {
@@ -2316,7 +2194,7 @@ var SearchBox = vue.defineComponent({
2316
2194
  return null;
2317
2195
  },
2318
2196
  renderTag: function renderTag(item) {
2319
- var _this13 = this;
2197
+ var _this11 = this;
2320
2198
  var innerClass = this.$props.innerClass;
2321
2199
  return vue.createVNode(TagItem, {
2322
2200
  "class": getClassName$1(innerClass, 'selected-tag') || ''
@@ -2327,7 +2205,7 @@ var SearchBox = vue.defineComponent({
2327
2205
  "aria-label": "delete-tag",
2328
2206
  "class": "close-icon",
2329
2207
  "onClick": function onClick() {
2330
- return _this13.clearTag(item);
2208
+ return _this11.clearTag(item);
2331
2209
  }
2332
2210
  }, [vue.createVNode(DropDown.CancelSvg, null, null)])];
2333
2211
  }
@@ -2350,7 +2228,7 @@ var SearchBox = vue.defineComponent({
2350
2228
  }
2351
2229
  },
2352
2230
  renderTags: function renderTags() {
2353
- var _this14 = this;
2231
+ var _this12 = this;
2354
2232
  if (!Array.isArray(this.selectedTags)) {
2355
2233
  return null;
2356
2234
  }
@@ -2364,16 +2242,16 @@ var SearchBox = vue.defineComponent({
2364
2242
  }) : vue.createVNode(TagsContainer, null, {
2365
2243
  "default": function _default() {
2366
2244
  return [tagsList.map(function (item) {
2367
- return _this14.renderTag(item);
2245
+ return _this12.renderTag(item);
2368
2246
  }), shouldRenderClearAllTag && vue.createVNode(TagItem, {
2369
- "class": getClassName$1(_this14.$props.innerClass, 'selected-tag') || ''
2247
+ "class": getClassName$1(_this12.$props.innerClass, 'selected-tag') || ''
2370
2248
  }, {
2371
2249
  "default": function _default() {
2372
2250
  return [vue.createVNode("span", null, [vue.createTextVNode("Clear All")]), vue.createVNode("span", {
2373
2251
  "role": "img",
2374
2252
  "aria-label": "delete-tag",
2375
2253
  "class": "close-icon",
2376
- "onClick": _this14.clearAllTags
2254
+ "onClick": _this12.clearAllTags
2377
2255
  }, [vue.createVNode(DropDown.CancelSvg, null, null)])];
2378
2256
  }
2379
2257
  })];
@@ -2381,13 +2259,13 @@ var SearchBox = vue.defineComponent({
2381
2259
  });
2382
2260
  },
2383
2261
  getAISourceObjects: function getAISourceObjects() {
2384
- var _this15 = this;
2262
+ var localCache = helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) && helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY)[this.componentId];
2385
2263
  var sourceObjects = [];
2386
2264
  if (!this.AIResponse) return sourceObjects;
2387
2265
  var docIds = this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [];
2388
- if (this.initialHits) {
2266
+ if (localCache && localCache.meta && localCache.meta.hits && localCache.meta.hits.hits) {
2389
2267
  docIds.forEach(function (id) {
2390
- var foundSourceObj = _this15.initialHits.find(function (hit) {
2268
+ var foundSourceObj = localCache.meta.hits.hits.find(function (hit) {
2391
2269
  return hit._id === id;
2392
2270
  }) || {};
2393
2271
  if (foundSourceObj) {
@@ -2421,31 +2299,31 @@ var SearchBox = vue.defineComponent({
2421
2299
  },
2422
2300
  renderAIScreenFooter: function renderAIScreenFooter() {
2423
2301
  var _slot8;
2424
- var _this16 = this;
2302
+ var _this13 = this;
2425
2303
  var _this$$props$AIUIConf2 = this.$props.AIUIConfig,
2426
2304
  AIUIConfig = _this$$props$AIUIConf2 === void 0 ? {} : _this$$props$AIUIConf2;
2427
2305
  var _ref6 = AIUIConfig || {},
2428
2306
  _ref6$showSourceDocum = _ref6.showSourceDocuments,
2429
- showSourceDocuments = _ref6$showSourceDocum === void 0 ? false : _ref6$showSourceDocum,
2307
+ showSourceDocuments = _ref6$showSourceDocum === void 0 ? true : _ref6$showSourceDocum,
2430
2308
  _ref6$onSourceClick = _ref6.onSourceClick,
2431
2309
  onSourceClick = _ref6$onSourceClick === void 0 ? function () {} : _ref6$onSourceClick;
2432
2310
  var renderSourceDocumentLabel = function renderSourceDocumentLabel(sourceObj) {
2433
- if (_this16.$props.AIUIConfig && _this16.$props.AIUIConfig.renderSourceDocument) {
2434
- return _this16.$props.AIUIConfig.renderSourceDocument(sourceObj);
2311
+ if (_this13.$props.AIUIConfig && _this13.$props.AIUIConfig.renderSourceDocument) {
2312
+ return _this13.$props.AIUIConfig.renderSourceDocument(sourceObj);
2435
2313
  }
2436
- if (_this16.$slots.renderSourceDocument) {
2437
- return _this16.$slots.renderSourceDocument(sourceObj);
2314
+ if (_this13.$slots.renderSourceDocument) {
2315
+ return _this13.$slots.renderSourceDocument(sourceObj);
2438
2316
  }
2439
2317
  return sourceObj._id;
2440
2318
  };
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, {
2319
+ return showSourceDocuments && this.showAIScreenFooter && this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds ? vue.createVNode(Footer, {
2442
2320
  "themePreset": this.$props.themePreset
2443
2321
  }, {
2444
2322
  "default": function _default() {
2445
- return [vue.createTextVNode("Summary generated using the following sources:"), ' ', vue.createVNode(SourceTags, null, _isSlot(_slot8 = _this16.getAISourceObjects().map(function (el) {
2323
+ return [vue.createTextVNode("Summary generated using the following sources:"), ' ', vue.createVNode(SourceTags, null, _isSlot(_slot8 = _this13.getAISourceObjects().map(function (el) {
2446
2324
  var _slot7;
2447
2325
  return vue.createVNode(Button.Button, {
2448
- "class": "--ai-source-tag " + (getClassName$1(_this16.$props.innerClass, 'ai-source-tag') || ''),
2326
+ "class": "--ai-source-tag " + (getClassName$1(_this13.$props.innerClass, 'ai-source-tag') || ''),
2449
2327
  "info": true,
2450
2328
  "onClick": function onClick() {
2451
2329
  return onSourceClick && onSourceClick(el);
@@ -2464,7 +2342,7 @@ var SearchBox = vue.defineComponent({
2464
2342
  }) : null;
2465
2343
  },
2466
2344
  renderAIScreen: function renderAIScreen() {
2467
- var _this17 = this;
2345
+ var _this14 = this;
2468
2346
  var customAIRenderer = this.$props.renderAIAnswer || this.$slots.renderAIAnswer;
2469
2347
  if (customAIRenderer) {
2470
2348
  return customAIRenderer({
@@ -2488,11 +2366,11 @@ var SearchBox = vue.defineComponent({
2488
2366
  "hideUI": this.isAIResponseLoading || this.isLoading || !this.sessionIdFromStore,
2489
2367
  "key": this.sessionIdFromStore,
2490
2368
  "onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
2491
- _this17.feedbackState = {
2369
+ _this14.feedbackState = {
2492
2370
  isRecorded: true,
2493
2371
  feedbackType: useful ? 'positive' : 'negative'
2494
2372
  };
2495
- _this17.recordAISessionUsefulness(_this17.sessionIdFromStore, {
2373
+ _this14.recordAISessionUsefulness(_this14.sessionIdFromStore, {
2496
2374
  useful: useful,
2497
2375
  reason: reason
2498
2376
  });
@@ -2527,7 +2405,7 @@ var SearchBox = vue.defineComponent({
2527
2405
  });
2528
2406
  },
2529
2407
  renderAskButtonElement: function renderAskButtonElement() {
2530
- var _this18 = this;
2408
+ var _this15 = this;
2531
2409
  var _this$$props5 = this.$props,
2532
2410
  AIUIConfig = _this$$props5.AIUIConfig,
2533
2411
  innerClass = _this$$props5.innerClass;
@@ -2537,12 +2415,12 @@ var SearchBox = vue.defineComponent({
2537
2415
  if (askButton) {
2538
2416
  var getEnterButtonMarkup = function getEnterButtonMarkup() {
2539
2417
  if (renderAskButton) {
2540
- return renderAskButton(_this18.askButtonOnClick);
2418
+ return renderAskButton(_this15.askButtonOnClick);
2541
2419
  }
2542
2420
  return vue.createVNode(Button.Button, {
2543
2421
  "class": "enter-btn " + getClassName$1(innerClass, 'ask-button'),
2544
2422
  "info": true,
2545
- "onClick": _this18.askButtonOnClick
2423
+ "onClick": _this15.askButtonOnClick
2546
2424
  }, {
2547
2425
  "default": function _default() {
2548
2426
  return [vue.createTextVNode("Ask")];
@@ -2557,28 +2435,28 @@ var SearchBox = vue.defineComponent({
2557
2435
  }
2558
2436
  },
2559
2437
  render: function render() {
2560
- var _this19 = this;
2438
+ var _this16 = this;
2561
2439
  var expandSuggestionsContainer = this.$props.expandSuggestionsContainer;
2562
2440
  var _this$$slots = this.$slots,
2563
2441
  recentSearchesIcon = _this$$slots.recentSearchesIcon,
2564
2442
  popularSearchesIcon = _this$$slots.popularSearchesIcon;
2565
- var hasSuggestions = Array.isArray(this.parsedSuggestions) && this.parsedSuggestions.length;
2443
+ var hasSuggestions = Array.isArray(this.normalizedSuggestions) && this.normalizedSuggestions.length;
2566
2444
  var renderItem = this.$slots.renderItem || this.$props.renderItem;
2567
2445
  return vue.createVNode(Container.Container, {
2568
2446
  "class": this.$props.className
2569
2447
  }, {
2570
2448
  "default": function _default() {
2571
- return [_this19.$props.title && vue.createVNode(Title.Title, {
2572
- "class": getClassName$1(_this19.$props.innerClass, 'title') || ''
2449
+ return [_this16.$props.title && vue.createVNode(Title.Title, {
2450
+ "class": getClassName$1(_this16.$props.innerClass, 'title') || ''
2573
2451
  }, {
2574
2452
  "default": function _default() {
2575
- return [_this19.$props.title];
2453
+ return [_this16.$props.title];
2576
2454
  }
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
2455
+ }), _this16.$props.autosuggest ? vue.createVNode(DropDown.Downshift, {
2456
+ "id": _this16.$props.componentId + "-downshift",
2457
+ "handleChange": _this16.onSuggestionSelected,
2458
+ "handleMouseup": _this16.handleStateChange,
2459
+ "isOpen": _this16.$data.isOpen
2582
2460
  }, {
2583
2461
  "default": function _default(_ref8) {
2584
2462
  var getInputEvents = _ref8.getInputEvents,
@@ -2634,21 +2512,21 @@ var SearchBox = vue.defineComponent({
2634
2512
  }
2635
2513
  };
2636
2514
  var indexOffset = 0;
2637
- return vue.createVNode("div", null, [_this19.hasCustomRenderer && _this19.getComponent({
2515
+ return vue.createVNode("div", null, [_this16.hasCustomRenderer && _this16.getComponent({
2638
2516
  isOpen: isOpen,
2639
2517
  getItemProps: getItemProps,
2640
2518
  getItemEvents: getItemEvents,
2641
2519
  highlightedIndex: highlightedIndex
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",
2520
+ }), _this16.renderErrorComponent(), !_this16.hasCustomRenderer && isOpen && hasSuggestions ? vue.createVNode("ul", {
2521
+ "class": Input.suggestions(_this16.themePreset, _this16.theme) + " " + getClassName$1(_this16.$props.innerClass, 'list') + " " + Input.searchboxSuggestions(_this16.themePreset, _this16.theme) + "\n\t\t\t\t\t\t\t\t\t\t\t\t\t",
2644
2522
  "ref": _dropdownULRef
2645
- }, [_this19.showAIScreen && vue.createVNode(SearchBoxAISection, {
2646
- "themePreset": _this19.$props.themePreset
2523
+ }, [_this16.showAIScreen && vue.createVNode(SearchBoxAISection, {
2524
+ "themePreset": _this16.$props.themePreset
2647
2525
  }, {
2648
2526
  "default": function _default() {
2649
- return [_this19.renderAIScreen(), ' ', _this19.renderErrorComponent(true)];
2527
+ return [_this16.renderAIScreen(), ' ', _this16.renderErrorComponent(true)];
2650
2528
  }
2651
- }), !_this19.showAIScreen && _this19.parsedSuggestions.map(function (item, itemIndex) {
2529
+ }), !_this16.showAIScreen && _this16.parsedSuggestions.map(function (item, itemIndex) {
2652
2530
  var index = indexOffset + itemIndex;
2653
2531
  if (Array.isArray(item)) {
2654
2532
  var sectionHtml = xss(item[0].sectionLabel);
@@ -2657,7 +2535,7 @@ var SearchBox = vue.defineComponent({
2657
2535
  "key": "section-" + itemIndex,
2658
2536
  "class": "section-container"
2659
2537
  }, [sectionHtml ? vue.createVNode("div", {
2660
- "class": "section-header " + getClassName$1(_this19.$props.innerClass, 'section-label'),
2538
+ "class": "section-header " + getClassName$1(_this16.$props.innerClass, 'section-label'),
2661
2539
  "key": "" + item[0].sectionId,
2662
2540
  "innerHTML": sectionHtml
2663
2541
  }, null) : null, vue.createVNode("ul", {
@@ -2677,7 +2555,7 @@ var SearchBox = vue.defineComponent({
2677
2555
  justifyContent: 'flex-start',
2678
2556
  alignItems: 'center'
2679
2557
  },
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'))
2558
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this16.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this16.$props.innerClass, 'suggestion-item'))
2681
2559
  }), [renderItem(sectionItem)]);
2682
2560
  }
2683
2561
  if (sectionItem._suggestion_type === '_internal_a_i_trigger') {
@@ -2691,9 +2569,9 @@ var SearchBox = vue.defineComponent({
2691
2569
  justifyContent: 'flex-start',
2692
2570
  alignItems: 'center'
2693
2571
  },
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'))
2572
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this16.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this16.$props.innerClass, 'suggestion-item'))
2695
2573
  }), [vue.createVNode(SuggestionItem, {
2696
- "currentValue": _this19.currentValue,
2574
+ "currentValue": _this16.currentValue,
2697
2575
  "suggestion": sectionItem
2698
2576
  }, null)]);
2699
2577
  }
@@ -2707,7 +2585,7 @@ var SearchBox = vue.defineComponent({
2707
2585
  justifyContent: 'flex-start',
2708
2586
  alignItems: 'center'
2709
2587
  },
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'))
2588
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this16.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this16.$props.innerClass, 'suggestion-item'))
2711
2589
  }), [vue.createVNode("div", {
2712
2590
  "style": {
2713
2591
  padding: '0 10px 0 0',
@@ -2715,74 +2593,74 @@ var SearchBox = vue.defineComponent({
2715
2593
  }
2716
2594
  }, [vue.createVNode(CustomSvg, {
2717
2595
  "key": sectionItem._suggestion_type + "-" + sectionIndex,
2718
- "className": getClassName$1(_this19.$props.innerClass, sectionItem._suggestion_type + "-search-icon") || null,
2596
+ "className": getClassName$1(_this16.$props.innerClass, sectionItem._suggestion_type + "-search-icon") || null,
2719
2597
  "icon": getIcon(sectionItem._suggestion_type, sectionItem, suggestionsHaveIcon),
2720
2598
  "type": sectionItem._suggestion_type + "-search-icon"
2721
2599
  }, null)]), vue.createVNode(SuggestionItem, {
2722
- "currentValue": _this19.currentValue,
2600
+ "currentValue": _this16.currentValue,
2723
2601
  "suggestion": sectionItem
2724
- }, null), _this19.renderActionIcon(sectionItem)]);
2602
+ }, null), _this16.renderActionIcon(sectionItem)]);
2725
2603
  })])]);
2726
2604
  }
2727
2605
  return vue.createVNode("div", null, [vue.createTextVNode("No suggestions")]);
2728
- }), !_this19.showAIScreen && _this19.parsedSuggestions.length && _this19.$props.showSuggestionsFooter ? _this19.suggestionsFooter() : null]) : _this19.renderNoSuggestions(_this19.normalizedSuggestions)]);
2606
+ }), !_this16.showAIScreen && _this16.parsedSuggestions.length && _this16.$props.showSuggestionsFooter ? _this16.suggestionsFooter() : null]) : _this16.renderNoSuggestions(_this16.normalizedSuggestions)]);
2729
2607
  };
2730
2608
  return vue.createVNode("div", {
2731
2609
  "class": Input.suggestionsContainer
2732
2610
  }, [vue.createVNode(InputGroup, {
2733
2611
  "searchBox": true,
2734
2612
  "ref": _inputGroupRef,
2735
- "isOpen": _this19.$data.isOpen
2613
+ "isOpen": _this16.$data.isOpen
2736
2614
  }, {
2737
2615
  "default": function _default() {
2738
2616
  return [vue.createVNode(Input.Actions, null, {
2739
2617
  "default": function _default() {
2740
- return [_this19.renderInputAddonBefore(), _this19.renderLeftIcons()];
2618
+ return [_this16.renderInputAddonBefore(), _this16.renderLeftIcons()];
2741
2619
  }
2742
2620
  }), vue.createVNode(DropDown.InputWrapper, null, {
2743
2621
  "default": function _default() {
2744
2622
  return [vue.createVNode(Input.TextArea, vue.mergeProps(_transformOn(getInputEvents({
2745
- onInput: _this19.onInputChange,
2623
+ onInput: _this16.onInputChange,
2746
2624
  onBlur: function onBlur(e) {
2747
- _this19.$emit('blur', e, _this19.triggerQuery);
2625
+ _this16.$emit('blur', e, _this16.triggerQuery);
2748
2626
  },
2749
- onFocus: _this19.handleFocus,
2627
+ onFocus: _this16.handleFocus,
2750
2628
  onKeyPress: function onKeyPress(e) {
2751
- _this19.$emit('keyPress', e, _this19.triggerQuery);
2752
- _this19.$emit('key-press', e, _this19.triggerQuery);
2629
+ _this16.$emit('keyPress', e, _this16.triggerQuery);
2630
+ _this16.$emit('key-press', e, _this16.triggerQuery);
2753
2631
  },
2754
2632
  onKeyDown: function onKeyDown(e) {
2755
- return _this19.handleKeyDown(e, highlightedIndex);
2633
+ return _this16.handleKeyDown(e, highlightedIndex);
2756
2634
  },
2757
2635
  onKeyUp: function onKeyUp(e) {
2758
- _this19.$emit('keyUp', e, _this19.triggerQuery);
2759
- _this19.$emit('key-up', e, _this19.triggerQuery);
2636
+ _this16.$emit('keyUp', e, _this16.triggerQuery);
2637
+ _this16.$emit('key-up', e, _this16.triggerQuery);
2760
2638
  },
2761
2639
  onClick: function onClick() {
2762
2640
  setHighlightedIndex(null);
2763
2641
  }
2764
2642
  })), {
2765
2643
  "searchBox": true,
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
2644
+ "isOpen": _this16.$data.isOpen,
2645
+ "id": _this16.$props.componentId + "-input",
2646
+ "ref": _this16.$props.innerRef,
2647
+ "class": getClassName$1(_this16.$props.innerClass, 'input'),
2648
+ "placeholder": _this16.$props.placeholder,
2649
+ "autoFocus": _this16.$props.autoFocus
2772
2650
  }, getInputProps({
2773
- value: _this19.$data.currentValue === null ? '' : _this19.$data.currentValue
2651
+ value: _this16.$data.currentValue === null ? '' : _this16.$data.currentValue
2774
2652
  }), {
2775
- "themePreset": _this19.themePreset,
2653
+ "themePreset": _this16.themePreset,
2776
2654
  "autocomplete": "off"
2777
2655
  }), null), !expandSuggestionsContainer && renderSuggestionsDropdown()];
2778
2656
  }
2779
2657
  }), vue.createVNode(Input.Actions, null, {
2780
2658
  "default": function _default() {
2781
- return [_this19.renderRightIcons(), _this19.renderInputAddonAfter(), _this19.renderAskButtonElement(), _this19.renderEnterButtonElement()];
2659
+ return [_this16.renderRightIcons(), _this16.renderInputAddonAfter(), _this16.renderAskButtonElement(), _this16.renderEnterButtonElement()];
2782
2660
  }
2783
2661
  })];
2784
2662
  }
2785
- }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this19.renderTags()]);
2663
+ }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this16.renderTags()]);
2786
2664
  }
2787
2665
  }) : vue.createVNode("div", {
2788
2666
  "class": Input.suggestionsContainer
@@ -2793,43 +2671,43 @@ var SearchBox = vue.defineComponent({
2793
2671
  "default": function _default() {
2794
2672
  return [vue.createVNode(Input.Actions, null, {
2795
2673
  "default": function _default() {
2796
- return [_this19.renderInputAddonBefore(), _this19.renderLeftIcons()];
2674
+ return [_this16.renderInputAddonBefore(), _this16.renderLeftIcons()];
2797
2675
  }
2798
2676
  }), vue.createVNode(DropDown.InputWrapper, null, {
2799
2677
  "default": function _default() {
2800
2678
  return [vue.createVNode(Input.TextArea, vue.mergeProps(_transformOn({
2801
2679
  blur: function blur(e) {
2802
- _this19.$emit('blur', e, _this19.triggerQuery);
2680
+ _this16.$emit('blur', e, _this16.triggerQuery);
2803
2681
  },
2804
2682
  keypress: function keypress(e) {
2805
- _this19.$emit('keyPress', e, _this19.triggerQuery);
2806
- _this19.$emit('key-press', e, _this19.triggerQuery);
2683
+ _this16.$emit('keyPress', e, _this16.triggerQuery);
2684
+ _this16.$emit('key-press', e, _this16.triggerQuery);
2807
2685
  },
2808
- input: _this19.onInputChange,
2686
+ input: _this16.onInputChange,
2809
2687
  focus: function focus(e) {
2810
- _this19.$emit('focus', e, _this19.triggerQuery);
2688
+ _this16.$emit('focus', e, _this16.triggerQuery);
2811
2689
  },
2812
- keydown: _this19.handleKeyDown,
2690
+ keydown: _this16.handleKeyDown,
2813
2691
  keyup: function keyup(e) {
2814
- _this19.$emit('keyUp', e, _this19.triggerQuery);
2815
- _this19.$emit('key-up', e, _this19.triggerQuery);
2692
+ _this16.$emit('keyUp', e, _this16.triggerQuery);
2693
+ _this16.$emit('key-up', e, _this16.triggerQuery);
2816
2694
  }
2817
2695
  }), {
2818
2696
  "searchBox": true,
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
2697
+ "class": getClassName$1(_this16.$props.innerClass, 'input') || '',
2698
+ "placeholder": _this16.$props.placeholder,
2699
+ "autofocus": _this16.$props.autoFocus,
2700
+ "value": _this16.$data.currentValue ? _this16.$data.currentValue : '',
2701
+ "iconPosition": _this16.$props.iconPosition,
2702
+ "showIcon": _this16.$props.showIcon,
2703
+ "showClear": _this16.$props.showClear,
2704
+ "ref": _this16.$props.innerRef,
2705
+ "themePreset": _this16.themePreset
2828
2706
  }), null)];
2829
2707
  }
2830
2708
  }), vue.createVNode(Input.Actions, null, {
2831
2709
  "default": function _default() {
2832
- return [_this19.renderRightIcons(), _this19.renderInputAddonAfter(), _this19.renderEnterButtonElement()];
2710
+ return [_this16.renderRightIcons(), _this16.renderInputAddonAfter(), _this16.renderEnterButtonElement()];
2833
2711
  }
2834
2712
  })];
2835
2713
  }
@@ -3044,14 +2922,12 @@ var AIAnswer = vue.defineComponent({
3044
2922
  message: response.error
3045
2923
  };
3046
2924
  }
2925
+
3047
2926
  // pushing message history so far
3048
2927
  if (messagesHistory && Array.isArray(messagesHistory)) {
3049
2928
  finalMessages.push.apply(finalMessages, messagesHistory.filter(function (msg) {
3050
2929
  return msg.role !== constants.AI_ROLES.SYSTEM;
3051
2930
  }));
3052
- if (finalMessages[0].role === constants.AI_ROLES.USER) {
3053
- finalMessages.shift();
3054
- }
3055
2931
  } else if (response && response.answer && response.answer.text) {
3056
2932
  finalMessages.push({
3057
2933
  role: constants.AI_ROLES.ASSISTANT,