instantsearch.js 4.56.8 → 4.56.10
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/server.js +11 -6
- 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/server.js +11 -6
- 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
|
@@ -31,6 +31,8 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
31
31
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
32
32
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
33
33
|
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); }
|
|
34
|
+
// CSS types
|
|
35
|
+
|
|
34
36
|
var defaultProps = {
|
|
35
37
|
cssClasses: {},
|
|
36
38
|
depth: 0
|
|
@@ -92,6 +94,21 @@ var RefinementList = /*#__PURE__*/function (_Component) {
|
|
|
92
94
|
templateProps: _this.props.templateProps
|
|
93
95
|
});
|
|
94
96
|
});
|
|
97
|
+
// Click events on DOM tree like LABEL > INPUT will result in two click events
|
|
98
|
+
// instead of one.
|
|
99
|
+
// No matter the framework, see https://www.google.com/search?q=click+label+twice
|
|
100
|
+
//
|
|
101
|
+
// Thus making it hard to distinguish activation from deactivation because both click events
|
|
102
|
+
// are very close. Debounce is a solution but hacky.
|
|
103
|
+
//
|
|
104
|
+
// So the code here checks if the click was done on or in a LABEL. If this LABEL
|
|
105
|
+
// has a checkbox inside, we ignore the first click event because we will get another one.
|
|
106
|
+
//
|
|
107
|
+
// We also check if the click was done inside a link and then e.preventDefault() because we already
|
|
108
|
+
// handle the url
|
|
109
|
+
//
|
|
110
|
+
// Finally, we always stop propagation of the event to avoid multiple levels RefinementLists to fail: click
|
|
111
|
+
// on child would click on parent also
|
|
95
112
|
_defineProperty(_assertThisInitialized(_this), "handleItemClick", function (_ref) {
|
|
96
113
|
var facetValueToRefine = _ref.facetValueToRefine,
|
|
97
114
|
isRefined = _ref.isRefined,
|
|
@@ -19,7 +19,11 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
19
19
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
20
20
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
21
21
|
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); }
|
|
22
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
22
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } /**
|
|
23
|
+
* This is a fork of Rheostat for Preact X.
|
|
24
|
+
*
|
|
25
|
+
* @see https://github.com/airbnb/rheostat
|
|
26
|
+
*/
|
|
23
27
|
var KEYS = {
|
|
24
28
|
DOWN: 40,
|
|
25
29
|
END: 35,
|
|
@@ -394,6 +398,8 @@ var Rheostat = /*#__PURE__*/function (_Component) {
|
|
|
394
398
|
}
|
|
395
399
|
killEvent(ev);
|
|
396
400
|
});
|
|
401
|
+
// Make sure the proposed position respects the bounds and
|
|
402
|
+
// does not collide with other handles too much.
|
|
397
403
|
_defineProperty(_assertThisInitialized(_this), "validatePosition", function (idx, proposedPosition) {
|
|
398
404
|
var _this$state4 = _this.state,
|
|
399
405
|
handlePos = _this$state4.handlePos,
|
|
@@ -81,7 +81,7 @@ var connectBreadcrumb = function connectBreadcrumb(renderFn) {
|
|
|
81
81
|
function getItems() {
|
|
82
82
|
// The hierarchicalFacets condition is required for flavors
|
|
83
83
|
// that render immediately with empty results, without relying
|
|
84
|
-
// on init() (like React InstantSearch
|
|
84
|
+
// on init() (like React InstantSearch).
|
|
85
85
|
if (!results || state.hierarchicalFacets.length === 0) {
|
|
86
86
|
return [];
|
|
87
87
|
}
|
|
@@ -13,6 +13,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
13
13
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
14
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
15
|
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); }
|
|
16
|
+
/**
|
|
17
|
+
* Refine the given search parameters.
|
|
18
|
+
*/
|
|
19
|
+
|
|
16
20
|
var withUsage = (0, _utils.createDocumentationMessageGenerator)({
|
|
17
21
|
name: 'configure',
|
|
18
22
|
connector: true
|
|
@@ -7,6 +7,11 @@ exports.default = void 0;
|
|
|
7
7
|
var _insights = require("../../lib/insights");
|
|
8
8
|
var _connectHits = _interopRequireDefault(require("./connectHits"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
/**
|
|
11
|
+
* Due to https://github.com/microsoft/web-build-tools/issues/1050, we need
|
|
12
|
+
* Connector<...> imported in this file, even though it is only used implicitly.
|
|
13
|
+
* This _uses_ Connector<...> so it is not accidentally removed by someone.
|
|
14
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10
15
|
var connectHitsWithInsights = (0, _insights.withInsights)(_connectHits.default);
|
|
11
16
|
var _default = connectHitsWithInsights;
|
|
12
17
|
exports.default = _default;
|
|
@@ -7,6 +7,11 @@ exports.default = void 0;
|
|
|
7
7
|
var _insights = require("../../lib/insights");
|
|
8
8
|
var _connectInfiniteHits = _interopRequireDefault(require("./connectInfiniteHits"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
/**
|
|
11
|
+
* Due to https://github.com/microsoft/web-build-tools/issues/1050, we need
|
|
12
|
+
* Connector<...> imported in this file, even though it is only used implicitly.
|
|
13
|
+
* This _uses_ Connector<...> so it is not accidentally removed by someone.
|
|
14
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10
15
|
var connectInfiniteHitsWithInsights = (0, _insights.withInsights)(_connectInfiniteHits.default);
|
|
11
16
|
var _default = connectInfiniteHitsWithInsights;
|
|
12
17
|
exports.default = _default;
|
|
@@ -91,7 +91,7 @@ var connectPagination = function connectPagination(renderFn) {
|
|
|
91
91
|
connectorState.createURL = function (page) {
|
|
92
92
|
return createURL(function (uiState) {
|
|
93
93
|
return _objectSpread(_objectSpread({}, uiState), {}, {
|
|
94
|
-
page: page
|
|
94
|
+
page: page + 1
|
|
95
95
|
});
|
|
96
96
|
});
|
|
97
97
|
};
|
|
@@ -25,6 +25,9 @@ var withUsage = (0, _utils.createDocumentationMessageGenerator)({
|
|
|
25
25
|
connector: true
|
|
26
26
|
});
|
|
27
27
|
var $$type = 'ais.range';
|
|
28
|
+
|
|
29
|
+
// @MAJOR: potentially we should consolidate these types
|
|
30
|
+
|
|
28
31
|
function toPrecision(_ref) {
|
|
29
32
|
var min = _ref.min,
|
|
30
33
|
max = _ref.max,
|
|
@@ -15,6 +15,16 @@ var withUsage = (0, _utils.createDocumentationMessageGenerator)({
|
|
|
15
15
|
name: 'search-box',
|
|
16
16
|
connector: true
|
|
17
17
|
});
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @typedef {Object} CustomSearchBoxWidgetParams
|
|
21
|
+
* @property {function(string, function(string))} [queryHook = undefined] A function that will be called every time
|
|
22
|
+
* a new value for the query is set. The first parameter is the query and the second is a
|
|
23
|
+
* function to actually trigger the search. The function takes the query as the parameter.
|
|
24
|
+
*
|
|
25
|
+
* This queryHook can be used to debounce the number of searches done from the searchBox.
|
|
26
|
+
*/
|
|
27
|
+
|
|
18
28
|
var defaultQueryHook = function defaultQueryHook(query, hook) {
|
|
19
29
|
return hook(query);
|
|
20
30
|
};
|
package/cjs/lib/InstantSearch.js
CHANGED
|
@@ -40,6 +40,9 @@ function defaultCreateURL() {
|
|
|
40
40
|
// this purposely breaks typescript's type inference to ensure it's not used
|
|
41
41
|
// as it's used for a default parameter for example
|
|
42
42
|
// source: https://github.com/Microsoft/TypeScript/issues/14829#issuecomment-504042546
|
|
43
|
+
/**
|
|
44
|
+
* Global options for an InstantSearch instance.
|
|
45
|
+
*/
|
|
43
46
|
/**
|
|
44
47
|
* The actual implementation of the InstantSearch. This is
|
|
45
48
|
* created using the `instantsearch` factory function.
|
|
@@ -73,7 +76,14 @@ var InstantSearch = /*#__PURE__*/function (_EventEmitter) {
|
|
|
73
76
|
_defineProperty(_assertThisInitialized(_this), "_mainHelperSearch", void 0);
|
|
74
77
|
_defineProperty(_assertThisInitialized(_this), "middleware", []);
|
|
75
78
|
_defineProperty(_assertThisInitialized(_this), "sendEventToInsights", void 0);
|
|
79
|
+
/**
|
|
80
|
+
* The status of the search. Can be "idle", "loading", "stalled", or "error".
|
|
81
|
+
*/
|
|
76
82
|
_defineProperty(_assertThisInitialized(_this), "status", 'idle');
|
|
83
|
+
/**
|
|
84
|
+
* The last returned error from the Search API.
|
|
85
|
+
* The error gets cleared when the next valid search response is rendered.
|
|
86
|
+
*/
|
|
77
87
|
_defineProperty(_assertThisInitialized(_this), "error", undefined);
|
|
78
88
|
_defineProperty(_assertThisInitialized(_this), "scheduleSearch", (0, _utils.defer)(function () {
|
|
79
89
|
if (_this.started) {
|
|
@@ -193,15 +203,6 @@ var InstantSearch = /*#__PURE__*/function (_EventEmitter) {
|
|
|
193
203
|
_createClass(InstantSearch, [{
|
|
194
204
|
key: "_isSearchStalled",
|
|
195
205
|
get:
|
|
196
|
-
/**
|
|
197
|
-
* The status of the search. Can be "idle", "loading", "stalled", or "error".
|
|
198
|
-
*/
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* The last returned error from the Search API.
|
|
202
|
-
* The error gets cleared when the next valid search response is rendered.
|
|
203
|
-
*/
|
|
204
|
-
|
|
205
206
|
/**
|
|
206
207
|
* @deprecated use `status === 'stalled'` instead
|
|
207
208
|
*/
|
|
@@ -22,48 +22,6 @@ var setWindowTitle = function setWindowTitle(title) {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
var BrowserHistory = /*#__PURE__*/function () {
|
|
25
|
-
/**
|
|
26
|
-
* Transforms a UI state into a title for the page.
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Time in milliseconds before performing a write in the history.
|
|
31
|
-
* It prevents from adding too many entries in the history and
|
|
32
|
-
* makes the back button more usable.
|
|
33
|
-
*
|
|
34
|
-
* @default 400
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Creates a full URL based on the route state.
|
|
39
|
-
* The storage adaptor maps all syncable keys to the query string of the URL.
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Parses the URL into a route state.
|
|
44
|
-
* It should be symmetrical to `createURL`.
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Returns the location to store in the history.
|
|
49
|
-
* @default () => window.location
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Indicates if last action was back/forward in the browser.
|
|
54
|
-
*/
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Indicates whether the history router is disposed or not.
|
|
58
|
-
*/
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Indicates the window.history.length before the last call to
|
|
62
|
-
* window.history.pushState (called in `write`).
|
|
63
|
-
* It allows to determine if a `pushState` has been triggered elsewhere,
|
|
64
|
-
* and thus to prevent the `write` method from calling `pushState`.
|
|
65
|
-
*/
|
|
66
|
-
|
|
67
25
|
/**
|
|
68
26
|
* Initializes a new storage provider that syncs the search state to the URL
|
|
69
27
|
* using web APIs (`window.location.pushState` and `onpopstate` event).
|
|
@@ -81,15 +39,49 @@ var BrowserHistory = /*#__PURE__*/function () {
|
|
|
81
39
|
push = _ref.push;
|
|
82
40
|
_classCallCheck(this, BrowserHistory);
|
|
83
41
|
_defineProperty(this, "$$type", 'ais.browser');
|
|
42
|
+
/**
|
|
43
|
+
* Transforms a UI state into a title for the page.
|
|
44
|
+
*/
|
|
84
45
|
_defineProperty(this, "windowTitle", void 0);
|
|
46
|
+
/**
|
|
47
|
+
* Time in milliseconds before performing a write in the history.
|
|
48
|
+
* It prevents from adding too many entries in the history and
|
|
49
|
+
* makes the back button more usable.
|
|
50
|
+
*
|
|
51
|
+
* @default 400
|
|
52
|
+
*/
|
|
85
53
|
_defineProperty(this, "writeDelay", void 0);
|
|
54
|
+
/**
|
|
55
|
+
* Creates a full URL based on the route state.
|
|
56
|
+
* The storage adaptor maps all syncable keys to the query string of the URL.
|
|
57
|
+
*/
|
|
86
58
|
_defineProperty(this, "_createURL", void 0);
|
|
59
|
+
/**
|
|
60
|
+
* Parses the URL into a route state.
|
|
61
|
+
* It should be symmetrical to `createURL`.
|
|
62
|
+
*/
|
|
87
63
|
_defineProperty(this, "parseURL", void 0);
|
|
64
|
+
/**
|
|
65
|
+
* Returns the location to store in the history.
|
|
66
|
+
* @default () => window.location
|
|
67
|
+
*/
|
|
88
68
|
_defineProperty(this, "getLocation", void 0);
|
|
89
69
|
_defineProperty(this, "writeTimer", void 0);
|
|
90
70
|
_defineProperty(this, "_onPopState", void 0);
|
|
71
|
+
/**
|
|
72
|
+
* Indicates if last action was back/forward in the browser.
|
|
73
|
+
*/
|
|
91
74
|
_defineProperty(this, "inPopState", false);
|
|
75
|
+
/**
|
|
76
|
+
* Indicates whether the history router is disposed or not.
|
|
77
|
+
*/
|
|
92
78
|
_defineProperty(this, "isDisposed", false);
|
|
79
|
+
/**
|
|
80
|
+
* Indicates the window.history.length before the last call to
|
|
81
|
+
* window.history.pushState (called in `write`).
|
|
82
|
+
* It allows to determine if a `pushState` has been triggered elsewhere,
|
|
83
|
+
* and thus to prevent the `write` method from calling `pushState`.
|
|
84
|
+
*/
|
|
93
85
|
_defineProperty(this, "latestAcknowledgedHistory", 0);
|
|
94
86
|
_defineProperty(this, "_start", void 0);
|
|
95
87
|
_defineProperty(this, "_dispose", void 0);
|
package/cjs/lib/server.js
CHANGED
|
@@ -49,12 +49,17 @@ function getInitialResults(rootIndex) {
|
|
|
49
49
|
var initialResults = {};
|
|
50
50
|
(0, _utils.walkIndex)(rootIndex, function (widget) {
|
|
51
51
|
var searchResults = widget.getResults();
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
if (searchResults) {
|
|
53
|
+
initialResults[widget.getIndexId()] = {
|
|
54
|
+
// We convert the Helper state to a plain object to pass parsable data
|
|
55
|
+
// structures from server to client.
|
|
56
|
+
state: _objectSpread({}, searchResults._state),
|
|
57
|
+
results: searchResults._rawResults
|
|
58
|
+
};
|
|
59
|
+
}
|
|
58
60
|
});
|
|
61
|
+
if (Object.keys(initialResults).length === 0) {
|
|
62
|
+
throw new Error('The root index does not have any results. Make sure you have at least one widget that provides results.');
|
|
63
|
+
}
|
|
59
64
|
return initialResults;
|
|
60
65
|
}
|
package/cjs/lib/version.js
CHANGED
|
@@ -13,6 +13,11 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
13
13
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
14
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
15
|
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); }
|
|
16
|
+
/**
|
|
17
|
+
* A list of [search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters/)
|
|
18
|
+
* to enable when the widget mounts.
|
|
19
|
+
*/
|
|
20
|
+
|
|
16
21
|
var configure = function configure(widgetParams) {
|
|
17
22
|
// This is a renderless widget that falls back to the connector's
|
|
18
23
|
// noop render and unmount functions.
|
|
@@ -18,7 +18,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
18
18
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
19
19
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
20
20
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
21
|
-
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); }
|
|
21
|
+
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); } /* global google EventListener */
|
|
22
22
|
var createHTMLMarker = function createHTMLMarker(googleReference) {
|
|
23
23
|
var HTMLMarker = /*#__PURE__*/function (_googleReference$maps) {
|
|
24
24
|
_inherits(HTMLMarker, _googleReference$maps);
|
|
@@ -16,7 +16,8 @@ var _defaultTemplates = _interopRequireDefault(require("./defaultTemplates"));
|
|
|
16
16
|
var _GeoSearchRenderer = _interopRequireDefault(require("./GeoSearchRenderer"));
|
|
17
17
|
var _excluded = ["initialZoom", "initialPosition", "templates", "cssClasses", "builtInMarker", "customHTMLMarker", "enableRefine", "enableClearMapRefinement", "enableRefineControl", "container", "googleReference"],
|
|
18
18
|
_excluded2 = ["item"],
|
|
19
|
-
_excluded3 = ["item"];
|
|
19
|
+
_excluded3 = ["item"]; // global for TypeScript alone
|
|
20
|
+
/* global google */
|
|
20
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
22
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
22
23
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -16,9 +16,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
16
16
|
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; }
|
|
17
17
|
/* Places.js is an optional dependency, no error should be reported if the package is missing */
|
|
18
18
|
/** @ts-ignore */
|
|
19
|
-
|
|
20
19
|
// using the type like this requires only one ts-ignore
|
|
21
|
-
|
|
22
20
|
/**
|
|
23
21
|
* This widget sets the geolocation value for the search based on the selected
|
|
24
22
|
* result in the Algolia Places autocomplete.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! InstantSearch.js 4.56.
|
|
1
|
+
/*! InstantSearch.js 4.56.10 | © 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) :
|
|
@@ -2803,6 +2803,11 @@
|
|
|
2803
2803
|
}
|
|
2804
2804
|
}
|
|
2805
2805
|
|
|
2806
|
+
/**
|
|
2807
|
+
* Due to https://github.com/microsoft/web-build-tools/issues/1050, we need
|
|
2808
|
+
* Connector<...> imported in this file, even though it is only used implicitly.
|
|
2809
|
+
* This _uses_ Connector<...> so it is not accidentally removed by someone.
|
|
2810
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2806
2811
|
var connectHitsWithInsights = withInsights(connectHits);
|
|
2807
2812
|
|
|
2808
2813
|
var withUsage$6 = createDocumentationMessageGenerator({
|
|
@@ -3187,6 +3192,11 @@
|
|
|
3187
3192
|
};
|
|
3188
3193
|
};
|
|
3189
3194
|
|
|
3195
|
+
/**
|
|
3196
|
+
* Due to https://github.com/microsoft/web-build-tools/issues/1050, we need
|
|
3197
|
+
* Connector<...> imported in this file, even though it is only used implicitly.
|
|
3198
|
+
* This _uses_ Connector<...> so it is not accidentally removed by someone.
|
|
3199
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3190
3200
|
var connectInfiniteHitsWithInsights = withInsights(connectInfiniteHits);
|
|
3191
3201
|
|
|
3192
3202
|
var _excluded$3 = ["name", "escapedValue", "path"];
|
|
@@ -3770,7 +3780,7 @@
|
|
|
3770
3780
|
connectorState.createURL = function (page) {
|
|
3771
3781
|
return createURL(function (uiState) {
|
|
3772
3782
|
return _objectSpread2(_objectSpread2({}, uiState), {}, {
|
|
3773
|
-
page: page
|
|
3783
|
+
page: page + 1
|
|
3774
3784
|
});
|
|
3775
3785
|
});
|
|
3776
3786
|
};
|
|
@@ -3811,6 +3821,9 @@
|
|
|
3811
3821
|
connector: true
|
|
3812
3822
|
});
|
|
3813
3823
|
var $$type$1 = 'ais.range';
|
|
3824
|
+
|
|
3825
|
+
// @MAJOR: potentially we should consolidate these types
|
|
3826
|
+
|
|
3814
3827
|
function toPrecision(_ref) {
|
|
3815
3828
|
var min = _ref.min,
|
|
3816
3829
|
max = _ref.max,
|
|
@@ -4351,6 +4364,16 @@
|
|
|
4351
4364
|
name: 'search-box',
|
|
4352
4365
|
connector: true
|
|
4353
4366
|
});
|
|
4367
|
+
|
|
4368
|
+
/**
|
|
4369
|
+
* @typedef {Object} CustomSearchBoxWidgetParams
|
|
4370
|
+
* @property {function(string, function(string))} [queryHook = undefined] A function that will be called every time
|
|
4371
|
+
* a new value for the query is set. The first parameter is the query and the second is a
|
|
4372
|
+
* function to actually trigger the search. The function takes the query as the parameter.
|
|
4373
|
+
*
|
|
4374
|
+
* This queryHook can be used to debounce the number of searches done from the searchBox.
|
|
4375
|
+
*/
|
|
4376
|
+
|
|
4354
4377
|
var defaultQueryHook = function defaultQueryHook(query, hook) {
|
|
4355
4378
|
return hook(query);
|
|
4356
4379
|
};
|
|
@@ -5221,7 +5244,7 @@
|
|
|
5221
5244
|
function getItems() {
|
|
5222
5245
|
// The hierarchicalFacets condition is required for flavors
|
|
5223
5246
|
// that render immediately with empty results, without relying
|
|
5224
|
-
// on init() (like React InstantSearch
|
|
5247
|
+
// on init() (like React InstantSearch).
|
|
5225
5248
|
if (!results || state.hierarchicalFacets.length === 0) {
|
|
5226
5249
|
return [];
|
|
5227
5250
|
}
|
|
@@ -11551,6 +11574,10 @@
|
|
|
11551
11574
|
|
|
11552
11575
|
var algoliasearchHelper_1 = algoliasearchHelper;
|
|
11553
11576
|
|
|
11577
|
+
/**
|
|
11578
|
+
* Refine the given search parameters.
|
|
11579
|
+
*/
|
|
11580
|
+
|
|
11554
11581
|
var withUsage$l = createDocumentationMessageGenerator({
|
|
11555
11582
|
name: 'configure',
|
|
11556
11583
|
connector: true
|
|
@@ -13662,48 +13689,6 @@
|
|
|
13662
13689
|
}
|
|
13663
13690
|
};
|
|
13664
13691
|
var BrowserHistory = /*#__PURE__*/function () {
|
|
13665
|
-
/**
|
|
13666
|
-
* Transforms a UI state into a title for the page.
|
|
13667
|
-
*/
|
|
13668
|
-
|
|
13669
|
-
/**
|
|
13670
|
-
* Time in milliseconds before performing a write in the history.
|
|
13671
|
-
* It prevents from adding too many entries in the history and
|
|
13672
|
-
* makes the back button more usable.
|
|
13673
|
-
*
|
|
13674
|
-
* @default 400
|
|
13675
|
-
*/
|
|
13676
|
-
|
|
13677
|
-
/**
|
|
13678
|
-
* Creates a full URL based on the route state.
|
|
13679
|
-
* The storage adaptor maps all syncable keys to the query string of the URL.
|
|
13680
|
-
*/
|
|
13681
|
-
|
|
13682
|
-
/**
|
|
13683
|
-
* Parses the URL into a route state.
|
|
13684
|
-
* It should be symmetrical to `createURL`.
|
|
13685
|
-
*/
|
|
13686
|
-
|
|
13687
|
-
/**
|
|
13688
|
-
* Returns the location to store in the history.
|
|
13689
|
-
* @default () => window.location
|
|
13690
|
-
*/
|
|
13691
|
-
|
|
13692
|
-
/**
|
|
13693
|
-
* Indicates if last action was back/forward in the browser.
|
|
13694
|
-
*/
|
|
13695
|
-
|
|
13696
|
-
/**
|
|
13697
|
-
* Indicates whether the history router is disposed or not.
|
|
13698
|
-
*/
|
|
13699
|
-
|
|
13700
|
-
/**
|
|
13701
|
-
* Indicates the window.history.length before the last call to
|
|
13702
|
-
* window.history.pushState (called in `write`).
|
|
13703
|
-
* It allows to determine if a `pushState` has been triggered elsewhere,
|
|
13704
|
-
* and thus to prevent the `write` method from calling `pushState`.
|
|
13705
|
-
*/
|
|
13706
|
-
|
|
13707
13692
|
/**
|
|
13708
13693
|
* Initializes a new storage provider that syncs the search state to the URL
|
|
13709
13694
|
* using web APIs (`window.location.pushState` and `onpopstate` event).
|
|
@@ -13721,15 +13706,49 @@
|
|
|
13721
13706
|
push = _ref.push;
|
|
13722
13707
|
_classCallCheck(this, BrowserHistory);
|
|
13723
13708
|
_defineProperty(this, "$$type", 'ais.browser');
|
|
13709
|
+
/**
|
|
13710
|
+
* Transforms a UI state into a title for the page.
|
|
13711
|
+
*/
|
|
13724
13712
|
_defineProperty(this, "windowTitle", void 0);
|
|
13713
|
+
/**
|
|
13714
|
+
* Time in milliseconds before performing a write in the history.
|
|
13715
|
+
* It prevents from adding too many entries in the history and
|
|
13716
|
+
* makes the back button more usable.
|
|
13717
|
+
*
|
|
13718
|
+
* @default 400
|
|
13719
|
+
*/
|
|
13725
13720
|
_defineProperty(this, "writeDelay", void 0);
|
|
13721
|
+
/**
|
|
13722
|
+
* Creates a full URL based on the route state.
|
|
13723
|
+
* The storage adaptor maps all syncable keys to the query string of the URL.
|
|
13724
|
+
*/
|
|
13726
13725
|
_defineProperty(this, "_createURL", void 0);
|
|
13726
|
+
/**
|
|
13727
|
+
* Parses the URL into a route state.
|
|
13728
|
+
* It should be symmetrical to `createURL`.
|
|
13729
|
+
*/
|
|
13727
13730
|
_defineProperty(this, "parseURL", void 0);
|
|
13731
|
+
/**
|
|
13732
|
+
* Returns the location to store in the history.
|
|
13733
|
+
* @default () => window.location
|
|
13734
|
+
*/
|
|
13728
13735
|
_defineProperty(this, "getLocation", void 0);
|
|
13729
13736
|
_defineProperty(this, "writeTimer", void 0);
|
|
13730
13737
|
_defineProperty(this, "_onPopState", void 0);
|
|
13738
|
+
/**
|
|
13739
|
+
* Indicates if last action was back/forward in the browser.
|
|
13740
|
+
*/
|
|
13731
13741
|
_defineProperty(this, "inPopState", false);
|
|
13742
|
+
/**
|
|
13743
|
+
* Indicates whether the history router is disposed or not.
|
|
13744
|
+
*/
|
|
13732
13745
|
_defineProperty(this, "isDisposed", false);
|
|
13746
|
+
/**
|
|
13747
|
+
* Indicates the window.history.length before the last call to
|
|
13748
|
+
* window.history.pushState (called in `write`).
|
|
13749
|
+
* It allows to determine if a `pushState` has been triggered elsewhere,
|
|
13750
|
+
* and thus to prevent the `write` method from calling `pushState`.
|
|
13751
|
+
*/
|
|
13733
13752
|
_defineProperty(this, "latestAcknowledgedHistory", 0);
|
|
13734
13753
|
_defineProperty(this, "_start", void 0);
|
|
13735
13754
|
_defineProperty(this, "_dispose", void 0);
|
|
@@ -14598,7 +14617,7 @@
|
|
|
14598
14617
|
};
|
|
14599
14618
|
}
|
|
14600
14619
|
|
|
14601
|
-
var version$1 = '4.56.
|
|
14620
|
+
var version$1 = '4.56.10';
|
|
14602
14621
|
|
|
14603
14622
|
var withUsage$r = createDocumentationMessageGenerator({
|
|
14604
14623
|
name: 'instantsearch'
|
|
@@ -14610,6 +14629,9 @@
|
|
|
14610
14629
|
// this purposely breaks typescript's type inference to ensure it's not used
|
|
14611
14630
|
// as it's used for a default parameter for example
|
|
14612
14631
|
// source: https://github.com/Microsoft/TypeScript/issues/14829#issuecomment-504042546
|
|
14632
|
+
/**
|
|
14633
|
+
* Global options for an InstantSearch instance.
|
|
14634
|
+
*/
|
|
14613
14635
|
/**
|
|
14614
14636
|
* The actual implementation of the InstantSearch. This is
|
|
14615
14637
|
* created using the `instantsearch` factory function.
|
|
@@ -14643,7 +14665,14 @@
|
|
|
14643
14665
|
_defineProperty(_assertThisInitialized(_this), "_mainHelperSearch", void 0);
|
|
14644
14666
|
_defineProperty(_assertThisInitialized(_this), "middleware", []);
|
|
14645
14667
|
_defineProperty(_assertThisInitialized(_this), "sendEventToInsights", void 0);
|
|
14668
|
+
/**
|
|
14669
|
+
* The status of the search. Can be "idle", "loading", "stalled", or "error".
|
|
14670
|
+
*/
|
|
14646
14671
|
_defineProperty(_assertThisInitialized(_this), "status", 'idle');
|
|
14672
|
+
/**
|
|
14673
|
+
* The last returned error from the Search API.
|
|
14674
|
+
* The error gets cleared when the next valid search response is rendered.
|
|
14675
|
+
*/
|
|
14647
14676
|
_defineProperty(_assertThisInitialized(_this), "error", undefined);
|
|
14648
14677
|
_defineProperty(_assertThisInitialized(_this), "scheduleSearch", defer(function () {
|
|
14649
14678
|
if (_this.started) {
|
|
@@ -14763,15 +14792,6 @@
|
|
|
14763
14792
|
_createClass(InstantSearch, [{
|
|
14764
14793
|
key: "_isSearchStalled",
|
|
14765
14794
|
get:
|
|
14766
|
-
/**
|
|
14767
|
-
* The status of the search. Can be "idle", "loading", "stalled", or "error".
|
|
14768
|
-
*/
|
|
14769
|
-
|
|
14770
|
-
/**
|
|
14771
|
-
* The last returned error from the Search API.
|
|
14772
|
-
* The error gets cleared when the next valid search response is rendered.
|
|
14773
|
-
*/
|
|
14774
|
-
|
|
14775
14795
|
/**
|
|
14776
14796
|
* @deprecated use `status === 'stalled'` instead
|
|
14777
14797
|
*/
|
|
@@ -17023,6 +17043,11 @@
|
|
|
17023
17043
|
});
|
|
17024
17044
|
};
|
|
17025
17045
|
|
|
17046
|
+
/**
|
|
17047
|
+
* A list of [search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters/)
|
|
17048
|
+
* to enable when the widget mounts.
|
|
17049
|
+
*/
|
|
17050
|
+
|
|
17026
17051
|
var configure = function configure(widgetParams) {
|
|
17027
17052
|
// This is a renderless widget that falls back to the connector's
|
|
17028
17053
|
// noop render and unmount functions.
|
|
@@ -17918,6 +17943,9 @@
|
|
|
17918
17943
|
}
|
|
17919
17944
|
|
|
17920
17945
|
var _excluded$k = ["root"];
|
|
17946
|
+
|
|
17947
|
+
// CSS types
|
|
17948
|
+
|
|
17921
17949
|
var defaultProps$2 = {
|
|
17922
17950
|
cssClasses: {},
|
|
17923
17951
|
depth: 0
|
|
@@ -17979,6 +18007,21 @@
|
|
|
17979
18007
|
templateProps: _this.props.templateProps
|
|
17980
18008
|
});
|
|
17981
18009
|
});
|
|
18010
|
+
// Click events on DOM tree like LABEL > INPUT will result in two click events
|
|
18011
|
+
// instead of one.
|
|
18012
|
+
// No matter the framework, see https://www.google.com/search?q=click+label+twice
|
|
18013
|
+
//
|
|
18014
|
+
// Thus making it hard to distinguish activation from deactivation because both click events
|
|
18015
|
+
// are very close. Debounce is a solution but hacky.
|
|
18016
|
+
//
|
|
18017
|
+
// So the code here checks if the click was done on or in a LABEL. If this LABEL
|
|
18018
|
+
// has a checkbox inside, we ignore the first click event because we will get another one.
|
|
18019
|
+
//
|
|
18020
|
+
// We also check if the click was done inside a link and then e.preventDefault() because we already
|
|
18021
|
+
// handle the url
|
|
18022
|
+
//
|
|
18023
|
+
// Finally, we always stop propagation of the event to avoid multiple levels RefinementLists to fail: click
|
|
18024
|
+
// on child would click on parent also
|
|
17982
18025
|
_defineProperty(_assertThisInitialized(_this), "handleItemClick", function (_ref) {
|
|
17983
18026
|
var facetValueToRefine = _ref.facetValueToRefine,
|
|
17984
18027
|
isRefined = _ref.isRefined,
|
|
@@ -19582,9 +19625,7 @@
|
|
|
19582
19625
|
_excluded2$5 = ["places"];
|
|
19583
19626
|
/* Places.js is an optional dependency, no error should be reported if the package is missing */
|
|
19584
19627
|
/** @ts-ignore */
|
|
19585
|
-
|
|
19586
19628
|
// using the type like this requires only one ts-ignore
|
|
19587
|
-
|
|
19588
19629
|
/**
|
|
19589
19630
|
* This widget sets the geolocation value for the search based on the selected
|
|
19590
19631
|
* result in the Algolia Places autocomplete.
|
|
@@ -20467,6 +20508,8 @@
|
|
|
20467
20508
|
}
|
|
20468
20509
|
killEvent(ev);
|
|
20469
20510
|
});
|
|
20511
|
+
// Make sure the proposed position respects the bounds and
|
|
20512
|
+
// does not collide with other handles too much.
|
|
20470
20513
|
_defineProperty(_assertThisInitialized(_this), "validatePosition", function (idx, proposedPosition) {
|
|
20471
20514
|
var _this$state4 = _this.state,
|
|
20472
20515
|
handlePos = _this$state4.handlePos,
|