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