mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-30 10:19:51 -06:00
moves the TFunction type to a common place
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
import { Container, Heading, Text } from "@react-email/components";
|
||||
import { TFunction } from "@/src/types/translations";
|
||||
import { EmailButton } from "../../src/components/email-button";
|
||||
import { EmailFooter } from "../../src/components/email-footer";
|
||||
import { EmailTemplate } from "../../src/components/email-template";
|
||||
import { exampleData } from "../../src/lib/example-data";
|
||||
import { t as mockT } from "../../src/lib/mock-translate";
|
||||
|
||||
type TFunction = (key: string, replacements?: Record<string, string>) => string;
|
||||
|
||||
interface ForgotPasswordEmailProps {
|
||||
readonly verifyLink: string;
|
||||
readonly t?: TFunction;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { Container, Heading, Link, Text } from "@react-email/components";
|
||||
import { TFunction } from "@/src/types/translations";
|
||||
import { EmailButton } from "../../src/components/email-button";
|
||||
import { EmailFooter } from "../../src/components/email-footer";
|
||||
import { EmailTemplate } from "../../src/components/email-template";
|
||||
import { exampleData } from "../../src/lib/example-data";
|
||||
import { t as mockT } from "../../src/lib/mock-translate";
|
||||
|
||||
type TFunction = (key: string, replacements?: Record<string, string>) => string;
|
||||
|
||||
interface NewEmailVerificationProps {
|
||||
readonly verifyLink: string;
|
||||
readonly t?: TFunction;
|
||||
@@ -24,7 +23,7 @@ export function NewEmailVerification({
|
||||
<Text className="text-sm">{t("emails.verification_security_notice")}</Text>
|
||||
<EmailButton href={verifyLink} label={t("emails.verification_email_verify_email")} />
|
||||
<Text className="text-sm">{t("emails.verification_email_click_on_this_link")}</Text>
|
||||
<Link className="break-all text-sm text-black" href={verifyLink}>
|
||||
<Link className="text-sm break-all text-black" href={verifyLink}>
|
||||
{verifyLink}
|
||||
</Link>
|
||||
<Text className="text-sm font-bold">{t("emails.verification_email_link_valid_for_24_hours")}</Text>
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { Container, Heading, Text } from "@react-email/components";
|
||||
import { TFunction } from "@/src/types/translations";
|
||||
import { EmailFooter } from "../../src/components/email-footer";
|
||||
import { EmailTemplate } from "../../src/components/email-template";
|
||||
import { exampleData } from "../../src/lib/example-data";
|
||||
import { t as mockT } from "../../src/lib/mock-translate";
|
||||
|
||||
type TFunction = (key: string, replacements?: Record<string, string>) => string;
|
||||
|
||||
interface PasswordResetNotifyEmailProps {
|
||||
readonly t?: TFunction;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { Container, Heading, Link, Text } from "@react-email/components";
|
||||
import { TFunction } from "@/src/types/translations";
|
||||
import { EmailButton } from "../../src/components/email-button";
|
||||
import { EmailFooter } from "../../src/components/email-footer";
|
||||
import { EmailTemplate } from "../../src/components/email-template";
|
||||
import { exampleData } from "../../src/lib/example-data";
|
||||
import { t as mockT } from "../../src/lib/mock-translate";
|
||||
|
||||
type TFunction = (key: string, replacements?: Record<string, string>) => string;
|
||||
|
||||
interface VerificationEmailProps {
|
||||
readonly verifyLink: string;
|
||||
readonly verificationRequestLink: string;
|
||||
@@ -25,7 +24,7 @@ export function VerificationEmail({
|
||||
<Text className="text-sm">{t("emails.verification_email_text")}</Text>
|
||||
<EmailButton href={verifyLink} label={t("emails.verification_email_verify_email")} />
|
||||
<Text className="text-sm">{t("emails.verification_email_click_on_this_link")}</Text>
|
||||
<Link className="break-all text-sm text-black" href={verifyLink}>
|
||||
<Link className="text-sm break-all text-black" href={verifyLink}>
|
||||
{verifyLink}
|
||||
</Link>
|
||||
<Text className="text-sm font-bold">{t("emails.verification_email_link_valid_for_24_hours")}</Text>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { Container, Heading, Text } from "@react-email/components";
|
||||
import { TFunction } from "@/src/types/translations";
|
||||
import { EmailTemplate } from "../../src/components/email-template";
|
||||
import { exampleData } from "../../src/lib/example-data";
|
||||
import { t as mockT } from "../../src/lib/mock-translate";
|
||||
|
||||
type TFunction = (key: string, replacements?: Record<string, string>) => string;
|
||||
|
||||
interface EmailCustomizationPreviewEmailProps {
|
||||
readonly userName: string;
|
||||
readonly logoUrl?: string;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { Container, Heading, Text } from "@react-email/components";
|
||||
import { TFunction } from "@/src/types/translations";
|
||||
import { EmailFooter } from "../../src/components/email-footer";
|
||||
import { EmailTemplate } from "../../src/components/email-template";
|
||||
import { exampleData } from "../../src/lib/example-data";
|
||||
import { t as mockT } from "../../src/lib/mock-translate";
|
||||
|
||||
type TFunction = (key: string, replacements?: Record<string, string>) => string;
|
||||
|
||||
interface InviteAcceptedEmailProps {
|
||||
readonly inviterName: string;
|
||||
readonly inviteeName: string;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { Container, Heading, Text } from "@react-email/components";
|
||||
import { TFunction } from "@/src/types/translations";
|
||||
import { EmailButton } from "../../src/components/email-button";
|
||||
import { EmailFooter } from "../../src/components/email-footer";
|
||||
import { EmailTemplate } from "../../src/components/email-template";
|
||||
import { exampleData } from "../../src/lib/example-data";
|
||||
import { t as mockT } from "../../src/lib/mock-translate";
|
||||
|
||||
type TFunction = (key: string, replacements?: Record<string, string>) => string;
|
||||
|
||||
interface InviteEmailProps {
|
||||
readonly inviteeName: string;
|
||||
readonly inviterName: string;
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { Container, Heading, Text } from "@react-email/components";
|
||||
import { TFunction } from "@/src/types/translations";
|
||||
import { EmailTemplate } from "../../src/components/email-template";
|
||||
import { exampleData } from "../../src/lib/example-data";
|
||||
import { t as mockT } from "../../src/lib/mock-translate";
|
||||
|
||||
type TFunction = (key: string, replacements?: Record<string, string>) => string;
|
||||
|
||||
interface EmbedSurveyPreviewEmailProps {
|
||||
readonly html: string;
|
||||
readonly environmentId: string;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { Column, Hr, Row, Text } from "@react-email/components";
|
||||
import { TFunction } from "@/src/types/translations";
|
||||
import { EmailTemplate } from "../../src/components/email-template";
|
||||
import { renderEmailResponseValue } from "../../src/lib/email-utils";
|
||||
import { exampleData } from "../../src/lib/example-data";
|
||||
import { t as mockT } from "../../src/lib/mock-translate";
|
||||
import { ProcessedHiddenField, ProcessedResponseElement, ProcessedVariable } from "../../src/types/follow-up";
|
||||
|
||||
type TFunction = (key: string, replacements?: Record<string, string>) => string;
|
||||
|
||||
export interface FollowUpEmailProps {
|
||||
readonly body: string; // Already processed HTML with recall tags replaced
|
||||
readonly responseData?: ProcessedResponseElement[]; // Already mapped elements
|
||||
@@ -56,7 +55,7 @@ export function FollowUpEmail({
|
||||
? `${t("emails.number_variable")}: ${variable.name}`
|
||||
: `${t("emails.text_variable")}: ${variable.name}`}
|
||||
</Text>
|
||||
<Text className="mt-0 whitespace-pre-wrap break-words text-sm text-slate-700">
|
||||
<Text className="mt-0 text-sm break-words whitespace-pre-wrap text-slate-700">
|
||||
{variable.value}
|
||||
</Text>
|
||||
</Column>
|
||||
@@ -69,7 +68,7 @@ export function FollowUpEmail({
|
||||
<Text className="mb-2 text-sm font-semibold text-slate-900">
|
||||
{t("emails.hidden_field")}: {hiddenField.id}
|
||||
</Text>
|
||||
<Text className="mt-0 whitespace-pre-wrap break-words text-sm text-slate-700">
|
||||
<Text className="mt-0 text-sm break-words whitespace-pre-wrap text-slate-700">
|
||||
{hiddenField.value}
|
||||
</Text>
|
||||
</Column>
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { Container, Heading, Text } from "@react-email/components";
|
||||
import { TFunction } from "@/src/types/translations";
|
||||
import { EmailButton } from "../../src/components/email-button";
|
||||
import { EmailFooter } from "../../src/components/email-footer";
|
||||
import { EmailTemplate } from "../../src/components/email-template";
|
||||
import { exampleData } from "../../src/lib/example-data";
|
||||
import { t as mockT } from "../../src/lib/mock-translate";
|
||||
|
||||
type TFunction = (key: string, replacements?: Record<string, string>) => string;
|
||||
|
||||
interface LinkSurveyEmailProps {
|
||||
readonly surveyName: string;
|
||||
readonly surveyLink: string;
|
||||
|
||||
@@ -4,6 +4,7 @@ import type { TOrganization } from "@formbricks/types/organizations";
|
||||
import type { TResponse } from "@formbricks/types/responses";
|
||||
import { TSurveyElementTypeEnum } from "@formbricks/types/surveys/elements";
|
||||
import type { TSurvey } from "@formbricks/types/surveys/types";
|
||||
import { TFunction } from "@/src/types/translations";
|
||||
import { EmailButton } from "../../src/components/email-button";
|
||||
import { EmailTemplate } from "../../src/components/email-template";
|
||||
import { renderEmailResponseValue } from "../../src/lib/email-utils";
|
||||
@@ -11,8 +12,6 @@ import { exampleData } from "../../src/lib/example-data";
|
||||
import { t as mockT } from "../../src/lib/mock-translate";
|
||||
import { ProcessedResponseElement } from "../../src/types/follow-up";
|
||||
|
||||
type TFunction = (key: string, replacements?: Record<string, string>) => string;
|
||||
|
||||
export interface ResponseFinishedEmailProps {
|
||||
readonly survey: TSurvey;
|
||||
readonly responseCount: number;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Text } from "@react-email/components";
|
||||
|
||||
type TFunction = (key: string, replacements?: Record<string, string>) => string;
|
||||
import { TFunction } from "../types/translations";
|
||||
|
||||
export function EmailFooter({ t }: { t: TFunction }): React.JSX.Element {
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Body, Container, Html, Img, Link, Section, Tailwind } from "@react-email/components";
|
||||
|
||||
type TFunction = (key: string, replacements?: Record<string, string>) => string;
|
||||
import { TFunction } from "../types/translations";
|
||||
|
||||
const fbLogoUrl = "https://app.formbricks.com/logo-transparent.png";
|
||||
const logoLink = "https://formbricks.com?utm_source=email_header&utm_medium=email";
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { Column, Container, Img, Link, Row, Text } from "@react-email/components";
|
||||
import { FileIcon } from "lucide-react";
|
||||
import { TSurveyElementTypeEnum } from "@formbricks/types/surveys/elements";
|
||||
|
||||
type TFunction = (key: string, replacements?: Record<string, string>) => string;
|
||||
import { TFunction } from "../types/translations";
|
||||
|
||||
// Simplified version - just get the filename from URL
|
||||
const getOriginalFileNameFromUrl = (url: string): string => {
|
||||
@@ -77,6 +76,6 @@ export const renderEmailResponseValue = (
|
||||
);
|
||||
|
||||
default:
|
||||
return <Text className="mt-0 whitespace-pre-wrap break-words text-sm">{response as string}</Text>;
|
||||
return <Text className="mt-0 text-sm break-words whitespace-pre-wrap">{response as string}</Text>;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,8 +13,7 @@ import {
|
||||
ResponseFinishedEmail,
|
||||
ResponseFinishedEmailProps,
|
||||
} from "../../emails/survey/response-finished-email";
|
||||
|
||||
type TFunction = (key: string, replacements?: Record<string, string>) => string;
|
||||
import { TFunction } from "../types/translations";
|
||||
|
||||
export async function renderVerificationEmail(props: {
|
||||
verifyLink: string;
|
||||
|
||||
1
packages/email/src/types/translations.ts
Normal file
1
packages/email/src/types/translations.ts
Normal file
@@ -0,0 +1 @@
|
||||
export type TFunction = (key: string, replacements?: Record<string, string>) => string;
|
||||
Reference in New Issue
Block a user