@appbaseio/reactivesearch-vue 3.0.0-rc → 3.0.0-rc.2
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 +6349 -518
- 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-2dc930e1.js → ComponentWrapper-0b9ffb1a.js} +4 -1
- package/dist/cjs/{DropDown-f48bea16.js → DropDown-3797bb6a.js} +2 -2
- package/dist/cjs/DynamicRangeSlider.js +3 -3
- package/dist/cjs/MultiDropdownList.js +5 -5
- package/dist/cjs/MultiList.js +4 -4
- package/dist/cjs/MultiRange.js +4 -4
- package/dist/cjs/{Pagination-b953a80a.js → Pagination-b1a053a7.js} +1 -1
- package/dist/cjs/{PreferencesConsumer-2c69ac61.js → PreferencesConsumer-85dee673.js} +1 -1
- package/dist/cjs/RangeInput.js +4 -4
- package/dist/cjs/RangeSlider.js +4 -4
- package/dist/cjs/ReactiveBase.js +5 -5
- package/dist/cjs/ReactiveComponent.js +4 -4
- package/dist/cjs/ReactiveGoogleMap.js +5 -5
- package/dist/cjs/ReactiveList.js +5 -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 +5 -5
- package/dist/cjs/SingleList.js +4 -4
- package/dist/cjs/SingleRange.js +4 -4
- package/dist/cjs/StateProvider.js +1 -1
- package/dist/cjs/ToggleButton.js +4 -4
- package/dist/cjs/{index-1481798c.js → index-779ed366.js} +2 -4
- package/dist/cjs/index.js +10 -7
- package/dist/cjs/{install-2c548585.js → install-581d2e18.js} +588 -18
- package/dist/cjs/install.js +9 -7
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/{vueTypes-1bf00978.js → vueTypes-d05e44cc.js} +8 -0
- package/dist/es/{ComponentWrapper-3a215eed.js → ComponentWrapper-a2635cfc.js} +4 -1
- package/dist/es/{DropDown-7174661a.js → DropDown-ff8e06b4.js} +2 -2
- package/dist/es/DynamicRangeSlider.js +3 -3
- package/dist/es/MultiDropdownList.js +5 -5
- package/dist/es/MultiList.js +4 -4
- package/dist/es/MultiRange.js +4 -4
- package/dist/es/{Pagination-c2745bec.js → Pagination-aecb3914.js} +1 -1
- package/dist/es/{PreferencesConsumer-24e88f3b.js → PreferencesConsumer-b058d14e.js} +1 -1
- package/dist/es/RangeInput.js +4 -4
- package/dist/es/RangeSlider.js +4 -4
- package/dist/es/ReactiveBase.js +5 -5
- package/dist/es/ReactiveComponent.js +4 -4
- package/dist/es/ReactiveGoogleMap.js +5 -5
- package/dist/es/ReactiveList.js +5 -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 +5 -5
- package/dist/es/SingleList.js +4 -4
- package/dist/es/SingleRange.js +4 -4
- package/dist/es/StateProvider.js +1 -1
- package/dist/es/ToggleButton.js +4 -4
- package/dist/es/{index-4520a598.js → index-882489e1.js} +2 -4
- package/dist/es/index.js +10 -8
- package/dist/es/{install-44a07e7a.js → install-3c029475.js} +591 -22
- package/dist/es/install.js +9 -7
- package/dist/es/version.js +1 -1
- package/dist/es/{vueTypes-f1923c72.js → vueTypes-d64f04f8.js} +8 -0
- package/package.json +4 -4
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
import { helper, Actions, causes } from '@appbaseio/reactivecore';
|
|
2
|
-
import { SEARCH_COMPONENTS_MODES, componentTypes, TREELIST_VALUES_PATH_SEPARATOR } from '@appbaseio/reactivecore/lib/utils/constants';
|
|
2
|
+
import { SEARCH_COMPONENTS_MODES, componentTypes, AI_LOCAL_CACHE_KEY, AI_ROLES, TREELIST_VALUES_PATH_SEPARATOR } from '@appbaseio/reactivecore/lib/utils/constants';
|
|
3
3
|
import _transformOn from '@vue/babel-helper-vue-transform-on';
|
|
4
4
|
import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-ded08042.js';
|
|
5
5
|
import { createVNode, createTextVNode, defineComponent, isVNode, mergeProps, h } from 'vue';
|
|
6
6
|
import VueTypes from 'vue-types';
|
|
7
|
-
import { getQueryOptions, suggestionTypes,
|
|
7
|
+
import { getQueryOptions, suggestionTypes, getObjectFromLocalStorage, getClassName as getClassName$2, setObjectInLocalStorage, recLookup, updateCustomQuery as updateCustomQuery$1, updateDefaultQuery as updateDefaultQuery$1, transformTreeListLocalStateIntoQueryComptaibleFormat, isEqual as isEqual$1, transformRawTreeListData, setDeep, getComponent as getComponent$1, getOptionsFromQuery, checkValueChange as checkValueChange$1, getAggsQuery, updateInternalQuery, isFunction as isFunction$1 } from '@appbaseio/reactivecore/lib/utils/helper';
|
|
8
8
|
import { styled, createGlobalStyle } from '@appbaseio/vue-emotion';
|
|
9
|
-
import { css } from '@emotion/css';
|
|
9
|
+
import { css, keyframes } from '@emotion/css';
|
|
10
|
+
import { lighten } from 'polished';
|
|
10
11
|
import { B as Button } from './Button-fd869491.js';
|
|
11
|
-
import { t as types } from './vueTypes-
|
|
12
|
+
import { t as types } from './vueTypes-d64f04f8.js';
|
|
12
13
|
import { RLConnected as ReactiveList } from './ReactiveList.js';
|
|
13
14
|
import { getInternalComponentID } from '@appbaseio/reactivecore/lib/utils/transform';
|
|
14
|
-
import { g as getComponent, h as hasCustomRenderer, f as decodeHtml, i as isQueryIdentical, u as updateDefaultQuery, j as updateCustomQuery, a as isFunction, k as isEmpty, p as parseFocusShortcuts, l as extractModifierKeysFromFocusShortcuts, c as connect } from './index-
|
|
15
|
-
import { C as ComponentWrapper } from './ComponentWrapper-
|
|
16
|
-
import { P as PreferencesConsumer } from './PreferencesConsumer-
|
|
15
|
+
import { g as getComponent, h as hasCustomRenderer, f as decodeHtml, i as isQueryIdentical, u as updateDefaultQuery, j as updateCustomQuery, a as isFunction, k as isEmpty, p as parseFocusShortcuts, l as extractModifierKeysFromFocusShortcuts, c as connect } from './index-882489e1.js';
|
|
16
|
+
import { C as ComponentWrapper } from './ComponentWrapper-a2635cfc.js';
|
|
17
|
+
import { P as PreferencesConsumer } from './PreferencesConsumer-b058d14e.js';
|
|
17
18
|
import { T as Title } from './Title-863dfa42.js';
|
|
18
19
|
import { L as ListItem } from './ListItem-e3c6acf4.js';
|
|
19
20
|
import { F as Flex } from './Flex-25792bc3.js';
|
|
20
21
|
import ReactiveBase from './ReactiveBase.js';
|
|
21
22
|
import hotkeys from 'hotkeys-js';
|
|
22
|
-
import { I as IconWrapper, C as CancelSvg, a as IconGroup, D as Downshift, b as InputWrapper } from './DropDown-
|
|
23
|
+
import { I as IconWrapper, C as CancelSvg, a as IconGroup, D as Downshift, b as InputWrapper } from './DropDown-ff8e06b4.js';
|
|
23
24
|
import { n as noSuggestions, s as suggestionsContainer, I as Input, a as suggestions } from './Input-f7499ef8.js';
|
|
24
25
|
import { C as Container } from './Container-d00219f7.js';
|
|
25
26
|
import Highlight from 'vue-highlight-words';
|
|
27
|
+
import { fetchAIResponse } from '@appbaseio/reactivecore/lib/actions/query';
|
|
28
|
+
import { Remarkable } from 'remarkable';
|
|
26
29
|
import { replaceDiacritics } from '@appbaseio/reactivecore/lib/utils/suggestions';
|
|
27
30
|
import { C as Checkbox, R as Radio } from './FormControlList-fe6eaee4.js';
|
|
28
31
|
import { s as sanitizeObject } from './utils-d7dd4f4e.js';
|
|
@@ -1223,8 +1226,8 @@ var SearchBox = defineComponent({
|
|
|
1223
1226
|
this.recordSuggestionClick(searchPosition, docId);
|
|
1224
1227
|
},
|
|
1225
1228
|
clearValue: function clearValue() {
|
|
1226
|
-
this.setValue('', false, this.$props, causes.CLEAR_VALUE, false);
|
|
1227
|
-
this.onValueSelectedHandler('', causes.CLEAR_VALUE);
|
|
1229
|
+
this.setValue('', false, this.$props, !this.$options.isTagsMode ? causes.CLEAR_VALUE : undefined, false);
|
|
1230
|
+
this.onValueSelectedHandler('', !this.$options.isTagsMode ? causes.CLEAR_VALUE : undefined);
|
|
1228
1231
|
},
|
|
1229
1232
|
handleKeyDown: function handleKeyDown(event, highlightedIndex) {
|
|
1230
1233
|
if (highlightedIndex === void 0) {
|
|
@@ -1254,7 +1257,7 @@ var SearchBox = defineComponent({
|
|
|
1254
1257
|
}
|
|
1255
1258
|
var value = this.$props.value;
|
|
1256
1259
|
if (value === undefined) {
|
|
1257
|
-
this.setValue(inputValue, false, this.$props,
|
|
1260
|
+
this.setValue(inputValue, false, this.$props, undefined);
|
|
1258
1261
|
} else {
|
|
1259
1262
|
this.$emit('change', inputValue, function (_ref3) {
|
|
1260
1263
|
var isOpen = _ref3.isOpen;
|
|
@@ -1862,9 +1865,575 @@ SBConnected.install = function (Vue) {
|
|
|
1862
1865
|
// Add componentType for SSR
|
|
1863
1866
|
SBConnected.componentType = componentTypes.searchBox;
|
|
1864
1867
|
|
|
1865
|
-
var _templateObject$8, _templateObject2$1;
|
|
1866
|
-
var
|
|
1867
|
-
|
|
1868
|
+
var _templateObject$8, _templateObject2$1, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
1869
|
+
var Chatbox = styled('div')(_templateObject$8 || (_templateObject$8 = _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) {
|
|
1870
|
+
return props.theme && props.theme.colors ? props.theme.colors.backgroundColor : '#fff';
|
|
1871
|
+
});
|
|
1872
|
+
var ChatContainer = styled('div')(_templateObject2$1 || (_templateObject2$1 = _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"])), function (props) {
|
|
1873
|
+
return props.showInput ? 'bottom: 48px;' : '';
|
|
1874
|
+
}, function (props) {
|
|
1875
|
+
return props.theme && props.theme.colors && props.theme.colors.backgroundColor ? props.theme.colors.backgroundColor : '#fff';
|
|
1876
|
+
}, function (props) {
|
|
1877
|
+
return props.theme && props.theme.colors && props.theme.colors.backgroundColor ? props.theme.colors.backgroundColor : '#fff';
|
|
1878
|
+
});
|
|
1879
|
+
var MessagesContainer = styled('div')(_templateObject3 || (_templateObject3 = _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"])));
|
|
1880
|
+
var typingDots = keyframes(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n 0% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(-70%);\n }\n 100% {\n transform: translateY(0);\n }\n"])));
|
|
1881
|
+
var TypingIndicator = styled('div')(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tmargin: 5px !important;\n"])));
|
|
1882
|
+
var TypingDot = styled('div')(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n\twidth: 6px;\n\theight: 6px;\n\tbackground-color: ", ";\n\tborder-radius: 50%;\n\tmargin: 0 2px !important;\n\tanimation: ", " 1s infinite;\n\t&:nth-child(2) {\n\t\tanimation-delay: 0.2s;\n\t}\n\t&:nth-child(3) {\n\t\tanimation-delay: 0.4s;\n\t}\n"])), function (props) {
|
|
1883
|
+
var finalColor;
|
|
1884
|
+
if (props.isSender) {
|
|
1885
|
+
finalColor = props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor;
|
|
1886
|
+
} else {
|
|
1887
|
+
finalColor = props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor;
|
|
1888
|
+
}
|
|
1889
|
+
return finalColor;
|
|
1890
|
+
}, typingDots);
|
|
1891
|
+
var resetCSS = function resetCSS(props) {
|
|
1892
|
+
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: " + (
|
|
1893
|
+
// eslint-disable-next-line no-nested-ternary
|
|
1894
|
+
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: " + function (colorProps) {
|
|
1895
|
+
return (
|
|
1896
|
+
// eslint-disable-next-line no-nested-ternary
|
|
1897
|
+
colorProps.isSender ? colorProps.themePreset !== 'dark' ? colorProps.theme.colors.primaryTextColor : colorProps.theme.colors.textColor : colorProps.theme.colors.primaryTextColor
|
|
1898
|
+
);
|
|
1899
|
+
} + ";\n\t\tborder-radius: 3px;\n\t\tfont-size: 85%;\n\t\tpadding: 0.2em 0.4em;\n\t\tmargin: 5px 0;\n\t\tdisplay: inline-block;\n\t\toverflow: auto;\n\t\twidth: 100%;\n\t}\n\tul,\n\tol {\n\t\tlist-style-position: inside;\n\t}\n";
|
|
1900
|
+
};
|
|
1901
|
+
var messageBGColor = function messageBGColor(props) {
|
|
1902
|
+
var finalBGColor;
|
|
1903
|
+
if (props.isSender) {
|
|
1904
|
+
finalBGColor = props.themePreset !== 'dark' ? props.theme.colors.primaryColor : props.theme.colors.borderColor;
|
|
1905
|
+
} else {
|
|
1906
|
+
finalBGColor = props.themePreset !== 'dark' ? lighten(0.25, props.theme.colors.borderColor) : props.theme.colors.backgroundColor;
|
|
1907
|
+
}
|
|
1908
|
+
return finalBGColor;
|
|
1909
|
+
};
|
|
1910
|
+
var Message = styled('div')(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n\tbackground-color: ", ";\n\tcolor: ", ";\n\tborder: 1px solid\n\t\t", ";\n\tpadding: 10px;\n\tborder-radius: 7px;\n\tmargin-bottom: 10px;\n\tmax-width: 80%;\n\talign-self: ", ";\n\tdisplay: inline-block;\n\tposition: relative;\n\toverflow-wrap: anywhere;\n\t", "\n"])), function (props) {
|
|
1911
|
+
return messageBGColor(props);
|
|
1912
|
+
}, function (props) {
|
|
1913
|
+
var finalColor;
|
|
1914
|
+
if (props.isSender) {
|
|
1915
|
+
finalColor = props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor;
|
|
1916
|
+
} else {
|
|
1917
|
+
finalColor = props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor;
|
|
1918
|
+
}
|
|
1919
|
+
return finalColor;
|
|
1920
|
+
}, function (props) {
|
|
1921
|
+
return props.themePreset === 'dark' ? 'currentColor' : messageBGColor(props);
|
|
1922
|
+
}, function (props) {
|
|
1923
|
+
return props.isSender ? 'flex-end' : 'flex-start';
|
|
1924
|
+
}, function (props) {
|
|
1925
|
+
return resetCSS(props);
|
|
1926
|
+
});
|
|
1927
|
+
var MessageInputContainer = styled('form')(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tpadding-top: 12px;\n\talign-items: stretch;\n\tmargin-top: 10px;\n"])));
|
|
1928
|
+
var MessageInput = styled(Input)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tborder-radius: 5px;\n\tborder: 1px solid #ccc;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\n\t::placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t:-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t::-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n"])), function (props) {
|
|
1929
|
+
return props.themePreset === 'dark' ? props.theme.colors.borderColor : '#fff';
|
|
1930
|
+
}, function (props) {
|
|
1931
|
+
return props.themePreset === 'dark' ? props.theme.colors.titleColor : props.theme.colors.textColor;
|
|
1932
|
+
}, function (props) {
|
|
1933
|
+
return props.theme.colors.textColor;
|
|
1934
|
+
}, function (props) {
|
|
1935
|
+
return props.theme.colors.textColor;
|
|
1936
|
+
}, function (props) {
|
|
1937
|
+
return props.theme.colors.textColor;
|
|
1938
|
+
});
|
|
1939
|
+
var SendButton = styled(Button)(_templateObject10 || (_templateObject10 = _taggedTemplateLiteralLoose(["\n\tborder: none;\n\tcolor: #ffffff;\n\tcursor: pointer;\n\tfont-size: 16px;\n\tmargin-left: 8px;\n\toutline: none;\n\tpadding: 10px;\n\ttext-align: center;\n"])));
|
|
1940
|
+
|
|
1941
|
+
function _isSlot$1(s) {
|
|
1942
|
+
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
1943
|
+
}
|
|
1944
|
+
var md = new Remarkable();
|
|
1945
|
+
md.set({
|
|
1946
|
+
html: true,
|
|
1947
|
+
breaks: true,
|
|
1948
|
+
xhtmlOut: true
|
|
1949
|
+
});
|
|
1950
|
+
var AIAnswer = defineComponent({
|
|
1951
|
+
name: 'AIAnswer',
|
|
1952
|
+
data: function data() {
|
|
1953
|
+
var props = this.$props;
|
|
1954
|
+
this.__state = {
|
|
1955
|
+
messages: [],
|
|
1956
|
+
inputMessage: '',
|
|
1957
|
+
AISessionId: '',
|
|
1958
|
+
error: null
|
|
1959
|
+
};
|
|
1960
|
+
this.internalComponent = props.componentId + "__internal";
|
|
1961
|
+
return this.__state;
|
|
1962
|
+
},
|
|
1963
|
+
inject: {
|
|
1964
|
+
theme: {
|
|
1965
|
+
from: 'theme_reactivesearch'
|
|
1966
|
+
}
|
|
1967
|
+
},
|
|
1968
|
+
created: function created() {},
|
|
1969
|
+
computed: {
|
|
1970
|
+
hasCustomRenderer: function hasCustomRenderer$1() {
|
|
1971
|
+
return hasCustomRenderer(this);
|
|
1972
|
+
},
|
|
1973
|
+
isLoadingState: function isLoadingState() {
|
|
1974
|
+
return this.isAIResponseLoading || this.isLoading;
|
|
1975
|
+
},
|
|
1976
|
+
shouldShowComponent: function shouldShowComponent() {
|
|
1977
|
+
return this.showComponent;
|
|
1978
|
+
}
|
|
1979
|
+
},
|
|
1980
|
+
props: {
|
|
1981
|
+
componentId: types.string.isRequired,
|
|
1982
|
+
showVoiceInput: VueTypes.bool.def(false),
|
|
1983
|
+
showIcon: VueTypes.bool.def(true),
|
|
1984
|
+
onData: types.func,
|
|
1985
|
+
innerRef: VueTypes.string.def('AISearchInputField'),
|
|
1986
|
+
react: types.react,
|
|
1987
|
+
enableAI: VueTypes.bool.def(true),
|
|
1988
|
+
AIConfig: types.AIConfig,
|
|
1989
|
+
iconPosition: types.iconPosition.def('left'),
|
|
1990
|
+
themePreset: types.themePreset,
|
|
1991
|
+
theme: types.style,
|
|
1992
|
+
icon: types.children,
|
|
1993
|
+
iconURL: VueTypes.string.def(''),
|
|
1994
|
+
renderMic: types.func,
|
|
1995
|
+
getMicInstance: types.func,
|
|
1996
|
+
innerClass: types.style,
|
|
1997
|
+
placeholder: VueTypes.string.def('Ask a question'),
|
|
1998
|
+
title: types.title,
|
|
1999
|
+
AIResponse: types.componentObject,
|
|
2000
|
+
isAIResponseLoading: VueTypes.bool.def(false),
|
|
2001
|
+
AIResponseError: types.componentObject,
|
|
2002
|
+
getAIResponse: types.func.isRequired,
|
|
2003
|
+
enterButton: types.bool,
|
|
2004
|
+
renderEnterButton: types.title,
|
|
2005
|
+
showInput: VueTypes.bool.def(true),
|
|
2006
|
+
clearSessionOnDestroy: VueTypes.bool.def(true),
|
|
2007
|
+
rawData: types.rawData,
|
|
2008
|
+
render: types.func,
|
|
2009
|
+
onError: types.func,
|
|
2010
|
+
renderError: types.title,
|
|
2011
|
+
isLoading: types.boolRequired,
|
|
2012
|
+
sessionIdFromStore: VueTypes.string,
|
|
2013
|
+
showComponent: types.boolRequired
|
|
2014
|
+
},
|
|
2015
|
+
mounted: function mounted() {},
|
|
2016
|
+
watch: {
|
|
2017
|
+
AIResponse: function AIResponse(newVal) {
|
|
2018
|
+
if (newVal) {
|
|
2019
|
+
this.AISessionId = ((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || null;
|
|
2020
|
+
var messagesHistory = newVal.messages,
|
|
2021
|
+
response = newVal.response;
|
|
2022
|
+
var finalMessages = [];
|
|
2023
|
+
if (response && response.error) {
|
|
2024
|
+
this.error = {
|
|
2025
|
+
message: response.error
|
|
2026
|
+
};
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
// pushing message history so far
|
|
2030
|
+
if (messagesHistory && messagesHistory && Array.isArray(messagesHistory)) {
|
|
2031
|
+
finalMessages.push.apply(finalMessages, messagesHistory.filter(function (msg) {
|
|
2032
|
+
return msg.role !== AI_ROLES.SYSTEM;
|
|
2033
|
+
}));
|
|
2034
|
+
}
|
|
2035
|
+
// fresh response
|
|
2036
|
+
if (response && response.answer) ;
|
|
2037
|
+
this.messages = finalMessages;
|
|
2038
|
+
} else if (!newVal && !this.error) {
|
|
2039
|
+
this.messages = [];
|
|
2040
|
+
}
|
|
2041
|
+
},
|
|
2042
|
+
rawData: function rawData(newVal) {
|
|
2043
|
+
this.$emit('on-data', {
|
|
2044
|
+
data: this.messages,
|
|
2045
|
+
rawData: newVal,
|
|
2046
|
+
loading: this.$props.isAIResponseLoading || this.$props.isLoading,
|
|
2047
|
+
error: this.$props.AIResponseError
|
|
2048
|
+
});
|
|
2049
|
+
},
|
|
2050
|
+
isAIResponseLoading: function isAIResponseLoading(newVal) {
|
|
2051
|
+
this.isLoadingState = newVal;
|
|
2052
|
+
this.$emit('on-data', {
|
|
2053
|
+
data: this.messages,
|
|
2054
|
+
rawData: this.$props.rawData,
|
|
2055
|
+
loading: newVal || this.$props.isLoading,
|
|
2056
|
+
error: this.$props.AIResponseError
|
|
2057
|
+
});
|
|
2058
|
+
},
|
|
2059
|
+
isLoading: function isLoading(newVal) {
|
|
2060
|
+
this.isLoadingState = newVal;
|
|
2061
|
+
this.$emit('on-data', {
|
|
2062
|
+
data: this.messages,
|
|
2063
|
+
rawData: this.$props.rawData,
|
|
2064
|
+
loading: newVal || this.$props.isLoading,
|
|
2065
|
+
error: this.$props.AIResponseError
|
|
2066
|
+
});
|
|
2067
|
+
},
|
|
2068
|
+
sessionIdFromStore: function sessionIdFromStore(newVal) {
|
|
2069
|
+
if (newVal) {
|
|
2070
|
+
this.sessionId = newVal;
|
|
2071
|
+
}
|
|
2072
|
+
},
|
|
2073
|
+
AIResponseError: function AIResponseError(newVal) {
|
|
2074
|
+
this.error = newVal;
|
|
2075
|
+
this.AISessionId = ((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || null;
|
|
2076
|
+
this.$emit('on-data', {
|
|
2077
|
+
data: this.messages,
|
|
2078
|
+
rawData: this.$props.rawData,
|
|
2079
|
+
loading: this.$props.isAIResponseLoading || this.$props.isLoading,
|
|
2080
|
+
error: newVal
|
|
2081
|
+
});
|
|
2082
|
+
},
|
|
2083
|
+
messages: function messages() {
|
|
2084
|
+
this.scrollToBottom();
|
|
2085
|
+
}
|
|
2086
|
+
},
|
|
2087
|
+
methods: {
|
|
2088
|
+
scrollToBottom: function scrollToBottom() {
|
|
2089
|
+
var _this = this;
|
|
2090
|
+
this.$nextTick(function () {
|
|
2091
|
+
var _this$$refs;
|
|
2092
|
+
var messageContainer = (_this$$refs = _this.$refs) == null ? void 0 : _this$$refs[_this.$props.innerRef];
|
|
2093
|
+
if (messageContainer && messageContainer.$el) {
|
|
2094
|
+
messageContainer.$el.scrollTo({
|
|
2095
|
+
top: messageContainer.$el.scrollHeight,
|
|
2096
|
+
behavior: 'smooth'
|
|
2097
|
+
});
|
|
2098
|
+
}
|
|
2099
|
+
});
|
|
2100
|
+
},
|
|
2101
|
+
handleMessageInputChange: function handleMessageInputChange(e) {
|
|
2102
|
+
this.inputMessage = e.target.value;
|
|
2103
|
+
},
|
|
2104
|
+
handleSendMessage: function handleSendMessage(e, isRetry, text) {
|
|
2105
|
+
if (isRetry === void 0) {
|
|
2106
|
+
isRetry = false;
|
|
2107
|
+
}
|
|
2108
|
+
if (text === void 0) {
|
|
2109
|
+
text = this.inputMessage;
|
|
2110
|
+
}
|
|
2111
|
+
if (typeof e === 'object') e.preventDefault();
|
|
2112
|
+
if (text.trim()) {
|
|
2113
|
+
if (this.isLoadingState) {
|
|
2114
|
+
return;
|
|
2115
|
+
}
|
|
2116
|
+
if (this.AISessionId) {
|
|
2117
|
+
if (!isRetry) this.messages = [].concat(this.messages, [{
|
|
2118
|
+
content: text,
|
|
2119
|
+
role: AI_ROLES.USER
|
|
2120
|
+
}]);
|
|
2121
|
+
this.getAIResponse(this.AISessionId, this.componentId, text);
|
|
2122
|
+
} else {
|
|
2123
|
+
console.error("AISessionId for " + this.$props.componentId + " is missing! AIAnswer component requires an AISession to function. Try reloading the App.");
|
|
2124
|
+
this.error = {
|
|
2125
|
+
message: "AISessionId for " + this.$props.componentId + " is missing! AIAnswer component requires an AISession to function. Trying reloading the App."
|
|
2126
|
+
};
|
|
2127
|
+
}
|
|
2128
|
+
this.inputMessage = '';
|
|
2129
|
+
}
|
|
2130
|
+
},
|
|
2131
|
+
handleRetryRequest: function handleRetryRequest() {
|
|
2132
|
+
if (this.messages && !this.isLoadingState) {
|
|
2133
|
+
var _this$messages;
|
|
2134
|
+
var lastUserRequestMessage = (_this$messages = this.messages[this.messages.length - 1]) == null ? void 0 : _this$messages.content;
|
|
2135
|
+
if (this.AISessionId) {
|
|
2136
|
+
this.getAIResponse(this.AISessionId, this.componentId, lastUserRequestMessage);
|
|
2137
|
+
this.inputMessage = '';
|
|
2138
|
+
} else {
|
|
2139
|
+
console.error("AISessionId for " + this.componentId + " is missing! AIAnswer component requires an AISession to function. Try reloading the App.");
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
},
|
|
2143
|
+
renderErrorComponent: function renderErrorComponent() {
|
|
2144
|
+
var renderError = this.$slots.renderError || this.$props.renderError;
|
|
2145
|
+
if (this.error && !this.isLoadingState) {
|
|
2146
|
+
if (renderError) {
|
|
2147
|
+
return createVNode("div", {
|
|
2148
|
+
"class": "--ai-answer-error-container " + (getClassName$2(this.$props.innerClass, 'ai-error') || '')
|
|
2149
|
+
}, [isFunction(renderError) ? renderError(this.error, this.handleRetryRequest) : renderError]);
|
|
2150
|
+
}
|
|
2151
|
+
return createVNode("div", {
|
|
2152
|
+
"class": "--ai-answer-error-container " + (getClassName$2(this.$props.innerClass, 'ai-error') || '')
|
|
2153
|
+
}, [createVNode("div", {
|
|
2154
|
+
"class": "--default-error-element"
|
|
2155
|
+
}, [createVNode("span", null, [this.error.message ? this.error.message : 'There was an error in generating the response.', ' ', this.error.code ? "Code:\n\t\t\t\t\t\t\t" + this.error.code : '']), this.AISessionId && createVNode(Button, {
|
|
2156
|
+
"primary": true,
|
|
2157
|
+
"onClick": this.handleRetryRequest
|
|
2158
|
+
}, {
|
|
2159
|
+
"default": function _default() {
|
|
2160
|
+
return [createTextVNode("Try again")];
|
|
2161
|
+
}
|
|
2162
|
+
})])]);
|
|
2163
|
+
}
|
|
2164
|
+
return null;
|
|
2165
|
+
},
|
|
2166
|
+
handleKeyPress: function handleKeyPress(e) {
|
|
2167
|
+
if (e.key === 'Enter') {
|
|
2168
|
+
this.handleSendMessage(e);
|
|
2169
|
+
this.inputMessage = '';
|
|
2170
|
+
}
|
|
2171
|
+
},
|
|
2172
|
+
renderIcon: function renderIcon() {
|
|
2173
|
+
if (this.$props.showIcon) {
|
|
2174
|
+
if (this.$props.icon) {
|
|
2175
|
+
return this.$props.icon;
|
|
2176
|
+
}
|
|
2177
|
+
if (this.$slots.icon) {
|
|
2178
|
+
return this.$slots.icon();
|
|
2179
|
+
}
|
|
2180
|
+
if (this.$props.iconURL) {
|
|
2181
|
+
return createVNode("img", {
|
|
2182
|
+
"style": {
|
|
2183
|
+
maxHeight: '25px'
|
|
2184
|
+
},
|
|
2185
|
+
"src": this.$props.iconURL,
|
|
2186
|
+
"alt": "search-icon"
|
|
2187
|
+
}, null);
|
|
2188
|
+
}
|
|
2189
|
+
return createVNode(SearchSvg, null, null);
|
|
2190
|
+
}
|
|
2191
|
+
return null;
|
|
2192
|
+
},
|
|
2193
|
+
shouldMicRender: function shouldMicRender(showVoiceSearch) {
|
|
2194
|
+
// checks for SSR
|
|
2195
|
+
if (typeof window === 'undefined') return false;
|
|
2196
|
+
return showVoiceSearch && (window.webkitSpeechRecognition || window.SpeechRecognition);
|
|
2197
|
+
},
|
|
2198
|
+
handleVoiceResults: function handleVoiceResults(_ref) {
|
|
2199
|
+
var results = _ref.results;
|
|
2200
|
+
if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
|
|
2201
|
+
this.handleSendMessage(null, false, results[0][0].transcript.trim());
|
|
2202
|
+
}
|
|
2203
|
+
},
|
|
2204
|
+
renderIcons: function renderIcons() {
|
|
2205
|
+
var _this2 = this;
|
|
2206
|
+
var _slot, _slot2;
|
|
2207
|
+
var _this$$props = this.$props,
|
|
2208
|
+
getMicInstance = _this$$props.getMicInstance,
|
|
2209
|
+
showVoiceInput = _this$$props.showVoiceInput,
|
|
2210
|
+
iconPosition = _this$$props.iconPosition,
|
|
2211
|
+
innerClass = _this$$props.innerClass;
|
|
2212
|
+
var renderMic = this.$slots.renderMic || this.$props.renderMic;
|
|
2213
|
+
return createVNode("div", null, [createVNode(IconGroup, {
|
|
2214
|
+
"groupPosition": "right",
|
|
2215
|
+
"positionType": "absolute"
|
|
2216
|
+
}, {
|
|
2217
|
+
"default": function _default() {
|
|
2218
|
+
return [_this2.shouldMicRender(showVoiceInput) && createVNode(Mic, {
|
|
2219
|
+
"getInstance": getMicInstance,
|
|
2220
|
+
"render": renderMic,
|
|
2221
|
+
"onResult": _this2.handleVoiceResults,
|
|
2222
|
+
"class": getClassName$2(innerClass, 'ai-search-mic') || null
|
|
2223
|
+
}, null), iconPosition === 'right' && createVNode(IconWrapper, null, _isSlot$1(_slot = _this2.renderIcon()) ? _slot : {
|
|
2224
|
+
"default": function _default() {
|
|
2225
|
+
return [_slot];
|
|
2226
|
+
}
|
|
2227
|
+
})];
|
|
2228
|
+
}
|
|
2229
|
+
}), createVNode(IconGroup, {
|
|
2230
|
+
"groupPosition": "left",
|
|
2231
|
+
"positionType": "absolute"
|
|
2232
|
+
}, {
|
|
2233
|
+
"default": function _default() {
|
|
2234
|
+
return [iconPosition === 'left' && createVNode(IconWrapper, null, _isSlot$1(_slot2 = _this2.renderIcon()) ? _slot2 : {
|
|
2235
|
+
"default": function _default() {
|
|
2236
|
+
return [_slot2];
|
|
2237
|
+
}
|
|
2238
|
+
})];
|
|
2239
|
+
}
|
|
2240
|
+
})]);
|
|
2241
|
+
},
|
|
2242
|
+
enterButtonOnClick: function enterButtonOnClick(e) {
|
|
2243
|
+
this.handleSendMessage(e);
|
|
2244
|
+
},
|
|
2245
|
+
renderEnterButtonElement: function renderEnterButtonElement() {
|
|
2246
|
+
var _this3 = this;
|
|
2247
|
+
var _this$$props2 = this.$props,
|
|
2248
|
+
enterButton = _this$$props2.enterButton,
|
|
2249
|
+
innerClass = _this$$props2.innerClass;
|
|
2250
|
+
var renderEnterButton = this.$slots.renderEnterButton;
|
|
2251
|
+
if (enterButton) {
|
|
2252
|
+
var getEnterButtonMarkup = function getEnterButtonMarkup() {
|
|
2253
|
+
if (renderEnterButton) {
|
|
2254
|
+
return renderEnterButton(_this3.enterButtonOnClick);
|
|
2255
|
+
}
|
|
2256
|
+
return createVNode(SendButton, {
|
|
2257
|
+
"primary": true,
|
|
2258
|
+
"type": "submit",
|
|
2259
|
+
"tabIndex": 0,
|
|
2260
|
+
"onClick": _this3.handleSendMessage,
|
|
2261
|
+
"onKeyPress": _this3.handleKeyPress,
|
|
2262
|
+
"class": "enter-btn " + getClassName$2(innerClass, 'ai-enter-button')
|
|
2263
|
+
}, {
|
|
2264
|
+
"default": function _default() {
|
|
2265
|
+
return [createTextVNode("Send")];
|
|
2266
|
+
}
|
|
2267
|
+
});
|
|
2268
|
+
};
|
|
2269
|
+
return createVNode("div", {
|
|
2270
|
+
"class": "ai-enter-button-wrapper"
|
|
2271
|
+
}, [getEnterButtonMarkup()]);
|
|
2272
|
+
}
|
|
2273
|
+
return null;
|
|
2274
|
+
},
|
|
2275
|
+
getComponent: function getComponent$1() {
|
|
2276
|
+
var data = {
|
|
2277
|
+
error: this.AIResponseError,
|
|
2278
|
+
loading: this.isAIResponseLoading,
|
|
2279
|
+
data: this.messages,
|
|
2280
|
+
rawData: this.rawData
|
|
2281
|
+
};
|
|
2282
|
+
return getComponent(data, this);
|
|
2283
|
+
}
|
|
2284
|
+
},
|
|
2285
|
+
beforeUnmount: function beforeUnmount() {
|
|
2286
|
+
if (this.$props.clearSessionOnDestroy) {
|
|
2287
|
+
// cleanup logic
|
|
2288
|
+
// final Object to store in local storage cache
|
|
2289
|
+
var finalCacheObj = getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {};
|
|
2290
|
+
// delete current component's cache
|
|
2291
|
+
delete finalCacheObj[this.$props.componentId];
|
|
2292
|
+
// update local cache
|
|
2293
|
+
setObjectInLocalStorage(AI_LOCAL_CACHE_KEY, finalCacheObj);
|
|
2294
|
+
}
|
|
2295
|
+
},
|
|
2296
|
+
render: function render() {
|
|
2297
|
+
var _slot3;
|
|
2298
|
+
var _this4 = this;
|
|
2299
|
+
var props = this.$props;
|
|
2300
|
+
if (!this.shouldShowComponent) {
|
|
2301
|
+
return null;
|
|
2302
|
+
}
|
|
2303
|
+
return createVNode(Chatbox, null, {
|
|
2304
|
+
"default": function _default() {
|
|
2305
|
+
return [_this4.$props.title && createVNode(Title, {
|
|
2306
|
+
"class": getClassName$2(_this4.$props.innerClass, 'title') || ''
|
|
2307
|
+
}, {
|
|
2308
|
+
"default": function _default() {
|
|
2309
|
+
return [_this4.$props.title];
|
|
2310
|
+
}
|
|
2311
|
+
}), createVNode(ChatContainer, {
|
|
2312
|
+
"theme": props.theme,
|
|
2313
|
+
"showInput": props.showInput
|
|
2314
|
+
}, {
|
|
2315
|
+
"default": function _default() {
|
|
2316
|
+
return [_this4.hasCustomRenderer && createVNode(MessagesContainer, {
|
|
2317
|
+
"themePreset": _this4.themePreset,
|
|
2318
|
+
"theme": props.theme,
|
|
2319
|
+
"ref": _this4.$props.innerRef,
|
|
2320
|
+
"class": "--ai-message-container " + (getClassName$2(props.innerClass, 'ai-message-container') || '')
|
|
2321
|
+
}, _isSlot$1(_slot3 = _this4.getComponent()) ? _slot3 : {
|
|
2322
|
+
"default": function _default() {
|
|
2323
|
+
return [_slot3];
|
|
2324
|
+
}
|
|
2325
|
+
}), !_this4.hasCustomRenderer && createVNode(MessagesContainer, {
|
|
2326
|
+
"themePreset": _this4.themePreset,
|
|
2327
|
+
"theme": props.theme,
|
|
2328
|
+
"ref": _this4.$props.innerRef,
|
|
2329
|
+
"class": "--ai-message-container " + (getClassName$2(props.innerClass, 'ai-message-container') || '')
|
|
2330
|
+
}, {
|
|
2331
|
+
"default": function _default() {
|
|
2332
|
+
return [_this4.messages.map(function (message, index) {
|
|
2333
|
+
return createVNode(Message, {
|
|
2334
|
+
"key": index,
|
|
2335
|
+
"isSender": message.role === AI_ROLES.USER,
|
|
2336
|
+
"innerHTML": md.render(message.content),
|
|
2337
|
+
"themePreset": _this4.themePreset,
|
|
2338
|
+
"theme": props.theme,
|
|
2339
|
+
"class": "--ai-answer-message " + (getClassName$2(props.innerClass, 'ai-message') || '')
|
|
2340
|
+
}, null);
|
|
2341
|
+
}), _this4.isLoadingState && createVNode(Message, {
|
|
2342
|
+
"themePreset": _this4.themePreset,
|
|
2343
|
+
"theme": props.theme,
|
|
2344
|
+
"isSender": false,
|
|
2345
|
+
"class": "--ai-answer-message " + (getClassName$2(props.innerClass, 'ai-message') || null)
|
|
2346
|
+
}, {
|
|
2347
|
+
"default": function _default() {
|
|
2348
|
+
return [createVNode(TypingIndicator, null, {
|
|
2349
|
+
"default": function _default() {
|
|
2350
|
+
return [createVNode(TypingDot, {
|
|
2351
|
+
"themePreset": _this4.themePreset
|
|
2352
|
+
}, null), createVNode(TypingDot, {
|
|
2353
|
+
"themePreset": _this4.themePreset
|
|
2354
|
+
}, null), createVNode(TypingDot, {
|
|
2355
|
+
"themePreset": _this4.themePreset
|
|
2356
|
+
}, null)];
|
|
2357
|
+
}
|
|
2358
|
+
})];
|
|
2359
|
+
}
|
|
2360
|
+
})];
|
|
2361
|
+
}
|
|
2362
|
+
}), _this4.renderErrorComponent(), props.showInput && createVNode(MessageInputContainer, {
|
|
2363
|
+
"class": "--ai-input-container",
|
|
2364
|
+
"onSubmit": _this4.handleSendMessage
|
|
2365
|
+
}, {
|
|
2366
|
+
"default": function _default() {
|
|
2367
|
+
return [createVNode(InputGroup, {
|
|
2368
|
+
"isOpen": false
|
|
2369
|
+
}, {
|
|
2370
|
+
"default": function _default() {
|
|
2371
|
+
return [createVNode(InputWrapper, null, {
|
|
2372
|
+
"default": function _default() {
|
|
2373
|
+
return [createVNode(MessageInput, {
|
|
2374
|
+
"type": "text",
|
|
2375
|
+
"placeholder": props.placeholder,
|
|
2376
|
+
"value": _this4.inputMessage,
|
|
2377
|
+
"onChange": _this4.handleMessageInputChange,
|
|
2378
|
+
"onKeyPress": _this4.handleKeyPress,
|
|
2379
|
+
"id": props.componentId + "-ai-input",
|
|
2380
|
+
"showIcon": props.showIcon,
|
|
2381
|
+
"iconPosition": props.iconPosition,
|
|
2382
|
+
"themePreset": _this4.themePreset,
|
|
2383
|
+
"disabled": _this4.isLoadingState,
|
|
2384
|
+
"class": getClassName$2(props.innerClass, 'ai-input') || null
|
|
2385
|
+
}, null), ' ', _this4.renderIcons()];
|
|
2386
|
+
}
|
|
2387
|
+
})];
|
|
2388
|
+
}
|
|
2389
|
+
}), _this4.renderEnterButtonElement()];
|
|
2390
|
+
}
|
|
2391
|
+
}), ' '];
|
|
2392
|
+
}
|
|
2393
|
+
})];
|
|
2394
|
+
}
|
|
2395
|
+
});
|
|
2396
|
+
}
|
|
2397
|
+
});
|
|
2398
|
+
AIAnswer.hasInternalComponent = function () {
|
|
2399
|
+
return true;
|
|
2400
|
+
};
|
|
2401
|
+
var mapStateToProps$1 = function mapStateToProps(state, props) {
|
|
2402
|
+
var dependencyComponent = Object.values(props.react)[0];
|
|
2403
|
+
if (Array.isArray(dependencyComponent)) {
|
|
2404
|
+
// eslint-disable-next-line prefer-destructuring
|
|
2405
|
+
dependencyComponent = dependencyComponent[0];
|
|
2406
|
+
}
|
|
2407
|
+
var showComponent = state.selectedValues[dependencyComponent] && state.selectedValues[dependencyComponent].value;
|
|
2408
|
+
return {
|
|
2409
|
+
showComponent: showComponent,
|
|
2410
|
+
AIResponse: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response,
|
|
2411
|
+
isAIResponseLoading: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].isLoading,
|
|
2412
|
+
AIResponseError: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].error,
|
|
2413
|
+
rawData: state.rawData[props.componentId],
|
|
2414
|
+
themePreset: state.config.themePreset,
|
|
2415
|
+
isLoading: state.isLoading[props.componentId] || false,
|
|
2416
|
+
sessionIdFromStore: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].sessionId || ''
|
|
2417
|
+
};
|
|
2418
|
+
};
|
|
2419
|
+
var mapDispatchToProps$1 = {
|
|
2420
|
+
getAIResponse: fetchAIResponse
|
|
2421
|
+
};
|
|
2422
|
+
var AIConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps$1, mapDispatchToProps$1)(AIAnswer), {
|
|
2423
|
+
componentType: componentTypes.AIAnswer,
|
|
2424
|
+
internalComponent: true
|
|
2425
|
+
}));
|
|
2426
|
+
AIConnected.name = AIAnswer.name;
|
|
2427
|
+
AIConnected.hasInternalComponent = AIAnswer.hasInternalComponent;
|
|
2428
|
+
AIConnected.install = function (Vue) {
|
|
2429
|
+
Vue.component(AIConnected.name, AIConnected);
|
|
2430
|
+
};
|
|
2431
|
+
// Add componentType for SSR
|
|
2432
|
+
AIConnected.componentType = componentTypes.AIAnswer;
|
|
2433
|
+
|
|
2434
|
+
var _templateObject$9, _templateObject2$2;
|
|
2435
|
+
var HierarchicalMenuList = styled('ul')(_templateObject$9 || (_templateObject$9 = _taggedTemplateLiteralLoose(["\n\tlist-style: none;\n\tpadding: 0;\n\tmargin: 0;\n\tmax-height: 0;\n\toverflow: hidden;\n\n\t&.--open {\n\t\tmax-height: 100%;\n\t}\n"])));
|
|
2436
|
+
var HierarchicalMenuListItem = styled('li')(_templateObject2$2 || (_templateObject2$2 = _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) {
|
|
1868
2437
|
return !props.showLine && "\n\t\t\t\t\tdisplay: none;\n\t\t\t\t";
|
|
1869
2438
|
});
|
|
1870
2439
|
|
|
@@ -2077,7 +2646,7 @@ var HierarchicalMenuListItemComponent = {
|
|
|
2077
2646
|
}
|
|
2078
2647
|
};
|
|
2079
2648
|
|
|
2080
|
-
function _isSlot$
|
|
2649
|
+
function _isSlot$2(s) {
|
|
2081
2650
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
2082
2651
|
}
|
|
2083
2652
|
var HierarchicalMenuComponent = {
|
|
@@ -2102,7 +2671,7 @@ var HierarchicalMenuComponent = {
|
|
|
2102
2671
|
return createVNode(HierarchicalMenuList, {
|
|
2103
2672
|
"class": "" + (isExpanded ? '--open' : ''),
|
|
2104
2673
|
"isSelected": isExpanded
|
|
2105
|
-
}, _isSlot$
|
|
2674
|
+
}, _isSlot$2(_slot = listArray.map(function (listItem) {
|
|
2106
2675
|
return createVNode(HierarchicalMenuListItemComponent, mergeProps({
|
|
2107
2676
|
"key": parentPath + "__" + JSON.stringify(listItem),
|
|
2108
2677
|
"parentPath": parentPath,
|
|
@@ -2116,7 +2685,7 @@ var HierarchicalMenuComponent = {
|
|
|
2116
2685
|
}
|
|
2117
2686
|
};
|
|
2118
2687
|
|
|
2119
|
-
function _isSlot$
|
|
2688
|
+
function _isSlot$3(s) {
|
|
2120
2689
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
2121
2690
|
}
|
|
2122
2691
|
var updateQueryAction = Actions.updateQuery,
|
|
@@ -2566,7 +3135,7 @@ var TreeList = {
|
|
|
2566
3135
|
"default": function _default() {
|
|
2567
3136
|
return [props.title && createVNode(Title, {
|
|
2568
3137
|
"class": getClassName$2(innerClass, 'title') || null
|
|
2569
|
-
}, _isSlot$
|
|
3138
|
+
}, _isSlot$3(title) ? title : {
|
|
2570
3139
|
"default": function _default() {
|
|
2571
3140
|
return [title];
|
|
2572
3141
|
}
|
|
@@ -2595,7 +3164,7 @@ var TreeList = {
|
|
|
2595
3164
|
});
|
|
2596
3165
|
}
|
|
2597
3166
|
};
|
|
2598
|
-
var mapStateToProps$
|
|
3167
|
+
var mapStateToProps$2 = function mapStateToProps(state, props) {
|
|
2599
3168
|
return {
|
|
2600
3169
|
selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
|
|
2601
3170
|
rawData: state.rawData[props.componentId] || {},
|
|
@@ -2613,7 +3182,7 @@ var mapDispatchtoProps = {
|
|
|
2613
3182
|
TreeList.hasInternalComponent = function () {
|
|
2614
3183
|
return true;
|
|
2615
3184
|
};
|
|
2616
|
-
var TreeListConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps$
|
|
3185
|
+
var TreeListConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps$2, mapDispatchtoProps)(TreeList), {
|
|
2617
3186
|
componentType: componentTypes.treeList,
|
|
2618
3187
|
internalComponent: TreeList.hasInternalComponent()
|
|
2619
3188
|
}));
|
|
@@ -2681,7 +3250,7 @@ RcConnected.install = function (Vue) {
|
|
|
2681
3250
|
Vue.component(RcConnected.name, RcConnected);
|
|
2682
3251
|
};
|
|
2683
3252
|
|
|
2684
|
-
var components = [ReactiveList, ResultCard, ResultList, ReactiveBase, SBConnected, SingleList, MultiList, SingleRange, MultiRange, RangeSlider, DynamicRangeSlider, ReactiveComponent, RcConnected, SelectedFilters, ToggleButton, SingleDropdownList, MultiDropdownList, StateProvider, RangeInput, TreeListConnected];
|
|
3253
|
+
var components = [ReactiveList, ResultCard, ResultList, ReactiveBase, SBConnected, SingleList, MultiList, SingleRange, MultiRange, RangeSlider, DynamicRangeSlider, ReactiveComponent, RcConnected, SelectedFilters, ToggleButton, SingleDropdownList, MultiDropdownList, StateProvider, RangeInput, TreeListConnected, AIConnected];
|
|
2685
3254
|
function install (Vue) {
|
|
2686
3255
|
components.map(function (component) {
|
|
2687
3256
|
Vue.use(component);
|
|
@@ -2689,4 +3258,4 @@ function install (Vue) {
|
|
|
2689
3258
|
});
|
|
2690
3259
|
}
|
|
2691
3260
|
|
|
2692
|
-
export { RcConnected as R, SBConnected as S, TreeListConnected as T, install as i };
|
|
3261
|
+
export { AIConnected as A, RcConnected as R, SBConnected as S, TreeListConnected as T, install as i };
|