@appbaseio/reactivesearch-vue 3.1.0-rc.1 → 3.3.0

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 (84) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +44252 -23301
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +32 -32
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/{Button-d4da7470.js → Button-f96a0570.js} +14 -7
  6. package/dist/cjs/{ComponentWrapper-b5c78446.js → ComponentWrapper-0334c14b.js} +3 -0
  7. package/dist/cjs/{DropDown-ec31bd3f.js → DropDown-ebe20e81.js} +18 -7
  8. package/dist/cjs/DynamicRangeSlider.js +11 -5
  9. package/dist/cjs/Input-cee51a53.js +97 -0
  10. package/dist/cjs/MultiDropdownList.js +7 -5
  11. package/dist/cjs/MultiList.js +4 -3
  12. package/dist/cjs/MultiRange.js +3 -2
  13. package/dist/cjs/{Pagination-b953a80a.js → Pagination-c53a18ab.js} +2 -2
  14. package/dist/cjs/RangeInput.js +7 -3
  15. package/dist/cjs/RangeSlider.js +7 -3
  16. package/dist/cjs/ReactiveBase.js +4 -4
  17. package/dist/cjs/ReactiveComponent.js +3 -2
  18. package/dist/cjs/ReactiveGoogleMap.js +8 -4
  19. package/dist/cjs/ReactiveList.js +10 -4
  20. package/dist/cjs/ResultCard.js +1 -1
  21. package/dist/cjs/ResultList.js +1 -1
  22. package/dist/cjs/SelectedFilters.js +3 -2
  23. package/dist/cjs/SingleDropdownList.js +7 -5
  24. package/dist/cjs/SingleList.js +4 -3
  25. package/dist/cjs/SingleRange.js +3 -2
  26. package/dist/cjs/ToggleButton.js +5 -3
  27. package/dist/cjs/index.js +14 -7
  28. package/dist/cjs/{install-fd2155c7.js → install-c61d8b86.js} +2062 -229
  29. package/dist/cjs/install.js +13 -7
  30. package/dist/cjs/version.js +1 -1
  31. package/dist/cjs/{vueTypes-1bf00978.js → vueTypes-289a891a.js} +19 -0
  32. package/dist/components/ReactiveBase/ReactiveBase.d.ts +33 -0
  33. package/dist/components/basic/ReactiveComponent.d.ts +30 -0
  34. package/dist/components/basic/ReactiveComponentPrivate.d.ts +10 -0
  35. package/dist/components/basic/SelectedFilters.d.ts +24 -0
  36. package/dist/components/basic/StateProvider.d.ts +12 -0
  37. package/dist/components/list/MultiDropdownList.d.ts +49 -0
  38. package/dist/components/list/MultiList.d.ts +47 -0
  39. package/dist/components/list/SingleDropdownList.d.ts +47 -0
  40. package/dist/components/list/SingleList.d.ts +47 -0
  41. package/dist/components/list/ToggleButton.d.ts +33 -0
  42. package/dist/components/list/TreeList.d.ts +48 -0
  43. package/dist/components/range/DynamicRangeSlider.d.ts +38 -0
  44. package/dist/components/range/MultiRange.d.ts +30 -0
  45. package/dist/components/range/RangeInput.d.ts +30 -0
  46. package/dist/components/range/RangeSlider.d.ts +40 -0
  47. package/dist/components/range/SingleRange.d.ts +28 -0
  48. package/dist/components/result/ReactiveList.d.ts +55 -0
  49. package/dist/components/result/ResultCard.d.ts +10 -0
  50. package/dist/components/result/ResultList.d.ts +11 -0
  51. package/dist/components/search/AIAnswer.d.ts +44 -0
  52. package/dist/components/search/SearchBox.d.ts +111 -0
  53. package/dist/es/{Button-fd869491.js → Button-5c2cf399.js} +14 -7
  54. package/dist/es/{ComponentWrapper-e91c9d43.js → ComponentWrapper-46d04344.js} +3 -0
  55. package/dist/es/{DropDown-74c20431.js → DropDown-36fa9ac5.js} +18 -8
  56. package/dist/es/DynamicRangeSlider.js +12 -6
  57. package/dist/es/Input-437ae439.js +89 -0
  58. package/dist/es/MultiDropdownList.js +7 -5
  59. package/dist/es/MultiList.js +4 -3
  60. package/dist/es/MultiRange.js +3 -2
  61. package/dist/es/{Pagination-c2745bec.js → Pagination-591fdb79.js} +2 -2
  62. package/dist/es/RangeInput.js +7 -3
  63. package/dist/es/RangeSlider.js +8 -4
  64. package/dist/es/ReactiveBase.js +4 -4
  65. package/dist/es/ReactiveComponent.js +3 -2
  66. package/dist/es/ReactiveGoogleMap.js +8 -4
  67. package/dist/es/ReactiveList.js +10 -4
  68. package/dist/es/ResultCard.js +1 -1
  69. package/dist/es/ResultList.js +1 -1
  70. package/dist/es/SelectedFilters.js +3 -2
  71. package/dist/es/SingleDropdownList.js +7 -5
  72. package/dist/es/SingleList.js +4 -3
  73. package/dist/es/SingleRange.js +3 -2
  74. package/dist/es/ToggleButton.js +5 -3
  75. package/dist/es/index.js +14 -8
  76. package/dist/es/{install-db7d6387.js → install-4fe6038c.js} +2067 -235
  77. package/dist/es/install.js +13 -7
  78. package/dist/es/version.js +1 -1
  79. package/dist/es/{vueTypes-f1923c72.js → vueTypes-f503e267.js} +19 -0
  80. package/dist/index.d.ts +40 -0
  81. package/dist/types.ts +238 -0
  82. package/package.json +10 -7
  83. package/dist/cjs/Input-497be42a.js +0 -74
  84. package/dist/es/Input-f7499ef8.js +0 -69
@@ -1,28 +1,33 @@
1
1
  import { helper, Actions, causes } from '@appbaseio/reactivecore';
2
- import { SEARCH_COMPONENTS_MODES, componentTypes, TREELIST_VALUES_PATH_SEPARATOR } from '@appbaseio/reactivecore/lib/utils/constants';
2
+ import { SEARCH_COMPONENTS_MODES, AI_TRIGGER_MODES, AI_LOCAL_CACHE_KEY, componentTypes, AI_ROLES, TREELIST_VALUES_PATH_SEPARATOR } from '@appbaseio/reactivecore/lib/utils/constants';
3
3
  import _transformOn from '@vue/babel-helper-vue-transform-on';
