2022-06-06 17:49:56 +00:00
|
|
|
import { renderEmail } from "../";
|
|
|
|
import BaseEmail from "./_base-email";
|
|
|
|
|
|
|
|
export interface Feedback {
|
2022-06-07 14:39:47 +00:00
|
|
|
username: string;
|
|
|
|
email: string;
|
2022-06-06 17:49:56 +00:00
|
|
|
rating: string;
|
|
|
|
comment: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default class FeedbackEmail extends BaseEmail {
|
|
|
|
feedback: Feedback;
|
|
|
|
|
|
|
|
constructor(feedback: Feedback) {
|
|
|
|
super();
|
|
|
|
this.feedback = feedback;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected getNodeMailerPayload(): Record<string, unknown> {
|
|
|
|
return {
|
|
|
|
from: `Cal.com <${this.getMailerOptions().from}>`,
|
|
|
|
to: process.env.SEND_FEEDBACK_EMAIL,
|
|
|
|
subject: `User Feedback`,
|
|
|
|
html: renderEmail("FeedbackEmail", this.feedback),
|
|
|
|
text: this.getTextBody(),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
protected getTextBody(): string {
|
|
|
|
return `
|
2022-06-07 14:39:47 +00:00
|
|
|
User: ${this.feedback.username}
|
|
|
|
Email: ${this.feedback.email}
|
2022-06-06 17:49:56 +00:00
|
|
|
Rating: ${this.feedback.rating}
|
|
|
|
Comment: ${this.feedback.comment}
|
|
|
|
`;
|
|
|
|
}
|
|
|
|
}
|