forked from novuhq/novu
-
Notifications
You must be signed in to change notification settings - Fork 0
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 NV-337-Read-only-environments
- Loading branch information
Showing
181 changed files
with
3,047 additions
and
1,863 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,7 @@ jobs: | |
run: | | ||
touch .env | ||
echo REACT_APP_API_URL="https://dev.api.novu.co" >> .env | ||
echo REACT_APP_WS_URL="https://dev.ws.novu.co" >> .env | ||
echo REACT_APP_WIDGET_EMBED_PATH="https://dev.embed.novu.co/embed.umd.min.js" >> .env | ||
echo REACT_APP_NOVU_APP_ID=${{ secrets.NOVU_APP_ID }} >> .env | ||
echo REACT_APP_SENTRY_DSN="https://[email protected]/6250907" >> .env | ||
|
@@ -71,6 +72,7 @@ jobs: | |
- name: Build | ||
env: | ||
REACT_APP_API_URL: https://dev.api.novu.co | ||
REACT_APP_WS_URL: https://dev.ws.novu.co | ||
REACT_APP_WIDGET_EMBED_PATH: https://dev.embed.novu.co/embed.umd.min.js | ||
REACT_APP_NOVU_APP_ID: ${{ secrets.NOVU_APP_ID }} | ||
REACT_APP_SENTRY_DSN: https://[email protected]/6250907 | ||
|
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 |
---|---|---|
|
@@ -60,8 +60,8 @@ jobs: | |
run: | | ||
touch .env | ||
echo REACT_APP_API_URL="https://dev.api.novu.co" >> .env | ||
echo REACT_APP_SENTRY_DSN="https://[email protected]/625116" >> .env | ||
echo REACT_APP_WS_URL="https://dev.ws.novu.co" >> .env | ||
echo REACT_APP_SENTRY_DSN="https://[email protected]/625116" >> .env | ||
echo REACT_APP_ENVIRONMENT=dev >> .env | ||
- name: Envsetup | ||
|
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 |
---|---|---|
|
@@ -57,6 +57,7 @@ jobs: | |
run: | | ||
touch .env | ||
echo REACT_APP_API_URL="https://api.novu.co" >> .env | ||
echo REACT_APP_WS_URL="https://ws.novu.co" >> .env | ||
echo REACT_APP_WIDGET_EMBED_PATH="https://embed.novu.co/embed.umd.min.js" >> .env | ||
echo REACT_APP_NOVU_APP_ID=${{ secrets.NOVU_APP_ID }} >> .env | ||
echo REACT_APP_SENTRY_DSN="https://[email protected]/6250907" >> .env | ||
|
@@ -69,6 +70,7 @@ jobs: | |
- name: Build | ||
env: | ||
REACT_APP_API_URL: https://api.novu.co | ||
REACT_APP_WS_URL: https://ws.novu.co | ||
REACT_APP_WIDGET_EMBED_PATH: https://embed.novu.co/embed.umd.min.js | ||
REACT_APP_NOVU_APP_ID: ${{ secrets.NOVU_APP_ID }} | ||
REACT_APP_SENTRY_DSN: https://[email protected]/6250907 | ||
|
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,31 @@ | ||
name: Test @novu/notification-center | ||
on: | ||
push: | ||
paths: | ||
- "packages/notification-center/**" | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: "14" | ||
- run: rm -rf build | ||
|
||
- name: Cache pnpm modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.pnpm-store | ||
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}- | ||
- uses: pnpm/[email protected] | ||
with: | ||
version: 6.0.2 | ||
run_install: true | ||
|
||
- name: Build | ||
run: pnpm build | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 |
---|---|---|
@@ -1,13 +1,14 @@ | ||
|
||
<div align="center"> | ||
|
||
![Logo Dark](https://user-images.githubusercontent.com/8872447/161003447-dab96279-a832-41a9-8a69-24967fdd64cd.png#gh-light-mode-only) | ||
![Logo Dark](https://user-images.githubusercontent.com/8872447/165779319-34962ccc-3149-466c-b1da-97fd93254520.png#gh-dark-mode-only) | ||
|
||
|
||
</div> | ||
|
||
<div align="center"> | ||
|
||
![Logo Light](https://user-images.githubusercontent.com/8872447/161003750-0c71e956-7448-4876-a446-876fdb7017af.png#gh-dark-mode-only) | ||
![Logo Light](https://user-images.githubusercontent.com/8872447/165779274-22a190da-3284-487e-bd1e-14983df12cbb.png#gh-light-mode-only) | ||
|
||
</div> | ||
|
||
|
@@ -22,14 +23,15 @@ The ultimate service for managing multi-channel notifications with a single API. | |
<br /> | ||
<a href="https://docs.novu.co" rel="dofollow"><strong>Explore the docs »</strong></a> | ||
<br /> | ||
|
||
<br/> | ||
<a href="https://github.com/novuhq/novu/issues">Report Bug</a> | ||
· | ||
<a href="https://github.com/novuhq/novu/discussions">Request Feature</a> | ||
· | ||
<a href="https://discord.gg/TT6TttXjRe">Join Our Discord</a> | ||
· | ||
<a href="https://blog.novu.co/">Read our blog</a> | ||
<a href="https://github.com/orgs/novuhq/projects/2">Roadmap</a> | ||
</p> | ||
|
||
## ⭐️ Why | ||
|
@@ -80,64 +82,6 @@ await novu.trigger('<TRIGGER_NAME>', | |
); | ||
``` | ||
|
||
# 📦 Stateless mode | ||
For simpler use cases, you can use the `@novu/stateless` library. This will require you to manage the templates content and providers registration. | ||
|
||
## 📦 Install | ||
|
||
```bash | ||
npm install @novu/stateless | ||
``` | ||
|
||
```bash | ||
yarn add @novu/stateless | ||
``` | ||
|
||
## 🔨 Usage | ||
|
||
```ts | ||
import { NovuStateless, ChannelTypeEnum } from '@novu/stateless'; | ||
import { SendgridEmailProvider } from '@novu/sendgrid'; | ||
|
||
const novu = new NovuStateless(); | ||
|
||
await novu.registerProvider( | ||
new SendgridEmailProvider({ | ||
apiKey: process.env.SENDGRID_API_KEY, | ||
from: '[email protected]' | ||
}) | ||
); | ||
|
||
const passwordResetTemplate = await novu.registerTemplate({ | ||
id: 'password-reset', | ||
messages: [ | ||
{ | ||
subject: 'Your password reset request', | ||
channel: ChannelTypeEnum.EMAIL, | ||
template: ` | ||
Hi {{firstName}}! | ||
To reset your password click <a href="{{resetLink}}">here.</a> | ||
{{#if organization}} | ||
<img src="{{organization.logo}}" /> | ||
{{/if}} | ||
` | ||
}, | ||
] | ||
}); | ||
|
||
await novu.trigger('<REPLACE_WITH_EVENT_NAME>', { | ||
$user_id: "<USER IDENTIFIER>", | ||
$email: "[email protected]", | ||
firstName: "John", | ||
lastName: "Doe", | ||
organization: { | ||
logo: 'https://evilcorp.com/logo.png' | ||
} | ||
}); | ||
``` | ||
|
||
## Providers | ||
Novu provides a single API to manage providers across multiple channels with a simple to use interface. | ||
|
||
|
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 |
---|---|---|
|
@@ -17,10 +17,10 @@ describe('Get activity feed - /activity (GET)', async () => { | |
.post('/v1/widgets/session/initialize') | ||
.send({ | ||
applicationIdentifier: session.environment.identifier, | ||
$user_id: '12345', | ||
$first_name: 'Test', | ||
$last_name: 'User', | ||
$email: '[email protected]', | ||
subscriberId: '12345', | ||
firstName: 'Test', | ||
lastName: 'User', | ||
email: '[email protected]', | ||
}) | ||
.expect(201); | ||
}); | ||
|
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 |
---|---|---|
|
@@ -17,10 +17,10 @@ describe('Get activity stats - /activity/stats (GET)', async () => { | |
.post('/v1/widgets/session/initialize') | ||
.send({ | ||
applicationIdentifier: session.environment.identifier, | ||
$user_id: '12345', | ||
$first_name: 'Test', | ||
$last_name: 'User', | ||
$email: '[email protected]', | ||
subscriberId: '12345', | ||
firstName: 'Test', | ||
lastName: 'User', | ||
email: '[email protected]', | ||
}) | ||
.expect(201); | ||
}); | ||
|
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import { UserSession } from '@novu/testing'; | ||
import * as jwt from 'jsonwebtoken'; | ||
import { expect } from 'chai'; | ||
|
||
describe('Initialize Session - /widgets/session/initialize (POST)', async () => { | ||
|
@@ -15,11 +14,11 @@ describe('Initialize Session - /widgets/session/initialize (POST)', async () => | |
.post('/v1/widgets/session/initialize') | ||
.send({ | ||
applicationIdentifier: session.environment.identifier, | ||
$user_id: '12345', | ||
$first_name: 'Test', | ||
$last_name: 'User', | ||
$email: '[email protected]', | ||
$phone: '054777777', | ||
subscriberId: '12345', | ||
firstName: 'Test', | ||
lastName: 'User', | ||
email: '[email protected]', | ||
phone: '054777777', | ||
}) | ||
.expect(201); | ||
|
||
|
@@ -33,11 +32,11 @@ describe('Initialize Session - /widgets/session/initialize (POST)', async () => | |
it('should throw an error when an invalid environment Id passed', async function () { | ||
const { body } = await session.testAgent.post('/v1/widgets/session/initialize').send({ | ||
applicationIdentifier: 'some-not-existing-id', | ||
$user_id: '12345', | ||
$first_name: 'Test', | ||
$last_name: 'User', | ||
$email: '[email protected]', | ||
$phone: '054777777', | ||
subscriberId: '12345', | ||
firstName: 'Test', | ||
lastName: 'User', | ||
email: '[email protected]', | ||
phone: '054777777', | ||
}); | ||
|
||
expect(body.message).to.contain('Please provide a valid app identifier'); | ||
|
Oops, something went wrong.