algolia-experiences 1.8.1 → 1.8.2
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.2 | © 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();
|
|
@@ -4987,7 +4987,7 @@
|
|
|
4987
4987
|
function requireVersion() {
|
|
4988
4988
|
if (hasRequiredVersion) return version$1;
|
|
4989
4989
|
hasRequiredVersion = 1;
|
|
4990
|
-
version$1 = '3.
|
|
4990
|
+
version$1 = '3.29.0';
|
|
4991
4991
|
return version$1;
|
|
4992
4992
|
}
|
|
4993
4993
|
|
|
@@ -6361,7 +6361,6 @@
|
|
|
6361
6361
|
var derivedStateQueries = requestBuilder._getCompositionQueries(derivedState);
|
|
6362
6362
|
states.push({
|
|
6363
6363
|
state: derivedState,
|
|
6364
|
-
queriesCount: derivedStateQueries.length,
|
|
6365
6364
|
helper: derivedHelper
|
|
6366
6365
|
});
|
|
6367
6366
|
derivedHelper.emit('search', {
|
|
@@ -6491,7 +6490,7 @@
|
|
|
6491
6490
|
var state = s.state;
|
|
6492
6491
|
var queriesCount = s.queriesCount;
|
|
6493
6492
|
var helper = s.helper;
|
|
6494
|
-
var specificResults = results.splice(0, queriesCount);
|
|
6493
|
+
var specificResults = queriesCount !== undefined ? results.splice(0, queriesCount) : results;
|
|
6495
6494
|
if (!state.index) {
|
|
6496
6495
|
helper.emit('result', {
|
|
6497
6496
|
results: null,
|
|
@@ -6499,8 +6498,24 @@
|
|
|
6499
6498
|
});
|
|
6500
6499
|
return;
|
|
6501
6500
|
}
|
|
6502
|
-
|
|
6503
|
-
if (
|
|
6501
|
+
// Multifeed composition: build ordered SearchResults array on lastResults
|
|
6502
|
+
if (specificResults.length > 0 && specificResults[0].feedID) {
|
|
6503
|
+
var feeds = specificResults.map(function(r) {
|
|
6504
|
+
var sr = new SearchResults(state, [
|
|
6505
|
+
r
|
|
6506
|
+
], self._searchResultsOptions);
|
|
6507
|
+
if (rawContent !== undefined) sr._rawContent = rawContent;
|
|
6508
|
+
return sr;
|
|
6509
|
+
});
|
|
6510
|
+
helper.lastResults = new SearchResults(state, [
|
|
6511
|
+
specificResults[0]
|
|
6512
|
+
], self._searchResultsOptions);
|
|
6513
|
+
helper.lastResults.feeds = feeds;
|
|
6514
|
+
if (rawContent !== undefined) helper.lastResults._rawContent = rawContent;
|
|
6515
|
+
} else {
|
|
6516
|
+
helper.lastResults = new SearchResults(state, specificResults, self._searchResultsOptions);
|
|
6517
|
+
if (rawContent !== undefined) helper.lastResults._rawContent = rawContent;
|
|
6518
|
+
}
|
|
6504
6519
|
helper.emit('result', {
|
|
6505
6520
|
results: helper.lastResults,
|
|
6506
6521
|
state: state
|
|
@@ -7280,6 +7295,20 @@
|
|
|
7280
7295
|
return typeof userToken === 'number' ? userToken.toString() : userToken;
|
|
7281
7296
|
}
|
|
7282
7297
|
|
|
7298
|
+
var indexWidgetTypes = [
|
|
7299
|
+
'ais.index',
|
|
7300
|
+
'ais.feedContainer'
|
|
7301
|
+
];
|
|
7302
|
+
|
|
7303
|
+
function isIndexWidget(widget) {
|
|
7304
|
+
return indexWidgetTypes.includes(widget.$$type);
|
|
7305
|
+
}
|
|
7306
|
+
|
|
7307
|
+
function getAlgoliaAgent(client) {
|
|
7308
|
+
var clientTyped = client;
|
|
7309
|
+
return clientTyped.transporter && clientTyped.transporter.userAgent ? clientTyped.transporter.userAgent.value : clientTyped._ua;
|
|
7310
|
+
}
|
|
7311
|
+
|
|
7283
7312
|
function createInitArgs(instantSearchInstance, parent, uiState) {
|
|
7284
7313
|
var helper = parent.getHelper();
|
|
7285
7314
|
return {
|
|
@@ -7319,10 +7348,10 @@
|
|
|
7319
7348
|
error: instantSearchInstance.error
|
|
7320
7349
|
};
|
|
7321
7350
|
}
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
var
|
|
7325
|
-
|
|
7351
|
+
function storeRenderState(param) {
|
|
7352
|
+
var renderState = param.renderState, instantSearchInstance = param.instantSearchInstance, parent = param.parent;
|
|
7353
|
+
var parentIndexName = parent ? parent.getIndexId() : instantSearchInstance.mainIndex.getIndexId();
|
|
7354
|
+
instantSearchInstance.renderState = _object_spread_props(_object_spread({}, instantSearchInstance.renderState), _define_property({}, parentIndexName, _object_spread({}, instantSearchInstance.renderState[parentIndexName], renderState)));
|
|
7326
7355
|
}
|
|
7327
7356
|
|
|
7328
7357
|
function extractWidgetPayload(widgets, instantSearchInstance, payload) {
|
|
@@ -7345,7 +7374,7 @@
|
|
|
7345
7374
|
widgetType: widget.$$widgetType,
|
|
7346
7375
|
params: params
|
|
7347
7376
|
});
|
|
7348
|
-
if (widget
|
|
7377
|
+
if (isIndexWidget(widget)) {
|
|
7349
7378
|
extractWidgetPayload(widget.getWidgets(), instantSearchInstance, payload);
|
|
7350
7379
|
}
|
|
7351
7380
|
});
|
|
@@ -8604,7 +8633,11 @@
|
|
|
8604
8633
|
routeToState: function routeToState() {
|
|
8605
8634
|
var routeState = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
8606
8635
|
return Object.keys(routeState).reduce(function(state, indexId) {
|
|
8607
|
-
|
|
8636
|
+
var indexState = routeState[indexId];
|
|
8637
|
+
if ((typeof indexState === "undefined" ? "undefined" : _type_of(indexState)) !== 'object' || indexState === null) {
|
|
8638
|
+
return state;
|
|
8639
|
+
}
|
|
8640
|
+
return _object_spread_props(_object_spread({}, state), _define_property({}, indexId, getIndexStateWithoutConfigure(indexState)));
|
|
8608
8641
|
}, {});
|
|
8609
8642
|
}
|
|
8610
8643
|
};
|
|
@@ -8717,10 +8750,6 @@
|
|
|
8717
8750
|
widget.$$id = id++;
|
|
8718
8751
|
}
|
|
8719
8752
|
|
|
8720
|
-
function isIndexWidget(widget) {
|
|
8721
|
-
return widget.$$type === 'ais.index';
|
|
8722
|
-
}
|
|
8723
|
-
|
|
8724
8753
|
var nextMicroTask = Promise.resolve();
|
|
8725
8754
|
function defer(callback) {
|
|
8726
8755
|
var progress = null;
|
|
@@ -9545,11 +9574,6 @@
|
|
|
9545
9574
|
}
|
|
9546
9575
|
};
|
|
9547
9576
|
};
|
|
9548
|
-
function storeRenderState(param) {
|
|
9549
|
-
var renderState = param.renderState, instantSearchInstance = param.instantSearchInstance, parent = param.parent;
|
|
9550
|
-
var parentIndexName = parent ? parent.getIndexId() : instantSearchInstance.mainIndex.getIndexId();
|
|
9551
|
-
instantSearchInstance.renderState = _object_spread_props(_object_spread({}, instantSearchInstance.renderState), _define_property({}, parentIndexName, _object_spread({}, instantSearchInstance.renderState[parentIndexName], renderState)));
|
|
9552
|
-
}
|
|
9553
9577
|
/**
|
|
9554
9578
|
* Walk up the parent chain to find the closest isolated index, or fall back to mainHelper
|
|
9555
9579
|
*/ function nearestIsolatedHelper(current, mainHelper) {
|
|
@@ -9957,8 +9981,12 @@
|
|
|
9957
9981
|
};
|
|
9958
9982
|
}
|
|
9959
9983
|
|
|
9960
|
-
var version = '4.
|
|
9984
|
+
var version = '4.96.0';
|
|
9961
9985
|
|
|
9986
|
+
function getServerResults(entry) {
|
|
9987
|
+
var _entry_compositionFeedsResults;
|
|
9988
|
+
return ((_entry_compositionFeedsResults = entry.compositionFeedsResults) === null || _entry_compositionFeedsResults === void 0 ? void 0 : _entry_compositionFeedsResults.length) ? entry.compositionFeedsResults : entry.results || [];
|
|
9989
|
+
}
|
|
9962
9990
|
function hydrateSearchClient(client, results) {
|
|
9963
9991
|
if (!results) {
|
|
9964
9992
|
return;
|
|
@@ -9971,7 +9999,9 @@
|
|
|
9971
9999
|
}
|
|
9972
10000
|
var cachedRequest = [
|
|
9973
10001
|
Object.keys(results).reduce(function(acc, key) {
|
|
9974
|
-
var
|
|
10002
|
+
var entry = results[key];
|
|
10003
|
+
var state = entry.state, requestParams = entry.requestParams;
|
|
10004
|
+
var serverResults = getServerResults(entry);
|
|
9975
10005
|
var mappedResults = serverResults && state ? serverResults.map(function(result, idx) {
|
|
9976
10006
|
return _object_spread({
|
|
9977
10007
|
indexName: state.index || result.index
|
|
@@ -9983,7 +10013,7 @@
|
|
|
9983
10013
|
}, [])
|
|
9984
10014
|
];
|
|
9985
10015
|
var cachedResults = Object.keys(results).reduce(function(acc, key) {
|
|
9986
|
-
var res = results[key]
|
|
10016
|
+
var res = getServerResults(results[key]);
|
|
9987
10017
|
if (!res) {
|
|
9988
10018
|
return acc;
|
|
9989
10019
|
}
|
|
@@ -10038,7 +10068,7 @@
|
|
|
10038
10068
|
}));
|
|
10039
10069
|
client.cache = _object_spread_props(_object_spread({}, client.cache), _define_property({}, cacheKey, JSON.stringify({
|
|
10040
10070
|
results: Object.keys(results).map(function(key) {
|
|
10041
|
-
return results[key]
|
|
10071
|
+
return getServerResults(results[key]);
|
|
10042
10072
|
})
|
|
10043
10073
|
})));
|
|
10044
10074
|
}
|
|
@@ -11105,6 +11135,13 @@
|
|
|
11105
11135
|
});
|
|
11106
11136
|
}
|
|
11107
11137
|
|
|
11138
|
+
/**
|
|
11139
|
+
* Returns true if the widget requires a second SSR pass to discover and
|
|
11140
|
+
* mount child widgets (e.g. DynamicWidgets, Feeds).
|
|
11141
|
+
*/ function isTwoPassWidget(widget) {
|
|
11142
|
+
return widget.$$type === 'ais.dynamicWidgets' || widget.$$type === 'ais.feeds';
|
|
11143
|
+
}
|
|
11144
|
+
|
|
11108
11145
|
/**
|
|
11109
11146
|
* Creates a new object with the same keys as the original object, but without the excluded keys.
|
|
11110
11147
|
* @param source original object
|
|
@@ -15476,19 +15513,16 @@
|
|
|
15476
15513
|
});
|
|
15477
15514
|
/*
|
|
15478
15515
|
With dynamic widgets, facets are not included in the state before their relevant widgets are mounted. Until then, we need to bail out of writing this incomplete state representation in cache.
|
|
15479
|
-
*/ var
|
|
15516
|
+
*/ var hasTwoPassWidgets = false;
|
|
15480
15517
|
walkIndex(instantSearchInstance.mainIndex, function(indexWidget) {
|
|
15481
|
-
if (!
|
|
15482
|
-
|
|
15483
|
-
return $$type === 'ais.dynamicWidgets';
|
|
15484
|
-
})) {
|
|
15485
|
-
hasDynamicWidgets = true;
|
|
15518
|
+
if (!hasTwoPassWidgets && indexWidget.getWidgets().some(isTwoPassWidget)) {
|
|
15519
|
+
hasTwoPassWidgets = true;
|
|
15486
15520
|
}
|
|
15487
15521
|
});
|
|
15488
15522
|
var hasNoFacets = !((_state_disjunctiveFacets = state.disjunctiveFacets) === null || _state_disjunctiveFacets === void 0 ? void 0 : _state_disjunctiveFacets.length) && !(state.facets || []).filter(function(f) {
|
|
15489
15523
|
return f !== '*';
|
|
15490
15524
|
}).length && !((_state_hierarchicalFacets = state.hierarchicalFacets) === null || _state_hierarchicalFacets === void 0 ? void 0 : _state_hierarchicalFacets.length);
|
|
15491
|
-
if (cachedHits[page] === undefined && !results.__isArtificial && instantSearchInstance.status === 'idle' && !(
|
|
15525
|
+
if (cachedHits[page] === undefined && !results.__isArtificial && instantSearchInstance.status === 'idle' && !(hasTwoPassWidgets && hasNoFacets)) {
|
|
15492
15526
|
cachedHits[page] = transformedHits;
|
|
15493
15527
|
cache.write({
|
|
15494
15528
|
state: normalizeState(state),
|
|
@@ -19385,7 +19419,8 @@
|
|
|
19385
19419
|
},
|
|
19386
19420
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, param) {
|
|
19387
19421
|
var uiState = param.uiState;
|
|
19388
|
-
var
|
|
19422
|
+
var isUiStateSortByInItems = !uiState.sortBy || Object.prototype.hasOwnProperty.call(connectorState.itemsLookup, uiState.sortBy);
|
|
19423
|
+
var sortByValue = (isUiStateSortByInItems ? uiState.sortBy : undefined) || connectorState.initialValue || searchParameters.index;
|
|
19389
19424
|
if (isValidStrategy(connectorState.itemsLookup, sortByValue)) {
|
|
19390
19425
|
var item = connectorState.itemsLookup[sortByValue];
|
|
19391
19426
|
// Strategy-based: set the sortBy parameter for composition API
|