onboarding.tsx 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. import type {Query} from 'history';
  2. import type {OnboardingContextProps} from 'sentry/components/onboarding/onboardingContext';
  3. import type {Category} from 'sentry/components/platformPicker';
  4. import type {InjectedRouter} from 'sentry/types/legacyReactRouter';
  5. import type {Group} from './group';
  6. import type {Organization} from './organization';
  7. import type {PlatformIntegration, PlatformKey, Project} from './project';
  8. import type {AvatarUser} from './user';
  9. export enum OnboardingTaskGroup {
  10. GETTING_STARTED = 'getting_started',
  11. BEYOND_BASICS = 'beyond_basics',
  12. }
  13. export enum OnboardingTaskKey {
  14. FIRST_PROJECT = 'create_project',
  15. FIRST_EVENT = 'send_first_event',
  16. INVITE_MEMBER = 'invite_member',
  17. SECOND_PLATFORM = 'setup_second_platform',
  18. USER_CONTEXT = 'setup_user_context',
  19. RELEASE_TRACKING = 'setup_release_tracking',
  20. SOURCEMAPS = 'setup_sourcemaps',
  21. USER_REPORTS = 'setup_user_reports',
  22. ALERT_RULE = 'setup_alert_rules',
  23. FIRST_TRANSACTION = 'setup_transactions',
  24. METRIC_ALERT = 'setup_metric_alert_rules',
  25. USER_SELECTED_PROJECTS = 'setup_userselected_projects',
  26. REAL_TIME_NOTIFICATIONS = 'setup_real_time_notifications',
  27. LINK_SENTRY_TO_SOURCE_CODE = 'link_sentry_to_source_code',
  28. /// Customized card that shows the selected integrations during onboarding
  29. INTEGRATIONS = 'integrations',
  30. /// Regular card that tells the user to setup integrations if no integrations were selected during onboarding
  31. FIRST_INTEGRATION = 'setup_integrations',
  32. SESSION_REPLAY = 'setup_session_replay',
  33. /// Demo New Walkthrough Tasks
  34. SIDEBAR_GUIDE = 'sidebar_guide',
  35. ISSUE_GUIDE = 'issue_guide',
  36. RELEASE_GUIDE = 'release_guide',
  37. PERFORMANCE_GUIDE = 'performance_guide',
  38. }
  39. export type OnboardingSupplementComponentProps = {
  40. onCompleteTask: () => void;
  41. task: OnboardingTask;
  42. };
  43. export type OnboardingCustomComponentProps = {
  44. onboardingContext: OnboardingContextProps;
  45. organization: Organization;
  46. projects: Project[];
  47. task: OnboardingTask;
  48. };
  49. interface OnboardingTaskDescriptorBase {
  50. description: string;
  51. /**
  52. * Should the onboarding task currently be displayed
  53. */
  54. display: boolean;
  55. /**
  56. * A list of require task keys that must have been completed before these
  57. * tasks may be completed.
  58. */
  59. requisites: OnboardingTaskKey[];
  60. /**
  61. * Can this task be skipped?
  62. */
  63. skippable: boolean;
  64. task: OnboardingTaskKey;
  65. title: string;
  66. /**
  67. * An extra component that may be rendered within the onboarding task item.
  68. */
  69. SupplementComponent?: React.ComponentType<OnboardingSupplementComponentProps>;
  70. /**
  71. * The group that this task belongs to, e.g. basic and level up
  72. */
  73. group?: OnboardingTaskGroup;
  74. /**
  75. * Joins with this task id for server-side onboarding state.
  76. * This allows you to create alias for exising onboarding tasks or create multiple
  77. * tasks for the same server-side task.
  78. */
  79. serverTask?: string;
  80. }
  81. interface OnboardingTypeDescriptorWithAction extends OnboardingTaskDescriptorBase {
  82. action: (props: InjectedRouter) => void;
  83. actionType: 'action';
  84. }
  85. interface OnboardingTypeDescriptorWithExternal extends OnboardingTaskDescriptorBase {
  86. actionType: 'external';
  87. location: string;
  88. }
  89. interface OnboardingTypeDescriptorWithAppLink extends OnboardingTaskDescriptorBase {
  90. actionType: 'app';
  91. location: string | {pathname: string; query?: Query};
  92. }
  93. export type OnboardingTaskDescriptor =
  94. | OnboardingTypeDescriptorWithAction
  95. | OnboardingTypeDescriptorWithExternal
  96. | OnboardingTypeDescriptorWithAppLink;
  97. export interface OnboardingTaskStatus {
  98. status: 'skipped' | 'pending' | 'complete';
  99. task: OnboardingTaskKey;
  100. completionSeen?: string | boolean;
  101. data?: {[key: string]: string};
  102. dateCompleted?: string;
  103. user?: AvatarUser | null;
  104. }
  105. interface OnboardingTaskWithAction
  106. extends OnboardingTaskStatus,
  107. OnboardingTypeDescriptorWithAction {
  108. /**
  109. * Onboarding tasks that are currently incomplete and must be completed
  110. * before this task should be completed.
  111. */
  112. requisiteTasks: OnboardingTaskDescriptor[];
  113. }
  114. interface OnboardingTaskWithExternal
  115. extends OnboardingTaskStatus,
  116. OnboardingTypeDescriptorWithExternal {
  117. /**
  118. * Onboarding tasks that are currently incomplete and must be completed
  119. * before this task should be completed.
  120. */
  121. requisiteTasks: OnboardingTaskDescriptor[];
  122. }
  123. interface OnboardingTaskWithAppLink
  124. extends OnboardingTaskStatus,
  125. OnboardingTypeDescriptorWithAppLink {
  126. requisiteTasks: OnboardingTaskDescriptor[];
  127. }
  128. export type OnboardingTask =
  129. | OnboardingTaskWithAction
  130. | OnboardingTaskWithExternal
  131. | OnboardingTaskWithAppLink;
  132. export enum OnboardingProjectStatus {
  133. WAITING = 'waiting',
  134. PROCESSING = 'processing',
  135. PROCESSED = 'processed',
  136. }
  137. export interface OnboardingSelectedSDK
  138. extends Pick<PlatformIntegration, 'language' | 'link' | 'name' | 'type'> {
  139. category: Category;
  140. key: PlatformKey;
  141. }
  142. export type OnboardingRecentCreatedProject = Project & {
  143. firstError: boolean;
  144. firstTransaction: boolean;
  145. hasReplays: boolean;
  146. hasSessions: boolean;
  147. olderThanOneHour: boolean;
  148. firstIssue?: Group;
  149. };
  150. export type OnboardingPlatformDoc = {html: string; link: string};