newsletterConsent.tsx 1.8 KB

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