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