utils.tsx 1.0 KB

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