-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(app): add mixpanel tracking for quick transfer (#16200)
fix PLAT-218
- Loading branch information
Showing
27 changed files
with
448 additions
and
37 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
33 changes: 33 additions & 0 deletions
33
app/src/organisms/Devices/hooks/useTrackEventWithRobotSerial.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,33 @@ | ||
import { useSelector } from 'react-redux' | ||
import { useTrackEvent } from '../../../redux/analytics' | ||
import { getLocalRobot, getRobotSerialNumber } from '../../../redux/discovery' | ||
|
||
interface AnalyticsEvent { | ||
name: string | ||
properties: { [key: string]: unknown } | ||
} | ||
|
||
export type TrackEventWithRobotSerial = (event: AnalyticsEvent) => void | ||
|
||
export function useTrackEventWithRobotSerial(): { | ||
trackEventWithRobotSerial: TrackEventWithRobotSerial | ||
} { | ||
const trackEvent = useTrackEvent() | ||
const localRobot = useSelector(getLocalRobot) | ||
const robotSerialNumber = | ||
localRobot?.status != null ? getRobotSerialNumber(localRobot) : null | ||
const trackEventWithRobotSerial: TrackEventWithRobotSerial = ({ | ||
name, | ||
properties, | ||
}) => { | ||
trackEvent({ | ||
name, | ||
properties: { | ||
...properties, | ||
robotSerial: robotSerialNumber, | ||
}, | ||
}) | ||
} | ||
|
||
return { trackEventWithRobotSerial } | ||
} |
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
Oops, something went wrong.