@appbaseio/reactivesearch-vue 3.0.0-rc.2 → 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 (57) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +8117 -7235
  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/{DropDown-3797bb6a.js → DropDown-aef75c14.js} +7 -4
  7. package/dist/cjs/DynamicRangeSlider.js +1 -1
  8. package/dist/cjs/{Input-497be42a.js → Input-56eba499.js} +71 -1
  9. package/dist/cjs/MultiDropdownList.js +5 -4
  10. package/dist/cjs/MultiList.js +2 -2
  11. package/dist/cjs/MultiRange.js +1 -1
  12. package/dist/cjs/{Pagination-b1a053a7.js → Pagination-58a0cf3f.js} +2 -2
  13. package/dist/cjs/RangeInput.js +2 -2
  14. package/dist/cjs/RangeSlider.js +1 -1
  15. package/dist/cjs/ReactiveBase.js +1 -1
  16. package/dist/cjs/ReactiveComponent.js +1 -1
  17. package/dist/cjs/ReactiveGoogleMap.js +4 -3
  18. package/dist/cjs/ReactiveList.js +3 -3
  19. package/dist/cjs/ResultCard.js +1 -1
  20. package/dist/cjs/ResultList.js +1 -1
  21. package/dist/cjs/SelectedFilters.js +3 -2
  22. package/dist/cjs/SingleDropdownList.js +5 -4
  23. package/dist/cjs/SingleList.js +2 -2
  24. package/dist/cjs/SingleRange.js +1 -1
  25. package/dist/cjs/ToggleButton.js +3 -2
  26. package/dist/cjs/index.js +7 -7
  27. package/dist/cjs/{install-581d2e18.js → install-b495bb2c.js} +803 -230
  28. package/dist/cjs/install.js +7 -7
  29. package/dist/cjs/version.js +1 -1
  30. package/dist/cjs/{vueTypes-d05e44cc.js → vueTypes-a5f1745e.js} +10 -0
  31. package/dist/es/{Button-fd869491.js → Button-c2ff5178.js} +13 -6
  32. package/dist/es/{DropDown-ff8e06b4.js → DropDown-39fedff8.js} +7 -4
  33. package/dist/es/DynamicRangeSlider.js +1 -1
  34. package/dist/es/{Input-f7499ef8.js → Input-11d211d2.js} +71 -2
  35. package/dist/es/MultiDropdownList.js +5 -4
  36. package/dist/es/MultiList.js +2 -2
  37. package/dist/es/MultiRange.js +1 -1
  38. package/dist/es/{Pagination-aecb3914.js → Pagination-ae401c33.js} +2 -2
  39. package/dist/es/RangeInput.js +2 -2
  40. package/dist/es/RangeSlider.js +1 -1
  41. package/dist/es/ReactiveBase.js +1 -1
  42. package/dist/es/ReactiveComponent.js +1 -1
  43. package/dist/es/ReactiveGoogleMap.js +4 -3
  44. package/dist/es/ReactiveList.js +3 -3
  45. package/dist/es/ResultCard.js +1 -1
  46. package/dist/es/ResultList.js +1 -1
  47. package/dist/es/SelectedFilters.js +3 -2
  48. package/dist/es/SingleDropdownList.js +5 -4
  49. package/dist/es/SingleList.js +2 -2
  50. package/dist/es/SingleRange.js +1 -1
  51. package/dist/es/ToggleButton.js +3 -2
  52. package/dist/es/index.js +8 -8
  53. package/dist/es/{install-3c029475.js → install-6011bce3.js} +806 -233
  54. package/dist/es/install.js +7 -7
  55. package/dist/es/version.js +1 -1
  56. package/dist/es/{vueTypes-d64f04f8.js → vueTypes-09cab4d3.js} +10 -0
  57. package/package.json +5 -4
@@ -12,8 +12,8 @@ var helper = require('@appbaseio/reactivecore/lib/utils/helper');
12
12
  var vueEmotion = require('@appbaseio/vue-emotion');
13
13
  var css = require('@emotion/css');
14
14
  var polished = require('polished');
15
- var Button = require('./Button-d4da7470.js');
16
- var vueTypes = require('./vueTypes-d05e44cc.js');
15
+ var Button = require('./Button-9e179864.js');
16
+ var vueTypes = require('./vueTypes-a5f1745e.js');
17
17
  var ReactiveList = require('./ReactiveList.js');
18
18
  var transform = require('@appbaseio/reactivecore/lib/utils/transform');
19
19
  var index = require('./index-779ed366.js');
@@ -22,14 +22,15 @@ var PreferencesConsumer = require('./PreferencesConsumer-85dee673.js');
22
22
  var Title = require('./Title-8802a218.js');
23
23
  var ListItem = require('./ListItem-7a682970.js');
24
24
  var Flex = require('./Flex-ddde6d26.js');
25
+ var analytics = require('@appbaseio/reactivecore/lib/actions/analytics');
25
26
  var ReactiveBase = require('./ReactiveBase.js');
26
27
  var hotkeys = _interopDefault(require('hotkeys-js'));
27
- var DropDown = require('./DropDown-3797bb6a.js');
28
- var Input = require('./Input-497be42a.js');
28
+ var remarkable = require('remarkable');
29
+ var DropDown = require('./DropDown-aef75c14.js');
30
+ var Input = require('./Input-56eba499.js');
29
31
  var Container = require('./Container-29f049b2.js');
30
32
  var Highlight = _interopDefault(require('vue-highlight-words'));
31
33
  var query = require('@appbaseio/reactivecore/lib/actions/query');
32
- var remarkable = require('remarkable');
33
34
  var suggestions = require('@appbaseio/reactivecore/lib/utils/suggestions');
34
35
  var FormControlList = require('./FormControlList-fadd792f.js');
35
36
  var utils = require('./utils-c9bd5628.js');
@@ -51,7 +52,7 @@ var ResultList = require('./ResultList.js');
51
52
  var StateProvider = require('./StateProvider.js');
52
53
 
53
54
  var _templateObject;
