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

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