newsletterConsent.tsx 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import {useEffect} from 'react';
  2. import {ApiForm} from 'sentry/components/forms';
  3. import FieldWrapper from 'sentry/components/forms/field/fieldWrapper';
  4. import RadioField from 'sentry/components/forms/fields/radioField';
  5. import ExternalLink from 'sentry/components/links/externalLink';
  6. import NarrowLayout from 'sentry/components/narrowLayout';
  7. import {t, tct} from 'sentry/locale';
  8. type Props = {
  9. onSubmitSuccess?: () => void;
  10. };
  11. function NewsletterConsent({onSubmitSuccess}: Props) {
  12. useEffect(() => {
  13. document.body.classList.add('auth');
  14. return () => document.body.classList.remove('auth');
  15. }, []);
  16. // NOTE: the text here is duplicated within ``RegisterForm`` on the backend
  17. return (
  18. <NarrowLayout>
  19. <ApiForm
  20. apiMethod="POST"
  21. apiEndpoint="/users/me/subscriptions/"
  22. onSubmitSuccess={onSubmitSuccess}
  23. submitLabel={t('Continue')}
  24. >
  25. <FieldWrapper stacked={false} hasControlState={false}>
  26. {t('Pardon the interruption, we just need to get a quick answer from you.')}
  27. </FieldWrapper>
  28. <RadioField
  29. name="subscribed"
  30. choices={[
  31. ['true', t('Yes, I would like to receive updates via email')],
  32. ['false', t("No, I'd prefer not to receive these updates")],
  33. ]}
  34. label={t('Email Updates')}
  35. required
  36. inline={false}
  37. help={tct(
  38. `We'd love to keep you updated via email with product and feature
  39. announcements, promotions, educational materials, and events. Our updates
  40. focus on relevant information, and we'll never sell your data to third
  41. parties. See our [link:Privacy Policy] for more details.
  42. `,
  43. {link: <ExternalLink href="https://sentry.io/privacy/" />}
  44. )}
  45. />
  46. </ApiForm>
  47. </NarrowLayout>
  48. );
  49. }
  50. export default NewsletterConsent;