diff --git a/utils/email/composer.ts b/utils/email/composer.ts new file mode 100644 index 00000000..4ace4d7f --- /dev/null +++ b/utils/email/composer.ts @@ -0,0 +1,67 @@ +import {Email} from "./email"; + +export class Composer { + private static noteBodySize = "14px"; + private static noteFontSize = "11px"; + + // TODO move to properties + private static openaireEmail = "mailto:openaire.test@gmail.com"; + + + private static ifYouAreNotResponsible(): string { + return "If you are not responsible for this community, please " + + "contact us."; + } + + private static manageNotificationSettings(): string { + // TODO take it from the method down + return "bla"; + } + + private static youAreManagerOfTheCommunity(): string { + // TODO take it from the method down + return "bla"; + } + + public static composeEmailForNewManager(communityId: string, communityName: string, newCommunityManagers: any): Email { + let email: Email = new Email(); + + email.subject = "[OpenAIRE-Connect] " + communityName + ": Welcome new manager"; + email.body = "

Welcome to OpenAIRE Connect!

" + + "

You are receiving this e-mail as you were assigned as manager of the community " + "\"" + communityName + "\"" + " dashboard. " + + "In order to access the administration section of your community you must first login using one of the available options. " + + "
The administrative rights are associated to the e-mail address, that was used to send you this message." + + " If you login with an account associated to a different email, please contact us" + + " or your colleagues, that already have access to the administration tool, to update your e-mail.
" + + "You can access the administration tool by clicking the \"Manage\" button that will be available in the top right corner of the dashboard." + + "

" + + "OpenAIRE team
" + "www.openaire.eu
" + + "

" + this.ifYouAreNotResponsible() + "

" + + "

"; + email.recipients = newCommunityManagers; + + console.log(email); + return email; + } + + public static composeEmailToInformOldManagersForTheNewOnes(communityName: string, communityId: string, firstVersionOfManagers: any, managers:any) : Email { + let email: Email; + + email.subject = "[OpenAIRE-Connect] " + communityName + ": Managers list notification"; + email.body = "
" + + "

There are updates in the managers list for \"" + communityName + "\" community.
" + + "The list of managers is: " + managers.join(', ') + "

" + + "OpenAIRE team
" + "www.openaire.eu
" + + "

You are receiving this e-mail as manager of the community " + + "" + communityName + ". " + + this.ifYouAreNotResponsible() + + "
" + + "Click here to manage your notification settings.

" + + "
"; + + email.recipients = firstVersionOfManagers; + return email; + } +}