-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into redesign-v2
- Loading branch information
Showing
32 changed files
with
322 additions
and
1,105 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
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,6 @@ | ||
import { z } from "zod"; | ||
|
||
export const payloadSchema = z.object({ | ||
firstName: z.string().default("John"), | ||
lastName: z.string().default("Doe"), | ||
}); |
15 changes: 15 additions & 0 deletions
15
src/app/workflows/default-usecase/Default/stepsControlSchema.ts
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,15 @@ | ||
import { z } from "zod"; | ||
|
||
export const inAppControlSchema = z.object({ | ||
useControls: z.boolean().default(false), | ||
inAppSubject: z.string().default("In-App Notification Subject!"), | ||
inAppBody: z.string().default("In-App Notification Body!"), | ||
inAppAvatar: z.string().default("https://avatars.githubusercontent.com/u/63902456?v=4"), | ||
showInAppAvatar: z.boolean().default(true), | ||
inAppPrimaryActionLabel: z.string().default("Reply"), | ||
enablePrimaryAction: z.boolean().default(true), | ||
inAppPrimaryActionUrl: z.string().default("https://novu.com"), | ||
inAppSecondaryActionLabel: z.string().default("Dismiss"), | ||
enableSecondaryAction: z.boolean().default(false), | ||
inAppSecondaryActionUrl: z.string().default("https://novu.com"), | ||
}); |
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,45 @@ | ||
import { workflow } from "@novu/framework"; | ||
import { payloadSchema } from "./payloadSchema"; | ||
import { inAppControlSchema } from "./stepsControlSchema"; | ||
|
||
const workflowName = "default-notification"; | ||
|
||
export const defaultNotification = workflow( | ||
workflowName, | ||
async ({ step, payload, subscriber }) => { | ||
await step.inApp( | ||
"in-app-step", | ||
async (controls) => { | ||
const result: any = { | ||
subject: controls.inAppSubject, | ||
body: controls.inAppBody, | ||
}; | ||
|
||
if (controls.showInAppAvatar) { | ||
result.avatar = controls.inAppAvatar; | ||
} | ||
|
||
if (controls.enablePrimaryAction) { | ||
result.primaryAction = { | ||
label: controls.inAppPrimaryActionLabel, | ||
url: controls.inAppPrimaryActionUrl, | ||
}; | ||
} | ||
|
||
if (controls.enableSecondaryAction) { | ||
result.secondaryAction = { | ||
label: controls.inAppSecondaryActionLabel, | ||
url: controls.inAppSecondaryActionUrl, | ||
}; | ||
} | ||
return result; | ||
}, | ||
{ | ||
controlSchema: inAppControlSchema, | ||
} | ||
); | ||
}, | ||
{ | ||
payloadSchema: payloadSchema, | ||
} | ||
); |
159 changes: 0 additions & 159 deletions
159
src/app/workflows/notion-usecases/Comment/email-templates/react-email-template.tsx
This file was deleted.
Oops, something went wrong.
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,6 @@ | ||
import { z } from "zod"; | ||
|
||
export const payloadSchema = z.object({ | ||
firstName: z.string().default("John"), | ||
lastName: z.string().default("Doe"), | ||
}); |
88 changes: 14 additions & 74 deletions
88
src/app/workflows/notion-usecases/Comment/stepsControlSchema.ts
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,82 +1,22 @@ | ||
import { z } from "zod"; | ||
import { CronExpression } from "@novu/framework"; | ||
|
||
export const emailControlSchema = z.object({ | ||
subject: z.string().default("A Successful Test on Novu!"), | ||
showHeader: z.boolean().default(true), | ||
components: z | ||
.array( | ||
z.object({ | ||
type: z.enum(["heading", "text", "button", "code", "users"]), | ||
text: z.string().default(""), | ||
align: z.enum(["left", "center", "right"]).default("left"), | ||
}), | ||
) | ||
.default([ | ||
{ | ||
type: "heading", | ||
text: "Welcome to Novu", | ||
align: "center", | ||
}, | ||
{ | ||
type: "text", | ||
text: "Congratulations on receiving your first notification email from Novu! Join the hundreds of thousands of developers worldwide who use Novu to build notification platforms for their products.", | ||
align: "left", | ||
}, | ||
{ | ||
type: "users", | ||
align: "center", | ||
text: "", | ||
}, | ||
{ | ||
type: "text", | ||
text: "Ready to get started? Click on the button below, and you will see first-hand how easily you can edit this email content.", | ||
align: "left", | ||
}, | ||
{ | ||
type: "button", | ||
text: "Edit Email", | ||
align: "center", | ||
}, | ||
]), | ||
}); | ||
|
||
export const inAppControlSchema = z.object({ | ||
inAppSubject: z.string().default("In-App Notification Subject!"), | ||
pageName: z.string().default("Very Intresting Page"), | ||
inAppAvatar: z.string().default("https://avatars.githubusercontent.com/u/63902456?v=4"), | ||
subscriberFirstName: z.string().default("John"), | ||
subscriberLastName: z.string().default("Doe"), | ||
inAppSubject: z | ||
.string() | ||
.default( | ||
`{{subscriber.firstName | capitalize}} {{subscriber.lastName | capitalize}} commented in` | ||
), | ||
inAppBody: z.string().default("Important Page"), | ||
inAppAvatar: z | ||
.string() | ||
.default("https://avatars.githubusercontent.com/u/63902456?v=4"), | ||
showInAppAvatar: z.boolean().default(true), | ||
inAppPrimaryActionLabel: z.string().default("Reply"), | ||
enablePrimaryAction: z.boolean().default(true), | ||
inAppPrimaryActionUrl: z.string().default("https://novu.com"), | ||
}); | ||
|
||
export const smsControlSchema = z.object({ | ||
smsBody: z.string().default("SMS Notification Subject"), | ||
}); | ||
|
||
export const pushControlSchema = z.object({ | ||
pushSubject: z.string().default("Push Notification Subject"), | ||
pushBody: z.string().default("Push Notification Body"), | ||
}); | ||
|
||
export const chatControlSchema = z.object({ | ||
chatBody: z.string().default("Chat Notification Body"), | ||
}); | ||
|
||
export const delayControlSchema = z.object({ | ||
unit: z.enum(["seconds", "minutes", "hours", "days", "weeks", "months"]).default("days"), | ||
amount: z.number().default(2), | ||
}); | ||
|
||
export const digestControlSchema = z.object({ | ||
strategy: z.enum(["Regular", "Scheduled"]).default("Regular"), | ||
lookBackWindow: z.boolean().default(false), | ||
digestKey: z.string().default("digestKey"), | ||
unit: z.enum(["seconds", "minutes", "hours", "days", "weeks", "months"]).default("days"), | ||
amount: z.number().default(3), | ||
cron: z.string().default(CronExpression.EVERY_DAY_AT_8AM), // visit https://crontab.guru/ to set the cron expression. | ||
}); | ||
|
||
export const customControlSchema = z.object({ | ||
inAppSecondaryActionLabel: z.string().default("Dismiss"), | ||
enableSecondaryAction: z.boolean().default(false), | ||
inAppSecondaryActionUrl: z.string().default("https://novu.com"), | ||
}); |
Oops, something went wrong.