react-instantsearch-core 7.32.2 → 7.33.0
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/version.js +1 -1
- package/dist/es/connectors/useFilterSuggestions.d.ts +3 -0
- package/dist/es/connectors/useFilterSuggestions.js +3 -1
- package/dist/es/version.d.ts +1 -1
- package/dist/es/version.js +1 -1
- package/dist/umd/ReactInstantSearchCore.js +45 -20
- package/dist/umd/ReactInstantSearchCore.min.js +3 -3
- package/package.json +3 -3
package/dist/cjs/version.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { AdditionalWidgetProperties } from '../hooks/useConnector';
|
|
2
2
|
import type { FilterSuggestionsConnectorParams } from 'instantsearch.js/es/connectors/filter-suggestions/connectFilterSuggestions';
|
|
3
3
|
export type UseFilterSuggestionsProps = FilterSuggestionsConnectorParams;
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Filter suggestions are deprecated and will be removed in a future major version.
|
|
6
|
+
*/
|
|
4
7
|
export declare function useFilterSuggestions(props: UseFilterSuggestionsProps, additionalWidgetProperties?: AdditionalWidgetProperties): import("instantsearch.js/es/connectors/filter-suggestions/connectFilterSuggestions").FilterSuggestionsRenderState;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import connectFilterSuggestions from 'instantsearch.js/es/connectors/filter-suggestions/connectFilterSuggestions.js';
|
|
2
2
|
import { useConnector } from '../hooks/useConnector.js';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Filter suggestions are deprecated and will be removed in a future major version.
|
|
6
|
+
*/ function useFilterSuggestions(props, additionalWidgetProperties) {
|
|
5
7
|
return useConnector(connectFilterSuggestions, props, additionalWidgetProperties);
|
|
6
8
|
}
|
|
7
9
|
|
package/dist/es/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "7.
|
|
1
|
+
declare const _default: "7.33.0";
|
|
2
2
|
export default _default;
|
package/dist/es/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! React InstantSearch Core 7.
|
|
1
|
+
/*! React InstantSearch Core 7.33.0 | © 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.0';
|
|
28
28
|
|
|
29
29
|
function _define_property(obj, key, value) {
|
|
30
30
|
if (key in obj) {
|
|
@@ -10853,7 +10853,7 @@
|
|
|
10853
10853
|
};
|
|
10854
10854
|
}
|
|
10855
10855
|
|
|
10856
|
-
var version = '4.
|
|
10856
|
+
var version = '4.98.0';
|
|
10857
10857
|
|
|
10858
10858
|
var withUsage$q = createDocumentationMessageGenerator({
|
|
10859
10859
|
name: 'instantsearch'
|
|
@@ -12587,6 +12587,12 @@
|
|
|
12587
12587
|
}
|
|
12588
12588
|
});
|
|
12589
12589
|
/**
|
|
12590
|
+
* Regenerate the chat id. Use this to start a fresh conversation on the
|
|
12591
|
+
* server while keeping the same Chat instance and its registered listeners.
|
|
12592
|
+
*/ _define_property(this, "regenerateId", function() {
|
|
12593
|
+
_this.id = _this.generateId();
|
|
12594
|
+
});
|
|
12595
|
+
/**
|
|
12590
12596
|
* Add a tool result for a tool call.
|
|
12591
12597
|
*/ _define_property(this, "addToolResult", function(param) {
|
|
12592
12598
|
var tool = param.tool, toolCallId = param.toolCallId, output = param.output;
|
|
@@ -13696,12 +13702,13 @@
|
|
|
13696
13702
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
13697
13703
|
checkRendering(renderFn, withUsage$n());
|
|
13698
13704
|
return function(widgetParams) {
|
|
13699
|
-
var _ref = widgetParams || {}, _ref_resume = _ref.resume, resume = _ref_resume === void 0 ? false : _ref_resume, _ref_tools = _ref.tools, tools = _ref_tools === void 0 ? {} : _ref_tools, _ref_type = _ref.type, type = _ref_type === void 0 ? 'chat' : _ref_type, context = _ref.context, initialUserMessage = _ref.initialUserMessage, options = _object_without_properties(_ref, [
|
|
13705
|
+
var _ref = widgetParams || {}, _ref_resume = _ref.resume, resume = _ref_resume === void 0 ? false : _ref_resume, _ref_tools = _ref.tools, tools = _ref_tools === void 0 ? {} : _ref_tools, _ref_type = _ref.type, type = _ref_type === void 0 ? 'chat' : _ref_type, context = _ref.context, initialUserMessage = _ref.initialUserMessage, initialMessages = _ref.initialMessages, options = _object_without_properties(_ref, [
|
|
13700
13706
|
"resume",
|
|
13701
13707
|
"tools",
|
|
13702
13708
|
"type",
|
|
13703
13709
|
"context",
|
|
13704
|
-
"initialUserMessage"
|
|
13710
|
+
"initialUserMessage",
|
|
13711
|
+
"initialMessages"
|
|
13705
13712
|
]);
|
|
13706
13713
|
var _chatInstance;
|
|
13707
13714
|
var input = '';
|
|
@@ -13752,12 +13759,14 @@
|
|
|
13752
13759
|
var onClearTransitionEnd = function onClearTransitionEnd() {
|
|
13753
13760
|
setMessages([]);
|
|
13754
13761
|
_chatInstance.clearError();
|
|
13762
|
+
_chatInstance.regenerateId();
|
|
13755
13763
|
feedbackState = {};
|
|
13756
13764
|
setIsClearing(false);
|
|
13757
13765
|
};
|
|
13758
13766
|
var makeChatInstance = function makeChatInstance(instantSearchInstance) {
|
|
13759
13767
|
var transport;
|
|
13760
|
-
var
|
|
13768
|
+
var client = instantSearchInstance.client;
|
|
13769
|
+
var _getAppIdAndApiKey = _sliced_to_array(getAppIdAndApiKey(client), 2), appId = _getAppIdAndApiKey[0], apiKey = _getAppIdAndApiKey[1];
|
|
13761
13770
|
// Filter out custom data parts (like data-suggestions) that the backend doesn't accept
|
|
13762
13771
|
var filterDataParts = function filterDataParts(messages) {
|
|
13763
13772
|
return messages.map(function(message) {
|
|
@@ -13774,9 +13783,16 @@
|
|
|
13774
13783
|
transport = new DefaultChatTransport(_object_spread_props(_object_spread({}, options.transport), {
|
|
13775
13784
|
prepareSendMessagesRequest: function prepareSendMessagesRequest(params) {
|
|
13776
13785
|
// Call the original prepareSendMessagesRequest if it exists,
|
|
13777
|
-
// otherwise construct
|
|
13786
|
+
// otherwise construct a minimal default body containing only the
|
|
13787
|
+
// request payload — without leaking transport metadata such as
|
|
13788
|
+
// resolved headers, api URL, credentials, or `requestMetadata`.
|
|
13778
13789
|
var preparedOrPromise = originalPrepare ? originalPrepare(params) : {
|
|
13779
|
-
body: _object_spread({
|
|
13790
|
+
body: _object_spread({
|
|
13791
|
+
id: params.id,
|
|
13792
|
+
messageId: params.messageId,
|
|
13793
|
+
trigger: params.trigger,
|
|
13794
|
+
messages: params.messages
|
|
13795
|
+
}, params.body)
|
|
13780
13796
|
};
|
|
13781
13797
|
// Then filter out data-* parts
|
|
13782
13798
|
var applyFilter = function applyFilter(prepared) {
|
|
@@ -13803,20 +13819,19 @@
|
|
|
13803
13819
|
api: baseApi,
|
|
13804
13820
|
headers: {
|
|
13805
13821
|
'x-algolia-application-id': appId,
|
|
13806
|
-
'x-algolia-api-
|
|
13807
|
-
'x-algolia-agent': getAlgoliaAgent(
|
|
13822
|
+
'x-algolia-api-key': apiKey,
|
|
13823
|
+
'x-algolia-agent': "".concat(getAlgoliaAgent(client), "; chat")
|
|
13808
13824
|
},
|
|
13809
|
-
prepareSendMessagesRequest: function prepareSendMessagesRequest(
|
|
13810
|
-
var messages =
|
|
13811
|
-
"messages",
|
|
13812
|
-
"trigger"
|
|
13813
|
-
]);
|
|
13825
|
+
prepareSendMessagesRequest: function prepareSendMessagesRequest(param) {
|
|
13826
|
+
var id = param.id, messages = param.messages, trigger = param.trigger, messageId = param.messageId;
|
|
13814
13827
|
return {
|
|
13815
13828
|
// Bypass cache when regenerating to ensure fresh responses
|
|
13816
13829
|
api: trigger === 'regenerate-message' ? "".concat(baseApi, "&cache=false") : baseApi,
|
|
13817
|
-
body:
|
|
13830
|
+
body: {
|
|
13831
|
+
id: id,
|
|
13832
|
+
messageId: messageId,
|
|
13818
13833
|
messages: filterDataParts(messages)
|
|
13819
|
-
}
|
|
13834
|
+
}
|
|
13820
13835
|
};
|
|
13821
13836
|
}
|
|
13822
13837
|
});
|
|
@@ -13922,13 +13937,19 @@
|
|
|
13922
13937
|
});
|
|
13923
13938
|
};
|
|
13924
13939
|
}
|
|
13940
|
+
var hasExistingMessages = _chatInstance.messages.length > 0;
|
|
13941
|
+
// Set initialMessages before registering callbacks to avoid
|
|
13942
|
+
// triggering re-renders during init
|
|
13943
|
+
if ((initialMessages === null || initialMessages === void 0 ? void 0 : initialMessages.length) && !resume && !hasExistingMessages) {
|
|
13944
|
+
_chatInstance.messages = initialMessages;
|
|
13945
|
+
}
|
|
13925
13946
|
_chatInstance['~registerErrorCallback'](render);
|
|
13926
13947
|
_chatInstance['~registerMessagesCallback'](render);
|
|
13927
13948
|
_chatInstance['~registerStatusCallback'](render);
|
|
13928
13949
|
if (resume) {
|
|
13929
13950
|
_chatInstance.resumeStream();
|
|
13930
13951
|
}
|
|
13931
|
-
if (initialUserMessage && !resume &&
|
|
13952
|
+
if (initialUserMessage && !resume && !hasExistingMessages) {
|
|
13932
13953
|
_chatInstance.sendMessage({
|
|
13933
13954
|
text: initialUserMessage
|
|
13934
13955
|
});
|
|
@@ -17604,7 +17625,9 @@
|
|
|
17604
17625
|
name: 'filter-suggestions',
|
|
17605
17626
|
connector: true
|
|
17606
17627
|
});
|
|
17607
|
-
|
|
17628
|
+
/**
|
|
17629
|
+
* @deprecated Filter suggestions are deprecated and will be removed in a future major version.
|
|
17630
|
+
*/ var connectFilterSuggestions = function connectFilterSuggestions(renderFn) {
|
|
17608
17631
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
17609
17632
|
checkRendering(renderFn, withUsage());
|
|
17610
17633
|
return function(widgetParams) {
|
|
@@ -17816,7 +17839,9 @@
|
|
|
17816
17839
|
};
|
|
17817
17840
|
};
|
|
17818
17841
|
|
|
17819
|
-
|
|
17842
|
+
/**
|
|
17843
|
+
* @deprecated Filter suggestions are deprecated and will be removed in a future major version.
|
|
17844
|
+
*/ function useFilterSuggestions(props, additionalWidgetProperties) {
|
|
17820
17845
|
return useConnector(connectFilterSuggestions, props, additionalWidgetProperties);
|
|
17821
17846
|
}
|
|
17822
17847
|
|