env var tweaks (#7457)

* add new events

* Discard changes to package.json

* Discard changes to src/lib/constants.ts

* Discard changes to src/state/feed-feedback.tsx

* Discard changes to yarn.lock

* remove unused event
This commit is contained in:
Hailey
2025-01-26 15:40:02 -08:00
committed by GitHub
parent 355c50fc0f
commit ebb6d5cc0f
7 changed files with 76 additions and 6 deletions
+23 -2
View File
@@ -196,6 +196,7 @@ export function SuggestedFollowsProfile({did}: {did: string}) {
<ProfileGrid <ProfileGrid
isSuggestionsLoading={isSuggestionsLoading} isSuggestionsLoading={isSuggestionsLoading}
profiles={data?.suggestions ?? []} profiles={data?.suggestions ?? []}
recId={data?.recId}
error={error} error={error}
viewContext="profile" viewContext="profile"
/> />
@@ -222,10 +223,12 @@ export function ProfileGrid({
isSuggestionsLoading, isSuggestionsLoading,
error, error,
profiles, profiles,
recId,
viewContext = 'feed', viewContext = 'feed',
}: { }: {
isSuggestionsLoading: boolean isSuggestionsLoading: boolean
profiles: AppBskyActorDefs.ProfileViewDetailed[] profiles: AppBskyActorDefs.ProfileViewDetailed[]
recId?: number
error: Error | null error: Error | null
viewContext: 'profile' | 'feed' viewContext: 'profile' | 'feed'
}) { }) {
@@ -249,12 +252,19 @@ export function ProfileGrid({
)) ))
) : error || !profiles.length ? null : ( ) : error || !profiles.length ? null : (
<> <>
{profiles.slice(0, maxLength).map(profile => ( {profiles.slice(0, maxLength).map((profile, index) => (
<ProfileCard.Link <ProfileCard.Link
key={profile.did} key={profile.did}
profile={profile} profile={profile}
onPress={() => { onPress={() => {
logEvent('feed:interstitial:profileCard:press', {}) logEvent('suggestedUser:press', {
logContext:
viewContext === 'feed'
? 'InterstitialDiscover'
: 'InterstitialProfile',
recId,
position: index,
})
}} }}
style={[ style={[
a.flex_1, a.flex_1,
@@ -282,6 +292,17 @@ export function ProfileGrid({
logContext="FeedInterstitial" logContext="FeedInterstitial"
shape="round" shape="round"
colorInverted colorInverted
onFollow={() => {
logEvent('suggestedUser:follow', {
logContext:
viewContext === 'feed'
? 'InterstitialDiscover'
: 'InterstitialProfile',
location: 'Card',
recId,
position: index,
})
}}
/> />
</ProfileCard.Header> </ProfileCard.Header>
<ProfileCard.Description profile={profile} numberOfLines={2} /> <ProfileCard.Description profile={profile} numberOfLines={2} />
+3
View File
@@ -286,6 +286,7 @@ export type FollowButtonProps = {
logContext: LogEvents['profile:follow']['logContext'] & logContext: LogEvents['profile:follow']['logContext'] &
LogEvents['profile:unfollow']['logContext'] LogEvents['profile:unfollow']['logContext']
colorInverted?: boolean colorInverted?: boolean
onFollow?: () => void
} & Partial<ButtonProps> } & Partial<ButtonProps>
export function FollowButton(props: FollowButtonProps) { export function FollowButton(props: FollowButtonProps) {
@@ -299,6 +300,7 @@ export function FollowButtonInner({
moderationOpts, moderationOpts,
logContext, logContext,
onPress: onPressProp, onPress: onPressProp,
onFollow,
colorInverted, colorInverted,
...rest ...rest
}: FollowButtonProps) { }: FollowButtonProps) {
@@ -325,6 +327,7 @@ export function FollowButtonInner({
), ),
) )
onPressProp?.(e) onPressProp?.(e)
onFollow?.()
} catch (err: any) { } catch (err: any) {
if (err?.name !== 'AbortError') { if (err?.name !== 'AbortError') {
Toast.show(_(msg`An issue occurred, please try again.`), 'xmark') Toast.show(_(msg`An issue occurred, please try again.`), 'xmark')
+20 -1
View File
@@ -170,6 +170,26 @@ export type LogEvents = {
| 'PostOnboardingFindFollows' | 'PostOnboardingFindFollows'
| 'ImmersiveVideo' | 'ImmersiveVideo'
} }
'suggestedUser:follow': {
logContext:
| 'Explore'
| 'InterstitialDiscover'
| 'InterstitialProfile'
| 'Profile'
location: 'Card' | 'Profile'
recId?: number
position: number
}
'suggestedUser:press': {
logContext: 'Explore' | 'InterstitialDiscover' | 'InterstitialProfile'
recId?: number
position: number
}
'suggestedUser:seen': {
logContext: 'Explore' | 'InterstitialDiscover' | 'InterstitialProfile'
recId?: number
position: number
}
'profile:unfollow': { 'profile:unfollow': {
logContext: logContext:
| 'RecommendedFollowsItem' | 'RecommendedFollowsItem'
@@ -225,7 +245,6 @@ export type LogEvents = {
domain: string domain: string
} }
'feed:interstitial:profileCard:press': {}
'feed:interstitial:feedCard:press': {} 'feed:interstitial:feedCard:press': {}
'profile:header:suggestedFollowsCard:press': {} 'profile:header:suggestedFollowsCard:press': {}
+1 -1
View File
@@ -120,7 +120,7 @@ export function useSuggestedFollowsByActorQuery({
const suggestions = res.data.isFallback const suggestions = res.data.isFallback
? [] ? []
: res.data.suggestions.filter(profile => !profile.viewer?.following) : res.data.suggestions.filter(profile => !profile.viewer?.following)
return {suggestions} return {suggestions, recId: res.data.recId}
}, },
enabled, enabled,
}) })
+3
View File
@@ -14,12 +14,14 @@ export function FollowButton({
profile, profile,
labelStyle, labelStyle,
logContext, logContext,
onFollow,
}: { }: {
unfollowedType?: ButtonType unfollowedType?: ButtonType
followedType?: ButtonType followedType?: ButtonType
profile: Shadow<AppBskyActorDefs.ProfileViewBasic> profile: Shadow<AppBskyActorDefs.ProfileViewBasic>
labelStyle?: StyleProp<TextStyle> labelStyle?: StyleProp<TextStyle>
logContext: 'ProfileCard' | 'StarterPackProfilesList' logContext: 'ProfileCard' | 'StarterPackProfilesList'
onFollow?: () => void
}) { }) {
const [queueFollow, queueUnfollow] = useProfileFollowMutationQueue( const [queueFollow, queueUnfollow] = useProfileFollowMutationQueue(
profile, profile,
@@ -30,6 +32,7 @@ export function FollowButton({
const onPressFollow = async () => { const onPressFollow = async () => {
try { try {
await queueFollow() await queueFollow()
onFollow?.()
} catch (e: any) { } catch (e: any) {
if (e?.name !== 'AbortError') { if (e?.name !== 'AbortError') {
Toast.show(_(msg`An issue occurred, please try again.`), 'xmark') Toast.show(_(msg`An issue occurred, please try again.`), 'xmark')
+7 -1
View File
@@ -184,6 +184,7 @@ export function ProfileCardWithFollowBtn({
noBg, noBg,
noBorder, noBorder,
onPress, onPress,
onFollow,
logContext = 'ProfileCard', logContext = 'ProfileCard',
showKnownFollowers, showKnownFollowers,
}: { }: {
@@ -191,6 +192,7 @@ export function ProfileCardWithFollowBtn({
noBg?: boolean noBg?: boolean
noBorder?: boolean noBorder?: boolean
onPress?: () => void onPress?: () => void
onFollow?: () => void
logContext?: 'ProfileCard' | 'StarterPackProfilesList' logContext?: 'ProfileCard' | 'StarterPackProfilesList'
showKnownFollowers?: boolean showKnownFollowers?: boolean
}) { }) {
@@ -206,7 +208,11 @@ export function ProfileCardWithFollowBtn({
isMe isMe
? undefined ? undefined
: profileShadow => ( : profileShadow => (
<FollowButton profile={profileShadow} logContext={logContext} /> <FollowButton
profile={profileShadow}
logContext={logContext}
onFollow={onFollow}
/>
) )
} }
onPress={onPress} onPress={onPress}
+19 -1
View File
@@ -10,6 +10,7 @@ import {
import {msg, Trans} from '@lingui/macro' import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react' import {useLingui} from '@lingui/react'
import {logEvent} from '#/lib/statsig/statsig'
import {cleanError} from '#/lib/strings/errors' import {cleanError} from '#/lib/strings/errors'
import {logger} from '#/logger' import {logger} from '#/logger'
import {isNative, isWeb} from '#/platform/detection' import {isNative, isWeb} from '#/platform/detection'
@@ -259,6 +260,7 @@ type ExploreScreenItems =
type: 'profile' type: 'profile'
key: string key: string
profile: AppBskyActorDefs.ProfileView profile: AppBskyActorDefs.ProfileView
recId?: number
} }
| { | {
type: 'feed' type: 'feed'
@@ -383,6 +385,7 @@ export function Explore() {
type: 'profile', type: 'profile',
key: actor.did, key: actor.did,
profile: actor, profile: actor,
recId: page.recId,
}) })
} }
} }
@@ -511,7 +514,7 @@ export function Explore() {
]) ])
const renderItem = React.useCallback( const renderItem = React.useCallback(
({item}: {item: ExploreScreenItems}) => { ({item, index}: {item: ExploreScreenItems; index: number}) => {
switch (item.type) { switch (item.type) {
case 'header': { case 'header': {
return ( return (
@@ -540,6 +543,21 @@ export function Explore() {
noBg noBg
noBorder noBorder
showKnownFollowers showKnownFollowers
onPress={() => {
logEvent('suggestedUser:press', {
logContext: 'Explore',
recId: item.recId,
position: index,
})
}}
onFollow={() => {
logEvent('suggestedUser:follow', {
logContext: 'Explore',
location: 'Card',
recId: item.recId,
position: index,
})
}}
/> />
</View> </View>
) )