react-instantsearch-core 7.32.3 → 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.
@@ -9,4 +9,4 @@ Object.defineProperty(exports, "default", {
9
9
  return _default;
10
10
  }
11
11
  });
12
- var _default = '7.32.3';
12
+ var _default = '7.33.0';
@@ -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
- function useFilterSuggestions(props, additionalWidgetProperties) {
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
 
@@ -1,2 +1,2 @@
1
- declare const _default: "7.32.3";
1
+ declare const _default: "7.33.0";
2
2
  export default _default;
@@ -1,3 +1,3 @@
1
- var version = '7.32.3';
1
+ var version = '7.33.0';
2
2
 
3
3
  export { version as default };
@@ -1,4 +1,4 @@
1
- /*! React InstantSearch Core 7.32.3 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
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.32.3';
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.97.0';
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;
@@ -13753,12 +13759,14 @@
13753
13759
  var onClearTransitionEnd = function onClearTransitionEnd() {
13754
13760
  setMessages([]);
13755
13761
  _chatInstance.clearError();
13762
+ _chatInstance.regenerateId();
13756
13763
  feedbackState = {};
13757
13764
  setIsClearing(false);
13758
13765
  };
13759
13766
  var makeChatInstance = function makeChatInstance(instantSearchInstance) {
13760
13767
  var transport;
13761
- var _getAppIdAndApiKey = _sliced_to_array(getAppIdAndApiKey(instantSearchInstance.client), 2), appId = _getAppIdAndApiKey[0], apiKey = _getAppIdAndApiKey[1];
13768
+ var client = instantSearchInstance.client;
13769
+ var _getAppIdAndApiKey = _sliced_to_array(getAppIdAndApiKey(client), 2), appId = _getAppIdAndApiKey[0], apiKey = _getAppIdAndApiKey[1];
13762
13770
  // Filter out custom data parts (like data-suggestions) that the backend doesn't accept
13763
13771
  var filterDataParts = function filterDataParts(messages) {
13764
13772
  return messages.map(function(message) {
@@ -13775,9 +13783,16 @@
13775
13783
  transport = new DefaultChatTransport(_object_spread_props(_object_spread({}, options.transport), {
13776
13784
  prepareSendMessagesRequest: function prepareSendMessagesRequest(params) {
13777
13785
  // Call the original prepareSendMessagesRequest if it exists,
13778
- // otherwise construct the default body
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`.
13779
13789
  var preparedOrPromise = originalPrepare ? originalPrepare(params) : {
13780
- body: _object_spread({}, params)
13790
+ body: _object_spread({
13791
+ id: params.id,
13792
+ messageId: params.messageId,
13793
+ trigger: params.trigger,
13794
+ messages: params.messages
13795
+ }, params.body)
13781
13796
  };
13782
13797
  // Then filter out data-* parts
13783
13798
  var applyFilter = function applyFilter(prepared) {
@@ -13804,20 +13819,19 @@
13804
13819
  api: baseApi,
13805
13820
  headers: {
13806
13821
  'x-algolia-application-id': appId,
13807
- 'x-algolia-api-Key': apiKey,
13808
- 'x-algolia-agent': getAlgoliaAgent(instantSearchInstance.client)
13822
+ 'x-algolia-api-key': apiKey,
13823
+ 'x-algolia-agent': "".concat(getAlgoliaAgent(client), "; chat")
13809
13824
  },
13810
- prepareSendMessagesRequest: function prepareSendMessagesRequest(_0) {
13811
- var messages = _0.messages, trigger = _0.trigger, rest = _object_without_properties(_0, [
13812
- "messages",
13813
- "trigger"
13814
- ]);
13825
+ prepareSendMessagesRequest: function prepareSendMessagesRequest(param) {
13826
+ var id = param.id, messages = param.messages, trigger = param.trigger, messageId = param.messageId;
13815
13827
  return {
13816
13828
  // Bypass cache when regenerating to ensure fresh responses
13817
13829
  api: trigger === 'regenerate-message' ? "".concat(baseApi, "&cache=false") : baseApi,
13818
- body: _object_spread_props(_object_spread({}, rest), {
13830
+ body: {
13831
+ id: id,
13832
+ messageId: messageId,
13819
13833
  messages: filterDataParts(messages)
13820
- })
13834
+ }
13821
13835
  };
13822
13836
  }
13823
13837
  });
@@ -17611,7 +17625,9 @@
17611
17625
  name: 'filter-suggestions',
17612
17626
  connector: true
17613
17627
  });
17614
- var connectFilterSuggestions = function connectFilterSuggestions(renderFn) {
17628
+ /**
17629
+ * @deprecated Filter suggestions are deprecated and will be removed in a future major version.
17630
+ */ var connectFilterSuggestions = function connectFilterSuggestions(renderFn) {
17615
17631
  var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
17616
17632
  checkRendering(renderFn, withUsage());
17617
17633
  return function(widgetParams) {
@@ -17823,7 +17839,9 @@
17823
17839
  };
17824
17840
  };
17825
17841
 
17826
- function useFilterSuggestions(props, additionalWidgetProperties) {
17842
+ /**
17843
+ * @deprecated Filter suggestions are deprecated and will be removed in a future major version.
17844
+ */ function useFilterSuggestions(props, additionalWidgetProperties) {
17827
17845
  return useConnector(connectFilterSuggestions, props, additionalWidgetProperties);
17828
17846
  }
17829
17847