sdkConfiguration.tsx 995 B

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