user.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import { Brand } from './helpers/brand'
  2. export type RefProviders = {
  3. mendeley?: boolean
  4. zotero?: boolean
  5. }
  6. export type UserId = Brand<string, 'UserId'>
  7. export type Features = {
  8. aiErrorAssistant?: boolean
  9. collaborators?: number
  10. compileGroup?: 'standard' | 'priority'
  11. compileTimeout?: number
  12. dropbox?: boolean
  13. gitBridge?: boolean
  14. github?: boolean
  15. mendeley?: boolean
  16. references?: boolean
  17. referencesSearch?: boolean
  18. symbolPalette?: boolean
  19. templates?: boolean
  20. trackChanges?: boolean
  21. versioning?: boolean
  22. zotero?: boolean
  23. }
  24. export type FeatureUsage = {
  25. [feature: string]: {
  26. remainingUsage: number
  27. resetDate: string // date string
  28. }
  29. }
  30. export type User = {
  31. id: UserId | null
  32. isAdmin?: boolean
  33. email: string
  34. allowedFreeTrial?: boolean
  35. first_name?: string
  36. last_name?: string
  37. alphaProgram?: boolean
  38. betaProgram?: boolean
  39. labsProgram?: boolean
  40. isLatexBeginner?: boolean
  41. signUpDate?: string // date string
  42. features?: Features
  43. refProviders?: RefProviders
  44. writefull?: {
  45. enabled: boolean
  46. autoCreatedAccount: boolean
  47. firstAutoLoad: boolean
  48. }
  49. featureUsage?: FeatureUsage
  50. }
  51. export type MongoUser = Pick<User, Exclude<keyof User, 'id'>> & { _id: string }