-
Notifications
You must be signed in to change notification settings - Fork 3.8k
feat(emails): add sub-processor change notification template #6820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+224
−1
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,6 @@ | ||
| export { ScheduleDisabledEmail } from './schedule-disabled-email' | ||
| export { | ||
| type SubprocessorChange, | ||
| SubprocessorChangeEmail, | ||
| type SubprocessorChangeType, | ||
| } from './subprocessor-change-email' |
138 changes: 138 additions & 0 deletions
138
apps/sim/components/emails/notifications/subprocessor-change-email.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| import { Link, Section, Text } from '@react-email/components' | ||
| import { baseStyles } from '@/components/emails/_styles' | ||
| import { EmailButton, EmailLayout, EmailStrong } from '@/components/emails/components' | ||
| import { getBrandConfig } from '@/ee/whitelabeling' | ||
|
|
||
| /** How a sub-processor's role on the list is changing. */ | ||
| export type SubprocessorChangeType = 'added' | 'replaced' | 'removed' | ||
|
|
||
| const CHANGE_TYPE_LABEL: Record<SubprocessorChangeType, string> = { | ||
| added: 'New sub-processor', | ||
| replaced: 'Replacement sub-processor', | ||
| removed: 'Sub-processor being removed', | ||
| } | ||
|
|
||
| /** | ||
| * Dates in a notice period have to be unambiguous, so the month is spelled out | ||
| * rather than left to the recipient's locale ordering of a numeric date. The | ||
| * zone is pinned because the notice window is contractual — the rendered day | ||
| * must not shift with the server the send happens to run on. | ||
| */ | ||
| const NOTICE_DATE_FORMAT: Intl.DateTimeFormatOptions = { | ||
| month: 'long', | ||
| day: 'numeric', | ||
| year: 'numeric', | ||
| timeZone: 'UTC', | ||
| } | ||
|
|
||
| function formatNoticeDate(date: Date): string { | ||
| return date.toLocaleDateString('en-US', NOTICE_DATE_FORMAT) | ||
| } | ||
|
|
||
| export interface SubprocessorChange { | ||
| /** Legal entity name of the sub-processor. */ | ||
| name: string | ||
| /** What it is used for, in plain language. */ | ||
| purpose: string | ||
| /** Categories of customer personal data it will process. */ | ||
| dataCategories: string | ||
| /** Primary processing location, e.g. `United States`. */ | ||
| location: string | ||
| changeType: SubprocessorChangeType | ||
| } | ||
|
|
||
| interface SubprocessorChangeEmailProps { | ||
| recipientName?: string | ||
| /** The sub-processors being added, replaced, or removed in this notice. */ | ||
| changes: SubprocessorChange[] | ||
| /** When the change takes effect. Sent at least 30 days ahead of this date. */ | ||
| effectiveDate: Date | ||
| /** Last day an objection can be raised. Falls on or before {@link effectiveDate}. */ | ||
| objectionDeadline: Date | ||
| /** Where an objection is sent. */ | ||
| objectionEmail: string | ||
| /** The public sub-processor list, which reflects the change once it is live. */ | ||
| subprocessorListUrl: string | ||
| /** Where the recipient manages whether they receive these notices. */ | ||
| subscriptionUrl?: string | ||
| } | ||
|
|
||
| /** | ||
| * Advance notice to subscribed customers that the sub-processors handling their | ||
| * personal data are changing, with the window and address for objecting. | ||
| */ | ||
| export function SubprocessorChangeEmail({ | ||
| recipientName, | ||
| changes, | ||
| effectiveDate, | ||
| objectionDeadline, | ||
| objectionEmail, | ||
| subprocessorListUrl, | ||
| subscriptionUrl, | ||
| }: SubprocessorChangeEmailProps) { | ||
| const brand = getBrandConfig() | ||
| const effectiveDateLabel = formatNoticeDate(effectiveDate) | ||
| const previewText = `${brand.name} is changing its sub-processors on ${effectiveDateLabel}` | ||
|
|
||
| return ( | ||
| <EmailLayout preview={previewText} showUnsubscribe={false}> | ||
| <Text style={baseStyles.greeting}>{recipientName ? `Hi ${recipientName},` : 'Hi,'}</Text> | ||
|
|
||
| <Text style={baseStyles.paragraph}> | ||
| We are giving you advance notice of a change to the sub-processors {brand.name} uses to | ||
| process customer personal data. The change takes effect on{' '} | ||
| <EmailStrong>{effectiveDateLabel}</EmailStrong>. | ||
| </Text> | ||
|
|
||
| {changes.map((change) => ( | ||
| <Section key={change.name} style={baseStyles.infoBox}> | ||
| <Text style={baseStyles.infoBoxTitle}> | ||
| {change.name} — {CHANGE_TYPE_LABEL[change.changeType]} | ||
| </Text> | ||
| <Text style={baseStyles.infoBoxList}> | ||
| Purpose: {change.purpose} | ||
| <br /> | ||
| Data processed: {change.dataCategories} | ||
| <br /> | ||
| Processing location: {change.location} | ||
| <br /> | ||
| Effective: {effectiveDateLabel} | ||
| </Text> | ||
| </Section> | ||
| ))} | ||
|
|
||
| <Text style={baseStyles.paragraph}> | ||
| If you object to this change, reply to this email or write to{' '} | ||
| <Link href={`mailto:${objectionEmail}`} style={baseStyles.link}> | ||
| {objectionEmail} | ||
| </Link>{' '} | ||
| by <EmailStrong>{formatNoticeDate(objectionDeadline)}</EmailStrong>. We will work with you | ||
| on a resolution, and you may terminate the affected service if we cannot reach one. | ||
| </Text> | ||
|
|
||
| <Text style={baseStyles.paragraph}> | ||
| No action is needed if you have no objection. The full list of sub-processors stays current | ||
| at the link below. | ||
| </Text> | ||
|
|
||
| <EmailButton href={subprocessorListUrl}>View sub-processor list</EmailButton> | ||
|
|
||
| <div style={baseStyles.divider} /> | ||
|
|
||
| <Text style={baseStyles.footnote}> | ||
| Sent to customers subscribed to sub-processor change notices. | ||
| {subscriptionUrl ? ( | ||
| <> | ||
| {' '} | ||
| <Link href={subscriptionUrl} style={baseStyles.footerLink}> | ||
| Manage whether you receive them | ||
| </Link> | ||
| . | ||
| </> | ||
| ) : null} | ||
| </Text> | ||
| </EmailLayout> | ||
| ) | ||
| } | ||
|
|
||
| export default SubprocessorChangeEmail | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Objection mailto opens blank tab
Medium Severity
The objection address is rendered with react-email's
Link, which defaults totarget="_blank". For amailto:href that opens a blank tab next to the compose window in most webmail clients. The shared footer already documents this and uses a raw<a>for support mailto links instead.Reviewed by Cursor Bugbot for commit 72606dc. Configure here.