Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): Billing alerts on usage emails #6883

Merged
merged 38 commits into from
Nov 12, 2024
Merged

feat(api): Billing alerts on usage emails #6883

merged 38 commits into from
Nov 12, 2024

Conversation

scopsy
Copy link
Contributor

@scopsy scopsy commented Nov 7, 2024

What changed? Why was the change needed?

  • Adds a new @novu/notifications package to manage workflows
  • Added a novu endpoint handler connected to our ORG in prod
  • Added controllerDecorators for the framework SDK to support custom decorators for nest applications (solving the nestjs swagger issue)
  • Added React email boilerplate.

Screenshots

CleanShot 2024-11-07 at 12 28 19@2x

https://github.com/novuhq/packages-enterprise/pull/239

Expand for optional sections

Related enterprise PR

Special notes for your reviewer

Copy link

pkg-pr-new bot commented Nov 7, 2024

Open in Stackblitz

@novu/client

pnpm add https://pkg.pr.new/novuhq/novu/@novu/client@6883

@novu/framework

pnpm add https://pkg.pr.new/novuhq/novu/@novu/framework@6883

@novu/headless

pnpm add https://pkg.pr.new/novuhq/novu/@novu/headless@6883

@novu/js

pnpm add https://pkg.pr.new/novuhq/novu/@novu/js@6883

@novu/nest

pnpm add https://pkg.pr.new/novuhq/novu/@novu/nest@6883

@novu/nextjs

pnpm add https://pkg.pr.new/novuhq/novu/@novu/nextjs@6883

@novu/node

pnpm add https://pkg.pr.new/novuhq/novu/@novu/node@6883

@novu/notification-center

pnpm add https://pkg.pr.new/novuhq/novu/@novu/notification-center@6883

novu

pnpm add https://pkg.pr.new/novuhq/novu@6883

@novu/providers

pnpm add https://pkg.pr.new/novuhq/novu/@novu/providers@6883

@novu/react

pnpm add https://pkg.pr.new/novuhq/novu/@novu/react@6883

@novu/react-native

pnpm add https://pkg.pr.new/novuhq/novu/@novu/react-native@6883

@novu/shared

pnpm add https://pkg.pr.new/novuhq/novu/@novu/shared@6883

@novu/stateless

pnpm add https://pkg.pr.new/novuhq/novu/@novu/stateless@6883

commit: 831db04

Copy link

netlify bot commented Nov 7, 2024

Deploy Preview for novu-stg-vite-dashboard-poc ready!

Name Link
🔨 Latest commit 831db04
🔍 Latest deploy log https://app.netlify.com/sites/novu-stg-vite-dashboard-poc/deploys/673313b2e7746e0008c3f65a
😎 Deploy Preview https://deploy-preview-6883--novu-stg-vite-dashboard-poc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

github-actions bot commented Nov 7, 2024

LaunchDarkly flag references

🔍 1 flag added or modified

Name Key Aliases found Info
IS_USAGE_ALERTS_ENABLED IS_USAGE_ALERTS_ENABLED

# where notification entities (eg. workflows, topics) are defined.
# Required.
bridge-url: https://api.novu-staging.co/v1/bridge/novu

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

apps/api/src/.example.env Outdated Show resolved Hide resolved
@@ -43,7 +44,7 @@ export class NovuModule extends NovuBaseModule {
static register(options: typeof OPTIONS_TYPE, customProviders?: Provider[]) {
const superModule = super.register(options);

superModule.controllers = [NovuController];
superModule.controllers = [applyDecorators(NovuController, options.controllerDecorators || [])];
superModule.providers?.push(registerApiPath, NovuClient, NovuHandler, ...(customProviders || []));
superModule.exports = [NovuClient, NovuHandler];

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: I can't add a comment on it because there's no diff, but we also need to support the injected controllerDecorators on the registerAsync method too to ensure consistency on both APIs.‏

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I couldn't follow the options logic or where they are defined. Should it come just from the useFactory?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had some trouble here too when I implemented the NestJS Framework module. I think it will require something like calling the super.registerAsync method and accessing the defined options on the super class, but I'm not certain.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will check this on my local soon.

Copy link
Collaborator

@rifont rifont Nov 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out the NestJS HttpModule, this covers the same pattern we need (StackOverflow ref). They've implemented their registerAsync a little more flexibly without using the NestJS built-in ConfigurableModuleBuilder, which grants access to async options more easily.

This is the approach we need to take for the customProviders and controllerDecorators properties. We can then deprecate the second method parameter which supplies only customProviders in favour of a single configuration object for both register + registerAsync.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't make it work :| I'm going to merge this PR as I need to test the Stripe behaviour on staging, and will raise a separate PR for the registerAsync behaviour later today.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok sounds good, I'll publish Framework from 1 commit this branch's merge commit to next to avoid releasing this change in that case. We should publish the feature in totality alongside the docs.

@scopsy scopsy merged commit 18812f6 into next Nov 12, 2024
37 checks passed
@scopsy scopsy deleted the billing-alerts branch November 12, 2024 09:23
@scopsy scopsy restored the billing-alerts branch December 22, 2024 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants