react-instantsearch-core 7.28.1 → 7.29.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
CHANGED
package/dist/es/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "7.
|
|
1
|
+
declare const _default: "7.29.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.29.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.29.0';
|
|
28
28
|
|
|
29
29
|
function _define_property(obj, key, value) {
|
|
30
30
|
if (key in obj) {
|
|
@@ -9721,7 +9721,7 @@
|
|
|
9721
9721
|
};
|
|
9722
9722
|
}
|
|
9723
9723
|
|
|
9724
|
-
var version = '4.
|
|
9724
|
+
var version = '4.93.0';
|
|
9725
9725
|
|
|
9726
9726
|
function hydrateSearchClient(client, results) {
|
|
9727
9727
|
if (!results) {
|
|
@@ -12630,6 +12630,30 @@
|
|
|
12630
12630
|
return DefaultChatTransport;
|
|
12631
12631
|
}(HttpChatTransport);
|
|
12632
12632
|
|
|
12633
|
+
function sendChatMessageFeedback(param) {
|
|
12634
|
+
var agentId = param.agentId, vote = param.vote, messageId = param.messageId, appId = param.appId, apiKey = param.apiKey;
|
|
12635
|
+
return fetch("https://".concat(appId, ".algolia.net/agent-studio/1/feedback"), {
|
|
12636
|
+
method: 'POST',
|
|
12637
|
+
body: JSON.stringify({
|
|
12638
|
+
messageId: messageId,
|
|
12639
|
+
agentId: agentId,
|
|
12640
|
+
vote: vote
|
|
12641
|
+
}),
|
|
12642
|
+
headers: {
|
|
12643
|
+
'x-algolia-application-id': appId,
|
|
12644
|
+
'x-algolia-api-key': apiKey,
|
|
12645
|
+
'content-type': 'application/json'
|
|
12646
|
+
}
|
|
12647
|
+
}).then(function(response) {
|
|
12648
|
+
if (response.status >= 300) {
|
|
12649
|
+
return response.json().then(function(data) {
|
|
12650
|
+
throw new Error("Feedback request failed with status ".concat(response.status, ": ").concat(data.message));
|
|
12651
|
+
});
|
|
12652
|
+
}
|
|
12653
|
+
return response.json();
|
|
12654
|
+
});
|
|
12655
|
+
}
|
|
12656
|
+
|
|
12633
12657
|
/**
|
|
12634
12658
|
* Clears the refinements of a SearchParameters object based on rules provided.
|
|
12635
12659
|
* The included attributes list is applied before the excluded attributes list. If the list
|
|
@@ -12849,7 +12873,11 @@
|
|
|
12849
12873
|
var setOpen;
|
|
12850
12874
|
var focusInput;
|
|
12851
12875
|
var setIsClearing;
|
|
12876
|
+
var setFeedbackState;
|
|
12852
12877
|
var agentId = 'agentId' in options ? options.agentId : undefined;
|
|
12878
|
+
var feedbackState = {};
|
|
12879
|
+
var _sendChatMessageFeedback;
|
|
12880
|
+
var feedbackAbortController;
|
|
12853
12881
|
// Extract suggestions from the last assistant message's data-suggestions part
|
|
12854
12882
|
var getSuggestionsFromMessages = function getSuggestionsFromMessages(messages) {
|
|
12855
12883
|
// Find the last assistant message (iterate from end)
|
|
@@ -12881,6 +12909,7 @@
|
|
|
12881
12909
|
var onClearTransitionEnd = function onClearTransitionEnd() {
|
|
12882
12910
|
setMessages([]);
|
|
12883
12911
|
_chatInstance.clearError();
|
|
12912
|
+
feedbackState = {};
|
|
12884
12913
|
setIsClearing(false);
|
|
12885
12914
|
};
|
|
12886
12915
|
var makeChatInstance = function makeChatInstance(instantSearchInstance) {
|
|
@@ -13015,6 +13044,33 @@
|
|
|
13015
13044
|
isClearing = value;
|
|
13016
13045
|
render();
|
|
13017
13046
|
};
|
|
13047
|
+
setFeedbackState = function setFeedbackState(messageId, state) {
|
|
13048
|
+
feedbackState = _object_spread_props(_object_spread({}, feedbackState), _define_property({}, messageId, state));
|
|
13049
|
+
render();
|
|
13050
|
+
};
|
|
13051
|
+
var feedback = 'feedback' in options ? options.feedback : undefined;
|
|
13052
|
+
if (agentId && feedback) {
|
|
13053
|
+
var _getAppIdAndApiKey = _sliced_to_array(getAppIdAndApiKey(initOptions.instantSearchInstance.client), 2), appId = _getAppIdAndApiKey[0], apiKey = _getAppIdAndApiKey[1];
|
|
13054
|
+
if (!appId || !apiKey) {
|
|
13055
|
+
throw new Error(withUsage$m('Could not extract Algolia credentials from the search client.'));
|
|
13056
|
+
}
|
|
13057
|
+
feedbackAbortController = new AbortController();
|
|
13058
|
+
_sendChatMessageFeedback = function _sendChatMessageFeedback(messageId, vote) {
|
|
13059
|
+
if (feedbackState[messageId] !== undefined) {
|
|
13060
|
+
return;
|
|
13061
|
+
}
|
|
13062
|
+
setFeedbackState(messageId, 'sending');
|
|
13063
|
+
sendChatMessageFeedback({
|
|
13064
|
+
agentId: agentId,
|
|
13065
|
+
vote: vote,
|
|
13066
|
+
messageId: messageId,
|
|
13067
|
+
appId: appId,
|
|
13068
|
+
apiKey: apiKey
|
|
13069
|
+
}).finally(function() {
|
|
13070
|
+
setFeedbackState(messageId, vote);
|
|
13071
|
+
});
|
|
13072
|
+
};
|
|
13073
|
+
}
|
|
13018
13074
|
_chatInstance['~registerErrorCallback'](render);
|
|
13019
13075
|
_chatInstance['~registerMessagesCallback'](render);
|
|
13020
13076
|
_chatInstance['~registerStatusCallback'](render);
|
|
@@ -13075,6 +13131,8 @@
|
|
|
13075
13131
|
clearMessages: clearMessages,
|
|
13076
13132
|
onClearTransitionEnd: onClearTransitionEnd,
|
|
13077
13133
|
tools: toolsWithAddToolResult,
|
|
13134
|
+
sendChatMessageFeedback: _sendChatMessageFeedback,
|
|
13135
|
+
feedbackState: feedbackState,
|
|
13078
13136
|
widgetParams: widgetParams,
|
|
13079
13137
|
// Chat instance render state
|
|
13080
13138
|
addToolResult: _chatInstance.addToolResult,
|
|
@@ -13090,6 +13148,7 @@
|
|
|
13090
13148
|
};
|
|
13091
13149
|
},
|
|
13092
13150
|
dispose: function dispose() {
|
|
13151
|
+
feedbackAbortController === null || feedbackAbortController === void 0 ? void 0 : feedbackAbortController.abort();
|
|
13093
13152
|
unmountFn();
|
|
13094
13153
|
},
|
|
13095
13154
|
shouldRender: function shouldRender() {
|