@novu/react 3.19.2 → 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 +10 -4
  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
@@ -0,0 +1,89 @@
1
+ // src/components/notification-item/parts/Date.tsx
2
+ import { badgeStyles, formatSnoozedUntil, formatToRelativeTime, notificationItemStyles } from "@novu/js/ui-core";
3
+ import { useEffect, useState } from "react";
4
+ import { useNovuUI } from "../../../context/NovuUIContext.js";
5
+ import { useLocalization, useStyle } from "../../../hooks/internal/useEngineStores.js";
6
+ import { ClockIcon } from "../ClockIcon.js";
7
+ import { useNotificationItem } from "../context.js";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
+ var MINUTE = 60 * 1e3;
10
+ var useMinuteTick = () => {
11
+ const [, setMinutesPassed] = useState(0);
12
+ useEffect(() => {
13
+ const interval = setInterval(() => setMinutesPassed((prev) => prev + 1), MINUTE);
14
+ return () => clearInterval(interval);
15
+ }, []);
16
+ };
17
+ var Clock = ({ styleKey }) => {
18
+ const { notification } = useNotificationItem("Date");
19
+ const { icons } = useNovuUI();
20
+ const style = useStyle();
21
+ const className = style({
22
+ key: notificationItemStyles[styleKey].key,
23
+ className: notificationItemStyles[styleKey].className,
24
+ iconKey: "clock",
25
+ context: { notification }
26
+ });
27
+ if (icons.clock) {
28
+ return /* @__PURE__ */ jsx(Fragment, { children: icons.clock({ class: className }) });
29
+ }
30
+ return /* @__PURE__ */ jsx(ClockIcon, { className });
31
+ };
32
+ var Date = ({ className, children }) => {
33
+ const { notification } = useNotificationItem("Date");
34
+ const style = useStyle();
35
+ const { t, locale } = useLocalization();
36
+ useMinuteTick();
37
+ const createdAt = formatToRelativeTime({ fromDate: new globalThis.Date(notification.createdAt), locale });
38
+ const snoozedUntil = notification.snoozedUntil ? formatSnoozedUntil({ untilDate: new globalThis.Date(notification.snoozedUntil), locale }) : null;
39
+ const deliveredAt = Array.isArray(notification.deliveredAt) ? notification.deliveredAt.map((date) => formatToRelativeTime({ fromDate: new globalThis.Date(date), locale })) : null;
40
+ let content = createdAt;
41
+ if (children !== void 0) {
42
+ content = children;
43
+ } else if (snoozedUntil) {
44
+ content = /* @__PURE__ */ jsxs(Fragment, { children: [
45
+ /* @__PURE__ */ jsx(Clock, { styleKey: "snoozedUntilIcon" }),
46
+ t("notification.snoozedUntil"),
47
+ " \xB7 ",
48
+ snoozedUntil
49
+ ] });
50
+ } else if (deliveredAt && deliveredAt.length >= 2) {
51
+ const [previous, latest] = deliveredAt.slice(-2);
52
+ content = /* @__PURE__ */ jsxs(Fragment, { children: [
53
+ " ",
54
+ previous,
55
+ " \xB7",
56
+ /* @__PURE__ */ jsxs(
57
+ "span",
58
+ {
59
+ "data-variant": "secondary",
60
+ "data-size": "default",
61
+ className: style({
62
+ key: notificationItemStyles.deliveredAtBadge.key,
63
+ className: [badgeStyles.base, badgeStyles.variants.secondary, badgeStyles.sizes.default].join(" "),
64
+ context: { notification }
65
+ }),
66
+ children: [
67
+ /* @__PURE__ */ jsx(Clock, { styleKey: "deliveredAtIcon" }),
68
+ latest
69
+ ]
70
+ }
71
+ )
72
+ ] });
73
+ }
74
+ return /* @__PURE__ */ jsx(
75
+ "div",
76
+ {
77
+ className: style({
78
+ key: notificationItemStyles.date.key,
79
+ className: [notificationItemStyles.date.className, className].filter(Boolean).join(" "),
80
+ context: { notification }
81
+ }),
82
+ children: content
83
+ }
84
+ );
85
+ };
86
+ export {
87
+ Date
88
+ };
89
+ //# sourceMappingURL=Date.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/notification-item/parts/Date.tsx"],"sourcesContent":["import { badgeStyles, formatSnoozedUntil, formatToRelativeTime, notificationItemStyles } from '@novu/js/ui-core';\nimport React, { type ReactNode, useEffect, useMemo, useState } from 'react';\nimport { useNovuUI } from '../../../context/NovuUIContext';\nimport { useLocalization, useStyle } from '../../../hooks/internal/useEngineStores';\nimport { ClockIcon } from '../ClockIcon';\nimport { useNotificationItem } from '../context';\n\nexport type NotificationItemDateProps = { className?: string; children?: ReactNode };\n\nconst MINUTE = 60 * 1000;\n\nconst useMinuteTick = () => {\n const [, setMinutesPassed] = useState(0);\n\n useEffect(() => {\n const interval = setInterval(() => setMinutesPassed((prev) => prev + 1), MINUTE);\n\n return () => clearInterval(interval);\n }, []);\n};\n\nconst Clock = ({ styleKey }: { styleKey: 'deliveredAtIcon' | 'snoozedUntilIcon' }) => {\n const { notification } = useNotificationItem('Date');\n const { icons } = useNovuUI();\n const style = useStyle();\n const className = style({\n key: notificationItemStyles[styleKey].key,\n className: notificationItemStyles[styleKey].className,\n iconKey: 'clock',\n context: { notification },\n });\n\n if (icons.clock) {\n return <>{icons.clock({ class: className })}</>;\n }\n\n return <ClockIcon className={className} />;\n};\n\n/** When the notification arrived, when it was delivered again, or until when it is snoozed. */\nexport const Date = ({ className, children }: NotificationItemDateProps) => {\n const { notification } = useNotificationItem('Date');\n const style = useStyle();\n const { t, locale } = useLocalization();\n useMinuteTick();\n\n const createdAt = formatToRelativeTime({ fromDate: new globalThis.Date(notification.createdAt), locale });\n const snoozedUntil = notification.snoozedUntil\n ? formatSnoozedUntil({ untilDate: new globalThis.Date(notification.snoozedUntil), locale })\n : null;\n const deliveredAt = Array.isArray(notification.deliveredAt)\n ? notification.deliveredAt.map((date) => formatToRelativeTime({ fromDate: new globalThis.Date(date), locale }))\n : null;\n\n let content: ReactNode = createdAt;\n if (children !== undefined) {\n content = children;\n } else if (snoozedUntil) {\n content = (\n <>\n <Clock styleKey=\"snoozedUntilIcon\" />\n {t('notification.snoozedUntil')} · {snoozedUntil}\n </>\n );\n } else if (deliveredAt && deliveredAt.length >= 2) {\n const [previous, latest] = deliveredAt.slice(-2);\n content = (\n <>\n {' '}\n {previous} ·\n <span\n data-variant=\"secondary\"\n data-size=\"default\"\n className={style({\n key: notificationItemStyles.deliveredAtBadge.key,\n className: [badgeStyles.base, badgeStyles.variants.secondary, badgeStyles.sizes.default].join(' '),\n context: { notification },\n })}\n >\n <Clock styleKey=\"deliveredAtIcon\" />\n {latest}\n </span>\n </>\n );\n }\n\n return (\n <div\n className={style({\n key: notificationItemStyles.date.key,\n className: [notificationItemStyles.date.className, className].filter(Boolean).join(' '),\n context: { notification },\n })}\n >\n {content}\n </div>\n );\n};\n"],"mappings":";AAAA,SAAS,aAAa,oBAAoB,sBAAsB,8BAA8B;AAC9F,SAAgC,WAAoB,gBAAgB;AACpE,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB,gBAAgB;AAC1C,SAAS,iBAAiB;AAC1B,SAAS,2BAA2B;AA4BzB,wBA0BL,YA1BK;AAxBX,IAAM,SAAS,KAAK;AAEpB,IAAM,gBAAgB,MAAM;AAC1B,QAAM,CAAC,EAAE,gBAAgB,IAAI,SAAS,CAAC;AAEvC,YAAU,MAAM;AACd,UAAM,WAAW,YAAY,MAAM,iBAAiB,CAAC,SAAS,OAAO,CAAC,GAAG,MAAM;AAE/E,WAAO,MAAM,cAAc,QAAQ;AAAA,EACrC,GAAG,CAAC,CAAC;AACP;AAEA,IAAM,QAAQ,CAAC,EAAE,SAAS,MAA4D;AACpF,QAAM,EAAE,aAAa,IAAI,oBAAoB,MAAM;AACnD,QAAM,EAAE,MAAM,IAAI,UAAU;AAC5B,QAAM,QAAQ,SAAS;AACvB,QAAM,YAAY,MAAM;AAAA,IACtB,KAAK,uBAAuB,QAAQ,EAAE;AAAA,IACtC,WAAW,uBAAuB,QAAQ,EAAE;AAAA,IAC5C,SAAS;AAAA,IACT,SAAS,EAAE,aAAa;AAAA,EAC1B,CAAC;AAED,MAAI,MAAM,OAAO;AACf,WAAO,gCAAG,gBAAM,MAAM,EAAE,OAAO,UAAU,CAAC,GAAE;AAAA,EAC9C;AAEA,SAAO,oBAAC,aAAU,WAAsB;AAC1C;AAGO,IAAM,OAAO,CAAC,EAAE,WAAW,SAAS,MAAiC;AAC1E,QAAM,EAAE,aAAa,IAAI,oBAAoB,MAAM;AACnD,QAAM,QAAQ,SAAS;AACvB,QAAM,EAAE,GAAG,OAAO,IAAI,gBAAgB;AACtC,gBAAc;AAEd,QAAM,YAAY,qBAAqB,EAAE,UAAU,IAAI,WAAW,KAAK,aAAa,SAAS,GAAG,OAAO,CAAC;AACxG,QAAM,eAAe,aAAa,eAC9B,mBAAmB,EAAE,WAAW,IAAI,WAAW,KAAK,aAAa,YAAY,GAAG,OAAO,CAAC,IACxF;AACJ,QAAM,cAAc,MAAM,QAAQ,aAAa,WAAW,IACtD,aAAa,YAAY,IAAI,CAAC,SAAS,qBAAqB,EAAE,UAAU,IAAI,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,CAAC,IAC5G;AAEJ,MAAI,UAAqB;AACzB,MAAI,aAAa,QAAW;AAC1B,cAAU;AAAA,EACZ,WAAW,cAAc;AACvB,cACE,iCACE;AAAA,0BAAC,SAAM,UAAS,oBAAmB;AAAA,MAClC,EAAE,2BAA2B;AAAA,MAAE;AAAA,MAAI;AAAA,OACtC;AAAA,EAEJ,WAAW,eAAe,YAAY,UAAU,GAAG;AACjD,UAAM,CAAC,UAAU,MAAM,IAAI,YAAY,MAAM,EAAE;AAC/C,cACE,iCACG;AAAA;AAAA,MACA;AAAA,MAAS;AAAA,MACV;AAAA,QAAC;AAAA;AAAA,UACC,gBAAa;AAAA,UACb,aAAU;AAAA,UACV,WAAW,MAAM;AAAA,YACf,KAAK,uBAAuB,iBAAiB;AAAA,YAC7C,WAAW,CAAC,YAAY,MAAM,YAAY,SAAS,WAAW,YAAY,MAAM,OAAO,EAAE,KAAK,GAAG;AAAA,YACjG,SAAS,EAAE,aAAa;AAAA,UAC1B,CAAC;AAAA,UAED;AAAA,gCAAC,SAAM,UAAS,mBAAkB;AAAA,YACjC;AAAA;AAAA;AAAA,MACH;AAAA,OACF;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,MAAM;AAAA,QACf,KAAK,uBAAuB,KAAK;AAAA,QACjC,WAAW,CAAC,uBAAuB,KAAK,WAAW,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,QACtF,SAAS,EAAE,aAAa;AAAA,MAC1B,CAAC;AAAA,MAEA;AAAA;AAAA,EACH;AAEJ;","names":[]}
@@ -0,0 +1,9 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ type NotificationItemDotProps = {
4
+ className?: string;
5
+ };
6
+ /** The unread marker on the right edge of the item. */
7
+ declare const Dot: ({ className }: NotificationItemDotProps) => react_jsx_runtime.JSX.Element;
8
+
9
+ export { Dot, type NotificationItemDotProps };
@@ -0,0 +1,23 @@
1
+ // src/components/notification-item/parts/Dot.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 Dot = ({ className }) => {
7
+ const { notification } = useNotificationItem("Dot");
8
+ const style = useStyle();
9
+ return /* @__PURE__ */ jsx("div", { className: notificationItemStyles.dotContainer.className, children: !notification.isRead && /* @__PURE__ */ jsx(
10
+ "span",
11
+ {
12
+ className: style({
13
+ key: notificationItemStyles.dot.key,
14
+ className: [notificationItemStyles.dot.className, className].filter(Boolean).join(" "),
15
+ context: { notification }
16
+ })
17
+ }
18
+ ) });
19
+ };
20
+ export {
21
+ Dot
22
+ };
23
+ //# sourceMappingURL=Dot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/notification-item/parts/Dot.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 NotificationItemDotProps = { className?: string };\n\n/** The unread marker on the right edge of the item. */\nexport const Dot = ({ className }: NotificationItemDotProps) => {\n const { notification } = useNotificationItem('Dot');\n const style = useStyle();\n\n return (\n <div className={notificationItemStyles.dotContainer.className}>\n {!notification.isRead && (\n <span\n className={style({\n key: notificationItemStyles.dot.key,\n className: [notificationItemStyles.dot.className, className].filter(Boolean).join(' '),\n context: { notification },\n })}\n />\n )}\n </div>\n );\n};\n"],"mappings":";AAAA,SAAS,8BAA8B;AAEvC,SAAS,gBAAgB;AACzB,SAAS,2BAA2B;AAY5B;AAPD,IAAM,MAAM,CAAC,EAAE,UAAU,MAAgC;AAC9D,QAAM,EAAE,aAAa,IAAI,oBAAoB,KAAK;AAClD,QAAM,QAAQ,SAAS;AAEvB,SACE,oBAAC,SAAI,WAAW,uBAAuB,aAAa,WACjD,WAAC,aAAa,UACb;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,MAAM;AAAA,QACf,KAAK,uBAAuB,IAAI;AAAA,QAChC,WAAW,CAAC,uBAAuB,IAAI,WAAW,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,QACrF,SAAS,EAAE,aAAa;AAAA,MAC1B,CAAC;AAAA;AAAA,EACH,GAEJ;AAEJ;","names":[]}
@@ -0,0 +1,15 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ type NotificationItemSubjectProps = {
5
+ className?: string;
6
+ children?: ReactNode;
7
+ };
8
+ declare const Subject: ({ className, children }: NotificationItemSubjectProps) => react_jsx_runtime.JSX.Element | null;
9
+ type NotificationItemBodyProps = {
10
+ className?: string;
11
+ children?: ReactNode;
12
+ };
13
+ declare const Body: ({ className, children }: NotificationItemBodyProps) => react_jsx_runtime.JSX.Element;
14
+
15
+ export { Body, type NotificationItemBodyProps, type NotificationItemSubjectProps, Subject };
@@ -0,0 +1,66 @@
1
+ // src/components/notification-item/parts/Subject.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 { Markdown } from "../Markdown.js";
6
+ import { Fragment, jsx } from "react/jsx-runtime";
7
+ var Subject = ({ className, children }) => {
8
+ const { notification, renderers } = useNotificationItem("Subject");
9
+ const style = useStyle();
10
+ if (renderers.renderSubject) {
11
+ return /* @__PURE__ */ jsx(Fragment, { children: renderers.renderSubject(notification) });
12
+ }
13
+ if (children === void 0 && !notification.subject) {
14
+ return null;
15
+ }
16
+ return /* @__PURE__ */ jsx(
17
+ "p",
18
+ {
19
+ className: style({
20
+ key: notificationItemStyles.subject.key,
21
+ className: [notificationItemStyles.subject.className, className].filter(Boolean).join(" "),
22
+ context: { notification }
23
+ }),
24
+ children: children ?? /* @__PURE__ */ jsx(
25
+ Markdown,
26
+ {
27
+ strongKey: notificationItemStyles.subject.strongKey,
28
+ emKey: notificationItemStyles.subject.emKey,
29
+ context: { notification },
30
+ children: notification.subject ?? ""
31
+ }
32
+ )
33
+ }
34
+ );
35
+ };
36
+ var Body = ({ className, children }) => {
37
+ const { notification, renderers } = useNotificationItem("Body");
38
+ const style = useStyle();
39
+ if (renderers.renderBody) {
40
+ return /* @__PURE__ */ jsx(Fragment, { children: renderers.renderBody(notification) });
41
+ }
42
+ return /* @__PURE__ */ jsx(
43
+ "p",
44
+ {
45
+ className: style({
46
+ key: notificationItemStyles.body.key,
47
+ className: [notificationItemStyles.body.className, className].filter(Boolean).join(" "),
48
+ context: { notification }
49
+ }),
50
+ children: children ?? /* @__PURE__ */ jsx(
51
+ Markdown,
52
+ {
53
+ strongKey: notificationItemStyles.body.strongKey,
54
+ emKey: notificationItemStyles.body.emKey,
55
+ context: { notification },
56
+ children: notification.body
57
+ }
58
+ )
59
+ }
60
+ );
61
+ };
62
+ export {
63
+ Body,
64
+ Subject
65
+ };
66
+ //# sourceMappingURL=Subject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/notification-item/parts/Subject.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';\nimport { Markdown } from '../Markdown';\n\nexport type NotificationItemSubjectProps = { className?: string; children?: ReactNode };\n\nexport const Subject = ({ className, children }: NotificationItemSubjectProps) => {\n const { notification, renderers } = useNotificationItem('Subject');\n const style = useStyle();\n\n if (renderers.renderSubject) {\n return <>{renderers.renderSubject(notification)}</>;\n }\n\n if (children === undefined && !notification.subject) {\n return null;\n }\n\n return (\n <p\n className={style({\n key: notificationItemStyles.subject.key,\n className: [notificationItemStyles.subject.className, className].filter(Boolean).join(' '),\n context: { notification },\n })}\n >\n {children ?? (\n <Markdown\n strongKey={notificationItemStyles.subject.strongKey}\n emKey={notificationItemStyles.subject.emKey}\n context={{ notification }}\n >\n {notification.subject ?? ''}\n </Markdown>\n )}\n </p>\n );\n};\n\nexport type NotificationItemBodyProps = { className?: string; children?: ReactNode };\n\nexport const Body = ({ className, children }: NotificationItemBodyProps) => {\n const { notification, renderers } = useNotificationItem('Body');\n const style = useStyle();\n\n if (renderers.renderBody) {\n return <>{renderers.renderBody(notification)}</>;\n }\n\n return (\n <p\n className={style({\n key: notificationItemStyles.body.key,\n className: [notificationItemStyles.body.className, className].filter(Boolean).join(' '),\n context: { notification },\n })}\n >\n {children ?? (\n <Markdown\n strongKey={notificationItemStyles.body.strongKey}\n emKey={notificationItemStyles.body.emKey}\n context={{ notification }}\n >\n {notification.body}\n </Markdown>\n )}\n </p>\n );\n};\n"],"mappings":";AAAA,SAAS,8BAA8B;AAEvC,SAAS,gBAAgB;AACzB,SAAS,2BAA2B;AACpC,SAAS,gBAAgB;AASd;AALJ,IAAM,UAAU,CAAC,EAAE,WAAW,SAAS,MAAoC;AAChF,QAAM,EAAE,cAAc,UAAU,IAAI,oBAAoB,SAAS;AACjE,QAAM,QAAQ,SAAS;AAEvB,MAAI,UAAU,eAAe;AAC3B,WAAO,gCAAG,oBAAU,cAAc,YAAY,GAAE;AAAA,EAClD;AAEA,MAAI,aAAa,UAAa,CAAC,aAAa,SAAS;AACnD,WAAO;AAAA,EACT;AAEA,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,sBACC;AAAA,QAAC;AAAA;AAAA,UACC,WAAW,uBAAuB,QAAQ;AAAA,UAC1C,OAAO,uBAAuB,QAAQ;AAAA,UACtC,SAAS,EAAE,aAAa;AAAA,UAEvB,uBAAa,WAAW;AAAA;AAAA,MAC3B;AAAA;AAAA,EAEJ;AAEJ;AAIO,IAAM,OAAO,CAAC,EAAE,WAAW,SAAS,MAAiC;AAC1E,QAAM,EAAE,cAAc,UAAU,IAAI,oBAAoB,MAAM;AAC9D,QAAM,QAAQ,SAAS;AAEvB,MAAI,UAAU,YAAY;AACxB,WAAO,gCAAG,oBAAU,WAAW,YAAY,GAAE;AAAA,EAC/C;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,MAAM;AAAA,QACf,KAAK,uBAAuB,KAAK;AAAA,QACjC,WAAW,CAAC,uBAAuB,KAAK,WAAW,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,QACtF,SAAS,EAAE,aAAa;AAAA,MAC1B,CAAC;AAAA,MAEA,sBACC;AAAA,QAAC;AAAA;AAAA,UACC,WAAW,uBAAuB,KAAK;AAAA,UACvC,OAAO,uBAAuB,KAAK;AAAA,UACnC,SAAS,EAAE,aAAa;AAAA,UAEvB,uBAAa;AAAA;AAAA,MAChB;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
@@ -1,6 +1,5 @@
1
1
  // src/components/slack-connect-button/DefaultSlackConnectButton.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 DefaultSlackConnectButton = (props) => {
