@appbaseio/reactivesearch-vue 3.0.6 → 3.1.0-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,8 +27,8 @@ var ReactiveBase = require('./ReactiveBase.js');
27
27
  var hotkeys = _interopDefault(require('hotkeys-js'));
28
28
  var xss = _interopDefault(require('xss'));
29
29
  var remarkable = require('remarkable');
30
- var DropDown = require('./DropDown-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,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 ? polished.lighten(0.1, props.theme.colors.backgroundColor) : '#fff';
839
+ return props.theme && props.theme.colors ? 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\n\t" + (props.themePreset === 'dark' && "a{\n\t\tcolor: cornflowerblue\n\t\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";
845
872
  };
846
873
  var messageBGColor = function messageBGColor(props) {
847
874
  var finalBGColor;
@@ -870,10 +897,16 @@ 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", "\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::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) {
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;
904
+ }, function (props) {
905
+ return props.theme.colors.textColor;
906
+ }, function (props) {
907
+ return props.theme.colors.textColor;
908
+ }, function (props) {
909
+ return props.theme.colors.textColor;
877
910
  }, function (_ref) {
878
911
  var enterButton = _ref.enterButton;
879
912
  return enterButton && "\n\t\t border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\t";
@@ -1078,6 +1111,42 @@ var AIFeedback = vue.defineComponent({
1078
1111
  }
1079
1112
  });
1080
1113
 
1114
+ // eslint-disable-next-line import/prefer-default-export
1115
+ var innerText = function innerText(jsx) {
1116
+ // Empty
1117
+ if (jsx === null || typeof jsx === 'boolean' || typeof jsx === 'undefined') {
1118
+ return '';
1119
+ }
1120
+
1121
+ // Numeric children.
1122
+ if (typeof jsx === 'number') {
1123
+ return jsx.toString();
1124
+ }
1125
+
1126
+ // String literals.
1127
+ if (typeof jsx === 'string') {
1128
+ return jsx;
1129
+ }
1130
+
1131
+ // Array of JSX.
1132
+ if (Array.isArray(jsx)) {
1133
+ // eslint-disable-next-line no-use-before-define
1134
+ return jsx.reduce(reduceJsxToString, '');
1135
+ }
1136
+
1137
+ // Children prop.
1138
+ if (Object.prototype.hasOwnProperty.call(jsx, 'children')) {
1139
+ return innerText(jsx.children);
1140
+ }
1141
+
1142
+ // Default
1143
+ return '';
1144
+ };
1145
+ innerText["default"] = innerText;
1146
+ function reduceJsxToString(previous, current) {
1147
+ return previous + innerText(current);
1148
+ }
1149
+
1081
1150
  var _excluded = ["_source"];
1082
1151
  function _isSlot(s) {
1083
1152
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
@@ -1118,8 +1187,7 @@ var SearchBox = vue.defineComponent({
1118
1187
  showFeedbackComponent: false,
1119
1188
  feedbackState: null,
1120
1189
  faqAnswer: '',
1121
- faqQuestion: '',
1122
- initialHits: null
1190
+ faqQuestion: ''
1123
1191
  };
1124
1192
  this.internalComponent = props.componentId + "__internal";
1125
1193
  return this.__state;
@@ -1171,11 +1239,12 @@ var SearchBox = vue.defineComponent({
1171
1239
  return this.faqAnswer || this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text;
1172
1240
  },
1173
1241
  parsedSuggestions: function parsedSuggestions() {
1242
+ var _this = this;
1174
1243
  var suggestionsArray = [];
1175
1244
  if (Array.isArray(this.suggestions) && this.suggestions.length) {
1176
1245
  suggestionsArray = [].concat(withClickIds(this.suggestions));
1177
1246
  }
1178
- if (this.renderTriggerMessage() && this.currentValue) {
1247
+ if (this.renderTriggerMessage() && this.currentValue && !this.isLoading) {
1179
1248
  suggestionsArray.unshift({
1180
1249
  label: this.renderTriggerMessage(),
1181
1250
  value: 'AI_TRIGGER_MESSAGE',
@@ -1189,6 +1258,20 @@ var SearchBox = vue.defineComponent({
1189
1258
  return _rollupPluginBabelHelpers._extends({}, s, {
1190
1259
  sectionId: s._suggestion_type
1191
1260
  });
1261
+ }).map(function (suggestion) {
1262
+ if (suggestion._suggestion_type === 'document') {
1263
+ // Document suggestions don't have a meaningful label and value
1264
+ var newSuggestion = _rollupPluginBabelHelpers._extends({}, suggestion);
1265
+ newSuggestion.label = 'For recent document suggestion, please implement a renderItem method to display label.';
1266
+ var renderItem = _this.$slots.renderItem || _this.$props.renderItem;
1267
+ if (typeof renderItem === 'function') {
1268
+ var jsxEl = renderItem(newSuggestion);
1269
+ var innerValue = innerText(jsxEl);
1270
+ newSuggestion.value = xss(innerValue);
1271
+ }
1272
+ return newSuggestion;
1273
+ }
1274
+ return suggestion;
1192
1275
  });
1193
1276
  var sectionsAccumulated = [];
1194
1277
  var sectionisedSuggestions = suggestionsArray.reduce(function (acc, d, currentIndex) {
@@ -1237,6 +1320,12 @@ var SearchBox = vue.defineComponent({
1237
1320
  enablePopularSuggestions: VueTypes.bool.def(false),
1238
1321
  enableRecentSuggestions: VueTypes.bool.def(false),
1239
1322
  enableFAQSuggestions: VueTypes.bool.def(false),
1323
+ enableDocumentSuggestions: VueTypes.bool.def(false),
1324
+ documentSuggestionsConfig: VueTypes.shape({
1325
+ size: VueTypes.number,
1326
+ from: VueTypes.number,
1327
+ maxChars: VueTypes.number
1328
+ }),
1240
1329
  FAQSuggestionsConfig: VueTypes.shape({
1241
1330
  sectionLabel: VueTypes.string,
1242
1331
  size: VueTypes.number
@@ -1305,47 +1394,9 @@ var SearchBox = vue.defineComponent({
1305
1394
  AIUIConfig: vueTypes.types.AIUIConfig
1306
1395
  },
1307
1396
  mounted: function mounted() {
1308
- var _this = this;
1309
1397
  this.listenForFocusShortcuts();
1310
- var dropdownEle = this.$refs[_dropdownULRef];
1311
- if (dropdownEle) {
1312
- var handleScroll = function handleScroll() {
1313
- var scrollTop = dropdownEle.scrollTop;
1314
- _this.lastScrollTop = scrollTop;
1315
- if (scrollTop < _this.lastScrollTop) {
1316
- // User is scrolling up
1317
- clearInterval(_this.scrollTimerRef);
1318
- _this.isUserScrolling = true;
1319
- }
1320
- // Update lastScrollTop with the current scroll position
1321
- _this.lastScrollTop = scrollTop;
1322
- };
1323
- dropdownEle.addEventListener('scroll', handleScroll);
1324
- }
1325
- },
1326
- updated: function updated() {
1327
- if (this.$props.mode === constants.SEARCH_COMPONENTS_MODES.SELECT && this.$options.isTagsMode === true) {
1328
- this.$options.isTagsMode = false;
1329
- this.selectedTags = [];
1330
- } else if (this.$props.mode === constants.SEARCH_COMPONENTS_MODES.TAG && this.$options.isTagsMode === false) {
1331
- this.$options.isTagsMode = true;
1332
- }
1333
1398
  },
1334
1399
  watch: {
1335
- AIResponse: function AIResponse(newVal) {
1336
- if (newVal) {
1337
- if (this.$props.AIUIConfig && this.$props.AIUIConfig.showSourceDocuments && newVal.response && newVal.response.answer && Array.isArray(newVal.response.answer.documentIds)) {
1338
- this.sourceDocIds = newVal.response.answer.documentIds;
1339
- var localCache = helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) && helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY)[this.$props.componentId];
1340
- if (localCache && localCache.meta && localCache.meta.hits && localCache.meta.hits.hits) {
1341
- this.initialHits = localCache.meta.hits.hits;
1342
- }
1343
- if (!this.showAIScreenFooter) {
1344
- this.showAIScreenFooter = true;
1345
- }
1346
- }
1347
- }
1348
- },
1349
1400
  dataField: function dataField(newVal, oldVal) {
1350
1401
  if (!isEqual(newVal, oldVal)) {
1351
1402
  this.triggerCustomQuery(this.$data.currentValue);
@@ -1420,9 +1471,6 @@ var SearchBox = vue.defineComponent({
1420
1471
  loading: this.isLoading,
1421
1472
  error: this.isError
1422
1473
  });
1423
- if (newVal && newVal.hits && newVal.hits.hits) {
1424
- this.initialHits = newVal.hits.hits;
1425
- }
1426
1474
  },
1427
1475
  aggregationData: function aggregationData(newVal) {
1428
1476
  this.$emit('on-data', {
@@ -1459,7 +1507,6 @@ var SearchBox = vue.defineComponent({
1459
1507
  isAITyping: function isAITyping(newVal, oldVal) {
1460
1508
  var _this2 = this;
1461
1509
  var scrollAIContainer = function scrollAIContainer() {
1462
- if (_this2.isUserScrolling) return;
1463
1510
  var dropdownEle = _this2.$refs[_dropdownULRef];
1464
1511
  if (dropdownEle) {
1465
1512
  dropdownEle.scrollTo({
@@ -1469,7 +1516,6 @@ var SearchBox = vue.defineComponent({
1469
1516
  }
1470
1517
  };
1471
1518
  if (!newVal && oldVal) {
1472
- clearInterval(this.scrollTimerRef);
1473
1519
  this.showAIScreenFooter = true;
1474
1520
  if (this.$props.AIUIConfig && typeof this.$props.AIUIConfig.showFeedback === 'boolean' ? this.$props.AIUIConfig.showFeedback : true) {
1475
1521
  this.showFeedbackComponent = true;
@@ -1478,7 +1524,7 @@ var SearchBox = vue.defineComponent({
1478
1524
  scrollAIContainer();
1479
1525
  }, 500);
1480
1526
  } else if (newVal) {
1481
- this.scrollTimerRef = setInterval(function () {
1527
+ this.scrollTimerRef = setTimeout(function () {
1482
1528
  scrollAIContainer();
1483
1529
  }, 2000);
1484
1530
  }
@@ -1495,7 +1541,7 @@ var SearchBox = vue.defineComponent({
1495
1541
  }
1496
1542
  },
1497
1543
  currentValue: function currentValue() {
1498
- this.$nextTick(this.handleTextAreaHeightChange);
1544
+ this.handleTextAreaHeightChange();
1499
1545
  }
1500
1546
  },
1501
1547
  methods: {
@@ -2297,13 +2343,13 @@ var SearchBox = vue.defineComponent({
2297
2343
  });
2298
2344
  },
2299
2345
  getAISourceObjects: function getAISourceObjects() {
2300
- var _this14 = this;
2346
+ var localCache = helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) && helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY)[this.componentId];
2301
2347
  var sourceObjects = [];
2302
2348
  if (!this.AIResponse) return sourceObjects;
2303
2349
  var docIds = this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [];
2304
- if (this.initialHits) {
2350
+ if (localCache && localCache.meta && localCache.meta.hits && localCache.meta.hits.hits) {
2305
2351
  docIds.forEach(function (id) {
2306
- var foundSourceObj = _this14.initialHits.find(function (hit) {
2352
+ var foundSourceObj = localCache.meta.hits.hits.find(function (hit) {
2307
2353
  return hit._id === id;
2308
2354
  }) || {};
2309
2355
  if (foundSourceObj) {
@@ -2337,31 +2383,31 @@ var SearchBox = vue.defineComponent({
2337
2383
  },
2338
2384
  renderAIScreenFooter: function renderAIScreenFooter() {
2339
2385
  var _slot8;
2340
- var _this15 = this;
2386
+ var _this14 = this;
2341
2387
  var _this$$props$AIUIConf2 = this.$props.AIUIConfig,
2342
2388
  AIUIConfig = _this$$props$AIUIConf2 === void 0 ? {} : _this$$props$AIUIConf2;
2343
2389
  var _ref6 = AIUIConfig || {},
2344
2390
  _ref6$showSourceDocum = _ref6.showSourceDocuments,
2345
- showSourceDocuments = _ref6$showSourceDocum === void 0 ? false : _ref6$showSourceDocum,
2391
+ showSourceDocuments = _ref6$showSourceDocum === void 0 ? true : _ref6$showSourceDocum,
2346
2392
  _ref6$onSourceClick = _ref6.onSourceClick,
2347
2393
  onSourceClick = _ref6$onSourceClick === void 0 ? function () {} : _ref6$onSourceClick;
2348
2394
  var renderSourceDocumentLabel = function renderSourceDocumentLabel(sourceObj) {
2349
- if (_this15.$props.AIUIConfig && _this15.$props.AIUIConfig.renderSourceDocument) {
2350
- return _this15.$props.AIUIConfig.renderSourceDocument(sourceObj);
2395
+ if (_this14.$props.AIUIConfig && _this14.$props.AIUIConfig.renderSourceDocument) {
2396
+ return _this14.$props.AIUIConfig.renderSourceDocument(sourceObj);
2351
2397
  }
2352
- if (_this15.$slots.renderSourceDocument) {
2353
- return _this15.$slots.renderSourceDocument(sourceObj);
2398
+ if (_this14.$slots.renderSourceDocument) {
2399
+ return _this14.$slots.renderSourceDocument(sourceObj);
2354
2400
  }
2355
2401
  return sourceObj._id;
2356
2402
  };
2357
- 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, {
2403
+ return showSourceDocuments && this.showAIScreenFooter && this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds ? vue.createVNode(Footer, {
2358
2404
  "themePreset": this.$props.themePreset
2359
2405
  }, {
2360
2406
  "default": function _default() {
2361
- return [vue.createTextVNode("Summary generated using the following sources:"), ' ', vue.createVNode(SourceTags, null, _isSlot(_slot8 = _this15.getAISourceObjects().map(function (el) {
2407
+ return [vue.createTextVNode("Summary generated using the following sources:"), ' ', vue.createVNode(SourceTags, null, _isSlot(_slot8 = _this14.getAISourceObjects().map(function (el) {
2362
2408
  var _slot7;
2363
2409
  return vue.createVNode(Button.Button, {
2364
- "class": "--ai-source-tag " + (getClassName$1(_this15.$props.innerClass, 'ai-source-tag') || ''),
2410
+ "class": "--ai-source-tag " + (getClassName$1(_this14.$props.innerClass, 'ai-source-tag') || ''),
2365
2411
  "info": true,
2366
2412
  "onClick": function onClick() {
2367
2413
  return onSourceClick && onSourceClick(el);
@@ -2380,7 +2426,7 @@ var SearchBox = vue.defineComponent({
2380
2426
  }) : null;
2381
2427
  },
2382
2428
  renderAIScreen: function renderAIScreen() {
2383
- var _this16 = this;
2429
+ var _this15 = this;
2384
2430
  var customAIRenderer = this.$props.renderAIAnswer || this.$slots.renderAIAnswer;
2385
2431
  if (customAIRenderer) {
2386
2432
  return customAIRenderer({
@@ -2404,11 +2450,11 @@ var SearchBox = vue.defineComponent({
2404
2450
  "hideUI": this.isAIResponseLoading || this.isLoading || !this.sessionIdFromStore,
2405
2451
  "key": this.sessionIdFromStore,
2406
2452
  "onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
2407
- _this16.feedbackState = {
2453
+ _this15.feedbackState = {
2408
2454
  isRecorded: true,
2409
2455
  feedbackType: useful ? 'positive' : 'negative'
2410
2456
  };
2411
- _this16.recordAISessionUsefulness(_this16.sessionIdFromStore, {
2457
+ _this15.recordAISessionUsefulness(_this15.sessionIdFromStore, {
2412
2458
  useful: useful,
2413
2459
  reason: reason
2414
2460
  });
@@ -2443,7 +2489,7 @@ var SearchBox = vue.defineComponent({
2443
2489
  });
2444
2490
  },
2445
2491
  renderAskButtonElement: function renderAskButtonElement() {
2446
- var _this17 = this;
2492
+ var _this16 = this;
2447
2493
  var _this$$props5 = this.$props,
2448
2494
  AIUIConfig = _this$$props5.AIUIConfig,
2449
2495
  innerClass = _this$$props5.innerClass;
@@ -2453,12 +2499,12 @@ var SearchBox = vue.defineComponent({
2453
2499
  if (askButton) {
2454
2500
  var getEnterButtonMarkup = function getEnterButtonMarkup() {
2455
2501
  if (renderAskButton) {
2456
- return renderAskButton(_this17.askButtonOnClick);
2502
+ return renderAskButton(_this16.askButtonOnClick);
2457
2503
  }
2458
2504
  return vue.createVNode(Button.Button, {
2459
2505
  "class": "enter-btn " + getClassName$1(innerClass, 'ask-button'),
2460
2506
  "info": true,
2461
- "onClick": _this17.askButtonOnClick
2507
+ "onClick": _this16.askButtonOnClick
2462
2508
  }, {
2463
2509
  "default": function _default() {
2464
2510
  return [vue.createTextVNode("Ask")];
@@ -2473,28 +2519,28 @@ var SearchBox = vue.defineComponent({
2473
2519
  }
2474
2520
  },
2475
2521
  render: function render() {
2476
- var _this18 = this;
2522
+ var _this17 = this;
2477
2523
  var expandSuggestionsContainer = this.$props.expandSuggestionsContainer;
2478
2524
  var _this$$slots = this.$slots,
2479
2525
  recentSearchesIcon = _this$$slots.recentSearchesIcon,
2480
2526
  popularSearchesIcon = _this$$slots.popularSearchesIcon;
2481
- var hasSuggestions = Array.isArray(this.parsedSuggestions) && this.parsedSuggestions.length;
2527
+ var hasSuggestions = Array.isArray(this.normalizedSuggestions) && this.normalizedSuggestions.length;
2482
2528
  var renderItem = this.$slots.renderItem || this.$props.renderItem;
2483
2529
  return vue.createVNode(Container.Container, {
2484
2530
  "class": this.$props.className
2485
2531
  }, {
2486
2532
  "default": function _default() {
2487
- return [_this18.$props.title && vue.createVNode(Title.Title, {
2488
- "class": getClassName$1(_this18.$props.innerClass, 'title') || ''
2533
+ return [_this17.$props.title && vue.createVNode(Title.Title, {
2534
+ "class": getClassName$1(_this17.$props.innerClass, 'title') || ''
2489
2535
  }, {
2490
2536
  "default": function _default() {
2491
- return [_this18.$props.title];
2537
+ return [_this17.$props.title];
2492
2538
  }
2493
- }), _this18.$props.autosuggest ? vue.createVNode(DropDown.Downshift, {
2494
- "id": _this18.$props.componentId + "-downshift",
2495
- "handleChange": _this18.onSuggestionSelected,
2496
- "handleMouseup": _this18.handleStateChange,
2497
- "isOpen": _this18.$data.isOpen
2539
+ }), _this17.$props.autosuggest ? vue.createVNode(DropDown.Downshift, {
2540
+ "id": _this17.$props.componentId + "-downshift",
2541
+ "handleChange": _this17.onSuggestionSelected,
2542
+ "handleMouseup": _this17.handleStateChange,
2543
+ "isOpen": _this17.$data.isOpen
2498
2544
  }, {
2499
2545
  "default": function _default(_ref8) {
2500
2546
  var getInputEvents = _ref8.getInputEvents,
@@ -2550,21 +2596,21 @@ var SearchBox = vue.defineComponent({
2550
2596
  }
2551
2597
  };
2552
2598
  var indexOffset = 0;
2553
- return vue.createVNode("div", null, [_this18.hasCustomRenderer && _this18.getComponent({
2599
+ return vue.createVNode("div", null, [_this17.hasCustomRenderer && _this17.getComponent({
2554
2600
  isOpen: isOpen,
2555
2601
  getItemProps: getItemProps,
2556
2602
  getItemEvents: getItemEvents,
2557
2603
  highlightedIndex: highlightedIndex
2558
- }), _this18.renderErrorComponent(), !_this18.hasCustomRenderer && isOpen && hasSuggestions ? vue.createVNode("ul", {
2559
- "class": Input.suggestions(_this18.themePreset, _this18.theme) + " " + getClassName$1(_this18.$props.innerClass, 'list') + " " + Input.searchboxSuggestions(_this18.themePreset, _this18.theme) + "\n\t\t\t\t\t\t\t\t\t\t\t\t\t",
2604
+ }), _this17.renderErrorComponent(), !_this17.hasCustomRenderer && isOpen && hasSuggestions ? vue.createVNode("ul", {
2605
+ "class": Input.suggestions(_this17.themePreset, _this17.theme) + " " + getClassName$1(_this17.$props.innerClass, 'list') + " " + Input.searchboxSuggestions(_this17.themePreset, _this17.theme) + "\n\t\t\t\t\t\t\t\t\t\t\t\t\t",
2560
2606
  "ref": _dropdownULRef
2561
- }, [_this18.showAIScreen && vue.createVNode(SearchBoxAISection, {
2562
- "themePreset": _this18.$props.themePreset
2607
+ }, [_this17.showAIScreen && vue.createVNode(SearchBoxAISection, {
2608
+ "themePreset": _this17.$props.themePreset
2563
2609
  }, {
2564
2610
  "default": function _default() {
2565
- return [_this18.renderAIScreen(), ' ', _this18.renderErrorComponent(true)];
2611
+ return [_this17.renderAIScreen(), ' ', _this17.renderErrorComponent(true)];
2566
2612
  }
2567
- }), !_this18.showAIScreen && _this18.parsedSuggestions.map(function (item, itemIndex) {
2613
+ }), !_this17.showAIScreen && _this17.parsedSuggestions.map(function (item, itemIndex) {
2568
2614
  var index = indexOffset + itemIndex;
2569
2615
  if (Array.isArray(item)) {
2570
2616
  var sectionHtml = xss(item[0].sectionLabel);
@@ -2573,7 +2619,7 @@ var SearchBox = vue.defineComponent({
2573
2619
  "key": "section-" + itemIndex,
2574
2620
  "class": "section-container"
2575
2621
  }, [sectionHtml ? vue.createVNode("div", {
2576
- "class": "section-header " + getClassName$1(_this18.$props.innerClass, 'section-label'),
2622
+ "class": "section-header " + getClassName$1(_this17.$props.innerClass, 'section-label'),
2577
2623
  "key": "" + item[0].sectionId,
2578
2624
  "innerHTML": sectionHtml
2579
2625
  }, null) : null, vue.createVNode("ul", {
@@ -2593,7 +2639,7 @@ var SearchBox = vue.defineComponent({
2593
2639
  justifyContent: 'flex-start',
2594
2640
  alignItems: 'center'
2595
2641
  },
2596
- "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this18.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this18.$props.innerClass, 'suggestion-item'))
2642
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this17.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this17.$props.innerClass, 'suggestion-item'))
2597
2643
  }), [renderItem(sectionItem)]);
2598
2644
  }
2599
2645
  if (sectionItem._suggestion_type === '_internal_a_i_trigger') {
@@ -2607,9 +2653,9 @@ var SearchBox = vue.defineComponent({
2607
2653
  justifyContent: 'flex-start',
2608
2654
  alignItems: 'center'
2609
2655
  },
2610
- "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this18.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this18.$props.innerClass, 'suggestion-item'))
2656
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this17.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this17.$props.innerClass, 'suggestion-item'))
2611
2657
  }), [vue.createVNode(SuggestionItem, {
2612
- "currentValue": _this18.currentValue,
2658
+ "currentValue": _this17.currentValue,
2613
2659
  "suggestion": sectionItem
2614
2660
  }, null)]);
2615
2661
  }
@@ -2623,7 +2669,7 @@ var SearchBox = vue.defineComponent({
2623
2669
  justifyContent: 'flex-start',
2624
2670
  alignItems: 'center'
2625
2671
  },
2626
- "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this18.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this18.$props.innerClass, 'suggestion-item'))
2672
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this17.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this17.$props.innerClass, 'suggestion-item'))
2627
2673
  }), [vue.createVNode("div", {
2628
2674
  "style": {
2629
2675
  padding: '0 10px 0 0',
@@ -2631,74 +2677,74 @@ var SearchBox = vue.defineComponent({
2631
2677
  }
2632
2678
  }, [vue.createVNode(CustomSvg, {
2633
2679
  "key": sectionItem._suggestion_type + "-" + sectionIndex,
2634
- "className": getClassName$1(_this18.$props.innerClass, sectionItem._suggestion_type + "-search-icon") || null,
2680
+ "className": getClassName$1(_this17.$props.innerClass, sectionItem._suggestion_type + "-search-icon") || null,
2635
2681
  "icon": getIcon(sectionItem._suggestion_type, sectionItem, suggestionsHaveIcon),
2636
2682
  "type": sectionItem._suggestion_type + "-search-icon"
2637
2683
  }, null)]), vue.createVNode(SuggestionItem, {
2638
- "currentValue": _this18.currentValue,
2684
+ "currentValue": _this17.currentValue,
2639
2685
  "suggestion": sectionItem
2640
- }, null), _this18.renderActionIcon(sectionItem)]);
2686
+ }, null), _this17.renderActionIcon(sectionItem)]);
2641
2687
  })])]);
2642
2688
  }
2643
2689
  return vue.createVNode("div", null, [vue.createTextVNode("No suggestions")]);
2644
- }), !_this18.showAIScreen && _this18.parsedSuggestions.length && _this18.$props.showSuggestionsFooter ? _this18.suggestionsFooter() : null]) : _this18.renderNoSuggestions(_this18.normalizedSuggestions)]);
2690
+ }), !_this17.showAIScreen && _this17.parsedSuggestions.length && _this17.$props.showSuggestionsFooter ? _this17.suggestionsFooter() : null]) : _this17.renderNoSuggestions(_this17.normalizedSuggestions)]);
2645
2691
  };
2646
2692
  return vue.createVNode("div", {
2647
2693
  "class": Input.suggestionsContainer
2648
2694
  }, [vue.createVNode(InputGroup, {
2649
2695
  "searchBox": true,
2650
2696
  "ref": _inputGroupRef,
2651
- "isOpen": _this18.$data.isOpen
2697
+ "isOpen": _this17.$data.isOpen
2652
2698
  }, {
2653
2699
  "default": function _default() {
2654
2700
  return [vue.createVNode(Input.Actions, null, {
2655
2701
  "default": function _default() {
2656
- return [_this18.renderInputAddonBefore(), _this18.renderLeftIcons()];
2702
+ return [_this17.renderInputAddonBefore(), _this17.renderLeftIcons()];
2657
2703
  }
2658
2704
  }), vue.createVNode(DropDown.InputWrapper, null, {
2659
2705
  "default": function _default() {
2660
2706
  return [vue.createVNode(Input.TextArea, vue.mergeProps(_transformOn(getInputEvents({
2661
- onInput: _this18.onInputChange,
2707
+ onInput: _this17.onInputChange,
2662
2708
  onBlur: function onBlur(e) {
2663
- _this18.$emit('blur', e, _this18.triggerQuery);
2709
+ _this17.$emit('blur', e, _this17.triggerQuery);
2664
2710
  },
2665
- onFocus: _this18.handleFocus,
2711
+ onFocus: _this17.handleFocus,
2666
2712
  onKeyPress: function onKeyPress(e) {
2667
- _this18.$emit('keyPress', e, _this18.triggerQuery);
2668
- _this18.$emit('key-press', e, _this18.triggerQuery);
2713
+ _this17.$emit('keyPress', e, _this17.triggerQuery);
2714
+ _this17.$emit('key-press', e, _this17.triggerQuery);
2669
2715
  },
2670
2716
  onKeyDown: function onKeyDown(e) {
2671
- return _this18.handleKeyDown(e, highlightedIndex);
2717
+ return _this17.handleKeyDown(e, highlightedIndex);
2672
2718
  },
2673
2719
  onKeyUp: function onKeyUp(e) {
2674
- _this18.$emit('keyUp', e, _this18.triggerQuery);
2675
- _this18.$emit('key-up', e, _this18.triggerQuery);
2720
+ _this17.$emit('keyUp', e, _this17.triggerQuery);
2721
+ _this17.$emit('key-up', e, _this17.triggerQuery);
2676
2722
  },
2677
2723
  onClick: function onClick() {
2678
2724
  setHighlightedIndex(null);
2679
2725
  }
2680
2726
  })), {
2681
2727
  "searchBox": true,
2682
- "isOpen": _this18.$data.isOpen,
2683
- "id": _this18.$props.componentId + "-input",
2684
- "ref": _this18.$props.innerRef,
2685
- "class": getClassName$1(_this18.$props.innerClass, 'input'),
2686
- "placeholder": _this18.$props.placeholder,
2687
- "autoFocus": _this18.$props.autoFocus
2728
+ "isOpen": _this17.$data.isOpen,
2729
+ "id": _this17.$props.componentId + "-input",
2730
+ "ref": _this17.$props.innerRef,
2731
+ "class": getClassName$1(_this17.$props.innerClass, 'input'),
2732
+ "placeholder": _this17.$props.placeholder,
2733
+ "autoFocus": _this17.$props.autoFocus
2688
2734
  }, getInputProps({
2689
- value: _this18.$data.currentValue === null ? '' : _this18.$data.currentValue
2735
+ value: _this17.$data.currentValue === null ? '' : _this17.$data.currentValue
2690
2736
  }), {
2691
- "themePreset": _this18.themePreset,
2737
+ "themePreset": _this17.themePreset,
2692
2738
  "autocomplete": "off"
2693
2739
  }), null), !expandSuggestionsContainer && renderSuggestionsDropdown()];
2694
2740
  }
2695
2741
  }), vue.createVNode(Input.Actions, null, {
2696
2742
  "default": function _default() {
2697
- return [_this18.renderRightIcons(), _this18.renderInputAddonAfter(), _this18.renderAskButtonElement(), _this18.renderEnterButtonElement()];
2743
+ return [_this17.renderRightIcons(), _this17.renderInputAddonAfter(), _this17.renderAskButtonElement(), _this17.renderEnterButtonElement()];
2698
2744
  }
2699
2745
  })];
2700
2746
  }
2701
- }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this18.renderTags()]);
2747
+ }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this17.renderTags()]);
2702
2748
  }
2703
2749
  }) : vue.createVNode("div", {
2704
2750
  "class": Input.suggestionsContainer
@@ -2709,43 +2755,43 @@ var SearchBox = vue.defineComponent({
2709
2755
  "default": function _default() {
2710
2756
  return [vue.createVNode(Input.Actions, null, {
2711
2757
  "default": function _default() {
2712
- return [_this18.renderInputAddonBefore(), _this18.renderLeftIcons()];
2758
+ return [_this17.renderInputAddonBefore(), _this17.renderLeftIcons()];
2713
2759
  }
2714
2760
  }), vue.createVNode(DropDown.InputWrapper, null, {
2715
2761
  "default": function _default() {
2716
2762
  return [vue.createVNode(Input.TextArea, vue.mergeProps(_transformOn({
2717
2763
  blur: function blur(e) {
2718
- _this18.$emit('blur', e, _this18.triggerQuery);
2764
+ _this17.$emit('blur', e, _this17.triggerQuery);
2719
2765
  },
2720
2766
  keypress: function keypress(e) {
2721
- _this18.$emit('keyPress', e, _this18.triggerQuery);
2722
- _this18.$emit('key-press', e, _this18.triggerQuery);
2767
+ _this17.$emit('keyPress', e, _this17.triggerQuery);
2768
+ _this17.$emit('key-press', e, _this17.triggerQuery);
2723
2769
  },
2724
- input: _this18.onInputChange,
2770
+ input: _this17.onInputChange,
2725
2771
  focus: function focus(e) {
2726
- _this18.$emit('focus', e, _this18.triggerQuery);
2772
+ _this17.$emit('focus', e, _this17.triggerQuery);
2727
2773
  },
2728
- keydown: _this18.handleKeyDown,
2774
+ keydown: _this17.handleKeyDown,
2729
2775
  keyup: function keyup(e) {
2730
- _this18.$emit('keyUp', e, _this18.triggerQuery);
2731
- _this18.$emit('key-up', e, _this18.triggerQuery);
2776
+ _this17.$emit('keyUp', e, _this17.triggerQuery);
2777
+ _this17.$emit('key-up', e, _this17.triggerQuery);
2732
2778
  }
2733
2779
  }), {
2734
2780
  "searchBox": true,
2735
- "class": getClassName$1(_this18.$props.innerClass, 'input') || '',
2736
- "placeholder": _this18.$props.placeholder,
2737
- "autofocus": _this18.$props.autoFocus,
2738
- "value": _this18.$data.currentValue ? _this18.$data.currentValue : '',
2739
- "iconPosition": _this18.$props.iconPosition,
2740
- "showIcon": _this18.$props.showIcon,
2741
- "showClear": _this18.$props.showClear,
2742
- "ref": _this18.$props.innerRef,
2743
- "themePreset": _this18.themePreset
2781
+ "class": getClassName$1(_this17.$props.innerClass, 'input') || '',
2782
+ "placeholder": _this17.$props.placeholder,
2783
+ "autofocus": _this17.$props.autoFocus,
2784
+ "value": _this17.$data.currentValue ? _this17.$data.currentValue : '',
2785
+ "iconPosition": _this17.$props.iconPosition,
2786
+ "showIcon": _this17.$props.showIcon,
2787
+ "showClear": _this17.$props.showClear,
2788
+ "ref": _this17.$props.innerRef,
2789
+ "themePreset": _this17.themePreset
2744
2790
  }), null)];
2745
2791
  }
2746
2792
  }), vue.createVNode(Input.Actions, null, {
2747
2793
  "default": function _default() {
2748
- return [_this18.renderRightIcons(), _this18.renderInputAddonAfter(), _this18.renderEnterButtonElement()];
2794
+ return [_this17.renderRightIcons(), _this17.renderInputAddonAfter(), _this17.renderEnterButtonElement()];
2749
2795
  }
2750
2796
  })];
2751
2797
  }
@@ -2960,14 +3006,12 @@ var AIAnswer = vue.defineComponent({
2960
3006
  message: response.error
2961
3007
  };
2962
3008
  }
3009
+
2963
3010
  // pushing message history so far
2964
3011
  if (messagesHistory && Array.isArray(messagesHistory)) {
2965
3012
  finalMessages.push.apply(finalMessages, messagesHistory.filter(function (msg) {
2966
3013
  return msg.role !== constants.AI_ROLES.SYSTEM;
2967
3014
  }));
2968
- if (finalMessages[0].role === constants.AI_ROLES.USER) {
2969
- finalMessages.shift();
2970
- }
2971
3015
  } else if (response && response.answer && response.answer.text) {
2972
3016
  finalMessages.push({
2973
3017
  role: constants.AI_ROLES.ASSISTANT,