You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `insightsClient` prop is a remnant of an older implementation of insights, and no longer is needed. In this PR it's removed.
BREAKING CHANGE: use `insights` prop of instantsearch instead of `insightsClient`
it('throws if insightsClient is not a function',()=>{
161
-
constwarn=jest.spyOn(global.console,'warn');
162
-
warn.mockImplementation(()=>{});
163
-
164
-
expect(()=>{
165
-
// eslint-disable-next-line no-new
166
-
newInstantSearch({
167
-
indexName: 'indexName',
168
-
searchClient: createSearchClient(),
169
-
// @ts-expect-error
170
-
insightsClient: 'insights',
171
-
});
172
-
}).toThrowErrorMatchingInlineSnapshot(`
173
-
"The \`insightsClient\` option should be a function.
174
-
175
-
See documentation: https://www.algolia.com/doc/api-reference/widgets/instantsearch/js/"
176
-
`);
177
-
});
178
-
179
160
it('throws if addWidgets is called with a single widget',()=>{
180
161
expect(()=>{
181
162
constsearch=newInstantSearch({
@@ -311,27 +292,6 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/instantsear
311
292
}).not.toWarnDev();
312
293
});
313
294
314
-
it('warns dev when insightsClient is given',()=>{
315
-
constsearchClient=createSearchClient({
316
-
addAlgoliaAgent: jest.fn(),
317
-
});
318
-
constwarn=jest.spyOn(global.console,'warn');
319
-
warn.mockImplementation(()=>{});
320
-
321
-
expect(()=>{
322
-
// eslint-disable-next-line no-new
323
-
newInstantSearch({
324
-
indexName: 'indexName',
325
-
searchClient,
326
-
insightsClient: ()=>{},
327
-
});
328
-
}).toWarnDev(
329
-
`[InstantSearch]: \`insightsClient\` property has been deprecated. It is still supported in 4.x releases, but not further. It is replaced by the \`insights\` middleware.
330
-
331
-
For more information, visit https://www.algolia.com/doc/guides/getting-insights-and-analytics/search-analytics/click-through-and-conversions/how-to/send-click-and-conversion-events-with-instantsearch/js/`
332
-
);
333
-
});
334
-
335
295
it('accepts middleware with partial methods',()=>{
336
296
constsearch=newInstantSearch({
337
297
indexName: 'indexName',
@@ -415,17 +375,6 @@ search.addWidgets([
415
375
See https://www.algolia.com/doc/api-reference/widgets/configure/js/`);
416
376
});
417
377
418
-
it('does store insightsClient on the instance',()=>{
`\`insightsClient\` property has been deprecated. It is still supported in 4.x releases, but not further. It is replaced by the \`insights\` middleware.
144
-
145
-
For more information, visit https://www.algolia.com/doc/guides/getting-insights-and-analytics/search-analytics/click-through-and-conversions/how-to/send-click-and-conversion-events-with-instantsearch/js/`
@@ -93,13 +90,6 @@ export type InstantSearchOptions<
93
90
* @default false
94
91
*/
95
92
insights?: InsightsProps|boolean;
96
-
/**
97
-
* the instance of search-insights to use for sending insights events inside
98
-
* widgets like `hits`.
99
-
*
100
-
* @deprecated This property will be still supported in 4.x releases, but not further. It is replaced by the `insights` middleware. For more information, visit https://www.algolia.com/doc/guides/getting-insights-and-analytics/search-analytics/click-through-and-conversions/how-to/send-click-and-conversion-events-with-instantsearch/js/
101
-
*/
102
-
insightsClient?: AlgoliaInsightsClient;
103
93
future?: {
104
94
/**
105
95
* Changes the way `dispose` is used in InstantSearch lifecycle.
0 commit comments