platformOrIntegration.tsx 817 B

12345678910111213141516171819202122
  1. import * as qs from 'query-string';
  2. import {platformToIntegrationMap} from 'sentry/utils/integrationUtil';
  3. import Platform from './platform';
  4. import PlatformIntegrationSetup from './platformIntegrationSetup';
  5. type Props = React.ComponentProps<typeof Platform> &
  6. Omit<React.ComponentProps<typeof PlatformIntegrationSetup>, 'integrationSlug'>;
  7. const PlatformOrIntegration = (props: Props) => {
  8. const parsed = qs.parse(window.location.search);
  9. const {platform} = props.params;
  10. const integrationSlug = platform && platformToIntegrationMap[platform];
  11. // check for manual override query param
  12. if (integrationSlug && parsed.manual !== '1') {
  13. return <PlatformIntegrationSetup integrationSlug={integrationSlug} {...props} />;
  14. }
  15. return <Platform {...props} />;
  16. };
  17. export default PlatformOrIntegration;