@novu/react 3.19.2-rc.dc9caee828 → 3.20.0-rc.569d407fd0

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.
Files changed (250) hide show
  1. package/dist/cjs/components/Bell.cjs +6 -21
  2. package/dist/cjs/components/Bell.cjs.map +1 -1
  3. package/dist/cjs/components/Bell.d.cts +2 -3
  4. package/dist/cjs/components/Inbox.cjs +100 -138
  5. package/dist/cjs/components/Inbox.cjs.map +1 -1
  6. package/dist/cjs/components/InboxContent.cjs +9 -65
  7. package/dist/cjs/components/InboxContent.cjs.map +1 -1
  8. package/dist/cjs/components/InboxContent.d.cts +2 -3
  9. package/dist/cjs/components/Mounter.cjs +20 -13
  10. package/dist/cjs/components/Mounter.cjs.map +1 -1
  11. package/dist/cjs/components/Mounter.d.cts +12 -4
  12. package/dist/cjs/components/Notifications.cjs +9 -59
  13. package/dist/cjs/components/Notifications.cjs.map +1 -1
  14. package/dist/cjs/components/Notifications.d.cts +2 -3
  15. package/dist/cjs/components/NovuUI.cjs +17 -6
  16. package/dist/cjs/components/NovuUI.cjs.map +1 -1
  17. package/dist/cjs/components/NovuUI.d.cts +4 -0
  18. package/dist/cjs/{context/RendererContext.cjs → components/OutletHost.cjs} +15 -15
  19. package/dist/cjs/components/OutletHost.cjs.map +1 -0
  20. package/dist/cjs/components/OutletHost.d.cts +14 -0
  21. package/dist/cjs/components/Preferences.cjs +1 -20
  22. package/dist/cjs/components/Preferences.cjs.map +1 -1
  23. package/dist/cjs/components/connect-chat/ConnectChat.cjs +2 -3
  24. package/dist/cjs/components/connect-chat/ConnectChat.cjs.map +1 -1
  25. package/dist/cjs/components/connect-chat/DefaultConnectChat.cjs +14 -23
  26. package/dist/cjs/components/connect-chat/DefaultConnectChat.cjs.map +1 -1
  27. package/dist/cjs/components/index.cjs +2 -0
  28. package/dist/cjs/components/index.cjs.map +1 -1
  29. package/dist/cjs/components/index.d.cts +6 -0
  30. package/dist/cjs/components/msteams-connect-button/DefaultMsTeamsConnectButton.cjs +17 -26
  31. package/dist/cjs/components/msteams-connect-button/DefaultMsTeamsConnectButton.cjs.map +1 -1
  32. package/dist/cjs/components/msteams-connect-button/MsTeamsConnectButton.cjs +2 -3
  33. package/dist/cjs/components/msteams-connect-button/MsTeamsConnectButton.cjs.map +1 -1
  34. package/dist/cjs/components/msteams-link-user/DefaultMsTeamsLinkUser.cjs +13 -22
  35. package/dist/cjs/components/msteams-link-user/DefaultMsTeamsLinkUser.cjs.map +1 -1
  36. package/dist/cjs/components/msteams-link-user/MsTeamsLinkUser.cjs +2 -3
  37. package/dist/cjs/components/msteams-link-user/MsTeamsLinkUser.cjs.map +1 -1
  38. package/dist/cjs/components/notification-item/ClockIcon.cjs +43 -0
  39. package/dist/cjs/components/notification-item/ClockIcon.cjs.map +1 -0
  40. package/dist/cjs/components/notification-item/ClockIcon.d.cts +7 -0
  41. package/dist/cjs/components/notification-item/Markdown.cjs +53 -0
  42. package/dist/cjs/components/notification-item/Markdown.cjs.map +1 -0
  43. package/dist/cjs/components/notification-item/Markdown.d.cts +12 -0
  44. package/dist/cjs/components/notification-item/NotificationItem.cjs +146 -0
  45. package/dist/cjs/components/notification-item/NotificationItem.cjs.map +1 -0
  46. package/dist/cjs/components/notification-item/NotificationItem.d.cts +40 -0
  47. package/dist/cjs/components/notification-item/context.cjs +49 -0
  48. package/dist/cjs/components/notification-item/context.cjs.map +1 -0
  49. package/dist/cjs/components/notification-item/context.d.cts +23 -0
  50. package/dist/cjs/components/notification-item/parts/Actions.cjs +56 -0
  51. package/dist/cjs/components/notification-item/parts/Actions.cjs.map +1 -0
  52. package/dist/cjs/components/notification-item/parts/Actions.d.cts +11 -0
  53. package/dist/cjs/components/notification-item/parts/Avatar.cjs +65 -0
  54. package/dist/cjs/components/notification-item/parts/Avatar.cjs.map +1 -0
  55. package/dist/cjs/components/notification-item/parts/Avatar.d.cts +8 -0
  56. package/dist/cjs/components/notification-item/parts/Content.cjs +66 -0
  57. package/dist/cjs/components/notification-item/parts/Content.cjs.map +1 -0
  58. package/dist/cjs/components/notification-item/parts/Content.d.cts +17 -0
  59. package/dist/cjs/components/notification-item/parts/Date.cjs +114 -0
  60. package/dist/cjs/components/notification-item/parts/Date.cjs.map +1 -0
  61. package/dist/cjs/components/notification-item/parts/Date.d.cts +11 -0
  62. package/dist/cjs/components/notification-item/parts/Dot.cjs +48 -0
  63. package/dist/cjs/components/notification-item/parts/Dot.cjs.map +1 -0
  64. package/dist/cjs/components/notification-item/parts/Dot.d.cts +9 -0
  65. package/dist/cjs/components/notification-item/parts/Subject.cjs +92 -0
  66. package/dist/cjs/components/notification-item/parts/Subject.cjs.map +1 -0
  67. package/dist/cjs/components/notification-item/parts/Subject.d.cts +15 -0
  68. package/dist/cjs/components/slack-connect-button/DefaultSlackConnectButton.cjs +18 -27
  69. package/dist/cjs/components/slack-connect-button/DefaultSlackConnectButton.cjs.map +1 -1
  70. package/dist/cjs/components/slack-connect-button/SlackConnectButton.cjs +2 -3
  71. package/dist/cjs/components/slack-connect-button/SlackConnectButton.cjs.map +1 -1
  72. package/dist/cjs/components/slack-link-user/DefaultSlackLinkUser.cjs +13 -22
  73. package/dist/cjs/components/slack-link-user/DefaultSlackLinkUser.cjs.map +1 -1
  74. package/dist/cjs/components/slack-link-user/SlackLinkUser.cjs +2 -3
  75. package/dist/cjs/components/slack-link-user/SlackLinkUser.cjs.map +1 -1
  76. package/dist/cjs/components/subscription/DefaultSubscription.cjs +14 -22
  77. package/dist/cjs/components/subscription/DefaultSubscription.cjs.map +1 -1
  78. package/dist/cjs/components/subscription/Subscription.cjs +2 -3
  79. package/dist/cjs/components/subscription/Subscription.cjs.map +1 -1
  80. package/dist/cjs/components/subscription/SubscriptionButton.cjs +9 -26
  81. package/dist/cjs/components/subscription/SubscriptionButton.cjs.map +1 -1
  82. package/dist/cjs/components/subscription/SubscriptionButton.d.cts +1 -1
  83. package/dist/cjs/components/subscription/SubscriptionPreferences.cjs +9 -26
  84. package/dist/cjs/components/subscription/SubscriptionPreferences.cjs.map +1 -1
  85. package/dist/cjs/components/subscription/SubscriptionPreferences.d.cts +1 -1
  86. package/dist/cjs/components/telegram-connect-button/DefaultTelegramConnectButton.cjs +14 -23
  87. package/dist/cjs/components/telegram-connect-button/DefaultTelegramConnectButton.cjs.map +1 -1
  88. package/dist/cjs/components/telegram-connect-button/TelegramConnectButton.cjs +2 -3
  89. package/dist/cjs/components/telegram-connect-button/TelegramConnectButton.cjs.map +1 -1
  90. package/dist/cjs/context/NovuUIContext.cjs +3 -0
  91. package/dist/cjs/context/NovuUIContext.cjs.map +1 -1
  92. package/dist/cjs/context/NovuUIContext.d.cts +8 -1
  93. package/dist/cjs/context/OutletStore.cjs +97 -0
  94. package/dist/cjs/context/OutletStore.cjs.map +1 -0
  95. package/dist/cjs/context/OutletStore.d.cts +31 -0
  96. package/dist/cjs/hooks/internal/useEngineAccessor.cjs +36 -0
  97. package/dist/cjs/hooks/internal/useEngineAccessor.cjs.map +1 -0
  98. package/dist/cjs/hooks/internal/useEngineAccessor.d.cts +4 -0
  99. package/dist/cjs/hooks/internal/useEngineStores.cjs +54 -0
  100. package/dist/cjs/hooks/internal/useEngineStores.cjs.map +1 -0
  101. package/dist/cjs/hooks/internal/useEngineStores.d.cts +13 -0
  102. package/dist/cjs/hooks/internal/useIsomorphicLayoutEffect.cjs +32 -0
  103. package/dist/cjs/hooks/internal/useIsomorphicLayoutEffect.cjs.map +1 -0
  104. package/dist/cjs/hooks/internal/useIsomorphicLayoutEffect.d.cts +5 -0
  105. package/dist/cjs/hooks/internal/useNotificationOutlets.cjs +57 -0
  106. package/dist/cjs/hooks/internal/useNotificationOutlets.cjs.map +1 -0
  107. package/dist/cjs/hooks/internal/useNotificationOutlets.d.cts +33 -0
  108. package/dist/cjs/hooks/internal/useOutletRenderer.cjs +53 -0
  109. package/dist/cjs/hooks/internal/useOutletRenderer.cjs.map +1 -0
  110. package/dist/cjs/hooks/internal/useOutletRenderer.d.cts +14 -0
  111. package/dist/cjs/index.cjs +2 -0
  112. package/dist/cjs/index.cjs.map +1 -1
  113. package/dist/cjs/index.d.cts +6 -0
  114. package/dist/cjs/server/index.cjs +14 -0
  115. package/dist/cjs/server/index.cjs.map +1 -1
  116. package/dist/cjs/server/index.d.cts +15 -1
  117. package/dist/cjs/utils/appearance.cjs +2 -2
  118. package/dist/cjs/utils/appearance.cjs.map +1 -1
  119. package/dist/cjs/utils/appearance.d.cts +2 -3
  120. package/dist/esm/components/Bell.d.ts +2 -3
  121. package/dist/esm/components/Bell.js +7 -22
  122. package/dist/esm/components/Bell.js.map +1 -1
  123. package/dist/esm/components/Inbox.js +100 -138
  124. package/dist/esm/components/Inbox.js.map +1 -1
  125. package/dist/esm/components/InboxContent.d.ts +2 -3
  126. package/dist/esm/components/InboxContent.js +10 -66
  127. package/dist/esm/components/InboxContent.js.map +1 -1
  128. package/dist/esm/components/Mounter.d.ts +12 -4
  129. package/dist/esm/components/Mounter.js +19 -14
  130. package/dist/esm/components/Mounter.js.map +1 -1
  131. package/dist/esm/components/Notifications.d.ts +2 -3
  132. package/dist/esm/components/Notifications.js +10 -60
  133. package/dist/esm/components/Notifications.js.map +1 -1
  134. package/dist/esm/components/NovuUI.d.ts +4 -0
  135. package/dist/esm/components/NovuUI.js +16 -6
  136. package/dist/esm/components/NovuUI.js.map +1 -1
  137. package/dist/esm/components/OutletHost.d.ts +14 -0
  138. package/dist/esm/components/OutletHost.js +15 -0
  139. package/dist/esm/components/OutletHost.js.map +1 -0
  140. package/dist/esm/components/Preferences.js +1 -10
  141. package/dist/esm/components/Preferences.js.map +1 -1
  142. package/dist/esm/components/connect-chat/ConnectChat.js +2 -3
  143. package/dist/esm/components/connect-chat/ConnectChat.js.map +1 -1
  144. package/dist/esm/components/connect-chat/DefaultConnectChat.js +15 -24
  145. package/dist/esm/components/connect-chat/DefaultConnectChat.js.map +1 -1
  146. package/dist/esm/components/index.d.ts +6 -0
  147. package/dist/esm/components/index.js +1 -0
  148. package/dist/esm/components/index.js.map +1 -1
  149. package/dist/esm/components/msteams-connect-button/DefaultMsTeamsConnectButton.js +18 -27
  150. package/dist/esm/components/msteams-connect-button/DefaultMsTeamsConnectButton.js.map +1 -1
  151. package/dist/esm/components/msteams-connect-button/MsTeamsConnectButton.js +2 -3
  152. package/dist/esm/components/msteams-connect-button/MsTeamsConnectButton.js.map +1 -1
  153. package/dist/esm/components/msteams-link-user/DefaultMsTeamsLinkUser.js +14 -23
  154. package/dist/esm/components/msteams-link-user/DefaultMsTeamsLinkUser.js.map +1 -1
  155. package/dist/esm/components/msteams-link-user/MsTeamsLinkUser.js +2 -3
  156. package/dist/esm/components/msteams-link-user/MsTeamsLinkUser.js.map +1 -1
  157. package/dist/esm/components/notification-item/ClockIcon.d.ts +7 -0
  158. package/dist/esm/components/notification-item/ClockIcon.js +18 -0
  159. package/dist/esm/components/notification-item/ClockIcon.js.map +1 -0
  160. package/dist/esm/components/notification-item/Markdown.d.ts +12 -0
  161. package/dist/esm/components/notification-item/Markdown.js +28 -0
  162. package/dist/esm/components/notification-item/Markdown.js.map +1 -0
  163. package/dist/esm/components/notification-item/NotificationItem.d.ts +40 -0
  164. package/dist/esm/components/notification-item/NotificationItem.js +131 -0
  165. package/dist/esm/components/notification-item/NotificationItem.js.map +1 -0
  166. package/dist/esm/components/notification-item/context.d.ts +23 -0
  167. package/dist/esm/components/notification-item/context.js +21 -0
  168. package/dist/esm/components/notification-item/context.js.map +1 -0
  169. package/dist/esm/components/notification-item/parts/Actions.d.ts +11 -0
  170. package/dist/esm/components/notification-item/parts/Actions.js +30 -0
  171. package/dist/esm/components/notification-item/parts/Actions.js.map +1 -0
  172. package/dist/esm/components/notification-item/parts/Avatar.d.ts +8 -0
  173. package/dist/esm/components/notification-item/parts/Avatar.js +40 -0
  174. package/dist/esm/components/notification-item/parts/Avatar.js.map +1 -0
  175. package/dist/esm/components/notification-item/parts/Content.d.ts +17 -0
  176. package/dist/esm/components/notification-item/parts/Content.js +40 -0
  177. package/dist/esm/components/notification-item/parts/Content.js.map +1 -0
  178. package/dist/esm/components/notification-item/parts/Date.d.ts +11 -0
  179. package/dist/esm/components/notification-item/parts/Date.js +89 -0
  180. package/dist/esm/components/notification-item/parts/Date.js.map +1 -0
  181. package/dist/esm/components/notification-item/parts/Dot.d.ts +9 -0
  182. package/dist/esm/components/notification-item/parts/Dot.js +23 -0
  183. package/dist/esm/components/notification-item/parts/Dot.js.map +1 -0
  184. package/dist/esm/components/notification-item/parts/Subject.d.ts +15 -0
  185. package/dist/esm/components/notification-item/parts/Subject.js +66 -0
  186. package/dist/esm/components/notification-item/parts/Subject.js.map +1 -0
  187. package/dist/esm/components/slack-connect-button/DefaultSlackConnectButton.js +19 -28
  188. package/dist/esm/components/slack-connect-button/DefaultSlackConnectButton.js.map +1 -1
  189. package/dist/esm/components/slack-connect-button/SlackConnectButton.js +2 -3
  190. package/dist/esm/components/slack-connect-button/SlackConnectButton.js.map +1 -1
  191. package/dist/esm/components/slack-link-user/DefaultSlackLinkUser.js +14 -23
  192. package/dist/esm/components/slack-link-user/DefaultSlackLinkUser.js.map +1 -1
  193. package/dist/esm/components/slack-link-user/SlackLinkUser.js +2 -3
  194. package/dist/esm/components/slack-link-user/SlackLinkUser.js.map +1 -1
  195. package/dist/esm/components/subscription/DefaultSubscription.js +15 -23
  196. package/dist/esm/components/subscription/DefaultSubscription.js.map +1 -1
  197. package/dist/esm/components/subscription/Subscription.js +2 -3
  198. package/dist/esm/components/subscription/Subscription.js.map +1 -1
  199. package/dist/esm/components/subscription/SubscriptionButton.d.ts +1 -1
  200. package/dist/esm/components/subscription/SubscriptionButton.js +10 -27
  201. package/dist/esm/components/subscription/SubscriptionButton.js.map +1 -1
  202. package/dist/esm/components/subscription/SubscriptionPreferences.d.ts +1 -1
  203. package/dist/esm/components/subscription/SubscriptionPreferences.js +10 -27
  204. package/dist/esm/components/subscription/SubscriptionPreferences.js.map +1 -1
  205. package/dist/esm/components/telegram-connect-button/DefaultTelegramConnectButton.js +15 -24
  206. package/dist/esm/components/telegram-connect-button/DefaultTelegramConnectButton.js.map +1 -1
  207. package/dist/esm/components/telegram-connect-button/TelegramConnectButton.js +2 -3
  208. package/dist/esm/components/telegram-connect-button/TelegramConnectButton.js.map +1 -1
  209. package/dist/esm/context/NovuUIContext.d.ts +8 -1
  210. package/dist/esm/context/NovuUIContext.js +2 -0
  211. package/dist/esm/context/NovuUIContext.js.map +1 -1
  212. package/dist/esm/context/OutletStore.d.ts +31 -0
  213. package/dist/esm/context/OutletStore.js +61 -0
  214. package/dist/esm/context/OutletStore.js.map +1 -0
  215. package/dist/esm/hooks/internal/useEngineAccessor.d.ts +4 -0
  216. package/dist/esm/hooks/internal/useEngineAccessor.js +11 -0
  217. package/dist/esm/hooks/internal/useEngineAccessor.js.map +1 -0
  218. package/dist/esm/hooks/internal/useEngineStores.d.ts +13 -0
  219. package/dist/esm/hooks/internal/useEngineStores.js +27 -0
  220. package/dist/esm/hooks/internal/useEngineStores.js.map +1 -0
  221. package/dist/esm/hooks/internal/useIsomorphicLayoutEffect.d.ts +5 -0
  222. package/dist/esm/hooks/internal/useIsomorphicLayoutEffect.js +7 -0
  223. package/dist/esm/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -0
  224. package/dist/esm/hooks/internal/useNotificationOutlets.d.ts +33 -0
  225. package/dist/esm/hooks/internal/useNotificationOutlets.js +32 -0
  226. package/dist/esm/hooks/internal/useNotificationOutlets.js.map +1 -0
  227. package/dist/esm/hooks/internal/useOutletRenderer.d.ts +14 -0
  228. package/dist/esm/hooks/internal/useOutletRenderer.js +25 -0
  229. package/dist/esm/hooks/internal/useOutletRenderer.js.map +1 -0
  230. package/dist/esm/index.d.ts +6 -0
  231. package/dist/esm/index.js +5 -3
  232. package/dist/esm/index.js.map +1 -1
  233. package/dist/esm/server/index.d.ts +15 -1
  234. package/dist/esm/server/index.js +14 -1
  235. package/dist/esm/server/index.js.map +1 -1
  236. package/dist/esm/utils/appearance.d.ts +2 -3
  237. package/dist/esm/utils/appearance.js +2 -2
  238. package/dist/esm/utils/appearance.js.map +1 -1
  239. package/package.json +11 -5
  240. package/dist/cjs/components/Renderer.cjs +0 -70
  241. package/dist/cjs/components/Renderer.cjs.map +0 -1
  242. package/dist/cjs/components/Renderer.d.cts +0 -8
  243. package/dist/cjs/context/RendererContext.cjs.map +0 -1
  244. package/dist/cjs/context/RendererContext.d.cts +0 -15
  245. package/dist/esm/components/Renderer.d.ts +0 -8
  246. package/dist/esm/components/Renderer.js +0 -44
  247. package/dist/esm/components/Renderer.js.map +0 -1
  248. package/dist/esm/context/RendererContext.d.ts +0 -15
  249. package/dist/esm/context/RendererContext.js +0 -13
  250. package/dist/esm/context/RendererContext.js.map +0 -1
