@appbaseio/reactivesearch-vue 3.0.0-rc.7.1 → 3.0.0-rc.9

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.
@@ -25,10 +25,9 @@ var Flex = require('./Flex-ddde6d26.js');
25
25
  var analytics = require('@appbaseio/reactivecore/lib/actions/analytics');
26
26
  var ReactiveBase = require('./ReactiveBase.js');
27
27
  var hotkeys = _interopDefault(require('hotkeys-js'));
28
- var xss = _interopDefault(require('xss'));
29
28
  var remarkable = require('remarkable');
30
- var DropDown = require('./DropDown-dcdaf54f.js');
31
- var Input = require('./Input-df30e5fc.js');
29
+ var DropDown = require('./DropDown-aef75c14.js');
30
+ var Input = require('./Input-56eba499.js');
32
31
  var Container = require('./Container-29f049b2.js');
33
32
  var Highlight = _interopDefault(require('vue-highlight-words'));
34
33
  var query = require('@appbaseio/reactivecore/lib/actions/query');
@@ -53,9 +52,7 @@ var ResultList = require('./ResultList.js');
53
52
  var StateProvider = require('./StateProvider.js');
54
53
 
55
54
  var _templateObject;
56
- var InputGroup = vueEmotion.styled('div')(_templateObject || (_templateObject = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: stretch;\n\twidth: 100%;\n\tbox-shadow: rgb(0 0 0 / 20%) 0px 0px 6px;\n\tborder-radius: 6px;\n\n\t", "\n};\n"])), function (props) {
57
- return props.isOpen && 'box-shadow: rgb(0 0 0 / 20%) 0px 0px 15px;';
58
- });
55
+ var InputGroup = vueEmotion.styled('div')(_templateObject || (_templateObject = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: stretch;\n\twidth: 100%;\n"])));
59
56
  InputGroup.defaultProps = {
60
57
  className: 'input-group'
61
58
  };
@@ -1073,9 +1070,6 @@ var AIFeedback = vue.defineComponent({
1073
1070
  }
1074
1071
  });
1075
1072
 
1076
- var _templateObject$8;
1077
- var AutosuggestFooterContainer = vueEmotion.styled('div')(_templateObject$8 || (_templateObject$8 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tcolor: #8792a2;\n\tbackground: #f7fafc;\n\tpadding: 10px;\n\theight: 40px;\n"])));
1078
-
1079
1073
  var _excluded = ["_source"];
1080
1074
  function _isSlot(s) {
1081
1075
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
@@ -1112,8 +1106,7 @@ var SearchBox = vue.defineComponent({
1112
1106
  showAIScreen: false,
1113
1107
  showAIScreenFooter: false,
1114
1108
  showFeedbackComponent: false,
1115
- feedbackState: null,
1116
- prefilledAIAnswer: ''
1109
+ feedbackState: null
1117
1110
  };
1118
1111
  this.internalComponent = props.componentId + "__internal";
1119
1112
  return this.__state;
@@ -1154,37 +1147,6 @@ var SearchBox = vue.defineComponent({
1154
1147
  },
1155
1148
  stats: function stats() {
1156
1149
  return getResultStats(this);
1157
- },
1158
- mergedAIAnswer: function mergedAIAnswer() {
1159
- return this.prefilledAIAnswer || this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text;
1160
- },
1161
- parsedSuggestions: function parsedSuggestions() {
1162
- var suggestionsArray = [];
1163
- if (Array.isArray(this.suggestions) && this.suggestions.length) {
1164
- suggestionsArray = [].concat(withClickIds(this.suggestions));
1165
- }
1166
- suggestionsArray = suggestionsArray.map(function (s) {
1167
- if (s.sectionId) {
1168
- return s;
1169
- }
1170
- return _rollupPluginBabelHelpers._extends({}, s, {
1171
- sectionId: s._suggestion_type
1172
- });
1173
- });
1174
- var sectionsAccumulated = [];
1175
- var sectionisedSuggestions = suggestionsArray.reduce(function (acc, d, currentIndex) {
1176
- if (sectionsAccumulated.includes(d.sectionId)) return acc;
1177
- if (d.sectionId) {
1178
- acc[currentIndex] = suggestionsArray.filter(function (g) {
1179
- return g.sectionId === d.sectionId;
1180
- });
1181
- sectionsAccumulated.push(d.sectionId);
1182
- } else {
1183
- acc[currentIndex] = d;
1184
- }
1185
- return acc;
1186
- }, {});
1187
- return Object.values(sectionisedSuggestions);
1188
1150
  }
1189
1151
  },
1190
1152
  props: {
@@ -1216,11 +1178,6 @@ var SearchBox = vue.defineComponent({
1216
1178
  enableQuerySuggestions: VueTypes.bool.def(false),
1217
1179
  enablePopularSuggestions: VueTypes.bool.def(false),
1218
1180
  enableRecentSuggestions: VueTypes.bool.def(false),
1219
- enableFAQSuggestions: VueTypes.bool.def(false),
1220
- FAQSuggestionsConfig: VueTypes.shape({
1221
- sectionLabel: VueTypes.string,
1222
- size: VueTypes.number
1223
- }),
1224
1181
  fieldWeights: vueTypes.types.fieldWeights,
1225
1182
  filterLabel: vueTypes.types.string,
1226
1183
  fuzziness: vueTypes.types.fuzziness,
@@ -1256,20 +1213,12 @@ var SearchBox = vue.defineComponent({
1256
1213
  distinctFieldConfig: vueTypes.types.props,
1257
1214
  //
1258
1215
  focusShortcuts: VueTypes.arrayOf(VueTypes.oneOfType([VueTypes.string, VueTypes.number])).def(['/']),
1259
- showFocusShortcutsIcon: VueTypes.bool.def(true),
1260
1216
  addonBefore: VueTypes.any,
1261
1217
  addonAfter: VueTypes.any,
1262
- showSuggestionsFooter: VueTypes.bool.def(true),
1263
1218
  expandSuggestionsContainer: VueTypes.bool.def(true),
1264
- renderSuggestionsFooter: VueTypes.func,
1265
1219
  index: VueTypes.string,
1266
1220
  popularSuggestionsConfig: VueTypes.object,
1267
1221
  recentSuggestionsConfig: VueTypes.object,
1268
- featuredSuggestionsConfig: VueTypes.shape({
1269
- maxSuggestionsPerSection: VueTypes.number,
1270
- sectionsOrder: VueTypes.arrayOf(VueTypes.string)
1271
- }),
1272
- customEvents: VueTypes.object,
1273
1222
  applyStopwords: VueTypes.bool,
1274
1223
  customStopwords: vueTypes.types.stringArray,
1275
1224
  onData: vueTypes.types.func,
@@ -1457,7 +1406,7 @@ var SearchBox = vue.defineComponent({
1457
1406
  resultStats: this.stats,
1458
1407
  AIData: {
1459
1408
  question: this.AIResponse && this.AIResponse.response && this.AIResponse.response.question,
1460
- answer: this.mergedAIAnswerc,
1409
+ answer: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text,
1461
1410
  documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
1462
1411
  showAIScreen: this.showAIScreen,
1463
1412
  sources: this.getAISourceObjects(),
@@ -1488,7 +1437,7 @@ var SearchBox = vue.defineComponent({
1488
1437
  this.onValueSelectedHandler(currentValue, reactivecore.causes.SEARCH_ICON_CLICK);
1489
1438
  }
1490
1439
  },
1491
- setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue, shouldExecuteQuery) {
1440
+ setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue) {
1492
1441
  var _this2 = this;
1493
1442
  if (isDefaultValue === void 0) {
1494
1443
  isDefaultValue = false;
@@ -1502,9 +1451,6 @@ var SearchBox = vue.defineComponent({
1502
1451
  if (categoryValue === void 0) {
1503
1452
  categoryValue = undefined;
1504
1453
  }
1505
- if (shouldExecuteQuery === void 0) {
1506
- shouldExecuteQuery = true;
1507
- }
1508
1454
  var performUpdate = function performUpdate() {
1509
1455
  if (_this2.$options.isTagsMode && isEqual(value, _this2.selectedTags)) {
1510
1456
  return;
@@ -1540,18 +1486,17 @@ var SearchBox = vue.defineComponent({
1540
1486
  }
1541
1487
  if (typeof _this2.currentValue === 'string') _this2.triggerDefaultQuery(_this2.currentValue, props.enableAI ? {
1542
1488
  enableAI: true
1543
- } : {}, shouldExecuteQuery);
1489
+ } : {});
1544
1490
  } // in case of strict selection only SUGGESTION_SELECT should be able
1545
1491
  // to set the query otherwise the value should reset
1546
1492
  if (props.strictSelection) {
1547
1493
  if (cause === reactivecore.causes.SUGGESTION_SELECT || (_this2.$options.isTagsMode ? _this2.selectedTags.length === 0 : value === '')) {
1548
- _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1494
+ _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue);
1549
1495
  } else {
1550
1496
  _this2.setValue('', true);
1551
1497
  }
1552
1498
  } else if (props.value === undefined || cause === reactivecore.causes.SUGGESTION_SELECT || cause === reactivecore.causes.CLEAR_VALUE) {
1553
- _this2.showAIScreen = false;
1554
- _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1499
+ _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue);
1555
1500
  }
1556
1501
  } else {
1557
1502
  // debounce for handling text while typing
@@ -1562,13 +1507,10 @@ var SearchBox = vue.defineComponent({
1562
1507
  };
1563
1508
  checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
1564
1509
  },
1565
- triggerDefaultQuery: function triggerDefaultQuery(paramValue, meta, shouldExecuteQuery) {
1510
+ triggerDefaultQuery: function triggerDefaultQuery(paramValue, meta) {
1566
1511
  if (meta === void 0) {
1567
1512
  meta = {};
1568
1513
  }
1569
- if (shouldExecuteQuery === void 0) {
1570
- shouldExecuteQuery = true;
1571
- }
1572
1514
  if (!this.$props.autosuggest) {
1573
1515
  return;
1574
1516
  }
@@ -1589,15 +1531,12 @@ var SearchBox = vue.defineComponent({
1589
1531
  value: value,
1590
1532
  componentType: constants.componentTypes.searchBox,
1591
1533
  meta: meta
1592
- }, shouldExecuteQuery);
1534
+ });
1593
1535
  },
1594
- triggerCustomQuery: function triggerCustomQuery(paramValue, categoryValue, shouldExecuteQuery) {
1536
+ triggerCustomQuery: function triggerCustomQuery(paramValue, categoryValue) {
1595
1537
  if (categoryValue === void 0) {
1596
1538
  categoryValue = undefined;
1597
1539
  }
1598
- if (shouldExecuteQuery === void 0) {
1599
- shouldExecuteQuery = true;
1600
- }
1601
1540
  var _this$$props = this.$props,
1602
1541
  customQuery = _this$$props.customQuery,
1603
1542
  filterLabel = _this$$props.filterLabel,
@@ -1626,7 +1565,7 @@ var SearchBox = vue.defineComponent({
1626
1565
  URLParams: URLParams,
1627
1566
  componentType: constants.componentTypes.searchBox,
1628
1567
  category: categoryValue
1629
- }, shouldExecuteQuery);
1568
+ });
1630
1569
  },
1631
1570
  handleFocus: function handleFocus(event) {
1632
1571
  if (this.$props.autosuggest) {
@@ -1725,60 +1664,12 @@ var SearchBox = vue.defineComponent({
1725
1664
  }, e);
1726
1665
  }
1727
1666
  },
1728
- handleFeaturedSuggestionClicked: function handleFeaturedSuggestionClicked(suggestion) {
1729
- try {
1730
- var _this$$refs2, _this$$refs2$this$$pr;
1731
- if (suggestion.action === helper.featuredSuggestionsActionTypes.NAVIGATE) {
1732
- var _JSON$parse = JSON.parse(suggestion.subAction),
1733
- _JSON$parse$target = _JSON$parse.target,
1734
- target = _JSON$parse$target === void 0 ? '_self' : _JSON$parse$target,
1735
- _JSON$parse$link = _JSON$parse.link,
1736
- link = _JSON$parse$link === void 0 ? '/' : _JSON$parse$link;
1737
- if (typeof window !== 'undefined') {
1738
- window.open(link, target);
1739
- }
1740
- }
1741
- if (suggestion.action === helper.featuredSuggestionsActionTypes.FUNCTION) {
1742
- var matchedValues = suggestion.subAction.match(/function\s*\(.*\)(.|\n)*/);
1743
- var functionStr = matchedValues && matchedValues[0];
1744
- // eslint-disable-next-line no-new-func
1745
- var func = new Function("return " + functionStr)();
1746
- func(suggestion, this.$data.currentValue, this.$props.customEvents);
1747
- }
1748
- if (suggestion.action === helper.featuredSuggestionsActionTypes.SELECT) {
1749
- this.setValue(suggestion.value, true, this.$props, this.$options.isTagsMode.current ? reactivecore.causes.SUGGESTION_SELECT : reactivecore.causes.ENTER_PRESS);
1750
- this.onValueSelectedHandler(suggestion.value, reactivecore.causes.SUGGESTION_SELECT);
1751
- }
1752
- // blur is important to close the dropdown
1753
- // on selecting one of featured suggestions
1754
- // else Downshift probably is focusing the dropdown
1755
- // and not letting it close
1756
- // eslint-disable-next-line no-unused-expressions
1757
- (_this$$refs2 = this.$refs) == null ? void 0 : (_this$$refs2$this$$pr = _this$$refs2[this.$props.innerRef]) == null ? void 0 : _this$$refs2$this$$pr.blur();
1758
- } catch (e) {
1759
- console.error("Error: There was an error parsing the subAction for the featured suggestion with label, \"" + suggestion.label + "\"", e);
1760
- }
1761
- },
1762
1667
  onSuggestionSelected: function onSuggestionSelected(suggestion) {
1763
1668
  var _this4 = this;
1764
- // handle when FAQ suggestion is clicked
1765
- if (suggestion && suggestion._suggestion_type === helper.suggestionTypes.FAQ) {
1766
- this.prefilledAIAnswer = suggestion._answer;
1767
- this.setValue(suggestion.value, true, this.$props, reactivecore.causes.SUGGESTION_SELECT, true, false, suggestion._category, false);
1768
- this.isOpen = true;
1769
- this.showAIScreen = true;
1770
- return;
1771
- }
1772
1669
  if (!this.$props.enableAI) this.isOpen = false;else {
1773
1670
  this.showAIScreen = true;
1774
1671
  }
1775
1672
  var value = this.$props.value;
1776
-
1777
- // handle featured suggestions click event
1778
- if (suggestion._suggestion_type === helper.suggestionTypes.Featured) {
1779
- this.handleFeaturedSuggestionClicked(suggestion);
1780
- return;
1781
- }
1782
1673
  // Record analytics for selected suggestions
1783
1674
  this.triggerClickAnalytics(suggestion._click_id);
1784
1675
  if (value === undefined) {
@@ -1934,13 +1825,6 @@ var SearchBox = vue.defineComponent({
1934
1825
  customQuery: true
1935
1826
  });
1936
1827
  },
1937
- suggestionsFooter: function suggestionsFooter() {
1938
- return typeof renderSuggestionsFooter === 'function' ? this.$props.renderSuggestionsFooter() : vue.createVNode(AutosuggestFooterContainer, null, {
1939
- "default": function _default() {
1940
- return [vue.createVNode("div", null, [vue.createTextVNode("\u2191\u2193 Navigate")]), vue.createVNode("div", null, [vue.createTextVNode("\u21A9 Go")])];
1941
- }
1942
- });
1943
- },
1944
1828
  renderEnterButtonElement: function renderEnterButtonElement() {
1945
1829
  var _this6 = this;
1946
1830
  var _this$$props2 = this.$props,
@@ -1968,29 +1852,16 @@ var SearchBox = vue.defineComponent({
1968
1852
  }
1969
1853
  return null;
1970
1854
  },
1971
- renderShortcut: function renderShortcut() {
1972
- if (this.$props.focusShortcuts && this.$props.focusShortcuts.length) {
1973
- var shortcut = this.$props.focusShortcuts[0];
1974
- shortcut = shortcut.toLowerCase();
1975
- shortcut = shortcut.replace('shift', '⬆️');
1976
- shortcut = shortcut.replace('command', 'cmd');
1977
- shortcut = shortcut.replace('control', 'ctrl');
1978
- shortcut = shortcut.replace('option', 'alt');
1979
- return shortcut.toUpperCase();
1980
- }
1981
- return '/';
1982
- },
1983
1855
  renderIcons: function renderIcons() {
1984
1856
  var _this7 = this;
1985
- var _slot3, _slot4, _slot5, _slot6;
1857
+ var _slot3, _slot4, _slot5;
1986
1858
  var _this$$props3 = this.$props,
1987
1859
  iconPosition = _this$$props3.iconPosition,
1988
1860
  showClear = _this$$props3.showClear,
1989
1861
  innerClass = _this$$props3.innerClass,
1990
1862
  getMicInstance = _this$$props3.getMicInstance,
1991
1863
  showVoiceSearch = _this$$props3.showVoiceSearch,
1992
- showIcon = _this$$props3.showIcon,
1993
- showFocusShortcutsIcon = _this$$props3.showFocusShortcutsIcon;
1864
+ showIcon = _this$$props3.showIcon;
1994
1865
  var renderMic = this.$slots.renderMic || this.$props.renderMic;
1995
1866
  var currentValue = this.$data.currentValue;
1996
1867
  return vue.createVNode("div", null, [vue.createVNode(DropDown.IconGroup, {
@@ -2006,14 +1877,6 @@ var SearchBox = vue.defineComponent({
2006
1877
  "default": function _default() {
2007
1878
  return [_slot3];
2008
1879
  }
2009
- }), showFocusShortcutsIcon && vue.createVNode(DropDown.ButtonIconWrapper, {
2010
- "onClick": function onClick(e) {
2011
- return _this7.focusSearchBox(e);
2012
- }
2013
- }, _isSlot(_slot4 = _this7.renderShortcut()) ? _slot4 : {
2014
- "default": function _default() {
2015
- return [_slot4];
2016
- }
2017
1880
  }), showVoiceSearch && vue.createVNode(Mic, {
2018
1881
  "getInstance": getMicInstance,
2019
1882
  "render": renderMic,
@@ -2021,9 +1884,9 @@ var SearchBox = vue.defineComponent({
2021
1884
  "className": getClassName$1(innerClass, 'mic') || null
2022
1885
  }, null), iconPosition === 'right' && showIcon && vue.createVNode(DropDown.IconWrapper, {
2023
1886
  "onClick": _this7.handleSearchIconClick
2024
- }, _isSlot(_slot5 = _this7.renderIcon()) ? _slot5 : {
1887
+ }, _isSlot(_slot4 = _this7.renderIcon()) ? _slot4 : {
2025
1888
  "default": function _default() {
2026
- return [_slot5];
1889
+ return [_slot4];
2027
1890
  }
2028
1891
  })];
2029
1892
  }
@@ -2034,23 +1897,23 @@ var SearchBox = vue.defineComponent({
2034
1897
  "default": function _default() {
2035
1898
  return [iconPosition === 'left' && showIcon && vue.createVNode(DropDown.IconWrapper, {
2036
1899
  "onClick": _this7.handleSearchIconClick
2037
- }, _isSlot(_slot6 = _this7.renderIcon()) ? _slot6 : {
1900
+ }, _isSlot(_slot5 = _this7.renderIcon()) ? _slot5 : {
2038
1901
  "default": function _default() {
2039
- return [_slot6];
1902
+ return [_slot5];
2040
1903
  }
2041
1904
  })];
2042
1905
  }
2043
1906
  })]);
2044
1907
  },
2045
1908
  focusSearchBox: function focusSearchBox(event) {
2046
- var _this$$refs3, _this$$refs3$this$$pr;
1909
+ var _this$$refs2, _this$$refs2$this$$pr;
2047
1910
  var elt = event.target || event.srcElement;
2048
1911
  var tagName = elt.tagName;
2049
1912
  if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
2050
1913
  // already in an input
2051
1914
  return;
2052
1915
  }
2053
- (_this$$refs3 = this.$refs) == null ? void 0 : (_this$$refs3$this$$pr = _this$$refs3[this.$props.innerRef]) == null ? void 0 : _this$$refs3$this$$pr.focus(); // eslint-disable-line
1916
+ (_this$$refs2 = this.$refs) == null ? void 0 : (_this$$refs2$this$$pr = _this$$refs2[this.$props.innerRef]) == null ? void 0 : _this$$refs2$this$$pr.focus(); // eslint-disable-line
2054
1917
  },
2055
1918
  listenForFocusShortcuts: function listenForFocusShortcuts() {
2056
1919
  var _this8 = this;
@@ -2090,31 +1953,16 @@ var SearchBox = vue.defineComponent({
2090
1953
  this.currentValue = index.decodeHtml(value);
2091
1954
  this.triggerDefaultQuery(value);
2092
1955
  },
2093
- renderActionIcon: function renderActionIcon(suggestion) {
1956
+ renderAutoFill: function renderAutoFill(suggestion) {
2094
1957
  var _this9 = this;
2095
1958
  var handleAutoFillClick = function handleAutoFillClick(e) {
2096
1959
  e.stopPropagation();
2097
1960
  _this9.onAutofillClick(suggestion);
2098
1961
  };
2099
- if (suggestion._suggestion_type === helper.suggestionTypes.Featured) {
2100
- if (suggestion.action === helper.featuredSuggestionsActionTypes.FUNCTION) {
2101
- return vue.createVNode(AutoFillSvg, {
2102
- "style": {
2103
- transform: 'rotate(135deg)',
2104
- pointerEvents: 'none'
2105
- }
2106
- }, null);
2107
- }
2108
- return null;
2109
- }
2110
- if (!suggestion._category) {
2111
- /* 👇 avoid showing autofill for category suggestions👇 */
2112
-
2113
- return vue.createVNode(AutoFillSvg, {
2114
- "onClick": handleAutoFillClick
2115
- }, null);
2116
- }
2117
- return null;
1962
+ /* 👇 avoid showing autofill for category suggestions👇 */
1963
+ return suggestion._category ? null : vue.createVNode(AutoFillSvg, {
1964
+ "onClick": handleAutoFillClick
1965
+ }, null);
2118
1966
  },
2119
1967
  renderTag: function renderTag(item) {
2120
1968
  var _this10 = this;
@@ -2221,7 +2069,7 @@ var SearchBox = vue.defineComponent({
2221
2069
  return vue.createVNode(HorizontalSkeletonLoader, null, null);
2222
2070
  },
2223
2071
  renderAIScreenFooter: function renderAIScreenFooter() {
2224
- var _slot7;
2072
+ var _slot6;
2225
2073
  var _this12 = this;
2226
2074
  var _this$$props$AIUIConf2 = this.$props.AIUIConfig,
2227
2075
  AIUIConfig = _this$$props$AIUIConf2 === void 0 ? {} : _this$$props$AIUIConf2;
@@ -2236,7 +2084,7 @@ var SearchBox = vue.defineComponent({
2236
2084
  "themePreset": this.$props.themePreset
2237
2085
  }, {
2238
2086
  "default": function _default() {
2239
- return [vue.createTextVNode("Summary generated using the following sources:"), ' ', vue.createVNode(SourceTags, null, _isSlot(_slot7 = _this12.getAISourceObjects().map(function (el) {
2087
+ return [vue.createTextVNode("Summary generated using the following sources:"), ' ', vue.createVNode(SourceTags, null, _isSlot(_slot6 = _this12.getAISourceObjects().map(function (el) {
2240
2088
  return vue.createVNode(Button.Button, {
2241
2089
  "class": "--ai-source-tag " + (getClassName$1(_this12.$props.innerClass, 'ai-source-tag') || ''),
2242
2090
  "title": el[sourceDocumentLabel],
@@ -2249,9 +2097,9 @@ var SearchBox = vue.defineComponent({
2249
2097
  return [el[sourceDocumentLabel]];
2250
2098
  }
2251
2099
  });
2252
- })) ? _slot7 : {
2100
+ })) ? _slot6 : {
2253
2101
  "default": function _default() {
2254
- return [_slot7];
2102
+ return [_slot6];
2255
2103
  }
2256
2104
  })];
2257
2105
  }
@@ -2263,7 +2111,7 @@ var SearchBox = vue.defineComponent({
2263
2111
  if (customAIRenderer) {
2264
2112
  return customAIRenderer({
2265
2113
  question: this.AIResponse && this.AIResponse.response && this.AIResponse.response.question,
2266
- answer: this.mergedAIAnswer,
2114
+ answer: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text,
2267
2115
  documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
2268
2116
  loading: this.isAIResponseLoading || this.isLoading,
2269
2117
  sources: this.getAISourceObjects(),
@@ -2274,7 +2122,7 @@ var SearchBox = vue.defineComponent({
2274
2122
  return this.renderAIScreenLoader();
2275
2123
  }
2276
2124
  return vue.createVNode("div", null, [vue.createVNode(Answer, {
2277
- "innerHTML": md.render(this.mergedAIAnswer)
2125
+ "innerHTML": md.render(this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text)
2278
2126
  }, null), this.renderAIScreenFooter(), this.showFeedbackComponent && vue.createVNode("div", {
2279
2127
  "class": "" + (getClassName$1(this.$props.innerClass, 'ai-feedback') || '')
2280
2128
  }, [vue.createVNode(AIFeedback, {
@@ -2383,58 +2231,23 @@ var SearchBox = vue.defineComponent({
2383
2231
  highlightedIndex = _ref8.highlightedIndex,
2384
2232
  setHighlightedIndex = _ref8.setHighlightedIndex;
2385
2233
  var renderSuggestionsDropdown = function renderSuggestionsDropdown() {
2386
- var getIcon = function getIcon(iconType, item, leaveSpaceForIcon) {
2234
+ var getIcon = function getIcon(iconType) {
2387
2235
  switch (iconType) {
2388
2236
  case helper.suggestionTypes.Recent:
2389
2237
  return recentSearchesIcon;
2390
2238
  case helper.suggestionTypes.Popular:
2391
2239
  return popularSearchesIcon;
2392
- case helper.suggestionTypes.Featured:
2393
- if (item.icon) {
2394
- return function () {
2395
- return vue.createVNode("div", {
2396
- "style": {
2397
- display: 'flex'
2398
- },
2399
- "innerHTML": xss(item.icon)
2400
- }, null);
2401
- };
2402
- }
2403
- if (item.iconURL) {
2404
- return function () {
2405
- return (// When you change below also change the empty icon below
2406
- vue.createVNode("img", {
2407
- "style": {
2408
- maxHeight: '25px'
2409
- },
2410
- "src": xss(item.iconURL),
2411
- "alt": item.value
2412
- }, null)
2413
- );
2414
- };
2415
- }
2416
- // Render an empty icon when no icon is provided from the dashboard
2417
- return function () {
2418
- return vue.createVNode("span", {
2419
- "style": {
2420
- display: 'inline-block',
2421
- height: '25px',
2422
- width: leaveSpaceForIcon ? '25px' : 0
2423
- }
2424
- }, null);
2425
- };
2426
2240
  default:
2427
2241
  return null;
2428
2242
  }
2429
2243
  };
2430
- var indexOffset = 0;
2431
2244
  return vue.createVNode("div", null, [_this15.hasCustomRenderer && _this15.getComponent({
2432
2245
  isOpen: isOpen,
2433
2246
  getItemProps: getItemProps,
2434
2247
  getItemEvents: getItemEvents,
2435
2248
  highlightedIndex: highlightedIndex
2436
2249
  }), _this15.renderErrorComponent(), !_this15.hasCustomRenderer && isOpen && hasSuggestions ? vue.createVNode("ul", {
2437
- "class": Input.suggestions(_this15.themePreset, _this15.theme) + " " + getClassName$1(_this15.$props.innerClass, 'list') + " " + Input.searchboxSuggestions(_this15.themePreset, _this15.theme) + "\n\t\t\t\t\t\t\t\t\t\t\t\t\t",
2250
+ "class": Input.suggestions(_this15.themePreset, _this15.theme) + " " + getClassName$1(_this15.$props.innerClass, 'list'),
2438
2251
  "ref": _dropdownULRef
2439
2252
  }, [_this15.showAIScreen && vue.createVNode(SearchBoxAISection, {
2440
2253
  "themePreset": _this15.$props.themePreset
@@ -2442,63 +2255,43 @@ var SearchBox = vue.defineComponent({
2442
2255
  "default": function _default() {
2443
2256
  return [_this15.renderAIScreen(), ' ', _this15.renderErrorComponent(true)];
2444
2257
  }
2445
- }), !_this15.showAIScreen && _this15.parsedSuggestions.map(function (item, itemIndex) {
2446
- var index = indexOffset + itemIndex;
2447
- if (Array.isArray(item)) {
2448
- var sectionHtml = xss(item[0].sectionLabel);
2449
- indexOffset += item.length - 1;
2450
- return vue.createVNode("div", {
2451
- "class": "section-container"
2452
- }, [sectionHtml ? vue.createVNode("div", {
2453
- "class": "section-header " + getClassName$1(_this15.$props.innerClass, 'section-label'),
2454
- "key": "" + item[0].sectionId,
2455
- "innerHTML": sectionHtml
2456
- }, null) : null, vue.createVNode("ul", {
2457
- "class": "section-list"
2458
- }, [item.map(function (sectionItem, sectionIndex) {
2459
- var suggestionsHaveIcon = item.some(function (s) {
2460
- return s.icon || s.iconURL;
2461
- });
2462
- return renderItem ? vue.createVNode("li", vue.mergeProps(getItemProps({
2463
- item: sectionItem
2464
- }), _transformOn(getItemEvents({
2465
- item: sectionItem
2466
- })), {
2467
- "key": index + sectionIndex,
2468
- "style": {
2469
- justifyContent: 'flex-start',
2470
- alignItems: 'center'
2471
- },
2472
- "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this15.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this15.$props.innerClass, 'suggestion-item'))
2473
- }), [renderItem(sectionItem)]) : vue.createVNode("li", vue.mergeProps(getItemProps({
2474
- item: sectionItem
2475
- }), _transformOn(getItemEvents({
2476
- item: sectionItem
2477
- })), {
2478
- "key": index + sectionIndex,
2479
- "style": {
2480
- justifyContent: 'flex-start',
2481
- alignItems: 'center'
2482
- },
2483
- "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this15.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this15.$props.innerClass, 'suggestion-item'))
2484
- }), [vue.createVNode("div", {
2485
- "style": {
2486
- padding: '0 10px 0 0',
2487
- display: 'flex'
2488
- }
2489
- }, [vue.createVNode(CustomSvg, {
2490
- "key": sectionItem._suggestion_type + "-" + sectionIndex,
2491
- "className": getClassName$1(_this15.$props.innerClass, sectionItem._suggestion_type + "-search-icon") || null,
2492
- "icon": getIcon(sectionItem._suggestion_type, sectionItem, suggestionsHaveIcon),
2493
- "type": sectionItem._suggestion_type + "-search-icon"
2494
- }, null)]), vue.createVNode(SuggestionItem, {
2495
- "currentValue": _this15.currentValue,
2496
- "suggestion": sectionItem
2497
- }, null), _this15.renderActionIcon(sectionItem)]);
2498
- })])]);
2499
- }
2500
- return vue.createVNode("div", null, [vue.createTextVNode("No suggestions")]);
2501
- }), _this15.$props.showSuggestionsFooter ? _this15.suggestionsFooter() : null]) : _this15.renderNoSuggestions(_this15.normalizedSuggestions)]);
2258
+ }), !_this15.showAIScreen && _this15.normalizedSuggestions.map(function (item, index) {
2259
+ return renderItem ? vue.createVNode("li", vue.mergeProps(getItemProps({
2260
+ item: item
2261
+ }), getItemEvents({
2262
+ item: item
2263
+ }), {
2264
+ "key": index + 1 + "-" + item.value,
2265
+ "style": {
2266
+ backgroundColor: _this15.getBackgroundColor(highlightedIndex, index),
2267
+ justifyContent: 'flex-start',
2268
+ alignItems: 'center'
2269
+ }
2270
+ }), [renderItem(item)]) : vue.createVNode("li", vue.mergeProps(getItemProps({
2271
+ item: item
2272
+ }), _transformOn(getItemEvents({
2273
+ item: item
2274
+ })), {
2275
+ "key": index + 1 + "-" + item.value,
2276
+ "style": {
2277
+ backgroundColor: _this15.getBackgroundColor(highlightedIndex, index),
2278
+ justifyContent: 'flex-start',
2279
+ alignItems: 'center'
2280
+ }
2281
+ }), [vue.createVNode("div", {
2282
+ "style": {
2283
+ padding: '0 10px 0 0',
2284
+ display: 'flex'
2285
+ }
2286
+ }, [vue.createVNode(CustomSvg, {
2287
+ "className": getClassName$1(_this15.$props.innerClass, item._suggestion_type + "-search-icon") || null,
2288
+ "icon": getIcon(item._suggestion_type),
2289
+ "type": item._suggestion_type + "-search-icon"
2290
+ }, null)]), vue.createVNode(SuggestionItem, {
2291
+ "currentValue": _this15.currentValue,
2292
+ "suggestion": item
2293
+ }, null), _this15.renderAutoFill(item)]);
2294
+ })]) : _this15.renderNoSuggestions(_this15.normalizedSuggestions)]);
2502
2295
  };
2503
2296
  return vue.createVNode("div", {
2504
2297
  "class": Input.suggestionsContainer
@@ -2538,8 +2331,7 @@ var SearchBox = vue.defineComponent({
2538
2331
  "placeholder": _this15.$props.placeholder,
2539
2332
  "autoFocus": _this15.$props.autoFocus,
2540
2333
  "showFocusShortcutsIcon": _this15.$props.showFocusShortcutsIcon,
2541
- "showVoiceSearch": _this15.$props.showVoiceSearch,
2542
- "searchBox": true
2334
+ "showVoiceSearch": _this15.$props.showVoiceSearch
2543
2335
  }, getInputProps({
2544
2336
  value: _this15.$data.currentValue === null ? '' : _this15.$data.currentValue
2545
2337
  }), {
@@ -3273,8 +3065,8 @@ AIConnected.install = function (Vue) {
3273
3065
  // Add componentType for SSR
3274
3066
  AIConnected.componentType = constants.componentTypes.AIAnswer;
3275
3067
 
3276
- var _templateObject$9, _templateObject2$4;
3277
- var HierarchicalMenuList = vueEmotion.styled('ul')(_templateObject$9 || (_templateObject$9 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tlist-style: none;\n\tpadding: 0;\n\tmargin: 0;\n\tmax-height: 0;\n\toverflow: hidden;\n\n\t&.--open {\n\t\tmax-height: 100%;\n\t}\n"])));
3068
+ var _templateObject$8, _templateObject2$4;
3069
+ var HierarchicalMenuList = vueEmotion.styled('ul')(_templateObject$8 || (_templateObject$8 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tlist-style: none;\n\tpadding: 0;\n\tmargin: 0;\n\tmax-height: 0;\n\toverflow: hidden;\n\n\t&.--open {\n\t\tmax-height: 100%;\n\t}\n"])));
3278
3070
  var HierarchicalMenuListItem = vueEmotion.styled('li')(_templateObject2$4 || (_templateObject2$4 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tfont-weight: 400;\n\tline-height: 1.5;\n\tbox-sizing: border-box;\n\n\ta {\n\t\tcolor: #424242;\n\t\ttext-decoration: none;\n\t\tgap: 5px;\n\t\t.--leaf-icon,\n\t\t.--folder-icon {\n\t\t\tline-height: 15px;\n\t\t\tsvg {\n\t\t\t\theight: 15px;\n\t\t\t}\n\t\t}\n\n\t\tinput {\n\t\t\tmargin: 0;\n\t\t\tcursor: pointer;\n\t\t}\n\t}\n\n\t.--switcher-icon {\n\t\ttransition: all 0.2s ease-in;\n\t\tmargin-right: 2px;\n\t}\n\t.--list-child {\n\t\tpadding-left: 1rem;\n\t\tposition: relative;\n\t\t&:before {\n\t\t\theight: 100%;\n\t\t\tcontent: '';\n\t\t\tposition: absolute;\n\t\t\tborder-left: 1px solid #787878;\n\t\t\twidth: 0;\n\t\t\tleft: 19px;\n\t\t\t", ";\n\t\t}\n\n\t\t&.--show-switcher-icon {\n\t\t\tpadding-left: 36px;\n\t\t}\n\t}\n\t.--list-item-label {\n\t\tline-height: 100%;\n\t}\n\t.--list-item-count {\n\t\tmargin-left: 10px;\n\t\tpadding: 0.1rem 0.4rem;\n\t\tfont-size: 0.8rem;\n\t\tcolor: #424242;\n\t\tbackground-color: #dee1e6;\n\t\tborder-radius: 8px;\n\t}\n\t&.-selected-item {\n\t\tfont-weight: 700 !important;\n\t}\n\t&.-expanded-item {\n\t\t& > a {\n\t\t\t& div > .--switcher-icon {\n\t\t\t\ttransform: rotate(90deg);\n\t\t\t}\n\t\t}\n\t}\n\t.--list-item-label-count-wrapper {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\t&:hover {\n\t\t\t.--list-item-count,\n\t\t\t.--list-item-label {\n\t\t\t\tfont-weight: 700;\n\t\t\t}\n\t\t}\n\t}\n"])), function (props) {
3279
3071
  return !props.showLine && "\n\t\t\t\t\tdisplay: none;\n\t\t\t\t";
3280
3072
  });
@@ -32,11 +32,10 @@ require('@appbaseio/analytics');
32
32
  require('url-search-params-polyfill');
33
33
  require('./ReactiveBase.js');
34
34
  require('hotkeys-js');
35
- require('xss');
36
35
  require('remarkable');
37
- var install = require('./install-3821345b.js');
38
- require('./DropDown-dcdaf54f.js');
39
- require('./Input-df30e5fc.js');
36
+ var install = require('./install-e8141489.js');
37
+ require('./DropDown-aef75c14.js');
38
+ require('./Input-56eba499.js');
40
39
  require('compute-scroll-into-view');
41
40
  require('./Container-29f049b2.js');
42
41
  require('vue-highlight-words');
@@ -2,6 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "3.0.0-rc.7.1";
5
+ var version = "3.0.0-rc.9";
6
6
 
7
7
  exports.default = version;