@appbaseio/reactivesearch-vue 3.0.0-rc.1 → 3.0.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +7363 -649
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/{Button-d4da7470.js → Button-9e179864.js} +13 -6
  6. package/dist/cjs/{ComponentWrapper-9146d811.js → ComponentWrapper-0b9ffb1a.js} +3 -0
  7. package/dist/cjs/{DropDown-b16418e9.js → DropDown-aef75c14.js} +7 -4
  8. package/dist/cjs/DynamicRangeSlider.js +1 -1
  9. package/dist/cjs/{Input-497be42a.js → Input-56eba499.js} +71 -1
  10. package/dist/cjs/MultiDropdownList.js +6 -5
  11. package/dist/cjs/MultiList.js +3 -3
  12. package/dist/cjs/MultiRange.js +2 -2
  13. package/dist/cjs/{Pagination-b953a80a.js → Pagination-58a0cf3f.js} +2 -2
  14. package/dist/cjs/RangeInput.js +3 -3
  15. package/dist/cjs/RangeSlider.js +2 -2
  16. package/dist/cjs/ReactiveBase.js +4 -4
  17. package/dist/cjs/ReactiveComponent.js +2 -2
  18. package/dist/cjs/ReactiveGoogleMap.js +5 -4
  19. package/dist/cjs/ReactiveList.js +4 -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 +6 -5
  24. package/dist/cjs/SingleList.js +3 -3
  25. package/dist/cjs/SingleRange.js +2 -2
  26. package/dist/cjs/ToggleButton.js +4 -3
  27. package/dist/cjs/index.js +10 -7
  28. package/dist/cjs/{install-7cdf6798.js → install-b495bb2c.js} +1301 -158
  29. package/dist/cjs/install.js +9 -7
  30. package/dist/cjs/version.js +1 -1
  31. package/dist/cjs/{vueTypes-1bf00978.js → vueTypes-a5f1745e.js} +18 -0
  32. package/dist/es/{Button-fd869491.js → Button-c2ff5178.js} +13 -6
  33. package/dist/es/{ComponentWrapper-8a3c388d.js → ComponentWrapper-a2635cfc.js} +3 -0
  34. package/dist/es/{DropDown-fc1fef02.js → DropDown-39fedff8.js} +7 -4
  35. package/dist/es/DynamicRangeSlider.js +1 -1
  36. package/dist/es/{Input-f7499ef8.js → Input-11d211d2.js} +71 -2
  37. package/dist/es/MultiDropdownList.js +6 -5
  38. package/dist/es/MultiList.js +3 -3
  39. package/dist/es/MultiRange.js +2 -2
  40. package/dist/es/{Pagination-c2745bec.js → Pagination-ae401c33.js} +2 -2
  41. package/dist/es/RangeInput.js +3 -3
  42. package/dist/es/RangeSlider.js +2 -2
  43. package/dist/es/ReactiveBase.js +4 -4
  44. package/dist/es/ReactiveComponent.js +2 -2
  45. package/dist/es/ReactiveGoogleMap.js +5 -4
  46. package/dist/es/ReactiveList.js +4 -4
  47. package/dist/es/ResultCard.js +1 -1
  48. package/dist/es/ResultList.js +1 -1
  49. package/dist/es/SelectedFilters.js +3 -2
  50. package/dist/es/SingleDropdownList.js +6 -5
  51. package/dist/es/SingleList.js +3 -3
  52. package/dist/es/SingleRange.js +2 -2
  53. package/dist/es/ToggleButton.js +4 -3
  54. package/dist/es/index.js +10 -8
  55. package/dist/es/{install-0c7962bc.js → install-6011bce3.js} +1306 -164
  56. package/dist/es/install.js +9 -7
  57. package/dist/es/version.js +1 -1
  58. package/dist/es/{vueTypes-f1923c72.js → vueTypes-09cab4d3.js} +18 -0
  59. package/package.json +4 -3
@@ -1,28 +1,32 @@
1
1
  import { helper, Actions, causes } from '@appbaseio/reactivecore';
2
- import { SEARCH_COMPONENTS_MODES, componentTypes, TREELIST_VALUES_PATH_SEPARATOR } from '@appbaseio/reactivecore/lib/utils/constants';
2
+ import { SEARCH_COMPONENTS_MODES, componentTypes, AI_LOCAL_CACHE_KEY, AI_ROLES, TREELIST_VALUES_PATH_SEPARATOR } from '@appbaseio/reactivecore/lib/utils/constants';
3
3
  import _transformOn from '@vue/babel-helper-vue-transform-on';
