onboarding.tsx 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. task: OnboardingTask;
  41. onCompleteTask?: () => void;
  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. pendingTitle?: string;
  75. /**
  76. * Joins with this task id for server-side onboarding state.
  77. * This allows you to create alias for exising onboarding tasks or create multiple
  78. * tasks for the same server-side task.
  79. */
  80. serverTask?: string;
  81. }
  82. interface OnboardingTypeDescriptorWithAction extends OnboardingTaskDescriptorBase {
  83. action: (props: InjectedRouter) => void;
  84. actionType: 'action';
  85. }
  86. interface OnboardingTypeDescriptorWithExternal extends OnboardingTaskDescriptorBase {
  87. actionType: 'external';
  88. location: string;
  89. }
  90. interface OnboardingTypeDescriptorWithAppLink extends OnboardingTaskDescriptorBase {
  91. actionType: 'app';
  92. location: string | {pathname: string; query?: Query};
  93. }
  94. export type OnboardingTaskDescriptor =
  95. | OnboardingTypeDescriptorWithAction
  96. | OnboardingTypeDescriptorWithExternal
  97. | OnboardingTypeDescriptorWithAppLink;
  98. export interface OnboardingTaskStatus {
  99. status: 'skipped' | 'pending' | 'complete';
  100. task: OnboardingTaskKey;
  101. completionSeen?: string | boolean;
  102. data?: {[key: string]: string};
  103. dateCompleted?: string;
  104. user?: AvatarUser | null;
  105. }
  106. interface OnboardingTaskWithAction
  107. extends OnboardingTaskStatus,
  108. OnboardingTypeDescriptorWithAction {
  109. /**
  110. * Onboarding tasks that are currently incomplete and must be completed
  111. * before this task should be completed.
  112. */
  113. requisiteTasks: OnboardingTaskDescriptor[];
  114. }
  115. interface OnboardingTaskWithExternal
  116. extends OnboardingTaskStatus,
  117. OnboardingTypeDescriptorWithExternal {
  118. /**
  119. * Onboarding tasks that are currently incomplete and must be completed
  120. * before this task should be completed.
  121. */
  122. requisiteTasks: OnboardingTaskDescriptor[];
  123. }
  124. interface OnboardingTaskWithAppLink
  125. extends OnboardingTaskStatus,
  126. OnboardingTypeDescriptorWithAppLink {
  127. requisiteTasks: OnboardingTaskDescriptor[];
  128. }
  129. export type OnboardingTask =
  130. | OnboardingTaskWithAction
  131. | OnboardingTaskWithExternal
  132. | OnboardingTaskWithAppLink;
  133. export enum OnboardingProjectStatus {
  134. WAITING = 'waiting',
  135. PROCESSING = 'processing',
  136. PROCESSED = 'processed',
  137. }
  138. export interface OnboardingSelectedSDK
  139. extends Pick<PlatformIntegration, 'language' | 'link' | 'name' | 'type'> {
  140. category: Category;
  141. key: PlatformKey;
  142. }
  143. export type OnboardingRecentCreatedProject = Project & {
  144. firstError: boolean;
  145. firstTransaction: boolean;
  146. hasReplays: boolean;
  147. hasSessions: boolean;
  148. olderThanOneHour: boolean;
  149. firstIssue?: Group;
  150. };
  151. export type OnboardingPlatformDoc = {html: string; link: string};