This repository has been archived by the owner on Oct 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PAY-1457] Add amplitude analytics to chat features (#3627)
- Loading branch information
1 parent
d1aee10
commit 5a3e74e
Showing
23 changed files
with
460 additions
and
94 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { createContext, useContext } from 'react' | ||
|
||
import { AnalyticsEvent, AllTrackingEvents } from 'models/Analytics' | ||
|
||
type AppContextType = { | ||
analytics: { | ||
track: (event: AnalyticsEvent, callback?: () => void) => Promise<void> | ||
make: <T extends AllTrackingEvents>( | ||
event: T | ||
) => { | ||
eventName: string | ||
properties: any | ||
} | ||
} | ||
} | ||
|
||
export const AppContext = createContext<AppContextType | null>(null) | ||
|
||
export const useAppContext = () => { | ||
const context = useContext(AppContext) | ||
if (!context) { | ||
throw new Error('useAppContext has to be used within <AppContext.Provider>') | ||
} | ||
|
||
return context | ||
} |
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 @@ | ||
export * from './appContext' |
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
Oops, something went wrong.