@appbaseio/reactivesearch-vue 3.0.0-rc.8 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@appbaseio/reactivesearch-vue.umd.js +8635 -6246
- 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/{ComponentWrapper-0b9ffb1a.js → ComponentWrapper-0334c14b.js} +1 -1
- package/dist/cjs/{DropDown-82d92f8b.js → DropDown-26666911.js} +3 -3
- package/dist/cjs/DynamicRangeSlider.js +7 -4
- package/dist/cjs/{Input-fcd780de.js → Input-3ecdb905.js} +7 -66
- package/dist/cjs/MultiDropdownList.js +7 -6
- package/dist/cjs/MultiList.js +6 -5
- package/dist/cjs/MultiRange.js +5 -4
- package/dist/cjs/{Pagination-bcf8af5f.js → Pagination-c53a18ab.js} +1 -1
- package/dist/cjs/{PreferencesConsumer-85dee673.js → PreferencesConsumer-7bee3c57.js} +1 -1
- package/dist/cjs/RangeInput.js +8 -5
- package/dist/cjs/RangeSlider.js +8 -5
- package/dist/cjs/ReactiveBase.js +20 -18
- package/dist/cjs/ReactiveComponent.js +5 -4
- package/dist/cjs/ReactiveGoogleMap.js +8 -5
- package/dist/cjs/ReactiveList.js +6 -5
- package/dist/cjs/ResultCard.js +1 -1
- package/dist/cjs/ResultList.js +1 -1
- package/dist/cjs/SelectedFilters.js +2 -2
- package/dist/cjs/SingleDropdownList.js +7 -6
- package/dist/cjs/SingleList.js +6 -5
- package/dist/cjs/SingleRange.js +5 -4
- package/dist/cjs/StateProvider.js +1 -1
- package/dist/cjs/ToggleButton.js +5 -4
- package/dist/cjs/{index-779ed366.js → index-1f41363f.js} +7 -3
- package/dist/cjs/index.js +11 -9
- package/dist/cjs/{install-2a1c953d.js → install-08b8d6e7.js} +483 -152
- package/dist/cjs/install.js +11 -9
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/{vueTypes-a5f1745e.js → vueTypes-289a891a.js} +2 -1
- package/dist/components/ReactiveBase/ReactiveBase.d.ts +33 -0
- package/dist/components/basic/ReactiveComponent.d.ts +30 -0
- package/dist/components/basic/ReactiveComponentPrivate.d.ts +10 -0
- package/dist/components/basic/SelectedFilters.d.ts +24 -0
- package/dist/components/basic/StateProvider.d.ts +12 -0
- package/dist/components/list/MultiDropdownList.d.ts +49 -0
- package/dist/components/list/MultiList.d.ts +47 -0
- package/dist/components/list/SingleDropdownList.d.ts +47 -0
- package/dist/components/list/SingleList.d.ts +47 -0
- package/dist/components/list/ToggleButton.d.ts +33 -0
- package/dist/components/list/TreeList.d.ts +48 -0
- package/dist/components/range/DynamicRangeSlider.d.ts +38 -0
- package/dist/components/range/MultiRange.d.ts +30 -0
- package/dist/components/range/RangeInput.d.ts +30 -0
- package/dist/components/range/RangeSlider.d.ts +40 -0
- package/dist/components/range/SingleRange.d.ts +28 -0
- package/dist/components/result/ReactiveList.d.ts +55 -0
- package/dist/components/result/ResultCard.d.ts +10 -0
- package/dist/components/result/ResultList.d.ts +11 -0
- package/dist/components/search/AIAnswer.d.ts +44 -0
- package/dist/components/search/SearchBox.d.ts +107 -0
- package/dist/es/{ComponentWrapper-a2635cfc.js → ComponentWrapper-46d04344.js} +1 -1
- package/dist/es/{DropDown-8075451b.js → DropDown-48045fde.js} +3 -3
- package/dist/es/DynamicRangeSlider.js +8 -5
- package/dist/es/{Input-4cd74b38.js → Input-83dee8c5.js} +7 -66
- package/dist/es/MultiDropdownList.js +7 -6
- package/dist/es/MultiList.js +6 -5
- package/dist/es/MultiRange.js +5 -4
- package/dist/es/{Pagination-50fc3ef5.js → Pagination-591fdb79.js} +1 -1
- package/dist/es/{PreferencesConsumer-b058d14e.js → PreferencesConsumer-0856ed43.js} +1 -1
- package/dist/es/RangeInput.js +8 -5
- package/dist/es/RangeSlider.js +9 -6
- package/dist/es/ReactiveBase.js +20 -18
- package/dist/es/ReactiveComponent.js +5 -4
- package/dist/es/ReactiveGoogleMap.js +8 -5
- package/dist/es/ReactiveList.js +6 -5
- package/dist/es/ResultCard.js +1 -1
- package/dist/es/ResultList.js +1 -1
- package/dist/es/SelectedFilters.js +2 -2
- package/dist/es/SingleDropdownList.js +7 -6
- package/dist/es/SingleList.js +6 -5
- package/dist/es/SingleRange.js +5 -4
- package/dist/es/StateProvider.js +1 -1
- package/dist/es/ToggleButton.js +5 -4
- package/dist/es/{index-882489e1.js → index-104f1dfb.js} +7 -3
- package/dist/es/index.js +12 -10
- package/dist/es/{install-f4f2557b.js → install-e883f435.js} +484 -153
- package/dist/es/install.js +11 -9
- package/dist/es/version.js +1 -1
- package/dist/es/{vueTypes-09cab4d3.js → vueTypes-f503e267.js} +2 -1
- package/dist/index.d.ts +40 -0
- package/dist/types.ts +226 -0
- package/package.json +5 -3
|
@@ -13,22 +13,22 @@ var vueEmotion = require('@appbaseio/vue-emotion');
|
|
|
13
13
|
var css = require('@emotion/css');
|
|
14
14
|
var polished = require('polished');
|
|
15
15
|
var Button = require('./Button-f96a0570.js');
|
|
16
|
-
var vueTypes = require('./vueTypes-
|
|
16
|
+
var vueTypes = require('./vueTypes-289a891a.js');
|
|
17
17
|
var ReactiveList = require('./ReactiveList.js');
|
|
18
18
|
var transform = require('@appbaseio/reactivecore/lib/utils/transform');
|
|
19
|
-
var index = require('./index-
|
|
20
|
-
var ComponentWrapper = require('./ComponentWrapper-
|
|
21
|
-
var PreferencesConsumer = require('./PreferencesConsumer-
|
|
19
|
+
var index = require('./index-1f41363f.js');
|
|
20
|
+
var ComponentWrapper = require('./ComponentWrapper-0334c14b.js');
|
|
21
|
+
var PreferencesConsumer = require('./PreferencesConsumer-7bee3c57.js');
|
|
22
22
|
var Title = require('./Title-8802a218.js');
|
|
23
23
|
var ListItem = require('./ListItem-7a682970.js');
|
|
24
24
|
var Flex = require('./Flex-ddde6d26.js');
|
|
25
25
|
var analytics = require('@appbaseio/reactivecore/lib/actions/analytics');
|
|
26
26
|
var ReactiveBase = require('./ReactiveBase.js');
|
|
27
27
|
var hotkeys = _interopDefault(require('hotkeys-js'));
|
|
28
|
-
var remarkable = require('remarkable');
|
|
29
28
|
var xss = _interopDefault(require('xss'));
|
|
30
|
-
var
|
|
31
|
-
var
|
|
29
|
+
var remarkable = require('remarkable');
|
|
30
|
+
var DropDown = require('./DropDown-26666911.js');
|
|
31
|
+
var Input = require('./Input-3ecdb905.js');
|
|
32
32
|
var Container = require('./Container-29f049b2.js');
|
|
33
33
|
var Highlight = _interopDefault(require('vue-highlight-words'));
|
|
34
34
|
var query = require('@appbaseio/reactivecore/lib/actions/query');
|
|
@@ -58,7 +58,7 @@ var InputGroup = vueEmotion.styled('div')(_templateObject || (_templateObject =
|
|
|
58
58
|
searchBox = _ref.searchBox;
|
|
59
59
|
return searchBox && "background-color: " + (theme.colors.backgroundColor || '#fafafa') + ";\n\t\tcolor: " + (theme.colors.textColor || '#fff') + ";\n\n\t\t&:focus-within {\n\t\t\tbackground-color: " + (theme.colors.backgroundColor || '#fff') + ";\n\t\t}";
|
|
60
60
|
}, function (props) {
|
|
61
|
-
return props.isOpen &&
|
|
61
|
+
return props.isOpen && "box-shadow: rgb(0 0 0 / 20%) 0px 0px 15px;\n\t\tborder-bottom-left-radius: 0;\n\t\t\tborder-bottom-right-radius: 0;";
|
|
62
62
|
});
|
|
63
63
|
InputGroup.defaultProps = {
|
|
64
64
|
className: 'input-group'
|
|
@@ -808,7 +808,7 @@ var HorizontalSkeletonLoader = vue.defineComponent({
|
|
|
808
808
|
});
|
|
809
809
|
|
|
810
810
|
var _templateObject$7, _templateObject2$2, _templateObject3$1, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
|
811
|
-
var Chatbox = vueEmotion.styled('div')(_templateObject$7 || (_templateObject$7 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tmargin: 0 auto;\n\tpadding: 10px;\n\tbackground-color: #fafafa;\n\twidth: 100%;\n\tbox-shadow: rgb(0 0 0 / 20%) 0px 0px 6px;\n\tborder-radius: 6px;\n\tmargin-bottom: 20px;\n\tbackground-color: ", ";\n"])), function (props) {
|
|
811
|
+
var Chatbox = vueEmotion.styled('div')(_templateObject$7 || (_templateObject$7 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tmargin: 0 auto;\n\tpadding: 10px;\n\tbackground-color: #fafafa;\n\twidth: 100%;\n\tbox-shadow: rgb(0 0 0 / 20%) 0px 0px 6px;\n\tborder-radius: 6px;\n\tmargin-bottom: 20px;\n\tbackground-color: ", ";\n\n\t.--trigger-message-wrapper {\n\t\tcursor: pointer;\n\t}\n"])), function (props) {
|
|
812
812
|
return props.theme && props.theme.colors ? props.theme.colors.backgroundColor : '#fff';
|
|
813
813
|
});
|
|
814
814
|
var ChatContainer = vueEmotion.styled('div')(_templateObject2$2 || (_templateObject2$2 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\theight: 100%;\n\tposition: relative;\n\t.--ai-answer-error-container {\n\t\ttext-align: center;\n\t\tposition: absolute;\n\t\tbottom: 0px;\n\t\t", ";\n\t\tz-index: 1;\n\t\tleft: 50%;\n\t\ttransform: translateX(-50%);\n\t\twidth: 100%;\n\n\t\t.--default-error-element {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\talign-items: center;\n\t\t\tpadding: 10px;\n\t\t\tbackground-color: ", ";\n\t\t\tbox-shadow: 0 -5px 5px -2px\n\t\t\t\t", ";\n\n\t\t\tspan {\n\t\t\t\tmargin-bottom: 5px;\n\t\t\t}\n\n\t\t\tbutton {\n\t\t\t}\n\t\t}\n\t}\n\n\t", ";\n"])), function (props) {
|
|
@@ -833,11 +833,15 @@ var TypingDot = vueEmotion.styled('div')(_templateObject6 || (_templateObject6 =
|
|
|
833
833
|
return finalColor;
|
|
834
834
|
}, typingDots);
|
|
835
835
|
var resetCSS = function resetCSS(props) {
|
|
836
|
-
return "\n\thtml,\n\tbody,\n\tdiv,\n\tspan,\n\tapplet,\n\tobject,\n\tiframe,\n\th1,\n\th2,\n\th3,\n\th4,\n\th5,\n\th6,\n\tp,\n\tblockquote,\n\tpre,\n\ta,\n\tabbr,\n\tacronym,\n\taddress,\n\tbig,\n\tcite,\n\tcode,\n\tdel,\n\tdfn,\n\tem,\n\timg,\n\tins,\n\tkbd,\n\tq,\n\ts,\n\tsamp,\n\tsmall,\n\tstrike,\n\tstrong,\n\tsub,\n\tsup,\n\ttt,\n\tvar,\n\tb,\n\tu,\n\ti,\n\tcenter,\n\tdl,\n\tdt,\n\tdd,\n\tol,\n\tul,\n\tli,\n\tfieldset,\n\tform,\n\tlabel,\n\tlegend,\n\ttable,\n\tcaption,\n\ttbody,\n\ttfoot,\n\tthead,\n\ttr,\n\tth,\n\ttd,\n\tarticle,\n\taside,\n\tcanvas,\n\tdetails,\n\tembed,\n\tfigure,\n\tfigcaption,\n\tfooter,\n\theader,\n\thgroup,\n\tmenu,\n\tnav,\n\toutput,\n\truby,\n\tsection,\n\tsummary,\n\ttime,\n\tmark,\n\taudio,\n\tvideo {\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\tborder: 0;\n\t\tfont-size: 100%;\n\t\tfont: inherit;\n\t\tvertical-align: baseline;\n\t\toverflow-wrap: anywhere;\n\t}\n\tpre {\n\t\tmargin: 10px auto;\n\t}\n\ttable {\n\t\tmargin: 10px auto;\n\t\tborder-collapse: collapse;\n\t\tborder-spacing: 0;\n\t}\n\ttr {\n\t\tborder-bottom: 1px solid #ccc;\n\t}\n\tth,\n\ttd {\n\t\ttext-align: left;\n\t\tpadding: 4px;\n\t\tborder: 1px solid;\n\t\tborder-collapse: collapse;\n\t}\n\tpre,\n\tcode {\n\t\tpadding: 0.6em 0.4em;\n\t\tbackground: " + (
|
|
836
|
+
return "\n\thtml,\n\tbody,\n\tdiv,\n\tspan,\n\tapplet,\n\tobject,\n\tiframe,\n\th1,\n\th2,\n\th3,\n\th4,\n\th5,\n\th6,\n\tp,\n\tblockquote,\n\tpre,\n\ta,\n\tabbr,\n\tacronym,\n\taddress,\n\tbig,\n\tcite,\n\tcode,\n\tdel,\n\tdfn,\n\tem,\n\timg,\n\tins,\n\tkbd,\n\tq,\n\ts,\n\tsamp,\n\tsmall,\n\tstrike,\n\tstrong,\n\tsub,\n\tsup,\n\ttt,\n\tvar,\n\tb,\n\tu,\n\ti,\n\tcenter,\n\tdl,\n\tdt,\n\tdd,\n\tol,\n\tul,\n\tli,\n\tfieldset,\n\tform,\n\tlabel,\n\tlegend,\n\ttable,\n\tcaption,\n\ttbody,\n\ttfoot,\n\tthead,\n\ttr,\n\tth,\n\ttd,\n\tarticle,\n\taside,\n\tcanvas,\n\tdetails,\n\tembed,\n\tfigure,\n\tfigcaption,\n\tfooter,\n\theader,\n\thgroup,\n\tmenu,\n\tnav,\n\toutput,\n\truby,\n\tsection,\n\tsummary,\n\ttime,\n\tmark,\n\taudio,\n\tvideo {\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\tborder: 0;\n\t\tfont-size: 100%;\n\t\tfont: inherit;\n\t\tvertical-align: baseline;\n\t\toverflow-wrap: anywhere;\n\t}\n\tpre {\n\t\tmargin: 10px auto;\n\t\twhite-space: pre-wrap;\n\n\t}\n\ttable {\n\t\tmargin: 10px auto;\n\t\tborder-collapse: collapse;\n\t\tborder-spacing: 0;\n\t}\n\ttr {\n\t\tborder-bottom: 1px solid #ccc;\n\t}\n\tth,\n\ttd {\n\t\ttext-align: left;\n\t\tpadding: 4px;\n\t\tborder: 1px solid;\n\t\tborder-collapse: collapse;\n\t}\n\tpre,\n\tcode {\n\t\tpadding: 0.6em 0.4em;\n\t\tbackground: " + (
|
|
837
|
+
// eslint-disable-next-line no-nested-ternary
|
|
838
|
+
props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryColor : props.theme.colors.borderColor : props.theme.colors.borderColor) + ";\n\n\t}\n\n\tpre{\n\t\tcolor: " + (
|
|
837
839
|
// eslint-disable-next-line no-nested-ternary
|
|
838
|
-
props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.
|
|
840
|
+
props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor : props.theme.colors.primaryTextColor) + ";}\n\n\tcode {\n\t\tline-height: normal;\n\n\t\tcolor: " + (
|
|
839
841
|
// eslint-disable-next-line no-nested-ternary
|
|
840
|
-
props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor : props.theme.colors.primaryTextColor) + ";\n\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\
|
|
842
|
+
props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor : props.theme.colors.primaryTextColor) + ";\n\t\tborder-radius: 3px;\n\t\tfont-size: 85%;\n\t\tpadding: 0.2em 0.4em;\n\t\tmargin-top: 5px;\n\t\tdisplay: inline-block;\n\t\toverflow: auto;\n\t\twidth: fit-content;\n\t\tmax-width: 100%;\n\t}\n\ncode[class*='language-'],\n\tpre[class*='language-'] {\n\t\tcolor: " + (
|
|
843
|
+
// eslint-disable-next-line no-nested-ternary
|
|
844
|
+
props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor : props.theme.colors.primaryTextColor) + ";\n\t\ttext-shadow: none;\n\t}\n\n\tul,\n\tol {\n\t\tlist-style-position: inside;\n\t\tpadding-left: 10px;\n\n\t}\n\n\tli{\n\t\tdisplay: list-item;\n\t\tcursor: default;\n\t\tpadding: initial;\n\n\t\t&:hover{\n\t\t\tbackground-color: initial;\n\t\t}\n\t}\n\tp {\n\t\tmargin: inherit;\n\t}\n";
|
|
841
845
|
};
|
|
842
846
|
var messageBGColor = function messageBGColor(props) {
|
|
843
847
|
var finalBGColor;
|
|
@@ -866,7 +870,7 @@ var Message = vueEmotion.styled('div')(_templateObject7 || (_templateObject7 = _
|
|
|
866
870
|
return resetCSS(props);
|
|
867
871
|
});
|
|
868
872
|
var MessageInputContainer = vueEmotion.styled('form')(_templateObject8 || (_templateObject8 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tpadding-top: 12px;\n\talign-items: stretch;\n\tmargin-top: 10px;\n\t.ai-enter-button-wrapper {\n\t\talign-self: baseline;\n\t\theight: 41px;\n\t}\n"])));
|
|
869
|
-
var MessageInput = vueEmotion.styled(Input.TextArea)(_templateObject9 || (_templateObject9 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tborder-radius: 5px;\n\tborder: 1px solid #ccc;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\n\t::placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t:-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t::-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n\t", "\n"])), function (props) {
|
|
873
|
+
var MessageInput = vueEmotion.styled(Input.TextArea)(_templateObject9 || (_templateObject9 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tborder-radius: 5px;\n\tborder: 1px solid #ccc;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\n\t::placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t:-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t::-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n\t", "\n\tpadding-left: 35px;\n"])), function (props) {
|
|
870
874
|
return props.themePreset === 'dark' ? props.theme.colors.borderColor : '#fff';
|
|
871
875
|
}, function (props) {
|
|
872
876
|
return props.themePreset === 'dark' ? props.theme.colors.titleColor : props.theme.colors.textColor;
|
|
@@ -1088,7 +1092,9 @@ var md = new remarkable.Remarkable();
|
|
|
1088
1092
|
md.set({
|
|
1089
1093
|
html: true,
|
|
1090
1094
|
breaks: true,
|
|
1091
|
-
xhtmlOut: true
|
|
1095
|
+
xhtmlOut: true,
|
|
1096
|
+
linkify: true,
|
|
1097
|
+
linkTarget: '_blank'
|
|
1092
1098
|
});
|
|
1093
1099
|
var _dropdownULRef = 'dropdownULRef';
|
|
1094
1100
|
var _inputGroupRef = 'inputGroupRef';
|
|
@@ -1116,7 +1122,9 @@ var SearchBox = vue.defineComponent({
|
|
|
1116
1122
|
showAIScreen: false,
|
|
1117
1123
|
showAIScreenFooter: false,
|
|
1118
1124
|
showFeedbackComponent: false,
|
|
1119
|
-
feedbackState: null
|
|
1125
|
+
feedbackState: null,
|
|
1126
|
+
faqAnswer: '',
|
|
1127
|
+
faqQuestion: ''
|
|
1120
1128
|
};
|
|
1121
1129
|
this.internalComponent = props.componentId + "__internal";
|
|
1122
1130
|
return this.__state;
|
|
@@ -1152,17 +1160,41 @@ var SearchBox = vue.defineComponent({
|
|
|
1152
1160
|
}
|
|
1153
1161
|
},
|
|
1154
1162
|
computed: {
|
|
1163
|
+
currentTriggerMode: function currentTriggerMode() {
|
|
1164
|
+
return this.$props.AIUIConfig && this.$props.AIUIConfig.triggerOn || constants.AI_TRIGGER_MODES.MANUAL;
|
|
1165
|
+
},
|
|
1155
1166
|
hasCustomRenderer: function hasCustomRenderer() {
|
|
1156
1167
|
return index.hasCustomRenderer(this);
|
|
1157
1168
|
},
|
|
1158
1169
|
stats: function stats() {
|
|
1159
1170
|
return getResultStats(this);
|
|
1160
1171
|
},
|
|
1172
|
+
mergedAIQuestion: function mergedAIQuestion() {
|
|
1173
|
+
return this.faqQuestion || this.AIResponse && this.AIResponse.response && this.AIResponse.response.question;
|
|
1174
|
+
},
|
|
1175
|
+
mergedAIAnswer: function mergedAIAnswer() {
|
|
1176
|
+
return this.faqAnswer || this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text;
|
|
1177
|
+
},
|
|
1161
1178
|
parsedSuggestions: function parsedSuggestions() {
|
|
1162
1179
|
var suggestionsArray = [];
|
|
1163
1180
|
if (Array.isArray(this.suggestions) && this.suggestions.length) {
|
|
1164
1181
|
suggestionsArray = [].concat(withClickIds(this.suggestions));
|
|
1165
1182
|
}
|
|
1183
|
+
if (this.renderTriggerMessage() && this.currentValue && !this.isLoading) {
|
|
1184
|
+
suggestionsArray.unshift({
|
|
1185
|
+
label: this.renderTriggerMessage(),
|
|
1186
|
+
value: 'AI_TRIGGER_MESSAGE',
|
|
1187
|
+
_suggestion_type: '_internal_a_i_trigger'
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
suggestionsArray = suggestionsArray.map(function (s) {
|
|
1191
|
+
if (s.sectionId) {
|
|
1192
|
+
return s;
|
|
1193
|
+
}
|
|
1194
|
+
return _rollupPluginBabelHelpers._extends({}, s, {
|
|
1195
|
+
sectionId: s._suggestion_type
|
|
1196
|
+
});
|
|
1197
|
+
});
|
|
1166
1198
|
var sectionsAccumulated = [];
|
|
1167
1199
|
var sectionisedSuggestions = suggestionsArray.reduce(function (acc, d, currentIndex) {
|
|
1168
1200
|
if (sectionsAccumulated.includes(d.sectionId)) return acc;
|
|
@@ -1186,6 +1218,7 @@ var SearchBox = vue.defineComponent({
|
|
|
1186
1218
|
className: VueTypes.string.def(''),
|
|
1187
1219
|
clearIcon: vueTypes.types.children,
|
|
1188
1220
|
componentId: vueTypes.types.stringRequired,
|
|
1221
|
+
compoundClause: vueTypes.types.compoundClause,
|
|
1189
1222
|
customHighlight: vueTypes.types.func,
|
|
1190
1223
|
customQuery: vueTypes.types.func,
|
|
1191
1224
|
defaultQuery: vueTypes.types.func,
|
|
@@ -1208,6 +1241,11 @@ var SearchBox = vue.defineComponent({
|
|
|
1208
1241
|
enableQuerySuggestions: VueTypes.bool.def(false),
|
|
1209
1242
|
enablePopularSuggestions: VueTypes.bool.def(false),
|
|
1210
1243
|
enableRecentSuggestions: VueTypes.bool.def(false),
|
|
1244
|
+
enableFAQSuggestions: VueTypes.bool.def(false),
|
|
1245
|
+
FAQSuggestionsConfig: VueTypes.shape({
|
|
1246
|
+
sectionLabel: VueTypes.string,
|
|
1247
|
+
size: VueTypes.number
|
|
1248
|
+
}),
|
|
1211
1249
|
fieldWeights: vueTypes.types.fieldWeights,
|
|
1212
1250
|
filterLabel: vueTypes.types.string,
|
|
1213
1251
|
fuzziness: vueTypes.types.fuzziness,
|
|
@@ -1331,7 +1369,11 @@ var SearchBox = vue.defineComponent({
|
|
|
1331
1369
|
if (this.$options.isTagsMode) {
|
|
1332
1370
|
cause = reactivecore.causes.SUGGESTION_SELECT;
|
|
1333
1371
|
}
|
|
1334
|
-
|
|
1372
|
+
if (this.$props.value === undefined) {
|
|
1373
|
+
this.setValue(newVal, newVal === '', this.$props, cause, false);
|
|
1374
|
+
} else {
|
|
1375
|
+
this.setValue(newVal || '', true, this.$props, cause);
|
|
1376
|
+
}
|
|
1335
1377
|
}
|
|
1336
1378
|
},
|
|
1337
1379
|
focusShortcuts: function focusShortcuts() {
|
|
@@ -1419,6 +1461,20 @@ var SearchBox = vue.defineComponent({
|
|
|
1419
1461
|
}
|
|
1420
1462
|
},
|
|
1421
1463
|
methods: {
|
|
1464
|
+
renderTriggerMessage: function renderTriggerMessage() {
|
|
1465
|
+
if (this.$props.enableAI) {
|
|
1466
|
+
if (this.$props.AIUIConfig && this.$props.AIUIConfig.renderTriggerMessage) {
|
|
1467
|
+
return this.$props.AIUIConfig.renderTriggerMessage;
|
|
1468
|
+
}
|
|
1469
|
+
if (this.$slots.renderTriggerMessage) {
|
|
1470
|
+
return this.$slots.renderTriggerMessage();
|
|
1471
|
+
}
|
|
1472
|
+
if (this.currentTriggerMode === constants.AI_TRIGGER_MODES.MANUAL && (this.$props.AIUIConfig ? !this.$props.AIUIConfig.askButton : true)) {
|
|
1473
|
+
return 'Click to trigger AIAnswer';
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
return null;
|
|
1477
|
+
},
|
|
1422
1478
|
handleText: function handleText(value, cause) {
|
|
1423
1479
|
if (cause === reactivecore.causes.CLEAR_VALUE) {
|
|
1424
1480
|
this.triggerCustomQuery(value);
|
|
@@ -1443,8 +1499,8 @@ var SearchBox = vue.defineComponent({
|
|
|
1443
1499
|
value: currentValue,
|
|
1444
1500
|
resultStats: this.stats,
|
|
1445
1501
|
AIData: {
|
|
1446
|
-
question: this.
|
|
1447
|
-
answer: this.
|
|
1502
|
+
question: this.mergedAIQuestion,
|
|
1503
|
+
answer: this.mergedAIAnswer,
|
|
1448
1504
|
documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
|
|
1449
1505
|
showAIScreen: this.showAIScreen,
|
|
1450
1506
|
sources: this.getAISourceObjects(),
|
|
@@ -1475,7 +1531,7 @@ var SearchBox = vue.defineComponent({
|
|
|
1475
1531
|
this.onValueSelectedHandler(currentValue, reactivecore.causes.SEARCH_ICON_CLICK);
|
|
1476
1532
|
}
|
|
1477
1533
|
},
|
|
1478
|
-
setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue) {
|
|
1534
|
+
setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue, shouldExecuteQuery) {
|
|
1479
1535
|
var _this2 = this;
|
|
1480
1536
|
if (isDefaultValue === void 0) {
|
|
1481
1537
|
isDefaultValue = false;
|
|
@@ -1489,6 +1545,9 @@ var SearchBox = vue.defineComponent({
|
|
|
1489
1545
|
if (categoryValue === void 0) {
|
|
1490
1546
|
categoryValue = undefined;
|
|
1491
1547
|
}
|
|
1548
|
+
if (shouldExecuteQuery === void 0) {
|
|
1549
|
+
shouldExecuteQuery = true;
|
|
1550
|
+
}
|
|
1492
1551
|
var performUpdate = function performUpdate() {
|
|
1493
1552
|
if (_this2.$options.isTagsMode && isEqual(value, _this2.selectedTags)) {
|
|
1494
1553
|
return;
|
|
@@ -1517,24 +1576,31 @@ var SearchBox = vue.defineComponent({
|
|
|
1517
1576
|
if (_this2.$options.isTagsMode && cause === reactivecore.causes.SUGGESTION_SELECT) {
|
|
1518
1577
|
queryHandlerValue = Array.isArray(_this2.selectedTags) && _this2.selectedTags.length ? _this2.selectedTags : undefined;
|
|
1519
1578
|
}
|
|
1579
|
+
if ((_this2.faqAnswer || _this2.faqQuestion) && value === '') {
|
|
1580
|
+
// Empty the previous state
|
|
1581
|
+
_this2.faqAnswer = '';
|
|
1582
|
+
_this2.faqQuestion = '';
|
|
1583
|
+
_this2.showAIScreen = false;
|
|
1584
|
+
}
|
|
1520
1585
|
if (isDefaultValue) {
|
|
1521
1586
|
if (_this2.$props.autosuggest) {
|
|
1522
1587
|
if (toggleIsOpen) {
|
|
1523
1588
|
_this2.isOpen = false;
|
|
1524
1589
|
}
|
|
1525
|
-
if (typeof _this2.currentValue === 'string') _this2.triggerDefaultQuery(_this2.currentValue, props.enableAI ? {
|
|
1590
|
+
if (typeof _this2.currentValue === 'string') _this2.triggerDefaultQuery(_this2.currentValue, props.enableAI && _this2.currentTriggerMode === constants.AI_TRIGGER_MODES.QUESTION && _this2.currentValue.endsWith('?') ? {
|
|
1526
1591
|
enableAI: true
|
|
1527
|
-
} : {});
|
|
1592
|
+
} : {}, shouldExecuteQuery);
|
|
1528
1593
|
} // in case of strict selection only SUGGESTION_SELECT should be able
|
|
1529
1594
|
// to set the query otherwise the value should reset
|
|
1530
1595
|
if (props.strictSelection) {
|
|
1531
1596
|
if (cause === reactivecore.causes.SUGGESTION_SELECT || (_this2.$options.isTagsMode ? _this2.selectedTags.length === 0 : value === '')) {
|
|
1532
|
-
_this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue);
|
|
1597
|
+
_this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
|
|
1533
1598
|
} else {
|
|
1534
1599
|
_this2.setValue('', true);
|
|
1535
1600
|
}
|
|
1536
1601
|
} else if (props.value === undefined || cause === reactivecore.causes.SUGGESTION_SELECT || cause === reactivecore.causes.CLEAR_VALUE) {
|
|
1537
|
-
_this2.
|
|
1602
|
+
_this2.showAIScreen = false;
|
|
1603
|
+
_this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
|
|
1538
1604
|
}
|
|
1539
1605
|
} else {
|
|
1540
1606
|
// debounce for handling text while typing
|
|
@@ -1545,10 +1611,13 @@ var SearchBox = vue.defineComponent({
|
|
|
1545
1611
|
};
|
|
1546
1612
|
checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
|
|
1547
1613
|
},
|
|
1548
|
-
triggerDefaultQuery: function triggerDefaultQuery(paramValue, meta) {
|
|
1614
|
+
triggerDefaultQuery: function triggerDefaultQuery(paramValue, meta, shouldExecuteQuery) {
|
|
1549
1615
|
if (meta === void 0) {
|
|
1550
1616
|
meta = {};
|
|
1551
1617
|
}
|
|
1618
|
+
if (shouldExecuteQuery === void 0) {
|
|
1619
|
+
shouldExecuteQuery = true;
|
|
1620
|
+
}
|
|
1552
1621
|
if (!this.$props.autosuggest) {
|
|
1553
1622
|
return;
|
|
1554
1623
|
}
|
|
@@ -1569,12 +1638,15 @@ var SearchBox = vue.defineComponent({
|
|
|
1569
1638
|
value: value,
|
|
1570
1639
|
componentType: constants.componentTypes.searchBox,
|
|
1571
1640
|
meta: meta
|
|
1572
|
-
});
|
|
1641
|
+
}, shouldExecuteQuery);
|
|
1573
1642
|
},
|
|
1574
|
-
triggerCustomQuery: function triggerCustomQuery(paramValue, categoryValue) {
|
|
1643
|
+
triggerCustomQuery: function triggerCustomQuery(paramValue, categoryValue, shouldExecuteQuery) {
|
|
1575
1644
|
if (categoryValue === void 0) {
|
|
1576
1645
|
categoryValue = undefined;
|
|
1577
1646
|
}
|
|
1647
|
+
if (shouldExecuteQuery === void 0) {
|
|
1648
|
+
shouldExecuteQuery = true;
|
|
1649
|
+
}
|
|
1578
1650
|
var _this$$props = this.$props,
|
|
1579
1651
|
customQuery = _this$$props.customQuery,
|
|
1580
1652
|
filterLabel = _this$$props.filterLabel,
|
|
@@ -1603,7 +1675,7 @@ var SearchBox = vue.defineComponent({
|
|
|
1603
1675
|
URLParams: URLParams,
|
|
1604
1676
|
componentType: constants.componentTypes.searchBox,
|
|
1605
1677
|
category: categoryValue
|
|
1606
|
-
});
|
|
1678
|
+
}, shouldExecuteQuery);
|
|
1607
1679
|
},
|
|
1608
1680
|
handleFocus: function handleFocus(event) {
|
|
1609
1681
|
if (this.$props.autosuggest) {
|
|
@@ -1614,7 +1686,9 @@ var SearchBox = vue.defineComponent({
|
|
|
1614
1686
|
handleVoiceResults: function handleVoiceResults(_ref) {
|
|
1615
1687
|
var results = _ref.results;
|
|
1616
1688
|
if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
|
|
1689
|
+
var _this$$refs2;
|
|
1617
1690
|
this.setValue(results[0][0].transcript.trim(), true);
|
|
1691
|
+
(_this$$refs2 = this.$refs) == null || (_this$$refs2 = _this$$refs2[this.$props.innerRef]) == null || (_this$$refs2 = _this$$refs2.$el) == null ? void 0 : _this$$refs2.focus(); // eslint-disable-line
|
|
1618
1692
|
}
|
|
1619
1693
|
},
|
|
1620
1694
|
triggerQuery: function triggerQuery(_ref2) {
|
|
@@ -1654,6 +1728,8 @@ var SearchBox = vue.defineComponent({
|
|
|
1654
1728
|
clearValue: function clearValue() {
|
|
1655
1729
|
this.setValue('', false, this.$props, !this.$options.isTagsMode ? reactivecore.causes.CLEAR_VALUE : undefined, false);
|
|
1656
1730
|
this.onValueSelectedHandler('', !this.$options.isTagsMode ? reactivecore.causes.CLEAR_VALUE : undefined);
|
|
1731
|
+
this.showAIScreen = false;
|
|
1732
|
+
this.isOpen = false;
|
|
1657
1733
|
},
|
|
1658
1734
|
handleKeyDown: function handleKeyDown(event, highlightedIndex) {
|
|
1659
1735
|
if (highlightedIndex === void 0) {
|
|
@@ -1666,9 +1742,10 @@ var SearchBox = vue.defineComponent({
|
|
|
1666
1742
|
} else if (highlightedIndex === null) {
|
|
1667
1743
|
this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? reactivecore.causes.SUGGESTION_SELECT : undefined,
|
|
1668
1744
|
// to handle tags
|
|
1669
|
-
!this.$props.enableAI);
|
|
1670
|
-
if (this.$props.enableAI && !this.showAIScreen) {
|
|
1745
|
+
!(this.$props.enableAI && this.currentTriggerMode === constants.AI_TRIGGER_MODES.QUESTION && event.target.value.endsWith('?')));
|
|
1746
|
+
if (this.$props.enableAI && !this.showAIScreen && this.currentTriggerMode === constants.AI_TRIGGER_MODES.QUESTION && event.target.value.endsWith('?')) {
|
|
1671
1747
|
this.showAIScreen = true;
|
|
1748
|
+
this.isOpen = true;
|
|
1672
1749
|
}
|
|
1673
1750
|
this.onValueSelectedHandler(event.target.value, reactivecore.causes.ENTER_PRESS);
|
|
1674
1751
|
}
|
|
@@ -1689,7 +1766,7 @@ var SearchBox = vue.defineComponent({
|
|
|
1689
1766
|
}
|
|
1690
1767
|
var value = this.$props.value;
|
|
1691
1768
|
if (value === undefined) {
|
|
1692
|
-
this.setValue(inputValue,
|
|
1769
|
+
this.setValue(inputValue, inputValue === '', this.$props, undefined, false);
|
|
1693
1770
|
} else {
|
|
1694
1771
|
this.$emit('change', inputValue, function (_ref3) {
|
|
1695
1772
|
var isOpen = _ref3.isOpen;
|
|
@@ -1704,7 +1781,7 @@ var SearchBox = vue.defineComponent({
|
|
|
1704
1781
|
},
|
|
1705
1782
|
handleFeaturedSuggestionClicked: function handleFeaturedSuggestionClicked(suggestion) {
|
|
1706
1783
|
try {
|
|
1707
|
-
var _this$$
|
|
1784
|
+
var _this$$refs3;
|
|
1708
1785
|
if (suggestion.action === helper.featuredSuggestionsActionTypes.NAVIGATE) {
|
|
1709
1786
|
var _JSON$parse = JSON.parse(suggestion.subAction),
|
|
1710
1787
|
_JSON$parse$target = _JSON$parse.target,
|
|
@@ -1723,7 +1800,7 @@ var SearchBox = vue.defineComponent({
|
|
|
1723
1800
|
func(suggestion, this.$data.currentValue, this.$props.customEvents);
|
|
1724
1801
|
}
|
|
1725
1802
|
if (suggestion.action === helper.featuredSuggestionsActionTypes.SELECT) {
|
|
1726
|
-
this.setValue(suggestion.value, true, this.$props, this.$options.isTagsMode.current ? reactivecore.causes.SUGGESTION_SELECT : reactivecore.causes.ENTER_PRESS);
|
|
1803
|
+
this.setValue(suggestion.value, true, this.$props, this.$options.isTagsMode.current ? reactivecore.causes.SUGGESTION_SELECT : reactivecore.causes.ENTER_PRESS, false);
|
|
1727
1804
|
this.onValueSelectedHandler(suggestion.value, reactivecore.causes.SUGGESTION_SELECT);
|
|
1728
1805
|
}
|
|
1729
1806
|
// blur is important to close the dropdown
|
|
@@ -1731,21 +1808,41 @@ var SearchBox = vue.defineComponent({
|
|
|
1731
1808
|
// else Downshift probably is focusing the dropdown
|
|
1732
1809
|
// and not letting it close
|
|
1733
1810
|
// eslint-disable-next-line no-unused-expressions
|
|
1734
|
-
(_this$$
|
|
1811
|
+
(_this$$refs3 = this.$refs) == null || (_this$$refs3 = _this$$refs3[this.$props.innerRef]) == null || (_this$$refs3 = _this$$refs3.el) == null ? void 0 : _this$$refs3.blur();
|
|
1735
1812
|
} catch (e) {
|
|
1736
1813
|
console.error("Error: There was an error parsing the subAction for the featured suggestion with label, \"" + suggestion.label + "\"", e);
|
|
1737
1814
|
}
|
|
1738
1815
|
},
|
|
1739
1816
|
onSuggestionSelected: function onSuggestionSelected(suggestion) {
|
|
1740
1817
|
var _this4 = this;
|
|
1741
|
-
|
|
1818
|
+
var value = this.$props.value;
|
|
1819
|
+
// The state of the suggestion is open by the time it reaches here. i.e. isOpen = true
|
|
1820
|
+
// handle when FAQ suggestion is clicked
|
|
1821
|
+
if (suggestion && suggestion._suggestion_type === helper.suggestionTypes.FAQ) {
|
|
1822
|
+
this.currentValue = suggestion.value;
|
|
1823
|
+
// Handle AI
|
|
1824
|
+
// Independent of enableAI.
|
|
1825
|
+
this.faqAnswer = suggestion._answer;
|
|
1826
|
+
this.faqQuestion = suggestion.value;
|
|
1827
|
+
this.isOpen = true;
|
|
1742
1828
|
this.showAIScreen = true;
|
|
1829
|
+
if (value !== undefined) this.$emit('change', suggestion.value, function () {});
|
|
1830
|
+
this.onValueSelectedHandler(suggestion.value);
|
|
1831
|
+
return;
|
|
1832
|
+
}
|
|
1833
|
+
if (suggestion && suggestion._suggestion_type === '_internal_a_i_trigger') {
|
|
1834
|
+
this.showAIScreen = true;
|
|
1835
|
+
this.askButtonOnClick();
|
|
1836
|
+
return;
|
|
1743
1837
|
}
|
|
1744
|
-
var value = this.$props.value;
|
|
1745
1838
|
|
|
1746
1839
|
// handle featured suggestions click event
|
|
1747
1840
|
if (suggestion._suggestion_type === helper.suggestionTypes.Featured) {
|
|
1748
1841
|
this.handleFeaturedSuggestionClicked(suggestion);
|
|
1842
|
+
// Handle AI
|
|
1843
|
+
if (!this.$props.enableAI) this.isOpen = false;else {
|
|
1844
|
+
this.showAIScreen = true;
|
|
1845
|
+
}
|
|
1749
1846
|
return;
|
|
1750
1847
|
}
|
|
1751
1848
|
// Record analytics for selected suggestions
|
|
@@ -1775,6 +1872,11 @@ var SearchBox = vue.defineComponent({
|
|
|
1775
1872
|
});
|
|
1776
1873
|
}
|
|
1777
1874
|
this.onValueSelectedHandler(suggestion.value, reactivecore.causes.SUGGESTION_SELECT, suggestion.source);
|
|
1875
|
+
|
|
1876
|
+
// Handle AI
|
|
1877
|
+
if (!this.$props.enableAI) this.isOpen = false;else if (this.currentTriggerMode === constants.AI_TRIGGER_MODES.QUESTION && suggestion.value.endsWith('?')) {
|
|
1878
|
+
this.showAIScreen = true;
|
|
1879
|
+
}
|
|
1778
1880
|
},
|
|
1779
1881
|
onValueSelectedHandler: function onValueSelectedHandler(currentValue) {
|
|
1780
1882
|
if (currentValue === void 0) {
|
|
@@ -2018,14 +2120,14 @@ var SearchBox = vue.defineComponent({
|
|
|
2018
2120
|
})]);
|
|
2019
2121
|
},
|
|
2020
2122
|
focusSearchBox: function focusSearchBox(event) {
|
|
2021
|
-
var _this$$
|
|
2123
|
+
var _this$$refs4;
|
|
2022
2124
|
var elt = event.target || event.srcElement;
|
|
2023
2125
|
var tagName = elt.tagName;
|
|
2024
2126
|
if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
|
|
2025
2127
|
// already in an input
|
|
2026
2128
|
return;
|
|
2027
2129
|
}
|
|
2028
|
-
(_this$$
|
|
2130
|
+
(_this$$refs4 = this.$refs) == null || (_this$$refs4 = _this$$refs4[this.$props.innerRef]) == null || (_this$$refs4 = _this$$refs4.$el) == null ? void 0 : _this$$refs4.focus(); // eslint-disable-line
|
|
2029
2131
|
},
|
|
2030
2132
|
listenForFocusShortcuts: function listenForFocusShortcuts() {
|
|
2031
2133
|
var _this9 = this;
|
|
@@ -2196,37 +2298,44 @@ var SearchBox = vue.defineComponent({
|
|
|
2196
2298
|
return vue.createVNode(HorizontalSkeletonLoader, null, null);
|
|
2197
2299
|
},
|
|
2198
2300
|
renderAIScreenFooter: function renderAIScreenFooter() {
|
|
2199
|
-
var
|
|
2301
|
+
var _slot8;
|
|
2200
2302
|
var _this13 = this;
|
|
2201
2303
|
var _this$$props$AIUIConf2 = this.$props.AIUIConfig,
|
|
2202
2304
|
AIUIConfig = _this$$props$AIUIConf2 === void 0 ? {} : _this$$props$AIUIConf2;
|
|
2203
2305
|
var _ref6 = AIUIConfig || {},
|
|
2204
2306
|
_ref6$showSourceDocum = _ref6.showSourceDocuments,
|
|
2205
2307
|
showSourceDocuments = _ref6$showSourceDocum === void 0 ? true : _ref6$showSourceDocum,
|
|
2206
|
-
_ref6$sourceDocumentL = _ref6.sourceDocumentLabel,
|
|
2207
|
-
sourceDocumentLabel = _ref6$sourceDocumentL === void 0 ? '_id' : _ref6$sourceDocumentL,
|
|
2208
2308
|
_ref6$onSourceClick = _ref6.onSourceClick,
|
|
2209
2309
|
onSourceClick = _ref6$onSourceClick === void 0 ? function () {} : _ref6$onSourceClick;
|
|
2310
|
+
var renderSourceDocumentLabel = function renderSourceDocumentLabel(sourceObj) {
|
|
2311
|
+
if (_this13.$props.AIUIConfig && _this13.$props.AIUIConfig.renderSourceDocument) {
|
|
2312
|
+
return _this13.$props.AIUIConfig.renderSourceDocument(sourceObj);
|
|
2313
|
+
}
|
|
2314
|
+
if (_this13.$slots.renderSourceDocument) {
|
|
2315
|
+
return _this13.$slots.renderSourceDocument(sourceObj);
|
|
2316
|
+
}
|
|
2317
|
+
return sourceObj._id;
|
|
2318
|
+
};
|
|
2210
2319
|
return showSourceDocuments && this.showAIScreenFooter && this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds ? vue.createVNode(Footer, {
|
|
2211
2320
|
"themePreset": this.$props.themePreset
|
|
2212
2321
|
}, {
|
|
2213
2322
|
"default": function _default() {
|
|
2214
|
-
return [vue.createTextVNode("Summary generated using the following sources:"), ' ', vue.createVNode(SourceTags, null, _isSlot(
|
|
2323
|
+
return [vue.createTextVNode("Summary generated using the following sources:"), ' ', vue.createVNode(SourceTags, null, _isSlot(_slot8 = _this13.getAISourceObjects().map(function (el) {
|
|
2324
|
+
var _slot7;
|
|
2215
2325
|
return vue.createVNode(Button.Button, {
|
|
2216
2326
|
"class": "--ai-source-tag " + (getClassName$1(_this13.$props.innerClass, 'ai-source-tag') || ''),
|
|
2217
|
-
"title": el[sourceDocumentLabel],
|
|
2218
2327
|
"info": true,
|
|
2219
2328
|
"onClick": function onClick() {
|
|
2220
2329
|
return onSourceClick && onSourceClick(el);
|
|
2221
2330
|
}
|
|
2222
|
-
}, {
|
|
2331
|
+
}, _isSlot(_slot7 = renderSourceDocumentLabel(el)) ? _slot7 : {
|
|
2223
2332
|
"default": function _default() {
|
|
2224
|
-
return [
|
|
2333
|
+
return [_slot7];
|
|
2225
2334
|
}
|
|
2226
2335
|
});
|
|
2227
|
-
})) ?
|
|
2336
|
+
})) ? _slot8 : {
|
|
2228
2337
|
"default": function _default() {
|
|
2229
|
-
return [
|
|
2338
|
+
return [_slot8];
|
|
2230
2339
|
}
|
|
2231
2340
|
})];
|
|
2232
2341
|
}
|
|
@@ -2237,8 +2346,8 @@ var SearchBox = vue.defineComponent({
|
|
|
2237
2346
|
var customAIRenderer = this.$props.renderAIAnswer || this.$slots.renderAIAnswer;
|
|
2238
2347
|
if (customAIRenderer) {
|
|
2239
2348
|
return customAIRenderer({
|
|
2240
|
-
question: this.
|
|
2241
|
-
answer: this.
|
|
2349
|
+
question: this.mergedAIQuestion,
|
|
2350
|
+
answer: this.mergedAIAnswer,
|
|
2242
2351
|
documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
|
|
2243
2352
|
loading: this.isAIResponseLoading || this.isLoading,
|
|
2244
2353
|
sources: this.getAISourceObjects(),
|
|
@@ -2249,7 +2358,7 @@ var SearchBox = vue.defineComponent({
|
|
|
2249
2358
|
return this.renderAIScreenLoader();
|
|
2250
2359
|
}
|
|
2251
2360
|
return vue.createVNode("div", null, [vue.createVNode(Answer, {
|
|
2252
|
-
"innerHTML": md.render(this.
|
|
2361
|
+
"innerHTML": md.render(this.mergedAIAnswer)
|
|
2253
2362
|
}, null), this.renderAIScreenFooter(), this.showFeedbackComponent && vue.createVNode("div", {
|
|
2254
2363
|
"class": "" + (getClassName$1(this.$props.innerClass, 'ai-feedback') || '')
|
|
2255
2364
|
}, [vue.createVNode(AIFeedback, {
|
|
@@ -2380,7 +2489,7 @@ var SearchBox = vue.defineComponent({
|
|
|
2380
2489
|
return (// When you change below also change the empty icon below
|
|
2381
2490
|
vue.createVNode("img", {
|
|
2382
2491
|
"style": {
|
|
2383
|
-
|
|
2492
|
+
maxWidth: '30px'
|
|
2384
2493
|
},
|
|
2385
2494
|
"src": xss(item.iconURL),
|
|
2386
2495
|
"alt": item.value
|
|
@@ -2393,8 +2502,8 @@ var SearchBox = vue.defineComponent({
|
|
|
2393
2502
|
return vue.createVNode("span", {
|
|
2394
2503
|
"style": {
|
|
2395
2504
|
display: 'inline-block',
|
|
2396
|
-
height: '
|
|
2397
|
-
width: leaveSpaceForIcon ? '
|
|
2505
|
+
height: '30px',
|
|
2506
|
+
width: leaveSpaceForIcon ? '30px' : 0
|
|
2398
2507
|
}
|
|
2399
2508
|
}, null);
|
|
2400
2509
|
};
|
|
@@ -2423,6 +2532,7 @@ var SearchBox = vue.defineComponent({
|
|
|
2423
2532
|
var sectionHtml = xss(item[0].sectionLabel);
|
|
2424
2533
|
indexOffset += item.length - 1;
|
|
2425
2534
|
return vue.createVNode("div", {
|
|
2535
|
+
"key": "section-" + itemIndex,
|
|
2426
2536
|
"class": "section-container"
|
|
2427
2537
|
}, [sectionHtml ? vue.createVNode("div", {
|
|
2428
2538
|
"class": "section-header " + getClassName$1(_this16.$props.innerClass, 'section-label'),
|
|
@@ -2434,23 +2544,43 @@ var SearchBox = vue.defineComponent({
|
|
|
2434
2544
|
var suggestionsHaveIcon = item.some(function (s) {
|
|
2435
2545
|
return s.icon || s.iconURL;
|
|
2436
2546
|
});
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2547
|
+
if (renderItem) {
|
|
2548
|
+
return vue.createVNode("li", vue.mergeProps(getItemProps({
|
|
2549
|
+
item: sectionItem
|
|
2550
|
+
}), _transformOn(getItemEvents({
|
|
2551
|
+
item: sectionItem
|
|
2552
|
+
})), {
|
|
2553
|
+
"key": sectionItem._id + "_" + index + "_" + sectionIndex,
|
|
2554
|
+
"style": {
|
|
2555
|
+
justifyContent: 'flex-start',
|
|
2556
|
+
alignItems: 'center'
|
|
2557
|
+
},
|
|
2558
|
+
"class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this16.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this16.$props.innerClass, 'suggestion-item'))
|
|
2559
|
+
}), [renderItem(sectionItem)]);
|
|
2560
|
+
}
|
|
2561
|
+
if (sectionItem._suggestion_type === '_internal_a_i_trigger') {
|
|
2562
|
+
return vue.createVNode("li", vue.mergeProps(getItemProps({
|
|
2563
|
+
item: sectionItem
|
|
2564
|
+
}), _transformOn(getItemEvents({
|
|
2565
|
+
item: sectionItem
|
|
2566
|
+
})), {
|
|
2567
|
+
"key": sectionItem._id + "_" + index + "_" + sectionIndex,
|
|
2568
|
+
"style": {
|
|
2569
|
+
justifyContent: 'flex-start',
|
|
2570
|
+
alignItems: 'center'
|
|
2571
|
+
},
|
|
2572
|
+
"class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this16.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this16.$props.innerClass, 'suggestion-item'))
|
|
2573
|
+
}), [vue.createVNode(SuggestionItem, {
|
|
2574
|
+
"currentValue": _this16.currentValue,
|
|
2575
|
+
"suggestion": sectionItem
|
|
2576
|
+
}, null)]);
|
|
2577
|
+
}
|
|
2578
|
+
return vue.createVNode("li", vue.mergeProps(getItemProps({
|
|
2449
2579
|
item: sectionItem
|
|
2450
2580
|
}), _transformOn(getItemEvents({
|
|
2451
2581
|
item: sectionItem
|
|
2452
2582
|
})), {
|
|
2453
|
-
"key": index + sectionIndex,
|
|
2583
|
+
"key": sectionItem._id + "_" + index + "_" + sectionIndex,
|
|
2454
2584
|
"style": {
|
|
2455
2585
|
justifyContent: 'flex-start',
|
|
2456
2586
|
alignItems: 'center'
|
|
@@ -2462,6 +2592,7 @@ var SearchBox = vue.defineComponent({
|
|
|
2462
2592
|
display: 'flex'
|
|
2463
2593
|
}
|
|
2464
2594
|
}, [vue.createVNode(CustomSvg, {
|
|
2595
|
+
"key": sectionItem._suggestion_type + "-" + sectionIndex,
|
|
2465
2596
|
"className": getClassName$1(_this16.$props.innerClass, sectionItem._suggestion_type + "-search-icon") || null,
|
|
2466
2597
|
"icon": getIcon(sectionItem._suggestion_type, sectionItem, suggestionsHaveIcon),
|
|
2467
2598
|
"type": sectionItem._suggestion_type + "-search-icon"
|
|
@@ -2472,13 +2603,14 @@ var SearchBox = vue.defineComponent({
|
|
|
2472
2603
|
})])]);
|
|
2473
2604
|
}
|
|
2474
2605
|
return vue.createVNode("div", null, [vue.createTextVNode("No suggestions")]);
|
|
2475
|
-
}), _this16.$props.showSuggestionsFooter ? _this16.suggestionsFooter() : null]) : _this16.renderNoSuggestions(_this16.normalizedSuggestions)]);
|
|
2606
|
+
}), !_this16.showAIScreen && _this16.parsedSuggestions.length && _this16.$props.showSuggestionsFooter ? _this16.suggestionsFooter() : null]) : _this16.renderNoSuggestions(_this16.normalizedSuggestions)]);
|
|
2476
2607
|
};
|
|
2477
2608
|
return vue.createVNode("div", {
|
|
2478
2609
|
"class": Input.suggestionsContainer
|
|
2479
2610
|
}, [vue.createVNode(InputGroup, {
|
|
2480
2611
|
"searchBox": true,
|
|
2481
|
-
"ref": _inputGroupRef
|
|
2612
|
+
"ref": _inputGroupRef,
|
|
2613
|
+
"isOpen": _this16.$data.isOpen
|
|
2482
2614
|
}, {
|
|
2483
2615
|
"default": function _default() {
|
|
2484
2616
|
return [vue.createVNode(Input.Actions, null, {
|
|
@@ -2508,17 +2640,13 @@ var SearchBox = vue.defineComponent({
|
|
|
2508
2640
|
setHighlightedIndex(null);
|
|
2509
2641
|
}
|
|
2510
2642
|
})), {
|
|
2643
|
+
"searchBox": true,
|
|
2644
|
+
"isOpen": _this16.$data.isOpen,
|
|
2511
2645
|
"id": _this16.$props.componentId + "-input",
|
|
2512
|
-
"showIcon": _this16.$props.showIcon,
|
|
2513
|
-
"showClear": _this16.$props.showClear,
|
|
2514
|
-
"iconPosition": _this16.$props.iconPosition,
|
|
2515
2646
|
"ref": _this16.$props.innerRef,
|
|
2516
2647
|
"class": getClassName$1(_this16.$props.innerClass, 'input'),
|
|
2517
2648
|
"placeholder": _this16.$props.placeholder,
|
|
2518
|
-
"autoFocus": _this16.$props.autoFocus
|
|
2519
|
-
"searchBox": true,
|
|
2520
|
-
"showFocusShortcutsIcon": _this16.$props.showFocusShortcutsIcon,
|
|
2521
|
-
"showVoiceSearch": _this16.$props.showVoiceSearch
|
|
2649
|
+
"autoFocus": _this16.$props.autoFocus
|
|
2522
2650
|
}, getInputProps({
|
|
2523
2651
|
value: _this16.$data.currentValue === null ? '' : _this16.$data.currentValue
|
|
2524
2652
|
}), {
|
|
@@ -2565,6 +2693,7 @@ var SearchBox = vue.defineComponent({
|
|
|
2565
2693
|
_this16.$emit('key-up', e, _this16.triggerQuery);
|
|
2566
2694
|
}
|
|
2567
2695
|
}), {
|
|
2696
|
+
"searchBox": true,
|
|
2568
2697
|
"class": getClassName$1(_this16.$props.innerClass, 'input') || '',
|
|
2569
2698
|
"placeholder": _this16.$props.placeholder,
|
|
2570
2699
|
"autofocus": _this16.$props.autoFocus,
|
|
@@ -2666,6 +2795,7 @@ SBConnected.install = function (Vue) {
|
|
|
2666
2795
|
// Add componentType for SSR
|
|
2667
2796
|
SBConnected.componentType = constants.componentTypes.searchBox;
|
|
2668
2797
|
|
|
2798
|
+
var _excluded$1 = ["_source"];
|
|
2669
2799
|
function _isSlot$1(s) {
|
|
2670
2800
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
2671
2801
|
}
|
|
@@ -2673,7 +2803,9 @@ var md$1 = new remarkable.Remarkable();
|
|
|
2673
2803
|
md$1.set({
|
|
2674
2804
|
html: true,
|
|
2675
2805
|
breaks: true,
|
|
2676
|
-
xhtmlOut: true
|
|
2806
|
+
xhtmlOut: true,
|
|
2807
|
+
linkify: true,
|
|
2808
|
+
linkTarget: '_blank'
|
|
2677
2809
|
});
|
|
2678
2810
|
var _inputWrapperRef = 'inputWrapperRef';
|
|
2679
2811
|
var _inputRef = 'inputRef';
|
|
@@ -2686,7 +2818,10 @@ var AIAnswer = vue.defineComponent({
|
|
|
2686
2818
|
messages: [],
|
|
2687
2819
|
inputMessage: '',
|
|
2688
2820
|
AISessionId: '',
|
|
2689
|
-
error: null
|
|
2821
|
+
error: null,
|
|
2822
|
+
sourceDocIds: null,
|
|
2823
|
+
initialHits: null,
|
|
2824
|
+
isTriggered: false
|
|
2690
2825
|
};
|
|
2691
2826
|
this.internalComponent = props.componentId + "__internal";
|
|
2692
2827
|
return this.__state;
|
|
@@ -2696,7 +2831,16 @@ var AIAnswer = vue.defineComponent({
|
|
|
2696
2831
|
from: 'theme_reactivesearch'
|
|
2697
2832
|
}
|
|
2698
2833
|
},
|
|
2699
|
-
created: function created() {
|
|
2834
|
+
created: function created() {
|
|
2835
|
+
if (this.$props.triggerOn === constants.AI_TRIGGER_MODES.ALWAYS) {
|
|
2836
|
+
this.isTriggered = true;
|
|
2837
|
+
} else if (this.$props.triggerOn === constants.AI_TRIGGER_MODES.QUESTION && this.dependentComponentValue && this.dependentComponentValue.endsWith('?')) {
|
|
2838
|
+
this.isTriggered = true;
|
|
2839
|
+
if (this.AISessionId) {
|
|
2840
|
+
this.handleSendMessage(null, false, '', true);
|
|
2841
|
+
}
|
|
2842
|
+
}
|
|
2843
|
+
},
|
|
2700
2844
|
computed: {
|
|
2701
2845
|
hasCustomRenderer: function hasCustomRenderer() {
|
|
2702
2846
|
return index.hasCustomRenderer(this);
|
|
@@ -2709,6 +2853,9 @@ var AIAnswer = vue.defineComponent({
|
|
|
2709
2853
|
},
|
|
2710
2854
|
errorMessageForMissingSessionId: function errorMessageForMissingSessionId() {
|
|
2711
2855
|
return "AISessionId for " + this.$props.componentId + " is missing! AIAnswer component requires an AISessionId to function. Try reloading the App.";
|
|
2856
|
+
},
|
|
2857
|
+
hasTriggered: function hasTriggered() {
|
|
2858
|
+
return this.isTriggered;
|
|
2712
2859
|
}
|
|
2713
2860
|
},
|
|
2714
2861
|
props: {
|
|
@@ -2747,13 +2894,26 @@ var AIAnswer = vue.defineComponent({
|
|
|
2747
2894
|
sessionIdFromStore: VueTypes.string,
|
|
2748
2895
|
showComponent: vueTypes.types.boolRequired,
|
|
2749
2896
|
componentError: vueTypes.types.componentObject,
|
|
2750
|
-
style: vueTypes.types.style
|
|
2897
|
+
style: vueTypes.types.style,
|
|
2898
|
+
showSourceDocuments: VueTypes.bool.def(false),
|
|
2899
|
+
renderSourceDocument: vueTypes.types.func,
|
|
2900
|
+
onSourceClick: vueTypes.types.func,
|
|
2901
|
+
isAITyping: vueTypes.types.boolRequired,
|
|
2902
|
+
triggerOn: VueTypes.string.def(constants.AI_TRIGGER_MODES.ALWAYS),
|
|
2903
|
+
renderTriggerMessage: vueTypes.types.func
|
|
2751
2904
|
},
|
|
2752
2905
|
mounted: function mounted() {},
|
|
2753
2906
|
watch: {
|
|
2754
2907
|
AIResponse: function AIResponse(newVal) {
|
|
2755
2908
|
if (newVal) {
|
|
2756
|
-
this.
|
|
2909
|
+
if (this.$props.showSourceDocuments && newVal.response && newVal.response.answer && Array.isArray(newVal.response.answer.documentIds)) {
|
|
2910
|
+
this.sourceDocIds = newVal.response.answer.documentIds;
|
|
2911
|
+
var localCache = helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) && helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY)[this.$props.componentId];
|
|
2912
|
+
if (localCache && localCache.meta && localCache.meta.hits) {
|
|
2913
|
+
this.initialHits = localCache.meta.hits;
|
|
2914
|
+
}
|
|
2915
|
+
}
|
|
2916
|
+
this.AISessionId = ((helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || (((helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).response || {}).sessionId;
|
|
2757
2917
|
var messagesHistory = newVal.messages,
|
|
2758
2918
|
response = newVal.response;
|
|
2759
2919
|
var finalMessages = [];
|
|
@@ -2764,7 +2924,7 @@ var AIAnswer = vue.defineComponent({
|
|
|
2764
2924
|
}
|
|
2765
2925
|
|
|
2766
2926
|
// pushing message history so far
|
|
2767
|
-
if (messagesHistory &&
|
|
2927
|
+
if (messagesHistory && Array.isArray(messagesHistory)) {
|
|
2768
2928
|
finalMessages.push.apply(finalMessages, messagesHistory.filter(function (msg) {
|
|
2769
2929
|
return msg.role !== constants.AI_ROLES.SYSTEM;
|
|
2770
2930
|
}));
|
|
@@ -2789,6 +2949,9 @@ var AIAnswer = vue.defineComponent({
|
|
|
2789
2949
|
loading: this.$props.isAIResponseLoading || this.$props.isLoading,
|
|
2790
2950
|
error: this.$props.AIResponseError
|
|
2791
2951
|
});
|
|
2952
|
+
if (newVal && newVal.hits && newVal.hits.hits) {
|
|
2953
|
+
this.initialHits = newVal.hits.hits;
|
|
2954
|
+
}
|
|
2792
2955
|
},
|
|
2793
2956
|
isAIResponseLoading: function isAIResponseLoading(newVal) {
|
|
2794
2957
|
this.$emit('on-data', {
|
|
@@ -2813,7 +2976,7 @@ var AIAnswer = vue.defineComponent({
|
|
|
2813
2976
|
},
|
|
2814
2977
|
AIResponseError: function AIResponseError(newVal) {
|
|
2815
2978
|
this.error = newVal;
|
|
2816
|
-
this.AISessionId = ((helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId ||
|
|
2979
|
+
this.AISessionId = ((helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || (((helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).response || {}).sessionId;
|
|
2817
2980
|
if (this.error && !this.AISessionId) {
|
|
2818
2981
|
var errorMessage = this.errorMessageForMissingSessionId;
|
|
2819
2982
|
this.error = {
|
|
@@ -2834,7 +2997,7 @@ var AIAnswer = vue.defineComponent({
|
|
|
2834
2997
|
componentError: function componentError(newVal) {
|
|
2835
2998
|
var _this = this;
|
|
2836
2999
|
if (newVal && newVal._bodyBlob) {
|
|
2837
|
-
this.AISessionId = ((helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId ||
|
|
3000
|
+
this.AISessionId = ((helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || (((helper.getObjectFromLocalStorage(constants.AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).response || {}).sessionId;
|
|
2838
3001
|
if (!this.AISessionId) {
|
|
2839
3002
|
this.generateNewSessionId();
|
|
2840
3003
|
}
|
|
@@ -2857,23 +3020,154 @@ var AIAnswer = vue.defineComponent({
|
|
|
2857
3020
|
console.error('Error reading component error text data:', error);
|
|
2858
3021
|
});
|
|
2859
3022
|
}
|
|
3023
|
+
},
|
|
3024
|
+
showComponent: function showComponent() {
|
|
3025
|
+
if (this.$props.triggerOn === constants.AI_TRIGGER_MODES.QUESTION && this.$props.dependentComponentValue.endsWith('?')) {
|
|
3026
|
+
this.isTriggered = true;
|
|
3027
|
+
}
|
|
3028
|
+
},
|
|
3029
|
+
dependentComponentValue: function dependentComponentValue(newVal) {
|
|
3030
|
+
if (this.$props.triggerOn === constants.AI_TRIGGER_MODES.QUESTION && newVal && newVal.endsWith('?')) {
|
|
3031
|
+
this.isTriggered = true;
|
|
3032
|
+
if (this.AISessionId) {
|
|
3033
|
+
this.handleSendMessage(null, false, '', true);
|
|
3034
|
+
}
|
|
3035
|
+
} else if (this.hasTriggered && this.$props.triggerOn !== constants.AI_TRIGGER_MODES.ALWAYS) {
|
|
3036
|
+
this.isTriggered = false;
|
|
3037
|
+
}
|
|
3038
|
+
},
|
|
3039
|
+
AISessionId: function AISessionId(newVal) {
|
|
3040
|
+
if (newVal) {
|
|
3041
|
+
if (this.$props.triggerOn === constants.AI_TRIGGER_MODES.QUESTION && this.dependentComponentValue && this.dependentComponentValue.endsWith('?') || this.$props.triggerOn === constants.AI_TRIGGER_MODES.ALWAYS) {
|
|
3042
|
+
this.handleSendMessage(null, false, '', true);
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
3045
|
+
},
|
|
3046
|
+
triggerOn: function triggerOn(newVal) {
|
|
3047
|
+
if (newVal === constants.AI_TRIGGER_MODES.ALWAYS) {
|
|
3048
|
+
this.isTriggered = true;
|
|
3049
|
+
}
|
|
2860
3050
|
}
|
|
2861
3051
|
},
|
|
2862
3052
|
methods: {
|
|
2863
|
-
|
|
3053
|
+
renderTriggerMessageFunc: function renderTriggerMessageFunc() {
|
|
3054
|
+
var triggerOn = this.$props.triggerOn;
|
|
3055
|
+
if (this.$props.renderTriggerMessage) {
|
|
3056
|
+
return this.$props.renderTriggerMessage;
|
|
3057
|
+
}
|
|
3058
|
+
if (this.$slots.renderTriggerMessage) {
|
|
3059
|
+
return this.$slots.renderTriggerMessage();
|
|
3060
|
+
}
|
|
3061
|
+
if (triggerOn === constants.AI_TRIGGER_MODES.QUESTION) {
|
|
3062
|
+
if (!this.dependentComponentValue.endsWith('?')) {
|
|
3063
|
+
return vue.createVNode("span", null, [vue.createVNode("span", {
|
|
3064
|
+
"role": "img",
|
|
3065
|
+
"aria-label": "bulb"
|
|
3066
|
+
}, [vue.createTextVNode("\uD83D\uDCA1")]), vue.createTextVNode("End your question with a question mark (?)")]);
|
|
3067
|
+
}
|
|
3068
|
+
} else if (triggerOn === constants.AI_TRIGGER_MODES.MANUAL) {
|
|
3069
|
+
return vue.createVNode("span", null, [vue.createTextVNode("Click here to ask AI"), ' ', vue.createVNode("span", {
|
|
3070
|
+
"role": "img",
|
|
3071
|
+
"aria-label": "bulb"
|
|
3072
|
+
}, [vue.createTextVNode("\uD83E\uDD16")])]);
|
|
3073
|
+
}
|
|
3074
|
+
return null;
|
|
3075
|
+
},
|
|
3076
|
+
handleTriggerClick: function handleTriggerClick() {
|
|
3077
|
+
if (this.$props.triggerOn === constants.AI_TRIGGER_MODES.MANUAL) {
|
|
3078
|
+
this.handleSendMessage(null, false, '', true);
|
|
3079
|
+
this.isTriggered = true;
|
|
3080
|
+
}
|
|
3081
|
+
},
|
|
3082
|
+
getAISourceObjects: function getAISourceObjects() {
|
|
2864
3083
|
var _this2 = this;
|
|
3084
|
+
var sourceObjects = [];
|
|
3085
|
+
if (!this.AIResponse) return sourceObjects;
|
|
3086
|
+
var docIds = this.sourceDocIds || [];
|
|
3087
|
+
if (this.initialHits) {
|
|
3088
|
+
docIds.forEach(function (id) {
|
|
3089
|
+
var foundSourceObj = _this2.initialHits.find(function (hit) {
|
|
3090
|
+
return hit._id === id;
|
|
3091
|
+
}) || {};
|
|
3092
|
+
if (foundSourceObj) {
|
|
3093
|
+
var _foundSourceObj$_sour = foundSourceObj._source,
|
|
3094
|
+
_source = _foundSourceObj$_sour === void 0 ? {} : _foundSourceObj$_sour,
|
|
3095
|
+
rest = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(foundSourceObj, _excluded$1);
|
|
3096
|
+
sourceObjects.push(_rollupPluginBabelHelpers._extends({}, rest, _source));
|
|
3097
|
+
}
|
|
3098
|
+
});
|
|
3099
|
+
} else {
|
|
3100
|
+
sourceObjects.push.apply(sourceObjects, docIds.map(function (id) {
|
|
3101
|
+
return {
|
|
3102
|
+
_id: id
|
|
3103
|
+
};
|
|
3104
|
+
}));
|
|
3105
|
+
}
|
|
3106
|
+
return sourceObjects;
|
|
3107
|
+
},
|
|
3108
|
+
renderAIScreenFooter: function renderAIScreenFooter() {
|
|
3109
|
+
var _slot2;
|
|
3110
|
+
var _this3 = this;
|
|
3111
|
+
var _ref = this.$props || {},
|
|
3112
|
+
_ref$showSourceDocume = _ref.showSourceDocuments,
|
|
3113
|
+
showSourceDocuments = _ref$showSourceDocume === void 0 ? true : _ref$showSourceDocume,
|
|
3114
|
+
_ref$onSourceClick = _ref.onSourceClick,
|
|
3115
|
+
onSourceClick = _ref$onSourceClick === void 0 ? function () {} : _ref$onSourceClick,
|
|
3116
|
+
renderSourceDocument = _ref.renderSourceDocument;
|
|
3117
|
+
var customRenderSourceDoc = renderSourceDocument || this.$slots.renderSourceDocument;
|
|
3118
|
+
if (this.isLoadingState || this.isAITyping) {
|
|
3119
|
+
return null;
|
|
3120
|
+
}
|
|
3121
|
+
var renderSourceDocumentLabel = function renderSourceDocumentLabel(sourceObj) {
|
|
3122
|
+
if (customRenderSourceDoc) {
|
|
3123
|
+
return customRenderSourceDoc(sourceObj);
|
|
3124
|
+
}
|
|
3125
|
+
return sourceObj._id;
|
|
3126
|
+
};
|
|
3127
|
+
return showSourceDocuments && Array.isArray(this.sourceDocIds) && this.sourceDocIds.length ? vue.createVNode(Footer, {
|
|
3128
|
+
"themePreset": this.$props.themePreset,
|
|
3129
|
+
"style": {
|
|
3130
|
+
marginTop: '1.5rem',
|
|
3131
|
+
background: 'inherit'
|
|
3132
|
+
}
|
|
3133
|
+
}, {
|
|
3134
|
+
"default": function _default() {
|
|
3135
|
+
return [vue.createTextVNode("Summary generated using the following sources:"), ' ', vue.createVNode(SourceTags, null, _isSlot$1(_slot2 = _this3.getAISourceObjects().map(function (el) {
|
|
3136
|
+
var _slot;
|
|
3137
|
+
return vue.createVNode(Button.Button, {
|
|
3138
|
+
"class": "--ai-source-tag " + (helper.getClassName(_this3.$props.innerClass, 'ai-source-tag') || ''),
|
|
3139
|
+
"info": true,
|
|
3140
|
+
"onClick": function onClick() {
|
|
3141
|
+
return onSourceClick && onSourceClick(el);
|
|
3142
|
+
},
|
|
3143
|
+
"key": el._id
|
|
3144
|
+
}, _isSlot$1(_slot = renderSourceDocumentLabel(el)) ? _slot : {
|
|
3145
|
+
"default": function _default() {
|
|
3146
|
+
return [_slot];
|
|
3147
|
+
}
|
|
3148
|
+
});
|
|
3149
|
+
})) ? _slot2 : {
|
|
3150
|
+
"default": function _default() {
|
|
3151
|
+
return [_slot2];
|
|
3152
|
+
}
|
|
3153
|
+
})];
|
|
3154
|
+
}
|
|
3155
|
+
}) : null;
|
|
3156
|
+
},
|
|
3157
|
+
generateNewSessionId: function generateNewSessionId() {
|
|
3158
|
+
var _this4 = this;
|
|
2865
3159
|
var newSessionPromise = this.createAISession();
|
|
2866
3160
|
newSessionPromise.then(function (res) {
|
|
2867
|
-
|
|
3161
|
+
_this4.AISessionId = res.AIsessionId;
|
|
2868
3162
|
})["catch"](function (e) {
|
|
2869
3163
|
console.error(e);
|
|
2870
3164
|
});
|
|
2871
3165
|
},
|
|
2872
3166
|
scrollToBottom: function scrollToBottom() {
|
|
2873
|
-
var
|
|
3167
|
+
var _this5 = this;
|
|
2874
3168
|
this.$nextTick(function () {
|
|
2875
|
-
var
|
|
2876
|
-
var messageContainer = (
|
|
3169
|
+
var _this5$$refs;
|
|
3170
|
+
var messageContainer = (_this5$$refs = _this5.$refs) == null ? void 0 : _this5$$refs[_this5.$props.innerRef];
|
|
2877
3171
|
if (messageContainer && messageContainer.$el) {
|
|
2878
3172
|
messageContainer.$el.scrollTo({
|
|
2879
3173
|
top: messageContainer.$el.scrollHeight,
|
|
@@ -2886,24 +3180,33 @@ var AIAnswer = vue.defineComponent({
|
|
|
2886
3180
|
this.inputMessage = e.target.value;
|
|
2887
3181
|
this.handleTextAreaHeightChange();
|
|
2888
3182
|
},
|
|
2889
|
-
handleSendMessage: function handleSendMessage(e, isRetry, text) {
|
|
3183
|
+
handleSendMessage: function handleSendMessage(e, isRetry, text, fetchMeta) {
|
|
2890
3184
|
if (isRetry === void 0) {
|
|
2891
3185
|
isRetry = false;
|
|
2892
3186
|
}
|
|
2893
3187
|
if (text === void 0) {
|
|
2894
3188
|
text = this.inputMessage;
|
|
2895
3189
|
}
|
|
3190
|
+
if (fetchMeta === void 0) {
|
|
3191
|
+
fetchMeta = false;
|
|
3192
|
+
}
|
|
2896
3193
|
if (typeof e === 'object' && e !== null) e.preventDefault();
|
|
2897
|
-
if (text.trim()) {
|
|
3194
|
+
if (text.trim() || !text && !e) {
|
|
2898
3195
|
if (this.isLoadingState) {
|
|
2899
3196
|
return;
|
|
2900
3197
|
}
|
|
2901
3198
|
if (this.AISessionId) {
|
|
2902
|
-
if (!isRetry)
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
3199
|
+
if (!isRetry) {
|
|
3200
|
+
var finalMessages = [].concat(this.messages);
|
|
3201
|
+
if (text) {
|
|
3202
|
+
finalMessages.push({
|
|
3203
|
+
content: text,
|
|
3204
|
+
role: constants.AI_ROLES.USER
|
|
3205
|
+
});
|
|
3206
|
+
}
|
|
3207
|
+
this.messages = [].concat(finalMessages);
|
|
3208
|
+
}
|
|
3209
|
+
this.getAIResponse(this.AISessionId, this.componentId, text, fetchMeta);
|
|
2907
3210
|
} else {
|
|
2908
3211
|
console.error(this.errorMessageForMissingSessionId);
|
|
2909
3212
|
this.error = {
|
|
@@ -2952,7 +3255,6 @@ var AIAnswer = vue.defineComponent({
|
|
|
2952
3255
|
return null;
|
|
2953
3256
|
},
|
|
2954
3257
|
handleKeyPress: function handleKeyPress(e) {
|
|
2955
|
-
window.console.log('e', e);
|
|
2956
3258
|
if (e.key === 'Enter') {
|
|
2957
3259
|
this.handleSendMessage(e);
|
|
2958
3260
|
this.inputMessage = '';
|
|
@@ -2984,15 +3286,15 @@ var AIAnswer = vue.defineComponent({
|
|
|
2984
3286
|
if (typeof window === 'undefined') return false;
|
|
2985
3287
|
return showVoiceSearch && (window.webkitSpeechRecognition || window.SpeechRecognition);
|
|
2986
3288
|
},
|
|
2987
|
-
handleVoiceResults: function handleVoiceResults(
|
|
2988
|
-
var results =
|
|
3289
|
+
handleVoiceResults: function handleVoiceResults(_ref2) {
|
|
3290
|
+
var results = _ref2.results;
|
|
2989
3291
|
if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
|
|
2990
3292
|
this.handleSendMessage(null, false, results[0][0].transcript.trim());
|
|
2991
3293
|
}
|
|
2992
3294
|
},
|
|
2993
3295
|
renderIcons: function renderIcons() {
|
|
2994
|
-
var
|
|
2995
|
-
var
|
|
3296
|
+
var _this6 = this;
|
|
3297
|
+
var _slot3, _slot4;
|
|
2996
3298
|
var _this$$props = this.$props,
|
|
2997
3299
|
getMicInstance = _this$$props.getMicInstance,
|
|
2998
3300
|
showVoiceInput = _this$$props.showVoiceInput,
|
|
@@ -3005,14 +3307,14 @@ var AIAnswer = vue.defineComponent({
|
|
|
3005
3307
|
"positionType": "absolute"
|
|
3006
3308
|
}, {
|
|
3007
3309
|
"default": function _default() {
|
|
3008
|
-
return [!
|
|
3310
|
+
return [!_this6.isLoadingState && _this6.AISessionId && _this6.shouldMicRender(showVoiceInput) && vue.createVNode(Mic, {
|
|
3009
3311
|
"getInstance": getMicInstance,
|
|
3010
3312
|
"render": renderMic,
|
|
3011
|
-
"handleResult":
|
|
3313
|
+
"handleResult": _this6.handleVoiceResults,
|
|
3012
3314
|
"class": helper.getClassName(innerClass, 'ai-search-mic') || null
|
|
3013
|
-
}, null), iconPosition === 'right' && vue.createVNode(DropDown.IconWrapper, null, _isSlot$1(
|
|
3315
|
+
}, null), iconPosition === 'right' && vue.createVNode(DropDown.IconWrapper, null, _isSlot$1(_slot3 = _this6.renderIcon()) ? _slot3 : {
|
|
3014
3316
|
"default": function _default() {
|
|
3015
|
-
return [
|
|
3317
|
+
return [_slot3];
|
|
3016
3318
|
}
|
|
3017
3319
|
})];
|
|
3018
3320
|
}
|
|
@@ -3022,9 +3324,9 @@ var AIAnswer = vue.defineComponent({
|
|
|
3022
3324
|
"positionType": "absolute"
|
|
3023
3325
|
}, {
|
|
3024
3326
|
"default": function _default() {
|
|
3025
|
-
return [iconPosition === 'left' && vue.createVNode(DropDown.IconWrapper, null, _isSlot$1(
|
|
3327
|
+
return [iconPosition === 'left' && vue.createVNode(DropDown.IconWrapper, null, _isSlot$1(_slot4 = _this6.renderIcon()) ? _slot4 : {
|
|
3026
3328
|
"default": function _default() {
|
|
3027
|
-
return [
|
|
3329
|
+
return [_slot4];
|
|
3028
3330
|
}
|
|
3029
3331
|
})];
|
|
3030
3332
|
}
|
|
@@ -3034,7 +3336,7 @@ var AIAnswer = vue.defineComponent({
|
|
|
3034
3336
|
this.handleSendMessage(e);
|
|
3035
3337
|
},
|
|
3036
3338
|
renderEnterButtonElement: function renderEnterButtonElement() {
|
|
3037
|
-
var
|
|
3339
|
+
var _this7 = this;
|
|
3038
3340
|
var _this$$props2 = this.$props,
|
|
3039
3341
|
enterButton = _this$$props2.enterButton,
|
|
3040
3342
|
innerClass = _this$$props2.innerClass;
|
|
@@ -3042,16 +3344,16 @@ var AIAnswer = vue.defineComponent({
|
|
|
3042
3344
|
if (enterButton) {
|
|
3043
3345
|
var getEnterButtonMarkup = function getEnterButtonMarkup() {
|
|
3044
3346
|
if (renderEnterButton) {
|
|
3045
|
-
return renderEnterButton(
|
|
3347
|
+
return renderEnterButton(_this7.enterButtonOnClick);
|
|
3046
3348
|
}
|
|
3047
3349
|
return vue.createVNode(SendButton, {
|
|
3048
3350
|
"primary": true,
|
|
3049
3351
|
"type": "submit",
|
|
3050
3352
|
"tabIndex": 0,
|
|
3051
|
-
"onClick":
|
|
3052
|
-
"onKeyPress":
|
|
3353
|
+
"onClick": _this7.handleSendMessage,
|
|
3354
|
+
"onKeyPress": _this7.handleKeyPress,
|
|
3053
3355
|
"class": "ask-btn " + helper.getClassName(innerClass, 'ai-enter-button'),
|
|
3054
|
-
"disabled":
|
|
3356
|
+
"disabled": _this7.isLoadingState || !_this7.AISessionId
|
|
3055
3357
|
}, {
|
|
3056
3358
|
"default": function _default() {
|
|
3057
3359
|
return [vue.createTextVNode("Send")];
|
|
@@ -3074,9 +3376,9 @@ var AIAnswer = vue.defineComponent({
|
|
|
3074
3376
|
return index.getComponent(data, this);
|
|
3075
3377
|
},
|
|
3076
3378
|
handleTextAreaHeightChange: function handleTextAreaHeightChange() {
|
|
3077
|
-
var _this$$refs, _this$$
|
|
3078
|
-
var textArea = (_this$$refs = this.$refs) == null
|
|
3079
|
-
var inputWrapper = (_this$$refs2 = this.$refs) == null
|
|
3379
|
+
var _this$$refs, _this$$refs2, _this$$refs3;
|
|
3380
|
+
var textArea = (_this$$refs = this.$refs) == null || (_this$$refs = _this$$refs[_inputRef]) == null ? void 0 : _this$$refs.$el;
|
|
3381
|
+
var inputWrapper = (_this$$refs2 = this.$refs) == null || (_this$$refs2 = _this$$refs2[_inputWrapperRef]) == null ? void 0 : _this$$refs2.$el;
|
|
3080
3382
|
var errorContainer = (_this$$refs3 = this.$refs) == null ? void 0 : _this$$refs3[_errorContainerRef];
|
|
3081
3383
|
if (textArea) {
|
|
3082
3384
|
textArea.style.height = '42px';
|
|
@@ -3094,6 +3396,20 @@ var AIAnswer = vue.defineComponent({
|
|
|
3094
3396
|
}
|
|
3095
3397
|
this.$forceUpdate();
|
|
3096
3398
|
}
|
|
3399
|
+
},
|
|
3400
|
+
getTitle: function getTitle() {
|
|
3401
|
+
var _this8 = this;
|
|
3402
|
+
var hasTitle = this.$props.title || this.$slots.title || null;
|
|
3403
|
+
if (hasTitle) {
|
|
3404
|
+
return vue.createVNode(Title.Title, {
|
|
3405
|
+
"class": helper.getClassName(this.$props.innerClass, 'ai-title') || null
|
|
3406
|
+
}, {
|
|
3407
|
+
"default": function _default() {
|
|
3408
|
+
return [_this8.$props.title || _this8.$slots.title()];
|
|
3409
|
+
}
|
|
3410
|
+
});
|
|
3411
|
+
}
|
|
3412
|
+
return null;
|
|
3097
3413
|
}
|
|
3098
3414
|
},
|
|
3099
3415
|
beforeUnmount: function beforeUnmount() {
|
|
@@ -3108,55 +3424,62 @@ var AIAnswer = vue.defineComponent({
|
|
|
3108
3424
|
}
|
|
3109
3425
|
},
|
|
3110
3426
|
render: function render() {
|
|
3111
|
-
var
|
|
3112
|
-
var
|
|
3427
|
+
var _slot5;
|
|
3428
|
+
var _this9 = this;
|
|
3113
3429
|
var props = this.$props;
|
|
3114
3430
|
if (!this.shouldShowComponent) {
|
|
3115
3431
|
return null;
|
|
3116
3432
|
}
|
|
3433
|
+
if (!this.isTriggered) {
|
|
3434
|
+
return vue.createVNode(Chatbox, {
|
|
3435
|
+
"style": props.style || {}
|
|
3436
|
+
}, {
|
|
3437
|
+
"default": function _default() {
|
|
3438
|
+
return [_this9.getTitle(), vue.createVNode("div", {
|
|
3439
|
+
"class": "--trigger-message-wrapper",
|
|
3440
|
+
"onClick": _this9.handleTriggerClick,
|
|
3441
|
+
"aria-hidden": "true"
|
|
3442
|
+
}, [_this9.renderTriggerMessageFunc()])];
|
|
3443
|
+
}
|
|
3444
|
+
});
|
|
3445
|
+
}
|
|
3117
3446
|
return vue.createVNode(Chatbox, {
|
|
3118
3447
|
"style": props.style || {}
|
|
3119
3448
|
}, {
|
|
3120
3449
|
"default": function _default() {
|
|
3121
|
-
return [
|
|
3122
|
-
"class": helper.getClassName(_this6.$props.innerClass, 'title') || ''
|
|
3123
|
-
}, {
|
|
3124
|
-
"default": function _default() {
|
|
3125
|
-
return [_this6.$props.title];
|
|
3126
|
-
}
|
|
3127
|
-
}), vue.createVNode(ChatContainer, {
|
|
3450
|
+
return [_this9.getTitle(), vue.createVNode(ChatContainer, {
|
|
3128
3451
|
"class": "--ai-chat-container",
|
|
3129
3452
|
"theme": props.theme,
|
|
3130
3453
|
"showInput": props.showInput
|
|
3131
3454
|
}, {
|
|
3132
3455
|
"default": function _default() {
|
|
3133
|
-
return [
|
|
3134
|
-
"themePreset":
|
|
3456
|
+
return [_this9.hasCustomRenderer && vue.createVNode(MessagesContainer, {
|
|
3457
|
+
"themePreset": _this9.themePreset,
|
|
3135
3458
|
"theme": props.theme,
|
|
3136
|
-
"ref":
|
|
3459
|
+
"ref": _this9.$props.innerRef,
|
|
3137
3460
|
"class": "--ai-message-container " + (helper.getClassName(props.innerClass, 'ai-message-container') || '')
|
|
3138
|
-
}, _isSlot$1(
|
|
3461
|
+
}, _isSlot$1(_slot5 = _this9.getComponent()) ? _slot5 : {
|
|
3139
3462
|
"default": function _default() {
|
|
3140
|
-
return [
|
|
3463
|
+
return [_slot5];
|
|
3141
3464
|
}
|
|
3142
|
-
}), !
|
|
3143
|
-
"themePreset":
|
|
3465
|
+
}), !_this9.hasCustomRenderer && vue.createVNode(MessagesContainer, {
|
|
3466
|
+
"themePreset": _this9.themePreset,
|
|
3144
3467
|
"theme": props.theme,
|
|
3145
|
-
"ref":
|
|
3468
|
+
"ref": _this9.$props.innerRef,
|
|
3146
3469
|
"class": "--ai-message-container " + (helper.getClassName(props.innerClass, 'ai-message-container') || '')
|
|
3147
3470
|
}, {
|
|
3148
3471
|
"default": function _default() {
|
|
3149
|
-
return [
|
|
3472
|
+
return [_this9.messages.map(function (message, index) {
|
|
3150
3473
|
return vue.createVNode(Message, {
|
|
3151
3474
|
"key": index,
|
|
3152
3475
|
"isSender": message.role === constants.AI_ROLES.USER,
|
|
3153
3476
|
"innerHTML": md$1.render(message.content),
|
|
3154
|
-
"themePreset":
|
|
3477
|
+
"themePreset": _this9.themePreset,
|
|
3155
3478
|
"theme": props.theme,
|
|
3156
3479
|
"class": "--ai-answer-message " + (helper.getClassName(props.innerClass, 'ai-message') || '')
|
|
3157
3480
|
}, null);
|
|
3158
|
-
}),
|
|
3159
|
-
"themePreset":
|
|
3481
|
+
}), _this9.isLoadingState && vue.createVNode(Message, {
|
|
3482
|
+
"themePreset": _this9.themePreset,
|
|
3160
3483
|
"theme": props.theme,
|
|
3161
3484
|
"isSender": false,
|
|
3162
3485
|
"class": "--ai-answer-message " + (helper.getClassName(props.innerClass, 'ai-message') || null)
|
|
@@ -3165,31 +3488,31 @@ var AIAnswer = vue.defineComponent({
|
|
|
3165
3488
|
return [vue.createVNode(TypingIndicator, null, {
|
|
3166
3489
|
"default": function _default() {
|
|
3167
3490
|
return [vue.createVNode(TypingDot, {
|
|
3168
|
-
"themePreset":
|
|
3491
|
+
"themePreset": _this9.themePreset
|
|
3169
3492
|
}, null), vue.createVNode(TypingDot, {
|
|
3170
|
-
"themePreset":
|
|
3493
|
+
"themePreset": _this9.themePreset
|
|
3171
3494
|
}, null), vue.createVNode(TypingDot, {
|
|
3172
|
-
"themePreset":
|
|
3495
|
+
"themePreset": _this9.themePreset
|
|
3173
3496
|
}, null)];
|
|
3174
3497
|
}
|
|
3175
3498
|
})];
|
|
3176
3499
|
}
|
|
3177
3500
|
})];
|
|
3178
3501
|
}
|
|
3179
|
-
}),
|
|
3502
|
+
}), _this9.renderErrorComponent(), ' ', props.showFeedback && !_this9.isLoadingState && !_this9.isAITyping && vue.createVNode("div", {
|
|
3180
3503
|
"class": "--ai-answer-feedback-container " + (helper.getClassName(props.innerClass, 'ai-feedback') || '')
|
|
3181
3504
|
}, [vue.createVNode(AIFeedback, {
|
|
3182
|
-
"hideUI":
|
|
3183
|
-
"key":
|
|
3505
|
+
"hideUI": _this9.isLoadingState || !_this9.sessionId,
|
|
3506
|
+
"key": _this9.sessionId,
|
|
3184
3507
|
"onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
|
|
3185
|
-
|
|
3508
|
+
_this9.trackUsefullness(_this9.sessionId, {
|
|
3186
3509
|
useful: useful,
|
|
3187
3510
|
reason: reason
|
|
3188
3511
|
});
|
|
3189
3512
|
}
|
|
3190
|
-
}, null)]), props.showInput && vue.createVNode(MessageInputContainer, {
|
|
3513
|
+
}, null)]), ' ', _this9.renderAIScreenFooter(), props.showInput && !_this9.isLoadingState && !_this9.isAITyping && vue.createVNode(MessageInputContainer, {
|
|
3191
3514
|
"class": "--ai-input-container",
|
|
3192
|
-
"onSubmit":
|
|
3515
|
+
"onSubmit": _this9.handleSendMessage
|
|
3193
3516
|
}, {
|
|
3194
3517
|
"default": function _default() {
|
|
3195
3518
|
return [vue.createVNode(InputGroup, {
|
|
@@ -3205,19 +3528,19 @@ var AIAnswer = vue.defineComponent({
|
|
|
3205
3528
|
"ref": _inputRef,
|
|
3206
3529
|
"placeholder": props.placeholder,
|
|
3207
3530
|
"enterButton": props.enterButton,
|
|
3208
|
-
"value":
|
|
3209
|
-
"onInput":
|
|
3531
|
+
"value": _this9.inputMessage,
|
|
3532
|
+
"onInput": _this9.handleMessageInputChange,
|
|
3210
3533
|
"id": props.componentId + "-ai-input",
|
|
3211
3534
|
"showIcon": props.showIcon,
|
|
3212
3535
|
"iconPosition": props.iconPosition,
|
|
3213
|
-
"themePreset":
|
|
3214
|
-
"disabled":
|
|
3536
|
+
"themePreset": _this9.themePreset,
|
|
3537
|
+
"disabled": _this9.isLoadingState || !_this9.AISessionId,
|
|
3215
3538
|
"class": helper.getClassName(props.innerClass, 'ai-input') || null
|
|
3216
|
-
}, null), ' ',
|
|
3539
|
+
}, null), ' ', _this9.renderIcons()];
|
|
3217
3540
|
}
|
|
3218
3541
|
})];
|
|
3219
3542
|
}
|
|
3220
|
-
}),
|
|
3543
|
+
}), _this9.renderEnterButtonElement()];
|
|
3221
3544
|
}
|
|
3222
3545
|
}), ' '];
|
|
3223
3546
|
}
|
|
@@ -3235,9 +3558,11 @@ var mapStateToProps$1 = function mapStateToProps(state, props) {
|
|
|
3235
3558
|
// eslint-disable-next-line prefer-destructuring
|
|
3236
3559
|
dependencyComponent = dependencyComponent[0];
|
|
3237
3560
|
}
|
|
3238
|
-
var showComponent = state.selectedValues[dependencyComponent] && state.selectedValues[dependencyComponent].value;
|
|
3561
|
+
var showComponent = !!(state.selectedValues[dependencyComponent] && state.selectedValues[dependencyComponent].value);
|
|
3562
|
+
var dependentComponentValue = state.selectedValues[dependencyComponent] && state.selectedValues[dependencyComponent].value || '';
|
|
3239
3563
|
return {
|
|
3240
3564
|
showComponent: showComponent,
|
|
3565
|
+
dependentComponentValue: dependentComponentValue,
|
|
3241
3566
|
AIResponse: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response,
|
|
3242
3567
|
isAIResponseLoading: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].isLoading,
|
|
3243
3568
|
AIResponseError: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].error,
|
|
@@ -3245,11 +3570,17 @@ var mapStateToProps$1 = function mapStateToProps(state, props) {
|
|
|
3245
3570
|
themePreset: state.config.themePreset,
|
|
3246
3571
|
isLoading: state.isLoading[props.componentId] || false,
|
|
3247
3572
|
sessionIdFromStore: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.sessionId || '',
|
|
3248
|
-
componentError: state.error[props.componentId]
|
|
3573
|
+
componentError: state.error[props.componentId] || null,
|
|
3574
|
+
isAITyping: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.isTyping || false
|
|
3249
3575
|
};
|
|
3250
3576
|
};
|
|
3251
3577
|
var mapDispatchToProps$1 = {
|
|
3252
|
-
getAIResponse:
|
|
3578
|
+
getAIResponse: function getAIResponse(sessionId, componentId, message, shouldFetchMeta) {
|
|
3579
|
+
if (shouldFetchMeta === void 0) {
|
|
3580
|
+
shouldFetchMeta = false;
|
|
3581
|
+
}
|
|
3582
|
+
return query.fetchAIResponse(sessionId, componentId, message, null, shouldFetchMeta);
|
|
3583
|
+
},
|
|
3253
3584
|
trackUsefullness: analytics.recordAISessionUsefulness,
|
|
3254
3585
|
createAISession: query.createAISession
|
|
3255
3586
|
};
|