mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-23 06:30:51 -06:00
fix: linting warnings in email package (#2998)
This commit is contained in:
committed by
GitHub
parent
fb149796fa
commit
bbab7fa672
@@ -7,7 +7,7 @@ interface ForgotPasswordEmailProps {
|
|||||||
verifyLink: string;
|
verifyLink: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ForgotPasswordEmail({ verifyLink }: ForgotPasswordEmailProps) {
|
export function ForgotPasswordEmail({ verifyLink }: ForgotPasswordEmailProps): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<Heading>Change password</Heading>
|
<Heading>Change password</Heading>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Container, Heading, Text } from "@react-email/components";
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { EmailFooter } from "../general/email-footer";
|
import { EmailFooter } from "../general/email-footer";
|
||||||
|
|
||||||
export function PasswordResetNotifyEmail() {
|
export function PasswordResetNotifyEmail(): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<Heading>Password changed</Heading>
|
<Heading>Password changed</Heading>
|
||||||
|
|||||||
@@ -8,7 +8,10 @@ interface VerificationEmailProps {
|
|||||||
verificationRequestLink: string;
|
verificationRequestLink: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function VerificationEmail({ verifyLink, verificationRequestLink }: VerificationEmailProps) {
|
export function VerificationEmail({
|
||||||
|
verifyLink,
|
||||||
|
verificationRequestLink,
|
||||||
|
}: VerificationEmailProps): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<Heading>Almost there!</Heading>
|
<Heading>Almost there!</Heading>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ interface EmailButtonProps {
|
|||||||
href: string;
|
href: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function EmailButton({ label, href }: EmailButtonProps) {
|
export function EmailButton({ label, href }: EmailButtonProps): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
<Button className="rounded-md bg-black p-4 text-white" href={href}>
|
<Button className="rounded-md bg-black p-4 text-white" href={href}>
|
||||||
{label}
|
{label}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Text } from "@react-email/components";
|
import { Text } from "@react-email/components";
|
||||||
|
|
||||||
export function EmailFooter() {
|
export function EmailFooter(): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
<Text>
|
<Text>
|
||||||
Have a great day!
|
Have a great day!
|
||||||
|
|||||||
@@ -4,78 +4,76 @@ interface EmailTemplateProps {
|
|||||||
content: JSX.Element;
|
content: JSX.Element;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function EmailTemplate({ content }: EmailTemplateProps) {
|
export function EmailTemplate({ content }: EmailTemplateProps): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
<Html>
|
<Html>
|
||||||
<Tailwind>
|
<Tailwind>
|
||||||
<>
|
<Body
|
||||||
<Body
|
className="m-0 h-full w-full justify-center bg-slate-100 bg-slate-50 p-6 text-center text-base font-medium text-slate-800"
|
||||||
className="m-0 h-full w-full justify-center bg-slate-100 bg-slate-50 p-6 text-center text-base font-medium text-slate-800"
|
style={{
|
||||||
style={{
|
fontFamily: "'Jost', 'Helvetica Neue', 'Segoe UI', 'Helvetica', 'sans-serif'",
|
||||||
fontFamily: "'Jost', 'Helvetica Neue', 'Segoe UI', 'Helvetica', 'sans-serif'",
|
}}>
|
||||||
}}>
|
<Section>
|
||||||
<Section>
|
<Link href="https://formbricks.com?utm_source=email_header&utm_medium=email" target="_blank">
|
||||||
<Link href="https://formbricks.com?utm_source=email_header&utm_medium=email" target="_blank">
|
<Img
|
||||||
<Img
|
alt="Formbricks Logo"
|
||||||
alt="Formbricks Logo"
|
className="mx-auto w-80"
|
||||||
className="mx-auto w-80"
|
src="https://s3.eu-central-1.amazonaws.com/listmonk-formbricks/Formbricks-Light-transparent.png"
|
||||||
src="https://s3.eu-central-1.amazonaws.com/listmonk-formbricks/Formbricks-Light-transparent.png"
|
/>
|
||||||
/>
|
</Link>
|
||||||
</Link>
|
</Section>
|
||||||
</Section>
|
<Container className="mx-auto my-8 max-w-xl bg-white p-4 text-left">{content}</Container>
|
||||||
<Container className="mx-auto my-8 max-w-xl bg-white p-4 text-left">{content}</Container>
|
|
||||||
|
|
||||||
<Section>
|
<Section>
|
||||||
<Row>
|
<Row>
|
||||||
<Column align="right" key="twitter">
|
<Column align="right" key="twitter">
|
||||||
<Link href="https://twitter.com/formbricks" target="_blank">
|
<Link href="https://twitter.com/formbricks" target="_blank">
|
||||||
<Img
|
<Img
|
||||||
alt="Tw"
|
alt="Tw"
|
||||||
src="https://s3.eu-central-1.amazonaws.com/listmonk-formbricks/Twitter-transp.png"
|
src="https://s3.eu-central-1.amazonaws.com/listmonk-formbricks/Twitter-transp.png"
|
||||||
title="Twitter"
|
title="Twitter"
|
||||||
width="32"
|
width="32"
|
||||||
/>
|
/>
|
||||||
</Link>
|
</Link>
|
||||||
</Column>
|
</Column>
|
||||||
<Column align="center" className="w-20" key="github">
|
<Column align="center" className="w-20" key="github">
|
||||||
<Link href="https://formbricks.com/github" target="_blank">
|
<Link href="https://formbricks.com/github" target="_blank">
|
||||||
<Img
|
<Img
|
||||||
alt="GitHub"
|
alt="GitHub"
|
||||||
src="https://s3.eu-central-1.amazonaws.com/listmonk-formbricks/Github-transp.png"
|
src="https://s3.eu-central-1.amazonaws.com/listmonk-formbricks/Github-transp.png"
|
||||||
title="GitHub"
|
title="GitHub"
|
||||||
width="32"
|
width="32"
|
||||||
/>
|
/>
|
||||||
</Link>
|
</Link>
|
||||||
</Column>
|
</Column>
|
||||||
<Column align="left" key="discord">
|
<Column align="left" key="discord">
|
||||||
<Link href="https://formbricks.com/discord" target="_blank">
|
<Link href="https://formbricks.com/discord" target="_blank">
|
||||||
<Img
|
<Img
|
||||||
alt="Discord"
|
alt="Discord"
|
||||||
src="https://s3.eu-central-1.amazonaws.com/listmonk-formbricks/Discord-transp.png"
|
src="https://s3.eu-central-1.amazonaws.com/listmonk-formbricks/Discord-transp.png"
|
||||||
title="Discord"
|
title="Discord"
|
||||||
width="32"
|
width="32"
|
||||||
/>
|
/>
|
||||||
</Link>
|
</Link>
|
||||||
</Column>
|
</Column>
|
||||||
</Row>
|
</Row>
|
||||||
</Section>
|
</Section>
|
||||||
<Section className="mt-4 text-center">
|
<Section className="mt-4 text-center">
|
||||||
Formbricks {new Date().getFullYear()}. All rights reserved.
|
Formbricks {new Date().getFullYear()}. All rights reserved.
|
||||||
<br />
|
<br />
|
||||||
<Link
|
<Link
|
||||||
href="https://formbricks.com/imprint?utm_source=email_footer&utm_medium=email"
|
href="https://formbricks.com/imprint?utm_source=email_footer&utm_medium=email"
|
||||||
target="_blank">
|
target="_blank">
|
||||||
Imprint
|
Imprint
|
||||||
</Link>{" "}
|
</Link>{" "}
|
||||||
|{" "}
|
|{" "}
|
||||||
<Link
|
<Link
|
||||||
href="https://formbricks.com/privacy-policy?utm_source=email_footer&utm_medium=email"
|
href="https://formbricks.com/privacy-policy?utm_source=email_footer&utm_medium=email"
|
||||||
target="_blank">
|
target="_blank">
|
||||||
Privacy Policy
|
Privacy Policy
|
||||||
</Link>
|
</Link>
|
||||||
</Section>
|
</Section>
|
||||||
</Body>
|
</Body>
|
||||||
</>
|
|
||||||
</Tailwind>
|
</Tailwind>
|
||||||
</Html>
|
</Html>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -7,7 +7,10 @@ interface InviteAcceptedEmailProps {
|
|||||||
inviteeName: string;
|
inviteeName: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function InviteAcceptedEmail({ inviterName, inviteeName }: InviteAcceptedEmailProps) {
|
export function InviteAcceptedEmail({
|
||||||
|
inviterName,
|
||||||
|
inviteeName,
|
||||||
|
}: InviteAcceptedEmailProps): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<Text>Hey {inviterName},</Text>
|
<Text>Hey {inviterName},</Text>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ interface InviteEmailProps {
|
|||||||
verifyLink: string;
|
verifyLink: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function InviteEmail({ inviteeName, inviterName, verifyLink }: InviteEmailProps) {
|
export function InviteEmail({ inviteeName, inviterName, verifyLink }: InviteEmailProps): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<Text>Hey {inviteeName},</Text>
|
<Text>Hey {inviteeName},</Text>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export function OnboardingInviteEmail({
|
|||||||
inviteMessage,
|
inviteMessage,
|
||||||
inviterName,
|
inviterName,
|
||||||
verifyLink,
|
verifyLink,
|
||||||
}: OnboardingInviteEmailProps) {
|
}: OnboardingInviteEmailProps): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<Heading>Hey 👋</Heading>
|
<Heading>Hey 👋</Heading>
|
||||||
|
|||||||
@@ -6,7 +6,10 @@ interface EmbedSurveyPreviewEmailProps {
|
|||||||
environmentId: string;
|
environmentId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function EmbedSurveyPreviewEmail({ html, environmentId }: EmbedSurveyPreviewEmailProps) {
|
export function EmbedSurveyPreviewEmail({
|
||||||
|
html,
|
||||||
|
environmentId,
|
||||||
|
}: EmbedSurveyPreviewEmailProps): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<Heading>Preview Email Embed</Heading>
|
<Heading>Preview Email Embed</Heading>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ interface LinkSurveyEmailProps {
|
|||||||
getSurveyLink: () => string;
|
getSurveyLink: () => string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function LinkSurveyEmail({ surveyName, getSurveyLink }: LinkSurveyEmailProps) {
|
export function LinkSurveyEmail({ surveyName, getSurveyLink }: LinkSurveyEmailProps): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<Heading>Hey 👋</Heading>
|
<Heading>Hey 👋</Heading>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import { COLOR_DEFAULTS } from "@formbricks/lib/styling/constants";
|
|||||||
import { isLight, mixColor } from "@formbricks/lib/utils/colors";
|
import { isLight, mixColor } from "@formbricks/lib/utils/colors";
|
||||||
import { type TSurvey, TSurveyQuestionTypeEnum, type TSurveyStyling } from "@formbricks/types/surveys/types";
|
import { type TSurvey, TSurveyQuestionTypeEnum, type TSurveyStyling } from "@formbricks/types/surveys/types";
|
||||||
import { RatingSmiley } from "@formbricks/ui/RatingSmiley";
|
import { RatingSmiley } from "@formbricks/ui/RatingSmiley";
|
||||||
import { getNPSOptionColor, getRatingNumberOptionColor } from "../../utils";
|
import { getNPSOptionColor, getRatingNumberOptionColor } from "../../lib/utils";
|
||||||
|
|
||||||
interface PreviewEmailTemplateProps {
|
interface PreviewEmailTemplateProps {
|
||||||
survey: TSurvey;
|
survey: TSurvey;
|
||||||
@@ -26,13 +26,21 @@ interface PreviewEmailTemplateProps {
|
|||||||
styling: TSurveyStyling;
|
styling: TSurveyStyling;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getPreviewEmailTemplateHtml = (survey: TSurvey, surveyUrl: string, styling: TSurveyStyling) => {
|
export const getPreviewEmailTemplateHtml = (
|
||||||
|
survey: TSurvey,
|
||||||
|
surveyUrl: string,
|
||||||
|
styling: TSurveyStyling
|
||||||
|
): string => {
|
||||||
return render(<PreviewEmailTemplate styling={styling} survey={survey} surveyUrl={surveyUrl} />, {
|
return render(<PreviewEmailTemplate styling={styling} survey={survey} surveyUrl={surveyUrl} />, {
|
||||||
pretty: true,
|
pretty: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export function PreviewEmailTemplate({ survey, surveyUrl, styling }: PreviewEmailTemplateProps) {
|
export function PreviewEmailTemplate({
|
||||||
|
survey,
|
||||||
|
surveyUrl,
|
||||||
|
styling,
|
||||||
|
}: PreviewEmailTemplateProps): React.JSX.Element {
|
||||||
const url = `${surveyUrl}?preview=true`;
|
const url = `${surveyUrl}?preview=true`;
|
||||||
const urlWithPrefilling = `${surveyUrl}?preview=true&skipPrefilled=true&`;
|
const urlWithPrefilling = `${surveyUrl}?preview=true&skipPrefilled=true&`;
|
||||||
const defaultLanguageCode = "default";
|
const defaultLanguageCode = "default";
|
||||||
@@ -371,11 +379,11 @@ export function PreviewEmailTemplate({ survey, surveyUrl, styling }: PreviewEmai
|
|||||||
<Section className="w-full table-auto">
|
<Section className="w-full table-auto">
|
||||||
<Row>
|
<Row>
|
||||||
<Column className="w-40 break-words px-4 py-2" />
|
<Column className="w-40 break-words px-4 py-2" />
|
||||||
{firstQuestion.columns.map((column, columnIndex) => {
|
{firstQuestion.columns.map((column) => {
|
||||||
return (
|
return (
|
||||||
<Column
|
<Column
|
||||||
className="text-question-color max-w-40 break-words px-4 py-2 text-center"
|
className="text-question-color max-w-40 break-words px-4 py-2 text-center"
|
||||||
key={columnIndex}>
|
key={getLocalizedValue(column, "default")}>
|
||||||
{getLocalizedValue(column, "default")}
|
{getLocalizedValue(column, "default")}
|
||||||
</Column>
|
</Column>
|
||||||
);
|
);
|
||||||
@@ -385,13 +393,15 @@ export function PreviewEmailTemplate({ survey, surveyUrl, styling }: PreviewEmai
|
|||||||
return (
|
return (
|
||||||
<Row
|
<Row
|
||||||
className={`${rowIndex % 2 === 0 ? "bg-input-color" : ""} rounded-custom`}
|
className={`${rowIndex % 2 === 0 ? "bg-input-color" : ""} rounded-custom`}
|
||||||
key={rowIndex}>
|
key={getLocalizedValue(row, "default")}>
|
||||||
<Column className="w-40 break-words px-4 py-2">
|
<Column className="w-40 break-words px-4 py-2">
|
||||||
{getLocalizedValue(row, "default")}
|
{getLocalizedValue(row, "default")}
|
||||||
</Column>
|
</Column>
|
||||||
{firstQuestion.columns.map((_, index) => {
|
{firstQuestion.columns.map((_) => {
|
||||||
return (
|
return (
|
||||||
<Column className="text-question-color px-4 py-2" key={index}>
|
<Column
|
||||||
|
className="text-question-color px-4 py-2"
|
||||||
|
key={getLocalizedValue(_, "default")}>
|
||||||
<Section className="bg-card-bg-color h-4 w-4 rounded-full p-2 outline" />
|
<Section className="bg-card-bg-color h-4 w-4 rounded-full p-2 outline" />
|
||||||
</Column>
|
</Column>
|
||||||
);
|
);
|
||||||
@@ -459,7 +469,7 @@ function EmailTemplateWrapper({
|
|||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
surveyUrl: string;
|
surveyUrl: string;
|
||||||
styling: TSurveyStyling;
|
styling: TSurveyStyling;
|
||||||
}) {
|
}): React.JSX.Element {
|
||||||
let signatureColor = "";
|
let signatureColor = "";
|
||||||
const colors = {
|
const colors = {
|
||||||
"brand-color": styling.brandColor?.light ?? COLOR_DEFAULTS.brandColor,
|
"brand-color": styling.brandColor?.light ?? COLOR_DEFAULTS.brandColor,
|
||||||
@@ -501,7 +511,7 @@ function EmailTemplateWrapper({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function EmailFooter() {
|
function EmailFooter(): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
<Container className="m-auto mt-8 text-center">
|
<Container className="m-auto mt-8 text-center">
|
||||||
<Link className="text-signature-color text-xs" href="https://formbricks.com/" target="_blank">
|
<Link className="text-signature-color text-xs" href="https://formbricks.com/" target="_blank">
|
||||||
|
|||||||
@@ -10,7 +10,10 @@ import {
|
|||||||
} from "@formbricks/types/surveys/types";
|
} from "@formbricks/types/surveys/types";
|
||||||
import { EmailButton } from "../general/email-button";
|
import { EmailButton } from "../general/email-button";
|
||||||
|
|
||||||
export const renderEmailResponseValue = (response: string | string[], questionType: TSurveyQuestionType) => {
|
export const renderEmailResponseValue = (
|
||||||
|
response: string | string[],
|
||||||
|
questionType: TSurveyQuestionType
|
||||||
|
): React.JSX.Element => {
|
||||||
switch (questionType) {
|
switch (questionType) {
|
||||||
case TSurveyQuestionTypeEnum.FileUpload:
|
case TSurveyQuestionTypeEnum.FileUpload:
|
||||||
return (
|
return (
|
||||||
@@ -67,7 +70,7 @@ export function ResponseFinishedEmail({
|
|||||||
WEBAPP_URL,
|
WEBAPP_URL,
|
||||||
environmentId,
|
environmentId,
|
||||||
organization,
|
organization,
|
||||||
}: ResponseFinishedEmailProps) {
|
}: ResponseFinishedEmailProps): React.JSX.Element {
|
||||||
const questions = getQuestionResponseMapping(survey, response);
|
const questions = getQuestionResponseMapping(survey, response);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -143,7 +146,7 @@ export function ResponseFinishedEmail({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function FileIcon() {
|
function FileIcon(): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
<svg
|
<svg
|
||||||
className="lucide lucide-file"
|
className="lucide lucide-file"
|
||||||
@@ -162,7 +165,7 @@ function FileIcon() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function EyeOffIcon() {
|
function EyeOffIcon(): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ interface CreateReminderNotificationBodyProps {
|
|||||||
notificationData: TWeeklySummaryNotificationResponse;
|
notificationData: TWeeklySummaryNotificationResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function CreateReminderNotificationBody({ notificationData }: CreateReminderNotificationBodyProps) {
|
export function CreateReminderNotificationBody({
|
||||||
|
notificationData,
|
||||||
|
}: CreateReminderNotificationBodyProps): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<Text>
|
<Text>
|
||||||
|
|||||||
@@ -33,8 +33,13 @@ interface LiveSurveyNotificationProps {
|
|||||||
surveys: TWeeklySummaryNotificationDataSurvey[];
|
surveys: TWeeklySummaryNotificationDataSurvey[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const LiveSurveyNotification = ({ environmentId, surveys }: LiveSurveyNotificationProps) => {
|
export const LiveSurveyNotification = ({
|
||||||
const createSurveyFields = (surveyResponses: TWeeklySummarySurveyResponseData[]) => {
|
environmentId,
|
||||||
|
surveys,
|
||||||
|
}: LiveSurveyNotificationProps): React.JSX.Element[] => {
|
||||||
|
const createSurveyFields = (
|
||||||
|
surveyResponses: TWeeklySummarySurveyResponseData[]
|
||||||
|
): React.JSX.Element | React.JSX.Element[] => {
|
||||||
if (surveyResponses.length === 0) {
|
if (surveyResponses.length === 0) {
|
||||||
return (
|
return (
|
||||||
<Container className="mt-4">
|
<Container className="mt-4">
|
||||||
@@ -66,14 +71,14 @@ export const LiveSurveyNotification = ({ environmentId, surveys }: LiveSurveyNot
|
|||||||
return surveyFields;
|
return surveyFields;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!surveys.length) return "";
|
if (!surveys.length) return [];
|
||||||
|
|
||||||
return surveys.map((survey, index) => {
|
return surveys.map((survey) => {
|
||||||
const displayStatus = convertSurveyStatus(survey.status);
|
const displayStatus = convertSurveyStatus(survey.status);
|
||||||
const isInProgress = displayStatus === "In Progress";
|
const isInProgress = displayStatus === "In Progress";
|
||||||
const noResponseLastWeek = isInProgress && survey.responses.length === 0;
|
const noResponseLastWeek = isInProgress && survey.responses.length === 0;
|
||||||
return (
|
return (
|
||||||
<Tailwind key={index}>
|
<Tailwind key={survey.id}>
|
||||||
<Container className="mt-12">
|
<Container className="mt-12">
|
||||||
<Text className="mb-0 inline">
|
<Text className="mb-0 inline">
|
||||||
<Link
|
<Link
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export function NoLiveSurveyNotificationEmail({
|
|||||||
endDate,
|
endDate,
|
||||||
startYear,
|
startYear,
|
||||||
endYear,
|
endYear,
|
||||||
}: NoLiveSurveyNotificationEmailProps) {
|
}: NoLiveSurveyNotificationEmailProps): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<NotificationHeader
|
<NotificationHeader
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { WEBAPP_URL } from "@formbricks/lib/constants";
|
|||||||
interface NotificatonFooterProps {
|
interface NotificatonFooterProps {
|
||||||
environmentId: string;
|
environmentId: string;
|
||||||
}
|
}
|
||||||
export function NotificationFooter({ environmentId }: NotificatonFooterProps) {
|
export function NotificationFooter({ environmentId }: NotificatonFooterProps): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
<Tailwind>
|
<Tailwind>
|
||||||
<Container className="w-full">
|
<Container className="w-full">
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ export function NotificationHeader({
|
|||||||
endDate,
|
endDate,
|
||||||
startYear,
|
startYear,
|
||||||
endYear,
|
endYear,
|
||||||
}: NotificationHeaderProps) {
|
}: NotificationHeaderProps): React.JSX.Element {
|
||||||
const getNotificationHeaderimePeriod = () => {
|
const getNotificationHeaderimePeriod = (): React.JSX.Element => {
|
||||||
if (startYear === endYear) {
|
if (startYear === endYear) {
|
||||||
return (
|
return (
|
||||||
<Text className="m-0 text-right">
|
<Text className="m-0 text-right">
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ interface NotificationInsightProps {
|
|||||||
insights: TWeeklySummaryInsights;
|
insights: TWeeklySummaryInsights;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function NotificationInsight({ insights }: NotificationInsightProps) {
|
export function NotificationInsight({ insights }: NotificationInsightProps): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<Section className="my-4 rounded-md bg-slate-100">
|
<Section className="my-4 rounded-md bg-slate-100">
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export function WeeklySummaryNotificationEmail({
|
|||||||
endDate,
|
endDate,
|
||||||
startYear,
|
startYear,
|
||||||
endYear,
|
endYear,
|
||||||
}: WeeklySummaryNotificationEmailProps) {
|
}: WeeklySummaryNotificationEmailProps): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<NotificationHeader
|
<NotificationHeader
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { render } from "@react-email/render";
|
import { render } from "@react-email/render";
|
||||||
import nodemailer from "nodemailer";
|
import { createTransport } from "nodemailer";
|
||||||
import type SMTPTransport from "nodemailer/lib/smtp-transport";
|
import type SMTPTransport from "nodemailer/lib/smtp-transport";
|
||||||
import {
|
import {
|
||||||
DEBUG,
|
DEBUG,
|
||||||
@@ -56,10 +56,10 @@ const getEmailSubject = (productName: string): string => {
|
|||||||
return `${productName} User Insights - Last Week by Formbricks`;
|
return `${productName} User Insights - Last Week by Formbricks`;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const sendEmail = async (emailData: SendEmailDataProps) => {
|
export const sendEmail = async (emailData: SendEmailDataProps): Promise<void> => {
|
||||||
if (!IS_SMTP_CONFIGURED) return;
|
if (!IS_SMTP_CONFIGURED) return;
|
||||||
|
|
||||||
const transporter = nodemailer.createTransport({
|
const transporter = createTransport({
|
||||||
host: SMTP_HOST,
|
host: SMTP_HOST,
|
||||||
port: SMTP_PORT,
|
port: SMTP_PORT,
|
||||||
secure: SMTP_SECURE_ENABLED, // true for 465, false for other ports
|
secure: SMTP_SECURE_ENABLED, // true for 465, false for other ports
|
||||||
@@ -79,7 +79,7 @@ export const sendEmail = async (emailData: SendEmailDataProps) => {
|
|||||||
await transporter.sendMail({ ...emailDefaults, ...emailData });
|
await transporter.sendMail({ ...emailDefaults, ...emailData });
|
||||||
};
|
};
|
||||||
|
|
||||||
export const sendVerificationEmail = async (user: TEmailUser) => {
|
export const sendVerificationEmail = async (user: TEmailUser): Promise<void> => {
|
||||||
const token = createToken(user.id, user.email, {
|
const token = createToken(user.id, user.email, {
|
||||||
expiresIn: "1d",
|
expiresIn: "1d",
|
||||||
});
|
});
|
||||||
@@ -94,7 +94,7 @@ export const sendVerificationEmail = async (user: TEmailUser) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const sendForgotPasswordEmail = async (user: TEmailUser) => {
|
export const sendForgotPasswordEmail = async (user: TEmailUser): Promise<void> => {
|
||||||
const token = createToken(user.id, user.email, {
|
const token = createToken(user.id, user.email, {
|
||||||
expiresIn: "1d",
|
expiresIn: "1d",
|
||||||
});
|
});
|
||||||
@@ -106,7 +106,7 @@ export const sendForgotPasswordEmail = async (user: TEmailUser) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const sendPasswordResetNotifyEmail = async (user: TEmailUser) => {
|
export const sendPasswordResetNotifyEmail = async (user: TEmailUser): Promise<void> => {
|
||||||
await sendEmail({
|
await sendEmail({
|
||||||
to: user.email,
|
to: user.email,
|
||||||
subject: "Your Formbricks password has been changed",
|
subject: "Your Formbricks password has been changed",
|
||||||
@@ -121,7 +121,7 @@ export const sendInviteMemberEmail = async (
|
|||||||
inviteeName: string,
|
inviteeName: string,
|
||||||
isOnboardingInvite?: boolean,
|
isOnboardingInvite?: boolean,
|
||||||
inviteMessage?: string
|
inviteMessage?: string
|
||||||
) => {
|
): Promise<void> => {
|
||||||
const token = createInviteToken(inviteId, email, {
|
const token = createInviteToken(inviteId, email, {
|
||||||
expiresIn: "7d",
|
expiresIn: "7d",
|
||||||
});
|
});
|
||||||
@@ -145,7 +145,11 @@ export const sendInviteMemberEmail = async (
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const sendInviteAcceptedEmail = async (inviterName: string, inviteeName: string, email: string) => {
|
export const sendInviteAcceptedEmail = async (
|
||||||
|
inviterName: string,
|
||||||
|
inviteeName: string,
|
||||||
|
email: string
|
||||||
|
): Promise<void> => {
|
||||||
await sendEmail({
|
await sendEmail({
|
||||||
to: email,
|
to: email,
|
||||||
subject: `You've got a new organization member!`,
|
subject: `You've got a new organization member!`,
|
||||||
@@ -159,7 +163,7 @@ export const sendResponseFinishedEmail = async (
|
|||||||
survey: TSurvey,
|
survey: TSurvey,
|
||||||
response: TResponse,
|
response: TResponse,
|
||||||
responseCount: number
|
responseCount: number
|
||||||
) => {
|
): Promise<void> => {
|
||||||
const personEmail = response.personAttributes?.email;
|
const personEmail = response.personAttributes?.email;
|
||||||
const organization = await getOrganizationByEnvironmentId(environmentId);
|
const organization = await getOrganizationByEnvironmentId(environmentId);
|
||||||
|
|
||||||
@@ -193,7 +197,7 @@ export const sendEmbedSurveyPreviewEmail = async (
|
|||||||
subject: string,
|
subject: string,
|
||||||
html: string,
|
html: string,
|
||||||
environmentId: string
|
environmentId: string
|
||||||
) => {
|
): Promise<void> => {
|
||||||
await sendEmail({
|
await sendEmail({
|
||||||
to,
|
to,
|
||||||
subject,
|
subject,
|
||||||
@@ -201,13 +205,13 @@ export const sendEmbedSurveyPreviewEmail = async (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const sendLinkSurveyToVerifiedEmail = async (data: LinkSurveyEmailData) => {
|
export const sendLinkSurveyToVerifiedEmail = async (data: LinkSurveyEmailData): Promise<void> => {
|
||||||
const surveyId = data.surveyId;
|
const surveyId = data.surveyId;
|
||||||
const email = data.email;
|
const email = data.email;
|
||||||
const surveyName = data.surveyName;
|
const surveyName = data.surveyName;
|
||||||
const singleUseId = data.suId;
|
const singleUseId = data.suId;
|
||||||
const token = createTokenForLinkSurvey(surveyId, email);
|
const token = createTokenForLinkSurvey(surveyId, email);
|
||||||
const getSurveyLink = () => {
|
const getSurveyLink = (): string => {
|
||||||
if (singleUseId) {
|
if (singleUseId) {
|
||||||
return `${WEBAPP_URL}/s/${surveyId}?verify=${encodeURIComponent(token)}&suId=${singleUseId}`;
|
return `${WEBAPP_URL}/s/${surveyId}?verify=${encodeURIComponent(token)}&suId=${singleUseId}`;
|
||||||
}
|
}
|
||||||
@@ -223,7 +227,7 @@ export const sendLinkSurveyToVerifiedEmail = async (data: LinkSurveyEmailData) =
|
|||||||
export const sendWeeklySummaryNotificationEmail = async (
|
export const sendWeeklySummaryNotificationEmail = async (
|
||||||
email: string,
|
email: string,
|
||||||
notificationData: TWeeklySummaryNotificationResponse
|
notificationData: TWeeklySummaryNotificationResponse
|
||||||
) => {
|
): Promise<void> => {
|
||||||
const startDate = `${notificationData.lastWeekDate.getDate().toString()} ${notificationData.lastWeekDate.toLocaleString(
|
const startDate = `${notificationData.lastWeekDate.getDate().toString()} ${notificationData.lastWeekDate.toLocaleString(
|
||||||
"default",
|
"default",
|
||||||
{ month: "short" }
|
{ month: "short" }
|
||||||
@@ -254,7 +258,7 @@ export const sendWeeklySummaryNotificationEmail = async (
|
|||||||
export const sendNoLiveSurveyNotificationEmail = async (
|
export const sendNoLiveSurveyNotificationEmail = async (
|
||||||
email: string,
|
email: string,
|
||||||
notificationData: TWeeklySummaryNotificationResponse
|
notificationData: TWeeklySummaryNotificationResponse
|
||||||
) => {
|
): Promise<void> => {
|
||||||
const startDate = `${notificationData.lastWeekDate.getDate().toString()} ${notificationData.lastWeekDate.toLocaleString(
|
const startDate = `${notificationData.lastWeekDate.getDate().toString()} ${notificationData.lastWeekDate.toLocaleString(
|
||||||
"default",
|
"default",
|
||||||
{ month: "short" }
|
{ month: "short" }
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ export const getNPSOptionColor = (idx: number): string => {
|
|||||||
return "bg-rose-100";
|
return "bg-rose-100";
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getRatingNumberOptionColor = (range: number, idx: number) => {
|
export const getRatingNumberOptionColor = (range: number, idx: number): string => {
|
||||||
if (range > 5) {
|
if (range > 5) {
|
||||||
if (range - idx < 2) return "bg-emerald-100";
|
if (range - idx < 2) return "bg-emerald-100";
|
||||||
if (range - idx < 4) return "bg-orange-100";
|
if (range - idx < 4) return "bg-orange-100";
|
||||||
Reference in New Issue
Block a user