algolia-experiences 1.8.5 → 1.8.6
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! algolia-experiences 1.8.
|
|
1
|
+
/*! algolia-experiences 1.8.6 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
|
|
2
2
|
(function (factory) {
|
|
3
3
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
4
4
|
factory();
|
|
@@ -9981,7 +9981,7 @@
|
|
|
9981
9981
|
};
|
|
9982
9982
|
}
|
|
9983
9983
|
|
|
9984
|
-
var version = '4.
|
|
9984
|
+
var version = '4.98.0';
|
|
9985
9985
|
|
|
9986
9986
|
function getServerResults(entry) {
|
|
9987
9987
|
var _entry_compositionFeedsResults;
|
|
@@ -13154,6 +13154,41 @@
|
|
|
13154
13154
|
};
|
|
13155
13155
|
};
|
|
13156
13156
|
|
|
13157
|
+
// Centralizes the "open the chat from an entry point" behavior shared by the
|
|
13158
|
+
// SearchBox AI button, the Autocomplete AI button, prompt suggestions, and any
|
|
13159
|
+
// future entry point. The chat is always opened; the message is only sent when
|
|
13160
|
+
// it is non-empty and the chat is not already processing a message.
|
|
13161
|
+
// Returns true when a message was submitted, so callers can clear their input.
|
|
13162
|
+
function openChat(chatRenderState) {
|
|
13163
|
+
var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, message = _ref.message, referer = _ref.referer;
|
|
13164
|
+
var _ref1;
|
|
13165
|
+
var _chatRenderState_setOpen;
|
|
13166
|
+
if (!chatRenderState) {
|
|
13167
|
+
return false;
|
|
13168
|
+
}
|
|
13169
|
+
(_chatRenderState_setOpen = chatRenderState.setOpen) === null || _chatRenderState_setOpen === void 0 ? void 0 : _chatRenderState_setOpen.call(chatRenderState, true);
|
|
13170
|
+
var trimmed = (_ref1 = message === null || message === void 0 ? void 0 : message.trim()) !== null && _ref1 !== void 0 ? _ref1 : '';
|
|
13171
|
+
if (!trimmed) {
|
|
13172
|
+
var _chatRenderState_focusInput;
|
|
13173
|
+
(_chatRenderState_focusInput = chatRenderState.focusInput) === null || _chatRenderState_focusInput === void 0 ? void 0 : _chatRenderState_focusInput.call(chatRenderState);
|
|
13174
|
+
return false;
|
|
13175
|
+
}
|
|
13176
|
+
if (isChatBusy(chatRenderState) || !chatRenderState.sendMessage) {
|
|
13177
|
+
return false;
|
|
13178
|
+
}
|
|
13179
|
+
chatRenderState.sendMessage({
|
|
13180
|
+
text: trimmed
|
|
13181
|
+
}, referer ? {
|
|
13182
|
+
headers: {
|
|
13183
|
+
'x-algolia-referer': referer
|
|
13184
|
+
}
|
|
13185
|
+
} : undefined);
|
|
13186
|
+
return true;
|
|
13187
|
+
}
|
|
13188
|
+
function isChatBusy(chatRenderState) {
|
|
13189
|
+
return (chatRenderState === null || chatRenderState === void 0 ? void 0 : chatRenderState.status) === 'submitted' || (chatRenderState === null || chatRenderState === void 0 ? void 0 : chatRenderState.status) === 'streaming';
|
|
13190
|
+
}
|
|
13191
|
+
|
|
13157
13192
|
var Breadcrumb = function Breadcrumb(param) {
|
|
13158
13193
|
var items = param.items, cssClasses = param.cssClasses, templateProps = param.templateProps, createURL = param.createURL, refine = param.refine;
|
|
13159
13194
|
return /*#__PURE__*/ h$1("div", {
|
|
@@ -14029,7 +14064,7 @@
|
|
|
14029
14064
|
{
|
|
14030
14065
|
key: "render",
|
|
14031
14066
|
value: function render() {
|
|
14032
|
-
var _this_props = this.props, cssClasses = _this_props.cssClasses, placeholder = _this_props.placeholder, autofocus = _this_props.autofocus, showSubmit = _this_props.showSubmit, showReset = _this_props.showReset, showLoadingIndicator = _this_props.showLoadingIndicator, templates = _this_props.templates, isSearchStalled = _this_props.isSearchStalled, ariaLabel = _this_props.ariaLabel, inputProps = _this_props.inputProps, onAiModeClick = _this_props.onAiModeClick;
|
|
14067
|
+
var _this_props = this.props, cssClasses = _this_props.cssClasses, placeholder = _this_props.placeholder, autofocus = _this_props.autofocus, showSubmit = _this_props.showSubmit, showReset = _this_props.showReset, showLoadingIndicator = _this_props.showLoadingIndicator, templates = _this_props.templates, isSearchStalled = _this_props.isSearchStalled, ariaLabel = _this_props.ariaLabel, inputProps = _this_props.inputProps, onAiModeClick = _this_props.onAiModeClick, aiModeButtonDisabled = _this_props.aiModeButtonDisabled;
|
|
14033
14068
|
return /*#__PURE__*/ h$1("div", {
|
|
14034
14069
|
className: cssClasses.root
|
|
14035
14070
|
}, /*#__PURE__*/ h$1("form", {
|
|
@@ -14104,6 +14139,7 @@
|
|
|
14104
14139
|
className: cssClasses.aiModeButton,
|
|
14105
14140
|
type: 'button',
|
|
14106
14141
|
title: 'AI Mode',
|
|
14142
|
+
disabled: aiModeButtonDisabled,
|
|
14107
14143
|
onClick: this.onAiModeClick
|
|
14108
14144
|
},
|
|
14109
14145
|
templates: templates,
|
|
@@ -19175,21 +19211,20 @@
|
|
|
19175
19211
|
var containerNode = param.containerNode, cssClasses = param.cssClasses, placeholder = param.placeholder, templates = param.templates, autofocus = param.autofocus, searchAsYouType = param.searchAsYouType, ignoreCompositionEvents = param.ignoreCompositionEvents, showReset = param.showReset, showSubmit = param.showSubmit, showLoadingIndicator = param.showLoadingIndicator, aiMode = param.aiMode;
|
|
19176
19212
|
return function(param) {
|
|
19177
19213
|
var refine = param.refine, query = param.query, isSearchStalled = param.isSearchStalled, instantSearchInstance = param.instantSearchInstance;
|
|
19178
|
-
var
|
|
19214
|
+
var getChatRenderState = function getChatRenderState() {
|
|
19179
19215
|
var _instantSearchInstance_renderState_indexId;
|
|
19180
19216
|
var indexId = instantSearchInstance.mainIndex.getIndexId();
|
|
19181
|
-
|
|
19182
|
-
|
|
19183
|
-
|
|
19184
|
-
|
|
19185
|
-
|
|
19186
|
-
|
|
19187
|
-
|
|
19188
|
-
|
|
19189
|
-
});
|
|
19190
|
-
}
|
|
19217
|
+
return (_instantSearchInstance_renderState_indexId = instantSearchInstance.renderState[indexId]) === null || _instantSearchInstance_renderState_indexId === void 0 ? void 0 : _instantSearchInstance_renderState_indexId.chat;
|
|
19218
|
+
};
|
|
19219
|
+
var onAiModeClick = aiMode ? function(currentQuery) {
|
|
19220
|
+
if (openChat(getChatRenderState(), {
|
|
19221
|
+
message: currentQuery,
|
|
19222
|
+
referer: 'ai-mode'
|
|
19223
|
+
})) {
|
|
19224
|
+
refine('');
|
|
19191
19225
|
}
|
|
19192
19226
|
} : undefined;
|
|
19227
|
+
var aiModeButtonDisabled = aiMode ? isChatBusy(getChatRenderState()) : undefined;
|
|
19193
19228
|
P(/*#__PURE__*/ h$1(SearchBox, {
|
|
19194
19229
|
query: query,
|
|
19195
19230
|
placeholder: placeholder,
|
|
@@ -19203,7 +19238,8 @@
|
|
|
19203
19238
|
showLoadingIndicator: showLoadingIndicator,
|
|
19204
19239
|
isSearchStalled: isSearchStalled,
|
|
19205
19240
|
cssClasses: cssClasses,
|
|
19206
|
-
onAiModeClick: onAiModeClick
|
|
19241
|
+
onAiModeClick: onAiModeClick,
|
|
19242
|
+
aiModeButtonDisabled: aiModeButtonDisabled
|
|
19207
19243
|
}), containerNode);
|
|
19208
19244
|
};
|
|
19209
19245
|
};
|