demoMode.tsx 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import ConfigStore from 'sentry/stores/configStore';
  2. import {OnboardingTaskKey} from 'sentry/types';
  3. export function extraQueryParameter(): URLSearchParams {
  4. const extraQueryString = window.SandboxData?.extraQueryString || '';
  5. const extraQuery = new URLSearchParams(extraQueryString);
  6. return extraQuery;
  7. }
  8. export function extraQueryParameterWithEmail(): URLSearchParams {
  9. const params = extraQueryParameter();
  10. const email = localStorage.getItem('email');
  11. if (email) {
  12. params.append('email', email);
  13. }
  14. return params;
  15. }
  16. export function urlAttachQueryParams(url: string, params: URLSearchParams): string {
  17. const queryString = params.toString();
  18. if (queryString) {
  19. return url + '?' + queryString;
  20. }
  21. return url;
  22. }
  23. // For the Sandbox, we are testing a new walkthrough. This affects a few different components of Sentry including the Onboarding Sidebar, Onboarding Tasks, the Demo End Modal, Demo Sign Up Modal, Guides, and more.
  24. // Outside of the Sandbox, this should have no effect on other elements of Sentry.
  25. export function isDemoWalkthrough(): boolean {
  26. return ConfigStore.get('demoMode');
  27. }
  28. // Function to determine which tour has completed depending on the guide that is being passed in.
  29. export function getTourTask(
  30. guide: string
  31. ): {task: OnboardingTaskKey; tour: string} | undefined {
  32. switch (guide) {
  33. case 'sidebar_v2':
  34. return {tour: 'tabs', task: OnboardingTaskKey.SIDEBAR_GUIDE};
  35. case 'issues_v3':
  36. return {tour: 'issues', task: OnboardingTaskKey.ISSUE_GUIDE};
  37. case 'release-details_v2':
  38. return {tour: 'releases', task: OnboardingTaskKey.RELEASE_GUIDE};
  39. case 'transaction_details_v2':
  40. return {tour: 'performance', task: OnboardingTaskKey.PERFORMANCE_GUIDE};
  41. default:
  42. return undefined;
  43. }
  44. }