-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Web App] novu functionalilty to received push notification - added (#…
…999) * novu functionalilty to received push notification - added * NovuProviderWrapper: naming refactor * NovuProviderWrapper: isNovuProviderEnabled flag - added, to avoid using Novu in production for now
- Loading branch information
Showing
8 changed files
with
757 additions
and
9 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
28 changes: 28 additions & 0 deletions
28
packages/web-app/src/components/NovuProviderWrapper/NovuProviderWrapper.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { NovuProvider } from '@novu/notification-center' | ||
import { observer } from 'mobx-react' | ||
import type { ReactElement } from 'react' | ||
import { config } from '../../config' | ||
import { getStore } from '../../Store' | ||
|
||
interface NovuProviderWrapperProps { | ||
children: ReactElement | ||
} | ||
|
||
const isNovuProviderEnabled = false | ||
|
||
export const NovuProviderWrapper = observer(({ children }: NovuProviderWrapperProps): ReactElement | null => { | ||
const store = getStore() | ||
const { currentProfile } = store.profile | ||
if (currentProfile?.id && isNovuProviderEnabled) { | ||
return ( | ||
<NovuProvider | ||
applicationIdentifier={config.novuAppId} | ||
subscriberId={currentProfile.id} | ||
initialFetchingStrategy={{ fetchNotifications: true }} | ||
> | ||
{children} | ||
</NovuProvider> | ||
) | ||
} | ||
return children | ||
}) |
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 @@ | ||
export { NovuProviderWrapper } from './NovuProviderWrapper' |
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
Oops, something went wrong.