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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +4866 -701
  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/{ComponentWrapper-0b9ffb1a.js → ComponentWrapper-0334c14b.js} +1 -1
  6. package/dist/cjs/{DropDown-aef75c14.js → DropDown-26666911.js} +14 -6
  7. package/dist/cjs/DynamicRangeSlider.js +7 -4
  8. package/dist/cjs/{Input-56eba499.js → Input-3ecdb905.js} +27 -74
  9. package/dist/cjs/MultiDropdownList.js +7 -6
  10. package/dist/cjs/MultiList.js +6 -5
  11. package/dist/cjs/MultiRange.js +5 -4
  12. package/dist/cjs/{Pagination-bcf8af5f.js → Pagination-c53a18ab.js} +1 -1
  13. package/dist/cjs/{PreferencesConsumer-85dee673.js → PreferencesConsumer-7bee3c57.js} +1 -1
  14. package/dist/cjs/RangeInput.js +8 -5
  15. package/dist/cjs/RangeSlider.js +8 -5
  16. package/dist/cjs/ReactiveBase.js +20 -18
  17. package/dist/cjs/ReactiveComponent.js +5 -4
  18. package/dist/cjs/ReactiveGoogleMap.js +8 -5
  19. package/dist/cjs/ReactiveList.js +6 -5
  20. package/dist/cjs/ResultCard.js +1 -1
  21. package/dist/cjs/ResultList.js +1 -1
  22. package/dist/cjs/SelectedFilters.js +2 -2
  23. package/dist/cjs/SingleDropdownList.js +7 -6
  24. package/dist/cjs/SingleList.js +6 -5
  25. package/dist/cjs/SingleRange.js +5 -4
  26. package/dist/cjs/StateProvider.js +1 -1
  27. package/dist/cjs/ToggleButton.js +5 -4
  28. package/dist/cjs/{index-779ed366.js → index-1f41363f.js} +7 -3
  29. package/dist/cjs/index.js +11 -8
  30. package/dist/cjs/{install-e8141489.js → install-08b8d6e7.js} +814 -283
  31. package/dist/cjs/install.js +11 -8
  32. package/dist/cjs/version.js +1 -1
  33. package/dist/cjs/{vueTypes-a5f1745e.js → vueTypes-289a891a.js} +2 -1
  34. package/dist/components/ReactiveBase/ReactiveBase.d.ts +33 -0
  35. package/dist/components/basic/ReactiveComponent.d.ts +30 -0
  36. package/dist/components/basic/ReactiveComponentPrivate.d.ts +10 -0
  37. package/dist/components/basic/SelectedFilters.d.ts +24 -0
  38. package/dist/components/basic/StateProvider.d.ts +12 -0
  39. package/dist/components/list/MultiDropdownList.d.ts +49 -0
  40. package/dist/components/list/MultiList.d.ts +47 -0
  41. package/dist/components/list/SingleDropdownList.d.ts +47 -0
  42. package/dist/components/list/SingleList.d.ts +47 -0
  43. package/dist/components/list/ToggleButton.d.ts +33 -0
  44. package/dist/components/list/TreeList.d.ts +48 -0
  45. package/dist/components/range/DynamicRangeSlider.d.ts +38 -0
  46. package/dist/components/range/MultiRange.d.ts +30 -0
  47. package/dist/components/range/RangeInput.d.ts +30 -0
  48. package/dist/components/range/RangeSlider.d.ts +40 -0
  49. package/dist/components/range/SingleRange.d.ts +28 -0
  50. package/dist/components/result/ReactiveList.d.ts +55 -0
  51. package/dist/components/result/ResultCard.d.ts +10 -0
  52. package/dist/components/result/ResultList.d.ts +11 -0
  53. package/dist/components/search/AIAnswer.d.ts +44 -0
  54. package/dist/components/search/SearchBox.d.ts +107 -0
  55. package/dist/es/{ComponentWrapper-a2635cfc.js → ComponentWrapper-46d04344.js} +1 -1
  56. package/dist/es/{DropDown-39fedff8.js → DropDown-48045fde.js} +14 -7
  57. package/dist/es/DynamicRangeSlider.js +8 -5
  58. package/dist/es/{Input-11d211d2.js → Input-83dee8c5.js} +26 -75
  59. package/dist/es/MultiDropdownList.js +7 -6
  60. package/dist/es/MultiList.js +6 -5
  61. package/dist/es/MultiRange.js +5 -4
  62. package/dist/es/{Pagination-50fc3ef5.js → Pagination-591fdb79.js} +1 -1
  63. package/dist/es/{PreferencesConsumer-b058d14e.js → PreferencesConsumer-0856ed43.js} +1 -1
  64. package/dist/es/RangeInput.js +8 -5
  65. package/dist/es/RangeSlider.js +9 -6
  66. package/dist/es/ReactiveBase.js +20 -18
  67. package/dist/es/ReactiveComponent.js +5 -4
  68. package/dist/es/ReactiveGoogleMap.js +8 -5
  69. package/dist/es/ReactiveList.js +6 -5
  70. package/dist/es/ResultCard.js +1 -1
  71. package/dist/es/ResultList.js +1 -1
  72. package/dist/es/SelectedFilters.js +2 -2
  73. package/dist/es/SingleDropdownList.js +7 -6
  74. package/dist/es/SingleList.js +6 -5
  75. package/dist/es/SingleRange.js +5 -4
  76. package/dist/es/StateProvider.js +1 -1
  77. package/dist/es/ToggleButton.js +5 -4
  78. package/dist/es/{index-882489e1.js → index-104f1dfb.js} +7 -3
  79. package/dist/es/index.js +12 -9
  80. package/dist/es/{install-b785dd55.js → install-e883f435.js} +816 -285
  81. package/dist/es/install.js +11 -8
  82. package/dist/es/version.js +1 -1
  83. package/dist/es/{vueTypes-09cab4d3.js → vueTypes-f503e267.js} +2 -1
  84. package/dist/index.d.ts +40 -0
  85. package/dist/types.ts +226 -0
  86. package/package.json +7 -4
@@ -13,21 +13,22 @@ var vueEmotion = require('@appbaseio/vue-emotion');
13
13
  var css = require('@emotion/css');
14
14
  var polished = require('polished');
15
15
  var Button = require('./Button-f96a0570.js');
16
- var vueTypes = require('./vueTypes-a5f1745e.js');
16
+ var vueTypes = require('./vueTypes-289a891a.js');
17
17
  var ReactiveList = require('./ReactiveList.js');
18
18
  var transform = require('@appbaseio/reactivecore/lib/utils/transform');
