-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
211 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
import { serve } from "@novu/framework/next"; | ||
import {uploaderCommitAcknowledged, welcomeOnboardingEmail} from "../../novu/workflows"; | ||
import { | ||
exposeDownloadLink, | ||
exposeZippyDownloadLink, | ||
uploaderCommitAcknowledged, | ||
} from "../../novu/workflows"; | ||
|
||
// the workflows collection can hold as many workflow definitions as you need | ||
export const { GET, POST, OPTIONS } = serve({ | ||
workflows: [ | ||
welcomeOnboardingEmail, | ||
uploaderCommitAcknowledged, | ||
exposeZippyDownloadLink, | ||
exposeDownloadLink, | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import {Button, Section, Text} from "@react-email/components"; | ||
import React from "react"; | ||
import DefaultEmail, { | ||
createEmailControlSchema, | ||
CreateEmailControlSchemaProps, | ||
styles | ||
} from "@/app/novu/emails/DefaultEmail"; | ||
import {z, ZodDefault, ZodOptional, ZodString} from "zod"; | ||
|
||
type Props = { | ||
introText?: string; | ||
outroText?: string; | ||
linkUrl: string; | ||
linkText: string; | ||
}; | ||
|
||
export default function CTAEmail({ | ||
linkUrl, | ||
linkText, | ||
introText, | ||
outroText, | ||
}: Props) { | ||
return ( | ||
<DefaultEmail> | ||
<Section> | ||
{introText ? <Text> | ||
{introText} | ||
</Text> : null} | ||
|
||
<Button style={styles.button} href={linkUrl}>{linkText}</Button> | ||
|
||
<Text> | ||
<a href={linkUrl}>{linkUrl}</a> | ||
</Text> | ||
|
||
{outroText ? <Text> | ||
{outroText} | ||
</Text> : null} | ||
</Section> | ||
</DefaultEmail> | ||
); | ||
} | ||
|
||
export type CreateCTAEEmailControlSchemaProps = { | ||
defaultIntroText?: string | undefined; | ||
defaultOutroText?: string | undefined; | ||
} & CreateEmailControlSchemaProps; | ||
|
||
export function createCTAEmailControlSchema({ | ||
defaultIntroText, | ||
defaultOutroText, | ||
...rest | ||
}: CreateCTAEEmailControlSchemaProps) { | ||
return createEmailControlSchema({ | ||
...rest, | ||
introText: createOptionalOrNotString(defaultIntroText), | ||
outroText: createOptionalOrNotString(defaultOutroText), | ||
}); | ||
} | ||
|
||
function createOptionalOrNotString(defaultValue: string | undefined): ZodOptional<ZodString> | ZodDefault<ZodString> { | ||
const string = z.string(); | ||
if (defaultValue) { | ||
return string.default(defaultValue); | ||
} else { | ||
return string.optional(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import {Body, Container, Head, Html, Preview} from "@react-email/components"; | ||
import React, {CSSProperties, PropsWithChildren} from "react"; | ||
import {z} from "zod"; | ||
import {ZodRawShape} from "zod/lib/types"; | ||
|
||
type Props = PropsWithChildren<{}>; | ||
|
||
export default function DefaultEmail({ | ||
children, | ||
}: Props) { | ||
return ( | ||
<Html> | ||
<Head/> | ||
<Preview>Dropbox reset your password</Preview> | ||
<Body style={main}> | ||
<Container style={container}> | ||
{children} | ||
</Container> | ||
</Body> | ||
</Html> | ||
); | ||
} | ||
|
||
const main: CSSProperties = { | ||
backgroundColor: "#abc5ff", | ||
padding: "8px 0", | ||
}; | ||
|
||
const container: CSSProperties = { | ||
backgroundColor: "#ffffff", | ||
border: "1px solid #f0f0f0", | ||
padding: "45px", | ||
}; | ||
|
||
export const text: CSSProperties = { | ||
fontSize: "16px", | ||
fontWeight: "300", | ||
color: "#404040", | ||
lineHeight: "26px", | ||
}; | ||
const headingText: CSSProperties = { | ||
fontWeight: "300", | ||
lineHeight: "30px", | ||
} | ||
const button: CSSProperties = { | ||
backgroundColor: "#007ee6", | ||
borderRadius: "4px", | ||
color: "#fff", | ||
fontSize: "15px", | ||
textDecoration: "none", | ||
textAlign: "center" as const, | ||
display: "block", | ||
width: "210px", | ||
padding: "14px 7px", | ||
}; | ||
|
||
const anchor: CSSProperties = { | ||
textDecoration: "underline", | ||
}; | ||
|
||
export const styles: Record<string, CSSProperties> = { | ||
text, | ||
headingText: headingText, | ||
button, | ||
anchor, | ||
} | ||
|
||
export type CreateEmailControlSchemaProps = { | ||
defaultEmailSubject: string; | ||
} & ZodRawShape; | ||
|
||
export function createEmailControlSchema({ | ||
defaultEmailSubject, | ||
...rest | ||
}: CreateEmailControlSchemaProps) { | ||
return z.object({ | ||
emailSubject: z.string().default(defaultEmailSubject), | ||
...rest, | ||
}); | ||
} |
This file was deleted.
Oops, something went wrong.
9 changes: 8 additions & 1 deletion
9
...pp/novu/workflows/expose/download-link.ts → ...p/novu/workflows/expose/download-link.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "./zippy-download-link"; | ||
export * from "./download-link"; |
Oops, something went wrong.