useLogUpgradeNowViewed.tsx 934 B

12345678910111213141516171819202122232425262728293031323334
  1. import {useEffect} from 'react';
  2. import type {Organization} from 'sentry/types/organization';
  3. import type {Subscription} from 'getsentry/types';
  4. import trackGetsentryAnalytics, {
  5. type AM2UpdateSurfaces,
  6. } from 'getsentry/utils/trackGetsentryAnalytics';
  7. type Props = {
  8. hasPriceChange: boolean;
  9. organization: Organization;
  10. subscription: Subscription;
  11. surface: AM2UpdateSurfaces;
  12. };
  13. export default function useLogUpgradeNowViewed({
  14. hasPriceChange,
  15. organization,
  16. subscription,
  17. surface,
  18. }: Props) {
  19. useEffect(() => {
  20. trackGetsentryAnalytics('upgrade_now.modal.viewed', {
  21. organization,
  22. planTier: subscription.planTier,
  23. canSelfServe: subscription.canSelfServe,
  24. channel: subscription.channel,
  25. has_billing_scope: organization.access?.includes('org:billing'),
  26. surface,
  27. has_price_change: hasPriceChange,
  28. });
  29. }, [hasPriceChange, organization, subscription, surface]);
  30. }