Remove LogEvents alias for Metrics
This commit is contained in:
@@ -24,6 +24,7 @@ import {device} from '#/storage'
|
||||
|
||||
export * as utils from '#/analytics/utils'
|
||||
export const features = {init, refresh}
|
||||
export {type Metrics} from '#/analytics/metrics'
|
||||
|
||||
type LoggerType = {
|
||||
debug: Logger['debug']
|
||||
|
||||
@@ -16,7 +16,6 @@ import {useLingui} from '@lingui/react'
|
||||
|
||||
import {useActorStatus} from '#/lib/actor-status'
|
||||
import {getModerationCauseKey} from '#/lib/moderation'
|
||||
import {type LogEvents} from '#/lib/statsig/statsig'
|
||||
import {forceLTR} from '#/lib/strings/bidi'
|
||||
import {NON_BREAKING_SPACE} from '#/lib/strings/constants'
|
||||
import {sanitizeDisplayName} from '#/lib/strings/display-names'
|
||||
@@ -47,6 +46,7 @@ import {RichText} from '#/components/RichText'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {useSimpleVerificationState} from '#/components/verification'
|
||||
import {VerificationCheck} from '#/components/verification/VerificationCheck'
|
||||
import {type Metrics} from '#/analytics/metrics'
|
||||
import type * as bsky from '#/types/bsky'
|
||||
|
||||
export function Default({
|
||||
@@ -461,8 +461,8 @@ export function DescriptionPlaceholder({
|
||||
export type FollowButtonProps = {
|
||||
profile: bsky.profile.AnyProfileView
|
||||
moderationOpts: ModerationOpts
|
||||
logContext: LogEvents['profile:follow']['logContext'] &
|
||||
LogEvents['profile:unfollow']['logContext']
|
||||
logContext: Metrics['profile:follow']['logContext'] &
|
||||
Metrics['profile:unfollow']['logContext']
|
||||
colorInverted?: boolean
|
||||
onFollow?: () => void
|
||||
withIcon?: boolean
|
||||
|
||||
@@ -2,12 +2,12 @@ import React from 'react'
|
||||
import {msg} from '@lingui/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
|
||||
import {type LogEvents} from '#/lib/statsig/statsig'
|
||||
import {logger} from '#/logger'
|
||||
import {type Shadow} from '#/state/cache/types'
|
||||
import {useProfileFollowMutationQueue} from '#/state/queries/profile'
|
||||
import {useRequireAuth} from '#/state/session'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {type Metrics} from '#/analytics/metrics'
|
||||
import type * as bsky from '#/types/bsky'
|
||||
|
||||
export function useFollowMethods({
|
||||
@@ -15,8 +15,8 @@ export function useFollowMethods({
|
||||
logContext,
|
||||
}: {
|
||||
profile: Shadow<bsky.profile.AnyProfileView>
|
||||
logContext: LogEvents['profile:follow']['logContext'] &
|
||||
LogEvents['profile:unfollow']['logContext']
|
||||
logContext: Metrics['profile:follow']['logContext'] &
|
||||
Metrics['profile:unfollow']['logContext']
|
||||
}) {
|
||||
const {_} = useLingui()
|
||||
const requireAuth = useRequireAuth()
|
||||
|
||||
@@ -6,11 +6,12 @@ import {logger} from '#/logger'
|
||||
import {type SessionAccount, useSessionApi} from '#/state/session'
|
||||
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
import {type Metrics} from '#/analytics/metrics'
|
||||
import {IS_WEB} from '#/env'
|
||||
import {logEvent} from '../statsig/statsig'
|
||||
import {type LogEvents} from '../statsig/statsig'
|
||||
|
||||
export function useAccountSwitcher() {
|
||||
const ax = useAnalytics()
|
||||
const [pendingDid, setPendingDid] = useState<string | null>(null)
|
||||
const {_} = useLingui()
|
||||
const {resumeSession} = useSessionApi()
|
||||
@@ -19,7 +20,7 @@ export function useAccountSwitcher() {
|
||||
const onPressSwitchAccount = useCallback(
|
||||
async (
|
||||
account: SessionAccount,
|
||||
logContext: LogEvents['account:loggedIn']['logContext'],
|
||||
logContext: Metrics['account:loggedIn']['logContext'],
|
||||
) => {
|
||||
if (pendingDid) {
|
||||
// The session API isn't resilient to race conditions so let's just ignore this.
|
||||
@@ -37,7 +38,7 @@ export function useAccountSwitcher() {
|
||||
history.pushState(null, '', '/')
|
||||
}
|
||||
await resumeSession(account, true)
|
||||
logEvent('account:loggedIn', {logContext, withPassword: false})
|
||||
ax.metric('account:loggedIn', {logContext, withPassword: false})
|
||||
Toast.show(_(msg`Signed in as @${account.handle}`))
|
||||
} else {
|
||||
requestSwitchToAccount({requestedAccount: account.did})
|
||||
@@ -59,7 +60,7 @@ export function useAccountSwitcher() {
|
||||
setPendingDid(null)
|
||||
}
|
||||
},
|
||||
[_, resumeSession, requestSwitchToAccount, pendingDid],
|
||||
[_, ax, resumeSession, requestSwitchToAccount, pendingDid],
|
||||
)
|
||||
|
||||
return {onPressSwitchAccount, pendingDid}
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
import type React from 'react'
|
||||
|
||||
import {type Metrics} from '#/logger'
|
||||
import {type Gate} from './gates'
|
||||
|
||||
export type {Metrics as LogEvents}
|
||||
|
||||
/**
|
||||
* @deprecated use `logger.metric()` instead
|
||||
*/
|
||||
export function logEvent<E extends keyof Metrics>(
|
||||
_eventName: E & string,
|
||||
_rawMetadata: Metrics[E] & any,
|
||||
export function logEvent(
|
||||
_eventName: string,
|
||||
_rawMetadata: any,
|
||||
_options: {
|
||||
/**
|
||||
* Send to our data lake only, not to StatSig
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {type LogEvents} from '#/lib/statsig/statsig'
|
||||
import {type PersistedAccount} from '#/state/persisted'
|
||||
import {type Metrics} from '#/analytics/metrics'
|
||||
|
||||
export type SessionAccount = PersistedAccount
|
||||
|
||||
@@ -21,7 +21,7 @@ export type SessionApiContext = {
|
||||
verificationPhone?: string
|
||||
verificationCode?: string
|
||||
},
|
||||
metrics: LogEvents['account:create:success'],
|
||||
metrics: Metrics['account:create:success'],
|
||||
) => Promise<void>
|
||||
login: (
|
||||
props: {
|
||||
@@ -30,13 +30,13 @@ export type SessionApiContext = {
|
||||
password: string
|
||||
authFactorToken?: string | undefined
|
||||
},
|
||||
logContext: LogEvents['account:loggedIn']['logContext'],
|
||||
logContext: Metrics['account:loggedIn']['logContext'],
|
||||
) => Promise<void>
|
||||
logoutCurrentAccount: (
|
||||
logContext: LogEvents['account:loggedOut']['logContext'],
|
||||
logContext: Metrics['account:loggedOut']['logContext'],
|
||||
) => void
|
||||
logoutEveryAccount: (
|
||||
logContext: LogEvents['account:loggedOut']['logContext'],
|
||||
logContext: Metrics['account:loggedOut']['logContext'],
|
||||
) => void
|
||||
resumeSession: (
|
||||
account: SessionAccount,
|
||||
|
||||
Reference in New Issue
Block a user