19
- var index = require('./index-779ed366.js');
20
- var ComponentWrapper = require('./ComponentWrapper-0b9ffb1a.js');
21
- var PreferencesConsumer = require('./PreferencesConsumer-85dee673.js');
19
+ var index = require('./index-1f41363f.js');
20
+ var ComponentWrapper = require('./ComponentWrapper-0334c14b.js');
21
+ var PreferencesConsumer = require('./PreferencesConsumer-7bee3c57.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
25
  var analytics = require('@appbaseio/reactivecore/lib/actions/analytics');
26
26
  var ReactiveBase = require('./ReactiveBase.js');
27
27
  var hotkeys = _interopDefault(require('hotkeys-js'));
28
+ var xss = _interopDefault(require('xss'));
28
29
  var remarkable = require('remarkable');
29
- var DropDown = require('./DropDown-aef75c14.js');
30
- var Input = require('./Input-56eba499.js');
30
+ var DropDown = require('./DropDown-26666911.js');
31
+ var Input = require('./Input-3ecdb905.js');
31
32
  var Container = require('./Container-29f049b2.js');
32
33
  var Highlight = _interopDefault(require('vue-highlight-words'));
33
34
  var query = require('@appbaseio/reactivecore/lib/actions/query');
@@ -52,7 +53,13 @@ var ResultList = require('./ResultList.js');
52
53
  var StateProvider = require('./StateProvider.js');
53
54
 
54
55
  var _templateObject;
55
- var InputGroup = vueEmotion.styled('div')(_templateObject || (_templateObject = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: stretch;\n\twidth: 100%;\n"])));
56
+ var InputGroup = vueEmotion.styled('div')(_templateObject || (_templateObject = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n \tdisplay: flex;\n\talign-items: stretch;\n\twidth: 100%;\n\tbox-shadow: rgb(0 0 0 / 20%) 0px 0px 6px;\n\tborder-radius: 6px;\n\n\t", "\n\t", "\n\t};\n"])), function (_ref) {
57
+ var theme = _ref.theme,
58
+ searchBox = _ref.searchBox;
59
+ return searchBox && "background-color: " + (theme.colors.backgroundColor || '#fafafa') + ";\n\t\tcolor: " + (theme.colors.textColor || '#fff') + ";\n\n\t\t&:focus-within {\n\t\t\tbackground-color: " + (theme.colors.backgroundColor || '#fff') + ";\n\t\t}";
60
+ }, function (props) {
61
+ return props.isOpen && "box-shadow: rgb(0 0 0 / 20%) 0px 0px 15px;\n\t\tborder-bottom-left-radius: 0;\n\t\t\tborder-bottom-right-radius: 0;";
62
+ });
56
63
  InputGroup.defaultProps = {
57
64
  className: 'input-group'
58
65
  };
@@ -782,8 +789,11 @@ var _templateObject$4, _templateObject2;
782
789
  var TagsContainer = vueEmotion.styled('div')(_templateObject$4 || (_templateObject$4 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tmargin-top: 10px;\n\twidth: 100%;\n"])));
783
790
  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"])));
784
791
 
785
- var _templateObject$5, _templateObject2$1, _templateObject3;
786
- var skeletonAnimation = css.keyframes(_templateObject$5 || (_templateObject$5 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n 0% {\n background-position: 100% 0;\n }\n 100% {\n background-position: -200% 0;\n }\n"])));
792
+ var _templateObject$5;
793
+ var AutosuggestFooterContainer = vueEmotion.styled('div')(_templateObject$5 || (_templateObject$5 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tcolor: #8792a2;\n\tbackground: #f7fafc;\n\tpadding: 10px;\n\theight: 40px;\n"])));
794
+
795
+ var _templateObject$6, _templateObject2$1, _templateObject3;
796
+ var skeletonAnimation = css.keyframes(_templateObject$6 || (_templateObject$6 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n 0% {\n background-position: 100% 0;\n }\n 100% {\n background-position: -200% 0;\n }\n"])));
787
797
  var SkeletonLoader = vueEmotion.styled('div')(_templateObject2$1 || (_templateObject2$1 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n"])));
788
798
  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);
789
799
  var HorizontalSkeletonLoader = vue.defineComponent({
@@ -797,8 +807,8 @@ var HorizontalSkeletonLoader = vue.defineComponent({
797
807
  }
798
808
  });
799
809
 
800
- var _templateObject$6, _templateObject2$2, _templateObject3$1, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
801
- var Chatbox = vueEmotion.styled('div')(_templateObject$6 || (_templateObject$6 = _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) {
810
+ var _templateObject$7, _templateObject2$2, _templateObject3$1, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
811
+ var Chatbox = vueEmotion.styled('div')(_templateObject$7 || (_templateObject$7 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tmargin: 0 auto;\n\tpadding: 10px;\n\tbackground-color: #fafafa;\n\twidth: 100%;\n\tbox-shadow: rgb(0 0 0 / 20%) 0px 0px 6px;\n\tborder-radius: 6px;\n\tmargin-bottom: 20px;\n\tbackground-color: ", ";\n\n\t.--trigger-message-wrapper {\n\t\tcursor: pointer;\n\t}\n"])), function (props) {
802
812
  return props.theme && props.theme.colors ? props.theme.colors.backgroundColor : '#fff';
803
813
  });
804
814
  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) {
@@ -823,11 +833,15 @@ var TypingDot = vueEmotion.styled('div')(_templateObject6 || (_templateObject6 =
823
833
  return finalColor;
824
834
  }, typingDots);
825
835
  var resetCSS = function resetCSS(props) {
826
- 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: " + (
836
+ return "\n\thtml,\n\tbody,\n\tdiv,\n\tspan,\n\tapplet,\n\tobject,\n\tiframe,\n\th1,\n\th2,\n\th3,\n\th4,\n\th5,\n\th6,\n\tp,\n\tblockquote,\n\tpre,\n\ta,\n\tabbr,\n\tacronym,\n\taddress,\n\tbig,\n\tcite,\n\tcode,\n\tdel,\n\tdfn,\n\tem,\n\timg,\n\tins,\n\tkbd,\n\tq,\n\ts,\n\tsamp,\n\tsmall,\n\tstrike,\n\tstrong,\n\tsub,\n\tsup,\n\ttt,\n\tvar,\n\tb,\n\tu,\n\ti,\n\tcenter,\n\tdl,\n\tdt,\n\tdd,\n\tol,\n\tul,\n\tli,\n\tfieldset,\n\tform,\n\tlabel,\n\tlegend,\n\ttable,\n\tcaption,\n\ttbody,\n\ttfoot,\n\tthead,\n\ttr,\n\tth,\n\ttd,\n\tarticle,\n\taside,\n\tcanvas,\n\tdetails,\n\tembed,\n\tfigure,\n\tfigcaption,\n\tfooter,\n\theader,\n\thgroup,\n\tmenu,\n\tnav,\n\toutput,\n\truby,\n\tsection,\n\tsummary,\n\ttime,\n\tmark,\n\taudio,\n\tvideo {\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\tborder: 0;\n\t\tfont-size: 100%;\n\t\tfont: inherit;\n\t\tvertical-align: baseline;\n\t\toverflow-wrap: anywhere;\n\t}\n\tpre {\n\t\tmargin: 10px auto;\n\t\twhite-space: pre-wrap;\n\n\t}\n\ttable {\n\t\tmargin: 10px auto;\n\t\tborder-collapse: collapse;\n\t\tborder-spacing: 0;\n\t}\n\ttr {\n\t\tborder-bottom: 1px solid #ccc;\n\t}\n\tth,\n\ttd {\n\t\ttext-align: left;\n\t\tpadding: 4px;\n\t\tborder: 1px solid;\n\t\tborder-collapse: collapse;\n\t}\n\tpre,\n\tcode {\n\t\tpadding: 0.6em 0.4em;\n\t\tbackground: " + (
837
+ // eslint-disable-next-line no-nested-ternary
838
+ props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryColor : props.theme.colors.borderColor : props.theme.colors.borderColor) + ";\n\n\t}\n\n\tpre{\n\t\tcolor: " + (
839
+ // eslint-disable-next-line no-nested-ternary
840
+ props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor : props.theme.colors.primaryTextColor) + ";}\n\n\tcode {\n\t\tline-height: normal;\n\n\t\tcolor: " + (
827
841
  // eslint-disable-next-line no-nested-ternary
828
- 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: " + (
842
+ props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor : props.theme.colors.primaryTextColor) + ";\n\t\tborder-radius: 3px;\n\t\tfont-size: 85%;\n\t\tpadding: 0.2em 0.4em;\n\t\tmargin-top: 5px;\n\t\tdisplay: inline-block;\n\t\toverflow: auto;\n\t\twidth: fit-content;\n\t\tmax-width: 100%;\n\t}\n\ncode[class*='language-'],\n\tpre[class*='language-'] {\n\t\tcolor: " + (
829
843
  // eslint-disable-next-line no-nested-ternary
830
- 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\t\tpadding-left: 10px;\n\n\t}\n\n\tli{\n\t\tdisplay: list-item;\n\t\tcursor: default;\n\t\tpadding: initial;\n\n\t\t&:hover{\n\t\t\tbackground-color: initial;\n\t\t}\n\t}\n\tp {\n\t\tmargin: inherit;\n\t}\n";
844
+ props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor : props.theme.colors.primaryTextColor) + ";\n\t\ttext-shadow: none;\n\t}\n\n\tul,\n\tol {\n\t\tlist-style-position: inside;\n\t\tpadding-left: 10px;\n\n\t}\n\n\tli{\n\t\tdisplay: list-item;\n\t\tcursor: default;\n\t\tpadding: initial;\n\n\t\t&:hover{\n\t\t\tbackground-color: initial;\n\t\t}\n\t}\n\tp {\n\t\tmargin: inherit;\n\t}\n";
831
845
  };
832
846
  var messageBGColor = function messageBGColor(props) {
833
847
  var finalBGColor;
@@ -856,7 +870,7 @@ var Message = vueEmotion.styled('div')(_templateObject7 || (_templateObject7 = _
856
870
  return resetCSS(props);
857
871
  });
858
872
  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"])));
859
- 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) {
873
+ 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\tpadding-left: 35px;\n"])), function (props) {
860
874
  return props.themePreset === 'dark' ? props.theme.colors.borderColor : '#fff';
861
875
  }, function (props) {
862
876
  return props.themePreset === 'dark' ? props.theme.colors.titleColor : props.theme.colors.textColor;
@@ -873,8 +887,8 @@ var MessageInput = vueEmotion.styled(Input.TextArea)(_templateObject9 || (_templ
873
887
  var SendButton = vueEmotion.styled(Button.Button)(_templateObject10 || (_templateObject10 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tborder: none;\n\tcolor: #ffffff;\n\tcursor: pointer;\n\tfont-size: 16px;\n\tmargin-left: 8px;\n\toutline: none;\n\tpadding: 10px;\n\ttext-align: center;\n\n\t&:disabled {\n\t\tcursor: not-allowed;\n\t}\n"])));
874
888
  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"])));
875
889
 
876
- var _templateObject$7, _templateObject2$3, _templateObject3$2, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7$1;
877
- var fadeInFromBottom = css.keyframes(_templateObject$7 || (_templateObject$7 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n 0% {\n opacity: 0;\n transform: translateY(20px);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n"])));
890
+ var _templateObject$8, _templateObject2$3, _templateObject3$2, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7$1;
891
+ var fadeInFromBottom = css.keyframes(_templateObject$8 || (_templateObject$8 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n 0% {\n opacity: 0;\n transform: translateY(20px);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n"])));
878
892
  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"])));
879
893
  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) {
880
894
  var themePreset = _ref.themePreset,
@@ -1078,7 +1092,9 @@ var md = new remarkable.Remarkable();
1078
1092
  md.set({
1079
1093
  html: true,
1080
1094
  breaks: true,
1081
- xhtmlOut: true
1095
+ xhtmlOut: true,
1096
+ linkify: true,
1097
+ linkTarget: '_blank'
1082
1098
  });
1083
1099
  var _dropdownULRef = 'dropdownULRef';
1084
1100
  var _inputGroupRef = 'inputGroupRef';
@@ -1106,7 +1122,9 @@ var SearchBox = vue.defineComponent({
1106
1122
  showAIScreen: false,
1107
1123
  showAIScreenFooter: false,
1108
1124
  showFeedbackComponent: false,
1109
- feedbackState: null
1125
+ feedbackState: null,
1126
+ faqAnswer: '',
1127
+ faqQuestion: ''
1110
1128
  };
1111
1129
  this.internalComponent = props.componentId + "__internal";
1112
1130
  return this.__state;
@@ -1142,11 +1160,55 @@ var SearchBox = vue.defineComponent({
1142
1160
  }
1143
1161
  },
1144
1162
  computed: {
1163
+ currentTriggerMode: function currentTriggerMode() {
1164
+ return this.$props.AIUIConfig && this.$props.AIUIConfig.triggerOn || constants.AI_TRIGGER_MODES.MANUAL;
1165
+ },
1145
1166
  hasCustomRenderer: function hasCustomRenderer() {
1146
1167
  return index.hasCustomRenderer(this);
1147
1168
  },
1148
1169
  stats: function stats() {
1149
1170
  return getResultStats(this);
1171
+ },
1172
+ mergedAIQuestion: function mergedAIQuestion() {
1173
+ return this.faqQuestion || this.AIResponse && this.AIResponse.response && this.AIResponse.response.question;
1174
+ },
1175
+ mergedAIAnswer: function mergedAIAnswer() {
1176
+ return this.faqAnswer || this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text;
1177
+ },
1178
+ parsedSuggestions: function parsedSuggestions() {
1179
+ var suggestionsArray = [];
1180
+ if (Array.isArray(this.suggestions) && this.suggestions.length) {
1181
+ suggestionsArray = [].concat(withClickIds(this.suggestions));
1182
+ }
1183
+ if (this.renderTriggerMessage() && this.currentValue && !this.isLoading) {
1184
+ suggestionsArray.unshift({
1185
+ label: this.renderTriggerMessage(),
1186
+ value: 'AI_TRIGGER_MESSAGE',
1187
+ _suggestion_type: '_internal_a_i_trigger'
1188
+ });
1189
+ }
1190
+ suggestionsArray = suggestionsArray.map(function (s) {
1191
+ if (s.sectionId) {
1192
+ return s;
1193
+ }
1194
+ return _rollupPluginBabelHelpers._extends({}, s, {
1195
+ sectionId: s._suggestion_type
1196
+ });
1197
+ });
1198
+ var sectionsAccumulated = [];
1199
+ var sectionisedSuggestions = suggestionsArray.reduce(function (acc, d, currentIndex) {
1200
+ if (sectionsAccumulated.includes(d.sectionId)) return acc;
1201
+ if (d.sectionId) {
1202
+ acc[currentIndex] = suggestionsArray.filter(function (g) {
1203
+ return g.sectionId === d.sectionId;
1204
+ });
1205
+ sectionsAccumulated.push(d.sectionId);
1206
+ } else {
1207
+ acc[currentIndex] = d;
1208
+ }
1209
+ return acc;
1210
+ }, {});
1211
+ return Object.values(sectionisedSuggestions);
1150
1212
  }
1151
1213
  },
1152
1214
  props: {
@@ -1156,6 +1218,7 @@ var SearchBox = vue.defineComponent({
1156
1218
  className: VueTypes.string.def(''),
1157
1219
  clearIcon: vueTypes.types.children,
1158
1220
  componentId: vueTypes.types.stringRequired,
1221
+ compoundClause: vueTypes.types.compoundClause,
1159
1222
  customHighlight: vueTypes.types.func,
1160
1223
  customQuery: vueTypes.types.func,
1161
1224
  defaultQuery: vueTypes.types.func,
@@ -1178,6 +1241,11 @@ var SearchBox = vue.defineComponent({
1178
1241
  enableQuerySuggestions: VueTypes.bool.def(false),
1179
1242
  enablePopularSuggestions: VueTypes.bool.def(false),
1180
1243
  enableRecentSuggestions: VueTypes.bool.def(false),
1244
+ enableFAQSuggestions: VueTypes.bool.def(false),
1245
+ FAQSuggestionsConfig: VueTypes.shape({
1246
+ sectionLabel: VueTypes.string,
1247
+ size: VueTypes.number
1248
+ }),
1181
1249
  fieldWeights: vueTypes.types.fieldWeights,
1182
1250
  filterLabel: vueTypes.types.string,
1183
1251
  fuzziness: vueTypes.types.fuzziness,
@@ -1213,12 +1281,20 @@ var SearchBox = vue.defineComponent({
1213
1281
  distinctFieldConfig: vueTypes.types.props,
1214
1282
  //
1215
1283
  focusShortcuts: VueTypes.arrayOf(VueTypes.oneOfType([VueTypes.string, VueTypes.number])).def(['/']),
1284
+ showFocusShortcutsIcon: VueTypes.bool.def(true),
1216
1285
  addonBefore: VueTypes.any,
1217
1286
  addonAfter: VueTypes.any,
1287
+ showSuggestionsFooter: VueTypes.bool.def(true),
1218
1288
  expandSuggestionsContainer: VueTypes.bool.def(true),
1289
+ renderSuggestionsFooter: VueTypes.func,
1219
1290
  index: VueTypes.string,
1220
1291
  popularSuggestionsConfig: VueTypes.object,
1221
1292
  recentSuggestionsConfig: VueTypes.object,
1293
+ featuredSuggestionsConfig: VueTypes.shape({
1294
+ maxSuggestionsPerSection: VueTypes.number,
1295
+ sectionsOrder: VueTypes.arrayOf(VueTypes.string)
1296
+ }),
1297
+ customEvents: VueTypes.object,
1222
1298
  applyStopwords: VueTypes.bool,
1223
1299
  customStopwords: vueTypes.types.stringArray,
1224
1300
  onData: vueTypes.types.func,
@@ -1293,7 +1369,11 @@ var SearchBox = vue.defineComponent({
1293
1369
  if (this.$options.isTagsMode) {
1294
1370
  cause = reactivecore.causes.SUGGESTION_SELECT;
1295
1371
  }
1296
- this.setValue(newVal || '', true, this.$props, cause);
1372
+ if (this.$props.value === undefined) {
1373
+ this.setValue(newVal, newVal === '', this.$props, cause, false);
1374
+ } else {
1375
+ this.setValue(newVal || '', true, this.$props, cause);
1376
+ }
1297
1377
  }
1298
1378
  },
1299
1379
  focusShortcuts: function focusShortcuts() {
@@ -1381,6 +1461,20 @@ var SearchBox = vue.defineComponent({
1381
1461
  }
1382
1462
  },
1383
1463
  methods: {
1464
+ renderTriggerMessage: function renderTriggerMessage() {
1465
+ if (this.$props.enableAI) {
1466
+ if (this.$props.AIUIConfig && this.$props.AIUIConfig.renderTriggerMessage) {
1467
+ return this.$props.AIUIConfig.renderTriggerMessage;
1468
+ }
1469
+ if (this.$slots.renderTriggerMessage) {
1470
+ return this.$slots.renderTriggerMessage();
1471
+ }
1472
+ if (this.currentTriggerMode === constants.AI_TRIGGER_MODES.MANUAL && (this.$props.AIUIConfig ? !this.$props.AIUIConfig.askButton : true)) {
1473
+ return 'Click to trigger AIAnswer';
1474
+ }
1475
+ }
1476
+ return null;
1477
+ },
1384
1478
  handleText: function handleText(value, cause) {
1385
1479
  if (cause === reactivecore.causes.CLEAR_VALUE) {
1386
1480
  this.triggerCustomQuery(value);
@@ -1405,8 +1499,8 @@ var SearchBox = vue.defineComponent({
1405
1499
  value: currentValue,
1406
1500
  resultStats: this.stats,
1407
1501
  AIData: {
1408
- question: this.AIResponse && this.AIResponse.response && this.AIResponse.response.question,
1409
- answer: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text,
1502
+ question: this.mergedAIQuestion,
1503
+ answer: this.mergedAIAnswer,
1410
1504
  documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
1411
1505
  showAIScreen: this.showAIScreen,
1412
1506
  sources: this.getAISourceObjects(),
@@ -1437,7 +1531,7 @@ var SearchBox = vue.defineComponent({
1437
1531
  this.onValueSelectedHandler(currentValue, reactivecore.causes.SEARCH_ICON_CLICK);
1438
1532
  }
1439
1533
  },
1440
- setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue) {
1534
+ setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue, shouldExecuteQuery) {
1441
1535
  var _this2 = this;
1442
1536
  if (isDefaultValue === void 0) {
1443
1537
  isDefaultValue = false;
@@ -1451,6 +1545,9 @@ var SearchBox = vue.defineComponent({
1451
1545
  if (categoryValue === void 0) {
1452
1546
  categoryValue = undefined;
1453
1547
  }
1548
+ if (shouldExecuteQuery === void 0) {
1549
+ shouldExecuteQuery = true;
1550
+ }
1454
1551
  var performUpdate = function performUpdate() {
1455
1552
  if (_this2.$options.isTagsMode && isEqual(value, _this2.selectedTags)) {
1456
1553
  return;
@@ -1479,24 +1576,31 @@ var SearchBox = vue.defineComponent({
1479
1576
  if (_this2.$options.isTagsMode && cause === reactivecore.causes.SUGGESTION_SELECT) {
1480
1577
  queryHandlerValue = Array.isArray(_this2.selectedTags) && _this2.selectedTags.length ? _this2.selectedTags : undefined;
1481
1578
  }
1579
+ if ((_this2.faqAnswer || _this2.faqQuestion) && value === '') {
1580
+ // Empty the previous state
1581
+ _this2.faqAnswer = '';
1582
+ _this2.faqQuestion = '';
1583
+ _this2.showAIScreen = false;
1584
+ }
1482
1585
  if (isDefaultValue) {
1483
1586
  if (_this2.$props.autosuggest) {
1484
1587
  if (toggleIsOpen) {
1485
1588
  _this2.isOpen = false;
1486
1589
  }
1487
- if (typeof _this2.currentValue === 'string') _this2.triggerDefaultQuery(_this2.currentValue, props.enableAI ? {
1590
+ if (typeof _this2.currentValue === 'string') _this2.triggerDefaultQuery(_this2.currentValue, props.enableAI && _this2.currentTriggerMode === constants.AI_TRIGGER_MODES.QUESTION && _this2.currentValue.endsWith('?') ? {
1488
1591
  enableAI: true
1489
- } : {});
1592
+ } : {}, shouldExecuteQuery);
1490
1593
  } // in case of strict selection only SUGGESTION_SELECT should be able
1491
1594
  // to set the query otherwise the value should reset
1492
1595
  if (props.strictSelection) {
1493
1596
  if (cause === reactivecore.causes.SUGGESTION_SELECT || (_this2.$options.isTagsMode ? _this2.selectedTags.length === 0 : value === '')) {
1494
- _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue);
1597
+ _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1495
1598
  } else {
1496
1599
  _this2.setValue('', true);
1497
1600
  }
1498
1601
  } else if (props.value === undefined || cause === reactivecore.causes.SUGGESTION_SELECT || cause === reactivecore.causes.CLEAR_VALUE) {
1499
- _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue);
1602
+ _this2.showAIScreen = false;
1603
+ _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1500
1604
  }
1501
1605
  } else {
1502
1606
  // debounce for handling text while typing
@@ -1507,10 +1611,13 @@ var SearchBox = vue.defineComponent({
1507
1611
  };
1508
1612
  checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
1509
1613
  },
1510
- triggerDefaultQuery: function triggerDefaultQuery(paramValue, meta) {
1614
+ triggerDefaultQuery: function triggerDefaultQuery(paramValue, meta, shouldExecuteQuery) {
1511
1615
  if (meta === void 0) {
1512
1616
  meta = {};
1513
1617
  }
1618
+ if (shouldExecuteQuery === void 0) {
1619
+ shouldExecuteQuery = true;
1620
+ }
1514
1621
  if (!this.$props.autosuggest) {
1515
1622
  return;
1516
1623
  }
@@ -1531,12 +1638,15 @@ var SearchBox = vue.defineComponent({
1531
1638
  value: value,
1532
1639
  componentType: constants.componentTypes.searchBox,
1533
1640
  meta: meta
1534
- });
1641
+ }, shouldExecuteQuery);
1535
1642
  },
1536
- triggerCustomQuery: function triggerCustomQuery(paramValue, categoryValue) {
1643
+ triggerCustomQuery: function triggerCustomQuery(paramValue, categoryValue, shouldExecuteQuery) {
1537
1644
  if (categoryValue === void 0) {
1538
1645
  categoryValue = undefined;
1539
1646
  }
1647
+ if (shouldExecuteQuery === void 0) {
1648
+ shouldExecuteQuery = true;
1649
+ }
1540
1650
  var _this$$props = this.$props,
1541
1651
  customQuery = _this$$props.customQuery,
1542
1652
  filterLabel = _this$$props.filterLabel,
@@ -1565,7 +1675,7 @@ var SearchBox = vue.defineComponent({
1565
1675
  URLParams: URLParams,
1566
1676
  componentType: constants.componentTypes.searchBox,
1567
1677
  category: categoryValue
1568
- });
1678
+ }, shouldExecuteQuery);
1569
1679
  },
1570
1680
  handleFocus: function handleFocus(event) {
1571
1681
  if (this.$props.autosuggest) {
@@ -1576,7 +1686,9 @@ var SearchBox = vue.defineComponent({
1576
1686
  handleVoiceResults: function handleVoiceResults(_ref) {
1577
1687
  var results = _ref.results;
1578
1688
  if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
1689
+ var _this$$refs2;
1579
1690
  this.setValue(results[0][0].transcript.trim(), true);
1691
+ (_this$$refs2 = this.$refs) == null || (_this$$refs2 = _this$$refs2[this.$props.innerRef]) == null || (_this$$refs2 = _this$$refs2.$el) == null ? void 0 : _this$$refs2.focus(); // eslint-disable-line
1580
1692
  }
1581
1693
  },
1582
1694
  triggerQuery: function triggerQuery(_ref2) {
@@ -1616,6 +1728,8 @@ var SearchBox = vue.defineComponent({
1616
1728
  clearValue: function clearValue() {
1617
1729
  this.setValue('', false, this.$props, !this.$options.isTagsMode ? reactivecore.causes.CLEAR_VALUE : undefined, false);
1618
1730
  this.onValueSelectedHandler('', !this.$options.isTagsMode ? reactivecore.causes.CLEAR_VALUE : undefined);
1731
+ this.showAIScreen = false;
1732
+ this.isOpen = false;
1619
1733
  },
1620
1734
  handleKeyDown: function handleKeyDown(event, highlightedIndex) {
1621
1735
  if (highlightedIndex === void 0) {
@@ -1628,9 +1742,10 @@ var SearchBox = vue.defineComponent({
1628
1742
  } else if (highlightedIndex === null) {
1629
1743
  this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? reactivecore.causes.SUGGESTION_SELECT : undefined,
1630
1744
  // to handle tags
1631
- !this.$props.enableAI);
1632
- if (this.$props.enableAI && !this.showAIScreen) {
1745
+ !(this.$props.enableAI && this.currentTriggerMode === constants.AI_TRIGGER_MODES.QUESTION && event.target.value.endsWith('?')));
1746
+ if (this.$props.enableAI && !this.showAIScreen && this.currentTriggerMode === constants.AI_TRIGGER_MODES.QUESTION && event.target.value.endsWith('?')) {
1633
1747
  this.showAIScreen = true;
1748
+ this.isOpen = true;
1634
1749
  }
1635
1750
  this.onValueSelectedHandler(event.target.value, reactivecore.causes.ENTER_PRESS);
1636
1751
  }
@@ -1651,7 +1766,7 @@ var SearchBox = vue.defineComponent({
1651
1766
  }
1652
1767
  var value = this.$props.value;
1653
1768
  if (value === undefined) {
1654
- this.setValue(inputValue, false, this.$props, undefined);
1769
+ this.setValue(inputValue, inputValue === '', this.$props, undefined, false);
1655
1770
  } else {
1656
1771
  this.$emit('change', inputValue, function (_ref3) {
1657
1772
  var isOpen = _ref3.isOpen;
@@ -1664,12 +1779,72 @@ var SearchBox = vue.defineComponent({
1664
1779
  }, e);
1665
1780
  }
1666
1781
  },
1782
+ handleFeaturedSuggestionClicked: function handleFeaturedSuggestionClicked(suggestion) {
1783
+ try {
1784
+ var _this$$refs3;
1785
+ if (suggestion.action === helper.featuredSuggestionsActionTypes.NAVIGATE) {
1786
+ var _JSON$parse = JSON.parse(suggestion.subAction),
1787
+ _JSON$parse$target = _JSON$parse.target,
1788
+ target = _JSON$parse$target === void 0 ? '_self' : _JSON$parse$target,
1789
+ _JSON$parse$link = _JSON$parse.link,
1790
+ link = _JSON$parse$link === void 0 ? '/' : _JSON$parse$link;
1791
+ if (typeof window !== 'undefined') {
1792
+ window.open(link, target);
1793
+ }
1794
+ }
1795
+ if (suggestion.action === helper.featuredSuggestionsActionTypes.FUNCTION) {
1796
+ var matchedValues = suggestion.subAction.match(/function\s*\(.*\)(.|\n)*/);
1797
+ var functionStr = matchedValues && matchedValues[0];
1798
+ // eslint-disable-next-line no-new-func
1799
+ var func = new Function("return " + functionStr)();
1800
+ func(suggestion, this.$data.currentValue, this.$props.customEvents);
1801
+ }
1802
+ if (suggestion.action === helper.featuredSuggestionsActionTypes.SELECT) {
1803
+ this.setValue(suggestion.value, true, this.$props, this.$options.isTagsMode.current ? reactivecore.causes.SUGGESTION_SELECT : reactivecore.causes.ENTER_PRESS, false);
1804
+ this.onValueSelectedHandler(suggestion.value, reactivecore.causes.SUGGESTION_SELECT);
1805
+ }
1806
+ // blur is important to close the dropdown
1807
+ // on selecting one of featured suggestions
1808
+ // else Downshift probably is focusing the dropdown
1809
+ // and not letting it close
1810
+ // eslint-disable-next-line no-unused-expressions
1811
+ (_this$$refs3 = this.$refs) == null || (_this$$refs3 = _this$$refs3[this.$props.innerRef]) == null || (_this$$refs3 = _this$$refs3.el) == null ? void 0 : _this$$refs3.blur();
1812
+ } catch (e) {
1813
+ console.error("Error: There was an error parsing the subAction for the featured suggestion with label, \"" + suggestion.label + "\"", e);
1814
+ }
1815
+ },
1667
1816
  onSuggestionSelected: function onSuggestionSelected(suggestion) {
1668
1817
  var _this4 = this;
1669
- if (!this.$props.enableAI) this.isOpen = false;else {
1818
+ var value = this.$props.value;
1819
+ // The state of the suggestion is open by the time it reaches here. i.e. isOpen = true
1820
+ // handle when FAQ suggestion is clicked
1821
+ if (suggestion && suggestion._suggestion_type === helper.suggestionTypes.FAQ) {
1822
+ this.currentValue = suggestion.value;
1823
+ // Handle AI
1824
+ // Independent of enableAI.
1825
+ this.faqAnswer = suggestion._answer;
1826
+ this.faqQuestion = suggestion.value;
1827
+ this.isOpen = true;
1670
1828
  this.showAIScreen = true;
1829
+ if (value !== undefined) this.$emit('change', suggestion.value, function () {});
1830
+ this.onValueSelectedHandler(suggestion.value);
1831
+ return;
1832
+ }
1833
+ if (suggestion && suggestion._suggestion_type === '_internal_a_i_trigger') {
1834
+ this.showAIScreen = true;
1835
+ this.askButtonOnClick();
1836
+ return;
1837
+ }
1838
+
1839
+ // handle featured suggestions click event
1840
+ if (suggestion._suggestion_type === helper.suggestionTypes.Featured) {
1841
+ this.handleFeaturedSuggestionClicked(suggestion);
1842
+ // Handle AI
1843
+ if (!this.$props.enableAI) this.isOpen = false;else {
1844
+ this.showAIScreen = true;
1845
+ }
1846
+ return;
1671
1847
  }
1672
- var value = this.$props.value;
1673
1848
  // Record analytics for selected suggestions
1674
1849
  this.triggerClickAnalytics(suggestion._click_id);
1675
1850
  if (value === undefined) {
@@ -1697,6 +1872,11 @@ var SearchBox = vue.defineComponent({
1697
1872
  });
1698
1873
  }
1699
1874
  this.onValueSelectedHandler(suggestion.value, reactivecore.causes.SUGGESTION_SELECT, suggestion.source);
1875
+
1876
+ // Handle AI
1877
+ if (!this.$props.enableAI) this.isOpen = false;else if (this.currentTriggerMode === constants.AI_TRIGGER_MODES.QUESTION && suggestion.value.endsWith('?')) {
1878
+ this.showAIScreen = true;
1879
+ }
1700
1880
  },
1701
1881
  onValueSelectedHandler: function onValueSelectedHandler(currentValue) {
1702
1882
  if (currentValue === void 0) {
@@ -1825,6 +2005,13 @@ var SearchBox = vue.defineComponent({
1825
2005
  customQuery: true
1826
2006
  });
1827
2007
  },
2008
+ suggestionsFooter: function suggestionsFooter() {
2009
+ return typeof renderSuggestionsFooter === 'function' ? this.$props.renderSuggestionsFooter() : vue.createVNode(AutosuggestFooterContainer, null, {
2010
+ "default": function _default() {
2011
+ return [vue.createVNode("div", null, [vue.createTextVNode("\u2191\u2193 Navigate")]), vue.createVNode("div", null, [vue.createTextVNode("\u21A9 Go")])];
2012
+ }
2013
+ });
2014
+ },
1828
2015
  renderEnterButtonElement: function renderEnterButtonElement() {
1829
2016
  var _this6 = this;
1830
2017
  var _this$$props2 = this.$props,
@@ -1852,71 +2039,98 @@ var SearchBox = vue.defineComponent({
1852
2039
  }
1853
2040
  return null;
1854
2041
  },
1855
- renderIcons: function renderIcons() {
2042
+ renderShortcut: function renderShortcut() {
2043
+ if (this.$props.focusShortcuts && this.$props.focusShortcuts.length) {
2044
+ var shortcut = this.$props.focusShortcuts[0];
2045
+ shortcut = shortcut.toLowerCase();
2046
+ shortcut = shortcut.replace('shift', '⬆️');
2047
+ shortcut = shortcut.replace('command', 'cmd');
2048
+ shortcut = shortcut.replace('control', 'ctrl');
2049
+ shortcut = shortcut.replace('option', 'alt');
2050
+ return shortcut.toUpperCase();
2051
+ }
2052
+ return '/';
2053
+ },
2054
+ renderLeftIcons: function renderLeftIcons() {
1856
2055
  var _this7 = this;
1857
- var _slot3, _slot4, _slot5;
2056
+ var _slot3;
1858
2057
  var _this$$props3 = this.$props,
1859
2058
  iconPosition = _this$$props3.iconPosition,
1860
- showClear = _this$$props3.showClear,
1861
- innerClass = _this$$props3.innerClass,
1862
- getMicInstance = _this$$props3.getMicInstance,
1863
- showVoiceSearch = _this$$props3.showVoiceSearch,
1864
2059
  showIcon = _this$$props3.showIcon;
2060
+ return vue.createVNode("div", null, [vue.createVNode(DropDown.IconGroup, {
2061
+ "groupPosition": "left"
2062
+ }, {
2063
+ "default": function _default() {
2064
+ return [iconPosition === 'left' && showIcon && vue.createVNode(DropDown.IconWrapper, {
2065
+ "onClick": _this7.handleSearchIconClick
2066
+ }, _isSlot(_slot3 = _this7.renderIcon()) ? _slot3 : {
2067
+ "default": function _default() {
2068
+ return [_slot3];
2069
+ }
2070
+ })];
2071
+ }
2072
+ })]);
2073
+ },
2074
+ renderRightIcons: function renderRightIcons() {
2075
+ var _this8 = this;
2076
+ var _slot4, _slot5, _slot6;
2077
+ var _this$$props4 = this.$props,
2078
+ iconPosition = _this$$props4.iconPosition,
2079
+ showClear = _this$$props4.showClear,
2080
+ innerClass = _this$$props4.innerClass,
2081
+ getMicInstance = _this$$props4.getMicInstance,
2082
+ showVoiceSearch = _this$$props4.showVoiceSearch,
2083
+ showIcon = _this$$props4.showIcon,
2084
+ showFocusShortcutsIcon = _this$$props4.showFocusShortcutsIcon;
1865
2085
  var renderMic = this.$slots.renderMic || this.$props.renderMic;
1866
2086
  var currentValue = this.$data.currentValue;
1867
2087
  return vue.createVNode("div", null, [vue.createVNode(DropDown.IconGroup, {
1868
- "groupPosition": "right",
1869
- "positionType": "absolute"
2088
+ "groupPosition": "right"
1870
2089
  }, {
1871
2090
  "default": function _default() {
1872
2091
  return [currentValue && showClear && vue.createVNode(DropDown.IconWrapper, {
1873
- "onClick": _this7.clearValue,
2092
+ "onClick": _this8.clearValue,
1874
2093
  "showIcon": showIcon,
1875
2094
  "isClearIcon": true
1876
- }, _isSlot(_slot3 = _this7.renderCancelIcon()) ? _slot3 : {
2095
+ }, _isSlot(_slot4 = _this8.renderCancelIcon()) ? _slot4 : {
1877
2096
  "default": function _default() {
1878
- return [_slot3];
2097
+ return [_slot4];
2098
+ }
2099
+ }), showFocusShortcutsIcon && vue.createVNode(DropDown.ButtonIconWrapper, {
2100
+ "onClick": function onClick(e) {
2101
+ return _this8.focusSearchBox(e);
2102
+ }
2103
+ }, _isSlot(_slot5 = _this8.renderShortcut()) ? _slot5 : {
2104
+ "default": function _default() {
2105
+ return [_slot5];
1879
2106
  }
1880
2107
  }), showVoiceSearch && vue.createVNode(Mic, {
1881
2108
  "getInstance": getMicInstance,
1882
2109
  "render": renderMic,
1883
- "handleResult": _this7.handleVoiceResults,
2110
+ "handleResult": _this8.handleVoiceResults,
1884
2111
  "className": getClassName$1(innerClass, 'mic') || null
1885
2112
  }, null), iconPosition === 'right' && showIcon && vue.createVNode(DropDown.IconWrapper, {
1886
- "onClick": _this7.handleSearchIconClick
1887
- }, _isSlot(_slot4 = _this7.renderIcon()) ? _slot4 : {
1888
- "default": function _default() {
1889
- return [_slot4];
1890
- }
1891
- })];
1892
- }
1893
- }), vue.createVNode(DropDown.IconGroup, {
1894
- "groupPosition": "left",
1895
- "positionType": "absolute"
1896
- }, {
1897
- "default": function _default() {
1898
- return [iconPosition === 'left' && showIcon && vue.createVNode(DropDown.IconWrapper, {
1899
- "onClick": _this7.handleSearchIconClick
1900
- }, _isSlot(_slot5 = _this7.renderIcon()) ? _slot5 : {
2113
+ "onClick": _this8.handleSearchIconClick
2114
+ }, _isSlot(_slot6 = _this8.renderIcon()) ? _slot6 : {
1901
2115
  "default": function _default() {
1902
- return [_slot5];
2116
+ return [_slot6];
1903
2117
  }
1904
2118
  })];
1905
2119
  }
1906
2120
  })]);
1907
2121
  },
1908
2122
  focusSearchBox: function focusSearchBox(event) {
1909
- var _this$$refs2, _this$$refs2$this$$pr;
2123
+ var _this$$refs4;
1910
2124
  var elt = event.target || event.srcElement;
1911
2125
  var tagName = elt.tagName;
1912
2126
  if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
1913
2127
  // already in an input
1914
2128
  return;
1915
2129
  }
1916
- (_this$$refs2 = this.$refs) == null ? void 0 : (_this$$refs2$this$$pr = _this$$refs2[this.$props.innerRef]) == null ? void 0 : _this$$refs2$this$$pr.focus(); // eslint-disable-line
2130
+ (_this$$refs4 = this.$refs) == null || (_this$$refs4 = _this$$refs4[this.$props.innerRef]) == null || (_this$$refs4 = _this$$refs4.$el) == null ? void 0 : _this$$refs4.focus(); // eslint-disable-line
1917
2131
  },
1918
2132
  listenForFocusShortcuts: function listenForFocusShortcuts() {
1919
- var _this8 = this;
2133
+ var _this9 = this;
1920
2134
  var _this$$props$focusSho = this.$props.focusShortcuts,
1921
2135
  focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
1922
2136
  if (index.isEmpty(focusShortcuts)) {
@@ -1931,7 +2145,7 @@ var SearchBox = vue.defineComponent({
1931
2145
  function (event, handler) {
1932
2146
  // Prevent the default refresh event under WINDOWS system
1933
2147
  event.preventDefault();
1934
- _this8.focusSearchBox(event);
2148
+ _this9.focusSearchBox(event);
1935
2149
  });
1936
2150
 
1937
2151
  // if one of modifier keys are used, they are handled below
@@ -1941,7 +2155,7 @@ var SearchBox = vue.defineComponent({
1941
2155
  for (var index$1 = 0; index$1 < modifierKeys.length; index$1 += 1) {
1942
2156
  var element = modifierKeys[index$1];
1943
2157
  if (hotkeys[element]) {
1944
- _this8.focusSearchBox(event);
2158
+ _this9.focusSearchBox(event);
1945
2159
  break;
1946
2160
  }
1947
2161
  }
@@ -1953,19 +2167,34 @@ var SearchBox = vue.defineComponent({
1953
2167
  this.currentValue = index.decodeHtml(value);
1954
2168
  this.triggerDefaultQuery(value);
1955
2169
  },
1956
- renderAutoFill: function renderAutoFill(suggestion) {
1957
- var _this9 = this;
2170
+ renderActionIcon: function renderActionIcon(suggestion) {
2171
+ var _this10 = this;
1958
2172
  var handleAutoFillClick = function handleAutoFillClick(e) {
1959
2173
  e.stopPropagation();
1960
- _this9.onAutofillClick(suggestion);
2174
+ _this10.onAutofillClick(suggestion);
1961
2175
  };
1962
- /* 👇 avoid showing autofill for category suggestions👇 */
1963
- return suggestion._category ? null : vue.createVNode(AutoFillSvg, {
1964
- "onClick": handleAutoFillClick
1965
- }, null);
2176
+ if (suggestion._suggestion_type === helper.suggestionTypes.Featured) {
2177
+ if (suggestion.action === helper.featuredSuggestionsActionTypes.FUNCTION) {
2178
+ return vue.createVNode(AutoFillSvg, {
2179
+ "style": {
2180
+ transform: 'rotate(135deg)',
2181
+ pointerEvents: 'none'
2182
+ }
2183
+ }, null);
2184
+ }
2185
+ return null;
2186
+ }
2187
+ if (!suggestion._category) {
2188
+ /* 👇 avoid showing autofill for category suggestions👇 */
2189
+
2190
+ return vue.createVNode(AutoFillSvg, {
2191
+ "onClick": handleAutoFillClick
2192
+ }, null);
2193
+ }
2194
+ return null;
1966
2195
  },
1967
2196
  renderTag: function renderTag(item) {
1968
- var _this10 = this;
2197
+ var _this11 = this;
1969
2198
  var innerClass = this.$props.innerClass;
1970
2199
  return vue.createVNode(TagItem, {
1971
2200
  "class": getClassName$1(innerClass, 'selected-tag') || ''
@@ -1976,7 +2205,7 @@ var SearchBox = vue.defineComponent({
1976
2205
  "aria-label": "delete-tag",
1977
2206
  "class": "close-icon",
1978
2207
  "onClick": function onClick() {
1979
- return _this10.clearTag(item);
2208
+ return _this11.clearTag(item);
1980
2209
  }
1981
2210
  }, [vue.createVNode(DropDown.CancelSvg, null, null)])];
1982
2211
  }
@@ -1999,7 +2228,7 @@ var SearchBox = vue.defineComponent({
1999
2228
  }
2000
2229
  },
2001
2230
  renderTags: function renderTags() {
2002
- var _this11 = this;
2231
+ var _this12 = this;
2003
2232
  if (!Array.isArray(this.selectedTags)) {
2004
2233
  return null;
2005
2234
  }
@@ -2013,16 +2242,16 @@ var SearchBox = vue.defineComponent({
2013
2242
  }) : vue.createVNode(TagsContainer, null, {
2014
2243
  "default": function _default() {
2015
2244
  return [tagsList.map(function (item) {
2016
- return _this11.renderTag(item);
2245
+ return _this12.renderTag(item);
2017
2246
  }), shouldRenderClearAllTag && vue.createVNode(TagItem, {
2018
- "class": getClassName$1(_this11.$props.innerClass, 'selected-tag') || ''
2247
+ "class": getClassName$1(_this12.$props.innerClass, 'selected-tag') || ''
2019
2248
  }, {
2020
2249
  "default": function _default() {
2021
2250
  return [vue.createVNode("span", null, [vue.createTextVNode("Clear All")]), vue.createVNode("span", {
2022
2251
  "role": "img",
2023
2252
  "aria-label": "delete-tag",
2024
2253
  "class": "close-icon",
2025
- "onClick": _this11.clearAllTags
2254
+ "onClick": _this12.clearAllTags
2026
2255
  }, [vue.createVNode(DropDown.CancelSvg, null, null)])];
2027
2256
  }
2028
2257
  })];
@@ -2069,49 +2298,56 @@ var SearchBox = vue.defineComponent({
2069
2298
  return vue.createVNode(HorizontalSkeletonLoader, null, null);
2070
2299
  },
2071
2300
  renderAIScreenFooter: function renderAIScreenFooter() {
2072
- var _slot6;
2073
- var _this12 = this;
2301
+ var _slot8;
2302
+ var _this13 = this;
2074
2303
  var _this$$props$AIUIConf2 = this.$props.AIUIConfig,
2075
2304
  AIUIConfig = _this$$props$AIUIConf2 === void 0 ? {} : _this$$props$AIUIConf2;
2076
2305
  var _ref6 = AIUIConfig || {},
2077
2306
  _ref6$showSourceDocum = _ref6.showSourceDocuments,
2078
2307
  showSourceDocuments = _ref6$showSourceDocum === void 0 ? true : _ref6$showSourceDocum,
2079
- _ref6$sourceDocumentL = _ref6.sourceDocumentLabel,
2080
- sourceDocumentLabel = _ref6$sourceDocumentL === void 0 ? '_id' : _ref6$sourceDocumentL,
2081
2308
  _ref6$onSourceClick = _ref6.onSourceClick,
2082
2309
  onSourceClick = _ref6$onSourceClick === void 0 ? function () {} : _ref6$onSourceClick;
2310
+ var renderSourceDocumentLabel = function renderSourceDocumentLabel(sourceObj) {
2311
+ if (_this13.$props.AIUIConfig && _this13.$props.AIUIConfig.renderSourceDocument) {
2312
+ return _this13.$props.AIUIConfig.renderSourceDocument(sourceObj);
2313
+ }
2314
+ if (_this13.$slots.renderSourceDocument) {
2315
+ return _this13.$slots.renderSourceDocument(sourceObj);
2316
+ }
2317
+ return sourceObj._id;
2318
+ };
2083
2319
  return showSourceDocuments && this.showAIScreenFooter && this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds ? vue.createVNode(Footer, {
2084
2320
  "themePreset": this.$props.themePreset
2085
2321
  }, {
2086
2322
  "default": function _default() {
2087
- return [vue.createTextVNode("Summary generated using the following sources:"), ' ', vue.createVNode(SourceTags, null, _isSlot(_slot6 = _this12.getAISourceObjects().map(function (el) {
2323
+ return [vue.createTextVNode("Summary generated using the following sources:"), ' ', vue.createVNode(SourceTags, null, _isSlot(_slot8 = _this13.getAISourceObjects().map(function (el) {
2324
+ var _slot7;
2088
2325
  return vue.createVNode(Button.Button, {
2089
- "class": "--ai-source-tag " + (getClassName$1(_this12.$props.innerClass, 'ai-source-tag') || ''),
2090
- "title": el[sourceDocumentLabel],
2326
+ "class": "--ai-source-tag " + (getClassName$1(_this13.$props.innerClass, 'ai-source-tag') || ''),
2091
2327
  "info": true,
2092
2328
  "onClick": function onClick() {
2093
2329
  return onSourceClick && onSourceClick(el);
2094
2330
  }
2095
- }, {
2331
+ }, _isSlot(_slot7 = renderSourceDocumentLabel(el)) ? _slot7 : {
2096
2332
  "default": function _default() {
2097
- return [el[sourceDocumentLabel]];
2333
+ return [_slot7];
2098
2334
  }
2099
2335
  });
2100
- })) ? _slot6 : {
2336
+ })) ? _slot8 : {
2101
2337
  "default": function _default() {
2102
- return [_slot6];
2338
+ return [_slot8];
2103
2339
  }
2104
2340
  })];
2105
2341
  }
2106
2342
  }) : null;
2107
2343
  },
2108
2344
  renderAIScreen: function renderAIScreen() {
2109
- var _this13 = this;
2345
+ var _this14 = this;
2110
2346
  var customAIRenderer = this.$props.renderAIAnswer || this.$slots.renderAIAnswer;
2111
2347
  if (customAIRenderer) {
2112
2348
  return customAIRenderer({
2113
- question: this.AIResponse && this.AIResponse.response && this.AIResponse.response.question,
2114
- answer: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text,
2349
+ question: this.mergedAIQuestion,
2350
+ answer: this.mergedAIAnswer,
2115
2351
  documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
2116
2352
  loading: this.isAIResponseLoading || this.isLoading,
2117
2353
  sources: this.getAISourceObjects(),
@@ -2122,7 +2358,7 @@ var SearchBox = vue.defineComponent({
2122
2358
  return this.renderAIScreenLoader();
2123
2359
  }
2124
2360
  return vue.createVNode("div", null, [vue.createVNode(Answer, {
2125
- "innerHTML": md.render(this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text)
2361
+ "innerHTML": md.render(this.mergedAIAnswer)
2126
2362
  }, null), this.renderAIScreenFooter(), this.showFeedbackComponent && vue.createVNode("div", {
2127
2363
  "class": "" + (getClassName$1(this.$props.innerClass, 'ai-feedback') || '')
2128
2364
  }, [vue.createVNode(AIFeedback, {
@@ -2130,11 +2366,11 @@ var SearchBox = vue.defineComponent({
2130
2366
  "hideUI": this.isAIResponseLoading || this.isLoading || !this.sessionIdFromStore,
2131
2367
  "key": this.sessionIdFromStore,
2132
2368
  "onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
2133
- _this13.feedbackState = {
2369
+ _this14.feedbackState = {
2134
2370
  isRecorded: true,
2135
2371
  feedbackType: useful ? 'positive' : 'negative'
2136
2372
  };
2137
- _this13.recordAISessionUsefulness(_this13.sessionIdFromStore, {
2373
+ _this14.recordAISessionUsefulness(_this14.sessionIdFromStore, {
2138
2374
  useful: useful,
2139
2375
  reason: reason
2140
2376
  });
@@ -2169,22 +2405,22 @@ var SearchBox = vue.defineComponent({
2169
2405
  });
2170
2406
  },
2171
2407
  renderAskButtonElement: function renderAskButtonElement() {
2172
- var _this14 = this;
2173
- var _this$$props4 = this.$props,
2174
- AIUIConfig = _this$$props4.AIUIConfig,
2175
- innerClass = _this$$props4.innerClass;
2408
+ var _this15 = this;
2409
+ var _this$$props5 = this.$props,
2410
+ AIUIConfig = _this$$props5.AIUIConfig,
2411
+ innerClass = _this$$props5.innerClass;
2176
2412
  var _ref7 = AIUIConfig || {},
2177
2413
  askButton = _ref7.askButton;
2178
2414
  var renderAskButton = this.$slots.renderAskButton;
2179
2415
  if (askButton) {
2180
2416
  var getEnterButtonMarkup = function getEnterButtonMarkup() {
2181
2417
  if (renderAskButton) {
2182
- return renderAskButton(_this14.askButtonOnClick);
2418
+ return renderAskButton(_this15.askButtonOnClick);
2183
2419
  }
2184
2420
  return vue.createVNode(Button.Button, {
2185
2421
  "class": "enter-btn " + getClassName$1(innerClass, 'ask-button'),
2186
2422
  "info": true,
2187
- "onClick": _this14.askButtonOnClick
2423
+ "onClick": _this15.askButtonOnClick
2188
2424
  }, {
2189
2425
  "default": function _default() {
2190
2426
  return [vue.createTextVNode("Ask")];
@@ -2199,7 +2435,7 @@ var SearchBox = vue.defineComponent({
2199
2435
  }
2200
2436
  },
2201
2437
  render: function render() {
2202
- var _this15 = this;
2438
+ var _this16 = this;
2203
2439
  var expandSuggestionsContainer = this.$props.expandSuggestionsContainer;
2204
2440
  var _this$$slots = this.$slots,
2205
2441
  recentSearchesIcon = _this$$slots.recentSearchesIcon,
@@ -2210,17 +2446,17 @@ var SearchBox = vue.defineComponent({
2210
2446
  "class": this.$props.className
2211
2447
  }, {
2212
2448
  "default": function _default() {
2213
- return [_this15.$props.title && vue.createVNode(Title.Title, {
2214
- "class": getClassName$1(_this15.$props.innerClass, 'title') || ''
2449
+ return [_this16.$props.title && vue.createVNode(Title.Title, {
2450
+ "class": getClassName$1(_this16.$props.innerClass, 'title') || ''
2215
2451
  }, {
2216
2452
  "default": function _default() {
2217
- return [_this15.$props.title];
2453
+ return [_this16.$props.title];
2218
2454
  }
2219
- }), _this15.$props.autosuggest ? vue.createVNode(DropDown.Downshift, {
2220
- "id": _this15.$props.componentId + "-downshift",
2221
- "handleChange": _this15.onSuggestionSelected,
2222
- "handleMouseup": _this15.handleStateChange,
2223
- "isOpen": _this15.$data.isOpen
2455
+ }), _this16.$props.autosuggest ? vue.createVNode(DropDown.Downshift, {
2456
+ "id": _this16.$props.componentId + "-downshift",
2457
+ "handleChange": _this16.onSuggestionSelected,
2458
+ "handleMouseup": _this16.handleStateChange,
2459
+ "isOpen": _this16.$data.isOpen
2224
2460
  }, {
2225
2461
  "default": function _default(_ref8) {
2226
2462
  var getInputEvents = _ref8.getInputEvents,
@@ -2231,156 +2467,249 @@ var SearchBox = vue.defineComponent({
2231
2467
  highlightedIndex = _ref8.highlightedIndex,
2232
2468
  setHighlightedIndex = _ref8.setHighlightedIndex;
2233
2469
  var renderSuggestionsDropdown = function renderSuggestionsDropdown() {
2234
- var getIcon = function getIcon(iconType) {
2470
+ var getIcon = function getIcon(iconType, item, leaveSpaceForIcon) {
2235
2471
  switch (iconType) {
2236
2472
  case helper.suggestionTypes.Recent:
2237
2473
  return recentSearchesIcon;
2238
2474
  case helper.suggestionTypes.Popular:
2239
2475
  return popularSearchesIcon;
2476
+ case helper.suggestionTypes.Featured:
2477
+ if (item.icon) {
2478
+ return function () {
2479
+ return vue.createVNode("div", {
2480
+ "style": {
2481
+ display: 'flex'
2482
+ },
2483
+ "innerHTML": xss(item.icon)
2484
+ }, null);
2485
+ };
2486
+ }
2487
+ if (item.iconURL) {
2488
+ return function () {
2489
+ return (// When you change below also change the empty icon below
2490
+ vue.createVNode("img", {
2491
+ "style": {
2492
+ maxWidth: '30px'
2493
+ },
2494
+ "src": xss(item.iconURL),
2495
+ "alt": item.value
2496
+ }, null)
2497
+ );
2498
+ };
2499
+ }
2500
+ // Render an empty icon when no icon is provided from the dashboard
2501
+ return function () {
2502
+ return vue.createVNode("span", {
2503
+ "style": {
2504
+ display: 'inline-block',
2505
+ height: '30px',
2506
+ width: leaveSpaceForIcon ? '30px' : 0
2507
+ }
2508
+ }, null);
2509
+ };
2240
2510
  default:
2241
2511
  return null;
2242
2512
  }
2243
2513
  };
2244
- return vue.createVNode("div", null, [_this15.hasCustomRenderer && _this15.getComponent({
2514
+ var indexOffset = 0;
2515
+ return vue.createVNode("div", null, [_this16.hasCustomRenderer && _this16.getComponent({
2245
2516
  isOpen: isOpen,
2246
2517
  getItemProps: getItemProps,
2247
2518
  getItemEvents: getItemEvents,
2248
2519
  highlightedIndex: highlightedIndex
2249
- }), _this15.renderErrorComponent(), !_this15.hasCustomRenderer && isOpen && hasSuggestions ? vue.createVNode("ul", {
2250
- "class": Input.suggestions(_this15.themePreset, _this15.theme) + " " + getClassName$1(_this15.$props.innerClass, 'list'),
2520
+ }), _this16.renderErrorComponent(), !_this16.hasCustomRenderer && isOpen && hasSuggestions ? vue.createVNode("ul", {
2521
+ "class": Input.suggestions(_this16.themePreset, _this16.theme) + " " + getClassName$1(_this16.$props.innerClass, 'list') + " " + Input.searchboxSuggestions(_this16.themePreset, _this16.theme) + "\n\t\t\t\t\t\t\t\t\t\t\t\t\t",
2251
2522
  "ref": _dropdownULRef
2252
- }, [_this15.showAIScreen && vue.createVNode(SearchBoxAISection, {
2253
- "themePreset": _this15.$props.themePreset
2523
+ }, [_this16.showAIScreen && vue.createVNode(SearchBoxAISection, {
2524
+ "themePreset": _this16.$props.themePreset
2254
2525
  }, {
2255
2526
  "default": function _default() {
2256
- return [_this15.renderAIScreen(), ' ', _this15.renderErrorComponent(true)];
2527
+ return [_this16.renderAIScreen(), ' ', _this16.renderErrorComponent(true)];
2257
2528
  }
2258
- }), !_this15.showAIScreen && _this15.normalizedSuggestions.map(function (item, index) {
2259
- return renderItem ? vue.createVNode("li", vue.mergeProps(getItemProps({
2260
- item: item
2261
- }), getItemEvents({
2262
- item: item
2263
- }), {
2264
- "key": index + 1 + "-" + item.value,
2265
- "style": {
2266
- backgroundColor: _this15.getBackgroundColor(highlightedIndex, index),
2267
- justifyContent: 'flex-start',
2268
- alignItems: 'center'
2269
- }
2270
- }), [renderItem(item)]) : vue.createVNode("li", vue.mergeProps(getItemProps({
2271
- item: item
2272
- }), _transformOn(getItemEvents({
2273
- item: item
2274
- })), {
2275
- "key": index + 1 + "-" + item.value,
2276
- "style": {
2277
- backgroundColor: _this15.getBackgroundColor(highlightedIndex, index),
2278
- justifyContent: 'flex-start',
2279
- alignItems: 'center'
2280
- }
2281
- }), [vue.createVNode("div", {
2282
- "style": {
2283
- padding: '0 10px 0 0',
2284
- display: 'flex'
2285
- }
2286
- }, [vue.createVNode(CustomSvg, {
2287
- "className": getClassName$1(_this15.$props.innerClass, item._suggestion_type + "-search-icon") || null,
2288
- "icon": getIcon(item._suggestion_type),
2289
- "type": item._suggestion_type + "-search-icon"
2290
- }, null)]), vue.createVNode(SuggestionItem, {
2291
- "currentValue": _this15.currentValue,
2292
- "suggestion": item
2293
- }, null), _this15.renderAutoFill(item)]);
2294
- })]) : _this15.renderNoSuggestions(_this15.normalizedSuggestions)]);
2529
+ }), !_this16.showAIScreen && _this16.parsedSuggestions.map(function (item, itemIndex) {
2530
+ var index = indexOffset + itemIndex;
2531
+ if (Array.isArray(item)) {
2532
+ var sectionHtml = xss(item[0].sectionLabel);
2533
+ indexOffset += item.length - 1;
2534
+ return vue.createVNode("div", {
2535
+ "key": "section-" + itemIndex,
2536
+ "class": "section-container"
2537
+ }, [sectionHtml ? vue.createVNode("div", {
2538
+ "class": "section-header " + getClassName$1(_this16.$props.innerClass, 'section-label'),
2539
+ "key": "" + item[0].sectionId,
2540
+ "innerHTML": sectionHtml
2541
+ }, null) : null, vue.createVNode("ul", {
2542
+ "class": "section-list"
2543
+ }, [item.map(function (sectionItem, sectionIndex) {
2544
+ var suggestionsHaveIcon = item.some(function (s) {
2545
+ return s.icon || s.iconURL;
2546
+ });
2547
+ if (renderItem) {
2548
+ return vue.createVNode("li", vue.mergeProps(getItemProps({
2549
+ item: sectionItem
2550
+ }), _transformOn(getItemEvents({
2551
+ item: sectionItem
2552
+ })), {
2553
+ "key": sectionItem._id + "_" + index + "_" + sectionIndex,
2554
+ "style": {
2555
+ justifyContent: 'flex-start',
2556
+ alignItems: 'center'
2557
+ },
2558
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this16.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this16.$props.innerClass, 'suggestion-item'))
2559
+ }), [renderItem(sectionItem)]);
2560
+ }
2561
+ if (sectionItem._suggestion_type === '_internal_a_i_trigger') {
2562
+ return vue.createVNode("li", vue.mergeProps(getItemProps({
2563
+ item: sectionItem
2564
+ }), _transformOn(getItemEvents({
2565
+ item: sectionItem
2566
+ })), {
2567
+ "key": sectionItem._id + "_" + index + "_" + sectionIndex,
2568
+ "style": {
2569
+ justifyContent: 'flex-start',
2570
+ alignItems: 'center'
2571
+ },
2572
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this16.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this16.$props.innerClass, 'suggestion-item'))
2573
+ }), [vue.createVNode(SuggestionItem, {
2574
+ "currentValue": _this16.currentValue,
2575
+ "suggestion": sectionItem
2576
+ }, null)]);
2577
+ }
2578
+ return vue.createVNode("li", vue.mergeProps(getItemProps({
2579
+ item: sectionItem
2580
+ }), _transformOn(getItemEvents({
2581
+ item: sectionItem
2582
+ })), {
2583
+ "key": sectionItem._id + "_" + index + "_" + sectionIndex,
2584
+ "style": {
2585
+ justifyContent: 'flex-start',
2586
+ alignItems: 'center'
2587
+ },
2588
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this16.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this16.$props.innerClass, 'suggestion-item'))
2589
+ }), [vue.createVNode("div", {
2590
+ "style": {
2591
+ padding: '0 10px 0 0',
2592
+ display: 'flex'
2593
+ }
2594
+ }, [vue.createVNode(CustomSvg, {
2595
+ "key": sectionItem._suggestion_type + "-" + sectionIndex,
2596
+ "className": getClassName$1(_this16.$props.innerClass, sectionItem._suggestion_type + "-search-icon") || null,
2597
+ "icon": getIcon(sectionItem._suggestion_type, sectionItem, suggestionsHaveIcon),
2598
+ "type": sectionItem._suggestion_type + "-search-icon"
2599
+ }, null)]), vue.createVNode(SuggestionItem, {
2600
+ "currentValue": _this16.currentValue,
2601
+ "suggestion": sectionItem
2602
+ }, null), _this16.renderActionIcon(sectionItem)]);
2603
+ })])]);
2604
+ }
2605
+ return vue.createVNode("div", null, [vue.createTextVNode("No suggestions")]);
2606
+ }), !_this16.showAIScreen && _this16.parsedSuggestions.length && _this16.$props.showSuggestionsFooter ? _this16.suggestionsFooter() : null]) : _this16.renderNoSuggestions(_this16.normalizedSuggestions)]);
2295
2607
  };
2296
2608
  return vue.createVNode("div", {
2297
2609
  "class": Input.suggestionsContainer
2298
2610
  }, [vue.createVNode(InputGroup, {
2299
- "ref": _inputGroupRef
2611
+ "searchBox": true,
2612
+ "ref": _inputGroupRef,
2613
+ "isOpen": _this16.$data.isOpen
2300
2614
  }, {
2301
2615
  "default": function _default() {
2302
- return [_this15.renderInputAddonBefore(), vue.createVNode(DropDown.InputWrapper, null, {
2616
+ return [vue.createVNode(Input.Actions, null, {
2617
+ "default": function _default() {
2618
+ return [_this16.renderInputAddonBefore(), _this16.renderLeftIcons()];
2619
+ }
2620
+ }), vue.createVNode(DropDown.InputWrapper, null, {
2303
2621
  "default": function _default() {
2304
2622
  return [vue.createVNode(Input.TextArea, vue.mergeProps(_transformOn(getInputEvents({
2305
- onInput: _this15.onInputChange,
2623
+ onInput: _this16.onInputChange,
2306
2624
  onBlur: function onBlur(e) {
2307
- _this15.$emit('blur', e, _this15.triggerQuery);
2625
+ _this16.$emit('blur', e, _this16.triggerQuery);
2308
2626
  },
2309
- onFocus: _this15.handleFocus,
2627
+ onFocus: _this16.handleFocus,
2310
2628
  onKeyPress: function onKeyPress(e) {
2311
- _this15.$emit('keyPress', e, _this15.triggerQuery);
2312
- _this15.$emit('key-press', e, _this15.triggerQuery);
2629
+ _this16.$emit('keyPress', e, _this16.triggerQuery);
2630
+ _this16.$emit('key-press', e, _this16.triggerQuery);
2313
2631
  },
2314
2632
  onKeyDown: function onKeyDown(e) {
2315
- return _this15.handleKeyDown(e, highlightedIndex);
2633
+ return _this16.handleKeyDown(e, highlightedIndex);
2316
2634
  },
2317
2635
  onKeyUp: function onKeyUp(e) {
2318
- _this15.$emit('keyUp', e, _this15.triggerQuery);
2319
- _this15.$emit('key-up', e, _this15.triggerQuery);
2636
+ _this16.$emit('keyUp', e, _this16.triggerQuery);
2637
+ _this16.$emit('key-up', e, _this16.triggerQuery);
2320
2638
  },
2321
2639
  onClick: function onClick() {
2322
2640
  setHighlightedIndex(null);
2323
2641
  }
2324
2642
  })), {
2325
- "id": _this15.$props.componentId + "-input",
2326
- "showIcon": _this15.$props.showIcon,
2327
- "showClear": _this15.$props.showClear,
2328
- "iconPosition": _this15.$props.iconPosition,
2329
- "ref": _this15.$props.innerRef,
2330
- "class": getClassName$1(_this15.$props.innerClass, 'input'),
2331
- "placeholder": _this15.$props.placeholder,
2332
- "autoFocus": _this15.$props.autoFocus,
2333
- "showFocusShortcutsIcon": _this15.$props.showFocusShortcutsIcon,
2334
- "showVoiceSearch": _this15.$props.showVoiceSearch
2643
+ "searchBox": true,
2644
+ "isOpen": _this16.$data.isOpen,
2645
+ "id": _this16.$props.componentId + "-input",
2646
+ "ref": _this16.$props.innerRef,
2647
+ "class": getClassName$1(_this16.$props.innerClass, 'input'),
2648
+ "placeholder": _this16.$props.placeholder,
2649
+ "autoFocus": _this16.$props.autoFocus
2335
2650
  }, getInputProps({
2336
- value: _this15.$data.currentValue === null ? '' : _this15.$data.currentValue
2651
+ value: _this16.$data.currentValue === null ? '' : _this16.$data.currentValue
2337
2652
  }), {
2338
- "themePreset": _this15.themePreset,
2653
+ "themePreset": _this16.themePreset,
2339
2654
  "autocomplete": "off"
2340
- }), null), _this15.renderIcons(), !expandSuggestionsContainer && renderSuggestionsDropdown()];
2655
+ }), null), !expandSuggestionsContainer && renderSuggestionsDropdown()];
2341
2656
  }
2342
- }), _this15.renderInputAddonAfter(), _this15.renderAskButtonElement(), _this15.renderEnterButtonElement()];
2657
+ }), vue.createVNode(Input.Actions, null, {
2658
+ "default": function _default() {
2659
+ return [_this16.renderRightIcons(), _this16.renderInputAddonAfter(), _this16.renderAskButtonElement(), _this16.renderEnterButtonElement()];
2660
+ }
2661
+ })];
2343
2662
  }
2344
- }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this15.renderTags()]);
2663
+ }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this16.renderTags()]);
2345
2664
  }
2346
2665
  }) : vue.createVNode("div", {
2347
2666
  "class": Input.suggestionsContainer
2348
2667
  }, [vue.createVNode(InputGroup, {
2668
+ "searchBox": true,
2349
2669
  "ref": _inputGroupRef
2350
2670
  }, {
2351
2671
  "default": function _default() {
2352
- return [_this15.renderInputAddonBefore(), vue.createVNode(DropDown.InputWrapper, null, {
2672
+ return [vue.createVNode(Input.Actions, null, {
2673
+ "default": function _default() {
2674
+ return [_this16.renderInputAddonBefore(), _this16.renderLeftIcons()];
2675
+ }
2676
+ }), vue.createVNode(DropDown.InputWrapper, null, {
2353
2677
  "default": function _default() {
2354
2678
  return [vue.createVNode(Input.TextArea, vue.mergeProps(_transformOn({
2355
2679
  blur: function blur(e) {
2356
- _this15.$emit('blur', e, _this15.triggerQuery);
2680
+ _this16.$emit('blur', e, _this16.triggerQuery);
2357
2681
  },
2358
2682
  keypress: function keypress(e) {
2359
- _this15.$emit('keyPress', e, _this15.triggerQuery);
2360
- _this15.$emit('key-press', e, _this15.triggerQuery);
2683
+ _this16.$emit('keyPress', e, _this16.triggerQuery);
2684
+ _this16.$emit('key-press', e, _this16.triggerQuery);
2361
2685
  },
2362
- input: _this15.onInputChange,
2686
+ input: _this16.onInputChange,
2363
2687
  focus: function focus(e) {
2364
- _this15.$emit('focus', e, _this15.triggerQuery);
2688
+ _this16.$emit('focus', e, _this16.triggerQuery);
2365
2689
  },
2366
- keydown: _this15.handleKeyDown,
2690
+ keydown: _this16.handleKeyDown,
2367
2691
  keyup: function keyup(e) {
2368
- _this15.$emit('keyUp', e, _this15.triggerQuery);
2369
- _this15.$emit('key-up', e, _this15.triggerQuery);
2692
+ _this16.$emit('keyUp', e, _this16.triggerQuery);
2693
+ _this16.$emit('key-up', e, _this16.triggerQuery);
2370
2694
  }
2371
2695
  }), {
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()];
2696
+ "searchBox": true,
2697
+ "class": getClassName$1(_this16.$props.innerClass, 'input') || '',
2698
+ "placeholder": _this16.$props.placeholder,
2699
+ "autofocus": _this16.$props.autoFocus,
2700
+ "value": _this16.$data.currentValue ? _this16.$data.currentValue : '',
2701
+ "iconPosition": _this16.$props.iconPosition,
2702
+ "showIcon": _this16.$props.showIcon,
2703
+ "showClear": _this16.$props.showClear,
2704
+ "ref": _this16.$props.innerRef,
2705
+ "themePreset": _this16.themePreset
2706
+ }), null)];
2707
+ }
2708
+ }), vue.createVNode(Input.Actions, null, {
2709
+ "default": function _default() {
2710
+ return [_this16.renderRightIcons(), _this16.renderInputAddonAfter(), _this16.renderEnterButtonElement()];
2382
2711
  }
2383
- }), _this15.renderInputAddonAfter(), _this15.renderEnterButtonElement()];
2712
+ })];
2384
2713
  }
2385
2714
  })])];
2386
2715
  }
@@ -2466,6 +2795,7 @@ SBConnected.install = function (Vue) {
2466
2795
  // Add componentType for SSR
2467
2796
  SBConnected.componentType = constants.componentTypes.searchBox;
2468
2797
 
2798
+ var _excluded$1 = ["_source"];
2469
2799
  function _isSlot$1(s) {
2470
2800
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
2471
2801
  }
@@ -2473,7 +2803,9 @@ var md$1 = new remarkable.Remarkable();
2473
2803
  md$1.set({
2474
2804
  html: true,
2475
2805
  breaks: true,
2476
- xhtmlOut: true
2806
+ xhtmlOut: true,
2807
+ linkify: true,
2808
+ linkTarget: '_blank'
2477
2809
  });
2478
2810
  var _inputWrapperRef = 'inputWrapperRef';
2479
2811
  var _inputRef = 'inputRef';
@@ -2486,7 +2818,10 @@ var AIAnswer = vue.defineComponent({
2486
2818
  messages: [],
2487
2819
  inputMessage: '',
2488
2820
  AISessionId: '',
2489
- error: null
2821
+ error: null,
2822
+ sourceDocIds: null,
2823
+ initialHits: null,
2824
+ isTriggered: false
2490
2825
  };
2491
2826
  this.internalComponent = props.componentId + "__internal";
2492
2827
  return this.__state;
@@ -2496,7 +2831,16 @@ var AIAnswer = vue.defineComponent({
2496
2831
  from: 'theme_reactivesearch'
2497
2832
  }
2498
2833
  },
2499
- created: function created() {},
2834
+ created: function created() {
2835
+ if (this.$props.triggerOn === constants.AI_TRIGGER_MODES.ALWAYS) {
2836
+ this.isTriggered = true;
2837
+ } else if (this.$props.triggerOn === constants.AI_TRIGGER_MODES.QUESTION && this.dependentComponentValue && this.dependentComponentValue.endsWith('?')) {
2838
+ this.isTriggered = true;
2839
+ if (this.AISessionId) {
2840
+ this.handleSendMessage(null, false, '', true);
2841
+ }
2842
+ }
2843
+ },
2500
2844
  computed: {
2501
2845
  hasCustomRenderer: function hasCustomRenderer() {
2502
2846
  return index.hasCustomRenderer(this);
@@ -2509,6 +2853,9 @@ var AIAnswer = vue.defineComponent({
2509
2853
  },
2510
2854
  errorMessageForMissingSessionId: function errorMessageForMissingSessionId() {
2511
2855
  return "AISessionId for " + this.$props.componentId + " is missing! AIAnswer component requires an AISessionId to function. Try reloading the App.";
2856
+ },
2857
+ hasTriggered: function hasTriggered() {
2858
+ return this.isTriggered;
2512
2859
  }
2513
2860
  },
2514
2861
  props: {
@@ -2547,13 +2894,26 @@ var AIAnswer = vue.defineComponent({
2547
2894
  sessionIdFromStore: VueTypes.string,
2548
2895
  showComponent: vueTypes.types.boolRequired,
2549
2896
  componentError: vueTypes.types.componentObject,
2550
- style: vueTypes.types.style
2897
+ style: vueTypes.types.style,
2898
+ showSourceDocuments: VueTypes.bool.def(false),
2899
+ renderSourceDocument: vueTypes.types.func,
2900
+ onSourceClick: vueTypes.types.func,
2901
+ isAITyping: vueTypes.types.boolRequired,
2902
+ triggerOn: VueTypes.string.def(constants.AI_TRIGGER_MODES.ALWAYS),
2903
+ renderTriggerMessage: vueTypes.types.func
2551
2904
  },
2552
2905
  mounted: function mounted() {},
2553
2906
  watch: {
2554
2907
  AIResponse: function AIResponse(newVal) {
2555
2908
  if (newVal) {
2556
- this.AISessionId = ((helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || null;
2909
+ if (this.$props.showSourceDocuments && newVal.response && newVal.response.answer && Array.isArray(newVal.response.answer.documentIds)) {
2910
+ this.sourceDocIds = newVal.response.answer.documentIds;
2911
+ var localCache = helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) && helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY)[this.$props.componentId];
2912
+ if (localCache && localCache.meta && localCache.meta.hits) {
2913
+ this.initialHits = localCache.meta.hits;
2914
+ }
2915
+ }
2916
+ this.AISessionId = ((helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || (((helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).response || {}).sessionId;
2557
2917
  var messagesHistory = newVal.messages,
2558
2918
  response = newVal.response;
2559
2919
  var finalMessages = [];
@@ -2564,7 +2924,7 @@ var AIAnswer = vue.defineComponent({
2564
2924
  }
2565
2925
 
2566
2926
  // pushing message history so far
2567
- if (messagesHistory && messagesHistory && Array.isArray(messagesHistory)) {
2927
+ if (messagesHistory && Array.isArray(messagesHistory)) {
2568
2928
  finalMessages.push.apply(finalMessages, messagesHistory.filter(function (msg) {
2569
2929
  return msg.role !== constants.AI_ROLES.SYSTEM;
2570
2930
  }));
@@ -2589,6 +2949,9 @@ var AIAnswer = vue.defineComponent({
2589
2949
  loading: this.$props.isAIResponseLoading || this.$props.isLoading,
2590
2950
  error: this.$props.AIResponseError
2591
2951
  });
2952
+ if (newVal && newVal.hits && newVal.hits.hits) {
2953
+ this.initialHits = newVal.hits.hits;
2954
+ }
2592
2955
  },
2593
2956
  isAIResponseLoading: function isAIResponseLoading(newVal) {
2594
2957
  this.$emit('on-data', {
@@ -2613,7 +2976,7 @@ var AIAnswer = vue.defineComponent({
2613
2976
  },
2614
2977
  AIResponseError: function AIResponseError(newVal) {
2615
2978
  this.error = newVal;
2616
- this.AISessionId = ((helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || null;
2979
+ this.AISessionId = ((helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || (((helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).response || {}).sessionId;
2617
2980
  if (this.error && !this.AISessionId) {
2618
2981
  var errorMessage = this.errorMessageForMissingSessionId;
2619
2982
  this.error = {
@@ -2634,7 +2997,7 @@ var AIAnswer = vue.defineComponent({
2634
2997
  componentError: function componentError(newVal) {
2635
2998
  var _this = this;
2636
2999
  if (newVal && newVal._bodyBlob) {
2637
- this.AISessionId = ((helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || null;
3000
+ this.AISessionId = ((helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || (((helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).response || {}).sessionId;
2638
3001
  if (!this.AISessionId) {
2639
3002
  this.generateNewSessionId();
2640
3003
  }
@@ -2657,23 +3020,154 @@ var AIAnswer = vue.defineComponent({
2657
3020
  console.error('Error reading component error text data:', error);
2658
3021
  });
2659
3022
  }
3023
+ },
3024
+ showComponent: function showComponent() {
3025
+ if (this.$props.triggerOn === constants.AI_TRIGGER_MODES.QUESTION && this.$props.dependentComponentValue.endsWith('?')) {
3026
+ this.isTriggered = true;
3027
+ }
3028
+ },
3029
+ dependentComponentValue: function dependentComponentValue(newVal) {
3030
+ if (this.$props.triggerOn === constants.AI_TRIGGER_MODES.QUESTION && newVal && newVal.endsWith('?')) {
3031
+ this.isTriggered = true;
3032
+ if (this.AISessionId) {
3033
+ this.handleSendMessage(null, false, '', true);
3034
+ }
3035
+ } else if (this.hasTriggered && this.$props.triggerOn !== constants.AI_TRIGGER_MODES.ALWAYS) {
3036
+ this.isTriggered = false;
3037
+ }
3038
+ },
3039
+ AISessionId: function AISessionId(newVal) {
3040
+ if (newVal) {
3041
+ if (this.$props.triggerOn === constants.AI_TRIGGER_MODES.QUESTION && this.dependentComponentValue && this.dependentComponentValue.endsWith('?') || this.$props.triggerOn === constants.AI_TRIGGER_MODES.ALWAYS) {
3042
+ this.handleSendMessage(null, false, '', true);
3043
+ }
3044
+ }
3045
+ },
3046
+ triggerOn: function triggerOn(newVal) {
3047
+ if (newVal === constants.AI_TRIGGER_MODES.ALWAYS) {
3048
+ this.isTriggered = true;
3049
+ }
2660
3050
  }
2661
3051
  },
2662
3052
  methods: {
2663
- generateNewSessionId: function generateNewSessionId() {
3053
+ renderTriggerMessageFunc: function renderTriggerMessageFunc() {
3054
+ var triggerOn = this.$props.triggerOn;
3055
+ if (this.$props.renderTriggerMessage) {
3056
+ return this.$props.renderTriggerMessage;
3057
+ }
3058
+ if (this.$slots.renderTriggerMessage) {
3059
+ return this.$slots.renderTriggerMessage();
3060
+ }
3061
+ if (triggerOn === constants.AI_TRIGGER_MODES.QUESTION) {
3062
+ if (!this.dependentComponentValue.endsWith('?')) {
3063
+ return vue.createVNode("span", null, [vue.createVNode("span", {
3064
+ "role": "img",
3065
+ "aria-label": "bulb"
3066
+ }, [vue.createTextVNode("\uD83D\uDCA1")]), vue.createTextVNode("End your question with a question mark (?)")]);
3067
+ }
3068
+ } else if (triggerOn === constants.AI_TRIGGER_MODES.MANUAL) {
3069
+ return vue.createVNode("span", null, [vue.createTextVNode("Click here to ask AI"), ' ', vue.createVNode("span", {
3070
+ "role": "img",
3071
+ "aria-label": "bulb"
3072
+ }, [vue.createTextVNode("\uD83E\uDD16")])]);
3073
+ }
3074
+ return null;
3075
+ },
3076
+ handleTriggerClick: function handleTriggerClick() {
3077
+ if (this.$props.triggerOn === constants.AI_TRIGGER_MODES.MANUAL) {
3078
+ this.handleSendMessage(null, false, '', true);
3079
+ this.isTriggered = true;
3080
+ }
3081
+ },
3082
+ getAISourceObjects: function getAISourceObjects() {
2664
3083
  var _this2 = this;
3084
+ var sourceObjects = [];
3085
+ if (!this.AIResponse) return sourceObjects;
3086
+ var docIds = this.sourceDocIds || [];
3087
+ if (this.initialHits) {
3088
+ docIds.forEach(function (id) {
3089
+ var foundSourceObj = _this2.initialHits.find(function (hit) {
3090
+ return hit._id === id;
3091
+ }) || {};
3092
+ if (foundSourceObj) {
3093
+ var _foundSourceObj$_sour = foundSourceObj._source,
3094
+ _source = _foundSourceObj$_sour === void 0 ? {} : _foundSourceObj$_sour,
3095
+ rest = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(foundSourceObj, _excluded$1);
3096
+ sourceObjects.push(_rollupPluginBabelHelpers._extends({}, rest, _source));
3097
+ }
3098
+ });
3099
+ } else {
3100
+ sourceObjects.push.apply(sourceObjects, docIds.map(function (id) {
3101
+ return {
3102
+ _id: id
3103
+ };
3104
+ }));
3105
+ }
3106
+ return sourceObjects;
3107
+ },
3108
+ renderAIScreenFooter: function renderAIScreenFooter() {
3109
+ var _slot2;
3110
+ var _this3 = this;
3111
+ var _ref = this.$props || {},
3112
+ _ref$showSourceDocume = _ref.showSourceDocuments,
3113
+ showSourceDocuments = _ref$showSourceDocume === void 0 ? true : _ref$showSourceDocume,
3114
+ _ref$onSourceClick = _ref.onSourceClick,
3115
+ onSourceClick = _ref$onSourceClick === void 0 ? function () {} : _ref$onSourceClick,
3116
+ renderSourceDocument = _ref.renderSourceDocument;
3117
+ var customRenderSourceDoc = renderSourceDocument || this.$slots.renderSourceDocument;
3118
+ if (this.isLoadingState || this.isAITyping) {
3119
+ return null;
3120
+ }
3121
+ var renderSourceDocumentLabel = function renderSourceDocumentLabel(sourceObj) {
3122
+ if (customRenderSourceDoc) {
3123
+ return customRenderSourceDoc(sourceObj);
3124
+ }
3125
+ return sourceObj._id;
3126
+ };
3127
+ return showSourceDocuments && Array.isArray(this.sourceDocIds) && this.sourceDocIds.length ? vue.createVNode(Footer, {
3128
+ "themePreset": this.$props.themePreset,
3129
+ "style": {
3130
+ marginTop: '1.5rem',
3131
+ background: 'inherit'
3132
+ }
3133
+ }, {
3134
+ "default": function _default() {
3135
+ return [vue.createTextVNode("Summary generated using the following sources:"), ' ', vue.createVNode(SourceTags, null, _isSlot$1(_slot2 = _this3.getAISourceObjects().map(function (el) {
3136
+ var _slot;
3137
+ return vue.createVNode(Button.Button, {
3138
+ "class": "--ai-source-tag " + (helper.getClassName(_this3.$props.innerClass, 'ai-source-tag') || ''),
3139
+ "info": true,
3140
+ "onClick": function onClick() {
3141
+ return onSourceClick && onSourceClick(el);
3142
+ },
3143
+ "key": el._id
3144
+ }, _isSlot$1(_slot = renderSourceDocumentLabel(el)) ? _slot : {
3145
+ "default": function _default() {
3146
+ return [_slot];
3147
+ }
3148
+ });
3149
+ })) ? _slot2 : {
3150
+ "default": function _default() {
3151
+ return [_slot2];
3152
+ }
3153
+ })];
3154
+ }
3155
+ }) : null;
3156
+ },
3157
+ generateNewSessionId: function generateNewSessionId() {
3158
+ var _this4 = this;
2665
3159
  var newSessionPromise = this.createAISession();
2666
3160
  newSessionPromise.then(function (res) {
2667
- _this2.AISessionId = res.AIsessionId;
3161
+ _this4.AISessionId = res.AIsessionId;
2668
3162
  })["catch"](function (e) {
2669
3163
  console.error(e);
2670
3164
  });
2671
3165
  },
2672
3166
  scrollToBottom: function scrollToBottom() {
2673
- var _this3 = this;
3167
+ var _this5 = this;
2674
3168
  this.$nextTick(function () {
2675
- var _this3$$refs;
2676
- var messageContainer = (_this3$$refs = _this3.$refs) == null ? void 0 : _this3$$refs[_this3.$props.innerRef];
3169
+ var _this5$$refs;
3170
+ var messageContainer = (_this5$$refs = _this5.$refs) == null ? void 0 : _this5$$refs[_this5.$props.innerRef];
2677
3171
  if (messageContainer && messageContainer.$el) {
2678
3172
  messageContainer.$el.scrollTo({
2679
3173
  top: messageContainer.$el.scrollHeight,
@@ -2686,24 +3180,33 @@ var AIAnswer = vue.defineComponent({
2686
3180
  this.inputMessage = e.target.value;
2687
3181
  this.handleTextAreaHeightChange();
2688
3182
  },
2689
- handleSendMessage: function handleSendMessage(e, isRetry, text) {
3183
+ handleSendMessage: function handleSendMessage(e, isRetry, text, fetchMeta) {
2690
3184
  if (isRetry === void 0) {
2691
3185
  isRetry = false;
2692
3186
  }
2693
3187
  if (text === void 0) {
2694
3188
  text = this.inputMessage;
2695
3189
  }
3190
+ if (fetchMeta === void 0) {
3191
+ fetchMeta = false;
3192
+ }
2696
3193
  if (typeof e === 'object' && e !== null) e.preventDefault();
2697
- if (text.trim()) {
3194
+ if (text.trim() || !text && !e) {
2698
3195
  if (this.isLoadingState) {
2699
3196
  return;
2700
3197
  }
2701
3198
  if (this.AISessionId) {
2702
- if (!isRetry) this.messages = [].concat(this.messages, [{
2703
- content: text,
2704
- role: constants.AI_ROLES.USER
2705
- }]);
2706
- this.getAIResponse(this.AISessionId, this.componentId, text);
3199
+ if (!isRetry) {
3200
+ var finalMessages = [].concat(this.messages);
3201
+ if (text) {
3202
+ finalMessages.push({
3203
+ content: text,
3204
+ role: constants.AI_ROLES.USER
3205
+ });
3206
+ }
3207
+ this.messages = [].concat(finalMessages);
3208
+ }
3209
+ this.getAIResponse(this.AISessionId, this.componentId, text, fetchMeta);
2707
3210
  } else {
2708
3211
  console.error(this.errorMessageForMissingSessionId);
2709
3212
  this.error = {
@@ -2752,7 +3255,6 @@ var AIAnswer = vue.defineComponent({
2752
3255
  return null;
2753
3256
  },
2754
3257
  handleKeyPress: function handleKeyPress(e) {
2755
- window.console.log('e', e);
2756
3258
  if (e.key === 'Enter') {
2757
3259
  this.handleSendMessage(e);
2758
3260
  this.inputMessage = '';
@@ -2784,15 +3286,15 @@ var AIAnswer = vue.defineComponent({
2784
3286
  if (typeof window === 'undefined') return false;
2785
3287
  return showVoiceSearch && (window.webkitSpeechRecognition || window.SpeechRecognition);
2786
3288
  },
2787
- handleVoiceResults: function handleVoiceResults(_ref) {
2788
- var results = _ref.results;
3289
+ handleVoiceResults: function handleVoiceResults(_ref2) {
3290
+ var results = _ref2.results;
2789
3291
  if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
2790
3292
  this.handleSendMessage(null, false, results[0][0].transcript.trim());
2791
3293
  }
2792
3294
  },
2793
3295
  renderIcons: function renderIcons() {
2794
- var _this4 = this;
2795
- var _slot, _slot2;
3296
+ var _this6 = this;
3297
+ var _slot3, _slot4;
2796
3298
  var _this$$props = this.$props,
2797
3299
  getMicInstance = _this$$props.getMicInstance,
2798
3300
  showVoiceInput = _this$$props.showVoiceInput,
@@ -2805,14 +3307,14 @@ var AIAnswer = vue.defineComponent({
2805
3307
  "positionType": "absolute"
2806
3308
  }, {
2807
3309
  "default": function _default() {
2808
- return [!_this4.isLoadingState && _this4.AISessionId && _this4.shouldMicRender(showVoiceInput) && vue.createVNode(Mic, {
3310
+ return [!_this6.isLoadingState && _this6.AISessionId && _this6.shouldMicRender(showVoiceInput) && vue.createVNode(Mic, {
2809
3311
  "getInstance": getMicInstance,
2810
3312
  "render": renderMic,
2811
- "handleResult": _this4.handleVoiceResults,
3313
+ "handleResult": _this6.handleVoiceResults,
2812
3314
  "class": helper.getClassName(innerClass, 'ai-search-mic') || null
2813
- }, null), iconPosition === 'right' && vue.createVNode(DropDown.IconWrapper, null, _isSlot$1(_slot = _this4.renderIcon()) ? _slot : {
3315
+ }, null), iconPosition === 'right' && vue.createVNode(DropDown.IconWrapper, null, _isSlot$1(_slot3 = _this6.renderIcon()) ? _slot3 : {
2814
3316
  "default": function _default() {
2815
- return [_slot];
3317
+ return [_slot3];
2816
3318
  }
2817
3319
  })];
2818
3320
  }
@@ -2822,9 +3324,9 @@ var AIAnswer = vue.defineComponent({
2822
3324
  "positionType": "absolute"
2823
3325
  }, {
2824
3326
  "default": function _default() {
2825
- return [iconPosition === 'left' && vue.createVNode(DropDown.IconWrapper, null, _isSlot$1(_slot2 = _this4.renderIcon()) ? _slot2 : {
3327
+ return [iconPosition === 'left' && vue.createVNode(DropDown.IconWrapper, null, _isSlot$1(_slot4 = _this6.renderIcon()) ? _slot4 : {
2826
3328
  "default": function _default() {
2827
- return [_slot2];
3329
+ return [_slot4];
2828
3330
  }
2829
3331
  })];
2830
3332
  }
@@ -2834,7 +3336,7 @@ var AIAnswer = vue.defineComponent({
2834
3336
  this.handleSendMessage(e);
2835
3337
  },
2836
3338
  renderEnterButtonElement: function renderEnterButtonElement() {
2837
- var _this5 = this;
3339
+ var _this7 = this;
2838
3340
  var _this$$props2 = this.$props,
2839
3341
  enterButton = _this$$props2.enterButton,
2840
3342
  innerClass = _this$$props2.innerClass;
@@ -2842,16 +3344,16 @@ var AIAnswer = vue.defineComponent({
2842
3344
  if (enterButton) {
2843
3345
  var getEnterButtonMarkup = function getEnterButtonMarkup() {
2844
3346
  if (renderEnterButton) {
2845
- return renderEnterButton(_this5.enterButtonOnClick);
3347
+ return renderEnterButton(_this7.enterButtonOnClick);
2846
3348
  }
2847
3349
  return vue.createVNode(SendButton, {
2848
3350
  "primary": true,
2849
3351
  "type": "submit",
2850
3352
  "tabIndex": 0,
2851
- "onClick": _this5.handleSendMessage,
2852
- "onKeyPress": _this5.handleKeyPress,
3353
+ "onClick": _this7.handleSendMessage,
3354
+ "onKeyPress": _this7.handleKeyPress,
2853
3355
  "class": "ask-btn " + helper.getClassName(innerClass, 'ai-enter-button'),
2854
- "disabled": _this5.isLoadingState || !_this5.AISessionId
3356
+ "disabled": _this7.isLoadingState || !_this7.AISessionId
2855
3357
  }, {
2856
3358
  "default": function _default() {
2857
3359
  return [vue.createTextVNode("Send")];
@@ -2874,9 +3376,9 @@ var AIAnswer = vue.defineComponent({
2874
3376
  return index.getComponent(data, this);
2875
3377
  },
2876
3378
  handleTextAreaHeightChange: function handleTextAreaHeightChange() {
2877
- var _this$$refs, _this$$refs$_inputRef, _this$$refs2, _this$$refs2$_inputWr, _this$$refs3;
2878
- var textArea = (_this$$refs = this.$refs) == null ? void 0 : (_this$$refs$_inputRef = _this$$refs[_inputRef]) == null ? void 0 : _this$$refs$_inputRef.$el;
2879
- var inputWrapper = (_this$$refs2 = this.$refs) == null ? void 0 : (_this$$refs2$_inputWr = _this$$refs2[_inputWrapperRef]) == null ? void 0 : _this$$refs2$_inputWr.$el;
3379
+ var _this$$refs, _this$$refs2, _this$$refs3;
3380
+ var textArea = (_this$$refs = this.$refs) == null || (_this$$refs = _this$$refs[_inputRef]) == null ? void 0 : _this$$refs.$el;
3381
+ var inputWrapper = (_this$$refs2 = this.$refs) == null || (_this$$refs2 = _this$$refs2[_inputWrapperRef]) == null ? void 0 : _this$$refs2.$el;
2880
3382
  var errorContainer = (_this$$refs3 = this.$refs) == null ? void 0 : _this$$refs3[_errorContainerRef];
2881
3383
  if (textArea) {
2882
3384
  textArea.style.height = '42px';
@@ -2894,6 +3396,20 @@ var AIAnswer = vue.defineComponent({
2894
3396
  }
2895
3397
  this.$forceUpdate();
2896
3398
  }
3399
+ },
3400
+ getTitle: function getTitle() {
3401
+ var _this8 = this;
3402
+ var hasTitle = this.$props.title || this.$slots.title || null;
3403
+ if (hasTitle) {
3404
+ return vue.createVNode(Title.Title, {
3405
+ "class": helper.getClassName(this.$props.innerClass, 'ai-title') || null
3406
+ }, {
3407
+ "default": function _default() {
3408
+ return [_this8.$props.title || _this8.$slots.title()];
3409
+ }
3410
+ });
3411
+ }
3412
+ return null;
2897
3413
  }
2898
3414
  },
2899
3415
  beforeUnmount: function beforeUnmount() {
@@ -2908,55 +3424,62 @@ var AIAnswer = vue.defineComponent({
2908
3424
  }
2909
3425
  },
2910
3426
  render: function render() {
2911
- var _slot3;
2912
- var _this6 = this;
3427
+ var _slot5;
3428
+ var _this9 = this;
2913
3429
  var props = this.$props;
2914
3430
  if (!this.shouldShowComponent) {
2915
3431
  return null;
2916
3432
  }
3433
+ if (!this.isTriggered) {
3434
+ return vue.createVNode(Chatbox, {
3435
+ "style": props.style || {}
3436
+ }, {
3437
+ "default": function _default() {
3438
+ return [_this9.getTitle(), vue.createVNode("div", {
3439
+ "class": "--trigger-message-wrapper",
3440
+ "onClick": _this9.handleTriggerClick,
3441
+ "aria-hidden": "true"
3442
+ }, [_this9.renderTriggerMessageFunc()])];
3443
+ }
3444
+ });
3445
+ }
2917
3446
  return vue.createVNode(Chatbox, {
2918
3447
  "style": props.style || {}
2919
3448
  }, {
2920
3449
  "default": function _default() {
2921
- return [_this6.$props.title && vue.createVNode(Title.Title, {
2922
- "class": helper.getClassName(_this6.$props.innerClass, 'title') || ''
2923
- }, {
2924
- "default": function _default() {
2925
- return [_this6.$props.title];
2926
- }
2927
- }), vue.createVNode(ChatContainer, {
3450
+ return [_this9.getTitle(), vue.createVNode(ChatContainer, {
2928
3451
  "class": "--ai-chat-container",
2929
3452
  "theme": props.theme,
2930
3453
  "showInput": props.showInput
2931
3454
  }, {
2932
3455
  "default": function _default() {
2933
- return [_this6.hasCustomRenderer && vue.createVNode(MessagesContainer, {
2934
- "themePreset": _this6.themePreset,
3456
+ return [_this9.hasCustomRenderer && vue.createVNode(MessagesContainer, {
3457
+ "themePreset": _this9.themePreset,
2935
3458
  "theme": props.theme,
2936
- "ref": _this6.$props.innerRef,
3459
+ "ref": _this9.$props.innerRef,
2937
3460
  "class": "--ai-message-container " + (helper.getClassName(props.innerClass, 'ai-message-container') || '')
2938
- }, _isSlot$1(_slot3 = _this6.getComponent()) ? _slot3 : {
3461
+ }, _isSlot$1(_slot5 = _this9.getComponent()) ? _slot5 : {
2939
3462
  "default": function _default() {
2940
- return [_slot3];
3463
+ return [_slot5];
2941
3464
  }
2942
- }), !_this6.hasCustomRenderer && vue.createVNode(MessagesContainer, {
2943
- "themePreset": _this6.themePreset,
3465
+ }), !_this9.hasCustomRenderer && vue.createVNode(MessagesContainer, {
3466
+ "themePreset": _this9.themePreset,
2944
3467
  "theme": props.theme,
2945
- "ref": _this6.$props.innerRef,
3468
+ "ref": _this9.$props.innerRef,
2946
3469
  "class": "--ai-message-container " + (helper.getClassName(props.innerClass, 'ai-message-container') || '')
2947
3470
  }, {
2948
3471
  "default": function _default() {
2949
- return [_this6.messages.map(function (message, index) {
3472
+ return [_this9.messages.map(function (message, index) {
2950
3473
  return vue.createVNode(Message, {
2951
3474
  "key": index,
2952
3475
  "isSender": message.role === constants.AI_ROLES.USER,
2953
3476
  "innerHTML": md$1.render(message.content),
2954
- "themePreset": _this6.themePreset,
3477
+ "themePreset": _this9.themePreset,
2955
3478
  "theme": props.theme,
2956
3479
  "class": "--ai-answer-message " + (helper.getClassName(props.innerClass, 'ai-message') || '')
2957
3480
  }, null);
2958
- }), _this6.isLoadingState && vue.createVNode(Message, {
2959
- "themePreset": _this6.themePreset,
3481
+ }), _this9.isLoadingState && vue.createVNode(Message, {
3482
+ "themePreset": _this9.themePreset,
2960
3483
  "theme": props.theme,
2961
3484
  "isSender": false,
2962
3485
  "class": "--ai-answer-message " + (helper.getClassName(props.innerClass, 'ai-message') || null)
@@ -2965,31 +3488,31 @@ var AIAnswer = vue.defineComponent({
2965
3488
  return [vue.createVNode(TypingIndicator, null, {
2966
3489
  "default": function _default() {
2967
3490
  return [vue.createVNode(TypingDot, {
2968
- "themePreset": _this6.themePreset
3491
+ "themePreset": _this9.themePreset
2969
3492
  }, null), vue.createVNode(TypingDot, {
2970
- "themePreset": _this6.themePreset
3493
+ "themePreset": _this9.themePreset
2971
3494
  }, null), vue.createVNode(TypingDot, {
2972
- "themePreset": _this6.themePreset
3495
+ "themePreset": _this9.themePreset
2973
3496
  }, null)];
2974
3497
  }
2975
3498
  })];
2976
3499
  }
2977
3500
  })];
2978
3501
  }
2979
- }), _this6.renderErrorComponent(), ' ', props.showFeedback && vue.createVNode("div", {
3502
+ }), _this9.renderErrorComponent(), ' ', props.showFeedback && !_this9.isLoadingState && !_this9.isAITyping && vue.createVNode("div", {
2980
3503
  "class": "--ai-answer-feedback-container " + (helper.getClassName(props.innerClass, 'ai-feedback') || '')
2981
3504
  }, [vue.createVNode(AIFeedback, {
2982
- "hideUI": _this6.isLoadingState || !_this6.sessionId,
2983
- "key": _this6.sessionId,
3505
+ "hideUI": _this9.isLoadingState || !_this9.sessionId,
3506
+ "key": _this9.sessionId,
2984
3507
  "onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
2985
- _this6.trackUsefullness(_this6.sessionId, {
3508
+ _this9.trackUsefullness(_this9.sessionId, {
2986
3509
  useful: useful,
2987
3510
  reason: reason
2988
3511
  });
2989
3512
  }
2990
- }, null)]), props.showInput && vue.createVNode(MessageInputContainer, {
3513
+ }, null)]), ' ', _this9.renderAIScreenFooter(), props.showInput && !_this9.isLoadingState && !_this9.isAITyping && vue.createVNode(MessageInputContainer, {
2991
3514
  "class": "--ai-input-container",
2992
- "onSubmit": _this6.handleSendMessage
3515
+ "onSubmit": _this9.handleSendMessage
2993
3516
  }, {
2994
3517
  "default": function _default() {
2995
3518
  return [vue.createVNode(InputGroup, {
@@ -3005,19 +3528,19 @@ var AIAnswer = vue.defineComponent({
3005
3528
  "ref": _inputRef,
3006
3529
  "placeholder": props.placeholder,
3007
3530
  "enterButton": props.enterButton,
3008
- "value": _this6.inputMessage,
3009
- "onInput": _this6.handleMessageInputChange,
3531
+ "value": _this9.inputMessage,
3532
+ "onInput": _this9.handleMessageInputChange,
3010
3533
  "id": props.componentId + "-ai-input",
3011
3534
  "showIcon": props.showIcon,
3012
3535
  "iconPosition": props.iconPosition,
3013
- "themePreset": _this6.themePreset,
3014
- "disabled": _this6.isLoadingState || !_this6.AISessionId,
3536
+ "themePreset": _this9.themePreset,
3537
+ "disabled": _this9.isLoadingState || !_this9.AISessionId,
3015
3538
  "class": helper.getClassName(props.innerClass, 'ai-input') || null
3016
- }, null), ' ', _this6.renderIcons()];
3539
+ }, null), ' ', _this9.renderIcons()];
3017
3540
  }
3018
3541
  })];
3019
3542
  }
3020
- }), _this6.renderEnterButtonElement()];
3543
+ }), _this9.renderEnterButtonElement()];
3021
3544
  }
3022
3545
  }), ' '];
3023
3546
  }
@@ -3035,9 +3558,11 @@ var mapStateToProps$1 = function mapStateToProps(state, props) {
3035
3558
  // eslint-disable-next-line prefer-destructuring
3036
3559
  dependencyComponent = dependencyComponent[0];
3037
3560
  }
3038
- var showComponent = state.selectedValues[dependencyComponent] && state.selectedValues[dependencyComponent].value;
3561
+ var showComponent = !!(state.selectedValues[dependencyComponent] && state.selectedValues[dependencyComponent].value);
3562
+ var dependentComponentValue = state.selectedValues[dependencyComponent] && state.selectedValues[dependencyComponent].value || '';
3039
3563
  return {
3040
3564
  showComponent: showComponent,
3565
+ dependentComponentValue: dependentComponentValue,
3041
3566
  AIResponse: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response,
3042
3567
  isAIResponseLoading: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].isLoading,
3043
3568
  AIResponseError: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].error,
@@ -3045,11 +3570,17 @@ var mapStateToProps$1 = function mapStateToProps(state, props) {
3045
3570
  themePreset: state.config.themePreset,
3046
3571
  isLoading: state.isLoading[props.componentId] || false,
3047
3572
  sessionIdFromStore: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.sessionId || '',
3048
- componentError: state.error[props.componentId]
3573
+ componentError: state.error[props.componentId] || null,
3574
+ isAITyping: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.isTyping || false
3049
3575
  };
3050
3576
  };
3051
3577
  var mapDispatchToProps$1 = {
3052
- getAIResponse: query.fetchAIResponse,
3578
+ getAIResponse: function getAIResponse(sessionId, componentId, message, shouldFetchMeta) {
3579
+ if (shouldFetchMeta === void 0) {
3580
+ shouldFetchMeta = false;
3581
+ }
3582
+ return query.fetchAIResponse(sessionId, componentId, message, null, shouldFetchMeta);
3583
+ },
3053
3584
  trackUsefullness: analytics.recordAISessionUsefulness,
3054
3585
  createAISession: query.createAISession
3055
3586
  };
@@ -3065,8 +3596,8 @@ AIConnected.install = function (Vue) {
3065
3596
  // Add componentType for SSR
3066
3597
  AIConnected.componentType = constants.componentTypes.AIAnswer;
3067
3598
 
3068
- var _templateObject$8, _templateObject2$4;
3069
- var HierarchicalMenuList = vueEmotion.styled('ul')(_templateObject$8 || (_templateObject$8 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tlist-style: none;\n\tpadding: 0;\n\tmargin: 0;\n\tmax-height: 0;\n\toverflow: hidden;\n\n\t&.--open {\n\t\tmax-height: 100%;\n\t}\n"])));
3599
+ var _templateObject$9, _templateObject2$4;
3600
+ 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"])));
3070
3601
  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) {
3071
3602
  return !props.showLine && "\n\t\t\t\t\tdisplay: none;\n\t\t\t\t";
3072
3603
  });