@@ -20,32 +19,24 @@ var DefaultSlackConnectButton = (props) => {
20
19
  connectLabel,
21
20
  connectedLabel
22
21
  } = props;
23
- const { novuUI } = useNovuUI();
24
- const mount = useCallback(
25
- (element) => {
26
- return novuUI.mountComponent({
27
- name: "SlackConnectButton",
28
- props: {
29
- integrationIdentifier,
30
- connectionIdentifier,
31
- subscriberId,
32
- context,
33
- contextHash,
34
- scope,
35
- connectionMode,
36
- autoLinkUser,
37
- onConnectSuccess,
38
- onConnectError,
39
- onDisconnectSuccess,
40
- onDisconnectError,
41
- connectLabel,
42
- connectedLabel
43
- },
44
- element
45
- });
46
- },
22
+ const mountProps = useMemo(
23
+ () => ({
24
+ integrationIdentifier,
25
+ connectionIdentifier,
26
+ subscriberId,
27
+ context,
28
+ contextHash,
29
+ scope,
30
+ connectionMode,
31
+ autoLinkUser,
32
+ onConnectSuccess,
33
+ onConnectError,
34
+ onDisconnectSuccess,
35
+ onDisconnectError,
36
+ connectLabel,
37
+ connectedLabel
38
+ }),
47
39
  [
48
- novuUI,
49
40
  integrationIdentifier,
50
41
  connectionIdentifier,
51
42
  subscriberId,
@@ -62,7 +53,7 @@ var DefaultSlackConnectButton = (props) => {
62
53
  connectedLabel
63
54
  ]
64
55
  );
65
- return /* @__PURE__ */ jsx(Mounter, { mount });
56
+ return /* @__PURE__ */ jsx(Mounter, { name: "SlackConnectButton", props: mountProps });
66
57
  };
67
58
  export {
68
59
  DefaultSlackConnectButton
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/slack-connect-button/DefaultSlackConnectButton.tsx"],"sourcesContent":["import { SlackConnectButtonProps } from '@novu/js/ui';\nimport { useCallback } from 'react';\nimport { useNovuUI } from '../../context/NovuUIContext';\nimport { Mounter } from '../Mounter';\n\nexport type DefaultSlackConnectButtonProps = Pick<\n SlackConnectButtonProps,\n | 'integrationIdentifier'\n | 'connectionIdentifier'\n | 'subscriberId'\n | 'context'\n | 'contextHash'\n | 'scope'\n | 'connectionMode'\n | 'autoLinkUser'\n | 'onConnectSuccess'\n | 'onConnectError'\n | 'onDisconnectSuccess'\n | 'onDisconnectError'\n | 'connectLabel'\n | 'connectedLabel'\n>;\n\nexport const DefaultSlackConnectButton = (props: DefaultSlackConnectButtonProps) => {\n const {\n integrationIdentifier,\n connectionIdentifier,\n subscriberId,\n context,\n contextHash,\n scope,\n connectionMode,\n autoLinkUser,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n connectLabel,\n connectedLabel,\n } = props;\n const { novuUI } = useNovuUI();\n\n const mount = useCallback(\n (element: HTMLElement) => {\n return novuUI.mountComponent({\n name: 'SlackConnectButton',\n props: {\n integrationIdentifier,\n connectionIdentifier,\n subscriberId,\n context,\n contextHash,\n scope,\n connectionMode,\n autoLinkUser,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n connectLabel,\n connectedLabel,\n },\n element,\n });\n },\n [\n novuUI,\n integrationIdentifier,\n connectionIdentifier,\n subscriberId,\n context,\n contextHash,\n scope,\n connectionMode,\n autoLinkUser,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n connectLabel,\n connectedLabel,\n ]\n );\n\n return <Mounter mount={mount} />;\n};\n"],"mappings":";AACA,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AAiFf;AA7DF,IAAM,4BAA4B,CAAC,UAA0C;AAClF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;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,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,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,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/slack-connect-button/DefaultSlackConnectButton.tsx"],"sourcesContent":["import { SlackConnectButtonProps } from '@novu/js/ui';\nimport { useMemo } from 'react';\nimport { Mounter } from '../Mounter';\n\nexport type DefaultSlackConnectButtonProps = Pick<\n SlackConnectButtonProps,\n | 'integrationIdentifier'\n | 'connectionIdentifier'\n | 'subscriberId'\n | 'context'\n | 'contextHash'\n | 'scope'\n | 'connectionMode'\n | 'autoLinkUser'\n | 'onConnectSuccess'\n | 'onConnectError'\n | 'onDisconnectSuccess'\n | 'onDisconnectError'\n | 'connectLabel'\n | 'connectedLabel'\n>;\n\nexport const DefaultSlackConnectButton = (props: DefaultSlackConnectButtonProps) => {\n const {\n integrationIdentifier,\n connectionIdentifier,\n subscriberId,\n context,\n contextHash,\n scope,\n connectionMode,\n autoLinkUser,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n connectLabel,\n connectedLabel,\n } = props;\n\n const mountProps = useMemo(\n () => ({\n integrationIdentifier,\n connectionIdentifier,\n subscriberId,\n context,\n contextHash,\n scope,\n connectionMode,\n autoLinkUser,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n connectLabel,\n connectedLabel,\n }),\n [\n integrationIdentifier,\n connectionIdentifier,\n subscriberId,\n context,\n contextHash,\n scope,\n connectionMode,\n autoLinkUser,\n onConnectSuccess,\n onConnectError,\n onDisconnectSuccess,\n onDisconnectError,\n connectLabel,\n connectedLabel,\n ]\n );\n\n return <Mounter name=\"SlackConnectButton\" props={mountProps} />;\n};\n"],"mappings":";AACA,SAAS,eAAe;AACxB,SAAS,eAAe;AAyEf;AArDF,IAAM,4BAA4B,CAAC,UAA0C;AAClF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;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,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,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,oBAAC,WAAQ,MAAK,sBAAqB,OAAO,YAAY;AAC/D;","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 { DefaultSlackConnectButton } from "./DefaultSlackConnectButton.js";
7
6
  import { jsx } from "react/jsx-runtime";
8
- var SlackConnectButtonInternal = withRenderer((props) => {
7
+ var SlackConnectButtonInternal = (props) => {
9
8
  const { container, appearance, ...defaultProps } = props;
10
9
  const novu = useNovu();
11
10
  const options = useMemo(() => {
@@ -16,7 +15,7 @@ var SlackConnectButtonInternal = withRenderer((props) => {
16
15
  };
17
16
  }, [container, appearance, novu.options]);
18
17
  return /* @__PURE__ */ jsx(NovuUI, { options, novu, children: /* @__PURE__ */ jsx(DefaultSlackConnectButton, { ...defaultProps }) });
19
- });
18
+ };
20
19
  SlackConnectButtonInternal.displayName = "SlackConnectButtonInternal";
21
20
  var SlackConnectButton = React.memo((props) => {
22
21
  return /* @__PURE__ */ jsx(SlackConnectButtonInternal, { ...props });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/slack-connect-button/SlackConnectButton.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { useNovu } from '../../hooks/NovuProvider';\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\nimport { withRenderer } from '../Renderer';\nimport { DefaultSlackConnectButton, DefaultSlackConnectButtonProps } from './DefaultSlackConnectButton';\n\nexport type SlackConnectButtonProps = DefaultSlackConnectButtonProps & Pick<NovuUIOptions, 'container' | 'appearance'>;\n\nconst SlackConnectButtonInternal = withRenderer<SlackConnectButtonProps>((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 <DefaultSlackConnectButton {...defaultProps} />\n </NovuUI>\n );\n});\n\nSlackConnectButtonInternal.displayName = 'SlackConnectButtonInternal';\n\nexport const SlackConnectButton = React.memo((props: SlackConnectButtonProps) => {\n return <SlackConnectButtonInternal {...props} />;\n});\n\nSlackConnectButton.displayName = 'SlackConnectButton';\n"],"mappings":";AAAA,OAAO,SAAS,eAAe;AAC/B,SAAS,eAAe;AACxB,SAAS,cAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,iCAAiE;AAkBpE;AAdN,IAAM,6BAA6B,aAAsC,CAAC,UAAU;AAClF,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,6BAA2B,GAAG,cAAc,GAC/C;AAEJ,CAAC;AAED,2BAA2B,cAAc;AAElC,IAAM,qBAAqB,MAAM,KAAK,CAAC,UAAmC;AAC/E,SAAO,oBAAC,8BAA4B,GAAG,OAAO;AAChD,CAAC;AAED,mBAAmB,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/slack-connect-button/SlackConnectButton.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { useNovu } from '../../hooks/NovuProvider';\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\nimport { DefaultSlackConnectButton, DefaultSlackConnectButtonProps } from './DefaultSlackConnectButton';\n\nexport type SlackConnectButtonProps = DefaultSlackConnectButtonProps & Pick<NovuUIOptions, 'container' | 'appearance'>;\n\nconst SlackConnectButtonInternal = (props: SlackConnectButtonProps) => {\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 <DefaultSlackConnectButton {...defaultProps} />\n </NovuUI>\n );\n};\n\nSlackConnectButtonInternal.displayName = 'SlackConnectButtonInternal';\n\nexport const SlackConnectButton = React.memo((props: SlackConnectButtonProps) => {\n return <SlackConnectButtonInternal {...props} />;\n});\n\nSlackConnectButton.displayName = 'SlackConnectButton';\n"],"mappings":";AAAA,OAAO,SAAS,eAAe;AAC/B,SAAS,eAAe;AACxB,SAAS,cAA6B;AACtC,SAAS,iCAAiE;AAkBpE;AAdN,IAAM,6BAA6B,CAAC,UAAmC;AACrE,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,6BAA2B,GAAG,cAAc,GAC/C;AAEJ;AAEA,2BAA2B,cAAc;AAElC,IAAM,qBAAqB,MAAM,KAAK,CAAC,UAAmC;AAC/E,SAAO,oBAAC,8BAA4B,GAAG,OAAO;AAChD,CAAC;AAED,mBAAmB,cAAc;","names":[]}
@@ -1,6 +1,5 @@
1
1
  // src/components/slack-link-user/DefaultSlackLinkUser.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 DefaultSlackLinkUser = (props) => {
@@ -15,27 +14,19 @@ var DefaultSlackLinkUser = (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: "SlackLinkUser",
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 DefaultSlackLinkUser = (props) => {
47
38
  unlinkLabel
48
39
  ]
49
40
  );
50
- return /* @__PURE__ */ jsx(Mounter, { mount });
41
+ return /* @__PURE__ */ jsx(Mounter, { name: "SlackLinkUser", props: mountProps });
51
42
  };
52
43
  export {
53
44
  DefaultSlackLinkUser
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/slack-link-user/DefaultSlackLinkUser.tsx"],"sourcesContent":["import { SlackLinkUserProps } from '@novu/js/ui';\nimport { useCallback } from 'react';\nimport { useNovuUI } from '../../context/NovuUIContext';\nimport { Mounter } from '../Mounter';\n\nexport type DefaultSlackLinkUserProps = Pick<\n SlackLinkUserProps,\n | 'integrationIdentifier'\n | 'connectionIdentifier'\n | 'context'\n | 'onLinkSuccess'\n | 'onLinkError'\n | 'onUnlinkSuccess'\n | 'onUnlinkError'\n | 'linkLabel'\n | 'unlinkLabel'\n>;\n\nexport const DefaultSlackLinkUser = (props: DefaultSlackLinkUserProps) => {\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: 'SlackLinkUser',\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,uBAAuB,CAAC,UAAqC;AACxE,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/slack-link-user/DefaultSlackLinkUser.tsx"],"sourcesContent":["import { SlackLinkUserProps } from '@novu/js/ui';\nimport { useMemo } from 'react';\nimport { Mounter } from '../Mounter';\n\nexport type DefaultSlackLinkUserProps = Pick<\n SlackLinkUserProps,\n | 'integrationIdentifier'\n | 'connectionIdentifier'\n | 'context'\n | 'onLinkSuccess'\n | 'onLinkError'\n | 'onUnlinkSuccess'\n | 'onUnlinkError'\n | 'linkLabel'\n | 'unlinkLabel'\n>;\n\nexport const DefaultSlackLinkUser = (props: DefaultSlackLinkUserProps) => {\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=\"SlackLinkUser\" props={mountProps} />;\n};\n"],"mappings":";AACA,SAAS,eAAe;AACxB,SAAS,eAAe;AAqDf;AAtCF,IAAM,uBAAuB,CAAC,UAAqC;AACxE,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,iBAAgB,OAAO,YAAY;AAC1D;","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 { DefaultSlackLinkUser } from "./DefaultSlackLinkUser.js";
7
6
  import { jsx } from "react/jsx-runtime";
8
- var SlackLinkUserInternal = withRenderer((props) => {
7
+ var SlackLinkUserInternal = (props) => {
9
8
  const { container, appearance, ...defaultProps } = props;
10
9
  const novu = useNovu();
11
10
  const options = useMemo(() => {
@@ -16,7 +15,7 @@ var SlackLinkUserInternal = withRenderer((props) => {
16
15
  };
17
16
  }, [container, appearance, novu.options]);
18
17
  return /* @__PURE__ */ jsx(NovuUI, { options, novu, children: /* @__PURE__ */ jsx(DefaultSlackLinkUser, { ...defaultProps }) });
19
- });
18
+ };
20
19
  SlackLinkUserInternal.displayName = "SlackLinkUserInternal";
21
20
  var SlackLinkUser = React.memo((props) => {
22
21
  return /* @__PURE__ */ jsx(SlackLinkUserInternal, { ...props });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/slack-link-user/SlackLinkUser.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { useNovu } from '../../hooks/NovuProvider';\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\nimport { withRenderer } from '../Renderer';\nimport { DefaultSlackLinkUser, DefaultSlackLinkUserProps } from './DefaultSlackLinkUser';\n\nexport type SlackLinkUserProps = DefaultSlackLinkUserProps & Pick<NovuUIOptions, 'container' | 'appearance'>;\n\nconst SlackLinkUserInternal = withRenderer<SlackLinkUserProps>((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 <DefaultSlackLinkUser {...defaultProps} />\n </NovuUI>\n );\n});\n\nSlackLinkUserInternal.displayName = 'SlackLinkUserInternal';\n\nexport const SlackLinkUser = React.memo((props: SlackLinkUserProps) => {\n return <SlackLinkUserInternal {...props} />;\n});\n\nSlackLinkUser.displayName = 'SlackLinkUser';\n"],"mappings":";AAAA,OAAO,SAAS,eAAe;AAC/B,SAAS,eAAe;AACxB,SAAS,cAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,4BAAuD;AAkB1D;AAdN,IAAM,wBAAwB,aAAiC,CAAC,UAAU;AACxE,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,wBAAsB,GAAG,cAAc,GAC1C;AAEJ,CAAC;AAED,sBAAsB,cAAc;AAE7B,IAAM,gBAAgB,MAAM,KAAK,CAAC,UAA8B;AACrE,SAAO,oBAAC,yBAAuB,GAAG,OAAO;AAC3C,CAAC;AAED,cAAc,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/slack-link-user/SlackLinkUser.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { useNovu } from '../../hooks/NovuProvider';\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\nimport { DefaultSlackLinkUser, DefaultSlackLinkUserProps } from './DefaultSlackLinkUser';\n\nexport type SlackLinkUserProps = DefaultSlackLinkUserProps & Pick<NovuUIOptions, 'container' | 'appearance'>;\n\nconst SlackLinkUserInternal = (props: SlackLinkUserProps) => {\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 <DefaultSlackLinkUser {...defaultProps} />\n </NovuUI>\n );\n};\n\nSlackLinkUserInternal.displayName = 'SlackLinkUserInternal';\n\nexport const SlackLinkUser = React.memo((props: SlackLinkUserProps) => {\n return <SlackLinkUserInternal {...props} />;\n});\n\nSlackLinkUser.displayName = 'SlackLinkUser';\n"],"mappings":";AAAA,OAAO,SAAS,eAAe;AAC/B,SAAS,eAAe;AACxB,SAAS,cAA6B;AACtC,SAAS,4BAAuD;AAkB1D;AAdN,IAAM,wBAAwB,CAAC,UAA8B;AAC3D,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,wBAAsB,GAAG,cAAc,GAC1C;AAEJ;AAEA,sBAAsB,cAAc;AAE7B,IAAM,gBAAgB,MAAM,KAAK,CAAC,UAA8B;AACrE,SAAO,oBAAC,yBAAuB,GAAG,OAAO;AAC3C,CAAC;AAED,cAAc,cAAc;","names":[]}
@@ -1,32 +1,24 @@
1
1
  // src/components/subscription/DefaultSubscription.tsx
2
- import { useCallback } from "react";
3
- import { useNovuUI } from "../../context/NovuUIContext.js";
4
- import { useRenderer } from "../../context/RendererContext.js";
2
+ import { useMemo } from "react";
3
+ import { useOutletRenderer } from "../../hooks/internal/useOutletRenderer.js";
5
4
  import { Mounter } from "../Mounter.js";
6
5
  import { jsx } from "react/jsx-runtime";
7
6
  var DefaultSubscription = (props) => {
8
7
  const { topicKey, identifier, preferences, open, placement, placementOffset, renderPreferences } = props;
9
- const { novuUI } = useNovuUI();
10
- const { mountElement } = useRenderer();
11
- const mount = useCallback(
12
- (element) => {
13
- return novuUI.mountComponent({
14
- name: "Subscription",
15
- props: {
16
- topicKey,
17
- identifier,
18
- preferences,
19
- open,
20
- placementOffset,
21
- placement,
22
- renderPreferences: renderPreferences ? (el, subscription, loading) => mountElement(el, renderPreferences(subscription, loading)) : void 0
23
- },
24
- element
25
- });
26
- },
27
- [topicKey, identifier, preferences, open, placementOffset, placement, renderPreferences, novuUI, mountElement]
8
+ const renderPreferencesOutlet = useOutletRenderer(renderPreferences);
9
+ const mountProps = useMemo(
10
+ () => ({
11
+ topicKey,
12
+ identifier,
13
+ preferences,
14
+ open,
15
+ placementOffset,
16
+ placement,
17
+ renderPreferences: renderPreferencesOutlet
18
+ }),
19
+ [topicKey, identifier, preferences, open, placementOffset, placement, renderPreferencesOutlet]
28
20
  );
29
- return /* @__PURE__ */ jsx(Mounter, { mount });
21
+ return /* @__PURE__ */ jsx(Mounter, { name: "Subscription", props: mountProps });
30
22
  };
31
23
  export {
32
24
  DefaultSubscription
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/subscription/DefaultSubscription.tsx"],"sourcesContent":["import { TopicSubscription } from '@novu/js';\nimport { SubscriptionProps } from '@novu/js/ui';\nimport { useCallback } from 'react';\nimport { useNovuUI } from '../../context/NovuUIContext';\nimport { useRenderer } from '../../context/RendererContext';\nimport { Mounter } from '../Mounter';\n\nexport type PreferencesRenderer = (subscription?: TopicSubscription, loading?: boolean) => React.ReactNode;\n\nexport type DefaultSubscriptionProps = {\n renderPreferences?: PreferencesRenderer;\n} & Pick<SubscriptionProps, 'open' | 'placement' | 'placementOffset' | 'topicKey' | 'identifier' | 'preferences'>;\n\nexport const DefaultSubscription = (props: DefaultSubscriptionProps) => {\n const { topicKey, identifier, preferences, open, placement, placementOffset, renderPreferences } = props;\n const { novuUI } = useNovuUI();\n const { mountElement } = useRenderer();\n\n const mount = useCallback(\n (element: HTMLElement) => {\n return novuUI.mountComponent({\n name: 'Subscription',\n props: {\n topicKey,\n identifier,\n preferences,\n open,\n placementOffset,\n placement,\n renderPreferences: renderPreferences\n ? (el, subscription, loading) => mountElement(el, renderPreferences(subscription, loading))\n : undefined,\n },\n element,\n });\n },\n [topicKey, identifier, preferences, open, placementOffset, placement, renderPreferences, novuUI, mountElement]\n );\n\n return <Mounter mount={mount} />;\n};\n"],"mappings":";AAEA,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AAkCf;AA1BF,IAAM,sBAAsB,CAAC,UAAoC;AACtE,QAAM,EAAE,UAAU,YAAY,aAAa,MAAM,WAAW,iBAAiB,kBAAkB,IAAI;AACnG,QAAM,EAAE,OAAO,IAAI,UAAU;AAC7B,QAAM,EAAE,aAAa,IAAI,YAAY;AAErC,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,mBAAmB,oBACf,CAAC,IAAI,cAAc,YAAY,aAAa,IAAI,kBAAkB,cAAc,OAAO,CAAC,IACxF;AAAA,QACN;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA,CAAC,UAAU,YAAY,aAAa,MAAM,iBAAiB,WAAW,mBAAmB,QAAQ,YAAY;AAAA,EAC/G;AAEA,SAAO,oBAAC,WAAQ,OAAc;AAChC;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/subscription/DefaultSubscription.tsx"],"sourcesContent":["import { TopicSubscription } from '@novu/js';\nimport { SubscriptionProps } from '@novu/js/ui';\nimport { useMemo } from 'react';\nimport { useOutletRenderer } from '../../hooks/internal/useOutletRenderer';\nimport { Mounter } from '../Mounter';\n\nexport type PreferencesRenderer = (subscription?: TopicSubscription, loading?: boolean) => React.ReactNode;\n\nexport type DefaultSubscriptionProps = {\n renderPreferences?: PreferencesRenderer;\n} & Pick<SubscriptionProps, 'open' | 'placement' | 'placementOffset' | 'topicKey' | 'identifier' | 'preferences'>;\n\nexport const DefaultSubscription = (props: DefaultSubscriptionProps) => {\n const { topicKey, identifier, preferences, open, placement, placementOffset, renderPreferences } = props;\n const renderPreferencesOutlet =\n useOutletRenderer<[TopicSubscription | undefined, boolean | undefined]>(renderPreferences);\n\n const mountProps = useMemo(\n () => ({\n topicKey,\n identifier,\n preferences,\n open,\n placementOffset,\n placement,\n renderPreferences: renderPreferencesOutlet,\n }),\n [topicKey, identifier, preferences, open, placementOffset, placement, renderPreferencesOutlet]\n );\n\n return <Mounter name=\"Subscription\" props={mountProps} />;\n};\n"],"mappings":";AAEA,SAAS,eAAe;AACxB,SAAS,yBAAyB;AAClC,SAAS,eAAe;AA0Bf;AAlBF,IAAM,sBAAsB,CAAC,UAAoC;AACtE,QAAM,EAAE,UAAU,YAAY,aAAa,MAAM,WAAW,iBAAiB,kBAAkB,IAAI;AACnG,QAAM,0BACJ,kBAAwE,iBAAiB;AAE3F,QAAM,aAAa;AAAA,IACjB,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,mBAAmB;AAAA,IACrB;AAAA,IACA,CAAC,UAAU,YAAY,aAAa,MAAM,iBAAiB,WAAW,uBAAuB;AAAA,EAC/F;AAEA,SAAO,oBAAC,WAAQ,MAAK,gBAAe,OAAO,YAAY;AACzD;","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 { DefaultSubscription } from "./DefaultSubscription.js";
7
6
  import { jsx } from "react/jsx-runtime";
8
- var SubscriptionInternal = withRenderer((props) => {
7
+ var SubscriptionInternal = (props) => {
9
8
  const { container, localization, appearance, ...defaultSubscriptionProps } = props;
10
9
  const novu = useNovu();
11
10
  const options = useMemo(() => {
@@ -31,7 +30,7 @@ var SubscriptionInternal = withRenderer((props) => {
31
30
  return /* @__PURE__ */ jsx(NovuUI, { options, novu, children: clonedChildren });
32
31
  }
33
32
  return /* @__PURE__ */ jsx(NovuUI, { options, novu, children: /* @__PURE__ */ jsx(DefaultSubscription, { ...defaultSubscriptionProps }) });
34
- });
33
+ };
35
34
  SubscriptionInternal.displayName = "SubscriptionInternal";
36
35
  var Subscription = React.memo((props) => {
37
36
  return /* @__PURE__ */ jsx(SubscriptionInternal, { ...props });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/subscription/Subscription.tsx"],"sourcesContent":["import { SubscriptionLocalization } from '@novu/js/ui';\nimport React, { useMemo } from 'react';\nimport { useNovu } from '../../hooks/NovuProvider';\nimport { ReactSubscriptionAppearance } from '../../utils/types';\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\nimport { withRenderer } from '../Renderer';\nimport { DefaultSubscription, DefaultSubscriptionProps } from './DefaultSubscription';\n\ntype BaseSubscriptionProps = {\n localization?: SubscriptionLocalization;\n appearance?: ReactSubscriptionAppearance;\n} & Pick<NovuUIOptions, 'container'>;\n\ntype SubscriptionPropsWithChildren = {\n children?: React.ReactNode;\n} & Exclude<DefaultSubscriptionProps, 'renderPreferences'> &\n BaseSubscriptionProps;\n\ntype SubscriptionPropsWithoutChildren = {\n children?: never;\n} & DefaultSubscriptionProps &\n BaseSubscriptionProps;\n\nexport type SubscriptionProps = SubscriptionPropsWithChildren | SubscriptionPropsWithoutChildren;\n\nconst SubscriptionInternal = withRenderer<SubscriptionProps>((props) => {\n const { container, localization, appearance, ...defaultSubscriptionProps } = props;\n const novu = useNovu();\n\n const options: NovuUIOptions = useMemo(() => {\n return {\n container,\n localization,\n appearance,\n options: novu.options,\n };\n }, [localization, appearance, container, novu.options]);\n\n if (isWithChildrenProps(props)) {\n const clonedChildren = React.Children.map(props.children, (child) => {\n if (React.isValidElement(child)) {\n return React.cloneElement(child, {\n ...child.props,\n topicKey: defaultSubscriptionProps.topicKey,\n identifier: defaultSubscriptionProps.identifier,\n preferences: defaultSubscriptionProps.preferences,\n });\n }\n\n return child;\n });\n\n return (\n <NovuUI options={options} novu={novu}>\n {clonedChildren}\n </NovuUI>\n );\n }\n\n return (\n <NovuUI options={options} novu={novu}>\n <DefaultSubscription {...defaultSubscriptionProps} />\n </NovuUI>\n );\n});\n\nSubscriptionInternal.displayName = 'SubscriptionInternal';\n\nexport const Subscription = React.memo((props: SubscriptionProps) => {\n return <SubscriptionInternal {...props} />;\n});\n\nfunction isWithChildrenProps(props: SubscriptionProps): props is SubscriptionPropsWithChildren {\n return 'children' in props;\n}\n"],"mappings":";AACA,OAAO,SAAS,eAAe;AAC/B,SAAS,eAAe;AAExB,SAAS,cAA6B;AACtC,SAAS,oBAAoB;AAC7B,SAAS,2BAAqD;AA+CxD;AA5BN,IAAM,uBAAuB,aAAgC,CAAC,UAAU;AACtE,QAAM,EAAE,WAAW,cAAc,YAAY,GAAG,yBAAyB,IAAI;AAC7E,QAAM,OAAO,QAAQ;AAErB,QAAM,UAAyB,QAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,cAAc,YAAY,WAAW,KAAK,OAAO,CAAC;AAEtD,MAAI,oBAAoB,KAAK,GAAG;AAC9B,UAAM,iBAAiB,MAAM,SAAS,IAAI,MAAM,UAAU,CAAC,UAAU;AACnE,UAAI,MAAM,eAAe,KAAK,GAAG;AAC/B,eAAO,MAAM,aAAa,OAAO;AAAA,UAC/B,GAAG,MAAM;AAAA,UACT,UAAU,yBAAyB;AAAA,UACnC,YAAY,yBAAyB;AAAA,UACrC,aAAa,yBAAyB;AAAA,QACxC,CAAC;AAAA,MACH;AAEA,aAAO;AAAA,IACT,CAAC;AAED,WACE,oBAAC,UAAO,SAAkB,MACvB,0BACH;AAAA,EAEJ;AAEA,SACE,oBAAC,UAAO,SAAkB,MACxB,8BAAC,uBAAqB,GAAG,0BAA0B,GACrD;AAEJ,CAAC;AAED,qBAAqB,cAAc;AAE5B,IAAM,eAAe,MAAM,KAAK,CAAC,UAA6B;AACnE,SAAO,oBAAC,wBAAsB,GAAG,OAAO;AAC1C,CAAC;AAED,SAAS,oBAAoB,OAAkE;AAC7F,SAAO,cAAc;AACvB;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/subscription/Subscription.tsx"],"sourcesContent":["import { SubscriptionLocalization } from '@novu/js/ui';\nimport React, { useMemo } from 'react';\nimport { useNovu } from '../../hooks/NovuProvider';\nimport { ReactSubscriptionAppearance } from '../../utils/types';\nimport { NovuUI, NovuUIOptions } from '../NovuUI';\nimport { DefaultSubscription, DefaultSubscriptionProps } from './DefaultSubscription';\n\ntype BaseSubscriptionProps = {\n localization?: SubscriptionLocalization;\n appearance?: ReactSubscriptionAppearance;\n} & Pick<NovuUIOptions, 'container'>;\n\ntype SubscriptionPropsWithChildren = {\n children?: React.ReactNode;\n} & Exclude<DefaultSubscriptionProps, 'renderPreferences'> &\n BaseSubscriptionProps;\n\ntype SubscriptionPropsWithoutChildren = {\n children?: never;\n} & DefaultSubscriptionProps &\n BaseSubscriptionProps;\n\nexport type SubscriptionProps = SubscriptionPropsWithChildren | SubscriptionPropsWithoutChildren;\n\nconst SubscriptionInternal = (props: SubscriptionProps) => {\n const { container, localization, appearance, ...defaultSubscriptionProps } = props;\n const novu = useNovu();\n\n const options: NovuUIOptions = useMemo(() => {\n return {\n container,\n localization,\n appearance,\n options: novu.options,\n };\n }, [localization, appearance, container, novu.options]);\n\n if (isWithChildrenProps(props)) {\n const clonedChildren = React.Children.map(props.children, (child) => {\n if (React.isValidElement(child)) {\n return React.cloneElement(child, {\n ...child.props,\n topicKey: defaultSubscriptionProps.topicKey,\n identifier: defaultSubscriptionProps.identifier,\n preferences: defaultSubscriptionProps.preferences,\n });\n }\n\n return child;\n });\n\n return (\n <NovuUI options={options} novu={novu}>\n {clonedChildren}\n </NovuUI>\n );\n }\n\n return (\n <NovuUI options={options} novu={novu}>\n <DefaultSubscription {...defaultSubscriptionProps} />\n </NovuUI>\n );\n};\n\nSubscriptionInternal.displayName = 'SubscriptionInternal';\n\nexport const Subscription = React.memo((props: SubscriptionProps) => {\n return <SubscriptionInternal {...props} />;\n});\n\nfunction isWithChildrenProps(props: SubscriptionProps): props is SubscriptionPropsWithChildren {\n return 'children' in props;\n}\n"],"mappings":";AACA,OAAO,SAAS,eAAe;AAC/B,SAAS,eAAe;AAExB,SAAS,cAA6B;AACtC,SAAS,2BAAqD;AA+CxD;AA5BN,IAAM,uBAAuB,CAAC,UAA6B;AACzD,QAAM,EAAE,WAAW,cAAc,YAAY,GAAG,yBAAyB,IAAI;AAC7E,QAAM,OAAO,QAAQ;AAErB,QAAM,UAAyB,QAAQ,MAAM;AAC3C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,KAAK;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,cAAc,YAAY,WAAW,KAAK,OAAO,CAAC;AAEtD,MAAI,oBAAoB,KAAK,GAAG;AAC9B,UAAM,iBAAiB,MAAM,SAAS,IAAI,MAAM,UAAU,CAAC,UAAU;AACnE,UAAI,MAAM,eAAe,KAAK,GAAG;AAC/B,eAAO,MAAM,aAAa,OAAO;AAAA,UAC/B,GAAG,MAAM;AAAA,UACT,UAAU,yBAAyB;AAAA,UACnC,YAAY,yBAAyB;AAAA,UACrC,aAAa,yBAAyB;AAAA,QACxC,CAAC;AAAA,MACH;AAEA,aAAO;AAAA,IACT,CAAC;AAED,WACE,oBAAC,UAAO,SAAkB,MACvB,0BACH;AAAA,EAEJ;AAEA,SACE,oBAAC,UAAO,SAAkB,MACxB,8BAAC,uBAAqB,GAAG,0BAA0B,GACrD;AAEJ;AAEA,qBAAqB,cAAc;AAE5B,IAAM,eAAe,MAAM,KAAK,CAAC,UAA6B;AACnE,SAAO,oBAAC,wBAAsB,GAAG,OAAO;AAC1C,CAAC;AAED,SAAS,oBAAoB,OAAkE;AAC7F,SAAO,cAAc;AACvB;","names":[]}
@@ -3,6 +3,6 @@ import { SubscriptionButtonWrapperProps } from '@novu/js/ui';
3
3
  import React__default from 'react';
4
4
 
5
5
  type SubscriptionButtonProps = Partial<SubscriptionButtonWrapperProps>;
6
- declare const SubscriptionButton: React__default.MemoExoticComponent<({ topicKey, identifier, preferences, onClick, onDeleteError, onDeleteSuccess, onCreateError, onCreateSuccess, }: SubscriptionButtonProps) => react_jsx_runtime.JSX.Element>;
6
+ declare const SubscriptionButton: React__default.MemoExoticComponent<({ topicKey, identifier, preferences, onClick, onDeleteError, onDeleteSuccess, onCreateError, onCreateSuccess, }: SubscriptionButtonProps) => react_jsx_runtime.JSX.Element | null>;
7
7
 
8
8
  export { SubscriptionButton, type SubscriptionButtonProps };