platformOrIntegration.tsx 1.0 KB

12345678910111213141516171819202122232425262728
  1. import * as qs from 'query-string';
  2. import {OnboardingContextProvider} from 'sentry/components/onboarding/onboardingContext';
  3. import {platformToIntegrationMap} from 'sentry/utils/integrationUtil';
  4. import {ProjectInstallPlatform} from './platform';
  5. import PlatformIntegrationSetup from './platformIntegrationSetup';
  6. type Props = React.ComponentProps<typeof ProjectInstallPlatform> &
  7. Omit<React.ComponentProps<typeof PlatformIntegrationSetup>, 'integrationSlug'>;
  8. function PlatformOrIntegration(props: Props) {
  9. const parsed = qs.parse(window.location.search);
  10. const {platform} = props.params;
  11. const integrationSlug = platform && platformToIntegrationMap[platform];
  12. // check for manual override query param
  13. // TODO(priscila): check this case
  14. if (integrationSlug && parsed.manual !== '1') {
  15. return <PlatformIntegrationSetup integrationSlug={integrationSlug} {...props} />;
  16. }
  17. return (
  18. <OnboardingContextProvider>
  19. <ProjectInstallPlatform {...props} />
  20. </OnboardingContextProvider>
  21. );
  22. }
  23. export default PlatformOrIntegration;