:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import {
ActivityLogItem,
ActivityLogUserName,
HumanizedChange,
activityLogSummary,
defaultDescriber,
} from 'lib/components/ActivityLog/humanizeActivity'
import { Link } from 'lib/lemon-ui/Link'
import { urls } from 'scenes/urls'
const nameOrLinkToTour = (id?: string | null, name?: string | null): string | JSX.Element => {
const displayName = name || '(empty string)'
return id ? <Link to={urls.productTour(id)}>{displayName}</Link> : displayName
}
export function productTourActivityDescriber(logItem: ActivityLogItem, asNotification?: boolean): HumanizedChange {
if (logItem.scope !== 'ProductTour') {
console.error('product tour describer received a non-product tour activity')
return { description: null }
}
if (logItem.activity === 'created') {
return {
summary: activityLogSummary(
logItem,
'Created the product tour',
nameOrLinkToTour(logItem?.item_id, logItem?.detail.name)
),
description: (
<>
<ActivityLogUserName logItem={logItem} /> created the product tour:{' '}
{nameOrLinkToTour(logItem?.item_id, logItem?.detail.name)}
</>
),
}
}
if (logItem.activity === 'updated') {
return {
summary: activityLogSummary(
logItem,
'Updated the product tour',
nameOrLinkToTour(logItem?.item_id, logItem?.detail.name)
),
description: (
<>
<ActivityLogUserName logItem={logItem} /> updated the product tour:{' '}
{nameOrLinkToTour(logItem?.item_id, logItem?.detail.name)}
</>
),
}
}
if (logItem.activity === 'deleted') {
return {
summary: activityLogSummary(
logItem,
'Deleted the product tour',
nameOrLinkToTour(logItem?.item_id, logItem?.detail.name)
),
description: (
<>
<ActivityLogUserName logItem={logItem} /> deleted the product tour:{' '}
{nameOrLinkToTour(logItem?.item_id, logItem?.detail.name)}
</>
),
}
}
return defaultDescriber(logItem, asNotification, nameOrLinkToTour(logItem?.item_id, logItem?.detail.name))
}