utils.tsx 847 B

123456789101112131415161718192021222324252627
  1. import partition from 'lodash/partition';
  2. import {replayPlatforms} from 'sentry/data/platformCategories';
  3. import {PlatformIntegration, PlatformKey, Project} from 'sentry/types';
  4. export function generateDocKeys(platform: PlatformKey): string[] {
  5. const platformKey = platform.startsWith('javascript')
  6. ? platform
  7. : 'javascript-' + platform;
  8. return ['1-install', '2-configure'].map(
  9. key => `${platformKey}-replay-onboarding-${key}`
  10. );
  11. }
  12. export function isPlatformSupported(platform: undefined | PlatformIntegration) {
  13. return platform?.id ? replayPlatforms.includes(platform?.id) : false;
  14. }
  15. export function splitProjectsByReplaySupport(projects: Project[]) {
  16. const [supported, unsupported] = partition(projects, project =>
  17. replayPlatforms.includes(project.platform!)
  18. );
  19. return {
  20. supported,
  21. unsupported,
  22. };
  23. }