15d5333cf6
* Init Maizzle * Initial template JSX conversion and testing * WIP * WIP * WIP * WIP * WIP * Migrated AttendeeRescheduledEmail * WIP * WIP * DRY * Cleanup * Cleanup * Cleanup * Migrate feedback email * Migrates ForgotPasswordEmail * Migrates OrganizerCancelledEmail * Migrated OrganizerLocationChangeEmail * Formatting * Migrated AttendeeRequestRescheduledEmail * Migrates OrganizerPaymentRefundFailedEmail * Migrates OrganizerRequestEmail * Migrates OrganizerRequestReminderEmail * Fixes type-check * Moved email-manager to package * Import fixes * Removed duplicate email code from vital app * Removed duplicate email code from wipemycal * Build/type fixes * Fixes web email imports * Fixes build * Embed build fixes * Update AttendeeAwaitingPaymentEmail.tsx * Update default-cookies.ts * Revert "Embed build fixes" This reverts commit 8d693e99aca6dfe92d5cbb27ffa962545c3e9389. * Embed build fixes # Conflicts: # packages/embeds/embed-core/package.json * dep and email date fixes * Update attendee-scheduled-email.ts * Update package.json * Update [...nextauth].tsx * Update email.ts * Prevents /api/email on production builds Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
59 lines
1.7 KiB
TypeScript
59 lines
1.7 KiB
TypeScript
import { NextApiRequest, NextApiResponse } from "next";
|
|
|
|
import { renderEmail } from "@calcom/emails";
|
|
import { getTranslation } from "@calcom/lib/server/i18n";
|
|
|
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|
if (process.env.NODE_ENV !== "development") return res.write("Only for development purposes"), res.end();
|
|
const t = await getTranslation("en", "common");
|
|
|
|
const evt = {
|
|
type: "30min",
|
|
title: "30min between Pro Example and pro@example.com",
|
|
description: null,
|
|
additionalNotes: "asdasdas",
|
|
customInputs: {
|
|
"Custom input 01": "sadasdasdsadasd",
|
|
"Custom input 02": "asdasdasd",
|
|
},
|
|
startTime: "2022-06-03T09:00:00-06:00",
|
|
endTime: "2022-06-03T09:30:00-06:00",
|
|
organizer: {
|
|
name: "Pro Example",
|
|
email: "pro@example.com",
|
|
timeZone: "Europe/London",
|
|
language: { translate: t, locale: "en" },
|
|
},
|
|
attendees: [
|
|
{
|
|
email: "pro@example.com",
|
|
name: "pro@example.com",
|
|
timeZone: "America/Chihuahua",
|
|
language: { translate: t, locale: "en" },
|
|
},
|
|
],
|
|
location: "Zoom video",
|
|
destinationCalendar: null,
|
|
hideCalendarNotes: false,
|
|
uid: "bwPWLpjYrx4rZf6MCZdKgE",
|
|
metadata: {},
|
|
cancellationReason: "It got late",
|
|
paymentInfo: { id: "pi_12312", link: "https://cal.com", reason: "no reason" },
|
|
};
|
|
|
|
req.statusCode = 200;
|
|
|
|
res.setHeader("Content-Type", "text/html");
|
|
res.setHeader("Cache-Control", "no-cache, no-store, private, must-revalidate");
|
|
res.write(
|
|
renderEmail("OrganizerRequestReminderEmail", {
|
|
attendee: evt.attendees[0],
|
|
calEvent: evt,
|
|
recurringEvent: {},
|
|
})
|
|
);
|
|
res.end();
|
|
};
|
|
|
|
export default handler;
|