Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(insights): set algolia credentials per event when supported #1120

Merged

Conversation

dhayab
Copy link
Member

@dhayab dhayab commented Apr 11, 2023

This PR sends events with additional parameters containing Algolia credentials, when the Insights client supports it.

Now, when the Insights client version supports it, we send events with an additional parameter that contain Algolia credentials relevant to the items. This makes it possible to have different Algolia sources that each send events to their corresponding Insights endpoints.

All relevant methods of the Insights API we provide (on top of the Insights client) are updated to require an items property in their payload, instead of the now deprecated objectIDs property.

FX-2277

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 11, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 0650ea1:

Sandbox Source
@algolia/autocomplete-example-github-repositories-custom-plugin Configuration
@algolia/autocomplete-example-instantsearch Configuration
@algolia/autocomplete-example-playground Configuration
@algolia/autocomplete-example-preview-panel-in-modal Configuration
@algolia/autocomplete-example-react-renderer Configuration
@algolia/autocomplete-example-starter-algolia Configuration
@algolia/autocomplete-example-starter Configuration
@algolia/autocomplete-example-reshape Configuration
@algolia/autocomplete-example-vue Configuration

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All object-based event methods are updated to accept items instead of objectIDs, from which we can retrieve the relevant Algolia credentials to craft the additional parameters that are then sent with the event payload.

Facet/filter-based event methods are not touched, as we don't have a use for them in the context of Autocomplete.

@dhayab dhayab marked this pull request as ready for review April 12, 2023 09:26
@dhayab dhayab requested review from a team, FabienMotte and sarahdayan and removed request for a team April 12, 2023 09:26
@dhayab dhayab force-pushed the feat/automatic-events-additional-parameters branch from bd24f5f to 1b133b9 Compare April 13, 2023 08:41
Copy link
Contributor

@FabienMotte FabienMotte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, nice work! 👏

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you highlight what changed? Since there was a file rename the diff shows everything as new.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, this should give you the changes before the file rename: e446d48#diff-9d876eb2a027f19903ce6ce0aa98bca3222a13857a61eb1751dfd11eda392552.

@dhayab dhayab requested review from sarahdayan, Haroenv and aymeric-giraudet and removed request for sarahdayan April 17, 2023 16:43
Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems logical, let's go!

@dhayab dhayab merged commit 4f85da4 into feat/automatic-events Apr 18, 2023
@dhayab dhayab deleted the feat/automatic-events-additional-parameters branch April 18, 2023 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants