instantsearch.js 4.37.3 → 4.38.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/CHANGELOG.md +14 -0
- package/cjs/connectors/breadcrumb/connectBreadcrumb.js +3 -1
- package/cjs/connectors/clear-refinements/connectClearRefinements.js +11 -6
- package/cjs/connectors/current-refinements/connectCurrentRefinements.js +6 -2
- package/cjs/connectors/geo-search/connectGeoSearch.js +3 -1
- package/cjs/connectors/hierarchical-menu/connectHierarchicalMenu.js +3 -1
- package/cjs/connectors/hits/connectHits.js +3 -1
- package/cjs/connectors/hits-per-page/connectHitsPerPage.js +3 -1
- package/cjs/connectors/infinite-hits/connectInfiniteHits.js +3 -1
- package/cjs/connectors/menu/connectMenu.js +3 -1
- package/cjs/connectors/numeric-menu/connectNumericMenu.js +5 -3
- package/cjs/connectors/query-rules/connectQueryRules.js +3 -1
- package/cjs/connectors/refinement-list/connectRefinementList.js +8 -3
- package/cjs/connectors/sort-by/connectSortBy.js +3 -1
- package/cjs/lib/version.js +1 -1
- package/dist/instantsearch.development.d.ts +9 -7
- package/dist/instantsearch.development.js +59 -25
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +9 -7
- package/dist/instantsearch.production.min.d.ts +9 -7
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/connectors/breadcrumb/connectBreadcrumb.js +3 -1
- package/es/connectors/clear-refinements/connectClearRefinements.js +11 -6
- package/es/connectors/current-refinements/connectCurrentRefinements.js +6 -2
- package/es/connectors/dynamic-widgets/connectDynamicWidgets.d.ts +4 -5
- package/es/connectors/geo-search/connectGeoSearch.js +3 -1
- package/es/connectors/hierarchical-menu/connectHierarchicalMenu.js +3 -1
- package/es/connectors/hits/connectHits.js +3 -1
- package/es/connectors/hits-per-page/connectHitsPerPage.js +3 -1
- package/es/connectors/infinite-hits/connectInfiniteHits.js +3 -1
- package/es/connectors/menu/connectMenu.js +3 -1
- package/es/connectors/numeric-menu/connectNumericMenu.js +5 -3
- package/es/connectors/query-rules/connectQueryRules.d.ts +1 -2
- package/es/connectors/query-rules/connectQueryRules.js +3 -1
- package/es/connectors/refinement-list/connectRefinementList.js +8 -3
- package/es/connectors/sort-by/connectSortBy.js +3 -1
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/types/widget.d.ts +4 -1
- package/package.json +1 -1
- package/dist/instantsearch.development.min.d.ts +0 -5246
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [4.38.0](https://github.com/algolia/instantsearch.js/compare/v4.37.3...v4.38.0) (2022-01-28)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **typescript:** remove non-existing UMD type definition ([#5001](https://github.com/algolia/instantsearch.js/issues/5001)) ([c234374](https://github.com/algolia/instantsearch.js/commit/c234374a1f5333f6625980c45fa0833a8c130257))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **connectors:** expose search results to `transformItems` when available ([#5000](https://github.com/algolia/instantsearch.js/issues/5000)) ([58c2651](https://github.com/algolia/instantsearch.js/commit/58c26517aad916ce49b474458e3411ff7ef5497a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
1
15
|
## [4.37.3](https://github.com/algolia/instantsearch.js/compare/v4.37.2...v4.37.3) (2022-01-25)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -106,7 +106,9 @@ var connectBreadcrumb = function connectBreadcrumb(renderFn) {
|
|
|
106
106
|
|
|
107
107
|
var facetValues = results.getFacetValues(facetName, {});
|
|
108
108
|
var data = Array.isArray(facetValues.data) ? facetValues.data : [];
|
|
109
|
-
var items = transformItems(shiftItemsValues(prepareItems(data))
|
|
109
|
+
var items = transformItems(shiftItemsValues(prepareItems(data)), {
|
|
110
|
+
results: results
|
|
111
|
+
});
|
|
110
112
|
return items;
|
|
111
113
|
}
|
|
112
114
|
|
|
@@ -88,13 +88,15 @@ var connectClearRefinements = function connectClearRefinements(renderFn) {
|
|
|
88
88
|
},
|
|
89
89
|
getWidgetRenderState: function getWidgetRenderState(_ref2) {
|
|
90
90
|
var createURL = _ref2.createURL,
|
|
91
|
-
scopedResults = _ref2.scopedResults
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
scopedResults = _ref2.scopedResults,
|
|
92
|
+
results = _ref2.results;
|
|
93
|
+
connectorState.attributesToClear = scopedResults.reduce(function (attributesToClear, scopedResult) {
|
|
94
|
+
return attributesToClear.concat(getAttributesToClear({
|
|
94
95
|
scopedResult: scopedResult,
|
|
95
96
|
includedAttributes: includedAttributes,
|
|
96
97
|
excludedAttributes: excludedAttributes,
|
|
97
|
-
transformItems: transformItems
|
|
98
|
+
transformItems: transformItems,
|
|
99
|
+
results: results
|
|
98
100
|
}));
|
|
99
101
|
}, []);
|
|
100
102
|
|
|
@@ -139,7 +141,8 @@ function getAttributesToClear(_ref5) {
|
|
|
139
141
|
var scopedResult = _ref5.scopedResult,
|
|
140
142
|
includedAttributes = _ref5.includedAttributes,
|
|
141
143
|
excludedAttributes = _ref5.excludedAttributes,
|
|
142
|
-
transformItems = _ref5.transformItems
|
|
144
|
+
transformItems = _ref5.transformItems,
|
|
145
|
+
results = _ref5.results;
|
|
143
146
|
var includesQuery = includedAttributes.indexOf('query') !== -1 || excludedAttributes.indexOf('query') === -1;
|
|
144
147
|
return {
|
|
145
148
|
helper: scopedResult.helper,
|
|
@@ -155,7 +158,9 @@ function getAttributesToClear(_ref5) {
|
|
|
155
158
|
attribute === 'query' && includesQuery || // Otherwise, ignore the excluded attributes
|
|
156
159
|
excludedAttributes.indexOf(attribute) === -1
|
|
157
160
|
);
|
|
158
|
-
}))
|
|
161
|
+
})), {
|
|
162
|
+
results: results
|
|
163
|
+
})
|
|
159
164
|
};
|
|
160
165
|
}
|
|
161
166
|
|
|
@@ -82,7 +82,9 @@ var connectCurrentRefinements = function connectCurrentRefinements(renderFn) {
|
|
|
82
82
|
helper: helper,
|
|
83
83
|
includedAttributes: includedAttributes,
|
|
84
84
|
excludedAttributes: excludedAttributes
|
|
85
|
-
})
|
|
85
|
+
}), {
|
|
86
|
+
results: results
|
|
87
|
+
});
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
return scopedResults.reduce(function (accResults, scopedResult) {
|
|
@@ -91,7 +93,9 @@ var connectCurrentRefinements = function connectCurrentRefinements(renderFn) {
|
|
|
91
93
|
helper: scopedResult.helper,
|
|
92
94
|
includedAttributes: includedAttributes,
|
|
93
95
|
excludedAttributes: excludedAttributes
|
|
94
|
-
})
|
|
96
|
+
}), {
|
|
97
|
+
results: results
|
|
98
|
+
}));
|
|
95
99
|
}, []);
|
|
96
100
|
}
|
|
97
101
|
|
|
@@ -169,7 +169,9 @@ var connectGeoSearch = function connectGeoSearch(renderFn) {
|
|
|
169
169
|
var state = helper.state;
|
|
170
170
|
var items = results ? transformItems(results.hits.filter(function (hit) {
|
|
171
171
|
return hit._geoloc;
|
|
172
|
-
})
|
|
172
|
+
}), {
|
|
173
|
+
results: results
|
|
174
|
+
}) : [];
|
|
173
175
|
|
|
174
176
|
if (!sendEvent) {
|
|
175
177
|
sendEvent = (0, _index.createSendEventForHits)({
|
|
@@ -200,7 +200,9 @@ var connectHierarchicalMenu = function connectHierarchicalMenu(renderFn) {
|
|
|
200
200
|
|
|
201
201
|
var hasExhaustiveItems = (state.maxValuesPerFacet || 0) > getLimit() ? facetItems.length <= getLimit() : facetItems.length < getLimit();
|
|
202
202
|
canToggleShowMore = showMore && (isShowingMore || !hasExhaustiveItems);
|
|
203
|
-
items = transformItems(_prepareFacetValues(facetItems)
|
|
203
|
+
items = transformItems(_prepareFacetValues(facetItems), {
|
|
204
|
+
results: results
|
|
205
|
+
});
|
|
204
206
|
}
|
|
205
207
|
|
|
206
208
|
return {
|
|
@@ -87,7 +87,9 @@ var connectHits = function connectHits(renderFn) {
|
|
|
87
87
|
|
|
88
88
|
var hitsWithAbsolutePosition = (0, _index.addAbsolutePosition)(results.hits, results.page, results.hitsPerPage);
|
|
89
89
|
var hitsWithAbsolutePositionAndQueryID = (0, _index.addQueryID)(hitsWithAbsolutePosition, results.queryID);
|
|
90
|
-
var transformedHits = transformItems(hitsWithAbsolutePositionAndQueryID
|
|
90
|
+
var transformedHits = transformItems(hitsWithAbsolutePositionAndQueryID, {
|
|
91
|
+
results: results
|
|
92
|
+
});
|
|
91
93
|
return {
|
|
92
94
|
hits: transformedHits,
|
|
93
95
|
results: results,
|
|
@@ -128,7 +128,9 @@ var connectHitsPerPage = function connectHitsPerPage(renderFn) {
|
|
|
128
128
|
createURL = _ref5.createURL,
|
|
129
129
|
helper = _ref5.helper;
|
|
130
130
|
return {
|
|
131
|
-
items: transformItems(normalizeItems(state)
|
|
131
|
+
items: transformItems(normalizeItems(state), {
|
|
132
|
+
results: results
|
|
133
|
+
}),
|
|
132
134
|
refine: connectorState.getRefine(helper),
|
|
133
135
|
createURL: connectorState.createURLFactory({
|
|
134
136
|
state: state,
|
|
@@ -184,7 +184,9 @@ var connectInfiniteHits = function connectInfiniteHits(renderFn) {
|
|
|
184
184
|
|
|
185
185
|
var hitsWithAbsolutePosition = (0, _index.addAbsolutePosition)(results.hits, results.page, results.hitsPerPage);
|
|
186
186
|
var hitsWithAbsolutePositionAndQueryID = (0, _index.addQueryID)(hitsWithAbsolutePosition, results.queryID);
|
|
187
|
-
var transformedHits = transformItems(hitsWithAbsolutePositionAndQueryID
|
|
187
|
+
var transformedHits = transformItems(hitsWithAbsolutePositionAndQueryID, {
|
|
188
|
+
results: results
|
|
189
|
+
});
|
|
188
190
|
|
|
189
191
|
if (cachedHits[_page] === undefined) {
|
|
190
192
|
cachedHits[_page] = transformedHits;
|
|
@@ -86,8 +86,8 @@ var connectNumericMenu = function connectNumericMenu(renderFn) {
|
|
|
86
86
|
_ref2$items = _ref2.items,
|
|
87
87
|
items = _ref2$items === void 0 ? [] : _ref2$items,
|
|
88
88
|
_ref2$transformItems = _ref2.transformItems,
|
|
89
|
-
transformItems = _ref2$transformItems === void 0 ? function (
|
|
90
|
-
return
|
|
89
|
+
transformItems = _ref2$transformItems === void 0 ? function (item) {
|
|
90
|
+
return item;
|
|
91
91
|
} : _ref2$transformItems;
|
|
92
92
|
|
|
93
93
|
if (attribute === '') {
|
|
@@ -224,7 +224,9 @@ var connectNumericMenu = function connectNumericMenu(renderFn) {
|
|
|
224
224
|
|
|
225
225
|
return {
|
|
226
226
|
createURL: connectorState.createURL(state),
|
|
227
|
-
items: transformItems(prepareItems(state)
|
|
227
|
+
items: transformItems(prepareItems(state), {
|
|
228
|
+
results: results
|
|
229
|
+
}),
|
|
228
230
|
hasNoResults: results ? results.nbHits === 0 : true,
|
|
229
231
|
refine: connectorState.refine,
|
|
230
232
|
sendEvent: connectorState.sendEvent,
|
|
@@ -160,7 +160,9 @@ var connectQueryRules = function connectQueryRules(_render) {
|
|
|
160
160
|
_ref4$userData = _ref4.userData,
|
|
161
161
|
userData = _ref4$userData === void 0 ? [] : _ref4$userData;
|
|
162
162
|
|
|
163
|
-
var items = transformItems(userData
|
|
163
|
+
var items = transformItems(userData, {
|
|
164
|
+
results: results
|
|
165
|
+
});
|
|
164
166
|
return {
|
|
165
167
|
items: items,
|
|
166
168
|
widgetParams: widgetParams
|
|
@@ -113,7 +113,8 @@ var connectRefinementList = function connectRefinementList(renderFn) {
|
|
|
113
113
|
var createSearchForFacetValues = function createSearchForFacetValues(helper, widget) {
|
|
114
114
|
return function (renderOptions) {
|
|
115
115
|
return function (query) {
|
|
116
|
-
var instantSearchInstance = renderOptions.instantSearchInstance
|
|
116
|
+
var instantSearchInstance = renderOptions.instantSearchInstance,
|
|
117
|
+
searchResults = renderOptions.results;
|
|
117
118
|
|
|
118
119
|
if (query === '' && lastItemsFromMainSearch) {
|
|
119
120
|
// render with previous data from the helper.
|
|
@@ -140,7 +141,9 @@ var connectRefinementList = function connectRefinementList(renderFn) {
|
|
|
140
141
|
value: value,
|
|
141
142
|
label: value
|
|
142
143
|
});
|
|
143
|
-
})
|
|
144
|
+
}), {
|
|
145
|
+
results: searchResults
|
|
146
|
+
});
|
|
144
147
|
renderFn(_objectSpread(_objectSpread({}, widget.getWidgetRenderState(_objectSpread(_objectSpread({}, renderOptions), {}, {
|
|
145
148
|
results: lastResultsFromMainSearch
|
|
146
149
|
}))), {}, {
|
|
@@ -204,7 +207,9 @@ var connectRefinementList = function connectRefinementList(renderFn) {
|
|
|
204
207
|
facetOrdering: sortBy === DEFAULT_SORT
|
|
205
208
|
});
|
|
206
209
|
facetValues = values && Array.isArray(values) ? values : [];
|
|
207
|
-
items = transformItems(facetValues.slice(0, getLimit()).map(formatItems)
|
|
210
|
+
items = transformItems(facetValues.slice(0, getLimit()).map(formatItems), {
|
|
211
|
+
results: results
|
|
212
|
+
});
|
|
208
213
|
var maxValuesPerFacetConfig = state.maxValuesPerFacet;
|
|
209
214
|
var currentLimit = getLimit(); // If the limit is the max number of facet retrieved it is impossible to know
|
|
210
215
|
// if the facets are exhaustive. The only moment we are sure it is exhaustive
|
|
@@ -87,7 +87,9 @@ var connectSortBy = function connectSortBy(renderFn) {
|
|
|
87
87
|
|
|
88
88
|
return {
|
|
89
89
|
currentRefinement: state.index,
|
|
90
|
-
options: transformItems(items
|
|
90
|
+
options: transformItems(items, {
|
|
91
|
+
results: results
|
|
92
|
+
}),
|
|
91
93
|
refine: connectorState.setIndex,
|
|
92
94
|
hasNoResults: results ? results.nbHits === 0 : true,
|
|
93
95
|
widgetParams: widgetParams
|
package/cjs/lib/version.js
CHANGED
|
@@ -1098,9 +1098,9 @@ declare type DynamicWidgetsConnectorParams = {
|
|
|
1098
1098
|
* Function to transform the items to render.
|
|
1099
1099
|
* The function also exposes the full search response.
|
|
1100
1100
|
*/
|
|
1101
|
-
transformItems
|
|
1102
|
-
results:
|
|
1103
|
-
}
|
|
1101
|
+
transformItems?: TransformItems<string, Omit<TransformItemsMetadata, 'results'> & {
|
|
1102
|
+
results: NonNullable<TransformItemsMetadata['results']>;
|
|
1103
|
+
}>;
|
|
1104
1104
|
/**
|
|
1105
1105
|
* To prevent unneeded extra network requests when widgets mount or unmount,
|
|
1106
1106
|
* we request all facet values.
|
|
@@ -3203,8 +3203,6 @@ declare type ParamTrackedFilters = {
|
|
|
3203
3203
|
[facetName: string]: (facetValues: TrackedFilterRefinement[]) => TrackedFilterRefinement[];
|
|
3204
3204
|
};
|
|
3205
3205
|
|
|
3206
|
-
declare type ParamTransformItems = TransformItems<any>;
|
|
3207
|
-
|
|
3208
3206
|
declare type ParamTransformRuleContexts = (ruleContexts: string[]) => string[];
|
|
3209
3207
|
|
|
3210
3208
|
declare type ParseURL<TRouteState> = (args: {
|
|
@@ -3345,7 +3343,7 @@ declare type QueryRulesConnector = Connector<QueryRulesWidgetDescription, QueryR
|
|
|
3345
3343
|
declare type QueryRulesConnectorParams = {
|
|
3346
3344
|
trackedFilters?: ParamTrackedFilters;
|
|
3347
3345
|
transformRuleContexts?: ParamTransformRuleContexts;
|
|
3348
|
-
transformItems?:
|
|
3346
|
+
transformItems?: TransformItems<any>;
|
|
3349
3347
|
};
|
|
3350
3348
|
|
|
3351
3349
|
declare type QueryRulesRenderState = {
|
|
@@ -5050,7 +5048,11 @@ declare type TrackedFilterRefinement = string | number | boolean;
|
|
|
5050
5048
|
/**
|
|
5051
5049
|
* Transforms the given items.
|
|
5052
5050
|
*/
|
|
5053
|
-
declare type TransformItems<TItem> = (items: TItem[]) => TItem[];
|
|
5051
|
+
declare type TransformItems<TItem, TMetadata = TransformItemsMetadata> = (items: TItem[], metadata: TMetadata) => TItem[];
|
|
5052
|
+
|
|
5053
|
+
declare type TransformItemsMetadata = {
|
|
5054
|
+
results?: SearchResults;
|
|
5055
|
+
};
|
|
5054
5056
|
|
|
5055
5057
|
declare type TransformSearchParameters = (searchParameters: SearchParameters) => PlainSearchParameters;
|
|
5056
5058
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! InstantSearch.js 4.
|
|
1
|
+
/*! InstantSearch.js 4.38.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -8483,7 +8483,7 @@
|
|
|
8483
8483
|
instantSearchInstance.renderState = _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState), {}, _defineProperty({}, parentIndexName, _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState[parentIndexName]), renderState)));
|
|
8484
8484
|
}
|
|
8485
8485
|
|
|
8486
|
-
var version$1 = '4.
|
|
8486
|
+
var version$1 = '4.38.0';
|
|
8487
8487
|
|
|
8488
8488
|
var NAMESPACE = 'ais';
|
|
8489
8489
|
var component = function component(componentName) {
|
|
@@ -10545,13 +10545,15 @@
|
|
|
10545
10545
|
},
|
|
10546
10546
|
getWidgetRenderState: function getWidgetRenderState(_ref2) {
|
|
10547
10547
|
var createURL = _ref2.createURL,
|
|
10548
|
-
scopedResults = _ref2.scopedResults
|
|
10549
|
-
|
|
10550
|
-
|
|
10548
|
+
scopedResults = _ref2.scopedResults,
|
|
10549
|
+
results = _ref2.results;
|
|
10550
|
+
connectorState.attributesToClear = scopedResults.reduce(function (attributesToClear, scopedResult) {
|
|
10551
|
+
return attributesToClear.concat(getAttributesToClear({
|
|
10551
10552
|
scopedResult: scopedResult,
|
|
10552
10553
|
includedAttributes: includedAttributes,
|
|
10553
10554
|
excludedAttributes: excludedAttributes,
|
|
10554
|
-
transformItems: transformItems
|
|
10555
|
+
transformItems: transformItems,
|
|
10556
|
+
results: results
|
|
10555
10557
|
}));
|
|
10556
10558
|
}, []);
|
|
10557
10559
|
|
|
@@ -10596,7 +10598,8 @@
|
|
|
10596
10598
|
var scopedResult = _ref5.scopedResult,
|
|
10597
10599
|
includedAttributes = _ref5.includedAttributes,
|
|
10598
10600
|
excludedAttributes = _ref5.excludedAttributes,
|
|
10599
|
-
transformItems = _ref5.transformItems
|
|
10601
|
+
transformItems = _ref5.transformItems,
|
|
10602
|
+
results = _ref5.results;
|
|
10600
10603
|
var includesQuery = includedAttributes.indexOf('query') !== -1 || excludedAttributes.indexOf('query') === -1;
|
|
10601
10604
|
return {
|
|
10602
10605
|
helper: scopedResult.helper,
|
|
@@ -10612,7 +10615,9 @@
|
|
|
10612
10615
|
attribute === 'query' && includesQuery || // Otherwise, ignore the excluded attributes
|
|
10613
10616
|
excludedAttributes.indexOf(attribute) === -1
|
|
10614
10617
|
);
|
|
10615
|
-
}))
|
|
10618
|
+
})), {
|
|
10619
|
+
results: results
|
|
10620
|
+
})
|
|
10616
10621
|
};
|
|
10617
10622
|
}
|
|
10618
10623
|
|
|
@@ -10673,7 +10678,9 @@
|
|
|
10673
10678
|
helper: helper,
|
|
10674
10679
|
includedAttributes: includedAttributes,
|
|
10675
10680
|
excludedAttributes: excludedAttributes
|
|
10676
|
-
})
|
|
10681
|
+
}), {
|
|
10682
|
+
results: results
|
|
10683
|
+
});
|
|
10677
10684
|
}
|
|
10678
10685
|
|
|
10679
10686
|
return scopedResults.reduce(function (accResults, scopedResult) {
|
|
@@ -10682,7 +10689,9 @@
|
|
|
10682
10689
|
helper: scopedResult.helper,
|
|
10683
10690
|
includedAttributes: includedAttributes,
|
|
10684
10691
|
excludedAttributes: excludedAttributes
|
|
10685
|
-
})
|
|
10692
|
+
}), {
|
|
10693
|
+
results: results
|
|
10694
|
+
}));
|
|
10686
10695
|
}, []);
|
|
10687
10696
|
}
|
|
10688
10697
|
|
|
@@ -10977,7 +10986,9 @@
|
|
|
10977
10986
|
|
|
10978
10987
|
var hasExhaustiveItems = (state.maxValuesPerFacet || 0) > getLimit() ? facetItems.length <= getLimit() : facetItems.length < getLimit();
|
|
10979
10988
|
canToggleShowMore = showMore && (isShowingMore || !hasExhaustiveItems);
|
|
10980
|
-
items = transformItems(_prepareFacetValues(facetItems)
|
|
10989
|
+
items = transformItems(_prepareFacetValues(facetItems), {
|
|
10990
|
+
results: results
|
|
10991
|
+
});
|
|
10981
10992
|
}
|
|
10982
10993
|
|
|
10983
10994
|
return {
|
|
@@ -11110,7 +11121,9 @@
|
|
|
11110
11121
|
|
|
11111
11122
|
var hitsWithAbsolutePosition = addAbsolutePosition(results.hits, results.page, results.hitsPerPage);
|
|
11112
11123
|
var hitsWithAbsolutePositionAndQueryID = addQueryID(hitsWithAbsolutePosition, results.queryID);
|
|
11113
|
-
var transformedHits = transformItems(hitsWithAbsolutePositionAndQueryID
|
|
11124
|
+
var transformedHits = transformItems(hitsWithAbsolutePositionAndQueryID, {
|
|
11125
|
+
results: results
|
|
11126
|
+
});
|
|
11114
11127
|
return {
|
|
11115
11128
|
hits: transformedHits,
|
|
11116
11129
|
results: results,
|
|
@@ -11443,7 +11456,9 @@
|
|
|
11443
11456
|
createURL = _ref5.createURL,
|
|
11444
11457
|
helper = _ref5.helper;
|
|
11445
11458
|
return {
|
|
11446
|
-
items: transformItems(normalizeItems(state)
|
|
11459
|
+
items: transformItems(normalizeItems(state), {
|
|
11460
|
+
results: results
|
|
11461
|
+
}),
|
|
11447
11462
|
refine: connectorState.getRefine(helper),
|
|
11448
11463
|
createURL: connectorState.createURLFactory({
|
|
11449
11464
|
state: state,
|
|
@@ -11630,7 +11645,9 @@
|
|
|
11630
11645
|
|
|
11631
11646
|
var hitsWithAbsolutePosition = addAbsolutePosition(results.hits, results.page, results.hitsPerPage);
|
|
11632
11647
|
var hitsWithAbsolutePositionAndQueryID = addQueryID(hitsWithAbsolutePosition, results.queryID);
|
|
11633
|
-
var transformedHits = transformItems(hitsWithAbsolutePositionAndQueryID
|
|
11648
|
+
var transformedHits = transformItems(hitsWithAbsolutePositionAndQueryID, {
|
|
11649
|
+
results: results
|
|
11650
|
+
});
|
|
11634
11651
|
|
|
11635
11652
|
if (cachedHits[_page] === undefined) {
|
|
11636
11653
|
cachedHits[_page] = transformedHits;
|
|
@@ -11854,7 +11871,9 @@
|
|
|
11854
11871
|
label: label,
|
|
11855
11872
|
value: value
|
|
11856
11873
|
});
|
|
11857
|
-
})
|
|
11874
|
+
}), {
|
|
11875
|
+
results: results
|
|
11876
|
+
});
|
|
11858
11877
|
}
|
|
11859
11878
|
|
|
11860
11879
|
return {
|
|
@@ -11968,8 +11987,8 @@
|
|
|
11968
11987
|
_ref2$items = _ref2.items,
|
|
11969
11988
|
items = _ref2$items === void 0 ? [] : _ref2$items,
|
|
11970
11989
|
_ref2$transformItems = _ref2.transformItems,
|
|
11971
|
-
transformItems = _ref2$transformItems === void 0 ? function (
|
|
11972
|
-
return
|
|
11990
|
+
transformItems = _ref2$transformItems === void 0 ? function (item) {
|
|
11991
|
+
return item;
|
|
11973
11992
|
} : _ref2$transformItems;
|
|
11974
11993
|
|
|
11975
11994
|
if (attribute === '') {
|
|
@@ -12106,7 +12125,9 @@
|
|
|
12106
12125
|
|
|
12107
12126
|
return {
|
|
12108
12127
|
createURL: connectorState.createURL(state),
|
|
12109
|
-
items: transformItems(prepareItems(state)
|
|
12128
|
+
items: transformItems(prepareItems(state), {
|
|
12129
|
+
results: results
|
|
12130
|
+
}),
|
|
12110
12131
|
hasNoResults: results ? results.nbHits === 0 : true,
|
|
12111
12132
|
refine: connectorState.refine,
|
|
12112
12133
|
sendEvent: connectorState.sendEvent,
|
|
@@ -12848,7 +12869,8 @@
|
|
|
12848
12869
|
var createSearchForFacetValues = function createSearchForFacetValues(helper, widget) {
|
|
12849
12870
|
return function (renderOptions) {
|
|
12850
12871
|
return function (query) {
|
|
12851
|
-
var instantSearchInstance = renderOptions.instantSearchInstance
|
|
12872
|
+
var instantSearchInstance = renderOptions.instantSearchInstance,
|
|
12873
|
+
searchResults = renderOptions.results;
|
|
12852
12874
|
|
|
12853
12875
|
if (query === '' && lastItemsFromMainSearch) {
|
|
12854
12876
|
// render with previous data from the helper.
|
|
@@ -12875,7 +12897,9 @@
|
|
|
12875
12897
|
value: value,
|
|
12876
12898
|
label: value
|
|
12877
12899
|
});
|
|
12878
|
-
})
|
|
12900
|
+
}), {
|
|
12901
|
+
results: searchResults
|
|
12902
|
+
});
|
|
12879
12903
|
renderFn(_objectSpread2(_objectSpread2({}, widget.getWidgetRenderState(_objectSpread2(_objectSpread2({}, renderOptions), {}, {
|
|
12880
12904
|
results: lastResultsFromMainSearch
|
|
12881
12905
|
}))), {}, {
|
|
@@ -12939,7 +12963,9 @@
|
|
|
12939
12963
|
facetOrdering: sortBy === DEFAULT_SORT$2
|
|
12940
12964
|
});
|
|
12941
12965
|
facetValues = values && Array.isArray(values) ? values : [];
|
|
12942
|
-
items = transformItems(facetValues.slice(0, getLimit()).map(formatItems)
|
|
12966
|
+
items = transformItems(facetValues.slice(0, getLimit()).map(formatItems), {
|
|
12967
|
+
results: results
|
|
12968
|
+
});
|
|
12943
12969
|
var maxValuesPerFacetConfig = state.maxValuesPerFacet;
|
|
12944
12970
|
var currentLimit = getLimit(); // If the limit is the max number of facet retrieved it is impossible to know
|
|
12945
12971
|
// if the facets are exhaustive. The only moment we are sure it is exhaustive
|
|
@@ -13197,7 +13223,9 @@
|
|
|
13197
13223
|
|
|
13198
13224
|
return {
|
|
13199
13225
|
currentRefinement: state.index,
|
|
13200
|
-
options: transformItems(items
|
|
13226
|
+
options: transformItems(items, {
|
|
13227
|
+
results: results
|
|
13228
|
+
}),
|
|
13201
13229
|
refine: connectorState.setIndex,
|
|
13202
13230
|
hasNoResults: results ? results.nbHits === 0 : true,
|
|
13203
13231
|
widgetParams: widgetParams
|
|
@@ -13955,7 +13983,9 @@
|
|
|
13955
13983
|
|
|
13956
13984
|
var facetValues = results.getFacetValues(facetName, {});
|
|
13957
13985
|
var data = Array.isArray(facetValues.data) ? facetValues.data : [];
|
|
13958
|
-
var items = transformItems(shiftItemsValues(prepareItems(data))
|
|
13986
|
+
var items = transformItems(shiftItemsValues(prepareItems(data)), {
|
|
13987
|
+
results: results
|
|
13988
|
+
});
|
|
13959
13989
|
return items;
|
|
13960
13990
|
}
|
|
13961
13991
|
|
|
@@ -14181,7 +14211,9 @@
|
|
|
14181
14211
|
var state = helper.state;
|
|
14182
14212
|
var items = results ? transformItems(results.hits.filter(function (hit) {
|
|
14183
14213
|
return hit._geoloc;
|
|
14184
|
-
})
|
|
14214
|
+
}), {
|
|
14215
|
+
results: results
|
|
14216
|
+
}) : [];
|
|
14185
14217
|
|
|
14186
14218
|
if (!sendEvent) {
|
|
14187
14219
|
sendEvent = createSendEventForHits({
|
|
@@ -14727,7 +14759,9 @@
|
|
|
14727
14759
|
_ref4$userData = _ref4.userData,
|
|
14728
14760
|
userData = _ref4$userData === void 0 ? [] : _ref4$userData;
|
|
14729
14761
|
|
|
14730
|
-
var items = transformItems(userData
|
|
14762
|
+
var items = transformItems(userData, {
|
|
14763
|
+
results: results
|
|
14764
|
+
});
|
|
14731
14765
|
return {
|
|
14732
14766
|
items: items,
|
|
14733
14767
|
widgetParams: widgetParams
|