instantsearch.js 4.50.3 → 4.51.1
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/breadcrumb/connectBreadcrumb.js +2 -2
- package/cjs/lib/routers/history.js +31 -4
- package/cjs/lib/version.js +1 -1
- package/dist/instantsearch.development.d.ts +8 -2
- package/dist/instantsearch.development.js +35 -8
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +8 -2
- package/dist/instantsearch.production.min.d.ts +8 -2
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/connectors/breadcrumb/connectBreadcrumb.js +2 -2
- package/es/lib/routers/history.d.ts +9 -3
- package/es/lib/routers/history.js +31 -4
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/package.json +5 -5
|
@@ -81,8 +81,8 @@ var connectBreadcrumb = function connectBreadcrumb(renderFn) {
|
|
|
81
81
|
var _state$hierarchicalFa = _slicedToArray(state.hierarchicalFacets, 1),
|
|
82
82
|
facetName = _state$hierarchicalFa[0].name;
|
|
83
83
|
var facetValues = results.getFacetValues(facetName, {});
|
|
84
|
-
var
|
|
85
|
-
var items = transformItems(shiftItemsValues(prepareItems(
|
|
84
|
+
var facetItems = facetValues && !Array.isArray(facetValues) && facetValues.data ? facetValues.data : [];
|
|
85
|
+
var items = transformItems(shiftItemsValues(prepareItems(facetItems)), {
|
|
86
86
|
results: results
|
|
87
87
|
});
|
|
88
88
|
return items;
|
|
@@ -9,12 +9,15 @@ type ParseURL<TRouteState> = (args: {
|
|
|
9
9
|
qsModule: typeof qs;
|
|
10
10
|
location: Location;
|
|
11
11
|
}) => TRouteState;
|
|
12
|
-
type BrowserHistoryArgs<TRouteState> = {
|
|
12
|
+
export type BrowserHistoryArgs<TRouteState> = {
|
|
13
13
|
windowTitle?: (routeState: TRouteState) => string;
|
|
14
14
|
writeDelay: number;
|
|
15
15
|
createURL: CreateURL<TRouteState>;
|
|
16
16
|
parseURL: ParseURL<TRouteState>;
|
|
17
17
|
getLocation(): Location;
|
|
18
|
+
start?: (onUpdate: () => void) => void;
|
|
19
|
+
dispose?: () => void;
|
|
20
|
+
push?: (url: string) => void;
|
|
18
21
|
};
|
|
19
22
|
declare class BrowserHistory<TRouteState> implements Router<TRouteState> {
|
|
20
23
|
/**
|
|
@@ -61,11 +64,14 @@ declare class BrowserHistory<TRouteState> implements Router<TRouteState> {
|
|
|
61
64
|
* and thus to prevent the `write` method from calling `pushState`.
|
|
62
65
|
*/
|
|
63
66
|
private latestAcknowledgedHistory;
|
|
67
|
+
private _start?;
|
|
68
|
+
private _dispose?;
|
|
69
|
+
private _push?;
|
|
64
70
|
/**
|
|
65
71
|
* Initializes a new storage provider that syncs the search state to the URL
|
|
66
72
|
* using web APIs (`window.location.pushState` and `onpopstate` event).
|
|
67
73
|
*/
|
|
68
|
-
constructor({ windowTitle, writeDelay, createURL, parseURL, getLocation, }: BrowserHistoryArgs<TRouteState>);
|
|
74
|
+
constructor({ windowTitle, writeDelay, createURL, parseURL, getLocation, start, dispose, push, }: BrowserHistoryArgs<TRouteState>);
|
|
69
75
|
/**
|
|
70
76
|
* Reads the URL and returns a syncable UI search state.
|
|
71
77
|
*/
|
|
@@ -93,5 +99,5 @@ declare class BrowserHistory<TRouteState> implements Router<TRouteState> {
|
|
|
93
99
|
dispose(): void;
|
|
94
100
|
private shouldWrite;
|
|
95
101
|
}
|
|
96
|
-
export default function historyRouter<TRouteState = UiState>({ createURL, parseURL, writeDelay, windowTitle, getLocation, }?: Partial<BrowserHistoryArgs<TRouteState>>): BrowserHistory<TRouteState>;
|
|
102
|
+
export default function historyRouter<TRouteState = UiState>({ createURL, parseURL, writeDelay, windowTitle, getLocation, start, dispose, push, }?: Partial<BrowserHistoryArgs<TRouteState>>): BrowserHistory<TRouteState>;
|
|
97
103
|
export {};
|
|
@@ -26,7 +26,10 @@ var BrowserHistory = /*#__PURE__*/function () {
|
|
|
26
26
|
writeDelay = _ref$writeDelay === void 0 ? 400 : _ref$writeDelay,
|
|
27
27
|
createURL = _ref.createURL,
|
|
28
28
|
parseURL = _ref.parseURL,
|
|
29
|
-
getLocation = _ref.getLocation
|
|
29
|
+
getLocation = _ref.getLocation,
|
|
30
|
+
start = _ref.start,
|
|
31
|
+
dispose = _ref.dispose,
|
|
32
|
+
push = _ref.push;
|
|
30
33
|
_classCallCheck(this, BrowserHistory);
|
|
31
34
|
_defineProperty(this, "windowTitle", void 0);
|
|
32
35
|
_defineProperty(this, "writeDelay", void 0);
|
|
@@ -37,12 +40,18 @@ var BrowserHistory = /*#__PURE__*/function () {
|
|
|
37
40
|
_defineProperty(this, "inPopState", false);
|
|
38
41
|
_defineProperty(this, "isDisposed", false);
|
|
39
42
|
_defineProperty(this, "latestAcknowledgedHistory", 0);
|
|
43
|
+
_defineProperty(this, "_start", void 0);
|
|
44
|
+
_defineProperty(this, "_dispose", void 0);
|
|
45
|
+
_defineProperty(this, "_push", void 0);
|
|
40
46
|
this.windowTitle = windowTitle;
|
|
41
47
|
this.writeTimer = undefined;
|
|
42
48
|
this.writeDelay = writeDelay;
|
|
43
49
|
this._createURL = createURL;
|
|
44
50
|
this.parseURL = parseURL;
|
|
45
51
|
this.getLocation = getLocation;
|
|
52
|
+
this._start = start;
|
|
53
|
+
this._dispose = dispose;
|
|
54
|
+
this._push = push;
|
|
46
55
|
safelyRunOnBrowser(function (_ref2) {
|
|
47
56
|
var window = _ref2.window;
|
|
48
57
|
var title = _this.windowTitle && _this.windowTitle(_this.read());
|
|
@@ -80,7 +89,11 @@ var BrowserHistory = /*#__PURE__*/function () {
|
|
|
80
89
|
_this2.writeTimer = setTimeout(function () {
|
|
81
90
|
setWindowTitle(title);
|
|
82
91
|
if (_this2.shouldWrite(url)) {
|
|
83
|
-
|
|
92
|
+
if (_this2._push) {
|
|
93
|
+
_this2._push(url);
|
|
94
|
+
} else {
|
|
95
|
+
window.history.pushState(routeState, title || '', url);
|
|
96
|
+
}
|
|
84
97
|
_this2.latestAcknowledgedHistory = window.history.length;
|
|
85
98
|
}
|
|
86
99
|
_this2.inPopState = false;
|
|
@@ -97,6 +110,11 @@ var BrowserHistory = /*#__PURE__*/function () {
|
|
|
97
110
|
key: "onUpdate",
|
|
98
111
|
value: function onUpdate(callback) {
|
|
99
112
|
var _this3 = this;
|
|
113
|
+
if (this._start) {
|
|
114
|
+
this._start(function () {
|
|
115
|
+
callback(_this3.read());
|
|
116
|
+
});
|
|
117
|
+
}
|
|
100
118
|
this._onPopState = function () {
|
|
101
119
|
if (_this3.writeTimer) {
|
|
102
120
|
clearTimeout(_this3.writeTimer);
|
|
@@ -138,6 +156,9 @@ var BrowserHistory = /*#__PURE__*/function () {
|
|
|
138
156
|
key: "dispose",
|
|
139
157
|
value: function dispose() {
|
|
140
158
|
var _this4 = this;
|
|
159
|
+
if (this._dispose) {
|
|
160
|
+
this._dispose();
|
|
161
|
+
}
|
|
141
162
|
this.isDisposed = true;
|
|
142
163
|
safelyRunOnBrowser(function (_ref5) {
|
|
143
164
|
var window = _ref5.window;
|
|
@@ -229,12 +250,18 @@ export default function historyRouter() {
|
|
|
229
250
|
throw new Error('You need to provide `getLocation` to the `history` router in environments where `window` does not exist.');
|
|
230
251
|
}
|
|
231
252
|
});
|
|
232
|
-
} : _ref7$getLocation
|
|
253
|
+
} : _ref7$getLocation,
|
|
254
|
+
start = _ref7.start,
|
|
255
|
+
dispose = _ref7.dispose,
|
|
256
|
+
push = _ref7.push;
|
|
233
257
|
return new BrowserHistory({
|
|
234
258
|
createURL: createURL,
|
|
235
259
|
parseURL: parseURL,
|
|
236
260
|
writeDelay: writeDelay,
|
|
237
261
|
windowTitle: windowTitle,
|
|
238
|
-
getLocation: getLocation
|
|
262
|
+
getLocation: getLocation,
|
|
263
|
+
start: start,
|
|
264
|
+
dispose: dispose,
|
|
265
|
+
push: push
|
|
239
266
|
});
|
|
240
267
|
}
|
package/es/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "4.
|
|
1
|
+
declare const _default: "4.51.1";
|
|
2
2
|
export default _default;
|
package/es/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '4.
|
|
1
|
+
export default '4.51.1';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "instantsearch.js",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.51.1",
|
|
4
4
|
"description": "InstantSearch.js is a JavaScript library for building performant and instant search experiences with Algolia.",
|
|
5
5
|
"homepage": "https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/",
|
|
6
6
|
"types": "es/index.d.ts",
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
"version": "./scripts/version/update-version.js"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@instantsearch/mocks": "1.
|
|
59
|
-
"@instantsearch/tests": "1.
|
|
60
|
-
"@instantsearch/testutils": "1.0.
|
|
58
|
+
"@instantsearch/mocks": "1.6.0",
|
|
59
|
+
"@instantsearch/tests": "1.6.0",
|
|
60
|
+
"@instantsearch/testutils": "1.0.9",
|
|
61
61
|
"@storybook/html": "5.3.9",
|
|
62
62
|
"@types/scriptjs": "0.0.2",
|
|
63
63
|
"algoliasearch": "4.14.3",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"scriptjs": "2.5.9",
|
|
66
66
|
"webpack": "4.41.5"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "92fa2b8968301b75e345fb6f6233a72d0830018a"
|
|
69
69
|
}
|