This repository has been archived by the owner on Jun 11, 2021. It is now read-only.
forked from algolia/autocomplete
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(react): attach Algolia agents in React renderer
- Loading branch information
1 parent
9b758ee
commit c6c4da5
Showing
13 changed files
with
133 additions
and
88 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -29,8 +29,5 @@ | |
"sideEffects": false, | ||
"files": [ | ||
"dist/" | ||
], | ||
"devDependencies": { | ||
"rollup-plugin-filesize": "6.2.1" | ||
} | ||
] | ||
} |
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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,2 @@ | ||
declare const __DEV__: boolean; | ||
declare const __VERSION__: boolean; |
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,17 @@ | ||
import { getAlgoliaHits as originalGetAlgoliaHits } from '@francoischalifour/autocomplete-preset-algolia'; | ||
|
||
type SearchClient = any; | ||
type SearchParameters = any; | ||
|
||
interface GetAlgoliaSourceParams { | ||
searchClient: SearchClient; | ||
queries: SearchParameters[]; | ||
} | ||
|
||
export function getAlgoliaHits(params: GetAlgoliaSourceParams) { | ||
if (typeof params.searchClient.addAlgoliaAgent === 'function') { | ||
params.searchClient.addAlgoliaAgent(`autocomplete-react (${__VERSION__})`); | ||
} | ||
|
||
return originalGetAlgoliaHits(params); | ||
} |
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,17 @@ | ||
import { getAlgoliaResults as originalGetAlgoliaResults } from '@francoischalifour/autocomplete-preset-algolia'; | ||
|
||
type SearchClient = any; | ||
type SearchParameters = any; | ||
|
||
interface GetAlgoliaSourceParams { | ||
searchClient: SearchClient; | ||
queries: SearchParameters[]; | ||
} | ||
|
||
export function getAlgoliaResults(params: GetAlgoliaSourceParams) { | ||
if (typeof params.searchClient.addAlgoliaAgent === 'function') { | ||
params.searchClient.addAlgoliaAgent(`autocomplete-react (${__VERSION__})`); | ||
} | ||
|
||
return originalGetAlgoliaResults(params); | ||
} |
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 |
---|---|---|
@@ -1 +1,9 @@ | ||
export { Autocomplete } from './Autocomplete'; | ||
export { getAlgoliaHits } from './getAlgoliaHits'; | ||
export { getAlgoliaResults } from './getAlgoliaResults'; | ||
// @TODO: provide React helpers without relying on `innerHTML`. | ||
export { | ||
highlightAlgoliaHit, | ||
reverseHighlightAlgoliaHit, | ||
snippetAlgoliaHit, | ||
} from '@francoischalifour/autocomplete-preset-algolia'; |
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