instantsearch.js 4.54.1 → 4.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/Breadcrumb/Breadcrumb.js +2 -2
- package/cjs/components/Hits/Hits.js +16 -7
- package/cjs/components/InfiniteHits/InfiniteHits.js +13 -2
- package/cjs/components/RangeInput/RangeInput.js +22 -11
- package/cjs/components/RefinementList/RefinementList.js +34 -52
- package/cjs/components/Slider/Rheostat.js +163 -249
- package/cjs/connectors/autocomplete/connectAutocomplete.js +1 -1
- package/cjs/connectors/geo-search/connectGeoSearch.js +1 -1
- package/cjs/connectors/hierarchical-menu/connectHierarchicalMenu.js +1 -1
- package/cjs/connectors/hits/connectHits.js +1 -1
- package/cjs/connectors/infinite-hits/connectInfiniteHits.js +55 -32
- package/cjs/connectors/menu/connectMenu.js +1 -1
- package/cjs/connectors/numeric-menu/connectNumericMenu.js +1 -1
- package/cjs/connectors/rating-menu/connectRatingMenu.js +7 -3
- package/cjs/connectors/refinement-list/connectRefinementList.js +1 -1
- package/cjs/connectors/toggle-refinement/connectToggleRefinement.js +14 -4
- package/cjs/helpers/insights.js +3 -4
- package/cjs/lib/InstantSearch.js +20 -6
- package/cjs/lib/insights/listener.js +43 -36
- package/cjs/lib/routers/history.js +55 -1
- package/cjs/lib/stateMappings/simple.js +1 -0
- package/cjs/lib/stateMappings/singleIndex.js +1 -0
- package/cjs/lib/utils/createSendEventForFacet.js +12 -2
- package/cjs/lib/utils/createSendEventForHits.js +34 -11
- package/cjs/lib/utils/render-args.js +3 -2
- package/cjs/lib/version.js +1 -1
- package/cjs/middlewares/createInsightsMiddleware.js +135 -33
- package/cjs/middlewares/createMetadataMiddleware.js +17 -5
- package/cjs/middlewares/createRouterMiddleware.js +5 -1
- package/cjs/widgets/hits/hits.js +1 -2
- package/cjs/widgets/hits-per-page/hits-per-page.js +3 -1
- package/cjs/widgets/index/index.js +8 -8
- package/cjs/widgets/infinite-hits/infinite-hits.js +1 -2
- package/dist/instantsearch.development.d.ts +143 -84
- package/dist/instantsearch.development.js +770 -584
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +143 -84
- package/dist/instantsearch.production.min.d.ts +143 -84
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/components/Breadcrumb/Breadcrumb.d.ts +2 -2
- package/es/components/Breadcrumb/Breadcrumb.js +2 -2
- package/es/components/GeoSearchControls/GeoSearchButton.d.ts +1 -1
- package/es/components/GeoSearchControls/GeoSearchControls.d.ts +3 -3
- package/es/components/GeoSearchControls/GeoSearchToggle.d.ts +1 -1
- package/es/components/Hits/Hits.d.ts +5 -5
- package/es/components/Hits/Hits.js +15 -5
- package/es/components/InfiniteHits/InfiniteHits.d.ts +3 -2
- package/es/components/InfiniteHits/InfiniteHits.js +13 -2
- package/es/components/Pagination/Pagination.d.ts +2 -2
- package/es/components/RangeInput/RangeInput.d.ts +7 -4
- package/es/components/RangeInput/RangeInput.js +22 -11
- package/es/components/RefinementList/RefinementList.d.ts +0 -1
- package/es/components/RefinementList/RefinementList.js +34 -52
- package/es/components/RelevantSort/RelevantSort.d.ts +1 -1
- package/es/components/Selector/Selector.d.ts +2 -2
- package/es/components/Slider/Rheostat.d.ts +23 -17
- package/es/components/Slider/Rheostat.js +163 -249
- package/es/components/Slider/Slider.d.ts +1 -1
- package/es/connectors/autocomplete/connectAutocomplete.js +1 -1
- package/es/connectors/current-refinements/connectCurrentRefinements.d.ts +2 -2
- package/es/connectors/dynamic-widgets/connectDynamicWidgets.d.ts +2 -2
- package/es/connectors/geo-search/connectGeoSearch.d.ts +7 -7
- package/es/connectors/geo-search/connectGeoSearch.js +1 -1
- package/es/connectors/hierarchical-menu/connectHierarchicalMenu.js +1 -1
- package/es/connectors/hits/connectHits.js +1 -1
- package/es/connectors/infinite-hits/connectInfiniteHits.js +56 -33
- package/es/connectors/menu/connectMenu.d.ts +2 -2
- package/es/connectors/menu/connectMenu.js +1 -1
- package/es/connectors/numeric-menu/connectNumericMenu.js +1 -1
- package/es/connectors/pagination/connectPagination.d.ts +1 -1
- package/es/connectors/range/connectRange.d.ts +3 -3
- package/es/connectors/rating-menu/connectRatingMenu.js +7 -3
- package/es/connectors/refinement-list/connectRefinementList.d.ts +3 -3
- package/es/connectors/refinement-list/connectRefinementList.js +1 -1
- package/es/connectors/relevant-sort/connectRelevantSort.d.ts +1 -1
- package/es/connectors/toggle-refinement/connectToggleRefinement.js +13 -3
- package/es/helpers/insights.d.ts +2 -1
- package/es/helpers/insights.js +3 -3
- package/es/lib/InstantSearch.d.ts +24 -14
- package/es/lib/InstantSearch.js +21 -7
- package/es/lib/insights/listener.d.ts +10 -6
- package/es/lib/insights/listener.js +42 -36
- package/es/lib/routers/history.d.ts +3 -2
- package/es/lib/routers/history.js +56 -2
- package/es/lib/stateMappings/simple.js +1 -0
- package/es/lib/stateMappings/singleIndex.js +1 -0
- package/es/lib/utils/createSendEventForFacet.js +12 -2
- package/es/lib/utils/createSendEventForHits.d.ts +8 -0
- package/es/lib/utils/createSendEventForHits.js +33 -11
- package/es/lib/utils/defer.d.ts +2 -2
- package/es/lib/utils/render-args.js +3 -2
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/middlewares/createInsightsMiddleware.d.ts +12 -12
- package/es/middlewares/createInsightsMiddleware.js +136 -34
- package/es/middlewares/createMetadataMiddleware.d.ts +3 -1
- package/es/middlewares/createMetadataMiddleware.js +17 -5
- package/es/middlewares/createRouterMiddleware.js +5 -1
- package/es/types/insights.d.ts +19 -1
- package/es/types/middleware.d.ts +22 -6
- package/es/types/router.d.ts +15 -7
- package/es/types/widget.d.ts +1 -1
- package/es/widgets/dynamic-widgets/dynamic-widgets.d.ts +2 -2
- package/es/widgets/geo-search/createHTMLMarker.d.ts +1 -1
- package/es/widgets/geo-search/geo-search.d.ts +1 -1
- package/es/widgets/hits/hits.js +2 -3
- package/es/widgets/hits-per-page/hits-per-page.js +3 -1
- package/es/widgets/index/index.d.ts +20 -20
- package/es/widgets/index/index.js +8 -8
- package/es/widgets/infinite-hits/infinite-hits.js +2 -3
- package/es/widgets/panel/panel.d.ts +2 -2
- package/es/widgets/range-slider/range-slider.d.ts +1 -1
- package/package.json +7 -7
|
@@ -6,6 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.createSendEventForFacet = createSendEventForFacet;
|
|
7
7
|
var _isFacetRefined = require("./isFacetRefined");
|
|
8
8
|
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); }
|
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
13
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
15
|
function createSendEventForFacet(_ref) {
|
|
10
16
|
var instantSearchInstance = _ref.instantSearchInstance,
|
|
11
17
|
helper = _ref.helper,
|
|
@@ -15,10 +21,13 @@ function createSendEventForFacet(_ref) {
|
|
|
15
21
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
16
22
|
args[_key] = arguments[_key];
|
|
17
23
|
}
|
|
18
|
-
var
|
|
19
|
-
facetValue = args[1],
|
|
24
|
+
var facetValue = args[1],
|
|
20
25
|
_args$ = args[2],
|
|
21
26
|
eventName = _args$ === void 0 ? 'Filter Applied' : _args$;
|
|
27
|
+
var _args$0$split = args[0].split(':'),
|
|
28
|
+
_args$0$split2 = _slicedToArray(_args$0$split, 2),
|
|
29
|
+
eventType = _args$0$split2[0],
|
|
30
|
+
eventModifier = _args$0$split2[1];
|
|
22
31
|
var attribute = typeof attr === 'string' ? attr : attr(facetValue);
|
|
23
32
|
if (args.length === 1 && _typeof(args[0]) === 'object') {
|
|
24
33
|
instantSearchInstance.sendEventToInsights(args[0]);
|
|
@@ -29,6 +38,7 @@ function createSendEventForFacet(_ref) {
|
|
|
29
38
|
insightsMethod: 'clickedFilters',
|
|
30
39
|
widgetType: widgetType,
|
|
31
40
|
eventType: eventType,
|
|
41
|
+
eventModifier: eventModifier,
|
|
32
42
|
payload: {
|
|
33
43
|
eventName: eventName,
|
|
34
44
|
index: helper.getIndex(),
|
|
@@ -3,9 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports._buildEventPayloadsForHits = _buildEventPayloadsForHits;
|
|
6
7
|
exports.createBindEventForHits = createBindEventForHits;
|
|
7
8
|
exports.createSendEventForHits = createSendEventForHits;
|
|
8
9
|
var _serializer = require("./serializer");
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
16
|
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); }
|
|
10
17
|
function chunk(arr) {
|
|
11
18
|
var chunkSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 20;
|
|
@@ -15,7 +22,7 @@ function chunk(arr) {
|
|
|
15
22
|
}
|
|
16
23
|
return chunks;
|
|
17
24
|
}
|
|
18
|
-
|
|
25
|
+
function _buildEventPayloadsForHits(_ref) {
|
|
19
26
|
var index = _ref.index,
|
|
20
27
|
widgetType = _ref.widgetType,
|
|
21
28
|
methodName = _ref.methodName,
|
|
@@ -25,7 +32,10 @@ var buildPayloads = function buildPayloads(_ref) {
|
|
|
25
32
|
if (args.length === 1 && _typeof(args[0]) === 'object') {
|
|
26
33
|
return [args[0]];
|
|
27
34
|
}
|
|
28
|
-
var
|
|
35
|
+
var _args$0$split = args[0].split(':'),
|
|
36
|
+
_args$0$split2 = _slicedToArray(_args$0$split, 2),
|
|
37
|
+
eventType = _args$0$split2[0],
|
|
38
|
+
eventModifier = _args$0$split2[1];
|
|
29
39
|
var hits = args[1];
|
|
30
40
|
var eventName = args[2];
|
|
31
41
|
if (!hits) {
|
|
@@ -72,7 +82,8 @@ var buildPayloads = function buildPayloads(_ref) {
|
|
|
72
82
|
index: index,
|
|
73
83
|
objectIDs: objectIDsByChunk[i]
|
|
74
84
|
},
|
|
75
|
-
hits: batch
|
|
85
|
+
hits: batch,
|
|
86
|
+
eventModifier: eventModifier
|
|
76
87
|
};
|
|
77
88
|
});
|
|
78
89
|
} else if (eventType === 'click') {
|
|
@@ -82,13 +93,14 @@ var buildPayloads = function buildPayloads(_ref) {
|
|
|
82
93
|
widgetType: widgetType,
|
|
83
94
|
eventType: eventType,
|
|
84
95
|
payload: {
|
|
85
|
-
eventName: eventName,
|
|
96
|
+
eventName: eventName || 'Hit Clicked',
|
|
86
97
|
index: index,
|
|
87
98
|
queryID: queryID,
|
|
88
99
|
objectIDs: objectIDsByChunk[i],
|
|
89
100
|
positions: positionsByChunk[i]
|
|
90
101
|
},
|
|
91
|
-
hits: batch
|
|
102
|
+
hits: batch,
|
|
103
|
+
eventModifier: eventModifier
|
|
92
104
|
};
|
|
93
105
|
});
|
|
94
106
|
} else if (eventType === 'conversion') {
|
|
@@ -98,12 +110,13 @@ var buildPayloads = function buildPayloads(_ref) {
|
|
|
98
110
|
widgetType: widgetType,
|
|
99
111
|
eventType: eventType,
|
|
100
112
|
payload: {
|
|
101
|
-
eventName: eventName,
|
|
113
|
+
eventName: eventName || 'Hit Converted',
|
|
102
114
|
index: index,
|
|
103
115
|
queryID: queryID,
|
|
104
116
|
objectIDs: objectIDsByChunk[i]
|
|
105
117
|
},
|
|
106
|
-
hits: batch
|
|
118
|
+
hits: batch,
|
|
119
|
+
eventModifier: eventModifier
|
|
107
120
|
};
|
|
108
121
|
});
|
|
109
122
|
} else if (process.env.NODE_ENV === 'development') {
|
|
@@ -111,16 +124,18 @@ var buildPayloads = function buildPayloads(_ref) {
|
|
|
111
124
|
} else {
|
|
112
125
|
return [];
|
|
113
126
|
}
|
|
114
|
-
}
|
|
127
|
+
}
|
|
115
128
|
function createSendEventForHits(_ref2) {
|
|
116
129
|
var instantSearchInstance = _ref2.instantSearchInstance,
|
|
117
130
|
index = _ref2.index,
|
|
118
131
|
widgetType = _ref2.widgetType;
|
|
132
|
+
var sentEvents = {};
|
|
133
|
+
var timer = undefined;
|
|
119
134
|
var sendEventForHits = function sendEventForHits() {
|
|
120
135
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
121
136
|
args[_key] = arguments[_key];
|
|
122
137
|
}
|
|
123
|
-
var payloads =
|
|
138
|
+
var payloads = _buildEventPayloadsForHits({
|
|
124
139
|
widgetType: widgetType,
|
|
125
140
|
index: index,
|
|
126
141
|
methodName: 'sendEvent',
|
|
@@ -128,8 +143,16 @@ function createSendEventForHits(_ref2) {
|
|
|
128
143
|
instantSearchInstance: instantSearchInstance
|
|
129
144
|
});
|
|
130
145
|
payloads.forEach(function (payload) {
|
|
131
|
-
|
|
146
|
+
if (payload.eventType === 'click' && payload.eventModifier === 'internal' && sentEvents[payload.eventType]) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
sentEvents[payload.eventType] = true;
|
|
150
|
+
instantSearchInstance.sendEventToInsights(payload);
|
|
132
151
|
});
|
|
152
|
+
clearTimeout(timer);
|
|
153
|
+
timer = setTimeout(function () {
|
|
154
|
+
sentEvents = {};
|
|
155
|
+
}, 0);
|
|
133
156
|
};
|
|
134
157
|
return sendEventForHits;
|
|
135
158
|
}
|
|
@@ -141,7 +164,7 @@ function createBindEventForHits(_ref3) {
|
|
|
141
164
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
142
165
|
args[_key2] = arguments[_key2];
|
|
143
166
|
}
|
|
144
|
-
var payloads =
|
|
167
|
+
var payloads = _buildEventPayloadsForHits({
|
|
145
168
|
widgetType: widgetType,
|
|
146
169
|
index: index,
|
|
147
170
|
methodName: 'bindEvent',
|
|
@@ -26,13 +26,14 @@ function createInitArgs(instantSearchInstance, parent, uiState) {
|
|
|
26
26
|
}
|
|
27
27
|
function createRenderArgs(instantSearchInstance, parent) {
|
|
28
28
|
var results = parent.getResults();
|
|
29
|
+
var helper = parent.getHelper();
|
|
29
30
|
return {
|
|
30
|
-
helper:
|
|
31
|
+
helper: helper,
|
|
31
32
|
parent: parent,
|
|
32
33
|
instantSearchInstance: instantSearchInstance,
|
|
33
34
|
results: results,
|
|
34
35
|
scopedResults: parent.getScopedResults(),
|
|
35
|
-
state: results._state,
|
|
36
|
+
state: results ? results._state : helper.state,
|
|
36
37
|
renderState: instantSearchInstance.renderState,
|
|
37
38
|
templatesConfig: instantSearchInstance.templatesConfig,
|
|
38
39
|
createURL: parent.createURL,
|
package/cjs/lib/version.js
CHANGED
|
@@ -14,35 +14,69 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
14
14
|
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); }
|
|
15
15
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
16
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
19
17
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
20
18
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
19
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
20
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
21
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
22
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
23
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
24
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
25
|
+
var ALGOLIA_INSIGHTS_VERSION = '2.6.0';
|
|
26
|
+
var ALGOLIA_INSIGHTS_SRC = "https://cdn.jsdelivr.net/npm/search-insights@".concat(ALGOLIA_INSIGHTS_VERSION, "/dist/search-insights.min.js");
|
|
27
|
+
function createInsightsMiddleware() {
|
|
28
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
29
|
+
var _insightsClient = props.insightsClient,
|
|
30
|
+
insightsInitParams = props.insightsInitParams,
|
|
31
|
+
onEvent = props.onEvent,
|
|
32
|
+
_props$$$internal = props.$$internal,
|
|
33
|
+
$$internal = _props$$$internal === void 0 ? false : _props$$$internal;
|
|
34
|
+
var potentialInsightsClient = _insightsClient;
|
|
35
|
+
if (!_insightsClient && _insightsClient !== null) {
|
|
36
|
+
(0, _utils.safelyRunOnBrowser)(function (_ref) {
|
|
37
|
+
var window = _ref.window;
|
|
38
|
+
var pointer = window.AlgoliaAnalyticsObject || 'aa';
|
|
39
|
+
if (typeof pointer === 'string') {
|
|
40
|
+
potentialInsightsClient = window[pointer];
|
|
41
|
+
}
|
|
42
|
+
if (!potentialInsightsClient) {
|
|
43
|
+
window.AlgoliaAnalyticsObject = pointer;
|
|
44
|
+
if (!window[pointer]) {
|
|
45
|
+
window[pointer] = function () {
|
|
46
|
+
if (!window[pointer].queue) {
|
|
47
|
+
window[pointer].queue = [];
|
|
48
|
+
}
|
|
49
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
50
|
+
args[_key] = arguments[_key];
|
|
51
|
+
}
|
|
52
|
+
window[pointer].queue.push(args);
|
|
53
|
+
};
|
|
54
|
+
window[pointer].version = ALGOLIA_INSIGHTS_VERSION;
|
|
55
|
+
window[pointer].shouldAddScript = true;
|
|
56
|
+
}
|
|
57
|
+
potentialInsightsClient = window[pointer];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
32
60
|
}
|
|
33
|
-
|
|
34
|
-
var insightsClient =
|
|
61
|
+
// if still no insightsClient was found, we use a noop
|
|
62
|
+
var insightsClient = potentialInsightsClient || _utils.noop;
|
|
35
63
|
return function (_ref2) {
|
|
36
64
|
var instantSearchInstance = _ref2.instantSearchInstance;
|
|
65
|
+
// remove existing default insights middleware
|
|
66
|
+
// user-provided insights middleware takes precedence
|
|
67
|
+
var existingInsightsMiddlewares = instantSearchInstance.middleware.filter(function (m) {
|
|
68
|
+
return m.instance.$$type === 'ais.insights' && m.instance.$$internal;
|
|
69
|
+
}).map(function (m) {
|
|
70
|
+
return m.creator;
|
|
71
|
+
});
|
|
72
|
+
instantSearchInstance.unuse.apply(instantSearchInstance, _toConsumableArray(existingInsightsMiddlewares));
|
|
37
73
|
var _getAppIdAndApiKey = (0, _utils.getAppIdAndApiKey)(instantSearchInstance.client),
|
|
38
74
|
_getAppIdAndApiKey2 = _slicedToArray(_getAppIdAndApiKey, 2),
|
|
39
75
|
appId = _getAppIdAndApiKey2[0],
|
|
40
76
|
apiKey = _getAppIdAndApiKey2[1];
|
|
41
77
|
|
|
42
78
|
// search-insights.js also throws an error so dev-only clarification is sufficient
|
|
43
|
-
|
|
44
|
-
throw new Error('[insights middleware]: could not extract Algolia credentials from searchClient');
|
|
45
|
-
}
|
|
79
|
+
process.env.NODE_ENV === 'development' ? (0, _utils.warning)(Boolean(appId && apiKey), 'could not extract Algolia credentials from searchClient in insights middleware.') : void 0;
|
|
46
80
|
var queuedUserToken = undefined;
|
|
47
81
|
var userTokenBeforeInit = undefined;
|
|
48
82
|
if (Array.isArray(insightsClient.queue)) {
|
|
@@ -72,15 +106,39 @@ function createInsightsMiddleware(props) {
|
|
|
72
106
|
// Otherwise, the `init` call might override it with anonymous user token.
|
|
73
107
|
userTokenBeforeInit = userToken;
|
|
74
108
|
});
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
109
|
+
|
|
110
|
+
// Only `init` if the `insightsInitParams` option is passed or
|
|
111
|
+
// if the `insightsClient` version doesn't supports optional `init` calling.
|
|
112
|
+
if (insightsInitParams || !isModernInsightsClient(insightsClient)) {
|
|
113
|
+
insightsClient('init', _objectSpread({
|
|
114
|
+
appId: appId,
|
|
115
|
+
apiKey: apiKey,
|
|
116
|
+
partial: true
|
|
117
|
+
}, insightsInitParams));
|
|
118
|
+
}
|
|
79
119
|
var initialParameters;
|
|
80
120
|
var helper;
|
|
81
121
|
return {
|
|
122
|
+
$$type: 'ais.insights',
|
|
123
|
+
$$internal: $$internal,
|
|
82
124
|
onStateChange: function onStateChange() {},
|
|
83
|
-
subscribe: function subscribe() {
|
|
125
|
+
subscribe: function subscribe() {
|
|
126
|
+
if (!insightsClient.shouldAddScript) return;
|
|
127
|
+
var errorMessage = '[insights middleware]: could not load search-insights.js. Please load it manually following https://alg.li/insights-init';
|
|
128
|
+
try {
|
|
129
|
+
var script = document.createElement('script');
|
|
130
|
+
script.async = true;
|
|
131
|
+
script.src = ALGOLIA_INSIGHTS_SRC;
|
|
132
|
+
script.onerror = function () {
|
|
133
|
+
instantSearchInstance.emit('error', new Error(errorMessage));
|
|
134
|
+
};
|
|
135
|
+
document.body.appendChild(script);
|
|
136
|
+
insightsClient.shouldAddScript = false;
|
|
137
|
+
} catch (cause) {
|
|
138
|
+
insightsClient.shouldAddScript = false;
|
|
139
|
+
instantSearchInstance.emit('error', new Error(errorMessage));
|
|
140
|
+
}
|
|
141
|
+
},
|
|
84
142
|
started: function started() {
|
|
85
143
|
insightsClient('addAlgoliaAgent', 'insights-middleware');
|
|
86
144
|
helper = instantSearchInstance.helper;
|
|
@@ -91,15 +149,23 @@ function createInsightsMiddleware(props) {
|
|
|
91
149
|
helper.overrideStateWithoutTriggeringChangeEvent(_objectSpread(_objectSpread({}, helper.state), {}, {
|
|
92
150
|
clickAnalytics: true
|
|
93
151
|
}));
|
|
94
|
-
|
|
152
|
+
if (!$$internal) {
|
|
153
|
+
instantSearchInstance.scheduleSearch();
|
|
154
|
+
}
|
|
95
155
|
var setUserTokenToSearch = function setUserTokenToSearch(userToken) {
|
|
156
|
+
if (!userToken) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
var existingToken = helper.state.userToken;
|
|
96
160
|
helper.overrideStateWithoutTriggeringChangeEvent(_objectSpread(_objectSpread({}, helper.state), {}, {
|
|
97
161
|
userToken: userToken
|
|
98
162
|
}));
|
|
99
|
-
|
|
163
|
+
if (existingToken && existingToken !== userToken) {
|
|
164
|
+
instantSearchInstance.scheduleSearch();
|
|
165
|
+
}
|
|
100
166
|
};
|
|
101
167
|
var anonymousUserToken = (0, _helpers.getInsightsAnonymousUserTokenInternal)();
|
|
102
|
-
if (
|
|
168
|
+
if (anonymousUserToken) {
|
|
103
169
|
// When `aa('init', { ... })` is called, it creates an anonymous user token in cookie.
|
|
104
170
|
// We can set it as userToken.
|
|
105
171
|
setUserTokenToSearch(anonymousUserToken);
|
|
@@ -108,8 +174,10 @@ function createInsightsMiddleware(props) {
|
|
|
108
174
|
// We consider the `userToken` coming from a `init` call to have a higher
|
|
109
175
|
// importance than the one coming from the queue.
|
|
110
176
|
if (userTokenBeforeInit) {
|
|
177
|
+
setUserTokenToSearch(userTokenBeforeInit);
|
|
111
178
|
insightsClient('setUserToken', userTokenBeforeInit);
|
|
112
179
|
} else if (queuedUserToken) {
|
|
180
|
+
setUserTokenToSearch(queuedUserToken);
|
|
113
181
|
insightsClient('setUserToken', queuedUserToken);
|
|
114
182
|
}
|
|
115
183
|
|
|
@@ -117,16 +185,31 @@ function createInsightsMiddleware(props) {
|
|
|
117
185
|
insightsClient('onUserTokenChange', setUserTokenToSearch, {
|
|
118
186
|
immediate: true
|
|
119
187
|
});
|
|
188
|
+
var insightsClientWithLocalCredentials = insightsClient;
|
|
189
|
+
if (isModernInsightsClient(insightsClient)) {
|
|
190
|
+
insightsClientWithLocalCredentials = function insightsClientWithLocalCredentials(method, payload) {
|
|
191
|
+
var extraParams = {
|
|
192
|
+
headers: {
|
|
193
|
+
'X-Algolia-Application-Id': appId,
|
|
194
|
+
'X-Algolia-API-Key': apiKey
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
// @ts-ignore we are calling this only when we know that the client actually is correct
|
|
199
|
+
return insightsClient(method, payload, extraParams);
|
|
200
|
+
};
|
|
201
|
+
}
|
|
120
202
|
instantSearchInstance.sendEventToInsights = function (event) {
|
|
121
203
|
if (onEvent) {
|
|
122
|
-
onEvent(event,
|
|
204
|
+
onEvent(event, insightsClientWithLocalCredentials);
|
|
123
205
|
} else if (event.insightsMethod) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
process.env.NODE_ENV === 'development' ? (0, _utils.warning)(false, "\nCannot send event to Algolia Insights because `userToken` is not set.\n\nSee documentation: https://www.algolia.com/doc/guides/building-search-ui/going-further/send-insights-events/js/#setting-the-usertoken\n") : void 0;
|
|
206
|
+
// Source is used to differentiate events sent by instantsearch from those sent manually.
|
|
207
|
+
event.payload.algoliaSource = ['instantsearch'];
|
|
208
|
+
if (event.eventModifier === 'internal') {
|
|
209
|
+
event.payload.algoliaSource.push('instantsearch-internal');
|
|
129
210
|
}
|
|
211
|
+
insightsClientWithLocalCredentials(event.insightsMethod, event.payload);
|
|
212
|
+
process.env.NODE_ENV === 'development' ? (0, _utils.warning)(Boolean(helper.state.userToken), "\nCannot send event to Algolia Insights because `userToken` is not set.\n\nSee documentation: https://www.algolia.com/doc/guides/building-search-ui/going-further/send-insights-events/js/#setting-the-usertoken\n") : void 0;
|
|
130
213
|
} else {
|
|
131
214
|
process.env.NODE_ENV === 'development' ? (0, _utils.warning)(false, 'Cannot send event to Algolia Insights because `insightsMethod` option is missing.') : void 0;
|
|
132
215
|
}
|
|
@@ -136,10 +219,29 @@ function createInsightsMiddleware(props) {
|
|
|
136
219
|
insightsClient('onUserTokenChange', undefined);
|
|
137
220
|
instantSearchInstance.sendEventToInsights = _utils.noop;
|
|
138
221
|
if (helper && initialParameters) {
|
|
139
|
-
helper.
|
|
222
|
+
helper.overrideStateWithoutTriggeringChangeEvent(_objectSpread(_objectSpread({}, helper.state), initialParameters));
|
|
140
223
|
instantSearchInstance.scheduleSearch();
|
|
141
224
|
}
|
|
142
225
|
}
|
|
143
226
|
};
|
|
144
227
|
};
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Determines if a given insights `client` supports the optional call to `init`
|
|
232
|
+
* and the ability to set credentials via extra parameters when sending events.
|
|
233
|
+
*/
|
|
234
|
+
function isModernInsightsClient(client) {
|
|
235
|
+
var _split$map = (client.version || '').split('.').map(Number),
|
|
236
|
+
_split$map2 = _slicedToArray(_split$map, 2),
|
|
237
|
+
major = _split$map2[0],
|
|
238
|
+
minor = _split$map2[1];
|
|
239
|
+
|
|
240
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
241
|
+
var v3 = major >= 3;
|
|
242
|
+
var v2_6 = major === 2 && minor >= 6;
|
|
243
|
+
var v1_10 = major === 1 && minor >= 10;
|
|
244
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
245
|
+
|
|
246
|
+
return v3 || v2_6 || v1_10;
|
|
145
247
|
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.createMetadataMiddleware = createMetadataMiddleware;
|
|
7
7
|
exports.isMetadataEnabled = isMetadataEnabled;
|
|
8
8
|
var _utils = require("../lib/utils");
|
|
9
|
-
function
|
|
9
|
+
function extractWidgetPayload(widgets, instantSearchInstance, payload) {
|
|
10
10
|
var initOptions = (0, _utils.createInitArgs)(instantSearchInstance, instantSearchInstance.mainIndex, instantSearchInstance._initialUiState);
|
|
11
11
|
widgets.forEach(function (widget) {
|
|
12
12
|
var widgetParams = {};
|
|
@@ -28,7 +28,7 @@ function extractPayload(widgets, instantSearchInstance, payload) {
|
|
|
28
28
|
params: params
|
|
29
29
|
});
|
|
30
30
|
if (widget.$$type === 'ais.index') {
|
|
31
|
-
|
|
31
|
+
extractWidgetPayload(widget.getWidgets(), instantSearchInstance, payload);
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -52,8 +52,11 @@ function isMetadataEnabled() {
|
|
|
52
52
|
* - connector name
|
|
53
53
|
*/
|
|
54
54
|
function createMetadataMiddleware() {
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
56
|
+
_ref2$$$internal = _ref2.$$internal,
|
|
57
|
+
$$internal = _ref2$$$internal === void 0 ? false : _ref2$$$internal;
|
|
58
|
+
return function (_ref3) {
|
|
59
|
+
var instantSearchInstance = _ref3.instantSearchInstance;
|
|
57
60
|
var payload = {
|
|
58
61
|
widgets: []
|
|
59
62
|
};
|
|
@@ -61,13 +64,22 @@ function createMetadataMiddleware() {
|
|
|
61
64
|
var refNode = document.querySelector('head');
|
|
62
65
|
payloadContainer.name = 'instantsearch:widgets';
|
|
63
66
|
return {
|
|
67
|
+
$$type: 'ais.metadata',
|
|
68
|
+
$$internal: $$internal,
|
|
64
69
|
onStateChange: function onStateChange() {},
|
|
65
70
|
subscribe: function subscribe() {
|
|
66
71
|
// using setTimeout here to delay extraction until widgets have been added in a tick (e.g. Vue)
|
|
67
72
|
setTimeout(function () {
|
|
68
73
|
var client = instantSearchInstance.client;
|
|
69
74
|
payload.ua = client.transporter && client.transporter.userAgent ? client.transporter.userAgent.value : client._ua;
|
|
70
|
-
|
|
75
|
+
extractWidgetPayload(instantSearchInstance.mainIndex.getWidgets(), instantSearchInstance, payload);
|
|
76
|
+
instantSearchInstance.middleware.forEach(function (middleware) {
|
|
77
|
+
return payload.widgets.push({
|
|
78
|
+
middleware: true,
|
|
79
|
+
type: middleware.instance.$$type,
|
|
80
|
+
internal: middleware.instance.$$internal
|
|
81
|
+
});
|
|
82
|
+
});
|
|
71
83
|
payloadContainer.content = JSON.stringify(payload);
|
|
72
84
|
refNode.appendChild(payloadContainer);
|
|
73
85
|
}, 0);
|
|
@@ -19,7 +19,9 @@ var createRouterMiddleware = function createRouterMiddleware() {
|
|
|
19
19
|
var _props$router = props.router,
|
|
20
20
|
router = _props$router === void 0 ? (0, _history.default)() : _props$router,
|
|
21
21
|
_props$stateMapping = props.stateMapping,
|
|
22
|
-
stateMapping = _props$stateMapping === void 0 ? (0, _simple.default)() : _props$stateMapping
|
|
22
|
+
stateMapping = _props$stateMapping === void 0 ? (0, _simple.default)() : _props$stateMapping,
|
|
23
|
+
_props$$$internal = props.$$internal,
|
|
24
|
+
$$internal = _props$$$internal === void 0 ? false : _props$$$internal;
|
|
23
25
|
return function (_ref) {
|
|
24
26
|
var instantSearchInstance = _ref.instantSearchInstance;
|
|
25
27
|
function topLevelCreateURL(nextState) {
|
|
@@ -36,6 +38,8 @@ var createRouterMiddleware = function createRouterMiddleware() {
|
|
|
36
38
|
var lastRouteState = undefined;
|
|
37
39
|
var initialUiState = instantSearchInstance._initialUiState;
|
|
38
40
|
return {
|
|
41
|
+
$$type: "ais.router({router:".concat(router.$$type || '__unknown__', ", stateMapping:").concat(stateMapping.$$type || '__unknown__', "})"),
|
|
42
|
+
$$internal: $$internal,
|
|
39
43
|
onStateChange: function onStateChange(_ref2) {
|
|
40
44
|
var uiState = _ref2.uiState;
|
|
41
45
|
var routeState = stateMapping.stateToRoute(uiState);
|
package/cjs/widgets/hits/hits.js
CHANGED
|
@@ -24,7 +24,6 @@ var withUsage = (0, _utils.createDocumentationMessageGenerator)({
|
|
|
24
24
|
name: 'hits'
|
|
25
25
|
});
|
|
26
26
|
var suit = (0, _suit.component)('Hits');
|
|
27
|
-
var HitsWithInsightsListener = (0, _insights.withInsightsListener)(_Hits.default);
|
|
28
27
|
var renderer = function renderer(_ref) {
|
|
29
28
|
var renderState = _ref.renderState,
|
|
30
29
|
cssClasses = _ref.cssClasses,
|
|
@@ -45,7 +44,7 @@ var renderer = function renderer(_ref) {
|
|
|
45
44
|
});
|
|
46
45
|
return;
|
|
47
46
|
}
|
|
48
|
-
(0, _preact.render)((0, _preact.h)(
|
|
47
|
+
(0, _preact.render)((0, _preact.h)(_Hits.default, {
|
|
49
48
|
cssClasses: cssClasses,
|
|
50
49
|
hits: receivedHits,
|
|
51
50
|
results: results,
|
|
@@ -38,7 +38,9 @@ var renderer = function renderer(_ref) {
|
|
|
38
38
|
}, (0, _preact.h)(_Selector.default, {
|
|
39
39
|
cssClasses: cssClasses,
|
|
40
40
|
currentValue: currentValue,
|
|
41
|
-
options: items
|
|
41
|
+
options: items
|
|
42
|
+
// @ts-expect-error: the refine function expects a number, but setValue will call it with a string. We don't want to change the type of the refine function because it's part of the connector API.
|
|
43
|
+
,
|
|
42
44
|
setValue: refine
|
|
43
45
|
})), containerNode);
|
|
44
46
|
};
|
|
@@ -339,7 +339,7 @@ var index = function index(widgetParams) {
|
|
|
339
339
|
// does not have access to lastResults, which it used to in pre-federated
|
|
340
340
|
// search behavior.
|
|
341
341
|
helper.lastResults = results;
|
|
342
|
-
lastValidSearchParameters = results._state;
|
|
342
|
+
lastValidSearchParameters = results === null || results === void 0 ? void 0 : results._state;
|
|
343
343
|
});
|
|
344
344
|
|
|
345
345
|
// We compute the render state before calling `init` in a separate loop
|
|
@@ -395,16 +395,16 @@ var index = function index(widgetParams) {
|
|
|
395
395
|
render: function render(_ref5) {
|
|
396
396
|
var _this4 = this;
|
|
397
397
|
var instantSearchInstance = _ref5.instantSearchInstance;
|
|
398
|
-
if (!this.getResults()) {
|
|
399
|
-
return;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
398
|
// we can't attach a listener to the error event of search, as the error
|
|
403
399
|
// then would no longer be thrown for global handlers.
|
|
404
|
-
if (instantSearchInstance.status === 'error' && !instantSearchInstance.mainHelper.hasPendingRequests()) {
|
|
400
|
+
if (instantSearchInstance.status === 'error' && !instantSearchInstance.mainHelper.hasPendingRequests() && lastValidSearchParameters) {
|
|
405
401
|
helper.setState(lastValidSearchParameters);
|
|
406
402
|
}
|
|
407
|
-
|
|
403
|
+
|
|
404
|
+
// We only render index widgets if there are no results.
|
|
405
|
+
// This makes sure `render` is never called with `results` being `null`.
|
|
406
|
+
var widgetsToRender = this.getResults() ? localWidgets : localWidgets.filter(_utils.isIndexWidget);
|
|
407
|
+
widgetsToRender.forEach(function (widget) {
|
|
408
408
|
if (widget.getRenderState) {
|
|
409
409
|
var renderState = widget.getRenderState(instantSearchInstance.renderState[_this4.getIndexId()] || {}, (0, _utils.createRenderArgs)(instantSearchInstance, _this4));
|
|
410
410
|
storeRenderState({
|
|
@@ -414,7 +414,7 @@ var index = function index(widgetParams) {
|
|
|
414
414
|
});
|
|
415
415
|
}
|
|
416
416
|
});
|
|
417
|
-
|
|
417
|
+
widgetsToRender.forEach(function (widget) {
|
|
418
418
|
// At this point, all the variables used below are set. Both `helper`
|
|
419
419
|
// and `derivedHelper` have been created at the `init` step. The attribute
|
|
420
420
|
// `lastResults` might be `null` though. It's possible that a stalled render
|
|
@@ -24,7 +24,6 @@ var withUsage = (0, _utils.createDocumentationMessageGenerator)({
|
|
|
24
24
|
name: 'infinite-hits'
|
|
25
25
|
});
|
|
26
26
|
var suit = (0, _suit.component)('InfiniteHits');
|
|
27
|
-
var InfiniteHitsWithInsightsListener = (0, _insights.withInsightsListener)(_InfiniteHits.default);
|
|
28
27
|
var renderer = function renderer(_ref) {
|
|
29
28
|
var containerNode = _ref.containerNode,
|
|
30
29
|
cssClasses = _ref.cssClasses,
|
|
@@ -50,7 +49,7 @@ var renderer = function renderer(_ref) {
|
|
|
50
49
|
});
|
|
51
50
|
return;
|
|
52
51
|
}
|
|
53
|
-
(0, _preact.render)((0, _preact.h)(
|
|
52
|
+
(0, _preact.render)((0, _preact.h)(_InfiniteHits.default, {
|
|
54
53
|
cssClasses: cssClasses,
|
|
55
54
|
hits: hits,
|
|
56
55
|
results: results,
|