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

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 +4885 -705
  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-5d1a97a5.js} +833 -287
  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-01aaa4e0.js} +835 -289
  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
@@ -1,29 +1,30 @@
1
1
  import { helper, Actions, causes } from '@appbaseio/reactivecore';
2
- import { SEARCH_COMPONENTS_MODES, componentTypes, AI_LOCAL_CACHE_KEY, AI_ROLES, TREELIST_VALUES_PATH_SEPARATOR } from '@appbaseio/reactivecore/lib/utils/constants';
2
+ import { SEARCH_COMPONENTS_MODES, AI_TRIGGER_MODES, AI_LOCAL_CACHE_KEY, componentTypes, AI_ROLES, TREELIST_VALUES_PATH_SEPARATOR } from '@appbaseio/reactivecore/lib/utils/constants';
3
3
  import _transformOn from '@vue/babel-helper-vue-transform-on';
4
4
  import { _ as _taggedTemplateLiteralLoose, a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-ded08042.js';
5
5
  import { createVNode, createTextVNode, defineComponent, ref, watch, isVNode, mergeProps, h } from 'vue';
6
6
  import VueTypes from 'vue-types';
7
- import { getQueryOptions, getObjectFromLocalStorage, suggestionTypes, getClassName as getClassName$2, setObjectInLocalStorage, recLookup, updateCustomQuery as updateCustomQuery$1, updateDefaultQuery as updateDefaultQuery$1, transformTreeListLocalStateIntoQueryComptaibleFormat, isEqual as isEqual$1, transformRawTreeListData, setDeep, getComponent as getComponent$1, getOptionsFromQuery, checkValueChange as checkValueChange$1, getAggsQuery, updateInternalQuery, isFunction as isFunction$1 } from '@appbaseio/reactivecore/lib/utils/helper';
7
+ import { getObjectFromLocalStorage, getQueryOptions, featuredSuggestionsActionTypes, suggestionTypes, getClassName as getClassName$2, setObjectInLocalStorage, recLookup, updateCustomQuery as updateCustomQuery$1, updateDefaultQuery as updateDefaultQuery$1, transformTreeListLocalStateIntoQueryComptaibleFormat, isEqual as isEqual$1, transformRawTreeListData, setDeep, getComponent as getComponent$1, getOptionsFromQuery, checkValueChange as checkValueChange$1, getAggsQuery, updateInternalQuery, isFunction as isFunction$1 } from '@appbaseio/reactivecore/lib/utils/helper';
8
8
  import { styled } from '@appbaseio/vue-emotion';
9
9
  import { css, keyframes } from '@emotion/css';
10
10
  import { lighten } from 'polished';
11
11
  import { B as Button } from './Button-5c2cf399.js';
12
- import { t as types } from './vueTypes-09cab4d3.js';
12
+ import { t as types } from './vueTypes-f503e267.js';
13
13
  import { RLConnected as ReactiveList } from './ReactiveList.js';
14
14
  import { getInternalComponentID } from '@appbaseio/reactivecore/lib/utils/transform';
15
- import { g as getComponent, h as hasCustomRenderer, f as decodeHtml, i as isQueryIdentical, u as updateDefaultQuery, j as updateCustomQuery, a as isFunction, k as isEmpty, p as parseFocusShortcuts, l as extractModifierKeysFromFocusShortcuts, c as connect } from './index-882489e1.js';
16
- import { C as ComponentWrapper } from './ComponentWrapper-a2635cfc.js';
17
- import { P as PreferencesConsumer } from './PreferencesConsumer-b058d14e.js';
15
+ import { g as getComponent, h as hasCustomRenderer, f as decodeHtml, i as isQueryIdentical, u as updateDefaultQuery, j as updateCustomQuery, a as isFunction, k as isEmpty, p as parseFocusShortcuts, l as extractModifierKeysFromFocusShortcuts, c as connect } from './index-104f1dfb.js';
16
+ import { C as ComponentWrapper } from './ComponentWrapper-46d04344.js';
17
+ import { P as PreferencesConsumer } from './PreferencesConsumer-0856ed43.js';
18
18
  import { T as Title } from './Title-863dfa42.js';
19
19
  import { L as ListItem } from './ListItem-e3c6acf4.js';
20
20
  import { F as Flex } from './Flex-25792bc3.js';
21
21
  import { recordAISessionUsefulness } from '@appbaseio/reactivecore/lib/actions/analytics';
22
22
  import ReactiveBase from './ReactiveBase.js';
23
23
  import hotkeys from 'hotkeys-js';
24
+ import xss from 'xss';
24
25
  import { Remarkable } from 'remarkable';
25
- import { I as IconWrapper, C as CancelSvg, a as IconGroup, D as Downshift, b as InputWrapper } from './DropDown-39fedff8.js';
26
- import { n as noSuggestions, T as TextArea, I as Input, s as suggestionsContainer, a as suggestions } from './Input-11d211d2.js';
26
+ import { I as IconWrapper, C as CancelSvg, a as IconGroup, B as ButtonIconWrapper, D as Downshift, b as InputWrapper } from './DropDown-48045fde.js';
27
+ import { n as noSuggestions, T as TextArea, I as Input, s as suggestionsContainer, A as Actions$1, a as suggestions, b as searchboxSuggestions } from './Input-83dee8c5.js';
27
28
  import { C as Container } from './Container-d00219f7.js';
28
29
  import Highlight from 'vue-highlight-words';
29
30
  import { fetchAIResponse, createAISession } from '@appbaseio/reactivecore/lib/actions/query';
@@ -48,7 +49,13 @@ import ResultList from './ResultList.js';
48
49
  import StateProvider from './StateProvider.js';
49
50
 
50
51
  var _templateObject;
51
- var InputGroup = styled('div')(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: stretch;\n\twidth: 100%;\n"])));
52
+ var InputGroup = styled('div')(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n \tdisplay: flex;\n\talign-items: stretch;\n\twidth: 100%;\n\tbox-shadow: rgb(0 0 0 / 20%) 0px 0px 6px;\n\tborder-radius: 6px;\n\n\t", "\n\t", "\n\t};\n"])), function (_ref) {
53
+ var theme = _ref.theme,
54
+ searchBox = _ref.searchBox;
55
+ return searchBox && "background-color: " + (theme.colors.backgroundColor || '#fafafa') + ";\n\t\tcolor: " + (theme.colors.textColor || '#fff') + ";\n\n\t\t&:focus-within {\n\t\t\tbackground-color: " + (theme.colors.backgroundColor || '#fff') + ";\n\t\t}";
56
+ }, function (props) {
57
+ return props.isOpen && "box-shadow: rgb(0 0 0 / 20%) 0px 0px 15px;\n\t\tborder-bottom-left-radius: 0;\n\t\t\tborder-bottom-right-radius: 0;";
58
+ });
52
59
  InputGroup.defaultProps = {
53
60
  className: 'input-group'
54
61
  };