54
- var InputGroup = vueEmotion.styled('div')(_templateObject || (_templateObject = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n display: flex;\n align-items: stretch;\n width: 100%;\n"])));
55
+ var InputGroup = vueEmotion.styled('div')(_templateObject || (_templateObject = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: stretch;\n\twidth: 100%;\n"])));
55
56
  InputGroup.defaultProps = {
56
57
  className: 'input-group'
57
58
  };
@@ -759,9 +760,305 @@ var _templateObject$7, _templateObject2;
759
760
  var TagsContainer = vueEmotion.styled('div')(_templateObject$7 || (_templateObject$7 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tmargin-top: 10px;\n\twidth: 100%;\n"])));
760
761
  var TagItem = vueEmotion.styled('span')(_templateObject2 || (_templateObject2 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tcursor: default;\n\tbox-sizing: border-box;\n\tmargin: 0 4px 4px 0;\n\tcolor: #000000d9;\n\tfont-size: 14px;\n\tfont-variant: tabular-nums;\n\tline-height: 1.5715;\n\tlist-style: none;\n\tfont-feature-settings: 'tnum';\n\tdisplay: inline-block;\n\theight: auto;\n\tpadding: 0 2px 0 7px;\n\tfont-size: 12px;\n\tline-height: 22px;\n\twhite-space: nowrap;\n\tbackground: #fafafa;\n\tborder: 1px solid #d9d9d9;\n\tborder-radius: 2px;\n\topacity: 1;\n\ttransition: all 0.3s;\n\n\tspan.close-icon {\n\t\tsvg {\n\t\t\tcursor: pointer;\n\t\t\theight: 15px;\n\t\t\tposition: relative;\n\t\t\ttop: 4px;\n\t\t\tfill: #262626;\n\t\t}\n\t}\n"])));
761
762
 
763
+ var _templateObject$8, _templateObject2$1, _templateObject3;
764
+ var skeletonAnimation = css.keyframes(_templateObject$8 || (_templateObject$8 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n 0% {\n background-position: 100% 0;\n }\n 100% {\n background-position: -200% 0;\n }\n"])));
765
+ var SkeletonLoader = vueEmotion.styled('div')(_templateObject2$1 || (_templateObject2$1 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n"])));
766
+ var SkeletonLine = vueEmotion.styled('div')(_templateObject3 || (_templateObject3 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\theight: 20px;\n\tbackground: linear-gradient(\n\t\t90deg,\n\t\trgba(220, 220, 220, 0.5) 25%,\n\t\trgba(240, 240, 240, 0.9) 50%,\n\t\trgba(220, 220, 220, 0.5) 75%\n\t);\n\tbackground-size: 200% 100%;\n\tanimation: ", " 1.5s infinite;\n"])), skeletonAnimation);
767
+ var HorizontalSkeletonLoader = vue.defineComponent({
768
+ name: 'HorizontalSkeletonLoader',
769
+ render: function render() {
770
+ return vue.createVNode(SkeletonLoader, null, {
771
+ "default": function _default() {
772
+ return [vue.createVNode(SkeletonLine, null, null), vue.createVNode(SkeletonLine, null, null), vue.createVNode(SkeletonLine, null, null), vue.createVNode(SkeletonLine, null, null)];
773
+ }
774
+ });
775
+ }
776
+ });
777
+
778
+ var _templateObject$9, _templateObject2$2, _templateObject3$1, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
779
+ var Chatbox = vueEmotion.styled('div')(_templateObject$9 || (_templateObject$9 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tmargin: 0 auto;\n\tpadding: 10px;\n\tbackground-color: #fafafa;\n\twidth: 100%;\n\tbox-shadow: rgb(0 0 0 / 20%) 0px 0px 6px;\n\tborder-radius: 6px;\n\tmargin-bottom: 20px;\n\tbackground-color: ", ";\n"])), function (props) {
780
+ return props.theme && props.theme.colors ? props.theme.colors.backgroundColor : '#fff';
781
+ });
782
+ var ChatContainer = vueEmotion.styled('div')(_templateObject2$2 || (_templateObject2$2 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\theight: 100%;\n\tposition: relative;\n\t.--ai-answer-error-container {\n\t\ttext-align: center;\n\t\tposition: absolute;\n\t\tbottom: 0px;\n\t\t", ";\n\t\tz-index: 1;\n\t\tleft: 50%;\n\t\ttransform: translateX(-50%);\n\t\twidth: 100%;\n\n\t\t.--default-error-element {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\talign-items: center;\n\t\t\tpadding: 10px;\n\t\t\tbackground-color: ", ";\n\t\t\tbox-shadow: 0 -5px 5px -2px\n\t\t\t\t", ";\n\n\t\t\tspan {\n\t\t\t\tmargin-bottom: 5px;\n\t\t\t}\n\n\t\t\tbutton {\n\t\t\t}\n\t\t}\n\t}\n\n\t", ";\n"])), function (props) {
783
+ return props.showInput ? 'bottom: 48px;' : '';
784
+ }, function (props) {
785
+ return props.theme && props.theme.colors && props.theme.colors.backgroundColor ? props.theme.colors.backgroundColor : '#fff';
786
+ }, function (props) {
787
+ return props.theme && props.theme.colors && props.theme.colors.backgroundColor ? props.theme.colors.backgroundColor : '#fff';
788
+ }, function (props) {
789
+ 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}";
790
+ });
791
+ var MessagesContainer = vueEmotion.styled('div')(_templateObject3$1 || (_templateObject3$1 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tmax-height: 400px;\n overflow-y: auto;\n\tpadding: 10px;\n\tdisplay: flex;\n\tflex-direction: column;\n\tmin-height: 200px;\n\n}};\n"])));
792
+ var typingDots = css.keyframes(_templateObject4 || (_templateObject4 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n 0% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(-70%);\n }\n 100% {\n transform: translateY(0);\n }\n"])));
793
+ var TypingIndicator = vueEmotion.styled('div')(_templateObject5 || (_templateObject5 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tmargin: 5px !important;\n"])));
794
+ var TypingDot = vueEmotion.styled('div')(_templateObject6 || (_templateObject6 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\twidth: 6px;\n\theight: 6px;\n\tbackground-color: ", ";\n\tborder-radius: 50%;\n\tmargin: 0 2px !important;\n\tanimation: ", " 1s infinite;\n\t&:nth-child(2) {\n\t\tanimation-delay: 0.2s;\n\t}\n\t&:nth-child(3) {\n\t\tanimation-delay: 0.4s;\n\t}\n"])), function (props) {
795
+ var finalColor;
796
+ if (props.isSender) {
797
+ finalColor = props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor;
798
+ } else {
799
+ finalColor = props.themePreset !== 'dark' ? props.theme.colors.borderColor : props.theme.colors.textColor;
800
+ }
801
+ return finalColor;
802
+ }, typingDots);
803
+ var resetCSS = function resetCSS(props) {
804
+ 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: " + (
805
+ // eslint-disable-next-line no-nested-ternary
806
+ 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: " + (
807
+ // eslint-disable-next-line no-nested-ternary
808
+ 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";
809
+ };
810
+ var messageBGColor = function messageBGColor(props) {
811
+ var finalBGColor;
812
+ if (props.isSender) {
813
+ finalBGColor = props.themePreset !== 'dark' ? props.theme.colors.primaryColor : props.theme.colors.borderColor;
814
+ } else {
815
+ finalBGColor = props.themePreset !== 'dark' ? polished.lighten(0.53, props.theme.colors.borderColor) : props.theme.colors.backgroundColor;
816
+ }
817
+ return finalBGColor;
818
+ };
819
+ var Message = vueEmotion.styled('div')(_templateObject7 || (_templateObject7 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tbackground-color: ", ";\n\tcolor: ", ";\n\tborder: 1px solid\n\t\t", ";\n\tpadding: 10px;\n\tborder-radius: 7px;\n\tmargin-bottom: 10px;\n\tmax-width: 80%;\n\talign-self: ", ";\n\tdisplay: inline-block;\n\tposition: relative;\n\toverflow-wrap: anywhere;\n\t", "\n"])), function (props) {
820
+ return messageBGColor(props);
821
+ }, function (props) {
822
+ var finalColor;
823
+ if (props.isSender) {
824
+ finalColor = props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor;
825
+ } else {
826
+ finalColor = props.themePreset !== 'dark' ? props.theme.colors.borderColor : props.theme.colors.textColor;
827
+ }
828
+ return finalColor;
829
+ }, function (props) {
830
+ return props.themePreset === 'dark' ? 'currentColor' : messageBGColor(props);
831
+ }, function (props) {
832
+ return props.isSender ? 'flex-end' : 'flex-start';
833
+ }, function (props) {
834
+ return resetCSS(props);
835
+ });
836
+ var MessageInputContainer = vueEmotion.styled('form')(_templateObject8 || (_templateObject8 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tpadding-top: 12px;\n\talign-items: stretch;\n\tmargin-top: 10px;\n\t.ai-enter-button-wrapper {\n\t\talign-self: baseline;\n\t\theight: 41px;\n\t}\n"])));
837
+ var MessageInput = vueEmotion.styled(Input.TextArea)(_templateObject9 || (_templateObject9 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tborder-radius: 5px;\n\tborder: 1px solid #ccc;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\n\t::placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t:-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t::-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n\t", "\n"])), function (props) {
838
+ return props.themePreset === 'dark' ? props.theme.colors.borderColor : '#fff';
839
+ }, function (props) {
840
+ return props.themePreset === 'dark' ? props.theme.colors.titleColor : props.theme.colors.textColor;
841
+ }, function (props) {
842
+ return props.theme.colors.textColor;
843
+ }, function (props) {
844
+ return props.theme.colors.textColor;
845
+ }, function (props) {
846
+ return props.theme.colors.textColor;
847
+ }, function (_ref) {
848
+ var enterButton = _ref.enterButton;
849
+ return enterButton && "\n\t\t border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\t";
850
+ });
851
+ var SendButton = vueEmotion.styled(Button.Button)(_templateObject10 || (_templateObject10 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tborder: none;\n\tcolor: #ffffff;\n\tcursor: pointer;\n\tfont-size: 16px;\n\tmargin-left: 8px;\n\toutline: none;\n\tpadding: 10px;\n\ttext-align: center;\n"])));
852
+ var AIFeedbackContainer = vueEmotion.styled('div')(_templateObject11 || (_templateObject11 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\t.--feedback-svgs-wrapper {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: flex-end;\n\t\tgap: 5px;\n\n\t\tsvg {\n\t\t\tcursor: pointer;\n\t\t\ttransition: all ease-in 0.1s;\n\t\t\t&.selected {\n\t\t\t\ttransform: scale(1.1);\n\t\t\t\tcursor: default;\n\t\t\t}\n\n\t\t\t&:hover {\n\t\t\t\ttransform: scale(1.1);\n\t\t\t}\n\t\t}\n\t}\n\n\t.--feedback-input-wrapper {\n\t\tdisplay: flex;\n\t\tgap: 7px;\n\t}\n"])));
853
+
854
+ var _templateObject$a, _templateObject2$3, _templateObject3$2, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7$1;
855
+ var fadeInFromBottom = css.keyframes(_templateObject$a || (_templateObject$a = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n 0% {\n opacity: 0;\n transform: translateY(20px);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n"])));
856
+ var fadeInFromTop = css.keyframes(_templateObject2$3 || (_templateObject2$3 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n 0% {\n opacity: 0;\n transform: translateY(-20px);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n"])));
857
+ var SearchBoxAISection = vueEmotion.styled('div')(_templateObject3$2 || (_templateObject3$2 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tpadding: 10px;\n\tborder-radius: 4px;\n\tmin-height: 200px;\n\tpadding-top: 20px;\n\tposition: relative;\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\t.--ai-answer-error-container {\n\t\tposition: absolute;\n\t\ttop: 50%;\n\t\tleft: 50%;\n\t\ttransform: translate(-50%, -50%);\n\t\t.--default-error-element {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\talign-items: center;\n\t\t\tgap: 10px;\n\t\t}\n\t}\n"])), function (_ref) {
858
+ var themePreset = _ref.themePreset,
859
+ theme = _ref.theme;
860
+ return themePreset === 'dark' ? '#424242' : theme.colors.backgroundColor;
861
+ }, function (_ref2) {
862
+ var theme = _ref2.theme;
863
+ return theme.colors.textColor;
864
+ });
865
+ var Question = vueEmotion.styled('div')(_templateObject4$1 || (_templateObject4$1 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tfont-weight: bold;\n\tmargin-bottom: 5px;\n\tanimation: ", " 0.5s ease-out;\n"])), fadeInFromTop);
866
+ var Answer = vueEmotion.styled('div')(_templateObject5$1 || (_templateObject5$1 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\t", "\n\tposition: relative;\n\tmargin-bottom: 5px;\n\tmin-height: 100px;\n\toverflow: auto;\n\twhite-space: pre-wrap;\n\tpre {\n\t\twhite-space: pre-wrap;\n\t}\n\tcode,\n\tpre {\n\t\tdisplay: revert;\n\t}\n"])), function (props) {
867
+ return resetCSS(props);
868
+ });
869
+ var Footer = vueEmotion.styled('div')(_templateObject6$1 || (_templateObject6$1 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tcolor: #777;\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 1rem;\n\tflex-wrap: wrap;\n\tanimation: ", " 0.5s ease-out;\n\tpadding: 10px 0;\n\tbackground: white;\n\tbackground-color: ", ";\n\tcolor: ", ";\n"])), fadeInFromBottom, function (_ref3) {
870
+ var themePreset = _ref3.themePreset,
871
+ theme = _ref3.theme;
872
+ return themePreset === 'dark' ? '#424242' : theme.colors.backgroundColor;
873
+ }, function (_ref4) {
874
+ var theme = _ref4.theme;
875
+ return theme.colors.textColor;
876
+ });
877
+ var SourceTags = vueEmotion.styled('div')(_templateObject7$1 || (_templateObject7$1 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tgap: 8px;\n\tflex-wrap: wrap;\n\t.--ai-source-tag {\n\t\tdisplay: inline-block;\n\t\tmax-width: 200px;\n\t\twhite-space: nowrap;\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t}\n"])));
878
+
879
+ var ThumbsUpSvg = {
880
+ name: 'ThumbsUpSvg',
881
+ props: ['clickHandler', 'className'],
882
+ render: function render() {
883
+ return vue.createVNode("svg", {
884
+ "stroke": "currentColor",
885
+ "fill": "none",
886
+ "strokeWidth": "2",
887
+ "viewBox": "0 0 24 24",
888
+ "strokeLinecap": "round",
889
+ "strokeLinejoin": "round",
890
+ "class": this.$props.className,
891
+ "height": "1em",
892
+ "width": "1em",
893
+ "xmlns": "http://www.w3.org/2000/svg",
894
+ "onClick": this.$props.clickHandler
895
+ }, [vue.createVNode("path", {
896
+ "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"
897
+ }, null)]);
898
+ }
899
+ };
900
+
901
+ var ThumbsDownSvg = {
902
+ name: 'ThumbsDownSvg',
903
+ props: ['clickHandler', 'className'],
904
+ render: function render() {
905
+ return vue.createVNode("svg", {
906
+ "stroke": "currentColor",
907
+ "fill": "none",
908
+ "strokeWidth": "2",
909
+ "viewBox": "0 0 24 24",
910
+ "strokeLinecap": "round",
911
+ "strokeLinejoin": "round",
912
+ "class": this.$props.className,
913
+ "height": "1em",
914
+ "width": "1em",
915
+ "xmlns": "http://www.w3.org/2000/svg",
916
+ "onClick": this.$props.clickHandler
917
+ }, [vue.createVNode("path", {
918
+ "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"
919
+ }, null), ' ']);
920
+ }
921
+ };
922
+
923
+ var AIFeedback = vue.defineComponent({
924
+ name: 'FeedbackComponent',
925
+ props: {
926
+ onFeedbackSubmit: {
927
+ type: Function,
928
+ "default": function _default() {}
929
+ },
930
+ hideUI: {
931
+ type: Boolean,
932
+ "default": false
933
+ },
934
+ overrideState: {
935
+ type: Object,
936
+ "default": function _default() {
937
+ return {};
938
+ }
939
+ }
940
+ },
941
+ setup: function setup(props, _ref) {
942
+ var emit = _ref.emit;
943
+ var showInput = vue.ref(false);
944
+ var feedbackType = vue.ref(null);
945
+ var feedbackText = vue.ref('');
946
+ var feedbackRecorded = vue.ref(false);
947
+ var handleButtonClick = function handleButtonClick(type) {
948
+ if (feedbackType.value === type) {
949
+ feedbackType.value = null;
950
+ showInput.value = false;
951
+ } else {
952
+ feedbackType.value = type;
953
+ showInput.value = true;
954
+ }
955
+ };
956
+ var handleInputChange = function handleInputChange(e) {
957
+ feedbackText.value = e.target.value;
958
+ };
959
+ var handleSubmit = function handleSubmit() {
960
+ emit('feedback-submit', feedbackType.value === 'positive', feedbackText.value);
961
+ feedbackText.value = '';
962
+ showInput.value = false;
963
+ feedbackRecorded.value = true;
964
+ };
965
+ var handleCancel = function handleCancel() {
966
+ feedbackType.value = null;
967
+ feedbackText.value = '';
968
+ showInput.value = false;
969
+ };
970
+ vue.watch(function () {
971
+ return props.overrideState;
972
+ }, function (newValue) {
973
+ if (newValue && newValue.isRecorded) {
974
+ feedbackRecorded.value = true;
975
+ feedbackType.value = newValue.feedbackType || 'positive';
976
+ }
977
+ });
978
+ if (props.overrideState && props.overrideState.isRecorded) {
979
+ feedbackRecorded.value = true;
980
+ feedbackType.value = props.overrideState.feedbackType || 'positive';
981
+ }
982
+ return {
983
+ showInput: showInput,
984
+ feedbackType: feedbackType,
985
+ feedbackText: feedbackText,
986
+ feedbackRecorded: feedbackRecorded,
987
+ handleButtonClick: handleButtonClick,
988
+ handleInputChange: handleInputChange,
989
+ handleSubmit: handleSubmit,
990
+ handleCancel: handleCancel
991
+ };
992
+ },
993
+ render: function render() {
994
+ var _this = this;
995
+ if (this.$props.hideUI) {
996
+ return null;
997
+ }
998
+ if (this.feedbackRecorded) {
999
+ return vue.createVNode(AIFeedbackContainer, null, {
1000
+ "default": function _default() {
1001
+ return [vue.createVNode("div", {
1002
+ "class": "--feedback-svgs-wrapper"
1003
+ }, [_this.feedbackType === 'positive' ? vue.createVNode(ThumbsUpSvg, {
1004
+ "class": "selected"
1005
+ }, null) : vue.createVNode(ThumbsDownSvg, {
1006
+ "class": "selected"
1007
+ }, null)])];
1008
+ }
1009
+ });
1010
+ }
1011
+ return vue.createVNode(AIFeedbackContainer, null, {
1012
+ "default": function _default() {
1013
+ return [!_this.showInput && vue.createVNode("div", {
1014
+ "class": "--feedback-svgs-wrapper"
1015
+ }, [vue.createVNode(ThumbsUpSvg, {
1016
+ "class": _this.feedbackType === 'positive' ? 'selected' : '',
1017
+ "onClick": function onClick() {
1018
+ return _this.handleButtonClick('positive');
1019
+ }
1020
+ }, null), vue.createVNode(ThumbsDownSvg, {
1021
+ "class": _this.feedbackType === 'negative' ? 'selected' : '',
1022
+ "onClick": function onClick() {
1023
+ return _this.handleButtonClick('negative');
1024
+ }
1025
+ }, null)]), _this.showInput && vue.createVNode("div", {
1026
+ "class": "--feedback-input-wrapper"
1027
+ }, [vue.createVNode(Input.Input, {
1028
+ "show": _this.showInput,
1029
+ "placeholder": _this.feedbackType === 'positive' ? 'What do you like about the response?' : 'What was the issue with the response? How can it be improved?',
1030
+ "value": _this.feedbackText,
1031
+ "onInput": _this.handleInputChange
1032
+ }, null), vue.createVNode(Button.Button, {
1033
+ "primary": true,
1034
+ "onClick": _this.handleSubmit
1035
+ }, {
1036
+ "default": function _default() {
1037
+ return [vue.createTextVNode("Submit")];
1038
+ }
1039
+ }), vue.createVNode(Button.Button, {
1040
+ "onClick": _this.handleCancel
1041
+ }, {
1042
+ "default": function _default() {
1043
+ return [vue.createTextVNode("Cancel")];
1044
+ }
1045
+ })])];
1046
+ }
1047
+ });
1048
+ }
1049
+ });
1050
+
1051
+ var _excluded = ["_source"];
762
1052
  function _isSlot(s) {
763
1053
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
764
1054
  }
1055
+ var md = new remarkable.Remarkable();
1056
+ md.set({
1057
+ html: true,
1058
+ breaks: true,
1059
+ xhtmlOut: true
1060
+ });
1061
+ var _dropdownULRef = 'dropdownULRef';
765
1062
  var updateQuery = reactivecore.Actions.updateQuery,
766
1063
  setCustomQuery = reactivecore.Actions.setCustomQuery,
767
1064
  setDefaultQuery = reactivecore.Actions.setDefaultQuery,
@@ -782,7 +1079,11 @@ var SearchBox = vue.defineComponent({
782
1079
  currentValue: '',
783
1080
  selectedTags: [],
784
1081
  isOpen: false,
785
- normalizedSuggestions: []
1082
+ normalizedSuggestions: [],
1083
+ showAIScreen: false,
1084
+ showAIScreenFooter: false,
1085
+ showFeedbackComponent: false,
1086
+ feedbackState: null
786
1087
  };
787
1088
  this.internalComponent = props.componentId + "__internal";
788
1089
  return this.__state;
@@ -904,7 +1205,10 @@ var SearchBox = vue.defineComponent({
904
1205
  mode: VueTypes.oneOf(['select', 'tag']).def('select'),
905
1206
  renderSelectedTags: VueTypes.any,
906
1207
  searchboxId: VueTypes.string,
907
- endpoint: vueTypes.types.endpointConfig
1208
+ endpoint: vueTypes.types.endpointConfig,
1209
+ enableAI: vueTypes.types.bool,
1210
+ AIConfig: vueTypes.types.AIConfig,
1211
+ AIUIConfig: vueTypes.types.AIUIConfig
908
1212
  },
909
1213
  mounted: function mounted() {
910
1214
  this.listenForFocusShortcuts();
@@ -1011,6 +1315,47 @@ var SearchBox = vue.defineComponent({
1011
1315
  if (!isEqual(newVal, oldVal)) {
1012
1316
  this.handleTextChange = _debounce(this.handleText, newVal);
1013
1317
  }
1318
+ },
1319
+ isAITyping: function isAITyping(newVal, oldVal) {
1320
+ var _this = this;
1321
+ var scrollAIContainer = function scrollAIContainer() {
1322
+ var dropdownEle = _this.$refs[_dropdownULRef];
1323
+ if (dropdownEle) {
1324
+ dropdownEle.scrollTo({
1325
+ top: dropdownEle.scrollHeight,
1326
+ behavior: 'smooth'
1327
+ });
1328
+ }
1329
+ };
1330
+ if (!newVal && oldVal) {
1331
+ this.showAIScreenFooter = true;
1332
+ if (this.$props.AIUIConfig && typeof this.$props.AIUIConfig.showFeedback === 'boolean' ? this.$props.AIUIConfig.showFeedback : true) {
1333
+ this.showFeedbackComponent = true;
1334
+ }
1335
+ setTimeout(function () {
1336
+ scrollAIContainer();
1337
+ }, 500);
1338
+ } else if (newVal) {
1339
+ this.scrollTimerRef = setTimeout(function () {
1340
+ scrollAIContainer();
1341
+ }, 2000);
1342
+ }
1343
+ },
1344
+ showAIScreen: function showAIScreen(newVal) {
1345
+ if (newVal) {
1346
+ var _this$$refs;
1347
+ if ((_this$$refs = this.$refs) != null && _this$$refs[this.$props.innerRef] && this.$refs[this.$props.innerRef].$el) {
1348
+ this.$refs[this.$props.innerRef].$el.blur();
1349
+ }
1350
+ } else {
1351
+ this.feedbackState = null;
1352
+ this.showFeedbackComponent = false;
1353
+ }
1354
+ },
1355
+ currentValue: function currentValue() {
1356
+ if (this.$props.autosuggest && this.$props.enableAI) {
1357
+ this.handleTextAreaHeightChange();
1358
+ }
1014
1359
  }
1015
1360
  },
1016
1361
  methods: {
@@ -1036,7 +1381,14 @@ var SearchBox = vue.defineComponent({
1036
1381
  data: this.normalizedSuggestions,
1037
1382
  rawData: this.rawData,
1038
1383
  value: currentValue,
1039
- resultStats: this.stats
1384
+ resultStats: this.stats,
1385
+ AIData: {
1386
+ question: this.AIResponse && this.AIResponse.response && this.AIResponse.response.question,
1387
+ answer: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text,
1388
+ documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
1389
+ showAIScreen: this.showAIScreen,
1390
+ sources: this.getAISourceObjects()
1391
+ }
1040
1392
  };
1041
1393
  return index.getComponent(data, this);
1042
1394
  },
@@ -1060,7 +1412,7 @@ var SearchBox = vue.defineComponent({
1060
1412
  }
1061
1413
  },
1062
1414
  setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue) {
1063
- var _this = this;
1415
+ var _this2 = this;
1064
1416
  if (isDefaultValue === void 0) {
1065
1417
  isDefaultValue = false;
1066
1418
  }
@@ -1074,60 +1426,65 @@ var SearchBox = vue.defineComponent({
1074
1426
  categoryValue = undefined;
1075
1427
  }
1076
1428
  var performUpdate = function performUpdate() {
1077
- if (_this.$options.isTagsMode && isEqual(value, _this.selectedTags)) {
1429
+ if (_this2.$options.isTagsMode && isEqual(value, _this2.selectedTags)) {
1078
1430
  return;
1079
1431
  }
1080
- if (_this.$options.isTagsMode && cause === reactivecore.causes.SUGGESTION_SELECT) {
1081
- if (Array.isArray(_this.selectedTags) && _this.selectedTags.length) {
1432
+ if (_this2.$options.isTagsMode && cause === reactivecore.causes.SUGGESTION_SELECT) {
1433
+ if (Array.isArray(_this2.selectedTags) && _this2.selectedTags.length) {
1082
1434
  // check if value already present in selectedTags
1083
- if (typeof value === 'string' && _this.selectedTags.includes(value)) {
1084
- _this.isOpen = false;
1435
+ if (typeof value === 'string' && _this2.selectedTags.includes(value)) {
1436
+ _this2.isOpen = false;
1085
1437
  return;
1086
1438
  }
1087
- _this.selectedTags = [].concat(_this.selectedTags);
1439
+ _this2.selectedTags = [].concat(_this2.selectedTags);
1088
1440
  if (typeof value === 'string' && !!value) {
1089
- _this.selectedTags.push(value);
1090
- } else if (Array.isArray(value) && !isEqual(_this.selectedTags, value)) {
1091
- _this.selectedTags = value;
1441
+ _this2.selectedTags.push(value);
1442
+ } else if (Array.isArray(value) && !isEqual(_this2.selectedTags, value)) {
1443
+ _this2.selectedTags = value;
1092
1444
  }
1093
1445
  } else if (value) {
1094
- _this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
1446
+ _this2.selectedTags = typeof value !== 'string' ? value : [].concat(value);
1095
1447
  }
1096
- _this.currentValue = '';
1448
+ _this2.currentValue = '';
1097
1449
  } else {
1098
- _this.currentValue = index.decodeHtml(value);
1450
+ _this2.currentValue = index.decodeHtml(value);
1099
1451
  }
1100
1452
  var queryHandlerValue = value;
1101
- if (_this.$options.isTagsMode && cause === reactivecore.causes.SUGGESTION_SELECT) {
1102
- queryHandlerValue = Array.isArray(_this.selectedTags) && _this.selectedTags.length ? _this.selectedTags : undefined;
1453
+ if (_this2.$options.isTagsMode && cause === reactivecore.causes.SUGGESTION_SELECT) {
1454
+ queryHandlerValue = Array.isArray(_this2.selectedTags) && _this2.selectedTags.length ? _this2.selectedTags : undefined;
1103
1455
  }
1104
1456
  if (isDefaultValue) {
1105
- if (_this.$props.autosuggest) {
1457
+ if (_this2.$props.autosuggest) {
1106
1458
  if (toggleIsOpen) {
1107
- _this.isOpen = false;
1459
+ _this2.isOpen = false;
1108
1460
  }
1109
- if (typeof _this.currentValue === 'string') _this.triggerDefaultQuery(_this.currentValue);
1461
+ if (typeof _this2.currentValue === 'string') _this2.triggerDefaultQuery(_this2.currentValue, props.enableAI ? {
1462
+ enableAI: true
1463
+ } : {});
1110
1464
  } // in case of strict selection only SUGGESTION_SELECT should be able
1111
1465
  // to set the query otherwise the value should reset
1112
1466
  if (props.strictSelection) {
1113
- if (cause === reactivecore.causes.SUGGESTION_SELECT || (_this.$options.isTagsMode ? _this.selectedTags.length === 0 : value === '')) {
1114
- _this.triggerCustomQuery(queryHandlerValue, _this.$options.isTagsMode ? undefined : categoryValue);
1467
+ if (cause === reactivecore.causes.SUGGESTION_SELECT || (_this2.$options.isTagsMode ? _this2.selectedTags.length === 0 : value === '')) {
1468
+ _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue);
1115
1469
  } else {
1116
- _this.setValue('', true);
1470
+ _this2.setValue('', true);
1117
1471
  }
1118
1472
  } else if (props.value === undefined || cause === reactivecore.causes.SUGGESTION_SELECT || cause === reactivecore.causes.CLEAR_VALUE) {
1119
- _this.triggerCustomQuery(queryHandlerValue, _this.$options.isTagsMode ? undefined : categoryValue);
1473
+ _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue);
1120
1474
  }
1121
1475
  } else {
1122
1476
  // debounce for handling text while typing
1123
- _this.handleTextChange(value, cause);
1477
+ _this2.handleTextChange(value, cause);
1124
1478
  }
1125
- _this.$emit('valueChange', value);
1126
- _this.$emit('value-change', value);
1479
+ _this2.$emit('valueChange', value);
1480
+ _this2.$emit('value-change', value);
1127
1481
  };
1128
1482
  checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
1129
1483
  },
1130
- triggerDefaultQuery: function triggerDefaultQuery(paramValue) {
1484
+ triggerDefaultQuery: function triggerDefaultQuery(paramValue, meta) {
1485
+ if (meta === void 0) {
1486
+ meta = {};
1487
+ }
1131
1488
  if (!this.$props.autosuggest) {
1132
1489
  return;
1133
1490
  }
@@ -1146,7 +1503,8 @@ var SearchBox = vue.defineComponent({
1146
1503
  componentId: this.internalComponent,
1147
1504
  query: query,
1148
1505
  value: value,
1149
- componentType: constants.componentTypes.searchBox
1506
+ componentType: constants.componentTypes.searchBox,
1507
+ meta: meta
1150
1508
  });
1151
1509
  },
1152
1510
  triggerCustomQuery: function triggerCustomQuery(paramValue, categoryValue) {
@@ -1242,9 +1600,12 @@ var SearchBox = vue.defineComponent({
1242
1600
  if (this.$props.autosuggest === false) {
1243
1601
  this.enterButtonOnClick();
1244
1602
  } else if (highlightedIndex === null) {
1245
- this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? reactivecore.causes.SUGGESTION_SELECT : undefined // to handle tags
1246
- );
1247
-
1603
+ this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? reactivecore.causes.SUGGESTION_SELECT : undefined,
1604
+ // to handle tags
1605
+ !this.$props.enableAI);
1606
+ if (this.$props.enableAI && !this.showAIScreen) {
1607
+ this.showAIScreen = true;
1608
+ }
1248
1609
  this.onValueSelectedHandler(event.target.value, reactivecore.causes.ENTER_PRESS);
1249
1610
  }
1250
1611
  }
@@ -1254,18 +1615,21 @@ var SearchBox = vue.defineComponent({
1254
1615
  this.$emit('key-down', event, this.triggerQuery);
1255
1616
  },
1256
1617
  onInputChange: function onInputChange(e) {
1257
- var _this2 = this;
1618
+ var _this3 = this;
1258
1619
  var inputValue = e.target.value;
1259
1620
  if (!this.$data.isOpen && this.$props.autosuggest) {
1260
1621
  this.isOpen = true;
1261
1622
  }
1623
+ if (this.showAIScreen) {
1624
+ this.showAIScreen = false;
1625
+ }
1262
1626
  var value = this.$props.value;
1263
1627
  if (value === undefined) {
1264
1628
  this.setValue(inputValue, false, this.$props, undefined);
1265
1629
  } else {
1266
1630
  this.$emit('change', inputValue, function (_ref3) {
1267
1631
  var isOpen = _ref3.isOpen;
1268
- return _this2.triggerQuery({
1632
+ return _this3.triggerQuery({
1269
1633
  defaultQuery: true,
1270
1634
  customQuery: true,
1271
1635
  value: inputValue,
@@ -1275,8 +1639,10 @@ var SearchBox = vue.defineComponent({
1275
1639
  }
1276
1640
  },
1277
1641
  onSuggestionSelected: function onSuggestionSelected(suggestion) {
1278
- var _this3 = this;
1279
- this.isOpen = false;
1642
+ var _this4 = this;
1643
+ if (!this.$props.enableAI) this.isOpen = false;else {
1644
+ this.showAIScreen = true;
1645
+ }
1280
1646
  var value = this.$props.value;
1281
1647
  // Record analytics for selected suggestions
1282
1648
  this.triggerClickAnalytics(suggestion._click_id);
@@ -1296,10 +1662,10 @@ var SearchBox = vue.defineComponent({
1296
1662
  this.setValue(emitValue, true, this.$props, reactivecore.causes.SUGGESTION_SELECT, false, suggestion._category);
1297
1663
  this.$emit('change', emitValue, function (_ref4) {
1298
1664
  var isOpen = _ref4.isOpen;
1299
- return _this3.triggerQuery(_rollupPluginBabelHelpers._extends({
1665
+ return _this4.triggerQuery(_rollupPluginBabelHelpers._extends({
1300
1666
  isOpen: isOpen,
1301
1667
  value: emitValue
1302
- }, !_this3.$options.isTagsMode && {
1668
+ }, !_this4.$options.isTagsMode && {
1303
1669
  categoryValue: suggestion._category
1304
1670
  }));
1305
1671
  });
@@ -1333,9 +1699,26 @@ var SearchBox = vue.defineComponent({
1333
1699
  }
1334
1700
  return null;
1335
1701
  },
1336
- renderErrorComponent: function renderErrorComponent() {
1337
- var _this4 = this;
1702
+ renderErrorComponent: function renderErrorComponent(isAIError) {
1703
+ var _this5 = this;
1704
+ if (isAIError === void 0) {
1705
+ isAIError = false;
1706
+ }
1338
1707
  var renderError = this.$slots.renderError || this.$props.renderError;
1708
+ if (isAIError) {
1709
+ if (this.showAIScreen && this.AIResponseError && !this.isAIResponseLoading) {
1710
+ if (renderError) {
1711
+ return vue.createVNode("div", {
1712
+ "class": "--ai-answer-error-container " + (getClassName$1(this.$props.innerClass, 'ai-error') || '')
1713
+ }, [renderError(this.AIResponseError)]);
1714
+ }
1715
+ return vue.createVNode("div", {
1716
+ "class": "--ai-answer-error-container " + (getClassName$1(this.$props.innerClass, 'ai-error') || '')
1717
+ }, [vue.createVNode("div", {
1718
+ "class": "--default-error-element"
1719
+ }, [vue.createVNode("span", null, [typeof this.AIResponseError === 'string' ? this.AIResponseError : this.AIResponseError.message ? this.AIResponseError.message : 'There was an error in generating the response.', this.AIResponseError.code ? "Code:\n\t\t\t\t\t\t\t" + this.AIResponseError.code : ''])])]);
1720
+ }
1721
+ }
1339
1722
  if (this.error && renderError && this.$data.currentValue && !this.isLoading) {
1340
1723
  return vue.createVNode(SuggestionWrapper, {
1341
1724
  "innerClass": this.$props.innerClass,
@@ -1344,7 +1727,7 @@ var SearchBox = vue.defineComponent({
1344
1727
  "themePreset": this.themePreset
1345
1728
  }, {
1346
1729
  "default": function _default() {
1347
- return [index.isFunction(renderError) ? renderError(_this4.error) : renderError];
1730
+ return [index.isFunction(renderError) ? renderError(_this5.error) : renderError];
1348
1731
  }
1349
1732
  });
1350
1733
  }
@@ -1409,6 +1792,7 @@ var SearchBox = vue.defineComponent({
1409
1792
  return null;
1410
1793
  },
1411
1794
  enterButtonOnClick: function enterButtonOnClick() {
1795
+ this.showAIScreen = false;
1412
1796
  this.triggerQuery({
1413
1797
  isOpen: false,
1414
1798
  value: this.currentValue,
@@ -1416,7 +1800,7 @@ var SearchBox = vue.defineComponent({
1416
1800
  });
1417
1801
  },
1418
1802
  renderEnterButtonElement: function renderEnterButtonElement() {
1419
- var _this5 = this;
1803
+ var _this6 = this;
1420
1804
  var _this$$props2 = this.$props,
1421
1805
  enterButton = _this$$props2.enterButton,
1422
1806
  innerClass = _this$$props2.innerClass;
@@ -1424,12 +1808,12 @@ var SearchBox = vue.defineComponent({
1424
1808
  if (enterButton) {
1425
1809
  var getEnterButtonMarkup = function getEnterButtonMarkup() {
1426
1810
  if (renderEnterButton) {
1427
- return renderEnterButton(_this5.enterButtonOnClick);
1811
+ return renderEnterButton(_this6.enterButtonOnClick);
1428
1812
  }
1429
1813
  return vue.createVNode(Button.Button, {
1430
1814
  "class": "enter-btn " + getClassName$1(innerClass, 'enter-button'),
1431
1815
  "primary": true,
1432
- "onClick": _this5.enterButtonOnClick
1816
+ "onClick": _this6.enterButtonOnClick
1433
1817
  }, {
1434
1818
  "default": function _default() {
1435
1819
  return [vue.createTextVNode("Search")];
@@ -1443,7 +1827,7 @@ var SearchBox = vue.defineComponent({
1443
1827
  return null;
1444
1828
  },
1445
1829
  renderIcons: function renderIcons() {
1446
- var _this6 = this;
1830
+ var _this7 = this;
1447
1831
  var _slot3, _slot4, _slot5;
1448
1832
  var _this$$props3 = this.$props,
1449
1833
  iconPosition = _this$$props3.iconPosition,
@@ -1460,21 +1844,21 @@ var SearchBox = vue.defineComponent({
1460
1844
  }, {
1461
1845
  "default": function _default() {
1462
1846
  return [currentValue && showClear && vue.createVNode(DropDown.IconWrapper, {
1463
- "onClick": _this6.clearValue,
1847
+ "onClick": _this7.clearValue,
1464
1848
  "showIcon": showIcon,
1465
1849
  "isClearIcon": true
1466
- }, _isSlot(_slot3 = _this6.renderCancelIcon()) ? _slot3 : {
1850
+ }, _isSlot(_slot3 = _this7.renderCancelIcon()) ? _slot3 : {
1467
1851
  "default": function _default() {
1468
1852
  return [_slot3];
1469
1853
  }
1470
1854
  }), showVoiceSearch && vue.createVNode(Mic, {
1471
1855
  "getInstance": getMicInstance,
1472
1856
  "render": renderMic,
1473
- "handleResult": _this6.handleVoiceResults,
1857
+ "handleResult": _this7.handleVoiceResults,
1474
1858
  "className": getClassName$1(innerClass, 'mic') || null
1475
1859
  }, null), iconPosition === 'right' && showIcon && vue.createVNode(DropDown.IconWrapper, {
1476
- "onClick": _this6.handleSearchIconClick
1477
- }, _isSlot(_slot4 = _this6.renderIcon()) ? _slot4 : {
1860
+ "onClick": _this7.handleSearchIconClick
1861
+ }, _isSlot(_slot4 = _this7.renderIcon()) ? _slot4 : {
1478
1862
  "default": function _default() {
1479
1863
  return [_slot4];
1480
1864
  }
@@ -1486,8 +1870,8 @@ var SearchBox = vue.defineComponent({
1486
1870
  }, {
1487
1871
  "default": function _default() {
1488
1872
  return [iconPosition === 'left' && showIcon && vue.createVNode(DropDown.IconWrapper, {
1489
- "onClick": _this6.handleSearchIconClick
1490
- }, _isSlot(_slot5 = _this6.renderIcon()) ? _slot5 : {
1873
+ "onClick": _this7.handleSearchIconClick
1874
+ }, _isSlot(_slot5 = _this7.renderIcon()) ? _slot5 : {
1491
1875
  "default": function _default() {
1492
1876
  return [_slot5];
1493
1877
  }
@@ -1496,17 +1880,17 @@ var SearchBox = vue.defineComponent({
1496
1880
  })]);
1497
1881
  },
1498
1882
  focusSearchBox: function focusSearchBox(event) {
1499
- var _this$$refs, _this$$refs$this$$pro;
1883
+ var _this$$refs2, _this$$refs2$this$$pr;
1500
1884
  var elt = event.target || event.srcElement;
1501
1885
  var tagName = elt.tagName;
1502
1886
  if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
1503
1887
  // already in an input
1504
1888
  return;
1505
1889
  }
1506
- (_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
1890
+ (_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
1507
1891
  },
1508
1892
  listenForFocusShortcuts: function listenForFocusShortcuts() {
1509
- var _this7 = this;
1893
+ var _this8 = this;
1510
1894
  var _this$$props$focusSho = this.$props.focusShortcuts,
1511
1895
  focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
1512
1896
  if (index.isEmpty(focusShortcuts)) {
@@ -1521,7 +1905,7 @@ var SearchBox = vue.defineComponent({
1521
1905
  function (event, handler) {
1522
1906
  // Prevent the default refresh event under WINDOWS system
1523
1907
  event.preventDefault();
1524
- _this7.focusSearchBox(event);
1908
+ _this8.focusSearchBox(event);
1525
1909
  });
1526
1910
 
1527
1911
  // if one of modifier keys are used, they are handled below
@@ -1531,7 +1915,7 @@ var SearchBox = vue.defineComponent({
1531
1915
  for (var index$1 = 0; index$1 < modifierKeys.length; index$1 += 1) {
1532
1916
  var element = modifierKeys[index$1];
1533
1917
  if (hotkeys[element]) {
1534
- _this7.focusSearchBox(event);
1918
+ _this8.focusSearchBox(event);
1535
1919
  break;
1536
1920
  }
1537
1921
  }
@@ -1544,10 +1928,10 @@ var SearchBox = vue.defineComponent({
1544
1928
  this.triggerDefaultQuery(value);
1545
1929
  },
1546
1930
  renderAutoFill: function renderAutoFill(suggestion) {
1547
- var _this8 = this;
1931
+ var _this9 = this;
1548
1932
  var handleAutoFillClick = function handleAutoFillClick(e) {
1549
1933
  e.stopPropagation();
1550
- _this8.onAutofillClick(suggestion);
1934
+ _this9.onAutofillClick(suggestion);
1551
1935
  };
1552
1936
  /* 👇 avoid showing autofill for category suggestions👇 */
1553
1937
  return suggestion._category ? null : vue.createVNode(AutoFillSvg, {
@@ -1555,7 +1939,7 @@ var SearchBox = vue.defineComponent({
1555
1939
  }, null);
1556
1940
  },
1557
1941
  renderTag: function renderTag(item) {
1558
- var _this9 = this;
1942
+ var _this10 = this;
1559
1943
  var innerClass = this.$props.innerClass;
1560
1944
  return vue.createVNode(TagItem, {
1561
1945
  "class": getClassName$1(innerClass, 'selected-tag') || ''
@@ -1566,7 +1950,7 @@ var SearchBox = vue.defineComponent({
1566
1950
  "aria-label": "delete-tag",
1567
1951
  "class": "close-icon",
1568
1952
  "onClick": function onClick() {
1569
- return _this9.clearTag(item);
1953
+ return _this10.clearTag(item);
1570
1954
  }
1571
1955
  }, [vue.createVNode(DropDown.CancelSvg, null, null)])];
1572
1956
  }
@@ -1589,7 +1973,7 @@ var SearchBox = vue.defineComponent({
1589
1973
  }
1590
1974
  },
1591
1975
  renderTags: function renderTags() {
1592
- var _this10 = this;
1976
+ var _this11 = this;
1593
1977
  if (!Array.isArray(this.selectedTags)) {
1594
1978
  return null;
1595
1979
  }
@@ -1603,25 +1987,189 @@ var SearchBox = vue.defineComponent({
1603
1987
  }) : vue.createVNode(TagsContainer, null, {
1604
1988
  "default": function _default() {
1605
1989
  return [tagsList.map(function (item) {
1606
- return _this10.renderTag(item);
1990
+ return _this11.renderTag(item);
1607
1991
  }), shouldRenderClearAllTag && vue.createVNode(TagItem, {
1608
- "class": getClassName$1(_this10.$props.innerClass, 'selected-tag') || ''
1992
+ "class": getClassName$1(_this11.$props.innerClass, 'selected-tag') || ''
1609
1993
  }, {
1610
1994
  "default": function _default() {
1611
1995
  return [vue.createVNode("span", null, [vue.createTextVNode("Clear All")]), vue.createVNode("span", {
1612
1996
  "role": "img",
1613
1997
  "aria-label": "delete-tag",
1614
1998
  "class": "close-icon",
1615
- "onClick": _this10.clearAllTags
1999
+ "onClick": _this11.clearAllTags
1616
2000
  }, [vue.createVNode(DropDown.CancelSvg, null, null)])];
1617
2001
  }
1618
2002
  })];
1619
2003
  }
1620
2004
  });
2005
+ },
2006
+ getAISourceObjects: function getAISourceObjects() {
2007
+ var localCache = helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) && helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY)[this.componentId];
2008
+ var sourceObjects = [];
2009
+ if (!this.AIResponse) return sourceObjects;
2010
+ var docIds = this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [];
2011
+ if (localCache && localCache.meta && localCache.meta.hits && localCache.meta.hits.hits) {
2012
+ docIds.forEach(function (id) {
2013
+ var foundSourceObj = localCache.meta.hits.hits.find(function (hit) {
2014
+ return hit._id === id;
2015
+ }) || {};
2016
+ if (foundSourceObj) {
2017
+ var _foundSourceObj$_sour = foundSourceObj._source,
2018
+ _source = _foundSourceObj$_sour === void 0 ? {} : _foundSourceObj$_sour,
2019
+ rest = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(foundSourceObj, _excluded);
2020
+ sourceObjects.push(_rollupPluginBabelHelpers._extends({}, rest, _source));
2021
+ }
2022
+ });
2023
+ } else {
2024
+ sourceObjects.push.apply(sourceObjects, docIds.map(function (id) {
2025
+ return {
2026
+ _id: id
2027
+ };
2028
+ }));
2029
+ }
2030
+ return sourceObjects;
2031
+ },
2032
+ renderAIScreenLoader: function renderAIScreenLoader() {
2033
+ var _this$$props$AIUIConf = this.$props.AIUIConfig,
2034
+ AIUIConfig = _this$$props$AIUIConf === void 0 ? {} : _this$$props$AIUIConf;
2035
+ var _ref5 = AIUIConfig || {},
2036
+ loaderMessage = _ref5.loaderMessage;
2037
+ if (loaderMessage) {
2038
+ return loaderMessage;
2039
+ }
2040
+ if (this.$slots.AILoaderMessage) {
2041
+ return this.$slots.AILoaderMessage();
2042
+ }
2043
+ return vue.createVNode(HorizontalSkeletonLoader, null, null);
2044
+ },
2045
+ renderAIScreenFooter: function renderAIScreenFooter() {
2046
+ var _slot6;
2047
+ var _this12 = this;
2048
+ var _this$$props$AIUIConf2 = this.$props.AIUIConfig,
2049
+ AIUIConfig = _this$$props$AIUIConf2 === void 0 ? {} : _this$$props$AIUIConf2;
2050
+ var _ref6 = AIUIConfig || {},
2051
+ _ref6$showSourceDocum = _ref6.showSourceDocuments,
2052
+ showSourceDocuments = _ref6$showSourceDocum === void 0 ? true : _ref6$showSourceDocum,
2053
+ _ref6$sourceDocumentL = _ref6.sourceDocumentLabel,
2054
+ sourceDocumentLabel = _ref6$sourceDocumentL === void 0 ? '_id' : _ref6$sourceDocumentL,
2055
+ _ref6$onSourceClick = _ref6.onSourceClick,
2056
+ onSourceClick = _ref6$onSourceClick === void 0 ? function () {} : _ref6$onSourceClick;
2057
+ return showSourceDocuments && this.showAIScreenFooter && this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds ? vue.createVNode(Footer, {
2058
+ "themePreset": this.$props.themePreset
2059
+ }, {
2060
+ "default": function _default() {
2061
+ return [vue.createTextVNode("Summary generated using the following sources:"), ' ', vue.createVNode(SourceTags, null, _isSlot(_slot6 = _this12.getAISourceObjects().map(function (el) {
2062
+ return vue.createVNode(Button.Button, {
2063
+ "class": "--ai-source-tag " + (getClassName$1(_this12.$props.innerClass, 'ai-source-tag') || ''),
2064
+ "title": el[sourceDocumentLabel],
2065
+ "info": true,
2066
+ "onClick": function onClick() {
2067
+ return onSourceClick && onSourceClick(el);
2068
+ }
2069
+ }, {
2070
+ "default": function _default() {
2071
+ return [el[sourceDocumentLabel]];
2072
+ }
2073
+ });
2074
+ })) ? _slot6 : {
2075
+ "default": function _default() {
2076
+ return [_slot6];
2077
+ }
2078
+ })];
2079
+ }
2080
+ }) : null;
2081
+ },
2082
+ renderAIScreen: function renderAIScreen() {
2083
+ var _this13 = this;
2084
+ var customAIRenderer = this.$props.renderAIAnswer || this.$slots.renderAIAnswer;
2085
+ if (customAIRenderer) {
2086
+ return customAIRenderer({
2087
+ question: this.AIResponse && this.AIResponse.response && this.AIResponse.response.question,
2088
+ answer: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text,
2089
+ documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
2090
+ loading: this.isAIResponseLoading || this.isLoading,
2091
+ sources: this.getAISourceObjects(),
2092
+ error: this.AIResponseError
2093
+ });
2094
+ }
2095
+ if (this.isAIResponseLoading || this.isLoading) {
2096
+ return this.renderAIScreenLoader();
2097
+ }
2098
+ return vue.createVNode("div", null, [vue.createVNode(Answer, {
2099
+ "innerHTML": md.render(this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text)
2100
+ }, null), this.renderAIScreenFooter(), this.showFeedbackComponent && vue.createVNode("div", {
2101
+ "class": "" + (getClassName$1(this.$props.innerClass, 'ai-feedback') || '')
2102
+ }, [vue.createVNode(AIFeedback, {
2103
+ "overrideState": this.feedbackState,
2104
+ "hideUI": this.isAIResponseLoading || this.isLoading || !this.sessionIdFromStore,
2105
+ "key": this.sessionIdFromStore,
2106
+ "onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
2107
+ _this13.feedbackState = {
2108
+ isRecorded: true,
2109
+ feedbackType: useful ? 'positive' : 'negative'
2110
+ };
2111
+ _this13.recordAISessionUsefulness(_this13.sessionIdFromStore, {
2112
+ useful: useful,
2113
+ reason: reason
2114
+ });
2115
+ }
2116
+ }, null)])]);
2117
+ },
2118
+ handleTextAreaHeightChange: function handleTextAreaHeightChange() {
2119
+ var _this$$refs$this$$pro;
2120
+ var textArea = (_this$$refs$this$$pro = this.$refs[this.$props.innerRef]) == null ? void 0 : _this$$refs$this$$pro.$el;
2121
+ if (textArea) {
2122
+ textArea.style.height = '42px';
2123
+ var lineHeight = parseInt(getComputedStyle(textArea).lineHeight, 10);
2124
+ var maxHeight = lineHeight * 4; // max height for 3 lines
2125
+ var height = Math.min(textArea.scrollHeight, maxHeight);
2126
+ textArea.style.height = height + "px";
2127
+ textArea.style.overflowY = height === maxHeight ? 'auto' : 'hidden';
2128
+ var dropdownEle = this.$refs[_dropdownULRef];
2129
+ if (dropdownEle) {
2130
+ dropdownEle.style.top = height + "px";
2131
+ }
2132
+ }
2133
+ },
2134
+ askButtonOnClick: function askButtonOnClick() {
2135
+ this.showAIScreen = true;
2136
+ this.isOpen = true;
2137
+ this.triggerDefaultQuery(this.currentValue, {
2138
+ enableAI: true
2139
+ });
2140
+ },
2141
+ renderAskButtonElement: function renderAskButtonElement() {
2142
+ var _this14 = this;
2143
+ var _this$$props4 = this.$props,
2144
+ AIUIConfig = _this$$props4.AIUIConfig,
2145
+ innerClass = _this$$props4.innerClass;
2146
+ var _ref7 = AIUIConfig || {},
2147
+ askButton = _ref7.askButton;
2148
+ var renderAskButton = this.$slots.renderAskButton;
2149
+ if (askButton) {
2150
+ var getEnterButtonMarkup = function getEnterButtonMarkup() {
2151
+ if (renderAskButton) {
2152
+ return renderAskButton(_this14.askButtonOnClick);
2153
+ }
2154
+ return vue.createVNode(Button.Button, {
2155
+ "class": "enter-btn " + getClassName$1(innerClass, 'ask-button'),
2156
+ "info": true,
2157
+ "onClick": _this14.askButtonOnClick
2158
+ }, {
2159
+ "default": function _default() {
2160
+ return [vue.createTextVNode("Ask")];
2161
+ }
2162
+ });
2163
+ };
2164
+ return vue.createVNode("div", {
2165
+ "class": "enter-button-wrapper"
2166
+ }, [getEnterButtonMarkup()]);
2167
+ }
2168
+ return null;
1621
2169
  }
1622
2170
  },
1623
2171
  render: function render() {
1624
- var _this11 = this;
2172
+ var _this15 = this;
1625
2173
  var expandSuggestionsContainer = this.$props.expandSuggestionsContainer;
1626
2174
  var _this$$slots = this.$slots,
1627
2175
  recentSearchesIcon = _this$$slots.recentSearchesIcon,
@@ -1632,26 +2180,26 @@ var SearchBox = vue.defineComponent({
1632
2180
  "class": this.$props.className
1633
2181
  }, {
1634
2182
  "default": function _default() {
1635
- return [_this11.$props.title && vue.createVNode(Title.Title, {
1636
- "class": getClassName$1(_this11.$props.innerClass, 'title') || ''
2183
+ return [_this15.$props.title && vue.createVNode(Title.Title, {
2184
+ "class": getClassName$1(_this15.$props.innerClass, 'title') || ''
1637
2185
  }, {
1638
2186
  "default": function _default() {
1639
- return [_this11.$props.title];
2187
+ return [_this15.$props.title];
1640
2188
  }
1641
- }), _this11.$props.autosuggest ? vue.createVNode(DropDown.Downshift, {
1642
- "id": _this11.$props.componentId + "-downshift",
1643
- "handleChange": _this11.onSuggestionSelected,
1644
- "handleMouseup": _this11.handleStateChange,
1645
- "isOpen": _this11.$data.isOpen
2189
+ }), _this15.$props.autosuggest ? vue.createVNode(DropDown.Downshift, {
2190
+ "id": _this15.$props.componentId + "-downshift",
2191
+ "handleChange": _this15.onSuggestionSelected,
2192
+ "handleMouseup": _this15.handleStateChange,
2193
+ "isOpen": _this15.$data.isOpen
1646
2194
  }, {
1647
- "default": function _default(_ref5) {
1648
- var getInputEvents = _ref5.getInputEvents,
1649
- getInputProps = _ref5.getInputProps,
1650
- getItemProps = _ref5.getItemProps,
1651
- getItemEvents = _ref5.getItemEvents,
1652
- isOpen = _ref5.isOpen,
1653
- highlightedIndex = _ref5.highlightedIndex,
1654
- setHighlightedIndex = _ref5.setHighlightedIndex;
2195
+ "default": function _default(_ref8) {
2196
+ var getInputEvents = _ref8.getInputEvents,
2197
+ getInputProps = _ref8.getInputProps,
2198
+ getItemProps = _ref8.getItemProps,
2199
+ getItemEvents = _ref8.getItemEvents,
2200
+ isOpen = _ref8.isOpen,
2201
+ highlightedIndex = _ref8.highlightedIndex,
2202
+ setHighlightedIndex = _ref8.setHighlightedIndex;
1655
2203
  var renderSuggestionsDropdown = function renderSuggestionsDropdown() {
1656
2204
  var getIcon = function getIcon(iconType) {
1657
2205
  switch (iconType) {
@@ -1663,14 +2211,21 @@ var SearchBox = vue.defineComponent({
1663
2211
  return null;
1664
2212
  }
1665
2213
  };
1666
- return vue.createVNode("div", null, [_this11.hasCustomRenderer && _this11.getComponent({
2214
+ return vue.createVNode("div", null, [_this15.hasCustomRenderer && _this15.getComponent({
1667
2215
  isOpen: isOpen,
1668
2216
  getItemProps: getItemProps,
1669
2217
  getItemEvents: getItemEvents,
1670
2218
  highlightedIndex: highlightedIndex
1671
- }), _this11.renderErrorComponent(), !_this11.hasCustomRenderer && isOpen && hasSuggestions ? vue.createVNode("ul", {
1672
- "class": Input.suggestions(_this11.themePreset, _this11.theme) + " " + getClassName$1(_this11.$props.innerClass, 'list')
1673
- }, [_this11.normalizedSuggestions.map(function (item, index) {
2219
+ }), _this15.renderErrorComponent(), !_this15.hasCustomRenderer && isOpen && hasSuggestions ? vue.createVNode("ul", {
2220
+ "class": Input.suggestions(_this15.themePreset, _this15.theme) + " " + getClassName$1(_this15.$props.innerClass, 'list'),
2221
+ "ref": _dropdownULRef
2222
+ }, [_this15.showAIScreen && vue.createVNode(SearchBoxAISection, {
2223
+ "themePreset": _this15.$props.themePreset
2224
+ }, {
2225
+ "default": function _default() {
2226
+ return [_this15.renderAIScreen(), ' ', _this15.renderErrorComponent(true)];
2227
+ }
2228
+ }), !_this15.showAIScreen && _this15.normalizedSuggestions.map(function (item, index) {
1674
2229
  return renderItem ? vue.createVNode("li", vue.mergeProps(getItemProps({
1675
2230
  item: item
1676
2231
  }), getItemEvents({
@@ -1678,7 +2233,7 @@ var SearchBox = vue.defineComponent({
1678
2233
  }), {
1679
2234
  "key": index + 1 + "-" + item.value,
1680
2235
  "style": {
1681
- backgroundColor: _this11.getBackgroundColor(highlightedIndex, index),
2236
+ backgroundColor: _this15.getBackgroundColor(highlightedIndex, index),
1682
2237
  justifyContent: 'flex-start',
1683
2238
  alignItems: 'center'
1684
2239
  }
@@ -1689,7 +2244,7 @@ var SearchBox = vue.defineComponent({
1689
2244
  })), {
1690
2245
  "key": index + 1 + "-" + item.value,
1691
2246
  "style": {
1692
- backgroundColor: _this11.getBackgroundColor(highlightedIndex, index),
2247
+ backgroundColor: _this15.getBackgroundColor(highlightedIndex, index),
1693
2248
  justifyContent: 'flex-start',
1694
2249
  alignItems: 'center'
1695
2250
  }
@@ -1699,97 +2254,133 @@ var SearchBox = vue.defineComponent({
1699
2254
  display: 'flex'
1700
2255
  }
1701
2256
  }, [vue.createVNode(CustomSvg, {
1702
- "className": getClassName$1(_this11.$props.innerClass, item._suggestion_type + "-search-icon") || null,
2257
+ "className": getClassName$1(_this15.$props.innerClass, item._suggestion_type + "-search-icon") || null,
1703
2258
  "icon": getIcon(item._suggestion_type),
1704
2259
  "type": item._suggestion_type + "-search-icon"
1705
2260
  }, null)]), vue.createVNode(SuggestionItem, {
1706
- "currentValue": _this11.currentValue,
2261
+ "currentValue": _this15.currentValue,
1707
2262
  "suggestion": item
1708
- }, null), _this11.renderAutoFill(item)]);
1709
- })]) : _this11.renderNoSuggestions(_this11.normalizedSuggestions)]);
2263
+ }, null), _this15.renderAutoFill(item)]);
2264
+ })]) : _this15.renderNoSuggestions(_this15.normalizedSuggestions)]);
1710
2265
  };
1711
2266
  return vue.createVNode("div", {
1712
2267
  "class": Input.suggestionsContainer
1713
2268
  }, [vue.createVNode(InputGroup, null, {
1714
2269
  "default": function _default() {
1715
- return [_this11.renderInputAddonBefore(), vue.createVNode(DropDown.InputWrapper, null, {
2270
+ return [_this15.renderInputAddonBefore(), vue.createVNode(DropDown.InputWrapper, null, {
1716
2271
  "default": function _default() {
1717
- return [vue.createVNode(Input.Input, vue.mergeProps(_transformOn(getInputEvents({
1718
- onInput: _this11.onInputChange,
2272
+ return [_this15.$props.enableAI ? vue.createVNode(Input.TextArea, vue.mergeProps(_transformOn(getInputEvents({
2273
+ onInput: _this15.onInputChange,
2274
+ onBlur: function onBlur(e) {
2275
+ _this15.$emit('blur', e, _this15.triggerQuery);
2276
+ },
2277
+ onFocus: _this15.handleFocus,
2278
+ onKeyPress: function onKeyPress(e) {
2279
+ _this15.$emit('keyPress', e, _this15.triggerQuery);
2280
+ _this15.$emit('key-press', e, _this15.triggerQuery);
2281
+ },
2282
+ onKeyDown: function onKeyDown(e) {
2283
+ return _this15.handleKeyDown(e, highlightedIndex);
2284
+ },
2285
+ onKeyUp: function onKeyUp(e) {
2286
+ _this15.$emit('keyUp', e, _this15.triggerQuery);
2287
+ _this15.$emit('key-up', e, _this15.triggerQuery);
2288
+ },
2289
+ onClick: function onClick() {
2290
+ setHighlightedIndex(null);
2291
+ }
2292
+ })), {
2293
+ "id": _this15.$props.componentId + "-input",
2294
+ "showIcon": _this15.$props.showIcon,
2295
+ "showClear": _this15.$props.showClear,
2296
+ "iconPosition": _this15.$props.iconPosition,
2297
+ "ref": _this15.$props.innerRef,
2298
+ "class": getClassName$1(_this15.$props.innerClass, 'input'),
2299
+ "placeholder": _this15.$props.placeholder,
2300
+ "autoFocus": _this15.$props.autoFocus,
2301
+ "showFocusShortcutsIcon": _this15.$props.showFocusShortcutsIcon,
2302
+ "showVoiceSearch": _this15.$props.showVoiceSearch
2303
+ }, getInputProps({
2304
+ value: _this15.$data.currentValue === null ? '' : _this15.$data.currentValue
2305
+ }), {
2306
+ "themePreset": _this15.themePreset,
2307
+ "autocomplete": "off"
2308
+ }), null) : vue.createVNode(Input.Input, vue.mergeProps(_transformOn(getInputEvents({
2309
+ onInput: _this15.onInputChange,
1719
2310
  onBlur: function onBlur(e) {
1720
- _this11.$emit('blur', e, _this11.triggerQuery);
2311
+ _this15.$emit('blur', e, _this15.triggerQuery);
1721
2312
  },
1722
- onFocus: _this11.handleFocus,
2313
+ onFocus: _this15.handleFocus,
1723
2314
  onKeyPress: function onKeyPress(e) {
1724
- _this11.$emit('keyPress', e, _this11.triggerQuery);
1725
- _this11.$emit('key-press', e, _this11.triggerQuery);
2315
+ _this15.$emit('keyPress', e, _this15.triggerQuery);
2316
+ _this15.$emit('key-press', e, _this15.triggerQuery);
1726
2317
  },
1727
2318
  onKeyDown: function onKeyDown(e) {
1728
- return _this11.handleKeyDown(e, highlightedIndex);
2319
+ return _this15.handleKeyDown(e, highlightedIndex);
1729
2320
  },
1730
2321
  onKeyUp: function onKeyUp(e) {
1731
- _this11.$emit('keyUp', e, _this11.triggerQuery);
1732
- _this11.$emit('key-up', e, _this11.triggerQuery);
2322
+ _this15.$emit('keyUp', e, _this15.triggerQuery);
2323
+ _this15.$emit('key-up', e, _this15.triggerQuery);
1733
2324
  },
1734
2325
  onClick: function onClick() {
1735
2326
  setHighlightedIndex(null);
1736
2327
  }
1737
2328
  })), {
1738
- "id": _this11.$props.componentId + "-input",
1739
- "showIcon": _this11.$props.showIcon,
1740
- "showClear": _this11.$props.showClear,
1741
- "iconPosition": _this11.$props.iconPosition,
1742
- "ref": _this11.$props.innerRef,
1743
- "class": getClassName$1(_this11.$props.innerClass, 'input'),
1744
- "placeholder": _this11.$props.placeholder,
1745
- "autoFocus": _this11.$props.autoFocus
2329
+ "id": _this15.$props.componentId + "-input",
2330
+ "showIcon": _this15.$props.showIcon,
2331
+ "showClear": _this15.$props.showClear,
2332
+ "iconPosition": _this15.$props.iconPosition,
2333
+ "ref": _this15.$props.innerRef,
2334
+ "class": getClassName$1(_this15.$props.innerClass, 'input'),
2335
+ "placeholder": _this15.$props.placeholder,
2336
+ "autoFocus": _this15.$props.autoFocus
1746
2337
  }, getInputProps({
1747
- value: _this11.$data.currentValue === null ? '' : _this11.$data.currentValue
2338
+ value: _this15.$data.currentValue === null ? '' : _this15.$data.currentValue
1748
2339
  }), {
1749
- "themePreset": _this11.themePreset,
2340
+ "themePreset": _this15.themePreset,
1750
2341
  "autocomplete": "off"
1751
- }), null), _this11.renderIcons(), !expandSuggestionsContainer && renderSuggestionsDropdown()];
2342
+ }), null), _this15.renderIcons(), !expandSuggestionsContainer && renderSuggestionsDropdown()];
1752
2343
  }
1753
- }), _this11.renderInputAddonAfter(), _this11.renderEnterButtonElement()];
2344
+ }), _this15.renderInputAddonAfter(), _this15.renderAskButtonElement(), _this15.renderEnterButtonElement()];
1754
2345
  }
1755
- }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this11.renderTags()]);
2346
+ }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this15.renderTags()]);
1756
2347
  }
1757
2348
  }) : vue.createVNode("div", {
1758
2349
  "class": Input.suggestionsContainer
1759
2350
  }, [vue.createVNode(InputGroup, null, {
1760
2351
  "default": function _default() {
1761
- return [_this11.renderInputAddonBefore(), vue.createVNode(DropDown.InputWrapper, null, {
2352
+ return [_this15.renderInputAddonBefore(), vue.createVNode(DropDown.InputWrapper, null, {
1762
2353
  "default": function _default() {
1763
2354
  return [vue.createVNode(Input.Input, vue.mergeProps(_transformOn({
1764
2355
  blur: function blur(e) {
1765
- _this11.$emit('blur', e, _this11.triggerQuery);
2356
+ _this15.$emit('blur', e, _this15.triggerQuery);
1766
2357
  },
1767
2358
  keypress: function keypress(e) {
1768
- _this11.$emit('keyPress', e, _this11.triggerQuery);
1769
- _this11.$emit('key-press', e, _this11.triggerQuery);
2359
+ _this15.$emit('keyPress', e, _this15.triggerQuery);
2360
+ _this15.$emit('key-press', e, _this15.triggerQuery);
1770
2361
  },
1771
- input: _this11.onInputChange,
2362
+ input: _this15.onInputChange,
1772
2363
  focus: function focus(e) {
1773
- _this11.$emit('focus', e, _this11.triggerQuery);
2364
+ _this15.$emit('focus', e, _this15.triggerQuery);
1774
2365
  },
1775
- keydown: _this11.handleKeyDown,
2366
+ keydown: _this15.handleKeyDown,
1776
2367
  keyup: function keyup(e) {
1777
- _this11.$emit('keyUp', e, _this11.triggerQuery);
1778
- _this11.$emit('key-up', e, _this11.triggerQuery);
2368
+ _this15.$emit('keyUp', e, _this15.triggerQuery);
2369
+ _this15.$emit('key-up', e, _this15.triggerQuery);
1779
2370
  }
1780
2371
  }), {
1781
- "class": getClassName$1(_this11.$props.innerClass, 'input') || '',
1782
- "placeholder": _this11.$props.placeholder,
1783
- "autofocus": _this11.$props.autoFocus,
1784
- "value": _this11.$data.currentValue ? _this11.$data.currentValue : '',
1785
- "iconPosition": _this11.$props.iconPosition,
1786
- "showIcon": _this11.$props.showIcon,
1787
- "showClear": _this11.$props.showClear,
1788
- "ref": _this11.$props.innerRef,
1789
- "themePreset": _this11.themePreset
1790
- }), null), _this11.renderIcons()];
2372
+ "class": getClassName$1(_this15.$props.innerClass, 'input') || '',
2373
+ "placeholder": _this15.$props.placeholder,
2374
+ "autofocus": _this15.$props.autoFocus,
2375
+ "value": _this15.$data.currentValue ? _this15.$data.currentValue : '',
2376
+ "iconPosition": _this15.$props.iconPosition,
2377
+ "showIcon": _this15.$props.showIcon,
2378
+ "showClear": _this15.$props.showClear,
2379
+ "ref": _this15.$props.innerRef,
2380
+ "themePreset": _this15.themePreset
2381
+ }), null), _this15.renderIcons()];
1791
2382
  }
1792
- }), _this11.renderInputAddonAfter(), _this11.renderEnterButtonElement()];
2383
+ }), _this15.renderInputAddonAfter(), _this15.renderEnterButtonElement()];
1793
2384
  }
1794
2385
  })])];
1795
2386
  }
@@ -1842,18 +2433,24 @@ var mapStateToProps = function mapStateToProps(state, props) {
1842
2433
  rawData: state.rawData[props.componentId],
1843
2434
  aggregationData: state.compositeAggregations[props.componentId] || [],
1844
2435
  themePreset: state.config.themePreset,
1845
- isLoading: !!state.isLoading[props.componentId + "_active"],
2436
+ isLoading: !!state.isLoading["" + props.componentId],
1846
2437
  error: state.error[props.componentId],
1847
2438
  time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
1848
2439
  total: state.hits[props.componentId] && state.hits[props.componentId].total,
1849
- hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden
2440
+ hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
2441
+ AIResponse: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response || null,
2442
+ isAIResponseLoading: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].isLoading,
2443
+ AIResponseError: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].error,
2444
+ sessionIdFromStore: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.sessionId || '',
2445
+ isAITyping: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.isTyping || false
1850
2446
  };
1851
2447
  };
1852
2448
  var mapDispatchToProps = {
1853
2449
  updateQuery: updateQuery,
1854
2450
  setCustomQuery: setCustomQuery,
1855
2451
  setDefaultQuery: setDefaultQuery,
1856
- recordSuggestionClick: recordSuggestionClick
2452
+ recordSuggestionClick: recordSuggestionClick,
2453
+ recordAISessionUsefulness: analytics.recordAISessionUsefulness
1857
2454
  };
1858
2455
  var SBConnected = PreferencesConsumer.PreferencesConsumer(ComponentWrapper.ComponentWrapper(index.connect(mapStateToProps, mapDispatchToProps)(SearchBox), {
1859
2456
  componentType: constants.componentTypes.searchBox,
@@ -1869,88 +2466,18 @@ SBConnected.install = function (Vue) {
1869
2466
  // Add componentType for SSR
1870
2467
  SBConnected.componentType = constants.componentTypes.searchBox;
1871
2468
 
1872
- var _templateObject$8, _templateObject2$1, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
1873
- var Chatbox = vueEmotion.styled('div')(_templateObject$8 || (_templateObject$8 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tmargin: 0 auto;\n\tpadding: 10px;\n\tbackground-color: #fafafa;\n\twidth: 100%;\n\tbox-shadow: rgb(0 0 0 / 20%) 0px 0px 6px;\n\tborder-radius: 6px;\n\tmargin-bottom: 20px;\n\tbackground-color: ", ";\n"])), function (props) {
1874
- return props.theme && props.theme.colors ? props.theme.colors.backgroundColor : '#fff';
1875
- });
1876
- var ChatContainer = vueEmotion.styled('div')(_templateObject2$1 || (_templateObject2$1 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\theight: 100%;\n\tposition: relative;\n\t.--ai-answer-error-container {\n\t\ttext-align: center;\n\t\tposition: absolute;\n\t\tbottom: 0px;\n\t\t", ";\n\t\tz-index: 1;\n\t\tleft: 50%;\n\t\ttransform: translateX(-50%);\n\t\twidth: 100%;\n\n\t\t.--default-error-element {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\talign-items: center;\n\t\t\tpadding: 10px;\n\t\t\tbackground-color: ", ";\n\t\t\tbox-shadow: 0 -5px 5px -2px\n\t\t\t\t", ";\n\n\t\t\tspan {\n\t\t\t\tmargin-bottom: 5px;\n\t\t\t}\n\n\t\t\tbutton {\n\t\t\t}\n\t\t}\n\t}\n"])), function (props) {
1877
- return props.showInput ? 'bottom: 48px;' : '';
1878
- }, function (props) {
1879
- return props.theme && props.theme.colors && props.theme.colors.backgroundColor ? props.theme.colors.backgroundColor : '#fff';
1880
- }, function (props) {
1881
- return props.theme && props.theme.colors && props.theme.colors.backgroundColor ? props.theme.colors.backgroundColor : '#fff';
1882
- });
1883
- var MessagesContainer = vueEmotion.styled('div')(_templateObject3 || (_templateObject3 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tmax-height: 400px;\n overflow-y: auto;\n\tpadding: 10px;\n\tdisplay: flex;\n\tflex-direction: column;\n\tmin-height: 200px;\n\n}};\n"])));
1884
- var typingDots = css.keyframes(_templateObject4 || (_templateObject4 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n 0% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(-70%);\n }\n 100% {\n transform: translateY(0);\n }\n"])));
1885
- var TypingIndicator = vueEmotion.styled('div')(_templateObject5 || (_templateObject5 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tmargin: 5px !important;\n"])));
1886
- var TypingDot = vueEmotion.styled('div')(_templateObject6 || (_templateObject6 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\twidth: 6px;\n\theight: 6px;\n\tbackground-color: ", ";\n\tborder-radius: 50%;\n\tmargin: 0 2px !important;\n\tanimation: ", " 1s infinite;\n\t&:nth-child(2) {\n\t\tanimation-delay: 0.2s;\n\t}\n\t&:nth-child(3) {\n\t\tanimation-delay: 0.4s;\n\t}\n"])), function (props) {
1887
- var finalColor;
1888
- if (props.isSender) {
1889
- finalColor = props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor;
1890
- } else {
1891
- finalColor = props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor;
1892
- }
1893
- return finalColor;
1894
- }, typingDots);
1895
- var resetCSS = function resetCSS(props) {
1896
- 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: " + (
1897
- // eslint-disable-next-line no-nested-ternary
1898
- 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: " + function (colorProps) {
1899
- return (
1900
- // eslint-disable-next-line no-nested-ternary
1901
- colorProps.isSender ? colorProps.themePreset !== 'dark' ? colorProps.theme.colors.primaryTextColor : colorProps.theme.colors.textColor : colorProps.theme.colors.primaryTextColor
1902
- );
1903
- } + ";\n\t\tborder-radius: 3px;\n\t\tfont-size: 85%;\n\t\tpadding: 0.2em 0.4em;\n\t\tmargin: 5px 0;\n\t\tdisplay: inline-block;\n\t\toverflow: auto;\n\t\twidth: 100%;\n\t}\n\tul,\n\tol {\n\t\tlist-style-position: inside;\n\t}\n";
1904
- };
1905
- var messageBGColor = function messageBGColor(props) {
1906
- var finalBGColor;
1907
- if (props.isSender) {
1908
- finalBGColor = props.themePreset !== 'dark' ? props.theme.colors.primaryColor : props.theme.colors.borderColor;
1909
- } else {
1910
- finalBGColor = props.themePreset !== 'dark' ? polished.lighten(0.25, props.theme.colors.borderColor) : props.theme.colors.backgroundColor;
1911
- }
1912
- return finalBGColor;
1913
- };
1914
- var Message = vueEmotion.styled('div')(_templateObject7 || (_templateObject7 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tbackground-color: ", ";\n\tcolor: ", ";\n\tborder: 1px solid\n\t\t", ";\n\tpadding: 10px;\n\tborder-radius: 7px;\n\tmargin-bottom: 10px;\n\tmax-width: 80%;\n\talign-self: ", ";\n\tdisplay: inline-block;\n\tposition: relative;\n\toverflow-wrap: anywhere;\n\t", "\n"])), function (props) {
1915
- return messageBGColor(props);
1916
- }, function (props) {
1917
- var finalColor;
1918
- if (props.isSender) {
1919
- finalColor = props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor;
1920
- } else {
1921
- finalColor = props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor;
1922
- }
1923
- return finalColor;
1924
- }, function (props) {
1925
- return props.themePreset === 'dark' ? 'currentColor' : messageBGColor(props);
1926
- }, function (props) {
1927
- return props.isSender ? 'flex-end' : 'flex-start';
1928
- }, function (props) {
1929
- return resetCSS(props);
1930
- });
1931
- var MessageInputContainer = vueEmotion.styled('form')(_templateObject8 || (_templateObject8 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tpadding-top: 12px;\n\talign-items: stretch;\n\tmargin-top: 10px;\n"])));
1932
- var MessageInput = vueEmotion.styled(Input.Input)(_templateObject9 || (_templateObject9 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tborder-radius: 5px;\n\tborder: 1px solid #ccc;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\n\t::placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t:-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t::-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n"])), function (props) {
1933
- return props.themePreset === 'dark' ? props.theme.colors.borderColor : '#fff';
1934
- }, function (props) {
1935
- return props.themePreset === 'dark' ? props.theme.colors.titleColor : props.theme.colors.textColor;
1936
- }, function (props) {
1937
- return props.theme.colors.textColor;
1938
- }, function (props) {
1939
- return props.theme.colors.textColor;
1940
- }, function (props) {
1941
- return props.theme.colors.textColor;
1942
- });
1943
- var SendButton = vueEmotion.styled(Button.Button)(_templateObject10 || (_templateObject10 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tborder: none;\n\tcolor: #ffffff;\n\tcursor: pointer;\n\tfont-size: 16px;\n\tmargin-left: 8px;\n\toutline: none;\n\tpadding: 10px;\n\ttext-align: center;\n"])));
1944
-
1945
2469
  function _isSlot$1(s) {
1946
2470
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
1947
2471
  }
1948
- var md = new remarkable.Remarkable();
1949
- md.set({
2472
+ var md$1 = new remarkable.Remarkable();
2473
+ md$1.set({
1950
2474
  html: true,
1951
2475
  breaks: true,
1952
2476
  xhtmlOut: true
1953
2477
  });
2478
+ var _inputWrapperRef = 'inputWrapperRef';
2479
+ var _inputRef = 'inputRef';
2480
+ var _errorContainerRef = 'errorContainerRef';
1954
2481
  var AIAnswer = vue.defineComponent({
1955
2482
  name: 'AIAnswer',
1956
2483
  data: function data() {
@@ -1984,6 +2511,7 @@ var AIAnswer = vue.defineComponent({
1984
2511
  props: {
1985
2512
  componentId: vueTypes.types.string.isRequired,
1986
2513
  showVoiceInput: VueTypes.bool.def(false),
2514
+ showFeedback: VueTypes.bool.def(true),
1987
2515
  showIcon: VueTypes.bool.def(true),
1988
2516
  onData: vueTypes.types.func,
1989
2517
  innerRef: VueTypes.string.def('AISearchInputField'),
@@ -2104,6 +2632,7 @@ var AIAnswer = vue.defineComponent({
2104
2632
  },
2105
2633
  handleMessageInputChange: function handleMessageInputChange(e) {
2106
2634
  this.inputMessage = e.target.value;
2635
+ this.handleTextAreaHeightChange();
2107
2636
  },
2108
2637
  handleSendMessage: function handleSendMessage(e, isRetry, text) {
2109
2638
  if (isRetry === void 0) {
@@ -2147,16 +2676,19 @@ var AIAnswer = vue.defineComponent({
2147
2676
  renderErrorComponent: function renderErrorComponent() {
2148
2677
  var renderError = this.$slots.renderError || this.$props.renderError;
2149
2678
  if (this.error && !this.isLoadingState) {
2679
+ var _this$error, _this$error2;
2150
2680
  if (renderError) {
2151
2681
  return vue.createVNode("div", {
2682
+ "ref": _errorContainerRef,
2152
2683
  "class": "--ai-answer-error-container " + (helper.getClassName(this.$props.innerClass, 'ai-error') || '')
2153
2684
  }, [index.isFunction(renderError) ? renderError(this.error, this.handleRetryRequest) : renderError]);
2154
2685
  }
2155
2686
  return vue.createVNode("div", {
2687
+ "ref": _errorContainerRef,
2156
2688
  "class": "--ai-answer-error-container " + (helper.getClassName(this.$props.innerClass, 'ai-error') || '')
2157
2689
  }, [vue.createVNode("div", {
2158
2690
  "class": "--default-error-element"
2159
- }, [vue.createVNode("span", null, [this.error.message ? this.error.message : 'There was an error in generating the response.', ' ', this.error.code ? "Code:\n\t\t\t\t\t\t\t" + this.error.code : '']), this.AISessionId && vue.createVNode(Button.Button, {
2691
+ }, [vue.createVNode("span", null, [(_this$error = this.error) != null && _this$error.message ? this.error.message : 'There was an error in generating the response.', ' ', (_this$error2 = this.error) != null && _this$error2.code ? "Code:\n\t\t\t\t\t\t\t" + this.error.code : '']), this.AISessionId && vue.createVNode(Button.Button, {
2160
2692
  "primary": true,
2161
2693
  "onClick": this.handleRetryRequest
2162
2694
  }, {
@@ -2215,6 +2747,7 @@ var AIAnswer = vue.defineComponent({
2215
2747
  innerClass = _this$$props.innerClass;
2216
2748
  var renderMic = this.$slots.renderMic || this.$props.renderMic;
2217
2749
  return vue.createVNode("div", null, [vue.createVNode(DropDown.IconGroup, {
2750
+ "enableAI": true,
2218
2751
  "groupPosition": "right",
2219
2752
  "positionType": "absolute"
2220
2753
  }, {
@@ -2231,6 +2764,7 @@ var AIAnswer = vue.defineComponent({
2231
2764
  })];
2232
2765
  }
2233
2766
  }), vue.createVNode(DropDown.IconGroup, {
2767
+ "enableAI": true,
2234
2768
  "groupPosition": "left",
2235
2769
  "positionType": "absolute"
2236
2770
  }, {
@@ -2284,6 +2818,28 @@ var AIAnswer = vue.defineComponent({
2284
2818
  rawData: this.rawData
2285
2819
  };
2286
2820
  return index.getComponent(data, this);
2821
+ },
2822
+ handleTextAreaHeightChange: function handleTextAreaHeightChange() {
2823
+ var _this$$refs2, _this$$refs2$_inputRe, _this$$refs3, _this$$refs3$_inputWr, _this$$refs4;
2824
+ var textArea = (_this$$refs2 = this.$refs) == null ? void 0 : (_this$$refs2$_inputRe = _this$$refs2[_inputRef]) == null ? void 0 : _this$$refs2$_inputRe.$el;
2825
+ var inputWrapper = (_this$$refs3 = this.$refs) == null ? void 0 : (_this$$refs3$_inputWr = _this$$refs3[_inputWrapperRef]) == null ? void 0 : _this$$refs3$_inputWr.$el;
2826
+ var errorContainer = (_this$$refs4 = this.$refs) == null ? void 0 : _this$$refs4[_errorContainerRef];
2827
+ if (textArea) {
2828
+ textArea.style.height = '42px';
2829
+ var lineHeight = parseInt(getComputedStyle(textArea).lineHeight, 10);
2830
+ var maxHeight = lineHeight * 11; // max height for 10 lines
2831
+ var height = Math.min(textArea.scrollHeight, maxHeight);
2832
+ textArea.style.height = height + "px";
2833
+ textArea.style.overflowY = height === maxHeight ? 'auto' : 'hidden';
2834
+ // wrapper around input/ textarea
2835
+ inputWrapper.style.height = height + "px";
2836
+ // adjust error-container
2837
+
2838
+ if (errorContainer) {
2839
+ errorContainer.style.bottom = height + "px";
2840
+ }
2841
+ this.$forceUpdate();
2842
+ }
2287
2843
  }
2288
2844
  },
2289
2845
  beforeUnmount: function beforeUnmount() {
@@ -2337,7 +2893,7 @@ var AIAnswer = vue.defineComponent({
2337
2893
  return vue.createVNode(Message, {
2338
2894
  "key": index,
2339
2895
  "isSender": message.role === constants.AI_ROLES.USER,
2340
- "innerHTML": md.render(message.content),
2896
+ "innerHTML": md$1.render(message.content),
2341
2897
  "themePreset": _this4.themePreset,
2342
2898
  "theme": props.theme,
2343
2899
  "class": "--ai-answer-message " + (helper.getClassName(props.innerClass, 'ai-message') || '')
@@ -2363,22 +2919,38 @@ var AIAnswer = vue.defineComponent({
2363
2919
  }
2364
2920
  })];
2365
2921
  }
2366
- }), _this4.renderErrorComponent(), props.showInput && vue.createVNode(MessageInputContainer, {
2922
+ }), _this4.renderErrorComponent(), ' ', props.showFeedback && vue.createVNode("div", {
2923
+ "class": "--ai-answer-feedback-container " + (helper.getClassName(props.innerClass, 'ai-feedback') || '')
2924
+ }, [vue.createVNode(AIFeedback, {
2925
+ "hideUI": _this4.isLoadingState || !_this4.sessionId,
2926
+ "key": _this4.sessionId,
2927
+ "onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
2928
+ _this4.trackUsefullness(_this4.sessionId, {
2929
+ useful: useful,
2930
+ reason: reason
2931
+ });
2932
+ }
2933
+ }, null)]), props.showInput && vue.createVNode(MessageInputContainer, {
2367
2934
  "class": "--ai-input-container",
2368
2935
  "onSubmit": _this4.handleSendMessage
2369
2936
  }, {
2370
2937
  "default": function _default() {
2371
2938
  return [vue.createVNode(InputGroup, {
2939
+ "enableAI": true,
2372
2940
  "isOpen": false
2373
2941
  }, {
2374
2942
  "default": function _default() {
2375
- return [vue.createVNode(DropDown.InputWrapper, null, {
2943
+ return [vue.createVNode(DropDown.InputWrapper, {
2944
+ "ref": _inputWrapperRef
2945
+ }, {
2376
2946
  "default": function _default() {
2377
2947
  return [vue.createVNode(MessageInput, {
2948
+ "ref": _inputRef,
2378
2949
  "type": "text",
2379
2950
  "placeholder": props.placeholder,
2951
+ "enterButton": props.enterButton,
2380
2952
  "value": _this4.inputMessage,
2381
- "onChange": _this4.handleMessageInputChange,
2953
+ "onInput": _this4.handleMessageInputChange,
2382
2954
  "onKeyPress": _this4.handleKeyPress,
2383
2955
  "id": props.componentId + "-ai-input",
2384
2956
  "showIcon": props.showIcon,
@@ -2417,11 +2989,12 @@ var mapStateToProps$1 = function mapStateToProps(state, props) {
2417
2989
  rawData: state.rawData[props.componentId],
2418
2990
  themePreset: state.config.themePreset,
2419
2991
  isLoading: state.isLoading[props.componentId] || false,
2420
- sessionIdFromStore: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].sessionId || ''
2992
+ sessionIdFromStore: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.sessionId || ''
2421
2993
  };
2422
2994
  };
2423
2995
  var mapDispatchToProps$1 = {
2424
- getAIResponse: query.fetchAIResponse
2996
+ getAIResponse: query.fetchAIResponse,
2997
+ trackUsefullness: analytics.recordAISessionUsefulness
2425
2998
  };
2426
2999
  var AIConnected = PreferencesConsumer.PreferencesConsumer(ComponentWrapper.ComponentWrapper(index.connect(mapStateToProps$1, mapDispatchToProps$1)(AIAnswer), {
2427
3000
  componentType: constants.componentTypes.AIAnswer,
@@ -2435,9 +3008,9 @@ AIConnected.install = function (Vue) {
2435
3008
  // Add componentType for SSR
2436
3009
  AIConnected.componentType = constants.componentTypes.AIAnswer;
2437
3010
 
2438
- var _templateObject$9, _templateObject2$2;
2439
- var HierarchicalMenuList = vueEmotion.styled('ul')(_templateObject$9 || (_templateObject$9 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tlist-style: none;\n\tpadding: 0;\n\tmargin: 0;\n\tmax-height: 0;\n\toverflow: hidden;\n\n\t&.--open {\n\t\tmax-height: 100%;\n\t}\n"])));
2440
- var HierarchicalMenuListItem = vueEmotion.styled('li')(_templateObject2$2 || (_templateObject2$2 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tfont-weight: 400;\n\tline-height: 1.5;\n\tbox-sizing: border-box;\n\n\ta {\n\t\tcolor: #424242;\n\t\ttext-decoration: none;\n\t\tgap: 5px;\n\t\t.--leaf-icon,\n\t\t.--folder-icon {\n\t\t\tline-height: 15px;\n\t\t\tsvg {\n\t\t\t\theight: 15px;\n\t\t\t}\n\t\t}\n\n\t\tinput {\n\t\t\tmargin: 0;\n\t\t\tcursor: pointer;\n\t\t}\n\t}\n\n\t.--switcher-icon {\n\t\ttransition: all 0.2s ease-in;\n\t\tmargin-right: 2px;\n\t}\n\t.--list-child {\n\t\tpadding-left: 1rem;\n\t\tposition: relative;\n\t\t&:before {\n\t\t\theight: 100%;\n\t\t\tcontent: '';\n\t\t\tposition: absolute;\n\t\t\tborder-left: 1px solid #787878;\n\t\t\twidth: 0;\n\t\t\tleft: 19px;\n\t\t\t", ";\n\t\t}\n\n\t\t&.--show-switcher-icon {\n\t\t\tpadding-left: 36px;\n\t\t}\n\t}\n\t.--list-item-label {\n\t\tline-height: 100%;\n\t}\n\t.--list-item-count {\n\t\tmargin-left: 10px;\n\t\tpadding: 0.1rem 0.4rem;\n\t\tfont-size: 0.8rem;\n\t\tcolor: #424242;\n\t\tbackground-color: #dee1e6;\n\t\tborder-radius: 8px;\n\t}\n\t&.-selected-item {\n\t\tfont-weight: 700 !important;\n\t}\n\t&.-expanded-item {\n\t\t& > a {\n\t\t\t& div > .--switcher-icon {\n\t\t\t\ttransform: rotate(90deg);\n\t\t\t}\n\t\t}\n\t}\n\t.--list-item-label-count-wrapper {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\t&:hover {\n\t\t\t.--list-item-count,\n\t\t\t.--list-item-label {\n\t\t\t\tfont-weight: 700;\n\t\t\t}\n\t\t}\n\t}\n"])), function (props) {
3011
+ var _templateObject$b, _templateObject2$4;
3012
+ var HierarchicalMenuList = vueEmotion.styled('ul')(_templateObject$b || (_templateObject$b = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tlist-style: none;\n\tpadding: 0;\n\tmargin: 0;\n\tmax-height: 0;\n\toverflow: hidden;\n\n\t&.--open {\n\t\tmax-height: 100%;\n\t}\n"])));
3013
+ var HierarchicalMenuListItem = vueEmotion.styled('li')(_templateObject2$4 || (_templateObject2$4 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tfont-weight: 400;\n\tline-height: 1.5;\n\tbox-sizing: border-box;\n\n\ta {\n\t\tcolor: #424242;\n\t\ttext-decoration: none;\n\t\tgap: 5px;\n\t\t.--leaf-icon,\n\t\t.--folder-icon {\n\t\t\tline-height: 15px;\n\t\t\tsvg {\n\t\t\t\theight: 15px;\n\t\t\t}\n\t\t}\n\n\t\tinput {\n\t\t\tmargin: 0;\n\t\t\tcursor: pointer;\n\t\t}\n\t}\n\n\t.--switcher-icon {\n\t\ttransition: all 0.2s ease-in;\n\t\tmargin-right: 2px;\n\t}\n\t.--list-child {\n\t\tpadding-left: 1rem;\n\t\tposition: relative;\n\t\t&:before {\n\t\t\theight: 100%;\n\t\t\tcontent: '';\n\t\t\tposition: absolute;\n\t\t\tborder-left: 1px solid #787878;\n\t\t\twidth: 0;\n\t\t\tleft: 19px;\n\t\t\t", ";\n\t\t}\n\n\t\t&.--show-switcher-icon {\n\t\t\tpadding-left: 36px;\n\t\t}\n\t}\n\t.--list-item-label {\n\t\tline-height: 100%;\n\t}\n\t.--list-item-count {\n\t\tmargin-left: 10px;\n\t\tpadding: 0.1rem 0.4rem;\n\t\tfont-size: 0.8rem;\n\t\tcolor: #424242;\n\t\tbackground-color: #dee1e6;\n\t\tborder-radius: 8px;\n\t}\n\t&.-selected-item {\n\t\tfont-weight: 700 !important;\n\t}\n\t&.-expanded-item {\n\t\t& > a {\n\t\t\t& div > .--switcher-icon {\n\t\t\t\ttransform: rotate(90deg);\n\t\t\t}\n\t\t}\n\t}\n\t.--list-item-label-count-wrapper {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\t&:hover {\n\t\t\t.--list-item-count,\n\t\t\t.--list-item-label {\n\t\t\t\tfont-weight: 700;\n\t\t\t}\n\t\t}\n\t}\n"])), function (props) {
2441
3014
  return !props.showLine && "\n\t\t\t\t\tdisplay: none;\n\t\t\t\t";
2442
3015
  });
2443
3016