upsellButton.tsx 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import {Button} from 'sentry/components/core/button';
  2. import {IconBusiness} from 'sentry/icons';
  3. import type {Organization} from 'sentry/types/organization';
  4. import UpsellProvider from 'getsentry/components/upsellProvider';
  5. import type {Subscription} from 'getsentry/types';
  6. type Props = Pick<
  7. React.ComponentProps<typeof UpsellProvider>,
  8. 'source' | 'extraAnalyticsParams'
  9. > &
  10. Omit<React.ComponentProps<typeof Button>, 'aria-label'> & {
  11. organization?: Organization;
  12. subscription?: Subscription;
  13. };
  14. function UpsellButton({
  15. source,
  16. extraAnalyticsParams,
  17. subscription,
  18. organization,
  19. ...rest
  20. }: Props) {
  21. return (
  22. <UpsellProvider
  23. source={source}
  24. organization={organization}
  25. triggerMemberRequests
  26. extraAnalyticsParams={extraAnalyticsParams}
  27. subscription={subscription}
  28. >
  29. {({onClick, defaultButtonText}) => (
  30. <Button onClick={onClick} icon={<IconBusiness />} {...rest}>
  31. {defaultButtonText}
  32. </Button>
  33. )}
  34. </UpsellProvider>
  35. );
  36. }
  37. export default UpsellButton;