-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(insights): show deprecation warnings for old insights related pro…
…perties and functions (#4524) * chore(deprecate): show deprecation warnings for old insights related properties and functions * Update src/helpers/get-insights-anonymous-user-token.ts Co-authored-by: François Chalifour <[email protected]> * update error message * add more warnings * add migration guide for analytics widget Co-authored-by: François Chalifour <[email protected]>
- Loading branch information
1 parent
71ebada
commit c93e1cf
Showing
12 changed files
with
166 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import withInsights from '../client'; | ||
import { warning } from '../../utils'; | ||
|
||
describe('withInsights', () => { | ||
it('shows a deprecation warning', () => { | ||
warning.cache = {}; | ||
|
||
const renderer = ({ insights }) => { | ||
insights('convertedObjectIDsAfterSearch', { | ||
objectIDs: ['1'], | ||
eventName: 'Add to basket', | ||
}); | ||
}; | ||
const connector = renderFn => () => ({ | ||
init() { | ||
renderFn({ | ||
results: {}, | ||
hits: [ | ||
{ objectID: '1', __queryID: 'theQueryID', __position: 9 }, | ||
{ objectID: '2', __queryID: 'theQueryID', __position: 10 }, | ||
{ objectID: '3', __queryID: 'theQueryID', __position: 11 }, | ||
{ objectID: '4', __queryID: 'theQueryID', __position: 12 }, | ||
], | ||
instantSearchInstance: { insightsClient: () => {} }, | ||
}); | ||
}, | ||
}); | ||
const makeWidget = withInsights(connector)(renderer); | ||
const widget = makeWidget(); | ||
expect(() => { | ||
widget.init(); | ||
}).toWarnDev( | ||
`[InstantSearch.js]: \`insights\` function has been deprecated. It is 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/` | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters