-
Notifications
You must be signed in to change notification settings - Fork 332
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(insights): set algolia credentials per event when supported
- Loading branch information
Showing
7 changed files
with
151 additions
and
27 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
20 changes: 13 additions & 7 deletions
20
packages/autocomplete-plugin-algolia-insights/src/createViewedEvents.ts
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
13 changes: 13 additions & 0 deletions
13
packages/autocomplete-plugin-algolia-insights/src/isModernInsightsClient.ts
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,13 @@ | ||
import type { InsightsClient } from './types'; | ||
|
||
export function isModernInsightsClient(client: InsightsClient): boolean { | ||
const [major, minor] = (client.version || '').split('.').map(Number); | ||
|
||
/* eslint-disable @typescript-eslint/camelcase */ | ||
const v3 = major >= 3; | ||
const v2_4 = major === 2 && minor >= 4; | ||
const v1_10 = major === 1 && minor >= 10; | ||
|
||
return v3 || v2_4 || v1_10; | ||
/* eslint-enable @typescript-eslint/camelcase */ | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/autocomplete-plugin-algolia-insights/src/types/AutocompleteInsightsApi.ts
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