Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/components/Notifications/Inbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type InboxProps = {
header?: InboxHeaderProps;
empty?: React.ReactNode;
imageShape?: 'circle' | 'square';
newTab?: boolean;
};

export const Inbox: React.FC<InboxProps> = (props) => {
Expand Down Expand Up @@ -129,6 +130,7 @@ export const Inbox: React.FC<InboxProps> = (props) => {
markAsClicked={context.markAsClicked}
renderer={props.notificationRenderer}
imageShape={props.imageShape}
newTab={props.newTab}
/>
</ListItem>
)}
Expand Down Expand Up @@ -169,6 +171,7 @@ export const Inbox: React.FC<InboxProps> = (props) => {
markAsClicked={context.markAsClicked}
renderer={props.notificationRenderer}
imageShape={props.imageShape}
newTab={props.newTab}
/>
</ListItem>
))}
Expand Down
7 changes: 6 additions & 1 deletion lib/components/Notifications/Notification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export type NotificationProps = {
markAsClicked: (ids: string[]) => void;
renderer?: (notification: InAppNotification[]) => ReactNode;
imageShape?: 'circle' | 'square';
newTab?: boolean;
};

export const Notification = (props: NotificationProps) => {
Expand Down Expand Up @@ -96,7 +97,11 @@ export const Notification = (props: NotificationProps) => {
onClick={() => {
props.markAsClicked(ids);
if (redirectURL) {
window.location.href = redirectURL;
if (props.newTab) {
window.open(redirectURL, '_blank');
} else {
window.location.href = redirectURL;
}
}
}}
style={{
Expand Down
5 changes: 4 additions & 1 deletion lib/components/Notifications/NotificationFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type NotificationFeedProps = {
};
header?: InboxHeaderProps;
imageShape?: 'circle' | 'square';
newTab?: boolean;
};

export const NotificationFeed: React.FC<NotificationFeedProps> = (props) => {
Expand Down Expand Up @@ -63,7 +64,8 @@ export const NotificationFeed: React.FC<NotificationFeedProps> = (props) => {
button2ClickHandler:
props.header?.button2ClickHandler ?? (() => setOpenPreferences(true))
},
imageShape: props.imageShape || 'circle'
imageShape: props.imageShape || 'circle',
newTab: props.newTab ?? false
};

return (
Expand All @@ -86,6 +88,7 @@ export const NotificationFeed: React.FC<NotificationFeedProps> = (props) => {
notificationRenderer={config.renderers.notification}
header={config.header}
imageShape={config.imageShape}
newTab={config.newTab}
/>
{context.webPushOptInMessage &&
localStorage.getItem('hideWebPushOptInMessage') !== 'true' && (
Expand Down
4 changes: 3 additions & 1 deletion lib/components/Notifications/NotificationLauncher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ export const NotificationLauncher: React.FC<NotificationLaucherProps> = (
vertical: props.popoverPosition?.anchorOrigin?.vertical ?? 'top',
horizontal: props.popoverPosition?.anchorOrigin?.horizontal ?? 'left'
}
}
},
newTab: props.newTab ?? false
};

const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
Expand Down Expand Up @@ -133,6 +134,7 @@ export const NotificationLauncher: React.FC<NotificationLaucherProps> = (
pagePosition={config.pagePosition}
notificationRenderer={config.renderers.notification}
header={config.header}
newTab={config.newTab}
/>
{context.webPushOptInMessage &&
localStorage.getItem('hideWebPushOptInMessage') !== 'true' && (
Expand Down
5 changes: 4 additions & 1 deletion lib/components/Notifications/NotificationPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export type NotificationPopupProps = {
horizontal: 'left' | 'center' | 'right';
};
};
newTab?: boolean;
};

export const NotificationPopup: React.FC<NotificationPopupProps> = (props) => {
Expand Down Expand Up @@ -86,7 +87,8 @@ export const NotificationPopup: React.FC<NotificationPopupProps> = (props) => {
vertical: props.popoverPosition?.anchorOrigin?.vertical ?? 'top',
horizontal: props.popoverPosition?.anchorOrigin?.horizontal ?? 'left'
}
}
},
newTab: props.newTab ?? false
};

const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
Expand Down Expand Up @@ -141,6 +143,7 @@ export const NotificationPopup: React.FC<NotificationPopupProps> = (props) => {
pagePosition={config.pagePosition}
notificationRenderer={config.renderers.notification}
header={config.header}
newTab={config.newTab}
/>
{context.webPushOptInMessage &&
localStorage.getItem('hideWebPushOptInMessage') !== 'true' && (
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@notificationapi/react",
"private": false,
"version": "1.6.0",
"version": "1.6.1",
"type": "module",
"overrides": {
"esbuild": "^0.25.0",
Expand Down