@notificationapi/react 1.6.0 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5884,7 +5884,7 @@ const kc = di.div`
5884
5884
  $seen: c || !!f,
5885
5885
  $archived: !!d,
5886
5886
  onClick: () => {
5887
- t.markAsClicked(v), a && (window.location.href = a);
5887
+ t.markAsClicked(v), a && (t.newTab ? window.open(a, "_blank") : window.location.href = a);
5888
5888
  },
5889
5889
  style: {
5890
5890
  padding: "16px 6px 16px 0",
@@ -13,5 +13,6 @@ export type InboxProps = {
13
13
  header?: InboxHeaderProps;
14
14
  empty?: React.ReactNode;
15
15
  imageShape?: 'circle' | 'square';
16
+ newTab?: boolean;
16
17
  };
17
18
  export declare const Inbox: React.FC<InboxProps>;
@@ -2874,7 +2874,8 @@ const yi = (e) => {
2874
2874
  notifications: u,
2875
2875
  markAsClicked: n.markAsClicked,
2876
2876
  renderer: e.notificationRenderer,
2877
- imageShape: e.imageShape
2877
+ imageShape: e.imageShape,
2878
+ newTab: e.newTab
2878
2879
  }
2879
2880
  ) }, u[0].id)
2880
2881
  }
@@ -2908,7 +2909,8 @@ const yi = (e) => {
2908
2909
  notifications: u,
2909
2910
  markAsClicked: n.markAsClicked,
2910
2911
  renderer: e.notificationRenderer,
2911
- imageShape: e.imageShape
2912
+ imageShape: e.imageShape,
2913
+ newTab: e.newTab
2912
2914
  }
2913
2915
  ) }, u[0].id)),
2914
2916
  e.pagePosition === "bottom" && f.length > 0 && /* @__PURE__ */ j(
@@ -7,5 +7,6 @@ export type NotificationProps = {
7
7
  markAsClicked: (ids: string[]) => void;
8
8
  renderer?: (notification: InAppNotification[]) => ReactNode;
9
9
  imageShape?: 'circle' | 'square';
10
+ newTab?: boolean;
10
11
  };
11
12
  export declare const Notification: (props: NotificationProps) => import("react/jsx-runtime").JSX.Element;
@@ -15,5 +15,6 @@ export type NotificationFeedProps = {
15
15
  };
16
16
  header?: InboxHeaderProps;
17
17
  imageShape?: 'circle' | 'square';
18
+ newTab?: boolean;
18
19
  };
19
20
  export declare const NotificationFeed: React.FC<NotificationFeedProps>;
@@ -9,7 +9,7 @@ import { c as C } from "../../assets/createSvgIcon.js";
9
9
  import { D as I } from "../../assets/Divider.js";
10
10
  const H = C(/* @__PURE__ */ n("path", {
11
11
  d: "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56M12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96M4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2s.06 1.34.14 2zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56m2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8M12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96M14.34 14H9.66c-.09-.66-.16-1.32-.16-2s.07-1.35.16-2h4.68c.09.65.16 1.32.16 2s-.07 1.34-.16 2m.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56M16.36 14c.08-.66.14-1.32.14-2s-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2z"
12
- }), "Language"), N = (e) => {
12
+ }), "Language"), O = (e) => {
13
13
  var a, o, c, l;
14
14
  const [f, r] = d(!1), i = m(p);
15
15
  if (h(() => {
@@ -36,7 +36,8 @@ const H = C(/* @__PURE__ */ n("path", {
36
36
  button1ClickHandler: ((c = e.header) == null ? void 0 : c.button1ClickHandler) ?? i.markAsArchived,
37
37
  button2ClickHandler: ((l = e.header) == null ? void 0 : l.button2ClickHandler) ?? (() => r(!0))
38
38
  },
39
- imageShape: e.imageShape || "circle"
39
+ imageShape: e.imageShape || "circle",
40
+ newTab: e.newTab ?? !1
40
41
  };
41
42
  return /* @__PURE__ */ s(
42
43
  "div",
@@ -60,7 +61,8 @@ const H = C(/* @__PURE__ */ n("path", {
60
61
  pagePosition: t.pagePosition,
61
62
  notificationRenderer: t.renderers.notification,
62
63
  header: t.header,
63
- imageShape: t.imageShape
64
+ imageShape: t.imageShape,
65
+ newTab: t.newTab
64
66
  }
65
67
  ),
66
68
  i.webPushOptInMessage && localStorage.getItem("hideWebPushOptInMessage") !== "true" && /* @__PURE__ */ s("div", { children: [
@@ -102,5 +104,5 @@ const H = C(/* @__PURE__ */ n("path", {
102
104
  );
103
105
  };
104
106
  export {
105
- N as NotificationFeed
107
+ O as NotificationFeed
106
108
  };
@@ -1,22 +1,22 @@
1
1
  import { jsx as o, jsxs as a } from "react/jsx-runtime";
2
- import { useState as c, useContext as C } from "react";
2
+ import { useState as l, useContext as C } from "react";
3
3
  import { Inbox as S } from "./Inbox.js";
4
4
  import { UnreadBadge as y } from "./UnreadBadge.js";
5
5
  import { NotificationAPIContext as z } from "../Provider/context.js";
6
6
  import { NotificationPreferencesPopup as N } from "../Preferences/NotificationPreferencesPopup.js";
7
- import { W as k, L as v } from "../../assets/WebPushOptInMessage.js";
8
- import { N as A } from "../../assets/channelUtils.js";
9
- import { I as H } from "../../assets/IconButton.js";
10
- import { P as L } from "../../assets/Popover.js";
11
- import { D as T } from "../../assets/Divider.js";
7
+ import { W as T, L as k } from "../../assets/WebPushOptInMessage.js";
8
+ import { N as v } from "../../assets/channelUtils.js";
9
+ import { I as A } from "../../assets/IconButton.js";
10
+ import { P as H } from "../../assets/Popover.js";
11
+ import { D as L } from "../../assets/Divider.js";
12
12
  const j = (e) => {
13
- var d, f, u, h, g, p, m, I;
14
- const [P, l] = c(!1), [n, s] = c(!1), i = C(z), [b, O] = c(null);
15
- if (!i)
13
+ var d, f, u, h, g, m, p, b;
14
+ const [I, c] = l(!1), [i, s] = l(!1), n = C(z), [P, O] = l(null);
15
+ if (!n)
16
16
  return null;
17
17
  const t = {
18
18
  buttonIcon: e.buttonIcon || /* @__PURE__ */ o(
19
- A,
19
+ v,
20
20
  {
21
21
  style: {
22
22
  fontSize: e.buttonIconSize || 20,
@@ -45,20 +45,21 @@ const j = (e) => {
45
45
  filter: e.filter || "ALL",
46
46
  header: {
47
47
  title: (d = e.header) == null ? void 0 : d.title,
48
- button1ClickHandler: ((f = e.header) == null ? void 0 : f.button1ClickHandler) ?? i.markAsArchived,
49
- button2ClickHandler: ((u = e.header) == null ? void 0 : u.button2ClickHandler) ?? (() => l(!0))
48
+ button1ClickHandler: ((f = e.header) == null ? void 0 : f.button1ClickHandler) ?? n.markAsArchived,
49
+ button2ClickHandler: ((u = e.header) == null ? void 0 : u.button2ClickHandler) ?? (() => c(!0))
50
50
  },
51
51
  renderers: {
52
52
  notification: (h = e.renderers) == null ? void 0 : h.notification
53
53
  },
54
54
  popoverPosition: {
55
55
  anchorOrigin: {
56
- vertical: ((p = (g = e.popoverPosition) == null ? void 0 : g.anchorOrigin) == null ? void 0 : p.vertical) ?? "top",
57
- horizontal: ((I = (m = e.popoverPosition) == null ? void 0 : m.anchorOrigin) == null ? void 0 : I.horizontal) ?? "left"
56
+ vertical: ((m = (g = e.popoverPosition) == null ? void 0 : g.anchorOrigin) == null ? void 0 : m.vertical) ?? "top",
57
+ horizontal: ((b = (p = e.popoverPosition) == null ? void 0 : p.anchorOrigin) == null ? void 0 : b.horizontal) ?? "left"
58
58
  }
59
- }
59
+ },
60
+ newTab: e.newTab ?? !1
60
61
  }, x = (r) => {
61
- s(!n), O(r == null ? void 0 : r.currentTarget), n && i.markAsOpened();
62
+ s(!i), O(r == null ? void 0 : r.currentTarget), i && n.markAsOpened();
62
63
  };
63
64
  return /* @__PURE__ */ a(
64
65
  "div",
@@ -76,14 +77,14 @@ const j = (e) => {
76
77
  style: {
77
78
  display: "inline-block"
78
79
  },
79
- children: /* @__PURE__ */ o(y, { ...e.unreadBadgeProps, count: t.count, children: /* @__PURE__ */ o(H, { style: t.buttonStyles, onClick: x, children: t.buttonIcon }) })
80
+ children: /* @__PURE__ */ o(y, { ...e.unreadBadgeProps, count: t.count, children: /* @__PURE__ */ o(A, { style: t.buttonStyles, onClick: x, children: t.buttonIcon }) })
80
81
  }
81
82
  ),
82
83
  /* @__PURE__ */ a(
83
- L,
84
+ H,
84
85
  {
85
- open: n,
86
- anchorEl: b,
86
+ open: i,
87
+ anchorEl: P,
87
88
  anchorReference: "anchorEl",
88
89
  anchorOrigin: {
89
90
  horizontal: "center",
@@ -113,16 +114,17 @@ const j = (e) => {
113
114
  pageSize: t.pageSize,
114
115
  pagePosition: t.pagePosition,
115
116
  notificationRenderer: t.renderers.notification,
116
- header: t.header
117
+ header: t.header,
118
+ newTab: t.newTab
117
119
  }
118
120
  ),
119
- i.webPushOptInMessage && localStorage.getItem("hideWebPushOptInMessage") !== "true" && /* @__PURE__ */ a("div", { children: [
120
- /* @__PURE__ */ o(T, { style: { margin: "10px 0" } }),
121
+ n.webPushOptInMessage && localStorage.getItem("hideWebPushOptInMessage") !== "true" && /* @__PURE__ */ a("div", { children: [
122
+ /* @__PURE__ */ o(L, { style: { margin: "10px 0" } }),
121
123
  /* @__PURE__ */ o(
122
- k,
124
+ T,
123
125
  {
124
126
  hideAfterInteraction: !0,
125
- icon: /* @__PURE__ */ o(v, { type: "text", style: { marginLeft: "9px" } }),
127
+ icon: /* @__PURE__ */ o(k, { type: "text", style: { marginLeft: "9px" } }),
126
128
  alertContainerStyle: { maxWidth: "345px" }
127
129
  }
128
130
  )
@@ -133,8 +135,8 @@ const j = (e) => {
133
135
  /* @__PURE__ */ o(
134
136
  N,
135
137
  {
136
- open: P,
137
- onClose: () => l(!1)
138
+ open: I,
139
+ onClose: () => c(!1)
138
140
  }
139
141
  )
140
142
  ]
@@ -29,5 +29,6 @@ export type NotificationPopupProps = {
29
29
  horizontal: 'left' | 'center' | 'right';
30
30
  };
31
31
  };
32
+ newTab?: boolean;
32
33
  };
33
34
  export declare const NotificationPopup: React.FC<NotificationPopupProps>;
@@ -8,12 +8,12 @@ import { Filter as z } from "./interface.js";
8
8
  import { W as y } from "../../assets/WebPushOptInMessage.js";
9
9
  import { N as k } from "../../assets/channelUtils.js";
10
10
  import { I as H } from "../../assets/IconButton.js";
11
- import { P as A } from "../../assets/Popover.js";
12
- import { D as B } from "../../assets/Divider.js";
11
+ import { P as T } from "../../assets/Popover.js";
12
+ import { D as A } from "../../assets/Divider.js";
13
13
  const j = (e) => {
14
- var c, d, u, h, p, s, g, f;
15
- const [I, a] = m(!1), [n, l] = m(null), i = O(v);
16
- if (!i)
14
+ var c, d, u, h, s, p, g, f;
15
+ const [I, a] = m(!1), [i, l] = m(null), n = O(v);
16
+ if (!n)
17
17
  return null;
18
18
  const t = {
19
19
  buttonIcon: e.buttonIcon || /* @__PURE__ */ o(
@@ -43,7 +43,7 @@ const j = (e) => {
43
43
  filter: e.filter || z.ALL,
44
44
  header: {
45
45
  title: (c = e.header) == null ? void 0 : c.title,
46
- button1ClickHandler: ((d = e.header) == null ? void 0 : d.button1ClickHandler) ?? i.markAsArchived,
46
+ button1ClickHandler: ((d = e.header) == null ? void 0 : d.button1ClickHandler) ?? n.markAsArchived,
47
47
  button2ClickHandler: ((u = e.header) == null ? void 0 : u.button2ClickHandler) ?? (() => a(!0))
48
48
  },
49
49
  renderers: {
@@ -51,12 +51,13 @@ const j = (e) => {
51
51
  },
52
52
  popoverPosition: {
53
53
  anchorOrigin: {
54
- vertical: ((s = (p = e.popoverPosition) == null ? void 0 : p.anchorOrigin) == null ? void 0 : s.vertical) ?? "top",
54
+ vertical: ((p = (s = e.popoverPosition) == null ? void 0 : s.anchorOrigin) == null ? void 0 : p.vertical) ?? "top",
55
55
  horizontal: ((f = (g = e.popoverPosition) == null ? void 0 : g.anchorOrigin) == null ? void 0 : f.horizontal) ?? "left"
56
56
  }
57
- }
58
- }, P = (b) => {
59
- l(b.currentTarget), i.markAsOpened();
57
+ },
58
+ newTab: e.newTab ?? !1
59
+ }, b = (P) => {
60
+ l(P.currentTarget), n.markAsOpened();
60
61
  };
61
62
  return /* @__PURE__ */ r(C, { children: [
62
63
  /* @__PURE__ */ o(
@@ -71,17 +72,17 @@ const j = (e) => {
71
72
  ...e.unreadBadgeProps,
72
73
  count: t.count,
73
74
  filter: t.filter,
74
- children: /* @__PURE__ */ o(H, { onClick: P, style: t.buttonStyles, children: t.buttonIcon })
75
+ children: /* @__PURE__ */ o(H, { onClick: b, style: t.buttonStyles, children: t.buttonIcon })
75
76
  }
76
77
  )
77
78
  }
78
79
  ),
79
80
  /* @__PURE__ */ o(
80
- A,
81
+ T,
81
82
  {
82
- open: !!n,
83
+ open: !!i,
83
84
  onClose: () => l(null),
84
- anchorEl: n,
85
+ anchorEl: i,
85
86
  slotProps: {
86
87
  paper: {
87
88
  style: {
@@ -89,7 +90,7 @@ const j = (e) => {
89
90
  }
90
91
  }
91
92
  },
92
- "aria-hidden": !n,
93
+ "aria-hidden": !i,
93
94
  anchorOrigin: t.popoverPosition.anchorOrigin,
94
95
  children: /* @__PURE__ */ r(
95
96
  "div",
@@ -110,11 +111,12 @@ const j = (e) => {
110
111
  pageSize: t.pageSize,
111
112
  pagePosition: t.pagePosition,
112
113
  notificationRenderer: t.renderers.notification,
113
- header: t.header
114
+ header: t.header,
115
+ newTab: t.newTab
114
116
  }
115
117
  ),
116
- i.webPushOptInMessage && localStorage.getItem("hideWebPushOptInMessage") !== "true" && /* @__PURE__ */ r("div", { children: [
117
- /* @__PURE__ */ o(B, { style: { margin: "10px 0" } }),
118
+ n.webPushOptInMessage && localStorage.getItem("hideWebPushOptInMessage") !== "true" && /* @__PURE__ */ r("div", { children: [
119
+ /* @__PURE__ */ o(A, { style: { margin: "10px 0" } }),
118
120
  /* @__PURE__ */ o(y, { hideAfterInteraction: !0 })
119
121
  ] })
120
122
  ]
@@ -119,9 +119,9 @@ const Oe = (o) => {
119
119
  children: l,
120
120
  className: u,
121
121
  collapsedSize: d = "0px",
122
- component: m,
122
+ component: g,
123
123
  easing: a,
124
- in: g,
124
+ in: m,
125
125
  onEnter: E,
126
126
  onEntered: R,
127
127
  onEntering: A,
@@ -187,7 +187,7 @@ const Oe = (o) => {
187
187
  r.style[N] = z, r.style.transitionTimingFunction = B, v && v(r);
188
188
  });
189
189
  return /* @__PURE__ */ i(k, {
190
- in: g,
190
+ in: m,
191
191
  onEnter: le,
192
192
  onEntered: ue,
193
193
  onEntering: pe,
@@ -204,10 +204,10 @@ const Oe = (o) => {
204
204
  ownerState: h,
205
205
  ...y
206
206
  }) => /* @__PURE__ */ i($e, {
207
- as: m,
207
+ as: g,
208
208
  className: U(x.root, u, {
209
209
  entered: x.entered,
210
- exited: !g && z === "0px" && x.hidden
210
+ exited: !m && z === "0px" && x.hidden
211
211
  }[r]),
212
212
  style: {
213
213
  [S ? "minWidth" : "minHeight"]: z,
@@ -454,9 +454,9 @@ const F = q("MuiAccordion", ["root", "heading", "rounded", "expanded", "disabled
454
454
  className: l,
455
455
  defaultExpanded: u = !1,
456
456
  disabled: d = !1,
457
- disableGutters: m = !1,
457
+ disableGutters: g = !1,
458
458
  expanded: a,
459
- onChange: g,
459
+ onChange: m,
460
460
  square: E = !1,
461
461
  slots: R = {},
462
462
  slotProps: A = {},
@@ -469,17 +469,17 @@ const F = q("MuiAccordion", ["root", "heading", "rounded", "expanded", "disabled
469
469
  name: "Accordion",
470
470
  state: "expanded"
471
471
  }), b = p.useCallback((Y) => {
472
- M(!f), g && g(Y, !f);
473
- }, [f, g, M]), [k, ...Q] = p.Children.toArray(c), P = p.useMemo(() => ({
472
+ M(!f), m && m(Y, !f);
473
+ }, [f, m, M]), [k, ...Q] = p.Children.toArray(c), P = p.useMemo(() => ({
474
474
  expanded: f,
475
475
  disabled: d,
476
- disableGutters: m,
476
+ disableGutters: g,
477
477
  toggle: b
478
- }), [f, d, m, b]), x = {
478
+ }), [f, d, g, b]), x = {
479
479
  ...s,
480
480
  square: E,
481
481
  disabled: d,
482
- disableGutters: m,
482
+ disableGutters: g,
483
483
  expanded: f
484
484
  }, O = We(x), X = {
485
485
  transition: D,
@@ -764,25 +764,25 @@ const W = q("MuiAccordionSummary", ["root", "expanded", "focusVisible", "disable
764
764
  className: l,
765
765
  expandIcon: u,
766
766
  focusVisibleClassName: d,
767
- onClick: m,
767
+ onClick: g,
768
768
  ...a
769
769
  } = s, {
770
- disabled: g = !1,
770
+ disabled: m = !1,
771
771
  disableGutters: E,
772
772
  expanded: R,
773
773
  toggle: A
774
774
  } = p.useContext(ne), D = (f) => {
775
- A && A(f), m && m(f);
775
+ A && A(f), g && g(f);
776
776
  }, w = {
777
777
  ...s,
778
778
  expanded: R,
779
- disabled: g,
779
+ disabled: m,
780
780
  disableGutters: E
781
781
  }, v = Le(w);
782
782
  return /* @__PURE__ */ G(qe, {
783
783
  focusRipple: !1,
784
784
  disableRipple: !0,
785
- disabled: g,
785
+ disabled: m,
786
786
  "aria-expanded": R,
787
787
  className: U(v.root, l),
788
788
  focusVisibleClassName: U(v.focusVisible, d),
@@ -848,14 +848,14 @@ function uo() {
848
848
  if (!o || !o.preferences)
849
849
  return null;
850
850
  const t = o.preferences.notifications.sort((n, s) => n.title.localeCompare(s.title)).map((n) => {
851
- var u, d, m;
851
+ var u, d, g;
852
852
  const s = (u = o.preferences) == null ? void 0 : u.preferences.filter(
853
853
  (a) => a.notificationId === n.notificationId && !a.subNotificationId
854
854
  ), c = (d = o.preferences) == null ? void 0 : d.preferences.filter(
855
855
  (a) => a.notificationId === n.notificationId && a.subNotificationId
856
- ), l = (m = o.preferences) == null ? void 0 : m.subNotifications.filter(
856
+ ), l = (g = o.preferences) == null ? void 0 : g.subNotifications.filter(
857
857
  (a) => c == null ? void 0 : c.find(
858
- (g) => g.subNotificationId === a.subNotificationId
858
+ (m) => m.subNotificationId === a.subNotificationId && m.notificationId === a.notificationId
859
859
  )
860
860
  );
861
861
  return /* @__PURE__ */ G(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@notificationapi/react",
3
3
  "private": false,
4
- "version": "1.6.0",
4
+ "version": "1.6.2",
5
5
  "type": "module",
6
6
  "overrides": {
7
7
  "esbuild": "^0.25.0",