@notificationapi/react 0.0.12 → 0.0.14

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.
@@ -4492,7 +4492,7 @@ const pu = Un.div`
4492
4492
  &:hover .notification-archive-button {
4493
4493
  visibility: ${(e) => e.$archived ? "hidden" : "visible"};
4494
4494
  }
4495
- `, wu = (e) => /* @__PURE__ */ lt(
4495
+ `, wu = (e) => e.renderer ? e.renderer(e.notification) : /* @__PURE__ */ lt(
4496
4496
  pu,
4497
4497
  {
4498
4498
  $redirect: !!e.notification.redirectURL,
@@ -1,17 +1,18 @@
1
1
  import { ImageShape } from './Notification';
2
2
  import { NotificationPopupProps } from './NotificationPopup';
3
+ import { InAppNotification } from '../../interface';
3
4
 
4
5
  export declare enum Pagination {
5
6
  INFINITE_SCROLL = "infinite_scroll",
6
7
  PAGINATED = "paginated"
7
8
  }
8
- type InboxProps = {
9
+ export type InboxProps = {
9
10
  pagination: keyof typeof Pagination;
10
11
  maxHeight: number;
11
12
  filter: NotificationPopupProps["filter"];
12
13
  imageShape: keyof typeof ImageShape;
13
14
  pageSize: number;
14
15
  pagePosition: NotificationPopupProps["pagePosition"];
16
+ notificationRenderer: ((notification: InAppNotification) => JSX.Element) | undefined;
15
17
  };
16
18
  export declare const Inbox: React.FC<InboxProps>;
17
- export {};
@@ -4,9 +4,11 @@ export declare enum ImageShape {
4
4
  square = "square",
5
5
  circle = "circle"
6
6
  }
7
- export declare const Notification: (props: {
7
+ export type NotificationProps = {
8
8
  notification: InAppNotification;
9
9
  markAsArchived: (ids: string[] | "ALL") => void;
10
10
  markAsClicked: (id: string) => void;
11
11
  imageShape: keyof typeof ImageShape;
12
- }) => JSX.Element;
12
+ renderer?: (notification: InAppNotification) => JSX.Element;
13
+ };
14
+ export declare const Notification: (props: NotificationProps) => JSX.Element;
@@ -2,6 +2,6 @@ import { PropsWithChildren } from 'react';
2
2
  import { UnreadBadgeProps } from './UnreadBadge';
3
3
 
4
4
  export type NotificationCounterProps = Omit<UnreadBadgeProps, "count"> & {
5
- counting?: UnreadBadgeProps["count"];
5
+ count?: UnreadBadgeProps["count"];
6
6
  };
7
7
  export declare const NotificationCounter: React.FC<PropsWithChildren<NotificationCounterProps>>;
@@ -1,9 +1,9 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
2
  import { UnreadBadge as r } from "./UnreadBadge.js";
3
- const N = (o) => {
4
- const t = o.counting || "COUNT_UNOPENED_NOTIFICATIONS";
3
+ const e = (o) => {
4
+ const t = o.count || "COUNT_UNOPENED_NOTIFICATIONS";
5
5
  return /* @__PURE__ */ n(r, { ...o, count: t });
6
6
  };
7
7
  export {
8
- N as NotificationCounter
8
+ e as NotificationCounter
9
9
  };
@@ -1,5 +1,5 @@
1
1
  import { Pagination } from './Inbox';
2
- import { ImageShape } from './Notification';
2
+ import { ImageShape, NotificationProps } from './Notification';
3
3
  import { Filter } from './NotificationPopup';
4
4
  import { InAppNotification } from '../../interface';
5
5
 
@@ -11,5 +11,8 @@ export type NotificationFeedProps = {
11
11
  infiniteScrollHeight?: number;
12
12
  style?: React.CSSProperties;
13
13
  filter?: keyof typeof Filter | ((n: InAppNotification) => boolean);
14
+ renderers?: {
15
+ notification?: NotificationProps["renderer"];
16
+ };
14
17
  };
15
18
  export declare const NotificationFeed: React.FC<NotificationFeedProps>;
@@ -1,24 +1,28 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import { useContext as o, useEffect as r } from "react";
3
- import { F as g, I as l } from "../../assets/Inbox.js";
4
- import { NotificationAPIContext as f } from "../Provider/index.js";
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { useContext as r, useEffect as g } from "react";
3
+ import { F as f, I as l } from "../../assets/Inbox.js";
4
+ import { NotificationAPIContext as c } from "../Provider/index.js";
5
5
  const h = (i) => {
6
+ var n;
6
7
  const e = {
7
8
  imageShape: i.imageShape || "circle",
8
9
  pagination: i.pagination || "INFINITE_SCROLL",
9
10
  pageSize: i.pageSize || 10,
10
11
  pagePosition: i.pagePosition || "top",
11
12
  style: i.style || {},
12
- filter: i.filter || g.ALL,
13
- infiniteScrollHeight: i.infiniteScrollHeight ? i.infiniteScrollHeight : window.innerHeight * 0.75
14
- }, t = o(f);
15
- return t ? (r(() => {
13
+ filter: i.filter || f.ALL,
14
+ infiniteScrollHeight: i.infiniteScrollHeight ? i.infiniteScrollHeight : window.innerHeight * 0.75,
15
+ renderers: {
16
+ notification: (n = i.renderers) == null ? void 0 : n.notification
17
+ }
18
+ }, t = r(c);
19
+ return t ? (g(() => {
16
20
  t.markAsOpened();
17
21
  const a = setInterval(() => {
18
22
  t.markAsOpened();
19
23
  }, 5e3);
20
24
  return () => clearInterval(a);
21
- }, []), /* @__PURE__ */ n(
25
+ }, []), /* @__PURE__ */ o(
22
26
  "div",
23
27
  {
24
28
  style: {
@@ -27,7 +31,7 @@ const h = (i) => {
27
31
  background: "#fff",
28
32
  ...i.style
29
33
  },
30
- children: /* @__PURE__ */ n(
34
+ children: /* @__PURE__ */ o(
31
35
  l,
32
36
  {
33
37
  maxHeight: e.infiniteScrollHeight,
@@ -35,7 +39,8 @@ const h = (i) => {
35
39
  filter: e.filter,
36
40
  imageShape: e.imageShape,
37
41
  pageSize: e.pageSize,
38
- pagePosition: e.pagePosition
42
+ pagePosition: e.pagePosition,
43
+ notificationRenderer: e.renderers.notification
39
44
  }
40
45
  )
41
46
  }
@@ -1,13 +1,14 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
- import { I as a } from "../../assets/Inbox.js";
2
+ import { I as r } from "../../assets/Inbox.js";
3
3
  import { UnreadBadge as f } from "./UnreadBadge.js";
4
- import { useContext as r } from "react";
4
+ import { useContext as d } from "react";
5
5
  import { NotificationAPIContext as g } from "../Provider/index.js";
6
6
  import { P as u } from "../../assets/index.js";
7
- import { B as h } from "../../assets/button.js";
8
- import { R as d } from "../../assets/BellOutlined.js";
7
+ import { B as c } from "../../assets/button.js";
8
+ import { R as h } from "../../assets/BellOutlined.js";
9
9
  var l = /* @__PURE__ */ ((t) => (t.TOP_LEFT = "top-left", t.TOP_RIGHT = "top-right", t.BOTTOM_LEFT = "bottom-left", t.BOTTOM_RIGHT = "bottom-right", t))(l || {});
10
- const S = (t) => {
10
+ const y = (t) => {
11
+ var n;
11
12
  const e = {
12
13
  buttonWidth: t.buttonWidth || 40,
13
14
  buttonHeight: t.buttonHeight || 40,
@@ -27,8 +28,11 @@ const S = (t) => {
27
28
  offsetY: t.offsetY || 16,
28
29
  position: t.position || "BOTTOM_RIGHT",
29
30
  count: t.count || "COUNT_UNOPENED_NOTIFICATIONS",
30
- filter: t.filter || "ALL"
31
- }, o = r(g);
31
+ filter: t.filter || "ALL",
32
+ renderers: {
33
+ notification: (n = t.renderers) == null ? void 0 : n.notification
34
+ }
35
+ }, o = d(g);
32
36
  return o ? /* @__PURE__ */ i(
33
37
  "div",
34
38
  {
@@ -44,14 +48,15 @@ const S = (t) => {
44
48
  autoAdjustOverflow: !0,
45
49
  trigger: "click",
46
50
  content: /* @__PURE__ */ i(
47
- a,
51
+ r,
48
52
  {
49
53
  maxHeight: 500,
50
54
  pagination: e.pagination,
51
55
  filter: e.filter,
52
56
  imageShape: e.imageShape,
53
57
  pageSize: e.pageSize,
54
- pagePosition: e.pagePosition
58
+ pagePosition: e.pagePosition,
59
+ notificationRenderer: e.renderers.notification
55
60
  }
56
61
  ),
57
62
  arrow: !1,
@@ -59,8 +64,8 @@ const S = (t) => {
59
64
  padding: "0 16px",
60
65
  minWidth: e.popupWidth
61
66
  },
62
- onOpenChange: (n) => {
63
- n && o.markAsOpened();
67
+ onOpenChange: (a) => {
68
+ a && o.markAsOpened();
64
69
  },
65
70
  children: /* @__PURE__ */ i(
66
71
  "div",
@@ -78,10 +83,10 @@ const S = (t) => {
78
83
  },
79
84
  count: e.count,
80
85
  children: /* @__PURE__ */ i(
81
- h,
86
+ c,
82
87
  {
83
88
  icon: /* @__PURE__ */ i(
84
- d,
89
+ h,
85
90
  {
86
91
  style: {
87
92
  fontSize: e.buttonIconSize
@@ -106,6 +111,6 @@ const S = (t) => {
106
111
  ) : null;
107
112
  };
108
113
  export {
109
- S as NotificationLauncher,
114
+ y as NotificationLauncher,
110
115
  l as Position
111
116
  };
@@ -1,6 +1,6 @@
1
1
  import { Pagination } from './Inbox';
2
2
  import { UnreadBadgeProps } from './UnreadBadge';
3
- import { ImageShape } from './Notification';
3
+ import { ImageShape, NotificationProps } from './Notification';
4
4
  import { InAppNotification } from '../../interface';
5
5
 
6
6
  export declare enum Filter {
@@ -21,5 +21,8 @@ export type NotificationPopupProps = {
21
21
  unreadBadgeProps?: UnreadBadgeProps;
22
22
  count?: UnreadBadgeProps["count"];
23
23
  filter?: keyof typeof Filter | ((n: InAppNotification) => boolean);
24
+ renderers?: {
25
+ notification?: NotificationProps["renderer"];
26
+ };
24
27
  };
25
28
  export declare const NotificationPopup: React.FC<NotificationPopupProps>;
@@ -1,5 +1,6 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { NotificationPopupProps } from './NotificationPopup';
3
+ import { InAppNotification } from '../../interface';
3
4
 
4
5
  export type UnreadBadgeProps = {
5
6
  color?: "blue" | "purple" | "cyan" | "green" | "magenta" | "pink" | "red" | "orange" | "yellow" | "volcano" | "geekblue" | "lime" | "gold" | undefined;
@@ -8,7 +9,7 @@ export type UnreadBadgeProps = {
8
9
  showZero?: boolean;
9
10
  size?: "default" | "small";
10
11
  style?: React.CSSProperties;
11
- count?: keyof typeof COUNT_TYPE | ((notification: any) => boolean);
12
+ count?: keyof typeof COUNT_TYPE | ((notification: InAppNotification) => boolean);
12
13
  filter?: NotificationPopupProps["filter"];
13
14
  };
14
15
  export declare enum COUNT_TYPE {
@@ -1,15 +1,6 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { InAppNotification } from '../../interface';
3
3
 
4
- type Props = {
5
- clientId: string;
6
- userId: string;
7
- hashedUserId?: string;
8
- apiURL?: string;
9
- wsURL?: string;
10
- initialLoadMaxCount?: number;
11
- initialLoadMaxAge?: Date;
12
- };
13
4
  export declare const NOTIFICATION_ACTIONS: {
14
5
  opened: string;
15
6
  clicked: string;
@@ -34,7 +25,7 @@ export declare enum DeliveryOptions {
34
25
  WEEKLY = "weekly",
35
26
  MONTHLY = "monthly"
36
27
  }
37
- export interface Notification {
28
+ export interface NotificationConfig {
38
29
  envId: string;
39
30
  notificationId: string;
40
31
  title: string;
@@ -91,7 +82,7 @@ export interface Preferences {
91
82
  notificationId: string;
92
83
  title: string;
93
84
  channels: Channels[];
94
- options: Notification["options"];
85
+ options: NotificationConfig["options"];
95
86
  }[];
96
87
  subNotifications: {
97
88
  notificationId: string;
@@ -109,5 +100,17 @@ export type Context = {
109
100
  updateDelivery: (notificationId: string, channel: Channels, delivery: DeliveryOptions, subNotificationId?: string) => void;
110
101
  };
111
102
  export declare const NotificationAPIContext: import('react').Context<Context | undefined>;
112
- export declare const NotificationAPIProvider: React.FunctionComponent<PropsWithChildren<Props>>;
103
+ type Props = {
104
+ clientId: string;
105
+ userId: string;
106
+ hashedUserId?: string;
107
+ apiURL?: string;
108
+ wsURL?: string;
109
+ initialLoadMaxCount?: number;
110
+ initialLoadMaxAge?: Date;
111
+ };
112
+ export declare const NotificationAPIProvider: React.FunctionComponent<PropsWithChildren<Props>> & {
113
+ useNotificationAPIContext: typeof useNotificationAPIContext;
114
+ };
115
+ declare const useNotificationAPIContext: () => Context;
113
116
  export {};
@@ -1,7 +1,7 @@
1
- import { jsx as _ } from "react/jsx-runtime";
2
- import { createContext as x, useState as f, useEffect as B } from "react";
3
- import { api as r } from "../../api.js";
4
- const j = {
1
+ import { jsx as W } from "react/jsx-runtime";
2
+ import { createContext as _, useState as f, useEffect as y, useContext as v } from "react";
3
+ import { api as s } from "../../api.js";
4
+ const q = {
5
5
  opened: "opened",
6
6
  clicked: "clicked",
7
7
  archived: "archived",
@@ -9,10 +9,10 @@ const j = {
9
9
  actioned1: "actioned1",
10
10
  actioned2: "actioned2"
11
11
  };
12
- var $ = /* @__PURE__ */ ((e) => (e.EMAIL = "EMAIL", e.INAPP_WEB = "INAPP_WEB", e.SMS = "SMS", e.CALL = "CALL", e.PUSH = "PUSH", e.WEB_PUSH = "WEB_PUSH", e))($ || {}), v = /* @__PURE__ */ ((e) => (e.OFF = "off", e.INSTANT = "instant", e.HOURLY = "hourly", e.DAILY = "daily", e.WEEKLY = "weekly", e.MONTHLY = "monthly", e))(v || {});
13
- const y = x(
12
+ var B = /* @__PURE__ */ ((e) => (e.EMAIL = "EMAIL", e.INAPP_WEB = "INAPP_WEB", e.SMS = "SMS", e.CALL = "CALL", e.PUSH = "PUSH", e.WEB_PUSH = "WEB_PUSH", e))(B || {}), $ = /* @__PURE__ */ ((e) => (e.OFF = "off", e.INSTANT = "instant", e.HOURLY = "hourly", e.DAILY = "daily", e.WEEKLY = "weekly", e.MONTHLY = "monthly", e))($ || {});
13
+ const g = _(
14
14
  void 0
15
- ), J = (e) => {
15
+ ), b = (e) => {
16
16
  const c = {
17
17
  ...{
18
18
  apiURL: "https://api.notificationapi.com",
@@ -21,51 +21,51 @@ const y = x(
21
21
  initialLoadMaxAge: new Date((/* @__PURE__ */ new Date()).setMonth((/* @__PURE__ */ new Date()).getMonth() - 3))
22
22
  },
23
23
  ...e
24
- }, [s, u] = f(), [P, S] = f(), [U, w] = f(!1), [N, E] = f((/* @__PURE__ */ new Date()).toISOString()), [m, M] = f(!0), g = (a) => {
24
+ }, [d, u] = f(), [N, w] = f(), [U, S] = f(!1), [E, M] = f((/* @__PURE__ */ new Date()).toISOString()), [m, T] = f(!0), A = (o) => {
25
25
  const n = (/* @__PURE__ */ new Date()).toISOString();
26
- u((t) => (a = a.filter((i) => !(i.expDate && new Date(i.expDate * 1e3).toISOString() > n || i.date > n)), t ? [
27
- ...a.filter((i) => !t.find((o) => o.id === i.id)),
26
+ u((t) => (o = o.filter((i) => !(i.expDate && new Date(i.expDate * 1e3).toISOString() > n || i.date > n)), t ? [
27
+ ...o.filter((i) => !t.find((a) => a.id === i.id)),
28
28
  ...t
29
- ] : a));
30
- }, T = async (a, n) => (await r(
29
+ ] : o));
30
+ }, k = async (o, n) => (await s(
31
31
  c.apiURL,
32
32
  "GET",
33
- `notifications/INAPP_WEB?count=${a}&before=${n}`,
33
+ `notifications/INAPP_WEB?count=${o}&before=${n}`,
34
34
  e.clientId,
35
35
  e.userId,
36
36
  e.hashedUserId
37
- )).notifications, k = async (a, n, t) => {
38
- let i = [], o = a, d = !0, h = !0;
37
+ )).notifications, x = async (o, n, t) => {
38
+ let i = [], a = o, r = !0, h = !0;
39
39
  for (; h; ) {
40
- const L = (await T(
40
+ const L = (await k(
41
41
  n,
42
- new Date(o).getTime()
42
+ new Date(a).getTime()
43
43
  )).filter(
44
44
  (I) => !i.find((l) => l.id === I.id)
45
45
  );
46
- o = L.reduce(
46
+ a = L.reduce(
47
47
  (I, l) => I < l.date ? I : l.date,
48
- a
49
- ), i = [...i, ...L], d = L.length > 0, h = !0, (!d || i.length >= n || t && o < t) && (h = !1);
48
+ o
49
+ ), i = [...i, ...L], r = L.length > 0, h = !0, (!r || i.length >= n || t && a < t) && (h = !1);
50
50
  }
51
51
  return {
52
52
  notifications: i,
53
- couldLoadMore: d,
54
- oldestReceived: o
53
+ couldLoadMore: r,
54
+ oldestReceived: a
55
55
  };
56
- }, A = async (a) => {
56
+ }, P = async (o) => {
57
57
  if (!m || U)
58
58
  return;
59
- w(!0);
60
- const n = await k(
61
- N,
62
- a ? c.initialLoadMaxCount : 1e3,
63
- a ? c.initialLoadMaxAge.toISOString() : void 0
59
+ S(!0);
60
+ const n = await x(
61
+ E,
62
+ o ? c.initialLoadMaxCount : 1e3,
63
+ o ? c.initialLoadMaxAge.toISOString() : void 0
64
64
  );
65
- E(n.oldestReceived), M(n.couldLoadMore), g(n.notifications), w(!1);
66
- }, R = async (a) => {
65
+ M(n.oldestReceived), T(n.couldLoadMore), A(n.notifications), S(!1);
66
+ }, R = async (o) => {
67
67
  const n = (/* @__PURE__ */ new Date()).toISOString();
68
- r(
68
+ s(
69
69
  c.apiURL,
70
70
  "PATCH",
71
71
  "notifications/INAPP_WEB",
@@ -73,20 +73,20 @@ const y = x(
73
73
  e.userId,
74
74
  e.hashedUserId,
75
75
  {
76
- trackingIds: [a],
76
+ trackingIds: [o],
77
77
  clicked: n
78
78
  }
79
79
  ), u((t) => {
80
80
  if (!t)
81
81
  return [];
82
- const i = [...t], o = i.find((d) => d.id === a);
83
- return o && (o.clicked = n), i;
82
+ const i = [...t], a = i.find((r) => r.id === o);
83
+ return a && (a.clicked = n), i;
84
84
  });
85
- }, O = async () => {
86
- if (!s)
85
+ }, C = async () => {
86
+ if (!d)
87
87
  return;
88
- const a = (/* @__PURE__ */ new Date()).toISOString(), n = s.filter((t) => !t.opened || !t.seen).map((t) => t.id);
89
- n.length !== 0 && (r(
88
+ const o = (/* @__PURE__ */ new Date()).toISOString(), n = d.filter((t) => !t.opened || !t.seen).map((t) => t.id);
89
+ n.length !== 0 && (s(
90
90
  c.apiURL,
91
91
  "PATCH",
92
92
  "notifications/INAPP_WEB",
@@ -95,21 +95,21 @@ const y = x(
95
95
  e.hashedUserId,
96
96
  {
97
97
  trackingIds: n,
98
- opened: a
98
+ opened: o
99
99
  }
100
100
  ), u((t) => {
101
101
  if (!t)
102
102
  return [];
103
103
  const i = [...t];
104
- return i.filter((o) => n.includes(o.id)).forEach((o) => {
105
- o.opened = a, o.seen = !0;
104
+ return i.filter((a) => n.includes(a.id)).forEach((a) => {
105
+ a.opened = o, a.seen = !0;
106
106
  }), i;
107
107
  }));
108
- }, D = async (a) => {
109
- if (!s)
108
+ }, O = async (o) => {
109
+ if (!d)
110
110
  return;
111
- const n = (/* @__PURE__ */ new Date()).toISOString(), t = s.filter((i) => !i.archived && (a === "ALL" || a.includes(i.id))).map((i) => i.id);
112
- t.length !== 0 && (r(
111
+ const n = (/* @__PURE__ */ new Date()).toISOString(), t = d.filter((i) => !i.archived && (o === "ALL" || o.includes(i.id))).map((i) => i.id);
112
+ t.length !== 0 && (s(
113
113
  c.apiURL,
114
114
  "PATCH",
115
115
  "notifications/INAPP_WEB",
@@ -123,13 +123,13 @@ const y = x(
123
123
  ), u((i) => {
124
124
  if (!i)
125
125
  return [];
126
- const o = [...i];
127
- return o.filter((d) => t.includes(d.id)).forEach((d) => {
128
- d.archived = n;
129
- }), o;
126
+ const a = [...i];
127
+ return a.filter((r) => t.includes(r.id)).forEach((r) => {
128
+ r.archived = n;
129
+ }), a;
130
130
  }));
131
- }, H = (a, n, t, i) => {
132
- r(
131
+ }, D = (o, n, t, i) => {
132
+ s(
133
133
  c.apiURL,
134
134
  "POST",
135
135
  "preferences",
@@ -138,34 +138,34 @@ const y = x(
138
138
  e.hashedUserId,
139
139
  [
140
140
  {
141
- notificationId: a,
141
+ notificationId: o,
142
142
  subNotificationId: i,
143
143
  channel: n,
144
144
  delivery: t
145
145
  }
146
146
  ]
147
147
  ).then(() => {
148
- r(
148
+ s(
149
149
  c.apiURL,
150
150
  "GET",
151
151
  "preferences",
152
152
  e.clientId,
153
153
  e.userId,
154
154
  e.hashedUserId
155
- ).then((o) => {
156
- S(o);
155
+ ).then((a) => {
156
+ w(a);
157
157
  });
158
158
  });
159
159
  };
160
- B(() => {
161
- A(!0);
162
- const a = new WebSocket(
160
+ y(() => {
161
+ P(!0);
162
+ const o = new WebSocket(
163
163
  c.hashedUserId ? `${c.wsURL}?userId=${c.userId}&envId=${c.clientId}&userIdHash=${c.hashedUserId}` : `${c.wsURL}?userId=${c.userId}&envId=${c.clientId}`
164
164
  );
165
- a.onmessage = (n) => {
165
+ o.onmessage = (n) => {
166
166
  const t = JSON.parse(n.data);
167
- !t || !t.route || t.route === "inapp_web/new_notifications" && g(t.payload.notifications);
168
- }, r(
167
+ !t || !t.route || t.route === "inapp_web/new_notifications" && A(t.payload.notifications);
168
+ }, s(
169
169
  c.apiURL,
170
170
  "GET",
171
171
  "preferences",
@@ -173,24 +173,30 @@ const y = x(
173
173
  e.userId,
174
174
  e.hashedUserId
175
175
  ).then((n) => {
176
- S(n);
176
+ w(n);
177
177
  });
178
178
  }, []);
179
- const W = {
180
- notifications: s,
181
- preferences: P,
182
- loadNotifications: A,
183
- markAsOpened: O,
184
- markAsArchived: D,
179
+ const H = {
180
+ notifications: d,
181
+ preferences: N,
182
+ loadNotifications: P,
183
+ markAsOpened: C,
184
+ markAsArchived: O,
185
185
  markAsClicked: R,
186
- updateDelivery: H
186
+ updateDelivery: D
187
187
  };
188
- return /* @__PURE__ */ _(y.Provider, { value: W, children: e.children });
188
+ return /* @__PURE__ */ W(g.Provider, { value: H, children: e.children });
189
+ }, Y = () => {
190
+ const e = v(g);
191
+ if (!e)
192
+ throw new Error("useMyContext must be used within a MyProvider");
193
+ return e;
189
194
  };
195
+ b.useNotificationAPIContext = Y;
190
196
  export {
191
- $ as Channels,
192
- v as DeliveryOptions,
193
- j as NOTIFICATION_ACTIONS,
194
- y as NotificationAPIContext,
195
- J as NotificationAPIProvider
197
+ B as Channels,
198
+ $ as DeliveryOptions,
199
+ q as NOTIFICATION_ACTIONS,
200
+ g as NotificationAPIContext,
201
+ b as NotificationAPIProvider
196
202
  };
@@ -1,5 +1,6 @@
1
1
  export interface InAppNotification {
2
2
  id: string;
3
+ notificationId: string;
3
4
  seen: boolean;
4
5
  title: string;
5
6
  redirectURL?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@notificationapi/react",
3
3
  "private": false,
4
- "version": "0.0.12",
4
+ "version": "0.0.14",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",