instantsearch.js 4.71.1 → 4.72.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/cjs/connectors/infinite-hits/connectInfiniteHits.js +3 -0
- package/cjs/lib/version.js +1 -1
- package/cjs/middlewares/createRouterMiddleware.js +1 -0
- package/dist/instantsearch.development.d.ts +14 -45
- package/dist/instantsearch.development.js +12 -6
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +14 -45
- package/dist/instantsearch.production.min.d.ts +14 -45
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/connectors/hits/connectHits.d.ts +2 -14
- package/es/connectors/hits/connectHitsWithInsights.d.ts +1 -12
- package/es/connectors/infinite-hits/connectInfiniteHits.d.ts +6 -1
- package/es/connectors/infinite-hits/connectInfiniteHits.js +3 -0
- package/es/connectors/infinite-hits/connectInfiniteHitsWithInsights.d.ts +1 -0
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/middlewares/createRouterMiddleware.js +2 -1
- package/es/widgets/hits/hits.d.ts +4 -19
- package/es/widgets/infinite-hits/infinite-hits.d.ts +1 -0
- package/package.json +7 -7
|
@@ -139,6 +139,7 @@ var connectInfiniteHits = function connectInfiniteHits(renderFn) {
|
|
|
139
139
|
});
|
|
140
140
|
},
|
|
141
141
|
getWidgetRenderState: function getWidgetRenderState(_ref6) {
|
|
142
|
+
var _results$renderingCon, _results$renderingCon2, _results$renderingCon3;
|
|
142
143
|
var results = _ref6.results,
|
|
143
144
|
helper = _ref6.helper,
|
|
144
145
|
parent = _ref6.parent,
|
|
@@ -155,6 +156,7 @@ var connectInfiniteHits = function connectInfiniteHits(renderFn) {
|
|
|
155
156
|
var cachedHits = cache.read({
|
|
156
157
|
state: normalizeState(state)
|
|
157
158
|
}) || {};
|
|
159
|
+
var banner = results === null || results === void 0 ? void 0 : (_results$renderingCon = results.renderingContent) === null || _results$renderingCon === void 0 ? void 0 : (_results$renderingCon2 = _results$renderingCon.widgets) === null || _results$renderingCon2 === void 0 ? void 0 : (_results$renderingCon3 = _results$renderingCon2.banners) === null || _results$renderingCon3 === void 0 ? void 0 : _results$renderingCon3[0];
|
|
158
160
|
if (!results) {
|
|
159
161
|
showPrevious = getShowPrevious(helper);
|
|
160
162
|
showMore = getShowMore(helper);
|
|
@@ -219,6 +221,7 @@ var connectInfiniteHits = function connectInfiniteHits(renderFn) {
|
|
|
219
221
|
currentPageHits: currentPageHits,
|
|
220
222
|
sendEvent: sendEvent,
|
|
221
223
|
bindEvent: bindEvent,
|
|
224
|
+
banner: banner,
|
|
222
225
|
results: results,
|
|
223
226
|
showPrevious: showPrevious,
|
|
224
227
|
showMore: showMore,
|
package/cjs/lib/version.js
CHANGED
|
@@ -57,6 +57,7 @@ var createRouterMiddleware = function createRouterMiddleware() {
|
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
subscribe: function subscribe() {
|
|
60
|
+
process.env.NODE_ENV === 'development' ? (0, _utils.warning)(Object.keys(initialUiState).length === 0, 'Using `initialUiState` together with routing is not recommended. The `initialUiState` will be overwritten by the URL parameters.') : void 0;
|
|
60
61
|
instantSearchInstance._initialUiState = _objectSpread(_objectSpread({}, initialUiState), stateMapping.routeToState(router.read()));
|
|
61
62
|
router.onUpdate(function (route) {
|
|
62
63
|
if (instantSearchInstance.mainIndex.getWidgets().length > 0) {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/// <reference types="googlemaps" />
|
|
3
3
|
|
|
4
4
|
import { AlgoliaSearchHelper } from 'algoliasearch-helper';
|
|
5
|
+
import { Banner } from 'algoliasearch-helper';
|
|
5
6
|
import EventEmitter from '@algolia/events';
|
|
6
7
|
import { FindAnswersOptions } from 'algoliasearch-helper/types/algoliasearch.js';
|
|
7
8
|
import type { FrequentlyBoughtTogetherProps } from 'instantsearch-ui-components';
|
|
@@ -311,8 +312,6 @@ declare type AutocompleteWidgetDescription = {
|
|
|
311
312
|
};
|
|
312
313
|
};
|
|
313
314
|
|
|
314
|
-
declare type Banner = NonNullable<NonNullable<Required<SearchResults<Hit>['renderingContent']>>['widgets']['banners']>[number];
|
|
315
|
-
|
|
316
315
|
declare type BaseHit = Record<string, any>;
|
|
317
316
|
|
|
318
317
|
declare type BindEventForHits = BuiltInBindEventForHits & CustomBindEventForHits;
|
|
@@ -893,18 +892,7 @@ declare const connectHitsWithInsights: <TWidgetParams>(renderFn: Renderer<HitsRe
|
|
|
893
892
|
hits: Hit<BaseHit>[] | Hit<THit>[];
|
|
894
893
|
items: Hit<BaseHit>[] | Hit<THit>[];
|
|
895
894
|
results: SearchResults<any>;
|
|
896
|
-
banner:
|
|
897
|
-
image: {
|
|
898
|
-
urls: {
|
|
899
|
-
url: string;
|
|
900
|
-
}[];
|
|
901
|
-
title?: string | undefined;
|
|
902
|
-
};
|
|
903
|
-
link?: {
|
|
904
|
-
url: string;
|
|
905
|
-
target?: "_blank" | "_self" | undefined;
|
|
906
|
-
} | undefined;
|
|
907
|
-
} | undefined;
|
|
895
|
+
banner: Banner | undefined;
|
|
908
896
|
sendEvent: SendEventForHits;
|
|
909
897
|
bindEvent: BindEventForHits;
|
|
910
898
|
widgetParams: TWidgetParams & HitsConnectorParams<THit>;
|
|
@@ -1077,6 +1065,7 @@ declare const connectInfiniteHitsWithInsights: <TWidgetParams extends object>(re
|
|
|
1077
1065
|
currentPageHits: Hit<THit>[];
|
|
1078
1066
|
sendEvent: SendEventForHits;
|
|
1079
1067
|
bindEvent: BindEventForHits;
|
|
1068
|
+
banner: Banner | undefined;
|
|
1080
1069
|
results: SearchResults<any> | undefined;
|
|
1081
1070
|
showPrevious: () => void;
|
|
1082
1071
|
showMore: () => void;
|
|
@@ -1613,18 +1602,7 @@ declare const _default: <TWidgetParams>(renderFn: Renderer<HitsRenderState<BaseH
|
|
|
1613
1602
|
hits: Hit<BaseHit>[] | Hit<THit>[];
|
|
1614
1603
|
items: Hit<BaseHit>[] | Hit<THit>[];
|
|
1615
1604
|
results: SearchResults<any>;
|
|
1616
|
-
banner:
|
|
1617
|
-
image: {
|
|
1618
|
-
urls: {
|
|
1619
|
-
url: string;
|
|
1620
|
-
}[];
|
|
1621
|
-
title?: string | undefined;
|
|
1622
|
-
};
|
|
1623
|
-
link?: {
|
|
1624
|
-
url: string;
|
|
1625
|
-
target?: "_blank" | "_self" | undefined;
|
|
1626
|
-
} | undefined;
|
|
1627
|
-
} | undefined;
|
|
1605
|
+
banner: Banner | undefined;
|
|
1628
1606
|
sendEvent: SendEventForHits;
|
|
1629
1607
|
bindEvent: BindEventForHits;
|
|
1630
1608
|
widgetParams: TWidgetParams & HitsConnectorParams<THit>;
|
|
@@ -1803,6 +1781,7 @@ declare const _default_10: <THit extends object = BaseHit>(widgetParams: Infinit
|
|
|
1803
1781
|
currentPageHits: Hit<THit>[];
|
|
1804
1782
|
sendEvent: SendEventForHits;
|
|
1805
1783
|
bindEvent: BindEventForHits;
|
|
1784
|
+
banner: Banner | undefined;
|
|
1806
1785
|
results: SearchResults<any> | undefined;
|
|
1807
1786
|
showPrevious: () => void;
|
|
1808
1787
|
showMore: () => void;
|
|
@@ -3185,6 +3164,7 @@ declare const _default_2: <TWidgetParams extends object>(renderFn: Renderer<Infi
|
|
|
3185
3164
|
currentPageHits: Hit<THit>[];
|
|
3186
3165
|
sendEvent: SendEventForHits;
|
|
3187
3166
|
bindEvent: BindEventForHits;
|
|
3167
|
+
banner: Banner | undefined;
|
|
3188
3168
|
results: SearchResults<any> | undefined;
|
|
3189
3169
|
showPrevious: () => void;
|
|
3190
3170
|
showMore: () => void;
|
|
@@ -5192,11 +5172,7 @@ declare const _default_9: <THit extends object = BaseHit>(widgetParams: HitsWidg
|
|
|
5192
5172
|
getWidgetRenderState({ results, helper, instantSearchInstance }: InitOptions | RenderOptions): {
|
|
5193
5173
|
hits: never[];
|
|
5194
5174
|
items: never[];
|
|
5195
|
-
results: undefined;
|
|
5196
|
-
* Template to use for each result. This template will receive an object containing a single record.
|
|
5197
|
-
*
|
|
5198
|
-
* @default ''
|
|
5199
|
-
*/
|
|
5175
|
+
results: undefined;
|
|
5200
5176
|
banner: undefined;
|
|
5201
5177
|
sendEvent: SendEventForHits;
|
|
5202
5178
|
bindEvent: BindEventForHits;
|
|
@@ -5205,22 +5181,11 @@ declare const _default_9: <THit extends object = BaseHit>(widgetParams: HitsWidg
|
|
|
5205
5181
|
hits: Hit<BaseHit>[] | Hit<THit>[];
|
|
5206
5182
|
items: Hit<BaseHit>[] | Hit<THit>[];
|
|
5207
5183
|
results: SearchResults<any>;
|
|
5184
|
+
banner: Banner | undefined;
|
|
5185
|
+
sendEvent: SendEventForHits;
|
|
5208
5186
|
/**
|
|
5209
|
-
*
|
|
5187
|
+
* Templates to use for the widget.
|
|
5210
5188
|
*/
|
|
5211
|
-
banner: {
|
|
5212
|
-
image: {
|
|
5213
|
-
urls: {
|
|
5214
|
-
url: string;
|
|
5215
|
-
}[];
|
|
5216
|
-
title?: string | undefined;
|
|
5217
|
-
};
|
|
5218
|
-
link?: {
|
|
5219
|
-
url: string;
|
|
5220
|
-
target?: "_blank" | "_self" | undefined;
|
|
5221
|
-
} | undefined;
|
|
5222
|
-
} | undefined;
|
|
5223
|
-
sendEvent: SendEventForHits;
|
|
5224
5189
|
bindEvent: BindEventForHits;
|
|
5225
5190
|
widgetParams: Partial<HitsWidgetParams<BaseHit>> & HitsConnectorParams<THit>;
|
|
5226
5191
|
};
|
|
@@ -6451,6 +6416,10 @@ declare type InfiniteHitsRenderState<THit extends NonNullable<object> = BaseHit>
|
|
|
6451
6416
|
* The response from the Algolia API.
|
|
6452
6417
|
*/
|
|
6453
6418
|
results?: SearchResults<Hit<THit>>;
|
|
6419
|
+
/**
|
|
6420
|
+
* The banner to display above the hits.
|
|
6421
|
+
*/
|
|
6422
|
+
banner?: Banner;
|
|
6454
6423
|
};
|
|
6455
6424
|
|
|
6456
6425
|
declare type InfiniteHitsTemplates<THit extends NonNullable<object> = BaseHit> = Partial<{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! InstantSearch.js 4.
|
|
1
|
+
/*! InstantSearch.js 4.72.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
|
|
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) :
|
|
@@ -3231,6 +3231,7 @@
|
|
|
3231
3231
|
});
|
|
3232
3232
|
},
|
|
3233
3233
|
getWidgetRenderState: function getWidgetRenderState(_ref6) {
|
|
3234
|
+
var _results$renderingCon, _results$renderingCon2, _results$renderingCon3;
|
|
3234
3235
|
var results = _ref6.results,
|
|
3235
3236
|
helper = _ref6.helper,
|
|
3236
3237
|
parent = _ref6.parent,
|
|
@@ -3247,6 +3248,7 @@
|
|
|
3247
3248
|
var cachedHits = cache.read({
|
|
3248
3249
|
state: normalizeState(state)
|
|
3249
3250
|
}) || {};
|
|
3251
|
+
var banner = results === null || results === void 0 ? void 0 : (_results$renderingCon = results.renderingContent) === null || _results$renderingCon === void 0 ? void 0 : (_results$renderingCon2 = _results$renderingCon.widgets) === null || _results$renderingCon2 === void 0 ? void 0 : (_results$renderingCon3 = _results$renderingCon2.banners) === null || _results$renderingCon3 === void 0 ? void 0 : _results$renderingCon3[0];
|
|
3250
3252
|
if (!results) {
|
|
3251
3253
|
showPrevious = getShowPrevious(helper);
|
|
3252
3254
|
showMore = getShowMore(helper);
|
|
@@ -3311,6 +3313,7 @@
|
|
|
3311
3313
|
currentPageHits: currentPageHits,
|
|
3312
3314
|
sendEvent: sendEvent,
|
|
3313
3315
|
bindEvent: bindEvent,
|
|
3316
|
+
banner: banner,
|
|
3314
3317
|
results: results,
|
|
3315
3318
|
showPrevious: showPrevious,
|
|
3316
3319
|
showMore: showMore,
|
|
@@ -10078,8 +10081,9 @@
|
|
|
10078
10081
|
function sortViaFacetOrdering(facetValues, facetOrdering) {
|
|
10079
10082
|
var orderedFacets = [];
|
|
10080
10083
|
var remainingFacets = [];
|
|
10081
|
-
|
|
10084
|
+
var hide = facetOrdering.hide || [];
|
|
10082
10085
|
var order = facetOrdering.order || [];
|
|
10086
|
+
|
|
10083
10087
|
/**
|
|
10084
10088
|
* an object with the keys being the values in order, the values their index:
|
|
10085
10089
|
* ['one', 'two'] -> { one: 0, two: 1 }
|
|
@@ -10092,9 +10096,10 @@
|
|
|
10092
10096
|
facetValues.forEach(function (item) {
|
|
10093
10097
|
// hierarchical facets get sorted using their raw name
|
|
10094
10098
|
var name = item.path || item.name;
|
|
10095
|
-
|
|
10099
|
+
var hidden = hide.indexOf(name) > -1;
|
|
10100
|
+
if (!hidden && reverseOrder[name] !== undefined) {
|
|
10096
10101
|
orderedFacets[reverseOrder[name]] = item;
|
|
10097
|
-
} else {
|
|
10102
|
+
} else if (!hidden) {
|
|
10098
10103
|
remainingFacets.push(item);
|
|
10099
10104
|
}
|
|
10100
10105
|
});
|
|
@@ -10480,7 +10485,7 @@
|
|
|
10480
10485
|
|
|
10481
10486
|
var sortAndMergeRecommendations_1 = sortAndMergeRecommendations;
|
|
10482
10487
|
|
|
10483
|
-
var version = '3.
|
|
10488
|
+
var version = '3.22.0';
|
|
10484
10489
|
|
|
10485
10490
|
var escapeFacetValue$4 = escapeFacetValue_1.escapeFacetValue;
|
|
10486
10491
|
|
|
@@ -15290,6 +15295,7 @@
|
|
|
15290
15295
|
}
|
|
15291
15296
|
},
|
|
15292
15297
|
subscribe: function subscribe() {
|
|
15298
|
+
_warning(Object.keys(initialUiState).length === 0, 'Using `initialUiState` together with routing is not recommended. The `initialUiState` will be overwritten by the URL parameters.') ;
|
|
15293
15299
|
instantSearchInstance._initialUiState = _objectSpread2(_objectSpread2({}, initialUiState), stateMapping.routeToState(router.read()));
|
|
15294
15300
|
router.onUpdate(function (route) {
|
|
15295
15301
|
if (instantSearchInstance.mainIndex.getWidgets().length > 0) {
|
|
@@ -23982,7 +23988,7 @@
|
|
|
23982
23988
|
};
|
|
23983
23989
|
}
|
|
23984
23990
|
|
|
23985
|
-
var version$1 = '4.
|
|
23991
|
+
var version$1 = '4.72.0';
|
|
23986
23992
|
|
|
23987
23993
|
var withUsage$10 = createDocumentationMessageGenerator({
|
|
23988
23994
|
name: 'instantsearch'
|