Skip to content

: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.

1.7 KB
Raw Blame
import { Meta, StoryObj } from '@storybook/react'

import { EventIngestionRestriction, RestrictionType } from 'lib/logic/eventIngestionRestrictionLogic'

import { EventIngestionRestrictionDetails } from './EventIngestionRestrictionDetails'

function restriction(overrides: Partial<EventIngestionRestriction>): EventIngestionRestriction {
    return {
        restriction_type: RestrictionType.DROP_EVENT_FROM_INGESTION,
        distinct_ids: [],
        session_ids: [],
        event_names: [],
        event_uuids: [],
        pipelines: ['analytics'],
        ...overrides,
    }
}

const meta: Meta<typeof EventIngestionRestrictionDetails> = {
    title: 'Layout/Navigation/EventIngestionRestrictionDetails',
    component: EventIngestionRestrictionDetails,
    tags: ['autodocs'],
}
export default meta

type Story = StoryObj<typeof EventIngestionRestrictionDetails>

export const WholeProject: Story = {
    args: {
        restrictions: [restriction({})],
    },
}

export const ScopedToDistinctIds: Story = {
    args: {
        restrictions: [
            restriction({
                restriction_type: RestrictionType.SKIP_PERSON_PROCESSING,
                distinct_ids: ['user-1', 'user-2', 'anonymous-3f2a'],
            }),
            restriction({
                restriction_type: RestrictionType.FORCE_OVERFLOW_FROM_INGESTION,
                distinct_ids: ['user-1'],
                event_names: ['$pageview'],
                pipelines: ['analytics', 'session_recordings'],
            }),
        ],
    },
}

export const ManyDistinctIds: Story = {
    args: {
        restrictions: [restriction({ distinct_ids: Array.from({ length: 30 }, (_, i) => `user-${i + 1}`) })],
    },
}