onboarding.tsx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import {AvatarUser} from './user';
  2. export enum OnboardingTaskKey {
  3. FIRST_PROJECT = 'create_project',
  4. FIRST_EVENT = 'send_first_event',
  5. INVITE_MEMBER = 'invite_member',
  6. SECOND_PLATFORM = 'setup_second_platform',
  7. USER_CONTEXT = 'setup_user_context',
  8. RELEASE_TRACKING = 'setup_release_tracking',
  9. SOURCEMAPS = 'setup_sourcemaps',
  10. USER_REPORTS = 'setup_user_reports',
  11. ISSUE_TRACKER = 'setup_issue_tracker',
  12. ALERT_RULE = 'setup_alert_rules',
  13. FIRST_TRANSACTION = 'setup_transactions',
  14. }
  15. export type OnboardingSupplementComponentProps = {
  16. onCompleteTask: () => void;
  17. task: OnboardingTask;
  18. };
  19. export type OnboardingTaskDescriptor = {
  20. description: string;
  21. /**
  22. * Should the onboarding task currently be displayed
  23. */
  24. display: boolean;
  25. /**
  26. * A list of require task keys that must have been completed before these
  27. * tasks may be completed.
  28. */
  29. requisites: OnboardingTaskKey[];
  30. /**
  31. * Can this task be skipped?
  32. */
  33. skippable: boolean;
  34. task: OnboardingTaskKey;
  35. title: string;
  36. /**
  37. * An extra component that may be rendered within the onboarding task item.
  38. */
  39. SupplementComponent?: React.ComponentType<OnboardingSupplementComponentProps>;
  40. } & (
  41. | {
  42. actionType: 'app' | 'external';
  43. location: string;
  44. }
  45. | {
  46. action: () => void;
  47. actionType: 'action';
  48. }
  49. );
  50. export type OnboardingTaskStatus = {
  51. status: 'skipped' | 'pending' | 'complete';
  52. task: OnboardingTaskKey;
  53. completionSeen?: string;
  54. data?: object;
  55. dateCompleted?: string;
  56. user?: AvatarUser | null;
  57. };
  58. export type OnboardingTask = OnboardingTaskStatus &
  59. OnboardingTaskDescriptor & {
  60. /**
  61. * Onboarding tasks that are currently incomplete and must be completed
  62. * before this task should be completed.
  63. */
  64. requisiteTasks: OnboardingTask[];
  65. };