react-instantsearch 7.32.3 → 7.33.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/cjs/components/AutocompleteSearch.js +2 -1
- package/dist/cjs/ui/SearchBox.js +3 -1
- package/dist/cjs/widgets/Autocomplete.js +15 -17
- package/dist/cjs/widgets/SearchBox.js +8 -10
- package/dist/cjs/widgets/TrendingFacets.js +1 -3
- package/dist/es/components/AutocompleteSearch.d.ts +2 -1
- package/dist/es/components/AutocompleteSearch.js +2 -1
- package/dist/es/ui/SearchBox.d.ts +2 -1
- package/dist/es/ui/SearchBox.js +3 -1
- package/dist/es/widgets/Autocomplete.js +15 -17
- package/dist/es/widgets/FilterSuggestions.d.ts +3 -0
- package/dist/es/widgets/FilterSuggestions.js +3 -1
- package/dist/es/widgets/SearchBox.d.ts +1 -1
- package/dist/es/widgets/SearchBox.js +8 -10
- package/dist/es/widgets/TrendingFacets.d.ts +1 -1
- package/dist/es/widgets/TrendingFacets.js +1 -3
- package/dist/umd/ReactInstantSearch.js +115 -93
- package/dist/umd/ReactInstantSearch.min.js +3 -3
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! React InstantSearch 7.
|
|
1
|
+
/*! React InstantSearch 7.33.1 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
26
26
|
|
|
27
|
-
var version$2 = '7.
|
|
27
|
+
var version$2 = '7.33.1';
|
|
28
28
|
|
|
29
29
|
function _define_property(obj, key, value) {
|
|
30
30
|
if (key in obj) {
|
|
@@ -10821,7 +10821,7 @@
|
|
|
10821
10821
|
};
|
|
10822
10822
|
}
|
|
10823
10823
|
|
|
10824
|
-
var version = '4.
|
|
10824
|
+
var version = '4.99.0';
|
|
10825
10825
|
|
|
10826
10826
|
var withUsage$q = createDocumentationMessageGenerator({
|
|
10827
10827
|
name: 'instantsearch'
|
|
@@ -12536,6 +12536,12 @@
|
|
|
12536
12536
|
}
|
|
12537
12537
|
});
|
|
12538
12538
|
/**
|
|
12539
|
+
* Regenerate the chat id. Use this to start a fresh conversation on the
|
|
12540
|
+
* server while keeping the same Chat instance and its registered listeners.
|
|
12541
|
+
*/ _define_property(this, "regenerateId", function() {
|
|
12542
|
+
_this.id = _this.generateId();
|
|
12543
|
+
});
|
|
12544
|
+
/**
|
|
12539
12545
|
* Add a tool result for a tool call.
|
|
12540
12546
|
*/ _define_property(this, "addToolResult", function(param) {
|
|
12541
12547
|
var tool = param.tool, toolCallId = param.toolCallId, output = param.output;
|
|
@@ -13412,6 +13418,41 @@
|
|
|
13412
13418
|
return Chat;
|
|
13413
13419
|
}(AbstractChat);
|
|
13414
13420
|
|
|
13421
|
+
// Centralizes the "open the chat from an entry point" behavior shared by the
|
|
13422
|
+
// SearchBox AI button, the Autocomplete AI button, prompt suggestions, and any
|
|
13423
|
+
// future entry point. The chat is always opened; the message is only sent when
|
|
13424
|
+
// it is non-empty and the chat is not already processing a message.
|
|
13425
|
+
// Returns true when a message was submitted, so callers can clear their input.
|
|
13426
|
+
function openChat(chatRenderState) {
|
|
13427
|
+
var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, message = _ref.message, referer = _ref.referer;
|
|
13428
|
+
var _ref1;
|
|
13429
|
+
var _chatRenderState_setOpen;
|
|
13430
|
+
if (!chatRenderState) {
|
|
13431
|
+
return false;
|
|
13432
|
+
}
|
|
13433
|
+
(_chatRenderState_setOpen = chatRenderState.setOpen) === null || _chatRenderState_setOpen === void 0 ? void 0 : _chatRenderState_setOpen.call(chatRenderState, true);
|
|
13434
|
+
var trimmed = (_ref1 = message === null || message === void 0 ? void 0 : message.trim()) !== null && _ref1 !== void 0 ? _ref1 : '';
|
|
13435
|
+
if (!trimmed) {
|
|
13436
|
+
var _chatRenderState_focusInput;
|
|
13437
|
+
(_chatRenderState_focusInput = chatRenderState.focusInput) === null || _chatRenderState_focusInput === void 0 ? void 0 : _chatRenderState_focusInput.call(chatRenderState);
|
|
13438
|
+
return false;
|
|
13439
|
+
}
|
|
13440
|
+
if (isChatBusy(chatRenderState) || !chatRenderState.sendMessage) {
|
|
13441
|
+
return false;
|
|
13442
|
+
}
|
|
13443
|
+
chatRenderState.sendMessage({
|
|
13444
|
+
text: trimmed
|
|
13445
|
+
}, referer ? {
|
|
13446
|
+
headers: {
|
|
13447
|
+
'x-algolia-referer': referer
|
|
13448
|
+
}
|
|
13449
|
+
} : undefined);
|
|
13450
|
+
return true;
|
|
13451
|
+
}
|
|
13452
|
+
function isChatBusy(chatRenderState) {
|
|
13453
|
+
return (chatRenderState === null || chatRenderState === void 0 ? void 0 : chatRenderState.status) === 'submitted' || (chatRenderState === null || chatRenderState === void 0 ? void 0 : chatRenderState.status) === 'streaming';
|
|
13454
|
+
}
|
|
13455
|
+
|
|
13415
13456
|
var SearchIndexToolType$1 = 'algolia_search_index';
|
|
13416
13457
|
var RecommendToolType = 'algolia_recommend';
|
|
13417
13458
|
var MemorizeToolType = 'algolia_memorize';
|
|
@@ -13707,12 +13748,14 @@
|
|
|
13707
13748
|
var onClearTransitionEnd = function onClearTransitionEnd() {
|
|
13708
13749
|
setMessages([]);
|
|
13709
13750
|
_chatInstance.clearError();
|
|
13751
|
+
_chatInstance.regenerateId();
|
|
13710
13752
|
feedbackState = {};
|
|
13711
13753
|
setIsClearing(false);
|
|
13712
13754
|
};
|
|
13713
13755
|
var makeChatInstance = function makeChatInstance(instantSearchInstance) {
|
|
13714
13756
|
var transport;
|
|
13715
|
-
var
|
|
13757
|
+
var client = instantSearchInstance.client;
|
|
13758
|
+
var _getAppIdAndApiKey = _sliced_to_array(getAppIdAndApiKey(client), 2), appId = _getAppIdAndApiKey[0], apiKey = _getAppIdAndApiKey[1];
|
|
13716
13759
|
// Filter out custom data parts (like data-suggestions) that the backend doesn't accept
|
|
13717
13760
|
var filterDataParts = function filterDataParts(messages) {
|
|
13718
13761
|
return messages.map(function(message) {
|
|
@@ -13729,9 +13772,16 @@
|
|
|
13729
13772
|
transport = new DefaultChatTransport(_object_spread_props(_object_spread({}, options.transport), {
|
|
13730
13773
|
prepareSendMessagesRequest: function prepareSendMessagesRequest(params) {
|
|
13731
13774
|
// Call the original prepareSendMessagesRequest if it exists,
|
|
13732
|
-
// otherwise construct
|
|
13775
|
+
// otherwise construct a minimal default body containing only the
|
|
13776
|
+
// request payload — without leaking transport metadata such as
|
|
13777
|
+
// resolved headers, api URL, credentials, or `requestMetadata`.
|
|
13733
13778
|
var preparedOrPromise = originalPrepare ? originalPrepare(params) : {
|
|
13734
|
-
body: _object_spread({
|
|
13779
|
+
body: _object_spread({
|
|
13780
|
+
id: params.id,
|
|
13781
|
+
messageId: params.messageId,
|
|
13782
|
+
trigger: params.trigger,
|
|
13783
|
+
messages: params.messages
|
|
13784
|
+
}, params.body)
|
|
13735
13785
|
};
|
|
13736
13786
|
// Then filter out data-* parts
|
|
13737
13787
|
var applyFilter = function applyFilter(prepared) {
|
|
@@ -13758,20 +13808,19 @@
|
|
|
13758
13808
|
api: baseApi,
|
|
13759
13809
|
headers: {
|
|
13760
13810
|
'x-algolia-application-id': appId,
|
|
13761
|
-
'x-algolia-api-
|
|
13762
|
-
'x-algolia-agent': getAlgoliaAgent(
|
|
13811
|
+
'x-algolia-api-key': apiKey,
|
|
13812
|
+
'x-algolia-agent': "".concat(getAlgoliaAgent(client), "; chat")
|
|
13763
13813
|
},
|
|
13764
|
-
prepareSendMessagesRequest: function prepareSendMessagesRequest(
|
|
13765
|
-
var messages =
|
|
13766
|
-
"messages",
|
|
13767
|
-
"trigger"
|
|
13768
|
-
]);
|
|
13814
|
+
prepareSendMessagesRequest: function prepareSendMessagesRequest(param) {
|
|
13815
|
+
var id = param.id, messages = param.messages, trigger = param.trigger, messageId = param.messageId;
|
|
13769
13816
|
return {
|
|
13770
13817
|
// Bypass cache when regenerating to ensure fresh responses
|
|
13771
13818
|
api: trigger === 'regenerate-message' ? "".concat(baseApi, "&cache=false") : baseApi,
|
|
13772
|
-
body:
|
|
13819
|
+
body: {
|
|
13820
|
+
id: id,
|
|
13821
|
+
messageId: messageId,
|
|
13773
13822
|
messages: filterDataParts(messages)
|
|
13774
|
-
}
|
|
13823
|
+
}
|
|
13775
13824
|
};
|
|
13776
13825
|
}
|
|
13777
13826
|
});
|
|
@@ -13945,47 +13994,15 @@
|
|
|
13945
13994
|
message
|
|
13946
13995
|
].concat(_to_consumable_array(rest)));
|
|
13947
13996
|
}
|
|
13948
|
-
|
|
13949
|
-
|
|
13950
|
-
|
|
13951
|
-
serializedContext = JSON.stringify(resolvedContext);
|
|
13952
|
-
} catch (unused) {
|
|
13953
|
-
var _chatInstance3;
|
|
13954
|
-
return (_chatInstance3 = _chatInstance).sendMessage.apply(_chatInstance3, [
|
|
13955
|
-
message
|
|
13956
|
-
].concat(_to_consumable_array(rest)));
|
|
13957
|
-
}
|
|
13958
|
-
var contextTextPart = {
|
|
13959
|
-
type: 'text',
|
|
13960
|
-
text: '<context>'.concat(serializedContext).concat('</context>')
|
|
13961
|
-
};
|
|
13962
|
-
if ('parts' in message && message.parts) {
|
|
13963
|
-
var _chatInstance4;
|
|
13964
|
-
return (_chatInstance4 = _chatInstance).sendMessage.apply(_chatInstance4, [
|
|
13965
|
-
_object_spread_props(_object_spread({}, message), {
|
|
13966
|
-
parts: [
|
|
13967
|
-
contextTextPart
|
|
13968
|
-
].concat(_to_consumable_array(message.parts)),
|
|
13969
|
-
text: undefined,
|
|
13970
|
-
files: undefined
|
|
13971
|
-
})
|
|
13972
|
-
].concat(_to_consumable_array(rest)));
|
|
13973
|
-
}
|
|
13974
|
-
var textContent = 'text' in message && message.text ? message.text : '';
|
|
13997
|
+
// Resolve once per send; let the server validate the payload and
|
|
13998
|
+
// surface any contract violations.
|
|
13999
|
+
var turnContext = typeof context === 'function' ? context() : context;
|
|
13975
14000
|
return (_chatInstance1 = _chatInstance).sendMessage.apply(_chatInstance1, [
|
|
13976
|
-
{
|
|
13977
|
-
|
|
13978
|
-
|
|
13979
|
-
|
|
13980
|
-
|
|
13981
|
-
text: textContent
|
|
13982
|
-
}
|
|
13983
|
-
],
|
|
13984
|
-
metadata: message.metadata,
|
|
13985
|
-
messageId: message.messageId,
|
|
13986
|
-
files: undefined,
|
|
13987
|
-
text: undefined
|
|
13988
|
-
}
|
|
14001
|
+
_object_spread_props(_object_spread({}, message), {
|
|
14002
|
+
metadata: _object_spread_props(_object_spread({}, message.metadata), {
|
|
14003
|
+
turnContext: turnContext
|
|
14004
|
+
})
|
|
14005
|
+
})
|
|
13989
14006
|
].concat(_to_consumable_array(rest)));
|
|
13990
14007
|
};
|
|
13991
14008
|
return {
|
|
@@ -17393,7 +17410,7 @@
|
|
|
17393
17410
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
17394
17411
|
checkRendering(renderFn, withUsage$2());
|
|
17395
17412
|
return function(widgetParams) {
|
|
17396
|
-
var _ref = widgetParams || {}, facetName = _ref.facetName, limit = _ref.limit, threshold = _ref.threshold, fallbackParameters = _ref.fallbackParameters,
|
|
17413
|
+
var _ref = widgetParams || {}, facetName = _ref.facetName, limit = _ref.limit, threshold = _ref.threshold, fallbackParameters = _ref.fallbackParameters, _ref_escapeHTML = _ref.escapeHTML, escapeHTML = _ref_escapeHTML === void 0 ? true : _ref_escapeHTML, _ref_transformItems = _ref.transformItems, transformItems = _ref_transformItems === void 0 ? function(items) {
|
|
17397
17414
|
return items;
|
|
17398
17415
|
} : _ref_transformItems;
|
|
17399
17416
|
if (!facetName) {
|
|
@@ -17461,7 +17478,6 @@
|
|
|
17461
17478
|
maxRecommendations: limit,
|
|
17462
17479
|
threshold: threshold,
|
|
17463
17480
|
fallbackParameters: fallbackParameters ? _object_spread({}, fallbackParameters, escapeHTML ? TAG_PLACEHOLDER : {}) : undefined,
|
|
17464
|
-
queryParameters: _object_spread({}, queryParameters, escapeHTML ? TAG_PLACEHOLDER : {}),
|
|
17465
17481
|
$$id: this.$$id
|
|
17466
17482
|
});
|
|
17467
17483
|
}
|
|
@@ -17565,7 +17581,9 @@
|
|
|
17565
17581
|
name: 'filter-suggestions',
|
|
17566
17582
|
connector: true
|
|
17567
17583
|
});
|
|
17568
|
-
|
|
17584
|
+
/**
|
|
17585
|
+
* @deprecated Filter suggestions are deprecated and will be removed in a future major version.
|
|
17586
|
+
*/ var connectFilterSuggestions = function connectFilterSuggestions(renderFn) {
|
|
17569
17587
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
17570
17588
|
checkRendering(renderFn, withUsage());
|
|
17571
17589
|
return function(widgetParams) {
|
|
@@ -17777,7 +17795,9 @@
|
|
|
17777
17795
|
};
|
|
17778
17796
|
};
|
|
17779
17797
|
|
|
17780
|
-
|
|
17798
|
+
/**
|
|
17799
|
+
* @deprecated Filter suggestions are deprecated and will be removed in a future major version.
|
|
17800
|
+
*/ function useFilterSuggestions(props, additionalWidgetProperties) {
|
|
17781
17801
|
return useConnector(connectFilterSuggestions, props, additionalWidgetProperties);
|
|
17782
17802
|
}
|
|
17783
17803
|
|
|
@@ -18804,7 +18824,7 @@
|
|
|
18804
18824
|
function createAutocompleteSearchComponent(param) {
|
|
18805
18825
|
var createElement = param.createElement;
|
|
18806
18826
|
return function AutocompleteSearch(userProps) {
|
|
18807
|
-
var inputProps = userProps.inputProps, onClear = userProps.onClear, query = userProps.query, isSearchStalled = userProps.isSearchStalled, onCancel = userProps.onCancel, isDetached = userProps.isDetached, submitTitle = userProps.submitTitle, onAiModeClick = userProps.onAiModeClick, _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames;
|
|
18827
|
+
var inputProps = userProps.inputProps, onClear = userProps.onClear, query = userProps.query, isSearchStalled = userProps.isSearchStalled, onCancel = userProps.onCancel, isDetached = userProps.isDetached, submitTitle = userProps.submitTitle, onAiModeClick = userProps.onAiModeClick, _userProps_aiModeButtonDisabled = userProps.aiModeButtonDisabled, aiModeButtonDisabled = _userProps_aiModeButtonDisabled === void 0 ? false : _userProps_aiModeButtonDisabled, _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames;
|
|
18808
18828
|
var isBackButton = Boolean(isDetached && onCancel);
|
|
18809
18829
|
var resolvedCancelTitle = submitTitle !== null && submitTitle !== void 0 ? submitTitle : 'Close';
|
|
18810
18830
|
var inputRef = inputProps.ref;
|
|
@@ -18881,6 +18901,7 @@
|
|
|
18881
18901
|
className: cx('ais-AiModeButton', classNames.aiModeButton),
|
|
18882
18902
|
type: "button",
|
|
18883
18903
|
title: "AI Mode",
|
|
18904
|
+
disabled: aiModeButtonDisabled,
|
|
18884
18905
|
onClick: function onClick(e) {
|
|
18885
18906
|
e.preventDefault();
|
|
18886
18907
|
onAiModeClick();
|
|
@@ -19687,6 +19708,10 @@
|
|
|
19687
19708
|
return null;
|
|
19688
19709
|
}
|
|
19689
19710
|
if (part.type === 'text') {
|
|
19711
|
+
// Back-compat shim for sessions started before the move from a
|
|
19712
|
+
// `<context>{...}</context>` text part to `metadata.turnContext`.
|
|
19713
|
+
// Safe to remove once existing sessionStorage transcripts have
|
|
19714
|
+
// rolled over (~2 weeks after release).
|
|
19690
19715
|
if (part.text.startsWith('<context>') && part.text.endsWith('</context>')) {
|
|
19691
19716
|
return null;
|
|
19692
19717
|
}
|
|
@@ -21696,7 +21721,7 @@
|
|
|
21696
21721
|
Fragment: React.Fragment
|
|
21697
21722
|
});
|
|
21698
21723
|
function AutocompleteSearch(param) {
|
|
21699
|
-
var inputProps = param.inputProps, clearQuery = param.clearQuery, onQueryChange = param.onQueryChange, query = param.query, isSearchStalled = param.isSearchStalled, onCancel = param.onCancel, isDetached = param.isDetached, submitTitle = param.submitTitle, onAiModeClick = param.onAiModeClick, classNames = param.classNames;
|
|
21724
|
+
var inputProps = param.inputProps, clearQuery = param.clearQuery, onQueryChange = param.onQueryChange, query = param.query, isSearchStalled = param.isSearchStalled, onCancel = param.onCancel, isDetached = param.isDetached, submitTitle = param.submitTitle, onAiModeClick = param.onAiModeClick, aiModeButtonDisabled = param.aiModeButtonDisabled, classNames = param.classNames;
|
|
21700
21725
|
return /*#__PURE__*/ React.createElement(AutocompleteSearchComponent, {
|
|
21701
21726
|
inputProps: _object_spread_props(_object_spread({}, inputProps), {
|
|
21702
21727
|
onChange: function onChange(event) {
|
|
@@ -21711,6 +21736,7 @@
|
|
|
21711
21736
|
isDetached: isDetached,
|
|
21712
21737
|
submitTitle: submitTitle,
|
|
21713
21738
|
onAiModeClick: onAiModeClick,
|
|
21739
|
+
aiModeButtonDisabled: aiModeButtonDisabled,
|
|
21714
21740
|
classNames: classNames
|
|
21715
21741
|
});
|
|
21716
21742
|
}
|
|
@@ -22207,14 +22233,13 @@
|
|
|
22207
22233
|
onSelect: userOnSelect !== null && userOnSelect !== void 0 ? userOnSelect : function(param) {
|
|
22208
22234
|
var item = param.item, query = param.query, setQuery = param.setQuery, url = param.url;
|
|
22209
22235
|
if (isPromptSuggestion(item)) {
|
|
22210
|
-
|
|
22211
|
-
|
|
22212
|
-
|
|
22213
|
-
|
|
22214
|
-
|
|
22215
|
-
|
|
22216
|
-
|
|
22217
|
-
});
|
|
22236
|
+
if (chatRenderState) {
|
|
22237
|
+
if (openChat(chatRenderState, {
|
|
22238
|
+
message: item.prompt,
|
|
22239
|
+
referer: 'prompt-suggestions'
|
|
22240
|
+
})) {
|
|
22241
|
+
setQuery('');
|
|
22242
|
+
}
|
|
22218
22243
|
return;
|
|
22219
22244
|
}
|
|
22220
22245
|
if ((showPromptSuggestions === null || showPromptSuggestions === void 0 ? void 0 : showPromptSuggestions.indexName) && !hasWarnedMissingPromptSuggestionsChatRef.current) {
|
|
@@ -22354,17 +22379,15 @@
|
|
|
22354
22379
|
if (isDetached) {
|
|
22355
22380
|
setIsModalOpen(false);
|
|
22356
22381
|
}
|
|
22357
|
-
if (chatRenderState
|
|
22358
|
-
|
|
22359
|
-
|
|
22360
|
-
|
|
22361
|
-
|
|
22362
|
-
|
|
22363
|
-
text: resolvedQuery
|
|
22364
|
-
});
|
|
22365
|
-
}
|
|
22382
|
+
if (openChat(chatRenderState, {
|
|
22383
|
+
message: resolvedQuery,
|
|
22384
|
+
referer: 'ai-mode'
|
|
22385
|
+
})) {
|
|
22386
|
+
refineSearchBox('');
|
|
22387
|
+
refineAutocomplete('');
|
|
22366
22388
|
}
|
|
22367
22389
|
} : undefined,
|
|
22390
|
+
aiModeButtonDisabled: aiMode ? isChatBusy(chatRenderState) : undefined,
|
|
22368
22391
|
classNames: classNames
|
|
22369
22392
|
});
|
|
22370
22393
|
var panelContent = /*#__PURE__*/ React.createElement(AutocompletePanel, _object_spread_props(_object_spread({}, getPanelProps()), {
|
|
@@ -24013,7 +24036,7 @@
|
|
|
24013
24036
|
}));
|
|
24014
24037
|
}
|
|
24015
24038
|
function SearchBox$1(_0) {
|
|
24016
|
-
var formRef = _0.formRef, inputRef = _0.inputRef, inputProps = _0.inputProps, isSearchStalled = _0.isSearchStalled, onChange = _0.onChange, onReset = _0.onReset, onSubmit = _0.onSubmit, _0_placeholder = _0.placeholder, placeholder = _0_placeholder === void 0 ? '' : _0_placeholder, value = _0.value, autoFocus = _0.autoFocus, tmp = _0.resetIconComponent, ResetIcon = tmp === void 0 ? DefaultResetIcon : tmp, tmp1 = _0.submitIconComponent, SubmitIcon = tmp1 === void 0 ? DefaultSubmitIcon : tmp1, tmp2 = _0.loadingIconComponent, LoadingIcon = tmp2 === void 0 ? DefaultLoadingIcon : tmp2, tmp3 = _0.aiModeIconComponent, AiModeIcon = tmp3 === void 0 ? DefaultAiModeIcon : tmp3, onAiModeClick = _0.onAiModeClick, _0_classNames = _0.classNames, classNames = _0_classNames === void 0 ? {} : _0_classNames, translations = _0.translations, props = _object_without_properties(_0, [
|
|
24039
|
+
var formRef = _0.formRef, inputRef = _0.inputRef, inputProps = _0.inputProps, isSearchStalled = _0.isSearchStalled, onChange = _0.onChange, onReset = _0.onReset, onSubmit = _0.onSubmit, _0_placeholder = _0.placeholder, placeholder = _0_placeholder === void 0 ? '' : _0_placeholder, value = _0.value, autoFocus = _0.autoFocus, tmp = _0.resetIconComponent, ResetIcon = tmp === void 0 ? DefaultResetIcon : tmp, tmp1 = _0.submitIconComponent, SubmitIcon = tmp1 === void 0 ? DefaultSubmitIcon : tmp1, tmp2 = _0.loadingIconComponent, LoadingIcon = tmp2 === void 0 ? DefaultLoadingIcon : tmp2, tmp3 = _0.aiModeIconComponent, AiModeIcon = tmp3 === void 0 ? DefaultAiModeIcon : tmp3, onAiModeClick = _0.onAiModeClick, _0_aiModeButtonDisabled = _0.aiModeButtonDisabled, aiModeButtonDisabled = _0_aiModeButtonDisabled === void 0 ? false : _0_aiModeButtonDisabled, _0_classNames = _0.classNames, classNames = _0_classNames === void 0 ? {} : _0_classNames, translations = _0.translations, props = _object_without_properties(_0, [
|
|
24017
24040
|
"formRef",
|
|
24018
24041
|
"inputRef",
|
|
24019
24042
|
"inputProps",
|
|
@@ -24029,6 +24052,7 @@
|
|
|
24029
24052
|
"loadingIconComponent",
|
|
24030
24053
|
"aiModeIconComponent",
|
|
24031
24054
|
"onAiModeClick",
|
|
24055
|
+
"aiModeButtonDisabled",
|
|
24032
24056
|
"classNames",
|
|
24033
24057
|
"translations"
|
|
24034
24058
|
]);
|
|
@@ -24092,6 +24116,7 @@
|
|
|
24092
24116
|
className: cx('ais-AiModeButton', classNames.aiModeButton),
|
|
24093
24117
|
type: "button",
|
|
24094
24118
|
title: translations.aiModeButtonTitle || 'AI Mode',
|
|
24119
|
+
disabled: aiModeButtonDisabled,
|
|
24095
24120
|
onClick: function onClick(e) {
|
|
24096
24121
|
e.preventDefault();
|
|
24097
24122
|
onAiModeClick();
|
|
@@ -24310,6 +24335,7 @@
|
|
|
24310
24335
|
if (query !== inputValue && document.activeElement !== inputRef.current) {
|
|
24311
24336
|
setInputValue(query);
|
|
24312
24337
|
}
|
|
24338
|
+
var chatRenderState = indexRenderState.chat;
|
|
24313
24339
|
var uiProps = {
|
|
24314
24340
|
inputRef: inputRef,
|
|
24315
24341
|
isSearchStalled: isSearchStalled,
|
|
@@ -24317,18 +24343,14 @@
|
|
|
24317
24343
|
onReset: onReset,
|
|
24318
24344
|
onSubmit: onSubmit,
|
|
24319
24345
|
onAiModeClick: aiMode ? function() {
|
|
24320
|
-
|
|
24321
|
-
|
|
24322
|
-
|
|
24323
|
-
|
|
24324
|
-
|
|
24325
|
-
var _chatRenderState_sendMessage;
|
|
24326
|
-
(_chatRenderState_sendMessage = chatRenderState.sendMessage) === null || _chatRenderState_sendMessage === void 0 ? void 0 : _chatRenderState_sendMessage.call(chatRenderState, {
|
|
24327
|
-
text: inputValue
|
|
24328
|
-
});
|
|
24329
|
-
}
|
|
24346
|
+
if (openChat(chatRenderState, {
|
|
24347
|
+
message: inputValue,
|
|
24348
|
+
referer: 'ai-mode'
|
|
24349
|
+
})) {
|
|
24350
|
+
onReset();
|
|
24330
24351
|
}
|
|
24331
24352
|
} : undefined,
|
|
24353
|
+
aiModeButtonDisabled: aiMode ? isChatBusy(chatRenderState) : undefined,
|
|
24332
24354
|
value: inputValue,
|
|
24333
24355
|
translations: _object_spread({
|
|
24334
24356
|
submitButtonTitle: 'Submit the search query',
|
|
@@ -24608,12 +24630,11 @@
|
|
|
24608
24630
|
Fragment: React.Fragment
|
|
24609
24631
|
});
|
|
24610
24632
|
function TrendingFacets(_0) {
|
|
24611
|
-
var facetName = _0.facetName, limit = _0.limit, threshold = _0.threshold, fallbackParameters = _0.fallbackParameters,
|
|
24633
|
+
var facetName = _0.facetName, limit = _0.limit, threshold = _0.threshold, fallbackParameters = _0.fallbackParameters, escapeHTML = _0.escapeHTML, transformItems = _0.transformItems, itemComponent = _0.itemComponent, headerComponent = _0.headerComponent, emptyComponent = _0.emptyComponent, props = _object_without_properties(_0, [
|
|
24612
24634
|
"facetName",
|
|
24613
24635
|
"limit",
|
|
24614
24636
|
"threshold",
|
|
24615
24637
|
"fallbackParameters",
|
|
24616
|
-
"queryParameters",
|
|
24617
24638
|
"escapeHTML",
|
|
24618
24639
|
"transformItems",
|
|
24619
24640
|
"itemComponent",
|
|
@@ -24626,7 +24647,6 @@
|
|
|
24626
24647
|
limit: limit,
|
|
24627
24648
|
threshold: threshold,
|
|
24628
24649
|
fallbackParameters: fallbackParameters,
|
|
24629
|
-
queryParameters: queryParameters,
|
|
24630
24650
|
escapeHTML: escapeHTML,
|
|
24631
24651
|
transformItems: transformItems
|
|
24632
24652
|
}, {
|
|
@@ -24646,7 +24666,9 @@
|
|
|
24646
24666
|
createElement: React.createElement,
|
|
24647
24667
|
Fragment: React.Fragment
|
|
24648
24668
|
});
|
|
24649
|
-
|
|
24669
|
+
/**
|
|
24670
|
+
* @deprecated Filter suggestions are deprecated and will be removed in a future major version.
|
|
24671
|
+
*/ function FilterSuggestions(_0) {
|
|
24650
24672
|
var agentId = _0.agentId, attributes = _0.attributes, maxSuggestions = _0.maxSuggestions, debounceMs = _0.debounceMs, hitsToSample = _0.hitsToSample, transformItems = _0.transformItems, itemComponent = _0.itemComponent, headerComponent = _0.headerComponent, emptyComponent = _0.emptyComponent, transport = _0.transport, props = _object_without_properties(_0, [
|
|
24651
24673
|
"agentId",
|
|
24652
24674
|
"attributes",
|