4
- import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-ded08042.js';
5
- import { createVNode, createTextVNode, defineComponent, isVNode, mergeProps, h } from 'vue';
4
+ import { _ as _taggedTemplateLiteralLoose, a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-ded08042.js';
5
+ import { createVNode, createTextVNode, defineComponent, ref, watch, isVNode, mergeProps, h } from 'vue';
6
6
  import VueTypes from 'vue-types';
7
- import { getQueryOptions, suggestionTypes, recLookup, getClassName as getClassName$2, updateCustomQuery as updateCustomQuery$1, updateDefaultQuery as updateDefaultQuery$1, transformTreeListLocalStateIntoQueryComptaibleFormat, isEqual as isEqual$1, transformRawTreeListData, setDeep, getComponent as getComponent$1, getOptionsFromQuery, checkValueChange as checkValueChange$1, getAggsQuery, updateInternalQuery, isFunction as isFunction$1 } from '@appbaseio/reactivecore/lib/utils/helper';
7
+ import { suggestionTypes, getObjectFromLocalStorage, getQueryOptions, featuredSuggestionsActionTypes, getClassName as getClassName$2, setObjectInLocalStorage, recLookup, updateCustomQuery as updateCustomQuery$1, updateDefaultQuery as updateDefaultQuery$1, transformTreeListLocalStateIntoQueryComptaibleFormat, isEqual as isEqual$1, transformRawTreeListData, setDeep, getComponent as getComponent$1, getOptionsFromQuery, checkValueChange as checkValueChange$1, getAggsQuery, updateInternalQuery, isFunction as isFunction$1 } from '@appbaseio/reactivecore/lib/utils/helper';
8
8
  import { styled } from '@appbaseio/vue-emotion';
9
- import { css } from '@emotion/css';
10
- import { B as Button } from './Button-fd869491.js';
11
- import { t as types } from './vueTypes-f1923c72.js';
9
+ import { css, keyframes } from '@emotion/css';
10
+ import { lighten } from 'polished';
11
+ import { B as Button } from './Button-5c2cf399.js';
12
+ import { t as types } from './vueTypes-f503e267.js';
12
13
  import { RLConnected as ReactiveList } from './ReactiveList.js';
13
14
  import { getInternalComponentID } from '@appbaseio/reactivecore/lib/utils/transform';
14
15
  import { g as getComponent, h as hasCustomRenderer, f as decodeHtml, i as isQueryIdentical, u as updateDefaultQuery, j as updateCustomQuery, a as isFunction, k as isEmpty, p as parseFocusShortcuts, l as extractModifierKeysFromFocusShortcuts, c as connect } from './index-104f1dfb.js';
15
- import { C as ComponentWrapper } from './ComponentWrapper-e91c9d43.js';
16
+ import { C as ComponentWrapper } from './ComponentWrapper-46d04344.js';
16
17
  import { P as PreferencesConsumer } from './PreferencesConsumer-0856ed43.js';
17
18
  import { T as Title } from './Title-863dfa42.js';
18
19
  import { L as ListItem } from './ListItem-e3c6acf4.js';
19
20
  import { F as Flex } from './Flex-25792bc3.js';
21
+ import { recordAISessionUsefulness } from '@appbaseio/reactivecore/lib/actions/analytics';
20
22
  import ReactiveBase from './ReactiveBase.js';
21
23
  import hotkeys from 'hotkeys-js';
22
- import { I as IconWrapper, C as CancelSvg, a as IconGroup, D as Downshift, b as InputWrapper } from './DropDown-74c20431.js';
23
- import { n as noSuggestions, s as suggestionsContainer, I as Input, a as suggestions } from './Input-f7499ef8.js';
24
+ import xss from 'xss';
25
+ import { Remarkable } from 'remarkable';
26
+ import { I as IconWrapper, C as CancelSvg, a as IconGroup, B as ButtonIconWrapper, D as Downshift, b as InputWrapper } from './DropDown-36fa9ac5.js';
27
+ import { n as noSuggestions, T as TextArea, I as Input, s as suggestionsContainer, A as Actions$1, a as suggestions, b as searchboxSuggestions } from './Input-437ae439.js';
24
28
  import { C as Container } from './Container-d00219f7.js';
25
29
  import Highlight from 'vue-highlight-words';
30
+ import { fetchAIResponse, createAISession } from '@appbaseio/reactivecore/lib/actions/query';
26
31
  import { replaceDiacritics } from '@appbaseio/reactivecore/lib/utils/suggestions';
27
32
  import { C as Checkbox, R as Radio } from './FormControlList-fe6eaee4.js';
28
33
  import { s as sanitizeObject } from './utils-d7dd4f4e.js';
@@ -44,13 +49,19 @@ import ResultList from './ResultList.js';
44
49
  import StateProvider from './StateProvider.js';
45
50
 
46
51
  var _templateObject;
47
- var InputGroup = styled('div')(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: stretch;\n width: 100%;\n"])));
52
+ var InputGroup = styled('div')(_templateObject || (_templateObject = _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\t", "\n\t};\n"])), function (_ref) {
53
+ var theme = _ref.theme,
54
+ searchBox = _ref.searchBox;
55
+ return searchBox && "background-color: " + (theme.colors.backgroundColor || '#fafafa') + ";\n\t\tcolor: " + (theme.colors.textColor || '#fff') + ";\n\n\t\t&:focus-within {\n\t\t\tbackground-color: " + (theme.colors.backgroundColor || '#fff') + ";\n\t\t}";
56
+ }, function (props) {
57
+ return props.isOpen && "box-shadow: rgb(0 0 0 / 20%) 0px 0px 15px;\n\t\tborder-bottom-left-radius: 0;\n\t\t\tborder-bottom-right-radius: 0;";
58
+ });
48
59
  InputGroup.defaultProps = {
49
60
  className: 'input-group'
50
61
  };
51
62
 
52
63
  var _templateObject$1;
53
- var InputAddon = styled('span')(_templateObject$1 || (_templateObject$1 = _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"])));
64
+ var InputAddon = styled('span')(_templateObject$1 || (_templateObject$1 = _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"])));
54
65
  InputAddon.defaultProps = {
55
66
  className: 'input-addon'
56
67
  };
@@ -86,7 +97,30 @@ var SuggestionItem = {
86
97
  name: 'SuggestionItem',
87
98
  props: {
88
99
  currentValue: types.string,
89
- suggestion: types.any
100
+ suggestion: types.any,
101
+ innerHTML: types.string.isRequired
102
+ },
103
+ data: function data() {
104
+ return {
105
+ isOverflowing: false
106
+ };
107
+ },
108
+ methods: {
109
+ updateOverflowing: function updateOverflowing() {
110
+ if (this.$refs.container && this.$refs.content) {
111
+ var _this$$refs = this.$refs,
112
+ container = _this$$refs.container,
113
+ content = _this$$refs.content;
114
+ var containerWidth = container.offsetWidth;
115
+ var contentWidth = content.scrollWidth;
116
+ this.isOverflowing = contentWidth > containerWidth;
117
+ } else {
118
+ this.isOverflowing = false;
119
+ }
120
+ }
121
+ },
122
+ mounted: function mounted() {
123
+ this.updateOverflowing();
90
124
  },
91
125
  render: function render() {
92
126
  var _this = this;
@@ -102,7 +136,11 @@ var SuggestionItem = {
102
136
  if (label) {
103
137
  // label has highest precedence
104
138
  return typeof label === 'string' ? createVNode("div", {
105
- "class": "trim"
139
+ "ref": "container",
140
+ "class": "trim",
141
+ "title": this.isOverflowing ? label : ''
142
+ }, [createVNode("div", {
143
+ "ref": "content"
106
144
  }, [(_category ? false : isPredictiveSuggestion
107
145
  // eslint-disable-next-line
108
146
  || !!_suggestion_type) ? createVNode(PredictiveSuggestion, {
@@ -112,7 +150,7 @@ var SuggestionItem = {
112
150
  "textToHighlight": label,
113
151
  "autoEscape": true,
114
152
  "highlightStyle": highlightStyle
115
- }, null)]) : label;
153
+ }, null)])]) : label;
116
154
  }
117
155
  if (title || image || description) {
118
156
  return createVNode(Flex, {
@@ -774,9 +812,345 @@ var _templateObject$4, _templateObject2;
774
812
  var TagsContainer = styled('div')(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tmargin-top: 10px;\n\twidth: 100%;\n"])));
775
813
  var TagItem = styled('span')(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n\tcursor: default;\n\tbox-sizing: border-box;\n\tmargin: 0 4px 4px 0;\n\tcolor: #000000d9;\n\tfont-size: 14px;\n\tfont-variant: tabular-nums;\n\tline-height: 1.5715;\n\tlist-style: none;\n\tfont-feature-settings: 'tnum';\n\tdisplay: inline-block;\n\theight: auto;\n\tpadding: 0 2px 0 7px;\n\tfont-size: 12px;\n\tline-height: 22px;\n\twhite-space: nowrap;\n\tbackground: #fafafa;\n\tborder: 1px solid #d9d9d9;\n\tborder-radius: 2px;\n\topacity: 1;\n\ttransition: all 0.3s;\n\n\tspan.close-icon {\n\t\tsvg {\n\t\t\tcursor: pointer;\n\t\t\theight: 15px;\n\t\t\tposition: relative;\n\t\t\ttop: 4px;\n\t\t\tfill: #262626;\n\t\t}\n\t}\n"])));
776
814
 
815
+ var _templateObject$5;
816
+ var AutosuggestFooterContainer = styled('div')(_templateObject$5 || (_templateObject$5 = _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"])));
817
+
818
+ var _templateObject$6, _templateObject2$1, _templateObject3;
819
+ var skeletonAnimation = keyframes(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteralLoose(["\n 0% {\n background-position: 100% 0;\n }\n 100% {\n background-position: -200% 0;\n }\n"])));
820
+ var SkeletonLoader = styled('div')(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n"])));
821
+ var SkeletonLine = styled('div')(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\theight: 20px;\n\tbackground: linear-gradient(\n\t\t90deg,\n\t\trgba(220, 220, 220, 0.5) 25%,\n\t\trgba(240, 240, 240, 0.9) 50%,\n\t\trgba(220, 220, 220, 0.5) 75%\n\t);\n\tbackground-size: 200% 100%;\n\tanimation: ", " 1.5s infinite;\n"])), skeletonAnimation);
822
+ var HorizontalSkeletonLoader = defineComponent({
823
+ name: 'HorizontalSkeletonLoader',
824
+ render: function render() {
825
+ return createVNode(SkeletonLoader, null, {
826
+ "default": function _default() {
827
+ return [createVNode(SkeletonLine, null, null), createVNode(SkeletonLine, null, null), createVNode(SkeletonLine, null, null), createVNode(SkeletonLine, null, null)];
828
+ }
829
+ });
830
+ }
831
+ });
832
+
833
+ var _templateObject$7, _templateObject2$2, _templateObject3$1, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
834
+ var Chatbox = styled('div')(_templateObject$7 || (_templateObject$7 = _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) {
835
+ return props.theme && props.theme.colors && props.theme.colors.backgroundColor ? lighten(0.1, props.theme.colors.backgroundColor) : '#fff';
836
+ });
837
+ var ChatContainer = styled('div')(_templateObject2$2 || (_templateObject2$2 = _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) {
838
+ return props.showInput ? 'bottom: 48px;' : '';
839
+ }, function (props) {
840
+ return props.theme && props.theme.colors && props.theme.colors.backgroundColor ? props.theme.colors.backgroundColor : '#fff';
841
+ }, function (props) {
842
+ return props.theme && props.theme.colors && props.theme.colors.backgroundColor ? props.theme.colors.backgroundColor : '#fff';
843
+ }, function (props) {
844
+ return props.showInput ? ".--ai-answer-feedback-container {\n\t\tmargin-top: 15px;\n\t\tmargin-bottom: -10px;\n\t}" : ".--ai-answer-feedback-container {\n\t\tmargin-top: 4px;\n\t}";
845
+ });
846
+ var MessagesContainer = styled('div')(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteralLoose(["\n\tmax-height: 400px;\n overflow-y: auto;\n\tpadding: 10px;\n\tdisplay: flex;\n\tflex-direction: column;\n\tmin-height: 200px;\n\n}};\n"])));
847
+ var typingDots = keyframes(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n 0% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(-70%);\n }\n 100% {\n transform: translateY(0);\n }\n"])));
848
+ var TypingIndicator = styled('div')(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tmargin: 5px !important;\n"])));
849
+ var TypingDot = styled('div')(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n\twidth: 6px;\n\theight: 6px;\n\tbackground-color: ", ";\n\tborder-radius: 50%;\n\tmargin: 0 2px !important;\n\tanimation: ", " 1s infinite;\n\t&:nth-child(2) {\n\t\tanimation-delay: 0.2s;\n\t}\n\t&:nth-child(3) {\n\t\tanimation-delay: 0.4s;\n\t}\n"])), function (props) {
850
+ var finalColor;
851
+ if (props.isSender) {
852
+ finalColor = props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor;
853
+ } else {
854
+ finalColor = props.themePreset !== 'dark' ? props.theme.colors.borderColor : props.theme.colors.textColor;
855
+ }
856
+ return finalColor;
857
+ }, typingDots);
858
+ var resetCSS = function resetCSS(props) {
859
+ return "\n\thtml,\n\tbody,\n\tdiv,\n\tspan,\n\tapplet,\n\tobject,\n\tiframe,\n\th1,\n\th2,\n\th3,\n\th4,\n\th5,\n\th6,\n\tp,\n\tblockquote,\n\tpre,\n\ta,\n\tabbr,\n\tacronym,\n\taddress,\n\tbig,\n\tcite,\n\tcode,\n\tdel,\n\tdfn,\n\tem,\n\timg,\n\tins,\n\tkbd,\n\tq,\n\ts,\n\tsamp,\n\tsmall,\n\tstrike,\n\tstrong,\n\tsub,\n\tsup,\n\ttt,\n\tvar,\n\tb,\n\tu,\n\ti,\n\tcenter,\n\tdl,\n\tdt,\n\tdd,\n\tol,\n\tul,\n\tli,\n\tfieldset,\n\tform,\n\tlabel,\n\tlegend,\n\ttable,\n\tcaption,\n\ttbody,\n\ttfoot,\n\tthead,\n\ttr,\n\tth,\n\ttd,\n\tarticle,\n\taside,\n\tcanvas,\n\tdetails,\n\tembed,\n\tfigure,\n\tfigcaption,\n\tfooter,\n\theader,\n\thgroup,\n\tmenu,\n\tnav,\n\toutput,\n\truby,\n\tsection,\n\tsummary,\n\ttime,\n\tmark,\n\taudio,\n\tvideo {\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\tborder: 0;\n\t\tfont-size: 100%;\n\t\tfont: inherit;\n\t\tvertical-align: baseline;\n\t\toverflow-wrap: anywhere;\n\t}\n\tpre {\n\t\tmargin: 10px auto;\n\t\twhite-space: pre-wrap;\n\n\t}\n\ttable {\n\t\tmargin: 10px auto;\n\t\tborder-collapse: collapse;\n\t\tborder-spacing: 0;\n\t}\n\ttr {\n\t\tborder-bottom: 1px solid #ccc;\n\t}\n\tth,\n\ttd {\n\t\ttext-align: left;\n\t\tpadding: 4px;\n\t\tborder: 1px solid;\n\t\tborder-collapse: collapse;\n\t}\n\tpre,\n\tcode {\n\t\tpadding: 0.6em 0.4em;\n\t\tbackground: " + (
860
+ // eslint-disable-next-line no-nested-ternary
861
+ props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryColor : props.theme.colors.borderColor : props.theme.colors.borderColor) + ";\n\n\t}\n\n\tpre{\n\t\tcolor: " + (
862
+ // eslint-disable-next-line no-nested-ternary
863
+ props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor : props.theme.colors.primaryTextColor) + ";}\n\n\tcode {\n\t\tline-height: normal;\n\n\t\tcolor: " + (
864
+ // eslint-disable-next-line no-nested-ternary
865
+ 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: " + (
866
+ // eslint-disable-next-line no-nested-ternary
867
+ 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";
868
+ };
869
+ var messageBGColor = function messageBGColor(props) {
870
+ var finalBGColor;
871
+ if (props.isSender) {
872
+ finalBGColor = props.themePreset !== 'dark' ? props.theme.colors.primaryColor : props.theme.colors.borderColor;
873
+ } else {
874
+ finalBGColor = props.themePreset !== 'dark' ? lighten(0.53, props.theme.colors.borderColor) : props.theme.colors.backgroundColor;
875
+ }
876
+ return finalBGColor;
877
+ };
878
+ var Message = styled('div')(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n\tbackground-color: ", ";\n\tcolor: ", ";\n\tborder: 1px solid\n\t\t", ";\n\tpadding: 10px;\n\tborder-radius: 7px;\n\tmargin-bottom: 10px;\n\tmax-width: 80%;\n\talign-self: ", ";\n\tdisplay: inline-block;\n\tposition: relative;\n\toverflow-wrap: anywhere;\n\t", "\n"])), function (props) {
879
+ return messageBGColor(props);
880
+ }, function (props) {
881
+ var finalColor;
882
+ if (props.isSender) {
883
+ finalColor = props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor;
884
+ } else {
885
+ finalColor = props.themePreset !== 'dark' ? props.theme.colors.borderColor : props.theme.colors.textColor;
886
+ }
887
+ return finalColor;
888
+ }, function (props) {
889
+ return props.themePreset === 'dark' ? 'currentColor' : messageBGColor(props);
890
+ }, function (props) {
891
+ return props.isSender ? 'flex-end' : 'flex-start';
892
+ }, function (props) {
893
+ return resetCSS(props);
894
+ });
895
+ var MessageInputContainer = styled('form')(_templateObject8 || (_templateObject8 = _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"])));
896
+ var MessageInput = styled(TextArea)(_templateObject9 || (_templateObject9 = _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) {
897
+ return props.themePreset === 'dark' ? props.theme.colors.borderColor : '#fff';
898
+ }, function (props) {
899
+ return props.themePreset === 'dark' ? props.theme.colors.titleColor : props.theme.colors.textColor;
900
+ }, function (_ref) {
901
+ var enterButton = _ref.enterButton;
902
+ return enterButton && "\n\t\t border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\t";
903
+ });
904
+ var SendButton = styled(Button)(_templateObject10 || (_templateObject10 = _taggedTemplateLiteralLoose(["\n\tborder: none;\n\tcolor: #ffffff;\n\tcursor: pointer;\n\tfont-size: 16px;\n\tmargin-left: 8px;\n\toutline: none;\n\tpadding: 10px;\n\ttext-align: center;\n\n\t&:disabled {\n\t\tcursor: not-allowed;\n\t}\n"])));
905
+ var AIFeedbackContainer = styled('div')(_templateObject11 || (_templateObject11 = _taggedTemplateLiteralLoose(["\n\t.--feedback-svgs-wrapper {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: flex-end;\n\t\tgap: 5px;\n\n\t\tsvg {\n\t\t\tcursor: pointer;\n\t\t\ttransition: all ease-in 0.1s;\n\t\t\t&.selected {\n\t\t\t\ttransform: scale(1.1);\n\t\t\t\tcursor: default;\n\t\t\t}\n\n\t\t\t&:hover {\n\t\t\t\ttransform: scale(1.1);\n\t\t\t}\n\t\t}\n\t}\n\n\t.--feedback-input-wrapper {\n\t\tdisplay: flex;\n\t\tgap: 7px;\n\t}\n"])));
906
+
907
+ var _templateObject$8, _templateObject2$3, _templateObject3$2, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7$1;
908
+ var fadeInFromBottom = keyframes(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteralLoose(["\n 0% {\n opacity: 0;\n transform: translateY(20px);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n"])));
909
+ var fadeInFromTop = keyframes(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteralLoose(["\n 0% {\n opacity: 0;\n transform: translateY(-20px);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n"])));
910
+ var SearchBoxAISection = styled('div')(_templateObject3$2 || (_templateObject3$2 = _taggedTemplateLiteralLoose(["\n\tpadding: 10px;\n\tborder-radius: 4px;\n\tmin-height: 200px;\n\tpadding-top: 20px;\n\tposition: relative;\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\t.--ai-answer-error-container {\n\t\tposition: absolute;\n\t\ttop: 50%;\n\t\tleft: 50%;\n\t\ttransform: translate(-50%, -50%);\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\tgap: 10px;\n\t\t}\n\t}\n"])), function (_ref) {
911
+ var themePreset = _ref.themePreset,
912
+ theme = _ref.theme;
913
+ return themePreset === 'dark' ? '#424242' : theme.colors.backgroundColor;
914
+ }, function (_ref2) {
915
+ var theme = _ref2.theme;
916
+ return theme.colors.textColor;
917
+ });
918
+ var Question = styled('div')(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteralLoose(["\n\tfont-weight: bold;\n\tmargin-bottom: 5px;\n\tanimation: ", " 0.5s ease-out;\n"])), fadeInFromTop);
919
+ var Answer = styled('div')(_templateObject5$1 || (_templateObject5$1 = _taggedTemplateLiteralLoose(["\n\t", "\n\tposition: relative;\n\tmargin-bottom: 5px;\n\tmin-height: 100px;\n\toverflow: auto;\n\twhite-space: pre-wrap;\n\tpre {\n\t\twhite-space: pre-wrap;\n\t}\n\tcode,\n\tpre {\n\t\tdisplay: revert;\n\t}\n"])), function (props) {
920
+ return resetCSS(props);
921
+ });
922
+ var Footer = styled('div')(_templateObject6$1 || (_templateObject6$1 = _taggedTemplateLiteralLoose(["\n\tcolor: #777;\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 1rem;\n\tflex-wrap: wrap;\n\tanimation: ", " 0.5s ease-out;\n\tpadding: 10px 0;\n\tbackground: white;\n\tbackground-color: ", ";\n\tcolor: ", ";\n"])), fadeInFromBottom, function (_ref3) {
923
+ var themePreset = _ref3.themePreset,
924
+ theme = _ref3.theme;
925
+ return themePreset === 'dark' ? '#424242' : theme.colors.backgroundColor;
926
+ }, function (_ref4) {
927
+ var theme = _ref4.theme;
928
+ return theme.colors.textColor;
929
+ });
930
+ var SourceTags = styled('div')(_templateObject7$1 || (_templateObject7$1 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tgap: 8px;\n\tflex-wrap: wrap;\n\t.--ai-source-tag {\n\t\tdisplay: inline-block;\n\t\tmax-width: 200px;\n\t\twhite-space: nowrap;\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t}\n"])));
931
+
932
+ var ThumbsUpSvg = {
933
+ name: 'ThumbsUpSvg',
934
+ props: ['clickHandler', 'className'],
935
+ render: function render() {
936
+ return createVNode("svg", {
937
+ "stroke": "currentColor",
938
+ "fill": "none",
939
+ "strokeWidth": "2",
940
+ "viewBox": "0 0 24 24",
941
+ "strokeLinecap": "round",
942
+ "strokeLinejoin": "round",
943
+ "class": this.$props.className,
944
+ "height": "1em",
945
+ "width": "1em",
946
+ "xmlns": "http://www.w3.org/2000/svg",
947
+ "onClick": this.$props.clickHandler
948
+ }, [createVNode("path", {
949
+ "d": "M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"
950
+ }, null)]);
951
+ }
952
+ };
953
+
954
+ var ThumbsDownSvg = {
955
+ name: 'ThumbsDownSvg',
956
+ props: ['clickHandler', 'className'],
957
+ render: function render() {
958
+ return createVNode("svg", {
959
+ "stroke": "currentColor",
960
+ "fill": "none",
961
+ "strokeWidth": "2",
962
+ "viewBox": "0 0 24 24",
963
+ "strokeLinecap": "round",
964
+ "strokeLinejoin": "round",
965
+ "class": this.$props.className,
966
+ "height": "1em",
967
+ "width": "1em",
968
+ "xmlns": "http://www.w3.org/2000/svg",
969
+ "onClick": this.$props.clickHandler
970
+ }, [createVNode("path", {
971
+ "d": "M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17"
972
+ }, null), ' ']);
973
+ }
974
+ };
975
+
976
+ var AIFeedback = defineComponent({
977
+ name: 'FeedbackComponent',
978
+ props: {
979
+ onFeedbackSubmit: {
980
+ type: Function,
981
+ "default": function _default() {}
982
+ },
983
+ hideUI: {
984
+ type: Boolean,
985
+ "default": false
986
+ },
987
+ overrideState: {
988
+ type: Object,
989
+ "default": function _default() {
990
+ return {};
991
+ }
992
+ }
993
+ },
994
+ setup: function setup(props, _ref) {
995
+ var emit = _ref.emit;
996
+ var showInput = ref(false);
997
+ var feedbackType = ref(null);
998
+ var feedbackText = ref('');
999
+ var feedbackRecorded = ref(false);
1000
+ var handleButtonClick = function handleButtonClick(type) {
1001
+ if (feedbackType.value === type) {
1002
+ feedbackType.value = null;
1003
+ showInput.value = false;
1004
+ } else {
1005
+ feedbackType.value = type;
1006
+ showInput.value = true;
1007
+ }
1008
+ };
1009
+ var handleInputChange = function handleInputChange(e) {
1010
+ feedbackText.value = e.target.value;
1011
+ };
1012
+ var handleSubmit = function handleSubmit() {
1013
+ emit('feedback-submit', feedbackType.value === 'positive', feedbackText.value);
1014
+ feedbackText.value = '';
1015
+ showInput.value = false;
1016
+ feedbackRecorded.value = true;
1017
+ };
1018
+ var handleCancel = function handleCancel() {
1019
+ feedbackType.value = null;
1020
+ feedbackText.value = '';
1021
+ showInput.value = false;
1022
+ };
1023
+ watch(function () {
1024
+ return props.overrideState;
1025
+ }, function (newValue) {
1026
+ if (newValue && newValue.isRecorded) {
1027
+ feedbackRecorded.value = true;
1028
+ feedbackType.value = newValue.feedbackType || 'positive';
1029
+ }
1030
+ });
1031
+ if (props.overrideState && props.overrideState.isRecorded) {
1032
+ feedbackRecorded.value = true;
1033
+ feedbackType.value = props.overrideState.feedbackType || 'positive';
1034
+ }
1035
+ return {
1036
+ showInput: showInput,
1037
+ feedbackType: feedbackType,
1038
+ feedbackText: feedbackText,
1039
+ feedbackRecorded: feedbackRecorded,
1040
+ handleButtonClick: handleButtonClick,
1041
+ handleInputChange: handleInputChange,
1042
+ handleSubmit: handleSubmit,
1043
+ handleCancel: handleCancel
1044
+ };
1045
+ },
1046
+ render: function render() {
1047
+ var _this = this;
1048
+ if (this.$props.hideUI) {
1049
+ return null;
1050
+ }
1051
+ if (this.feedbackRecorded) {
1052
+ return createVNode(AIFeedbackContainer, null, {
1053
+ "default": function _default() {
1054
+ return [createVNode("div", {
1055
+ "class": "--feedback-svgs-wrapper"
1056
+ }, [_this.feedbackType === 'positive' ? createVNode(ThumbsUpSvg, {
1057
+ "class": "selected"
1058
+ }, null) : createVNode(ThumbsDownSvg, {
1059
+ "class": "selected"
1060
+ }, null)])];
1061
+ }
1062
+ });
1063
+ }
1064
+ return createVNode(AIFeedbackContainer, null, {
1065
+ "default": function _default() {
1066
+ return [!_this.showInput && createVNode("div", {
1067
+ "class": "--feedback-svgs-wrapper"
1068
+ }, [createVNode(ThumbsUpSvg, {
1069
+ "class": _this.feedbackType === 'positive' ? 'selected' : '',
1070
+ "onClick": function onClick() {
1071
+ return _this.handleButtonClick('positive');
1072
+ }
1073
+ }, null), createVNode(ThumbsDownSvg, {
1074
+ "class": _this.feedbackType === 'negative' ? 'selected' : '',
1075
+ "onClick": function onClick() {
1076
+ return _this.handleButtonClick('negative');
1077
+ }
1078
+ }, null)]), _this.showInput && createVNode("div", {
1079
+ "class": "--feedback-input-wrapper"
1080
+ }, [createVNode(Input, {
1081
+ "show": _this.showInput,
1082
+ "placeholder": _this.feedbackType === 'positive' ? 'What do you like about the response?' : 'What was the issue with the response? How can it be improved?',
1083
+ "value": _this.feedbackText,
1084
+ "onInput": _this.handleInputChange
1085
+ }, null), createVNode(Button, {
1086
+ "primary": true,
1087
+ "onClick": _this.handleSubmit
1088
+ }, {
1089
+ "default": function _default() {
1090
+ return [createTextVNode("Submit")];
1091
+ }
1092
+ }), createVNode(Button, {
1093
+ "onClick": _this.handleCancel
1094
+ }, {
1095
+ "default": function _default() {
1096
+ return [createTextVNode("Cancel")];
1097
+ }
1098
+ })])];
1099
+ }
1100
+ });
1101
+ }
1102
+ });
1103
+
1104
+ // eslint-disable-next-line import/prefer-default-export
1105
+ var innerText = function innerText(jsx) {
1106
+ // Empty
1107
+ if (jsx === null || typeof jsx === 'boolean' || typeof jsx === 'undefined') {
1108
+ return '';
1109
+ }
1110
+
1111
+ // Numeric children.
1112
+ if (typeof jsx === 'number') {
1113
+ return jsx.toString();
1114
+ }
1115
+
1116
+ // String literals.
1117
+ if (typeof jsx === 'string') {
1118
+ return jsx;
1119
+ }
1120
+
1121
+ // Array of JSX.
1122
+ if (Array.isArray(jsx)) {
1123
+ // eslint-disable-next-line no-use-before-define
1124
+ return jsx.reduce(reduceJsxToString, '');
1125
+ }
1126
+
1127
+ // Children prop.
1128
+ if (Object.prototype.hasOwnProperty.call(jsx, 'children')) {
1129
+ return innerText(jsx.children);
1130
+ }
1131
+
1132
+ // Default
1133
+ return '';
1134
+ };
1135
+ innerText["default"] = innerText;
1136
+ function reduceJsxToString(previous, current) {
1137
+ return previous + innerText(current);
1138
+ }
1139
+
1140
+ var _excluded = ["_source"];
777
1141
  function _isSlot(s) {
778
1142
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
779
1143
  }
1144
+ var md = new Remarkable();
1145
+ md.set({
1146
+ html: true,
1147
+ breaks: true,
1148
+ xhtmlOut: true,
1149
+ linkify: true,
1150
+ linkTarget: '_blank'
1151
+ });
1152
+ var _dropdownULRef = 'dropdownULRef';
1153
+ var _inputGroupRef = 'inputGroupRef';
780
1154
  var updateQuery = Actions.updateQuery,
781
1155
  setCustomQuery = Actions.setCustomQuery,
782
1156
  setDefaultQuery = Actions.setDefaultQuery,
@@ -797,7 +1171,14 @@ var SearchBox = defineComponent({
797
1171
  currentValue: '',
798
1172
  selectedTags: [],
799
1173
  isOpen: false,
800
- normalizedSuggestions: []
1174
+ normalizedSuggestions: [],
1175
+ showAIScreen: false,
1176
+ showAIScreenFooter: false,
1177
+ showFeedbackComponent: false,
1178
+ feedbackState: null,
1179
+ faqAnswer: '',
1180
+ faqQuestion: '',
1181
+ initialHits: null
801
1182
  };
802
1183
  this.internalComponent = props.componentId + "__internal";
803
1184
  return this.__state;
@@ -833,11 +1214,70 @@ var SearchBox = defineComponent({
833
1214
  }
834
1215
  },
835
1216
  computed: {
1217
+ currentTriggerMode: function currentTriggerMode() {
1218
+ return this.$props.AIUIConfig && this.$props.AIUIConfig.triggerOn || AI_TRIGGER_MODES.MANUAL;
1219
+ },
836
1220
  hasCustomRenderer: function hasCustomRenderer$1() {
837
1221
  return hasCustomRenderer(this);
838
1222
  },
839
1223
  stats: function stats() {
840
1224
  return getResultStats(this);
1225
+ },
1226
+ mergedAIQuestion: function mergedAIQuestion() {
1227
+ return this.faqQuestion || this.AIResponse && this.AIResponse.response && this.AIResponse.response.question;
1228
+ },
1229
+ mergedAIAnswer: function mergedAIAnswer() {
1230
+ return this.faqAnswer || this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text;
1231
+ },
1232
+ parsedSuggestions: function parsedSuggestions() {
1233
+ var _this = this;
1234
+ var suggestionsArray = [];
1235
+ if (Array.isArray(this.suggestions) && this.suggestions.length) {
1236
+ suggestionsArray = [].concat(withClickIds(this.suggestions));
1237
+ }
1238
+ if (this.renderTriggerMessage() && this.currentValue) {
1239
+ suggestionsArray.unshift({
1240
+ label: this.renderTriggerMessage(),
1241
+ value: 'AI_TRIGGER_MESSAGE',
1242
+ _suggestion_type: '_internal_a_i_trigger'
1243
+ });
1244
+ }
1245
+ suggestionsArray = suggestionsArray.map(function (s) {
1246
+ if (s.sectionId) {
1247
+ return s;
1248
+ }
1249
+ return _extends({}, s, {
1250
+ sectionId: s._suggestion_type
1251
+ });
1252
+ }).map(function (suggestion) {
1253
+ if (suggestion._suggestion_type === suggestionTypes.Document) {
1254
+ // Document suggestions don't have a meaningful label and value
1255
+ var newSuggestion = _extends({}, suggestion);
1256
+ newSuggestion.label = 'For document suggestions, please implement a renderItem method to display label.';
1257
+ var renderItem = _this.$slots.renderItem || _this.$props.renderItem;
1258
+ if (typeof renderItem === 'function') {
1259
+ var jsxEl = renderItem(newSuggestion);
1260
+ var innerValue = innerText(jsxEl);
1261
+ newSuggestion.value = xss(innerValue);
1262
+ }
1263
+ return newSuggestion;
1264
+ }
1265
+ return suggestion;
1266
+ });
1267
+ var sectionsAccumulated = [];
1268
+ var sectionisedSuggestions = suggestionsArray.reduce(function (acc, d, currentIndex) {
1269
+ if (sectionsAccumulated.includes(d.sectionId)) return acc;
1270
+ if (d.sectionId) {
1271
+ acc[currentIndex] = suggestionsArray.filter(function (g) {
1272
+ return g.sectionId === d.sectionId;
1273
+ });
1274
+ sectionsAccumulated.push(d.sectionId);
1275
+ } else {
1276
+ acc[currentIndex] = d;
1277
+ }
1278
+ return acc;
1279
+ }, {});
1280
+ return Object.values(sectionisedSuggestions);
841
1281
  }
842
1282
  },
843
1283
  props: {
@@ -847,6 +1287,7 @@ var SearchBox = defineComponent({
847
1287
  className: VueTypes.string.def(''),
848
1288
  clearIcon: types.children,
849
1289
  componentId: types.stringRequired,
1290
+ compoundClause: types.compoundClause,
850
1291
  customHighlight: types.func,
851
1292
  customQuery: types.func,
852
1293
  defaultQuery: types.func,
@@ -869,6 +1310,17 @@ var SearchBox = defineComponent({
869
1310
  enableQuerySuggestions: VueTypes.bool.def(false),
870
1311
  enablePopularSuggestions: VueTypes.bool.def(false),
871
1312
  enableRecentSuggestions: VueTypes.bool.def(false),
1313
+ enableFAQSuggestions: VueTypes.bool.def(false),
1314
+ enableDocumentSuggestions: VueTypes.bool.def(false),
1315
+ documentSuggestionsConfig: VueTypes.shape({
1316
+ size: VueTypes.number,
1317
+ from: VueTypes.number,
1318
+ maxChars: VueTypes.number
1319
+ }),
1320
+ FAQSuggestionsConfig: VueTypes.shape({
1321
+ sectionLabel: VueTypes.string,
1322
+ size: VueTypes.number
1323
+ }),
872
1324
  fieldWeights: types.fieldWeights,
873
1325
  filterLabel: types.string,
874
1326
  fuzziness: types.fuzziness,
@@ -904,12 +1356,20 @@ var SearchBox = defineComponent({
904
1356
  distinctFieldConfig: types.props,
905
1357
  //
906
1358
  focusShortcuts: VueTypes.arrayOf(VueTypes.oneOfType([VueTypes.string, VueTypes.number])).def(['/']),
1359
+ showFocusShortcutsIcon: VueTypes.bool.def(true),
907
1360
  addonBefore: VueTypes.any,
908
1361
  addonAfter: VueTypes.any,
1362
+ showSuggestionsFooter: VueTypes.bool.def(true),
909
1363
  expandSuggestionsContainer: VueTypes.bool.def(true),
1364
+ renderSuggestionsFooter: VueTypes.func,
910
1365
  index: VueTypes.string,
911
1366
  popularSuggestionsConfig: VueTypes.object,
912
1367
  recentSuggestionsConfig: VueTypes.object,
1368
+ featuredSuggestionsConfig: VueTypes.shape({
1369
+ maxSuggestionsPerSection: VueTypes.number,
1370
+ sectionsOrder: VueTypes.arrayOf(VueTypes.string)
1371
+ }),
1372
+ customEvents: VueTypes.object,
913
1373
  applyStopwords: VueTypes.bool,
914
1374
  customStopwords: types.stringArray,
915
1375
  onData: types.func,
@@ -919,12 +1379,53 @@ var SearchBox = defineComponent({
919
1379
  mode: VueTypes.oneOf(['select', 'tag']).def('select'),
920
1380
  renderSelectedTags: VueTypes.any,
921
1381
  searchboxId: VueTypes.string,
922
- endpoint: types.endpointConfig
1382
+ endpoint: types.endpointConfig,
1383
+ enableAI: VueTypes.bool.def(false),
1384
+ AIConfig: types.AIConfig,
1385
+ AIUIConfig: types.AIUIConfig
923
1386
  },
924
1387
  mounted: function mounted() {
1388
+ var _this2 = this;
925
1389
  this.listenForFocusShortcuts();
1390
+ var dropdownEle = this.$refs[_dropdownULRef];
1391
+ if (dropdownEle) {
1392
+ var handleScroll = function handleScroll() {
1393
+ var scrollTop = dropdownEle.scrollTop;
1394
+ _this2.lastScrollTop = scrollTop;
1395
+ if (scrollTop < _this2.lastScrollTop) {
1396
+ // User is scrolling up
1397
+ clearInterval(_this2.scrollTimerRef);
1398
+ _this2.isUserScrolling = true;
1399
+ }
1400
+ // Update lastScrollTop with the current scroll position
1401
+ _this2.lastScrollTop = scrollTop;
1402
+ };
1403
+ dropdownEle.addEventListener('scroll', handleScroll);
1404
+ }
1405
+ },
1406
+ updated: function updated() {
1407
+ if (this.$props.mode === SEARCH_COMPONENTS_MODES.SELECT && this.$options.isTagsMode === true) {
1408
+ this.$options.isTagsMode = false;
1409
+ this.selectedTags = [];
1410
+ } else if (this.$props.mode === SEARCH_COMPONENTS_MODES.TAG && this.$options.isTagsMode === false) {
1411
+ this.$options.isTagsMode = true;
1412
+ }
926
1413
  },
927
1414
  watch: {
1415
+ AIResponse: function AIResponse(newVal) {
1416
+ if (newVal) {
1417
+ if (this.$props.AIUIConfig && this.$props.AIUIConfig.showSourceDocuments && newVal.response && newVal.response.answer && Array.isArray(newVal.response.answer.documentIds)) {
1418
+ this.sourceDocIds = newVal.response.answer.documentIds;
1419
+ var localCache = getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) && getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY)[this.$props.componentId];
1420
+ if (localCache && localCache.meta && localCache.meta.hits && localCache.meta.hits.hits) {
1421
+ this.initialHits = localCache.meta.hits.hits;
1422
+ }
1423
+ if (!this.showAIScreenFooter) {
1424
+ this.showAIScreenFooter = true;
1425
+ }
1426
+ }
1427
+ }
1428
+ },
928
1429
  dataField: function dataField(newVal, oldVal) {
929
1430
  if (!isEqual(newVal, oldVal)) {
930
1431
  this.triggerCustomQuery(this.$data.currentValue);
@@ -965,6 +1466,7 @@ var SearchBox = defineComponent({
965
1466
  suggestionsList = [].concat(withClickIds(this.$props.defaultSuggestions));
966
1467
  }
967
1468
  this.normalizedSuggestions = suggestionsList;
1469
+ this.handleTextAreaHeightChange();
968
1470
  },
969
1471
  selectedValue: function selectedValue(newVal, oldVal) {
970
1472
  if (!isEqual(newVal, oldVal) && (this.$options.isTagsMode ? !isEqual(this.$data.selectedTags, newVal) : this.$data.currentValue !== newVal)) {
@@ -980,7 +1482,11 @@ var SearchBox = defineComponent({
980
1482
  if (this.$options.isTagsMode) {
981
1483
  cause = causes.SUGGESTION_SELECT;
982
1484
  }
983
- this.setValue(newVal || '', true, this.$props, cause);
1485
+ if (this.$props.value === undefined) {
1486
+ this.setValue(newVal, newVal === '', this.$props, cause, false);
1487
+ } else {
1488
+ this.setValue(newVal || '', true, this.$props, cause);
1489
+ }
984
1490
  }
985
1491
  },
986
1492
  focusShortcuts: function focusShortcuts() {
@@ -994,6 +1500,9 @@ var SearchBox = defineComponent({
994
1500
  loading: this.isLoading,
995
1501
  error: this.isError
996
1502
  });
1503
+ if (newVal && newVal.hits && newVal.hits.hits) {
1504
+ this.initialHits = newVal.hits.hits;
1505
+ }
997
1506
  },
998
1507
  aggregationData: function aggregationData(newVal) {
999
1508
  this.$emit('on-data', {
@@ -1026,9 +1535,64 @@ var SearchBox = defineComponent({
1026
1535
  if (!isEqual(newVal, oldVal)) {
1027
1536
  this.handleTextChange = _debounce(this.handleText, newVal);
1028
1537
  }
1538
+ },
1539
+ isAITyping: function isAITyping(newVal, oldVal) {
1540
+ var _this3 = this;
1541
+ var scrollAIContainer = function scrollAIContainer() {
1542
+ if (_this3.isUserScrolling) return;
1543
+ var dropdownEle = _this3.$refs[_dropdownULRef];
1544
+ if (dropdownEle) {
1545
+ dropdownEle.scrollTo({
1546
+ top: dropdownEle.scrollHeight,
1547
+ behavior: 'smooth'
1548
+ });
1549
+ }
1550
+ };
1551
+ if (!newVal && oldVal) {
1552
+ clearInterval(this.scrollTimerRef);
1553
+ this.showAIScreenFooter = true;
1554
+ if (this.$props.AIUIConfig && typeof this.$props.AIUIConfig.showFeedback === 'boolean' ? this.$props.AIUIConfig.showFeedback : true) {
1555
+ this.showFeedbackComponent = true;
1556
+ }
1557
+ setTimeout(function () {
1558
+ scrollAIContainer();
1559
+ }, 500);
1560
+ } else if (newVal) {
1561
+ this.scrollTimerRef = setInterval(function () {
1562
+ scrollAIContainer();
1563
+ }, 2000);
1564
+ }
1565
+ },
1566
+ showAIScreen: function showAIScreen(newVal) {
1567
+ if (newVal) {
1568
+ var _this$$refs;
1569
+ if ((_this$$refs = this.$refs) != null && _this$$refs[this.$props.innerRef] && this.$refs[this.$props.innerRef].$el) {
1570
+ this.$refs[this.$props.innerRef].$el.blur();
1571
+ }
1572
+ } else {
1573
+ this.feedbackState = null;
1574
+ this.showFeedbackComponent = false;
1575
+ }
1576
+ },
1577
+ currentValue: function currentValue() {
1578
+ this.$nextTick(this.handleTextAreaHeightChange);
1029
1579
  }
1030
1580
  },
1031
1581
  methods: {
1582
+ renderTriggerMessage: function renderTriggerMessage() {
1583
+ if (this.$props.enableAI) {
1584
+ if (this.$props.AIUIConfig && this.$props.AIUIConfig.renderTriggerMessage) {
1585
+ return this.$props.AIUIConfig.renderTriggerMessage;
1586
+ }
1587
+ if (this.$slots.renderTriggerMessage) {
1588
+ return this.$slots.renderTriggerMessage();
1589
+ }
1590
+ if (this.currentTriggerMode === AI_TRIGGER_MODES.MANUAL && (this.$props.AIUIConfig ? !this.$props.AIUIConfig.askButton : true)) {
1591
+ return 'Click to trigger AIAnswer';
1592
+ }
1593
+ }
1594
+ return null;
1595
+ },
1032
1596
  handleText: function handleText(value, cause) {
1033
1597
  if (cause === causes.CLEAR_VALUE) {
1034
1598
  this.triggerCustomQuery(value);
@@ -1051,9 +1615,20 @@ var SearchBox = defineComponent({
1051
1615
  data: this.normalizedSuggestions,
1052
1616
  rawData: this.rawData,
1053
1617
  value: currentValue,
1054
- resultStats: this.stats
1618
+ resultStats: this.stats,
1619
+ AIData: {
1620
+ question: this.mergedAIQuestion,
1621
+ answer: this.mergedAIAnswer,
1622
+ documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
1623
+ showAIScreen: this.showAIScreen,
1624
+ sources: this.getAISourceObjects(),
1625
+ isAILoading: this.isAIResponseLoading,
1626
+ AIError: this.AIResponseError
1627
+ }
1055
1628
  };
1056
- return getComponent(data, this);
1629
+ return createVNode("div", {
1630
+ "ref": _dropdownULRef
1631
+ }, [getComponent(data, this)]);
1057
1632
  },
1058
1633
  // returns size and aggs property
1059
1634
  getBasicQueryOptions: function getBasicQueryOptions() {
@@ -1074,8 +1649,8 @@ var SearchBox = defineComponent({
1074
1649
  this.onValueSelectedHandler(currentValue, causes.SEARCH_ICON_CLICK);
1075
1650
  }
1076
1651
  },
1077
- setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue) {
1078
- var _this = this;
1652
+ setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue, shouldExecuteQuery) {
1653
+ var _this4 = this;
1079
1654
  if (isDefaultValue === void 0) {
1080
1655
  isDefaultValue = false;
1081
1656
  }
@@ -1088,61 +1663,79 @@ var SearchBox = defineComponent({
1088
1663
  if (categoryValue === void 0) {
1089
1664
  categoryValue = undefined;
1090
1665
  }
1666
+ if (shouldExecuteQuery === void 0) {
1667
+ shouldExecuteQuery = true;
1668
+ }
1091
1669
  var performUpdate = function performUpdate() {
1092
- if (_this.$options.isTagsMode && isEqual(value, _this.selectedTags)) {
1670
+ if (_this4.$options.isTagsMode && isEqual(value, _this4.selectedTags)) {
1093
1671
  return;
1094
1672
  }
1095
- if (_this.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1096
- if (Array.isArray(_this.selectedTags) && _this.selectedTags.length) {
1673
+ if (_this4.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1674
+ if (Array.isArray(_this4.selectedTags) && _this4.selectedTags.length) {
1097
1675
  // check if value already present in selectedTags
1098
- if (typeof value === 'string' && _this.selectedTags.includes(value)) {
1099
- _this.isOpen = false;
1676
+ if (typeof value === 'string' && _this4.selectedTags.includes(value)) {
1677
+ _this4.isOpen = false;
1100
1678
  return;
1101
1679
  }
1102
- _this.selectedTags = [].concat(_this.selectedTags);
1680
+ _this4.selectedTags = [].concat(_this4.selectedTags);
1103
1681
  if (typeof value === 'string' && !!value) {
1104
- _this.selectedTags.push(value);
1105
- } else if (Array.isArray(value) && !isEqual(_this.selectedTags, value)) {
1106
- _this.selectedTags = value;
1682
+ _this4.selectedTags.push(value);
1683
+ } else if (Array.isArray(value) && !isEqual(_this4.selectedTags, value)) {
1684
+ _this4.selectedTags = value;
1107
1685
  }
1108
1686
  } else if (value) {
1109
- _this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
1687
+ _this4.selectedTags = typeof value !== 'string' ? value : [].concat(value);
1110
1688
  }
1111
- _this.currentValue = '';
1689
+ _this4.currentValue = '';
1112
1690
  } else {
1113
- _this.currentValue = decodeHtml(value);
1691
+ _this4.currentValue = decodeHtml(value);
1114
1692
  }
1115
1693
  var queryHandlerValue = value;
1116
- if (_this.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1117
- queryHandlerValue = Array.isArray(_this.selectedTags) && _this.selectedTags.length ? _this.selectedTags : undefined;
1694
+ if (_this4.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1695
+ queryHandlerValue = Array.isArray(_this4.selectedTags) && _this4.selectedTags.length ? _this4.selectedTags : undefined;
1696
+ }
1697
+ if ((_this4.faqAnswer || _this4.faqQuestion) && value === '') {
1698
+ // Empty the previous state
1699
+ _this4.faqAnswer = '';
1700
+ _this4.faqQuestion = '';
1701
+ _this4.showAIScreen = false;
1118
1702
  }
1119
1703
  if (isDefaultValue) {
1120
- if (_this.$props.autosuggest) {
1704
+ if (_this4.$props.autosuggest) {
1121
1705
  if (toggleIsOpen) {
1122
- _this.isOpen = false;
1706
+ _this4.isOpen = false;
1123
1707
  }
1124
- if (typeof _this.currentValue === 'string') _this.triggerDefaultQuery(_this.currentValue);
1708
+ if (typeof _this4.currentValue === 'string') _this4.triggerDefaultQuery(_this4.currentValue, props.enableAI && _this4.currentTriggerMode === AI_TRIGGER_MODES.QUESTION && _this4.currentValue.endsWith('?') ? {
1709
+ enableAI: true
1710
+ } : {}, shouldExecuteQuery);
1125
1711
  } // in case of strict selection only SUGGESTION_SELECT should be able
1126
1712
  // to set the query otherwise the value should reset
1127
1713
  if (props.strictSelection) {
1128
- if (cause === causes.SUGGESTION_SELECT || (_this.$options.isTagsMode ? _this.selectedTags.length === 0 : value === '')) {
1129
- _this.triggerCustomQuery(queryHandlerValue, _this.$options.isTagsMode ? undefined : categoryValue);
1714
+ if (cause === causes.SUGGESTION_SELECT || (_this4.$options.isTagsMode ? _this4.selectedTags.length === 0 : value === '')) {
1715
+ _this4.triggerCustomQuery(queryHandlerValue, _this4.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1130
1716
  } else {
1131
- _this.setValue('', true);
1717
+ _this4.setValue('', true);
1132
1718
  }
1133
1719
  } else if (props.value === undefined || cause === causes.SUGGESTION_SELECT || cause === causes.CLEAR_VALUE) {
1134
- _this.triggerCustomQuery(queryHandlerValue, _this.$options.isTagsMode ? undefined : categoryValue);
1720
+ _this4.showAIScreen = false;
1721
+ _this4.triggerCustomQuery(queryHandlerValue, _this4.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1135
1722
  }
1136
1723
  } else {
1137
1724
  // debounce for handling text while typing
1138
- _this.handleTextChange(value, cause);
1725
+ _this4.handleTextChange(value, cause);
1139
1726
  }
1140
- _this.$emit('valueChange', value);
1141
- _this.$emit('value-change', value);
1727
+ _this4.$emit('valueChange', value);
1728
+ _this4.$emit('value-change', value);
1142
1729
  };
1143
1730
  checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
1144
1731
  },
1145
- triggerDefaultQuery: function triggerDefaultQuery(paramValue) {
1732
+ triggerDefaultQuery: function triggerDefaultQuery(paramValue, meta, shouldExecuteQuery) {
1733
+ if (meta === void 0) {
1734
+ meta = {};
1735
+ }
1736
+ if (shouldExecuteQuery === void 0) {
1737
+ shouldExecuteQuery = true;
1738
+ }
1146
1739
  if (!this.$props.autosuggest) {
1147
1740
  return;
1148
1741
  }
@@ -1161,13 +1754,17 @@ var SearchBox = defineComponent({
1161
1754
  componentId: this.internalComponent,
1162
1755
  query: query,
1163
1756
  value: value,
1164
- componentType: componentTypes.searchBox
1165
- });
1757
+ componentType: componentTypes.searchBox,
1758
+ meta: meta
1759
+ }, shouldExecuteQuery);
1166
1760
  },
1167
- triggerCustomQuery: function triggerCustomQuery(paramValue, categoryValue) {
1761
+ triggerCustomQuery: function triggerCustomQuery(paramValue, categoryValue, shouldExecuteQuery) {
1168
1762
  if (categoryValue === void 0) {
1169
1763
  categoryValue = undefined;
1170
1764
  }
1765
+ if (shouldExecuteQuery === void 0) {
1766
+ shouldExecuteQuery = true;
1767
+ }
1171
1768
  var _this$$props = this.$props,
1172
1769
  customQuery = _this$$props.customQuery,
1173
1770
  filterLabel = _this$$props.filterLabel,
@@ -1196,7 +1793,7 @@ var SearchBox = defineComponent({
1196
1793
  URLParams: URLParams,
1197
1794
  componentType: componentTypes.searchBox,
1198
1795
  category: categoryValue
1199
- });
1796
+ }, shouldExecuteQuery);
1200
1797
  },
1201
1798
  handleFocus: function handleFocus(event) {
1202
1799
  if (this.$props.autosuggest) {
@@ -1207,7 +1804,9 @@ var SearchBox = defineComponent({
1207
1804
  handleVoiceResults: function handleVoiceResults(_ref) {
1208
1805
  var results = _ref.results;
1209
1806
  if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
1807
+ var _this$$refs2;
1210
1808
  this.setValue(results[0][0].transcript.trim(), true);
1809
+ (_this$$refs2 = this.$refs) == null || (_this$$refs2 = _this$$refs2[this.$props.innerRef]) == null || (_this$$refs2 = _this$$refs2.$el) == null || _this$$refs2.focus(); // eslint-disable-line
1211
1810
  }
1212
1811
  },
1213
1812
  triggerQuery: function triggerQuery(_ref2) {
@@ -1245,8 +1844,10 @@ var SearchBox = defineComponent({
1245
1844
  this.recordSuggestionClick(searchPosition, docId);
1246
1845
  },
1247
1846
  clearValue: function clearValue() {
1248
- this.setValue('', false, this.$props, causes.CLEAR_VALUE, false);
1249
- this.onValueSelectedHandler('', causes.CLEAR_VALUE);
1847
+ this.setValue('', false, this.$props, !this.$options.isTagsMode ? causes.CLEAR_VALUE : undefined, false);
1848
+ this.onValueSelectedHandler('', !this.$options.isTagsMode ? causes.CLEAR_VALUE : undefined);
1849
+ this.showAIScreen = false;
1850
+ this.isOpen = false;
1250
1851
  },
1251
1852
  handleKeyDown: function handleKeyDown(event, highlightedIndex) {
1252
1853
  if (highlightedIndex === void 0) {
@@ -1257,9 +1858,13 @@ var SearchBox = defineComponent({
1257
1858
  if (this.$props.autosuggest === false) {
1258
1859
  this.enterButtonOnClick();
1259
1860
  } else if (highlightedIndex === null) {
1260
- this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined // to handle tags
1261
- );
1262
-
1861
+ this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined,
1862
+ // to handle tags
1863
+ !(this.$props.enableAI && this.currentTriggerMode === AI_TRIGGER_MODES.QUESTION && event.target.value.endsWith('?')));
1864
+ if (this.$props.enableAI && !this.showAIScreen && this.currentTriggerMode === AI_TRIGGER_MODES.QUESTION && event.target.value.endsWith('?')) {
1865
+ this.showAIScreen = true;
1866
+ this.isOpen = true;
1867
+ }
1263
1868
  this.onValueSelectedHandler(event.target.value, causes.ENTER_PRESS);
1264
1869
  }
1265
1870
  }
@@ -1269,18 +1874,21 @@ var SearchBox = defineComponent({
1269
1874
  this.$emit('key-down', event, this.triggerQuery);
1270
1875
  },
1271
1876
  onInputChange: function onInputChange(e) {
1272
- var _this2 = this;
1877
+ var _this5 = this;
1273
1878
  var inputValue = e.target.value;
1274
1879
  if (!this.$data.isOpen && this.$props.autosuggest) {
1275
1880
  this.isOpen = true;
1276
1881
  }
1882
+ if (this.showAIScreen) {
1883
+ this.showAIScreen = false;
1884
+ }
1277
1885
  var value = this.$props.value;
1278
1886
  if (value === undefined) {
1279
- this.setValue(inputValue, false, this.$props, inputValue === '' ? causes.CLEAR_VALUE : undefined);
1887
+ this.setValue(inputValue, inputValue === '', this.$props, undefined, false);
1280
1888
  } else {
1281
1889
  this.$emit('change', inputValue, function (_ref3) {
1282
1890
  var isOpen = _ref3.isOpen;
1283
- return _this2.triggerQuery({
1891
+ return _this5.triggerQuery({
1284
1892
  defaultQuery: true,
1285
1893
  customQuery: true,
1286
1894
  value: inputValue,
@@ -1289,10 +1897,72 @@ var SearchBox = defineComponent({
1289
1897
  }, e);
1290
1898
  }
1291
1899
  },
1900
+ handleFeaturedSuggestionClicked: function handleFeaturedSuggestionClicked(suggestion) {
1901
+ try {
1902
+ var _this$$refs3;
1903
+ if (suggestion.action === featuredSuggestionsActionTypes.NAVIGATE) {
1904
+ var _JSON$parse = JSON.parse(suggestion.subAction),
1905
+ _JSON$parse$target = _JSON$parse.target,
1906
+ target = _JSON$parse$target === void 0 ? '_self' : _JSON$parse$target,
1907
+ _JSON$parse$link = _JSON$parse.link,
1908
+ link = _JSON$parse$link === void 0 ? '/' : _JSON$parse$link;
1909
+ if (typeof window !== 'undefined') {
1910
+ window.open(link, target);
1911
+ }
1912
+ }
1913
+ if (suggestion.action === featuredSuggestionsActionTypes.FUNCTION) {
1914
+ var matchedValues = suggestion.subAction.match(/function\s*\(.*\)(.|\n)*/);
1915
+ var functionStr = matchedValues && matchedValues[0];
1916
+ // eslint-disable-next-line no-new-func
1917
+ var func = new Function("return " + functionStr)();
1918
+ func(suggestion, this.$data.currentValue, this.$props.customEvents);
1919
+ }
1920
+ if (suggestion.action === featuredSuggestionsActionTypes.SELECT) {
1921
+ this.setValue(suggestion.value, true, this.$props, this.$options.isTagsMode.current ? causes.SUGGESTION_SELECT : causes.ENTER_PRESS, false);
1922
+ this.onValueSelectedHandler(suggestion.value, causes.SUGGESTION_SELECT);
1923
+ }
1924
+ // blur is important to close the dropdown
1925
+ // on selecting one of featured suggestions
1926
+ // else Downshift probably is focusing the dropdown
1927
+ // and not letting it close
1928
+ // eslint-disable-next-line no-unused-expressions
1929
+ (_this$$refs3 = this.$refs) == null || (_this$$refs3 = _this$$refs3[this.$props.innerRef]) == null || (_this$$refs3 = _this$$refs3.el) == null || _this$$refs3.blur();
1930
+ } catch (e) {
1931
+ console.error("Error: There was an error parsing the subAction for the featured suggestion with label, \"" + suggestion.label + "\"", e);
1932
+ }
1933
+ },
1292
1934
  onSuggestionSelected: function onSuggestionSelected(suggestion) {
1293
- var _this3 = this;
1294
- this.isOpen = false;
1935
+ var _this6 = this;
1295
1936
  var value = this.$props.value;
1937
+ // The state of the suggestion is open by the time it reaches here. i.e. isOpen = true
1938
+ // handle when FAQ suggestion is clicked
1939
+ if (suggestion && suggestion._suggestion_type === suggestionTypes.FAQ) {
1940
+ this.currentValue = suggestion.value;
1941
+ // Handle AI
1942
+ // Independent of enableAI.
1943
+ this.faqAnswer = suggestion._answer;
1944
+ this.faqQuestion = suggestion.value;
1945
+ this.isOpen = true;
1946
+ this.showAIScreen = true;
1947
+ if (value !== undefined) this.$emit('change', suggestion.value, function () {});
1948
+ this.onValueSelectedHandler(suggestion.value);
1949
+ return;
1950
+ }
1951
+ if (suggestion && suggestion._suggestion_type === '_internal_a_i_trigger') {
1952
+ this.showAIScreen = true;
1953
+ this.askButtonOnClick();
1954
+ return;
1955
+ }
1956
+
1957
+ // handle featured suggestions click event
1958
+ if (suggestion._suggestion_type === suggestionTypes.Featured) {
1959
+ this.handleFeaturedSuggestionClicked(suggestion);
1960
+ // Handle AI
1961
+ if (!this.$props.enableAI) this.isOpen = false;else {
1962
+ this.showAIScreen = true;
1963
+ }
1964
+ return;
1965
+ }
1296
1966
  // Record analytics for selected suggestions
1297
1967
  this.triggerClickAnalytics(suggestion._click_id);
1298
1968
  if (value === undefined) {
@@ -1311,15 +1981,20 @@ var SearchBox = defineComponent({
1311
1981
  this.setValue(emitValue, true, this.$props, causes.SUGGESTION_SELECT, false, suggestion._category);
1312
1982
  this.$emit('change', emitValue, function (_ref4) {
1313
1983
  var isOpen = _ref4.isOpen;
1314
- return _this3.triggerQuery(_extends({
1984
+ return _this6.triggerQuery(_extends({
1315
1985
  isOpen: isOpen,
1316
1986
  value: emitValue
1317
- }, !_this3.$options.isTagsMode && {
1987
+ }, !_this6.$options.isTagsMode && {
1318
1988
  categoryValue: suggestion._category
1319
1989
  }));
1320
1990
  });
1321
1991
  }
1322
1992
  this.onValueSelectedHandler(suggestion.value, causes.SUGGESTION_SELECT, suggestion.source);
1993
+
1994
+ // Handle AI
1995
+ if (!this.$props.enableAI) this.isOpen = false;else if (this.currentTriggerMode === AI_TRIGGER_MODES.QUESTION && suggestion.value.endsWith('?')) {
1996
+ this.showAIScreen = true;
1997
+ }
1323
1998
  },
1324
1999
  onValueSelectedHandler: function onValueSelectedHandler(currentValue) {
1325
2000
  if (currentValue === void 0) {
@@ -1348,9 +2023,26 @@ var SearchBox = defineComponent({
1348
2023
  }
1349
2024
  return null;
1350
2025
  },
1351
- renderErrorComponent: function renderErrorComponent() {
1352
- var _this4 = this;
2026
+ renderErrorComponent: function renderErrorComponent(isAIError) {
2027
+ var _this7 = this;
2028
+ if (isAIError === void 0) {
2029
+ isAIError = false;
2030
+ }
1353
2031
  var renderError = this.$slots.renderError || this.$props.renderError;
2032
+ if (isAIError) {
2033
+ if (this.showAIScreen && this.AIResponseError && !this.isAIResponseLoading) {
2034
+ if (renderError) {
2035
+ return createVNode("div", {
2036
+ "class": "--ai-answer-error-container " + (getClassName$1(this.$props.innerClass, 'ai-error') || '')
2037
+ }, [renderError(this.AIResponseError)]);
2038
+ }
2039
+ return createVNode("div", {
2040
+ "class": "--ai-answer-error-container " + (getClassName$1(this.$props.innerClass, 'ai-error') || '')
2041
+ }, [createVNode("div", {
2042
+ "class": "--default-error-element"
2043
+ }, [createVNode("span", null, [typeof this.AIResponseError === 'string' ? this.AIResponseError : this.AIResponseError.message ? this.AIResponseError.message : 'There was an error in generating the response.', this.AIResponseError.code ? "Code:\n\t\t\t\t\t\t\t" + this.AIResponseError.code : ''])])]);
2044
+ }
2045
+ }
1354
2046
  if (this.error && renderError && this.$data.currentValue && !this.isLoading) {
1355
2047
  return createVNode(SuggestionWrapper, {
1356
2048
  "innerClass": this.$props.innerClass,
@@ -1359,7 +2051,7 @@ var SearchBox = defineComponent({
1359
2051
  "themePreset": this.themePreset
1360
2052
  }, {
1361
2053
  "default": function _default() {
1362
- return [isFunction(renderError) ? renderError(_this4.error) : renderError];
2054
+ return [isFunction(renderError) ? renderError(_this7.error) : renderError];
1363
2055
  }
1364
2056
  });
1365
2057
  }
@@ -1424,14 +2116,22 @@ var SearchBox = defineComponent({
1424
2116
  return null;
1425
2117
  },
1426
2118
  enterButtonOnClick: function enterButtonOnClick() {
2119
+ this.showAIScreen = false;
1427
2120
  this.triggerQuery({
1428
2121
  isOpen: false,
1429
2122
  value: this.currentValue,
1430
2123
  customQuery: true
1431
2124
  });
1432
2125
  },
2126
+ suggestionsFooter: function suggestionsFooter() {
2127
+ return typeof renderSuggestionsFooter === 'function' ? this.$props.renderSuggestionsFooter() : createVNode(AutosuggestFooterContainer, null, {
2128
+ "default": function _default() {
2129
+ return [createVNode("div", null, [createTextVNode("\u2191\u2193 Navigate")]), createVNode("div", null, [createTextVNode("\u21A9 Go")])];
2130
+ }
2131
+ });
2132
+ },
1433
2133
  renderEnterButtonElement: function renderEnterButtonElement() {
1434
- var _this5 = this;
2134
+ var _this8 = this;
1435
2135
  var _this$$props2 = this.$props,
1436
2136
  enterButton = _this$$props2.enterButton,
1437
2137
  innerClass = _this$$props2.innerClass;
@@ -1439,12 +2139,12 @@ var SearchBox = defineComponent({
1439
2139
  if (enterButton) {
1440
2140
  var getEnterButtonMarkup = function getEnterButtonMarkup() {
1441
2141
  if (renderEnterButton) {
1442
- return renderEnterButton(_this5.enterButtonOnClick);
2142
+ return renderEnterButton(_this8.enterButtonOnClick);
1443
2143
  }
1444
2144
  return createVNode(Button, {
1445
2145
  "class": "enter-btn " + getClassName$1(innerClass, 'enter-button'),
1446
2146
  "primary": true,
1447
- "onClick": _this5.enterButtonOnClick
2147
+ "onClick": _this8.enterButtonOnClick
1448
2148
  }, {
1449
2149
  "default": function _default() {
1450
2150
  return [createTextVNode("Search")];
@@ -1457,71 +2157,98 @@ var SearchBox = defineComponent({
1457
2157
  }
1458
2158
  return null;
1459
2159
  },
1460
- renderIcons: function renderIcons() {
1461
- var _this6 = this;
1462
- var _slot3, _slot4, _slot5;
2160
+ renderShortcut: function renderShortcut() {
2161
+ if (this.$props.focusShortcuts && this.$props.focusShortcuts.length) {
2162
+ var shortcut = this.$props.focusShortcuts[0];
2163
+ shortcut = shortcut.toLowerCase();
2164
+ shortcut = shortcut.replace('shift', '⬆️');
2165
+ shortcut = shortcut.replace('command', 'cmd');
2166
+ shortcut = shortcut.replace('control', 'ctrl');
2167
+ shortcut = shortcut.replace('option', 'alt');
2168
+ return shortcut.toUpperCase();
2169
+ }
2170
+ return '/';
2171
+ },
2172
+ renderLeftIcons: function renderLeftIcons() {
2173
+ var _this9 = this;
2174
+ var _slot3;
1463
2175
  var _this$$props3 = this.$props,
1464
2176
  iconPosition = _this$$props3.iconPosition,
1465
- showClear = _this$$props3.showClear,
1466
- innerClass = _this$$props3.innerClass,
1467
- getMicInstance = _this$$props3.getMicInstance,
1468
- showVoiceSearch = _this$$props3.showVoiceSearch,
1469
2177
  showIcon = _this$$props3.showIcon;
2178
+ return createVNode("div", null, [createVNode(IconGroup, {
2179
+ "groupPosition": "left"
2180
+ }, {
2181
+ "default": function _default() {
2182
+ return [iconPosition === 'left' && showIcon && createVNode(IconWrapper, {
2183
+ "onClick": _this9.handleSearchIconClick
2184
+ }, _isSlot(_slot3 = _this9.renderIcon()) ? _slot3 : {
2185
+ "default": function _default() {
2186
+ return [_slot3];
2187
+ }
2188
+ })];
2189
+ }
2190
+ })]);
2191
+ },
2192
+ renderRightIcons: function renderRightIcons() {
2193
+ var _this10 = this;
2194
+ var _slot4, _slot5, _slot6;
2195
+ var _this$$props4 = this.$props,
2196
+ iconPosition = _this$$props4.iconPosition,
2197
+ showClear = _this$$props4.showClear,
2198
+ innerClass = _this$$props4.innerClass,
2199
+ getMicInstance = _this$$props4.getMicInstance,
2200
+ showVoiceSearch = _this$$props4.showVoiceSearch,
2201
+ showIcon = _this$$props4.showIcon,
2202
+ showFocusShortcutsIcon = _this$$props4.showFocusShortcutsIcon;
1470
2203
  var renderMic = this.$slots.renderMic || this.$props.renderMic;
1471
2204
  var currentValue = this.$data.currentValue;
1472
2205
  return createVNode("div", null, [createVNode(IconGroup, {
1473
- "groupPosition": "right",
1474
- "positionType": "absolute"
2206
+ "groupPosition": "right"
1475
2207
  }, {
1476
2208
  "default": function _default() {
1477
2209
  return [currentValue && showClear && createVNode(IconWrapper, {
1478
- "onClick": _this6.clearValue,
2210
+ "onClick": _this10.clearValue,
1479
2211
  "showIcon": showIcon,
1480
2212
  "isClearIcon": true
1481
- }, _isSlot(_slot3 = _this6.renderCancelIcon()) ? _slot3 : {
2213
+ }, _isSlot(_slot4 = _this10.renderCancelIcon()) ? _slot4 : {
1482
2214
  "default": function _default() {
1483
- return [_slot3];
2215
+ return [_slot4];
2216
+ }
2217
+ }), showFocusShortcutsIcon && createVNode(ButtonIconWrapper, {
2218
+ "onClick": function onClick(e) {
2219
+ return _this10.focusSearchBox(e);
2220
+ }
2221
+ }, _isSlot(_slot5 = _this10.renderShortcut()) ? _slot5 : {
2222
+ "default": function _default() {
2223
+ return [_slot5];
1484
2224
  }
1485
2225
  }), showVoiceSearch && createVNode(Mic, {
1486
2226
  "getInstance": getMicInstance,
1487
2227
  "render": renderMic,
1488
- "handleResult": _this6.handleVoiceResults,
2228
+ "handleResult": _this10.handleVoiceResults,
1489
2229
  "className": getClassName$1(innerClass, 'mic') || null
1490
2230
  }, null), iconPosition === 'right' && showIcon && createVNode(IconWrapper, {
1491
- "onClick": _this6.handleSearchIconClick
1492
- }, _isSlot(_slot4 = _this6.renderIcon()) ? _slot4 : {
1493
- "default": function _default() {
1494
- return [_slot4];
1495
- }
1496
- })];
1497
- }
1498
- }), createVNode(IconGroup, {
1499
- "groupPosition": "left",
1500
- "positionType": "absolute"
1501
- }, {
1502
- "default": function _default() {
1503
- return [iconPosition === 'left' && showIcon && createVNode(IconWrapper, {
1504
- "onClick": _this6.handleSearchIconClick
1505
- }, _isSlot(_slot5 = _this6.renderIcon()) ? _slot5 : {
2231
+ "onClick": _this10.handleSearchIconClick
2232
+ }, _isSlot(_slot6 = _this10.renderIcon()) ? _slot6 : {
1506
2233
  "default": function _default() {
1507
- return [_slot5];
2234
+ return [_slot6];
1508
2235
  }
1509
2236
  })];
1510
2237
  }
1511
2238
  })]);
1512
2239
  },
1513
2240
  focusSearchBox: function focusSearchBox(event) {
1514
- var _this$$refs, _this$$refs$this$$pro;
2241
+ var _this$$refs4;
1515
2242
  var elt = event.target || event.srcElement;
1516
2243
  var tagName = elt.tagName;
1517
2244
  if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
1518
2245
  // already in an input
1519
2246
  return;
1520
2247
  }
1521
- (_this$$refs = this.$refs) == null ? void 0 : (_this$$refs$this$$pro = _this$$refs[this.$props.innerRef]) == null ? void 0 : _this$$refs$this$$pro.focus(); // eslint-disable-line
2248
+ (_this$$refs4 = this.$refs) == null || (_this$$refs4 = _this$$refs4[this.$props.innerRef]) == null || (_this$$refs4 = _this$$refs4.$el) == null || _this$$refs4.focus(); // eslint-disable-line
1522
2249
  },
1523
2250
  listenForFocusShortcuts: function listenForFocusShortcuts() {
1524
- var _this7 = this;
2251
+ var _this11 = this;
1525
2252
  var _this$$props$focusSho = this.$props.focusShortcuts,
1526
2253
  focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
1527
2254
  if (isEmpty(focusShortcuts)) {
@@ -1536,7 +2263,7 @@ var SearchBox = defineComponent({
1536
2263
  function (event, handler) {
1537
2264
  // Prevent the default refresh event under WINDOWS system
1538
2265
  event.preventDefault();
1539
- _this7.focusSearchBox(event);
2266
+ _this11.focusSearchBox(event);
1540
2267
  });
1541
2268
 
1542
2269
  // if one of modifier keys are used, they are handled below
@@ -1546,7 +2273,7 @@ var SearchBox = defineComponent({
1546
2273
  for (var index = 0; index < modifierKeys.length; index += 1) {
1547
2274
  var element = modifierKeys[index];
1548
2275
  if (hotkeys[element]) {
1549
- _this7.focusSearchBox(event);
2276
+ _this11.focusSearchBox(event);
1550
2277
  break;
1551
2278
  }
1552
2279
  }
@@ -1558,19 +2285,34 @@ var SearchBox = defineComponent({
1558
2285
  this.currentValue = decodeHtml(value);
1559
2286
  this.triggerDefaultQuery(value);
1560
2287
  },
1561
- renderAutoFill: function renderAutoFill(suggestion) {
1562
- var _this8 = this;
2288
+ renderActionIcon: function renderActionIcon(suggestion) {
2289
+ var _this12 = this;
1563
2290
  var handleAutoFillClick = function handleAutoFillClick(e) {
1564
2291
  e.stopPropagation();
1565
- _this8.onAutofillClick(suggestion);
2292
+ _this12.onAutofillClick(suggestion);
1566
2293
  };
1567
- /* 👇 avoid showing autofill for category suggestions👇 */
1568
- return suggestion._category ? null : createVNode(AutoFillSvg, {
1569
- "onClick": handleAutoFillClick
1570
- }, null);
2294
+ if (suggestion._suggestion_type === suggestionTypes.Featured) {
2295
+ if (suggestion.action === featuredSuggestionsActionTypes.FUNCTION) {
2296
+ return createVNode(AutoFillSvg, {
2297
+ "style": {
2298
+ transform: 'rotate(135deg)',
2299
+ pointerEvents: 'none'
2300
+ }
2301
+ }, null);
2302
+ }
2303
+ return null;
2304
+ }
2305
+ if (!suggestion._category) {
2306
+ /* 👇 avoid showing autofill for category suggestions👇 */
2307
+
2308
+ return createVNode(AutoFillSvg, {
2309
+ "onClick": handleAutoFillClick
2310
+ }, null);
2311
+ }
2312
+ return null;
1571
2313
  },
1572
2314
  renderTag: function renderTag(item) {
1573
- var _this9 = this;
2315
+ var _this13 = this;
1574
2316
  var innerClass = this.$props.innerClass;
1575
2317
  return createVNode(TagItem, {
1576
2318
  "class": getClassName$1(innerClass, 'selected-tag') || ''
@@ -1581,7 +2323,7 @@ var SearchBox = defineComponent({
1581
2323
  "aria-label": "delete-tag",
1582
2324
  "class": "close-icon",
1583
2325
  "onClick": function onClick() {
1584
- return _this9.clearTag(item);
2326
+ return _this13.clearTag(item);
1585
2327
  }
1586
2328
  }, [createVNode(CancelSvg, null, null)])];
1587
2329
  }
@@ -1604,7 +2346,7 @@ var SearchBox = defineComponent({
1604
2346
  }
1605
2347
  },
1606
2348
  renderTags: function renderTags() {
1607
- var _this10 = this;
2349
+ var _this14 = this;
1608
2350
  if (!Array.isArray(this.selectedTags)) {
1609
2351
  return null;
1610
2352
  }
@@ -1618,193 +2360,474 @@ var SearchBox = defineComponent({
1618
2360
  }) : createVNode(TagsContainer, null, {
1619
2361
  "default": function _default() {
1620
2362
  return [tagsList.map(function (item) {
1621
- return _this10.renderTag(item);
2363
+ return _this14.renderTag(item);
1622
2364
  }), shouldRenderClearAllTag && createVNode(TagItem, {
1623
- "class": getClassName$1(_this10.$props.innerClass, 'selected-tag') || ''
2365
+ "class": getClassName$1(_this14.$props.innerClass, 'selected-tag') || ''
1624
2366
  }, {
1625
2367
  "default": function _default() {
1626
2368
  return [createVNode("span", null, [createTextVNode("Clear All")]), createVNode("span", {
1627
2369
  "role": "img",
1628
2370
  "aria-label": "delete-tag",
1629
2371
  "class": "close-icon",
1630
- "onClick": _this10.clearAllTags
2372
+ "onClick": _this14.clearAllTags
1631
2373
  }, [createVNode(CancelSvg, null, null)])];
1632
2374
  }
1633
2375
  })];
1634
2376
  }
1635
2377
  });
2378
+ },
2379
+ getAISourceObjects: function getAISourceObjects() {
2380
+ var _this15 = this;
2381
+ var sourceObjects = [];
2382
+ if (!this.AIResponse) return sourceObjects;
2383
+ var docIds = this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [];
2384
+ if (this.initialHits) {
2385
+ docIds.forEach(function (id) {
2386
+ var foundSourceObj = _this15.initialHits.find(function (hit) {
2387
+ return hit._id === id;
2388
+ }) || {};
2389
+ if (foundSourceObj) {
2390
+ var _foundSourceObj$_sour = foundSourceObj._source,
2391
+ _source = _foundSourceObj$_sour === void 0 ? {} : _foundSourceObj$_sour,
2392
+ rest = _objectWithoutPropertiesLoose(foundSourceObj, _excluded);
2393
+ sourceObjects.push(_extends({}, rest, _source));
2394
+ }
2395
+ });
2396
+ } else {
2397
+ sourceObjects.push.apply(sourceObjects, docIds.map(function (id) {
2398
+ return {
2399
+ _id: id
2400
+ };
2401
+ }));
2402
+ }
2403
+ return sourceObjects;
2404
+ },
2405
+ renderAIScreenLoader: function renderAIScreenLoader() {
2406
+ var _this$$props$AIUIConf = this.$props.AIUIConfig,
2407
+ AIUIConfig = _this$$props$AIUIConf === void 0 ? {} : _this$$props$AIUIConf;
2408
+ var _ref5 = AIUIConfig || {},
2409
+ loaderMessage = _ref5.loaderMessage;
2410
+ if (loaderMessage) {
2411
+ return loaderMessage;
2412
+ }
2413
+ if (this.$slots.AILoaderMessage) {
2414
+ return this.$slots.AILoaderMessage();
2415
+ }
2416
+ return createVNode(HorizontalSkeletonLoader, null, null);
2417
+ },
2418
+ renderAIScreenFooter: function renderAIScreenFooter() {
2419
+ var _slot8;
2420
+ var _this16 = this;
2421
+ var _this$$props$AIUIConf2 = this.$props.AIUIConfig,
2422
+ AIUIConfig = _this$$props$AIUIConf2 === void 0 ? {} : _this$$props$AIUIConf2;
2423
+ var _ref6 = AIUIConfig || {},
2424
+ _ref6$showSourceDocum = _ref6.showSourceDocuments,
2425
+ showSourceDocuments = _ref6$showSourceDocum === void 0 ? false : _ref6$showSourceDocum,
2426
+ _ref6$onSourceClick = _ref6.onSourceClick,
2427
+ onSourceClick = _ref6$onSourceClick === void 0 ? function () {} : _ref6$onSourceClick;
2428
+ var renderSourceDocumentLabel = function renderSourceDocumentLabel(sourceObj) {
2429
+ if (_this16.$props.AIUIConfig && _this16.$props.AIUIConfig.renderSourceDocument) {
2430
+ return _this16.$props.AIUIConfig.renderSourceDocument(sourceObj);
2431
+ }
2432
+ if (_this16.$slots.renderSourceDocument) {
2433
+ return _this16.$slots.renderSourceDocument(sourceObj);
2434
+ }
2435
+ return sourceObj._id;
2436
+ };
2437
+ return showSourceDocuments && this.showAIScreenFooter && this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds && this.AIResponse.response.answer.documentIds.length ? createVNode(Footer, {
2438
+ "themePreset": this.$props.themePreset
2439
+ }, {
2440
+ "default": function _default() {
2441
+ return [createTextVNode("Summary generated using the following sources:"), ' ', createVNode(SourceTags, null, _isSlot(_slot8 = _this16.getAISourceObjects().map(function (el) {
2442
+ var _slot7;
2443
+ return createVNode(Button, {
2444
+ "class": "--ai-source-tag " + (getClassName$1(_this16.$props.innerClass, 'ai-source-tag') || ''),
2445
+ "info": true,
2446
+ "onClick": function onClick() {
2447
+ return onSourceClick && onSourceClick(el);
2448
+ }
2449
+ }, _isSlot(_slot7 = renderSourceDocumentLabel(el)) ? _slot7 : {
2450
+ "default": function _default() {
2451
+ return [_slot7];
2452
+ }
2453
+ });
2454
+ })) ? _slot8 : {
2455
+ "default": function _default() {
2456
+ return [_slot8];
2457
+ }
2458
+ })];
2459
+ }
2460
+ }) : null;
2461
+ },
2462
+ renderAIScreen: function renderAIScreen() {
2463
+ var _this17 = this;
2464
+ var customAIRenderer = this.$props.renderAIAnswer || this.$slots.renderAIAnswer;
2465
+ if (customAIRenderer) {
2466
+ return customAIRenderer({
2467
+ question: this.mergedAIQuestion,
2468
+ answer: this.mergedAIAnswer,
2469
+ documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
2470
+ loading: this.isAIResponseLoading || this.isLoading,
2471
+ sources: this.getAISourceObjects(),
2472
+ error: this.AIResponseError
2473
+ });
2474
+ }
2475
+ if (this.isAIResponseLoading || this.isLoading) {
2476
+ return this.renderAIScreenLoader();
2477
+ }
2478
+ return createVNode("div", null, [createVNode(Answer, {
2479
+ "innerHTML": md.render(this.mergedAIAnswer)
2480
+ }, null), this.renderAIScreenFooter(), this.showFeedbackComponent && createVNode("div", {
2481
+ "class": "" + (getClassName$1(this.$props.innerClass, 'ai-feedback') || '')
2482
+ }, [createVNode(AIFeedback, {
2483
+ "overrideState": this.feedbackState,
2484
+ "hideUI": this.isAIResponseLoading || this.isLoading || !this.sessionIdFromStore,
2485
+ "key": this.sessionIdFromStore,
2486
+ "onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
2487
+ _this17.feedbackState = {
2488
+ isRecorded: true,
2489
+ feedbackType: useful ? 'positive' : 'negative'
2490
+ };
2491
+ _this17.recordAISessionUsefulness(_this17.sessionIdFromStore, {
2492
+ useful: useful,
2493
+ reason: reason
2494
+ });
2495
+ }
2496
+ }, null)])]);
2497
+ },
2498
+ handleTextAreaHeightChange: function handleTextAreaHeightChange() {
2499
+ var _this$$refs$this$$pro, _this$$refs$_inputGro;
2500
+ var textArea = (_this$$refs$this$$pro = this.$refs[this.$props.innerRef]) == null ? void 0 : _this$$refs$this$$pro.$el;
2501
+ var inputGroupEle = (_this$$refs$_inputGro = this.$refs[_inputGroupRef]) == null ? void 0 : _this$$refs$_inputGro.$el;
2502
+ if (textArea) {
2503
+ textArea.style.height = '42px';
2504
+ var lineHeight = parseInt(getComputedStyle(textArea).lineHeight, 10);
2505
+ var maxHeight = lineHeight * 4; // max height for 3 lines
2506
+ var height = Math.min(textArea.scrollHeight, maxHeight);
2507
+ textArea.style.height = height + "px";
2508
+ textArea.style.overflowY = height === maxHeight ? 'auto' : 'hidden';
2509
+ var dropdownEle = this.$refs[_dropdownULRef];
2510
+ if (dropdownEle) {
2511
+ dropdownEle.style.top = "" + textArea.style.height;
2512
+ }
2513
+ if (inputGroupEle) {
2514
+ inputGroupEle.style.height = "" + textArea.style.height;
2515
+ }
2516
+ }
2517
+ },
2518
+ askButtonOnClick: function askButtonOnClick() {
2519
+ this.showAIScreen = true;
2520
+ this.isOpen = true;
2521
+ this.triggerDefaultQuery(this.currentValue, {
2522
+ enableAI: true
2523
+ });
2524
+ },
2525
+ renderAskButtonElement: function renderAskButtonElement() {
2526
+ var _this18 = this;
2527
+ var _this$$props5 = this.$props,
2528
+ AIUIConfig = _this$$props5.AIUIConfig,
2529
+ innerClass = _this$$props5.innerClass;
2530
+ var _ref7 = AIUIConfig || {},
2531
+ askButton = _ref7.askButton;
2532
+ var renderAskButton = this.$slots.renderAskButton;
2533
+ if (askButton) {
2534
+ var getEnterButtonMarkup = function getEnterButtonMarkup() {
2535
+ if (renderAskButton) {
2536
+ return renderAskButton(_this18.askButtonOnClick);
2537
+ }
2538
+ return createVNode(Button, {
2539
+ "class": "enter-btn " + getClassName$1(innerClass, 'ask-button'),
2540
+ "info": true,
2541
+ "onClick": _this18.askButtonOnClick
2542
+ }, {
2543
+ "default": function _default() {
2544
+ return [createTextVNode("Ask")];
2545
+ }
2546
+ });
2547
+ };
2548
+ return createVNode("div", {
2549
+ "class": "enter-button-wrapper"
2550
+ }, [getEnterButtonMarkup()]);
2551
+ }
2552
+ return null;
1636
2553
  }
1637
2554
  },
1638
2555
  render: function render() {
1639
- var _this11 = this;
2556
+ var _this19 = this;
1640
2557
  var expandSuggestionsContainer = this.$props.expandSuggestionsContainer;
1641
2558
  var _this$$slots = this.$slots,
1642
2559
  recentSearchesIcon = _this$$slots.recentSearchesIcon,
1643
2560
  popularSearchesIcon = _this$$slots.popularSearchesIcon;
1644
- var hasSuggestions = Array.isArray(this.normalizedSuggestions) && this.normalizedSuggestions.length;
2561
+ var hasSuggestions = Array.isArray(this.parsedSuggestions) && this.parsedSuggestions.length;
1645
2562
  var renderItem = this.$slots.renderItem || this.$props.renderItem;
1646
2563
  return createVNode(Container, {
1647
2564
  "class": this.$props.className
1648
2565
  }, {
1649
2566
  "default": function _default() {
1650
- return [_this11.$props.title && createVNode(Title, {
1651
- "class": getClassName$1(_this11.$props.innerClass, 'title') || ''
2567
+ return [_this19.$props.title && createVNode(Title, {
2568
+ "class": getClassName$1(_this19.$props.innerClass, 'title') || ''
1652
2569
  }, {
1653
2570
  "default": function _default() {
1654
- return [_this11.$props.title];
2571
+ return [_this19.$props.title];
1655
2572
  }
1656
- }), _this11.$props.autosuggest ? createVNode(Downshift, {
1657
- "id": _this11.$props.componentId + "-downshift",
1658
- "handleChange": _this11.onSuggestionSelected,
1659
- "handleMouseup": _this11.handleStateChange,
1660
- "isOpen": _this11.$data.isOpen
2573
+ }), _this19.$props.autosuggest ? createVNode(Downshift, {
2574
+ "id": _this19.$props.componentId + "-downshift",
2575
+ "handleChange": _this19.onSuggestionSelected,
2576
+ "handleMouseup": _this19.handleStateChange,
2577
+ "isOpen": _this19.$data.isOpen
1661
2578
  }, {
1662
- "default": function _default(_ref5) {
1663
- var getInputEvents = _ref5.getInputEvents,
1664
- getInputProps = _ref5.getInputProps,
1665
- getItemProps = _ref5.getItemProps,
1666
- getItemEvents = _ref5.getItemEvents,
1667
- isOpen = _ref5.isOpen,
1668
- highlightedIndex = _ref5.highlightedIndex,
1669
- setHighlightedIndex = _ref5.setHighlightedIndex;
2579
+ "default": function _default(_ref8) {
2580
+ var getInputEvents = _ref8.getInputEvents,
2581
+ getInputProps = _ref8.getInputProps,
2582
+ getItemProps = _ref8.getItemProps,
2583
+ getItemEvents = _ref8.getItemEvents,
2584
+ isOpen = _ref8.isOpen,
2585
+ highlightedIndex = _ref8.highlightedIndex,
2586
+ setHighlightedIndex = _ref8.setHighlightedIndex;
1670
2587
  var renderSuggestionsDropdown = function renderSuggestionsDropdown() {
1671
- var getIcon = function getIcon(iconType) {
2588
+ var getIcon = function getIcon(iconType, item, leaveSpaceForIcon) {
1672
2589
  switch (iconType) {
1673
2590
  case suggestionTypes.Recent:
1674
2591
  return recentSearchesIcon;
1675
2592
  case suggestionTypes.Popular:
1676
2593
  return popularSearchesIcon;
2594
+ case suggestionTypes.Featured:
2595
+ if (item.icon) {
2596
+ return function () {
2597
+ return createVNode("div", {
2598
+ "style": {
2599
+ display: 'flex'
2600
+ },
2601
+ "innerHTML": xss(item.icon)
2602
+ }, null);
2603
+ };
2604
+ }
2605
+ if (item.iconURL) {
2606
+ return function () {
2607
+ return (// When you change below also change the empty icon below
2608
+ createVNode("img", {
2609
+ "style": {
2610
+ maxWidth: '30px'
2611
+ },
2612
+ "src": xss(item.iconURL),
2613
+ "alt": item.value
2614
+ }, null)
2615
+ );
2616
+ };
2617
+ }
2618
+ // Render an empty icon when no icon is provided from the dashboard
2619
+ return function () {
2620
+ return createVNode("span", {
2621
+ "style": {
2622
+ display: 'inline-block',
2623
+ height: '30px',
2624
+ width: leaveSpaceForIcon ? '30px' : 0
2625
+ }
2626
+ }, null);
2627
+ };
1677
2628
  default:
1678
2629
  return null;
1679
2630
  }
1680
2631
  };
1681
- return createVNode("div", null, [_this11.hasCustomRenderer && _this11.getComponent({
2632
+ var indexOffset = 0;
2633
+ return createVNode("div", null, [_this19.hasCustomRenderer && _this19.getComponent({
1682
2634
  isOpen: isOpen,
1683
2635
  getItemProps: getItemProps,
1684
2636
  getItemEvents: getItemEvents,
1685
2637
  highlightedIndex: highlightedIndex
1686
- }), _this11.renderErrorComponent(), !_this11.hasCustomRenderer && isOpen && hasSuggestions ? createVNode("ul", {
1687
- "class": suggestions(_this11.themePreset, _this11.theme) + " " + getClassName$1(_this11.$props.innerClass, 'list')
1688
- }, [_this11.normalizedSuggestions.map(function (item, index) {
1689
- return renderItem ? createVNode("li", mergeProps(getItemProps({
1690
- item: item
1691
- }), getItemEvents({
1692
- item: item
1693
- }), {
1694
- "key": index + 1 + "-" + item.value,
1695
- "style": {
1696
- backgroundColor: _this11.getBackgroundColor(highlightedIndex, index),
1697
- justifyContent: 'flex-start',
1698
- alignItems: 'center'
1699
- }
1700
- }), [renderItem(item)]) : createVNode("li", mergeProps(getItemProps({
1701
- item: item
1702
- }), _transformOn(getItemEvents({
1703
- item: item
1704
- })), {
1705
- "key": index + 1 + "-" + item.value,
1706
- "style": {
1707
- backgroundColor: _this11.getBackgroundColor(highlightedIndex, index),
1708
- justifyContent: 'flex-start',
1709
- alignItems: 'center'
1710
- }
1711
- }), [createVNode("div", {
1712
- "style": {
1713
- padding: '0 10px 0 0',
1714
- display: 'flex'
1715
- }
1716
- }, [createVNode(CustomSvg, {
1717
- "className": getClassName$1(_this11.$props.innerClass, item._suggestion_type + "-search-icon") || null,
1718
- "icon": getIcon(item._suggestion_type),
1719
- "type": item._suggestion_type + "-search-icon"
1720
- }, null)]), createVNode(SuggestionItem, {
1721
- "currentValue": _this11.currentValue,
1722
- "suggestion": item
1723
- }, null), _this11.renderAutoFill(item)]);
1724
- })]) : _this11.renderNoSuggestions(_this11.normalizedSuggestions)]);
2638
+ }), _this19.renderErrorComponent(), !_this19.hasCustomRenderer && isOpen && hasSuggestions ? createVNode("ul", {
2639
+ "class": suggestions(_this19.themePreset, _this19.theme) + " " + getClassName$1(_this19.$props.innerClass, 'list') + " " + searchboxSuggestions(_this19.themePreset, _this19.theme) + "\n\t\t\t\t\t\t\t\t\t\t\t\t\t",
2640
+ "ref": _dropdownULRef
2641
+ }, [_this19.showAIScreen && createVNode(SearchBoxAISection, {
2642
+ "themePreset": _this19.$props.themePreset
2643
+ }, {
2644
+ "default": function _default() {
2645
+ return [_this19.renderAIScreen(), ' ', _this19.renderErrorComponent(true)];
2646
+ }
2647
+ }), !_this19.showAIScreen && _this19.parsedSuggestions.map(function (item, itemIndex) {
2648
+ var index = indexOffset + itemIndex;
2649
+ if (Array.isArray(item)) {
2650
+ var sectionHtml = xss(item[0].sectionLabel);
2651
+ indexOffset += item.length - 1;
2652
+ return createVNode("div", {
2653
+ "key": "section-" + itemIndex,
2654
+ "class": "section-container"
2655
+ }, [sectionHtml ? createVNode("div", {
2656
+ "class": "section-header " + getClassName$1(_this19.$props.innerClass, 'section-label'),
2657
+ "key": "" + item[0].sectionId,
2658
+ "innerHTML": sectionHtml
2659
+ }, null) : null, createVNode("ul", {
2660
+ "class": "section-list"
2661
+ }, [item.map(function (sectionItem, sectionIndex) {
2662
+ var suggestionsHaveIcon = item.some(function (s) {
2663
+ return s.icon || s.iconURL;
2664
+ });
2665
+ if (renderItem) {
2666
+ return createVNode("li", mergeProps(getItemProps({
2667
+ item: sectionItem
2668
+ }), _transformOn(getItemEvents({
2669
+ item: sectionItem
2670
+ })), {
2671
+ "key": sectionItem._id + "_" + index + "_" + sectionIndex,
2672
+ "style": {
2673
+ justifyContent: 'flex-start',
2674
+ alignItems: 'center'
2675
+ },
2676
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this19.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this19.$props.innerClass, 'suggestion-item'))
2677
+ }), [renderItem(sectionItem)]);
2678
+ }
2679
+ if (sectionItem._suggestion_type === '_internal_a_i_trigger') {
2680
+ return createVNode("li", mergeProps(getItemProps({
2681
+ item: sectionItem
2682
+ }), _transformOn(getItemEvents({
2683
+ item: sectionItem
2684
+ })), {
2685
+ "key": sectionItem._id + "_" + index + "_" + sectionIndex,
2686
+ "style": {
2687
+ justifyContent: 'flex-start',
2688
+ alignItems: 'center'
2689
+ },
2690
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this19.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this19.$props.innerClass, 'suggestion-item'))
2691
+ }), [createVNode(SuggestionItem, {
2692
+ "currentValue": _this19.currentValue,
2693
+ "suggestion": sectionItem
2694
+ }, null)]);
2695
+ }
2696
+ return createVNode("li", mergeProps(getItemProps({
2697
+ item: sectionItem
2698
+ }), _transformOn(getItemEvents({
2699
+ item: sectionItem
2700
+ })), {
2701
+ "key": sectionItem._id + "_" + index + "_" + sectionIndex,
2702
+ "style": {
2703
+ justifyContent: 'flex-start',
2704
+ alignItems: 'center'
2705
+ },
2706
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this19.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this19.$props.innerClass, 'suggestion-item'))
2707
+ }), [createVNode("div", {
2708
+ "style": {
2709
+ padding: '0 10px 0 0',
2710
+ display: 'flex'
2711
+ }
2712
+ }, [createVNode(CustomSvg, {
2713
+ "key": sectionItem._suggestion_type + "-" + sectionIndex,
2714
+ "className": getClassName$1(_this19.$props.innerClass, sectionItem._suggestion_type + "-search-icon") || null,
2715
+ "icon": getIcon(sectionItem._suggestion_type, sectionItem, suggestionsHaveIcon),
2716
+ "type": sectionItem._suggestion_type + "-search-icon"
2717
+ }, null)]), createVNode(SuggestionItem, {
2718
+ "currentValue": _this19.currentValue,
2719
+ "suggestion": sectionItem
2720
+ }, null), _this19.renderActionIcon(sectionItem)]);
2721
+ })])]);
2722
+ }
2723
+ return createVNode("div", null, [createTextVNode("No suggestions")]);
2724
+ }), !_this19.showAIScreen && _this19.parsedSuggestions.length && _this19.$props.showSuggestionsFooter ? _this19.suggestionsFooter() : null]) : _this19.renderNoSuggestions(_this19.normalizedSuggestions)]);
1725
2725
  };
1726
2726
  return createVNode("div", {
1727
2727
  "class": suggestionsContainer
1728
- }, [createVNode(InputGroup, null, {
2728
+ }, [createVNode(InputGroup, {
2729
+ "searchBox": true,
2730
+ "ref": _inputGroupRef,
2731
+ "isOpen": _this19.$data.isOpen
2732
+ }, {
1729
2733
  "default": function _default() {
1730
- return [_this11.renderInputAddonBefore(), createVNode(InputWrapper, null, {
2734
+ return [createVNode(Actions$1, null, {
2735
+ "default": function _default() {
2736
+ return [_this19.renderInputAddonBefore(), _this19.renderLeftIcons()];
2737
+ }
2738
+ }), createVNode(InputWrapper, null, {
1731
2739
  "default": function _default() {
1732
- return [createVNode(Input, mergeProps(_transformOn(getInputEvents({
1733
- onInput: _this11.onInputChange,
2740
+ return [createVNode(TextArea, mergeProps(_transformOn(getInputEvents({
2741
+ onInput: _this19.onInputChange,
1734
2742
  onBlur: function onBlur(e) {
1735
- _this11.$emit('blur', e, _this11.triggerQuery);
2743
+ _this19.$emit('blur', e, _this19.triggerQuery);
1736
2744
  },
1737
- onFocus: _this11.handleFocus,
2745
+ onFocus: _this19.handleFocus,
1738
2746
  onKeyPress: function onKeyPress(e) {
1739
- _this11.$emit('keyPress', e, _this11.triggerQuery);
1740
- _this11.$emit('key-press', e, _this11.triggerQuery);
2747
+ _this19.$emit('keyPress', e, _this19.triggerQuery);
2748
+ _this19.$emit('key-press', e, _this19.triggerQuery);
1741
2749
  },
1742
2750
  onKeyDown: function onKeyDown(e) {
1743
- return _this11.handleKeyDown(e, highlightedIndex);
2751
+ return _this19.handleKeyDown(e, highlightedIndex);
1744
2752
  },
1745
2753
  onKeyUp: function onKeyUp(e) {
1746
- _this11.$emit('keyUp', e, _this11.triggerQuery);
1747
- _this11.$emit('key-up', e, _this11.triggerQuery);
2754
+ _this19.$emit('keyUp', e, _this19.triggerQuery);
2755
+ _this19.$emit('key-up', e, _this19.triggerQuery);
1748
2756
  },
1749
2757
  onClick: function onClick() {
1750
2758
  setHighlightedIndex(null);
1751
2759
  }
1752
2760
  })), {
1753
- "id": _this11.$props.componentId + "-input",
1754
- "showIcon": _this11.$props.showIcon,
1755
- "showClear": _this11.$props.showClear,
1756
- "iconPosition": _this11.$props.iconPosition,
1757
- "ref": _this11.$props.innerRef,
1758
- "class": getClassName$1(_this11.$props.innerClass, 'input'),
1759
- "placeholder": _this11.$props.placeholder,
1760
- "autoFocus": _this11.$props.autoFocus
2761
+ "searchBox": true,
2762
+ "isOpen": _this19.$data.isOpen,
2763
+ "id": _this19.$props.componentId + "-input",
2764
+ "ref": _this19.$props.innerRef,
2765
+ "class": getClassName$1(_this19.$props.innerClass, 'input'),
2766
+ "placeholder": _this19.$props.placeholder,
2767
+ "autoFocus": _this19.$props.autoFocus
1761
2768
  }, getInputProps({
1762
- value: _this11.$data.currentValue === null ? '' : _this11.$data.currentValue
2769
+ value: _this19.$data.currentValue === null ? '' : _this19.$data.currentValue
1763
2770
  }), {
1764
- "themePreset": _this11.themePreset,
2771
+ "themePreset": _this19.themePreset,
1765
2772
  "autocomplete": "off"
1766
- }), null), _this11.renderIcons(), !expandSuggestionsContainer && renderSuggestionsDropdown()];
2773
+ }), null), !expandSuggestionsContainer && renderSuggestionsDropdown()];
1767
2774
  }
1768
- }), _this11.renderInputAddonAfter(), _this11.renderEnterButtonElement()];
2775
+ }), createVNode(Actions$1, null, {
2776
+ "default": function _default() {
2777
+ return [_this19.renderRightIcons(), _this19.renderInputAddonAfter(), _this19.renderAskButtonElement(), _this19.renderEnterButtonElement()];
2778
+ }
2779
+ })];
1769
2780
  }
1770
- }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this11.renderTags()]);
2781
+ }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this19.renderTags()]);
1771
2782
  }
1772
2783
  }) : createVNode("div", {
1773
2784
  "class": suggestionsContainer
1774
- }, [createVNode(InputGroup, null, {
2785
+ }, [createVNode(InputGroup, {
2786
+ "searchBox": true,
2787
+ "ref": _inputGroupRef
2788
+ }, {
1775
2789
  "default": function _default() {
1776
- return [_this11.renderInputAddonBefore(), createVNode(InputWrapper, null, {
2790
+ return [createVNode(Actions$1, null, {
1777
2791
  "default": function _default() {
1778
- return [createVNode(Input, mergeProps(_transformOn({
2792
+ return [_this19.renderInputAddonBefore(), _this19.renderLeftIcons()];
2793
+ }
2794
+ }), createVNode(InputWrapper, null, {
2795
+ "default": function _default() {
2796
+ return [createVNode(TextArea, mergeProps(_transformOn({
1779
2797
  blur: function blur(e) {
1780
- _this11.$emit('blur', e, _this11.triggerQuery);
2798
+ _this19.$emit('blur', e, _this19.triggerQuery);
1781
2799
  },
1782
2800
  keypress: function keypress(e) {
1783
- _this11.$emit('keyPress', e, _this11.triggerQuery);
1784
- _this11.$emit('key-press', e, _this11.triggerQuery);
2801
+ _this19.$emit('keyPress', e, _this19.triggerQuery);
2802
+ _this19.$emit('key-press', e, _this19.triggerQuery);
1785
2803
  },
1786
- input: _this11.onInputChange,
2804
+ input: _this19.onInputChange,
1787
2805
  focus: function focus(e) {
1788
- _this11.$emit('focus', e, _this11.triggerQuery);
2806
+ _this19.$emit('focus', e, _this19.triggerQuery);
1789
2807
  },
1790
- keydown: _this11.handleKeyDown,
2808
+ keydown: _this19.handleKeyDown,
1791
2809
  keyup: function keyup(e) {
1792
- _this11.$emit('keyUp', e, _this11.triggerQuery);
1793
- _this11.$emit('key-up', e, _this11.triggerQuery);
2810
+ _this19.$emit('keyUp', e, _this19.triggerQuery);
2811
+ _this19.$emit('key-up', e, _this19.triggerQuery);
1794
2812
  }
1795
2813
  }), {
1796
- "class": getClassName$1(_this11.$props.innerClass, 'input') || '',
1797
- "placeholder": _this11.$props.placeholder,
1798
- "autofocus": _this11.$props.autoFocus,
1799
- "value": _this11.$data.currentValue ? _this11.$data.currentValue : '',
1800
- "iconPosition": _this11.$props.iconPosition,
1801
- "showIcon": _this11.$props.showIcon,
1802
- "showClear": _this11.$props.showClear,
1803
- "ref": _this11.$props.innerRef,
1804
- "themePreset": _this11.themePreset
1805
- }), null), _this11.renderIcons()];
2814
+ "searchBox": true,
2815
+ "class": getClassName$1(_this19.$props.innerClass, 'input') || '',
2816
+ "placeholder": _this19.$props.placeholder,
2817
+ "autofocus": _this19.$props.autoFocus,
2818
+ "value": _this19.$data.currentValue ? _this19.$data.currentValue : '',
2819
+ "iconPosition": _this19.$props.iconPosition,
2820
+ "showIcon": _this19.$props.showIcon,
2821
+ "showClear": _this19.$props.showClear,
2822
+ "ref": _this19.$props.innerRef,
2823
+ "themePreset": _this19.themePreset
2824
+ }), null)];
2825
+ }
2826
+ }), createVNode(Actions$1, null, {
2827
+ "default": function _default() {
2828
+ return [_this19.renderRightIcons(), _this19.renderInputAddonAfter(), _this19.renderEnterButtonElement()];
1806
2829
  }
1807
- }), _this11.renderInputAddonAfter(), _this11.renderEnterButtonElement()];
2830
+ })];
1808
2831
  }
1809
2832
  })])];
1810
2833
  }
@@ -1857,18 +2880,24 @@ var mapStateToProps = function mapStateToProps(state, props) {
1857
2880
  rawData: state.rawData[props.componentId],
1858
2881
  aggregationData: state.compositeAggregations[props.componentId] || [],
1859
2882
  themePreset: state.config.themePreset,
1860
- isLoading: !!state.isLoading[props.componentId + "_active"],
2883
+ isLoading: !!state.isLoading["" + props.componentId],
1861
2884
  error: state.error[props.componentId],
1862
2885
  time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
1863
2886
  total: state.hits[props.componentId] && state.hits[props.componentId].total,
1864
- hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden
2887
+ hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
2888
+ AIResponse: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response || null,
2889
+ isAIResponseLoading: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].isLoading,
2890
+ AIResponseError: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].error,
2891
+ sessionIdFromStore: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.sessionId || '',
2892
+ isAITyping: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.isTyping || false
1865
2893
  };
1866
2894
  };
1867
2895
  var mapDispatchToProps = {
1868
2896
  updateQuery: updateQuery,
1869
2897
  setCustomQuery: setCustomQuery,
1870
2898
  setDefaultQuery: setDefaultQuery,
1871
- recordSuggestionClick: recordSuggestionClick
2899
+ recordSuggestionClick: recordSuggestionClick,
2900
+ recordAISessionUsefulness: recordAISessionUsefulness
1872
2901
  };
1873
2902
  var SBConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps, mapDispatchToProps)(SearchBox), {
1874
2903
  componentType: componentTypes.searchBox,
@@ -1884,9 +2913,812 @@ SBConnected.install = function (Vue) {
1884
2913
  // Add componentType for SSR
1885
2914
  SBConnected.componentType = componentTypes.searchBox;
1886
2915
 
1887
- var _templateObject$5, _templateObject2$1;
1888
- var HierarchicalMenuList = styled('ul')(_templateObject$5 || (_templateObject$5 = _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"])));
1889
- var HierarchicalMenuListItem = styled('li')(_templateObject2$1 || (_templateObject2$1 = _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) {
2916
+ var _excluded$1 = ["_source"];
2917
+ function _isSlot$1(s) {
2918
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
2919
+ }
2920
+ var md$1 = new Remarkable();
2921
+ md$1.set({
2922
+ html: true,
2923
+ breaks: true,
2924
+ xhtmlOut: true,
2925
+ linkify: true,
2926
+ linkTarget: '_blank'
2927
+ });
2928
+ var _inputWrapperRef = 'inputWrapperRef';
2929
+ var _inputRef = 'inputRef';
2930
+ var _errorContainerRef = 'errorContainerRef';
2931
+ var AIAnswer = defineComponent({
2932
+ name: 'AIAnswer',
2933
+ data: function data() {
2934
+ var props = this.$props;
2935
+ this.__state = {
2936
+ messages: [],
2937
+ inputMessage: '',
2938
+ AISessionId: '',
2939
+ error: null,
2940
+ sourceDocIds: null,
2941
+ initialHits: null,
2942
+ isTriggered: false
2943
+ };
2944
+ this.internalComponent = props.componentId + "__internal";
2945
+ return this.__state;
2946
+ },
2947
+ inject: {
2948
+ theme: {
2949
+ from: 'theme_reactivesearch'
2950
+ }
2951
+ },
2952
+ created: function created() {
2953
+ if (this.$props.triggerOn === AI_TRIGGER_MODES.ALWAYS) {
2954
+ this.isTriggered = true;
2955
+ } else if (this.$props.triggerOn === AI_TRIGGER_MODES.QUESTION && this.dependentComponentValue && this.dependentComponentValue.endsWith('?')) {
2956
+ this.isTriggered = true;
2957
+ if (this.AISessionId) {
2958
+ this.handleSendMessage(null, false, '', true);
2959
+ }
2960
+ }
2961
+ },
2962
+ computed: {
2963
+ hasCustomRenderer: function hasCustomRenderer$1() {
2964
+ return hasCustomRenderer(this);
2965
+ },
2966
+ isLoadingState: function isLoadingState() {
2967
+ return this.isAIResponseLoading || this.isLoading;
2968
+ },
2969
+ shouldShowComponent: function shouldShowComponent() {
2970
+ return this.showComponent;
2971
+ },
2972
+ errorMessageForMissingSessionId: function errorMessageForMissingSessionId() {
2973
+ return "AISessionId for " + this.$props.componentId + " is missing! AIAnswer component requires an AISessionId to function. Try reloading the App.";
2974
+ },
2975
+ hasTriggered: function hasTriggered() {
2976
+ return this.isTriggered;
2977
+ }
2978
+ },
2979
+ props: {
2980
+ componentId: types.string.isRequired,
2981
+ showVoiceInput: VueTypes.bool.def(false),
2982
+ showFeedback: VueTypes.bool.def(true),
2983
+ showIcon: VueTypes.bool.def(true),
2984
+ onData: types.func,
2985
+ innerRef: VueTypes.string.def('AISearchInputField'),
2986
+ react: types.react,
2987
+ enableAI: VueTypes.bool.def(true),
2988
+ AIConfig: types.AIConfig,
2989
+ iconPosition: types.iconPosition.def('left'),
2990
+ themePreset: types.themePreset,
2991
+ theme: types.style,
2992
+ icon: types.children,
2993
+ iconURL: VueTypes.string.def(''),
2994
+ renderMic: types.func,
2995
+ getMicInstance: types.func,
2996
+ innerClass: types.style,
2997
+ placeholder: VueTypes.string.def('Ask a question'),
2998
+ title: types.title,
2999
+ AIResponse: types.componentObject,
3000
+ isAIResponseLoading: VueTypes.bool.def(false),
3001
+ AIResponseError: types.componentObject,
3002
+ getAIResponse: types.func.isRequired,
3003
+ enterButton: types.bool,
3004
+ renderEnterButton: types.title,
3005
+ showInput: VueTypes.bool.def(true),
3006
+ clearSessionOnDestroy: VueTypes.bool.def(true),
3007
+ rawData: types.rawData,
3008
+ render: types.func,
3009
+ onError: types.func,
3010
+ renderError: types.title,
3011
+ isLoading: types.boolRequired,
3012
+ sessionIdFromStore: VueTypes.string,
3013
+ showComponent: types.boolRequired,
3014
+ componentError: types.componentObject,
3015
+ style: types.style,
3016
+ showSourceDocuments: VueTypes.bool.def(false),
3017
+ renderSourceDocument: types.func,
3018
+ onSourceClick: types.func,
3019
+ isAITyping: types.boolRequired,
3020
+ triggerOn: VueTypes.string.def(AI_TRIGGER_MODES.ALWAYS),
3021
+ renderTriggerMessage: types.func
3022
+ },
3023
+ mounted: function mounted() {},
3024
+ watch: {
3025
+ AIResponse: function AIResponse(newVal) {
3026
+ if (newVal) {
3027
+ if (this.$props.showSourceDocuments && newVal.response && newVal.response.answer && Array.isArray(newVal.response.answer.documentIds)) {
3028
+ this.sourceDocIds = newVal.response.answer.documentIds;
3029
+ var localCache = getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) && getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY)[this.$props.componentId];
3030
+ if (localCache && localCache.meta && localCache.meta.hits) {
3031
+ this.initialHits = localCache.meta.hits;
3032
+ }
3033
+ }
3034
+ this.AISessionId = ((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || (((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).response || {}).sessionId;
3035
+ var messagesHistory = newVal.messages,
3036
+ response = newVal.response;
3037
+ var finalMessages = [];
3038
+ if (response && response.error) {
3039
+ this.error = {
3040
+ message: response.error
3041
+ };
3042
+ }
3043
+ // pushing message history so far
3044
+ if (messagesHistory && Array.isArray(messagesHistory)) {
3045
+ finalMessages.push.apply(finalMessages, messagesHistory.filter(function (msg) {
3046
+ return msg.role !== AI_ROLES.SYSTEM;
3047
+ }));
3048
+ if (finalMessages[0].role === AI_ROLES.USER) {
3049
+ finalMessages.shift();
3050
+ }
3051
+ } else if (response && response.answer && response.answer.text) {
3052
+ finalMessages.push({
3053
+ role: AI_ROLES.ASSISTANT,
3054
+ content: response.answer.text
3055
+ });
3056
+ if (!this.AISessionId) this.error = {
3057
+ message: this.errorMessageForMissingSessionId
3058
+ };
3059
+ }
3060
+ this.messages = finalMessages;
3061
+ } else if (!newVal && !this.error) {
3062
+ this.messages = [];
3063
+ }
3064
+ },
3065
+ rawData: function rawData(newVal) {
3066
+ this.$emit('on-data', {
3067
+ data: this.messages,
3068
+ rawData: newVal,
3069
+ loading: this.$props.isAIResponseLoading || this.$props.isLoading,
3070
+ error: this.$props.AIResponseError
3071
+ });
3072
+ if (newVal && newVal.hits && newVal.hits.hits) {
3073
+ this.initialHits = newVal.hits.hits;
3074
+ }
3075
+ },
3076
+ isAIResponseLoading: function isAIResponseLoading(newVal) {
3077
+ this.$emit('on-data', {
3078
+ data: this.messages,
3079
+ rawData: this.$props.rawData,
3080
+ loading: newVal || this.isLoading,
3081
+ error: this.$props.AIResponseError
3082
+ });
3083
+ },
3084
+ isLoading: function isLoading(newVal) {
3085
+ this.$emit('on-data', {
3086
+ data: this.messages,
3087
+ rawData: this.$props.rawData,
3088
+ loading: newVal || this.isAIResponseLoading,
3089
+ error: this.$props.AIResponseError
3090
+ });
3091
+ },
3092
+ sessionIdFromStore: function sessionIdFromStore(newVal) {
3093
+ if (newVal) {
3094
+ this.sessionId = newVal;
3095
+ }
3096
+ },
3097
+ AIResponseError: function AIResponseError(newVal) {
3098
+ this.error = newVal;
3099
+ this.AISessionId = ((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || (((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).response || {}).sessionId;
3100
+ if (this.error && !this.AISessionId) {
3101
+ var errorMessage = this.errorMessageForMissingSessionId;
3102
+ this.error = {
3103
+ message: errorMessage
3104
+ };
3105
+ console.error(errorMessage);
3106
+ }
3107
+ this.$emit('on-data', {
3108
+ data: this.messages,
3109
+ rawData: this.$props.rawData,
3110
+ loading: this.isAIResponseLoading || this.isLoading,
3111
+ error: newVal
3112
+ });
3113
+ },
3114
+ messages: function messages() {
3115
+ this.scrollToBottom();
3116
+ },
3117
+ componentError: function componentError(newVal) {
3118
+ var _this = this;
3119
+ if (newVal && newVal._bodyBlob) {
3120
+ this.AISessionId = ((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || (((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).response || {}).sessionId;
3121
+ if (!this.AISessionId) {
3122
+ this.generateNewSessionId();
3123
+ }
3124
+ newVal._bodyBlob.text().then(function (textData) {
3125
+ try {
3126
+ var parsedErrorRes = JSON.parse(textData);
3127
+ if (parsedErrorRes.error) {
3128
+ _this.error = parsedErrorRes.error;
3129
+ _this.$emit('on-data', {
3130
+ data: _this.messages,
3131
+ rawData: _this.$props.rawData,
3132
+ loading: _this.$props.isAIResponseLoading || _this.$props.isLoading,
3133
+ error: parsedErrorRes.error
3134
+ });
3135
+ }
3136
+ } catch (error) {
3137
+ console.error('Error parsing component error JSON:', error);
3138
+ }
3139
+ })["catch"](function (error) {
3140
+ console.error('Error reading component error text data:', error);
3141
+ });
3142
+ }
3143
+ },
3144
+ showComponent: function showComponent() {
3145
+ if (this.$props.triggerOn === AI_TRIGGER_MODES.QUESTION && this.$props.dependentComponentValue.endsWith('?')) {
3146
+ this.isTriggered = true;
3147
+ }
3148
+ },
3149
+ dependentComponentValue: function dependentComponentValue(newVal) {
3150
+ if (this.$props.triggerOn === AI_TRIGGER_MODES.QUESTION && newVal && newVal.endsWith('?')) {
3151
+ this.isTriggered = true;
3152
+ if (this.AISessionId) {
3153
+ this.handleSendMessage(null, false, '', true);
3154
+ }
3155
+ } else if (this.hasTriggered && this.$props.triggerOn !== AI_TRIGGER_MODES.ALWAYS) {
3156
+ this.isTriggered = false;
3157
+ }
3158
+ },
3159
+ AISessionId: function AISessionId(newVal) {
3160
+ if (newVal) {
3161
+ if (this.$props.triggerOn === AI_TRIGGER_MODES.QUESTION && this.dependentComponentValue && this.dependentComponentValue.endsWith('?') || this.$props.triggerOn === AI_TRIGGER_MODES.ALWAYS) {
3162
+ this.handleSendMessage(null, false, '', true);
3163
+ }
3164
+ }
3165
+ },
3166
+ triggerOn: function triggerOn(newVal) {
3167
+ if (newVal === AI_TRIGGER_MODES.ALWAYS) {
3168
+ this.isTriggered = true;
3169
+ }
3170
+ }
3171
+ },
3172
+ methods: {
3173
+ renderTriggerMessageFunc: function renderTriggerMessageFunc() {
3174
+ var triggerOn = this.$props.triggerOn;
3175
+ if (this.$props.renderTriggerMessage) {
3176
+ return this.$props.renderTriggerMessage;
3177
+ }
3178
+ if (this.$slots.renderTriggerMessage) {
3179
+ return this.$slots.renderTriggerMessage();
3180
+ }
3181
+ if (triggerOn === AI_TRIGGER_MODES.QUESTION) {
3182
+ if (!this.dependentComponentValue.endsWith('?')) {
3183
+ return createVNode("span", null, [createVNode("span", {
3184
+ "role": "img",
3185
+ "aria-label": "bulb"
3186
+ }, [createTextVNode("\uD83D\uDCA1")]), createTextVNode("End your question with a question mark (?)")]);
3187
+ }
3188
+ } else if (triggerOn === AI_TRIGGER_MODES.MANUAL) {
3189
+ return createVNode("span", null, [createTextVNode("Click here to ask AI"), ' ', createVNode("span", {
3190
+ "role": "img",
3191
+ "aria-label": "bulb"
3192
+ }, [createTextVNode("\uD83E\uDD16")])]);
3193
+ }
3194
+ return null;
3195
+ },
3196
+ handleTriggerClick: function handleTriggerClick() {
3197
+ if (this.$props.triggerOn === AI_TRIGGER_MODES.MANUAL) {
3198
+ this.handleSendMessage(null, false, '', true);
3199
+ this.isTriggered = true;
3200
+ }
3201
+ },
3202
+ getAISourceObjects: function getAISourceObjects() {
3203
+ var _this2 = this;
3204
+ var sourceObjects = [];
3205
+ if (!this.AIResponse) return sourceObjects;
3206
+ var docIds = this.sourceDocIds || [];
3207
+ if (this.initialHits) {
3208
+ docIds.forEach(function (id) {
3209
+ var foundSourceObj = _this2.initialHits.find(function (hit) {
3210
+ return hit._id === id;
3211
+ }) || {};
3212
+ if (foundSourceObj) {
3213
+ var _foundSourceObj$_sour = foundSourceObj._source,
3214
+ _source = _foundSourceObj$_sour === void 0 ? {} : _foundSourceObj$_sour,
3215
+ rest = _objectWithoutPropertiesLoose(foundSourceObj, _excluded$1);
3216
+ sourceObjects.push(_extends({}, rest, _source));
3217
+ }
3218
+ });
3219
+ } else {
3220
+ sourceObjects.push.apply(sourceObjects, docIds.map(function (id) {
3221
+ return {
3222
+ _id: id
3223
+ };
3224
+ }));
3225
+ }
3226
+ return sourceObjects;
3227
+ },
3228
+ renderAIScreenFooter: function renderAIScreenFooter() {
3229
+ var _slot2;
3230
+ var _this3 = this;
3231
+ var _ref = this.$props || {},
3232
+ _ref$showSourceDocume = _ref.showSourceDocuments,
3233
+ showSourceDocuments = _ref$showSourceDocume === void 0 ? true : _ref$showSourceDocume,
3234
+ _ref$onSourceClick = _ref.onSourceClick,
3235
+ onSourceClick = _ref$onSourceClick === void 0 ? function () {} : _ref$onSourceClick,
3236
+ renderSourceDocument = _ref.renderSourceDocument;
3237
+ var customRenderSourceDoc = renderSourceDocument || this.$slots.renderSourceDocument;
3238
+ if (this.isLoadingState || this.isAITyping) {
3239
+ return null;
3240
+ }
3241
+ var renderSourceDocumentLabel = function renderSourceDocumentLabel(sourceObj) {
3242
+ if (customRenderSourceDoc) {
3243
+ return customRenderSourceDoc(sourceObj);
3244
+ }
3245
+ return sourceObj._id;
3246
+ };
3247
+ return showSourceDocuments && Array.isArray(this.sourceDocIds) && this.sourceDocIds.length ? createVNode(Footer, {
3248
+ "themePreset": this.$props.themePreset,
3249
+ "style": {
3250
+ marginTop: '1.5rem',
3251
+ background: 'inherit'
3252
+ }
3253
+ }, {
3254
+ "default": function _default() {
3255
+ return [createTextVNode("Summary generated using the following sources:"), ' ', createVNode(SourceTags, null, _isSlot$1(_slot2 = _this3.getAISourceObjects().map(function (el) {
3256
+ var _slot;
3257
+ return createVNode(Button, {
3258
+ "class": "--ai-source-tag " + (getClassName$2(_this3.$props.innerClass, 'ai-source-tag') || ''),
3259
+ "info": true,
3260
+ "onClick": function onClick() {
3261
+ return onSourceClick && onSourceClick(el);
3262
+ },
3263
+ "key": el._id
3264
+ }, _isSlot$1(_slot = renderSourceDocumentLabel(el)) ? _slot : {
3265
+ "default": function _default() {
3266
+ return [_slot];
3267
+ }
3268
+ });
3269
+ })) ? _slot2 : {
3270
+ "default": function _default() {
3271
+ return [_slot2];
3272
+ }
3273
+ })];
3274
+ }
3275
+ }) : null;
3276
+ },
3277
+ generateNewSessionId: function generateNewSessionId() {
3278
+ var _this4 = this;
3279
+ var newSessionPromise = this.createAISession();
3280
+ newSessionPromise.then(function (res) {
3281
+ _this4.AISessionId = res.AIsessionId;
3282
+ })["catch"](function (e) {
3283
+ console.error(e);
3284
+ });
3285
+ },
3286
+ scrollToBottom: function scrollToBottom() {
3287
+ var _this5 = this;
3288
+ this.$nextTick(function () {
3289
+ var _this5$$refs;
3290
+ var messageContainer = (_this5$$refs = _this5.$refs) == null ? void 0 : _this5$$refs[_this5.$props.innerRef];
3291
+ if (messageContainer && messageContainer.$el) {
3292
+ messageContainer.$el.scrollTo({
3293
+ top: messageContainer.$el.scrollHeight,
3294
+ behavior: 'smooth'
3295
+ });
3296
+ }
3297
+ });
3298
+ },
3299
+ handleMessageInputChange: function handleMessageInputChange(e) {
3300
+ this.inputMessage = e.target.value;
3301
+ this.handleTextAreaHeightChange();
3302
+ },
3303
+ handleSendMessage: function handleSendMessage(e, isRetry, text, fetchMeta) {
3304
+ if (isRetry === void 0) {
3305
+ isRetry = false;
3306
+ }
3307
+ if (text === void 0) {
3308
+ text = this.inputMessage;
3309
+ }
3310
+ if (fetchMeta === void 0) {
3311
+ fetchMeta = false;
3312
+ }
3313
+ if (typeof e === 'object' && e !== null) e.preventDefault();
3314
+ if (text.trim() || !text && !e) {
3315
+ if (this.isLoadingState) {
3316
+ return;
3317
+ }
3318
+ if (this.AISessionId) {
3319
+ if (!isRetry) {
3320
+ var finalMessages = [].concat(this.messages);
3321
+ if (text) {
3322
+ finalMessages.push({
3323
+ content: text,
3324
+ role: AI_ROLES.USER
3325
+ });
3326
+ }
3327
+ this.messages = [].concat(finalMessages);
3328
+ }
3329
+ this.getAIResponse(this.AISessionId, this.componentId, text, fetchMeta);
3330
+ } else {
3331
+ console.error(this.errorMessageForMissingSessionId);
3332
+ this.error = {
3333
+ message: "AISessionId for " + this.$props.componentId + " is missing! AIAnswer component requires an AISessionId to function. Trying reloading the App."
3334
+ };
3335
+ }
3336
+ this.inputMessage = '';
3337
+ }
3338
+ },
3339
+ handleRetryRequest: function handleRetryRequest() {
3340
+ if (this.messages && !this.isLoadingState) {
3341
+ var _this$messages;
3342
+ var lastUserRequestMessage = (_this$messages = this.messages[this.messages.length - 1]) == null ? void 0 : _this$messages.content;
3343
+ if (this.AISessionId) {
3344
+ this.getAIResponse(this.AISessionId, this.componentId, lastUserRequestMessage);
3345
+ this.inputMessage = '';
3346
+ } else {
3347
+ console.error("AISessionId for " + this.componentId + " is missing! AIAnswer component requires an AISessionId to function. Try reloading the App.");
3348
+ }
3349
+ }
3350
+ },
3351
+ renderErrorComponent: function renderErrorComponent() {
3352
+ var renderError = this.$slots.renderError || this.$props.renderError;
3353
+ if (this.error && !this.isLoadingState) {
3354
+ var _this$error, _this$error2;
3355
+ if (renderError) {
3356
+ return createVNode("div", {
3357
+ "ref": _errorContainerRef,
3358
+ "class": "--ai-answer-error-container " + (getClassName$2(this.$props.innerClass, 'ai-error') || '')
3359
+ }, [isFunction(renderError) ? renderError(this.error, this.handleRetryRequest) : renderError]);
3360
+ }
3361
+ return createVNode("div", {
3362
+ "ref": _errorContainerRef,
3363
+ "class": "--ai-answer-error-container " + (getClassName$2(this.$props.innerClass, 'ai-error') || '')
3364
+ }, [createVNode("div", {
3365
+ "class": "--default-error-element"
3366
+ }, [createVNode("span", null, [(_this$error = this.error) != null && _this$error.message ? this.error.message : 'There was an error in generating the response.', ' ', (_this$error2 = this.error) != null && _this$error2.code ? ", Code:\n\t\t\t\t\t\t\t" + this.error.code : '']), this.AISessionId && createVNode(Button, {
3367
+ "primary": true,
3368
+ "onClick": this.handleRetryRequest
3369
+ }, {
3370
+ "default": function _default() {
3371
+ return [createTextVNode("Try again")];
3372
+ }
3373
+ })])]);
3374
+ }
3375
+ return null;
3376
+ },
3377
+ handleKeyPress: function handleKeyPress(e) {
3378
+ if (e.key === 'Enter') {
3379
+ this.handleSendMessage(e);
3380
+ this.inputMessage = '';
3381
+ }
3382
+ },
3383
+ renderIcon: function renderIcon() {
3384
+ if (this.$props.showIcon) {
3385
+ if (this.$props.icon) {
3386
+ return this.$props.icon;
3387
+ }
3388
+ if (this.$slots.icon) {
3389
+ return this.$slots.icon();
3390
+ }
3391
+ if (this.$props.iconURL) {
3392
+ return createVNode("img", {
3393
+ "style": {
3394
+ maxHeight: '25px'
3395
+ },
3396
+ "src": this.$props.iconURL,
3397
+ "alt": "search-icon"
3398
+ }, null);
3399
+ }
3400
+ return createVNode(SearchSvg, null, null);
3401
+ }
3402
+ return null;
3403
+ },
3404
+ shouldMicRender: function shouldMicRender(showVoiceSearch) {
3405
+ // checks for SSR
3406
+ if (typeof window === 'undefined') return false;
3407
+ return showVoiceSearch && (window.webkitSpeechRecognition || window.SpeechRecognition);
3408
+ },
3409
+ handleVoiceResults: function handleVoiceResults(_ref2) {
3410
+ var results = _ref2.results;
3411
+ if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
3412
+ this.handleSendMessage(null, false, results[0][0].transcript.trim());
3413
+ }
3414
+ },
3415
+ renderIcons: function renderIcons() {
3416
+ var _this6 = this;
3417
+ var _slot3, _slot4;
3418
+ var _this$$props = this.$props,
3419
+ getMicInstance = _this$$props.getMicInstance,
3420
+ showVoiceInput = _this$$props.showVoiceInput,
3421
+ iconPosition = _this$$props.iconPosition,
3422
+ innerClass = _this$$props.innerClass;
3423
+ var renderMic = this.$slots.renderMic || this.$props.renderMic;
3424
+ return createVNode("div", null, [createVNode(IconGroup, {
3425
+ "enableAI": true,
3426
+ "groupPosition": "right",
3427
+ "positionType": "absolute"
3428
+ }, {
3429
+ "default": function _default() {
3430
+ return [!_this6.isLoadingState && _this6.AISessionId && _this6.shouldMicRender(showVoiceInput) && createVNode(Mic, {
3431
+ "getInstance": getMicInstance,
3432
+ "render": renderMic,
3433
+ "handleResult": _this6.handleVoiceResults,
3434
+ "class": getClassName$2(innerClass, 'ai-search-mic') || null
3435
+ }, null), iconPosition === 'right' && createVNode(IconWrapper, null, _isSlot$1(_slot3 = _this6.renderIcon()) ? _slot3 : {
3436
+ "default": function _default() {
3437
+ return [_slot3];
3438
+ }
3439
+ })];
3440
+ }
3441
+ }), createVNode(IconGroup, {
3442
+ "enableAI": true,
3443
+ "groupPosition": "left",
3444
+ "positionType": "absolute"
3445
+ }, {
3446
+ "default": function _default() {
3447
+ return [iconPosition === 'left' && createVNode(IconWrapper, null, _isSlot$1(_slot4 = _this6.renderIcon()) ? _slot4 : {
3448
+ "default": function _default() {
3449
+ return [_slot4];
3450
+ }
3451
+ })];
3452
+ }
3453
+ })]);
3454
+ },
3455
+ enterButtonOnClick: function enterButtonOnClick(e) {
3456
+ this.handleSendMessage(e);
3457
+ },
3458
+ renderEnterButtonElement: function renderEnterButtonElement() {
3459
+ var _this7 = this;
3460
+ var _this$$props2 = this.$props,
3461
+ enterButton = _this$$props2.enterButton,
3462
+ innerClass = _this$$props2.innerClass;
3463
+ var renderEnterButton = this.$slots.renderEnterButton;
3464
+ if (enterButton) {
3465
+ var getEnterButtonMarkup = function getEnterButtonMarkup() {
3466
+ if (renderEnterButton) {
3467
+ return renderEnterButton(_this7.enterButtonOnClick);
3468
+ }
3469
+ return createVNode(SendButton, {
3470
+ "primary": true,
3471
+ "type": "submit",
3472
+ "tabIndex": 0,
3473
+ "onClick": _this7.handleSendMessage,
3474
+ "onKeyPress": _this7.handleKeyPress,
3475
+ "class": "ask-btn " + getClassName$2(innerClass, 'ai-enter-button'),
3476
+ "disabled": _this7.isLoadingState || !_this7.AISessionId
3477
+ }, {
3478
+ "default": function _default() {
3479
+ return [createTextVNode("Send")];
3480
+ }
3481
+ });
3482
+ };
3483
+ return createVNode("div", {
3484
+ "class": "ai-enter-button-wrapper"
3485
+ }, [getEnterButtonMarkup()]);
3486
+ }
3487
+ return null;
3488
+ },
3489
+ getComponent: function getComponent$1() {
3490
+ var data = {
3491
+ error: this.AIResponseError,
3492
+ loading: this.isAIResponseLoading,
3493
+ data: this.messages,
3494
+ rawData: this.rawData
3495
+ };
3496
+ return getComponent(data, this);
3497
+ },
3498
+ handleTextAreaHeightChange: function handleTextAreaHeightChange() {
3499
+ var _this$$refs, _this$$refs2, _this$$refs3;
3500
+ var textArea = (_this$$refs = this.$refs) == null || (_this$$refs = _this$$refs[_inputRef]) == null ? void 0 : _this$$refs.$el;
3501
+ var inputWrapper = (_this$$refs2 = this.$refs) == null || (_this$$refs2 = _this$$refs2[_inputWrapperRef]) == null ? void 0 : _this$$refs2.$el;
3502
+ var errorContainer = (_this$$refs3 = this.$refs) == null ? void 0 : _this$$refs3[_errorContainerRef];
3503
+ if (textArea) {
3504
+ textArea.style.height = '42px';
3505
+ var lineHeight = parseInt(getComputedStyle(textArea).lineHeight, 10);
3506
+ var maxHeight = lineHeight * 11; // max height for 10 lines
3507
+ var height = Math.min(textArea.scrollHeight, maxHeight);
3508
+ textArea.style.height = height + "px";
3509
+ textArea.style.overflowY = height === maxHeight ? 'auto' : 'hidden';
3510
+ // wrapper around input/ textarea
3511
+ inputWrapper.style.height = height + "px";
3512
+ // adjust error-container
3513
+
3514
+ if (errorContainer) {
3515
+ errorContainer.style.bottom = height + "px";
3516
+ }
3517
+ this.$forceUpdate();
3518
+ }
3519
+ },
3520
+ getTitle: function getTitle() {
3521
+ var _this8 = this;
3522
+ var hasTitle = this.$props.title || this.$slots.title || null;
3523
+ if (hasTitle) {
3524
+ return createVNode(Title, {
3525
+ "class": getClassName$2(this.$props.innerClass, 'ai-title') || null
3526
+ }, {
3527
+ "default": function _default() {
3528
+ return [_this8.$props.title || _this8.$slots.title()];
3529
+ }
3530
+ });
3531
+ }
3532
+ return null;
3533
+ }
3534
+ },
3535
+ beforeUnmount: function beforeUnmount() {
3536
+ if (this.$props.clearSessionOnDestroy) {
3537
+ // cleanup logic
3538
+ // final Object to store in local storage cache
3539
+ var finalCacheObj = getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {};
3540
+ // delete current component's cache
3541
+ delete finalCacheObj[this.$props.componentId];
3542
+ // update local cache
3543
+ setObjectInLocalStorage(AI_LOCAL_CACHE_KEY, finalCacheObj);
3544
+ }
3545
+ },
3546
+ render: function render() {
3547
+ var _slot5;
3548
+ var _this9 = this;
3549
+ var props = this.$props;
3550
+ if (!this.shouldShowComponent) {
3551
+ return null;
3552
+ }
3553
+ if (!this.isTriggered) {
3554
+ return createVNode(Chatbox, {
3555
+ "style": props.style || {}
3556
+ }, {
3557
+ "default": function _default() {
3558
+ return [_this9.getTitle(), createVNode("div", {
3559
+ "class": "--trigger-message-wrapper",
3560
+ "onClick": _this9.handleTriggerClick,
3561
+ "aria-hidden": "true"
3562
+ }, [_this9.renderTriggerMessageFunc()])];
3563
+ }
3564
+ });
3565
+ }
3566
+ return createVNode(Chatbox, {
3567
+ "style": props.style || {}
3568
+ }, {
3569
+ "default": function _default() {
3570
+ return [_this9.getTitle(), createVNode(ChatContainer, {
3571
+ "class": "--ai-chat-container",
3572
+ "theme": props.theme,
3573
+ "showInput": props.showInput
3574
+ }, {
3575
+ "default": function _default() {
3576
+ return [_this9.hasCustomRenderer && createVNode(MessagesContainer, {
3577
+ "themePreset": _this9.themePreset,
3578
+ "theme": props.theme,
3579
+ "ref": _this9.$props.innerRef,
3580
+ "class": "--ai-message-container " + (getClassName$2(props.innerClass, 'ai-message-container') || '')
3581
+ }, _isSlot$1(_slot5 = _this9.getComponent()) ? _slot5 : {
3582
+ "default": function _default() {
3583
+ return [_slot5];
3584
+ }
3585
+ }), !_this9.hasCustomRenderer && createVNode(MessagesContainer, {
3586
+ "themePreset": _this9.themePreset,
3587
+ "theme": props.theme,
3588
+ "ref": _this9.$props.innerRef,
3589
+ "class": "--ai-message-container " + (getClassName$2(props.innerClass, 'ai-message-container') || '')
3590
+ }, {
3591
+ "default": function _default() {
3592
+ return [_this9.messages.map(function (message, index) {
3593
+ return createVNode(Message, {
3594
+ "key": index,
3595
+ "isSender": message.role === AI_ROLES.USER,
3596
+ "innerHTML": md$1.render(message.content),
3597
+ "themePreset": _this9.themePreset,
3598
+ "theme": props.theme,
3599
+ "class": "--ai-answer-message " + (getClassName$2(props.innerClass, 'ai-message') || '')
3600
+ }, null);
3601
+ }), _this9.isLoadingState && createVNode(Message, {
3602
+ "themePreset": _this9.themePreset,
3603
+ "theme": props.theme,
3604
+ "isSender": false,
3605
+ "class": "--ai-answer-message " + (getClassName$2(props.innerClass, 'ai-message') || null)
3606
+ }, {
3607
+ "default": function _default() {
3608
+ return [createVNode(TypingIndicator, null, {
3609
+ "default": function _default() {
3610
+ return [createVNode(TypingDot, {
3611
+ "themePreset": _this9.themePreset
3612
+ }, null), createVNode(TypingDot, {
3613
+ "themePreset": _this9.themePreset
3614
+ }, null), createVNode(TypingDot, {
3615
+ "themePreset": _this9.themePreset
3616
+ }, null)];
3617
+ }
3618
+ })];
3619
+ }
3620
+ })];
3621
+ }
3622
+ }), _this9.renderErrorComponent(), ' ', props.showFeedback && !_this9.isLoadingState && !_this9.isAITyping && createVNode("div", {
3623
+ "class": "--ai-answer-feedback-container " + (getClassName$2(props.innerClass, 'ai-feedback') || '')
3624
+ }, [createVNode(AIFeedback, {
3625
+ "hideUI": _this9.isLoadingState || !_this9.sessionId,
3626
+ "key": _this9.sessionId,
3627
+ "onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
3628
+ _this9.trackUsefullness(_this9.sessionId, {
3629
+ useful: useful,
3630
+ reason: reason
3631
+ });
3632
+ }
3633
+ }, null)]), ' ', _this9.renderAIScreenFooter(), props.showInput && !_this9.isLoadingState && !_this9.isAITyping && createVNode(MessageInputContainer, {
3634
+ "class": "--ai-input-container",
3635
+ "onSubmit": _this9.handleSendMessage
3636
+ }, {
3637
+ "default": function _default() {
3638
+ return [createVNode(InputGroup, {
3639
+ "enableAI": true,
3640
+ "isOpen": false
3641
+ }, {
3642
+ "default": function _default() {
3643
+ return [createVNode(InputWrapper, {
3644
+ "ref": _inputWrapperRef
3645
+ }, {
3646
+ "default": function _default() {
3647
+ return [createVNode(MessageInput, {
3648
+ "ref": _inputRef,
3649
+ "placeholder": props.placeholder,
3650
+ "enterButton": props.enterButton,
3651
+ "value": _this9.inputMessage,
3652
+ "onInput": _this9.handleMessageInputChange,
3653
+ "id": props.componentId + "-ai-input",
3654
+ "showIcon": props.showIcon,
3655
+ "iconPosition": props.iconPosition,
3656
+ "themePreset": _this9.themePreset,
3657
+ "disabled": _this9.isLoadingState || !_this9.AISessionId,
3658
+ "class": getClassName$2(props.innerClass, 'ai-input') || null
3659
+ }, null), ' ', _this9.renderIcons()];
3660
+ }
3661
+ })];
3662
+ }
3663
+ }), _this9.renderEnterButtonElement()];
3664
+ }
3665
+ }), ' '];
3666
+ }
3667
+ })];
3668
+ }
3669
+ });
3670
+ }
3671
+ });
3672
+ AIAnswer.hasInternalComponent = function () {
3673
+ return true;
3674
+ };
3675
+ var mapStateToProps$1 = function mapStateToProps(state, props) {
3676
+ var dependencyComponent = Object.values(props.react)[0];
3677
+ if (Array.isArray(dependencyComponent)) {
3678
+ // eslint-disable-next-line prefer-destructuring
3679
+ dependencyComponent = dependencyComponent[0];
3680
+ }
3681
+ var showComponent = !!(state.selectedValues[dependencyComponent] && state.selectedValues[dependencyComponent].value);
3682
+ var dependentComponentValue = state.selectedValues[dependencyComponent] && state.selectedValues[dependencyComponent].value || '';
3683
+ return {
3684
+ showComponent: showComponent,
3685
+ dependentComponentValue: dependentComponentValue,
3686
+ AIResponse: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response,
3687
+ isAIResponseLoading: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].isLoading,
3688
+ AIResponseError: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].error,
3689
+ rawData: state.rawData[props.componentId],
3690
+ themePreset: state.config.themePreset,
3691
+ isLoading: state.isLoading[props.componentId] || false,
3692
+ sessionIdFromStore: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.sessionId || '',
3693
+ componentError: state.error[props.componentId] || null,
3694
+ isAITyping: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.isTyping || false
3695
+ };
3696
+ };
3697
+ var mapDispatchToProps$1 = {
3698
+ getAIResponse: function getAIResponse(sessionId, componentId, message, shouldFetchMeta) {
3699
+ if (shouldFetchMeta === void 0) {
3700
+ shouldFetchMeta = false;
3701
+ }
3702
+ return fetchAIResponse(sessionId, componentId, message, null, shouldFetchMeta);
3703
+ },
3704
+ trackUsefullness: recordAISessionUsefulness,
3705
+ createAISession: createAISession
3706
+ };
3707
+ var AIConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps$1, mapDispatchToProps$1)(AIAnswer), {
3708
+ componentType: componentTypes.AIAnswer,
3709
+ internalComponent: true
3710
+ }));
3711
+ AIConnected.name = AIAnswer.name;
3712
+ AIConnected.hasInternalComponent = AIAnswer.hasInternalComponent;
3713
+ AIConnected.install = function (Vue) {
3714
+ Vue.component(AIConnected.name, AIConnected);
3715
+ };
3716
+ // Add componentType for SSR
3717
+ AIConnected.componentType = componentTypes.AIAnswer;
3718
+
3719
+ var _templateObject$9, _templateObject2$4;
3720
+ var HierarchicalMenuList = styled('ul')(_templateObject$9 || (_templateObject$9 = _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"])));
3721
+ var HierarchicalMenuListItem = styled('li')(_templateObject2$4 || (_templateObject2$4 = _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) {
1890
3722
  return !props.showLine && "\n\t\t\t\t\tdisplay: none;\n\t\t\t\t";
1891
3723
  });
1892
3724
 
@@ -2099,7 +3931,7 @@ var HierarchicalMenuListItemComponent = {
2099
3931
  }
2100
3932
  };
2101
3933
 
2102
- function _isSlot$1(s) {
3934
+ function _isSlot$2(s) {
2103
3935
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
2104
3936
  }
2105
3937
  var HierarchicalMenuComponent = {
@@ -2124,7 +3956,7 @@ var HierarchicalMenuComponent = {
2124
3956
  return createVNode(HierarchicalMenuList, {
2125
3957
  "class": "" + (isExpanded ? '--open' : ''),
2126
3958
  "isSelected": isExpanded
2127
- }, _isSlot$1(_slot = listArray.map(function (listItem) {
3959
+ }, _isSlot$2(_slot = listArray.map(function (listItem) {
2128
3960
  return createVNode(HierarchicalMenuListItemComponent, mergeProps({
2129
3961
  "key": parentPath + "__" + JSON.stringify(listItem),
2130
3962
  "parentPath": parentPath,
@@ -2138,7 +3970,7 @@ var HierarchicalMenuComponent = {
2138
3970
  }
2139
3971
  };
2140
3972
 
2141
- function _isSlot$2(s) {
3973
+ function _isSlot$3(s) {
2142
3974
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
2143
3975
  }
2144
3976
  var updateQueryAction = Actions.updateQuery,
@@ -2588,7 +4420,7 @@ var TreeList = {
2588
4420
  "default": function _default() {
2589
4421
  return [props.title && createVNode(Title, {
2590
4422
  "class": getClassName$2(innerClass, 'title') || null
2591
- }, _isSlot$2(title) ? title : {
4423
+ }, _isSlot$3(title) ? title : {
2592
4424
  "default": function _default() {
2593
4425
  return [title];
2594
4426
  }
@@ -2617,7 +4449,7 @@ var TreeList = {
2617
4449
  });
2618
4450
  }
2619
4451
  };
2620
- var mapStateToProps$1 = function mapStateToProps(state, props) {
4452
+ var mapStateToProps$2 = function mapStateToProps(state, props) {
2621
4453
  return {
2622
4454
  selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
2623
4455
  rawData: state.rawData[props.componentId] || {},
@@ -2635,7 +4467,7 @@ var mapDispatchtoProps = {
2635
4467
  TreeList.hasInternalComponent = function () {
2636
4468
  return true;
2637
4469
  };
2638
- var TreeListConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps$1, mapDispatchtoProps)(TreeList), {
4470
+ var TreeListConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps$2, mapDispatchtoProps)(TreeList), {
2639
4471
  componentType: componentTypes.treeList,
2640
4472
  internalComponent: TreeList.hasInternalComponent()
2641
4473
  }));
@@ -2703,7 +4535,7 @@ RcConnected.install = function (Vue) {
2703
4535
  Vue.component(RcConnected.name, RcConnected);
2704
4536
  };
2705
4537
 
2706
- var components = [ReactiveList, ResultCard, ResultList, ReactiveBase, SBConnected, SingleList, MultiList, SingleRange, MultiRange, RangeSlider, DynamicRangeSlider, ReactiveComponent, RcConnected, SelectedFilters, ToggleButton, SingleDropdownList, MultiDropdownList, StateProvider, RangeInput, TreeListConnected];
4538
+ var components = [ReactiveList, ResultCard, ResultList, ReactiveBase, SBConnected, SingleList, MultiList, SingleRange, MultiRange, RangeSlider, DynamicRangeSlider, ReactiveComponent, RcConnected, SelectedFilters, ToggleButton, SingleDropdownList, MultiDropdownList, StateProvider, RangeInput, TreeListConnected, AIConnected];
2707
4539
  function install (Vue) {
2708
4540
  components.map(function (component) {
2709
4541
  Vue.use(component);
@@ -2711,4 +4543,4 @@ function install (Vue) {
2711
4543
  });
2712
4544
  }
2713
4545
 
2714
- export { RcConnected as R, SBConnected as S, TreeListConnected as T, install as i };
4546
+ export { AIConnected as A, RcConnected as R, SBConnected as S, TreeListConnected as T, install as i };