sdkConfiguration.tsx 963 B

123456789101112131415161718192021222324252627
  1. import * as qs from 'query-string';
  2. import {platformToIntegrationMap} from 'sentry/utils/integrationUtil';
  3. import DocumentationSetup from './documentationSetup';
  4. import IntegrationSetup from './integrationSetup';
  5. import OtherSetup from './otherSetup';
  6. type Props = React.ComponentProps<typeof DocumentationSetup> &
  7. React.ComponentProps<typeof OtherSetup> &
  8. Omit<React.ComponentProps<typeof IntegrationSetup>, 'integrationSlug'>;
  9. const SdkConfiguration = (props: Props) => {
  10. const parsed = qs.parse(window.location.search);
  11. const {platform} = props;
  12. const integrationSlug = platform && platformToIntegrationMap[platform];
  13. // check for manual override query param
  14. if (integrationSlug && parsed.manual !== '1') {
  15. return <IntegrationSetup integrationSlug={integrationSlug} {...props} />;
  16. }
  17. if (platform === 'other') {
  18. return <OtherSetup {...props} />;
  19. }
  20. return <DocumentationSetup {...props} />;
  21. };
  22. export default SdkConfiguration;