@@ -778,8 +785,11 @@ var _templateObject$4, _templateObject2;
778
785
  var TagsContainer = styled('div')(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tmargin-top: 10px;\n\twidth: 100%;\n"])));
779
786
  var TagItem = styled('span')(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n\tcursor: default;\n\tbox-sizing: border-box;\n\tmargin: 0 4px 4px 0;\n\tcolor: #000000d9;\n\tfont-size: 14px;\n\tfont-variant: tabular-nums;\n\tline-height: 1.5715;\n\tlist-style: none;\n\tfont-feature-settings: 'tnum';\n\tdisplay: inline-block;\n\theight: auto;\n\tpadding: 0 2px 0 7px;\n\tfont-size: 12px;\n\tline-height: 22px;\n\twhite-space: nowrap;\n\tbackground: #fafafa;\n\tborder: 1px solid #d9d9d9;\n\tborder-radius: 2px;\n\topacity: 1;\n\ttransition: all 0.3s;\n\n\tspan.close-icon {\n\t\tsvg {\n\t\t\tcursor: pointer;\n\t\t\theight: 15px;\n\t\t\tposition: relative;\n\t\t\ttop: 4px;\n\t\t\tfill: #262626;\n\t\t}\n\t}\n"])));
780
787
 
781
- var _templateObject$5, _templateObject2$1, _templateObject3;
782
- var skeletonAnimation = keyframes(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteralLoose(["\n 0% {\n background-position: 100% 0;\n }\n 100% {\n background-position: -200% 0;\n }\n"])));
788
+ var _templateObject$5;
789
+ var AutosuggestFooterContainer = styled('div')(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tcolor: #8792a2;\n\tbackground: #f7fafc;\n\tpadding: 10px;\n\theight: 40px;\n"])));
790
+
791
+ var _templateObject$6, _templateObject2$1, _templateObject3;
792
+ var skeletonAnimation = keyframes(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteralLoose(["\n 0% {\n background-position: 100% 0;\n }\n 100% {\n background-position: -200% 0;\n }\n"])));
783
793
  var SkeletonLoader = styled('div')(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n"])));
784
794
  var SkeletonLine = styled('div')(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\theight: 20px;\n\tbackground: linear-gradient(\n\t\t90deg,\n\t\trgba(220, 220, 220, 0.5) 25%,\n\t\trgba(240, 240, 240, 0.9) 50%,\n\t\trgba(220, 220, 220, 0.5) 75%\n\t);\n\tbackground-size: 200% 100%;\n\tanimation: ", " 1.5s infinite;\n"])), skeletonAnimation);
785
795
  var HorizontalSkeletonLoader = defineComponent({
@@ -793,9 +803,9 @@ var HorizontalSkeletonLoader = defineComponent({
793
803
  }
794
804
  });
795
805
 
796
- var _templateObject$6, _templateObject2$2, _templateObject3$1, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
797
- var Chatbox = styled('div')(_templateObject$6 || (_templateObject$6 = _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) {
798
- return props.theme && props.theme.colors ? props.theme.colors.backgroundColor : '#fff';
806
+ var _templateObject$7, _templateObject2$2, _templateObject3$1, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
807
+ var Chatbox = styled('div')(_templateObject$7 || (_templateObject$7 = _taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tmargin: 0 auto;\n\tpadding: 10px;\n\tbackground-color: #fafafa;\n\twidth: 100%;\n\tbox-shadow: rgb(0 0 0 / 20%) 0px 0px 6px;\n\tborder-radius: 6px;\n\tmargin-bottom: 20px;\n\tbackground-color: ", ";\n\n\t.--trigger-message-wrapper {\n\t\tcursor: pointer;\n\t}\n"])), function (props) {
808
+ return props.theme && props.theme.colors ? lighten(0.1, props.theme.colors.backgroundColor) : '#fff';
799
809
  });
800
810
  var ChatContainer = styled('div')(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\theight: 100%;\n\tposition: relative;\n\t.--ai-answer-error-container {\n\t\ttext-align: center;\n\t\tposition: absolute;\n\t\tbottom: 0px;\n\t\t", ";\n\t\tz-index: 1;\n\t\tleft: 50%;\n\t\ttransform: translateX(-50%);\n\t\twidth: 100%;\n\n\t\t.--default-error-element {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\talign-items: center;\n\t\t\tpadding: 10px;\n\t\t\tbackground-color: ", ";\n\t\t\tbox-shadow: 0 -5px 5px -2px\n\t\t\t\t", ";\n\n\t\t\tspan {\n\t\t\t\tmargin-bottom: 5px;\n\t\t\t}\n\n\t\t\tbutton {\n\t\t\t}\n\t\t}\n\t}\n\n\t", ";\n"])), function (props) {
801
811
  return props.showInput ? 'bottom: 48px;' : '';
@@ -819,11 +829,15 @@ var TypingDot = styled('div')(_templateObject6 || (_templateObject6 = _taggedTem
819
829
  return finalColor;
820
830
  }, typingDots);
821
831
  var resetCSS = function resetCSS(props) {
822
- 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: " + (
832
+ 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: " + (
833
+ // eslint-disable-next-line no-nested-ternary
834
+ 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: " + (
835
+ // eslint-disable-next-line no-nested-ternary
836
+ 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: " + (
823
837
  // eslint-disable-next-line no-nested-ternary
824
- 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: " + (
838
+ 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: " + (
825
839
  // eslint-disable-next-line no-nested-ternary
826
- 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";
840
+ props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor : props.theme.colors.primaryTextColor) + ";\n\t\ttext-shadow: none;\n\t}\n\n\tul,\n\tol {\n\t\tlist-style-position: inside;\n\t\tpadding-left: 10px;\n\n\t}\n\n\tli{\n\t\tdisplay: list-item;\n\t\tcursor: default;\n\t\tpadding: initial;\n\n\t\t&:hover{\n\t\t\tbackground-color: initial;\n\t\t}\n\t}\n\tp {\n\t\tmargin: inherit;\n\t}\n\n\t" + (props.themePreset === 'dark' && "a{\n\t\tcolor: cornflowerblue\n\t\t}") + ";\n";
827
841
  };
828
842
  var messageBGColor = function messageBGColor(props) {
829
843
  var finalBGColor;
@@ -852,7 +866,7 @@ var Message = styled('div')(_templateObject7 || (_templateObject7 = _taggedTempl
852
866
  return resetCSS(props);
853
867
  });
854
868
  var MessageInputContainer = styled('form')(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tpadding-top: 12px;\n\talign-items: stretch;\n\tmargin-top: 10px;\n\t.ai-enter-button-wrapper {\n\t\talign-self: baseline;\n\t\theight: 41px;\n\t}\n"])));
855
- var MessageInput = styled(TextArea)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tborder-radius: 5px;\n\tborder: 1px solid #ccc;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\n\t::placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t:-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t::-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n\t", "\n"])), function (props) {
869
+ var MessageInput = styled(TextArea)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tborder-radius: 5px;\n\tborder: 1px solid #ccc;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\n\t::placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t:-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t::-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n\t", "\n\tpadding-left: 35px;\n"])), function (props) {
856
870
  return props.themePreset === 'dark' ? props.theme.colors.borderColor : '#fff';
857
871
  }, function (props) {
858
872
  return props.themePreset === 'dark' ? props.theme.colors.titleColor : props.theme.colors.textColor;
@@ -869,8 +883,8 @@ var MessageInput = styled(TextArea)(_templateObject9 || (_templateObject9 = _tag
869
883
  var SendButton = styled(Button)(_templateObject10 || (_templateObject10 = _taggedTemplateLiteralLoose(["\n\tborder: none;\n\tcolor: #ffffff;\n\tcursor: pointer;\n\tfont-size: 16px;\n\tmargin-left: 8px;\n\toutline: none;\n\tpadding: 10px;\n\ttext-align: center;\n\n\t&:disabled {\n\t\tcursor: not-allowed;\n\t}\n"])));
870
884
  var AIFeedbackContainer = styled('div')(_templateObject11 || (_templateObject11 = _taggedTemplateLiteralLoose(["\n\t.--feedback-svgs-wrapper {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: flex-end;\n\t\tgap: 5px;\n\n\t\tsvg {\n\t\t\tcursor: pointer;\n\t\t\ttransition: all ease-in 0.1s;\n\t\t\t&.selected {\n\t\t\t\ttransform: scale(1.1);\n\t\t\t\tcursor: default;\n\t\t\t}\n\n\t\t\t&:hover {\n\t\t\t\ttransform: scale(1.1);\n\t\t\t}\n\t\t}\n\t}\n\n\t.--feedback-input-wrapper {\n\t\tdisplay: flex;\n\t\tgap: 7px;\n\t}\n"])));
871
885
 
872
- var _templateObject$7, _templateObject2$3, _templateObject3$2, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7$1;
873
- var fadeInFromBottom = keyframes(_templateObject$7 || (_templateObject$7 = _taggedTemplateLiteralLoose(["\n 0% {\n opacity: 0;\n transform: translateY(20px);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n"])));
886
+ var _templateObject$8, _templateObject2$3, _templateObject3$2, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7$1;
887
+ var fadeInFromBottom = keyframes(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteralLoose(["\n 0% {\n opacity: 0;\n transform: translateY(20px);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n"])));
874
888
  var fadeInFromTop = keyframes(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteralLoose(["\n 0% {\n opacity: 0;\n transform: translateY(-20px);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n"])));
875
889
  var SearchBoxAISection = styled('div')(_templateObject3$2 || (_templateObject3$2 = _taggedTemplateLiteralLoose(["\n\tpadding: 10px;\n\tborder-radius: 4px;\n\tmin-height: 200px;\n\tpadding-top: 20px;\n\tposition: relative;\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\t.--ai-answer-error-container {\n\t\tposition: absolute;\n\t\ttop: 50%;\n\t\tleft: 50%;\n\t\ttransform: translate(-50%, -50%);\n\t\t.--default-error-element {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\talign-items: center;\n\t\t\tgap: 10px;\n\t\t}\n\t}\n"])), function (_ref) {
876
890
  var themePreset = _ref.themePreset,
@@ -1074,7 +1088,9 @@ var md = new Remarkable();
1074
1088
  md.set({
1075
1089
  html: true,
1076
1090
  breaks: true,
1077
- xhtmlOut: true
1091
+ xhtmlOut: true,
1092
+ linkify: true,
1093
+ linkTarget: '_blank'
1078
1094
  });
1079
1095
  var _dropdownULRef = 'dropdownULRef';
1080
1096
  var _inputGroupRef = 'inputGroupRef';
@@ -1102,7 +1118,10 @@ var SearchBox = defineComponent({
1102
1118
  showAIScreen: false,
1103
1119
  showAIScreenFooter: false,
1104
1120
  showFeedbackComponent: false,
1105
- feedbackState: null
1121
+ feedbackState: null,
1122
+ faqAnswer: '',
1123
+ faqQuestion: '',
1124
+ initialHits: null
1106
1125
  };
1107
1126
  this.internalComponent = props.componentId + "__internal";
1108
1127
  return this.__state;
@@ -1138,11 +1157,55 @@ var SearchBox = defineComponent({
1138
1157
  }
1139
1158
  },
1140
1159
  computed: {
1160
+ currentTriggerMode: function currentTriggerMode() {
1161
+ return this.$props.AIUIConfig && this.$props.AIUIConfig.triggerOn || AI_TRIGGER_MODES.MANUAL;
1162
+ },
1141
1163
  hasCustomRenderer: function hasCustomRenderer$1() {
1142
1164
  return hasCustomRenderer(this);
1143
1165
  },
1144
1166
  stats: function stats() {
1145
1167
  return getResultStats(this);
1168
+ },
1169
+ mergedAIQuestion: function mergedAIQuestion() {
1170
+ return this.faqQuestion || this.AIResponse && this.AIResponse.response && this.AIResponse.response.question;
1171
+ },
1172
+ mergedAIAnswer: function mergedAIAnswer() {
1173
+ return this.faqAnswer || this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text;
1174
+ },
1175
+ parsedSuggestions: function parsedSuggestions() {
1176
+ var suggestionsArray = [];
1177
+ if (Array.isArray(this.suggestions) && this.suggestions.length) {
1178
+ suggestionsArray = [].concat(withClickIds(this.suggestions));
1179
+ }
1180
+ if (this.renderTriggerMessage() && this.currentValue) {
1181
+ suggestionsArray.unshift({
1182
+ label: this.renderTriggerMessage(),
1183
+ value: 'AI_TRIGGER_MESSAGE',
1184
+ _suggestion_type: '_internal_a_i_trigger'
1185
+ });
1186
+ }
1187
+ suggestionsArray = suggestionsArray.map(function (s) {
1188
+ if (s.sectionId) {
1189
+ return s;
1190
+ }
1191
+ return _extends({}, s, {
1192
+ sectionId: s._suggestion_type
1193
+ });
1194
+ });
1195
+ var sectionsAccumulated = [];
1196
+ var sectionisedSuggestions = suggestionsArray.reduce(function (acc, d, currentIndex) {
1197
+ if (sectionsAccumulated.includes(d.sectionId)) return acc;
1198
+ if (d.sectionId) {
1199
+ acc[currentIndex] = suggestionsArray.filter(function (g) {
1200
+ return g.sectionId === d.sectionId;
1201
+ });
1202
+ sectionsAccumulated.push(d.sectionId);
1203
+ } else {
1204
+ acc[currentIndex] = d;
1205
+ }
1206
+ return acc;
1207
+ }, {});
1208
+ return Object.values(sectionisedSuggestions);
1146
1209
  }
1147
1210
  },
1148
1211
  props: {
@@ -1152,6 +1215,7 @@ var SearchBox = defineComponent({
1152
1215
  className: VueTypes.string.def(''),
1153
1216
  clearIcon: types.children,
1154
1217
  componentId: types.stringRequired,
1218
+ compoundClause: types.compoundClause,
1155
1219
  customHighlight: types.func,
1156
1220
  customQuery: types.func,
1157
1221
  defaultQuery: types.func,
@@ -1174,6 +1238,11 @@ var SearchBox = defineComponent({
1174
1238
  enableQuerySuggestions: VueTypes.bool.def(false),
1175
1239
  enablePopularSuggestions: VueTypes.bool.def(false),
1176
1240
  enableRecentSuggestions: VueTypes.bool.def(false),
1241
+ enableFAQSuggestions: VueTypes.bool.def(false),
1242
+ FAQSuggestionsConfig: VueTypes.shape({
1243
+ sectionLabel: VueTypes.string,
1244
+ size: VueTypes.number
1245
+ }),
1177
1246
  fieldWeights: types.fieldWeights,
1178
1247
  filterLabel: types.string,
1179
1248
  fuzziness: types.fuzziness,
@@ -1209,12 +1278,20 @@ var SearchBox = defineComponent({
1209
1278
  distinctFieldConfig: types.props,
1210
1279
  //
1211
1280
  focusShortcuts: VueTypes.arrayOf(VueTypes.oneOfType([VueTypes.string, VueTypes.number])).def(['/']),
1281
+ showFocusShortcutsIcon: VueTypes.bool.def(true),
1212
1282
  addonBefore: VueTypes.any,
1213
1283
  addonAfter: VueTypes.any,
1284
+ showSuggestionsFooter: VueTypes.bool.def(true),
1214
1285
  expandSuggestionsContainer: VueTypes.bool.def(true),
1286
+ renderSuggestionsFooter: VueTypes.func,
1215
1287
  index: VueTypes.string,
1216
1288
  popularSuggestionsConfig: VueTypes.object,
1217
1289
  recentSuggestionsConfig: VueTypes.object,
1290
+ featuredSuggestionsConfig: VueTypes.shape({
1291
+ maxSuggestionsPerSection: VueTypes.number,
1292
+ sectionsOrder: VueTypes.arrayOf(VueTypes.string)
1293
+ }),
1294
+ customEvents: VueTypes.object,
1218
1295
  applyStopwords: VueTypes.bool,
1219
1296
  customStopwords: types.stringArray,
1220
1297
  onData: types.func,
@@ -1233,6 +1310,17 @@ var SearchBox = defineComponent({
1233
1310
  this.listenForFocusShortcuts();
1234
1311
  },
1235
1312
  watch: {
1313
+ AIResponse: function AIResponse(newVal) {
1314
+ if (newVal) {
1315
+ if (this.$props.AIUIConfig && this.$props.AIUIConfig.showSourceDocuments && newVal.response && newVal.response.answer && Array.isArray(newVal.response.answer.documentIds)) {
1316
+ this.sourceDocIds = newVal.response.answer.documentIds;
1317
+ var localCache = getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) && getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY)[this.$props.componentId];
1318
+ if (localCache && localCache.meta && localCache.meta.hits) {
1319
+ this.initialHits = localCache.meta.hits;
1320
+ }
1321
+ }
1322
+ }
1323
+ },
1236
1324
  dataField: function dataField(newVal, oldVal) {
1237
1325
  if (!isEqual(newVal, oldVal)) {
1238
1326
  this.triggerCustomQuery(this.$data.currentValue);
@@ -1289,7 +1377,11 @@ var SearchBox = defineComponent({
1289
1377
  if (this.$options.isTagsMode) {
1290
1378
  cause = causes.SUGGESTION_SELECT;
1291
1379
  }
1292
- this.setValue(newVal || '', true, this.$props, cause);
1380
+ if (this.$props.value === undefined) {
1381
+ this.setValue(newVal, newVal === '', this.$props, cause, false);
1382
+ } else {
1383
+ this.setValue(newVal || '', true, this.$props, cause);
1384
+ }
1293
1385
  }
1294
1386
  },
1295
1387
  focusShortcuts: function focusShortcuts() {
@@ -1303,6 +1395,9 @@ var SearchBox = defineComponent({
1303
1395
  loading: this.isLoading,
1304
1396
  error: this.isError
1305
1397
  });
1398
+ if (newVal && newVal.hits && newVal.hits.hits) {
1399
+ this.initialHits = newVal.hits.hits;
1400
+ }
1306
1401
  },
1307
1402
  aggregationData: function aggregationData(newVal) {
1308
1403
  this.$emit('on-data', {
@@ -1377,6 +1472,20 @@ var SearchBox = defineComponent({
1377
1472
  }
1378
1473
  },
1379
1474
  methods: {
1475
+ renderTriggerMessage: function renderTriggerMessage() {
1476
+ if (this.$props.enableAI) {
1477
+ if (this.$props.AIUIConfig && this.$props.AIUIConfig.renderTriggerMessage) {
1478
+ return this.$props.AIUIConfig.renderTriggerMessage;
1479
+ }
1480
+ if (this.$slots.renderTriggerMessage) {
1481
+ return this.$slots.renderTriggerMessage();
1482
+ }
1483
+ if (this.currentTriggerMode === AI_TRIGGER_MODES.MANUAL && (this.$props.AIUIConfig ? !this.$props.AIUIConfig.askButton : true)) {
1484
+ return 'Click to trigger AIAnswer';
1485
+ }
1486
+ }
1487
+ return null;
1488
+ },
1380
1489
  handleText: function handleText(value, cause) {
1381
1490
  if (cause === causes.CLEAR_VALUE) {
1382
1491
  this.triggerCustomQuery(value);
@@ -1401,8 +1510,8 @@ var SearchBox = defineComponent({
1401
1510
  value: currentValue,
1402
1511
  resultStats: this.stats,
1403
1512
  AIData: {
1404
- question: this.AIResponse && this.AIResponse.response && this.AIResponse.response.question,
1405
- answer: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text,
1513
+ question: this.mergedAIQuestion,
1514
+ answer: this.mergedAIAnswer,
1406
1515
  documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
1407
1516
  showAIScreen: this.showAIScreen,
1408
1517
  sources: this.getAISourceObjects(),
@@ -1433,7 +1542,7 @@ var SearchBox = defineComponent({
1433
1542
  this.onValueSelectedHandler(currentValue, causes.SEARCH_ICON_CLICK);
1434
1543
  }
1435
1544
  },
1436
- setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue) {
1545
+ setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue, shouldExecuteQuery) {
1437
1546
  var _this2 = this;
1438
1547
  if (isDefaultValue === void 0) {
1439
1548
  isDefaultValue = false;
@@ -1447,6 +1556,9 @@ var SearchBox = defineComponent({
1447
1556
  if (categoryValue === void 0) {
1448
1557
  categoryValue = undefined;
1449
1558
  }
1559
+ if (shouldExecuteQuery === void 0) {
1560
+ shouldExecuteQuery = true;
1561
+ }
1450
1562
  var performUpdate = function performUpdate() {
1451
1563
  if (_this2.$options.isTagsMode && isEqual(value, _this2.selectedTags)) {
1452
1564
  return;
@@ -1475,24 +1587,31 @@ var SearchBox = defineComponent({
1475
1587
  if (_this2.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1476
1588
  queryHandlerValue = Array.isArray(_this2.selectedTags) && _this2.selectedTags.length ? _this2.selectedTags : undefined;
1477
1589
  }
1590
+ if ((_this2.faqAnswer || _this2.faqQuestion) && value === '') {
1591
+ // Empty the previous state
1592
+ _this2.faqAnswer = '';
1593
+ _this2.faqQuestion = '';
1594
+ _this2.showAIScreen = false;
1595
+ }
1478
1596
  if (isDefaultValue) {
1479
1597
  if (_this2.$props.autosuggest) {
1480
1598
  if (toggleIsOpen) {
1481
1599
  _this2.isOpen = false;
1482
1600
  }
1483
- if (typeof _this2.currentValue === 'string') _this2.triggerDefaultQuery(_this2.currentValue, props.enableAI ? {
1601
+ if (typeof _this2.currentValue === 'string') _this2.triggerDefaultQuery(_this2.currentValue, props.enableAI && _this2.currentTriggerMode === AI_TRIGGER_MODES.QUESTION && _this2.currentValue.endsWith('?') ? {
1484
1602
  enableAI: true
1485
- } : {});
1603
+ } : {}, shouldExecuteQuery);
1486
1604
  } // in case of strict selection only SUGGESTION_SELECT should be able
1487
1605
  // to set the query otherwise the value should reset
1488
1606
  if (props.strictSelection) {
1489
1607
  if (cause === causes.SUGGESTION_SELECT || (_this2.$options.isTagsMode ? _this2.selectedTags.length === 0 : value === '')) {
1490
- _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue);
1608
+ _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1491
1609
  } else {
1492
1610
  _this2.setValue('', true);
1493
1611
  }
1494
1612
  } else if (props.value === undefined || cause === causes.SUGGESTION_SELECT || cause === causes.CLEAR_VALUE) {
1495
- _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue);
1613
+ _this2.showAIScreen = false;
1614
+ _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
1496
1615
  }
1497
1616
  } else {
1498
1617
  // debounce for handling text while typing
@@ -1503,10 +1622,13 @@ var SearchBox = defineComponent({
1503
1622
  };
1504
1623
  checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
1505
1624
  },
1506
- triggerDefaultQuery: function triggerDefaultQuery(paramValue, meta) {
1625
+ triggerDefaultQuery: function triggerDefaultQuery(paramValue, meta, shouldExecuteQuery) {
1507
1626
  if (meta === void 0) {
1508
1627
  meta = {};
1509
1628
  }
1629
+ if (shouldExecuteQuery === void 0) {
1630
+ shouldExecuteQuery = true;
1631
+ }
1510
1632
  if (!this.$props.autosuggest) {
1511
1633
  return;
1512
1634
  }
@@ -1527,12 +1649,15 @@ var SearchBox = defineComponent({
1527
1649
  value: value,
1528
1650
  componentType: componentTypes.searchBox,
1529
1651
  meta: meta
1530
- });
1652
+ }, shouldExecuteQuery);
1531
1653
  },
1532
- triggerCustomQuery: function triggerCustomQuery(paramValue, categoryValue) {
1654
+ triggerCustomQuery: function triggerCustomQuery(paramValue, categoryValue, shouldExecuteQuery) {
1533
1655
  if (categoryValue === void 0) {
1534
1656
  categoryValue = undefined;
1535
1657
  }
1658
+ if (shouldExecuteQuery === void 0) {
1659
+ shouldExecuteQuery = true;
1660
+ }
1536
1661
  var _this$$props = this.$props,
1537
1662
  customQuery = _this$$props.customQuery,
1538
1663
  filterLabel = _this$$props.filterLabel,
@@ -1561,7 +1686,7 @@ var SearchBox = defineComponent({
1561
1686
  URLParams: URLParams,
1562
1687
  componentType: componentTypes.searchBox,
1563
1688
  category: categoryValue
1564
- });
1689
+ }, shouldExecuteQuery);
1565
1690
  },
1566
1691
  handleFocus: function handleFocus(event) {
1567
1692
  if (this.$props.autosuggest) {
@@ -1572,7 +1697,9 @@ var SearchBox = defineComponent({
1572
1697
  handleVoiceResults: function handleVoiceResults(_ref) {
1573
1698
  var results = _ref.results;
1574
1699
  if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
1700
+ var _this$$refs2;
1575
1701
  this.setValue(results[0][0].transcript.trim(), true);
1702
+ (_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
1576
1703
  }
1577
1704
  },
1578
1705
  triggerQuery: function triggerQuery(_ref2) {
@@ -1612,6 +1739,8 @@ var SearchBox = defineComponent({
1612
1739
  clearValue: function clearValue() {
1613
1740
  this.setValue('', false, this.$props, !this.$options.isTagsMode ? causes.CLEAR_VALUE : undefined, false);
1614
1741
  this.onValueSelectedHandler('', !this.$options.isTagsMode ? causes.CLEAR_VALUE : undefined);
1742
+ this.showAIScreen = false;
1743
+ this.isOpen = false;
1615
1744
  },
1616
1745
  handleKeyDown: function handleKeyDown(event, highlightedIndex) {
1617
1746
  if (highlightedIndex === void 0) {
@@ -1624,9 +1753,10 @@ var SearchBox = defineComponent({
1624
1753
  } else if (highlightedIndex === null) {
1625
1754
  this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined,
1626
1755
  // to handle tags
1627
- !this.$props.enableAI);
1628
- if (this.$props.enableAI && !this.showAIScreen) {
1756
+ !(this.$props.enableAI && this.currentTriggerMode === AI_TRIGGER_MODES.QUESTION && event.target.value.endsWith('?')));
1757
+ if (this.$props.enableAI && !this.showAIScreen && this.currentTriggerMode === AI_TRIGGER_MODES.QUESTION && event.target.value.endsWith('?')) {
1629
1758
  this.showAIScreen = true;
1759
+ this.isOpen = true;
1630
1760
  }
1631
1761
  this.onValueSelectedHandler(event.target.value, causes.ENTER_PRESS);
1632
1762
  }
@@ -1647,7 +1777,7 @@ var SearchBox = defineComponent({
1647
1777
  }
1648
1778
  var value = this.$props.value;
1649
1779
  if (value === undefined) {
1650
- this.setValue(inputValue, false, this.$props, undefined);
1780
+ this.setValue(inputValue, inputValue === '', this.$props, undefined, false);
1651
1781
  } else {
1652
1782
  this.$emit('change', inputValue, function (_ref3) {
1653
1783
  var isOpen = _ref3.isOpen;
@@ -1660,12 +1790,72 @@ var SearchBox = defineComponent({
1660
1790
  }, e);
1661
1791
  }
1662
1792
  },
1793
+ handleFeaturedSuggestionClicked: function handleFeaturedSuggestionClicked(suggestion) {
1794
+ try {
1795
+ var _this$$refs3;
1796
+ if (suggestion.action === featuredSuggestionsActionTypes.NAVIGATE) {
1797
+ var _JSON$parse = JSON.parse(suggestion.subAction),
1798
+ _JSON$parse$target = _JSON$parse.target,
1799
+ target = _JSON$parse$target === void 0 ? '_self' : _JSON$parse$target,
1800
+ _JSON$parse$link = _JSON$parse.link,
1801
+ link = _JSON$parse$link === void 0 ? '/' : _JSON$parse$link;
1802
+ if (typeof window !== 'undefined') {
1803
+ window.open(link, target);
1804
+ }
1805
+ }
1806
+ if (suggestion.action === featuredSuggestionsActionTypes.FUNCTION) {
1807
+ var matchedValues = suggestion.subAction.match(/function\s*\(.*\)(.|\n)*/);
1808
+ var functionStr = matchedValues && matchedValues[0];
1809
+ // eslint-disable-next-line no-new-func
1810
+ var func = new Function("return " + functionStr)();
1811
+ func(suggestion, this.$data.currentValue, this.$props.customEvents);
1812
+ }
1813
+ if (suggestion.action === featuredSuggestionsActionTypes.SELECT) {
1814
+ this.setValue(suggestion.value, true, this.$props, this.$options.isTagsMode.current ? causes.SUGGESTION_SELECT : causes.ENTER_PRESS, false);
1815
+ this.onValueSelectedHandler(suggestion.value, causes.SUGGESTION_SELECT);
1816
+ }
1817
+ // blur is important to close the dropdown
1818
+ // on selecting one of featured suggestions
1819
+ // else Downshift probably is focusing the dropdown
1820
+ // and not letting it close
1821
+ // eslint-disable-next-line no-unused-expressions
1822
+ (_this$$refs3 = this.$refs) == null || (_this$$refs3 = _this$$refs3[this.$props.innerRef]) == null || (_this$$refs3 = _this$$refs3.el) == null ? void 0 : _this$$refs3.blur();
1823
+ } catch (e) {
1824
+ console.error("Error: There was an error parsing the subAction for the featured suggestion with label, \"" + suggestion.label + "\"", e);
1825
+ }
1826
+ },
1663
1827
  onSuggestionSelected: function onSuggestionSelected(suggestion) {
1664
1828
  var _this4 = this;
1665
- if (!this.$props.enableAI) this.isOpen = false;else {
1829
+ var value = this.$props.value;
1830
+ // The state of the suggestion is open by the time it reaches here. i.e. isOpen = true
1831
+ // handle when FAQ suggestion is clicked
1832
+ if (suggestion && suggestion._suggestion_type === suggestionTypes.FAQ) {
1833
+ this.currentValue = suggestion.value;
1834
+ // Handle AI
1835
+ // Independent of enableAI.
1836
+ this.faqAnswer = suggestion._answer;
1837
+ this.faqQuestion = suggestion.value;
1838
+ this.isOpen = true;
1666
1839
  this.showAIScreen = true;
1840
+ if (value !== undefined) this.$emit('change', suggestion.value, function () {});
1841
+ this.onValueSelectedHandler(suggestion.value);
1842
+ return;
1843
+ }
1844
+ if (suggestion && suggestion._suggestion_type === '_internal_a_i_trigger') {
1845
+ this.showAIScreen = true;
1846
+ this.askButtonOnClick();
1847
+ return;
1848
+ }
1849
+
1850
+ // handle featured suggestions click event
1851
+ if (suggestion._suggestion_type === suggestionTypes.Featured) {
1852
+ this.handleFeaturedSuggestionClicked(suggestion);
1853
+ // Handle AI
1854
+ if (!this.$props.enableAI) this.isOpen = false;else {
1855
+ this.showAIScreen = true;
1856
+ }
1857
+ return;
1667
1858
  }
1668
- var value = this.$props.value;
1669
1859
  // Record analytics for selected suggestions
1670
1860
  this.triggerClickAnalytics(suggestion._click_id);
1671
1861
  if (value === undefined) {
@@ -1693,6 +1883,11 @@ var SearchBox = defineComponent({
1693
1883
  });
1694
1884
  }
1695
1885
  this.onValueSelectedHandler(suggestion.value, causes.SUGGESTION_SELECT, suggestion.source);
1886
+
1887
+ // Handle AI
1888
+ if (!this.$props.enableAI) this.isOpen = false;else if (this.currentTriggerMode === AI_TRIGGER_MODES.QUESTION && suggestion.value.endsWith('?')) {
1889
+ this.showAIScreen = true;
1890
+ }
1696
1891
  },
1697
1892
  onValueSelectedHandler: function onValueSelectedHandler(currentValue) {
1698
1893
  if (currentValue === void 0) {
@@ -1821,6 +2016,13 @@ var SearchBox = defineComponent({
1821
2016
  customQuery: true
1822
2017
  });
1823
2018
  },
2019
+ suggestionsFooter: function suggestionsFooter() {
2020
+ return typeof renderSuggestionsFooter === 'function' ? this.$props.renderSuggestionsFooter() : createVNode(AutosuggestFooterContainer, null, {
2021
+ "default": function _default() {
2022
+ return [createVNode("div", null, [createTextVNode("\u2191\u2193 Navigate")]), createVNode("div", null, [createTextVNode("\u21A9 Go")])];
2023
+ }
2024
+ });
2025
+ },
1824
2026
  renderEnterButtonElement: function renderEnterButtonElement() {
1825
2027
  var _this6 = this;
1826
2028
  var _this$$props2 = this.$props,
@@ -1848,71 +2050,98 @@ var SearchBox = defineComponent({
1848
2050
  }
1849
2051
  return null;
1850
2052
  },
1851
- renderIcons: function renderIcons() {
2053
+ renderShortcut: function renderShortcut() {
2054
+ if (this.$props.focusShortcuts && this.$props.focusShortcuts.length) {
2055
+ var shortcut = this.$props.focusShortcuts[0];
2056
+ shortcut = shortcut.toLowerCase();
2057
+ shortcut = shortcut.replace('shift', '⬆️');
2058
+ shortcut = shortcut.replace('command', 'cmd');
2059
+ shortcut = shortcut.replace('control', 'ctrl');
2060
+ shortcut = shortcut.replace('option', 'alt');
2061
+ return shortcut.toUpperCase();
2062
+ }
2063
+ return '/';
2064
+ },
2065
+ renderLeftIcons: function renderLeftIcons() {
1852
2066
  var _this7 = this;
1853
- var _slot3, _slot4, _slot5;
2067
+ var _slot3;
1854
2068
  var _this$$props3 = this.$props,
1855
2069
  iconPosition = _this$$props3.iconPosition,
1856
- showClear = _this$$props3.showClear,
1857
- innerClass = _this$$props3.innerClass,
1858
- getMicInstance = _this$$props3.getMicInstance,
1859
- showVoiceSearch = _this$$props3.showVoiceSearch,
1860
2070
  showIcon = _this$$props3.showIcon;
2071
+ return createVNode("div", null, [createVNode(IconGroup, {
2072
+ "groupPosition": "left"
2073
+ }, {
2074
+ "default": function _default() {
2075
+ return [iconPosition === 'left' && showIcon && createVNode(IconWrapper, {
2076
+ "onClick": _this7.handleSearchIconClick
2077
+ }, _isSlot(_slot3 = _this7.renderIcon()) ? _slot3 : {
2078
+ "default": function _default() {
2079
+ return [_slot3];
2080
+ }
2081
+ })];
2082
+ }
2083
+ })]);
2084
+ },
2085
+ renderRightIcons: function renderRightIcons() {
2086
+ var _this8 = this;
2087
+ var _slot4, _slot5, _slot6;
2088
+ var _this$$props4 = this.$props,
2089
+ iconPosition = _this$$props4.iconPosition,
2090
+ showClear = _this$$props4.showClear,
2091
+ innerClass = _this$$props4.innerClass,
2092
+ getMicInstance = _this$$props4.getMicInstance,
2093
+ showVoiceSearch = _this$$props4.showVoiceSearch,
2094
+ showIcon = _this$$props4.showIcon,
2095
+ showFocusShortcutsIcon = _this$$props4.showFocusShortcutsIcon;
1861
2096
  var renderMic = this.$slots.renderMic || this.$props.renderMic;
1862
2097
  var currentValue = this.$data.currentValue;
1863
2098
  return createVNode("div", null, [createVNode(IconGroup, {
1864
- "groupPosition": "right",
1865
- "positionType": "absolute"
2099
+ "groupPosition": "right"
1866
2100
  }, {
1867
2101
  "default": function _default() {
1868
2102
  return [currentValue && showClear && createVNode(IconWrapper, {
1869
- "onClick": _this7.clearValue,
2103
+ "onClick": _this8.clearValue,
1870
2104
  "showIcon": showIcon,
1871
2105
  "isClearIcon": true
1872
- }, _isSlot(_slot3 = _this7.renderCancelIcon()) ? _slot3 : {
2106
+ }, _isSlot(_slot4 = _this8.renderCancelIcon()) ? _slot4 : {
1873
2107
  "default": function _default() {
1874
- return [_slot3];
2108
+ return [_slot4];
2109
+ }
2110
+ }), showFocusShortcutsIcon && createVNode(ButtonIconWrapper, {
2111
+ "onClick": function onClick(e) {
2112
+ return _this8.focusSearchBox(e);
2113
+ }
2114
+ }, _isSlot(_slot5 = _this8.renderShortcut()) ? _slot5 : {
2115
+ "default": function _default() {
2116
+ return [_slot5];
1875
2117
  }
1876
2118
  }), showVoiceSearch && createVNode(Mic, {
1877
2119
  "getInstance": getMicInstance,
1878
2120
  "render": renderMic,
1879
- "handleResult": _this7.handleVoiceResults,
2121
+ "handleResult": _this8.handleVoiceResults,
1880
2122
  "className": getClassName$1(innerClass, 'mic') || null
1881
2123
  }, null), iconPosition === 'right' && showIcon && createVNode(IconWrapper, {
1882
- "onClick": _this7.handleSearchIconClick
1883
- }, _isSlot(_slot4 = _this7.renderIcon()) ? _slot4 : {
2124
+ "onClick": _this8.handleSearchIconClick
2125
+ }, _isSlot(_slot6 = _this8.renderIcon()) ? _slot6 : {
1884
2126
  "default": function _default() {
1885
- return [_slot4];
1886
- }
1887
- })];
1888
- }
1889
- }), createVNode(IconGroup, {
1890
- "groupPosition": "left",
1891
- "positionType": "absolute"
1892
- }, {
1893
- "default": function _default() {
1894
- return [iconPosition === 'left' && showIcon && createVNode(IconWrapper, {
1895
- "onClick": _this7.handleSearchIconClick
1896
- }, _isSlot(_slot5 = _this7.renderIcon()) ? _slot5 : {
1897
- "default": function _default() {
1898
- return [_slot5];
2127
+ return [_slot6];
1899
2128
  }
1900
2129
  })];
1901
2130
  }
1902
2131
  })]);
1903
2132
  },
1904
2133
  focusSearchBox: function focusSearchBox(event) {
1905
- var _this$$refs2, _this$$refs2$this$$pr;
2134
+ var _this$$refs4;
1906
2135
  var elt = event.target || event.srcElement;
1907
2136
  var tagName = elt.tagName;
1908
2137
  if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
1909
2138
  // already in an input
1910
2139
  return;
1911
2140
  }
1912
- (_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
2141
+ (_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
1913
2142
  },
1914
2143
  listenForFocusShortcuts: function listenForFocusShortcuts() {
1915
- var _this8 = this;
2144
+ var _this9 = this;
1916
2145
  var _this$$props$focusSho = this.$props.focusShortcuts,
1917
2146
  focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
1918
2147
  if (isEmpty(focusShortcuts)) {
@@ -1927,7 +2156,7 @@ var SearchBox = defineComponent({
1927
2156
  function (event, handler) {
1928
2157
  // Prevent the default refresh event under WINDOWS system
1929
2158
  event.preventDefault();
1930
- _this8.focusSearchBox(event);
2159
+ _this9.focusSearchBox(event);
1931
2160
  });
1932
2161
 
1933
2162
  // if one of modifier keys are used, they are handled below
@@ -1937,7 +2166,7 @@ var SearchBox = defineComponent({
1937
2166
  for (var index = 0; index < modifierKeys.length; index += 1) {
1938
2167
  var element = modifierKeys[index];
1939
2168
  if (hotkeys[element]) {
1940
- _this8.focusSearchBox(event);
2169
+ _this9.focusSearchBox(event);
1941
2170
  break;
1942
2171
  }
1943
2172
  }
@@ -1949,19 +2178,34 @@ var SearchBox = defineComponent({
1949
2178
  this.currentValue = decodeHtml(value);
1950
2179
  this.triggerDefaultQuery(value);
1951
2180
  },
1952
- renderAutoFill: function renderAutoFill(suggestion) {
1953
- var _this9 = this;
2181
+ renderActionIcon: function renderActionIcon(suggestion) {
2182
+ var _this10 = this;
1954
2183
  var handleAutoFillClick = function handleAutoFillClick(e) {
1955
2184
  e.stopPropagation();
1956
- _this9.onAutofillClick(suggestion);
2185
+ _this10.onAutofillClick(suggestion);
1957
2186
  };
1958
- /* 👇 avoid showing autofill for category suggestions👇 */
1959
- return suggestion._category ? null : createVNode(AutoFillSvg, {
1960
- "onClick": handleAutoFillClick
1961
- }, null);
2187
+ if (suggestion._suggestion_type === suggestionTypes.Featured) {
2188
+ if (suggestion.action === featuredSuggestionsActionTypes.FUNCTION) {
2189
+ return createVNode(AutoFillSvg, {
2190
+ "style": {
2191
+ transform: 'rotate(135deg)',
2192
+ pointerEvents: 'none'
2193
+ }
2194
+ }, null);
2195
+ }
2196
+ return null;
2197
+ }
2198
+ if (!suggestion._category) {
2199
+ /* 👇 avoid showing autofill for category suggestions👇 */
2200
+
2201
+ return createVNode(AutoFillSvg, {
2202
+ "onClick": handleAutoFillClick
2203
+ }, null);
2204
+ }
2205
+ return null;
1962
2206
  },
1963
2207
  renderTag: function renderTag(item) {
1964
- var _this10 = this;
2208
+ var _this11 = this;
1965
2209
  var innerClass = this.$props.innerClass;
1966
2210
  return createVNode(TagItem, {
1967
2211
  "class": getClassName$1(innerClass, 'selected-tag') || ''
@@ -1972,7 +2216,7 @@ var SearchBox = defineComponent({
1972
2216
  "aria-label": "delete-tag",
1973
2217
  "class": "close-icon",
1974
2218
  "onClick": function onClick() {
1975
- return _this10.clearTag(item);
2219
+ return _this11.clearTag(item);
1976
2220
  }
1977
2221
  }, [createVNode(CancelSvg, null, null)])];
1978
2222
  }
@@ -1995,7 +2239,7 @@ var SearchBox = defineComponent({
1995
2239
  }
1996
2240
  },
1997
2241
  renderTags: function renderTags() {
1998
- var _this11 = this;
2242
+ var _this12 = this;
1999
2243
  if (!Array.isArray(this.selectedTags)) {
2000
2244
  return null;
2001
2245
  }
@@ -2009,16 +2253,16 @@ var SearchBox = defineComponent({
2009
2253
  }) : createVNode(TagsContainer, null, {
2010
2254
  "default": function _default() {
2011
2255
  return [tagsList.map(function (item) {
2012
- return _this11.renderTag(item);
2256
+ return _this12.renderTag(item);
2013
2257
  }), shouldRenderClearAllTag && createVNode(TagItem, {
2014
- "class": getClassName$1(_this11.$props.innerClass, 'selected-tag') || ''
2258
+ "class": getClassName$1(_this12.$props.innerClass, 'selected-tag') || ''
2015
2259
  }, {
2016
2260
  "default": function _default() {
2017
2261
  return [createVNode("span", null, [createTextVNode("Clear All")]), createVNode("span", {
2018
2262
  "role": "img",
2019
2263
  "aria-label": "delete-tag",
2020
2264
  "class": "close-icon",
2021
- "onClick": _this11.clearAllTags
2265
+ "onClick": _this12.clearAllTags
2022
2266
  }, [createVNode(CancelSvg, null, null)])];
2023
2267
  }
2024
2268
  })];
@@ -2026,13 +2270,13 @@ var SearchBox = defineComponent({
2026
2270
  });
2027
2271
  },
2028
2272
  getAISourceObjects: function getAISourceObjects() {
2029
- var localCache = getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) && getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY)[this.componentId];
2273
+ var _this13 = this;
2030
2274
  var sourceObjects = [];
2031
2275
  if (!this.AIResponse) return sourceObjects;
2032
2276
  var docIds = this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [];
2033
- if (localCache && localCache.meta && localCache.meta.hits && localCache.meta.hits.hits) {
2277
+ if (this.initialHits) {
2034
2278
  docIds.forEach(function (id) {
2035
- var foundSourceObj = localCache.meta.hits.hits.find(function (hit) {
2279
+ var foundSourceObj = _this13.initialHits.find(function (hit) {
2036
2280
  return hit._id === id;
2037
2281
  }) || {};
2038
2282
  if (foundSourceObj) {
@@ -2065,49 +2309,56 @@ var SearchBox = defineComponent({
2065
2309
  return createVNode(HorizontalSkeletonLoader, null, null);
2066
2310
  },
2067
2311
  renderAIScreenFooter: function renderAIScreenFooter() {
2068
- var _slot6;
2069
- var _this12 = this;
2312
+ var _slot8;
2313
+ var _this14 = this;
2070
2314
  var _this$$props$AIUIConf2 = this.$props.AIUIConfig,
2071
2315
  AIUIConfig = _this$$props$AIUIConf2 === void 0 ? {} : _this$$props$AIUIConf2;
2072
2316
  var _ref6 = AIUIConfig || {},
2073
2317
  _ref6$showSourceDocum = _ref6.showSourceDocuments,
2074
2318
  showSourceDocuments = _ref6$showSourceDocum === void 0 ? true : _ref6$showSourceDocum,
2075
- _ref6$sourceDocumentL = _ref6.sourceDocumentLabel,
2076
- sourceDocumentLabel = _ref6$sourceDocumentL === void 0 ? '_id' : _ref6$sourceDocumentL,
2077
2319
  _ref6$onSourceClick = _ref6.onSourceClick,
2078
2320
  onSourceClick = _ref6$onSourceClick === void 0 ? function () {} : _ref6$onSourceClick;
2321
+ var renderSourceDocumentLabel = function renderSourceDocumentLabel(sourceObj) {
2322
+ if (_this14.$props.AIUIConfig && _this14.$props.AIUIConfig.renderSourceDocument) {
2323
+ return _this14.$props.AIUIConfig.renderSourceDocument(sourceObj);
2324
+ }
2325
+ if (_this14.$slots.renderSourceDocument) {
2326
+ return _this14.$slots.renderSourceDocument(sourceObj);
2327
+ }
2328
+ return sourceObj._id;
2329
+ };
2079
2330
  return showSourceDocuments && this.showAIScreenFooter && this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds ? createVNode(Footer, {
2080
2331
  "themePreset": this.$props.themePreset
2081
2332
  }, {
2082
2333
  "default": function _default() {
2083
- return [createTextVNode("Summary generated using the following sources:"), ' ', createVNode(SourceTags, null, _isSlot(_slot6 = _this12.getAISourceObjects().map(function (el) {
2334
+ return [createTextVNode("Summary generated using the following sources:"), ' ', createVNode(SourceTags, null, _isSlot(_slot8 = _this14.getAISourceObjects().map(function (el) {
2335
+ var _slot7;
2084
2336
  return createVNode(Button, {
2085
- "class": "--ai-source-tag " + (getClassName$1(_this12.$props.innerClass, 'ai-source-tag') || ''),
2086
- "title": el[sourceDocumentLabel],
2337
+ "class": "--ai-source-tag " + (getClassName$1(_this14.$props.innerClass, 'ai-source-tag') || ''),
2087
2338
  "info": true,
2088
2339
  "onClick": function onClick() {
2089
2340
  return onSourceClick && onSourceClick(el);
2090
2341
  }
2091
- }, {
2342
+ }, _isSlot(_slot7 = renderSourceDocumentLabel(el)) ? _slot7 : {
2092
2343
  "default": function _default() {
2093
- return [el[sourceDocumentLabel]];
2344
+ return [_slot7];
2094
2345
  }
2095
2346
  });
2096
- })) ? _slot6 : {
2347
+ })) ? _slot8 : {
2097
2348
  "default": function _default() {
2098
- return [_slot6];
2349
+ return [_slot8];
2099
2350
  }
2100
2351
  })];
2101
2352
  }
2102
2353
  }) : null;
2103
2354
  },
2104
2355
  renderAIScreen: function renderAIScreen() {
2105
- var _this13 = this;
2356
+ var _this15 = this;
2106
2357
  var customAIRenderer = this.$props.renderAIAnswer || this.$slots.renderAIAnswer;
2107
2358
  if (customAIRenderer) {
2108
2359
  return customAIRenderer({
2109
- question: this.AIResponse && this.AIResponse.response && this.AIResponse.response.question,
2110
- answer: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text,
2360
+ question: this.mergedAIQuestion,
2361
+ answer: this.mergedAIAnswer,
2111
2362
  documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
2112
2363
  loading: this.isAIResponseLoading || this.isLoading,
2113
2364
  sources: this.getAISourceObjects(),
@@ -2118,7 +2369,7 @@ var SearchBox = defineComponent({
2118
2369
  return this.renderAIScreenLoader();
2119
2370
  }
2120
2371
  return createVNode("div", null, [createVNode(Answer, {
2121
- "innerHTML": md.render(this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text)
2372
+ "innerHTML": md.render(this.mergedAIAnswer)
2122
2373
  }, null), this.renderAIScreenFooter(), this.showFeedbackComponent && createVNode("div", {
2123
2374
  "class": "" + (getClassName$1(this.$props.innerClass, 'ai-feedback') || '')
2124
2375
  }, [createVNode(AIFeedback, {
@@ -2126,11 +2377,11 @@ var SearchBox = defineComponent({
2126
2377
  "hideUI": this.isAIResponseLoading || this.isLoading || !this.sessionIdFromStore,
2127
2378
  "key": this.sessionIdFromStore,
2128
2379
  "onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
2129
- _this13.feedbackState = {
2380
+ _this15.feedbackState = {
2130
2381
  isRecorded: true,
2131
2382
  feedbackType: useful ? 'positive' : 'negative'
2132
2383
  };
2133
- _this13.recordAISessionUsefulness(_this13.sessionIdFromStore, {
2384
+ _this15.recordAISessionUsefulness(_this15.sessionIdFromStore, {
2134
2385
  useful: useful,
2135
2386
  reason: reason
2136
2387
  });
@@ -2165,22 +2416,22 @@ var SearchBox = defineComponent({
2165
2416
  });
2166
2417
  },
2167
2418
  renderAskButtonElement: function renderAskButtonElement() {
2168
- var _this14 = this;
2169
- var _this$$props4 = this.$props,
2170
- AIUIConfig = _this$$props4.AIUIConfig,
2171
- innerClass = _this$$props4.innerClass;
2419
+ var _this16 = this;
2420
+ var _this$$props5 = this.$props,
2421
+ AIUIConfig = _this$$props5.AIUIConfig,
2422
+ innerClass = _this$$props5.innerClass;
2172
2423
  var _ref7 = AIUIConfig || {},
2173
2424
  askButton = _ref7.askButton;
2174
2425
  var renderAskButton = this.$slots.renderAskButton;
2175
2426
  if (askButton) {
2176
2427
  var getEnterButtonMarkup = function getEnterButtonMarkup() {
2177
2428
  if (renderAskButton) {
2178
- return renderAskButton(_this14.askButtonOnClick);
2429
+ return renderAskButton(_this16.askButtonOnClick);
2179
2430
  }
2180
2431
  return createVNode(Button, {
2181
2432
  "class": "enter-btn " + getClassName$1(innerClass, 'ask-button'),
2182
2433
  "info": true,
2183
- "onClick": _this14.askButtonOnClick
2434
+ "onClick": _this16.askButtonOnClick
2184
2435
  }, {
2185
2436
  "default": function _default() {
2186
2437
  return [createTextVNode("Ask")];
@@ -2195,7 +2446,7 @@ var SearchBox = defineComponent({
2195
2446
  }
2196
2447
  },
2197
2448
  render: function render() {
2198
- var _this15 = this;
2449
+ var _this17 = this;
2199
2450
  var expandSuggestionsContainer = this.$props.expandSuggestionsContainer;
2200
2451
  var _this$$slots = this.$slots,
2201
2452
  recentSearchesIcon = _this$$slots.recentSearchesIcon,
@@ -2206,17 +2457,17 @@ var SearchBox = defineComponent({
2206
2457
  "class": this.$props.className
2207
2458
  }, {
2208
2459
  "default": function _default() {
2209
- return [_this15.$props.title && createVNode(Title, {
2210
- "class": getClassName$1(_this15.$props.innerClass, 'title') || ''
2460
+ return [_this17.$props.title && createVNode(Title, {
2461
+ "class": getClassName$1(_this17.$props.innerClass, 'title') || ''
2211
2462
  }, {
2212
2463
  "default": function _default() {
2213
- return [_this15.$props.title];
2464
+ return [_this17.$props.title];
2214
2465
  }
2215
- }), _this15.$props.autosuggest ? createVNode(Downshift, {
2216
- "id": _this15.$props.componentId + "-downshift",
2217
- "handleChange": _this15.onSuggestionSelected,
2218
- "handleMouseup": _this15.handleStateChange,
2219
- "isOpen": _this15.$data.isOpen
2466
+ }), _this17.$props.autosuggest ? createVNode(Downshift, {
2467
+ "id": _this17.$props.componentId + "-downshift",
2468
+ "handleChange": _this17.onSuggestionSelected,
2469
+ "handleMouseup": _this17.handleStateChange,
2470
+ "isOpen": _this17.$data.isOpen
2220
2471
  }, {
2221
2472
  "default": function _default(_ref8) {
2222
2473
  var getInputEvents = _ref8.getInputEvents,
@@ -2227,156 +2478,249 @@ var SearchBox = defineComponent({
2227
2478
  highlightedIndex = _ref8.highlightedIndex,
2228
2479
  setHighlightedIndex = _ref8.setHighlightedIndex;
2229
2480
  var renderSuggestionsDropdown = function renderSuggestionsDropdown() {
2230
- var getIcon = function getIcon(iconType) {
2481
+ var getIcon = function getIcon(iconType, item, leaveSpaceForIcon) {
2231
2482
  switch (iconType) {
2232
2483
  case suggestionTypes.Recent:
2233
2484
  return recentSearchesIcon;
2234
2485
  case suggestionTypes.Popular:
2235
2486
  return popularSearchesIcon;
2487
+ case suggestionTypes.Featured:
2488
+ if (item.icon) {
2489
+ return function () {
2490
+ return createVNode("div", {
2491
+ "style": {
2492
+ display: 'flex'
2493
+ },
2494
+ "innerHTML": xss(item.icon)
2495
+ }, null);
2496
+ };
2497
+ }
2498
+ if (item.iconURL) {
2499
+ return function () {
2500
+ return (// When you change below also change the empty icon below
2501
+ createVNode("img", {
2502
+ "style": {
2503
+ maxWidth: '30px'
2504
+ },
2505
+ "src": xss(item.iconURL),
2506
+ "alt": item.value
2507
+ }, null)
2508
+ );
2509
+ };
2510
+ }
2511
+ // Render an empty icon when no icon is provided from the dashboard
2512
+ return function () {
2513
+ return createVNode("span", {
2514
+ "style": {
2515
+ display: 'inline-block',
2516
+ height: '30px',
2517
+ width: leaveSpaceForIcon ? '30px' : 0
2518
+ }
2519
+ }, null);
2520
+ };
2236
2521
  default:
2237
2522
  return null;
2238
2523
  }
2239
2524
  };
2240
- return createVNode("div", null, [_this15.hasCustomRenderer && _this15.getComponent({
2525
+ var indexOffset = 0;
2526
+ return createVNode("div", null, [_this17.hasCustomRenderer && _this17.getComponent({
2241
2527
  isOpen: isOpen,
2242
2528
  getItemProps: getItemProps,
2243
2529
  getItemEvents: getItemEvents,
2244
2530
  highlightedIndex: highlightedIndex
2245
- }), _this15.renderErrorComponent(), !_this15.hasCustomRenderer && isOpen && hasSuggestions ? createVNode("ul", {
2246
- "class": suggestions(_this15.themePreset, _this15.theme) + " " + getClassName$1(_this15.$props.innerClass, 'list'),
2531
+ }), _this17.renderErrorComponent(), !_this17.hasCustomRenderer && isOpen && hasSuggestions ? createVNode("ul", {
2532
+ "class": suggestions(_this17.themePreset, _this17.theme) + " " + getClassName$1(_this17.$props.innerClass, 'list') + " " + searchboxSuggestions(_this17.themePreset, _this17.theme) + "\n\t\t\t\t\t\t\t\t\t\t\t\t\t",
2247
2533
  "ref": _dropdownULRef
2248
- }, [_this15.showAIScreen && createVNode(SearchBoxAISection, {
2249
- "themePreset": _this15.$props.themePreset
2534
+ }, [_this17.showAIScreen && createVNode(SearchBoxAISection, {
2535
+ "themePreset": _this17.$props.themePreset
2250
2536
  }, {
2251
2537
  "default": function _default() {
2252
- return [_this15.renderAIScreen(), ' ', _this15.renderErrorComponent(true)];
2538
+ return [_this17.renderAIScreen(), ' ', _this17.renderErrorComponent(true)];
2253
2539
  }
2254
- }), !_this15.showAIScreen && _this15.normalizedSuggestions.map(function (item, index) {
2255
- return renderItem ? createVNode("li", mergeProps(getItemProps({
2256
- item: item
2257
- }), getItemEvents({
2258
- item: item
2259
- }), {
2260
- "key": index + 1 + "-" + item.value,
2261
- "style": {
2262
- backgroundColor: _this15.getBackgroundColor(highlightedIndex, index),
2263
- justifyContent: 'flex-start',
2264
- alignItems: 'center'
2265
- }
2266
- }), [renderItem(item)]) : createVNode("li", mergeProps(getItemProps({
2267
- item: item
2268
- }), _transformOn(getItemEvents({
2269
- item: item
2270
- })), {
2271
- "key": index + 1 + "-" + item.value,
2272
- "style": {
2273
- backgroundColor: _this15.getBackgroundColor(highlightedIndex, index),
2274
- justifyContent: 'flex-start',
2275
- alignItems: 'center'
2276
- }
2277
- }), [createVNode("div", {
2278
- "style": {
2279
- padding: '0 10px 0 0',
2280
- display: 'flex'
2281
- }
2282
- }, [createVNode(CustomSvg, {
2283
- "className": getClassName$1(_this15.$props.innerClass, item._suggestion_type + "-search-icon") || null,
2284
- "icon": getIcon(item._suggestion_type),
2285
- "type": item._suggestion_type + "-search-icon"
2286
- }, null)]), createVNode(SuggestionItem, {
2287
- "currentValue": _this15.currentValue,
2288
- "suggestion": item
2289
- }, null), _this15.renderAutoFill(item)]);
2290
- })]) : _this15.renderNoSuggestions(_this15.normalizedSuggestions)]);
2540
+ }), !_this17.showAIScreen && _this17.parsedSuggestions.map(function (item, itemIndex) {
2541
+ var index = indexOffset + itemIndex;
2542
+ if (Array.isArray(item)) {
2543
+ var sectionHtml = xss(item[0].sectionLabel);
2544
+ indexOffset += item.length - 1;
2545
+ return createVNode("div", {
2546
+ "key": "section-" + itemIndex,
2547
+ "class": "section-container"
2548
+ }, [sectionHtml ? createVNode("div", {
2549
+ "class": "section-header " + getClassName$1(_this17.$props.innerClass, 'section-label'),
2550
+ "key": "" + item[0].sectionId,
2551
+ "innerHTML": sectionHtml
2552
+ }, null) : null, createVNode("ul", {
2553
+ "class": "section-list"
2554
+ }, [item.map(function (sectionItem, sectionIndex) {
2555
+ var suggestionsHaveIcon = item.some(function (s) {
2556
+ return s.icon || s.iconURL;
2557
+ });
2558
+ if (renderItem) {
2559
+ return createVNode("li", mergeProps(getItemProps({
2560
+ item: sectionItem
2561
+ }), _transformOn(getItemEvents({
2562
+ item: sectionItem
2563
+ })), {
2564
+ "key": sectionItem._id + "_" + index + "_" + sectionIndex,
2565
+ "style": {
2566
+ justifyContent: 'flex-start',
2567
+ alignItems: 'center'
2568
+ },
2569
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this17.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this17.$props.innerClass, 'suggestion-item'))
2570
+ }), [renderItem(sectionItem)]);
2571
+ }
2572
+ if (sectionItem._suggestion_type === '_internal_a_i_trigger') {
2573
+ return createVNode("li", mergeProps(getItemProps({
2574
+ item: sectionItem
2575
+ }), _transformOn(getItemEvents({
2576
+ item: sectionItem
2577
+ })), {
2578
+ "key": sectionItem._id + "_" + index + "_" + sectionIndex,
2579
+ "style": {
2580
+ justifyContent: 'flex-start',
2581
+ alignItems: 'center'
2582
+ },
2583
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this17.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this17.$props.innerClass, 'suggestion-item'))
2584
+ }), [createVNode(SuggestionItem, {
2585
+ "currentValue": _this17.currentValue,
2586
+ "suggestion": sectionItem
2587
+ }, null)]);
2588
+ }
2589
+ return createVNode("li", mergeProps(getItemProps({
2590
+ item: sectionItem
2591
+ }), _transformOn(getItemEvents({
2592
+ item: sectionItem
2593
+ })), {
2594
+ "key": sectionItem._id + "_" + index + "_" + sectionIndex,
2595
+ "style": {
2596
+ justifyContent: 'flex-start',
2597
+ alignItems: 'center'
2598
+ },
2599
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this17.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this17.$props.innerClass, 'suggestion-item'))
2600
+ }), [createVNode("div", {
2601
+ "style": {
2602
+ padding: '0 10px 0 0',
2603
+ display: 'flex'
2604
+ }
2605
+ }, [createVNode(CustomSvg, {
2606
+ "key": sectionItem._suggestion_type + "-" + sectionIndex,
2607
+ "className": getClassName$1(_this17.$props.innerClass, sectionItem._suggestion_type + "-search-icon") || null,
2608
+ "icon": getIcon(sectionItem._suggestion_type, sectionItem, suggestionsHaveIcon),
2609
+ "type": sectionItem._suggestion_type + "-search-icon"
2610
+ }, null)]), createVNode(SuggestionItem, {
2611
+ "currentValue": _this17.currentValue,
2612
+ "suggestion": sectionItem
2613
+ }, null), _this17.renderActionIcon(sectionItem)]);
2614
+ })])]);
2615
+ }
2616
+ return createVNode("div", null, [createTextVNode("No suggestions")]);
2617
+ }), !_this17.showAIScreen && _this17.parsedSuggestions.length && _this17.$props.showSuggestionsFooter ? _this17.suggestionsFooter() : null]) : _this17.renderNoSuggestions(_this17.normalizedSuggestions)]);
2291
2618
  };
2292
2619
  return createVNode("div", {
2293
2620
  "class": suggestionsContainer
2294
2621
  }, [createVNode(InputGroup, {
2295
- "ref": _inputGroupRef
2622
+ "searchBox": true,
2623
+ "ref": _inputGroupRef,
2624
+ "isOpen": _this17.$data.isOpen
2296
2625
  }, {
2297
2626
  "default": function _default() {
2298
- return [_this15.renderInputAddonBefore(), createVNode(InputWrapper, null, {
2627
+ return [createVNode(Actions$1, null, {
2628
+ "default": function _default() {
2629
+ return [_this17.renderInputAddonBefore(), _this17.renderLeftIcons()];
2630
+ }
2631
+ }), createVNode(InputWrapper, null, {
2299
2632
  "default": function _default() {
2300
2633
  return [createVNode(TextArea, mergeProps(_transformOn(getInputEvents({
2301
- onInput: _this15.onInputChange,
2634
+ onInput: _this17.onInputChange,
2302
2635
  onBlur: function onBlur(e) {
2303
- _this15.$emit('blur', e, _this15.triggerQuery);
2636
+ _this17.$emit('blur', e, _this17.triggerQuery);
2304
2637
  },
2305
- onFocus: _this15.handleFocus,
2638
+ onFocus: _this17.handleFocus,
2306
2639
  onKeyPress: function onKeyPress(e) {
2307
- _this15.$emit('keyPress', e, _this15.triggerQuery);
2308
- _this15.$emit('key-press', e, _this15.triggerQuery);
2640
+ _this17.$emit('keyPress', e, _this17.triggerQuery);
2641
+ _this17.$emit('key-press', e, _this17.triggerQuery);
2309
2642
  },
2310
2643
  onKeyDown: function onKeyDown(e) {
2311
- return _this15.handleKeyDown(e, highlightedIndex);
2644
+ return _this17.handleKeyDown(e, highlightedIndex);
2312
2645
  },
2313
2646
  onKeyUp: function onKeyUp(e) {
2314
- _this15.$emit('keyUp', e, _this15.triggerQuery);
2315
- _this15.$emit('key-up', e, _this15.triggerQuery);
2647
+ _this17.$emit('keyUp', e, _this17.triggerQuery);
2648
+ _this17.$emit('key-up', e, _this17.triggerQuery);
2316
2649
  },
2317
2650
  onClick: function onClick() {
2318
2651
  setHighlightedIndex(null);
2319
2652
  }
2320
2653
  })), {
2321
- "id": _this15.$props.componentId + "-input",
2322
- "showIcon": _this15.$props.showIcon,
2323
- "showClear": _this15.$props.showClear,
2324
- "iconPosition": _this15.$props.iconPosition,
2325
- "ref": _this15.$props.innerRef,
2326
- "class": getClassName$1(_this15.$props.innerClass, 'input'),
2327
- "placeholder": _this15.$props.placeholder,
2328
- "autoFocus": _this15.$props.autoFocus,
2329
- "showFocusShortcutsIcon": _this15.$props.showFocusShortcutsIcon,
2330
- "showVoiceSearch": _this15.$props.showVoiceSearch
2654
+ "searchBox": true,
2655
+ "isOpen": _this17.$data.isOpen,
2656
+ "id": _this17.$props.componentId + "-input",
2657
+ "ref": _this17.$props.innerRef,
2658
+ "class": getClassName$1(_this17.$props.innerClass, 'input'),
2659
+ "placeholder": _this17.$props.placeholder,
2660
+ "autoFocus": _this17.$props.autoFocus
2331
2661
  }, getInputProps({
2332
- value: _this15.$data.currentValue === null ? '' : _this15.$data.currentValue
2662
+ value: _this17.$data.currentValue === null ? '' : _this17.$data.currentValue
2333
2663
  }), {
2334
- "themePreset": _this15.themePreset,
2664
+ "themePreset": _this17.themePreset,
2335
2665
  "autocomplete": "off"
2336
- }), null), _this15.renderIcons(), !expandSuggestionsContainer && renderSuggestionsDropdown()];
2666
+ }), null), !expandSuggestionsContainer && renderSuggestionsDropdown()];
2667
+ }
2668
+ }), createVNode(Actions$1, null, {
2669
+ "default": function _default() {
2670
+ return [_this17.renderRightIcons(), _this17.renderInputAddonAfter(), _this17.renderAskButtonElement(), _this17.renderEnterButtonElement()];
2337
2671
  }
2338
- }), _this15.renderInputAddonAfter(), _this15.renderAskButtonElement(), _this15.renderEnterButtonElement()];
2672
+ })];
2339
2673
  }
2340
- }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this15.renderTags()]);
2674
+ }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this17.renderTags()]);
2341
2675
  }
2342
2676
  }) : createVNode("div", {
2343
2677
  "class": suggestionsContainer
2344
2678
  }, [createVNode(InputGroup, {
2679
+ "searchBox": true,
2345
2680
  "ref": _inputGroupRef
2346
2681
  }, {
2347
2682
  "default": function _default() {
2348
- return [_this15.renderInputAddonBefore(), createVNode(InputWrapper, null, {
2683
+ return [createVNode(Actions$1, null, {
2684
+ "default": function _default() {
2685
+ return [_this17.renderInputAddonBefore(), _this17.renderLeftIcons()];
2686
+ }
2687
+ }), createVNode(InputWrapper, null, {
2349
2688
  "default": function _default() {
2350
2689
  return [createVNode(TextArea, mergeProps(_transformOn({
2351
2690
  blur: function blur(e) {
2352
- _this15.$emit('blur', e, _this15.triggerQuery);
2691
+ _this17.$emit('blur', e, _this17.triggerQuery);
2353
2692
  },
2354
2693
  keypress: function keypress(e) {
2355
- _this15.$emit('keyPress', e, _this15.triggerQuery);
2356
- _this15.$emit('key-press', e, _this15.triggerQuery);
2694
+ _this17.$emit('keyPress', e, _this17.triggerQuery);
2695
+ _this17.$emit('key-press', e, _this17.triggerQuery);
2357
2696
  },
2358
- input: _this15.onInputChange,
2697
+ input: _this17.onInputChange,
2359
2698
  focus: function focus(e) {
2360
- _this15.$emit('focus', e, _this15.triggerQuery);
2699
+ _this17.$emit('focus', e, _this17.triggerQuery);
2361
2700
  },
2362
- keydown: _this15.handleKeyDown,
2701
+ keydown: _this17.handleKeyDown,
2363
2702
  keyup: function keyup(e) {
2364
- _this15.$emit('keyUp', e, _this15.triggerQuery);
2365
- _this15.$emit('key-up', e, _this15.triggerQuery);
2703
+ _this17.$emit('keyUp', e, _this17.triggerQuery);
2704
+ _this17.$emit('key-up', e, _this17.triggerQuery);
2366
2705
  }
2367
2706
  }), {
2368
- "class": getClassName$1(_this15.$props.innerClass, 'input') || '',
2369
- "placeholder": _this15.$props.placeholder,
2370
- "autofocus": _this15.$props.autoFocus,
2371
- "value": _this15.$data.currentValue ? _this15.$data.currentValue : '',
2372
- "iconPosition": _this15.$props.iconPosition,
2373
- "showIcon": _this15.$props.showIcon,
2374
- "showClear": _this15.$props.showClear,
2375
- "ref": _this15.$props.innerRef,
2376
- "themePreset": _this15.themePreset
2377
- }), null), _this15.renderIcons()];
2707
+ "searchBox": true,
2708
+ "class": getClassName$1(_this17.$props.innerClass, 'input') || '',
2709
+ "placeholder": _this17.$props.placeholder,
2710
+ "autofocus": _this17.$props.autoFocus,
2711
+ "value": _this17.$data.currentValue ? _this17.$data.currentValue : '',
2712
+ "iconPosition": _this17.$props.iconPosition,
2713
+ "showIcon": _this17.$props.showIcon,
2714
+ "showClear": _this17.$props.showClear,
2715
+ "ref": _this17.$props.innerRef,
2716
+ "themePreset": _this17.themePreset
2717
+ }), null)];
2378
2718
  }
2379
- }), _this15.renderInputAddonAfter(), _this15.renderEnterButtonElement()];
2719
+ }), createVNode(Actions$1, null, {
2720
+ "default": function _default() {
2721
+ return [_this17.renderRightIcons(), _this17.renderInputAddonAfter(), _this17.renderEnterButtonElement()];
2722
+ }
2723
+ })];
2380
2724
  }
2381
2725
  })])];
2382
2726
  }
@@ -2462,6 +2806,7 @@ SBConnected.install = function (Vue) {
2462
2806
  // Add componentType for SSR
2463
2807
  SBConnected.componentType = componentTypes.searchBox;
2464
2808
 
2809
+ var _excluded$1 = ["_source"];
2465
2810
  function _isSlot$1(s) {
2466
2811
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
2467
2812
  }
@@ -2469,7 +2814,9 @@ var md$1 = new Remarkable();
2469
2814
  md$1.set({
2470
2815
  html: true,
2471
2816
  breaks: true,
2472
- xhtmlOut: true
2817
+ xhtmlOut: true,
2818
+ linkify: true,
2819
+ linkTarget: '_blank'
2473
2820
  });
2474
2821
  var _inputWrapperRef = 'inputWrapperRef';
2475
2822
  var _inputRef = 'inputRef';
@@ -2482,7 +2829,10 @@ var AIAnswer = defineComponent({
2482
2829
  messages: [],
2483
2830
  inputMessage: '',
2484
2831
  AISessionId: '',
2485
- error: null
2832
+ error: null,
2833
+ sourceDocIds: null,
2834
+ initialHits: null,
2835
+ isTriggered: false
2486
2836
  };
2487
2837
  this.internalComponent = props.componentId + "__internal";
2488
2838
  return this.__state;
@@ -2492,7 +2842,16 @@ var AIAnswer = defineComponent({
2492
2842
  from: 'theme_reactivesearch'
2493
2843
  }
2494
2844
  },
2495
- created: function created() {},
2845
+ created: function created() {
2846
+ if (this.$props.triggerOn === AI_TRIGGER_MODES.ALWAYS) {
2847
+ this.isTriggered = true;
2848
+ } else if (this.$props.triggerOn === AI_TRIGGER_MODES.QUESTION && this.dependentComponentValue && this.dependentComponentValue.endsWith('?')) {
2849
+ this.isTriggered = true;
2850
+ if (this.AISessionId) {
2851
+ this.handleSendMessage(null, false, '', true);
2852
+ }
2853
+ }
2854
+ },
2496
2855
  computed: {
2497
2856
  hasCustomRenderer: function hasCustomRenderer$1() {
2498
2857
  return hasCustomRenderer(this);
@@ -2505,6 +2864,9 @@ var AIAnswer = defineComponent({
2505
2864
  },
2506
2865
  errorMessageForMissingSessionId: function errorMessageForMissingSessionId() {
2507
2866
  return "AISessionId for " + this.$props.componentId + " is missing! AIAnswer component requires an AISessionId to function. Try reloading the App.";
2867
+ },
2868
+ hasTriggered: function hasTriggered() {
2869
+ return this.isTriggered;
2508
2870
  }
2509
2871
  },
2510
2872
  props: {
@@ -2543,13 +2905,26 @@ var AIAnswer = defineComponent({
2543
2905
  sessionIdFromStore: VueTypes.string,
2544
2906
  showComponent: types.boolRequired,
2545
2907
  componentError: types.componentObject,
2546
- style: types.style
2908
+ style: types.style,
2909
+ showSourceDocuments: VueTypes.bool.def(false),
2910
+ renderSourceDocument: types.func,
2911
+ onSourceClick: types.func,
2912
+ isAITyping: types.boolRequired,
2913
+ triggerOn: VueTypes.string.def(AI_TRIGGER_MODES.ALWAYS),
2914
+ renderTriggerMessage: types.func
2547
2915
  },
2548
2916
  mounted: function mounted() {},
2549
2917
  watch: {
2550
2918
  AIResponse: function AIResponse(newVal) {
2551
2919
  if (newVal) {
2552
- this.AISessionId = ((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || null;
2920
+ if (this.$props.showSourceDocuments && newVal.response && newVal.response.answer && Array.isArray(newVal.response.answer.documentIds)) {
2921
+ this.sourceDocIds = newVal.response.answer.documentIds;
2922
+ var localCache = getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) && getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY)[this.$props.componentId];
2923
+ if (localCache && localCache.meta && localCache.meta.hits) {
2924
+ this.initialHits = localCache.meta.hits;
2925
+ }
2926
+ }
2927
+ this.AISessionId = ((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || (((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).response || {}).sessionId;
2553
2928
  var messagesHistory = newVal.messages,
2554
2929
  response = newVal.response;
2555
2930
  var finalMessages = [];
@@ -2560,7 +2935,7 @@ var AIAnswer = defineComponent({
2560
2935
  }
2561
2936
 
2562
2937
  // pushing message history so far
2563
- if (messagesHistory && messagesHistory && Array.isArray(messagesHistory)) {
2938
+ if (messagesHistory && Array.isArray(messagesHistory)) {
2564
2939
  finalMessages.push.apply(finalMessages, messagesHistory.filter(function (msg) {
2565
2940
  return msg.role !== AI_ROLES.SYSTEM;
2566
2941
  }));
@@ -2585,6 +2960,9 @@ var AIAnswer = defineComponent({
2585
2960
  loading: this.$props.isAIResponseLoading || this.$props.isLoading,
2586
2961
  error: this.$props.AIResponseError
2587
2962
  });
2963
+ if (newVal && newVal.hits && newVal.hits.hits) {
2964
+ this.initialHits = newVal.hits.hits;
2965
+ }
2588
2966
  },
2589
2967
  isAIResponseLoading: function isAIResponseLoading(newVal) {
2590
2968
  this.$emit('on-data', {
@@ -2609,7 +2987,7 @@ var AIAnswer = defineComponent({
2609
2987
  },
2610
2988
  AIResponseError: function AIResponseError(newVal) {
2611
2989
  this.error = newVal;
2612
- this.AISessionId = ((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || null;
2990
+ this.AISessionId = ((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || (((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).response || {}).sessionId;
2613
2991
  if (this.error && !this.AISessionId) {
2614
2992
  var errorMessage = this.errorMessageForMissingSessionId;
2615
2993
  this.error = {
@@ -2630,7 +3008,7 @@ var AIAnswer = defineComponent({
2630
3008
  componentError: function componentError(newVal) {
2631
3009
  var _this = this;
2632
3010
  if (newVal && newVal._bodyBlob) {
2633
- this.AISessionId = ((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || null;
3011
+ this.AISessionId = ((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || (((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).response || {}).sessionId;
2634
3012
  if (!this.AISessionId) {
2635
3013
  this.generateNewSessionId();
2636
3014
  }
@@ -2653,23 +3031,154 @@ var AIAnswer = defineComponent({
2653
3031
  console.error('Error reading component error text data:', error);
2654
3032
  });
2655
3033
  }
3034
+ },
3035
+ showComponent: function showComponent() {
3036
+ if (this.$props.triggerOn === AI_TRIGGER_MODES.QUESTION && this.$props.dependentComponentValue.endsWith('?')) {
3037
+ this.isTriggered = true;
3038
+ }
3039
+ },
3040
+ dependentComponentValue: function dependentComponentValue(newVal) {
3041
+ if (this.$props.triggerOn === AI_TRIGGER_MODES.QUESTION && newVal && newVal.endsWith('?')) {
3042
+ this.isTriggered = true;
3043
+ if (this.AISessionId) {
3044
+ this.handleSendMessage(null, false, '', true);
3045
+ }
3046
+ } else if (this.hasTriggered && this.$props.triggerOn !== AI_TRIGGER_MODES.ALWAYS) {
3047
+ this.isTriggered = false;
3048
+ }
3049
+ },
3050
+ AISessionId: function AISessionId(newVal) {
3051
+ if (newVal) {
3052
+ if (this.$props.triggerOn === AI_TRIGGER_MODES.QUESTION && this.dependentComponentValue && this.dependentComponentValue.endsWith('?') || this.$props.triggerOn === AI_TRIGGER_MODES.ALWAYS) {
3053
+ this.handleSendMessage(null, false, '', true);
3054
+ }
3055
+ }
3056
+ },
3057
+ triggerOn: function triggerOn(newVal) {
3058
+ if (newVal === AI_TRIGGER_MODES.ALWAYS) {
3059
+ this.isTriggered = true;
3060
+ }
2656
3061
  }
2657
3062
  },
2658
3063
  methods: {
2659
- generateNewSessionId: function generateNewSessionId() {
3064
+ renderTriggerMessageFunc: function renderTriggerMessageFunc() {
3065
+ var triggerOn = this.$props.triggerOn;
3066
+ if (this.$props.renderTriggerMessage) {
3067
+ return this.$props.renderTriggerMessage;
3068
+ }
3069
+ if (this.$slots.renderTriggerMessage) {
3070
+ return this.$slots.renderTriggerMessage();
3071
+ }
3072
+ if (triggerOn === AI_TRIGGER_MODES.QUESTION) {
3073
+ if (!this.dependentComponentValue.endsWith('?')) {
3074
+ return createVNode("span", null, [createVNode("span", {
3075
+ "role": "img",
3076
+ "aria-label": "bulb"
3077
+ }, [createTextVNode("\uD83D\uDCA1")]), createTextVNode("End your question with a question mark (?)")]);
3078
+ }
3079
+ } else if (triggerOn === AI_TRIGGER_MODES.MANUAL) {
3080
+ return createVNode("span", null, [createTextVNode("Click here to ask AI"), ' ', createVNode("span", {
3081
+ "role": "img",
3082
+ "aria-label": "bulb"
3083
+ }, [createTextVNode("\uD83E\uDD16")])]);
3084
+ }
3085
+ return null;
3086
+ },
3087
+ handleTriggerClick: function handleTriggerClick() {
3088
+ if (this.$props.triggerOn === AI_TRIGGER_MODES.MANUAL) {
3089
+ this.handleSendMessage(null, false, '', true);
3090
+ this.isTriggered = true;
3091
+ }
3092
+ },
3093
+ getAISourceObjects: function getAISourceObjects() {
2660
3094
  var _this2 = this;
3095
+ var sourceObjects = [];
3096
+ if (!this.AIResponse) return sourceObjects;
3097
+ var docIds = this.sourceDocIds || [];
3098
+ if (this.initialHits) {
3099
+ docIds.forEach(function (id) {
3100
+ var foundSourceObj = _this2.initialHits.find(function (hit) {
3101
+ return hit._id === id;
3102
+ }) || {};
3103
+ if (foundSourceObj) {
3104
+ var _foundSourceObj$_sour = foundSourceObj._source,
3105
+ _source = _foundSourceObj$_sour === void 0 ? {} : _foundSourceObj$_sour,
3106
+ rest = _objectWithoutPropertiesLoose(foundSourceObj, _excluded$1);
3107
+ sourceObjects.push(_extends({}, rest, _source));
3108
+ }
3109
+ });
3110
+ } else {
3111
+ sourceObjects.push.apply(sourceObjects, docIds.map(function (id) {
3112
+ return {
3113
+ _id: id
3114
+ };
3115
+ }));
3116
+ }
3117
+ return sourceObjects;
3118
+ },
3119
+ renderAIScreenFooter: function renderAIScreenFooter() {
3120
+ var _slot2;
3121
+ var _this3 = this;
3122
+ var _ref = this.$props || {},
3123
+ _ref$showSourceDocume = _ref.showSourceDocuments,
3124
+ showSourceDocuments = _ref$showSourceDocume === void 0 ? true : _ref$showSourceDocume,
3125
+ _ref$onSourceClick = _ref.onSourceClick,
3126
+ onSourceClick = _ref$onSourceClick === void 0 ? function () {} : _ref$onSourceClick,
3127
+ renderSourceDocument = _ref.renderSourceDocument;
3128
+ var customRenderSourceDoc = renderSourceDocument || this.$slots.renderSourceDocument;
3129
+ if (this.isLoadingState || this.isAITyping) {
3130
+ return null;
3131
+ }
3132
+ var renderSourceDocumentLabel = function renderSourceDocumentLabel(sourceObj) {
3133
+ if (customRenderSourceDoc) {
3134
+ return customRenderSourceDoc(sourceObj);
3135
+ }
3136
+ return sourceObj._id;
3137
+ };
3138
+ return showSourceDocuments && Array.isArray(this.sourceDocIds) && this.sourceDocIds.length ? createVNode(Footer, {
3139
+ "themePreset": this.$props.themePreset,
3140
+ "style": {
3141
+ marginTop: '1.5rem',
3142
+ background: 'inherit'
3143
+ }
3144
+ }, {
3145
+ "default": function _default() {
3146
+ return [createTextVNode("Summary generated using the following sources:"), ' ', createVNode(SourceTags, null, _isSlot$1(_slot2 = _this3.getAISourceObjects().map(function (el) {
3147
+ var _slot;
3148
+ return createVNode(Button, {
3149
+ "class": "--ai-source-tag " + (getClassName$2(_this3.$props.innerClass, 'ai-source-tag') || ''),
3150
+ "info": true,
3151
+ "onClick": function onClick() {
3152
+ return onSourceClick && onSourceClick(el);
3153
+ },
3154
+ "key": el._id
3155
+ }, _isSlot$1(_slot = renderSourceDocumentLabel(el)) ? _slot : {
3156
+ "default": function _default() {
3157
+ return [_slot];
3158
+ }
3159
+ });
3160
+ })) ? _slot2 : {
3161
+ "default": function _default() {
3162
+ return [_slot2];
3163
+ }
3164
+ })];
3165
+ }
3166
+ }) : null;
3167
+ },
3168
+ generateNewSessionId: function generateNewSessionId() {
3169
+ var _this4 = this;
2661
3170
  var newSessionPromise = this.createAISession();
2662
3171
  newSessionPromise.then(function (res) {
2663
- _this2.AISessionId = res.AIsessionId;
3172
+ _this4.AISessionId = res.AIsessionId;
2664
3173
  })["catch"](function (e) {
2665
3174
  console.error(e);
2666
3175
  });
2667
3176
  },
2668
3177
  scrollToBottom: function scrollToBottom() {
2669
- var _this3 = this;
3178
+ var _this5 = this;
2670
3179
  this.$nextTick(function () {
2671
- var _this3$$refs;
2672
- var messageContainer = (_this3$$refs = _this3.$refs) == null ? void 0 : _this3$$refs[_this3.$props.innerRef];
3180
+ var _this5$$refs;
3181
+ var messageContainer = (_this5$$refs = _this5.$refs) == null ? void 0 : _this5$$refs[_this5.$props.innerRef];
2673
3182
  if (messageContainer && messageContainer.$el) {
2674
3183
  messageContainer.$el.scrollTo({
2675
3184
  top: messageContainer.$el.scrollHeight,
@@ -2682,24 +3191,33 @@ var AIAnswer = defineComponent({
2682
3191
  this.inputMessage = e.target.value;
2683
3192
  this.handleTextAreaHeightChange();
2684
3193
  },
2685
- handleSendMessage: function handleSendMessage(e, isRetry, text) {
3194
+ handleSendMessage: function handleSendMessage(e, isRetry, text, fetchMeta) {
2686
3195
  if (isRetry === void 0) {
2687
3196
  isRetry = false;
2688
3197
  }
2689
3198
  if (text === void 0) {
2690
3199
  text = this.inputMessage;
2691
3200
  }
3201
+ if (fetchMeta === void 0) {
3202
+ fetchMeta = false;
3203
+ }
2692
3204
  if (typeof e === 'object' && e !== null) e.preventDefault();
2693
- if (text.trim()) {
3205
+ if (text.trim() || !text && !e) {
2694
3206
  if (this.isLoadingState) {
2695
3207
  return;
2696
3208
  }
2697
3209
  if (this.AISessionId) {
2698
- if (!isRetry) this.messages = [].concat(this.messages, [{
2699
- content: text,
2700
- role: AI_ROLES.USER
2701
- }]);
2702
- this.getAIResponse(this.AISessionId, this.componentId, text);
3210
+ if (!isRetry) {
3211
+ var finalMessages = [].concat(this.messages);
3212
+ if (text) {
3213
+ finalMessages.push({
3214
+ content: text,
3215
+ role: AI_ROLES.USER
3216
+ });
3217
+ }
3218
+ this.messages = [].concat(finalMessages);
3219
+ }
3220
+ this.getAIResponse(this.AISessionId, this.componentId, text, fetchMeta);
2703
3221
  } else {
2704
3222
  console.error(this.errorMessageForMissingSessionId);
2705
3223
  this.error = {
@@ -2748,7 +3266,6 @@ var AIAnswer = defineComponent({
2748
3266
  return null;
2749
3267
  },
2750
3268
  handleKeyPress: function handleKeyPress(e) {
2751
- window.console.log('e', e);
2752
3269
  if (e.key === 'Enter') {
2753
3270
  this.handleSendMessage(e);
2754
3271
  this.inputMessage = '';
@@ -2780,15 +3297,15 @@ var AIAnswer = defineComponent({
2780
3297
  if (typeof window === 'undefined') return false;
2781
3298
  return showVoiceSearch && (window.webkitSpeechRecognition || window.SpeechRecognition);
2782
3299
  },
2783
- handleVoiceResults: function handleVoiceResults(_ref) {
2784
- var results = _ref.results;
3300
+ handleVoiceResults: function handleVoiceResults(_ref2) {
3301
+ var results = _ref2.results;
2785
3302
  if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
2786
3303
  this.handleSendMessage(null, false, results[0][0].transcript.trim());
2787
3304
  }
2788
3305
  },
2789
3306
  renderIcons: function renderIcons() {
2790
- var _this4 = this;
2791
- var _slot, _slot2;
3307
+ var _this6 = this;
3308
+ var _slot3, _slot4;
2792
3309
  var _this$$props = this.$props,
2793
3310
  getMicInstance = _this$$props.getMicInstance,
2794
3311
  showVoiceInput = _this$$props.showVoiceInput,
@@ -2801,14 +3318,14 @@ var AIAnswer = defineComponent({
2801
3318
  "positionType": "absolute"
2802
3319
  }, {
2803
3320
  "default": function _default() {
2804
- return [!_this4.isLoadingState && _this4.AISessionId && _this4.shouldMicRender(showVoiceInput) && createVNode(Mic, {
3321
+ return [!_this6.isLoadingState && _this6.AISessionId && _this6.shouldMicRender(showVoiceInput) && createVNode(Mic, {
2805
3322
  "getInstance": getMicInstance,
2806
3323
  "render": renderMic,
2807
- "handleResult": _this4.handleVoiceResults,
3324
+ "handleResult": _this6.handleVoiceResults,
2808
3325
  "class": getClassName$2(innerClass, 'ai-search-mic') || null
2809
- }, null), iconPosition === 'right' && createVNode(IconWrapper, null, _isSlot$1(_slot = _this4.renderIcon()) ? _slot : {
3326
+ }, null), iconPosition === 'right' && createVNode(IconWrapper, null, _isSlot$1(_slot3 = _this6.renderIcon()) ? _slot3 : {
2810
3327
  "default": function _default() {
2811
- return [_slot];
3328
+ return [_slot3];
2812
3329
  }
2813
3330
  })];
2814
3331
  }
@@ -2818,9 +3335,9 @@ var AIAnswer = defineComponent({
2818
3335
  "positionType": "absolute"
2819
3336
  }, {
2820
3337
  "default": function _default() {
2821
- return [iconPosition === 'left' && createVNode(IconWrapper, null, _isSlot$1(_slot2 = _this4.renderIcon()) ? _slot2 : {
3338
+ return [iconPosition === 'left' && createVNode(IconWrapper, null, _isSlot$1(_slot4 = _this6.renderIcon()) ? _slot4 : {
2822
3339
  "default": function _default() {
2823
- return [_slot2];
3340
+ return [_slot4];
2824
3341
  }
2825
3342
  })];
2826
3343
  }
@@ -2830,7 +3347,7 @@ var AIAnswer = defineComponent({
2830
3347
  this.handleSendMessage(e);
2831
3348
  },
2832
3349
  renderEnterButtonElement: function renderEnterButtonElement() {
2833
- var _this5 = this;
3350
+ var _this7 = this;
2834
3351
  var _this$$props2 = this.$props,
2835
3352
  enterButton = _this$$props2.enterButton,
2836
3353
  innerClass = _this$$props2.innerClass;
@@ -2838,16 +3355,16 @@ var AIAnswer = defineComponent({
2838
3355
  if (enterButton) {
2839
3356
  var getEnterButtonMarkup = function getEnterButtonMarkup() {
2840
3357
  if (renderEnterButton) {
2841
- return renderEnterButton(_this5.enterButtonOnClick);
3358
+ return renderEnterButton(_this7.enterButtonOnClick);
2842
3359
  }
2843
3360
  return createVNode(SendButton, {
2844
3361
  "primary": true,
2845
3362
  "type": "submit",
2846
3363
  "tabIndex": 0,
2847
- "onClick": _this5.handleSendMessage,
2848
- "onKeyPress": _this5.handleKeyPress,
3364
+ "onClick": _this7.handleSendMessage,
3365
+ "onKeyPress": _this7.handleKeyPress,
2849
3366
  "class": "ask-btn " + getClassName$2(innerClass, 'ai-enter-button'),
2850
- "disabled": _this5.isLoadingState || !_this5.AISessionId
3367
+ "disabled": _this7.isLoadingState || !_this7.AISessionId
2851
3368
  }, {
2852
3369
  "default": function _default() {
2853
3370
  return [createTextVNode("Send")];
@@ -2870,9 +3387,9 @@ var AIAnswer = defineComponent({
2870
3387
  return getComponent(data, this);
2871
3388
  },
2872
3389
  handleTextAreaHeightChange: function handleTextAreaHeightChange() {
2873
- var _this$$refs, _this$$refs$_inputRef, _this$$refs2, _this$$refs2$_inputWr, _this$$refs3;
2874
- var textArea = (_this$$refs = this.$refs) == null ? void 0 : (_this$$refs$_inputRef = _this$$refs[_inputRef]) == null ? void 0 : _this$$refs$_inputRef.$el;
2875
- var inputWrapper = (_this$$refs2 = this.$refs) == null ? void 0 : (_this$$refs2$_inputWr = _this$$refs2[_inputWrapperRef]) == null ? void 0 : _this$$refs2$_inputWr.$el;
3390
+ var _this$$refs, _this$$refs2, _this$$refs3;
3391
+ var textArea = (_this$$refs = this.$refs) == null || (_this$$refs = _this$$refs[_inputRef]) == null ? void 0 : _this$$refs.$el;
3392
+ var inputWrapper = (_this$$refs2 = this.$refs) == null || (_this$$refs2 = _this$$refs2[_inputWrapperRef]) == null ? void 0 : _this$$refs2.$el;
2876
3393
  var errorContainer = (_this$$refs3 = this.$refs) == null ? void 0 : _this$$refs3[_errorContainerRef];
2877
3394
  if (textArea) {
2878
3395
  textArea.style.height = '42px';
@@ -2890,6 +3407,20 @@ var AIAnswer = defineComponent({
2890
3407
  }
2891
3408
  this.$forceUpdate();
2892
3409
  }
3410
+ },
3411
+ getTitle: function getTitle() {
3412
+ var _this8 = this;
3413
+ var hasTitle = this.$props.title || this.$slots.title || null;
3414
+ if (hasTitle) {
3415
+ return createVNode(Title, {
3416
+ "class": getClassName$2(this.$props.innerClass, 'ai-title') || null
3417
+ }, {
3418
+ "default": function _default() {
3419
+ return [_this8.$props.title || _this8.$slots.title()];
3420
+ }
3421
+ });
3422
+ }
3423
+ return null;
2893
3424
  }
2894
3425
  },
2895
3426
  beforeUnmount: function beforeUnmount() {
@@ -2904,55 +3435,62 @@ var AIAnswer = defineComponent({
2904
3435
  }
2905
3436
  },
2906
3437
  render: function render() {
2907
- var _slot3;
2908
- var _this6 = this;
3438
+ var _slot5;
3439
+ var _this9 = this;
2909
3440
  var props = this.$props;
2910
3441
  if (!this.shouldShowComponent) {
2911
3442
  return null;
2912
3443
  }
3444
+ if (!this.isTriggered) {
3445
+ return createVNode(Chatbox, {
3446
+ "style": props.style || {}
3447
+ }, {
3448
+ "default": function _default() {
3449
+ return [_this9.getTitle(), createVNode("div", {
3450
+ "class": "--trigger-message-wrapper",
3451
+ "onClick": _this9.handleTriggerClick,
3452
+ "aria-hidden": "true"
3453
+ }, [_this9.renderTriggerMessageFunc()])];
3454
+ }
3455
+ });
3456
+ }
2913
3457
  return createVNode(Chatbox, {
2914
3458
  "style": props.style || {}
2915
3459
  }, {
2916
3460
  "default": function _default() {
2917
- return [_this6.$props.title && createVNode(Title, {
2918
- "class": getClassName$2(_this6.$props.innerClass, 'title') || ''
2919
- }, {
2920
- "default": function _default() {
2921
- return [_this6.$props.title];
2922
- }
2923
- }), createVNode(ChatContainer, {
3461
+ return [_this9.getTitle(), createVNode(ChatContainer, {
2924
3462
  "class": "--ai-chat-container",
2925
3463
  "theme": props.theme,
2926
3464
  "showInput": props.showInput
2927
3465
  }, {
2928
3466
  "default": function _default() {
2929
- return [_this6.hasCustomRenderer && createVNode(MessagesContainer, {
2930
- "themePreset": _this6.themePreset,
3467
+ return [_this9.hasCustomRenderer && createVNode(MessagesContainer, {
3468
+ "themePreset": _this9.themePreset,
2931
3469
  "theme": props.theme,
2932
- "ref": _this6.$props.innerRef,
3470
+ "ref": _this9.$props.innerRef,
2933
3471
  "class": "--ai-message-container " + (getClassName$2(props.innerClass, 'ai-message-container') || '')
2934
- }, _isSlot$1(_slot3 = _this6.getComponent()) ? _slot3 : {
3472
+ }, _isSlot$1(_slot5 = _this9.getComponent()) ? _slot5 : {
2935
3473
  "default": function _default() {
2936
- return [_slot3];
3474
+ return [_slot5];
2937
3475
  }
2938
- }), !_this6.hasCustomRenderer && createVNode(MessagesContainer, {
2939
- "themePreset": _this6.themePreset,
3476
+ }), !_this9.hasCustomRenderer && createVNode(MessagesContainer, {
3477
+ "themePreset": _this9.themePreset,
2940
3478
  "theme": props.theme,
2941
- "ref": _this6.$props.innerRef,
3479
+ "ref": _this9.$props.innerRef,
2942
3480
  "class": "--ai-message-container " + (getClassName$2(props.innerClass, 'ai-message-container') || '')
2943
3481
  }, {
2944
3482
  "default": function _default() {
2945
- return [_this6.messages.map(function (message, index) {
3483
+ return [_this9.messages.map(function (message, index) {
2946
3484
  return createVNode(Message, {
2947
3485
  "key": index,
2948
3486
  "isSender": message.role === AI_ROLES.USER,
2949
3487
  "innerHTML": md$1.render(message.content),
2950
- "themePreset": _this6.themePreset,
3488
+ "themePreset": _this9.themePreset,
2951
3489
  "theme": props.theme,
2952
3490
  "class": "--ai-answer-message " + (getClassName$2(props.innerClass, 'ai-message') || '')
2953
3491
  }, null);
2954
- }), _this6.isLoadingState && createVNode(Message, {
2955
- "themePreset": _this6.themePreset,
3492
+ }), _this9.isLoadingState && createVNode(Message, {
3493
+ "themePreset": _this9.themePreset,
2956
3494
  "theme": props.theme,
2957
3495
  "isSender": false,
2958
3496
  "class": "--ai-answer-message " + (getClassName$2(props.innerClass, 'ai-message') || null)
@@ -2961,31 +3499,31 @@ var AIAnswer = defineComponent({
2961
3499
  return [createVNode(TypingIndicator, null, {
2962
3500
  "default": function _default() {
2963
3501
  return [createVNode(TypingDot, {
2964
- "themePreset": _this6.themePreset
3502
+ "themePreset": _this9.themePreset
2965
3503
  }, null), createVNode(TypingDot, {
2966
- "themePreset": _this6.themePreset
3504
+ "themePreset": _this9.themePreset
2967
3505
  }, null), createVNode(TypingDot, {
2968
- "themePreset": _this6.themePreset
3506
+ "themePreset": _this9.themePreset
2969
3507
  }, null)];
2970
3508
  }
2971
3509
  })];
2972
3510
  }
2973
3511
  })];
2974
3512
  }
2975
- }), _this6.renderErrorComponent(), ' ', props.showFeedback && createVNode("div", {
3513
+ }), _this9.renderErrorComponent(), ' ', props.showFeedback && !_this9.isLoadingState && !_this9.isAITyping && createVNode("div", {
2976
3514
  "class": "--ai-answer-feedback-container " + (getClassName$2(props.innerClass, 'ai-feedback') || '')
2977
3515
  }, [createVNode(AIFeedback, {
2978
- "hideUI": _this6.isLoadingState || !_this6.sessionId,
2979
- "key": _this6.sessionId,
3516
+ "hideUI": _this9.isLoadingState || !_this9.sessionId,
3517
+ "key": _this9.sessionId,
2980
3518
  "onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
2981
- _this6.trackUsefullness(_this6.sessionId, {
3519
+ _this9.trackUsefullness(_this9.sessionId, {
2982
3520
  useful: useful,
2983
3521
  reason: reason
2984
3522
  });
2985
3523
  }
2986
- }, null)]), props.showInput && createVNode(MessageInputContainer, {
3524
+ }, null)]), ' ', _this9.renderAIScreenFooter(), props.showInput && !_this9.isLoadingState && !_this9.isAITyping && createVNode(MessageInputContainer, {
2987
3525
  "class": "--ai-input-container",
2988
- "onSubmit": _this6.handleSendMessage
3526
+ "onSubmit": _this9.handleSendMessage
2989
3527
  }, {
2990
3528
  "default": function _default() {
2991
3529
  return [createVNode(InputGroup, {
@@ -3001,19 +3539,19 @@ var AIAnswer = defineComponent({
3001
3539
  "ref": _inputRef,
3002
3540
  "placeholder": props.placeholder,
3003
3541
  "enterButton": props.enterButton,
3004
- "value": _this6.inputMessage,
3005
- "onInput": _this6.handleMessageInputChange,
3542
+ "value": _this9.inputMessage,
3543
+ "onInput": _this9.handleMessageInputChange,
3006
3544
  "id": props.componentId + "-ai-input",
3007
3545
  "showIcon": props.showIcon,
3008
3546
  "iconPosition": props.iconPosition,
3009
- "themePreset": _this6.themePreset,
3010
- "disabled": _this6.isLoadingState || !_this6.AISessionId,
3547
+ "themePreset": _this9.themePreset,
3548
+ "disabled": _this9.isLoadingState || !_this9.AISessionId,
3011
3549
  "class": getClassName$2(props.innerClass, 'ai-input') || null
3012
- }, null), ' ', _this6.renderIcons()];
3550
+ }, null), ' ', _this9.renderIcons()];
3013
3551
  }
3014
3552
  })];
3015
3553
  }
3016
- }), _this6.renderEnterButtonElement()];
3554
+ }), _this9.renderEnterButtonElement()];
3017
3555
  }
3018
3556
  }), ' '];
3019
3557
  }
@@ -3031,9 +3569,11 @@ var mapStateToProps$1 = function mapStateToProps(state, props) {
3031
3569
  // eslint-disable-next-line prefer-destructuring
3032
3570
  dependencyComponent = dependencyComponent[0];
3033
3571
  }
3034
- var showComponent = state.selectedValues[dependencyComponent] && state.selectedValues[dependencyComponent].value;
3572
+ var showComponent = !!(state.selectedValues[dependencyComponent] && state.selectedValues[dependencyComponent].value);
3573
+ var dependentComponentValue = state.selectedValues[dependencyComponent] && state.selectedValues[dependencyComponent].value || '';
3035
3574
  return {
3036
3575
  showComponent: showComponent,
3576
+ dependentComponentValue: dependentComponentValue,
3037
3577
  AIResponse: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response,
3038
3578
  isAIResponseLoading: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].isLoading,
3039
3579
  AIResponseError: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].error,
@@ -3041,11 +3581,17 @@ var mapStateToProps$1 = function mapStateToProps(state, props) {
3041
3581
  themePreset: state.config.themePreset,
3042
3582
  isLoading: state.isLoading[props.componentId] || false,
3043
3583
  sessionIdFromStore: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.sessionId || '',
3044
- componentError: state.error[props.componentId]
3584
+ componentError: state.error[props.componentId] || null,
3585
+ isAITyping: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.isTyping || false
3045
3586
  };
3046
3587
  };
3047
3588
  var mapDispatchToProps$1 = {
3048
- getAIResponse: fetchAIResponse,
3589
+ getAIResponse: function getAIResponse(sessionId, componentId, message, shouldFetchMeta) {
3590
+ if (shouldFetchMeta === void 0) {
3591
+ shouldFetchMeta = false;
3592
+ }
3593
+ return fetchAIResponse(sessionId, componentId, message, null, shouldFetchMeta);
3594
+ },
3049
3595
  trackUsefullness: recordAISessionUsefulness,
3050
3596
  createAISession: createAISession
3051
3597
  };
@@ -3061,8 +3607,8 @@ AIConnected.install = function (Vue) {
3061
3607
  // Add componentType for SSR
3062
3608
  AIConnected.componentType = componentTypes.AIAnswer;
3063
3609
 
3064
- var _templateObject$8, _templateObject2$4;
3065
- var HierarchicalMenuList = styled('ul')(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteralLoose(["\n\tlist-style: none;\n\tpadding: 0;\n\tmargin: 0;\n\tmax-height: 0;\n\toverflow: hidden;\n\n\t&.--open {\n\t\tmax-height: 100%;\n\t}\n"])));
3610
+ var _templateObject$9, _templateObject2$4;
3611
+ var HierarchicalMenuList = styled('ul')(_templateObject$9 || (_templateObject$9 = _taggedTemplateLiteralLoose(["\n\tlist-style: none;\n\tpadding: 0;\n\tmargin: 0;\n\tmax-height: 0;\n\toverflow: hidden;\n\n\t&.--open {\n\t\tmax-height: 100%;\n\t}\n"])));
3066
3612
  var HierarchicalMenuListItem = styled('li')(_templateObject2$4 || (_templateObject2$4 = _taggedTemplateLiteralLoose(["\n\tfont-weight: 400;\n\tline-height: 1.5;\n\tbox-sizing: border-box;\n\n\ta {\n\t\tcolor: #424242;\n\t\ttext-decoration: none;\n\t\tgap: 5px;\n\t\t.--leaf-icon,\n\t\t.--folder-icon {\n\t\t\tline-height: 15px;\n\t\t\tsvg {\n\t\t\t\theight: 15px;\n\t\t\t}\n\t\t}\n\n\t\tinput {\n\t\t\tmargin: 0;\n\t\t\tcursor: pointer;\n\t\t}\n\t}\n\n\t.--switcher-icon {\n\t\ttransition: all 0.2s ease-in;\n\t\tmargin-right: 2px;\n\t}\n\t.--list-child {\n\t\tpadding-left: 1rem;\n\t\tposition: relative;\n\t\t&:before {\n\t\t\theight: 100%;\n\t\t\tcontent: '';\n\t\t\tposition: absolute;\n\t\t\tborder-left: 1px solid #787878;\n\t\t\twidth: 0;\n\t\t\tleft: 19px;\n\t\t\t", ";\n\t\t}\n\n\t\t&.--show-switcher-icon {\n\t\t\tpadding-left: 36px;\n\t\t}\n\t}\n\t.--list-item-label {\n\t\tline-height: 100%;\n\t}\n\t.--list-item-count {\n\t\tmargin-left: 10px;\n\t\tpadding: 0.1rem 0.4rem;\n\t\tfont-size: 0.8rem;\n\t\tcolor: #424242;\n\t\tbackground-color: #dee1e6;\n\t\tborder-radius: 8px;\n\t}\n\t&.-selected-item {\n\t\tfont-weight: 700 !important;\n\t}\n\t&.-expanded-item {\n\t\t& > a {\n\t\t\t& div > .--switcher-icon {\n\t\t\t\ttransform: rotate(90deg);\n\t\t\t}\n\t\t}\n\t}\n\t.--list-item-label-count-wrapper {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\t&:hover {\n\t\t\t.--list-item-count,\n\t\t\t.--list-item-label {\n\t\t\t\tfont-weight: 700;\n\t\t\t}\n\t\t}\n\t}\n"])), function (props) {
3067
3613
  return !props.showLine && "\n\t\t\t\t\tdisplay: none;\n\t\t\t\t";
3068
3614
  });