react-instantsearch-core 7.23.2 → 7.24.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 +132 -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.24.0";
|
|
2
2
|
export default _default;
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '7.
|
|
1
|
+
export default '7.24.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.24.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.88.0';
|
|
12843
12843
|
|
|
12844
12844
|
function _typeof$l(o) {
|
|
12845
12845
|
"@babel/helpers - typeof";
|
|
@@ -16074,6 +16074,12 @@
|
|
|
16074
16074
|
return _createClass$5(Chat);
|
|
16075
16075
|
}(AbstractChat);
|
|
16076
16076
|
|
|
16077
|
+
function flat$1(arr) {
|
|
16078
|
+
return arr.reduce(function (acc, array) {
|
|
16079
|
+
return acc.concat(array);
|
|
16080
|
+
}, []);
|
|
16081
|
+
}
|
|
16082
|
+
|
|
16077
16083
|
function _typeof$s(o) {
|
|
16078
16084
|
"@babel/helpers - typeof";
|
|
16079
16085
|
|
|
@@ -16128,12 +16134,56 @@
|
|
|
16128
16134
|
}
|
|
16129
16135
|
return ("string" === r ? String : Number)(t);
|
|
16130
16136
|
}
|
|
16137
|
+
function _toConsumableArray$5(r) {
|
|
16138
|
+
return _arrayWithoutHoles$5(r) || _iterableToArray$5(r) || _unsupportedIterableToArray$c(r) || _nonIterableSpread$5();
|
|
16139
|
+
}
|
|
16140
|
+
function _nonIterableSpread$5() {
|
|
16141
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
16142
|
+
}
|
|
16143
|
+
function _iterableToArray$5(r) {
|
|
16144
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
16145
|
+
}
|
|
16146
|
+
function _arrayWithoutHoles$5(r) {
|
|
16147
|
+
if (Array.isArray(r)) return _arrayLikeToArray$c(r);
|
|
16148
|
+
}
|
|
16149
|
+
function _objectWithoutProperties$6(e, t) {
|
|
16150
|
+
if (null == e) return {};
|
|
16151
|
+
var o,
|
|
16152
|
+
r,
|
|
16153
|
+
i = _objectWithoutPropertiesLoose$7(e, t);
|
|
16154
|
+
if (Object.getOwnPropertySymbols) {
|
|
16155
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
16156
|
+
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
16157
|
+
}
|
|
16158
|
+
return i;
|
|
16159
|
+
}
|
|
16160
|
+
function _objectWithoutPropertiesLoose$7(r, e) {
|
|
16161
|
+
if (null == r) return {};
|
|
16162
|
+
var t = {};
|
|
16163
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
16164
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
16165
|
+
t[n] = r[n];
|
|
16166
|
+
}
|
|
16167
|
+
return t;
|
|
16168
|
+
}
|
|
16131
16169
|
function _slicedToArray$8(r, e) {
|
|
16132
16170
|
return _arrayWithHoles$8(r) || _iterableToArrayLimit$8(r, e) || _unsupportedIterableToArray$c(r, e) || _nonIterableRest$8();
|
|
16133
16171
|
}
|
|
16134
16172
|
function _nonIterableRest$8() {
|
|
16135
16173
|
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
16174
|
}
|
|
16175
|
+
function _unsupportedIterableToArray$c(r, a) {
|
|
16176
|
+
if (r) {
|
|
16177
|
+
if ("string" == typeof r) return _arrayLikeToArray$c(r, a);
|
|
16178
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
16179
|
+
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;
|
|
16180
|
+
}
|
|
16181
|
+
}
|
|
16182
|
+
function _arrayLikeToArray$c(r, a) {
|
|
16183
|
+
(null == a || a > r.length) && (a = r.length);
|
|
16184
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
16185
|
+
return n;
|
|
16186
|
+
}
|
|
16137
16187
|
function _iterableToArrayLimit$8(r, l) {
|
|
16138
16188
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
16139
16189
|
if (null != t) {
|
|
@@ -16164,66 +16214,72 @@
|
|
|
16164
16214
|
function _arrayWithHoles$8(r) {
|
|
16165
16215
|
if (Array.isArray(r)) return r;
|
|
16166
16216
|
}
|
|
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
16217
|
var withUsage$6 = createDocumentationMessageGenerator({
|
|
16212
16218
|
name: 'chat',
|
|
16213
16219
|
connector: true
|
|
16214
16220
|
});
|
|
16221
|
+
function getAttributesToClear(_ref) {
|
|
16222
|
+
var results = _ref.results,
|
|
16223
|
+
helper = _ref.helper;
|
|
16224
|
+
return uniq(getRefinements(results, helper.state, true).map(function (refinement) {
|
|
16225
|
+
return refinement.attribute;
|
|
16226
|
+
}));
|
|
16227
|
+
}
|
|
16228
|
+
function updateStateFromSearchToolInput(params, helper) {
|
|
16229
|
+
// clear all filters first
|
|
16230
|
+
var attributesToClear = getAttributesToClear({
|
|
16231
|
+
results: helper.lastResults,
|
|
16232
|
+
helper: helper
|
|
16233
|
+
});
|
|
16234
|
+
helper.setState(clearRefinements({
|
|
16235
|
+
helper: helper,
|
|
16236
|
+
attributesToClear: attributesToClear
|
|
16237
|
+
}));
|
|
16238
|
+
if (params.facetFilters) {
|
|
16239
|
+
var attributes = flat$1(params.facetFilters).map(function (filter) {
|
|
16240
|
+
var _filter$split = filter.split(':'),
|
|
16241
|
+
_filter$split2 = _slicedToArray$8(_filter$split, 2),
|
|
16242
|
+
attribute = _filter$split2[0],
|
|
16243
|
+
value = _filter$split2[1];
|
|
16244
|
+
return {
|
|
16245
|
+
attribute: attribute,
|
|
16246
|
+
value: value
|
|
16247
|
+
};
|
|
16248
|
+
});
|
|
16249
|
+
attributes.forEach(function (_ref2) {
|
|
16250
|
+
var attribute = _ref2.attribute,
|
|
16251
|
+
value = _ref2.value;
|
|
16252
|
+
if (!helper.state.isConjunctiveFacet(attribute) && !helper.state.isHierarchicalFacet(attribute) && !helper.state.isDisjunctiveFacet(attribute)) {
|
|
16253
|
+
var s = helper.state.addDisjunctiveFacet(attribute);
|
|
16254
|
+
helper.setState(s);
|
|
16255
|
+
helper.toggleFacetRefinement(attribute, value);
|
|
16256
|
+
} else {
|
|
16257
|
+
var _helper$state$hierarc;
|
|
16258
|
+
var attr = ((_helper$state$hierarc = helper.state.hierarchicalFacets.find(function (facet) {
|
|
16259
|
+
return facet.name === attribute;
|
|
16260
|
+
})) === null || _helper$state$hierarc === void 0 ? void 0 : _helper$state$hierarc.name) || attribute;
|
|
16261
|
+
helper.toggleFacetRefinement(attr, value);
|
|
16262
|
+
}
|
|
16263
|
+
});
|
|
16264
|
+
}
|
|
16265
|
+
if (params.query) {
|
|
16266
|
+
helper.setQuery(params.query);
|
|
16267
|
+
}
|
|
16268
|
+
helper.search();
|
|
16269
|
+
return helper.state;
|
|
16270
|
+
}
|
|
16215
16271
|
var connectChat = (function connectChat(renderFn) {
|
|
16216
16272
|
var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
16217
16273
|
checkRendering(renderFn, withUsage$6());
|
|
16218
16274
|
return function (widgetParams) {
|
|
16219
|
-
var
|
|
16220
|
-
|
|
16221
|
-
resume =
|
|
16222
|
-
|
|
16223
|
-
tools =
|
|
16224
|
-
|
|
16225
|
-
type =
|
|
16226
|
-
options = _objectWithoutProperties$6(
|
|
16275
|
+
var _ref3 = widgetParams || {},
|
|
16276
|
+
_ref3$resume = _ref3.resume,
|
|
16277
|
+
resume = _ref3$resume === void 0 ? false : _ref3$resume,
|
|
16278
|
+
_ref3$tools = _ref3.tools,
|
|
16279
|
+
tools = _ref3$tools === void 0 ? {} : _ref3$tools,
|
|
16280
|
+
_ref3$type = _ref3.type,
|
|
16281
|
+
type = _ref3$type === void 0 ? 'chat' : _ref3$type,
|
|
16282
|
+
options = _objectWithoutProperties$6(_ref3, _excluded$a);
|
|
16227
16283
|
var _chatInstance;
|
|
16228
16284
|
var input = '';
|
|
16229
16285
|
var open = false;
|
|
@@ -16324,10 +16380,10 @@
|
|
|
16324
16380
|
'x-algolia-api-Key': apiKey,
|
|
16325
16381
|
'x-algolia-agent': getAlgoliaAgent(instantSearchInstance.client)
|
|
16326
16382
|
},
|
|
16327
|
-
prepareSendMessagesRequest: function prepareSendMessagesRequest(
|
|
16328
|
-
var messages =
|
|
16329
|
-
trigger =
|
|
16330
|
-
rest = _objectWithoutProperties$6(
|
|
16383
|
+
prepareSendMessagesRequest: function prepareSendMessagesRequest(_ref4) {
|
|
16384
|
+
var messages = _ref4.messages,
|
|
16385
|
+
trigger = _ref4.trigger,
|
|
16386
|
+
rest = _objectWithoutProperties$6(_ref4, _excluded2$2);
|
|
16331
16387
|
return {
|
|
16332
16388
|
// Bypass cache when regenerating to ensure fresh responses
|
|
16333
16389
|
api: trigger === 'regenerate-message' ? "".concat(baseApi, "&cache=false") : baseApi,
|
|
@@ -16347,8 +16403,8 @@
|
|
|
16347
16403
|
return new Chat(_objectSpread$m(_objectSpread$m({}, options), {}, {
|
|
16348
16404
|
transport: transport,
|
|
16349
16405
|
sendAutomaticallyWhen: lastAssistantMessageIsCompleteWithToolCalls,
|
|
16350
|
-
onToolCall: function onToolCall(
|
|
16351
|
-
var toolCall =
|
|
16406
|
+
onToolCall: function onToolCall(_ref5) {
|
|
16407
|
+
var toolCall = _ref5.toolCall;
|
|
16352
16408
|
var tool = tools[toolCall.toolName];
|
|
16353
16409
|
if (!tool) {
|
|
16354
16410
|
return _chatInstance.addToolResult({
|
|
@@ -16358,8 +16414,8 @@
|
|
|
16358
16414
|
});
|
|
16359
16415
|
}
|
|
16360
16416
|
if (tool.onToolCall) {
|
|
16361
|
-
var addToolResult = function addToolResult(
|
|
16362
|
-
var output =
|
|
16417
|
+
var addToolResult = function addToolResult(_ref6) {
|
|
16418
|
+
var output = _ref6.output;
|
|
16363
16419
|
return _chatInstance.addToolResult({
|
|
16364
16420
|
output: output,
|
|
16365
16421
|
tool: toolCall.toolName,
|
|
@@ -16419,7 +16475,8 @@
|
|
|
16419
16475
|
},
|
|
16420
16476
|
getWidgetRenderState: function getWidgetRenderState(renderOptions) {
|
|
16421
16477
|
var instantSearchInstance = renderOptions.instantSearchInstance,
|
|
16422
|
-
parent = renderOptions.parent
|
|
16478
|
+
parent = renderOptions.parent,
|
|
16479
|
+
helper = renderOptions.helper;
|
|
16423
16480
|
if (!_chatInstance) {
|
|
16424
16481
|
this.init(_objectSpread$m(_objectSpread$m({}, renderOptions), {}, {
|
|
16425
16482
|
uiState: {},
|
|
@@ -16433,13 +16490,17 @@
|
|
|
16433
16490
|
widgetType: this.$$type
|
|
16434
16491
|
});
|
|
16435
16492
|
}
|
|
16493
|
+
function applyFilters(params) {
|
|
16494
|
+
return updateStateFromSearchToolInput(params, helper);
|
|
16495
|
+
}
|
|
16436
16496
|
var toolsWithAddToolResult = {};
|
|
16437
|
-
Object.entries(tools).forEach(function (
|
|
16438
|
-
var
|
|
16439
|
-
key =
|
|
16440
|
-
tool =
|
|
16497
|
+
Object.entries(tools).forEach(function (_ref7) {
|
|
16498
|
+
var _ref8 = _slicedToArray$8(_ref7, 2),
|
|
16499
|
+
key = _ref8[0],
|
|
16500
|
+
tool = _ref8[1];
|
|
16441
16501
|
var toolWithAddToolResult = _objectSpread$m(_objectSpread$m({}, tool), {}, {
|
|
16442
|
-
addToolResult: _chatInstance.addToolResult
|
|
16502
|
+
addToolResult: _chatInstance.addToolResult,
|
|
16503
|
+
applyFilters: applyFilters
|
|
16443
16504
|
});
|
|
16444
16505
|
toolsWithAddToolResult[key] = toolWithAddToolResult;
|
|
16445
16506
|
});
|
|
@@ -16624,7 +16685,7 @@
|
|
|
16624
16685
|
scopedResults = _ref2.scopedResults,
|
|
16625
16686
|
results = _ref2.results;
|
|
16626
16687
|
connectorState.attributesToClear = scopedResults.reduce(function (attributesToClear, scopedResult) {
|
|
16627
|
-
return attributesToClear.concat(getAttributesToClear({
|
|
16688
|
+
return attributesToClear.concat(getAttributesToClear$1({
|
|
16628
16689
|
scopedResult: scopedResult,
|
|
16629
16690
|
includedAttributes: includedAttributes,
|
|
16630
16691
|
excludedAttributes: excludedAttributes,
|
|
@@ -16666,7 +16727,7 @@
|
|
|
16666
16727
|
};
|
|
16667
16728
|
};
|
|
16668
16729
|
};
|
|
16669
|
-
function getAttributesToClear(_ref5) {
|
|
16730
|
+
function getAttributesToClear$1(_ref5) {
|
|
16670
16731
|
var scopedResult = _ref5.scopedResult,
|
|
16671
16732
|
includedAttributes = _ref5.includedAttributes,
|
|
16672
16733
|
excludedAttributes = _ref5.excludedAttributes,
|