Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

3.8 KB
Raw Blame
import { OrganisationMembership } from './Organisation'
import { SharedProject } from './SharedProject'

export enum DashboardBlockReason {
  exceeding_plan_limits = 'exceeding_plan_limits',
  trial_ended = 'trial_ended',
  payment_failed = 'payment_failed',
  subscription_cancelled = 'subscription_cancelled',
}

enum PlanCode {
  none = 'none',
  free = 'free',
  trial = 'trial',
  hobby = 'hobby',
  freelancer = 'freelancer',
  '50k' = '50k',
  '100k' = '100k',
  '200k' = '200k',
  '500k' = '500k',
  '1m' = '1m',
  '2m' = '2m',
  '5m' = '5m',
  '10m' = '10m',
  '15m' = '15m',
  '20m' = '20m',
  '30m' = '30m',
  '40m' = '40m',
  '50m' = '50m',
}

enum PlanType {
  standard = 'standard',
  plus = 'plus',
  enterprise = 'enterprise',
}

interface WebsiteAddon {
  code: 'websites'
  quantity: number
  pendingQuantity: number | null
  billingInterval: 'monthly' | 'yearly' | null
  pendingBillingInterval: 'monthly' | 'yearly' | null
  currency: 'USD' | 'EUR' | 'GBP' | null
  status: 'active' | 'past_due' | 'cancelled' | 'legacy' | null
  periodEnd: string | null
  nextChargeDate: string | null
  recurringAmount: number | null
  isLegacy: boolean
  failedChargeAttempts: number
}

interface SessionReplayAddon {
  code: 'session_replays'
  quantity: number
  pendingQuantity: number | null
  billingInterval: 'monthly' | 'yearly' | null
  pendingBillingInterval: 'monthly' | 'yearly' | null
  currency: 'USD' | 'EUR' | 'GBP' | null
  status: 'active' | 'past_due' | 'cancelled' | 'legacy' | null
  periodEnd: string | null
  nextChargeDate: string | null
  recurringAmount: number | null
  isLegacy: boolean
  failedChargeAttempts: number
}

enum OnboardingStep {
  LANGUAGE = 'language',
  WELCOME = 'welcome',
  FEATURE_TRAFFIC = 'feature_traffic',
  FEATURE_ERRORS = 'feature_errors',
  FEATURE_SESSIONS = 'feature_sessions',
  CREATE_PROJECT = 'create_project',
  SETUP_TRACKING = 'setup_tracking',
  WAITING_FOR_EVENTS = 'waiting_for_events',
  VERIFY_EMAIL = 'verify_email',
  COMPLETED = 'completed',
}

export interface User {
  id: string
  planCode: PlanCode
  planType: PlanType | null
  effectivePlanType: PlanType | null
  addonOverrides: Record<string, unknown> | null
  entitlementOverrides: Record<string, unknown> | null
  email: string
  isActive: boolean
  trialEndDate: string
  reportFrequency: string
  emailRequests: number
  created: string
  updated: string
  evWarningSentOn: string | null
  subID: string | null
  subUpdateURL: string | null
  subCancelURL: string | null
  timezone: string
  isTwoFactorAuthenticationEnabled: boolean
  billingFrequency: string | null
  nextBillDate: string | null
  cancellationEffectiveDate: string | null
  telegramChatId: string | null
  isTelegramChatIdConfirmed: boolean
  timeFormat: '12-hour' | '24-hour'
  sharedProjects: SharedProject[]
  registeredWithGoogle: boolean
  googleId: string | null
  githubId: number | null
  registeredWithGithub: boolean
  maxEventsCount: number
  maxProjects: number
  includedWebsites: number
  effectiveProjectLimit: number
  maxApiKeyRequestsPerHour: number
  apiRateLimitPerHour: number
  includedSessionReplays: number | string
  sessionReplaysIncluded: number | string
  purchasedWebsiteAddons: number
  purchasedSessionReplayAddons: number
  sessionReplayRetentionDays: number
  teamMembers: number | 'custom'
  organisations: number | 'custom'
  websiteAddon?: WebsiteAddon | null
  sessionReplayAddon?: SessionReplayAddon | null
  tierCurrency: 'USD' | 'EUR' | 'GBP' | null
  showLiveVisitorsInTitle: boolean
  receiveLoginNotifications: boolean
  planExceedContactedAt: Date
  dashboardBlockReason: DashboardBlockReason
  isAccountBillingSuspended: boolean
  organisationMemberships: OrganisationMembership[]
  onboardingStep: OnboardingStep
  hasCompletedOnboarding: boolean
  registeredViaInvitation: boolean
}