instantsearch.js 4.56.8 → 4.56.9
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/components/RefinementList/RefinementList.js +17 -0
- package/cjs/components/Slider/Rheostat.js +7 -1
- package/cjs/connectors/breadcrumb/connectBreadcrumb.js +1 -1
- package/cjs/connectors/configure/connectConfigure.js +4 -0
- package/cjs/connectors/hits/connectHitsWithInsights.js +5 -0
- package/cjs/connectors/infinite-hits/connectInfiniteHitsWithInsights.js +5 -0
- package/cjs/connectors/pagination/connectPagination.js +1 -1
- package/cjs/connectors/range/connectRange.js +3 -0
- package/cjs/connectors/search-box/connectSearchBox.js +10 -0
- package/cjs/lib/InstantSearch.js +10 -9
- package/cjs/lib/routers/history.js +34 -42
- package/cjs/lib/version.js +1 -1
- package/cjs/widgets/configure/configure.js +5 -0
- package/cjs/widgets/geo-search/createHTMLMarker.js +1 -1
- package/cjs/widgets/geo-search/geo-search.js +2 -1
- package/cjs/widgets/places/places.js +0 -2
- package/dist/instantsearch.development.js +100 -57
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/components/RefinementList/RefinementList.js +18 -0
- package/es/components/Slider/Rheostat.js +2 -0
- package/es/connectors/breadcrumb/connectBreadcrumb.js +1 -1
- package/es/connectors/configure/connectConfigure.js +5 -0
- package/es/connectors/hits/connectHitsWithInsights.js +6 -0
- package/es/connectors/infinite-hits/connectInfiniteHitsWithInsights.js +6 -0
- package/es/connectors/pagination/connectPagination.js +1 -1
- package/es/connectors/range/connectRange.js +3 -0
- package/es/connectors/search-box/connectSearchBox.js +10 -0
- package/es/lib/InstantSearch.js +10 -9
- package/es/lib/routers/history.js +34 -42
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/widgets/configure/configure.js +6 -0
- package/es/widgets/places/places.js +0 -2
- package/package.json +5 -5
|
@@ -24,6 +24,9 @@ import { isSpecialClick, isEqual } from "../../lib/utils/index.js";
|
|
|
24
24
|
import SearchBox from "../SearchBox/SearchBox.js";
|
|
25
25
|
import Template from "../Template/Template.js";
|
|
26
26
|
import RefinementListItem from "./RefinementListItem.js";
|
|
27
|
+
|
|
28
|
+
// CSS types
|
|
29
|
+
|
|
27
30
|
var defaultProps = {
|
|
28
31
|
cssClasses: {},
|
|
29
32
|
depth: 0
|
|
@@ -85,6 +88,21 @@ var RefinementList = /*#__PURE__*/function (_Component) {
|
|
|
85
88
|
templateProps: _this.props.templateProps
|
|
86
89
|
});
|
|
87
90
|
});
|
|
91
|
+
// Click events on DOM tree like LABEL > INPUT will result in two click events
|
|
92
|
+
// instead of one.
|
|
93
|
+
// No matter the framework, see https://www.google.com/search?q=click+label+twice
|
|
94
|
+
//
|
|
95
|
+
// Thus making it hard to distinguish activation from deactivation because both click events
|
|
96
|
+
// are very close. Debounce is a solution but hacky.
|
|
97
|
+
//
|
|
98
|
+
// So the code here checks if the click was done on or in a LABEL. If this LABEL
|
|
99
|
+
// has a checkbox inside, we ignore the first click event because we will get another one.
|
|
100
|
+
//
|
|
101
|
+
// We also check if the click was done inside a link and then e.preventDefault() because we already
|
|
102
|
+
// handle the url
|
|
103
|
+
//
|
|
104
|
+
// Finally, we always stop propagation of the event to avoid multiple levels RefinementLists to fail: click
|
|
105
|
+
// on child would click on parent also
|
|
88
106
|
_defineProperty(_assertThisInitialized(_this), "handleItemClick", function (_ref) {
|
|
89
107
|
var facetValueToRefine = _ref.facetValueToRefine,
|
|
90
108
|
isRefined = _ref.isRefined,
|
|
@@ -392,6 +392,8 @@ var Rheostat = /*#__PURE__*/function (_Component) {
|
|
|
392
392
|
}
|
|
393
393
|
killEvent(ev);
|
|
394
394
|
});
|
|
395
|
+
// Make sure the proposed position respects the bounds and
|
|
396
|
+
// does not collide with other handles too much.
|
|
395
397
|
_defineProperty(_assertThisInitialized(_this), "validatePosition", function (idx, proposedPosition) {
|
|
396
398
|
var _this$state4 = _this.state,
|
|
397
399
|
handlePos = _this$state4.handlePos,
|
|
@@ -75,7 +75,7 @@ var connectBreadcrumb = function connectBreadcrumb(renderFn) {
|
|
|
75
75
|
function getItems() {
|
|
76
76
|
// The hierarchicalFacets condition is required for flavors
|
|
77
77
|
// that render immediately with empty results, without relying
|
|
78
|
-
// on init() (like React InstantSearch
|
|
78
|
+
// on init() (like React InstantSearch).
|
|
79
79
|
if (!results || state.hierarchicalFacets.length === 0) {
|
|
80
80
|
return [];
|
|
81
81
|
}
|
|
@@ -6,6 +6,11 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
6
6
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
7
|
import algoliasearchHelper from 'algoliasearch-helper';
|
|
8
8
|
import { createDocumentationMessageGenerator, isPlainObject, mergeSearchParameters, noop } from "../../lib/utils/index.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Refine the given search parameters.
|
|
12
|
+
*/
|
|
13
|
+
|
|
9
14
|
var withUsage = createDocumentationMessageGenerator({
|
|
10
15
|
name: 'configure',
|
|
11
16
|
connector: true
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { withInsights } from "../../lib/insights/index.js";
|
|
2
2
|
import connectHits from "./connectHits.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Due to https://github.com/microsoft/web-build-tools/issues/1050, we need
|
|
6
|
+
* Connector<...> imported in this file, even though it is only used implicitly.
|
|
7
|
+
* This _uses_ Connector<...> so it is not accidentally removed by someone.
|
|
8
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3
9
|
var connectHitsWithInsights = withInsights(connectHits);
|
|
4
10
|
export default connectHitsWithInsights;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { withInsights } from "../../lib/insights/index.js";
|
|
2
2
|
import connectInfiniteHits from "./connectInfiniteHits.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Due to https://github.com/microsoft/web-build-tools/issues/1050, we need
|
|
6
|
+
* Connector<...> imported in this file, even though it is only used implicitly.
|
|
7
|
+
* This _uses_ Connector<...> so it is not accidentally removed by someone.
|
|
8
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3
9
|
var connectInfiniteHitsWithInsights = withInsights(connectInfiniteHits);
|
|
4
10
|
export default connectInfiniteHitsWithInsights;
|
|
@@ -84,7 +84,7 @@ var connectPagination = function connectPagination(renderFn) {
|
|
|
84
84
|
connectorState.createURL = function (page) {
|
|
85
85
|
return createURL(function (uiState) {
|
|
86
86
|
return _objectSpread(_objectSpread({}, uiState), {}, {
|
|
87
|
-
page: page
|
|
87
|
+
page: page + 1
|
|
88
88
|
});
|
|
89
89
|
});
|
|
90
90
|
};
|
|
@@ -9,6 +9,16 @@ var withUsage = createDocumentationMessageGenerator({
|
|
|
9
9
|
name: 'search-box',
|
|
10
10
|
connector: true
|
|
11
11
|
});
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {Object} CustomSearchBoxWidgetParams
|
|
15
|
+
* @property {function(string, function(string))} [queryHook = undefined] A function that will be called every time
|
|
16
|
+
* a new value for the query is set. The first parameter is the query and the second is a
|
|
17
|
+
* function to actually trigger the search. The function takes the query as the parameter.
|
|
18
|
+
*
|
|
19
|
+
* This queryHook can be used to debounce the number of searches done from the searchBox.
|
|
20
|
+
*/
|
|
21
|
+
|
|
12
22
|
var defaultQueryHook = function defaultQueryHook(query, hook) {
|
|
13
23
|
return hook(query);
|
|
14
24
|
};
|
package/es/lib/InstantSearch.js
CHANGED
|
@@ -33,6 +33,9 @@ function defaultCreateURL() {
|
|
|
33
33
|
// this purposely breaks typescript's type inference to ensure it's not used
|
|
34
34
|
// as it's used for a default parameter for example
|
|
35
35
|
// source: https://github.com/Microsoft/TypeScript/issues/14829#issuecomment-504042546
|
|
36
|
+
/**
|
|
37
|
+
* Global options for an InstantSearch instance.
|
|
38
|
+
*/
|
|
36
39
|
/**
|
|
37
40
|
* The actual implementation of the InstantSearch. This is
|
|
38
41
|
* created using the `instantsearch` factory function.
|
|
@@ -66,7 +69,14 @@ var InstantSearch = /*#__PURE__*/function (_EventEmitter) {
|
|
|
66
69
|
_defineProperty(_assertThisInitialized(_this), "_mainHelperSearch", void 0);
|
|
67
70
|
_defineProperty(_assertThisInitialized(_this), "middleware", []);
|
|
68
71
|
_defineProperty(_assertThisInitialized(_this), "sendEventToInsights", void 0);
|
|
72
|
+
/**
|
|
73
|
+
* The status of the search. Can be "idle", "loading", "stalled", or "error".
|
|
74
|
+
*/
|
|
69
75
|
_defineProperty(_assertThisInitialized(_this), "status", 'idle');
|
|
76
|
+
/**
|
|
77
|
+
* The last returned error from the Search API.
|
|
78
|
+
* The error gets cleared when the next valid search response is rendered.
|
|
79
|
+
*/
|
|
70
80
|
_defineProperty(_assertThisInitialized(_this), "error", undefined);
|
|
71
81
|
_defineProperty(_assertThisInitialized(_this), "scheduleSearch", defer(function () {
|
|
72
82
|
if (_this.started) {
|
|
@@ -186,15 +196,6 @@ var InstantSearch = /*#__PURE__*/function (_EventEmitter) {
|
|
|
186
196
|
_createClass(InstantSearch, [{
|
|
187
197
|
key: "_isSearchStalled",
|
|
188
198
|
get:
|
|
189
|
-
/**
|
|
190
|
-
* The status of the search. Can be "idle", "loading", "stalled", or "error".
|
|
191
|
-
*/
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* The last returned error from the Search API.
|
|
195
|
-
* The error gets cleared when the next valid search response is rendered.
|
|
196
|
-
*/
|
|
197
|
-
|
|
198
199
|
/**
|
|
199
200
|
* @deprecated use `status === 'stalled'` instead
|
|
200
201
|
*/
|
|
@@ -15,48 +15,6 @@ var setWindowTitle = function setWindowTitle(title) {
|
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
var BrowserHistory = /*#__PURE__*/function () {
|
|
18
|
-
/**
|
|
19
|
-
* Transforms a UI state into a title for the page.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Time in milliseconds before performing a write in the history.
|
|
24
|
-
* It prevents from adding too many entries in the history and
|
|
25
|
-
* makes the back button more usable.
|
|
26
|
-
*
|
|
27
|
-
* @default 400
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Creates a full URL based on the route state.
|
|
32
|
-
* The storage adaptor maps all syncable keys to the query string of the URL.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Parses the URL into a route state.
|
|
37
|
-
* It should be symmetrical to `createURL`.
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Returns the location to store in the history.
|
|
42
|
-
* @default () => window.location
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Indicates if last action was back/forward in the browser.
|
|
47
|
-
*/
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Indicates whether the history router is disposed or not.
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Indicates the window.history.length before the last call to
|
|
55
|
-
* window.history.pushState (called in `write`).
|
|
56
|
-
* It allows to determine if a `pushState` has been triggered elsewhere,
|
|
57
|
-
* and thus to prevent the `write` method from calling `pushState`.
|
|
58
|
-
*/
|
|
59
|
-
|
|
60
18
|
/**
|
|
61
19
|
* Initializes a new storage provider that syncs the search state to the URL
|
|
62
20
|
* using web APIs (`window.location.pushState` and `onpopstate` event).
|
|
@@ -74,15 +32,49 @@ var BrowserHistory = /*#__PURE__*/function () {
|
|
|
74
32
|
push = _ref.push;
|
|
75
33
|
_classCallCheck(this, BrowserHistory);
|
|
76
34
|
_defineProperty(this, "$$type", 'ais.browser');
|
|
35
|
+
/**
|
|
36
|
+
* Transforms a UI state into a title for the page.
|
|
37
|
+
*/
|
|
77
38
|
_defineProperty(this, "windowTitle", void 0);
|
|
39
|
+
/**
|
|
40
|
+
* Time in milliseconds before performing a write in the history.
|
|
41
|
+
* It prevents from adding too many entries in the history and
|
|
42
|
+
* makes the back button more usable.
|
|
43
|
+
*
|
|
44
|
+
* @default 400
|
|
45
|
+
*/
|
|
78
46
|
_defineProperty(this, "writeDelay", void 0);
|
|
47
|
+
/**
|
|
48
|
+
* Creates a full URL based on the route state.
|
|
49
|
+
* The storage adaptor maps all syncable keys to the query string of the URL.
|
|
50
|
+
*/
|
|
79
51
|
_defineProperty(this, "_createURL", void 0);
|
|
52
|
+
/**
|
|
53
|
+
* Parses the URL into a route state.
|
|
54
|
+
* It should be symmetrical to `createURL`.
|
|
55
|
+
*/
|
|
80
56
|
_defineProperty(this, "parseURL", void 0);
|
|
57
|
+
/**
|
|
58
|
+
* Returns the location to store in the history.
|
|
59
|
+
* @default () => window.location
|
|
60
|
+
*/
|
|
81
61
|
_defineProperty(this, "getLocation", void 0);
|
|
82
62
|
_defineProperty(this, "writeTimer", void 0);
|
|
83
63
|
_defineProperty(this, "_onPopState", void 0);
|
|
64
|
+
/**
|
|
65
|
+
* Indicates if last action was back/forward in the browser.
|
|
66
|
+
*/
|
|
84
67
|
_defineProperty(this, "inPopState", false);
|
|
68
|
+
/**
|
|
69
|
+
* Indicates whether the history router is disposed or not.
|
|
70
|
+
*/
|
|
85
71
|
_defineProperty(this, "isDisposed", false);
|
|
72
|
+
/**
|
|
73
|
+
* Indicates the window.history.length before the last call to
|
|
74
|
+
* window.history.pushState (called in `write`).
|
|
75
|
+
* It allows to determine if a `pushState` has been triggered elsewhere,
|
|
76
|
+
* and thus to prevent the `write` method from calling `pushState`.
|
|
77
|
+
*/
|
|
86
78
|
_defineProperty(this, "latestAcknowledgedHistory", 0);
|
|
87
79
|
_defineProperty(this, "_start", void 0);
|
|
88
80
|
_defineProperty(this, "_dispose", void 0);
|
package/es/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "4.56.
|
|
1
|
+
declare const _default: "4.56.9";
|
|
2
2
|
export default _default;
|
package/es/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '4.56.
|
|
1
|
+
export default '4.56.9';
|
|
@@ -6,6 +6,12 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
6
6
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
7
|
import connectConfigure from "../../connectors/configure/connectConfigure.js";
|
|
8
8
|
import { noop } from "../../lib/utils/index.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A list of [search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters/)
|
|
12
|
+
* to enable when the widget mounts.
|
|
13
|
+
*/
|
|
14
|
+
|
|
9
15
|
var configure = function configure(widgetParams) {
|
|
10
16
|
// This is a renderless widget that falls back to the connector's
|
|
11
17
|
// noop render and unmount functions.
|
|
@@ -10,9 +10,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
10
10
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
11
|
/* Places.js is an optional dependency, no error should be reported if the package is missing */
|
|
12
12
|
/** @ts-ignore */
|
|
13
|
-
|
|
14
13
|
// using the type like this requires only one ts-ignore
|
|
15
|
-
|
|
16
14
|
/**
|
|
17
15
|
* This widget sets the geolocation value for the search based on the selected
|
|
18
16
|
* result in the Algolia Places autocomplete.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "instantsearch.js",
|
|
3
|
-
"version": "4.56.
|
|
3
|
+
"version": "4.56.9",
|
|
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.
|
|
58
|
+
"@instantsearch/mocks": "1.23.0",
|
|
59
|
+
"@instantsearch/tests": "1.23.0",
|
|
60
|
+
"@instantsearch/testutils": "1.12.0",
|
|
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": "94deb1ad0715410c61f4aa285a78a36ccf367fd7"
|
|
69
69
|
}
|