Users.constants.ts 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { type OptimizedSearchColumns } from '@supabase/pg-meta'
  2. import { PROVIDER_PHONE, PROVIDERS_SCHEMAS } from '../AuthProvidersFormValidation'
  3. import { BASE_PATH } from '@/lib/constants'
  4. export type Filter = 'all' | 'verified' | 'unverified' | 'anonymous'
  5. export type SpecificFilterColumn = OptimizedSearchColumns | 'name' | 'freeform'
  6. export const UUIDV4_LEFT_PREFIX_REGEX =
  7. /^(?:[0-9a-f]{1,8}|[0-9a-f]{8}-|[0-9a-f]{8}-[0-9a-f]{1,4}|[0-9a-f]{8}-[0-9a-f]{4}-|[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{0,3}|[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-|[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{0,3}|[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-|[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{0,12})$/i
  8. export const PHONE_NUMBER_LEFT_PREFIX_REGEX = /^[+]?[0-9]{0,15}$/
  9. export const PANEL_PADDING = 'px-5 py-5'
  10. // [Joshen] Temporary fix as bulk delete will fire n requests since Auth + API do not have a bulk delete endpoint yet
  11. export const MAX_BULK_DELETE = 20
  12. export const PROVIDER_FILTER_OPTIONS = PROVIDERS_SCHEMAS.map((provider) => ({
  13. name: provider.title,
  14. value: 'key' in provider ? provider.key : provider.title.toLowerCase(),
  15. icon: `${BASE_PATH}/img/icons/${provider.misc.iconKey}.svg`,
  16. iconClass: provider.title === 'GitHub' ? 'dark:invert' : '',
  17. })).concat(
  18. PROVIDER_PHONE.properties.SMS_PROVIDER.enum.map((x) => ({
  19. name: x.label,
  20. value: x.value,
  21. icon: `${BASE_PATH}/img/icons/${x.icon}`,
  22. iconClass: '',
  23. }))
  24. )
  25. export type UsersTableColumn = {
  26. id: string
  27. name: string
  28. minWidth?: number
  29. width?: number
  30. resizable?: boolean
  31. }
  32. export type ColumnConfiguration = { id: string; width?: number }
  33. export const USERS_TABLE_COLUMNS: UsersTableColumn[] = [
  34. { id: 'img', name: '', minWidth: 95, width: 95, resizable: false },
  35. { id: 'id', name: 'UID', width: 280 },
  36. { id: 'name', name: 'Display name', minWidth: 0, width: 150 },
  37. { id: 'email', name: 'Email', width: 300 },
  38. { id: 'phone', name: 'Phone' },
  39. { id: 'providers', name: 'Providers', minWidth: 150 },
  40. { id: 'provider_type', name: 'Provider type', minWidth: 150 },
  41. { id: 'created_at', name: 'Created at', width: 260 },
  42. { id: 'last_sign_in_at', name: 'Last sign in at', width: 260 },
  43. ]