react-instantsearch-core 7.23.2 → 7.25.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/version.d.ts +1 -1
- package/dist/es/version.js +1 -1
- package/dist/umd/ReactInstantSearchCore.js +139 -71
- package/dist/umd/ReactInstantSearchCore.js.map +1 -1
- package/dist/umd/ReactInstantSearchCore.min.js +1 -1
- package/dist/umd/ReactInstantSearchCore.min.js.map +1 -1
- package/package.json +3 -3
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.25.0";
|
|
2
2
|
export default _default;
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '7.
|
|
1
|
+
export default '7.25.0';
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
var React__default = 'default' in React ? React['default'] : React;
|
|
9
9
|
|
|
10
|
-
var version = '7.
|
|
10
|
+
var version = '7.25.0';
|
|
11
11
|
|
|
12
12
|
function _arrayLikeToArray(r, a) {
|
|
13
13
|
(null == a || a > r.length) && (a = r.length);
|
|
@@ -10293,7 +10293,7 @@
|
|
|
10293
10293
|
|
|
10294
10294
|
// We use the same pattern for the `searchForFacetValues`.
|
|
10295
10295
|
helper.searchForFacetValues = function (facetName, facetValue, maxFacetHits, userState) {
|
|
10296
|
-
var state =
|
|
10296
|
+
var state = mergeSearchParameters.apply(void 0, [mainHelper.state].concat(_toConsumableArray$1(resolveSearchParameters(_this3)))).setQueryParameters(userState);
|
|
10297
10297
|
return mainHelper.searchForFacetValues(facetName, facetValue, maxFacetHits, state);
|
|
10298
10298
|
};
|
|
10299
10299
|
var isolatedHelper = indexName ? helper : algoliasearchHelper_1({}, '__empty_index__', {});
|
|
@@ -12839,7 +12839,7 @@
|
|
|
12839
12839
|
};
|
|
12840
12840
|
}
|
|
12841
12841
|
|
|
12842
|
-
var version$2 = '4.
|
|
12842
|
+
var version$2 = '4.89.0';
|
|
12843
12843
|
|
|
12844
12844
|
function _typeof$l(o) {
|
|
12845
12845
|
"@babel/helpers - typeof";
|
|
@@ -16074,6 +16074,14 @@
|
|
|
16074
16074
|
return _createClass$5(Chat);
|
|
16075
16075
|
}(AbstractChat);
|
|
16076
16076
|
|
|
16077
|
+
var SearchIndexToolType = 'algolia_search_index';
|
|
16078
|
+
|
|
16079
|
+
function flat$1(arr) {
|
|
16080
|
+
return arr.reduce(function (acc, array) {
|
|
16081
|
+
return acc.concat(array);
|
|
16082
|
+
}, []);
|
|
16083
|
+
}
|
|
16084
|
+
|
|
16077
16085
|
function _typeof$s(o) {
|
|
16078
16086
|
"@babel/helpers - typeof";
|
|
16079
16087
|
|
|
@@ -16128,12 +16136,56 @@
|
|
|
16128
16136
|
}
|
|
16129
16137
|
return ("string" === r ? String : Number)(t);
|
|
16130
16138
|
}
|
|
16139
|
+
function _toConsumableArray$5(r) {
|
|
16140
|
+
return _arrayWithoutHoles$5(r) || _iterableToArray$5(r) || _unsupportedIterableToArray$c(r) || _nonIterableSpread$5();
|
|
16141
|
+
}
|
|
16142
|
+
function _nonIterableSpread$5() {
|
|
16143
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
16144
|
+
}
|
|
16145
|
+
function _iterableToArray$5(r) {
|
|
16146
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
16147
|
+
}
|
|
16148
|
+
function _arrayWithoutHoles$5(r) {
|
|
16149
|
+
if (Array.isArray(r)) return _arrayLikeToArray$c(r);
|
|
16150
|
+
}
|
|
16151
|
+
function _objectWithoutProperties$6(e, t) {
|
|
16152
|
+
if (null == e) return {};
|
|
16153
|
+
var o,
|
|
16154
|
+
r,
|
|
16155
|
+
i = _objectWithoutPropertiesLoose$7(e, t);
|
|
16156
|
+
if (Object.getOwnPropertySymbols) {
|
|
16157
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
16158
|
+
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
16159
|
+
}
|
|
16160
|
+
return i;
|
|
16161
|
+
}
|
|
16162
|
+
function _objectWithoutPropertiesLoose$7(r, e) {
|
|
16163
|
+
if (null == r) return {};
|
|
16164
|
+
var t = {};
|
|
16165
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
16166
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
16167
|
+
t[n] = r[n];
|
|
16168
|
+
}
|
|
16169
|
+
return t;
|
|
16170
|
+
}
|
|
16131
16171
|
function _slicedToArray$8(r, e) {
|
|
16132
16172
|
return _arrayWithHoles$8(r) || _iterableToArrayLimit$8(r, e) || _unsupportedIterableToArray$c(r, e) || _nonIterableRest$8();
|
|
16133
16173
|
}
|
|
16134
16174
|
function _nonIterableRest$8() {
|
|
16135
16175
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
16136
16176
|
}
|
|
16177
|
+
function _unsupportedIterableToArray$c(r, a) {
|
|
16178
|
+
if (r) {
|
|
16179
|
+
if ("string" == typeof r) return _arrayLikeToArray$c(r, a);
|
|
16180
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
16181
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$c(r, a) : void 0;
|
|
16182
|
+
}
|
|
16183
|
+
}
|
|
16184
|
+
function _arrayLikeToArray$c(r, a) {
|
|
16185
|
+
(null == a || a > r.length) && (a = r.length);
|
|
16186
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
16187
|
+
return n;
|
|
16188
|
+
}
|
|
16137
16189
|
function _iterableToArrayLimit$8(r, l) {
|
|
16138
16190
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
16139
16191
|
if (null != t) {
|
|
@@ -16164,66 +16216,72 @@
|
|
|
16164
16216
|
function _arrayWithHoles$8(r) {
|
|
16165
16217
|
if (Array.isArray(r)) return r;
|
|
16166
16218
|
}
|
|
16167
|
-
function _toConsumableArray$5(r) {
|
|
16168
|
-
return _arrayWithoutHoles$5(r) || _iterableToArray$5(r) || _unsupportedIterableToArray$c(r) || _nonIterableSpread$5();
|
|
16169
|
-
}
|
|
16170
|
-
function _nonIterableSpread$5() {
|
|
16171
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
16172
|
-
}
|
|
16173
|
-
function _unsupportedIterableToArray$c(r, a) {
|
|
16174
|
-
if (r) {
|
|
16175
|
-
if ("string" == typeof r) return _arrayLikeToArray$c(r, a);
|
|
16176
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
16177
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$c(r, a) : void 0;
|
|
16178
|
-
}
|
|
16179
|
-
}
|
|
16180
|
-
function _iterableToArray$5(r) {
|
|
16181
|
-
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
16182
|
-
}
|
|
16183
|
-
function _arrayWithoutHoles$5(r) {
|
|
16184
|
-
if (Array.isArray(r)) return _arrayLikeToArray$c(r);
|
|
16185
|
-
}
|
|
16186
|
-
function _arrayLikeToArray$c(r, a) {
|
|
16187
|
-
(null == a || a > r.length) && (a = r.length);
|
|
16188
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
16189
|
-
return n;
|
|
16190
|
-
}
|
|
16191
|
-
function _objectWithoutProperties$6(e, t) {
|
|
16192
|
-
if (null == e) return {};
|
|
16193
|
-
var o,
|
|
16194
|
-
r,
|
|
16195
|
-
i = _objectWithoutPropertiesLoose$7(e, t);
|
|
16196
|
-
if (Object.getOwnPropertySymbols) {
|
|
16197
|
-
var n = Object.getOwnPropertySymbols(e);
|
|
16198
|
-
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
16199
|
-
}
|
|
16200
|
-
return i;
|
|
16201
|
-
}
|
|
16202
|
-
function _objectWithoutPropertiesLoose$7(r, e) {
|
|
16203
|
-
if (null == r) return {};
|
|
16204
|
-
var t = {};
|
|
16205
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
16206
|
-
if (-1 !== e.indexOf(n)) continue;
|
|
16207
|
-
t[n] = r[n];
|
|
16208
|
-
}
|
|
16209
|
-
return t;
|
|
16210
|
-
}
|
|
16211
16219
|
var withUsage$6 = createDocumentationMessageGenerator({
|
|
16212
16220
|
name: 'chat',
|
|
16213
16221
|
connector: true
|
|
16214
16222
|
});
|
|
16223
|
+
function getAttributesToClear(_ref) {
|
|
16224
|
+
var results = _ref.results,
|
|
16225
|
+
helper = _ref.helper;
|
|
16226
|
+
return uniq(getRefinements(results, helper.state, true).map(function (refinement) {
|
|
16227
|
+
return refinement.attribute;
|
|
16228
|
+
}));
|
|
16229
|
+
}
|
|
16230
|
+
function updateStateFromSearchToolInput(params, helper) {
|
|
16231
|
+
// clear all filters first
|
|
16232
|
+
var attributesToClear = getAttributesToClear({
|
|
16233
|
+
results: helper.lastResults,
|
|
16234
|
+
helper: helper
|
|
16235
|
+
});
|
|
16236
|
+
helper.setState(clearRefinements({
|
|
16237
|
+
helper: helper,
|
|
16238
|
+
attributesToClear: attributesToClear
|
|
16239
|
+
}));
|
|
16240
|
+
if (params.facetFilters) {
|
|
16241
|
+
var attributes = flat$1(params.facetFilters).map(function (filter) {
|
|
16242
|
+
var _filter$split = filter.split(':'),
|
|
16243
|
+
_filter$split2 = _slicedToArray$8(_filter$split, 2),
|
|
16244
|
+
attribute = _filter$split2[0],
|
|
16245
|
+
value = _filter$split2[1];
|
|
16246
|
+
return {
|
|
16247
|
+
attribute: attribute,
|
|
16248
|
+
value: value
|
|
16249
|
+
};
|
|
16250
|
+
});
|
|
16251
|
+
attributes.forEach(function (_ref2) {
|
|
16252
|
+
var attribute = _ref2.attribute,
|
|
16253
|
+
value = _ref2.value;
|
|
16254
|
+
if (!helper.state.isConjunctiveFacet(attribute) && !helper.state.isHierarchicalFacet(attribute) && !helper.state.isDisjunctiveFacet(attribute)) {
|
|
16255
|
+
var s = helper.state.addDisjunctiveFacet(attribute);
|
|
16256
|
+
helper.setState(s);
|
|
16257
|
+
helper.toggleFacetRefinement(attribute, value);
|
|
16258
|
+
} else {
|
|
16259
|
+
var _helper$state$hierarc;
|
|
16260
|
+
var attr = ((_helper$state$hierarc = helper.state.hierarchicalFacets.find(function (facet) {
|
|
16261
|
+
return facet.name === attribute;
|
|
16262
|
+
})) === null || _helper$state$hierarc === void 0 ? void 0 : _helper$state$hierarc.name) || attribute;
|
|
16263
|
+
helper.toggleFacetRefinement(attr, value);
|
|
16264
|
+
}
|
|
16265
|
+
});
|
|
16266
|
+
}
|
|
16267
|
+
if (params.query) {
|
|
16268
|
+
helper.setQuery(params.query);
|
|
16269
|
+
}
|
|
16270
|
+
helper.search();
|
|
16271
|
+
return helper.state;
|
|
16272
|
+
}
|
|
16215
16273
|
var connectChat = (function connectChat(renderFn) {
|
|
16216
16274
|
var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
16217
16275
|
checkRendering(renderFn, withUsage$6());
|
|
16218
16276
|
return function (widgetParams) {
|
|
16219
|
-
var
|
|
16220
|
-
|
|
16221
|
-
resume =
|
|
16222
|
-
|
|
16223
|
-
tools =
|
|
16224
|
-
|
|
16225
|
-
type =
|
|
16226
|
-
options = _objectWithoutProperties$6(
|
|
16277
|
+
var _ref3 = widgetParams || {},
|
|
16278
|
+
_ref3$resume = _ref3.resume,
|
|
16279
|
+
resume = _ref3$resume === void 0 ? false : _ref3$resume,
|
|
16280
|
+
_ref3$tools = _ref3.tools,
|
|
16281
|
+
tools = _ref3$tools === void 0 ? {} : _ref3$tools,
|
|
16282
|
+
_ref3$type = _ref3.type,
|
|
16283
|
+
type = _ref3$type === void 0 ? 'chat' : _ref3$type,
|
|
16284
|
+
options = _objectWithoutProperties$6(_ref3, _excluded$a);
|
|
16227
16285
|
var _chatInstance;
|
|
16228
16286
|
var input = '';
|
|
16229
16287
|
var open = false;
|
|
@@ -16324,10 +16382,10 @@
|
|
|
16324
16382
|
'x-algolia-api-Key': apiKey,
|
|
16325
16383
|
'x-algolia-agent': getAlgoliaAgent(instantSearchInstance.client)
|
|
16326
16384
|
},
|
|
16327
|
-
prepareSendMessagesRequest: function prepareSendMessagesRequest(
|
|
16328
|
-
var messages =
|
|
16329
|
-
trigger =
|
|
16330
|
-
rest = _objectWithoutProperties$6(
|
|
16385
|
+
prepareSendMessagesRequest: function prepareSendMessagesRequest(_ref4) {
|
|
16386
|
+
var messages = _ref4.messages,
|
|
16387
|
+
trigger = _ref4.trigger,
|
|
16388
|
+
rest = _objectWithoutProperties$6(_ref4, _excluded2$2);
|
|
16331
16389
|
return {
|
|
16332
16390
|
// Bypass cache when regenerating to ensure fresh responses
|
|
16333
16391
|
api: trigger === 'regenerate-message' ? "".concat(baseApi, "&cache=false") : baseApi,
|
|
@@ -16347,9 +16405,14 @@
|
|
|
16347
16405
|
return new Chat(_objectSpread$m(_objectSpread$m({}, options), {}, {
|
|
16348
16406
|
transport: transport,
|
|
16349
16407
|
sendAutomaticallyWhen: lastAssistantMessageIsCompleteWithToolCalls,
|
|
16350
|
-
onToolCall: function onToolCall(
|
|
16351
|
-
var toolCall =
|
|
16408
|
+
onToolCall: function onToolCall(_ref5) {
|
|
16409
|
+
var toolCall = _ref5.toolCall;
|
|
16352
16410
|
var tool = tools[toolCall.toolName];
|
|
16411
|
+
|
|
16412
|
+
// Compatibility shim with Algolia MCP Server search tool
|
|
16413
|
+
if (!tool && toolCall.toolName.startsWith("".concat(SearchIndexToolType, "_"))) {
|
|
16414
|
+
tool = tools[SearchIndexToolType];
|
|
16415
|
+
}
|
|
16353
16416
|
if (!tool) {
|
|
16354
16417
|
return _chatInstance.addToolResult({
|
|
16355
16418
|
output: "No tool implemented for \"".concat(toolCall.toolName, "\"."),
|
|
@@ -16358,8 +16421,8 @@
|
|
|
16358
16421
|
});
|
|
16359
16422
|
}
|
|
16360
16423
|
if (tool.onToolCall) {
|
|
16361
|
-
var addToolResult = function addToolResult(
|
|
16362
|
-
var output =
|
|
16424
|
+
var addToolResult = function addToolResult(_ref6) {
|
|
16425
|
+
var output = _ref6.output;
|
|
16363
16426
|
return _chatInstance.addToolResult({
|
|
16364
16427
|
output: output,
|
|
16365
16428
|
tool: toolCall.toolName,
|
|
@@ -16419,7 +16482,8 @@
|
|
|
16419
16482
|
},
|
|
16420
16483
|
getWidgetRenderState: function getWidgetRenderState(renderOptions) {
|
|
16421
16484
|
var instantSearchInstance = renderOptions.instantSearchInstance,
|
|
16422
|
-
parent = renderOptions.parent
|
|
16485
|
+
parent = renderOptions.parent,
|
|
16486
|
+
helper = renderOptions.helper;
|
|
16423
16487
|
if (!_chatInstance) {
|
|
16424
16488
|
this.init(_objectSpread$m(_objectSpread$m({}, renderOptions), {}, {
|
|
16425
16489
|
uiState: {},
|
|
@@ -16433,13 +16497,17 @@
|
|
|
16433
16497
|
widgetType: this.$$type
|
|
16434
16498
|
});
|
|
16435
16499
|
}
|
|
16500
|
+
function applyFilters(params) {
|
|
16501
|
+
return updateStateFromSearchToolInput(params, helper);
|
|
16502
|
+
}
|
|
16436
16503
|
var toolsWithAddToolResult = {};
|
|
16437
|
-
Object.entries(tools).forEach(function (
|
|
16438
|
-
var
|
|
16439
|
-
key =
|
|
16440
|
-
tool =
|
|
16504
|
+
Object.entries(tools).forEach(function (_ref7) {
|
|
16505
|
+
var _ref8 = _slicedToArray$8(_ref7, 2),
|
|
16506
|
+
key = _ref8[0],
|
|
16507
|
+
tool = _ref8[1];
|
|
16441
16508
|
var toolWithAddToolResult = _objectSpread$m(_objectSpread$m({}, tool), {}, {
|
|
16442
|
-
addToolResult: _chatInstance.addToolResult
|
|
16509
|
+
addToolResult: _chatInstance.addToolResult,
|
|
16510
|
+
applyFilters: applyFilters
|
|
16443
16511
|
});
|
|
16444
16512
|
toolsWithAddToolResult[key] = toolWithAddToolResult;
|
|
16445
16513
|
});
|
|
@@ -16624,7 +16692,7 @@
|
|
|
16624
16692
|
scopedResults = _ref2.scopedResults,
|
|
16625
16693
|
results = _ref2.results;
|
|
16626
16694
|
connectorState.attributesToClear = scopedResults.reduce(function (attributesToClear, scopedResult) {
|
|
16627
|
-
return attributesToClear.concat(getAttributesToClear({
|
|
16695
|
+
return attributesToClear.concat(getAttributesToClear$1({
|
|
16628
16696
|
scopedResult: scopedResult,
|
|
16629
16697
|
includedAttributes: includedAttributes,
|
|
16630
16698
|
excludedAttributes: excludedAttributes,
|
|
@@ -16666,7 +16734,7 @@
|
|
|
16666
16734
|
};
|
|
16667
16735
|
};
|
|
16668
16736
|
};
|
|
16669
|
-
function getAttributesToClear(_ref5) {
|
|
16737
|
+
function getAttributesToClear$1(_ref5) {
|
|
16670
16738
|
var scopedResult = _ref5.scopedResult,
|
|
16671
16739
|
includedAttributes = _ref5.includedAttributes,
|
|
16672
16740
|
excludedAttributes = _ref5.excludedAttributes,
|