@appbaseio/reactivesearch-vue 3.0.0-rc.17 → 3.0.0-rc.18

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.
@@ -16141,16 +16141,21 @@
16141
16141
  var transformedRequest = Object.assign({}, ts);
16142
16142
  var url = transformedRequest.url;
16143
16143
  delete transformedRequest.url;
16144
+ var controller = new AbortController();
16145
+ var signal = controller.signal;
16144
16146
  var fetchPromise = fetch$1(url || finalURL, Object.assign({}, transformedRequest, {
16145
16147
  // apply timestamp header for RS API
16146
16148
  headers: isRSAPI && !isMongoRequest ? Object.assign({}, transformedRequest.headers, {
16147
16149
  'x-timestamp': new Date().getTime()
16148
- }) : transformedRequest.headers
16150
+ }) : transformedRequest.headers,
16151
+ signal: signal // Attach the abort signal to the fetch request
16149
16152
  }));
16153
+
16150
16154
  var timeoutPromise = new Promise(function (_, rejectTP) {
16151
16155
  if (httpRequestTimeout > 0) {
16152
16156
  setTimeout(function () {
16153
16157
  rejectTP(new Error('Request timeout'));
16158
+ controller.abort();
16154
16159
  }, httpRequestTimeout);
16155
16160
  }
16156
16161
  });
@@ -26512,7 +26517,7 @@
26512
26517
  });
26513
26518
 
26514
26519
  var _templateObject$k, _templateObject2$8, _templateObject3$5, _templateObject4$2, _templateObject5$2, _templateObject6$1, _templateObject7$1, _templateObject8$1, _templateObject9$1, _templateObject10, _templateObject11;
