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`
`\`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.
it('throws if insightsClient is not a function',()=>{
160
-
constwarn=jest.spyOn(global.console,'warn');
161
-
warn.mockImplementation(()=>{});
162
-
163
-
expect(()=>{
164
-
// eslint-disable-next-line no-new
165
-
newInstantSearch({
166
-
indexName: 'indexName',
167
-
searchClient: createSearchClient(),
168
-
// @ts-expect-error
169
-
insightsClient: 'insights',
170
-
});
171
-
}).toThrowErrorMatchingInlineSnapshot(`
172
-
"The \`insightsClient\` option should be a function.
173
-
174
-
See documentation: https://www.algolia.com/doc/api-reference/widgets/instantsearch/js/"
175
-
`);
176
-
});
177
-
178
159
it('throws if addWidgets is called with a single widget',()=>{
179
160
expect(()=>{
180
161
constsearch=newInstantSearch({
@@ -310,27 +291,6 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/instantsear
310
291
}).not.toWarnDev();
311
292
});
312
293
313
-
it('warns dev when insightsClient is given',()=>{
314
-
constsearchClient=createSearchClient({
315
-
addAlgoliaAgent: jest.fn(),
316
-
});
317
-
constwarn=jest.spyOn(global.console,'warn');
318
-
warn.mockImplementation(()=>{});
319
-
320
-
expect(()=>{
321
-
// eslint-disable-next-line no-new
322
-
newInstantSearch({
323
-
indexName: 'indexName',
324
-
searchClient,
325
-
insightsClient: ()=>{},
326
-
});
327
-
}).toWarnDev(
328
-
`[InstantSearch]: \`insightsClient\` property has been deprecated. It is still supported in 4.x releases, but not further. It is replaced by the \`insights\` middleware.
329
-
330
-
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/`
331
-
);
332
-
});
333
-
334
294
it('accepts middleware with partial methods',()=>{
335
295
constsearch=newInstantSearch({
336
296
indexName: 'indexName',
@@ -417,17 +377,6 @@ search.addWidgets([
417
377
See https://www.algolia.com/doc/api-reference/widgets/configure/js/`);
418
378
});
419
379
420
-
it('does store insightsClient on the instance',()=>{
0 commit comments