useAM2ProfilingUpsellModal.tsx 763 B

1234567891011121314151617181920212223242526272829
  1. import {useCallback} from 'react';
  2. import useOrganization from 'sentry/utils/useOrganization';
  3. import type {UpsellModalSamePriceProps} from 'getsentry/actionCreators/modal';
  4. import {openAM2ProfilingUpsellModal} from 'getsentry/actionCreators/modal';
  5. import type {Subscription} from 'getsentry/types';
  6. export function useAM2ProfilingUpsellModal({
  7. subscription,
  8. onComplete,
  9. }: {
  10. subscription: Subscription;
  11. onComplete?: UpsellModalSamePriceProps['onComplete'];
  12. }) {
  13. const organization = useOrganization();
  14. const handleShowModal = useCallback(() => {
  15. openAM2ProfilingUpsellModal({
  16. organization,
  17. subscription,
  18. onComplete,
  19. });
  20. }, [organization, subscription, onComplete]);
  21. return {
  22. showModal: handleShowModal,
  23. };
  24. }