react-instantsearch-core 6.38.1 → 6.38.2
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/LICENSE +21 -0
- package/README.md +9 -1
- package/dist/cjs/connectors/connectAutoComplete.js +14 -33
- package/dist/cjs/connectors/connectBreadcrumb.js +9 -22
- package/dist/cjs/connectors/connectConfigure.js +17 -26
- package/dist/cjs/connectors/connectConfigureRelatedItems.js +20 -33
- package/dist/cjs/connectors/connectCurrentRefinements.js +6 -13
- package/dist/cjs/connectors/connectDynamicWidgets.js +2 -13
- package/dist/cjs/connectors/connectGeoSearch.js +15 -34
- package/dist/cjs/connectors/connectHierarchicalMenu.js +22 -48
- package/dist/cjs/connectors/connectHighlight.js +8 -14
- package/dist/cjs/connectors/connectHitInsights.js +8 -20
- package/dist/cjs/connectors/connectHits.js +2 -11
- package/dist/cjs/connectors/connectHitsPerPage.js +8 -18
- package/dist/cjs/connectors/connectInfiniteHits.js +25 -43
- package/dist/cjs/connectors/connectMenu.js +14 -33
- package/dist/cjs/connectors/connectNumericMenu.js +24 -49
- package/dist/cjs/connectors/connectPagination.js +7 -17
- package/dist/cjs/connectors/connectPoweredBy.js +1 -5
- package/dist/cjs/connectors/connectQueryRules.js +11 -29
- package/dist/cjs/connectors/connectRange.js +33 -75
- package/dist/cjs/connectors/connectRefinementList.js +16 -34
- package/dist/cjs/connectors/connectRelevantSort.js +6 -13
- package/dist/cjs/connectors/connectScrollTo.js +6 -14
- package/dist/cjs/connectors/connectSearchBox.js +7 -17
- package/dist/cjs/connectors/connectSortBy.js +8 -18
- package/dist/cjs/connectors/connectStateResults.js +1 -6
- package/dist/cjs/connectors/connectStats.js +2 -8
- package/dist/cjs/connectors/connectToggleRefinement.js +14 -29
- package/dist/cjs/connectors/connectVoiceSearch.js +7 -24
- package/dist/cjs/core/context.js +3 -7
- package/dist/cjs/core/createConnector.js +60 -114
- package/dist/cjs/core/createInstantSearchManager.d.js +1 -0
- package/dist/cjs/core/createInstantSearchManager.js +67 -116
- package/dist/cjs/core/createStore.js +0 -1
- package/dist/cjs/core/createWidgetsManager.js +4 -7
- package/dist/cjs/core/highlight.js +11 -20
- package/dist/cjs/core/indexUtils.js +34 -77
- package/dist/cjs/core/metadata.js +7 -15
- package/dist/cjs/core/translatable.js +19 -46
- package/dist/cjs/core/utils.js +14 -52
- package/dist/cjs/core/version.js +1 -1
- package/dist/cjs/index.js +9 -44
- package/dist/cjs/types/index.js +0 -2
- package/dist/cjs/widgets/Configure.js +1 -5
- package/dist/cjs/widgets/ConfigureRelatedItems.js +1 -8
- package/dist/cjs/widgets/DynamicWidgets.js +12 -33
- package/dist/cjs/widgets/Index.js +26 -52
- package/dist/cjs/widgets/InstantSearch.js +28 -67
- package/dist/cjs/widgets/QueryRuleContext.js +1 -5
- package/dist/es/connectors/connectAutoComplete.js +11 -25
- package/dist/es/connectors/connectBreadcrumb.js +7 -13
- package/dist/es/connectors/connectConfigure.js +13 -22
- package/dist/es/connectors/connectConfigureRelatedItems.js +17 -25
- package/dist/es/connectors/connectCurrentRefinements.js +5 -7
- package/dist/es/connectors/connectDynamicWidgets.js +1 -6
- package/dist/es/connectors/connectGeoSearch.js +14 -27
- package/dist/es/connectors/connectHierarchicalMenu.js +19 -38
- package/dist/es/connectors/connectHighlight.js +7 -9
- package/dist/es/connectors/connectHitInsights.js +7 -14
- package/dist/es/connectors/connectHits.js +2 -5
- package/dist/es/connectors/connectHitsPerPage.js +5 -12
- package/dist/es/connectors/connectInfiniteHits.js +21 -31
- package/dist/es/connectors/connectMenu.js +12 -25
- package/dist/es/connectors/connectNumericMenu.js +22 -40
- package/dist/es/connectors/connectPagination.js +5 -12
- package/dist/es/connectors/connectPoweredBy.js +1 -1
- package/dist/es/connectors/connectQueryRules.js +9 -20
- package/dist/es/connectors/connectRange.js +31 -68
- package/dist/es/connectors/connectRefinementList.js +14 -24
- package/dist/es/connectors/connectRelevantSort.js +7 -8
- package/dist/es/connectors/connectScrollTo.js +6 -7
- package/dist/es/connectors/connectSearchBox.js +5 -11
- package/dist/es/connectors/connectSortBy.js +5 -12
- package/dist/es/connectors/connectStateResults.js +1 -1
- package/dist/es/connectors/connectStats.js +2 -3
- package/dist/es/connectors/connectToggleRefinement.js +12 -22
- package/dist/es/connectors/connectVoiceSearch.js +4 -16
- package/dist/es/core/context.js +3 -5
- package/dist/es/core/createConnector.js +33 -86
- package/dist/es/core/createInstantSearchManager.d.js +0 -0
- package/dist/es/core/createInstantSearchManager.js +59 -100
- package/dist/es/core/createWidgetsManager.js +4 -5
- package/dist/es/core/highlight.js +11 -17
- package/dist/es/core/indexUtils.js +27 -62
- package/dist/es/core/metadata.js +6 -8
- package/dist/es/core/translatable.js +13 -29
- package/dist/es/core/utils.js +12 -29
- package/dist/es/core/version.js +1 -1
- package/dist/es/index.js +39 -6
- package/dist/es/widgets/Configure.js +1 -0
- package/dist/es/widgets/ConfigureRelatedItems.js +0 -2
- package/dist/es/widgets/DynamicWidgets.js +9 -18
- package/dist/es/widgets/Index.js +13 -31
- package/dist/es/widgets/InstantSearch.js +13 -42
- package/dist/umd/ReactInstantSearchCore.js +507 -1078
- package/dist/umd/ReactInstantSearchCore.js.map +1 -1
- package/dist/umd/ReactInstantSearchCore.min.js +2 -2
- package/dist/umd/ReactInstantSearchCore.min.js.map +1 -1
- package/package.json +7 -5
|
@@ -1,30 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
2
|
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; }
|
|
4
|
-
|
|
5
3
|
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; }
|
|
6
|
-
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
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 { omit } from "./utils.js";
|
|
8
8
|
export function getIndexId(context) {
|
|
9
9
|
return hasMultipleIndices(context) ? context.multiIndexContext.targetedIndex : context.ais.mainTargetedIndex;
|
|
10
10
|
}
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line valid-jsdoc
|
|
11
13
|
/**
|
|
12
14
|
* @returns {import('algoliasearch-helper').SearchResults} results
|
|
13
15
|
*/
|
|
14
|
-
|
|
15
16
|
export function getResults(searchResults, context) {
|
|
16
17
|
if (searchResults.results) {
|
|
17
18
|
if (searchResults.results.hits) {
|
|
18
19
|
return searchResults.results;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
21
|
var indexId = getIndexId(context);
|
|
22
|
-
|
|
23
22
|
if (searchResults.results[indexId]) {
|
|
24
23
|
return searchResults.results[indexId];
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
|
-
|
|
28
26
|
return null;
|
|
29
27
|
}
|
|
30
28
|
export function hasMultipleIndices(context) {
|
|
@@ -51,11 +49,9 @@ export function refineValue(searchState, nextRefinement, context, resetPage, nam
|
|
|
51
49
|
}, true, namespace);
|
|
52
50
|
});
|
|
53
51
|
}
|
|
54
|
-
|
|
55
52
|
return namespace ? refineSingleIndexWithNamespace(searchState, nextRefinement, resetPage, namespace) : refineSingleIndex(searchState, nextRefinement, resetPage);
|
|
56
53
|
}
|
|
57
54
|
}
|
|
58
|
-
|
|
59
55
|
function refineMultiIndex(searchState, nextRefinement, indexId, resetPage) {
|
|
60
56
|
var page = resetPage ? {
|
|
61
57
|
page: 1
|
|
@@ -65,17 +61,14 @@ function refineMultiIndex(searchState, nextRefinement, indexId, resetPage) {
|
|
|
65
61
|
indices: state
|
|
66
62
|
});
|
|
67
63
|
}
|
|
68
|
-
|
|
69
64
|
function refineSingleIndex(searchState, nextRefinement, resetPage) {
|
|
70
65
|
var page = resetPage ? {
|
|
71
66
|
page: 1
|
|
72
67
|
} : undefined;
|
|
73
68
|
return _objectSpread(_objectSpread(_objectSpread({}, searchState), nextRefinement), page);
|
|
74
69
|
}
|
|
75
|
-
|
|
76
70
|
function refineMultiIndexWithNamespace(searchState, nextRefinement, indexId, resetPage, namespace) {
|
|
77
71
|
var _objectSpread4;
|
|
78
|
-
|
|
79
72
|
var page = resetPage ? {
|
|
80
73
|
page: 1
|
|
81
74
|
} : undefined;
|
|
@@ -84,14 +77,12 @@ function refineMultiIndexWithNamespace(searchState, nextRefinement, indexId, res
|
|
|
84
77
|
indices: state
|
|
85
78
|
});
|
|
86
79
|
}
|
|
87
|
-
|
|
88
80
|
function refineSingleIndexWithNamespace(searchState, nextRefinement, resetPage, namespace) {
|
|
89
81
|
var page = resetPage ? {
|
|
90
82
|
page: 1
|
|
91
83
|
} : undefined;
|
|
92
84
|
return _objectSpread(_objectSpread({}, searchState), {}, _defineProperty({}, namespace, _objectSpread(_objectSpread({}, searchState[namespace]), nextRefinement)), page);
|
|
93
85
|
}
|
|
94
|
-
|
|
95
86
|
function getNamespaceAndAttributeName(id) {
|
|
96
87
|
var parts = id.match(/^([^.]*)\.(.*)/);
|
|
97
88
|
var namespace = parts && parts[1];
|
|
@@ -101,60 +92,47 @@ function getNamespaceAndAttributeName(id) {
|
|
|
101
92
|
attributeName: attributeName
|
|
102
93
|
};
|
|
103
94
|
}
|
|
104
|
-
|
|
105
95
|
function hasRefinements(_ref) {
|
|
106
96
|
var multiIndex = _ref.multiIndex,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
97
|
+
indexId = _ref.indexId,
|
|
98
|
+
namespace = _ref.namespace,
|
|
99
|
+
attributeName = _ref.attributeName,
|
|
100
|
+
id = _ref.id,
|
|
101
|
+
searchState = _ref.searchState;
|
|
113
102
|
if (multiIndex && namespace) {
|
|
114
103
|
return searchState.indices && searchState.indices[indexId] && searchState.indices[indexId][namespace] && Object.hasOwnProperty.call(searchState.indices[indexId][namespace], attributeName);
|
|
115
104
|
}
|
|
116
|
-
|
|
117
105
|
if (multiIndex) {
|
|
118
106
|
return searchState.indices && searchState.indices[indexId] && Object.hasOwnProperty.call(searchState.indices[indexId], id);
|
|
119
107
|
}
|
|
120
|
-
|
|
121
108
|
if (namespace) {
|
|
122
109
|
return searchState[namespace] && Object.hasOwnProperty.call(searchState[namespace], attributeName);
|
|
123
110
|
}
|
|
124
|
-
|
|
125
111
|
return Object.hasOwnProperty.call(searchState, id);
|
|
126
112
|
}
|
|
127
|
-
|
|
128
113
|
function getRefinements(_ref2) {
|
|
129
114
|
var multiIndex = _ref2.multiIndex,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
115
|
+
indexId = _ref2.indexId,
|
|
116
|
+
namespace = _ref2.namespace,
|
|
117
|
+
attributeName = _ref2.attributeName,
|
|
118
|
+
id = _ref2.id,
|
|
119
|
+
searchState = _ref2.searchState;
|
|
136
120
|
if (multiIndex && namespace) {
|
|
137
121
|
return searchState.indices[indexId][namespace][attributeName];
|
|
138
122
|
}
|
|
139
|
-
|
|
140
123
|
if (multiIndex) {
|
|
141
124
|
return searchState.indices[indexId][id];
|
|
142
125
|
}
|
|
143
|
-
|
|
144
126
|
if (namespace) {
|
|
145
127
|
return searchState[namespace][attributeName];
|
|
146
128
|
}
|
|
147
|
-
|
|
148
129
|
return searchState[id];
|
|
149
130
|
}
|
|
150
|
-
|
|
151
131
|
export function getCurrentRefinementValue(props, searchState, context, id, defaultValue) {
|
|
152
132
|
var indexId = getIndexId(context);
|
|
153
|
-
|
|
154
133
|
var _getNamespaceAndAttri = getNamespaceAndAttributeName(id),
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
134
|
+
namespace = _getNamespaceAndAttri.namespace,
|
|
135
|
+
attributeName = _getNamespaceAndAttri.attributeName;
|
|
158
136
|
var multiIndex = hasMultipleIndices(context);
|
|
159
137
|
var args = {
|
|
160
138
|
multiIndex: multiIndex,
|
|
@@ -165,24 +143,19 @@ export function getCurrentRefinementValue(props, searchState, context, id, defau
|
|
|
165
143
|
searchState: searchState
|
|
166
144
|
};
|
|
167
145
|
var hasRefinementsValue = hasRefinements(args);
|
|
168
|
-
|
|
169
146
|
if (hasRefinementsValue) {
|
|
170
147
|
return getRefinements(args);
|
|
171
148
|
}
|
|
172
|
-
|
|
173
149
|
if (props.defaultRefinement) {
|
|
174
150
|
return props.defaultRefinement;
|
|
175
151
|
}
|
|
176
|
-
|
|
177
152
|
return defaultValue;
|
|
178
153
|
}
|
|
179
154
|
export function cleanUpValue(searchState, context, id) {
|
|
180
155
|
var indexId = getIndexId(context);
|
|
181
|
-
|
|
182
156
|
var _getNamespaceAndAttri2 = getNamespaceAndAttributeName(id),
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
157
|
+
namespace = _getNamespaceAndAttri2.namespace,
|
|
158
|
+
attributeName = _getNamespaceAndAttri2.attributeName;
|
|
186
159
|
if (hasMultipleIndices(context) && Boolean(searchState.indices)) {
|
|
187
160
|
return cleanUpValueWithMultiIndex({
|
|
188
161
|
attribute: attributeName,
|
|
@@ -192,7 +165,6 @@ export function cleanUpValue(searchState, context, id) {
|
|
|
192
165
|
namespace: namespace
|
|
193
166
|
});
|
|
194
167
|
}
|
|
195
|
-
|
|
196
168
|
return cleanUpValueWithSingleIndex({
|
|
197
169
|
attribute: attributeName,
|
|
198
170
|
searchState: searchState,
|
|
@@ -200,39 +172,32 @@ export function cleanUpValue(searchState, context, id) {
|
|
|
200
172
|
namespace: namespace
|
|
201
173
|
});
|
|
202
174
|
}
|
|
203
|
-
|
|
204
175
|
function cleanUpValueWithSingleIndex(_ref3) {
|
|
205
176
|
var searchState = _ref3.searchState,
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
177
|
+
id = _ref3.id,
|
|
178
|
+
namespace = _ref3.namespace,
|
|
179
|
+
attribute = _ref3.attribute;
|
|
210
180
|
if (namespace) {
|
|
211
181
|
return _objectSpread(_objectSpread({}, searchState), {}, _defineProperty({}, namespace, omit(searchState[namespace], [attribute])));
|
|
212
182
|
}
|
|
213
|
-
|
|
214
183
|
return omit(searchState, [id]);
|
|
215
184
|
}
|
|
216
|
-
|
|
217
185
|
function cleanUpValueWithMultiIndex(_ref4) {
|
|
218
186
|
var searchState = _ref4.searchState,
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
187
|
+
indexId = _ref4.indexId,
|
|
188
|
+
id = _ref4.id,
|
|
189
|
+
namespace = _ref4.namespace,
|
|
190
|
+
attribute = _ref4.attribute;
|
|
223
191
|
var indexSearchState = searchState.indices[indexId];
|
|
224
|
-
|
|
225
192
|
if (namespace && indexSearchState) {
|
|
226
193
|
return _objectSpread(_objectSpread({}, searchState), {}, {
|
|
227
194
|
indices: _objectSpread(_objectSpread({}, searchState.indices), {}, _defineProperty({}, indexId, _objectSpread(_objectSpread({}, indexSearchState), {}, _defineProperty({}, namespace, omit(indexSearchState[namespace], [attribute])))))
|
|
228
195
|
});
|
|
229
196
|
}
|
|
230
|
-
|
|
231
197
|
if (indexSearchState) {
|
|
232
198
|
return _objectSpread(_objectSpread({}, searchState), {}, {
|
|
233
199
|
indices: _objectSpread(_objectSpread({}, searchState.indices), {}, _defineProperty({}, indexId, omit(indexSearchState, [id])))
|
|
234
200
|
});
|
|
235
201
|
}
|
|
236
|
-
|
|
237
202
|
return searchState;
|
|
238
203
|
}
|
package/dist/es/core/metadata.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
2
|
export function isMetadataEnabled() {
|
|
3
3
|
return (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && _typeof(window.navigator) === 'object' && typeof window.navigator.userAgent === 'string' && window.navigator.userAgent.includes('Algolia Crawler') && _typeof(window.document) === 'object';
|
|
4
4
|
}
|
|
@@ -6,14 +6,12 @@ export function getMetadataPayload(widgets, searchClient) {
|
|
|
6
6
|
var internalProps = ['contextValue', 'indexContextValue'];
|
|
7
7
|
var widgetsPayload = widgets.map(function (_ref) {
|
|
8
8
|
var props = _ref.props,
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
constructor = _ref.constructor;
|
|
11
10
|
var _ref2 = constructor._connectorDesc || {},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
_ref2$defaultProps = _ref2.defaultProps,
|
|
12
|
+
defaultProps = _ref2$defaultProps === void 0 ? {} : _ref2$defaultProps,
|
|
13
|
+
_ref2$displayName = _ref2.displayName,
|
|
14
|
+
displayName = _ref2$displayName === void 0 ? constructor.displayName : _ref2$displayName;
|
|
17
15
|
return {
|
|
18
16
|
displayName: displayName,
|
|
19
17
|
$$type: constructor.$$type,
|
|
@@ -1,73 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
|
-
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
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); }
|
|
3
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
5
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
6
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
7
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
10
8
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
|
-
|
|
9
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
10
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
12
11
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
|
-
|
|
12
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
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
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
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); }
|
|
14
16
|
import React, { Component } from 'react';
|
|
15
|
-
|
|
16
17
|
var withKeysPropType = function withKeysPropType(keys) {
|
|
17
18
|
return function (props, propName, componentName) {
|
|
18
19
|
var prop = props[propName];
|
|
19
|
-
|
|
20
20
|
if (prop) {
|
|
21
21
|
// eslint-disable-next-line no-restricted-syntax
|
|
22
22
|
for (var _i = 0, _Object$keys = Object.keys(prop); _i < _Object$keys.length; _i++) {
|
|
23
23
|
var key = _Object$keys[_i];
|
|
24
|
-
|
|
25
24
|
if (keys.indexOf(key) === -1) {
|
|
26
25
|
return new Error("Unknown `".concat(propName, "` key `").concat(key, "`. Check the render method ") + "of `".concat(componentName, "`."));
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
|
-
|
|
31
29
|
return undefined;
|
|
32
30
|
};
|
|
33
31
|
};
|
|
34
|
-
|
|
35
32
|
export default function translatable(defaultTranslations) {
|
|
36
33
|
return function (Composed) {
|
|
37
34
|
var Translatable = /*#__PURE__*/function (_Component) {
|
|
38
35
|
_inherits(Translatable, _Component);
|
|
39
|
-
|
|
40
36
|
var _super = _createSuper(Translatable);
|
|
41
|
-
|
|
42
37
|
function Translatable() {
|
|
43
38
|
var _this;
|
|
44
|
-
|
|
45
39
|
_classCallCheck(this, Translatable);
|
|
46
|
-
|
|
47
40
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
48
41
|
args[_key] = arguments[_key];
|
|
49
42
|
}
|
|
50
|
-
|
|
51
43
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
52
|
-
|
|
53
44
|
_defineProperty(_assertThisInitialized(_this), "translate", function (key) {
|
|
54
45
|
var translations = _this.props.translations;
|
|
55
46
|
var translation = translations && translations.hasOwnProperty(key) ? translations[key] : defaultTranslations[key];
|
|
56
|
-
|
|
57
47
|
if (typeof translation === 'function') {
|
|
58
48
|
for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
59
49
|
params[_key2 - 1] = arguments[_key2];
|
|
60
50
|
}
|
|
61
|
-
|
|
62
51
|
return translation.apply(void 0, params);
|
|
63
52
|
}
|
|
64
|
-
|
|
65
53
|
return translation;
|
|
66
54
|
});
|
|
67
|
-
|
|
68
55
|
return _this;
|
|
69
56
|
}
|
|
70
|
-
|
|
71
57
|
_createClass(Translatable, [{
|
|
72
58
|
key: "render",
|
|
73
59
|
value: function render() {
|
|
@@ -76,10 +62,8 @@ export default function translatable(defaultTranslations) {
|
|
|
76
62
|
}, this.props));
|
|
77
63
|
}
|
|
78
64
|
}]);
|
|
79
|
-
|
|
80
65
|
return Translatable;
|
|
81
66
|
}(Component);
|
|
82
|
-
|
|
83
67
|
var name = Composed.displayName || Composed.name || 'UnknownComponent';
|
|
84
68
|
Translatable.displayName = "Translatable(".concat(name, ")");
|
|
85
69
|
Translatable.propTypes = {
|
package/dist/es/core/utils.js
CHANGED
|
@@ -1,32 +1,27 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
3
|
-
|
|
4
1
|
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; }
|
|
5
|
-
|
|
6
2
|
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; }
|
|
7
|
-
|
|
3
|
+
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; }
|
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
5
|
+
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); }
|
|
6
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
8
7
|
// From https://github.com/reactjs/react-redux/blob/master/src/utils/shallowEqual.js
|
|
9
8
|
export var shallowEqual = function shallowEqual(objA, objB) {
|
|
10
9
|
if (objA === objB) {
|
|
11
10
|
return true;
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
var keysA = Object.keys(objA);
|
|
15
13
|
var keysB = Object.keys(objB);
|
|
16
|
-
|
|
17
14
|
if (keysA.length !== keysB.length) {
|
|
18
15
|
return false;
|
|
19
|
-
}
|
|
20
|
-
|
|
16
|
+
}
|
|
21
17
|
|
|
18
|
+
// Test for A's keys different from B.
|
|
22
19
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
23
|
-
|
|
24
20
|
for (var i = 0; i < keysA.length; i++) {
|
|
25
21
|
if (!hasOwn.call(objB, keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
|
|
26
22
|
return false;
|
|
27
23
|
}
|
|
28
24
|
}
|
|
29
|
-
|
|
30
25
|
return true;
|
|
31
26
|
};
|
|
32
27
|
export var getDisplayName = function getDisplayName(Component) {
|
|
@@ -36,19 +31,15 @@ var resolved = Promise.resolve();
|
|
|
36
31
|
export var defer = function defer(f) {
|
|
37
32
|
resolved.then(f);
|
|
38
33
|
};
|
|
39
|
-
|
|
40
34
|
var isPlainObject = function isPlainObject(value) {
|
|
41
35
|
return _typeof(value) === 'object' && value !== null && !Array.isArray(value);
|
|
42
36
|
};
|
|
43
|
-
|
|
44
37
|
export var removeEmptyKey = function removeEmptyKey(obj) {
|
|
45
38
|
Object.keys(obj).forEach(function (key) {
|
|
46
39
|
var value = obj[key];
|
|
47
|
-
|
|
48
40
|
if (!isPlainObject(value)) {
|
|
49
41
|
return;
|
|
50
42
|
}
|
|
51
|
-
|
|
52
43
|
if (!objectHasKeys(value)) {
|
|
53
44
|
delete obj[key];
|
|
54
45
|
} else {
|
|
@@ -60,7 +51,6 @@ export var removeEmptyKey = function removeEmptyKey(obj) {
|
|
|
60
51
|
export var removeEmptyArraysFromObject = function removeEmptyArraysFromObject(obj) {
|
|
61
52
|
Object.keys(obj).forEach(function (key) {
|
|
62
53
|
var value = obj[key];
|
|
63
|
-
|
|
64
54
|
if (Array.isArray(value) && value.length === 0) {
|
|
65
55
|
delete obj[key];
|
|
66
56
|
}
|
|
@@ -78,7 +68,6 @@ export function addQueryID(hits, queryID) {
|
|
|
78
68
|
if (!queryID) {
|
|
79
69
|
return hits;
|
|
80
70
|
}
|
|
81
|
-
|
|
82
71
|
return hits.map(function (hit) {
|
|
83
72
|
return _objectSpread(_objectSpread({}, hit), {}, {
|
|
84
73
|
__queryID: queryID
|
|
@@ -89,40 +78,35 @@ export function find(array, comparator) {
|
|
|
89
78
|
if (!Array.isArray(array)) {
|
|
90
79
|
return undefined;
|
|
91
80
|
}
|
|
92
|
-
|
|
93
81
|
for (var i = 0; i < array.length; i++) {
|
|
94
82
|
if (comparator(array[i])) {
|
|
95
83
|
return array[i];
|
|
96
84
|
}
|
|
97
85
|
}
|
|
98
|
-
|
|
99
86
|
return undefined;
|
|
100
87
|
}
|
|
101
88
|
export function objectHasKeys(object) {
|
|
102
89
|
return object && Object.keys(object).length > 0;
|
|
103
|
-
}
|
|
90
|
+
}
|
|
104
91
|
|
|
92
|
+
// https://github.com/babel/babel/blob/3aaafae053fa75febb3aa45d45b6f00646e30ba4/packages/babel-helpers/src/helpers.js#L604-L620
|
|
105
93
|
export function omit(source, excluded) {
|
|
106
94
|
if (source === null || source === undefined) {
|
|
107
95
|
return {};
|
|
108
96
|
}
|
|
109
|
-
|
|
110
97
|
var target = {};
|
|
111
98
|
var sourceKeys = Object.keys(source);
|
|
112
|
-
|
|
113
99
|
for (var i = 0; i < sourceKeys.length; i++) {
|
|
114
|
-
var
|
|
115
|
-
|
|
116
|
-
if (excluded.indexOf(_key) >= 0) {
|
|
100
|
+
var key = sourceKeys[i];
|
|
101
|
+
if (excluded.indexOf(key) >= 0) {
|
|
117
102
|
// eslint-disable-next-line no-continue
|
|
118
103
|
continue;
|
|
119
104
|
}
|
|
120
|
-
|
|
121
|
-
target[_key] = source[_key];
|
|
105
|
+
target[key] = source[key];
|
|
122
106
|
}
|
|
123
|
-
|
|
124
107
|
return target;
|
|
125
108
|
}
|
|
109
|
+
|
|
126
110
|
/**
|
|
127
111
|
* Retrieve the value at a path of the object:
|
|
128
112
|
*
|
|
@@ -140,7 +124,6 @@ export function omit(source, excluded) {
|
|
|
140
124
|
* @param object Source object to query
|
|
141
125
|
* @param path either an array of properties, or a string form of the properties, separated by .
|
|
142
126
|
*/
|
|
143
|
-
|
|
144
127
|
export var getPropertyByPath = function getPropertyByPath(object, path) {
|
|
145
128
|
return (Array.isArray(path) ? path : path.replace(/\[(\d+)]/g, '.$1').split('.')).reduce(function (current, key) {
|
|
146
129
|
return current ? current[key] : undefined;
|
package/dist/es/core/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '6.38.
|
|
1
|
+
export default '6.38.2';
|
package/dist/es/index.js
CHANGED
|
@@ -1,53 +1,86 @@
|
|
|
1
1
|
// Core
|
|
2
2
|
export { default as createConnector } from "./core/createConnector.js";
|
|
3
|
-
export { instantSearchContext, InstantSearchConsumer, InstantSearchProvider } from "./core/context.js";
|
|
3
|
+
export { instantSearchContext, InstantSearchConsumer, InstantSearchProvider } from "./core/context.js";
|
|
4
4
|
|
|
5
|
+
// Utils
|
|
6
|
+
// @ts-ignore not yet typed
|
|
5
7
|
export { HIGHLIGHT_TAGS } from "./core/highlight.js";
|
|
8
|
+
// @ts-ignore not yet typed
|
|
6
9
|
export { default as version } from "./core/version.js";
|
|
7
|
-
|
|
10
|
+
// @ts-ignore not yet typed
|
|
11
|
+
export { default as translatable } from "./core/translatable.js";
|
|
8
12
|
|
|
13
|
+
// Widgets
|
|
14
|
+
// @ts-ignore not yet typed
|
|
9
15
|
export { default as Configure } from "./widgets/Configure.js";
|
|
10
16
|
export { default as ExperimentalConfigureRelatedItems } from "./widgets/ConfigureRelatedItems.js";
|
|
11
17
|
import { default as DynamicWidgets } from "./widgets/DynamicWidgets.js";
|
|
12
18
|
/** @deprecated use DynamicWidgets */
|
|
13
|
-
|
|
14
19
|
var ExperimentalDynamicWidgets = DynamicWidgets;
|
|
15
20
|
export { ExperimentalDynamicWidgets, DynamicWidgets };
|
|
16
21
|
export { default as QueryRuleContext } from "./widgets/QueryRuleContext.js";
|
|
17
22
|
export { default as Index } from "./widgets/Index.js";
|
|
18
|
-
export { default as InstantSearch } from "./widgets/InstantSearch.js";
|
|
23
|
+
export { default as InstantSearch } from "./widgets/InstantSearch.js";
|
|
19
24
|
|
|
25
|
+
// Connectors
|
|
26
|
+
// @ts-ignore not yet typed
|
|
20
27
|
export { default as connectAutoComplete } from "./connectors/connectAutoComplete.js";
|
|
28
|
+
// @ts-ignore not yet typed
|
|
21
29
|
export { default as connectBreadcrumb } from "./connectors/connectBreadcrumb.js";
|
|
30
|
+
// @ts-ignore not yet typed
|
|
22
31
|
export { default as connectConfigure } from "./connectors/connectConfigure.js";
|
|
23
32
|
export { default as EXPERIMENTAL_connectConfigureRelatedItems } from "./connectors/connectConfigureRelatedItems.js";
|
|
33
|
+
// @ts-ignore not yet typed
|
|
24
34
|
export { default as connectCurrentRefinements } from "./connectors/connectCurrentRefinements.js";
|
|
25
35
|
import { default as connectDynamicWidgets } from "./connectors/connectDynamicWidgets.js";
|
|
26
36
|
/** @deprecated use connectDynamicWidgets */
|
|
27
|
-
|
|
28
37
|
var EXPERIMENTAL_connectDynamicWidgets = connectDynamicWidgets;
|
|
29
38
|
export { connectDynamicWidgets, EXPERIMENTAL_connectDynamicWidgets };
|
|
39
|
+
|
|
40
|
+
// @ts-ignore not yet typed
|
|
30
41
|
export { default as connectGeoSearch } from "./connectors/connectGeoSearch.js";
|
|
42
|
+
// @ts-ignore not yet typed
|
|
31
43
|
export { default as connectHierarchicalMenu } from "./connectors/connectHierarchicalMenu.js";
|
|
44
|
+
// @ts-ignore not yet typed
|
|
32
45
|
export { default as connectHighlight } from "./connectors/connectHighlight.js";
|
|
46
|
+
// @ts-ignore not yet typed
|
|
33
47
|
export { default as connectHits } from "./connectors/connectHits.js";
|
|
48
|
+
// @ts-ignore not yet typed
|
|
34
49
|
export { default as connectHitsPerPage } from "./connectors/connectHitsPerPage.js";
|
|
50
|
+
// @ts-ignore not yet typed
|
|
35
51
|
export { default as connectInfiniteHits } from "./connectors/connectInfiniteHits.js";
|
|
52
|
+
// @ts-ignore not yet typed
|
|
36
53
|
export { default as connectMenu } from "./connectors/connectMenu.js";
|
|
54
|
+
// @ts-ignore not yet typed
|
|
37
55
|
export { default as connectNumericMenu } from "./connectors/connectNumericMenu.js";
|
|
56
|
+
// @ts-ignore not yet typed
|
|
38
57
|
export { default as connectPagination } from "./connectors/connectPagination.js";
|
|
58
|
+
// @ts-ignore not yet typed
|
|
39
59
|
export { default as connectPoweredBy } from "./connectors/connectPoweredBy.js";
|
|
60
|
+
// @ts-ignore not yet typed
|
|
40
61
|
export { default as connectQueryRules } from "./connectors/connectQueryRules.js";
|
|
62
|
+
// @ts-ignore not yet typed
|
|
41
63
|
export { default as connectRange } from "./connectors/connectRange.js";
|
|
64
|
+
// @ts-ignore not yet typed
|
|
42
65
|
export { default as connectRefinementList } from "./connectors/connectRefinementList.js";
|
|
66
|
+
// @ts-ignore not yet typed
|
|
43
67
|
export { default as connectScrollTo } from "./connectors/connectScrollTo.js";
|
|
68
|
+
// @ts-ignore not yet typed
|
|
44
69
|
export { default as connectSearchBox } from "./connectors/connectSearchBox.js";
|
|
70
|
+
// @ts-ignore not yet typed
|
|
45
71
|
export { default as connectRelevantSort } from "./connectors/connectRelevantSort.js";
|
|
72
|
+
// @ts-ignore not yet typed
|
|
46
73
|
export { default as connectSortBy } from "./connectors/connectSortBy.js";
|
|
74
|
+
// @ts-ignore not yet typed
|
|
47
75
|
export { default as connectStateResults } from "./connectors/connectStateResults.js";
|
|
76
|
+
// @ts-ignore not yet typed
|
|
48
77
|
export { default as connectStats } from "./connectors/connectStats.js";
|
|
78
|
+
// @ts-ignore not yet typed
|
|
49
79
|
export { default as connectToggleRefinement } from "./connectors/connectToggleRefinement.js";
|
|
80
|
+
// @ts-ignore not yet typed
|
|
50
81
|
export { default as connectHitInsights } from "./connectors/connectHitInsights.js";
|
|
51
|
-
|
|
82
|
+
// @ts-ignore not yet typed
|
|
83
|
+
export { default as connectVoiceSearch } from "./connectors/connectVoiceSearch.js";
|
|
52
84
|
|
|
85
|
+
// Types
|
|
53
86
|
export * from "./types/index.js";
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import connectConfigureRelatedItems from "../connectors/connectConfigureRelatedItems.js";
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
3
|
function ConfigureRelatedItems() {
|
|
5
4
|
return null;
|
|
6
5
|
}
|
|
7
|
-
|
|
8
6
|
ConfigureRelatedItems.propTypes = {
|
|
9
7
|
hit: PropTypes.object.isRequired,
|
|
10
8
|
matchingPatterns: PropTypes.object.isRequired,
|