4
- import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-ded08042.js';
5
- import { createVNode, createTextVNode, defineComponent, isVNode, mergeProps, h } from 'vue';
4
+ import { _ as _taggedTemplateLiteralLoose, a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-ded08042.js';
5
+ import { createVNode, createTextVNode, defineComponent, ref, watch, isVNode, mergeProps, h } from 'vue';
6
6
  import VueTypes from 'vue-types';
7
- import { getQueryOptions, suggestionTypes, recLookup, getClassName as getClassName$2, updateCustomQuery as updateCustomQuery$1, updateDefaultQuery as updateDefaultQuery$1, transformTreeListLocalStateIntoQueryComptaibleFormat, isEqual as isEqual$1, transformRawTreeListData, setDeep, getComponent as getComponent$1, getOptionsFromQuery, checkValueChange as checkValueChange$1, getAggsQuery, updateInternalQuery, isFunction as isFunction$1 } from '@appbaseio/reactivecore/lib/utils/helper';
7
+ import { getQueryOptions, getObjectFromLocalStorage, suggestionTypes, getClassName as getClassName$2, setObjectInLocalStorage, recLookup, updateCustomQuery as updateCustomQuery$1, updateDefaultQuery as updateDefaultQuery$1, transformTreeListLocalStateIntoQueryComptaibleFormat, isEqual as isEqual$1, transformRawTreeListData, setDeep, getComponent as getComponent$1, getOptionsFromQuery, checkValueChange as checkValueChange$1, getAggsQuery, updateInternalQuery, isFunction as isFunction$1 } from '@appbaseio/reactivecore/lib/utils/helper';
8
8
  import { styled, createGlobalStyle } from '@appbaseio/vue-emotion';
9
- import { css } from '@emotion/css';
10
- import { B as Button } from './Button-fd869491.js';
11
- import { t as types } from './vueTypes-f1923c72.js';
9
+ import { css, keyframes } from '@emotion/css';
10
+ import { lighten } from 'polished';
11
+ import { B as Button } from './Button-c2ff5178.js';
12
+ import { t as types } from './vueTypes-09cab4d3.js';
12
13
  import { RLConnected as ReactiveList } from './ReactiveList.js';
13
14
  import { getInternalComponentID } from '@appbaseio/reactivecore/lib/utils/transform';
14
15
  import { g as getComponent, h as hasCustomRenderer, f as decodeHtml, i as isQueryIdentical, u as updateDefaultQuery, j as updateCustomQuery, a as isFunction, k as isEmpty, p as parseFocusShortcuts, l as extractModifierKeysFromFocusShortcuts, c as connect } from './index-882489e1.js';
15
- import { C as ComponentWrapper } from './ComponentWrapper-8a3c388d.js';
16
+ import { C as ComponentWrapper } from './ComponentWrapper-a2635cfc.js';
16
17
  import { P as PreferencesConsumer } from './PreferencesConsumer-b058d14e.js';
17
18
  import { T as Title } from './Title-863dfa42.js';
18
19
  import { L as ListItem } from './ListItem-e3c6acf4.js';
19
20
  import { F as Flex } from './Flex-25792bc3.js';
21
+ import { recordAISessionUsefulness } from '@appbaseio/reactivecore/lib/actions/analytics';
20
22
  import ReactiveBase from './ReactiveBase.js';
21
23
  import hotkeys from 'hotkeys-js';
22
- import { I as IconWrapper, C as CancelSvg, a as IconGroup, D as Downshift, b as InputWrapper } from './DropDown-fc1fef02.js';
23
- import { n as noSuggestions, s as suggestionsContainer, I as Input, a as suggestions } from './Input-f7499ef8.js';
24
+ import { Remarkable } from 'remarkable';
25
+ import { I as IconWrapper, C as CancelSvg, a as IconGroup, D as Downshift, b as InputWrapper } from './DropDown-39fedff8.js';
26
+ import { n as noSuggestions, T as TextArea, I as Input, s as suggestionsContainer, a as suggestions } from './Input-11d211d2.js';
24
27
  import { C as Container } from './Container-d00219f7.js';
25
28
  import Highlight from 'vue-highlight-words';
29
+ import { fetchAIResponse } from '@appbaseio/reactivecore/lib/actions/query';
26
30
  import { replaceDiacritics } from '@appbaseio/reactivecore/lib/utils/suggestions';
27
31
  import { C as Checkbox, R as Radio } from './FormControlList-fe6eaee4.js';
28
32
  import { s as sanitizeObject } from './utils-d7dd4f4e.js';
@@ -44,7 +48,7 @@ import ResultList from './ResultList.js';
44
48
  import StateProvider from './StateProvider.js';
45
49
 
46
50
  var _templateObject;
47
- var InputGroup = styled('div')(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: stretch;\n width: 100%;\n"])));
51
+ var InputGroup = styled('div')(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: stretch;\n\twidth: 100%;\n"])));
48
52
  InputGroup.defaultProps = {
49
53
  className: 'input-group'
50
54
  };
@@ -752,9 +756,305 @@ var _templateObject$7, _templateObject2;
752
756
  var TagsContainer = styled('div')(_templateObject$7 || (_templateObject$7 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tmargin-top: 10px;\n\twidth: 100%;\n"])));
753
757
  var TagItem = styled('span')(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n\tcursor: default;\n\tbox-sizing: border-box;\n\tmargin: 0 4px 4px 0;\n\tcolor: #000000d9;\n\tfont-size: 14px;\n\tfont-variant: tabular-nums;\n\tline-height: 1.5715;\n\tlist-style: none;\n\tfont-feature-settings: 'tnum';\n\tdisplay: inline-block;\n\theight: auto;\n\tpadding: 0 2px 0 7px;\n\tfont-size: 12px;\n\tline-height: 22px;\n\twhite-space: nowrap;\n\tbackground: #fafafa;\n\tborder: 1px solid #d9d9d9;\n\tborder-radius: 2px;\n\topacity: 1;\n\ttransition: all 0.3s;\n\n\tspan.close-icon {\n\t\tsvg {\n\t\t\tcursor: pointer;\n\t\t\theight: 15px;\n\t\t\tposition: relative;\n\t\t\ttop: 4px;\n\t\t\tfill: #262626;\n\t\t}\n\t}\n"])));
754
758
 
759
+ var _templateObject$8, _templateObject2$1, _templateObject3;
760
+ var skeletonAnimation = keyframes(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteralLoose(["\n 0% {\n background-position: 100% 0;\n }\n 100% {\n background-position: -200% 0;\n }\n"])));
761
+ var SkeletonLoader = styled('div')(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n"])));
762
+ var SkeletonLine = styled('div')(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\theight: 20px;\n\tbackground: linear-gradient(\n\t\t90deg,\n\t\trgba(220, 220, 220, 0.5) 25%,\n\t\trgba(240, 240, 240, 0.9) 50%,\n\t\trgba(220, 220, 220, 0.5) 75%\n\t);\n\tbackground-size: 200% 100%;\n\tanimation: ", " 1.5s infinite;\n"])), skeletonAnimation);
763
+ var HorizontalSkeletonLoader = defineComponent({
764
+ name: 'HorizontalSkeletonLoader',
765
+ render: function render() {
766
+ return createVNode(SkeletonLoader, null, {
767
+ "default": function _default() {
768
+ return [createVNode(SkeletonLine, null, null), createVNode(SkeletonLine, null, null), createVNode(SkeletonLine, null, null), createVNode(SkeletonLine, null, null)];
769
+ }
770
+ });
771
+ }
772
+ });
773
+
774
+ var _templateObject$9, _templateObject2$2, _templateObject3$1, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
775
+ var Chatbox = styled('div')(_templateObject$9 || (_templateObject$9 = _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"])), function (props) {
776
+ return props.theme && props.theme.colors ? props.theme.colors.backgroundColor : '#fff';
777
+ });
778
+ var ChatContainer = styled('div')(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\theight: 100%;\n\tposition: relative;\n\t.--ai-answer-error-container {\n\t\ttext-align: center;\n\t\tposition: absolute;\n\t\tbottom: 0px;\n\t\t", ";\n\t\tz-index: 1;\n\t\tleft: 50%;\n\t\ttransform: translateX(-50%);\n\t\twidth: 100%;\n\n\t\t.--default-error-element {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\talign-items: center;\n\t\t\tpadding: 10px;\n\t\t\tbackground-color: ", ";\n\t\t\tbox-shadow: 0 -5px 5px -2px\n\t\t\t\t", ";\n\n\t\t\tspan {\n\t\t\t\tmargin-bottom: 5px;\n\t\t\t}\n\n\t\t\tbutton {\n\t\t\t}\n\t\t}\n\t}\n\n\t", ";\n"])), function (props) {
779
+ return props.showInput ? 'bottom: 48px;' : '';
780
+ }, function (props) {
781
+ return props.theme && props.theme.colors && props.theme.colors.backgroundColor ? props.theme.colors.backgroundColor : '#fff';
782
+ }, function (props) {
783
+ return props.theme && props.theme.colors && props.theme.colors.backgroundColor ? props.theme.colors.backgroundColor : '#fff';
784
+ }, function (props) {
785
+ 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}";
786
+ });
787
+ var MessagesContainer = styled('div')(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteralLoose(["\n\tmax-height: 400px;\n overflow-y: auto;\n\tpadding: 10px;\n\tdisplay: flex;\n\tflex-direction: column;\n\tmin-height: 200px;\n\n}};\n"])));
788
+ var typingDots = keyframes(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n 0% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(-70%);\n }\n 100% {\n transform: translateY(0);\n }\n"])));
789
+ var TypingIndicator = styled('div')(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tmargin: 5px !important;\n"])));
790
+ var TypingDot = styled('div')(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n\twidth: 6px;\n\theight: 6px;\n\tbackground-color: ", ";\n\tborder-radius: 50%;\n\tmargin: 0 2px !important;\n\tanimation: ", " 1s infinite;\n\t&:nth-child(2) {\n\t\tanimation-delay: 0.2s;\n\t}\n\t&:nth-child(3) {\n\t\tanimation-delay: 0.4s;\n\t}\n"])), function (props) {
791
+ var finalColor;
792
+ if (props.isSender) {
793
+ finalColor = props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor;
794
+ } else {
795
+ finalColor = props.themePreset !== 'dark' ? props.theme.colors.borderColor : props.theme.colors.textColor;
796
+ }
797
+ return finalColor;
798
+ }, typingDots);
799
+ var resetCSS = function resetCSS(props) {
800
+ 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}\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: " + (
801
+ // eslint-disable-next-line no-nested-ternary
802
+ props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryColor : props.theme.colors.borderColor : props.theme.colors.borderColor) + ";\n\t}\n\n\tcode {\n\t\tline-height: normal;\n\n\t\tcolor: " + (
803
+ // eslint-disable-next-line no-nested-ternary
804
+ 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\tul,\n\tol {\n\t\tlist-style-position: inside;\n\n\t}\n\n\tli{\n\t\tdisplay: unset;\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";
805
+ };
806
+ var messageBGColor = function messageBGColor(props) {
807
+ var finalBGColor;
808
+ if (props.isSender) {
809
+ finalBGColor = props.themePreset !== 'dark' ? props.theme.colors.primaryColor : props.theme.colors.borderColor;
810
+ } else {
811
+ finalBGColor = props.themePreset !== 'dark' ? lighten(0.53, props.theme.colors.borderColor) : props.theme.colors.backgroundColor;
812
+ }
813
+ return finalBGColor;
814
+ };
815
+ var Message = styled('div')(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n\tbackground-color: ", ";\n\tcolor: ", ";\n\tborder: 1px solid\n\t\t", ";\n\tpadding: 10px;\n\tborder-radius: 7px;\n\tmargin-bottom: 10px;\n\tmax-width: 80%;\n\talign-self: ", ";\n\tdisplay: inline-block;\n\tposition: relative;\n\toverflow-wrap: anywhere;\n\t", "\n"])), function (props) {
816
+ return messageBGColor(props);
817
+ }, function (props) {
818
+ var finalColor;
819
+ if (props.isSender) {
820
+ finalColor = props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor;
821
+ } else {
822
+ finalColor = props.themePreset !== 'dark' ? props.theme.colors.borderColor : props.theme.colors.textColor;
823
+ }
824
+ return finalColor;
825
+ }, function (props) {
826
+ return props.themePreset === 'dark' ? 'currentColor' : messageBGColor(props);
827
+ }, function (props) {
828
+ return props.isSender ? 'flex-end' : 'flex-start';
829
+ }, function (props) {
830
+ return resetCSS(props);
831
+ });
832
+ var MessageInputContainer = styled('form')(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tpadding-top: 12px;\n\talign-items: stretch;\n\tmargin-top: 10px;\n\t.ai-enter-button-wrapper {\n\t\talign-self: baseline;\n\t\theight: 41px;\n\t}\n"])));
833
+ var MessageInput = styled(TextArea)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tborder-radius: 5px;\n\tborder: 1px solid #ccc;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\n\t::placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t:-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t::-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n\t", "\n"])), function (props) {
834
+ return props.themePreset === 'dark' ? props.theme.colors.borderColor : '#fff';
835
+ }, function (props) {
836
+ return props.themePreset === 'dark' ? props.theme.colors.titleColor : props.theme.colors.textColor;
837
+ }, function (props) {
838
+ return props.theme.colors.textColor;
839
+ }, function (props) {
840
+ return props.theme.colors.textColor;
841
+ }, function (props) {
842
+ return props.theme.colors.textColor;
843
+ }, function (_ref) {
844
+ var enterButton = _ref.enterButton;
845
+ return enterButton && "\n\t\t border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\t";
846
+ });
847
+ var SendButton = styled(Button)(_templateObject10 || (_templateObject10 = _taggedTemplateLiteralLoose(["\n\tborder: none;\n\tcolor: #ffffff;\n\tcursor: pointer;\n\tfont-size: 16px;\n\tmargin-left: 8px;\n\toutline: none;\n\tpadding: 10px;\n\ttext-align: center;\n"])));
848
+ var AIFeedbackContainer = styled('div')(_templateObject11 || (_templateObject11 = _taggedTemplateLiteralLoose(["\n\t.--feedback-svgs-wrapper {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: flex-end;\n\t\tgap: 5px;\n\n\t\tsvg {\n\t\t\tcursor: pointer;\n\t\t\ttransition: all ease-in 0.1s;\n\t\t\t&.selected {\n\t\t\t\ttransform: scale(1.1);\n\t\t\t\tcursor: default;\n\t\t\t}\n\n\t\t\t&:hover {\n\t\t\t\ttransform: scale(1.1);\n\t\t\t}\n\t\t}\n\t}\n\n\t.--feedback-input-wrapper {\n\t\tdisplay: flex;\n\t\tgap: 7px;\n\t}\n"])));
849
+
850
+ var _templateObject$a, _templateObject2$3, _templateObject3$2, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7$1;
851
+ var fadeInFromBottom = keyframes(_templateObject$a || (_templateObject$a = _taggedTemplateLiteralLoose(["\n 0% {\n opacity: 0;\n transform: translateY(20px);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n"])));
852
+ var fadeInFromTop = keyframes(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteralLoose(["\n 0% {\n opacity: 0;\n transform: translateY(-20px);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n"])));
853
+ var SearchBoxAISection = styled('div')(_templateObject3$2 || (_templateObject3$2 = _taggedTemplateLiteralLoose(["\n\tpadding: 10px;\n\tborder-radius: 4px;\n\tmin-height: 200px;\n\tpadding-top: 20px;\n\tposition: relative;\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\t.--ai-answer-error-container {\n\t\tposition: absolute;\n\t\ttop: 50%;\n\t\tleft: 50%;\n\t\ttransform: translate(-50%, -50%);\n\t\t.--default-error-element {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\talign-items: center;\n\t\t\tgap: 10px;\n\t\t}\n\t}\n"])), function (_ref) {
854
+ var themePreset = _ref.themePreset,
855
+ theme = _ref.theme;
856
+ return themePreset === 'dark' ? '#424242' : theme.colors.backgroundColor;
857
+ }, function (_ref2) {
858
+ var theme = _ref2.theme;
859
+ return theme.colors.textColor;
860
+ });
861
+ var Question = styled('div')(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteralLoose(["\n\tfont-weight: bold;\n\tmargin-bottom: 5px;\n\tanimation: ", " 0.5s ease-out;\n"])), fadeInFromTop);
862
+ var Answer = styled('div')(_templateObject5$1 || (_templateObject5$1 = _taggedTemplateLiteralLoose(["\n\t", "\n\tposition: relative;\n\tmargin-bottom: 5px;\n\tmin-height: 100px;\n\toverflow: auto;\n\twhite-space: pre-wrap;\n\tpre {\n\t\twhite-space: pre-wrap;\n\t}\n\tcode,\n\tpre {\n\t\tdisplay: revert;\n\t}\n"])), function (props) {
863
+ return resetCSS(props);
864
+ });
865
+ var Footer = styled('div')(_templateObject6$1 || (_templateObject6$1 = _taggedTemplateLiteralLoose(["\n\tcolor: #777;\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 1rem;\n\tflex-wrap: wrap;\n\tanimation: ", " 0.5s ease-out;\n\tpadding: 10px 0;\n\tbackground: white;\n\tbackground-color: ", ";\n\tcolor: ", ";\n"])), fadeInFromBottom, function (_ref3) {
866
+ var themePreset = _ref3.themePreset,
867
+ theme = _ref3.theme;
868
+ return themePreset === 'dark' ? '#424242' : theme.colors.backgroundColor;
869
+ }, function (_ref4) {
870
+ var theme = _ref4.theme;
871
+ return theme.colors.textColor;
872
+ });
873
+ var SourceTags = styled('div')(_templateObject7$1 || (_templateObject7$1 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tgap: 8px;\n\tflex-wrap: wrap;\n\t.--ai-source-tag {\n\t\tdisplay: inline-block;\n\t\tmax-width: 200px;\n\t\twhite-space: nowrap;\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t}\n"])));
874
+
875
+ var ThumbsUpSvg = {
876
+ name: 'ThumbsUpSvg',
877
+ props: ['clickHandler', 'className'],
878
+ render: function render() {
879
+ return createVNode("svg", {
880
+ "stroke": "currentColor",
881
+ "fill": "none",
882
+ "strokeWidth": "2",
883
+ "viewBox": "0 0 24 24",
884
+ "strokeLinecap": "round",
885
+ "strokeLinejoin": "round",
886
+ "class": this.$props.className,
887
+ "height": "1em",
888
+ "width": "1em",
889
+ "xmlns": "http://www.w3.org/2000/svg",
890
+ "onClick": this.$props.clickHandler
891
+ }, [createVNode("path", {
892
+ "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"
893
+ }, null)]);
894
+ }
895
+ };
896
+
897
+ var ThumbsDownSvg = {
898
+ name: 'ThumbsDownSvg',
899
+ props: ['clickHandler', 'className'],
900
+ render: function render() {
901
+ return createVNode("svg", {
902
+ "stroke": "currentColor",
903
+ "fill": "none",
904
+ "strokeWidth": "2",
905
+ "viewBox": "0 0 24 24",
906
+ "strokeLinecap": "round",
907
+ "strokeLinejoin": "round",
908
+ "class": this.$props.className,
909
+ "height": "1em",
910
+ "width": "1em",
911
+ "xmlns": "http://www.w3.org/2000/svg",
912
+ "onClick": this.$props.clickHandler
913
+ }, [createVNode("path", {
914
+ "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"
915
+ }, null), ' ']);
916
+ }
917
+ };
918
+
919
+ var AIFeedback = defineComponent({
920
+ name: 'FeedbackComponent',
921
+ props: {
922
+ onFeedbackSubmit: {
923
+ type: Function,
924
+ "default": function _default() {}
925
+ },
926
+ hideUI: {
927
+ type: Boolean,
928
+ "default": false
929
+ },
930
+ overrideState: {
931
+ type: Object,
932
+ "default": function _default() {
933
+ return {};
934
+ }
935
+ }
936
+ },
937
+ setup: function setup(props, _ref) {
938
+ var emit = _ref.emit;
939
+ var showInput = ref(false);
940
+ var feedbackType = ref(null);
941
+ var feedbackText = ref('');
942
+ var feedbackRecorded = ref(false);
943
+ var handleButtonClick = function handleButtonClick(type) {
944
+ if (feedbackType.value === type) {
945
+ feedbackType.value = null;
946
+ showInput.value = false;
947
+ } else {
948
+ feedbackType.value = type;
949
+ showInput.value = true;
950
+ }
951
+ };
952
+ var handleInputChange = function handleInputChange(e) {
953
+ feedbackText.value = e.target.value;
954
+ };
955
+ var handleSubmit = function handleSubmit() {
956
+ emit('feedback-submit', feedbackType.value === 'positive', feedbackText.value);
957
+ feedbackText.value = '';
958
+ showInput.value = false;
959
+ feedbackRecorded.value = true;
960
+ };
961
+ var handleCancel = function handleCancel() {
962
+ feedbackType.value = null;
963
+ feedbackText.value = '';
964
+ showInput.value = false;
965
+ };
966
+ watch(function () {
967
+ return props.overrideState;
968
+ }, function (newValue) {
969
+ if (newValue && newValue.isRecorded) {
970
+ feedbackRecorded.value = true;
971
+ feedbackType.value = newValue.feedbackType || 'positive';
972
+ }
973
+ });
974
+ if (props.overrideState && props.overrideState.isRecorded) {
975
+ feedbackRecorded.value = true;
976
+ feedbackType.value = props.overrideState.feedbackType || 'positive';
977
+ }
978
+ return {
979
+ showInput: showInput,
980
+ feedbackType: feedbackType,
981
+ feedbackText: feedbackText,
982
+ feedbackRecorded: feedbackRecorded,
983
+ handleButtonClick: handleButtonClick,
984
+ handleInputChange: handleInputChange,
985
+ handleSubmit: handleSubmit,
986
+ handleCancel: handleCancel
987
+ };
988
+ },
989
+ render: function render() {
990
+ var _this = this;
991
+ if (this.$props.hideUI) {
992
+ return null;
993
+ }
994
+ if (this.feedbackRecorded) {
995
+ return createVNode(AIFeedbackContainer, null, {
996
+ "default": function _default() {
997
+ return [createVNode("div", {
998
+ "class": "--feedback-svgs-wrapper"
999
+ }, [_this.feedbackType === 'positive' ? createVNode(ThumbsUpSvg, {
1000
+ "class": "selected"
1001
+ }, null) : createVNode(ThumbsDownSvg, {
1002
+ "class": "selected"
1003
+ }, null)])];
1004
+ }
1005
+ });
1006
+ }
1007
+ return createVNode(AIFeedbackContainer, null, {
1008
+ "default": function _default() {
1009
+ return [!_this.showInput && createVNode("div", {
1010
+ "class": "--feedback-svgs-wrapper"
1011
+ }, [createVNode(ThumbsUpSvg, {
1012
+ "class": _this.feedbackType === 'positive' ? 'selected' : '',
1013
+ "onClick": function onClick() {
1014
+ return _this.handleButtonClick('positive');
1015
+ }
1016
+ }, null), createVNode(ThumbsDownSvg, {
1017
+ "class": _this.feedbackType === 'negative' ? 'selected' : '',
1018
+ "onClick": function onClick() {
1019
+ return _this.handleButtonClick('negative');
1020
+ }
1021
+ }, null)]), _this.showInput && createVNode("div", {
1022
+ "class": "--feedback-input-wrapper"
1023
+ }, [createVNode(Input, {
1024
+ "show": _this.showInput,
1025
+ "placeholder": _this.feedbackType === 'positive' ? 'What do you like about the response?' : 'What was the issue with the response? How can it be improved?',
1026
+ "value": _this.feedbackText,
1027
+ "onInput": _this.handleInputChange
1028
+ }, null), createVNode(Button, {
1029
+ "primary": true,
1030
+ "onClick": _this.handleSubmit
1031
+ }, {
1032
+ "default": function _default() {
1033
+ return [createTextVNode("Submit")];
1034
+ }
1035
+ }), createVNode(Button, {
1036
+ "onClick": _this.handleCancel
1037
+ }, {
1038
+ "default": function _default() {
1039
+ return [createTextVNode("Cancel")];
1040
+ }
1041
+ })])];
1042
+ }
1043
+ });
1044
+ }
1045
+ });
1046
+
1047
+ var _excluded = ["_source"];
755
1048
  function _isSlot(s) {
756
1049
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
757
1050
  }
1051
+ var md = new Remarkable();
1052
+ md.set({
1053
+ html: true,
1054
+ breaks: true,
1055
+ xhtmlOut: true
1056
+ });
1057
+ var _dropdownULRef = 'dropdownULRef';
758
1058
  var updateQuery = Actions.updateQuery,
759
1059
  setCustomQuery = Actions.setCustomQuery,
760
1060
  setDefaultQuery = Actions.setDefaultQuery,
@@ -775,7 +1075,11 @@ var SearchBox = defineComponent({
775
1075
  currentValue: '',
776
1076
  selectedTags: [],
777
1077
  isOpen: false,
778
- normalizedSuggestions: []
1078
+ normalizedSuggestions: [],
1079
+ showAIScreen: false,
1080
+ showAIScreenFooter: false,
1081
+ showFeedbackComponent: false,
1082
+ feedbackState: null
779
1083
  };
780
1084
  this.internalComponent = props.componentId + "__internal";
781
1085
  return this.__state;
@@ -897,7 +1201,10 @@ var SearchBox = defineComponent({
897
1201
  mode: VueTypes.oneOf(['select', 'tag']).def('select'),
898
1202
  renderSelectedTags: VueTypes.any,
899
1203
  searchboxId: VueTypes.string,
900
- endpoint: types.endpointConfig
1204
+ endpoint: types.endpointConfig,
1205
+ enableAI: types.bool,
1206
+ AIConfig: types.AIConfig,
1207
+ AIUIConfig: types.AIUIConfig
901
1208
  },
902
1209
  mounted: function mounted() {
903
1210
  this.listenForFocusShortcuts();
@@ -1004,6 +1311,47 @@ var SearchBox = defineComponent({
1004
1311
  if (!isEqual(newVal, oldVal)) {
1005
1312
  this.handleTextChange = _debounce(this.handleText, newVal);
1006
1313
  }
1314
+ },
1315
+ isAITyping: function isAITyping(newVal, oldVal) {
1316
+ var _this = this;
1317
+ var scrollAIContainer = function scrollAIContainer() {
1318
+ var dropdownEle = _this.$refs[_dropdownULRef];
1319
+ if (dropdownEle) {
1320
+ dropdownEle.scrollTo({
1321
+ top: dropdownEle.scrollHeight,
1322
+ behavior: 'smooth'
1323
+ });
1324
+ }
1325
+ };
1326
+ if (!newVal && oldVal) {
1327
+ this.showAIScreenFooter = true;
1328
+ if (this.$props.AIUIConfig && typeof this.$props.AIUIConfig.showFeedback === 'boolean' ? this.$props.AIUIConfig.showFeedback : true) {
1329
+ this.showFeedbackComponent = true;
1330
+ }
1331
+ setTimeout(function () {
1332
+ scrollAIContainer();
1333
+ }, 500);
1334
+ } else if (newVal) {
1335
+ this.scrollTimerRef = setTimeout(function () {
1336
+ scrollAIContainer();
1337
+ }, 2000);
1338
+ }
1339
+ },
1340
+ showAIScreen: function showAIScreen(newVal) {
1341
+ if (newVal) {
1342
+ var _this$$refs;
1343
+ if ((_this$$refs = this.$refs) != null && _this$$refs[this.$props.innerRef] && this.$refs[this.$props.innerRef].$el) {
1344
+ this.$refs[this.$props.innerRef].$el.blur();
1345
+ }
1346
+ } else {
1347
+ this.feedbackState = null;
1348
+ this.showFeedbackComponent = false;
1349
+ }
1350
+ },
1351
+ currentValue: function currentValue() {
1352
+ if (this.$props.autosuggest && this.$props.enableAI) {
1353
+ this.handleTextAreaHeightChange();
1354
+ }
1007
1355
  }
1008
1356
  },
1009
1357
  methods: {
@@ -1029,7 +1377,14 @@ var SearchBox = defineComponent({
1029
1377
  data: this.normalizedSuggestions,
1030
1378
  rawData: this.rawData,
1031
1379
  value: currentValue,
1032
- resultStats: this.stats
1380
+ resultStats: this.stats,
1381
+ AIData: {
1382
+ question: this.AIResponse && this.AIResponse.response && this.AIResponse.response.question,
1383
+ answer: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text,
1384
+ documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
1385
+ showAIScreen: this.showAIScreen,
1386
+ sources: this.getAISourceObjects()
1387
+ }
1033
1388
  };
1034
1389
  return getComponent(data, this);
1035
1390
  },
@@ -1053,7 +1408,7 @@ var SearchBox = defineComponent({
1053
1408
  }
1054
1409
  },
1055
1410
  setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue) {
1056
- var _this = this;
1411
+ var _this2 = this;
1057
1412
  if (isDefaultValue === void 0) {
1058
1413
  isDefaultValue = false;
1059
1414
  }
@@ -1067,60 +1422,65 @@ var SearchBox = defineComponent({
1067
1422
  categoryValue = undefined;
1068
1423
  }
1069
1424
  var performUpdate = function performUpdate() {
1070
- if (_this.$options.isTagsMode && isEqual(value, _this.selectedTags)) {
1425
+ if (_this2.$options.isTagsMode && isEqual(value, _this2.selectedTags)) {
1071
1426
  return;
1072
1427
  }
1073
- if (_this.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1074
- if (Array.isArray(_this.selectedTags) && _this.selectedTags.length) {
1428
+ if (_this2.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1429
+ if (Array.isArray(_this2.selectedTags) && _this2.selectedTags.length) {
1075
1430
  // check if value already present in selectedTags
1076
- if (typeof value === 'string' && _this.selectedTags.includes(value)) {
1077
- _this.isOpen = false;
1431
+ if (typeof value === 'string' && _this2.selectedTags.includes(value)) {
1432
+ _this2.isOpen = false;
1078
1433
  return;
1079
1434
  }
1080
- _this.selectedTags = [].concat(_this.selectedTags);
1435
+ _this2.selectedTags = [].concat(_this2.selectedTags);
1081
1436
  if (typeof value === 'string' && !!value) {
1082
- _this.selectedTags.push(value);
1083
- } else if (Array.isArray(value) && !isEqual(_this.selectedTags, value)) {
1084
- _this.selectedTags = value;
1437
+ _this2.selectedTags.push(value);
1438
+ } else if (Array.isArray(value) && !isEqual(_this2.selectedTags, value)) {
1439
+ _this2.selectedTags = value;
1085
1440
  }
1086
1441
  } else if (value) {
1087
- _this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
1442
+ _this2.selectedTags = typeof value !== 'string' ? value : [].concat(value);
1088
1443
  }
1089
- _this.currentValue = '';
1444
+ _this2.currentValue = '';
1090
1445
  } else {
1091
- _this.currentValue = decodeHtml(value);
1446
+ _this2.currentValue = decodeHtml(value);
1092
1447
  }
1093
1448
  var queryHandlerValue = value;
1094
- if (_this.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1095
- queryHandlerValue = Array.isArray(_this.selectedTags) && _this.selectedTags.length ? _this.selectedTags : undefined;
1449
+ if (_this2.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1450
+ queryHandlerValue = Array.isArray(_this2.selectedTags) && _this2.selectedTags.length ? _this2.selectedTags : undefined;
1096
1451
  }
1097
1452
  if (isDefaultValue) {
1098
- if (_this.$props.autosuggest) {
1453
+ if (_this2.$props.autosuggest) {
1099
1454
  if (toggleIsOpen) {
1100
- _this.isOpen = false;
1455
+ _this2.isOpen = false;
1101
1456
  }
1102
- if (typeof _this.currentValue === 'string') _this.triggerDefaultQuery(_this.currentValue);
1457
+ if (typeof _this2.currentValue === 'string') _this2.triggerDefaultQuery(_this2.currentValue, props.enableAI ? {
1458
+ enableAI: true
1459
+ } : {});
1103
1460
  } // in case of strict selection only SUGGESTION_SELECT should be able
1104
1461
  // to set the query otherwise the value should reset
1105
1462
  if (props.strictSelection) {
1106
- if (cause === causes.SUGGESTION_SELECT || (_this.$options.isTagsMode ? _this.selectedTags.length === 0 : value === '')) {
1107
- _this.triggerCustomQuery(queryHandlerValue, _this.$options.isTagsMode ? undefined : categoryValue);
1463
+ if (cause === causes.SUGGESTION_SELECT || (_this2.$options.isTagsMode ? _this2.selectedTags.length === 0 : value === '')) {
1464
+ _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue);
1108
1465
  } else {
1109
- _this.setValue('', true);
1466
+ _this2.setValue('', true);
1110
1467
  }
1111
1468
  } else if (props.value === undefined || cause === causes.SUGGESTION_SELECT || cause === causes.CLEAR_VALUE) {
1112
- _this.triggerCustomQuery(queryHandlerValue, _this.$options.isTagsMode ? undefined : categoryValue);
1469
+ _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue);
1113
1470
  }
1114
1471
  } else {
1115
1472
  // debounce for handling text while typing
1116
- _this.handleTextChange(value, cause);
1473
+ _this2.handleTextChange(value, cause);
1117
1474
  }
1118
- _this.$emit('valueChange', value);
1119
- _this.$emit('value-change', value);
1475
+ _this2.$emit('valueChange', value);
1476
+ _this2.$emit('value-change', value);
1120
1477
  };
1121
1478
  checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
1122
1479
  },
1123
- triggerDefaultQuery: function triggerDefaultQuery(paramValue) {
1480
+ triggerDefaultQuery: function triggerDefaultQuery(paramValue, meta) {
1481
+ if (meta === void 0) {
1482
+ meta = {};
1483
+ }
1124
1484
  if (!this.$props.autosuggest) {
1125
1485
  return;
1126
1486
  }
@@ -1139,7 +1499,8 @@ var SearchBox = defineComponent({
1139
1499
  componentId: this.internalComponent,
1140
1500
  query: query,
1141
1501
  value: value,
1142
- componentType: componentTypes.searchBox
1502
+ componentType: componentTypes.searchBox,
1503
+ meta: meta
1143
1504
  });
1144
1505
  },
1145
1506
  triggerCustomQuery: function triggerCustomQuery(paramValue, categoryValue) {
@@ -1223,8 +1584,8 @@ var SearchBox = defineComponent({
1223
1584
  this.recordSuggestionClick(searchPosition, docId);
1224
1585
  },
1225
1586
  clearValue: function clearValue() {
1226
- this.setValue('', false, this.$props, causes.CLEAR_VALUE, false);
1227
- this.onValueSelectedHandler('', causes.CLEAR_VALUE);
1587
+ this.setValue('', false, this.$props, !this.$options.isTagsMode ? causes.CLEAR_VALUE : undefined, false);
1588
+ this.onValueSelectedHandler('', !this.$options.isTagsMode ? causes.CLEAR_VALUE : undefined);
1228
1589
  },
1229
1590
  handleKeyDown: function handleKeyDown(event, highlightedIndex) {
1230
1591
  if (highlightedIndex === void 0) {
@@ -1235,9 +1596,12 @@ var SearchBox = defineComponent({
1235
1596
  if (this.$props.autosuggest === false) {
1236
1597
  this.enterButtonOnClick();
1237
1598
  } else if (highlightedIndex === null) {
1238
- this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined // to handle tags
1239
- );
1240
-
1599
+ this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined,
1600
+ // to handle tags
1601
+ !this.$props.enableAI);
1602
+ if (this.$props.enableAI && !this.showAIScreen) {
1603
+ this.showAIScreen = true;
1604
+ }
1241
1605
  this.onValueSelectedHandler(event.target.value, causes.ENTER_PRESS);
1242
1606
  }
1243
1607
  }
@@ -1247,18 +1611,21 @@ var SearchBox = defineComponent({
1247
1611
  this.$emit('key-down', event, this.triggerQuery);
1248
1612
  },
1249
1613
  onInputChange: function onInputChange(e) {
1250
- var _this2 = this;
1614
+ var _this3 = this;
1251
1615
  var inputValue = e.target.value;
1252
1616
  if (!this.$data.isOpen && this.$props.autosuggest) {
1253
1617
  this.isOpen = true;
1254
1618
  }
1619
+ if (this.showAIScreen) {
1620
+ this.showAIScreen = false;
1621
+ }
1255
1622
  var value = this.$props.value;
1256
1623
  if (value === undefined) {
1257
- this.setValue(inputValue, false, this.$props, inputValue === '' ? causes.CLEAR_VALUE : undefined);
1624
+ this.setValue(inputValue, false, this.$props, undefined);
1258
1625
  } else {
1259
1626
  this.$emit('change', inputValue, function (_ref3) {
1260
1627
  var isOpen = _ref3.isOpen;
1261
- return _this2.triggerQuery({
1628
+ return _this3.triggerQuery({
1262
1629
  defaultQuery: true,
1263
1630
  customQuery: true,
1264
1631
  value: inputValue,
@@ -1268,8 +1635,10 @@ var SearchBox = defineComponent({
1268
1635
  }
1269
1636
  },
1270
1637
  onSuggestionSelected: function onSuggestionSelected(suggestion) {
1271
- var _this3 = this;
1272
- this.isOpen = false;
1638
+ var _this4 = this;
1639
+ if (!this.$props.enableAI) this.isOpen = false;else {
1640
+ this.showAIScreen = true;
1641
+ }
1273
1642
  var value = this.$props.value;
1274
1643
  // Record analytics for selected suggestions
1275
1644
  this.triggerClickAnalytics(suggestion._click_id);
@@ -1289,10 +1658,10 @@ var SearchBox = defineComponent({
1289
1658
  this.setValue(emitValue, true, this.$props, causes.SUGGESTION_SELECT, false, suggestion._category);
1290
1659
  this.$emit('change', emitValue, function (_ref4) {
1291
1660
  var isOpen = _ref4.isOpen;
1292
- return _this3.triggerQuery(_extends({
1661
+ return _this4.triggerQuery(_extends({
1293
1662
  isOpen: isOpen,
1294
1663
  value: emitValue
1295
- }, !_this3.$options.isTagsMode && {
1664
+ }, !_this4.$options.isTagsMode && {
1296
1665
  categoryValue: suggestion._category
1297
1666
  }));
1298
1667
  });
@@ -1326,9 +1695,26 @@ var SearchBox = defineComponent({
1326
1695
  }
1327
1696
  return null;
1328
1697
  },
1329
- renderErrorComponent: function renderErrorComponent() {
1330
- var _this4 = this;
1698
+ renderErrorComponent: function renderErrorComponent(isAIError) {
1699
+ var _this5 = this;
1700
+ if (isAIError === void 0) {
1701
+ isAIError = false;
1702
+ }
1331
1703
  var renderError = this.$slots.renderError || this.$props.renderError;
1704
+ if (isAIError) {
1705
+ if (this.showAIScreen && this.AIResponseError && !this.isAIResponseLoading) {
1706
+ if (renderError) {
1707
+ return createVNode("div", {
1708
+ "class": "--ai-answer-error-container " + (getClassName$1(this.$props.innerClass, 'ai-error') || '')
1709
+ }, [renderError(this.AIResponseError)]);
1710
+ }
1711
+ return createVNode("div", {
1712
+ "class": "--ai-answer-error-container " + (getClassName$1(this.$props.innerClass, 'ai-error') || '')
1713
+ }, [createVNode("div", {
1714
+ "class": "--default-error-element"
1715
+ }, [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 : ''])])]);
1716
+ }
1717
+ }
1332
1718
  if (this.error && renderError && this.$data.currentValue && !this.isLoading) {
1333
1719
  return createVNode(SuggestionWrapper, {
1334
1720
  "innerClass": this.$props.innerClass,
@@ -1337,7 +1723,7 @@ var SearchBox = defineComponent({
1337
1723
  "themePreset": this.themePreset
1338
1724
  }, {
1339
1725
  "default": function _default() {
1340
- return [isFunction(renderError) ? renderError(_this4.error) : renderError];
1726
+ return [isFunction(renderError) ? renderError(_this5.error) : renderError];
1341
1727
  }
1342
1728
  });
1343
1729
  }
@@ -1402,6 +1788,7 @@ var SearchBox = defineComponent({
1402
1788
  return null;
1403
1789
  },
1404
1790
  enterButtonOnClick: function enterButtonOnClick() {
1791
+ this.showAIScreen = false;
1405
1792
  this.triggerQuery({
1406
1793
  isOpen: false,
1407
1794
  value: this.currentValue,
@@ -1409,7 +1796,7 @@ var SearchBox = defineComponent({
1409
1796
  });
1410
1797
  },
1411
1798
  renderEnterButtonElement: function renderEnterButtonElement() {
1412
- var _this5 = this;
1799
+ var _this6 = this;
1413
1800
  var _this$$props2 = this.$props,
1414
1801
  enterButton = _this$$props2.enterButton,
1415
1802
  innerClass = _this$$props2.innerClass;
@@ -1417,12 +1804,12 @@ var SearchBox = defineComponent({
1417
1804
  if (enterButton) {
1418
1805
  var getEnterButtonMarkup = function getEnterButtonMarkup() {
1419
1806
  if (renderEnterButton) {
1420
- return renderEnterButton(_this5.enterButtonOnClick);
1807
+ return renderEnterButton(_this6.enterButtonOnClick);
1421
1808
  }
1422
1809
  return createVNode(Button, {
1423
1810
  "class": "enter-btn " + getClassName$1(innerClass, 'enter-button'),
1424
1811
  "primary": true,
1425
- "onClick": _this5.enterButtonOnClick
1812
+ "onClick": _this6.enterButtonOnClick
1426
1813
  }, {
1427
1814
  "default": function _default() {
1428
1815
  return [createTextVNode("Search")];
@@ -1436,7 +1823,7 @@ var SearchBox = defineComponent({
1436
1823
  return null;
1437
1824
  },
1438
1825
  renderIcons: function renderIcons() {
1439
- var _this6 = this;
1826
+ var _this7 = this;
1440
1827
  var _slot3, _slot4, _slot5;
1441
1828
  var _this$$props3 = this.$props,
1442
1829
  iconPosition = _this$$props3.iconPosition,
@@ -1453,21 +1840,21 @@ var SearchBox = defineComponent({
1453
1840
  }, {
1454
1841
  "default": function _default() {
1455
1842
  return [currentValue && showClear && createVNode(IconWrapper, {
1456
- "onClick": _this6.clearValue,
1843
+ "onClick": _this7.clearValue,
1457
1844
  "showIcon": showIcon,
1458
1845
  "isClearIcon": true
1459
- }, _isSlot(_slot3 = _this6.renderCancelIcon()) ? _slot3 : {
1846
+ }, _isSlot(_slot3 = _this7.renderCancelIcon()) ? _slot3 : {
1460
1847
  "default": function _default() {
1461
1848
  return [_slot3];
1462
1849
  }
1463
1850
  }), showVoiceSearch && createVNode(Mic, {
1464
1851
  "getInstance": getMicInstance,
1465
1852
  "render": renderMic,
1466
- "handleResult": _this6.handleVoiceResults,
1853
+ "handleResult": _this7.handleVoiceResults,
1467
1854
  "className": getClassName$1(innerClass, 'mic') || null
1468
1855
  }, null), iconPosition === 'right' && showIcon && createVNode(IconWrapper, {
1469
- "onClick": _this6.handleSearchIconClick
1470
- }, _isSlot(_slot4 = _this6.renderIcon()) ? _slot4 : {
1856
+ "onClick": _this7.handleSearchIconClick
1857
+ }, _isSlot(_slot4 = _this7.renderIcon()) ? _slot4 : {
1471
1858
  "default": function _default() {
1472
1859
  return [_slot4];
1473
1860
  }
@@ -1479,8 +1866,8 @@ var SearchBox = defineComponent({
1479
1866
  }, {
1480
1867
  "default": function _default() {
1481
1868
  return [iconPosition === 'left' && showIcon && createVNode(IconWrapper, {
1482
- "onClick": _this6.handleSearchIconClick
1483
- }, _isSlot(_slot5 = _this6.renderIcon()) ? _slot5 : {
1869
+ "onClick": _this7.handleSearchIconClick
1870
+ }, _isSlot(_slot5 = _this7.renderIcon()) ? _slot5 : {
1484
1871
  "default": function _default() {
1485
1872
  return [_slot5];
1486
1873
  }
@@ -1489,17 +1876,17 @@ var SearchBox = defineComponent({
1489
1876
  })]);
1490
1877
  },
1491
1878
  focusSearchBox: function focusSearchBox(event) {
1492
- var _this$$refs, _this$$refs$this$$pro;
1879
+ var _this$$refs2, _this$$refs2$this$$pr;
1493
1880
  var elt = event.target || event.srcElement;
1494
1881
  var tagName = elt.tagName;
1495
1882
  if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
1496
1883
  // already in an input
1497
1884
  return;
1498
1885
  }
1499
- (_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
1886
+ (_this$$refs2 = this.$refs) == null ? void 0 : (_this$$refs2$this$$pr = _this$$refs2[this.$props.innerRef]) == null ? void 0 : _this$$refs2$this$$pr.focus(); // eslint-disable-line
1500
1887
  },
1501
1888
  listenForFocusShortcuts: function listenForFocusShortcuts() {
1502
- var _this7 = this;
1889
+ var _this8 = this;
1503
1890
  var _this$$props$focusSho = this.$props.focusShortcuts,
1504
1891
  focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
1505
1892
  if (isEmpty(focusShortcuts)) {
@@ -1514,7 +1901,7 @@ var SearchBox = defineComponent({
1514
1901
  function (event, handler) {
1515
1902
  // Prevent the default refresh event under WINDOWS system
1516
1903
  event.preventDefault();
1517
- _this7.focusSearchBox(event);
1904
+ _this8.focusSearchBox(event);
1518
1905
  });
1519
1906
 
1520
1907
  // if one of modifier keys are used, they are handled below
@@ -1524,7 +1911,7 @@ var SearchBox = defineComponent({
1524
1911
  for (var index = 0; index < modifierKeys.length; index += 1) {
1525
1912
  var element = modifierKeys[index];
1526
1913
  if (hotkeys[element]) {
1527
- _this7.focusSearchBox(event);
1914
+ _this8.focusSearchBox(event);
1528
1915
  break;
1529
1916
  }
1530
1917
  }
@@ -1537,10 +1924,10 @@ var SearchBox = defineComponent({
1537
1924
  this.triggerDefaultQuery(value);
1538
1925
  },
1539
1926
  renderAutoFill: function renderAutoFill(suggestion) {
1540
- var _this8 = this;
1927
+ var _this9 = this;
1541
1928
  var handleAutoFillClick = function handleAutoFillClick(e) {
1542
1929
  e.stopPropagation();
1543
- _this8.onAutofillClick(suggestion);
1930
+ _this9.onAutofillClick(suggestion);
1544
1931
  };
1545
1932
  /* 👇 avoid showing autofill for category suggestions👇 */
1546
1933
  return suggestion._category ? null : createVNode(AutoFillSvg, {
@@ -1548,7 +1935,7 @@ var SearchBox = defineComponent({
1548
1935
  }, null);
1549
1936
  },
1550
1937
  renderTag: function renderTag(item) {
1551
- var _this9 = this;
1938
+ var _this10 = this;
1552
1939
  var innerClass = this.$props.innerClass;
1553
1940
  return createVNode(TagItem, {
1554
1941
  "class": getClassName$1(innerClass, 'selected-tag') || ''
@@ -1559,7 +1946,7 @@ var SearchBox = defineComponent({
1559
1946
  "aria-label": "delete-tag",
1560
1947
  "class": "close-icon",
1561
1948
  "onClick": function onClick() {
1562
- return _this9.clearTag(item);
1949
+ return _this10.clearTag(item);
1563
1950
  }
1564
1951
  }, [createVNode(CancelSvg, null, null)])];
1565
1952
  }
@@ -1582,7 +1969,7 @@ var SearchBox = defineComponent({
1582
1969
  }
1583
1970
  },
1584
1971
  renderTags: function renderTags() {
1585
- var _this10 = this;
1972
+ var _this11 = this;
1586
1973
  if (!Array.isArray(this.selectedTags)) {
1587
1974
  return null;
1588
1975
  }
@@ -1596,25 +1983,189 @@ var SearchBox = defineComponent({
1596
1983
  }) : createVNode(TagsContainer, null, {
1597
1984
  "default": function _default() {
1598
1985
  return [tagsList.map(function (item) {
1599
- return _this10.renderTag(item);
1986
+ return _this11.renderTag(item);
1600
1987
  }), shouldRenderClearAllTag && createVNode(TagItem, {
1601
- "class": getClassName$1(_this10.$props.innerClass, 'selected-tag') || ''
1988
+ "class": getClassName$1(_this11.$props.innerClass, 'selected-tag') || ''
1602
1989
  }, {
1603
1990
  "default": function _default() {
1604
1991
  return [createVNode("span", null, [createTextVNode("Clear All")]), createVNode("span", {
1605
1992
  "role": "img",
1606
1993
  "aria-label": "delete-tag",
1607
1994
  "class": "close-icon",
1608
- "onClick": _this10.clearAllTags
1995
+ "onClick": _this11.clearAllTags
1609
1996
  }, [createVNode(CancelSvg, null, null)])];
1610
1997
  }
1611
1998
  })];
1612
1999
  }
1613
2000
  });
2001
+ },
2002
+ getAISourceObjects: function getAISourceObjects() {
2003
+ var localCache = getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) && getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY)[this.componentId];
2004
+ var sourceObjects = [];
2005
+ if (!this.AIResponse) return sourceObjects;
2006
+ var docIds = this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [];
2007
+ if (localCache && localCache.meta && localCache.meta.hits && localCache.meta.hits.hits) {
2008
+ docIds.forEach(function (id) {
2009
+ var foundSourceObj = localCache.meta.hits.hits.find(function (hit) {
2010
+ return hit._id === id;
2011
+ }) || {};
2012
+ if (foundSourceObj) {
2013
+ var _foundSourceObj$_sour = foundSourceObj._source,
2014
+ _source = _foundSourceObj$_sour === void 0 ? {} : _foundSourceObj$_sour,
2015
+ rest = _objectWithoutPropertiesLoose(foundSourceObj, _excluded);
2016
+ sourceObjects.push(_extends({}, rest, _source));
2017
+ }
2018
+ });
2019
+ } else {
2020
+ sourceObjects.push.apply(sourceObjects, docIds.map(function (id) {
2021
+ return {
2022
+ _id: id
2023
+ };
2024
+ }));
2025
+ }
2026
+ return sourceObjects;
2027
+ },
2028
+ renderAIScreenLoader: function renderAIScreenLoader() {
2029
+ var _this$$props$AIUIConf = this.$props.AIUIConfig,
2030
+ AIUIConfig = _this$$props$AIUIConf === void 0 ? {} : _this$$props$AIUIConf;
2031
+ var _ref5 = AIUIConfig || {},
2032
+ loaderMessage = _ref5.loaderMessage;
2033
+ if (loaderMessage) {
2034
+ return loaderMessage;
2035
+ }
2036
+ if (this.$slots.AILoaderMessage) {
2037
+ return this.$slots.AILoaderMessage();
2038
+ }
2039
+ return createVNode(HorizontalSkeletonLoader, null, null);
2040
+ },
2041
+ renderAIScreenFooter: function renderAIScreenFooter() {
2042
+ var _slot6;
2043
+ var _this12 = this;
2044
+ var _this$$props$AIUIConf2 = this.$props.AIUIConfig,
2045
+ AIUIConfig = _this$$props$AIUIConf2 === void 0 ? {} : _this$$props$AIUIConf2;
2046
+ var _ref6 = AIUIConfig || {},
2047
+ _ref6$showSourceDocum = _ref6.showSourceDocuments,
2048
+ showSourceDocuments = _ref6$showSourceDocum === void 0 ? true : _ref6$showSourceDocum,
2049
+ _ref6$sourceDocumentL = _ref6.sourceDocumentLabel,
2050
+ sourceDocumentLabel = _ref6$sourceDocumentL === void 0 ? '_id' : _ref6$sourceDocumentL,
2051
+ _ref6$onSourceClick = _ref6.onSourceClick,
2052
+ onSourceClick = _ref6$onSourceClick === void 0 ? function () {} : _ref6$onSourceClick;
2053
+ return showSourceDocuments && this.showAIScreenFooter && this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds ? createVNode(Footer, {
2054
+ "themePreset": this.$props.themePreset
2055
+ }, {
2056
+ "default": function _default() {
2057
+ return [createTextVNode("Summary generated using the following sources:"), ' ', createVNode(SourceTags, null, _isSlot(_slot6 = _this12.getAISourceObjects().map(function (el) {
2058
+ return createVNode(Button, {
2059
+ "class": "--ai-source-tag " + (getClassName$1(_this12.$props.innerClass, 'ai-source-tag') || ''),
2060
+ "title": el[sourceDocumentLabel],
2061
+ "info": true,
2062
+ "onClick": function onClick() {
2063
+ return onSourceClick && onSourceClick(el);
2064
+ }
2065
+ }, {
2066
+ "default": function _default() {
2067
+ return [el[sourceDocumentLabel]];
2068
+ }
2069
+ });
2070
+ })) ? _slot6 : {
2071
+ "default": function _default() {
2072
+ return [_slot6];
2073
+ }
2074
+ })];
2075
+ }
2076
+ }) : null;
2077
+ },
2078
+ renderAIScreen: function renderAIScreen() {
2079
+ var _this13 = this;
2080
+ var customAIRenderer = this.$props.renderAIAnswer || this.$slots.renderAIAnswer;
2081
+ if (customAIRenderer) {
2082
+ return customAIRenderer({
2083
+ question: this.AIResponse && this.AIResponse.response && this.AIResponse.response.question,
2084
+ answer: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text,
2085
+ documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
2086
+ loading: this.isAIResponseLoading || this.isLoading,
2087
+ sources: this.getAISourceObjects(),
2088
+ error: this.AIResponseError
2089
+ });
2090
+ }
2091
+ if (this.isAIResponseLoading || this.isLoading) {
2092
+ return this.renderAIScreenLoader();
2093
+ }
2094
+ return createVNode("div", null, [createVNode(Answer, {
2095
+ "innerHTML": md.render(this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text)
2096
+ }, null), this.renderAIScreenFooter(), this.showFeedbackComponent && createVNode("div", {
2097
+ "class": "" + (getClassName$1(this.$props.innerClass, 'ai-feedback') || '')
2098
+ }, [createVNode(AIFeedback, {
2099
+ "overrideState": this.feedbackState,
2100
+ "hideUI": this.isAIResponseLoading || this.isLoading || !this.sessionIdFromStore,
2101
+ "key": this.sessionIdFromStore,
2102
+ "onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
2103
+ _this13.feedbackState = {
2104
+ isRecorded: true,
2105
+ feedbackType: useful ? 'positive' : 'negative'
2106
+ };
2107
+ _this13.recordAISessionUsefulness(_this13.sessionIdFromStore, {
2108
+ useful: useful,
2109
+ reason: reason
2110
+ });
2111
+ }
2112
+ }, null)])]);
2113
+ },
2114
+ handleTextAreaHeightChange: function handleTextAreaHeightChange() {
2115
+ var _this$$refs$this$$pro;
2116
+ var textArea = (_this$$refs$this$$pro = this.$refs[this.$props.innerRef]) == null ? void 0 : _this$$refs$this$$pro.$el;
2117
+ if (textArea) {
2118
+ textArea.style.height = '42px';
2119
+ var lineHeight = parseInt(getComputedStyle(textArea).lineHeight, 10);
2120
+ var maxHeight = lineHeight * 4; // max height for 3 lines
2121
+ var height = Math.min(textArea.scrollHeight, maxHeight);
2122
+ textArea.style.height = height + "px";
2123
+ textArea.style.overflowY = height === maxHeight ? 'auto' : 'hidden';
2124
+ var dropdownEle = this.$refs[_dropdownULRef];
2125
+ if (dropdownEle) {
2126
+ dropdownEle.style.top = height + "px";
2127
+ }
2128
+ }
2129
+ },
2130
+ askButtonOnClick: function askButtonOnClick() {
2131
+ this.showAIScreen = true;
2132
+ this.isOpen = true;
2133
+ this.triggerDefaultQuery(this.currentValue, {
2134
+ enableAI: true
2135
+ });
2136
+ },
2137
+ renderAskButtonElement: function renderAskButtonElement() {
2138
+ var _this14 = this;
2139
+ var _this$$props4 = this.$props,
2140
+ AIUIConfig = _this$$props4.AIUIConfig,
2141
+ innerClass = _this$$props4.innerClass;
2142
+ var _ref7 = AIUIConfig || {},
2143
+ askButton = _ref7.askButton;
2144
+ var renderAskButton = this.$slots.renderAskButton;
2145
+ if (askButton) {
2146
+ var getEnterButtonMarkup = function getEnterButtonMarkup() {
2147
+ if (renderAskButton) {
2148
+ return renderAskButton(_this14.askButtonOnClick);
2149
+ }
2150
+ return createVNode(Button, {
2151
+ "class": "enter-btn " + getClassName$1(innerClass, 'ask-button'),
2152
+ "info": true,
2153
+ "onClick": _this14.askButtonOnClick
2154
+ }, {
2155
+ "default": function _default() {
2156
+ return [createTextVNode("Ask")];
2157
+ }
2158
+ });
2159
+ };
2160
+ return createVNode("div", {
2161
+ "class": "enter-button-wrapper"
2162
+ }, [getEnterButtonMarkup()]);
2163
+ }
2164
+ return null;
1614
2165
  }
1615
2166
  },
1616
2167
  render: function render() {
1617
- var _this11 = this;
2168
+ var _this15 = this;
1618
2169
  var expandSuggestionsContainer = this.$props.expandSuggestionsContainer;
1619
2170
  var _this$$slots = this.$slots,
1620
2171
  recentSearchesIcon = _this$$slots.recentSearchesIcon,
@@ -1625,26 +2176,26 @@ var SearchBox = defineComponent({
1625
2176
  "class": this.$props.className
1626
2177
  }, {
1627
2178
  "default": function _default() {
1628
- return [_this11.$props.title && createVNode(Title, {
1629
- "class": getClassName$1(_this11.$props.innerClass, 'title') || ''
2179
+ return [_this15.$props.title && createVNode(Title, {
2180
+ "class": getClassName$1(_this15.$props.innerClass, 'title') || ''
1630
2181
  }, {
1631
2182
  "default": function _default() {
1632
- return [_this11.$props.title];
2183
+ return [_this15.$props.title];
1633
2184
  }
1634
- }), _this11.$props.autosuggest ? createVNode(Downshift, {
1635
- "id": _this11.$props.componentId + "-downshift",
1636
- "handleChange": _this11.onSuggestionSelected,
1637
- "handleMouseup": _this11.handleStateChange,
1638
- "isOpen": _this11.$data.isOpen
2185
+ }), _this15.$props.autosuggest ? createVNode(Downshift, {
2186
+ "id": _this15.$props.componentId + "-downshift",
2187
+ "handleChange": _this15.onSuggestionSelected,
2188
+ "handleMouseup": _this15.handleStateChange,
2189
+ "isOpen": _this15.$data.isOpen
1639
2190
  }, {
1640
- "default": function _default(_ref5) {
1641
- var getInputEvents = _ref5.getInputEvents,
1642
- getInputProps = _ref5.getInputProps,
1643
- getItemProps = _ref5.getItemProps,
1644
- getItemEvents = _ref5.getItemEvents,
1645
- isOpen = _ref5.isOpen,
1646
- highlightedIndex = _ref5.highlightedIndex,
1647
- setHighlightedIndex = _ref5.setHighlightedIndex;
2191
+ "default": function _default(_ref8) {
2192
+ var getInputEvents = _ref8.getInputEvents,
2193
+ getInputProps = _ref8.getInputProps,
2194
+ getItemProps = _ref8.getItemProps,
2195
+ getItemEvents = _ref8.getItemEvents,
2196
+ isOpen = _ref8.isOpen,
2197
+ highlightedIndex = _ref8.highlightedIndex,
2198
+ setHighlightedIndex = _ref8.setHighlightedIndex;
1648
2199
  var renderSuggestionsDropdown = function renderSuggestionsDropdown() {
1649
2200
  var getIcon = function getIcon(iconType) {
1650
2201
  switch (iconType) {
@@ -1656,14 +2207,21 @@ var SearchBox = defineComponent({
1656
2207
  return null;
1657
2208
  }
1658
2209
  };
1659
- return createVNode("div", null, [_this11.hasCustomRenderer && _this11.getComponent({
2210
+ return createVNode("div", null, [_this15.hasCustomRenderer && _this15.getComponent({
1660
2211
  isOpen: isOpen,
1661
2212
  getItemProps: getItemProps,
1662
2213
  getItemEvents: getItemEvents,
1663
2214
  highlightedIndex: highlightedIndex
1664
- }), _this11.renderErrorComponent(), !_this11.hasCustomRenderer && isOpen && hasSuggestions ? createVNode("ul", {
1665
- "class": suggestions(_this11.themePreset, _this11.theme) + " " + getClassName$1(_this11.$props.innerClass, 'list')
1666
- }, [_this11.normalizedSuggestions.map(function (item, index) {
2215
+ }), _this15.renderErrorComponent(), !_this15.hasCustomRenderer && isOpen && hasSuggestions ? createVNode("ul", {
2216
+ "class": suggestions(_this15.themePreset, _this15.theme) + " " + getClassName$1(_this15.$props.innerClass, 'list'),
2217
+ "ref": _dropdownULRef
2218
+ }, [_this15.showAIScreen && createVNode(SearchBoxAISection, {
2219
+ "themePreset": _this15.$props.themePreset
2220
+ }, {
2221
+ "default": function _default() {
2222
+ return [_this15.renderAIScreen(), ' ', _this15.renderErrorComponent(true)];
2223
+ }
2224
+ }), !_this15.showAIScreen && _this15.normalizedSuggestions.map(function (item, index) {
1667
2225
  return renderItem ? createVNode("li", mergeProps(getItemProps({
1668
2226
  item: item
1669
2227
  }), getItemEvents({
@@ -1671,7 +2229,7 @@ var SearchBox = defineComponent({
1671
2229
  }), {
1672
2230
  "key": index + 1 + "-" + item.value,
1673
2231
  "style": {
1674
- backgroundColor: _this11.getBackgroundColor(highlightedIndex, index),
2232
+ backgroundColor: _this15.getBackgroundColor(highlightedIndex, index),
1675
2233
  justifyContent: 'flex-start',
1676
2234
  alignItems: 'center'
1677
2235
  }
@@ -1682,7 +2240,7 @@ var SearchBox = defineComponent({
1682
2240
  })), {
1683
2241
  "key": index + 1 + "-" + item.value,
1684
2242
  "style": {
1685
- backgroundColor: _this11.getBackgroundColor(highlightedIndex, index),
2243
+ backgroundColor: _this15.getBackgroundColor(highlightedIndex, index),
1686
2244
  justifyContent: 'flex-start',
1687
2245
  alignItems: 'center'
1688
2246
  }
@@ -1692,97 +2250,133 @@ var SearchBox = defineComponent({
1692
2250
  display: 'flex'
1693
2251
  }
1694
2252
  }, [createVNode(CustomSvg, {
1695
- "className": getClassName$1(_this11.$props.innerClass, item._suggestion_type + "-search-icon") || null,
2253
+ "className": getClassName$1(_this15.$props.innerClass, item._suggestion_type + "-search-icon") || null,
1696
2254
  "icon": getIcon(item._suggestion_type),
1697
2255
  "type": item._suggestion_type + "-search-icon"
1698
2256
  }, null)]), createVNode(SuggestionItem, {
1699
- "currentValue": _this11.currentValue,
2257
+ "currentValue": _this15.currentValue,
1700
2258
  "suggestion": item
1701
- }, null), _this11.renderAutoFill(item)]);
1702
- })]) : _this11.renderNoSuggestions(_this11.normalizedSuggestions)]);
2259
+ }, null), _this15.renderAutoFill(item)]);
2260
+ })]) : _this15.renderNoSuggestions(_this15.normalizedSuggestions)]);
1703
2261
  };
1704
2262
  return createVNode("div", {
1705
2263
  "class": suggestionsContainer
1706
2264
  }, [createVNode(InputGroup, null, {
1707
2265
  "default": function _default() {
1708
- return [_this11.renderInputAddonBefore(), createVNode(InputWrapper, null, {
2266
+ return [_this15.renderInputAddonBefore(), createVNode(InputWrapper, null, {
1709
2267
  "default": function _default() {
1710
- return [createVNode(Input, mergeProps(_transformOn(getInputEvents({
1711
- onInput: _this11.onInputChange,
2268
+ return [_this15.$props.enableAI ? createVNode(TextArea, mergeProps(_transformOn(getInputEvents({
2269
+ onInput: _this15.onInputChange,
1712
2270
  onBlur: function onBlur(e) {
1713
- _this11.$emit('blur', e, _this11.triggerQuery);
2271
+ _this15.$emit('blur', e, _this15.triggerQuery);
1714
2272
  },
1715
- onFocus: _this11.handleFocus,
2273
+ onFocus: _this15.handleFocus,
1716
2274
  onKeyPress: function onKeyPress(e) {
1717
- _this11.$emit('keyPress', e, _this11.triggerQuery);
1718
- _this11.$emit('key-press', e, _this11.triggerQuery);
2275
+ _this15.$emit('keyPress', e, _this15.triggerQuery);
2276
+ _this15.$emit('key-press', e, _this15.triggerQuery);
1719
2277
  },
1720
2278
  onKeyDown: function onKeyDown(e) {
1721
- return _this11.handleKeyDown(e, highlightedIndex);
2279
+ return _this15.handleKeyDown(e, highlightedIndex);
1722
2280
  },
1723
2281
  onKeyUp: function onKeyUp(e) {
1724
- _this11.$emit('keyUp', e, _this11.triggerQuery);
1725
- _this11.$emit('key-up', e, _this11.triggerQuery);
2282
+ _this15.$emit('keyUp', e, _this15.triggerQuery);
2283
+ _this15.$emit('key-up', e, _this15.triggerQuery);
1726
2284
  },
1727
2285
  onClick: function onClick() {
1728
2286
  setHighlightedIndex(null);
1729
2287
  }
1730
2288
  })), {
1731
- "id": _this11.$props.componentId + "-input",
1732
- "showIcon": _this11.$props.showIcon,
1733
- "showClear": _this11.$props.showClear,
1734
- "iconPosition": _this11.$props.iconPosition,
1735
- "ref": _this11.$props.innerRef,
1736
- "class": getClassName$1(_this11.$props.innerClass, 'input'),
1737
- "placeholder": _this11.$props.placeholder,
1738
- "autoFocus": _this11.$props.autoFocus
2289
+ "id": _this15.$props.componentId + "-input",
2290
+ "showIcon": _this15.$props.showIcon,
2291
+ "showClear": _this15.$props.showClear,
2292
+ "iconPosition": _this15.$props.iconPosition,
2293
+ "ref": _this15.$props.innerRef,
2294
+ "class": getClassName$1(_this15.$props.innerClass, 'input'),
2295
+ "placeholder": _this15.$props.placeholder,
2296
+ "autoFocus": _this15.$props.autoFocus,
2297
+ "showFocusShortcutsIcon": _this15.$props.showFocusShortcutsIcon,
2298
+ "showVoiceSearch": _this15.$props.showVoiceSearch
1739
2299
  }, getInputProps({
1740
- value: _this11.$data.currentValue === null ? '' : _this11.$data.currentValue
2300
+ value: _this15.$data.currentValue === null ? '' : _this15.$data.currentValue
1741
2301
  }), {
1742
- "themePreset": _this11.themePreset,
2302
+ "themePreset": _this15.themePreset,
1743
2303
  "autocomplete": "off"
1744
- }), null), _this11.renderIcons(), !expandSuggestionsContainer && renderSuggestionsDropdown()];
2304
+ }), null) : createVNode(Input, mergeProps(_transformOn(getInputEvents({
2305
+ onInput: _this15.onInputChange,
2306
+ onBlur: function onBlur(e) {
2307
+ _this15.$emit('blur', e, _this15.triggerQuery);
2308
+ },
2309
+ onFocus: _this15.handleFocus,
2310
+ onKeyPress: function onKeyPress(e) {
2311
+ _this15.$emit('keyPress', e, _this15.triggerQuery);
2312
+ _this15.$emit('key-press', e, _this15.triggerQuery);
2313
+ },
2314
+ onKeyDown: function onKeyDown(e) {
2315
+ return _this15.handleKeyDown(e, highlightedIndex);
2316
+ },
2317
+ onKeyUp: function onKeyUp(e) {
2318
+ _this15.$emit('keyUp', e, _this15.triggerQuery);
2319
+ _this15.$emit('key-up', e, _this15.triggerQuery);
2320
+ },
2321
+ onClick: function onClick() {
2322
+ setHighlightedIndex(null);
2323
+ }
2324
+ })), {
2325
+ "id": _this15.$props.componentId + "-input",
2326
+ "showIcon": _this15.$props.showIcon,
2327
+ "showClear": _this15.$props.showClear,
2328
+ "iconPosition": _this15.$props.iconPosition,
2329
+ "ref": _this15.$props.innerRef,
2330
+ "class": getClassName$1(_this15.$props.innerClass, 'input'),
2331
+ "placeholder": _this15.$props.placeholder,
2332
+ "autoFocus": _this15.$props.autoFocus
2333
+ }, getInputProps({
2334
+ value: _this15.$data.currentValue === null ? '' : _this15.$data.currentValue
2335
+ }), {
2336
+ "themePreset": _this15.themePreset,
2337
+ "autocomplete": "off"
2338
+ }), null), _this15.renderIcons(), !expandSuggestionsContainer && renderSuggestionsDropdown()];
1745
2339
  }
1746
- }), _this11.renderInputAddonAfter(), _this11.renderEnterButtonElement()];
2340
+ }), _this15.renderInputAddonAfter(), _this15.renderAskButtonElement(), _this15.renderEnterButtonElement()];
1747
2341
  }
1748
- }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this11.renderTags()]);
2342
+ }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this15.renderTags()]);
1749
2343
  }
1750
2344
  }) : createVNode("div", {
1751
2345
  "class": suggestionsContainer
1752
2346
  }, [createVNode(InputGroup, null, {
1753
2347
  "default": function _default() {
1754
- return [_this11.renderInputAddonBefore(), createVNode(InputWrapper, null, {
2348
+ return [_this15.renderInputAddonBefore(), createVNode(InputWrapper, null, {
1755
2349
  "default": function _default() {
1756
2350
  return [createVNode(Input, mergeProps(_transformOn({
1757
2351
  blur: function blur(e) {
1758
- _this11.$emit('blur', e, _this11.triggerQuery);
2352
+ _this15.$emit('blur', e, _this15.triggerQuery);
1759
2353
  },
1760
2354
  keypress: function keypress(e) {
1761
- _this11.$emit('keyPress', e, _this11.triggerQuery);
1762
- _this11.$emit('key-press', e, _this11.triggerQuery);
2355
+ _this15.$emit('keyPress', e, _this15.triggerQuery);
2356
+ _this15.$emit('key-press', e, _this15.triggerQuery);
1763
2357
  },
1764
- input: _this11.onInputChange,
2358
+ input: _this15.onInputChange,
1765
2359
  focus: function focus(e) {
1766
- _this11.$emit('focus', e, _this11.triggerQuery);
2360
+ _this15.$emit('focus', e, _this15.triggerQuery);
1767
2361
  },
1768
- keydown: _this11.handleKeyDown,
2362
+ keydown: _this15.handleKeyDown,
1769
2363
  keyup: function keyup(e) {
1770
- _this11.$emit('keyUp', e, _this11.triggerQuery);
1771
- _this11.$emit('key-up', e, _this11.triggerQuery);
2364
+ _this15.$emit('keyUp', e, _this15.triggerQuery);
2365
+ _this15.$emit('key-up', e, _this15.triggerQuery);
1772
2366
  }
1773
2367
  }), {
1774
- "class": getClassName$1(_this11.$props.innerClass, 'input') || '',
1775
- "placeholder": _this11.$props.placeholder,
1776
- "autofocus": _this11.$props.autoFocus,
1777
- "value": _this11.$data.currentValue ? _this11.$data.currentValue : '',
1778
- "iconPosition": _this11.$props.iconPosition,
1779
- "showIcon": _this11.$props.showIcon,
1780
- "showClear": _this11.$props.showClear,
1781
- "ref": _this11.$props.innerRef,
1782
- "themePreset": _this11.themePreset
1783
- }), null), _this11.renderIcons()];
2368
+ "class": getClassName$1(_this15.$props.innerClass, 'input') || '',
2369
+ "placeholder": _this15.$props.placeholder,
2370
+ "autofocus": _this15.$props.autoFocus,
2371
+ "value": _this15.$data.currentValue ? _this15.$data.currentValue : '',
2372
+ "iconPosition": _this15.$props.iconPosition,
2373
+ "showIcon": _this15.$props.showIcon,
2374
+ "showClear": _this15.$props.showClear,
2375
+ "ref": _this15.$props.innerRef,
2376
+ "themePreset": _this15.themePreset
2377
+ }), null), _this15.renderIcons()];
1784
2378
  }
1785
- }), _this11.renderInputAddonAfter(), _this11.renderEnterButtonElement()];
2379
+ }), _this15.renderInputAddonAfter(), _this15.renderEnterButtonElement()];
1786
2380
  }
1787
2381
  })])];
1788
2382
  }
@@ -1835,18 +2429,24 @@ var mapStateToProps = function mapStateToProps(state, props) {
1835
2429
  rawData: state.rawData[props.componentId],
1836
2430
  aggregationData: state.compositeAggregations[props.componentId] || [],
1837
2431
  themePreset: state.config.themePreset,
1838
- isLoading: !!state.isLoading[props.componentId + "_active"],
2432
+ isLoading: !!state.isLoading["" + props.componentId],
1839
2433
  error: state.error[props.componentId],
1840
2434
  time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
1841
2435
  total: state.hits[props.componentId] && state.hits[props.componentId].total,
1842
- hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden
2436
+ hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
2437
+ AIResponse: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response || null,
2438
+ isAIResponseLoading: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].isLoading,
2439
+ AIResponseError: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].error,
2440
+ sessionIdFromStore: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.sessionId || '',
2441
+ isAITyping: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.isTyping || false
1843
2442
  };
1844
2443
  };
1845
2444
  var mapDispatchToProps = {
1846
2445
  updateQuery: updateQuery,
1847
2446
  setCustomQuery: setCustomQuery,
1848
2447
  setDefaultQuery: setDefaultQuery,
1849
- recordSuggestionClick: recordSuggestionClick
2448
+ recordSuggestionClick: recordSuggestionClick,
2449
+ recordAISessionUsefulness: recordAISessionUsefulness
1850
2450
  };
1851
2451
  var SBConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps, mapDispatchToProps)(SearchBox), {
1852
2452
  componentType: componentTypes.searchBox,
@@ -1862,9 +2462,551 @@ SBConnected.install = function (Vue) {
1862
2462
  // Add componentType for SSR
1863
2463
  SBConnected.componentType = componentTypes.searchBox;
1864
2464
 
1865
- var _templateObject$8, _templateObject2$1;
1866
- var HierarchicalMenuList = styled('ul')(_templateObject$8 || (_templateObject$8 = _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"])));
1867
- var HierarchicalMenuListItem = styled('li')(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteralLoose(["\n\tfont-weight: 400;\n\tline-height: 1.5;\n\tbox-sizing: border-box;\n\n\ta {\n\t\tcolor: #424242;\n\t\ttext-decoration: none;\n\t\tgap: 5px;\n\t\t.--leaf-icon,\n\t\t.--folder-icon {\n\t\t\tline-height: 15px;\n\t\t\tsvg {\n\t\t\t\theight: 15px;\n\t\t\t}\n\t\t}\n\n\t\tinput {\n\t\t\tmargin: 0;\n\t\t\tcursor: pointer;\n\t\t}\n\t}\n\n\t.--switcher-icon {\n\t\ttransition: all 0.2s ease-in;\n\t\tmargin-right: 2px;\n\t}\n\t.--list-child {\n\t\tpadding-left: 1rem;\n\t\tposition: relative;\n\t\t&:before {\n\t\t\theight: 100%;\n\t\t\tcontent: '';\n\t\t\tposition: absolute;\n\t\t\tborder-left: 1px solid #787878;\n\t\t\twidth: 0;\n\t\t\tleft: 19px;\n\t\t\t", ";\n\t\t}\n\n\t\t&.--show-switcher-icon {\n\t\t\tpadding-left: 36px;\n\t\t}\n\t}\n\t.--list-item-label {\n\t\tline-height: 100%;\n\t}\n\t.--list-item-count {\n\t\tmargin-left: 10px;\n\t\tpadding: 0.1rem 0.4rem;\n\t\tfont-size: 0.8rem;\n\t\tcolor: #424242;\n\t\tbackground-color: #dee1e6;\n\t\tborder-radius: 8px;\n\t}\n\t&.-selected-item {\n\t\tfont-weight: 700 !important;\n\t}\n\t&.-expanded-item {\n\t\t& > a {\n\t\t\t& div > .--switcher-icon {\n\t\t\t\ttransform: rotate(90deg);\n\t\t\t}\n\t\t}\n\t}\n\t.--list-item-label-count-wrapper {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\t&:hover {\n\t\t\t.--list-item-count,\n\t\t\t.--list-item-label {\n\t\t\t\tfont-weight: 700;\n\t\t\t}\n\t\t}\n\t}\n"])), function (props) {
2465
+ function _isSlot$1(s) {
2466
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
2467
+ }
2468
+ var md$1 = new Remarkable();
2469
+ md$1.set({
2470
+ html: true,
2471
+ breaks: true,
2472
+ xhtmlOut: true
2473
+ });
2474
+ var _inputWrapperRef = 'inputWrapperRef';
2475
+ var _inputRef = 'inputRef';
2476
+ var _errorContainerRef = 'errorContainerRef';
2477
+ var AIAnswer = defineComponent({
2478
+ name: 'AIAnswer',
2479
+ data: function data() {
2480
+ var props = this.$props;
2481
+ this.__state = {
2482
+ messages: [],
2483
+ inputMessage: '',
2484
+ AISessionId: '',
2485
+ error: null
2486
+ };
2487
+ this.internalComponent = props.componentId + "__internal";
2488
+ return this.__state;
2489
+ },
2490
+ inject: {
2491
+ theme: {
2492
+ from: 'theme_reactivesearch'
2493
+ }
2494
+ },
2495
+ created: function created() {},
2496
+ computed: {
2497
+ hasCustomRenderer: function hasCustomRenderer$1() {
2498
+ return hasCustomRenderer(this);
2499
+ },
2500
+ isLoadingState: function isLoadingState() {
2501
+ return this.isAIResponseLoading || this.isLoading;
2502
+ },
2503
+ shouldShowComponent: function shouldShowComponent() {
2504
+ return this.showComponent;
2505
+ }
2506
+ },
2507
+ props: {
2508
+ componentId: types.string.isRequired,
2509
+ showVoiceInput: VueTypes.bool.def(false),
2510
+ showFeedback: VueTypes.bool.def(true),
2511
+ showIcon: VueTypes.bool.def(true),
2512
+ onData: types.func,
2513
+ innerRef: VueTypes.string.def('AISearchInputField'),
2514
+ react: types.react,
2515
+ enableAI: VueTypes.bool.def(true),
2516
+ AIConfig: types.AIConfig,
2517
+ iconPosition: types.iconPosition.def('left'),
2518
+ themePreset: types.themePreset,
2519
+ theme: types.style,
2520
+ icon: types.children,
2521
+ iconURL: VueTypes.string.def(''),
2522
+ renderMic: types.func,
2523
+ getMicInstance: types.func,
2524
+ innerClass: types.style,
2525
+ placeholder: VueTypes.string.def('Ask a question'),
2526
+ title: types.title,
2527
+ AIResponse: types.componentObject,
2528
+ isAIResponseLoading: VueTypes.bool.def(false),
2529
+ AIResponseError: types.componentObject,
2530
+ getAIResponse: types.func.isRequired,
2531
+ enterButton: types.bool,
2532
+ renderEnterButton: types.title,
2533
+ showInput: VueTypes.bool.def(true),
2534
+ clearSessionOnDestroy: VueTypes.bool.def(true),
2535
+ rawData: types.rawData,
2536
+ render: types.func,
2537
+ onError: types.func,
2538
+ renderError: types.title,
2539
+ isLoading: types.boolRequired,
2540
+ sessionIdFromStore: VueTypes.string,
2541
+ showComponent: types.boolRequired
2542
+ },
2543
+ mounted: function mounted() {},
2544
+ watch: {
2545
+ AIResponse: function AIResponse(newVal) {
2546
+ if (newVal) {
2547
+ this.AISessionId = ((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || null;
2548
+ var messagesHistory = newVal.messages,
2549
+ response = newVal.response;
2550
+ var finalMessages = [];
2551
+ if (response && response.error) {
2552
+ this.error = {
2553
+ message: response.error
2554
+ };
2555
+ }
2556
+
2557
+ // pushing message history so far
2558
+ if (messagesHistory && messagesHistory && Array.isArray(messagesHistory)) {
2559
+ finalMessages.push.apply(finalMessages, messagesHistory.filter(function (msg) {
2560
+ return msg.role !== AI_ROLES.SYSTEM;
2561
+ }));
2562
+ }
2563
+ // fresh response
2564
+ if (response && response.answer) ;
2565
+ this.messages = finalMessages;
2566
+ } else if (!newVal && !this.error) {
2567
+ this.messages = [];
2568
+ }
2569
+ },
2570
+ rawData: function rawData(newVal) {
2571
+ this.$emit('on-data', {
2572
+ data: this.messages,
2573
+ rawData: newVal,
2574
+ loading: this.$props.isAIResponseLoading || this.$props.isLoading,
2575
+ error: this.$props.AIResponseError
2576
+ });
2577
+ },
2578
+ isAIResponseLoading: function isAIResponseLoading(newVal) {
2579
+ this.isLoadingState = newVal;
2580
+ this.$emit('on-data', {
2581
+ data: this.messages,
2582
+ rawData: this.$props.rawData,
2583
+ loading: newVal || this.$props.isLoading,
2584
+ error: this.$props.AIResponseError
2585
+ });
2586
+ },
2587
+ isLoading: function isLoading(newVal) {
2588
+ this.isLoadingState = newVal;
2589
+ this.$emit('on-data', {
2590
+ data: this.messages,
2591
+ rawData: this.$props.rawData,
2592
+ loading: newVal || this.$props.isLoading,
2593
+ error: this.$props.AIResponseError
2594
+ });
2595
+ },
2596
+ sessionIdFromStore: function sessionIdFromStore(newVal) {
2597
+ if (newVal) {
2598
+ this.sessionId = newVal;
2599
+ }
2600
+ },
2601
+ AIResponseError: function AIResponseError(newVal) {
2602
+ this.error = newVal;
2603
+ this.AISessionId = ((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || null;
2604
+ this.$emit('on-data', {
2605
+ data: this.messages,
2606
+ rawData: this.$props.rawData,
2607
+ loading: this.$props.isAIResponseLoading || this.$props.isLoading,
2608
+ error: newVal
2609
+ });
2610
+ },
2611
+ messages: function messages() {
2612
+ this.scrollToBottom();
2613
+ }
2614
+ },
2615
+ methods: {
2616
+ scrollToBottom: function scrollToBottom() {
2617
+ var _this = this;
2618
+ this.$nextTick(function () {
2619
+ var _this$$refs;
2620
+ var messageContainer = (_this$$refs = _this.$refs) == null ? void 0 : _this$$refs[_this.$props.innerRef];
2621
+ if (messageContainer && messageContainer.$el) {
2622
+ messageContainer.$el.scrollTo({
2623
+ top: messageContainer.$el.scrollHeight,
2624
+ behavior: 'smooth'
2625
+ });
2626
+ }
2627
+ });
2628
+ },
2629
+ handleMessageInputChange: function handleMessageInputChange(e) {
2630
+ this.inputMessage = e.target.value;
2631
+ this.handleTextAreaHeightChange();
2632
+ },
2633
+ handleSendMessage: function handleSendMessage(e, isRetry, text) {
2634
+ if (isRetry === void 0) {
2635
+ isRetry = false;
2636
+ }
2637
+ if (text === void 0) {
2638
+ text = this.inputMessage;
2639
+ }
2640
+ if (typeof e === 'object') e.preventDefault();
2641
+ if (text.trim()) {
2642
+ if (this.isLoadingState) {
2643
+ return;
2644
+ }
2645
+ if (this.AISessionId) {
2646
+ if (!isRetry) this.messages = [].concat(this.messages, [{
2647
+ content: text,
2648
+ role: AI_ROLES.USER
2649
+ }]);
2650
+ this.getAIResponse(this.AISessionId, this.componentId, text);
2651
+ } else {
2652
+ console.error("AISessionId for " + this.$props.componentId + " is missing! AIAnswer component requires an AISession to function. Try reloading the App.");
2653
+ this.error = {
2654
+ message: "AISessionId for " + this.$props.componentId + " is missing! AIAnswer component requires an AISession to function. Trying reloading the App."
2655
+ };
2656
+ }
2657
+ this.inputMessage = '';
2658
+ }
2659
+ },
2660
+ handleRetryRequest: function handleRetryRequest() {
2661
+ if (this.messages && !this.isLoadingState) {
2662
+ var _this$messages;
2663
+ var lastUserRequestMessage = (_this$messages = this.messages[this.messages.length - 1]) == null ? void 0 : _this$messages.content;
2664
+ if (this.AISessionId) {
2665
+ this.getAIResponse(this.AISessionId, this.componentId, lastUserRequestMessage);
2666
+ this.inputMessage = '';
2667
+ } else {
2668
+ console.error("AISessionId for " + this.componentId + " is missing! AIAnswer component requires an AISession to function. Try reloading the App.");
2669
+ }
2670
+ }
2671
+ },
2672
+ renderErrorComponent: function renderErrorComponent() {
2673
+ var renderError = this.$slots.renderError || this.$props.renderError;
2674
+ if (this.error && !this.isLoadingState) {
2675
+ var _this$error, _this$error2;
2676
+ if (renderError) {
2677
+ return createVNode("div", {
2678
+ "ref": _errorContainerRef,
2679
+ "class": "--ai-answer-error-container " + (getClassName$2(this.$props.innerClass, 'ai-error') || '')
2680
+ }, [isFunction(renderError) ? renderError(this.error, this.handleRetryRequest) : renderError]);
2681
+ }
2682
+ return createVNode("div", {
2683
+ "ref": _errorContainerRef,
2684
+ "class": "--ai-answer-error-container " + (getClassName$2(this.$props.innerClass, 'ai-error') || '')
2685
+ }, [createVNode("div", {
2686
+ "class": "--default-error-element"
2687
+ }, [createVNode("span", null, [(_this$error = this.error) != null && _this$error.message ? this.error.message : 'There was an error in generating the response.', ' ', (_this$error2 = this.error) != null && _this$error2.code ? "Code:\n\t\t\t\t\t\t\t" + this.error.code : '']), this.AISessionId && createVNode(Button, {
2688
+ "primary": true,
2689
+ "onClick": this.handleRetryRequest
2690
+ }, {
2691
+ "default": function _default() {
2692
+ return [createTextVNode("Try again")];
2693
+ }
2694
+ })])]);
2695
+ }
2696
+ return null;
2697
+ },
2698
+ handleKeyPress: function handleKeyPress(e) {
2699
+ if (e.key === 'Enter') {
2700
+ this.handleSendMessage(e);
2701
+ this.inputMessage = '';
2702
+ }
2703
+ },
2704
+ renderIcon: function renderIcon() {
2705
+ if (this.$props.showIcon) {
2706
+ if (this.$props.icon) {
2707
+ return this.$props.icon;
2708
+ }
2709
+ if (this.$slots.icon) {
2710
+ return this.$slots.icon();
2711
+ }
2712
+ if (this.$props.iconURL) {
2713
+ return createVNode("img", {
2714
+ "style": {
2715
+ maxHeight: '25px'
2716
+ },
2717
+ "src": this.$props.iconURL,
2718
+ "alt": "search-icon"
2719
+ }, null);
2720
+ }
2721
+ return createVNode(SearchSvg, null, null);
2722
+ }
2723
+ return null;
2724
+ },
2725
+ shouldMicRender: function shouldMicRender(showVoiceSearch) {
2726
+ // checks for SSR
2727
+ if (typeof window === 'undefined') return false;
2728
+ return showVoiceSearch && (window.webkitSpeechRecognition || window.SpeechRecognition);
2729
+ },
2730
+ handleVoiceResults: function handleVoiceResults(_ref) {
2731
+ var results = _ref.results;
2732
+ if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
2733
+ this.handleSendMessage(null, false, results[0][0].transcript.trim());
2734
+ }
2735
+ },
2736
+ renderIcons: function renderIcons() {
2737
+ var _this2 = this;
2738
+ var _slot, _slot2;
2739
+ var _this$$props = this.$props,
2740
+ getMicInstance = _this$$props.getMicInstance,
2741
+ showVoiceInput = _this$$props.showVoiceInput,
2742
+ iconPosition = _this$$props.iconPosition,
2743
+ innerClass = _this$$props.innerClass;
2744
+ var renderMic = this.$slots.renderMic || this.$props.renderMic;
2745
+ return createVNode("div", null, [createVNode(IconGroup, {
2746
+ "enableAI": true,
2747
+ "groupPosition": "right",
2748
+ "positionType": "absolute"
2749
+ }, {
2750
+ "default": function _default() {
2751
+ return [_this2.shouldMicRender(showVoiceInput) && createVNode(Mic, {
2752
+ "getInstance": getMicInstance,
2753
+ "render": renderMic,
2754
+ "onResult": _this2.handleVoiceResults,
2755
+ "class": getClassName$2(innerClass, 'ai-search-mic') || null
2756
+ }, null), iconPosition === 'right' && createVNode(IconWrapper, null, _isSlot$1(_slot = _this2.renderIcon()) ? _slot : {
2757
+ "default": function _default() {
2758
+ return [_slot];
2759
+ }
2760
+ })];
2761
+ }
2762
+ }), createVNode(IconGroup, {
2763
+ "enableAI": true,
2764
+ "groupPosition": "left",
2765
+ "positionType": "absolute"
2766
+ }, {
2767
+ "default": function _default() {
2768
+ return [iconPosition === 'left' && createVNode(IconWrapper, null, _isSlot$1(_slot2 = _this2.renderIcon()) ? _slot2 : {
2769
+ "default": function _default() {
2770
+ return [_slot2];
2771
+ }
2772
+ })];
2773
+ }
2774
+ })]);
2775
+ },
2776
+ enterButtonOnClick: function enterButtonOnClick(e) {
2777
+ this.handleSendMessage(e);
2778
+ },
2779
+ renderEnterButtonElement: function renderEnterButtonElement() {
2780
+ var _this3 = this;
2781
+ var _this$$props2 = this.$props,
2782
+ enterButton = _this$$props2.enterButton,
2783
+ innerClass = _this$$props2.innerClass;
2784
+ var renderEnterButton = this.$slots.renderEnterButton;
2785
+ if (enterButton) {
2786
+ var getEnterButtonMarkup = function getEnterButtonMarkup() {
2787
+ if (renderEnterButton) {
2788
+ return renderEnterButton(_this3.enterButtonOnClick);
2789
+ }
2790
+ return createVNode(SendButton, {
2791
+ "primary": true,
2792
+ "type": "submit",
2793
+ "tabIndex": 0,
2794
+ "onClick": _this3.handleSendMessage,
2795
+ "onKeyPress": _this3.handleKeyPress,
2796
+ "class": "enter-btn " + getClassName$2(innerClass, 'ai-enter-button')
2797
+ }, {
2798
+ "default": function _default() {
2799
+ return [createTextVNode("Send")];
2800
+ }
2801
+ });
2802
+ };
2803
+ return createVNode("div", {
2804
+ "class": "ai-enter-button-wrapper"
2805
+ }, [getEnterButtonMarkup()]);
2806
+ }
2807
+ return null;
2808
+ },
2809
+ getComponent: function getComponent$1() {
2810
+ var data = {
2811
+ error: this.AIResponseError,
2812
+ loading: this.isAIResponseLoading,
2813
+ data: this.messages,
2814
+ rawData: this.rawData
2815
+ };
2816
+ return getComponent(data, this);
2817
+ },
2818
+ handleTextAreaHeightChange: function handleTextAreaHeightChange() {
2819
+ var _this$$refs2, _this$$refs2$_inputRe, _this$$refs3, _this$$refs3$_inputWr, _this$$refs4;
2820
+ var textArea = (_this$$refs2 = this.$refs) == null ? void 0 : (_this$$refs2$_inputRe = _this$$refs2[_inputRef]) == null ? void 0 : _this$$refs2$_inputRe.$el;
2821
+ var inputWrapper = (_this$$refs3 = this.$refs) == null ? void 0 : (_this$$refs3$_inputWr = _this$$refs3[_inputWrapperRef]) == null ? void 0 : _this$$refs3$_inputWr.$el;
2822
+ var errorContainer = (_this$$refs4 = this.$refs) == null ? void 0 : _this$$refs4[_errorContainerRef];
2823
+ if (textArea) {
2824
+ textArea.style.height = '42px';
2825
+ var lineHeight = parseInt(getComputedStyle(textArea).lineHeight, 10);
2826
+ var maxHeight = lineHeight * 11; // max height for 10 lines
2827
+ var height = Math.min(textArea.scrollHeight, maxHeight);
2828
+ textArea.style.height = height + "px";
2829
+ textArea.style.overflowY = height === maxHeight ? 'auto' : 'hidden';
2830
+ // wrapper around input/ textarea
2831
+ inputWrapper.style.height = height + "px";
2832
+ // adjust error-container
2833
+
2834
+ if (errorContainer) {
2835
+ errorContainer.style.bottom = height + "px";
2836
+ }
2837
+ this.$forceUpdate();
2838
+ }
2839
+ }
2840
+ },
2841
+ beforeUnmount: function beforeUnmount() {
2842
+ if (this.$props.clearSessionOnDestroy) {
2843
+ // cleanup logic
2844
+ // final Object to store in local storage cache
2845
+ var finalCacheObj = getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {};
2846
+ // delete current component's cache
2847
+ delete finalCacheObj[this.$props.componentId];
2848
+ // update local cache
2849
+ setObjectInLocalStorage(AI_LOCAL_CACHE_KEY, finalCacheObj);
2850
+ }
2851
+ },
2852
+ render: function render() {
2853
+ var _slot3;
2854
+ var _this4 = this;
2855
+ var props = this.$props;
2856
+ if (!this.shouldShowComponent) {
2857
+ return null;
2858
+ }
2859
+ return createVNode(Chatbox, null, {
2860
+ "default": function _default() {
2861
+ return [_this4.$props.title && createVNode(Title, {
2862
+ "class": getClassName$2(_this4.$props.innerClass, 'title') || ''
2863
+ }, {
2864
+ "default": function _default() {
2865
+ return [_this4.$props.title];
2866
+ }
2867
+ }), createVNode(ChatContainer, {
2868
+ "theme": props.theme,
2869
+ "showInput": props.showInput
2870
+ }, {
2871
+ "default": function _default() {
2872
+ return [_this4.hasCustomRenderer && createVNode(MessagesContainer, {
2873
+ "themePreset": _this4.themePreset,
2874
+ "theme": props.theme,
2875
+ "ref": _this4.$props.innerRef,
2876
+ "class": "--ai-message-container " + (getClassName$2(props.innerClass, 'ai-message-container') || '')
2877
+ }, _isSlot$1(_slot3 = _this4.getComponent()) ? _slot3 : {
2878
+ "default": function _default() {
2879
+ return [_slot3];
2880
+ }
2881
+ }), !_this4.hasCustomRenderer && createVNode(MessagesContainer, {
2882
+ "themePreset": _this4.themePreset,
2883
+ "theme": props.theme,
2884
+ "ref": _this4.$props.innerRef,
2885
+ "class": "--ai-message-container " + (getClassName$2(props.innerClass, 'ai-message-container') || '')
2886
+ }, {
2887
+ "default": function _default() {
2888
+ return [_this4.messages.map(function (message, index) {
2889
+ return createVNode(Message, {
2890
+ "key": index,
2891
+ "isSender": message.role === AI_ROLES.USER,
2892
+ "innerHTML": md$1.render(message.content),
2893
+ "themePreset": _this4.themePreset,
2894
+ "theme": props.theme,
2895
+ "class": "--ai-answer-message " + (getClassName$2(props.innerClass, 'ai-message') || '')
2896
+ }, null);
2897
+ }), _this4.isLoadingState && createVNode(Message, {
2898
+ "themePreset": _this4.themePreset,
2899
+ "theme": props.theme,
2900
+ "isSender": false,
2901
+ "class": "--ai-answer-message " + (getClassName$2(props.innerClass, 'ai-message') || null)
2902
+ }, {
2903
+ "default": function _default() {
2904
+ return [createVNode(TypingIndicator, null, {
2905
+ "default": function _default() {
2906
+ return [createVNode(TypingDot, {
2907
+ "themePreset": _this4.themePreset
2908
+ }, null), createVNode(TypingDot, {
2909
+ "themePreset": _this4.themePreset
2910
+ }, null), createVNode(TypingDot, {
2911
+ "themePreset": _this4.themePreset
2912
+ }, null)];
2913
+ }
2914
+ })];
2915
+ }
2916
+ })];
2917
+ }
2918
+ }), _this4.renderErrorComponent(), ' ', props.showFeedback && createVNode("div", {
2919
+ "class": "--ai-answer-feedback-container " + (getClassName$2(props.innerClass, 'ai-feedback') || '')
2920
+ }, [createVNode(AIFeedback, {
2921
+ "hideUI": _this4.isLoadingState || !_this4.sessionId,
2922
+ "key": _this4.sessionId,
2923
+ "onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
2924
+ _this4.trackUsefullness(_this4.sessionId, {
2925
+ useful: useful,
2926
+ reason: reason
2927
+ });
2928
+ }
2929
+ }, null)]), props.showInput && createVNode(MessageInputContainer, {
2930
+ "class": "--ai-input-container",
2931
+ "onSubmit": _this4.handleSendMessage
2932
+ }, {
2933
+ "default": function _default() {
2934
+ return [createVNode(InputGroup, {
2935
+ "enableAI": true,
2936
+ "isOpen": false
2937
+ }, {
2938
+ "default": function _default() {
2939
+ return [createVNode(InputWrapper, {
2940
+ "ref": _inputWrapperRef
2941
+ }, {
2942
+ "default": function _default() {
2943
+ return [createVNode(MessageInput, {
2944
+ "ref": _inputRef,
2945
+ "type": "text",
2946
+ "placeholder": props.placeholder,
2947
+ "enterButton": props.enterButton,
2948
+ "value": _this4.inputMessage,
2949
+ "onInput": _this4.handleMessageInputChange,
2950
+ "onKeyPress": _this4.handleKeyPress,
2951
+ "id": props.componentId + "-ai-input",
2952
+ "showIcon": props.showIcon,
2953
+ "iconPosition": props.iconPosition,
2954
+ "themePreset": _this4.themePreset,
2955
+ "disabled": _this4.isLoadingState,
2956
+ "class": getClassName$2(props.innerClass, 'ai-input') || null
2957
+ }, null), ' ', _this4.renderIcons()];
2958
+ }
2959
+ })];
2960
+ }
2961
+ }), _this4.renderEnterButtonElement()];
2962
+ }
2963
+ }), ' '];
2964
+ }
2965
+ })];
2966
+ }
2967
+ });
2968
+ }
2969
+ });
2970
+ AIAnswer.hasInternalComponent = function () {
2971
+ return true;
2972
+ };
2973
+ var mapStateToProps$1 = function mapStateToProps(state, props) {
2974
+ var dependencyComponent = Object.values(props.react)[0];
2975
+ if (Array.isArray(dependencyComponent)) {
2976
+ // eslint-disable-next-line prefer-destructuring
2977
+ dependencyComponent = dependencyComponent[0];
2978
+ }
2979
+ var showComponent = state.selectedValues[dependencyComponent] && state.selectedValues[dependencyComponent].value;
2980
+ return {
2981
+ showComponent: showComponent,
2982
+ AIResponse: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response,
2983
+ isAIResponseLoading: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].isLoading,
2984
+ AIResponseError: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].error,
2985
+ rawData: state.rawData[props.componentId],
2986
+ themePreset: state.config.themePreset,
2987
+ isLoading: state.isLoading[props.componentId] || false,
2988
+ sessionIdFromStore: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.sessionId || ''
2989
+ };
2990
+ };
2991
+ var mapDispatchToProps$1 = {
2992
+ getAIResponse: fetchAIResponse,
2993
+ trackUsefullness: recordAISessionUsefulness
2994
+ };
2995
+ var AIConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps$1, mapDispatchToProps$1)(AIAnswer), {
2996
+ componentType: componentTypes.AIAnswer,
2997
+ internalComponent: true
2998
+ }));
2999
+ AIConnected.name = AIAnswer.name;
3000
+ AIConnected.hasInternalComponent = AIAnswer.hasInternalComponent;
3001
+ AIConnected.install = function (Vue) {
3002
+ Vue.component(AIConnected.name, AIConnected);
3003
+ };
3004
+ // Add componentType for SSR
3005
+ AIConnected.componentType = componentTypes.AIAnswer;
3006
+
3007
+ var _templateObject$b, _templateObject2$4;
3008
+ var HierarchicalMenuList = styled('ul')(_templateObject$b || (_templateObject$b = _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"])));
3009
+ var HierarchicalMenuListItem = styled('li')(_templateObject2$4 || (_templateObject2$4 = _taggedTemplateLiteralLoose(["\n\tfont-weight: 400;\n\tline-height: 1.5;\n\tbox-sizing: border-box;\n\n\ta {\n\t\tcolor: #424242;\n\t\ttext-decoration: none;\n\t\tgap: 5px;\n\t\t.--leaf-icon,\n\t\t.--folder-icon {\n\t\t\tline-height: 15px;\n\t\t\tsvg {\n\t\t\t\theight: 15px;\n\t\t\t}\n\t\t}\n\n\t\tinput {\n\t\t\tmargin: 0;\n\t\t\tcursor: pointer;\n\t\t}\n\t}\n\n\t.--switcher-icon {\n\t\ttransition: all 0.2s ease-in;\n\t\tmargin-right: 2px;\n\t}\n\t.--list-child {\n\t\tpadding-left: 1rem;\n\t\tposition: relative;\n\t\t&:before {\n\t\t\theight: 100%;\n\t\t\tcontent: '';\n\t\t\tposition: absolute;\n\t\t\tborder-left: 1px solid #787878;\n\t\t\twidth: 0;\n\t\t\tleft: 19px;\n\t\t\t", ";\n\t\t}\n\n\t\t&.--show-switcher-icon {\n\t\t\tpadding-left: 36px;\n\t\t}\n\t}\n\t.--list-item-label {\n\t\tline-height: 100%;\n\t}\n\t.--list-item-count {\n\t\tmargin-left: 10px;\n\t\tpadding: 0.1rem 0.4rem;\n\t\tfont-size: 0.8rem;\n\t\tcolor: #424242;\n\t\tbackground-color: #dee1e6;\n\t\tborder-radius: 8px;\n\t}\n\t&.-selected-item {\n\t\tfont-weight: 700 !important;\n\t}\n\t&.-expanded-item {\n\t\t& > a {\n\t\t\t& div > .--switcher-icon {\n\t\t\t\ttransform: rotate(90deg);\n\t\t\t}\n\t\t}\n\t}\n\t.--list-item-label-count-wrapper {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\t&:hover {\n\t\t\t.--list-item-count,\n\t\t\t.--list-item-label {\n\t\t\t\tfont-weight: 700;\n\t\t\t}\n\t\t}\n\t}\n"])), function (props) {
1868
3010
  return !props.showLine && "\n\t\t\t\t\tdisplay: none;\n\t\t\t\t";
1869
3011
  });
1870
3012
 
@@ -2077,7 +3219,7 @@ var HierarchicalMenuListItemComponent = {
2077
3219
  }
2078
3220
  };
2079
3221
 
2080
- function _isSlot$1(s) {
3222
+ function _isSlot$2(s) {
2081
3223
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
2082
3224
  }
2083
3225
  var HierarchicalMenuComponent = {
@@ -2102,7 +3244,7 @@ var HierarchicalMenuComponent = {
2102
3244
  return createVNode(HierarchicalMenuList, {
2103
3245
  "class": "" + (isExpanded ? '--open' : ''),
2104
3246
  "isSelected": isExpanded
2105
- }, _isSlot$1(_slot = listArray.map(function (listItem) {
3247
+ }, _isSlot$2(_slot = listArray.map(function (listItem) {
2106
3248
  return createVNode(HierarchicalMenuListItemComponent, mergeProps({
2107
3249
  "key": parentPath + "__" + JSON.stringify(listItem),
2108
3250
  "parentPath": parentPath,
@@ -2116,7 +3258,7 @@ var HierarchicalMenuComponent = {
2116
3258
  }
2117
3259
  };
2118
3260
 
2119
- function _isSlot$2(s) {
3261
+ function _isSlot$3(s) {
2120
3262
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
2121
3263
  }
2122
3264
  var updateQueryAction = Actions.updateQuery,
@@ -2566,7 +3708,7 @@ var TreeList = {
2566
3708
  "default": function _default() {
2567
3709
  return [props.title && createVNode(Title, {
2568
3710
  "class": getClassName$2(innerClass, 'title') || null
2569
- }, _isSlot$2(title) ? title : {
3711
+ }, _isSlot$3(title) ? title : {
2570
3712
  "default": function _default() {
2571
3713
  return [title];
2572
3714
  }
@@ -2595,7 +3737,7 @@ var TreeList = {
2595
3737
  });
2596
3738
  }
2597
3739
  };
2598
- var mapStateToProps$1 = function mapStateToProps(state, props) {
3740
+ var mapStateToProps$2 = function mapStateToProps(state, props) {
2599
3741
  return {
2600
3742
  selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
2601
3743
  rawData: state.rawData[props.componentId] || {},
@@ -2613,7 +3755,7 @@ var mapDispatchtoProps = {
2613
3755
  TreeList.hasInternalComponent = function () {
2614
3756
  return true;
2615
3757
  };
2616
- var TreeListConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps$1, mapDispatchtoProps)(TreeList), {
3758
+ var TreeListConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps$2, mapDispatchtoProps)(TreeList), {
2617
3759
  componentType: componentTypes.treeList,
2618
3760
  internalComponent: TreeList.hasInternalComponent()
2619
3761
  }));
@@ -2681,7 +3823,7 @@ RcConnected.install = function (Vue) {
2681
3823
  Vue.component(RcConnected.name, RcConnected);
2682
3824
  };
2683
3825
 
2684
- var components = [ReactiveList, ResultCard, ResultList, ReactiveBase, SBConnected, SingleList, MultiList, SingleRange, MultiRange, RangeSlider, DynamicRangeSlider, ReactiveComponent, RcConnected, SelectedFilters, ToggleButton, SingleDropdownList, MultiDropdownList, StateProvider, RangeInput, TreeListConnected];
3826
+ var components = [ReactiveList, ResultCard, ResultList, ReactiveBase, SBConnected, SingleList, MultiList, SingleRange, MultiRange, RangeSlider, DynamicRangeSlider, ReactiveComponent, RcConnected, SelectedFilters, ToggleButton, SingleDropdownList, MultiDropdownList, StateProvider, RangeInput, TreeListConnected, AIConnected];
2685
3827
  function install (Vue) {
2686
3828
  components.map(function (component) {
2687
3829
  Vue.use(component);
@@ -2689,4 +3831,4 @@ function install (Vue) {
2689
3831
  });
2690
3832
  }
2691
3833
 
2692
- export { RcConnected as R, SBConnected as S, TreeListConnected as T, install as i };
3834
+ export { AIConnected as A, RcConnected as R, SBConnected as S, TreeListConnected as T, install as i };