algolia-experiences 1.8.15 → 1.8.17
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! algolia-experiences 1.8.
|
|
1
|
+
/*! algolia-experiences 1.8.17 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
|
|
2
2
|
(function (factory) {
|
|
3
3
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
4
4
|
factory();
|
|
@@ -6886,7 +6886,7 @@
|
|
|
6886
6886
|
});
|
|
6887
6887
|
}
|
|
6888
6888
|
|
|
6889
|
-
var version = '4.
|
|
6889
|
+
var version = '4.108.0';
|
|
6890
6890
|
|
|
6891
6891
|
var ANONYMOUS_TOKEN_COOKIE_KEY = '_ALGOLIA';
|
|
6892
6892
|
function getCookie(name) {
|
|
@@ -9290,13 +9290,47 @@
|
|
|
9290
9290
|
].concat(_to_consumable_array(resolveScopedResultsFromWidgets(current.getWidgets()))));
|
|
9291
9291
|
}, []);
|
|
9292
9292
|
}
|
|
9293
|
+
function getWidgetsRequestDependencies(widgets) {
|
|
9294
|
+
return widgets.reduce(function(dependencies, widget) {
|
|
9295
|
+
if (isIndexWidget(widget)) {
|
|
9296
|
+
if (widget._isolated) {
|
|
9297
|
+
return dependencies;
|
|
9298
|
+
}
|
|
9299
|
+
var childDependencies = getWidgetsRequestDependencies(widget.getWidgets());
|
|
9300
|
+
return {
|
|
9301
|
+
hasSearchWidget: dependencies.hasSearchWidget || childDependencies.hasSearchWidget,
|
|
9302
|
+
hasRecommendWidget: dependencies.hasRecommendWidget || childDependencies.hasRecommendWidget
|
|
9303
|
+
};
|
|
9304
|
+
}
|
|
9305
|
+
if (widget.dependsOn === 'recommend') {
|
|
9306
|
+
return _object_spread_props(_object_spread({}, dependencies), {
|
|
9307
|
+
hasRecommendWidget: true
|
|
9308
|
+
});
|
|
9309
|
+
}
|
|
9310
|
+
if (widget.dependsOn === 'none') {
|
|
9311
|
+
return dependencies;
|
|
9312
|
+
}
|
|
9313
|
+
return _object_spread_props(_object_spread({}, dependencies), {
|
|
9314
|
+
hasSearchWidget: true
|
|
9315
|
+
});
|
|
9316
|
+
}, {
|
|
9317
|
+
hasSearchWidget: false,
|
|
9318
|
+
hasRecommendWidget: false
|
|
9319
|
+
});
|
|
9320
|
+
}
|
|
9321
|
+
function recomputeInstantSearchRequestDependencies(instantSearchInstance) {
|
|
9322
|
+
var _getWidgetsRequestDependencies = getWidgetsRequestDependencies(instantSearchInstance.mainIndex.getWidgets()), hasSearchWidget = _getWidgetsRequestDependencies.hasSearchWidget, hasRecommendWidget = _getWidgetsRequestDependencies.hasRecommendWidget;
|
|
9323
|
+
instantSearchInstance._hasSearchWidget = hasSearchWidget;
|
|
9324
|
+
instantSearchInstance._hasRecommendWidget = hasRecommendWidget;
|
|
9325
|
+
}
|
|
9293
9326
|
var index = function index(widgetParams) {
|
|
9294
|
-
|
|
9327
|
+
var _widgetParams_EXPERIMENTAL_isolated;
|
|
9328
|
+
if (widgetParams === undefined || widgetParams.indexName === undefined && !widgetParams.isolated && !widgetParams.EXPERIMENTAL_isolated) {
|
|
9295
9329
|
throw new Error(withUsage$K('The `indexName` option is required.'));
|
|
9296
9330
|
}
|
|
9297
9331
|
// When isolated=true, we use an empty string as the default indexName.
|
|
9298
9332
|
// This is intentional: isolated indices do not require a real index name.
|
|
9299
|
-
var _widgetParams_indexName = widgetParams.indexName, indexName = _widgetParams_indexName === void 0 ? '' : _widgetParams_indexName, _widgetParams_indexId = widgetParams.indexId, indexId = _widgetParams_indexId === void 0 ? indexName : _widgetParams_indexId,
|
|
9333
|
+
var _widgetParams_indexName = widgetParams.indexName, indexName = _widgetParams_indexName === void 0 ? '' : _widgetParams_indexName, _widgetParams_indexId = widgetParams.indexId, indexId = _widgetParams_indexId === void 0 ? indexName : _widgetParams_indexId, _widgetParams_isolated = widgetParams.isolated, isolated = _widgetParams_isolated === void 0 ? (_widgetParams_EXPERIMENTAL_isolated = widgetParams.EXPERIMENTAL_isolated) !== null && _widgetParams_EXPERIMENTAL_isolated !== void 0 ? _widgetParams_EXPERIMENTAL_isolated : false : _widgetParams_isolated;
|
|
9300
9334
|
var localWidgets = [];
|
|
9301
9335
|
var localUiState = {};
|
|
9302
9336
|
var localInstantSearchInstance = null;
|
|
@@ -9304,8 +9338,11 @@
|
|
|
9304
9338
|
var helper = null;
|
|
9305
9339
|
var derivedHelper = null;
|
|
9306
9340
|
var lastValidSearchParameters = null;
|
|
9307
|
-
var
|
|
9308
|
-
|
|
9341
|
+
var recomputeLocalRequestDependencies = function recomputeLocalRequestDependencies() {
|
|
9342
|
+
if (localInstantSearchInstance) {
|
|
9343
|
+
recomputeInstantSearchRequestDependencies(localInstantSearchInstance);
|
|
9344
|
+
}
|
|
9345
|
+
};
|
|
9309
9346
|
return {
|
|
9310
9347
|
$$type: 'ais.index',
|
|
9311
9348
|
$$widgetType: 'ais.index',
|
|
@@ -9396,21 +9433,12 @@
|
|
|
9396
9433
|
}
|
|
9397
9434
|
flatWidgets.forEach(function(widget) {
|
|
9398
9435
|
widget.parent = _this;
|
|
9399
|
-
if (isIndexWidget(widget)) {
|
|
9400
|
-
|
|
9436
|
+
if (!isIndexWidget(widget)) {
|
|
9437
|
+
addWidgetId(widget);
|
|
9401
9438
|
}
|
|
9402
|
-
if (localInstantSearchInstance && widget.dependsOn === 'recommend') {
|
|
9403
|
-
localInstantSearchInstance._hasRecommendWidget = true;
|
|
9404
|
-
} else if (localInstantSearchInstance) {
|
|
9405
|
-
localInstantSearchInstance._hasSearchWidget = true;
|
|
9406
|
-
} else if (widget.dependsOn === 'recommend') {
|
|
9407
|
-
hasRecommendWidget = true;
|
|
9408
|
-
} else {
|
|
9409
|
-
hasSearchWidget = true;
|
|
9410
|
-
}
|
|
9411
|
-
addWidgetId(widget);
|
|
9412
9439
|
});
|
|
9413
9440
|
localWidgets = localWidgets.concat(flatWidgets);
|
|
9441
|
+
recomputeLocalRequestDependencies();
|
|
9414
9442
|
if (localInstantSearchInstance && Boolean(flatWidgets.length)) {
|
|
9415
9443
|
privateHelperSetState(helper, {
|
|
9416
9444
|
state: getLocalWidgetsSearchParameters(localWidgets, {
|
|
@@ -9467,21 +9495,10 @@
|
|
|
9467
9495
|
localWidgets = localWidgets.filter(function(widget) {
|
|
9468
9496
|
return flatWidgets.indexOf(widget) === -1;
|
|
9469
9497
|
});
|
|
9470
|
-
|
|
9498
|
+
flatWidgets.forEach(function(widget) {
|
|
9471
9499
|
widget.parent = undefined;
|
|
9472
|
-
if (isIndexWidget(widget)) {
|
|
9473
|
-
return;
|
|
9474
|
-
}
|
|
9475
|
-
if (localInstantSearchInstance && widget.dependsOn === 'recommend') {
|
|
9476
|
-
localInstantSearchInstance._hasRecommendWidget = true;
|
|
9477
|
-
} else if (localInstantSearchInstance) {
|
|
9478
|
-
localInstantSearchInstance._hasSearchWidget = true;
|
|
9479
|
-
} else if (widget.dependsOn === 'recommend') {
|
|
9480
|
-
hasRecommendWidget = true;
|
|
9481
|
-
} else {
|
|
9482
|
-
hasSearchWidget = true;
|
|
9483
|
-
}
|
|
9484
9500
|
});
|
|
9501
|
+
recomputeLocalRequestDependencies();
|
|
9485
9502
|
if (localInstantSearchInstance && Boolean(flatWidgets.length)) {
|
|
9486
9503
|
var _flatWidgets_reduce = flatWidgets.reduce(function(states, widget) {
|
|
9487
9504
|
// the `dispose` method exists at this point we already assert it
|
|
@@ -9704,12 +9721,7 @@
|
|
|
9704
9721
|
// schedule a render that will render the results injected on the helper.
|
|
9705
9722
|
instantSearchInstance.scheduleRender();
|
|
9706
9723
|
}
|
|
9707
|
-
|
|
9708
|
-
instantSearchInstance._hasRecommendWidget = true;
|
|
9709
|
-
}
|
|
9710
|
-
if (hasSearchWidget) {
|
|
9711
|
-
instantSearchInstance._hasSearchWidget = true;
|
|
9712
|
-
}
|
|
9724
|
+
recomputeLocalRequestDependencies();
|
|
9713
9725
|
},
|
|
9714
9726
|
render: function render(param) {
|
|
9715
9727
|
var _this = this;
|
|
@@ -10600,8 +10612,11 @@
|
|
|
10600
10612
|
mainHelper.searchForFacetValues = mainHelper.searchForCompositionFacetValues.bind(mainHelper);
|
|
10601
10613
|
}
|
|
10602
10614
|
mainHelper.search = function() {
|
|
10603
|
-
_this.
|
|
10604
|
-
|
|
10615
|
+
var hasSearchOrRecommendWidget = _this._hasSearchWidget || _this._hasRecommendWidget;
|
|
10616
|
+
if (hasSearchOrRecommendWidget) {
|
|
10617
|
+
_this.status = 'loading';
|
|
10618
|
+
}
|
|
10619
|
+
_this.scheduleRender(!hasSearchOrRecommendWidget);
|
|
10605
10620
|
// This solution allows us to keep the exact same API for the users but
|
|
10606
10621
|
// under the hood, we have a different implementation. It should be
|
|
10607
10622
|
// completely transparent for the rest of the codebase. Only this module
|
|
@@ -10665,7 +10680,7 @@
|
|
|
10665
10680
|
error.error = error;
|
|
10666
10681
|
_this.error = error;
|
|
10667
10682
|
_this.status = 'error';
|
|
10668
|
-
_this.scheduleRender(
|
|
10683
|
+
_this.scheduleRender(!_this._hasSearchWidget && !_this._hasRecommendWidget);
|
|
10669
10684
|
// This needs to execute last because it throws the error.
|
|
10670
10685
|
_this.emit('error', error);
|
|
10671
10686
|
});
|
|
@@ -13260,6 +13275,41 @@
|
|
|
13260
13275
|
});
|
|
13261
13276
|
};
|
|
13262
13277
|
|
|
13278
|
+
// Centralizes the "open the chat from an entry point" behavior shared by the
|
|
13279
|
+
// SearchBox AI button, the Autocomplete AI button, prompt suggestions, and any
|
|
13280
|
+
// future entry point. The chat is always opened; the message is only sent when
|
|
13281
|
+
// it is non-empty and the chat is not already processing a message.
|
|
13282
|
+
// Returns true when a message was submitted, so callers can clear their input.
|
|
13283
|
+
function openChat(chatRenderState) {
|
|
13284
|
+
var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, message = _ref.message, referer = _ref.referer;
|
|
13285
|
+
var _ref1;
|
|
13286
|
+
var _chatRenderState_setOpen;
|
|
13287
|
+
if (!chatRenderState) {
|
|
13288
|
+
return false;
|
|
13289
|
+
}
|
|
13290
|
+
(_chatRenderState_setOpen = chatRenderState.setOpen) === null || _chatRenderState_setOpen === void 0 ? void 0 : _chatRenderState_setOpen.call(chatRenderState, true);
|
|
13291
|
+
var trimmed = (_ref1 = message === null || message === void 0 ? void 0 : message.trim()) !== null && _ref1 !== void 0 ? _ref1 : '';
|
|
13292
|
+
if (!trimmed) {
|
|
13293
|
+
var _chatRenderState_focusInput;
|
|
13294
|
+
(_chatRenderState_focusInput = chatRenderState.focusInput) === null || _chatRenderState_focusInput === void 0 ? void 0 : _chatRenderState_focusInput.call(chatRenderState);
|
|
13295
|
+
return false;
|
|
13296
|
+
}
|
|
13297
|
+
if (isChatBusy(chatRenderState) || !chatRenderState.sendMessage) {
|
|
13298
|
+
return false;
|
|
13299
|
+
}
|
|
13300
|
+
chatRenderState.sendMessage({
|
|
13301
|
+
text: trimmed
|
|
13302
|
+
}, referer ? {
|
|
13303
|
+
headers: {
|
|
13304
|
+
'x-algolia-referer': referer
|
|
13305
|
+
}
|
|
13306
|
+
} : undefined);
|
|
13307
|
+
return true;
|
|
13308
|
+
}
|
|
13309
|
+
function isChatBusy(chatRenderState) {
|
|
13310
|
+
return (chatRenderState === null || chatRenderState === void 0 ? void 0 : chatRenderState.status) === 'submitted' || (chatRenderState === null || chatRenderState === void 0 ? void 0 : chatRenderState.status) === 'streaming';
|
|
13311
|
+
}
|
|
13312
|
+
|
|
13263
13313
|
var withUsage$H = createDocumentationMessageGenerator({
|
|
13264
13314
|
name: 'search-box',
|
|
13265
13315
|
connector: true
|
|
@@ -13341,41 +13391,6 @@
|
|
|
13341
13391
|
};
|
|
13342
13392
|
};
|
|
13343
13393
|
|
|
13344
|
-
// Centralizes the "open the chat from an entry point" behavior shared by the
|
|
13345
|
-
// SearchBox AI button, the Autocomplete AI button, prompt suggestions, and any
|
|
13346
|
-
// future entry point. The chat is always opened; the message is only sent when
|
|
13347
|
-
// it is non-empty and the chat is not already processing a message.
|
|
13348
|
-
// Returns true when a message was submitted, so callers can clear their input.
|
|
13349
|
-
function openChat(chatRenderState) {
|
|
13350
|
-
var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, message = _ref.message, referer = _ref.referer;
|
|
13351
|
-
var _ref1;
|
|
13352
|
-
var _chatRenderState_setOpen;
|
|
13353
|
-
if (!chatRenderState) {
|
|
13354
|
-
return false;
|
|
13355
|
-
}
|
|
13356
|
-
(_chatRenderState_setOpen = chatRenderState.setOpen) === null || _chatRenderState_setOpen === void 0 ? void 0 : _chatRenderState_setOpen.call(chatRenderState, true);
|
|
13357
|
-
var trimmed = (_ref1 = message === null || message === void 0 ? void 0 : message.trim()) !== null && _ref1 !== void 0 ? _ref1 : '';
|
|
13358
|
-
if (!trimmed) {
|
|
13359
|
-
var _chatRenderState_focusInput;
|
|
13360
|
-
(_chatRenderState_focusInput = chatRenderState.focusInput) === null || _chatRenderState_focusInput === void 0 ? void 0 : _chatRenderState_focusInput.call(chatRenderState);
|
|
13361
|
-
return false;
|
|
13362
|
-
}
|
|
13363
|
-
if (isChatBusy(chatRenderState) || !chatRenderState.sendMessage) {
|
|
13364
|
-
return false;
|
|
13365
|
-
}
|
|
13366
|
-
chatRenderState.sendMessage({
|
|
13367
|
-
text: trimmed
|
|
13368
|
-
}, referer ? {
|
|
13369
|
-
headers: {
|
|
13370
|
-
'x-algolia-referer': referer
|
|
13371
|
-
}
|
|
13372
|
-
} : undefined);
|
|
13373
|
-
return true;
|
|
13374
|
-
}
|
|
13375
|
-
function isChatBusy(chatRenderState) {
|
|
13376
|
-
return (chatRenderState === null || chatRenderState === void 0 ? void 0 : chatRenderState.status) === 'submitted' || (chatRenderState === null || chatRenderState === void 0 ? void 0 : chatRenderState.status) === 'streaming';
|
|
13377
|
-
}
|
|
13378
|
-
|
|
13379
13394
|
var Breadcrumb = function Breadcrumb(param) {
|
|
13380
13395
|
var items = param.items, cssClasses = param.cssClasses, templateProps = param.templateProps, createURL = param.createURL, refine = param.refine;
|
|
13381
13396
|
return /*#__PURE__*/ h$1("div", {
|