26515
- var Chatbox = styled('div')(_templateObject$k || (_templateObject$k = _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) {
26520
+ var Chatbox = styled('div')(_templateObject$k || (_templateObject$k = _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) {
26516
26521
  return props.theme && props.theme.colors ? props.theme.colors.backgroundColor : '#fff';
26517
26522
  });
26518
26523
  var ChatContainer = styled('div')(_templateObject2$8 || (_templateObject2$8 = _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) {
@@ -26537,11 +26542,15 @@
26537
26542
  return finalColor;
26538
26543
  }, typingDots);
26539
26544
  var resetCSS = function resetCSS(props) {
26540
- 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: " + (
26545
+ return "\n\thtml,\n\tbody,\n\tdiv,\n\tspan,\n\tapplet,\n\tobject,\n\tiframe,\n\th1,\n\th2,\n\th3,\n\th4,\n\th5,\n\th6,\n\tp,\n\tblockquote,\n\tpre,\n\ta,\n\tabbr,\n\tacronym,\n\taddress,\n\tbig,\n\tcite,\n\tcode,\n\tdel,\n\tdfn,\n\tem,\n\timg,\n\tins,\n\tkbd,\n\tq,\n\ts,\n\tsamp,\n\tsmall,\n\tstrike,\n\tstrong,\n\tsub,\n\tsup,\n\ttt,\n\tvar,\n\tb,\n\tu,\n\ti,\n\tcenter,\n\tdl,\n\tdt,\n\tdd,\n\tol,\n\tul,\n\tli,\n\tfieldset,\n\tform,\n\tlabel,\n\tlegend,\n\ttable,\n\tcaption,\n\ttbody,\n\ttfoot,\n\tthead,\n\ttr,\n\tth,\n\ttd,\n\tarticle,\n\taside,\n\tcanvas,\n\tdetails,\n\tembed,\n\tfigure,\n\tfigcaption,\n\tfooter,\n\theader,\n\thgroup,\n\tmenu,\n\tnav,\n\toutput,\n\truby,\n\tsection,\n\tsummary,\n\ttime,\n\tmark,\n\taudio,\n\tvideo {\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\tborder: 0;\n\t\tfont-size: 100%;\n\t\tfont: inherit;\n\t\tvertical-align: baseline;\n\t\toverflow-wrap: anywhere;\n\t}\n\tpre {\n\t\tmargin: 10px auto;\n\t\twhite-space: pre-wrap;\n\n\t}\n\ttable {\n\t\tmargin: 10px auto;\n\t\tborder-collapse: collapse;\n\t\tborder-spacing: 0;\n\t}\n\ttr {\n\t\tborder-bottom: 1px solid #ccc;\n\t}\n\tth,\n\ttd {\n\t\ttext-align: left;\n\t\tpadding: 4px;\n\t\tborder: 1px solid;\n\t\tborder-collapse: collapse;\n\t}\n\tpre,\n\tcode {\n\t\tpadding: 0.6em 0.4em;\n\t\tbackground: " + (
26546
+ // eslint-disable-next-line no-nested-ternary
26547
+ props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryColor : props.theme.colors.borderColor : props.theme.colors.borderColor) + ";\n\n\t}\n\n\tpre{\n\t\tcolor: " + (
26541
26548
  // eslint-disable-next-line no-nested-ternary
26542
- 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: " + (
26549
+ props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor : props.theme.colors.primaryTextColor) + ";}\n\n\tcode {\n\t\tline-height: normal;\n\n\t\tcolor: " + (
26543
26550
  // eslint-disable-next-line no-nested-ternary
26544
- props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor : props.theme.colors.primaryTextColor) + ";\n\t\tborder-radius: 3px;\n\t\tfont-size: 85%;\n\t\tpadding: 0.2em 0.4em;\n\t\tmargin-top: 5px;\n\t\tdisplay: inline-block;\n\t\toverflow: auto;\n\t\twidth: fit-content;\n\t\tmax-width: 100%;\n\t}\n\tul,\n\tol {\n\t\tlist-style-position: inside;\n\t\tpadding-left: 10px;\n\n\t}\n\n\tli{\n\t\tdisplay: list-item;\n\t\tcursor: default;\n\t\tpadding: initial;\n\n\t\t&:hover{\n\t\t\tbackground-color: initial;\n\t\t}\n\t}\n\tp {\n\t\tmargin: inherit;\n\t}\n";
26551
+ 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: " + (
26552
+ // eslint-disable-next-line no-nested-ternary
26553
+ 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";
26545
26554
  };
26546
26555
  var messageBGColor = function messageBGColor(props) {
26547
26556
  var finalBGColor;
@@ -26860,6 +26869,9 @@
26860
26869
  }
26861
26870
  },
26862
26871
  computed: {
26872
+ currentTriggerMode: function currentTriggerMode() {
26873
+ return this.$props.AIUIConfig && this.$props.AIUIConfig.triggerOn || constants_9$1.MANUAL;
26874
+ },
26863
26875
  hasCustomRenderer: function hasCustomRenderer$1() {
26864
26876
  return hasCustomRenderer(this);
26865
26877
  },
@@ -26877,6 +26889,13 @@
26877
26889
  if (Array.isArray(this.suggestions) && this.suggestions.length) {
26878
26890
  suggestionsArray = [].concat(withClickIds(this.suggestions));
26879
26891
  }
26892
+ if (this.renderTriggerMessage() && this.currentValue && !this.isLoading) {
26893
+ suggestionsArray.unshift({
26894
+ label: this.renderTriggerMessage(),
26895
+ value: 'AI_TRIGGER_MESSAGE',
26896
+ _suggestion_type: '_internal_a_i_trigger'
26897
+ });
26898
+ }
26880
26899
  suggestionsArray = suggestionsArray.map(function (s) {
26881
26900
  if (s.sectionId) {
26882
26901
  return s;
@@ -27150,6 +27169,20 @@
27150
27169
  }
27151
27170
  },
27152
27171
  methods: {
27172
+ renderTriggerMessage: function renderTriggerMessage() {
27173
+ if (this.$props.enableAI) {
27174
+ if (this.$props.AIUIConfig && this.$props.AIUIConfig.renderTriggerMessage) {
27175
+ return this.$props.AIUIConfig.renderTriggerMessage;
27176
+ }
27177
+ if (this.$slots.renderTriggerMessage) {
27178
+ return this.$slots.renderTriggerMessage();
27179
+ }
27180
+ if (this.currentTriggerMode === constants_9$1.MANUAL && (this.$props.AIUIConfig ? !this.$props.AIUIConfig.askButton : true)) {
27181
+ return 'Click to trigger AIAnswer';
27182
+ }
27183
+ }
27184
+ return null;
27185
+ },
27153
27186
  handleText: function handleText(value, cause) {
27154
27187
  if (cause === lib_7.CLEAR_VALUE) {
27155
27188
  this.triggerCustomQuery(value);
@@ -27262,7 +27295,7 @@
27262
27295
  if (toggleIsOpen) {
27263
27296
  _this2.isOpen = false;
27264
27297
  }
27265
- if (typeof _this2.currentValue === 'string') _this2.triggerDefaultQuery(_this2.currentValue, props.enableAI ? {
27298
+ if (typeof _this2.currentValue === 'string') _this2.triggerDefaultQuery(_this2.currentValue, props.enableAI && _this2.currentTriggerMode === constants_9$1.QUESTION && _this2.currentValue.endsWith('?') ? {
27266
27299
  enableAI: true
27267
27300
  } : {}, shouldExecuteQuery);
27268
27301
  } // in case of strict selection only SUGGESTION_SELECT should be able
@@ -27417,9 +27450,10 @@
27417
27450
  } else if (highlightedIndex === null) {
27418
27451
  this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? lib_7.SUGGESTION_SELECT : undefined,
27419
27452
  // to handle tags
27420
- !this.$props.enableAI);
27421
- if (this.$props.enableAI && !this.showAIScreen) {
27453
+ !(this.$props.enableAI && this.currentTriggerMode === constants_9$1.QUESTION && event.target.value.endsWith('?')));
27454
+ if (this.$props.enableAI && !this.showAIScreen && this.currentTriggerMode === constants_9$1.QUESTION && event.target.value.endsWith('?')) {
27422
27455
  this.showAIScreen = true;
27456
+ this.isOpen = true;
27423
27457
  }
27424
27458
  this.onValueSelectedHandler(event.target.value, lib_7.ENTER_PRESS);
27425
27459
  }
@@ -27504,6 +27538,11 @@
27504
27538
  this.onValueSelectedHandler(suggestion.value);
27505
27539
  return;
27506
27540
  }
27541
+ if (suggestion && suggestion._suggestion_type === '_internal_a_i_trigger') {
27542
+ this.showAIScreen = true;
27543
+ this.askButtonOnClick();
27544
+ return;
27545
+ }
27507
27546
 
27508
27547
  // handle featured suggestions click event
27509
27548
  if (suggestion._suggestion_type === helper_16.Featured) {
@@ -27543,7 +27582,7 @@
27543
27582
  this.onValueSelectedHandler(suggestion.value, lib_7.SUGGESTION_SELECT, suggestion.source);
27544
27583
 
27545
27584
  // Handle AI
27546
- if (!this.$props.enableAI) this.isOpen = false;else {
27585
+ if (!this.$props.enableAI) this.isOpen = false;else if (this.currentTriggerMode === constants_9$1.QUESTION && suggestion.value.endsWith('?')) {
27547
27586
  this.showAIScreen = true;
27548
27587
  }
27549
27588
  },
@@ -28213,18 +28252,38 @@
28213
28252
  var suggestionsHaveIcon = item.some(function (s) {
28214
28253
  return s.icon || s.iconURL;
28215
28254
  });
28216
- return renderItem ? vue.createVNode("li", vue.mergeProps(getItemProps({
28217
- item: sectionItem
28218
- }), babelHelperVueTransformOn(getItemEvents({
28219
- item: sectionItem
28220
- })), {
28221
- "key": sectionItem._id + "_" + index + "_" + sectionIndex,
28222
- "style": {
28223
- justifyContent: 'flex-start',
28224
- alignItems: 'center'
28225
- },
28226
- "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$3(_this16.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$3(_this16.$props.innerClass, 'suggestion-item'))
28227
- }), [renderItem(sectionItem)]) : vue.createVNode("li", vue.mergeProps(getItemProps({
28255
+ if (renderItem) {
28256
+ return vue.createVNode("li", vue.mergeProps(getItemProps({
28257
+ item: sectionItem
28258
+ }), babelHelperVueTransformOn(getItemEvents({
28259
+ item: sectionItem
28260
+ })), {
28261
+ "key": sectionItem._id + "_" + index + "_" + sectionIndex,
28262
+ "style": {
28263
+ justifyContent: 'flex-start',
28264
+ alignItems: 'center'
28265
+ },
28266
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$3(_this16.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$3(_this16.$props.innerClass, 'suggestion-item'))
28267
+ }), [renderItem(sectionItem)]);
28268
+ }
28269
+ if (sectionItem._suggestion_type === '_internal_a_i_trigger') {
28270
+ return vue.createVNode("li", vue.mergeProps(getItemProps({
28271
+ item: sectionItem
28272
+ }), babelHelperVueTransformOn(getItemEvents({
28273
+ item: sectionItem
28274
+ })), {
28275
+ "key": sectionItem._id + "_" + index + "_" + sectionIndex,
28276
+ "style": {
28277
+ justifyContent: 'flex-start',
28278
+ alignItems: 'center'
28279
+ },
28280
+ "class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$3(_this16.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$3(_this16.$props.innerClass, 'suggestion-item'))
28281
+ }), [vue.createVNode(SuggestionItem, {
28282
+ "currentValue": _this16.currentValue,
28283
+ "suggestion": sectionItem
28284
+ }, null)]);
28285
+ }
28286
+ return vue.createVNode("li", vue.mergeProps(getItemProps({
28228
28287
  item: sectionItem
28229
28288
  }), babelHelperVueTransformOn(getItemEvents({
28230
28289
  item: sectionItem
@@ -28444,6 +28503,7 @@
28444
28503
  // Add componentType for SSR
28445
28504
  SBConnected.componentType = constants_1$1.searchBox;
28446
28505
 
28506
+ var _excluded$2 = ["_source"];
28447
28507
  function _isSlot$6(s) {
28448
28508
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
28449
28509
  }
@@ -28466,7 +28526,10 @@
28466
28526
  messages: [],
28467
28527
  inputMessage: '',
28468
28528
  AISessionId: '',
28469
- error: null
28529
+ error: null,
28530
+ sourceDocIds: null,
28531
+ initialHits: null,
28532
+ isTriggered: false
28470
28533
  };
28471
28534
  this.internalComponent = props.componentId + "__internal";
28472
28535
  return this.__state;
@@ -28476,7 +28539,16 @@
28476
28539
  from: 'theme_reactivesearch'
28477
28540
  }
28478
28541
  },
28479
- created: function created() {},
28542
+ created: function created() {
28543
+ if (this.$props.triggerOn === constants_9$1.ALWAYS) {
28544
+ this.isTriggered = true;
28545
+ } else if (this.$props.triggerOn === constants_9$1.QUESTION && this.dependentComponentValue && this.dependentComponentValue.endsWith('?')) {
28546
+ this.isTriggered = true;
28547
+ if (this.AISessionId) {
28548
+ this.handleSendMessage(null, false, '', true);
28549
+ }
28550
+ }
28551
+ },
28480
28552
  computed: {
28481
28553
  hasCustomRenderer: function hasCustomRenderer$1() {
28482
28554
  return hasCustomRenderer(this);
@@ -28489,6 +28561,9 @@
28489
28561
  },
28490
28562
  errorMessageForMissingSessionId: function errorMessageForMissingSessionId() {
28491
28563
  return "AISessionId for " + this.$props.componentId + " is missing! AIAnswer component requires an AISessionId to function. Try reloading the App.";
28564
+ },
28565
+ hasTriggered: function hasTriggered() {
28566
+ return this.isTriggered;
28492
28567
  }
28493
28568
  },
28494
28569
  props: {
@@ -28527,13 +28602,26 @@
28527
28602
  sessionIdFromStore: Q.string,
28528
28603
  showComponent: types.boolRequired,
28529
28604
  componentError: types.componentObject,
28530
- style: types.style
28605
+ style: types.style,
28606
+ showSourceDocuments: Q.bool.def(false),
28607
+ renderSourceDocument: types.func,
28608
+ onSourceClick: types.func,
28609
+ isAITyping: types.boolRequired,
28610
+ triggerOn: Q.string.def(constants_9$1.ALWAYS),
28611
+ renderTriggerMessage: types.func
28531
28612
  },
28532
28613
  mounted: function mounted() {},
28533
28614
  watch: {
28534
28615
  AIResponse: function AIResponse(newVal) {
28535
28616
  if (newVal) {
28536
- this.AISessionId = ((helper_2(constants_8$1) || {})[this.$props.componentId] || {}).sessionId || null;
28617
+ if (this.$props.showSourceDocuments && newVal.response && newVal.response.answer && Array.isArray(newVal.response.answer.documentIds)) {
28618
+ this.sourceDocIds = newVal.response.answer.documentIds;
28619
+ var localCache = helper_2(constants_8$1) && helper_2(constants_8$1)[this.$props.componentId];
28620
+ if (localCache && localCache.meta && localCache.meta.hits) {
28621
+ this.initialHits = localCache.meta.hits;
28622
+ }
28623
+ }
28624
+ this.AISessionId = ((helper_2(constants_8$1) || {})[this.$props.componentId] || {}).sessionId || (((helper_2(constants_8$1) || {})[this.$props.componentId] || {}).response || {}).sessionId;
28537
28625
  var messagesHistory = newVal.messages,
28538
28626
  response = newVal.response;
28539
28627
  var finalMessages = [];
@@ -28544,7 +28632,7 @@
28544
28632
  }
28545
28633
 
28546
28634
  // pushing message history so far
28547
- if (messagesHistory && messagesHistory && Array.isArray(messagesHistory)) {
28635
+ if (messagesHistory && Array.isArray(messagesHistory)) {
28548
28636
  finalMessages.push.apply(finalMessages, messagesHistory.filter(function (msg) {
28549
28637
  return msg.role !== constants_7$1.SYSTEM;
28550
28638
  }));
@@ -28569,6 +28657,9 @@
28569
28657
  loading: this.$props.isAIResponseLoading || this.$props.isLoading,
28570
28658
  error: this.$props.AIResponseError
28571
28659
  });
28660
+ if (newVal && newVal.hits && newVal.hits.hits) {
28661
+ this.initialHits = newVal.hits.hits;
28662
+ }
28572
28663
  },
28573
28664
  isAIResponseLoading: function isAIResponseLoading(newVal) {
28574
28665
  this.$emit('on-data', {
@@ -28593,7 +28684,7 @@
28593
28684
  },
28594
28685
  AIResponseError: function AIResponseError(newVal) {
28595
28686
  this.error = newVal;
28596
- this.AISessionId = ((helper_2(constants_8$1) || {})[this.$props.componentId] || {}).sessionId || null;
28687
+ this.AISessionId = ((helper_2(constants_8$1) || {})[this.$props.componentId] || {}).sessionId || (((helper_2(constants_8$1) || {})[this.$props.componentId] || {}).response || {}).sessionId;
28597
28688
  if (this.error && !this.AISessionId) {
28598
28689
  var errorMessage = this.errorMessageForMissingSessionId;
28599
28690
  this.error = {
@@ -28614,7 +28705,7 @@
28614
28705
  componentError: function componentError(newVal) {
28615
28706
  var _this = this;
28616
28707
  if (newVal && newVal._bodyBlob) {
28617
- this.AISessionId = ((helper_2(constants_8$1) || {})[this.$props.componentId] || {}).sessionId || null;
28708
+ this.AISessionId = ((helper_2(constants_8$1) || {})[this.$props.componentId] || {}).sessionId || (((helper_2(constants_8$1) || {})[this.$props.componentId] || {}).response || {}).sessionId;
28618
28709
  if (!this.AISessionId) {
28619
28710
  this.generateNewSessionId();
28620
28711
  }
@@ -28637,23 +28728,154 @@
28637
28728
  console.error('Error reading component error text data:', error);
28638
28729
  });
28639
28730
  }
28731
+ },
28732
+ showComponent: function showComponent() {
28733
+ if (this.$props.triggerOn === constants_9$1.QUESTION && this.$props.dependentComponentValue.endsWith('?')) {
28734
+ this.isTriggered = true;
28735
+ }
28736
+ },
28737
+ dependentComponentValue: function dependentComponentValue(newVal) {
28738
+ if (this.$props.triggerOn === constants_9$1.QUESTION && newVal && newVal.endsWith('?')) {
28739
+ this.isTriggered = true;
28740
+ if (this.AISessionId) {
28741
+ this.handleSendMessage(null, false, '', true);
28742
+ }
28743
+ } else if (this.hasTriggered && this.$props.triggerOn !== constants_9$1.ALWAYS) {
28744
+ this.isTriggered = false;
28745
+ }
28746
+ },
28747
+ AISessionId: function AISessionId(newVal) {
28748
+ if (newVal) {
28749
+ if (this.$props.triggerOn === constants_9$1.QUESTION && this.dependentComponentValue && this.dependentComponentValue.endsWith('?') || this.$props.triggerOn === constants_9$1.ALWAYS) {
28750
+ this.handleSendMessage(null, false, '', true);
28751
+ }
28752
+ }
28753
+ },
28754
+ triggerOn: function triggerOn(newVal) {
28755
+ if (newVal === constants_9$1.ALWAYS) {
28756
+ this.isTriggered = true;
28757
+ }
28640
28758
  }
28641
28759
  },
28642
28760
  methods: {
28643
- generateNewSessionId: function generateNewSessionId() {
28761
+ renderTriggerMessageFunc: function renderTriggerMessageFunc() {
28762
+ var triggerOn = this.$props.triggerOn;
28763
+ if (this.$props.renderTriggerMessage) {
28764
+ return this.$props.renderTriggerMessage;
28765
+ }
28766
+ if (this.$slots.renderTriggerMessage) {
28767
+ return this.$slots.renderTriggerMessage();
28768
+ }
28769
+ if (triggerOn === constants_9$1.QUESTION) {
28770
+ if (!this.dependentComponentValue.endsWith('?')) {
28771
+ return vue.createVNode("span", null, [vue.createVNode("span", {
28772
+ "role": "img",
28773
+ "aria-label": "bulb"
28774
+ }, [vue.createTextVNode("\uD83D\uDCA1")]), vue.createTextVNode("End your question with a question mark (?)")]);
28775
+ }
28776
+ } else if (triggerOn === constants_9$1.MANUAL) {
28777
+ return vue.createVNode("span", null, [vue.createTextVNode("Click here to ask AI"), ' ', vue.createVNode("span", {
28778
+ "role": "img",
28779
+ "aria-label": "bulb"
28780
+ }, [vue.createTextVNode("\uD83E\uDD16")])]);
28781
+ }
28782
+ return null;
28783
+ },
28784
+ handleTriggerClick: function handleTriggerClick() {
28785
+ if (this.$props.triggerOn === constants_9$1.MANUAL) {
28786
+ this.handleSendMessage(null, false, '', true);
28787
+ this.isTriggered = true;
28788
+ }
28789
+ },
28790
+ getAISourceObjects: function getAISourceObjects() {
28644
28791
  var _this2 = this;
28792
+ var sourceObjects = [];
28793
+ if (!this.AIResponse) return sourceObjects;
28794
+ var docIds = this.sourceDocIds || [];
28795
+ if (this.initialHits) {
28796
+ docIds.forEach(function (id) {
28797
+ var foundSourceObj = _this2.initialHits.find(function (hit) {
28798
+ return hit._id === id;
28799
+ }) || {};
28800
+ if (foundSourceObj) {
28801
+ var _foundSourceObj$_sour = foundSourceObj._source,
28802
+ _source = _foundSourceObj$_sour === void 0 ? {} : _foundSourceObj$_sour,
28803
+ rest = _objectWithoutPropertiesLoose(foundSourceObj, _excluded$2);
28804
+ sourceObjects.push(_extends({}, rest, _source));
28805
+ }
28806
+ });
28807
+ } else {
28808
+ sourceObjects.push.apply(sourceObjects, docIds.map(function (id) {
28809
+ return {
28810
+ _id: id
28811
+ };
28812
+ }));
28813
+ }
28814
+ return sourceObjects;
28815
+ },
28816
+ renderAIScreenFooter: function renderAIScreenFooter() {
28817
+ var _slot2;
28818
+ var _this3 = this;
28819
+ var _ref = this.$props || {},
28820
+ _ref$showSourceDocume = _ref.showSourceDocuments,
28821
+ showSourceDocuments = _ref$showSourceDocume === void 0 ? true : _ref$showSourceDocume,
28822
+ _ref$onSourceClick = _ref.onSourceClick,
28823
+ onSourceClick = _ref$onSourceClick === void 0 ? function () {} : _ref$onSourceClick,
28824
+ renderSourceDocument = _ref.renderSourceDocument;
28825
+ var customRenderSourceDoc = renderSourceDocument || this.$slots.renderSourceDocument;
28826
+ if (this.isLoadingState || this.isAITyping) {
28827
+ return null;
28828
+ }
28829
+ var renderSourceDocumentLabel = function renderSourceDocumentLabel(sourceObj) {
28830
+ if (customRenderSourceDoc) {
28831
+ return customRenderSourceDoc(sourceObj);
28832
+ }
28833
+ return sourceObj._id;
28834
+ };
28835
+ return showSourceDocuments && Array.isArray(this.sourceDocIds) && this.sourceDocIds.length ? vue.createVNode(Footer, {
28836
+ "themePreset": this.$props.themePreset,
28837
+ "style": {
28838
+ marginTop: '1.5rem',
28839
+ background: 'inherit'
28840
+ }
28841
+ }, {
28842
+ "default": function _default() {
28843
+ return [vue.createTextVNode("Summary generated using the following sources:"), ' ', vue.createVNode(SourceTags, null, _isSlot$6(_slot2 = _this3.getAISourceObjects().map(function (el) {
28844
+ var _slot;
28845
+ return vue.createVNode(Button, {
28846
+ "class": "--ai-source-tag " + (helper_31(_this3.$props.innerClass, 'ai-source-tag') || ''),
28847
+ "info": true,
28848
+ "onClick": function onClick() {
28849
+ return onSourceClick && onSourceClick(el);
28850
+ },
28851
+ "key": el._id
28852
+ }, _isSlot$6(_slot = renderSourceDocumentLabel(el)) ? _slot : {
28853
+ "default": function _default() {
28854
+ return [_slot];
28855
+ }
28856
+ });
28857
+ })) ? _slot2 : {
28858
+ "default": function _default() {
28859
+ return [_slot2];
28860
+ }
28861
+ })];
28862
+ }
28863
+ }) : null;
28864
+ },
28865
+ generateNewSessionId: function generateNewSessionId() {
28866
+ var _this4 = this;
28645
28867
  var newSessionPromise = this.createAISession();
28646
28868
  newSessionPromise.then(function (res) {
28647
- _this2.AISessionId = res.AIsessionId;
28869
+ _this4.AISessionId = res.AIsessionId;
28648
28870
  })["catch"](function (e) {
28649
28871
  console.error(e);
28650
28872
  });
28651
28873
  },
28652
28874
  scrollToBottom: function scrollToBottom() {
28653
- var _this3 = this;
28875
+ var _this5 = this;
28654
28876
  this.$nextTick(function () {
28655
- var _this3$$refs;
28656
- var messageContainer = (_this3$$refs = _this3.$refs) == null ? void 0 : _this3$$refs[_this3.$props.innerRef];
28877
+ var _this5$$refs;
28878
+ var messageContainer = (_this5$$refs = _this5.$refs) == null ? void 0 : _this5$$refs[_this5.$props.innerRef];
28657
28879
  if (messageContainer && messageContainer.$el) {
28658
28880
  messageContainer.$el.scrollTo({
28659
28881
  top: messageContainer.$el.scrollHeight,
@@ -28666,24 +28888,33 @@
28666
28888
  this.inputMessage = e.target.value;
28667
28889
  this.handleTextAreaHeightChange();
28668
28890
  },
28669
- handleSendMessage: function handleSendMessage(e, isRetry, text) {
28891
+ handleSendMessage: function handleSendMessage(e, isRetry, text, fetchMeta) {
28670
28892
  if (isRetry === void 0) {
28671
28893
  isRetry = false;
28672
28894
  }
28673
28895
  if (text === void 0) {
28674
28896
  text = this.inputMessage;
28675
28897
  }
28898
+ if (fetchMeta === void 0) {
28899
+ fetchMeta = false;
28900
+ }
28676
28901
  if (typeof e === 'object' && e !== null) e.preventDefault();
28677
- if (text.trim()) {
28902
+ if (text.trim() || !text && !e) {
28678
28903
  if (this.isLoadingState) {
28679
28904
  return;
28680
28905
  }
28681
28906
  if (this.AISessionId) {
28682
- if (!isRetry) this.messages = [].concat(this.messages, [{
28683
- content: text,
28684
- role: constants_7$1.USER
28685
- }]);
28686
- this.getAIResponse(this.AISessionId, this.componentId, text);
28907
+ if (!isRetry) {
28908
+ var finalMessages = [].concat(this.messages);
28909
+ if (text) {
28910
+ finalMessages.push({
28911
+ content: text,
28912
+ role: constants_7$1.USER
28913
+ });
28914
+ }
28915
+ this.messages = [].concat(finalMessages);
28916
+ }
28917
+ this.getAIResponse(this.AISessionId, this.componentId, text, fetchMeta);
28687
28918
  } else {
28688
28919
  console.error(this.errorMessageForMissingSessionId);
28689
28920
  this.error = {
@@ -28732,7 +28963,6 @@
28732
28963
  return null;
28733
28964
  },
28734
28965
  handleKeyPress: function handleKeyPress(e) {
28735
- window.console.log('e', e);
28736
28966
  if (e.key === 'Enter') {
28737
28967
  this.handleSendMessage(e);
28738
28968
  this.inputMessage = '';
@@ -28764,15 +28994,15 @@
28764
28994
  if (typeof window === 'undefined') return false;
28765
28995
  return showVoiceSearch && (window.webkitSpeechRecognition || window.SpeechRecognition);
28766
28996
  },
28767
- handleVoiceResults: function handleVoiceResults(_ref) {
28768
- var results = _ref.results;
28997
+ handleVoiceResults: function handleVoiceResults(_ref2) {
28998
+ var results = _ref2.results;
28769
28999
  if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
28770
29000
  this.handleSendMessage(null, false, results[0][0].transcript.trim());
28771
29001
  }
28772
29002
  },
28773
29003
  renderIcons: function renderIcons() {
28774
- var _this4 = this;
28775
- var _slot, _slot2;
29004
+ var _this6 = this;
29005
+ var _slot3, _slot4;
28776
29006
  var _this$$props = this.$props,
28777
29007
  getMicInstance = _this$$props.getMicInstance,
28778
29008
  showVoiceInput = _this$$props.showVoiceInput,
@@ -28785,14 +29015,14 @@
28785
29015
  "positionType": "absolute"
28786
29016
  }, {
28787
29017
  "default": function _default() {
28788
- return [!_this4.isLoadingState && _this4.AISessionId && _this4.shouldMicRender(showVoiceInput) && vue.createVNode(Mic, {
29018
+ return [!_this6.isLoadingState && _this6.AISessionId && _this6.shouldMicRender(showVoiceInput) && vue.createVNode(Mic, {
28789
29019
  "getInstance": getMicInstance,
28790
29020
  "render": renderMic,
28791
- "handleResult": _this4.handleVoiceResults,
29021
+ "handleResult": _this6.handleVoiceResults,
28792
29022
  "class": helper_31(innerClass, 'ai-search-mic') || null
28793
- }, null), iconPosition === 'right' && vue.createVNode(IconWrapper, null, _isSlot$6(_slot = _this4.renderIcon()) ? _slot : {
29023
+ }, null), iconPosition === 'right' && vue.createVNode(IconWrapper, null, _isSlot$6(_slot3 = _this6.renderIcon()) ? _slot3 : {
28794
29024
  "default": function _default() {
28795
- return [_slot];
29025
+ return [_slot3];
28796
29026
  }
28797
29027
  })];
28798
29028
  }
@@ -28802,9 +29032,9 @@
28802
29032
  "positionType": "absolute"
28803
29033
  }, {
28804
29034
  "default": function _default() {
28805
- return [iconPosition === 'left' && vue.createVNode(IconWrapper, null, _isSlot$6(_slot2 = _this4.renderIcon()) ? _slot2 : {
29035
+ return [iconPosition === 'left' && vue.createVNode(IconWrapper, null, _isSlot$6(_slot4 = _this6.renderIcon()) ? _slot4 : {
28806
29036
  "default": function _default() {
28807
- return [_slot2];
29037
+ return [_slot4];
28808
29038
  }
28809
29039
  })];
28810
29040
  }
@@ -28814,7 +29044,7 @@
28814
29044
  this.handleSendMessage(e);
28815
29045
  },
28816
29046
  renderEnterButtonElement: function renderEnterButtonElement() {
28817
- var _this5 = this;
29047
+ var _this7 = this;
28818
29048
  var _this$$props2 = this.$props,
28819
29049
  enterButton = _this$$props2.enterButton,
28820
29050
  innerClass = _this$$props2.innerClass;
@@ -28822,16 +29052,16 @@
28822
29052
  if (enterButton) {
28823
29053
  var getEnterButtonMarkup = function getEnterButtonMarkup() {
28824
29054
  if (renderEnterButton) {
28825
- return renderEnterButton(_this5.enterButtonOnClick);
29055
+ return renderEnterButton(_this7.enterButtonOnClick);
28826
29056
  }
28827
29057
  return vue.createVNode(SendButton, {
28828
29058
  "primary": true,
28829
29059
  "type": "submit",
28830
29060
  "tabIndex": 0,
28831
- "onClick": _this5.handleSendMessage,
28832
- "onKeyPress": _this5.handleKeyPress,
29061
+ "onClick": _this7.handleSendMessage,
29062
+ "onKeyPress": _this7.handleKeyPress,
28833
29063
  "class": "ask-btn " + helper_31(innerClass, 'ai-enter-button'),
28834
- "disabled": _this5.isLoadingState || !_this5.AISessionId
29064
+ "disabled": _this7.isLoadingState || !_this7.AISessionId
28835
29065
  }, {
28836
29066
  "default": function _default() {
28837
29067
  return [vue.createTextVNode("Send")];
@@ -28874,6 +29104,20 @@
28874
29104
  }
28875
29105
  this.$forceUpdate();
28876
29106
  }
29107
+ },
29108
+ getTitle: function getTitle() {
29109
+ var _this8 = this;
29110
+ var hasTitle = this.$props.title || this.$slots.title || null;
29111
+ if (hasTitle) {
29112
+ return vue.createVNode(Title, {
29113
+ "class": helper_31(this.$props.innerClass, 'ai-title') || null
29114
+ }, {
29115
+ "default": function _default() {
29116
+ return [_this8.$props.title || _this8.$slots.title()];
29117
+ }
29118
+ });
29119
+ }
29120
+ return null;
28877
29121
  }
28878
29122
  },
28879
29123
  beforeUnmount: function beforeUnmount() {
@@ -28888,55 +29132,62 @@
28888
29132
  }
28889
29133
  },
28890
29134
  render: function render() {
28891
- var _slot3;
28892
- var _this6 = this;
29135
+ var _slot5;
29136
+ var _this9 = this;
28893
29137
  var props = this.$props;
28894
29138
  if (!this.shouldShowComponent) {
28895
29139
  return null;
28896
29140
  }
29141
+ if (!this.isTriggered) {
29142
+ return vue.createVNode(Chatbox, {
29143
+ "style": props.style || {}
29144
+ }, {
29145
+ "default": function _default() {
29146
+ return [_this9.getTitle(), vue.createVNode("div", {
29147
+ "class": "--trigger-message-wrapper",
29148
+ "onClick": _this9.handleTriggerClick,
29149
+ "aria-hidden": "true"
29150
+ }, [_this9.renderTriggerMessageFunc()])];
29151
+ }
29152
+ });
29153
+ }
28897
29154
  return vue.createVNode(Chatbox, {
28898
29155
  "style": props.style || {}
28899
29156
  }, {
28900
29157
  "default": function _default() {
28901
- return [_this6.$props.title && vue.createVNode(Title, {
28902
- "class": helper_31(_this6.$props.innerClass, 'title') || ''
28903
- }, {
28904
- "default": function _default() {
28905
- return [_this6.$props.title];
28906
- }
28907
- }), vue.createVNode(ChatContainer, {
29158
+ return [_this9.getTitle(), vue.createVNode(ChatContainer, {
28908
29159
  "class": "--ai-chat-container",
28909
29160
  "theme": props.theme,
28910
29161
  "showInput": props.showInput
28911
29162
  }, {
28912
29163
  "default": function _default() {
28913
- return [_this6.hasCustomRenderer && vue.createVNode(MessagesContainer, {
28914
- "themePreset": _this6.themePreset,
29164
+ return [_this9.hasCustomRenderer && vue.createVNode(MessagesContainer, {
29165
+ "themePreset": _this9.themePreset,
28915
29166
  "theme": props.theme,
28916
- "ref": _this6.$props.innerRef,
29167
+ "ref": _this9.$props.innerRef,
28917
29168
  "class": "--ai-message-container " + (helper_31(props.innerClass, 'ai-message-container') || '')
28918
- }, _isSlot$6(_slot3 = _this6.getComponent()) ? _slot3 : {
29169
+ }, _isSlot$6(_slot5 = _this9.getComponent()) ? _slot5 : {
28919
29170
  "default": function _default() {
28920
- return [_slot3];
29171
+ return [_slot5];
28921
29172
  }
28922
- }), !_this6.hasCustomRenderer && vue.createVNode(MessagesContainer, {
28923
- "themePreset": _this6.themePreset,
29173
+ }), !_this9.hasCustomRenderer && vue.createVNode(MessagesContainer, {
29174
+ "themePreset": _this9.themePreset,
28924
29175
  "theme": props.theme,
28925
- "ref": _this6.$props.innerRef,
29176
+ "ref": _this9.$props.innerRef,
28926
29177
  "class": "--ai-message-container " + (helper_31(props.innerClass, 'ai-message-container') || '')
28927
29178
  }, {
28928
29179
  "default": function _default() {
28929
- return [_this6.messages.map(function (message, index) {
29180
+ return [_this9.messages.map(function (message, index) {
28930
29181
  return vue.createVNode(Message, {
28931
29182
  "key": index,
28932
29183
  "isSender": message.role === constants_7$1.USER,
28933
29184
  "innerHTML": md$1.render(message.content),
28934
- "themePreset": _this6.themePreset,
29185
+ "themePreset": _this9.themePreset,
28935
29186
  "theme": props.theme,
28936
29187
  "class": "--ai-answer-message " + (helper_31(props.innerClass, 'ai-message') || '')
28937
29188
  }, null);
28938
- }), _this6.isLoadingState && vue.createVNode(Message, {
28939
- "themePreset": _this6.themePreset,
29189
+ }), _this9.isLoadingState && vue.createVNode(Message, {
29190
+ "themePreset": _this9.themePreset,
28940
29191
  "theme": props.theme,
28941
29192
  "isSender": false,
28942
29193
  "class": "--ai-answer-message " + (helper_31(props.innerClass, 'ai-message') || null)
@@ -28945,31 +29196,31 @@
28945
29196
  return [vue.createVNode(TypingIndicator, null, {
28946
29197
  "default": function _default() {
28947
29198
  return [vue.createVNode(TypingDot, {
28948
- "themePreset": _this6.themePreset
29199
+ "themePreset": _this9.themePreset
28949
29200
  }, null), vue.createVNode(TypingDot, {
28950
- "themePreset": _this6.themePreset
29201
+ "themePreset": _this9.themePreset
28951
29202
  }, null), vue.createVNode(TypingDot, {
28952
- "themePreset": _this6.themePreset
29203
+ "themePreset": _this9.themePreset
28953
29204
  }, null)];
28954
29205
  }
28955
29206
  })];
28956
29207
  }
28957
29208
  })];
28958
29209
  }
28959
- }), _this6.renderErrorComponent(), ' ', props.showFeedback && vue.createVNode("div", {
29210
+ }), _this9.renderErrorComponent(), ' ', props.showFeedback && !_this9.isLoadingState && !_this9.isAITyping && vue.createVNode("div", {
28960
29211
  "class": "--ai-answer-feedback-container " + (helper_31(props.innerClass, 'ai-feedback') || '')
28961
29212
  }, [vue.createVNode(AIFeedback, {
28962
- "hideUI": _this6.isLoadingState || !_this6.sessionId,
28963
- "key": _this6.sessionId,
29213
+ "hideUI": _this9.isLoadingState || !_this9.sessionId,
29214
+ "key": _this9.sessionId,
28964
29215
  "onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
28965
- _this6.trackUsefullness(_this6.sessionId, {
29216
+ _this9.trackUsefullness(_this9.sessionId, {
28966
29217
  useful: useful,
28967
29218
  reason: reason
28968
29219
  });
28969
29220
  }
28970
- }, null)]), props.showInput && vue.createVNode(MessageInputContainer, {
29221
+ }, null)]), ' ', _this9.renderAIScreenFooter(), props.showInput && !_this9.isLoadingState && !_this9.isAITyping && vue.createVNode(MessageInputContainer, {
28971
29222
  "class": "--ai-input-container",
28972
- "onSubmit": _this6.handleSendMessage
29223
+ "onSubmit": _this9.handleSendMessage
28973
29224
  }, {
28974
29225
  "default": function _default() {
28975
29226
  return [vue.createVNode(InputGroup, {
@@ -28985,19 +29236,19 @@
28985
29236
  "ref": _inputRef,
28986
29237
  "placeholder": props.placeholder,
28987
29238
  "enterButton": props.enterButton,
28988
- "value": _this6.inputMessage,
28989
- "onInput": _this6.handleMessageInputChange,
29239
+ "value": _this9.inputMessage,
29240
+ "onInput": _this9.handleMessageInputChange,
28990
29241
  "id": props.componentId + "-ai-input",
28991
29242
  "showIcon": props.showIcon,
28992
29243
  "iconPosition": props.iconPosition,
28993
- "themePreset": _this6.themePreset,
28994
- "disabled": _this6.isLoadingState || !_this6.AISessionId,
29244
+ "themePreset": _this9.themePreset,
29245
+ "disabled": _this9.isLoadingState || !_this9.AISessionId,
28995
29246
  "class": helper_31(props.innerClass, 'ai-input') || null
28996
- }, null), ' ', _this6.renderIcons()];
29247
+ }, null), ' ', _this9.renderIcons()];
28997
29248
  }
28998
29249
  })];
28999
29250
  }
29000
- }), _this6.renderEnterButtonElement()];
29251
+ }), _this9.renderEnterButtonElement()];
29001
29252
  }
29002
29253
  }), ' '];
29003
29254
  }
@@ -29015,9 +29266,11 @@
29015
29266
  // eslint-disable-next-line prefer-destructuring
29016
29267
  dependencyComponent = dependencyComponent[0];
29017
29268
  }
29018
- var showComponent = state.selectedValues[dependencyComponent] && state.selectedValues[dependencyComponent].value;
29269
+ var showComponent = !!(state.selectedValues[dependencyComponent] && state.selectedValues[dependencyComponent].value);
29270
+ var dependentComponentValue = state.selectedValues[dependencyComponent] && state.selectedValues[dependencyComponent].value || '';
29019
29271
  return {
29020
29272
  showComponent: showComponent,
29273
+ dependentComponentValue: dependentComponentValue,
29021
29274
  AIResponse: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response,
29022
29275
  isAIResponseLoading: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].isLoading,
29023
29276
  AIResponseError: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].error,
@@ -29025,11 +29278,17 @@
29025
29278
  themePreset: state.config.themePreset,
29026
29279
  isLoading: state.isLoading[props.componentId] || false,
29027
29280
  sessionIdFromStore: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.sessionId || '',
29028
- componentError: state.error[props.componentId]
29281
+ componentError: state.error[props.componentId] || null,
29282
+ isAITyping: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.isTyping || false
29029
29283
  };
29030
29284
  };
29031
29285
  var mapDispatchToProps$3 = {
29032
- getAIResponse: query_7,
29286
+ getAIResponse: function getAIResponse(sessionId, componentId, message, shouldFetchMeta) {
29287
+ if (shouldFetchMeta === void 0) {
29288
+ shouldFetchMeta = false;
29289
+ }
29290
+ return query_7(sessionId, componentId, message, null, shouldFetchMeta);
29291
+ },
29033
29292
  trackUsefullness: analytics_8,
29034
29293
  createAISession: query_8
29035
29294
  };
@@ -33234,7 +33493,7 @@
33234
33493
  // Add componentType for SSR
33235
33494
  TBConnected.componentType = constants_1$1.toggleButton;
33236
33495
 
33237
- var _excluded$2 = ["options"];
33496
+ var _excluded$3 = ["options"];
33238
33497
  var updateQuery$7 = lib_5.updateQuery,
33239
33498
  setQueryOptions$7 = lib_5.setQueryOptions,
33240
33499
  setCustomQuery$6 = lib_5.setCustomQuery,
@@ -33293,7 +33552,7 @@
33293
33552
  }
33294
33553
  this.setQuery = function (_ref) {
33295
33554
  var options = _ref.options,
33296
- obj = _objectWithoutPropertiesLoose(_ref, _excluded$2);
33555
+ obj = _objectWithoutPropertiesLoose(_ref, _excluded$3);
33297
33556
  var queryToBeSet = obj.query;
33298
33557
 
33299
33558
  // when enableAppbase is true, Backend throws error because of repeated query in request body
@@ -37128,7 +37387,7 @@
37128
37387
  Vue.component(ResultCardTitle.name, ResultCardTitle);
37129
37388
  };
37130
37389
 
37131
- var _excluded$3 = ["src"];
37390
+ var _excluded$4 = ["src"];
37132
37391
  var ResultCardImage = {
37133
37392
  name: 'ResultCardImage',
37134
37393
  props: {
@@ -37137,7 +37396,7 @@
37137
37396
  render: function render() {
37138
37397
  var _this$$props = this.$props,
37139
37398
  src = _this$$props.src,
37140
- props = _objectWithoutPropertiesLoose(_this$$props, _excluded$3);
37399
+ props = _objectWithoutPropertiesLoose(_this$$props, _excluded$4);
37141
37400
  return vue.createVNode(Image$1, vue.mergeProps({
37142
37401
  "style": {
37143
37402
  backgroundImage: "url(" + src + ")"
@@ -37160,7 +37419,7 @@
37160
37419
  Vue.component(ResultCardDescription.name, ResultCardDescription);
37161
37420
  };
37162
37421
 
37163
- var _excluded$4 = ["href", "target"];
37422
+ var _excluded$5 = ["href", "target"];
37164
37423
  function _isSlot$e(s) {
37165
37424
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
37166
37425
  }
@@ -37181,7 +37440,7 @@
37181
37440
  var _this$$props = this.$props,
37182
37441
  href = _this$$props.href,
37183
37442
  target = _this$$props.target,
37184
- rest = _objectWithoutPropertiesLoose(_this$$props, _excluded$4);
37443
+ rest = _objectWithoutPropertiesLoose(_this$$props, _excluded$5);
37185
37444
  return vue.createVNode(Card, vue.mergeProps({
37186
37445
  "href": href,
37187
37446
  "target": target,
@@ -37222,7 +37481,7 @@
37222
37481
  Vue.component(ResultListDescription.name, ResultListDescription);
37223
37482
  };
37224
37483
 
37225
- var _excluded$5 = ["src", "small"];
37484
+ var _excluded$6 = ["src", "small"];
37226
37485
  var ResultListImage = {
37227
37486
  name: 'ResultListImage',
37228
37487
  props: {
@@ -37233,7 +37492,7 @@
37233
37492
  var _this$$props = this.$props,
37234
37493
  src = _this$$props.src,
37235
37494
  small = _this$$props.small,
37236
- props = _objectWithoutPropertiesLoose(_this$$props, _excluded$5);
37495
+ props = _objectWithoutPropertiesLoose(_this$$props, _excluded$6);
37237
37496
  return vue.createVNode(Image, vue.mergeProps({
37238
37497
  "src": src,
37239
37498
  "small": small
@@ -37263,7 +37522,7 @@
37263
37522
  Vue.component(ResultListTitle.name, ResultListTitle);
37264
37523
  };
37265
37524
 
37266
- var _excluded$6 = ["href", "target"];
37525
+ var _excluded$7 = ["href", "target"];
37267
37526
  function _isSlot$g(s) {
37268
37527
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
37269
37528
  }
@@ -37303,7 +37562,7 @@
37303
37562
  var _this$$props = this.$props,
37304
37563
  href = _this$$props.href,
37305
37564
  target = _this$$props.target,
37306
- props = _objectWithoutPropertiesLoose(_this$$props, _excluded$6);
37565
+ props = _objectWithoutPropertiesLoose(_this$$props, _excluded$7);
37307
37566
  var hasImage = this.hasImage,
37308
37567
  isSmall = this.isSmall;
37309
37568
  var children = this.$slots["default"];
@@ -37781,7 +38040,7 @@
37781
38040
  }
37782
38041
  };
37783
38042
 
37784
- var _excluded$7 = ["mappedProps", "name", "ctr", "ctrArgs", "events", "beforeCreate", "afterCreate", "props"];
38043
+ var _excluded$8 = ["mappedProps", "name", "ctr", "ctrArgs", "events", "beforeCreate", "afterCreate", "props"];
37785
38044
 
37786
38045
  /**
37787
38046
  *
@@ -37833,7 +38092,7 @@
37833
38092
  beforeCreate = options.beforeCreate,
37834
38093
  afterCreate = options.afterCreate,
37835
38094
  props = options.props,
37836
- rest = _objectWithoutPropertiesLoose(options, _excluded$7);
38095
+ rest = _objectWithoutPropertiesLoose(options, _excluded$8);
37837
38096
  var promiseName = "$" + name + "Promise";
37838
38097
  var instanceName = "$" + name + "Object";
37839
38098
  assert(!(rest.props instanceof Array), '`props` should be an object, not Array');
@@ -39700,7 +39959,7 @@
39700
39959
  return MarkerClusterer;
39701
39960
  }(OverlayViewSafe);
39702
39961
 
39703
- var _excluded$8 = ["map"];
39962
+ var _excluded$9 = ["map"];
39704
39963
  var props$6 = {
39705
39964
  algorithm: {
39706
39965
  type: Object,
@@ -39728,7 +39987,7 @@
39728
39987
  },
39729
39988
  ctrArgs: function ctrArgs(_ref) {
39730
39989
  var map = _ref.map,
39731
- otherOptions = _objectWithoutPropertiesLoose(_ref, _excluded$8);
39990
+ otherOptions = _objectWithoutPropertiesLoose(_ref, _excluded$9);
39732
39991
  return [_extends({
39733
39992
  map: map
39734
39993
  }, otherOptions)];
@@ -41761,7 +42020,7 @@
41761
42020
  });
41762
42021
  }
41763
42022
 
41764
- var _excluded$9 = ["options", "position"];
42023
+ var _excluded$a = ["options", "position"];
41765
42024
  var InfoWindowClusterManager = {
41766
42025
  name: 'InfoWindowClusterManager',
41767
42026
  inject: {
@@ -41782,7 +42041,7 @@
41782
42041
  }, getPropsValues$1(_this, infoWindowMappedProps));
41783
42042
  var extraOptions = initialOptions.options,
41784
42043
  position = initialOptions.position,
41785
- finalOptions = _objectWithoutPropertiesLoose(initialOptions, _excluded$9);
42044
+ finalOptions = _objectWithoutPropertiesLoose(initialOptions, _excluded$a);
41786
42045
  finalOptions.content = _this.$refs.flyaway;
41787
42046
  if (_this.$markerPromise) {
41788
42047
  _this.$markerPromise.then(function (markerObject) {
@@ -41937,7 +42196,7 @@
41937
42196
  }
41938
42197
  };
41939
42198
 
41940
- var _excluded$a = ["options"];
42199
+ var _excluded$b = ["options"];
41941
42200
  var isEqual$h = lib_8.isEqual;
41942
42201
  var recordResultClick$2 = lib_5.recordResultClick;
41943
42202
  var ClusterMarkers = {
@@ -42060,7 +42319,7 @@
42060
42319
  };
42061
42320
  }
42062
42321
  var extraOptions = initialOptions.options,
42063
- finalOptions = _objectWithoutPropertiesLoose(initialOptions, _excluded$a);
42322
+ finalOptions = _objectWithoutPropertiesLoose(initialOptions, _excluded$b);
42064
42323
  if (_this.$clusterPromise) {
42065
42324
  finalOptions.map = null;
42066
42325
  }
@@ -43933,7 +44192,7 @@
43933
44192
  }, queryString, renderFunction);
43934
44193
  }
43935
44194
 
43936
- var version = "3.0.0-rc.17";
44195
+ var version = "3.0.0-rc.18";
43937
44196
 
43938
44197
  var components = [RLConnected, ResultCard, ResultList, ReactiveBase, SBConnected, ListConnected, ListConnected$1, RangeConnected$1, RangeConnected$2, RangeConnected$3, RangeConnected, RcConnected, RcConnected$1, RcConnected$2, TBConnected, ListConnected$2, ListConnected$3, StateProviderConnected, RangeConnected$4, TreeListConnected, AIConnected];
43939
44198
  function install$1 (Vue) {