@appbaseio/reactivesearch-vue 3.0.0-rc.8 → 3.1.0-rc.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.
- package/dist/@appbaseio/reactivesearch-vue.umd.js +23301 -41871
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +32 -32
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/{Button-f96a0570.js → Button-d4da7470.js} +7 -14
- package/dist/cjs/{ComponentWrapper-0b9ffb1a.js → ComponentWrapper-b5c78446.js} +1 -4
- package/dist/cjs/{DropDown-82d92f8b.js → DropDown-ec31bd3f.js} +8 -19
- package/dist/cjs/DynamicRangeSlider.js +3 -3
- package/dist/cjs/Input-497be42a.js +74 -0
- package/dist/cjs/MultiDropdownList.js +7 -8
- package/dist/cjs/MultiList.js +5 -5
- package/dist/cjs/MultiRange.js +4 -4
- package/dist/cjs/{Pagination-bcf8af5f.js → Pagination-b953a80a.js} +2 -2
- package/dist/cjs/{PreferencesConsumer-85dee673.js → PreferencesConsumer-7bee3c57.js} +1 -1
- package/dist/cjs/RangeInput.js +5 -5
- package/dist/cjs/RangeSlider.js +4 -4
- package/dist/cjs/ReactiveBase.js +23 -21
- package/dist/cjs/ReactiveComponent.js +4 -4
- package/dist/cjs/ReactiveGoogleMap.js +6 -7
- package/dist/cjs/ReactiveList.js +6 -6
- package/dist/cjs/ResultCard.js +1 -1
- package/dist/cjs/ResultList.js +1 -1
- package/dist/cjs/SelectedFilters.js +3 -4
- package/dist/cjs/SingleDropdownList.js +7 -8
- package/dist/cjs/SingleList.js +5 -5
- package/dist/cjs/SingleRange.js +4 -4
- package/dist/cjs/StateProvider.js +1 -1
- package/dist/cjs/ToggleButton.js +5 -6
- package/dist/cjs/{index-779ed366.js → index-1f41363f.js} +7 -3
- package/dist/cjs/index.js +9 -13
- package/dist/cjs/{install-2a1c953d.js → install-fd2155c7.js} +221 -1599
- package/dist/cjs/install.js +9 -12
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/{vueTypes-a5f1745e.js → vueTypes-1bf00978.js} +0 -18
- package/dist/es/{Button-5c2cf399.js → Button-fd869491.js} +7 -14
- package/dist/es/{ComponentWrapper-a2635cfc.js → ComponentWrapper-e91c9d43.js} +1 -4
- package/dist/es/{DropDown-8075451b.js → DropDown-74c20431.js} +9 -19
- package/dist/es/DynamicRangeSlider.js +3 -3
- package/dist/es/Input-f7499ef8.js +69 -0
- package/dist/es/MultiDropdownList.js +7 -8
- package/dist/es/MultiList.js +5 -5
- package/dist/es/MultiRange.js +4 -4
- package/dist/es/{Pagination-50fc3ef5.js → Pagination-c2745bec.js} +2 -2
- package/dist/es/{PreferencesConsumer-b058d14e.js → PreferencesConsumer-0856ed43.js} +1 -1
- package/dist/es/RangeInput.js +5 -5
- package/dist/es/RangeSlider.js +4 -4
- package/dist/es/ReactiveBase.js +23 -21
- package/dist/es/ReactiveComponent.js +4 -4
- package/dist/es/ReactiveGoogleMap.js +6 -7
- package/dist/es/ReactiveList.js +6 -6
- package/dist/es/ResultCard.js +1 -1
- package/dist/es/ResultList.js +1 -1
- package/dist/es/SelectedFilters.js +3 -4
- package/dist/es/SingleDropdownList.js +7 -8
- package/dist/es/SingleList.js +5 -5
- package/dist/es/SingleRange.js +4 -4
- package/dist/es/StateProvider.js +1 -1
- package/dist/es/ToggleButton.js +5 -6
- package/dist/es/{index-882489e1.js → index-104f1dfb.js} +7 -3
- package/dist/es/index.js +10 -13
- package/dist/es/{install-f4f2557b.js → install-db7d6387.js} +227 -1604
- package/dist/es/install.js +9 -12
- package/dist/es/version.js +1 -1
- package/dist/es/{vueTypes-09cab4d3.js → vueTypes-f1923c72.js} +0 -18
- package/package.json +5 -7
- package/dist/cjs/Input-fcd780de.js +0 -156
- package/dist/es/Input-4cd74b38.js +0 -148
|
@@ -1,33 +1,28 @@
|
|
|
1
1
|
import { helper, Actions, causes } from '@appbaseio/reactivecore';
|
|
2
|
-
import { SEARCH_COMPONENTS_MODES, componentTypes,
|
|
2
|
+
import { SEARCH_COMPONENTS_MODES, componentTypes, TREELIST_VALUES_PATH_SEPARATOR } from '@appbaseio/reactivecore/lib/utils/constants';
|
|
3
3
|
import _transformOn from '@vue/babel-helper-vue-transform-on';
|
|
4
|
-
import { _ as _taggedTemplateLiteralLoose, a as _extends
|
|
5
|
-
import { createVNode, createTextVNode, defineComponent,
|
|
4
|
+
import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-ded08042.js';
|
|
5
|
+
import { createVNode, createTextVNode, defineComponent, isVNode, mergeProps, h } from 'vue';
|
|
6
6
|
import VueTypes from 'vue-types';
|
|
7
|
-
import { getQueryOptions,
|
|
7
|
+
import { getQueryOptions, suggestionTypes, recLookup, getClassName as getClassName$2, updateCustomQuery as updateCustomQuery$1, updateDefaultQuery as updateDefaultQuery$1, transformTreeListLocalStateIntoQueryComptaibleFormat, isEqual as isEqual$1, transformRawTreeListData, setDeep, getComponent as getComponent$1, getOptionsFromQuery, checkValueChange as checkValueChange$1, getAggsQuery, updateInternalQuery, isFunction as isFunction$1 } from '@appbaseio/reactivecore/lib/utils/helper';
|
|
8
8
|
import { styled } from '@appbaseio/vue-emotion';
|
|
9
|
-
import { css
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { t as types } from './vueTypes-09cab4d3.js';
|
|
9
|
+
import { css } from '@emotion/css';
|
|
10
|
+
import { B as Button } from './Button-fd869491.js';
|
|
11
|
+
import { t as types } from './vueTypes-f1923c72.js';
|
|
13
12
|
import { RLConnected as ReactiveList } from './ReactiveList.js';
|
|
14
13
|
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-
|
|
16
|
-
import { C as ComponentWrapper } from './ComponentWrapper-
|
|
17
|
-
import { P as PreferencesConsumer } from './PreferencesConsumer-
|
|
14
|
+
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';
|
|
15
|
+
import { C as ComponentWrapper } from './ComponentWrapper-e91c9d43.js';
|
|
16
|
+
import { P as PreferencesConsumer } from './PreferencesConsumer-0856ed43.js';
|
|
18
17
|
import { T as Title } from './Title-863dfa42.js';
|
|
19
18
|
import { L as ListItem } from './ListItem-e3c6acf4.js';
|
|
20
19
|
import { F as Flex } from './Flex-25792bc3.js';
|
|
21
|
-
import { recordAISessionUsefulness } from '@appbaseio/reactivecore/lib/actions/analytics';
|
|
22
20
|
import ReactiveBase from './ReactiveBase.js';
|
|
23
21
|
import hotkeys from 'hotkeys-js';
|
|
24
|
-
import {
|
|
25
|
-
import
|
|
26
|
-
import { I as IconWrapper, C as CancelSvg, a as IconGroup, B as ButtonIconWrapper, D as Downshift, b as InputWrapper } from './DropDown-8075451b.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-4cd74b38.js';
|
|
22
|
+
import { I as IconWrapper, C as CancelSvg, a as IconGroup, D as Downshift, b as InputWrapper } from './DropDown-74c20431.js';
|
|
23
|
+
import { n as noSuggestions, s as suggestionsContainer, I as Input, a as suggestions } from './Input-f7499ef8.js';
|
|
28
24
|
import { C as Container } from './Container-d00219f7.js';
|
|
29
25
|
import Highlight from 'vue-highlight-words';
|
|
30
|
-
import { fetchAIResponse, createAISession } from '@appbaseio/reactivecore/lib/actions/query';
|
|
31
26
|
import { replaceDiacritics } from '@appbaseio/reactivecore/lib/utils/suggestions';
|
|
32
27
|
import { C as Checkbox, R as Radio } from './FormControlList-fe6eaee4.js';
|
|
33
28
|
import { s as sanitizeObject } from './utils-d7dd4f4e.js';
|
|
@@ -49,13 +44,7 @@ import ResultList from './ResultList.js';
|
|
|
49
44
|
import StateProvider from './StateProvider.js';
|
|
50
45
|
|
|
51
46
|
var _templateObject;
|
|
52
|
-
var InputGroup = styled('div')(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n
|
|
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;';
|
|
58
|
-
});
|
|
47
|
+
var InputGroup = styled('div')(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: stretch;\n width: 100%;\n"])));
|
|
59
48
|
InputGroup.defaultProps = {
|
|
60
49
|
className: 'input-group'
|
|
61
50
|
};
|
|
@@ -785,309 +774,9 @@ var _templateObject$4, _templateObject2;
|
|
|
785
774
|
var TagsContainer = styled('div')(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tmargin-top: 10px;\n\twidth: 100%;\n"])));
|
|
786
775
|
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"])));
|
|
787
776
|
|
|
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"])));
|
|
793
|
-
var SkeletonLoader = styled('div')(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n"])));
|
|
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);
|
|
795
|
-
var HorizontalSkeletonLoader = defineComponent({
|
|
796
|
-
name: 'HorizontalSkeletonLoader',
|
|
797
|
-
render: function render() {
|
|
798
|
-
return createVNode(SkeletonLoader, null, {
|
|
799
|
-
"default": function _default() {
|
|
800
|
-
return [createVNode(SkeletonLine, null, null), createVNode(SkeletonLine, null, null), createVNode(SkeletonLine, null, null), createVNode(SkeletonLine, null, null)];
|
|
801
|
-
}
|
|
802
|
-
});
|
|
803
|
-
}
|
|
804
|
-
});
|
|
805
|
-
|
|
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"])), function (props) {
|
|
808
|
-
return props.theme && props.theme.colors ? props.theme.colors.backgroundColor : '#fff';
|
|
809
|
-
});
|
|
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) {
|
|
811
|
-
return props.showInput ? 'bottom: 48px;' : '';
|
|
812
|
-
}, function (props) {
|
|
813
|
-
return props.theme && props.theme.colors && props.theme.colors.backgroundColor ? props.theme.colors.backgroundColor : '#fff';
|
|
814
|
-
}, function (props) {
|
|
815
|
-
return props.theme && props.theme.colors && props.theme.colors.backgroundColor ? props.theme.colors.backgroundColor : '#fff';
|
|
816
|
-
}, function (props) {
|
|
817
|
-
return props.showInput ? ".--ai-answer-feedback-container {\n\t\tmargin-top: 15px;\n\t\tmargin-bottom: -10px;\n\t}" : ".--ai-answer-feedback-container {\n\t\tmargin-top: 4px;\n\t}";
|
|
818
|
-
});
|
|
819
|
-
var MessagesContainer = styled('div')(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteralLoose(["\n\tmax-height: 400px;\n overflow-y: auto;\n\tpadding: 10px;\n\tdisplay: flex;\n\tflex-direction: column;\n\tmin-height: 200px;\n\n}};\n"])));
|
|
820
|
-
var typingDots = keyframes(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n 0% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(-70%);\n }\n 100% {\n transform: translateY(0);\n }\n"])));
|
|
821
|
-
var TypingIndicator = styled('div')(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tmargin: 5px !important;\n"])));
|
|
822
|
-
var TypingDot = styled('div')(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n\twidth: 6px;\n\theight: 6px;\n\tbackground-color: ", ";\n\tborder-radius: 50%;\n\tmargin: 0 2px !important;\n\tanimation: ", " 1s infinite;\n\t&:nth-child(2) {\n\t\tanimation-delay: 0.2s;\n\t}\n\t&:nth-child(3) {\n\t\tanimation-delay: 0.4s;\n\t}\n"])), function (props) {
|
|
823
|
-
var finalColor;
|
|
824
|
-
if (props.isSender) {
|
|
825
|
-
finalColor = props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor;
|
|
826
|
-
} else {
|
|
827
|
-
finalColor = props.themePreset !== 'dark' ? props.theme.colors.borderColor : props.theme.colors.textColor;
|
|
828
|
-
}
|
|
829
|
-
return finalColor;
|
|
830
|
-
}, typingDots);
|
|
831
|
-
var resetCSS = function resetCSS(props) {
|
|
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}\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\t}\n\n\tcode {\n\t\tline-height: normal;\n\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\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";
|
|
837
|
-
};
|
|
838
|
-
var messageBGColor = function messageBGColor(props) {
|
|
839
|
-
var finalBGColor;
|
|
840
|
-
if (props.isSender) {
|
|
841
|
-
finalBGColor = props.themePreset !== 'dark' ? props.theme.colors.primaryColor : props.theme.colors.borderColor;
|
|
842
|
-
} else {
|
|
843
|
-
finalBGColor = props.themePreset !== 'dark' ? lighten(0.53, props.theme.colors.borderColor) : props.theme.colors.backgroundColor;
|
|
844
|
-
}
|
|
845
|
-
return finalBGColor;
|
|
846
|
-
};
|
|
847
|
-
var Message = styled('div')(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n\tbackground-color: ", ";\n\tcolor: ", ";\n\tborder: 1px solid\n\t\t", ";\n\tpadding: 10px;\n\tborder-radius: 7px;\n\tmargin-bottom: 10px;\n\tmax-width: 80%;\n\talign-self: ", ";\n\tdisplay: inline-block;\n\tposition: relative;\n\toverflow-wrap: anywhere;\n\t", "\n"])), function (props) {
|
|
848
|
-
return messageBGColor(props);
|
|
849
|
-
}, function (props) {
|
|
850
|
-
var finalColor;
|
|
851
|
-
if (props.isSender) {
|
|
852
|
-
finalColor = props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor;
|
|
853
|
-
} else {
|
|
854
|
-
finalColor = props.themePreset !== 'dark' ? props.theme.colors.borderColor : props.theme.colors.textColor;
|
|
855
|
-
}
|
|
856
|
-
return finalColor;
|
|
857
|
-
}, function (props) {
|
|
858
|
-
return props.themePreset === 'dark' ? 'currentColor' : messageBGColor(props);
|
|
859
|
-
}, function (props) {
|
|
860
|
-
return props.isSender ? 'flex-end' : 'flex-start';
|
|
861
|
-
}, function (props) {
|
|
862
|
-
return resetCSS(props);
|
|
863
|
-
});
|
|
864
|
-
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"])));
|
|
865
|
-
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) {
|
|
866
|
-
return props.themePreset === 'dark' ? props.theme.colors.borderColor : '#fff';
|
|
867
|
-
}, function (props) {
|
|
868
|
-
return props.themePreset === 'dark' ? props.theme.colors.titleColor : props.theme.colors.textColor;
|
|
869
|
-
}, function (props) {
|
|
870
|
-
return props.theme.colors.textColor;
|
|
871
|
-
}, function (props) {
|
|
872
|
-
return props.theme.colors.textColor;
|
|
873
|
-
}, function (props) {
|
|
874
|
-
return props.theme.colors.textColor;
|
|
875
|
-
}, function (_ref) {
|
|
876
|
-
var enterButton = _ref.enterButton;
|
|
877
|
-
return enterButton && "\n\t\t border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\t";
|
|
878
|
-
});
|
|
879
|
-
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"])));
|
|
880
|
-
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"])));
|
|
881
|
-
|
|
882
|
-
var _templateObject$8, _templateObject2$3, _templateObject3$2, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7$1;
|
|
883
|
-
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"])));
|
|
884
|
-
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"])));
|
|
885
|
-
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) {
|
|
886
|
-
var themePreset = _ref.themePreset,
|
|
887
|
-
theme = _ref.theme;
|
|
888
|
-
return themePreset === 'dark' ? '#424242' : theme.colors.backgroundColor;
|
|
889
|
-
}, function (_ref2) {
|
|
890
|
-
var theme = _ref2.theme;
|
|
891
|
-
return theme.colors.textColor;
|
|
892
|
-
});
|
|
893
|
-
var Question = styled('div')(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteralLoose(["\n\tfont-weight: bold;\n\tmargin-bottom: 5px;\n\tanimation: ", " 0.5s ease-out;\n"])), fadeInFromTop);
|
|
894
|
-
var Answer = styled('div')(_templateObject5$1 || (_templateObject5$1 = _taggedTemplateLiteralLoose(["\n\t", "\n\tposition: relative;\n\tmargin-bottom: 5px;\n\tmin-height: 100px;\n\toverflow: auto;\n\twhite-space: pre-wrap;\n\tpre {\n\t\twhite-space: pre-wrap;\n\t}\n\tcode,\n\tpre {\n\t\tdisplay: revert;\n\t}\n"])), function (props) {
|
|
895
|
-
return resetCSS(props);
|
|
896
|
-
});
|
|
897
|
-
var Footer = styled('div')(_templateObject6$1 || (_templateObject6$1 = _taggedTemplateLiteralLoose(["\n\tcolor: #777;\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 1rem;\n\tflex-wrap: wrap;\n\tanimation: ", " 0.5s ease-out;\n\tpadding: 10px 0;\n\tbackground: white;\n\tbackground-color: ", ";\n\tcolor: ", ";\n"])), fadeInFromBottom, function (_ref3) {
|
|
898
|
-
var themePreset = _ref3.themePreset,
|
|
899
|
-
theme = _ref3.theme;
|
|
900
|
-
return themePreset === 'dark' ? '#424242' : theme.colors.backgroundColor;
|
|
901
|
-
}, function (_ref4) {
|
|
902
|
-
var theme = _ref4.theme;
|
|
903
|
-
return theme.colors.textColor;
|
|
904
|
-
});
|
|
905
|
-
var SourceTags = styled('div')(_templateObject7$1 || (_templateObject7$1 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tgap: 8px;\n\tflex-wrap: wrap;\n\t.--ai-source-tag {\n\t\tdisplay: inline-block;\n\t\tmax-width: 200px;\n\t\twhite-space: nowrap;\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t}\n"])));
|
|
906
|
-
|
|
907
|
-
var ThumbsUpSvg = {
|
|
908
|
-
name: 'ThumbsUpSvg',
|
|
909
|
-
props: ['clickHandler', 'className'],
|
|
910
|
-
render: function render() {
|
|
911
|
-
return createVNode("svg", {
|
|
912
|
-
"stroke": "currentColor",
|
|
913
|
-
"fill": "none",
|
|
914
|
-
"strokeWidth": "2",
|
|
915
|
-
"viewBox": "0 0 24 24",
|
|
916
|
-
"strokeLinecap": "round",
|
|
917
|
-
"strokeLinejoin": "round",
|
|
918
|
-
"class": this.$props.className,
|
|
919
|
-
"height": "1em",
|
|
920
|
-
"width": "1em",
|
|
921
|
-
"xmlns": "http://www.w3.org/2000/svg",
|
|
922
|
-
"onClick": this.$props.clickHandler
|
|
923
|
-
}, [createVNode("path", {
|
|
924
|
-
"d": "M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"
|
|
925
|
-
}, null)]);
|
|
926
|
-
}
|
|
927
|
-
};
|
|
928
|
-
|
|
929
|
-
var ThumbsDownSvg = {
|
|
930
|
-
name: 'ThumbsDownSvg',
|
|
931
|
-
props: ['clickHandler', 'className'],
|
|
932
|
-
render: function render() {
|
|
933
|
-
return createVNode("svg", {
|
|
934
|
-
"stroke": "currentColor",
|
|
935
|
-
"fill": "none",
|
|
936
|
-
"strokeWidth": "2",
|
|
937
|
-
"viewBox": "0 0 24 24",
|
|
938
|
-
"strokeLinecap": "round",
|
|
939
|
-
"strokeLinejoin": "round",
|
|
940
|
-
"class": this.$props.className,
|
|
941
|
-
"height": "1em",
|
|
942
|
-
"width": "1em",
|
|
943
|
-
"xmlns": "http://www.w3.org/2000/svg",
|
|
944
|
-
"onClick": this.$props.clickHandler
|
|
945
|
-
}, [createVNode("path", {
|
|
946
|
-
"d": "M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17"
|
|
947
|
-
}, null), ' ']);
|
|
948
|
-
}
|
|
949
|
-
};
|
|
950
|
-
|
|
951
|
-
var AIFeedback = defineComponent({
|
|
952
|
-
name: 'FeedbackComponent',
|
|
953
|
-
props: {
|
|
954
|
-
onFeedbackSubmit: {
|
|
955
|
-
type: Function,
|
|
956
|
-
"default": function _default() {}
|
|
957
|
-
},
|
|
958
|
-
hideUI: {
|
|
959
|
-
type: Boolean,
|
|
960
|
-
"default": false
|
|
961
|
-
},
|
|
962
|
-
overrideState: {
|
|
963
|
-
type: Object,
|
|
964
|
-
"default": function _default() {
|
|
965
|
-
return {};
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
},
|
|
969
|
-
setup: function setup(props, _ref) {
|
|
970
|
-
var emit = _ref.emit;
|
|
971
|
-
var showInput = ref(false);
|
|
972
|
-
var feedbackType = ref(null);
|
|
973
|
-
var feedbackText = ref('');
|
|
974
|
-
var feedbackRecorded = ref(false);
|
|
975
|
-
var handleButtonClick = function handleButtonClick(type) {
|
|
976
|
-
if (feedbackType.value === type) {
|
|
977
|
-
feedbackType.value = null;
|
|
978
|
-
showInput.value = false;
|
|
979
|
-
} else {
|
|
980
|
-
feedbackType.value = type;
|
|
981
|
-
showInput.value = true;
|
|
982
|
-
}
|
|
983
|
-
};
|
|
984
|
-
var handleInputChange = function handleInputChange(e) {
|
|
985
|
-
feedbackText.value = e.target.value;
|
|
986
|
-
};
|
|
987
|
-
var handleSubmit = function handleSubmit() {
|
|
988
|
-
emit('feedback-submit', feedbackType.value === 'positive', feedbackText.value);
|
|
989
|
-
feedbackText.value = '';
|
|
990
|
-
showInput.value = false;
|
|
991
|
-
feedbackRecorded.value = true;
|
|
992
|
-
};
|
|
993
|
-
var handleCancel = function handleCancel() {
|
|
994
|
-
feedbackType.value = null;
|
|
995
|
-
feedbackText.value = '';
|
|
996
|
-
showInput.value = false;
|
|
997
|
-
};
|
|
998
|
-
watch(function () {
|
|
999
|
-
return props.overrideState;
|
|
1000
|
-
}, function (newValue) {
|
|
1001
|
-
if (newValue && newValue.isRecorded) {
|
|
1002
|
-
feedbackRecorded.value = true;
|
|
1003
|
-
feedbackType.value = newValue.feedbackType || 'positive';
|
|
1004
|
-
}
|
|
1005
|
-
});
|
|
1006
|
-
if (props.overrideState && props.overrideState.isRecorded) {
|
|
1007
|
-
feedbackRecorded.value = true;
|
|
1008
|
-
feedbackType.value = props.overrideState.feedbackType || 'positive';
|
|
1009
|
-
}
|
|
1010
|
-
return {
|
|
1011
|
-
showInput: showInput,
|
|
1012
|
-
feedbackType: feedbackType,
|
|
1013
|
-
feedbackText: feedbackText,
|
|
1014
|
-
feedbackRecorded: feedbackRecorded,
|
|
1015
|
-
handleButtonClick: handleButtonClick,
|
|
1016
|
-
handleInputChange: handleInputChange,
|
|
1017
|
-
handleSubmit: handleSubmit,
|
|
1018
|
-
handleCancel: handleCancel
|
|
1019
|
-
};
|
|
1020
|
-
},
|
|
1021
|
-
render: function render() {
|
|
1022
|
-
var _this = this;
|
|
1023
|
-
if (this.$props.hideUI) {
|
|
1024
|
-
return null;
|
|
1025
|
-
}
|
|
1026
|
-
if (this.feedbackRecorded) {
|
|
1027
|
-
return createVNode(AIFeedbackContainer, null, {
|
|
1028
|
-
"default": function _default() {
|
|
1029
|
-
return [createVNode("div", {
|
|
1030
|
-
"class": "--feedback-svgs-wrapper"
|
|
1031
|
-
}, [_this.feedbackType === 'positive' ? createVNode(ThumbsUpSvg, {
|
|
1032
|
-
"class": "selected"
|
|
1033
|
-
}, null) : createVNode(ThumbsDownSvg, {
|
|
1034
|
-
"class": "selected"
|
|
1035
|
-
}, null)])];
|
|
1036
|
-
}
|
|
1037
|
-
});
|
|
1038
|
-
}
|
|
1039
|
-
return createVNode(AIFeedbackContainer, null, {
|
|
1040
|
-
"default": function _default() {
|
|
1041
|
-
return [!_this.showInput && createVNode("div", {
|
|
1042
|
-
"class": "--feedback-svgs-wrapper"
|
|
1043
|
-
}, [createVNode(ThumbsUpSvg, {
|
|
1044
|
-
"class": _this.feedbackType === 'positive' ? 'selected' : '',
|
|
1045
|
-
"onClick": function onClick() {
|
|
1046
|
-
return _this.handleButtonClick('positive');
|
|
1047
|
-
}
|
|
1048
|
-
}, null), createVNode(ThumbsDownSvg, {
|
|
1049
|
-
"class": _this.feedbackType === 'negative' ? 'selected' : '',
|
|
1050
|
-
"onClick": function onClick() {
|
|
1051
|
-
return _this.handleButtonClick('negative');
|
|
1052
|
-
}
|
|
1053
|
-
}, null)]), _this.showInput && createVNode("div", {
|
|
1054
|
-
"class": "--feedback-input-wrapper"
|
|
1055
|
-
}, [createVNode(Input, {
|
|
1056
|
-
"show": _this.showInput,
|
|
1057
|
-
"placeholder": _this.feedbackType === 'positive' ? 'What do you like about the response?' : 'What was the issue with the response? How can it be improved?',
|
|
1058
|
-
"value": _this.feedbackText,
|
|
1059
|
-
"onInput": _this.handleInputChange
|
|
1060
|
-
}, null), createVNode(Button, {
|
|
1061
|
-
"primary": true,
|
|
1062
|
-
"onClick": _this.handleSubmit
|
|
1063
|
-
}, {
|
|
1064
|
-
"default": function _default() {
|
|
1065
|
-
return [createTextVNode("Submit")];
|
|
1066
|
-
}
|
|
1067
|
-
}), createVNode(Button, {
|
|
1068
|
-
"onClick": _this.handleCancel
|
|
1069
|
-
}, {
|
|
1070
|
-
"default": function _default() {
|
|
1071
|
-
return [createTextVNode("Cancel")];
|
|
1072
|
-
}
|
|
1073
|
-
})])];
|
|
1074
|
-
}
|
|
1075
|
-
});
|
|
1076
|
-
}
|
|
1077
|
-
});
|
|
1078
|
-
|
|
1079
|
-
var _excluded = ["_source"];
|
|
1080
777
|
function _isSlot(s) {
|
|
1081
778
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
1082
779
|
}
|
|
1083
|
-
var md = new Remarkable();
|
|
1084
|
-
md.set({
|
|
1085
|
-
html: true,
|
|
1086
|
-
breaks: true,
|
|
1087
|
-
xhtmlOut: true
|
|
1088
|
-
});
|
|
1089
|
-
var _dropdownULRef = 'dropdownULRef';
|
|
1090
|
-
var _inputGroupRef = 'inputGroupRef';
|
|
1091
780
|
var updateQuery = Actions.updateQuery,
|
|
1092
781
|
setCustomQuery = Actions.setCustomQuery,
|
|
1093
782
|
setDefaultQuery = Actions.setDefaultQuery,
|
|
@@ -1108,11 +797,7 @@ var SearchBox = defineComponent({
|
|
|
1108
797
|
currentValue: '',
|
|
1109
798
|
selectedTags: [],
|
|
1110
799
|
isOpen: false,
|
|
1111
|
-
normalizedSuggestions: []
|
|
1112
|
-
showAIScreen: false,
|
|
1113
|
-
showAIScreenFooter: false,
|
|
1114
|
-
showFeedbackComponent: false,
|
|
1115
|
-
feedbackState: null
|
|
800
|
+
normalizedSuggestions: []
|
|
1116
801
|
};
|
|
1117
802
|
this.internalComponent = props.componentId + "__internal";
|
|
1118
803
|
return this.__state;
|
|
@@ -1153,26 +838,6 @@ var SearchBox = defineComponent({
|
|
|
1153
838
|
},
|
|
1154
839
|
stats: function stats() {
|
|
1155
840
|
return getResultStats(this);
|
|
1156
|
-
},
|
|
1157
|
-
parsedSuggestions: function parsedSuggestions() {
|
|
1158
|
-
var suggestionsArray = [];
|
|
1159
|
-
if (Array.isArray(this.suggestions) && this.suggestions.length) {
|
|
1160
|
-
suggestionsArray = [].concat(withClickIds(this.suggestions));
|
|
1161
|
-
}
|
|
1162
|
-
var sectionsAccumulated = [];
|
|
1163
|
-
var sectionisedSuggestions = suggestionsArray.reduce(function (acc, d, currentIndex) {
|
|
1164
|
-
if (sectionsAccumulated.includes(d.sectionId)) return acc;
|
|
1165
|
-
if (d.sectionId) {
|
|
1166
|
-
acc[currentIndex] = suggestionsArray.filter(function (g) {
|
|
1167
|
-
return g.sectionId === d.sectionId;
|
|
1168
|
-
});
|
|
1169
|
-
sectionsAccumulated.push(d.sectionId);
|
|
1170
|
-
} else {
|
|
1171
|
-
acc[currentIndex] = d;
|
|
1172
|
-
}
|
|
1173
|
-
return acc;
|
|
1174
|
-
}, {});
|
|
1175
|
-
return Object.values(sectionisedSuggestions);
|
|
1176
841
|
}
|
|
1177
842
|
},
|
|
1178
843
|
props: {
|
|
@@ -1239,20 +904,12 @@ var SearchBox = defineComponent({
|
|
|
1239
904
|
distinctFieldConfig: types.props,
|
|
1240
905
|
//
|
|
1241
906
|
focusShortcuts: VueTypes.arrayOf(VueTypes.oneOfType([VueTypes.string, VueTypes.number])).def(['/']),
|
|
1242
|
-
showFocusShortcutsIcon: VueTypes.bool.def(true),
|
|
1243
907
|
addonBefore: VueTypes.any,
|
|
1244
908
|
addonAfter: VueTypes.any,
|
|
1245
|
-
showSuggestionsFooter: VueTypes.bool.def(true),
|
|
1246
909
|
expandSuggestionsContainer: VueTypes.bool.def(true),
|
|
1247
|
-
renderSuggestionsFooter: VueTypes.func,
|
|
1248
910
|
index: VueTypes.string,
|
|
1249
911
|
popularSuggestionsConfig: VueTypes.object,
|
|
1250
912
|
recentSuggestionsConfig: VueTypes.object,
|
|
1251
|
-
featuredSuggestionsConfig: VueTypes.shape({
|
|
1252
|
-
maxSuggestionsPerSection: VueTypes.number,
|
|
1253
|
-
sectionsOrder: VueTypes.arrayOf(VueTypes.string)
|
|
1254
|
-
}),
|
|
1255
|
-
customEvents: VueTypes.object,
|
|
1256
913
|
applyStopwords: VueTypes.bool,
|
|
1257
914
|
customStopwords: types.stringArray,
|
|
1258
915
|
onData: types.func,
|
|
@@ -1262,10 +919,7 @@ var SearchBox = defineComponent({
|
|
|
1262
919
|
mode: VueTypes.oneOf(['select', 'tag']).def('select'),
|
|
1263
920
|
renderSelectedTags: VueTypes.any,
|
|
1264
921
|
searchboxId: VueTypes.string,
|
|
1265
|
-
endpoint: types.endpointConfig
|
|
1266
|
-
enableAI: VueTypes.bool.def(false),
|
|
1267
|
-
AIConfig: types.AIConfig,
|
|
1268
|
-
AIUIConfig: types.AIUIConfig
|
|
922
|
+
endpoint: types.endpointConfig
|
|
1269
923
|
},
|
|
1270
924
|
mounted: function mounted() {
|
|
1271
925
|
this.listenForFocusShortcuts();
|
|
@@ -1311,7 +965,6 @@ var SearchBox = defineComponent({
|
|
|
1311
965
|
suggestionsList = [].concat(withClickIds(this.$props.defaultSuggestions));
|
|
1312
966
|
}
|
|
1313
967
|
this.normalizedSuggestions = suggestionsList;
|
|
1314
|
-
this.handleTextAreaHeightChange();
|
|
1315
968
|
},
|
|
1316
969
|
selectedValue: function selectedValue(newVal, oldVal) {
|
|
1317
970
|
if (!isEqual(newVal, oldVal) && (this.$options.isTagsMode ? !isEqual(this.$data.selectedTags, newVal) : this.$data.currentValue !== newVal)) {
|
|
@@ -1373,45 +1026,6 @@ var SearchBox = defineComponent({
|
|
|
1373
1026
|
if (!isEqual(newVal, oldVal)) {
|
|
1374
1027
|
this.handleTextChange = _debounce(this.handleText, newVal);
|
|
1375
1028
|
}
|
|
1376
|
-
},
|
|
1377
|
-
isAITyping: function isAITyping(newVal, oldVal) {
|
|
1378
|
-
var _this = this;
|
|
1379
|
-
var scrollAIContainer = function scrollAIContainer() {
|
|
1380
|
-
var dropdownEle = _this.$refs[_dropdownULRef];
|
|
1381
|
-
if (dropdownEle) {
|
|
1382
|
-
dropdownEle.scrollTo({
|
|
1383
|
-
top: dropdownEle.scrollHeight,
|
|
1384
|
-
behavior: 'smooth'
|
|
1385
|
-
});
|
|
1386
|
-
}
|
|
1387
|
-
};
|
|
1388
|
-
if (!newVal && oldVal) {
|
|
1389
|
-
this.showAIScreenFooter = true;
|
|
1390
|
-
if (this.$props.AIUIConfig && typeof this.$props.AIUIConfig.showFeedback === 'boolean' ? this.$props.AIUIConfig.showFeedback : true) {
|
|
1391
|
-
this.showFeedbackComponent = true;
|
|
1392
|
-
}
|
|
1393
|
-
setTimeout(function () {
|
|
1394
|
-
scrollAIContainer();
|
|
1395
|
-
}, 500);
|
|
1396
|
-
} else if (newVal) {
|
|
1397
|
-
this.scrollTimerRef = setTimeout(function () {
|
|
1398
|
-
scrollAIContainer();
|
|
1399
|
-
}, 2000);
|
|
1400
|
-
}
|
|
1401
|
-
},
|
|
1402
|
-
showAIScreen: function showAIScreen(newVal) {
|
|
1403
|
-
if (newVal) {
|
|
1404
|
-
var _this$$refs;
|
|
1405
|
-
if ((_this$$refs = this.$refs) != null && _this$$refs[this.$props.innerRef] && this.$refs[this.$props.innerRef].$el) {
|
|
1406
|
-
this.$refs[this.$props.innerRef].$el.blur();
|
|
1407
|
-
}
|
|
1408
|
-
} else {
|
|
1409
|
-
this.feedbackState = null;
|
|
1410
|
-
this.showFeedbackComponent = false;
|
|
1411
|
-
}
|
|
1412
|
-
},
|
|
1413
|
-
currentValue: function currentValue() {
|
|
1414
|
-
this.handleTextAreaHeightChange();
|
|
1415
1029
|
}
|
|
1416
1030
|
},
|
|
1417
1031
|
methods: {
|
|
@@ -1437,20 +1051,9 @@ var SearchBox = defineComponent({
|
|
|
1437
1051
|
data: this.normalizedSuggestions,
|
|
1438
1052
|
rawData: this.rawData,
|
|
1439
1053
|
value: currentValue,
|
|
1440
|
-
resultStats: this.stats
|
|
1441
|
-
AIData: {
|
|
1442
|
-
question: this.AIResponse && this.AIResponse.response && this.AIResponse.response.question,
|
|
1443
|
-
answer: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text,
|
|
1444
|
-
documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
|
|
1445
|
-
showAIScreen: this.showAIScreen,
|
|
1446
|
-
sources: this.getAISourceObjects(),
|
|
1447
|
-
isAILoading: this.isAIResponseLoading,
|
|
1448
|
-
AIError: this.AIResponseError
|
|
1449
|
-
}
|
|
1054
|
+
resultStats: this.stats
|
|
1450
1055
|
};
|
|
1451
|
-
return
|
|
1452
|
-
"ref": _dropdownULRef
|
|
1453
|
-
}, [getComponent(data, this)]);
|
|
1056
|
+
return getComponent(data, this);
|
|
1454
1057
|
},
|
|
1455
1058
|
// returns size and aggs property
|
|
1456
1059
|
getBasicQueryOptions: function getBasicQueryOptions() {
|
|
@@ -1472,7 +1075,7 @@ var SearchBox = defineComponent({
|
|
|
1472
1075
|
}
|
|
1473
1076
|
},
|
|
1474
1077
|
setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue) {
|
|
1475
|
-
var
|
|
1078
|
+
var _this = this;
|
|
1476
1079
|
if (isDefaultValue === void 0) {
|
|
1477
1080
|
isDefaultValue = false;
|
|
1478
1081
|
}
|
|
@@ -1486,65 +1089,60 @@ var SearchBox = defineComponent({
|
|
|
1486
1089
|
categoryValue = undefined;
|
|
1487
1090
|
}
|
|
1488
1091
|
var performUpdate = function performUpdate() {
|
|
1489
|
-
if (
|
|
1092
|
+
if (_this.$options.isTagsMode && isEqual(value, _this.selectedTags)) {
|
|
1490
1093
|
return;
|
|
1491
1094
|
}
|
|
1492
|
-
if (
|
|
1493
|
-
if (Array.isArray(
|
|
1095
|
+
if (_this.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
|
|
1096
|
+
if (Array.isArray(_this.selectedTags) && _this.selectedTags.length) {
|
|
1494
1097
|
// check if value already present in selectedTags
|
|
1495
|
-
if (typeof value === 'string' &&
|
|
1496
|
-
|
|
1098
|
+
if (typeof value === 'string' && _this.selectedTags.includes(value)) {
|
|
1099
|
+
_this.isOpen = false;
|
|
1497
1100
|
return;
|
|
1498
1101
|
}
|
|
1499
|
-
|
|
1102
|
+
_this.selectedTags = [].concat(_this.selectedTags);
|
|
1500
1103
|
if (typeof value === 'string' && !!value) {
|
|
1501
|
-
|
|
1502
|
-
} else if (Array.isArray(value) && !isEqual(
|
|
1503
|
-
|
|
1104
|
+
_this.selectedTags.push(value);
|
|
1105
|
+
} else if (Array.isArray(value) && !isEqual(_this.selectedTags, value)) {
|
|
1106
|
+
_this.selectedTags = value;
|
|
1504
1107
|
}
|
|
1505
1108
|
} else if (value) {
|
|
1506
|
-
|
|
1109
|
+
_this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
|
|
1507
1110
|
}
|
|
1508
|
-
|
|
1111
|
+
_this.currentValue = '';
|
|
1509
1112
|
} else {
|
|
1510
|
-
|
|
1113
|
+
_this.currentValue = decodeHtml(value);
|
|
1511
1114
|
}
|
|
1512
1115
|
var queryHandlerValue = value;
|
|
1513
|
-
if (
|
|
1514
|
-
queryHandlerValue = Array.isArray(
|
|
1116
|
+
if (_this.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
|
|
1117
|
+
queryHandlerValue = Array.isArray(_this.selectedTags) && _this.selectedTags.length ? _this.selectedTags : undefined;
|
|
1515
1118
|
}
|
|
1516
1119
|
if (isDefaultValue) {
|
|
1517
|
-
if (
|
|
1120
|
+
if (_this.$props.autosuggest) {
|
|
1518
1121
|
if (toggleIsOpen) {
|
|
1519
|
-
|
|
1122
|
+
_this.isOpen = false;
|
|
1520
1123
|
}
|
|
1521
|
-
if (typeof
|
|
1522
|
-
enableAI: true
|
|
1523
|
-
} : {});
|
|
1124
|
+
if (typeof _this.currentValue === 'string') _this.triggerDefaultQuery(_this.currentValue);
|
|
1524
1125
|
} // in case of strict selection only SUGGESTION_SELECT should be able
|
|
1525
1126
|
// to set the query otherwise the value should reset
|
|
1526
1127
|
if (props.strictSelection) {
|
|
1527
|
-
if (cause === causes.SUGGESTION_SELECT || (
|
|
1528
|
-
|
|
1128
|
+
if (cause === causes.SUGGESTION_SELECT || (_this.$options.isTagsMode ? _this.selectedTags.length === 0 : value === '')) {
|
|
1129
|
+
_this.triggerCustomQuery(queryHandlerValue, _this.$options.isTagsMode ? undefined : categoryValue);
|
|
1529
1130
|
} else {
|
|
1530
|
-
|
|
1131
|
+
_this.setValue('', true);
|
|
1531
1132
|
}
|
|
1532
1133
|
} else if (props.value === undefined || cause === causes.SUGGESTION_SELECT || cause === causes.CLEAR_VALUE) {
|
|
1533
|
-
|
|
1134
|
+
_this.triggerCustomQuery(queryHandlerValue, _this.$options.isTagsMode ? undefined : categoryValue);
|
|
1534
1135
|
}
|
|
1535
1136
|
} else {
|
|
1536
1137
|
// debounce for handling text while typing
|
|
1537
|
-
|
|
1138
|
+
_this.handleTextChange(value, cause);
|
|
1538
1139
|
}
|
|
1539
|
-
|
|
1540
|
-
|
|
1140
|
+
_this.$emit('valueChange', value);
|
|
1141
|
+
_this.$emit('value-change', value);
|
|
1541
1142
|
};
|
|
1542
1143
|
checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
|
|
1543
1144
|
},
|
|
1544
|
-
triggerDefaultQuery: function triggerDefaultQuery(paramValue
|
|
1545
|
-
if (meta === void 0) {
|
|
1546
|
-
meta = {};
|
|
1547
|
-
}
|
|
1145
|
+
triggerDefaultQuery: function triggerDefaultQuery(paramValue) {
|
|
1548
1146
|
if (!this.$props.autosuggest) {
|
|
1549
1147
|
return;
|
|
1550
1148
|
}
|
|
@@ -1563,8 +1161,7 @@ var SearchBox = defineComponent({
|
|
|
1563
1161
|
componentId: this.internalComponent,
|
|
1564
1162
|
query: query,
|
|
1565
1163
|
value: value,
|
|
1566
|
-
componentType: componentTypes.searchBox
|
|
1567
|
-
meta: meta
|
|
1164
|
+
componentType: componentTypes.searchBox
|
|
1568
1165
|
});
|
|
1569
1166
|
},
|
|
1570
1167
|
triggerCustomQuery: function triggerCustomQuery(paramValue, categoryValue) {
|
|
@@ -1648,8 +1245,8 @@ var SearchBox = defineComponent({
|
|
|
1648
1245
|
this.recordSuggestionClick(searchPosition, docId);
|
|
1649
1246
|
},
|
|
1650
1247
|
clearValue: function clearValue() {
|
|
1651
|
-
this.setValue('', false, this.$props,
|
|
1652
|
-
this.onValueSelectedHandler('',
|
|
1248
|
+
this.setValue('', false, this.$props, causes.CLEAR_VALUE, false);
|
|
1249
|
+
this.onValueSelectedHandler('', causes.CLEAR_VALUE);
|
|
1653
1250
|
},
|
|
1654
1251
|
handleKeyDown: function handleKeyDown(event, highlightedIndex) {
|
|
1655
1252
|
if (highlightedIndex === void 0) {
|
|
@@ -1660,12 +1257,9 @@ var SearchBox = defineComponent({
|
|
|
1660
1257
|
if (this.$props.autosuggest === false) {
|
|
1661
1258
|
this.enterButtonOnClick();
|
|
1662
1259
|
} else if (highlightedIndex === null) {
|
|
1663
|
-
this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
if (this.$props.enableAI && !this.showAIScreen) {
|
|
1667
|
-
this.showAIScreen = true;
|
|
1668
|
-
}
|
|
1260
|
+
this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined // to handle tags
|
|
1261
|
+
);
|
|
1262
|
+
|
|
1669
1263
|
this.onValueSelectedHandler(event.target.value, causes.ENTER_PRESS);
|
|
1670
1264
|
}
|
|
1671
1265
|
}
|
|
@@ -1675,21 +1269,18 @@ var SearchBox = defineComponent({
|
|
|
1675
1269
|
this.$emit('key-down', event, this.triggerQuery);
|
|
1676
1270
|
},
|
|
1677
1271
|
onInputChange: function onInputChange(e) {
|
|
1678
|
-
var
|
|
1272
|
+
var _this2 = this;
|
|
1679
1273
|
var inputValue = e.target.value;
|
|
1680
1274
|
if (!this.$data.isOpen && this.$props.autosuggest) {
|
|
1681
1275
|
this.isOpen = true;
|
|
1682
1276
|
}
|
|
1683
|
-
if (this.showAIScreen) {
|
|
1684
|
-
this.showAIScreen = false;
|
|
1685
|
-
}
|
|
1686
1277
|
var value = this.$props.value;
|
|
1687
1278
|
if (value === undefined) {
|
|
1688
|
-
this.setValue(inputValue, false, this.$props, undefined);
|
|
1279
|
+
this.setValue(inputValue, false, this.$props, inputValue === '' ? causes.CLEAR_VALUE : undefined);
|
|
1689
1280
|
} else {
|
|
1690
1281
|
this.$emit('change', inputValue, function (_ref3) {
|
|
1691
1282
|
var isOpen = _ref3.isOpen;
|
|
1692
|
-
return
|
|
1283
|
+
return _this2.triggerQuery({
|
|
1693
1284
|
defaultQuery: true,
|
|
1694
1285
|
customQuery: true,
|
|
1695
1286
|
value: inputValue,
|
|
@@ -1698,52 +1289,10 @@ var SearchBox = defineComponent({
|
|
|
1698
1289
|
}, e);
|
|
1699
1290
|
}
|
|
1700
1291
|
},
|
|
1701
|
-
handleFeaturedSuggestionClicked: function handleFeaturedSuggestionClicked(suggestion) {
|
|
1702
|
-
try {
|
|
1703
|
-
var _this$$refs2, _this$$refs2$this$$pr;
|
|
1704
|
-
if (suggestion.action === featuredSuggestionsActionTypes.NAVIGATE) {
|
|
1705
|
-
var _JSON$parse = JSON.parse(suggestion.subAction),
|
|
1706
|
-
_JSON$parse$target = _JSON$parse.target,
|
|
1707
|
-
target = _JSON$parse$target === void 0 ? '_self' : _JSON$parse$target,
|
|
1708
|
-
_JSON$parse$link = _JSON$parse.link,
|
|
1709
|
-
link = _JSON$parse$link === void 0 ? '/' : _JSON$parse$link;
|
|
1710
|
-
if (typeof window !== 'undefined') {
|
|
1711
|
-
window.open(link, target);
|
|
1712
|
-
}
|
|
1713
|
-
}
|
|
1714
|
-
if (suggestion.action === featuredSuggestionsActionTypes.FUNCTION) {
|
|
1715
|
-
var matchedValues = suggestion.subAction.match(/function\s*\(.*\)(.|\n)*/);
|
|
1716
|
-
var functionStr = matchedValues && matchedValues[0];
|
|
1717
|
-
// eslint-disable-next-line no-new-func
|
|
1718
|
-
var func = new Function("return " + functionStr)();
|
|
1719
|
-
func(suggestion, this.$data.currentValue, this.$props.customEvents);
|
|
1720
|
-
}
|
|
1721
|
-
if (suggestion.action === featuredSuggestionsActionTypes.SELECT) {
|
|
1722
|
-
this.setValue(suggestion.value, true, this.$props, this.$options.isTagsMode.current ? causes.SUGGESTION_SELECT : causes.ENTER_PRESS);
|
|
1723
|
-
this.onValueSelectedHandler(suggestion.value, causes.SUGGESTION_SELECT);
|
|
1724
|
-
}
|
|
1725
|
-
// blur is important to close the dropdown
|
|
1726
|
-
// on selecting one of featured suggestions
|
|
1727
|
-
// else Downshift probably is focusing the dropdown
|
|
1728
|
-
// and not letting it close
|
|
1729
|
-
// eslint-disable-next-line no-unused-expressions
|
|
1730
|
-
(_this$$refs2 = this.$refs) == null ? void 0 : (_this$$refs2$this$$pr = _this$$refs2[this.$props.innerRef]) == null ? void 0 : _this$$refs2$this$$pr.blur();
|
|
1731
|
-
} catch (e) {
|
|
1732
|
-
console.error("Error: There was an error parsing the subAction for the featured suggestion with label, \"" + suggestion.label + "\"", e);
|
|
1733
|
-
}
|
|
1734
|
-
},
|
|
1735
1292
|
onSuggestionSelected: function onSuggestionSelected(suggestion) {
|
|
1736
|
-
var
|
|
1737
|
-
|
|
1738
|
-
this.showAIScreen = true;
|
|
1739
|
-
}
|
|
1293
|
+
var _this3 = this;
|
|
1294
|
+
this.isOpen = false;
|
|
1740
1295
|
var value = this.$props.value;
|
|
1741
|
-
|
|
1742
|
-
// handle featured suggestions click event
|
|
1743
|
-
if (suggestion._suggestion_type === suggestionTypes.Featured) {
|
|
1744
|
-
this.handleFeaturedSuggestionClicked(suggestion);
|
|
1745
|
-
return;
|
|
1746
|
-
}
|
|
1747
1296
|
// Record analytics for selected suggestions
|
|
1748
1297
|
this.triggerClickAnalytics(suggestion._click_id);
|
|
1749
1298
|
if (value === undefined) {
|
|
@@ -1762,10 +1311,10 @@ var SearchBox = defineComponent({
|
|
|
1762
1311
|
this.setValue(emitValue, true, this.$props, causes.SUGGESTION_SELECT, false, suggestion._category);
|
|
1763
1312
|
this.$emit('change', emitValue, function (_ref4) {
|
|
1764
1313
|
var isOpen = _ref4.isOpen;
|
|
1765
|
-
return
|
|
1314
|
+
return _this3.triggerQuery(_extends({
|
|
1766
1315
|
isOpen: isOpen,
|
|
1767
1316
|
value: emitValue
|
|
1768
|
-
}, !
|
|
1317
|
+
}, !_this3.$options.isTagsMode && {
|
|
1769
1318
|
categoryValue: suggestion._category
|
|
1770
1319
|
}));
|
|
1771
1320
|
});
|
|
@@ -1799,26 +1348,9 @@ var SearchBox = defineComponent({
|
|
|
1799
1348
|
}
|
|
1800
1349
|
return null;
|
|
1801
1350
|
},
|
|
1802
|
-
renderErrorComponent: function renderErrorComponent(
|
|
1803
|
-
var
|
|
1804
|
-
if (isAIError === void 0) {
|
|
1805
|
-
isAIError = false;
|
|
1806
|
-
}
|
|
1351
|
+
renderErrorComponent: function renderErrorComponent() {
|
|
1352
|
+
var _this4 = this;
|
|
1807
1353
|
var renderError = this.$slots.renderError || this.$props.renderError;
|
|
1808
|
-
if (isAIError) {
|
|
1809
|
-
if (this.showAIScreen && this.AIResponseError && !this.isAIResponseLoading) {
|
|
1810
|
-
if (renderError) {
|
|
1811
|
-
return createVNode("div", {
|
|
1812
|
-
"class": "--ai-answer-error-container " + (getClassName$1(this.$props.innerClass, 'ai-error') || '')
|
|
1813
|
-
}, [renderError(this.AIResponseError)]);
|
|
1814
|
-
}
|
|
1815
|
-
return createVNode("div", {
|
|
1816
|
-
"class": "--ai-answer-error-container " + (getClassName$1(this.$props.innerClass, 'ai-error') || '')
|
|
1817
|
-
}, [createVNode("div", {
|
|
1818
|
-
"class": "--default-error-element"
|
|
1819
|
-
}, [createVNode("span", null, [typeof this.AIResponseError === 'string' ? this.AIResponseError : this.AIResponseError.message ? this.AIResponseError.message : 'There was an error in generating the response.', this.AIResponseError.code ? "Code:\n\t\t\t\t\t\t\t" + this.AIResponseError.code : ''])])]);
|
|
1820
|
-
}
|
|
1821
|
-
}
|
|
1822
1354
|
if (this.error && renderError && this.$data.currentValue && !this.isLoading) {
|
|
1823
1355
|
return createVNode(SuggestionWrapper, {
|
|
1824
1356
|
"innerClass": this.$props.innerClass,
|
|
@@ -1827,7 +1359,7 @@ var SearchBox = defineComponent({
|
|
|
1827
1359
|
"themePreset": this.themePreset
|
|
1828
1360
|
}, {
|
|
1829
1361
|
"default": function _default() {
|
|
1830
|
-
return [isFunction(renderError) ? renderError(
|
|
1362
|
+
return [isFunction(renderError) ? renderError(_this4.error) : renderError];
|
|
1831
1363
|
}
|
|
1832
1364
|
});
|
|
1833
1365
|
}
|
|
@@ -1892,22 +1424,14 @@ var SearchBox = defineComponent({
|
|
|
1892
1424
|
return null;
|
|
1893
1425
|
},
|
|
1894
1426
|
enterButtonOnClick: function enterButtonOnClick() {
|
|
1895
|
-
this.showAIScreen = false;
|
|
1896
1427
|
this.triggerQuery({
|
|
1897
1428
|
isOpen: false,
|
|
1898
1429
|
value: this.currentValue,
|
|
1899
1430
|
customQuery: true
|
|
1900
1431
|
});
|
|
1901
1432
|
},
|
|
1902
|
-
suggestionsFooter: function suggestionsFooter() {
|
|
1903
|
-
return typeof renderSuggestionsFooter === 'function' ? this.$props.renderSuggestionsFooter() : createVNode(AutosuggestFooterContainer, null, {
|
|
1904
|
-
"default": function _default() {
|
|
1905
|
-
return [createVNode("div", null, [createTextVNode("\u2191\u2193 Navigate")]), createVNode("div", null, [createTextVNode("\u21A9 Go")])];
|
|
1906
|
-
}
|
|
1907
|
-
});
|
|
1908
|
-
},
|
|
1909
1433
|
renderEnterButtonElement: function renderEnterButtonElement() {
|
|
1910
|
-
var
|
|
1434
|
+
var _this5 = this;
|
|
1911
1435
|
var _this$$props2 = this.$props,
|
|
1912
1436
|
enterButton = _this$$props2.enterButton,
|
|
1913
1437
|
innerClass = _this$$props2.innerClass;
|
|
@@ -1915,12 +1439,12 @@ var SearchBox = defineComponent({
|
|
|
1915
1439
|
if (enterButton) {
|
|
1916
1440
|
var getEnterButtonMarkup = function getEnterButtonMarkup() {
|
|
1917
1441
|
if (renderEnterButton) {
|
|
1918
|
-
return renderEnterButton(
|
|
1442
|
+
return renderEnterButton(_this5.enterButtonOnClick);
|
|
1919
1443
|
}
|
|
1920
1444
|
return createVNode(Button, {
|
|
1921
1445
|
"class": "enter-btn " + getClassName$1(innerClass, 'enter-button'),
|
|
1922
1446
|
"primary": true,
|
|
1923
|
-
"onClick":
|
|
1447
|
+
"onClick": _this5.enterButtonOnClick
|
|
1924
1448
|
}, {
|
|
1925
1449
|
"default": function _default() {
|
|
1926
1450
|
return [createTextVNode("Search")];
|
|
@@ -1933,98 +1457,71 @@ var SearchBox = defineComponent({
|
|
|
1933
1457
|
}
|
|
1934
1458
|
return null;
|
|
1935
1459
|
},
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
shortcut = shortcut.toLowerCase();
|
|
1940
|
-
shortcut = shortcut.replace('shift', '⬆️');
|
|
1941
|
-
shortcut = shortcut.replace('command', 'cmd');
|
|
1942
|
-
shortcut = shortcut.replace('control', 'ctrl');
|
|
1943
|
-
shortcut = shortcut.replace('option', 'alt');
|
|
1944
|
-
return shortcut.toUpperCase();
|
|
1945
|
-
}
|
|
1946
|
-
return '/';
|
|
1947
|
-
},
|
|
1948
|
-
renderLeftIcons: function renderLeftIcons() {
|
|
1949
|
-
var _this7 = this;
|
|
1950
|
-
var _slot3;
|
|
1460
|
+
renderIcons: function renderIcons() {
|
|
1461
|
+
var _this6 = this;
|
|
1462
|
+
var _slot3, _slot4, _slot5;
|
|
1951
1463
|
var _this$$props3 = this.$props,
|
|
1952
1464
|
iconPosition = _this$$props3.iconPosition,
|
|
1465
|
+
showClear = _this$$props3.showClear,
|
|
1466
|
+
innerClass = _this$$props3.innerClass,
|
|
1467
|
+
getMicInstance = _this$$props3.getMicInstance,
|
|
1468
|
+
showVoiceSearch = _this$$props3.showVoiceSearch,
|
|
1953
1469
|
showIcon = _this$$props3.showIcon;
|
|
1954
|
-
return createVNode("div", null, [createVNode(IconGroup, {
|
|
1955
|
-
"groupPosition": "left"
|
|
1956
|
-
}, {
|
|
1957
|
-
"default": function _default() {
|
|
1958
|
-
return [iconPosition === 'left' && showIcon && createVNode(IconWrapper, {
|
|
1959
|
-
"onClick": _this7.handleSearchIconClick
|
|
1960
|
-
}, _isSlot(_slot3 = _this7.renderIcon()) ? _slot3 : {
|
|
1961
|
-
"default": function _default() {
|
|
1962
|
-
return [_slot3];
|
|
1963
|
-
}
|
|
1964
|
-
})];
|
|
1965
|
-
}
|
|
1966
|
-
})]);
|
|
1967
|
-
},
|
|
1968
|
-
renderRightIcons: function renderRightIcons() {
|
|
1969
|
-
var _this8 = this;
|
|
1970
|
-
var _slot4, _slot5, _slot6;
|
|
1971
|
-
var _this$$props4 = this.$props,
|
|
1972
|
-
iconPosition = _this$$props4.iconPosition,
|
|
1973
|
-
showClear = _this$$props4.showClear,
|
|
1974
|
-
innerClass = _this$$props4.innerClass,
|
|
1975
|
-
getMicInstance = _this$$props4.getMicInstance,
|
|
1976
|
-
showVoiceSearch = _this$$props4.showVoiceSearch,
|
|
1977
|
-
showIcon = _this$$props4.showIcon,
|
|
1978
|
-
showFocusShortcutsIcon = _this$$props4.showFocusShortcutsIcon;
|
|
1979
1470
|
var renderMic = this.$slots.renderMic || this.$props.renderMic;
|
|
1980
1471
|
var currentValue = this.$data.currentValue;
|
|
1981
1472
|
return createVNode("div", null, [createVNode(IconGroup, {
|
|
1982
|
-
"groupPosition": "right"
|
|
1473
|
+
"groupPosition": "right",
|
|
1474
|
+
"positionType": "absolute"
|
|
1983
1475
|
}, {
|
|
1984
1476
|
"default": function _default() {
|
|
1985
1477
|
return [currentValue && showClear && createVNode(IconWrapper, {
|
|
1986
|
-
"onClick":
|
|
1478
|
+
"onClick": _this6.clearValue,
|
|
1987
1479
|
"showIcon": showIcon,
|
|
1988
1480
|
"isClearIcon": true
|
|
1989
|
-
}, _isSlot(
|
|
1990
|
-
"default": function _default() {
|
|
1991
|
-
return [_slot4];
|
|
1992
|
-
}
|
|
1993
|
-
}), showFocusShortcutsIcon && createVNode(ButtonIconWrapper, {
|
|
1994
|
-
"onClick": function onClick(e) {
|
|
1995
|
-
return _this8.focusSearchBox(e);
|
|
1996
|
-
}
|
|
1997
|
-
}, _isSlot(_slot5 = _this8.renderShortcut()) ? _slot5 : {
|
|
1481
|
+
}, _isSlot(_slot3 = _this6.renderCancelIcon()) ? _slot3 : {
|
|
1998
1482
|
"default": function _default() {
|
|
1999
|
-
return [
|
|
1483
|
+
return [_slot3];
|
|
2000
1484
|
}
|
|
2001
1485
|
}), showVoiceSearch && createVNode(Mic, {
|
|
2002
1486
|
"getInstance": getMicInstance,
|
|
2003
1487
|
"render": renderMic,
|
|
2004
|
-
"handleResult":
|
|
1488
|
+
"handleResult": _this6.handleVoiceResults,
|
|
2005
1489
|
"className": getClassName$1(innerClass, 'mic') || null
|
|
2006
1490
|
}, null), iconPosition === 'right' && showIcon && createVNode(IconWrapper, {
|
|
2007
|
-
"onClick":
|
|
2008
|
-
}, _isSlot(
|
|
1491
|
+
"onClick": _this6.handleSearchIconClick
|
|
1492
|
+
}, _isSlot(_slot4 = _this6.renderIcon()) ? _slot4 : {
|
|
2009
1493
|
"default": function _default() {
|
|
2010
|
-
return [
|
|
1494
|
+
return [_slot4];
|
|
1495
|
+
}
|
|
1496
|
+
})];
|
|
1497
|
+
}
|
|
1498
|
+
}), createVNode(IconGroup, {
|
|
1499
|
+
"groupPosition": "left",
|
|
1500
|
+
"positionType": "absolute"
|
|
1501
|
+
}, {
|
|
1502
|
+
"default": function _default() {
|
|
1503
|
+
return [iconPosition === 'left' && showIcon && createVNode(IconWrapper, {
|
|
1504
|
+
"onClick": _this6.handleSearchIconClick
|
|
1505
|
+
}, _isSlot(_slot5 = _this6.renderIcon()) ? _slot5 : {
|
|
1506
|
+
"default": function _default() {
|
|
1507
|
+
return [_slot5];
|
|
2011
1508
|
}
|
|
2012
1509
|
})];
|
|
2013
1510
|
}
|
|
2014
1511
|
})]);
|
|
2015
1512
|
},
|
|
2016
1513
|
focusSearchBox: function focusSearchBox(event) {
|
|
2017
|
-
var _this$$
|
|
1514
|
+
var _this$$refs, _this$$refs$this$$pro;
|
|
2018
1515
|
var elt = event.target || event.srcElement;
|
|
2019
1516
|
var tagName = elt.tagName;
|
|
2020
1517
|
if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
|
|
2021
1518
|
// already in an input
|
|
2022
1519
|
return;
|
|
2023
1520
|
}
|
|
2024
|
-
(_this$$
|
|
1521
|
+
(_this$$refs = this.$refs) == null ? void 0 : (_this$$refs$this$$pro = _this$$refs[this.$props.innerRef]) == null ? void 0 : _this$$refs$this$$pro.focus(); // eslint-disable-line
|
|
2025
1522
|
},
|
|
2026
1523
|
listenForFocusShortcuts: function listenForFocusShortcuts() {
|
|
2027
|
-
var
|
|
1524
|
+
var _this7 = this;
|
|
2028
1525
|
var _this$$props$focusSho = this.$props.focusShortcuts,
|
|
2029
1526
|
focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
|
|
2030
1527
|
if (isEmpty(focusShortcuts)) {
|
|
@@ -2039,7 +1536,7 @@ var SearchBox = defineComponent({
|
|
|
2039
1536
|
function (event, handler) {
|
|
2040
1537
|
// Prevent the default refresh event under WINDOWS system
|
|
2041
1538
|
event.preventDefault();
|
|
2042
|
-
|
|
1539
|
+
_this7.focusSearchBox(event);
|
|
2043
1540
|
});
|
|
2044
1541
|
|
|
2045
1542
|
// if one of modifier keys are used, they are handled below
|
|
@@ -2049,7 +1546,7 @@ var SearchBox = defineComponent({
|
|
|
2049
1546
|
for (var index = 0; index < modifierKeys.length; index += 1) {
|
|
2050
1547
|
var element = modifierKeys[index];
|
|
2051
1548
|
if (hotkeys[element]) {
|
|
2052
|
-
|
|
1549
|
+
_this7.focusSearchBox(event);
|
|
2053
1550
|
break;
|
|
2054
1551
|
}
|
|
2055
1552
|
}
|
|
@@ -2061,34 +1558,19 @@ var SearchBox = defineComponent({
|
|
|
2061
1558
|
this.currentValue = decodeHtml(value);
|
|
2062
1559
|
this.triggerDefaultQuery(value);
|
|
2063
1560
|
},
|
|
2064
|
-
|
|
2065
|
-
var
|
|
1561
|
+
renderAutoFill: function renderAutoFill(suggestion) {
|
|
1562
|
+
var _this8 = this;
|
|
2066
1563
|
var handleAutoFillClick = function handleAutoFillClick(e) {
|
|
2067
1564
|
e.stopPropagation();
|
|
2068
|
-
|
|
1565
|
+
_this8.onAutofillClick(suggestion);
|
|
2069
1566
|
};
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
transform: 'rotate(135deg)',
|
|
2075
|
-
pointerEvents: 'none'
|
|
2076
|
-
}
|
|
2077
|
-
}, null);
|
|
2078
|
-
}
|
|
2079
|
-
return null;
|
|
2080
|
-
}
|
|
2081
|
-
if (!suggestion._category) {
|
|
2082
|
-
/* 👇 avoid showing autofill for category suggestions👇 */
|
|
2083
|
-
|
|
2084
|
-
return createVNode(AutoFillSvg, {
|
|
2085
|
-
"onClick": handleAutoFillClick
|
|
2086
|
-
}, null);
|
|
2087
|
-
}
|
|
2088
|
-
return null;
|
|
1567
|
+
/* 👇 avoid showing autofill for category suggestions👇 */
|
|
1568
|
+
return suggestion._category ? null : createVNode(AutoFillSvg, {
|
|
1569
|
+
"onClick": handleAutoFillClick
|
|
1570
|
+
}, null);
|
|
2089
1571
|
},
|
|
2090
1572
|
renderTag: function renderTag(item) {
|
|
2091
|
-
var
|
|
1573
|
+
var _this9 = this;
|
|
2092
1574
|
var innerClass = this.$props.innerClass;
|
|
2093
1575
|
return createVNode(TagItem, {
|
|
2094
1576
|
"class": getClassName$1(innerClass, 'selected-tag') || ''
|
|
@@ -2099,7 +1581,7 @@ var SearchBox = defineComponent({
|
|
|
2099
1581
|
"aria-label": "delete-tag",
|
|
2100
1582
|
"class": "close-icon",
|
|
2101
1583
|
"onClick": function onClick() {
|
|
2102
|
-
return
|
|
1584
|
+
return _this9.clearTag(item);
|
|
2103
1585
|
}
|
|
2104
1586
|
}, [createVNode(CancelSvg, null, null)])];
|
|
2105
1587
|
}
|
|
@@ -2122,7 +1604,7 @@ var SearchBox = defineComponent({
|
|
|
2122
1604
|
}
|
|
2123
1605
|
},
|
|
2124
1606
|
renderTags: function renderTags() {
|
|
2125
|
-
var
|
|
1607
|
+
var _this10 = this;
|
|
2126
1608
|
if (!Array.isArray(this.selectedTags)) {
|
|
2127
1609
|
return null;
|
|
2128
1610
|
}
|
|
@@ -2136,193 +1618,25 @@ var SearchBox = defineComponent({
|
|
|
2136
1618
|
}) : createVNode(TagsContainer, null, {
|
|
2137
1619
|
"default": function _default() {
|
|
2138
1620
|
return [tagsList.map(function (item) {
|
|
2139
|
-
return
|
|
1621
|
+
return _this10.renderTag(item);
|
|
2140
1622
|
}), shouldRenderClearAllTag && createVNode(TagItem, {
|
|
2141
|
-
"class": getClassName$1(
|
|
1623
|
+
"class": getClassName$1(_this10.$props.innerClass, 'selected-tag') || ''
|
|
2142
1624
|
}, {
|
|
2143
1625
|
"default": function _default() {
|
|
2144
1626
|
return [createVNode("span", null, [createTextVNode("Clear All")]), createVNode("span", {
|
|
2145
1627
|
"role": "img",
|
|
2146
1628
|
"aria-label": "delete-tag",
|
|
2147
1629
|
"class": "close-icon",
|
|
2148
|
-
"onClick":
|
|
1630
|
+
"onClick": _this10.clearAllTags
|
|
2149
1631
|
}, [createVNode(CancelSvg, null, null)])];
|
|
2150
1632
|
}
|
|
2151
1633
|
})];
|
|
2152
1634
|
}
|
|
2153
1635
|
});
|
|
2154
|
-
},
|
|
2155
|
-
getAISourceObjects: function getAISourceObjects() {
|
|
2156
|
-
var localCache = getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) && getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY)[this.componentId];
|
|
2157
|
-
var sourceObjects = [];
|
|
2158
|
-
if (!this.AIResponse) return sourceObjects;
|
|
2159
|
-
var docIds = this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [];
|
|
2160
|
-
if (localCache && localCache.meta && localCache.meta.hits && localCache.meta.hits.hits) {
|
|
2161
|
-
docIds.forEach(function (id) {
|
|
2162
|
-
var foundSourceObj = localCache.meta.hits.hits.find(function (hit) {
|
|
2163
|
-
return hit._id === id;
|
|
2164
|
-
}) || {};
|
|
2165
|
-
if (foundSourceObj) {
|
|
2166
|
-
var _foundSourceObj$_sour = foundSourceObj._source,
|
|
2167
|
-
_source = _foundSourceObj$_sour === void 0 ? {} : _foundSourceObj$_sour,
|
|
2168
|
-
rest = _objectWithoutPropertiesLoose(foundSourceObj, _excluded);
|
|
2169
|
-
sourceObjects.push(_extends({}, rest, _source));
|
|
2170
|
-
}
|
|
2171
|
-
});
|
|
2172
|
-
} else {
|
|
2173
|
-
sourceObjects.push.apply(sourceObjects, docIds.map(function (id) {
|
|
2174
|
-
return {
|
|
2175
|
-
_id: id
|
|
2176
|
-
};
|
|
2177
|
-
}));
|
|
2178
|
-
}
|
|
2179
|
-
return sourceObjects;
|
|
2180
|
-
},
|
|
2181
|
-
renderAIScreenLoader: function renderAIScreenLoader() {
|
|
2182
|
-
var _this$$props$AIUIConf = this.$props.AIUIConfig,
|
|
2183
|
-
AIUIConfig = _this$$props$AIUIConf === void 0 ? {} : _this$$props$AIUIConf;
|
|
2184
|
-
var _ref5 = AIUIConfig || {},
|
|
2185
|
-
loaderMessage = _ref5.loaderMessage;
|
|
2186
|
-
if (loaderMessage) {
|
|
2187
|
-
return loaderMessage;
|
|
2188
|
-
}
|
|
2189
|
-
if (this.$slots.AILoaderMessage) {
|
|
2190
|
-
return this.$slots.AILoaderMessage();
|
|
2191
|
-
}
|
|
2192
|
-
return createVNode(HorizontalSkeletonLoader, null, null);
|
|
2193
|
-
},
|
|
2194
|
-
renderAIScreenFooter: function renderAIScreenFooter() {
|
|
2195
|
-
var _slot7;
|
|
2196
|
-
var _this13 = this;
|
|
2197
|
-
var _this$$props$AIUIConf2 = this.$props.AIUIConfig,
|
|
2198
|
-
AIUIConfig = _this$$props$AIUIConf2 === void 0 ? {} : _this$$props$AIUIConf2;
|
|
2199
|
-
var _ref6 = AIUIConfig || {},
|
|
2200
|
-
_ref6$showSourceDocum = _ref6.showSourceDocuments,
|
|
2201
|
-
showSourceDocuments = _ref6$showSourceDocum === void 0 ? true : _ref6$showSourceDocum,
|
|
2202
|
-
_ref6$sourceDocumentL = _ref6.sourceDocumentLabel,
|
|
2203
|
-
sourceDocumentLabel = _ref6$sourceDocumentL === void 0 ? '_id' : _ref6$sourceDocumentL,
|
|
2204
|
-
_ref6$onSourceClick = _ref6.onSourceClick,
|
|
2205
|
-
onSourceClick = _ref6$onSourceClick === void 0 ? function () {} : _ref6$onSourceClick;
|
|
2206
|
-
return showSourceDocuments && this.showAIScreenFooter && this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds ? createVNode(Footer, {
|
|
2207
|
-
"themePreset": this.$props.themePreset
|
|
2208
|
-
}, {
|
|
2209
|
-
"default": function _default() {
|
|
2210
|
-
return [createTextVNode("Summary generated using the following sources:"), ' ', createVNode(SourceTags, null, _isSlot(_slot7 = _this13.getAISourceObjects().map(function (el) {
|
|
2211
|
-
return createVNode(Button, {
|
|
2212
|
-
"class": "--ai-source-tag " + (getClassName$1(_this13.$props.innerClass, 'ai-source-tag') || ''),
|
|
2213
|
-
"title": el[sourceDocumentLabel],
|
|
2214
|
-
"info": true,
|
|
2215
|
-
"onClick": function onClick() {
|
|
2216
|
-
return onSourceClick && onSourceClick(el);
|
|
2217
|
-
}
|
|
2218
|
-
}, {
|
|
2219
|
-
"default": function _default() {
|
|
2220
|
-
return [el[sourceDocumentLabel]];
|
|
2221
|
-
}
|
|
2222
|
-
});
|
|
2223
|
-
})) ? _slot7 : {
|
|
2224
|
-
"default": function _default() {
|
|
2225
|
-
return [_slot7];
|
|
2226
|
-
}
|
|
2227
|
-
})];
|
|
2228
|
-
}
|
|
2229
|
-
}) : null;
|
|
2230
|
-
},
|
|
2231
|
-
renderAIScreen: function renderAIScreen() {
|
|
2232
|
-
var _this14 = this;
|
|
2233
|
-
var customAIRenderer = this.$props.renderAIAnswer || this.$slots.renderAIAnswer;
|
|
2234
|
-
if (customAIRenderer) {
|
|
2235
|
-
return customAIRenderer({
|
|
2236
|
-
question: this.AIResponse && this.AIResponse.response && this.AIResponse.response.question,
|
|
2237
|
-
answer: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text,
|
|
2238
|
-
documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
|
|
2239
|
-
loading: this.isAIResponseLoading || this.isLoading,
|
|
2240
|
-
sources: this.getAISourceObjects(),
|
|
2241
|
-
error: this.AIResponseError
|
|
2242
|
-
});
|
|
2243
|
-
}
|
|
2244
|
-
if (this.isAIResponseLoading || this.isLoading) {
|
|
2245
|
-
return this.renderAIScreenLoader();
|
|
2246
|
-
}
|
|
2247
|
-
return createVNode("div", null, [createVNode(Answer, {
|
|
2248
|
-
"innerHTML": md.render(this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text)
|
|
2249
|
-
}, null), this.renderAIScreenFooter(), this.showFeedbackComponent && createVNode("div", {
|
|
2250
|
-
"class": "" + (getClassName$1(this.$props.innerClass, 'ai-feedback') || '')
|
|
2251
|
-
}, [createVNode(AIFeedback, {
|
|
2252
|
-
"overrideState": this.feedbackState,
|
|
2253
|
-
"hideUI": this.isAIResponseLoading || this.isLoading || !this.sessionIdFromStore,
|
|
2254
|
-
"key": this.sessionIdFromStore,
|
|
2255
|
-
"onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
|
|
2256
|
-
_this14.feedbackState = {
|
|
2257
|
-
isRecorded: true,
|
|
2258
|
-
feedbackType: useful ? 'positive' : 'negative'
|
|
2259
|
-
};
|
|
2260
|
-
_this14.recordAISessionUsefulness(_this14.sessionIdFromStore, {
|
|
2261
|
-
useful: useful,
|
|
2262
|
-
reason: reason
|
|
2263
|
-
});
|
|
2264
|
-
}
|
|
2265
|
-
}, null)])]);
|
|
2266
|
-
},
|
|
2267
|
-
handleTextAreaHeightChange: function handleTextAreaHeightChange() {
|
|
2268
|
-
var _this$$refs$this$$pro, _this$$refs$_inputGro;
|
|
2269
|
-
var textArea = (_this$$refs$this$$pro = this.$refs[this.$props.innerRef]) == null ? void 0 : _this$$refs$this$$pro.$el;
|
|
2270
|
-
var inputGroupEle = (_this$$refs$_inputGro = this.$refs[_inputGroupRef]) == null ? void 0 : _this$$refs$_inputGro.$el;
|
|
2271
|
-
if (textArea) {
|
|
2272
|
-
textArea.style.height = '42px';
|
|
2273
|
-
var lineHeight = parseInt(getComputedStyle(textArea).lineHeight, 10);
|
|
2274
|
-
var maxHeight = lineHeight * 4; // max height for 3 lines
|
|
2275
|
-
var height = Math.min(textArea.scrollHeight, maxHeight);
|
|
2276
|
-
textArea.style.height = height + "px";
|
|
2277
|
-
textArea.style.overflowY = height === maxHeight ? 'auto' : 'hidden';
|
|
2278
|
-
var dropdownEle = this.$refs[_dropdownULRef];
|
|
2279
|
-
if (dropdownEle) {
|
|
2280
|
-
dropdownEle.style.top = "" + textArea.style.height;
|
|
2281
|
-
}
|
|
2282
|
-
if (inputGroupEle) {
|
|
2283
|
-
inputGroupEle.style.height = "" + textArea.style.height;
|
|
2284
|
-
}
|
|
2285
|
-
}
|
|
2286
|
-
},
|
|
2287
|
-
askButtonOnClick: function askButtonOnClick() {
|
|
2288
|
-
this.showAIScreen = true;
|
|
2289
|
-
this.isOpen = true;
|
|
2290
|
-
this.triggerDefaultQuery(this.currentValue, {
|
|
2291
|
-
enableAI: true
|
|
2292
|
-
});
|
|
2293
|
-
},
|
|
2294
|
-
renderAskButtonElement: function renderAskButtonElement() {
|
|
2295
|
-
var _this15 = this;
|
|
2296
|
-
var _this$$props5 = this.$props,
|
|
2297
|
-
AIUIConfig = _this$$props5.AIUIConfig,
|
|
2298
|
-
innerClass = _this$$props5.innerClass;
|
|
2299
|
-
var _ref7 = AIUIConfig || {},
|
|
2300
|
-
askButton = _ref7.askButton;
|
|
2301
|
-
var renderAskButton = this.$slots.renderAskButton;
|
|
2302
|
-
if (askButton) {
|
|
2303
|
-
var getEnterButtonMarkup = function getEnterButtonMarkup() {
|
|
2304
|
-
if (renderAskButton) {
|
|
2305
|
-
return renderAskButton(_this15.askButtonOnClick);
|
|
2306
|
-
}
|
|
2307
|
-
return createVNode(Button, {
|
|
2308
|
-
"class": "enter-btn " + getClassName$1(innerClass, 'ask-button'),
|
|
2309
|
-
"info": true,
|
|
2310
|
-
"onClick": _this15.askButtonOnClick
|
|
2311
|
-
}, {
|
|
2312
|
-
"default": function _default() {
|
|
2313
|
-
return [createTextVNode("Ask")];
|
|
2314
|
-
}
|
|
2315
|
-
});
|
|
2316
|
-
};
|
|
2317
|
-
return createVNode("div", {
|
|
2318
|
-
"class": "enter-button-wrapper"
|
|
2319
|
-
}, [getEnterButtonMarkup()]);
|
|
2320
|
-
}
|
|
2321
|
-
return null;
|
|
2322
1636
|
}
|
|
2323
1637
|
},
|
|
2324
1638
|
render: function render() {
|
|
2325
|
-
var
|
|
1639
|
+
var _this11 = this;
|
|
2326
1640
|
var expandSuggestionsContainer = this.$props.expandSuggestionsContainer;
|
|
2327
1641
|
var _this$$slots = this.$slots,
|
|
2328
1642
|
recentSearchesIcon = _this$$slots.recentSearchesIcon,
|
|
@@ -2333,250 +1647,164 @@ var SearchBox = defineComponent({
|
|
|
2333
1647
|
"class": this.$props.className
|
|
2334
1648
|
}, {
|
|
2335
1649
|
"default": function _default() {
|
|
2336
|
-
return [
|
|
2337
|
-
"class": getClassName$1(
|
|
1650
|
+
return [_this11.$props.title && createVNode(Title, {
|
|
1651
|
+
"class": getClassName$1(_this11.$props.innerClass, 'title') || ''
|
|
2338
1652
|
}, {
|
|
2339
1653
|
"default": function _default() {
|
|
2340
|
-
return [
|
|
1654
|
+
return [_this11.$props.title];
|
|
2341
1655
|
}
|
|
2342
|
-
}),
|
|
2343
|
-
"id":
|
|
2344
|
-
"handleChange":
|
|
2345
|
-
"handleMouseup":
|
|
2346
|
-
"isOpen":
|
|
1656
|
+
}), _this11.$props.autosuggest ? createVNode(Downshift, {
|
|
1657
|
+
"id": _this11.$props.componentId + "-downshift",
|
|
1658
|
+
"handleChange": _this11.onSuggestionSelected,
|
|
1659
|
+
"handleMouseup": _this11.handleStateChange,
|
|
1660
|
+
"isOpen": _this11.$data.isOpen
|
|
2347
1661
|
}, {
|
|
2348
|
-
"default": function _default(
|
|
2349
|
-
var getInputEvents =
|
|
2350
|
-
getInputProps =
|
|
2351
|
-
getItemProps =
|
|
2352
|
-
getItemEvents =
|
|
2353
|
-
isOpen =
|
|
2354
|
-
highlightedIndex =
|
|
2355
|
-
setHighlightedIndex =
|
|
1662
|
+
"default": function _default(_ref5) {
|
|
1663
|
+
var getInputEvents = _ref5.getInputEvents,
|
|
1664
|
+
getInputProps = _ref5.getInputProps,
|
|
1665
|
+
getItemProps = _ref5.getItemProps,
|
|
1666
|
+
getItemEvents = _ref5.getItemEvents,
|
|
1667
|
+
isOpen = _ref5.isOpen,
|
|
1668
|
+
highlightedIndex = _ref5.highlightedIndex,
|
|
1669
|
+
setHighlightedIndex = _ref5.setHighlightedIndex;
|
|
2356
1670
|
var renderSuggestionsDropdown = function renderSuggestionsDropdown() {
|
|
2357
|
-
var getIcon = function getIcon(iconType
|
|
1671
|
+
var getIcon = function getIcon(iconType) {
|
|
2358
1672
|
switch (iconType) {
|
|
2359
1673
|
case suggestionTypes.Recent:
|
|
2360
1674
|
return recentSearchesIcon;
|
|
2361
1675
|
case suggestionTypes.Popular:
|
|
2362
1676
|
return popularSearchesIcon;
|
|
2363
|
-
case suggestionTypes.Featured:
|
|
2364
|
-
if (item.icon) {
|
|
2365
|
-
return function () {
|
|
2366
|
-
return createVNode("div", {
|
|
2367
|
-
"style": {
|
|
2368
|
-
display: 'flex'
|
|
2369
|
-
},
|
|
2370
|
-
"innerHTML": xss(item.icon)
|
|
2371
|
-
}, null);
|
|
2372
|
-
};
|
|
2373
|
-
}
|
|
2374
|
-
if (item.iconURL) {
|
|
2375
|
-
return function () {
|
|
2376
|
-
return (// When you change below also change the empty icon below
|
|
2377
|
-
createVNode("img", {
|
|
2378
|
-
"style": {
|
|
2379
|
-
maxHeight: '25px'
|
|
2380
|
-
},
|
|
2381
|
-
"src": xss(item.iconURL),
|
|
2382
|
-
"alt": item.value
|
|
2383
|
-
}, null)
|
|
2384
|
-
);
|
|
2385
|
-
};
|
|
2386
|
-
}
|
|
2387
|
-
// Render an empty icon when no icon is provided from the dashboard
|
|
2388
|
-
return function () {
|
|
2389
|
-
return createVNode("span", {
|
|
2390
|
-
"style": {
|
|
2391
|
-
display: 'inline-block',
|
|
2392
|
-
height: '25px',
|
|
2393
|
-
width: leaveSpaceForIcon ? '25px' : 0
|
|
2394
|
-
}
|
|
2395
|
-
}, null);
|
|
2396
|
-
};
|
|
2397
1677
|
default:
|
|
2398
1678
|
return null;
|
|
2399
1679
|
}
|
|
2400
1680
|
};
|
|
2401
|
-
|
|
2402
|
-
return createVNode("div", null, [_this16.hasCustomRenderer && _this16.getComponent({
|
|
1681
|
+
return createVNode("div", null, [_this11.hasCustomRenderer && _this11.getComponent({
|
|
2403
1682
|
isOpen: isOpen,
|
|
2404
1683
|
getItemProps: getItemProps,
|
|
2405
1684
|
getItemEvents: getItemEvents,
|
|
2406
1685
|
highlightedIndex: highlightedIndex
|
|
2407
|
-
}),
|
|
2408
|
-
"class": suggestions(
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
}), _transformOn(getItemEvents({
|
|
2447
|
-
item: sectionItem
|
|
2448
|
-
})), {
|
|
2449
|
-
"key": index + sectionIndex,
|
|
2450
|
-
"style": {
|
|
2451
|
-
justifyContent: 'flex-start',
|
|
2452
|
-
alignItems: 'center'
|
|
2453
|
-
},
|
|
2454
|
-
"class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this16.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this16.$props.innerClass, 'suggestion-item'))
|
|
2455
|
-
}), [createVNode("div", {
|
|
2456
|
-
"style": {
|
|
2457
|
-
padding: '0 10px 0 0',
|
|
2458
|
-
display: 'flex'
|
|
2459
|
-
}
|
|
2460
|
-
}, [createVNode(CustomSvg, {
|
|
2461
|
-
"className": getClassName$1(_this16.$props.innerClass, sectionItem._suggestion_type + "-search-icon") || null,
|
|
2462
|
-
"icon": getIcon(sectionItem._suggestion_type, sectionItem, suggestionsHaveIcon),
|
|
2463
|
-
"type": sectionItem._suggestion_type + "-search-icon"
|
|
2464
|
-
}, null)]), createVNode(SuggestionItem, {
|
|
2465
|
-
"currentValue": _this16.currentValue,
|
|
2466
|
-
"suggestion": sectionItem
|
|
2467
|
-
}, null), _this16.renderActionIcon(sectionItem)]);
|
|
2468
|
-
})])]);
|
|
2469
|
-
}
|
|
2470
|
-
return createVNode("div", null, [createTextVNode("No suggestions")]);
|
|
2471
|
-
}), _this16.$props.showSuggestionsFooter ? _this16.suggestionsFooter() : null]) : _this16.renderNoSuggestions(_this16.normalizedSuggestions)]);
|
|
1686
|
+
}), _this11.renderErrorComponent(), !_this11.hasCustomRenderer && isOpen && hasSuggestions ? createVNode("ul", {
|
|
1687
|
+
"class": suggestions(_this11.themePreset, _this11.theme) + " " + getClassName$1(_this11.$props.innerClass, 'list')
|
|
1688
|
+
}, [_this11.normalizedSuggestions.map(function (item, index) {
|
|
1689
|
+
return renderItem ? createVNode("li", mergeProps(getItemProps({
|
|
1690
|
+
item: item
|
|
1691
|
+
}), getItemEvents({
|
|
1692
|
+
item: item
|
|
1693
|
+
}), {
|
|
1694
|
+
"key": index + 1 + "-" + item.value,
|
|
1695
|
+
"style": {
|
|
1696
|
+
backgroundColor: _this11.getBackgroundColor(highlightedIndex, index),
|
|
1697
|
+
justifyContent: 'flex-start',
|
|
1698
|
+
alignItems: 'center'
|
|
1699
|
+
}
|
|
1700
|
+
}), [renderItem(item)]) : createVNode("li", mergeProps(getItemProps({
|
|
1701
|
+
item: item
|
|
1702
|
+
}), _transformOn(getItemEvents({
|
|
1703
|
+
item: item
|
|
1704
|
+
})), {
|
|
1705
|
+
"key": index + 1 + "-" + item.value,
|
|
1706
|
+
"style": {
|
|
1707
|
+
backgroundColor: _this11.getBackgroundColor(highlightedIndex, index),
|
|
1708
|
+
justifyContent: 'flex-start',
|
|
1709
|
+
alignItems: 'center'
|
|
1710
|
+
}
|
|
1711
|
+
}), [createVNode("div", {
|
|
1712
|
+
"style": {
|
|
1713
|
+
padding: '0 10px 0 0',
|
|
1714
|
+
display: 'flex'
|
|
1715
|
+
}
|
|
1716
|
+
}, [createVNode(CustomSvg, {
|
|
1717
|
+
"className": getClassName$1(_this11.$props.innerClass, item._suggestion_type + "-search-icon") || null,
|
|
1718
|
+
"icon": getIcon(item._suggestion_type),
|
|
1719
|
+
"type": item._suggestion_type + "-search-icon"
|
|
1720
|
+
}, null)]), createVNode(SuggestionItem, {
|
|
1721
|
+
"currentValue": _this11.currentValue,
|
|
1722
|
+
"suggestion": item
|
|
1723
|
+
}, null), _this11.renderAutoFill(item)]);
|
|
1724
|
+
})]) : _this11.renderNoSuggestions(_this11.normalizedSuggestions)]);
|
|
2472
1725
|
};
|
|
2473
1726
|
return createVNode("div", {
|
|
2474
1727
|
"class": suggestionsContainer
|
|
2475
|
-
}, [createVNode(InputGroup, {
|
|
2476
|
-
"searchBox": true,
|
|
2477
|
-
"ref": _inputGroupRef
|
|
2478
|
-
}, {
|
|
1728
|
+
}, [createVNode(InputGroup, null, {
|
|
2479
1729
|
"default": function _default() {
|
|
2480
|
-
return [createVNode(
|
|
2481
|
-
"default": function _default() {
|
|
2482
|
-
return [_this16.renderInputAddonBefore(), _this16.renderLeftIcons()];
|
|
2483
|
-
}
|
|
2484
|
-
}), createVNode(InputWrapper, null, {
|
|
1730
|
+
return [_this11.renderInputAddonBefore(), createVNode(InputWrapper, null, {
|
|
2485
1731
|
"default": function _default() {
|
|
2486
|
-
return [createVNode(
|
|
2487
|
-
onInput:
|
|
1732
|
+
return [createVNode(Input, mergeProps(_transformOn(getInputEvents({
|
|
1733
|
+
onInput: _this11.onInputChange,
|
|
2488
1734
|
onBlur: function onBlur(e) {
|
|
2489
|
-
|
|
1735
|
+
_this11.$emit('blur', e, _this11.triggerQuery);
|
|
2490
1736
|
},
|
|
2491
|
-
onFocus:
|
|
1737
|
+
onFocus: _this11.handleFocus,
|
|
2492
1738
|
onKeyPress: function onKeyPress(e) {
|
|
2493
|
-
|
|
2494
|
-
|
|
1739
|
+
_this11.$emit('keyPress', e, _this11.triggerQuery);
|
|
1740
|
+
_this11.$emit('key-press', e, _this11.triggerQuery);
|
|
2495
1741
|
},
|
|
2496
1742
|
onKeyDown: function onKeyDown(e) {
|
|
2497
|
-
return
|
|
1743
|
+
return _this11.handleKeyDown(e, highlightedIndex);
|
|
2498
1744
|
},
|
|
2499
1745
|
onKeyUp: function onKeyUp(e) {
|
|
2500
|
-
|
|
2501
|
-
|
|
1746
|
+
_this11.$emit('keyUp', e, _this11.triggerQuery);
|
|
1747
|
+
_this11.$emit('key-up', e, _this11.triggerQuery);
|
|
2502
1748
|
},
|
|
2503
1749
|
onClick: function onClick() {
|
|
2504
1750
|
setHighlightedIndex(null);
|
|
2505
1751
|
}
|
|
2506
1752
|
})), {
|
|
2507
|
-
"id":
|
|
2508
|
-
"showIcon":
|
|
2509
|
-
"showClear":
|
|
2510
|
-
"iconPosition":
|
|
2511
|
-
"ref":
|
|
2512
|
-
"class": getClassName$1(
|
|
2513
|
-
"placeholder":
|
|
2514
|
-
"autoFocus":
|
|
2515
|
-
"searchBox": true,
|
|
2516
|
-
"showFocusShortcutsIcon": _this16.$props.showFocusShortcutsIcon,
|
|
2517
|
-
"showVoiceSearch": _this16.$props.showVoiceSearch
|
|
1753
|
+
"id": _this11.$props.componentId + "-input",
|
|
1754
|
+
"showIcon": _this11.$props.showIcon,
|
|
1755
|
+
"showClear": _this11.$props.showClear,
|
|
1756
|
+
"iconPosition": _this11.$props.iconPosition,
|
|
1757
|
+
"ref": _this11.$props.innerRef,
|
|
1758
|
+
"class": getClassName$1(_this11.$props.innerClass, 'input'),
|
|
1759
|
+
"placeholder": _this11.$props.placeholder,
|
|
1760
|
+
"autoFocus": _this11.$props.autoFocus
|
|
2518
1761
|
}, getInputProps({
|
|
2519
|
-
value:
|
|
1762
|
+
value: _this11.$data.currentValue === null ? '' : _this11.$data.currentValue
|
|
2520
1763
|
}), {
|
|
2521
|
-
"themePreset":
|
|
1764
|
+
"themePreset": _this11.themePreset,
|
|
2522
1765
|
"autocomplete": "off"
|
|
2523
|
-
}), null), !expandSuggestionsContainer && renderSuggestionsDropdown()];
|
|
2524
|
-
}
|
|
2525
|
-
}), createVNode(Actions$1, null, {
|
|
2526
|
-
"default": function _default() {
|
|
2527
|
-
return [_this16.renderRightIcons(), _this16.renderInputAddonAfter(), _this16.renderAskButtonElement(), _this16.renderEnterButtonElement()];
|
|
1766
|
+
}), null), _this11.renderIcons(), !expandSuggestionsContainer && renderSuggestionsDropdown()];
|
|
2528
1767
|
}
|
|
2529
|
-
})];
|
|
1768
|
+
}), _this11.renderInputAddonAfter(), _this11.renderEnterButtonElement()];
|
|
2530
1769
|
}
|
|
2531
|
-
}), expandSuggestionsContainer && renderSuggestionsDropdown(),
|
|
1770
|
+
}), expandSuggestionsContainer && renderSuggestionsDropdown(), _this11.renderTags()]);
|
|
2532
1771
|
}
|
|
2533
1772
|
}) : createVNode("div", {
|
|
2534
1773
|
"class": suggestionsContainer
|
|
2535
|
-
}, [createVNode(InputGroup, {
|
|
2536
|
-
"searchBox": true,
|
|
2537
|
-
"ref": _inputGroupRef
|
|
2538
|
-
}, {
|
|
1774
|
+
}, [createVNode(InputGroup, null, {
|
|
2539
1775
|
"default": function _default() {
|
|
2540
|
-
return [createVNode(
|
|
2541
|
-
"default": function _default() {
|
|
2542
|
-
return [_this16.renderInputAddonBefore(), _this16.renderLeftIcons()];
|
|
2543
|
-
}
|
|
2544
|
-
}), createVNode(InputWrapper, null, {
|
|
1776
|
+
return [_this11.renderInputAddonBefore(), createVNode(InputWrapper, null, {
|
|
2545
1777
|
"default": function _default() {
|
|
2546
|
-
return [createVNode(
|
|
1778
|
+
return [createVNode(Input, mergeProps(_transformOn({
|
|
2547
1779
|
blur: function blur(e) {
|
|
2548
|
-
|
|
1780
|
+
_this11.$emit('blur', e, _this11.triggerQuery);
|
|
2549
1781
|
},
|
|
2550
1782
|
keypress: function keypress(e) {
|
|
2551
|
-
|
|
2552
|
-
|
|
1783
|
+
_this11.$emit('keyPress', e, _this11.triggerQuery);
|
|
1784
|
+
_this11.$emit('key-press', e, _this11.triggerQuery);
|
|
2553
1785
|
},
|
|
2554
|
-
input:
|
|
1786
|
+
input: _this11.onInputChange,
|
|
2555
1787
|
focus: function focus(e) {
|
|
2556
|
-
|
|
1788
|
+
_this11.$emit('focus', e, _this11.triggerQuery);
|
|
2557
1789
|
},
|
|
2558
|
-
keydown:
|
|
1790
|
+
keydown: _this11.handleKeyDown,
|
|
2559
1791
|
keyup: function keyup(e) {
|
|
2560
|
-
|
|
2561
|
-
|
|
1792
|
+
_this11.$emit('keyUp', e, _this11.triggerQuery);
|
|
1793
|
+
_this11.$emit('key-up', e, _this11.triggerQuery);
|
|
2562
1794
|
}
|
|
2563
1795
|
}), {
|
|
2564
|
-
"class": getClassName$1(
|
|
2565
|
-
"placeholder":
|
|
2566
|
-
"autofocus":
|
|
2567
|
-
"value":
|
|
2568
|
-
"iconPosition":
|
|
2569
|
-
"showIcon":
|
|
2570
|
-
"showClear":
|
|
2571
|
-
"ref":
|
|
2572
|
-
"themePreset":
|
|
2573
|
-
}), null)];
|
|
1796
|
+
"class": getClassName$1(_this11.$props.innerClass, 'input') || '',
|
|
1797
|
+
"placeholder": _this11.$props.placeholder,
|
|
1798
|
+
"autofocus": _this11.$props.autoFocus,
|
|
1799
|
+
"value": _this11.$data.currentValue ? _this11.$data.currentValue : '',
|
|
1800
|
+
"iconPosition": _this11.$props.iconPosition,
|
|
1801
|
+
"showIcon": _this11.$props.showIcon,
|
|
1802
|
+
"showClear": _this11.$props.showClear,
|
|
1803
|
+
"ref": _this11.$props.innerRef,
|
|
1804
|
+
"themePreset": _this11.themePreset
|
|
1805
|
+
}), null), _this11.renderIcons()];
|
|
2574
1806
|
}
|
|
2575
|
-
}),
|
|
2576
|
-
"default": function _default() {
|
|
2577
|
-
return [_this16.renderRightIcons(), _this16.renderInputAddonAfter(), _this16.renderEnterButtonElement()];
|
|
2578
|
-
}
|
|
2579
|
-
})];
|
|
1807
|
+
}), _this11.renderInputAddonAfter(), _this11.renderEnterButtonElement()];
|
|
2580
1808
|
}
|
|
2581
1809
|
})])];
|
|
2582
1810
|
}
|
|
@@ -2629,24 +1857,18 @@ var mapStateToProps = function mapStateToProps(state, props) {
|
|
|
2629
1857
|
rawData: state.rawData[props.componentId],
|
|
2630
1858
|
aggregationData: state.compositeAggregations[props.componentId] || [],
|
|
2631
1859
|
themePreset: state.config.themePreset,
|
|
2632
|
-
isLoading: !!state.isLoading[
|
|
1860
|
+
isLoading: !!state.isLoading[props.componentId + "_active"],
|
|
2633
1861
|
error: state.error[props.componentId],
|
|
2634
1862
|
time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
|
|
2635
1863
|
total: state.hits[props.componentId] && state.hits[props.componentId].total,
|
|
2636
|
-
hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden
|
|
2637
|
-
AIResponse: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response || null,
|
|
2638
|
-
isAIResponseLoading: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].isLoading,
|
|
2639
|
-
AIResponseError: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].error,
|
|
2640
|
-
sessionIdFromStore: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.sessionId || '',
|
|
2641
|
-
isAITyping: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.isTyping || false
|
|
1864
|
+
hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden
|
|
2642
1865
|
};
|
|
2643
1866
|
};
|
|
2644
1867
|
var mapDispatchToProps = {
|
|
2645
1868
|
updateQuery: updateQuery,
|
|
2646
1869
|
setCustomQuery: setCustomQuery,
|
|
2647
1870
|
setDefaultQuery: setDefaultQuery,
|
|
2648
|
-
recordSuggestionClick: recordSuggestionClick
|
|
2649
|
-
recordAISessionUsefulness: recordAISessionUsefulness
|
|
1871
|
+
recordSuggestionClick: recordSuggestionClick
|
|
2650
1872
|
};
|
|
2651
1873
|
var SBConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps, mapDispatchToProps)(SearchBox), {
|
|
2652
1874
|
componentType: componentTypes.searchBox,
|
|
@@ -2662,608 +1884,9 @@ SBConnected.install = function (Vue) {
|
|
|
2662
1884
|
// Add componentType for SSR
|
|
2663
1885
|
SBConnected.componentType = componentTypes.searchBox;
|
|
2664
1886
|
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
}
|
|
2668
|
-
var md$1 = new Remarkable();
|
|
2669
|
-
md$1.set({
|
|
2670
|
-
html: true,
|
|
2671
|
-
breaks: true,
|
|
2672
|
-
xhtmlOut: true
|
|
2673
|
-
});
|
|
2674
|
-
var _inputWrapperRef = 'inputWrapperRef';
|
|
2675
|
-
var _inputRef = 'inputRef';
|
|
2676
|
-
var _errorContainerRef = 'errorContainerRef';
|
|
2677
|
-
var AIAnswer = defineComponent({
|
|
2678
|
-
name: 'AIAnswer',
|
|
2679
|
-
data: function data() {
|
|
2680
|
-
var props = this.$props;
|
|
2681
|
-
this.__state = {
|
|
2682
|
-
messages: [],
|
|
2683
|
-
inputMessage: '',
|
|
2684
|
-
AISessionId: '',
|
|
2685
|
-
error: null
|
|
2686
|
-
};
|
|
2687
|
-
this.internalComponent = props.componentId + "__internal";
|
|
2688
|
-
return this.__state;
|
|
2689
|
-
},
|
|
2690
|
-
inject: {
|
|
2691
|
-
theme: {
|
|
2692
|
-
from: 'theme_reactivesearch'
|
|
2693
|
-
}
|
|
2694
|
-
},
|
|
2695
|
-
created: function created() {},
|
|
2696
|
-
computed: {
|
|
2697
|
-
hasCustomRenderer: function hasCustomRenderer$1() {
|
|
2698
|
-
return hasCustomRenderer(this);
|
|
2699
|
-
},
|
|
2700
|
-
isLoadingState: function isLoadingState() {
|
|
2701
|
-
return this.isAIResponseLoading || this.isLoading;
|
|
2702
|
-
},
|
|
2703
|
-
shouldShowComponent: function shouldShowComponent() {
|
|
2704
|
-
return this.showComponent;
|
|
2705
|
-
},
|
|
2706
|
-
errorMessageForMissingSessionId: function errorMessageForMissingSessionId() {
|
|
2707
|
-
return "AISessionId for " + this.$props.componentId + " is missing! AIAnswer component requires an AISessionId to function. Try reloading the App.";
|
|
2708
|
-
}
|
|
2709
|
-
},
|
|
2710
|
-
props: {
|
|
2711
|
-
componentId: types.string.isRequired,
|
|
2712
|
-
showVoiceInput: VueTypes.bool.def(false),
|
|
2713
|
-
showFeedback: VueTypes.bool.def(true),
|
|
2714
|
-
showIcon: VueTypes.bool.def(true),
|
|
2715
|
-
onData: types.func,
|
|
2716
|
-
innerRef: VueTypes.string.def('AISearchInputField'),
|
|
2717
|
-
react: types.react,
|
|
2718
|
-
enableAI: VueTypes.bool.def(true),
|
|
2719
|
-
AIConfig: types.AIConfig,
|
|
2720
|
-
iconPosition: types.iconPosition.def('left'),
|
|
2721
|
-
themePreset: types.themePreset,
|
|
2722
|
-
theme: types.style,
|
|
2723
|
-
icon: types.children,
|
|
2724
|
-
iconURL: VueTypes.string.def(''),
|
|
2725
|
-
renderMic: types.func,
|
|
2726
|
-
getMicInstance: types.func,
|
|
2727
|
-
innerClass: types.style,
|
|
2728
|
-
placeholder: VueTypes.string.def('Ask a question'),
|
|
2729
|
-
title: types.title,
|
|
2730
|
-
AIResponse: types.componentObject,
|
|
2731
|
-
isAIResponseLoading: VueTypes.bool.def(false),
|
|
2732
|
-
AIResponseError: types.componentObject,
|
|
2733
|
-
getAIResponse: types.func.isRequired,
|
|
2734
|
-
enterButton: types.bool,
|
|
2735
|
-
renderEnterButton: types.title,
|
|
2736
|
-
showInput: VueTypes.bool.def(true),
|
|
2737
|
-
clearSessionOnDestroy: VueTypes.bool.def(true),
|
|
2738
|
-
rawData: types.rawData,
|
|
2739
|
-
render: types.func,
|
|
2740
|
-
onError: types.func,
|
|
2741
|
-
renderError: types.title,
|
|
2742
|
-
isLoading: types.boolRequired,
|
|
2743
|
-
sessionIdFromStore: VueTypes.string,
|
|
2744
|
-
showComponent: types.boolRequired,
|
|
2745
|
-
componentError: types.componentObject,
|
|
2746
|
-
style: types.style
|
|
2747
|
-
},
|
|
2748
|
-
mounted: function mounted() {},
|
|
2749
|
-
watch: {
|
|
2750
|
-
AIResponse: function AIResponse(newVal) {
|
|
2751
|
-
if (newVal) {
|
|
2752
|
-
this.AISessionId = ((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || null;
|
|
2753
|
-
var messagesHistory = newVal.messages,
|
|
2754
|
-
response = newVal.response;
|
|
2755
|
-
var finalMessages = [];
|
|
2756
|
-
if (response && response.error) {
|
|
2757
|
-
this.error = {
|
|
2758
|
-
message: response.error
|
|
2759
|
-
};
|
|
2760
|
-
}
|
|
2761
|
-
|
|
2762
|
-
// pushing message history so far
|
|
2763
|
-
if (messagesHistory && messagesHistory && Array.isArray(messagesHistory)) {
|
|
2764
|
-
finalMessages.push.apply(finalMessages, messagesHistory.filter(function (msg) {
|
|
2765
|
-
return msg.role !== AI_ROLES.SYSTEM;
|
|
2766
|
-
}));
|
|
2767
|
-
} else if (response && response.answer && response.answer.text) {
|
|
2768
|
-
finalMessages.push({
|
|
2769
|
-
role: AI_ROLES.ASSISTANT,
|
|
2770
|
-
content: response.answer.text
|
|
2771
|
-
});
|
|
2772
|
-
if (!this.AISessionId) this.error = {
|
|
2773
|
-
message: this.errorMessageForMissingSessionId
|
|
2774
|
-
};
|
|
2775
|
-
}
|
|
2776
|
-
this.messages = finalMessages;
|
|
2777
|
-
} else if (!newVal && !this.error) {
|
|
2778
|
-
this.messages = [];
|
|
2779
|
-
}
|
|
2780
|
-
},
|
|
2781
|
-
rawData: function rawData(newVal) {
|
|
2782
|
-
this.$emit('on-data', {
|
|
2783
|
-
data: this.messages,
|
|
2784
|
-
rawData: newVal,
|
|
2785
|
-
loading: this.$props.isAIResponseLoading || this.$props.isLoading,
|
|
2786
|
-
error: this.$props.AIResponseError
|
|
2787
|
-
});
|
|
2788
|
-
},
|
|
2789
|
-
isAIResponseLoading: function isAIResponseLoading(newVal) {
|
|
2790
|
-
this.$emit('on-data', {
|
|
2791
|
-
data: this.messages,
|
|
2792
|
-
rawData: this.$props.rawData,
|
|
2793
|
-
loading: newVal || this.isLoading,
|
|
2794
|
-
error: this.$props.AIResponseError
|
|
2795
|
-
});
|
|
2796
|
-
},
|
|
2797
|
-
isLoading: function isLoading(newVal) {
|
|
2798
|
-
this.$emit('on-data', {
|
|
2799
|
-
data: this.messages,
|
|
2800
|
-
rawData: this.$props.rawData,
|
|
2801
|
-
loading: newVal || this.isAIResponseLoading,
|
|
2802
|
-
error: this.$props.AIResponseError
|
|
2803
|
-
});
|
|
2804
|
-
},
|
|
2805
|
-
sessionIdFromStore: function sessionIdFromStore(newVal) {
|
|
2806
|
-
if (newVal) {
|
|
2807
|
-
this.sessionId = newVal;
|
|
2808
|
-
}
|
|
2809
|
-
},
|
|
2810
|
-
AIResponseError: function AIResponseError(newVal) {
|
|
2811
|
-
this.error = newVal;
|
|
2812
|
-
this.AISessionId = ((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || null;
|
|
2813
|
-
if (this.error && !this.AISessionId) {
|
|
2814
|
-
var errorMessage = this.errorMessageForMissingSessionId;
|
|
2815
|
-
this.error = {
|
|
2816
|
-
message: errorMessage
|
|
2817
|
-
};
|
|
2818
|
-
console.error(errorMessage);
|
|
2819
|
-
}
|
|
2820
|
-
this.$emit('on-data', {
|
|
2821
|
-
data: this.messages,
|
|
2822
|
-
rawData: this.$props.rawData,
|
|
2823
|
-
loading: this.isAIResponseLoading || this.isLoading,
|
|
2824
|
-
error: newVal
|
|
2825
|
-
});
|
|
2826
|
-
},
|
|
2827
|
-
messages: function messages() {
|
|
2828
|
-
this.scrollToBottom();
|
|
2829
|
-
},
|
|
2830
|
-
componentError: function componentError(newVal) {
|
|
2831
|
-
var _this = this;
|
|
2832
|
-
if (newVal && newVal._bodyBlob) {
|
|
2833
|
-
this.AISessionId = ((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || null;
|
|
2834
|
-
if (!this.AISessionId) {
|
|
2835
|
-
this.generateNewSessionId();
|
|
2836
|
-
}
|
|
2837
|
-
newVal._bodyBlob.text().then(function (textData) {
|
|
2838
|
-
try {
|
|
2839
|
-
var parsedErrorRes = JSON.parse(textData);
|
|
2840
|
-
if (parsedErrorRes.error) {
|
|
2841
|
-
_this.error = parsedErrorRes.error;
|
|
2842
|
-
_this.$emit('on-data', {
|
|
2843
|
-
data: _this.messages,
|
|
2844
|
-
rawData: _this.$props.rawData,
|
|
2845
|
-
loading: _this.$props.isAIResponseLoading || _this.$props.isLoading,
|
|
2846
|
-
error: parsedErrorRes.error
|
|
2847
|
-
});
|
|
2848
|
-
}
|
|
2849
|
-
} catch (error) {
|
|
2850
|
-
console.error('Error parsing component error JSON:', error);
|
|
2851
|
-
}
|
|
2852
|
-
})["catch"](function (error) {
|
|
2853
|
-
console.error('Error reading component error text data:', error);
|
|
2854
|
-
});
|
|
2855
|
-
}
|
|
2856
|
-
}
|
|
2857
|
-
},
|
|
2858
|
-
methods: {
|
|
2859
|
-
generateNewSessionId: function generateNewSessionId() {
|
|
2860
|
-
var _this2 = this;
|
|
2861
|
-
var newSessionPromise = this.createAISession();
|
|
2862
|
-
newSessionPromise.then(function (res) {
|
|
2863
|
-
_this2.AISessionId = res.AIsessionId;
|
|
2864
|
-
})["catch"](function (e) {
|
|
2865
|
-
console.error(e);
|
|
2866
|
-
});
|
|
2867
|
-
},
|
|
2868
|
-
scrollToBottom: function scrollToBottom() {
|
|
2869
|
-
var _this3 = this;
|
|
2870
|
-
this.$nextTick(function () {
|
|
2871
|
-
var _this3$$refs;
|
|
2872
|
-
var messageContainer = (_this3$$refs = _this3.$refs) == null ? void 0 : _this3$$refs[_this3.$props.innerRef];
|
|
2873
|
-
if (messageContainer && messageContainer.$el) {
|
|
2874
|
-
messageContainer.$el.scrollTo({
|
|
2875
|
-
top: messageContainer.$el.scrollHeight,
|
|
2876
|
-
behavior: 'smooth'
|
|
2877
|
-
});
|
|
2878
|
-
}
|
|
2879
|
-
});
|
|
2880
|
-
},
|
|
2881
|
-
handleMessageInputChange: function handleMessageInputChange(e) {
|
|
2882
|
-
this.inputMessage = e.target.value;
|
|
2883
|
-
this.handleTextAreaHeightChange();
|
|
2884
|
-
},
|
|
2885
|
-
handleSendMessage: function handleSendMessage(e, isRetry, text) {
|
|
2886
|
-
if (isRetry === void 0) {
|
|
2887
|
-
isRetry = false;
|
|
2888
|
-
}
|
|
2889
|
-
if (text === void 0) {
|
|
2890
|
-
text = this.inputMessage;
|
|
2891
|
-
}
|
|
2892
|
-
if (typeof e === 'object' && e !== null) e.preventDefault();
|
|
2893
|
-
if (text.trim()) {
|
|
2894
|
-
if (this.isLoadingState) {
|
|
2895
|
-
return;
|
|
2896
|
-
}
|
|
2897
|
-
if (this.AISessionId) {
|
|
2898
|
-
if (!isRetry) this.messages = [].concat(this.messages, [{
|
|
2899
|
-
content: text,
|
|
2900
|
-
role: AI_ROLES.USER
|
|
2901
|
-
}]);
|
|
2902
|
-
this.getAIResponse(this.AISessionId, this.componentId, text);
|
|
2903
|
-
} else {
|
|
2904
|
-
console.error(this.errorMessageForMissingSessionId);
|
|
2905
|
-
this.error = {
|
|
2906
|
-
message: "AISessionId for " + this.$props.componentId + " is missing! AIAnswer component requires an AISessionId to function. Trying reloading the App."
|
|
2907
|
-
};
|
|
2908
|
-
}
|
|
2909
|
-
this.inputMessage = '';
|
|
2910
|
-
}
|
|
2911
|
-
},
|
|
2912
|
-
handleRetryRequest: function handleRetryRequest() {
|
|
2913
|
-
if (this.messages && !this.isLoadingState) {
|
|
2914
|
-
var _this$messages;
|
|
2915
|
-
var lastUserRequestMessage = (_this$messages = this.messages[this.messages.length - 1]) == null ? void 0 : _this$messages.content;
|
|
2916
|
-
if (this.AISessionId) {
|
|
2917
|
-
this.getAIResponse(this.AISessionId, this.componentId, lastUserRequestMessage);
|
|
2918
|
-
this.inputMessage = '';
|
|
2919
|
-
} else {
|
|
2920
|
-
console.error("AISessionId for " + this.componentId + " is missing! AIAnswer component requires an AISessionId to function. Try reloading the App.");
|
|
2921
|
-
}
|
|
2922
|
-
}
|
|
2923
|
-
},
|
|
2924
|
-
renderErrorComponent: function renderErrorComponent() {
|
|
2925
|
-
var renderError = this.$slots.renderError || this.$props.renderError;
|
|
2926
|
-
if (this.error && !this.isLoadingState) {
|
|
2927
|
-
var _this$error, _this$error2;
|
|
2928
|
-
if (renderError) {
|
|
2929
|
-
return createVNode("div", {
|
|
2930
|
-
"ref": _errorContainerRef,
|
|
2931
|
-
"class": "--ai-answer-error-container " + (getClassName$2(this.$props.innerClass, 'ai-error') || '')
|
|
2932
|
-
}, [isFunction(renderError) ? renderError(this.error, this.handleRetryRequest) : renderError]);
|
|
2933
|
-
}
|
|
2934
|
-
return createVNode("div", {
|
|
2935
|
-
"ref": _errorContainerRef,
|
|
2936
|
-
"class": "--ai-answer-error-container " + (getClassName$2(this.$props.innerClass, 'ai-error') || '')
|
|
2937
|
-
}, [createVNode("div", {
|
|
2938
|
-
"class": "--default-error-element"
|
|
2939
|
-
}, [createVNode("span", null, [(_this$error = this.error) != null && _this$error.message ? this.error.message : 'There was an error in generating the response.', ' ', (_this$error2 = this.error) != null && _this$error2.code ? ", Code:\n\t\t\t\t\t\t\t" + this.error.code : '']), this.AISessionId && createVNode(Button, {
|
|
2940
|
-
"primary": true,
|
|
2941
|
-
"onClick": this.handleRetryRequest
|
|
2942
|
-
}, {
|
|
2943
|
-
"default": function _default() {
|
|
2944
|
-
return [createTextVNode("Try again")];
|
|
2945
|
-
}
|
|
2946
|
-
})])]);
|
|
2947
|
-
}
|
|
2948
|
-
return null;
|
|
2949
|
-
},
|
|
2950
|
-
handleKeyPress: function handleKeyPress(e) {
|
|
2951
|
-
window.console.log('e', e);
|
|
2952
|
-
if (e.key === 'Enter') {
|
|
2953
|
-
this.handleSendMessage(e);
|
|
2954
|
-
this.inputMessage = '';
|
|
2955
|
-
}
|
|
2956
|
-
},
|
|
2957
|
-
renderIcon: function renderIcon() {
|
|
2958
|
-
if (this.$props.showIcon) {
|
|
2959
|
-
if (this.$props.icon) {
|
|
2960
|
-
return this.$props.icon;
|
|
2961
|
-
}
|
|
2962
|
-
if (this.$slots.icon) {
|
|
2963
|
-
return this.$slots.icon();
|
|
2964
|
-
}
|
|
2965
|
-
if (this.$props.iconURL) {
|
|
2966
|
-
return createVNode("img", {
|
|
2967
|
-
"style": {
|
|
2968
|
-
maxHeight: '25px'
|
|
2969
|
-
},
|
|
2970
|
-
"src": this.$props.iconURL,
|
|
2971
|
-
"alt": "search-icon"
|
|
2972
|
-
}, null);
|
|
2973
|
-
}
|
|
2974
|
-
return createVNode(SearchSvg, null, null);
|
|
2975
|
-
}
|
|
2976
|
-
return null;
|
|
2977
|
-
},
|
|
2978
|
-
shouldMicRender: function shouldMicRender(showVoiceSearch) {
|
|
2979
|
-
// checks for SSR
|
|
2980
|
-
if (typeof window === 'undefined') return false;
|
|
2981
|
-
return showVoiceSearch && (window.webkitSpeechRecognition || window.SpeechRecognition);
|
|
2982
|
-
},
|
|
2983
|
-
handleVoiceResults: function handleVoiceResults(_ref) {
|
|
2984
|
-
var results = _ref.results;
|
|
2985
|
-
if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
|
|
2986
|
-
this.handleSendMessage(null, false, results[0][0].transcript.trim());
|
|
2987
|
-
}
|
|
2988
|
-
},
|
|
2989
|
-
renderIcons: function renderIcons() {
|
|
2990
|
-
var _this4 = this;
|
|
2991
|
-
var _slot, _slot2;
|
|
2992
|
-
var _this$$props = this.$props,
|
|
2993
|
-
getMicInstance = _this$$props.getMicInstance,
|
|
2994
|
-
showVoiceInput = _this$$props.showVoiceInput,
|
|
2995
|
-
iconPosition = _this$$props.iconPosition,
|
|
2996
|
-
innerClass = _this$$props.innerClass;
|
|
2997
|
-
var renderMic = this.$slots.renderMic || this.$props.renderMic;
|
|
2998
|
-
return createVNode("div", null, [createVNode(IconGroup, {
|
|
2999
|
-
"enableAI": true,
|
|
3000
|
-
"groupPosition": "right",
|
|
3001
|
-
"positionType": "absolute"
|
|
3002
|
-
}, {
|
|
3003
|
-
"default": function _default() {
|
|
3004
|
-
return [!_this4.isLoadingState && _this4.AISessionId && _this4.shouldMicRender(showVoiceInput) && createVNode(Mic, {
|
|
3005
|
-
"getInstance": getMicInstance,
|
|
3006
|
-
"render": renderMic,
|
|
3007
|
-
"handleResult": _this4.handleVoiceResults,
|
|
3008
|
-
"class": getClassName$2(innerClass, 'ai-search-mic') || null
|
|
3009
|
-
}, null), iconPosition === 'right' && createVNode(IconWrapper, null, _isSlot$1(_slot = _this4.renderIcon()) ? _slot : {
|
|
3010
|
-
"default": function _default() {
|
|
3011
|
-
return [_slot];
|
|
3012
|
-
}
|
|
3013
|
-
})];
|
|
3014
|
-
}
|
|
3015
|
-
}), createVNode(IconGroup, {
|
|
3016
|
-
"enableAI": true,
|
|
3017
|
-
"groupPosition": "left",
|
|
3018
|
-
"positionType": "absolute"
|
|
3019
|
-
}, {
|
|
3020
|
-
"default": function _default() {
|
|
3021
|
-
return [iconPosition === 'left' && createVNode(IconWrapper, null, _isSlot$1(_slot2 = _this4.renderIcon()) ? _slot2 : {
|
|
3022
|
-
"default": function _default() {
|
|
3023
|
-
return [_slot2];
|
|
3024
|
-
}
|
|
3025
|
-
})];
|
|
3026
|
-
}
|
|
3027
|
-
})]);
|
|
3028
|
-
},
|
|
3029
|
-
enterButtonOnClick: function enterButtonOnClick(e) {
|
|
3030
|
-
this.handleSendMessage(e);
|
|
3031
|
-
},
|
|
3032
|
-
renderEnterButtonElement: function renderEnterButtonElement() {
|
|
3033
|
-
var _this5 = this;
|
|
3034
|
-
var _this$$props2 = this.$props,
|
|
3035
|
-
enterButton = _this$$props2.enterButton,
|
|
3036
|
-
innerClass = _this$$props2.innerClass;
|
|
3037
|
-
var renderEnterButton = this.$slots.renderEnterButton;
|
|
3038
|
-
if (enterButton) {
|
|
3039
|
-
var getEnterButtonMarkup = function getEnterButtonMarkup() {
|
|
3040
|
-
if (renderEnterButton) {
|
|
3041
|
-
return renderEnterButton(_this5.enterButtonOnClick);
|
|
3042
|
-
}
|
|
3043
|
-
return createVNode(SendButton, {
|
|
3044
|
-
"primary": true,
|
|
3045
|
-
"type": "submit",
|
|
3046
|
-
"tabIndex": 0,
|
|
3047
|
-
"onClick": _this5.handleSendMessage,
|
|
3048
|
-
"onKeyPress": _this5.handleKeyPress,
|
|
3049
|
-
"class": "ask-btn " + getClassName$2(innerClass, 'ai-enter-button'),
|
|
3050
|
-
"disabled": _this5.isLoadingState || !_this5.AISessionId
|
|
3051
|
-
}, {
|
|
3052
|
-
"default": function _default() {
|
|
3053
|
-
return [createTextVNode("Send")];
|
|
3054
|
-
}
|
|
3055
|
-
});
|
|
3056
|
-
};
|
|
3057
|
-
return createVNode("div", {
|
|
3058
|
-
"class": "ai-enter-button-wrapper"
|
|
3059
|
-
}, [getEnterButtonMarkup()]);
|
|
3060
|
-
}
|
|
3061
|
-
return null;
|
|
3062
|
-
},
|
|
3063
|
-
getComponent: function getComponent$1() {
|
|
3064
|
-
var data = {
|
|
3065
|
-
error: this.AIResponseError,
|
|
3066
|
-
loading: this.isAIResponseLoading,
|
|
3067
|
-
data: this.messages,
|
|
3068
|
-
rawData: this.rawData
|
|
3069
|
-
};
|
|
3070
|
-
return getComponent(data, this);
|
|
3071
|
-
},
|
|
3072
|
-
handleTextAreaHeightChange: function handleTextAreaHeightChange() {
|
|
3073
|
-
var _this$$refs, _this$$refs$_inputRef, _this$$refs2, _this$$refs2$_inputWr, _this$$refs3;
|
|
3074
|
-
var textArea = (_this$$refs = this.$refs) == null ? void 0 : (_this$$refs$_inputRef = _this$$refs[_inputRef]) == null ? void 0 : _this$$refs$_inputRef.$el;
|
|
3075
|
-
var inputWrapper = (_this$$refs2 = this.$refs) == null ? void 0 : (_this$$refs2$_inputWr = _this$$refs2[_inputWrapperRef]) == null ? void 0 : _this$$refs2$_inputWr.$el;
|
|
3076
|
-
var errorContainer = (_this$$refs3 = this.$refs) == null ? void 0 : _this$$refs3[_errorContainerRef];
|
|
3077
|
-
if (textArea) {
|
|
3078
|
-
textArea.style.height = '42px';
|
|
3079
|
-
var lineHeight = parseInt(getComputedStyle(textArea).lineHeight, 10);
|
|
3080
|
-
var maxHeight = lineHeight * 11; // max height for 10 lines
|
|
3081
|
-
var height = Math.min(textArea.scrollHeight, maxHeight);
|
|
3082
|
-
textArea.style.height = height + "px";
|
|
3083
|
-
textArea.style.overflowY = height === maxHeight ? 'auto' : 'hidden';
|
|
3084
|
-
// wrapper around input/ textarea
|
|
3085
|
-
inputWrapper.style.height = height + "px";
|
|
3086
|
-
// adjust error-container
|
|
3087
|
-
|
|
3088
|
-
if (errorContainer) {
|
|
3089
|
-
errorContainer.style.bottom = height + "px";
|
|
3090
|
-
}
|
|
3091
|
-
this.$forceUpdate();
|
|
3092
|
-
}
|
|
3093
|
-
}
|
|
3094
|
-
},
|
|
3095
|
-
beforeUnmount: function beforeUnmount() {
|
|
3096
|
-
if (this.$props.clearSessionOnDestroy) {
|
|
3097
|
-
// cleanup logic
|
|
3098
|
-
// final Object to store in local storage cache
|
|
3099
|
-
var finalCacheObj = getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {};
|
|
3100
|
-
// delete current component's cache
|
|
3101
|
-
delete finalCacheObj[this.$props.componentId];
|
|
3102
|
-
// update local cache
|
|
3103
|
-
setObjectInLocalStorage(AI_LOCAL_CACHE_KEY, finalCacheObj);
|
|
3104
|
-
}
|
|
3105
|
-
},
|
|
3106
|
-
render: function render() {
|
|
3107
|
-
var _slot3;
|
|
3108
|
-
var _this6 = this;
|
|
3109
|
-
var props = this.$props;
|
|
3110
|
-
if (!this.shouldShowComponent) {
|
|
3111
|
-
return null;
|
|
3112
|
-
}
|
|
3113
|
-
return createVNode(Chatbox, {
|
|
3114
|
-
"style": props.style || {}
|
|
3115
|
-
}, {
|
|
3116
|
-
"default": function _default() {
|
|
3117
|
-
return [_this6.$props.title && createVNode(Title, {
|
|
3118
|
-
"class": getClassName$2(_this6.$props.innerClass, 'title') || ''
|
|
3119
|
-
}, {
|
|
3120
|
-
"default": function _default() {
|
|
3121
|
-
return [_this6.$props.title];
|
|
3122
|
-
}
|
|
3123
|
-
}), createVNode(ChatContainer, {
|
|
3124
|
-
"class": "--ai-chat-container",
|
|
3125
|
-
"theme": props.theme,
|
|
3126
|
-
"showInput": props.showInput
|
|
3127
|
-
}, {
|
|
3128
|
-
"default": function _default() {
|
|
3129
|
-
return [_this6.hasCustomRenderer && createVNode(MessagesContainer, {
|
|
3130
|
-
"themePreset": _this6.themePreset,
|
|
3131
|
-
"theme": props.theme,
|
|
3132
|
-
"ref": _this6.$props.innerRef,
|
|
3133
|
-
"class": "--ai-message-container " + (getClassName$2(props.innerClass, 'ai-message-container') || '')
|
|
3134
|
-
}, _isSlot$1(_slot3 = _this6.getComponent()) ? _slot3 : {
|
|
3135
|
-
"default": function _default() {
|
|
3136
|
-
return [_slot3];
|
|
3137
|
-
}
|
|
3138
|
-
}), !_this6.hasCustomRenderer && createVNode(MessagesContainer, {
|
|
3139
|
-
"themePreset": _this6.themePreset,
|
|
3140
|
-
"theme": props.theme,
|
|
3141
|
-
"ref": _this6.$props.innerRef,
|
|
3142
|
-
"class": "--ai-message-container " + (getClassName$2(props.innerClass, 'ai-message-container') || '')
|
|
3143
|
-
}, {
|
|
3144
|
-
"default": function _default() {
|
|
3145
|
-
return [_this6.messages.map(function (message, index) {
|
|
3146
|
-
return createVNode(Message, {
|
|
3147
|
-
"key": index,
|
|
3148
|
-
"isSender": message.role === AI_ROLES.USER,
|
|
3149
|
-
"innerHTML": md$1.render(message.content),
|
|
3150
|
-
"themePreset": _this6.themePreset,
|
|
3151
|
-
"theme": props.theme,
|
|
3152
|
-
"class": "--ai-answer-message " + (getClassName$2(props.innerClass, 'ai-message') || '')
|
|
3153
|
-
}, null);
|
|
3154
|
-
}), _this6.isLoadingState && createVNode(Message, {
|
|
3155
|
-
"themePreset": _this6.themePreset,
|
|
3156
|
-
"theme": props.theme,
|
|
3157
|
-
"isSender": false,
|
|
3158
|
-
"class": "--ai-answer-message " + (getClassName$2(props.innerClass, 'ai-message') || null)
|
|
3159
|
-
}, {
|
|
3160
|
-
"default": function _default() {
|
|
3161
|
-
return [createVNode(TypingIndicator, null, {
|
|
3162
|
-
"default": function _default() {
|
|
3163
|
-
return [createVNode(TypingDot, {
|
|
3164
|
-
"themePreset": _this6.themePreset
|
|
3165
|
-
}, null), createVNode(TypingDot, {
|
|
3166
|
-
"themePreset": _this6.themePreset
|
|
3167
|
-
}, null), createVNode(TypingDot, {
|
|
3168
|
-
"themePreset": _this6.themePreset
|
|
3169
|
-
}, null)];
|
|
3170
|
-
}
|
|
3171
|
-
})];
|
|
3172
|
-
}
|
|
3173
|
-
})];
|
|
3174
|
-
}
|
|
3175
|
-
}), _this6.renderErrorComponent(), ' ', props.showFeedback && createVNode("div", {
|
|
3176
|
-
"class": "--ai-answer-feedback-container " + (getClassName$2(props.innerClass, 'ai-feedback') || '')
|
|
3177
|
-
}, [createVNode(AIFeedback, {
|
|
3178
|
-
"hideUI": _this6.isLoadingState || !_this6.sessionId,
|
|
3179
|
-
"key": _this6.sessionId,
|
|
3180
|
-
"onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
|
|
3181
|
-
_this6.trackUsefullness(_this6.sessionId, {
|
|
3182
|
-
useful: useful,
|
|
3183
|
-
reason: reason
|
|
3184
|
-
});
|
|
3185
|
-
}
|
|
3186
|
-
}, null)]), props.showInput && createVNode(MessageInputContainer, {
|
|
3187
|
-
"class": "--ai-input-container",
|
|
3188
|
-
"onSubmit": _this6.handleSendMessage
|
|
3189
|
-
}, {
|
|
3190
|
-
"default": function _default() {
|
|
3191
|
-
return [createVNode(InputGroup, {
|
|
3192
|
-
"enableAI": true,
|
|
3193
|
-
"isOpen": false
|
|
3194
|
-
}, {
|
|
3195
|
-
"default": function _default() {
|
|
3196
|
-
return [createVNode(InputWrapper, {
|
|
3197
|
-
"ref": _inputWrapperRef
|
|
3198
|
-
}, {
|
|
3199
|
-
"default": function _default() {
|
|
3200
|
-
return [createVNode(MessageInput, {
|
|
3201
|
-
"ref": _inputRef,
|
|
3202
|
-
"placeholder": props.placeholder,
|
|
3203
|
-
"enterButton": props.enterButton,
|
|
3204
|
-
"value": _this6.inputMessage,
|
|
3205
|
-
"onInput": _this6.handleMessageInputChange,
|
|
3206
|
-
"id": props.componentId + "-ai-input",
|
|
3207
|
-
"showIcon": props.showIcon,
|
|
3208
|
-
"iconPosition": props.iconPosition,
|
|
3209
|
-
"themePreset": _this6.themePreset,
|
|
3210
|
-
"disabled": _this6.isLoadingState || !_this6.AISessionId,
|
|
3211
|
-
"class": getClassName$2(props.innerClass, 'ai-input') || null
|
|
3212
|
-
}, null), ' ', _this6.renderIcons()];
|
|
3213
|
-
}
|
|
3214
|
-
})];
|
|
3215
|
-
}
|
|
3216
|
-
}), _this6.renderEnterButtonElement()];
|
|
3217
|
-
}
|
|
3218
|
-
}), ' '];
|
|
3219
|
-
}
|
|
3220
|
-
})];
|
|
3221
|
-
}
|
|
3222
|
-
});
|
|
3223
|
-
}
|
|
3224
|
-
});
|
|
3225
|
-
AIAnswer.hasInternalComponent = function () {
|
|
3226
|
-
return true;
|
|
3227
|
-
};
|
|
3228
|
-
var mapStateToProps$1 = function mapStateToProps(state, props) {
|
|
3229
|
-
var dependencyComponent = Object.values(props.react)[0];
|
|
3230
|
-
if (Array.isArray(dependencyComponent)) {
|
|
3231
|
-
// eslint-disable-next-line prefer-destructuring
|
|
3232
|
-
dependencyComponent = dependencyComponent[0];
|
|
3233
|
-
}
|
|
3234
|
-
var showComponent = state.selectedValues[dependencyComponent] && state.selectedValues[dependencyComponent].value;
|
|
3235
|
-
return {
|
|
3236
|
-
showComponent: showComponent,
|
|
3237
|
-
AIResponse: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response,
|
|
3238
|
-
isAIResponseLoading: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].isLoading,
|
|
3239
|
-
AIResponseError: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].error,
|
|
3240
|
-
rawData: state.rawData[props.componentId],
|
|
3241
|
-
themePreset: state.config.themePreset,
|
|
3242
|
-
isLoading: state.isLoading[props.componentId] || false,
|
|
3243
|
-
sessionIdFromStore: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.sessionId || '',
|
|
3244
|
-
componentError: state.error[props.componentId]
|
|
3245
|
-
};
|
|
3246
|
-
};
|
|
3247
|
-
var mapDispatchToProps$1 = {
|
|
3248
|
-
getAIResponse: fetchAIResponse,
|
|
3249
|
-
trackUsefullness: recordAISessionUsefulness,
|
|
3250
|
-
createAISession: createAISession
|
|
3251
|
-
};
|
|
3252
|
-
var AIConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps$1, mapDispatchToProps$1)(AIAnswer), {
|
|
3253
|
-
componentType: componentTypes.AIAnswer,
|
|
3254
|
-
internalComponent: true
|
|
3255
|
-
}));
|
|
3256
|
-
AIConnected.name = AIAnswer.name;
|
|
3257
|
-
AIConnected.hasInternalComponent = AIAnswer.hasInternalComponent;
|
|
3258
|
-
AIConnected.install = function (Vue) {
|
|
3259
|
-
Vue.component(AIConnected.name, AIConnected);
|
|
3260
|
-
};
|
|
3261
|
-
// Add componentType for SSR
|
|
3262
|
-
AIConnected.componentType = componentTypes.AIAnswer;
|
|
3263
|
-
|
|
3264
|
-
var _templateObject$9, _templateObject2$4;
|
|
3265
|
-
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"])));
|
|
3266
|
-
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) {
|
|
1887
|
+
var _templateObject$5, _templateObject2$1;
|
|
1888
|
+
var HierarchicalMenuList = styled('ul')(_templateObject$5 || (_templateObject$5 = _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"])));
|
|
1889
|
+
var HierarchicalMenuListItem = styled('li')(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteralLoose(["\n\tfont-weight: 400;\n\tline-height: 1.5;\n\tbox-sizing: border-box;\n\n\ta {\n\t\tcolor: #424242;\n\t\ttext-decoration: none;\n\t\tgap: 5px;\n\t\t.--leaf-icon,\n\t\t.--folder-icon {\n\t\t\tline-height: 15px;\n\t\t\tsvg {\n\t\t\t\theight: 15px;\n\t\t\t}\n\t\t}\n\n\t\tinput {\n\t\t\tmargin: 0;\n\t\t\tcursor: pointer;\n\t\t}\n\t}\n\n\t.--switcher-icon {\n\t\ttransition: all 0.2s ease-in;\n\t\tmargin-right: 2px;\n\t}\n\t.--list-child {\n\t\tpadding-left: 1rem;\n\t\tposition: relative;\n\t\t&:before {\n\t\t\theight: 100%;\n\t\t\tcontent: '';\n\t\t\tposition: absolute;\n\t\t\tborder-left: 1px solid #787878;\n\t\t\twidth: 0;\n\t\t\tleft: 19px;\n\t\t\t", ";\n\t\t}\n\n\t\t&.--show-switcher-icon {\n\t\t\tpadding-left: 36px;\n\t\t}\n\t}\n\t.--list-item-label {\n\t\tline-height: 100%;\n\t}\n\t.--list-item-count {\n\t\tmargin-left: 10px;\n\t\tpadding: 0.1rem 0.4rem;\n\t\tfont-size: 0.8rem;\n\t\tcolor: #424242;\n\t\tbackground-color: #dee1e6;\n\t\tborder-radius: 8px;\n\t}\n\t&.-selected-item {\n\t\tfont-weight: 700 !important;\n\t}\n\t&.-expanded-item {\n\t\t& > a {\n\t\t\t& div > .--switcher-icon {\n\t\t\t\ttransform: rotate(90deg);\n\t\t\t}\n\t\t}\n\t}\n\t.--list-item-label-count-wrapper {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\t&:hover {\n\t\t\t.--list-item-count,\n\t\t\t.--list-item-label {\n\t\t\t\tfont-weight: 700;\n\t\t\t}\n\t\t}\n\t}\n"])), function (props) {
|
|
3267
1890
|
return !props.showLine && "\n\t\t\t\t\tdisplay: none;\n\t\t\t\t";
|
|
3268
1891
|
});
|
|
3269
1892
|
|
|
@@ -3476,7 +2099,7 @@ var HierarchicalMenuListItemComponent = {
|
|
|
3476
2099
|
}
|
|
3477
2100
|
};
|
|
3478
2101
|
|
|
3479
|
-
function _isSlot$
|
|
2102
|
+
function _isSlot$1(s) {
|
|
3480
2103
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
3481
2104
|
}
|
|
3482
2105
|
var HierarchicalMenuComponent = {
|
|
@@ -3501,7 +2124,7 @@ var HierarchicalMenuComponent = {
|
|
|
3501
2124
|
return createVNode(HierarchicalMenuList, {
|
|
3502
2125
|
"class": "" + (isExpanded ? '--open' : ''),
|
|
3503
2126
|
"isSelected": isExpanded
|
|
3504
|
-
}, _isSlot$
|
|
2127
|
+
}, _isSlot$1(_slot = listArray.map(function (listItem) {
|
|
3505
2128
|
return createVNode(HierarchicalMenuListItemComponent, mergeProps({
|
|
3506
2129
|
"key": parentPath + "__" + JSON.stringify(listItem),
|
|
3507
2130
|
"parentPath": parentPath,
|
|
@@ -3515,7 +2138,7 @@ var HierarchicalMenuComponent = {
|
|
|
3515
2138
|
}
|
|
3516
2139
|
};
|
|
3517
2140
|
|
|
3518
|
-
function _isSlot$
|
|
2141
|
+
function _isSlot$2(s) {
|
|
3519
2142
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
3520
2143
|
}
|
|
3521
2144
|
var updateQueryAction = Actions.updateQuery,
|
|
@@ -3965,7 +2588,7 @@ var TreeList = {
|
|
|
3965
2588
|
"default": function _default() {
|
|
3966
2589
|
return [props.title && createVNode(Title, {
|
|
3967
2590
|
"class": getClassName$2(innerClass, 'title') || null
|
|
3968
|
-
}, _isSlot$
|
|
2591
|
+
}, _isSlot$2(title) ? title : {
|
|
3969
2592
|
"default": function _default() {
|
|
3970
2593
|
return [title];
|
|
3971
2594
|
}
|
|
@@ -3994,7 +2617,7 @@ var TreeList = {
|
|
|
3994
2617
|
});
|
|
3995
2618
|
}
|
|
3996
2619
|
};
|
|
3997
|
-
var mapStateToProps$
|
|
2620
|
+
var mapStateToProps$1 = function mapStateToProps(state, props) {
|
|
3998
2621
|
return {
|
|
3999
2622
|
selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
|
|
4000
2623
|
rawData: state.rawData[props.componentId] || {},
|
|
@@ -4012,7 +2635,7 @@ var mapDispatchtoProps = {
|
|
|
4012
2635
|
TreeList.hasInternalComponent = function () {
|
|
4013
2636
|
return true;
|
|
4014
2637
|
};
|
|
4015
|
-
var TreeListConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps$
|
|
2638
|
+
var TreeListConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps$1, mapDispatchtoProps)(TreeList), {
|
|
4016
2639
|
componentType: componentTypes.treeList,
|
|
4017
2640
|
internalComponent: TreeList.hasInternalComponent()
|
|
4018
2641
|
}));
|
|
@@ -4080,7 +2703,7 @@ RcConnected.install = function (Vue) {
|
|
|
4080
2703
|
Vue.component(RcConnected.name, RcConnected);
|
|
4081
2704
|
};
|
|
4082
2705
|
|
|
4083
|
-
var components = [ReactiveList, ResultCard, ResultList, ReactiveBase, SBConnected, SingleList, MultiList, SingleRange, MultiRange, RangeSlider, DynamicRangeSlider, ReactiveComponent, RcConnected, SelectedFilters, ToggleButton, SingleDropdownList, MultiDropdownList, StateProvider, RangeInput, TreeListConnected
|
|
2706
|
+
var components = [ReactiveList, ResultCard, ResultList, ReactiveBase, SBConnected, SingleList, MultiList, SingleRange, MultiRange, RangeSlider, DynamicRangeSlider, ReactiveComponent, RcConnected, SelectedFilters, ToggleButton, SingleDropdownList, MultiDropdownList, StateProvider, RangeInput, TreeListConnected];
|
|
4084
2707
|
function install (Vue) {
|
|
4085
2708
|
components.map(function (component) {
|
|
4086
2709
|
Vue.use(component);
|
|
@@ -4088,4 +2711,4 @@ function install (Vue) {
|
|
|
4088
2711
|
});
|
|
4089
2712
|
}
|
|
4090
2713
|
|
|
4091
|
-
export {
|
|
2714
|
+
export { RcConnected as R, SBConnected as S, TreeListConnected as T, install as i };
|