@@ -1,6 +1,5 @@
1
1
  // src/components/msteams-link-user/DefaultMsTeamsLinkUser.tsx
2
- import { useCallback } from "react";
3
- import { useNovuUI } from "../../context/NovuUIContext.js";
2
+ import { useMemo } from "react";
4
3
  import { Mounter } from "../Mounter.js";
5
4
  import { jsx } from "react/jsx-runtime";
6
5
  var DefaultMsTeamsLinkUser = (props) => {
@@ -15,27 +14,19 @@ var DefaultMsTeamsLinkUser = (props) => {
15
14
  linkLabel,
16
15
  unlinkLabel
17
16
  } = props;
18
- const { novuUI } = useNovuUI();
19
- const mount = useCallback(
20
- (element) => {
21
- return novuUI.mountComponent({
22
- name: "MsTeamsLinkUser",
23
- props: {
24
- integrationIdentifier,
25
- connectionIdentifier,
26
- context,
27
- onLinkSuccess,
28
- onLinkError,
29
- onUnlinkSuccess,
30
- onUnlinkError,
31
- linkLabel,
32
- unlinkLabel
33
- },
34
- element
35
- });
36
- },
17
+ const mountProps = useMemo(
18
+ () => ({
19
+ integrationIdentifier,
20
+ connectionIdentifier,
21
+ context,
22
+ onLinkSuccess,
23
+ onLinkError,
24
+ onUnlinkSuccess,
25
+ onUnlinkError,
26
+ linkLabel,
27
+ unlinkLabel
28
+ }),
37
29
  [
38
- novuUI,
39
30
  integrationIdentifier,
40
31
  connectionIdentifier,
41
32
  context,
@@ -47,7 +38,7 @@ var DefaultMsTeamsLinkUser = (props) => {
47
38
  unlinkLabel
48
39
  ]
49
40
  );
50
- return /* @__PURE__ */ jsx(Mounter, { mount });
41
+ return /* @__PURE__ */ jsx(Mounter, { name: "MsTeamsLinkUser", props: mountProps });
51
42
  };
52
43
  export {
53
44
  DefaultMsTeamsLinkUser
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/msteams-link-user/DefaultMsTeamsLinkUser.tsx"],"sourcesContent":["import { MsTeamsLinkUserProps } from '@novu/js/ui';\nimport { useCallback } from 'react';\nimport { useNovuUI } from '../../context/NovuUIContext';\nimport { Mounter } from '../Mounter';\n\nexport type DefaultMsTeamsLinkUserProps = Pick<\n MsTeamsLinkUserProps,\n | 'integrationIdentifier'\n | 'connectionIdentifier'\n | 'context'\n | 'onLinkSuccess'\n | 'onLinkError'\n | 'onUnlinkSuccess'\n | 'onUnlinkError'\n | 'linkLabel'\n | 'unlinkLabel'\n>;\n\nexport const DefaultMsTeamsLinkUser = (props: DefaultMsTeamsLinkUserProps) => {\n const {\n integrationIdentifier,\n connectionIdentifier,\n context,\n onLinkSuccess,\n onLinkError,\n onUnlinkSuccess,\n onUnlinkError,\n linkLabel,\n unlinkLabel,\n } = props;\n const { novuUI } = useNovuUI();\n\n const mount = useCallback(\n (element: HTMLElement) => {\n return novuUI.mountComponent({\n name: 'MsTeamsLinkUser',\n props: {\n integrationIdentifier,\n connectionIdentifier,\n context,\n onLinkSuccess,\n onLinkError,\n onUnlinkSuccess,\n onUnlinkError,\n linkLabel,\n unlinkLabel,\n },\n element,\n });\n },\n [\n novuUI,\n integrationIdentifier,\n connectionIdentifier,\n context,\n onLinkSuccess,\n onLinkError,\n onUnlinkSuccess,\n onUnlinkError,\n linkLabel,\n unlinkLabel,\n ]\n );\n\n return <Mounter mount={mount} />;\n};\n"],"mappings":";AACA,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AA6Df;AA9CF,IAAM,yBAAyB,CAAC,UAAuC;AAC5E,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,OAAO,IAAI,UAAU;AAE7B,QAAM,QAAQ;AAAA,IACZ,CAAC,YAAyB;AACxB,aAAO,OAAO,eAAe;AAAA,QAC3B,MAAM;AAAA,QACN,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,oBAAC,WAAQ,OAAc;AAChC;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/msteams-link-user/DefaultMsTeamsLinkUser.tsx"],"sourcesContent":["import { MsTeamsLinkUserProps } from '@novu/js/ui';\nimport { useMemo } from 'react';\nimport { Mounter } from '../Mounter';\n\nexport type DefaultMsTeamsLinkUserProps = Pick<\n MsTeamsLinkUserProps,\n | 'integrationIdentifier'\n | 'connectionIdentifier'\n | 'context'\n | 'onLinkSuccess'\n | 'onLinkError'\n | 'onUnlinkSuccess'\n | 'onUnlinkError'\n | 'linkLabel'\n | 'unlinkLabel'\n>;\n\nexport const DefaultMsTeamsLinkUser = (props: DefaultMsTeamsLinkUserProps) => {\n const {\n integrationIdentifier,\n connectionIdentifier,\n context,\n onLinkSuccess,\n onLinkError,\n onUnlinkSuccess,\n onUnlinkError,\n linkLabel,\n unlinkLabel,\n } = props;\n\n const mountProps = useMemo(\n () => ({\n integrationIdentifier,\n connectionIdentifier,\n context,\n onLinkSuccess,\n onLinkError,\n onUnlinkSuccess,\n onUnlinkError,\n linkLabel,\n unlinkLabel,\n }),\n [\n integrationIdentifier,\n connectionIdentifier,\n context,\n onLinkSuccess,\n onLinkError,\n onUnlinkSuccess,\n onUnlinkError,\n linkLabel,\n unlinkLabel,\n ]\n );\n\n return <Mounter name=\"MsTeamsLinkUser\" props={mountProps} />;\n};\n"],"mappings":";AACA,SAAS,eAAe;AACxB,SAAS,eAAe;AAqDf;AAtCF,IAAM,yBAAyB,CAAC,UAAuC;AAC5E,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,aAAa;AAAA,IACjB,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,oBAAC,WAAQ,MAAK,mBAAkB,OAAO,YAAY;AAC5D;","names":[]}
@@ -2,10 +2,9 @@
2
2
  import React, { useMemo } from "react";
3
3
  import { useNovu } from "../../hooks/NovuProvider.js";
4
4
  import { NovuUI } from "../NovuUI.js";
5
- import { withRenderer } from "../Renderer.js";
6
5
  import { DefaultMsTeamsLinkUser } from "./DefaultMsTeamsLinkUser.js";
7
6
  import { jsx } from "react/jsx-runtime";
8
- var MsTeamsLinkUserInternal = withRenderer((props) => {
7
+ var MsTeamsLinkUserInternal = (props) => {
9
8
  const { container, appearance, ...defaultProps } = props;
10
9
  const novu = useNovu();
11
10
  const options = useMemo(() => {
@@ -16,7 +15,7 @@ var MsTeamsLinkUserInternal = withRenderer((props) => {
16
15
  };
17
16
  }, [container, appearance, novu.options]);
18
17
  return /* @__PURE__ */ jsx(NovuUI, { options, novu, children: /* @__PURE__ */ jsx(DefaultMsTeamsLinkUser, { ...defaultProps }) });
19
- });
18
+ };
20
19
  MsTeamsLinkUserInternal.displayName = "MsTeamsLinkUserInternal";
21
20
  var MsTeamsLinkUser = React.memo((props) => {
22
21
  return /* @__PURE__ */ jsx(MsTeamsLinkUserInternal, { ...props });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/msteams-link-user/MsTeamsLinkUser.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { useNovu } from '../../hooks/NovuProvider';\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\nimport { withRenderer } from '../Renderer';\nimport { DefaultMsTeamsLinkUser, DefaultMsTeamsLinkUserProps } from './DefaultMsTeamsLinkUser';\n\nexport type MsTeamsLinkUserProps = DefaultMsTeamsLinkUserProps & Pick<NovuUIOptions, 'container' | 'appearance'>;\n\nconst MsTeamsLinkUserInternal = withRenderer<MsTeamsLinkUserProps>((props) => {\n const { container, appearance, ...defaultProps } = props;\n const novu = useNovu();\n\n const options: NovuUIOptions = useMemo(() => {\n return {\n container,\n appearance,\n options: novu.options,\n };\n }, [container, appearance, novu.options]);\n\n return (\n <NovuUI options={options} novu={novu}>\n <DefaultMsTeamsLinkUser {...defaultProps} />\n </NovuUI>\n );\n});\n\nMsTeamsLinkUserInternal.displayName = 'MsTeamsLinkUserInternal';\n\nexport const MsTeamsLinkUser = React.memo((props: MsTeamsLinkUserProps) => {\n return <MsTeamsLinkUserInternal {...props} />;\n});\n\nMsTeamsLinkUser.displayName = 'MsTeamsLinkUser';\n"],"mappings":";AAAA,OAAO,SAAS,eAAe;AAC/B,SAAS,eAAe;AACxB,SAAS,cAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,8BAA2D;AAkB9D;AAdN,IAAM,0BAA0B,aAAmC,CAAC,UAAU;AAC5E,QAAM,EAAE,WAAW,YAAY,GAAG,aAAa,IAAI;AACnD,QAAM,OAAO,QAAQ;AAErB,QAAM,UAAyB,QAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,WAAW,YAAY,KAAK,OAAO,CAAC;AAExC,SACE,oBAAC,UAAO,SAAkB,MACxB,8BAAC,0BAAwB,GAAG,cAAc,GAC5C;AAEJ,CAAC;AAED,wBAAwB,cAAc;AAE/B,IAAM,kBAAkB,MAAM,KAAK,CAAC,UAAgC;AACzE,SAAO,oBAAC,2BAAyB,GAAG,OAAO;AAC7C,CAAC;AAED,gBAAgB,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/msteams-link-user/MsTeamsLinkUser.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { useNovu } from '../../hooks/NovuProvider';\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\nimport { DefaultMsTeamsLinkUser, DefaultMsTeamsLinkUserProps } from './DefaultMsTeamsLinkUser';\n\nexport type MsTeamsLinkUserProps = DefaultMsTeamsLinkUserProps & Pick<NovuUIOptions, 'container' | 'appearance'>;\n\nconst MsTeamsLinkUserInternal = (props: MsTeamsLinkUserProps) => {\n const { container, appearance, ...defaultProps } = props;\n const novu = useNovu();\n\n const options: NovuUIOptions = useMemo(() => {\n return {\n container,\n appearance,\n options: novu.options,\n };\n }, [container, appearance, novu.options]);\n\n return (\n <NovuUI options={options} novu={novu}>\n <DefaultMsTeamsLinkUser {...defaultProps} />\n </NovuUI>\n );\n};\n\nMsTeamsLinkUserInternal.displayName = 'MsTeamsLinkUserInternal';\n\nexport const MsTeamsLinkUser = React.memo((props: MsTeamsLinkUserProps) => {\n return <MsTeamsLinkUserInternal {...props} />;\n});\n\nMsTeamsLinkUser.displayName = 'MsTeamsLinkUser';\n"],"mappings":";AAAA,OAAO,SAAS,eAAe;AAC/B,SAAS,eAAe;AACxB,SAAS,cAA6B;AACtC,SAAS,8BAA2D;AAkB9D;AAdN,IAAM,0BAA0B,CAAC,UAAgC;AAC/D,QAAM,EAAE,WAAW,YAAY,GAAG,aAAa,IAAI;AACnD,QAAM,OAAO,QAAQ;AAErB,QAAM,UAAyB,QAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,WAAW,YAAY,KAAK,OAAO,CAAC;AAExC,SACE,oBAAC,UAAO,SAAkB,MACxB,8BAAC,0BAAwB,GAAG,cAAc,GAC5C;AAEJ;AAEA,wBAAwB,cAAc;AAE/B,IAAM,kBAAkB,MAAM,KAAK,CAAC,UAAgC;AACzE,SAAO,oBAAC,2BAAyB,GAAG,OAAO;AAC7C,CAAC;AAED,gBAAgB,cAAc;","names":[]}
@@ -0,0 +1,7 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React__default from 'react';
3
+
4
+ /** The engine's clock icon, used when the host has no `appearance.icons.clock` override. */
5
+ declare const ClockIcon: (props: React__default.SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
6
+
7
+ export { ClockIcon };
@@ -0,0 +1,18 @@
1
+ // src/components/notification-item/ClockIcon.tsx
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ var ClockIcon = (props) => /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
4
+ /* @__PURE__ */ jsx("title", { children: "clock" }),
5
+ /* @__PURE__ */ jsx("g", { clipPath: "url(#clip0_3188_15050)", children: /* @__PURE__ */ jsx(
6
+ "path",
7
+ {
8
+ d: "M6 3V6L8 7M11 6C11 8.76142 8.76142 11 6 11C3.23858 11 1 8.76142 1 6C1 3.23858 3.23858 1 6 1C8.76142 1 11 3.23858 11 6Z",
9
+ stroke: "currentColor",
10
+ strokeLinecap: "round",
11
+ strokeLinejoin: "round"
12
+ }
13
+ ) })
14
+ ] });
15
+ export {
16
+ ClockIcon
17
+ };
18
+ //# sourceMappingURL=ClockIcon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/notification-item/ClockIcon.tsx"],"sourcesContent":["import React from 'react';\n\n/** The engine's clock icon, used when the host has no `appearance.icons.clock` override. */\nexport const ClockIcon = (props: React.SVGProps<SVGSVGElement>) => (\n <svg viewBox=\"0 0 12 12\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n <title>clock</title>\n <g clipPath=\"url(#clip0_3188_15050)\">\n <path\n d=\"M6 3V6L8 7M11 6C11 8.76142 8.76142 11 6 11C3.23858 11 1 8.76142 1 6C1 3.23858 3.23858 1 6 1C8.76142 1 11 3.23858 11 6Z\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </g>\n </svg>\n);\n"],"mappings":";AAIE,SACE,KADF;AADK,IAAM,YAAY,CAAC,UACxB,qBAAC,SAAI,SAAQ,aAAY,MAAK,QAAO,OAAM,8BAA8B,GAAG,OAC1E;AAAA,sBAAC,WAAM,mBAAK;AAAA,EACZ,oBAAC,OAAE,UAAS,0BACV;AAAA,IAAC;AAAA;AAAA,MACC,GAAE;AAAA,MACF,QAAO;AAAA,MACP,eAAc;AAAA,MACd,gBAAe;AAAA;AAAA,EACjB,GACF;AAAA,GACF;","names":[]}
@@ -0,0 +1,12 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ type MarkdownProps = {
4
+ children: string;
5
+ strongKey: string;
6
+ emKey: string;
7
+ context: Record<string, unknown>;
8
+ };
9
+ /** Renders the same inline markdown as the engine: `**strong**`, `*em*`, and both nested. */
10
+ declare const Markdown: ({ children, strongKey, emKey, context }: MarkdownProps) => react_jsx_runtime.JSX.Element;
11
+
12
+ export { Markdown };
@@ -0,0 +1,28 @@
1
+ // src/components/notification-item/Markdown.tsx
2
+ import { markdownStyles, parseMarkdownIntoTokens } from "@novu/js/ui-core";
3
+ import { Fragment, useMemo } from "react";
4
+ import { useStyle } from "../../hooks/internal/useEngineStores.js";
5
+ import { Fragment as Fragment2, jsx } from "react/jsx-runtime";
6
+ var Markdown = ({ children, strongKey, emKey, context }) => {
7
+ const style = useStyle();
8
+ const tokens = useMemo(() => parseMarkdownIntoTokens(children), [children]);
9
+ const strongClassName = style({ key: strongKey, className: markdownStyles.strong.className, context });
10
+ const emClassName = style({ key: emKey, className: markdownStyles.em.className, context });
11
+ return /* @__PURE__ */ jsx(Fragment2, { children: tokens.map((token, index) => {
12
+ const key = `${index}-${token.type}`;
13
+ if (token.type === "boldItalic") {
14
+ return /* @__PURE__ */ jsx("strong", { className: strongClassName, children: /* @__PURE__ */ jsx("em", { className: emClassName, children: token.content }) }, key);
15
+ }
16
+ if (token.type === "bold") {
17
+ return /* @__PURE__ */ jsx("strong", { className: strongClassName, children: token.content }, key);
18
+ }
19
+ if (token.type === "italic") {
20
+ return /* @__PURE__ */ jsx("em", { className: emClassName, children: token.content }, key);
21
+ }
22
+ return /* @__PURE__ */ jsx(Fragment, { children: token.content }, key);
23
+ }) });
24
+ };
25
+ export {
26
+ Markdown
27
+ };
28
+ //# sourceMappingURL=Markdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/notification-item/Markdown.tsx"],"sourcesContent":["import { markdownStyles, parseMarkdownIntoTokens } from '@novu/js/ui-core';\nimport React, { Fragment, useMemo } from 'react';\nimport { useStyle } from '../../hooks/internal/useEngineStores';\n\ntype MarkdownProps = {\n children: string;\n strongKey: string;\n emKey: string;\n context: Record<string, unknown>;\n};\n\n/** Renders the same inline markdown as the engine: `**strong**`, `*em*`, and both nested. */\nexport const Markdown = ({ children, strongKey, emKey, context }: MarkdownProps) => {\n const style = useStyle();\n const tokens = useMemo(() => parseMarkdownIntoTokens(children), [children]);\n const strongClassName = style({ key: strongKey as never, className: markdownStyles.strong.className, context });\n const emClassName = style({ key: emKey as never, className: markdownStyles.em.className, context });\n\n return (\n <>\n {tokens.map((token, index) => {\n const key = `${index}-${token.type}`;\n if (token.type === 'boldItalic') {\n return (\n <strong key={key} className={strongClassName}>\n <em className={emClassName}>{token.content}</em>\n </strong>\n );\n }\n if (token.type === 'bold') {\n return (\n <strong key={key} className={strongClassName}>\n {token.content}\n </strong>\n );\n }\n if (token.type === 'italic') {\n return (\n <em key={key} className={emClassName}>\n {token.content}\n </em>\n );\n }\n\n return <Fragment key={key}>{token.content}</Fragment>;\n })}\n </>\n );\n};\n"],"mappings":";AAAA,SAAS,gBAAgB,+BAA+B;AACxD,SAAgB,UAAU,eAAe;AACzC,SAAS,gBAAgB;AAiBrB,qBAAAA,WAMU,WANV;AAPG,IAAM,WAAW,CAAC,EAAE,UAAU,WAAW,OAAO,QAAQ,MAAqB;AAClF,QAAM,QAAQ,SAAS;AACvB,QAAM,SAAS,QAAQ,MAAM,wBAAwB,QAAQ,GAAG,CAAC,QAAQ,CAAC;AAC1E,QAAM,kBAAkB,MAAM,EAAE,KAAK,WAAoB,WAAW,eAAe,OAAO,WAAW,QAAQ,CAAC;AAC9G,QAAM,cAAc,MAAM,EAAE,KAAK,OAAgB,WAAW,eAAe,GAAG,WAAW,QAAQ,CAAC;AAElG,SACE,oBAAAA,WAAA,EACG,iBAAO,IAAI,CAAC,OAAO,UAAU;AAC5B,UAAM,MAAM,GAAG,KAAK,IAAI,MAAM,IAAI;AAClC,QAAI,MAAM,SAAS,cAAc;AAC/B,aACE,oBAAC,YAAiB,WAAW,iBAC3B,8BAAC,QAAG,WAAW,aAAc,gBAAM,SAAQ,KADhC,GAEb;AAAA,IAEJ;AACA,QAAI,MAAM,SAAS,QAAQ;AACzB,aACE,oBAAC,YAAiB,WAAW,iBAC1B,gBAAM,WADI,GAEb;AAAA,IAEJ;AACA,QAAI,MAAM,SAAS,UAAU;AAC3B,aACE,oBAAC,QAAa,WAAW,aACtB,gBAAM,WADA,GAET;AAAA,IAEJ;AAEA,WAAO,oBAAC,YAAoB,gBAAM,WAAZ,GAAoB;AAAA,EAC5C,CAAC,GACH;AAEJ;","names":["Fragment"]}
@@ -0,0 +1,40 @@
1
+ import { NotificationItemDotProps } from './parts/Dot.js';
2
+ import { NotificationItemDateProps } from './parts/Date.js';
3
+ import { NotificationItemSubjectProps, NotificationItemBodyProps } from './parts/Subject.js';
4
+ import { NotificationItemContentProps, NotificationItemTextProps } from './parts/Content.js';
5
+ import { NotificationItemAvatarProps } from './parts/Avatar.js';
6
+ import * as react_jsx_runtime from 'react/jsx-runtime';
7
+ import { Notification } from '@novu/js';
8
+ import { NotificationClickHandler, NotificationActionClickHandler } from '@novu/js/ui';
9
+ import { ReactNode } from 'react';
10
+
11
+ type NotificationItemProps = {
12
+ notification: Notification;
13
+ /** Your own arrangement of the parts. Without it, the built-in arrangement is rendered. */
14
+ children?: ReactNode;
15
+ className?: string;
16
+ onNotificationClick?: NotificationClickHandler;
17
+ onPrimaryActionClick?: NotificationActionClickHandler;
18
+ onSecondaryActionClick?: NotificationActionClickHandler;
19
+ renderAvatar?: (notification: Notification) => ReactNode;
20
+ renderSubject?: (notification: Notification) => ReactNode;
21
+ renderBody?: (notification: Notification) => ReactNode;
22
+ renderDefaultActions?: (notification: Notification) => ReactNode;
23
+ renderCustomActions?: (notification: Notification) => ReactNode;
24
+ };
25
+ declare const NotificationItem: {
26
+ (props: NotificationItemProps): react_jsx_runtime.JSX.Element;
27
+ displayName: string;
28
+ } & {
29
+ Avatar: ({ className }: NotificationItemAvatarProps) => react_jsx_runtime.JSX.Element;
30
+ Content: ({ className, children }: NotificationItemContentProps) => react_jsx_runtime.JSX.Element;
31
+ Text: ({ className, children }: NotificationItemTextProps) => react_jsx_runtime.JSX.Element;
32
+ Subject: ({ className, children }: NotificationItemSubjectProps) => react_jsx_runtime.JSX.Element | null;
33
+ Body: ({ className, children }: NotificationItemBodyProps) => react_jsx_runtime.JSX.Element;
34
+ DefaultActions: () => react_jsx_runtime.JSX.Element;
35
+ CustomActions: () => react_jsx_runtime.JSX.Element;
36
+ Date: ({ className, children }: NotificationItemDateProps) => react_jsx_runtime.JSX.Element;
37
+ Dot: ({ className }: NotificationItemDotProps) => react_jsx_runtime.JSX.Element;
38
+ };
39
+
40
+ export { NotificationItem, type NotificationItemProps };
@@ -0,0 +1,131 @@
1
+ // src/components/notification-item/NotificationItem.tsx
2
+ import { SeverityLevelEnum } from "@novu/js";
3
+ import {
4
+ cn,
5
+ createNotificationItemController,
6
+ isInsideIsland,
7
+ notificationItemStyles,
8
+ SEVERITY_TO_BAR_KEYS,
9
+ SEVERITY_TO_NOTIFICATION_KEYS
10
+ } from "@novu/js/ui-core";
11
+ import { useMemo, useRef } from "react";
12
+ import { useEngineStores, useStyle } from "../../hooks/internal/useEngineStores.js";
13
+ import {
14
+ NotificationItemProvider,
15
+ useInheritedNotificationHandlers
16
+ } from "./context.js";
17
+ import { CustomActions, DefaultActions } from "./parts/Actions.js";
18
+ import { Avatar } from "./parts/Avatar.js";
19
+ import { Content, Text } from "./parts/Content.js";
20
+ import { Date } from "./parts/Date.js";
21
+ import { Dot } from "./parts/Dot.js";
22
+ import { Body, Subject } from "./parts/Subject.js";
23
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
24
+ var DefaultArrangement = () => /* @__PURE__ */ jsxs(Fragment, { children: [
25
+ /* @__PURE__ */ jsx(Avatar, {}),
26
+ /* @__PURE__ */ jsxs(Content, { children: [
27
+ /* @__PURE__ */ jsxs(Text, { children: [
28
+ /* @__PURE__ */ jsx(Subject, {}),
29
+ /* @__PURE__ */ jsx(Body, {})
30
+ ] }),
31
+ /* @__PURE__ */ jsx(DefaultActions, {}),
32
+ /* @__PURE__ */ jsx(CustomActions, {}),
33
+ /* @__PURE__ */ jsx(Date, {})
34
+ ] }),
35
+ /* @__PURE__ */ jsx(Dot, {})
36
+ ] });
37
+ var NotificationItemRoot = (props) => {
38
+ const {
39
+ notification,
40
+ children,
41
+ className,
42
+ onNotificationClick,
43
+ onPrimaryActionClick,
44
+ onSecondaryActionClick,
45
+ renderAvatar,
46
+ renderSubject,
47
+ renderBody,
48
+ renderDefaultActions,
49
+ renderCustomActions
50
+ } = props;
51
+ const style = useStyle();
52
+ const { inbox } = useEngineStores();
53
+ const inherited = useInheritedNotificationHandlers();
54
+ const handlers = useMemo(
55
+ () => ({
56
+ onNotificationClick: onNotificationClick ?? inherited.onNotificationClick,
57
+ onPrimaryActionClick: onPrimaryActionClick ?? inherited.onPrimaryActionClick,
58
+ onSecondaryActionClick: onSecondaryActionClick ?? inherited.onSecondaryActionClick
59
+ }),
60
+ [onNotificationClick, onPrimaryActionClick, onSecondaryActionClick, inherited]
61
+ );
62
+ const latest = useRef({ notification, handlers });
63
+ latest.current = { notification, handlers };
64
+ const controller = useMemo(
65
+ () => createNotificationItemController({
66
+ notification: () => latest.current.notification,
67
+ handlers: () => latest.current.handlers,
68
+ navigate: inbox.navigate
69
+ }),
70
+ [inbox]
71
+ );
72
+ const contextValue = useMemo(
73
+ () => ({
74
+ notification,
75
+ handlers,
76
+ renderers: { renderAvatar, renderSubject, renderBody, renderDefaultActions, renderCustomActions }
77
+ }),
78
+ [notification, handlers, renderAvatar, renderSubject, renderBody, renderDefaultActions, renderCustomActions]
79
+ );
80
+ const severity = notification.severity ?? SeverityLevelEnum.NONE;
81
+ return /* @__PURE__ */ jsx(NotificationItemProvider, { value: contextValue, children: /* @__PURE__ */ jsxs(
82
+ "a",
83
+ {
84
+ className: style({
85
+ key: SEVERITY_TO_NOTIFICATION_KEYS[severity],
86
+ className: cn(
87
+ notificationItemStyles.root.className,
88
+ notificationItemStyles.root.severity[severity],
89
+ { [notificationItemStyles.root.clickable]: controller.isClickable() },
90
+ className
91
+ ),
92
+ context: { notification }
93
+ }),
94
+ onClick: (event) => {
95
+ if (!isInsideIsland(event.target)) {
96
+ event.stopPropagation();
97
+ }
98
+ void controller.handleClick(event.nativeEvent);
99
+ },
100
+ children: [
101
+ /* @__PURE__ */ jsx(
102
+ "div",
103
+ {
104
+ className: style({
105
+ key: SEVERITY_TO_BAR_KEYS[severity],
106
+ className: cn(notificationItemStyles.bar.className, notificationItemStyles.bar.severity[severity]),
107
+ context: { notification }
108
+ })
109
+ }
110
+ ),
111
+ children ?? /* @__PURE__ */ jsx(DefaultArrangement, {})
112
+ ]
113
+ }
114
+ ) });
115
+ };
116
+ NotificationItemRoot.displayName = "NotificationItem";
117
+ var NotificationItem = Object.assign(NotificationItemRoot, {
118
+ Avatar,
119
+ Content,
120
+ Text,
121
+ Subject,
122
+ Body,
123
+ DefaultActions,
124
+ CustomActions,
125
+ Date,
126
+ Dot
127
+ });
128
+ export {
129
+ NotificationItem
130
+ };
131
+ //# sourceMappingURL=NotificationItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/notification-item/NotificationItem.tsx"],"sourcesContent":["import type { Notification } from '@novu/js';\nimport { SeverityLevelEnum } from '@novu/js';\nimport type { NotificationActionClickHandler, NotificationClickHandler } from '@novu/js/ui';\nimport {\n cn,\n createNotificationItemController,\n isInsideIsland,\n notificationItemStyles,\n SEVERITY_TO_BAR_KEYS,\n SEVERITY_TO_NOTIFICATION_KEYS,\n} from '@novu/js/ui-core';\nimport React, { type ReactNode, useMemo, useRef } from 'react';\nimport { useEngineStores, useStyle } from '../../hooks/internal/useEngineStores';\nimport {\n type NotificationItemContextValue,\n NotificationItemProvider,\n useInheritedNotificationHandlers,\n} from './context';\nimport { CustomActions, DefaultActions } from './parts/Actions';\nimport { Avatar } from './parts/Avatar';\nimport { Content, Text } from './parts/Content';\nimport { Date } from './parts/Date';\nimport { Dot } from './parts/Dot';\nimport { Body, Subject } from './parts/Subject';\n\nexport type NotificationItemProps = {\n notification: Notification;\n /** Your own arrangement of the parts. Without it, the built-in arrangement is rendered. */\n children?: ReactNode;\n className?: string;\n onNotificationClick?: NotificationClickHandler;\n onPrimaryActionClick?: NotificationActionClickHandler;\n onSecondaryActionClick?: NotificationActionClickHandler;\n renderAvatar?: (notification: Notification) => ReactNode;\n renderSubject?: (notification: Notification) => ReactNode;\n renderBody?: (notification: Notification) => ReactNode;\n renderDefaultActions?: (notification: Notification) => ReactNode;\n renderCustomActions?: (notification: Notification) => ReactNode;\n};\n\nconst DefaultArrangement = () => (\n <>\n <Avatar />\n <Content>\n <Text>\n <Subject />\n <Body />\n </Text>\n <DefaultActions />\n <CustomActions />\n <Date />\n </Content>\n <Dot />\n </>\n);\n\n/**\n * The built-in notification item, rendered natively in React.\n *\n * `<NotificationItem notification={n} />` is the default look. Pass children to arrange the parts yourself:\n * `NotificationItem.Avatar`, `Content`, `Text`, `Subject`, `Body`, `DefaultActions`, `CustomActions`, `Date`\n * and `Dot`. The root carries the item's behaviour in both modes: severity styling, the hover group, and the\n * click that marks the notification read and follows its redirect. Handlers fall back to the ones given to\n * `Inbox`, `Notifications` or `InboxContent`.\n */\nconst NotificationItemRoot = (props: NotificationItemProps) => {\n const {\n notification,\n children,\n className,\n onNotificationClick,\n onPrimaryActionClick,\n onSecondaryActionClick,\n renderAvatar,\n renderSubject,\n renderBody,\n renderDefaultActions,\n renderCustomActions,\n } = props;\n const style = useStyle();\n const { inbox } = useEngineStores();\n const inherited = useInheritedNotificationHandlers();\n\n const handlers = useMemo(\n () => ({\n onNotificationClick: onNotificationClick ?? inherited.onNotificationClick,\n onPrimaryActionClick: onPrimaryActionClick ?? inherited.onPrimaryActionClick,\n onSecondaryActionClick: onSecondaryActionClick ?? inherited.onSecondaryActionClick,\n }),\n [onNotificationClick, onPrimaryActionClick, onSecondaryActionClick, inherited]\n );\n\n const latest = useRef({ notification, handlers });\n latest.current = { notification, handlers };\n const controller = useMemo(\n () =>\n createNotificationItemController({\n notification: () => latest.current.notification,\n handlers: () => latest.current.handlers,\n navigate: inbox.navigate,\n }),\n [inbox]\n );\n\n const contextValue = useMemo<NotificationItemContextValue>(\n () => ({\n notification,\n handlers,\n renderers: { renderAvatar, renderSubject, renderBody, renderDefaultActions, renderCustomActions },\n }),\n [notification, handlers, renderAvatar, renderSubject, renderBody, renderDefaultActions, renderCustomActions]\n );\n\n const severity = notification.severity ?? SeverityLevelEnum.NONE;\n\n return (\n <NotificationItemProvider value={contextValue}>\n <a\n className={style({\n key: SEVERITY_TO_NOTIFICATION_KEYS[severity],\n className: cn(\n notificationItemStyles.root.className,\n notificationItemStyles.root.severity[severity],\n { [notificationItemStyles.root.clickable]: controller.isClickable() },\n className\n ),\n context: { notification },\n })}\n onClick={(event) => {\n if (!isInsideIsland(event.target)) {\n event.stopPropagation();\n }\n void controller.handleClick(event.nativeEvent);\n }}\n >\n <div\n className={style({\n key: SEVERITY_TO_BAR_KEYS[severity],\n className: cn(notificationItemStyles.bar.className, notificationItemStyles.bar.severity[severity]),\n context: { notification },\n })}\n />\n {children ?? <DefaultArrangement />}\n </a>\n </NotificationItemProvider>\n );\n};\n\nNotificationItemRoot.displayName = 'NotificationItem';\n\nexport const NotificationItem = Object.assign(NotificationItemRoot, {\n Avatar,\n Content,\n Text,\n Subject,\n Body,\n DefaultActions,\n CustomActions,\n Date,\n Dot,\n});\n"],"mappings":";AACA,SAAS,yBAAyB;AAElC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAgC,SAAS,cAAc;AACvD,SAAS,iBAAiB,gBAAgB;AAC1C;AAAA,EAEE;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe,sBAAsB;AAC9C,SAAS,cAAc;AACvB,SAAS,SAAS,YAAY;AAC9B,SAAS,YAAY;AACrB,SAAS,WAAW;AACpB,SAAS,MAAM,eAAe;AAkB5B,mBACE,KAEE,YAHJ;AADF,IAAM,qBAAqB,MACzB,iCACE;AAAA,sBAAC,UAAO;AAAA,EACR,qBAAC,WACC;AAAA,yBAAC,QACC;AAAA,0BAAC,WAAQ;AAAA,MACT,oBAAC,QAAK;AAAA,OACR;AAAA,IACA,oBAAC,kBAAe;AAAA,IAChB,oBAAC,iBAAc;AAAA,IACf,oBAAC,QAAK;AAAA,KACR;AAAA,EACA,oBAAC,OAAI;AAAA,GACP;AAYF,IAAM,uBAAuB,CAAC,UAAiC;AAC7D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,QAAQ,SAAS;AACvB,QAAM,EAAE,MAAM,IAAI,gBAAgB;AAClC,QAAM,YAAY,iCAAiC;AAEnD,QAAM,WAAW;AAAA,IACf,OAAO;AAAA,MACL,qBAAqB,uBAAuB,UAAU;AAAA,MACtD,sBAAsB,wBAAwB,UAAU;AAAA,MACxD,wBAAwB,0BAA0B,UAAU;AAAA,IAC9D;AAAA,IACA,CAAC,qBAAqB,sBAAsB,wBAAwB,SAAS;AAAA,EAC/E;AAEA,QAAM,SAAS,OAAO,EAAE,cAAc,SAAS,CAAC;AAChD,SAAO,UAAU,EAAE,cAAc,SAAS;AAC1C,QAAM,aAAa;AAAA,IACjB,MACE,iCAAiC;AAAA,MAC/B,cAAc,MAAM,OAAO,QAAQ;AAAA,MACnC,UAAU,MAAM,OAAO,QAAQ;AAAA,MAC/B,UAAU,MAAM;AAAA,IAClB,CAAC;AAAA,IACH,CAAC,KAAK;AAAA,EACR;AAEA,QAAM,eAAe;AAAA,IACnB,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,WAAW,EAAE,cAAc,eAAe,YAAY,sBAAsB,oBAAoB;AAAA,IAClG;AAAA,IACA,CAAC,cAAc,UAAU,cAAc,eAAe,YAAY,sBAAsB,mBAAmB;AAAA,EAC7G;AAEA,QAAM,WAAW,aAAa,YAAY,kBAAkB;AAE5D,SACE,oBAAC,4BAAyB,OAAO,cAC/B;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,MAAM;AAAA,QACf,KAAK,8BAA8B,QAAQ;AAAA,QAC3C,WAAW;AAAA,UACT,uBAAuB,KAAK;AAAA,UAC5B,uBAAuB,KAAK,SAAS,QAAQ;AAAA,UAC7C,EAAE,CAAC,uBAAuB,KAAK,SAAS,GAAG,WAAW,YAAY,EAAE;AAAA,UACpE;AAAA,QACF;AAAA,QACA,SAAS,EAAE,aAAa;AAAA,MAC1B,CAAC;AAAA,MACD,SAAS,CAAC,UAAU;AAClB,YAAI,CAAC,eAAe,MAAM,MAAM,GAAG;AACjC,gBAAM,gBAAgB;AAAA,QACxB;AACA,aAAK,WAAW,YAAY,MAAM,WAAW;AAAA,MAC/C;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,MAAM;AAAA,cACf,KAAK,qBAAqB,QAAQ;AAAA,cAClC,WAAW,GAAG,uBAAuB,IAAI,WAAW,uBAAuB,IAAI,SAAS,QAAQ,CAAC;AAAA,cACjG,SAAS,EAAE,aAAa;AAAA,YAC1B,CAAC;AAAA;AAAA,QACH;AAAA,QACC,YAAY,oBAAC,sBAAmB;AAAA;AAAA;AAAA,EACnC,GACF;AAEJ;AAEA,qBAAqB,cAAc;AAE5B,IAAM,mBAAmB,OAAO,OAAO,sBAAsB;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;","names":[]}
@@ -0,0 +1,23 @@
1
+ import * as React from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { Notification } from '@novu/js';
4
+ import { NotificationItemHandlers } from '@novu/js/ui-core';
5
+
6
+ type NotificationItemRenderers = {
7
+ renderAvatar?: (notification: Notification) => ReactNode;
8
+ renderSubject?: (notification: Notification) => ReactNode;
9
+ renderBody?: (notification: Notification) => ReactNode;
10
+ renderDefaultActions?: (notification: Notification) => ReactNode;
11
+ renderCustomActions?: (notification: Notification) => ReactNode;
12
+ };
13
+ type NotificationItemContextValue = {
14
+ notification: Notification;
15
+ handlers: NotificationItemHandlers;
16
+ renderers: NotificationItemRenderers;
17
+ };
18
+ declare const NotificationItemProvider: React.Provider<NotificationItemContextValue | undefined>;
19
+ declare const useNotificationItem: (part: string) => NotificationItemContextValue;
20
+ declare const NotificationHandlersProvider: React.Provider<NotificationItemHandlers>;
21
+ declare const useInheritedNotificationHandlers: () => NotificationItemHandlers;
22
+
23
+ export { NotificationHandlersProvider, type NotificationItemContextValue, NotificationItemProvider, type NotificationItemRenderers, useInheritedNotificationHandlers, useNotificationItem };
@@ -0,0 +1,21 @@
1
+ // src/components/notification-item/context.tsx
2
+ import { createContext, useContext } from "react";
3
+ var NotificationItemContext = createContext(void 0);
4
+ var NotificationItemProvider = NotificationItemContext.Provider;
5
+ var useNotificationItem = (part) => {
6
+ const context = useContext(NotificationItemContext);
7
+ if (!context) {
8
+ throw new Error(`<NotificationItem.${part} /> must be rendered inside <NotificationItem />`);
9
+ }
10
+ return context;
11
+ };
12
+ var NotificationHandlersContext = createContext({});
13
+ var NotificationHandlersProvider = NotificationHandlersContext.Provider;
14
+ var useInheritedNotificationHandlers = () => useContext(NotificationHandlersContext);
15
+ export {
16
+ NotificationHandlersProvider,
17
+ NotificationItemProvider,
18
+ useInheritedNotificationHandlers,
19
+ useNotificationItem
20
+ };
21
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/notification-item/context.tsx"],"sourcesContent":["import type { Notification } from '@novu/js';\nimport type { NotificationItemHandlers } from '@novu/js/ui-core';\nimport { createContext, type ReactNode, useContext } from 'react';\n\nexport type NotificationItemRenderers = {\n renderAvatar?: (notification: Notification) => ReactNode;\n renderSubject?: (notification: Notification) => ReactNode;\n renderBody?: (notification: Notification) => ReactNode;\n renderDefaultActions?: (notification: Notification) => ReactNode;\n renderCustomActions?: (notification: Notification) => ReactNode;\n};\n\nexport type NotificationItemContextValue = {\n notification: Notification;\n handlers: NotificationItemHandlers;\n renderers: NotificationItemRenderers;\n};\n\nconst NotificationItemContext = createContext<NotificationItemContextValue | undefined>(undefined);\n\nexport const NotificationItemProvider = NotificationItemContext.Provider;\n\nexport const useNotificationItem = (part: string): NotificationItemContextValue => {\n const context = useContext(NotificationItemContext);\n if (!context) {\n throw new Error(`<NotificationItem.${part} /> must be rendered inside <NotificationItem />`);\n }\n\n return context;\n};\n\n/**\n * The handlers given to `Inbox`, `Notifications` or `InboxContent`. Items rendered from their `renderNotification`\n * fall back to these when they get no handlers of their own.\n */\nconst NotificationHandlersContext = createContext<NotificationItemHandlers>({});\n\nexport const NotificationHandlersProvider = NotificationHandlersContext.Provider;\n\nexport const useInheritedNotificationHandlers = () => useContext(NotificationHandlersContext);\n"],"mappings":";AAEA,SAAS,eAA+B,kBAAkB;AAgB1D,IAAM,0BAA0B,cAAwD,MAAS;AAE1F,IAAM,2BAA2B,wBAAwB;AAEzD,IAAM,sBAAsB,CAAC,SAA+C;AACjF,QAAM,UAAU,WAAW,uBAAuB;AAClD,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,qBAAqB,IAAI,kDAAkD;AAAA,EAC7F;AAEA,SAAO;AACT;AAMA,IAAM,8BAA8B,cAAwC,CAAC,CAAC;AAEvE,IAAM,+BAA+B,4BAA4B;AAEjE,IAAM,mCAAmC,MAAM,WAAW,2BAA2B;","names":[]}
@@ -0,0 +1,11 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ /**
4
+ * The read, archive and snooze controls. An island: the engine renders it into this block, so the dropdowns,
5
+ * tooltips and pickers exist once. Clicks inside it never reach the item's own click handler.
6
+ */
7
+ declare const DefaultActions: () => react_jsx_runtime.JSX.Element;
8
+ /** The primary and secondary action buttons. An island, like the default actions. */
9
+ declare const CustomActions: () => react_jsx_runtime.JSX.Element;
10
+
11
+ export { CustomActions, DefaultActions };
@@ -0,0 +1,30 @@
1
+ // src/components/notification-item/parts/Actions.tsx
2
+ import { useMemo } from "react";
3
+ import { Mounter } from "../../Mounter.js";
4
+ import { useNotificationItem } from "../context.js";
5
+ import { Fragment, jsx } from "react/jsx-runtime";
6
+ var DefaultActions = () => {
7
+ const { notification, renderers } = useNotificationItem("DefaultActions");
8
+ const mountProps = useMemo(() => ({ notification }), [notification]);
9
+ if (renderers.renderDefaultActions) {
10
+ return /* @__PURE__ */ jsx(Fragment, { children: renderers.renderDefaultActions(notification) });
11
+ }
12
+ return /* @__PURE__ */ jsx(Mounter, { name: "NotificationDefaultActions", props: mountProps, bare: true });
13
+ };
14
+ var CustomActions = () => {
15
+ const { notification, handlers, renderers } = useNotificationItem("CustomActions");
16
+ const { onPrimaryActionClick, onSecondaryActionClick } = handlers;
17
+ const mountProps = useMemo(
18
+ () => ({ notification, onPrimaryActionClick, onSecondaryActionClick }),
19
+ [notification, onPrimaryActionClick, onSecondaryActionClick]
20
+ );
21
+ if (renderers.renderCustomActions) {
22
+ return /* @__PURE__ */ jsx(Fragment, { children: renderers.renderCustomActions(notification) });
23
+ }
24
+ return /* @__PURE__ */ jsx(Mounter, { name: "NotificationCustomActions", props: mountProps, bare: true });
25
+ };
26
+ export {
27
+ CustomActions,
28
+ DefaultActions
29
+ };
30
+ //# sourceMappingURL=Actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/notification-item/parts/Actions.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { Mounter } from '../../Mounter';\nimport { useNotificationItem } from '../context';\n\n/**\n * The read, archive and snooze controls. An island: the engine renders it into this block, so the dropdowns,\n * tooltips and pickers exist once. Clicks inside it never reach the item's own click handler.\n */\nexport const DefaultActions = () => {\n const { notification, renderers } = useNotificationItem('DefaultActions');\n const mountProps = useMemo(() => ({ notification }), [notification]);\n\n if (renderers.renderDefaultActions) {\n return <>{renderers.renderDefaultActions(notification)}</>;\n }\n\n return <Mounter name=\"NotificationDefaultActions\" props={mountProps} bare />;\n};\n\n/** The primary and secondary action buttons. An island, like the default actions. */\nexport const CustomActions = () => {\n const { notification, handlers, renderers } = useNotificationItem('CustomActions');\n const { onPrimaryActionClick, onSecondaryActionClick } = handlers;\n const mountProps = useMemo(\n () => ({ notification, onPrimaryActionClick, onSecondaryActionClick }),\n [notification, onPrimaryActionClick, onSecondaryActionClick]\n );\n\n if (renderers.renderCustomActions) {\n return <>{renderers.renderCustomActions(notification)}</>;\n }\n\n return <Mounter name=\"NotificationCustomActions\" props={mountProps} bare />;\n};\n"],"mappings":";AAAA,SAAgB,eAAe;AAC/B,SAAS,eAAe;AACxB,SAAS,2BAA2B;AAWzB;AALJ,IAAM,iBAAiB,MAAM;AAClC,QAAM,EAAE,cAAc,UAAU,IAAI,oBAAoB,gBAAgB;AACxE,QAAM,aAAa,QAAQ,OAAO,EAAE,aAAa,IAAI,CAAC,YAAY,CAAC;AAEnE,MAAI,UAAU,sBAAsB;AAClC,WAAO,gCAAG,oBAAU,qBAAqB,YAAY,GAAE;AAAA,EACzD;AAEA,SAAO,oBAAC,WAAQ,MAAK,8BAA6B,OAAO,YAAY,MAAI,MAAC;AAC5E;AAGO,IAAM,gBAAgB,MAAM;AACjC,QAAM,EAAE,cAAc,UAAU,UAAU,IAAI,oBAAoB,eAAe;AACjF,QAAM,EAAE,sBAAsB,uBAAuB,IAAI;AACzD,QAAM,aAAa;AAAA,IACjB,OAAO,EAAE,cAAc,sBAAsB,uBAAuB;AAAA,IACpE,CAAC,cAAc,sBAAsB,sBAAsB;AAAA,EAC7D;AAEA,MAAI,UAAU,qBAAqB;AACjC,WAAO,gCAAG,oBAAU,oBAAoB,YAAY,GAAE;AAAA,EACxD;AAEA,SAAO,oBAAC,WAAQ,MAAK,6BAA4B,OAAO,YAAY,MAAI,MAAC;AAC3E;","names":[]}
@@ -0,0 +1,8 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ type NotificationItemAvatarProps = {
4
+ className?: string;
5
+ };
6
+ declare const Avatar: ({ className }: NotificationItemAvatarProps) => react_jsx_runtime.JSX.Element;
7
+
8
+ export { Avatar, type NotificationItemAvatarProps };
@@ -0,0 +1,40 @@
1
+ // src/components/notification-item/parts/Avatar.tsx
2
+ import { notificationItemStyles } from "@novu/js/ui-core";
3
+ import { useStyle } from "../../../hooks/internal/useEngineStores.js";
4
+ import { useNotificationItem } from "../context.js";
5
+ import { Fragment, jsx } from "react/jsx-runtime";
6
+ var Avatar = ({ className }) => {
7
+ const { notification, renderers } = useNotificationItem("Avatar");
8
+ const style = useStyle();
9
+ if (renderers.renderAvatar) {
10
+ return /* @__PURE__ */ jsx(Fragment, { children: renderers.renderAvatar(notification) });
11
+ }
12
+ if (!notification.avatar) {
13
+ return /* @__PURE__ */ jsx(
14
+ "div",
15
+ {
16
+ className: style({
17
+ key: notificationItemStyles.avatarFallback.key,
18
+ className: [notificationItemStyles.avatarFallback.className, className].filter(Boolean).join(" "),
19
+ context: { notification }
20
+ })
21
+ }
22
+ );
23
+ }
24
+ return /* @__PURE__ */ jsx(
25
+ "img",
26
+ {
27
+ alt: "",
28
+ className: style({
29
+ key: notificationItemStyles.avatar.key,
30
+ className: [notificationItemStyles.avatar.className, className].filter(Boolean).join(" "),
31
+ context: { notification }
32
+ }),
33
+ src: notification.avatar
34
+ }
35
+ );
36
+ };
37
+ export {
38
+ Avatar
39
+ };
40
+ //# sourceMappingURL=Avatar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/notification-item/parts/Avatar.tsx"],"sourcesContent":["import { notificationItemStyles } from '@novu/js/ui-core';\nimport React from 'react';\nimport { useStyle } from '../../../hooks/internal/useEngineStores';\nimport { useNotificationItem } from '../context';\n\nexport type NotificationItemAvatarProps = { className?: string };\n\nexport const Avatar = ({ className }: NotificationItemAvatarProps) => {\n const { notification, renderers } = useNotificationItem('Avatar');\n const style = useStyle();\n\n if (renderers.renderAvatar) {\n return <>{renderers.renderAvatar(notification)}</>;\n }\n\n if (!notification.avatar) {\n return (\n <div\n className={style({\n key: notificationItemStyles.avatarFallback.key,\n className: [notificationItemStyles.avatarFallback.className, className].filter(Boolean).join(' '),\n context: { notification },\n })}\n />\n );\n }\n\n return (\n <img\n alt=\"\"\n className={style({\n key: notificationItemStyles.avatar.key,\n className: [notificationItemStyles.avatar.className, className].filter(Boolean).join(' '),\n context: { notification },\n })}\n src={notification.avatar}\n />\n );\n};\n"],"mappings":";AAAA,SAAS,8BAA8B;AAEvC,SAAS,gBAAgB;AACzB,SAAS,2BAA2B;AASzB;AALJ,IAAM,SAAS,CAAC,EAAE,UAAU,MAAmC;AACpE,QAAM,EAAE,cAAc,UAAU,IAAI,oBAAoB,QAAQ;AAChE,QAAM,QAAQ,SAAS;AAEvB,MAAI,UAAU,cAAc;AAC1B,WAAO,gCAAG,oBAAU,aAAa,YAAY,GAAE;AAAA,EACjD;AAEA,MAAI,CAAC,aAAa,QAAQ;AACxB,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,MAAM;AAAA,UACf,KAAK,uBAAuB,eAAe;AAAA,UAC3C,WAAW,CAAC,uBAAuB,eAAe,WAAW,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,UAChG,SAAS,EAAE,aAAa;AAAA,QAC1B,CAAC;AAAA;AAAA,IACH;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAI;AAAA,MACJ,WAAW,MAAM;AAAA,QACf,KAAK,uBAAuB,OAAO;AAAA,QACnC,WAAW,CAAC,uBAAuB,OAAO,WAAW,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,QACxF,SAAS,EAAE,aAAa;AAAA,MAC1B,CAAC;AAAA,MACD,KAAK,aAAa;AAAA;AAAA,EACpB;AAEJ;","names":[]}
@@ -0,0 +1,17 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ type NotificationItemContentProps = {
5
+ className?: string;
6
+ children?: ReactNode;
7
+ };
8
+ /** The column next to the avatar that holds the text, the actions and the date. */
9
+ declare const Content: ({ className, children }: NotificationItemContentProps) => react_jsx_runtime.JSX.Element;
10
+ type NotificationItemTextProps = {
11
+ className?: string;
12
+ children?: ReactNode;
13
+ };
14
+ /** Groups the subject and the body. */
15
+ declare const Text: ({ className, children }: NotificationItemTextProps) => react_jsx_runtime.JSX.Element;
16
+
17
+ export { Content, type NotificationItemContentProps, type NotificationItemTextProps, Text };
@@ -0,0 +1,40 @@
1
+ // src/components/notification-item/parts/Content.tsx
2
+ import { notificationItemStyles } from "@novu/js/ui-core";
3
+ import { useStyle } from "../../../hooks/internal/useEngineStores.js";
4
+ import { useNotificationItem } from "../context.js";
5
+ import { jsx } from "react/jsx-runtime";
6
+ var Content = ({ className, children }) => {
7
+ const { notification } = useNotificationItem("Content");
8
+ const style = useStyle();
9
+ return /* @__PURE__ */ jsx(
10
+ "div",
11
+ {
12
+ className: style({
13
+ key: notificationItemStyles.content.key,
14
+ className: [notificationItemStyles.content.className, className].filter(Boolean).join(" "),
15
+ context: { notification }
16
+ }),
17
+ children
18
+ }
19
+ );
20
+ };
21
+ var Text = ({ className, children }) => {
22
+ const { notification } = useNotificationItem("Text");
23
+ const style = useStyle();
24
+ return /* @__PURE__ */ jsx(
25
+ "div",
26
+ {
27
+ className: style({
28
+ key: notificationItemStyles.textContainer.key,
29
+ className: [notificationItemStyles.textContainer.className, className].filter(Boolean).join(" "),
30
+ context: { notification }
31
+ }),
32
+ children
33
+ }
34
+ );
35
+ };
36
+ export {
37
+ Content,
38
+ Text
39
+ };
40
+ //# sourceMappingURL=Content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/notification-item/parts/Content.tsx"],"sourcesContent":["import { notificationItemStyles } from '@novu/js/ui-core';\nimport React, { type ReactNode } from 'react';\nimport { useStyle } from '../../../hooks/internal/useEngineStores';\nimport { useNotificationItem } from '../context';\n\nexport type NotificationItemContentProps = { className?: string; children?: ReactNode };\n\n/** The column next to the avatar that holds the text, the actions and the date. */\nexport const Content = ({ className, children }: NotificationItemContentProps) => {\n const { notification } = useNotificationItem('Content');\n const style = useStyle();\n\n return (\n <div\n className={style({\n key: notificationItemStyles.content.key,\n className: [notificationItemStyles.content.className, className].filter(Boolean).join(' '),\n context: { notification },\n })}\n >\n {children}\n </div>\n );\n};\n\nexport type NotificationItemTextProps = { className?: string; children?: ReactNode };\n\n/** Groups the subject and the body. */\nexport const Text = ({ className, children }: NotificationItemTextProps) => {\n const { notification } = useNotificationItem('Text');\n const style = useStyle();\n\n return (\n <div\n className={style({\n key: notificationItemStyles.textContainer.key,\n className: [notificationItemStyles.textContainer.className, className].filter(Boolean).join(' '),\n context: { notification },\n })}\n >\n {children}\n </div>\n );\n};\n"],"mappings":";AAAA,SAAS,8BAA8B;AAEvC,SAAS,gBAAgB;AACzB,SAAS,2BAA2B;AAUhC;AALG,IAAM,UAAU,CAAC,EAAE,WAAW,SAAS,MAAoC;AAChF,QAAM,EAAE,aAAa,IAAI,oBAAoB,SAAS;AACtD,QAAM,QAAQ,SAAS;AAEvB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,MAAM;AAAA,QACf,KAAK,uBAAuB,QAAQ;AAAA,QACpC,WAAW,CAAC,uBAAuB,QAAQ,WAAW,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,QACzF,SAAS,EAAE,aAAa;AAAA,MAC1B,CAAC;AAAA,MAEA;AAAA;AAAA,EACH;AAEJ;AAKO,IAAM,OAAO,CAAC,EAAE,WAAW,SAAS,MAAiC;AAC1E,QAAM,EAAE,aAAa,IAAI,oBAAoB,MAAM;AACnD,QAAM,QAAQ,SAAS;AAEvB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,MAAM;AAAA,QACf,KAAK,uBAAuB,cAAc;AAAA,QAC1C,WAAW,CAAC,uBAAuB,cAAc,WAAW,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,QAC/F,SAAS,EAAE,aAAa;AAAA,MAC1B,CAAC;AAAA,MAEA;AAAA;AAAA,EACH;AAEJ;","names":[]}
@@ -0,0 +1,11 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ type NotificationItemDateProps = {
5
+ className?: string;
6
+ children?: ReactNode;
7
+ };
8
+ /** When the notification arrived, when it was delivered again, or until when it is snoozed. */
9
+ declare const Date: ({ className, children }: NotificationItemDateProps) => react_jsx_runtime.JSX.Element;
10
+
11
+ export { Date, type NotificationItemDateProps };