Skip to content

Commit

Permalink
feat: Add email subject to form
Browse files Browse the repository at this point in the history
Will be used if subject is set dynamically to sendgrid
  • Loading branch information
sashko9807 committed Jun 19, 2024
1 parent ef43c2b commit 515efe1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion public/locales/bg/marketing.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"sendConsentEmail": "Изпращане на емайл за съгласие",
"common": {
"templateId": "Идентификатор на Sendgrid шаблон",
"listId": "Идентифицатор на Sendgrid списък с контакти"
"listId": "Идентифицатор на Sendgrid списък с контакти",
"subject": "Тема на емайл"
}
}
}
3 changes: 2 additions & 1 deletion public/locales/en/marketing.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"sendConsentEmail": "Send newsletter consent email",
"common": {
"templateId": "ID of Sendgrid template",
"listId": "ID of Sendgrid contact list"
"listId": "ID of Sendgrid contact list",
"subject": "Email subject"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ export default function SendConsentEmailForm() {
const initialValues: SendNewsLetterConsent = {
templateId: '',
listId: '',
subject: '',
dateThreshold: new Date().toISOString(),
}

const validationSchema: yup.SchemaOf<SendNewsLetterConsent> = yup.object().defined().shape({
templateId: yup.string().required(),
listId: yup.string().required(),
subject: yup.string().required(),
dateThreshold: yup.string().optional(),
})

Expand Down Expand Up @@ -60,6 +62,7 @@ export default function SendConsentEmailForm() {
const data: SendNewsLetterConsent = {
templateId: values.templateId,
listId: values.listId,
subject: values.subject,
dateThreshold: values.dateThreshold,
}
await mutation.mutateAsync(data)
Expand All @@ -86,6 +89,9 @@ export default function SendConsentEmailForm() {
<Grid item xs={12}>
<FormTextField type="text" label={t('admin.common.listId')} name="listId" />
</Grid>
<Grid item xs={12}>
<FormTextField type="text" label={t('admin.common.subject')} name="subject" />
</Grid>
<Grid
container
item
Expand Down
1 change: 1 addition & 0 deletions src/gql/marketing.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export type SendMarketingEmail = {
templateId: string
listId: string
subject: string
}

export type SendNewsLetterConsent = SendMarketingEmail & {
Expand Down

0 comments on commit 515efe1

Please sign in to comment.