@appbaseio/reactivesearch-vue 3.1.0-alpha → 3.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@appbaseio/reactivesearch-vue.umd.js +225 -175
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +4 -4
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/{DropDown-26666911.js → DropDown-1532353d.js} +1 -1
- package/dist/cjs/{Input-3ecdb905.js → Input-4279b088.js} +2 -2
- package/dist/cjs/MultiDropdownList.js +2 -2
- package/dist/cjs/MultiList.js +1 -1
- package/dist/cjs/RangeInput.js +1 -1
- package/dist/cjs/SingleDropdownList.js +2 -2
- package/dist/cjs/SingleList.js +1 -1
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/{install-22854c15.js → install-05fcf590.js} +204 -164
- package/dist/cjs/install.js +3 -3
- package/dist/cjs/version.js +1 -1
- package/dist/es/{DropDown-48045fde.js → DropDown-6d1dddde.js} +1 -1
- package/dist/es/{Input-83dee8c5.js → Input-1f6207bc.js} +2 -2
- package/dist/es/MultiDropdownList.js +2 -2
- package/dist/es/MultiList.js +1 -1
- package/dist/es/RangeInput.js +1 -1
- package/dist/es/SingleDropdownList.js +2 -2
- package/dist/es/SingleList.js +1 -1
- package/dist/es/index.js +4 -4
- package/dist/es/{install-7615abec.js → install-2b5814e0.js} +206 -166
- package/dist/es/install.js +3 -3
- package/dist/es/version.js +1 -1
- package/package.json +2 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { helper, Actions, causes } from '@appbaseio/reactivecore';
|
|
2
|
-
import { SEARCH_COMPONENTS_MODES, AI_TRIGGER_MODES,
|
|
2
|
+
import { SEARCH_COMPONENTS_MODES, AI_TRIGGER_MODES, AI_LOCAL_CACHE_KEY, componentTypes, AI_ROLES, TREELIST_VALUES_PATH_SEPARATOR } from '@appbaseio/reactivecore/lib/utils/constants';
|
|
3
3
|
import _transformOn from '@vue/babel-helper-vue-transform-on';
|
|
4
4
|
import { _ as _taggedTemplateLiteralLoose, a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-ded08042.js';
|
|
5
5
|
import { createVNode, createTextVNode, defineComponent, ref, watch, isVNode, mergeProps, h } from 'vue';
|
|
6
6
|
import VueTypes from 'vue-types';
|
|
7
|
-
import { getQueryOptions, featuredSuggestionsActionTypes, suggestionTypes,
|
|
7
|
+
import { getObjectFromLocalStorage, getQueryOptions, featuredSuggestionsActionTypes, suggestionTypes, getClassName as getClassName$2, setObjectInLocalStorage, recLookup, updateCustomQuery as updateCustomQuery$1, updateDefaultQuery as updateDefaultQuery$1, transformTreeListLocalStateIntoQueryComptaibleFormat, isEqual as isEqual$1, transformRawTreeListData, setDeep, getComponent as getComponent$1, getOptionsFromQuery, checkValueChange as checkValueChange$1, getAggsQuery, updateInternalQuery, isFunction as isFunction$1 } from '@appbaseio/reactivecore/lib/utils/helper';
|
|
8
8
|
import { styled } from '@appbaseio/vue-emotion';
|
|
9
9
|
import { css, keyframes } from '@emotion/css';
|
|
10
10
|
import { lighten } from 'polished';
|
|
@@ -23,8 +23,8 @@ import ReactiveBase from './ReactiveBase.js';
|
|
|
23
23
|
import hotkeys from 'hotkeys-js';
|
|
24
24
|
import xss from 'xss';
|
|
25
25
|
import { Remarkable } from 'remarkable';
|
|
26
|
-
import { I as IconWrapper, C as CancelSvg, a as IconGroup, B as ButtonIconWrapper, D as Downshift, b as InputWrapper } from './DropDown-
|
|
27
|
-
import { n as noSuggestions, T as TextArea, I as Input, s as suggestionsContainer, A as Actions$1, a as suggestions, b as searchboxSuggestions } from './Input-
|
|
26
|
+
import { I as IconWrapper, C as CancelSvg, a as IconGroup, B as ButtonIconWrapper, D as Downshift, b as InputWrapper } from './DropDown-6d1dddde.js';
|
|
27
|
+
import { n as noSuggestions, T as TextArea, I as Input, s as suggestionsContainer, A as Actions$1, a as suggestions, b as searchboxSuggestions } from './Input-1f6207bc.js';
|
|
28
28
|
import { C as Container } from './Container-d00219f7.js';
|
|
29
29
|
import Highlight from 'vue-highlight-words';
|
|
30
30
|
import { fetchAIResponse, createAISession } from '@appbaseio/reactivecore/lib/actions/query';
|
|
@@ -61,7 +61,7 @@ InputGroup.defaultProps = {
|
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
var _templateObject$1;
|
|
64
|
-
var InputAddon = styled('span')(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #fafafa;\n border: 1px solid
|
|
64
|
+
var InputAddon = styled('span')(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #fafafa;\n border: 1px solid transparent;\n border-radius: 6px;\n color: rgba(0, 0, 0, 0.85);\n font-size: 14px;\n font-weight: 400;\n padding: 0 11px;\n position: relative;\n transition: all 0.3s;\n box-sizing: border-box;\n overflow: hidden;\n\n &:first-of-type {\n border-right: none;\n }\n &:last-of-type {\n border-left: none;\n }\n"])));
|
|
65
65
|
InputAddon.defaultProps = {
|
|
66
66
|
className: 'input-addon'
|
|
67
67
|
};
|
|
@@ -832,7 +832,7 @@ var HorizontalSkeletonLoader = defineComponent({
|
|
|
832
832
|
|
|
833
833
|
var _templateObject$7, _templateObject2$2, _templateObject3$1, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
|
834
834
|
var Chatbox = styled('div')(_templateObject$7 || (_templateObject$7 = _taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tmargin: 0 auto;\n\tpadding: 10px;\n\tbackground-color: #fafafa;\n\twidth: 100%;\n\tbox-shadow: rgb(0 0 0 / 20%) 0px 0px 6px;\n\tborder-radius: 6px;\n\tmargin-bottom: 20px;\n\tbackground-color: ", ";\n\n\t.--trigger-message-wrapper {\n\t\tcursor: pointer;\n\t}\n"])), function (props) {
|
|
835
|
-
return props.theme && props.theme.colors ? props.theme.colors.backgroundColor : '#fff';
|
|
835
|
+
return props.theme && props.theme.colors && props.theme.colors.backgroundColor ? lighten(0.1, props.theme.colors.backgroundColor) : '#fff';
|
|
836
836
|
});
|
|
837
837
|
var ChatContainer = styled('div')(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\theight: 100%;\n\tposition: relative;\n\t.--ai-answer-error-container {\n\t\ttext-align: center;\n\t\tposition: absolute;\n\t\tbottom: 0px;\n\t\t", ";\n\t\tz-index: 1;\n\t\tleft: 50%;\n\t\ttransform: translateX(-50%);\n\t\twidth: 100%;\n\n\t\t.--default-error-element {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\talign-items: center;\n\t\t\tpadding: 10px;\n\t\t\tbackground-color: ", ";\n\t\t\tbox-shadow: 0 -5px 5px -2px\n\t\t\t\t", ";\n\n\t\t\tspan {\n\t\t\t\tmargin-bottom: 5px;\n\t\t\t}\n\n\t\t\tbutton {\n\t\t\t}\n\t\t}\n\t}\n\n\t", ";\n"])), function (props) {
|
|
838
838
|
return props.showInput ? 'bottom: 48px;' : '';
|
|
@@ -864,7 +864,7 @@ var resetCSS = function resetCSS(props) {
|
|
|
864
864
|
// eslint-disable-next-line no-nested-ternary
|
|
865
865
|
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: " + (
|
|
866
866
|
// eslint-disable-next-line no-nested-ternary
|
|
867
|
-
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";
|
|
867
|
+
props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor : props.theme.colors.primaryTextColor) + ";\n\t\ttext-shadow: none;\n\t}\n\n\tul,\n\tol {\n\t\tlist-style-position: inside;\n\t\tpadding-left: 10px;\n\n\t}\n\n\tli{\n\t\tdisplay: list-item;\n\t\tcursor: default;\n\t\tpadding: initial;\n\n\t\t&:hover{\n\t\t\tbackground-color: initial;\n\t\t}\n\t}\n\tp {\n\t\tmargin: inherit;\n\t}\n\n\t" + (props.themePreset === 'dark' && "a{\n\t\tcolor: cornflowerblue\n\t\t}") + ";\n";
|
|
868
868
|
};
|
|
869
869
|
var messageBGColor = function messageBGColor(props) {
|
|
870
870
|
var finalBGColor;
|
|
@@ -893,16 +893,10 @@ var Message = styled('div')(_templateObject7 || (_templateObject7 = _taggedTempl
|
|
|
893
893
|
return resetCSS(props);
|
|
894
894
|
});
|
|
895
895
|
var MessageInputContainer = styled('form')(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tpadding-top: 12px;\n\talign-items: stretch;\n\tmargin-top: 10px;\n\t.ai-enter-button-wrapper {\n\t\talign-self: baseline;\n\t\theight: 41px;\n\t}\n"])));
|
|
896
|
-
var MessageInput = styled(TextArea)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tborder-radius: 5px;\n\tborder: 1px solid #ccc;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\n\t
|
|
896
|
+
var MessageInput = styled(TextArea)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tborder-radius: 5px;\n\tborder: 1px solid #ccc;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\n\t", "\n\tpadding-left: 35px;\n"])), function (props) {
|
|
897
897
|
return props.themePreset === 'dark' ? props.theme.colors.borderColor : '#fff';
|
|
898
898
|
}, function (props) {
|
|
899
899
|
return props.themePreset === 'dark' ? props.theme.colors.titleColor : props.theme.colors.textColor;
|
|
900
|
-
}, function (props) {
|
|
901
|
-
return props.theme.colors.textColor;
|
|
902
|
-
}, function (props) {
|
|
903
|
-
return props.theme.colors.textColor;
|
|
904
|
-
}, function (props) {
|
|
905
|
-
return props.theme.colors.textColor;
|
|
906
900
|
}, function (_ref) {
|
|
907
901
|
var enterButton = _ref.enterButton;
|
|
908
902
|
return enterButton && "\n\t\t border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\t";
|
|
@@ -1183,7 +1177,8 @@ var SearchBox = defineComponent({
|
|
|
1183
1177
|
showFeedbackComponent: false,
|
|
1184
1178
|
feedbackState: null,
|
|
1185
1179
|
faqAnswer: '',
|
|
1186
|
-
faqQuestion: ''
|
|
1180
|
+
faqQuestion: '',
|
|
1181
|
+
initialHits: null
|
|
1187
1182
|
};
|
|
1188
1183
|
this.internalComponent = props.componentId + "__internal";
|
|
1189
1184
|
return this.__state;
|
|
@@ -1240,7 +1235,7 @@ var SearchBox = defineComponent({
|
|
|
1240
1235
|
if (Array.isArray(this.suggestions) && this.suggestions.length) {
|
|
1241
1236
|
suggestionsArray = [].concat(withClickIds(this.suggestions));
|
|
1242
1237
|
}
|
|
1243
|
-
if (this.renderTriggerMessage() && this.currentValue
|
|
1238
|
+
if (this.renderTriggerMessage() && this.currentValue) {
|
|
1244
1239
|
suggestionsArray.unshift({
|
|
1245
1240
|
label: this.renderTriggerMessage(),
|
|
1246
1241
|
value: 'AI_TRIGGER_MESSAGE',
|
|
@@ -1390,9 +1385,47 @@ var SearchBox = defineComponent({
|
|
|
1390
1385
|
AIUIConfig: types.AIUIConfig
|
|
1391
1386
|
},
|
|
1392
1387
|
mounted: function mounted() {
|
|
1388
|
+
var _this2 = this;
|
|
1393
1389
|
this.listenForFocusShortcuts();
|
|
1390
|
+
var dropdownEle = this.$refs[_dropdownULRef];
|
|
1391
|
+
if (dropdownEle) {
|
|
1392
|
+
var handleScroll = function handleScroll() {
|
|
1393
|
+
var scrollTop = dropdownEle.scrollTop;
|
|
1394
|
+
_this2.lastScrollTop = scrollTop;
|
|
1395
|
+
if (scrollTop < _this2.lastScrollTop) {
|
|
1396
|
+
// User is scrolling up
|
|
1397
|
+
clearInterval(_this2.scrollTimerRef);
|
|
1398
|
+
_this2.isUserScrolling = true;
|
|
1399
|
+
}
|
|
1400
|
+
// Update lastScrollTop with the current scroll position
|
|
1401
|
+
_this2.lastScrollTop = scrollTop;
|
|
1402
|
+
};
|
|
1403
|
+
dropdownEle.addEventListener('scroll', handleScroll);
|
|
1404
|
+
}
|
|
1405
|
+
},
|
|
1406
|
+
updated: function updated() {
|
|
1407
|
+
if (this.$props.mode === SEARCH_COMPONENTS_MODES.SELECT && this.$options.isTagsMode === true) {
|
|
1408
|
+
this.$options.isTagsMode = false;
|
|
1409
|
+
this.selectedTags = [];
|
|
1410
|
+
} else if (this.$props.mode === SEARCH_COMPONENTS_MODES.TAG && this.$options.isTagsMode === false) {
|
|
1411
|
+
this.$options.isTagsMode = true;
|
|
1412
|
+
}
|
|
1394
1413
|
},
|
|
1395
1414
|
watch: {
|
|
1415
|
+
AIResponse: function AIResponse(newVal) {
|
|
1416
|
+
if (newVal) {
|
|
1417
|
+
if (this.$props.AIUIConfig && this.$props.AIUIConfig.showSourceDocuments && newVal.response && newVal.response.answer && Array.isArray(newVal.response.answer.documentIds)) {
|
|
1418
|
+
this.sourceDocIds = newVal.response.answer.documentIds;
|
|
1419
|
+
var localCache = getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) && getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY)[this.$props.componentId];
|
|
1420
|
+
if (localCache && localCache.meta && localCache.meta.hits && localCache.meta.hits.hits) {
|
|
1421
|
+
this.initialHits = localCache.meta.hits.hits;
|
|
1422
|
+
}
|
|
1423
|
+
if (!this.showAIScreenFooter) {
|
|
1424
|
+
this.showAIScreenFooter = true;
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
},
|
|
1396
1429
|
dataField: function dataField(newVal, oldVal) {
|
|
1397
1430
|
if (!isEqual(newVal, oldVal)) {
|
|
1398
1431
|
this.triggerCustomQuery(this.$data.currentValue);
|
|
@@ -1467,6 +1500,9 @@ var SearchBox = defineComponent({
|
|
|
1467
1500
|
loading: this.isLoading,
|
|
1468
1501
|
error: this.isError
|
|
1469
1502
|
});
|
|
1503
|
+
if (newVal && newVal.hits && newVal.hits.hits) {
|
|
1504
|
+
this.initialHits = newVal.hits.hits;
|
|
1505
|
+
}
|
|
1470
1506
|
},
|
|
1471
1507
|
aggregationData: function aggregationData(newVal) {
|
|
1472
1508
|
this.$emit('on-data', {
|
|
@@ -1501,9 +1537,10 @@ var SearchBox = defineComponent({
|
|
|
1501
1537
|
}
|
|
1502
1538
|
},
|
|
1503
1539
|
isAITyping: function isAITyping(newVal, oldVal) {
|
|
1504
|
-
var
|
|
1540
|
+
var _this3 = this;
|
|
1505
1541
|
var scrollAIContainer = function scrollAIContainer() {
|
|
1506
|
-
|
|
1542
|
+
if (_this3.isUserScrolling) return;
|
|
1543
|
+
var dropdownEle = _this3.$refs[_dropdownULRef];
|
|
1507
1544
|
if (dropdownEle) {
|
|
1508
1545
|
dropdownEle.scrollTo({
|
|
1509
1546
|
top: dropdownEle.scrollHeight,
|
|
@@ -1512,6 +1549,7 @@ var SearchBox = defineComponent({
|
|
|
1512
1549
|
}
|
|
1513
1550
|
};
|
|
1514
1551
|
if (!newVal && oldVal) {
|
|
1552
|
+
clearInterval(this.scrollTimerRef);
|
|
1515
1553
|
this.showAIScreenFooter = true;
|
|
1516
1554
|
if (this.$props.AIUIConfig && typeof this.$props.AIUIConfig.showFeedback === 'boolean' ? this.$props.AIUIConfig.showFeedback : true) {
|
|
1517
1555
|
this.showFeedbackComponent = true;
|
|
@@ -1520,7 +1558,7 @@ var SearchBox = defineComponent({
|
|
|
1520
1558
|
scrollAIContainer();
|
|
1521
1559
|
}, 500);
|
|
1522
1560
|
} else if (newVal) {
|
|
1523
|
-
this.scrollTimerRef =
|
|
1561
|
+
this.scrollTimerRef = setInterval(function () {
|
|
1524
1562
|
scrollAIContainer();
|
|
1525
1563
|
}, 2000);
|
|
1526
1564
|
}
|
|
@@ -1537,7 +1575,7 @@ var SearchBox = defineComponent({
|
|
|
1537
1575
|
}
|
|
1538
1576
|
},
|
|
1539
1577
|
currentValue: function currentValue() {
|
|
1540
|
-
this.handleTextAreaHeightChange
|
|
1578
|
+
this.$nextTick(this.handleTextAreaHeightChange);
|
|
1541
1579
|
}
|
|
1542
1580
|
},
|
|
1543
1581
|
methods: {
|
|
@@ -1612,7 +1650,7 @@ var SearchBox = defineComponent({
|
|
|
1612
1650
|
}
|
|
1613
1651
|
},
|
|
1614
1652
|
setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue, shouldExecuteQuery) {
|
|
1615
|
-
var
|
|
1653
|
+
var _this4 = this;
|
|
1616
1654
|
if (isDefaultValue === void 0) {
|
|
1617
1655
|
isDefaultValue = false;
|
|
1618
1656
|
}
|
|
@@ -1629,65 +1667,65 @@ var SearchBox = defineComponent({
|
|
|
1629
1667
|
shouldExecuteQuery = true;
|
|
1630
1668
|
}
|
|
1631
1669
|
var performUpdate = function performUpdate() {
|
|
1632
|
-
if (
|
|
1670
|
+
if (_this4.$options.isTagsMode && isEqual(value, _this4.selectedTags)) {
|
|
1633
1671
|
return;
|
|
1634
1672
|
}
|
|
1635
|
-
if (
|
|
1636
|
-
if (Array.isArray(
|
|
1673
|
+
if (_this4.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
|
|
1674
|
+
if (Array.isArray(_this4.selectedTags) && _this4.selectedTags.length) {
|
|
1637
1675
|
// check if value already present in selectedTags
|
|
1638
|
-
if (typeof value === 'string' &&
|
|
1639
|
-
|
|
1676
|
+
if (typeof value === 'string' && _this4.selectedTags.includes(value)) {
|
|
1677
|
+
_this4.isOpen = false;
|
|
1640
1678
|
return;
|
|
1641
1679
|
}
|
|
1642
|
-
|
|
1680
|
+
_this4.selectedTags = [].concat(_this4.selectedTags);
|
|
1643
1681
|
if (typeof value === 'string' && !!value) {
|
|
1644
|
-
|
|
1645
|
-
} else if (Array.isArray(value) && !isEqual(
|
|
1646
|
-
|
|
1682
|
+
_this4.selectedTags.push(value);
|
|
1683
|
+
} else if (Array.isArray(value) && !isEqual(_this4.selectedTags, value)) {
|
|
1684
|
+
_this4.selectedTags = value;
|
|
1647
1685
|
}
|
|
1648
1686
|
} else if (value) {
|
|
1649
|
-
|
|
1687
|
+
_this4.selectedTags = typeof value !== 'string' ? value : [].concat(value);
|
|
1650
1688
|
}
|
|
1651
|
-
|
|
1689
|
+
_this4.currentValue = '';
|
|
1652
1690
|
} else {
|
|
1653
|
-
|
|
1691
|
+
_this4.currentValue = decodeHtml(value);
|
|
1654
1692
|
}
|
|
1655
1693
|
var queryHandlerValue = value;
|
|
1656
|
-
if (
|
|
1657
|
-
queryHandlerValue = Array.isArray(
|
|
1694
|
+
if (_this4.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
|
|
1695
|
+
queryHandlerValue = Array.isArray(_this4.selectedTags) && _this4.selectedTags.length ? _this4.selectedTags : undefined;
|
|
1658
1696
|
}
|
|
1659
|
-
if ((
|
|
1697
|
+
if ((_this4.faqAnswer || _this4.faqQuestion) && value === '') {
|
|
1660
1698
|
// Empty the previous state
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1699
|
+
_this4.faqAnswer = '';
|
|
1700
|
+
_this4.faqQuestion = '';
|
|
1701
|
+
_this4.showAIScreen = false;
|
|
1664
1702
|
}
|
|
1665
1703
|
if (isDefaultValue) {
|
|
1666
|
-
if (
|
|
1704
|
+
if (_this4.$props.autosuggest) {
|
|
1667
1705
|
if (toggleIsOpen) {
|
|
1668
|
-
|
|
1706
|
+
_this4.isOpen = false;
|
|
1669
1707
|
}
|
|
1670
|
-
if (typeof
|
|
1708
|
+
if (typeof _this4.currentValue === 'string') _this4.triggerDefaultQuery(_this4.currentValue, props.enableAI && _this4.currentTriggerMode === AI_TRIGGER_MODES.QUESTION && _this4.currentValue.endsWith('?') ? {
|
|
1671
1709
|
enableAI: true
|
|
1672
1710
|
} : {}, shouldExecuteQuery);
|
|
1673
1711
|
} // in case of strict selection only SUGGESTION_SELECT should be able
|
|
1674
1712
|
// to set the query otherwise the value should reset
|
|
1675
1713
|
if (props.strictSelection) {
|
|
1676
|
-
if (cause === causes.SUGGESTION_SELECT || (
|
|
1677
|
-
|
|
1714
|
+
if (cause === causes.SUGGESTION_SELECT || (_this4.$options.isTagsMode ? _this4.selectedTags.length === 0 : value === '')) {
|
|
1715
|
+
_this4.triggerCustomQuery(queryHandlerValue, _this4.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
|
|
1678
1716
|
} else {
|
|
1679
|
-
|
|
1717
|
+
_this4.setValue('', true);
|
|
1680
1718
|
}
|
|
1681
1719
|
} else if (props.value === undefined || cause === causes.SUGGESTION_SELECT || cause === causes.CLEAR_VALUE) {
|
|
1682
|
-
|
|
1683
|
-
|
|
1720
|
+
_this4.showAIScreen = false;
|
|
1721
|
+
_this4.triggerCustomQuery(queryHandlerValue, _this4.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
|
|
1684
1722
|
}
|
|
1685
1723
|
} else {
|
|
1686
1724
|
// debounce for handling text while typing
|
|
1687
|
-
|
|
1725
|
+
_this4.handleTextChange(value, cause);
|
|
1688
1726
|
}
|
|
1689
|
-
|
|
1690
|
-
|
|
1727
|
+
_this4.$emit('valueChange', value);
|
|
1728
|
+
_this4.$emit('value-change', value);
|
|
1691
1729
|
};
|
|
1692
1730
|
checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
|
|
1693
1731
|
},
|
|
@@ -1836,7 +1874,7 @@ var SearchBox = defineComponent({
|
|
|
1836
1874
|
this.$emit('key-down', event, this.triggerQuery);
|
|
1837
1875
|
},
|
|
1838
1876
|
onInputChange: function onInputChange(e) {
|
|
1839
|
-
var
|
|
1877
|
+
var _this5 = this;
|
|
1840
1878
|
var inputValue = e.target.value;
|
|
1841
1879
|
if (!this.$data.isOpen && this.$props.autosuggest) {
|
|
1842
1880
|
this.isOpen = true;
|
|
@@ -1850,7 +1888,7 @@ var SearchBox = defineComponent({
|
|
|
1850
1888
|
} else {
|
|
1851
1889
|
this.$emit('change', inputValue, function (_ref3) {
|
|
1852
1890
|
var isOpen = _ref3.isOpen;
|
|
1853
|
-
return
|
|
1891
|
+
return _this5.triggerQuery({
|
|
1854
1892
|
defaultQuery: true,
|
|
1855
1893
|
customQuery: true,
|
|
1856
1894
|
value: inputValue,
|
|
@@ -1894,7 +1932,7 @@ var SearchBox = defineComponent({
|
|
|
1894
1932
|
}
|
|
1895
1933
|
},
|
|
1896
1934
|
onSuggestionSelected: function onSuggestionSelected(suggestion) {
|
|
1897
|
-
var
|
|
1935
|
+
var _this6 = this;
|
|
1898
1936
|
var value = this.$props.value;
|
|
1899
1937
|
// The state of the suggestion is open by the time it reaches here. i.e. isOpen = true
|
|
1900
1938
|
// handle when FAQ suggestion is clicked
|
|
@@ -1943,10 +1981,10 @@ var SearchBox = defineComponent({
|
|
|
1943
1981
|
this.setValue(emitValue, true, this.$props, causes.SUGGESTION_SELECT, false, suggestion._category);
|
|
1944
1982
|
this.$emit('change', emitValue, function (_ref4) {
|
|
1945
1983
|
var isOpen = _ref4.isOpen;
|
|
1946
|
-
return
|
|
1984
|
+
return _this6.triggerQuery(_extends({
|
|
1947
1985
|
isOpen: isOpen,
|
|
1948
1986
|
value: emitValue
|
|
1949
|
-
}, !
|
|
1987
|
+
}, !_this6.$options.isTagsMode && {
|
|
1950
1988
|
categoryValue: suggestion._category
|
|
1951
1989
|
}));
|
|
1952
1990
|
});
|
|
@@ -1986,7 +2024,7 @@ var SearchBox = defineComponent({
|
|
|
1986
2024
|
return null;
|
|
1987
2025
|
},
|
|
1988
2026
|
renderErrorComponent: function renderErrorComponent(isAIError) {
|
|
1989
|
-
var
|
|
2027
|
+
var _this7 = this;
|
|
1990
2028
|
if (isAIError === void 0) {
|
|
1991
2029
|
isAIError = false;
|
|
1992
2030
|
}
|
|
@@ -2013,7 +2051,7 @@ var SearchBox = defineComponent({
|
|
|
2013
2051
|
"themePreset": this.themePreset
|
|
2014
2052
|
}, {
|
|
2015
2053
|
"default": function _default() {
|
|
2016
|
-
return [isFunction(renderError) ? renderError(
|
|
2054
|
+
return [isFunction(renderError) ? renderError(_this7.error) : renderError];
|
|
2017
2055
|
}
|
|
2018
2056
|
});
|
|
2019
2057
|
}
|
|
@@ -2093,7 +2131,7 @@ var SearchBox = defineComponent({
|
|
|
2093
2131
|
});
|
|
2094
2132
|
},
|
|
2095
2133
|
renderEnterButtonElement: function renderEnterButtonElement() {
|
|
2096
|
-
var
|
|
2134
|
+
var _this8 = this;
|
|
2097
2135
|
var _this$$props2 = this.$props,
|
|
2098
2136
|
enterButton = _this$$props2.enterButton,
|
|
2099
2137
|
innerClass = _this$$props2.innerClass;
|
|
@@ -2101,12 +2139,12 @@ var SearchBox = defineComponent({
|
|
|
2101
2139
|
if (enterButton) {
|
|
2102
2140
|
var getEnterButtonMarkup = function getEnterButtonMarkup() {
|
|
2103
2141
|
if (renderEnterButton) {
|
|
2104
|
-
return renderEnterButton(
|
|
2142
|
+
return renderEnterButton(_this8.enterButtonOnClick);
|
|
2105
2143
|
}
|
|
2106
2144
|
return createVNode(Button, {
|
|
2107
2145
|
"class": "enter-btn " + getClassName$1(innerClass, 'enter-button'),
|
|
2108
2146
|
"primary": true,
|
|
2109
|
-
"onClick":
|
|
2147
|
+
"onClick": _this8.enterButtonOnClick
|
|
2110
2148
|
}, {
|
|
2111
2149
|
"default": function _default() {
|
|
2112
2150
|
return [createTextVNode("Search")];
|
|
@@ -2132,7 +2170,7 @@ var SearchBox = defineComponent({
|
|
|
2132
2170
|
return '/';
|
|
2133
2171
|
},
|
|
2134
2172
|
renderLeftIcons: function renderLeftIcons() {
|
|
2135
|
-
var
|
|
2173
|
+
var _this9 = this;
|
|
2136
2174
|
var _slot3;
|
|
2137
2175
|
var _this$$props3 = this.$props,
|
|
2138
2176
|
iconPosition = _this$$props3.iconPosition,
|
|
@@ -2142,8 +2180,8 @@ var SearchBox = defineComponent({
|
|
|
2142
2180
|
}, {
|
|
2143
2181
|
"default": function _default() {
|
|
2144
2182
|
return [iconPosition === 'left' && showIcon && createVNode(IconWrapper, {
|
|
2145
|
-
"onClick":
|
|
2146
|
-
}, _isSlot(_slot3 =
|
|
2183
|
+
"onClick": _this9.handleSearchIconClick
|
|
2184
|
+
}, _isSlot(_slot3 = _this9.renderIcon()) ? _slot3 : {
|
|
2147
2185
|
"default": function _default() {
|
|
2148
2186
|
return [_slot3];
|
|
2149
2187
|
}
|
|
@@ -2152,7 +2190,7 @@ var SearchBox = defineComponent({
|
|
|
2152
2190
|
})]);
|
|
2153
2191
|
},
|
|
2154
2192
|
renderRightIcons: function renderRightIcons() {
|
|
2155
|
-
var
|
|
2193
|
+
var _this10 = this;
|
|
2156
2194
|
var _slot4, _slot5, _slot6;
|
|
2157
2195
|
var _this$$props4 = this.$props,
|
|
2158
2196
|
iconPosition = _this$$props4.iconPosition,
|
|
@@ -2169,29 +2207,29 @@ var SearchBox = defineComponent({
|
|
|
2169
2207
|
}, {
|
|
2170
2208
|
"default": function _default() {
|
|
2171
2209
|
return [currentValue && showClear && createVNode(IconWrapper, {
|
|
2172
|
-
"onClick":
|
|
2210
|
+
"onClick": _this10.clearValue,
|
|
2173
2211
|
"showIcon": showIcon,
|
|
2174
2212
|
"isClearIcon": true
|
|
2175
|
-
}, _isSlot(_slot4 =
|
|
2213
|
+
}, _isSlot(_slot4 = _this10.renderCancelIcon()) ? _slot4 : {
|
|
2176
2214
|
"default": function _default() {
|
|
2177
2215
|
return [_slot4];
|
|
2178
2216
|
}
|
|
2179
2217
|
}), showFocusShortcutsIcon && createVNode(ButtonIconWrapper, {
|
|
2180
2218
|
"onClick": function onClick(e) {
|
|
2181
|
-
return
|
|
2219
|
+
return _this10.focusSearchBox(e);
|
|
2182
2220
|
}
|
|
2183
|
-
}, _isSlot(_slot5 =
|
|
2221
|
+
}, _isSlot(_slot5 = _this10.renderShortcut()) ? _slot5 : {
|
|
2184
2222
|
"default": function _default() {
|
|
2185
2223
|
return [_slot5];
|
|
2186
2224
|
}
|
|
2187
2225
|
}), showVoiceSearch && createVNode(Mic, {
|
|
2188
2226
|
"getInstance": getMicInstance,
|
|
2189
2227
|
"render": renderMic,
|
|
2190
|
-
"handleResult":
|
|
2228
|
+
"handleResult": _this10.handleVoiceResults,
|
|
2191
2229
|
"className": getClassName$1(innerClass, 'mic') || null
|
|
2192
2230
|
}, null), iconPosition === 'right' && showIcon && createVNode(IconWrapper, {
|
|
2193
|
-
"onClick":
|
|
2194
|
-
}, _isSlot(_slot6 =
|
|
2231
|
+
"onClick": _this10.handleSearchIconClick
|
|
2232
|
+
}, _isSlot(_slot6 = _this10.renderIcon()) ? _slot6 : {
|
|
2195
2233
|
"default": function _default() {
|
|
2196
2234
|
return [_slot6];
|
|
2197
2235
|
}
|
|
@@ -2210,7 +2248,7 @@ var SearchBox = defineComponent({
|
|
|
2210
2248
|
(_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
|
|
2211
2249
|
},
|
|
2212
2250
|
listenForFocusShortcuts: function listenForFocusShortcuts() {
|
|
2213
|
-
var
|
|
2251
|
+
var _this11 = this;
|
|
2214
2252
|
var _this$$props$focusSho = this.$props.focusShortcuts,
|
|
2215
2253
|
focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
|
|
2216
2254
|
if (isEmpty(focusShortcuts)) {
|
|
@@ -2225,7 +2263,7 @@ var SearchBox = defineComponent({
|
|
|
2225
2263
|
function (event, handler) {
|
|
2226
2264
|
// Prevent the default refresh event under WINDOWS system
|
|
2227
2265
|
event.preventDefault();
|
|
2228
|
-
|
|
2266
|
+
_this11.focusSearchBox(event);
|
|
2229
2267
|
});
|
|
2230
2268
|
|
|
2231
2269
|
// if one of modifier keys are used, they are handled below
|
|
@@ -2235,7 +2273,7 @@ var SearchBox = defineComponent({
|
|
|
2235
2273
|
for (var index = 0; index < modifierKeys.length; index += 1) {
|
|
2236
2274
|
var element = modifierKeys[index];
|
|
2237
2275
|
if (hotkeys[element]) {
|
|
2238
|
-
|
|
2276
|
+
_this11.focusSearchBox(event);
|
|
2239
2277
|
break;
|
|
2240
2278
|
}
|
|
2241
2279
|
}
|
|
@@ -2248,10 +2286,10 @@ var SearchBox = defineComponent({
|
|
|
2248
2286
|
this.triggerDefaultQuery(value);
|
|
2249
2287
|
},
|
|
2250
2288
|
renderActionIcon: function renderActionIcon(suggestion) {
|
|
2251
|
-
var
|
|
2289
|
+
var _this12 = this;
|
|
2252
2290
|
var handleAutoFillClick = function handleAutoFillClick(e) {
|
|
2253
2291
|
e.stopPropagation();
|
|
2254
|
-
|
|
2292
|
+
_this12.onAutofillClick(suggestion);
|
|
2255
2293
|
};
|
|
2256
2294
|
if (suggestion._suggestion_type === suggestionTypes.Featured) {
|
|
2257
2295
|
if (suggestion.action === featuredSuggestionsActionTypes.FUNCTION) {
|
|
@@ -2274,7 +2312,7 @@ var SearchBox = defineComponent({
|
|
|
2274
2312
|
return null;
|
|
2275
2313
|
},
|
|
2276
2314
|
renderTag: function renderTag(item) {
|
|
2277
|
-
var
|
|
2315
|
+
var _this13 = this;
|
|
2278
2316
|
var innerClass = this.$props.innerClass;
|
|
2279
2317
|
return createVNode(TagItem, {
|
|
2280
2318
|
"class": getClassName$1(innerClass, 'selected-tag') || ''
|
|
@@ -2285,7 +2323,7 @@ var SearchBox = defineComponent({
|
|
|
2285
2323
|
"aria-label": "delete-tag",
|
|
2286
2324
|
"class": "close-icon",
|
|
2287
2325
|
"onClick": function onClick() {
|
|
2288
|
-
return
|
|
2326
|
+
return _this13.clearTag(item);
|
|
2289
2327
|
}
|
|
2290
2328
|
}, [createVNode(CancelSvg, null, null)])];
|
|
2291
2329
|
}
|
|
@@ -2308,7 +2346,7 @@ var SearchBox = defineComponent({
|
|
|
2308
2346
|
}
|
|
2309
2347
|
},
|
|
2310
2348
|
renderTags: function renderTags() {
|
|
2311
|
-
var
|
|
2349
|
+
var _this14 = this;
|
|
2312
2350
|
if (!Array.isArray(this.selectedTags)) {
|
|
2313
2351
|
return null;
|
|
2314
2352
|
}
|
|
@@ -2322,16 +2360,16 @@ var SearchBox = defineComponent({
|
|
|
2322
2360
|
}) : createVNode(TagsContainer, null, {
|
|
2323
2361
|
"default": function _default() {
|
|
2324
2362
|
return [tagsList.map(function (item) {
|
|
2325
|
-
return
|
|
2363
|
+
return _this14.renderTag(item);
|
|
2326
2364
|
}), shouldRenderClearAllTag && createVNode(TagItem, {
|
|
2327
|
-
"class": getClassName$1(
|
|
2365
|
+
"class": getClassName$1(_this14.$props.innerClass, 'selected-tag') || ''
|
|
2328
2366
|
}, {
|
|
2329
2367
|
"default": function _default() {
|
|
2330
2368
|
return [createVNode("span", null, [createTextVNode("Clear All")]), createVNode("span", {
|
|
2331
2369
|
"role": "img",
|
|
2332
2370
|
"aria-label": "delete-tag",
|
|
2333
2371
|
"class": "close-icon",
|
|
2334
|
-
"onClick":
|
|
2372
|
+
"onClick": _this14.clearAllTags
|
|
2335
2373
|
}, [createVNode(CancelSvg, null, null)])];
|
|
2336
2374
|
}
|
|
2337
2375
|
})];
|
|
@@ -2339,13 +2377,13 @@ var SearchBox = defineComponent({
|
|
|
2339
2377
|
});
|
|
2340
2378
|
},
|
|
2341
2379
|
getAISourceObjects: function getAISourceObjects() {
|
|
2342
|
-
var
|
|
2380
|
+
var _this15 = this;
|
|
2343
2381
|
var sourceObjects = [];
|
|
2344
2382
|
if (!this.AIResponse) return sourceObjects;
|
|
2345
2383
|
var docIds = this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [];
|
|
2346
|
-
if (
|
|
2384
|
+
if (this.initialHits) {
|
|
2347
2385
|
docIds.forEach(function (id) {
|
|
2348
|
-
var foundSourceObj =
|
|
2386
|
+
var foundSourceObj = _this15.initialHits.find(function (hit) {
|
|
2349
2387
|
return hit._id === id;
|
|
2350
2388
|
}) || {};
|
|
2351
2389
|
if (foundSourceObj) {
|
|
@@ -2379,31 +2417,31 @@ var SearchBox = defineComponent({
|
|
|
2379
2417
|
},
|
|
2380
2418
|
renderAIScreenFooter: function renderAIScreenFooter() {
|
|
2381
2419
|
var _slot8;
|
|
2382
|
-
var
|
|
2420
|
+
var _this16 = this;
|
|
2383
2421
|
var _this$$props$AIUIConf2 = this.$props.AIUIConfig,
|
|
2384
2422
|
AIUIConfig = _this$$props$AIUIConf2 === void 0 ? {} : _this$$props$AIUIConf2;
|
|
2385
2423
|
var _ref6 = AIUIConfig || {},
|
|
2386
2424
|
_ref6$showSourceDocum = _ref6.showSourceDocuments,
|
|
2387
|
-
showSourceDocuments = _ref6$showSourceDocum === void 0 ?
|
|
2425
|
+
showSourceDocuments = _ref6$showSourceDocum === void 0 ? false : _ref6$showSourceDocum,
|
|
2388
2426
|
_ref6$onSourceClick = _ref6.onSourceClick,
|
|
2389
2427
|
onSourceClick = _ref6$onSourceClick === void 0 ? function () {} : _ref6$onSourceClick;
|
|
2390
2428
|
var renderSourceDocumentLabel = function renderSourceDocumentLabel(sourceObj) {
|
|
2391
|
-
if (
|
|
2392
|
-
return
|
|
2429
|
+
if (_this16.$props.AIUIConfig && _this16.$props.AIUIConfig.renderSourceDocument) {
|
|
2430
|
+
return _this16.$props.AIUIConfig.renderSourceDocument(sourceObj);
|
|
2393
2431
|
}
|
|
2394
|
-
if (
|
|
2395
|
-
return
|
|
2432
|
+
if (_this16.$slots.renderSourceDocument) {
|
|
2433
|
+
return _this16.$slots.renderSourceDocument(sourceObj);
|
|
2396
2434
|
}
|
|
2397
2435
|
return sourceObj._id;
|
|
2398
2436
|
};
|
|
2399
|
-
return showSourceDocuments && this.showAIScreenFooter && this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds ? createVNode(Footer, {
|
|
2437
|
+
return showSourceDocuments && this.showAIScreenFooter && this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds && this.AIResponse.response.answer.documentIds.length ? createVNode(Footer, {
|
|
2400
2438
|
"themePreset": this.$props.themePreset
|
|
2401
2439
|
}, {
|
|
2402
2440
|
"default": function _default() {
|
|
2403
|
-
return [createTextVNode("Summary generated using the following sources:"), ' ', createVNode(SourceTags, null, _isSlot(_slot8 =
|
|
2441
|
+
return [createTextVNode("Summary generated using the following sources:"), ' ', createVNode(SourceTags, null, _isSlot(_slot8 = _this16.getAISourceObjects().map(function (el) {
|
|
2404
2442
|
var _slot7;
|
|
2405
2443
|
return createVNode(Button, {
|
|
2406
|
-
"class": "--ai-source-tag " + (getClassName$1(
|
|
2444
|
+
"class": "--ai-source-tag " + (getClassName$1(_this16.$props.innerClass, 'ai-source-tag') || ''),
|
|
2407
2445
|
"info": true,
|
|
2408
2446
|
"onClick": function onClick() {
|
|
2409
2447
|
return onSourceClick && onSourceClick(el);
|
|
@@ -2422,7 +2460,7 @@ var SearchBox = defineComponent({
|
|
|
2422
2460
|
}) : null;
|
|
2423
2461
|
},
|
|
2424
2462
|
renderAIScreen: function renderAIScreen() {
|
|
2425
|
-
var
|
|
2463
|
+
var _this17 = this;
|
|
2426
2464
|
var customAIRenderer = this.$props.renderAIAnswer || this.$slots.renderAIAnswer;
|
|
2427
2465
|
if (customAIRenderer) {
|
|
2428
2466
|
return customAIRenderer({
|
|
@@ -2446,11 +2484,11 @@ var SearchBox = defineComponent({
|
|
|
2446
2484
|
"hideUI": this.isAIResponseLoading || this.isLoading || !this.sessionIdFromStore,
|
|
2447
2485
|
"key": this.sessionIdFromStore,
|
|
2448
2486
|
"onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
|
|
2449
|
-
|
|
2487
|
+
_this17.feedbackState = {
|
|
2450
2488
|
isRecorded: true,
|
|
2451
2489
|
feedbackType: useful ? 'positive' : 'negative'
|
|
2452
2490
|
};
|
|
2453
|
-
|
|
2491
|
+
_this17.recordAISessionUsefulness(_this17.sessionIdFromStore, {
|
|
2454
2492
|
useful: useful,
|
|
2455
2493
|
reason: reason
|
|
2456
2494
|
});
|
|
@@ -2485,7 +2523,7 @@ var SearchBox = defineComponent({
|
|
|
2485
2523
|
});
|
|
2486
2524
|
},
|
|
2487
2525
|
renderAskButtonElement: function renderAskButtonElement() {
|
|
2488
|
-
var
|
|
2526
|
+
var _this18 = this;
|
|
2489
2527
|
var _this$$props5 = this.$props,
|
|
2490
2528
|
AIUIConfig = _this$$props5.AIUIConfig,
|
|
2491
2529
|
innerClass = _this$$props5.innerClass;
|
|
@@ -2495,12 +2533,12 @@ var SearchBox = defineComponent({
|
|
|
2495
2533
|
if (askButton) {
|
|
2496
2534
|
var getEnterButtonMarkup = function getEnterButtonMarkup() {
|
|
2497
2535
|
if (renderAskButton) {
|
|
2498
|
-
return renderAskButton(
|
|
2536
|
+
return renderAskButton(_this18.askButtonOnClick);
|
|
2499
2537
|
}
|
|
2500
2538
|
return createVNode(Button, {
|
|
2501
2539
|
"class": "enter-btn " + getClassName$1(innerClass, 'ask-button'),
|
|
2502
2540
|
"info": true,
|
|
2503
|
-
"onClick":
|
|
2541
|
+
"onClick": _this18.askButtonOnClick
|
|
2504
2542
|
}, {
|
|
2505
2543
|
"default": function _default() {
|
|
2506
2544
|
return [createTextVNode("Ask")];
|
|
@@ -2515,28 +2553,28 @@ var SearchBox = defineComponent({
|
|
|
2515
2553
|
}
|
|
2516
2554
|
},
|
|
2517
2555
|
render: function render() {
|
|
2518
|
-
var
|
|
2556
|
+
var _this19 = this;
|
|
2519
2557
|
var expandSuggestionsContainer = this.$props.expandSuggestionsContainer;
|
|
2520
2558
|
var _this$$slots = this.$slots,
|
|
2521
2559
|
recentSearchesIcon = _this$$slots.recentSearchesIcon,
|
|
2522
2560
|
popularSearchesIcon = _this$$slots.popularSearchesIcon;
|
|
2523
|
-
var hasSuggestions = Array.isArray(this.
|
|
2561
|
+
var hasSuggestions = Array.isArray(this.parsedSuggestions) && this.parsedSuggestions.length;
|
|
2524
2562
|
var renderItem = this.$slots.renderItem || this.$props.renderItem;
|
|
2525
2563
|
return createVNode(Container, {
|
|
2526
2564
|
"class": this.$props.className
|
|
2527
2565
|
}, {
|
|
2528
2566
|
"default": function _default() {
|
|
2529
|
-
return [
|
|
2530
|
-
"class": getClassName$1(
|
|
2567
|
+
return [_this19.$props.title && createVNode(Title, {
|
|
2568
|
+
"class": getClassName$1(_this19.$props.innerClass, 'title') || ''
|
|
2531
2569
|
}, {
|
|
2532
2570
|
"default": function _default() {
|
|
2533
|
-
return [
|
|
2571
|
+
return [_this19.$props.title];
|
|
2534
2572
|
}
|
|
2535
|
-
}),
|
|
2536
|
-
"id":
|
|
2537
|
-
"handleChange":
|
|
2538
|
-
"handleMouseup":
|
|
2539
|
-
"isOpen":
|
|
2573
|
+
}), _this19.$props.autosuggest ? createVNode(Downshift, {
|
|
2574
|
+
"id": _this19.$props.componentId + "-downshift",
|
|
2575
|
+
"handleChange": _this19.onSuggestionSelected,
|
|
2576
|
+
"handleMouseup": _this19.handleStateChange,
|
|
2577
|
+
"isOpen": _this19.$data.isOpen
|
|
2540
2578
|
}, {
|
|
2541
2579
|
"default": function _default(_ref8) {
|
|
2542
2580
|
var getInputEvents = _ref8.getInputEvents,
|
|
@@ -2592,21 +2630,21 @@ var SearchBox = defineComponent({
|
|
|
2592
2630
|
}
|
|
2593
2631
|
};
|
|
2594
2632
|
var indexOffset = 0;
|
|
2595
|
-
return createVNode("div", null, [
|
|
2633
|
+
return createVNode("div", null, [_this19.hasCustomRenderer && _this19.getComponent({
|
|
2596
2634
|
isOpen: isOpen,
|
|
2597
2635
|
getItemProps: getItemProps,
|
|
2598
2636
|
getItemEvents: getItemEvents,
|
|
2599
2637
|
highlightedIndex: highlightedIndex
|
|
2600
|
-
}),
|
|
2601
|
-
"class": suggestions(
|
|
2638
|
+
}), _this19.renderErrorComponent(), !_this19.hasCustomRenderer && isOpen && hasSuggestions ? createVNode("ul", {
|
|
2639
|
+
"class": suggestions(_this19.themePreset, _this19.theme) + " " + getClassName$1(_this19.$props.innerClass, 'list') + " " + searchboxSuggestions(_this19.themePreset, _this19.theme) + "\n\t\t\t\t\t\t\t\t\t\t\t\t\t",
|
|
2602
2640
|
"ref": _dropdownULRef
|
|
2603
|
-
}, [
|
|
2604
|
-
"themePreset":
|
|
2641
|
+
}, [_this19.showAIScreen && createVNode(SearchBoxAISection, {
|
|
2642
|
+
"themePreset": _this19.$props.themePreset
|
|
2605
2643
|
}, {
|
|
2606
2644
|
"default": function _default() {
|
|
2607
|
-
return [
|
|
2645
|
+
return [_this19.renderAIScreen(), ' ', _this19.renderErrorComponent(true)];
|
|
2608
2646
|
}
|
|
2609
|
-
}), !
|
|
2647
|
+
}), !_this19.showAIScreen && _this19.parsedSuggestions.map(function (item, itemIndex) {
|
|
2610
2648
|
var index = indexOffset + itemIndex;
|
|
2611
2649
|
if (Array.isArray(item)) {
|
|
2612
2650
|
var sectionHtml = xss(item[0].sectionLabel);
|
|
@@ -2615,7 +2653,7 @@ var SearchBox = defineComponent({
|
|
|
2615
2653
|
"key": "section-" + itemIndex,
|
|
2616
2654
|
"class": "section-container"
|
|
2617
2655
|
}, [sectionHtml ? createVNode("div", {
|
|
2618
|
-
"class": "section-header " + getClassName$1(
|
|
2656
|
+
"class": "section-header " + getClassName$1(_this19.$props.innerClass, 'section-label'),
|
|
2619
2657
|
"key": "" + item[0].sectionId,
|
|
2620
2658
|
"innerHTML": sectionHtml
|
|
2621
2659
|
}, null) : null, createVNode("ul", {
|
|
@@ -2635,7 +2673,7 @@ var SearchBox = defineComponent({
|
|
|
2635
2673
|
justifyContent: 'flex-start',
|
|
2636
2674
|
alignItems: 'center'
|
|
2637
2675
|
},
|
|
2638
|
-
"class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(
|
|
2676
|
+
"class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this19.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this19.$props.innerClass, 'suggestion-item'))
|
|
2639
2677
|
}), [renderItem(sectionItem)]);
|
|
2640
2678
|
}
|
|
2641
2679
|
if (sectionItem._suggestion_type === '_internal_a_i_trigger') {
|
|
@@ -2649,9 +2687,9 @@ var SearchBox = defineComponent({
|
|
|
2649
2687
|
justifyContent: 'flex-start',
|
|
2650
2688
|
alignItems: 'center'
|
|
2651
2689
|
},
|
|
2652
|
-
"class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(
|
|
2690
|
+
"class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this19.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this19.$props.innerClass, 'suggestion-item'))
|
|
2653
2691
|
}), [createVNode(SuggestionItem, {
|
|
2654
|
-
"currentValue":
|
|
2692
|
+
"currentValue": _this19.currentValue,
|
|
2655
2693
|
"suggestion": sectionItem
|
|
2656
2694
|
}, null)]);
|
|
2657
2695
|
}
|
|
@@ -2665,7 +2703,7 @@ var SearchBox = defineComponent({
|
|
|
2665
2703
|
justifyContent: 'flex-start',
|
|
2666
2704
|
alignItems: 'center'
|
|
2667
2705
|
},
|
|
2668
|
-
"class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(
|
|
2706
|
+
"class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this19.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this19.$props.innerClass, 'suggestion-item'))
|
|
2669
2707
|
}), [createVNode("div", {
|
|
2670
2708
|
"style": {
|
|
2671
2709
|
padding: '0 10px 0 0',
|
|
@@ -2673,74 +2711,74 @@ var SearchBox = defineComponent({
|
|
|
2673
2711
|
}
|
|
2674
2712
|
}, [createVNode(CustomSvg, {
|
|
2675
2713
|
"key": sectionItem._suggestion_type + "-" + sectionIndex,
|
|
2676
|
-
"className": getClassName$1(
|
|
2714
|
+
"className": getClassName$1(_this19.$props.innerClass, sectionItem._suggestion_type + "-search-icon") || null,
|
|
2677
2715
|
"icon": getIcon(sectionItem._suggestion_type, sectionItem, suggestionsHaveIcon),
|
|
2678
2716
|
"type": sectionItem._suggestion_type + "-search-icon"
|
|
2679
2717
|
}, null)]), createVNode(SuggestionItem, {
|
|
2680
|
-
"currentValue":
|
|
2718
|
+
"currentValue": _this19.currentValue,
|
|
2681
2719
|
"suggestion": sectionItem
|
|
2682
|
-
}, null),
|
|
2720
|
+
}, null), _this19.renderActionIcon(sectionItem)]);
|
|
2683
2721
|
})])]);
|
|
2684
2722
|
}
|
|
2685
2723
|
return createVNode("div", null, [createTextVNode("No suggestions")]);
|
|
2686
|
-
}), !
|
|
2724
|
+
}), !_this19.showAIScreen && _this19.parsedSuggestions.length && _this19.$props.showSuggestionsFooter ? _this19.suggestionsFooter() : null]) : _this19.renderNoSuggestions(_this19.normalizedSuggestions)]);
|
|
2687
2725
|
};
|
|
2688
2726
|
return createVNode("div", {
|
|
2689
2727
|
"class": suggestionsContainer
|
|
2690
2728
|
}, [createVNode(InputGroup, {
|
|
2691
2729
|
"searchBox": true,
|
|
2692
2730
|
"ref": _inputGroupRef,
|
|
2693
|
-
"isOpen":
|
|
2731
|
+
"isOpen": _this19.$data.isOpen
|
|
2694
2732
|
}, {
|
|
2695
2733
|
"default": function _default() {
|
|
2696
2734
|
return [createVNode(Actions$1, null, {
|
|
2697
2735
|
"default": function _default() {
|
|
2698
|
-
return [
|
|
2736
|
+
return [_this19.renderInputAddonBefore(), _this19.renderLeftIcons()];
|
|
2699
2737
|
}
|
|
2700
2738
|
}), createVNode(InputWrapper, null, {
|
|
2701
2739
|
"default": function _default() {
|
|
2702
2740
|
return [createVNode(TextArea, mergeProps(_transformOn(getInputEvents({
|
|
2703
|
-
onInput:
|
|
2741
|
+
onInput: _this19.onInputChange,
|
|
2704
2742
|
onBlur: function onBlur(e) {
|
|
2705
|
-
|
|
2743
|
+
_this19.$emit('blur', e, _this19.triggerQuery);
|
|
2706
2744
|
},
|
|
2707
|
-
onFocus:
|
|
2745
|
+
onFocus: _this19.handleFocus,
|
|
2708
2746
|
onKeyPress: function onKeyPress(e) {
|
|
2709
|
-
|
|
2710
|
-
|
|
2747
|
+
_this19.$emit('keyPress', e, _this19.triggerQuery);
|
|
2748
|
+
_this19.$emit('key-press', e, _this19.triggerQuery);
|
|
2711
2749
|
},
|
|
2712
2750
|
onKeyDown: function onKeyDown(e) {
|
|
2713
|
-
return
|
|
2751
|
+
return _this19.handleKeyDown(e, highlightedIndex);
|
|
2714
2752
|
},
|
|
2715
2753
|
onKeyUp: function onKeyUp(e) {
|
|
2716
|
-
|
|
2717
|
-
|
|
2754
|
+
_this19.$emit('keyUp', e, _this19.triggerQuery);
|
|
2755
|
+
_this19.$emit('key-up', e, _this19.triggerQuery);
|
|
2718
2756
|
},
|
|
2719
2757
|
onClick: function onClick() {
|
|
2720
2758
|
setHighlightedIndex(null);
|
|
2721
2759
|
}
|
|
2722
2760
|
})), {
|
|
2723
2761
|
"searchBox": true,
|
|
2724
|
-
"isOpen":
|
|
2725
|
-
"id":
|
|
2726
|
-
"ref":
|
|
2727
|
-
"class": getClassName$1(
|
|
2728
|
-
"placeholder":
|
|
2729
|
-
"autoFocus":
|
|
2762
|
+
"isOpen": _this19.$data.isOpen,
|
|
2763
|
+
"id": _this19.$props.componentId + "-input",
|
|
2764
|
+
"ref": _this19.$props.innerRef,
|
|
2765
|
+
"class": getClassName$1(_this19.$props.innerClass, 'input'),
|
|
2766
|
+
"placeholder": _this19.$props.placeholder,
|
|
2767
|
+
"autoFocus": _this19.$props.autoFocus
|
|
2730
2768
|
}, getInputProps({
|
|
2731
|
-
value:
|
|
2769
|
+
value: _this19.$data.currentValue === null ? '' : _this19.$data.currentValue
|
|
2732
2770
|
}), {
|
|
2733
|
-
"themePreset":
|
|
2771
|
+
"themePreset": _this19.themePreset,
|
|
2734
2772
|
"autocomplete": "off"
|
|
2735
2773
|
}), null), !expandSuggestionsContainer && renderSuggestionsDropdown()];
|
|
2736
2774
|
}
|
|
2737
2775
|
}), createVNode(Actions$1, null, {
|
|
2738
2776
|
"default": function _default() {
|
|
2739
|
-
return [
|
|
2777
|
+
return [_this19.renderRightIcons(), _this19.renderInputAddonAfter(), _this19.renderAskButtonElement(), _this19.renderEnterButtonElement()];
|
|
2740
2778
|
}
|
|
2741
2779
|
})];
|
|
2742
2780
|
}
|
|
2743
|
-
}), expandSuggestionsContainer && renderSuggestionsDropdown(),
|
|
2781
|
+
}), expandSuggestionsContainer && renderSuggestionsDropdown(), _this19.renderTags()]);
|
|
2744
2782
|
}
|
|
2745
2783
|
}) : createVNode("div", {
|
|
2746
2784
|
"class": suggestionsContainer
|
|
@@ -2751,43 +2789,43 @@ var SearchBox = defineComponent({
|
|
|
2751
2789
|
"default": function _default() {
|
|
2752
2790
|
return [createVNode(Actions$1, null, {
|
|
2753
2791
|
"default": function _default() {
|
|
2754
|
-
return [
|
|
2792
|
+
return [_this19.renderInputAddonBefore(), _this19.renderLeftIcons()];
|
|
2755
2793
|
}
|
|
2756
2794
|
}), createVNode(InputWrapper, null, {
|
|
2757
2795
|
"default": function _default() {
|
|
2758
2796
|
return [createVNode(TextArea, mergeProps(_transformOn({
|
|
2759
2797
|
blur: function blur(e) {
|
|
2760
|
-
|
|
2798
|
+
_this19.$emit('blur', e, _this19.triggerQuery);
|
|
2761
2799
|
},
|
|
2762
2800
|
keypress: function keypress(e) {
|
|
2763
|
-
|
|
2764
|
-
|
|
2801
|
+
_this19.$emit('keyPress', e, _this19.triggerQuery);
|
|
2802
|
+
_this19.$emit('key-press', e, _this19.triggerQuery);
|
|
2765
2803
|
},
|
|
2766
|
-
input:
|
|
2804
|
+
input: _this19.onInputChange,
|
|
2767
2805
|
focus: function focus(e) {
|
|
2768
|
-
|
|
2806
|
+
_this19.$emit('focus', e, _this19.triggerQuery);
|
|
2769
2807
|
},
|
|
2770
|
-
keydown:
|
|
2808
|
+
keydown: _this19.handleKeyDown,
|
|
2771
2809
|
keyup: function keyup(e) {
|
|
2772
|
-
|
|
2773
|
-
|
|
2810
|
+
_this19.$emit('keyUp', e, _this19.triggerQuery);
|
|
2811
|
+
_this19.$emit('key-up', e, _this19.triggerQuery);
|
|
2774
2812
|
}
|
|
2775
2813
|
}), {
|
|
2776
2814
|
"searchBox": true,
|
|
2777
|
-
"class": getClassName$1(
|
|
2778
|
-
"placeholder":
|
|
2779
|
-
"autofocus":
|
|
2780
|
-
"value":
|
|
2781
|
-
"iconPosition":
|
|
2782
|
-
"showIcon":
|
|
2783
|
-
"showClear":
|
|
2784
|
-
"ref":
|
|
2785
|
-
"themePreset":
|
|
2815
|
+
"class": getClassName$1(_this19.$props.innerClass, 'input') || '',
|
|
2816
|
+
"placeholder": _this19.$props.placeholder,
|
|
2817
|
+
"autofocus": _this19.$props.autoFocus,
|
|
2818
|
+
"value": _this19.$data.currentValue ? _this19.$data.currentValue : '',
|
|
2819
|
+
"iconPosition": _this19.$props.iconPosition,
|
|
2820
|
+
"showIcon": _this19.$props.showIcon,
|
|
2821
|
+
"showClear": _this19.$props.showClear,
|
|
2822
|
+
"ref": _this19.$props.innerRef,
|
|
2823
|
+
"themePreset": _this19.themePreset
|
|
2786
2824
|
}), null)];
|
|
2787
2825
|
}
|
|
2788
2826
|
}), createVNode(Actions$1, null, {
|
|
2789
2827
|
"default": function _default() {
|
|
2790
|
-
return [
|
|
2828
|
+
return [_this19.renderRightIcons(), _this19.renderInputAddonAfter(), _this19.renderEnterButtonElement()];
|
|
2791
2829
|
}
|
|
2792
2830
|
})];
|
|
2793
2831
|
}
|
|
@@ -3002,12 +3040,14 @@ var AIAnswer = defineComponent({
|
|
|
3002
3040
|
message: response.error
|
|
3003
3041
|
};
|
|
3004
3042
|
}
|
|
3005
|
-
|
|
3006
3043
|
// pushing message history so far
|
|
3007
3044
|
if (messagesHistory && Array.isArray(messagesHistory)) {
|
|
3008
3045
|
finalMessages.push.apply(finalMessages, messagesHistory.filter(function (msg) {
|
|
3009
3046
|
return msg.role !== AI_ROLES.SYSTEM;
|
|
3010
3047
|
}));
|
|
3048
|
+
if (finalMessages[0].role === AI_ROLES.USER) {
|
|
3049
|
+
finalMessages.shift();
|
|
3050
|
+
}
|
|
3011
3051
|
} else if (response && response.answer && response.answer.text) {
|
|
3012
3052
|
finalMessages.push({
|
|
3013
3053
|
role: AI_ROLES.ASSISTANT,
|